mirror of
https://github.com/rvtr/TDT.git
synced 2025-10-31 13:51:07 -04:00
Pad banner if it's too small and at end of file.
This commit is contained in:
parent
e9d9444e43
commit
27c497e313
@ -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
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user