shithub: rgbds

Download patch

ref: babf36e96ece780a985294760fb423c2c58e574f
parent: d6a43f6a53b129866a657b6c32c1cc0de59e20f8
author: ISSOtm <[email protected]>
date: Sun Nov 3 20:16:08 EST 2019

Don't forget to initialize additional banks when using an overlay

--- a/src/link/output.c
+++ b/src/link/output.c
@@ -111,6 +111,11 @@
 					nbOverlayBanks);
 		if (!sections[SECTTYPE_ROMX].banks)
 			err(1, "Failed to realloc banks for overlay");
+		for (uint32_t i = sections[SECTTYPE_ROMX].nbBanks;
+		     i < nbOverlayBanks; i++) {
+			sections[SECTTYPE_ROMX].banks[i].sections = NULL;
+			sections[SECTTYPE_ROMX].banks[i].zeroLenSections = NULL;
+		}
 		sections[SECTTYPE_ROMX].nbBanks = nbOverlayBanks;
 	}
 }