This commit is contained in:
Ethan Roseman 2020-08-26 18:54:55 -04:00
parent a6c722060a
commit 74a46100c1
5 changed files with 29 additions and 66 deletions

View File

@ -1,32 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel GetColliderCenter
/* 0EEA5C 802CA0AC 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 0EEA60 802CA0B0 AFB00020 */ sw $s0, 0x20($sp)
/* 0EEA64 802CA0B4 0080802D */ daddu $s0, $a0, $zero
/* 0EEA68 802CA0B8 AFBF0024 */ sw $ra, 0x24($sp)
/* 0EEA6C 802CA0BC 8E02000C */ lw $v0, 0xc($s0)
/* 0EEA70 802CA0C0 0C0B1EAF */ jal get_variable
/* 0EEA74 802CA0C4 8C450000 */ lw $a1, ($v0)
/* 0EEA78 802CA0C8 0040202D */ daddu $a0, $v0, $zero
/* 0EEA7C 802CA0CC 27A50010 */ addiu $a1, $sp, 0x10
/* 0EEA80 802CA0D0 27A60014 */ addiu $a2, $sp, 0x14
/* 0EEA84 802CA0D4 0C016F84 */ jal get_collider_center
/* 0EEA88 802CA0D8 27A70018 */ addiu $a3, $sp, 0x18
/* 0EEA8C 802CA0DC C7A00010 */ lwc1 $f0, 0x10($sp)
/* 0EEA90 802CA0E0 4600010D */ trunc.w.s $f4, $f0
/* 0EEA94 802CA0E4 E6040084 */ swc1 $f4, 0x84($s0)
/* 0EEA98 802CA0E8 C7A00014 */ lwc1 $f0, 0x14($sp)
/* 0EEA9C 802CA0EC C7A20018 */ lwc1 $f2, 0x18($sp)
/* 0EEAA0 802CA0F0 4600010D */ trunc.w.s $f4, $f0
/* 0EEAA4 802CA0F4 E6040088 */ swc1 $f4, 0x88($s0)
/* 0EEAA8 802CA0F8 4600110D */ trunc.w.s $f4, $f2
/* 0EEAAC 802CA0FC E604008C */ swc1 $f4, 0x8c($s0)
/* 0EEAB0 802CA100 8FBF0024 */ lw $ra, 0x24($sp)
/* 0EEAB4 802CA104 8FB00020 */ lw $s0, 0x20($sp)
/* 0EEAB8 802CA108 24020002 */ addiu $v0, $zero, 2
/* 0EEABC 802CA10C 03E00008 */ jr $ra
/* 0EEAC0 802CA110 27BD0028 */ addiu $sp, $sp, 0x28

View File

@ -1,29 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel si_handle_allocate_array
/* 0EABC4 802C6214 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 0EABC8 802C6218 AFB10014 */ sw $s1, 0x14($sp)
/* 0EABCC 802C621C 0080882D */ daddu $s1, $a0, $zero
/* 0EABD0 802C6220 AFBF0018 */ sw $ra, 0x18($sp)
/* 0EABD4 802C6224 AFB00010 */ sw $s0, 0x10($sp)
/* 0EABD8 802C6228 8E30000C */ lw $s0, 0xc($s1)
/* 0EABDC 802C622C 8E050000 */ lw $a1, ($s0)
/* 0EABE0 802C6230 0C0B1EAF */ jal get_variable
/* 0EABE4 802C6234 26100004 */ addiu $s0, $s0, 4
/* 0EABE8 802C6238 8E100000 */ lw $s0, ($s0)
/* 0EABEC 802C623C 0C00AB39 */ jal heap_malloc
/* 0EABF0 802C6240 00022080 */ sll $a0, $v0, 2
/* 0EABF4 802C6244 0220202D */ daddu $a0, $s1, $zero
/* 0EABF8 802C6248 0040302D */ daddu $a2, $v0, $zero
/* 0EABFC 802C624C AC82013C */ sw $v0, 0x13c($a0)
/* 0EAC00 802C6250 0C0B2026 */ jal set_variable
/* 0EAC04 802C6254 0200282D */ daddu $a1, $s0, $zero
/* 0EAC08 802C6258 8FBF0018 */ lw $ra, 0x18($sp)
/* 0EAC0C 802C625C 8FB10014 */ lw $s1, 0x14($sp)
/* 0EAC10 802C6260 8FB00010 */ lw $s0, 0x10($sp)
/* 0EAC14 802C6264 24020002 */ addiu $v0, $zero, 2
/* 0EAC18 802C6268 03E00008 */ jr $ra
/* 0EAC1C 802C626C 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -7,8 +7,12 @@
void osCleanupThread(void);
s32 heap_malloc(s32 size);
void clone_model(u16 srcModelID, u16 newModelID);
void update_collider_transform(s16 colliderID);
void get_collider_center(s32 colliderID, f32* x, f32* y, f32* z);
s32 get_variable(ScriptInstance* script, Bytecode var);
s32 set_variable(ScriptInstance* script, Bytecode var, s32 value);
f32 get_float_variable(ScriptInstance* script, Bytecode var);

View File

@ -26,7 +26,7 @@ INCLUDE_ASM("code_362a0_len_2f70", get_collider_type_by_id);
INCLUDE_ASM("code_362a0_len_2f70", func_8005BDD8);
INCLUDE_ASM("code_362a0_len_2f70", get_collider_center);
void INCLUDE_ASM("code_362a0_len_2f70", get_collider_center, s32 colliderID, f32* x, f32* y, f32* z);
INCLUDE_ASM("code_362a0_len_2f70", test_ray_triangle_general);

View File

@ -538,13 +538,21 @@ ApiStatus si_handle_set_flag_array(ScriptInstance* script) {
return ApiStatus_DONE2;
}
INCLUDE_ASM("code_e92d0_len_5da0", si_handle_allocate_array);
ApiStatus si_handle_allocate_array(ScriptInstance* script) {
Bytecode* thisPos = script->ptrReadPos;
s32 size = get_variable(script, *thisPos++);
Bytecode var = *thisPos++;
script->array = heap_malloc(size * 4);
set_variable(script, var, script->array);
return ApiStatus_DONE2;
}
INCLUDE_ASM("code_e92d0_len_5da0", si_handle_AND);
ApiStatus si_handle_AND_const(ScriptInstance* script) {
Bytecode* ptrReadPos = script->ptrReadPos;
// todo improve
s32 constant = ptrReadPos[0]; // NOLINT
s32 var = ptrReadPos[0];
@ -558,7 +566,7 @@ INCLUDE_ASM("code_e92d0_len_5da0", si_handle_OR);
ApiStatus si_handle_OR_const(ScriptInstance* script) {
Bytecode* ptrReadPos = script->ptrReadPos;
// todo improve
s32 constant = ptrReadPos[0]; // NOLINT
s32 var = ptrReadPos[0];
@ -779,7 +787,19 @@ INCLUDE_API_ASM("code_e92d0_len_5da0", ModifyColliderFlags);
INCLUDE_API_ASM("code_e92d0_len_5da0", ResetFromLava);
INCLUDE_API_ASM("code_e92d0_len_5da0", GetColliderCenter);
ApiStatus GetColliderCenter(ScriptInstance* script, s32 initialCall) {
f32 x;
f32 y;
f32 z;
get_collider_center(get_variable(script, *script->ptrReadPos), &x, &y, &z);
script->varTable[0] = x;
script->varTable[1] = y;
script->varTable[2] = z;
return ApiStatus_DONE2;
}
INCLUDE_API_ASM("code_e92d0_len_5da0", ParentColliderToModel);