mirror of
https://github.com/rvtr/TDT.git
synced 2025-10-31 13:51:07 -04:00
Fix homebrew banner padding
This commit is contained in:
parent
fcb97b07a5
commit
baba3783f4
@ -487,11 +487,11 @@ bool install(char* fpath, bool systemTitle)
|
|||||||
swiWaitForVBlank();
|
swiWaitForVBlank();
|
||||||
|
|
||||||
u32 clusterSize = getDsiClusterSize();
|
u32 clusterSize = getDsiClusterSize();
|
||||||
unsigned long long fileSize = getRomSize(fpath);
|
unsigned long long fileSize = getRomSize(fpath), fileSizeOnDisk = fileSize;
|
||||||
if ((fileSize % clusterSize) != 0)
|
if ((fileSizeOnDisk % clusterSize) != 0)
|
||||||
fileSize += clusterSize - (fileSize % clusterSize);
|
fileSizeOnDisk = clusterSize - (fileSizeOnDisk % clusterSize);
|
||||||
//file + saves + TMD (rounded up to cluster size)
|
//file + saves + TMD (rounded up to cluster size)
|
||||||
unsigned long long installSize = fileSize + _getSaveDataSize(h) + clusterSize;
|
unsigned long long installSize = fileSizeOnDisk + _getSaveDataSize(h) + clusterSize;
|
||||||
if (tmdFound) installSize += clusterSize; //ticket, rounded up to cluster size
|
if (tmdFound) installSize += clusterSize; //ticket, rounded up to cluster size
|
||||||
|
|
||||||
printBytes(installSize);
|
printBytes(installSize);
|
||||||
@ -661,12 +661,12 @@ bool install(char* fpath, bool systemTitle)
|
|||||||
|
|
||||||
//pad out banner if it is the last part of the file
|
//pad out banner if it is the last part of the file
|
||||||
{
|
{
|
||||||
if (h->ndshdr.bannerOffset == fileSize - 0x1C00)
|
if (h->ndshdr.bannerOffset > (fileSize - 0x23C0))
|
||||||
{
|
{
|
||||||
iprintf("Padding banner...");
|
iprintf("Padding banner...");
|
||||||
swiWaitForVBlank();
|
swiWaitForVBlank();
|
||||||
|
|
||||||
if (padFile(appPath, 0x7C0) == false)
|
if (padFile(appPath, h->ndshdr.bannerOffset + 0x23C0 - fileSize) == false)
|
||||||
{
|
{
|
||||||
iprintf("\x1B[31m"); //red
|
iprintf("\x1B[31m"); //red
|
||||||
iprintf("Failed\n");
|
iprintf("Failed\n");
|
||||||
|
|||||||
@ -186,8 +186,8 @@ bool padFile(char const* path, int size)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char zero = 0;
|
for (int i = 0; i < size; i++)
|
||||||
fwrite(&zero, size, 1, f);
|
fputc('\0', f);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user