Files
dusk/src/duskpsp/save/savedeviceplatform.h
T
YourWishes 82ae2bce9d Add compressed combined save format for PSP and Dolphin
Memory sticks/cards don't suit N+1 separate save files the way Linux's
filesystem does, so add an opt-in SAVE_DEVICE_DATA_RAW mode: settings and
all save slots get serialized to JSON, concatenated, zlib-compressed, and
framed with a magic/version/checksum/generation header, then read/written
as a single blob through one combined platform hook instead of four.

- PSP and Dolphin's SD/NAND backends write via a temp file + atomic rename,
  so a crash mid-write can never leave a half-written save behind.
- GameCube memory cards have no rename or resize primitive, so they
  ping-pong between two fixed files instead, picking whichever is valid and
  has the higher generation counter on load.
- Linux is untouched (still four separate JSON files); saveslot.h/
  savesettings.h drop their now-unnecessary pack(1) now that nothing
  persists them as raw bytes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-17 21:28:56 -05:00

32 lines
1.0 KiB
C

/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "savedevicepsp.h"
#define SAVE_DEVICE_COUNT 1
#define saveDevicePlatformInit saveDevicePSPInit
#define saveDevicePlatformUpdate saveDevicePSPUpdate
#define saveDeviceCheckAvailabilityPlatform saveDevicePSPCheckAvailability
#define saveDevicePlatformDispose saveDevicePSPDispose
// The memory stick has no directory-listing UI convention to preserve like
// GameCube/Wii memory cards do, so settings + all save slots are combined
// into one compressed blob rather than kept as separate files - see
// SAVE_DEVICE_DATA_RAW in save/savedevice.h.
#define SAVE_DEVICE_DATA_RAW
#define saveDeviceDataWritePlatform saveDevicePSPDataWrite
#define saveDeviceDataReadPlatform saveDevicePSPDataRead
#ifndef SAVE_DEVICE_PSP_DIRECTORY_NAME
#define SAVE_DEVICE_PSP_DIRECTORY_NAME "ms0:/DUSK"
#endif
#ifndef SAVE_DEVICE_PSP_DATA_FILENAME
#define SAVE_DEVICE_PSP_DATA_FILENAME "save.dat"
#endif