diff --git a/README.md b/README.md index 145677a1..a0e97d27 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,11 @@ This repo contains a work-in-progress decompilation of Diddy Kong Racing for the Currently, only the US 1.0 version of the game is supported. US 1.1, EU 1.0, EU 1.1, and JP are not supported at this time. -As of March 3, 2023, this is our current score: +As of April 11, 2023, this is our current score: -    Decomp progress: 50.82% +    Decomp progress: 51.01% -    Documentation progress: 23.36% +    Documentation progress: 23.43% --- @@ -128,25 +128,25 @@ s32 is_drumstick_unlocked(void) { ``` -As of March 3, 2023, this is our current score: +As of April 11, 2023, this is our current score: ``` =================================================================== ADVENTURE ONE (ASM -> C Decompilation) - ------------------------- 50.82% Complete ------------------------- - # Decompiled functions: 1492 - # GLOBAL_ASM remaining: 339 + ------------------------- 51.01% Complete ------------------------- + # Decompiled functions: 1498 + # GLOBAL_ASM remaining: 334 # NON_MATCHING functions: 12 - # NON_EQUIVALENT WIP functions: 63 + # NON_EQUIVALENT WIP functions: 64 --------------------------- Game Status --------------------------- Balloons: 25/47, Keys: 3/4, Trophies: 2/5 T.T. Amulets: 2/4, Wizpig Amulets: 2/4 ------------------------------------------------------------------- - We are racing in Treasure Caves. (Lap 2/3) + We are racing in Treasure Caves. (Lap 3/3) =================================================================== ADVENTURE TWO (Cleanup & Documentation) - ------------------------- 23.36% Complete ------------------------- - # Documented functions: 445 - # Undocumented remaining: 1121 + ------------------------- 23.43% Complete ------------------------- + # Documented functions: 449 + # Undocumented remaining: 1118 --------------------------- Game Status --------------------------- Balloons: 12/47, Keys: 1/4, Trophies: 0/5 T.T. Amulets: 1/4, Wizpig Amulets: 1/4 diff --git a/asm/math_util/rng.s b/asm/math_util/rng.s index ced428a8..b69af8c4 100644 --- a/asm/math_util/rng.s +++ b/asm/math_util/rng.s @@ -1,3 +1,4 @@ +/* Official Name: mathRnd */ glabel get_random_number_from_range /* 07054C 8006F94C 3C08800E */ lui $t0, %hi(gCurrentRNGSeed) # $t0, 0x800e /* 070550 8006F950 8D08D434 */ lw $t0, %lo(gCurrentRNGSeed)($t0) diff --git a/asm/non_matchings/game_ui/func_800A277C.s b/asm/non_matchings/game_ui/func_800A277C.s index 5854c3c9..1616292d 100644 --- a/asm/non_matchings/game_ui/func_800A277C.s +++ b/asm/non_matchings/game_ui/func_800A277C.s @@ -1044,7 +1044,7 @@ glabel func_800A277C /* 0A4290 800A3690 3C048012 */ lui $a0, %hi(D_80127194) # $a0, 0x8012 /* 0A4294 800A3694 8C847194 */ lw $a0, %lo(D_80127194)($a0) /* 0A4298 800A3698 8FA500C8 */ lw $a1, 0xc8($sp) -/* 0A429C 800A369C 0C01FC93 */ jal func_8007F24C +/* 0A429C 800A369C 0C01FC93 */ jal update_colour_cycle /* 0A42A0 800A36A0 00000000 */ nop /* 0A42A4 800A36A4 0C031059 */ jal set_kerning /* 0A42A8 800A36A8 00002025 */ move $a0, $zero diff --git a/asm/non_matchings/game_ui/func_800AA3EC.s b/asm/non_matchings/game_ui/func_800AA3EC.s deleted file mode 100644 index 737e535a..00000000 --- a/asm/non_matchings/game_ui/func_800AA3EC.s +++ /dev/null @@ -1,137 +0,0 @@ -glabel func_800AA3EC -/* 0AAFEC 800AA3EC 27BDFFD0 */ addiu $sp, $sp, -0x30 -/* 0AAFF0 800AA3F0 AFBF0014 */ sw $ra, 0x14($sp) -/* 0AAFF4 800AA3F4 E7AC0030 */ swc1 $f12, 0x30($sp) -/* 0AAFF8 800AA3F8 E7AE0034 */ swc1 $f14, 0x34($sp) -/* 0AAFFC 800AA3FC AFA60038 */ sw $a2, 0x38($sp) -/* 0AB000 800AA400 0C00B1F1 */ jal get_current_level_model -/* 0AB004 800AA404 AFA7003C */ sw $a3, 0x3c($sp) -/* 0AB008 800AA408 3C014270 */ li $at, 0x42700000 # 60.000000 -/* 0AB00C 800AA40C 44812000 */ mtc1 $at, $f4 -/* 0AB010 800AA410 C7A60040 */ lwc1 $f6, 0x40($sp) -/* 0AB014 800AA414 8443003C */ lh $v1, 0x3c($v0) -/* 0AB018 800AA418 46062202 */ mul.s $f8, $f4, $f6 -/* 0AB01C 800AA41C 44832000 */ mtc1 $v1, $f4 -/* 0AB020 800AA420 C44A0028 */ lwc1 $f10, 0x28($v0) -/* 0AB024 800AA424 844E003E */ lh $t6, 0x3e($v0) -/* 0AB028 800AA428 468021A0 */ cvt.s.w $f6, $f4 -/* 0AB02C 800AA42C C7B20030 */ lwc1 $f18, 0x30($sp) -/* 0AB030 800AA430 01C33023 */ subu $a2, $t6, $v1 -/* 0AB034 800AA434 460A4402 */ mul.s $f16, $f8, $f10 -/* 0AB038 800AA438 46069201 */ sub.s $f8, $f18, $f6 -/* 0AB03C 800AA43C 44862000 */ mtc1 $a2, $f4 -/* 0AB040 800AA440 84440044 */ lh $a0, 0x44($v0) -/* 0AB044 800AA444 46088282 */ mul.s $f10, $f16, $f8 -/* 0AB048 800AA448 3C01C270 */ li $at, 0xC2700000 # -60.000000 -/* 0AB04C 800AA44C 44818000 */ mtc1 $at, $f16 -/* 0AB050 800AA450 C446002C */ lwc1 $f6, 0x2c($v0) -/* 0AB054 800AA454 468024A0 */ cvt.s.w $f18, $f4 -/* 0AB058 800AA458 844F0046 */ lh $t7, 0x46($v0) -/* 0AB05C 800AA45C C7A40034 */ lwc1 $f4, 0x34($sp) -/* 0AB060 800AA460 46125003 */ div.s $f0, $f10, $f18 -/* 0AB064 800AA464 44845000 */ mtc1 $a0, $f10 -/* 0AB068 800AA468 46103202 */ mul.s $f8, $f6, $f16 -/* 0AB06C 800AA46C 01E43823 */ subu $a3, $t7, $a0 -/* 0AB070 800AA470 AFA2002C */ sw $v0, 0x2c($sp) -/* 0AB074 800AA474 468054A0 */ cvt.s.w $f18, $f10 -/* 0AB078 800AA478 44875000 */ mtc1 $a3, $f10 -/* 0AB07C 800AA47C 46122181 */ sub.s $f6, $f4, $f18 -/* 0AB080 800AA480 E7A00020 */ swc1 $f0, 0x20($sp) -/* 0AB084 800AA484 46064402 */ mul.s $f16, $f8, $f6 -/* 0AB088 800AA488 46805120 */ cvt.s.w $f4, $f10 -/* 0AB08C 800AA48C 00000000 */ nop -/* 0AB090 800AA490 46048083 */ div.s $f2, $f16, $f4 -/* 0AB094 800AA494 0C0270C3 */ jal get_filtered_cheats -/* 0AB098 800AA498 E7A2001C */ swc1 $f2, 0x1c($sp) -/* 0AB09C 800AA49C 8FA5002C */ lw $a1, 0x2c($sp) -/* 0AB0A0 800AA4A0 C7A00020 */ lwc1 $f0, 0x20($sp) -/* 0AB0A4 800AA4A4 C7A2001C */ lwc1 $f2, 0x1c($sp) -/* 0AB0A8 800AA4A8 C7AC003C */ lwc1 $f12, 0x3c($sp) -/* 0AB0AC 800AA4AC C7AE0038 */ lwc1 $f14, 0x38($sp) -/* 0AB0B0 800AA4B0 30580004 */ andi $t8, $v0, 4 -/* 0AB0B4 800AA4B4 13000028 */ beqz $t8, .L800AA558 -/* 0AB0B8 800AA4B8 00000000 */ nop -/* 0AB0BC 800AA4BC 460C0482 */ mul.s $f18, $f0, $f12 -/* 0AB0C0 800AA4C0 3C198012 */ lui $t9, %hi(D_80126D58) # $t9, 0x8012 -/* 0AB0C4 800AA4C4 8F396D58 */ lw $t9, %lo(D_80126D58)($t9) -/* 0AB0C8 800AA4C8 84A80034 */ lh $t0, 0x34($a1) -/* 0AB0CC 800AA4CC 460E1202 */ mul.s $f8, $f2, $f14 -/* 0AB0D0 800AA4D0 44995000 */ mtc1 $t9, $f10 -/* 0AB0D4 800AA4D4 3C098012 */ lui $t1, %hi(D_80126D1C) # $t1, 0x8012 -/* 0AB0D8 800AA4D8 8D296D1C */ lw $t1, %lo(D_80126D1C)($t1) -/* 0AB0DC 800AA4DC 46805420 */ cvt.s.w $f16, $f10 -/* 0AB0E0 800AA4E0 3C028012 */ lui $v0, %hi(D_80126CDC) # $v0, 0x8012 -/* 0AB0E4 800AA4E4 24426CDC */ addiu $v0, %lo(D_80126CDC) # addiu $v0, $v0, 0x6cdc -/* 0AB0E8 800AA4E8 46089180 */ add.s $f6, $f18, $f8 -/* 0AB0EC 800AA4EC 44889000 */ mtc1 $t0, $f18 -/* 0AB0F0 800AA4F0 46068101 */ sub.s $f4, $f16, $f6 -/* 0AB0F4 800AA4F4 44898000 */ mtc1 $t1, $f16 -/* 0AB0F8 800AA4F8 46809220 */ cvt.s.w $f8, $f18 -/* 0AB0FC 800AA4FC 8C4A0000 */ lw $t2, ($v0) -/* 0AB100 800AA500 3C0C8012 */ lui $t4, %hi(D_80126D5C) # $t4, 0x8012 -/* 0AB104 800AA504 468081A0 */ cvt.s.w $f6, $f16 -/* 0AB108 800AA508 3C0E8012 */ lui $t6, %hi(D_80126D20) # $t6, 0x8012 -/* 0AB10C 800AA50C 46082280 */ add.s $f10, $f4, $f8 -/* 0AB110 800AA510 46065481 */ sub.s $f18, $f10, $f6 -/* 0AB114 800AA514 E55201EC */ swc1 $f18, 0x1ec($t2) -/* 0AB118 800AA518 460E0402 */ mul.s $f16, $f0, $f14 -/* 0AB11C 800AA51C 8D8C6D5C */ lw $t4, %lo(D_80126D5C)($t4) -/* 0AB120 800AA520 84AB0036 */ lh $t3, 0x36($a1) -/* 0AB124 800AA524 8DCE6D20 */ lw $t6, %lo(D_80126D20)($t6) -/* 0AB128 800AA528 460C1282 */ mul.s $f10, $f2, $f12 -/* 0AB12C 800AA52C 016C6821 */ addu $t5, $t3, $t4 -/* 0AB130 800AA530 448D2000 */ mtc1 $t5, $f4 -/* 0AB134 800AA534 8C4F0000 */ lw $t7, ($v0) -/* 0AB138 800AA538 46802220 */ cvt.s.w $f8, $f4 -/* 0AB13C 800AA53C 448E2000 */ mtc1 $t6, $f4 -/* 0AB140 800AA540 460A8181 */ sub.s $f6, $f16, $f10 -/* 0AB144 800AA544 46802420 */ cvt.s.w $f16, $f4 -/* 0AB148 800AA548 46064481 */ sub.s $f18, $f8, $f6 -/* 0AB14C 800AA54C 46109280 */ add.s $f10, $f18, $f16 -/* 0AB150 800AA550 10000027 */ b .L800AA5F0 -/* 0AB154 800AA554 E5EA01F0 */ swc1 $f10, 0x1f0($t7) -.L800AA558: -/* 0AB158 800AA558 460C0202 */ mul.s $f8, $f0, $f12 -/* 0AB15C 800AA55C 3C188012 */ lui $t8, %hi(D_80126D58) # $t8, 0x8012 -/* 0AB160 800AA560 8F186D58 */ lw $t8, %lo(D_80126D58)($t8) -/* 0AB164 800AA564 84B90030 */ lh $t9, 0x30($a1) -/* 0AB168 800AA568 460E1182 */ mul.s $f6, $f2, $f14 -/* 0AB16C 800AA56C 44989000 */ mtc1 $t8, $f18 -/* 0AB170 800AA570 3C088012 */ lui $t0, %hi(D_80126D1C) # $t0, 0x8012 -/* 0AB174 800AA574 8D086D1C */ lw $t0, %lo(D_80126D1C)($t0) -/* 0AB178 800AA578 46809420 */ cvt.s.w $f16, $f18 -/* 0AB17C 800AA57C 3C028012 */ lui $v0, %hi(D_80126CDC) # $v0, 0x8012 -/* 0AB180 800AA580 24426CDC */ addiu $v0, %lo(D_80126CDC) # addiu $v0, $v0, 0x6cdc -/* 0AB184 800AA584 46064100 */ add.s $f4, $f8, $f6 -/* 0AB188 800AA588 44994000 */ mtc1 $t9, $f8 -/* 0AB18C 800AA58C 46048280 */ add.s $f10, $f16, $f4 -/* 0AB190 800AA590 44888000 */ mtc1 $t0, $f16 -/* 0AB194 800AA594 468041A0 */ cvt.s.w $f6, $f8 -/* 0AB198 800AA598 8C490000 */ lw $t1, ($v0) -/* 0AB19C 800AA59C 3C0B8012 */ lui $t3, %hi(D_80126D5C) # $t3, 0x8012 -/* 0AB1A0 800AA5A0 46808120 */ cvt.s.w $f4, $f16 -/* 0AB1A4 800AA5A4 3C0D8012 */ lui $t5, %hi(D_80126D20) # $t5, 0x8012 -/* 0AB1A8 800AA5A8 46065480 */ add.s $f18, $f10, $f6 -/* 0AB1AC 800AA5AC 46049201 */ sub.s $f8, $f18, $f4 -/* 0AB1B0 800AA5B0 E52801EC */ swc1 $f8, 0x1ec($t1) -/* 0AB1B4 800AA5B4 460E0402 */ mul.s $f16, $f0, $f14 -/* 0AB1B8 800AA5B8 8D6B6D5C */ lw $t3, %lo(D_80126D5C)($t3) -/* 0AB1BC 800AA5BC 84AA0032 */ lh $t2, 0x32($a1) -/* 0AB1C0 800AA5C0 8DAD6D20 */ lw $t5, %lo(D_80126D20)($t5) -/* 0AB1C4 800AA5C4 460C1482 */ mul.s $f18, $f2, $f12 -/* 0AB1C8 800AA5C8 014B6021 */ addu $t4, $t2, $t3 -/* 0AB1CC 800AA5CC 448C5000 */ mtc1 $t4, $f10 -/* 0AB1D0 800AA5D0 8C4E0000 */ lw $t6, ($v0) -/* 0AB1D4 800AA5D4 468051A0 */ cvt.s.w $f6, $f10 -/* 0AB1D8 800AA5D8 448D5000 */ mtc1 $t5, $f10 -/* 0AB1DC 800AA5DC 46128101 */ sub.s $f4, $f16, $f18 -/* 0AB1E0 800AA5E0 46805420 */ cvt.s.w $f16, $f10 -/* 0AB1E4 800AA5E4 46043201 */ sub.s $f8, $f6, $f4 -/* 0AB1E8 800AA5E8 46104480 */ add.s $f18, $f8, $f16 -/* 0AB1EC 800AA5EC E5D201F0 */ swc1 $f18, 0x1f0($t6) -.L800AA5F0: -/* 0AB1F0 800AA5F0 8FBF0014 */ lw $ra, 0x14($sp) -/* 0AB1F4 800AA5F4 27BD0030 */ addiu $sp, $sp, 0x30 -/* 0AB1F8 800AA5F8 03E00008 */ jr $ra -/* 0AB1FC 800AA5FC 00000000 */ nop - diff --git a/asm/non_matchings/objects/func_80011134.s b/asm/non_matchings/objects/func_80011134.s index cb40987d..32941486 100644 --- a/asm/non_matchings/objects/func_80011134.s +++ b/asm/non_matchings/objects/func_80011134.s @@ -49,7 +49,7 @@ glabel func_80011134 /* 011DEC 800111EC AFB8005C */ sw $t8, 0x5c($sp) /* 011DF0 800111F0 24A50008 */ addiu $a1, $a1, 8 /* 011DF4 800111F4 27A6005C */ addiu $a2, $sp, 0x5c -/* 011DF8 800111F8 0C01FBE0 */ jal func_8007EF80 +/* 011DF8 800111F8 0C01FBE0 */ jal tex_animate_texture /* 011DFC 800111FC 02C03825 */ move $a3, $s6 /* 011E00 80011200 8FB9005C */ lw $t9, 0x5c($sp) /* 011E04 80011204 00000000 */ nop diff --git a/asm/non_matchings/printf/func_800B3140.s b/asm/non_matchings/particles/func_800B3140.s similarity index 100% rename from asm/non_matchings/printf/func_800B3140.s rename to asm/non_matchings/particles/func_800B3140.s diff --git a/asm/non_matchings/printf/func_800B3240.s b/asm/non_matchings/particles/func_800B3240.s similarity index 100% rename from asm/non_matchings/printf/func_800B3240.s rename to asm/non_matchings/particles/func_800B3240.s diff --git a/asm/non_matchings/printf/func_800B3358.s b/asm/non_matchings/particles/func_800B3358.s similarity index 100% rename from asm/non_matchings/printf/func_800B3358.s rename to asm/non_matchings/particles/func_800B3358.s diff --git a/asm/non_matchings/printf/func_800B34B0.s b/asm/non_matchings/particles/func_800B34B0.s similarity index 100% rename from asm/non_matchings/printf/func_800B34B0.s rename to asm/non_matchings/particles/func_800B34B0.s diff --git a/asm/non_matchings/printf/func_800B3564.s b/asm/non_matchings/particles/func_800B3564.s similarity index 100% rename from asm/non_matchings/printf/func_800B3564.s rename to asm/non_matchings/particles/func_800B3564.s diff --git a/asm/non_matchings/printf/func_800B3740.s b/asm/non_matchings/particles/func_800B3740.s similarity index 100% rename from asm/non_matchings/printf/func_800B3740.s rename to asm/non_matchings/particles/func_800B3740.s diff --git a/asm/non_matchings/printf/func_800B3E64.s b/asm/non_matchings/particles/func_800B3E64.s similarity index 100% rename from asm/non_matchings/printf/func_800B3E64.s rename to asm/non_matchings/particles/func_800B3E64.s diff --git a/asm/non_matchings/printf/func_800B45C4.s b/asm/non_matchings/particles/func_800B45C4.s similarity index 100% rename from asm/non_matchings/printf/func_800B45C4.s rename to asm/non_matchings/particles/func_800B45C4.s diff --git a/asm/non_matchings/printf/func_800B461C.s b/asm/non_matchings/particles/func_800B461C.s similarity index 100% rename from asm/non_matchings/printf/func_800B461C.s rename to asm/non_matchings/particles/func_800B461C.s diff --git a/asm/non_matchings/printf/func_800B4668.s b/asm/non_matchings/particles/func_800B4668.s similarity index 100% rename from asm/non_matchings/printf/func_800B4668.s rename to asm/non_matchings/particles/func_800B4668.s diff --git a/asm/non_matchings/printf/func_800B46BC.s b/asm/non_matchings/particles/func_800B46BC.s similarity index 91% rename from asm/non_matchings/printf/func_800B46BC.s rename to asm/non_matchings/particles/func_800B46BC.s index 8d1fbfad..36fe19cf 100644 --- a/asm/non_matchings/printf/func_800B46BC.s +++ b/asm/non_matchings/particles/func_800B46BC.s @@ -178,20 +178,3 @@ glabel func_800B46BC /* 0B5500 800B4900 00001025 */ move $v0, $zero /* 0B5504 800B4904 03E00008 */ jr $ra /* 0B5508 800B4908 00000000 */ nop - -/* 0B550C 800B490C 2CC30001 */ sltiu $v1, $a2, 1 -/* 0B5510 800B4910 38630001 */ xori $v1, $v1, 1 -/* 0B5514 800B4914 00801025 */ move $v0, $a0 -/* 0B5518 800B4918 10600007 */ beqz $v1, .L800B4938 -/* 0B551C 800B491C 24C6FFFF */ addiu $a2, $a2, -1 -.L800B4920: -/* 0B5520 800B4920 2CC30001 */ sltiu $v1, $a2, 1 -/* 0B5524 800B4924 38630001 */ xori $v1, $v1, 1 -/* 0B5528 800B4928 24C6FFFF */ addiu $a2, $a2, -1 -/* 0B552C 800B492C A0450000 */ sb $a1, ($v0) -/* 0B5530 800B4930 1460FFFB */ bnez $v1, .L800B4920 -/* 0B5534 800B4934 24420001 */ addiu $v0, $v0, 1 -.L800B4938: -/* 0B5538 800B4938 03E00008 */ jr $ra -/* 0B553C 800B493C 00801025 */ move $v0, $a0 - diff --git a/asm/non_matchings/printf/func_800B63F4.s b/asm/non_matchings/printf/func_800B63F4.s deleted file mode 100644 index c78ac07f..00000000 --- a/asm/non_matchings/printf/func_800B63F4.s +++ /dev/null @@ -1,91 +0,0 @@ -# Unused? -glabel func_800B63F4 -/* 0B6FF4 800B63F4 27BDFEC8 */ addiu $sp, $sp, -0x138 -/* 0B6FF8 800B63F8 AFBF0014 */ sw $ra, 0x14($sp) -/* 0B6FFC 800B63FC AFA40138 */ sw $a0, 0x138($sp) -/* 0B7000 800B6400 AFA5013C */ sw $a1, 0x13c($sp) -/* 0B7004 800B6404 AFA60140 */ sw $a2, 0x140($sp) -/* 0B7008 800B6408 AFA70144 */ sw $a3, 0x144($sp) -/* 0B700C 800B640C 24040001 */ li $a0, 1 -/* 0B7010 800B6410 0C02D282 */ jal func_800B4A08 -/* 0B7014 800B6414 AFA0012C */ sw $zero, 0x12c($sp) -/* 0B7018 800B6418 8FA50138 */ lw $a1, 0x138($sp) -/* 0B701C 800B641C 27A4002C */ addiu $a0, $sp, 0x2c -/* 0B7020 800B6420 0C02D290 */ jal sprintf -/* 0B7024 800B6424 27A6013C */ addiu $a2, $sp, 0x13c -/* 0B7028 800B6428 0C02D282 */ jal func_800B4A08 -/* 0B702C 800B642C 00002025 */ move $a0, $zero -/* 0B7030 800B6430 93AF002C */ lbu $t7, 0x2c($sp) -/* 0B7034 800B6434 8FA7012C */ lw $a3, 0x12c($sp) -/* 0B7038 800B6438 27AE002C */ addiu $t6, $sp, 0x2c -/* 0B703C 800B643C 11E0003B */ beqz $t7, .L800B652C -/* 0B7040 800B6440 01C01825 */ move $v1, $t6 -/* 0B7044 800B6444 91C50000 */ lbu $a1, ($t6) -/* 0B7048 800B6448 3C0A800E */ lui $t2, %hi(D_800E2EF4) # $t2, 0x800e -/* 0B704C 800B644C 3C068012 */ lui $a2, %hi(gDebugFontTexture) # $a2, 0x8012 -/* 0B7050 800B6450 24C67CCC */ addiu $a2, %lo(gDebugFontTexture) # addiu $a2, $a2, 0x7ccc -/* 0B7054 800B6454 254A2EF4 */ addiu $t2, %lo(D_800E2EF4) # addiu $t2, $t2, 0x2ef4 -/* 0B7058 800B6458 240C0002 */ li $t4, 2 -/* 0B705C 800B645C 240B0001 */ li $t3, 1 -/* 0B7060 800B6460 24090020 */ li $t1, 32 -/* 0B7064 800B6464 2408000A */ li $t0, 10 -/* 0B7068 800B6468 00A01025 */ move $v0, $a1 -.L800B646C: -/* 0B706C 800B646C 1048002B */ beq $v0, $t0, .L800B651C -/* 0B7070 800B6470 00000000 */ nop -/* 0B7074 800B6474 14490003 */ bne $v0, $t1, .L800B6484 -/* 0B7078 800B6478 28410040 */ slti $at, $v0, 0x40 -/* 0B707C 800B647C 10000027 */ b .L800B651C -/* 0B7080 800B6480 24E70006 */ addiu $a3, $a3, 6 -.L800B6484: -/* 0B7084 800B6484 10200009 */ beqz $at, .L800B64AC -/* 0B7088 800B6488 28410060 */ slti $at, $v0, 0x60 -/* 0B708C 800B648C ACC00000 */ sw $zero, ($a2) -/* 0B7090 800B6490 90780000 */ lbu $t8, ($v1) -/* 0B7094 800B6494 00000000 */ nop -/* 0B7098 800B6498 2719FFDF */ addiu $t9, $t8, -0x21 -/* 0B709C 800B649C A0790000 */ sb $t9, ($v1) -/* 0B70A0 800B64A0 10000014 */ b .L800B64F4 -/* 0B70A4 800B64A4 332500FF */ andi $a1, $t9, 0xff -/* 0B70A8 800B64A8 28410060 */ slti $at, $v0, 0x60 -.L800B64AC: -/* 0B70AC 800B64AC 10200009 */ beqz $at, .L800B64D4 -/* 0B70B0 800B64B0 28410080 */ slti $at, $v0, 0x80 -/* 0B70B4 800B64B4 ACCB0000 */ sw $t3, ($a2) -/* 0B70B8 800B64B8 906D0000 */ lbu $t5, ($v1) -/* 0B70BC 800B64BC 00000000 */ nop -/* 0B70C0 800B64C0 25AFFFC0 */ addiu $t7, $t5, -0x40 -/* 0B70C4 800B64C4 A06F0000 */ sb $t7, ($v1) -/* 0B70C8 800B64C8 1000000A */ b .L800B64F4 -/* 0B70CC 800B64CC 31E500FF */ andi $a1, $t7, 0xff -/* 0B70D0 800B64D0 28410080 */ slti $at, $v0, 0x80 -.L800B64D4: -/* 0B70D4 800B64D4 10200007 */ beqz $at, .L800B64F4 -/* 0B70D8 800B64D8 00000000 */ nop -/* 0B70DC 800B64DC ACCC0000 */ sw $t4, ($a2) -/* 0B70E0 800B64E0 906E0000 */ lbu $t6, ($v1) -/* 0B70E4 800B64E4 00000000 */ nop -/* 0B70E8 800B64E8 25D8FFA0 */ addiu $t8, $t6, -0x60 -/* 0B70EC 800B64EC A0780000 */ sb $t8, ($v1) -/* 0B70F0 800B64F0 330500FF */ andi $a1, $t8, 0xff -.L800B64F4: -/* 0B70F4 800B64F4 8CD90000 */ lw $t9, ($a2) -/* 0B70F8 800B64F8 00057040 */ sll $t6, $a1, 1 -/* 0B70FC 800B64FC 00196980 */ sll $t5, $t9, 6 -/* 0B7100 800B6500 014D7821 */ addu $t7, $t2, $t5 -/* 0B7104 800B6504 01EE1021 */ addu $v0, $t7, $t6 -/* 0B7108 800B6508 90580001 */ lbu $t8, 1($v0) -/* 0B710C 800B650C 90440000 */ lbu $a0, ($v0) -/* 0B7110 800B6510 00F8C821 */ addu $t9, $a3, $t8 -/* 0B7114 800B6514 03243823 */ subu $a3, $t9, $a0 -/* 0B7118 800B6518 24E70001 */ addiu $a3, $a3, 1 -.L800B651C: -/* 0B711C 800B651C 90650001 */ lbu $a1, 1($v1) -/* 0B7120 800B6520 24630001 */ addiu $v1, $v1, 1 -/* 0B7124 800B6524 14A0FFD1 */ bnez $a1, .L800B646C -/* 0B7128 800B6528 00A01025 */ move $v0, $a1 -.L800B652C: -/* 0B712C 800B652C 8FBF0014 */ lw $ra, 0x14($sp) -/* 0B7130 800B6530 27BD0138 */ addiu $sp, $sp, 0x138 -/* 0B7134 800B6534 03E00008 */ jr $ra -/* 0B7138 800B6538 00E01025 */ move $v0, $a3 \ No newline at end of file diff --git a/asm/non_matchings/printf/render_printf.s b/asm/non_matchings/printf/render_printf.s deleted file mode 100644 index 6580cb4f..00000000 --- a/asm/non_matchings/printf/render_printf.s +++ /dev/null @@ -1,44 +0,0 @@ -glabel render_printf /* official name: diPrintf */ -/* 0B6ADC 800B5EDC 3C0E8013 */ lui $t6, %hi(gDebugPrintBufferEnd) # $t6, 0x8013 -/* 0B6AE0 800B5EE0 8DCE85D8 */ lw $t6, %lo(gDebugPrintBufferEnd)($t6) -/* 0B6AE4 800B5EE4 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0B6AE8 800B5EE8 3C0F8012 */ lui $t7, %hi(gDebugPrintBufferStart) # $t7, 0x8012 -/* 0B6AEC 800B5EEC 25EF7CD8 */ addiu $t7, %lo(gDebugPrintBufferStart) # addiu $t7, $t7, 0x7cd8 -/* 0B6AF0 800B5EF0 01CFC023 */ subu $t8, $t6, $t7 -/* 0B6AF4 800B5EF4 2B010801 */ slti $at, $t8, 0x801 -/* 0B6AF8 800B5EF8 AFBF0014 */ sw $ra, 0x14($sp) -/* 0B6AFC 800B5EFC AFA40020 */ sw $a0, 0x20($sp) -/* 0B6B00 800B5F00 AFA50024 */ sw $a1, 0x24($sp) -/* 0B6B04 800B5F04 AFA60028 */ sw $a2, 0x28($sp) -/* 0B6B08 800B5F08 14200003 */ bnez $at, .L800B5F18 -/* 0B6B0C 800B5F0C AFA7002C */ sw $a3, 0x2c($sp) -/* 0B6B10 800B5F10 10000015 */ b .L800B5F68 -/* 0B6B14 800B5F14 2402FFFF */ li $v0, -1 -.L800B5F18: -/* 0B6B18 800B5F18 0C02D282 */ jal func_800B4A08 -/* 0B6B1C 800B5F1C 24040001 */ li $a0, 1 -/* 0B6B20 800B5F20 3C048013 */ lui $a0, %hi(gDebugPrintBufferEnd) # $a0, 0x8013 -/* 0B6B24 800B5F24 8C8485D8 */ lw $a0, %lo(gDebugPrintBufferEnd)($a0) -/* 0B6B28 800B5F28 8FA50020 */ lw $a1, 0x20($sp) -/* 0B6B2C 800B5F2C 0C02D290 */ jal sprintf -/* 0B6B30 800B5F30 27A60024 */ addiu $a2, $sp, 0x24 -/* 0B6B34 800B5F34 00002025 */ move $a0, $zero -/* 0B6B38 800B5F38 0C02D282 */ jal func_800B4A08 -/* 0B6B3C 800B5F3C AFA20018 */ sw $v0, 0x18($sp) -/* 0B6B40 800B5F40 8FA30018 */ lw $v1, 0x18($sp) -/* 0B6B44 800B5F44 3C028013 */ lui $v0, %hi(gDebugPrintBufferEnd) # $v0, 0x8013 -/* 0B6B48 800B5F48 18600006 */ blez $v1, .L800B5F64 -/* 0B6B4C 800B5F4C 244285D8 */ addiu $v0, %lo(gDebugPrintBufferEnd) # addiu $v0, $v0, -0x7a28 -/* 0B6B50 800B5F50 8C590000 */ lw $t9, ($v0) -/* 0B6B54 800B5F54 00000000 */ nop -/* 0B6B58 800B5F58 03234021 */ addu $t0, $t9, $v1 -/* 0B6B5C 800B5F5C 25090001 */ addiu $t1, $t0, 1 -/* 0B6B60 800B5F60 AC490000 */ sw $t1, ($v0) -.L800B5F64: -/* 0B6B64 800B5F64 00001025 */ move $v0, $zero -.L800B5F68: -/* 0B6B68 800B5F68 8FBF0014 */ lw $ra, 0x14($sp) -/* 0B6B6C 800B5F6C 27BD0020 */ addiu $sp, $sp, 0x20 -/* 0B6B70 800B5F70 03E00008 */ jr $ra -/* 0B6B74 800B5F74 00000000 */ nop - diff --git a/asm/non_matchings/printf/sprintf.s b/asm/non_matchings/printf/vsprintf.s similarity index 99% rename from asm/non_matchings/printf/sprintf.s rename to asm/non_matchings/printf/vsprintf.s index d3621371..4f7c5f7a 100644 --- a/asm/non_matchings/printf/sprintf.s +++ b/asm/non_matchings/printf/vsprintf.s @@ -7,7 +7,7 @@ glabel jpt_800E8D88 .word L800B52C4, amGetSfxCount, L800B5794, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, L800B4F84, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, L800B5AC4, L800B4E38, L800B52C4, L800B57A4, L800B5794, amGetSfxCount, L800B4E38, amGetSfxCount, amGetSfxCount, amGetSfxCount, amGetSfxCount, L800B5D78, L800B4F64, L800B5C8C, amGetSfxCount, amGetSfxCount, L800B5B48, amGetSfxCount, L800B4F44, amGetSfxCount, amGetSfxCount, L800B4FA4 .text -glabel sprintf +glabel vsprintf /* 0B5640 800B4A40 27BDFE48 */ addiu $sp, $sp, -0x1b8 /* 0B5644 800B4A44 AFBF004C */ sw $ra, 0x4c($sp) /* 0B5648 800B4A48 AFBE0048 */ sw $fp, 0x48($sp) diff --git a/asm/non_matchings/textures_sprites/texInitTextures.s b/asm/non_matchings/textures_sprites/texInitTextures.s deleted file mode 100644 index d36cc6ba..00000000 --- a/asm/non_matchings/textures_sprites/texInitTextures.s +++ /dev/null @@ -1,111 +0,0 @@ -glabel texInitTextures -/* 07B870 8007AC70 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 07B874 8007AC74 AFBF0014 */ sw $ra, 0x14($sp) -/* 07B878 8007AC78 3C05FF00 */ lui $a1, (0xFF00FFFF >> 16) # lui $a1, 0xff00 -/* 07B87C 8007AC7C 34A5FFFF */ ori $a1, (0xFF00FFFF & 0xFFFF) # ori $a1, $a1, 0xffff -/* 07B880 8007AC80 0C01C327 */ jal allocate_from_main_pool_safe -/* 07B884 8007AC84 240415E0 */ li $a0, 5600 -/* 07B888 8007AC88 3C018012 */ lui $at, %hi(gTextureCache) # $at, 0x8012 -/* 07B88C 8007AC8C 3C05FF00 */ lui $a1, (0xFF00FFFF >> 16) # lui $a1, 0xff00 -/* 07B890 8007AC90 AC226328 */ sw $v0, %lo(gTextureCache)($at) -/* 07B894 8007AC94 34A5FFFF */ ori $a1, (0xFF00FFFF & 0xFFFF) # ori $a1, $a1, 0xffff -/* 07B898 8007AC98 0C01C327 */ jal allocate_from_main_pool_safe -/* 07B89C 8007AC9C 24040280 */ li $a0, 640 -/* 07B8A0 8007ACA0 3C018012 */ lui $at, %hi(gCiPalettes) # $at, 0x8012 -/* 07B8A4 8007ACA4 AC22632C */ sw $v0, %lo(gCiPalettes)($at) -/* 07B8A8 8007ACA8 3C018012 */ lui $at, %hi(gNumberOfLoadedTextures) # $at, 0x8012 -/* 07B8AC 8007ACAC AC206330 */ sw $zero, %lo(gNumberOfLoadedTextures)($at) -/* 07B8B0 8007ACB0 3C018012 */ lui $at, %hi(gCiPalettesSize) # $at, 0x8012 -/* 07B8B4 8007ACB4 AC206340 */ sw $zero, %lo(gCiPalettesSize)($at) -/* 07B8B8 8007ACB8 0C01DB16 */ jal load_asset_section_from_rom -/* 07B8BC 8007ACBC 24040005 */ li $a0, 5 -/* 07B8C0 8007ACC0 3C058012 */ lui $a1, %hi(D_80126320) # $a1, 0x8012 -/* 07B8C4 8007ACC4 24A56320 */ addiu $a1, %lo(D_80126320) # addiu $a1, $a1, 0x6320 -/* 07B8C8 8007ACC8 ACA20000 */ sw $v0, ($a1) -/* 07B8CC 8007ACCC 0C01DB16 */ jal load_asset_section_from_rom -/* 07B8D0 8007ACD0 24040003 */ li $a0, 3 -/* 07B8D4 8007ACD4 3C058012 */ lui $a1, %hi(D_80126320) # $a1, 0x8012 -/* 07B8D8 8007ACD8 24A56320 */ addiu $a1, %lo(D_80126320) # addiu $a1, $a1, 0x6320 -/* 07B8DC 8007ACDC 8CA40000 */ lw $a0, ($a1) -/* 07B8E0 8007ACE0 ACA20004 */ sw $v0, 4($a1) -/* 07B8E4 8007ACE4 8C8E0000 */ lw $t6, ($a0) -/* 07B8E8 8007ACE8 2407FFFF */ li $a3, -1 -/* 07B8EC 8007ACEC 10EE0006 */ beq $a3, $t6, .L8007AD08 -/* 07B8F0 8007ACF0 00001825 */ move $v1, $zero -/* 07B8F4 8007ACF4 00801025 */ move $v0, $a0 -.L8007ACF8: -/* 07B8F8 8007ACF8 8C4F0004 */ lw $t7, 4($v0) -/* 07B8FC 8007ACFC 24630001 */ addiu $v1, $v1, 1 -/* 07B900 8007AD00 14EFFFFD */ bne $a3, $t7, .L8007ACF8 -/* 07B904 8007AD04 24420004 */ addiu $v0, $v0, 4 -.L8007AD08: -/* 07B908 8007AD08 3C068012 */ lui $a2, %hi(D_80126338) # $a2, 0x8012 -/* 07B90C 8007AD0C 8CA40004 */ lw $a0, 4($a1) -/* 07B910 8007AD10 24C66338 */ addiu $a2, %lo(D_80126338) # addiu $a2, $a2, 0x6338 -/* 07B914 8007AD14 2463FFFF */ addiu $v1, $v1, -1 -/* 07B918 8007AD18 ACC30000 */ sw $v1, ($a2) -/* 07B91C 8007AD1C 8C980000 */ lw $t8, ($a0) -/* 07B920 8007AD20 00001825 */ move $v1, $zero -/* 07B924 8007AD24 10F80006 */ beq $a3, $t8, .L8007AD40 -/* 07B928 8007AD28 3C05FF00 */ lui $a1, (0xFF00FFFF >> 16) # lui $a1, 0xff00 -/* 07B92C 8007AD2C 00801025 */ move $v0, $a0 -.L8007AD30: -/* 07B930 8007AD30 8C590004 */ lw $t9, 4($v0) -/* 07B934 8007AD34 24630001 */ addiu $v1, $v1, 1 -/* 07B938 8007AD38 14F9FFFD */ bne $a3, $t9, .L8007AD30 -/* 07B93C 8007AD3C 24420004 */ addiu $v0, $v0, 4 -.L8007AD40: -/* 07B940 8007AD40 2463FFFF */ addiu $v1, $v1, -1 -/* 07B944 8007AD44 ACC30004 */ sw $v1, 4($a2) -/* 07B948 8007AD48 24040320 */ li $a0, 800 -/* 07B94C 8007AD4C 0C01C327 */ jal allocate_from_main_pool_safe -/* 07B950 8007AD50 34A5FFFF */ ori $a1, (0xFF00FFFF & 0xFFFF) # ori $a1, $a1, 0xffff -/* 07B954 8007AD54 3C018012 */ lui $at, %hi(gSpriteCache) # $at, 0x8012 -/* 07B958 8007AD58 3C05FF00 */ lui $a1, (0xFF00FFFF >> 16) # lui $a1, 0xff00 -/* 07B95C 8007AD5C AC22634C */ sw $v0, %lo(gSpriteCache)($at) -/* 07B960 8007AD60 34A5FFFF */ ori $a1, (0xFF00FFFF & 0xFFFF) # ori $a1, $a1, 0xffff -/* 07B964 8007AD64 0C01C327 */ jal allocate_from_main_pool_safe -/* 07B968 8007AD68 24040200 */ li $a0, 512 -/* 07B96C 8007AD6C 3C018012 */ lui $at, %hi(gCurrentSprite) # $at, 0x8012 -/* 07B970 8007AD70 AC226350 */ sw $v0, %lo(gCurrentSprite)($at) -/* 07B974 8007AD74 3C018012 */ lui $at, %hi(D_80126358) # $at, 0x8012 -/* 07B978 8007AD78 AC206358 */ sw $zero, %lo(D_80126358)($at) -/* 07B97C 8007AD7C 0C01DB16 */ jal load_asset_section_from_rom -/* 07B980 8007AD80 2404000D */ li $a0, 13 -/* 07B984 8007AD84 3C058012 */ lui $a1, %hi(gSpriteOffsetTable) # $a1, 0x8012 -/* 07B988 8007AD88 3C068012 */ lui $a2, %hi(D_80126354) # $a2, 0x8012 -/* 07B98C 8007AD8C 24C66354 */ addiu $a2, %lo(D_80126354) # addiu $a2, $a2, 0x6354 -/* 07B990 8007AD90 24A56348 */ addiu $a1, %lo(gSpriteOffsetTable) # addiu $a1, $a1, 0x6348 -/* 07B994 8007AD94 00004080 */ sll $t0, $zero, 2 -/* 07B998 8007AD98 ACA20000 */ sw $v0, ($a1) -/* 07B99C 8007AD9C ACC00000 */ sw $zero, ($a2) -/* 07B9A0 8007ADA0 00484821 */ addu $t1, $v0, $t0 -/* 07B9A4 8007ADA4 8D2A0000 */ lw $t2, ($t1) -/* 07B9A8 8007ADA8 2407FFFF */ li $a3, -1 -/* 07B9AC 8007ADAC 00402025 */ move $a0, $v0 -/* 07B9B0 8007ADB0 10EA0009 */ beq $a3, $t2, .L8007ADD8 -/* 07B9B4 8007ADB4 00001825 */ move $v1, $zero -/* 07B9B8 8007ADB8 246B0001 */ addiu $t3, $v1, 1 -.L8007ADBC: -/* 07B9BC 8007ADBC 000B6080 */ sll $t4, $t3, 2 -/* 07B9C0 8007ADC0 008C6821 */ addu $t5, $a0, $t4 -/* 07B9C4 8007ADC4 ACCB0000 */ sw $t3, ($a2) -/* 07B9C8 8007ADC8 8DAE0000 */ lw $t6, ($t5) -/* 07B9CC 8007ADCC 01601825 */ move $v1, $t3 -/* 07B9D0 8007ADD0 14EEFFFA */ bne $a3, $t6, .L8007ADBC -/* 07B9D4 8007ADD4 246B0001 */ addiu $t3, $v1, 1 -.L8007ADD8: -/* 07B9D8 8007ADD8 246FFFFF */ addiu $t7, $v1, -1 -/* 07B9DC 8007ADDC 3C05FF00 */ lui $a1, (0xFF00FFFF >> 16) # lui $a1, 0xff00 -/* 07B9E0 8007ADE0 ACCF0000 */ sw $t7, ($a2) -/* 07B9E4 8007ADE4 34A5FFFF */ ori $a1, (0xFF00FFFF & 0xFFFF) # ori $a1, $a1, 0xffff -/* 07B9E8 8007ADE8 0C01C327 */ jal allocate_from_main_pool_safe -/* 07B9EC 8007ADEC 24040028 */ li $a0, 40 -/* 07B9F0 8007ADF0 3C018012 */ lui $at, %hi(gTempTextureHeader) # $at, 0x8012 -/* 07B9F4 8007ADF4 8FBF0014 */ lw $ra, 0x14($sp) -/* 07B9F8 8007ADF8 AC22636C */ sw $v0, %lo(gTempTextureHeader)($at) -/* 07B9FC 8007ADFC 3C018012 */ lui $at, %hi(D_80126344) # $at, 0x8012 -/* 07BA00 8007AE00 AC206344 */ sw $zero, %lo(D_80126344)($at) -/* 07BA04 8007AE04 03E00008 */ jr $ra -/* 07BA08 8007AE08 27BD0018 */ addiu $sp, $sp, 0x18 - diff --git a/asm/non_matchings/textures_sprites/func_8007F24C.s b/asm/non_matchings/textures_sprites/update_colour_cycle.s similarity index 99% rename from asm/non_matchings/textures_sprites/func_8007F24C.s rename to asm/non_matchings/textures_sprites/update_colour_cycle.s index 7eb08ed5..77c70a58 100644 --- a/asm/non_matchings/textures_sprites/func_8007F24C.s +++ b/asm/non_matchings/textures_sprites/update_colour_cycle.s @@ -1,4 +1,4 @@ -glabel func_8007F24C +glabel update_colour_cycle /* 07FE4C 8007F24C 8C8E0000 */ lw $t6, ($a0) /* 07FE50 8007F250 27BDFFE0 */ addiu $sp, $sp, -0x20 /* 07FE54 8007F254 29C10002 */ slti $at, $t6, 2 diff --git a/include/sched.h b/include/sched.h index 3e734e25..f0b76a2c 100644 --- a/include/sched.h +++ b/include/sched.h @@ -68,7 +68,7 @@ typedef struct OSScTask_s { s32 unk60; s32 unk64; s32 unk68; /* Added by Rare? */ - s32 unk6C; + s32 unk6C; /* Task ID, used in debug functions in JFG */ } OSScTask; typedef struct SCClient_s { diff --git a/include/structs.h b/include/structs.h index 7057d1b5..9170c40d 100644 --- a/include/structs.h +++ b/include/structs.h @@ -570,7 +570,8 @@ typedef struct LevelModelSegment { /* 0x32 */ s16 unk32; s16 *unk34; /* 0x38 */ s16 unk38; - u8 pad3A[6]; + u8 pad3A[2]; +/* 0x3C */ s32 unk3C; /* 0x40 */ u8 numberofOpaqueBatches; u8 pad41[0x3]; } LevelModelSegment; @@ -597,17 +598,22 @@ typedef struct LevelModel { /* 0x00 */ TextureInfo *textures; /* 0x04 */ LevelModelSegment *segments; /* 0x08 */ LevelModelSegmentBoundingBox *segmentsBoundingBoxes; -/* 0x0C */ s32 unkC; +/* 0x0C */ u8 *unkC; //Unused? /* 0x10 */ u8 *segmentsBitfields; /* 0x14 */ BspTreeNode *segmentsBspTree; /* 0x18 */ s16 numberOfTextures; /* 0x1A */ s16 numberOfSegments; -/* 0x1C */ s16 unk1C; -/* 0x1E */ s16 unk1E; -/* 0x20 */ s32 minimapSprite; -/* 0x24 */ u16 unk24; -/* 0x26 */ u16 unk26; - u8 pad28[0x10]; +/* 0x1C */ s16 unk1C; // Unused? +/* 0x1E */ s16 numberOfAnimatedTextures; +/* 0x20 */ s32 minimapSpriteIndex; +/* 0x24 */ u16 minimapRotation; // angle for icons on minimap? +/* 0x26 */ u16 unk26; // Unused? Common values: 0x0009, 0xFFFF, 0x0303 +/* 0x28 */ f32 minimapXScale; +/* 0x2C */ f32 minimapYScale; +/* 0x30 */ s16 minimapOffsetXAdv1; // minimap X offset (Adventure 1) +/* 0x32 */ s16 minimapOffsetYAdv1; // minimap Y offset (Adventure 1) +/* 0x34 */ s16 minimapOffsetXAdv2; // minimap X offset (Adventure 2) +/* 0x36 */ s16 minimapOffsetYAdv2; // minimap Y offset (Adventure 2) /* 0x38 */ u32 minimapColor; /* 0x3C */ s16 lowerXBounds; /* 0x3E */ s16 upperXBounds; @@ -654,7 +660,10 @@ typedef struct ObjectHeader { /* 0x32 */ s16 unk36; u8 pad38[5]; /* 0x3D */ u8 unk3D; - u8 pad3E[12]; + u8 pad3E[4]; + /* 0x42 */ s16 unk42; + /* 0x44 */ s16 unk44; + u8 pad46[4]; /* 0x4A */ s16 unk4A; /* 0x4C */ s16 unk4C; /* 0x4E */ s16 drawDistance; diff --git a/lib/asm/exception/__osException.s b/lib/asm/exception/__osException.s index 6eed695b..0932b9a5 100644 --- a/lib/asm/exception/__osException.s +++ b/lib/asm/exception/__osException.s @@ -145,7 +145,7 @@ glabel __osException /* 0D3A8C 800D2E8C 112A00B0 */ beq $t1, $t2, .L800D3150 /* 0D3A90 800D2E90 00000000 */ nop /* 0D3A94 800D2E94 240A002C */ li $t2, 44 -/* 0D3A98 800D2E98 112A00FF */ beq $t1, $t2, .L800D3298 +/* 0D3A98 800D2E98 112A00FF */ beq $t1, $t2, handle_CpU /* 0D3A9C 800D2E9C 00000000 */ nop /* 0D3AA0 800D2EA0 240A0000 */ li $t2, 0 /* 0D3AA4 800D2EA4 152A00C3 */ bne $t1, $t2, .L800D31B4 diff --git a/lib/asm/exception/send_mesg.s b/lib/asm/exception/send_mesg.s index b2ce7a64..9bea017a 100644 --- a/lib/asm/exception/send_mesg.s +++ b/lib/asm/exception/send_mesg.s @@ -47,7 +47,7 @@ glabel send_mesg .L800D3290: /* 0D3E90 800D3290 02400008 */ jr $s2 /* 0D3E94 800D3294 00000000 */ nop -.L800D3298: +glabel handle_CpU /* 0D3E98 800D3298 3C013000 */ lui $at, 0x3000 /* 0D3E9C 800D329C 01014824 */ and $t1, $t0, $at /* 0D3EA0 800D32A0 00094F02 */ srl $t1, $t1, 0x1c diff --git a/lib/src/al/env.c b/lib/src/al/env.c index 0079ce26..a3c7146c 100644 --- a/lib/src/al/env.c +++ b/lib/src/al/env.c @@ -24,7 +24,7 @@ #include "types.h" #include "macros.h" #include "audio_internal.h" -#include "thread0_epc.h" +#include "unknown_B7B30.h" // TODO: these come from headers #ident "$Revision: 1.17 $" @@ -111,11 +111,10 @@ Acmd *alEnvmixerPull(void *filter, UNUSED s16 *outp, s32 outCount, s32 sampleOff assert(samples <= AL_MAX_RSP_SAMPLES); #else // Something must have gone wrong when compiling this file, and the asserts got left in. - // The function happens to currently live in the thread0 file for some reason. if (samples >= 0) {} - else { thread0_Assert("samples >= 0", "env.c", 104); } + else { assert_stub("samples >= 0", "env.c", 104); } if (samples <= AL_MAX_RSP_SAMPLES) {} - else { thread0_Assert("samples <= AL_MAX_RSP_SAMPLES", "env.c", 105); } + else { assert_stub("samples <= AL_MAX_RSP_SAMPLES", "env.c", 105); } #endif @@ -389,9 +388,8 @@ Acmd* _pullSubFrame(void *filter, s16 *inp, s16 *outp, s32 outCount, assert(source); #else // Something must have gone wrong when compiling this file, and the asserts got left in. - // The function happens to currently live in the thread0 file for some reason. if (source) {} - else { thread0_Assert("source", "env.c", 373); } + else { assert_stub("source", "env.c", 373); } #endif ptr = (*source->handler)(source, inp, outCount, sampleOffset, p); diff --git a/src/asset_loading.c b/src/asset_loading.c index 77fd20d4..addb0597 100644 --- a/src/asset_loading.c +++ b/src/asset_loading.c @@ -25,6 +25,7 @@ extern u8 __ASSETS_LUT_START[], __ASSETS_LUT_END[]; // __ASSETS_LUT_START = 0xEC * Set up the peripheral interface message queues and scheduling. * This will send messages when DMA reads are finished. * After, allocate space and load the asset table into RAM. + * Official Name: piInit */ void init_PI_mesg_queue(void) { u32 assetTableSize; @@ -39,6 +40,7 @@ void init_PI_mesg_queue(void) { /** * Returns the memory address containing an asset section loaded from ROM. + * Official Name: piRomLoad */ u32 *load_asset_section_from_rom(u32 assetIndex) { u32 *index; diff --git a/src/audiomgr.c b/src/audiomgr.c index d558444c..ab6831ff 100644 --- a/src/audiomgr.c +++ b/src/audiomgr.c @@ -210,10 +210,16 @@ void amCreateAudioMgr(ALSynConfig *c, OSPri pri, OSSched *audSched) { (void *)(audioStack+AUDIO_STACKSIZE/sizeof(u64)), pri); } +/** + * Official Name: amGo +*/ void audioStartThread(void) { osStartThread(&__am.thread); } +/** + * Official Name: amGoStop + */ void audioStopThread(void) { osStopThread(&__am.thread); } diff --git a/src/audiosfx.c b/src/audiosfx.c index 8f27bd7b..3ce2c13b 100644 --- a/src/audiosfx.c +++ b/src/audiosfx.c @@ -270,6 +270,7 @@ void func_800049F8(s32 soundMask, s16 type, u32 volume) { /** * Returns the volume level of the channel ID. + * Official Name: gsSndpGetMasterVolume */ u16 get_sound_channel_volume(u8 channel) { return gSoundChannelVolume[channel]; @@ -278,6 +279,7 @@ u16 get_sound_channel_volume(u8 channel) { //TODO: The structs used here are almost definitely wrong, but they do match, so it can at least show the pattern we're looking for. /** * Looks for the intended audio channel in the main buffer and adjusts its volume + * Official Name: gsSndpSetMasterVolume */ void set_sound_channel_volume(u8 channel, u16 volume) { OSIntMask mask; diff --git a/src/camera.c b/src/camera.c index 26e882de..72c19bf7 100644 --- a/src/camera.c +++ b/src/camera.c @@ -137,7 +137,9 @@ Matrix D_801210A0; #ifdef NON_EQUIVALENT extern s32 D_B0000578; - +/** + * Official Name: camInit +*/ void func_80065EA0(void) { s32 i, j; for (i = 0; i < 5; i++) { diff --git a/src/controller.c b/src/controller.c index 2af2a212..0e01e99a 100644 --- a/src/controller.c +++ b/src/controller.c @@ -10,10 +10,9 @@ u16 gButtonMask = 0xFFFF; //Used when anti-cheat/anti-tamper has failed in func_ OSMesgQueue sSIMesgQueue; OSMesg sSIMesgBuf; OSMesg gSIMesg; -OSContStatus status; -UNUSED s32 D_80121108[2]; -OSContPad sControllerCurrData[MAXCONTROLLERS]; -OSContPad sControllerPrevData[MAXCONTROLLERS]; +OSContStatus gControllerStatus[MAXCONTROLLERS]; +OSContPad gControllerCurrData[MAXCONTROLLERS]; +OSContPad gControllerPrevData[MAXCONTROLLERS]; u16 gControllerButtonsPressed[MAXCONTROLLERS]; u16 gControllerButtonsReleased[MAXCONTROLLERS]; u8 sPlayerID[16]; @@ -37,13 +36,13 @@ s32 init_controllers(void) { osCreateMesgQueue(&sSIMesgQueue, &sSIMesgBuf, 1); osSetEventMesg(OS_EVENT_SI, &sSIMesgQueue, gSIMesg); - osContInit(&sSIMesgQueue, &bitpattern, &status); + osContInit(&sSIMesgQueue, &bitpattern, gControllerStatus); osContStartReadData(&sSIMesgQueue); initialise_player_ids(); sNoControllerPluggedIn = FALSE; - if ((bitpattern & CONT_ABSOLUTE) && (!(status.errno & CONT_NO_RESPONSE_ERROR))) { + if ((bitpattern & CONT_ABSOLUTE) && (!(gControllerStatus[0].errno & CONT_NO_RESPONSE_ERROR))) { return CONTROLLER_EXISTS; } @@ -68,9 +67,9 @@ s32 handle_save_data_and_read_controller(s32 saveDataFlags, s32 updateRate) { if (osRecvMesg(&sSIMesgQueue, &unusedMsg, OS_MESG_NOBLOCK) == 0) { //Back up old controller data for (i = 0; i < MAXCONTROLLERS; i++) { - sControllerPrevData[i] = sControllerCurrData[i]; + gControllerPrevData[i] = gControllerCurrData[i]; } - osContGetReadData(sControllerCurrData); + osContGetReadData(gControllerCurrData); if (saveDataFlags != 0) { settings = get_settings(); if (SAVE_DATA_FLAG_READ_EEPROM_INDEX(saveDataFlags)) { @@ -110,11 +109,11 @@ s32 handle_save_data_and_read_controller(s32 saveDataFlags, s32 updateRate) { } for (i = 0; i < MAXCONTROLLERS; i++) { if (sNoControllerPluggedIn) { - sControllerCurrData[i].button = 0; + gControllerCurrData[i].button = 0; } //XOR the diff between the last read of the controller data with the current read to see what buttons have been pushed and released. - gControllerButtonsPressed[i] = ((sControllerCurrData[i].button ^ sControllerPrevData[i].button) & sControllerCurrData[i].button) & gButtonMask; - gControllerButtonsReleased[i] = ((sControllerCurrData[i].button ^ sControllerPrevData[i].button) & sControllerPrevData[i].button) & gButtonMask; + gControllerButtonsPressed[i] = ((gControllerCurrData[i].button ^ gControllerPrevData[i].button) & gControllerCurrData[i].button) & gButtonMask; + gControllerButtonsReleased[i] = ((gControllerCurrData[i].button ^ gControllerPrevData[i].button) & gControllerPrevData[i].button) & gButtonMask; } return saveDataFlags; } @@ -173,7 +172,7 @@ void swap_player_1_and_2_ids(void) { * Official name: joyGetButtons */ u16 get_buttons_held_from_player(s32 player) { - return sControllerCurrData[sPlayerID[player]].button; + return gControllerCurrData[sPlayerID[player]].button; } /** @@ -198,7 +197,7 @@ u16 get_buttons_released_from_player(s32 player) { * Official name: joyGetStickX */ s8 clamp_joystick_x_axis(s32 player) { - return clamp_joystick(sControllerCurrData[sPlayerID[player]].stick_x); + return clamp_joystick(gControllerCurrData[sPlayerID[player]].stick_x); } /** @@ -206,7 +205,7 @@ s8 clamp_joystick_x_axis(s32 player) { * Official name: joyGetStickY */ s8 clamp_joystick_y_axis(s32 player) { - return clamp_joystick(sControllerCurrData[sPlayerID[player]].stick_y); + return clamp_joystick(gControllerCurrData[sPlayerID[player]].stick_y); } /** @@ -218,12 +217,12 @@ s8 clamp_joystick(s8 stickMag) { return 0; } if (stickMag > 0) { - stickMag -= 8; + stickMag -= JOYSTICK_DEADZONE; if (stickMag > JOYSTICK_MAX_RANGE) { stickMag = JOYSTICK_MAX_RANGE; } } else { - stickMag += 8; + stickMag += JOYSTICK_DEADZONE; if (stickMag < -JOYSTICK_MAX_RANGE) { stickMag = -JOYSTICK_MAX_RANGE; } diff --git a/src/font.c b/src/font.c index 9c709737..cafd26f2 100644 --- a/src/font.c +++ b/src/font.c @@ -66,10 +66,10 @@ OSDevMgr __osPiDevMgr = { /************ .bss ************/ s32 gNumberOfFonts; -FontData *gFonts; -DialogueBoxBackground *gDialogueBoxBackground; -DialogueTextElement *gDialogueText; -s32 gCompactKerning; // Boolean value, seems to be related to X placement of menus on the X Axis? +FontData *gFonts; //Official Name: Font +DialogueBoxBackground *gDialogueBoxBackground; //Official Name: Window +DialogueTextElement *gDialogueText; //Official Name: String +s32 gCompactKerning; // Official Name: squash - Boolean value, seems to be related to X placement of menus on the X Axis? s8 sDialogueBoxCloseTimer; UNUSED s32 D_8012A7F8; UNUSED s32 D_8012A7FC; @@ -223,6 +223,7 @@ UNUSED TextureHeader *get_loaded_font(s32 font, u8 index) { /** * Sets the colour of the current dialogue box's text. + * Official Name: fontColour */ void set_text_colour(s32 red, s32 green, s32 blue, s32 alpha, s32 opacity) { gDialogueBoxBackground[0].textColourR = red; @@ -234,6 +235,7 @@ void set_text_colour(s32 red, s32 green, s32 blue, s32 alpha, s32 opacity) { /** * Sets the colour of the current dialogue box's text background. + * Official Name: fontBackground */ void set_text_background_colour(s32 red, s32 green, s32 blue, s32 alpha) { gDialogueBoxBackground[0].textBGColourR = red; @@ -251,6 +253,7 @@ UNUSED void draw_text_plain_unused(Gfx **displayList, char *text, AlignmentFlags /** * Builds the background settings, then renders the given text at a given position. + * Official Name: fontPrintWindowXY? */ void draw_text(Gfx **displayList, s32 xpos, s32 ypos, char *text, AlignmentFlags alignmentFlags) { DialogueBoxBackground *temp = &gDialogueBoxBackground[0]; @@ -271,6 +274,7 @@ UNUSED void draw_dialogue_text_unused(Gfx **displayList, s32 dialogueBoxID, char /** * Unused text draw function that would draw text in the current dialogue box while overriding position. + * Official Name: fontPrintWindowXY */ UNUSED void draw_dialogue_text_pos_unused(Gfx **displayList, s32 dialogueBoxID, s32 xpos, s32 ypos, char *text, AlignmentFlags alignmentFlags) { if (dialogueBoxID >= 0 && dialogueBoxID < DIALOGUEBOXBACKGROUND_COUNT) { @@ -439,6 +443,7 @@ void render_text_string(Gfx **dList, DialogueBoxBackground *box, char *text, Ali /** * Start from the beginning of the line then add to an offset from the starting position. * Returns the width of the string. + * Official Name: fontStringWidth */ s32 get_text_width(char *text, s32 x, s32 font) { s32 diffX, thisDiffX; @@ -483,6 +488,7 @@ s32 get_text_width(char *text, s32 x, s32 font) { /** * Sets the position and size of the current dialogue box. + * Official Name: fontWindowSize */ void set_current_dialogue_box_coords(s32 dialogueBoxID, s32 x1, s32 y1, s32 x2, s32 y2) { if (dialogueBoxID > 0 && dialogueBoxID < DIALOGUEBOXBACKGROUND_COUNT) { @@ -510,6 +516,7 @@ void set_current_dialogue_box_coords(s32 dialogueBoxID, s32 x1, s32 y1, s32 x2, /** * Sets the active front of the current dialogue box. + * Official Name: fontWindowUseFont */ void set_dialogue_font(s32 dialogueBoxID, s32 font) { if (dialogueBoxID >= 0 && dialogueBoxID < DIALOGUEBOXBACKGROUND_COUNT) { @@ -519,8 +526,10 @@ void set_dialogue_font(s32 dialogueBoxID, s32 font) { } } } + /** * Sets the background colour of the current dialogue box. + * Official Name: fontWindowColour */ void set_current_dialogue_background_colour(s32 dialogueBoxID, s32 red, s32 green, s32 blue, s32 alpha) { if (dialogueBoxID > 0 && dialogueBoxID < DIALOGUEBOXBACKGROUND_COUNT) { @@ -534,6 +543,7 @@ void set_current_dialogue_background_colour(s32 dialogueBoxID, s32 red, s32 gree /** * Sets the text colour of the current dialogue box. + * Official Name: fontWindowFontColour */ void set_current_text_colour(s32 dialogueBoxID, s32 red, s32 green, s32 blue, s32 alpha, s32 opacity) { DialogueBoxBackground *temp; @@ -550,6 +560,7 @@ void set_current_text_colour(s32 dialogueBoxID, s32 red, s32 green, s32 blue, s3 /** * Sets text background colour of the current dialogue box. + * Official Name: fontWindowFontBackground */ void set_current_text_background_colour(s32 dialogueBoxID, s32 red, s32 green, s32 blue, s32 alpha) { DialogueBoxBackground *dialogueBox; @@ -603,6 +614,7 @@ UNUSED void func_800C510C(s32 dialogueBoxID, char *text, s32 number, s32 flags) /** * Draws the text portion of a dialogue box that's passed through. * Binds the text to the box, then returns it. + * Official Name: fontWindowAddStringXY */ void *render_dialogue_text(s32 dialogueBoxID, s32 posX, s32 posY, char *text, s32 number, s32 flags) { s32 width; @@ -709,6 +721,7 @@ UNUSED void move_dialogue_box_to_front(s32 dialogueBoxID, DialogueBox *dialogueB /** * Unused function that moved a dialogue box ID to the front of the list. + * Official Name: fontWindowFlushStrings */ void assign_dialogue_box_id(s32 dialogueBoxID) { DialogueBoxBackground *dialogueBox; @@ -768,6 +781,7 @@ void open_dialogue_box(s32 dialogueBoxID) { /** * Mark the selected dialogue box as closed + * Official Name: fontWindowDisable */ void close_dialogue_box(s32 dialogueBoxID) { gDialogueBoxBackground[dialogueBoxID].flags &= DIALOGUE_BOX_CLOSED; @@ -802,6 +816,7 @@ void func_800C56D0(s32 dialogueBoxID) { * Main function to render each dialogue box entry. * Contains a timer that counts down two frames before closing a dialogue box * when the player exits out of one. + * Official Name: fontWindowsDraw */ void render_dialogue_boxes(Gfx **dlist, MatrixS **mat, Vertex **verts) { s32 i; @@ -827,6 +842,7 @@ void render_dialogue_boxes(Gfx **dlist, MatrixS **mat, Vertex **verts) { /** * Convert an integer to a string. + * Official Name: fontStringAddNumber */ void s32_to_string(char **outString, s32 number) { u8 digit; @@ -890,6 +906,7 @@ void render_fill_rectangle(Gfx **dlist, s32 ulx, s32 uly, s32 lrx, s32 lry) { /** * Render the selected dialogue box. Background first, then text. + * Official Name: fontWindowDraw */ void render_dialogue_box(Gfx **dlist, MatrixS **mat, Vertex **verts, s32 dialogueBoxID) { DialogueBoxBackground *dialogueBox; diff --git a/src/game.c b/src/game.c index af5ac149..1a388477 100644 --- a/src/game.c +++ b/src/game.c @@ -89,7 +89,7 @@ UNUSED char gBuildString[40] = "Version 7.7 29/09/97 15.00 L.Schuneman"; s8 sAntiPiracyTriggered = 0; UNUSED s32 D_800DD378 = 1; -s32 gSaveDataFlags = 0; +s32 gSaveDataFlags = 0; //Official Name: load_save_flags s32 gScreenStatus = OSMESG_SWAP_BUFFER; s32 sControllerStatus = 0; UNUSED s32 D_800DD388 = 0; @@ -175,7 +175,8 @@ s32 gCurrNumHudVertsPerPlayer; OSScClient *gNMISched[3]; OSMesg gNMIOSMesg; OSMesgQueue gNMIMesgQueue; -s32 gNMIMesgBuf[8]; +s32 gNMIMesgBuf; //Official Name: resetPressed +s32 D_80123568[6]; // BSS Padding /******************************/ @@ -891,6 +892,7 @@ void thread3_main(UNUSED void *unused) { /** * Setup all of the necessary pieces required for the game to function. * This includes the memory pool. controllers, video, audio, core assets and more. + * Official Name: mainInitGame */ void init_game(void) { s32 viMode; @@ -923,7 +925,7 @@ void init_game(void) { audio_init(&gMainSched); func_80008040(); // Should be very similar to func_8005F850 sControllerStatus = init_controllers(); - texInitTextures(); // Should be very similar to func_8005F850 + tex_init_textures(); func_8005F850(); // Matched allocate_object_pools(); diPrintfInit(); @@ -938,7 +940,7 @@ void init_game(void) { create_and_start_thread30(); osCreateMesgQueue(&gNMIMesgQueue, &gNMIOSMesg, 1); osScAddClient(&gMainSched, (OSScClient*) gNMISched, &gNMIMesgQueue, OS_SC_ID_PRENMI); - gNMIMesgBuf[0] = 0; + gNMIMesgBuf = 0; D_80123504 = 0; D_80123508 = 0; gSPTaskNum = 0; @@ -1893,10 +1895,10 @@ s8 is_postrace_viewport_active(void) { * Official name: mainResetPressed */ s32 is_reset_pressed(void) { - if (gNMIMesgBuf[0] == 0) { - gNMIMesgBuf[0] = (s32)((osRecvMesg(&gNMIMesgQueue, NULL, OS_MESG_NOBLOCK) + 1) != 0); + if (gNMIMesgBuf == 0) { + gNMIMesgBuf = (s32)((osRecvMesg(&gNMIMesgQueue, NULL, OS_MESG_NOBLOCK) + 1) != 0); } - return gNMIMesgBuf[0]; + return gNMIMesgBuf; } s32 func_8006EB14(void) { @@ -1964,6 +1966,7 @@ void mark_to_write_flap_and_course_times(void) { /** * Forcefully marks a flag to write a save file to flash. + * Official Name: mainSaveGame */ void force_mark_write_save_file(s32 saveFileIndex) { gSaveDataFlags &= ~SAVE_DATA_FLAG_WRITE_SAVE_FILE_NUMBER_BITS; //Wipe out bits 10 and 11 @@ -1973,6 +1976,7 @@ void force_mark_write_save_file(s32 saveFileIndex) { /** * Marks a flag to write a save file to flash as long as we're not in tracks mode, and we're in the draw game render context. * This should prevent save data from being overwritten outside of Adventure Mode. + * Official Name: mainSaveGame2 */ void safe_mark_write_save_file(s32 saveFileIndex) { if (sRenderContext == DRAW_GAME && !is_in_tracks_mode()) { diff --git a/src/game_ui.c b/src/game_ui.c index 770e775f..dd374a52 100644 --- a/src/game_ui.c +++ b/src/game_ui.c @@ -243,8 +243,8 @@ s32 gHUDNumPlayers; s32 D_80126D10; s32 D_80126D14; s32 D_80126D18; -s32 D_80126D1C; -s32 D_80126D20; +s32 gMinimapDotOffsetX; +s32 gMinimapDotOffsetY; s32 D_80126D24; s32 D_80126D28; u16 D_80126D2C; @@ -263,8 +263,8 @@ s32 D_80126D50; u8 gMinimapRed; u8 gMinimapGreen; u8 gMinimapBlue; -s32 D_80126D58; -s32 D_80126D5C; +s32 gMinimapScreenX; +s32 gMinimapScreenY; LevelHeader *gHudLevelHeader; u8 D_80126D64; u8 D_80126D65; @@ -390,8 +390,8 @@ void render_hud(Gfx **dList, MatrixS **mtx, Vertex **vertexList, Object *arg3, s gDPPipeSync(gHUDCurrDisplayList++); init_rsp(&gHUDCurrDisplayList); init_rdp_and_framebuffer(&gHUDCurrDisplayList); - texDisableModes(0xFFFFFFFF); - texEnableModes(RENDER_Z_COMPARE); + tex_enable_modes(0xFFFFFFFF); + tex_disable_modes(RENDER_Z_COMPARE); func_8007BF1C(FALSE); if (check_if_showing_cutscene_camera() == FALSE && D_80126D34 == 0 && racer->racer.playerIndex == PLAYER_ONE) { if (D_80126D35 != 0) { @@ -489,7 +489,7 @@ block_95: *dList = gHUDCurrDisplayList; *mtx = gHUDCurrMatrix; *vertexList = gHUDCurrVertex; - texDisableModes(0xFFFFFFFF); + tex_enable_modes(0xFFFFFFFF); } } } @@ -1519,9 +1519,9 @@ void minimap_init(LevelModel *model) { gMinimapRed = (model->minimapColor >> 16) & 0xFF; gMinimapGreen = (model->minimapColor >> 8) & 0xFF; gMinimapBlue = model->minimapColor & 0xFF; - load_sprite_info(model->minimapSprite, &D_80126D1C, &D_80126D20, &sp2C, &sp2C, &sp2C); - func_8007CA68(model->minimapSprite, 0, &D_80126D14, &D_80126D18, &sp2C); - model->minimapSprite = (s32) func_8007C12C(model->minimapSprite, 1); + load_sprite_info(model->minimapSpriteIndex, &gMinimapDotOffsetX, &gMinimapDotOffsetY, &sp2C, &sp2C, &sp2C); + func_8007CA68(model->minimapSpriteIndex, 0, &D_80126D14, &D_80126D18, &sp2C); + model->minimapSpriteIndex = (s32) func_8007C12C(model->minimapSpriteIndex, 1); } /** @@ -1824,38 +1824,38 @@ void render_minimap_and_misc_hud(Gfx **dList, MatrixS **mtx, Vertex **vtx, s32 u } someObjSeg = get_active_camera_segment(); func_80068508(TRUE); - minimap = (Sprite *) lvlMdl->minimapSprite; + minimap = (Sprite *) lvlMdl->minimapSpriteIndex; switch (gHUDNumPlayers) { case TWO_PLAYERS: - D_80126D58 = 135; - D_80126D5C = -D_80126D20 / 2; + gMinimapScreenX = 135; + gMinimapScreenY = -gMinimapDotOffsetY / 2; break; case THREE_PLAYERS: if (get_current_level_race_type() == RACETYPE_CHALLENGE_EGGS || get_current_level_race_type() == RACETYPE_CHALLENGE_BATTLE || get_current_level_race_type() == RACETYPE_CHALLENGE_BANANAS) { - D_80126D58 = (D_80126D1C / 2) - 8; - D_80126D5C = -D_80126D20 / 2; + gMinimapScreenX = (gMinimapDotOffsetX / 2) - 8; + gMinimapScreenY = -gMinimapDotOffsetY / 2; } else { - D_80126D58 = ( D_80126D1C / 2) + 72; - D_80126D5C = -60 - (D_80126D20 / 2); + gMinimapScreenX = ( gMinimapDotOffsetX / 2) + 72; + gMinimapScreenY = -60 - (gMinimapDotOffsetY / 2); } break; case FOUR_PLAYERS: - D_80126D58 = (D_80126D1C / 2) - 8; - D_80126D5C = -D_80126D20 / 2; + gMinimapScreenX = (gMinimapDotOffsetX / 2) - 8; + gMinimapScreenY = -gMinimapDotOffsetY / 2; break; default: - D_80126D58 = 135; - D_80126D5C = -98; + gMinimapScreenX = 135; + gMinimapScreenY = -98; break; } if (osTvType == TV_TYPE_PAL) { - D_80126D5C *= 1.2; + gMinimapScreenY *= 1.2; } func_8007BF1C(FALSE); - objTrans.trans.x_position = D_80126D58 + D_80126D24 + D_80126D28; - objTrans.trans.y_position = D_80126D5C; + objTrans.trans.x_position = gMinimapScreenX + D_80126D24 + D_80126D28; + objTrans.trans.y_position = gMinimapScreenY; if (osTvType == TV_TYPE_PAL) { objTrans.trans.x_position -= 4.0f; } @@ -1863,7 +1863,7 @@ void render_minimap_and_misc_hud(Gfx **dList, MatrixS **mtx, Vertex **vtx, s32 u objTrans.trans.x_rotation = 0; if (get_filtered_cheats() & CHEAT_MIRRORED_TRACKS) { objTrans.trans.y_rotation = -0x8000; - objTrans.trans.x_position -= D_80126D1C; + objTrans.trans.x_position -= gMinimapDotOffsetX; } else { objTrans.trans.y_rotation = 0; } @@ -1881,8 +1881,8 @@ void render_minimap_and_misc_hud(Gfx **dList, MatrixS **mtx, Vertex **vtx, s32 u } render_ortho_triangle_image(&gHUDCurrDisplayList, &gHUDCurrMatrix, &gHUDCurrVertex, (ObjectSegment* ) &objTrans.trans, minimap, 0); sp11C = (lvlMdl->upperXBounds - lvlMdl->lowerXBounds) / (f32) (lvlMdl->upperZBounds - lvlMdl->lowerZBounds); - sp118 = coss_f((lvlMdl->unk24 * 0xFFFF) / 360); - sp114 = sins_f((lvlMdl->unk24 * 0xFFFF) / 360); + sp118 = coss_f((lvlMdl->minimapRotation * 0xFFFF) / 360); + sp114 = sins_f((lvlMdl->minimapRotation * 0xFFFF) / 360); if (func_8000E4D8() && func_8001B288()) { temp_v0_8 = func_8001B2E0(); if (temp_v0_8 != NULL) { @@ -1927,7 +1927,7 @@ void render_minimap_and_misc_hud(Gfx **dList, MatrixS **mtx, Vertex **vtx, s32 u if (someRacer->playerIndex != PLAYER_COMPUTER) { D_80126CDC->unk1F0 -= 1.0f; D_80126CDC->unk1E6 = 27; - D_80126CDC->unk1E4 = (objectGroup[i]->segment.trans.y_rotation - ((lvlMdl->unk24 * 0xFFFF) / 360)) & 0xFFFF; + D_80126CDC->unk1E4 = (objectGroup[i]->segment.trans.y_rotation - ((lvlMdl->minimapRotation * 0xFFFF) / 360)) & 0xFFFF; if (get_filtered_cheats() & CHEAT_MIRRORED_TRACKS) { D_80126CDC->unk1E4 = 0xFFFF - D_80126CDC->unk1E4; @@ -1977,8 +1977,32 @@ void render_minimap_and_misc_hud(Gfx **dList, MatrixS **mtx, Vertex **vtx, s32 u } } +void func_800AA3EC(f32 x, f32 z, f32 angleSin, f32 angleCos, f32 modelAspectRatio) { + LevelModel* lvlMdl; + UNUSED s32 pad24[2]; + f32 scaledX; + f32 scaledY; + s32 a; + s32 b; + + lvlMdl = get_current_level_model(); + + a = lvlMdl->upperXBounds - lvlMdl->lowerXBounds; + b = lvlMdl->upperZBounds - lvlMdl->lowerZBounds; + scaledX = (60.0f * modelAspectRatio * lvlMdl->minimapXScale * (x - lvlMdl->lowerXBounds)) / (a); + scaledY = (lvlMdl->minimapYScale * -60.0f * (z - lvlMdl->lowerZBounds)) / (b); + + if (get_filtered_cheats() & CHEAT_MIRRORED_TRACKS) { // Is adventure 2? + D_80126CDC->unk1EC = (((f32) gMinimapScreenX - ((scaledX * angleCos) + (scaledY * angleSin))) + (f32) lvlMdl->minimapOffsetXAdv2) - (f32) gMinimapDotOffsetX; + D_80126CDC->unk1F0 = ((f32) (lvlMdl->minimapOffsetYAdv2 + gMinimapScreenY) - ((scaledX * angleSin) - (scaledY * angleCos))) + (f32) gMinimapDotOffsetY; + return; + } + // Final x position on minimap + D_80126CDC->unk1EC = ((f32) gMinimapScreenX + ((scaledX * angleCos) + (scaledY * angleSin)) + (f32) lvlMdl->minimapOffsetXAdv1) - (f32) gMinimapDotOffsetX; + // Final y position on minimap + D_80126CDC->unk1F0 = ((f32) (lvlMdl->minimapOffsetYAdv1 + gMinimapScreenY) - ((scaledX * angleSin) - (scaledY * angleCos))) + (f32) gMinimapDotOffsetY; +} -GLOBAL_ASM("asm/non_matchings/game_ui/func_800AA3EC.s") GLOBAL_ASM("asm/non_matchings/game_ui/func_800AA600.s") void func_800AAFD0(ObjectModel *objModel) { diff --git a/src/gzip.c b/src/gzip.c index c4b60699..c390a7ac 100644 --- a/src/gzip.c +++ b/src/gzip.c @@ -7,7 +7,7 @@ /************ .data ************/ -huft *D_800E3760 = NULL; +huft *D_800E3760 = NULL; //gzip_huft_alloc s32 *gAssetAddress = NULL; u8 *gzip_inflate_input = NULL; u8 *gzip_inflate_output = NULL; @@ -18,7 +18,7 @@ u8 *gzip_inflate_output = NULL; u32 gzip_bit_buffer; u32 gzip_num_bits; -s32 D_8012AAD8; +s32 D_8012AAD8; //gzip_hufts /******************************/ diff --git a/src/main.c b/src/main.c index 8d48ddd4..66558c09 100644 --- a/src/main.c +++ b/src/main.c @@ -33,7 +33,6 @@ void main(void) { * Initialise the crash handler thread, then initialise the main game thread. * Reset the start and endpoint of the game thread stack, then set thread priority to zero, effectively * stopping this thread, as it's no longer needed. - * Official name: main */ void thread1_main(UNUSED void *unused) { thread0_create(); @@ -41,7 +40,7 @@ void thread1_main(UNUSED void *unused) { gThread3Stack[0x400] = 0; gThread3Stack[0] = 0; osStartThread(&gThread3); - osSetThreadPri(NULL, 0); + osSetThreadPri(NULL, OS_PRIORITY_IDLE); while (1) {} } diff --git a/src/math_util.c b/src/math_util.c index 3df85705..9344c7a2 100644 --- a/src/math_util.c +++ b/src/math_util.c @@ -22,8 +22,11 @@ extern s16 gArcTanTable[]; /******************************/ +/* Official Name: disableInterrupts*/ GLOBAL_ASM("asm/math_util/clear_status_register_flags.s") +/* Official Name: enableInterrupts */ GLOBAL_ASM("asm/math_util/set_status_register_flags.s") +/* Official Name: setIntDisFlag */ GLOBAL_ASM("asm/math_util/set_D_800DD430.s") GLOBAL_ASM("asm/math_util/get_D_800DD430.s") @@ -124,6 +127,7 @@ void f32_matrix_to_s16_matrix(Matrix *input, MatrixS *output) { GLOBAL_ASM("asm/math_util/f32_matrix_to_s16_matrix.s") #endif +/* Official Name: mathSeed */ void set_rng_seed(s32 num) { gCurrentRNGSeed = num; } @@ -142,10 +146,11 @@ s32 get_rng_seed(void) { return gCurrentRNGSeed; } +/* Official Name: mathRnd */ GLOBAL_ASM("asm/math_util/rng.s") #ifdef NON_EQUIVALENT -/* Official name: fastShortReflection(?) */ +/* Official name: fastShortReflection */ void s16_matrix_rotate(s16 *arg0[4][4], s16 arg1[4][4]) { s32 temp_t6; @@ -193,6 +198,7 @@ GLOBAL_ASM("asm/math_util/s16_vec3_mult_by_s32_matrix.s") #endif #ifdef NON_EQUIVALENT +/* Official Name: mathRpyXyzMtx */ void object_transform_to_matrix(Matrix arg0, ObjectTransform *trans) { f32 yRotSine; f32 yRotCosine; diff --git a/src/memory.c b/src/memory.c index 59ad5aaf..d12cacb3 100644 --- a/src/memory.c +++ b/src/memory.c @@ -38,7 +38,7 @@ s32 gNumberOfMemoryPools; UNUSED s32 D_801235C4; FreeQueueSlot gFreeQueue[256]; s32 gFreeQueueCount; -s32 gFreeQueueState; +s32 gFreeQueueState; //Official Name: mmDelay extern MemoryPoolSlot gMainMemoryPool; @@ -47,13 +47,17 @@ extern MemoryPoolSlot gMainMemoryPool; /** * Creates the main memory pool. * Starts at 0x8012D3F0. Ends at 0x80400000. Contains 1600 allocation slots. + * Official Name: mmInit */ void init_main_memory_pool(void) { + s32 ramEnd; gNumberOfMemoryPools = -1; - if (1) { - // Create the main memory pool. - new_memory_pool(&gMainMemoryPool, RAM_END - (s32)(&gMainMemoryPool), MAIN_POOL_SLOT_COUNT); + if (FALSE) { + ramEnd = EXTENDED_RAM_END; //Value from JFG, not required to match + } else { + ramEnd = RAM_END; } + new_memory_pool(&gMainMemoryPool, ramEnd - (s32)(&gMainMemoryPool), MAIN_POOL_SLOT_COUNT); set_free_queue_state(2); gFreeQueueCount = 0; } @@ -83,34 +87,33 @@ MemoryPoolSlot *new_sub_memory_pool(s32 poolDataSize, s32 numSlots) { MemoryPoolSlot *new_memory_pool(MemoryPoolSlot *slots, s32 poolSize, s32 numSlots) { MemoryPoolSlot *firstSlot; s32 poolCount; - MemoryPool *pool; s32 i; + s32 firstSlotSize; - poolCount = ++gNumberOfMemoryPools; \ + poolCount = ++gNumberOfMemoryPools; + firstSlotSize = poolSize - (numSlots * sizeof(MemoryPoolSlot)); gMemoryPools[poolCount].maxNumSlots = numSlots; gMemoryPools[poolCount].curNumSlots = 0; gMemoryPools[poolCount].slots = slots; gMemoryPools[poolCount].size = poolSize; - pool = &gMemoryPools[poolCount++]; firstSlot = slots; - if(0){} if (!pool->maxNumSlots){} // Fakematch - for (i = 0; i < pool->maxNumSlots; i++) { + for (i = 0; i < gMemoryPools[poolCount].maxNumSlots; i++) { firstSlot->index = i; firstSlot++; } - firstSlot = &pool->slots[0]; + firstSlot = &gMemoryPools[poolCount].slots[0]; slots += numSlots; if ((s32) slots & 0xF) { firstSlot->data = (u8 *) _ALIGN16(slots); } else { firstSlot->data = (u8 *) slots; } - firstSlot->size = poolSize - (numSlots * sizeof(MemoryPoolSlot)); + firstSlot->size = firstSlotSize; firstSlot->flags = 0; firstSlot->prevIndex = -1; firstSlot->nextIndex = -1; - pool->curNumSlots++; - return pool->slots; + gMemoryPools[poolCount].curNumSlots++; + return gMemoryPools[poolCount].slots; } /** @@ -155,7 +158,8 @@ MemoryPoolSlot *allocate_from_memory_pool(s32 poolIndex, s32 size, u32 colourTag } currIndex = -1; if (size & 0xF) { - size = (size & ~0xF) + 0x10; + size = (size & ~0xF); + size += 0x10; } slots = pool->slots; slotSize = 0x7FFFFFFF; @@ -190,6 +194,7 @@ void *allocate_from_pool_containing_slots(MemoryPoolSlot *slots, s32 size) { return (void *)NULL; } +/* Official Name: mmAllocAtAddr */ void *allocate_at_address_in_main_pool(s32 size, u8 *address, u32 colorTag) { s32 i; MemoryPoolSlot *curSlot; @@ -201,28 +206,28 @@ void *allocate_at_address_in_main_pool(s32 size, u8 *address, u32 colorTag) { if ((gMemoryPools[0].curNumSlots + 1) == gMemoryPools[0].maxNumSlots) { set_status_register_flags(flags); } else { - if (size & 0xF) { - size = _ALIGN16(size); - } - slots = gMemoryPools[0].slots; - for (i = 0; i != -1; i = curSlot->nextIndex) { - curSlot = &slots[i]; - if (curSlot->flags == 0) { - if ((u32) address >= (u32) curSlot->data && (u32)address + size <= (u32) curSlot->data + curSlot->size) { - if (address == (u8 *) curSlot->data) { - allocate_memory_pool_slot(0, i, size, 1, 0, colorTag); - set_status_register_flags(flags); - return curSlot->data; - } else { - i = allocate_memory_pool_slot(0, i, (u32) address - (u32) curSlot->data, 0, 1, colorTag); - allocate_memory_pool_slot(0, i, size, 1, 0, colorTag); - set_status_register_flags(flags); - return (slots + i)->data; + if (size & 0xF) { + size = _ALIGN16(size); + } + slots = gMemoryPools[0].slots; + for (i = 0; i != -1; i = curSlot->nextIndex) { + curSlot = &slots[i]; + if (curSlot->flags == 0) { + if ((u32) address >= (u32) curSlot->data && (u32)address + size <= (u32) curSlot->data + curSlot->size) { + if (address == (u8 *) curSlot->data) { + allocate_memory_pool_slot(0, i, size, 1, 0, colorTag); + set_status_register_flags(flags); + return curSlot->data; + } else { + i = allocate_memory_pool_slot(0, i, (u32) address - (u32) curSlot->data, 0, 1, colorTag); + allocate_memory_pool_slot(0, i, size, 1, 0, colorTag); + set_status_register_flags(flags); + return (slots + i)->data; + } } } } - } - set_status_register_flags(flags); + set_status_register_flags(flags); } return 0; } @@ -245,7 +250,8 @@ void set_free_queue_state(s32 state) { /** * Unallocates data from the pool that contains the data. Will free immediately if the free queue - * state is set to 0, otherwise the data will just be marked for deletion. + * state is set to 0, otherwise the data will just be marked for deletion. + * Official Name: mmFree */ void free_from_memory_pool(void *data) { s32 *flags = clear_status_register_flags(); @@ -258,7 +264,8 @@ void free_from_memory_pool(void *data) { } /** - * Frees all the addresses in the free queue. + * Frees all the addresses in the free queue. + * Official Name: mmFreeTick */ void clear_free_queue(void) { s32 i; @@ -297,7 +304,7 @@ void free_slot_containing_address(u8 *address) { if (address == (u8 *) slot->data) { if (slot->flags == 1 || slot->flags == 4) { - free_memory_pool_slot(poolIndex, slotIndex); + free_memory_pool_slot(poolIndex, slotIndex); } break; } @@ -394,7 +401,6 @@ s32 func_80071538(u8 *address) { /** * Returns the index of the memory pool containing the memory address. - * Official(?) name: getHeapIdxOf */ s32 get_memory_pool_index_containing_address(u8 *address) { s32 i; diff --git a/src/memory.h b/src/memory.h index 562b312d..e410caa8 100644 --- a/src/memory.h +++ b/src/memory.h @@ -6,6 +6,7 @@ #include "macros.h" #define RAM_END 0x80400000 +#define EXTENDED_RAM_END 0x80800000 #define MAIN_POOL_SLOT_COUNT 1600 // Animation related? diff --git a/src/objects.c b/src/objects.c index b1e154eb..cd2b3586 100644 --- a/src/objects.c +++ b/src/objects.c @@ -16,7 +16,6 @@ #include "game.h" #include "racer.h" #include "particles.h" -#include "printf.h" #include "unknown_0255E0.h" #include "math_util.h" #include "camera.h" @@ -1136,7 +1135,7 @@ void func_80011134(Object *arg0, s32 arg1) { if (temp_v0 != 0xFF) { var_t5 = temp_s3->textures[temp_v0].texture; sp5C = var_s0->unk7 << 6; - func_8007EF80(var_t5, temp_s4[var_s1].flags, &sp5C, arg1); + tex_animate_texture(var_t5, temp_s4[var_s1].flags, &sp5C, arg1); var_s0->unk7 = sp5C >> 6; } } diff --git a/src/particles.c b/src/particles.c index fab73c0c..789dd298 100644 --- a/src/particles.c +++ b/src/particles.c @@ -161,33 +161,8 @@ s32 D_800E2EEC = 0x100; s32 D_80127C80; s32 D_80127C84; s32 D_80127C88[6]; -TextureHeader *gTexture0; -TextureHeader *gTexture1; -TextureHeader *gTexture2; -u16 D_80127CAC; -u16 D_80127CAE; -s16 D_80127CB0; -s16 D_80127CB2; -s32 D_80127CB4; -s32 D_80127CB8; -s32 D_80127CBC; -s32 D_80127CC0; -s32 D_80127CC4; -s32 D_80127CC8; -s32 gDebugFontTexture; -u16 D_80127CD0; -u16 D_80127CD2; -s32 D_80127CD4; -s8 gDebugPrintBufferStart[2300]; -UNUSED s32 D_801285D4; -u8 *gDebugPrintBufferEnd; -u64 gEPCStack[0x200]; -OSThread gEPCThread; -s32 D_80129790[6]; // Osmesg stuff -s32 D_801297A8[8]; -s32 D_801297C8[8]; -s32 D_801297E8[6]; - +//printf.c +//thread0_epc /******************************/ void func_800AE270(void) { @@ -1432,3 +1407,76 @@ void func_800B2FBC(Particle2 *arg0) { } } +GLOBAL_ASM("asm/non_matchings/particles/func_800B3140.s") +GLOBAL_ASM("asm/non_matchings/particles/func_800B3240.s") +GLOBAL_ASM("asm/non_matchings/particles/func_800B3358.s") +GLOBAL_ASM("asm/non_matchings/particles/func_800B34B0.s") +GLOBAL_ASM("asm/non_matchings/particles/func_800B3564.s") + +UNUSED void func_800B3678(Gfx **arg0, MatrixS **arg1, Vertex **arg2) { + UNUSED s32 pad; + UNUSED s32 pad2; + Object **objects; + s32 iObj; + s32 nObjs; + + objects = objGetObjList(&iObj, &nObjs); + for (; iObj < nObjs; iObj++) { + if (objects[iObj]->segment.trans.unk6 & 0x8000) { + if ((s32) objects[iObj]->segment.header & 0x8000) { + func_800B3740(objects[iObj], arg0, arg1, arg2, 0); + } + } + } +} + +GLOBAL_ASM("asm/non_matchings/particles/func_800B3740.s") +GLOBAL_ASM("asm/non_matchings/particles/func_800B3E64.s") + +UNUSED unk800E2CF0 *func_800B4488(s32 idx) { + if (idx < gParticlesAssetTableCount) { + return gParticlesAssetTable[idx]; + } + return gParticlesAssetTable[gParticlesAssetTableCount - 1]; +} + +UNUSED unk800E2CF0 *func_800B44D4(s32 *idx) { + *idx = *idx + 1; + while (*idx >= gParticlesAssetTableCount) { + *idx = *idx - gParticlesAssetTableCount; + } + return gParticlesAssetTable[*idx]; +} + +UNUSED unk800E2CF0 *func_800B452C(s32 *arg0) { + for (*arg0 = *arg0 - 1; *arg0 < 0; *arg0 += gParticlesAssetTableCount); + return gParticlesAssetTable[*arg0]; +} + +UNUSED ParticleBehavior *func_800B4578(s32 idx) { + if (idx < gParticleBehavioursAssetTableCount) { + return gParticleBehavioursAssetTable[idx]; + } + return gParticleBehavioursAssetTable[gParticleBehavioursAssetTableCount - 1]; +} + +GLOBAL_ASM("asm/non_matchings/particles/func_800B45C4.s") +GLOBAL_ASM("asm/non_matchings/particles/func_800B461C.s") +GLOBAL_ASM("asm/non_matchings/particles/func_800B4668.s") +GLOBAL_ASM("asm/non_matchings/particles/func_800B46BC.s") + +/** + * memset(void *s, int c, size_t n) + * + * s: start of area to clear + * c: char to fill with + * n: size of area to clear + */ +void *memset(void *s, int c, size_t n) { + u8 *var_v0 = s; + + while (n-- > 0) { + *var_v0++ = c; + } + return s; +} diff --git a/src/particles.h b/src/particles.h index 2d179921..f985b930 100644 --- a/src/particles.h +++ b/src/particles.h @@ -293,26 +293,6 @@ typedef struct Particle2 { /* 0x0077 */ u8 unk77; } Particle2; -extern unk800E2CF0 **gParticlesAssetTable; -extern s32 gParticlesAssetTableCount; -extern s32 D_80127CB8; -extern s32 gDebugFontTexture; -extern u16 D_80127CAE; -extern u16 D_80127CAC; -extern u16 D_80127CD0; -extern s32 D_80127CBC; -extern s32 D_80127CC0; -extern u16 D_80127CD2; -extern s32 D_80127CC4; -extern s32 D_80127CC8; -extern s32 D_80127CB4; -extern s16 D_80127CB0; -extern s16 D_80127CB2; -extern OSThread gEPCThread; - -extern ParticleBehavior **gParticleBehavioursAssetTable; -extern s32 gParticleBehavioursAssetTableCount; - void func_800AE270(void); void func_800AE2A0(void); void func_800AE2D8(void); @@ -354,5 +334,8 @@ void func_800B3240(Particle2 *); void func_800B3358(Particle2 *); void func_800B34B0(Particle2 *); void func_800B3564(Particle2 *); +void func_800B3740(Object *, Gfx **, MatrixS **, Vertex **, s32); // Non Matching +void func_800B4668(Object*, s32, s32, s32); +void func_800B46BC(Object*, s32, s32, s32); #endif diff --git a/src/printf.c b/src/printf.c index 63def063..128c3686 100644 --- a/src/printf.c +++ b/src/printf.c @@ -1,5 +1,5 @@ /* The comment below is needed for this file to be picked up by generate_ld */ -/* RAM_POS: 0x800B3140 */ +/* RAM_POS: 0x800B4940 */ #include "printf.h" #include "types.h" @@ -8,29 +8,123 @@ #include "thread0_epc.h" #include "stdarg.h" #include "textures_sprites.h" -#include "stdio.h" -#include "objects.h" -#include "particles.h" #include "unknown_078050.h" /************ .data ************/ s32 D_800E2EF0 = 0; -u8 D_800E2EF4[196] = { - 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0F, 0x11, 0x15, 0x17, 0x1F, 0x21, 0x27, 0x29, 0x2B, 0x2D, 0x2F, - 0x31, 0x33, 0x35, 0x38, 0x3A, 0x3F, 0x41, 0x43, 0x45, 0x48, 0x4A, 0x4B, 0x4D, 0x50, 0x52, 0x56, - 0x58, 0x5B, 0x5D, 0x62, 0x64, 0x68, 0x6A, 0x6F, 0x71, 0x76, 0x78, 0x7D, 0x7F, 0x84, 0x86, 0x8B, - 0x8D, 0x92, 0x94, 0x96, 0x98, 0x9A, 0x9D, 0xA2, 0xA5, 0xA9, 0xAB, 0xB0, 0xB3, 0xB8, 0x00, 0x01, - 0x00, 0x09, 0x0B, 0x11, 0x13, 0x19, 0x1B, 0x21, 0x23, 0x29, 0x2B, 0x31, 0x33, 0x38, 0x3A, 0x41, - 0x43, 0x49, 0x4B, 0x4C, 0x4E, 0x53, 0x55, 0x5B, 0x5D, 0x62, 0x64, 0x6B, 0x6D, 0x73, 0x75, 0x7B, - 0x7D, 0x83, 0x85, 0x8B, 0x8D, 0x93, 0x95, 0x9B, 0x9D, 0xA3, 0xA5, 0xAA, 0xAC, 0xB2, 0xB4, 0xBC, - 0xBE, 0xC4, 0xC6, 0xCC, 0xCE, 0xD3, 0xD5, 0xD7, 0xD9, 0xDC, 0xDE, 0xE0, 0xE2, 0xE7, 0xE9, 0xEF, - 0x00, 0x01, 0x03, 0x08, 0x09, 0x0F, 0x11, 0x16, 0x18, 0x1D, 0x1F, 0x24, 0x26, 0x28, 0x2A, 0x2F, - 0x31, 0x36, 0x38, 0x39, 0x3B, 0x3D, 0x3F, 0x43, 0x45, 0x46, 0x48, 0x4F, 0x51, 0x56, 0x58, 0x5D, - 0x5F, 0x64, 0x66, 0x6B, 0x6C, 0x70, 0x72, 0x77, 0x79, 0x7C, 0x7E, 0x82, 0x84, 0x89, 0x8B, 0x92, - 0x94, 0x99, 0x9B, 0xA0, 0xA2, 0xA6, 0xA8, 0xAB, 0xAD, 0xAE, 0xB0, 0xB3, 0xB5, 0xB9, 0xB5, 0xB9, - 0x00, 0x00, 0x00, 0x00 +//Char width is (v - u) + 1 +TexFontCoords gDebugFontCoords[3][32] = { + //ASCII symbols and numbers + //(This is out of order since they subtract 0x21 instead of 0x20) + //!"#$%&'()*+,-./0123456789:;<=>?{SPACE} + { + { 0x02, 0x04, }, //! + { 0x06, 0x08, }, //" + { 0x0A, 0x0F, }, //# + { 0x11, 0x15, }, //$ + { 0x17, 0x1F, }, //% + { 0x21, 0x27, }, //& + { 0x29, 0x2B, }, //' + { 0x2D, 0x2F, }, //( + { 0x31, 0x33, }, //) + { 0x35, 0x38, }, //* + { 0x3A, 0x3F, }, //+ + { 0x41, 0x43, }, //, + { 0x45, 0x48, }, //- + { 0x4A, 0x4B, }, //. + { 0x4D, 0x50, }, /// + { 0x52, 0x56, }, //0 + { 0x58, 0x5B, }, //1 + { 0x5D, 0x62, }, //2 + { 0x64, 0x68, }, //3 + { 0x6A, 0x6F, }, //4 + { 0x71, 0x76, }, //5 + { 0x78, 0x7D, }, //6 + { 0x7F, 0x84, }, //7 + { 0x86, 0x8B, }, //8 + { 0x8D, 0x92, }, //9 + { 0x94, 0x96, }, //: + { 0x98, 0x9A, }, //; + { 0x9D, 0xA2, }, //< + { 0xA5, 0xA9, }, //= + { 0xAB, 0xB0, }, //> + { 0xB3, 0xB8, }, //? + { 0x00, 0x01, }, //{SPACE} + }, + //ASCII Upper Case + //@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ + { + { 0x00, 0x09, }, //@ + { 0x0B, 0x11, }, //A + { 0x13, 0x19, }, //B + { 0x1B, 0x21, }, //C + { 0x23, 0x29, }, //D + { 0x2B, 0x31, }, //E + { 0x33, 0x38, }, //F + { 0x3A, 0x41, }, //G + { 0x43, 0x49, }, //H + { 0x4B, 0x4C, }, //I + { 0x4E, 0x53, }, //J + { 0x55, 0x5B, }, //K + { 0x5D, 0x62, }, //L + { 0x64, 0x6B, }, //M + { 0x6D, 0x73, }, //N + { 0x75, 0x7B, }, //O + { 0x7D, 0x83, }, //P + { 0x85, 0x8B, }, //Q + { 0x8D, 0x93, }, //R + { 0x95, 0x9B, }, //S + { 0x9D, 0xA3, }, //T + { 0xA5, 0xAA, }, //U + { 0xAC, 0xB2, }, //V + { 0xB4, 0xBC, }, //W + { 0xBE, 0xC4, }, //X + { 0xC6, 0xCC, }, //Y + { 0xCE, 0xD3, }, //Z + { 0xD5, 0xD7, }, //[ + { 0xD9, 0xDC, }, //{backslash} + { 0xDE, 0xE0, }, //] + { 0xE2, 0xE7, }, //^ + { 0xE9, 0xEF, }, //_ + }, + //ASCII Lower Case + //`abcdefghijklmnopqrstuvwxyz{|}~ + { + { 0x00, 0x01, }, //` + { 0x03, 0x08, }, //a + { 0x09, 0x0F, }, //b + { 0x11, 0x16, }, //c + { 0x18, 0x1D, }, //d + { 0x1F, 0x24, }, //e + { 0x26, 0x28, }, //f + { 0x2A, 0x2F, }, //g + { 0x31, 0x36, }, //h + { 0x38, 0x39, }, //i + { 0x3B, 0x3D, }, //j + { 0x3F, 0x43, }, //k + { 0x45, 0x46, }, //l + { 0x48, 0x4F, }, //m + { 0x51, 0x56, }, //n + { 0x58, 0x5D, }, //o + { 0x5F, 0x64, }, //p + { 0x66, 0x6B, }, //q + { 0x6C, 0x70, }, //r + { 0x72, 0x77, }, //s + { 0x79, 0x7C, }, //t + { 0x7E, 0x82, }, //u + { 0x84, 0x89, }, //v + { 0x8B, 0x92, }, //w + { 0x94, 0x99, }, //x + { 0x9B, 0xA0, }, //y + { 0xA2, 0xA6, }, //z + { 0xA8, 0xAB, }, //{ + { 0xAD, 0xAE, }, //| + { 0xB0, 0xB3, }, //} + { 0xB5, 0xB9, }, //~ + { 0xB5, 0xB9, }, //ASCII DEL, so it just reuses the tilde above. + }, }; Gfx dDebugFontSettings[] = { @@ -64,87 +158,45 @@ const char D_800E8C64[] = "*** diPrintf Error *** ---> Out of string space. (Pri /************ .bss ************/ -extern TextureHeader *gTexture0; -extern TextureHeader *gTexture1; -extern TextureHeader *gTexture2; -extern u8 gDebugPrintBufferStart[]; -extern u8 *gDebugPrintBufferEnd; +TextureHeader *gTexture0; +TextureHeader *gTexture1; +TextureHeader *gTexture2; +u16 D_80127CAC; +u16 D_80127CAE; +u16 D_80127CB0; +u16 D_80127CB2; +s32 D_80127CB4; +s32 D_80127CB8; +s32 D_80127CBC; +s32 D_80127CC0; +s32 D_80127CC4; +s32 D_80127CC8; +s32 gDebugFontTexture; +u16 D_80127CD0; +u16 D_80127CD2; +s32 D_80127CD4; +char gDebugPrintBufferStart[0x900]; +char *gDebugPrintBufferEnd; /******************************/ -GLOBAL_ASM("asm/non_matchings/printf/func_800B3140.s") -GLOBAL_ASM("asm/non_matchings/printf/func_800B3240.s") -GLOBAL_ASM("asm/non_matchings/printf/func_800B3358.s") -GLOBAL_ASM("asm/non_matchings/printf/func_800B34B0.s") -GLOBAL_ASM("asm/non_matchings/printf/func_800B3564.s") - -UNUSED void func_800B3678(Gfx **arg0, MatrixS **arg1, Vertex **arg2) { - UNUSED s32 pad; - UNUSED s32 pad2; - Object **objects; - s32 iObj; - s32 nObjs; - - objects = objGetObjList(&iObj, &nObjs); - for (; iObj < nObjs; iObj++) { - if (objects[iObj]->segment.trans.unk6 & 0x8000) { - if ((s32) objects[iObj]->segment.header & 0x8000) { - func_800B3740(objects[iObj], arg0, arg1, arg2, 0); - } - } - } -} - -GLOBAL_ASM("asm/non_matchings/printf/func_800B3740.s") -GLOBAL_ASM("asm/non_matchings/printf/func_800B3E64.s") - -UNUSED unk800E2CF0 *func_800B4488(s32 idx) { - if (idx < gParticlesAssetTableCount) { - return gParticlesAssetTable[idx]; - } - return gParticlesAssetTable[gParticlesAssetTableCount - 1]; -} - -UNUSED unk800E2CF0 *func_800B44D4(s32 *idx) { - *idx = *idx + 1; - while (*idx >= gParticlesAssetTableCount) { - *idx = *idx - gParticlesAssetTableCount; - } - return gParticlesAssetTable[*idx]; -} - -UNUSED unk800E2CF0 *func_800B452C(s32 *arg0) { - for (*arg0 = *arg0 - 1; *arg0 < 0; *arg0 += gParticlesAssetTableCount); - return gParticlesAssetTable[*arg0]; -} - -UNUSED ParticleBehavior *func_800B4578(s32 idx) { - if (idx < gParticleBehavioursAssetTableCount) { - return gParticleBehavioursAssetTable[idx]; - } - return gParticleBehavioursAssetTable[gParticleBehavioursAssetTableCount - 1]; -} - -GLOBAL_ASM("asm/non_matchings/printf/func_800B45C4.s") -GLOBAL_ASM("asm/non_matchings/printf/func_800B461C.s") -GLOBAL_ASM("asm/non_matchings/printf/func_800B4668.s") -GLOBAL_ASM("asm/non_matchings/printf/func_800B46BC.s") GLOBAL_ASM("asm/non_matchings/printf/_itoa.s") +//Official Name: sprintfSetSpacingCodes void func_800B4A08(s32 arg0) { D_800E2EF0 = arg0; } -/* Official name: sprintf(?) */ -UNUSED void func_800B4A14(char *s, char *format, ...) { +/* Official name: sprintf */ +UNUSED void sprintf(char *s, char *format, ...) { va_list args; va_start(args, format); - //!@bug Should be calling vsprintf here. - sprintf(s, format, args); + vsprintf(s, format, args); va_end(args); } -GLOBAL_ASM("asm/non_matchings/printf/sprintf.s") +//Official Name: vsprintf +GLOBAL_ASM("asm/non_matchings/printf/vsprintf.s") void diPrintfInit(void) { gTexture0 = load_texture(0); @@ -153,29 +205,27 @@ void diPrintfInit(void) { gDebugPrintBufferEnd = gDebugPrintBufferStart; } -#ifdef NON_EQUIVALENT +//Official Name: diPrintf s32 render_printf(const char *format, ...) { - s32 written; va_list args; + s32 written; va_start(args, format); - if ((gDebugPrintBufferEnd - gDebugPrintBufferStart) >= 0x801) { + if ((gDebugPrintBufferEnd - gDebugPrintBufferStart) > 0x800) { return -1; } func_800B4A08(1); - written = sprintf(gDebugPrintBufferEnd, format, args); + written = vsprintf(gDebugPrintBufferEnd, format, args); func_800B4A08(0); if (written > 0) { gDebugPrintBufferEnd = &gDebugPrintBufferEnd[written] + 1; } return 0; } -#else -GLOBAL_ASM("asm/non_matchings/printf/render_printf.s") -#endif /** * At the end of a frame, iterate through the debug text buffer and print it on screen. * Soft-clear the buffer afterwards by setting the endpoint to the start point. + * Official Name: diPrintfAll */ void print_debug_strings(Gfx **dList) { char *buffer; @@ -183,8 +233,8 @@ void print_debug_strings(Gfx **dList) { init_rdp_and_framebuffer(dList); widthAndHeight = get_video_width_and_height_as_s32(); - D_80127CD2 = (widthAndHeight >> 0x10); - D_80127CD0 = widthAndHeight & 0xFFFF; + D_80127CD2 = GET_VIDEO_HEIGHT(widthAndHeight); + D_80127CD0 = GET_VIDEO_WIDTH(widthAndHeight); gDPSetScissor((*dList)++, 0, 0, 0, D_80127CD0, D_80127CD2); func_800B6E50(); gSPDisplayList((*dList)++, dDebugFontSettings); @@ -195,8 +245,8 @@ void print_debug_strings(Gfx **dList) { D_80127CB0 = D_80127CAC; D_80127CB2 = D_80127CAE; while ((s32)buffer != (s32)gDebugPrintBufferEnd) { - D_80127CB8 = 0; - buffer += func_800B653C(dList, (s8 *) buffer); + D_80127CB8 = FALSE; + buffer += func_800B653C(dList, buffer); } func_800B695C(dList, (u16) D_80127CB0, (u16) D_80127CB2, D_80127CAC, D_80127CAE + 10); buffer = (char *) gDebugPrintBufferStart; @@ -204,8 +254,8 @@ void print_debug_strings(Gfx **dList) { gDebugFontTexture = -1; D_80127CB4 = 0; while ((s32)buffer != (s32)gDebugPrintBufferEnd) { - D_80127CB8 = 1; - buffer += func_800B653C(dList, (s8 *) buffer); + D_80127CB8 = TRUE; + buffer += func_800B653C(dList, buffer); } gDebugPrintBufferEnd = gDebugPrintBufferStart; } @@ -217,6 +267,7 @@ UNUSED void func_800B61E0(void) { /** * Set the colour of the current debug text. + * Official Name: diPrintfSetCol */ void set_render_printf_colour(u8 red, u8 green, u8 blue, u8 alpha) { RENDER_PRINTF_CMD_SET_COLOR(red, green, blue, alpha) @@ -224,6 +275,7 @@ void set_render_printf_colour(u8 red, u8 green, u8 blue, u8 alpha) { /** * Set the background colour of the current debug text. + * Official Name: diPrintfSetBG */ void set_render_printf_background_colour(u8 red, u8 green, u8 blue, u8 alpha) { RENDER_PRINTF_CMD_SET_BACKGROUND_COLOR(red, green, blue, alpha) @@ -237,56 +289,130 @@ void set_render_printf_position(u16 x, u16 y) { RENDER_PRINTF_CMD_SET_POSITION(x, y) } -GLOBAL_ASM("asm/non_matchings/printf/func_800B63F4.s") +/** + * Definitely has some fakematch shenanigans. + * This will return the length in pixels of a given string using the debug small font. +*/ +UNUSED s32 func_800B63F4(const char *format, ...) { + s32 pad; + s32 fontCharU; + s32 stringLength; + char s[255]; + char *ch; + va_list args; + va_start(args, format); + + stringLength = 0; + func_800B4A08(1); + vsprintf(s, format, args); + func_800B4A08(0); + for (ch = &s[0]; *ch != '\0'; ch++) { + pad = *ch; + if (*ch != (0, '\n')) { + if (pad == ' ') { + stringLength += 6; + if (1){ } + } else { + if (*ch < 0x40) { + //Character is a symbol or number and not a letter + gDebugFontTexture = 0; + *ch-= 0x21; + } else if (*ch < 0x60) { + //Character is a upper case letter + gDebugFontTexture = 1; + *ch -= 0x40; + } else if (*ch < 0x80) { + //Character is a lower case letter + gDebugFontTexture = 2; + *ch -= 0x60; + } + fontCharU = gDebugFontCoords[gDebugFontTexture][*ch].u; + stringLength = ((stringLength + gDebugFontCoords[gDebugFontTexture][*ch].v) - fontCharU) + (pad = 1); + } + } + } + va_end(args); + return stringLength; +} + GLOBAL_ASM("asm/non_matchings/printf/func_800B653C.s") -void func_800B695C(Gfx **dList, u32 arg1, u32 arg2, u32 arg3, u32 arg4) { - if (!((arg1 == arg3) | (arg2 == arg4))) { - if (arg1 >= 2) { - arg1 -= 2; +void func_800B695C(Gfx **dList, u32 ulx, u32 uly, u32 lrx, u32 lry) { + if (!((ulx == lrx) | (uly == lry))) { + if (ulx >= 2) { + ulx -= 2; } - arg3 += 2; + lrx += 2; gDPSetCombineMode((*dList)++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); - gDPFillRectangle((*dList)++, arg1, arg2, arg3, arg4); + gDPFillRectangle((*dList)++, ulx, uly, lrx, lry); } } -s32 func_800B69FC(Gfx **dList, s32 arg1) { - s32 temp_a3; - s32 temp_a2; - u8* temp_v0_22; +//Loads a font texture and returns the width of the character given. +s32 func_800B69FC(Gfx **dList, s32 asciiVal) { + s32 fontCharWidth; + s32 fontCharU; - if (arg1 < 64) { + if (asciiVal < 0x40) { + //Character is a symbol or number and not a letter if (gDebugFontTexture != 0) { - if (D_80127CB8 != 0) { + if (D_80127CB8) { gDPLoadTextureBlock((*dList)++, OS_PHYSICAL_TO_K0(gTexture0 + 1), G_IM_FMT_IA, G_IM_SIZ_8b, 192, 11, 0, 2, 2, 0, 0, 0, 0); } gDebugFontTexture = 0; } - arg1 -= 33; - } else if (arg1 < 96) { + asciiVal -= 0x21; + } else if (asciiVal < 0x60) { + //Character is a upper case letter if (gDebugFontTexture != 1) { if (D_80127CB8) { gDPLoadTextureBlock((*dList)++, OS_PHYSICAL_TO_K0(gTexture1 + 1), G_IM_FMT_IA, G_IM_SIZ_8b, 248, 11, 0, 2, 2, 0, 0, 0, 0); } gDebugFontTexture = 1; } - arg1 -= 64; - } else if (arg1 < 128) { - arg1 -= 96; + asciiVal -= 0x40; + } else if (asciiVal < 0x80) { + //Character is a lower case letter if (gDebugFontTexture != 2) { - if (D_80127CB8 != 0) { + if (D_80127CB8) { gDPLoadTextureBlock((*dList)++, OS_PHYSICAL_TO_K0(gTexture2 + 1), G_IM_FMT_IA, G_IM_SIZ_8b, 192, 11, 0, 2, 2, 0, 0, 0, 0); } gDebugFontTexture = 2; } + asciiVal -= 0x60; } - temp_v0_22 = &D_800E2EF4[(gDebugFontTexture << 6) + (arg1 * 2)]; - temp_a2 = temp_v0_22[0]; - temp_a3 = (temp_v0_22[1] - temp_a2) + 1; + fontCharU = gDebugFontCoords[gDebugFontTexture][asciiVal].u; + fontCharWidth = (gDebugFontCoords[gDebugFontTexture][asciiVal].v - fontCharU) + 1; if (D_80127CB8) { gDPSetCombineMode((*dList)++, DKR_CC_UNK12, DKR_CC_UNK12); - gSPTextureRectangle((*dList)++, (D_80127CAC << 2), (D_80127CAE << 2), ((D_80127CAC + temp_a3) << 2), ((D_80127CAE + 10) << 2), 0, (temp_a2 << 5), 0, 1024, 1024); + gSPTextureRectangle((*dList)++, (D_80127CAC << 2), (D_80127CAE << 2), ((D_80127CAC + fontCharWidth) << 2), ((D_80127CAE + 10) << 2), 0, (fontCharU << 5), 0, 1024, 1024); } - return temp_a3; + return fontCharWidth; +} + +void func_800B6E50(void) { + if (D_80127CD0 <= 320) { + D_80127CBC = 16; + D_80127CC0 = D_80127CD0 - 16; + } else { + D_80127CBC = 32; + D_80127CC0 = D_80127CD0 - 32; + } + if (D_80127CD2 <= 240) { + D_80127CC4 = 16; + D_80127CC8 = D_80127CD2 - 16; + } else { + D_80127CC4 = 32; + D_80127CC8 = D_80127CD2 - 32; + } +} + +void func_800B6EE0(void) { + D_80127CAC = D_80127CBC; + D_80127CAE = D_80127CC4; +} + +void func_800B6F04(void) { + D_80127CAC = D_80127CBC; + D_80127CAE += 11; } diff --git a/src/printf.h b/src/printf.h index 3f570ca7..73a841a6 100644 --- a/src/printf.h +++ b/src/printf.h @@ -3,10 +3,12 @@ #include "types.h" #include "structs.h" -#include "particles.h" #include "macros.h" #include +typedef struct TexFontCoords { + u8 u, v; +} TexFontCoords; #define RENDER_PRINTF_CMD_ARG_BYTE(val) *gDebugPrintBufferEnd = val; gDebugPrintBufferEnd++; #define RENDER_PRINTF_CMD_ARG_SHORT(val) RENDER_PRINTF_CMD_ARG_BYTE(val) RENDER_PRINTF_CMD_ARG_BYTE(val >> 8) @@ -46,15 +48,16 @@ void func_800B4A08(s32 arg0); void diPrintfInit(void); void set_render_printf_colour(u8 red, u8 green, u8 blue, u8 alpha); void set_render_printf_background_colour(u8 red, u8 green, u8 blue, u8 alpha); -void func_800B695C(Gfx** dList, u32 arg1, u32 arg2, u32 arg3, u32 arg4); -s32 func_800B69FC(Gfx **dList, s32 arg1); +void func_800B695C(Gfx **dList, u32 ulx, u32 uly, u32 lrx, u32 lry); +s32 func_800B69FC(Gfx **dList, s32 asciiVal); void print_debug_strings(Gfx **dList); void set_render_printf_position(u16 x, u16 y); +s32 render_printf(const char *format, ...); +void func_800B6E50(void); +void func_800B6EE0(void); +void func_800B6F04(void); -s32 render_printf(const char *format, ...); // Non Matchingg -void func_800B3740(Object *, Gfx **, MatrixS **, Vertex **, s32); // Non Matching -s32 func_800B653C(Gfx**, s8*); -void func_800B4668(Object*, s32, s32, s32); -void func_800B46BC(Object*, s32, s32, s32); +s32 func_800B653C(Gfx**, char*); +int vsprintf(char *s, const char *fmt, ...); #endif diff --git a/src/racer.c b/src/racer.c index 72a4309d..d79e3c7e 100644 --- a/src/racer.c +++ b/src/racer.c @@ -27,6 +27,7 @@ #include "audiosfx.h" #include "collision.h" #include "controller.h" +#include "particles.h" #define MAX_NUMBER_OF_GHOST_NODES 360 diff --git a/src/set_rsp_segment.c b/src/set_rsp_segment.c index d958c48d..2977b74e 100644 --- a/src/set_rsp_segment.c +++ b/src/set_rsp_segment.c @@ -9,7 +9,7 @@ /** * Set the offset for the given address, so the RSP can get the correct physical address. * This is used for the colour and depth buffers. - * Official(?) name: segSetBase + * Official name: segSetBase */ void set_rsp_segment(Gfx **dlist, s32 segment, s32 base) { gSPSegment((*dlist)++, segment, base + K0BASE) diff --git a/src/textures_sprites.c b/src/textures_sprites.c index 9a389378..d0c3eaac 100644 --- a/src/textures_sprites.c +++ b/src/textures_sprites.c @@ -894,34 +894,65 @@ s16 D_80126384; /******************************/ -GLOBAL_ASM("asm/non_matchings/textures_sprites/texInitTextures.s") +void tex_init_textures(void) { + s32 i; -/* these two are possibly wrong */ -void texEnableModes(s32 flags) { + gTextureCache = allocate_from_main_pool_safe(0x15E0, COLOUR_TAG_MAGENTA); + gCiPalettes = allocate_from_main_pool_safe(0x280, 0xFF00FFFF); + gNumberOfLoadedTextures = 0; + gCiPalettesSize = 0; + D_80126320[0] = (s32 *) load_asset_section_from_rom(ASSET_TEXTURES_2D_TABLE); + D_80126320[1] = (s32 *) load_asset_section_from_rom(ASSET_TEXTURES_3D_TABLE); + + for (i = 0; D_80126320[0][i] != -1; i++) { } + D_80126338[0] = --i; + + for (i = 0; D_80126320[1][i] != -1; i++) { } + D_80126338[1] = --i; + + gSpriteCache = allocate_from_main_pool_safe(0x320, COLOUR_TAG_MAGENTA); + gCurrentSprite = allocate_from_main_pool_safe(0x200, COLOUR_TAG_MAGENTA); + D_80126358 = 0; + gSpriteOffsetTable = (s32 *) load_asset_section_from_rom(ASSET_SPRITES_TABLE); + D_80126354 = 0; + while (gSpriteOffsetTable[D_80126354] != -1) { + D_80126354++; + } + D_80126354--; + + gTempTextureHeader = allocate_from_main_pool_safe(0x28, COLOUR_TAG_MAGENTA); + D_80126344 = 0; +} + +/** + * Official Name: texDisableModes +*/ +void tex_disable_modes(s32 flags) { D_80126378 |= flags; } -void texDisableModes(s32 flags) { +/** + * Official Name: texEnableModes +*/ +void tex_enable_modes(s32 flags) { D_80126378 &= ~flags; } -/* Unused? */ -s32 func_8007AE44(void) { +UNUSED s32 func_8007AE44(void) { return D_80126338[0]; } -/* Unused? */ -s32 func_8007AE54(void) { +UNUSED s32 func_8007AE54(void) { return D_80126338[1]; } -/* Unused? */ -s32 func_8007AE64(void) { +UNUSED s32 func_8007AE64(void) { return D_80126354; } #ifdef NON_EQUIVALENT // Minor matching issues with loops, but should be functionally the same. +//Official Name: texLoadTexture TextureHeader *load_texture(s32 arg0) { s32 assetSection; s32 assetIndex; @@ -1037,6 +1068,9 @@ GLOBAL_ASM("asm/non_matchings/textures_sprites/load_texture.s") #endif #ifdef NON_EQUIVALENT +/** + * Official Name: texFreeTexture +*/ void free_texture(TextureHeader *tex) { s32 i; if (tex != NULL) { @@ -1059,6 +1093,7 @@ GLOBAL_ASM("asm/non_matchings/textures_sprites/free_texture.s") /** * Set the colour tag that determines which memory pool textures will be loaded into. * By default, this generally stays as COLOUR_TAG_MAGENTA + * Official Name: setTexMemColour */ void set_texture_colour_tag(s32 tagID) { gTexColourTag = tagID; @@ -1083,6 +1118,7 @@ GLOBAL_ASM("asm/non_matchings/textures_sprites/func_8007B380.s") /** * Resets all render settings to the default state. * The next draw call will be forced to apply all settings instead of skipping unecessary steps. + * Official Name: texDPInit */ void reset_render_settings(Gfx **dlist) { D_8012637C = NULL; @@ -1113,6 +1149,9 @@ typedef struct Struct_Unk_8007B46C { u8 pad17[3]; } Struct_Unk_8007B46C; +/** + * Official Name: texFrame +*/ Struct_Unk_8007B46C *func_8007B46C(Struct_Unk_8007B46C *arg0, s32 arg1) { if (arg1 > 0) { if (arg1 < arg0->unk12 << 8) { @@ -1291,8 +1330,7 @@ void load_blinking_lights_texture(Gfx **dlist, TextureHeader *texture_list, u32 gDPLoadTextureBlock((*dlist)++, OS_K0_TO_PHYSICAL(tblock), G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 32, 0, 0, 0, 5, 5, 0, 0); } - - // gSPSetGeometryMode((*dlist)++, 0); + gDPPipeSync((*dlist)++); D_8012637C = 0; flags &= 0x1F; @@ -1355,6 +1393,9 @@ void func_8007BF34(Gfx **dlist, s32 arg1) { GLOBAL_ASM("asm/non_matchings/textures_sprites/func_8007BF34.s") #endif +/** + * Official Name: texLoadSprite +*/ GLOBAL_ASM("asm/non_matchings/textures_sprites/func_8007C12C.s") #ifdef NON_MATCHING @@ -1498,19 +1539,163 @@ GLOBAL_ASM("asm/non_matchings/textures_sprites/free_sprite.s") #endif GLOBAL_ASM("asm/non_matchings/textures_sprites/func_8007CDC0.s") + +#ifdef NON_EQUIVALENT +//HEAVILY WIP +void build_tex_display_list(TextureHeader *tex, Gfx *dlist) { + s32 texFlags; + s32 cms; + s32 cmt; + s32 texFormat; + s32 temp_v0_4; + s32 i; + s32 uClamp; + s32 vClamp; + s32 masks; + s32 maskt; + u8 height; + u8 width; + s32 var_v0; + + tex->cmd = (s32 *) dlist; + texFormat = tex->format & 0xF; + texFlags = (tex->format >> 4) & 0xF; + height = tex->height; + width = tex->width; + var_v0 = 1; + masks = 1; + maskt = 1; + uClamp = TRUE; + vClamp = TRUE; + for (i = 0; i < 7; i++) { + if (var_v0 < width) { + masks = i + 1; + } + if (var_v0 == width) { + uClamp = FALSE; + } + if (var_v0 < height) { + maskt = i + 1; + } + if (var_v0 == height) { + vClamp = FALSE; + } + var_v0 <<= 1; + } + if (uClamp || (tex->flags & 0x40)) { + cms = 2; + masks = 0; + } else { + cms = 0; + } + if (vClamp || (tex->flags & 0x80)) { + cmt = 2; + maskt = 0; + } else { + cmt = 0; + } + if (!(tex->flags & 0x400)) { + if (texFormat == 0) { + gDPLoadTextureBlock(dlist++, OS_PHYSICAL_TO_K0(tex + 1), G_IM_FMT_RGBA, G_IM_SIZ_32b, width, height, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + if ((texFlags == 0) || (texFlags == 2)) { + tex->flags |= 4; + } + } + if (texFormat == 1) { + gDPLoadTextureBlock(dlist++, OS_PHYSICAL_TO_K0(tex + 1), G_IM_FMT_RGBA, G_IM_SIZ_16b, width, height, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + if ((texFlags == 0) || (texFlags == 2)) { + tex->flags |= 4; + } + } + if (texFormat == 7) { + gDPLoadTextureBlock(dlist++, OS_PHYSICAL_TO_K0(tex + 1), G_IM_FMT_CI, G_IM_SIZ_16b, width, height, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + temp_v0_4 = func_8007EF64(tex->ciPaletteOffset); + gDPLoadTLUT_pal16(dlist++, 0, temp_v0_4); + + tex->flags |= 0x20; + if ((texFlags == 0) || (texFlags == 2)) { + tex->flags |= 4; + } + } + if (texFormat == 4) { + gDPLoadTextureBlock(dlist++, OS_PHYSICAL_TO_K0(tex + 1), G_IM_FMT_IA, G_IM_SIZ_16b, width, height, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + tex->flags |= 4; + } + if (texFormat == 5) { + gDPLoadTextureBlock(dlist++, OS_PHYSICAL_TO_K0(tex + 1), G_IM_FMT_IA, G_IM_SIZ_8b, width, height, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + tex->flags |= 4; + } + if (texFormat == 6) { + gDPLoadTextureBlock(dlist++, OS_PHYSICAL_TO_K0(tex + 1), G_IM_FMT_IA, G_IM_SIZ_4b, width, height, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + tex->flags |= 4; + } + if (texFormat == 2) { + gDPLoadTextureBlock(dlist++, OS_PHYSICAL_TO_K0(tex + 1), G_IM_FMT_I, G_IM_SIZ_8b, width, height, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + } + if (texFormat == 3) { + gDPLoadTextureBlock(dlist++, OS_PHYSICAL_TO_K0(tex + 1), G_IM_FMT_I, G_IM_SIZ_4b, width, height, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + } + tex->numberOfCommands = ((s32) ((s32)dlist - (s32)tex->cmd) >> 3); + } else { + + if (texFormat == 0) { + gDPLoadTextureBlockS(dlist++, OS_PHYSICAL_TO_K0(tex + 1), G_IM_FMT_RGBA, G_IM_SIZ_32b, width, height, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + if ((texFlags == 0) || (texFlags == 2)) { + tex->flags |= 4; + } + } + if (texFormat == 1) { + gDPLoadTextureBlockS(dlist++, OS_PHYSICAL_TO_K0(tex + 1), G_IM_FMT_RGBA, G_IM_SIZ_16b, width, height, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + if ((texFlags == 0) || (texFlags == 2)) { + tex->flags |= 4; + } + } + if (texFormat == 7) { + gDPLoadTextureBlockS(dlist++, OS_PHYSICAL_TO_K0(tex + 1), G_IM_FMT_CI, G_IM_SIZ_16b, width, height, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + temp_v0_4 = func_8007EF64(tex->ciPaletteOffset); + gDPLoadTLUT_pal16(dlist++, 0, temp_v0_4); + + tex->flags |= 0x20; + if ((texFlags == 0) || (texFlags == 2)) { + tex->flags |= 4; + } + } + if (texFormat == 4) { + gDPLoadTextureBlockS(dlist++, OS_PHYSICAL_TO_K0(tex + 1), G_IM_FMT_IA, G_IM_SIZ_16b, width, height, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + tex->flags |= 4; + } + if (texFormat == 5) { + gDPLoadTextureBlockS(dlist++, OS_PHYSICAL_TO_K0(tex + 1), G_IM_FMT_IA, G_IM_SIZ_8b, width, height, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + tex->flags |= 4; + } + if (texFormat == 6) { + gDPLoadTextureBlockS(dlist++, OS_PHYSICAL_TO_K0(tex + 1), G_IM_FMT_IA, G_IM_SIZ_4b, width, height, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + tex->flags |= 4; + } + if (texFormat == 2) { + gDPLoadTextureBlockS(dlist++, OS_PHYSICAL_TO_K0(tex + 1), G_IM_FMT_I, G_IM_SIZ_8b, width, height, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + } + if (texFormat == 3) { + gDPLoadTextureBlockS(dlist++, OS_PHYSICAL_TO_K0(tex + 1), G_IM_FMT_I, G_IM_SIZ_4b, width, height, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + } + tex->numberOfCommands = ((s32) ((s32)dlist - (s32)tex->cmd) >> 3); + } +} +#else GLOBAL_ASM("asm/non_matchings/textures_sprites/build_tex_display_list.s") +#endif s32 func_8007EF64(s16 arg0) { return (s32) (arg0 + gCiPalettes); } - -// There might be a file boundary here. - -void func_8007EF80(TextureHeader *texture, u32 *triangleBatchInfoFlags, s32 *arg2, s32 updateRate) { +/** + * Official Name: texAnimateTexture +*/ +void tex_animate_texture(TextureHeader *texture, u32 *triangleBatchInfoFlags, s32 *arg2, s32 updateRate) { s32 bit23Set; s32 bit25Set; s32 bit26Set; - s32 phi_a0; + s32 breakVar; bit23Set = *triangleBatchInfoFlags & BATCH_FLAGS_UNK00800000; bit26Set = *triangleBatchInfoFlags & BATCH_FLAGS_UNK04000000; @@ -1522,61 +1707,53 @@ void func_8007EF80(TextureHeader *texture, u32 *triangleBatchInfoFlags, s32 *arg *triangleBatchInfoFlags |= BATCH_FLAGS_UNK02000000; } } else if (!bit26Set) { - *arg2 = *arg2 + (texture->frameAdvanceDelay * updateRate); + *arg2 += texture->frameAdvanceDelay * updateRate; if (*arg2 >= texture->numOfTextures) { *arg2 = ((texture->numOfTextures * 2) - *arg2) - 1; if (*arg2 < 0) { *arg2 = 0; *triangleBatchInfoFlags &= ~(BATCH_FLAGS_UNK02000000 | BATCH_FLAGS_UNK04000000); - return; + } else { + *triangleBatchInfoFlags |= BATCH_FLAGS_UNK04000000; } - *triangleBatchInfoFlags |= BATCH_FLAGS_UNK04000000; } } else { - *arg2 = *arg2 - (texture->frameAdvanceDelay * updateRate); + *arg2 -= texture->frameAdvanceDelay * updateRate; if (*arg2 < 0) { *arg2 = 0; *triangleBatchInfoFlags &= ~(BATCH_FLAGS_UNK02000000 | BATCH_FLAGS_UNK04000000); } } - } else { - if (bit25Set) { - if (!bit26Set) { - *arg2 += texture->frameAdvanceDelay * updateRate; - } else { - *arg2 -= texture->frameAdvanceDelay * updateRate; - } - do { - phi_a0 = 0; - if (*arg2 < 0) { - *arg2 = -*arg2; - *triangleBatchInfoFlags &= ~BATCH_FLAGS_UNK04000000; - phi_a0 = 1; - } - if (*arg2 >= texture->numOfTextures) { - *arg2 = ((texture->numOfTextures * 2) - *arg2) - 1; - *triangleBatchInfoFlags |= BATCH_FLAGS_UNK04000000; - phi_a0 = 1; - } - } while (phi_a0 != 0); - return; - } + } else if (bit25Set) { if (!bit26Set) { - *arg2 = *arg2 + (texture->frameAdvanceDelay * updateRate); - if (*arg2 >= texture->numOfTextures) { - do { - *arg2 -= texture->numOfTextures; - } while (*arg2 >= texture->numOfTextures); - } + *arg2 += texture->frameAdvanceDelay * updateRate; } else { - *arg2 = *arg2 - (texture->frameAdvanceDelay * updateRate); - if (*arg2 < 0) { - do { - *arg2 += texture->numOfTextures; - } while (*arg2 < 0); - } + *arg2 -= texture->frameAdvanceDelay * updateRate; } - } + do { + breakVar = FALSE; + if (*arg2 < 0) { + *arg2 = -*arg2; + *triangleBatchInfoFlags &= ~BATCH_FLAGS_UNK04000000; + breakVar = TRUE; + } + if (*arg2 >= texture->numOfTextures) { + *arg2 = ((texture->numOfTextures * 2) - *arg2) - 1; + *triangleBatchInfoFlags |= BATCH_FLAGS_UNK04000000; + breakVar = TRUE; + } + } while (breakVar); + } else if (!bit26Set) { + *arg2 += texture->frameAdvanceDelay * updateRate; + while (*arg2 >= texture->numOfTextures) { + *arg2 -= texture->numOfTextures; + } + } else { + *arg2 -= texture->frameAdvanceDelay * updateRate; + while (*arg2 < 0) { + *arg2 += texture->numOfTextures; + } + } } void func_8007F1E8(unk8007F1E8 *arg0) { @@ -1594,9 +1771,14 @@ void func_8007F1E8(unk8007F1E8 *arg0) { } } -GLOBAL_ASM("asm/non_matchings/textures_sprites/func_8007F24C.s") +/** + * Official name: updateColourCycle +*/ +GLOBAL_ASM("asm/non_matchings/textures_sprites/update_colour_cycle.s") -/* Official name: resetMixCycle */ +/** + * Official name: resetMixCycle +*/ void init_pulsating_light_data(PulsatingLightData *data) { s32 i; data->currentFrame = 0; @@ -1608,6 +1790,9 @@ void init_pulsating_light_data(PulsatingLightData *data) { } } +/** + * Official Name: updateMixCycle +*/ void update_pulsating_light_data(PulsatingLightData *data, s32 timeDelta) { s32 thisFrameIndex, nextFrameIndex; diff --git a/src/textures_sprites.h b/src/textures_sprites.h index e4524e26..c48d76aa 100644 --- a/src/textures_sprites.h +++ b/src/textures_sprites.h @@ -115,8 +115,8 @@ typedef struct TempTexHeader { /* 0x25 */ u8 pad25[3]; // padding } TempTexHeader; -void texEnableModes(s32 flags); -void texDisableModes(s32 flags); +void tex_disable_modes(s32 flags); +void tex_enable_modes(s32 flags); s32 func_8007AE44(void); s32 func_8007AE54(void); s32 func_8007AE64(void); @@ -130,7 +130,7 @@ s32 func_8007EF64(s16 arg0); void load_and_set_texture(Gfx **dlist, TextureHeader *texhead, s32 flags, s32 offset); // There might be a file boundary here. -void func_8007EF80(TextureHeader *texture, u32 *triangleBatchInfoFlags, s32 *arg2, s32 updateRate); +void tex_animate_texture(TextureHeader *texture, u32 *triangleBatchInfoFlags, s32 *arg2, s32 updateRate); void func_8007F1E8(unk8007F1E8 *arg0); void init_pulsating_light_data(PulsatingLightData *data); void update_pulsating_light_data(PulsatingLightData *data, s32 timeDelta); @@ -146,9 +146,9 @@ void free_sprite(Sprite *sprite); // Non Matching void func_8007F594(Gfx **dlist, u32 index, u32 primitiveColor, u32 environmentColor); // Non Matching void func_8007CA68(s32 spriteID, s32 arg1, s32 *arg2, s32 *arg3, s32 *arg4); // Non Matching MemoryPoolSlot *func_8007C12C(s32 spriteID, s32 arg1); // Non Matching -void texInitTextures(void); // Non Matching +void tex_init_textures(void); // Non Matching void func_8007BF34(Gfx **dlist, s32 arg1); // Non Matching void load_blinking_lights_texture(Gfx **dlist, TextureHeader *arg1, u32 flags, s32 arg3); // Non Matching -void build_tex_display_list(TextureHeader *tex, u8 *addr); +void build_tex_display_list(TextureHeader *tex, Gfx *dlist); //Non Matching #endif diff --git a/src/thread0_epc.c b/src/thread0_epc.c index b062c5b8..d98e4fbf 100644 --- a/src/thread0_epc.c +++ b/src/thread0_epc.c @@ -1,5 +1,5 @@ /* The comment below is needed for this file to be picked up by generate_ld */ -/* RAM_POS: 0x800B6E50 */ +/* RAM_POS: 0x800B6F50 */ #include "thread0_epc.h" #include "types.h" @@ -11,7 +11,6 @@ #include "controller.h" #include "game.h" #include "stacks.h" -#include "particles.h" /************ .rodata ************/ @@ -35,52 +34,16 @@ s32 sLockupDelay = 0; /*******************************/ -extern OSMesgQueue D_80129790; -extern OSMesg D_801297A8; -extern OSMesgQueue D_801297E8; -extern OSMesg D_801297C8; -extern u64 gEPCStack[0x200]; -extern s32 D_80129FB0[3]; - -void func_800B6E50(void) { - if (D_80127CD0 < 0x141) { - D_80127CBC = 0x10; - D_80127CC0 = D_80127CD0 - 0x10; - } else { - D_80127CBC = 0x20; - D_80127CC0 = D_80127CD0 - 0x20; - } - if (D_80127CD2 < 0xF1) { - D_80127CC4 = 0x10; - D_80127CC8 = D_80127CD2 - 0x10; - } else { - D_80127CC4 = 0x20; - D_80127CC8 = D_80127CD2 - 0x20; - } -} - -void func_800B6EE0(void) { - D_80127CAC = D_80127CBC; - D_80127CAE = D_80127CC4; -} - -void func_800B6F04(void) { - D_80127CAC = D_80127CBC; - D_80127CAE += 11; -} - -void func_800B6F30(UNUSED s32 arg0, UNUSED s32 arg1, UNUSED s32 arg2) {} - -// Only called from two libultra funcs for some reason. -// This is likely an assert gone wrong. -// Called from alEnvMixerPull, and _pullSubFrame -// thread0_Assert("samples >= 0", "env.c", 104); -// thread0_Assert("samples <= AL_MAX_RSP_SAMPLES", "env.c", 105); -// thread0_Assert("source", "env.c", 373); -void thread0_Assert(UNUSED char *message, UNUSED char *fileName, UNUSED s32 lineNumber) {} +u64 gEPCStack[0x200]; +OSThread gEPCThread; +s32 D_80129790[6]; // Osmesg stuff +s32 D_801297A8[8]; +s32 D_801297C8[8]; +s32 D_801297E8[6]; /** * Start the exception program counter thread. + * Official Name: diCpuTraceInit */ void thread0_create(void) { s32 i; @@ -93,26 +56,23 @@ void thread0_create(void) { } -#ifdef NON_EQUIVALENT -void thread0_Main(UNUSED void *unused) { // Has regalloc issues +void thread0_Main(UNUSED void *unused) { s32 sp34; s32 s0 = 0; osCreateMesgQueue(&D_80129790, &D_801297A8, 8); - osSetEventMesg(12, &D_80129790, 8); - osSetEventMesg(10, &D_80129790, 2); + osSetEventMesg(OS_EVENT_FAULT, &D_80129790, 8); + osSetEventMesg(OS_EVENT_CPU_BREAK, &D_80129790, 2); osCreatePiManager(150, &D_801297E8, &D_801297C8, 8); while (1) { - while (1) { - osRecvMesg(&D_80129790, &sp34, OS_MESG_BLOCK); - if (!(get_filtered_cheats() & CHEAT_EPC_LOCK_UP_DISPLAY)) { - continue; - } - s0 |= sp34; - if ((s0 & 8) || (s0 & 2)) { - break; - } + osRecvMesg(&D_80129790, &sp34, OS_MESG_BLOCK); + if (!(get_filtered_cheats() & CHEAT_EPC_LOCK_UP_DISPLAY)) { + continue; + } + s0 |= sp34; + if ((s0 & 8) == 0 && (s0 & 2) == 0) { + continue; } s0 &= ~8; func_800B70D0(); @@ -120,9 +80,6 @@ void thread0_Main(UNUSED void *unused) { // Has regalloc issues func_800B71B0(); } } -#else -GLOBAL_ASM("asm/non_matchings/thread0_epc/thread0_Main.s") -#endif void func_800B70D0(void) { OSThread *node = __osGetActiveQueue(); @@ -329,4 +286,4 @@ void render_epc_lock_up_display(void) { default: return; } -} \ No newline at end of file +} diff --git a/src/thread0_epc.h b/src/thread0_epc.h index 72ca7ef6..96650bd8 100644 --- a/src/thread0_epc.h +++ b/src/thread0_epc.h @@ -77,11 +77,6 @@ enum EPCScreenPage { EPC_PAGE_EXIT }; -void func_800B6E50(void); -void func_800B6EE0(void); -void func_800B6F04(void); -void func_800B6F30(s32 arg0, s32 arg1, s32 arg2); -void thread0_Assert(UNUSED char *message, UNUSED char *fileName, UNUSED s32 lineNumber); void func_800B70D0(void); void func_800B7144(void); void func_800B76B8(s32 arg0, s32 arg1); diff --git a/src/unknown_0255E0.c b/src/unknown_0255E0.c index a29dfed1..ffc665a3 100644 --- a/src/unknown_0255E0.c +++ b/src/unknown_0255E0.c @@ -22,6 +22,7 @@ #include "objects.h" #include "math_util.h" #include "printf.h" +#include "collision.h" // Maximum size for a level model is 522.5 KiB #define LEVEL_MODEL_MAX_SIZE 0x82A00 @@ -39,8 +40,8 @@ f32 D_800DC884[10] = { Vec3f D_800DC8AC[3][3] = { { {{{ 50.0f, 0.0f, 32.0f }}}, {{{ -50.0f, 0.0f, 32.0f }}}, {{{ -50.0f, 100.0f, 32.0f }}} }, - { {{{ 0.0f, 0.0f, 32.0f }}}, {{{ 130.0f, 60.0f, -68.0f }}}, {{{ 130.0f, -60.0f, -68.0f }}} }, - { {{{ 0.0f, 0.0f, 32.0f }}}, {{{ -130.0f, -60.0f, -68.0f }}}, {{{ -130.0f, 60.0f, -68.0f }}} }, + { {{{ 0.0f, 0.0f, 32.0f }}}, {{{ 130.0f, 60.0f, -68.0f }}}, {{{ 130.0f, -60.0f, -68.0f }}} }, + { {{{ 0.0f, 0.0f, 32.0f }}}, {{{ -130.0f, -60.0f, -68.0f }}}, {{{ -130.0f, 60.0f, -68.0f }}} }, }; LevelModel *gCurrentLevelModel = NULL; @@ -123,7 +124,7 @@ f32 D_8011D0D4; s32 D_8011D0D8; s32 D_8011D0DC; s32 D_8011D0E0; -s32 D_8011D0E4; +f32 D_8011D0E4; s32 D_8011D0E8; s32 D_8011D0EC; s32 D_8011D0F0; @@ -159,14 +160,14 @@ UNUSED f32 gCurrBBoxDistanceToCamera; // Used in a comparison check, but functio u32 D_8011D384; unk8011D388 D_8011D388[4]; Vec3i gScenePerspectivePos; -s32 *D_8011D474; -s32 D_8011D478; -s32 D_8011D47C; -s32 D_8011D480[2]; -Vertex **D_8011D488; +unk8011D474 *D_8011D474; // 0x10 bytes struct? +unk8011D478 *D_8011D478; // 0x8 bytes struct? +s16 **D_8011D47C; +Vertex *D_8011D480[2]; +Vertex *D_8011D488; s32 D_8011D48C; -s32 D_8011D490[2]; -Vertex **D_8011D498; +TriangleList *D_8011D490[2]; +Vertex *D_8011D498; s16 D_8011D49C; s16 D_8011D49E; f32 D_8011D4A0; @@ -302,7 +303,7 @@ void render_scene(Gfx **dList, MatrixS **mtx, Vertex **vtx, TriangleList **tris, func_8002D8DC(2, 2, updateRate); for (i = 0; i < 7; i++) { if ((s32) gCurrentLevelHeader2->unk74[i] != -1) { - func_8007F24C(gCurrentLevelHeader2->unk74[i], tempUpdateRate); + update_colour_cycle(gCurrentLevelHeader2->unk74[i], tempUpdateRate); } } @@ -322,7 +323,7 @@ void render_scene(Gfx **dList, MatrixS **mtx, Vertex **vtx, TriangleList **tris, gCurrentLevelHeader2->unkA8 = (gCurrentLevelHeader2->unkA8 + (gCurrentLevelHeader2->unkA2 * tempUpdateRate)) & i; i = (gCurrentLevelHeader2->unkA4->height << 9) - 1; gCurrentLevelHeader2->unkAA = (gCurrentLevelHeader2->unkAA + (gCurrentLevelHeader2->unkA3 * tempUpdateRate)) & i; - func_8007EF80(gCurrentLevelHeader2->unkA4, &D_8011B114, &D_8011B110, tempUpdateRate); + tex_animate_texture(gCurrentLevelHeader2->unkA4, &D_8011B114, &D_8011B110, tempUpdateRate); } flip = FALSE; if (get_filtered_cheats() & CHEAT_MIRRORED_TRACKS) { @@ -341,7 +342,7 @@ void render_scene(Gfx **dList, MatrixS **mtx, Vertex **vtx, TriangleList **tris, func_800AD40C(); func_80030838(numViewports, tempUpdateRate); func_800AF404(tempUpdateRate); - if (gCurrentLevelModel->unk1E > 0) { + if (gCurrentLevelModel->numberOfAnimatedTextures > 0) { func_80027E24(tempUpdateRate); } for (j = gSceneCurrentPlayerID = 0; j < numViewports; gSceneCurrentPlayerID++, j = gSceneCurrentPlayerID) { @@ -438,7 +439,177 @@ void func_800257D0(void) { } } +#ifdef NON_EQUIVALENT + +void func_80026070(LevelModelSegmentBoundingBox *, f32, f32, f32); +void func_80026430(LevelModelSegment *, f32, f32, f32); +void func_80026C14(s16 arg0, s16 arg1, s32 arg2); +void func_80026E54(s16 arg0, s8 *arg1, f32 arg2, f32 arg3); + +void func_8002581C(u8 *segmentIds, s32 numberOfSegments, s32 viewportIndex) { + Vertex *spAC; + s8 *spA8; + s8 sp7C; + LevelModelSegmentBoundingBox *bbox; + Vertex *temp_t6; + f32 yCameraCoss; + f32 x1Sins; + f32 x2Sins; + f32 z2Coss; + f32 temp_f22; + f32 yCameraSins; + f32 z1Coss; + s16 *var_a0; + s16 temp_s3; + s32 temp_t3_2; + s16 var_s0; + s16 i; + s16 var_s4; + s16 var_v1; + s32 temp_t3; + s32 temp_t4; + s32 continueLoop; + s16 check1; + s16 check2; + s16 check3; + s16 check4; + s8 *temp_t3_3; + s8 *temp_t7; + s8 *temp_v0_4; + s8 *var_t6; + s8 temp_t3_4; + u8 segmentIndex; + + D_8011D490[0] = D_8011D474[viewportIndex].unk0; + D_8011D490[1] = D_8011D474[viewportIndex].unk4; + D_8011D480[0] = D_8011D474[viewportIndex].unk8; + D_8011D480[1] = D_8011D474[viewportIndex].unkC; + load_and_set_texture_no_offset(&gSceneCurrDisplayList, NULL, RENDER_ANTI_ALIASING | RENDER_Z_COMPARE); + D_8011D49C = 0; + D_8011D49E = 0; + yCameraSins = sins_f(gSceneActiveCamera->trans.y_rotation * -1); + yCameraCoss = coss_f(gSceneActiveCamera->trans.y_rotation * -1); + D_8011D4AC = (gSceneActiveCamera->trans.x_position + (yCameraSins * 250.0)); + D_8011D4B0 = (gSceneActiveCamera->trans.z_position + (yCameraCoss * 250.0)); + D_8011D4A0 = -yCameraCoss; + D_8011D4A4 = yCameraSins; + temp_f22 = -((yCameraSins * D_8011D4AC) + (yCameraCoss * D_8011D4B0)); + D_8011D4A8 = -((D_8011D4A0 * D_8011D4AC) + (D_8011D4A4 * D_8011D4B0)); + for (i = 0; i < numberOfSegments; i++) { + segmentIndex = segmentIds[i]; + bbox = &gCurrentLevelModel->segmentsBoundingBoxes[segmentIndex]; + x1Sins = bbox->x1 * yCameraSins; + z1Coss = bbox->z1 * yCameraCoss; + x2Sins = bbox->x2 * yCameraSins; + z2Coss = bbox->z2 * yCameraCoss; + check1 = FALSE; + check2 = FALSE; + check3 = FALSE; + check4 = FALSE; + if ((x1Sins + z1Coss + temp_f22) <= 0.0) { + check1 = TRUE; + } + if ((x2Sins + z1Coss + temp_f22) <= 0.0) { + check2 = TRUE; + } + if ((x1Sins + z2Coss + temp_f22) <= 0.0) { + check3 = TRUE; + } + if ((x2Sins + z2Coss + temp_f22) <= 0.0) { + check4 = TRUE; + } + if (((s16) ((s16) (check1 + check2) + check3) + check4) & 3) { + func_80026430(bbox, yCameraSins, yCameraCoss, temp_f22); + if (gCurrentLevelModel->segments[segmentIndex].unk3C & 2) { + func_80026070(bbox, yCameraSins, yCameraCoss, temp_f22); + } + } + } + func_80026C14( 300, (gCurrentLevelModel->lowerYBounds - 195), 1); + func_80026C14(-300, (gCurrentLevelModel->lowerYBounds - 195), 1); + func_80026C14( 300, (gCurrentLevelModel->upperYBounds + 195), 0); + func_80026C14(-300, (gCurrentLevelModel->upperYBounds + 195), 0); + if (D_8011D49E < D_8011D4BA && D_8011D49E != 0) { + continueLoop = TRUE; + do { + for (i = 0; i < D_8011D49E - 1; i++) { + if (D_8011D478[i].unk8 < D_8011D478[i].unk0) { + temp_t3 = D_8011D478[i].unk8; + D_8011D478[i].unk8 = D_8011D478[i].unk0; + temp_t4 = D_8011D478[i+1].unk0; + D_8011D478[i].unk0 = temp_t3; + D_8011D478[i+1].unk0 = D_8011D478[i].unk4; + D_8011D478[i].unk4 = temp_t4; + continueLoop = FALSE; + } + } + } while (!continueLoop); + var_s0 = 0; + for (i = 0; i < D_8011D49E; i++) { + temp_t3_2 = D_8011D478[var_s0].unk8 * 2; + if (D_8011D47C[temp_t3_2][0] == -1) { + D_8011D478[i].unk4 = (s8) (D_8011D478[i].unk8 | 2); + D_8011D47C[temp_t3_2][0] = (s8) i; + } else { + D_8011D47C[temp_t3_2][0] = (s8) i; + } + } + temp_t6 = gSceneCurrVertexList; + gSceneCurrVertexList = D_8011D480[D_8011D4B4]; + temp_t7 = gSceneCurrTriList; + gSceneCurrTriList = D_8011D490[D_8011D4B4]; + D_8011D4B4 = 1 - D_8011D4B4; + var_s4 = D_8011D478->unk0; + D_8011D488 = gSceneCurrVertexList; + D_8011D498 = gSceneCurrTriList; + D_8011D4B6 = 0; + D_8011D4B8 = 0; + spAC = temp_t6; + spA8 = temp_t7; + for (i = 0; i < D_8011D49E; i++) { + if ((i < D_8011D49E) != 0) { + var_a0 = &D_8011D478[i].unk0; + if (var_s4 == *var_a0) { + temp_t3_3 = &(&sp7C)[var_s0]; + if (var_a0[3] & 2) { + var_s0++; + *temp_t3_3 = var_a0[7]; + } else { + for (var_v1 = 0; var_v1 < var_s0; var_v1++) { + var_t6 = &(&sp7C)[var_v1]; + if (*var_t6 == var_a0[7]) { + var_s0 -= 1; + while (var_v1 < var_s0) { + temp_v0_4 = &(&sp7C)[var_v1]; + temp_t3_4 = temp_v0_4[1]; + temp_v0_4[0] = temp_t3_4; + var_v1++; + } + } + } + } + } + } + if (i < D_8011D49E) { + temp_s3 = D_8011D478[i].unk0; + if (var_s4 != temp_s3) { + func_80026E54(var_s0, &sp7C, (f32) temp_s3, (f32) var_s4); + var_s4 = temp_s3; + } + } + } + if (D_8011D4B6 != 0) { + gSPVertexDKR(gSceneCurrDisplayList++, OS_PHYSICAL_TO_K0(D_8011D488), D_8011D4B6, 0); + gSPPolygon(gSceneCurrDisplayList++, OS_PHYSICAL_TO_K0(D_8011D498), (D_8011D4B6 >> 1), TRIN_DISABLE_TEXTURE); + } + gSceneCurrVertexList = spAC; + gSceneCurrTriList = spA8; + } +} +#else GLOBAL_ASM("asm/non_matchings/unknown_0255E0/func_8002581C.s") +#endif + GLOBAL_ASM("asm/non_matchings/unknown_0255E0/func_80026070.s") GLOBAL_ASM("asm/non_matchings/unknown_0255E0/func_80026430.s") GLOBAL_ASM("asm/non_matchings/unknown_0255E0/func_80026C14.s") @@ -465,10 +636,10 @@ void func_80027E24(s32 updateRate) { temp = batch[batchNumber].unk7 << 6; if (batch[batchNumber].flags & BATCH_FLAGS_UNK80000000) { temp |= batch[batchNumber].unk6; - func_8007EF80(texture, &batch[batchNumber].flags, &temp, updateRate); + tex_animate_texture(texture, &batch[batchNumber].flags, &temp, updateRate); batch[batchNumber].unk6 = temp & 0x3F; } else { - func_8007EF80(texture, &batch[batchNumber].flags, &temp, updateRate); + tex_animate_texture(texture, &batch[batchNumber].flags, &temp, updateRate); } batch[batchNumber].unk7 = (temp >> 6) & 0xFF; } @@ -1505,7 +1676,7 @@ void func_8002C0C4(s32 modelId) { LOCAL_OFFSET_TO_RAM_ADDRESS(TextureInfo *, gCurrentLevelModel->textures); LOCAL_OFFSET_TO_RAM_ADDRESS(LevelModelSegment *, gCurrentLevelModel->segments); LOCAL_OFFSET_TO_RAM_ADDRESS(LevelModelSegmentBoundingBox *, gCurrentLevelModel->segmentsBoundingBoxes); - LOCAL_OFFSET_TO_RAM_ADDRESS(s32, gCurrentLevelModel->unkC); + LOCAL_OFFSET_TO_RAM_ADDRESS(u8 *, gCurrentLevelModel->unkC); LOCAL_OFFSET_TO_RAM_ADDRESS(u8 *, gCurrentLevelModel->segmentsBitfields); LOCAL_OFFSET_TO_RAM_ADDRESS(BspTreeNode *, gCurrentLevelModel->segmentsBspTree); @@ -1603,7 +1774,7 @@ void func_8002C7D4(void) { free_from_memory_pool(D_8011D30C); free_from_memory_pool(D_8011D370); free_from_memory_pool(D_8011D374); - free_sprite((Sprite *) gCurrentLevelModel->minimapSprite); + free_sprite((Sprite *) gCurrentLevelModel->minimapSpriteIndex); for(i = 0; i < MAXCONTROLLERS; i++) { free_from_memory_pool(D_8011D350[i]); free_from_memory_pool(D_8011D320[i]); @@ -1931,7 +2102,134 @@ void func_8002D8DC(s32 arg0, s32 arg1, s32 updateRate) { D_8011D360[D_8011D364].unk6 = D_8011D36C; } +#ifdef NON_EQUIVALENT +void func_8002DE30(Object *obj) { + s32 sp94; + s32 sp90; + s32 sp8C; + s32 sp88; + s32 i; + s32 sp5C; + LevelModelSegment *segment; + ObjectHeader *objHeader; + Triangle *temp_t0; + TriangleBatchInfo *batches; + Vertex *vert; + f32 temp_f0_2; + s16 temp_v0_3; + s16 segmentIndex; + s16 var_a1; + s16 var_a2; + s16 facesOffset; + s32 obj_yPos; + s32 temp_v0; + s32 temp_v0_2; + s32 var_s4; + s32 var_s7; + s32 var_t2; + s32 var_v1; + u32 temp_v1_2; + u8 *var_a0; + u8 temp_t7; + s32 vertsOffset; + + objHeader = obj->segment.header; + obj_yPos = obj->segment.trans.y_position; + sp94 = obj_yPos + objHeader->unk44; + sp90 = obj_yPos + objHeader->unk42; + segmentIndex = obj->segment.unk2C.half.lower; + var_s7 = 0; + if (segmentIndex != -1) { + //func_800314DC = collision + temp_v0 = func_800314DC(&gCurrentLevelModel->segmentsBoundingBoxes[segmentIndex], + (obj->segment.trans.x_position - 16.0f), + (obj->segment.trans.z_position - 16.0f), + (obj->segment.trans.x_position + 16.0f), + (obj->segment.trans.z_position + 16.0f)); + + segment = &gCurrentLevelModel->segments[segmentIndex]; + for (i = 0; i < segment->numberOfBatches; i++) { + vertsOffset = segment->batches[i].verticesOffset; + + } + + i = 0; + segment = &gCurrentLevelModel->segments[segmentIndex]; + var_t2 = 0; + if (segment->numberOfBatches > 0) { + batches = segment->batches; + vertsOffset = batches->verticesOffset; +loop_3: + temp_v1_2 = batches->flags; + if (!(temp_v1_2 & 0x6900)) { + facesOffset = batches->facesOffset; + vert = &segment->vertices[vertsOffset]; + if ((facesOffset < batches[1].textureIndex) != 0) { + var_s4 = facesOffset * 2; + if (var_s7 == 0) { +loop_6: + temp_v0_2 = *(segment->unk10 + var_s4) & temp_v0; + if ((temp_v0_2 & 0xFF) && (temp_v0_2 & 0xFF00)) { + temp_t0 = &segment->triangles[facesOffset]; + temp_t7 = temp_t0->verticesArray[1]; + var_a0 = &temp_t0->verticesArray[1]; + var_v1 = 1; + var_a1 = vert[temp_t7].y; + var_a2 = var_a1; + do { + var_v1 += 1; + temp_v0_3 = vert[var_a0[1]].y; + if (temp_v0_3 < var_a1) { + var_a1 = temp_v0_3; + } else if (var_a2 < temp_v0_3) { + var_a2 = temp_v0_3; + } + var_a0 += 1; + } while (var_v1 != 3); + if ((var_a2 >= sp90) && (sp94 >= var_a1)) { + sp88 = temp_v0; + sp5C = var_t2; + if (point_triangle_2d_xz_intersection( + obj->segment.trans.x_position, + obj->segment.trans.z_position, + &vert[temp_t7].x, + &vert[temp_t0->verticesArray[2]].x, + &vert[temp_t0->verticesArray[3]].x + ) != 0) { + var_s7 = 1; + obj->unk54->unk0 += (((1.0f - D_800DC884[temp_v1_2]) - obj->unk54->unk0) * 0.2); + } + } + } + facesOffset += 1; + batches = &segment->batches[var_t2]; + var_s4 += 2; + if (facesOffset < batches[1].textureIndex) { + if (var_s7 != 0) { + + } else { + goto loop_6; + } + } + } + } + } + var_t2 += 0xC; + i++; + batches += 0xC; + if (i < segment->numberOfBatches) { + if (var_s7 != 0) { + + } else { + goto loop_3; + } + } + } + } +} +#else GLOBAL_ASM("asm/non_matchings/unknown_0255E0/func_8002DE30.s") +#endif GLOBAL_ASM("asm/non_matchings/unknown_0255E0/func_8002E234.s") GLOBAL_ASM("asm/non_matchings/unknown_0255E0/func_8002E904.s") GLOBAL_ASM("asm/non_matchings/unknown_0255E0/func_8002EEEC.s") diff --git a/src/unknown_0255E0.h b/src/unknown_0255E0.h index 0d59935b..3d72fcea 100644 --- a/src/unknown_0255E0.h +++ b/src/unknown_0255E0.h @@ -73,6 +73,21 @@ typedef struct unk8011D360 { s16 unk6; } unk8011D360; +/* Size: 0x10 bytes */ +typedef struct unk8011D474 { + TriangleList *unk0; + TriangleList *unk4; + Vertex *unk8; + Vertex *unkC; +} unk8011D474; + +/* Size: 0x8 bytes */ +typedef struct unk8011D478 { + s32 unk0; + s32 unk4; + s32 unk8; +} unk8011D478; + /* Size: 0x38 bytes */ typedef struct unk8011D388 { s32 unk0; @@ -163,7 +178,7 @@ void render_scene(Gfx** dList, MatrixS** mtx, Vertex** vtx, TriangleList** tris, void func_80030664(s32 arg0, s16 arg1, s16 arg2, u8 arg3, u8 arg4, u8 arg5); void func_8002C7D4(void); -Gfx *func_8002581C(u8 *segmentIds, s32 numberOfSegments, s32 currentViewportIndex); +void func_8002581C(u8 *segmentIds, s32 numberOfSegments, s32 currentViewportIndex); s32 func_80027568(void); s32 func_8002CC30(LevelModelSegment*); s8 func_8002B0F4(s16, f32 xPos, f32 zPos, struct TempStruct8**); @@ -171,7 +186,7 @@ void func_800278E8(s32); void func_80028050(void); void initialise_player_viewport_vars(s32); void func_8002A31C(void); -void func_8007F24C(s8*, s32); +void update_colour_cycle(s8*, s32); void func_800AD030(ObjectSegment*); void func_800B9C18(s32); void func_800BA8E4(Gfx**, MatrixS**, s32); diff --git a/src/unknown_032760.c b/src/unknown_032760.c index 9e1e9aac..d200cd23 100644 --- a/src/unknown_032760.c +++ b/src/unknown_032760.c @@ -62,18 +62,15 @@ GLOBAL_ASM("asm/non_matchings/unknown_032760/func_80031CAC.s") GLOBAL_ASM("asm/non_matchings/unknown_032760/func_80031F88.s") -// Unused. -void func_80032210(unk800DC950 *arg0) { +UNUSED void func_80032210(unk800DC950 *arg0) { arg0->unk4 = 0; } -// Unused. -void func_80032218(unk800DC950 *arg0) { +UNUSED void func_80032218(unk800DC950 *arg0) { arg0->unk4 = 1; } -// Unused. -void func_80032224(unk800DC950 *arg0) { +UNUSED void func_80032224(unk800DC950 *arg0) { if (arg0->unk4 == 1) { arg0->unk4 = 0; return; @@ -81,8 +78,7 @@ void func_80032224(unk800DC950 *arg0) { arg0->unk4 = 1; } -// Unused. -void func_80032248(unk800DC950 *arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6) { +UNUSED void func_80032248(unk800DC950 *arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6) { if (arg2 > 0) { arg0->unk3C = arg2; arg0->unk2C = ((arg1 << 0x10) - arg0->unk1C) / arg2; diff --git a/src/unknown_078050.c b/src/unknown_078050.c index 77fc592d..db6e994a 100644 --- a/src/unknown_078050.c +++ b/src/unknown_078050.c @@ -178,6 +178,7 @@ OSMesgQueue *osScInterruptQ; /** * Prepare the gfx task for the F3DDKR XBus microcode. * Sends a message to the scheduler to start processing an RSP task once set up. + * Official Name: rcpFast3d */ s32 setup_ostask_xbus(Gfx* dlBegin, Gfx* dlEnd, UNUSED s32 recvMesg) { DKR_OSTask *dkrtask; diff --git a/src/unknown_B7B30.c b/src/unknown_B7B30.c new file mode 100644 index 00000000..456e9a12 --- /dev/null +++ b/src/unknown_B7B30.c @@ -0,0 +1,14 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800B6F30 */ + +#include "unknown_B7B30.h" + +UNUSED void func_800B6F30(UNUSED int arg0, UNUSED int arg1, UNUSED int arg2) {} + +// Only called from two libultra funcs for some reason. +// This is likely an assert gone wrong. +// Called from alEnvMixerPull, and _pullSubFrame +// assert_stub("samples >= 0", "env.c", 104); +// assert_stub("samples <= AL_MAX_RSP_SAMPLES", "env.c", 105); +// assert_stub("source", "env.c", 373); +void assert_stub(UNUSED char *message, UNUSED char *fileName, UNUSED s32 lineNumber) {} diff --git a/src/unknown_B7B30.h b/src/unknown_B7B30.h new file mode 100644 index 00000000..6414ad2d --- /dev/null +++ b/src/unknown_B7B30.h @@ -0,0 +1,10 @@ +#ifndef _UNKNOWN_B7B30_H_ +#define _UNKNOWN_B7B30_H_ + +#include "types.h" +#include "libultra_internal.h" +#include "macros.h" + +void assert_stub(UNUSED char *message, UNUSED char *fileName, UNUSED s32 lineNumber); + +#endif diff --git a/src/video.c b/src/video.c index f23ed670..5f2a679d 100644 --- a/src/video.c +++ b/src/video.c @@ -30,7 +30,7 @@ UNUSED s32 D_800DE7BC = 0; /************ .bss ************/ -s32 gVideoRefreshRate; +s32 gVideoRefreshRate; //Official Name: viFramesPerSecond f32 gVideoAspectRatio; f32 gVideoHeightRatio; UNUSED s32 D_8012617C; @@ -59,6 +59,7 @@ OSScClient gVideoSched; /** * Set up the framebuffers and the VI. * Framebuffers are allocated at runtime. + * Official Name: viInit */ void init_video(s32 videoModeIndex, OSSched *sc) { if (osTvType == TV_TYPE_PAL) { @@ -125,6 +126,7 @@ UNUSED void set_video_width_and_height_from_index(s32 fbIndex) { /** * Return the current framebuffer dimensions as a single s32 value. * The high 16 bits are the height of the frame, and the low 16 bits are the width. + * Official Name: viGetCurrentSize? */ s32 get_video_width_and_height_as_s32(void) { return (gVideoFbHeights[gVideoCurrFbIndex] << 16) | gVideoFbWidths[gVideoCurrFbIndex]; diff --git a/tools/permuter_settings.toml b/tools/permuter_settings.toml index 43df063a..a8a3a8db 100644 --- a/tools/permuter_settings.toml +++ b/tools/permuter_settings.toml @@ -7,6 +7,7 @@ compiler_type = "ido" "fast3d_cmd" = "void" "OS_PHYSICAL_TO_K0" = "void *" "_SHIFTL" = "unsigned int" +"G_IM_.*" = "unsigned int" [decompme.compilers] -"tools/ido-static-recomp/build5.3/out/cc" = "ido5.3" +"tools/ido-static-recomp/build/5.3/out/cc" = "ido5.3" diff --git a/tools/python/first_diff.py b/tools/python/first_diff.py index cbe59cf4..879e66aa 100644 --- a/tools/python/first_diff.py +++ b/tools/python/first_diff.py @@ -35,7 +35,7 @@ if args.make: check_call(["ninja", "baseroms/dkr.z64"]) baseimg = f"baseroms/dkr.z64" -basemap = f"build/dkr.map" +basemap = f"expected/build//us_1.0/dkr.map" myimg = f"build/us_1.0/dkr.z64" mymap = f"build/us_1.0/dkr.map"