mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-25 09:45:02 +00:00
Document HREG debugging system (#1351)
* progress * progress * change * named most * name prerender things * fix and format * play prefix * address most comments (still a few more things to do) * fix error * reword input test comments * some more * rework env draw flags * add hilite * merge and format * init to proper values * rename env draw flag names * 7 to 6 * more small changes
This commit is contained in:
parent
274743738b
commit
eb0a82c513
12 changed files with 370 additions and 188 deletions
146
include/regs.h
146
include/regs.h
|
@ -199,4 +199,150 @@
|
|||
#define R_EN_GOROIWA_SPEED mREG(12)
|
||||
#define R_NAVI_MSG_REGION_ALPHA nREG(87)
|
||||
|
||||
|
||||
#define R_HREG_MODE HREG(80) // see `HRegMode` for mode options
|
||||
|
||||
typedef enum {
|
||||
/* 6 */ HREG_MODE_PRINT_HILITE_INFO = 6, // print hilite information
|
||||
/* 7 */ HREG_MODE_UCODE_DISAS, // various controls for the ucode disas system
|
||||
/* 8 */ HREG_MODE_PRINT_MEMORY, // print memory at a specified address
|
||||
/* 9 */ HREG_MODE_UNUSED_9,
|
||||
/* 10 */ HREG_MODE_PLAY, // various debug controls for the Play state
|
||||
/* 11 */ HREG_MODE_PERSPECTIVE, // set various properties of the view perspective
|
||||
/* 12 */ HREG_MODE_INPUT_TEST, // displays inputs from the specified controller
|
||||
/* 13 */ HREG_MODE_SCHED, // toggle various vi special features
|
||||
/* 14 */ HREG_MODE_UNUSED_14,
|
||||
/* 15 */ HREG_MODE_PRERENDER,
|
||||
/* 16 */ HREG_MODE_SETUP_FRAME, // set the base screen color (and by extension, shrink window color too)
|
||||
/* 17 */ HREG_MODE_SCENE_CONFIG, // toggle drawing the scene config
|
||||
/* 18 */ HREG_MODE_PRINT_OBJECT_TABLE,
|
||||
/* 19 */ HREG_MODE_LETTERBOX, // toggle logging and view values for the letterbox system
|
||||
/* 20 */ HREG_MODE_HEAP_FREE_BLOCK_TEST, // enable or disable heap free block test
|
||||
/* 21 */ HREG_MODE_VI
|
||||
} HRegMode;
|
||||
|
||||
// HREG_MODE_PRINT_HILITE_INFO
|
||||
// This mode has no controls with other regs. Simply set HREG mode to `HREG_MODE_PRINT_HILITE_INFO`
|
||||
// to print out the eye, object, and light direction vectors for hilite on every frame.
|
||||
|
||||
// HREG_MODE_UCODE_DISAS
|
||||
#define R_UCODE_DISAS_TOGGLE HREG(81) // < 0 enables and prints some hardware reg info for 1 frame, > 0 enables constant disas
|
||||
#define R_UCODE_DISAS_LOG_MODE HREG(82) // 1 and 2 print counts, 3 enables fault client, 4 disables open/close disps
|
||||
#define R_UCODE_DISAS_LOG_LEVEL HREG(83) // enables various logging within the dissasembler itself
|
||||
#define R_UCODE_DISAS_TOTAL_COUNT HREG(84) // read-only
|
||||
#define R_UCODE_DISAS_VTX_COUNT HREG(85) // read-only
|
||||
#define R_UCODE_DISAS_SPVTX_COUNT HREG(86) // read-only
|
||||
#define R_UCODE_DISAS_TRI1_COUNT HREG(87) // read-only
|
||||
#define R_UCODE_DISAS_TRI2_COUNT HREG(88) // read-only
|
||||
#define R_UCODE_DISAS_QUAD_COUNT HREG(89) // read-only
|
||||
#define R_UCODE_DISAS_LINE_COUNT HREG(90) // read-only
|
||||
#define R_UCODE_DISAS_SYNC_ERROR_COUNT HREG(91) // read-only
|
||||
#define R_UCODE_DISAS_LOAD_COUNT HREG(92) // read-only
|
||||
#define R_UCODE_DISAS_DL_COUNT HREG(93) // read-only
|
||||
|
||||
// HREG_MODE_PRINT_MEMORY
|
||||
#define R_PRINT_MEMORY_INIT HREG(94) // set to `HREG_MODE_PRINT_MEMORY` when init is complete
|
||||
#define R_PRINT_MEMORY_TRIGGER HREG(81) // set to a negative number to print memory
|
||||
#define R_PRINT_MEMORY_ADDR HREG(82) // middle 16 bits of the address to print from (80XXXX00)
|
||||
#define R_PRINT_MEMORY_SIZE HREG(83) // value * 0x10 = length of the log
|
||||
|
||||
// HREG_MODE_PLAY
|
||||
#define R_PLAY_INIT HREG(94) // set to `HREG_MODE_PLAY` when init is complete
|
||||
#define R_PLAY_RUN_UPDATE HREG(81)
|
||||
#define R_PLAY_RUN_DRAW HREG(82)
|
||||
#define R_PLAY_DRAW_SKYBOX HREG(83)
|
||||
#define R_PLAY_DRAW_ROOM_FLAGS HREG(84) // also enables drawing the scene config and room bg cover
|
||||
#define R_PLAY_DRAW_ACTORS HREG(85)
|
||||
#define R_PLAY_DRAW_LENS_FLARES HREG(86)
|
||||
#define R_PLAY_DRAW_SCREEN_FILLS HREG(87)
|
||||
#define R_PLAY_DRAW_SANDSTORM HREG(88)
|
||||
#define R_PLAY_DRAW_OVERLAY_ELEMENTS HREG(89)
|
||||
#define R_PLAY_DRAW_ENV_FLAGS HREG(90) // see flags below
|
||||
#define R_PLAY_DRAW_COVER_ELEMENTS HREG(92) // draw transition instance and vismono
|
||||
#define R_PLAY_DRAW_DEBUG_OBJECTS HREG(93)
|
||||
|
||||
#define PLAY_ENV_DRAW_SKYBOX_FILTERS (1 << 0)
|
||||
#define PLAY_ENV_DRAW_SUN_AND_MOON (1 << 1)
|
||||
#define PLAY_ENV_DRAW_LIGHTNING (1 << 2)
|
||||
#define PLAY_ENV_DRAW_LIGHTS (1 << 3)
|
||||
|
||||
#define R_PLAY_ENABLE_UCODE_DISAS HREG(93) // set to 2 to switch to ucode disas mode and trigger it
|
||||
#define R_PLAY_UCODE_DISAS_LOG_LEVEL HREG(92) // log level to use when switching to ucode disas
|
||||
|
||||
// HREG_MODE_PERSPECTIVE
|
||||
#define R_PERSPECTIVE_INIT HREG(94) // set to `HREG_MODE_PERSPECTIVE` when init is complete
|
||||
#define R_PERSPECTIVE_FOVY HREG(83) // value to use for `fovy`
|
||||
#define R_PERSPECTIVE_ASPECT HREG(84) // value to use for `aspect`, divided by 10000
|
||||
#define R_PERSPECTIVE_NEAR HREG(85) // value to use for `near`
|
||||
#define R_PERSPECTIVE_FAR HREG(86) // value to use for `far`
|
||||
#define R_PERSPECTIVE_SCALE HREG(87) // value to use for `scale`, divided by 100
|
||||
|
||||
// HREG_MODE_INPUT_TEST
|
||||
#define R_INPUT_TEST_CONTROLLER_PORT HREG(81) // controller to copy values from
|
||||
#define R_INPUT_TEST_COMPARE_VALUE HREG(82) // input value compared against for various tests
|
||||
#define R_INPUT_TEST_BUTTON_CUR HREG(83) // buttons held on the test controller
|
||||
#define R_INPUT_TEST_BUTTON_PRESS HREG(84) // buttons pressed on the test controller
|
||||
#define R_INPUT_TEST_REL_STICK_X HREG(85) // current stick value on the x axis (ignoring the deadzone)
|
||||
#define R_INPUT_TEST_REL_STICK_Y HREG(86) // current stick value on the y axis (ignoring the deadzone)
|
||||
#define R_INPUT_TEST_REL_STICK_X_2 HREG(87) // same as R_INPUT_TEST_REL_STICK_X
|
||||
#define R_INPUT_TEST_REL_STICK_Y_2 HREG(88) // same as R_INPUT_TEST_REL_STICK_Y
|
||||
#define R_INPUT_TEST_CUR_STICK_X HREG(89) // current stick value on the x axis
|
||||
#define R_INPUT_TEST_CUR_STICK_Y HREG(90) // current stick value on the y axis
|
||||
#define R_INPUT_TEST_COMPARE_BUTTON_CUR HREG(93) // set to 1 if cur.button exactly matches R_INPUT_TEST_COMPARE_VALUE
|
||||
#define R_INPUT_TEST_COMPARE_COMBO_CUR HREG(94) // set to 1 if cur.button contains R_INPUT_TEST_COMPARE_VALUE
|
||||
#define R_INPUT_TEST_COMPARE_COMBO_PRESS HREG(95) // set to 1 if press.button contains R_INPUT_TEST_COMPARE_VALUE
|
||||
|
||||
// HREG_MODE_SCHED
|
||||
#define R_SCHED_INIT HREG(95) // set to `HREG_MODE_SCHED` when init is complete
|
||||
#define R_SCHED_TOGGLE_SPECIAL_FEATURES HREG(81) // set to 2 to allow special features to be applied
|
||||
#define R_SCHED_GAMMA_ON HREG(82) // set OS_VI_GAMMA_ON
|
||||
#define R_SCHED_DITHER_FILTER_ON HREG(83) // set OS_VI_DITHER_FILTER_ON
|
||||
#define R_SCHED_GAMMA_DITHER_ON HREG(84) // set OS_VI_GAMMA_DITHER_ON
|
||||
#define R_SCHED_DIVOT_ON HREG(85) // set OS_VI_DIVOT_ON
|
||||
|
||||
// HREG_MODE_PRERENDER
|
||||
#define R_PRERENDER_DIVOT_CONTROL HREG(81)
|
||||
|
||||
#define PRERENDER_DIVOT_ALTERNATE_COLOR 1
|
||||
#define PRERENDER_DIVOT_PRINT_COLOR 3
|
||||
#define PRERENDER_DIVOT_PARTIAL_CVG_RED 5
|
||||
|
||||
// HREG_MODE_SETUP_FRAME
|
||||
#define R_SETUP_FRAME_INIT HREG(95) // set to `HREG_MODE_SETUP_FRAME` when init is complete
|
||||
#define R_SETUP_FRAME_GET HREG(81) // get the current values and store them in appropriate regs
|
||||
#define R_SETUP_FRAME_SET HREG(82) // use the value from regs as the current value
|
||||
#define R_SETUP_FRAME_LETTERBOX_SIZE HREG(83)
|
||||
#define R_SETUP_FRAME_BASE_COLOR_R HREG(84)
|
||||
#define R_SETUP_FRAME_BASE_COLOR_G HREG(85)
|
||||
#define R_SETUP_FRAME_BASE_COLOR_B HREG(86)
|
||||
|
||||
#define SETUP_FRAME_LETTERBOX_SIZE_FLAG (1 << 0) // used with R_SETUP_FRAME_GET and R_SETUP_FRAME_SET
|
||||
#define SETUP_FRAME_BASE_COLOR_FLAG (1 << 1) // used with R_SETUP_FRAME_GET and R_SETUP_FRAME_SET
|
||||
|
||||
// HREG_MODE_SCENE_CONFIG
|
||||
#define R_SCENE_CONFIG_INIT HREG(95) // set to `HREG_MODE_SCENE_CONFIG` when init is complete
|
||||
#define R_SCENE_CONFIG_DRAW_DEFAULT_DLIST HREG(81) // set to 1 to draw the default display list
|
||||
#define R_SCENE_CONFIG_DRAW_SCENE_CONFIG HREG(82) // set to 1 to draw the scene config
|
||||
|
||||
// HREG_MODE_PRINT_OBJECT_TABLE
|
||||
#define R_PRINT_OBJECT_TABLE_TRIGGER HREG(81) // set to a negative number to print out the whole object table
|
||||
|
||||
// HREG_MODE_LETTERBOX
|
||||
#define R_LETTERBOX_INIT HREG(94) // set to `HREG_MODE_LETTERBOX` when init is complete
|
||||
#define R_LETTERBOX_ENABLE_LOGS HREG(81) // set to 1 to enable logging
|
||||
#define R_LETTERBOX_STATE HREG(83) // read-only
|
||||
#define R_LETTERBOX_SIZE HREG(84) // read-only
|
||||
#define R_LETTERBOX_TARGET_SIZE HREG(85) // read-only
|
||||
#define R_LETTERBOX_STEP HREG(86) // read-only
|
||||
|
||||
// HREG_MODE_HEAP_FREE_BLOCK_TEST
|
||||
#define R_HEAP_FREE_BLOCK_TEST_TOGGLE HREG(82) // 0 = disabled, 1 = enabled
|
||||
|
||||
// HREG_MODE_VI
|
||||
#define R_VI_INIT HREG(95) // set to `HREG_MODE_VI` when init is complete
|
||||
#define R_VI_NEXT_Y_SCALE_MODE HREG(81) // set to 0 to scale yScale with additional scan lines, else use 1.0
|
||||
#define R_VI_NEXT_ADDI_SCAN_LINES HREG(82)
|
||||
#define R_VI_CUR_ADDI_SCAN_LINES HREG(83)
|
||||
#define R_VI_CUR_Y_SCALE_MODE HREG(84)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -720,10 +720,11 @@ void PreRender_DivotFilter(PreRender* this) {
|
|||
}
|
||||
|
||||
// This condition is checked before entering this function, it will always pass if it runs.
|
||||
if ((HREG(80) == 15 ? HREG(81) : 0) != 0) {
|
||||
if ((HREG(80) == 15 ? HREG(81) : 0) != 0) {}
|
||||
if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) != 0) {
|
||||
if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) != 0) {}
|
||||
|
||||
if ((HREG(80) == 15 ? HREG(81) : 0) == 5) {
|
||||
if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) ==
|
||||
PRERENDER_DIVOT_PARTIAL_CVG_RED) {
|
||||
// Fill the pixel with full red, likely for debugging
|
||||
pxR = 31;
|
||||
pxG = 0;
|
||||
|
@ -734,7 +735,8 @@ void PreRender_DivotFilter(PreRender* this) {
|
|||
u8* windowG = &buffG[x - 1];
|
||||
u8* windowB = &buffB[x - 1];
|
||||
|
||||
if ((HREG(80) == 15 ? HREG(81) : 0) == 3) {
|
||||
if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) ==
|
||||
PRERENDER_DIVOT_PRINT_COLOR) {
|
||||
osSyncPrintf("red=%3d %3d %3d %3d grn=%3d %3d %3d %3d blu=%3d %3d %3d %3d \n", windowR[0],
|
||||
windowR[1], windowR[2], MEDIAN3(windowR[0], windowR[1], windowR[2]), windowG[0],
|
||||
windowG[1], windowG[2], MEDIAN3(windowG[0], windowG[1], windowG[2]), windowB[0],
|
||||
|
@ -744,7 +746,8 @@ void PreRender_DivotFilter(PreRender* this) {
|
|||
// Sample the median value from the 3 pixel wide window
|
||||
|
||||
// (Both blocks contain the same code)
|
||||
if ((HREG(80) == 15 ? HREG(81) : 0) == 1) {
|
||||
if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) ==
|
||||
PRERENDER_DIVOT_ALTERNATE_COLOR) {
|
||||
pxR = MEDIAN3(windowR[0], windowR[1], windowR[2]);
|
||||
pxG = MEDIAN3(windowG[0], windowG[1], windowG[2]);
|
||||
pxB = MEDIAN3(windowB[0], windowB[1], windowB[2]);
|
||||
|
@ -754,6 +757,7 @@ void PreRender_DivotFilter(PreRender* this) {
|
|||
pxB = MEDIAN3(windowB[0], windowB[1], windowB[2]);
|
||||
}
|
||||
}
|
||||
|
||||
pxOut.r = pxR;
|
||||
pxOut.g = pxG;
|
||||
pxOut.b = pxB;
|
||||
|
@ -787,7 +791,7 @@ void PreRender_ApplyFilters(PreRender* this) {
|
|||
}
|
||||
}
|
||||
|
||||
if ((HREG(80) == 15 ? HREG(81) : 0) != 0) {
|
||||
if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) != 0) {
|
||||
// Apply divot filter
|
||||
PreRender_DivotFilter(this);
|
||||
}
|
||||
|
|
100
src/code/game.c
100
src/code/game.c
|
@ -61,26 +61,28 @@ void GameState_SetFBFilter(Gfx** gfx) {
|
|||
void func_800C4344(GameState* gameState) {
|
||||
Input* selectedInput;
|
||||
s32 hexDumpSize;
|
||||
u16 hReg82;
|
||||
u16 inputCompareValue;
|
||||
|
||||
if (HREG(80) == 0x14) {
|
||||
__osMalloc_FreeBlockTest_Enable = HREG(82);
|
||||
if (R_HREG_MODE == HREG_MODE_HEAP_FREE_BLOCK_TEST) {
|
||||
__osMalloc_FreeBlockTest_Enable = R_HEAP_FREE_BLOCK_TEST_TOGGLE;
|
||||
}
|
||||
|
||||
if (HREG(80) == 0xC) {
|
||||
selectedInput = &gameState->input[(u32)HREG(81) < 4U ? HREG(81) : 0];
|
||||
hReg82 = HREG(82);
|
||||
HREG(83) = selectedInput->cur.button;
|
||||
HREG(84) = selectedInput->press.button;
|
||||
HREG(85) = selectedInput->rel.stick_x;
|
||||
HREG(86) = selectedInput->rel.stick_y;
|
||||
HREG(87) = selectedInput->rel.stick_x;
|
||||
HREG(88) = selectedInput->rel.stick_y;
|
||||
HREG(89) = selectedInput->cur.stick_x;
|
||||
HREG(90) = selectedInput->cur.stick_y;
|
||||
HREG(93) = (selectedInput->cur.button == hReg82);
|
||||
HREG(94) = CHECK_BTN_ALL(selectedInput->cur.button, hReg82);
|
||||
HREG(95) = CHECK_BTN_ALL(selectedInput->press.button, hReg82);
|
||||
if (R_HREG_MODE == HREG_MODE_INPUT_TEST) {
|
||||
selectedInput =
|
||||
&gameState->input[(u32)R_INPUT_TEST_CONTROLLER_PORT < MAXCONTROLLERS ? R_INPUT_TEST_CONTROLLER_PORT : 0];
|
||||
|
||||
inputCompareValue = R_INPUT_TEST_COMPARE_VALUE;
|
||||
R_INPUT_TEST_BUTTON_CUR = selectedInput->cur.button;
|
||||
R_INPUT_TEST_BUTTON_PRESS = selectedInput->press.button;
|
||||
R_INPUT_TEST_REL_STICK_X = selectedInput->rel.stick_x;
|
||||
R_INPUT_TEST_REL_STICK_Y = selectedInput->rel.stick_y;
|
||||
R_INPUT_TEST_REL_STICK_X_2 = selectedInput->rel.stick_x;
|
||||
R_INPUT_TEST_REL_STICK_Y_2 = selectedInput->rel.stick_y;
|
||||
R_INPUT_TEST_CUR_STICK_X = selectedInput->cur.stick_x;
|
||||
R_INPUT_TEST_CUR_STICK_Y = selectedInput->cur.stick_y;
|
||||
R_INPUT_TEST_COMPARE_BUTTON_CUR = (selectedInput->cur.button == inputCompareValue);
|
||||
R_INPUT_TEST_COMPARE_COMBO_CUR = CHECK_BTN_ALL(selectedInput->cur.button, inputCompareValue);
|
||||
R_INPUT_TEST_COMPARE_COMBO_PRESS = CHECK_BTN_ALL(selectedInput->press.button, inputCompareValue);
|
||||
}
|
||||
|
||||
if (gIsCtrlr2Valid) {
|
||||
|
@ -91,18 +93,19 @@ void func_800C4344(GameState* gameState) {
|
|||
gDmaMgrDmaBuffSize = SREG(21) != 0 ? ALIGN16(SREG(21)) : DMAMGR_DEFAULT_BUFSIZE;
|
||||
gSystemArenaLogSeverity = HREG(61);
|
||||
gZeldaArenaLogSeverity = HREG(62);
|
||||
if (HREG(80) == 8) {
|
||||
if (HREG(94) != 8) {
|
||||
HREG(94) = 8;
|
||||
HREG(81) = 0;
|
||||
HREG(82) = 0;
|
||||
HREG(83) = 0;
|
||||
|
||||
if (R_HREG_MODE == HREG_MODE_PRINT_MEMORY) {
|
||||
if (R_PRINT_MEMORY_INIT != HREG_MODE_PRINT_MEMORY) {
|
||||
R_PRINT_MEMORY_INIT = HREG_MODE_PRINT_MEMORY;
|
||||
R_PRINT_MEMORY_TRIGGER = 0;
|
||||
R_PRINT_MEMORY_ADDR = 0;
|
||||
R_PRINT_MEMORY_SIZE = 0;
|
||||
}
|
||||
if (HREG(81) < 0) {
|
||||
HREG(81) = 0;
|
||||
// & 0xFFFFFFFF necessary for matching.
|
||||
hexDumpSize = (HREG(83) == 0 ? 0x100 : HREG(83) * 0x10) & 0xFFFFFFFF;
|
||||
LogUtils_LogHexDump(PHYSICAL_TO_VIRTUAL(HREG(82) << 8), hexDumpSize);
|
||||
|
||||
if (R_PRINT_MEMORY_TRIGGER < 0) {
|
||||
R_PRINT_MEMORY_TRIGGER = 0;
|
||||
hexDumpSize = (u32)(R_PRINT_MEMORY_SIZE == 0 ? 0x100 : R_PRINT_MEMORY_SIZE * 0x10);
|
||||
LogUtils_LogHexDump((void*)(0x80000000 + (R_PRINT_MEMORY_ADDR << 8)), hexDumpSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -285,28 +288,33 @@ void GameState_Update(GameState* gameState) {
|
|||
gfxCtx->viMode = NULL;
|
||||
}
|
||||
|
||||
if (HREG(80) == 0x15) {
|
||||
if (HREG(95) != 0x15) {
|
||||
HREG(95) = 0x15;
|
||||
HREG(81) = 0;
|
||||
HREG(82) = gViConfigAdditionalScanLines;
|
||||
HREG(83) = 0;
|
||||
HREG(84) = 0;
|
||||
if (R_HREG_MODE == HREG_MODE_VI) {
|
||||
if (R_VI_INIT != HREG_MODE_VI) {
|
||||
R_VI_INIT = HREG_MODE_VI;
|
||||
R_VI_NEXT_Y_SCALE_MODE = 0;
|
||||
R_VI_NEXT_ADDI_SCAN_LINES = gViConfigAdditionalScanLines;
|
||||
R_VI_CUR_ADDI_SCAN_LINES = 0;
|
||||
R_VI_CUR_Y_SCALE_MODE = 0;
|
||||
}
|
||||
|
||||
if (HREG(82) < 0) {
|
||||
HREG(82) = 0;
|
||||
}
|
||||
if (HREG(82) > 0x30) {
|
||||
HREG(82) = 0x30;
|
||||
if (R_VI_NEXT_ADDI_SCAN_LINES < 0) {
|
||||
R_VI_NEXT_ADDI_SCAN_LINES = 0;
|
||||
}
|
||||
|
||||
if ((HREG(83) != HREG(82)) || HREG(84) != HREG(81)) {
|
||||
HREG(83) = HREG(82);
|
||||
HREG(84) = HREG(81);
|
||||
gViConfigAdditionalScanLines = HREG(82);
|
||||
gViConfigYScale =
|
||||
HREG(81) == 0 ? ((f32)SCREEN_HEIGHT) / (gViConfigAdditionalScanLines + (f32)SCREEN_HEIGHT) : 1.0f;
|
||||
if (R_VI_NEXT_ADDI_SCAN_LINES > 0x30) {
|
||||
R_VI_NEXT_ADDI_SCAN_LINES = 0x30;
|
||||
}
|
||||
|
||||
if ((R_VI_CUR_ADDI_SCAN_LINES != R_VI_NEXT_ADDI_SCAN_LINES) ||
|
||||
R_VI_CUR_Y_SCALE_MODE != R_VI_NEXT_Y_SCALE_MODE) {
|
||||
|
||||
R_VI_CUR_ADDI_SCAN_LINES = R_VI_NEXT_ADDI_SCAN_LINES;
|
||||
R_VI_CUR_Y_SCALE_MODE = R_VI_NEXT_Y_SCALE_MODE;
|
||||
|
||||
gViConfigAdditionalScanLines = R_VI_NEXT_ADDI_SCAN_LINES;
|
||||
gViConfigYScale = R_VI_NEXT_Y_SCALE_MODE == 0
|
||||
? ((f32)SCREEN_HEIGHT) / (gViConfigAdditionalScanLines + (f32)SCREEN_HEIGHT)
|
||||
: 1.0f;
|
||||
D_80009430 = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,23 +45,28 @@ void UCodeDisas_Disassemble(UCodeDisas*, Gfx*);
|
|||
void Graph_DisassembleUCode(Gfx* workBuf) {
|
||||
UCodeDisas disassembler;
|
||||
|
||||
if (HREG(80) == 7 && HREG(81) != 0) {
|
||||
if (R_HREG_MODE == HREG_MODE_UCODE_DISAS && R_UCODE_DISAS_TOGGLE != 0) {
|
||||
UCodeDisas_Init(&disassembler);
|
||||
disassembler.enableLog = HREG(83);
|
||||
disassembler.enableLog = R_UCODE_DISAS_LOG_LEVEL;
|
||||
|
||||
UCodeDisas_RegisterUCode(&disassembler, ARRAY_COUNT(D_8012D230), D_8012D230);
|
||||
UCodeDisas_SetCurUCode(&disassembler, gspF3DZEX2_NoN_PosLight_fifoTextStart);
|
||||
|
||||
UCodeDisas_Disassemble(&disassembler, workBuf);
|
||||
HREG(93) = disassembler.dlCnt;
|
||||
HREG(84) = disassembler.tri2Cnt * 2 + disassembler.tri1Cnt + (disassembler.quadCnt * 2) + disassembler.lineCnt;
|
||||
HREG(85) = disassembler.vtxCnt;
|
||||
HREG(86) = disassembler.spvtxCnt;
|
||||
HREG(87) = disassembler.tri1Cnt;
|
||||
HREG(88) = disassembler.tri2Cnt;
|
||||
HREG(89) = disassembler.quadCnt;
|
||||
HREG(90) = disassembler.lineCnt;
|
||||
HREG(91) = disassembler.syncErr;
|
||||
HREG(92) = disassembler.loaducodeCnt;
|
||||
if (HREG(82) == 1 || HREG(82) == 2) {
|
||||
|
||||
R_UCODE_DISAS_DL_COUNT = disassembler.dlCnt;
|
||||
R_UCODE_DISAS_TOTAL_COUNT =
|
||||
disassembler.tri2Cnt * 2 + disassembler.tri1Cnt + (disassembler.quadCnt * 2) + disassembler.lineCnt;
|
||||
R_UCODE_DISAS_VTX_COUNT = disassembler.vtxCnt;
|
||||
R_UCODE_DISAS_SPVTX_COUNT = disassembler.spvtxCnt;
|
||||
R_UCODE_DISAS_TRI1_COUNT = disassembler.tri1Cnt;
|
||||
R_UCODE_DISAS_TRI2_COUNT = disassembler.tri2Cnt;
|
||||
R_UCODE_DISAS_QUAD_COUNT = disassembler.quadCnt;
|
||||
R_UCODE_DISAS_LINE_COUNT = disassembler.lineCnt;
|
||||
R_UCODE_DISAS_SYNC_ERROR_COUNT = disassembler.syncErr;
|
||||
R_UCODE_DISAS_LOAD_COUNT = disassembler.loaducodeCnt;
|
||||
|
||||
if (R_UCODE_DISAS_LOG_MODE == 1 || R_UCODE_DISAS_LOG_MODE == 2) {
|
||||
osSyncPrintf("vtx_cnt=%d\n", disassembler.vtxCnt);
|
||||
osSyncPrintf("spvtx_cnt=%d\n", disassembler.spvtxCnt);
|
||||
osSyncPrintf("tri1_cnt=%d\n", disassembler.tri1Cnt);
|
||||
|
@ -73,6 +78,7 @@ void Graph_DisassembleUCode(Gfx* workBuf) {
|
|||
osSyncPrintf("dl_depth=%d\n", disassembler.dlDepth);
|
||||
osSyncPrintf("dl_cnt=%d\n", disassembler.dlCnt);
|
||||
}
|
||||
|
||||
UCodeDisas_Destroy(&disassembler);
|
||||
}
|
||||
}
|
||||
|
@ -181,12 +187,13 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) {
|
|||
|
||||
SREG(6) = -1;
|
||||
if (sPrevTaskWorkBuffer != NULL) {
|
||||
HREG(80) = 7;
|
||||
HREG(81) = 1;
|
||||
HREG(83) = 2;
|
||||
R_HREG_MODE = HREG_MODE_UCODE_DISAS;
|
||||
R_UCODE_DISAS_TOGGLE = 1;
|
||||
R_UCODE_DISAS_LOG_LEVEL = 2;
|
||||
sPrevTaskWorkBuffer = sPrevTaskWorkBuffer;
|
||||
Graph_DisassembleUCode(sPrevTaskWorkBuffer);
|
||||
}
|
||||
|
||||
Fault_AddHungupAndCrashImpl("RCP is HUNG UP!!", "Oh! MY GOD!!");
|
||||
}
|
||||
|
||||
|
@ -303,30 +310,30 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
|
|||
|
||||
CLOSE_DISPS(gfxCtx, "../graph.c", 1028);
|
||||
|
||||
if (HREG(80) == 10 && HREG(93) == 2) {
|
||||
HREG(80) = 7;
|
||||
HREG(81) = -1;
|
||||
HREG(83) = HREG(92);
|
||||
if (R_HREG_MODE == HREG_MODE_PLAY && R_PLAY_ENABLE_UCODE_DISAS == 2) {
|
||||
R_HREG_MODE = HREG_MODE_UCODE_DISAS;
|
||||
R_UCODE_DISAS_TOGGLE = -1;
|
||||
R_UCODE_DISAS_LOG_LEVEL = R_PLAY_UCODE_DISAS_LOG_LEVEL;
|
||||
}
|
||||
|
||||
if (HREG(80) == 7 && HREG(81) != 0) {
|
||||
if (HREG(82) == 3) {
|
||||
if (R_HREG_MODE == HREG_MODE_UCODE_DISAS && R_UCODE_DISAS_TOGGLE != 0) {
|
||||
if (R_UCODE_DISAS_LOG_MODE == 3) {
|
||||
Fault_AddClient(&sGraphUcodeFaultClient, Graph_UCodeFaultClient, gfxCtx->workBuffer, "do_count_fault");
|
||||
}
|
||||
|
||||
Graph_DisassembleUCode(gfxCtx->workBuffer);
|
||||
|
||||
if (HREG(82) == 3) {
|
||||
if (R_UCODE_DISAS_LOG_MODE == 3) {
|
||||
Fault_RemoveClient(&sGraphUcodeFaultClient);
|
||||
}
|
||||
|
||||
if (HREG(81) < 0) {
|
||||
if (R_UCODE_DISAS_TOGGLE < 0) {
|
||||
LogUtils_LogHexDump((void*)PHYS_TO_K1(SP_BASE_REG), 0x20);
|
||||
LogUtils_LogHexDump((void*)PHYS_TO_K1(DPC_BASE_REG), 0x20);
|
||||
}
|
||||
|
||||
if (HREG(81) < 0) {
|
||||
HREG(81) = 0;
|
||||
if (R_UCODE_DISAS_TOGGLE < 0) {
|
||||
R_UCODE_DISAS_TOGGLE = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -475,7 +482,7 @@ void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size) {
|
|||
}
|
||||
|
||||
void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line) {
|
||||
if (HREG(80) == 7 && HREG(82) != 4) {
|
||||
if (R_HREG_MODE == HREG_MODE_UCODE_DISAS && R_UCODE_DISAS_LOG_MODE != 4) {
|
||||
dispRefs[0] = gfxCtx->polyOpa.p;
|
||||
dispRefs[1] = gfxCtx->polyXlu.p;
|
||||
dispRefs[2] = gfxCtx->overlay.p;
|
||||
|
@ -487,7 +494,7 @@ void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file,
|
|||
}
|
||||
|
||||
void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line) {
|
||||
if (HREG(80) == 7 && HREG(82) != 4) {
|
||||
if (R_HREG_MODE == HREG_MODE_UCODE_DISAS && R_UCODE_DISAS_LOG_MODE != 4) {
|
||||
if (dispRefs[0] + 1 == gfxCtx->polyOpa.p) {
|
||||
gfxCtx->polyOpa.p = dispRefs[0];
|
||||
} else {
|
||||
|
|
|
@ -73,12 +73,14 @@ void Sched_SwapFrameBufferImpl(CfbInfo* cfbInfo) {
|
|||
width = (cfbInfo->viMode != NULL) ? cfbInfo->viMode->comRegs.width : (u32)gScreenWidth;
|
||||
Fault_SetFrameBuffer(cfbInfo->swapBuffer, width, 16);
|
||||
|
||||
if (HREG(80) == 0xD && HREG(95) != 0xD) {
|
||||
HREG(81) = 0;
|
||||
HREG(82) = 0;
|
||||
HREG(83) = 1;
|
||||
HREG(84) = 0;
|
||||
HREG(85) = 1;
|
||||
if (R_HREG_MODE == HREG_MODE_SCHED && R_SCHED_INIT != HREG_MODE_SCHED) {
|
||||
R_SCHED_TOGGLE_SPECIAL_FEATURES = 0;
|
||||
R_SCHED_GAMMA_ON = 0;
|
||||
R_SCHED_DITHER_FILTER_ON = 1;
|
||||
R_SCHED_GAMMA_DITHER_ON = 0;
|
||||
R_SCHED_DIVOT_ON = 1;
|
||||
|
||||
// these regs are not used in this mode
|
||||
HREG(86) = 0;
|
||||
HREG(87) = 0;
|
||||
HREG(88) = 0;
|
||||
|
@ -88,15 +90,18 @@ void Sched_SwapFrameBufferImpl(CfbInfo* cfbInfo) {
|
|||
HREG(92) = 0;
|
||||
HREG(93) = 0;
|
||||
HREG(94) = 0;
|
||||
HREG(95) = 0xD;
|
||||
|
||||
R_SCHED_INIT = HREG_MODE_SCHED;
|
||||
}
|
||||
if (HREG(80) == 0xD && HREG(81) == 2) {
|
||||
osViSetSpecialFeatures((HREG(82) != 0) ? OS_VI_GAMMA_ON : OS_VI_GAMMA_OFF);
|
||||
osViSetSpecialFeatures((HREG(83) != 0) ? OS_VI_DITHER_FILTER_ON : OS_VI_DITHER_FILTER_OFF);
|
||||
osViSetSpecialFeatures((HREG(84) != 0) ? OS_VI_GAMMA_DITHER_ON : OS_VI_GAMMA_DITHER_OFF);
|
||||
osViSetSpecialFeatures((HREG(85) != 0) ? OS_VI_DIVOT_ON : OS_VI_DIVOT_OFF);
|
||||
|
||||
if (R_HREG_MODE == HREG_MODE_SCHED && R_SCHED_TOGGLE_SPECIAL_FEATURES == 2) {
|
||||
osViSetSpecialFeatures(R_SCHED_GAMMA_ON ? OS_VI_GAMMA_ON : OS_VI_GAMMA_OFF);
|
||||
osViSetSpecialFeatures(R_SCHED_DITHER_FILTER_ON ? OS_VI_DITHER_FILTER_ON : OS_VI_DITHER_FILTER_OFF);
|
||||
osViSetSpecialFeatures(R_SCHED_GAMMA_DITHER_ON ? OS_VI_GAMMA_DITHER_ON : OS_VI_GAMMA_DITHER_OFF);
|
||||
osViSetSpecialFeatures(R_SCHED_DIVOT_ON ? OS_VI_DIVOT_ON : OS_VI_DIVOT_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
cfbInfo->unk_10 = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ s32 sLetterboxSizeTarget = 0;
|
|||
s32 sLetterboxSize = 0;
|
||||
|
||||
void Letterbox_SetSizeTarget(s32 target) {
|
||||
if (HREG(80) == 0x13 && HREG(81) == 1) {
|
||||
if (R_HREG_MODE == HREG_MODE_LETTERBOX && R_LETTERBOX_ENABLE_LOGS == 1) {
|
||||
osSyncPrintf("shrink_window_setval(%d)\n", target);
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ u32 Letterbox_GetSizeTarget(void) {
|
|||
}
|
||||
|
||||
void Letterbox_SetSize(s32 size) {
|
||||
if (HREG(80) == 0x13 && HREG(81) == 1) {
|
||||
if (R_HREG_MODE == HREG_MODE_LETTERBOX && R_LETTERBOX_ENABLE_LOGS == 1) {
|
||||
osSyncPrintf("shrink_window_setnowval(%d)\n", size);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ u32 Letterbox_GetSize(void) {
|
|||
}
|
||||
|
||||
void Letterbox_Init(void) {
|
||||
if (HREG(80) == 0x13 && HREG(81) == 1) {
|
||||
if (R_HREG_MODE == HREG_MODE_LETTERBOX && R_LETTERBOX_ENABLE_LOGS == 1) {
|
||||
osSyncPrintf("shrink_window_init()\n");
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ void Letterbox_Init(void) {
|
|||
}
|
||||
|
||||
void Letterbox_Destroy(void) {
|
||||
if (HREG(80) == 0x13 && HREG(81) == 1) {
|
||||
if (R_HREG_MODE == HREG_MODE_LETTERBOX && R_LETTERBOX_ENABLE_LOGS == 1) {
|
||||
osSyncPrintf("shrink_window_cleanup()\n");
|
||||
}
|
||||
|
||||
|
@ -86,23 +86,25 @@ void Letterbox_Update(s32 updateRate) {
|
|||
sLetterboxState = LETTERBOX_STATE_IDLE;
|
||||
}
|
||||
|
||||
if (HREG(80) == 0x13) {
|
||||
if (HREG(94) != 0x13) {
|
||||
HREG(94) = 0x13;
|
||||
HREG(81) = 0;
|
||||
HREG(82) = 0;
|
||||
HREG(83) = 0;
|
||||
HREG(84) = 0;
|
||||
HREG(85) = 0;
|
||||
HREG(86) = 0;
|
||||
if (R_HREG_MODE == HREG_MODE_LETTERBOX) {
|
||||
if (R_LETTERBOX_INIT != HREG_MODE_LETTERBOX) {
|
||||
R_LETTERBOX_INIT = HREG_MODE_LETTERBOX;
|
||||
R_LETTERBOX_ENABLE_LOGS = 0;
|
||||
HREG(82) = 0; // this reg is not used in this mode
|
||||
R_LETTERBOX_STATE = 0;
|
||||
R_LETTERBOX_SIZE = 0;
|
||||
R_LETTERBOX_TARGET_SIZE = 0;
|
||||
R_LETTERBOX_STEP = 0;
|
||||
|
||||
// these regs are not used in this mode
|
||||
HREG(87) = 0;
|
||||
HREG(88) = 0;
|
||||
HREG(89) = 0;
|
||||
}
|
||||
|
||||
HREG(83) = sLetterboxState;
|
||||
HREG(84) = sLetterboxSize;
|
||||
HREG(85) = sLetterboxSizeTarget;
|
||||
HREG(86) = step;
|
||||
R_LETTERBOX_STATE = sLetterboxState;
|
||||
R_LETTERBOX_SIZE = sLetterboxSize;
|
||||
R_LETTERBOX_TARGET_SIZE = sLetterboxSizeTarget;
|
||||
R_LETTERBOX_STEP = step;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1319,7 +1319,7 @@ Gfx* func_8002E830(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext*
|
|||
|
||||
*hilite = Graph_Alloc(gfxCtx, sizeof(Hilite));
|
||||
|
||||
if (HREG(80) == 6) {
|
||||
if (R_HREG_MODE == HREG_MODE_PRINT_HILITE_INFO) {
|
||||
osSyncPrintf("z_actor.c 3529 eye=[%f(%f) %f %f] object=[%f %f %f] light_direction=[%f %f %f]\n", correctedEyeX,
|
||||
eye->x, eye->y, eye->z, object->x, object->y, object->z, lightDir->x, lightDir->y, lightDir->z);
|
||||
}
|
||||
|
@ -1368,7 +1368,7 @@ void func_8002EBCC(Actor* actor, PlayState* play, s32 flag) {
|
|||
lightDir.y = play->envCtx.dirLight1.params.dir.y;
|
||||
lightDir.z = play->envCtx.dirLight1.params.dir.z;
|
||||
|
||||
if (HREG(80) == 6) {
|
||||
if (R_HREG_MODE == HREG_MODE_PRINT_HILITE_INFO) {
|
||||
osSyncPrintf("z_actor.c 3637 game_play->view.eye=[%f(%f) %f %f]\n", play->view.eye.x, play->view.eye.y,
|
||||
play->view.eye.z);
|
||||
}
|
||||
|
|
|
@ -59,16 +59,16 @@ void KaleidoScopeCall_Update(PlayState* play) {
|
|||
if ((pauseCtx->state != 0) || (pauseCtx->debugState != 0)) {
|
||||
if (pauseCtx->state == 1) {
|
||||
if (Letterbox_GetSize() == 0) {
|
||||
HREG(80) = 7;
|
||||
HREG(82) = 3;
|
||||
R_HREG_MODE = HREG_MODE_UCODE_DISAS;
|
||||
R_UCODE_DISAS_LOG_MODE = 3;
|
||||
R_PAUSE_MENU_MODE = 1;
|
||||
pauseCtx->unk_1E4 = 0;
|
||||
pauseCtx->unk_1EC = 0;
|
||||
pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1;
|
||||
}
|
||||
} else if (pauseCtx->state == 8) {
|
||||
HREG(80) = 7;
|
||||
HREG(82) = 3;
|
||||
R_HREG_MODE = HREG_MODE_UCODE_DISAS;
|
||||
R_UCODE_DISAS_LOG_MODE = 3;
|
||||
R_PAUSE_MENU_MODE = 1;
|
||||
pauseCtx->unk_1E4 = 0;
|
||||
pauseCtx->unk_1EC = 0;
|
||||
|
|
|
@ -456,8 +456,8 @@ void Play_Update(PlayState* this) {
|
|||
ZeldaArena_Display();
|
||||
}
|
||||
|
||||
if ((HREG(80) == 18) && (HREG(81) < 0)) {
|
||||
HREG(81) = 0;
|
||||
if ((R_HREG_MODE == HREG_MODE_PRINT_OBJECT_TABLE) && (R_PRINT_OBJECT_TABLE_TRIGGER < 0)) {
|
||||
R_PRINT_OBJECT_TABLE_TRIGGER = 0;
|
||||
osSyncPrintf("object_exchange_rom_address %u\n", gObjectTableSize);
|
||||
osSyncPrintf("RomStart RomEnd Size\n");
|
||||
|
||||
|
@ -471,6 +471,9 @@ void Play_Update(PlayState* this) {
|
|||
osSyncPrintf("\n");
|
||||
}
|
||||
|
||||
// HREG(81) was very likely intended to be HREG(80), which would make more sense given how the
|
||||
// HREG debugging system works. If this condition used HREG(80) instead, `HREG_MODE_PRINT_OBJECT_TABLE`
|
||||
// would also include the actor overlay table and HREG(82) would be used to trigger it instead.
|
||||
if ((HREG(81) == 18) && (HREG(82) < 0)) {
|
||||
HREG(82) = 0;
|
||||
ActorOverlayTable_LogPrint();
|
||||
|
@ -1047,7 +1050,7 @@ void Play_Draw(PlayState* this) {
|
|||
|
||||
Gfx_SetupFrame(gfxCtx, 0, 0, 0);
|
||||
|
||||
if ((HREG(80) != 10) || (HREG(82) != 0)) {
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_RUN_DRAW) {
|
||||
POLY_OPA_DISP = Play_SetFog(this, POLY_OPA_DISP);
|
||||
POLY_XLU_DISP = Play_SetFog(this, POLY_XLU_DISP);
|
||||
|
||||
|
@ -1070,7 +1073,7 @@ void Play_Draw(PlayState* this) {
|
|||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x01, this->billboardMtx);
|
||||
|
||||
if ((HREG(80) != 10) || (HREG(92) != 0)) {
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_COVER_ELEMENTS) {
|
||||
Gfx* gfxP;
|
||||
Gfx* sp1CC = POLY_OPA_DISP;
|
||||
|
||||
|
@ -1128,7 +1131,7 @@ void Play_Draw(PlayState* this) {
|
|||
} else {
|
||||
s32 roomDrawFlags;
|
||||
|
||||
if ((HREG(80) != 10) || (HREG(83) != 0)) {
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SKYBOX) {
|
||||
if (this->skyboxId && (this->skyboxId != SKYBOX_UNSET_1D) && !this->envCtx.skyboxDisabled) {
|
||||
if ((this->skyboxId == SKYBOX_NORMAL_SKY) || (this->skyboxId == SKYBOX_CUTSCENE_MAP)) {
|
||||
Environment_UpdateSkybox(this->skyboxId, &this->envCtx, &this->skyboxCtx);
|
||||
|
@ -1141,33 +1144,33 @@ void Play_Draw(PlayState* this) {
|
|||
}
|
||||
}
|
||||
|
||||
if ((HREG(80) != 10) || (HREG(90) & 2)) {
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_SUN_AND_MOON)) {
|
||||
if (!this->envCtx.sunMoonDisabled) {
|
||||
Environment_DrawSunAndMoon(this);
|
||||
}
|
||||
}
|
||||
|
||||
if ((HREG(80) != 10) || (HREG(90) & 1)) {
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_SKYBOX_FILTERS)) {
|
||||
Environment_DrawSkyboxFilters(this);
|
||||
}
|
||||
|
||||
if ((HREG(80) != 10) || (HREG(90) & 4)) {
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_LIGHTNING)) {
|
||||
Environment_UpdateLightningStrike(this);
|
||||
Environment_DrawLightning(this, 0);
|
||||
}
|
||||
|
||||
if ((HREG(80) != 10) || (HREG(90) & 8)) {
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_LIGHTS)) {
|
||||
sp228 = LightContext_NewLights(&this->lightCtx, gfxCtx);
|
||||
Lights_BindAll(sp228, this->lightCtx.listHead, NULL);
|
||||
Lights_Draw(sp228, gfxCtx);
|
||||
}
|
||||
|
||||
if ((HREG(80) != 10) || (HREG(84) != 0)) {
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ROOM_FLAGS != 0)) {
|
||||
if (VREG(94) == 0) {
|
||||
if (HREG(80) != 10) {
|
||||
if (R_HREG_MODE != HREG_MODE_PLAY) {
|
||||
roomDrawFlags = ROOM_DRAW_OPA | ROOM_DRAW_XLU;
|
||||
} else {
|
||||
roomDrawFlags = HREG(84);
|
||||
roomDrawFlags = R_PLAY_DRAW_ROOM_FLAGS;
|
||||
}
|
||||
Scene_Draw(this);
|
||||
Room_Draw(this, &this->roomCtx.curRoom, roomDrawFlags & (ROOM_DRAW_OPA | ROOM_DRAW_XLU));
|
||||
|
@ -1175,7 +1178,7 @@ void Play_Draw(PlayState* this) {
|
|||
}
|
||||
}
|
||||
|
||||
if ((HREG(80) != 10) || (HREG(83) != 0)) {
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SKYBOX) {
|
||||
if ((this->skyboxCtx.unk_140 != 0) && (GET_ACTIVE_CAM(this)->setting != CAM_SET_PREREND_FIXED)) {
|
||||
Vec3f quakeOffset;
|
||||
|
||||
|
@ -1189,15 +1192,15 @@ void Play_Draw(PlayState* this) {
|
|||
Environment_DrawRain(this, &this->view, gfxCtx);
|
||||
}
|
||||
|
||||
if ((HREG(80) != 10) || (HREG(84) != 0)) {
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ROOM_FLAGS != 0)) {
|
||||
Environment_FillScreen(gfxCtx, 0, 0, 0, this->unk_11E18, FILL_SCREEN_OPA);
|
||||
}
|
||||
|
||||
if ((HREG(80) != 10) || (HREG(85) != 0)) {
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_ACTORS) {
|
||||
func_800315AC(this, &this->actorCtx);
|
||||
}
|
||||
|
||||
if ((HREG(80) != 10) || (HREG(86) != 0)) {
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_LENS_FLARES) {
|
||||
if (!this->envCtx.sunMoonDisabled) {
|
||||
sp21C.x = this->view.eye.x + this->envCtx.sunPos.x;
|
||||
sp21C.y = this->view.eye.y + this->envCtx.sunPos.y;
|
||||
|
@ -1207,7 +1210,7 @@ void Play_Draw(PlayState* this) {
|
|||
Environment_DrawCustomLensFlare(this);
|
||||
}
|
||||
|
||||
if ((HREG(80) != 10) || (HREG(87) != 0)) {
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SCREEN_FILLS) {
|
||||
if (MREG(64) != 0) {
|
||||
Environment_FillScreen(gfxCtx, MREG(65), MREG(66), MREG(67), MREG(68),
|
||||
FILL_SCREEN_OPA | FILL_SCREEN_XLU);
|
||||
|
@ -1224,13 +1227,13 @@ void Play_Draw(PlayState* this) {
|
|||
}
|
||||
}
|
||||
|
||||
if ((HREG(80) != 10) || (HREG(88) != 0)) {
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SANDSTORM) {
|
||||
if (this->envCtx.sandstormState != SANDSTORM_OFF) {
|
||||
Environment_DrawSandstorm(this, this->envCtx.sandstormState);
|
||||
}
|
||||
}
|
||||
|
||||
if ((HREG(80) != 10) || (HREG(93) != 0)) {
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_DEBUG_OBJECTS) {
|
||||
DebugDisplay_DrawObjects(this);
|
||||
}
|
||||
|
||||
|
@ -1252,7 +1255,7 @@ void Play_Draw(PlayState* this) {
|
|||
SREG(33) |= 1;
|
||||
} else {
|
||||
Play_Draw_DrawOverlayElements:
|
||||
if ((HREG(80) != 10) || (HREG(89) != 0)) {
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_OVERLAY_ELEMENTS) {
|
||||
Play_DrawOverlayElements(this);
|
||||
}
|
||||
}
|
||||
|
@ -1283,24 +1286,25 @@ void Play_Main(GameState* thisx) {
|
|||
|
||||
PLAY_LOG(4556);
|
||||
|
||||
if ((HREG(80) == 10) && (HREG(94) != 10)) {
|
||||
HREG(81) = 1;
|
||||
HREG(82) = 1;
|
||||
HREG(83) = 1;
|
||||
HREG(84) = 3;
|
||||
HREG(85) = 1;
|
||||
HREG(86) = 1;
|
||||
HREG(87) = 1;
|
||||
HREG(88) = 1;
|
||||
HREG(89) = 1;
|
||||
HREG(90) = 15;
|
||||
HREG(91) = 1;
|
||||
HREG(92) = 1;
|
||||
HREG(93) = 1;
|
||||
HREG(94) = 10;
|
||||
if ((R_HREG_MODE == HREG_MODE_PLAY) && (R_PLAY_INIT != HREG_MODE_PLAY)) {
|
||||
R_PLAY_RUN_UPDATE = true;
|
||||
R_PLAY_RUN_DRAW = true;
|
||||
R_PLAY_DRAW_SKYBOX = true;
|
||||
R_PLAY_DRAW_ROOM_FLAGS = (ROOM_DRAW_OPA | ROOM_DRAW_XLU);
|
||||
R_PLAY_DRAW_ACTORS = true;
|
||||
R_PLAY_DRAW_LENS_FLARES = true;
|
||||
R_PLAY_DRAW_SCREEN_FILLS = true;
|
||||
R_PLAY_DRAW_SANDSTORM = true;
|
||||
R_PLAY_DRAW_OVERLAY_ELEMENTS = true;
|
||||
R_PLAY_DRAW_ENV_FLAGS = (PLAY_ENV_DRAW_SKYBOX_FILTERS | PLAY_ENV_DRAW_SUN_AND_MOON | PLAY_ENV_DRAW_LIGHTNING |
|
||||
PLAY_ENV_DRAW_LIGHTS);
|
||||
HREG(91) = 1; // reg is not used in this mode
|
||||
R_PLAY_DRAW_COVER_ELEMENTS = true;
|
||||
R_PLAY_DRAW_DEBUG_OBJECTS = true;
|
||||
R_PLAY_INIT = HREG_MODE_PLAY;
|
||||
}
|
||||
|
||||
if ((HREG(80) != 10) || (HREG(81) != 0)) {
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_RUN_UPDATE) {
|
||||
Play_Update(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -1472,14 +1472,16 @@ void Gfx_SetupFrame(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) {
|
|||
if ((R_PAUSE_MENU_MODE < 2) && (gTrnsnUnkState < 2)) {
|
||||
s32 letterboxSize = Letterbox_GetSize();
|
||||
|
||||
if (HREG(80) == 16) {
|
||||
if (HREG(95) != 16) {
|
||||
HREG(81) = 3;
|
||||
HREG(82) = 3;
|
||||
HREG(83) = 0;
|
||||
HREG(84) = 0;
|
||||
HREG(85) = 0;
|
||||
HREG(86) = 0;
|
||||
if (R_HREG_MODE == HREG_MODE_SETUP_FRAME) {
|
||||
if (R_SETUP_FRAME_INIT != HREG_MODE_SETUP_FRAME) {
|
||||
R_SETUP_FRAME_GET = (SETUP_FRAME_LETTERBOX_SIZE_FLAG | SETUP_FRAME_BASE_COLOR_FLAG);
|
||||
R_SETUP_FRAME_SET = (SETUP_FRAME_LETTERBOX_SIZE_FLAG | SETUP_FRAME_BASE_COLOR_FLAG);
|
||||
R_SETUP_FRAME_LETTERBOX_SIZE = 0;
|
||||
R_SETUP_FRAME_BASE_COLOR_R = 0;
|
||||
R_SETUP_FRAME_BASE_COLOR_G = 0;
|
||||
R_SETUP_FRAME_BASE_COLOR_B = 0;
|
||||
|
||||
// these regs are not used in this mode
|
||||
HREG(87) = 0;
|
||||
HREG(88) = 0;
|
||||
HREG(89) = 0;
|
||||
|
@ -1488,27 +1490,28 @@ void Gfx_SetupFrame(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) {
|
|||
HREG(92) = 0;
|
||||
HREG(93) = 0;
|
||||
HREG(94) = 0;
|
||||
HREG(95) = 16;
|
||||
|
||||
R_SETUP_FRAME_INIT = HREG_MODE_SETUP_FRAME;
|
||||
}
|
||||
|
||||
if (HREG(81) & 1) {
|
||||
HREG(83) = letterboxSize;
|
||||
if (R_SETUP_FRAME_GET & SETUP_FRAME_LETTERBOX_SIZE_FLAG) {
|
||||
R_SETUP_FRAME_LETTERBOX_SIZE = letterboxSize;
|
||||
}
|
||||
|
||||
if (HREG(81) & 2) {
|
||||
HREG(84) = r;
|
||||
HREG(85) = g;
|
||||
HREG(86) = b;
|
||||
if (R_SETUP_FRAME_GET & SETUP_FRAME_BASE_COLOR_FLAG) {
|
||||
R_SETUP_FRAME_BASE_COLOR_R = r;
|
||||
R_SETUP_FRAME_BASE_COLOR_G = g;
|
||||
R_SETUP_FRAME_BASE_COLOR_B = b;
|
||||
}
|
||||
|
||||
if (HREG(82) & 1) {
|
||||
letterboxSize = HREG(83);
|
||||
if (R_SETUP_FRAME_SET & SETUP_FRAME_LETTERBOX_SIZE_FLAG) {
|
||||
letterboxSize = R_SETUP_FRAME_LETTERBOX_SIZE;
|
||||
}
|
||||
|
||||
if (HREG(82) & 2) {
|
||||
r = HREG(84);
|
||||
g = HREG(85);
|
||||
b = HREG(86);
|
||||
if (R_SETUP_FRAME_SET & SETUP_FRAME_BASE_COLOR_FLAG) {
|
||||
r = R_SETUP_FRAME_BASE_COLOR_R;
|
||||
g = R_SETUP_FRAME_BASE_COLOR_G;
|
||||
b = R_SETUP_FRAME_BASE_COLOR_B;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1649,11 +1649,13 @@ void (*sSceneDrawConfigs[SDC_MAX])(PlayState*) = {
|
|||
};
|
||||
|
||||
void Scene_Draw(PlayState* play) {
|
||||
if (HREG(80) == 17) {
|
||||
if (HREG(95) != 17) {
|
||||
HREG(95) = 17;
|
||||
HREG(81) = 1;
|
||||
HREG(82) = 1;
|
||||
if (R_HREG_MODE == HREG_MODE_SCENE_CONFIG) {
|
||||
if (R_SCENE_CONFIG_INIT != HREG_MODE_SCENE_CONFIG) {
|
||||
R_SCENE_CONFIG_INIT = HREG_MODE_SCENE_CONFIG;
|
||||
R_SCENE_CONFIG_DRAW_DEFAULT_DLIST = 1;
|
||||
R_SCENE_CONFIG_DRAW_SCENE_CONFIG = 1;
|
||||
|
||||
// these regs are not used in this mode
|
||||
HREG(83) = 0;
|
||||
HREG(84) = 0;
|
||||
HREG(85) = 0;
|
||||
|
@ -1669,14 +1671,14 @@ void Scene_Draw(PlayState* play) {
|
|||
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 8104);
|
||||
|
||||
if (HREG(81) == 1) {
|
||||
if (R_SCENE_CONFIG_DRAW_DEFAULT_DLIST == 1) {
|
||||
gSPDisplayList(POLY_OPA_DISP++, sDefaultDisplayList);
|
||||
gSPDisplayList(POLY_XLU_DISP++, sDefaultDisplayList);
|
||||
}
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 8109);
|
||||
|
||||
if (HREG(82) == 1) {
|
||||
if (R_SCENE_CONFIG_DRAW_SCENE_CONFIG == 1) {
|
||||
sSceneDrawConfigs[play->sceneDrawConfig](play);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -310,16 +310,17 @@ s32 View_ApplyPerspective(View* view) {
|
|||
height = view->viewport.bottomY - view->viewport.topY;
|
||||
aspect = (f32)width / (f32)height;
|
||||
|
||||
if (HREG(80) == 11) {
|
||||
if (HREG(94) != 11) {
|
||||
HREG(94) = 11;
|
||||
HREG(83) = 60;
|
||||
HREG(84) = 13333;
|
||||
HREG(85) = 10;
|
||||
HREG(86) = 12800;
|
||||
HREG(87) = 100;
|
||||
if (R_HREG_MODE == HREG_MODE_PERSPECTIVE) {
|
||||
if (R_PERSPECTIVE_INIT != HREG_MODE_PERSPECTIVE) {
|
||||
R_PERSPECTIVE_INIT = HREG_MODE_PERSPECTIVE;
|
||||
R_PERSPECTIVE_FOVY = 60;
|
||||
R_PERSPECTIVE_ASPECT = (10000 * 4) / 3;
|
||||
R_PERSPECTIVE_NEAR = 10;
|
||||
R_PERSPECTIVE_FAR = 12800;
|
||||
R_PERSPECTIVE_SCALE = 100;
|
||||
}
|
||||
guPerspective(projection, &view->normal, HREG(83), HREG(84) / 10000.0f, HREG(85), HREG(86), HREG(87) / 100.0f);
|
||||
guPerspective(projection, &view->normal, R_PERSPECTIVE_FOVY, R_PERSPECTIVE_ASPECT / 10000.0f,
|
||||
R_PERSPECTIVE_NEAR, R_PERSPECTIVE_FAR, R_PERSPECTIVE_SCALE / 100.0f);
|
||||
} else {
|
||||
guPerspective(projection, &view->normal, view->fovy, aspect, view->zNear, view->zFar, view->scale);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue