View Single Post
Old 05-29-2019, 03:44 PM   #14
GeoffR
Wizard
GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.
 
GeoffR's Avatar
 
Posts: 3,821
Karma: 19162882
Join Date: Nov 2012
Location: Te Riu-a-Māui
Device: Kobo Glo
Quote:
Originally Posted by geek1011 View Post
That should work, but then I wouldn't be able to fit the bugfix in there too.
I think this would work, but have not tested. it uses the fact that r7 = sp+8 which might change in the future.
Spoiler:
Code:
Increase TOC level indentation and fix extra indentation bug:
  - Enabled: yes
  - PatchGroup: TOC Indentation
  - Description: |
      The space indented Table of Contents levels are quite hard to see, as the
      difference is almost too small to easily notice. In addition, this fixes
      the bug where all TOC entries are indented by 1 level extra.
  - BaseAddress: 0x8B2FD2
  # Clear out existing instructions with NOPs
  - ReplaceBytes: {Offset: 0, FindH: 07 F1 0C 0B, ReplaceH: 00 20 00 20} # put string address in fp
  - ReplaceBytes: {Offset: 4, FindH: 42 00, ReplaceH: 00 20}             # shift level by 1 (multiply by 2) into r2
  - ReplaceBytes: {Offset: 6, FindH: 4F F0 20 01, ReplaceH: 00 20 00 20} # set r1 to 0x20 (space char)
  - ReplaceBytes: {Offset: 10, FindH: 58 46, ReplaceH: 00 20}            # put fp in r0
  # Put new instructions
  - ReplaceBytes: {Offset: 0, FindH: 00 20, ReplaceH: 40 1E}             # decrease level by 1
  - ReplaceBytes: {Offset: 2, FindH: 00 20, ReplaceH: 02 22}             # load multiplier into r2
  - ReplaceBytes: {Offset: 4, FindH: 00 20, ReplaceH: 42 43}             # multiply level, result into r2
  - ReplaceBytes: {Offset: 6, FindH: 00 20, ReplaceH: 20 21}             # set r1 to 0x20 (space char) 
  - ReplaceBytes: {Offset: 8, FindH: 00 20, ReplaceH: 05 A8}             # put string address (sp+20==r7+12) into r0
  - ReplaceBytes: {Offset: 10, FindH: 00 20, ReplaceH: 83 46}            # save r0 into fp
  # Replacement value (multiplier):
  - ReplaceInt: {Offset: 2, Find: 2, Replace: 6}
GeoffR is offline   Reply With Quote