Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;GameShark Menu Fix (Makes sure that you aren't in a pause menu)
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- D03FDA3D 0000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;Custom Action Engine (NOT GameShark Safe)
- ;Could be made safe by adding a check to make sure that game isn't in a menu.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .org 0x8074F210
- J start
- NOP
- mask:
- .org 0x803B00A0
- start:
- BEQ AT, R0, setup ;Branch if action is NOT less than 0x4D
- NOP
- J mask ;Jump to the Mask function
- LBU V0, 0x0153(S0) ;Restore V0, it was overwritten
- end:
- JAL 0x8074B680 ;Play sound
- NOP
- J 0x8074F3B4 ;
- LW RA, 0x002C(SP) ;
- unusable:
- J end ;Jump to End
- ADDIU A1, R0, 0x0834 ;Set sound to play to Unusable Item
- setup:
- ;V1 = 0x8011A5D0 (SRAM Address)
- ;S1 = Action ID
- ;RA = Default Return Address, do not change unless you know what you're doing
- LI RA, end ;Set RA to end so that it can be used at the end of a function.
- LI V1, 0x801EF670 ;V1 = SRAM Address
- ADDU T1, R0, R0 ;Clear T1 for function setups
- ADDU T2, R0, R0 ;Clear T2 for function setups
- ADDU T3, R0, R0 ;Clear T3 for function setups
- ADDU T4, R0, R0 ;Clear T4 for function setups
- ADDU T5, R0, R0 ;Clear T5 for function setups
- ADDU T6, R0, R0 ;Clear T6 for function setups
- ADDU T7, R0, R0 ;Clear T7 for function setups
- LI V0, verify ;Prepare V0 for function setup verification
- B functions ;Jump to functions
- NOP
- verify:
- ;AT = Return Address Address to return to after verifying the item.
- ;T1 = Magic Required You need atleast this much magic to use it.
- ;T2 = Magic Cost This is the amount of magic it'll cost when using it. This'll be the required amount if it is higher than T1.
- ;T3 = Ammo Cost The amount of Ammo you need to use the item, you'll also loose the same amount. (ONLY WORKS FOR ITEMS WITH AMMO)
- ;T4 = Health Required The amount of health you need to use the item.
- ;T5 = Rupee Cost The amount of rupees it'll cost to use the item.
- ;T6 = Restriction Decides when an item CAN'T be used. 0x1 = Standing, 0x2 = Midair
- ; These bitflags will disable the item even if the button isn't. The default restrictions are still applied. items can't be used from ledges, climbable collision, rolling, etc.
- ;T7 Unused
- ;T8 Unused
- ;T9 Unused
- ;V0 Used for verification
- ;V1 = 0x8011A5D0 SRAM Address
- ;Check health
- LH V0, 0x0036(V1) ;V0 = Current Health
- SLT V0, V0, T4 ;If (Current Health < Health Required) {V0 = 0x1} Else {V0 = 0x0}
- BNE V0, R0, unusable ;Branch to unusable if you do not have enough health
- NOP
- ;T4, V0 is now available
- ;Check Magic
- LB V0, 0x0039(V1) ;V0 = Current Magic
- SLT T4, V0, T1 ;If (Current Magic < Magic Required) {T4 = 0x1} Else {T4 = 0x0}
- BNE T4, R0, unusable ;Branch to unusable if you do not have enough magic
- NOP
- SUB T1, V0, T2 ;T1 = V0 - T2 (New Magic)
- BLTZ T1, unusable ;Branch to unusable if you do not have enough magic
- NOP
- ;T2, T4, V0 is now unused
- ;Check Rupees
- LH V0, 0x003A(V1) ;V0 = Current Rupees
- SUB V0, V0, T5 ;V0 = V0 - T5 (New Rupees)
- BLTZ V0, unusable ;Branch to unusable if you do not have rupees
- NOP
- SUB T5, R0, T5 ;T5 = -T5 (Rupees to decrease by)
- ;T2, T4, V0 is now unused
- ;Check Ammunition
- ;First of all, we need to know what item slot the item being used is linked to.
- ;To do this, we'll have to read read the Last Pressed Item Button Index from 0x801DAB70
- ;Then we use that ID to get the item slot linked to the specified button.
- ;We make sure that the item ID has a value below 14
- ;(so that it won't attempt to read incorrect data, only slot 0-13 has ammo)
- ;If the action requires Ammo, but the item slot doesn't have ammo, the item won't be usable in order to prevent data manipulation.
- ;If it passes the check we look up how much Ammo the item has and continue like normally.
- BEQ T3, R0, ammobranch ;There's no ammo cost, skip past.
- LUI V0, 8040 ;V0 = Last Pressed Item Button Index Address (Upper Bytes)
- LB V0, 0xFEF5(V0) ;V0 = Last Pressed Item Button Index
- ADDU V0, V1, V0 ;V0 = SRAM + Last Pressed Item Button Index
- LB V0, 0x005C(V0) ;V0 = Item Slot ID
- SLTI T2, V0, 0x0014 ;If (Item Slot ID < 0x0014) {T2 = 0x1} Else {T2 = 0x0}
- BEQ T2, R0, unusable ;Branch to unusable if the Item Slot ID isn't below 14
- NOP
- ADDU T2, V1, V0 ;T2 = SRAM + Item Slot ID
- LB T2, 0x00A0(T2) ;T2 = Ammo
- SUB T3, T2, T3 ;T3 = Ammo - Ammo Cost
- BLTZ T3, unusable ;Branch to unusable if you do not have enough ammo
- NOP
- ;T2, T4 is now unused
- ;V0 won't be changed for the rest of the verification so that the item slot can be easily accessed later on
- ammobranch:
- ;Check Restriction
- ;0x801DAAB8 = Standing, In Water, Jumping up against ledge, etc. State
- ;0x1 = Standing
- ;0x60 = In Water?
- ;BEQ T6, R0, verresqu ;There is no restriction, skip past the check
- ;NOP
- ;LUI T4, 0x801E ;T4 = standing & in water state (Upper bytes)
- ;LH T4, 0xAAB8(T4) ;T4 = Current standing & in water state
- ;verresstand:
- ;ANDI T2, T6, 0x0001 ;T2 = 0x1 if Standing is restricted
- ;BEQ T2, R0, verresair ;Branch to midair check if standing isn't restricted
- ;NOP
- ;ANDI T2, T4, 0x0001 ;T2 = 0x1 if you're standing
- ;BNE T2, R0, unusable ;Branch to unusable if you're standing
- ;NOP
- ;verresair:
- ;ANDI T2, T6, 0x0002 ;T2 = 0x2 if being in midair is restricted
- ;BEQ T2, R0, verresqu ;Branch to restriction check end if being in midair isn't restricted
- ;NOP
- ;ANDI T2, T4, 0x0001 ;T2 = 0x1 if you're standing
- ;BEQ T2, R0, end ;Branch to end if you're not standing
- ;ADDU A0, R0, R0 ;Set sound to play to nothing
- ;verresqu:
- ;T2, T4, T6 is now unused
- ;Update
- ;T1 = New Magic Amount
- ;T2 = Unused
- ;T3 = New Ammo Amount
- ;T4 = Unused
- ;T5 = Amount of rupees to decrease by
- ;T6 = Unused
- ;T7 = Unused
- ;T8 = Unused
- ;T9 = Unused
- ;V0 = Item Slot ID
- ;V1 = SRAM Address
- SB T1, 0x0039(V1) ;Current Magic = New Magic Amount
- LUI T2, 801F ;Rupee increase/decrease address upper half
- LH T4, 0x0688(T2) ;Load current rupee increase/decrease amount
- ADDU T4, T4, T5 ;Set new rupee increase/decrease amount
- SH T4, 0x0688(T2) ;Store new rupeee increase/decrease amount
- ADDU T2, V1, V0 ;T2 = SRAM + Item Slot ID
- SB T3, 0x00A0(T2) ;Current Ammo = New Ammo Amount
- LI RA, end ;Set RA to end so that it can be used at the end of a function.
- JR AT ;Jump Back
- NOP
- functions:
- SLTI T0, S1, 0x55 ;Set T0 if A2 is less than 0x55 (0x53 & 0x54)
- BNE T0, R0, tunics ;Branch to tunics if action is less than 0x55
- NOP
- B end ;Branch to end if action doesn't exist
- NOP
- tunics:
- ADDIU T0, S1, 0xFFAF ;T0 = S1 - 0x51 = New Tunic
- LB T1, 0x006C(V1) ;T1 = Current Boots & Tunic
- ANDI T2, T1, 0x000F ;T2 = Current Tunic
- ANDI T3, T1, 0x00F0 ;T3 = Current Boots
- BEQL T0, T2, updatetunic ;Execute Delay Slot and Branch if you already have the tunic equipped
- ADDU T3, T3, R0 ;T3 = Current Boots & No Tunic
- ADDU T3, T3, T0 ;T3 = Current Boots & New Tunic
- updatetunic:
- SB T3, 0x006C(V1) ;T1 = Current Tunics & Boots
- ADDIU T3, R0, 0x0001 ;T3 = 0x1
- SB T3, 0x0145(S0) ;Unequip Iron Boots
- J end ;Function is over, jump to end
- ADDIU A1, R0, 0x0834 ;Set sound to play to Pull out Item
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;Set Up Tunic Actions (GameShark Safe)
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 80779E37 0053
- 80779E3D 0054
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;Add OoT Dialog Icon Entries (GameShark Safe)
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 811CFFBE 0005
- 811CFFC0 000B
- 811CFFC2 0011
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;TEXT SETUP (ROM Patch Only)
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- Icons
- 0x15 Fairy Ocarina (OoT)
- 0x16 Fairy Slingshot (OoT)
- 0x17 Hookshot (OoT)
- icon 22 (0x16)
- Goron Tunic
- Allows the bearer to withstand
- heated areas.
- icon 23 (0x17)
- Zora Tunic
- Allows the bearer to breathe
- while underwater.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;Allow any action to be performed under water (NOT GameShark Safe)
- ;Could be made safe by adding a check to make sure that game isn't in a menu.
- ;WARNING: Game may crash when changing Form. Need to look into this.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .org 0x8074EEC4
- BEQL R0, R0, 0x8074EEEC
- D03FDA3D 0000
- 8174EEC4 5000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;Allow Tunics, Bottles, Hookshot & Great Fairy Sword in water (GameShark Safe)
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .org 0x8012432C
- NOP
- .org 0x80124344
- NOP
- .org 0x80110898
- J 0x803B0300
- NOP
- .org 0x803B0300
- BEQ T7, AT, usable ;It is zora Mask, can use
- LB A0, 0x0020(T0) ;A0 = Form
- ADDIU AT, R0, 0x04 ;AT = 0x4 (Link)
- BNE A0, AT, disable ;You're not link form, can't use tunics
- ADDIU AT, R0, 0x0B ;0x0B = Goron Tunic
- BEQ T7, AT, usable ;It is goron Tunic, can use
- ADDIU AT, R0, 0x11 ;0x11 = Zora Tunic
- BEQ T7, AT, usable ;It is zora Tunic, can use
- NOP
- disable:
- J 0x801108A0
- NOP
- usable:
- J 0x801109B8
- LBU T7, 0x3F18(A1)
- underwatercheck:
- BEQL T2, AT, donecheck ;You are Link
- ADDIU T7, R0, 0x000F ;T7 = 0x0F (Link Start Range)
- donecheck:
- J 0x8011091C
- SLT AT, A2, T7 ;Set AT = 0x1 if item is below start range
- .org 0x801108DC
- BNEL A3, R0, 0x80110910
- ADDIU T7, R0, 0x00012 ;T7 = 0x12 (Zora Link Start Range)
- .org 0x80110914
- J underwatercheck
- LB AT, 0x0020(T0) ;AT = Form
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;Allow Zora Swimming with Zora Tunic (NOT GameShark Safe)
- ;Could be made safe by adding a check to make sure that game isn't in a menu.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;Add iron boots to B when Link have Zora Tunic Equipped
- .org 0x8075757C
- JAL 0x803B0340
- OR V0, R0, T7 ;V0 = Current Form
- BEQ AT, R0, 0x80757594 ;You aren't Zora Link, and you don't have Zora Tunic Equipped, branch
- NOP
- JAL 0x807574DC
- .org 0x807575A0
- OR V0, R0, R0 ;Clear out V0
- ;Add zora swimming to A when Link have Zora Tunic Equipped
- .org 0x8076DBDC
- JAL 0x803B0340
- OR V0, R0, T6 ;V0 = Current Form
- BEQ AT, R0, 0x8076DCD0 ;You aren't Zora Link, and you don't have Zora Tunic Equipped, branch
- OR V0, R0, R0 ;Clear out V0
- ;Allow Link to Surface with A
- .org 0x807575F4
- NOP
- ;Remove Dive ability from A when Link have Zora Tunic Equipped
- ;0x80758888 is the branch used to prevent zora link from having Dive on A
- .org 0x8075887C
- LBU V0, 0x014B(S0) ;Change the register used from T0 to V0
- JAL 0x803B0340
- .org 0x80758888
- BNEL AT, R0, 0x80758998 ;You are Zora Link, or you have the Zora Tunic Equipped, branch
- ;Set A Button Text to Swim instead of Dive when Link have Zora Tunic Equipped
- .org 0x80760228
- BNEL T7, R0, 0x80760294
- .org 0x80760294
- JAL 0x803B0340
- LBU V0, 0x014B(A3)
- BEQL AT, R0, 0x807602B0 ;You aren't Zora Link, and you don't have Zora Tunic Equipped, branch
- ;Zora Link or Zora Tunic Check
- ;V0 is Current Form (this register will not be changed)
- ;AT will return as 0x0 if false, 0x1 if true.
- ;It is set up this way to allow the function to run from all the Zora Checks.
- .org 0x803B0340
- ADDIU AT, R0, 0x0002 ;0x2 = Zora
- BEQ V0, AT, usable ;You're zora link, branch
- ADDIU AT, R0, 0x0004 ;0x4 = Link
- BNE V0, AT, end ;You're not Link, branch
- LUI AT, 0x801F ;AT = 0x801F0000
- LB AT, 0xF6DC(AT) ;AT = Boots & Tunic Byte
- ANDI AT, AT, 0x000F ;AT = Tunic
- XORI AT, AT, 0x0003 ;AT will be set to 0 only if Zora Tunic is equipped.
- BNE AT, R0, end ;You don't have zora tunic equipped, branch
- NOP
- usable:
- JR RA
- ADDIU AT, R0, 0x0001 ;AT = 0x1
- end:
- JR RA
- ADDIU AT, R0, 0x0000 ;AT = 0x0
- ;To do:
- ;Make it so that the B Button says "Dive" when you have zora tunic equipped
- ;This can't be solved with a simple Branch since Zora Link always has Text on the B button, while Link doesn't.
- 80122130
- 80114E60
- A2 80545ED0
- 80178E24
- 80236C40
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement