@@ -6,9 +6,11 @@ require 'scripts/gc+map'
6
6
require ' scripts/topbarcmd'
7
7
8
8
menuSystem = MenuSystem ()
9
+ cheatsMenuSystem = MenuSystem ()
9
10
10
11
function init ()
11
12
showingGameConfig = false
13
+ showingGameCheats = false
12
14
showingGC2Wiimote = false
13
15
showingGCPMapping = false
14
16
@@ -97,20 +99,29 @@ function init()
97
99
menuSystem :addEntry (" Configure GC2Wiimote" , false )
98
100
menuSystem :setEntrySelectAction (activateGC2WMapping )
99
101
menuSystem :addYesNoEntry (" Patch MX chip" , false , GamesView .config .YES , GamesView .config .NO )
102
+ menuSystem :addYesNoEntry (" Enable Cheats" , false , GamesView .config .YES , GamesView .config .NO )
103
+ menuSystem :addEntry (" Configure cheats" , false )
104
+ menuSystem :setEntrySelectAction (activateCheatsConfig )
100
105
elseif GamesView .getGamesType () == GamesView .gameType .WII_CHANNEL then
101
106
menuSystem :addYesNoEntry (" Enable WiFi" , false , GamesView .config .YES , GamesView .config .NO )
102
107
menuSystem :addYesNoEntry (" Enable Bluetooth" , false , GamesView .config .YES , GamesView .config .NO )
103
108
menuSystem :addYesNoEntry (" Enable GC2Wiimote" , false , GamesView .config .YES , GamesView .config .NO )
104
109
menuSystem :addEntry (" Configure GC2Wiimote" , false )
105
110
menuSystem :setEntrySelectAction (activateGC2WMapping )
106
111
menuSystem :addYesNoEntry (" Patch MX chip" , false , GamesView .config .YES , GamesView .config .NO )
112
+ menuSystem :addYesNoEntry (" Enable Cheats" , false , GamesView .config .YES , GamesView .config .NO )
113
+ menuSystem :addEntry (" Configure cheats" , false )
114
+ menuSystem :setEntrySelectAction (activateCheatsConfig )
107
115
elseif GamesView .getGamesType () == GamesView .gameType .WII_VC then
108
116
menuSystem :addYesNoEntry (" Enable WiFi" , false , GamesView .config .YES , GamesView .config .NO )
109
117
menuSystem :addYesNoEntry (" Enable Bluetooth" , false , GamesView .config .YES , GamesView .config .NO )
110
118
menuSystem :addYesNoEntry (" Enable GC2Wiimote" , false , GamesView .config .YES , GamesView .config .NO )
111
119
menuSystem :addEntry (" Configure GC2Wiimote" , false )
112
120
menuSystem :setEntrySelectAction (activateGC2WMapping )
113
121
menuSystem :addYesNoEntry (" Patch MX chip" , false , GamesView .config .YES , GamesView .config .NO )
122
+ menuSystem :addYesNoEntry (" Enable Cheats" , false , GamesView .config .YES , GamesView .config .NO )
123
+ menuSystem :addEntry (" Configure cheats" , false )
124
+ menuSystem :setEntrySelectAction (activateCheatsConfig )
114
125
end
115
126
116
127
fonts = {}
@@ -122,6 +133,12 @@ function init()
122
133
menuSystem .columnWidth = SETTINGS_WIN_WIDTH
123
134
menuSystem .sideMargin = SETTINGS_SIDE_MARGIN
124
135
136
+ cheatsMenuSystem .font = fonts [SETTING_FONT_SIZE ]
137
+ cheatsMenuSystem .lineHeight = SETTING_EL_HEIGHT
138
+ cheatsMenuSystem .columnWidth = SETTINGS_WIN_WIDTH
139
+ cheatsMenuSystem .sideMargin = SETTINGS_SIDE_MARGIN
140
+ cheatsMenuSystem .lineWidth = 280
141
+
125
142
initGC2WiimoteConf ()
126
143
initGCPMapConf ()
127
144
end
@@ -137,6 +154,17 @@ function activateGC2WMapping(index)
137
154
showingGC2Wiimote = true
138
155
end
139
156
157
+ function activateCheatsConfig (index )
158
+ gameCheats = GamesView .readGameCheats (selectedGame )
159
+ cheatsMenuSystem :clearEntries ()
160
+ cheatsMenuSystem :reset ()
161
+ for i = 1 , # gameCheats do
162
+ cheatsMenuSystem :addYesNoEntry (gameCheats [i ], false , GamesView .config .YES , GamesView .config .NO )
163
+ cheatsMenuSystem :setEntryValue (gameCheats [i ], GamesView .getGameConfigValue (" Cheat_" .. GamesView .getCheatNameHash (gameCheats [i ])))
164
+ end
165
+ showingGameCheats = true
166
+ end
167
+
140
168
function draw (onFocus )
141
169
if showingGC2Wiimote then
142
170
topBarSetText (" GC2Wiimote: " .. GamesView .getGameName (selectedGame ))
@@ -216,7 +244,9 @@ function draw(onFocus)
216
244
Gfx .popScissorBox ()
217
245
Gfx .popMatrix ()
218
246
219
- if showingGameConfig then
247
+ if showingGameCheats then
248
+ drawGameCheats (onFocus )
249
+ elseif showingGameConfig then
220
250
drawGameConfig (onFocus )
221
251
end
222
252
end
@@ -236,7 +266,10 @@ function handleInputs(onFocus)
236
266
return
237
267
end
238
268
239
- if showingGameConfig then
269
+ if showingGameCheats then
270
+ handleGameCheats ()
271
+ return
272
+ elseif showingGameConfig then
240
273
handleGameConfig ()
241
274
return
242
275
end
@@ -320,7 +353,6 @@ function handleInputs(onFocus)
320
353
-- Show game config if requested
321
354
if down .BUTTON_B then
322
355
GamesView .openGameConfig (selectedGame )
323
- GamesView .getGameConfigValue (" Enable Bluetooth" )
324
356
configOptions = menuSystem :getEntriesWithOptions ()
325
357
for i = 1 , # configOptions do
326
358
menuSystem :setEntryValue (configOptions [i ], GamesView .getGameConfigValue (configOptions [i ]))
@@ -370,3 +402,33 @@ function handleGameConfig()
370
402
371
403
menuSystem :handleInputs ()
372
404
end
405
+
406
+ function drawGameCheats (onFocus )
407
+ Gfx .pushMatrix ()
408
+ Gfx .identity ()
409
+ Gfx .pushIdentityScissorBox ()
410
+ Gfx .drawRectangle (0 , 0 , Gui .getScreenSize ().x , Gui .getScreenSize ().y , Gfx .RGBA8 (0x00 , 0x00 , 0x00 , 0xA0 ))
411
+ Gfx .translate ((Gui .getScreenSize ().x - SETTINGS_WIN_WIDTH ) / 2 , (Gui .getScreenSize ().y - SETTINGS_WIN_HEIGHT ) / 2 )
412
+ Gfx .pushScissorBox (SETTINGS_WIN_WIDTH , SETTINGS_WIN_HEIGHT )
413
+ Gfx .drawRectangle (0 , 0 , SETTINGS_WIN_WIDTH , SETTINGS_WIN_HEIGHT , Gfx .RGBA8 (0x2D , 0x2D , 0x2D , 0xB0 ))
414
+
415
+ cheatsMenuSystem :printMenu (onFocus )
416
+
417
+ Gfx .popScissorBox ()
418
+ Gfx .popScissorBox ()
419
+ Gfx .popMatrix ()
420
+ end
421
+
422
+ function handleGameCheats ()
423
+ local down = Pad .gendown (0 )
424
+
425
+ if down .BUTTON_B then
426
+ for i = 1 , # gameCheats do
427
+ GamesView .setGameConfigValue (" Cheat_" .. GamesView .getCheatNameHash (gameCheats [i ]), cheatsMenuSystem :getEntryValue (gameCheats [i ]))
428
+ end
429
+ showingGameCheats = false
430
+ return
431
+ end
432
+
433
+ cheatsMenuSystem :handleInputs ()
434
+ end
0 commit comments