diff options
author | Sergeanur <s.anureev@yandex.ua> | 2021-01-23 16:54:46 +0100 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2021-01-23 16:54:46 +0100 |
commit | e9689a0a079bd1d7e5028aa89fd5aeaa5e28ecdf (patch) | |
tree | 0e96dcb221d57e79ffffaeda7b23c530dcd4f8d6 /src/skel/glfw/glfw.cpp | |
parent | Merge remote-tracking branch 'origin/lcs' into lcs (diff) | |
parent | Merge branch 'miami' of https://github.com/GTAmodding/re3 into miami (diff) | |
download | re3-e9689a0a079bd1d7e5028aa89fd5aeaa5e28ecdf.tar re3-e9689a0a079bd1d7e5028aa89fd5aeaa5e28ecdf.tar.gz re3-e9689a0a079bd1d7e5028aa89fd5aeaa5e28ecdf.tar.bz2 re3-e9689a0a079bd1d7e5028aa89fd5aeaa5e28ecdf.tar.lz re3-e9689a0a079bd1d7e5028aa89fd5aeaa5e28ecdf.tar.xz re3-e9689a0a079bd1d7e5028aa89fd5aeaa5e28ecdf.tar.zst re3-e9689a0a079bd1d7e5028aa89fd5aeaa5e28ecdf.zip |
Diffstat (limited to 'src/skel/glfw/glfw.cpp')
-rw-r--r-- | src/skel/glfw/glfw.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 3a070c33..3e7ba0ab 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -1637,6 +1637,13 @@ main(int argc, char *argv[]) { 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("gta_vc.set", "r"); if ( gta3set ) @@ -1646,6 +1653,14 @@ main(int argc, char *argv[]) } CFileMgr::SetDir(""); + +#ifdef LOAD_INI_SETTINGS + LoadINIControllerSettings(); + if (connectedPadButtons != 0) { + ControlsManager.InitDefaultControlConfigJoyPad(connectedPadButtons); + SaveINIControllerSettings(); + } +#endif } #ifdef _WIN32 @@ -2159,6 +2174,12 @@ void joysChangeCB(int jid, int event) #ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS strcpy(gSelectedJoystickName, glfwGetJoystickName(jid)); #endif + // This is behind LOAD_INI_SETTINGS, because otherwise the Init call below will destroy/overwrite your bindings. +#ifdef LOAD_INI_SETTINGS + int count; + glfwGetJoystickButtons(PSGLOBAL(joy1id), &count); + ControlsManager.InitDefaultControlConfigJoyPad(count); +#endif } else if (PSGLOBAL(joy2id) == -1) PSGLOBAL(joy2id) = jid; |