Unify save system into one save.h/.c; diverge storage format per platform
Renames savefile_t to saveslot_t and folds last session's standalone settings.h/.c module back in as savemeta_t, so there's one save system (SAVE.slots[] + SAVE.meta) instead of two parallel ones - while letting each platform pick its own physical format for the two concepts: - Linux now writes human-editable JSON (slot0.json, settings.json, ...) via yyjson's mutable writer API, so players can hand-fix a bad setting. - PSP folds meta into the same sceUtilitySavedata binary payload as its one save slot (SAVE_SLOT_COUNT_MAX=1 there - a future save picker will let players manage multiple named saves via the OS's own browser). - GameCube consolidates the 3 per-slot memory card files and the separate settings file into one combined card file. Also fixes two bugs surfaced while building this: the CRC finalize step seeked to a hardcoded offset (only safe for one section per file, breaks once meta+slots share a buffer), and save.c's async/sync dispatch left an unconditional fallback call that doesn't exist on PSP-only platforms. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,24 +7,21 @@
|
||||
|
||||
#pragma once
|
||||
#include "save/savelinux.h"
|
||||
#include "save/savestreamlinux.h"
|
||||
|
||||
typedef savelinux_t saveplatform_t;
|
||||
typedef savestreamlinux_t saveplatformstream_t;
|
||||
// Linux fully overrides every save operation with JSON I/O (see
|
||||
// savelinux.c/savejsonlinux.c) - nothing generic ever opens a
|
||||
// savestream_t here, so this only needs to exist for that shared type to
|
||||
// compile.
|
||||
typedef struct {
|
||||
uint8_t reserved;
|
||||
} saveplatformstream_t;
|
||||
|
||||
#define saveInitPlatform saveInitLinux
|
||||
#define saveDisposePlatform saveDisposeLinux
|
||||
#define saveDeletePlatform saveDeleteLinux
|
||||
|
||||
#define saveStreamOpenReadPlatform(stream, slot) \
|
||||
saveStreamOpenReadLinux(&(stream)->platform, &(stream)->found, slot)
|
||||
#define saveStreamOpenWritePlatform(stream, slot) \
|
||||
saveStreamOpenWriteLinux(&(stream)->platform, slot)
|
||||
#define saveStreamClosePlatform(stream) \
|
||||
saveStreamCloseLinux(&(stream)->platform)
|
||||
#define saveStreamReadBytesPlatform(stream, buf, len) \
|
||||
saveStreamReadBytesLinux(&(stream)->platform, buf, len)
|
||||
#define saveStreamWriteBytesPlatform(stream, buf, len) \
|
||||
saveStreamWriteBytesLinux(&(stream)->platform, buf, len)
|
||||
#define saveStreamSeekPlatform(stream, pos) \
|
||||
saveStreamSeekLinux(&(stream)->platform, pos)
|
||||
#define saveSlotDeletePlatform saveDeleteSlotLinux
|
||||
#define saveSlotLoadPlatform saveSlotLoadLinux
|
||||
#define saveSlotWritePlatform saveSlotWriteLinux
|
||||
#define saveMetaLoadPlatform saveMetaLoadLinux
|
||||
#define saveMetaWritePlatform saveMetaWriteLinux
|
||||
|
||||
Reference in New Issue
Block a user