Add PSP/GameCube/Wii save-device availability checks

PSP checks memory-stick reachability via sceIoGetstat. GameCube gets two
devices (CARD_SLOTA/CARD_SLOTB), each mounted via CARD_Init/CARD_Mount and
checked for free space via CARD_GetDirectory/CARD_GetBlockCount. Wii picks
between three storage methods at compile time (DUSK_SAVE_WII_METHOD =
NAND/CARD/SD in wii.cmake, default NAND via ISFS) since real hardware
behavior for the default is unverified.

Also fixes two pre-existing bugs found while build/runtime-testing this
across PPSSPP and Dolphin: wrong libogc language macros in
systemGetLocaleDolphin, and a missing SYS_STDIO_Report(true) call that
silently swallowed all guest console output in Dolphin.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-14 16:20:28 -05:00
parent 45331c2a60
commit d7223d7387
16 changed files with 670 additions and 2 deletions
+44
View File
@@ -0,0 +1,44 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
// GameCube only ever has the CARD_SLOTA/CARD_SLOTB memory card devices.
// Wii additionally picks between three storage methods, selected by
// DUSK_SAVE_WII_METHOD in cmake/targets/wii.cmake:
// - NAND (default): real internal storage via ISFS, see
// savedevicedolphinnand.h for the caveats around this.
// - CARD: reuses the exact same GameCube memory card code, since libogc's
// CARD API transparently redirects to Wii's NAND-based GameCube memory
// card emulation.
// - SD: the SD card via libfat, same mechanism this project already uses
// for Dolphin/Wii asset loading (see assetdolphinfat.c).
#if defined(DUSK_WII) && defined(DUSK_SAVE_WII_METHOD_NAND)
#include "savedevicedolphinnand.h"
#define SAVE_DEVICE_COUNT 1
#define saveDevicePlatformInit saveDeviceDolphinNandInit
#define saveDevicePlatformUpdate saveDeviceDolphinNandUpdate
#define saveDeviceCheckAvailabilityPlatform \
saveDeviceDolphinNandCheckAvailability
#define saveDevicePlatformDispose saveDeviceDolphinNandDispose
#elif defined(DUSK_WII) && defined(DUSK_SAVE_WII_METHOD_SD)
#include "savedevicedolphinsd.h"
#define SAVE_DEVICE_COUNT 1
#define saveDevicePlatformInit saveDeviceDolphinSDInit
#define saveDevicePlatformUpdate saveDeviceDolphinSDUpdate
#define saveDeviceCheckAvailabilityPlatform \
saveDeviceDolphinSDCheckAvailability
#define saveDevicePlatformDispose saveDeviceDolphinSDDispose
#else
#include "savedevicedolphincard.h"
#define SAVE_DEVICE_COUNT 2
#define saveDevicePlatformInit saveDeviceDolphinCardInit
#define saveDevicePlatformUpdate saveDeviceDolphinCardUpdate
#define saveDeviceCheckAvailabilityPlatform \
saveDeviceDolphinCardCheckAvailability
#define saveDevicePlatformDispose saveDeviceDolphinCardDispose
#endif