Skip to content

Commit

Permalink
Re-support NDS system
Browse files Browse the repository at this point in the history
  • Loading branch information
d3m3vilurr committed Oct 27, 2017
1 parent c5682ea commit e95bbba
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
39 changes: 24 additions & 15 deletions source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,11 @@ int restore(Flashcart *cart) {

for (uint32_t i = 0; i < length; i += chunk_size) {
if (!compareBuf(orig_flashrom + i, curr_flashrom + i, chunk_size)) {
iprintf("fail");
iprintf("\nfail");
goto exit;
}
}
iprintf("ok");
iprintf("\nok");

exit:
iprintf("\nDone\n\n");
Expand Down Expand Up @@ -339,10 +339,9 @@ int main(void) {
#ifndef NDSI_MODE
if (support_restore) {
iprintf("<X> Restore flash\n");
iprintf("<B> Return\n");
} else {
iprintf("<B> Exit\n");
iprintf("<Y> Change cartridge\n");
}
iprintf("<B> Return\n");
#else
iprintf("<B> Exit\n");
#endif
Expand All @@ -357,20 +356,30 @@ int main(void) {
}

#ifndef NDSI_MODE
if (support_restore && (keys & KEY_X)) {
restore(cart);
break;
}
if (keys & KEY_B) {
if (!support_restore) {
if (support_restore) {
if (keys & KEY_X) {
restore(cart);
break;
}
if (keys & KEY_Y) {
cart->shutdown();
return 0;
do {
reset();
} while(!cart->initialize());
goto flash_menu;
}
if (keys & KEY_B) {
if (waitConfirmLostDump()) {
cart->shutdown();
goto select_cart;
}
goto flash_menu;
}
if (waitConfirmLostDump()) {
} else {
if (keys & KEY_B) {
cart->shutdown();
goto select_cart;
goto flash_menu;
}
goto flash_menu;
}
#else
if (keys & KEY_B) {
Expand Down
2 changes: 2 additions & 0 deletions source/nds_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ void reset() {
iprintf("then reinsert the cartridge.\n\n");

waitPressA();

ntrcard::state.status = ntrcard::Status::RAW;
#endif

ntrcard::sendCommand(dummyCommand, 0x2000, NULL, 32);
Expand Down

0 comments on commit e95bbba

Please sign in to comment.