Merge pull request #162 from Kelebek1/fragment22

fragment22
This commit is contained in:
Revo
2024-10-18 23:38:53 -04:00
committed by GitHub
19 changed files with 3449 additions and 70 deletions

View File

@@ -34,7 +34,7 @@
#define ALIGN4(val) (((val) + 0x3) & ~0x3)
#define ALIGN8(val) (((val) + 0x7) & ~0x7)
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
#define ALIGN16(val) (((val) + 0xFu) & ~0xFu)
#define ALIGN64(val) (((val) + 0x3F) & ~0x3F)
#define DECR(x) ((x) == 0 ? 0 : --(x))

View File

@@ -137,36 +137,50 @@ extern u8 fragment22_relocs_ROM_END[];
extern u8 fragment23_TEXT_START[];
extern u8 fragment23_ROM_START[];
extern u8 fragment23_ROM_END[];
extern u8 fragment23_relocs_ROM_END[];
// fragment 24
extern u8 fragment24_TEXT_START[];
extern u8 fragment24_ROM_START[];
extern u8 fragment24_ROM_END[];
extern u8 fragment24_relocs_ROM_END[];
// fragment 25
extern u8 fragment25_TEXT_START[];
extern u8 fragment25_ROM_START[];
extern u8 fragment25_ROM_END[];
extern u8 fragment25_relocs_ROM_END[];
// fragment 26
extern u8 fragment26_TEXT_START[];
extern u8 fragment26_ROM_START[];
extern u8 fragment26_ROM_END[];
extern u8 fragment26_relocs_ROM_END[];
// fragment 27
extern u8 fragment27_TEXT_START[];
extern u8 fragment27_ROM_START[];
extern u8 fragment27_ROM_END[];
extern u8 fragment27_relocs_ROM_END[];
// fragment 28
extern u8 fragment28_TEXT_START[];
extern u8 fragment28_ROM_START[];
extern u8 fragment28_ROM_END[];
extern u8 fragment28_relocs_ROM_END[];
// fragment 29
extern u8 fragment29_TEXT_START[];
extern u8 fragment29_ROM_START[];
extern u8 fragment29_ROM_END[];
extern u8 fragment29_relocs_ROM_END[];
extern u8 fragment29_misc_1_ROM_START[];
extern u8 fragment29_misc_1_ROM_END[];
extern u8 fragment29_misc_2_ROM_START[];
extern u8 fragment29_misc_2_ROM_END[];
extern u8 fragment29_misc_3_ROM_START[];
extern u8 fragment29_misc_3_ROM_END[];
// fragment 30
extern u8 fragment30_TEXT_START[];

View File

@@ -90,8 +90,12 @@ void func_80023D60(s32);
void func_80023F78(s32 arg0);
void func_80024040(s32 arg0);
s32 func_800240A0(void);
s32 func_80024A48(s32, s32, s32);
s32 func_80024EF4(void);
s32 func_80024F00(s32);
s32 func_80024FB0(s32 arg0);
void func_800251B0(s32, s8*);
s32 func_80025370(s32);
s32 func_8002539C(s32);
#endif // _6BC0_H_

View File

@@ -2,6 +2,7 @@
#define _26820_H_
#include "global.h"
#include "22630.h"
#include "29BA0.h"
typedef struct unk_func_8002A728 {
@@ -29,19 +30,44 @@ typedef struct unk_func_800281D4 {
/* 0x10 */ char unk_10[16];
} unk_func_800281D4; // size >= 0x20
void func_80026684(s32, s32);
void func_80025C20(UNUSED MainPoolBlock* arg0, u32 arg1);
u16 func_80025C80(u8* arg0, s32 arg1);
s32 func_80025CBC(u8* arg0, s32 arg1);
void func_80025D30(u8* arg0, s32 arg1, s32 arg2);
void func_80025DA0(u8* arg0, u8* arg1, s32 arg2, s32 arg3);
void func_80025DE4(u8* arg0, s32 arg1, s32 arg2);
void func_80025E44(u8* arg0, s32 arg1, s32 arg2);
void func_80025EA0(u8* arg0, s32 arg1, s32 arg2);
void func_80025EF8(u8* arg0, s32 arg1, s32 arg2);
void func_80025F50(s32 arg0, s32 arg1);
void func_80026268(unk_func_80026268_arg0* arg0, unk_D_800AE4E8_004_1_000_010* arg1);
void func_800262DC(unk_func_80026268_arg0* arg0, unk_D_800AE4E8_004_1_000_010* arg1);
s32 func_80026338(s32 arg0, s32 arg1, s16 arg2);
void func_800264DC(s32 arg0, s32 arg1, s16 arg2);
void func_8002667C(void);
void func_80026684(s32 arg0, s32 arg1);
void func_8002685C(s32 arg0, s32 arg1);
void func_80026A34(s32 arg0, s32 arg1);
void func_80026C0C(s32 arg0, s32 arg1);
void func_8002707C(s32 arg0, s32 arg1);
void func_80027F24(unk_func_8002A728*);
void func_80027F40(unk_func_8002A728*);
void func_80027FA0(unk_func_80027FA0*, s16);
void func_80028070(u16*);
void func_800280D4(u8);
void func_80028128(s32);
s32 func_800270AC(s32 arg0);
s32 func_80027108(s32 arg0);
s16 func_800275E0(s32 arg0, s32 arg1);
s32 func_8002797C(s32 arg0, s32 arg1, s32 arg2, void* arg3);
s32 func_80027C24(s32 arg0, s32 arg1, s32 arg2, void* arg3);
void func_80027F24(unk_func_8002A728* arg0);
void func_80027F40(unk_func_8002A728* arg0);
void func_80027FA0(unk_func_80027FA0* arg0, s16 arg1);
void func_80028070(u16* arg0);
void func_800280D4(u8 arg0);
s32 func_8002816C(void);
void func_8002817C(u8, u8);
void func_800281D4(unk_func_800281D4*, unk_func_80026268_arg0*, u8);
s32 func_80028320(unk_func_800281D4*, unk_func_80026268_arg0*);
s32 func_800284B4(s16);
s32 func_80028AFC(s16);
s32 func_800284B4(s16 arg0);
s32 func_8002873C(s16 arg0, u32 arg1);
void func_80028840(void);
void func_800288F4(void);
void func_800289AC(void);
void func_80028A74(void);
s32 func_80028AFC(s16 arg0);
#endif // _26820_H_

View File

@@ -75,7 +75,7 @@ unk_D_800AE540_0004* func_80029074(void) {
return D_800AE540.unk_0004;
}
s16 func_80029080(void) {
s32 func_80029080(void) {
return D_80075674;
}

View File

@@ -122,7 +122,7 @@ s32 Game_DoCopyProtection(s32 state);
s32 func_80029008(s32 arg0, u8* romStart, u8* romEnd, u32 arg3, u32 arg4);
void func_80029048(s32 arg0, u8* arg1, u8* arg2, s32 arg3, s32 arg4);
unk_D_800AE540_0004* func_80029074(void);
s16 func_80029080(void);
s32 func_80029080(void);
void func_8002908C(s32 arg0);
void func_800290B4(void);
s32 func_800290E4(s16 arg0);

View File

@@ -2,7 +2,11 @@
#define _2E460_H_
#include "global.h"
#include "src/fragments/26/fragment26.h"
void func_8002EE78(void);
void func_8002EEA8(unk_func_88001300_034*);
void func_8002EF18(s32*);
void func_8002EF44(void);
#endif // _2E460_H_

View File

@@ -217,7 +217,22 @@ void func_8002FA40(void) {
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_8003107C.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_80031140.s")
void func_80031140(unk_func_80026268_arg0* arg0, unk_D_83407AC8* arg1) {
s32 i;
bzero(arg0, sizeof(unk_func_80026268_arg0));
arg0->unk_0E = arg1->unk_00;
arg0->unk_00 = arg1->unk_02;
for (i = 0; i < 11; i++) {
arg0->unk_30[i] = arg1->unk_03[i];
}
for (i = 0; i < 11; i++) {
arg0->unk_3B[i] = arg1->unk_0E[i];
}
}
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_80031204.s")

View File

@@ -7,11 +7,9 @@
typedef struct unk_D_83407AC8 {
/* 0x00 */ u16 unk_00;
/* 0x02 */ u8 unk_02;
/* 0x03 */ u8 unk_03[11];
/* 0x0E */ u8 unk_0E;
/* 0x0F */ u8 unk_0F;
/* 0x10 */ u8 unk_10;
} unk_D_83407AC8; // size >= 0x12
/* 0x03 */ s8 unk_03[11];
/* 0x0E */ s8 unk_0E[11];
} unk_D_83407AC8; // size >= 0x1A
typedef struct unk_D_83402EE0_070 {
/* 0x00 */ char unk00[0x1A];

View File

@@ -472,10 +472,10 @@ void func_80004200(u32 block_addr, u32 addr) {
}
}
s32 func_80004258(s32 id, u8* rom_start, u8* rom_end, s32 arg3) {
s32 vaddr = func_80003DC4(rom_start, rom_end, arg3, 0);
u8* func_80004258(s32 id, u8* rom_start, u8* rom_end, s32 arg3) {
u8* vaddr = func_80003DC4(rom_start, rom_end, arg3, 0);
if ((vaddr != 0) && (id > 0)) {
if ((vaddr != NULL) && (id > 0)) {
Memmap_SetSegmentMap(id, vaddr, main_pool_get_block_dist(vaddr));
main_pool_set_func(vaddr, id + 0x82000000, &func_80004200);
}

View File

@@ -101,7 +101,7 @@ unk_func_800041C0* func_80004098(unk_func_800041C0* arg0, s32 arg1, s32 arg2);
unk_func_800041C0* func_800040EC(unk_func_800041C0* arg0, u32 arg1, u32 offset, u32 size);
void func_800041C0(s32 arg0, s32 arg1, s32 arg2);
void func_80004200(u32 block_addr, u32 addr);
s32 func_80004258(s32 id, u8* rom_start, u8* rom_end, s32 arg3);
u8* func_80004258(s32 id, u8* rom_start, u8* rom_end, s32 arg3);
MainPoolBlock* func_800042E0(s32 arg0, s32 arg1, s32 arg2, s32 arg3);
void func_80004364(u32 base_addr, u32 addr);
void func_800043BC(s32 arg0, Fragment* addr);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,62 @@
#ifndef _FRAGMENT22_H_
#define _FRAGMENT22_H_
#include "global.h"
#include "src/fragments/26/fragment26.h"
typedef struct unk_func_8800071C {
/* 0x00 */ unk_func_88001300_000 unk_00;
/* 0x2C */ u8* unk_2C;
/* 0x30 */ u8* unk_30;
/* 0x34 */ Color_RGBA8 unk_34;
/* 0x38 */ Color_RGBA8 unk_38;
} unk_func_8800071C; // size = 0x3C
typedef struct unk_func_88000830 {
/* 0x00 */ unk_func_88001300_000 unk_00;
/* 0x2C */ s32 unk_2C;
/* 0x30 */ u8** unk_30;
/* 0x34 */ s32 unk_34;
} unk_func_88000830; // size = 0x38
typedef struct unk_func_88000C18 {
/* 0x00 */ unk_func_88001300_000 unk_00;
/* 0x2C */ Color_RGBA8 unk_2C;
/* 0x30 */ s32 unk_30;
} unk_func_88000C18; // size = 0x34
typedef struct unk_func_88000CC8 {
/* 0x00 */ unk_func_88001300_000 unk_00;
/* 0x2C */ u8* unk_2C;
/* 0x30 */ u8* unk_30[2];
/* 0x38 */ u8* unk_38[3];
/* 0x44 */ s32 unk_44;
/* 0x48 */ s32 unk_48;
/* 0x4C */ s32 unk_4C;
/* 0x50 */ unk_func_88001300_034* unk_50;
} unk_func_88000CC8; // size = 0x54
void func_88000020(unk_func_88001300_000* arg0, s32 arg1, s32 arg2);
s32 func_8800008C(unk_func_88001300_000* arg0, s32 arg1, s32 arg2);
void func_8800071C(unk_func_8800071C* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, u8* arg5, u8* arg6, Color_RGBA8 arg7, Color_RGBA8 arg8);
s32 func_880007C0(unk_func_88001300_000* arg0, s32 arg1, s32 arg2);
void func_88000830(unk_func_88000830* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, u8** arg6);
s32 func_880008C4(unk_func_88001300_000* arg0);
s32 func_880008E0(unk_func_88000830* arg0, s32 arg1, s32 arg2);
void func_88000C18(unk_func_88000C18* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, Color_RGBA8 arg5);
void func_88000CB0(unk_func_88001300_000* arg0);
void func_88000CC0(unk_func_88001300* arg0, s32 arg1);
void func_88000CC8(unk_func_88000CC8* arg0, s32 arg1, s32 arg2, unk_func_88500020* arg3, u8* arg4, u8* arg5, u8* arg6, u8* arg7, u8* arg8, unk_func_88001300_034* arg9);
void func_88000D80(unk_func_88001300_000* arg0);
s32 func_88000E30(unk_func_88001300_000* arg0, s32 arg1, s32 arg2);
void func_88001258(unk_func_88001300* arg0);
void func_88001CBC(unk_func_88001300* arg0, s32 arg1);
s32 func_88001D0C(unk_func_88001300* arg0, Controller* controller);
s32 func_88001D34(void);
s32 func_88001D94(unk_func_88001300* arg0);
void func_8800233C(unk_func_88001300* arg0);
void func_88002580(unk_func_88001300* arg0);
s32 func_880025D8(unk_func_88001300* arg0);
s32 func_88002628(s32 arg0, UNUSED s32 arg1);
#endif // _FRAGMENT22_H_

View File

@@ -0,0 +1,171 @@
#ifndef _FRAGMENT26_H_
#define _FRAGMENT26_H_
#include "global.h"
#include "src/memory.h"
#include "src/controller.h"
struct unk_func_88001300;
struct unk_func_88001300_000;
struct unk_func_88001300_03C;
typedef s32 (*unk_func_88001300_018)(struct unk_func_88001300_000*, s32, s32);
typedef s32 (*unk_func_88001300_01C)(struct unk_func_88001300_000*);
typedef s32 (*unk_func_88001300_020)(struct unk_func_88001300*, Controller*);
typedef void (*unk_func_88001300_024)(struct unk_func_88001300*, s32);
typedef struct unk_func_88001300_000_000 {
/* 0x00 */ char unk00[0x4];
/* 0x04 */ struct unk_func_88001300* unk_04;
/* 0x08 */ struct unk_func_88001300* unk_08;
} unk_func_88001300_000_000; // size >= 0xC
typedef struct unk_func_88001300_000 {
/* 0x00 */ unk_func_88001300_000_000 unk_00;
/* 0x0C */ char unk0C[0x4];
/* 0x10 */ s16 unk_10;
/* 0x12 */ s16 unk_12;
/* 0x14 */ s16 unk_14;
/* 0x16 */ s16 unk_16;
/* 0x18 */ unk_func_88001300_018 unk_18;
/* 0x1C */ unk_func_88001300_01C unk_1C;
/* 0x20 */ unk_func_88001300_020 unk_20;
/* 0x24 */ unk_func_88001300_024 unk_24;
/* 0x28 */ u16 unk_28;
/* 0x2A */ u16 unk_2A;
} unk_func_88001300_000; // size = 0x2C
typedef struct unk_func_88001300_02C {
/* 0x00 */ unk_func_88001300_000_000 unk_00;
/* 0x0C */ char unk0C[0x20];
/* 0x2C */ s32 unk_2C;
} unk_func_88001300_02C; // size = 0x30
typedef struct unk_func_88001300_030 {
/* 0x00 */ unk_func_88001300_000_000 unk_00;
/* 0x0C */ char unk0C[0x20];
/* 0x2C */ Color_RGBA8_u32 unk_2C;
/* 0x30 */ s32 unk_30;
/* 0x34 */ s32 unk_34;
/* 0x38 */ char unk38[0x4];
} unk_func_88001300_030; // size = 0x3C
typedef struct unk_func_88001300_034 {
/* 0x00 */ unk_func_88001300_000 unk_00;
/* 0x2C */ char unk2C[0x4];
/* 0x30 */ s32 unk_30;
/* 0x34 */ char unk34[0xC];
/* 0x40 */ s32 unk_40;
} unk_func_88001300_034; // size = 0x44
typedef struct unk_func_88001300_038 {
/* 0x00 */ char unk00[0x28];
/* 0x28 */ u16 unk_28;
/* 0x2A */ char unk2A[0xA];
} unk_func_88001300_038; // size = 0x34
typedef struct unk_func_88001300_03C_00C {
/* 0x00 */ char unk00[0x10];
/* 0x10 */ s16 unk_10;
/* 0x12 */ s16 unk_12;
/* 0x14 */ s16 unk_14;
/* 0x16 */ s16 unk_16;
/* 0x18 */ char unk18[0x14];
} unk_func_88001300_03C_00C; // size = 0x2C
typedef struct unk_func_88001300_03C_01C {
/* 0x00 */ unk_func_88001300_000 unk_00;
/* 0x2C */ Color_RGBA8_u32 unk_2C;
/* 0x30 */ s32 unk_30;
} unk_func_88001300_03C_01C; // size = 0x34
typedef s32 (*unk_func_88001300_03C_010)(struct unk_func_88001300_03C*, Controller*);
typedef void (*unk_func_88001300_03C_014)(struct unk_func_88001300_03C*, s32);
typedef struct unk_func_88001300_03C {
/* 0x00 */ char unk00[0xC];
/* 0x00 */ unk_func_88001300_03C_00C* unk_0C;
/* 0x10 */ unk_func_88001300_03C_010 unk_10;
/* 0x14 */ unk_func_88001300_03C_014 unk_14;
/* 0x18 */ unk_func_88001300_000** unk_18;
/* 0x1C */ unk_func_88001300_03C_01C* unk_1C;
/* 0x20 */ char unk20[0x4];
/* 0x24 */ s32 unk_24;
/* 0x28 */ char unk28[0x4];
/* 0x2C */ s32 unk_2C;
/* 0x30 */ char unk30[0x10];
} unk_func_88001300_03C; // size = 0x40
typedef struct unk_func_88001300 {
/* 0x00 */ unk_func_88001300_000 unk_00;
/* 0x2C */ unk_func_88001300_02C* unk_2C;
/* 0x30 */ unk_func_88001300_030* unk_30;
/* 0x34 */ unk_func_88001300_034* unk_34;
/* 0x38 */ unk_func_88001300_038* unk_38;
/* 0x3C */ unk_func_88001300_03C* unk_3C;
/* 0x40 */ s32 unk_40;
/* 0x44 */ char unk44[0xC];
/* 0x50 */ s32 unk_50;
/* 0x54 */ s32 unk_54;
} unk_func_88001300; // size = 0x58
typedef struct unk_func_88500E34 {
/* 0x00 */ unk_func_88001300_000 unk_00;
/* 0x2C */ u8* unk_2C;
} unk_func_88500E34; // size = 0x30
typedef struct unk_func_88509A2C {
/* 0x00 */ unk_func_88001300_000 unk_00;
/* 0x2C */ s32 unk_2C;
/* 0x30 */ s32 unk_30;
/* 0x34 */ s32 unk_34;
/* 0x38 */ s32 unk_38;
/* 0x3C */ char* unk_3C;
/* 0x40 */ char unk_40[12];
} unk_func_88509A2C; // size = 0x4C
typedef struct unk_func_88500020 {
/* 0x00 */ s32 unk_00;
/* 0x04 */ s32 unk_04;
/* 0x08 */ s32 unk_08;
/* 0x0C */ u8* unk_0C;
} unk_func_88500020; // size = 0x10
typedef void (*func88500020)(unk_func_88500020*, s32, s32);
typedef void (*func8850068C)(unk_func_88001300_000_000*, unk_func_88001300_000_000*);
typedef void (*func885007CC)(unk_func_88001300_000*, s32);
typedef void (*func88500828)(unk_func_88001300*, s32, s32);
typedef void (*func885008C4)(unk_func_88001300*);
typedef void (*func8850093C)(s32, s32);
typedef void (*func88500E34)(unk_func_88500E34*, s32, s32, s32, s32, u8*);
typedef void (*func88502274)(unk_func_88001300_038*, s32, s32, s32, s32);
typedef void (*func88503118)(unk_func_88001300_02C*, s32, s32, s32, s32);
typedef void (*func88504570)(unk_func_88001300_03C_01C*, s32, s32, s32, s32, Color_RGBA8);
typedef void (*func885054D8)(unk_func_88001300_030*, s32, s32, s32, s32, Color_RGBA8);
typedef void (*func88505E2C)(unk_func_88001300_034*, s32, s32, s32, s32, s32, Color_RGBA8, unk_D_800AC870*);
typedef void (*func88506074)(unk_func_88001300_034*, char*);
typedef void (*func88509A2C)(unk_func_88509A2C*, s32, s32, s32, char*);
typedef void (*func8850BC94)(s32);
typedef void (*func8850C284)(unk_func_88001300_03C*, s32, s32, MemoryPool*);
typedef void (*func8850CB48)(unk_func_88001300_03C*, s32);
void func_88500020(unk_func_88500020*, s32, s32);
void func_8850068C(unk_func_88001300_000_000*, unk_func_88001300_000_000*);
void func_885007CC(unk_func_88001300_000*, s32);
void func_88500828(unk_func_88001300*, s32, s32);
void func_885008C4(unk_func_88001300*);
void func_8850093C(s32, s32);
void func_88500E34(unk_func_88500E34*, s32, s32, s32, s32, u8*);
void func_88502274(unk_func_88001300_038*, s32, s32, s32, s32);
void func_88503118(unk_func_88001300_02C*, s32, s32, s32, s32);
void func_88504570(unk_func_88001300_03C_01C*, s32, s32, s32, s32, Color_RGBA8);
void func_885054D8(unk_func_88001300_030*, s32, s32, s32, s32, Color_RGBA8);
void func_88505E2C(unk_func_88001300_034*, s32, s32, s32, s32, s32, Color_RGBA8, unk_D_800AC870*);
void func_88506074(unk_func_88001300_034* arg0, char* arg1);
void func_88509A2C(unk_func_88509A2C*, s32, s32, s32, char*);
void func_8850BC94(s32);
void func_8850C284(unk_func_88001300_03C*, s32, s32, MemoryPool*);
void func_8850CB48(unk_func_88001300_03C*, s32, s32);
#endif // _FRAGMENT26_H_

View File

@@ -9,9 +9,9 @@
* order for allocation/freeing.
* Return NULL if there is not enough space in the main pool.
*/
struct MemoryPool* mem_pool_try_init(u32 size, s32 side) {
MemoryPool* mem_pool_try_init(u32 size, s32 side) {
MainPoolBlock* block;
struct MemoryPool* ret;
MemoryPool* ret;
size = ALIGN4(size);
block = main_pool_alloc(size, side);
@@ -28,7 +28,7 @@ struct MemoryPool* mem_pool_try_init(u32 size, s32 side) {
// TODO: This function is strange, it cant be using MemoryPool, as it allocates
// more variables than the MemoryPool struct, and it doesnt line up. Whats going
// on with these structs?
struct MainPool* mem_pool_init(struct MainPool* pool, s32 size) {
MainPool* mem_pool_init(MainPool* pool, s32 size) {
s32 aligned_size =
ALIGN4(size - 3) - 0x28; // whats the deal with 0x28? this size doesnt match any known pool struct.
void* listHeadL = &pool->listHeadL;
@@ -46,7 +46,7 @@ struct MainPool* mem_pool_init(struct MainPool* pool, s32 size) {
/**
* Allocate from a memory pool. Return NULL if there is not enough space.
*/
void* mem_pool_alloc(struct MainPool* node, s32 size) {
void* mem_pool_alloc(MainPool* node, s32 size) {
struct MemoryBlock* freeBlock;
void* addr;
@@ -79,7 +79,7 @@ void* mem_pool_alloc(struct MainPool* node, s32 size) {
/**
* Free a block that was allocated using mem_pool_alloc.
*/
void mem_pool_free(struct MemoryPool* pool, void* addr) {
void mem_pool_free(MemoryPool* pool, void* addr) {
struct MemoryBlock* block;
struct MemoryBlock* freeList;

View File

@@ -26,7 +26,7 @@ typedef struct MainPoolState {
/* 0x0C */ struct MainPoolState *prev;
} MainPoolState;
struct MainPool {
typedef struct MainPool {
/* 0x00 */ OSMesg msgs[1];
/* 0x04 */ OSMesgQueue queue;
/* 0x1C */ size_t available;
@@ -35,7 +35,7 @@ struct MainPool {
/* 0x28 */ MainPoolBlock *listHeadL;
/* 0x2C */ MainPoolBlock *listHeadR;
/* 0x30 */ struct MainPoolState *mainState;
};
} MainPool;
// structs used for the smaller pools allocated from the global pool.
typedef struct MemoryBlock {
@@ -43,13 +43,13 @@ typedef struct MemoryBlock {
/* 0x04 */ u32 size;
} MemoryBlock;
struct MemoryPool {
typedef struct MemoryPool {
/* 0x00 */ OSMesg msgs[1];
/* 0x04 */ OSMesgQueue queue;
/* 0x1C */ size_t available;
/* 0x20 */ struct MemoryBlock *firstBlock;
/* 0x24 */ struct MemoryBlock freeList;
};
} MemoryPool;
// memory_main.c
void main_pool_init(void *start, void *end);
@@ -65,14 +65,14 @@ u32 main_pool_pop_state(u32 arg);
void *main_pool_search(uintptr_t addr, s32 *argPtr);
void main_pool_set_func(void *block, s32 arg, AllocateFunc func);
size_t main_pool_get_block_dist(MainPoolBlock *block);
struct MainPool *main_pool_get_pool(void);
MainPool*main_pool_get_pool(void);
// memory.c
struct MemoryPool *mem_pool_try_init(u32 size, s32 side);
struct MainPool* mem_pool_init(struct MainPool *pool, s32 size);
void *mem_pool_alloc(struct MainPool *node, s32 size);
MemoryPool *mem_pool_try_init(u32 size, s32 side);
MainPool* mem_pool_init(MainPool*pool, s32 size);
void *mem_pool_alloc(MainPool*node, s32 size);
void mem_pool_free(struct MemoryPool* pool, void* addr);
void mem_pool_free(MemoryPool* pool, void* addr);
void *func_80002D10(u32 size, s32 side);
void func_80002D60(struct MemoryBlock* block);
void* func_80002DA4(struct MainPoolState* block, s32 size);

View File

@@ -395,6 +395,6 @@ size_t main_pool_get_block_dist(MainPoolBlock* block) {
/**
* Return the pointer to the static memory pool area.
*/
struct MainPool* main_pool_get_pool(void) {
MainPool* main_pool_get_pool(void) {
return &sMemPool;
}

View File

@@ -12,7 +12,7 @@
*/
u32 gExpansionRAMStart = FALSE;
extern struct MainPool** gMainPool; // gMainPool
extern MainPool** gMainPool; // gMainPool
void func_80003860(void);
s32 func_80007A58(void);
@@ -114,7 +114,7 @@ void Util_DrawRect(Gfx** dlist, s32 ulx, s32 lrx, u16 color) {
* tacked onto the profiler by HAL instead of EAD.
*/
void Util_DrawMemProfiler(Gfx** dlist) {
struct MainPool* pool = main_pool_get_pool(); // get pool pointer
MainPool* pool = main_pool_get_pool(); // get pool pointer
/**
* Get the available memory offset by gExpansionRAMStart variable. This variable is weird; it
* seems to be used in reference to osMemSize checks >= 0x600000 which would only be true

View File

@@ -1118,10 +1118,10 @@
subsegments:
- [0x191660, textbin, fragments/22/fragment22_header]
- [0x191680, c, fragments/22/fragment22]
- [0x193EA0, data, fragments/22/fragment22_data]
- [0x1A8320, rodata, fragments/22/fragment22_rodata]
- [0x193EA0, .data, fragments/22/fragment22]
- [0x1A8320, .rodata, fragments/22/fragment22]
- {vram: 0x88016CF0, type: bss, name: fragments/22/fragment22_bss}
- {vram: 0x88016CF0, type: .bss, name: fragments/22/fragment22}
- name: fragment22_relocs
type: code