shithub: rgbds

Download patch

ref: 69a41d8ef9671437a73a3dd73efe5f11922a836c
parent: b958820bce7574a509d6990d07d139f366c4fa62
author: James Larrowe <[email protected]>
date: Mon Jun 15 18:45:29 EDT 2020

Fix indexing of banks array

When ROMX bank 1 is given, the banks array is indexed with an index
of 1 rather than an index of zero.

--- a/src/link/output.c
+++ b/src/link/output.c
@@ -88,8 +88,9 @@
 
 struct Section const *out_OverlappingSection(struct Section const *section)
 {
+	struct SortedSections *banks = sections[section->type].banks;
 	struct SortedSection *ptr =
-		sections[section->type].banks[section->bank].sections;
+		banks[section->bank - bankranges[section->type][0]].sections;
 
 	while (ptr) {
 		if (ptr->section->org < section->org + section->size