From 747ae0427950b0f0883b46db4f85ca34a684536f Mon Sep 17 00:00:00 2001 From: erorcun Date: Sun, 15 Aug 2021 03:29:49 +0300 Subject: [PATCH] Fix premature .ini saving leading to missing bindings --- src/core/Frontend.cpp | 3 --- src/skel/glfw/glfw.cpp | 10 ++++++---- src/skel/win/win.cpp | 10 ++++++---- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 62c16cd9..b5d12d58 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -3812,9 +3812,6 @@ CMenuManager::LoadSettings() if (LoadINISettings()) { LoadINIControllerSettings(); } - // if no re3.ini, create it, or update it with new values - SaveINISettings(); - SaveINIControllerSettings(); #endif m_PrefsVsync = m_PrefsVsyncDisp; diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 8d3fc7d7..44f0c83a 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -1935,10 +1935,12 @@ main(int argc, char *argv[]) #ifdef LOAD_INI_SETTINGS LoadINIControllerSettings(); - if (connectedPadButtons != 0) { - ControlsManager.InitDefaultControlConfigJoyPad(connectedPadButtons); - SaveINIControllerSettings(); - } + if (connectedPadButtons != 0) + ControlsManager.InitDefaultControlConfigJoyPad(connectedPadButtons); // add (connected-saved) amount of new button assignments on top of ours + + // these have 2 purposes: creating .ini at the start, and adding newly introduced settings to old .ini at the start + SaveINISettings(); + SaveINIControllerSettings(); #endif } diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 01e56701..95ac28aa 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -2181,10 +2181,12 @@ WinMain(HINSTANCE instance, #ifdef LOAD_INI_SETTINGS LoadINIControllerSettings(); - if (connectedPadButtons != 0) { - ControlsManager.InitDefaultControlConfigJoyPad(connectedPadButtons); - SaveINIControllerSettings(); - } + if (connectedPadButtons != 0) + ControlsManager.InitDefaultControlConfigJoyPad(connectedPadButtons); // add (connected-saved) amount of new button assignments on top of ours + + // these have 2 purposes: creating .ini at the start, and adding newly introduced settings to old .ini at the start + SaveINISettings(); + SaveINIControllerSettings(); #endif }