Merge pull request #44 from ethteck/si

Two functions & splat update
This commit is contained in:
Ethan Roseman 2020-08-26 19:44:51 -04:00 committed by GitHub
commit f3edd49096
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 51 additions and 88 deletions

View File

@ -9,7 +9,7 @@
.include "macro.inc"
.section .text40_boot, "ax"
.section .text_40, "ax"
/* 000040 A4000040 40806800 */ mtc0 $zero, $13
/* 000044 A4000044 40804800 */ mtc0 $zero, $9

View File

@ -1,4 +1,4 @@
.section .text0_header, "a"
.section .text_0, "a"
.byte 0x80, 0x37, 0x12, 0x40 # PI BSD Domain 1 register
.word 0x0000000F # clock rate setting
.word 0x80125C00 # entry point

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

@ -1,18 +1,18 @@
SECTIONS
{
/* 0x0 0-40 (len 40) */
.text0_header 0x0 : AT(0x0) {
build/asm/header.o(.text0_header);
.text_0 0x0 : AT(0x0) {
build/asm/header.o(.text_0);
}
/* 0xA4000040 40-1000 (len FC0) */
.text40_boot 0xA4000040 : AT(0x40) {
build/asm/boot.o(.text40_boot);
.text_40 0xA4000040 : AT(0x40) {
build/asm/boot.o(.text_40);
build/bin/bootcode_font.o(.data);
}
/* 0x80025C00 1000-759B0 (len 749B0) */
.text1000_code 0x80025C00 : AT(0x1000) {
.text_1000 0x80025C00 : AT(0x1000) {
build/src/code_1000_len_60.o(.text);
build/src/code_1060_len_310.o(.text);
build/src/code_1370_len_7d0.o(.text);
@ -182,7 +182,7 @@ SECTIONS
}
/* 0x800DC500 759B0-A5DD0 (len 30420) */
.text759B0_code 0x800DC500 : AT(0x759B0) {
.text_759B0 0x800DC500 : AT(0x759B0) {
build/src/code_759b0_len_61b0.o(.text);
build/src/code_7bb60_len_41b0.o(.text);
build/src/code_7fd10_len_b40.o(.text);
@ -196,7 +196,7 @@ SECTIONS
}
/* 0x8010F6D0 A5DD0-E79B0 (len 41BE0) */
.textA5DD0_code 0x8010F6D0 : AT(0xA5DD0) {
.text_A5DD0 0x8010F6D0 : AT(0xA5DD0) {
build/src/code_a5dd0_len_114e0.o(.text);
build/src/code_b72b0_len_15ed0.o(.text);
build/src/code_cd180_len_38f0.o(.text);
@ -215,7 +215,7 @@ SECTIONS
}
/* 0x802C3000 E79B0-FEE30 (len 17480) */
.textE79B0_code 0x802C3000 : AT(0xE79B0) {
.text_E79B0 0x802C3000 : AT(0xE79B0) {
build/src/code_e79b0_len_1920.o(.text);
build/src/code_e92d0_len_5da0.o(.text);
build/src/code_ef070_len_3400.o(.text);
@ -228,14 +228,14 @@ SECTIONS
}
/* 0x802DBD40 FEE30-102610 (len 37E0) */
.textFEE30_code 0x802DBD40 : AT(0xFEE30) {
.text_FEE30 0x802DBD40 : AT(0xFEE30) {
build/src/code_fee30_len_2d60.o(.text);
build/src/code_101b90_len_8f0.o(.text);
build/bin/code_102480.o(.data);
}
/* 0x802E0D90 102610-10A9F0 (len 83E0) */
.text102610_code 0x802E0D90 : AT(0x102610) {
.text_102610 0x802E0D90 : AT(0x102610) {
build/src/code_102610_len_2330.o(.text);
build/src/code_104940_len_dc0.o(.text);
build/src/code_105700_len_2130.o(.text);
@ -255,13 +255,13 @@ SECTIONS
}
/* 0x80242BA0 135EE0-163400 (len 2D520) */
.text135EE0_code 0x80242BA0 : AT(0x135EE0) {
.text_135EE0 0x80242BA0 : AT(0x135EE0) {
build/src/code_135EE0.o(.text);
build/bin/code_1422A0.o(.data);
}
/* 0x80242BA0 163400-16C8E0 (len 94E0) */
.text163400_code 0x80242BA0 : AT(0x163400) {
.text_163400 0x80242BA0 : AT(0x163400) {
build/src/code_163400.o(.text);
build/src/code_167570.o(.text);
build/src/code_168590.o(.text);
@ -270,7 +270,7 @@ SECTIONS
}
/* 0x8023E000 16C8E0-1CC310 (len 5FA30) */
.text16C8E0_code 0x8023E000 : AT(0x16C8E0) {
.text_16C8E0 0x8023E000 : AT(0x16C8E0) {
build/src/code_16c8e0.o(.text);
build/bin/code_1AF2C0.o(.data);
}
@ -281,7 +281,7 @@ SECTIONS
}
/* 0x80200000 3169F0-316C00 (len 210) */
.text3169F0_code 0x80200000 : AT(0x3169F0) {
.text_3169F0 0x80200000 : AT(0x3169F0) {
build/src/code_3169f0.o(.text);
build/src/code_316a70.o(.text);
}
@ -292,12 +292,12 @@ SECTIONS
}
/* 0x802AE000 316D90-316F30 (len 1A0) */
.text316D90_code 0x802AE000 : AT(0x316D90) {
.text_316D90 0x802AE000 : AT(0x316D90) {
build/src/code_316d90.o(.text);
}
/* 0x802B2000 316F30-317020 (len F0) */
.text316F30_code 0x802B2000 : AT(0x316F30) {
.text_316F30 0x802B2000 : AT(0x316F30) {
build/src/code_316f30.o(.text);
}
@ -307,7 +307,7 @@ SECTIONS
}
/* 0x802A1000 415D90-4200C0 (len A330) */
.text415D90_code 0x802A1000 : AT(0x415D90) {
.text_415D90 0x802A1000 : AT(0x415D90) {
build/src/code_415D90.o(.text);
}
@ -317,7 +317,7 @@ SECTIONS
}
/* 0x80280000 7E0E80-7E4D00 (len 3E80) */
.text7E0E80_code 0x80280000 : AT(0x7E0E80) {
.text_7E0E80 0x80280000 : AT(0x7E0E80) {
build/src/code_7e0e80.o(.text);
build/src/code_7E2AA0.o(.text);
build/src/code_7E3700.o(.text);
@ -329,7 +329,7 @@ SECTIONS
}
/* 0x802B7000 E20EB0-E215C0 (len 710) */
.textE20EB0_code 0x802B7000 : AT(0xE20EB0) {
.text_E20EB0 0x802B7000 : AT(0xE20EB0) {
build/src/code_e20eb0.o(.text);
}

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);

@ -1 +1 @@
Subproject commit 1a525eafd798840e3b1d8bb7d543aa26d3014a3d
Subproject commit 3b35d2b7e4299d3651f6dca6ccaa61bb671f23b3