diff --git a/src/controller_pak.c b/src/controller_pak.c index b3e44712..58ffed85 100644 --- a/src/controller_pak.c +++ b/src/controller_pak.c @@ -2,17 +2,10 @@ /* RAM_POS: 0x80072250 */ #include "controller_pak.h" -#include "memory.h" -#include "PR/pfs.h" -#include "PR/os_cont.h" - -#include "types.h" -#include "macros.h" -#include "structs.h" /************ .data ************/ -s32 D_800DE440 = 0; +s32 *D_800DE440 = 0; u8 gN64FontCodes[68] = "\0 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#'*+,-./:=?@"; @@ -79,8 +72,6 @@ s32 D_801241F4; /*******************************/ -u8 func_8006A4F8(s32 arg0); - u8 func_80072250(s32 arg0) { if ((arg0 == 0 || arg0 == 1) && func_8000E158()) { arg0 = 1 - arg0; @@ -88,7 +79,6 @@ u8 func_80072250(s32 arg0) { return func_8006A4F8(arg0); } -void func_80072708(void); void func_80072298(u8 arg0) { D_801241E4 = arg0; if (arg0 != 0) { @@ -140,18 +130,18 @@ GLOBAL_ASM("asm/non_matchings/controller_pak/func_80073E1C.s") s32 func_80073F5C(s32 arg0, s32 arg1) { s32 temp_v0; - s32 sp30; + s32 sp30; //Possible epcInfo struct u8 *sp2C; s32 phi_v1; - s32 sp24; + s32 size; - sp24 = func_80073C4C(); // 256 bytes - sp2C = allocate_from_main_pool_safe(sp24, COLOR_TAG_WHITE); - *((s32*)sp2C) = 0x47414D44; // GAMD + size = func_80073C4C(); // 256 bytes + sp2C = allocate_from_main_pool_safe(size, COLOR_TAG_WHITE); + *((s32*)sp2C) = 'GAMD'; func_800732E8(arg1, sp2C + 4); phi_v1 = func_80073C5C(arg0, 3, &sp30); if (phi_v1 == 0) { - phi_v1 = func_800766D4(arg0, -1, &D_800E7680, &sp30, sp2C, sp24); + phi_v1 = func_800766D4(arg0, -1, &D_800E7680, &sp30, sp2C, size); } free_from_memory_pool(sp2C); if (phi_v1 != 0) { @@ -167,7 +157,7 @@ s32 func_80074148(s32 arg0, Settings *arg1) { s32 phi_v1; s32 sp24; s32 temp_v0; - s32 sp30; + s32 sp30; //Possible epcInfo struct sp24 = func_80073C54(); // 512 bytes sp2C = allocate_from_main_pool_safe(sp24, COLOR_TAG_WHITE); @@ -451,13 +441,13 @@ s32 func_80076AF4(s32 controllerIndex, s32 fileNum) { data = allocate_from_main_pool_safe(0x100, COLOR_TAG_BLACK); if (read_data_from_controller_pak(controllerIndex, fileNum, (u8 *)data, 0x100) == 0) { switch(*data) { - case 0x47414D44: // GAMD, Game Data? + case 'GAMD': // Game Data? ret = 3; break; - case 0x54494D44: // TIMD, Time Data? + case 'TIMD': // Time Data? ret = 4; break; - case 0x47485353: // GHSS, Ghosts? + case 'GHSS': // Ghosts? ret = 5; break; default: diff --git a/src/controller_pak.h b/src/controller_pak.h index b3530ed1..91ab1b2c 100644 --- a/src/controller_pak.h +++ b/src/controller_pak.h @@ -2,11 +2,55 @@ #define _UNKNOWN_072E50_H_ #include "types.h" +#include "memory.h" +#include "PR/pfs.h" +#include "PR/os_cont.h" +#include "macros.h" +#include "structs.h" +#include "camera.h" -extern s32 D_800DE440; +// Ghost data follows directly after the header +/* Size: 8 bytes */ +typedef struct GhostHeader { + s16 checksum; + s8 unk2; + s8 unk3; + s16 unk4; + s16 numberFrames; +} GhostHeader; + +/* Size: 12 bytes */ +typedef struct GhostDataFrame { + u8 pad0[12]; +} GhostDataFrame; + +extern s32 *D_800DE440; extern u8 gN64FontCodes[68]; extern s32 D_800DE488; extern s32 D_800DE48C; + +u8 func_80072250(s32 arg0); +void func_80072298(u8 arg0); +void func_80072708(void); +s32 func_80073C4C(void); +s32 func_80073C54(void); +s32 func_80073F5C(s32 arg0, s32 arg1); +s32 func_80074148(s32 arg0, Settings *arg1); +void func_80074AA8(GhostHeader *ghostHeader, s16 arg1, s16 arg2, s16 numberFrames, u8 *dest); +s32 func_80075AEC(s32 controllerIndex); +s32 func_80075D38(s32 controllerIndex); +s32 func_80075DC4(s32 controllerIndex); +void func_80076164(void); +s32 func_80076194(s32 controllerIndex, s32 *arg1, s32 *arg2); s32 read_data_from_controller_pak(s32 controllerIndex, s32 fileNum, u8 *data, s32 dataLength); +s32 func_80076AF4(s32 controllerIndex, s32 fileNum); + +s32 func_800722E8(s16 arg0); //Non matching +s32 func_800738A4(Settings *arg0, void *arg1); //Non matching +s64 func_8007480C(u64 arg0); //Non matching +s32 func_8007497C(u64 *arg0); //Non matching +s32 func_80074B1C(void); //Non matching +s32 func_800762C8(s32 controllerIndex, s32 fileNum); //Non matching +s32 func_80076924(s32 controllerIndex, s32 arg1, s32 *arg2); //Non matching #endif diff --git a/src/memory.h b/src/memory.h index 76cb6fbf..9c6677df 100644 --- a/src/memory.h +++ b/src/memory.h @@ -25,6 +25,7 @@ #define COLOR_TAG_BLACK 0x000000FF void *allocate_from_main_pool_safe(s32 size, u32 colorTag); +void free_from_memory_pool(void *data); s32 func_80071478(u8 *address); #endif