Skip to content

Commit

Permalink
Merge pull request #104 from Kelebek1/fragment7
Browse files Browse the repository at this point in the history
fragment7
  • Loading branch information
RevoSucks committed Aug 17, 2024
2 parents 9900f5b + ade09f5 commit 1873068
Show file tree
Hide file tree
Showing 17 changed files with 2,025 additions and 157 deletions.
33 changes: 20 additions & 13 deletions include/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ typedef unsigned int uintptr_t;
#include "sections.h"
#include "gfx.h"
#include "color.h"
#include "math.h"

typedef struct unk_D_86002F58_004_00C_028 {
/* 0x00 */ char pad0[4];
Expand All @@ -37,14 +38,19 @@ typedef struct unk_D_86002F58_004_010 {
/* 0x28 */ s32 unk_28;
} unk_D_86002F58_004_010; // size >= 0x2C

typedef struct unk_func_8001BCF0 {
/* 0x00 */ u8 unk_00;
/* 0x01 */ u8 unk_01;
/* 0x04 */ unk_D_86002F58_004_00C* unk_04;
/* 0x08 */ unk_D_86002F58_004_010* unk_08;
} unk_func_8001BCF0; // size >= 0x0C

typedef struct unk_D_86002F58_004 {
/* 0x000 */ char pad0[1];
/* 0x000 */ u8 unk_000;
/* 0x001 */ u8 unk_001;
/* 0x002 */ u8 unk_002;
/* 0x003 */ char pad3[9];
/* 0x00C */ unk_D_86002F58_004_00C* unk_00C;
/* 0x010 */ unk_D_86002F58_004_010* unk_010;
/* 0x014 */ char unk014[0x4];
/* 0x004 */ unk_func_8001BCF0 unk_004;
/* 0x010 */ char unk010[0x8];
/* 0x018 */ s16 unk_018;
/* 0x01A */ s16 unk_01A;
/* 0x01C */ u8 unk_01C;
Expand Down Expand Up @@ -75,22 +81,19 @@ typedef struct unk_D_86002F58_004 {
/* 0x0AC */ f32 unk_0AC;
/* 0x0B0 */ f32 unk_0B0;
/* 0x0B4 */ char padB4[0xB4];
/* 0x168 */ s16 unk_168;
/* 0x16A */ u16 unk_16A;
/* 0x16C */ s16 unk_16C;
/* 0x16E */ char pad16E[2];
} unk_D_86002F58_004; // size = 0x170
} unk_D_86002F58_004; // size = 0x168

// possibly unk_D_86002F58_004
typedef struct unk_D_86002F34_00C {
/* 0x00 */ char pad00[0x2C];
/* 0x00 */ char pad0[0x2C];
/* 0x2C */ f32 unk_02C;
/* 0x30 */ char pad30[0x4];
/* 0x30 */ char pad30[4];
/* 0x34 */ f32 unk_034;
/* 0x38 */ f32 unk_038;
/* 0x3C */ char pad3C[0x6C];
/* 0xA8 */ f32 unk_0A8;
/* 0xAC */ char padAC[0x8];
/* 0xAC */ f32 unk_0AC;
/* 0xB0 */ f32 unk_0B0;
/* 0xB4 */ f32 unk_0B4;
/* 0xB8 */ f32 unk_0B8;
/* 0xBC */ f32 unk_0BC;
Expand All @@ -101,6 +104,10 @@ typedef struct unk_D_86002F34 {
/* 0x0C */ unk_D_86002F34_00C* unk_0C;
} unk_D_86002F34; // size >= 0x10

typedef struct unk_D_86002F30 {
/* 0x00 */ char unk_00[0x8];
/* 0x08 */ unk_func_8001BCF0** unk_08;
} unk_D_86002F30; // size >= 0xC


#endif
27 changes: 5 additions & 22 deletions include/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "PR/ultratypes.h"

#define M_PI 3.14159265358979323846f
#define M_SQRT2 1.41421356237309504880f
#define M_SQRT1_2 0.70710678118654752440f /* 1/sqrt(2) */
#define FLT_MAX 340282346638528859811704183484516925440.0f
Expand All @@ -21,26 +20,10 @@ typedef union {
};
} MtxF;

typedef union {
f64 d;
struct {
u32 hi;
u32 lo;
} word;
} du;

typedef union {
u32 i;
f32 f;
} fu;

extern f32 __libm_qnan_f;

float fabsf(float f);
#pragma intrinsic(fabsf)
float sqrtf(float f);
#pragma intrinsic(sqrtf)
double sqrt(double d);
#pragma intrinsic(sqrt)
typedef struct {
/* 0x0 */ f32 x;
/* 0x4 */ f32 y;
/* 0x8 */ f32 z;
} Vec3f; // size = 0xC

#endif
11 changes: 10 additions & 1 deletion include/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ extern u32 D_1000000;
extern u32 D_3000000;
extern u32 D_5000000;
extern u32 D_6000000;
extern u32 D_81000000;
extern u32 D_8D000000;

typedef struct unk_D_80068BA0 {
Expand All @@ -35,7 +36,10 @@ typedef struct unk_D_80068BA0 {
/* 0x08 */ u16 unk_08;
} unk_D_80068BA0; // size >= 0xC

extern unk_D_80068BA0* D_80068BA0[4];
extern unk_D_80068BA0* D_80068BA0;
extern unk_D_80068BA0* D_80068BA4;
extern unk_D_80068BA0* D_80068BA8;
extern unk_D_80068BA0* D_80068BAC;
extern Gfx D_8006F518[];
extern Gfx D_8006F630[];

Expand Down Expand Up @@ -102,4 +106,9 @@ 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;

#endif
1 change: 1 addition & 0 deletions src/12D80.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

void func_80015094(unk_D_86002F34*);
void func_80015348(void);
s32 func_80015390(unk_D_86002F58_004*, s16, Vec3f*);


#endif // _12D80_H_
2 changes: 1 addition & 1 deletion src/18480.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "global.h"
#include "src/memory.h"

s32 func_80018B70(MemoryBlock*, uintptr_t);
s32 func_80018B70(MemoryBlock*, void*);


#endif // _18480_H_
48 changes: 24 additions & 24 deletions src/1C720.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void func_8001BBC8(unk_D_86002F58_004* arg0) {
arg0->unk_001 &= ~1;
}

void func_8001BC34(unk_D_86002F58_004* arg0, s16 arg1, s16 arg2, unk_D_86002F58_004* arg3) {
void func_8001BC34(unk_D_86002F58_004* arg0, s16 arg1, s16 arg2, unk_func_8001BCF0* arg3) {
func_80012094(arg0, arg3);
func_8000ED98(&arg0->unk_060);
arg0->unk_018 = arg1;
Expand Down Expand Up @@ -58,12 +58,12 @@ void func_8001BC34(unk_D_86002F58_004* arg0, s16 arg1, s16 arg2, unk_D_86002F58_
}

void func_8001BCF0(unk_D_86002F58_004* arg0) {
arg0->unk_00C = NULL;
arg0->unk_004.unk_08 = NULL;
arg0->unk_001 &= ~1;
}

s32 func_8001BD04(unk_D_86002F58_004* arg0, s32 arg1) {
unk_D_86002F58_004_00C* tmp = arg0->unk_00C;
unk_D_86002F58_004_00C* tmp = arg0->unk_004.unk_08;
unk_D_86002F58_004_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* arg0, s32 arg1) {
}

s32 func_8001BD9C(unk_D_86002F58_004* arg0, s32 arg1) {
unk_D_86002F58_004_00C* temp_v0 = arg0->unk_00C;
unk_D_86002F58_004_00C* temp_v0 = arg0->unk_004.unk_08;
unk_D_86002F58_004_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_00C_028* func_8001BE90(unk_D_86002F58_004* arg0, s32 arg1) {
}

if (arg0 != NULL) {
unk_D_86002F58_004_00C* tmp = arg0->unk_00C;
unk_D_86002F58_004_00C* tmp = arg0->unk_004.unk_08;

var_v1 = tmp->unk_28(arg1, 0);
}
Expand Down Expand Up @@ -140,17 +140,19 @@ void func_8001BEE8(s32* arg0, unk_func_8001BEE8* arg1) {
var_a0 = (arg1->unk_0E >> 8) + arg1->unk_0E;

var_v1 = arg1->unk_30;
while (*var_v1 != 0) {
t = *var_v1++;
var_a0 += t;
}
while (*var_v1 != 0) {
t = *var_v1++;
var_a0 += t;
}

var_v1 = arg1->unk_3B;
while (*var_v1 != 0) {
t = *var_v1++;
var_a0 += t;
do { var_a0 += t; } while (0);
}
while (*var_v1 != 0) {
t = *var_v1++;
var_a0 += t;
do {
var_a0 += t;
} while (0);
}

*(s16*)&sp34 = ((((sp30->unk_12 - sp30->unk_10) << 6) * var_a0) / 255) + (sp30->unk_10 << 6);
}
Expand All @@ -162,10 +164,10 @@ void func_8001BEE8(s32* arg0, unk_func_8001BEE8* arg1) {
#endif

void func_8001C014(s32* arg0, unk_func_8001C014* arg1, u16 arg2) {
unk_func_8001BEE8 stack;
unk_func_8001BEE8 stack;

stack.unk_00 = arg2;
stack.unk_0E = arg1->unk_02;
stack.unk_00 = arg2;
stack.unk_0E = arg1->unk_02;

_bcopy(arg1->unk_04, stack.unk_30, 0x10);
_bcopy(arg1->unk_14, stack.unk_3B, 0x10);
Expand All @@ -174,10 +176,10 @@ void func_8001C014(s32* arg0, unk_func_8001C014* arg1, u16 arg2) {

#ifdef NON_MATCHING
typedef struct stack_func_8001C07C {
/* 0x00 */ s32 unk_00;
/* 0x06 */ s16 unk_06;
/* 0x08 */ s16 unk_08;
/* 0x0C */ s32 unk_0C;
/* 0x00 */ s32 unk_00;
/* 0x06 */ s16 unk_06;
/* 0x08 */ s16 unk_08;
/* 0x0C */ s32 unk_0C;
} stack_func_8001C07C; // size == 0x30

void func_8001C07C(unk_func_8001C07C_arg0* arg0) {
Expand All @@ -195,9 +197,7 @@ void func_8001C07C(unk_func_8001C07C_arg0* arg0) {
}

if (!(arg0->unk_10->unk_00 & 4)) {
while (func_80001C90() == 0) {

}
while (func_80001C90() == 0) {}
}

stack.unk_00 = stack.unk_0C;
Expand Down
2 changes: 1 addition & 1 deletion src/1C720.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ typedef struct unk_func_8001C07C_arg0 {
void func_8001BB20(void);
void func_8001BB58(unk_D_86002F58_004* arg0);
void func_8001BBC8(unk_D_86002F58_004* arg0);
void func_8001BC34(unk_D_86002F58_004* arg0, s16 arg1, s16 arg2, unk_D_86002F58_004* arg3);
void func_8001BC34(unk_D_86002F58_004* arg0, s16 arg1, s16 arg2, unk_func_8001BCF0* arg3);
void func_8001BCF0(unk_D_86002F58_004* arg0);
s32 func_8001BD04(unk_D_86002F58_004* arg0, s32 arg1);
s32 func_8001BD9C(unk_D_86002F58_004* arg0, s32 arg1);
Expand Down
6 changes: 3 additions & 3 deletions src/3FB0.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

#include "global.h"

void* func_80003DC4(uintptr_t romStart, uintptr_t romEnd, s32 arg2, s32 arg3);
s32 func_80004258(s32 id, s32 arg1, s32 arg2, s32 arg3);
void *func_80004454(s32 arg0, uintptr_t romStart, uintptr_t romEnd);
void* func_80003DC4(void* romStart, void* romEnd, s32 arg2, s32 arg3);
s32 func_80004258(s32 id, void* arg1, void* arg2, s32 arg3);
void *func_80004454(s32 arg0, void* romStart, void* romEnd);
void* func_800044F4(uintptr_t romStart, uintptr_t romEnd, s32 arg2, s32 arg3);

#endif // _3FB0_H_
3 changes: 2 additions & 1 deletion src/4BDC0.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

void func_8004B9C4(s32);
void func_8004B1CC(s32);

void func_8004BC84(s32, u32);
u32 func_8004BFB0(void);

#endif // _4BDC0_H_
3 changes: 1 addition & 2 deletions src/E1C0.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "sections.h"
#include "memory.h"
#include "dp_intro.h"
#include "3FB0.h"
#include "util.h"

struct UnkInputStruct8000D738 {
Expand Down Expand Up @@ -38,9 +39,7 @@ void func_81206E64(void);
void func_81206F38(void);

void func_80005370(struct UnkStruct800AA660*);
void func_80004454(u32, void*, void*);
char func_8000B318(char);
s32 func_800044F4(void*, void*, s32, s32);
s32 func_8000484C(s32, s32);

void func_8000D5C0(void* unused) {
Expand Down
4 changes: 2 additions & 2 deletions src/crash_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ void crash_screen_wait_for_button_combo(void) {
do {
Cont_StartReadInputs();
Cont_ReadInputs();
if (D_80068BA0[0]->unk_08 != 0) {
if (D_80068BA0[0]->unk_08 == gCrashScreenUnlockInputs[i++]) {
if (D_80068BA0->unk_08 != 0) {
if (D_80068BA0->unk_08 == gCrashScreenUnlockInputs[i++]) {
// have we reached the end of the array? exit the sleep loop.
if (i == 10) {
breakloop = TRUE;
Expand Down
2 changes: 2 additions & 0 deletions src/fragments/2/fragment2.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ extern u16 D_8780FC96;
extern u16 D_8780FC98;

u32 func_878001E8(s32);
void func_8780024C(s32, s32, s32, s32, s32);
void func_87801290(s32*, s32*, s32, s32, s32);
s32 func_878013D4(s32, s32);
void func_87801644(s32, s16, s16, f32);
void func_87801684(s32, s32, u8*);
void func_87801824(s32, s32, u8*);
void func_87801C8C(s32, s32, s32*);
void func_87801F48(s32, s32, s32);
void func_87802528(void);
void func_878025D0(void);
Expand Down
Loading

0 comments on commit 1873068

Please sign in to comment.