shithub: rgbds

Download patch

ref: f0361ee025c9c32d6a960b8a7e8de09887ae2227
parent: 3649cec52d57dc55e6b9cf499346f37c3ac8cbd1
author: anthony <[email protected]>
date: Mon Jan 4 15:04:25 EST 2010

many of the flags did not respect -d (debug) flag. this fixes them.

--- a/src/fix/main.c
+++ b/src/fix/main.c
@@ -474,11 +474,12 @@
 			if (!(ulOptions & OPTF_QUIET)) {
 				printf("Setting RAM size\n");
 			}
-			fflush(f);
-			fseek(f, 0x149L, SEEK_SET);
-			fputc(ram_size, f);
-			fflush(f);
-
+			if (!(ulOptions & OPTF_DEBUG)) {
+				fflush(f);
+				fseek(f, 0x149L, SEEK_SET);
+				fputc(ram_size, f);
+				fflush(f);
+			}
 			if (!(ulOptions & OPTF_QUIET)) {
 				printf("\tRAM size set to %#02X\n", ram_size);
 			}
@@ -487,11 +488,12 @@
 		 * -j (Set region flag) option code
 		 */
 		if (ulOptions & OPTF_JAPAN) {
-			fflush(f);
-			fseek(f, 0x14A, SEEK_SET);
-			fputc(1, f);
-			fflush(f);
-
+			if (!(ulOptions & OPTF_DEBUG)) {
+				fflush(f);
+				fseek(f, 0x14A, SEEK_SET);
+				fputc(1, f);
+				fflush(f);
+			}
 			if (!(ulOptions & OPTF_QUIET)) {
 				printf("\tRegion code set to non-Japan\n");
 			}
@@ -504,11 +506,12 @@
 			if (!(ulOptions & OPTF_QUIET)) {
 				printf("Setting MBC type\n");
 			}
-			fflush(f);
-			fseek(f, 0x147L, SEEK_SET);
-			fputc(mbc_type, f);
-			fflush(f);
-
+			if (!(ulOptions & OPTF_DEBUG)) {
+				fflush(f);
+				fseek(f, 0x147L, SEEK_SET);
+				fputc(mbc_type, f);
+				fflush(f);
+			}
 			if (!(ulOptions & OPTF_QUIET)) {
 				printf("\tMBC type set to %#02X (%s)\n", mbc_type, MBC_String(mbc_type));
 			}
@@ -523,11 +526,12 @@
 			if (!(ulOptions & OPTF_QUIET) && gbc_mode == 0xC0) {
 				printf("Setting Game Boy Color only mode\n");
 			}
-			fflush(f);
-			fseek(f, 0x143L, SEEK_SET);
-			fputc(gbc_mode, f);
-			fflush(f);
-
+			if (!(ulOptions & OPTF_DEBUG)) {
+				fflush(f);
+				fseek(f, 0x143L, SEEK_SET);
+				fputc(gbc_mode, f);
+				fflush(f);
+			}
 			if (!(ulOptions & OPTF_QUIET) && gbc_mode == 0x80) {
 				printf("\tGame Boy Color compatible mode set\n");
 			}
@@ -545,15 +549,16 @@
 		 * -s (Set SGB mode) option code
 		 */
 		if (ulOptions & OPTF_SGBMODE) {
-			fflush(f);
-			// set old licensee code to 0x33
-			fseek(f, 0x14B, SEEK_SET);
-			fputc(0x33, f);
-			// set SGB flag to 0x03
-			fseek(f, 0x146, SEEK_SET);
-			fputc(3, f);
-			fflush(f);
-
+			if (!(ulOptions & OPTF_DEBUG)) {
+				fflush(f);
+				// set old licensee code to 0x33
+				fseek(f, 0x14B, SEEK_SET);
+				fputc(0x33, f);
+				// set SGB flag to 0x03
+				fseek(f, 0x146, SEEK_SET);
+				fputc(3, f);
+				fflush(f);
+			}
 			if (!(ulOptions & OPTF_QUIET)) {
 				printf("Setting SGB mode flag\n");
 			}