diff --git a/src/installmenu.c b/src/installmenu.c index 131da3a..4f58e0a 100644 --- a/src/installmenu.c +++ b/src/installmenu.c @@ -419,7 +419,18 @@ void install(Menu* m) goto error; } - iprintf("Done\n"); + iprintf("Done\n"); + } + + //Pad out banner if it is the last part of the file + if (header->ndshdr.bannerOffset == fileSize - 0x1C00) + { + iprintf("Padding banner..."); + + if (padFile(appPath, 0x7C0) == false) + iprintf("Failed\n"); + else + iprintf("Done\n"); } //Write new patched header diff --git a/src/storage.c b/src/storage.c index 1cccb11..7f13836 100644 --- a/src/storage.c +++ b/src/storage.c @@ -233,6 +233,24 @@ int getFileSizePath(const char* path) return size; } +int padFile(const char* path, int size) +{ + FILE* f = fopen(path, "ab"); + + if (!f) + return 0; + + else + { + unsigned char zero = 0; + fwrite(&zero, sizeof(char), size, f); + } + + fclose(f); + + return 1; +} + //Directories int dirExists(const char* path) { diff --git a/src/storage.h b/src/storage.h index 11c627a..486fb22 100644 --- a/src/storage.h +++ b/src/storage.h @@ -20,6 +20,7 @@ void clearProgressBar(); int copyFile(const char* in, char* out); int getFileSize(FILE* f); int getFileSizePath(const char* path); +int padFile(const char* path, int size); //Directories int dirExists(const char* path);