2018-05-15 13:57:40 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <switch.h>
|
2018-05-15 17:00:19 +01:00
|
|
|
#include "menu.h"
|
|
|
|
#include "dumper.h"
|
|
|
|
#include "ccolor.h"
|
2018-05-15 13:57:40 +01:00
|
|
|
|
2018-05-15 17:00:19 +01:00
|
|
|
FsDeviceOperator fsOperatorInstance;
|
2018-05-15 13:57:40 +01:00
|
|
|
|
2018-05-15 17:00:19 +01:00
|
|
|
bool shouldWaitForAnyButton = false;
|
2018-05-15 13:57:40 +01:00
|
|
|
|
2018-05-15 17:00:19 +01:00
|
|
|
void menuWaitForAnyButton() {
|
|
|
|
printf(C_DIM "Press any button to return to menu\n");
|
|
|
|
shouldWaitForAnyButton = true;
|
|
|
|
}
|
2018-05-15 13:57:40 +01:00
|
|
|
|
2018-05-15 17:00:19 +01:00
|
|
|
void startOperation(const char* title) {
|
|
|
|
consoleClear();
|
|
|
|
printf(C_DIM "%s\n\n" C_RESET, title);
|
|
|
|
}
|
2018-05-15 13:57:40 +01:00
|
|
|
|
2018-05-15 17:00:19 +01:00
|
|
|
void dumpPartitionZero() {
|
|
|
|
startOperation("Raw Dump Partition 0 (SysUpdate)");
|
|
|
|
dumpPartitionRaw(&fsOperatorInstance, 0);
|
|
|
|
menuWaitForAnyButton();
|
2018-05-15 13:57:40 +01:00
|
|
|
}
|
|
|
|
|
2018-05-15 17:00:19 +01:00
|
|
|
MenuItem mainMenu[] = {
|
|
|
|
{ .text = "Raw Dump Partition 0 (SysUpdate)", .callback = dumpPartitionZero },
|
|
|
|
{ .text = NULL }
|
|
|
|
};
|
|
|
|
|
2018-05-15 13:57:40 +01:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
gfxInitDefault();
|
|
|
|
consoleInit(NULL);
|
|
|
|
|
2018-05-15 17:00:19 +01:00
|
|
|
if (R_FAILED(fsOpenDeviceOperator(&fsOperatorInstance))) {
|
2018-05-15 13:57:40 +01:00
|
|
|
printf("Failed to open device operator\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2018-05-15 17:00:19 +01:00
|
|
|
menuSetCurrent(mainMenu);
|
2018-05-15 13:57:40 +01:00
|
|
|
|
|
|
|
while(appletMainLoop())
|
|
|
|
{
|
2018-05-15 17:00:19 +01:00
|
|
|
bool btnWait = shouldWaitForAnyButton;
|
|
|
|
|
2018-05-15 13:57:40 +01:00
|
|
|
hidScanInput();
|
|
|
|
|
2018-05-15 17:00:19 +01:00
|
|
|
if (!btnWait)
|
|
|
|
menuUpdate(&fsOperatorInstance);
|
2018-05-15 13:57:40 +01:00
|
|
|
|
|
|
|
u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO);
|
|
|
|
if (kDown & KEY_PLUS) break;
|
2018-05-15 17:00:19 +01:00
|
|
|
if (btnWait && kDown) {
|
|
|
|
shouldWaitForAnyButton = false;
|
|
|
|
menuPrint();
|
|
|
|
}
|
2018-05-15 13:57:40 +01:00
|
|
|
|
|
|
|
gfxFlushBuffers();
|
|
|
|
gfxSwapBuffers();
|
|
|
|
gfxWaitForVsync();
|
|
|
|
}
|
|
|
|
|
2018-05-15 17:00:19 +01:00
|
|
|
fsDeviceOperatorClose(&fsOperatorInstance);
|
|
|
|
|
2018-05-15 13:57:40 +01:00
|
|
|
gfxExit();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|