Skip to content

Commit

Permalink
Fix created save size
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Mar 11, 2022
1 parent b58ff24 commit 630882c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions quickmenu/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,11 +850,14 @@ bool createDSiWareSave(const char *path, int size) {
if(file) {
showProgressBar = true;
fwrite(&h, sizeof(FATHeader), 1, file); // Write header
for (int i = 0x8000; i < size; i += 0x8000) {
int i = 0;
while (1) {
i += 0x8000;
if (i > size) i = size;
progressBarLength = i/(size/192);
fseek(file, i - 1, SEEK_SET); // Pad rest of the file
fputc('\0', file);
if (i == size) break;
}
fclose(file);
showProgressBar = false;
Expand Down Expand Up @@ -2377,11 +2380,14 @@ int main(int argc, char **argv) {
FILE *pFile = fopen(savepath.c_str(), orgsavesize > 0 ? "r+" : "wb");
if (pFile) {
showProgressBar = true;
for (u32 i = (orgsavesize>0 ? orgsavesize : 0)+0x8000; i < savesize; i += 0x8000) {
u32 i = (orgsavesize>0 ? orgsavesize : 0);
while (1) {
i += 0x8000;
if (i > savesize) i = savesize;
progressBarLength = i/(savesize/192);
fseek(pFile, i - 1, SEEK_SET);
fputc('\0', pFile);
if (i == savesize) break;
}
fclose(pFile);
showProgressBar = false;
Expand Down
10 changes: 8 additions & 2 deletions romsel_dsimenutheme/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,11 +757,14 @@ bool createDSiWareSave(const char *path, int size) {
if(file) {
showProgressBar = true;
fwrite(&h, sizeof(FATHeader), 1, file); // Write header
for (int i = 0x8000; i < size; i += 0x8000) {
int i = 0;
while (1) {
i += 0x8000;
if (i > size) i = size;
progressBarLength = i/(size/192);
fseek(file, i - 1, SEEK_SET); // Pad rest of the file
fputc('\0', file);
if (i == size) break;
}
fclose(file);
showProgressBar = false;
Expand Down Expand Up @@ -1540,11 +1543,14 @@ int main(int argc, char **argv) {
FILE *pFile = fopen(savepath.c_str(), orgsavesize > 0 ? "r+" : "wb");
if (pFile) {
showProgressBar = true;
for (u32 i = (orgsavesize>0 ? orgsavesize : 0)+0x8000; i < savesize; i += 0x8000) {
u32 i = (orgsavesize>0 ? orgsavesize : 0);
while (1) {
i += 0x8000;
if (i > savesize) i = savesize;
progressBarLength = i/(savesize/192);
fseek(pFile, i - 1, SEEK_SET);
fputc('\0', pFile);
if (i == savesize) break;
}
fclose(pFile);
showProgressBar = false;
Expand Down

0 comments on commit 630882c

Please sign in to comment.