mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-24 12:02:08 +00:00
Don't generate output file if overlay isn't found
Previously, the output file was opened before trying to open the overlay. Because of this, rgblink generated an empty output file if the overlay couldn't be opened. Now the overlay is opened (and checked) before the output file, so the output file is only generated if the overlay is found. Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
@@ -110,12 +110,9 @@ void Output(void)
|
||||
FILE *f_overlay = NULL;
|
||||
|
||||
/*
|
||||
* Apply overlay
|
||||
* Load overlay
|
||||
*/
|
||||
|
||||
f = fopen(tzOutname, "wb");
|
||||
|
||||
if (f != NULL) {
|
||||
if (tzOverlayname) {
|
||||
f_overlay = fopen(tzOverlayname, "rb");
|
||||
|
||||
@@ -138,18 +135,28 @@ void Output(void)
|
||||
MaxBankUsed = MaxOverlayBank;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write ROM.
|
||||
*/
|
||||
|
||||
f = fopen(tzOutname, "wb");
|
||||
if (f != NULL) {
|
||||
writehome(f, f_overlay);
|
||||
for (i = 1; i <= MaxBankUsed; i += 1)
|
||||
writebank(f, f_overlay, i);
|
||||
|
||||
fclose(f);
|
||||
|
||||
if (tzOverlayname)
|
||||
fclose(f_overlay);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add regular sections
|
||||
* Close overlay
|
||||
*/
|
||||
|
||||
if (tzOverlayname)
|
||||
fclose(f_overlay);
|
||||
|
||||
/*
|
||||
* Add regular sections to map and sym files.
|
||||
*/
|
||||
|
||||
for (i = BANK_INDEX_WRAM0; i < BANK_INDEX_MAX; i++) {
|
||||
|
||||
Reference in New Issue
Block a user