Path: blob/master/RSDKv5/RSDK/Dev/Debug.cpp
1162 views
#include "RSDK/Core/RetroEngine.hpp"12#if RETRO_PLATFORM == RETRO_WIN3#include <Windows.h>45#undef PRINT_ERROR // causes conflicts6#endif7#if RETRO_PLATFORM == RETRO_ANDROID8#include <android/log.h>9#include <locale>10#include <codecvt>11std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;12#endif1314using namespace RSDK;1516bool32 RSDK::engineDebugMode = true;17bool32 RSDK::useEndLine = true;18char RSDK::outputString[0x400];1920#if RETRO_REV0221int32 RSDK::viewableVarCount = 0;22ViewableVariable RSDK::viewableVarList[VIEWVAR_LIST_COUNT];23#endif2425DevMenu RSDK::devMenu = DevMenu();2627inline void PrintConsole(const char *message) { printf("%s", message); }2829void RSDK::PrintLog(int32 mode, const char *message, ...)30{31#if !RETRO_DISABLE_LOG32if (engineDebugMode) {33// make the full string34char tmpStr[0x400];35va_list args;36va_start(args, message);3738vsnprintf(tmpStr, sizeof(tmpStr), message, args);39if (useEndLine)40sprintf(outputString, "%.*s\n", (int32)sizeof(tmpStr) - 1, tmpStr);41else42sprintf(outputString, "%.*s", (int32)sizeof(tmpStr) - 1, tmpStr);43va_end(args);4445#if RETRO_REV0246switch (mode) {47default:48case PRINT_NORMAL: break;4950case PRINT_POPUP:51if (sceneInfo.state & 3) {52CreateEntity(DevOutput->classID, outputString, 0, 0);53}54break;5556case PRINT_ERROR:57if (sceneInfo.state & 3) {58engine.storedState = sceneInfo.state;59sceneInfo.state = ENGINESTATE_ERRORMSG;60}61break;6263case PRINT_FATAL:64if (sceneInfo.state & 3) {65engine.storedState = sceneInfo.state;66sceneInfo.state = ENGINESTATE_ERRORMSG_FATAL;67}68break;6970#if RETRO_REV0U71case PRINT_SCRIPTERR:72engine.storedState = RSDK::Legacy::gameMode;73RSDK::Legacy::gameMode = RSDK::Legacy::ENGINE_SCRIPTERROR;74strcpy(RSDK::Legacy::scriptErrorMessage, outputString);75break;76#endif77}78#endif79if (engine.consoleEnabled) {80PrintConsole(outputString);81}82else {83#if RETRO_PLATFORM == RETRO_WIN84OutputDebugStringA(outputString);85#elif RETRO_PLATFORM == RETRO_ANDROID86int32 as = ANDROID_LOG_INFO;87switch (mode) {88#if RETRO_REV0U89case PRINT_SCRIPTERR:90#endif91case PRINT_ERROR: as = ANDROID_LOG_ERROR; break;92case PRINT_FATAL: as = ANDROID_LOG_FATAL; break;93default: break;94}95auto *jni = GetJNISetup();96int len = strlen(outputString);97jbyteArray array = jni->env->NewByteArray(len); // as per research, this gets freed automatically98jni->env->SetByteArrayRegion(array, 0, len, (jbyte *)outputString);99jni->env->CallVoidMethod(jni->thiz, writeLog, array, as);100#elif RETRO_PLATFORM == RETRO_SWITCH101printf("%s", outputString);102#endif103}104105#if !RETRO_USE_ORIGINAL_CODE && RETRO_PLATFORM != RETRO_ANDROID106char logPath[0x100];107sprintf_s(logPath, sizeof(logPath), "%slog.txt", SKU::userFileDir);108FileIO *file = fOpen(logPath, "a");109if (file) {110fWrite(&outputString, 1, strlen(outputString), file);111fClose(file);112}113#endif114}115#endif116}117118#if RETRO_REV02119void RSDK::AddViewableVariable(const char *name, void *value, int32 type, int32 min, int32 max)120{121if (viewableVarCount < VIEWVAR_COUNT) {122ViewableVariable *viewVar = &viewableVarList[viewableVarCount++];123124strncpy(viewVar->name, name, 0x10);125viewVar->value = value;126127switch (type) {128case VIEWVAR_BOOL:129viewVar->type = VIEWVAR_DISPLAY_BOOL;130viewVar->size = sizeof(bool32);131break;132133case VIEWVAR_UINT8:134viewVar->type = VIEWVAR_DISPLAY_UNSIGNED;135viewVar->size = sizeof(uint8);136break;137138case VIEWVAR_UINT16:139viewVar->type = VIEWVAR_DISPLAY_UNSIGNED;140viewVar->size = sizeof(uint16);141break;142143case VIEWVAR_UINT32:144viewVar->type = VIEWVAR_DISPLAY_UNSIGNED;145viewVar->size = sizeof(uint32);146break;147148case VIEWVAR_INT8:149viewVar->type = VIEWVAR_DISPLAY_SIGNED;150viewVar->size = sizeof(int8);151break;152153case VIEWVAR_INT16:154viewVar->type = VIEWVAR_DISPLAY_SIGNED;155viewVar->size = sizeof(int16);156break;157158case VIEWVAR_INT32:159viewVar->type = VIEWVAR_DISPLAY_SIGNED;160viewVar->size = sizeof(int32);161break;162163default: break;164}165166viewVar->min = min;167viewVar->max = max;168}169}170#endif171172#if !RETRO_REV02173void RSDK::PrintMessage(void *msg, uint8 type)174{175useEndLine = false;176177if (msg && engine.consoleEnabled) {178switch (type) {179case MESSAGE_STRING: PrintLog(PRINT_NORMAL, "%s", (const char *)msg); break;180case MESSAGE_INT32: PrintLog(PRINT_NORMAL, "%i", *(int32 *)msg); break;181case MESSAGE_UINT32: PrintLog(PRINT_NORMAL, "%i", *(uint32 *)msg, 0); break;182case MESSAGE_FLOAT: PrintLog(PRINT_NORMAL, "%f", *(float *)msg); break;183default: break;184}185}186187useEndLine = true;188}189#endif190191#if !RETRO_USE_ORIGINAL_CODE192uint8 touchTimer = 0;193194namespace RSDK195{196void DevMenu_HandleTouchControls(int8 cornerButton)197{198bool32 cornerCheck = cornerButton != CORNERBUTTON_START ? !controller[CONT_ANY].keyLeft.down && !controller[CONT_ANY].keyRight.down199: !controller[CONT_ANY].keyStart.down;200201if (cornerCheck && !controller[CONT_ANY].keyUp.down && !controller[CONT_ANY].keyDown.down) {202for (int32 t = 0; t < touchInfo.count; ++t) {203int32 tx = (int32)(touchInfo.x[t] * screens->size.x);204int32 ty = (int32)(touchInfo.y[t] * screens->size.y);205206bool32 touchingSlider = cornerButton == CORNERBUTTON_SLIDER && tx > screens->center.x && ty > screens->center.y;207208if (touchInfo.down[t] && (!(touchTimer % 8) || touchingSlider)) {209if (tx < screens->center.x) {210if (ty >= screens->center.y) {211if (!controller[CONT_ANY].keyDown.down)212controller[CONT_ANY].keyDown.press = true;213214controller[CONT_ANY].keyDown.down = true;215break;216}217else {218if (!controller[CONT_ANY].keyUp.down)219controller[CONT_ANY].keyUp.press = true;220221controller[CONT_ANY].keyUp.down = true;222break;223}224}225else if (tx > screens->center.x) {226if (ty > screens->center.y) {227if (cornerButton == CORNERBUTTON_START) {228if (!controller[CONT_ANY].keyStart.down)229controller[CONT_ANY].keyStart.press = true;230231controller[CONT_ANY].keyStart.down = true;232}233else {234if (tx < screens->size.x * 0.75) {235if (!controller[CONT_ANY].keyLeft.down)236controller[CONT_ANY].keyLeft.press = true;237238controller[CONT_ANY].keyLeft.down = true;239}240else {241if (!controller[CONT_ANY].keyRight.down)242controller[CONT_ANY].keyRight.press = true;243244controller[CONT_ANY].keyRight.down = true;245break;246}247}248break;249}250else {251if (!controller[CONT_ANY].keyB.down)252controller[CONT_ANY].keyB.press = true;253254controller[CONT_ANY].keyB.down = true;255break;256}257}258}259}260}261262touchTimer++;263}264} // namespace RSDK265#endif266267void RSDK::OpenDevMenu()268{269devMenu.state = DevMenu_MainMenu;270devMenu.selection = 0;271devMenu.scrollPos = 0;272devMenu.timer = 0;273274#if RETRO_REV0U275switch (engine.version) {276default: break;277278case 5:279devMenu.sceneState = sceneInfo.state;280videoSettings.screenCount = sceneInfo.state == ENGINESTATE_VIDEOPLAYBACK ? 1 : videoSettings.screenCount;281sceneInfo.state = ENGINESTATE_DEVMENU;282break;283284case 4:285case 3:286devMenu.sceneState = RSDK::Legacy::gameMode;287RSDK::Legacy::gameMode = RSDK::Legacy::ENGINE_DEVMENU;288break;289}290#if RETRO_USE_MOD_LOADER291devMenu.startingVersion = engine.version;292#endif293#else294devMenu.sceneState = sceneInfo.state;295videoSettings.screenCount = sceneInfo.state == ENGINESTATE_VIDEOPLAYBACK ? 1 : videoSettings.screenCount;296sceneInfo.state = ENGINESTATE_DEVMENU;297#endif298299PauseSound();300}301302void RSDK::CloseDevMenu()303{304#if RETRO_REV0U305switch (engine.version) {306default: break;307case 5:308videoSettings.screenCount = sceneInfo.state == ENGINESTATE_VIDEOPLAYBACK ? 0 : videoSettings.screenCount;309sceneInfo.state = devMenu.sceneState;310break;311case 4:312case 3: RSDK::Legacy::gameMode = devMenu.sceneState; break;313}314#else315videoSettings.screenCount = sceneInfo.state == ENGINESTATE_VIDEOPLAYBACK ? 0 : videoSettings.screenCount;316sceneInfo.state = devMenu.sceneState;317#endif318319#if RETRO_USE_MOD_LOADER320if (devMenu.modMenuCalled) {321devMenu.modMenuCalled = false;322323if (!CheckValidScene()) {324sceneInfo.activeCategory = 0;325sceneInfo.listPos = 0;326}327328#if RETRO_REV0U329switch (engine.version) {330default: break;331case 5: LoadScene(); break;332case 4:333case 3:334RSDK::Legacy::ResetCurrentStageFolder();335RSDK::Legacy::stageMode = RSDK::Legacy::STAGEMODE_LOAD;336break;337}338#else339LoadScene();340#endif341}342#endif343344ResumeSound();345}346347#if RETRO_USE_MOD_LOADER348void RSDK::OpenModMenu()349{350LoadMods(true); // reload our mod list real quick351if (modList.size() != 0) {352OpenDevMenu();353devMenu.state = DevMenu_ModsMenu;354devMenu.modMenuCalled = true;355}356else {357#if RETRO_REV0U358switch (engine.version) {359default: break;360case 5: LoadScene(); break;361case 4:362case 3: RSDK::Legacy::stageMode = RSDK::Legacy::STAGEMODE_LOAD; break;363}364#else365LoadScene();366#endif367}368}369#endif370371void RSDK::DevMenu_MainMenu()372{373#if !RETRO_USE_MOD_LOADER374const int32 selectionCount = 5;375uint32 selectionColors[] = { 0x808090, 0x808090, 0x808090, 0x808090, 0x808090 };376const char *selectionNames[] = { "Resume", "Restart", "Stage Select", "Options", "Exit" };377#else378const int32 selectionCount = 6;379uint32 selectionColors[] = { 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090 };380const char *selectionNames[] = { "Resume", "Restart", "Stage Select", "Options", "Mods", "Exit" };381#endif382selectionColors[devMenu.selection] = 0xF0F0F0;383384// Info Box385int32 y = currentScreen->center.y - 80;386DrawRectangle(currentScreen->center.x - 128, currentScreen->center.y - 84, 0x100, 0x30, 0x80, 0xFF, INK_NONE, true);387DrawDevString("RETRO ENGINE " ENGINE_V_NAME, currentScreen->center.x, y, ALIGN_CENTER, 0xF0F0F0);388389y += 8;390DrawDevString("Dev Menu", currentScreen->center.x, y, ALIGN_CENTER, 0xF0F0F0);391392y += 8;393#if RETRO_USE_MOD_LOADER394if (devMenu.modsChanged)395DrawDevString("Game will restart on resume!", currentScreen->center.x, y, ALIGN_CENTER, 0xF08080);396#ifdef RETRO_DEV_EXTRA397else398DrawDevString(RETRO_DEV_EXTRA, currentScreen->center.x, y, ALIGN_CENTER, 0x808090);399#endif400#endif401y += 8;402DrawDevString(gameVerInfo.gameTitle, currentScreen->center.x, y, ALIGN_CENTER, 0x808090);403404y += 8;405DrawDevString(gameVerInfo.version, currentScreen->center.x, y, ALIGN_CENTER, 0x808090);406407// Selections Box408y += 24;409DrawRectangle(currentScreen->center.x - 128, y - 8, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);410411for (int32 i = 0; i < selectionCount; ++i) {412DrawDevString(selectionNames[i], currentScreen->center.x, y, ALIGN_CENTER, selectionColors[i]);413#if RETRO_USE_MOD_LOADER414y += 10;415#else416y += 12;417#endif418}419y += 20;420421// Storage box422423// Stage Storage424int32 stgUsed = (int32)((sizeof(int32) * dataStorage[DATASET_STG].usedStorage) / (float)dataStorage[DATASET_STG].storageLimit * 126.0);425DrawRectangle(currentScreen->center.x - 40, y, 0x80, 0x08, 0x80, 0xFF, INK_NONE, true);426DrawRectangle(currentScreen->center.x - 39, y + 1, stgUsed, 6, 0xF0F0F0, 0xFF, INK_NONE, true);427DrawDevString("STG", currentScreen->center.x - 64, y, 0, 0xF0F080);428429// Music Storage430int32 musUsed = (int32)((sizeof(int32) * dataStorage[DATASET_MUS].usedStorage) / (float)dataStorage[DATASET_MUS].storageLimit * 126.0);431y += 10;432DrawRectangle(currentScreen->center.x - 40, y, 0x80, 0x08, 0x80, 0xFF5, INK_NONE, true);433DrawRectangle(currentScreen->center.x - 39, y + 1, musUsed, 6, 0xF0F0F0, 0xFF, INK_NONE, true);434DrawDevString("MUS", currentScreen->center.x - 64, y, 0, 0xF0F080);435436// SoundFX Storage437int32 sfxUsed = (int32)((sizeof(int32) * dataStorage[DATASET_SFX].usedStorage) / (float)dataStorage[DATASET_SFX].storageLimit * 126.0);438y += 10;439DrawRectangle(currentScreen->center.x - 40, y, 0x80, 0x08, 0x80, 0xFF, INK_NONE, true);440DrawRectangle(currentScreen->center.x - 39, y + 1, sfxUsed, 6, 0xF0F0F0, 0xFF, INK_NONE, true);441DrawDevString("SFX", currentScreen->center.x - 64, y, 0, 0xF0F080);442443// String Storage444int32 strUsed = (int32)((sizeof(int32) * dataStorage[DATASET_STR].usedStorage) / (float)dataStorage[DATASET_STR].storageLimit * 126.0);445y += 10;446DrawRectangle(currentScreen->center.x - 40, y, 0x80, 0x08, 0x80, 0xFF, INK_NONE, true);447DrawRectangle(currentScreen->center.x - 39, y + 1, strUsed, 6, 0xF0F0F0, 0xFF, INK_NONE, true);448DrawDevString("STR", currentScreen->center.x - 64, y, 0, 0xF0F080);449450// Temp Storage451int32 tmpUsed = (int32)((sizeof(int32) * dataStorage[DATASET_TMP].usedStorage) / (float)dataStorage[DATASET_TMP].storageLimit * 126.0);452y += 10;453DrawRectangle(currentScreen->center.x - 40, y, 0x80, 0x08, 0x80, 0xFF, INK_NONE, true);454DrawRectangle(currentScreen->center.x - 39, y + 1, tmpUsed, 6, 0xF0F0F0, 0xFF, INK_NONE, true);455DrawDevString("TMP", currentScreen->center.x - 64, y, 0, 0xF0F080);456457#if !RETRO_USE_ORIGINAL_CODE458DevMenu_HandleTouchControls(CORNERBUTTON_START);459#endif460461if (controller[CONT_ANY].keyUp.press) {462devMenu.selection--;463devMenu.timer = 1;464465if (devMenu.selection < 0)466devMenu.selection += selectionCount;467}468else if (controller[CONT_ANY].keyUp.down) {469if (devMenu.timer) {470devMenu.timer = ++devMenu.timer & 7;471}472else {473devMenu.selection--;474devMenu.timer = ++devMenu.timer & 7;475476if (devMenu.selection < 0)477devMenu.selection += selectionCount;478}479}480481if (controller[CONT_ANY].keyDown.press) {482devMenu.selection++;483devMenu.timer = 1;484485if (devMenu.selection >= selectionCount)486devMenu.selection -= selectionCount;487}488else if (controller[CONT_ANY].keyDown.down) {489if (devMenu.timer) {490devMenu.timer = ++devMenu.timer & 7;491}492else {493devMenu.selection++;494devMenu.timer = ++devMenu.timer & 7;495496if (devMenu.selection >= selectionCount)497devMenu.selection -= selectionCount;498}499}500501bool32 confirm = controller[CONT_ANY].keyA.press;502#if RETRO_REV02503if (SKU::userCore->GetConfirmButtonFlip())504#else505if (SKU::GetConfirmButtonFlip())506#endif507confirm = controller[CONT_ANY].keyB.press;508509if (controller[CONT_ANY].keyStart.press || confirm) {510#if RETRO_USE_MOD_LOADER && RETRO_REV0U511if (devMenu.selection <= 1 && devMenu.startingVersion != engine.version) {512// goofy aaa hack513RSDK::Legacy::stageMode = RSDK::Legacy::STAGEMODE_NORMAL;514devMenu.selection = 0;515}516#endif517switch (devMenu.selection) {518case 0: CloseDevMenu(); break;519520case 1:521#if RETRO_REV0U522switch (engine.version) {523default: break;524case 5: sceneInfo.state = ENGINESTATE_LOAD; break;525526case 4:527case 3:528RSDK::Legacy::gameMode = RSDK::Legacy::ENGINE_MAINGAME;529RSDK::Legacy::stageMode = RSDK::Legacy::STAGEMODE_LOAD;530break;531}532#else533sceneInfo.state = ENGINESTATE_LOAD;534#endif535break;536537case 2:538#if RETRO_REV0U && RETRO_USE_MOD_LOADER539if (engine.version == 5) {540devMenu.state = DevMenu_CategorySelectMenu;541devMenu.selection = 0;542devMenu.timer = 1;543}544else {545devMenu.state = DevMenu_PlayerSelectMenu;546devMenu.scrollPos = 0;547devMenu.selection = 0;548}549#else550devMenu.state = DevMenu_CategorySelectMenu;551devMenu.selection = 0;552devMenu.timer = 1;553#endif554break;555556case 3:557devMenu.state = DevMenu_OptionsMenu;558devMenu.selection = 0;559devMenu.timer = 1;560break;561562#if !RETRO_USE_MOD_LOADER563case 4: RenderDevice::isRunning = false; break;564#else565case 4:566LoadMods(true); // reload our mod list real quick567if (modList.size() != 0) {568devMenu.state = DevMenu_ModsMenu;569devMenu.selection = 0;570devMenu.timer = 1;571}572break;573574case 5: RenderDevice::isRunning = false; break;575#endif576577default: break;578}579}580#if !RETRO_USE_ORIGINAL_CODE581#if RETRO_REV02582else if (SKU::userCore->GetConfirmButtonFlip() ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {583#else584else if (SKU::GetConfirmButtonFlip() ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {585#endif586CloseDevMenu();587}588#endif589}590void RSDK::DevMenu_CategorySelectMenu()591{592uint32 selectionColors[] = {5930x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090,594};595selectionColors[devMenu.selection - devMenu.scrollPos] = 0xF0F0F0;596597int32 dy = currentScreen->center.y;598DrawRectangle(currentScreen->center.x - 128, dy - 84, 0x100, 0x30, 0x80, 0xFF, INK_NONE, true);599600dy -= 68;601DrawDevString("SELECT STAGE CATEGORY", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F0F0);602DrawRectangle(currentScreen->center.x - 128, dy + 36, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);603604int32 y = dy + 40;605for (int32 i = 0; i < 8; ++i) {606if (devMenu.scrollPos + i < sceneInfo.categoryCount) {607DrawDevString(sceneInfo.listCategory[devMenu.scrollPos + i].name, currentScreen->center.x - 64, y, ALIGN_LEFT, selectionColors[i]);608y += 8;609}610}611612#if !RETRO_USE_ORIGINAL_CODE613DevMenu_HandleTouchControls(CORNERBUTTON_START);614#endif615616if (controller[CONT_ANY].keyUp.press) {617if (--devMenu.selection < 0)618devMenu.selection += sceneInfo.categoryCount;619620if (devMenu.selection >= devMenu.scrollPos) {621if (devMenu.selection > devMenu.scrollPos + 7)622devMenu.scrollPos = devMenu.selection - 7;623}624else {625devMenu.scrollPos = devMenu.selection;626}627628devMenu.timer = 1;629}630else if (controller[CONT_ANY].keyUp.down) {631if (devMenu.timer) {632devMenu.timer = (devMenu.timer + 1) & 7;633634if (devMenu.selection >= devMenu.scrollPos) {635if (devMenu.selection > devMenu.scrollPos + 7)636devMenu.scrollPos = devMenu.selection - 7;637}638else {639devMenu.scrollPos = devMenu.selection;640}641}642else {643if (--devMenu.selection < 0)644devMenu.selection += sceneInfo.categoryCount;645646devMenu.timer = (devMenu.timer + 1) & 7;647648if (devMenu.selection >= devMenu.scrollPos) {649if (devMenu.selection > devMenu.scrollPos + 7)650devMenu.scrollPos = devMenu.selection - 7;651}652else {653devMenu.scrollPos = devMenu.selection;654}655}656}657658if (controller[CONT_ANY].keyDown.press) {659if (++devMenu.selection == sceneInfo.categoryCount)660devMenu.selection = 0;661662if (devMenu.selection >= devMenu.scrollPos) {663if (devMenu.selection > devMenu.scrollPos + 7)664devMenu.scrollPos = devMenu.selection - 7;665}666else {667devMenu.scrollPos = devMenu.selection;668}669670devMenu.timer = 1;671}672else if (controller[CONT_ANY].keyDown.down) {673if (devMenu.timer) {674devMenu.timer = (devMenu.timer + 1) & 7;675676if (devMenu.selection >= devMenu.scrollPos) {677if (devMenu.selection > devMenu.scrollPos + 7)678devMenu.scrollPos = devMenu.selection - 7;679}680else {681devMenu.scrollPos = devMenu.selection;682}683}684else {685if (++devMenu.selection == sceneInfo.categoryCount)686devMenu.selection = 0;687688devMenu.timer = (devMenu.timer + 1) & 7;689690if (devMenu.selection >= devMenu.scrollPos) {691if (devMenu.selection > devMenu.scrollPos + 7)692devMenu.scrollPos = devMenu.selection - 7;693}694else {695devMenu.scrollPos = devMenu.selection;696}697}698}699700bool32 confirm = controller[CONT_ANY].keyA.press;701#if RETRO_REV02702bool32 swap = SKU::userCore->GetConfirmButtonFlip();703#else704bool32 swap = SKU::GetConfirmButtonFlip();705#endif706if (swap)707confirm = controller[CONT_ANY].keyB.press;708709if (controller[CONT_ANY].keyStart.press || confirm) {710if (sceneInfo.listCategory[devMenu.selection].sceneCount) {711devMenu.state = DevMenu_SceneSelectMenu;712devMenu.listPos = devMenu.selection;713devMenu.scrollPos = 0;714devMenu.selection = 0;715}716}717#if !RETRO_USE_ORIGINAL_CODE718else if (swap ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {719#if RETRO_REV0U && RETRO_USE_MOD_LOADER720if (engine.version == 5) {721devMenu.state = DevMenu_MainMenu;722devMenu.listPos = 0;723devMenu.scrollPos = 0;724devMenu.selection = 2;725}726else {727devMenu.state = DevMenu_PlayerSelectMenu;728devMenu.listPos = 0;729devMenu.scrollPos = 0;730devMenu.selection = 0;731}732#else733devMenu.state = DevMenu_MainMenu;734devMenu.listPos = 0;735devMenu.scrollPos = 0;736devMenu.selection = 2;737#endif //! RETRO_REV0U && RETRO_USE_MOD_LOADER738}739#endif // ! !RETRO_USE_ORIGINAL_CODE740}741void RSDK::DevMenu_SceneSelectMenu()742{743uint32 selectionColors[] = {7440x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090,745};746selectionColors[devMenu.selection - devMenu.scrollPos] = 0xF0F0F0;747748int32 dy = currentScreen->center.y;749DrawRectangle(currentScreen->center.x - 128, dy - 84, 0x100, 0x30, 0x80, 0xFF, INK_NONE, true);750751dy -= 68;752DrawDevString("SELECT STAGE SCENE", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F0F0);753DrawRectangle(currentScreen->center.x - 128, dy + 36, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);754755int32 y = dy + 40;756SceneListInfo *list = &sceneInfo.listCategory[devMenu.listPos];757int32 start = list->sceneOffsetStart;758for (int32 i = 0; i < 8; ++i) {759if (devMenu.scrollPos + i < list->sceneCount) {760DrawDevString(sceneInfo.listData[start + (devMenu.scrollPos + i)].name, currentScreen->center.x + 96, y, ALIGN_RIGHT, selectionColors[i]);761y += 8;762devMenu.scrollPos = devMenu.scrollPos; //? look into763}764}765766#if !RETRO_USE_ORIGINAL_CODE767DevMenu_HandleTouchControls(CORNERBUTTON_START);768#endif769770if (controller[CONT_ANY].keyUp.press) {771if (start + --devMenu.selection < list->sceneOffsetStart)772devMenu.selection = list->sceneCount - 1;773774if (devMenu.selection >= devMenu.scrollPos) {775if (devMenu.selection > devMenu.scrollPos + 7) {776devMenu.scrollPos = devMenu.selection - 7;777}778}779else {780devMenu.scrollPos = devMenu.selection;781}782783devMenu.timer = 1;784}785else if (controller[CONT_ANY].keyUp.down) {786if (!devMenu.timer && start + --devMenu.selection < list->sceneOffsetStart)787devMenu.selection = list->sceneCount - 1;788789devMenu.timer = (devMenu.timer + 1) & 7;790791if (devMenu.selection >= devMenu.scrollPos) {792if (devMenu.selection > devMenu.scrollPos + 7)793devMenu.scrollPos = devMenu.selection - 7;794}795else {796devMenu.scrollPos = devMenu.selection;797}798}799800if (controller[CONT_ANY].keyDown.press) {801if (++devMenu.selection >= list->sceneCount)802devMenu.selection = 0;803804if (devMenu.selection >= devMenu.scrollPos) {805if (devMenu.selection > devMenu.scrollPos + 7)806devMenu.scrollPos = devMenu.selection - 7;807}808else {809devMenu.scrollPos = devMenu.selection;810}811812devMenu.timer = 1;813}814else if (controller[CONT_ANY].keyDown.down) {815if (!devMenu.timer && ++devMenu.selection >= list->sceneCount)816devMenu.selection = 0;817818devMenu.timer = (devMenu.timer + 1) & 7;819820if (devMenu.selection >= devMenu.scrollPos) {821if (devMenu.selection > devMenu.scrollPos + 7)822devMenu.scrollPos = devMenu.selection - 7;823}824else {825devMenu.scrollPos = devMenu.selection;826}827}828829bool32 confirm = controller[CONT_ANY].keyA.press;830#if RETRO_REV02831bool32 swap = SKU::userCore->GetConfirmButtonFlip();832#else833bool32 swap = SKU::GetConfirmButtonFlip();834#endif835if (swap)836confirm = controller[CONT_ANY].keyB.press;837838if (controller[CONT_ANY].keyStart.press || confirm) {839840#if RETRO_REV02841// they hardcoded a check in here that forces you to own the encore DLC to select encore mode stages842bool32 disabled = strcmp(list->name, "Encore Mode") == 0 && !SKU::userCore->CheckDLC(0);843#else844bool32 disabled = false;845#endif846847if (!disabled) {848sceneInfo.activeCategory = devMenu.listPos;849sceneInfo.listPos = devMenu.selection + list->sceneOffsetStart;850851#if RETRO_REV0U852switch (engine.version) {853default: break;854case 5: sceneInfo.state = ENGINESTATE_LOAD; break;855case 4:856case 3:857#if !RETRO_USE_ORIGINAL_CODE858RSDK::Legacy::debugMode = confirm;859#endif860#if RETRO_USE_MOD_LOADER861switch (engine.version) {862case 3: RSDK::Legacy::v3::playerListPos = devMenu.playerListPos; break;863case 4: RSDK::Legacy::v4::playerListPos = devMenu.playerListPos; break;864}865#endif866RSDK::Legacy::gameMode = RSDK::Legacy::ENGINE_MAINGAME;867RSDK::Legacy::stageMode = RSDK::Legacy::STAGEMODE_LOAD;868break;869}870#else871sceneInfo.state = ENGINESTATE_LOAD;872#endif //! RETRO_REV0U873874// Bug Details(?):875// rev01 had this here, rev02 does not.876// This can cause an annoying popup when starting a stage877#if !RETRO_REV02878AssignInputSlotToDevice(CONT_P1, INPUT_AUTOASSIGN);879#endif880}881}882#if !RETRO_USE_ORIGINAL_CODE883else if (swap ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {884devMenu.state = DevMenu_CategorySelectMenu;885devMenu.scrollPos = 0;886devMenu.selection = 0;887devMenu.listPos = 0;888}889#endif890}891void RSDK::DevMenu_OptionsMenu()892{893const uint8 selectionCount = RETRO_REV02 ? 5 : 4;894#if RETRO_REV02895uint32 selectionColors[] = { 0x808090, 0x808090, 0x808090, 0x808090, 0x808090 };896#else897uint32 selectionColors[] = { 0x808090, 0x808090, 0x808090, 0x808090 };898#endif899selectionColors[devMenu.selection] = 0xF0F0F0;900901int32 dy = currentScreen->center.y;902DrawRectangle(currentScreen->center.x - 128, dy - 84, 256, 0x30, 0x80, 0xFF, INK_NONE, true);903904dy -= 68;905DrawDevString("OPTIONS", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F0F0);906907dy += 44;908DrawRectangle(currentScreen->center.x - 128, dy - 8, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);909910DrawDevString("Video Settings", currentScreen->center.x, dy, ALIGN_CENTER, selectionColors[0]);911912dy += 12;913DrawDevString("Audio Settings", currentScreen->center.x, dy, ALIGN_CENTER, selectionColors[1]);914915dy += 12;916DrawDevString("Configure Input", currentScreen->center.x, dy, ALIGN_CENTER, selectionColors[2]);917918#if RETRO_REV02919dy += 12;920DrawDevString("Debug Flags", currentScreen->center.x, dy, ALIGN_CENTER, selectionColors[3]);921922#endif923DrawDevString("Back", currentScreen->center.x, dy + 12, ALIGN_CENTER, selectionColors[selectionCount - 1]);924925#if !RETRO_USE_ORIGINAL_CODE926DevMenu_HandleTouchControls(CORNERBUTTON_START);927#endif928929if (controller[CONT_ANY].keyUp.press) {930if (--devMenu.selection < 0)931devMenu.selection = selectionCount - 1;932933devMenu.timer = 1;934}935else if (controller[CONT_ANY].keyUp.down) {936if (!devMenu.timer && --devMenu.selection < 0)937devMenu.selection = selectionCount - 1;938939devMenu.timer = (devMenu.timer + 1) & 7;940}941942if (controller[CONT_ANY].keyDown.press) {943if (++devMenu.selection >= selectionCount)944devMenu.selection = 0;945946devMenu.timer = 1;947}948else if (controller[CONT_ANY].keyDown.down) {949if (!devMenu.timer && ++devMenu.selection >= selectionCount)950devMenu.selection = 0;951952devMenu.timer = (devMenu.timer + 1) & 7;953}954955bool32 confirm = controller[CONT_ANY].keyA.press;956#if RETRO_REV02957bool32 swap = SKU::userCore->GetConfirmButtonFlip();958#else959bool32 swap = SKU::GetConfirmButtonFlip();960#endif961if (swap)962confirm = controller[CONT_ANY].keyB.press;963964if (controller[CONT_ANY].keyStart.press || confirm) {965switch (devMenu.selection) {966case 0: {967devMenu.windowed = videoSettings.windowed;968devMenu.windowScale = (videoSettings.windowHeight / videoSettings.pixHeight) - 1;969970int32 aspect = (int32)((videoSettings.windowWidth / (float)videoSettings.windowHeight) * (float)SCREEN_YSIZE) >> 3;971switch (aspect) {972default:973case 40: devMenu.windowAspect = 0; break; // 4:3974case 45: devMenu.windowAspect = 1; break; // 3:2975case 48: devMenu.windowAspect = 2; break; // 16:10976case 50: devMenu.windowAspect = 3; break; // 5:3977case 53: devMenu.windowAspect = 4; break; // 16:9978}979980devMenu.state = DevMenu_VideoOptionsMenu;981devMenu.selection = 0;982break;983}984985case 1:986devMenu.state = DevMenu_AudioOptionsMenu;987devMenu.selection = 0;988break;989990case 2:991devMenu.state = DevMenu_InputOptionsMenu;992devMenu.selection = 0;993break;994995#if RETRO_REV02996case 3: devMenu.state = DevMenu_DebugOptionsMenu; devMenu.selection = 0;997998#if !RETRO_USE_ORIGINAL_CODE999// reset this just to be sure there's no crashing since we can go back from prev menus unlike original RSDKv51000devMenu.scrollPos = 0;1001#endif1002break;10031004case 4:1005#else1006case 3:1007#endif1008devMenu.state = DevMenu_MainMenu;1009devMenu.selection = 0;1010break;1011}1012}1013#if !RETRO_USE_ORIGINAL_CODE1014else if (swap ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {1015devMenu.state = DevMenu_MainMenu;1016devMenu.listPos = 0;1017devMenu.scrollPos = 0;1018devMenu.selection = 3;1019}1020#endif1021}1022void RSDK::DevMenu_VideoOptionsMenu()1023{1024uint32 selectionColors[] = { 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090 };1025selectionColors[devMenu.selection] = 0xF0F0F0;10261027int32 dy = currentScreen->center.y;1028DrawRectangle(currentScreen->center.x - 128, dy - 84, 0x100, 0x30, 0x80, 0xFF, INK_NONE, true);10291030dy -= 68;1031DrawDevString("VIDEO SETTINGS", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F0F0);10321033dy += 44;1034DrawRectangle(currentScreen->center.x - 128, dy - 8, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);10351036DrawDevString("Window Size:", currentScreen->center.x - 96, dy, 0, selectionColors[0]);10371038const char *scale = "unknown";1039switch (devMenu.windowScale) {1040case 0: scale = "1x"; break;1041case 1: scale = "2x"; break;1042case 2: scale = "3x"; break;1043case 3: scale = "4x"; break;1044default: break;1045}1046DrawDevString(scale, currentScreen->center.x + 80, dy, ALIGN_CENTER, 0xF0F080);10471048dy += 8;1049DrawDevString("Window Aspect:", currentScreen->center.x - 96, dy, 0, selectionColors[1]);10501051const char *aspect = "unknown";1052switch (devMenu.windowAspect) {1053case 0: aspect = "4:3"; break;1054case 1: aspect = "3:2"; break;1055case 2: aspect = "16:10"; break;1056case 3: aspect = "5:3"; break;1057case 4: aspect = "16:9"; break;1058default: break;1059}1060DrawDevString(aspect, currentScreen->center.x + 80, dy, ALIGN_CENTER, 0xF0F080);10611062dy += 8;1063DrawDevString("Fullscreen:", currentScreen->center.x - 96, dy, 0, selectionColors[2]);1064DrawDevString(devMenu.windowed ? "NO" : "YES", currentScreen->center.x + 80, dy, ALIGN_CENTER, 0xF0F080);10651066dy += 8;1067DrawDevString("Screen Shader:", currentScreen->center.x - 96, dy, ALIGN_LEFT, selectionColors[3]);1068DrawDevString(shaderList[videoSettings.shaderID].name, currentScreen->center.x + 80, dy, ALIGN_CENTER, 0xF0F080);10691070dy += 16;1071DrawDevString("Confirm", currentScreen->center.x, dy, ALIGN_CENTER, selectionColors[4]);1072DrawDevString("Cancel", currentScreen->center.x, dy + 8, ALIGN_CENTER, selectionColors[5]);10731074#if !RETRO_USE_ORIGINAL_CODE1075DevMenu_HandleTouchControls(devMenu.selection < 4);1076#endif10771078if (controller[CONT_ANY].keyUp.press) {1079if (--devMenu.selection < 0)1080devMenu.selection = 5;10811082devMenu.timer = 1;1083}1084else if (controller[CONT_ANY].keyUp.down) {1085if (!devMenu.timer && --devMenu.selection < 0)1086devMenu.selection = 5;10871088devMenu.timer = (devMenu.timer + 1) & 7;1089}10901091if (controller[CONT_ANY].keyDown.press) {1092if (++devMenu.selection > 5)1093devMenu.selection = 0;10941095devMenu.timer = 1;1096}1097else if (controller[CONT_ANY].keyDown.down) {1098if (!devMenu.timer && ++devMenu.selection > 5)1099devMenu.selection = 0;11001101devMenu.timer = (devMenu.timer + 1) & 7;1102}11031104switch (devMenu.selection) {1105case 0: // scale1106if (controller[CONT_ANY].keyLeft.press) {1107devMenu.windowScale = (devMenu.windowScale - 1) & 3;1108changedVideoSettings = true;1109}1110else if (controller[CONT_ANY].keyRight.press) {1111devMenu.windowScale = (devMenu.windowScale + 1) & 3;1112changedVideoSettings = true;1113}1114break;11151116case 1: // aspect1117if (controller[CONT_ANY].keyLeft.press) {1118devMenu.windowAspect--;1119changedVideoSettings = true;1120}1121else if (controller[CONT_ANY].keyRight.press) {1122devMenu.windowAspect++;1123changedVideoSettings = true;1124}11251126if (devMenu.windowAspect > 4)1127devMenu.windowAspect = 0;1128else if (devMenu.windowAspect < 0)1129devMenu.windowAspect = 4;1130break;11311132case 2: // fullscreen1133if (controller[CONT_ANY].keyLeft.press || controller[CONT_ANY].keyRight.press) {1134devMenu.windowed ^= 1;1135changedVideoSettings = true;1136}1137break;11381139case 3: // screenShader1140if (controller[CONT_ANY].keyLeft.press) {1141videoSettings.shaderID--;1142changedVideoSettings = true;1143}1144else if (controller[CONT_ANY].keyRight.press) {1145videoSettings.shaderID++;1146changedVideoSettings = true;1147}11481149if (videoSettings.shaderID >= userShaderCount)1150videoSettings.shaderID = SHADER_NONE;1151else if (videoSettings.shaderID < SHADER_NONE)1152videoSettings.shaderID = MAX(userShaderCount - 1, 0);1153break;11541155case 4: // confirm1156{1157bool32 confirm = controller[CONT_ANY].keyA.press;1158#if RETRO_REV021159if (SKU::userCore->GetConfirmButtonFlip())1160#else1161if (SKU::GetConfirmButtonFlip())1162#endif1163confirm = controller[CONT_ANY].keyB.press;11641165if (controller[CONT_ANY].keyStart.press || confirm) {1166// do confirm1167videoSettings.windowed = devMenu.windowed;1168shaderList[0].linear = !devMenu.windowed;1169if (!devMenu.windowScale)1170videoSettings.shaderID = SHADER_NONE;1171devMenu.windowScale++;11721173int32 width = 0;1174switch (devMenu.windowAspect) {1175default: width = videoSettings.windowWidth; break;1176case 0: width = 3 - (int32)(videoSettings.pixHeight * -1.3333334f); break; // 16:91177case 1: width = 3 - (int32)(videoSettings.pixHeight * -1.5f); break; // 4:31178case 2: width = 3 - (int32)(videoSettings.pixHeight * -1.6f); break; // 3:21179case 3: width = 3 - (int32)(videoSettings.pixHeight * -1.6666666f); break; // 16:101180case 4: width = 3 - (int32)(videoSettings.pixHeight * -1.7777778f); break; // 5:31181}1182width &= 0x7FF8;11831184#if !RETRO_USE_ORIGINAL_CODE1185if (customSettings.maxPixWidth && width > customSettings.maxPixWidth)1186width = customSettings.maxPixWidth;1187#else1188if (width > DEFAULT_PIXWIDTH)1189width = DEFAULT_PIXWIDTH;1190#endif11911192videoSettings.windowWidth = width * devMenu.windowScale;1193videoSettings.windowHeight = videoSettings.pixHeight * devMenu.windowScale;1194UpdateGameWindow();11951196devMenu.state = DevMenu_OptionsMenu;1197devMenu.selection = 0;1198}1199break;1200}12011202case 5: // cancel1203{1204bool32 confirm = controller[CONT_ANY].keyA.press;1205#if RETRO_REV021206if (SKU::userCore->GetConfirmButtonFlip())1207#else1208if (SKU::GetConfirmButtonFlip())1209#endif1210confirm = controller[CONT_ANY].keyB.press;12111212if (controller[CONT_ANY].keyStart.press || confirm) {1213devMenu.state = DevMenu_OptionsMenu;1214devMenu.selection = 0;1215}1216break;1217}1218}12191220#if !RETRO_USE_ORIGINAL_CODE1221#if RETRO_REV021222bool32 swap = SKU::userCore->GetConfirmButtonFlip();1223#else1224bool32 swap = SKU::GetConfirmButtonFlip();1225#endif1226if (swap ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {1227devMenu.state = DevMenu_OptionsMenu;1228devMenu.selection = 0;1229}1230#endif1231}1232void RSDK::DevMenu_AudioOptionsMenu()1233{1234uint32 selectionColors[] = { 0x808090, 0x808090, 0x808090, 0x808090 };1235selectionColors[devMenu.selection] = 0xF0F0F0;12361237int32 dy = currentScreen->center.y;1238DrawRectangle(currentScreen->center.x - 128, dy - 84, 0x100, 0x30, 0x80, 0xFF, INK_NONE, true);12391240dy -= 68;1241DrawDevString("AUDIO SETTINGS", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F0F0);12421243dy += 44;1244DrawRectangle(currentScreen->center.x - 128, dy - 8, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);12451246DrawDevString("Streams Enabled:", currentScreen->center.x - 96, dy, 0, selectionColors[0]);1247DrawDevString(engine.streamsEnabled ? "YES" : "NO", currentScreen->center.x + 80, dy, ALIGN_CENTER, 0xF0F080);12481249dy += 16;1250DrawDevString("Streams Vol:", currentScreen->center.x - 96, dy, 0, selectionColors[1]);1251DrawRectangle(currentScreen->center.x + 8, dy, 112, 8, 0x000000, 0xFF, INK_NONE, true);1252DrawRectangle(currentScreen->center.x + 9, dy + 1, (int32)(engine.streamVolume * 110.0), 6, 0xF0F0F0, 255, INK_NONE, true);12531254dy += 16;1255DrawDevString("SoundFX Vol:", currentScreen->center.x - 96, dy, 0, selectionColors[2]);1256DrawRectangle(currentScreen->center.x + 8, dy, 112, 8, 0x000000, 0xFF, INK_NONE, true);1257DrawRectangle(currentScreen->center.x + 9, dy + 1, (int32)(engine.soundFXVolume * 110.0), 6, 0xF0F0F0, 255, INK_NONE, true);1258DrawDevString("Back", currentScreen->center.x, dy + 16, ALIGN_CENTER, selectionColors[3]);12591260#if !RETRO_USE_ORIGINAL_CODE1261int8 cornerButton = CORNERBUTTON_START;1262switch (devMenu.selection) {1263case 0: cornerButton = CORNERBUTTON_LEFTRIGHT; break;12641265case 1:1266case 2: cornerButton = CORNERBUTTON_SLIDER; break;12671268case 3: cornerButton = CORNERBUTTON_START; break;1269}12701271DevMenu_HandleTouchControls(cornerButton);1272#endif12731274if (controller[CONT_ANY].keyUp.press) {1275if (--devMenu.selection < 0)1276devMenu.selection = 3;12771278devMenu.timer = 1;1279}1280else if (controller[CONT_ANY].keyUp.down) {1281if (!devMenu.timer && --devMenu.selection < 0)1282devMenu.selection = 3;12831284devMenu.timer = (devMenu.timer + 1) & 7;1285}12861287if (controller[CONT_ANY].keyDown.press) {1288if (++devMenu.selection > 3)1289devMenu.selection = 0;12901291devMenu.timer = 1;1292}1293else if (controller[CONT_ANY].keyDown.down) {1294if (!devMenu.timer && ++devMenu.selection > 3)1295devMenu.selection = 0;12961297devMenu.timer = (devMenu.timer + 1) & 7;1298}12991300switch (devMenu.selection) {1301case 0:1302if (controller[CONT_ANY].keyLeft.press || controller[CONT_ANY].keyRight.press) {1303engine.streamsEnabled ^= 1;1304changedVideoSettings = true;1305}1306break;13071308case 1:1309if (controller[CONT_ANY].keyLeft.down) {1310engine.streamVolume -= 1.0 / 64.0;1311if (engine.streamVolume < 0.0)1312engine.streamVolume = 0.0;13131314changedVideoSettings = true;1315}1316else {1317if (controller[CONT_ANY].keyRight.down) {1318engine.streamVolume += 1.0 / 64.0;1319if (engine.streamVolume > 1.0)1320engine.streamVolume = 1.0;13211322changedVideoSettings = true;1323}1324}1325break;13261327case 2:1328if (controller[CONT_ANY].keyLeft.down) {1329engine.soundFXVolume -= 1.0 / 64.0;1330if (engine.soundFXVolume < 0.0)1331engine.soundFXVolume = 0.0;13321333changedVideoSettings = true;1334}1335else {1336if (controller[CONT_ANY].keyRight.down) {1337engine.soundFXVolume += 1.0 / 64.0;1338if (engine.soundFXVolume > 1.0)1339engine.soundFXVolume = 1.0;13401341changedVideoSettings = true;1342}1343}1344break;13451346case 3: {1347bool32 confirm = controller[CONT_ANY].keyA.press;1348#if RETRO_REV021349if (SKU::userCore->GetConfirmButtonFlip())1350#else1351if (SKU::GetConfirmButtonFlip())1352#endif1353confirm = controller[CONT_ANY].keyB.press;13541355if (controller[CONT_ANY].keyStart.press || confirm) {1356devMenu.state = DevMenu_OptionsMenu;1357devMenu.selection = 1;1358}1359break;1360}1361}13621363#if !RETRO_USE_ORIGINAL_CODE1364#if RETRO_REV021365bool32 swap = SKU::userCore->GetConfirmButtonFlip();1366#else1367bool32 swap = SKU::GetConfirmButtonFlip();1368#endif1369if (swap ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {1370devMenu.state = DevMenu_OptionsMenu;1371devMenu.selection = 1;1372}1373#endif1374}1375void RSDK::DevMenu_InputOptionsMenu()1376{1377uint32 selectionColors[] = { 0x808090, 0x808090, 0x808090, 0x808090, 0x808090 };1378selectionColors[devMenu.selection] = 0xF0F0F0;13791380int32 dy = currentScreen->center.y;1381DrawRectangle(currentScreen->center.x - 128, dy - 84, 0x100, 0x30, 0x80, 0xFF, INK_NONE, true);13821383dy -= 68;1384DrawDevString("CONFIGURE INPUT", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F0F0);13851386dy += 44;1387DrawRectangle(currentScreen->center.x - 128, dy - 8, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);13881389DrawDevString("Set Keys For Input 1", currentScreen->center.x, dy, ALIGN_CENTER, selectionColors[0]);13901391dy += 10;1392DrawDevString("Set Keys For Input 2", currentScreen->center.x, dy, ALIGN_CENTER, selectionColors[1]);13931394dy += 10;1395DrawDevString("Set Keys For Input 3", currentScreen->center.x, dy, ALIGN_CENTER, selectionColors[2]);13961397dy += 10;1398DrawDevString("Set Keys For Input 4", currentScreen->center.x, dy, ALIGN_CENTER, selectionColors[3]);13991400DrawDevString("Back", currentScreen->center.x, dy + 18, ALIGN_CENTER, selectionColors[4]);14011402#if !RETRO_USE_ORIGINAL_CODE1403DevMenu_HandleTouchControls(CORNERBUTTON_START);1404#endif14051406if (controller[CONT_ANY].keyUp.press) {1407if (--devMenu.selection < 0)1408devMenu.selection = 4;14091410devMenu.timer = 1;1411}1412else if (controller[CONT_ANY].keyUp.down) {1413if (!devMenu.timer && --devMenu.selection < 0)1414devMenu.selection = 4;14151416devMenu.timer = (devMenu.timer + 1) & 7;1417}14181419if (controller[CONT_ANY].keyDown.press) {1420if (++devMenu.selection > 4)1421devMenu.selection = 0;14221423devMenu.timer = 1;1424}1425else if (controller[CONT_ANY].keyDown.down) {1426if (!devMenu.timer && ++devMenu.selection > 4)1427devMenu.selection = 0;14281429devMenu.timer = (devMenu.timer + 1) & 7;1430}14311432bool32 confirm = controller[CONT_ANY].keyA.press;1433#if RETRO_REV021434if (SKU::userCore->GetConfirmButtonFlip())1435#else1436if (SKU::GetConfirmButtonFlip())1437#endif1438confirm = controller[CONT_ANY].keyB.press;14391440if (controller[CONT_ANY].keyStart.press || confirm) {1441if (devMenu.selection == 4) {1442devMenu.state = DevMenu_OptionsMenu;1443devMenu.selection = 3;1444}1445else {1446devMenu.state = DevMenu_KeyMappingsMenu;1447devMenu.scrollPos = 0;1448changedVideoSettings = true;14491450controller[CONT_P1 + devMenu.selection].keyUp.keyMap = KEYMAP_AUTO_MAPPING;1451}1452}14531454#if !RETRO_USE_ORIGINAL_CODE1455#if RETRO_REV021456bool32 swap = SKU::userCore->GetConfirmButtonFlip();1457#else1458bool32 swap = SKU::GetConfirmButtonFlip();1459#endif1460if (swap ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {1461devMenu.state = DevMenu_OptionsMenu;1462devMenu.selection = 2;1463}1464#endif1465}1466void RSDK::DevMenu_KeyMappingsMenu()1467{1468#if !RETRO_USE_ORIGINAL_CODE1469DevMenu_HandleTouchControls(CORNERBUTTON_START);1470#endif14711472int32 dy = currentScreen->center.y;1473DrawRectangle(currentScreen->center.x - 128, dy - 84, 0x100, 0x30, 0x80, 0xFF, INK_NONE, true);14741475dy -= 68;1476DrawDevString("SET KEY BINDING", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F0F0);14771478dy += 44;1479DrawRectangle(currentScreen->center.x - 128, dy - 8, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);14801481int32 controllerID = CONT_P1 + devMenu.selection;1482switch (devMenu.scrollPos) {1483case 0:1484DrawDevString("Press Key For UP", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);1485if (controller[controllerID].keyUp.keyMap != KEYMAP_AUTO_MAPPING) {1486controller[controllerID].keyDown.keyMap = KEYMAP_AUTO_MAPPING;1487++devMenu.scrollPos;1488}1489break;14901491case 1:1492DrawDevString("Press Key For DOWN", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);1493if (controller[controllerID].keyDown.keyMap != KEYMAP_AUTO_MAPPING) {1494controller[controllerID].keyLeft.keyMap = KEYMAP_AUTO_MAPPING;1495++devMenu.scrollPos;1496}1497break;14981499case 2:1500DrawDevString("Press Key For LEFT", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);1501if (controller[controllerID].keyLeft.keyMap != KEYMAP_AUTO_MAPPING) {1502controller[controllerID].keyRight.keyMap = KEYMAP_AUTO_MAPPING;1503++devMenu.scrollPos;1504}1505break;15061507case 3:1508DrawDevString("Press Key For RIGHT", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);1509if (controller[controllerID].keyRight.keyMap != KEYMAP_AUTO_MAPPING) {1510controller[controllerID].keyA.keyMap = KEYMAP_AUTO_MAPPING;1511++devMenu.scrollPos;1512}1513break;15141515case 4:1516DrawDevString("Press Key For BUTTON A", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);1517if (controller[controllerID].keyA.keyMap != KEYMAP_AUTO_MAPPING) {1518controller[controllerID].keyB.keyMap = KEYMAP_AUTO_MAPPING;1519++devMenu.scrollPos;1520}1521break;15221523case 5:1524DrawDevString("Press Key For BUTTON B", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);1525if (controller[controllerID].keyB.keyMap != KEYMAP_AUTO_MAPPING) {1526controller[controllerID].keyC.keyMap = KEYMAP_AUTO_MAPPING;1527++devMenu.scrollPos;1528}1529break;15301531case 6:1532DrawDevString("Press Key For BUTTON C", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);1533if (controller[controllerID].keyC.keyMap != KEYMAP_AUTO_MAPPING) {1534controller[controllerID].keyX.keyMap = KEYMAP_AUTO_MAPPING;1535++devMenu.scrollPos;1536}1537break;15381539case 7:1540DrawDevString("Press Key For BUTTON X", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);1541if (controller[controllerID].keyX.keyMap != KEYMAP_AUTO_MAPPING) {1542controller[controllerID].keyY.keyMap = KEYMAP_AUTO_MAPPING;1543++devMenu.scrollPos;1544}1545break;15461547case 8:1548DrawDevString("Press Key For BUTTON Y", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);1549if (controller[controllerID].keyY.keyMap != KEYMAP_AUTO_MAPPING) {1550controller[controllerID].keyZ.keyMap = KEYMAP_AUTO_MAPPING;1551++devMenu.scrollPos;1552}1553break;15541555case 9:1556DrawDevString("Press Key For BUTTON Z", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);1557if (controller[controllerID].keyZ.keyMap != KEYMAP_AUTO_MAPPING) {1558controller[controllerID].keyStart.keyMap = KEYMAP_AUTO_MAPPING;1559++devMenu.scrollPos;1560}1561break;15621563case 10:1564DrawDevString("Press Key For START", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);1565if (controller[controllerID].keyStart.keyMap != KEYMAP_AUTO_MAPPING) {1566controller[controllerID].keySelect.keyMap = KEYMAP_AUTO_MAPPING;1567++devMenu.scrollPos;1568}1569break;15701571case 11:1572DrawDevString("Press Key For SELECT", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F080);1573if (controller[controllerID].keySelect.keyMap != KEYMAP_AUTO_MAPPING)1574devMenu.state = DevMenu_InputOptionsMenu;1575break;15761577default: break;1578}15791580#if !RETRO_USE_ORIGINAL_CODE1581#if RETRO_REV021582bool32 swap = SKU::userCore->GetConfirmButtonFlip();1583#else1584bool32 swap = SKU::GetConfirmButtonFlip();1585#endif1586if (swap ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {1587devMenu.state = DevMenu_OptionsMenu;1588devMenu.selection = 3;1589}1590#endif1591}1592#if RETRO_REV021593void RSDK::DevMenu_DebugOptionsMenu()1594{1595uint32 selectionColors[] = { 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090 };1596selectionColors[devMenu.selection - devMenu.scrollPos] = 0xF0F0F0;15971598int32 dy = currentScreen->center.y;1599DrawRectangle(currentScreen->center.x - 128, dy - 84, 0x100, 0x30, 0x80, 0xFF, INK_NONE, true);16001601dy -= 68;1602DrawDevString("CONFIGURE DEBUG FLAGS", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F0F0);16031604dy += 40;1605DrawRectangle(currentScreen->center.x - 128, dy - 4, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);16061607#if !RETRO_USE_ORIGINAL_CODE1608DevMenu_HandleTouchControls(devMenu.selection < viewableVarCount);1609#endif16101611bool32 confirm = controller[CONT_ANY].keyA.press;1612if (SKU::userCore->GetConfirmButtonFlip())1613confirm = controller[CONT_ANY].keyB.press;16141615confirm |= controller[CONT_ANY].keyStart.press;16161617for (int32 i = 0; i < 8; ++i) {1618if (devMenu.scrollPos + i < viewableVarCount) {1619ViewableVariable *value = &viewableVarList[devMenu.scrollPos + i];1620DrawDevString(value->name, currentScreen->center.x - 96, dy, ALIGN_LEFT, selectionColors[i]);16211622if (!value->value) {1623DrawDevString("--------", currentScreen->center.x + 96, dy, ALIGN_RIGHT, 0xF0F080);1624}1625else {1626char valueStr[0x10];1627strcpy(valueStr, "--------");16281629switch (value->size) {1630default: DrawDevString("--------", currentScreen->center.x + 96, dy, ALIGN_RIGHT, 0xF0F080); break;16311632case sizeof(uint8): {1633uint8 *v = (uint8 *)value->value;16341635switch (value->type) {1636case VIEWVAR_DISPLAY_BOOL:1637valueStr[0] = *v ? 'Y' : 'N';1638valueStr[1] = 0;1639break;16401641default:1642case VIEWVAR_DISPLAY_UNSIGNED: valueStr[0] = ' '; break;16431644case VIEWVAR_DISPLAY_SIGNED:1645valueStr[0] = *v > 0x7F ? '-' : ' ';1646*v &= 0x7F;1647break;1648}1649break;1650}16511652case sizeof(int16): {1653uint16 *v = (uint16 *)value->value;16541655switch (value->type) {1656case VIEWVAR_DISPLAY_BOOL:1657valueStr[0] = *v ? 'Y' : 'N';1658valueStr[1] = 0;1659break;16601661default:1662case VIEWVAR_DISPLAY_UNSIGNED: valueStr[0] = ' '; break;16631664case VIEWVAR_DISPLAY_SIGNED:1665valueStr[0] = *v > 0x7FFF ? '-' : ' ';1666*v &= 0x7FFF;1667break;1668}1669break;1670}16711672case sizeof(int32): {1673uint32 *v = (uint32 *)value->value;16741675switch (value->type) {1676case VIEWVAR_DISPLAY_BOOL:1677valueStr[0] = *v ? 'Y' : 'N';1678valueStr[1] = 0;1679break;16801681default:1682case VIEWVAR_DISPLAY_UNSIGNED: valueStr[0] = ' '; break;16831684case VIEWVAR_DISPLAY_SIGNED:1685valueStr[0] = *v > 0x7FFFFFFF ? '-' : ' ';1686*v &= 0x7FFFFFFF;1687break;1688}1689break;1690}1691}16921693if (value->type != VIEWVAR_DISPLAY_BOOL) {1694if (2 * value->size) {1695char *curChar = &valueStr[2 * value->size];1696valueStr[(2 * value->size) + 1] = 0;16971698switch (value->size) {1699default: break;17001701case sizeof(uint8): {1702uint8 *valuePtr = (uint8 *)value->value;17031704for (int32 v = 0; v < 2 * value->size; ++v) *curChar-- = ((v & 0xF) > 9 ? '7' : '0') + ((*valuePtr >> 4 * v) & 0xF);1705break;1706}17071708case sizeof(int16): {1709uint16 *valuePtr = (uint16 *)value->value;17101711for (int32 v = 0; v < 2 * value->size; ++v) *curChar-- = ((v & 0xF) > 9 ? '7' : '0') + ((*valuePtr >> 4 * v) & 0xF);1712break;1713}17141715case sizeof(int32): {1716uint32 *valuePtr = (uint32 *)value->value;17171718for (int32 v = 0; v < 2 * value->size; ++v) *curChar-- = ((v & 0xF) > 9 ? '7' : '0') + ((*valuePtr >> 4 * v) & 0xF);1719break;1720}1721}1722}1723}17241725DrawDevString(valueStr, currentScreen->center.x + 96, dy, ALIGN_CENTER, 0xF0F080);1726}1727dy += 8;1728}1729else {1730DrawDevString("Back", currentScreen->center.x, dy, ALIGN_CENTER, selectionColors[i]);1731}1732}17331734if (controller[CONT_ANY].keyUp.press) {1735if (--devMenu.selection < 0)1736devMenu.selection = viewableVarCount;17371738if (devMenu.selection >= devMenu.scrollPos) {1739if (devMenu.selection > devMenu.scrollPos + 7)1740devMenu.scrollPos = devMenu.selection - 7;1741}1742else {1743devMenu.scrollPos = devMenu.selection;1744}17451746devMenu.timer = 1;1747}1748else if (controller[CONT_ANY].keyUp.down) {1749if (!devMenu.timer && --devMenu.selection < 0)1750devMenu.selection = viewableVarCount;17511752devMenu.timer = (devMenu.timer + 1) & 7;17531754if (devMenu.selection >= devMenu.scrollPos) {1755if (devMenu.selection > devMenu.scrollPos + 7)1756devMenu.scrollPos = devMenu.selection - 7;1757}1758else {1759devMenu.scrollPos = devMenu.selection;1760}1761}17621763if (controller[CONT_ANY].keyDown.press) {1764if (++devMenu.selection > viewableVarCount)1765devMenu.selection = 0;17661767if (devMenu.selection >= devMenu.scrollPos) {1768if (devMenu.selection > devMenu.scrollPos + 7)1769devMenu.scrollPos = devMenu.selection - 7;1770}1771else {1772devMenu.scrollPos = devMenu.selection;1773}17741775devMenu.timer = 1;1776}1777else if (controller[CONT_ANY].keyDown.down) {1778if (!devMenu.timer && ++devMenu.selection >= viewableVarCount)1779devMenu.selection = 0;17801781devMenu.timer = (devMenu.timer + 1) & 7;1782if (devMenu.selection >= devMenu.scrollPos) {1783if (devMenu.selection > devMenu.scrollPos + 7)1784devMenu.scrollPos = devMenu.selection - 7;1785}1786else {1787devMenu.scrollPos = devMenu.selection;1788}1789}17901791if (devMenu.selection < viewableVarCount) {1792ViewableVariable *var = &viewableVarList[devMenu.selection];17931794switch (var->size) {1795default: DrawDevString("--------", currentScreen->center.x + 96, dy, ALIGN_RIGHT, 0xF0F080); break;17961797case sizeof(int8): {1798int8 *value = (int8 *)var->value;17991800if (controller[CONT_ANY].keyLeft.press) {1801if (var->type == VIEWVAR_DISPLAY_BOOL)1802*value ^= 1;1803else if (*value - 1 >= var->min)1804*value = *value - 1;1805}18061807if (controller[CONT_ANY].keyRight.press) {1808if (var->type == VIEWVAR_DISPLAY_BOOL)1809*value ^= 1;1810else if (*value + 1 <= var->max)1811*value = *value + 1;1812}1813break;1814}18151816case sizeof(int16): {1817int16 *value = (int16 *)var->value;18181819if (controller[CONT_ANY].keyLeft.press) {1820if (var->type == VIEWVAR_DISPLAY_BOOL)1821*value ^= 1;1822else if (*value - 1 >= var->min)1823*value = *value - 1;1824}18251826if (controller[CONT_ANY].keyRight.press) {1827if (var->type == VIEWVAR_DISPLAY_BOOL)1828*value ^= 1;1829else if (*value + 1 <= var->max)1830*value = *value + 1;1831}1832break;1833}18341835case sizeof(int32): {1836int32 *value = (int32 *)var->value;18371838if (controller[CONT_ANY].keyLeft.press) {1839if (var->type == VIEWVAR_DISPLAY_BOOL)1840*value ^= 1;1841else if (*value - 1 >= var->min)1842*value = *value - 1;1843}18441845if (controller[CONT_ANY].keyRight.press) {1846if (!var->type)1847*value ^= 1;1848else if (*value + 1 <= var->max)1849*value = *value + 1;1850}1851break;1852}1853}1854}1855else {1856if (confirm) {1857devMenu.state = DevMenu_OptionsMenu;1858devMenu.selection = 4;1859}1860}18611862#if !RETRO_USE_ORIGINAL_CODE1863#if RETRO_REV021864bool32 swap = SKU::userCore->GetConfirmButtonFlip();1865#else1866bool32 swap = SKU::GetConfirmButtonFlip()1867#endif1868if (swap ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {1869devMenu.state = DevMenu_OptionsMenu;1870devMenu.selection = 4;1871}1872#endif1873}1874#endif18751876#if RETRO_USE_MOD_LOADER1877void RSDK::DevMenu_ModsMenu()1878{1879uint32 selectionColors[] = { 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090 };1880selectionColors[devMenu.selection - devMenu.scrollPos] = 0xF0F0F0;18811882int32 dy = currentScreen->center.y;1883DrawRectangle(currentScreen->center.x - 128, dy - 84, 0x100, 0x30, 0x80, 0xFF, INK_NONE, true);18841885dy -= 68;1886DrawDevString("MANAGE MODS", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F0F0);1887DrawRectangle(currentScreen->center.x - 128, dy + 36, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);18881889int32 y = dy + 40;1890for (int32 i = 0; i < 8; ++i) {1891if (devMenu.scrollPos + i < modList.size()) {1892DrawDevString(modList[(devMenu.scrollPos + i)].name.c_str(), currentScreen->center.x - 96, y, ALIGN_LEFT, selectionColors[i]);1893DrawDevString(modList[(devMenu.scrollPos + i)].active ? "Y" : "N", currentScreen->center.x + 96, y, ALIGN_RIGHT, selectionColors[i]);18941895y += 8;1896devMenu.scrollPos = devMenu.scrollPos;1897}1898}18991900#if !RETRO_USE_ORIGINAL_CODE1901DevMenu_HandleTouchControls(CORNERBUTTON_START);1902#endif19031904int32 preselection = devMenu.selection;1905if (controller[CONT_ANY].keyUp.press) {1906if (--devMenu.selection < 0)1907devMenu.selection = (int32)(modList.size() - 1);19081909if (devMenu.selection >= devMenu.scrollPos) {1910if (devMenu.selection > devMenu.scrollPos + 7)1911devMenu.scrollPos = devMenu.selection - 7;1912}1913else {1914devMenu.scrollPos = devMenu.selection;1915}19161917devMenu.timer = 1;1918}1919else if (controller[CONT_ANY].keyUp.down) {1920if (!devMenu.timer && --devMenu.selection < 0)1921devMenu.selection = (int32)(modList.size() - 1);19221923devMenu.timer = (devMenu.timer + 1) & 7;19241925if (devMenu.selection >= devMenu.scrollPos) {1926if (devMenu.selection > devMenu.scrollPos + 7)1927devMenu.scrollPos = devMenu.selection - 7;1928}1929else {1930devMenu.scrollPos = devMenu.selection;1931}1932}19331934if (controller[CONT_ANY].keyDown.press) {1935if (++devMenu.selection >= modList.size())1936devMenu.selection = 0;19371938if (devMenu.selection >= devMenu.scrollPos) {1939if (devMenu.selection > devMenu.scrollPos + 7)1940devMenu.scrollPos = devMenu.selection - 7;1941}1942else {1943devMenu.scrollPos = devMenu.selection;1944}19451946devMenu.timer = 1;1947}1948else if (controller[CONT_ANY].keyDown.down) {1949if (!devMenu.timer && ++devMenu.selection >= modList.size())1950devMenu.selection = 0;19511952devMenu.timer = (devMenu.timer + 1) & 7;19531954if (devMenu.selection >= devMenu.scrollPos) {1955if (devMenu.selection > devMenu.scrollPos + 7)1956devMenu.scrollPos = devMenu.selection - 7;1957}1958else {1959devMenu.scrollPos = devMenu.selection;1960}1961}19621963bool32 confirm = controller[CONT_ANY].keyA.press;1964#if RETRO_REV021965bool32 swap = SKU::userCore->GetConfirmButtonFlip();1966#else1967bool32 swap = SKU::GetConfirmButtonFlip();1968#endif1969if (swap)1970confirm = controller[CONT_ANY].keyB.press;19711972if (controller[CONT_ANY].keyStart.press || confirm || controller[CONT_ANY].keyLeft.press || controller[CONT_ANY].keyRight.press) {1973modList[devMenu.selection].active ^= true;1974devMenu.modsChanged = true;1975}1976else if (controller[CONT_ANY].keyC.down) {1977ModInfo swap = modList[preselection];1978modList[preselection] = modList[devMenu.selection];1979modList[devMenu.selection] = swap;1980devMenu.modsChanged = true;1981}1982else if (swap ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {1983devMenu.state = DevMenu_MainMenu;1984devMenu.scrollPos = 0;1985devMenu.selection = 4;1986#if RETRO_REV0U1987engine.version = 0;1988#endif1989SaveMods();1990if (devMenu.modsChanged) {1991DrawDevString("Reloading mods...", currentScreen->center.x, dy + 12, ALIGN_CENTER, 0xF08080);1992// we do a little hacking1993RenderDevice::CopyFrameBuffer();1994RenderDevice::FlipScreen();1995ApplyModChanges();1996}1997#if RETRO_REV0U1998else {1999engine.version = devMenu.startingVersion;2000}2001#endif20022003if (devMenu.modMenuCalled)2004CloseDevMenu();2005}2006}2007#endif20082009#if RETRO_REV0U && RETRO_USE_MOD_LOADER2010void RSDK::DevMenu_PlayerSelectMenu()2011{2012uint32 selectionColors[] = {20130x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090, 0x808090,2014};2015selectionColors[devMenu.selection - devMenu.scrollPos] = 0xF0F0F0;20162017int32 dy = currentScreen->center.y;2018DrawRectangle(currentScreen->center.x - 128, dy - 84, 0x100, 0x30, 0x80, 0xFF, INK_NONE, true);20192020dy -= 68;2021DrawDevString("SELECT PLAYER", currentScreen->center.x, dy, ALIGN_CENTER, 0xF0F0F0);2022DrawRectangle(currentScreen->center.x - 128, dy + 36, 0x100, 0x48, 0x80, 0xFF, INK_NONE, true);20232024int32 y = dy + 40;2025for (int32 i = 0; i < 8; ++i) {2026if (devMenu.scrollPos + i < modSettings.playerCount) {2027DrawDevString(modSettings.playerNames[devMenu.scrollPos + i], currentScreen->center.x - 64, y, ALIGN_LEFT, selectionColors[i]);2028y += 8;2029}2030}20312032DevMenu_HandleTouchControls(CORNERBUTTON_START);20332034if (controller[CONT_ANY].keyUp.press) {2035if (--devMenu.selection < 0)2036devMenu.selection = modSettings.playerCount - 1;20372038if (devMenu.selection >= devMenu.scrollPos) {2039if (devMenu.selection > devMenu.scrollPos + 7)2040devMenu.scrollPos = devMenu.selection - 7;2041}2042else {2043devMenu.scrollPos = devMenu.selection;2044}20452046devMenu.timer = 1;2047}2048else if (controller[CONT_ANY].keyUp.down) {2049if (!devMenu.timer && --devMenu.selection < 0)2050devMenu.selection = modSettings.playerCount - 1;20512052devMenu.timer = (devMenu.timer + 1) & 7;20532054if (devMenu.selection >= devMenu.scrollPos) {2055if (devMenu.selection > devMenu.scrollPos + 7)2056devMenu.scrollPos = devMenu.selection - 7;2057}2058else {2059devMenu.scrollPos = devMenu.selection;2060}2061}20622063if (controller[CONT_ANY].keyDown.press) {2064if (++devMenu.selection >= modSettings.playerCount)2065devMenu.selection = 0;20662067if (devMenu.selection >= devMenu.scrollPos) {2068if (devMenu.selection > devMenu.scrollPos + 7)2069devMenu.scrollPos = devMenu.selection - 7;2070}2071else {2072devMenu.scrollPos = devMenu.selection;2073}20742075devMenu.timer = 1;2076}2077else if (controller[CONT_ANY].keyDown.down) {2078if (!devMenu.timer && ++devMenu.selection >= modSettings.playerCount)2079devMenu.selection = 0;20802081devMenu.timer = (devMenu.timer + 1) & 7;20822083if (devMenu.selection >= devMenu.scrollPos) {2084if (devMenu.selection > devMenu.scrollPos + 7)2085devMenu.scrollPos = devMenu.selection - 7;2086}2087else {2088devMenu.scrollPos = devMenu.selection;2089}2090}20912092bool32 confirm = controller[CONT_ANY].keyA.press;2093#if RETRO_REV022094bool32 swap = SKU::userCore->GetConfirmButtonFlip();2095#else2096bool32 swap = SKU::GetConfirmButtonFlip();2097#endif2098if (swap)2099confirm = controller[CONT_ANY].keyB.press;21002101if (controller[CONT_ANY].keyStart.press || confirm) {2102devMenu.state = DevMenu_CategorySelectMenu;2103devMenu.playerListPos = devMenu.selection;2104devMenu.selection = 0;2105devMenu.timer = 1;2106}2107else if (swap ? controller[CONT_ANY].keyA.press : controller[CONT_ANY].keyB.press) {2108devMenu.state = DevMenu_MainMenu;2109devMenu.playerListPos = 0;2110devMenu.scrollPos = 0;2111devMenu.selection = 2;2112}2113}2114#endif211521162117