Skip to content

Commit 8e44699

Browse files
author
Niko
committed
start of clip buffer debugging
1 parent 9f976d8 commit 8e44699

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed
Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
#include <common.h>
22

3+
// Debug clip space
4+
#define JAL(dest) (((unsigned long)dest & 0x3FFFFFF) >> 2 | 0xC000000)
5+
void RunHook226();
6+
37
int DECOMP_MainDB_GetClipSize(u_int levelID, int numPlyrCurrGame)
48
{
5-
6-
/*
7-
Breakpoint 800aa790
8-
$s7/r23 is pointer to start Clip Buffer (buffer start)
9-
$t8/r24 is pointer to curr Clip Buffer (last write)
10-
*/
9+
#if 0
10+
// jal 800aa790 (can breakpoint to see regs)
11+
if (*(int*)0x800a0eac == 0xC02A9e4)
12+
*(int*)0x800a0eac = JAL(RunHook226);
13+
#endif
1114

1215
if(levelID == PAPU_PYRAMID || levelID == POLAR_PASS)
1316
if (2 < numPlyrCurrGame)
@@ -19,4 +22,25 @@ int DECOMP_MainDB_GetClipSize(u_int levelID, int numPlyrCurrGame)
1922
if(levelID == ADVENTURE_CHARACTER_SELECT) return 6000; // down from 24000
2023

2124
return 3000;
22-
}
25+
}
26+
27+
#if 0
28+
void RunHook226()
29+
{
30+
// ra = 0x8000c000;
31+
asm("lui $ra, 0x8000");
32+
asm("ori $ra, $ra, 0xc000");
33+
34+
// Save start(s7) and end(t8)
35+
asm("sw $s7, 0x0($ra)");
36+
asm("sw $t8, 0x4($ra)");
37+
asm("nop");
38+
39+
// ra = 0x800a0eb4;
40+
asm("lui $ra, 0x800a");
41+
asm("ori $ra, $ra, 0xeb4");
42+
43+
asm("j 0x800aa790");
44+
asm("nop");
45+
}
46+
#endif

0 commit comments

Comments
 (0)