mirror of
https://github.com/DarkMatterCore/nxdumptool.git
synced 2025-02-18 14:35:56 +00:00
Support cancellation
This commit is contained in:
parent
5892d49599
commit
70fe38bd3a
1 changed files with 13 additions and 0 deletions
|
@ -12,6 +12,8 @@ bool dumpPartitionRaw(FsDeviceOperator* fsOperator, u32 partition) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("Handle = %x\n", handle);
|
||||||
|
|
||||||
if (partition == 0) {
|
if (partition == 0) {
|
||||||
u32 title_ver;
|
u32 title_ver;
|
||||||
fsDeviceOperatorUpdatePartitionInfo(fsOperator, handle, &title_ver, NULL);
|
fsDeviceOperatorUpdatePartitionInfo(fsOperator, handle, &title_ver, NULL);
|
||||||
|
@ -47,15 +49,26 @@ bool dumpPartitionRaw(FsDeviceOperator* fsOperator, u32 partition) {
|
||||||
n = size - off;
|
n = size - off;
|
||||||
if (R_FAILED(result = fsStorageRead(&gameCardStorage, off, buf, n))) {
|
if (R_FAILED(result = fsStorageRead(&gameCardStorage, off, buf, n))) {
|
||||||
printf("fsStorageRead error\n");
|
printf("fsStorageRead error\n");
|
||||||
|
free(buf);
|
||||||
fsStorageClose(&gameCardStorage);
|
fsStorageClose(&gameCardStorage);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (fwrite(buf, 1, n, outFile) != n) {
|
if (fwrite(buf, 1, n, outFile) != n) {
|
||||||
printf("fwrite error\n");
|
printf("fwrite error\n");
|
||||||
|
free(buf);
|
||||||
fsStorageClose(&gameCardStorage);
|
fsStorageClose(&gameCardStorage);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (((off / bufs) % 10) == 0) {
|
if (((off / bufs) % 10) == 0) {
|
||||||
|
hidScanInput();
|
||||||
|
u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO);
|
||||||
|
if (kDown & KEY_B) {
|
||||||
|
printf("\nCancelled\n");
|
||||||
|
free(buf);
|
||||||
|
fsStorageClose(&gameCardStorage);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
printf(C_CLEAR_LINE "\rDumping %i%% [%li / %li bytes]", (int) (off * 100 / size), off, size);
|
printf(C_CLEAR_LINE "\rDumping %i%% [%li / %li bytes]", (int) (off * 100 / size), off, size);
|
||||||
syncDisplay();
|
syncDisplay();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue