Edit. Glad you got it working. It seems pokegen has a feature that is essentially the copy data into new save thing I was on about earlier. I will leave what I wrote below.
Offhand I am not sure and I lack the time at present to go through a pokemon hacking site to figure out the format. Technically there are a few ways you could otherwise figure it out without knowing how the save format works* but I am not sure if you would do well for you.
The general idea is you have a save, it might have three slots for three players or something.
Each of those slots has two saves within it.
When you save one of those slots is used, next time you save the next one is used. Obviously the game also keeps track of which one is the current. This is partially as a backup, partially as a thing called wear levelling.
The idea would be that you corrupt the "current" save (even opening in a hex editor, finding the location of said save and overwriting with random keyboard mashings will do the job).
You load the game (in an emulator if you want). The game will try to load, see the "current" one is corrupt and then try to fall back to the previous one which will hopefully still be good, albeit at the loss of a bit of progress as it will be the time before. You then save normally and carry on with your game.
Depending upon how it was corrupted though the game might well already have tried this and still failed. If it was more that a save editor was used and corrupted it (but otherwise kept all the checks happy) then that is a different matter, hence why I asked how the corruption happened.
*the two ideas for it I would have other than finding a copy of the save format (
https://projectpokemon.org/docs/gen-4/ seems rather limited as well) would be 1) if this corrupted version still saves then save a few times and note where the changes are at. Go back to your original and figure out what was the "current" one and do the random gibberish thing in that section.
2) pokegen will also know what the current one is. Do some mods with it (don't care, anything really), do a compare with a hex editor to see which parts were changed, overwrite those changes again with random gibberish and then try to load the game as per the other parts of the thread.