shithub: rgbds

Download patch

ref: 94d07c78d846f1a7a2af837f563a35bce468963a
parent: b51e1c7c2c4ce2769f01e016967d0115893a7a88
author: ISSOtm <eldredhabert0@gmail.com>
date: Thu Aug 12 05:19:32 EDT 2021

Fix MBC3+TIMER + handle lack of BATTERY

`TIMER & BATTERY` is 0, but even `|` would only be checking if
*either* is set; instead, imply BATTERY as soon as TIMER is given,
printing a warning if it was not given.

--- a/src/fix/main.c
+++ b/src/fix/main.c
@@ -494,7 +494,9 @@
 
 		case MBC3:
 			// Handle timer, which also requires battery
-			if (features & (TIMER & BATTERY)) {
+			if (features & TIMER) {
+				if (!(features & BATTERY))
+					fprintf(stderr, "warning: MBC3+TIMER implies BATTERY\n");
 				features &= ~(TIMER | BATTERY); // Reset those bits
 				mbc = MBC3_TIMER_BATTERY;
 				// RAM is handled below