Hi, everyone.
I'm currently making use of the following code to patch CRE files so they use a different animation:
ACTION_DEFINE_ASSOCIATIVE_ARRAY cd_animation_map BEGIN
0x6000 => 0x5622
[...]
END
COPY_EXISTING_REGEXP GLOB ~.*\.cre~ ~override~
READ_LONG 0x28 current
PATCH_PHP_EACH cd_animation_map AS old => new BEGIN
PATCH_IF (current = old) BEGIN
WRITE_LONG 0x28 new
END
END
BUT_ONLY
So far, so good; it works.
However, this copies a disproportionate amount of CRE files into the override that don't really need to be patched, since their animation doesn't match the "old" one specified in my associative array.
So I was wondering: Is it possible to write code that cycles through existing CRE files, reads 0x28, only copies them to the override if 0x28 matches the "old" value in the array, then cycles through copied CRE files and patches from "old" to "new"?
(Probably not strictly needed as the Enhanced Editions run pretty smooth even with several files in the override, but I figured optimizing would still be a good idea.)