2020-03-17 04:31:30 +00:00
|
|
|
#include <ultra64.h>
|
|
|
|
#include <global.h>
|
2020-03-18 14:27:49 +00:00
|
|
|
#include <z64.h>
|
|
|
|
#include <color.h>
|
|
|
|
#include <regs.h>
|
2020-03-19 22:06:41 +00:00
|
|
|
#include <PR/os_cont.h>
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-03-18 14:27:49 +00:00
|
|
|
#define PAGE_N 16
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
u8 x;
|
|
|
|
u8 y;
|
|
|
|
u8 colorId;
|
|
|
|
char text[0x15];
|
|
|
|
} PrintTextBuffer;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
u16 push;
|
|
|
|
u16 held;
|
|
|
|
} InputCombo;
|
|
|
|
|
2020-03-18 16:31:36 +00:00
|
|
|
GameInfo* gGameInfo;
|
|
|
|
int D_8015FA94; //no known symbols
|
|
|
|
PrintTextBuffer D_8015FA98[0x16];
|
2020-03-18 14:27:49 +00:00
|
|
|
|
2020-03-18 16:31:36 +00:00
|
|
|
s16 D_8011E0B0 = 0; //PrintTextBuffer index
|
|
|
|
Color_RGBA8 printTextColors[] = {
|
|
|
|
{ 0xFF, 0xFF, 0x20, 0xC0 },
|
|
|
|
{ 0xFF, 0x96, 0x80, 0xC0 },
|
|
|
|
{ 0x80, 0x60, 0x00, 0x40 },
|
|
|
|
{ 0xC0, 0x80, 0x10, 0x80 },
|
|
|
|
{ 0xFF, 0xC0, 0x20, 0x80 },
|
|
|
|
{ 0xE6, 0xE6, 0xDC, 0x40 },
|
|
|
|
{ 0x80, 0x96, 0xFF, 0x80 },
|
|
|
|
{ 0x80, 0xFF, 0x20, 0x80 },
|
|
|
|
};
|
|
|
|
|
2020-03-19 22:06:41 +00:00
|
|
|
InputCombo inputCombos[REG_GROUPS] = {
|
|
|
|
{ L_TRIG, U_CBUTTONS },
|
|
|
|
{ L_TRIG, L_CBUTTONS },
|
|
|
|
{ L_TRIG, D_CBUTTONS },
|
|
|
|
{ L_TRIG, A_BUTTON },
|
|
|
|
{ R_TRIG, D_CBUTTONS },
|
|
|
|
{ L_TRIG, R_CBUTTONS },
|
|
|
|
{ L_TRIG, R_TRIG },
|
|
|
|
{ L_TRIG, L_JPAD },
|
|
|
|
{ L_TRIG, R_JPAD },
|
|
|
|
{ L_TRIG, U_JPAD },
|
|
|
|
{ L_TRIG, B_BUTTON },
|
|
|
|
{ L_TRIG, Z_TRIG },
|
|
|
|
{ L_TRIG, D_JPAD },
|
|
|
|
{ R_TRIG, A_BUTTON },
|
|
|
|
{ R_TRIG, B_BUTTON },
|
|
|
|
{ R_TRIG, Z_TRIG },
|
|
|
|
{ R_TRIG, L_TRIG },
|
|
|
|
{ R_TRIG, U_CBUTTONS },
|
|
|
|
{ R_TRIG, R_CBUTTONS },
|
|
|
|
{ R_TRIG, L_JPAD },
|
|
|
|
{ R_TRIG, L_CBUTTONS },
|
|
|
|
{ R_TRIG, START_BUTTON },
|
|
|
|
{ L_TRIG, START_BUTTON },
|
|
|
|
{ R_TRIG, R_JPAD },
|
|
|
|
{ R_TRIG, U_JPAD },
|
|
|
|
{ START_BUTTON, R_TRIG },
|
|
|
|
{ START_BUTTON, A_BUTTON },
|
|
|
|
{ START_BUTTON, B_BUTTON },
|
|
|
|
{ START_BUTTON, R_CBUTTONS },
|
2020-03-18 16:31:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
char regChar[] = " SOPQMYDUIZCNKXcsiWAVHGmnBdkb";
|
2020-03-18 14:27:49 +00:00
|
|
|
|
|
|
|
//initialize GameInfo
|
|
|
|
void func_800636C0()
|
|
|
|
{
|
|
|
|
s32 i;
|
|
|
|
|
2020-03-19 22:06:41 +00:00
|
|
|
gGameInfo = (GameInfo*)SystemArena_MallocDebug(sizeof(GameInfo), "../z_debug.c", 260);
|
|
|
|
gGameInfo->regPage = 0;
|
|
|
|
gGameInfo->regGroup = 0;
|
|
|
|
gGameInfo->regCur = 0;
|
|
|
|
gGameInfo->dpadLast = 0;
|
2020-03-18 14:27:49 +00:00
|
|
|
gGameInfo->repeat = 0;
|
2020-03-19 22:06:41 +00:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gGameInfo->data); i++)
|
2020-03-18 14:27:49 +00:00
|
|
|
{
|
|
|
|
gGameInfo->data[i] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-18 16:31:36 +00:00
|
|
|
//Called when free movement is active.
|
|
|
|
//8011D394 to enable camera debugger
|
2020-03-18 14:27:49 +00:00
|
|
|
void func_8006375C(s32 arg0, s32 arg1, float* d_80855320)
|
2020-03-17 04:31:30 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-03-18 14:27:49 +00:00
|
|
|
#ifdef NON_MATCHING //regalloc
|
|
|
|
//Copy Camera Debugger Text
|
|
|
|
void func_8006376C(u8 x, u8 y, u8 colorId, const char* text)
|
|
|
|
{
|
|
|
|
PrintTextBuffer* buf;
|
2020-03-19 22:06:41 +00:00
|
|
|
char* bufText;
|
2020-03-18 14:27:49 +00:00
|
|
|
s16 i; //v1
|
|
|
|
|
|
|
|
buf = &D_8015FA98[D_8011E0B0];
|
|
|
|
if (D_8011E0B0 < 0x16) {
|
|
|
|
|
|
|
|
buf->x = x;
|
|
|
|
buf->y = y;
|
|
|
|
buf->colorId = colorId;
|
|
|
|
|
|
|
|
i = 0;
|
2020-03-19 22:06:41 +00:00
|
|
|
bufText = buf->text + 1;
|
2020-03-18 14:27:49 +00:00
|
|
|
|
|
|
|
if (*buf->text = *text++) {
|
|
|
|
do if (i++ > 0x14) {
|
|
|
|
break;
|
2020-03-19 22:06:41 +00:00
|
|
|
} while (*bufText++ = *text++);
|
2020-03-18 14:27:49 +00:00
|
|
|
}
|
|
|
|
|
2020-03-19 22:06:41 +00:00
|
|
|
*bufText = '\0';
|
2020-03-18 14:27:49 +00:00
|
|
|
D_8011E0B0++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
2020-03-17 04:31:30 +00:00
|
|
|
#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug/func_8006376C.s")
|
2020-03-18 14:27:49 +00:00
|
|
|
#endif
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-03-18 14:27:49 +00:00
|
|
|
//Draw Text
|
|
|
|
void func_80063828(GfxPrint* gfxPrint)
|
|
|
|
{
|
|
|
|
s32 i;
|
|
|
|
Color_RGBA8* color;
|
|
|
|
PrintTextBuffer* buffer;
|
|
|
|
char* text;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
if (D_8011E0B0 > 0)
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
buffer = &D_8015FA98[i];
|
|
|
|
text = buffer->text;
|
|
|
|
|
2020-03-18 16:31:36 +00:00
|
|
|
color = &printTextColors[buffer->colorId];
|
2020-03-18 14:27:49 +00:00
|
|
|
GfxPrint_SetColor(gfxPrint, color->r, color->g, color->b, color->a);
|
|
|
|
GfxPrint_SetPos(gfxPrint, buffer->x, buffer->y);
|
|
|
|
GfxPrint_Printf(gfxPrint, "%s", text);
|
|
|
|
i += 1;
|
|
|
|
} while (i < D_8011E0B0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Edit REG
|
|
|
|
void func_8006390C(Input* input) {
|
|
|
|
|
|
|
|
s32 dpad;
|
2020-03-19 22:06:41 +00:00
|
|
|
s32 regGroup;
|
2020-03-18 14:27:49 +00:00
|
|
|
s32 increment;
|
|
|
|
InputCombo* input_combo;
|
|
|
|
s32 i;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-03-19 22:06:41 +00:00
|
|
|
regGroup = (gGameInfo->regGroup * (REG_PER_GROUP / PAGE_N) + gGameInfo->regPage) * PAGE_N - PAGE_N;
|
2020-03-18 14:27:49 +00:00
|
|
|
dpad = input->raw.pad & 0xF00;
|
2020-03-19 22:06:41 +00:00
|
|
|
if (!~(input->raw.pad | ~L_TRIG) ||
|
|
|
|
!~(input->raw.pad | ~R_TRIG) ||
|
|
|
|
!~(input->raw.pad | ~START_BUTTON)) {
|
2020-03-18 16:31:36 +00:00
|
|
|
input_combo = inputCombos;
|
2020-03-19 22:06:41 +00:00
|
|
|
for (i = 0; i < REG_GROUPS; i++)
|
2020-03-18 14:27:49 +00:00
|
|
|
{
|
|
|
|
if (~(~input_combo->push | input->raw.pad) ||
|
|
|
|
~(~input_combo->held | input->padPressed)) {
|
|
|
|
input_combo++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-03-19 22:06:41 +00:00
|
|
|
if (i < REG_GROUPS) {
|
|
|
|
if (i == gGameInfo->regGroup) {
|
|
|
|
gGameInfo->regPage = (gGameInfo->regPage + 1) % 7;
|
2020-03-18 14:27:49 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-03-19 22:06:41 +00:00
|
|
|
gGameInfo->regGroup = i;
|
|
|
|
gGameInfo->regPage = 0;
|
2020-03-18 14:27:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2020-03-19 22:06:41 +00:00
|
|
|
switch (gGameInfo->regPage - 1)
|
2020-03-18 14:27:49 +00:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
case 2:
|
|
|
|
case 3:
|
|
|
|
case 4:
|
|
|
|
case 5:
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-03-19 22:06:41 +00:00
|
|
|
if (dpad == gGameInfo->dpadLast) {
|
2020-03-18 14:27:49 +00:00
|
|
|
gGameInfo->repeat--;
|
|
|
|
if (gGameInfo->repeat < 0) {
|
|
|
|
gGameInfo->repeat = 1;
|
|
|
|
}
|
|
|
|
else {
|
2020-03-19 22:06:41 +00:00
|
|
|
dpad ^= gGameInfo->dpadLast;
|
2020-03-18 14:27:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
gGameInfo->repeat = 0x10;
|
2020-03-19 22:06:41 +00:00
|
|
|
gGameInfo->dpadLast = dpad;
|
2020-03-18 14:27:49 +00:00
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-03-18 14:27:49 +00:00
|
|
|
increment =
|
2020-03-19 22:06:41 +00:00
|
|
|
(dpad & R_JPAD) ? (
|
|
|
|
!~(input->raw.pad | ~(A_BUTTON | B_BUTTON)) ? 1000 :
|
|
|
|
!~(input->raw.pad | ~A_BUTTON) ? 100 :
|
|
|
|
!~(input->raw.pad | ~B_BUTTON) ? 10 : 1) :
|
|
|
|
(dpad & L_JPAD) ? (
|
|
|
|
!~(input->raw.pad | ~(A_BUTTON | B_BUTTON)) ? -1000 :
|
|
|
|
!~(input->raw.pad | ~A_BUTTON) ? -100 :
|
|
|
|
!~(input->raw.pad | ~B_BUTTON) ? -10 : -1) :
|
2020-03-18 14:27:49 +00:00
|
|
|
0;
|
|
|
|
|
2020-03-19 22:06:41 +00:00
|
|
|
gGameInfo->data[gGameInfo->regCur + regGroup] += increment;
|
|
|
|
if (dpad & U_JPAD) {
|
|
|
|
gGameInfo->regCur--;
|
|
|
|
if (gGameInfo->regCur < 0) {
|
|
|
|
gGameInfo->regCur = PAGE_N - 1;
|
2020-03-18 14:27:49 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-19 22:06:41 +00:00
|
|
|
else if (dpad & D_JPAD) {
|
|
|
|
gGameInfo->regCur++;
|
|
|
|
if (gGameInfo->regCur >= PAGE_N) {
|
|
|
|
gGameInfo->regCur = 0;
|
2020-03-18 14:27:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (iREG(0)) {
|
|
|
|
iREG(0) = 0;
|
|
|
|
func_800AA000(0, iREG(1), iREG(2), iREG(3));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Draw Memory Viewer
|
|
|
|
void func_80063C04(GfxPrint* gfxPrint)
|
|
|
|
{
|
|
|
|
s32 i;
|
|
|
|
s32 page;
|
2020-03-19 22:06:41 +00:00
|
|
|
s32 regGroup;
|
2020-03-18 14:27:49 +00:00
|
|
|
s32 test; //removing affects stack
|
2020-03-19 22:06:41 +00:00
|
|
|
char name[3];
|
2020-03-18 14:27:49 +00:00
|
|
|
|
2020-03-19 22:06:41 +00:00
|
|
|
page = (gGameInfo->regPage * PAGE_N) - PAGE_N;
|
|
|
|
regGroup = (gGameInfo->regGroup * (REG_PER_GROUP / PAGE_N) + gGameInfo->regPage) * PAGE_N - PAGE_N;
|
2020-03-18 14:27:49 +00:00
|
|
|
|
|
|
|
//set up register name string
|
2020-03-19 22:06:41 +00:00
|
|
|
name[0] = 'R';
|
|
|
|
name[1] = regChar[gGameInfo->regGroup]; //r_group type char
|
|
|
|
name[2] = '\0';
|
2020-03-18 14:27:49 +00:00
|
|
|
GfxPrint_SetColor(gfxPrint, 0, 0x80, 0x80, 0x80);
|
|
|
|
|
|
|
|
for (i = 0; i != PAGE_N; i++)
|
|
|
|
{
|
2020-03-19 22:06:41 +00:00
|
|
|
if (i == gGameInfo->regCur)
|
2020-03-18 14:27:49 +00:00
|
|
|
{
|
|
|
|
GfxPrint_SetColor(gfxPrint, 0, 0xff, 0xff, 0xff);
|
|
|
|
}
|
|
|
|
GfxPrint_SetPos(gfxPrint, 3, i + 5);
|
2020-03-19 22:06:41 +00:00
|
|
|
GfxPrint_Printf(gfxPrint, "%s%02d%6d", &name, page + i, gGameInfo->data[i + regGroup]);
|
|
|
|
if (i == gGameInfo->regCur)
|
2020-03-18 14:27:49 +00:00
|
|
|
{
|
|
|
|
GfxPrint_SetColor(gfxPrint, 0, 0x80, 0x80, 0x80);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_80063D7C(GraphicsContext* gfxCtx) {
|
|
|
|
Gfx* sp7C;
|
|
|
|
Gfx* sp78;
|
2020-03-19 22:06:41 +00:00
|
|
|
Gfx* tempRet;
|
2020-03-18 14:27:49 +00:00
|
|
|
void* unk2[6];
|
|
|
|
GfxPrint gfxPrint;
|
|
|
|
void* unk[2];
|
2020-03-19 22:06:41 +00:00
|
|
|
Gfx* dlFrame[4]; //stores state of GfxCtx next ptrs
|
2020-03-18 14:27:49 +00:00
|
|
|
|
2020-03-19 22:06:41 +00:00
|
|
|
func_800C6AC4(&dlFrame, gfxCtx, "../z_debug.c", 628);
|
2020-03-18 14:27:49 +00:00
|
|
|
GfxPrint_Ctor(&gfxPrint);
|
|
|
|
sp78 = gfxCtx->polyOpa.p;
|
2020-03-19 22:06:41 +00:00
|
|
|
tempRet = func_800C6C20(gfxCtx->polyOpa.p);
|
|
|
|
gSPDisplayList(gfxCtx->overlay.p++, tempRet);
|
|
|
|
GfxPrint_Open(&gfxPrint, tempRet);
|
2020-03-18 14:27:49 +00:00
|
|
|
|
|
|
|
if ((OREG(0) == 1) || (OREG(0) == 8)) {
|
|
|
|
func_80063828(&gfxPrint);
|
|
|
|
}
|
|
|
|
|
2020-03-19 22:06:41 +00:00
|
|
|
if (gGameInfo->regPage != 0) {
|
2020-03-18 14:27:49 +00:00
|
|
|
func_80063C04(&gfxPrint);
|
|
|
|
}
|
|
|
|
|
|
|
|
D_8011E0B0 = 0;
|
|
|
|
sp7C = GfxPrint_Close(&gfxPrint);
|
|
|
|
gSPEndDisplayList(sp7C++);
|
|
|
|
func_800C6C28(sp78, sp7C);
|
|
|
|
gfxCtx->polyOpa.p = sp7C;
|
|
|
|
if (0);
|
2020-03-19 22:06:41 +00:00
|
|
|
func_800C6B54(&dlFrame, gfxCtx, "../z_debug.c", 664);
|
2020-03-18 14:27:49 +00:00
|
|
|
GfxPrint_Dtor(&gfxPrint);
|
|
|
|
}
|