From 642f99bf3249b2de45d3b5b90a3411dfce58ef58 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Fri, 15 Jan 2021 10:20:04 +0900 Subject: [PATCH] WIP (broken) --- .../code_a5dd0_len_114e0/func_8010FD98.s | 48 ------------------- src/code_a5dd0_len_114e0.c | 36 +++++++++++++- tools/smallest_with_symbol.py | 2 +- tools/splat.yaml | 2 +- 4 files changed, 36 insertions(+), 52 deletions(-) delete mode 100644 asm/nonmatchings/code_a5dd0_len_114e0/func_8010FD98.s diff --git a/asm/nonmatchings/code_a5dd0_len_114e0/func_8010FD98.s b/asm/nonmatchings/code_a5dd0_len_114e0/func_8010FD98.s deleted file mode 100644 index e5aa6c6bdb..0000000000 --- a/asm/nonmatchings/code_a5dd0_len_114e0/func_8010FD98.s +++ /dev/null @@ -1,48 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_8010FD98 -/* A6498 8010FD98 00A0382D */ daddu $a3, $a1, $zero -/* A649C 8010FD9C 28E200FF */ slti $v0, $a3, 0xff -/* A64A0 8010FDA0 14400016 */ bnez $v0, .L8010FDFC -/* A64A4 8010FDA4 3C06FCFF */ lui $a2, 0xfcff -/* A64A8 8010FDA8 3C07E200 */ lui $a3, 0xe200 -/* A64AC 8010FDAC 34E7001C */ ori $a3, $a3, 0x1c -/* A64B0 8010FDB0 3C050055 */ lui $a1, 0x55 -/* A64B4 8010FDB4 34A52078 */ ori $a1, $a1, 0x2078 -/* A64B8 8010FDB8 3C08FC12 */ lui $t0, 0xfc12 -/* A64BC 8010FDBC 35081824 */ ori $t0, $t0, 0x1824 -/* A64C0 8010FDC0 3C06FF33 */ lui $a2, 0xff33 -/* A64C4 8010FDC4 3C04800A */ lui $a0, %hi(gMasterGfxPos) -/* A64C8 8010FDC8 2484A66C */ addiu $a0, $a0, %lo(gMasterGfxPos) -/* A64CC 8010FDCC 8C820000 */ lw $v0, ($a0) -/* A64D0 8010FDD0 34C6FFFF */ ori $a2, $a2, 0xffff -/* A64D4 8010FDD4 0040182D */ daddu $v1, $v0, $zero -/* A64D8 8010FDD8 24420008 */ addiu $v0, $v0, 8 -/* A64DC 8010FDDC AC820000 */ sw $v0, ($a0) -/* A64E0 8010FDE0 AC670000 */ sw $a3, ($v1) -/* A64E4 8010FDE4 AC650004 */ sw $a1, 4($v1) -/* A64E8 8010FDE8 24430008 */ addiu $v1, $v0, 8 -/* A64EC 8010FDEC AC830000 */ sw $v1, ($a0) -/* A64F0 8010FDF0 AC480000 */ sw $t0, ($v0) -/* A64F4 8010FDF4 03E00008 */ jr $ra -/* A64F8 8010FDF8 AC460004 */ sw $a2, 4($v0) -.L8010FDFC: -/* A64FC 8010FDFC 34C6B3FF */ ori $a2, $a2, 0xb3ff -/* A6500 8010FE00 3C05FF2C */ lui $a1, 0xff2c -/* A6504 8010FE04 3C04800A */ lui $a0, %hi(gMasterGfxPos) -/* A6508 8010FE08 2484A66C */ addiu $a0, $a0, %lo(gMasterGfxPos) -/* A650C 8010FE0C 8C820000 */ lw $v0, ($a0) -/* A6510 8010FE10 34A5FE7F */ ori $a1, $a1, 0xfe7f -/* A6514 8010FE14 0040182D */ daddu $v1, $v0, $zero -/* A6518 8010FE18 24420008 */ addiu $v0, $v0, 8 -/* A651C 8010FE1C AC820000 */ sw $v0, ($a0) -/* A6520 8010FE20 AC660000 */ sw $a2, ($v1) -/* A6524 8010FE24 AC650004 */ sw $a1, 4($v1) -/* A6528 8010FE28 24430008 */ addiu $v1, $v0, 8 -/* A652C 8010FE2C AC830000 */ sw $v1, ($a0) -/* A6530 8010FE30 3C03FA00 */ lui $v1, 0xfa00 -/* A6534 8010FE34 AC430000 */ sw $v1, ($v0) -/* A6538 8010FE38 30E300FF */ andi $v1, $a3, 0xff -/* A653C 8010FE3C 03E00008 */ jr $ra -/* A6540 8010FE40 AC430004 */ sw $v1, 4($v0) diff --git a/src/code_a5dd0_len_114e0.c b/src/code_a5dd0_len_114e0.c index 4d613ec259..8b204899ba 100644 --- a/src/code_a5dd0_len_114e0.c +++ b/src/code_a5dd0_len_114e0.c @@ -10,7 +10,15 @@ INCLUDE_ASM(s32, "code_a5dd0_len_114e0", func_8010FBD8); INCLUDE_ASM(s32, "code_a5dd0_len_114e0", func_8010FD68); -INCLUDE_ASM(s32, "code_a5dd0_len_114e0", func_8010FD98); +void func_8010FD98(s32 arg0, s32 alpha) { + if (alpha >= 255) { + gDPSetRenderMode(gMasterGfxPos++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2); + gDPSetCombineMode(gMasterGfxPos++, G_CC_MODULATEIA, G_CC_MODULATEIA); + } else { + gDPSetCombineLERP(gMasterGfxPos++, 0, 0, 0, TEXEL0, PRIMITIVE, 0, TEXEL0, 0, 0, 0, 0, TEXEL0, TEXEL0, 0, PRIMITIVE, 0); + gDPSetPrimColor(gMasterGfxPos++, 0, 0, 0x00, 0x00, 0x00, alpha); + } +} INCLUDE_ASM(s32, "code_a5dd0_len_114e0", func_8010FE44); @@ -320,7 +328,31 @@ INCLUDE_ASM(s32, "code_a5dd0_len_114e0", func_8011C80C); INCLUDE_ASM(s32, "code_a5dd0_len_114e0", func_8011CFBC); -INCLUDE_ASM(s32, "code_a5dd0_len_114e0", func_8011D72C); +//INCLUDE_ASM(s32, "code_a5dd0_len_114e0", func_8011D72C); +void func_8011D72C(Gfx** arg0, s32 treeIndex) { + Model* model = get_model_from_list_index(get_model_list_index_from_tree_index(treeIndex & 0xFFFF)); + Model copied = *model; + Gfx** oldGfxPos; + s32 flag; + Gfx* new_var2; + Gfx* new_var; + + *oldGfxPos = &gMasterGfxPos; + + if (*arg0 == *oldGfxPos) { + flag = 1; + } + new_var = *arg0; + + copied.flags = 0x81; + appendGfx_model(&copied); + new_var2 = *oldGfxPos; + + *arg0 = new_var; + if (flag == 0) { + *arg0 = new_var2; + } +} INCLUDE_ASM(s32, "code_a5dd0_len_114e0", func_8011D7E4); diff --git a/tools/smallest_with_symbol.py b/tools/smallest_with_symbol.py index c57fb727b8..7bc5793ce3 100755 --- a/tools/smallest_with_symbol.py +++ b/tools/smallest_with_symbol.py @@ -16,7 +16,7 @@ smallest_len = 1000 for root, dirs, files in os.walk(asm_dir): for f_name in files: - if f_name.endswith(".s") and f_name not in ["func_8024F768.s", "func_800271A0.s", "func_80240448_B141B8.s"]: + if f_name.endswith(".s") and len(f_name) < 20 and f_name not in ["func_8024F768.s", "func_800271A0.s", "func_80240448_B141B8.s"]: f_path = os.path.join(root, f_name) with open(f_path) as f: f_text = f.read() diff --git a/tools/splat.yaml b/tools/splat.yaml index 9c02a972d1..1351623e5b 100644 --- a/tools/splat.yaml +++ b/tools/splat.yaml @@ -2323,7 +2323,7 @@ segments: overlay: True files: - [0x7345A0, c] - - [0x734640, bin] + - [0x734650, bin] - type: code start: 0x737890 vram: 0x802A1000