diff options
Diffstat (limited to '')
-rw-r--r-- | heapbar.yaml | 1 | ||||
-rw-r--r-- | src/heapbar.S | 38 | ||||
-rw-r--r-- | src/heapbar.cpp | 30 |
3 files changed, 43 insertions, 26 deletions
diff --git a/heapbar.yaml b/heapbar.yaml index fd8b56a..aea2af0 100644 --- a/heapbar.yaml +++ b/heapbar.yaml @@ -4,6 +4,5 @@ hooks: - name: heapbar_draw
type: branch_insn
branch_type: b
- src_addr_ntsc: 0xdeadbeef
src_addr_pal: 0x800B0B40
target_func: 'doHeapBar'
diff --git a/src/heapbar.S b/src/heapbar.S index 4f86fbe..83b0c3a 100644 --- a/src/heapbar.S +++ b/src/heapbar.S @@ -1,18 +1,9 @@ # memory debugger - fun! # GX stuff is implemented in C++, this just gets the lowlevel info -#ifndef __MWERKS__ -.set r0,0; .set r1,1; .set r2,2; .set r3,3; .set r4,4 -.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 -.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 -.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 -.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 -.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 -.set r30,30; .set r31,31; .set f0,0; .set f2,2; .set f3,3 -#endif - #define HEAP_EGGRootMEM1 1 #define HEAP_EGGRootMEM2 2 +#define HEAP_Archive 3 .extern cppGXStart .extern cppGXEnd @@ -20,6 +11,10 @@ .extern MEMGetTotalFreeSizeForExpHeap .extern GameHeap1 .extern GameHeap2 +.extern ArchiveHeap +.extern OSReport +.extern dSys_c__RootHeapMEM1 +.extern dSys_c__RootHeapMEM2 .set sp,1 .set rtoc,2 @@ -32,8 +27,6 @@ .global doHeapBar doHeapBar: - blr - stwu sp, -0x10(sp) mflr r0 stw r0, 0x14(sp) @@ -63,7 +56,23 @@ doHeapBar: lwz r3, 0(r3) li r4, HEAP_EGGRootMEM2 bl asmProcessHeap + + lis r3, ArchiveHeap@h + ori r3, r3, ArchiveHeap@l + lwz r3, 0(r3) + li r4, HEAP_Archive + bl asmProcessHeap + lis r3, dSys_c__RootHeapMEM2@h + ori r3, r3, dSys_c__RootHeapMEM2@l + lwz r3, 0(r3) + lwz r3, 0x10(r3) + lwz r4, 0x18(r3) + lwz r5, 0x1C(r3) + lis r3, THE_THING@h + ori r3, r3, THE_THING@l + bl OSReport + bl cppGXEnd lwz this, 0xC(sp) @@ -116,3 +125,8 @@ asmProcessHeap: mtlr r0 addi sp, sp, 0x10 blr + +.data +THE_THING: .string "A thing: %x - %x\n" +.align 4 + diff --git a/src/heapbar.cpp b/src/heapbar.cpp index 386427d..40fefe5 100644 --- a/src/heapbar.cpp +++ b/src/heapbar.cpp @@ -64,22 +64,26 @@ void cppGXEnd() { float y_positions[] = { - -1, - 0.0, - 16.0 + -1.0f, + 0.0f, + 16.0f, + 32.0f, }; +#define END_AT 48.0f + u32 colours[] = { -1, 0x0000ffff, - 0xff0000ff + 0xff0000ff, + 0xffffffff, }; u32 col_5758[] = { 0x00ff00ff, 0xffff00ff, 0x00ffffff, - 0xf0ff0fff + 0xff00ffff }; void cppProcessHeap(u32 freeSize, u32 heapSize, int heapID, char *name) { @@ -113,13 +117,13 @@ void cppProcessHeap(u32 freeSize, u32 heapSize, int heapID, char *name) { GXBegin(GX_QUADS, GX_VTXFMT0, 16); for (int i = 0; i < 4; i++) { - GXPosition3f32(16*i, 32, 0.0); + GXPosition3f32(16*i, END_AT, 0.0); GXColor1u32(col_5758[i]); - GXPosition3f32(16*i+16, 32, 0.0); + GXPosition3f32(16*i+16, END_AT, 0.0); GXColor1u32(col_5758[i]); - GXPosition3f32(16*i+16, 48, 0.0); + GXPosition3f32(16*i+16, END_AT+16.0f, 0.0); GXColor1u32(col_5758[i]); - GXPosition3f32(16*i, 48, 0.0); + GXPosition3f32(16*i, END_AT+16.0f, 0.0); GXColor1u32(col_5758[i]); } @@ -129,13 +133,13 @@ void cppProcessHeap(u32 freeSize, u32 heapSize, int heapID, char *name) { if (Global5758 & (1 << i)) { GXBegin(GX_QUADS, GX_VTXFMT0, 4); - GXPosition3f32(16*i, 48, 0.0); + GXPosition3f32(16*i, END_AT+16.0f, 0.0); GXColor1u32(0xffffffff); - GXPosition3f32(16*i+16, 48, 0.0); + GXPosition3f32(16*i+16, END_AT+16.0f, 0.0); GXColor1u32(0xffffffff); - GXPosition3f32(16*i+16, 56, 0.0); + GXPosition3f32(16*i+16, END_AT+24.0f, 0.0); GXColor1u32(0xffffffff); - GXPosition3f32(16*i, 56, 0.0); + GXPosition3f32(16*i, END_AT+24.0f, 0.0); GXColor1u32(0xffffffff); GXEnd(); |