No Description

save_block_jpan.s 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. .align 2
  2. .thumb
  3. /*cc left in first block
  4. 70 +70+70+108 = 258 in people block
  5. 8*70 + 820 = BA0 from box block
  6. grand total of EC4 wasted space (9/10 of block wasted)
  7. saved c000 to c0cc at first block (0x0)
  8. saved c0cc to c324 at fifth block (0x4)
  9. saved c324 to cec4 at 14th block (0xd)*/
  10. /*at 080D9EDC, in the save routine, place a branch to this (in r0)*/
  11. /*in pre-patched Fire Red, d9ef0*/
  12. .global load_hijack
  13. load_hijack: ldr r1, [r4]
  14. mov r3, #0xff
  15. lsl r3, r3, #0x4
  16. add r3, r3, r1
  17. ldrh r0, [r3, #0x4]
  18. cmp r0, #0x0
  19. beq first_cc_load
  20. cmp r0, #0x4
  21. beq middle_load
  22. cmp r0, #0xd
  23. beq last_load
  24. load_ender: cmp r5, #0xd
  25. ble next_loop_iter
  26. mov r0, #0x1
  27. pop {r3}
  28. mov r8, r3
  29. pop {r4-r7}
  30. pop {r1}
  31. bx r1
  32. first_cc_load: mov r1, #0xcc
  33. ldr r2, c0c8_addr
  34. b load_loop
  35. middle_load: mov r1, #0x96
  36. lsl r1, r1, #0x2
  37. ldr r2, c320_addr
  38. b load_loop
  39. last_load:
  40. mov r1, #0xba
  41. lsl r1, r1, #0x4
  42. ldr r2, cec0_addr
  43. load_loop: sub r3, #0x4
  44. ldr r0, [r3]
  45. str r0, [r2]
  46. sub r2, #0x4
  47. sub r1, #0x4
  48. cmp r1, #0x0
  49. bne load_loop
  50. b load_ender
  51. .align 2
  52. c0c8_addr: .word 0x0203c0c8
  53. c320_addr: .word 0x0203c320
  54. cec0_addr: .word 0x0203cec0
  55. next_loop_iter:
  56. ldr r0, game_load_ret_addr
  57. bx r0
  58. game_load_ret_addr: .word 0x080D9E71
  59. /*d9e85 for pre-patched*/
  60. .word 0xffffffff
  61. /*for the Save routine, we hijack before the save on Flash routine
  62. that is located at 080d991e. Change there for bx r7, and at 80D995C
  63. place pointer to this*/
  64. /*in pre-patched version is d9932 and d9970*/
  65. .global store_hijack
  66. store_hijack: mov r7, #0xff
  67. lsl r7, r7, #0x4
  68. add r7, r1, r7
  69. strh r0, [r7,#0x6]
  70. ldrh r6, [r7, #0x4]
  71. cmp r6, #0x0
  72. beq first_store
  73. cmp r6, #0x4
  74. beq middle_store
  75. cmp r6, #0xd
  76. beq last_store
  77. .hword 0x0000
  78. store_ender: ldr r0, game_store_ret_addr
  79. bx r0
  80. game_store_ret_addr: .word 0x080D9923
  81. /*in pre-patched return is d9937*/
  82. first_store: mov r3, #0xcc
  83. ldr r2, c0c8_addr_2
  84. b store_loop
  85. middle_store: mov r3, #0x96
  86. lsl r3, r3, #0x2
  87. ldr r2, c320_addr_2
  88. b store_loop
  89. last_store: mov r3, #0xba
  90. lsl r3, r3, #0x4
  91. ldr r2, cec0_addr_2
  92. store_loop: sub r7, #0x4
  93. ldr r0, [r2]
  94. str r0, [r7]
  95. sub r2, #0x4
  96. sub r3, #0x4
  97. cmp r3, #0x0
  98. bne store_loop
  99. b store_ender
  100. c0c8_addr_2: .word 0x0203c0c8
  101. c320_addr_2: .word 0x0203c320
  102. cec0_addr_2: .word 0x0203cec0