Skip to content

Commit e522654

Browse files
committed
Misc decomp
1 parent 709a606 commit e522654

23 files changed

+516
-166
lines changed

export_symbol_addrs.txt

+10-10
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ set_camera_selector = 0x8000000F;
1616
get_main_camera = 0x80000010;
1717
get_world_actors = 0x80000011;
1818
get_actor_child_position = 0x80000012;
19-
round_2_floats = 0x80000013;
19+
arctan2_f = 0x80000013;
2020
gDLL_21_gametext = 0x80000014;
2121
delayByte = 0x80000015;
2222
dl_apply_combine = 0x80000016;
@@ -39,7 +39,7 @@ func_8003DB5C = 0x80000026;
3939
func_80004A4C = 0x80000027;
4040
delayFloat = 0x80000028;
4141
func_800390A4 = 0x80000029;
42-
func_800155C4 = 0x8000002A;
42+
rand_next = 0x8000002A;
4343
func_8005F6DC = 0x8000002B;
4444
bzero = 0x8000002C;
4545
malloc = 0x8000002D;
@@ -61,7 +61,7 @@ set_fov_y = 0x8000003C;
6161
update_camera_for_actor = 0x8000003D;
6262
func_80046B58 = 0x8000003E;
6363
gDLL_UI = 0x8000003F;
64-
func_80015FFC = 0x80000040;
64+
arctan2s = 0x80000040;
6565
func_80007EE0 = 0x80000041;
6666
func_80008048 = 0x80000042;
6767
func_800233F4 = 0x80000043;
@@ -160,7 +160,7 @@ gDLL_8 = 0x8000009F;
160160
dl_set_env_color = 0x800000A0;
161161
get_far_plane = 0x800000A1;
162162
func_80001660 = 0x800000A2;
163-
func_80015DAC = 0x800000A3;
163+
rotate_vec3 = 0x800000A3;
164164
func_80041E68 = 0x800000A4;
165165
func_800032C4 = 0x800000A5;
166166
set_textures_on_gdl = 0x800000A6;
@@ -184,7 +184,7 @@ func_8001F81C = 0x800000B7;
184184
func_80000824 = 0x800000B8;
185185
func_8004B948 = 0x800000B9;
186186
guNormalize = 0x800000BA;
187-
func_80015584 = 0x800000BB;
187+
rand_set_seed = 0x800000BB;
188188
matrix_scaling = 0x800000BC;
189189
matrix_concat_4x3 = 0x800000BD;
190190
matrix_f2l_4x3 = 0x800000BE;
@@ -212,15 +212,15 @@ transform_point_by_actor_matrix = 0x800000D3;
212212
gDLL_newlfx = 0x800000D4;
213213
get_num_objects = 0x800000D5;
214214
func_80021178 = 0x800000D6;
215-
func_80015C70 = 0x800000D7;
215+
s16_vec3_apply_srt_rotation = 0x800000D7;
216216
func_80004F90 = 0x800000D8;
217217
func_80004B78 = 0x800000D9;
218218
func_80005E60 = 0x800000DA;
219219
gDLL_expgfx = 0x800000DB;
220220
gDLL_27 = 0x800000DC;
221221
func_80025540 = 0x800000DD;
222222
matrix_from_srt = 0x800000DE;
223-
guMtxXFMF = 0x800000DF;
223+
vec3_transform = 0x800000DF;
224224
func_800239C0 = 0x800000E0;
225225
D_800A7D94 = 0x800000E1;
226226
func_8000FB2C = 0x800000E2;
@@ -276,7 +276,7 @@ func_800332A4 = 0x80000113;
276276
func_80034D94 = 0x80000114;
277277
func_80031F6C = 0x80000115;
278278
func_80058680 = 0x80000116;
279-
func_80015E64 = 0x80000117;
279+
rotate_vec_inv = 0x80000117;
280280
func_80031470 = 0x80000118;
281281
func_800267C4 = 0x80000119;
282282
func_8002681C = 0x8000011A;
@@ -384,7 +384,7 @@ func_80034BC0 = 0x8000017F;
384384
func_800395D8 = 0x80000180;
385385
vec3_distance_xz_squared = 0x80000181;
386386
func_80044448 = 0x80000182;
387-
func_80016348 = 0x80000183;
387+
atan2f_to_s = 0x80000183;
388388
fsin16 = 0x80000184;
389389
fcos16 = 0x80000185;
390390
func_80039610 = 0x80000186;
@@ -409,7 +409,7 @@ func_8002683C = 0x80000198;
409409
func_80036F6C = 0x80000199;
410410
add_matrix_to_pool = 0x8000019A;
411411
func_8001A8EC = 0x8000019B;
412-
func_80016444 = 0x8000019C;
412+
rotation16_sub_wrap = 0x8000019C;
413413
func_800325C0 = 0x8000019D;
414414
func_800323C4 = 0x8000019E;
415415
func_8001AFCC = 0x8000019F;

include/common.h

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "sys/memory.h"
1212
#include "sys/thread.h"
1313
#include "sys/math.h"
14+
#include "sys/rand.h"
1415
#include "sys/dll.h"
1516
#include "sys/debug.h"
1617
#include "sys/controller.h"

include/functions.h

-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ void add_object_to_array(TActor *actor, s32 param2);
4040

4141
void write_c_file_label_pointers(char *cFileLabel, s32 a1);
4242

43-
s32 func_with_status_reg();
44-
void set_status_reg(s32);
45-
4643
void func_800267A4(TActor *actor);
4744
TActor *func_8002394C();
4845
s32 func_80023D30(TActor*,s32,f32,s32);

include/sys/interrupt_util.h

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#ifndef _SYS_INTERRUPT_UTIL_H
2+
#define _SYS_INTERRUPT_UTIL_H
3+
4+
#include <PR/ultratypes.h>
5+
6+
/**
7+
* Whether interrupts_disable/interrupts_enable should have any effect.
8+
*/
9+
extern s8 gIntDisFlag;
10+
11+
/**
12+
* Disables interrupts if gIntDisFlag is set.
13+
* Returns the previous value of the SR_IE bit.
14+
*/
15+
s32 interrupts_disable();
16+
17+
/**
18+
* Restores the SR_IE flag to the given value if gIntDisFlag is set.
19+
*/
20+
void interrupts_enable(s32 ie);
21+
22+
void set_gIntDisFlag(s32 value);
23+
24+
#endif

include/sys/math.h

+55-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#ifndef _SYS_MATH_H
44
#define _SYS_MATH_H
55

6+
#include <PR/gbi.h>
7+
68
#define M_PI_F 3.141592741f
79
#define DEG_TO_RAD(deg) ((deg) * M_PI_F / 180.0f)
810

@@ -47,7 +49,34 @@ typedef struct
4749
/*000C*/ Vec3f transl;
4850
} SRT;
4951

52+
void vec3_transform(MtxF *mtx, float x, float y, float z, float *ox, float *oy, float *oz);
53+
void vec3_transform_no_translate(MtxF *mf, Vec3f *v, Vec3f *ov);
54+
void matrix_concat(MtxF *m1, MtxF *m2, MtxF *output);
55+
void matrix_concat_4x3(MtxF *m1, MtxF *m2, MtxF *output);
56+
void matrix_concat_3x3(MtxF *m1, MtxF *m2, MtxF *output);
57+
void matrix_f2l(MtxF *mf, Mtx *ml);
58+
void matrix_f2l_4x3(MtxF *mf, Mtx *ml);
59+
void matrix_f2l_translate_only(MtxF *mf, Mtx *ml);
60+
61+
void s16_matrix_rotate(Mtx *m, s16 *);
5062
void matrix_from_srt(MtxF *mf, SRT *srt);
63+
void matrix_prescale_y(MtxF *mf, f32 scale);
64+
void matrix_trans_y(MtxF *mf, f32 scale);
65+
void matrix_from_srt_reversed(MtxF *mf, SRT *srt);
66+
void matrix_from_srt_rotation(MtxF *mf, SRT *srt);
67+
void matrix_from_yaw(s16 theta, MtxF *mf);
68+
void s16_vec3_apply_srt_rotation(SRT *srt, s16 *vec);
69+
void rotate_vec3(SRT *srt, Vec3f *vec);
70+
void rotate_vec_inv(SRT *srt, Vec3f *vec);
71+
void vec_from_rotation(SRT *srt, Vec3f *vec);
72+
void matrix_translation(MtxF *mf, f32 x, f32 y, f32 z);
73+
Mtx *get_some_model_view_mtx();
74+
void matrix_scaling(MtxF *mf, f32 sx, f32 sy, f32 sz);
75+
s16 rotation16_sub_wrap(s32, s32);
76+
f32 func_800164A0(f32, f32, f32, f32, f32);
77+
78+
f32 fsin16_precise(s16 theta);
79+
f32 fcos16_precise(s16 theta);
5180

5281
// theta: [-32768..32768) => [-pi..pi)
5382
// returns: [-65536..65536] => [-1..1]
@@ -65,14 +94,37 @@ s32 cos16(s16 theta);
6594
// returns: [-65536..65536] => [-1..1]
6695
s32 sin16(s16 theta);
6796

68-
f32 acosf(f32);
69-
f32 asinf(f32);
97+
f32 fcos16(s16 theta);
98+
f32 fsin16(s16 theta);
7099

100+
f32 sinf(f32);
101+
102+
s16 arctan2s(s16 x, s16 z);
103+
s16 arctan2_f(f32 x, f32 z);
104+
s16 atan2f_to_s(f32 x, f32 z);
71105
f32 atan2f(f32 x, f32 z);
72106

107+
f32 acosf(f32);
108+
f32 asinf(f32);
73109
u16 acos(s16);
74110
s16 asin(s16);
75111

76-
f32 sinf(f32);
112+
s32 floor_f(f32);
113+
s32 ceil_f(f32);
114+
115+
f32 vec3_distance(Vec3f *v1, Vec3f *v2);
116+
f32 vec3_distance_squared(Vec3f *v1, Vec3f *v2);
117+
f32 vec3_distance_xz(Vec3f *v1, Vec3f *v2);
118+
f32 vec3_distance_xz_squared(Vec3f *v1, Vec3f *v2);
119+
120+
f32 vec3_dot_product(Vec3f *v1, Vec3f *v2);
121+
f32 vec3_length(Vec3f *v);
122+
f32 vec3_length_squared(Vec3f *v);
123+
void vec3_cross_product(Vec3f *v1, Vec3f *v2, Vec3f *result);
124+
void vec3_cross_product_2(Vec3f *v1, Vec3f *v2, Vec3f *result);
125+
f32 vec3_normalize(Vec3f *v);
126+
void vec3_sub(Vec3f *v1, Vec3f *v2, Vec3f *result);
127+
void vec3_add_with_scale(Vec3f *v1, Vec3f *v2, f32 scale, Vec3f *result);
128+
void vec3_reflect(Vec3f *v1, Vec3f *v2, Vec3f *result);
77129

78130
#endif //_SYS_MATH_H

include/sys/rand.h

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef _SYS_RAND_H
2+
#define _SYS_RAND_H
3+
4+
#include <PR/ultratypes.h>
5+
6+
void rand_set_seed(s32 seed);
7+
void rand_save_seed();
8+
void rand_load_seed();
9+
s32 rand_get_seed();
10+
s32 rand_next(s32 min, s32 max);
11+
12+
#endif

include/sys/rarezip.h

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#ifndef _SYS_RAREZIP_H
2+
#define _SYS_RAREZIP_H
3+
4+
#include <PR/ultratypes.h>
5+
6+
typedef struct huft {
7+
u8 e; /* number of extra bits or operation */
8+
u8 b; /* number of bits in this code or subcode */
9+
union {
10+
u16 n; /* literal, length base, or distance base */
11+
struct huft *t; /* pointer to next level of table */
12+
} v;
13+
} huft;
14+
15+
/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */
16+
#define BMAX 16 /* maximum bit length of any code (16 for explode) */
17+
#define N_MAX 288 /* maximum number of codes in any set */
18+
19+
void rarezip_init();
20+
s32 rarezip_uncompress_size(u8 *b);
21+
s32 rarezip_uncompress_size_rom(s32 arg0, s32 arg1, s32 arg2);
22+
u8 *rarezip_uncompress(u8 *compressedInput, u8 *decompressedOutput, s32 outputSize);
23+
void rarezip_huft_build(u32 *b, u32 n, u32 s, u16 *d, u16 *e, huft **t, s32 *m);
24+
25+
#endif

include/sys/scheduler.h

-15
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,6 @@ extern s32 gRetraceCounter32;
5151
extern s32 gCurRSPTaskCounter;
5252
extern s32 gCurRDPTaskCounter;
5353

54-
extern char gStrAudioTask[]; // "(Audio task)"
55-
extern char gStrGameTask[]; // "(Game task)"
56-
extern char gStrDITask[]; // "(DI task)\n"
57-
extern char gStrDIBenchmarkTest[]; // "(DI benchmark test)\n"
58-
extern char gStrUnknownTaskType[]; // "(Unknown task type)\n"
59-
60-
extern char D_8009A280[]; // "SP CRASHED, gfx=%x\n"
61-
extern char D_8009A294[]; // "TRACE: %s:%d gfx=%x\n"
62-
extern char D_8009A2B0[]; // "TRACE: %s:%d gfx=%x\n"
63-
extern char D_8009A2CC[]; // "DP CRASHED, gfx=%x\n"
64-
extern char D_8009A2E0[]; // "TRACE: %s:%5d gfx=%x\n"
65-
extern char D_8009A2FC[]; // "TRACE: %s:%5d gfx=%x\n"
66-
extern char D_8009A318[]; // "CODE: Version %s %s %s\n"
67-
extern char D_8009A334[]; // "DB: %s\n"
68-
6954
extern s32 gCurRSPTaskIsSet;
7055
extern s32 gCurRDPTaskIsSet;
7156

splat.yaml

+11-4
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ segments:
5252
- [0x13030, c, segment_13030]
5353
- [0x130E0, c, queue]
5454
- [0x13D70, c, main]
55-
- [0x15A70, asm, status_register]
56-
- [0x15AD0, hasm, segment_15AD0]
55+
- [0x15A70, asm, interrupt_util]
56+
- [0x15AD0, hasm, math_util]
5757
- [0x17180, c, vec3]
5858
- [0x17500, c, memory]
5959
- [0x18820, c, model]
@@ -70,7 +70,8 @@ segments:
7070
- [0x37C90, c, filesystem]
7171
- [0x38020, c, crash]
7272
- [0x38380, c, segment_38380]
73-
- [0x3B750, asm, gzip]
73+
- [0x3AFB0, c, rarezip]
74+
- [0x3B750, asm, rarezip_asm]
7475
- [0x3C1B0, c, scheduler]
7576
- [0x3D850, c, segment_3D850]
7677
- [0x3D890, c, texture]
@@ -284,8 +285,12 @@ segments:
284285
- [0x8A350, databin, ucode_aspMainText]
285286
- [0x8BC90, databin, ucode_rspbootText]
286287
- [0x8BD60, databin, ucode_gspF3DEX2_xbusText]
288+
- [0x8D640, data, math_util]
289+
- [0x8F6A0, databin]
287290
- [0x92370, .data, crash]
288291
- [0x92380, databin]
292+
- [0x924B0, .data, rarezip]
293+
- [0x924D0, databin]
289294
- [0x93BF0, .data, video]
290295
- [0x93C10, databin]
291296
- [0x93CB0, .data, libultra/io/vimgr]
@@ -320,7 +325,9 @@ segments:
320325
- [0x99CA0, .rodata, queue]
321326
- [0x99D10, .rodata, main]
322327
- [0x99DB0, rodatabin]
323-
- [0x9AF40, .rodata, scheduler]
328+
- [0x9AAB0, .rodata, rarezip]
329+
- [0x9AB30, rodata, rarezip_asm]
330+
- [0x9AC20, .rodata, scheduler]
324331
- [0x9AF70, rodatabin]
325332
- [0x9B8C0, .rodata, video]
326333
- [0x9B8E0, rodatabin]

0 commit comments

Comments
 (0)