Difference between revisions of "Item Ability Loading"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(hey guys. found the routine that hardcodes that only Item is allowed to have items.)
 
Line 5: Line 5:
 
  001817c0: [[Load ability data for skillset]]
 
  001817c0: [[Load ability data for skillset]]
 
   
 
   
  00181b94: 27bdff40 addiu r29,r29,0xff40
+
  00181b94: 27bdff40 addiu r29,r29,0xff40 - 0xC0
  00181b98: afb200b0 sw r18,0x00b0(r29) Store 0x0 onto Stack
+
  00181b98: afb200b0 sw r18,0x00b0(r29)
  00181b9c: 00809021 addu r18,r4,r0
+
  00181b9c: 00809021 addu r18,r4,r0 r18 = Unit Battle ID
  00181ba0: afb000a8 sw r16,0x00a8(r29) Store 0x0 onto Stack
+
  00181ba0: afb000a8 sw r16,0x00a8(r29)
  00181ba4: 00c08021 addu r16,r6,r0
+
  00181ba4: 00c08021 addu r16,r6,r0 r16 = Stack + 0xE0
  00181ba8: afb300b4 sw r19,0x00b4(r29) Store 0x0 onto Stack
+
  00181ba8: afb300b4 sw r19,0x00b4(r29)
  00181bac: 00009821 addu r19,r0,r0
+
  00181bac: 00009821 addu r19,r0,r0 r19 = 0
  00181bb0: afb100ac sw r17,0x00ac(r29) Store 0x0 onto Stack
+
  00181bb0: afb100ac sw r17,0x00ac(r29)
  00181bb4: afbf00b8 sw r31,0x00b8(r29) Store 0x0 onto Stack
+
  00181bb4: afbf00b8 sw r31,0x00b8(r29)
 
  00181bb8: 0c060435 jal 0x001810d4 [[Load unit Data]]
 
  00181bb8: 0c060435 jal 0x001810d4 [[Load unit Data]]
  00181bbc: 00a08821 addu r17,r5,r0
+
  00181bbc: 00a08821 addu r17,r5,r0 r17 = Primary Skillset ID
 
  00181bc0: 14400003 bne r2,r0,0x00181bd0 Branch if Unit Data  != 0x0
 
  00181bc0: 14400003 bne r2,r0,0x00181bd0 Branch if Unit Data  != 0x0
  00181bc4: 322300ff andi r3,r17,0x00ff Mask second byte
+
  00181bc4: 322300ff andi r3,r17,0x00ff really stupid error check. happens *constantly* and it just bloats the routines.
 
  00181bc8: 08060726 j 0x00181c98
 
  00181bc8: 08060726 j 0x00181c98
  00181bcc: 00001021 addu r2,r0,r0
+
  00181bcc: 00001021 addu r2,r0,r0 End return 0 valid items
  00181bd0: 34020006 ori r2,r0,0x0006 r2 = (0x6) 6
+
  00181bd0: 34020006 ori r2,r0,0x0006 r2 = 0x6
  00181bd4: 14620010 bne r3,r2,0x00181c18 Branch if 0x0 != 6 (6)
+
  00181bd4: 14620010 bne r3,r2,0x00181c18 Branch if skillset != Item (... that's so fucking stupid lmao)
  00181bd8: 340200ff ori r2,r0,0x00ff r2 = (0xFF) 255
+
  00181bd8: 340200ff ori r2,r0,0x00ff store Consumable item as 0xFF if skillset ID isn't 6 (no items exist. thanks Squeenix!)
  00181bdc: 02402021 addu r4,r18,r0
+
  00181bdc: 02402021 addu r4,r18,r0 r4 = Unit Battle ID
 
  00181be0: 27a20060 addiu r2,r29,0x0060
 
  00181be0: 27a20060 addiu r2,r29,0x0060
  00181be4: afa20010 sw r2,0x0010(r29) Store 0x60 onto Stack
+
  00181be4: afa20010 sw r2,0x0010(r29) Store 0x60 for Raw Ability CT
 
  00181be8: 27a20078 addiu r2,r29,0x0078
 
  00181be8: 27a20078 addiu r2,r29,0x0078
  00181bec: afa20018 sw r2,0x0018(r29) Store 0x78 onto Stack
+
  00181bec: afa20018 sw r2,0x0018(r29) Store 0x78 for Silence Performance Checks
 
  00181bf0: 27a20090 addiu r2,r29,0x0090
 
  00181bf0: 27a20090 addiu r2,r29,0x0090
  00181bf4: 34050006 ori r5,r0,0x0006 r5 = (0x6) 6
+
  00181bf4: 34050006 ori r5,r0,0x0006 r5 = 0x6 (primary skillset is 6 (fuck you, that's why.))
  00181bf8: 27a60020 addiu r6,r29,0x0020
+
  00181bf8: 27a60020 addiu r6,r29,0x0020 parse stack + 0x20 for Ability IDs
  00181bfc: 27a70048 addiu r7,r29,0x0048
+
  00181bfc: 27a70048 addiu r7,r29,0x0048 parse stack + 0x48 for MP costs
 
  00181c00: afa00014 sw r0,0x0014(r29) Store 0x0 onto Stack
 
  00181c00: afa00014 sw r0,0x0014(r29) Store 0x0 onto Stack
 
  00181c04: 0c0605f0 jal 0x001817c0 [[Load ability data for skillset]]
 
  00181c04: 0c0605f0 jal 0x001817c0 [[Load ability data for skillset]]
  00181c08: afa2001c sw r2,0x001c(r29) Store 0x90 onto Stack
+
  00181c08: afa2001c sw r2,0x001c(r29) Store 0x90 for #turns to complete
 
  00181c0c: 00403021 addu r6,r2,r0
 
  00181c0c: 00403021 addu r6,r2,r0
  00181c10: 14c00004 bne r6,r0,0x00181c24 Branch if 0x90 != 0x0
+
  00181c10: 14c00004 bne r6,r0,0x00181c24 Branch if number of abilities <> 0
  00181c14: 340200ff ori r2,r0,0x00ff r2 = (0xFF) 255
+
  00181c14: 340200ff ori r2,r0,0x00ff
  00181c18: a2020000 sb r2,0x0000(r16) Store FF (255) into 0x0
+
  00181c18: a2020000 sb r2,0x0000(r16) Store 0xFF into Consumable Items list if number of abilities in skillset is 0.
 
  00181c1c: 08060726 j 0x00181c98
 
  00181c1c: 08060726 j 0x00181c98
  00181c20: 00001021 addu r2,r0,r0
+
  00181c20: 00001021 addu r2,r0,r0 END return 0 valid items
  00181c24: 0266102a slt r2,r19,r6 Set if 0 < 0x90
+
  00181c24: 0266102a slt r2,r19,r6 Set if number of items < number of abilities in skillset
 
  00181c28: 10400018 beq r2,r0,0x00181c8c Branch if not
 
  00181c28: 10400018 beq r2,r0,0x00181c8c Branch if not
 
  00181c2c: 00002821 addu r5,r0,r0
 
  00181c2c: 00002821 addu r5,r0,r0
  00181c30: 3408fe90 ori r8,r0,0xfe90 r8 = (0xFE90) 65168
+
  00181c30: 3408fe90 ori r8,r0,0xfe90 r8 = -0x170
 
  00181c34: 3c078006 lui r7,0x8006
 
  00181c34: 3c078006 lui r7,0x8006
  00181c38: 24e71010 addiu r7,r7,0x1010
+
  00181c38: 24e71010 addiu r7,r7,0x1010 Used Item ID pointer
  00181c3c: 27a40020 addiu r4,r29,0x0020
+
  00181c3c: 27a40020 addiu r4,r29,0x0020 r4 = Ability ID
  00181c40: 94830000 lhu r3,0x0000(r4) Load ???
+
  00181c40: 94830000 lhu r3,0x0000(r4) Load Ability ID
 
  00181c44: 00000000 nop
 
  00181c44: 00000000 nop
  00181c48: 00681021 addu r2,r3,r8
+
  00181c48: 00681021 addu r2,r3,r8
  00181c4c: 3042ffff andi r2,r2,0xffff r2 = FE90 (65168) +
+
  00181c4c: 3042ffff andi r2,r2,0xffff r2 = Ability ID - 0x170
  00181c50: 2c42000e sltiu r2,r2,0x000e Set if Result < 14
+
  00181c50: 2c42000e sltiu r2,r2,0x000e Set if ability is Item (potion - Phoenix down)
 
  00181c54: 10400009 beq r2,r0,0x00181c7c Branch if not
 
  00181c54: 10400009 beq r2,r0,0x00181c7c Branch if not
  00181c58: 24840002 addiu r4,r4,0x0002
+
  00181c58: 24840002 addiu r4,r4,0x0002 increase ability ID counter by 2
  00181c5c: 2462fe90 addiu r2,r3,0xfe90
+
  00181c5c: 2462fe90 addiu r2,r3,0xfe90 Ability ID - 0x170
  00181c60: 00021400 sll r2,r2,0x10 Shift left 2 bytes(*0x10000) (*65536)
+
  00181c60: 00021400 sll r2,r2,0x10
  00181c64: 00021403 sra r2,r2,0x10 r2 = -0x170 * 0x10 (16)
+
  00181c64: 00021403 sra r2,r2,0x10 this does nothing. it's a waste of space and time.
  00181c68: 00471021 addu r2,r2,r7
+
  00181c68: 00471021 addu r2,r2,r7
 
  00181c6c: 90420000 lbu r2,0x0000(r2) Load Item Used ID
 
  00181c6c: 90420000 lbu r2,0x0000(r2) Load Item Used ID
  00181c70: 26730001 addiu r19,r19,0x0001
+
  00181c70: 26730001 addiu r19,r19,0x0001 Increase valid item counter by 1
  00181c74: a2020000 sb r2,0x0000(r16) Store Item Used ID into 0x0
+
  00181c74: a2020000 sb r2,0x0000(r16) Store Item Used ID into Item List
  00181c78: 26100001 addiu r16,r16,0x0001
+
  00181c78: 26100001 addiu r16,r16,0x0001 increases Item List by 1 for every valid ability
  00181c7c: 24a50001 addiu r5,r5,0x0001
+
  00181c7c: 24a50001 addiu r5,r5,0x0001 Increase counter by 1
  00181c80: 00a6102a slt r2,r5,r6 Set if 0x1 < 0x90
+
  00181c80: 00a6102a slt r2,r5,r6 Set if counter < Number of abilities in skillset
  00181c84: 1440ffee bne r2,r0,0x00181c40 Branch if so
+
  00181c84: 1440ffee bne r2,r0,0x00181c40 Loop while not all abilities in skillset have been processed.
 
  00181c88: 00000000 nop
 
  00181c88: 00000000 nop
  00181c8c: 340200ff ori r2,r0,0x00ff r2 = (0xFF) 255
+
  00181c8c: 340200ff ori r2,r0,0x00ff r2 = 0xFF
  00181c90: a2020000 sb r2,0x0000(r16) Store FF (255) into 0x1
+
  00181c90: a2020000 sb r2,0x0000(r16) Store 0xFF into final slot of Item List (finish I imagine.)
  00181c94: 26620100 addiu r2,r19,0x0100
+
  00181c94: 26620100 addiu r2,r19,0x0100 r2 = number of valid items + 0x100 (is 0x100 a flag that means "inventory not skills" or something? Throw does this too.)
  00181c98: 8fbf00b8 lw r31,0x00b8(r29) Load Stack + 0xB8
+
  00181c98: 8fbf00b8 lw r31,0x00b8(r29)
  00181c9c: 8fb300b4 lw r19,0x00b4(r29) Load Stack + 0xB4
+
  00181c9c: 8fb300b4 lw r19,0x00b4(r29)
  00181ca0: 8fb200b0 lw r18,0x00b0(r29) Load Stack + 0xB0
+
  00181ca0: 8fb200b0 lw r18,0x00b0(r29)
  00181ca4: 8fb100ac lw r17,0x00ac(r29) Load Stack + 0xAC
+
  00181ca4: 8fb100ac lw r17,0x00ac(r29)
  00181ca8: 8fb000a8 lw r16,0x00a8(r29) Load Stack + 0xA8
+
  00181ca8: 8fb000a8 lw r16,0x00a8(r29)
 
  00181cac: 27bd00c0 addiu r29,r29,0x00c0
 
  00181cac: 27bd00c0 addiu r29,r29,0x00c0
  00181cb0: 03e00008 jr r31 Jump to Address
+
  00181cb0: 03e00008 jr r31
 
  00181cb4: 00000000 nop
 
  00181cb4: 00000000 nop
 
   
 
   
 
   
 
   
 
  </font>
 
  </font>

Latest revision as of 10:11, 18 February 2022

Item Ability Loading 181b94: 00181b94 - 00181cb4

	001810d4: Load unit Data
	001817c0: Load ability data for skillset

00181b94: 27bdff40 addiu r29,r29,0xff40			- 0xC0
00181b98: afb200b0 sw r18,0x00b0(r29)			
00181b9c: 00809021 addu r18,r4,r0			r18 = Unit Battle ID
00181ba0: afb000a8 sw r16,0x00a8(r29)			
00181ba4: 00c08021 addu r16,r6,r0			r16 = Stack + 0xE0
00181ba8: afb300b4 sw r19,0x00b4(r29)			
00181bac: 00009821 addu r19,r0,r0			r19 = 0
00181bb0: afb100ac sw r17,0x00ac(r29)			
00181bb4: afbf00b8 sw r31,0x00b8(r29)			
00181bb8: 0c060435 jal 0x001810d4			Load unit Data
00181bbc: 00a08821 addu r17,r5,r0			r17 = Primary Skillset ID
00181bc0: 14400003 bne r2,r0,0x00181bd0			Branch if Unit Data  != 0x0
00181bc4: 322300ff andi r3,r17,0x00ff			really stupid error check. happens *constantly* and it just bloats the routines.
00181bc8: 08060726 j 0x00181c98			
00181bcc: 00001021 addu r2,r0,r0			End return 0 valid items
00181bd0: 34020006 ori r2,r0,0x0006			r2 = 0x6
00181bd4: 14620010 bne r3,r2,0x00181c18			Branch if skillset != Item (... that's so fucking stupid lmao)
00181bd8: 340200ff ori r2,r0,0x00ff			store Consumable item as 0xFF if skillset ID isn't 6 (no items exist. thanks Squeenix!)
00181bdc: 02402021 addu r4,r18,r0			r4 = Unit Battle ID
00181be0: 27a20060 addiu r2,r29,0x0060
00181be4: afa20010 sw r2,0x0010(r29)			Store 0x60 for Raw Ability CT
00181be8: 27a20078 addiu r2,r29,0x0078
00181bec: afa20018 sw r2,0x0018(r29)			Store 0x78 for Silence Performance Checks
00181bf0: 27a20090 addiu r2,r29,0x0090
00181bf4: 34050006 ori r5,r0,0x0006			r5 = 0x6 (primary skillset is 6 (fuck you, that's why.))
00181bf8: 27a60020 addiu r6,r29,0x0020			parse stack + 0x20 for Ability IDs
00181bfc: 27a70048 addiu r7,r29,0x0048			parse stack + 0x48 for MP costs
00181c00: afa00014 sw r0,0x0014(r29)			Store 0x0 onto Stack
00181c04: 0c0605f0 jal 0x001817c0			Load ability data for skillset
00181c08: afa2001c sw r2,0x001c(r29)			Store 0x90 for #turns to complete
00181c0c: 00403021 addu r6,r2,r0
00181c10: 14c00004 bne r6,r0,0x00181c24			Branch if number of abilities <> 0
00181c14: 340200ff ori r2,r0,0x00ff			
00181c18: a2020000 sb r2,0x0000(r16)			Store 0xFF into Consumable Items list if number of abilities in skillset is 0.
00181c1c: 08060726 j 0x00181c98			
00181c20: 00001021 addu r2,r0,r0			END return 0 valid items
00181c24: 0266102a slt r2,r19,r6			Set if number of items < number of abilities in skillset
00181c28: 10400018 beq r2,r0,0x00181c8c			Branch if not
00181c2c: 00002821 addu r5,r0,r0
00181c30: 3408fe90 ori r8,r0,0xfe90			r8 = -0x170
00181c34: 3c078006 lui r7,0x8006			
00181c38: 24e71010 addiu r7,r7,0x1010			Used Item ID pointer
00181c3c: 27a40020 addiu r4,r29,0x0020			r4 = Ability ID
00181c40: 94830000 lhu r3,0x0000(r4)			Load Ability ID
00181c44: 00000000 nop
00181c48: 00681021 addu r2,r3,r8			
00181c4c: 3042ffff andi r2,r2,0xffff			r2 = Ability ID - 0x170
00181c50: 2c42000e sltiu r2,r2,0x000e			Set if ability is Item (potion - Phoenix down)
00181c54: 10400009 beq r2,r0,0x00181c7c			Branch if not
00181c58: 24840002 addiu r4,r4,0x0002			increase ability ID counter by 2
00181c5c: 2462fe90 addiu r2,r3,0xfe90			Ability ID - 0x170
00181c60: 00021400 sll r2,r2,0x10			
00181c64: 00021403 sra r2,r2,0x10			this does nothing. it's a waste of space and time.
00181c68: 00471021 addu r2,r2,r7			
00181c6c: 90420000 lbu r2,0x0000(r2)			Load Item Used ID
00181c70: 26730001 addiu r19,r19,0x0001		Increase valid item counter by 1
00181c74: a2020000 sb r2,0x0000(r16)			Store Item Used ID into Item List
00181c78: 26100001 addiu r16,r16,0x0001		increases Item List by 1 for every valid ability
00181c7c: 24a50001 addiu r5,r5,0x0001			Increase counter by 1
00181c80: 00a6102a slt r2,r5,r6			Set if counter < Number of abilities in skillset
00181c84: 1440ffee bne r2,r0,0x00181c40			Loop while not all abilities in skillset have been processed.
00181c88: 00000000 nop
00181c8c: 340200ff ori r2,r0,0x00ff			r2 = 0xFF
00181c90: a2020000 sb r2,0x0000(r16)			Store 0xFF into final slot of Item List (finish I imagine.)
00181c94: 26620100 addiu r2,r19,0x0100			r2 = number of valid items + 0x100 (is 0x100 a flag that means "inventory not skills" or something? Throw does this too.)
00181c98: 8fbf00b8 lw r31,0x00b8(r29)			
00181c9c: 8fb300b4 lw r19,0x00b4(r29)			
00181ca0: 8fb200b0 lw r18,0x00b0(r29)			
00181ca4: 8fb100ac lw r17,0x00ac(r29)			
00181ca8: 8fb000a8 lw r16,0x00a8(r29)			
00181cac: 27bd00c0 addiu r29,r29,0x00c0			
00181cb0: 03e00008 jr r31			
00181cb4: 00000000 nop