summaryrefslogtreecommitdiffstats
path: root/src/core/MenuScreensCustom.cpp
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2021-01-22 21:40:28 +0100
committererorcun <erorcunerorcun@hotmail.com.tr>2021-01-23 14:18:19 +0100
commit1b3284042446551f6ff5a2c723957056131f5f31 (patch)
tree7ea98fd4aa5eb80ef24185f4ec3df373ee91f83d /src/core/MenuScreensCustom.cpp
parentMigrate from old .ini to new .ini (diff)
downloadre3-1b3284042446551f6ff5a2c723957056131f5f31.tar
re3-1b3284042446551f6ff5a2c723957056131f5f31.tar.gz
re3-1b3284042446551f6ff5a2c723957056131f5f31.tar.bz2
re3-1b3284042446551f6ff5a2c723957056131f5f31.tar.lz
re3-1b3284042446551f6ff5a2c723957056131f5f31.tar.xz
re3-1b3284042446551f6ff5a2c723957056131f5f31.tar.zst
re3-1b3284042446551f6ff5a2c723957056131f5f31.zip
Diffstat (limited to 'src/core/MenuScreensCustom.cpp')
-rw-r--r--src/core/MenuScreensCustom.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/core/MenuScreensCustom.cpp b/src/core/MenuScreensCustom.cpp
index d34ff8b9..770e8ec1 100644
--- a/src/core/MenuScreensCustom.cpp
+++ b/src/core/MenuScreensCustom.cpp
@@ -16,6 +16,7 @@
#include "Collision.h"
#include "ModelInfo.h"
#include "Pad.h"
+#include "ControllerConfig.h"
// Menu screens array is at the bottom of the file.
@@ -278,6 +279,7 @@ void ScreenModeAfterChange(int8 before, int8 after)
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
wchar selectedJoystickUnicode[128];
+int cachedButtonNum = -1;
wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
int numButtons;
@@ -306,6 +308,7 @@ wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
strcpy(gSelectedJoystickName, joyname);
PSGLOBAL(joy1id) = found;
+ cachedButtonNum = numButtons;
}
}
if (PSGLOBAL(joy1id) == -1)
@@ -315,6 +318,18 @@ wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
return selectedJoystickUnicode;
}
+
+void DetectJoystickGoBack() {
+ if (cachedButtonNum != -1) {
+#ifdef LOAD_INI_SETTINGS
+ ControlsManager.InitDefaultControlConfigJoyPad(cachedButtonNum);
+ SaveINIControllerSettings();
+#else
+ // Otherwise no way to save gSelectedJoystickName or ms_padButtonsInited anyway :shrug: Why do you even use this config.??
+#endif
+ cachedButtonNum = -1;
+ }
+}
#endif
CMenuScreenCustom aScreens[] = {
@@ -702,8 +717,7 @@ CMenuScreenCustom aScreens[] = {
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
// MENUPAGE_DETECT_JOYSTICK
- { "FEC_JOD", MENUPAGE_CONTROLLER_PC, new CCustomScreenLayout({0, 0, 0, false, false, 30}), nil,
-
+ { "FEC_JOD", MENUPAGE_CONTROLLER_PC, new CCustomScreenLayout({0, 0, 0, false, false, 30}), DetectJoystickGoBack,
MENUACTION_LABEL, "FEC_JPR", { nil, SAVESLOT_NONE, MENUPAGE_NONE }, 0, 0, 0,
MENUACTION_CFO_DYNAMIC, "FEC_JDE", { new CCFODynamic(nil, nil, nil, DetectJoystickDraw, nil) }, 80, 200, MENUALIGN_LEFT,
MENUACTION_GOBACK, "FEDS_TB", {nil, SAVESLOT_NONE, MENUPAGE_NONE}, 320, 225, MENUALIGN_CENTER,