Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Rubberduckycooly
GitHub Repository: Rubberduckycooly/RSDKv5-Decompilation
Path: blob/master/RSDKv5/RSDK/Dev/Debug.cpp
1162 views
1
#include "RSDK/Core/RetroEngine.hpp"
2
3
#if RETRO_PLATFORM == RETRO_WIN
4
#include <Windows.h>
5
6
#undef PRINT_ERROR // causes conflicts
7
#endif
8
#if RETRO_PLATFORM == RETRO_ANDROID
9
#include <android/log.h>
10
#include <locale>
11
#include <codecvt>
12
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
13
#endif
14
15
using namespace RSDK;
16
17
bool32 RSDK::engineDebugMode = true;
18
bool32 RSDK::useEndLine = true;
19
char RSDK::outputString[0x400];
20
21
#if RETRO_REV02
22
int32 RSDK::viewableVarCount = 0;
23
ViewableVariable RSDK::viewableVarList[VIEWVAR_LIST_COUNT];
24
#endif
25
26
DevMenu RSDK::devMenu = DevMenu();
27
28
inline void PrintConsole(const char *message) { printf("%s", message); }
29
30
void RSDK::PrintLog(int32 mode, const char *message, ...)
31
{
32
#if !RETRO_DISABLE_LOG
33
if (engineDebugMode) {
34
// make the full string
35
char tmpStr[0x400];
36
va_list args;
37
va_start(args, message);
38
39
vsnprintf(tmpStr, sizeof(tmpStr), message, args);
40
if (useEndLine)
41
sprintf(outputString, "%.*s\n", (int32)sizeof(tmpStr) - 1, tmpStr);
42
else
43
sprintf(outputString, "%.*s", (int32)sizeof(tmpStr) - 1, tmpStr);
44
va_end(args);
45
46
#if RETRO_REV02
47
switch (mode) {
48
default:
49
case PRINT_NORMAL: break;
50
51
case PRINT_POPUP:
52
if (sceneInfo.state & 3) {
53
CreateEntity(DevOutput->classID, outputString, 0, 0);
54
}
55
break;
56
57
case PRINT_ERROR:
58
if (sceneInfo.state & 3) {
59
engine.storedState = sceneInfo.state;
60
sceneInfo.state = ENGINESTATE_ERRORMSG;
61
}
62
break;
63
64
case PRINT_FATAL:
65
if (sceneInfo.state & 3) {
66
engine.storedState = sceneInfo.state;
67
sceneInfo.state = ENGINESTATE_ERRORMSG_FATAL;
68
}
69
break;
70
71
#if RETRO_REV0U
72
case PRINT_SCRIPTERR:
73
engine.storedState = RSDK::Legacy::gameMode;
74
RSDK::Legacy::gameMode = RSDK::Legacy::ENGINE_SCRIPTERROR;
75
strcpy(RSDK::Legacy::scriptErrorMessage, outputString);
76
break;
77
#endif
78
}
79
#endif
80
if (engine.consoleEnabled) {
81
PrintConsole(outputString);
82
}
83
else {
84
#if RETRO_PLATFORM == RETRO_WIN
85
OutputDebugStringA(outputString);
86
#elif RETRO_PLATFORM == RETRO_ANDROID
87
int32 as = ANDROID_LOG_INFO;
88
switch (mode) {
89
#if RETRO_REV0U
90
case PRINT_SCRIPTERR:
91
#endif
92
case PRINT_ERROR: as = ANDROID_LOG_ERROR; break;
93
case PRINT_FATAL: as = ANDROID_LOG_FATAL; break;
94
default: break;
95
}
96
auto *jni = GetJNISetup();
97
int len = strlen(outputString);
98
jbyteArray array = jni->env->NewByteArray(len); // as per research, this gets freed automatically
99
jni->env->SetByteArrayRegion(array, 0, len, (jbyte *)outputString);
100
jni->env->CallVoidMethod(jni->thiz, writeLog, array, as);
101
#elif RETRO_PLATFORM == RETRO_SWITCH
102
printf("%s", outputString);
103
#endif
104
}
105
106
#if !RETRO_USE_ORIGINAL_CODE && RETRO_PLATFORM != RETRO_ANDROID
107
char logPath[0x100];
108
sprintf_s(logPath, sizeof(logPath), "%slog.txt", SKU::userFileDir);
109
FileIO *file = fOpen(logPath, "a");
110
if (file) {
111
fWrite(&outputString, 1, strlen(outputString), file);
112
fClose(file);
113
}
114
#endif
115
}
116
#endif
117
}
118
119
#if RETRO_REV02
120
void RSDK::AddViewableVariable(const char *name, void *value, int32 type, int32 min, int32 max)
121
{
122
if (viewableVarCount < VIEWVAR_COUNT) {
123
ViewableVariable *viewVar = &viewableVarList[viewableVarCount++];
124
125
strncpy(viewVar->name, name, 0x10);
126
viewVar->value = value;
127
128
switch (type) {
129
case VIEWVAR_BOOL:
130
viewVar->type = VIEWVAR_DISPLAY_BOOL;
131
viewVar->size = sizeof(bool32);
132
break;
133
134
case VIEWVAR_UINT8:
135
viewVar->type = VIEWVAR_DISPLAY_UNSIGNED;
136
viewVar->size = sizeof(uint8);
137
break;
138
139
case VIEWVAR_UINT16:
140
viewVar->type = VIEWVAR_DISPLAY_UNSIGNED;
141
viewVar->size = sizeof(uint16);
142
break;
143
144
case VIEWVAR_UINT32:
145
viewVar->type = VIEWVAR_DISPLAY_UNSIGNED;
146
viewVar->size = sizeof(uint32);
147
break;
148
149
case VIEWVAR_INT8:
150
viewVar->type = VIEWVAR_DISPLAY_SIGNED;
151
viewVar->size = sizeof(int8);
152
break;
153
154
case VIEWVAR_INT16:
155
viewVar->type = VIEWVAR_DISPLAY_SIGNED;
156
viewVar->size = sizeof(int16);
157
break;
158
159
case VIEWVAR_INT32:
160
viewVar->type = VIEWVAR_DISPLAY_SIGNED;
161
viewVar->size = sizeof(int32);
162
break;
163
164
default: break;
165
}
166
167
viewVar->min = min;
168
viewVar->max = max;
169
}
170
}
171
#endif
172
173
#if !RETRO_REV02
174
void RSDK::PrintMessage(void *msg, uint8 type)
175
{
176
useEndLine = false;
177
178
if (msg && engine.consoleEnabled) {
179
switch (type) {
180
case MESSAGE_STRING: PrintLog(PRINT_NORMAL, "%s", (const char *)msg); break;
181
case MESSAGE_INT32: PrintLog(PRINT_NORMAL, "%i", *(int32 *)msg); break;
182
case MESSAGE_UINT32: PrintLog(PRINT_NORMAL, "%i", *(uint32 *)msg, 0); break;
183
case MESSAGE_FLOAT: PrintLog(PRINT_NORMAL, "%f", *(float *)msg); break;
184
default: break;
185
}
186
}
187
188
useEndLine = true;
189
}
190
#endif
191
192
#if !RETRO_USE_ORIGINAL_CODE
193
uint8 touchTimer = 0;
194
195
namespace RSDK
196
{
197
void DevMenu_HandleTouchControls(int8 cornerButton)
198
{
199
bool32 cornerCheck = cornerButton != CORNERBUTTON_START ? !controller[CONT_ANY].keyLeft.down && !controller[CONT_ANY].keyRight.down
200
: !controller[CONT_ANY].keyStart.down;
201
202
if (cornerCheck && !controller[CONT_ANY].keyUp.down && !controller[CONT_ANY].keyDown.down) {
203
for (int32 t = 0; t < touchInfo.count; ++t) {
204
int32 tx = (int32)(touchInfo.x[t] * screens->size.x);
205
int32 ty = (int32)(touchInfo.y[t] * screens->size.y);
206
207
bool32 touchingSlider = cornerButton == CORNERBUTTON_SLIDER && tx > screens->center.x && ty > screens->center.y;
208
209
if (touchInfo.down[t] && (!(touchTimer % 8) || touchingSlider)) {
210
if (tx < screens->center.x) {
211
if (ty >= screens->center.y) {
212
if (!controller[CONT_ANY].keyDown.down)
213
controller[CONT_ANY].keyDown.press = true;
214
215
controller[CONT_ANY].keyDown.down = true;
216
break;
217
}
218
else {
219
if (!controller[CONT_ANY].keyUp.down)
220
controller[CONT_ANY].keyUp.press = true;
221
222
controller[CONT_ANY].keyUp.down = true;
223
break;
224
}
225
}
226
else if (tx > screens->center.x) {
227
if (ty > screens->center.y) {
228
if (cornerButton == CORNERBUTTON_START) {
229
if (!controller[CONT_ANY].keyStart.down)
230
controller[CONT_ANY].keyStart.press = true;
231
232
controller[CONT_ANY].keyStart.down = true;
233
}
234
else {
235
if (tx < screens->size.x * 0.75) {
236
if (!controller[CONT_ANY].keyLeft.down)
237
controller[CONT_ANY].keyLeft.press = true;
238
239
controller[CONT_ANY].keyLeft.down = true;
240
}
241
else {
242
if (!controller[CONT_ANY].keyRight.down)
243
controller[CONT_ANY].keyRight.press = true;
244
245
controller[CONT_ANY].keyRight.down = true;
246
break;
247
}
248
}
249
break;
250
}
251
else {
252
if (!controller[CONT_ANY].keyB.down)
253
controller[CONT_ANY].keyB.press = true;
254
255
controller[CONT_ANY].keyB.down = true;
256
break;
257
}
258
}
259
}
260
}
261
}
262
263
touchTimer++;
264
}
265
} // namespace RSDK
266
#endif
267
268
void RSDK::OpenDevMenu()
269
{
270
devMenu.state = DevMenu_MainMenu;
271
devMenu.selection = 0;
272
devMenu.scrollPos = 0;
273
devMenu.timer = 0;
274
275
#if RETRO_REV0U
276
switch (engine.version) {
277
default: break;
278
279
case 5:
280
devMenu.sceneState = sceneInfo.state;
281
videoSettings.screenCount = sceneInfo.state == ENGINESTATE_VIDEOPLAYBACK ? 1 : videoSettings.screenCount;
282
sceneInfo.state = ENGINESTATE_DEVMENU;
283
break;
284
285
case 4:
286
case 3:
287
devMenu.sceneState = RSDK::Legacy::gameMode;
288
RSDK::Legacy::gameMode = RSDK::Legacy::ENGINE_DEVMENU;
289
break;
290
}
291
#if RETRO_USE_MOD_LOADER
292
devMenu.startingVersion = engine.version;
293
#endif
294
#else
295
devMenu.sceneState = sceneInfo.state;
296
videoSettings.screenCount = sceneInfo.state == ENGINESTATE_VIDEOPLAYBACK ? 1 : videoSettings.screenCount;
297
sceneInfo.state = ENGINESTATE_DEVMENU;
298
#endif
299
300
PauseSound();
301
}
302
303
void RSDK::CloseDevMenu()
304
{
305
#if RETRO_REV0U
306
switch (engine.version) {
307
default: break;
308
case 5:
309
videoSettings.screenCount = sceneInfo.state == ENGINESTATE_VIDEOPLAYBACK ? 0 : videoSettings.screenCount;
310
sceneInfo.state = devMenu.sceneState;
311
break;
312
case 4:
313
case 3: RSDK::Legacy::gameMode = devMenu.sceneState; break;
314
}
315
#else
316
videoSettings.screenCount = sceneInfo.state == ENGINESTATE_VIDEOPLAYBACK ? 0 : videoSettings.screenCount;
317
sceneInfo.state = devMenu.sceneState;
318
#endif
319
320
#if RETRO_USE_MOD_LOADER
321
if (devMenu.modMenuCalled) {
322
devMenu.modMenuCalled = false;
323
324
if (!CheckValidScene()) {
325
sceneInfo.activeCategory = 0;
326
sceneInfo.listPos = 0;
327
}
328
329
#if RETRO_REV0U
330
switch (engine.version) {
331
default: break;
332
case 5: LoadScene(); break;
333
case 4:
334
case 3:
335
RSDK::Legacy::ResetCurrentStageFolder();
336
RSDK::Legacy::stageMode = RSDK::Legacy::STAGEMODE_LOAD;
337
break;
338
}
339
#else
340
LoadScene();
341
#endif
342
}
343
#endif
344
345
ResumeSound();
346
}
347
348
#if RETRO_USE_MOD_LOADER
349
void RSDK::OpenModMenu()
350
{
351
LoadMods(true); // reload our mod list real quick
352
if (modList.size() != 0) {
353
OpenDevMenu();
354
devMenu.state = DevMenu_ModsMenu;
355
devMenu.modMenuCalled = true;
356
}
357
else {
358
#if RETRO_REV0U
359
switch (engine.version) {
360
default: break;
361
case 5: LoadScene(); break;
362
case 4:
363
case 3: RSDK::Legacy::stageMode = RSDK::Legacy::STAGEMODE_LOAD; break;
364
}
365
#else
366
LoadScene();
367
#endif
368
}
369
}
370
#endif
371
372
void RSDK::DevMenu_MainMenu()
373
{
374
#if !RETRO_USE_MOD_LOADER
375
const int32 selectionCount = 5;
376
uint32 selectionColors[] = { 0x808090, 0x808090, 0x808090, 0x808090, 0x808090 };
377
const char *selectionNames[] = { "Resume", "Restart", "Stage Select", "Options", "Exit" };
378
#else
379
const int32 selectionCount = 6;
380
uint32 selectionColors[] = { 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090 };
381
const char *selectionNames[] = { "Resume", "Restart", "Stage Select", "Options", "Mods", "Exit" };
382
#endif
383
selectionColors[devMenu.selection] = 0xF0F0F0;
384
385
// Info Box
386
int32 y = currentScreen->center.y - 80;
387
DrawRectangle(currentScreen->center.x - 128, currentScreen->center.y - 84, 0x100, 0x30, 0x80, 0xFF, INK_NONE, true);
388
DrawDevString("RETRO ENGINE " ENGINE_V_NAME, currentScreen->center.x, y, ALIGN_CENTER, 0xF0F0F0);
389
390
y += 8;
391
DrawDevString("Dev Menu", currentScreen->center.x, y, ALIGN_CENTER, 0xF0F0F0);
392
393
y += 8;
394
#if RETRO_USE_MOD_LOADER
395
if (devMenu.modsChanged)
396
DrawDevString("Game will restart on resume!", currentScreen->center.x, y, ALIGN_CENTER, 0xF08080);
397
#ifdef RETRO_DEV_EXTRA
398
else
399
DrawDevString(RETRO_DEV_EXTRA, currentScreen->center.x, y, ALIGN_CENTER, 0x808090);
400
#endif
401
#endif
402
y += 8;
403
DrawDevString(gameVerInfo.gameTitle, currentScreen->center.x, y, ALIGN_CENTER, 0x808090);
404
405
y += 8;
406
DrawDevString(gameVerInfo.version, currentScreen->center.x, y, ALIGN_CENTER, 0x808090);
407
408
// Selections Box
409
y += 24;
410
DrawRectangle(currentScreen->center.x - 128, y - 8, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);
411
412
for (int32 i = 0; i < selectionCount; ++i) {
413
DrawDevString(selectionNames[i], currentScreen->center.x, y, ALIGN_CENTER, selectionColors[i]);
414
#if RETRO_USE_MOD_LOADER
415
y += 10;
416
#else
417
y += 12;
418
#endif
419
}
420
y += 20;
421
422
// Storage box
423
424
// Stage Storage
425
int32 stgUsed = (int32)((sizeof(int32) * dataStorage[DATASET_STG].usedStorage) / (float)dataStorage[DATASET_STG].storageLimit * 126.0);
426
DrawRectangle(currentScreen->center.x - 40, y, 0x80, 0x08, 0x80, 0xFF, INK_NONE, true);
427
DrawRectangle(currentScreen->center.x - 39, y + 1, stgUsed, 6, 0xF0F0F0, 0xFF, INK_NONE, true);
428
DrawDevString("STG", currentScreen->center.x - 64, y, 0, 0xF0F080);
429
430
// Music Storage
431
int32 musUsed = (int32)((sizeof(int32) * dataStorage[DATASET_MUS].usedStorage) / (float)dataStorage[DATASET_MUS].storageLimit * 126.0);
432
y += 10;
433
DrawRectangle(currentScreen->center.x - 40, y, 0x80, 0x08, 0x80, 0xFF5, INK_NONE, true);
434
DrawRectangle(currentScreen->center.x - 39, y + 1, musUsed, 6, 0xF0F0F0, 0xFF, INK_NONE, true);
435
DrawDevString("MUS", currentScreen->center.x - 64, y, 0, 0xF0F080);
436
437
// SoundFX Storage
438
int32 sfxUsed = (int32)((sizeof(int32) * dataStorage[DATASET_SFX].usedStorage) / (float)dataStorage[DATASET_SFX].storageLimit * 126.0);
439
y += 10;
440
DrawRectangle(currentScreen->center.x - 40, y, 0x80, 0x08, 0x80, 0xFF, INK_NONE, true);
441
DrawRectangle(currentScreen->center.x - 39, y + 1, sfxUsed, 6, 0xF0F0F0, 0xFF, INK_NONE, true);
442
DrawDevString("SFX", currentScreen->center.x - 64, y, 0, 0xF0F080);
443
444
// String Storage
445
int32 strUsed = (int32)((sizeof(int32) * dataStorage[DATASET_STR].usedStorage) / (float)dataStorage[DATASET_STR].storageLimit * 126.0);
446
y += 10;
447
DrawRectangle(currentScreen->center.x - 40, y, 0x80, 0x08, 0x80, 0xFF, INK_NONE, true);
448
DrawRectangle(currentScreen->center.x - 39, y + 1, strUsed, 6, 0xF0F0F0, 0xFF, INK_NONE, true);
449
DrawDevString("STR", currentScreen->center.x - 64, y, 0, 0xF0F080);
450
451
// Temp Storage
452
int32 tmpUsed = (int32)((sizeof(int32) * dataStorage[DATASET_TMP].usedStorage) / (float)dataStorage[DATASET_TMP].storageLimit * 126.0);
453
y += 10;
454
DrawRectangle(currentScreen->center.x - 40, y, 0x80, 0x08, 0x80, 0xFF, INK_NONE, true);
455
DrawRectangle(currentScreen->center.x - 39, y + 1, tmpUsed, 6, 0xF0F0F0, 0xFF, INK_NONE, true);
456
DrawDevString("TMP", currentScreen->center.x - 64, y, 0, 0xF0F080);
457
458
#if !RETRO_USE_ORIGINAL_CODE
459
DevMenu_HandleTouchControls(CORNERBUTTON_START);
460
#endif
461
462
if (controller[CONT_ANY].keyUp.press) {
463
devMenu.selection--;
464
devMenu.timer = 1;
465
466
if (devMenu.selection < 0)
467
devMenu.selection += selectionCount;
468
}
469
else if (controller[CONT_ANY].keyUp.down) {
470
if (devMenu.timer) {
471
devMenu.timer = ++devMenu.timer & 7;
472
}
473
else {
474
devMenu.selection--;
475
devMenu.timer = ++devMenu.timer & 7;
476
477
if (devMenu.selection < 0)
478
devMenu.selection += selectionCount;
479
}
480
}
481
482
if (controller[CONT_ANY].keyDown.press) {
483
devMenu.selection++;
484
devMenu.timer = 1;
485
486
if (devMenu.selection >= selectionCount)
487
devMenu.selection -= selectionCount;
488
}
489
else if (controller[CONT_ANY].keyDown.down) {
490
if (devMenu.timer) {
491
devMenu.timer = ++devMenu.timer & 7;
492
}
493
else {
494
devMenu.selection++;
495
devMenu.timer = ++devMenu.timer & 7;
496
497
if (devMenu.selection >= selectionCount)
498
devMenu.selection -= selectionCount;
499
}
500
}
501
502
bool32 confirm = controller[CONT_ANY].keyA.press;
503
#if RETRO_REV02
504
if (SKU::userCore->GetConfirmButtonFlip())
505
#else
506
if (SKU::GetConfirmButtonFlip())
507
#endif
508
confirm = controller[CONT_ANY].keyB.press;
509
510
if (controller[CONT_ANY].keyStart.press || confirm) {
511
#if RETRO_USE_MOD_LOADER && RETRO_REV0U
512
if (devMenu.selection <= 1 && devMenu.startingVersion != engine.version) {
513
// goofy aaa hack
514
RSDK::Legacy::stageMode = RSDK::Legacy::STAGEMODE_NORMAL;
515
devMenu.selection = 0;
516
}
517
#endif
518
switch (devMenu.selection) {
519
case 0: CloseDevMenu(); break;
520
521
case 1:
522
#if RETRO_REV0U
523
switch (engine.version) {
524
default: break;
525
case 5: sceneInfo.state = ENGINESTATE_LOAD; break;
526
527
case 4:
528
case 3:
529
RSDK::Legacy::gameMode = RSDK::Legacy::ENGINE_MAINGAME;
530
RSDK::Legacy::stageMode = RSDK::Legacy::STAGEMODE_LOAD;
531
break;
532
}
533
#else
534
sceneInfo.state = ENGINESTATE_LOAD;
535
#endif
536
break;
537
538
case 2:
539
#if RETRO_REV0U && RETRO_USE_MOD_LOADER
540
if (engine.version == 5) {
541
devMenu.state = DevMenu_CategorySelectMenu;
542
devMenu.selection = 0;
543
devMenu.timer = 1;
544
}
545
else {
546
devMenu.state = DevMenu_PlayerSelectMenu;
547
devMenu.scrollPos = 0;
548
devMenu.selection = 0;
549
}
550
#else
551
devMenu.state = DevMenu_CategorySelectMenu;
552
devMenu.selection = 0;
553
devMenu.timer = 1;
554
#endif
555
break;
556
557
case 3:
558
devMenu.state = DevMenu_OptionsMenu;
559
devMenu.selection = 0;
560
devMenu.timer = 1;
561
break;
562
563
#if !RETRO_USE_MOD_LOADER
564
case 4: RenderDevice::isRunning = false; break;
565
#else
566
case 4:
567
LoadMods(true); // reload our mod list real quick
568
if (modList.size() != 0) {
569
devMenu.state = DevMenu_ModsMenu;
570
devMenu.selection = 0;
571
devMenu.timer = 1;
572
}
573
break;
574
575
case 5: RenderDevice::isRunning = false; break;
576
#endif
577
578
default: break;
579
}
580
}
581
#if !RETRO_USE_ORIGINAL_CODE
582
#if RETRO_REV02
583
else if (SKU::userCore->GetConfirmButtonFlip() ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {
584
#else
585
else if (SKU::GetConfirmButtonFlip() ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {
586
#endif
587
CloseDevMenu();
588
}
589
#endif
590
}
591
void RSDK::DevMenu_CategorySelectMenu()
592
{
593
uint32 selectionColors[] = {
594
0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090,
595
};
596
selectionColors[devMenu.selection - devMenu.scrollPos] = 0xF0F0F0;
597
598
int32 dy = currentScreen->center.y;
599
DrawRectangle(currentScreen->center.x - 128, dy - 84, 0x100, 0x30, 0x80, 0xFF, INK_NONE, true);
600
601
dy -= 68;
602
DrawDevString("SELECT STAGE CATEGORY", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F0F0);
603
DrawRectangle(currentScreen->center.x - 128, dy + 36, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);
604
605
int32 y = dy + 40;
606
for (int32 i = 0; i < 8; ++i) {
607
if (devMenu.scrollPos + i < sceneInfo.categoryCount) {
608
DrawDevString(sceneInfo.listCategory[devMenu.scrollPos + i].name, currentScreen->center.x - 64, y, ALIGN_LEFT, selectionColors[i]);
609
y += 8;
610
}
611
}
612
613
#if !RETRO_USE_ORIGINAL_CODE
614
DevMenu_HandleTouchControls(CORNERBUTTON_START);
615
#endif
616
617
if (controller[CONT_ANY].keyUp.press) {
618
if (--devMenu.selection < 0)
619
devMenu.selection += sceneInfo.categoryCount;
620
621
if (devMenu.selection >= devMenu.scrollPos) {
622
if (devMenu.selection > devMenu.scrollPos + 7)
623
devMenu.scrollPos = devMenu.selection - 7;
624
}
625
else {
626
devMenu.scrollPos = devMenu.selection;
627
}
628
629
devMenu.timer = 1;
630
}
631
else if (controller[CONT_ANY].keyUp.down) {
632
if (devMenu.timer) {
633
devMenu.timer = (devMenu.timer + 1) & 7;
634
635
if (devMenu.selection >= devMenu.scrollPos) {
636
if (devMenu.selection > devMenu.scrollPos + 7)
637
devMenu.scrollPos = devMenu.selection - 7;
638
}
639
else {
640
devMenu.scrollPos = devMenu.selection;
641
}
642
}
643
else {
644
if (--devMenu.selection < 0)
645
devMenu.selection += sceneInfo.categoryCount;
646
647
devMenu.timer = (devMenu.timer + 1) & 7;
648
649
if (devMenu.selection >= devMenu.scrollPos) {
650
if (devMenu.selection > devMenu.scrollPos + 7)
651
devMenu.scrollPos = devMenu.selection - 7;
652
}
653
else {
654
devMenu.scrollPos = devMenu.selection;
655
}
656
}
657
}
658
659
if (controller[CONT_ANY].keyDown.press) {
660
if (++devMenu.selection == sceneInfo.categoryCount)
661
devMenu.selection = 0;
662
663
if (devMenu.selection >= devMenu.scrollPos) {
664
if (devMenu.selection > devMenu.scrollPos + 7)
665
devMenu.scrollPos = devMenu.selection - 7;
666
}
667
else {
668
devMenu.scrollPos = devMenu.selection;
669
}
670
671
devMenu.timer = 1;
672
}
673
else if (controller[CONT_ANY].keyDown.down) {
674
if (devMenu.timer) {
675
devMenu.timer = (devMenu.timer + 1) & 7;
676
677
if (devMenu.selection >= devMenu.scrollPos) {
678
if (devMenu.selection > devMenu.scrollPos + 7)
679
devMenu.scrollPos = devMenu.selection - 7;
680
}
681
else {
682
devMenu.scrollPos = devMenu.selection;
683
}
684
}
685
else {
686
if (++devMenu.selection == sceneInfo.categoryCount)
687
devMenu.selection = 0;
688
689
devMenu.timer = (devMenu.timer + 1) & 7;
690
691
if (devMenu.selection >= devMenu.scrollPos) {
692
if (devMenu.selection > devMenu.scrollPos + 7)
693
devMenu.scrollPos = devMenu.selection - 7;
694
}
695
else {
696
devMenu.scrollPos = devMenu.selection;
697
}
698
}
699
}
700
701
bool32 confirm = controller[CONT_ANY].keyA.press;
702
#if RETRO_REV02
703
bool32 swap = SKU::userCore->GetConfirmButtonFlip();
704
#else
705
bool32 swap = SKU::GetConfirmButtonFlip();
706
#endif
707
if (swap)
708
confirm = controller[CONT_ANY].keyB.press;
709
710
if (controller[CONT_ANY].keyStart.press || confirm) {
711
if (sceneInfo.listCategory[devMenu.selection].sceneCount) {
712
devMenu.state = DevMenu_SceneSelectMenu;
713
devMenu.listPos = devMenu.selection;
714
devMenu.scrollPos = 0;
715
devMenu.selection = 0;
716
}
717
}
718
#if !RETRO_USE_ORIGINAL_CODE
719
else if (swap ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {
720
#if RETRO_REV0U && RETRO_USE_MOD_LOADER
721
if (engine.version == 5) {
722
devMenu.state = DevMenu_MainMenu;
723
devMenu.listPos = 0;
724
devMenu.scrollPos = 0;
725
devMenu.selection = 2;
726
}
727
else {
728
devMenu.state = DevMenu_PlayerSelectMenu;
729
devMenu.listPos = 0;
730
devMenu.scrollPos = 0;
731
devMenu.selection = 0;
732
}
733
#else
734
devMenu.state = DevMenu_MainMenu;
735
devMenu.listPos = 0;
736
devMenu.scrollPos = 0;
737
devMenu.selection = 2;
738
#endif //! RETRO_REV0U && RETRO_USE_MOD_LOADER
739
}
740
#endif // ! !RETRO_USE_ORIGINAL_CODE
741
}
742
void RSDK::DevMenu_SceneSelectMenu()
743
{
744
uint32 selectionColors[] = {
745
0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090,
746
};
747
selectionColors[devMenu.selection - devMenu.scrollPos] = 0xF0F0F0;
748
749
int32 dy = currentScreen->center.y;
750
DrawRectangle(currentScreen->center.x - 128, dy - 84, 0x100, 0x30, 0x80, 0xFF, INK_NONE, true);
751
752
dy -= 68;
753
DrawDevString("SELECT STAGE SCENE", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F0F0);
754
DrawRectangle(currentScreen->center.x - 128, dy + 36, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);
755
756
int32 y = dy + 40;
757
SceneListInfo *list = &sceneInfo.listCategory[devMenu.listPos];
758
int32 start = list->sceneOffsetStart;
759
for (int32 i = 0; i < 8; ++i) {
760
if (devMenu.scrollPos + i < list->sceneCount) {
761
DrawDevString(sceneInfo.listData[start + (devMenu.scrollPos + i)].name, currentScreen->center.x + 96, y, ALIGN_RIGHT, selectionColors[i]);
762
y += 8;
763
devMenu.scrollPos = devMenu.scrollPos; //? look into
764
}
765
}
766
767
#if !RETRO_USE_ORIGINAL_CODE
768
DevMenu_HandleTouchControls(CORNERBUTTON_START);
769
#endif
770
771
if (controller[CONT_ANY].keyUp.press) {
772
if (start + --devMenu.selection < list->sceneOffsetStart)
773
devMenu.selection = list->sceneCount - 1;
774
775
if (devMenu.selection >= devMenu.scrollPos) {
776
if (devMenu.selection > devMenu.scrollPos + 7) {
777
devMenu.scrollPos = devMenu.selection - 7;
778
}
779
}
780
else {
781
devMenu.scrollPos = devMenu.selection;
782
}
783
784
devMenu.timer = 1;
785
}
786
else if (controller[CONT_ANY].keyUp.down) {
787
if (!devMenu.timer && start + --devMenu.selection < list->sceneOffsetStart)
788
devMenu.selection = list->sceneCount - 1;
789
790
devMenu.timer = (devMenu.timer + 1) & 7;
791
792
if (devMenu.selection >= devMenu.scrollPos) {
793
if (devMenu.selection > devMenu.scrollPos + 7)
794
devMenu.scrollPos = devMenu.selection - 7;
795
}
796
else {
797
devMenu.scrollPos = devMenu.selection;
798
}
799
}
800
801
if (controller[CONT_ANY].keyDown.press) {
802
if (++devMenu.selection >= list->sceneCount)
803
devMenu.selection = 0;
804
805
if (devMenu.selection >= devMenu.scrollPos) {
806
if (devMenu.selection > devMenu.scrollPos + 7)
807
devMenu.scrollPos = devMenu.selection - 7;
808
}
809
else {
810
devMenu.scrollPos = devMenu.selection;
811
}
812
813
devMenu.timer = 1;
814
}
815
else if (controller[CONT_ANY].keyDown.down) {
816
if (!devMenu.timer && ++devMenu.selection >= list->sceneCount)
817
devMenu.selection = 0;
818
819
devMenu.timer = (devMenu.timer + 1) & 7;
820
821
if (devMenu.selection >= devMenu.scrollPos) {
822
if (devMenu.selection > devMenu.scrollPos + 7)
823
devMenu.scrollPos = devMenu.selection - 7;
824
}
825
else {
826
devMenu.scrollPos = devMenu.selection;
827
}
828
}
829
830
bool32 confirm = controller[CONT_ANY].keyA.press;
831
#if RETRO_REV02
832
bool32 swap = SKU::userCore->GetConfirmButtonFlip();
833
#else
834
bool32 swap = SKU::GetConfirmButtonFlip();
835
#endif
836
if (swap)
837
confirm = controller[CONT_ANY].keyB.press;
838
839
if (controller[CONT_ANY].keyStart.press || confirm) {
840
841
#if RETRO_REV02
842
// they hardcoded a check in here that forces you to own the encore DLC to select encore mode stages
843
bool32 disabled = strcmp(list->name, "Encore Mode") == 0 && !SKU::userCore->CheckDLC(0);
844
#else
845
bool32 disabled = false;
846
#endif
847
848
if (!disabled) {
849
sceneInfo.activeCategory = devMenu.listPos;
850
sceneInfo.listPos = devMenu.selection + list->sceneOffsetStart;
851
852
#if RETRO_REV0U
853
switch (engine.version) {
854
default: break;
855
case 5: sceneInfo.state = ENGINESTATE_LOAD; break;
856
case 4:
857
case 3:
858
#if !RETRO_USE_ORIGINAL_CODE
859
RSDK::Legacy::debugMode = confirm;
860
#endif
861
#if RETRO_USE_MOD_LOADER
862
switch (engine.version) {
863
case 3: RSDK::Legacy::v3::playerListPos = devMenu.playerListPos; break;
864
case 4: RSDK::Legacy::v4::playerListPos = devMenu.playerListPos; break;
865
}
866
#endif
867
RSDK::Legacy::gameMode = RSDK::Legacy::ENGINE_MAINGAME;
868
RSDK::Legacy::stageMode = RSDK::Legacy::STAGEMODE_LOAD;
869
break;
870
}
871
#else
872
sceneInfo.state = ENGINESTATE_LOAD;
873
#endif //! RETRO_REV0U
874
875
// Bug Details(?):
876
// rev01 had this here, rev02 does not.
877
// This can cause an annoying popup when starting a stage
878
#if !RETRO_REV02
879
AssignInputSlotToDevice(CONT_P1, INPUT_AUTOASSIGN);
880
#endif
881
}
882
}
883
#if !RETRO_USE_ORIGINAL_CODE
884
else if (swap ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {
885
devMenu.state = DevMenu_CategorySelectMenu;
886
devMenu.scrollPos = 0;
887
devMenu.selection = 0;
888
devMenu.listPos = 0;
889
}
890
#endif
891
}
892
void RSDK::DevMenu_OptionsMenu()
893
{
894
const uint8 selectionCount = RETRO_REV02 ? 5 : 4;
895
#if RETRO_REV02
896
uint32 selectionColors[] = { 0x808090, 0x808090, 0x808090, 0x808090, 0x808090 };
897
#else
898
uint32 selectionColors[] = { 0x808090, 0x808090, 0x808090, 0x808090 };
899
#endif
900
selectionColors[devMenu.selection] = 0xF0F0F0;
901
902
int32 dy = currentScreen->center.y;
903
DrawRectangle(currentScreen->center.x - 128, dy - 84, 256, 0x30, 0x80, 0xFF, INK_NONE, true);
904
905
dy -= 68;
906
DrawDevString("OPTIONS", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F0F0);
907
908
dy += 44;
909
DrawRectangle(currentScreen->center.x - 128, dy - 8, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);
910
911
DrawDevString("Video Settings", currentScreen->center.x, dy, ALIGN_CENTER, selectionColors[0]);
912
913
dy += 12;
914
DrawDevString("Audio Settings", currentScreen->center.x, dy, ALIGN_CENTER, selectionColors[1]);
915
916
dy += 12;
917
DrawDevString("Configure Input", currentScreen->center.x, dy, ALIGN_CENTER, selectionColors[2]);
918
919
#if RETRO_REV02
920
dy += 12;
921
DrawDevString("Debug Flags", currentScreen->center.x, dy, ALIGN_CENTER, selectionColors[3]);
922
923
#endif
924
DrawDevString("Back", currentScreen->center.x, dy + 12, ALIGN_CENTER, selectionColors[selectionCount - 1]);
925
926
#if !RETRO_USE_ORIGINAL_CODE
927
DevMenu_HandleTouchControls(CORNERBUTTON_START);
928
#endif
929
930
if (controller[CONT_ANY].keyUp.press) {
931
if (--devMenu.selection < 0)
932
devMenu.selection = selectionCount - 1;
933
934
devMenu.timer = 1;
935
}
936
else if (controller[CONT_ANY].keyUp.down) {
937
if (!devMenu.timer && --devMenu.selection < 0)
938
devMenu.selection = selectionCount - 1;
939
940
devMenu.timer = (devMenu.timer + 1) & 7;
941
}
942
943
if (controller[CONT_ANY].keyDown.press) {
944
if (++devMenu.selection >= selectionCount)
945
devMenu.selection = 0;
946
947
devMenu.timer = 1;
948
}
949
else if (controller[CONT_ANY].keyDown.down) {
950
if (!devMenu.timer && ++devMenu.selection >= selectionCount)
951
devMenu.selection = 0;
952
953
devMenu.timer = (devMenu.timer + 1) & 7;
954
}
955
956
bool32 confirm = controller[CONT_ANY].keyA.press;
957
#if RETRO_REV02
958
bool32 swap = SKU::userCore->GetConfirmButtonFlip();
959
#else
960
bool32 swap = SKU::GetConfirmButtonFlip();
961
#endif
962
if (swap)
963
confirm = controller[CONT_ANY].keyB.press;
964
965
if (controller[CONT_ANY].keyStart.press || confirm) {
966
switch (devMenu.selection) {
967
case 0: {
968
devMenu.windowed = videoSettings.windowed;
969
devMenu.windowScale = (videoSettings.windowHeight / videoSettings.pixHeight) - 1;
970
971
int32 aspect = (int32)((videoSettings.windowWidth / (float)videoSettings.windowHeight) * (float)SCREEN_YSIZE) >> 3;
972
switch (aspect) {
973
default:
974
case 40: devMenu.windowAspect = 0; break; // 4:3
975
case 45: devMenu.windowAspect = 1; break; // 3:2
976
case 48: devMenu.windowAspect = 2; break; // 16:10
977
case 50: devMenu.windowAspect = 3; break; // 5:3
978
case 53: devMenu.windowAspect = 4; break; // 16:9
979
}
980
981
devMenu.state = DevMenu_VideoOptionsMenu;
982
devMenu.selection = 0;
983
break;
984
}
985
986
case 1:
987
devMenu.state = DevMenu_AudioOptionsMenu;
988
devMenu.selection = 0;
989
break;
990
991
case 2:
992
devMenu.state = DevMenu_InputOptionsMenu;
993
devMenu.selection = 0;
994
break;
995
996
#if RETRO_REV02
997
case 3: devMenu.state = DevMenu_DebugOptionsMenu; devMenu.selection = 0;
998
999
#if !RETRO_USE_ORIGINAL_CODE
1000
// reset this just to be sure there's no crashing since we can go back from prev menus unlike original RSDKv5
1001
devMenu.scrollPos = 0;
1002
#endif
1003
break;
1004
1005
case 4:
1006
#else
1007
case 3:
1008
#endif
1009
devMenu.state = DevMenu_MainMenu;
1010
devMenu.selection = 0;
1011
break;
1012
}
1013
}
1014
#if !RETRO_USE_ORIGINAL_CODE
1015
else if (swap ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {
1016
devMenu.state = DevMenu_MainMenu;
1017
devMenu.listPos = 0;
1018
devMenu.scrollPos = 0;
1019
devMenu.selection = 3;
1020
}
1021
#endif
1022
}
1023
void RSDK::DevMenu_VideoOptionsMenu()
1024
{
1025
uint32 selectionColors[] = { 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090 };
1026
selectionColors[devMenu.selection] = 0xF0F0F0;
1027
1028
int32 dy = currentScreen->center.y;
1029
DrawRectangle(currentScreen->center.x - 128, dy - 84, 0x100, 0x30, 0x80, 0xFF, INK_NONE, true);
1030
1031
dy -= 68;
1032
DrawDevString("VIDEO SETTINGS", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F0F0);
1033
1034
dy += 44;
1035
DrawRectangle(currentScreen->center.x - 128, dy - 8, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);
1036
1037
DrawDevString("Window Size:", currentScreen->center.x - 96, dy, 0, selectionColors[0]);
1038
1039
const char *scale = "unknown";
1040
switch (devMenu.windowScale) {
1041
case 0: scale = "1x"; break;
1042
case 1: scale = "2x"; break;
1043
case 2: scale = "3x"; break;
1044
case 3: scale = "4x"; break;
1045
default: break;
1046
}
1047
DrawDevString(scale, currentScreen->center.x + 80, dy, ALIGN_CENTER, 0xF0F080);
1048
1049
dy += 8;
1050
DrawDevString("Window Aspect:", currentScreen->center.x - 96, dy, 0, selectionColors[1]);
1051
1052
const char *aspect = "unknown";
1053
switch (devMenu.windowAspect) {
1054
case 0: aspect = "4:3"; break;
1055
case 1: aspect = "3:2"; break;
1056
case 2: aspect = "16:10"; break;
1057
case 3: aspect = "5:3"; break;
1058
case 4: aspect = "16:9"; break;
1059
default: break;
1060
}
1061
DrawDevString(aspect, currentScreen->center.x + 80, dy, ALIGN_CENTER, 0xF0F080);
1062
1063
dy += 8;
1064
DrawDevString("Fullscreen:", currentScreen->center.x - 96, dy, 0, selectionColors[2]);
1065
DrawDevString(devMenu.windowed ? "NO" : "YES", currentScreen->center.x + 80, dy, ALIGN_CENTER, 0xF0F080);
1066
1067
dy += 8;
1068
DrawDevString("Screen Shader:", currentScreen->center.x - 96, dy, ALIGN_LEFT, selectionColors[3]);
1069
DrawDevString(shaderList[videoSettings.shaderID].name, currentScreen->center.x + 80, dy, ALIGN_CENTER, 0xF0F080);
1070
1071
dy += 16;
1072
DrawDevString("Confirm", currentScreen->center.x, dy, ALIGN_CENTER, selectionColors[4]);
1073
DrawDevString("Cancel", currentScreen->center.x, dy + 8, ALIGN_CENTER, selectionColors[5]);
1074
1075
#if !RETRO_USE_ORIGINAL_CODE
1076
DevMenu_HandleTouchControls(devMenu.selection < 4);
1077
#endif
1078
1079
if (controller[CONT_ANY].keyUp.press) {
1080
if (--devMenu.selection < 0)
1081
devMenu.selection = 5;
1082
1083
devMenu.timer = 1;
1084
}
1085
else if (controller[CONT_ANY].keyUp.down) {
1086
if (!devMenu.timer && --devMenu.selection < 0)
1087
devMenu.selection = 5;
1088
1089
devMenu.timer = (devMenu.timer + 1) & 7;
1090
}
1091
1092
if (controller[CONT_ANY].keyDown.press) {
1093
if (++devMenu.selection > 5)
1094
devMenu.selection = 0;
1095
1096
devMenu.timer = 1;
1097
}
1098
else if (controller[CONT_ANY].keyDown.down) {
1099
if (!devMenu.timer && ++devMenu.selection > 5)
1100
devMenu.selection = 0;
1101
1102
devMenu.timer = (devMenu.timer + 1) & 7;
1103
}
1104
1105
switch (devMenu.selection) {
1106
case 0: // scale
1107
if (controller[CONT_ANY].keyLeft.press) {
1108
devMenu.windowScale = (devMenu.windowScale - 1) & 3;
1109
changedVideoSettings = true;
1110
}
1111
else if (controller[CONT_ANY].keyRight.press) {
1112
devMenu.windowScale = (devMenu.windowScale + 1) & 3;
1113
changedVideoSettings = true;
1114
}
1115
break;
1116
1117
case 1: // aspect
1118
if (controller[CONT_ANY].keyLeft.press) {
1119
devMenu.windowAspect--;
1120
changedVideoSettings = true;
1121
}
1122
else if (controller[CONT_ANY].keyRight.press) {
1123
devMenu.windowAspect++;
1124
changedVideoSettings = true;
1125
}
1126
1127
if (devMenu.windowAspect > 4)
1128
devMenu.windowAspect = 0;
1129
else if (devMenu.windowAspect < 0)
1130
devMenu.windowAspect = 4;
1131
break;
1132
1133
case 2: // fullscreen
1134
if (controller[CONT_ANY].keyLeft.press || controller[CONT_ANY].keyRight.press) {
1135
devMenu.windowed ^= 1;
1136
changedVideoSettings = true;
1137
}
1138
break;
1139
1140
case 3: // screenShader
1141
if (controller[CONT_ANY].keyLeft.press) {
1142
videoSettings.shaderID--;
1143
changedVideoSettings = true;
1144
}
1145
else if (controller[CONT_ANY].keyRight.press) {
1146
videoSettings.shaderID++;
1147
changedVideoSettings = true;
1148
}
1149
1150
if (videoSettings.shaderID >= userShaderCount)
1151
videoSettings.shaderID = SHADER_NONE;
1152
else if (videoSettings.shaderID < SHADER_NONE)
1153
videoSettings.shaderID = MAX(userShaderCount - 1, 0);
1154
break;
1155
1156
case 4: // confirm
1157
{
1158
bool32 confirm = controller[CONT_ANY].keyA.press;
1159
#if RETRO_REV02
1160
if (SKU::userCore->GetConfirmButtonFlip())
1161
#else
1162
if (SKU::GetConfirmButtonFlip())
1163
#endif
1164
confirm = controller[CONT_ANY].keyB.press;
1165
1166
if (controller[CONT_ANY].keyStart.press || confirm) {
1167
// do confirm
1168
videoSettings.windowed = devMenu.windowed;
1169
shaderList[0].linear = !devMenu.windowed;
1170
if (!devMenu.windowScale)
1171
videoSettings.shaderID = SHADER_NONE;
1172
devMenu.windowScale++;
1173
1174
int32 width = 0;
1175
switch (devMenu.windowAspect) {
1176
default: width = videoSettings.windowWidth; break;
1177
case 0: width = 3 - (int32)(videoSettings.pixHeight * -1.3333334f); break; // 16:9
1178
case 1: width = 3 - (int32)(videoSettings.pixHeight * -1.5f); break; // 4:3
1179
case 2: width = 3 - (int32)(videoSettings.pixHeight * -1.6f); break; // 3:2
1180
case 3: width = 3 - (int32)(videoSettings.pixHeight * -1.6666666f); break; // 16:10
1181
case 4: width = 3 - (int32)(videoSettings.pixHeight * -1.7777778f); break; // 5:3
1182
}
1183
width &= 0x7FF8;
1184
1185
#if !RETRO_USE_ORIGINAL_CODE
1186
if (customSettings.maxPixWidth && width > customSettings.maxPixWidth)
1187
width = customSettings.maxPixWidth;
1188
#else
1189
if (width > DEFAULT_PIXWIDTH)
1190
width = DEFAULT_PIXWIDTH;
1191
#endif
1192
1193
videoSettings.windowWidth = width * devMenu.windowScale;
1194
videoSettings.windowHeight = videoSettings.pixHeight * devMenu.windowScale;
1195
UpdateGameWindow();
1196
1197
devMenu.state = DevMenu_OptionsMenu;
1198
devMenu.selection = 0;
1199
}
1200
break;
1201
}
1202
1203
case 5: // cancel
1204
{
1205
bool32 confirm = controller[CONT_ANY].keyA.press;
1206
#if RETRO_REV02
1207
if (SKU::userCore->GetConfirmButtonFlip())
1208
#else
1209
if (SKU::GetConfirmButtonFlip())
1210
#endif
1211
confirm = controller[CONT_ANY].keyB.press;
1212
1213
if (controller[CONT_ANY].keyStart.press || confirm) {
1214
devMenu.state = DevMenu_OptionsMenu;
1215
devMenu.selection = 0;
1216
}
1217
break;
1218
}
1219
}
1220
1221
#if !RETRO_USE_ORIGINAL_CODE
1222
#if RETRO_REV02
1223
bool32 swap = SKU::userCore->GetConfirmButtonFlip();
1224
#else
1225
bool32 swap = SKU::GetConfirmButtonFlip();
1226
#endif
1227
if (swap ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {
1228
devMenu.state = DevMenu_OptionsMenu;
1229
devMenu.selection = 0;
1230
}
1231
#endif
1232
}
1233
void RSDK::DevMenu_AudioOptionsMenu()
1234
{
1235
uint32 selectionColors[] = { 0x808090, 0x808090, 0x808090, 0x808090 };
1236
selectionColors[devMenu.selection] = 0xF0F0F0;
1237
1238
int32 dy = currentScreen->center.y;
1239
DrawRectangle(currentScreen->center.x - 128, dy - 84, 0x100, 0x30, 0x80, 0xFF, INK_NONE, true);
1240
1241
dy -= 68;
1242
DrawDevString("AUDIO SETTINGS", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F0F0);
1243
1244
dy += 44;
1245
DrawRectangle(currentScreen->center.x - 128, dy - 8, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);
1246
1247
DrawDevString("Streams Enabled:", currentScreen->center.x - 96, dy, 0, selectionColors[0]);
1248
DrawDevString(engine.streamsEnabled ? "YES" : "NO", currentScreen->center.x + 80, dy, ALIGN_CENTER, 0xF0F080);
1249
1250
dy += 16;
1251
DrawDevString("Streams Vol:", currentScreen->center.x - 96, dy, 0, selectionColors[1]);
1252
DrawRectangle(currentScreen->center.x + 8, dy, 112, 8, 0x000000, 0xFF, INK_NONE, true);
1253
DrawRectangle(currentScreen->center.x + 9, dy + 1, (int32)(engine.streamVolume * 110.0), 6, 0xF0F0F0, 255, INK_NONE, true);
1254
1255
dy += 16;
1256
DrawDevString("SoundFX Vol:", currentScreen->center.x - 96, dy, 0, selectionColors[2]);
1257
DrawRectangle(currentScreen->center.x + 8, dy, 112, 8, 0x000000, 0xFF, INK_NONE, true);
1258
DrawRectangle(currentScreen->center.x + 9, dy + 1, (int32)(engine.soundFXVolume * 110.0), 6, 0xF0F0F0, 255, INK_NONE, true);
1259
DrawDevString("Back", currentScreen->center.x, dy + 16, ALIGN_CENTER, selectionColors[3]);
1260
1261
#if !RETRO_USE_ORIGINAL_CODE
1262
int8 cornerButton = CORNERBUTTON_START;
1263
switch (devMenu.selection) {
1264
case 0: cornerButton = CORNERBUTTON_LEFTRIGHT; break;
1265
1266
case 1:
1267
case 2: cornerButton = CORNERBUTTON_SLIDER; break;
1268
1269
case 3: cornerButton = CORNERBUTTON_START; break;
1270
}
1271
1272
DevMenu_HandleTouchControls(cornerButton);
1273
#endif
1274
1275
if (controller[CONT_ANY].keyUp.press) {
1276
if (--devMenu.selection < 0)
1277
devMenu.selection = 3;
1278
1279
devMenu.timer = 1;
1280
}
1281
else if (controller[CONT_ANY].keyUp.down) {
1282
if (!devMenu.timer && --devMenu.selection < 0)
1283
devMenu.selection = 3;
1284
1285
devMenu.timer = (devMenu.timer + 1) & 7;
1286
}
1287
1288
if (controller[CONT_ANY].keyDown.press) {
1289
if (++devMenu.selection > 3)
1290
devMenu.selection = 0;
1291
1292
devMenu.timer = 1;
1293
}
1294
else if (controller[CONT_ANY].keyDown.down) {
1295
if (!devMenu.timer && ++devMenu.selection > 3)
1296
devMenu.selection = 0;
1297
1298
devMenu.timer = (devMenu.timer + 1) & 7;
1299
}
1300
1301
switch (devMenu.selection) {
1302
case 0:
1303
if (controller[CONT_ANY].keyLeft.press || controller[CONT_ANY].keyRight.press) {
1304
engine.streamsEnabled ^= 1;
1305
changedVideoSettings = true;
1306
}
1307
break;
1308
1309
case 1:
1310
if (controller[CONT_ANY].keyLeft.down) {
1311
engine.streamVolume -= 1.0 / 64.0;
1312
if (engine.streamVolume < 0.0)
1313
engine.streamVolume = 0.0;
1314
1315
changedVideoSettings = true;
1316
}
1317
else {
1318
if (controller[CONT_ANY].keyRight.down) {
1319
engine.streamVolume += 1.0 / 64.0;
1320
if (engine.streamVolume > 1.0)
1321
engine.streamVolume = 1.0;
1322
1323
changedVideoSettings = true;
1324
}
1325
}
1326
break;
1327
1328
case 2:
1329
if (controller[CONT_ANY].keyLeft.down) {
1330
engine.soundFXVolume -= 1.0 / 64.0;
1331
if (engine.soundFXVolume < 0.0)
1332
engine.soundFXVolume = 0.0;
1333
1334
changedVideoSettings = true;
1335
}
1336
else {
1337
if (controller[CONT_ANY].keyRight.down) {
1338
engine.soundFXVolume += 1.0 / 64.0;
1339
if (engine.soundFXVolume > 1.0)
1340
engine.soundFXVolume = 1.0;
1341
1342
changedVideoSettings = true;
1343
}
1344
}
1345
break;
1346
1347
case 3: {
1348
bool32 confirm = controller[CONT_ANY].keyA.press;
1349
#if RETRO_REV02
1350
if (SKU::userCore->GetConfirmButtonFlip())
1351
#else
1352
if (SKU::GetConfirmButtonFlip())
1353
#endif
1354
confirm = controller[CONT_ANY].keyB.press;
1355
1356
if (controller[CONT_ANY].keyStart.press || confirm) {
1357
devMenu.state = DevMenu_OptionsMenu;
1358
devMenu.selection = 1;
1359
}
1360
break;
1361
}
1362
}
1363
1364
#if !RETRO_USE_ORIGINAL_CODE
1365
#if RETRO_REV02
1366
bool32 swap = SKU::userCore->GetConfirmButtonFlip();
1367
#else
1368
bool32 swap = SKU::GetConfirmButtonFlip();
1369
#endif
1370
if (swap ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {
1371
devMenu.state = DevMenu_OptionsMenu;
1372
devMenu.selection = 1;
1373
}
1374
#endif
1375
}
1376
void RSDK::DevMenu_InputOptionsMenu()
1377
{
1378
uint32 selectionColors[] = { 0x808090, 0x808090, 0x808090, 0x808090, 0x808090 };
1379
selectionColors[devMenu.selection] = 0xF0F0F0;
1380
1381
int32 dy = currentScreen->center.y;
1382
DrawRectangle(currentScreen->center.x - 128, dy - 84, 0x100, 0x30, 0x80, 0xFF, INK_NONE, true);
1383
1384
dy -= 68;
1385
DrawDevString("CONFIGURE INPUT", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F0F0);
1386
1387
dy += 44;
1388
DrawRectangle(currentScreen->center.x - 128, dy - 8, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);
1389
1390
DrawDevString("Set Keys For Input 1", currentScreen->center.x, dy, ALIGN_CENTER, selectionColors[0]);
1391
1392
dy += 10;
1393
DrawDevString("Set Keys For Input 2", currentScreen->center.x, dy, ALIGN_CENTER, selectionColors[1]);
1394
1395
dy += 10;
1396
DrawDevString("Set Keys For Input 3", currentScreen->center.x, dy, ALIGN_CENTER, selectionColors[2]);
1397
1398
dy += 10;
1399
DrawDevString("Set Keys For Input 4", currentScreen->center.x, dy, ALIGN_CENTER, selectionColors[3]);
1400
1401
DrawDevString("Back", currentScreen->center.x, dy + 18, ALIGN_CENTER, selectionColors[4]);
1402
1403
#if !RETRO_USE_ORIGINAL_CODE
1404
DevMenu_HandleTouchControls(CORNERBUTTON_START);
1405
#endif
1406
1407
if (controller[CONT_ANY].keyUp.press) {
1408
if (--devMenu.selection < 0)
1409
devMenu.selection = 4;
1410
1411
devMenu.timer = 1;
1412
}
1413
else if (controller[CONT_ANY].keyUp.down) {
1414
if (!devMenu.timer && --devMenu.selection < 0)
1415
devMenu.selection = 4;
1416
1417
devMenu.timer = (devMenu.timer + 1) & 7;
1418
}
1419
1420
if (controller[CONT_ANY].keyDown.press) {
1421
if (++devMenu.selection > 4)
1422
devMenu.selection = 0;
1423
1424
devMenu.timer = 1;
1425
}
1426
else if (controller[CONT_ANY].keyDown.down) {
1427
if (!devMenu.timer && ++devMenu.selection > 4)
1428
devMenu.selection = 0;
1429
1430
devMenu.timer = (devMenu.timer + 1) & 7;
1431
}
1432
1433
bool32 confirm = controller[CONT_ANY].keyA.press;
1434
#if RETRO_REV02
1435
if (SKU::userCore->GetConfirmButtonFlip())
1436
#else
1437
if (SKU::GetConfirmButtonFlip())
1438
#endif
1439
confirm = controller[CONT_ANY].keyB.press;
1440
1441
if (controller[CONT_ANY].keyStart.press || confirm) {
1442
if (devMenu.selection == 4) {
1443
devMenu.state = DevMenu_OptionsMenu;
1444
devMenu.selection = 3;
1445
}
1446
else {
1447
devMenu.state = DevMenu_KeyMappingsMenu;
1448
devMenu.scrollPos = 0;
1449
changedVideoSettings = true;
1450
1451
controller[CONT_P1 + devMenu.selection].keyUp.keyMap = KEYMAP_AUTO_MAPPING;
1452
}
1453
}
1454
1455
#if !RETRO_USE_ORIGINAL_CODE
1456
#if RETRO_REV02
1457
bool32 swap = SKU::userCore->GetConfirmButtonFlip();
1458
#else
1459
bool32 swap = SKU::GetConfirmButtonFlip();
1460
#endif
1461
if (swap ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {
1462
devMenu.state = DevMenu_OptionsMenu;
1463
devMenu.selection = 2;
1464
}
1465
#endif
1466
}
1467
void RSDK::DevMenu_KeyMappingsMenu()
1468
{
1469
#if !RETRO_USE_ORIGINAL_CODE
1470
DevMenu_HandleTouchControls(CORNERBUTTON_START);
1471
#endif
1472
1473
int32 dy = currentScreen->center.y;
1474
DrawRectangle(currentScreen->center.x - 128, dy - 84, 0x100, 0x30, 0x80, 0xFF, INK_NONE, true);
1475
1476
dy -= 68;
1477
DrawDevString("SET KEY BINDING", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F0F0);
1478
1479
dy += 44;
1480
DrawRectangle(currentScreen->center.x - 128, dy - 8, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);
1481
1482
int32 controllerID = CONT_P1 + devMenu.selection;
1483
switch (devMenu.scrollPos) {
1484
case 0:
1485
DrawDevString("Press Key For UP", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);
1486
if (controller[controllerID].keyUp.keyMap != KEYMAP_AUTO_MAPPING) {
1487
controller[controllerID].keyDown.keyMap = KEYMAP_AUTO_MAPPING;
1488
++devMenu.scrollPos;
1489
}
1490
break;
1491
1492
case 1:
1493
DrawDevString("Press Key For DOWN", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);
1494
if (controller[controllerID].keyDown.keyMap != KEYMAP_AUTO_MAPPING) {
1495
controller[controllerID].keyLeft.keyMap = KEYMAP_AUTO_MAPPING;
1496
++devMenu.scrollPos;
1497
}
1498
break;
1499
1500
case 2:
1501
DrawDevString("Press Key For LEFT", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);
1502
if (controller[controllerID].keyLeft.keyMap != KEYMAP_AUTO_MAPPING) {
1503
controller[controllerID].keyRight.keyMap = KEYMAP_AUTO_MAPPING;
1504
++devMenu.scrollPos;
1505
}
1506
break;
1507
1508
case 3:
1509
DrawDevString("Press Key For RIGHT", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);
1510
if (controller[controllerID].keyRight.keyMap != KEYMAP_AUTO_MAPPING) {
1511
controller[controllerID].keyA.keyMap = KEYMAP_AUTO_MAPPING;
1512
++devMenu.scrollPos;
1513
}
1514
break;
1515
1516
case 4:
1517
DrawDevString("Press Key For BUTTON A", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);
1518
if (controller[controllerID].keyA.keyMap != KEYMAP_AUTO_MAPPING) {
1519
controller[controllerID].keyB.keyMap = KEYMAP_AUTO_MAPPING;
1520
++devMenu.scrollPos;
1521
}
1522
break;
1523
1524
case 5:
1525
DrawDevString("Press Key For BUTTON B", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);
1526
if (controller[controllerID].keyB.keyMap != KEYMAP_AUTO_MAPPING) {
1527
controller[controllerID].keyC.keyMap = KEYMAP_AUTO_MAPPING;
1528
++devMenu.scrollPos;
1529
}
1530
break;
1531
1532
case 6:
1533
DrawDevString("Press Key For BUTTON C", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);
1534
if (controller[controllerID].keyC.keyMap != KEYMAP_AUTO_MAPPING) {
1535
controller[controllerID].keyX.keyMap = KEYMAP_AUTO_MAPPING;
1536
++devMenu.scrollPos;
1537
}
1538
break;
1539
1540
case 7:
1541
DrawDevString("Press Key For BUTTON X", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);
1542
if (controller[controllerID].keyX.keyMap != KEYMAP_AUTO_MAPPING) {
1543
controller[controllerID].keyY.keyMap = KEYMAP_AUTO_MAPPING;
1544
++devMenu.scrollPos;
1545
}
1546
break;
1547
1548
case 8:
1549
DrawDevString("Press Key For BUTTON Y", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);
1550
if (controller[controllerID].keyY.keyMap != KEYMAP_AUTO_MAPPING) {
1551
controller[controllerID].keyZ.keyMap = KEYMAP_AUTO_MAPPING;
1552
++devMenu.scrollPos;
1553
}
1554
break;
1555
1556
case 9:
1557
DrawDevString("Press Key For BUTTON Z", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);
1558
if (controller[controllerID].keyZ.keyMap != KEYMAP_AUTO_MAPPING) {
1559
controller[controllerID].keyStart.keyMap = KEYMAP_AUTO_MAPPING;
1560
++devMenu.scrollPos;
1561
}
1562
break;
1563
1564
case 10:
1565
DrawDevString("Press Key For START", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);
1566
if (controller[controllerID].keyStart.keyMap != KEYMAP_AUTO_MAPPING) {
1567
controller[controllerID].keySelect.keyMap = KEYMAP_AUTO_MAPPING;
1568
++devMenu.scrollPos;
1569
}
1570
break;
1571
1572
case 11:
1573
DrawDevString("Press Key For SELECT", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);
1574
if (controller[controllerID].keySelect.keyMap != KEYMAP_AUTO_MAPPING)
1575
devMenu.state = DevMenu_InputOptionsMenu;
1576
break;
1577
1578
default: break;
1579
}
1580
1581
#if !RETRO_USE_ORIGINAL_CODE
1582
#if RETRO_REV02
1583
bool32 swap = SKU::userCore->GetConfirmButtonFlip();
1584
#else
1585
bool32 swap = SKU::GetConfirmButtonFlip();
1586
#endif
1587
if (swap ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {
1588
devMenu.state = DevMenu_OptionsMenu;
1589
devMenu.selection = 3;
1590
}
1591
#endif
1592
}
1593
#if RETRO_REV02
1594
void RSDK::DevMenu_DebugOptionsMenu()
1595
{
1596
uint32 selectionColors[] = { 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090 };
1597
selectionColors[devMenu.selection - devMenu.scrollPos] = 0xF0F0F0;
1598
1599
int32 dy = currentScreen->center.y;
1600
DrawRectangle(currentScreen->center.x - 128, dy - 84, 0x100, 0x30, 0x80, 0xFF, INK_NONE, true);
1601
1602
dy -= 68;
1603
DrawDevString("CONFIGURE DEBUG FLAGS", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F0F0);
1604
1605
dy += 40;
1606
DrawRectangle(currentScreen->center.x - 128, dy - 4, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);
1607
1608
#if !RETRO_USE_ORIGINAL_CODE
1609
DevMenu_HandleTouchControls(devMenu.selection < viewableVarCount);
1610
#endif
1611
1612
bool32 confirm = controller[CONT_ANY].keyA.press;
1613
if (SKU::userCore->GetConfirmButtonFlip())
1614
confirm = controller[CONT_ANY].keyB.press;
1615
1616
confirm |= controller[CONT_ANY].keyStart.press;
1617
1618
for (int32 i = 0; i < 8; ++i) {
1619
if (devMenu.scrollPos + i < viewableVarCount) {
1620
ViewableVariable *value = &viewableVarList[devMenu.scrollPos + i];
1621
DrawDevString(value->name, currentScreen->center.x - 96, dy, ALIGN_LEFT, selectionColors[i]);
1622
1623
if (!value->value) {
1624
DrawDevString("--------", currentScreen->center.x + 96, dy, ALIGN_RIGHT, 0xF0F080);
1625
}
1626
else {
1627
char valueStr[0x10];
1628
strcpy(valueStr, "--------");
1629
1630
switch (value->size) {
1631
default: DrawDevString("--------", currentScreen->center.x + 96, dy, ALIGN_RIGHT, 0xF0F080); break;
1632
1633
case sizeof(uint8): {
1634
uint8 *v = (uint8 *)value->value;
1635
1636
switch (value->type) {
1637
case VIEWVAR_DISPLAY_BOOL:
1638
valueStr[0] = *v ? 'Y' : 'N';
1639
valueStr[1] = 0;
1640
break;
1641
1642
default:
1643
case VIEWVAR_DISPLAY_UNSIGNED: valueStr[0] = ' '; break;
1644
1645
case VIEWVAR_DISPLAY_SIGNED:
1646
valueStr[0] = *v > 0x7F ? '-' : ' ';
1647
*v &= 0x7F;
1648
break;
1649
}
1650
break;
1651
}
1652
1653
case sizeof(int16): {
1654
uint16 *v = (uint16 *)value->value;
1655
1656
switch (value->type) {
1657
case VIEWVAR_DISPLAY_BOOL:
1658
valueStr[0] = *v ? 'Y' : 'N';
1659
valueStr[1] = 0;
1660
break;
1661
1662
default:
1663
case VIEWVAR_DISPLAY_UNSIGNED: valueStr[0] = ' '; break;
1664
1665
case VIEWVAR_DISPLAY_SIGNED:
1666
valueStr[0] = *v > 0x7FFF ? '-' : ' ';
1667
*v &= 0x7FFF;
1668
break;
1669
}
1670
break;
1671
}
1672
1673
case sizeof(int32): {
1674
uint32 *v = (uint32 *)value->value;
1675
1676
switch (value->type) {
1677
case VIEWVAR_DISPLAY_BOOL:
1678
valueStr[0] = *v ? 'Y' : 'N';
1679
valueStr[1] = 0;
1680
break;
1681
1682
default:
1683
case VIEWVAR_DISPLAY_UNSIGNED: valueStr[0] = ' '; break;
1684
1685
case VIEWVAR_DISPLAY_SIGNED:
1686
valueStr[0] = *v > 0x7FFFFFFF ? '-' : ' ';
1687
*v &= 0x7FFFFFFF;
1688
break;
1689
}
1690
break;
1691
}
1692
}
1693
1694
if (value->type != VIEWVAR_DISPLAY_BOOL) {
1695
if (2 * value->size) {
1696
char *curChar = &valueStr[2 * value->size];
1697
valueStr[(2 * value->size) + 1] = 0;
1698
1699
switch (value->size) {
1700
default: break;
1701
1702
case sizeof(uint8): {
1703
uint8 *valuePtr = (uint8 *)value->value;
1704
1705
for (int32 v = 0; v < 2 * value->size; ++v) *curChar-- = ((v & 0xF) > 9 ? '7' : '0') + ((*valuePtr >> 4 * v) & 0xF);
1706
break;
1707
}
1708
1709
case sizeof(int16): {
1710
uint16 *valuePtr = (uint16 *)value->value;
1711
1712
for (int32 v = 0; v < 2 * value->size; ++v) *curChar-- = ((v & 0xF) > 9 ? '7' : '0') + ((*valuePtr >> 4 * v) & 0xF);
1713
break;
1714
}
1715
1716
case sizeof(int32): {
1717
uint32 *valuePtr = (uint32 *)value->value;
1718
1719
for (int32 v = 0; v < 2 * value->size; ++v) *curChar-- = ((v & 0xF) > 9 ? '7' : '0') + ((*valuePtr >> 4 * v) & 0xF);
1720
break;
1721
}
1722
}
1723
}
1724
}
1725
1726
DrawDevString(valueStr, currentScreen->center.x + 96, dy, ALIGN_CENTER, 0xF0F080);
1727
}
1728
dy += 8;
1729
}
1730
else {
1731
DrawDevString("Back", currentScreen->center.x, dy, ALIGN_CENTER, selectionColors[i]);
1732
}
1733
}
1734
1735
if (controller[CONT_ANY].keyUp.press) {
1736
if (--devMenu.selection < 0)
1737
devMenu.selection = viewableVarCount;
1738
1739
if (devMenu.selection >= devMenu.scrollPos) {
1740
if (devMenu.selection > devMenu.scrollPos + 7)
1741
devMenu.scrollPos = devMenu.selection - 7;
1742
}
1743
else {
1744
devMenu.scrollPos = devMenu.selection;
1745
}
1746
1747
devMenu.timer = 1;
1748
}
1749
else if (controller[CONT_ANY].keyUp.down) {
1750
if (!devMenu.timer && --devMenu.selection < 0)
1751
devMenu.selection = viewableVarCount;
1752
1753
devMenu.timer = (devMenu.timer + 1) & 7;
1754
1755
if (devMenu.selection >= devMenu.scrollPos) {
1756
if (devMenu.selection > devMenu.scrollPos + 7)
1757
devMenu.scrollPos = devMenu.selection - 7;
1758
}
1759
else {
1760
devMenu.scrollPos = devMenu.selection;
1761
}
1762
}
1763
1764
if (controller[CONT_ANY].keyDown.press) {
1765
if (++devMenu.selection > viewableVarCount)
1766
devMenu.selection = 0;
1767
1768
if (devMenu.selection >= devMenu.scrollPos) {
1769
if (devMenu.selection > devMenu.scrollPos + 7)
1770
devMenu.scrollPos = devMenu.selection - 7;
1771
}
1772
else {
1773
devMenu.scrollPos = devMenu.selection;
1774
}
1775
1776
devMenu.timer = 1;
1777
}
1778
else if (controller[CONT_ANY].keyDown.down) {
1779
if (!devMenu.timer && ++devMenu.selection >= viewableVarCount)
1780
devMenu.selection = 0;
1781
1782
devMenu.timer = (devMenu.timer + 1) & 7;
1783
if (devMenu.selection >= devMenu.scrollPos) {
1784
if (devMenu.selection > devMenu.scrollPos + 7)
1785
devMenu.scrollPos = devMenu.selection - 7;
1786
}
1787
else {
1788
devMenu.scrollPos = devMenu.selection;
1789
}
1790
}
1791
1792
if (devMenu.selection < viewableVarCount) {
1793
ViewableVariable *var = &viewableVarList[devMenu.selection];
1794
1795
switch (var->size) {
1796
default: DrawDevString("--------", currentScreen->center.x + 96, dy, ALIGN_RIGHT, 0xF0F080); break;
1797
1798
case sizeof(int8): {
1799
int8 *value = (int8 *)var->value;
1800
1801
if (controller[CONT_ANY].keyLeft.press) {
1802
if (var->type == VIEWVAR_DISPLAY_BOOL)
1803
*value ^= 1;
1804
else if (*value - 1 >= var->min)
1805
*value = *value - 1;
1806
}
1807
1808
if (controller[CONT_ANY].keyRight.press) {
1809
if (var->type == VIEWVAR_DISPLAY_BOOL)
1810
*value ^= 1;
1811
else if (*value + 1 <= var->max)
1812
*value = *value + 1;
1813
}
1814
break;
1815
}
1816
1817
case sizeof(int16): {
1818
int16 *value = (int16 *)var->value;
1819
1820
if (controller[CONT_ANY].keyLeft.press) {
1821
if (var->type == VIEWVAR_DISPLAY_BOOL)
1822
*value ^= 1;
1823
else if (*value - 1 >= var->min)
1824
*value = *value - 1;
1825
}
1826
1827
if (controller[CONT_ANY].keyRight.press) {
1828
if (var->type == VIEWVAR_DISPLAY_BOOL)
1829
*value ^= 1;
1830
else if (*value + 1 <= var->max)
1831
*value = *value + 1;
1832
}
1833
break;
1834
}
1835
1836
case sizeof(int32): {
1837
int32 *value = (int32 *)var->value;
1838
1839
if (controller[CONT_ANY].keyLeft.press) {
1840
if (var->type == VIEWVAR_DISPLAY_BOOL)
1841
*value ^= 1;
1842
else if (*value - 1 >= var->min)
1843
*value = *value - 1;
1844
}
1845
1846
if (controller[CONT_ANY].keyRight.press) {
1847
if (!var->type)
1848
*value ^= 1;
1849
else if (*value + 1 <= var->max)
1850
*value = *value + 1;
1851
}
1852
break;
1853
}
1854
}
1855
}
1856
else {
1857
if (confirm) {
1858
devMenu.state = DevMenu_OptionsMenu;
1859
devMenu.selection = 4;
1860
}
1861
}
1862
1863
#if !RETRO_USE_ORIGINAL_CODE
1864
#if RETRO_REV02
1865
bool32 swap = SKU::userCore->GetConfirmButtonFlip();
1866
#else
1867
bool32 swap = SKU::GetConfirmButtonFlip()
1868
#endif
1869
if (swap ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {
1870
devMenu.state = DevMenu_OptionsMenu;
1871
devMenu.selection = 4;
1872
}
1873
#endif
1874
}
1875
#endif
1876
1877
#if RETRO_USE_MOD_LOADER
1878
void RSDK::DevMenu_ModsMenu()
1879
{
1880
uint32 selectionColors[] = { 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090 };
1881
selectionColors[devMenu.selection - devMenu.scrollPos] = 0xF0F0F0;
1882
1883
int32 dy = currentScreen->center.y;
1884
DrawRectangle(currentScreen->center.x - 128, dy - 84, 0x100, 0x30, 0x80, 0xFF, INK_NONE, true);
1885
1886
dy -= 68;
1887
DrawDevString("MANAGE MODS", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F0F0);
1888
DrawRectangle(currentScreen->center.x - 128, dy + 36, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);
1889
1890
int32 y = dy + 40;
1891
for (int32 i = 0; i < 8; ++i) {
1892
if (devMenu.scrollPos + i < modList.size()) {
1893
DrawDevString(modList[(devMenu.scrollPos + i)].name.c_str(), currentScreen->center.x - 96, y, ALIGN_LEFT, selectionColors[i]);
1894
DrawDevString(modList[(devMenu.scrollPos + i)].active ? "Y" : "N", currentScreen->center.x + 96, y, ALIGN_RIGHT, selectionColors[i]);
1895
1896
y += 8;
1897
devMenu.scrollPos = devMenu.scrollPos;
1898
}
1899
}
1900
1901
#if !RETRO_USE_ORIGINAL_CODE
1902
DevMenu_HandleTouchControls(CORNERBUTTON_START);
1903
#endif
1904
1905
int32 preselection = devMenu.selection;
1906
if (controller[CONT_ANY].keyUp.press) {
1907
if (--devMenu.selection < 0)
1908
devMenu.selection = (int32)(modList.size() - 1);
1909
1910
if (devMenu.selection >= devMenu.scrollPos) {
1911
if (devMenu.selection > devMenu.scrollPos + 7)
1912
devMenu.scrollPos = devMenu.selection - 7;
1913
}
1914
else {
1915
devMenu.scrollPos = devMenu.selection;
1916
}
1917
1918
devMenu.timer = 1;
1919
}
1920
else if (controller[CONT_ANY].keyUp.down) {
1921
if (!devMenu.timer && --devMenu.selection < 0)
1922
devMenu.selection = (int32)(modList.size() - 1);
1923
1924
devMenu.timer = (devMenu.timer + 1) & 7;
1925
1926
if (devMenu.selection >= devMenu.scrollPos) {
1927
if (devMenu.selection > devMenu.scrollPos + 7)
1928
devMenu.scrollPos = devMenu.selection - 7;
1929
}
1930
else {
1931
devMenu.scrollPos = devMenu.selection;
1932
}
1933
}
1934
1935
if (controller[CONT_ANY].keyDown.press) {
1936
if (++devMenu.selection >= modList.size())
1937
devMenu.selection = 0;
1938
1939
if (devMenu.selection >= devMenu.scrollPos) {
1940
if (devMenu.selection > devMenu.scrollPos + 7)
1941
devMenu.scrollPos = devMenu.selection - 7;
1942
}
1943
else {
1944
devMenu.scrollPos = devMenu.selection;
1945
}
1946
1947
devMenu.timer = 1;
1948
}
1949
else if (controller[CONT_ANY].keyDown.down) {
1950
if (!devMenu.timer && ++devMenu.selection >= modList.size())
1951
devMenu.selection = 0;
1952
1953
devMenu.timer = (devMenu.timer + 1) & 7;
1954
1955
if (devMenu.selection >= devMenu.scrollPos) {
1956
if (devMenu.selection > devMenu.scrollPos + 7)
1957
devMenu.scrollPos = devMenu.selection - 7;
1958
}
1959
else {
1960
devMenu.scrollPos = devMenu.selection;
1961
}
1962
}
1963
1964
bool32 confirm = controller[CONT_ANY].keyA.press;
1965
#if RETRO_REV02
1966
bool32 swap = SKU::userCore->GetConfirmButtonFlip();
1967
#else
1968
bool32 swap = SKU::GetConfirmButtonFlip();
1969
#endif
1970
if (swap)
1971
confirm = controller[CONT_ANY].keyB.press;
1972
1973
if (controller[CONT_ANY].keyStart.press || confirm || controller[CONT_ANY].keyLeft.press || controller[CONT_ANY].keyRight.press) {
1974
modList[devMenu.selection].active ^= true;
1975
devMenu.modsChanged = true;
1976
}
1977
else if (controller[CONT_ANY].keyC.down) {
1978
ModInfo swap = modList[preselection];
1979
modList[preselection] = modList[devMenu.selection];
1980
modList[devMenu.selection] = swap;
1981
devMenu.modsChanged = true;
1982
}
1983
else if (swap ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {
1984
devMenu.state = DevMenu_MainMenu;
1985
devMenu.scrollPos = 0;
1986
devMenu.selection = 4;
1987
#if RETRO_REV0U
1988
engine.version = 0;
1989
#endif
1990
SaveMods();
1991
if (devMenu.modsChanged) {
1992
DrawDevString("Reloading mods...", currentScreen->center.x, dy + 12, ALIGN_CENTER, 0xF08080);
1993
// we do a little hacking
1994
RenderDevice::CopyFrameBuffer();
1995
RenderDevice::FlipScreen();
1996
ApplyModChanges();
1997
}
1998
#if RETRO_REV0U
1999
else {
2000
engine.version = devMenu.startingVersion;
2001
}
2002
#endif
2003
2004
if (devMenu.modMenuCalled)
2005
CloseDevMenu();
2006
}
2007
}
2008
#endif
2009
2010
#if RETRO_REV0U && RETRO_USE_MOD_LOADER
2011
void RSDK::DevMenu_PlayerSelectMenu()
2012
{
2013
uint32 selectionColors[] = {
2014
0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090,
2015
};
2016
selectionColors[devMenu.selection - devMenu.scrollPos] = 0xF0F0F0;
2017
2018
int32 dy = currentScreen->center.y;
2019
DrawRectangle(currentScreen->center.x - 128, dy - 84, 0x100, 0x30, 0x80, 0xFF, INK_NONE, true);
2020
2021
dy -= 68;
2022
DrawDevString("SELECT PLAYER", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F0F0);
2023
DrawRectangle(currentScreen->center.x - 128, dy + 36, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);
2024
2025
int32 y = dy + 40;
2026
for (int32 i = 0; i < 8; ++i) {
2027
if (devMenu.scrollPos + i < modSettings.playerCount) {
2028
DrawDevString(modSettings.playerNames[devMenu.scrollPos + i], currentScreen->center.x - 64, y, ALIGN_LEFT, selectionColors[i]);
2029
y += 8;
2030
}
2031
}
2032
2033
DevMenu_HandleTouchControls(CORNERBUTTON_START);
2034
2035
if (controller[CONT_ANY].keyUp.press) {
2036
if (--devMenu.selection < 0)
2037
devMenu.selection = modSettings.playerCount - 1;
2038
2039
if (devMenu.selection >= devMenu.scrollPos) {
2040
if (devMenu.selection > devMenu.scrollPos + 7)
2041
devMenu.scrollPos = devMenu.selection - 7;
2042
}
2043
else {
2044
devMenu.scrollPos = devMenu.selection;
2045
}
2046
2047
devMenu.timer = 1;
2048
}
2049
else if (controller[CONT_ANY].keyUp.down) {
2050
if (!devMenu.timer && --devMenu.selection < 0)
2051
devMenu.selection = modSettings.playerCount - 1;
2052
2053
devMenu.timer = (devMenu.timer + 1) & 7;
2054
2055
if (devMenu.selection >= devMenu.scrollPos) {
2056
if (devMenu.selection > devMenu.scrollPos + 7)
2057
devMenu.scrollPos = devMenu.selection - 7;
2058
}
2059
else {
2060
devMenu.scrollPos = devMenu.selection;
2061
}
2062
}
2063
2064
if (controller[CONT_ANY].keyDown.press) {
2065
if (++devMenu.selection >= modSettings.playerCount)
2066
devMenu.selection = 0;
2067
2068
if (devMenu.selection >= devMenu.scrollPos) {
2069
if (devMenu.selection > devMenu.scrollPos + 7)
2070
devMenu.scrollPos = devMenu.selection - 7;
2071
}
2072
else {
2073
devMenu.scrollPos = devMenu.selection;
2074
}
2075
2076
devMenu.timer = 1;
2077
}
2078
else if (controller[CONT_ANY].keyDown.down) {
2079
if (!devMenu.timer && ++devMenu.selection >= modSettings.playerCount)
2080
devMenu.selection = 0;
2081
2082
devMenu.timer = (devMenu.timer + 1) & 7;
2083
2084
if (devMenu.selection >= devMenu.scrollPos) {
2085
if (devMenu.selection > devMenu.scrollPos + 7)
2086
devMenu.scrollPos = devMenu.selection - 7;
2087
}
2088
else {
2089
devMenu.scrollPos = devMenu.selection;
2090
}
2091
}
2092
2093
bool32 confirm = controller[CONT_ANY].keyA.press;
2094
#if RETRO_REV02
2095
bool32 swap = SKU::userCore->GetConfirmButtonFlip();
2096
#else
2097
bool32 swap = SKU::GetConfirmButtonFlip();
2098
#endif
2099
if (swap)
2100
confirm = controller[CONT_ANY].keyB.press;
2101
2102
if (controller[CONT_ANY].keyStart.press || confirm) {
2103
devMenu.state = DevMenu_CategorySelectMenu;
2104
devMenu.playerListPos = devMenu.selection;
2105
devMenu.selection = 0;
2106
devMenu.timer = 1;
2107
}
2108
else if (swap ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {
2109
devMenu.state = DevMenu_MainMenu;
2110
devMenu.playerListPos = 0;
2111
devMenu.scrollPos = 0;
2112
devMenu.selection = 2;
2113
}
2114
}
2115
#endif
2116
2117