Skip to content

Commit

Permalink
Merge pull request #493 from abnormalhare/main
Browse files Browse the repository at this point in the history
match m418Dll
  • Loading branch information
Rainchus authored Dec 30, 2024
2 parents 70971b5 + 99e5615 commit 732e9ff
Show file tree
Hide file tree
Showing 7 changed files with 412 additions and 146 deletions.
11 changes: 10 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"*.s": "plaintext",
"*.json": "jsonc",
"*.c": "c",
"*.asm": "masm",
"*.inc": "c",
".clangd": "yaml",
"m443dll.h": "c",
Expand All @@ -25,7 +26,15 @@
"m438dll.h": "c",
"audio.h": "c",
"musyx.h": "c",
"math.h": "c"
"math.h": "c",
"m418dll.h": "c",
"ext_math.h": "c",
"mtx.h": "c",
"types.h": "c",
"corecrt_math.h": "c",
"corecrt.h": "c",
"vcruntime.h": "c",
"hsfmotion.h": "c"
},
"search.useIgnoreFiles": false,
"search.exclude": {
Expand Down
256 changes: 128 additions & 128 deletions config/GMPE01_00/rels/m418Dll/symbols.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion config/GMPE01_00/rels/m438Dll/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ lbl_1_data_8C8 = .data:0x000008C8; // type:object size:0x9 data:string
lbl_1_data_8D1 = .data:0x000008D1; // type:object size:0x7 data:string
lbl_1_data_8D8 = .data:0x000008D8; // type:object size:0x60
lbl_1_data_938 = .data:0x00000938; // type:object size:0xB data:string
lbl_1_bss_0 = .bss:0x00000000; // type:object size:0x4 data:4byte
lbl_1_bss_0 = .bss:0x00000000; // type:object size:0x4 scope:local data:4byte
lbl_1_bss_4 = .bss:0x00000004; // type:object size:0x4 data:4byte
lbl_1_bss_8 = .bss:0x00000008; // type:object size:0x4 data:4byte
lbl_1_bss_C = .bss:0x0000000C; // type:object size:0x288
Expand Down
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ def MatchingFor(*versions):
"m418Dll", # Hide and Go BOOM!
objects={
Object(MatchingFor("GMPE01_00", "GMPE01_01"), "REL/m418Dll/main.c"),
Object(NonMatching, "REL/m418Dll/sequence.c"),
Object(MatchingFor("GMPE01_00", "GMPE01_01"), "REL/m418Dll/sequence.c"),
},
),
Rel(
Expand Down
27 changes: 17 additions & 10 deletions include/REL/m418Dll.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

#include "dolphin.h"

#include "ext_math.h"
#include "game/hsfmotion.h"
#include "game/object.h"

typedef void (*M418DllFunc)(void);
typedef s32 (*M418DllRetFunc)(void);
typedef void (*M418DllInFunc)(s32);
Expand All @@ -11,33 +15,36 @@ typedef s32 (*M418DllInRetFunc)(s32);
typedef struct M418DllUnkStruct {
M418DllFunc unk0;
Vec center;
char unk10[0xC];
Vec unk10; // sequence center
Vec rot;
char unk28[0xC];
Vec unk28; // sequence rot
f32 zoom;
char unk38[0x4];
f32 unk38; // sequence zoom
f32 unk3C[3];
f32 unk48;
} M418DllUnkStruct; // sizeof 0x4C

typedef struct M418DllUnkStruct7 {
char unk[0x10];
M418DllFunc unk10;
M418DllRetFunc unk14;
} M418DllUnkStruct7; // sizeof 0x18

typedef struct M418DllUnkStruct8 {
M418DllInFunc unk0;
M418DllInRetFunc unk4;
s32 unk8;
} M418DllUnkStruct8; // sizeof 0x24

typedef struct M418DllUnkStruct7 {
s32 unk0;
M418DllUnkStruct8* unk4;
s32 unk8;
s32 unkC;
M418DllFunc unk10;
M418DllRetFunc unk14;
} M418DllUnkStruct7; // sizeof 0x18

f32 fn_1_A920(f32, f32, f32);
f32 fn_1_A940(f32, f32, f32, f32);
f32 fn_1_AA30(f32, f32, f32, f32);
void fn_1_ABC4(omObjData*, s32, s32, s32, s32);
void fn_1_AD14(omObjData*, s32, s32, s32, s32);
void fn_1_AEDC(M418DllUnkStruct7*, M418DllUnkStruct8**);
void fn_1_AEDC(M418DllUnkStruct7*, M418DllUnkStruct8*);
s32 fn_1_AF38(M418DllUnkStruct7*);
s32 fn_1_B034(M418DllUnkStruct7*, s32);
s32 fn_1_B0C8(M418DllUnkStruct7*, s32);
Expand Down
8 changes: 3 additions & 5 deletions src/REL/m418Dll/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
#include "ext_math.h"
#include "game/chrman.h"
#include "game/hsfman.h"
#include "game/hsfmotion.h"
#include "game/minigame_seq.h"
#include "game/object.h"
#include "game/objsub.h"
#include "game/pad.h"
#include "game/wipe.h"
Expand Down Expand Up @@ -1377,7 +1375,7 @@ M418DllUnkStruct8 lbl_1_data_294[3] = {
};

void fn_1_5D28(void) {
fn_1_AEDC(&lbl_1_bss_50, (M418DllUnkStruct8**)&lbl_1_data_294);
fn_1_AEDC(&lbl_1_bss_50, &lbl_1_data_294[0]);
}

s32 fn_1_5D58(void) {
Expand Down Expand Up @@ -2155,7 +2153,7 @@ M418DllUnkStruct8 lbl_1_data_348[11] = {
};

void fn_1_8480(void) {
fn_1_AEDC(&lbl_1_bss_38, (M418DllUnkStruct8**)&lbl_1_data_348);
fn_1_AEDC(&lbl_1_bss_38, &lbl_1_data_348[0]);
}

s32 fn_1_84B0(void) {
Expand Down Expand Up @@ -2527,7 +2525,7 @@ M418DllUnkStruct8 lbl_1_data_444[8] = {
};

void fn_1_9334(void) {
fn_1_AEDC(&lbl_1_bss_20, (M418DllUnkStruct8**)&lbl_1_data_444);
fn_1_AEDC(&lbl_1_bss_20, &lbl_1_data_444[0]);
}

s32 fn_1_9364(void) {
Expand Down
252 changes: 252 additions & 0 deletions src/REL/m418Dll/sequence.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
#include "REL/m418Dll.h"

f32 fn_1_A920(f32 arg0, f32 arg1, f32 arg2) {
return (arg1 + (arg0 * (arg2 - 1.0f))) / arg2;
}

f32 fn_1_A940(f32 arg0, f32 arg1, f32 arg2, f32 arg3) {
if (arg2 >= arg3) {
return arg1;
}
return arg0 + ((arg2 / arg3) * (arg1 - arg0));
}

f32 fn_1_A968(f32 arg8, f32 arg9, f32 argA, f32 argB) {
if (argA >= argB) {
return arg9;
}
return arg8 + (arg9 - arg8) * sind(((90.0f / argB) * argA));
}

f32 fn_1_AA30(f32 arg0, f32 arg1, f32 arg2, f32 arg3) {
if (arg2 >= arg3) {
return arg0;
}
return arg0 + (arg1 - arg0) * sind((180.0f / arg3) * arg2);
}

f32 fn_1_AAEC(f32 arg8, f32 arg9, f32 argA, f32 argB) {
if (argA >= argB) {
return arg9;
}
return (arg8 + (arg9 - arg8) * (1.0 - cosd((90.0f / argB) * argA)));
}

void fn_1_ABC4(omObjData* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
if (arg4 == 1) {
Hu3DMotionShiftSet(arg0->model[arg1], arg0->motion[arg2], 0.0f, arg3, 0x40000001);
return;
}
if (arg4 == 2) {
Hu3DMotionShiftSet(arg0->model[arg1], arg0->motion[arg2], 0.0f, arg3, 0x40000002);
return;
}
Hu3DMotionShiftSet(arg0->model[arg1], arg0->motion[arg2], 0.0f, arg3, 0);
}

void fn_1_AD14(omObjData* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
if (arg0->work[3] != arg0->motion[arg2]) {
arg0->work[3] = arg0->motion[arg2];
if (arg4 == 1) {
Hu3DMotionShiftSet(arg0->model[arg1], arg0->motion[arg2], 0.0f, arg3, 0x40000001);
return;
}
if (arg4 == 2) {
Hu3DMotionShiftSet(arg0->model[arg1], arg0->motion[arg2], 0.0f, arg3, 0x40000002);
return;
}
Hu3DMotionShiftSet(arg0->model[arg1], arg0->motion[arg2], 0.0f, arg3, 0);
}
}

void fn_1_AE8C(M418DllUnkStruct7* arg0) {
arg0->unk8 = 0;
arg0->unkC = arg0->unk4[arg0->unk0].unk8;
arg0->unk10 = (M418DllFunc)arg0->unk4[arg0->unk0].unk0;
arg0->unk14 = (M418DllRetFunc)arg0->unk4[arg0->unk0].unk4;
}

void fn_1_AEDC(M418DllUnkStruct7* arg0, M418DllUnkStruct8* arg1) {
arg0->unk0 = 0;
arg0->unk4 = arg1;
fn_1_AE8C(arg0);
}

s32 fn_1_AF38(M418DllUnkStruct7* arg0) {
arg0->unk0++;
fn_1_AE8C(arg0);
if ((arg0->unk10 == NULL) && (arg0->unk14 == NULL)) {
return 1;
}
return 0;
}

s32 fn_1_AFC0(M418DllUnkStruct7* arg0) {
arg0->unk0--;
if (arg0->unk0 < 0) {
return 1;
}
fn_1_AE8C(arg0);
return 0;
}

s32 fn_1_B034(M418DllUnkStruct7* arg0, s32 arg1) {
arg0->unk0 = arg1;
if (arg0->unk0 < 0) {
return 1;
}
fn_1_AE8C(arg0);
if ((arg0->unk10 == NULL) && (arg0->unk14 == NULL)) {
return 1;
}
return 0;
}

s32 fn_1_B0C8(M418DllUnkStruct7* arg0, s32 arg1) {
if (arg1 == 0) {
return arg0->unk8;
}
arg0->unk8 += arg1;
if (arg0->unk8 >= arg0->unkC) {
return 1;
}
return 0;
}

void fn_1_B104(M418DllUnkStruct* arg0, Vec arg1, Vec arg2) {
f32 temp_f31;
f32 temp_f30;
f32 temp_f29;
f32 temp_f27;

temp_f31 = arg1.x - arg2.x;
temp_f29 = arg1.y - arg2.y;
temp_f30 = arg1.z - arg2.z;
arg0->unk10.x = arg2.x;
arg0->unk10.y = arg2.y;
arg0->unk10.z = arg2.z;
arg0->unk38 = sqrtf((temp_f30 * temp_f30) + ((temp_f31 * temp_f31) + (temp_f29 * temp_f29)));
temp_f27 = atan2d(temp_f30, temp_f31);
arg0->unk28.x = -atan2d(temp_f29, (temp_f31 * cosd(-temp_f27)) + (temp_f30 * -sind(-temp_f27)));
arg0->unk28.y = -(temp_f27 - 90.0f);
arg0->unk28.z = 0.0f;
}

void fn_1_B41C(M418DllUnkStruct* arg0) {
arg0->center.x = arg0->unk10.x;
arg0->center.y = arg0->unk10.y;
arg0->center.z = arg0->unk10.z;
arg0->rot.x = arg0->unk28.x;
arg0->rot.y = arg0->unk28.y;
arg0->rot.z = arg0->unk28.z;
arg0->zoom = arg0->unk38;
}

void fn_1_B458(M418DllUnkStruct* arg0) {
arg0->unk48 = 0.0f;
arg0->unk10.x = arg0->center.x;
arg0->unk10.y = arg0->center.y;
arg0->unk10.z = arg0->center.z;
arg0->unk28.x = arg0->rot.x;
arg0->unk28.y = arg0->rot.y;
arg0->unk28.z = arg0->rot.z;
arg0->unk38 = arg0->zoom;
}

void fn_1_B4A4(M418DllUnkStruct* arg0, M418DllUnkStruct* arg1, f32 arg8) {
arg0->center.x = fn_1_A920(arg0->center.x, arg1->unk10.x, arg8);
arg0->center.y = fn_1_A920(arg0->center.y, arg1->unk10.y, arg8);
arg0->center.z = fn_1_A920(arg0->center.z, arg1->unk10.z, arg8);
arg0->rot.x = fn_1_A920(arg0->rot.x, arg1->unk28.x, arg8);
arg0->rot.y = fn_1_A920(arg0->rot.y, arg1->unk28.y, arg8);
arg0->rot.z = fn_1_A920(arg0->rot.z, arg1->unk28.z, arg8);
arg0->zoom = fn_1_A920(arg0->zoom, arg1->unk38, arg8);
}

void fn_1_B710(M418DllUnkStruct* arg0, f32 arg1) {
arg0->center.x = fn_1_A920(arg0->center.x, arg0->unk10.x, arg1);
arg0->center.y = fn_1_A920(arg0->center.y, arg0->unk10.y, arg1);
arg0->center.z = fn_1_A920(arg0->center.z, arg0->unk10.z, arg1);
arg0->rot.x = fn_1_A920(arg0->rot.x, arg0->unk28.x, arg1);
arg0->rot.y = fn_1_A920(arg0->rot.y, arg0->unk28.y, arg1);
arg0->rot.z = fn_1_A920(arg0->rot.z, arg0->unk28.z, arg1);
arg0->zoom = fn_1_A920(arg0->zoom, arg0->unk38, arg1);
}

void fn_1_B97C(M418DllUnkStruct* arg0, M418DllUnkStruct* arg1, f32 arg8, f32 arg9) {
arg1->unk10.x = fn_1_A940(arg0->unk10.x, arg1->center.x, arg8, arg9);
arg1->unk10.y = fn_1_A940(arg0->unk10.y, arg1->center.y, arg8, arg9);
arg1->unk10.z = fn_1_A940(arg0->unk10.z, arg1->center.z, arg8, arg9);
arg1->unk28.x = fn_1_A940(arg0->unk28.x, arg1->rot.x, arg8, arg9);
arg1->unk28.y = fn_1_A940(arg0->unk28.y, arg1->rot.y, arg8, arg9);
arg1->unk28.z = fn_1_A940(arg0->unk28.z, arg1->rot.z, arg8, arg9);
arg1->unk38 = fn_1_A940(arg0->unk38, arg1->zoom, arg8, arg9);
}

void fn_1_BBF8(M418DllUnkStruct* arg0, M418DllUnkStruct* arg1, f32 arg8, f32 arg9) {
fn_1_B97C(arg0, arg1, arg8, arg9);
arg0->center.x = arg1->unk10.x;
arg0->center.y = arg1->unk10.y;
arg0->center.z = arg1->unk10.z;
arg0->rot.x = arg1->unk28.x;
arg0->rot.y = arg1->unk28.y;
arg0->rot.z = arg1->unk28.z;
arg0->zoom = arg1->unk38;
}

void fn_1_BEAC(M418DllUnkStruct* arg0, M418DllUnkStruct* arg1, f32 arg2, f32 arg3, f32 arg4) {
fn_1_B97C(arg0, arg1, arg2, arg3);
fn_1_B4A4(arg0, arg1, arg4);
}

void fn_1_C318(M418DllUnkStruct* arg0, M418DllUnkStruct* arg1, f32 arg8, f32 arg9) {
arg1->unk10.x = fn_1_A968(arg0->unk10.x, arg1->center.x, arg8, arg9);
arg1->unk10.y = fn_1_A968(arg0->unk10.y, arg1->center.y, arg8, arg9);
arg1->unk10.z = fn_1_A968(arg0->unk10.z, arg1->center.z, arg8, arg9);
arg1->unk28.x = fn_1_A968(arg0->unk28.x, arg1->rot.x, arg8, arg9);
arg1->unk28.y = fn_1_A968(arg0->unk28.y, arg1->rot.y, arg8, arg9);
arg1->unk28.z = fn_1_A968(arg0->unk28.z, arg1->rot.z, arg8, arg9);
arg1->unk38 = fn_1_A968(arg0->unk38, arg1->zoom, arg8, arg9);
}

void fn_1_C76C(M418DllUnkStruct* arg0, M418DllUnkStruct* arg1, f32 arg8, f32 arg9) {
fn_1_C318(arg0, arg1, arg8, arg9);
arg0->center.x = arg1->unk10.x;
arg0->center.y = arg1->unk10.y;
arg0->center.z = arg1->unk10.z;
arg0->rot.x = arg1->unk28.x;
arg0->rot.y = arg1->unk28.y;
arg0->rot.z = arg1->unk28.z;
arg0->zoom = arg1->unk38;
}

void fn_1_CBF8(M418DllUnkStruct* arg0, M418DllUnkStruct* arg1, f32 arg2, f32 arg3, f32 arg4) {
fn_1_C318(arg0, arg1, arg2, arg3);
fn_1_B4A4(arg0, arg1, arg4);
}

void fn_1_D250(M418DllUnkStruct* arg0, M418DllUnkStruct* arg1, f32 arg8, f32 arg9) {
arg1->unk10.x = fn_1_AAEC(arg0->unk10.x, arg1->center.x, arg8, arg9);
arg1->unk10.y = fn_1_AAEC(arg0->unk10.y, arg1->center.y, arg8, arg9);
arg1->unk10.z = fn_1_AAEC(arg0->unk10.z, arg1->center.z, arg8, arg9);
arg1->unk28.x = fn_1_AAEC(arg0->unk28.x, arg1->rot.x, arg8, arg9);
arg1->unk28.y = fn_1_AAEC(arg0->unk28.y, arg1->rot.y, arg8, arg9);
arg1->unk28.z = fn_1_AAEC(arg0->unk28.z, arg1->rot.z, arg8, arg9);
arg1->unk38 = fn_1_AAEC(arg0->unk38, arg1->zoom, arg8, arg9);
}

void fn_1_D714(M418DllUnkStruct* arg0, M418DllUnkStruct* arg1, f32 arg8, f32 arg9) {
fn_1_D250(arg0, arg1, arg8, arg9);
arg0->center.x = arg1->unk10.x;
arg0->center.y = arg1->unk10.y;
arg0->center.z = arg1->unk10.z;
arg0->rot.x = arg1->unk28.x;
arg0->rot.y = arg1->unk28.y;
arg0->rot.z = arg1->unk28.z;
arg0->zoom = arg1->unk38;
}

void fn_1_DC10(M418DllUnkStruct* arg0, M418DllUnkStruct* arg1, f32 arg2, f32 arg3, f32 arg4) {
fn_1_D250(arg0, arg1, arg2, arg3);
fn_1_B4A4(arg0, arg1, arg4);
}

0 comments on commit 732e9ff

Please sign in to comment.