View Single Post
Old 04-27-2018, 01:39 PM   #2
geek1011
Wizard
geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.
 
Posts: 2,804
Karma: 7025947
Join Date: May 2016
Location: Ontario, Canada
Device: Kobo Mini, Aura Edition 2 v1, Clara HD
Here are some regexps I'm working on to convert the patches to my (WIP) new format (the output needs to be checked, as these don't cover edge cases):

Note: These need to be applied without case sensitivity.

replace_bytes:
Spoiler:

Code:
replace_bytes ?= ?([0-9A-Fa-f]+), ?([0-9A-Fa-f ]+), ?([0-9A-Fa-f ]+)$
to
Code:
  - ReplaceBytes: {Offset: 0x$1, FindH: $2, ReplaceH: $3}


replace_int:
Spoiler:

Code:
replace_int ?= ?([0-9A-Fa-f]+), ?([0-9-]+), ?([0-9-]+)$
to
Code:
  - ReplaceInt: {Offset: 0x$1, Find: $2, Replace: $3}


replace_float:
Spoiler:

Code:
replace_float ?= ?([0-9A-Fa-f]+), ([0-9.-]+), ?([0-9.-]+)$
to
Code:
  - ReplaceFloat: {Offset: 0x$1, Find: $2, Replace: $3}


base_address:
Spoiler:

Code:
base_address ?= ?([0-9A-Fa-f]+)
to
Code:
  - BaseAddress: 0x$1


patch_name:
Spoiler:

Code:
patch_name ?= ?`(.+?)`$
to
Code:
$1:


patch_enable:
Spoiler:

Code:
patch_enable ?= ?`(.+?)`$
to
Code:
  - Enabled: $1


find_base_address:
Spoiler:

Code:
find_base_address ?= ?`(.+?)`$
to
Code:
  - FindBaseAddressString: "$1"
Important: For patches which consist of strings of only bytes, use FindBaseAddressHex instead!


replace_string:
Spoiler:

Code:
replace_string ?= ?([0-9A-Fa-f]+), ?`((?:[^`\\]|\\.)*)`, ?`((?:[^`\\]|\\.)*)`$
to
Code:
  - ReplaceString: {Offset: 0x$1, Find: "$2", Replace: "$3"}


patch_group:
Spoiler:

Code:
# ?patch_group ?= ?`(.+?)`
to
Code:
  - PatchGroup: $1


patch:
Spoiler:

Code:
(<patch>|</patch>)
to


The description and cleanup needs to be done manually, and the output needs to be checked.

Last edited by geek1011; 04-27-2018 at 09:58 PM.
geek1011 is offline   Reply With Quote