Default Wii saves to SD card, store saves next to dusk.dsk/EBOOT.PBP

Wii NAND save storage is blocked by Dolphin's IOS ticket-rights check for
homebrew (documented earlier this session as a known, non-code limitation),
so Wii now defaults DUSK_SAVE_WII_METHOD to SD instead of NAND.

Also: asset_t gains ASSET.baseDirectory, populated by each platform's asset
loader with the real directory dusk.dsk was opened from (or, on PSP, the
directory EBOOT.PBP itself lives in, since dusk.dsk is embedded inside it).
Wii SD and PSP now write their single combined save file directly into
that directory instead of a separate hardcoded path, and no longer need to
create it (it's already known to exist). Linux now uses a `saves/`
subdirectory of that same directory instead of ~/.dusk/saves, since it
keeps multiple files (settings + one per slot). Wii NAND and GameCube/Wii
memory-card storage are unaffected - neither has a real filesystem-path
concept this applies to.

Built and verified on Linux, PSP (Docker), GameCube (Docker) and Wii
(Docker) - confirmed via the compiler invocation that Wii now compiles
with DUSK_SAVE_WII_METHOD_SD.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
YourWishesandClaude Sonnet 5 committed 2026-09-04 09:43:00 -05:00
1 parent f9820bd226
commit 3c3dc35e1d
11 files changed
+70 -49

No files matched your search

+10 -12
View File
@@ -10,10 +10,10 @@
#include "save/saveslot.h"
#include "save/savesettings.h"
#include "save/savejson.h"
#include "asset/asset.h"
#include "assert/assert.h"
#include "util/mkdirp.h"
#include "util/string.h"
#include <stdlib.h>
errorret_t saveDeviceLinuxInit(savedevice_t *device) {
assertNotNull(device, "device cannot be null");
@@ -37,17 +37,15 @@ void saveDeviceLinuxCheckAvailability(savedevice_t *device) {
"Device state incorrect?"
);
// Resolve the save directory.
// Resolve the save directory - can't actually fail (just a
// stringFormat), unlike when this derived from $HOME, but this function
// returns void (via saveDeviceFireCallback below) rather than
// errorret_t, so there's no return-early errorChain to use here.
char_t directory[SAVE_DEVICE_LINUX_PATH_MAX];
errorret_t directoryResult = saveDeviceLinuxGetDirectory(
directory, sizeof(directory)
);
if(errorIsNotOk(directoryResult)) {
errorCatch(errorPrint(directoryResult));
device->state = SAVE_DEVICE_STATE_UNAVAILABLE;
device->reasonKey = "save.linux.no_home";
return saveDeviceFireCallback(device);
}
if(errorIsNotOk(directoryResult)) errorCatch(errorPrint(directoryResult));
// Mkdirp the save directory.
int mkdirpResult = mkdirp(directory, 0700);
@@ -66,10 +64,10 @@ void saveDeviceLinuxCheckAvailability(savedevice_t *device) {
errorret_t saveDeviceLinuxGetDirectory(char_t *dest, const size_t destSize) {
assertNotNull(dest, "dest cannot be null");
const char_t *home = getenv("HOME");
if(home == NULL) errorThrow("HOME environment variable is not set");
stringFormat(dest, destSize, "%s/%s", home, SAVE_DEVICE_LINUX_DIRECTORY_NAME);
stringFormat(
dest, destSize, "%s/%s",
ASSET.baseDirectory, SAVE_DEVICE_LINUX_SAVES_SUBDIR_NAME
);
errorOk();
}