Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.67 KB | None | 0 0
  1. # 8006B800 - mtlr for action state interrupt pointer
  2.  
  3. bl get_data
  4. b start
  5.  
  6. # Data
  7. # Whether a hit connected for each port
  8. # Set from hitstop set and ActionStateChange hooks
  9. .space 4
  10.  
  11. # Put pointer to data in r4 using return address
  12. get_data:
  13. mflr r4
  14. addi r4, r4, 4
  15. blr
  16.  
  17. start:
  18. # Check character
  19. lwz r3, 0x64(r30)
  20. cmpwi r3, 0x13 # Zelda
  21. beq zeldasheik
  22. cmpwi r3, 7 # Sheik
  23. beq zeldasheik
  24.  
  25. b end
  26.  
  27. zeldasheik:
  28. # Check AS ID
  29. lwz r3, 0x70(r30)
  30.  
  31. # Aerials (including landing lag)
  32. check_aerials:
  33. cmpwi r3, 0x41
  34. blt check_tilt
  35. cmpwi r3, 0x4A
  36. bgt check_tilt
  37. b attacking
  38.  
  39. # Tilts
  40. check_tilt:
  41. cmpwi r3, 0x35
  42. blt check_smash
  43. cmpwi r3, 0x39
  44. bgt check_smash
  45. b attacking
  46.  
  47. # Smashes
  48. check_smash:
  49. cmpwi r3, 0x3C
  50. blt check_da
  51. cmpwi r3, 0x40
  52. bgt check_da
  53. b attacking
  54.  
  55. # Dash attack
  56. check_da:
  57. cmpwi r3, 0x32
  58. beq attacking
  59.  
  60. # Jabs
  61. cmpwi r3, 0x2C
  62. blt end
  63. cmpwi r3, 0x31
  64. bgt end
  65.  
  66. attacking:
  67. # Get attack hit bool pointer for this port
  68. lbz r3, 0x6C(r30)
  69. add r4, r4, r3
  70.  
  71. # Check if attack connected
  72. lbz r3, 0(r4)
  73. cmpwi r3, 0
  74. beq end
  75.  
  76. # Back up r12 because it gets dicked down by Interrupt_DownB_Grounded
  77. stwu r1, -4(r1)
  78. stw r12, 0(r1)
  79.  
  80. # Check if airborne
  81. lwz r3, 0x140(r30)
  82. cmpwi r3, 0
  83. beq grounded
  84.  
  85. # Custom Interrupt_DownB_Air
  86. mr r3, r30
  87. lis r4, 0x803C
  88. addi r0, r4, 0x14F0
  89. lwz r5, 0x2C(r3)
  90. lwz r4, 4(r5)
  91. rlwinm r4, r4, 2, 0, 29
  92. add r4, r0, r4
  93. lwz r12, 0(r4)
  94. cmplwi r12, 0
  95. bne check_something
  96. li r3, 0
  97. b downb_air_end
  98. check_something:
  99. lbz r0, 0x687(r5)
  100. cmplwi r0, 0
  101. bne downb_air_no_interrupt
  102. mtlr r12
  103. blrl
  104. li r3, 1
  105. b downb_air_end
  106. downb_air_no_interrupt:
  107. downb_air_end:
  108. b downb_cleanup
  109.  
  110. grounded:
  111. # Call Interrupt_DownB_Grounded
  112. mr r3, r30
  113. lis r0, 0x800D
  114. ori r0, r0, 0x68C0
  115. mtlr r0
  116. blrl
  117.  
  118. downb_cleanup:
  119. # Restore r12
  120. lwz r12, 0(r1)
  121. addi r1, r1, 4
  122.  
  123. cmpwi r3, 0
  124. beq end
  125.  
  126. # Skip interrupt call
  127. lis r0, 0x8006
  128. ori r0, r0, 0xB80C
  129. mtlr r0
  130. blr
  131.  
  132. end:
  133. # Overwritten instruction
  134. mtlr r12
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143. # 800693E4 - ActionStateChange+0x38
  144.  
  145. # Aerials
  146. check_aerials:
  147. cmpwi r4, 0x41
  148. blt check_tilt
  149. cmpwi r4, 0x45
  150. bgt check_tilt
  151. b attacking
  152.  
  153. # Tilts
  154. check_tilt:
  155. cmpwi r4, 0x35
  156. blt check_smash
  157. cmpwi r4, 0x39
  158. bgt check_smash
  159. b attacking
  160.  
  161. # Smashes
  162. check_smash:
  163. cmpwi r4, 0x3C
  164. blt check_da
  165. cmpwi r4, 0x40
  166. bgt check_da
  167. b attacking
  168.  
  169. # Dash attack
  170. check_da:
  171. cmpwi r4, 0x32
  172. beq attacking
  173.  
  174. # Jab 1
  175. cmpwi r4, 0x2C
  176. bne end
  177.  
  178. attacking:
  179. # Get address of AS interrupt mtlr patch
  180. lis r4, 0x8006
  181. ori r4, r4, 0xB800
  182. lwz r3, 0(r4)
  183.  
  184. # Mask off 0x48 bl opcode
  185. lis r4, 0xFF
  186. ori r4, r4, 0xFFFF
  187. and r3, r3, r4
  188.  
  189. # Add bl offset
  190. lis r4, 0x8006
  191. ori r4, r4, 0xB800
  192. add r3, r4, r3
  193.  
  194. # Add offset to data
  195. addi r3, r3, 8
  196.  
  197. # Add port offset
  198. lbz r4, 0x6C(r30)
  199. add r3, r3, r4
  200.  
  201. # Reset hit flag
  202. li r4, 0
  203. stb r4, 0(r3)
  204.  
  205. # Restore r3
  206. mr r3, r30
  207.  
  208. end:
  209. # Overwritten instruction
  210. lwz r27, 0x28(r3)
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219. # 8006D708 - Storing hitstop
  220.  
  221. # Get address of AS interrupt mtlr patch
  222. lis r4, 0x8006
  223. ori r4, r4, 0xB800
  224. lwz r3, 0(r4)
  225.  
  226. # Mask off 0x48 bl opcode
  227. lis r4, 0xFF
  228. ori r4, r4, 0xFFFF
  229. and r3, r3, r4
  230.  
  231. # Add bl offset
  232. lis r4, 0x8006
  233. ori r4, r4, 0xB800
  234. add r3, r4, r3
  235.  
  236. # Add offset to data
  237. addi r3, r3, 8
  238.  
  239. # Add port offset
  240. lbz r4, 0xC(r30)
  241. add r3, r3, r4
  242.  
  243. # Update hit flag
  244. li r4, 1
  245. stb r4, 0(r3)
  246.  
  247. # Overwritten instruction
  248. stfs f1, 0x195C(r30)
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255. # 80114190 - Sheik_AS_361_Transform_Grounded+0x30
  256.  
  257. # Overwritten instruction
  258. mr r3, r31
  259.  
  260. # Load 36/15 into f1 using the stack
  261. lis r0, 0x4019
  262. ori r0, r0, 0x999A
  263. stw r0, 8(r1)
  264. lfs f1, 8(r1)
  265.  
  266. # Call FrameSpeedChange_Landing
  267. lis r0, 0x8006
  268. ori r0, r0, 0xF190
  269. mtlr r0
  270. blrl
  271.  
  272. # Restore r3
  273. mr r3, r31
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282. # 8013AF10 - Zelda_AS_355_Transform_Grounded+0x30
  283.  
  284. # Overwritten instruction
  285. mr r3, r31
  286.  
  287. # Load 43/15 into f1 using the stack
  288. lis r0, 0x4037
  289. ori r0, r0, 0x7777
  290. stw r0, 8(r1)
  291. lfs f1, 8(r1)
  292.  
  293. # Call FrameSpeedChange_Landing
  294. lis r0, 0x8006
  295. ori r0, r0, 0xF190
  296. mtlr r0
  297. blrl
  298.  
  299. # Restore r3
  300. mr r3, r31
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement