mirror of
https://git.eden-emu.dev/archive/citron
synced 2026-04-16 17:50:45 -04:00
feat(fs): Cross-Compatible Emulator Save Pathing w/ Custom Save Paths
Signed-off-by: Collecting <collecting@noreply.localhost>
This commit is contained in:
@@ -132,12 +132,32 @@ Result IFileSystem::GetEntryType(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result IFileSystem::Commit() {
|
Result IFileSystem::Commit() {
|
||||||
|
// 1. Standard Commit
|
||||||
Result res = backend->Commit();
|
Result res = backend->Commit();
|
||||||
if (res != ResultSuccess) return res;
|
if (res != ResultSuccess) return res;
|
||||||
|
|
||||||
if (save_factory && Settings::values.backup_saves_to_nand.GetValue()) {
|
// Citron: Shutdown Safety Check
|
||||||
LOG_INFO(Common, "IFileSystem: Commit detected, triggering NAND backup...");
|
// If the emulator is stopping, the VFS might be invalid. Skip mirroring to prevent SEGV.
|
||||||
save_factory->DoNandBackup(save_space, save_attr, content_dir);
|
if (system.IsShuttingDown()) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. (Citron NAND -> External)
|
||||||
|
if (save_factory) {
|
||||||
|
u64 title_id = save_attr.program_id != 0 ? save_attr.program_id : system.GetApplicationProcessProgramID();
|
||||||
|
auto mirror_dir = save_factory->GetMirrorDirectory(title_id);
|
||||||
|
|
||||||
|
if (mirror_dir != nullptr) {
|
||||||
|
LOG_INFO(Service_FS, "Mirroring: Pushing Citron NAND data back to external source...");
|
||||||
|
|
||||||
|
// SYNC: Citron NAND Title ID folder -> Selected External Folder Contents
|
||||||
|
save_factory->SmartSyncFromSource(content_dir, mirror_dir);
|
||||||
|
|
||||||
|
LOG_INFO(Service_FS, "Mirroring: Push complete.");
|
||||||
|
}
|
||||||
|
else if (Settings::values.backup_saves_to_nand.GetValue()) {
|
||||||
|
save_factory->DoNandBackup(save_space, save_attr, content_dir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
R_RETURN(res);
|
R_RETURN(res);
|
||||||
|
|||||||
Reference in New Issue
Block a user