My OoT Hacking Website: http://cloudmodding.com/zelda/oot
Make Slingshot & Bow (+magical arrows) usable by Adult & Child Link
#FIX SLING & BOW FUNCTIONALITY FOR ADULT & CHILD
#This is the first ASM Hack I wrote.
#0x8038AD88 is the address of the instruction that sets T6 to adult/child
#If you're adult (T6==0), the game uses the bow, if you're child (T6==1), the game uses slingshot
#So we create a function to set T6 to 0 when you're using bow, and 1 when you're using slingshot, instead of using the age.#This ASM Hack will fix the Projectile Model, Ammunition Usage, and Magical Arrows, all in one go.##I write the ASM Hack to 0x80600000, so you must have 8mb RAM enabled or move it to another location.##0x801DAB73 stores what item button you last pressed with a value of 0 to 3 (B, C-Left, C-Down, C-Right)
#T0 = Save RAM offset
#We can use: T4, T6
.ORG 0x8038AD84
J code #This'll overwrite the T6 = Age instruction
.ORG 0x80600000
code:
LUI T4, 0x801E #T4 = Used Button Index Offset (upper bits)
LW T4, 0xAB73(T4) #T4 = Used Button Index
ADDIU T4, T4, 0x0068 #T4 = Used Button Item Index Offset relative to Save RAM
ADDU T4, T0, T4 #T4 = Used Button Item Index Offset
LB T4, 0x0000(T4) #T4 = Used Item Index
ADDIU T6, R0, 0x0006 #T6 = 0x6 (Slingshot)
BEQL T4, T6, end #If (Used Item Index == Slingshot) Execute Delay Slot & Branch to End
ADDIU T6, R0, 0x0001 #T6 = 1 (Sling)
ADDIU T6, R0, 0x0000 #T6 = 0 (Bow)
end:
J 0x8038AD8C #Jump back to the address after the initial Jumps delay slot
NOPI've written a partial ASM hack so that child & adult also load different Display Lists, but since I do not know how to do Display List Porting (and I'm only doing RAM hacks at the moment), I didn't finish the code. And here's a hack I wrote to go along with it (and also fix several "issues" with the inventory)
#Inventory Slot to Item Usability
#This ASM Hack will change the Inventory ASM to read from the Item Usability Table instead of the Slot Usability Table.
#Normally the inventory uses the Item Usability Table when setting item icon color, and Item Slot Usability Table for equipping, item name color, ammunition color and enlarging icons when they're selected. As a result, if you were to have an item that you can equip, in a slot that you can't use, you wouldn't be able to use the item.
#It also makes it possible to equip slingshot, bow & magical arrows as child & adult (to go with my other code)
##I write the ASM Hack to 0x80600100, so you must have 8mb RAM enabled or move it to another location.
##The ASM is injected after the Inventory has been loaded into to the RAM
##Overwrite:#0x8009A074 LUI A0, 0x8010#0x8009A078 LW A0, 0xE4BC(A0)
##We can use: A0, A1, A3, T0, T9#T4 + A78 = Item Usability Offset#
.ORG 0x8009A074
J 0x80600100
NOP
.ORG 0x80600100
ADDIU T0, T4, 0x0A78 #T0 = Item Usability Offset
LUI T9, 0x8012
ADDIU T9, T9, 0xA65C #T9 = Item Offset
#CHILD & ADULT
ADDIU A0, R0, 0x0009 #A0 = 9
SB A0, 0x0003(T0) #Bow
SB A0, 0x0004(T0) #Fire Arrow
SB A0, 0x0006(T0) #Sling
SB A0, 0x000C(T0) #Ice Arrow
SB A0, 0x0012(T0) #Light Arrow
SB A0, 0x0038(T0) #Bow + Fire Arrow
SB A0, 0x0039(T0) #Bow + Ice Arrow
SB A0, 0x003A(T0) #Bow + Light Arrow
#REPLACE THE USAGE OF SLOT ID WITH ITEM ID FOR ALL CHECKS
LUI A0, 0x8039 #A0 = Check offsets
ADDIU A1, R0, 0x0186 #A1 = New Command
SB A1, 0xEA61(A0) #Change Ammunition instructions to use Item ID instead of Slot ID
ADDIU A1, R0, 0xF13C #A1 = New Command
SB A1, 0xEA67(A0) #Change Ammunition instructions Usability RAM offset from Slots to Items
ADDIU A1, R0, 0x0059 #A1 = New Command
SB A1, 0xFAC1(A0) #Change Icon Enlarge instructions to use Item ID instead of Slot ID
ADDIU A1, R0, 0xF13C #A1 = New Command
SB A1, 0xFACF(A0) #Change Icon Enlarge instructions Usability RAM offset from Slots to Items
ADDIU A1, R0, 0x018F #A1 = New Command
SB A1, 0xF609(A0) #Change Name Color instructions Usability RAM offset from Slots to Items
ADDIU A1, R0, 0xF13C #A1 = New Command
SB A1, 0xF5EF(A0) #Change Name Color instructions to use Item ID instead of Slot ID
#END
LUI A0, 0x8010 #Restore A0
LW A0, 0xE4BC(A0) #Restore A0
J 0x8009A07C