Skip to content

Commit

Permalink
enh - batch restore - mocked version - fix
Browse files Browse the repository at this point in the history
  • Loading branch information
w3irDv committed Oct 20, 2024
1 parent 42f6baa commit 0933734
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
6 changes: 4 additions & 2 deletions include/menu/BackupSetListState.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class BackupSetListState : public ApplicationState {
public:
BackupSetListState();
BackupSetListState(Title *titles, int titlesCount);
BackupSetListState(Title *titles, int titlesCount, bool vWiiRestore);

static void resetCursorPosition();
static void resetCursorAndScroll();
Expand All @@ -30,7 +30,7 @@ class BackupSetListState : public ApplicationState {
eState state = STATE_BACKUPSET_MENU;
eSubstateCalled substateCalled = NONE;
bool finalScreen;

bool sortAscending;

static int cursorPos;
Expand All @@ -43,4 +43,6 @@ class BackupSetListState : public ApplicationState {

Title *titles;
int titlesCount;

bool vWiiRestore;
};
4 changes: 3 additions & 1 deletion include/menu/BatchRestoreOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class BatchRestoreOptions : public ApplicationState {
public:
BatchRestoreOptions(Title *titles, int titlesCount);
BatchRestoreOptions(Title *titles, int titlesCount, bool vWiiRestore);

enum eState {
STATE_BATCH_RESTORE_OPTIONS_MENU,
Expand All @@ -36,4 +36,6 @@ class BatchRestoreOptions : public ApplicationState {
int titlesCount = 0;

int cursorPos = 0;

bool vWiiRestore;
};
2 changes: 1 addition & 1 deletion src/menu/BRTitleSelectState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void BRTitleSelectState::render() {
consolePrintPos(M_OFF, i + 2, " %s %s%s%s [%s]", this->titles[c2t[i + this->scroll]].shortName,
this->titles[c2t[i + this->scroll]].isTitleOnUSB ? "(USB)" : "(NAND)",
this->titles[c2t[i + this->scroll]].isTitleDupe ? " [D]" : "",
this->titles[c2t[i + this->scroll]].currentBackup.selected ? LanguageUtils::gettext(" [Restore]" : LanguageUtils::gettext(" [Skip]"),
this->titles[c2t[i + this->scroll]].currentBackup.selected ? LanguageUtils::gettext(" [Restore]" ) : LanguageUtils::gettext(" [Skip]"),
titleStateAfterBR[this->titles[c2t[i + this->scroll]].currentBackup.batchRestoreState]);

else
Expand Down
7 changes: 4 additions & 3 deletions src/menu/BackupSetListState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ BackupSetListState::BackupSetListState() {
this->sortAscending = BackupSetList::sortAscending;
}

BackupSetListState::BackupSetListState(Title *titles, int titlesCount) :
BackupSetListState::BackupSetListState(Title *titles, int titlesCount, bool vWiiRestore) :
titles(titles),
titlesCount(titlesCount) {
titlesCount(titlesCount),
vWiiRestore(vWiiRestore) {
finalScreen = false;
}

Expand Down Expand Up @@ -100,7 +101,7 @@ ApplicationState::eSubState BackupSetListState::update(Input *input) {
else // is a step in batchRestore
{
this->state = STATE_DO_SUBSTATE;
this->subState = std::make_unique<BatchRestoreOptions>(titles, titlesCount);
this->subState = std::make_unique<BatchRestoreOptions>(titles, titlesCount, vWiiRestore);
}
}
if (input->get(TRIGGER, PAD_BUTTON_Y)) {
Expand Down
6 changes: 3 additions & 3 deletions src/menu/BatchRestoreOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ extern Account *sdacc;
extern uint8_t sdaccn;

BatchRestoreOptions::BatchRestoreOptions(Title *titles,
int titlesCount) : titles(titles),
titlesCount(titlesCount) {

int titlesCount,bool vWiiRestore) : titles(titles),
titlesCount(titlesCount), vWiiRestore(vWiiRestore) {
WHBLogPrintf("batchRestore constructor");
for (int i = 0; i<this->titlesCount; i++) {
this->titles[i].currentBackup= {
.hasBatchBackup = false,
Expand Down
4 changes: 2 additions & 2 deletions src/menu/BatchRestoreState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ ApplicationState::eSubState BatchRestoreState::update(Input *input) {
switch (cursorPos) {
case 0:
this->state = STATE_DO_SUBSTATE;
this->subState = std::make_unique<BackupSetListState>(this->wiiutitles, this->wiiuTitlesCount);
this->subState = std::make_unique<BackupSetListState>(this->wiiutitles, this->wiiuTitlesCount, false);
break;
case 1:
this->state = STATE_DO_SUBSTATE;
this->subState = std::make_unique<BackupSetListState>(this->wiititles, this->vWiiTitlesCount);
this->subState = std::make_unique<BackupSetListState>(this->wiititles, this->vWiiTitlesCount, true);
break;
default:
return SUBSTATE_RUNNING;
Expand Down

0 comments on commit 0933734

Please sign in to comment.