Skip to content

Commit 8fe8dbe

Browse files
committed
Implemented PADRead game setting
1 parent 22755d5 commit 8fe8dbe

File tree

4 files changed

+52
-1
lines changed

4 files changed

+52
-1
lines changed

driveRoot/apps/RVLoader/boot.dol

288 Bytes
Binary file not shown.

driveRoot/rvloader/themes/main/scripts/gamesview.lua

+18
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ function init()
9999
menuSystem:addEntry("Configure GC2Wiimote", false)
100100
menuSystem:setEntrySelectAction(activateGC2WMapping)
101101
menuSystem:addYesNoEntry("Patch MX chip", false, GamesView.config.YES, GamesView.config.NO)
102+
menuSystem:addEntry("PADRead mode", false)
103+
menuSystem:addEntryOption("Auto", GamesView.hiidra.PADREAD_AUTO)
104+
menuSystem:addEntryOption("Bypass", GamesView.hiidra.PADREAD_BYPASS)
105+
menuSystem:addEntryOption("Redirect", GamesView.hiidra.PADREAD_REDIRECT)
106+
menuSystem:setEntryIncreaseAction(menuSystem.increaseEntryValue)
107+
menuSystem:setEntryDecreaseAction(menuSystem.decreaseEntryValue)
102108
menuSystem:addYesNoEntry("Enable Cheats", false, GamesView.config.YES, GamesView.config.NO)
103109
menuSystem:addEntry("Configure cheats", false)
104110
menuSystem:setEntrySelectAction(activateCheatsConfig)
@@ -109,6 +115,12 @@ function init()
109115
menuSystem:addEntry("Configure GC2Wiimote", false)
110116
menuSystem:setEntrySelectAction(activateGC2WMapping)
111117
menuSystem:addYesNoEntry("Patch MX chip", false, GamesView.config.YES, GamesView.config.NO)
118+
menuSystem:addEntry("PADRead mode", false)
119+
menuSystem:addEntryOption("Auto", GamesView.hiidra.PADREAD_AUTO)
120+
menuSystem:addEntryOption("Bypass", GamesView.hiidra.PADREAD_BYPASS)
121+
menuSystem:addEntryOption("Redirect", GamesView.hiidra.PADREAD_REDIRECT)
122+
menuSystem:setEntryIncreaseAction(menuSystem.increaseEntryValue)
123+
menuSystem:setEntryDecreaseAction(menuSystem.decreaseEntryValue)
112124
menuSystem:addYesNoEntry("Enable Cheats", false, GamesView.config.YES, GamesView.config.NO)
113125
menuSystem:addEntry("Configure cheats", false)
114126
menuSystem:setEntrySelectAction(activateCheatsConfig)
@@ -119,6 +131,12 @@ function init()
119131
menuSystem:addEntry("Configure GC2Wiimote", false)
120132
menuSystem:setEntrySelectAction(activateGC2WMapping)
121133
menuSystem:addYesNoEntry("Patch MX chip", false, GamesView.config.YES, GamesView.config.NO)
134+
menuSystem:addEntry("PADRead mode", false)
135+
menuSystem:addEntryOption("Auto", GamesView.hiidra.PADREAD_AUTO)
136+
menuSystem:addEntryOption("Bypass", GamesView.hiidra.PADREAD_BYPASS)
137+
menuSystem:addEntryOption("Redirect", GamesView.hiidra.PADREAD_REDIRECT)
138+
menuSystem:setEntryIncreaseAction(menuSystem.increaseEntryValue)
139+
menuSystem:setEntryDecreaseAction(menuSystem.decreaseEntryValue)
122140
menuSystem:addYesNoEntry("Enable Cheats", false, GamesView.config.YES, GamesView.config.NO)
123141
menuSystem:addEntry("Configure cheats", false)
124142
menuSystem:setEntrySelectAction(activateCheatsConfig)

main/include/hiidra.h

+8-1
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77

88
#define HIIDRA_MAGIC 0x48445241
99

10-
#define HIIDRA_CFG_VERSION 0x00000003
10+
#define HIIDRA_CFG_VERSION 0x00000004
1111

1212
typedef struct HIIDRA_CFG {
1313
u32 Magicbytes;
1414
u32 Version;
1515
u32 Config;
1616
u64 TitleID;
17+
u32 PADReadMode;
1718
char GamePath[256];
1819
char CheatPath[256];
1920
} HIIDRA_CFG;
@@ -38,6 +39,12 @@ enum hiidraconfig {
3839
HIIDRA_CFG_PATCHMX = (1 << HIIDRA_CFG_BIT_PATCHMX),
3940
};
4041

42+
enum hiidrapadreadmode {
43+
HIIDRA_PADREAD_AUTO = 0,
44+
HIIDRA_PADREAD_BYPASS,
45+
HIIDRA_PADREAD_REDIRECT
46+
};
47+
4148
void forgeKernel(char* kernel, u32 kernelSize, const uint8_t** extraModules, u32 nExtraModules, u32 keepES, u32 keepFS);
4249
int getKernelSize(u32* kernelSize);
4350
int loadKernel(char* kernel, u32* kernelSize, u32* FoundVersion);

main/source/gui/guigamesview.cpp

+26
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,14 @@ void GuiGamesView::initLUA() {
138138
luaSetTableIntField(L, "LANG_DUTCH", NIN_LAN_DUTCH);
139139
lua_settable(L, -3);
140140

141+
//Create GamesView.hiidra table
142+
lua_pushstring(L, "hiidra");
143+
lua_newtable(L);
144+
luaSetTableIntField(L, "PADREAD_AUTO", HIIDRA_PADREAD_AUTO);
145+
luaSetTableIntField(L, "PADREAD_BYPASS", HIIDRA_PADREAD_BYPASS);
146+
luaSetTableIntField(L, "PADREAD_REDIRECT", HIIDRA_PADREAD_REDIRECT);
147+
lua_settable(L, -3);
148+
141149
//Create GamesView.GC2Wiimote
142150
lua_pushstring(L, "GC2Wiimote");
143151
lua_newtable(L);
@@ -242,6 +250,8 @@ void GuiGamesView::openGameConfig(u32 idx) {
242250
gameConfig.setValue("Enable GC2Wiimote", 0);
243251
if (!gameConfig.getValue("Patch MX chip", &tempVal))
244252
gameConfig.setValue("Patch MX chip", 0);
253+
if (!gameConfig.getValue("PADRead mode", &tempVal))
254+
gameConfig.setValue("PADRead mode", HIIDRA_PADREAD_AUTO);
245255
if (!gameConfig.getValue("Enable Cheats", &tempVal))
246256
gameConfig.setValue("Enable Cheats", 0);
247257
break;
@@ -255,6 +265,8 @@ void GuiGamesView::openGameConfig(u32 idx) {
255265
gameConfig.setValue("Enable GC2Wiimote", 0);
256266
if (!gameConfig.getValue("Patch MX chip", &tempVal))
257267
gameConfig.setValue("Patch MX chip", 0);
268+
if (!gameConfig.getValue("PADRead mode", &tempVal))
269+
gameConfig.setValue("PADRead mode", HIIDRA_PADREAD_AUTO);
258270
if (!gameConfig.getValue("Enable Cheats", &tempVal))
259271
gameConfig.setValue("Enable Cheats", 0);
260272
break;
@@ -268,6 +280,8 @@ void GuiGamesView::openGameConfig(u32 idx) {
268280
gameConfig.setValue("Enable GC2Wiimote", 0);
269281
if (!gameConfig.getValue("Patch MX chip", &tempVal))
270282
gameConfig.setValue("Patch MX chip", 0);
283+
if (!gameConfig.getValue("PADRead mode", &tempVal))
284+
gameConfig.setValue("PADRead mode", HIIDRA_PADREAD_AUTO);
271285
if (!gameConfig.getValue("Enable Cheats", &tempVal))
272286
gameConfig.setValue("Enable Cheats", 0);
273287
break;
@@ -580,6 +594,10 @@ int GuiGamesView::lua_bootGame(lua_State* L) {
580594
thisView->gameConfig.getValue("Patch MX chip", &tempVal);
581595
if (tempVal)
582596
cfg.Config |= HIIDRA_CFG_PATCHMX;
597+
598+
tempVal = HIIDRA_PADREAD_AUTO;
599+
thisView->gameConfig.getValue("PADRead mode", &tempVal);
600+
cfg.PADReadMode = tempVal;
583601

584602
//Handle cheats
585603
tempVal = 0;
@@ -720,6 +738,10 @@ int GuiGamesView::lua_bootGame(lua_State* L) {
720738
thisView->gameConfig.getValue("Patch MX chip", &tempVal);
721739
if (tempVal)
722740
cfg.Config |= HIIDRA_CFG_PATCHMX;
741+
742+
tempVal = HIIDRA_PADREAD_AUTO;
743+
thisView->gameConfig.getValue("PADRead mode", &tempVal);
744+
cfg.PADReadMode = tempVal;
723745

724746
//Handle cheats
725747
tempVal = 0;
@@ -777,6 +799,10 @@ int GuiGamesView::lua_bootGame(lua_State* L) {
777799
thisView->gameConfig.getValue("Patch MX chip", &tempVal);
778800
if (tempVal)
779801
cfg.Config |= HIIDRA_CFG_PATCHMX;
802+
803+
tempVal = HIIDRA_PADREAD_AUTO;
804+
thisView->gameConfig.getValue("PADRead mode", &tempVal);
805+
cfg.PADReadMode = tempVal;
780806

781807
//Handle cheats
782808
tempVal = 0;

0 commit comments

Comments
 (0)