Skip to content

Commit

Permalink
Match 34% of sislib (#1421)
Browse files Browse the repository at this point in the history
* 34%

* un-regress `mnDeflicker_8024A4BC`

* prevent accidental struct duplication across TUs
  • Loading branch information
thefoxcam authored Aug 11, 2024
1 parent e6b188c commit b3241f8
Show file tree
Hide file tree
Showing 5 changed files with 2,124 additions and 38 deletions.
17 changes: 6 additions & 11 deletions src/melee/mn/mndeflicker.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ typedef struct {
void* x4;
} gobj_user_data;

struct sislib_idk {
float idk[40];
};

extern struct {
unsigned char x0;
char x1;
Expand Down Expand Up @@ -94,7 +90,6 @@ void gmMainLib_8015F588(u8);
void lbAudioAx_80024030(int);
int lb_80011E24(HSD_JObj*, HSD_JObj**, ...);
void lb_8001CE00(void);
void HSD_SisLib_803A5CC4(void*);
void lb_8001CE00(void);
u8 gmMainLib_8015F4E8(void);

Expand Down Expand Up @@ -198,16 +193,16 @@ void mnDeflicker_8024A3E8(HSD_GObj* gobj)
#define GET_GOBJ_USER_DATA(gobj) ((gobj_user_data*) HSD_GObjGetUserData(gobj))
static inline void inline_test(void)
{
struct sislib_idk* temp_r3_6;
sislib_UnkAllocReturn* temp_r3_6;
gobj_user_data* user_data = GET_GOBJ_USER_DATA(mnDeflicker_804D6C38);
if (user_data->x4) {
HSD_SisLib_803A5CC4(user_data->x4);
}
temp_r3_6 = (struct sislib_idk*) HSD_SisLib_803A5ACC(
0, 1, -9.5F, 9.1F, 17.0F, 364.68332F, 38.38772F);
temp_r3_6 =
HSD_SisLib_803A5ACC(0, 1, -9.5F, 9.1F, 17.0F, 364.68332F, 38.38772F);
user_data->x4 = temp_r3_6;
temp_r3_6->idk[9] = 0.0521F;
temp_r3_6->idk[10] = 0.0521F;
temp_r3_6->x24.x = 0.0521F;
temp_r3_6->x24.y = 0.0521F;
HSD_SisLib_803A6368(temp_r3_6, 0xBD);
}

Expand All @@ -220,8 +215,8 @@ void mnDeflicker_8024A4BC(HSD_GObj* arg0)
HSD_GObjProc* proc;
HSD_JObj* jobj;
u8 temp_r29;
struct sislib_idk* temp_r3_6;
gobj_user_data* user_data;
PAD_STACK(4);

gobj = GObj_Create(HSD_GOBJ_CLASS_ITEM, 7U, 0x80);
mnDeflicker_804D6C38 = gobj;
Expand Down
15 changes: 5 additions & 10 deletions src/melee/mn/mnhyaku.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ void mnHyaku_8024CD64(u8);

extern HSD_GObj* mnHyaku_804D6C58;

void HSD_SisLib_803A5CC4(void*);
s32 mn_80229624(s32);
s32 mn_80229894(s32, s32, s32);
float mn_8022EC18(HSD_JObj*, float*, int);
Expand Down Expand Up @@ -73,10 +72,6 @@ extern struct {
char x11;
} mn_804A04F0;

struct sislib_idk {
float idk[40];
};

static inline void mnHyaku_8024C68C_inline(HSD_JObj* jobj, s32 val)
{
f32 temp_f31 = mn_8022F298(jobj);
Expand All @@ -89,6 +84,7 @@ static inline void mnHyaku_8024C68C_inline(HSD_JObj* jobj, s32 val)

static u8 vals[] = { 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0x00, 0x00 };

// @todo: this is a common inline in mn
#define GET_GOBJ_USER_DATA(gobj) ((gobj_user_data*) HSD_GObjGetUserData(gobj))
static inline void mnHyaku_8024C68C_inline_2(HSD_GObj* gobj)
{
Expand All @@ -98,12 +94,11 @@ static inline void mnHyaku_8024C68C_inline_2(HSD_GObj* gobj)
}
{
u8 val = vals[user_data->x0];
struct sislib_idk* temp_r3_6 =
(struct sislib_idk*) HSD_SisLib_803A5ACC(0, 1, -9.5F, 9.1F, 17.0F,
364.68332F, 38.38772F);
sislib_UnkAllocReturn* temp_r3_6 = HSD_SisLib_803A5ACC(
0, 1, -9.5F, 9.1F, 17.0F, 364.68332F, 38.38772F);
user_data->x4 = temp_r3_6;
temp_r3_6->idk[9] = 0.0521F;
temp_r3_6->idk[10] = 0.0521F;
temp_r3_6->x24.x = 0.0521F;
temp_r3_6->x24.y = 0.0521F;
HSD_SisLib_803A6368(temp_r3_6, val);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/sysdolphin/baselib/gobj.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ extern HSD_GObjProc* HSD_GObj_804D7838;
extern HSD_GObjProc** HSD_GObj_804D7840;
extern s32 HSD_GObj_804D7834;
extern s32 HSD_GObj_804D783C;
extern HSD_GObj* HSD_SisLib_804D797C;
// extern HSD_GObj* HSD_SisLib_804D797C; @todo: is this actually correct?
extern HSD_GObj** HSD_GObj_804D7820;
extern HSD_GObj** HSD_GObj_804D7824;
extern HSD_GObjLibInitDataType HSD_GObjLibInitData;
Expand Down
Loading

0 comments on commit b3241f8

Please sign in to comment.