-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Niko
committed
Feb 17, 2025
1 parent
2e88730
commit 06ba88f
Showing
8 changed files
with
695 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
#include "DebugStructs.h" | ||
|
||
void DebugMenu_LoadGame_GivenLevelId(struct GameTracker* gGT, int levelID) | ||
{ | ||
gGT->levelID = levelID; | ||
DECOMP_MainRaceTrack_RequestLoad(gGT->levelID); | ||
} | ||
|
||
void DebugMenu_LoadGame_GivenIndexE3(struct GameTracker* gGT, int index) | ||
{ | ||
/* | ||
Row 1: 1P Dingo Canyon, P1 Crash | ||
Row 2: 1P Crash Cove, P1 Coco | ||
Row 3: 1P Blizzard Bluff, P1 Tiny | ||
Row 4: 1P Tiger Temple, P1 Polar | ||
Row 5: 1P Papu Pyramid, P1 Cortex | ||
Row 6: 2P Papu Pyramid, drivers are Crash, Cortex, Tiny, Coco, NGin, Dingo (standard 2 players 4 AIs) | ||
Row 7: 4P Tiger Temple, Crash Cortex Tiny Coco | ||
Row 8: 4P Blizzard Bluff, Crash Cortex Tiny Coco | ||
*/ | ||
|
||
DECOMP_MainRaceTrack_RequestLoad(gGT->levelID); | ||
} | ||
|
||
// Set by menu | ||
static int debugPlayerIndex = 0; | ||
|
||
void DebugMenu_LoadGame_GivenCharacterId(struct GameTracker* gGT, int charID) | ||
{ | ||
data.characterIDs[debugPlayerIndex] = charID; | ||
DECOMP_MainRaceTrack_RequestLoad(gGT->levelID); | ||
} | ||
|
||
void DebugMenu_LoadGame_GivenNumPlyr(struct GameTracker* gGT, int numPlyr) | ||
{ | ||
gGT->numPlyrNextGame = numPlyr; | ||
DECOMP_MainRaceTrack_RequestLoad(gGT->levelID); | ||
} | ||
|
||
void DebugMenu_SetLapCount(struct GameTracker* gGT, int numLaps) | ||
{ | ||
gGT->numLaps = numLaps; | ||
} | ||
|
||
#if 0 | ||
static int debugModeArr[6] = | ||
{ | ||
ADVENTURE_MODE, | ||
ADVENTURE_MODE | ADVENTURE_ARENA, | ||
TIME_TRIAL, | ||
BATTLE_MODE, | ||
ARCADE_MODE, | ||
0x0, // VS mode | ||
}; | ||
|
||
void DebugMenu_SetGameMode(struct GameTracker* gGT, int index) | ||
{ | ||
int removeBits = ~( | ||
ADVENTURE_MODE | | ||
ADVENTURE_ARENA | | ||
TIME_TRIAL | | ||
BATTLE_MODE | | ||
ARCADE_MODE | ||
); | ||
|
||
gGT->gameMode1 &= removeBits; | ||
gGT->gameMode1 |= debugModeArr[index]; | ||
}; | ||
#endif | ||
|
||
struct DebugRow rowsDbgBattle[] = | ||
{ | ||
{3, 0x12, sdata_static.s_battle1, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0x13, sdata_static.s_battle2, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0x14, sdata_static.s_battle3, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0x15, sdata_static.s_battle4, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0x16, sdata_static.s_battle5, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0x17, sdata_static.s_battle6, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0x18, sdata_static.s_battle7, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0x10, sdata_static.s_secret1, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0x11, sdata_static.s_secret2, DebugMenu_LoadGame_GivenLevelId }, | ||
{0} | ||
}; | ||
|
||
struct DebugMenu menuDbgBattle = | ||
{ | ||
.parentMenu = 0, | ||
.rowArr = rowsDbgBattle, | ||
}; | ||
|
||
struct DebugRow rowsDbgLevels[] = | ||
{ | ||
{1, 0x0, "BATTLE...", &menuDbgBattle }, | ||
{3, 0x0, sdata_static.s_proto8, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0x1, sdata_static.s_proto9, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0x2, sdata_static.s_desert2, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0x3, sdata_static.s_island1, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0x4, sdata_static.s_temple1, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0x5, sdata_static.s_temple2, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0x6, sdata_static.s_tube1, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0x7, sdata_static.s_blimp1, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0x8, sdata_static.s_sewer1, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0x9, sdata_static.s_cave1, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0xA, sdata_static.s_castle1, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0xB, sdata_static.s_labs1, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0xC, sdata_static.s_ice1, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0xD, sdata_static.s_space, DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0xE, "asphalt1", DebugMenu_LoadGame_GivenLevelId }, | ||
{3, 0xF, "asphalt2", DebugMenu_LoadGame_GivenLevelId }, | ||
{0} | ||
}; | ||
|
||
struct DebugMenu menuDbgLevels = | ||
{ | ||
.parentMenu = 0, | ||
.rowArr = rowsDbgLevels, | ||
}; | ||
|
||
struct DebugRow rowsDbgMain[] = | ||
{ | ||
{ 1, 0x0, "LEVEL...", &menuDbgLevels }, | ||
|
||
// TODO: Change back to 1 | ||
{ 3, 0x0, "PLAYERS...", 0 }, // TODO: Submenu | ||
{0} | ||
}; | ||
|
||
struct DebugMenu menuDbgMain = | ||
{ | ||
.parentMenu = 0, | ||
.rowArr = rowsDbgMain, | ||
}; | ||
|
||
void DebugMenu_InitMenuPositionSize( | ||
struct DebugMenu* dm, | ||
int charSizeX, int charSizeY, | ||
int posX, int posY) | ||
{ | ||
int len = 0; | ||
int rowCount = 0; | ||
struct DebugRow* dr; | ||
|
||
dm->posX = posX; | ||
dm->posY = posY; | ||
|
||
dr = dm->rowArr; | ||
while(dr->actionFlag != 0) | ||
{ | ||
int rowLen = strlen(dr->rowText); | ||
|
||
if (len < (rowLen+1)) | ||
len = rowLen+1; | ||
|
||
dr++; | ||
rowCount++; | ||
} | ||
|
||
dm->sizeX = (charSizeX * len) + 6; | ||
dm->sizeY = (charSizeY * rowCount) + 6; | ||
|
||
dr = dm->rowArr; | ||
while(dr->actionFlag != 0) | ||
{ | ||
if(dr->actionFlag == 1) | ||
{ | ||
DebugMenu_InitMenuPositionSize( | ||
dr->subMenu, | ||
charSizeX, charSizeY, | ||
dm->posX + dm->sizeX + 10, | ||
posY); | ||
} | ||
|
||
dr++; | ||
} | ||
} | ||
|
||
void DebugMenu_Init() | ||
{ | ||
DebugMenu_InitMenuPositionSize( | ||
&menuDbgMain,8,8,0x14,0x41); | ||
} | ||
|
||
void DebugMenu_DrawIfOpen() | ||
{ | ||
struct GameTracker* gGT = sdata->gGT; | ||
|
||
int buttonTap = sdata->gGamepads->gamepad[0].buttonsTapped; | ||
|
||
if ((buttonTap & BTN_SELECT) != 0) | ||
gGT->gameMode1 ^= DEBUG_MENU; | ||
|
||
if ((gGT->gameMode1 & DEBUG_MENU) == 0) | ||
return; | ||
|
||
void DebugMenu_Draw(struct DebugMenu* dm); | ||
DebugMenu_Draw(&menuDbgMain); | ||
} | ||
|
||
// June 1999 | ||
// 800828F0 - Battle submenu | ||
// 80082b10 - Levels submenu | ||
// 80082d24 - Character submenu (reload level) | ||
// 80082f38 - Character submenu (mid-race swap?) | ||
// 8008314c - Players submenu (1/2/3/4/ResetPositions/StartRace) | ||
// 80083360 - Ghost submenu | ||
// 80083570 - Various Options (save, laps, game modes) | ||
// 80083788 - Levels/Players Menu | ||
|
||
// E3 demos were stripped |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
#ifndef DEBUGSTRUCTS | ||
#define DEBUGSTRUCTS | ||
|
||
struct ProfilerSection | ||
{ | ||
// 0x0 | ||
char* name; | ||
|
||
// 0x4 | ||
char a; | ||
char r; | ||
char g; | ||
char b; | ||
|
||
#if 0 | ||
// 0x8 | ||
int unk8; | ||
#endif | ||
|
||
// 0xC | ||
int timeStart; | ||
|
||
// 0x10 | ||
int timeEnd; | ||
|
||
// 0x14 | ||
// 1 - DrawV | ||
// 2 - DrawD | ||
// 4 - DrawT | ||
int flagsVDT; | ||
|
||
// 0x18 | ||
// VSyncCallback | ||
int posV; | ||
|
||
// 0x1c | ||
// DrawSyncCallback | ||
int posD; | ||
|
||
#if 0 | ||
// 0x20 | ||
// Unused | ||
int posT; | ||
#endif | ||
|
||
// size = 0x20 | ||
}; | ||
|
||
struct DebugRow; | ||
|
||
struct DebugMenu | ||
{ | ||
// initialized at runtime | ||
struct DebugMenu* parentMenu; | ||
|
||
// set by compiler | ||
struct DebugRow* rowArr; | ||
|
||
// initialized at runtime | ||
struct DebugMenu* childMenu; | ||
|
||
// This is actually RECT, | ||
// x,y,w,h | ||
|
||
// 0xC | ||
short posX; | ||
short posY; | ||
|
||
// 0x10 | ||
short sizeX; | ||
short sizeY; | ||
|
||
// RowArray[0] | ||
}; | ||
|
||
struct DebugRow | ||
{ | ||
// & 0 -> null terminator | ||
// & 1 -> leads to submenu | ||
// & 3 -> run function | ||
int actionFlag; | ||
|
||
// levelID, characterID, etc | ||
int actionParam; | ||
|
||
char* rowText; | ||
|
||
union | ||
{ | ||
// & 1 | ||
struct DebugMenu* subMenu; | ||
|
||
// & 3 | ||
int funcPtr; | ||
}; | ||
}; | ||
|
||
#endif |
Oops, something went wrong.