Skip to content
This repository has been archived by the owner on Aug 14, 2020. It is now read-only.

Commit

Permalink
added cancel function
Browse files Browse the repository at this point in the history
  • Loading branch information
emiyl committed Apr 12, 2020
1 parent 84d0088 commit 9cd326b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
16 changes: 10 additions & 6 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void console_printf(int newline, const char *format, ...)
OSScreenFlipBuffersEx(1);
}

int CheckCancel(void)
/*int CheckCancel(void)
{
int vpadError = -1;
VPADData vpad;
Expand All @@ -125,7 +125,7 @@ int CheckCancel(void)
return 1;
}
return 0;
}
}*/

int dump_func(const char *mount_path, int selectedItem, int fsaFd, int initScreen, int dump_source)
{
Expand Down Expand Up @@ -288,6 +288,7 @@ int Menu_Main(void)
int selectedItem = 0;

int dump_source = 0;
//int dump_target = 0;

while(1)
{
Expand Down Expand Up @@ -318,11 +319,12 @@ int Menu_Main(void)
OSScreenClearBufferEx(1, 0);


console_print_pos(0, 1, "-- Dumpling v0.2.1 by emiyl --");
console_print_pos(0, 2, "Mode: %s", (dump_source) ? "USB" : "MLC");
console_print_pos(0, 1, "-- Dumpling v0.2.2 by emiyl --");
console_print_pos(0, 2, "Source: %s", (dump_source) ? "USB" : "MLC");
//console_print_pos(0, 2, "Target: %s", (dump_target) ? "USB" : "SD");

console_print_pos(0, 4, "Select what to dump to SD card and press A to start dump.");
console_print_pos(0, 5, "Use L and R to change where you're dumping from.");
console_print_pos(0, 5, "Use L/R to change source.");// and ZL/ZR to change target.");

u32 i;
for(i = 0; i < (((dump_source) ? sizeof(usb_selection_paths) : sizeof(mlc_selection_paths)) / 4); i++)
Expand All @@ -337,6 +339,8 @@ int Menu_Main(void)
}
}

console_print_pos(0, 16, "Hold B to cancel dumping.");

// Flip buffers
OSScreenFlipBuffersEx(0);
OSScreenFlipBuffersEx(1);
Expand Down Expand Up @@ -376,7 +380,7 @@ int Menu_Main(void)

if(vpadError == 0 && ((vpad.btns_d | vpad.btns_h) & VPAD_BUTTON_A))
{
if (dump_source | (selectedItem > 2)) initScreen = dump_func(((dump_source) ? usb_selection_paths : mlc_selection_paths)[selectedItem], selectedItem, fsaFd, initScreen, dump_source);
if (dump_source | (selectedItem > 1)) initScreen = dump_func(((dump_source) ? usb_selection_paths : mlc_selection_paths)[selectedItem], selectedItem, fsaFd, initScreen, dump_source);
else if (selectedItem == 0) {
initScreen = dump_func("/vol/storage_mlc01/usr/save/system/act/" , selectedItem, fsaFd, initScreen, dump_source); // account.dat
initScreen = dump_func("/vol/storage_mlc01/sys/title/0005001b/10054000/content/ccerts", selectedItem, fsaFd, initScreen, dump_source); // ccerts
Expand Down
16 changes: 15 additions & 1 deletion src/sd_dumper.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,27 @@
#include <sys/dirent.h>
#include "dynamic_libs/os_functions.h"
#include "dynamic_libs/fs_functions.h"
#include "dynamic_libs/vpad_functions.h"
#include "fs/fs_utils.h"
#include "main.h"

#define BUFFER_SIZE 0x80000

void console_printf(int newline, const char *format, ...);
int checkCancel(void);
int CheckCancel(void)
{
int vpadError = -1;
VPADData vpad;

//! update only at 50 Hz, thats more than enough
VPADRead(0, &vpad, 1, &vpadError);

if(vpadError == 0 && ((vpad.btns_d | vpad.btns_h) & VPAD_BUTTON_B))
{
return 1;
}
return 0;
}

const bool detailed_logs = false;

Expand Down

0 comments on commit 9cd326b

Please sign in to comment.