-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpop_profile_sav.1sc
46 lines (36 loc) · 1.58 KB
/
pop_profile_sav.1sc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//------------------------------------------------
//--- 010 Editor v12.0.1 Script File
//
// File: Prince of Persia: Warrior Within - Save0.SAV (CRC-recomputer script)
// Authors: Swyter
// Version: 2023.01.11
// Purpose: Recalculate the checksums after tampering with save files.
// Category: Game
//------------------------------------------------
#include <pop_crc32_functions.h>
/* swy: run the original template to fill out the data structures in
the template results; we depend on this to work */
RunTemplate("pop_profile_sav.bt");
uint cur_block = 0, overwritten_blocks = 0; uint32 crc;
//for (cur_block = 0; cur_block < block_count; cur_block++)
{
crc = compute_crc_for_block(precomputed_table, startof(full_size) + sizeof(uint) /* swy: from the field after the CRC */, full_size);
Assert(crc != 0xffffffff, "CRC computation failed");
Printf(
"\n[i] %16s: offset: %#5x, len: %#5x, checksum: %#010x/%08x (%s)",
"intro", full_size, startof(full_size) + sizeof(uint),
checksum, crc, checksum == crc ? "OK" : "BAD"
);
/* swy: overwrite it with the correct/new checksum if it's not correct */
if (checksum != crc)
{
checksum = crc;
overwritten_blocks++;
}
}
Printf("\n\n[+] Done, overwritten %u/%u.\n", overwritten_blocks, 1);
//for (j = 0; j <= 53; j++)
//{
// level_label = j; story_chapter_title = j <= 31 ? j : 31; in_game_time_secs = j * 60; time.year = j * 100; time.minute = story_chapter_title;
// FileSaveRange(Str("%s\\..\\tester\\Save%u.SAV", FileNameGetPath(GetFileName()), j), 0, FileSize());
//}