Camtech075

get at me, hex

Feb 20th, 2012
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. .align 2
  2. @Hardware offset
  3. .long 0x08000000
  4. @AS routine is at 0x08028B76
  5.  
  6. @----------
  7. @ Hook
  8. @----------
  9.  
  10. BDH_HOOK:
  11. .align 2
  12. @.org 0x08029440
  13. .set BDH_HOOK_SIZE, BDH_HOOK_END - BDH_HOOK_ST
  14. .set BDH_HOOK_ORG, 0x08029440
  15. .long BDH_HOOK_ORG
  16. .long 0x00000002
  17. .long BDH_HOOK_SIZE
  18.  
  19. .thumb
  20. .short 0x00
  21.  
  22. BDH_HOOK_ST:
  23. @Preparations
  24. push {r9,lr}
  25. ldr r0, BDH_HOOK_TARG
  26. bl r0
  27. mov lr, r2
  28. lsl r0, #0x0 @Padding
  29. @Right after this is the rest of the original function.
  30.  
  31. BDH_HOOK_TARG:
  32. .align 2
  33. .long BDH_HACK_ORG + 1
  34. BDH_HOOK_END:
  35.  
  36. @----------
  37. @ Hack
  38. @----------
  39.  
  40. .align 2
  41. @.org 0x8D3___
  42.  
  43. BDH_HACK:
  44. .set BDH_HACK_SIZE, BDH_HACK_END - BDH_HACK_ST
  45. .set BDH_HACK_ORG, 0x08D3___
  46. .long BDH_HACK_ORG
  47. .long 0x00000000
  48. .long BDH_HACK_SIZE
  49.  
  50. .thumb
  51.  
  52. BDH_HACK_ST:
  53. ldrh r2, [r7, r2] @Load enemy HP: Missing
  54. mov r3, #0x4 @Ready R3: Missing
  55. ldsh r0, [r1, r3] @Load damage: missing
  56. cmp r0, r2 @Is damage less than enemy HP?: missing
  57. ble RETURN
  58. mov r9, #0x3 @Prepare R9
  59. cmp r2, r9 @
  60. beq NEGATE_ATT @If equal, negate attack
  61. strh r2, [r1, #0x4] @Otherwise, set enemy HP as damage: missing
  62. b RETURN
  63.  
  64. NEGATE_ATT: @The actual hack bit
  65. mov r9, #0x1 @R9 is useless, so use it as scratch
  66. strh r9, [r1, #0x4] @Store 1 as damage.
  67.  
  68. @Cleanup.
  69.  
  70. RETURN:
  71. pop {r9, r2} @R2 is safe, it gets clobbered immediately after return.
  72. bx lr @Return to main function
Advertisement
Add Comment
Please, Sign In to add comment