aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 72cede1406f4de25e0eac9399387d4a93ad8d9d7 (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<!--
.. File: README.md
.. Location: https://bgstack15.ddns.net/cgit/srb_lib
.. Author: bgstack15
.. SPDX-License-Identifier: GPL-3.0-only
.. Startdate: 2024-03-20-4 10:14
.. Title: Readme for savegame editor for Snoopy vs. the Red Baron
.. Project: srb_lib
.. Purpose: Read it.
.. Usage: Read it.
.. Reference: See heading References
.. Improve:
.. Documentation: Read it.
-->

# README for Savegame Editor for Snoopy vs. the Red Baron
Modify an existing savegame file for the PC game [Snoopy vs. the Red Baron (2006)](https://en.wikipedia.org/wiki/Snoopy_vs._the_Red_Baron_(video_game)).

# tl;dr

    ./srb.py --profile 1 --unlock-everything --buy-everything ~/"Documents/Snoopy vs. the Red Baron/Profile 1/Profile 1.sav"

## Upstream
This project's upstream is at <https://bgstack15.ddns.net/cgit/srb_lib/>.

## Alternatives
None found.

## Reason for existence
The author was unable to find any trainer or savegame editor for this game, and I wanted to be able to reset certain elements or cheat and give myself everything. Mostly I wanted "Octo-gun" and I was concerned I wasn't good enough to beat every level (mostly boss levels) with rank General. I did actually beat the game with 100% completion before I finished this tool.

## Using
Most capabilities have "set" and "get" parameters. Some have "set" and "add/remove" parameters. To see a full list of commands, run `./srb.py --help`.

Some common examples.

    ./srb.py --profile 1 --set-name "newname" --file "Profile 1.sav"
    ./srb.py --profile 1 --set-money 10000 --file "Profile 1.sav"
    ./srb.py --profile 1 --set-level 5,all --file "Profile 1.sav"
    ./srb.py --profile 1 --set-level 6,none --file "Profile 1.sav"
    ./srb.py --profile 1 --set-health 4 --file "Profile 1.sav"

Note that `--set-level 5,all` operates three separate parameters that could be done individually:

    --set-level-status 5,general
    --set-level-balloons 5,all
    --set-level-letters 5,all

Individual letter/balloon control is not implemented at this time.

## Dependencies
For the library and cli, just python3.

For the graphical frontend:

    sudo apt-get install python3-tkinter python3-pil.imagetk

## Building
N/A

## Design notes
The checksum used is this crc32:

    crc width=32 poly=0x4c11db7 init=0x0 xorout=0x235b4b9c refin=false refout=false out_endian=little

Which I only learned through the reverse-engineering efforts of <https://github.com/8051Enthusiast/delsum>.

Before I learned this, none of this savegame editing was possible.

The binary contents are stored in little-endian, which makes visual inspection of the file in a hexeditor slower.

![Screenshot of profile selection screen showing three names: "Hexedit," "4fun and," and "Profit."](.images/scrot-hexedit-for-fun-and-profit-srb.png "Screenshot of profiles with fun names")

## Graphical frontend
There is an included python tcl/tk frontend:

    ./srb_tk.py

The tool loads the default "Profile 1.sav" file right away. Clicking any widget effects an immediate change to the checksum. To save the file, you must select "Save" from the menu.

![Screenshot of graphical savegame editor](.images/scrot-savegame-editor-graphical.png "Screenshot of the savegame editor with a completed profile on display")

## Credits
Unless a graphic was taken from the game, any icons come from icons8.

<a target="_blank" href="https://icons8.com/icon/9336/aircraft">Main program icon</a> icon by <a target="_blank" href="https://icons8.com">Icons8</a>
<a target="_blank" href="https://icons8.com/icon/8Sk1THlBUpC6/hay-bale">Hay Bale</a> icon by <a target="_blank" href="https://icons8.com">Icons8</a>
<a target="_blank" href="https://icons8.com/icon/23346/wooden-beer-keg">Barrel</a> icon by <a target="_blank" href="https://icons8.com">Icons8</a>
<a target="_blank" href="https://icons8.com/icon/IjFwYfQ6Hmgc/geyser">Geyser</a> icon by <a target="_blank" href="https://icons8.com">Icons8</a>
<a target="_blank" href="https://icons8.com/icon/17358/pumpkin">Pumpkin</a> icon by <a target="_blank" href="https://icons8.com">Icons8</a>
<a target="_blank" href="https://icons8.com/icon/dwzqRjO6XcTN/battery">Battery</a> icon by <a target="_blank" href="https://icons8.com">Icons8</a>

## License
GPL 3.0. Contributions welcome!

## References

1. <https://bgstack15.ddns.net/blog/posts/2024/03/22/initial-research-for-hacking-savegame-files-for-snoopy-vs-the-red-baron/>
2. <https://bgstack15.ddns.net/blog/posts/2024/03/26/the-checksum-for-the-savegame-file-for-snoopy-vs-the-red-baron>
3. <https://github.com/8051Enthusiast/delsum>
4. <https://gist.github.com/Lauszus/6c787a3bc26fea6e842dfb8296ebd630>
5. <https://stackoverflow.com/questions/46109815/reversing-the-byte-order-of-a-string-containing-hexadecimal-characters>
6. [Walkthrough for Snoopy vs. the Red Baron](https://gamefaqs.gamespot.com/pc/930591-snoopy-vs-the-red-baron/faqs/46161)

Too many to list here. See the References heading in each file for more.
bgstack15