/** * 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 // ISFS_Rename exists, so NAND uses the same write-temp-then-rename // pattern as PSP/Linux - see SAVE_DEVICE_DATA_RAW in save/savedevice.h. #define SAVE_DEVICE_DATA_RAW #define saveDeviceDataWritePlatform saveDeviceDolphinNandDataWrite #define saveDeviceDataReadPlatform saveDeviceDolphinNandDataRead #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 // libfat gives standard POSIX rename(), so SD uses the same // write-temp-then-rename pattern as PSP/Linux - see SAVE_DEVICE_DATA_RAW // in save/savedevice.h. #define SAVE_DEVICE_DATA_RAW #define saveDeviceDataWritePlatform saveDeviceDolphinSDDataWrite #define saveDeviceDataReadPlatform saveDeviceDolphinSDDataRead #else #include "savedevicedolphincard.h" #define SAVE_DEVICE_COUNT 2 #define saveDevicePlatformInit saveDeviceDolphinCardInit #define saveDevicePlatformUpdate saveDeviceDolphinCardUpdate #define saveDeviceCheckAvailabilityPlatform \ saveDeviceDolphinCardCheckAvailability #define saveDevicePlatformDispose saveDeviceDolphinCardDispose // No rename or resize primitive on the CARD API, so this ping-pongs // between two fixed files instead - see SAVE_DEVICE_DOLPHIN_CARD_FILENAME_0 // in savedevicedolphincard.h and SAVE_DEVICE_DATA_RAW in save/savedevice.h. #define SAVE_DEVICE_DATA_RAW #define saveDeviceDataWritePlatform saveDeviceDolphinCardDataWrite #define saveDeviceDataReadPlatform saveDeviceDolphinCardDataRead #endif