Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fragment2 #114

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions include/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,20 @@ typedef struct unk_D_86002F58_004_000_004 {
/* 0x08 */ unk_D_86002F58_004_000_010* unk_08;
} unk_D_86002F58_004_000_004; // size >= 0x0C

typedef struct unk_D_86002F58_004_000_000 {
/* 0x00 */ u8 unk_00;
/* 0x01 */ u8 unk_01;
/* 0x02 */ u8 unk_02;
/* 0x03 */ u8 unk_03;
/* 0x04 */ struct unk_D_86002F58_004_000_000* unk_04;
/* 0x08 */ struct unk_D_86002F58_004_000_000* unk_08;
/* 0x0C */ unk_D_86002F58_004_000_00C* unk_0C;
/* 0x10 */ s32 unk_10;
/* 0x14 */ s32 unk_14;
} unk_D_86002F58_004_000_000; // size = 0x18

typedef struct unk_D_86002F58_004_000 {
/* 0x000 */ u8 unk_000;
/* 0x001 */ u8 unk_001;
/* 0x002 */ u8 unk_002;
/* 0x003 */ u8 unk_003;
/* 0x004 */ struct unk_D_86002F58_004_000* unk_004;
/* 0x008 */ struct unk_D_86002F58_004_000* unk_008;
/* 0x00C */ unk_D_86002F58_004_000_00C* unk_00C;
/* 0x010 */ s32 unk_010;
/* 0x014 */ s32 unk_014;
/* 0x000 */ unk_D_86002F58_004_000_000 unk_000;
/* 0x018 */ s16 unk_018;
/* 0x01A */ s16 unk_01A;
/* 0x01C */ u8 unk_01C;
Expand Down Expand Up @@ -83,7 +87,6 @@ typedef struct unk_D_86002F58_004_000 {
/* 0x0B4 */ char padB4[0xB4];
} unk_D_86002F58_004_000; // size = 0x168

// possibly unk_D_86002F58_004_000
typedef struct unk_D_86002F34_00C {
/* 0x00 */ char pad0[0x24];
/* 0x24 */ MtxF* unk_024;
Expand Down Expand Up @@ -115,12 +118,6 @@ typedef struct unk_D_86002F30 {
/* 0x08 */ unk_D_86002F58_004_000_004* unk_08[4];
} unk_D_86002F30; // size = 0x18 ??

typedef struct unk_D_800AC840 {
/* 0x00 */ char pad0[0xC];
/* 0x0C */ unk_D_86002F58_004_000* unk_0C;
/* 0x10 */ char pad10[8];
} unk_D_800AC840; // size = 0x18

struct UnkInputStruct8000D738 {
s32 unk0;
s32 unk4;
Expand Down
12 changes: 12 additions & 0 deletions include/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,16 @@
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
#define ALIGN64(val) (((val) + 0x3F) & ~0x3F)

#define DECR(x) ((x) == 0 ? 0 : --(x))

//! checks min first
#define CLAMP(x, min, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x))
//! checks max first
#define CLAMP_ALT(x, min, max) ((x) > (max) ? (max) : (x) < (min) ? (min) : (x))
#define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x))
#define CLAMP_MIN(x, min) ((x) < (min) ? (min) : (x))

#define ABS(x) ((x) >= 0 ? (x) : -(x))
#define ABS_ALT(x) ((x) < 0 ? -(x) : (x))

#endif
4 changes: 2 additions & 2 deletions include/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ typedef union {
};
} MtxF;

typedef struct {
typedef struct Vec3f {
/* 0x0 */ f32 x;
/* 0x4 */ f32 y;
/* 0x8 */ f32 z;
} Vec3f; // size = 0xC

typedef struct {
typedef struct Vec3s {
/* 0x0 */ s16 x;
/* 0x2 */ s16 y;
/* 0x4 */ s16 z;
Expand Down
35 changes: 24 additions & 11 deletions include/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ extern u32 D_81000000;
extern u32 D_8D000000;

typedef struct unk_D_80068BA0 {
/* 0x00 */ char pad00[6];
/* 0x00 */ char pad00[0x4];
/* 0x04 */ s16 unk_04;
/* 0x06 */ u16 unk_06;
/* 0x08 */ u16 unk_08;
/* 0x0A */ char pad0A[0x2];
} unk_D_80068BA0; // size >= 0xC

extern unk_D_80068BA0* D_80068BA0;
Expand Down Expand Up @@ -95,13 +97,13 @@ typedef struct unk_D_800A7440 {
} unk_D_800A7440; // size >= 0x8
extern unk_D_800A7440 D_800A7440;

extern struct unk_D_800AC840 D_800AC840;
extern struct unk_D_800AC840 D_800AC858;
extern struct unk_D_86002F58_004_000_000 D_800AC840;
extern struct unk_D_86002F58_004_000_000 D_800AC858;
extern struct unk_D_86002F58_004_000* D_8006F09C;

extern s32 D_8006F050[];
extern s16 D_8006F05C[];
extern f32 D_8006F064[];
extern struct Vec3f D_8006F050;
extern struct Vec3s D_8006F05C;
extern struct Vec3f D_8006F064;

typedef struct unk_D_8006FF00 {
/* 0x00 */ char unk_00[0x10];
Expand All @@ -111,11 +113,6 @@ typedef struct unk_D_8006FF00 {
} unk_D_8006FF00; // size = 0x1C
extern unk_D_8006FF00 D_8006FF00[];

extern s16 D_8780FA2C;
extern s16 D_8780FA32;
extern s16 D_8780FA34;
extern s16 D_8780FA36;

typedef struct unk_D_800AC870_sub {
/* 0x00 */ s16 unk_00;
/* 0x02 */ s16 unk_02;
Expand Down Expand Up @@ -199,4 +196,20 @@ typedef struct unk_D_800FC798 {
} unk_D_800FC798; // size >= 0xC
extern unk_D_800FC798* D_800FC798;

typedef struct unk_D_800A6CF4 {
/* 0x00 */ char unk00[0x20];
/* 0x20 */ s32 unk_20;
} unk_D_800A6CF4; // size = 0x24
extern unk_D_800A6CF4 D_800A6CF4;

extern Mtx D_8006F010;
extern u32 D_3010000;
extern u32 D_3016E80;
extern u32 D_30200C0;
extern u32 D_3004000;
extern u32 D_3008000;
extern u32 D_300C000;
extern u32 D_1003E78[];
extern u32 D_304F120[];

#endif
6 changes: 4 additions & 2 deletions linker_scripts/us/symbol_addrs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ gSIEventMesgBuf = 0x800A73F8;
gEepromMesgQueue = 0x800A7400;
gEepromMesgBuf = 0x800A73FC;
.L8120A860 = 0x8120A860;
D_8780FA30 = 0x8780FA30;
D_8780FA34 = 0x8780FA34;
D_8780FA30 = 0x8780FA30; // size:0x8
D_87906044 = 0x87906044;
D_87906048 = 0x87906048;
D_87906060 = 0x87906060;
Expand Down Expand Up @@ -241,3 +240,6 @@ D_87A01190 = 0x87A01190;
D_87A011A4 = 0x87A011A4;
D_800A7428 = 0x800A7428;
D_80079014 = 0x80079014;
D_3004000 = 0x3004000;
D_8780FCB8 = 0x8780FCB8; // size:0x20
D_8780FA68 = 0x8780FA68; // size:0x8
52 changes: 26 additions & 26 deletions src/11BA0.c
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
#include "global.h"
#include "11BA0.h"

void func_80010FA0(unk_D_86002F58_004_000* arg0, u8 arg1) {
void func_80010FA0(unk_D_86002F58_004_000_000* arg0, u8 arg1) {
if (arg0 != NULL) {
arg0->unk_000 = arg1;
arg0->unk_001 = 0x11;
arg0->unk_002 = 0;
arg0->unk_003 = 0;
arg0->unk_004 = arg0;
arg0->unk_008 = arg0;
arg0->unk_00C = NULL;
arg0->unk_010 = 0;
arg0->unk_014 = 0;
arg0->unk_00 = arg1;
arg0->unk_01 = 0x11;
arg0->unk_02 = 0;
arg0->unk_03 = 0;
arg0->unk_04 = arg0;
arg0->unk_08 = arg0;
arg0->unk_0C = NULL;
arg0->unk_10 = 0;
arg0->unk_14 = 0;
}
}

#pragma GLOBAL_ASM("asm/us/nonmatchings/11BA0/func_80010FDC.s")

unk_D_86002F58_004_000* func_8001103C(MainPoolState* arg0, void* arg1) {
unk_D_86002F58_004_000_000* func_8001103C(MainPoolState* arg0, void* arg1) {
if (arg0 != 0) {
arg1 = func_80002DCC(arg0, 0x18, 4);
arg1 = func_80002DCC(arg0, sizeof(unk_D_86002F58_004_000_000), 4);
}

if (arg1 != NULL) {
Expand Down Expand Up @@ -67,10 +67,10 @@ unk_D_86002F58_004_000* func_8001103C(MainPoolState* arg0, void* arg1) {

#pragma GLOBAL_ASM("asm/us/nonmatchings/11BA0/func_800118D0.s")

unk_D_86002F58_004_000* func_80011938(s32 arg0, unk_D_86002F58_004_000* arg1, s16 arg2, Vec3f* arg3, Vec3s* arg4,
Vec3f* arg5) {
unk_D_86002F58_004_000* func_80011938(MainPoolState* arg0, unk_D_86002F58_004_000* arg1, s16 arg2, Vec3f* arg3,
Vec3s* arg4, Vec3f* arg5) {
if (arg0 != 0) {
arg1 = func_80002DCC(arg0, 0x168, 4);
arg1 = func_80002DCC(arg0, sizeof(unk_D_86002F58_004_000), 4);
}

if (arg1 != NULL) {
Expand All @@ -93,8 +93,8 @@ unk_D_86002F58_004_000* func_80011938(s32 arg0, unk_D_86002F58_004_000* arg1, s1
arg1->unk_058 = 0;
arg1->unk_05C = 0;
arg1->unk_05E = 0;
func_80010FA0(arg1, 0x16);
arg1->unk_002 |= 0x60;
func_80010FA0(&arg1->unk_000, 0x16);
arg1->unk_000.unk_02 |= 0x60;
}

return arg1;
Expand Down Expand Up @@ -124,21 +124,21 @@ unk_D_86002F58_004_000* func_80011938(s32 arg0, unk_D_86002F58_004_000* arg1, s1

#pragma GLOBAL_ASM("asm/us/nonmatchings/11BA0/func_80012044.s")

void func_80012094(unk_D_800AC840* arg0, unk_D_86002F58_004_000* arg1) {
unk_D_86002F58_004_000* temp_v0;
unk_D_86002F58_004_000_004* temp_v1;
void func_80012094(unk_D_86002F58_004_000_000* arg0, unk_D_86002F58_004_000_000* arg1) {
unk_D_86002F58_004_000_000* temp_v0;
unk_D_86002F58_004_000_000* temp_v1;

if ((arg0 != NULL) && (arg1 != NULL)) {
temp_v0 = arg0->unk_0C;
if (temp_v0 == NULL) {
arg0->unk_0C = arg1;
arg1->unk_004 = arg1;
arg1->unk_008 = arg1;
arg1->unk_04 = arg1;
arg1->unk_08 = arg1;
} else {
temp_v1 = temp_v0->unk_004;
arg1->unk_008 = temp_v0;
arg1->unk_004 = temp_v1;
temp_v0->unk_004 = arg1;
temp_v1 = temp_v0->unk_04;
arg1->unk_08 = temp_v0;
arg1->unk_04 = temp_v1;
temp_v0->unk_04 = arg1;
temp_v1->unk_08 = arg1;
}
}
Expand Down
12 changes: 9 additions & 3 deletions src/11BA0.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
#include "global.h"
#include "src/memory.h"

unk_D_86002F58_004_000* func_8001103C(MainPoolState*, void*);
unk_D_86002F58_004_000* func_80011938(s32 arg0, unk_D_86002F58_004_000* arg1, s16 arg2, Vec3f* arg3, Vec3s* arg4, Vec3f* arg5);
void func_80012094(unk_D_800AC840*, unk_D_86002F58_004_000*);
typedef struct unk_func_80011B94 {
/* 0x00 */ unk_D_86002F58_004_000_000 unk_00;
/* 0x18 */ Gfx* unk_18;
} unk_func_80011B94; // size = 0x1C

unk_D_86002F58_004_000_000* func_8001103C(MainPoolState*, void*);
unk_D_86002F58_004_000* func_80011938(MainPoolState* arg0, unk_D_86002F58_004_000* arg1, s16 arg2, Vec3f* arg3, Vec3s* arg4, Vec3f* arg5);
unk_func_80011B94* func_80011B94(MainPoolState*, void*, s32, Gfx*);
void func_80012094(unk_D_86002F58_004_000_000*, unk_D_86002F58_004_000_000*);


#endif // _11BA0_H_
36 changes: 18 additions & 18 deletions src/1C720.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,33 @@ void func_8001BB20(void) {
}

void func_8001BB58(unk_D_86002F58_004_000* arg0) {
func_80011938(0, arg0, 0, D_8006F050, D_8006F05C, D_8006F064);
func_80012094(&D_800AC840, arg0);
func_80011938(NULL, arg0, 0, &D_8006F050, &D_8006F05C, &D_8006F064);
func_80012094(&D_800AC840, &arg0->unk_000);
arg0->unk_0A6 = 0;
arg0->unk_001 &= ~1;
arg0->unk_000.unk_01 &= ~1;
}

void func_8001BBC8(unk_D_86002F58_004_000* arg0) {
func_80011938(0, arg0, 0, D_8006F050, D_8006F05C, D_8006F064);
func_80012094(&D_800AC858, arg0);
arg0->unk_001 &= ~1;
func_80011938(NULL, arg0, 0, &D_8006F050, &D_8006F05C, &D_8006F064);
func_80012094(&D_800AC858, &arg0->unk_000);
arg0->unk_000.unk_01 &= ~1;
}

void func_8001BC34(unk_D_86002F58_004_000* arg0, s16 arg1, s16 arg2, unk_D_86002F58_004_000_004* arg3) {
func_80012094(arg0, arg3);
func_80012094(&arg0->unk_000, arg3);
func_8000ED98(&arg0->unk_060);
arg0->unk_018 = arg1;
arg0->unk_01A = arg2;

arg0->unk_01D = 0xFF;
arg0->unk_01C = 0;

arg0->unk_001 |= 0x1;
arg0->unk_000.unk_01 |= 0x1;

arg0->unk_002 &= ~0x4;
arg0->unk_002 |= 0x20;
arg0->unk_002 |= 0x40;
arg0->unk_002 &= ~0x2;
arg0->unk_000.unk_02 &= ~0x4;
arg0->unk_000.unk_02 |= 0x20;
arg0->unk_000.unk_02 |= 0x40;
arg0->unk_000.unk_02 &= ~0x2;

arg0->unk_0A0 = -0x100;
arg0->unk_03C = -0x100;
Expand All @@ -50,20 +50,20 @@ void func_8001BC34(unk_D_86002F58_004_000* arg0, s16 arg1, s16 arg2, unk_D_86002
arg0->unk_054 = -1;
arg0->unk_058 = 0;

arg0->unk_002 &= ~0x8;
arg0->unk_000.unk_02 &= ~0x8;

if (arg2 > 0) {
func_8003260C(arg0);
}
}

void func_8001BCF0(unk_D_86002F58_004_000* arg0) {
arg0->unk_00C = NULL;
arg0->unk_001 &= ~1;
arg0->unk_000.unk_0C = NULL;
arg0->unk_000.unk_01 &= ~1;
}

s32 func_8001BD04(unk_D_86002F58_004_000* arg0, s32 arg1) {
unk_D_86002F58_004_000_00C* tmp = arg0->unk_00C;
unk_D_86002F58_004_000_00C* tmp = arg0->unk_000.unk_0C;
unk_D_86002F58_004_000_00C_028* temp_v0 = tmp->unk_28(0, 0);

if (arg1 == -1) {
Expand All @@ -77,7 +77,7 @@ s32 func_8001BD04(unk_D_86002F58_004_000* arg0, s32 arg1) {
}

s32 func_8001BD9C(unk_D_86002F58_004_000* arg0, s32 arg1) {
unk_D_86002F58_004_000_00C* temp_v0 = arg0->unk_00C;
unk_D_86002F58_004_000_00C* temp_v0 = arg0->unk_000.unk_0C;
unk_D_86002F58_004_000_00C_028* temp_v1 = temp_v0->unk_28(0, 0);

if (arg1 == -1) {
Expand Down Expand Up @@ -110,7 +110,7 @@ unk_D_86002F58_004_000_00C_028* func_8001BE90(unk_D_86002F58_004_000* arg0, s32
}

if (arg0 != NULL) {
unk_D_86002F58_004_000_00C* tmp = arg0->unk_00C;
unk_D_86002F58_004_000_00C* tmp = arg0->unk_000.unk_0C;

var_v1 = tmp->unk_28(arg1, 0);
}
Expand Down
Loading
Loading