Initialise FFT Game state

From Final Fantasy Hacktics Wiki
Revision as of 02:03, 15 December 2024 by Talcall (talk | contribs)
Jump to navigation Jump to search

00040a00: 27bdffe0 addiu r29,r29,0xffe0
00040a04: afb10014 sw r17,0x0014(r29)
00040a08: 34110005 ori r17,r0,0x0005		#r17 = 5
00040a0c: afb20018 sw r18,0x0018(r29)
00040a10: 34120002 ori r18,r0,0x0002		#r18 = 2
00040a14: afb00010 sw r16,0x0010(r29)
00040a18: 34100003 ori r16,r0,0x0003		#r16 = 3
00040a1c: afbf001c sw r31,0x001c(r29)
00040a20: 3c018004 lui r1,0x8004
00040a24: ac205978 sw r0,0x5978(r1)
00040a28: 0c010a84 jal 0x00042a10		#Starting Inventory
00040a2c: 00000000 nop
00040a30: 3c028004 lui r2,0x8004
00040a34: 8c425978 lw r2,0x5978(r2)		#a loop counter maybe?
00040a38: 00000000 nop
00040a3c: 10510004 beq r2,r17,0x00040a50	# branch if above equals 5
00040a40: 34040001 ori r4,r0,0x0001
00040a44: 0c0109a4 jal 0x00042690		#00042690 - 000427a0
00040a48: 00000000 nop
00040a4c: 00002021 addu r4,r0,r0
00040a50: 0c01162e jal 0x000458b8		#Get OPEN.BIN to RAM 1 OPEN.BIN Routines
00040a54: 00000000 nop
00040a58: 1440000b bne r2,r0,0x00040a88	# 
00040a5c: 34020001 ori r2,r0,0x0001
00040a60: 3c018004 lui r1,0x8004
00040a64: a02273a0 sb r2,0x73a0(r1)            # mark as file opened in this space
00040a68: 3c018004 lui r1,0x8004
00040a6c: ac205978 sw r0,0x5978(r1)            # ? 
00040a70: 080102a4 j 0x00040a90
00040a74: 00000000 nop
00040a78: 0c01024d jal 0x00040934		#Between Gamestates: turn off sound, quit SPU
00040a7c: 00000000 nop
00040a80: 080102c0 j 0x00040b00
00040a84: 00000000 nop
00040a88: 3c018004 lui r1,0x8004
00040a8c: a02073a0 sb r0,0x73a0(r1)
00040a90: 3c028004 lui r2,0x8004
00040a94: 904273a0 lbu r2,0x73a0(r2)           # if open.bin is still open, don't open WORLD.BIN or WLDCORE.BIN
00040a98: 00000000 nop
00040a9c: 14400005 bne r2,r0,0x00040ab4        # 
00040aa0: 00000000 nop
00040aa4: 0c011473 jal 0x000451cc		#Open WORLD.BIN & WLDCORE.BIN WORLD.BIN Routines
00040aa8: 34040001 ori r4,r0,0x0001
00040aac: 3c018004 lui r1,0x8004
00040ab0: ac225978 sw r2,0x5978(r1)		# store return to counter thing
00040ab4: 3c028004 lui r2,0x8004
00040ab8: 8c425978 lw r2,0x5978(r2)
00040abc: 00000000 nop
00040ac0: 1051000f beq r2,r17,0x00040b00	#branch if counter thing is 5
00040ac4: 00000000 nop
00040ac8: 0c010271 jal 0x000409c4		#Get BATTLE.BIN Contains jump to space of nops - Worth investigation? anyway, BATTLE.BIN Routines
00040acc: 00000000 nop
00040ad0: 0c01e6a6 jal 0x00079a98		#Game Flow Control routine
00040ad4: 00000000 nop
00040ad8: 0c011033 jal 0x000440cc		#000440cc - 000440f0
00040adc: 00000000 nop
00040ae0: 3c02800a lui r2,0x800a
00040ae4: 8c42778c lw r2,0x778c(r2)
00040ae8: 3c018004 lui r1,0x8004
00040aec: a02073a0 sb r0,0x73a0(r1)
00040af0: 1052ffe1 beq r2,r18,0x00040a78	#loop backward if 0x800a778c is 2 
00040af4: 00000000 nop
00040af8: 1450ffe5 bne r2,r16,0x00040a90	#loop back if not credits scene
00040afc: 00000000 nop
00040b00: 3c02800a lui r2,0x800a
00040b04: 8c42778c lw r2,0x778c(r2)
00040b08: 00000000 nop
00040b0c: 1450ffc6 bne r2,r16,0x00040a28	#
00040b10: 00000000 nop
00040b14: 0c011033 jal 0x000440cc
00040b18: 00000000 nop
00040b1c: 0c010fc0 jal 0x00043f00
00040b20: 00000000 nop

Credits and post credits scene

00040b24: 34040064 ori r4,r0,0x0064
00040b28: 0c04ed91 jal 0x0013b644		#Set r5 as New Variable Value set variable 0x64 to 1 (next scenario? new game?)
00040b2c: 34050001 ori r5,r0,0x0001
00040b30: 34040027 ori r4,r0,0x0027
00040b34: 0c04ed91 jal 0x0013b644		#Set r5 as New Variable Value set variable 0x27 to 0x012a (set current event to Searching for Alma (end Chpt. 3)) // actually seems to be set to ramza funeral?
00040b38: 3405012a ori r5,r0,0x012a
00040b3c: 0c011640 jal 0x00045900              #Get OPEN.BIN to RAM 2 <- play credits sequence
00040b40: 00000000 nop
00040b44: 0c010271 jal 0x000409c4		#Get BATTLE.BIN
00040b48: 00000000 nop
00040b4c: 0c010942 jal 0x00042508
00040b50: 00000000 nop
00040b54: 0c01e6a6 jal 0x00079a98		#Game Flow Control routine <- play ramza funeral event
00040b58: 00000000 nop
00040b5c: 0c01024d jal 0x00040934
00040b60: 00000000 nop
00040b64: 0801028a j 0x00040a28		#loop back to start of routine
00040b68: 00000000 nop
00040b6c: 8fbf001c lw r31,0x001c(r29)
00040b70: 8fb20018 lw r18,0x0018(r29)
00040b74: 8fb10014 lw r17,0x0014(r29)
00040b78: 8fb00010 lw r16,0x0010(r29)
00040b7c: 27bd0020 addiu r29,r29,0x0020
00040b80: 03e00008 jr r31
00040b84: 00000000 nop