Skip to content

Commit

Permalink
batch restore - RC5
Browse files Browse the repository at this point in the history
  • Loading branch information
w3irDv committed Jan 1, 2025
1 parent dbc20a7 commit c4882c0
Show file tree
Hide file tree
Showing 19 changed files with 181 additions and 32 deletions.
93 changes: 93 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,99 @@ For sorting Titles press R to change sorting method and press L to change betwee

Use it at your own risk and please report any issues that may occur.

## Quick Notes
### Wii U Title Management / vWii Title Management

Allows you to backup/restore/wipe individual titles.

1. First select the title you want to manage.
1. Wii U titles: If the title has not been initialized (you have not created an initial save by playing it beforehand) it will be marked as "Not init" and will appear in yellow. You can try to manage it (restore task), but the outcome is uncertain. It is recommended to first play to the game before trying to restore its savedata.
1. An special case of this are vWii injects. They have a vWii title and an associated Wii U title with no savedata that will appear in Wii U title Management marked with "Not init". Savedata for these titles can be managed from the vWii Management tasks, and will appear ther after you create an initital save by playing it. Savemii allows yo to manage the Wii U title portion, but as stated, the real savedata should be managed from the "vWii Title managament" tasks.
2. Select the task you want to do:
1. Backup: Copy savedata from USB/NAND to SD
2. Restore: Copy savedata from SD to USB/NAND
3. Wipe: Delete savedata from USB/NAND
4. Export / Import to Loadiine: Legacy options to manage Loadiine savedata
5. Copy to other Device: If savedata for a title is present in USB and NAND, copy it from one storage to the other

#### Backup
1. Select a slot to save the savedata. You can select a number from 0 to 255, each one representing a different folder in the SD card. After the backup is done, you can tag the slot with a meaningful name using the Option X
2. For Wii U titles, select which data to save
1. All users: Recommended option Will backup all game data
2. From user: xxxxx. Will only backup the data for the specified profile. In this case, must also specify if you want to save "common" data or not. "Common" savedata is data shared by all profiles

```
sd:/wiiu/backup/
xxxxxxxx-yyyyyyy/
0/
saveMii.json
80000001/
...
80000002/
...
... one folder for each profile
common/
...
1/
...
```
#### Restore
1. Select a slot to get the data from. By default, data from the "root" backup set (the one where the manual backups are stored) is used. But you can also use slots from batch restore backup sets, by using option X and selecting the one you want to use. BackupSets can also be tagged by using option X in the backupSet list Menu.
To identify which data the slot contains: If the slot has been tagged, you will see its tag next to the slot number. On the top line, you can see which backupSet are you using. And at the last line, you can see when the savedata were taken, and from which console.
2. For Wii U titles, select witch data to restore:
1. From: All users / To: Same user than Source
1. This wil restore all save data (profiles+common) from the selected slot keeping the same userid that was used to backup the data. This option can be only used to restore previous savedata from the same console, or if the profile ids in the new console are the same thant the ones in the source console. If profile ids from source and target differ, you must use fhe following option
2. From: select source user / To: select target user. This will copy savedata from the specified profile id in the slotbackup to the specified profile id in the console. You can specify if copy common savedata or not.
If you are just copying the savedata from one profileid to a different one in the same console, choose `copy common savedata: no`. If you are restoring to a new console with different profile ids, just choose `copy common savedata: yes` once for any of the profile ids, and copy the rest of profiles with `copy common savedata: no`
#### Wipe
1. Sometimes you will need to wipe savedata in the console before restoring a previous backup. If a restore is unsuccesful, please try to wipe previous data before attempting a new restore. Options are the same than in the *Backup* task, but now refer to savedata for the specified titel in the NAND or in the USB.
#### Copy to other device
If a title has savedata in the NAND and in the USB, you can copy it between both storages. Options are the same than in the *Restore* task.


### Batch Backup

You can backup savedata for all Wii U titles and all Wii titles at once using this tasks. Savedata will be stored in a "Backup set" in the `batch` directori, and can after be used to restore individual titles or to batch restore all of them.
Batch backupsets can be tagged from the list batch backup set menu (accessible by pressing X in the Backup task for any title, or by entering the menu Backupset Management from the Main menu)

```
sd:/wiiu/backup/batch/
${timestamp}/
xxxxxxxx-yyyyyyy/
0/ (USB or NAND savedata for the title)
saveMii.json
80000001/
...
80000002/
...
... one folder for each profile
common/
...
1/ (NAND savedata only for titles simultanously installed in USB and NAND)
...
xxxxxxxxx-yyyyyyy/
0/
....
```

### Batch Restore

This task allows you to restore from a batch backupset the savedata for titles already installed in the Wii U or in the vWii
1. Select wether you want to restore Wii U titles or vWii titles
2. Select the backupSet you want to restore from
3. Select wich data to restore. Options are the same than in the *Restore* task. You can also choose if you want to perform a full backup (recommended) or to wipe data before restoring it
4. The list of all titles that are installed, that have a backup in the backupset, and that match the savedata criteria choosen in the previous step will appear. You can select / deselect which titles to restore. Titles with "Not Init" savedata will be skipped by default.
5. Once you have reviewed the list of titles to be restored, press A. A summary screen will appear, and if is OK, you can inititiate the restore.
6. Once the restore is completed, a summary screen will show number of sucess/failed/skipped titles.
7. The list of all titles will appear again, now showing the restored status. You can try to select failed titles and restore them again to see what the error is. Succesfully restored titles will be skipped.

### Backupset management
In this menu you can tag backupsets or delete the one you don't need. You cal also set the one you want to use to restore savedata (you cal also select it directrly from the savedata restore menu)


----


Reasons to use this over original mod:

- Faster copy speeds
Expand Down
7 changes: 7 additions & 0 deletions include/menu/MainMenuState.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,20 @@ class MainMenuState : public ApplicationState {
STATE_DO_SUBSTATE,
};

enum eSubstateCalled {
NONE,
STATE_BACKUPSET_MENU,
};

void render() override;
ApplicationState::eSubState update(Input *input) override;

private:
std::unique_ptr<ApplicationState> subState{};
eState state = STATE_MAIN_MENU;

eSubstateCalled substateCalled = NONE;

Title *wiiutitles;
Title *wiititles;

Expand Down
3 changes: 2 additions & 1 deletion include/savemng.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,10 @@ std::string getNowDateForFolder() __attribute__((hot));
std::string getNowDate() __attribute__((hot));
void writeMetadata(uint32_t highID,uint32_t lowID,uint8_t slot,bool isUSB) __attribute__((hot));
void writeMetadata(uint32_t highID,uint32_t lowID,uint8_t slot,bool isUSB,const std::string &batchDatetime) __attribute__((hot));
void writeMetadataWithTag(uint32_t highID,uint32_t lowID,uint8_t slot,bool isUSB,const std::string &tag) __attribute__((hot));
void writeBackupAllMetadata(const std::string & Date, const std::string & tag);
void backupAllSave(Title *titles, int count, const std::string &batchDatetime, bool onlySelectedTitles = false) __attribute__((hot));
void backupSavedata(Title *title, uint8_t slot, int8_t wiiuuser, bool common) __attribute__((hot));
void backupSavedata(Title *title, uint8_t slot, int8_t wiiuuser, bool common, const std::string &tag = "") __attribute__((hot));
int restoreSavedata(Title *title, uint8_t slot, int8_t sduser, int8_t wiiuuser, bool common, bool interactive = true) __attribute__((hot));
int wipeSavedata(Title *title, int8_t wiiuuser, bool common, bool interactive = true) __attribute__((hot));
void importFromLoadiine(Title *title, bool common, int version);
Expand Down
2 changes: 1 addition & 1 deletion include/utils/Colors.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#define COLOR_LIST_RESTORE_SUCCESS Color(0xFFFFFFFF)
#define COLOR_LIST_RESTORE_SUCCESS_AT_CURSOR Color(0xBBBBEEFF)
#define COLOR_INFO Color(0x88CC88FF)
#define COLOR_INFO_AT_CURSOR Color(0x88CCBBFF)
#define COLOR_INFO_AT_CURSOR Color(0x88CCCCFF)
#define COLOR_KEY Color(0xFF3333FF)
#define COLOR_KEY_S Color(0xFF666600)
#define COLOR_KEY_C Color(0xFF0000FF)
Expand Down
4 changes: 3 additions & 1 deletion romfs/languages/SChinese.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@
"\ue003\ue07e: Select/Deselect \ue000: Restore selected titles \ue001: Back": "\ue003\ue07e: Select/Deselect \ue000: Restore selected titles \ue001: Back",
"same user than in source": "same user than in source",
"vWii Titles": "vWii Titles",
"|Restored|": "|Restored|",
"|Restored|": "|Restored|",
" BackupSet Management": " BackupSet Management",
"BS: %s": "BS: %s",
"KB_N_0": "1234567890-=",
"KB_N_1": "qwertyuiop[]|",
"KB_N_2": "asdfghjkl;'",
Expand Down
4 changes: 3 additions & 1 deletion romfs/languages/TChinese.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@
"\ue083 Sort: %s \ue084": "\ue083 Sort: %s \ue084",
"same user than in source": "same user than in source",
"vWii Titles": "vWii Titles",
"|Restored|": "|Restored|",
"|Restored|": "|Restored|",
" BackupSet Management": " BackupSet Management",
"BS: %s": "BS: %s",
"KB_N_0": "1234567890-=",
"KB_N_1": "qwertyuiop[]|",
"KB_N_2": "asdfghjkl;'",
Expand Down
2 changes: 2 additions & 0 deletions romfs/languages/english.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@
"same user than in source": "same user than in source",
"vWii Titles": "vWii Titles",
"|Restored|": "|Restored|",
" BackupSet Management": " BackupSet Management",
"BS: %s": "BS: %s",
"KB_N_0": "1234567890-=",
"KB_N_1": "qwertyuiop[]|",
"KB_N_2": "asdfghjkl;'",
Expand Down
2 changes: 2 additions & 0 deletions romfs/languages/german.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@
"same user than in source": "same user than in source",
"vWii Titles": "vWii Titles",
"|Restored|": "|Restored|",
" BackupSet Management": " BackupSet Management",
"BS: %s": "BS: %s",
"KB_N_0": "1234567890-=",
"KB_N_1": "qwertyuiop[]|",
"KB_N_2": "asdfghjkl;'",
Expand Down
4 changes: 3 additions & 1 deletion romfs/languages/italian.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@
"\ue003\ue07e: Select/Deselect \ue000: Restore selected titles \ue001: Back": "\ue003\ue07e: Select/Deselect \ue000: Restore selected titles \ue001: Back",
"same user than in source": "same user than in source",
"vWii Titles": "vWii Titles",
"|Restored|": "|Restored|",
"|Restored|": "|Restored|",
" BackupSet Management": " BackupSet Management",
"BS: %s": "BS: %s",
"KB_N_0": "1234567890-=",
"KB_N_1": "qwertyuiop[]|",
"KB_N_2": "asdfghjkl;'",
Expand Down
4 changes: 3 additions & 1 deletion romfs/languages/japanese.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@
"\ue083 Sort: %s \ue084": "\ue083 Sort: %s \ue084",
"same user than in source": "same user than in source",
"vWii Titles": "vWii Titles",
"|Restored|": "|Restored|",
"|Restored|": "|Restored|",
" BackupSet Management": " BackupSet Management",
"BS: %s": "BS: %s",
"KB_N_0": "1234567890-=",
"KB_N_1": "qwertyuiop[]|",
"KB_N_2": "asdfghjkl;'",
Expand Down
2 changes: 2 additions & 0 deletions romfs/languages/korean.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@
"same user than in source": "same user than in source",
"vWii Titles": "vWii Titles",
"|Restored|": "|Restored|",
" BackupSet Management": " BackupSet Management",
"BS: %s": "BS: %s",
"KB_N_0": "1234567890-=",
"KB_N_1": "qwertyuiop[]|",
"KB_N_2": "asdfghjkl;'",
Expand Down
4 changes: 3 additions & 1 deletion romfs/languages/portuguese.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@
"\ue003\ue07e: Select/Deselect \ue000: Restore selected titles \ue001: Back": "\ue003\ue07e: Select/Deselect \ue000: Restore selected titles \ue001: Back",
"same user than in source": "same user than in source",
"vWii Titles": "vWii Titles",
"|Restored|": "|Restored|",
"|Restored|": "|Restored|",
" BackupSet Management": " BackupSet Management",
"BS: %s": "BS: %s",
"KB_N_0": "1234567890-=",
"KB_N_1": "qwertyuiop[]|",
"KB_N_2": "asdfghjkl;'",
Expand Down
4 changes: 3 additions & 1 deletion romfs/languages/russian.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@
"\ue083 Sort: %s \ue084": "\ue083 Sort: %s \ue084",
"same user than in source": "same user than in source",
"vWii Titles": "vWii Titles",
"|Restored|": "|Restored|",
"|Restored|": "|Restored|",
" BackupSet Management": " BackupSet Management",
"BS: %s": "BS: %s",
"KB_N_0": "1234567890-=",
"KB_N_1": "qwertyuiop[]|",
"KB_N_2": "asdfghjkl;'",
Expand Down
2 changes: 2 additions & 0 deletions romfs/languages/spanish.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@
"same user than in source": "same user than in source",
"vWii Titles": "vWii Titles",
"|Restored|": "|Restored|",
" BackupSet Management": " BackupSet Management",
"BS: %s": "BS: %s",
"KB_N_0": "1234567890-=",
"KB_N_1": "qwertyuiop[]|",
"KB_N_2": "asdfghjkl;'",
Expand Down
4 changes: 3 additions & 1 deletion src/menu/BatchRestoreOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ void BatchRestoreOptions::render() {

if (this->state == STATE_BATCH_RESTORE_OPTIONS_MENU) {
DrawUtils::setFontColor(COLOR_INFO);
consolePrintPosAligned(0, 4, 1, LanguageUtils::gettext("BatchRestore - Options"));
consolePrintPos(16,0, LanguageUtils::gettext("BatchRestore - Options"));
DrawUtils::setFontColor(COLOR_INFO_AT_CURSOR);
consolePrintPosAligned(0, 4, 2,LanguageUtils::gettext("BS: %s"),BackupSetList::getBackupSetEntry().c_str());
DrawUtils::setFontColor(COLOR_TEXT);
if (isWiiUBatchRestore) {
consolePrintPos(M_OFF, 3, LanguageUtils::gettext("Select SD user to copy from:"));
Expand Down
28 changes: 17 additions & 11 deletions src/menu/MainMenuState.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <coreinit/debug.h>
#include <menu/BatchBackupState.h>
//#include <menu/BackupSetListState.h>
#include <menu/BackupSetListState.h>
#include <BackupSetList.h>
#include <menu/ConfigMenuState.h>
#include <menu/MainMenuState.h>
Expand All @@ -13,7 +13,7 @@
#include <menu/BatchRestoreState.h>
#include <utils/Colors.h>

#define ENTRYCOUNT 4
#define ENTRYCOUNT 5

static int cursorPos = 0;

Expand All @@ -38,6 +38,8 @@ void MainMenuState::render() {
consolePrintPos(M_OFF, 4, LanguageUtils::gettext(" Batch Backup"));
DrawUtils::setFontColorByCursor(COLOR_TEXT,COLOR_TEXT_AT_CURSOR,cursorPos,3);
consolePrintPos(M_OFF, 5, LanguageUtils::gettext(" Batch Restore"));
DrawUtils::setFontColorByCursor(COLOR_TEXT,COLOR_TEXT_AT_CURSOR,cursorPos,4);
consolePrintPos(M_OFF, 6, LanguageUtils::gettext(" BackupSet Management"));
DrawUtils::setFontColor(COLOR_TEXT);
consolePrintPos(M_OFF, 2 + cursorPos, "\u2192");
consolePrintPosAligned(17, 4, 2, LanguageUtils::gettext("\uE002: Options \ue000: Select Mode"));
Expand All @@ -49,12 +51,12 @@ ApplicationState::eSubState MainMenuState::update(Input *input) {
if (input->get(TRIGGER, PAD_BUTTON_A)) {
switch (cursorPos) {
case 0:
BackupSetList::setBackupSetToRoot();
//BackupSetList::setBackupSetToRoot();
this->state = STATE_DO_SUBSTATE;
this->subState = std::make_unique<WiiUTitleListState>(this->wiiutitles, this->wiiuTitlesCount);
break;
case 1:
BackupSetList::setBackupSetToRoot();
//BackupSetList::setBackupSetToRoot();
this->state = STATE_DO_SUBSTATE;
this->subState = std::make_unique<vWiiTitleListState>(this->wiititles, this->vWiiTitlesCount);
break;
Expand All @@ -63,10 +65,16 @@ ApplicationState::eSubState MainMenuState::update(Input *input) {
this->subState = std::make_unique<BatchBackupState>(this->wiiutitles, this->wiititles, this->wiiuTitlesCount, this->vWiiTitlesCount);
break;
case 3:
BackupSetList::setBackupSetToRoot();
//BackupSetList::setBackupSetToRoot();
this->state = STATE_DO_SUBSTATE;
this->subState = std::make_unique<BatchRestoreState>(this->wiiutitles, this->wiititles, this->wiiuTitlesCount, this->vWiiTitlesCount);
break;
case 4:
//BackupSetList::setBackupSetToRoot();
this->state = STATE_DO_SUBSTATE;
this->substateCalled = STATE_BACKUPSET_MENU;
this->subState = std::make_unique<BackupSetListState>();
break;
default:
break;
}
Expand All @@ -81,18 +89,16 @@ ApplicationState::eSubState MainMenuState::update(Input *input) {
if (input->get(TRIGGER, PAD_BUTTON_DOWN))
if (++cursorPos == ENTRYCOUNT)
--cursorPos;
/*
if (input->get(TRIGGER, PAD_BUTTON_Y)) {
this->state = STATE_DO_SUBSTATE;
this->subState = std::make_unique<BackupSetListState>();
}
*/
} else if (this->state == STATE_DO_SUBSTATE) {
auto retSubState = this->subState->update(input);
if (retSubState == SUBSTATE_RUNNING) {
// keep running.
return SUBSTATE_RUNNING;
} else if (retSubState == SUBSTATE_RETURN) {
// if ( this->substateCalled == STATE_BACKUPSET_MENU) {
// slot = 0;
// getAccountsSD(&this->title, slot);
// }
this->subState.reset();
this->state = STATE_MAIN_MENU;
}
Expand Down
Loading

0 comments on commit c4882c0

Please sign in to comment.