For education purposes only · no game files included · bring your own THUG
Guide 03

How save works

How the console "memory card" became a folder of folders, and how to keep saves out of a read-only app bundle.

GoalSaving and loading through the game's own menus, with saves you can see, copy and back up.

1Pick the console code path that fits a filesystem

The game runs its Xbox save code (Config::HARDWARE_XBOX): every save is a directory with a display name, holding the data and an icon. Display names may contain characters files can't, so each folder gets a sanitized name and keeps the real one in SaveMeta.txt, like the Xbox's SaveMeta.xbx.

excerptWn32/Code/Plat/Sys/MemCard/p_McMan.cpp
The game's own save screen, listing the folders in <code>save/</code> with their <code>SaveMeta.txt</code> names, sizes and dates.
The game's own save screen, listing the folders in save/ with their SaveMeta.txt names, sizes and dates.

An int holding a FILE*: fine in 2003, a segfault with extra steps in 64-bit land. Hence the handle table.

2Move user files out of the bundle

From a disk image (read-only) or after Gatekeeper translocation, the app can't write next to itself, and an update would wipe it anyway. So user files get their own root: next to the executable for a plain build, ~/Library/Application Support/THUG for THUG.app.

diffWn32/Code/Plat/Sys/File/p_filesys.cpp · 97790b7
diffWn32/Code/Plat/Sys/MemCard/p_McMan.cpp · 97790b7

3Know where your saves are

RunningSavesSettings
./Game/THUGGame/save/Game/config.ini
THUG.app~/Library/Application Support/THUG/save/~/Library/Application Support/THUG/config.ini

Back up a save by copying its folder; delete one in the game or by deleting the folder. The most recent story/skater save loads automatically at start.