Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //--------------------------------------
- //--- 010 Editor v6.0.2 Script File
- //
- // File: Rune Factory 4 save checksum
- // Author: HenryEx
- // Revision: 2
- // Purpose: Repair checksum on modified save files
- //--------------------------------------
- RequiresFile(); // needs file to run on
- OutputPaneClear(); // clear output
- // Define variables
- int64 size, fsize, pad, pos;
- uint savehash, magic;
- // Initialize variables
- fsize = FileSize();
- magic = ReadUInt( 0 );
- pad = 0xE0; // EoF block not used in hash
- pos = 4; // offset after hash
- // Throw error if file layout has changed
- switch( fsize ) {
- case 0x1FC:
- Printf( "File size %Ld - File should be RF4 (3DS) save selection \n", fsize );
- break;
- case 0x2458:
- Printf( "File size %Ld - File should be RF4 (Switch) save selection \n", fsize );
- break;
- case 0x22400:
- Printf( "File size %Ld - File should be RF4 (3DS) save file \n", fsize );
- break;
- case 0x22480:
- Printf( "File size %Ld - File should be RF4 (Switch) save file \n", fsize );
- break;
- default:
- Printf( "Unexpected file size %Ld! Script failed!\n", fsize );
- Warning( "File mismatch, script terminated" );
- Exit( -1 );
- }
- // Change vars in case it's the save selector file rf4s.sav
- if( magic == 1144276562 ) // string 'RF4D'
- {
- Printf( "Calculating system save file hash...\n" );
- pos += 4;
- size = fsize - pos;
- }
- else {
- Printf( "Calculating save file hash...\n" );
- size = fsize - pad - pos;
- }
- savehash = Checksum( CHECKSUM_CRC32, pos, size, -1, -1 );
- Printf( "New checksum: %x \n", savehash );
- WriteUInt( pos - 4, savehash );
- Printf( "Success! Save the file now." );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement