Silence warnings and fixes

- Silence warning [-Wmaybe-uninitialized]
- m359: Fix value overflow
- m534: Silence warnings
- mmc1: Silence warnings
- Silence more warnings
This commit is contained in:
negativeExponent
2020-02-17 10:11:55 +08:00
parent ddb1fe786a
commit f9fb33d8e8
9 changed files with 19 additions and 27 deletions

View File

@@ -56,8 +56,8 @@ void Mirror(uint8 value)
static void Sync() {
uint8 prglo;
uint8 prghi;
uint8 prglo = 0;
uint8 prghi = 0;
uint8 outb = outer << 1;

View File

@@ -24,7 +24,7 @@
#include "mapinc.h"
static uint8 mapperNum;
static uint32 mapperNum;
static uint8 preg[4];
static uint8 creg[8];
static uint8 exRegs[4];

View File

@@ -30,10 +30,10 @@ static uint32 GetPRGBank(uint32 bank)
}
void SyncPRG_GNROM(int A14, int AND, int OR) {
setprg8(0x8000, (GetPRGBank(0) & ~A14) & AND | OR);
setprg8(0xA000, (GetPRGBank(1) & ~A14) & AND | OR);
setprg8(0xC000, (GetPRGBank(0) | A14) & AND | OR);
setprg8(0xE000, (GetPRGBank(1) | A14) & AND | OR);
setprg8(0x8000, ((GetPRGBank(0) & ~A14) & AND) | OR);
setprg8(0xA000, ((GetPRGBank(1) & ~A14) & AND) | OR);
setprg8(0xC000, ((GetPRGBank(0) | A14) & AND) | OR);
setprg8(0xE000, ((GetPRGBank(1) | A14) & AND) | OR);
}
static void M534PW(uint32 A, uint8 V) {
@@ -47,13 +47,6 @@ static void M534CW(uint32 A, uint8 V) {
setchr1(A, (V & 0xFF) | ((EXPREGS[2] & 0x0F) << 3) | ((EXPREGS[0] & 0x18) << 4));
}
static DECLFR(M534Read) {
if (EXPREGS[1] & 0x01)
return (EXPREGS[4] | (X.DB & ~0x03));
else
return CartBR(A);
}
static DECLFW(M534IRQWrite) {
MMC3_IRQWrite(0xC000 | (A & 1), V ^ 0xFF);
}

View File

@@ -52,6 +52,8 @@ static void Sync(void) {
*/
preg[0] = bank;
preg[1] = 0;
switch (mode & 3) {
case 0x00:
case 0x01:

View File

@@ -335,7 +335,8 @@ static void GenMMC1Init(CartInfo *info, int prg, int chr, int wram, int saveram)
is155 = 0;
info->Close = GenMMC1Close;
MMC1PRGHook16 = MMC1CHRHook4 = MMC1WRAMHook8 = 0;
MMC1PRGHook16 = MMC1CHRHook4 = 0;
MMC1WRAMHook8 = 0;
WRAMSIZE = wram * 1024;
NONSaveRAMSIZE = (wram - saveram) * 1024;
PRGmask16[0] &= (prg >> 14) - 1;
@@ -597,9 +598,9 @@ static void M543CHR4(uint32 A, uint8 V) {
static void M543WRAM8(void) {
uint32 wramBank;
if (outerBank & 2)
wramBank = 4 | ((outerBank >> 1) & 2) | (outerBank & 1) ;
else
wramBank = ((outerBank << 1) & 2) | ((MMC1GetCHRBank(0) >> 3) & 1);
wramBank = 4 | ((outerBank >> 1) & 2) | (outerBank & 1) ;
else
wramBank = ((outerBank << 1) & 2) | ((MMC1GetCHRBank(0) >> 3) & 1);
setprg8r(0x10, 0x6000, wramBank);
}

View File

@@ -98,7 +98,7 @@ static DECLFW(TXC_CMDWrite) {
if (txc.increase)
txc.accumulator++;
else
txc.accumulator = ((txc.accumulator & ~txc.mask) | (txc.staging ^ txc.invert) & txc.mask);
txc.accumulator = ((txc.accumulator & ~txc.mask) | ((txc.staging ^ txc.invert) & txc.mask));
break;
case 0x101:
txc.invert = (V & 0x01) ? 0xFF : 0x00;
@@ -133,9 +133,6 @@ static void GenTXCPower(void) {
TXCRegReset();
}
static void TXCClose(void) {
}
static void StateRestore(int version) {
WSync();
}
@@ -148,7 +145,7 @@ static void GenTXC_Init(CartInfo *info, void (*proc)(void), uint32 jv001) {
}
static int CheckHash(CartInfo *info) {
int x, i = 0;
int x = 0;
uint64 partialmd5 = 0;
/* These carts do not work with new mapper implementation.

View File

@@ -81,7 +81,6 @@ static unsigned turbo_delay = 0;
static unsigned input_type[MAX_PLAYERS + 1] = {0}; /* 4-players + famicom expansion */
enum RetroZapperInputModes{RetroLightgun, RetroMouse, RetroPointer};
static enum RetroZapperInputModes zappermode = RetroLightgun;
static unsigned show_advance_sound_options;
/* emulator-specific variables */
@@ -2215,7 +2214,7 @@ bool retro_load_game(const struct retro_game_info *game)
FCEU_printf(" Loading custom palette: %s%cnes.pal\n", dir, slash);
/* Save region and dendy mode for region-auto detect */
systemRegion = (dendy << 1) | retro_get_region() & 1;
systemRegion = (dendy << 1) | (retro_get_region() & 1);
retro_set_custom_palette();
FCEUD_SoundToggle();

View File

@@ -396,7 +396,7 @@ void FCEU_MemoryRand(uint8 *ptr, uint32 size)
*ptr = (x & 1) ? 0x55 : 0xAA; /* F-15 Sity War HISCORE is screwed... */
/* 1942 SCORE/HISCORE is screwed... */
#endif
uint8_t v;
uint8_t v = 0;
switch (option_ramstate)
{
case 0: v = 0xff; break;

View File

@@ -312,7 +312,7 @@ static int SetBoardName(FCEUFILE *fp) {
FCEU_fread(boardname, 1, uchead.info, fp);
boardname[uchead.info] = 0;
/* strip whitespaces */
boardname = string_trim_whitespace(boardname);
boardname = string_trim_whitespace((char const*)boardname);
FCEU_printf(" Board name: %s\n", boardname);
sboardname = boardname;
if (!memcmp(boardname, "NES-", 4) || !memcmp(boardname, "UNL-", 4) ||