Qhimm.com Forums

Miscellaneous Forums => Scripting and Reverse Engineering => Topic started by: antd on 2012-11-18 22:42:31

Title: How to Fix Save File (Checksum)?
Post by: antd on 2012-11-18 22:42:31
I want to corrupt a save file and then be able to load it (PSX version).

I have successfully corrupted a save file. However, I cannot load it because it says 'file ruined'.

I have read that it is possible, by changing the 'window colour' values, to fix the checksum and load a corrupted save file.
I've also found that the window colour can change when attempting to load a corrupted save file....

Does anyone here know how to do this? Or how I can find out which 'window colour' settings to use to fix the file?

Thanks! :D
Title: Re: How to Fix Save File (Checksum)?
Post by: Vgr on 2012-11-19 01:51:30
Stop breaking FF7!

More seriously, I have heard of something similar before, so it probably isn't impossible. But I don't know if it's possible.
Title: Re: How to Fix Save File (Checksum)?
Post by: sithlord48 on 2012-11-19 04:23:21
I want to corrupt a save file and then be able to load it (PSX version).

I have successfully corrupted a save file. However, I cannot load it because it says 'file ruined'.

I have read that it is possible, by changing the 'window colour' values, to fix the checksum and load a corrupted save file.
I've also found that the window colour can change when attempting to load a corrupted save file....

Does anyone here know how to do this? Or how I can find out which 'window colour' settings to use to fix the file?

Thanks! :D

open the file in Black Chocobo (http://www.blackchocobo.com) and save it , it should fix your checksum.

or you would like to see code for how to make the checksum

Code: [Select]
int FF7Save::ff7__checksum( void* qw )
{
   int i = 0, t, d;
   long r = 0xFFFF, len = 4336;
   long pbit = 0x8000;
   char* b=(char*)qw;

   while( len-- ) {
      t = b[i++];
      r ^= t << 8;
      for(d=0;d<8;d++) {
         if( r & pbit )
            r = ( r << 1 ) ^ 0x1021;
         else
            r <<= 1;
      }
      r &= ( 1 << 16 ) - 1;
   }
   return (r^0xFFFF)&0xFFFF;
}
Title: Re: How to Fix Save File (Checksum)?
Post by: Vgr on 2012-11-19 21:37:36
Just saying, a TAS disallows any use of external tools such as a save editor or even memory editor. Everything has to be redoable. Inside the emulator. That's probablu why he asks.
Title: Re: How to Fix Save File (Checksum)?
Post by: antd on 2012-11-19 21:54:43
I see!

Another question:
Currently the save mechanism saves the FieldID (2bytes) in 1 frame.

Are there any thoughts on how to get this to save in 2 frames? (1 byte in one frame, the other byte in the next frame)

If it can be done in 2 frames, instead of 1, I will be able to skip most of the game by manipulating the FieldID via a corrupt save.
Title: Re: How to Fix Save File (Checksum)?
Post by: nfitc1 on 2012-11-19 21:59:26
It's probably impossible in a frame-advancing emulator. It would require millisecond timing to do such a thing even in real-time. Even so, each 'frame' isn't considered fully processed until all the background processing is finished too.
Title: Re: How to Fix Save File (Checksum)?
Post by: sithlord48 on 2012-11-20 01:52:23
Just saying, a TAS disallows any use of external tools such as a save editor or even memory editor. Everything has to be redoable. Inside the emulator. That's probablu why he asks.

1. what is a TAS ?
2. where do you see this in his post?
Title: Re: How to Fix Save File (Checksum)?
Post by: nfitc1 on 2012-11-20 13:53:14
1. what is a TAS ?

Tool-Aided Speedrun/Superrun. Basically playing a game frame-by-frame and being able to save/load whenever to play a game from beginning to end as fast as possible. There's a website devoted to them.

2. where do you see this in his post?

It's not, but in the aforementioned website he's listed as the author of one of the more anticipated runs (http://tasvideos.org/CriticalFive.html). FFVII hasn't been done, but FFVIII (http://tasvideos.org/movies.cgi?id=1835) and FFIX (http://tasvideos.org/movies.cgi?id=2022) have. The only pre-PS2 FF not done is 2. I'm sure that would be easy enough to do.
Title: Re: How to Fix Save File (Checksum)?
Post by: antd on 2012-11-20 16:50:00
It's probably impossible in a frame-advancing emulator. It would require millisecond timing to do such a thing even in real-time. Even so, each 'frame' isn't considered fully processed until all the background processing is finished too.
A snes emulator was modified to allow "mid-frame resets". Essentially it allowed the author of the glitched chrono trigger run to do what I'm trying to do in ffvii.

But it seems there is almost no chance of this being implemented in the current psx tas emulator.

Oh well!  :-X
Title: Re: How to Fix Save File (Checksum)?
Post by: nfitc1 on 2012-11-20 18:15:09
A snes emulator was modified to allow "mid-frame resets". Essentially it allowed the author of the glitched chrono trigger run to do what I'm trying to do in ffvii.

Wouldn't the playback have to happen on the same type of modified emulator? I thought the recorded commands were stored by frame. I'm not much of an authority on emulators either way.

No one believes that I had a hand in the existence of TASes anyway.  :cry:
Title: Re: How to Fix Save File (Checksum)?
Post by: antd on 2012-11-20 20:13:48
Wouldn't the playback have to happen on the same type of modified emulator? I thought the recorded commands were stored by frame. I'm not much of an authority on emulators either way.

No one believes that I had a hand in the existence of TASes anyway.  :cry:
Yup. Playback requires that specific emulator build.