The ROM that I am trying to modify stores instructions for how to load from or save to save states. A value is stored in 2 bytes that equals to the character ID. The game then uses this character ID to save the data for that character. For example, a (hex) value of 0006 will mean the game tries to save/load data for character with ID = 0006.
At runtime, I insert an Action Replay code to change the character's ID to another value, say, 002D. However, when I save the game, the game still tries to save the data for the character with the old ID (0006). Since this ID has now been overridden by the AR code, yet the value in ROM has not been updated, the save becomes corrupted.
The question I'm asking is: How can I modify the value in ROM at a later time so that it corresponds with the new value I have specified in my Action Replay code? (i.e. change the value in ROM to 002D as well)
Note: I only want to enable the AR code during certain parts of the game, thus I cannot just change the value in ROM (which would change the value permanently). I also don't want to make another copy of the ROM for every character ID I want to override. What are my options here?