From 412e40698de037075842cb34bdaf09878e52c971 Mon Sep 17 00:00:00 2001 From: negativeExponent Date: Mon, 19 Oct 2020 08:18:23 +0800 Subject: [PATCH 1/4] Fix overrides incorrectly setting flags --- src/ines.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ines.c b/src/ines.c index 8ca2d3e..8b8c621 100644 --- a/src/ines.c +++ b/src/ines.c @@ -328,13 +328,15 @@ static void CheckHInfo(void) { case 1: case 5: case 176: - tofix |= 32; - iNESCart.iNES2 = 1; if (moo[x].prgram >= 0) { + tofix |= 32; + iNESCart.iNES2 = 1; iNESCart.PRGRamSize = (moo[x].prgram & 0x0F) ? (64 << ((moo[x].prgram >> 0) & 0xF)) : 0; iNESCart.PRGRamSaveSize = (moo[x].prgram & 0xF0) ? (64 << ((moo[x].prgram >> 4) & 0xF)) : 0; } if (moo[x].chrram >= 0) { + tofix |= 32; + iNESCart.iNES2 = 1; iNESCart.CHRRamSize = (moo[x].chrram & 0x0F) ? (64 << ((moo[x].chrram >> 0) & 0xF)) : 0; iNESCart.CHRRamSaveSize = (moo[x].chrram & 0xF0) ? (64 << ((moo[x].chrram >> 4) & 0xF)) : 0; } From 023d2a397b2ee41035a240712a396fe253a3db0c Mon Sep 17 00:00:00 2001 From: negativeExponent Date: Mon, 19 Oct 2020 09:17:45 +0800 Subject: [PATCH 2/4] m176: Updates - Fix incorrect chr-bank mask (let's see which games complain again) - Enables the 7-stage dipswitch support through reset switch. E.g switches multicart type on supported carts. like 10-in-1 to 20-in-1 etc. --- src/boards/fk23c.c | 97 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 86 insertions(+), 11 deletions(-) diff --git a/src/boards/fk23c.c b/src/boards/fk23c.c index dece010..8aed560 100644 --- a/src/boards/fk23c.c +++ b/src/boards/fk23c.c @@ -32,6 +32,76 @@ * Subtype 2, 8192 or more KiB PRG-ROM, no CHR-ROM: Like Subtype 0, but MMC3 registers $46 and $47 swapped. */ +/* +Mode Register ($5xx0) +7654 3210 +---- ---- +PCTm PMMM +|||| |||| +|||| |+++- Select PRG Banking Mode (ignored in Extended MMC3 Mode) +|||| | 0: MMC3 PRG Mode, 512 KiB Outer PRG Bank Size +|||| | 1: MMC3 PRG Mode, 256 KiB Outer PRG Bank Size +|||| | 2: MMC3 PRG Mode, 128 KiB Outer PRG Bank Size +|||| | 3: NROM-128 PRG Mode, 16 KiB PRG at $8000-$BFFF mirrored at $C000-$FFFF +|||| | 4: NROM-256 PRG Mode, 32 KiB PRG at $8000-$FFFF +|||| | 5-7: Never used +|||| +---- PRG Base A21 +|||+------ Select Outer CHR Bank Size +||| 0: In MMC3 CHR Mode: 256 KiB +||| In CNROM CHR Mode: 32 KiB +||| 1: In MMC3 CHR Mode: 128 KiB +||| In CNROM CHR Mode: 16 KiB +||+------- Select CHR Memory Type +|| 0: CHR-ROM +|| 1: CHR-RAM +|+-------- CHR Mode +| 0: MMC3 CHR Mode +| 1: NROM/CNROM CHR Mode ++--------- PRG Base A22 + +Power-on value: $00 + +PRG Base Register ($5xx1) +Mask: $5xx3, x determined by solder pad setting + +7654 3210 +---- ---- +.PPP PPPP + ||| |||| + +++-++++- PRG Base A20..A14 + +Power-on value: $00 +CHR Base Register ($5xx2) +Mask: $5xx3, x determined by solder pad setting + +7654 3210 +---- ---- +ccdC CCCC +|||| |||| +++++-++++- CHR Base A20..A13 +||+------- PRG Base A25 +++-------- PRG Base A24..A23 + +Power-on value: $00 +Writing to the CHR Base Register also resets the CNROM latch. + +Extended Mode Register ($5xx3) +Mask: $5xx3, x determined by solder pad setting + +7654 3210 +---- ---- +.C.. .CE. + | || + | |+- Extended MMC3 Mode + | | 0: disable + | | 1: enable + +----+-- Select NROM/CNROM CHR Mode + 0: NROM + 1: CNROM + +Power-on value: $02 (Submapper 1), $00 (otherwise) +*/ + /* 2020-3-14 - Refactoring based on latest sources */ /* TODO: Add database for ines 1.0 headers */ @@ -55,7 +125,11 @@ static uint8 irq_reload = 0; static uint8 cnrom_chr = 0; static uint8 dipswitch = 0; static uint8 subType = 0; -static uint8 is_bmcfk23ca = 0; + +/* enable dipswitch settings for fk23/fk23ca, + * switchable on reset. Can enable different multicart-modes + * depending on address */ +static uint8 dipsw_enable = 0; static SFORMAT StateRegs[] = { { fk23_regs, 4, "EXPR" }, @@ -138,12 +212,12 @@ static void SyncCHR(void) { uint16 cbase = INVERT_CHR ? 0x1000 : 0; uint8 mask = CHR_OUTER_BANK_SIZE ? 0x7F : 0xFF; - uint16 outer = (fk23_regs[2] << 3) & ~mask; + uint16 outer = (fk23_regs[2] << 3); - cwrap(cbase ^ 0x0000, ((mmc3_regs[0] & 0xFE) & mask) | outer); - cwrap(cbase ^ 0x0400, ((mmc3_regs[0] | 0x01) & mask) | outer); - cwrap(cbase ^ 0x0800, ((mmc3_regs[1] & 0xFE) & mask) | outer); - cwrap(cbase ^ 0x0C00, ((mmc3_regs[1] | 0x01) & mask) | outer); + cwrap(cbase ^ 0x0000, ((mmc3_regs[0] & mask) & 0xFE) | outer); + cwrap(cbase ^ 0x0400, ((mmc3_regs[0] & mask) | 0x01) | outer); + cwrap(cbase ^ 0x0800, ((mmc3_regs[1] & mask) & 0xFE) | outer); + cwrap(cbase ^ 0x0C00, ((mmc3_regs[1] & mask) | 0x01) | outer); cwrap(cbase ^ 0x1000, (mmc3_regs[2] & mask) | outer); cwrap(cbase ^ 0x1400, (mmc3_regs[3] & mask) | outer); @@ -383,10 +457,10 @@ static void IRQHook(void) static void Reset(void) { /* this little hack makes sure that we try all the dip switch settings eventually, if we reset enough */ - /*if (is_bmcfk23ca) { + if (dipsw_enable) { dipswitch = (dipswitch + 1) & 7; - printf("BMCFK23C dipswitch set to $%04x\n",0x5000|0x10 << dipswitch); - }*/ + FCEU_printf("BMCFK23C dipswitch set to $%04x\n",0x5000|0x10 << dipswitch); + } fk23_regs[0] = fk23_regs[1] = fk23_regs[2] = fk23_regs[3] = 0; mmc3_regs[0] = 0; @@ -463,7 +537,7 @@ static void StateRestore(int version) void GenBMCFK23C_Init(CartInfo *info) { - is_bmcfk23ca = 0; + dipsw_enable = 0; info->Power = Power; info->Reset = Reset; @@ -526,6 +600,7 @@ void BMCFK23C_Init(CartInfo *info) { } GenBMCFK23C_Init(info); + dipsw_enable = 1; } /* UNIF Boards, declares so we can for chr mixed mode size and wram if any */ @@ -539,7 +614,7 @@ void BMCFK23CA_Init(CartInfo *info) WRAMSIZE = 8 * 1024; GenBMCFK23C_Init(info); - is_bmcfk23ca = 1; + dipsw_enable = 1; } /* BMC-Super24in1SC03 */ From 7d232046a1452e88f3e2a8817a5044613581451f Mon Sep 17 00:00:00 2001 From: negativeExponent Date: Mon, 19 Oct 2020 09:31:16 +0800 Subject: [PATCH 3/4] Remove unused functions --- src/driver.h | 9 --------- src/drivers/libretro/libretro.c | 17 ----------------- src/ppu.c | 2 +- 3 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/driver.h b/src/driver.h index b3f029b..9ce4796 100644 --- a/src/driver.h +++ b/src/driver.h @@ -35,7 +35,6 @@ void FCEU_printf(char *format, ...); /* Video interface */ void FCEUD_SetPalette(uint8 index, uint8 r, uint8 g, uint8 b); -void FCEUD_GetPalette(uint8 i, uint8 *r, uint8 *g, uint8 *b); /* Displays an error. Can block or not. */ void FCEUD_PrintError(char *s); @@ -51,14 +50,6 @@ int FCEUI_NetplayStart(int nlocal, int divisor); /* Call when network play needs to stop. */ void FCEUI_NetplayStop(void); -/* Note: YOU MUST NOT CALL ANY FCEUI_* FUNCTIONS WHILE IN FCEUD_SendData() or - FCEUD_RecvData(). -*/ - -/* Return 0 on failure, 1 on success. */ -int FCEUD_SendData(void *data, uint32 len); -int FCEUD_RecvData(void *data, uint32 len); - /* Display text received over the network. */ void FCEUD_NetplayText(uint8 *text); diff --git a/src/drivers/libretro/libretro.c b/src/drivers/libretro/libretro.c index 3f41833..56b2bb2 100644 --- a/src/drivers/libretro/libretro.c +++ b/src/drivers/libretro/libretro.c @@ -202,11 +202,6 @@ const char * GetKeyboard(void) return ""; } -int FCEUD_SendData(void *data, uint32 len) -{ - return 1; -} - #define BUILD_PIXEL_RGB565(R,G,B) (((int) ((R)&0x1f) << RED_SHIFT) | ((int) ((G)&0x3f) << GREEN_SHIFT) | ((int) ((B)&0x1f) << BLUE_SHIFT)) #if defined (PSP) @@ -266,15 +261,6 @@ void FCEUD_SetPalette(uint8_t index, uint8_t r, uint8_t g, uint8_t b) #endif } -void FCEUD_GetPalette(unsigned char i, unsigned char *r, unsigned char *g, unsigned char *b) -{ -} - -bool FCEUD_ShouldDrawInputAids (void) -{ - return 1; -} - static struct retro_log_callback log_cb; static void default_logger(enum retro_log_level level, const char *fmt, ...) {} @@ -304,9 +290,6 @@ void FCEUD_SoundToggle (void) FCEUI_SetSoundVolume(sndvolume); } -void FCEUD_VideoChanged (void) -{ } - FILE *FCEUD_UTF8fopen(const char *n, const char *m) { if (n) diff --git a/src/ppu.c b/src/ppu.c index e9aec63..0d8ee53 100644 --- a/src/ppu.c +++ b/src/ppu.c @@ -1241,7 +1241,7 @@ int FCEUPPU_Loop(int skip) { for (scanline = 0; scanline < totalscanlines; ) { /* scanline is incremented in DoLine. Evil. :/ */ deempcnt[deemp]++; - if ((PPUViewer) && (scanline == PPUViewScanline)) UpdatePPUView(1); + /* if ((PPUViewer) && (scanline == PPUViewScanline)) UpdatePPUView(1); */ DoLine(); if (scanline < normal_scanlines || scanline == totalscanlines) overclocked = 0; From 8b3c191f68f0ed668a368b40ce1ba0968f6a61dd Mon Sep 17 00:00:00 2001 From: negativeExponent Date: Mon, 19 Oct 2020 09:32:37 +0800 Subject: [PATCH 4/4] Remove NETWORK branch This was part of netplay.c that do not exist anymore. Its empty and not relevant to current codebase. --- src/driver.h | 22 ---------------------- src/input.c | 3 --- 2 files changed, 25 deletions(-) diff --git a/src/driver.h b/src/driver.h index 9ce4796..196c733 100644 --- a/src/driver.h +++ b/src/driver.h @@ -41,28 +41,6 @@ void FCEUD_PrintError(char *s); void FCEUD_Message(char *s); void FCEUD_DispMessage(char *m); -#ifdef NETWORK -/* Network interface */ - -/* Call only when a game is loaded. */ -int FCEUI_NetplayStart(int nlocal, int divisor); - -/* Call when network play needs to stop. */ -void FCEUI_NetplayStop(void); - -/* Display text received over the network. */ -void FCEUD_NetplayText(uint8 *text); - -/* Encode and send text over the network. */ -void FCEUI_NetplayText(uint8 *text); - -/* Called when a fatal error occurred and network play can't continue. This function - should call FCEUI_NetplayStop() after it has deinitialized the network on the driver - side. -*/ -void FCEUD_NetworkClose(void); -#endif - int FCEUI_BeginWaveRecord(char *fn); int FCEUI_EndWaveRecord(void); diff --git a/src/input.c b/src/input.c index ff01bd5..318d68a 100644 --- a/src/input.c +++ b/src/input.c @@ -195,9 +195,6 @@ static void FP_FASTAPASS(3) UpdateGP(int w, void *data, int arg) { joy[1] = *(uint32*)ptr >> 8; joy[3] = *(uint32*)ptr >> 24; } -#ifdef NETWORK - if (FCEUnetplay) NetplayUpdate(joy); -#endif FCEUMOV_AddJoy(joy); }