Skip to content

Commit 23bb731

Browse files
authored
Merge pull request #158 from Kelebek1/fragment18
fragment18
2 parents 0bc12ff + 3dc0221 commit 23bb731

16 files changed

+3635
-123
lines changed

linker_scripts/us/symbol_addrs.txt

+4-7
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,7 @@ D_8690B5D0 = 0x8690B5D0; // size:0x24
353353
D_86A06228 = 0x86A06228; // size:0xC
354354
D_86A06238 = 0x86A06238; // size:0xC
355355
D_86A06248 = 0x86A06248; // size:0xC
356-
D_30074E0 = 0x30074E0;
357-
D_30092E0 = 0x30092E0;
358-
D_300B6E0 = 0x300B6E0;
359-
D_300B980 = 0x300B980;
360-
D_300BAD0 = 0x300BAD0;
361-
D_300BED0 = 0x300BED0;
362-
D_300C2D0 = 0x300C2D0;
356+
D_86C0E480 = 0x86C0E480; // size:0x1854
357+
D_86C0FCD8 = 0x86C0FCD8; // size:0x1854
358+
D_86C11530 = 0x86C11530; // size:0xAD0
359+
D_879060BC = 0x879060BC; // size:0x2

linker_scripts/us/undefined_syms.ld

+16
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,19 @@ D_300B980 = 0x300B980;
55
D_300BAD0 = 0x300BAD0;
66
D_300BED0 = 0x300BED0;
77
D_300C2D0 = 0x300C2D0;
8+
D_03034E40 = 0x03034E40;
9+
D_03035A80 = 0x03035A80;
10+
D_030366C0 = 0x030366C0;
11+
D_03037300 = 0x03037300;
12+
D_030397C0 = 0x030397C0;
13+
D_0303A400 = 0x0303A400;
14+
D_0303B040 = 0x0303B040;
15+
D_0303D500 = 0x0303D500;
16+
D_03040580 = 0x03040580;
17+
D_03040980 = 0x03040980;
18+
D_03040D80 = 0x03040D80;
19+
D_03041FC0 = 0x03041FC0;
20+
D_03043520 = 0x03043520;
21+
D_03043C40 = 0x03043C40;
22+
D_030426E0 = 0x030426E0;
23+
D_03042E00 = 0x03042E00;

src/50860.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "38BB0.h"
44
#include "3D140.h"
55

6-
void func_8004FC60(s32 arg0, s32 arg1) {
6+
void func_8004FC60(s32 arg0, u32 arg1) {
77
s32 i;
88

99
if (arg0 & 4) {

src/50860.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "global.h"
55

6-
void func_8004FC60(s32, s32);
6+
void func_8004FC60(s32, u32);
77
void func_8004FCD8(s32);
88

99
#endif // _50860_H_

src/fragments/18/fragment18.c

+3,488-64
Large diffs are not rendered by default.

src/fragments/18/fragment18.h

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#ifndef _FRAGMENT18_H_
2+
#define _FRAGMENT18_H_
3+
4+
#include "global.h"
5+
#include "src/fragments/3/fragment3.h"
6+
7+
s32 func_86C00020(unk_func_8790002C* arg0);
8+
void func_86C00090(s16 arg0, s32* arg1, s32* arg2);
9+
void func_86C00110(s16 arg0, s16 arg1);
10+
void func_86C00368(s16 arg0, s16 arg1);
11+
void func_86C003AC(unk_func_8790002C* arg0);
12+
void func_86C00424(unk_func_8790002C* arg0, s16 arg1);
13+
void func_86C005D0(void);
14+
f32 func_86C0063C(unk_func_8790002C* arg0);
15+
s16 func_86C00668(unk_func_8790002C* arg0, s16 arg1);
16+
void func_86C00770(unk_func_8790002C* arg0);
17+
void func_86C00AA4(void);
18+
s32 func_86C00B0C(unk_func_8790002C* arg0);
19+
s16 func_86C00BB4(void);
20+
s16 func_86C00C40(unk_func_8790002C* arg0);
21+
s16 func_86C00D50(unk_func_8790002C* arg0);
22+
s32 func_86C00EF8(unk_func_8790002C* arg0);
23+
void func_86C00F70(unk_func_8790002C* arg0);
24+
void func_86C01100(unk_func_8790002C* arg0);
25+
s16 func_86C01408(void);
26+
s16 func_86C014A0(void);
27+
void func_86C01538(unk_func_8790002C* arg0);
28+
void func_86C016C8(unk_func_8790002C* arg0);
29+
void func_86C01748(void);
30+
void func_86C01750(unk_func_8790002C* arg0, s32 arg1, s32 arg2, f32 arg3, f32 arg4, f32 arg5);
31+
void func_86C018B8(unk_func_8790002C* arg0, s32 arg1);
32+
void func_86C01AF8(void);
33+
void func_86C01D2C(unk_func_8790002C* arg0, s32 arg1);
34+
void func_86C01FAC(unk_func_8790002C* arg0, s32 arg1);
35+
void func_86C021FC(unk_func_8790002C* arg0);
36+
void func_86C022D8(unk_func_8790002C* arg0);
37+
void func_86C02324(unk_func_8790002C* arg0, s32 arg1);
38+
void func_86C0250C(void);
39+
void func_86C02514(void);
40+
void func_86C02610(unk_func_8790002C* arg0, s32 arg1);
41+
void func_86C026F0(unk_func_8790002C* arg0, s32 arg1);
42+
void func_86C0276C(void);
43+
void func_86C027A4(void);
44+
void func_86C027AC(void);
45+
void func_86C027B4(void);
46+
void func_86C027BC(void);
47+
void func_86C02804(void);
48+
s16 func_86C028C0(s16 arg0);
49+
void func_86C02A1C(unk_func_8790002C* arg0);
50+
void func_86C02B78(unk_func_8790002C* arg0, s32 arg1);
51+
void func_86C02C28(void);
52+
void func_86C03008(void);
53+
void func_86C03080(void);
54+
s32 func_86C030EC(void);
55+
void func_86C03128(void);
56+
s32 func_86C031E4(void);
57+
s32 func_86C03258(void);
58+
void func_86C03344(void);
59+
void func_86C034F8(void);
60+
void func_86C03500(void);
61+
void func_86C035E0(void);
62+
void func_86C03608(void);
63+
void func_86C03AB8(void);
64+
void func_86C03BE8(void);
65+
void func_86C03C64(void);
66+
void func_86C03E4C(void);
67+
void func_86C03E8C(s32 arg0);
68+
void func_86C03ED4(void);
69+
void func_86C040B4(s32 arg0);
70+
void func_86C04170(void);
71+
void func_86C041E8(void);
72+
void func_86C043C4(void);
73+
void func_86C044B4(void);
74+
s32 func_86C046B0(s32 arg0, UNUSED s32 arg1);
75+
76+
#endif // _FRAGMENT18_H_

src/fragments/2/fragment2.h

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ extern char** D_87806330;
1212
extern s16 D_87806338;
1313
extern u32* D_8780633C[];
1414
extern u32* D_8780634C[];
15+
extern u32 D_87806398[];
1516

1617
extern u16 D_8780FA28;
1718
extern s16 D_8780FA2A;

src/fragments/2/fragment2_1.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ static Gfx D_87806390[] = {
1010
};
1111

1212
u32 D_87806398[] = {
13-
0x0B00001E, 0x00000000, 0x014000F0, 0x00000000, 0x000016A8, 0x00000190, 0x05000000, 0x0D000000, 0x05000000,
14-
0x0F000002, 0x05000000, 0x0A000000, 0x800AC858, 0x06000000, 0x06000000, 0x06000000, 0x04000000, 0x00000000,
13+
0x0B00001E, 0x00000000, 0x014000F0, 0x00000000, 0x000016A8, 0x00000190, 0x05000000, 0x0D000000, 0x05000000,
14+
0x0F000002, 0x05000000, 0x0A000000, &D_800AC858, 0x06000000, 0x06000000, 0x06000000, 0x04000000, 0x00000000,
1515
};
1616

1717
static Vtx D_878063E0[] = {

src/fragments/3/fragment3.h

+14-13
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
#include "global.h"
55
#include "src/fragments/34/fragment34.h"
66
#include "src/3FB0.h"
7+
#include "src/controller.h"
78

89
typedef struct unk_func_8790002C {
910
/* 0x000 */ unk_D_86002F58_004_000 unk_000;
1011
/* 0x168 */ unk_D_86002F30* unk_168;
11-
/* 0x16C */ f32 unk_16C;
12-
/* 0x170 */ f32 unk_170;
13-
/* 0x174 */ f32 unk_174;
12+
/* 0x16C */ Vec3f unk_16C;
1413
/* 0x178 */ char unk178[0x18];
1514
/* 0x190 */ f32 unk_190;
1615
/* 0x194 */ f32 unk_194;
@@ -30,7 +29,7 @@ typedef struct unk_func_8790002C {
3029
/* 0x1CC */ f32 unk_1CC;
3130
/* 0x1D0 */ f32 unk_1D0;
3231
/* 0x1D4 */ f32 unk_1D4;
33-
/* 0x1D8 */ char unk1D8[0xC];
32+
/* 0x1D8 */ Vec3f unk_1D8;
3433
/* 0x1E4 */ f32 unk_1E4;
3534
/* 0x1E8 */ char unk1E8[0x4];
3635
/* 0x1EC */ f32 unk_1EC;
@@ -73,14 +72,15 @@ typedef struct unk_func_8790002C {
7372
/* 0x24C */ s16 unk_24C;
7473
/* 0x24E */ char unk24E[0x6];
7574
/* 0x254 */ s32 unk_254;
76-
/* 0x258 */ char unk258[0x2];
75+
/* 0x258 */ s16 unk_258;
7776
/* 0x25A */ s16 unk_25A;
78-
/* 0x25C */ char unk25C[0x4];
77+
/* 0x25C */ s16 unk_25C;
78+
/* 0x25E */ s16 unk_25E;
7979
/* 0x260 */ s16 unk_260;
8080
/* 0x262 */ s16 unk_262;
8181
/* 0x264 */ s16 unk_264;
8282
/* 0x264 */ s16 unk_266;
83-
/* 0x268 */ char unk268[0x2];
83+
/* 0x268 */ s16 unk_268;
8484
/* 0x26A */ s16 unk_26A;
8585
/* 0x26C */ s16 unk_26C;
8686
/* 0x26E */ s16 unk_26E;
@@ -108,6 +108,7 @@ typedef struct unk_func_8790002C {
108108
/* 0x2A8 */ s16 unk_2A8;
109109
/* 0x2AA */ s16 unk_2AA;
110110
/* 0x2AC */ s16 unk_2AC;
111+
/* 0x2AE */ s16 unk_2AE;
111112
/* 0x2B0 */ char unk2B0[0x4];
112113
} unk_func_8790002C; // size = 0x2B4
113114

@@ -130,9 +131,11 @@ typedef struct unk_D_87903E10 {
130131
/* 0x04 */ unk_D_87903E00* unk_04;
131132
} unk_D_87903E10; // size = 0x8
132133

134+
extern s16 D_87903DA0;
133135
extern s16 D_87903DA4;
134136
extern s16 D_87903DA8;
135137
extern s16 D_87903DAC;
138+
extern s16 D_87903DBC;
136139
extern s16 D_87903DC0;
137140
extern s16 D_87903DC4;
138141
extern s16 D_87903DC8;
@@ -165,7 +168,6 @@ extern s16 D_87906078;
165168
extern f32 D_8790607C;
166169
extern f32 D_87906080;
167170
extern Vec3f D_87906088;
168-
169171
extern s16 D_87906094;
170172
extern s16 D_87906096;
171173
extern s16 D_87906098;
@@ -180,11 +182,10 @@ extern Vec3s D_879060AC;
180182

181183
extern s16 D_87903DB0;
182184
extern s16 D_87903DB8;
183-
184-
extern s8 D_879060C4;
185-
extern s8 D_879060C5;
186-
extern s8 D_879060C6;
187-
extern s8 D_879060C7;
185+
extern Controller* D_879060BC;
186+
extern s16 D_879060C0;
187+
extern s16 D_879060C2;
188+
extern s8 D_879060C4[4];
188189
extern s16 D_879060C8;
189190
extern s16 D_879060CA;
190191

src/fragments/3/fragment3_1189B0.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ s16 D_87903DAC = 0;
1515
s16 D_87903DB0 = 0;
1616
s32 pad_D_87903DB4 = 0;
1717
s16 D_87903DB8 = 0;
18-
s32 pad_D_87903DBC = 0;
18+
s16 D_87903DBC = 0;
1919
s16 D_87903DC0 = 0;
2020
s16 D_87903DC4 = 0;
2121
s16 D_87903DC8 = 0;
@@ -39,7 +39,7 @@ s32 func_879000C4(unk_func_8790002C* arg0, unk_func_8790002C* arg1) {
3939
f32 var_fv0 = arg1->unk_19C - arg0->unk_19C;
4040
f32 var_fv1 = arg1->unk_1A0 - arg0->unk_1A0;
4141
f32 var_fa0 = arg1->unk_1A4 - arg0->unk_1A4;
42-
f32 var_fa1 = (arg0->unk_288 * arg0->unk_170) + (arg1->unk_288 * arg1->unk_170);
42+
f32 var_fa1 = (arg0->unk_288 * arg0->unk_16C.y) + (arg1->unk_288 * arg1->unk_16C.y);
4343
s32 ret = 0;
4444

4545
if (var_fv0 < 0.0f) {
@@ -79,8 +79,8 @@ s32 func_879001A4(unk_func_8790002C* arg0, unk_func_8790002C* arg1) {
7979
var_fa0 = arg1->unk_1A4 - arg0->unk_1A4;
8080
var_v1 = 0;
8181

82-
var_fa1 = (arg0->unk_288 * arg0->unk_170) + (arg1->unk_288 * arg1->unk_170);
83-
var_fs0 = ((arg0->unk_28C * arg0->unk_170) + (arg1->unk_28C * arg1->unk_170)) * 0.5f;
82+
var_fa1 = (arg0->unk_288 * arg0->unk_16C.y) + (arg1->unk_288 * arg1->unk_16C.y);
83+
var_fs0 = ((arg0->unk_28C * arg0->unk_16C.y) + (arg1->unk_28C * arg1->unk_16C.y)) * 0.5f;
8484

8585
var_fv0 = ABS(var_fv0);
8686
var_fv1 = ABS(var_fv1);
@@ -240,7 +240,7 @@ void func_8790060C(unk_func_8790002C* arg0) {
240240
arg0->unk_296 = 0;
241241
arg0->unk_298 = 0;
242242

243-
arg0->unk_16C = arg0->unk_170 = arg0->unk_174 = 1.0f;
243+
arg0->unk_16C.x = arg0->unk_16C.y = arg0->unk_16C.z = 1.0f;
244244

245245
arg0->unk_198 = 0.0f;
246246
arg0->unk_194 = 0.0f;
@@ -290,9 +290,9 @@ void func_87900770(unk_func_8790002C* arg0) {
290290
}
291291

292292
void func_87900808(unk_func_8790002C* arg0) {
293-
arg0->unk_000.unk_030.x = arg0->unk_16C;
294-
arg0->unk_000.unk_030.y = arg0->unk_170;
295-
arg0->unk_000.unk_030.z = arg0->unk_174;
293+
arg0->unk_000.unk_030.x = arg0->unk_16C.x;
294+
arg0->unk_000.unk_030.y = arg0->unk_16C.y;
295+
arg0->unk_000.unk_030.z = arg0->unk_16C.z;
296296

297297
arg0->unk_000.unk_024.x = arg0->unk_190;
298298
arg0->unk_000.unk_024.y = arg0->unk_194;
@@ -322,10 +322,10 @@ void func_87900854(void) {
322322
func_878029C0();
323323
func_87802528();
324324

325-
D_879060C4 = ptr[0];
326-
D_879060C5 = ptr[1];
327-
D_879060C6 = ptr[2];
328-
D_879060C7 = ptr[3];
325+
D_879060C4[0] = ptr[0];
326+
D_879060C4[1] = ptr[1];
327+
D_879060C4[2] = ptr[2];
328+
D_879060C4[3] = ptr[3];
329329

330330
D_879060C8 = 0xFF;
331331
}

src/fragments/3/fragment3_1193E0.c

+2-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "src/1CF30.h"
33
#include "src/20470.h"
44
#include "src/F420.h"
5-
#include "src/controller.h"
65

76
s16 D_87906040;
87
s16 pad_D_87906042;
@@ -41,14 +40,10 @@ s16 D_879060A8;
4140
Vec3s D_879060AC;
4241
s32 pad_D_879060B4;
4342
s32 pad_D_879060B8;
44-
s16 D_879060BC;
45-
s16 D_879060BE;
43+
Controller* D_879060BC;
4644
s16 D_879060C0;
4745
s16 D_879060C2;
48-
s8 D_879060C4;
49-
s8 D_879060C5;
50-
s8 D_879060C6;
51-
s8 D_879060C7;
46+
s8 D_879060C4[4];
5247
s16 D_879060C8;
5348
s16 D_879060CA;
5449
s32 pad_D_879060D0[4];

src/fragments/3/fragment3_11BF90.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ void func_8790370C(void) {
4646

4747
void func_87903778(unk_func_8790002C* arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s16 arg5, s16 arg6, s16 arg7,
4848
s16 arg8) {
49-
arg0->unk_16C = arg1;
50-
arg0->unk_170 = arg1;
51-
arg0->unk_174 = arg1;
49+
arg0->unk_16C.x = arg1;
50+
arg0->unk_16C.y = arg1;
51+
arg0->unk_16C.z = arg1;
52+
5253
arg0->unk_1A8 = arg2;
5354
arg0->unk_1AC = arg3;
5455
arg0->unk_1B0 = arg4;

src/fragments/34/fragment34.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,9 @@ s32 func_81400B00(s32 arg0);
335335
s32 func_81400B28(s32 arg0, s32 arg1);
336336
s32 func_81400B4C(s32 arg0, s32 arg1);
337337
void func_81400B84(UNUSED s32 arg0);
338-
void func_81400B8C(Vec3f arg0);
339-
void func_81400BBC(Vec3f arg0);
340-
void func_81400BEC(Vec3f arg0);
338+
s16 func_81400B8C(Vec3f arg0);
339+
s16 func_81400BBC(Vec3f arg0);
340+
s16 func_81400BEC(Vec3f arg0);
341341
void func_81400C1C(Vec3s* arg0, Vec3f arg1);
342342
f32 func_81400C80(f32 arg0, f32 arg1, s16 arg2);
343343
f32 func_81400CC0(f32 arg0, f32 arg1, s16 arg2);

src/fragments/34/fragment34_261F90.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -555,16 +555,16 @@ s32 func_81400B4C(s32 arg0, s32 arg1) {
555555
void func_81400B84(UNUSED s32 arg0) {
556556
}
557557

558-
void func_81400B8C(Vec3f arg0) {
559-
MathUtil_Atan2s(arg0.y, arg0.z);
558+
s16 func_81400B8C(Vec3f arg0) {
559+
return MathUtil_Atan2s(arg0.y, arg0.z);
560560
}
561561

562-
void func_81400BBC(Vec3f arg0) {
563-
MathUtil_Atan2s(arg0.z, arg0.x);
562+
s16 func_81400BBC(Vec3f arg0) {
563+
return MathUtil_Atan2s(arg0.z, arg0.x);
564564
}
565565

566-
void func_81400BEC(Vec3f arg0) {
567-
MathUtil_Atan2s(arg0.x, arg0.y);
566+
s16 func_81400BEC(Vec3f arg0) {
567+
return MathUtil_Atan2s(arg0.x, arg0.y);
568568
}
569569

570570
void func_81400C1C(Vec3s* arg0, Vec3f arg1) {

tools/animation_script.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,13 @@ def get_type(f, offset, cmd, args, out):
119119

120120
out += f" ANIMATION_SCRIPT_CMD_{cmd:02X}"
121121
out += "("
122+
#print(hex(offset), hex(cmd))
122123
out = get_type(f, offset, cmd, COMMANDS[cmd]["args"][1:], out)
123124
if out[-2:] == ", ":
124125
out = out[:-2]
125126
out += "),\n"
126127

127-
if cmd == 0x01:
128+
if cmd == 0x01 or cmd == 0x04:
128129
break;
129130

130131
offset += COMMANDS[cmd]["size"]

0 commit comments

Comments
 (0)