This commit is contained in:
dark-samus 2021-01-15 12:01:44 -05:00
parent 17add9b58d
commit 8d533d5615
36 changed files with 1249 additions and 754 deletions

View File

@ -0,0 +1,125 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_802E246C
/* 103CEC 802E246C 27BDFF40 */ addiu $sp, $sp, -0xc0
/* 103CF0 802E2470 AFB500A4 */ sw $s5, 0xa4($sp)
/* 103CF4 802E2474 0080A82D */ daddu $s5, $a0, $zero
/* 103CF8 802E2478 AFB600A8 */ sw $s6, 0xa8($sp)
/* 103CFC 802E247C 00C0B02D */ daddu $s6, $a2, $zero
/* 103D00 802E2480 27A40050 */ addiu $a0, $sp, 0x50
/* 103D04 802E2484 30A5FFFF */ andi $a1, $a1, 0xffff
/* 103D08 802E2488 AFBF00B0 */ sw $ra, 0xb0($sp)
/* 103D0C 802E248C AFB700AC */ sw $s7, 0xac($sp)
/* 103D10 802E2490 AFB400A0 */ sw $s4, 0xa0($sp)
/* 103D14 802E2494 AFB3009C */ sw $s3, 0x9c($sp)
/* 103D18 802E2498 AFB20098 */ sw $s2, 0x98($sp)
/* 103D1C 802E249C AFB10094 */ sw $s1, 0x94($sp)
/* 103D20 802E24A0 AFB00090 */ sw $s0, 0x90($sp)
/* 103D24 802E24A4 F7B400B8 */ sdc1 $f20, 0xb8($sp)
/* 103D28 802E24A8 8EA20044 */ lw $v0, 0x44($s5)
/* 103D2C 802E24AC 8EB00040 */ lw $s0, 0x40($s5)
/* 103D30 802E24B0 00451021 */ addu $v0, $v0, $a1
/* 103D34 802E24B4 AE020034 */ sw $v0, 0x34($s0)
/* 103D38 802E24B8 3C02802E */ lui $v0, %hi(func_802E2BA4)
/* 103D3C 802E24BC 24422BA4 */ addiu $v0, $v0, %lo(func_802E2BA4)
/* 103D40 802E24C0 AEA2003C */ sw $v0, 0x3c($s5)
/* 103D44 802E24C4 240200FF */ addiu $v0, $zero, 0xff
/* 103D48 802E24C8 A2A2000B */ sb $v0, 0xb($s5)
/* 103D4C 802E24CC C6000038 */ lwc1 $f0, 0x38($s0)
/* 103D50 802E24D0 8EA50048 */ lw $a1, 0x48($s5)
/* 103D54 802E24D4 8EA70050 */ lw $a3, 0x50($s5)
/* 103D58 802E24D8 44060000 */ mfc1 $a2, $f0
/* 103D5C 802E24DC 24170002 */ addiu $s7, $zero, 2
/* 103D60 802E24E0 0C019E40 */ jal guTranslateF
/* 103D64 802E24E4 AEA6004C */ sw $a2, 0x4c($s5)
/* 103D68 802E24E8 0C044AC8 */ jal func_80112B20
/* 103D6C 802E24EC 02A0202D */ daddu $a0, $s5, $zero
/* 103D70 802E24F0 50400001 */ beql $v0, $zero, .L802E24F8
/* 103D74 802E24F4 24170001 */ addiu $s7, $zero, 1
.L802E24F8:
/* 103D78 802E24F8 0000A02D */ daddu $s4, $zero, $zero
/* 103D7C 802E24FC 0200902D */ daddu $s2, $s0, $zero
/* 103D80 802E2500 0240882D */ daddu $s1, $s2, $zero
/* 103D84 802E2504 0240982D */ daddu $s3, $s2, $zero
/* 103D88 802E2508 240200FF */ addiu $v0, $zero, 0xff
/* 103D8C 802E250C A640003E */ sh $zero, 0x3e($s2)
/* 103D90 802E2510 A642003C */ sh $v0, 0x3c($s2)
.L802E2514:
/* 103D94 802E2514 32C2FFFF */ andi $v0, $s6, 0xffff
/* 103D98 802E2518 26D60040 */ addiu $s6, $s6, 0x40
/* 103D9C 802E251C 8EA50044 */ lw $a1, 0x44($s5)
/* 103DA0 802E2520 27A40010 */ addiu $a0, $sp, 0x10
/* 103DA4 802E2524 0C019D60 */ jal guMtxL2F
/* 103DA8 802E2528 00A22821 */ addu $a1, $a1, $v0
/* 103DAC 802E252C 27A40050 */ addiu $a0, $sp, 0x50
/* 103DB0 802E2530 27A50010 */ addiu $a1, $sp, 0x10
/* 103DB4 802E2534 0C019D80 */ jal guMtxCatF
/* 103DB8 802E2538 00A0302D */ daddu $a2, $a1, $zero
/* 103DBC 802E253C C7A00040 */ lwc1 $f0, 0x40($sp)
/* 103DC0 802E2540 E64000C0 */ swc1 $f0, 0xc0($s2)
/* 103DC4 802E2544 C7A00044 */ lwc1 $f0, 0x44($sp)
/* 103DC8 802E2548 E6400124 */ swc1 $f0, 0x124($s2)
/* 103DCC 802E254C C7A00048 */ lwc1 $f0, 0x48($sp)
/* 103DD0 802E2550 240400FF */ addiu $a0, $zero, 0xff
/* 103DD4 802E2554 0C00A67F */ jal rand_int
/* 103DD8 802E2558 E6400188 */ swc1 $f0, 0x188($s2)
/* 103DDC 802E255C 00021023 */ negu $v0, $v0
/* 103DE0 802E2560 A2220072 */ sb $v0, 0x72($s1)
/* 103DE4 802E2564 24020001 */ addiu $v0, $zero, 1
/* 103DE8 802E2568 16E20008 */ bne $s7, $v0, .L802E258C
/* 103DEC 802E256C 24100028 */ addiu $s0, $zero, 0x28
/* 103DF0 802E2570 24100014 */ addiu $s0, $zero, 0x14
/* 103DF4 802E2574 96620000 */ lhu $v0, ($s3)
/* 103DF8 802E2578 3C0140CC */ lui $at, 0x40cc
/* 103DFC 802E257C 3421CCCD */ ori $at, $at, 0xcccd
/* 103E00 802E2580 4481A000 */ mtc1 $at, $f20
/* 103E04 802E2584 080B8968 */ j .L802E25A0
/* 103E08 802E2588 34420001 */ ori $v0, $v0, 1
.L802E258C:
/* 103E0C 802E258C 96620000 */ lhu $v0, ($s3)
/* 103E10 802E2590 3C014109 */ lui $at, 0x4109
/* 103E14 802E2594 3421999A */ ori $at, $at, 0x999a
/* 103E18 802E2598 4481A000 */ mtc1 $at, $f20
/* 103E1C 802E259C 34420002 */ ori $v0, $v0, 2
.L802E25A0:
/* 103E20 802E25A0 A6620000 */ sh $v0, ($s3)
/* 103E24 802E25A4 0C00A67F */ jal rand_int
/* 103E28 802E25A8 2404000A */ addiu $a0, $zero, 0xa
/* 103E2C 802E25AC 02028021 */ addu $s0, $s0, $v0
/* 103E30 802E25B0 32820001 */ andi $v0, $s4, 1
/* 103E34 802E25B4 14400003 */ bnez $v0, .L802E25C4
/* 103E38 802E25B8 A2300059 */ sb $s0, 0x59($s1)
/* 103E3C 802E25BC 00101023 */ negu $v0, $s0
/* 103E40 802E25C0 A2220059 */ sb $v0, 0x59($s1)
.L802E25C4:
/* 103E44 802E25C4 0C00A64D */ jal func_80029934
/* 103E48 802E25C8 26730002 */ addiu $s3, $s3, 2
/* 103E4C 802E25CC 3C01802F */ lui $at, %hi(D_802EB130)
/* 103E50 802E25D0 D422B130 */ ldc1 $f2, %lo(D_802EB130)($at)
/* 103E54 802E25D4 46000021 */ cvt.d.s $f0, $f0
/* 103E58 802E25D8 46220002 */ mul.d $f0, $f0, $f2
/* 103E5C 802E25DC 00000000 */ nop
/* 103E60 802E25E0 46200020 */ cvt.s.d $f0, $f0
/* 103E64 802E25E4 4600A000 */ add.s $f0, $f20, $f0
/* 103E68 802E25E8 26940001 */ addiu $s4, $s4, 1
/* 103E6C 802E25EC 2A820018 */ slti $v0, $s4, 0x18
/* 103E70 802E25F0 E64001EC */ swc1 $f0, 0x1ec($s2)
/* 103E74 802E25F4 26520004 */ addiu $s2, $s2, 4
/* 103E78 802E25F8 A2200040 */ sb $zero, 0x40($s1)
/* 103E7C 802E25FC A220008B */ sb $zero, 0x8b($s1)
/* 103E80 802E2600 A22000A4 */ sb $zero, 0xa4($s1)
/* 103E84 802E2604 1440FFC3 */ bnez $v0, .L802E2514
/* 103E88 802E2608 26310001 */ addiu $s1, $s1, 1
/* 103E8C 802E260C 8FBF00B0 */ lw $ra, 0xb0($sp)
/* 103E90 802E2610 8FB700AC */ lw $s7, 0xac($sp)
/* 103E94 802E2614 8FB600A8 */ lw $s6, 0xa8($sp)
/* 103E98 802E2618 8FB500A4 */ lw $s5, 0xa4($sp)
/* 103E9C 802E261C 8FB400A0 */ lw $s4, 0xa0($sp)
/* 103EA0 802E2620 8FB3009C */ lw $s3, 0x9c($sp)
/* 103EA4 802E2624 8FB20098 */ lw $s2, 0x98($sp)
/* 103EA8 802E2628 8FB10094 */ lw $s1, 0x94($sp)
/* 103EAC 802E262C 8FB00090 */ lw $s0, 0x90($sp)
/* 103EB0 802E2630 D7B400B8 */ ldc1 $f20, 0xb8($sp)
/* 103EB4 802E2634 03E00008 */ jr $ra
/* 103EB8 802E2638 27BD00C0 */ addiu $sp, $sp, 0xc0

View File

@ -1,28 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_80025C60
/* 1060 80025C60 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 1064 80025C64 3C05B3FF */ lui $a1, 0xb3ff
/* 1068 80025C68 34A50014 */ ori $a1, $a1, 0x14
/* 106C 80025C6C AFB00010 */ sw $s0, 0x10($sp)
/* 1070 80025C70 3C10800A */ lui $s0, %hi(carthandle)
/* 1074 80025C74 2610A638 */ addiu $s0, $s0, %lo(carthandle)
/* 1078 80025C78 AFBF0014 */ sw $ra, 0x14($sp)
/* 107C 80025C7C 8E040000 */ lw $a0, ($s0)
/* 1080 80025C80 0C018358 */ jal osEPiWriteIo
/* 1084 80025C84 0000302D */ daddu $a2, $zero, $zero
/* 1088 80025C88 3C05B3FF */ lui $a1, 0xb3ff
/* 108C 80025C8C 34A50004 */ ori $a1, $a1, 4
/* 1090 80025C90 8E040000 */ lw $a0, ($s0)
/* 1094 80025C94 0C018358 */ jal osEPiWriteIo
/* 1098 80025C98 0000302D */ daddu $a2, $zero, $zero
/* 109C 80025C9C 3C05B3FF */ lui $a1, 0xb3ff
/* 10A0 80025CA0 3C064953 */ lui $a2, 0x4953
/* 10A4 80025CA4 8E040000 */ lw $a0, ($s0)
/* 10A8 80025CA8 0C018358 */ jal osEPiWriteIo
/* 10AC 80025CAC 34C63634 */ ori $a2, $a2, 0x3634
/* 10B0 80025CB0 8FBF0014 */ lw $ra, 0x14($sp)
/* 10B4 80025CB4 8FB00010 */ lw $s0, 0x10($sp)
/* 10B8 80025CB8 03E00008 */ jr $ra
/* 10BC 80025CBC 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,19 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_80025CC0
/* 10C0 80025CC0 AFA40000 */ sw $a0, ($sp)
/* 10C4 80025CC4 AFA50004 */ sw $a1, 4($sp)
/* 10C8 80025CC8 AFA60008 */ sw $a2, 8($sp)
/* 10CC 80025CCC AFA7000C */ sw $a3, 0xc($sp)
/* 10D0 80025CD0 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 10D4 80025CD4 0080302D */ daddu $a2, $a0, $zero
/* 10D8 80025CD8 3C048002 */ lui $a0, %hi(func_80025D74)
/* 10DC 80025CDC 24845D74 */ addiu $a0, $a0, %lo(func_80025D74)
/* 10E0 80025CE0 0000282D */ daddu $a1, $zero, $zero
/* 10E4 80025CE4 AFBF0010 */ sw $ra, 0x10($sp)
/* 10E8 80025CE8 0C0192A8 */ jal _Printf
/* 10EC 80025CEC 27A7001C */ addiu $a3, $sp, 0x1c
/* 10F0 80025CF0 8FBF0010 */ lw $ra, 0x10($sp)
/* 10F4 80025CF4 03E00008 */ jr $ra
/* 10F8 80025CF8 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,19 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_80025CFC
/* 10FC 80025CFC AFA40000 */ sw $a0, ($sp)
/* 1100 80025D00 AFA50004 */ sw $a1, 4($sp)
/* 1104 80025D04 AFA60008 */ sw $a2, 8($sp)
/* 1108 80025D08 AFA7000C */ sw $a3, 0xc($sp)
/* 110C 80025D0C 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 1110 80025D10 0080302D */ daddu $a2, $a0, $zero
/* 1114 80025D14 3C048002 */ lui $a0, %hi(func_80025D74)
/* 1118 80025D18 24845D74 */ addiu $a0, $a0, %lo(func_80025D74)
/* 111C 80025D1C 0000282D */ daddu $a1, $zero, $zero
/* 1120 80025D20 AFBF0010 */ sw $ra, 0x10($sp)
/* 1124 80025D24 0C0192A8 */ jal _Printf
/* 1128 80025D28 27A7001C */ addiu $a3, $sp, 0x1c
/* 112C 80025D2C 8FBF0010 */ lw $ra, 0x10($sp)
/* 1130 80025D30 03E00008 */ jr $ra
/* 1134 80025D34 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,19 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_80025D38
/* 1138 80025D38 AFA40000 */ sw $a0, ($sp)
/* 113C 80025D3C AFA50004 */ sw $a1, 4($sp)
/* 1140 80025D40 AFA60008 */ sw $a2, 8($sp)
/* 1144 80025D44 AFA7000C */ sw $a3, 0xc($sp)
/* 1148 80025D48 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 114C 80025D4C 0080302D */ daddu $a2, $a0, $zero
/* 1150 80025D50 3C048002 */ lui $a0, %hi(func_80025D74)
/* 1154 80025D54 24845D74 */ addiu $a0, $a0, %lo(func_80025D74)
/* 1158 80025D58 0000282D */ daddu $a1, $zero, $zero
/* 115C 80025D5C AFBF0010 */ sw $ra, 0x10($sp)
/* 1160 80025D60 0C0192A8 */ jal _Printf
/* 1164 80025D64 27A7001C */ addiu $a3, $sp, 0x1c
/* 1168 80025D68 8FBF0010 */ lw $ra, 0x10($sp)
/* 116C 80025D6C 03E00008 */ jr $ra
/* 1170 80025D70 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,126 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_80025D74
/* 1174 80025D74 27BDFFC0 */ addiu $sp, $sp, -0x40
/* 1178 80025D78 AFB30024 */ sw $s3, 0x24($sp)
/* 117C 80025D7C 00A0982D */ daddu $s3, $a1, $zero
/* 1180 80025D80 AFB40028 */ sw $s4, 0x28($sp)
/* 1184 80025D84 00C0A02D */ daddu $s4, $a2, $zero
/* 1188 80025D88 3C05B3FF */ lui $a1, 0xb3ff
/* 118C 80025D8C AFB1001C */ sw $s1, 0x1c($sp)
/* 1190 80025D90 3C11800A */ lui $s1, %hi(carthandle)
/* 1194 80025D94 2631A638 */ addiu $s1, $s1, %lo(carthandle)
/* 1198 80025D98 AFB00018 */ sw $s0, 0x18($sp)
/* 119C 80025D9C 27B00010 */ addiu $s0, $sp, 0x10
/* 11A0 80025DA0 AFBF003C */ sw $ra, 0x3c($sp)
/* 11A4 80025DA4 AFBE0038 */ sw $fp, 0x38($sp)
/* 11A8 80025DA8 AFB70034 */ sw $s7, 0x34($sp)
/* 11AC 80025DAC AFB60030 */ sw $s6, 0x30($sp)
/* 11B0 80025DB0 AFB5002C */ sw $s5, 0x2c($sp)
/* 11B4 80025DB4 AFB20020 */ sw $s2, 0x20($sp)
/* 11B8 80025DB8 8E240000 */ lw $a0, ($s1)
/* 11BC 80025DBC 0C018370 */ jal osEPiReadIo
/* 11C0 80025DC0 0200302D */ daddu $a2, $s0, $zero
/* 11C4 80025DC4 3C034953 */ lui $v1, 0x4953
/* 11C8 80025DC8 8FA20010 */ lw $v0, 0x10($sp)
/* 11CC 80025DCC 34633634 */ ori $v1, $v1, 0x3634
/* 11D0 80025DD0 14430050 */ bne $v0, $v1, .L80025F14
/* 11D4 80025DD4 24020001 */ addiu $v0, $zero, 1
/* 11D8 80025DD8 3C05B3FF */ lui $a1, 0xb3ff
/* 11DC 80025DDC 34A50004 */ ori $a1, $a1, 4
/* 11E0 80025DE0 8E240000 */ lw $a0, ($s1)
/* 11E4 80025DE4 0C018370 */ jal osEPiReadIo
/* 11E8 80025DE8 0200302D */ daddu $a2, $s0, $zero
/* 11EC 80025DEC 3C05B3FF */ lui $a1, 0xb3ff
/* 11F0 80025DF0 0200302D */ daddu $a2, $s0, $zero
/* 11F4 80025DF4 8E240000 */ lw $a0, ($s1)
/* 11F8 80025DF8 8FB00010 */ lw $s0, 0x10($sp)
/* 11FC 80025DFC 0C018370 */ jal osEPiReadIo
/* 1200 80025E00 34A50014 */ ori $a1, $a1, 0x14
/* 1204 80025E04 8FB20010 */ lw $s2, 0x10($sp)
/* 1208 80025E08 3402FFDF */ ori $v0, $zero, 0xffdf
/* 120C 80025E0C 02541821 */ addu $v1, $s2, $s4
/* 1210 80025E10 0043102A */ slt $v0, $v0, $v1
/* 1214 80025E14 1040000B */ beqz $v0, .L80025E44
/* 1218 80025E18 3C02FFFF */ lui $v0, 0xffff
/* 121C 80025E1C 34420020 */ ori $v0, $v0, 0x20
/* 1220 80025E20 00621821 */ addu $v1, $v1, $v0
/* 1224 80025E24 0203102A */ slt $v0, $s0, $v1
/* 1228 80025E28 1440003A */ bnez $v0, .L80025F14
/* 122C 80025E2C 24020001 */ addiu $v0, $zero, 1
/* 1230 80025E30 0250102A */ slt $v0, $s2, $s0
/* 1234 80025E34 10400008 */ beqz $v0, .L80025E58
/* 1238 80025E38 24020001 */ addiu $v0, $zero, 1
/* 123C 80025E3C 080097C5 */ j .L80025F14
/* 1240 80025E40 00000000 */ nop
.L80025E44:
/* 1244 80025E44 0250102A */ slt $v0, $s2, $s0
/* 1248 80025E48 10400003 */ beqz $v0, .L80025E58
/* 124C 80025E4C 0203102A */ slt $v0, $s0, $v1
/* 1250 80025E50 14400030 */ bnez $v0, .L80025F14
/* 1254 80025E54 24020001 */ addiu $v0, $zero, 1
.L80025E58:
/* 1258 80025E58 12800027 */ beqz $s4, .L80025EF8
/* 125C 80025E5C 3C1E0FFF */ lui $fp, 0xfff
/* 1260 80025E60 37DEFFFC */ ori $fp, $fp, 0xfffc
/* 1264 80025E64 3C17B3FF */ lui $s7, 0xb3ff
/* 1268 80025E68 36F70020 */ ori $s7, $s7, 0x20
/* 126C 80025E6C 3C15800A */ lui $s5, %hi(carthandle)
/* 1270 80025E70 26B5A638 */ addiu $s5, $s5, %lo(carthandle)
/* 1274 80025E74 3C16FFFF */ lui $s6, 0xffff
/* 1278 80025E78 36D60020 */ ori $s6, $s6, 0x20
.L80025E7C:
/* 127C 80025E7C 92620000 */ lbu $v0, ($s3)
/* 1280 80025E80 1040001A */ beqz $v0, .L80025EEC
/* 1284 80025E84 025E8824 */ and $s1, $s2, $fp
/* 1288 80025E88 02378821 */ addu $s1, $s1, $s7
/* 128C 80025E8C 0220282D */ daddu $a1, $s1, $zero
/* 1290 80025E90 27A60010 */ addiu $a2, $sp, 0x10
/* 1294 80025E94 32500003 */ andi $s0, $s2, 3
/* 1298 80025E98 26520001 */ addiu $s2, $s2, 1
/* 129C 80025E9C 24070003 */ addiu $a3, $zero, 3
/* 12A0 80025EA0 00F08023 */ subu $s0, $a3, $s0
/* 12A4 80025EA4 8EA40000 */ lw $a0, ($s5)
/* 12A8 80025EA8 0C018370 */ jal osEPiReadIo
/* 12AC 80025EAC 00F08004 */ sllv $s0, $s0, $a3
/* 12B0 80025EB0 0220282D */ daddu $a1, $s1, $zero
/* 12B4 80025EB4 240700FF */ addiu $a3, $zero, 0xff
/* 12B8 80025EB8 02071004 */ sllv $v0, $a3, $s0
/* 12BC 80025EBC 00021027 */ nor $v0, $zero, $v0
/* 12C0 80025EC0 8EA40000 */ lw $a0, ($s5)
/* 12C4 80025EC4 8FA30010 */ lw $v1, 0x10($sp)
/* 12C8 80025EC8 92660000 */ lbu $a2, ($s3)
/* 12CC 80025ECC 00621824 */ and $v1, $v1, $v0
/* 12D0 80025ED0 02063004 */ sllv $a2, $a2, $s0
/* 12D4 80025ED4 0C018358 */ jal osEPiWriteIo
/* 12D8 80025ED8 00663025 */ or $a2, $v1, $a2
/* 12DC 80025EDC 3407FFDF */ ori $a3, $zero, 0xffdf
/* 12E0 80025EE0 00F2102A */ slt $v0, $a3, $s2
/* 12E4 80025EE4 54400001 */ bnel $v0, $zero, .L80025EEC
/* 12E8 80025EE8 02569021 */ addu $s2, $s2, $s6
.L80025EEC:
/* 12EC 80025EEC 2694FFFF */ addiu $s4, $s4, -1
/* 12F0 80025EF0 1680FFE2 */ bnez $s4, .L80025E7C
/* 12F4 80025EF4 26730001 */ addiu $s3, $s3, 1
.L80025EF8:
/* 12F8 80025EF8 3C04800A */ lui $a0, %hi(carthandle)
/* 12FC 80025EFC 8C84A638 */ lw $a0, %lo(carthandle)($a0)
/* 1300 80025F00 3C05B3FF */ lui $a1, 0xb3ff
/* 1304 80025F04 34A50014 */ ori $a1, $a1, 0x14
/* 1308 80025F08 0C018358 */ jal osEPiWriteIo
/* 130C 80025F0C 0240302D */ daddu $a2, $s2, $zero
/* 1310 80025F10 24020001 */ addiu $v0, $zero, 1
.L80025F14:
/* 1314 80025F14 8FBF003C */ lw $ra, 0x3c($sp)
/* 1318 80025F18 8FBE0038 */ lw $fp, 0x38($sp)
/* 131C 80025F1C 8FB70034 */ lw $s7, 0x34($sp)
/* 1320 80025F20 8FB60030 */ lw $s6, 0x30($sp)
/* 1324 80025F24 8FB5002C */ lw $s5, 0x2c($sp)
/* 1328 80025F28 8FB40028 */ lw $s4, 0x28($sp)
/* 132C 80025F2C 8FB30024 */ lw $s3, 0x24($sp)
/* 1330 80025F30 8FB20020 */ lw $s2, 0x20($sp)
/* 1334 80025F34 8FB1001C */ lw $s1, 0x1c($sp)
/* 1338 80025F38 8FB00018 */ lw $s0, 0x18($sp)
/* 133C 80025F3C 03E00008 */ jr $ra
/* 1340 80025F40 27BD0040 */ addiu $sp, $sp, 0x40

View File

@ -1,16 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_80025F44
/* 1344 80025F44 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 1348 80025F48 AFBF0010 */ sw $ra, 0x10($sp)
/* 134C 80025F4C 0080382D */ daddu $a3, $a0, $zero
/* 1350 80025F50 3C048009 */ lui $a0, %hi(D_80097D30)
/* 1354 80025F54 24847D30 */ addiu $a0, $a0, %lo(D_80097D30)
/* 1358 80025F58 0C00973F */ jal func_80025CFC
/* 135C 80025F5C 00000000 */ nop
.L80025F60:
/* 1360 80025F60 080097D8 */ j .L80025F60
/* 1364 80025F64 00000000 */ nop
/* 1368 80025F68 00000000 */ nop
/* 136C 80025F6C 00000000 */ nop

View File

@ -1,101 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel play_effect
/* 35964 8005A564 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 35968 8005A568 AFB20020 */ sw $s2, 0x20($sp)
/* 3596C 8005A56C 0080902D */ daddu $s2, $a0, $zero
/* 35970 8005A570 3C038008 */ lui $v1, %hi(D_8007F210)
/* 35974 8005A574 2463F210 */ addiu $v1, $v1, %lo(D_8007F210)
/* 35978 8005A578 00121040 */ sll $v0, $s2, 1
/* 3597C 8005A57C 00521021 */ addu $v0, $v0, $s2
/* 35980 8005A580 000210C0 */ sll $v0, $v0, 3
/* 35984 8005A584 AFB1001C */ sw $s1, 0x1c($sp)
/* 35988 8005A588 00438821 */ addu $s1, $v0, $v1
/* 3598C 8005A58C 0000202D */ daddu $a0, $zero, $zero
/* 35990 8005A590 AFB00018 */ sw $s0, 0x18($sp)
/* 35994 8005A594 3C10800A */ lui $s0, %hi(D_800A4000)
/* 35998 8005A598 26104000 */ addiu $s0, $s0, %lo(D_800A4000)
/* 3599C 8005A59C AFBF0024 */ sw $ra, 0x24($sp)
.L8005A5A0:
/* 359A0 8005A5A0 8E020000 */ lw $v0, ($s0)
/* 359A4 8005A5A4 30420001 */ andi $v0, $v0, 1
/* 359A8 8005A5A8 50400005 */ beql $v0, $zero, .L8005A5C0
/* 359AC 8005A5AC 24840001 */ addiu $a0, $a0, 1
/* 359B0 8005A5B0 8E020004 */ lw $v0, 4($s0)
/* 359B4 8005A5B4 10520006 */ beq $v0, $s2, .L8005A5D0
/* 359B8 8005A5B8 2882000F */ slti $v0, $a0, 0xf
/* 359BC 8005A5BC 24840001 */ addiu $a0, $a0, 1
.L8005A5C0:
/* 359C0 8005A5C0 2882000F */ slti $v0, $a0, 0xf
/* 359C4 8005A5C4 1440FFF6 */ bnez $v0, .L8005A5A0
/* 359C8 8005A5C8 26100020 */ addiu $s0, $s0, 0x20
/* 359CC 8005A5CC 2882000F */ slti $v0, $a0, 0xf
.L8005A5D0:
/* 359D0 8005A5D0 14400030 */ bnez $v0, .L8005A694
/* 359D4 8005A5D4 24020001 */ addiu $v0, $zero, 1
/* 359D8 8005A5D8 0000202D */ daddu $a0, $zero, $zero
/* 359DC 8005A5DC 3C10800A */ lui $s0, %hi(D_800A4000)
/* 359E0 8005A5E0 26104000 */ addiu $s0, $s0, %lo(D_800A4000)
.L8005A5E4:
/* 359E4 8005A5E4 8E020000 */ lw $v0, ($s0)
/* 359E8 8005A5E8 30420001 */ andi $v0, $v0, 1
/* 359EC 8005A5EC 10400006 */ beqz $v0, .L8005A608
/* 359F0 8005A5F0 2882000F */ slti $v0, $a0, 0xf
/* 359F4 8005A5F4 24840001 */ addiu $a0, $a0, 1
/* 359F8 8005A5F8 2882000F */ slti $v0, $a0, 0xf
/* 359FC 8005A5FC 1440FFF9 */ bnez $v0, .L8005A5E4
/* 35A00 8005A600 26100020 */ addiu $s0, $s0, 0x20
/* 35A04 8005A604 2882000F */ slti $v0, $a0, 0xf
.L8005A608:
/* 35A08 8005A608 14400003 */ bnez $v0, .L8005A618
/* 35A0C 8005A60C 3C0700FF */ lui $a3, 0xff
.L8005A610:
/* 35A10 8005A610 08016984 */ j .L8005A610
/* 35A14 8005A614 00000000 */ nop
.L8005A618:
/* 35A18 8005A618 34E7FFFF */ ori $a3, $a3, 0xffff
/* 35A1C 8005A61C 0000282D */ daddu $a1, $zero, $zero
/* 35A20 8005A620 2402FFFF */ addiu $v0, $zero, -1
/* 35A24 8005A624 3C038019 */ lui $v1, %hi(D_80197000)
/* 35A28 8005A628 24637000 */ addiu $v1, $v1, %lo(D_80197000)
/* 35A2C 8005A62C AFA20010 */ sw $v0, 0x10($sp)
/* 35A30 8005A630 AFA20014 */ sw $v0, 0x14($sp)
/* 35A34 8005A634 00041300 */ sll $v0, $a0, 0xc
/* 35A38 8005A638 00431021 */ addu $v0, $v0, $v1
/* 35A3C 8005A63C 8E26000C */ lw $a2, 0xc($s1)
/* 35A40 8005A640 0C0199E8 */ jal osMapTLB
/* 35A44 8005A644 00473824 */ and $a3, $v0, $a3
/* 35A48 8005A648 8E240004 */ lw $a0, 4($s1)
/* 35A4C 8005A64C 8E250008 */ lw $a1, 8($s1)
/* 35A50 8005A650 0C00A5CF */ jal dma_copy
/* 35A54 8005A654 8E26000C */ lw $a2, 0xc($s1)
/* 35A58 8005A658 8E220010 */ lw $v0, 0x10($s1)
/* 35A5C 8005A65C 5040000D */ beql $v0, $zero, .L8005A694
/* 35A60 8005A660 24020001 */ addiu $v0, $zero, 1
/* 35A64 8005A664 8E240014 */ lw $a0, 0x14($s1)
/* 35A68 8005A668 0C00AB0A */ jal general_heap_malloc
/* 35A6C 8005A66C 00822023 */ subu $a0, $a0, $v0
/* 35A70 8005A670 14400003 */ bnez $v0, .L8005A680
/* 35A74 8005A674 AE02001C */ sw $v0, 0x1c($s0)
.L8005A678:
/* 35A78 8005A678 0801699E */ j .L8005A678
/* 35A7C 8005A67C 00000000 */ nop
.L8005A680:
/* 35A80 8005A680 8E240010 */ lw $a0, 0x10($s1)
/* 35A84 8005A684 8E250014 */ lw $a1, 0x14($s1)
/* 35A88 8005A688 0C00A5CF */ jal dma_copy
/* 35A8C 8005A68C 8E06001C */ lw $a2, 0x1c($s0)
/* 35A90 8005A690 24020001 */ addiu $v0, $zero, 1
.L8005A694:
/* 35A94 8005A694 0040182D */ daddu $v1, $v0, $zero
/* 35A98 8005A698 AE120004 */ sw $s2, 4($s0)
/* 35A9C 8005A69C AE000008 */ sw $zero, 8($s0)
/* 35AA0 8005A6A0 AE030000 */ sw $v1, ($s0)
/* 35AA4 8005A6A4 8FBF0024 */ lw $ra, 0x24($sp)
/* 35AA8 8005A6A8 8FB20020 */ lw $s2, 0x20($sp)
/* 35AAC 8005A6AC 8FB1001C */ lw $s1, 0x1c($sp)
/* 35AB0 8005A6B0 8FB00018 */ lw $s0, 0x18($sp)
/* 35AB4 8005A6B4 03E00008 */ jr $ra
/* 35AB8 8005A6B8 27BD0028 */ addiu $sp, $sp, 0x28
/* 35ABC 8005A6BC 00000000 */ nop

View File

@ -1361,7 +1361,7 @@ typedef struct {
typedef union { typedef union {
Light_t l; Light_t l;
long long int force_structure_alignment[2]; //long long int force_structure_alignment[2];
} Light; } Light;
typedef union { typedef union {

View File

@ -11,5 +11,6 @@
#include "si.h" #include "si.h"
#include "messages.h" #include "messages.h"
#include "ld_addrs.h" #include "ld_addrs.h"
#include "stdarg.h"
#endif #endif

View File

@ -477,7 +477,9 @@ typedef struct Camera {
/* 0x084 */ f32 trueRotation[3]; /* 0x084 */ f32 trueRotation[3];
/* 0x090 */ f32 currentBlendedYawNegated; /* 0x090 */ f32 currentBlendedYawNegated;
/* 0x094 */ f32 currentPitch; /* 0x094 */ f32 currentPitch;
/* 0x098 */ char unk_98[60]; /* 0x098 */ char unk_98[8];
/* 0x0A0 */ Vp viewport;
/* 0x0B0 */ char unk_B0[0x24];
/* 0x0D4 */ struct Matrix4f perspectiveMatrix; /* 0x0D4 */ struct Matrix4f perspectiveMatrix;
/* 0x114 */ struct Matrix4f viewMtxPlayer; /* centers on player */ /* 0x114 */ struct Matrix4f viewMtxPlayer; /* centers on player */
/* 0x154 */ struct Matrix4f viewMtxLeading; /* leads player slightly */ /* 0x154 */ struct Matrix4f viewMtxLeading; /* leads player slightly */
@ -779,7 +781,7 @@ typedef struct StaticItem {
typedef struct EffectInstance { typedef struct EffectInstance {
/* 0x00 */ s32 flags; /* 0x00 */ s32 flags;
/* 0x04 */ s32 effectIndex; /* 0x04 */ s32 effectIndex;
/* 0x08 */ char unk_08[4]; /* 0x08 */ s32 totalMatricies;
/* 0x0C */ void* unk_0C; /* 0x0C */ void* unk_0C;
/* 0x10 */ struct Effect* effect; /* 0x10 */ struct Effect* effect;
} EffectInstance; } EffectInstance;
@ -805,7 +807,7 @@ typedef struct Effect {
} Effect; // size = 0x20 } Effect; // size = 0x20
typedef struct EffectTableEntry { typedef struct EffectTableEntry {
/* 0x00 */ UNK_FUN_PTR(entryPoint); /* 0x00 */ void (*entryPoint)(s32 arg0, s32 arg1, s32 arg2, s32 arg3, f32 x, f32 y, f32 z);
/* 0x04 */ void* dmaStart; /* 0x04 */ void* dmaStart;
/* 0x08 */ void* dmaEnd; /* 0x08 */ void* dmaEnd;
/* 0x0C */ void* dmaDest; /* 0x0C */ void* dmaDest;
@ -813,7 +815,6 @@ typedef struct EffectTableEntry {
/* 0x14 */ void* unkEndRom; /* 0x14 */ void* unkEndRom;
} EffectTableEntry; // size = 0x18 } EffectTableEntry; // size = 0x18
typedef struct ItemEntity { typedef struct ItemEntity {
/* 0x00 */ s32 flags; /* 0x00 */ s32 flags;
/* 0x04 */ s16 boundVar; /* see make_item_entity */ /* 0x04 */ s16 boundVar; /* see make_item_entity */
@ -953,7 +954,8 @@ typedef struct GameStatus {
/* 0x08A */ s16 changedArea; /* (1 = yes) */ /* 0x08A */ s16 changedArea; /* (1 = yes) */
/* 0x08C */ s16 mapID; /* 0x08C */ s16 mapID;
/* 0x08E */ s16 entryID; /* 0x08E */ s16 entryID;
/* 0x090 */ char unk_90[4]; /* 0x090 */ u16 unk_90;
/* 0x092 */ u16 unk_92;
/* 0x094 */ f32 exitAngle; /* 0x094 */ f32 exitAngle;
/* 0x098 */ Vec3f playerPos; /* 0x098 */ Vec3f playerPos;
/* 0x0A4 */ f32 playerYaw; /* 0x0A4 */ f32 playerYaw;
@ -1630,6 +1632,11 @@ typedef struct {
// BEGIN ENTITY-SPECIFIC STRUCTS // BEGIN ENTITY-SPECIFIC STRUCTS
typedef struct struct802E2BA4 {
/* 0x00 */ char unk_00[2];
/* 0x02 */ u16 unk_02[24][2];
} struct802E2BA4;
// from code_102c80, size unknown. // from code_102c80, size unknown.
typedef struct struct802E1400 { typedef struct struct802E1400 {
/* 0x000 */ Vec3f unk_00; /* 0x000 */ Vec3f unk_00;
@ -1639,10 +1646,25 @@ typedef struct struct802E1400 {
/* 0x014 */ Vec3f unk_14; /* 0x014 */ Vec3f unk_14;
/* 0x020 */ u16 unk_20; /* 0x020 */ u16 unk_20;
/* 0x022 */ s16 unk_22; /* 0x022 */ s16 unk_22;
/* 0x024 */ char unk_24[4]; /* 0x024 */ s16 unk_24;
/* 0x028 */ Entity* attachedEntity; /* 0x028 */ Entity* attachedEntity;
/* 0x02C */ char unk_2C[12]; /* 0x02C */ char unk_2C[8];
/* 0x034 */ struct802E2BA4* unk_34;
/* 0x038 */ f32 unk_38; /* 0x038 */ f32 unk_38;
/* 0x03C */ union {
/* */ s16 s;
/* */ s8 b[2];
/* */ } unk_3C;
/* 0x03E */ char unk_3E[0x4D];
/* 0x08B */ u8 unk_8B[24];
/* 0x0A3 */ char unk_A3; // padding?
/* 0x0A4 */ u8 unk_A4[24];
/* 0x0BC */ char unk_BC[4];
/* 0x0C0 */ f32 unk_C0[24];
/* 0x120 */ char unk_120[4];
/* 0x124 */ f32 unk_124[24];
/* 0x184 */ char unk_184[4];
/* 0x188 */ f32 unk_188[24];
} struct802E1400; } struct802E1400;
// from code_104940_len_dc0, size unknown // from code_104940_len_dc0, size unknown

View File

@ -782,7 +782,7 @@ typedef UNK_TYPE Phase;
#define Phase_MERLEE_EXP_BONUS 0x00000016 #define Phase_MERLEE_EXP_BONUS 0x00000016
#define Phase_PLAYER_HAPPY 0x0000001E #define Phase_PLAYER_HAPPY 0x0000001E
typedef UNK_TYPE ActorID; typedef s32 ActorID;
#define ActorID_SELF 0xFFFFFF81 #define ActorID_SELF 0xFFFFFF81
#define ActorID_PLAYER 0x00000000 #define ActorID_PLAYER 0x00000000
#define ActorID_PARTNER 0x00000100 #define ActorID_PARTNER 0x00000100

205
include/stdarg.h Normal file
View File

@ -0,0 +1,205 @@
/* stdarg.h for GNU.
Note that the type used in va_arg is supposed to match the
actual type **after default promotions**.
Thus, va_arg (..., short) is not valid. */
#ifndef _STDARG_H
#ifndef _ANSI_STDARG_H_
#ifndef __need___va_list
#define _STDARG_H
#define _ANSI_STDARG_H_
#endif /* not __need___va_list */
#undef __need___va_list
#ifdef __clipper__
#include "va-clipper.h"
#else
#ifdef __m88k__
#include "va-m88k.h"
#else
#ifdef __i860__
#include "va-i860.h"
#else
#ifdef __hppa__
#include "va-pa.h"
#else
#ifdef __mips__
#include "va-mips.h"
#else
#ifdef __sparc__
#include "va-sparc.h"
#else
#ifdef __i960__
#include "va-i960.h"
#else
#ifdef __alpha__
#include "va-alpha.h"
#else
#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__)
#include "va-h8300.h"
#else
#if defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32))
#include "va-ppc.h"
#else
#ifdef __arc__
#include "va-arc.h"
#else
#ifdef __M32R__
#include "va-m32r.h"
#else
#ifdef __sh__
#include "va-sh.h"
#else
#ifdef __mn10300__
#include "va-mn10300.h"
#else
#ifdef __mn10200__
#include "va-mn10200.h"
#else
#ifdef __v850__
#include "va-v850.h"
#else
/* Define __gnuc_va_list. */
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__)
typedef char *__gnuc_va_list;
#else
typedef void *__gnuc_va_list;
#endif
#endif
/* Define the standard macros for the user,
if this invocation was from the user program. */
#ifdef _STDARG_H
/* Amount of space required in an argument list for an arg of type TYPE.
TYPE may alternatively be an expression whose type is used. */
#if defined(sysV68)
#define __va_rounded_size(TYPE) \
(((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
#else
#define __va_rounded_size(TYPE) \
(((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#endif
#define va_start(AP, LASTARG) \
(AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
#undef va_end
void va_end (__gnuc_va_list); /* Defined in libgcc.a */
#define va_end(AP) ((void)0)
/* We cast to void * and then to TYPE * because this avoids
a warning about increasing the alignment requirement. */
#if (defined (__arm__) && ! defined (__ARMEB__)) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
/* This is for little-endian machines; small args are padded upward. */
#define va_arg(AP, TYPE) \
(AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
*((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
#else /* big-endian */
/* This is for big-endian machines; small args are padded downward. */
#define va_arg(AP, TYPE) \
(AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
*((TYPE *) (void *) ((char *) (AP) \
- ((sizeof (TYPE) < __va_rounded_size (char) \
? sizeof (TYPE) : __va_rounded_size (TYPE))))))
#endif /* big-endian */
/* Copy __gnuc_va_list into another variable of this type. */
#define __va_copy(dest, src) (dest) = (src)
#endif /* _STDARG_H */
#endif /* not v850 */
#endif /* not mn10200 */
#endif /* not mn10300 */
#endif /* not sh */
#endif /* not m32r */
#endif /* not arc */
#endif /* not powerpc with V.4 calling sequence */
#endif /* not h8300 */
#endif /* not alpha */
#endif /* not i960 */
#endif /* not sparc */
#endif /* not mips */
#endif /* not hppa */
#endif /* not i860 */
#endif /* not m88k */
#endif /* not clipper */
#ifdef _STDARG_H
/* Define va_list, if desired, from __gnuc_va_list. */
/* We deliberately do not define va_list when called from
stdio.h, because ANSI C says that stdio.h is not supposed to define
va_list. stdio.h needs to have access to that data type,
but must not use that name. It should use the name __gnuc_va_list,
which is safe because it is reserved for the implementation. */
#ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
#undef _VA_LIST
#endif
#ifdef _BSD_VA_LIST
#undef _BSD_VA_LIST
#endif
#if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST))
/* SVR4.2 uses _VA_LIST for an internal alias for va_list,
so we must avoid testing it and setting it here.
SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
have no conflict with that. */
#ifndef _VA_LIST_
#define _VA_LIST_
#ifdef __i860__
#ifndef _VA_LIST
#define _VA_LIST va_list
#endif
#endif /* __i860__ */
typedef __gnuc_va_list va_list;
#ifdef _SCO_DS
#define __VA_LIST
#endif
#endif /* _VA_LIST_ */
#else /* not __svr4__ || _SCO_DS */
/* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
But on BSD NET2 we must not test or define or undef it.
(Note that the comments in NET 2's ansi.h
are incorrect for _VA_LIST_--see stdio.h!) */
#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
/* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
#ifndef _VA_LIST_DEFINED
/* The macro _VA_LIST is used in SCO Unix 3.2. */
#ifndef _VA_LIST
/* The macro _VA_LIST_T_H is used in the Bull dpx2 */
#ifndef _VA_LIST_T_H
typedef __gnuc_va_list va_list;
#endif /* not _VA_LIST_T_H */
#endif /* not _VA_LIST */
#endif /* not _VA_LIST_DEFINED */
#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
#define _VA_LIST_
#endif
#ifndef _VA_LIST
#define _VA_LIST
#endif
#ifndef _VA_LIST_DEFINED
#define _VA_LIST_DEFINED
#endif
#ifndef _VA_LIST_T_H
#define _VA_LIST_T_H
#endif
#endif /* not _VA_LIST_, except on certain systems */
#endif /* not __svr4__ */
#endif /* _STDARG_H */
#endif /* not _ANSI_STDARG_H_ */
#endif /* not _STDARG_H */

276
include/va-mips.h Normal file
View File

@ -0,0 +1,276 @@
/* ---------------------------------------- */
/* VARARGS for MIPS/GNU CC */
/* */
/* */
/* */
/* */
/* ---------------------------------------- */
/* These macros implement varargs for GNU C--either traditional or ANSI. */
/* Define __gnuc_va_list. */
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
#if defined (__mips_eabi) && ! defined (__mips_soft_float) && ! defined (__mips_single_float)
typedef struct {
/* Pointer to FP regs. */
char *__fp_regs;
/* Number of FP regs remaining. */
int __fp_left;
/* Pointer to GP regs followed by stack parameters. */
char *__gp_regs;
} __gnuc_va_list;
#else /* ! (defined (__mips_eabi) && ! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
typedef char * __gnuc_va_list;
#endif /* ! (defined (__mips_eabi) && ! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
#endif /* not __GNUC_VA_LIST */
/* If this is for internal libc use, don't define anything but
__gnuc_va_list. */
#if defined (_STDARG_H) || defined (_VARARGS_H)
#ifndef _VA_MIPS_H_ENUM
#define _VA_MIPS_H_ENUM
enum {
__no_type_class = -1,
__void_type_class,
__integer_type_class,
__char_type_class,
__enumeral_type_class,
__boolean_type_class,
__pointer_type_class,
__reference_type_class,
__offset_type_class,
__real_type_class,
__complex_type_class,
__function_type_class,
__method_type_class,
__record_type_class,
__union_type_class,
__array_type_class,
__string_type_class,
__set_type_class,
__file_type_class,
__lang_type_class
};
#endif
/* In GCC version 2, we want an ellipsis at the end of the declaration
of the argument list. GCC version 1 can't parse it. */
#if __GNUC__ > 1
#define __va_ellipsis ...
#else
#define __va_ellipsis
#endif
#ifdef __mips64
#define __va_rounded_size(__TYPE) \
(((sizeof (__TYPE) + 8 - 1) / 8) * 8)
#else
#define __va_rounded_size(__TYPE) \
(((sizeof (__TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#endif
#ifdef __mips64
#define __va_reg_size 8
#else
#define __va_reg_size 4
#endif
/* Get definitions for _MIPS_SIM_ABI64 etc. */
#ifdef _MIPS_SIM
#include <sgidefs.h>
#endif
#ifdef _STDARG_H
#if defined (__mips_eabi)
#if ! defined (__mips_soft_float) && ! defined (__mips_single_float)
#ifdef __mips64
#define va_start(__AP, __LASTARG) \
(__AP.__gp_regs = ((char *) __builtin_next_arg (__LASTARG) \
- (__builtin_args_info (2) < 8 \
? (8 - __builtin_args_info (2)) * __va_reg_size \
: 0)), \
__AP.__fp_left = 8 - __builtin_args_info (3), \
__AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * __va_reg_size)
#else /* ! defined (__mips64) */
#define va_start(__AP, __LASTARG) \
(__AP.__gp_regs = ((char *) __builtin_next_arg (__LASTARG) \
- (__builtin_args_info (2) < 8 \
? (8 - __builtin_args_info (2)) * __va_reg_size \
: 0)), \
__AP.__fp_left = (8 - __builtin_args_info (3)) / 2, \
__AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * 8, \
__AP.__fp_regs = (char *) ((int) __AP.__fp_regs & -8))
#endif /* ! defined (__mips64) */
#else /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float) ) */
#define va_start(__AP, __LASTARG) \
(__AP = ((__gnuc_va_list) __builtin_next_arg (__LASTARG) \
- (__builtin_args_info (2) >= 8 ? 0 \
: (8 - __builtin_args_info (2)) * __va_reg_size)))
#endif /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float) ) */
#else /* ! defined (__mips_eabi) */
#define va_start(__AP, __LASTARG) \
(__AP = (__gnuc_va_list) __builtin_next_arg (__LASTARG))
#endif /* ! (defined (__mips_eabi) && ! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
#else /* ! _STDARG_H */
#define va_alist __builtin_va_alist
#ifdef __mips64
/* This assumes that `long long int' is always a 64 bit type. */
#define va_dcl long long int __builtin_va_alist; __va_ellipsis
#else
#define va_dcl int __builtin_va_alist; __va_ellipsis
#endif
#if defined (__mips_eabi)
#if ! defined (__mips_soft_float) && ! defined (__mips_single_float)
#ifdef __mips64
#define va_start(__AP) \
(__AP.__gp_regs = ((char *) __builtin_next_arg () \
- (__builtin_args_info (2) < 8 \
? (8 - __builtin_args_info (2)) * __va_reg_size \
: __va_reg_size)), \
__AP.__fp_left = 8 - __builtin_args_info (3), \
__AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * __va_reg_size)
#else /* ! defined (__mips64) */
#define va_start(__AP) \
(__AP.__gp_regs = ((char *) __builtin_next_arg () \
- (__builtin_args_info (2) < 8 \
? (8 - __builtin_args_info (2)) * __va_reg_size \
: __va_reg_size)), \
__AP.__fp_left = (8 - __builtin_args_info (3)) / 2, \
__AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * 8, \
__AP.__fp_regs = (char *) ((int) __AP.__fp_regs & -8))
#endif /* ! defined (__mips64) */
#else /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
#define va_start(__AP) \
(__AP = ((__gnuc_va_list) __builtin_next_arg () \
- (__builtin_args_info (2) >= 8 ? __va_reg_size \
: (8 - __builtin_args_info (2)) * __va_reg_size)))
#endif /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
/* Need alternate code for _MIPS_SIM_ABI64. */
#elif defined(_MIPS_SIM) && (_MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32)
#define va_start(__AP) \
(__AP = (__gnuc_va_list) __builtin_next_arg () \
+ (__builtin_args_info (2) >= 8 ? -8 : 0))
#else
#define va_start(__AP) __AP = (char *) &__builtin_va_alist
#endif
#endif /* ! _STDARG_H */
#ifndef va_end
void va_end (__gnuc_va_list); /* Defined in libgcc.a */
#endif
#define va_end(__AP) ((void)0)
#if defined (__mips_eabi)
#if ! defined (__mips_soft_float) && ! defined (__mips_single_float)
#ifdef __mips64
#define __va_next_addr(__AP, __type) \
((__builtin_classify_type (*(__type *) 0) == __real_type_class \
&& __AP.__fp_left > 0) \
? (--__AP.__fp_left, (__AP.__fp_regs += 8) - 8) \
: (__AP.__gp_regs += __va_reg_size) - __va_reg_size)
#else
#define __va_next_addr(__AP, __type) \
((__builtin_classify_type (*(__type *) 0) == __real_type_class \
&& __AP.__fp_left > 0) \
? (--__AP.__fp_left, (__AP.__fp_regs += 8) - 8) \
: (((__builtin_classify_type (* (__type *) 0) < __record_type_class \
&& __alignof__ (__type) > 4) \
? __AP.__gp_regs = (char *) (((int) __AP.__gp_regs + 8 - 1) & -8) \
: (char *) 0), \
(__builtin_classify_type (* (__type *) 0) >= __record_type_class \
? (__AP.__gp_regs += __va_reg_size) - __va_reg_size \
: ((__AP.__gp_regs += __va_rounded_size (__type)) \
- __va_rounded_size (__type)))))
#endif
#else /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
#ifdef __mips64
#define __va_next_addr(__AP, __type) \
((__AP += __va_reg_size) - __va_reg_size)
#else
#define __va_next_addr(__AP, __type) \
(((__builtin_classify_type (* (__type *) 0) < __record_type_class \
&& __alignof__ (__type) > 4) \
? __AP = (char *) (((int) __AP + 8 - 1) & -8) \
: (char *) 0), \
(__builtin_classify_type (* (__type *) 0) >= __record_type_class \
? (__AP += __va_reg_size) - __va_reg_size \
: ((__AP += __va_rounded_size (__type)) \
- __va_rounded_size (__type))))
#endif
#endif /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
#ifdef __MIPSEB__
#define va_arg(__AP, __type) \
((__va_rounded_size (__type) <= __va_reg_size) \
? *(__type *) (void *) (__va_next_addr (__AP, __type) \
+ __va_reg_size \
- sizeof (__type)) \
: (__builtin_classify_type (*(__type *) 0) >= __record_type_class \
? **(__type **) (void *) (__va_next_addr (__AP, __type) \
+ __va_reg_size \
- sizeof (char *)) \
: *(__type *) (void *) __va_next_addr (__AP, __type)))
#else
#define va_arg(__AP, __type) \
((__va_rounded_size (__type) <= __va_reg_size) \
? *(__type *) (void *) __va_next_addr (__AP, __type) \
: (__builtin_classify_type (* (__type *) 0) >= __record_type_class \
? **(__type **) (void *) __va_next_addr (__AP, __type) \
: *(__type *) (void *) __va_next_addr (__AP, __type)))
#endif
#else /* ! defined (__mips_eabi) */
/* We cast to void * and then to TYPE * because this avoids
a warning about increasing the alignment requirement. */
/* The __mips64 cases are reversed from the 32 bit cases, because the standard
32 bit calling convention left-aligns all parameters smaller than a word,
whereas the __mips64 calling convention does not (and hence they are
right aligned). */
#ifdef __mips64
#ifdef __MIPSEB__
#define va_arg(__AP, __type) \
((__type *) (void *) (__AP = (char *) ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \
+ __va_rounded_size (__type))))[-1]
#else
#define va_arg(__AP, __type) \
((__AP = (char *) ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \
+ __va_rounded_size (__type))), \
*(__type *) (void *) (__AP - __va_rounded_size (__type)))
#endif
#else /* not __mips64 */
#ifdef __MIPSEB__
/* For big-endian machines. */
#define va_arg(__AP, __type) \
((__AP = (char *) ((__alignof__ (__type) > 4 \
? ((int)__AP + 8 - 1) & -8 \
: ((int)__AP + 4 - 1) & -4) \
+ __va_rounded_size (__type))), \
*(__type *) (void *) (__AP - __va_rounded_size (__type)))
#else
/* For little-endian machines. */
#define va_arg(__AP, __type) \
((__type *) (void *) (__AP = (char *) ((__alignof__(__type) > 4 \
? ((int)__AP + 8 - 1) & -8 \
: ((int)__AP + 4 - 1) & -4) \
+ __va_rounded_size(__type))))[-1]
#endif
#endif
#endif /* ! defined (__mips_eabi) */
/* Copy __gnuc_va_list into another variable of this type. */
#define __va_copy(dest, src) (dest) = (src)
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */

220
include/varargs.h Normal file
View File

@ -0,0 +1,220 @@
/* Record that this is varargs.h; this turns off stdarg.h. */
#ifndef _VARARGS_H
#define _VARARGS_H
#ifdef __sparc__
#include "va-sparc.h"
#else
#ifdef __spur__
#include "va-spur.h"
#else
#ifdef __mips__
#include "va-mips.h"
#else
#ifdef __i860__
#include "va-i860.h"
#else
#ifdef __pyr__
#include "va-pyr.h"
#else
#ifdef __clipper__
#include "va-clipper.h"
#else
#ifdef __m88k__
#include "va-m88k.h"
#else
#if defined(__hppa__) || defined(hp800)
#include "va-pa.h"
#else
#ifdef __i960__
#include "va-i960.h"
#else
#ifdef __alpha__
#include "va-alpha.h"
#else
#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__)
#include "va-h8300.h"
#else
#if defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32))
#include "va-ppc.h"
#else
#ifdef __arc__
#include "va-arc.h"
#else
#ifdef __M32R__
#include "va-m32r.h"
#else
#ifdef __sh__
#include "va-sh.h"
#else
#ifdef __mn10300__
#include "va-mn10300.h"
#else
#ifdef __mn10200__
#include "va-mn10200.h"
#else
#ifdef __v850__
#include "va-v850.h"
#else
#ifdef __NeXT__
/* On Next, erase any vestiges of stdarg.h. */
#ifdef _ANSI_STDARG_H_
#define _VA_LIST_
#endif
#define _ANSI_STDARG_H_
#undef va_alist
#undef va_dcl
#undef va_list
#undef va_start
#undef va_end
#undef __va_rounded_size
#undef va_arg
#endif /* __NeXT__ */
/* In GCC version 2, we want an ellipsis at the end of the declaration
of the argument list. GCC version 1 can't parse it. */
#if __GNUC__ > 1
#define __va_ellipsis ...
#else
#define __va_ellipsis
#endif
/* These macros implement traditional (non-ANSI) varargs
for GNU C. */
#define va_alist __builtin_va_alist
/* The ... causes current_function_varargs to be set in cc1. */
#define va_dcl int __builtin_va_alist; __va_ellipsis
/* Define __gnuc_va_list, just as in gstdarg.h. */
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX)
typedef char *__gnuc_va_list;
#else
typedef void *__gnuc_va_list;
#endif
#endif
#define va_start(AP) AP=(char *) &__builtin_va_alist
#define va_end(AP) ((void)0)
#if defined(sysV68)
#define __va_rounded_size(TYPE) \
(((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
#else
#define __va_rounded_size(TYPE) \
(((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#endif
#if (defined (__arm__) && ! defined (__ARMEB__)) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
/* This is for little-endian machines; small args are padded upward. */
#define va_arg(AP, TYPE) \
(AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
*((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
#else /* big-endian */
/* This is for big-endian machines; small args are padded downward. */
#define va_arg(AP, TYPE) \
(AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
*((TYPE *) (void *) ((char *) (AP) \
- ((sizeof (TYPE) < __va_rounded_size (char) \
? sizeof (TYPE) : __va_rounded_size (TYPE))))))
#endif /* big-endian */
/* Copy __gnuc_va_list into another variable of this type. */
#define __va_copy(dest, src) (dest) = (src)
#endif /* not v850 */
#endif /* not mn10200 */
#endif /* not mn10300 */
#endif /* not sh */
#endif /* not m32r */
#endif /* not arc */
#endif /* not powerpc with V.4 calling sequence */
#endif /* not h8300 */
#endif /* not alpha */
#endif /* not i960 */
#endif /* not hppa */
#endif /* not m88k */
#endif /* not clipper */
#endif /* not pyr */
#endif /* not i860 */
#endif /* not mips */
#endif /* not spur */
#endif /* not sparc */
#endif /* not _VARARGS_H */
/* Define va_list from __gnuc_va_list. */
#ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
#undef _VA_LIST
#endif
#if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST))
/* SVR4.2 uses _VA_LIST for an internal alias for va_list,
so we must avoid testing it and setting it here.
SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
have no conflict with that. */
#ifndef _VA_LIST_
#define _VA_LIST_
#ifdef __i860__
#ifndef _VA_LIST
#define _VA_LIST va_list
#endif
#endif /* __i860__ */
typedef __gnuc_va_list va_list;
#ifdef _SCO_DS
#define __VA_LIST
#endif
#endif /* _VA_LIST_ */
#else /* not __svr4__ || _SCO_DS */
/* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
But on BSD NET2 we must not test or define or undef it.
(Note that the comments in NET 2's ansi.h
are incorrect for _VA_LIST_--see stdio.h!) */
/* Michael Eriksson <mer@sics.se> at Thu Sep 30 11:00:57 1993:
Sequent defines _VA_LIST_ in <machine/machtypes.h> to be the type to
use for va_list (``typedef _VA_LIST_ va_list'') */
#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
/* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
#ifndef _VA_LIST_DEFINED
/* The macro _VA_LIST is used in SCO Unix 3.2. */
#ifndef _VA_LIST
/* The macro _VA_LIST_T_H is used in the Bull dpx2 */
#ifndef _VA_LIST_T_H
typedef __gnuc_va_list va_list;
#endif /* not _VA_LIST_T_H */
#endif /* not _VA_LIST */
#endif /* not _VA_LIST_DEFINED */
#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
#define _VA_LIST_
#endif
#ifndef _VA_LIST
#define _VA_LIST
#endif
#ifndef _VA_LIST_DEFINED
#define _VA_LIST_DEFINED
#endif
#ifndef _VA_LIST_T_H
#define _VA_LIST_T_H
#endif
#endif /* not _VA_LIST_, except on certain systems */
#endif /* not __svr4__ */
/* The next BSD release (if there is one) wants this symbol to be
undefined instead of _VA_LIST_. */
#ifdef _BSD_VA_LIST
#undef _BSD_VA_LIST
#endif

View File

@ -522,8 +522,62 @@ INCLUDE_ASM(void, "code_102c80", func_802E246C, Entity* entity, void* arg1, void
INCLUDE_ASM(s32, "code_102c80", func_802E263C); INCLUDE_ASM(s32, "code_102c80", func_802E263C);
INCLUDE_ASM(s32, "code_102c80", func_802E2BA4); #ifdef NON_MATCHING
// display list issues
void func_802E2BA4(s32 entityIndex) {
Gfx* temp_s2;
struct802E1400* temp_s4;
struct802E2BA4* phi_fp;
Matrix4f subroutine_arg6;
Matrix4f subroutine_arg16;
Matrix4f subroutine_arg36;
Matrix4f subroutine_arg48;
s32 i;
f32 x_inv;
f32 y_inv;
f32 z_inv;
Entity* entity;
f32 threeSixty;
f32 someFloat;
f32 one;
s16 temp;
temp_s2 = gMasterGfxPos;
threeSixty = 360.0f;
someFloat = 0.00390625f;
entity = get_entity_by_index(entityIndex);
temp_s4 = entity->dataBuf;
x_inv = -entity->position.x;
y_inv = -entity->position.y;
z_inv = -entity->position.z;
phi_fp = temp_s4->unk_34;
for(i = 0; i < 24; i++) {
if (temp_s4->unk_3C.s == 0xFF) {
gDPSetRenderMode(temp_s2++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
gDPSetCombineMode(temp_s2++, G_CC_MODULATEIA, G_CC_MODULATEIA);
} else {
gDPSetCombineLERP(temp_s2++, 0, 0, 0, TEXEL0, SHADE, 0, TEXEL0, 0, 0, 0, 0, TEXEL0, TEXEL0, 0, SHADE, 0);
gDPSetPrimColor(temp_s2++, 0, 0, 0x00, 0x00, 0x00, temp_s4->unk_3C.b[1])
}
guTranslateF(&subroutine_arg6, x_inv, y_inv, z_inv);
guRotateF(&subroutine_arg36, temp_s4->unk_8B[i] * threeSixty * someFloat, 1.0f, 0.0f, 0.0f);
guRotateF(&subroutine_arg48, temp_s4->unk_A4[i] * threeSixty * someFloat, 0.0f, 1.0f, 0.0f);
guMtxCatF(&subroutine_arg36, &subroutine_arg48, &subroutine_arg48);
guMtxCatF(&subroutine_arg48, &subroutine_arg6, &subroutine_arg6);
guTranslateF(&subroutine_arg16, temp_s4->unk_C0[i], temp_s4->unk_124[i], temp_s4->unk_188[i]);
guMtxCatF(&subroutine_arg6, &subroutine_arg16, &subroutine_arg16);
guMtxF2L(&subroutine_arg16, &gDisplayContext->matrixStack[gMatrixListPos]);
gSPMatrix(temp_s2++, &gDisplayContext->matrixStack[++gMatrixListPos], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
gSPDisplayList(temp_s2++, entity->vertexData + phi_fp->unk_02[i][0]);
gSPPopMatrix(temp_s2++, G_MTX_MODELVIEW);
}
gMasterGfxPos = temp_s2;
}
#else
INCLUDE_ASM(s32, "code_102c80", func_802E2BA4);
#endif
// file split
#ifdef NON_MATCHING #ifdef NON_MATCHING
// Needs rodata support // Needs rodata support
void func_802E2EB0(Entity* entity) { void func_802E2EB0(Entity* entity) {

View File

@ -1,13 +1,85 @@
#include "common.h" #include "common.h"
INCLUDE_ASM(s32, "code_1060_len_310", func_80025C60); u32 func_80025D74(void* arg0, const unsigned char* str, s32 count);
INCLUDE_ASM(s32, "code_1060_len_310", func_80025CC0); void func_80025C60(void) {
OSPiHandle** handle = &carthandle;
osEPiWriteIo(*handle, 0xB3FF0014, 0);
osEPiWriteIo(*handle, 0xB3FF0004, 0);
osEPiWriteIo(*handle, 0xB3FF0000, 0x49533634);
}
INCLUDE_ASM(s32, "code_1060_len_310", func_80025CFC); void func_80025CC0(const char* fmt, ...) {
va_list args;
va_start(args, fmt);
INCLUDE_ASM(s32, "code_1060_len_310", func_80025D38); _Printf(&func_80025D74, NULL, fmt, args);
}
INCLUDE_ASM(s32, "code_1060_len_310", func_80025D74); void func_80025CFC(const char* fmt, ...) {
va_list args;
va_start(args, fmt);
INCLUDE_ASM(s32, "code_1060_len_310", func_80025F44); _Printf(&func_80025D74, NULL, fmt, args);
}
void func_80025D38(const char* fmt, ...) {
va_list args;
va_start(args, fmt);
_Printf(&func_80025D74, NULL, fmt, args);
}
u32 func_80025D74(void* arg0, const unsigned char* str, s32 count) {
u32 data;
s32 pos;
s32 start;
s32 end;
OSPiHandle** handle = &carthandle;
osEPiReadIo(*handle, 0xB3FF0000, &data);
if (data != 0x49533634) {
return 1;
}
osEPiReadIo(*handle, 0xB3FF0004, &data);
pos = data;
osEPiReadIo(*handle, 0xB3FF0014, &data);
start = data;
end = start + count;
if (end >= 0xffe0) {
end -= 0xffe0;
if (pos < end || start < pos) {
return 1;
}
} else {
if (start < pos && pos < end) {
return 1;
}
}
while (count) {
if (*str) {
u32 addr = 0xB3FF0020 + (start & 0xffffffc);
s32 shift = ((3 - (start & 3)) * 8);
OSPiHandle** handle2 = &carthandle;
osEPiReadIo(*handle2, addr, &data);
osEPiWriteIo(*handle2, addr, (data & ~(0xff << shift)) | (*str << shift));
start++;
if (start >= 0xffe0) {
start -= 0xffe0;
}
}
count--;
str++;
}
osEPiWriteIo(carthandle, 0xB3FF0014, start);
return 1;
}
extern const char D_80097D30[];
void func_80025F44(char* arg0, char* file, s32 line, char* arg3) {
func_80025CFC(&D_80097D30, file, line, arg0);
PANIC();
}

View File

@ -79,7 +79,7 @@ void set_actor_home_position(ActorID actorID, f32 x, f32 y, f32 z) {
actor->homePos.z = z; actor->homePos.z = z;
} }
Actor* get_actor(s32 actorID) { Actor* get_actor(ActorID actorID) {
Actor* ret = NULL; Actor* ret = NULL;
BattleStatus* battleStatus = BATTLE_STATUS; BattleStatus* battleStatus = BATTLE_STATUS;
s32 idFlag = actorID & 0x700; s32 idFlag = actorID & 0x700;

View File

@ -1,7 +1,7 @@
#include "common.h" #include "common.h"
extern Gfx D_00074210[]; extern Gfx D_80074210[];
extern Gfx D_00074230[]; extern Gfx D_80074230[];
extern int D_000759B0[]; extern int D_000759B0[];
extern int D_000759B0_end[]; // A55D0 extern int D_000759B0_end[]; // A55D0
@ -37,9 +37,9 @@ INCLUDE_ASM(s32, "code_1b40_len_20b0", func_800269EC);
INCLUDE_ASM(s32, "code_1b40_len_20b0", gfx_draw_frame); INCLUDE_ASM(s32, "code_1b40_len_20b0", gfx_draw_frame);
INCLUDE_ASM(s32, "code_1b40_len_20b0", load_engine_data); #ifdef NON_MATCHING
/*void load_engine_data(void) { void load_engine_data(void) {
game_status *phi_s0; GameStatus *phi_s0;
s32 i; s32 i;
dma_copy(D_000FEE30, D_000FEE30_end, D_802DBD40); dma_copy(D_000FEE30, D_000FEE30_end, D_802DBD40);
@ -50,19 +50,19 @@ INCLUDE_ASM(s32, "code_1b40_len_20b0", load_engine_data);
dma_copy(D_0010CC10, D_0010CC10_end, D_802EB3D0); dma_copy(D_0010CC10, D_0010CC10_end, D_802EB3D0);
D_8009A650[0] = 0; D_8009A650[0] = 0;
phi_s0 = *gGameStatusPtr; phi_s0 = *gGameStatusPtr;
(*gGameStatusPtr)->unk_79 = 0; GAME_STATUS->unk_79 = 0;
(*gGameStatusPtr)->musicEnabled = 1; GAME_STATUS->musicEnabled = 1;
phi_s0->unk_148 = 0; phi_s0->unk_148 = 0;
(*gGameStatusPtr)->unk_7C = 1; GAME_STATUS->unk_7C = 1;
(*gGameStatusPtr)->unk_A8 = -1; GAME_STATUS->unk_A8 = -1;
(*gGameStatusPtr)->unk_AA = 0; GAME_STATUS->unk_AA = 0;
(*gGameStatusPtr)->unk_81 = 0; GAME_STATUS->unk_81 = 0;
(*gGameStatusPtr)->unk_82 = -8; GAME_STATUS->unk_82 = -8;
(*gGameStatusPtr)->unk_83 = 4; GAME_STATUS->unk_83 = 4;
D_8009A5D8 = 0; D_8009A5D8 = 0;
(*gGameStatusPtr)->unk_75 = (*gGameStatusPtr)->unk_13C = 0; GAME_STATUS->unk_75 = GAME_STATUS->unk_13C = 0;
D_80074021 = 5; D_80074021 = 5;
(*gGameStatusPtr)->unk_168 = 0; GAME_STATUS->unk_168 = 0;
fio_init_flash(); fio_init_flash();
func_80028838(); func_80028838();
general_heap_create(); general_heap_create();
@ -97,7 +97,7 @@ INCLUDE_ASM(s32, "code_1b40_len_20b0", load_engine_data);
func_8002BA40(); func_8002BA40();
poll_rumble(); poll_rumble();
phi_s0 = *gGameStatusPtr; phi_s0 = GAME_STATUS;
for(i = 0; i < 4; i++) for(i = 0; i < 4; i++)
{ {
phi_s0->unk_50[i] = 3; phi_s0->unk_50[i] = 3;
@ -106,7 +106,10 @@ INCLUDE_ASM(s32, "code_1b40_len_20b0", load_engine_data);
D_8009A650[0] |= 8; D_8009A650[0] |= 8;
set_game_mode(0); set_game_mode(0);
}*/ }
#else
INCLUDE_ASM(s32, "code_1b40_len_20b0", load_engine_data);
#endif
INCLUDE_ASM(void, "code_1b40_len_20b0", func_80027088, s32 arg0); INCLUDE_ASM(void, "code_1b40_len_20b0", func_80027088, s32 arg0);
@ -114,16 +117,15 @@ s32 func_80027190(void) {
return D_8009A5D8; return D_8009A5D8;
} }
#ifdef NON_MATCHING
void func_800271A0(void) {
gSPSegment(gMasterGfxPos++, 0x00, 0x0);
gSPDisplayList(gMasterGfxPos++, OS_K0_TO_PHYSICAL(&D_80074230));
gSPDisplayList(gMasterGfxPos++, OS_K0_TO_PHYSICAL(&D_80074210));
}
#else
INCLUDE_ASM(s32, "code_1b40_len_20b0", func_800271A0); INCLUDE_ASM(s32, "code_1b40_len_20b0", func_800271A0);
/*void func_800271A0(void) { #endif
Gfx *temp = gMasterGfxPos[0] + 1;
gSPSegment(gMasterGfxPos[0], 0x00, 0x00000000);
gMasterGfxPos[0] = temp;
gSPDisplayList(temp, &D_00074230);
gMasterGfxPos[0]++;
gSPDisplayList(gMasterGfxPos[0]++, &D_00074210);
}*/
INCLUDE_ASM(s32, "code_1b40_len_20b0", func_800271FC); INCLUDE_ASM(s32, "code_1b40_len_20b0", func_800271FC);

View File

@ -1,157 +1,6 @@
#include "common.h" #include "common.h"
typedef struct structE001E000 {
/* 0x000 */ s32 unk_00;
/* 0x004 */ Vec3f unk_04;
/* 0x010 */ Vec3f unk_10;
/* 0x01C */ s32 unk_1C;
/* 0x020 */ char unk_20[4];
/* 0x024 */ f32 unk_24;
/* 0x028 */ s32 unk_28;
/* 0x02C */ f32 unk_2C;
/* 0x030 */ f32 unk_30;
/* 0x034 */ f32 unk_34;
/* 0x038 */ char unk_38[4];
/* 0x03C */ s32 unk_3C;
/* 0x040 */ char unk_40[0x200];
/* 0x240 */ f32 unk_240;
/* 0x244 */ s32 unk_244;
/* 0x248 */ s32 unk_248;
/* 0x24C */ s32 unk_24C;
} structE001E000; // size = 0x250
extern Camera D_800B1DEC[2];
INCLUDE_ASM(s32, "code_331940", func_E001E000); INCLUDE_ASM(s32, "code_331940", func_E001E000);
/*
void *func_E001E000(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, f32 arg7) {
f32 temp_f0;
f32 temp_f0_2;
f32 temp_f12;
f32 temp_f20;
f32 temp_f20_2;
f32 temp_f20_3;
f32 temp_f20_4;
f32 temp_f22;
f32 temp_f22_2;
f32 temp_f24;
f32 temp_f26;
f32 temp_f2;
f32 temp_f4;
s32 temp_a0;
s32 temp_a1;
s32 temp_s0;
s32 temp_v0_2;
s32 temp_v0_3;
void *temp_s0_2;
void *temp_s1;
void *temp_s2;
void *temp_v0;
void *temp_v0_4;
f32 phi_f4;
f32 phi_f0;
f32 phi_f12;
f32 phi_f26;
void *phi_v0;
void *phi_v1;
s32 phi_a1;
f32 phi_f12_2;
void *phi_a0;
temp_s2 = func_E0200490(&subroutine_arg4, 0, 0xF, &D_E001E370, &D_E001E378, &D_E001E6E8, 0);
temp_s2->unk8 = 1;
temp_v0 = func_E02004B0(0x250); // some kind of allocation function.
temp_s1 = temp_v0;
temp_s2->unkC = temp_v0;
ASSERT(temp_s1 != NULL);
temp_s1->unk_00 = 1;
temp_s1->unk_04.x = arg1;
temp_s1->unk_04.y = arg2;
temp_s1->unk_04.z = arg3;
temp_s1->unk_1C = 0;
temp_s1->unk_24 = 0.0f;
temp_s1->unk_28 = 0;
temp_s1->unk_38 = arg0;
if (arg0 == 3) {
temp_s1->unk_240 = 0.2f;
temp_v0_2 = func_E02004E0(0xFF);
temp_a0 = 0xFF - temp_v0_2;
temp_s1->unk_244 = temp_v0_2;
temp_v0_3 = func_E02004E0(temp_a0);
temp_s0 = 0xFF - temp_v0_3;
temp_s1->unk_248 = temp_v0_3;
temp_s1->unk_24C = (s32) (temp_s0 - temp_s1->unk_244);
} else {
temp_s1->unk_244 = 0xD2;
temp_s1->unk_248 = 0xBA;
temp_s1->unk_24C = 0x5A;
temp_s1->unk_240 = 0.5f;
}
temp_f24 = arg4 - arg1;
temp_f22 = arg5 - arg2;
temp_f20 = arg6 - arg3;
temp_f26 = (temp_f24 * temp_f24) + (temp_f22 * temp_f22) + (temp_f20 * temp_f20);
phi_f4 = temp_f26;
phi_f26 = temp_f26;
if (temp_f26 != 0.0f) {
temp_f0 = func_E0200550(temp_f26);
phi_f4 = arg7 / temp_f0;
phi_f26 = temp_f0;
}
temp_s1->unk10.x = (f32) (temp_f24 * phi_f4);
temp_s1->unk10.y = (f32) (temp_f22 * phi_f4);
temp_s1->unk10.z = (f32) (temp_f20 * phi_f4);
temp_f20_2 = *(&D_800B1DEC + (gCurrentCameraID * 0x558));
temp_f22_2 = -func_E0200510(temp_f20_2);
temp_f4 = temp_f22_2 * temp_s1->unk10;
temp_f20_3 = -func_E0200500(temp_f20_2);
temp_f2 = temp_f20_3 * temp_s1->unk18;
temp_f12 = (temp_f4 * temp_f4) + (temp_f2 * temp_f2);
phi_f12_2 = temp_f12;
if (temp_f12 != 0.0f) {
phi_f12_2 = func_E0200550(temp_f12);
}
if (((temp_f22_2 * temp_s1->unk10) + (temp_f20_3 * temp_s1->unk18)) < 0.0f) {
phi_f0 = -20.0f;
phi_f12 = -phi_f12_2;
} else {
phi_f0 = 20.0f;
phi_f12 = phi_f12_2;
}
temp_s1->unk2C = phi_f0;
temp_f20_4 = -phi_f12;
temp_f0_2 = func_E0200520(0, 0, -temp_s1->unk14, temp_f20_4);
temp_s1->unk_30 = (bitwise f32) (s32) (phi_f26 / arg7);
temp_s0_2 = temp_s1 + 0x40;
temp_s1->unk24 = temp_f0_2;
temp_s1->unk20 = temp_f0_2;
temp_s1->unk34 = temp_f20_4;
func_E0200430(temp_s0_2, (bitwise s32) temp_s1->unk4, (bitwise s32) temp_s1->unk8, (bitwise s32) temp_s1->unkC);
phi_a1 = 1;
phi_a0 = temp_s0_2;
loop_13:
phi_v0 = temp_s0_2;
phi_v1 = phi_a0 + 0x40;
loop_14:
phi_v1->unk0 = (s32) phi_v0->unk0;
phi_v1->unk4 = (s32) phi_v0->unk4;
phi_v1->unk8 = (s32) phi_v0->unk8;
phi_v1->unkC = (s32) phi_v0->unkC;
temp_v0_4 = phi_v0 + 0x10;
phi_v0 = temp_v0_4;
phi_v1 = phi_v1 + 0x10;
if (temp_v0_4 != (temp_s1 + 0x80)) {
goto loop_14;
}
temp_a1 = phi_a1 + 1;
phi_a1 = temp_a1;
phi_a0 = phi_a0 + 0x40;
if (temp_a1 < 8) {
goto loop_13;
}
temp_s1->unk3C = -1;
return temp_s2;
}*/
INCLUDE_ASM(s32, "code_331940", func_E001E370); INCLUDE_ASM(s32, "code_331940", func_E001E370);

225
src/code_341d0.c Normal file
View File

@ -0,0 +1,225 @@
#include "common.h"
INCLUDE_ASM(s32, "code_341d0", func_80058DD0);
INCLUDE_ASM(s32, "code_341d0", func_80058E84);
INCLUDE_ASM(s32, "code_341d0", func_80058F88);
INCLUDE_ASM(s32, "code_341d0", func_80059008);
INCLUDE_ASM(s32, "code_341d0", func_8005904C);
INCLUDE_ASM(s32, "code_341d0", func_80059310);
INCLUDE_ASM(s32, "code_341d0", func_800598A0);
INCLUDE_ASM(s32, "code_341d0", func_80059AB8);
INCLUDE_ASM(s32, "code_341d0", func_80059BD4);
void func_80059C80(EffectInstance* effectInst) {
}
INCLUDE_ASM(s32, "code_341d0", func_80059C88);
INCLUDE_ASM(s32, "code_341d0", func_80059C9C);
void func_80059D48(void) {
}
INCLUDE_ASM(s32, "code_341d0", func_80059D50);
#define EFFECT_LOADED 1
extern EffectInstance* D_800B4398[96]; //effectInstanceList
extern Effect D_800A4000[15];
extern void* D_80059C80;
s32 render_effects(void) {
EffectInstance** curEffectInst;
s32 i;
curEffectInst = &D_800B4398[0];
for(i = 0; i < ARRAY_COUNT(D_800B4398); i++) {
if ((curEffectInst[i] != NULL) && ((curEffectInst[i]->flags & 1) != 0) && ((curEffectInst[i]->flags & 8) != 0)) {
if(GAME_STATUS->isBattle) {
if((curEffectInst[i]->flags & 4) != 0) {
curEffectInst[i]->effect->renderWorld(curEffectInst[i]);
}
} else if((curEffectInst[i]->flags & 4) == 0) {
curEffectInst[i]->effect->renderWorld(curEffectInst[i]);
}
}
}
}
INCLUDE_ASM(s32, "code_341d0", func_80059F94);
EffectInstance* func_8005A2BC(EffectBlueprint* effectBp) {
EffectInstance *newEffectInst;
Effect* curEffect;
s32 i;
EffectInstance** temp = &D_800B4398[0];
// Search for an unused instance
for(i = 0; i < ARRAY_COUNT(D_800B4398); i++) {
if (temp[i] == NULL) {
break;
}
}
ASSERT(i < ARRAY_COUNT(D_800B4398));
// Allocate space for the new instance
D_800B4398[i] = newEffectInst = general_heap_malloc(sizeof(EffectInstance));
ASSERT(newEffectInst != NULL);
curEffect = &D_800A4000[0];
newEffectInst->effectIndex = effectBp->effectIndex;
newEffectInst->flags = 1;
// Look for a loaded effect of the proper index
for(i = 0; i < ARRAY_COUNT(D_800A4000); i++) {
if ((curEffect->flags & EFFECT_LOADED) && (curEffect->effectIndex == effectBp->effectIndex)) {
break;
}
curEffect++;
}
ASSERT(i < ARRAY_COUNT(D_800A4000));
// If this is the first new instance of the effect, initialize the function pointers
if (curEffect->instanceCounter == 0) {
curEffect->update = effectBp->update;
if (curEffect->update == NULL) {
curEffect->renderWorld = func_80059C80;
}
curEffect->renderWorld = effectBp->renderWorld;
if (curEffect->unk_18 == NULL) {
curEffect->unk_18 = func_80059C80;
}
curEffect->unk_18 = effectBp->unk_14;
if (curEffect->unk_18 == NULL) {
curEffect->unk_18 = func_80059C80;
}
}
curEffect->instanceCounter++;
newEffectInst->effect = curEffect;
if (effectBp->init != NULL) {
effectBp->init(newEffectInst);
}
if (GAME_STATUS->isBattle) {
newEffectInst->flags |= 4;
}
return newEffectInst;
}
void remove_effect(EffectInstance* arg0) {
s32 i;
EffectInstance** temp = &D_800B4398[0];
for(i = 0; i < ARRAY_COUNT(D_800B4398); i++) {
if (temp[i] == arg0) {
break;
}
}
ASSERT(i < ARRAY_COUNT(D_800B4398));
if (arg0->unk_0C == NULL) {
general_heap_free(arg0);
D_800B4398[i] = NULL;
return;
}
general_heap_free(arg0->unk_0C);
general_heap_free(arg0);
D_800B4398[i] = NULL;
}
void remove_all_effects(void) {
s32 i;
EffectInstance** temp = &D_800B4398[0];
for(i = 0; i < ARRAY_COUNT(D_800B4398); i++) {
EffectInstance* temp2 = temp[i];
if (temp2 != NULL && temp2->flags & 4) {
if(temp2->unk_0C != NULL) {
general_heap_free(temp2->unk_0C);
}
general_heap_free(temp2);
temp[i] = NULL;
}
}
}
typedef s32 TlbEntry[0x1000 / 4];
typedef TlbEntry TlbMappablePage[15];
extern TlbMappablePage D_80197000;
extern EffectTableEntry D_8007F210[135];
s32 play_effect(s32 effectIndex) {
EffectTableEntry* effectTable = &D_8007F210[0];
EffectTableEntry* effectEntry;
Effect* curEffect;
TlbMappablePage* tlbMappablePages;
s32 i;
effectEntry = &effectTable[effectIndex];
// Look for a loaded effect matching the desired index
for(i = 0, curEffect = &D_800A4000[0]; i < ARRAY_COUNT(D_800A4000); i++) {
if ((curEffect->flags & EFFECT_LOADED) && (curEffect->effectIndex == effectIndex)) {
break;
}
curEffect++;
}
// If an effect was found within the table, initialize it and return
if (i < ARRAY_COUNT(D_800A4000)) {
curEffect->effectIndex = effectIndex;
curEffect->instanceCounter = 0;
curEffect->flags = EFFECT_LOADED;
return 1;
}
// If a loaded effect wasn't found, look for the first empty space
for(i = 0, curEffect = &D_800A4000[0]; i < ARRAY_COUNT(D_800A4000); i++) {
if (!(curEffect->flags & EFFECT_LOADED)) {
break;
}
curEffect++;
}
// If no empty space was found, panic
ASSERT(i < ARRAY_COUNT(D_800A4000));
// Map space for the effect
tlbMappablePages = &D_80197000;
osMapTLB(i, 0, effectEntry->dmaDest, (s32)((*tlbMappablePages)[i]) & 0xFFFFFF, -1, -1);
// Copy the effect into the newly mapped space
dma_copy(effectEntry->dmaStart, effectEntry->dmaEnd, effectEntry->dmaDest);
// If there's extra data the effect normally loads, allocate space and copy into the new space
if (effectEntry->unkStartRom != NULL) {
void* effectDataBuf = general_heap_malloc(effectEntry->unkEndRom - effectEntry->unkStartRom);
curEffect->unk_1C = effectDataBuf;
ASSERT(effectDataBuf != NULL);
dma_copy(effectEntry->unkStartRom, effectEntry->unkEndRom, curEffect->unk_1C);
}
// Initialize the newly loaded effect data
curEffect->effectIndex = effectIndex;
curEffect->instanceCounter = 0;
curEffect->flags = EFFECT_LOADED;
return 1;
}

View File

@ -2,236 +2,6 @@
#include "ld_addrs.h" #include "ld_addrs.h"
#include "map.h" #include "map.h"
INCLUDE_ASM(s32, "world/world", func_80058DD0);
INCLUDE_ASM(s32, "world/world", func_80058E84);
INCLUDE_ASM(s32, "world/world", func_80058F88);
INCLUDE_ASM(s32, "world/world", func_80059008);
INCLUDE_ASM(s32, "world/world", func_8005904C);
INCLUDE_ASM(s32, "world/world", func_80059310);
INCLUDE_ASM(s32, "world/world", func_800598A0);
INCLUDE_ASM(s32, "world/world", func_80059AB8);
INCLUDE_ASM(s32, "world/world", func_80059BD4);
void func_80059C80(EffectInstance* effectInst) {
}
INCLUDE_ASM(s32, "world/world", func_80059C88);
INCLUDE_ASM(s32, "world/world", func_80059C9C);
void func_80059D48(void) {
}
INCLUDE_ASM(s32, "world/world", func_80059D50);
#define EFFECT_LOADED 1
extern EffectInstance* D_800B4398[96]; //effectInstanceList
extern Effect D_800A4000[15];
extern void* D_80059C80;
s32 render_effects(void) {
EffectInstance** curEffectInst;
s32 i;
curEffectInst = &D_800B4398[0];
for(i = 0; i < ARRAY_COUNT(D_800B4398); i++) {
if ((curEffectInst[i] != NULL) && ((curEffectInst[i]->flags & 1) != 0) && ((curEffectInst[i]->flags & 8) != 0)) {
if(GAME_STATUS->isBattle) {
if((curEffectInst[i]->flags & 4) != 0) {
curEffectInst[i]->effect->renderWorld(curEffectInst[i]);
}
} else if((curEffectInst[i]->flags & 4) == 0) {
curEffectInst[i]->effect->renderWorld(curEffectInst[i]);
}
}
}
}
INCLUDE_ASM(s32, "world/world", func_80059F94);
EffectInstance* func_8005A2BC(EffectBlueprint* effectBp) {
EffectInstance *newEffectInst;
Effect* curEffect;
s32 i;
EffectInstance** temp = &D_800B4398[0];
// Search for an unused instance
for(i = 0; i < ARRAY_COUNT(D_800B4398); i++) {
if (temp[i] == NULL) {
break;
}
}
ASSERT(i < ARRAY_COUNT(D_800B4398));
// Allocate space for the new instance
D_800B4398[i] = newEffectInst = general_heap_malloc(sizeof(EffectInstance));
ASSERT(newEffectInst != NULL);
curEffect = &D_800A4000[0];
newEffectInst->effectIndex = effectBp->effectIndex;
newEffectInst->flags = 1;
// Look for a loaded effect of the proper index
for(i = 0; i < ARRAY_COUNT(D_800A4000); i++) {
if ((curEffect->flags & EFFECT_LOADED) && (curEffect->effectIndex == effectBp->effectIndex)) {
break;
}
curEffect++;
}
ASSERT(i < ARRAY_COUNT(D_800A4000));
// If this is the first new instance of the effect, initialize the function pointers
if (curEffect->instanceCounter == 0) {
curEffect->update = effectBp->update;
if (curEffect->update == NULL) {
curEffect->renderWorld = func_80059C80;
}
curEffect->renderWorld = effectBp->renderWorld;
if (curEffect->unk_18 == NULL) {
curEffect->unk_18 = func_80059C80;
}
curEffect->unk_18 = effectBp->unk_14;
if (curEffect->unk_18 == NULL) {
curEffect->unk_18 = func_80059C80;
}
}
curEffect->instanceCounter++;
newEffectInst->effect = curEffect;
if (effectBp->init != NULL) {
effectBp->init(newEffectInst);
}
if (GAME_STATUS->isBattle) {
newEffectInst->flags |= 4;
}
return newEffectInst;
}
void remove_effect(EffectInstance* arg0) {
s32 i;
EffectInstance** temp = &D_800B4398[0];
for(i = 0; i < ARRAY_COUNT(D_800B4398); i++) {
if (temp[i] == arg0) {
break;
}
}
ASSERT(i < ARRAY_COUNT(D_800B4398));
if (arg0->unk_0C == NULL) {
general_heap_free(arg0);
D_800B4398[i] = NULL;
return;
}
general_heap_free(arg0->unk_0C);
general_heap_free(arg0);
D_800B4398[i] = NULL;
}
void remove_all_effects(void) {
s32 i;
EffectInstance** temp = &D_800B4398[0];
for(i = 0; i < ARRAY_COUNT(D_800B4398); i++) {
EffectInstance* temp2 = temp[i];
if (temp2 != NULL && temp2->flags & 4) {
if(temp2->unk_0C != NULL) {
general_heap_free(temp2->unk_0C);
}
general_heap_free(temp2);
temp[i] = NULL;
}
}
}
typedef s32 TlbEntry[0x1000 / 4];
typedef TlbEntry TlbMappablePage[15];
extern TlbMappablePage D_80197000;
extern EffectTableEntry D_8007F210[135];
#ifdef NON_MATCHING
// Matching, but needs a file split
s32 play_effect(s32 effectIndex) {
EffectTableEntry* effectTable = &D_8007F210[0];
EffectTableEntry* effectEntry;
Effect* curEffect;
TlbMappablePage* tlbMappablePages;
s32 i;
effectEntry = &effectTable[effectIndex];
// Look for a loaded effect matching the desired index
for(i = 0, curEffect = &D_800A4000[0]; i < ARRAY_COUNT(D_800A4000); i++) {
if ((curEffect->flags & EFFECT_LOADED) && (curEffect->effectIndex == effectIndex)) {
break;
}
curEffect++;
}
// If an effect was found within the table, initialize it and return
if (i < ARRAY_COUNT(D_800A4000)) {
curEffect->effectIndex = effectIndex;
curEffect->unk_08 = NULL;
curEffect->flags = EFFECT_LOADED;
return 1;
}
// If a loaded effect wasn't found, look for the first empty space
for(i = 0, curEffect = &D_800A4000[0]; i < ARRAY_COUNT(D_800A4000); i++) {
if (!(curEffect->flags & EFFECT_LOADED)) {
break;
}
curEffect++;
}
// If no empty space was found, panic
ASSERT(i < ARRAY_COUNT(D_800A4000));
// Map space for the effect
tlbMappablePages = &D_80197000;
osMapTLB(i, 0, effectEntry->dmaDest, (s32)((*tlbMappablePages)[i]) & 0xFFFFFF, -1, -1);
// Copy the effect into the newly mapped space
dma_copy(effectEntry->dmaStart, effectEntry->dmaEnd, effectEntry->dmaDest);
// If there's extra data the effect normally loads, allocate space and copy into the new space
if (effectEntry->unkStartRom != NULL) {
void* effectDataBuf = general_heap_malloc(effectEntry->unkEndRom - effectEntry->unkStartRom);
curEffect->unk_1C = effectDataBuf;
ASSERT(effectDataBuf != NULL);
dma_copy(effectEntry->unkStartRom, effectEntry->unkEndRom, curEffect->unk_1C);
}
// Initialize the newly loaded effect data
curEffect->effectIndex = effectIndex;
curEffect->unk_08 = NULL;
curEffect->flags = EFFECT_LOADED;
return 1;
}
#else
INCLUDE_ASM(s32, "world/world", play_effect);
#endif
// FILE SPLIT
void load_world_script_api(void) { void load_world_script_api(void) {
dma_copy(&world_script_api_ROM_START, &world_script_api_ROM_END, &world_script_api_VRAM); dma_copy(&world_script_api_ROM_START, &world_script_api_ROM_END, &world_script_api_VRAM);
} }

View File

@ -63,7 +63,8 @@ segments:
- [0x2e230, c, code_2e230_len_2190] - [0x2e230, c, code_2e230_len_2190]
- [0x303c0, c, code_303c0_len_3e10] - [0x303c0, c, code_303c0_len_3e10]
- [0x31650, c, code_31650] - [0x31650, c, code_31650]
- [0x341d0, c, world/world] - [0x341d0, c, code_341d0]
- [0x35ac0, c, world/world]
- [0x362a0, c, code_362a0_len_2f70] - [0x362a0, c, code_362a0_len_2f70]
- [0x39210, c, code_39210_len_aa0] - [0x39210, c, code_39210_len_aa0]
- [0x39cb0, c, os/code_39cb0_len_100] - [0x39cb0, c, os/code_39cb0_len_100]
@ -214,7 +215,8 @@ segments:
- [0x6EAC0, data] # has scripts - [0x6EAC0, data] # has scripts
- [0x70E30, .data, battle/battle] - [0x70E30, .data, battle/battle]
- [0x71430, data] - [0x71430, data]
- [0x73130, rodata] - [0x73130, .rodata, code_1060_len_310]
- [0x73148, rodata]
- [0x73DA0, .rodata, world/world] - [0x73DA0, .rodata, world/world]
- [0x74EA0, rodata] - [0x74EA0, rodata]
- [0x75240, .rodata, battle/battle] # ram 80099E40 - [0x75240, .rodata, battle/battle] # ram 80099E40