Jump to content

Some way to save controllers settings and restore when Windows be reinstalled. Today we need to import plane by plane, controller by controller


Go to solution Solved by Mr_sukebe,

Recommended Posts

Posted (edited)

Hi there,

I'm at work, I can't test right now if DCS will recognize the files "diff.lua" pasted in the Input folder in the Config.

I as asked for ChatGPT to create a script to rename all controller filename changing only the GUID of the device and delete onde ones if exists.

I would like to know if is it possible to only paste the files after a Windows reinstallation or I need to load plane by plane, controller by controller?

Create a file rename.bat, edit, paste the code. Copy and paste the rename.bat in the base of the Config folder.

C:\Users<Username>\Saved Games\DCS\Config\rename.bat

I need the new GUID generated by the OS new installation for each device.

So, I map one airplane with all devices possible, to make DCS generate the diff.lua in the Input folder.

With the new GUIDs, I put in the new GUIDs in the variables and I go to the folder Input and copy and paste the old GUIDs in the respective old GUID variables.

Replace in the script the GUID (Globally Unique Identifier) of all devices you have and execute the bat, or ask for chat GPT to adjust the code for your older devices with older GUID and new GUIDs of devices generated by Windows after the installation.

Make a backup of the Input folder and execute the script.

Best regards.

@echo off
setlocal enabledelayedexpansion

:: === New GUIDs defined by the user ===
set "ControllerID=NEW-GUID-0001"
set "MFD1ID=NEW-GUID-0002"
set "MFD2ID=NEW-GUID-0003"
set "MFD3ID=NEW-GUID-0004"
set "JoystickID=NEW-GUID-0005"
set "WheelID=NEW-GUID-0006"
set "ThrottleID=NEW-GUID-0007"
set "TPRID=NEW-GUID-0008"
set "TPRJSAID=NEW-GUID-0009"

:: === Old GUIDs and device file names ===
set "ControllerName=Controller (Inno GamePad..)"
set "ControllerOld=6A8737F0-25BC-11ee-8001-444553540000"

set "MFD1Name=F16 MFD 1"
set "MFD1Old=A0E15750-A6A2-11ef-8005-444553540000"

set "MFD2Name=F16 MFD 2"
set "MFD2Old=A0E15750-A6A2-11ef-8007-444553540000"

set "MFD3Name=F16 MFD 3"
set "MFD3Old=A0E13040-A6A2-11ef-8004-444553540000"

set "JoystickName=Joystick - HOTAS Warthog"
set "JoystickOld=A0E15750-A6A2-11ef-8006-444553540000"

set "WheelName=Logitech G27 Racing Wheel USB"
set "WheelOld=2A3BFFF0-A6A3-11ef-8001-444553540000"

set "ThrottleName=Throttle - HOTAS Warthog"
set "ThrottleOld=A0E17E60-A6A2-11ef-8008-444553540000"

set "TPRName=TPR T.Pendular Rudder"
set "TPROld=A0E17E60-A6A2-11ef-8009-444553540000"

set "TPRJSName=T-Pendular-Rudder"
set "TPRJSOld=23155230-2508-11ee-8007-444553540000"

:: === Search all Input\*\joystick subfolders ===
for /d %%A in ("Input\*") do (
    set "subdir=%%~fA\joystick"
    if exist "!subdir!" (
        pushd "!subdir!"
        call :processFile "!ControllerName!" "!ControllerOld!" "!ControllerID!"
        call :processFile "!MFD1Name!" "!MFD1Old!" "!MFD1ID!"
        call :processFile "!MFD2Name!" "!MFD2Old!" "!MFD2ID!"
        call :processFile "!MFD3Name!" "!MFD3Old!" "!MFD3ID!"
        call :processFile "!JoystickName!" "!JoystickOld!" "!JoystickID!"
        call :processFile "!WheelName!" "!WheelOld!" "!WheelID!"
        call :processFile "!ThrottleName!" "!ThrottleOld!" "!ThrottleID!"
        call :processFile "!TPRName!" "!TPROld!" "!TPRID!"
        call :processFile "!TPRJSName!" "!TPRJSOld!" "!TPRJSAID!"
        popd
    )
)

goto :eof

:processFile
:: %1 = Base name
:: %2 = Old GUID
:: %3 = New GUID

setlocal enabledelayedexpansion

set "baseName=%~1"
set "oldGUID=%~2"
set "newGUID=%~3"

set "oldFile=%baseName% {%oldGUID%}.diff.lua"
set "newFile=%baseName% {%newGUID%}.diff.lua"
set "plainFile=%baseName%.diff.lua"

:: === Step 1: Find the most recent file among all baseName {GUID}.diff.lua ===
set "mostRecentFile="
set "mostRecentDate=0"

for %%F in ("%baseName% {*.diff.lua") do (
    for /f %%a in ('powershell -command "(Get-Item '%%~fF').LastWriteTime.ToString('yyyyMMddHHmmss')"') do (
        set "fileDate=%%a"
        if "!fileDate!" GTR "!mostRecentDate!" (
            set "mostRecentDate=!fileDate!"
            set "mostRecentFile=%%~fF"
        )
    )
)

:: === Step 2: Delete all less recent files with GUID ===
for %%F in ("%baseName% {*.diff.lua") do (
    if not "%%~fF"=="!mostRecentFile!" (
        echo [DEL] Deleting older file: "%%~fF"
        del /f /q "%%~fF"
    )
)

:: === Step 3: Delete plain file if it's older than the most recent one with GUID ===
if defined mostRecentFile (
    if exist "%plainFile%" (
        for /f %%a in ('powershell -command "(Get-Item '%plainFile%').LastWriteTime.ToString('yyyyMMddHHmmss')"') do set "plainDate=%%a"
        for /f %%a in ('powershell -command "(Get-Item '!mostRecentFile!').LastWriteTime.ToString('yyyyMMddHHmmss')"') do set "recentDate=%%a"

        if "!plainDate!" LSS "!recentDate!" (
            echo [DEL] Deleting older plain file: "%plainFile%"
            del /f /q "%plainFile%"
        ) else (
            echo [SKIP] Plain file is newer than the most recent GUID-based file.
        )
    )
)

:: === Step 4: Rename old GUID file to new one, if it still exists ===
if exist "%oldFile%" (
    echo [OK] Renaming "%oldFile%" to "%newFile%"
    ren "%oldFile%" "%newFile%"
) else (
    echo [INFO] Old GUID file not found: "%oldFile%"
)

endlocal
goto :eof

 

Edited by SilentSierra

CPU: AMD Ryzen 7 9800X3D MOBO: Asus ROG STRIX B650E-E MEM: Kingston FURY Renegade 64GB DDR5 5200MHz SSD: Kingstone Fury Renegade NVME PCIe 4.0 M.2 SSD 4TB GPU: ASUS ROG STRIX RTX 4090 OC CASE: Cooler Master TD500 Mesh WATER COOLER: Cooler Master Master Liquid ML360 Illusion HT: TrackIR 5 VR: HP Reverb G2 V2 HOTAS: TM HOTAS Warthog RUDDER: TPR Rudder Pedals GRIP: TM F/A-18C GRIP WHEELS: Logitech G27 OS: Win 11 Pro 23H2 SIMS: DCS World, Falcon BMS, IL-2 Sturmovik, MSFS2020, Arma 3, Assetto Corsa.

  • Solution
Posted

Pasting the old config files and renaming them with the new controller IDs does work, though it has to be by aircraft aswell.  So if you have 30 aircraft and 12 controllers, that's 360 file renames to do.

  • Like 1

7800x3d, 5080, 64GB, PCIE5 SSD - Oculus Pro - Moza (AB9), Virpil (Alpha, CM3, CM1 and CM2), WW (TOP and CP), TM (MFDs, Pendular Rudder), Tek Creations (F18 panel), Total Controls (Apache MFD), Jetseat 

Posted (edited)

I would not run a random ChatGPT script that does a simple rename and has 100 lines...

You can also just use this:

param(
  [string]$directory,
  [string]$oldName,
  [string]$newName
)

Get-ChildItem -Path $directory -Recurse -Filter $oldName | 
  ForEach-Object {
    Rename-Item -Path $_.FullName -NewName $newName
  }

That is a small powershell script, which does basically the same. It runs through your Config\Input directory and renames all oldName files in there to newName.

How would you use it after you changed your hardware?
- Copy your old Saved Games\DCS\Config\Input folder to your new PC.
- Open DCS, go to the plane of your choice. Save new bindings in any of your devices which then gives you the new GUIDs.
- Then check the new names and run the above script with the old and new filenames. Depending on the number of controllers you have attached, you run it n times.

Edited by Special K
  • Like 3
Posted

The ChatGPT script is more specific:

Script Summary

  1. Defines new device GUIDs
    Sets new GUID values to be used when renaming files.

  2. Defines old device GUIDs and file base names
    Associates each device with its previous GUID and human-readable name.

  3. Scans all Input\*\joystick subfolders
    Iterates through each aircraft or module folder inside Input, looking specifically inside the joystick subfolder.

  4. Processes each device file
    For every defined device (e.g., Controller, MFDs, Joystick), it calls a subroutine :processFile to handle the renaming and cleanup logic.

  5. Inside :processFile subroutine:

    • Identifies all files for that device with {GUID} in the name
      Searches for all files matching the pattern DeviceName {GUID}.diff.lua.

    • Finds the most recent file
      Compares timestamps using PowerShell to determine which file is the newest.

    • Deletes older GUID-based versions
      Keeps only the most recent version, deleting all older ones with different GUIDs.

    • Deletes the plain file (without GUID) if it's older
      If a DeviceName.diff.lua file exists and it's older than the most recent {GUID} file, it gets deleted.

    • Renames the old GUID file to the new GUID
      If a file with the old GUID exists, it gets renamed to match the new GUID.

CPU: AMD Ryzen 7 9800X3D MOBO: Asus ROG STRIX B650E-E MEM: Kingston FURY Renegade 64GB DDR5 5200MHz SSD: Kingstone Fury Renegade NVME PCIe 4.0 M.2 SSD 4TB GPU: ASUS ROG STRIX RTX 4090 OC CASE: Cooler Master TD500 Mesh WATER COOLER: Cooler Master Master Liquid ML360 Illusion HT: TrackIR 5 VR: HP Reverb G2 V2 HOTAS: TM HOTAS Warthog RUDDER: TPR Rudder Pedals GRIP: TM F/A-18C GRIP WHEELS: Logitech G27 OS: Win 11 Pro 23H2 SIMS: DCS World, Falcon BMS, IL-2 Sturmovik, MSFS2020, Arma 3, Assetto Corsa.

Posted

But - you can not just put in random GUIDs??
You need the ones that your system gave to your USB devices.

My script does the subdirectories also btw. It has been used by a couple of people already without issues.

  • Like 1
Posted (edited)

No problem with your script.

I need the new GUID generated by the OS new installation for each device.

So, I map one airplane with all devices possible, to make DCS generate the diff.lua in the Input folder.

With the new GUIDs, I put in the new GUIDs in the variables and I go to the folder Input and copy and paste the old GUIDs in the respective old GUID variables.

Sorry if I wrote the wrong script. I tested it here and it works well. But it's become too complex.

Edited by SilentSierra

CPU: AMD Ryzen 7 9800X3D MOBO: Asus ROG STRIX B650E-E MEM: Kingston FURY Renegade 64GB DDR5 5200MHz SSD: Kingstone Fury Renegade NVME PCIe 4.0 M.2 SSD 4TB GPU: ASUS ROG STRIX RTX 4090 OC CASE: Cooler Master TD500 Mesh WATER COOLER: Cooler Master Master Liquid ML360 Illusion HT: TrackIR 5 VR: HP Reverb G2 V2 HOTAS: TM HOTAS Warthog RUDDER: TPR Rudder Pedals GRIP: TM F/A-18C GRIP WHEELS: Logitech G27 OS: Win 11 Pro 23H2 SIMS: DCS World, Falcon BMS, IL-2 Sturmovik, MSFS2020, Arma 3, Assetto Corsa.

Posted

This app is my script with asteroids.

CPU: AMD Ryzen 7 9800X3D MOBO: Asus ROG STRIX B650E-E MEM: Kingston FURY Renegade 64GB DDR5 5200MHz SSD: Kingstone Fury Renegade NVME PCIe 4.0 M.2 SSD 4TB GPU: ASUS ROG STRIX RTX 4090 OC CASE: Cooler Master TD500 Mesh WATER COOLER: Cooler Master Master Liquid ML360 Illusion HT: TrackIR 5 VR: HP Reverb G2 V2 HOTAS: TM HOTAS Warthog RUDDER: TPR Rudder Pedals GRIP: TM F/A-18C GRIP WHEELS: Logitech G27 OS: Win 11 Pro 23H2 SIMS: DCS World, Falcon BMS, IL-2 Sturmovik, MSFS2020, Arma 3, Assetto Corsa.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...