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

This commit is contained in:
anthony
2010-01-04 20:04:25 -07:00
parent 3649cec52d
commit f0361ee025

View File

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