diff options
author | erorcun <erorcunerorcun@hotmail.com.tr> | 2021-01-22 23:40:28 +0300 |
---|---|---|
committer | erorcun <erorcunerorcun@hotmail.com.tr> | 2021-01-22 23:43:49 +0300 |
commit | 226e3b83dafbff6e59b8d351441026c5a6a4bf25 (patch) | |
tree | ff214ec3d124746ae08fba9ef1128f286c89c772 /src/skel/win/win.cpp | |
parent | f6c846d27a419735e641881f9970d01cbd832f77 (diff) |
No more resetting bindings for joypad, create .ini at the first start, joystick hotplug for Linux
Diffstat (limited to 'src/skel/win/win.cpp')
-rw-r--r-- | src/skel/win/win.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 16c37490..3bda4e9d 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -2150,12 +2150,18 @@ WinMain(HINSTANCE instance, ShowWindow(PSGLOBAL(window), cmdShow); UpdateWindow(PSGLOBAL(window)); - // This part is needed because controller initialisation overwrites loaded settings. { CFileMgr::SetDirMyDocuments(); +#ifdef LOAD_INI_SETTINGS + // At this point InitDefaultControlConfigJoyPad must have set all bindings to default and ms_padButtonsInited to number of detected buttons. + // We will load stored bindings below, but let's cache ms_padButtonsInited before LoadINIControllerSettings and LoadSettings clears it, + // so we can add new joy bindings **on top of** stored bindings. + int connectedPadButtons = ControlsManager.ms_padButtonsInited; +#endif + int32 gta3set = CFileMgr::OpenFile("gta3.set", "r"); - + if ( gta3set ) { ControlsManager.LoadSettings(gta3set); @@ -2166,6 +2172,10 @@ WinMain(HINSTANCE instance, #ifdef LOAD_INI_SETTINGS LoadINIControllerSettings(); + if (connectedPadButtons != 0) { + ControlsManager.InitDefaultControlConfigJoyPad(connectedPadButtons); + SaveINIControllerSettings(); + } #endif } |