From 64b5536ab8344ec9fc6e0a3be53d275743b67087 Mon Sep 17 00:00:00 2001 From: Roman971 Date: Mon, 23 Mar 2020 01:38:25 +0100 Subject: [PATCH 1/2] Fix remaining non matchings --- .../fault_drawer/FaultDrawer_DrawRecImpl.s | 82 ---- .../code/z_actor/TitleCard_Draw.s | 388 ------------------ .../code/z_debug/func_8006376C.s | 52 --- include/z64actor.h | 3 +- src/code/fault_drawer.c | 53 ++- src/code/z_actor.c | 139 ++++--- src/code/z_camera.c | 5 +- src/code/z_debug.c | 24 +- src/code/z_lifemeter.c | 2 +- src/code/z_room.c | 2 +- src/code/z_scene.c | 2 +- 11 files changed, 114 insertions(+), 638 deletions(-) delete mode 100644 asm/non_matchings/code/fault_drawer/FaultDrawer_DrawRecImpl.s delete mode 100644 asm/non_matchings/code/z_actor/TitleCard_Draw.s delete mode 100644 asm/non_matchings/code/z_debug/func_8006376C.s diff --git a/asm/non_matchings/code/fault_drawer/FaultDrawer_DrawRecImpl.s b/asm/non_matchings/code/fault_drawer/FaultDrawer_DrawRecImpl.s deleted file mode 100644 index a0b2f6c39f..0000000000 --- a/asm/non_matchings/code/fault_drawer/FaultDrawer_DrawRecImpl.s +++ /dev/null @@ -1,82 +0,0 @@ -glabel FaultDrawer_DrawRecImpl -/* B4D920 800D6780 3C0EFFFA */ lui $t6, (0xFFFA5A5A >> 16) # lui $t6, 0xfffa -/* B4D924 800D6784 03A07825 */ move $t7, $sp -/* B4D928 800D6788 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* B4D92C 800D678C 35CE5A5A */ ori $t6, (0xFFFA5A5A & 0xFFFF) # ori $t6, $t6, 0x5a5a -.L800D6790: -/* B4D930 800D6790 25EFFFF8 */ addiu $t7, $t7, -8 -/* B4D934 800D6794 ADEE0000 */ sw $t6, ($t7) -/* B4D938 800D6798 15FDFFFD */ bne $t7, $sp, .L800D6790 -/* B4D93C 800D679C ADEE0004 */ sw $t6, 4($t7) -/* B4D940 800D67A0 3C0D8017 */ lui $t5, %hi(sFaultDrawerStruct) # $t5, 0x8017 -/* B4D944 800D67A4 25ADB680 */ addiu $t5, %lo(sFaultDrawerStruct) # addiu $t5, $t5, -0x4980 -/* B4D948 800D67A8 AFBF0014 */ sw $ra, 0x14($sp) -/* B4D94C 800D67AC 95A90004 */ lhu $t1, 4($t5) -/* B4D950 800D67B0 95AE0006 */ lhu $t6, 6($t5) -/* B4D954 800D67B4 00C41823 */ subu $v1, $a2, $a0 -/* B4D958 800D67B8 00E55823 */ subu $t3, $a3, $a1 -/* B4D95C 800D67BC 24630001 */ addiu $v1, $v1, 1 -/* B4D960 800D67C0 256B0001 */ addiu $t3, $t3, 1 -/* B4D964 800D67C4 01241023 */ subu $v0, $t1, $a0 -/* B4D968 800D67C8 00604025 */ move $t0, $v1 -/* B4D96C 800D67CC 01605025 */ move $t2, $t3 -/* B4D970 800D67D0 1840002E */ blez $v0, .L800D688C -/* B4D974 800D67D4 01C56023 */ subu $t4, $t6, $a1 -/* B4D978 800D67D8 1980002C */ blez $t4, .L800D688C -/* B4D97C 800D67DC 0043082A */ slt $at, $v0, $v1 -/* B4D980 800D67E0 50200003 */ beql $at, $zero, .L800D67F0 -/* B4D984 800D67E4 018B082A */ slt $at, $t4, $t3 -/* B4D988 800D67E8 00404025 */ move $t0, $v0 -/* B4D98C 800D67EC 018B082A */ slt $at, $t4, $t3 -.L800D67F0: -/* B4D990 800D67F0 10200002 */ beqz $at, .L800D67FC -/* B4D994 800D67F4 00000000 */ nop -/* B4D998 800D67F8 01805025 */ move $t2, $t4 -.L800D67FC: -/* B4D99C 800D67FC 01250019 */ multu $t1, $a1 -/* B4D9A0 800D6800 8DB90000 */ lw $t9, ($t5) -/* B4D9A4 800D6804 00003825 */ move $a3, $zero -/* B4D9A8 800D6808 00007812 */ mflo $t7 -/* B4D9AC 800D680C 000FC040 */ sll $t8, $t7, 1 -/* B4D9B0 800D6810 00047840 */ sll $t7, $a0, 1 -/* B4D9B4 800D6814 03197021 */ addu $t6, $t8, $t9 -/* B4D9B8 800D6818 1940001A */ blez $t2, .L800D6884 -/* B4D9BC 800D681C 01CF1021 */ addu $v0, $t6, $t7 -/* B4D9C0 800D6820 97A4002A */ lhu $a0, 0x2a($sp) -.L800D6824: -/* B4D9C4 800D6824 19000012 */ blez $t0, .L800D6870 -/* B4D9C8 800D6828 00001825 */ move $v1, $zero -/* B4D9CC 800D682C 31060003 */ andi $a2, $t0, 3 -/* B4D9D0 800D6830 10C00007 */ beqz $a2, .L800D6850 -/* B4D9D4 800D6834 3C098017 */ lui $t1, %hi(sFaultDrawerStruct+4) # $t1, 0x8017 -/* B4D9D8 800D6838 00C02825 */ move $a1, $a2 -.L800D683C: -/* B4D9DC 800D683C 24630001 */ addiu $v1, $v1, 1 -/* B4D9E0 800D6840 A4440000 */ sh $a0, ($v0) -/* B4D9E4 800D6844 14A3FFFD */ bne $a1, $v1, .L800D683C -/* B4D9E8 800D6848 24420002 */ addiu $v0, $v0, 2 -/* B4D9EC 800D684C 10680007 */ beq $v1, $t0, .L800D686C -.L800D6850: -/* B4D9F0 800D6850 24630004 */ addiu $v1, $v1, 4 -/* B4D9F4 800D6854 A4440002 */ sh $a0, 2($v0) -/* B4D9F8 800D6858 A4440004 */ sh $a0, 4($v0) -/* B4D9FC 800D685C A4440006 */ sh $a0, 6($v0) -/* B4DA00 800D6860 24420008 */ addiu $v0, $v0, 8 -/* B4DA04 800D6864 1468FFFA */ bne $v1, $t0, .L800D6850 -/* B4DA08 800D6868 A444FFF8 */ sh $a0, -8($v0) -.L800D686C: -/* B4DA0C 800D686C 9529B684 */ lhu $t1, %lo(sFaultDrawerStruct+4)($t1) -.L800D6870: -/* B4DA10 800D6870 0128C023 */ subu $t8, $t1, $t0 -/* B4DA14 800D6874 24E70001 */ addiu $a3, $a3, 1 -/* B4DA18 800D6878 0018C840 */ sll $t9, $t8, 1 -/* B4DA1C 800D687C 14EAFFE9 */ bne $a3, $t2, .L800D6824 -/* B4DA20 800D6880 00591021 */ addu $v0, $v0, $t9 -.L800D6884: -/* B4DA24 800D6884 0C041924 */ jal osWritebackDCacheAll -/* B4DA28 800D6888 00000000 */ nop -.L800D688C: -/* B4DA2C 800D688C 8FBF0014 */ lw $ra, 0x14($sp) -/* B4DA30 800D6890 27BD0018 */ addiu $sp, $sp, 0x18 -/* B4DA34 800D6894 03E00008 */ jr $ra -/* B4DA38 800D6898 00000000 */ nop \ No newline at end of file diff --git a/asm/non_matchings/code/z_actor/TitleCard_Draw.s b/asm/non_matchings/code/z_actor/TitleCard_Draw.s deleted file mode 100644 index de9f881306..0000000000 --- a/asm/non_matchings/code/z_actor/TitleCard_Draw.s +++ /dev/null @@ -1,388 +0,0 @@ -.rdata -glabel D_80136160 - .asciz "../z_actor.c" - .balign 4 - -glabel D_80136170 - .asciz "../z_actor.c" - .balign 4 - -.text -glabel TitleCard_Draw -/* AA414C 8002CFAC 27BDFF30 */ addiu $sp, $sp, -0xd0 -/* AA4150 8002CFB0 AFBF0014 */ sw $ra, 0x14($sp) -/* AA4154 8002CFB4 AFA400D0 */ sw $a0, 0xd0($sp) -/* AA4158 8002CFB8 AFA500D4 */ sw $a1, 0xd4($sp) -/* AA415C 8002CFBC 84AF000C */ lh $t7, 0xc($a1) -/* AA4160 8002CFC0 3C068013 */ lui $a2, %hi(D_80136160) # $a2, 0x8013 -/* AA4164 8002CFC4 24C66160 */ addiu $a2, %lo(D_80136160) # addiu $a2, $a2, 0x6160 -/* AA4168 8002CFC8 51E00159 */ beql $t7, $zero, .L8002D530 -/* AA416C 8002CFCC 8FBF0014 */ lw $ra, 0x14($sp) -/* AA4170 8002CFD0 90AA0008 */ lbu $t2, 8($a1) -/* AA4174 8002CFD4 84B80004 */ lh $t8, 4($a1) -/* AA4178 8002CFD8 90A90009 */ lbu $t1, 9($a1) -/* AA417C 8002CFDC 000A1040 */ sll $v0, $t2, 1 -/* AA4180 8002CFE0 0018C880 */ sll $t9, $t8, 2 -/* AA4184 8002CFE4 03227823 */ subu $t7, $t9, $v0 -/* AA4188 8002CFE8 AFAF00C0 */ sw $t7, 0xc0($sp) -/* AA418C 8002CFEC 84B80006 */ lh $t8, 6($a1) -/* AA4190 8002CFF0 00097840 */ sll $t7, $t1, 1 -/* AA4194 8002CFF4 24070B08 */ li $a3, 2824 -/* AA4198 8002CFF8 0018C880 */ sll $t9, $t8, 2 -/* AA419C 8002CFFC 032F7023 */ subu $t6, $t9, $t7 -/* AA41A0 8002D000 AFAE00B8 */ sw $t6, 0xb8($sp) -/* AA41A4 8002D004 8C850000 */ lw $a1, ($a0) -/* AA41A8 8002D008 AFA20038 */ sw $v0, 0x38($sp) -/* AA41AC 8002D00C 27A4009C */ addiu $a0, $sp, 0x9c -/* AA41B0 8002D010 AFAA00CC */ sw $t2, 0xcc($sp) -/* AA41B4 8002D014 AFA900C8 */ sw $t1, 0xc8($sp) -/* AA41B8 8002D018 0C031AB1 */ jal func_800C6AC4 -/* AA41BC 8002D01C AFA500AC */ sw $a1, 0xac($sp) -/* AA41C0 8002D020 8FA900C8 */ lw $t1, 0xc8($sp) -/* AA41C4 8002D024 8FAA00CC */ lw $t2, 0xcc($sp) -/* AA41C8 8002D028 3C198016 */ lui $t9, %hi(gSaveContext+0x1409) # $t9, 0x8016 -/* AA41CC 8002D02C 9339FA69 */ lbu $t9, %lo(gSaveContext+0x1409)($t9) -/* AA41D0 8002D030 01490019 */ multu $t2, $t1 -/* AA41D4 8002D034 8FA800AC */ lw $t0, 0xac($sp) -/* AA41D8 8002D038 8FAB00D4 */ lw $t3, 0xd4($sp) -/* AA41DC 8002D03C 240E1000 */ li $t6, 4096 -/* AA41E0 8002D040 00002812 */ mflo $a1 -/* AA41E4 8002D044 28A11001 */ slti $at, $a1, 0x1001 -/* AA41E8 8002D048 00000000 */ nop -/* AA41EC 8002D04C 00B90019 */ multu $a1, $t9 -/* AA41F0 8002D050 8FB900B8 */ lw $t9, 0xb8($sp) -/* AA41F4 8002D054 00007812 */ mflo $t7 -/* AA41F8 8002D058 AFAF00B0 */ sw $t7, 0xb0($sp) -/* AA41FC 8002D05C 54200011 */ bnezl $at, .L8002D0A4 -/* AA4200 8002D060 0009C080 */ sll $t8, $t1, 2 -/* AA4204 8002D064 01CA001A */ div $zero, $t6, $t2 -/* AA4208 8002D068 00004812 */ mflo $t1 -/* AA420C 8002D06C 15400002 */ bnez $t2, .L8002D078 -/* AA4210 8002D070 00000000 */ nop -/* AA4214 8002D074 0007000D */ break 7 -.L8002D078: -/* AA4218 8002D078 2401FFFF */ li $at, -1 -/* AA421C 8002D07C 15410004 */ bne $t2, $at, .L8002D090 -/* AA4220 8002D080 3C018000 */ lui $at, 0x8000 -/* AA4224 8002D084 15C10002 */ bne $t6, $at, .L8002D090 -/* AA4228 8002D088 00000000 */ nop -/* AA422C 8002D08C 0006000D */ break 6 -.L8002D090: -/* AA4230 8002D090 01490019 */ multu $t2, $t1 -/* AA4234 8002D094 00002812 */ mflo $a1 -/* AA4238 8002D098 00000000 */ nop -/* AA423C 8002D09C 00000000 */ nop -/* AA4240 8002D0A0 0009C080 */ sll $t8, $t1, 2 -.L8002D0A4: -/* AA4244 8002D0A4 03196021 */ addu $t4, $t8, $t9 -/* AA4248 8002D0A8 AFAC00B4 */ sw $t4, 0xb4($sp) -/* AA424C 8002D0AC 8D0402B0 */ lw $a0, 0x2b0($t0) -/* AA4250 8002D0B0 AFAC0030 */ sw $t4, 0x30($sp) -/* AA4254 8002D0B4 AFAA00CC */ sw $t2, 0xcc($sp) -/* AA4258 8002D0B8 AFA900C8 */ sw $t1, 0xc8($sp) -/* AA425C 8002D0BC AFA800AC */ sw $t0, 0xac($sp) -/* AA4260 8002D0C0 0C024E02 */ jal func_80093808 -/* AA4264 8002D0C4 AFA50034 */ sw $a1, 0x34($sp) -/* AA4268 8002D0C8 8FA800AC */ lw $t0, 0xac($sp) -/* AA426C 8002D0CC 8FA50034 */ lw $a1, 0x34($sp) -/* AA4270 8002D0D0 8FAA00CC */ lw $t2, 0xcc($sp) -/* AA4274 8002D0D4 8FAB00D4 */ lw $t3, 0xd4($sp) -/* AA4278 8002D0D8 8FA900C8 */ lw $t1, 0xc8($sp) -/* AA427C 8002D0DC 8FAC0030 */ lw $t4, 0x30($sp) -/* AA4280 8002D0E0 244F0008 */ addiu $t7, $v0, 8 -/* AA4284 8002D0E4 AD0202B0 */ sw $v0, 0x2b0($t0) -/* AA4288 8002D0E8 3C0EFA00 */ lui $t6, 0xfa00 -/* AA428C 8002D0EC AD0F02B0 */ sw $t7, 0x2b0($t0) -/* AA4290 8002D0F0 AC4E0000 */ sw $t6, ($v0) -/* AA4294 8002D0F4 9163000F */ lbu $v1, 0xf($t3) -/* AA4298 8002D0F8 01403825 */ move $a3, $t2 -/* AA429C 8002D0FC 24ED0007 */ addiu $t5, $a3, 7 -/* AA42A0 8002D100 0003C600 */ sll $t8, $v1, 0x18 -/* AA42A4 8002D104 0003CC00 */ sll $t9, $v1, 0x10 -/* AA42A8 8002D108 03197825 */ or $t7, $t8, $t9 -/* AA42AC 8002D10C 00037200 */ sll $t6, $v1, 8 -/* AA42B0 8002D110 01EEC025 */ or $t8, $t7, $t6 -/* AA42B4 8002D114 916F000D */ lbu $t7, 0xd($t3) -/* AA42B8 8002D118 24A30001 */ addiu $v1, $a1, 1 -/* AA42BC 8002D11C 00031843 */ sra $v1, $v1, 1 -/* AA42C0 8002D120 030F7025 */ or $t6, $t8, $t7 -/* AA42C4 8002D124 AC4E0004 */ sw $t6, 4($v0) -/* AA42C8 8002D128 8D0202B0 */ lw $v0, 0x2b0($t0) -/* AA42CC 8002D12C 3C18FD70 */ lui $t8, 0xfd70 -/* AA42D0 8002D130 2463FFFF */ addiu $v1, $v1, -1 -/* AA42D4 8002D134 24590008 */ addiu $t9, $v0, 8 -/* AA42D8 8002D138 AD1902B0 */ sw $t9, 0x2b0($t0) -/* AA42DC 8002D13C AC580000 */ sw $t8, ($v0) -/* AA42E0 8002D140 8FAE00B0 */ lw $t6, 0xb0($sp) -/* AA42E4 8002D144 8D6F0000 */ lw $t7, ($t3) -/* AA42E8 8002D148 000D68C3 */ sra $t5, $t5, 3 -/* AA42EC 8002D14C 31AD01FF */ andi $t5, $t5, 0x1ff -/* AA42F0 8002D150 01EEC821 */ addu $t9, $t7, $t6 -/* AA42F4 8002D154 AC590004 */ sw $t9, 4($v0) -/* AA42F8 8002D158 8D0202B0 */ lw $v0, 0x2b0($t0) -/* AA42FC 8002D15C 3C0E0700 */ lui $t6, 0x700 -/* AA4300 8002D160 3C0FF570 */ lui $t7, 0xf570 -/* AA4304 8002D164 24580008 */ addiu $t8, $v0, 8 -/* AA4308 8002D168 AD1802B0 */ sw $t8, 0x2b0($t0) -/* AA430C 8002D16C AC4E0004 */ sw $t6, 4($v0) -/* AA4310 8002D170 AC4F0000 */ sw $t7, ($v0) -/* AA4314 8002D174 8D0202B0 */ lw $v0, 0x2b0($t0) -/* AA4318 8002D178 3C18E600 */ lui $t8, 0xe600 -/* AA431C 8002D17C 3C0EF300 */ lui $t6, 0xf300 -/* AA4320 8002D180 24590008 */ addiu $t9, $v0, 8 -/* AA4324 8002D184 AD1902B0 */ sw $t9, 0x2b0($t0) -/* AA4328 8002D188 AC400004 */ sw $zero, 4($v0) -/* AA432C 8002D18C AC580000 */ sw $t8, ($v0) -/* AA4330 8002D190 8D0602B0 */ lw $a2, 0x2b0($t0) -/* AA4334 8002D194 286107FF */ slti $at, $v1, 0x7ff -/* AA4338 8002D198 000D6A40 */ sll $t5, $t5, 9 -/* AA433C 8002D19C 24CF0008 */ addiu $t7, $a2, 8 -/* AA4340 8002D1A0 AD0F02B0 */ sw $t7, 0x2b0($t0) -/* AA4344 8002D1A4 10200003 */ beqz $at, .L8002D1B4 -/* AA4348 8002D1A8 ACCE0000 */ sw $t6, ($a2) -/* AA434C 8002D1AC 10000002 */ b .L8002D1B8 -/* AA4350 8002D1B0 00602025 */ move $a0, $v1 -.L8002D1B4: -/* AA4354 8002D1B4 240407FF */ li $a0, 2047 -.L8002D1B8: -/* AA4358 8002D1B8 04E10003 */ bgez $a3, .L8002D1C8 -/* AA435C 8002D1BC 000728C3 */ sra $a1, $a3, 3 -/* AA4360 8002D1C0 24E10007 */ addiu $at, $a3, 7 -/* AA4364 8002D1C4 000128C3 */ sra $a1, $at, 3 -.L8002D1C8: -/* AA4368 8002D1C8 1CA00003 */ bgtz $a1, .L8002D1D8 -/* AA436C 8002D1CC 2547FFFF */ addiu $a3, $t2, -1 -/* AA4370 8002D1D0 10000002 */ b .L8002D1DC -/* AA4374 8002D1D4 24030001 */ li $v1, 1 -.L8002D1D8: -/* AA4378 8002D1D8 00A01825 */ move $v1, $a1 -.L8002D1DC: -/* AA437C 8002D1DC 1CA00003 */ bgtz $a1, .L8002D1EC -/* AA4380 8002D1E0 247907FF */ addiu $t9, $v1, 0x7ff -/* AA4384 8002D1E4 10000002 */ b .L8002D1F0 -/* AA4388 8002D1E8 24020001 */ li $v0, 1 -.L8002D1EC: -/* AA438C 8002D1EC 00A01025 */ move $v0, $a1 -.L8002D1F0: -/* AA4390 8002D1F0 0322001A */ div $zero, $t9, $v0 -/* AA4394 8002D1F4 14400002 */ bnez $v0, .L8002D200 -/* AA4398 8002D1F8 00000000 */ nop -/* AA439C 8002D1FC 0007000D */ break 7 -.L8002D200: -/* AA43A0 8002D200 2401FFFF */ li $at, -1 -/* AA43A4 8002D204 14410004 */ bne $v0, $at, .L8002D218 -/* AA43A8 8002D208 3C018000 */ lui $at, 0x8000 -/* AA43AC 8002D20C 17210002 */ bne $t9, $at, .L8002D218 -/* AA43B0 8002D210 00000000 */ nop -/* AA43B4 8002D214 0006000D */ break 6 -.L8002D218: -/* AA43B8 8002D218 0000C012 */ mflo $t8 -/* AA43BC 8002D21C 330F0FFF */ andi $t7, $t8, 0xfff -/* AA43C0 8002D220 3C010700 */ lui $at, 0x700 -/* AA43C4 8002D224 30990FFF */ andi $t9, $a0, 0xfff -/* AA43C8 8002D228 0019C300 */ sll $t8, $t9, 0xc -/* AA43CC 8002D22C 01E17025 */ or $t6, $t7, $at -/* AA43D0 8002D230 01D87825 */ or $t7, $t6, $t8 -/* AA43D4 8002D234 ACCF0004 */ sw $t7, 4($a2) -/* AA43D8 8002D238 8D0202B0 */ lw $v0, 0x2b0($t0) -/* AA43DC 8002D23C 3C0EE700 */ lui $t6, 0xe700 -/* AA43E0 8002D240 3C01F568 */ lui $at, 0xf568 -/* AA43E4 8002D244 24590008 */ addiu $t9, $v0, 8 -/* AA43E8 8002D248 AD1902B0 */ sw $t9, 0x2b0($t0) -/* AA43EC 8002D24C AC400004 */ sw $zero, 4($v0) -/* AA43F0 8002D250 AC4E0000 */ sw $t6, ($v0) -/* AA43F4 8002D254 8D0202B0 */ lw $v0, 0x2b0($t0) -/* AA43F8 8002D258 01A16825 */ or $t5, $t5, $at -/* AA43FC 8002D25C 252EFFFF */ addiu $t6, $t1, -1 -/* AA4400 8002D260 24580008 */ addiu $t8, $v0, 8 -/* AA4404 8002D264 AD1802B0 */ sw $t8, 0x2b0($t0) -/* AA4408 8002D268 AC400004 */ sw $zero, 4($v0) -/* AA440C 8002D26C AC4D0000 */ sw $t5, ($v0) -/* AA4410 8002D270 8D0202B0 */ lw $v0, 0x2b0($t0) -/* AA4414 8002D274 00073880 */ sll $a3, $a3, 2 -/* AA4418 8002D278 30E70FFF */ andi $a3, $a3, 0xfff -/* AA441C 8002D27C 244F0008 */ addiu $t7, $v0, 8 -/* AA4420 8002D280 AD0F02B0 */ sw $t7, 0x2b0($t0) -/* AA4424 8002D284 000EC080 */ sll $t8, $t6, 2 -/* AA4428 8002D288 3C19F200 */ lui $t9, 0xf200 -/* AA442C 8002D28C 330F0FFF */ andi $t7, $t8, 0xfff -/* AA4430 8002D290 00073B00 */ sll $a3, $a3, 0xc -/* AA4434 8002D294 AC590000 */ sw $t9, ($v0) -/* AA4438 8002D298 00EFC825 */ or $t9, $a3, $t7 -/* AA443C 8002D29C AC590004 */ sw $t9, 4($v0) -/* AA4440 8002D2A0 8D0202B0 */ lw $v0, 0x2b0($t0) -/* AA4444 8002D2A4 8FA600C0 */ lw $a2, 0xc0($sp) -/* AA4448 8002D2A8 2599FFFF */ addiu $t9, $t4, -1 -/* AA444C 8002D2AC 244E0008 */ addiu $t6, $v0, 8 -/* AA4450 8002D2B0 AD0E02B0 */ sw $t6, 0x2b0($t0) -/* AA4454 8002D2B4 8FB80038 */ lw $t8, 0x38($sp) -/* AA4458 8002D2B8 3C01E400 */ lui $at, 0xe400 -/* AA445C 8002D2BC 332E0FFF */ andi $t6, $t9, 0xfff -/* AA4460 8002D2C0 00187840 */ sll $t7, $t8, 1 -/* AA4464 8002D2C4 01E62021 */ addu $a0, $t7, $a2 -/* AA4468 8002D2C8 2484FFFC */ addiu $a0, $a0, -4 -/* AA446C 8002D2CC 30840FFF */ andi $a0, $a0, 0xfff -/* AA4470 8002D2D0 00042300 */ sll $a0, $a0, 0xc -/* AA4474 8002D2D4 00812025 */ or $a0, $a0, $at -/* AA4478 8002D2D8 008EC025 */ or $t8, $a0, $t6 -/* AA447C 8002D2DC AC580000 */ sw $t8, ($v0) -/* AA4480 8002D2E0 8FAF00B8 */ lw $t7, 0xb8($sp) -/* AA4484 8002D2E4 30DF0FFF */ andi $ra, $a2, 0xfff -/* AA4488 8002D2E8 001FFB00 */ sll $ra, $ra, 0xc -/* AA448C 8002D2EC 31F90FFF */ andi $t9, $t7, 0xfff -/* AA4490 8002D2F0 03F97025 */ or $t6, $ra, $t9 -/* AA4494 8002D2F4 AC4E0004 */ sw $t6, 4($v0) -/* AA4498 8002D2F8 AFA4001C */ sw $a0, 0x1c($sp) -/* AA449C 8002D2FC 8D0202B0 */ lw $v0, 0x2b0($t0) -/* AA44A0 8002D300 3C0CE100 */ lui $t4, 0xe100 -/* AA44A4 8002D304 3C0E0400 */ lui $t6, (0x04000400 >> 16) # lui $t6, 0x400 -/* AA44A8 8002D308 24580008 */ addiu $t8, $v0, 8 -/* AA44AC 8002D30C AD1802B0 */ sw $t8, 0x2b0($t0) -/* AA44B0 8002D310 AC400004 */ sw $zero, 4($v0) -/* AA44B4 8002D314 AC4C0000 */ sw $t4, ($v0) -/* AA44B8 8002D318 8D0202B0 */ lw $v0, 0x2b0($t0) -/* AA44BC 8002D31C 35CE0400 */ ori $t6, (0x04000400 & 0xFFFF) # ori $t6, $t6, 0x400 -/* AA44C0 8002D320 3C19F100 */ lui $t9, 0xf100 -/* AA44C4 8002D324 244F0008 */ addiu $t7, $v0, 8 -/* AA44C8 8002D328 AD0F02B0 */ sw $t7, 0x2b0($t0) -/* AA44CC 8002D32C AC4E0004 */ sw $t6, 4($v0) -/* AA44D0 8002D330 AC590000 */ sw $t9, ($v0) -/* AA44D4 8002D334 91780009 */ lbu $t8, 9($t3) -/* AA44D8 8002D338 00401825 */ move $v1, $v0 -/* AA44DC 8002D33C 03094823 */ subu $t1, $t8, $t1 -/* AA44E0 8002D340 59200074 */ blezl $t1, .L8002D514 -/* AA44E4 8002D344 8FB800D0 */ lw $t8, 0xd0($sp) -/* AA44E8 8002D348 8D0202B0 */ lw $v0, 0x2b0($t0) -/* AA44EC 8002D34C 3C19FD70 */ lui $t9, 0xfd70 -/* AA44F0 8002D350 01490019 */ multu $t2, $t1 -/* AA44F4 8002D354 244F0008 */ addiu $t7, $v0, 8 -/* AA44F8 8002D358 AD0F02B0 */ sw $t7, 0x2b0($t0) -/* AA44FC 8002D35C AC590000 */ sw $t9, ($v0) -/* AA4500 8002D360 8FB800B0 */ lw $t8, 0xb0($sp) -/* AA4504 8002D364 8D6E0000 */ lw $t6, ($t3) -/* AA4508 8002D368 240407FF */ li $a0, 2047 -/* AA450C 8002D36C 01D87821 */ addu $t7, $t6, $t8 -/* AA4510 8002D370 25F91000 */ addiu $t9, $t7, 0x1000 -/* AA4514 8002D374 AC590004 */ sw $t9, 4($v0) -/* AA4518 8002D378 8D0202B0 */ lw $v0, 0x2b0($t0) -/* AA451C 8002D37C 3C0F0700 */ lui $t7, 0x700 -/* AA4520 8002D380 3C18F570 */ lui $t8, 0xf570 -/* AA4524 8002D384 244E0008 */ addiu $t6, $v0, 8 -/* AA4528 8002D388 AD0E02B0 */ sw $t6, 0x2b0($t0) -/* AA452C 8002D38C AC4F0004 */ sw $t7, 4($v0) -/* AA4530 8002D390 AC580000 */ sw $t8, ($v0) -/* AA4534 8002D394 8D0202B0 */ lw $v0, 0x2b0($t0) -/* AA4538 8002D398 3C0EE600 */ lui $t6, 0xe600 -/* AA453C 8002D39C 00001812 */ mflo $v1 -/* AA4540 8002D3A0 24590008 */ addiu $t9, $v0, 8 -/* AA4544 8002D3A4 AD1902B0 */ sw $t9, 0x2b0($t0) -/* AA4548 8002D3A8 AC400004 */ sw $zero, 4($v0) -/* AA454C 8002D3AC AC4E0000 */ sw $t6, ($v0) -/* AA4550 8002D3B0 8D0602B0 */ lw $a2, 0x2b0($t0) -/* AA4554 8002D3B4 24630001 */ addiu $v1, $v1, 1 -/* AA4558 8002D3B8 00031843 */ sra $v1, $v1, 1 -/* AA455C 8002D3BC 2463FFFF */ addiu $v1, $v1, -1 -/* AA4560 8002D3C0 24D80008 */ addiu $t8, $a2, 8 -/* AA4564 8002D3C4 AD1802B0 */ sw $t8, 0x2b0($t0) -/* AA4568 8002D3C8 286107FF */ slti $at, $v1, 0x7ff -/* AA456C 8002D3CC 3C0FF300 */ lui $t7, 0xf300 -/* AA4570 8002D3D0 10200003 */ beqz $at, .L8002D3E0 -/* AA4574 8002D3D4 ACCF0000 */ sw $t7, ($a2) -/* AA4578 8002D3D8 10000001 */ b .L8002D3E0 -/* AA457C 8002D3DC 00602025 */ move $a0, $v1 -.L8002D3E0: -/* AA4580 8002D3E0 1CA00003 */ bgtz $a1, .L8002D3F0 -/* AA4584 8002D3E4 00A01825 */ move $v1, $a1 -/* AA4588 8002D3E8 10000001 */ b .L8002D3F0 -/* AA458C 8002D3EC 24030001 */ li $v1, 1 -.L8002D3F0: -/* AA4590 8002D3F0 1CA00003 */ bgtz $a1, .L8002D400 -/* AA4594 8002D3F4 247907FF */ addiu $t9, $v1, 0x7ff -/* AA4598 8002D3F8 10000002 */ b .L8002D404 -/* AA459C 8002D3FC 24020001 */ li $v0, 1 -.L8002D400: -/* AA45A0 8002D400 00A01025 */ move $v0, $a1 -.L8002D404: -/* AA45A4 8002D404 0322001A */ div $zero, $t9, $v0 -/* AA45A8 8002D408 14400002 */ bnez $v0, .L8002D414 -/* AA45AC 8002D40C 00000000 */ nop -/* AA45B0 8002D410 0007000D */ break 7 -.L8002D414: -/* AA45B4 8002D414 2401FFFF */ li $at, -1 -/* AA45B8 8002D418 14410004 */ bne $v0, $at, .L8002D42C -/* AA45BC 8002D41C 3C018000 */ lui $at, 0x8000 -/* AA45C0 8002D420 17210002 */ bne $t9, $at, .L8002D42C -/* AA45C4 8002D424 00000000 */ nop -/* AA45C8 8002D428 0006000D */ break 6 -.L8002D42C: -/* AA45CC 8002D42C 00007012 */ mflo $t6 -/* AA45D0 8002D430 31D80FFF */ andi $t8, $t6, 0xfff -/* AA45D4 8002D434 3C010700 */ lui $at, 0x700 -/* AA45D8 8002D438 30990FFF */ andi $t9, $a0, 0xfff -/* AA45DC 8002D43C 00197300 */ sll $t6, $t9, 0xc -/* AA45E0 8002D440 03017825 */ or $t7, $t8, $at -/* AA45E4 8002D444 01EEC025 */ or $t8, $t7, $t6 -/* AA45E8 8002D448 ACD80004 */ sw $t8, 4($a2) -/* AA45EC 8002D44C 8D0202B0 */ lw $v0, 0x2b0($t0) -/* AA45F0 8002D450 3C0FE700 */ lui $t7, 0xe700 -/* AA45F4 8002D454 24590008 */ addiu $t9, $v0, 8 -/* AA45F8 8002D458 AD1902B0 */ sw $t9, 0x2b0($t0) -/* AA45FC 8002D45C AC400004 */ sw $zero, 4($v0) -/* AA4600 8002D460 AC4F0000 */ sw $t7, ($v0) -/* AA4604 8002D464 8D0202B0 */ lw $v0, 0x2b0($t0) -/* AA4608 8002D468 252FFFFF */ addiu $t7, $t1, -1 -/* AA460C 8002D46C 3C19F200 */ lui $t9, 0xf200 -/* AA4610 8002D470 244E0008 */ addiu $t6, $v0, 8 -/* AA4614 8002D474 AD0E02B0 */ sw $t6, 0x2b0($t0) -/* AA4618 8002D478 AC400004 */ sw $zero, 4($v0) -/* AA461C 8002D47C AC4D0000 */ sw $t5, ($v0) -/* AA4620 8002D480 8D0202B0 */ lw $v0, 0x2b0($t0) -/* AA4624 8002D484 000F7080 */ sll $t6, $t7, 2 -/* AA4628 8002D488 24580008 */ addiu $t8, $v0, 8 -/* AA462C 8002D48C AD1802B0 */ sw $t8, 0x2b0($t0) -/* AA4630 8002D490 31D80FFF */ andi $t8, $t6, 0xfff -/* AA4634 8002D494 AC590000 */ sw $t9, ($v0) -/* AA4638 8002D498 00F8C825 */ or $t9, $a3, $t8 -/* AA463C 8002D49C AC590004 */ sw $t9, 4($v0) -/* AA4640 8002D4A0 8D0202B0 */ lw $v0, 0x2b0($t0) -/* AA4644 8002D4A4 8FA400B4 */ lw $a0, 0xb4($sp) -/* AA4648 8002D4A8 0009C080 */ sll $t8, $t1, 2 -/* AA464C 8002D4AC 244F0008 */ addiu $t7, $v0, 8 -/* AA4650 8002D4B0 AD0F02B0 */ sw $t7, 0x2b0($t0) -/* AA4654 8002D4B4 0098C821 */ addu $t9, $a0, $t8 -/* AA4658 8002D4B8 8FAE001C */ lw $t6, 0x1c($sp) -/* AA465C 8002D4BC 272FFFFF */ addiu $t7, $t9, -1 -/* AA4660 8002D4C0 31F80FFF */ andi $t8, $t7, 0xfff -/* AA4664 8002D4C4 308F0FFF */ andi $t7, $a0, 0xfff -/* AA4668 8002D4C8 01D8C825 */ or $t9, $t6, $t8 -/* AA466C 8002D4CC 03EF7025 */ or $t6, $ra, $t7 -/* AA4670 8002D4D0 AC4E0004 */ sw $t6, 4($v0) -/* AA4674 8002D4D4 AC590000 */ sw $t9, ($v0) -/* AA4678 8002D4D8 8D0202B0 */ lw $v0, 0x2b0($t0) -/* AA467C 8002D4DC 3C0E0400 */ lui $t6, (0x04000400 >> 16) # lui $t6, 0x400 -/* AA4680 8002D4E0 35CE0400 */ ori $t6, (0x04000400 & 0xFFFF) # ori $t6, $t6, 0x400 -/* AA4684 8002D4E4 24580008 */ addiu $t8, $v0, 8 -/* AA4688 8002D4E8 AD1802B0 */ sw $t8, 0x2b0($t0) -/* AA468C 8002D4EC AC400004 */ sw $zero, 4($v0) -/* AA4690 8002D4F0 AC4C0000 */ sw $t4, ($v0) -/* AA4694 8002D4F4 8D0202B0 */ lw $v0, 0x2b0($t0) -/* AA4698 8002D4F8 3C0FF100 */ lui $t7, 0xf100 -/* AA469C 8002D4FC 24590008 */ addiu $t9, $v0, 8 -/* AA46A0 8002D500 AD1902B0 */ sw $t9, 0x2b0($t0) -/* AA46A4 8002D504 AC4E0004 */ sw $t6, 4($v0) -/* AA46A8 8002D508 AC4F0000 */ sw $t7, ($v0) -/* AA46AC 8002D50C 00401825 */ move $v1, $v0 -/* AA46B0 8002D510 8FB800D0 */ lw $t8, 0xd0($sp) -.L8002D514: -/* AA46B4 8002D514 3C068013 */ lui $a2, %hi(D_80136170) # $a2, 0x8013 -/* AA46B8 8002D518 24C66170 */ addiu $a2, %lo(D_80136170) # addiu $a2, $a2, 0x6170 -/* AA46BC 8002D51C 27A4009C */ addiu $a0, $sp, 0x9c -/* AA46C0 8002D520 24070B40 */ li $a3, 2880 -/* AA46C4 8002D524 0C031AD5 */ jal func_800C6B54 -/* AA46C8 8002D528 8F050000 */ lw $a1, ($t8) -/* AA46CC 8002D52C 8FBF0014 */ lw $ra, 0x14($sp) -.L8002D530: -/* AA46D0 8002D530 27BD00D0 */ addiu $sp, $sp, 0xd0 -/* AA46D4 8002D534 03E00008 */ jr $ra -/* AA46D8 8002D538 00000000 */ nop - diff --git a/asm/non_matchings/code/z_debug/func_8006376C.s b/asm/non_matchings/code/z_debug/func_8006376C.s deleted file mode 100644 index d8645d0e1a..0000000000 --- a/asm/non_matchings/code/z_debug/func_8006376C.s +++ /dev/null @@ -1,52 +0,0 @@ -glabel func_8006376C -/* ADA90C 8006376C 3C098012 */ lui $t1, %hi(D_8011E0B0) # $t1, 0x8012 -/* ADA910 80063770 2529E0B0 */ addiu $t1, %lo(D_8011E0B0) # addiu $t1, $t1, -0x1f50 -/* ADA914 80063774 85230000 */ lh $v1, ($t1) -/* ADA918 80063778 27BDFFF8 */ addiu $sp, $sp, -8 -/* ADA91C 8006377C 3C0F8016 */ lui $t7, %hi(D_8015FA98) # $t7, 0x8016 -/* ADA920 80063780 00037080 */ sll $t6, $v1, 2 -/* ADA924 80063784 01C37023 */ subu $t6, $t6, $v1 -/* ADA928 80063788 AFB00004 */ sw $s0, 4($sp) -/* ADA92C 8006378C AFA40008 */ sw $a0, 8($sp) -/* ADA930 80063790 AFA5000C */ sw $a1, 0xc($sp) -/* ADA934 80063794 AFA60010 */ sw $a2, 0x10($sp) -/* ADA938 80063798 000E70C0 */ sll $t6, $t6, 3 -/* ADA93C 8006379C 25EFFA98 */ addiu $t7, %lo(D_8015FA98) # addiu $t7, $t7, -0x568 -/* ADA940 800637A0 28610016 */ slti $at, $v1, 0x16 -/* ADA944 800637A4 30C600FF */ andi $a2, $a2, 0xff -/* ADA948 800637A8 30A500FF */ andi $a1, $a1, 0xff -/* ADA94C 800637AC 308400FF */ andi $a0, $a0, 0xff -/* ADA950 800637B0 00E08025 */ move $s0, $a3 -/* ADA954 800637B4 10200019 */ beqz $at, .L8006381C -/* ADA958 800637B8 01CF1021 */ addu $v0, $t6, $t7 -/* ADA95C 800637BC A0440000 */ sb $a0, ($v0) -/* ADA960 800637C0 A0450001 */ sb $a1, 1($v0) -/* ADA964 800637C4 A0460002 */ sb $a2, 2($v0) -/* ADA968 800637C8 90E70000 */ lbu $a3, ($a3) -/* ADA96C 800637CC 00001825 */ move $v1, $zero -/* ADA970 800637D0 24480004 */ addiu $t0, $v0, 4 -/* ADA974 800637D4 26100001 */ addiu $s0, $s0, 1 -/* ADA978 800637D8 10E0000C */ beqz $a3, .L8006380C -/* ADA97C 800637DC A0470003 */ sb $a3, 3($v0) -.L800637E0: -/* ADA980 800637E0 28620015 */ slti $v0, $v1, 0x15 -/* ADA984 800637E4 24630001 */ addiu $v1, $v1, 1 -/* ADA988 800637E8 00031C00 */ sll $v1, $v1, 0x10 -/* ADA98C 800637EC 38420001 */ xori $v0, $v0, 1 -/* ADA990 800637F0 14400006 */ bnez $v0, .L8006380C -/* ADA994 800637F4 00031C03 */ sra $v1, $v1, 0x10 -/* ADA998 800637F8 92070000 */ lbu $a3, ($s0) -/* ADA99C 800637FC 25080001 */ addiu $t0, $t0, 1 -/* ADA9A0 80063800 26100001 */ addiu $s0, $s0, 1 -/* ADA9A4 80063804 14E0FFF6 */ bnez $a3, .L800637E0 -/* ADA9A8 80063808 A107FFFF */ sb $a3, -1($t0) -.L8006380C: -/* ADA9AC 8006380C A1000000 */ sb $zero, ($t0) -/* ADA9B0 80063810 85380000 */ lh $t8, ($t1) -/* ADA9B4 80063814 27190001 */ addiu $t9, $t8, 1 -/* ADA9B8 80063818 A5390000 */ sh $t9, ($t1) -.L8006381C: -/* ADA9BC 8006381C 8FB00004 */ lw $s0, 4($sp) -/* ADA9C0 80063820 03E00008 */ jr $ra -/* ADA9C4 80063824 27BD0008 */ addiu $sp, $sp, 8 - diff --git a/include/z64actor.h b/include/z64actor.h index 4b986b4d6e..9a18e6d5c4 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -144,8 +144,7 @@ typedef struct Actor { /* 0x094 */ f32 yDistanceFromLink; /* 0x098 */ SubActorStruct98 sub_98; /* 0x0B4 */ ActorShape shape; - /* 0x0CC */ Vec3f unk_CC; // Used in Link, not Deku Babas - /* 0x0D8 */ Vec3f unk_D8; // Used in Link, not Deku Babas + /* 0x0CC */ Vec3f unk_CC[2]; /* 0x0E4 */ Vec3f unk_E4; // Stores result of some vector transformation involving actor xyz vector, and a matrix at Global Context + 11D60 /* 0x0F0 */ f32 unk_F0; // Related to above /* 0x0F4 */ f32 unk_F4; diff --git a/src/code/fault_drawer.c b/src/code/fault_drawer.c index 8d85af18b3..b17679d355 100644 --- a/src/code/fault_drawer.c +++ b/src/code/fault_drawer.c @@ -65,38 +65,51 @@ void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled) { sFaultDrawerStruct.osSyncPrintfEnabled = enabled; } -#ifdef NON_MATCHING -void FaultDrawer_DrawRecImpl(s32 xstart, s32 ystart, s32 xend, s32 yend, u16 color) { - if (sFaultDrawerStruct.w - xstart > 0 && sFaultDrawerStruct.h - ystart > 0) { - s32 x, y; +void FaultDrawer_DrawRecImpl(s32 xStart, s32 yStart, s32 xEnd, s32 yEnd, u16 color) { + u16* fb; + s32 x, y; + s32 xDiff = sFaultDrawerStruct.w - xStart; + s32 yDiff = sFaultDrawerStruct.h - yStart; + s32 xSize = xEnd - xStart + 1; + s32 ySize = yEnd - yStart + 1; - for (y = 0; y <= yend - ystart; y++) - for (x = 0; x <= xend - xstart; x++) - sFaultDrawerStruct.fb[sFaultDrawerStruct.w * y + x] = color; + if (xDiff > 0 && yDiff > 0) { + if (xDiff < xSize) { + xSize = xDiff; + } + + if (yDiff < ySize) { + ySize = yDiff; + } + + fb = sFaultDrawerStruct.fb + sFaultDrawerStruct.w * yStart + xStart; + for (y = 0; y < ySize; y++) { + for (x = 0; x < xSize; x++) { + *fb++ = color; + } + fb += sFaultDrawerStruct.w - xSize; + } osWritebackDCacheAll(); } } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/fault_drawer/FaultDrawer_DrawRecImpl.s") -#endif #ifdef NON_MATCHING // regalloc and minor ordering differences void FaultDrawer_DrawChar(char c) { + u16* fb; s32 x, y; u32* dataPtr; - u16* fb; + s32 cursorX = sFaultDrawerStruct.cursorX; + s32 cursorY = sFaultDrawerStruct.cursorY; dataPtr = &sFaultDrawerStruct.fontData[((c & 4) >> 2) + ((c / 8) * 16)]; + fb = sFaultDrawerStruct.fb + sFaultDrawerStruct.w * cursorY + cursorX; - fb = &sFaultDrawerStruct.fb[sFaultDrawerStruct.cursorY * sFaultDrawerStruct.w]; - fb = &fb[sFaultDrawerStruct.cursorX]; - - if ((sFaultDrawerStruct.xStart <= sFaultDrawerStruct.cursorX) && - ((sFaultDrawerStruct.charW + sFaultDrawerStruct.cursorX - 1) <= sFaultDrawerStruct.xEnd) && - (sFaultDrawerStruct.yStart <= sFaultDrawerStruct.cursorY) && - ((sFaultDrawerStruct.charH + sFaultDrawerStruct.cursorY - 1) <= sFaultDrawerStruct.yEnd)) { + if ((sFaultDrawerStruct.xStart <= cursorX) && + ((sFaultDrawerStruct.charW + cursorX - 1) <= sFaultDrawerStruct.xEnd) && + (sFaultDrawerStruct.yStart <= cursorY) && + ((sFaultDrawerStruct.charH + cursorY - 1) <= sFaultDrawerStruct.yEnd)) { for (y = 0; y < sFaultDrawerStruct.charH; y++) { u32 mask = 0x10000000 << (c % 4); u32 data = *dataPtr; @@ -152,7 +165,7 @@ void FaultDrawer_SetBackColor(u16 color) { } void FaultDrawer_SetFontColor(u16 color) { - FaultDrawer_SetForeColor((u16)(color | 1)); // force alpha to be set + FaultDrawer_SetForeColor(color | 1); // force alpha to be set } void FaultDrawer_SetCharPad(s8 padW, s8 padH) { @@ -260,7 +273,7 @@ void FaultDrawer_DrawText(s32 x, s32 y, const char* fmt, ...) { } void FaultDrawer_SetDrawerFB(void* fb, u16 w, u16 h) { - sFaultDrawerStruct.fb = (u16*)fb; + sFaultDrawerStruct.fb = fb; sFaultDrawerStruct.w = w; sFaultDrawerStruct.h = h; } diff --git a/src/code/z_actor.c b/src/code/z_actor.c index be598da4a1..5fa59e19bc 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -96,14 +96,14 @@ void func_8002B66C(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3, } #ifdef NON_MATCHING -// this function still needs a lot of work +// saved register, stack usage and minor ordering differences void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx) { GraphicsContext* gfxCtx; MtxF spE8; - Vec2f spE0; - s32 index; + f32 spE0[2]; + s32 i; f32* spAC; - Gfx* gfxArr[7]; + Gfx* gfxArr[4]; f32 temp_10; u8 temp_14; f32 temp_f0; @@ -124,8 +124,8 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa if (temp_f20 > 20.0f) { temp_10 = actor->shape.unk_10; - actor->shape.unk_10 *= 0.3f; temp_14 = actor->shape.unk_14; + actor->shape.unk_10 *= 0.3f; actor->shape.unk_14 *= ((temp_f20 - 20.0f) * 0.02f) > 1.0f ? 1.0f : ((temp_f20 - 20.0f) * 0.02f); ActorShadow_DrawFunc_Circle(actor, lightMapper, globalCtx); actor->shape.unk_10 = temp_10; @@ -133,18 +133,18 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa } if (temp_f20 < 200.0f) { - spAC = &spE0.x; - gfxCtx = globalCtx->state.gfxCtx; - temp_s6 = lightMapper->numLights - 2; + phi_s7 = &actor->unk_CC[0]; + spAC = &spE0[0]; + temp_s6 = lightMapper->numLights; + temp_s6 -= 2; + gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 1741); gfxCtx->polyOpa.p = func_80093774(gfxCtx->polyOpa.p, 0x2C); actor->shape.unk_15 = 0; - phi_s7 = &actor->unk_CC; - - for (index = 0; index < 2; index++) { + for (i = 0; i < 2; i++) { phi_s7->y += 50.0f; *spAC = func_800BFCB8(globalCtx, &spE8, phi_s7); phi_s7->y -= 50.0f; @@ -162,12 +162,12 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa if (30.0f < phi_f2) phi_f2 = 30.0f; - temp_f24 = actor->shape.unk_14 * (1.0f - (phi_f2 * (1.f / 30))); + temp_f24 = actor->shape.unk_14 * (1.0f - (phi_f2 * (1.0f / 30))); if (30.0f < phi_f2) phi_f2 = 30.0f; - temp_f20_2 = 1.0f - (phi_f2 * (1.f / 70)); + temp_f20_2 = 1.0f - (phi_f2 * (1.0f / 70)); temp_f22_2 = (actor->shape.unk_10 * temp_f20_2) * actor->scale.x; phi_s2 = 0; @@ -198,14 +198,11 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa phi_s7++; } - if (!(actor->bgCheckFlags & 1)) + if (!(actor->bgCheckFlags & 1)) { actor->shape.unk_15 = 0; - else if (actor->shape.unk_15 == 3) { - temp_f0 = actor->unk_CC.y - actor->unk_D8.y; - if ((spE0.x + temp_f0) < (spE0.y - temp_f0)) - actor->shape.unk_15 = 2; - else - actor->shape.unk_15 = 1; + } else if (actor->shape.unk_15 == 3) { + temp_f0 = actor->unk_CC[0].y - actor->unk_CC[1].y; + actor->shape.unk_15 = ((spE0[0] + temp_f0) < (spE0[1] - temp_f0)) ? 2 : 1; } func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 1831); @@ -217,9 +214,9 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa void func_8002BDB0(Actor* actor, s32 arg1, s32 arg2, UNK_PTR arg3, s32 arg4, UNK_PTR arg5) { if (arg1 == arg2) { - Matrix_MultVec3f(arg3, &actor->unk_CC); + Matrix_MultVec3f(arg3, &actor->unk_CC[0]); } else if (arg1 == arg4) { - Matrix_MultVec3f(arg5, &actor->unk_D8); + Matrix_MultVec3f(arg5, &actor->unk_CC[1]); } } @@ -310,25 +307,25 @@ void func_8002C0C0(TargetContext* targetCtx, Actor* actor, GlobalContext* global } #ifdef NON_MATCHING -// this function still needs some work +// regalloc and minor ordering differences void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { Actor* actor; Player* player; GraphicsContext* gfxCtx; - Gfx* gfxArr[5]; + Gfx* gfxArr[4]; + TargetContextEntry* entry; s16 spCE; + f32 temp1; Vec3f spBC; s32 spB8; f32 spB4; s32 spB0; s32 spAC; - s32 i; - TargetContextEntry* entry; - f32 temp1; f32 var1; f32 var2; - Vec3f* vec; + s32 i; + actor = targetCtx->targetedActor; gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 2029); @@ -343,11 +340,11 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { else spB8 = 3; - if (targetCtx->targetedActor != NULL) { - Math_Vec3f_Copy(&targetCtx->targetCenterPos, &targetCtx->targetedActor->posRot2.pos); + if (actor != NULL) { + Math_Vec3f_Copy(&targetCtx->targetCenterPos, &actor->posRot2.pos); var1 = (500.0f - targetCtx->unk_44) / 420.0f; } else { - targetCtx->unk_48 -= 0x78; + targetCtx->unk_48 -= 120; if (targetCtx->unk_48 < 0) targetCtx->unk_48 = 0; spCE = targetCtx->unk_48; @@ -355,13 +352,13 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { func_8002BE04(globalCtx, &targetCtx->targetCenterPos, &spBC, &spB4); - temp1 = ((spBC.x * spB4) * 160.0f) * var1; - spBC.x = (temp1 < -320.0f) ? -320.0f : ((temp1 > 320.0f) ? 320.0f : temp1); + temp1 = ((spBC.x * spB4) * 160) * var1; + spBC.x = (temp1 < -320) ? -320 : ((temp1 > 320) ? 320 : temp1); - temp1 = ((spBC.y * spB4) * 120.0f) * var1; - spBC.y = (temp1 < -240.0f) ? -240.0f : ((temp1 > 240.0f) ? 240.0f : temp1); + temp1 = ((spBC.y * spB4) * 120) * var1; + spBC.y = (temp1 < -240) ? -240 : ((temp1 > 240) ? 240 : temp1); - spBC.z *= var1; + spBC.z = spBC.z * var1; targetCtx->unk_4C--; if (targetCtx->unk_4C < 0) @@ -369,7 +366,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { func_8002BE64(targetCtx, targetCtx->unk_4C, spBC.x, spBC.y, spBC.z); - if ((!(player->stateFlags1 & 0x40)) || (targetCtx->targetedActor != player->unk_664)) { + if ((!(player->stateFlags1 & 0x40)) || (actor != player->unk_664)) { gfxCtx->overlay.p = func_80093774(gfxCtx->overlay.p, 0x39); for (spB0 = 0, spAC = targetCtx->unk_4C; spB0 < spB8; spB0++) { @@ -720,20 +717,17 @@ void TitleCard_Update(GlobalContext* globalCtx, TitleCardContext* titleCtx) { } } -#ifdef NON_MATCHING -// major ordering and stack usage differences void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) { s32 spCC; s32 spC8; s32 unk1; s32 spC0; - s32 unk2; + s32 sp38; s32 spB8; s32 spB4; s32 spB0; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; - s32 sp38; if (titleCtx->unk_C != 0) { spCC = titleCtx->unk_8; @@ -743,14 +737,13 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) { sp38 = spCC * 2; gfxCtx = globalCtx->state.gfxCtx; - func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 2824); spB0 = spCC * spC8 * gSaveContext.language; - spC8 = (spCC * spC8 > 0x1000) ? 0x1000 / spCC : spC8; + spB4 = spB8 + (spC8 * 4); - spB4 = (spC8 * 4) + spB8; + if (1) {} // Necessary to match gfxCtx->overlay.p = func_80093808(gfxCtx->overlay.p); @@ -761,8 +754,8 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) { G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfxCtx->overlay.p++, spC0, spB8, ((sp38 * 2) + spC0) - 4, spB8 - 1, G_TX_RENDERTILE, 0, 0, - 1024, 1024); + gSPTextureRectangle(gfxCtx->overlay.p++, spC0, spB8, ((sp38 * 2) + spC0) - 4, spB8 + (spC8 * 4) - 1, + G_TX_RENDERTILE, 0, 0, 1024, 1024); spC8 = titleCtx->unk_9 - spC8; @@ -771,16 +764,13 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) { spC8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfxCtx->overlay.p++, spC0, spB4, ((sp38 * 2) + spC0) - 4, spB4 - 1, G_TX_RENDERTILE, 0, - 0, 1024, 1024); + gSPTextureRectangle(gfxCtx->overlay.p++, spC0, spB4, ((sp38 * 2) + spC0) - 4, spB4 + (spC8 * 4) - 1, + G_TX_RENDERTILE, 0, 0, 1024, 1024); } func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 2880); } } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/TitleCard_Draw.s") -#endif s32 func_8002D53C(GlobalContext* globalCtx, TitleCardContext* titleCtx) { if ((globalCtx->actorCtx.titleCtx.delayB != 0) || (globalCtx->actorCtx.titleCtx.unk_C != 0)) { @@ -1802,7 +1792,8 @@ Color_RGB8 D_80116060 = { 0xFF, 0xFF, 0xFF }; Color_RGB8 D_80116064 = { 0x64, 0xC8, 0x00 }; #ifdef NON_MATCHING -// this function still needs a lot of work +// saved register, stack usage and minor ordering differences +// this also doesn't generate a few useless struct copies void func_8002FBAC(GlobalContext* globalCtx) { GraphicsContext* gfxCtx; Gfx* gfxArr[6]; @@ -1810,6 +1801,7 @@ void func_8002FBAC(GlobalContext* globalCtx) { f32 spD8; f32 spD4; s32 spD0; + s32 spCC; f32 spC0; Vec3f spB4; Vec3f spA4; @@ -1839,6 +1831,7 @@ void func_8002FBAC(GlobalContext* globalCtx) { spD4 = 1.0f; temp_a3 = gSaveContext.respawn[RESPAWN_MODE_TOP].data - 0x28; + spCC = temp_a3; if (temp_a3 < 0) { gSaveContext.respawn[RESPAWN_MODE_TOP].data++; @@ -1871,7 +1864,7 @@ void func_8002FBAC(GlobalContext* globalCtx) { temp_f12 = sp9C * 0.5f; temp_f14 = temp_ret - temp_f12; spD8 += sqrtf((temp_f12 * temp_f12) - (temp_f14 * temp_f14)) * 0.2f; - osSyncPrintf("-------- DISPLAY Y=%f\n", (f64)spD8); + osSyncPrintf("-------- DISPLAY Y=%f\n", spD8); } spA4.x = Math_Rand_CenteredFloat(6.0f) + gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x; @@ -1886,6 +1879,7 @@ void func_8002FBAC(GlobalContext* globalCtx) { gSaveContext.respawn[RESPAWN_MODE_TOP].data = 0x28; } + // somehow this shouldn't be optimized out gSaveContext.respawn[RESPAWN_MODE_TOP].pos = gSaveContext.respawn[RESPAWN_MODE_TOP].pos; } else if (temp_a3 > 0) { temp_f12 = temp_a3 * 0.1f; @@ -1914,7 +1908,7 @@ void func_8002FBAC(GlobalContext* globalCtx) { gSaveContext.respawn[RESPAWN_MODE_TOP].data++; } - spD4 = temp_a3 * 0.200000000000000011102230246252 + 1.0f; + spD4 = spCC * 0.200000000000000011102230246252 + 1.0f; } if ((globalCtx->csCtx.state == 0) && @@ -3723,17 +3717,15 @@ struct_80116130 D_80116130[13] = { }; #ifdef NON_MATCHING -// this function still needs a lot of work +// regalloc differences void func_800344BC(Actor* actor, struct_80034A14_arg1* arg1, s16 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, s16 arg7, u8 arg8) { s16 sp46; s16 sp44; - s16 temp1; - s16 sp40; s16 temp2; + s16 sp40; + s16 temp1; Vec3f sp30; - s16 temp3; - s16 temp4; sp30.x = actor->posRot.pos.x; sp30.y = actor->posRot.pos.y + arg1->unk_14; @@ -3741,27 +3733,34 @@ void func_800344BC(Actor* actor, struct_80034A14_arg1* arg1, s16 arg2, s16 arg3, sp46 = Math_Vec3f_Pitch(&sp30, &arg1->unk_18); sp44 = Math_Vec3f_Yaw(&sp30, &arg1->unk_18); + sp40 = Math_Vec3f_Yaw(&actor->posRot.pos, &arg1->unk_18) - actor->shape.rot.y; - temp1 = Math_Vec3f_Yaw(&actor->posRot.pos, &arg1->unk_18) - actor->shape.rot.y; + temp1 = (sp40 < -arg2) ? -arg2 : ((sp40 > arg2) ? arg2 : sp40); + Math_SmoothScaleMaxMinS(&arg1->unk_0A, temp1, 6, 2000, 1); - Math_SmoothScaleMaxMinS(&arg1->unk_0A, (temp1 < -arg2) ? -arg2 : ((temp1 > arg2) ? arg2 : temp1), 6, 2000, 1); + sp40 = (ABS(sp40) >= 0x8000) ? 0 : ((sp40 >= 0) ? sp40 : -sp40); + arg1->unk_0A = ((arg1->unk_0A < -sp40) ? -sp40 : ((arg1->unk_0A > sp40) ? sp40 : arg1->unk_0A)); - temp3 = (ABS(temp1) >= 0x8000) ? 0 : ((temp1 >= 0) ? temp1 : -temp1); - arg1->unk_0A = ((arg1->unk_0A < -temp3) ? -temp3 : ((arg1->unk_0A > temp3) ? temp3 : arg1->unk_0A)); + sp40 = sp40 - arg1->unk_0A; - sp40 = temp1 - arg1->unk_0A; - Math_SmoothScaleMaxMinS(&arg1->unk_10, (sp40 < -arg5) ? -arg5 : ((sp40 > arg5) ? arg5 : sp40), 6, 2000, 1); + temp1 = (sp40 < -arg5) ? -arg5 : ((sp40 > arg5) ? arg5 : sp40); + Math_SmoothScaleMaxMinS(&arg1->unk_10, temp1, 6, 2000, 1); - temp4 = (ABS(sp40) >= 0x8000) ? 0 : ((sp40 >= 0) ? sp40 : -sp40); - arg1->unk_10 = ((arg1->unk_10 < -temp4) ? -temp4 : ((arg1->unk_10 > temp4) ? temp4 : arg1->unk_10)); + sp40 = (ABS(sp40) >= 0x8000) ? 0 : ((sp40 >= 0) ? sp40 : -sp40); + arg1->unk_10 = ((arg1->unk_10 < -sp40) ? -sp40 : ((arg1->unk_10 > sp40) ? sp40 : arg1->unk_10)); - if (arg8 != 0) + if (arg8 != 0) { + if (arg3) {} // Seems necessary to match Math_SmoothScaleMaxMinS(&actor->shape.rot.y, sp44, 6, 2000, 1); + } - Math_SmoothScaleMaxMinS(&arg1->unk_08, (sp46 < arg4) ? arg4 : ((sp46 > arg3) ? arg3 : sp46), 6, 2000, 1); + temp1 = (sp46 < arg4) ? arg4 : ((sp46 > arg3) ? arg3 : sp46); + Math_SmoothScaleMaxMinS(&arg1->unk_08, temp1, 6, 2000, 1); temp2 = sp46 - arg1->unk_08; - Math_SmoothScaleMaxMinS(&arg1->unk_0E, (temp2 < arg7) ? arg4 : ((temp2 > arg6) ? arg3 : temp2), 6, 2000, 1); + + temp1 = (temp2 < arg7) ? arg7 : ((temp2 > arg6) ? arg6 : temp2); + Math_SmoothScaleMaxMinS(&arg1->unk_0E, temp1, 6, 2000, 1); } #else #pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/func_800344BC.s") diff --git a/src/code/z_camera.c b/src/code/z_camera.c index d7b0108d54..9dd358ffcc 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -520,7 +520,7 @@ s32 func_80045B08(Camera* camera, struct_80045714* b, f32 c, s16 d) { return 1; } -#ifdef NON_MATCHING +/* // someone who's not me can have fun with this function s32 func_80045C74(Camera* camera, struct_80045714* b, f32 c, f32* d, s16 arg4) { Vec3f sp70; @@ -593,9 +593,8 @@ s32 func_80045C74(Camera* camera, struct_80045714* b, f32 c, f32* d, s16 arg4) { return 1; } -#else +*/ #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_80045C74.s") -#endif // 421 lines #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800460A8.s") diff --git a/src/code/z_debug.c b/src/code/z_debug.c index e0c1c4f9f8..e5bc9199f2 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -1,8 +1,5 @@ #include #include -#include -#include -#include #include typedef struct { @@ -60,29 +57,24 @@ void func_800636C0() { void func_8006375C(s32 arg0, s32 arg1, float* d_80855320) { } -#ifdef NON_MATCHING // regalloc // Copy Camera Debugger Text void func_8006376C(u8 x, u8 y, u8 colorId, const char* text) { PrintTextBuffer* buf; char* bufText; - s16 i; // v1 + s16 i; buf = &D_8015FA98[D_8011E0B0]; if (D_8011E0B0 < 0x16) { - buf->x = x; buf->y = y; buf->colorId = colorId; i = 0; - bufText = buf->text + 1; - - if (*buf->text = *text++) { - do - if (i++ > 0x14) { - break; - } - while (*bufText++ = *text++); + bufText = buf->text; + while (*bufText++ = *text++) { + if (i++ > 0x14) { + break; + } } *bufText = '\0'; @@ -90,10 +82,6 @@ void func_8006376C(u8 x, u8 y, u8 colorId, const char* text) { } } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug/func_8006376C.s") -#endif - // Draw Text void func_80063828(GfxPrint* gfxPrint) { s32 i; diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index b69ac8b344..27050cf24f 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -48,7 +48,7 @@ void Health_InitData(GlobalContext* globalCtx) { } #ifdef NON_MATCHING -// this function still needs some work +// this function still needs some work but it should be functionally equivalent void Health_UpdateData(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; f32 temp_f0 = interfaceCtx->unk_1FE * 0.1f; diff --git a/src/code/z_room.c b/src/code/z_room.c index f9973bfeaf..f225ef77fb 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -85,7 +85,7 @@ typedef struct struct_80095D04 { // Room Draw Polygon Type 2 #ifdef NON_MATCHING -// this function still needs some work +// this function still needs some work but it should be functionally equivalent void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) { PolygonType2* polygon2; PolygonDlist2* polygonDlist; diff --git a/src/code/z_scene.c b/src/code/z_scene.c index c8c97459cb..949e1e41cb 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -280,7 +280,7 @@ void func_80098958(GlobalContext* globalCtx, SceneCmd* cmd) { // Scene Command 0x0B: Object List #ifdef NON_MATCHING -// this function still needs some work +// this function still needs some work but it should be functionally equivalent void func_8009899C(GlobalContext* globalCtx, SceneCmd* cmd) { s32 i, j, k; s16* objectEntry; From 7c9291c59ecfe38660bdf546b33dd338c105bc09 Mon Sep 17 00:00:00 2001 From: Roman971 Date: Mon, 23 Mar 2020 01:49:30 +0100 Subject: [PATCH 2/2] Update progress script to default to decomp progress --- progress.py | 48 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/progress.py b/progress.py index 8353eead4d..62d201c853 100644 --- a/progress.py +++ b/progress.py @@ -1,4 +1,24 @@ +#!/usr/bin/env python3 + import os +import re +import argparse + +parser = argparse.ArgumentParser(description="Computes current progress throughout the whole project.") +parser.add_argument("-m", "--matching", dest='matching', action='store_true', + help="Output matching progress instead of decompilation progress") +args = parser.parse_args() + +NON_MATCHING_PATTERN = "#ifdef\s+NON_MATCHING.*?#pragma\s+GLOBAL_ASM\s*\(\s*\"(.*?)\"\s*\).*?#endif" + +def GetNonMatchingFunctions(files): + functions = [] + + for file in files: + with open(file) as f: + functions += re.findall(NON_MATCHING_PATTERN, f.read(), re.DOTALL) + + return functions def ReadAllLines(fileName): lineList = list() @@ -7,27 +27,30 @@ def ReadAllLines(fileName): return lineList -def GetFiles(path): +def GetFiles(path, ext): files = [] for r, d, f in os.walk(path): for file in f: - if '.s' in file: + if file.endswith(ext): files.append(os.path.join(r, file)) return files +nonMatchingFunctions = GetNonMatchingFunctions(GetFiles("src", ".c")) if not args.matching else [] + def GetNonMatchingSize(path): size = 0 - asmFiles = GetFiles(path) + asmFiles = GetFiles(path, ".s") for asmFilePath in asmFiles: - asmLines = ReadAllLines(asmFilePath) + if asmFilePath not in nonMatchingFunctions: + asmLines = ReadAllLines(asmFilePath) - for asmLine in asmLines: - if (asmLine.startswith("/*")): - size += 4 + for asmLine in asmLines: + if (asmLine.startswith("/*")): + size += 4 return size @@ -97,12 +120,13 @@ ovlPct = 100 * ovl / ovlSize compiled_bytes = total bytesPerHeartPiece = compiled_bytes / 80 +adjective = "decompiled" if not args.matching else "matched" + print(str(total) + " total bytes of decompilable code\n") -print(str(src) + " bytes of code in src " + str(srcPct) + "%\n") -#print(str(asm) + " bytes of code in asm " + str(asmPct) + "%\n") -print(str(boot) + "/" + str(bootSize) + " bytes of code in boot " + str(bootPct) + "%\n") -print(str(code) + "/" + str(codeSize) + " bytes of code in code " + str(codePct) + "%\n") -print(str(ovl) + "/" + str(ovlSize) + " bytes of code in overlays " + str(ovlPct) + "%\n") +print(str(src) + " bytes " + adjective + " in src " + str(srcPct) + "%\n") +print(str(boot) + "/" + str(bootSize) + " bytes " + adjective + " in boot " + str(bootPct) + "%\n") +print(str(code) + "/" + str(codeSize) + " bytes " + adjective + " in code " + str(codePct) + "%\n") +print(str(ovl) + "/" + str(ovlSize) + " bytes " + adjective + " in overlays " + str(ovlPct) + "%\n") print("------------------------------------\n") heartPieces = int(src / bytesPerHeartPiece)