No Description

custom_structs_malloc_hook.S 591B

123456789101112131415161718192021222324252627282930313233343536
  1. .text
  2. .align 2
  3. .thumb
  4. .global alloc_res_hook
  5. alloc_res_hook:
  6. str r0, [r4] @save last malloced data pointer
  7. ldr r4, =0x02023FF4 @some battle struct pointer
  8. mov r0, #0x20 @size of struct
  9. bl malloc_and_clear
  10. str r0, [r4]
  11. bl malloc_battle_structs @allocate custom stuff
  12. ldr r0, =0x0802E084|1
  13. bx r0
  14. .align 2
  15. .global free_res_hook
  16. free_res_hook:
  17. ldr r4, =0x02022BBC
  18. ldr r0, [r4]
  19. bl free_routine
  20. str r5, [r4] @@null_pointer
  21. bl free_battle_structs
  22. ldr r0, =0x0802E200|1
  23. bx r0
  24. .align 2
  25. malloc_and_clear:
  26. ldr r3, =malloc
  27. bx r3
  28. free_routine:
  29. ldr r3, =free
  30. bx r3