Brak opisu

hooks.asm 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. _call_via_r0 equ 0x081E3BA8
  2. _call_via_r1 equ 0x081E3BAC
  3. //----------------------
  4. // ipatix sound stuff
  5. //----------------------
  6. .org 0x080007B4
  7. .word 0x0203E000 // new PCM work area
  8. .org 0x081DD0B4
  9. .word main_mixer // new mixer ROM location
  10. .word 0x03005F50 // new mixer RAM location (used for loading)
  11. .halfword mixer_size
  12. .halfword 0x400 // CpuSet, copy code by 32 bit units
  13. .word 0x0203E000 // new PCM work area
  14. .org 0x081DD0C8
  15. // set correct sound driver operation mode
  16. // 12 channels at 31536 Hz samplerate
  17. .byte 0x00, 0xCC, 0x99, 0x00
  18. .org 0x081DC094
  19. .word 0x03005F50+1 // new mixer RAM location (used for branch)
  20. // repoint correctly to the new cry tables
  21. .org 0x080720C8
  22. .include "patches/disable_cry_table_blocks.s"
  23. // cry-ID = poke-ID
  24. .org 0x08043304
  25. LSL R0, R0, #0x10
  26. LSR R0, R0, #0x10
  27. BX LR
  28. // music overrides
  29. .org 0x0808064C // encounter music ([!] Box) song hook
  30. LDR R1, =mhk_intro_music_id_to_song|1
  31. BL _call_via_r1
  32. B 0x080806BA
  33. .pool
  34. .org 0x08044090
  35. LDR R1, =mhk_current_map_music_set_default_for_battle|1
  36. BX R1
  37. .pool
  38. .org 0x080156FE // trainer victory music hook
  39. LDR R0, =mhk_trainer_battle_play_defeat|1
  40. BL _call_via_r0
  41. B 0x0801576E
  42. .pool
  43. .org 0x08021D46 // wild poke defeated
  44. BL _call_via_r0
  45. .org 0x08021D94
  46. .word mhk_wild_poke_def_music|1
  47. .org 0x0807F9F8
  48. LDR R1, =0x0807FA3E
  49. BL _call_via_r1
  50. MOV R1, R0
  51. B 0x0807FA3E
  52. .pool
  53. .org 0x080159D0
  54. LDR R0, =mhk_fadeout|1
  55. BL _call_via_r0
  56. B 0x080159DC
  57. .pool
  58. //---------------------
  59. // ipatix misc stuff
  60. //---------------------
  61. // disable help menu
  62. // see: https://www.pokecommunity.com/showthread.php?t=364909
  63. .org 0x0813B8C2
  64. .halfword 0xE01D
  65. // idle loop eliminiation
  66. .org 0x080008A4
  67. cmp r0, #0
  68. bne ile_end_wait
  69. mov r3, #1
  70. ile_idle_loop:
  71. swi #2
  72. ldrh r1, [r2, #0x1c]
  73. mov r0, r3
  74. and r0, r1
  75. beq ile_idle_loop
  76. ile_end_wait:
  77. pop {r0}
  78. bx r0
  79. //--------------
  80. // IRAM hacks
  81. //--------------
  82. // decrease amount of valid file handles from 20 to 12 to free up some IRAM
  83. NUM_FILE_HANDLES equ 12
  84. .org 0x081E9948
  85. cmp r1, #(NUM_FILE_HANDLES - 1)
  86. .org 0x081E99E4
  87. add r0, #((NUM_FILE_HANDLES - 1) * 8)
  88. .org 0x081E9AA4
  89. cmp r6, #NUM_FILE_HANDLES
  90. .org 0x081E9ADE
  91. cmp r6, #NUM_FILE_HANDLES
  92. .org 0x081E9B1C
  93. cmp r6, #NUM_FILE_HANDLES
  94. bge 0x081E9B2E
  95. .org 0x081E9BA6
  96. cmp r7, #NUM_FILE_HANDLES
  97. bge 0x081E9BB8
  98. .org 0x081E9BDA
  99. cmp r0, #NUM_FILE_HANDLES
  100. blo 0x081E9BE2
  101. .org 0x081E9C84
  102. cmp r1, #NUM_FILE_HANDLES
  103. bge 0x081E9C94
  104. //----------------
  105. // S-Bird stuff
  106. //----------------
  107. //Don't know what thats all about... leaving it commented for now
  108. //.org 0x0800f268
  109. // .halfword 0xE000
  110. //flag routine
  111. .org 0x0806E5D6
  112. ldr r0, =flag_hook|1
  113. bx r0
  114. lsl r0, #0
  115. .pool
  116. .org 0x0806E584
  117. ldr r3, =var_set_hack|1
  118. bx r3
  119. .pool
  120. .org 0x0806E568
  121. ldr r3, =var_get_hack|1
  122. bx r3
  123. .pool
  124. .org 0x0806E680
  125. ldr r1, =flag_set_hack|1
  126. bx r1
  127. .pool
  128. //end of flag routine
  129. //var routine
  130. .org 0x0806E45C
  131. ldr r0,=var_hook+1
  132. bx r0
  133. .pool
  134. .org 0x0806A390
  135. ldr r3, =var_set_script_hack|1
  136. bx r3
  137. .pool
  138. //end of var routine
  139. .org 0x0804C034
  140. ldr r0, =clear_sav1|1
  141. bx r0
  142. .pool
  143. //trainer Flag stuff
  144. .org 0x08080378
  145. ldr r1, =trainerflag_read_fix+1
  146. bx r1
  147. .pool
  148. .org 0x080800B8
  149. ldr r2, =trainerflag_opponent_fix+1
  150. bx r2
  151. .pool
  152. .org 0x08080424
  153. ldr r1, =trainerflag_check_fix+1
  154. bx r1
  155. .pool
  156. .org 0x0808043c
  157. ldr r1, =trainerflag_set_fix+1
  158. bx r1
  159. .pool
  160. .org 0x08080450
  161. ldr r1, =trainerflag_clear_fix+1
  162. bx r1
  163. .pool
  164. //end of trainer flag stuff
  165. //New behavior bytes for jumping
  166. .org 0x0806811A
  167. ldr r0,=jump_behavior|1
  168. bx r0
  169. .pool
  170. //behavior walk stuff
  171. .org 0x0806D720
  172. ldr r0,=on_step|1
  173. bx r0
  174. .pool
  175. //end of new behavior bytes for jumping
  176. //transparent textboxes and mugshots
  177. .org 0x08069410
  178. bx r0
  179. .org 0x0806941C
  180. .word trans_activate|1
  181. .org 0x08069504
  182. bx r1
  183. .org 0x0806950C
  184. .word trans_deactivate|1
  185. .org 0x08150000
  186. ldr r0, =pal_load_hook_2|1
  187. bx r0
  188. .pool
  189. .org 0x0815044A
  190. bx r1
  191. .org 0x08150450
  192. .word pal_load_hook|1
  193. .org 0x0809CEB2
  194. ldr r0, =trans_mug_close_fix+1
  195. bx r0
  196. lsl r0, #0
  197. .pool
  198. //end of transparent textboxes and mugshots
  199. //saveblock routine start
  200. .org 0x080D9EDC
  201. ldr r0, =load_hijack|1
  202. bx r0
  203. .pool
  204. .org 0x080d991E
  205. bx r7
  206. .org 0x080d995C
  207. .word store_hijack|1
  208. .org 0x083FEC94
  209. .include "patches/save_table/save_table.s"
  210. //end of saveblock routine
  211. //new battle script commands
  212. //replace tables
  213. .org 0x08014C1C
  214. .word bs_command_table
  215. .org 0x08015A28
  216. .word bs_command_table
  217. .org 0x08015C6C
  218. .word bs_command_table
  219. .org 0x08015C98
  220. .word bs_command_table
  221. .org 0x0801D054
  222. .word bs_command_table
  223. //end of new battle script commands
  224. //move effect table
  225. .org 0x08016364
  226. .word m_effect_table
  227. .org 0x08023328
  228. .word m_effect_table
  229. .org 0x08025CF8
  230. .word m_effect_table
  231. .org 0x08027464
  232. .word m_effect_table
  233. .org 0x080297F0
  234. .word m_effect_table
  235. .org 0x0802BE80
  236. .word m_effect_table
  237. //end of move effect table
  238. //move limits
  239. .org 0x080D75FC
  240. .byte 0,0,0,0,0,0
  241. //end of move limits
  242. //print string mod
  243. .org 0x080D77C0
  244. bx r1
  245. .org 0x080D77CC
  246. .word custom_print_string|1
  247. //end of print string mod
  248. //new move animation table
  249. .org 0x080725d0
  250. .word m_animation_table
  251. //end of new move animation table