From 6881c1fd2a2e268c50ceac8c1605eaa6f12528f9 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 25 Sep 2021 03:41:39 +0200 Subject: [PATCH] Some MSVC / C89 buildfixes --- src/boards/162.c | 5 +++-- src/boards/163.c | 5 +++-- src/boards/164.c | 5 +++-- src/boards/558.c | 5 +++-- src/boards/fk23c.c | 6 ++++-- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/boards/162.c b/src/boards/162.c index 6a57890..4dd12bf 100644 --- a/src/boards/162.c +++ b/src/boards/162.c @@ -77,7 +77,7 @@ static void power(void) SetWriteHandler(0x6000, 0x7FFF, CartBW); } -static void reset() +static void reset(void) { memset(reg, 0, sizeof(reg)); sync(); @@ -85,13 +85,14 @@ static void reset() void Mapper162_Init (CartInfo *info) { + uint8 *WRAM; uint32 WRAMSIZE = info->iNES2? (info->PRGRamSize + info->PRGRamSaveSize): 8192; info->Power = power; info->Reset = reset; GameHBIRQHook = hblank; AddExState(StateRegs, ~0, 0, 0); - uint8* WRAM = (uint8*) FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8*) FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM); if (info->battery) { diff --git a/src/boards/163.c b/src/boards/163.c index a285fff..94ff9d3 100644 --- a/src/boards/163.c +++ b/src/boards/163.c @@ -82,7 +82,7 @@ static void power(void) SetWriteHandler(0x6000, 0x7FFF, CartBW); } -static void reset() +static void reset(void) { memset(reg, 0, sizeof(reg)); sync(); @@ -90,13 +90,14 @@ static void reset() void Mapper163_Init (CartInfo *info) { + uint8 *WRAM; uint32 WRAMSIZE = info->iNES2? (info->PRGRamSize + info->PRGRamSaveSize): 8192; info->Power = power; info->Reset = reset; GameHBIRQHook = hblank; AddExState(StateRegs, ~0, 0, 0); - uint8* WRAM = (uint8*) FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8*) FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM); if (info->battery) { diff --git a/src/boards/164.c b/src/boards/164.c index a9d7c9e..06c7b39 100644 --- a/src/boards/164.c +++ b/src/boards/164.c @@ -95,7 +95,7 @@ static void power(void) SetWriteHandler(0x6000, 0x7FFF, CartBW); } -static void reset() +static void reset(void) { memset(reg, 0, sizeof(reg)); sync(); @@ -103,12 +103,13 @@ static void reset() void Mapper164_Init (CartInfo *info) { + uint8 *WRAM; uint32 WRAMSIZE = info->iNES2? (info->PRGRamSize + (info->PRGRamSaveSize &~0x7FF)): 8192; info->Power = power; info->Reset = reset; AddExState(StateRegs, ~0, 0, 0); - uint8* WRAM = (uint8*) FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8*) FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM); diff --git a/src/boards/558.c b/src/boards/558.c index b622a61..a6664c0 100644 --- a/src/boards/558.c +++ b/src/boards/558.c @@ -91,7 +91,7 @@ static void power(void) SetWriteHandler(0x6000, 0x7FFF, CartBW); } -static void reset() +static void reset(void) { memset(reg, 0, sizeof(reg)); sync(); @@ -99,13 +99,14 @@ static void reset() void Mapper558_Init (CartInfo *info) { + uint8 *WRAM; uint32 WRAMSIZE = info->PRGRamSize + (info->PRGRamSaveSize &~0x7FF); info->Power = power; info->Reset = reset; GameHBIRQHook = hblank; AddExState(StateRegs, ~0, 0, 0); - uint8* WRAM = (uint8*) FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8*) FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM); haveEEPROM =!!(info->PRGRamSaveSize &0x200); diff --git a/src/boards/fk23c.c b/src/boards/fk23c.c index bbbb23b..b5c13f5 100644 --- a/src/boards/fk23c.c +++ b/src/boards/fk23c.c @@ -290,8 +290,9 @@ static DECLFW(Write8000) { case 0x8000: { + uint8 old_ctrl; if (A & 2) return; /* Confirmed on real hardware: writes to 8002 and 8003, or 9FFE and 9FFF, are ignored. Needed for Dr. Mario on some of the "bouncing ball" multis. */ - uint8 old_ctrl = mmc3_ctrl; + old_ctrl = mmc3_ctrl; /* Subtype 2, 8192 or more KiB PRG-ROM, no CHR-ROM: Like Subtype 0, * but MMC3 registers $46 and $47 swapped. */ @@ -315,8 +316,9 @@ static DECLFW(Write8000) } case 0x8001: { + uint8 ctrl_mask; if (A & 2) return; /* Confirmed on real hardware: writes to 8002 and 8003, or 9FFE and 9FFF, are ignored. Needed for Dr. Mario on some of the "bouncing ball" multis. */ - uint8 ctrl_mask = MMC3_EXTENDED ? 0x0F : 0x07; + ctrl_mask = MMC3_EXTENDED ? 0x0F : 0x07; if ((mmc3_ctrl & ctrl_mask) < 12) {