From 88275c2906be1f4f39451bae1d813e529df8a2de Mon Sep 17 00:00:00 2001 From: RocketRobz Date: Fri, 5 Oct 2018 20:25:58 -0600 Subject: [PATCH] Increase copy buffer size, and hold B to cancel copying --- arm9/source/fileOperations.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/arm9/source/fileOperations.cpp b/arm9/source/fileOperations.cpp index 3a0a56c..2eb8e04 100644 --- a/arm9/source/fileOperations.cpp +++ b/arm9/source/fileOperations.cpp @@ -1,7 +1,9 @@ #include #include -u32 copyBuf[0x8000]; +#define copyBufSize 0x20000 + +u32 copyBuf[copyBufSize]; off_t getFileSize(const char *fileName) { @@ -43,19 +45,19 @@ int fcopy(const char *sourcePath, const char *destinationPath) int numr; while (1) { - /* scanKeys(); - if (keysHeld() & KEY_A) { + scanKeys(); + if (keysHeld() & KEY_B) { // Cancel copying fclose(sourceFile); fclose(destinationFile); return -1; break; - } */ + } // Copy file to destination path - numr = fread(copyBuf, 2, 0x8000, sourceFile); + numr = fread(copyBuf, 2, copyBufSize, sourceFile); fwrite(copyBuf, 2, numr, destinationFile); - offset += 0x8000; + offset += copyBufSize; if (offset > fsize) { fclose(sourceFile);