From 237bf72a2c4e4613ec49af1f58770d2fe71b4415 Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Tue, 21 Nov 2023 20:53:03 -0600 Subject: [PATCH 01/10] Start work on malloc.c --- config/GMPE01_00/splits.txt | 9 ++++++ config/GMPE01_00/symbols.txt | 56 +++++++++++++++++------------------ configure.py | 15 ++++++++++ include/functions.h | 11 +++++++ include/types.h | 1 + src/game/malloc.c | 57 ++++++++++++++++++++++++++++++++++++ 6 files changed, 121 insertions(+), 28 deletions(-) create mode 100644 src/game/malloc.c diff --git a/config/GMPE01_00/splits.txt b/config/GMPE01_00/splits.txt index 7e961f99..d864a28b 100644 --- a/config/GMPE01_00/splits.txt +++ b/config/GMPE01_00/splits.txt @@ -13,6 +13,15 @@ Sections: .sdata2 type:rodata .sbss2 type:bss +game/malloc.c: + .text start:0x8000A558 end:0x8000A938 + .data start:0x80121F50 end:0x80121FC8 + .bss start:0x80145A80 end:0x80145A98 + +game/memory.c: + .text start:0x8000A938 end:0x8000AEF0 + .data start:0x80121FC8 end:0x80122140 + Runtime.PPCEABI.H/global_destructor_chain.c: .text start:0x800E2008 end:0x800E2068 .dtors start:0x8011DCE8 end:0x8011DCEC diff --git a/config/GMPE01_00/symbols.txt b/config/GMPE01_00/symbols.txt index 7aeba886..d2905542 100644 --- a/config/GMPE01_00/symbols.txt +++ b/config/GMPE01_00/symbols.txt @@ -101,29 +101,29 @@ fn_8000A1A4 = .text:0x8000A1A4; // type:function size:0x6C fn_8000A210 = .text:0x8000A210; // type:function size:0x254 fn_8000A464 = .text:0x8000A464; // type:function size:0x74 fn_8000A4D8 = .text:0x8000A4D8; // type:function size:0x80 -fn_8000A558 = .text:0x8000A558; // type:function size:0x12C -fn_8000A684 = .text:0x8000A684; // type:function size:0x30 -fn_8000A6B4 = .text:0x8000A6B4; // type:function size:0x2C -fn_8000A6E0 = .text:0x8000A6E0; // type:function size:0x54 -fn_8000A734 = .text:0x8000A734; // type:function size:0x64 -fn_8000A798 = .text:0x8000A798; // type:function size:0x6C -fn_8000A804 = .text:0x8000A804; // type:function size:0x38 -fn_8000A83C = .text:0x8000A83C; // type:function size:0x54 -fn_8000A890 = .text:0x8000A890; // type:function size:0x3C -fn_8000A8CC = .text:0x8000A8CC; // type:function size:0x3C -fn_8000A908 = .text:0x8000A908; // type:function size:0x18 -fn_8000A920 = .text:0x8000A920; // type:function size:0x18 -fn_8000A938 = .text:0x8000A938; // type:function size:0x4C -fn_8000A984 = .text:0x8000A984; // type:function size:0x40 -fn_8000A9C4 = .text:0x8000A9C4; // type:function size:0x3C -fn_8000AA00 = .text:0x8000AA00; // type:function size:0x108 -fn_8000AB08 = .text:0x8000AB08; // type:function size:0x7C -fn_8000AB84 = .text:0x8000AB84; // type:function size:0x12C -fn_8000ACB0 = .text:0x8000ACB0; // type:function size:0x48 -fn_8000ACF8 = .text:0x8000ACF8; // type:function size:0x44 -fn_8000AD3C = .text:0x8000AD3C; // type:function size:0xC -fn_8000AD48 = .text:0x8000AD48; // type:function size:0x158 -fn_8000AEA0 = .text:0x8000AEA0; // type:function size:0x50 +HuMemInitAll = .text:0x8000A558; // type:function size:0x12C +HuMemInit = .text:0x8000A684; // type:function size:0x30 +HuMemDCFlushAll = .text:0x8000A6B4; // type:function size:0x2C +HuMemDCFlush = .text:0x8000A6E0; // type:function size:0x54 +HuMemDirectMalloc = .text:0x8000A734; // type:function size:0x64 +HuMemDirectMallocNum = .text:0x8000A798; // type:function size:0x6C +HuMemDirectFree = .text:0x8000A804; // type:function size:0x38 +HuMemDirectFreeNum = .text:0x8000A83C; // type:function size:0x54 +HuMemUsedMallocSizeGet = .text:0x8000A890; // type:function size:0x3C +HuMemUsedMallocBlockGet = .text:0x8000A8CC; // type:function size:0x3C +HuMemHeapSizeGet = .text:0x8000A908; // type:function size:0x18 +HuMemHeapPtrGet = .text:0x8000A920; // type:function size:0x18 +HuMemHeapInit = .text:0x8000A938; // type:function size:0x4C +HuMemMemoryAllocNum = .text:0x8000A984; // type:function size:0x40 +HuMemMemoryAlloc = .text:0x8000A9C4; // type:function size:0x3C +HuMemMemoryAlloc2 = .text:0x8000AA00; // type:function size:0x108 +HuMemMemoryFreeNum = .text:0x8000AB08; // type:function size:0x7C +HuMemMemoryFree = .text:0x8000AB84; // type:function size:0x12C +HuMemUsedMemorySizeGet = .text:0x8000ACB0; // type:function size:0x48 +HuMemUsedMemoryBlockGet = .text:0x8000ACF8; // type:function size:0x44 +HuMemMemoryAllocSizeGet = .text:0x8000AD3C; // type:function size:0xC +HuMemHeapDump = .text:0x8000AD48; // type:function size:0x158 +HuMemMemorySizeGet = .text:0x8000AEA0; // type:function size:0x50 fn_8000AEF0 = .text:0x8000AEF0; // type:function size:0x64 fn_8000AF54 = .text:0x8000AF54; // type:function size:0xA0 fn_8000AFF4 = .text:0x8000AFF4; // type:function size:0x15C @@ -2053,13 +2053,13 @@ OSCancelAlarm = .text:0x800B5008; // type:function size:0x11C DecrementerExceptionCallback = .text:0x800B5124; // type:function size:0x230 scope:local DecrementerExceptionHandler = .text:0x800B5354; // type:function size:0x50 scope:local fn_800B53A4 = .text:0x800B53A4; // type:function size:0xAC -fn_800B5450 = .text:0x800B5450; // type:function size:0xFC +OSAllocFromHeap = .text:0x800B5450; // type:function size:0xFC fn_800B554C = .text:0x800B554C; // type:function size:0x284 fn_800B57D0 = .text:0x800B57D0; // type:function size:0x7C OSSetCurrentHeap = .text:0x800B584C; // type:function size:0x10 OSInitAlloc = .text:0x800B585C; // type:function size:0x70 OSCreateHeap = .text:0x800B58CC; // type:function size:0x6C -fn_800B5938 = .text:0x800B5938; // type:function size:0x360 +OSCheckHeap = .text:0x800B5938; // type:function size:0x360 fn_800B5C98 = .text:0x800B5C98; // type:function size:0x104 OSGetArenaHi = .text:0x800B5D9C; // type:function size:0x8 scope:global OSGetArenaLo = .text:0x800B5DA4; // type:function size:0x8 scope:global @@ -4840,7 +4840,7 @@ lbl_8011FCBE = .data:0x8011FCBE; // type:object size:0x122 lbl_8011FDE0 = .data:0x8011FDE0; // type:object size:0x20 lbl_8011FE00 = .data:0x8011FE00; // type:object size:0x2000 lbl_80121E00 = .data:0x80121E00; // type:object size:0x150 -lbl_80121F50 = .data:0x80121F50; // type:object size:0x78 +HeapSizeTbl = .data:0x80121F50; // type:object size:0x78 scope:local lbl_80121FC8 = .data:0x80121FC8; // type:object size:0x50 lbl_80122018 = .data:0x80122018; // type:object size:0x128 fcoltbl = .data:0x80122140; // type:object size:0x40 @@ -5356,7 +5356,7 @@ RumbleData = .bss:0x80142810; // type:object size:0x30 ReadDataStat = .bss:0x80142840; // type:object size:0x2E00 data:4byte TextBuffer = .bss:0x80145640; // type:object size:0x400 lbl_80145A40 = .bss:0x80145A40; // type:object size:0x40 -lbl_80145A80 = .bss:0x80145A80; // type:object size:0x18 +HeapTbl = .bss:0x80145A80; // type:object size:0x14 scope:local lbl_80145A98 = .bss:0x80145A98; // type:object size:0x6800 lbl_8014C298 = .bss:0x8014C298; // type:object size:0x100 data:byte lbl_8014C398 = .bss:0x8014C398; // type:object size:0xF8 @@ -5840,7 +5840,7 @@ lbl_801D38B0 = .sdata:0x801D38B0; // type:object size:0x2 data:2byte lbl_801D38B2 = .sdata:0x801D38B2; // type:object size:0x2 data:2byte lbl_801D38B4 = .sdata:0x801D38B4; // type:object size:0x2 data:2byte lbl_801D38B6 = .sdata:0x801D38B6; // type:object size:0x2 data:2byte -lbl_801D38B8 = .sdata:0x801D38B8; // type:object size:0x8 data:4byte +__OSCurrHeap = .sdata:0x801D38B8; // type:object size:0x8 data:4byte __OSArenaLo = .sdata:0x801D38C0; // type:object size:0x4 scope:local data:4byte @32 = .sdata:0x801D38C8; // type:object size:0x2 scope:local data:string lbl_801D38D0 = .sdata:0x801D38D0; // type:object size:0x8 data:2byte diff --git a/configure.py b/configure.py index 74dfe46a..743ffead 100755 --- a/configure.py +++ b/configure.py @@ -177,6 +177,12 @@ cflags_rel = [ "-sdata2 0", ] +# Game flags +cflags_game = [ + *cflags_base, + "-O0,p", +] + config.linker_version = "GC/2.6" config.rel_strip_partial = False config.rel_empty_file = "REL/empty.c" @@ -210,6 +216,15 @@ NonMatching = False config.warn_missing_config = True config.warn_missing_source = False config.libs = [ + { + "lib": "Game", + "mw_version": config.linker_version, + "cflags": cflags_game, + "host": False, + "objects": [ + Object(NonMatching, "game/malloc.c"), + ], + }, { "lib": "Runtime.PPCEABI.H", "mw_version": config.linker_version, diff --git a/include/functions.h b/include/functions.h index 6d8168d0..e5091dc7 100644 --- a/include/functions.h +++ b/include/functions.h @@ -5,6 +5,9 @@ #include "common_structs.h" void OSReport(const char * format, ...); +void* OSAllocFromHeap(int heap, u32 size); +s32 OSCheckHeap(int heap); +void DCFlushRangeNoSync(void *addr, u32 size); void* HuPrcCreate(void (*), s32, s32, s32); void Hu3DBGColorSet(u8, u8, u8); void Hu3DCameraCreate(s16); @@ -18,4 +21,12 @@ void fn_80045F74(s16, s32); s32 fn_800578E4(void); void fn_1_26C(void); + +void HuMemInitAll(void); +void *HuMemInit(void *ptr, u32 size); +void HuMemDCFlush(int heap); + +void *HuMemHeapInit(void *ptr, u32 size); +void *HuMemMemoryAlloc(void *heap_ptr, u32 size, void *retaddr); + #endif \ No newline at end of file diff --git a/include/types.h b/include/types.h index 71c28167..388ebfcc 100644 --- a/include/types.h +++ b/include/types.h @@ -1,6 +1,7 @@ #ifndef _TYPES_H_ #define _TYPES_H_ +#define NULL ((void *)0) typedef unsigned char u8; typedef unsigned short u16; typedef unsigned long u32; diff --git a/src/game/malloc.c b/src/game/malloc.c new file mode 100644 index 00000000..a66f325b --- /dev/null +++ b/src/game/malloc.c @@ -0,0 +1,57 @@ +#include "common.h" + +extern int __OSCurrHeap; + +static u32 HeapSizeTbl[5] = { 0x240000, 0x140000, 0xA80000, 0x580000, 0x6B1C0 }; +static void *HeapTbl[5]; + +void HuMemInitAll(void) +{ + int i; + void *ptr; + u32 free_size; + for(i=0; i<4; i++) { + ptr = OSAllocFromHeap(__OSCurrHeap, HeapSizeTbl[i]); + if(ptr == NULL) { + OSReport("HuMem> Failed OSAlloc Size:%d\n", HeapSizeTbl[i]); + return; + } + HeapTbl[i] = HuMemInit(ptr, HeapSizeTbl[i]); + } + free_size = OSCheckHeap(__OSCurrHeap); + OSReport("HuMem> left memory space %dKB(%d)\n", free_size/1024, free_size); + ptr = OSAllocFromHeap(__OSCurrHeap, free_size); + if(ptr == NULL) { + OSReport("HuMem> Failed OSAlloc left space\n"); + return; + } + HeapTbl[4] = HuMemInit(ptr, free_size); + HeapSizeTbl[4] = free_size; +} + +void *HuMemInit(void *ptr, u32 size) +{ + return HuMemHeapInit(ptr, size); +} + + +void HuMemDCFlushAll() +{ + HuMemDCFlush(2); + HuMemDCFlush(0); +} + +void HuMemDCFlush(int heap) +{ + DCFlushRangeNoSync(HeapTbl[heap], HeapSizeTbl[heap]); +} + +void *HuMemDirectMalloc(int heap, u32 size) +{ + register void *retaddr; + asm { + mflr retaddr + } + size = (size+31) & 0xFFFFFFE0; + return HuMemMemoryAlloc(HeapTbl[heap], size, retaddr); +} From 33cc13b68725a2369dd75f18964cc3657ccfba40 Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Tue, 21 Nov 2023 21:06:39 -0600 Subject: [PATCH 02/10] Fully match malloc.c --- config/GMPE01_00/symbols.txt | 2 +- configure.py | 3 +- include/functions.h | 6 ++++ src/game/malloc.c | 53 ++++++++++++++++++++++++++++++++++-- 4 files changed, 60 insertions(+), 4 deletions(-) diff --git a/config/GMPE01_00/symbols.txt b/config/GMPE01_00/symbols.txt index d2905542..b41ce435 100644 --- a/config/GMPE01_00/symbols.txt +++ b/config/GMPE01_00/symbols.txt @@ -5952,7 +5952,7 @@ lbl_801D3B0C = .sbss:0x801D3B0C; // type:object size:0x4 data:4byte lbl_801D3B10 = .sbss:0x801D3B10; // type:object size:0x4 data:4byte lbl_801D3B14 = .sbss:0x801D3B14; // type:object size:0x4 data:4byte lbl_801D3B18 = .sbss:0x801D3B18; // type:object size:0x4 data:4byte -lbl_801D3B1C = .sbss:0x801D3B1C; // type:object size:0x4 data:4byte +currentHeapHandle = .sbss:0x801D3B1C; // type:object size:0x4 data:4byte lbl_801D3B20 = .sbss:0x801D3B20; // type:object size:0x8 data:4byte lbl_801D3B28 = .sbss:0x801D3B28; // type:object size:0x4 data:4byte lbl_801D3B2C = .sbss:0x801D3B2C; // type:object size:0x2 data:2byte diff --git a/configure.py b/configure.py index 743ffead..e0899cf8 100755 --- a/configure.py +++ b/configure.py @@ -222,7 +222,8 @@ config.libs = [ "cflags": cflags_game, "host": False, "objects": [ - Object(NonMatching, "game/malloc.c"), + Object(Matching, "game/malloc.c"), + Object(NonMatching, "game/memory.c"), ], }, { diff --git a/include/functions.h b/include/functions.h index e5091dc7..4ccdb727 100644 --- a/include/functions.h +++ b/include/functions.h @@ -28,5 +28,11 @@ void HuMemDCFlush(int heap); void *HuMemHeapInit(void *ptr, u32 size); void *HuMemMemoryAlloc(void *heap_ptr, u32 size, void *retaddr); +void *HuMemMemoryAllocNum(void *heap_ptr, u32 size, u32 num, void *retaddr); +void HuMemMemoryFree(void *ptr, void *retaddr); +void HuMemMemoryFreeNum(void *heap_ptr, u32 num, void *retaddr); +u32 HuMemUsedMemorySizeGet(void *heap_ptr); +u32 HuMemUsedMemoryBlockGet(void *heap_ptr); + #endif \ No newline at end of file diff --git a/src/game/malloc.c b/src/game/malloc.c index a66f325b..b3572691 100644 --- a/src/game/malloc.c +++ b/src/game/malloc.c @@ -1,8 +1,9 @@ #include "common.h" extern int __OSCurrHeap; +extern int currentHeapHandle; -static u32 HeapSizeTbl[5] = { 0x240000, 0x140000, 0xA80000, 0x580000, 0x6B1C0 }; +static u32 HeapSizeTbl[5] = { 0x240000, 0x140000, 0xA80000, 0x580000, 0 }; static void *HeapTbl[5]; void HuMemInitAll(void) @@ -18,7 +19,7 @@ void HuMemInitAll(void) } HeapTbl[i] = HuMemInit(ptr, HeapSizeTbl[i]); } - free_size = OSCheckHeap(__OSCurrHeap); + free_size = OSCheckHeap(currentHeapHandle); OSReport("HuMem> left memory space %dKB(%d)\n", free_size/1024, free_size); ptr = OSAllocFromHeap(__OSCurrHeap, free_size); if(ptr == NULL) { @@ -55,3 +56,51 @@ void *HuMemDirectMalloc(int heap, u32 size) size = (size+31) & 0xFFFFFFE0; return HuMemMemoryAlloc(HeapTbl[heap], size, retaddr); } + +void *HuMemDirectMallocNum(int heap, u32 size, u32 num) +{ + register void *retaddr; + asm { + mflr retaddr + } + size = (size+31) & 0xFFFFFFE0; + return HuMemMemoryAllocNum(HeapTbl[heap], size, num, retaddr); +} + +void HuMemDirectFree(void *ptr) +{ + register void *retaddr; + asm { + mflr retaddr + } + HuMemMemoryFree(ptr, retaddr); +} + +void HuMemDirectFreeNum(int heap, u32 num) +{ + register void *retaddr; + asm { + mflr retaddr + } + HuMemMemoryFreeNum(HeapTbl[heap], num, retaddr); +} + +u32 HuMemUsedMallocSizeGet(int heap) +{ + return HuMemUsedMemorySizeGet(HeapTbl[heap]); +} + +u32 HuMemUsedMallocBlockGet(int heap) +{ + return HuMemUsedMemoryBlockGet(HeapTbl[heap]); +} + +u32 HuMemHeapSizeGet(int heap) +{ + return HeapSizeTbl[heap]; +} + +void *HuMemHeapPtrGet(int heap) +{ + return HeapTbl[heap]; +} \ No newline at end of file From f6d4f74c25567f471c292f312af0f42ab29d27c8 Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Tue, 21 Nov 2023 21:22:21 -0600 Subject: [PATCH 03/10] Start work on memory.c --- config/GMPE01_00/symbols.txt | 2 +- configure.py | 2 +- include/functions.h | 17 +++++++++++---- src/game/malloc.c | 13 ++++++------ src/game/memory.c | 41 ++++++++++++++++++++++++++++++++++++ 5 files changed, 62 insertions(+), 13 deletions(-) create mode 100644 src/game/memory.c diff --git a/config/GMPE01_00/symbols.txt b/config/GMPE01_00/symbols.txt index b41ce435..f7429804 100644 --- a/config/GMPE01_00/symbols.txt +++ b/config/GMPE01_00/symbols.txt @@ -116,7 +116,7 @@ HuMemHeapPtrGet = .text:0x8000A920; // type:function size:0x18 HuMemHeapInit = .text:0x8000A938; // type:function size:0x4C HuMemMemoryAllocNum = .text:0x8000A984; // type:function size:0x40 HuMemMemoryAlloc = .text:0x8000A9C4; // type:function size:0x3C -HuMemMemoryAlloc2 = .text:0x8000AA00; // type:function size:0x108 +HuMemMemoryAlloc2 = .text:0x8000AA00; // type:function size:0x108 scope:local HuMemMemoryFreeNum = .text:0x8000AB08; // type:function size:0x7C HuMemMemoryFree = .text:0x8000AB84; // type:function size:0x12C HuMemUsedMemorySizeGet = .text:0x8000ACB0; // type:function size:0x48 diff --git a/configure.py b/configure.py index e0899cf8..c86dab57 100755 --- a/configure.py +++ b/configure.py @@ -223,7 +223,7 @@ config.libs = [ "host": False, "objects": [ Object(Matching, "game/malloc.c"), - Object(NonMatching, "game/memory.c"), + Object(Matching, "game/memory.c"), ], }, { diff --git a/include/functions.h b/include/functions.h index 4ccdb727..8de302eb 100644 --- a/include/functions.h +++ b/include/functions.h @@ -24,13 +24,22 @@ void fn_1_26C(void); void HuMemInitAll(void); void *HuMemInit(void *ptr, u32 size); +void HuMemDCFlushAll(); void HuMemDCFlush(int heap); +void *HuMemDirectMalloc(int heap, u32 size); +void *HuMemDirectMallocNum(int heap, u32 size, int num); +void HuMemDirectFree(void *ptr); +void HuMemDirectFreeNum(int heap, int num); +u32 HuMemUsedMallocSizeGet(int heap); +u32 HuMemUsedMallocBlockGet(int heap); +u32 HuMemHeapSizeGet(int heap); +void *HuMemHeapPtrGet(int heap); void *HuMemHeapInit(void *ptr, u32 size); -void *HuMemMemoryAlloc(void *heap_ptr, u32 size, void *retaddr); -void *HuMemMemoryAllocNum(void *heap_ptr, u32 size, u32 num, void *retaddr); -void HuMemMemoryFree(void *ptr, void *retaddr); -void HuMemMemoryFreeNum(void *heap_ptr, u32 num, void *retaddr); +void *HuMemMemoryAlloc(void *heap_ptr, u32 size, u32 retaddr); +void *HuMemMemoryAllocNum(void *heap_ptr, u32 size, int num, u32 retaddr); +void HuMemMemoryFree(void *ptr, u32 retaddr); +void HuMemMemoryFreeNum(void *heap_ptr, int num, u32 retaddr); u32 HuMemUsedMemorySizeGet(void *heap_ptr); u32 HuMemUsedMemoryBlockGet(void *heap_ptr); diff --git a/src/game/malloc.c b/src/game/malloc.c index b3572691..4c466b02 100644 --- a/src/game/malloc.c +++ b/src/game/malloc.c @@ -35,7 +35,6 @@ void *HuMemInit(void *ptr, u32 size) return HuMemHeapInit(ptr, size); } - void HuMemDCFlushAll() { HuMemDCFlush(2); @@ -49,7 +48,7 @@ void HuMemDCFlush(int heap) void *HuMemDirectMalloc(int heap, u32 size) { - register void *retaddr; + register u32 retaddr; asm { mflr retaddr } @@ -57,9 +56,9 @@ void *HuMemDirectMalloc(int heap, u32 size) return HuMemMemoryAlloc(HeapTbl[heap], size, retaddr); } -void *HuMemDirectMallocNum(int heap, u32 size, u32 num) +void *HuMemDirectMallocNum(int heap, u32 size, int num) { - register void *retaddr; + register u32 retaddr; asm { mflr retaddr } @@ -69,16 +68,16 @@ void *HuMemDirectMallocNum(int heap, u32 size, u32 num) void HuMemDirectFree(void *ptr) { - register void *retaddr; + register u32 retaddr; asm { mflr retaddr } HuMemMemoryFree(ptr, retaddr); } -void HuMemDirectFreeNum(int heap, u32 num) +void HuMemDirectFreeNum(int heap, int num) { - register void *retaddr; + register u32 retaddr; asm { mflr retaddr } diff --git a/src/game/memory.c b/src/game/memory.c new file mode 100644 index 00000000..1b1576f3 --- /dev/null +++ b/src/game/memory.c @@ -0,0 +1,41 @@ +#include "common.h" + +struct memory_block { + u32 size; + u8 magic; + u8 flag; + struct memory_block *prev; + struct memory_block *next; + int num; + u32 retaddr; +}; + +static void *HuMemMemoryAlloc2(void *heap_ptr, u32 size, int num, u32 retaddr); + +void *HuMemHeapInit(void *ptr, u32 size) +{ + struct memory_block *block = ptr; + block->size = size; + block->magic = 205; + block->flag = 0; + block->prev = block; + block->next = block; + block->num = -256; + block->retaddr = 0xCDCDCDCD; + return block; +} + +void *HuMemMemoryAllocNum(void *heap_ptr, u32 size, int num, u32 retaddr) +{ + return HuMemMemoryAlloc2(heap_ptr, size, num, retaddr); +} + +void *HuMemMemoryAlloc(void *heap_ptr, u32 size, u32 retaddr) +{ + return HuMemMemoryAlloc2(heap_ptr, size, -256, retaddr); +} + +static void *HuMemMemoryAlloc2(void *heap_ptr, u32 size, int num, u32 retaddr) +{ + +} \ No newline at end of file From 66f6f65899f8d4be0071d9178e0f9f587520abdf Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Tue, 21 Nov 2023 22:15:51 -0600 Subject: [PATCH 04/10] Finish all but HuMemHeapDump HuMemHeapDump has some regallloc problems --- include/functions.h | 27 ++++--- src/game/malloc.c | 12 +-- src/game/memory.c | 179 ++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 192 insertions(+), 26 deletions(-) diff --git a/include/functions.h b/include/functions.h index 8de302eb..29afc607 100644 --- a/include/functions.h +++ b/include/functions.h @@ -23,25 +23,28 @@ void fn_1_26C(void); void HuMemInitAll(void); -void *HuMemInit(void *ptr, u32 size); +void *HuMemInit(void *ptr, s32 size); void HuMemDCFlushAll(); void HuMemDCFlush(int heap); -void *HuMemDirectMalloc(int heap, u32 size); -void *HuMemDirectMallocNum(int heap, u32 size, int num); +void *HuMemDirectMalloc(int heap, s32 size); +void *HuMemDirectMallocNum(int heap, s32 size, u32 num); void HuMemDirectFree(void *ptr); -void HuMemDirectFreeNum(int heap, int num); -u32 HuMemUsedMallocSizeGet(int heap); -u32 HuMemUsedMallocBlockGet(int heap); +void HuMemDirectFreeNum(int heap, u32 num); +s32 HuMemUsedMallocSizeGet(int heap); +s32 HuMemUsedMallocBlockGet(int heap); u32 HuMemHeapSizeGet(int heap); void *HuMemHeapPtrGet(int heap); -void *HuMemHeapInit(void *ptr, u32 size); -void *HuMemMemoryAlloc(void *heap_ptr, u32 size, u32 retaddr); -void *HuMemMemoryAllocNum(void *heap_ptr, u32 size, int num, u32 retaddr); +void *HuMemHeapInit(void *ptr, s32 size); +void *HuMemMemoryAlloc(void *heap_ptr, s32 size, u32 retaddr); +void *HuMemMemoryAllocNum(void *heap_ptr, s32 size, u32 num, u32 retaddr); void HuMemMemoryFree(void *ptr, u32 retaddr); -void HuMemMemoryFreeNum(void *heap_ptr, int num, u32 retaddr); -u32 HuMemUsedMemorySizeGet(void *heap_ptr); -u32 HuMemUsedMemoryBlockGet(void *heap_ptr); +void HuMemMemoryFreeNum(void *heap_ptr, u32 num, u32 retaddr); +s32 HuMemUsedMemorySizeGet(void *heap_ptr); +s32 HuMemUsedMemoryBlockGet(void *heap_ptr); +s32 HuMemMemoryAllocSizeGet(s32 size); +void HuMemHeapDump(void *heap_ptr, s16 status); + #endif \ No newline at end of file diff --git a/src/game/malloc.c b/src/game/malloc.c index 4c466b02..08910376 100644 --- a/src/game/malloc.c +++ b/src/game/malloc.c @@ -30,7 +30,7 @@ void HuMemInitAll(void) HeapSizeTbl[4] = free_size; } -void *HuMemInit(void *ptr, u32 size) +void *HuMemInit(void *ptr, s32 size) { return HuMemHeapInit(ptr, size); } @@ -46,7 +46,7 @@ void HuMemDCFlush(int heap) DCFlushRangeNoSync(HeapTbl[heap], HeapSizeTbl[heap]); } -void *HuMemDirectMalloc(int heap, u32 size) +void *HuMemDirectMalloc(int heap, s32 size) { register u32 retaddr; asm { @@ -56,7 +56,7 @@ void *HuMemDirectMalloc(int heap, u32 size) return HuMemMemoryAlloc(HeapTbl[heap], size, retaddr); } -void *HuMemDirectMallocNum(int heap, u32 size, int num) +void *HuMemDirectMallocNum(int heap, s32 size, u32 num) { register u32 retaddr; asm { @@ -75,7 +75,7 @@ void HuMemDirectFree(void *ptr) HuMemMemoryFree(ptr, retaddr); } -void HuMemDirectFreeNum(int heap, int num) +void HuMemDirectFreeNum(int heap, u32 num) { register u32 retaddr; asm { @@ -84,12 +84,12 @@ void HuMemDirectFreeNum(int heap, int num) HuMemMemoryFreeNum(HeapTbl[heap], num, retaddr); } -u32 HuMemUsedMallocSizeGet(int heap) +s32 HuMemUsedMallocSizeGet(int heap) { return HuMemUsedMemorySizeGet(HeapTbl[heap]); } -u32 HuMemUsedMallocBlockGet(int heap) +s32 HuMemUsedMallocBlockGet(int heap) { return HuMemUsedMemoryBlockGet(HeapTbl[heap]); } diff --git a/src/game/memory.c b/src/game/memory.c index 1b1576f3..15dfb908 100644 --- a/src/game/memory.c +++ b/src/game/memory.c @@ -1,18 +1,23 @@ #include "common.h" +#define DATA_GET_BLOCK(ptr) ((struct memory_block *)(((char *)(ptr))-32)) +#define BLOCK_GET_DATA(block) (((char *)(block))+32) + +#define MEM_ALLOC_SIZE(size) (((size)+63) & 0xFFFFFFE0) + struct memory_block { - u32 size; + s32 size; u8 magic; u8 flag; struct memory_block *prev; struct memory_block *next; - int num; + u32 num; u32 retaddr; }; -static void *HuMemMemoryAlloc2(void *heap_ptr, u32 size, int num, u32 retaddr); +static void *HuMemMemoryAlloc2(void *heap_ptr, s32 size, u32 num, u32 retaddr); -void *HuMemHeapInit(void *ptr, u32 size) +void *HuMemHeapInit(void *ptr, s32 size) { struct memory_block *block = ptr; block->size = size; @@ -25,17 +30,175 @@ void *HuMemHeapInit(void *ptr, u32 size) return block; } -void *HuMemMemoryAllocNum(void *heap_ptr, u32 size, int num, u32 retaddr) +void *HuMemMemoryAllocNum(void *heap_ptr, s32 size, u32 num, u32 retaddr) { return HuMemMemoryAlloc2(heap_ptr, size, num, retaddr); } -void *HuMemMemoryAlloc(void *heap_ptr, u32 size, u32 retaddr) +void *HuMemMemoryAlloc(void *heap_ptr, s32 size, u32 retaddr) { return HuMemMemoryAlloc2(heap_ptr, size, -256, retaddr); } -static void *HuMemMemoryAlloc2(void *heap_ptr, u32 size, int num, u32 retaddr) +static void *HuMemMemoryAlloc2(void *heap_ptr, s32 size, u32 num, u32 retaddr) { + s32 alloc_size = MEM_ALLOC_SIZE(size); + struct memory_block *block = heap_ptr; + do { + if(!block->flag && block->size >= alloc_size) { + if(block->size-alloc_size > 32u) { + struct memory_block *new_block = (struct memory_block *)(((u32)block)+alloc_size); + new_block->size = block->size-alloc_size; + new_block->magic = 205; + new_block->flag = 0; + new_block->retaddr = retaddr; + block->next->prev = new_block; + new_block->next = block->next; + block->next = new_block; + new_block->prev = block; + block->size = alloc_size; + } + block->flag = 1; + block->magic = 165; + block->num = num; + block->retaddr = retaddr; + return BLOCK_GET_DATA(block); + } + block = block->next; + } while(block != heap_ptr); + OSReport("HuMem>memory alloc error %08x(%08X): Call %08x\n", size, num, retaddr); + HuMemHeapDump(heap_ptr, -1); + return NULL; +} + +void HuMemMemoryFreeNum(void *heap_ptr, u32 num, u32 retaddr) +{ + struct memory_block *block = heap_ptr; + do { + struct memory_block *block_next = block->next; + if(block->flag && block->num == num) { + HuMemMemoryFree(BLOCK_GET_DATA(block), retaddr); + } + block = block_next; + } while(block != heap_ptr); -} \ No newline at end of file +} + +static void HuMemTailMemoryAlloc2() //Required for string literal +{ + OSReport("memory allocation(tail) error.\n"); +} + +void HuMemMemoryFree(void *ptr, u32 retaddr) +{ + struct memory_block *block; + if(!ptr) { + return; + } + block = DATA_GET_BLOCK(ptr); + if(block->magic != 165) { + OSReport("HuMem>memory free error. %08x( call %08x)\n", ptr, retaddr); + return; + } + if(block->prev < block && !block->prev->flag) { + block->flag = 0; + block->magic = 205; + block->next->prev = block->prev; + block->prev->next = block->next; + block->prev->size += block->size; + block = block->prev; + } + if(block->next > block && !block->next->flag) { + block->next->next->prev = block; + block->size += block->next->size; + block->next = block->next->next; + } + block->flag = 0; + block->magic = 205; + block->retaddr = retaddr; +} + +s32 HuMemUsedMemorySizeGet(void *heap_ptr) +{ + struct memory_block *block = heap_ptr; + s32 size = 0; + do { + if(block->flag == 1) { + size += block->size; + } + block = block->next; + } while(block != heap_ptr); + return size; +} + +s32 HuMemUsedMemoryBlockGet(void *heap_ptr) +{ + struct memory_block *block = heap_ptr; + s32 num_blocks = 0; + do { + if(block->flag == 1) { + num_blocks++; + } + block = block->next; + } while(block != heap_ptr); + return num_blocks; +} + +s32 HuMemMemoryAllocSizeGet(s32 size) +{ + return MEM_ALLOC_SIZE(size); +} + +void HuMemHeapDump(void *heap_ptr, s16 status) +{ + u8 dump_type; + s32 size, inactive_size; + s32 num_unused_blocks, num_blocks; + struct memory_block *block = heap_ptr; + size = 0; + inactive_size = 0; + num_blocks = 0; + num_unused_blocks = 0; + + if(status < 0) { + dump_type = 10; + } else if(status == 0) { + dump_type = 0; + } else { + dump_type = 1; + } + OSReport("======== HuMem heap dump %08x ========\n", heap_ptr); + OSReport("MCB-----+Size----+MG+FL+Prev----+Next----+UNum----+Body----+Call----\n"); + do { + if(dump_type == 10 || block->flag == dump_type) { + OSReport("%08x %08x %02x %02x %08x %08x %08x %08x %08x\n", block, block->size, block->magic, block->flag, + block->prev, block->next, block->num, BLOCK_GET_DATA(block), block->retaddr); + } + if(block->flag == 1) { + size += block->size; + num_blocks++; + } else { + inactive_size += block->size; + num_unused_blocks++; + } + + block = block->next; + } while(block != heap_ptr); + OSReport("MCB:%d(%d/%d) MEM:%08x(%08x/%08x)\n", num_blocks+num_unused_blocks, num_blocks, num_unused_blocks, + size+inactive_size, size, inactive_size); + OSReport("======== HuMem heap dump %08x end =====\n", heap_ptr); +} + +s32 HuMemMemorySizeGet(void *ptr) +{ + struct memory_block *block; + if(!ptr) { + return 0; + } + block = DATA_GET_BLOCK(ptr); + if(block->flag == 1 && block->magic == 165) { + return block->size-32; + } else { + return 0; + } +} From c059fed81545b4d3e598c2f7d15d6c9e58921c25 Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Tue, 21 Nov 2023 22:19:25 -0600 Subject: [PATCH 05/10] Match memory.c --- config/GMPE01_00/symbols.txt | 2 +- src/game/memory.c | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/config/GMPE01_00/symbols.txt b/config/GMPE01_00/symbols.txt index f7429804..7b255f4e 100644 --- a/config/GMPE01_00/symbols.txt +++ b/config/GMPE01_00/symbols.txt @@ -4843,7 +4843,7 @@ lbl_80121E00 = .data:0x80121E00; // type:object size:0x150 HeapSizeTbl = .data:0x80121F50; // type:object size:0x78 scope:local lbl_80121FC8 = .data:0x80121FC8; // type:object size:0x50 lbl_80122018 = .data:0x80122018; // type:object size:0x128 -fcoltbl = .data:0x80122140; // type:object size:0x40 +fcoltbl = .data:0x80122140; // type:object size:0x40 align:32 lbl_80122180 = .data:0x80122180; // type:object size:0x1F data:string lbl_8012219F = .data:0x8012219F; // type:object size:0x31 lbl_801221D0 = .data:0x801221D0; // type:object size:0x12 diff --git a/src/game/memory.c b/src/game/memory.c index 15dfb908..990c70db 100644 --- a/src/game/memory.c +++ b/src/game/memory.c @@ -151,15 +151,13 @@ s32 HuMemMemoryAllocSizeGet(s32 size) void HuMemHeapDump(void *heap_ptr, s16 status) { - u8 dump_type; - s32 size, inactive_size; - s32 num_unused_blocks, num_blocks; struct memory_block *block = heap_ptr; - size = 0; - inactive_size = 0; - num_blocks = 0; - num_unused_blocks = 0; - + s32 size = 0; + s32 inactive_size = 0; + s32 num_blocks = 0; + s32 num_unused_blocks = 0; + u8 dump_type; + if(status < 0) { dump_type = 10; } else if(status == 0) { From 2e6017ef9309d6c5aa44d0eda700c3bde8a4ef25 Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Wed, 22 Nov 2023 08:18:05 -0600 Subject: [PATCH 06/10] Split and Add Symbols to Sprite Translation Units --- config/GMPE01_00/splits.txt | 17 ++++++ config/GMPE01_00/symbols.txt | 114 +++++++++++++++++------------------ configure.py | 2 + 3 files changed, 76 insertions(+), 57 deletions(-) diff --git a/config/GMPE01_00/splits.txt b/config/GMPE01_00/splits.txt index d864a28b..4798b47f 100644 --- a/config/GMPE01_00/splits.txt +++ b/config/GMPE01_00/splits.txt @@ -22,6 +22,23 @@ game/memory.c: .text start:0x8000A938 end:0x8000AEF0 .data start:0x80121FC8 end:0x80122140 +game/sprman.c: + .text start:0x8000D348 end:0x8000F6A0 + .rodata start:0x8011DD00 end:0x8011DD10 + .data start:0x801221D0 end:0x801222F0 + .bss start:0x8014C490 end:0x8015C690 + .sdata start:0x801D3460 end:0x801D3470 + .sbss start:0x801D3B48 end:0x801D3B50 + .sdata2 start:0x801D49C8 end:0x801D49F0 + +game/sprput.c: + .text start:0x8000F6A0 end:0x80010B30 + .rodata start:0x8011DD10 end:0x8011DD20 + .data start:0x801222F0 end:0x80122320 + .bss start:0x8015C690 end:0x8015C6C0 + .sbss start:0x801D3B50 end:0x801D3B58 + .sdata2 start:0x801D49F0 end:0x801D4A28 + Runtime.PPCEABI.H/global_destructor_chain.c: .text start:0x800E2008 end:0x800E2068 .dtors start:0x8011DCE8 end:0x8011DCEC diff --git a/config/GMPE01_00/symbols.txt b/config/GMPE01_00/symbols.txt index 7b255f4e..146d27ca 100644 --- a/config/GMPE01_00/symbols.txt +++ b/config/GMPE01_00/symbols.txt @@ -153,53 +153,53 @@ fn_8000D21C = .text:0x8000D21C; // type:function size:0x10 fn_8000D22C = .text:0x8000D22C; // type:function size:0x14 fn_8000D240 = .text:0x8000D240; // type:function size:0x84 fn_8000D2C4 = .text:0x8000D2C4; // type:function size:0x84 -fn_8000D348 = .text:0x8000D348; // type:function size:0xA0 -fn_8000D3E8 = .text:0x8000D3E8; // type:function size:0xB0 -fn_8000D498 = .text:0x8000D498; // type:function size:0x64 -fn_8000D4FC = .text:0x8000D4FC; // type:function size:0x188 -fn_8000D684 = .text:0x8000D684; // type:function size:0x14C -fn_8000D7D0 = .text:0x8000D7D0; // type:function size:0xF4 -fn_8000D8C4 = .text:0x8000D8C4; // type:function size:0x458 -fn_8000DD1C = .text:0x8000DD1C; // type:function size:0x8 -fn_8000DD24 = .text:0x8000DD24; // type:function size:0x114 -fn_8000DE38 = .text:0x8000DE38; // type:function size:0x10 -fn_8000DE48 = .text:0x8000DE48; // type:function size:0x128 -fn_8000DF70 = .text:0x8000DF70; // type:function size:0x188 -fn_8000E0F8 = .text:0x8000E0F8; // type:function size:0xF4 -fn_8000E1EC = .text:0x8000E1EC; // type:function size:0x334 -fn_8000E520 = .text:0x8000E520; // type:function size:0x8C -fn_8000E5AC = .text:0x8000E5AC; // type:function size:0xAC -fn_8000E658 = .text:0x8000E658; // type:function size:0x9C -fn_8000E6F4 = .text:0x8000E6F4; // type:function size:0x84 -fn_8000E778 = .text:0x8000E778; // type:function size:0x90 -fn_8000E808 = .text:0x8000E808; // type:function size:0xAC -fn_8000E8B4 = .text:0x8000E8B4; // type:function size:0xAC -fn_8000E960 = .text:0x8000E960; // type:function size:0x60 -fn_8000E9C0 = .text:0x8000E9C0; // type:function size:0x5C -fn_8000EA1C = .text:0x8000EA1C; // type:function size:0x60 -fn_8000EA7C = .text:0x8000EA7C; // type:function size:0x64 -fn_8000EAE0 = .text:0x8000EAE0; // type:function size:0x64 -fn_8000EB44 = .text:0x8000EB44; // type:function size:0x4C -fn_8000EB90 = .text:0x8000EB90; // type:function size:0xF0 -fn_8000EC80 = .text:0x8000EC80; // type:function size:0x9C -fn_8000ED1C = .text:0x8000ED1C; // type:function size:0x9C -fn_8000EDB8 = .text:0x8000EDB8; // type:function size:0x98 -fn_8000EE50 = .text:0x8000EE50; // type:function size:0x9C -fn_8000EEEC = .text:0x8000EEEC; // type:function size:0xC0 -fn_8000EFAC = .text:0x8000EFAC; // type:function size:0x8C -fn_8000F038 = .text:0x8000F038; // type:function size:0x50 -fn_8000F088 = .text:0x8000F088; // type:function size:0x4C -fn_8000F0D4 = .text:0x8000F0D4; // type:function size:0xAC -fn_8000F180 = .text:0x8000F180; // type:function size:0x58 -fn_8000F1D8 = .text:0x8000F1D8; // type:function size:0x1FC -fn_8000F3D4 = .text:0x8000F3D4; // type:function size:0x68 -fn_8000F43C = .text:0x8000F43C; // type:function size:0x50 -fn_8000F48C = .text:0x8000F48C; // type:function size:0x214 -fn_8000F6A0 = .text:0x8000F6A0; // type:function size:0x158 -fn_8000F7F8 = .text:0x8000F7F8; // type:function size:0xECC -fn_800106C4 = .text:0x800106C4; // type:function size:0x29C -fn_80010960 = .text:0x80010960; // type:function size:0x58 -fn_800109B8 = .text:0x800109B8; // type:function size:0x178 +HuSprInit = .text:0x8000D348; // type:function size:0xA0 +HuSprClose = .text:0x8000D3E8; // type:function size:0xB0 +HuSprExec = .text:0x8000D498; // type:function size:0x64 +HuSprBegin = .text:0x8000D4FC; // type:function size:0x188 +HuSprOrderEntry = .text:0x8000D684; // type:function size:0x14C +HuSprCall = .text:0x8000D7D0; // type:function size:0xF4 +HuSprFinish = .text:0x8000D8C4; // type:function size:0x458 +HuSprPauseSet = .text:0x8000DD1C; // type:function size:0x8 +HuSprAnimRead = .text:0x8000DD24; // type:function size:0x114 +HuSprAnimLock = .text:0x8000DE38; // type:function size:0x10 +HuSprCreate = .text:0x8000DE48; // type:function size:0x128 +HuSprFuncCreate = .text:0x8000DF70; // type:function size:0x188 +HuSprGrpCreate = .text:0x8000E0F8; // type:function size:0xF4 +HuSprGrpCopy = .text:0x8000E1EC; // type:function size:0x334 +HuSprGrpMemberSet = .text:0x8000E520; // type:function size:0x8C +HuSprGrpMemberKill = .text:0x8000E5AC; // type:function size:0xAC +HuSprGrpKill = .text:0x8000E658; // type:function size:0x9C +HuSprKill = .text:0x8000E6F4; // type:function size:0x84 +HuSprAnimKill = .text:0x8000E778; // type:function size:0x90 +HuSprAttrSet = .text:0x8000E808; // type:function size:0xAC +HuSprAttrReset = .text:0x8000E8B4; // type:function size:0xAC +HuSprPosSet = .text:0x8000E960; // type:function size:0x60 +HuSprZRotSet = .text:0x8000E9C0; // type:function size:0x5C +HuSprScaleSet = .text:0x8000EA1C; // type:function size:0x60 +HuSprTPLvlSet = .text:0x8000EA7C; // type:function size:0x64 +HuSprColorSet = .text:0x8000EAE0; // type:function size:0x64 +HuSprSpeedSet = .text:0x8000EB44; // type:function size:0x4C +HuSprBankSet = .text:0x8000EB90; // type:function size:0xF0 +HuSprGrpPosSet = .text:0x8000EC80; // type:function size:0x9C +HuSprGrpCenterSet = .text:0x8000ED1C; // type:function size:0x9C +HuSprGrpZRotSet = .text:0x8000EDB8; // type:function size:0x98 +HuSprGrpScaleSet = .text:0x8000EE50; // type:function size:0x9C +HuSprGrpTPLvlSet = .text:0x8000EEEC; // type:function size:0xC0 +HuSprGrpDrawNoSet = .text:0x8000EFAC; // type:function size:0x8C +HuSprDrawNoSet = .text:0x8000F038; // type:function size:0x50 +HuSprPriSet = .text:0x8000F088; // type:function size:0x4C +HuSprGrpScissorSet = .text:0x8000F0D4; // type:function size:0xAC +HuSprScissorSet = .text:0x8000F180; // type:function size:0x58 +HuSprAnimMake = .text:0x8000F1D8; // type:function size:0x1FC +HuSprBGSet = .text:0x8000F3D4; // type:function size:0x68 +HuSprSprBGSet = .text:0x8000F43C; // type:function size:0x50 +AnimDebug = .text:0x8000F48C; // type:function size:0x214 +HuSprDispInit = .text:0x8000F6A0; // type:function size:0x158 +HuSprDisp = .text:0x8000F7F8; // type:function size:0xECC +HuSprTexLoad = .text:0x800106C4; // type:function size:0x29C +HuSprExecLayerSet = .text:0x80010960; // type:function size:0x58 +HuSprLayerHook = .text:0x800109B8; // type:function size:0x178 fn_80010B30 = .text:0x80010B30; // type:function size:0xB0 fn_80010BE0 = .text:0x80010BE0; // type:function size:0xA0 fn_80010C80 = .text:0x80010C80; // type:function size:0xC8 @@ -4847,7 +4847,7 @@ fcoltbl = .data:0x80122140; // type:object size:0x40 align:32 lbl_80122180 = .data:0x80122180; // type:object size:0x1F data:string lbl_8012219F = .data:0x8012219F; // type:object size:0x31 lbl_801221D0 = .data:0x801221D0; // type:object size:0x12 -lbl_801221E2 = .data:0x801221E2; // type:object size:0x10E +bitSizeTbl = .data:0x801221E2; // type:object size:0x10E scope:local jumptable_801222F0 = .data:0x801222F0; // type:object size:0x2C scope:local jumptable_80122320 = .data:0x80122320; // type:object size:0x28 scope:local jumptable_80122348 = .data:0x80122348; // type:object size:0x2C scope:local @@ -5360,11 +5360,11 @@ HeapTbl = .bss:0x80145A80; // type:object size:0x14 scope:local lbl_80145A98 = .bss:0x80145A98; // type:object size:0x6800 lbl_8014C298 = .bss:0x8014C298; // type:object size:0x100 data:byte lbl_8014C398 = .bss:0x8014C398; // type:object size:0xF8 -lbl_8014C490 = .bss:0x8014C490; // type:object size:0x9600 -lbl_80155A90 = .bss:0x80155A90; // type:object size:0x5400 data:2byte -lbl_8015AE90 = .bss:0x8015AE90; // type:object size:0x1800 -lbl_8015C690 = .bss:0x8015C690; // type:object size:0x20 -lbl_8015C6B0 = .bss:0x8015C6B0; // type:object size:0x10 +HuSprData = .bss:0x8014C490; // type:object size:0x9600 +HuSprGrpData = .bss:0x80155A90; // type:object size:0x5400 data:2byte +HuSprOrder = .bss:0x8015AE90; // type:object size:0x1800 +bmpNoCC = .bss:0x8015C690; // type:object size:0x20 +HuSprLayerDrawNo = .bss:0x8015C6B0; // type:object size:0x10 lbl_8015C6C0 = .bss:0x8015C6C0; // type:object size:0x80 lbl_8015C740 = .bss:0x8015C740; // type:object size:0x240 lbl_8015C980 = .bss:0x8015C980; // type:object size:0x300 data:byte @@ -5962,10 +5962,10 @@ lbl_801D3B38 = .sbss:0x801D3B38; // type:object size:0x4 data:4byte lbl_801D3B3C = .sbss:0x801D3B3C; // type:object size:0x2 data:2byte lbl_801D3B40 = .sbss:0x801D3B40; // type:object size:0x4 data:4byte lbl_801D3B44 = .sbss:0x801D3B44; // type:object size:0x4 data:4byte -lbl_801D3B48 = .sbss:0x801D3B48; // type:object size:0x4 data:4byte -lbl_801D3B4C = .sbss:0x801D3B4C; // type:object size:0x2 data:2byte -lbl_801D3B4E = .sbss:0x801D3B4E; // type:object size:0x2 data:2byte -lbl_801D3B50 = .sbss:0x801D3B50; // type:object size:0x8 data:2byte +HuSprPauseF = .sbss:0x801D3B48; // type:object size:0x4 data:4byte +HuSprOrderNo = .sbss:0x801D3B4C; // type:object size:0x2 data:2byte +HuSprOrderNum = .sbss:0x801D3B4E; // type:object size:0x2 data:2byte +bmpCCIdx = .sbss:0x801D3B50; // type:object size:0x8 data:2byte lbl_801D3B58 = .sbss:0x801D3B58; // type:object size:0x4 data:4byte lbl_801D3B5C = .sbss:0x801D3B5C; // type:object size:0x4 data:4byte lbl_801D3B60 = .sbss:0x801D3B60; // type:object size:0x4 data:4byte diff --git a/configure.py b/configure.py index c86dab57..7a49715c 100755 --- a/configure.py +++ b/configure.py @@ -224,6 +224,8 @@ config.libs = [ "objects": [ Object(Matching, "game/malloc.c"), Object(Matching, "game/memory.c"), + Object(NonMatching, "game/sprman.c"), + Object(NonMatching, "game/sprput.c"), ], }, { From 3e16f215683c2a7d98f51a58fbb262fbd05f435c Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Wed, 22 Nov 2023 08:59:27 -0600 Subject: [PATCH 07/10] Split early translation units --- config/GMPE01_00/splits.txt | 19 +++++ config/GMPE01_00/symbols.txt | 112 ++++++++++++++-------------- configure.py | 3 + src/REL/_minigameDLL/_minigameDLL.c | 2 +- 4 files changed, 79 insertions(+), 57 deletions(-) diff --git a/config/GMPE01_00/splits.txt b/config/GMPE01_00/splits.txt index 4798b47f..4ed757b3 100644 --- a/config/GMPE01_00/splits.txt +++ b/config/GMPE01_00/splits.txt @@ -13,6 +13,25 @@ Sections: .sdata2 type:rodata .sbss2 type:bss +game/main.c: + .text start:0x800057C0 end:0x80005A5C + .data start:0x8011EDE0 end:0x8011EDF0 + .sdata start:0x801D3420 end:0x801D3430 + .sbss start:0x801D3A00 end:0x801D3A58 + .sdata2 start:0x801D4960 end:0x801D4968 + +game/pad.c: + .text start:0x80005A5C end:0x80006478 + .data start:0x8011EDF0 end:0x8011EE00 + .bss start:0x80142800 end:0x80142840 + .sbss start:0x801D3A58 end:0x801D3AE0 + +game/dvd.c: + .text start:0x80006478 end:0x80006E38 + .data start:0x8011EE00 end:0x8011EF58 + .sdata start:0x801D3430 end:0x801D3438 + .sbss start:0x801D3AE0 end:0x801D3AE8 + game/malloc.c: .text start:0x8000A558 end:0x8000A938 .data start:0x80121F50 end:0x80121FC8 diff --git a/config/GMPE01_00/symbols.txt b/config/GMPE01_00/symbols.txt index 146d27ca..37fd31ed 100644 --- a/config/GMPE01_00/symbols.txt +++ b/config/GMPE01_00/symbols.txt @@ -44,27 +44,27 @@ _bss_init_info = .init:0x800055F0; // type:object size:0x20 scope:global data:4b @eti_80005790 = extabindex:0x80005790; // type:object size:0xC scope:local hidden _eti_init_info = extabindex:0x8000579C; // type:object size:0x20 scope:global main = .text:0x800057C0; // type:function size:0x22C scope:global -fn_800059EC = .text:0x800059EC; // type:function size:0x38 -fn_80005A24 = .text:0x80005A24; // type:function size:0xC -fn_80005A30 = .text:0x80005A30; // type:function size:0x2C -fn_80005A5C = .text:0x80005A5C; // type:function size:0xF0 -fn_80005B4C = .text:0x80005B4C; // type:function size:0x168 -fn_80005CB4 = .text:0x80005CB4; // type:function size:0x440 -fn_800060F4 = .text:0x800060F4; // type:function size:0x234 -HuPadRumbleAllStop = .text:0x80006328; // type:function size:0x54 -fn_8000637C = .text:0x8000637C; // type:function size:0x70 -fn_800063EC = .text:0x800063EC; // type:function size:0x70 -fn_8000645C = .text:0x8000645C; // type:function size:0x14 -fn_80006470 = .text:0x80006470; // type:function size:0x8 -fn_80006478 = .text:0x80006478; // type:function size:0xC -fn_80006484 = .text:0x80006484; // type:function size:0x16C -fn_800065F0 = .text:0x800065F0; // type:function size:0x1B4 -fn_800067A4 = .text:0x800067A4; // type:function size:0x170 -fn_80006914 = .text:0x80006914; // type:function size:0x16C -fn_80006A80 = .text:0x80006A80; // type:function size:0x174 -fn_80006BF4 = .text:0x80006BF4; // type:function size:0x150 -fn_80006D44 = .text:0x80006D44; // type:function size:0x38 -fn_80006D7C = .text:0x80006D7C; // type:function size:0xBC +HuSysVWaitSet = .text:0x800059EC; // type:function size:0x38 +HuSysVWaitGet = .text:0x80005A24; // type:function size:0xC +rand8 = .text:0x80005A30; // type:function size:0x2C +HuPadInit = .text:0x80005A5C; // type:function size:0xF0 +HuPadRead = .text:0x80005B4C; // type:function size:0x168 +PadReadVSync = .text:0x80005CB4; // type:function size:0x440 +PadADConv = .text:0x800060F4; // type:function size:0x234 +HuPadRumbleSet = .text:0x80006328; // type:function size:0x54 +HuPadRumbleStop = .text:0x8000637C; // type:function size:0x70 +HuPadRumbleAllStop = .text:0x800063EC; // type:function size:0x70 +HuPadStatGet = .text:0x8000645C; // type:function size:0x14 +HuPadRumbleGet = .text:0x80006470; // type:function size:0x8 +HuDVDReadAsyncCallBack = .text:0x80006478; // type:function size:0xC scope:local +HuDvdDataRead = .text:0x80006484; // type:function size:0x16C +HuDvdDataReadMulti = .text:0x800065F0; // type:function size:0x1B4 +HuDvdDataReadDirect = .text:0x800067A4; // type:function size:0x170 +HuDvdDataFastRead = .text:0x80006914; // type:function size:0x16C +HuDvdDataFastReadNum = .text:0x80006A80; // type:function size:0x174 +HuDvdDataFastReadAsync = .text:0x80006BF4; // type:function size:0x150 +HuDvdDataClose = .text:0x80006D44; // type:function size:0x38 +HuDvdErrorWatch = .text:0x80006D7C; // type:function size:0xBC fn_80006E38 = .text:0x80006E38; // type:function size:0xD0 fn_80006F08 = .text:0x80006F08; // type:function size:0x74 fn_80006F7C = .text:0x80006F7C; // type:function size:0x64 @@ -4688,8 +4688,8 @@ lbl_8011EBB8 = .rodata:0x8011EBB8; // type:object size:0x88 lbl_8011EC40 = .rodata:0x8011EC40; // type:object size:0x88 data:byte lbl_8011ECC8 = .rodata:0x8011ECC8; // type:object size:0x100 lbl_8011EDE0 = .data:0x8011EDE0; // type:object size:0x10 data:string -lbl_8011EDF0 = .data:0x8011EDF0; // type:object size:0x10 -lbl_8011EE00 = .data:0x8011EE00; // type:object size:0x124 +chanTbl = .data:0x8011EDF0; // type:object size:0x10 +correctDiskID = .data:0x8011EE00; // type:object size:0x124 scope:local jumptable_8011EF24 = .data:0x8011EF24; // type:object size:0x34 scope:local lbl_8011EF58 = .data:0x8011EF58; // type:object size:0x11 data:string lbl_8011EF69 = .data:0x8011EF69; // type:object size:0x11 data:string @@ -5351,8 +5351,8 @@ lbl_801405E0 = .data:0x801405E0; // type:object size:0x19E0 lbl_80141FC0 = .data:0x80141FC0; // type:object size:0x10 lbl_80141FD0 = .data:0x80141FD0; // type:object size:0x20 lbl_80141FF0 = .data:0x80141FF0; // type:object size:0x800 -PadStatErrOld = .bss:0x80142800; // type:object size:0x10 -RumbleData = .bss:0x80142810; // type:object size:0x30 +padStatErrOld = .bss:0x80142800; // type:object size:0x10 +rumbleData = .bss:0x80142810; // type:object size:0x30 ReadDataStat = .bss:0x80142840; // type:object size:0x2E00 data:4byte TextBuffer = .bss:0x80145640; // type:object size:0x400 lbl_80145A40 = .bss:0x80145A40; // type:object size:0x40 @@ -5614,7 +5614,7 @@ se = .bss:0x801D32D8; // type:object size:0xE8 data:4byte StreamInfo = .bss:0x801D33C0; // type:object size:0x60 data:4byte lbl_801D3420 = .sdata:0x801D3420; // type:object size:0x5 data:string lbl_801D3425 = .sdata:0x801D3425; // type:object size:0x7 -lbl_801D342C = .sdata:0x801D342C; // type:object size:0x4 data:4byte +rnd_seed = .sdata:0x801D342C; // type:object size:0x4 data:4byte lbl_801D3430 = .sdata:0x801D3430; // type:object size:0x6 data:string lbl_801D3436 = .sdata:0x801D3436; // type:object size:0x2 data:string lbl_801D3438 = .sdata:0x801D3438; // type:object size:0x7 data:string @@ -5910,36 +5910,36 @@ lbl_801D3A48 = .sbss:0x801D3A48; // type:object size:0x4 lbl_801D3A4C = .sbss:0x801D3A4C; // type:object size:0x4 lbl_801D3A50 = .sbss:0x801D3A50; // type:object size:0x4 lbl_801D3A54 = .sbss:0x801D3A54; // type:object size:0x4 data:4byte -lbl_801D3A58 = .sbss:0x801D3A58; // type:object size:0x4 data:4byte -lbl_801D3A5C = .sbss:0x801D3A5C; // type:object size:0x4 data:4byte -lbl_801D3A60 = .sbss:0x801D3A60; // type:object size:0x4 -lbl_801D3A64 = .sbss:0x801D3A64; // type:object size:0x4 -lbl_801D3A68 = .sbss:0x801D3A68; // type:object size:0x4 -lbl_801D3A6C = .sbss:0x801D3A6C; // type:object size:0x4 -lbl_801D3A70 = .sbss:0x801D3A70; // type:object size:0x4 -lbl_801D3A74 = .sbss:0x801D3A74; // type:object size:0x4 -lbl_801D3A78 = .sbss:0x801D3A78; // type:object size:0x4 -lbl_801D3A7C = .sbss:0x801D3A7C; // type:object size:0x4 -lbl_801D3A80 = .sbss:0x801D3A80; // type:object size:0x4 -lbl_801D3A84 = .sbss:0x801D3A84; // type:object size:0x4 -lbl_801D3A88 = .sbss:0x801D3A88; // type:object size:0x4 -lbl_801D3A8C = .sbss:0x801D3A8C; // type:object size:0x8 -lbl_801D3A94 = .sbss:0x801D3A94; // type:object size:0x8 -lbl_801D3A9C = .sbss:0x801D3A9C; // type:object size:0x8 -lbl_801D3AA4 = .sbss:0x801D3AA4; // type:object size:0x4 -lbl_801D3AA8 = .sbss:0x801D3AA8; // type:object size:0x4 -lbl_801D3AAC = .sbss:0x801D3AAC; // type:object size:0x4 -lbl_801D3AB0 = .sbss:0x801D3AB0; // type:object size:0x4 -lbl_801D3AB4 = .sbss:0x801D3AB4; // type:object size:0x4 -lbl_801D3AB8 = .sbss:0x801D3AB8; // type:object size:0x4 -lbl_801D3ABC = .sbss:0x801D3ABC; // type:object size:0x4 -lbl_801D3AC0 = .sbss:0x801D3AC0; // type:object size:0x4 -lbl_801D3AC4 = .sbss:0x801D3AC4; // type:object size:0x4 -lbl_801D3AC8 = .sbss:0x801D3AC8; // type:object size:0x8 -lbl_801D3AD0 = .sbss:0x801D3AD0; // type:object size:0x8 data:2byte -lbl_801D3AD8 = .sbss:0x801D3AD8; // type:object size:0x8 -lbl_801D3AE0 = .sbss:0x801D3AE0; // type:object size:0x4 data:4byte -lbl_801D3AE4 = .sbss:0x801D3AE4; // type:object size:0x4 data:4byte +VCounter = .sbss:0x801D3A58; // type:object size:0x4 data:4byte +RumbleBit = .sbss:0x801D3A5C; // type:object size:0x4 scope:local data:4byte +_PadErr = .sbss:0x801D3A60; // type:object size:0x4 scope:local +_PadDStkRepOld = .sbss:0x801D3A64; // type:object size:0x4 scope:local +_PadDStkRepCnt = .sbss:0x801D3A68; // type:object size:0x4 scope:local +_PadDStkRep = .sbss:0x801D3A6C; // type:object size:0x4 scope:local +_PadDStk = .sbss:0x801D3A70; // type:object size:0x4 scope:local +_PadTrigR = .sbss:0x801D3A74; // type:object size:0x4 scope:local +_PadTrigL = .sbss:0x801D3A78; // type:object size:0x4 scope:local +_PadSubStkY = .sbss:0x801D3A7C; // type:object size:0x4 scope:local +_PadSubStkX = .sbss:0x801D3A80; // type:object size:0x4 scope:local +_PadStkY = .sbss:0x801D3A84; // type:object size:0x4 scope:local +_PadStkX = .sbss:0x801D3A88; // type:object size:0x4 scope:local +_PadRepCnt = .sbss:0x801D3A8C; // type:object size:0x8 scope:local +_PadBtnDown = .sbss:0x801D3A94; // type:object size:0x8 scope:local +_PadBtn = .sbss:0x801D3A9C; // type:object size:0x8 scope:local +HuPadErr = .sbss:0x801D3AA4; // type:object size:0x4 +HuPadDStkRep = .sbss:0x801D3AA8; // type:object size:0x4 +HuPadDStk = .sbss:0x801D3AAC; // type:object size:0x4 +HuPadTrigR = .sbss:0x801D3AB0; // type:object size:0x4 +HuPadTrigL = .sbss:0x801D3AB4; // type:object size:0x4 +HuPadSubStkY = .sbss:0x801D3AB8; // type:object size:0x4 +HuPadSubStkX = .sbss:0x801D3ABC; // type:object size:0x4 +HuPadStkY = .sbss:0x801D3AC0; // type:object size:0x4 +HuPadStkX = .sbss:0x801D3AC4; // type:object size:0x4 +HuPadBtnRep = .sbss:0x801D3AC8; // type:object size:0x8 +HuPadBtnDown = .sbss:0x801D3AD0; // type:object size:0x8 data:2byte +HuPadBtn = .sbss:0x801D3AD8; // type:object size:0x8 +beforeDvdStatus = .sbss:0x801D3AE0; // type:object size:0x4 scope:local data:4byte +CallBackStatus = .sbss:0x801D3AE4; // type:object size:0x4 scope:local data:4byte lbl_801D3AE8 = .sbss:0x801D3AE8; // type:object size:0x4 data:4byte lbl_801D3AEC = .sbss:0x801D3AEC; // type:object size:0x4 data:4byte lbl_801D3AF0 = .sbss:0x801D3AF0; // type:object size:0x8 data:4byte diff --git a/configure.py b/configure.py index 7a49715c..b65c75ae 100755 --- a/configure.py +++ b/configure.py @@ -222,6 +222,9 @@ config.libs = [ "cflags": cflags_game, "host": False, "objects": [ + Object(NonMatching, "game/main.c"), + Object(NonMatching, "game/pad.c"), + Object(NonMatching, "game/dvd.c"), Object(Matching, "game/malloc.c"), Object(Matching, "game/memory.c"), Object(NonMatching, "game/sprman.c"), diff --git a/src/REL/_minigameDLL/_minigameDLL.c b/src/REL/_minigameDLL/_minigameDLL.c index 2a62228c..065b263a 100644 --- a/src/REL/_minigameDLL/_minigameDLL.c +++ b/src/REL/_minigameDLL/_minigameDLL.c @@ -6,5 +6,5 @@ void ModuleProlog(void) { } unsigned char fn_1_CC(void) { - return fn_80005A30(); + return rand8(); } \ No newline at end of file From 5cb53ace31fd56be0a62d4f95450cd542346c223 Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Wed, 22 Nov 2023 09:30:35 -0600 Subject: [PATCH 08/10] Split out data.c and decode.c Also given symbols --- config/GMPE01_00/splits.txt | 12 ++++++++ config/GMPE01_00/symbols.txt | 58 ++++++++++++++++++------------------ configure.py | 1 + 3 files changed, 42 insertions(+), 29 deletions(-) diff --git a/config/GMPE01_00/splits.txt b/config/GMPE01_00/splits.txt index 4ed757b3..4e160c46 100644 --- a/config/GMPE01_00/splits.txt +++ b/config/GMPE01_00/splits.txt @@ -32,6 +32,18 @@ game/dvd.c: .sdata start:0x801D3430 end:0x801D3438 .sbss start:0x801D3AE0 end:0x801D3AE8 +game/data.c: + .text start:0x80006E38 end:0x80009400 + .data start:0x8011EF58 end:0x8011FDE0 + .bss start:0x80142840 end:0x80145640 + .sdata start:0x801D3438 end:0x801D3448 + .sbss start:0x801D3AE8 end:0x801D3AF8 + +game/decode.c: + .text start:0x80009400 end:0x80009AFC + .data start:0x8011FDE0 end:0x8011FE00 + .bss start:0x80145640 end:0x80145A40 + game/malloc.c: .text start:0x8000A558 end:0x8000A938 .data start:0x80121F50 end:0x80121FC8 diff --git a/config/GMPE01_00/symbols.txt b/config/GMPE01_00/symbols.txt index 37fd31ed..338d5df5 100644 --- a/config/GMPE01_00/symbols.txt +++ b/config/GMPE01_00/symbols.txt @@ -65,31 +65,31 @@ HuDvdDataFastReadNum = .text:0x80006A80; // type:function size:0x174 HuDvdDataFastReadAsync = .text:0x80006BF4; // type:function size:0x150 HuDvdDataClose = .text:0x80006D44; // type:function size:0x38 HuDvdErrorWatch = .text:0x80006D7C; // type:function size:0xBC -fn_80006E38 = .text:0x80006E38; // type:function size:0xD0 -fn_80006F08 = .text:0x80006F08; // type:function size:0x74 -fn_80006F7C = .text:0x80006F7C; // type:function size:0x64 -fn_80006FE0 = .text:0x80006FE0; // type:function size:0xB8 -fn_80007098 = .text:0x80007098; // type:function size:0x224 -fn_800072BC = .text:0x800072BC; // type:function size:0x188 -fn_80007444 = .text:0x80007444; // type:function size:0xC8 -fn_8000750C = .text:0x8000750C; // type:function size:0x1A8 -fn_800076B4 = .text:0x800076B4; // type:function size:0x1A8 -fn_8000785C = .text:0x8000785C; // type:function size:0x60 -fn_800078BC = .text:0x800078BC; // type:function size:0x344 -fn_80007C00 = .text:0x80007C00; // type:function size:0x3A0 -fn_80007FA0 = .text:0x80007FA0; // type:function size:0x3C4 -fn_80008364 = .text:0x80008364; // type:function size:0x428 -fn_8000878C = .text:0x8000878C; // type:function size:0x30 -fn_800087BC = .text:0x800087BC; // type:function size:0x3FC -fn_80008BB8 = .text:0x80008BB8; // type:function size:0x104 -fn_80008CBC = .text:0x80008CBC; // type:function size:0x38 -fn_80008CF4 = .text:0x80008CF4; // type:function size:0x7C -fn_80008D70 = .text:0x80008D70; // type:function size:0xD4 -fn_80008E44 = .text:0x80008E44; // type:function size:0x130 -fn_80008F74 = .text:0x80008F74; // type:function size:0x48C -fn_80009400 = .text:0x80009400; // type:function size:0x200 -fn_80009600 = .text:0x80009600; // type:function size:0x1D8 -fn_800097D8 = .text:0x800097D8; // type:function size:0x324 +HuDataInit = .text:0x80006E38; // type:function size:0xD0 +HuDataReadChk = .text:0x80006F08; // type:function size:0x74 +HuDataGetStatus = .text:0x80006F7C; // type:function size:0x64 +HuDataGetDirPtr = .text:0x80006FE0; // type:function size:0xB8 +HuDataDirRead = .text:0x80007098; // type:function size:0x224 +HuDataDirSet = .text:0x800072BC; // type:function size:0x188 +HuDataDirReadAsyncCallBack = .text:0x80007444; // type:function size:0xC8 +HuDataDirReadAsync = .text:0x8000750C; // type:function size:0x1A8 +HuDataDirReadNumAsync = .text:0x800076B4; // type:function size:0x1A8 +HuDataGetAsyncStat = .text:0x8000785C; // type:function size:0x60 +HuDataRead = .text:0x800078BC; // type:function size:0x344 +HuDataReadNum = .text:0x80007C00; // type:function size:0x3A0 +HuDataSelHeapRead = .text:0x80007FA0; // type:function size:0x3C4 +HuDataSelHeapReadNum = .text:0x80008364; // type:function size:0x428 +HuDataReadMulti = .text:0x8000878C; // type:function size:0x30 +HuDataReadMultiSub = .text:0x800087BC; // type:function size:0x3FC +HuDataGetSize = .text:0x80008BB8; // type:function size:0x104 +HuDataClose = .text:0x80008CBC; // type:function size:0x38 +HuDataCloseMulti = .text:0x80008CF4; // type:function size:0x7C +HuDataDirClose = .text:0x80008D70; // type:function size:0xD4 +HuDataDirCloseNum = .text:0x80008E44; // type:function size:0x130 +HuDataReadNumHeapShortForce = .text:0x80008F74; // type:function size:0x48C +HuDecodeSlide = .text:0x80009400; // type:function size:0x200 scope:local +HuDecodeFslide = .text:0x80009600; // type:function size:0x1D8 scope:local +HuDecodeData = .text:0x800097D8; // type:function size:0x324 HuSysInit = .text:0x80009AFC; // type:function size:0x138 fn_80009C34 = .text:0x80009C34; // type:function size:0xD0 fn_80009D04 = .text:0x80009D04; // type:function size:0x164 @@ -5353,7 +5353,7 @@ lbl_80141FD0 = .data:0x80141FD0; // type:object size:0x20 lbl_80141FF0 = .data:0x80141FF0; // type:object size:0x800 padStatErrOld = .bss:0x80142800; // type:object size:0x10 rumbleData = .bss:0x80142810; // type:object size:0x30 -ReadDataStat = .bss:0x80142840; // type:object size:0x2E00 data:4byte +ReadDataStat = .bss:0x80142840; // type:object size:0x2E00 align:32 data:4byte TextBuffer = .bss:0x80145640; // type:object size:0x400 lbl_80145A40 = .bss:0x80145A40; // type:object size:0x40 HeapTbl = .bss:0x80145A80; // type:object size:0x14 scope:local @@ -5940,9 +5940,9 @@ HuPadBtnDown = .sbss:0x801D3AD0; // type:object size:0x8 data:2byte HuPadBtn = .sbss:0x801D3AD8; // type:object size:0x8 beforeDvdStatus = .sbss:0x801D3AE0; // type:object size:0x4 scope:local data:4byte CallBackStatus = .sbss:0x801D3AE4; // type:object size:0x4 scope:local data:4byte -lbl_801D3AE8 = .sbss:0x801D3AE8; // type:object size:0x4 data:4byte -lbl_801D3AEC = .sbss:0x801D3AEC; // type:object size:0x4 data:4byte -lbl_801D3AF0 = .sbss:0x801D3AF0; // type:object size:0x8 data:4byte +shortAccessSleep = .sbss:0x801D3AE8; // type:object size:0x4 scope:local data:4byte +DataDirMax = .sbss:0x801D3AEC; // type:object size:0x4 scope:local data:4byte +DirDataSize = .sbss:0x801D3AF0; // type:object size:0x8 scope:local data:4byte lbl_801D3AF8 = .sbss:0x801D3AF8; // type:object size:0x4 data:4byte lbl_801D3AFC = .sbss:0x801D3AFC; // type:object size:0x4 data:4byte lbl_801D3B00 = .sbss:0x801D3B00; // type:object size:0x4 data:float diff --git a/configure.py b/configure.py index b65c75ae..5f92cfd7 100755 --- a/configure.py +++ b/configure.py @@ -225,6 +225,7 @@ config.libs = [ Object(NonMatching, "game/main.c"), Object(NonMatching, "game/pad.c"), Object(NonMatching, "game/dvd.c"), + Object(NonMatching, "game/decode.c"), Object(Matching, "game/malloc.c"), Object(Matching, "game/memory.c"), Object(NonMatching, "game/sprman.c"), From 28ca446347fd0ca9678dee7d982d38d5e79ec448 Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Wed, 22 Nov 2023 09:31:37 -0600 Subject: [PATCH 09/10] Fix configure file --- config/GMPE01_00/splits.txt | 4 ++-- configure.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config/GMPE01_00/splits.txt b/config/GMPE01_00/splits.txt index 4e160c46..0490a5fa 100644 --- a/config/GMPE01_00/splits.txt +++ b/config/GMPE01_00/splits.txt @@ -35,10 +35,10 @@ game/dvd.c: game/data.c: .text start:0x80006E38 end:0x80009400 .data start:0x8011EF58 end:0x8011FDE0 - .bss start:0x80142840 end:0x80145640 + .bss start:0x80142840 end:0x80145640 .sdata start:0x801D3438 end:0x801D3448 .sbss start:0x801D3AE8 end:0x801D3AF8 - + game/decode.c: .text start:0x80009400 end:0x80009AFC .data start:0x8011FDE0 end:0x8011FE00 diff --git a/configure.py b/configure.py index 5f92cfd7..b0fdec5f 100755 --- a/configure.py +++ b/configure.py @@ -225,6 +225,7 @@ config.libs = [ Object(NonMatching, "game/main.c"), Object(NonMatching, "game/pad.c"), Object(NonMatching, "game/dvd.c"), + Object(NonMatching, "game/data.c"), Object(NonMatching, "game/decode.c"), Object(Matching, "game/malloc.c"), Object(Matching, "game/memory.c"), From 334276fdfc4c8aa9d5565793e3bf9a09cedffbb0 Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Wed, 22 Nov 2023 09:33:00 -0600 Subject: [PATCH 10/10] DataDirStat is a local symbol --- config/GMPE01_00/symbols.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/GMPE01_00/symbols.txt b/config/GMPE01_00/symbols.txt index 338d5df5..2fc1ed93 100644 --- a/config/GMPE01_00/symbols.txt +++ b/config/GMPE01_00/symbols.txt @@ -4831,7 +4831,7 @@ lbl_8011F77C = .data:0x8011F77C; // type:object size:0x13 data:string lbl_8011F78F = .data:0x8011F78F; // type:object size:0x13 data:string lbl_8011F7A2 = .data:0x8011F7A2; // type:object size:0x12 data:string lbl_8011F7B4 = .data:0x8011F7B4; // type:object size:0x10 -DataDirStat = .data:0x8011F7C4; // type:object size:0x468 data:4byte +DataDirStat = .data:0x8011F7C4; // type:object size:0x468 data:4byte scope:local lbl_8011FC2C = .data:0x8011FC2C; // type:object size:0x1D data:string lbl_8011FC49 = .data:0x8011FC49; // type:object size:0x1F data:string lbl_8011FC68 = .data:0x8011FC68; // type:object size:0x3C