diff --git a/include/arm9/menu.h b/include/arm9/menu.h index 4e95f5d..8be8916 100644 --- a/include/arm9/menu.h +++ b/include/arm9/menu.h @@ -5,6 +5,7 @@ #include "arm9/menu_nand.h" #include "arm9/menu_options.h" #include "arm9/menu_filebrowse.h" +#include "arm9/menu_update.h" enum menu_state_type { MENU_STATE_MAIN = 0, @@ -16,6 +17,7 @@ MENU_STATE_NAND_RESTORE, MENU_STATE_FIRM_LAUNCH, MENU_STATE_BROWSER, + MENU_STATE_UPDATE, MENU_STATE_EXIT, STATE_PREVIOUS // pseudo state for menuSetReturnToState() diff --git a/include/arm9/menu_update.h b/include/arm9/menu_update.h new file mode 100644 index 0000000..6930a0e --- /dev/null +++ b/include/arm9/menu_update.h @@ -0,0 +1,3 @@ +#pragma once + +bool menuUpdateLoader(); diff --git a/source/arm9/menu.c b/source/arm9/menu.c index be9e243..fad8287 100644 --- a/source/arm9/menu.c +++ b/source/arm9/menu.c @@ -20,12 +20,13 @@ const menu_state_options menu_main = { - 4, + 5, { {"Continue boot", MENU_STATE_FIRM_LAUNCH_SETTINGS}, {"NAND tools...", MENU_STATE_NAND_MENU}, {"Options...", MENU_STATE_OPTIONS_MENU}, {"Browse FIRM...", MENU_STATE_BROWSER}, + {"Update", MENU_STATE_UPDATE}, } }; @@ -185,6 +186,11 @@ menuSetEnterNextState(MENU_STATE_FIRM_LAUNCH); break; + case MENU_STATE_UPDATE: + menuUpdateLoader(); + uiClearConsoles(); + break; + case MENU_STATE_EXIT: goto exitAndLaunchFirm; break; diff --git a/source/arm9/menu_nand.c b/source/arm9/menu_nand.c index 787a045..18afd92 100644 --- a/source/arm9/menu_nand.c +++ b/source/arm9/menu_nand.c @@ -68,6 +68,7 @@ } uiPrintTextAt(0, 5, "Dumping NAND...\n"); + uiPrintTextAt(0, 22, "Press B to cancel."); /* Main loop */ @@ -94,7 +95,7 @@ hidScanInput(); if(hidKeysDown() & KEY_B) { - uiPrintInfo("\n...canceled!\n"); + uiPrintTextAt(0, 22, "... canceled. "); f_close(&file); goto fail; } @@ -104,9 +105,8 @@ // print current progress information uiPrintTextAt(1, 20, "\r%"PRId32"/%"PRId32" MB (Sector 0x%"PRIX32"/0x%"PRIX32")", curSector>>11, sectorCount>>11, curSector, sectorCount); - - uiPrintProgressBar(10, 80, 380, 20, curSector, sectorCount); + uiPrintProgressBar(0, 80, 380, 20, curSector, sectorCount); switch(menuUpdateGlobalState()) { @@ -126,7 +126,7 @@ f_close(&file); free(buf); - uiPrintInfo("Finished! Press any key to return..."); + uiPrintTextAt(0, 24, "Finished! Press any key to return."); menuWaitForAnyPadkey(); menuSetReturnToState(STATE_PREVIOUS); @@ -136,7 +136,7 @@ fail: free(buf); - uiPrintInfo("Press any key to return..."); + uiPrintTextAt(0, 24, "Press any key to return."); menuWaitForAnyPadkey(); menuSetReturnToState(STATE_PREVIOUS); @@ -191,7 +191,8 @@ unmount_nand_fs(); uiPrintTextAt(0, 5, "Restoring...\n"); - + uiPrintTextAt(0, 22, "Press B to cancel."); + /* Main loop */ const u32 sectorCount = fileStat.fsize>>9; @@ -218,7 +219,7 @@ hidScanInput(); if(hidKeysDown() & KEY_B) { - uiPrintInfo("\n...canceled!\n"); + uiPrintTextAt(0, 22, "... canceled. "); f_close(&file); goto fail; } @@ -249,7 +250,7 @@ free(buf); remount_nand_fs(); - uiPrintInfo("Finished! Press any key to return..."); + uiPrintTextAt(0, 24, "Finished! Press any key to return."); menuWaitForAnyPadkey(); menuSetReturnToState(STATE_PREVIOUS); @@ -260,7 +261,7 @@ free(buf); remount_nand_fs(); - uiPrintInfo("Press any key to return..."); + uiPrintTextAt(0, 24, "Press any key to return."); menuWaitForAnyPadkey(); menuSetReturnToState(STATE_PREVIOUS); diff --git a/source/arm9/menu_options.c b/source/arm9/menu_options.c index 099805a..3a67007 100644 --- a/source/arm9/menu_options.c +++ b/source/arm9/menu_options.c @@ -46,8 +46,6 @@ { u32 keys; - PXI_sendWord(PXI_CMD_ALLOW_POWER_OFF); - uiClearConsoles(); consoleSelect(&con_bottom); diff --git a/source/arm9/menu_update.c b/source/arm9/menu_update.c index a38436d..933d705 100644 --- a/source/arm9/menu_update.c +++ b/source/arm9/menu_update.c @@ -44,7 +44,7 @@ // update file is just a firmware if(!tryLoadFirmware(updateFilePath, false, false)) { - uiPrintError("Invalid update file!\n"); + uiPrintError("Update file is corrupted!\n"); goto fail; } @@ -58,7 +58,7 @@ // verify fastboot magic if(memcmp(updateBuffer+0x208, "FASTBOOT 3DS ", 0x10) != 0) { - uiPrintError("Invalid update file!\n"); + uiPrintError("Not an update file!\n"); goto fail; } diff --git a/source/arm9/ui.c b/source/arm9/ui.c index 8875066..fea09c3 100644 --- a/source/arm9/ui.c +++ b/source/arm9/ui.c @@ -214,9 +214,9 @@ { for(unsigned y = start_y; y < height+start_y; y++) { - framebuf = &((u16*)FRAMEBUF_TOP_A_1)[SCREEN_HEIGHT_TOP * x + y]; - u8 *pixeldata = &imagedata[(y*width+x)*3]; - *framebuf = RGB8_to_565(pixeldata[0], pixeldata[1], pixeldata[2]); + //framebuf = &((u16*)FRAMEBUF_TOP_A_1)[SCREEN_HEIGHT_TOP * x + width - y]; + u8 *pixeldata = &imagedata[(width*(y-1)+x)*3]; + *framebuf++ = RGB8_to_565(pixeldata[0], pixeldata[1], pixeldata[2]); } } }