Skip to content

Commit

Permalink
backup before restore redirected to ROOT
Browse files Browse the repository at this point in the history
  • Loading branch information
w3irDv committed Aug 23, 2024
1 parent a71ec42 commit c63e9db
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 9 deletions.
3 changes: 3 additions & 0 deletions include/BackupSetList.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class BackupSetList {
static void setBackupSetSubPath();
static void initBackupSetList();
static void setBackupSetSubPathToRoot() { backupSetSubPath = "/"; }
static void saveBackupSetSubPath() { savedBackupSetSubPath = backupSetSubPath; }
static void restoreBackupSetSubPath() { backupSetSubPath = savedBackupSetSubPath; }

private:
static bool sortAscending;
Expand All @@ -31,6 +33,7 @@ class BackupSetList {
std::string backupSetListRoot;
static std::string backupSetSubPath;
static std::string backupSetEntry;
static std::string savedBackupSetSubPath;

};

4 changes: 3 additions & 1 deletion languages/english.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,7 @@
"WiiU NAND Savedata >> slot 1": "WiiU NAND Savedata >> slot 1",
"vWii Savedata >> slot 0": "vWii Savedata >> slot 0",
"BackupSet: %s": "BackupSet: %s",
", from ": ", from "
", from ": ", from ",
"Common save not restored.": "Common save not restored.",
"\ue001: Back": "\ue001: Back"
}
7 changes: 4 additions & 3 deletions languages/german.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"Include 'common' save?": "'Gemeinsame' Speicherung einschließen?",
"yes": "Ja",
"no ": "Nein ",
"No 'common' save found.": "Keine 'gemeinsame' Speicherung gefunden.",,
"No 'common' save found.": "Keine 'gemeinsame' Speicherung gefunden.",
"\ue000: Wipe \ue001: Back": "\ue000: Lösche \ue001: Zurück",
"\ue000: Import \ue001: Back": "\ue000: Importieren \ue001: Zurück",
"\ue000: Export \ue001: Back": "\ue000: Exportieren \ue001: Zurück",
Expand Down Expand Up @@ -94,13 +94,14 @@
"Failed to delete user folder: %s": "Löschen vom Nutzerordner fehlgeschlagen: %s",
"Failed to import savedata from loadiine.": "Importieren von Loadiine Speicherdaten fehlgeschlagen.",
"Failed to export savedata to loadiine.": "Exportieren von Loadiine Speicherdaten fehlgeschlagen.",
"German": "Deutsch",
"\ue083 Sort: %s \ue084": "\ue083 Sortieren: %s \ue084",
"\ue000: Select BackupSet \ue001: Back": "\ue000: Wählen Sie BackupSet \ue001: Zurück",
"\ue002: Change BackupSet \ue000: Restore \ue001: Back": "\ue002: BackupSet ändern \ue000: Wiederherstellen \ue001: Zurück",
"WiiU USB Savedata >> slot 0": "WiiU USB Savedata >> slot 0",
"WiiU NAND Savedata >> slot 1": "WiiU NAND Savedata >> slot 1",
"vWii Savedata >> slot 0": "vWii Savedata >> slot 0",
"BackupSet: %s": "BackupSet: %s",
", from ": ", aus "
", from ": ", aus ",
"Common save not restored.": "'Gemeinsame' Sicherung nicht wiederhergestellt",
"\ue001: Back": "\ue001: Zurück"
}
4 changes: 3 additions & 1 deletion languages/italian.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,7 @@
"WiiU NAND Savedata >> slot 1": "WiiU NAND Savedata >> slot 1",
"vWii Savedata >> slot 0": "vWii Savedata >> slot 0",
"BackupSet: %s": "BackupSet: %s",
", from ": ", da "
", from ": ", da ",
"Common save not restored.": "Salvataggio comune non ripristinato",
"\ue001: Back": "\ue001: Indietro"
}
4 changes: 3 additions & 1 deletion languages/portuguese.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,7 @@
"WiiU NAND Savedata >> slot 1": "WiiU NAND Savedata >> slot 1",
"vWii Savedata >> slot 0": "vWii Savedata >> slot 0",
"BackupSet: %s": "BackupSet: %s",
", from ": ", de "
", from ": ", de ",
"Common save not restored.": "Save 'Common' não restauradoi",
"\ue001: Back": "\ue001: Voltar"
}
4 changes: 3 additions & 1 deletion languages/spanish.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,7 @@
"WiiU NAND Savedata >> slot 1": "WiiU NAND Savedata >> slot 1",
"vWii Savedata >> slot 0": "vWii Savedata >> slot 0",
"BackupSet: %s": "BackupSet: %s",
", from ": ", de "
", from ": ", de ",
"Common save not restored.": "No se ha podido restaurar el common save",
"\ue001: Back": "\ue001: Atrás"
}
1 change: 1 addition & 0 deletions src/BackupSetList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ bool BackupSetList::sortAscending = false;
const std::string BackupSetList::ROOT_BS = ">> Root <<";
std::string BackupSetList::backupSetSubPath = "/";;
std::string BackupSetList::backupSetEntry = ROOT_BS;
std::string BackupSetList::savedBackupSetSubPath {};

std::unique_ptr<BackupSetList> BackupSetList::currentBackupSetList = std::make_unique<BackupSetList>();

Expand Down
1 change: 1 addition & 0 deletions src/menu/ConfigMenuState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ void ConfigMenuState::render() {
language = LanguageUtils::getLoadedLanguage();
consolePrintPos(M_OFF, 2, LanguageUtils::gettext(" Language: %s"), language.c_str());
consolePrintPos(M_OFF, 2 + cursorPos, "\u2192");
consolePrintPosAligned(17,4,2,LanguageUtils::gettext("\ue001: Back"));
}

ApplicationState::eSubState ConfigMenuState::update(Input *input) {
Expand Down
7 changes: 5 additions & 2 deletions src/savemng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,6 @@ void backupSavedata(Title *title, uint8_t slot, int8_t wiiuser, bool common) {
}
srcPath.append(StringUtils::stringFormat("/%s", wiiuacc[wiiuser].persistentID));
dstPath.append(StringUtils::stringFormat("/%s", wiiuacc[wiiuser].persistentID));

if (checkEntry(srcPath.c_str()) == 0) {
if (commonSaved)
writeMetadata(highID,lowID,slot,isUSB);
Expand All @@ -1016,9 +1015,13 @@ void restoreSavedata(Title *title, uint8_t slot, int8_t sduser, int8_t wiiuser,
}
if (!promptConfirm(ST_WARNING, LanguageUtils::gettext("Are you sure?")))
return;
// backups to ROOT backupSet
BackupSetList::saveBackupSetSubPath();
BackupSetList::setBackupSetSubPathToRoot();
int slotb = getEmptySlot(title->highID, title->lowID);
if ((slotb >= 0) && promptConfirm(ST_YES_NO, LanguageUtils::gettext("Backup current savedata first to next empty slot?")))
backupSavedata(title, slotb, wiiuser, common);
BackupSetList::restoreBackupSetSubPath();
uint32_t highID = title->highID;
uint32_t lowID = title->lowID;
bool isUSB = title->isTitleOnUSB;
Expand All @@ -1036,7 +1039,7 @@ void restoreSavedata(Title *title, uint8_t slot, int8_t sduser, int8_t wiiuser,
if (copyDir(srcPath + "/common", dstPath + "/common"))
commonSaved = true;
else
promptError(LanguageUtils::gettext("Common save not found."));
promptError(LanguageUtils::gettext("Common save not restored."));
}
srcPath.append(StringUtils::stringFormat("/%s", sdacc[sduser].persistentID));
dstPath.append(StringUtils::stringFormat("/%s", wiiuacc[wiiuser].persistentID));
Expand Down
2 changes: 2 additions & 0 deletions src/utils/LanguageUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ void LanguageUtils::loadLanguage(Swkbd_LanguageType language) {
break;
*/
case Swkbd_LanguageType__German:
DrawUtils::setFont(OS_SHAREDDATATYPE_FONT_STANDARD);
gettextLoadLanguage("romfs:/german.json");
break;
case Swkbd_LanguageType__Italian:
Expand All @@ -49,6 +50,7 @@ void LanguageUtils::loadLanguage(Swkbd_LanguageType language) {
break;
*/
case Swkbd_LanguageType__Portuguese:
DrawUtils::setFont(OS_SHAREDDATATYPE_FONT_STANDARD);
gettextLoadLanguage("romfs:/portuguese.json");
break;
case Swkbd_LanguageType__Russian:
Expand Down

0 comments on commit c63e9db

Please sign in to comment.