diff --git a/.gitignore b/.gitignore index 407bd5b..26bc844 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ *.a *.so .vscode +build.log diff --git a/src/boards/09-034a.c b/src/boards/09-034a.c index 72ee4e6..cfd74ae 100644 --- a/src/boards/09-034a.c +++ b/src/boards/09-034a.c @@ -32,8 +32,8 @@ #include "mapinc.h" -static uint8 prg; -static uint32 IRQCount, IRQa; +static uint8_t prg; +static uint32_t IRQCount, IRQa; static SFORMAT StateRegs[] = { diff --git a/src/boards/103.c b/src/boards/103.c index 3f69a78..b3bc772 100644 --- a/src/boards/103.c +++ b/src/boards/103.c @@ -24,9 +24,9 @@ #include "mapinc.h" #include "../fds_apu.h" -static uint8 reg0, reg1, reg2; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t reg0, reg1, reg2; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -109,7 +109,7 @@ void Mapper103_Init(CartInfo *info) { GameStateRestore = StateRestore; WRAMSIZE = 16384; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); diff --git a/src/boards/104.c b/src/boards/104.c index 6a894a7..db3ac68 100644 --- a/src/boards/104.c +++ b/src/boards/104.c @@ -22,9 +22,9 @@ #include "mapinc.h" -static uint8 preg[2]; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t preg[2]; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -80,7 +80,7 @@ void Mapper104_Init(CartInfo *info) { AddExState(&StateRegs, ~0, 0, 0); WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); if (info->battery) { diff --git a/src/boards/106.c b/src/boards/106.c index 3945ed7..bfde3ba 100644 --- a/src/boards/106.c +++ b/src/boards/106.c @@ -20,10 +20,10 @@ #include "mapinc.h" -static uint8 reg[16], IRQa; -static uint32 IRQCount; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t reg[16], IRQa; +static uint32_t IRQCount; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -100,7 +100,7 @@ void Mapper106_Init(CartInfo *info) { GameStateRestore = StateRestore; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); diff --git a/src/boards/108.c b/src/boards/108.c index a06113b..15fca48 100644 --- a/src/boards/108.c +++ b/src/boards/108.c @@ -26,7 +26,7 @@ #include "mapinc.h" -static uint8 reg; +static uint8_t reg; static SFORMAT StateRegs[] = { diff --git a/src/boards/112.c b/src/boards/112.c index a469719..0080ef1 100644 --- a/src/boards/112.c +++ b/src/boards/112.c @@ -23,9 +23,9 @@ #include "mapinc.h" -static uint8 reg[8]; -static uint8 mirror, cmd, bank; -static uint8 *WRAM = NULL; +static uint8_t reg[8]; +static uint8_t mirror, cmd, bank; +static uint8_t *WRAM = NULL; static SFORMAT StateRegs[] = { @@ -84,7 +84,7 @@ void Mapper112_Init(CartInfo *info) { info->Power = M112Power; info->Close = M112Close; GameStateRestore = StateRestore; - WRAM = (uint8*)FCEU_gmalloc(8192); + WRAM = (uint8_t*)FCEU_gmalloc(8192); SetupCartPRGMapping(0x10, WRAM, 8192, 1); AddExState(WRAM, 8192, 0, "WRAM"); AddExState(&StateRegs, ~0, 0, 0); diff --git a/src/boards/116.c b/src/boards/116.c index 151b8b7..52f6eb4 100644 --- a/src/boards/116.c +++ b/src/boards/116.c @@ -23,10 +23,10 @@ #include "asic_mmc3.h" #include "asic_vrc2and4.h" -static uint8 submapper; -static uint8 reg; -static uint8 init; /* Games switch between ASICs expecting registers to keep their value, so initialize each ASIC only on the first switch and use this bitfield to track it */ -static uint8 game; +static uint8_t submapper; +static uint8_t reg; +static uint8_t init; /* Games switch between ASICs expecting registers to keep their value, so initialize each ASIC only on the first switch and use this bitfield to track it */ +static uint8_t game; static SFORMAT stateRegs[] = { { ®, 1, "MODE" }, @@ -72,11 +72,11 @@ static void sync (void) { } } -int Huang2_getPRGBank (uint8 bank) { +int Huang2_getPRGBank (uint8_t bank) { return MMC1_getPRGBank(bank) >>1; } -static void applyMode (uint8 clear) { +static void applyMode (uint8_t clear) { PPU_hook = NULL; MapIRQHook = NULL; GameHBIRQHook = NULL; @@ -102,7 +102,7 @@ static void applyMode (uint8 clear) { static DECLFW (writeReg) { if (A &0x100) { - uint8 previousReg = reg; + uint8_t previousReg = reg; reg = V; if ((previousReg ^V) &3) applyMode(1); diff --git a/src/boards/117.c b/src/boards/117.c index a434899..c309879 100644 --- a/src/boards/117.c +++ b/src/boards/117.c @@ -20,8 +20,8 @@ #include "mapinc.h" -static uint8 prgreg[4], chrreg[8], mirror; -static uint8 IRQa, IRQCount, IRQLatch; +static uint8_t prgreg[4], chrreg[8], mirror; +static uint8_t IRQa, IRQCount, IRQLatch; static SFORMAT StateRegs[] = { diff --git a/src/boards/120.c b/src/boards/120.c index bdc8dd5..daeadc3 100644 --- a/src/boards/120.c +++ b/src/boards/120.c @@ -23,7 +23,7 @@ #include "mapinc.h" -static uint8 reg; +static uint8_t reg; static SFORMAT StateRegs[] = { diff --git a/src/boards/121.c b/src/boards/121.c index b09a614..48cdd0a 100644 --- a/src/boards/121.c +++ b/src/boards/121.c @@ -44,7 +44,7 @@ static void Sync() { } } -static void M121CW(uint32 A, uint8 V) { +static void M121CW(uint32_t A, uint8_t V) { if (PRGsize[0] == CHRsize[0]) { /* A9713 multigame extension hack! */ setchr1(A, V | ((EXPREGS[3] & 0x80) << 1)); } else { @@ -55,7 +55,7 @@ static void M121CW(uint32 A, uint8 V) { } } -static void M121PW(uint32 A, uint8 V) { +static void M121PW(uint32_t A, uint8_t V) { setprg8(A, (V & 0x1F) | ((EXPREGS[3] & 0x80) >> 2)); if (EXPREGS[5] & 0x3F) { setprg8(0xE000, (EXPREGS[0]) | ((EXPREGS[3] & 0x80) >> 2)); @@ -91,7 +91,7 @@ static DECLFW(M121Write) { } } -static uint8 prot_array[16] = { 0x83, 0x83, 0x42, 0x00 }; +static uint8_t prot_array[16] = { 0x83, 0x83, 0x42, 0x00 }; static DECLFW(M121LoWrite) { EXPREGS[4] = prot_array[V & 3]; /* 0x100 bit in address seems to be switch arrays 0, 2, 2, 3 (Contra Fighter) */ if ((A & 0x5180) == 0x5180) { /* A9713 multigame extension */ diff --git a/src/boards/122.c b/src/boards/122.c index 9021045..486d9ba 100644 --- a/src/boards/122.c +++ b/src/boards/122.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 reg[2]; +static uint8_t reg[2]; static void sync () { setprg32(0x8000, 0); diff --git a/src/boards/126_422_534.c b/src/boards/126_422_534.c index 521082e..f85dbfd 100644 --- a/src/boards/126_422_534.c +++ b/src/boards/126_422_534.c @@ -38,17 +38,17 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 reverseCHR_A18_A19; -static uint8 invertC000; -static uint8 SL0; -static uint8 submapper; +static uint8_t reverseCHR_A18_A19; +static uint8_t invertC000; +static uint8_t SL0; +static uint8_t submapper; -static uint8 getMMC3Bank(int bank) { +static uint8_t getMMC3Bank(int bank) { if (~bank &1 && MMC3_cmd &0x40) bank ^=2; return bank &2? 0xFE | bank &1: DRegBuf[6 | bank &1]; } -static void wrapPRG(uint32 A, uint8 V) { +static void wrapPRG(uint32_t A, uint8_t V) { int prgAND = EXPREGS[0] &0x40? 0x0F: 0x1F; /* 128 KiB or 256 KiB inner PRG bank selection */ int prgOR =(EXPREGS[0] <<4 &0x70 | (EXPREGS[0] ^0x20) <<3 &0x180) &~prgAND; /* Outer PRG bank */ if (submapper ==1) prgOR =prgOR &0x7F | prgOR >>1 &0x80; /* Submapper 1 uses PRG A21 as a chip select between two 1 MiB chips */ @@ -78,7 +78,7 @@ static void wrapPRG(uint32 A, uint8 V) { mwrap(A000B); /* After 8000 write */ } -static void wrapCHR(uint32 A, uint8 V) { +static void wrapCHR(uint32_t A, uint8_t V) { int chrAND = EXPREGS[0] &0x80? 0x7F: 0xFF; /* 128 KiB or 256 KiB innter CHR bank selection */ int chrOR; /* outer CHR bank */ if (reverseCHR_A18_A19) /* Mapper 126 swaps CHR A18 and A19 */ @@ -99,7 +99,7 @@ static void wrapCHR(uint32 A, uint8 V) { setchr1(A, (V & chrAND) | chrOR); } -static void wrapMirroring(uint8 V) { +static void wrapMirroring(uint8_t V) { A000B =V; if (EXPREGS[3] &0x20) { /* ANROM mirroring */ if (DRegBuf[6] &0x10) diff --git a/src/boards/128.c b/src/boards/128.c index 0aff661..a2aae01 100644 --- a/src/boards/128.c +++ b/src/boards/128.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "latch.h" -static uint16 outerbank = 0; +static uint16_t outerbank = 0; static void Sync(void) { setprg16(0x8000, (outerbank >> 2) | (latch.data & 7)); diff --git a/src/boards/12in1.c b/src/boards/12in1.c index e9be49d..ee67c8a 100644 --- a/src/boards/12in1.c +++ b/src/boards/12in1.c @@ -24,7 +24,7 @@ #include "mapinc.h" -static uint8 prgchr[2], ctrl; +static uint8_t prgchr[2], ctrl; static SFORMAT StateRegs[] = { { prgchr, 2, "REGS" }, @@ -33,7 +33,7 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { - uint8 bank = (ctrl & 3) << 3; + uint8_t bank = (ctrl & 3) << 3; setchr4(0x0000, (prgchr[0] >> 3) | (bank << 2)); setchr4(0x1000, (prgchr[1] >> 3) | (bank << 2)); if (ctrl & 8) { diff --git a/src/boards/134.c b/src/boards/134.c index 3f2f99f..b0f9866 100644 --- a/src/boards/134.c +++ b/src/boards/134.c @@ -25,9 +25,9 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 dip; +static uint8_t dip; -static void Mapper134_PRGWrap(uint32 A, uint8 V) { +static void Mapper134_PRGWrap(uint32_t A, uint8_t V) { int prgAND =EXPREGS[1] &0x04? 0x0F: 0x1F; int prgOR =EXPREGS[1] <<4 &0x30 | EXPREGS[0] <<2 &0x40; if (EXPREGS[1] &0x80) { /* NROM mode */ @@ -46,7 +46,7 @@ static void Mapper134_PRGWrap(uint32 A, uint8 V) { setprg8(A, V &prgAND | prgOR &~prgAND); } -static void Mapper134_CHRWrap(uint32 A, uint8 V) { +static void Mapper134_CHRWrap(uint32_t A, uint8_t V) { int chrAND =EXPREGS[1] &0x40? 0x7F: 0xFF; int chrOR =EXPREGS[1] <<3 &0x180 | EXPREGS[0] <<4 &0x200; if (EXPREGS[0] &0x08) V =EXPREGS[2] <<3 | A >>10 &7; /* In CNROM mode, outer bank register 2 replaces the MMC3's CHR registers, and CHR A10-A12 are PPU A10-A12. */ diff --git a/src/boards/14.c b/src/boards/14.c index 6e223e2..e53838d 100644 --- a/src/boards/14.c +++ b/src/boards/14.c @@ -22,9 +22,9 @@ #include "asic_mmc3.h" #include "asic_vrc2and4.h" -static uint8 reg; -static uint8 init; /* Games switch between ASICs expecting registers to keep their value, so initialize each ASIC only on the first switch and use this bitfield to track it */ -static void applyMode (uint8); +static uint8_t reg; +static uint8_t init; /* Games switch between ASICs expecting registers to keep their value, so initialize each ASIC only on the first switch and use this bitfield to track it */ +static void applyMode (uint8_t); static SFORMAT StateRegs[] = { { ®, 1, "MODE" }, @@ -44,16 +44,16 @@ static void sync (void) { } } -int getCHRBank_MMC3 (uint8 bank) { +int getCHRBank_MMC3 (uint8_t bank) { return MMC3_getCHRBank(bank) | reg <<(~bank &4? 5: ~bank &2? 3: 1) &0x100; } -int getCHRBank_VRC2 (uint8 bank) { +int getCHRBank_VRC2 (uint8_t bank) { return VRC24_getCHRBank(bank) | reg <<(~bank &4? 5: ~bank &2? 3: 1) &0x100; } static DECLFW (writeReg) { - uint8 previousReg = reg; + uint8_t previousReg = reg; reg = V; if ((previousReg ^V) &2) applyMode(1); @@ -61,7 +61,7 @@ static DECLFW (writeReg) { sync(); } -static void applyMode (uint8 clear) { +static void applyMode (uint8_t clear) { PPU_hook = NULL; MapIRQHook = NULL; GameHBIRQHook = NULL; diff --git a/src/boards/15.c b/src/boards/15.c index f9c99a7..8097d97 100644 --- a/src/boards/15.c +++ b/src/boards/15.c @@ -21,10 +21,10 @@ #include "mapinc.h" -static uint16 latchea; -static uint8 latched; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint16_t latchea; +static uint8_t latched; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { { &latchea, 2 | FCEUSTATE_RLSB, "AREG" }, @@ -33,8 +33,8 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { - uint32 preg[4]; - uint32 bank = (latched & 0x3F) << 1; + uint32_t preg[4]; + uint32_t bank = (latched & 0x3F) << 1; switch (latchea & 0x03) { case 0: preg[0] = bank + 0; @@ -114,7 +114,7 @@ void Mapper15_Init(CartInfo *info) { info->Close = M15Close; GameStateRestore = StateRestore; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); if (info->battery) { info->SaveGame[0] = WRAM; diff --git a/src/boards/151.c b/src/boards/151.c index 45b7e2a..039e8a1 100644 --- a/src/boards/151.c +++ b/src/boards/151.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 regs[8]; +static uint8_t regs[8]; static SFORMAT StateRegs[] = { diff --git a/src/boards/156.c b/src/boards/156.c index a605e69..68eead9 100644 --- a/src/boards/156.c +++ b/src/boards/156.c @@ -26,9 +26,9 @@ #include "mapinc.h" -static uint8 chrlo[8], chrhi[8], prg, mirr, mirrisused = 0; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t chrlo[8], chrhi[8], prg, mirr, mirrisused = 0; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -40,7 +40,7 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { - uint32 i; + uint32_t i; for (i = 0; i < 8; i++) setchr1(i << 10, chrlo[i] | (chrhi[i] << 8)); setprg8r(0x10, 0x6000, 0); @@ -76,7 +76,7 @@ static DECLFW(M156Write) { } static void M156Reset(void) { - uint32 i; + uint32_t i; for (i = 0; i < 8; i++) { chrlo[i] = 0; chrhi[i] = 0; @@ -111,7 +111,7 @@ void Mapper156_Init(CartInfo *info) { info->Close = M156Close; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); diff --git a/src/boards/162.c b/src/boards/162.c index 676b44f..816f2cf 100644 --- a/src/boards/162.c +++ b/src/boards/162.c @@ -24,9 +24,9 @@ #include "mapinc.h" -static uint8 *WRAM; -static uint32 WRAMSIZE; -static uint8 reg[4]; +static uint8_t *WRAM; +static uint32_t WRAMSIZE; +static uint8_t reg[4]; static SFORMAT StateRegs[] = { { reg, 4, "REGS" }, @@ -107,7 +107,7 @@ void Mapper162_Init (CartInfo *info) AddExState(StateRegs, ~0, 0, 0); WRAMSIZE = info->iNES2? (info->PRGRamSize + info->PRGRamSaveSize): 8192; - WRAM = (uint8*) FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*) FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM); diff --git a/src/boards/163.c b/src/boards/163.c index 9709255..04942c9 100644 --- a/src/boards/163.c +++ b/src/boards/163.c @@ -24,9 +24,9 @@ #include "mapinc.h" -static uint8 *WRAM; -static uint32 WRAMSIZE; -static uint8 reg[4]; +static uint8_t *WRAM; +static uint32_t WRAMSIZE; +static uint8_t reg[4]; static SFORMAT StateRegs[] = { { reg, 4, "REGS" }, @@ -58,7 +58,7 @@ static DECLFR(readReg) static DECLFW(writeReg) { - uint8 index = A >>8 &3; + uint8_t index = A >>8 &3; /* Swap bits of registers 0-2 again if the "swap bits" bit is set. Exclude register 2 on when PRG-ROM is 1 MiB. */ if (reg[3] &0x01 && index <= (ROM_size == 64? 1: 2)) @@ -112,7 +112,7 @@ void Mapper163_Init (CartInfo *info) AddExState(StateRegs, ~0, 0, 0); WRAMSIZE = info->iNES2? (info->PRGRamSize + info->PRGRamSaveSize): 8192; - WRAM = (uint8*) FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*) FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM); diff --git a/src/boards/164.c b/src/boards/164.c index 16e0748..dec875a 100644 --- a/src/boards/164.c +++ b/src/boards/164.c @@ -28,10 +28,10 @@ #include "mapinc.h" #include "eeprom_93Cx6.h" -static uint8 *WRAM; -static uint32 WRAMSIZE; -static uint8 reg[8]; -static uint8 eeprom_data[512]; +static uint8_t *WRAM; +static uint32_t WRAMSIZE; +static uint8_t reg[8]; +static uint8_t eeprom_data[512]; static SFORMAT StateRegs[] = { { reg, 8, "REGS" }, @@ -41,8 +41,8 @@ static SFORMAT StateRegs[] = static void sync() { - uint8 prgLow = reg[0] &0x0F | reg[0] >>1 &0x10; - uint8 prgHigh = reg[1] <<5; + uint8_t prgLow = reg[0] &0x0F | reg[0] >>1 &0x10; + uint8_t prgHigh = reg[1] <<5; switch (reg[0] >>5 &2 | reg[0] >>4 &1) { case 0: /* UNROM-512 */ @@ -125,7 +125,7 @@ void Mapper164_Init (CartInfo *info) AddExState(StateRegs, ~0, 0, 0); WRAMSIZE = info->iNES2? (info->PRGRamSize + (info->PRGRamSaveSize &~0x7FF)): 8192; - WRAM = (uint8*) FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*) FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM); diff --git a/src/boards/168.c b/src/boards/168.c index ae3f760..baba975 100644 --- a/src/boards/168.c +++ b/src/boards/168.c @@ -23,9 +23,9 @@ #include "mapinc.h" -static uint8 reg; -static uint8 *CHRRAM = NULL; -static uint32 CHRRAMSIZE; +static uint8_t reg; +static uint8_t *CHRRAM = NULL; +static uint32_t CHRRAMSIZE; static SFORMAT StateRegs[] = { @@ -75,7 +75,7 @@ void Mapper168_Init(CartInfo *info) { AddExState(&StateRegs, ~0, 0, 0); CHRRAMSIZE = 8192 * 8; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM = (uint8_t*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM"); } diff --git a/src/boards/170.c b/src/boards/170.c index 37e8612..7531f1e 100644 --- a/src/boards/170.c +++ b/src/boards/170.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 reg; +static uint8_t reg; static SFORMAT StateRegs[] = { diff --git a/src/boards/175.c b/src/boards/175.c index 91e52a8..4fb1775 100644 --- a/src/boards/175.c +++ b/src/boards/175.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 reg, delay, mirr; +static uint8_t reg, delay, mirr; static SFORMAT StateRegs[] = { diff --git a/src/boards/177.c b/src/boards/177.c index 38828f8..ad29e95 100644 --- a/src/boards/177.c +++ b/src/boards/177.c @@ -20,10 +20,10 @@ #include "mapinc.h" -static uint8 reg; +static uint8_t reg; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -75,7 +75,7 @@ void Mapper177_Init(CartInfo *info) { GameStateRestore = StateRestore; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); if (info->battery) { diff --git a/src/boards/178.c b/src/boards/178.c index 60fedf8..d113a2f 100644 --- a/src/boards/178.c +++ b/src/boards/178.c @@ -27,16 +27,16 @@ #include "mapinc.h" -static uint8 submapper; -static uint8 reg[4]; -static uint8 pad[2]; +static uint8_t submapper; +static uint8_t reg[4]; +static uint8_t pad[2]; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; /* SND Registers */ -static uint8 pcm_enable = 0; -static int16 pcm_latch = 0x3F6, pcm_clock = 0x3F6; +static uint8_t pcm_enable = 0; +static int16_t pcm_latch = 0x3F6, pcm_clock = 0x3F6; static writefunc pcmwrite; static SFORMAT StateRegs[] = @@ -45,19 +45,19 @@ static SFORMAT StateRegs[] = { 0 } }; -static int16 step_size[49] = { +static int16_t step_size[49] = { 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552 }; /* 49 items */ -static int32 step_adj[16] = { -1, -1, -1, -1, 2, 5, 7, 9, -1, -1, -1, -1, 2, 5, 7, 9 }; +static int32_t step_adj[16] = { -1, -1, -1, -1, 2, 5, 7, 9, -1, -1, -1, -1, 2, 5, 7, 9 }; /* decode stuff */ -static int32 jedi_table[16 * 49]; -static int32 acc = 0; /* ADPCM accumulator, initial condition must be 0 */ -static int32 decstep = 0; /* ADPCM decoding step, initial condition must be 0 */ +static int32_t jedi_table[16 * 49]; +static int32_t acc = 0; /* ADPCM accumulator, initial condition must be 0 */ +static int32_t decstep = 0; /* ADPCM decoding step, initial condition must be 0 */ static void jedi_table_init() { int step, nib; @@ -70,7 +70,7 @@ static void jedi_table_init() { } } -static uint8 decode(uint8 code) { +static uint8_t decode(uint8_t code) { acc += jedi_table[decstep + code]; if ((acc & ~0x7ff) != 0) /* acc is > 2047 */ acc |= ~0xfff; @@ -86,8 +86,8 @@ static DECLFR(readPad) { } static void M178Sync(void) { - uint32 sbank = reg[1] & 0x7; - uint32 bbank = reg[2]; + uint32_t sbank = reg[1] & 0x7; + uint32_t bbank = reg[2]; setchr8(0); setprg8r(0x10, 0x6000, reg[3] & 3); if (reg[0] & 2) { /* UNROM mode */ @@ -97,7 +97,7 @@ static void M178Sync(void) { else setprg16(0xC000, (bbank << 3) | 7); } else { /* NROM mode */ - uint32 bank = (bbank << 3) | sbank; + uint32_t bank = (bbank << 3) | sbank; if (reg[0] & 4) { setprg16(0x8000, bank); setprg16(0xC000, bank); @@ -110,8 +110,8 @@ static void M178Sync(void) { } static void M551Sync(void) { - uint32 sbank = reg[1] & 0x7; - uint32 bbank = reg[2]; + uint32_t sbank = reg[1] & 0x7; + uint32_t bbank = reg[2]; if (reg[0] & 2) { /* UNROM mode */ setprg16(0x8000, (bbank << 3) | sbank); if (reg[0] & 4) @@ -119,7 +119,7 @@ static void M551Sync(void) { else setprg16(0xC000, (bbank << 3) | 7); } else { /* NROM mode */ - uint32 bank = (bbank << 3) | sbank; + uint32_t bank = (bbank << 3) | sbank; if (reg[0] & 4) { setprg16(0x8000, bank); setprg16(0xC000, bank); @@ -249,7 +249,7 @@ void Mapper178_Init(CartInfo *info) { AddExState(pad, 2, 0, "DIPS"); else { WRAMSIZE = 32768; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); if (info->battery) { info->SaveGame[0] = WRAM; diff --git a/src/boards/18.c b/src/boards/18.c index da92770..636208e 100644 --- a/src/boards/18.c +++ b/src/boards/18.c @@ -20,11 +20,11 @@ #include "mapinc.h" -static uint8 preg[4], creg[8]; -static uint8 IRQa, mirr; -static int32 IRQCount, IRQLatch; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t preg[4], creg[8]; +static uint8_t IRQa, mirr; +static int32_t IRQCount, IRQLatch; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -64,14 +64,14 @@ static DECLFW(M18WriteIRQ) { } static DECLFW(M18WritePrg) { - uint32 i = ((A >> 1) & 1) | ((A - 0x8000) >> 11); + uint32_t i = ((A >> 1) & 1) | ((A - 0x8000) >> 11); preg[i] &= (0xF0) >> ((A & 1) << 2); preg[i] |= (V & 0xF) << ((A & 1) << 2); Sync(); } static DECLFW(M18WriteChr) { - uint32 i = ((A >> 1) & 1) | ((A - 0xA000) >> 11); + uint32_t i = ((A >> 1) & 1) | ((A - 0xA000) >> 11); creg[i] &= (0xF0) >> ((A & 1) << 2); creg[i] |= (V & 0xF) << ((A & 1) << 2); Sync(); @@ -120,7 +120,7 @@ void Mapper18_Init(CartInfo *info) { GameStateRestore = StateRestore; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); if (info->battery) { diff --git a/src/boards/182.c b/src/boards/182.c index c4edcf2..75d0af6 100644 --- a/src/boards/182.c +++ b/src/boards/182.c @@ -23,7 +23,7 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg[4]; +static uint8_t reg[4]; static void sync () { int prgAND = reg[1] &0x20? 0x1F: 0x0F; @@ -51,8 +51,8 @@ static DECLFW (writeReg) { } static DECLFW (unscramble) { - static const uint16 lutAddress[8] = { 0xA001, 0xA000, 0x8000, 0xC000, 0x8001, 0xC001, 0xE000, 0xE001 }; /* i <5? 4-i: i */ - static const uint8 lutIndex[8] = { 0, 3, 1, 5, 6, 7, 2, 4 }; /* i <6? (i^3)-1: i */ + static const uint16_t lutAddress[8] = { 0xA001, 0xA000, 0x8000, 0xC000, 0x8001, 0xC001, 0xE000, 0xE001 }; /* i <5? 4-i: i */ + static const uint8_t lutIndex[8] = { 0, 3, 1, 5, 6, 7, 2, 4 }; /* i <6? (i^3)-1: i */ MMC3_writeReg(lutAddress[A >>12 &6 | A &1], (A &0xE001) == 0xA000? lutIndex[V &7]: V); } diff --git a/src/boards/183.c b/src/boards/183.c index ef21817..1021089 100644 --- a/src/boards/183.c +++ b/src/boards/183.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "asic_vrc2and4.h" -static uint8 prg; +static uint8_t prg; static SFORMAT stateRegs[] ={ { &prg, 1, "PRG6" }, diff --git a/src/boards/185.c b/src/boards/185.c index cfea494..fb6efaa 100644 --- a/src/boards/185.c +++ b/src/boards/185.c @@ -21,8 +21,8 @@ #include "mapinc.h" -static uint8 *DummyCHR = NULL; -static uint8 datareg; +static uint8_t *DummyCHR = NULL; +static uint8_t datareg; static void (*Sync)(void); @@ -87,7 +87,7 @@ void Mapper185_Init(CartInfo *info) { info->Power = MPower; info->Close = MClose; GameStateRestore = MRestore; - DummyCHR = (uint8*)FCEU_gmalloc(8192); + DummyCHR = (uint8_t*)FCEU_gmalloc(8192); for (x = 0; x < 8192; x++) DummyCHR[x] = 0xff; SetupCartCHRMapping(0x10, DummyCHR, 8192, 0); @@ -100,7 +100,7 @@ void Mapper181_Init(CartInfo *info) { info->Power = MPower; info->Close = MClose; GameStateRestore = MRestore; - DummyCHR = (uint8*)FCEU_gmalloc(8192); + DummyCHR = (uint8_t*)FCEU_gmalloc(8192); for (x = 0; x < 8192; x++) DummyCHR[x] = 0xff; SetupCartCHRMapping(0x10, DummyCHR, 8192, 0); diff --git a/src/boards/186.c b/src/boards/186.c index dddca91..0301611 100644 --- a/src/boards/186.c +++ b/src/boards/186.c @@ -22,9 +22,9 @@ #include "mapinc.h" -static uint8 SWRAM[3072]; -static uint8 *WRAM = NULL; -static uint8 regs[4]; +static uint8_t SWRAM[3072]; +static uint8_t *WRAM = NULL; +static uint8_t regs[4]; static SFORMAT StateRegs[] = { @@ -88,7 +88,7 @@ void Mapper186_Init(CartInfo *info) { info->Power = M186Power; info->Close = M186Close; GameStateRestore = M186Restore; - WRAM = (uint8*)FCEU_gmalloc(32768); + WRAM = (uint8_t*)FCEU_gmalloc(32768); SetupCartPRGMapping(0x10, WRAM, 32768, 1); AddExState(WRAM, 32768, 0, "WRAM"); AddExState(StateRegs, ~0, 0, 0); diff --git a/src/boards/187.c b/src/boards/187.c index 701114b..2b6d430 100644 --- a/src/boards/187.c +++ b/src/boards/187.c @@ -25,16 +25,16 @@ #include "mapinc.h" #include "mmc3.h" -static void M187CW(uint32 A, uint8 V) { +static void M187CW(uint32_t A, uint8_t V) { if ((A & 0x1000) == ((MMC3_cmd & 0x80) << 5)) setchr1(A, V | 0x100); else setchr1(A, V); } -static void M187PW(uint32 A, uint8 V) { +static void M187PW(uint32_t A, uint8_t V) { if (EXPREGS[0] & 0x80) { - uint8 bank = EXPREGS[0] & 0x1F; + uint8_t bank = EXPREGS[0] & 0x1F; if (EXPREGS[0] & 0x20) { if (EXPREGS[0] & 0x40) setprg32(0x8000, bank >> 2); @@ -65,7 +65,7 @@ static DECLFW(M187WriteLo) { } } -static uint8 prot_data[4] = { 0x83, 0x83, 0x42, 0x00 }; +static uint8_t prot_data[4] = { 0x83, 0x83, 0x42, 0x00 }; static DECLFR(M187Read) { return prot_data[EXPREGS[1] & 3]; } diff --git a/src/boards/189.c b/src/boards/189.c index c3e1671..72d9195 100644 --- a/src/boards/189.c +++ b/src/boards/189.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "mmc3.h" -static void M189PW(uint32 A, uint8 V) { +static void M189PW(uint32_t A, uint8_t V) { setprg32(0x8000, EXPREGS[0] & 7); } diff --git a/src/boards/190.c b/src/boards/190.c index 847d658..f36c651 100644 --- a/src/boards/190.c +++ b/src/boards/190.c @@ -21,8 +21,8 @@ #include "mapinc.h" -static uint8 preg, creg[4]; -static uint8 *WRAM = NULL; +static uint8_t preg, creg[4]; +static uint8_t *WRAM = NULL; static SFORMAT StateRegs[] = { @@ -82,7 +82,7 @@ static void StateRestore(int version) { void Mapper190_Init(CartInfo *info) { info->Power = M190Power; info->Close = M190Close; - WRAM = (uint8*)FCEU_gmalloc(0x2000); + WRAM = (uint8_t*)FCEU_gmalloc(0x2000); SetupCartPRGMapping(0x10, WRAM, 0x2000, 1); AddExState(WRAM, 0x2000, 0, "WRAM"); GameStateRestore = StateRestore; diff --git a/src/boards/191.c b/src/boards/191.c index c3eaf96..f809d38 100644 --- a/src/boards/191.c +++ b/src/boards/191.c @@ -24,8 +24,8 @@ #include "asic_mmc3.h" #include "cartram.h" -static uint8 submapper; -static uint8 reg; +static uint8_t submapper; +static uint8_t reg; static void sync () { int bank; @@ -39,7 +39,7 @@ static void sync () { MMC3_syncMirror(); } -static int getPRGBank (uint8 bank) { +static int getPRGBank (uint8_t bank) { if (bank &2) return MMC3_getPRGBank(bank) &~6 | reg <<1 &6; else diff --git a/src/boards/193.c b/src/boards/193.c index 26f749a..6098c87 100644 --- a/src/boards/193.c +++ b/src/boards/193.c @@ -23,8 +23,8 @@ #include "mapinc.h" -static uint8 reg[8]; -static uint8 mirror, cmd, bank; +static uint8_t reg[8]; +static uint8_t mirror, cmd, bank; static SFORMAT StateRegs[] = { diff --git a/src/boards/195.c b/src/boards/195.c index 730a6d7..23467a4 100644 --- a/src/boards/195.c +++ b/src/boards/195.c @@ -21,20 +21,20 @@ #include "mmc3.h" static writefunc writePPU; -static uint8 *CHRRAM; -static uint32 CHRRAMSIZE; -static uint8 mask; -static uint8 compare; -extern uint32 RefreshAddr; +static uint8_t *CHRRAM; +static uint32_t CHRRAMSIZE; +static uint8_t mask; +static uint8_t compare; +extern uint32_t RefreshAddr; -static void Mapper195_CHRWrap(uint32 A, uint8 V) { +static void Mapper195_CHRWrap(uint32_t A, uint8_t V) { if ((V &mask) ==compare) setchr1r(0x10, A, V); else setchr1r(0, A, V); } -static const uint8 compares[8] = { 0x28, 0x00, 0x4C, 0x64, 0x46, 0x7C, 0x04, 0xFF }; +static const uint8_t compares[8] = { 0x28, 0x00, 0x4C, 0x64, 0x46, 0x7C, 0x04, 0xFF }; static DECLFW(Mapper195_InterceptPPUWrite) { if (RefreshAddr <0x2000) { int addr =RefreshAddr; @@ -89,7 +89,7 @@ void Mapper195_Init(CartInfo *info) { info->Reset = MMC3RegReset; info->Close = Mapper195_Close; CHRRAMSIZE =4096; - CHRRAM =(uint8*)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM =(uint8_t*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR"); AddExState(&mask, 1, 0, "EXP0"); diff --git a/src/boards/199.c b/src/boards/199.c index 16beb17..c2bc318 100644 --- a/src/boards/199.c +++ b/src/boards/199.c @@ -20,7 +20,7 @@ #include "mapinc.h" #include "mmc3.h" -static void Mapper199_CHRWrap(uint32 A, uint8 V) { +static void Mapper199_CHRWrap(uint32_t A, uint8_t V) { setchr8(0); /* Unbanked CHR RAM */ } diff --git a/src/boards/206_486.c b/src/boards/206_486.c index 8342d90..01f3e7c 100644 --- a/src/boards/206_486.c +++ b/src/boards/206_486.c @@ -20,8 +20,8 @@ #include "mapinc.h" -static uint8 cmd; -static uint8 DRegs[8]; +static uint8_t cmd; +static uint8_t DRegs[8]; static SFORMAT StateRegs[] = { diff --git a/src/boards/208.c b/src/boards/208.c index af03010..0040a0f 100644 --- a/src/boards/208.c +++ b/src/boards/208.c @@ -27,9 +27,9 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 submapper; +static uint8_t submapper; -static const uint8 lut[256] = { +static const uint8_t lut[256] = { 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x49, 0x19, 0x09, 0x59, 0x49, 0x19, 0x09, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x51, 0x41, 0x11, 0x01, 0x51, 0x41, 0x11, 0x01, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x49, 0x19, 0x09, 0x59, 0x49, 0x19, 0x09, @@ -48,14 +48,14 @@ static const uint8 lut[256] = { 0x09, 0x19, 0x49, 0x59, 0x09, 0x19, 0x49, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static void M208PW(uint32 A, uint8 V) { +static void M208PW(uint32_t A, uint8_t V) { if (submapper == 1) setprg32(0x8000, DRegBuf[6] >> 2); else setprg32(0x8000, (EXPREGS[5] & 0x1) | ((EXPREGS[5] >> 3) & 0x2)); } -static void M208MW(uint8 V) { +static void M208MW(uint8_t V) { if (submapper == 1) setmirror((V & 1) ^ 1); else diff --git a/src/boards/21_22_23_25.c b/src/boards/21_22_23_25.c index ea66dc9..dc7397a 100644 --- a/src/boards/21_22_23_25.c +++ b/src/boards/21_22_23_25.c @@ -39,7 +39,7 @@ void Mapper21_Init (CartInfo *info) { WRAM_init(info, 8); } -static int Mapper22_getCHRBank(uint8 bank) { +static int Mapper22_getCHRBank(uint8_t bank) { return VRC24_getCHRBank(bank &7) >>1; } diff --git a/src/boards/222.c b/src/boards/222.c index 38b8554..40db377 100644 --- a/src/boards/222.c +++ b/src/boards/222.c @@ -21,11 +21,11 @@ #include "mapinc.h" #include "asic_vrc2and4.h" -static uint8 clockMode; -static uint8 pending; -static uint8 counter1; -static uint8 counter2; -static uint8 prescaler; +static uint8_t clockMode; +static uint8_t pending; +static uint8_t counter1; +static uint8_t counter2; +static uint8_t prescaler; static SFORMAT stateRegs[] = { { &clockMode, 1, "CLKM" }, @@ -66,7 +66,7 @@ static DECLFW (writeIRQ) { static void FP_FASTAPASS(1) cpuCycle (int a) { while (a--) { - uint8 previousPrescaler = prescaler; + uint8_t previousPrescaler = prescaler; if (pending) prescaler = 0; else diff --git a/src/boards/225.c b/src/boards/225.c index ae384ed..0e80973 100644 --- a/src/boards/225.c +++ b/src/boards/225.c @@ -30,8 +30,8 @@ #include "mapinc.h" -static uint8 extraRAM[4], prg, mode, chr, mirr; -static uint8 is255; +static uint8_t extraRAM[4], prg, mode, chr, mirr; +static uint8_t is255; static SFORMAT StateRegs[] = { @@ -54,7 +54,7 @@ static void Sync(void) { } static DECLFW(M225Write) { - uint8 bank = (A >> 14) & 1; + uint8_t bank = (A >> 14) & 1; mirr = (A >> 13) & 1; mode = (A >> 12) & 1; if (is255) diff --git a/src/boards/228.c b/src/boards/228.c index 81201a0..c465695 100644 --- a/src/boards/228.c +++ b/src/boards/228.c @@ -20,8 +20,8 @@ #include "mapinc.h" -static uint8 mram[4], vreg; -static uint16 areg; +static uint8_t mram[4], vreg; +static uint16_t areg; static SFORMAT StateRegs[] = { @@ -32,7 +32,7 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { - uint32 prgl, prgh, page = (areg >> 7) & 0x3F; + uint32_t prgl, prgh, page = (areg >> 7) & 0x3F; if ((page & 0x30) == 0x30) page -= 0x10; prgl = prgh = (page << 1) + (((areg >> 6) & 1) & ((areg >> 5) & 1)); diff --git a/src/boards/230.c b/src/boards/230.c index 89e235b..339f5f0 100644 --- a/src/boards/230.c +++ b/src/boards/230.c @@ -24,7 +24,7 @@ #include "mapinc.h" -static uint8 latche, reset; +static uint8_t latche, reset; static SFORMAT StateRegs[] = { { &reset, 1, "RST" }, @@ -38,7 +38,7 @@ static void Sync(void) { setprg16(0xC000, 7); setmirror(MI_V); } else { - uint32 bank = (latche & 0x1F) + 8; + uint32_t bank = (latche & 0x1F) + 8; if (latche & 0x20) { setprg16(0x8000, bank); setprg16(0xC000, bank); diff --git a/src/boards/232.c b/src/boards/232.c index ec1dbba..9792157 100644 --- a/src/boards/232.c +++ b/src/boards/232.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 bank, preg; +static uint8_t bank, preg; static SFORMAT StateRegs[] = { { &bank, 1, "BANK" }, @@ -29,8 +29,8 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { -/* uint32 bbank = (bank & 0x18) >> 1; */ - uint32 bbank = ((bank & 0x10) >> 2) | (bank & 8); /* some dumps have bbanks swapped, if swap commands, +/* uint32_t bbank = (bank & 0x18) >> 1; */ + uint32_t bbank = ((bank & 0x10) >> 2) | (bank & 8); /* some dumps have bbanks swapped, if swap commands, * then all roms can be played, but with some swapped * games in menu. if not, some dumps are unplayable * make hard dump for both cart types to check diff --git a/src/boards/233.c b/src/boards/233.c index e441772..e925369 100644 --- a/src/boards/233.c +++ b/src/boards/233.c @@ -27,8 +27,8 @@ #include "mapinc.h" -static uint8 latche; -static uint8 reset; +static uint8_t latche; +static uint8_t reset; static SFORMAT StateRegs[] = { @@ -38,7 +38,7 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { - uint8 bank = (latche & 0x1f) | (reset << 5); + uint8_t bank = (latche & 0x1f) | (reset << 5); if (!(latche & 0x20)) setprg32(0x8000, bank >> 1); diff --git a/src/boards/234.c b/src/boards/234.c index 2037c53..751a819 100644 --- a/src/boards/234.c +++ b/src/boards/234.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 bank, preg; +static uint8_t bank, preg; static SFORMAT StateRegs[] = { { &bank, 1, "BANK" }, @@ -40,7 +40,7 @@ static void Sync(void) { } DECLFR(M234ReadBank) { - uint8 r = CartBR(A); + uint8_t r = CartBR(A); if (!bank) { bank = r; Sync(); @@ -49,7 +49,7 @@ DECLFR(M234ReadBank) { } DECLFR(M234ReadPreg) { - uint8 r = CartBR(A); + uint8_t r = CartBR(A); preg = r; Sync(); return r; diff --git a/src/boards/235.c b/src/boards/235.c index c26d451..3140a6a 100644 --- a/src/boards/235.c +++ b/src/boards/235.c @@ -21,10 +21,10 @@ #include "mapinc.h" -static uint16 cmdreg; -static uint8 unrom, reg, openbus; +static uint16_t cmdreg; +static uint8_t unrom, reg, openbus; -static uint32 PRGROMSize; +static uint32_t PRGROMSize; static SFORMAT StateRegs[] = { @@ -37,13 +37,13 @@ static SFORMAT StateRegs[] = static void Sync(void) { if (unrom) { - uint8 PRGPageSize = PRGROMSize / 16384; + uint8_t PRGPageSize = PRGROMSize / 16384; setprg16(0x8000, (PRGPageSize & 0xC0) | (reg & 7)); setprg16(0xC000, (PRGPageSize & 0xC0) | 7); setchr8(0); setmirror(MI_V); } else { - uint8 bank = ((cmdreg & 0x300) >> 3) | (cmdreg & 0x1F); + uint8_t bank = ((cmdreg & 0x300) >> 3) | (cmdreg & 0x1F); if (cmdreg & 0x400) setmirror(MI_0); else diff --git a/src/boards/236.c b/src/boards/236.c index 463e988..395d87b 100644 --- a/src/boards/236.c +++ b/src/boards/236.c @@ -20,9 +20,9 @@ #include "mapinc.h" -static uint8 reg[2]; -static uint8 dip; -static uint8 chrramvariant; +static uint8_t reg[2]; +static uint8_t dip; +static uint8_t chrramvariant; static SFORMAT StateRegs[] = { { reg, 2, "REG " }, diff --git a/src/boards/237.c b/src/boards/237.c index 00c9a6c..bb30eb2 100644 --- a/src/boards/237.c +++ b/src/boards/237.c @@ -28,8 +28,8 @@ #include "mapinc.h" -static uint8 reg[2]; -static uint8 dipswitch; +static uint8_t reg[2]; +static uint8_t dipswitch; static SFORMAT StateRegs[] = { @@ -40,9 +40,9 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { - uint8 bank = (reg[1] & 0x07); - uint8 base = (reg[1] & 0x18) | ((reg[0] & 0x04) << 3); - uint8 mode = (reg[1] & 0xC0) >> 6; + uint8_t bank = (reg[1] & 0x07); + uint8_t base = (reg[1] & 0x18) | ((reg[0] & 0x04) << 3); + uint8_t mode = (reg[1] & 0xC0) >> 6; setchr8(0); setprg16(0x8000, base | (bank & ~(mode & 1))); diff --git a/src/boards/244.c b/src/boards/244.c index f5d696e..8c5ef4b 100644 --- a/src/boards/244.c +++ b/src/boards/244.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 preg, creg; +static uint8_t preg, creg; static SFORMAT StateRegs[] = { { &preg, 1, "PREG" }, @@ -28,14 +28,14 @@ static SFORMAT StateRegs[] = { 0 } }; -static uint8 prg_perm[4][4] = { +static uint8_t prg_perm[4][4] = { { 0, 1, 2, 3, }, { 3, 2, 1, 0, }, { 0, 2, 1, 3, }, { 3, 1, 2, 0, }, }; -static uint8 chr_perm[8][8] = { +static uint8_t chr_perm[8][8] = { { 0, 1, 2, 3, 4, 5, 6, 7, }, { 0, 2, 1, 3, 4, 6, 5, 7, }, { 0, 1, 4, 5, 2, 3, 6, 7, }, diff --git a/src/boards/246.c b/src/boards/246.c index 8193f6c..419ad20 100644 --- a/src/boards/246.c +++ b/src/boards/246.c @@ -20,9 +20,9 @@ #include "mapinc.h" -static uint8 regs[8]; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t regs[8]; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -73,7 +73,7 @@ void Mapper246_Init(CartInfo *info) { GameStateRestore = StateRestore; WRAMSIZE = 2048; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); diff --git a/src/boards/252_253.c b/src/boards/252_253.c index 61e7116..b9b900f 100644 --- a/src/boards/252_253.c +++ b/src/boards/252_253.c @@ -22,10 +22,10 @@ #include "asic_vrc2and4.h" #include "cartram.h" -static uint8 mask; -static uint8 compare; +static uint8_t mask; +static uint8_t compare; -extern uint32 RefreshAddr; +extern uint32_t RefreshAddr; static writefunc writePPU; static SFORMAT stateRegs[] = { diff --git a/src/boards/265.c b/src/boards/265.c index 0665c48..fb8aa03 100644 --- a/src/boards/265.c +++ b/src/boards/265.c @@ -25,7 +25,7 @@ #include "latch.h" static void Sync(void) { - uint8 bank = ((latch.addr >> 3) & 0x60) | ((latch.addr >> 2) & 0x18) | (latch.data & 0x07); + uint8_t bank = ((latch.addr >> 3) & 0x60) | ((latch.addr >> 2) & 0x18) | (latch.data & 0x07); if (latch.addr & 0x80) { if (!bank) { diff --git a/src/boards/266.c b/src/boards/266.c index cc59614..303aa47 100644 --- a/src/boards/266.c +++ b/src/boards/266.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "asic_vrc2and4.h" -static uint8 prg; +static uint8_t prg; static SFORMAT stateRegs[] ={ { &prg, 1, "PRG8" }, diff --git a/src/boards/267.c b/src/boards/267.c index 1f34529..3a20cf8 100644 --- a/src/boards/267.c +++ b/src/boards/267.c @@ -25,11 +25,11 @@ #define OUTER_BANK (((EXPREGS[0] & 0x20) >> 2) | (EXPREGS[0] & 0x06)) -static void M267CW(uint32 A, uint8 V) { +static void M267CW(uint32_t A, uint8_t V) { setchr1(A, (V & 0x7F) | (OUTER_BANK << 6)); } -static void M267PW(uint32 A, uint8 V) { +static void M267PW(uint32_t A, uint8_t V) { setprg8(A, (V & 0x1F) | (OUTER_BANK << 4)); } diff --git a/src/boards/268.c b/src/boards/268.c index 6723474..d7f841b 100644 --- a/src/boards/268.c +++ b/src/boards/268.c @@ -20,10 +20,10 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 *CHRRAM =NULL; -static uint8 submapper; +static uint8_t *CHRRAM =NULL; +static uint8_t submapper; -static void Mapper268_PRGWrap(uint32 A, uint8 V) { +static void Mapper268_PRGWrap(uint32_t A, uint8_t V) { int prgMaskMMC3, prgMaskGNROM, prgOffset; prgMaskMMC3 =(EXPREGS[3] &0x10? 0x00: 0x0F) /* PRG A13-A16 */ @@ -83,7 +83,7 @@ static void Mapper268_PRGWrap(uint32 A, uint8 V) { SetupCartCHRMapping(0, CHRptr[0], CHRsize[0], (submapper &~1) ==8 && EXPREGS[0] &0x10? 0: 1); } -static void Mapper268_CHRWrap(uint32 A, uint8 V) { +static void Mapper268_CHRWrap(uint32_t A, uint8_t V) { int chrMaskMMC3, chrMaskGNROM, chrOffset; chrMaskMMC3 =EXPREGS[3] &0x10? 0x00: EXPREGS[0] &0x80? 0x7F: 0xFF; @@ -94,7 +94,7 @@ static void Mapper268_CHRWrap(uint32 A, uint8 V) { setchr1r(CHRRAM && EXPREGS[4] &0x01 && (V &0xFE) ==(EXPREGS[4] &0xFE)? 0x10: 0x00, A, V &chrMaskMMC3 | chrOffset | A >>10 &chrMaskGNROM); } -void Mapper268_MirrorWrap(uint8 V) { +void Mapper268_MirrorWrap(uint8_t V) { A000B =V; if ((submapper &~1) ==10 && ~EXPREGS[0] &0x20) setmirror(EXPREGS[0] &0x10? MI_1: MI_0); @@ -169,7 +169,7 @@ void Mapper268_Init(CartInfo *info) { AddExState(EXPREGS, 8, 0, "EXPR"); if (info->CHRRomSize && info->CHRRamSize + info->CHRRamSaveSize) { - CHRRAM =(uint8 *)FCEU_gmalloc(info->CHRRamSize + info->CHRRamSaveSize); + CHRRAM =(uint8_t *)FCEU_gmalloc(info->CHRRamSize + info->CHRRamSaveSize); SetupCartCHRMapping(0x10, CHRRAM, info->CHRRamSize + info->CHRRamSaveSize, 1); AddExState(CHRRAM, info->CHRRamSize + info->CHRRamSaveSize, 0, "CRAM"); } diff --git a/src/boards/269.c b/src/boards/269.c index 9985888..b915cf8 100644 --- a/src/boards/269.c +++ b/src/boards/269.c @@ -27,19 +27,19 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 *CHRROM; -static uint32 CHRROMSIZE; +static uint8_t *CHRROM; +static uint32_t CHRROMSIZE; -static void M269CW(uint32 A, uint8 V) { - uint16 NV = V; +static void M269CW(uint32_t A, uint8_t V) { + uint16_t NV = V; if (EXPREGS[2] & 8) NV &= (1 << ((EXPREGS[2] & 7) + 1)) - 1; NV |= EXPREGS[0] | ((EXPREGS[2] & 0xF0) << 4); setchr1(A, NV); } -static void M269PW(uint32 A, uint8 V) { - uint16 MV = V & ((EXPREGS[3] & 0x3F) ^ 0x3F); +static void M269PW(uint32_t A, uint8_t V) { + uint16_t MV = V & ((EXPREGS[3] & 0x3F) ^ 0x3F); MV |= EXPREGS[1]; MV |= ((EXPREGS[3] & 0x40) << 2); setprg8(A, MV); @@ -74,13 +74,13 @@ static void M269Power(void) { SetWriteHandler(0x5000, 0x5FFF, M269Write5); } -static uint8 unscrambleCHR(uint8 data) { +static uint8_t unscrambleCHR(uint8_t data) { return ((data & 0x01) << 6) | ((data & 0x02) << 3) | ((data & 0x04) << 0) | ((data & 0x08) >> 3) | ((data & 0x10) >> 3) | ((data & 0x20) >> 2) | ((data & 0x40) >> 1) | ((data & 0x80) << 0); } void Mapper269_Init(CartInfo *info) { - uint32 i; + uint32_t i; GenMMC3_Init(info, 512, 0, 8, 0); cwrap = M269CW; pwrap = M269PW; @@ -90,7 +90,7 @@ void Mapper269_Init(CartInfo *info) { AddExState(EXPREGS, 5, 0, "EXPR"); CHRROMSIZE = PRGsize[0]; - CHRROM = (uint8*)FCEU_gmalloc(CHRROMSIZE); + CHRROM = (uint8_t*)FCEU_gmalloc(CHRROMSIZE); /* unscramble CHR data from PRG */ for (i = 0; i < CHRROMSIZE; i++) CHRROM[i] = unscrambleCHR(PRGptr[0][i]); diff --git a/src/boards/272.c b/src/boards/272.c index 3e91c1e..3668097 100644 --- a/src/boards/272.c +++ b/src/boards/272.c @@ -27,13 +27,13 @@ #include "mapinc.h" -static uint8 prg[2]; -static uint8 chr[8]; -static uint8 mirr; -static uint8 pal_mirr; -static uint8 last_pa13; -static uint8 IRQCount; -static uint8 IRQa; +static uint8_t prg[2]; +static uint8_t chr[8]; +static uint8_t mirr; +static uint8_t pal_mirr; +static uint8_t last_pa13; +static uint8_t IRQCount; +static uint8_t IRQa; static SFORMAT StateRegs[] = { @@ -51,13 +51,13 @@ static SFORMAT StateRegs[] = #define shi(exp, bit, pos) \ ((((exp) & (1 << (bit))) >> (bit)) << (pos)) -static uint32 vrc_addr_mix(uint32 A) { +static uint32_t vrc_addr_mix(uint32_t A) { /* this game wires A0 to VRC_A0 and A1 to VRC_A1 */ return (A & 0xf000) | shi(A, 0, 0) | shi(A, 1, 1); } static void Sync(void) { - uint8 i; + uint8_t i; setprg8(0x8000, prg[0]); setprg8(0xa000, prg[1]); setprg16(0xc000, -1); @@ -141,8 +141,8 @@ static void M272Power(void) { SetReadHandler(0x8000, 0xFFFF, CartBR); } -static void M272Hook(uint32 A) { - uint8 pa13 = (A >> 13) & 1; +static void M272Hook(uint32_t A) { + uint8_t pa13 = (A >> 13) & 1; if ((last_pa13 == 1) && (pa13 == 0)) { if (IRQa) { IRQCount++; diff --git a/src/boards/273.c b/src/boards/273.c index 23df59a..01d6e00 100644 --- a/src/boards/273.c +++ b/src/boards/273.c @@ -21,10 +21,10 @@ #include "mapinc.h" #include "asic_vrc2and4.h" -static uint8 irqEnabled; -static uint8 irqCounter; -static uint8 irqPrescaler; -static uint8 irqMask; +static uint8_t irqEnabled; +static uint8_t irqCounter; +static uint8_t irqPrescaler; +static uint8_t irqMask; static SFORMAT stateRegs[] ={ { &irqEnabled, 1, "IRQE" }, diff --git a/src/boards/277.c b/src/boards/277.c index e37a5d8..3472f6f 100644 --- a/src/boards/277.c +++ b/src/boards/277.c @@ -22,7 +22,7 @@ #include "mapinc.h" #include "latch.h" -static uint8 inesMirroring; +static uint8_t inesMirroring; static void Sync(void) { if (!(latch.data & 1) && (latch.data & 8)) { diff --git a/src/boards/28.c b/src/boards/28.c index 0daf2f3..cc526ad 100644 --- a/src/boards/28.c +++ b/src/boards/28.c @@ -24,8 +24,8 @@ #include "mapinc.h" -static uint8 prg_mask_16k; -static uint8 reg, chr, prg, mode, outer; +static uint8_t prg_mask_16k; +static uint8_t reg, chr, prg, mode, outer; static SFORMAT StateRegs[] = { {®, 1, "REG"}, @@ -45,7 +45,7 @@ void SyncMirror() { } } -void Mirror(uint8 value) +void Mirror(uint8_t value) { if ((mode & 2) == 0) { mode &= 0xfe; @@ -56,10 +56,10 @@ void Mirror(uint8 value) static void Sync() { - uint8 prglo = 0; - uint8 prghi = 0; + uint8_t prglo = 0; + uint8_t prghi = 0; - uint8 outb = outer << 1; + uint8_t outb = outer << 1; /* this can probably be rolled up, but i have no motivation to do so * until it's been tested */ diff --git a/src/boards/280.c b/src/boards/280.c index d1eefc9..f97a0d2 100644 --- a/src/boards/280.c +++ b/src/boards/280.c @@ -20,10 +20,10 @@ #include "mapinc.h" -static uint16 latchAddr; -static uint8 latchData; -static uint8 mode; -static uint8 submapper; +static uint16_t latchAddr; +static uint8_t latchData; +static uint8_t mode; +static uint8_t submapper; static SFORMAT StateRegs[] = { { &latchAddr, 2 | FCEUSTATE_RLSB, "LATC" }, diff --git a/src/boards/283.c b/src/boards/283.c index 7d9eaef..d4b2e32 100644 --- a/src/boards/283.c +++ b/src/boards/283.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 reg, mirr; +static uint8_t reg, mirr; static SFORMAT StateRegs[] = { { ®, 1, "REGS" }, diff --git a/src/boards/285.c b/src/boards/285.c index 2b1c72a..3c42605 100644 --- a/src/boards/285.c +++ b/src/boards/285.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "asic_latch.h" -static uint8 pad; +static uint8_t pad; static void sync_submapper0 () { if (Latch_data &0x40) diff --git a/src/boards/291.c b/src/boards/291.c index aacce1a..bdd7e67 100644 --- a/src/boards/291.c +++ b/src/boards/291.c @@ -21,11 +21,11 @@ #include "mapinc.h" #include "mmc3.h" -static void M291CW(uint32 A, uint8 V) { +static void M291CW(uint32_t A, uint8_t V) { setchr1(A, V | ((EXPREGS[0] << 2) & 0x100)); } -static void M291PW(uint32 A, uint8 V) { +static void M291PW(uint32_t A, uint8_t V) { if (EXPREGS[0] & 0x20) setprg32(0x8000, ((EXPREGS[0] >> 1) & 3) | ((EXPREGS[0] >> 4) & 4)); else diff --git a/src/boards/293.c b/src/boards/293.c index e9f7a12..3c5bb7a 100644 --- a/src/boards/293.c +++ b/src/boards/293.c @@ -22,7 +22,7 @@ #include "mapinc.h" -static uint8 regs[2]; +static uint8_t regs[2]; static SFORMAT StateRegs[] = { { regs, 2, "REGS" }, @@ -30,9 +30,9 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { - uint8 mode = ((regs[0] >> 2) & 2) | ((regs[1] >> 6) & 1); - uint8 bank = ((regs[1] << 5) & 0x20) | ((regs[1] >> 1) & 0x18); - uint8 block = (regs[0] & 7); + uint8_t mode = ((regs[0] >> 2) & 2) | ((regs[1] >> 6) & 1); + uint8_t bank = ((regs[1] << 5) & 0x20) | ((regs[1] >> 1) & 0x18); + uint8_t block = (regs[0] & 7); switch (mode) { case 0: /* UNROM */ setprg16(0x8000, bank | block); diff --git a/src/boards/294.c b/src/boards/294.c index db4956c..b4cad3d 100644 --- a/src/boards/294.c +++ b/src/boards/294.c @@ -21,7 +21,7 @@ #include "mapinc.h" -static uint8 latch; +static uint8_t latch; static void Mapper294_sync (void) { setprg16(0x8000, latch); diff --git a/src/boards/301.c b/src/boards/301.c index 4e73d23..ee5f671 100644 --- a/src/boards/301.c +++ b/src/boards/301.c @@ -21,8 +21,8 @@ #include "mapinc.h" #include "asic_latch.h" -static uint8 half; -static uint8 reg; +static uint8_t half; +static uint8_t reg; static void sync () { setprg16(0x8000, half <<5 &0x20 | reg <<3 &0x18 | Latch_data &0x07); diff --git a/src/boards/308.c b/src/boards/308.c index 1e15832..32473dc 100644 --- a/src/boards/308.c +++ b/src/boards/308.c @@ -21,9 +21,9 @@ #include "mapinc.h" #include "asic_vrc2and4.h" -static uint8 irqEnabled; -static uint16 irqCounterLow; -static uint8 irqCounterHigh; +static uint8_t irqEnabled; +static uint16_t irqCounterLow; +static uint8_t irqCounterHigh; static SFORMAT stateRegs[] ={ { &irqEnabled, 1, "IRQE" }, diff --git a/src/boards/31.c b/src/boards/31.c index 17777ab..80f7b49 100644 --- a/src/boards/31.c +++ b/src/boards/31.c @@ -23,7 +23,7 @@ #include "mapinc.h" -static uint8 preg[8]; +static uint8_t preg[8]; static SFORMAT StateRegs[] = { diff --git a/src/boards/310.c b/src/boards/310.c index 929af1b..4dbf7a1 100644 --- a/src/boards/310.c +++ b/src/boards/310.c @@ -21,8 +21,8 @@ #include "mapinc.h" -static uint8 regData[2]; -static uint8 regAddr; +static uint8_t regData[2]; +static uint8_t regAddr; static SFORMAT K1053_state[] = { diff --git a/src/boards/319.c b/src/boards/319.c index d7288b6..1f28553 100644 --- a/src/boards/319.c +++ b/src/boards/319.c @@ -21,9 +21,9 @@ #include "mapinc.h" -static uint8 reg[2]; -static uint8 latch; -static uint8 pad; +static uint8_t reg[2]; +static uint8_t latch; +static uint8_t pad; static SFORMAT StateRegs[] = { diff --git a/src/boards/32.c b/src/boards/32.c index 165f645..1405711 100644 --- a/src/boards/32.c +++ b/src/boards/32.c @@ -20,10 +20,10 @@ #include "mapinc.h" -static uint8 preg[2], creg[8], mirr; +static uint8_t preg[2], creg[8], mirr; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -34,8 +34,8 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { - uint8 i; - uint16 swap = ((mirr & 2) << 13); + uint8_t i; + uint16_t swap = ((mirr & 2) << 13); setmirror((mirr & 1) ^ 1); setprg8r(0x10, 0x6000, 0); setprg8(0x8000 ^ swap, preg[0]); @@ -94,7 +94,7 @@ void Mapper32_Init(CartInfo *info) { GameStateRestore = StateRestore; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); diff --git a/src/boards/321.c b/src/boards/321.c index 8b5f0a0..8047413 100644 --- a/src/boards/321.c +++ b/src/boards/321.c @@ -23,7 +23,7 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg; +static uint8_t reg; static void sync () { if (reg &0x08) diff --git a/src/boards/326.c b/src/boards/326.c index a29fced..b461186 100644 --- a/src/boards/326.c +++ b/src/boards/326.c @@ -24,7 +24,7 @@ #include "mapinc.h" -static uint8 PRG[3], CHR[8], NTAPage[4]; +static uint8_t PRG[3], CHR[8], NTAPage[4]; static SFORMAT StateRegs[] = { @@ -41,7 +41,7 @@ static void SyncPRG(void) { setprg8(0xE000, ~0); } -static void DoCHR(int x, uint8 V) { +static void DoCHR(int x, uint8_t V) { CHR[x] = V; setchr1(x << 10, V); } @@ -52,7 +52,7 @@ static void FixCHR(void) { DoCHR(x, CHR[x]); } -static void FASTAPASS(2) DoNTARAM(int w, uint8 V) { +static void FASTAPASS(2) DoNTARAM(int w, uint8_t V) { NTAPage[w] = V; setntamem(NTARAM + ((V & 1) << 10), 1, w); } diff --git a/src/boards/33.c b/src/boards/33.c index 6f200c9..bb155ed 100644 --- a/src/boards/33.c +++ b/src/boards/33.c @@ -20,10 +20,10 @@ #include "mapinc.h" -static uint8 is48; -static uint8 regs[8], mirr; -static uint8 IRQa; -static int16 IRQCount, IRQLatch; +static uint8_t is48; +static uint8_t regs[8], mirr; +static uint8_t IRQa; +static int16_t IRQCount, IRQLatch; static SFORMAT StateRegs[] = { diff --git a/src/boards/330.c b/src/boards/330.c index b2ab32b..0d18ef9 100644 --- a/src/boards/330.c +++ b/src/boards/330.c @@ -24,11 +24,11 @@ #include "mapinc.h" -static uint8 *WRAM; +static uint8_t *WRAM; -static uint8 PRG[3], CHR[8], NTAPage[4]; -static uint8 IRQa; -static uint16 IRQCount; +static uint8_t PRG[3], CHR[8], NTAPage[4]; +static uint8_t IRQa; +static uint16_t IRQCount; static SFORMAT StateRegs[] = { @@ -47,7 +47,7 @@ static void SyncPRG(void) { setprg8(0xE000, ~0); } -static void DoCHR(int x, uint8 V) { +static void DoCHR(int x, uint8_t V) { CHR[x] = V; setchr1(x << 10, V); } @@ -58,7 +58,7 @@ static void FixCHR(void) { DoCHR(x, CHR[x]); } -static void FASTAPASS(2) DoNTARAM(int w, uint8 V) { +static void FASTAPASS(2) DoNTARAM(int w, uint8_t V) { NTAPage[w] = V; setntamem(NTARAM + ((V & 1) << 10), 1, w); } @@ -139,7 +139,7 @@ void Mapper330_Init(CartInfo *info) { MapIRQHook = M330IRQHook; GameStateRestore = StateRestore; AddExState(&StateRegs, ~0, 0, 0); - WRAM = (uint8 *)FCEU_gmalloc(8192); + WRAM = (uint8_t *)FCEU_gmalloc(8192); SetupCartPRGMapping(0x10, WRAM, 8192, 1); AddExState(WRAM, 8192, 0, "WRAM"); } diff --git a/src/boards/334.c b/src/boards/334.c index a4dfc27..2b0cb93 100644 --- a/src/boards/334.c +++ b/src/boards/334.c @@ -23,9 +23,9 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 dipswitch; +static uint8_t dipswitch; -static void M334PW(uint32 A, uint8 V) { +static void M334PW(uint32_t A, uint8_t V) { setprg32(0x8000, EXPREGS[0] >> 1); } diff --git a/src/boards/34.c b/src/boards/34.c index a340697..0138359 100644 --- a/src/boards/34.c +++ b/src/boards/34.c @@ -29,9 +29,9 @@ #include "mapinc.h" -static uint8 regs[3]; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t regs[3]; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -85,7 +85,7 @@ void Mapper34_Init(CartInfo *info) { GameStateRestore = StateRestore; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); diff --git a/src/boards/340.c b/src/boards/340.c index 4ca2787..504972b 100644 --- a/src/boards/340.c +++ b/src/boards/340.c @@ -25,7 +25,7 @@ Submapper 1 - K-3055 PCB: H mirroring via A2 in NROM mode, and via A3=0,A4=1 in UNROM mode (used by Thundercade). */ -static uint8 submapper; +static uint8_t submapper; static void sync () { int prg = Latch_address >>2 &0x20 | Latch_address &0x1F; if (Latch_address &0x20) { /* NROM mode */ diff --git a/src/boards/341.c b/src/boards/341.c index 415a538..b95c33a 100644 --- a/src/boards/341.c +++ b/src/boards/341.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "asic_latch.h" -static uint8 submapper; +static uint8_t submapper; static void sync () { setprg32(0x8000, Latch_address >>8); @@ -29,7 +29,7 @@ static void sync () { setmirror(Latch_address &(submapper == 1? 0x800: 0x200)? MI_H: MI_V); } -static void trapLatchWrite (uint16 *newAddress, uint8 *newValue, uint8 romValue) { +static void trapLatchWrite (uint16_t *newAddress, uint8_t *newValue, uint8_t romValue) { if (!((*newAddress &0xF0) == 0xA0)) *newAddress = Latch_address; /* Update address only if new A7..A4 = $A */ } diff --git a/src/boards/343.c b/src/boards/343.c index 50ec372..f055d6c 100644 --- a/src/boards/343.c +++ b/src/boards/343.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "asic_latch.h" -static uint8 reg; +static uint8_t reg; static void sync () { setprg32(0x8000, Latch_data); diff --git a/src/boards/351.c b/src/boards/351.c index 24de00d..05c68c0 100644 --- a/src/boards/351.c +++ b/src/boards/351.c @@ -23,9 +23,9 @@ #include "asic_mmc3.h" #include "asic_vrc2and4.h" -static uint8 reg[4], dip; -static uint8 *CHRRAM = NULL; -static uint8 *PRGCHR = NULL; +static uint8_t reg[4], dip; +static uint8_t *CHRRAM = NULL; +static uint8_t *PRGCHR = NULL; static int prgMask_CHRROM; /* PRG-ROM bank mask when CHR-ROM is active (outside of PRG address space */ static int prgMask_CHRRAM; /* PRG-ROM bank mask when CHR-RAM is active (CHR-ROM becomes part of PRG address space) */ @@ -90,7 +90,7 @@ DECLFW (VRC24_trapWriteReg) { /* When A11 is set, VRC4's A0 and A1 are swapped * VRC24_writeReg(A, V); } -static void applyMode (uint8 clear) { +static void applyMode (uint8_t clear) { PPU_hook = NULL; MapIRQHook = NULL; GameHBIRQHook = NULL; @@ -162,12 +162,12 @@ void Mapper351_Init (CartInfo *info) { /* When CHR-RAM is enabled, CHR-ROM becomes part of PRG-ROM address space. */ prgMask_CHRROM = prgMask_CHRRAM = PRGsize[0] /8192 -1; if (CHRRAMSIZE) { - uint8* newROM; - CHRRAM = (uint8 *)FCEU_gmalloc(CHRRAMSIZE); + uint8_t* newROM; + CHRRAM = (uint8_t *)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM"); prgMask_CHRRAM = (PRGsize[0] +CHRsize[0]) /8192 -1; - newROM = (uint8*)FCEU_gmalloc(PRGsize[0] +CHRsize[0]); + newROM = (uint8_t*)FCEU_gmalloc(PRGsize[0] +CHRsize[0]); memcpy(newROM, ROM, info->PRGRomSize); memcpy(newROM +PRGsize[0], VROM, info->CHRRomSize); FCEU_gfree(ROM); diff --git a/src/boards/352.c b/src/boards/352.c index 10c6986..916f96a 100644 --- a/src/boards/352.c +++ b/src/boards/352.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 game; +static uint8_t game; static void sync () { setprg32(0x8000, game); diff --git a/src/boards/353.c b/src/boards/353.c index 36126f5..d6df161 100644 --- a/src/boards/353.c +++ b/src/boards/353.c @@ -27,12 +27,12 @@ #include "mmc3.h" #include "../fds_apu.h" -static uint8* CHRRAM = NULL; -static uint32 CHRRAMSIZE; -static uint8 PPUCHRBus; -static uint8 MIR[8]; +static uint8_t* CHRRAM = NULL; +static uint32_t CHRRAMSIZE; +static uint8_t PPUCHRBus; +static uint8_t MIR[8]; -static void M353PPU(uint32 A) { +static void M353PPU(uint32_t A) { A &= 0x1FFF; A >>= 10; PPUCHRBus = A; @@ -40,8 +40,8 @@ static void M353PPU(uint32 A) { setmirror(MI_0 + MIR[A]); } -static void M353PW(uint32 A, uint8 V) { - uint8 bank = V; +static void M353PW(uint32_t A, uint8_t V) { + uint8_t bank = V; if (EXPREGS[0] == 2) { bank &= 0x0F; @@ -64,7 +64,7 @@ static void M353PW(uint32 A, uint8 V) { setprg8(A, bank); } -static void M353CW(uint32 A, uint8 V) { +static void M353CW(uint32_t A, uint8_t V) { if ((EXPREGS[0] == 2) && (DRegBuf[0] & 0x80)) setchr8r(0x10, 0); else @@ -75,7 +75,7 @@ static void M353CW(uint32 A, uint8 V) { setmirror(MI_0 + (V >> 7)); } -static void M353MW(uint8 V) { +static void M353MW(uint8_t V) { if (EXPREGS[0] != 0) { A000B = V; setmirror((V & 1) ^ 1); @@ -128,7 +128,7 @@ void Mapper353_Init(CartInfo* info) { AddExState(EXPREGS, 1, 0, "EXPR"); CHRRAMSIZE = 8192; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM = (uint8_t*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR"); } diff --git a/src/boards/354.c b/src/boards/354.c index b8bda59..2949f65 100644 --- a/src/boards/354.c +++ b/src/boards/354.c @@ -20,9 +20,9 @@ #include "mapinc.h" -static uint16 latchAddr; -static uint8 latchData; -static uint8 submapper; +static uint16_t latchAddr; +static uint8_t latchData; +static uint8_t submapper; static SFORMAT StateRegs[] = { diff --git a/src/boards/355.c b/src/boards/355.c index ae93b54..de3a14e 100644 --- a/src/boards/355.c +++ b/src/boards/355.c @@ -22,8 +22,8 @@ #include "mapinc.h" #include "pic16c5x.h" -static uint32 address; -static uint8 *picrom = NULL; +static uint32_t address; +static uint8_t *picrom = NULL; static uint8_t pci16c5x_read(int port) { if (port == 0) { diff --git a/src/boards/356.c b/src/boards/356.c index 60e8e5a..77700ef 100644 --- a/src/boards/356.c +++ b/src/boards/356.c @@ -23,8 +23,8 @@ #include "mapinc.h" #include "asic_tc3294.h" -static uint8 *CHRRAM = NULL; -static uint32 CHRRAMSize; +static uint8_t *CHRRAM = NULL; +static uint32_t CHRRAMSize; static void sync () { TC3294_syncPRG(0xFF, 0x00); @@ -52,7 +52,7 @@ void Mapper356_Init (CartInfo *info) { TC3294_init(info, sync); info->Close = close; CHRRAMSize = 8192; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSize); + CHRRAM = (uint8_t*)FCEU_gmalloc(CHRRAMSize); AddExState(CHRRAM, CHRRAMSize, 0, "CRAM"); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1); } diff --git a/src/boards/357.c b/src/boards/357.c index a260008..8fc7c99 100644 --- a/src/boards/357.c +++ b/src/boards/357.c @@ -27,13 +27,13 @@ #include "mapinc.h" -static uint8 preg[4]; -static uint8 dipswitch; -static uint8 IRQa; -static uint16 IRQCount; +static uint8_t preg[4]; +static uint8_t dipswitch; +static uint8_t IRQa; +static uint16_t IRQCount; -static const uint8 banks[8] = { 4, 3, 5, 3, 6, 3, 7, 3 }; -static const uint8 outer_bank[4] = { 0x00, 0x08, 0x10, 0x18 }; +static const uint8_t banks[8] = { 4, 3, 5, 3, 6, 3, 7, 3 }; +static const uint8_t outer_bank[4] = { 0x00, 0x08, 0x10, 0x18 }; static SFORMAT StateRegs[] = { diff --git a/src/boards/359.c b/src/boards/359.c index db65987..ab66598 100644 --- a/src/boards/359.c +++ b/src/boards/359.c @@ -25,17 +25,17 @@ #include "mapinc.h" #include "../fds_apu.h" -static uint32 mapperNum; -static uint8 preg[4]; -static uint8 creg[8]; -static uint8 exRegs[4]; -static uint8 IRQReload; -static uint8 IRQa; -static uint8 irqPA12; -static uint8 IRQAutoEnable; -static uint8 IRQLatch; -static uint8 IRQCount; -static int16 IRQCount16; +static uint32_t mapperNum; +static uint8_t preg[4]; +static uint8_t creg[8]; +static uint8_t exRegs[4]; +static uint8_t IRQReload; +static uint8_t IRQa; +static uint8_t irqPA12; +static uint8_t IRQAutoEnable; +static uint8_t IRQLatch; +static uint8_t IRQCount; +static int16_t IRQCount16; static SFORMAT StateRegs[] = { { preg, 4, "PREG" }, @@ -52,8 +52,8 @@ static SFORMAT StateRegs[] = { }; static void Sync(void) { - uint8 prgMask = 0x3F; - uint8 prgOuterBank = (exRegs[0] & 0x38) << 1; + uint8_t prgMask = 0x3F; + uint8_t prgOuterBank = (exRegs[0] & 0x38) << 1; switch (exRegs[1] & 3) { case 0: prgMask = 0x3F; break; @@ -71,9 +71,9 @@ static void Sync(void) { if (!UNIFchrrama) { switch (mapperNum) { case 359: { - uint8 i; - uint8 chrMask = (exRegs[1] & 0x40) ? 0xFF : 0x7F; - uint16 chrOuterBank = (exRegs[3] << 7); + uint8_t i; + uint8_t chrMask = (exRegs[1] & 0x40) ? 0xFF : 0x7F; + uint16_t chrOuterBank = (exRegs[3] << 7); for (i = 0; i < 8; i++) setchr1(i << 10, (creg[i] & chrMask) | chrOuterBank); @@ -124,19 +124,19 @@ static DECLFW(M359WriteIRQ) { } static DECLFW(M359WritePRG) { - uint8 i = A & 3; + uint8_t i = A & 3; preg[i] = V; Sync(); } static DECLFW(M359WriteCHR) { - uint8 i = ((A >> 10) & 4) | (A & 3); + uint8_t i = ((A >> 10) & 4) | (A & 3); creg[i] = V; Sync(); } static DECLFW(M359WriteEx) { - uint8 i = A & 3; + uint8_t i = A & 3; exRegs[i] = V; Sync(); } diff --git a/src/boards/360.c b/src/boards/360.c index c42c046..450ff6e 100644 --- a/src/boards/360.c +++ b/src/boards/360.c @@ -22,8 +22,8 @@ #include "mapinc.h" -static uint8 reg; -static uint8 submapper; +static uint8_t reg; +static uint8_t submapper; static SFORMAT StateRegs[] = { diff --git a/src/boards/361.c b/src/boards/361.c index 6d0f6f9..6a6662e 100644 --- a/src/boards/361.c +++ b/src/boards/361.c @@ -23,7 +23,7 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg; +static uint8_t reg; static void sync () { MMC3_syncPRG(0x0F, reg &~0x0F); diff --git a/src/boards/362.c b/src/boards/362.c index e6d75b7..ffc4b12 100644 --- a/src/boards/362.c +++ b/src/boards/362.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "asic_vrc2and4.h" -static uint8 game; +static uint8_t game; static SFORMAT stateRegs[] ={ { &game, 1, "GAME" }, diff --git a/src/boards/363.c b/src/boards/363.c index 2916e41..5aa0dcd 100644 --- a/src/boards/363.c +++ b/src/boards/363.c @@ -28,7 +28,7 @@ static void sync () { setmirror(Latch_address &0x20? MI_H: MI_V); } -static void trapLatchWrite (uint16 *newAddress, uint8 *newValue, uint8 romValue) { +static void trapLatchWrite (uint16_t *newAddress, uint8_t *newValue, uint8_t romValue) { if (!(~Latch_address &0x10 && *newAddress &0x10)) *newAddress = Latch_address; /* Address bits only latched on a rising edge of A4 */ *newValue &= romValue; /* AND-type bus conflicts */ } diff --git a/src/boards/364.c b/src/boards/364.c index 36ab766..d1a41d5 100644 --- a/src/boards/364.c +++ b/src/boards/364.c @@ -22,12 +22,12 @@ #include "mapinc.h" #include "mmc3.h" -static void M364CW(uint32 A, uint8 V) { +static void M364CW(uint32_t A, uint8_t V) { V &= (EXPREGS[0] & 0x20) ? 0x7F : 0xFF; setchr1(A, V | ((EXPREGS[0] << 4) & 0x100)); } -static void M364PW(uint32 A, uint8 V) { +static void M364PW(uint32_t A, uint8_t V) { V &= (EXPREGS[0] & 0x20) ? 0x0F : 0x1F; setprg8(A, V | ((EXPREGS[0] >> 1) & 0x20)); } diff --git a/src/boards/366.c b/src/boards/366.c index 4307bd1..068e6df 100644 --- a/src/boards/366.c +++ b/src/boards/366.c @@ -24,7 +24,7 @@ #include "asic_mmc3.h" #include "cartram.h" -static uint8 reg; +static uint8_t reg; static void sync () { MMC3_syncWRAM(0); diff --git a/src/boards/368.c b/src/boards/368.c index db08973..efe740f 100644 --- a/src/boards/368.c +++ b/src/boards/368.c @@ -27,12 +27,12 @@ #include "mapinc.h" -static uint8 preg; -static uint8 latch; -static uint8 IRQa; -static uint16 IRQCount; +static uint8_t preg; +static uint8_t latch; +static uint8_t IRQa; +static uint16_t IRQCount; -static const uint8 banks[8] = { 4, 3, 5, 3, 6, 3, 7, 3 }; +static const uint8_t banks[8] = { 4, 3, 5, 3, 6, 3, 7, 3 }; static SFORMAT StateRegs[] = { diff --git a/src/boards/369.c b/src/boards/369.c index fea0379..51550e5 100644 --- a/src/boards/369.c +++ b/src/boards/369.c @@ -23,11 +23,11 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 mode; -static uint8 mmc3_count, mmc3_latch, mmc3_enabled, mmc3_reload; -static uint8 smb2_reg; -static uint8 smb2j_enabled; -static uint16 smb2j_count; +static uint8_t mode; +static uint8_t mmc3_count, mmc3_latch, mmc3_enabled, mmc3_reload; +static uint8_t smb2_reg; +static uint8_t smb2j_enabled; +static uint16_t smb2j_count; static SFORMAT StateRegs[] = { { &mode, 1, "MODE" }, @@ -41,7 +41,7 @@ static SFORMAT StateRegs[] = { { 0 } }; -static void SyncPRG(uint32 A, uint8 V) { +static void SyncPRG(uint32_t A, uint8_t V) { switch (mode) { case 0x00: case 0x01: /* NROM */ @@ -65,7 +65,7 @@ static void SyncPRG(uint32 A, uint8 V) { } } -static void SyncCHR(uint32 A, uint8 V) { +static void SyncCHR(uint32_t A, uint8_t V) { switch (mode) { case 0x00: case 0x01: /* NROM */ @@ -148,7 +148,7 @@ static void FP_FASTAPASS(1) SMB2JIRQHook(int a) { } static void MMC3IRQHook(void) { - int32 count = mmc3_count; + int32_t count = mmc3_count; if (mode == 0x13) return; diff --git a/src/boards/370.c b/src/boards/370.c index 297031b..335094b 100644 --- a/src/boards/370.c +++ b/src/boards/370.c @@ -25,10 +25,10 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 PPUCHRBus; -static uint8 mirr[8]; +static uint8_t PPUCHRBus; +static uint8_t mirr[8]; -static void FP_FASTAPASS(1) M370PPU(uint32 A) { +static void FP_FASTAPASS(1) M370PPU(uint32_t A) { if ((EXPREGS[0] & 7) == 1) { A &= 0x1FFF; A >>= 10; @@ -37,8 +37,8 @@ static void FP_FASTAPASS(1) M370PPU(uint32 A) { } } -static void M370CW(uint32 A, uint8 V) { - uint8 mask = (EXPREGS[0] & 4) ? 0x7F : 0xFF; +static void M370CW(uint32_t A, uint8_t V) { + uint8_t mask = (EXPREGS[0] & 4) ? 0x7F : 0xFF; /* FIXME: Mario VII, mask is reversed? */ if ((EXPREGS[0] & 7) == 6 && V & 0x80) mask = 0xFF; @@ -48,12 +48,12 @@ static void M370CW(uint32 A, uint8 V) { setmirror(MI_0 + (V >> 7)); } -static void M370PW(uint32 A, uint8 V) { - uint8 mask = EXPREGS[0] & 0x20 ? 0x0F : 0x1F; +static void M370PW(uint32_t A, uint8_t V) { + uint8_t mask = EXPREGS[0] & 0x20 ? 0x0F : 0x1F; setprg8(A, (V & mask) | ((EXPREGS[0] & 0x38) << 1)); } -static void M370MW(uint8 V) { +static void M370MW(uint8_t V) { A000B = V; if ((EXPREGS[0] & 7) != 1) setmirror((V & 1) ^ 1); diff --git a/src/boards/372.c b/src/boards/372.c index 3f878b2..70d6f3a 100644 --- a/src/boards/372.c +++ b/src/boards/372.c @@ -26,13 +26,13 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 WRAM[0x2000]; -static uint32 CHRRAMSIZE; -static uint8 *CHRRAM; +static uint8_t WRAM[0x2000]; +static uint32_t CHRRAMSIZE; +static uint8_t *CHRRAM; -static void M372CW(uint32 A, uint8 V) { +static void M372CW(uint32_t A, uint8_t V) { if (!UNIFchrrama) { - uint32 NV = V; + uint32_t NV = V; if (EXPREGS[2] & 8) NV &= (1 << ((EXPREGS[2] & 7) + 1)) - 1; else if (EXPREGS[2]) @@ -47,8 +47,8 @@ static void M372CW(uint32 A, uint8 V) { setchr1(A, V); } -static void M372PW(uint32 A, uint8 V) { - uint32 MV = V & ((EXPREGS[3] & 0x3F) ^ 0x3F); +static void M372PW(uint32_t A, uint8_t V) { + uint32_t MV = V & ((EXPREGS[3] & 0x3F) ^ 0x3F); MV |= EXPREGS[1]; if(UNIFchrrama) MV |= ((EXPREGS[2] & 0x40) << 2); @@ -68,7 +68,7 @@ static DECLFW(M372Write) { } static DECLFR(M372Read) { - uint32 addr = 1 << (EXPREGS[5] + 4); + uint32_t addr = 1 << (EXPREGS[5] + 4); if (A & (addr | (addr - 1))) return X.DB | 1; else @@ -104,7 +104,7 @@ void Mapper372_Init(CartInfo *info) { info->Power = M372Power; info->Close = M372Close; CHRRAMSIZE = 8192; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM = (uint8_t*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR"); AddExState(EXPREGS, 5, 0, "EXPR"); diff --git a/src/boards/375.c b/src/boards/375.c index 11fc843..cfeadc6 100644 --- a/src/boards/375.c +++ b/src/boards/375.c @@ -20,17 +20,17 @@ #include "mapinc.h" -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; -static uint16 addrlatch; -static uint8 datalatch; +static uint16_t addrlatch; +static uint8_t datalatch; static void Sync(void) { - uint32 S = addrlatch & 1; - uint32 p = ((addrlatch >> 2) & 0x1F) + ((addrlatch & 0x100) >> 3) + ((addrlatch & 0x400) >> 4); - uint32 L = (addrlatch >> 9) & 1; - uint32 p_8000 = p; + uint32_t S = addrlatch & 1; + uint32_t p = ((addrlatch >> 2) & 0x1F) + ((addrlatch & 0x100) >> 3) + ((addrlatch & 0x400) >> 4); + uint32_t L = (addrlatch >> 9) & 1; + uint32_t p_8000 = p; if ((addrlatch >> 11) & 1) p_8000 = (p & 0x7E) | (datalatch & 7); @@ -122,7 +122,7 @@ void Mapper375_Init(CartInfo *info) { AddExState(&datalatch, 1, 0, "DATA"); WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); } diff --git a/src/boards/376.c b/src/boards/376.c index b9a1171..382445c 100644 --- a/src/boards/376.c +++ b/src/boards/376.c @@ -21,13 +21,13 @@ #include "mapinc.h" #include "mmc3.h" -static void Mapper376CW(uint32 A, uint8 V) { - uint32 base = (EXPREGS[0] &0x40? 0x080: 0x000) | (EXPREGS[1] &0x01? 0x100: 0x000); +static void Mapper376CW(uint32_t A, uint8_t V) { + uint32_t base = (EXPREGS[0] &0x40? 0x080: 0x000) | (EXPREGS[1] &0x01? 0x100: 0x000); setchr1(A, base | (V & 0x7F)); } -static void Mapper376PW(uint32 A, uint8 V) { - uint32 base = (EXPREGS[0] &0x07) | (EXPREGS[0] &0x40? 0x08: 0x00) | (EXPREGS[1] &0x01? 0x10: 0x00); +static void Mapper376PW(uint32_t A, uint8_t V) { + uint32_t base = (EXPREGS[0] &0x07) | (EXPREGS[0] &0x40? 0x08: 0x00) | (EXPREGS[1] &0x01? 0x10: 0x00); if (EXPREGS[0] & 0x80) { if (EXPREGS[0] &0x20) { if (A ==0x8000) setprg32(A, base >>1); diff --git a/src/boards/377.c b/src/boards/377.c index 9b0cdd9..7a3f9b5 100644 --- a/src/boards/377.c +++ b/src/boards/377.c @@ -27,11 +27,11 @@ #define OUTER_BANK (((EXPREGS[0] & 0x20) >> 2) | (EXPREGS[0] & 0x06)) -static void M377CW(uint32 A, uint8 V) { +static void M377CW(uint32_t A, uint8_t V) { setchr1(A, (V & 0x7F) | (OUTER_BANK << 6)); } -static void M377PW(uint32 A, uint8 V) { +static void M377PW(uint32_t A, uint8_t V) { setprg8(A, (V & 0x0F) | (OUTER_BANK << 3)); } diff --git a/src/boards/380.c b/src/boards/380.c index 2b53fb1..8c0481c 100644 --- a/src/boards/380.c +++ b/src/boards/380.c @@ -23,10 +23,10 @@ #include "mapinc.h" -static uint16 latche; -static uint8 dipswitch; -static uint8 isKN35A; -static uint8 is4K1; +static uint16_t latche; +static uint8_t dipswitch; +static uint8_t isKN35A; +static uint8_t is4K1; static SFORMAT StateRegs[] = { { &latche, 2 | FCEUSTATE_RLSB, "LATC" }, diff --git a/src/boards/382.c b/src/boards/382.c index 0372f92..3b8daec 100644 --- a/src/boards/382.c +++ b/src/boards/382.c @@ -25,10 +25,10 @@ #include "mapinc.h" -static uint8 preg[2]; -static uint8 mode; -static uint8 mirr; -static uint8 lock; +static uint8_t preg[2]; +static uint8_t mode; +static uint8_t mirr; +static uint8_t lock; static SFORMAT StateRegs[] = { { &preg[0], 1, "PRG0" }, diff --git a/src/boards/383.c b/src/boards/383.c index ade8b07..d863c57 100644 --- a/src/boards/383.c +++ b/src/boards/383.c @@ -27,7 +27,7 @@ #define A16 EXPREGS[1] #define A17A18 EXPREGS[2] -static void M383PRGWrap (uint32 A, uint8 V) +static void M383PRGWrap (uint32_t A, uint8_t V) { switch(A17A18) { @@ -54,7 +54,7 @@ static void M383PRGWrap (uint32 A, uint8 V) } } -static void M383CHRWrap (uint32 A, uint8 V) +static void M383CHRWrap (uint32_t A, uint8_t V) { setchr1(A, V &0x7F | A17A18 <<3); } diff --git a/src/boards/384.c b/src/boards/384.c index 02d7803..ed78050 100644 --- a/src/boards/384.c +++ b/src/boards/384.c @@ -22,7 +22,7 @@ #include "asic_vrc2and4.h" #include "cartram.h" -static uint8 reg; +static uint8_t reg; static SFORMAT stateRegs[] ={ { ®, 1, "EXP0" }, diff --git a/src/boards/389.c b/src/boards/389.c index b1dbfd0..584f02b 100644 --- a/src/boards/389.c +++ b/src/boards/389.c @@ -22,7 +22,7 @@ #include "mapinc.h" -static uint8 regs[3]; +static uint8_t regs[3]; static SFORMAT StateRegs[] = { { ®s, 3, "REGS" }, diff --git a/src/boards/390.c b/src/boards/390.c index 9d2a953..aa3d227 100644 --- a/src/boards/390.c +++ b/src/boards/390.c @@ -22,8 +22,8 @@ #include "mapinc.h" -static uint8 regs[2]; -static uint8 dipswitch; +static uint8_t regs[2]; +static uint8_t dipswitch; static SFORMAT StateRegs[] = { @@ -55,7 +55,7 @@ static void Sync(void) { } static DECLFR(M390Read) { - uint8 ret = CartBR(A); + uint8_t ret = CartBR(A); if ((regs[1] & 0x30) == 0x10) ret |= dipswitch; return ret; diff --git a/src/boards/391.c b/src/boards/391.c index da66b3e..4e5d200 100644 --- a/src/boards/391.c +++ b/src/boards/391.c @@ -23,7 +23,7 @@ #include "mapinc.h" #include "mmc3.h" -static void Mapper391_PRGWrap(uint32 A, uint8 V) { +static void Mapper391_PRGWrap(uint32_t A, uint8_t V) { int prgAND =EXPREGS[0] &0x08? 0x0F: 0x1F; int prgOR =EXPREGS[0] <<4 &0x30; if (EXPREGS[0] &0x20) { @@ -35,7 +35,7 @@ static void Mapper391_PRGWrap(uint32 A, uint8 V) { setprg8(A, V &prgAND | prgOR &~prgAND); } -static void Mapper391_CHRWrap(uint32 A, uint8 V) { +static void Mapper391_CHRWrap(uint32_t A, uint8_t V) { int chrAND =EXPREGS[0] &0x40? 0x7F: 0xFF; int chrOR =EXPREGS[0] <<3 &0x80 | EXPREGS[1] <<8 &0x100; setchr1(A, V &chrAND | chrOR &~chrAND); diff --git a/src/boards/393.c b/src/boards/393.c index 5315cce..3551ea3 100644 --- a/src/boards/393.c +++ b/src/boards/393.c @@ -23,22 +23,22 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 *CHRRAM; -static uint32 CHRRAMSIZE; +static uint8_t *CHRRAM; +static uint32_t CHRRAMSIZE; static int getPRGBank(int bank) { if ((~bank & 1) && (MMC3_cmd & 0x40)) bank ^= 2; return (bank & 2) ? 0xFE | (bank & 1) : DRegBuf[6 | (bank & 1)]; } -static void M393CW(uint32 A, uint8 V) { +static void M393CW(uint32_t A, uint8_t V) { if (EXPREGS[0] & 8) setchr8r(0x10, 0); else setchr1(A, V & 0xFF | EXPREGS[0] << 8); } -static void M393PW(uint32 A, uint8 V) { +static void M393PW(uint32_t A, uint8_t V) { switch ((EXPREGS[0] >> 4) & 3) { case 0: case 1: @@ -104,7 +104,7 @@ void Mapper393_Init(CartInfo *info) { info->Reset = M393Reset; info->Close = M393lose; CHRRAMSIZE = 8192; - CHRRAM = (uint8 *)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM = (uint8_t *)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR"); AddExState(EXPREGS, 2, 0, "EXPR"); diff --git a/src/boards/395.c b/src/boards/395.c index 949b099..29a0a43 100644 --- a/src/boards/395.c +++ b/src/boards/395.c @@ -28,13 +28,13 @@ #include "mapinc.h" #include "mmc3.h" -static void M395CW(uint32 A, uint8 V) { - uint8 mask = EXPREGS[1] & 0x40 ? 0x7F : 0xFF; +static void M395CW(uint32_t A, uint8_t V) { + uint8_t mask = EXPREGS[1] & 0x40 ? 0x7F : 0xFF; setchr1(A, (V & mask) | ((EXPREGS[1] & 0x10) << 3) | ((EXPREGS[0] & 0x30) << 4) | ((EXPREGS[1] & 0x20) << 5)); } -static void M395PW(uint32 A, uint8 V) { - uint8 mask = EXPREGS[1] & 8 ? 0x0F : 0x1F; +static void M395PW(uint32_t A, uint8_t V) { + uint8_t mask = EXPREGS[1] & 8 ? 0x0F : 0x1F; setprg8(A, (V & mask) | ((EXPREGS[0] & 0x30) << 1) | ((EXPREGS[0] & 8) << 4) | ((EXPREGS[1] & 1) << 4)); } diff --git a/src/boards/396.c b/src/boards/396.c index 4c4d105..c170610 100644 --- a/src/boards/396.c +++ b/src/boards/396.c @@ -20,8 +20,8 @@ #include "mapinc.h" -static uint8 submapper; -static uint8 reg[2]; +static uint8_t submapper; +static uint8_t reg[2]; static void sync () { setprg16(0x8000, reg[0] <<3 | reg[1] &0x07); diff --git a/src/boards/398.c b/src/boards/398.c index ce1e630..38314be 100644 --- a/src/boards/398.c +++ b/src/boards/398.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "asic_vrc2and4.h" -static uint8 reg; +static uint8_t reg; static SFORMAT stateRegs[] ={ { ®, 1, "EXP0" }, diff --git a/src/boards/399.c b/src/boards/399.c index 644680f..2e123f3 100644 --- a/src/boards/399.c +++ b/src/boards/399.c @@ -21,9 +21,9 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 submapper; +static uint8_t submapper; -static void PRGWrap(uint32 A, uint8 V) { +static void PRGWrap(uint32_t A, uint8_t V) { if (submapper ==1) { setprg8(0x6000, ~1); setprg8(0x8000, DRegBuf[6] <<1 |0); @@ -36,7 +36,7 @@ static void PRGWrap(uint32 A, uint8 V) { setprg8(0xE000, ~0); } -static void CHRWrap(uint32 A, uint8 V) { +static void CHRWrap(uint32_t A, uint8_t V) { setchr4(0x0000, DRegBuf[0]); setchr4(0x1000, DRegBuf[1]); } diff --git a/src/boards/40.c b/src/boards/40.c index fe16148..c2e4b3c 100644 --- a/src/boards/40.c +++ b/src/boards/40.c @@ -24,9 +24,9 @@ #include "mapinc.h" -static uint8 submapper; -static uint8 reg, outer; -static uint32 IRQCount, IRQa; +static uint8_t submapper; +static uint8_t reg, outer; +static uint32_t IRQCount, IRQa; static SFORMAT StateRegs[] = { diff --git a/src/boards/400.c b/src/boards/400.c index 3965439..fa639d2 100644 --- a/src/boards/400.c +++ b/src/boards/400.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "asic_latch.h" -static uint8 reg[4]; +static uint8_t reg[4]; static void sync () { setprg16(0x8000, reg[2] &~0x07 | Latch_data &0x07); diff --git a/src/boards/401.c b/src/boards/401.c index 940aa4f..4201704 100644 --- a/src/boards/401.c +++ b/src/boards/401.c @@ -25,20 +25,20 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 dipswitch = 0; +static uint8_t dipswitch = 0; -static void M401CW(uint32 A, uint8 V) { - uint32 mask = (0xFF >> (~EXPREGS[2] & 0xF)); - uint32 bank = (EXPREGS[0] | ((EXPREGS[2] << 4) & 0xF00)); +static void M401CW(uint32_t A, uint8_t V) { + uint32_t mask = (0xFF >> (~EXPREGS[2] & 0xF)); + uint32_t bank = (EXPREGS[0] | ((EXPREGS[2] << 4) & 0xF00)); setchr1(A, (V & mask) | bank); } -static void M401PW(uint32 A, uint8 V) { +static void M401PW(uint32_t A, uint8_t V) { if ((dipswitch & 1) && (EXPREGS[1] & 0x80)) { /* openbus */ } else { - uint32 mask = (~EXPREGS[3] & 0x1F); - uint32 bank = (EXPREGS[1] & 0x1F) | (EXPREGS[2] & 0x80) | + uint32_t mask = (~EXPREGS[3] & 0x1F); + uint32_t bank = (EXPREGS[1] & 0x1F) | (EXPREGS[2] & 0x80) | ((dipswitch & 2) ? (EXPREGS[2] & 0x20) : ((EXPREGS[1] >> 1) & 0x20)) | ((dipswitch & 4) ? (EXPREGS[2] & 0x40) : ((EXPREGS[1] << 1) & 0x40)); setprg8(A, (V & mask) | bank); diff --git a/src/boards/403.c b/src/boards/403.c index 11dfa5c..d539be6 100644 --- a/src/boards/403.c +++ b/src/boards/403.c @@ -26,12 +26,12 @@ #include "mapinc.h" -static uint8 reg[3]; +static uint8_t reg[3]; static void Sync(void) { - uint8 prg = reg[0]; - uint8 chr = reg[1]; - uint8 mode = reg[2]; + uint8_t prg = reg[0]; + uint8_t chr = reg[1]; + uint8_t mode = reg[2]; /* NROM-128 */ if (mode & 1) { diff --git a/src/boards/406.c b/src/boards/406.c index 6bb41cd..52aef04 100644 --- a/src/boards/406.c +++ b/src/boards/406.c @@ -22,7 +22,7 @@ #include "mmc3.h" #include "flashrom.h" -static uint8 submapper; +static uint8_t submapper; static DECLFW(Write) { flashrom_write(A &0x1FFF | (Page[A >>11] +A -PRGptr[0]) &~0x1FFF, V); diff --git a/src/boards/41.c b/src/boards/41.c index d0d9083..c32deed 100644 --- a/src/boards/41.c +++ b/src/boards/41.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 mainreg, chrreg, mirror; +static uint8_t mainreg, chrreg, mirror; static SFORMAT StateRegs[] = { diff --git a/src/boards/410.c b/src/boards/410.c index 1484e59..6314461 100644 --- a/src/boards/410.c +++ b/src/boards/410.c @@ -27,11 +27,11 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 *CHRRAM; +static uint8_t *CHRRAM; -static void M410CW(uint32 A, uint8 V) { +static void M410CW(uint32_t A, uint8_t V) { if (!(EXPREGS[2] & 0x40)) { - uint32 NV = V; + uint32_t NV = V; NV &= (1 << ((EXPREGS[2] & 7) + 1)) - 1; NV |= EXPREGS[0] | ((EXPREGS[2] & 0xF0) << 4); setchr1(A, NV); @@ -39,8 +39,8 @@ static void M410CW(uint32 A, uint8 V) { setchr8r(0x10, 0); } -static void M410PW(uint32 A, uint8 V) { - uint32 MV = V & ((EXPREGS[3] & 0x3F) ^ 0x3F); +static void M410PW(uint32_t A, uint8_t V) { + uint32_t MV = V & ((EXPREGS[3] & 0x3F) ^ 0x3F); MV |= EXPREGS[1]; MV |= ((EXPREGS[2] & 0x40) << 2); setprg8(A, MV); @@ -83,7 +83,7 @@ void Mapper410_Init(CartInfo *info) { info->Close = M410Close; AddExState(EXPREGS, 5, 0, "EXPR"); - CHRRAM = (uint8*)FCEU_gmalloc(8192); + CHRRAM = (uint8_t*)FCEU_gmalloc(8192); SetupCartCHRMapping(0x10, CHRRAM, 8192, 1); AddExState(CHRRAM, 8192, 0, "CRAM"); } \ No newline at end of file diff --git a/src/boards/411.c b/src/boards/411.c index 8f63948..0dc5f08 100644 --- a/src/boards/411.c +++ b/src/boards/411.c @@ -31,9 +31,9 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 submapper; +static uint8_t submapper; -static void M411CW(uint32 A, uint8 V) { +static void M411CW(uint32_t A, uint8_t V) { int chrAND, chrOR; switch(submapper) { default:chrOR =EXPREGS[1] <<5 &0x080 | EXPREGS[0] <<4 &0x100 | EXPREGS[1] <<2 &0x200; @@ -49,7 +49,7 @@ static void M411CW(uint32 A, uint8 V) { setchr1(A, V &chrAND | chrOR &~chrAND); } -static void M411PW(uint32 A, uint8 V) { +static void M411PW(uint32_t A, uint8_t V) { int prgAND, prgOR; switch(submapper) { default:prgOR =EXPREGS[1] <<1 &0x10 | EXPREGS[1] >>1 &0x60; @@ -63,7 +63,7 @@ static void M411PW(uint32 A, uint8 V) { break; } if (EXPREGS[0] & 0x40) { /* NROM Mode */ - uint32 bank = EXPREGS[0] &5 | EXPREGS[0] >>2 &2 | prgOR >>1; + uint32_t bank = EXPREGS[0] &5 | EXPREGS[0] >>2 &2 | prgOR >>1; if (EXPREGS[0] & 0x02) /* NROM-256 */ setprg32(0x8000, bank >> 1); else { /* NROM-128 */ diff --git a/src/boards/411120-c.c b/src/boards/411120-c.c index a21a898..fa7bc0f 100644 --- a/src/boards/411120-c.c +++ b/src/boards/411120-c.c @@ -31,16 +31,16 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 reset_flag = 0; -static uint8 isK3088; +static uint8_t reset_flag = 0; +static uint8_t isK3088; -static void BMC411120CCW(uint32 A, uint8 V) { - uint32 mask = isK3088 ? 0x07 : 0x03; +static void BMC411120CCW(uint32_t A, uint8_t V) { + uint32_t mask = isK3088 ? 0x07 : 0x03; setchr1(A, V | ((EXPREGS[0] & mask) << 7)); } -static void BMC411120CPW(uint32 A, uint8 V) { - uint32 mask = isK3088 ? 0x07 : 0x03; +static void BMC411120CPW(uint32_t A, uint8_t V) { + uint32_t mask = isK3088 ? 0x07 : 0x03; if (EXPREGS[0] & (isK3088 ? 8 : (8 | reset_flag))) { /* 32K Mode */ if (A == 0x8000) /* bit 0-1 of register should be used as outer bank regardless of banking modes */ diff --git a/src/boards/412.c b/src/boards/412.c index 2e97322..071b18d 100644 --- a/src/boards/412.c +++ b/src/boards/412.c @@ -23,7 +23,7 @@ #include "mapinc.h" #include "mmc3.h" -static void M412PW(uint32 A, uint8 V) { +static void M412PW(uint32_t A, uint8_t V) { int prgAND =0x0F | (EXPREGS[1] &0x02? 0x00: 0x20) | (EXPREGS[1] &0x10? 0x00: 0x10); int prgOR =(EXPREGS[1] &0x40? 0x10: 0x00) | (EXPREGS[1] &0x04? 0x20: 0x00); if (EXPREGS[2] &0x02) { /* NROM mode */ @@ -37,7 +37,7 @@ static void M412PW(uint32 A, uint8 V) { setprg8(A, V &prgAND | prgOR &~prgAND); } -static void M412CW(uint32 A, uint8 V) { +static void M412CW(uint32_t A, uint8_t V) { int chrAND =EXPREGS[1] &0x20? 0x7F: 0xFF; int chrOR =(EXPREGS[1] &0x80? 0x80: 0x00) | (EXPREGS[1] &0x08? 0x100: 0x000); if (EXPREGS[2] &0x02) /* (C)NROM mode */ diff --git a/src/boards/413.c b/src/boards/413.c index 2faa38c..c98a148 100644 --- a/src/boards/413.c +++ b/src/boards/413.c @@ -20,14 +20,14 @@ #include "mapinc.h" -static uint8 reg[4]; -static uint32 pcmAddress, pcmAddressMask; -static uint8 pcmControl; -static uint8 scanlineCounter; -static uint8 scanlineReload; -static uint8 scanlineIRQ; -static uint32 lasttime; -extern uint32 timestamp; +static uint8_t reg[4]; +static uint32_t pcmAddress, pcmAddressMask; +static uint8_t pcmControl; +static uint8_t scanlineCounter; +static uint8_t scanlineReload; +static uint8_t scanlineIRQ; +static uint32_t lasttime; +extern uint32_t timestamp; static SFORMAT stateRegs[] ={ { reg, 4, "REGS" }, @@ -51,7 +51,7 @@ static void sync() { } static DECLFR(readPCM) { - uint8 result =MiscROM[pcmAddress &pcmAddressMask]; + uint8_t result =MiscROM[pcmAddress &pcmAddressMask]; if (timestamp (lasttime +6)) { if (pcmControl &2) ++pcmAddress; lasttime =timestamp; diff --git a/src/boards/414.c b/src/boards/414.c index a66da80..85e75e7 100644 --- a/src/boards/414.c +++ b/src/boards/414.c @@ -20,9 +20,9 @@ #include "mapinc.h" -static uint8 latch_data; -static uint32 latch_addr; -static uint8 dipswitch; +static uint8_t latch_data; +static uint32_t latch_addr; +static uint8_t dipswitch; static SFORMAT StateRegs[] = { diff --git a/src/boards/416.c b/src/boards/416.c index 9ea10b4..2e61ea3 100644 --- a/src/boards/416.c +++ b/src/boards/416.c @@ -22,14 +22,14 @@ #include "mapinc.h" -static uint8 reg; -static uint8 smb2j_reg; -static uint8 IRQa; -static uint16 IRQCount; +static uint8_t reg; +static uint8_t smb2j_reg; +static uint8_t IRQa; +static uint16_t IRQCount; static void Sync(void) { if (reg & 8) { - uint8 prg = ((reg >> 5) & 1) | ((reg >> 6) & 2) | ((reg >> 1) & 4); + uint8_t prg = ((reg >> 5) & 1) | ((reg >> 6) & 2) | ((reg >> 1) & 4); switch ((reg >> 6) & 3) { case 0: setprg8(0x8000, prg << 1); diff --git a/src/boards/417.c b/src/boards/417.c index 26dfea8..76c07a0 100644 --- a/src/boards/417.c +++ b/src/boards/417.c @@ -20,12 +20,12 @@ #include "mapinc.h" -static uint8 preg[4]; -static uint8 creg[8]; -static uint8 nt[4]; -static uint8 IRQa; -static uint16 IRQCount; -static uint8 submapper; +static uint8_t preg[4]; +static uint8_t creg[8]; +static uint8_t nt[4]; +static uint8_t IRQa; +static uint16_t IRQCount; +static uint8_t submapper; static SFORMAT StateRegs[] = { { preg, 4, "PREG" }, diff --git a/src/boards/42.c b/src/boards/42.c index 25e9b6d..01fe0b5 100644 --- a/src/boards/42.c +++ b/src/boards/42.c @@ -25,8 +25,8 @@ #include "mapinc.h" #include "../fds_apu.h" -static uint8 preg, creg, mirr; -static uint32 IRQCount, IRQa; +static uint8_t preg, creg, mirr; +static uint32_t IRQCount, IRQa; static SFORMAT StateRegs[] = { diff --git a/src/boards/420.c b/src/boards/420.c index c012a7c..f480fbe 100644 --- a/src/boards/420.c +++ b/src/boards/420.c @@ -21,16 +21,16 @@ #include "mapinc.h" #include "mmc3.h" -static void M420CW(uint32 A, uint8 V) { - uint8 mask = (EXPREGS[1] & 0x80) ? 0x7F : 0xFF; +static void M420CW(uint32_t A, uint8_t V) { + uint8_t mask = (EXPREGS[1] & 0x80) ? 0x7F : 0xFF; setchr1(A, ((EXPREGS[1] << 1) & 0x100) | ((EXPREGS[1] << 5) & 0x80) | (V & mask)); } -static void M420PW(uint32 A, uint8 V) { +static void M420PW(uint32_t A, uint8_t V) { if (EXPREGS[0] & 0x80) { setprg32(0x8000, ((EXPREGS[2] >> 2) & 8) | ((EXPREGS[0] >> 1) & 7)); } else { - uint8 mask = (EXPREGS[0] & 0x20) ? 0x0F : ((EXPREGS[3] & 0x20) ? 0x1F : 0x3F); + uint8_t mask = (EXPREGS[0] & 0x20) ? 0x0F : ((EXPREGS[3] & 0x20) ? 0x1F : 0x3F); setprg8(A, ((EXPREGS[3] << 3) & 0x20) | (V & mask)); } } diff --git a/src/boards/428.c b/src/boards/428.c index 06f18f7..4aff16b 100644 --- a/src/boards/428.c +++ b/src/boards/428.c @@ -23,8 +23,8 @@ #include "mapinc.h" -static uint8 regs[4]; -static uint8 hrd_flag; +static uint8_t regs[4]; +static uint8_t hrd_flag; static SFORMAT StateRegs[] = { diff --git a/src/boards/43.c b/src/boards/43.c index d4c59cc..edde11e 100644 --- a/src/boards/43.c +++ b/src/boards/43.c @@ -23,8 +23,8 @@ #include "mapinc.h" -static uint8 reg, swap; -static uint32 IRQCount, IRQa; +static uint8_t reg, swap; +static uint32_t IRQCount, IRQa; static SFORMAT StateRegs[] = { diff --git a/src/boards/430.c b/src/boards/430.c index 8fc0227..7483e1b 100644 --- a/src/boards/430.c +++ b/src/boards/430.c @@ -21,12 +21,12 @@ #include "mapinc.h" #include "mmc3.h" -static void M430CW(uint32 A, uint8 V) { - uint8 mask = (EXPREGS[0] & 4) ? 0x7F : 0xFF; +static void M430CW(uint32_t A, uint8_t V) { + uint8_t mask = (EXPREGS[0] & 4) ? 0x7F : 0xFF; setchr1(A, ((EXPREGS[0] << 6) & ~mask) | (V & mask)); } -static void M430PW(uint32 A, uint8 V) { +static void M430PW(uint32_t A, uint8_t V) { if (EXPREGS[0] & 8) { setprg8(0x8000, ((EXPREGS[0] << 4) & 0x30) | ((DRegBuf[6] & ~2) & 0x0F)); setprg8(0xA000, ((EXPREGS[0] << 4) & 0x30) | ((DRegBuf[7] & ~2) & 0x0F)); diff --git a/src/boards/431.c b/src/boards/431.c index afc9ef9..44df737 100644 --- a/src/boards/431.c +++ b/src/boards/431.c @@ -20,8 +20,8 @@ #include "mapinc.h" -static uint8 inner_bank; -static uint8 outer_bank; +static uint8_t inner_bank; +static uint8_t outer_bank; static SFORMAT StateRegs[] = { diff --git a/src/boards/432.c b/src/boards/432.c index 9cb9681..1e14399 100644 --- a/src/boards/432.c +++ b/src/boards/432.c @@ -23,9 +23,9 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 submapper; -static uint8 reg[2]; -static uint8 pad; +static uint8_t submapper; +static uint8_t reg[2]; +static uint8_t pad; static DECLFR (readPad) { return pad; @@ -49,7 +49,7 @@ static void sync () { SetReadHandler(0x8000, 0xFFFF, submapper == 1 && reg[1] &0x20 || submapper != 1 && reg[0] &0x01? readPad: CartBR); } -static int getPRGBank (uint8 bank) { +static int getPRGBank (uint8_t bank) { if (reg[1] &0x40) { int mask = reg[1] &(submapper == 2? 0x20: 0x80)? 3: 1; return MMC3_getPRGBank(bank &1) &~mask | bank &mask; @@ -57,7 +57,7 @@ static int getPRGBank (uint8 bank) { return MMC3_getPRGBank(bank); } -static int getCHRBank (uint8 bank) { +static int getCHRBank (uint8_t bank) { if (reg[1] &0x20 && submapper == 3) return MMC3_getCHRBank(bank &6 | bank >>1 &1) <<1 | bank &1; else diff --git a/src/boards/433.c b/src/boards/433.c index 07dba88..99e63ef 100644 --- a/src/boards/433.c +++ b/src/boards/433.c @@ -24,7 +24,7 @@ #include "mapinc.h" -static uint8 latche; +static uint8_t latche; static SFORMAT StateRegs[] = { diff --git a/src/boards/434.c b/src/boards/434.c index eda4790..6e7e583 100644 --- a/src/boards/434.c +++ b/src/boards/434.c @@ -23,7 +23,7 @@ #include "mapinc.h" -static uint16 latch; +static uint16_t latch; static void Mapper434_Sync(void) { setprg16(0x8000, latch); diff --git a/src/boards/437.c b/src/boards/437.c index 77f6b00..ea63b0e 100644 --- a/src/boards/437.c +++ b/src/boards/437.c @@ -23,7 +23,7 @@ #include "mapinc.h" -static uint8 latch; +static uint8_t latch; static void Mapper437_Sync(void) { setprg16(0x8000, latch); diff --git a/src/boards/438.c b/src/boards/438.c index ca6063a..0a7d823 100644 --- a/src/boards/438.c +++ b/src/boards/438.c @@ -22,7 +22,7 @@ #include "asic_latch.h" #include "cartram.h" -static uint8 unrom; +static uint8_t unrom; static void sync0 () { if (Latch_address &0x01) diff --git a/src/boards/439.c b/src/boards/439.c index 8874609..0351301 100644 --- a/src/boards/439.c +++ b/src/boards/439.c @@ -25,8 +25,8 @@ #include "mapinc.h" #include "latch.h" -static uint8 reg[2]; -static uint8 pad; +static uint8_t reg[2]; +static uint8_t pad; static void Sync(void) { diff --git a/src/boards/441.c b/src/boards/441.c index 8589d26..81bbbab 100644 --- a/src/boards/441.c +++ b/src/boards/441.c @@ -24,9 +24,9 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 submapper; +static uint8_t submapper; -static void Mapper441_PRGWrap(uint32 A, uint8 V) { +static void Mapper441_PRGWrap(uint32_t A, uint8_t V) { int prgAND = EXPREGS[0] &0x08? 0x0F: 0x1F; int prgOR = EXPREGS[0] <<4 &0x30; if (EXPREGS[0] &0x04) { @@ -38,7 +38,7 @@ static void Mapper441_PRGWrap(uint32 A, uint8 V) { setprg8(A, V &prgAND | prgOR &~prgAND); } -static void Mapper441_CHRWrap(uint32 A, uint8 V) { +static void Mapper441_CHRWrap(uint32_t A, uint8_t V) { int chrAND = EXPREGS[0] &0x40? 0x7F: 0xFF; int chrOR = EXPREGS[0] <<3 &0x180; setchr1(A, V &chrAND | chrOR &~chrAND); diff --git a/src/boards/443.c b/src/boards/443.c index 034f615..2fe83d8 100644 --- a/src/boards/443.c +++ b/src/boards/443.c @@ -23,9 +23,9 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 dip; +static uint8_t dip; -static void Mapper443_PRGWrap(uint32 A, uint8 V) { +static void Mapper443_PRGWrap(uint32_t A, uint8_t V) { int prgAND =0x0F; int prgOR =EXPREGS[0] <<4 &0x20 | EXPREGS[0] &0x10; if (EXPREGS[0] &0x04) { @@ -37,7 +37,7 @@ static void Mapper443_PRGWrap(uint32 A, uint8 V) { setprg8(A, V &prgAND | prgOR &~prgAND); } -static void Mapper443_CHRWrap(uint32 A, uint8 V) { +static void Mapper443_CHRWrap(uint32_t A, uint8_t V) { int chrAND =0xFF; int chrOR =EXPREGS[0] <<8; setchr1(A, V &chrAND | chrOR &~chrAND); diff --git a/src/boards/444.c b/src/boards/444.c index 3872f56..56315cb 100644 --- a/src/boards/444.c +++ b/src/boards/444.c @@ -24,10 +24,10 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 pads; -static uint8 dip; +static uint8_t pads; +static uint8_t dip; -static void Mapper444_PRGWrap(uint32 A, uint8 V) { +static void Mapper444_PRGWrap(uint32_t A, uint8_t V) { int prgAND =pads &4 && EXPREGS[0] &0x02? 0x1F: 0x0F; int prgOR =EXPREGS[0] <<4; if (EXPREGS[0] &0x04) { @@ -39,7 +39,7 @@ static void Mapper444_PRGWrap(uint32 A, uint8 V) { setprg8(A, V &prgAND | prgOR &~prgAND); } -static void Mapper444_CHRWrap(uint32 A, uint8 V) { +static void Mapper444_CHRWrap(uint32_t A, uint8_t V) { int chrAND =pads &1? 0xFF: 0x7F; int chrOR =EXPREGS[0] <<7 &(pads &1? 0x00: 0x80) | EXPREGS[0] <<(pads &2? 4: 7) &0x100; setchr1(A, V &chrAND | chrOR &~chrAND); diff --git a/src/boards/445.c b/src/boards/445.c index 0c5a77e..0fcad5a 100644 --- a/src/boards/445.c +++ b/src/boards/445.c @@ -23,8 +23,8 @@ #include "asic_mmc3.h" #include "asic_vrc2and4.h" -static uint8 reg[4]; -static uint8 dip; +static uint8_t reg[4]; +static uint8_t dip; static SFORMAT stateRegs[] = { { reg, 4, "REGS" }, @@ -66,7 +66,7 @@ static void sync () { SetReadHandler(0x8000, 0xFFFF, reg[0] &0xC0 && (reg[0] &0xC0) == dip? NULL: CartBR); } -static void applyMode (uint8 clear) { +static void applyMode (uint8_t clear) { if ((reg[2] >>3 &7) >= 5) Latch_activate(clear, sync, 0x8000, 0xFFFF, NULL); else diff --git a/src/boards/446.c b/src/boards/446.c index da4cdd3..18e378b 100644 --- a/src/boards/446.c +++ b/src/boards/446.c @@ -35,10 +35,10 @@ #include "flashrom.h" #include "cartram.h" -static uint8 submapper; -static uint8 reg[8]; +static uint8_t submapper; +static uint8_t reg[8]; static void (*mapperSync)(int, int, int, int) = NULL; -static void applyMode (uint8); +static void applyMode (uint8_t); static void sync () { int prgAND = reg[3] ^ (submapper == 2? 0x00: 0xFF); @@ -244,11 +244,11 @@ static DECLFW (writeFlash) { flashrom_write(A &0x1FFF | (Page[A >>11] +A -PRGptr[0]) &~0x1FFF, V); } -static int SUROM_getPRGBank (uint8 bank) { +static int SUROM_getPRGBank (uint8_t bank) { return MMC1_getPRGBank(bank) | MMC1_getCHRBank(0) &0x10; } -static int Mapper22_getCHRBank (uint8 bank) { +static int Mapper22_getCHRBank (uint8_t bank) { return VRC24_getCHRBank(bank &7) >>1; } @@ -260,7 +260,7 @@ static DECLFW (writeReg) { sync(); } -static void applyMode (uint8 clear) { +static void applyMode (uint8_t clear) { if (reg[0] &0x80) { SetWriteHandler(0x5000, 0x5FFF, CartBW); switch(submapper <<8 | reg[0] &0x1F) { diff --git a/src/boards/447.c b/src/boards/447.c index 79d516d..edcb619 100644 --- a/src/boards/447.c +++ b/src/boards/447.c @@ -22,9 +22,9 @@ #include "asic_vrc2and4.h" #include "cartram.h" -static uint8 submapper; -static uint8 reg; -static uint8 pad; +static uint8_t submapper; +static uint8_t reg; +static uint8_t pad; static void sync () { VRC24_syncPRG(0x0F, reg <<4); @@ -33,7 +33,7 @@ static void sync () { VRC24_syncWRAM(0); } -static int getPRGBank (uint8 bank) { +static int getPRGBank (uint8_t bank) { if (reg &0x04) { int mask = reg &(submapper == 0? 0x02: 0x08) ? 1: 3; return VRC24_getPRGBank(bank &1) &~mask | bank &mask; diff --git a/src/boards/448.c b/src/boards/448.c index 04576ee..f097e34 100644 --- a/src/boards/448.c +++ b/src/boards/448.c @@ -22,7 +22,7 @@ #include "asic_vrc2and4.h" #include "cartram.h" -static uint8 reg; +static uint8_t reg; static SFORMAT stateRegs[] ={ { ®, 1, "EXP0" }, diff --git a/src/boards/449.c b/src/boards/449.c index 21f899e..db7ec08 100644 --- a/src/boards/449.c +++ b/src/boards/449.c @@ -21,9 +21,9 @@ #include "mapinc.h" #include "asic_latch.h" -static uint8 submapper; -uint8 pad; -uint8 padSelect; +static uint8_t submapper; +uint8_t pad; +uint8_t padSelect; static DECLFR (readPad_submapper0) { return CartBR(A &~0xF | pad &0xF); diff --git a/src/boards/451.c b/src/boards/451.c index ac7d9a2..373fe6f 100644 --- a/src/boards/451.c +++ b/src/boards/451.c @@ -24,7 +24,7 @@ #include "mmc3.h" #include "flashrom.h" -static void PRGWrap(uint32 A, uint8 V) { +static void PRGWrap(uint32_t A, uint8_t V) { if (A ==0x8000) V =0x00; else if (A ==0xE000) V =0x30; setprg8(A, V); diff --git a/src/boards/452.c b/src/boards/452.c index bd83f51..cb452fe 100644 --- a/src/boards/452.c +++ b/src/boards/452.c @@ -23,12 +23,12 @@ #include "mapinc.h" -static uint8 *WRAM; -static uint32 WRAMSIZE; -static uint16 latch[2]; -static uint8 submapper; +static uint8_t *WRAM; +static uint32_t WRAMSIZE; +static uint16_t latch[2]; +static uint8_t submapper; -static void SetWRAM(uint16 A) { +static void SetWRAM(uint16_t A) { setprg8r(0x10, A, 0); SetWriteHandler(A, A |0x1FFF, CartBW); } @@ -69,7 +69,7 @@ static void Mapper452_Sync(void) { setchr8(0); setmirror(latch[0] &0x800? MI_H: MI_V); } else { - uint8 wramBank = latch[1] >>3 &6 |8; + uint8_t wramBank = latch[1] >>3 &6 |8; if (latch[1] &2) { setprg8(0x8000, latch[0] >>1); setprg8(0xA000, latch[0] >>1); @@ -129,7 +129,7 @@ void Mapper452_Init(CartInfo *info) { GameStateRestore = StateRestore; WRAMSIZE =8192; - WRAM =(uint8*) FCEU_gmalloc(WRAMSIZE); + WRAM =(uint8_t*) FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); AddExState(&latch, 4, 0, "LATC"); diff --git a/src/boards/454.c b/src/boards/454.c index 99b65ab..928ef62 100644 --- a/src/boards/454.c +++ b/src/boards/454.c @@ -23,10 +23,10 @@ #include "latch.h" static void Sync(void) { - uint8 prg = ((latch.addr >> 3) & 0x20) | ((latch.addr >> 2) & 0x1F); - uint8 cpuA14 = latch.addr & 0x01; - uint8 nrom = (latch.addr >> 7) & 0x01; - uint8 unrom = (latch.addr >> 8) & 0x01; + uint8_t prg = ((latch.addr >> 3) & 0x20) | ((latch.addr >> 2) & 0x1F); + uint8_t cpuA14 = latch.addr & 0x01; + uint8_t nrom = (latch.addr >> 7) & 0x01; + uint8_t unrom = (latch.addr >> 8) & 0x01; setprg16(0x8000, ((prg & ~cpuA14) & ~(0x07 * unrom)) | (latch.data * unrom)); setprg16(0xC000, ((prg | cpuA14) & ~(0x1F * !nrom * !unrom)) | (0x07 * unrom)); diff --git a/src/boards/455.c b/src/boards/455.c index c76eced..4cafbd4 100644 --- a/src/boards/455.c +++ b/src/boards/455.c @@ -23,7 +23,7 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg[2]; +static uint8_t reg[2]; static void sync () { if (reg[0] &0x01) { diff --git a/src/boards/456.c b/src/boards/456.c index 33bf824..ad8f4ef 100644 --- a/src/boards/456.c +++ b/src/boards/456.c @@ -21,11 +21,11 @@ #include "mapinc.h" #include "mmc3.h" -static void Mapper456_PRGWrap(uint32 A, uint8 V) { +static void Mapper456_PRGWrap(uint32_t A, uint8_t V) { setprg8(A, V &0x0F | EXPREGS[0] <<4); } -static void Mapper456_CHRWrap(uint32 A, uint8 V) { +static void Mapper456_CHRWrap(uint32_t A, uint8_t V) { setchr1(A, V &0x7F | EXPREGS[0] <<7); } diff --git a/src/boards/457.c b/src/boards/457.c index e67bc93..46e7343 100644 --- a/src/boards/457.c +++ b/src/boards/457.c @@ -21,13 +21,13 @@ #include "mapinc.h" #include "mmc3.h" -static void M457CW(uint32 A, uint8 V) { - uint32 mask = (EXPREGS[0] & 8) ? 0xFF : 0x7F; +static void M457CW(uint32_t A, uint8_t V) { + uint32_t mask = (EXPREGS[0] & 8) ? 0xFF : 0x7F; setchr1(A, ((EXPREGS[0] << 7) & ~mask) | (V & mask)); } -static void M457PW(uint32 A, uint8 V) { - uint32 mask = (EXPREGS[0] & 8) ? 0x1F : 0x0F; +static void M457PW(uint32_t A, uint8_t V) { + uint32_t mask = (EXPREGS[0] & 8) ? 0x1F : 0x0F; setprg8(A, (((EXPREGS[0] & 7) << 4) & ~mask) | (V & mask)); } diff --git a/src/boards/458.c b/src/boards/458.c index 5ae5b05..8ea33f1 100644 --- a/src/boards/458.c +++ b/src/boards/458.c @@ -23,9 +23,9 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 submapper; -static uint8 reg; -static uint8 pad; +static uint8_t submapper; +static uint8_t reg; +static uint8_t pad; static DECLFR (readPad) { return CartBR(A &~0xF | pad &0xF); diff --git a/src/boards/46.c b/src/boards/46.c index 04e0312..c4106b7 100644 --- a/src/boards/46.c +++ b/src/boards/46.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 reg0, reg1; +static uint8_t reg0, reg1; static SFORMAT StateRegs[] = { diff --git a/src/boards/460.c b/src/boards/460.c index 1345e28..b082ba6 100644 --- a/src/boards/460.c +++ b/src/boards/460.c @@ -24,9 +24,9 @@ #include "asic_mmc3.h" #include "cartram.h" -static uint8 submapper; -static uint8 reg; -static uint8 pad; +static uint8_t submapper; +static uint8_t reg; +static uint8_t pad; static DECLFR (readPad) { return CartBR(A &~3 | pad &3); @@ -42,7 +42,7 @@ static void sync () { SetReadHandler(0x8000, 0xFFFF, submapper == 0 && reg &0x80 || submapper == 1 && reg &0x20? readPad: CartBR); } -static int getPRGBank (uint8 bank) { +static int getPRGBank (uint8_t bank) { if (reg &0x08) { int mask = reg &0x10? 3: 1; return MMC3_getPRGBank(bank &1) &~mask | bank &mask; @@ -50,7 +50,7 @@ static int getPRGBank (uint8 bank) { return MMC3_getPRGBank(bank); } -static int getCHRBank (uint8 bank) { +static int getCHRBank (uint8_t bank) { if (reg &0x04) return MMC3_getCHRBank(bank &6 | bank >>1 &1) <<1 | bank &1; else diff --git a/src/boards/461.c b/src/boards/461.c index 47d20c8..11e554b 100644 --- a/src/boards/461.c +++ b/src/boards/461.c @@ -23,7 +23,7 @@ #include "mapinc.h" #include "asic_mmc1.h" -static uint8 reg; +static uint8_t reg; static void sync () { if (reg &0x04) { diff --git a/src/boards/463.c b/src/boards/463.c index 3c70244..814aca3 100644 --- a/src/boards/463.c +++ b/src/boards/463.c @@ -20,8 +20,8 @@ #include "mapinc.h" -static uint8 regs[4] = { 0 }; -static uint8 dipswitch = 0; +static uint8_t regs[4] = { 0 }; +static uint8_t dipswitch = 0; static SFORMAT StateRegs[] = { { regs, 4, "EXPR" }, diff --git a/src/boards/465.c b/src/boards/465.c index ef5164b..0400b50 100644 --- a/src/boards/465.c +++ b/src/boards/465.c @@ -20,8 +20,8 @@ #include "mapinc.h" -static uint16 latchAddr; -static uint8 latchData; +static uint16_t latchAddr; +static uint8_t latchData; static SFORMAT StateRegs[] = { diff --git a/src/boards/466.c b/src/boards/466.c index a8ad361..c83f531 100644 --- a/src/boards/466.c +++ b/src/boards/466.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 regs[3]; +static uint8_t regs[3]; static SFORMAT StateRegs[] = { diff --git a/src/boards/467.c b/src/boards/467.c index 268a1a6..f990858 100644 --- a/src/boards/467.c +++ b/src/boards/467.c @@ -20,7 +20,7 @@ #include "mapinc.h" #include "mmc3.h" -static void Mapper467_PRGWrap(uint32 A, uint8 V) { +static void Mapper467_PRGWrap(uint32_t A, uint8_t V) { if (EXPREGS[0] &0x20) { int prgAND =EXPREGS[0] &0x40? 0x0F: 0x03; int prgOR =EXPREGS[0] <<1 &0x3C | 0x40; @@ -30,7 +30,7 @@ static void Mapper467_PRGWrap(uint32 A, uint8 V) { setprg16(A, EXPREGS[0] &0x1F); } -static void Mapper467_CHRWrap(uint32 A, uint8 V) { +static void Mapper467_CHRWrap(uint32_t A, uint8_t V) { if (~A &0x0800) { A =A &~0x400 | A <<1 &0x800; if (EXPREGS[0] &0x40) diff --git a/src/boards/468.c b/src/boards/468.c index 70110c8..53c72ec 100644 --- a/src/boards/468.c +++ b/src/boards/468.c @@ -31,13 +31,13 @@ #include "asic_vrc7.h" #include "cartram.h" -static uint8 submapper; -static uint8 reg[4]; /* Supervisor registers */ -static uint8 Custom_reg[4]; /* Registers for custom mappers */ -static uint8 eeprom[16], eep_clock, state, command, output; /* Serial EEPROM */ +static uint8_t submapper; +static uint8_t reg[4]; /* Supervisor registers */ +static uint8_t Custom_reg[4]; /* Registers for custom mappers */ +static uint8_t eeprom[16], eep_clock, state, command, output; /* Serial EEPROM */ static void (*mapperSync)(int) = NULL; -static void applyMode (uint8); +static void applyMode (uint8_t); static SFORMAT stateRegs[] = { { ®, 4, "REGS" }, @@ -51,7 +51,7 @@ static SFORMAT stateRegs[] = { }; /* Serial EEPROM */ -static const uint16 lut509[512] = { /* Look-up table, used only by Legendary Games of NES 509-in-1 */ +static const uint16_t lut509[512] = { /* Look-up table, used only by Legendary Games of NES 509-in-1 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 0, 1, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 4, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, @@ -67,7 +67,7 @@ static const uint16 lut509[512] = { /* Look-up table, used only by Legendary Gam 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 512, 513, 514, 515, 516, 517 }; -static void setPins(uint8 select, uint8 newClock, uint8 newData) { /* Serial EEPROM */ +static void setPins(uint8_t select, uint8_t newClock, uint8_t newData) { /* Serial EEPROM */ if (select) state = 0; else @@ -259,7 +259,7 @@ static void sync_SUROM (int prgOR) { MMC1_syncMirror(); } -static int SUROM_getPRGBank (uint8 bank) { +static int SUROM_getPRGBank (uint8_t bank) { return MMC1_getPRGBank(bank) | MMC1_getCHRBank(0) &0x10; } @@ -380,8 +380,8 @@ static DECLFW (writeReg) { } } -static void applyMode (uint8 clear) { - uint8 previousMirroring; +static void applyMode (uint8_t clear) { + uint8_t previousMirroring; MapIRQHook = NULL; PPU_hook = NULL; GameHBIRQHook = NULL; diff --git a/src/boards/471.c b/src/boards/471.c index 2dbb83d..0659c9a 100644 --- a/src/boards/471.c +++ b/src/boards/471.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 latch; +static uint8_t latch; static SFORMAT stateRegs[] ={ { &latch, 1, "LATC" }, diff --git a/src/boards/473.c b/src/boards/473.c index af1b193..08d93b4 100644 --- a/src/boards/473.c +++ b/src/boards/473.c @@ -20,7 +20,7 @@ #include "mapinc.h" #include "mmc3.h" -static void Mapper473_PRGWrap(uint32 A, uint8 V) { +static void Mapper473_PRGWrap(uint32_t A, uint8_t V) { int prgAND =EXPREGS[0] &0x20? (0xFF >> (7 -(EXPREGS[0] &7))): 0x00; int prgOR =EXPREGS[0] &0x20? (EXPREGS[1] | EXPREGS[2] <<8): 0x3F; setprg8(A, V &prgAND | prgOR &~prgAND); @@ -28,7 +28,7 @@ static void Mapper473_PRGWrap(uint32 A, uint8 V) { SetWriteHandler(0xC000, 0xFFFF, EXPREGS[0] &0x40? CartBW: MMC3_IRQWrite); } -static void Mapper473_CHRWrap(uint32 A, uint8 V) { +static void Mapper473_CHRWrap(uint32_t A, uint8_t V) { if (~EXPREGS[0] &0x80) setchr8(EXPREGS[3]); else diff --git a/src/boards/474.c b/src/boards/474.c index 49d7a89..b150a76 100644 --- a/src/boards/474.c +++ b/src/boards/474.c @@ -20,7 +20,7 @@ #include "mapinc.h" #include "mmc3.h" -static void PRGWrap(uint32 A, uint8 V) { +static void PRGWrap(uint32_t A, uint8_t V) { if (EXPREGS[0] &0x04) { setprg16(0x8000, EXPREGS[0] >>3 &0x1F | EXPREGS[0] <<5 &0x20); setprg16(0xC000, EXPREGS[0] >>3 &0x1F | EXPREGS[0] <<5 &0x20); @@ -28,7 +28,7 @@ static void PRGWrap(uint32 A, uint8 V) { setprg32(0x8000, EXPREGS[0] >>4 &0x0F | EXPREGS[0] <<4 &0x10); } -static void CHRWrap(uint32 A, uint8 V) { +static void CHRWrap(uint32_t A, uint8_t V) { setchr1(A, V &0xFF | EXPREGS[0] <<7 &0x100); } diff --git a/src/boards/475.c b/src/boards/475.c index 69b9b7c..18a8ad1 100644 --- a/src/boards/475.c +++ b/src/boards/475.c @@ -20,7 +20,7 @@ #include "mapinc.h" #include "mmc3.h" -static void PRGWrap(uint32 A, uint8 V) { +static void PRGWrap(uint32_t A, uint8_t V) { if (EXPREGS[1] &1) { if ((EXPREGS[0] &3) ==3) setprg32(0x8000, EXPREGS[0] <<2 &0xC | EXPREGS[0] >>2 &0x3); @@ -30,7 +30,7 @@ static void PRGWrap(uint32 A, uint8 V) { setprg32(0x8000, EXPREGS[0] >>4 &0x3 | 0x10); } -static void CHRWrap(uint32 A, uint8 V) { +static void CHRWrap(uint32_t A, uint8_t V) { if (EXPREGS[1] &1) setchr1(A, V &0x7F | EXPREGS[0] <<7 &0x180); else diff --git a/src/boards/476.c b/src/boards/476.c index 740488e..6cad5fe 100644 --- a/src/boards/476.c +++ b/src/boards/476.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 reg[4]; +static uint8_t reg[4]; static readfunc read4016 =NULL; static SFORMAT stateRegs[] ={ @@ -41,7 +41,7 @@ static void sync () { static DECLFR(remapButtons) { int i; - uint8 result =0x40; + uint8_t result =0x40; GetWriteHandler(0x4016)(0x4016, 1); GetWriteHandler(0x4016)(0x4016, 0); if (A ==0x4016) { diff --git a/src/boards/478.c b/src/boards/478.c index 395a9aa..19578bc 100644 --- a/src/boards/478.c +++ b/src/boards/478.c @@ -23,12 +23,12 @@ #include "mapinc.h" #include "mmc3.h" -static void PRGWrap(uint32 A, uint8 V) { +static void PRGWrap(uint32_t A, uint8_t V) { int prgAND =EXPREGS[0] &8 && EXPREGS[0] &4? 0x03: 0x0F; setprg8(A, V &prgAND | EXPREGS[0] <<2 &~prgAND); } -static void CHRWrap(uint32 A, uint8 V) { +static void CHRWrap(uint32_t A, uint8_t V) { int chrAND =EXPREGS[0] &8 && EXPREGS[0] &4? 0x1F: 0x7F; setchr1(A, V &chrAND | EXPREGS[0] <<5 &~chrAND); } diff --git a/src/boards/480.c b/src/boards/480.c index dddd00b..2ae698b 100644 --- a/src/boards/480.c +++ b/src/boards/480.c @@ -21,26 +21,26 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 submapper; -static uint8 *CHRRAM =NULL; -static uint32 CHRRAMSIZE; +static uint8_t submapper; +static uint8_t *CHRRAM =NULL; +static uint32_t CHRRAMSIZE; -static void PRGWrap0(uint32 A, uint8 V) { +static void PRGWrap0(uint32_t A, uint8_t V) { int prgAND =EXPREGS[0] &0x20? 0x1F: 0x0F; setprg8(A, V &prgAND | EXPREGS[0] <<4 &~prgAND); } -static void CHRWrap0(uint32 A, uint8 V) { +static void CHRWrap0(uint32_t A, uint8_t V) { int chrAND =EXPREGS[0] &0x20? 0xFF: 0x7F; setchr1(A, V &chrAND | EXPREGS[0] <<7 &~chrAND); } -static void PRGWrap1(uint32 A, uint8 V) { +static void PRGWrap1(uint32_t A, uint8_t V) { int prgAND =(EXPREGS[0] &0x1F) ==0x1F? 0x1F: 0x0F; setprg8(A, V &prgAND | EXPREGS[0] <<4 &~prgAND); } -static void CHRWrap1(uint32 A, uint8 V) { +static void CHRWrap1(uint32_t A, uint8_t V) { int chrAND =(EXPREGS[0] &0x1F) ==0x19? 0xFF: 0x7F; if (EXPREGS[0] &0x20) setchr8r(0x10, 0); @@ -48,7 +48,7 @@ static void CHRWrap1(uint32 A, uint8 V) { setchr1(A, V &chrAND | EXPREGS[0] <<7 &~chrAND); } -static void PRGWrap2(uint32 A, uint8 V) { +static void PRGWrap2(uint32_t A, uint8_t V) { int prgAND =(EXPREGS[0] &0x0E) ==0x0E? 0x1F: 0x0F; if (EXPREGS[0] &0x20) setprg32(0x8000, EXPREGS[1] &3 | EXPREGS[0] <<2 &~3); @@ -56,7 +56,7 @@ static void PRGWrap2(uint32 A, uint8 V) { setprg8(A, V &prgAND | EXPREGS[0] <<4 &~prgAND); } -static void CHRWrap2(uint32 A, uint8 V) { +static void CHRWrap2(uint32_t A, uint8_t V) { int chrAND =(EXPREGS[0] &0x0F) ==0x03 || (EXPREGS[0] &0x0F) ==0x0F? 0xFF: 0x7F; if (EXPREGS[0] &0x10) { setchr2(0x0000, DRegBuf[0] &0xFE | 0x400); @@ -106,7 +106,7 @@ void Mapper480_Init(CartInfo *info) { AddExState(EXPREGS, 2, 0, "EXPR"); if (submapper ==1) { CHRRAMSIZE = 8192; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM = (uint8_t*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR"); } diff --git a/src/boards/482.c b/src/boards/482.c index cd12e2e..42ade68 100644 --- a/src/boards/482.c +++ b/src/boards/482.c @@ -22,7 +22,7 @@ #include "mapinc.h" #include "latch.h" -static uint8 dip; +static uint8_t dip; static SFORMAT StateRegs[] = { { &dip, 1, "DIPS" }, diff --git a/src/boards/483.c b/src/boards/483.c index 8bd4387..f27518e 100644 --- a/src/boards/483.c +++ b/src/boards/483.c @@ -26,7 +26,7 @@ #include "asic_latch.h" #include "asic_mmc1.h" -static uint8 game; +static uint8_t game; static void sync_SLROM () { MMC1_syncPRG(0x07, game <<3); @@ -46,7 +46,7 @@ static void sync_SEROM () { MMC1_syncMirror(); } -static void applyMode (uint8 clear) { +static void applyMode (uint8_t clear) { if (game <= 2) MMC1_activate(clear, sync_SLROM, MMC1_TYPE_MMC1B, NULL, NULL, NULL, NULL); else diff --git a/src/boards/484.c b/src/boards/484.c index 857672b..32d7119 100644 --- a/src/boards/484.c +++ b/src/boards/484.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "mmc3.h" -static void PRGWrap(uint32 A, uint8 V) { +static void PRGWrap(uint32_t A, uint8_t V) { int prgAND =EXPREGS[0] &0x80? 0x1F: 0x3F; int prgOR =EXPREGS[0] <<5 &0x20; setprg8(A, V &prgAND | prgOR &~prgAND); diff --git a/src/boards/485.c b/src/boards/485.c index 91548b5..2ab1bfe 100644 --- a/src/boards/485.c +++ b/src/boards/485.c @@ -22,7 +22,7 @@ #include "mapinc.h" #include "latch.h" -static uint8 reg; +static uint8_t reg; static SFORMAT StateRegs[] = { { ®, 1, "REG " }, diff --git a/src/boards/487.c b/src/boards/487.c index 07417e2..e39e8ec 100644 --- a/src/boards/487.c +++ b/src/boards/487.c @@ -21,8 +21,8 @@ #include "mapinc.h" -static uint8 reg[2]; -static uint8 submapper; +static uint8_t reg[2]; +static uint8_t submapper; static SFORMAT StateRegs[] ={ { reg, 2, "REGS" }, diff --git a/src/boards/490.c b/src/boards/490.c index 30c7fce..a377b68 100644 --- a/src/boards/490.c +++ b/src/boards/490.c @@ -23,8 +23,8 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg; -static uint8 pad; +static uint8_t reg; +static uint8_t pad; static DECLFR (readPad) { return CartBR(A &~0xF | pad &0xF); diff --git a/src/boards/493.c b/src/boards/493.c index bef0875..fb1cf6f 100644 --- a/src/boards/493.c +++ b/src/boards/493.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 reg[2]; +static uint8_t reg[2]; static void sync () { setprg32(0x8000, reg[0] <<1 | reg[1] &0x01); diff --git a/src/boards/494.c b/src/boards/494.c index f7b1dbb..ce12cd9 100644 --- a/src/boards/494.c +++ b/src/boards/494.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "asic_latch.h" -static uint8 pad; +static uint8_t pad; static DECLFR (readOB) { return X.DB; diff --git a/src/boards/495.c b/src/boards/495.c index 65568ec..c8ab9d3 100644 --- a/src/boards/495.c +++ b/src/boards/495.c @@ -20,9 +20,9 @@ #include "mapinc.h" -static uint8 prg[3]; -static uint8 chr[4]; -static uint8 latch[2]; +static uint8_t prg[3]; +static uint8_t chr[4]; +static uint8_t latch[2]; static SFORMAT stateRegs[] = { { prg, 3, "PRGR" }, @@ -46,7 +46,7 @@ static void sync () { } } -static void FP_FASTAPASS(1) trapPPUAddressChange (uint32 A) { +static void FP_FASTAPASS(1) trapPPUAddressChange (uint32_t A) { if ((A &0x2FF0) == 0xFD0 || (A &0x2FF0) == 0xFE0) { latch[A >>12 &1] = ~A >>5 &1; sync(); diff --git a/src/boards/498.c b/src/boards/498.c index 6befb42..99b74d1 100644 --- a/src/boards/498.c +++ b/src/boards/498.c @@ -23,7 +23,7 @@ #include "mapinc.h" #include "asic_mmc1.h" -static uint8 reg; +static uint8_t reg; static void sync () { if (reg &0x20) diff --git a/src/boards/499.c b/src/boards/499.c index 340c0fd..cc7b3cd 100644 --- a/src/boards/499.c +++ b/src/boards/499.c @@ -23,7 +23,7 @@ #include "mapinc.h" #include "asic_mmc1.h" -static uint8 reg; +static uint8_t reg; static void sync () { MMC1_syncPRG(0x07, reg <<3); diff --git a/src/boards/50.c b/src/boards/50.c index 74d3e2f..1552d6a 100644 --- a/src/boards/50.c +++ b/src/boards/50.c @@ -23,8 +23,8 @@ #include "mapinc.h" -static uint8 reg; -static uint32 IRQCount, IRQa; +static uint8_t reg; +static uint32_t IRQCount, IRQa; static SFORMAT StateRegs[] = { diff --git a/src/boards/500.c b/src/boards/500.c index 0ecfa0e..5930d8f 100644 --- a/src/boards/500.c +++ b/src/boards/500.c @@ -22,7 +22,7 @@ #include "mapinc.h" #include "latch.h" -static uint8 reg[2]; +static uint8_t reg[2]; static SFORMAT StateRegs[] = { { reg, 2, "REGS" }, diff --git a/src/boards/501.c b/src/boards/501.c index 42564fd..d7be538 100644 --- a/src/boards/501.c +++ b/src/boards/501.c @@ -22,7 +22,7 @@ #include "mapinc.h" #include "latch.h" -static uint8 reg[2]; +static uint8_t reg[2]; static SFORMAT StateRegs[] = { { reg, 2, "REGS" }, diff --git a/src/boards/502.c b/src/boards/502.c index a6320d6..1f09e66 100644 --- a/src/boards/502.c +++ b/src/boards/502.c @@ -22,7 +22,7 @@ #include "mapinc.h" #include "latch.h" -static uint8 reg[2]; +static uint8_t reg[2]; static SFORMAT StateRegs[] = { { reg, 2, "REGS" }, @@ -30,7 +30,7 @@ static SFORMAT StateRegs[] = { }; static void Sync(void) { - uint8 mask = (8 << (reg[1] >> 4 & 3)) - 1; + uint8_t mask = (8 << (reg[1] >> 4 & 3)) - 1; setprg4(0x7000, 0); if (reg[1] & 6) setprg32(0x8000, (reg[0] << 2) + (latch.data & (mask >> 1))); diff --git a/src/boards/503.c b/src/boards/503.c index 04f944d..97bc90e 100644 --- a/src/boards/503.c +++ b/src/boards/503.c @@ -23,8 +23,8 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg; -static uint8 pad; +static uint8_t reg; +static uint8_t pad; static DECLFR (readPad) { return CartBR(A &~3 | pad &3); diff --git a/src/boards/504.c b/src/boards/504.c index 93e1a32..ecd1711 100644 --- a/src/boards/504.c +++ b/src/boards/504.c @@ -23,7 +23,7 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg; +static uint8_t reg; static void sync () { int prgAND = reg &0x02? 0x0F: 0x1F; @@ -35,7 +35,7 @@ static void sync () { MMC3_syncMirror(); } -static int getPRGBank (uint8 bank) { +static int getPRGBank (uint8_t bank) { if ((reg &0x03) == 0x03 && ~reg &0x08) return MMC3_getPRGBank(bank &1) &~1 | bank &1; else diff --git a/src/boards/505.c b/src/boards/505.c index 24b4555..dc74721 100644 --- a/src/boards/505.c +++ b/src/boards/505.c @@ -23,8 +23,8 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint16 reg; -static uint8 pad; +static uint16_t reg; +static uint8_t pad; static void sync () { if (reg &0x01) diff --git a/src/boards/506.c b/src/boards/506.c index aac7e49..323c957 100644 --- a/src/boards/506.c +++ b/src/boards/506.c @@ -23,7 +23,7 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg; +static uint8_t reg; static void sync () { int prgAND =~reg &3? 0x0F: 0x1F; diff --git a/src/boards/507.c b/src/boards/507.c index 0c01414..692491c 100644 --- a/src/boards/507.c +++ b/src/boards/507.c @@ -23,8 +23,8 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg; -static uint8 pad; +static uint8_t reg; +static uint8_t pad; static void sync () { int prgAND = reg &0x20? 0x0F: 0x1F; diff --git a/src/boards/508.c b/src/boards/508.c index 9a8a16b..f6ef763 100644 --- a/src/boards/508.c +++ b/src/boards/508.c @@ -23,8 +23,8 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg; -static uint8 pad; +static uint8_t reg; +static uint8_t pad; static void sync () { if (reg &0x80) diff --git a/src/boards/509.c b/src/boards/509.c index 4e61254..54ba101 100644 --- a/src/boards/509.c +++ b/src/boards/509.c @@ -24,7 +24,7 @@ #include "asic_mmc3.h" #include "cartram.h" -static uint8 reg; +static uint8_t reg; static void sync () { int prgAND = reg &0x10? 0x1F: 0x0F; diff --git a/src/boards/51.c b/src/boards/51.c index 35b1fb1..08f807e 100644 --- a/src/boards/51.c +++ b/src/boards/51.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 bank, mode; +static uint8_t bank, mode; static SFORMAT StateRegs[] = { { &bank, 1, "BANK" }, diff --git a/src/boards/510.c b/src/boards/510.c index b57eabe..518a567 100644 --- a/src/boards/510.c +++ b/src/boards/510.c @@ -24,7 +24,7 @@ #include "asic_mmc3.h" #include "cartram.h" -static uint8 reg; +static uint8_t reg; static void sync () { int prgAND = reg &0x20? 0x0F: 0x1F; diff --git a/src/boards/511.c b/src/boards/511.c index 3929975..7a986ca 100644 --- a/src/boards/511.c +++ b/src/boards/511.c @@ -23,8 +23,8 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg; -static uint8 pad; +static uint8_t reg; +static uint8_t pad; static DECLFR (readPad) { return CartBR(A &~0x3 | pad &0x3); @@ -41,7 +41,7 @@ static void sync () { SetReadHandler(0x8000, 0xFFFF, reg &0x08? readPad: CartBR); } -static int getPRGBank (uint8 bank) { +static int getPRGBank (uint8_t bank) { if (reg &0x04) { int mask = reg &0x02? 1: 3; return MMC3_getPRGBank(bank &1) &~mask | bank &mask; diff --git a/src/boards/512.c b/src/boards/512.c index c332e75..ddb9208 100644 --- a/src/boards/512.c +++ b/src/boards/512.c @@ -24,7 +24,7 @@ #include "asic_mmc3.h" #include "cartram.h" -static uint8 reg; +static uint8_t reg; static void sync () { MMC3_syncPRG(0x3F, 0x00); diff --git a/src/boards/514.c b/src/boards/514.c index 292a5cd..11e52de 100644 --- a/src/boards/514.c +++ b/src/boards/514.c @@ -22,7 +22,7 @@ #include "asic_latch.h" #include "cartram.h" -static uint8 chr; +static uint8_t chr; static void sync () { setprg8r(0x10, 0x6000, 0); @@ -32,7 +32,7 @@ static void sync () { setmirror(Latch_data &0x40? MI_H: MI_V); } -static void FP_FASTAPASS(1) trapPPUAddressChange (uint32 A) { +static void FP_FASTAPASS(1) trapPPUAddressChange (uint32_t A) { if (A &0x2000 && (A &0x23C0) < 0x23C0) { chr = A >>(10 +(Latch_data &0x40? 1: 0)) &1; setchr4(0x0000, Latch_data &0x80? chr: 0); diff --git a/src/boards/516.c b/src/boards/516.c index c9e5a86..4c6c6c8 100644 --- a/src/boards/516.c +++ b/src/boards/516.c @@ -23,12 +23,12 @@ #include "mapinc.h" #include "mmc3.h" -static void M516CW(uint32 A, uint8 V) { +static void M516CW(uint32_t A, uint8_t V) { /* FCEU_printf("CHR: A:%04x V:%02x R0:%02x\n", A, V, EXPREGS[0]); */ setchr1(A, (V & 0x7F) | ((EXPREGS[0] << 5) & 0x180)); } -static void M516PW(uint32 A, uint8 V) { +static void M516PW(uint32_t A, uint8_t V) { /* FCEU_printf("PRG: A:%04x V:%02x R0:%02x\n", A, V, EXPREGS[0]); */ setprg8(A, (V & 0x0F) | ((EXPREGS[0] << 4) & 0x30)); } diff --git a/src/boards/518.c b/src/boards/518.c index 9a8944c..207fee2 100644 --- a/src/boards/518.c +++ b/src/boards/518.c @@ -21,8 +21,8 @@ #include "mapinc.h" #include "cartram.h" -static uint8 reg[2]; -static uint8 chr; +static uint8_t reg[2]; +static uint8_t chr; static void sync () { setprg8r(0x10, 0x6000, 0); @@ -37,7 +37,7 @@ static void sync () { setmirror(reg[1] &0x01? MI_H: MI_V); } -static void FP_FASTAPASS(1) trapPPUAddressChange (uint32 A) { +static void FP_FASTAPASS(1) trapPPUAddressChange (uint32_t A) { if (A &0x2000 && (A &0x23C0) < 0x23C0) { chr = A >>(10 +(reg[1] &0x01? 1: 0)) &1; setchr4(0x0000, reg[1] &0x02? chr: 0); diff --git a/src/boards/524.c b/src/boards/524.c index 2658bdd..4afef32 100644 --- a/src/boards/524.c +++ b/src/boards/524.c @@ -21,8 +21,8 @@ #include "mapinc.h" #include "asic_vrc2and4.h" -static uint8 irqEnabled; -static uint16 irqCounter; +static uint8_t irqEnabled; +static uint16_t irqCounter; static SFORMAT stateRegs[] ={ { &irqEnabled, 1, "IRQE" }, diff --git a/src/boards/528.c b/src/boards/528.c index 7366dc6..5336a2c 100644 --- a/src/boards/528.c +++ b/src/boards/528.c @@ -25,10 +25,10 @@ #include "mapinc.h" #include "vrcirq.h" -static uint8 preg[4], creg[8], mirr; -static uint8 gamesel; -static uint8 *WRAM; -static uint32 WRAMSIZE; +static uint8_t preg[4], creg[8], mirr; +static uint8_t gamesel; +static uint8_t *WRAM; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -40,7 +40,7 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { - uint8 mask = (gamesel << 4) | 0x0F; + uint8_t mask = (gamesel << 4) | 0x0F; if (preg[3] == 1) { setprg8r(0x10, 0x6000, 0); } else { @@ -128,7 +128,7 @@ void Mapper528_Init(CartInfo *info) { AddExState(&StateRegs, ~0, 0, 0); WRAMSIZE = 8192; - WRAM = (uint8*) FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*) FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); } diff --git a/src/boards/529.c b/src/boards/529.c index af9e17b..5359cdd 100644 --- a/src/boards/529.c +++ b/src/boards/529.c @@ -22,7 +22,7 @@ #include "asic_vrc2and4.h" #include "eeprom_93Cx6.h" -static uint8 eeprom_data[256]; +static uint8_t eeprom_data[256]; static SFORMAT stateRegs[] ={ { eeprom_data, 256, "EEPR" }, diff --git a/src/boards/530.c b/src/boards/530.c index 66924e8..ca0a51e 100644 --- a/src/boards/530.c +++ b/src/boards/530.c @@ -27,12 +27,12 @@ static void sync () { VRC24_syncMirror(); } -static int getPRGBank (uint8 bank) { +static int getPRGBank (uint8_t bank) { int result =VRC24_getPRGBank(bank); return result <<2 &0x8 | result >>2 &0x2 | result &~0xA; } -static int getCHRBank (uint8 bank) { +static int getCHRBank (uint8_t bank) { int result =VRC24_getCHRBank(bank); return result <<1 &0x40 | result >>1 &0x20 | result &~0x60; } diff --git a/src/boards/533.c b/src/boards/533.c index 3465576..6afc32c 100644 --- a/src/boards/533.c +++ b/src/boards/533.c @@ -27,7 +27,7 @@ #include "mapinc.h" -static uint8 latche; +static uint8_t latche; static SFORMAT StateRegs[] = { { &latche, 1, "LATC" }, diff --git a/src/boards/536.c b/src/boards/536.c index 935e777..ccc6c98 100644 --- a/src/boards/536.c +++ b/src/boards/536.c @@ -25,7 +25,7 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg[2]; +static uint8_t reg[2]; static void sync () { int prg = reg[0] &0x1F | reg[0] >>1 &0x20; diff --git a/src/boards/537.c b/src/boards/537.c index e628180..6b0093e 100644 --- a/src/boards/537.c +++ b/src/boards/537.c @@ -25,7 +25,7 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg[2]; +static uint8_t reg[2]; static void sync () { int prgAND = reg[0] &0x80? 0x0F: 0x1F; diff --git a/src/boards/539.c b/src/boards/539.c index cfcc6b6..3044c83 100644 --- a/src/boards/539.c +++ b/src/boards/539.c @@ -23,9 +23,9 @@ #include "mapinc.h" #include "../fds_apu.h" -static uint8 preg; -static uint8 mirr; -static uint8 WRAM[8192]; +static uint8_t preg; +static uint8_t mirr; +static uint8_t WRAM[8192]; static SFORMAT StateRegs[] = { @@ -34,7 +34,7 @@ static SFORMAT StateRegs[] = { 0 } }; -static uint32 GetWRAMAddress(uint32 A) { +static uint32_t GetWRAMAddress(uint32_t A) { return ((A & 0x1FFF) | ((A < 0xC000) ? 0x1000 : 0x0000) | ((A < 0x8000) ? 0x0800 : 0x000)); diff --git a/src/boards/542.c b/src/boards/542.c index 6d4a23a..a5f9c8b 100644 --- a/src/boards/542.c +++ b/src/boards/542.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "asic_vrc2and4.h" -static uint8 reg; +static uint8_t reg; static SFORMAT stateRegs[] ={ { ®, 1, "EXP0" }, diff --git a/src/boards/544.c b/src/boards/544.c index ae9ca8c..ca4adbb 100644 --- a/src/boards/544.c +++ b/src/boards/544.c @@ -22,12 +22,12 @@ #include "asic_vrc2and4.h" #include "cartram.h" -static uint8 nt[4]; -static uint8 prg; -static uint8 mask; -static uint8 compare; +static uint8_t nt[4]; +static uint8_t prg; +static uint8_t mask; +static uint8_t compare; -extern uint32 RefreshAddr; +extern uint32_t RefreshAddr; static writefunc writePPU; static SFORMAT stateRegs[] ={ @@ -46,7 +46,7 @@ static void sync () { setmirrorw(nt[0] &1, nt[1] &1, nt[2] &1, nt[3] &1); } -static const uint8 compares[8] = { 0x28, 0x00, 0x4C, 0x64, 0x46, 0x7C, 0x04, 0xFF }; +static const uint8_t compares[8] = { 0x28, 0x00, 0x4C, 0x64, 0x46, 0x7C, 0x04, 0xFF }; static DECLFW (interceptPPUWrite) { if (~RefreshAddr &0x2000) { int bank =VRC24_getCHRBank(RefreshAddr >>10 &7); @@ -65,7 +65,7 @@ static DECLFW (interceptPPUWrite) { writePPU(A, V); } -static int getPRGBank (uint8 bank) { +static int getPRGBank (uint8_t bank) { return bank ==2? prg: VRC24_getPRGBank(bank); } diff --git a/src/boards/545.c b/src/boards/545.c index bd28342..f722207 100644 --- a/src/boards/545.c +++ b/src/boards/545.c @@ -24,7 +24,7 @@ #include "asic_mmc3.h" #include "cartram.h" -static uint8 reg; +static uint8_t reg; static void sync () { MMC3_syncWRAM(0); @@ -33,7 +33,7 @@ static void sync () { MMC3_syncMirror(); } -static int getPRGBank (uint8 bank) { +static int getPRGBank (uint8_t bank) { int result = MMC3_getPRGBank(bank); if (reg &0x08 && ~result &0x10) result = 0x40 | result &0x0F; diff --git a/src/boards/546.c b/src/boards/546.c index e388215..d1a98c6 100644 --- a/src/boards/546.c +++ b/src/boards/546.c @@ -24,7 +24,7 @@ #include "asic_mmc1.h" #include "cartram.h" -static uint8 reg; +static uint8_t reg; static void sync () { MMC1_syncWRAM(0); diff --git a/src/boards/548.c b/src/boards/548.c index ca82a20..c4d96dd 100644 --- a/src/boards/548.c +++ b/src/boards/548.c @@ -24,10 +24,10 @@ #include "cartram.h" #include "../fds_apu.h" -static uint8 reg; -static uint8 latch; -static uint8 counting; -static uint16 counter; +static uint8_t reg; +static uint8_t latch; +static uint8_t counting; +static uint16_t counter; static SFORMAT stateRegs[] ={ { ®, 1, "REGM" }, diff --git a/src/boards/554.c b/src/boards/554.c index 8084a76..6026195 100644 --- a/src/boards/554.c +++ b/src/boards/554.c @@ -25,7 +25,7 @@ #include "mapinc.h" -static uint8 reg; +static uint8_t reg; static SFORMAT StateRegs[] = { diff --git a/src/boards/556.c b/src/boards/556.c index 3e6dd7f..494ac6e 100644 --- a/src/boards/556.c +++ b/src/boards/556.c @@ -27,8 +27,8 @@ #include "asic_vrc2and4.h" #include "cartram.h" -static uint8 reg[4]; -static uint8 rIdx; +static uint8_t reg[4]; +static uint8_t rIdx; static SFORMAT StateRegs[] = { { reg, 4, "REGS" }, @@ -54,7 +54,7 @@ static void sync (void) { } } -static void applyMode (uint8 clear) { +static void applyMode (uint8_t clear) { if (reg[2] &0x80) VRC4_activate(clear, sync, 0x05, 0x0A, 1, NULL, NULL, NULL, NULL, NULL); else diff --git a/src/boards/558.c b/src/boards/558.c index e9b8c96..287c593 100644 --- a/src/boards/558.c +++ b/src/boards/558.c @@ -25,11 +25,11 @@ #include "mapinc.h" #include "eeprom_93Cx6.h" -static uint8 *WRAM; -static uint32 WRAMSIZE; -static uint8 reg[4]; -static uint8 haveEEPROM; -static uint8 eeprom_data[512]; +static uint8_t *WRAM; +static uint32_t WRAMSIZE; +static uint8_t reg[4]; +static uint8_t haveEEPROM; +static uint8_t eeprom_data[512]; static SFORMAT StateRegs[] = { { reg, 4, "REGS" }, @@ -67,7 +67,7 @@ static DECLFR(readReg) static DECLFW(writeReg) { - uint8 index = A >>8 &3; + uint8_t index = A >>8 &3; /* D0 and D1 are connected to the ASIC in reverse order, so swap once */ V = V &~3 | V >>1 &1 | V <<1 &2; @@ -121,7 +121,7 @@ void Mapper558_Init (CartInfo *info) AddExState(StateRegs, ~0, 0, 0); WRAMSIZE = info->PRGRamSize + (info->PRGRamSaveSize &~0x7FF); - WRAM = (uint8*) FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*) FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM); diff --git a/src/boards/559.c b/src/boards/559.c index 5baeaff..ef36b26 100644 --- a/src/boards/559.c +++ b/src/boards/559.c @@ -21,8 +21,8 @@ #include "mapinc.h" #include "asic_vrc2and4.h" -static uint8 nt[4]; -static uint8 prg; +static uint8_t nt[4]; +static uint8_t prg; static SFORMAT stateRegs[] ={ { nt, 4, "EXPN" }, @@ -38,7 +38,7 @@ static void sync () { setmirrorw(nt[0] &1, nt[1] &1, nt[2] &1, nt[3] &1); } -static int getPRGBank (uint8 bank) { +static int getPRGBank (uint8_t bank) { return bank ==2? prg: VRC24_getPRGBank(bank); } diff --git a/src/boards/563.c b/src/boards/563.c index 1db54d4..abbb9e4 100644 --- a/src/boards/563.c +++ b/src/boards/563.c @@ -21,8 +21,8 @@ #include "mapinc.h" #include "asic_vrc2and4.h" -static uint8 irqEnabled; -static uint8 irqCounter; +static uint8_t irqEnabled; +static uint8_t irqCounter; static SFORMAT Mapper563_stateRegs[] ={ { &irqEnabled, 1, "IRQE" }, diff --git a/src/boards/564.c b/src/boards/564.c index 94fa23c..ec4454d 100644 --- a/src/boards/564.c +++ b/src/boards/564.c @@ -30,7 +30,7 @@ static void sync () { setmirror(Latch_data &0x10? MI_H: MI_V); } -static void trapLatchWrite (uint16 *newAddress, uint8 *newValue, uint8 romValue) { /* After the lock bit is set, only update the (mode-specific) inner bank bits. */ +static void trapLatchWrite (uint16_t *newAddress, uint8_t *newValue, uint8_t romValue) { /* After the lock bit is set, only update the (mode-specific) inner bank bits. */ if (Latch_data &0x20) { if (Latch_data &0x08) *newValue = Latch_data &0x28 | *newValue &~0x28; /* AOROM */ diff --git a/src/boards/565.c b/src/boards/565.c index ff526d7..941ed0b 100644 --- a/src/boards/565.c +++ b/src/boards/565.c @@ -21,9 +21,9 @@ #include "mapinc.h" #include "asic_vrc2and4.h" -static uint8 irqEnabled; -static uint8 irqCounter; -static uint8 irqPrescaler; +static uint8_t irqEnabled; +static uint8_t irqCounter; +static uint8_t irqPrescaler; static SFORMAT stateRegs[] ={ { &irqEnabled, 1, "IRQE" }, diff --git a/src/boards/566.c b/src/boards/566.c index 592fd11..123df13 100644 --- a/src/boards/566.c +++ b/src/boards/566.c @@ -23,7 +23,7 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg; +static uint8_t reg; static void sync () { int prgAND = reg &0x04? 0x0F: 0x1F; diff --git a/src/boards/567.c b/src/boards/567.c index 431c54a..1f54957 100644 --- a/src/boards/567.c +++ b/src/boards/567.c @@ -23,7 +23,7 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg; +static uint8_t reg; static void sync () { MMC3_syncPRG(0x0F, reg <<4); @@ -34,14 +34,14 @@ static void sync () { MMC3_syncMirror(); } -static int getPRGBank (uint8 bank) { +static int getPRGBank (uint8_t bank) { if (reg == 0x08) { return MMC3_getPRGBank(bank &1) &~3 | bank &3; } else return MMC3_getPRGBank(bank); } -static int getCHRBank (uint8 bank) { +static int getCHRBank (uint8_t bank) { if (reg == 0x0F) return MMC3_getCHRBank(bank &6 | bank >>1 &1) <<1 | bank &1; else diff --git a/src/boards/568.c b/src/boards/568.c index bec0ca5..b3b785e 100644 --- a/src/boards/568.c +++ b/src/boards/568.c @@ -23,8 +23,8 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg; -static uint8 pad; +static uint8_t reg; +static uint8_t pad; static DECLFR (readPad) { return CartBR(A &~0xF | pad &0xF); @@ -41,7 +41,7 @@ static void sync () { SetReadHandler(0x8000, 0xFFFF, reg &0x40? readPad: CartBR); } -static int getPRGBank (uint8 bank) { +static int getPRGBank (uint8_t bank) { if (reg &0x02) { int mask = reg &0x01? 3: 1; return MMC3_getPRGBank(0) &~mask | bank &mask; diff --git a/src/boards/569.c b/src/boards/569.c index a6f0dd5..5107f51 100644 --- a/src/boards/569.c +++ b/src/boards/569.c @@ -23,7 +23,7 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg; +static uint8_t reg; static void sync () { int chrAND = reg &0x04? 0x1FF: reg &0x02? 0xFF: 0x7F; @@ -33,14 +33,14 @@ static void sync () { MMC3_syncMirror(); } -static int getPRGBank (uint8 bank) { +static int getPRGBank (uint8_t bank) { if (reg &0x08) { return MMC3_getPRGBank(0) &~3 | bank &3; } else return MMC3_getPRGBank(bank); } -static int getCHRBank (uint8 bank) { +static int getCHRBank (uint8_t bank) { if (reg &0x04) return MMC3_getCHRBank(bank &6 | bank >>1 &1) <<1 | bank &1; else diff --git a/src/boards/57.c b/src/boards/57.c index 036c485..3bd97a6 100644 --- a/src/boards/57.c +++ b/src/boards/57.c @@ -21,8 +21,8 @@ #include "mapinc.h" -static uint8 regs[2]; -static uint8 hrd_flag; +static uint8_t regs[2]; +static uint8_t hrd_flag; static SFORMAT StateRegs[] = { diff --git a/src/boards/570.c b/src/boards/570.c index baaa7cc..92841c4 100644 --- a/src/boards/570.c +++ b/src/boards/570.c @@ -23,7 +23,7 @@ #include "mapinc.h" #include "asic_vrc2and4.h" -static uint8 reg; +static uint8_t reg; static void sync () { int prgAND = 0x0F; diff --git a/src/boards/571.c b/src/boards/571.c index 6189f65..f5f7701 100644 --- a/src/boards/571.c +++ b/src/boards/571.c @@ -23,8 +23,8 @@ #include "mapinc.h" #include "asic_vrc2and4.h" -static uint8 submapper; -static uint8 reg; +static uint8_t submapper; +static uint8_t reg; static void sync () { int prgAND = reg &0x10? 0x1F: 0x0F; diff --git a/src/boards/572.c b/src/boards/572.c index 44ccb6c..74d4879 100644 --- a/src/boards/572.c +++ b/src/boards/572.c @@ -23,7 +23,7 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg; +static uint8_t reg; static void sync () { int prgAND = 0x1F; diff --git a/src/boards/573.c b/src/boards/573.c index 9829cce..6a5b9aa 100644 --- a/src/boards/573.c +++ b/src/boards/573.c @@ -37,7 +37,7 @@ static void sync () { setchr8(0); } -static void trapLatchWrite (uint16 *newAddress, uint8 *newValue, uint8 romValue) { +static void trapLatchWrite (uint16_t *newAddress, uint8_t *newValue, uint8_t romValue) { if (Latch_address &0x20) *newAddress = Latch_address; /* Once bit 5 is set, only the inner bank bits can be modified. */ *newValue &= romValue; /* AND-type bus conflicts */ } diff --git a/src/boards/574.c b/src/boards/574.c index 089a73a..4a97764 100644 --- a/src/boards/574.c +++ b/src/boards/574.c @@ -36,7 +36,7 @@ static void sync () { setmirror(Latch_data &0x10? MI_H: MI_V); } -static void trapLatchWrite (uint16 *newAddress, uint8 *newValue, uint8 romValue) { /* After the lock bit is set, only update the data bits and the lowest two address bits. */ +static void trapLatchWrite (uint16_t *newAddress, uint8_t *newValue, uint8_t romValue) { /* After the lock bit is set, only update the data bits and the lowest two address bits. */ if (Latch_address &0x80) *newAddress = Latch_address &~0x03 | *newAddress &0x03; } diff --git a/src/boards/577.c b/src/boards/577.c index a969163..a333954 100644 --- a/src/boards/577.c +++ b/src/boards/577.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "asic_latch.h" -static uint8 pad; +static uint8_t pad; static DECLFR (readOB) { return X.DB; diff --git a/src/boards/578.c b/src/boards/578.c index 298b516..aa1c0e4 100644 --- a/src/boards/578.c +++ b/src/boards/578.c @@ -23,7 +23,7 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg; +static uint8_t reg; static void sync () { int prgAND = reg &0x02 && reg &0x04? 0x1F: 0x0F; diff --git a/src/boards/579.c b/src/boards/579.c index 2170c21..84b94dd 100644 --- a/src/boards/579.c +++ b/src/boards/579.c @@ -39,7 +39,7 @@ static void sync () { setmirror(Latch_address &0x02? MI_H: MI_V); } -static void trapLatchWrite (uint16 *newAddress, uint8 *newValue, uint8 romValue) { /* Once bit 9 is set, only the inner bank bits can be modified. */ +static void trapLatchWrite (uint16_t *newAddress, uint8_t *newValue, uint8_t romValue) { /* Once bit 9 is set, only the inner bank bits can be modified. */ if (Latch_address &0x200) *newAddress = *newAddress &0x01C | Latch_address &~0x01C; } diff --git a/src/boards/581.c b/src/boards/581.c index e35c8ac..7c00f2d 100644 --- a/src/boards/581.c +++ b/src/boards/581.c @@ -38,7 +38,7 @@ static void sync () { setmirror(Latch_address &0x80? MI_H: MI_V); } -static void trapLatchWrite (uint16 *newAddress, uint8 *newValue, uint8 romValue) { /* The upper two address bits are only updated on a falling edge of A5. */ +static void trapLatchWrite (uint16_t *newAddress, uint8_t *newValue, uint8_t romValue) { /* The upper two address bits are only updated on a falling edge of A5. */ if (!(Latch_address &0x20 && ~*newAddress &0x20)) *newAddress = *newAddress &~0xC0 | Latch_address &0xC0; } diff --git a/src/boards/582.c b/src/boards/582.c index f12ce07..c0b3b4c 100644 --- a/src/boards/582.c +++ b/src/boards/582.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 reg[4]; +static uint8_t reg[4]; static void sync () { setprg16(0x8000, reg[1] <<3 | reg[0] &0x07); diff --git a/src/boards/583.c b/src/boards/583.c index 37ef1f4..8de1e42 100644 --- a/src/boards/583.c +++ b/src/boards/583.c @@ -40,7 +40,7 @@ static void sync () { setchr8(0); } -static void trapLatchWrite (uint16 *newAddress, uint8 *newValue, uint8 romValue) { /* The address bits are only updated on a rising edge of A7. */ +static void trapLatchWrite (uint16_t *newAddress, uint8_t *newValue, uint8_t romValue) { /* The address bits are only updated on a rising edge of A7. */ if (!(~Latch_address &0x80 && *newAddress &0x80)) *newAddress = Latch_address; } diff --git a/src/boards/584.c b/src/boards/584.c index 295cbde..3f27ccd 100644 --- a/src/boards/584.c +++ b/src/boards/584.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 reg[2]; +static uint8_t reg[2]; static void sync () { if (reg[0] &0x20) diff --git a/src/boards/585.c b/src/boards/585.c index 60c3761..a08dfcb 100644 --- a/src/boards/585.c +++ b/src/boards/585.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "asic_latch.h" -static uint8 pad; +static uint8_t pad; static DECLFR (readOB) { return X.DB; diff --git a/src/boards/587.c b/src/boards/587.c index 4c6c251..d2fc3d5 100644 --- a/src/boards/587.c +++ b/src/boards/587.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 reg[2]; +static uint8_t reg[2]; static void sync () { if (reg[0] &0x02) { diff --git a/src/boards/588.c b/src/boards/588.c index 4a7802e..2d6d2cd 100644 --- a/src/boards/588.c +++ b/src/boards/588.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 reg[2]; +static uint8_t reg[2]; static void sync () { setprg8(0x6000, reg[1] &0x07 |0x08); diff --git a/src/boards/589.c b/src/boards/589.c index 6610761..20531d3 100644 --- a/src/boards/589.c +++ b/src/boards/589.c @@ -33,7 +33,7 @@ static void sync () { setmirror(Latch_address &1? MI_H: MI_V); } -static void trapLatchWrite (uint16 *newAddress, uint8 *newValue, uint8 romValue) { /* The address bits are only updated on a falling edge of D3. */ +static void trapLatchWrite (uint16_t *newAddress, uint8_t *newValue, uint8_t romValue) { /* The address bits are only updated on a falling edge of D3. */ if (!(Latch_data &0x08 && ~*newValue &0x08)) *newAddress = Latch_address; } diff --git a/src/boards/592.c b/src/boards/592.c index 3185658..811e02d 100644 --- a/src/boards/592.c +++ b/src/boards/592.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "asic_latch.h" -static uint8 submapper; +static uint8_t submapper; static void sync () { if (submapper == 1) diff --git a/src/boards/594.c b/src/boards/594.c index be0c8a7..151c8ee 100644 --- a/src/boards/594.c +++ b/src/boards/594.c @@ -25,10 +25,10 @@ #include "fifo.h" #include "msm6585.h" -static uint8 reg[4]; +static uint8_t reg[4]; static FIFO fifo; static MSM6585 adpcm; -static int32 soundOffset = 0; +static int32_t soundOffset = 0; static void sync () { int prgAND = 0x3F; @@ -41,7 +41,7 @@ static void sync () { MMC3_syncMirror(); } -static int getCHRBank (uint8 bank) { +static int getCHRBank (uint8_t bank) { return MMC3_getCHRBank(bank) | bank <<6 &0x100; } @@ -103,7 +103,7 @@ static void mapperSound_fillBufferHigh () { soundOffset = SOUNDTS; } -static void mapperSound_setSoundOffset (int32 newSoundOffset) { +static void mapperSound_setSoundOffset (int32_t newSoundOffset) { soundOffset = newSoundOffset; } diff --git a/src/boards/595.c b/src/boards/595.c index b98267f..a810efb 100644 --- a/src/boards/595.c +++ b/src/boards/595.c @@ -22,7 +22,7 @@ #include "cartram.h" #include "flashrom.h" -static uint8 reg; +static uint8_t reg; static void sync () { setprg8r(0x10, 0x6000, 0); diff --git a/src/boards/596.c b/src/boards/596.c index d62c447..fe5371d 100644 --- a/src/boards/596.c +++ b/src/boards/596.c @@ -24,7 +24,7 @@ #include "asic_mmc3.h" #include "cartram.h" -static uint8 reg; +static uint8_t reg; static void sync () { int prgAND = reg &0x04? 0x1F: 0x0F; diff --git a/src/boards/597.c b/src/boards/597.c index 5f2846a..1303e1e 100644 --- a/src/boards/597.c +++ b/src/boards/597.c @@ -23,8 +23,8 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg; -static uint8 pad; +static uint8_t reg; +static uint8_t pad; static DECLFR (readPad) { return CartBR(A &~0xF | pad &0xF); @@ -41,7 +41,7 @@ static void sync () { SetReadHandler(0x8000, 0xFFFF, reg &0x20? readPad: CartBR); } -static int getPRGBank (uint8 bank) { +static int getPRGBank (uint8_t bank) { if (reg &0x04) { int mask = reg &0x10? 1: 3; return MMC3_getPRGBank(0) &~mask | bank &mask; diff --git a/src/boards/598.c b/src/boards/598.c index c109155..05817db 100644 --- a/src/boards/598.c +++ b/src/boards/598.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 reg[2]; +static uint8_t reg[2]; static void sync () { setprg16(0x8000, reg[0] &0x18 | reg[1] &0x07); diff --git a/src/boards/599.c b/src/boards/599.c index 22857d2..594affd 100644 --- a/src/boards/599.c +++ b/src/boards/599.c @@ -22,7 +22,7 @@ #include "asic_latch.h" #include "cartram.h" -static uint8 pad; +static uint8_t pad; static DECLFR (readOB) { return X.DB; @@ -57,7 +57,7 @@ static void sync () { setmirror(Latch_address &0x002? MI_H: MI_V); } -static void trapLatchWrite (uint16 *newAddress, uint8 *newValue, uint8 romValue) { /* Latch address bit 14 is an address lock bit */ +static void trapLatchWrite (uint16_t *newAddress, uint8_t *newValue, uint8_t romValue) { /* Latch address bit 14 is an address lock bit */ if (Latch_address &0x4000) *newAddress = Latch_address; } diff --git a/src/boards/60.c b/src/boards/60.c index 29ace51..10a03d1 100644 --- a/src/boards/60.c +++ b/src/boards/60.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 game = 0; +static uint8_t game = 0; static void Sync(void) { diff --git a/src/boards/603-5052.c b/src/boards/603-5052.c index cbee199..ffb07e5 100644 --- a/src/boards/603-5052.c +++ b/src/boards/603-5052.c @@ -26,7 +26,7 @@ #include "mapinc.h" #include "mmc3.h" -static const uint8 lut[4] = { 0x00, 0x02, 0x02, 0x03 }; +static const uint8_t lut[4] = { 0x00, 0x02, 0x02, 0x03 }; static DECLFW(UNL6035052ProtWrite) { EXPREGS[0] = lut[V & 3]; diff --git a/src/boards/605.c b/src/boards/605.c index 442285b..57b9085 100644 --- a/src/boards/605.c +++ b/src/boards/605.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 reg[4]; +static uint8_t reg[4]; static void sync () { if (reg[3] &0x01) { /* UNROM mode */ diff --git a/src/boards/606.c b/src/boards/606.c index 212b129..bae4be2 100644 --- a/src/boards/606.c +++ b/src/boards/606.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "asic_latch.h" -static uint8 reg; +static uint8_t reg; static void sync () { if (reg &0x80) { /* ANROM mode */ diff --git a/src/boards/607.c b/src/boards/607.c index c623e51..5dfccbc 100644 --- a/src/boards/607.c +++ b/src/boards/607.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "asic_latch.h" -static uint8 reg; +static uint8_t reg; static DECLFR (readOB) { return X.DB; diff --git a/src/boards/608.c b/src/boards/608.c index f032bfc..9e78515 100644 --- a/src/boards/608.c +++ b/src/boards/608.c @@ -28,7 +28,7 @@ static void sync () { setmirror(Latch_address &0x04? MI_V: MI_H); } -static void trapLatchWrite (uint16 *newAddress, uint8 *newValue, uint8 romValue) { /* The address bits are only updated when the new A4=0 and A3=1. */ +static void trapLatchWrite (uint16_t *newAddress, uint8_t *newValue, uint8_t romValue) { /* The address bits are only updated when the new A4=0 and A3=1. */ if (!(~*newAddress &0x10 && *newAddress &0x08)) *newAddress = Latch_address; } diff --git a/src/boards/609.c b/src/boards/609.c index 6883d8d..4ae17f4 100644 --- a/src/boards/609.c +++ b/src/boards/609.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 reg; +static uint8_t reg; static void sync () { int bank; diff --git a/src/boards/610.c b/src/boards/610.c index 70f23e1..1bc64b6 100644 --- a/src/boards/610.c +++ b/src/boards/610.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "asic_latch.h" -static uint8 reg; +static uint8_t reg; static void sync () { if (reg &0x10) { /* NROM-128 mode */ diff --git a/src/boards/612.c b/src/boards/612.c index f43cf21..0c655ae 100644 --- a/src/boards/612.c +++ b/src/boards/612.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "asic_latch.h" -static uint8 reg; +static uint8_t reg; static void sync () { setprg16(0x8000, reg <<3 | Latch_data &0x07); diff --git a/src/boards/613.c b/src/boards/613.c index c501647..9e5c75f 100644 --- a/src/boards/613.c +++ b/src/boards/613.c @@ -22,7 +22,7 @@ #include "asic_mmc1.h" #include "asic_mmc3.h" -static uint8 reg; +static uint8_t reg; static void sync (void) { if (reg &0x01) { @@ -36,7 +36,7 @@ static void sync (void) { } } -static void applyMode (uint8 clear) { +static void applyMode (uint8_t clear) { PPU_hook = NULL; MapIRQHook = NULL; GameHBIRQHook = NULL; diff --git a/src/boards/614.c b/src/boards/614.c index 2d4803c..a21e5ea 100644 --- a/src/boards/614.c +++ b/src/boards/614.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 reg[3]; +static uint8_t reg[3]; static void sync () { int prg = reg[0] &0x30 | reg[1] <<3 &0x08; diff --git a/src/boards/615.c b/src/boards/615.c index da373d1..865bdd0 100644 --- a/src/boards/615.c +++ b/src/boards/615.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 reg[3]; +static uint8_t reg[3]; static void sync () { int prg = reg[0] &0x34 | reg[1] <<3 &0x08; diff --git a/src/boards/616.c b/src/boards/616.c index 010e1cc..53a0cd5 100644 --- a/src/boards/616.c +++ b/src/boards/616.c @@ -24,7 +24,7 @@ #include "asic_mmc3.h" #include "cartram.h" -static uint8 reg; +static uint8_t reg; static void sync () { MMC3_syncPRG(0x0F, reg <<4); diff --git a/src/boards/617.c b/src/boards/617.c index a072a3c..58b2da2 100644 --- a/src/boards/617.c +++ b/src/boards/617.c @@ -23,7 +23,7 @@ #include "mapinc.h" #include "asic_vrc2and4.h" -static uint8 reg; +static uint8_t reg; static void sync () { int prgAND = reg &0x04? 0x1F: 0x0F; diff --git a/src/boards/618.c b/src/boards/618.c index 58e143c..1f8e450 100644 --- a/src/boards/618.c +++ b/src/boards/618.c @@ -23,7 +23,7 @@ #include "mapinc.h" #include "asic_mmc3.h" -static uint8 reg; +static uint8_t reg; static void sync () { if (reg &0x02) @@ -37,7 +37,7 @@ static void sync () { MMC3_syncMirror(); } -static int getCHRBank (uint8 bank) { +static int getCHRBank (uint8_t bank) { if (reg &0x80) return MMC3_getCHRBank(bank &4 | bank >>1 &1) <<1 | bank &1; else diff --git a/src/boards/62.c b/src/boards/62.c index c5032c5..3fa9569 100644 --- a/src/boards/62.c +++ b/src/boards/62.c @@ -20,8 +20,8 @@ #include "mapinc.h" -static uint8 bank; -static uint16 mode; +static uint8_t bank; +static uint16_t mode; static SFORMAT StateRegs[] = { { &bank, 1, "BANK" }, diff --git a/src/boards/65.c b/src/boards/65.c index c9503e7..c632d43 100644 --- a/src/boards/65.c +++ b/src/boards/65.c @@ -20,9 +20,9 @@ #include "mapinc.h" -static uint8 preg[3], creg[8], mirr; -static uint8 IRQa; -static int16 IRQCount, IRQLatch; +static uint8_t preg[3], creg[8], mirr; +static uint8_t IRQa; +static int16_t IRQCount, IRQLatch; static SFORMAT StateRegs[] = { diff --git a/src/boards/67.c b/src/boards/67.c index 1272d45..ff9e248 100644 --- a/src/boards/67.c +++ b/src/boards/67.c @@ -20,9 +20,9 @@ #include "mapinc.h" -static uint8 preg, creg[4], mirr, suntoggle = 0; -static uint8 IRQa; -static int16 IRQCount, IRQLatch; +static uint8_t preg, creg[4], mirr, suntoggle = 0; +static uint8_t IRQa; +static int16_t IRQCount, IRQLatch; static SFORMAT StateRegs[] = { diff --git a/src/boards/68.c b/src/boards/68.c index e883fd9..44630d7 100644 --- a/src/boards/68.c +++ b/src/boards/68.c @@ -20,11 +20,11 @@ #include "mapinc.h" -static uint8 chr_reg[4]; -static uint8 kogame, prg_reg, nt1, nt2, mirr; +static uint8_t chr_reg[4]; +static uint8_t kogame, prg_reg, nt1, nt2, mirr; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE, count; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE, count; static SFORMAT StateRegs[] = { @@ -153,7 +153,7 @@ void Mapper68_Init(CartInfo *info) { info->Close = M68Close; GameStateRestore = StateRestore; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); if (info->battery) { info->SaveGame[0] = WRAM; diff --git a/src/boards/69.c b/src/boards/69.c index c7d5231..9f2ff2d 100644 --- a/src/boards/69.c +++ b/src/boards/69.c @@ -21,11 +21,11 @@ #include "mapinc.h" -static uint8 cmdreg, preg[4], creg[8], mirr; -static uint8 IRQa; -static int32 IRQCount; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t cmdreg, preg[4], creg[8], mirr; +static uint8_t IRQa; +static int32_t IRQCount; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static void(*sfun[3]) (void); @@ -41,7 +41,7 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { - uint8 i; + uint8_t i; if ((preg[3] & 0xC0) == 0xC0) setprg8r(0x10, 0x6000, preg[3] & 0x3F); else @@ -104,9 +104,9 @@ static void AYSoundHQ(void); static void DoAYSQ(int x); static void DoAYSQHQ(int x); -static uint8 sndcmd, sreg[14]; -static int32 vcount[3]; -static int32 dcount[3]; +static uint8_t sndcmd, sreg[14]; +static int32_t vcount[3]; +static int32_t dcount[3]; static int CAYBC[3]; static SFORMAT SStateRegs[] = @@ -156,9 +156,9 @@ static DECLFW(M69SWrite1) { } static void DoAYSQ(int x) { - int32 freq = ((sreg[x << 1] | ((sreg[(x << 1) + 1] & 15) << 8)) + 1) << (4 + 17); - int32 amp = (sreg[0x8 + x] & 15) << 2; - int32 start, end; + int32_t freq = ((sreg[x << 1] | ((sreg[(x << 1) + 1] & 15) << 8)) + 1) << (4 + 17); + int32_t amp = (sreg[0x8 + x] & 15) << 2; + int32_t start, end; int V; amp += amp >> 1; @@ -181,9 +181,9 @@ static void DoAYSQ(int x) { } static void DoAYSQHQ(int x) { - uint32 V; - int32 freq = ((sreg[x << 1] | ((sreg[(x << 1) + 1] & 15) << 8)) + 1) << 4; - int32 amp = (sreg[0x8 + x] & 15) << 6; + uint32_t V; + int32_t freq = ((sreg[x << 1] | ((sreg[(x << 1) + 1] & 15) << 8)) + 1) << 4; + int32_t amp = (sreg[0x8 + x] & 15) << 6; amp += amp >> 1; @@ -240,7 +240,7 @@ static void AYSoundHQ(void) { DoAYSQ3HQ(); } -static void AYHiSync(int32 ts) { +static void AYHiSync(int32_t ts) { int x; for (x = 0; x < 3; x++) @@ -309,7 +309,7 @@ void Mapper69_Init(CartInfo *info) { info->Close = M69Close; MapIRQHook = M69IRQHook; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); if (info->battery) { diff --git a/src/boards/6_8_12_17_561_562.c b/src/boards/6_8_12_17_561_562.c index 883e319..424217d 100644 --- a/src/boards/6_8_12_17_561_562.c +++ b/src/boards/6_8_12_17_561_562.c @@ -30,16 +30,16 @@ #define BUNG 1 #define VENUS 2 -static uint8 maker; -static uint8 mc1Mode, mc1ModeInitial; /* register 42Fx */ -static uint8 mc2Mode, mc2ModeInitial; /* register 43Fx */ -static uint8 extMode, extModeInitial; /* register 4500 on FFE, 4411 on Venus, does not exist on Bung */ -static uint8 latch; /* 8000-FFFF register for 1M modes */ -static uint8 lockCHR; /* CHR-RAM write-protected via undocumented protection mechanism */ -static uint8 prg8K[4]; /* 8 KiB PRG registers in 2M or 4M mode */ -static uint8 chr1K[12]; /* Not used by Bung, 8 registers by Venus, 12 registers by FFE */ -static uint8 chr8K; /* Not used by FFE, only by Bung and Venus */ -static uint8 lastCHRBank; /* Only used by Venus */ +static uint8_t maker; +static uint8_t mc1Mode, mc1ModeInitial; /* register 42Fx */ +static uint8_t mc2Mode, mc2ModeInitial; /* register 43Fx */ +static uint8_t extMode, extModeInitial; /* register 4500 on FFE, 4411 on Venus, does not exist on Bung */ +static uint8_t latch; /* 8000-FFFF register for 1M modes */ +static uint8_t lockCHR; /* CHR-RAM write-protected via undocumented protection mechanism */ +static uint8_t prg8K[4]; /* 8 KiB PRG registers in 2M or 4M mode */ +static uint8_t chr1K[12]; /* Not used by Bung, 8 registers by Venus, 12 registers by FFE */ +static uint8_t chr8K; /* Not used by FFE, only by Bung and Venus */ +static uint8_t lastCHRBank; /* Only used by Venus */ /* IRQ counter used by FFE and Bung */ static signed short int irqCounter; @@ -48,22 +48,22 @@ static signed short int irqCounter; static unsigned short int tgdCounter, tgdTarget; /* FFE-only registers */ -static uint8 latchMMC4[2]; /* For MMC4 emulation mode */ -static uint8 smcIRQ; /* IRQ enable register */ +static uint8_t latchMMC4[2]; /* For MMC4 emulation mode */ +static uint8_t smcIRQ; /* IRQ enable register */ /* FDS data IRQ, used for frame timing purposes */ -static uint8 fdsIO; +static uint8_t fdsIO; static signed short int fdsCounter; -static uint8 *WRAM =NULL; /* 0000-1FFF: CPU 6000-7FFF; 2000-2FFF: CPU 5000-5FFF (FFE only) */ -static uint8 *CHRRAM =NULL; /* up to 32 KiB for Bung, up to 256 KiB for FFE and Venus */ +static uint8_t *WRAM =NULL; /* 0000-1FFF: CPU 6000-7FFF; 2000-2FFF: CPU 5000-5FFF (FFE only) */ +static uint8_t *CHRRAM =NULL; /* up to 32 KiB for Bung, up to 256 KiB for FFE and Venus */ -static uint32 trainerSize; -static uint8 *trainerSource, *trainerTarget; -static uint16 trainerInit, resetAddress; +static uint32_t trainerSize; +static uint8_t *trainerSource, *trainerTarget; +static uint16_t trainerInit, resetAddress; /* For trapping writes to CHR-RAM, which can trigger a protection mechanism in FFE and Venus devices */ -extern uint32 RefreshAddr; +extern uint32_t RefreshAddr; static writefunc writePPU; static DECLFW(interceptPPUWrite) { /* Only called in modes 5-7 with single-screen mirroring. Then, Writing anything to CHR-RAM locks (CIRAM page 1) or unlocks (CIRAM page 0) CHR memory in modes 0-3. Needed for (F4040) Karnov). */ if (~RefreshAddr &0x2000) lockCHR =!!(mc1Mode &0x10); @@ -229,7 +229,7 @@ static void sync () { /* Some Venus games check values in BIOS at 4800-4FFF to lock out Bung and FFE devices. Do not need to include the full BIOS, just a selection of values. */ -static const uint8 tgdBIOSExtract[32] ={ +static const uint8_t tgdBIOSExtract[32] ={ 0xfe, 0x60, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4c, 0xd9, 0x48, 0x4c, 0x18, 0x49, 0x4c, @@ -493,7 +493,7 @@ static void pseudoScanlineFFE () { } } -static void FP_FASTAPASS(1) trapPPUAddressChangeFFE (uint32 A) { +static void FP_FASTAPASS(1) trapPPUAddressChangeFFE (uint32_t A) { if (extMode &0x01 && ~extMode &0x04 && ((A &0x2FF0) ==0xFD0 || (A &0x2FF0) ==0xFE0)) { /* If MMC4 mode is enabled, and CHR mode[0] is 4 KiB, and tile FD or FE is being fetched ... */ latchMMC4[A >>12 &1] =(A >>10 &4) | (A >>4 &2); /* ... switch the left or right pattern table's latch to 0 (FD) or 2 (FE), being used as an offset for the CHR register index. */ @@ -501,7 +501,7 @@ static void FP_FASTAPASS(1) trapPPUAddressChangeFFE (uint32 A) { } } -static void FP_FASTAPASS(1) trapPPUAddressChangeVenus (uint32 A) { +static void FP_FASTAPASS(1) trapPPUAddressChangeVenus (uint32_t A) { if (A &~0x2000) lastCHRBank =A >>10; } @@ -528,17 +528,17 @@ void FFE_Init(CartInfo *info) { mc2ModeInitial =info->mapper ==12 || info->mapper ==17? 0x00: 0x03; extModeInitial =info->mapper ==17? 0x47: 0x42; - WRAM =(uint8*)FCEU_gmalloc(16384); /* Just 12 KiB actually, but need power-of-two size */ + WRAM =(uint8_t*)FCEU_gmalloc(16384); /* Just 12 KiB actually, but need power-of-two size */ SetupCartPRGMapping(0x10, WRAM, 16384, 1); memset(WRAM, 0x00, 16384); AddExState(WRAM, 16384, 0, "WRAM"); - CHRRAM =(uint8*)FCEU_gmalloc(262144); + CHRRAM =(uint8_t*)FCEU_gmalloc(262144); SetupCartCHRMapping(0x10, CHRRAM, 262144, 1); AddExState(CHRRAM, 262144, 0, "CRAM"); memset(CHRRAM, 0xFF, 262144); /* Don't initialize to $00 because 8 Eyes (F4089) uses a sprite 0 hit sprite with uninitialized CHR data */ if (info->mapper ==12 && info->submapper ==1 && info->CHRRomSize) { /* FFE F6xxx needs CHR data in PRG-ROM. Enlarge to 512 KiB, copy and replace previous PRG-ROM buffer. */ - uint8* newROM =(uint8*)FCEU_gmalloc(524288); + uint8_t* newROM =(uint8_t*)FCEU_gmalloc(524288); memset(newROM, 0xFF, 524288); memcpy(newROM + 0, ROM, info->PRGRomSize >524288? 524288: info->PRGRomSize); memcpy(newROM +262144, VROM, info->CHRRomSize >262144? 262144: info->CHRRomSize); @@ -583,18 +583,18 @@ void Mapper561_562_Init(CartInfo *info) { mc2ModeInitial =0x03; extModeInitial =0x03; - WRAM =(uint8*)FCEU_gmalloc(8192); + WRAM =(uint8_t*)FCEU_gmalloc(8192); SetupCartPRGMapping(0x10, WRAM, 8192, 1); memset(WRAM, 0x00, 8192); AddExState(WRAM, 8192, 0, "WRAM"); CHRRAMSize =info->CHRRomSize? info->CHRRomSize: (info->CHRRamSize +info->CHRRamSaveSize); - CHRRAM =(uint8*)FCEU_gmalloc(CHRRAMSize); + CHRRAM =(uint8_t*)FCEU_gmalloc(CHRRAMSize); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1); AddExState(CHRRAM, CHRRAMSize, 0, "CRAM"); memset(CHRRAM, 0xFF, CHRRAMSize); if (info->mapper ==561 && info->submapper ==3 && info->PRGRomSize ==131072) { /* Crazy Climber (G026) is 128 KiB but expects to find PRG-DRAM above it */ - uint8* newROM =(uint8*)FCEU_gmalloc(262144); + uint8_t* newROM =(uint8_t*)FCEU_gmalloc(262144); memset(newROM, 0xFF, 262144); memcpy(newROM, ROM, 131072); FCEU_gfree(ROM); diff --git a/src/boards/71.c b/src/boards/71.c index 343bdf0..63585b7 100644 --- a/src/boards/71.c +++ b/src/boards/71.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 preg, mirr; +static uint8_t preg, mirr; static SFORMAT StateRegs[] = { diff --git a/src/boards/72.c b/src/boards/72.c index bd187f8..22b2c4f 100644 --- a/src/boards/72.c +++ b/src/boards/72.c @@ -23,7 +23,7 @@ #include "mapinc.h" -static uint8 preg, creg; +static uint8_t preg, creg; static SFORMAT StateRegs[] = { diff --git a/src/boards/77.c b/src/boards/77.c index 7edbd3e..5f62ed8 100644 --- a/src/boards/77.c +++ b/src/boards/77.c @@ -20,10 +20,10 @@ #include "mapinc.h" -static uint8 latche; +static uint8_t latche; -static uint8 *CHRRAM = NULL; -static uint32 CHRRAMSIZE; +static uint8_t *CHRRAM = NULL; +static uint32_t CHRRAMSIZE; static SFORMAT StateRegs[] = { @@ -66,7 +66,7 @@ void Mapper77_Init(CartInfo *info) { GameStateRestore = StateRestore; CHRRAMSIZE = 6 * 1024; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM = (uint8_t*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM"); diff --git a/src/boards/79.c b/src/boards/79.c index 68bb3b3..3ebe5ed 100644 --- a/src/boards/79.c +++ b/src/boards/79.c @@ -21,7 +21,7 @@ #include "mapinc.h" -static uint8 creg, preg; +static uint8_t creg, preg; static SFORMAT StateRegs[] = { { &creg, 1, "CREG" }, diff --git a/src/boards/80.c b/src/boards/80.c index 3a02215..965b424 100644 --- a/src/boards/80.c +++ b/src/boards/80.c @@ -21,10 +21,10 @@ #include "mapinc.h" -static uint8 preg[3], creg[6], isExMirr; -static uint8 mirr, cmd, wram_enable, wram[256]; -static uint8 mcache[8]; -static uint32 lastppu; +static uint8_t preg[3], creg[6], isExMirr; +static uint8_t mirr, cmd, wram_enable, wram[256]; +static uint8_t mcache[8]; +static uint32_t lastppu; static SFORMAT StateRegs80[] = { @@ -121,8 +121,8 @@ static DECLFW(M95Write) { } } -static void FP_FASTAPASS(1) MExMirrPPU(uint32 A) { - static int8 lastmirr = -1, curmirr; +static void FP_FASTAPASS(1) MExMirrPPU(uint32_t A) { + static int8_t lastmirr = -1, curmirr; if (A < 0x2000) { lastppu = A >> 10; curmirr = mcache[lastppu]; diff --git a/src/boards/8237.c b/src/boards/8237.c index c72d969..067d18c 100644 --- a/src/boards/8237.c +++ b/src/boards/8237.c @@ -37,9 +37,9 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 submapper; +static uint8_t submapper; -static uint8 regperm[8][8] = +static uint8_t regperm[8][8] = { { 0, 1, 2, 3, 4, 5, 6, 7 }, { 0, 2, 6, 1, 7, 3, 4, 5 }, @@ -51,7 +51,7 @@ static uint8 regperm[8][8] = { 0, 1, 2, 3, 4, 5, 6, 7 }, /* empty */ }; -static uint8 adrperm[8][8] = +static uint8_t adrperm[8][8] = { { 0, 1, 2, 3, 4, 5, 6, 7 }, { 3, 2, 0, 4, 1, 5, 6, 7 }, @@ -63,7 +63,7 @@ static uint8 adrperm[8][8] = { 0, 1, 2, 3, 4, 5, 6, 7 }, /* empty */ }; -static uint8 protarray[8][8] = { +static uint8_t protarray[8][8] = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 0 Super Hang-On */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00 }, /* 1 Monkey King */ { 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x00, 0x00 }, /* 2 Super Hang-On/Monkey King */ @@ -74,8 +74,8 @@ static uint8 protarray[8][8] = { { 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x0F, 0x00 } /* 7 (default) Blood of Jurassic */ }; -static void UNL8237CW(uint32 A, uint8 V) { - uint16 outer_bank; +static void UNL8237CW(uint32_t A, uint8_t V) { + uint16_t outer_bank; if (submapper == 1) outer_bank = ((EXPREGS[1] & 0xE) << 7); @@ -88,16 +88,16 @@ static void UNL8237CW(uint32 A, uint8 V) { setchr1(A, outer_bank | V); } -static void UNL8237PW(uint32 A, uint8 V) { - uint8 outer_bank = ((EXPREGS[1] & 3) << 5); +static void UNL8237PW(uint32_t A, uint8_t V) { + uint8_t outer_bank = ((EXPREGS[1] & 3) << 5); if (submapper == 1) outer_bank |= ((EXPREGS[1] & 8) << 4); if (EXPREGS[0] & 0x40) { - uint8 sbank = (EXPREGS[1] & 0x10); + uint8_t sbank = (EXPREGS[1] & 0x10); if (EXPREGS[0] & 0x80) { /* NROM */ - uint8 bank = (outer_bank >> 1) | (EXPREGS[0] & 0x7) | (sbank >> 1); + uint8_t bank = (outer_bank >> 1) | (EXPREGS[0] & 0x7) | (sbank >> 1); if (EXPREGS[0] & 0x20) /* NROM-256 */ setprg32(0x8000, bank >> 1); else { /* NROM-128 */ @@ -108,7 +108,7 @@ static void UNL8237PW(uint32 A, uint8 V) { setprg8(A, outer_bank | (V & 0x0F) | sbank); } else { if (EXPREGS[0] & 0x80) { /* NROM */ - uint8 bank = (outer_bank >> 1) | (EXPREGS[0] & 0xF); + uint8_t bank = (outer_bank >> 1) | (EXPREGS[0] & 0xF); if (EXPREGS[0] & 0x20) /* NROM-256 */ setprg32(0x8000, bank >> 1); else { /* NROM-128 */ @@ -125,9 +125,9 @@ static DECLFR(UNL8237ProtRead) { } static DECLFW(UNL8237Write) { - uint8 dat = V; - uint8 adr = adrperm[EXPREGS[2]][((A >> 12) & 6) | (A & 1)]; - uint16 addr = (adr & 1) | ((adr & 6) << 12) | 0x8000; + uint8_t dat = V; + uint8_t adr = adrperm[EXPREGS[2]][((A >> 12) & 6) | (A & 1)]; + uint16_t addr = (adr & 1) | ((adr & 6) << 12) | 0x8000; if (adr < 4) { if (!adr) dat = (dat & 0xC0) | (regperm[EXPREGS[2]][dat & 7]); diff --git a/src/boards/82_552.c b/src/boards/82_552.c index 5ed4d6b..ff6c491 100644 --- a/src/boards/82_552.c +++ b/src/boards/82_552.c @@ -23,10 +23,10 @@ #include "mapinc.h" -static uint8 regs[9], ctrl; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; -static uint8 is552; +static uint8_t regs[9], ctrl; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; +static uint8_t is552; static SFORMAT StateRegs[] = { @@ -35,7 +35,7 @@ static SFORMAT StateRegs[] = { 0 } }; -uint8 prgBits (uint8 val) { +uint8_t prgBits (uint8_t val) { if (is552) return val >>5 &0x01 | val >>3 &0x02 | val >>1 &0x04 | val <<1 &0x08 | val <<3 &0x10 | val <<5 &0x20; else @@ -43,7 +43,7 @@ uint8 prgBits (uint8 val) { } static void Sync(void) { - uint32 swap = ((ctrl & 2) << 11); + uint32_t swap = ((ctrl & 2) << 11); setchr2(0x0000 ^ swap, regs[0] >> 1); setchr2(0x0800 ^ swap, regs[1] >> 1); setchr1(0x1000 ^ swap, regs[2]); @@ -95,7 +95,7 @@ void Mapper82_Init(CartInfo *info) { info->Close = M82Close; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); if (info->battery) { diff --git a/src/boards/830118C.c b/src/boards/830118C.c index 5196c8d..dd47da2 100644 --- a/src/boards/830118C.c +++ b/src/boards/830118C.c @@ -23,11 +23,11 @@ #include "mapinc.h" #include "mmc3.h" -static void BMC830118CCW(uint32 A, uint8 V) { +static void BMC830118CCW(uint32_t A, uint8_t V) { setchr1(A, (V & 0x7F) | ((EXPREGS[0] & 0x0c) << 5)); } -static void BMC830118CPW(uint32 A, uint8 V) { +static void BMC830118CPW(uint32_t A, uint8_t V) { if ((EXPREGS[0] & 0x0C) == 0x0C) { if (A == 0x8000) { setprg8(A, (V & 0x0F) | ((EXPREGS[0] & 0x0c) << 2)); diff --git a/src/boards/830134C.c b/src/boards/830134C.c index 711eb93..4874139 100644 --- a/src/boards/830134C.c +++ b/src/boards/830134C.c @@ -27,11 +27,11 @@ #include "mapinc.h" #include "mmc3.h" -static void BMC830134CCW(uint32 A, uint8 V) { +static void BMC830134CCW(uint32_t A, uint8_t V) { setchr1(A, (V & 0xFF) | ((EXPREGS[0] & 0x01) << 8) | ((EXPREGS[0] & 0x02) << 6) | ((EXPREGS[0] & 0x08) << 3)); } -static void BMC830134CPW(uint32 A, uint8 V) { +static void BMC830134CPW(uint32_t A, uint8_t V) { if (EXPREGS[0] & 0x08) { if (A == 0x8000) { setprg8(A, (V & 0x0F) | ((EXPREGS[0] & 0x06) << 3)); diff --git a/src/boards/83_264.c b/src/boards/83_264.c index 7601869..fb16017 100644 --- a/src/boards/83_264.c +++ b/src/boards/83_264.c @@ -23,12 +23,12 @@ #include "mapinc.h" #include "cartram.h" -static uint8 reg[16]; -static uint8 scratch[4]; -static uint8 flags; -static uint8 pad; +static uint8_t reg[16]; +static uint8_t scratch[4]; +static uint8_t flags; +static uint8_t pad; static int mapper; -static uint8 submapper; +static uint8_t submapper; static SFORMAT stateRegs[] = { { reg, 16, "REGS" }, @@ -157,7 +157,7 @@ static DECLFW (writeReg) { } void clockCounter (void) { - uint16 counter = reg[2] | reg[3] <<8; + uint16_t counter = reg[2] | reg[3] <<8; if (flags &0x80 && counter) { if (reg[1] &0x40) counter--; diff --git a/src/boards/88.c b/src/boards/88.c index dd0932d..46b4ef5 100644 --- a/src/boards/88.c +++ b/src/boards/88.c @@ -20,8 +20,8 @@ #include "mapinc.h" -static uint8 reg[8]; -static uint8 mirror, cmd, is154; +static uint8_t reg[8]; +static uint8_t mirror, cmd, is154; static SFORMAT StateRegs[] = { diff --git a/src/boards/8in1.c b/src/boards/8in1.c index 6498caf..ca7592c 100644 --- a/src/boards/8in1.c +++ b/src/boards/8in1.c @@ -27,13 +27,13 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 submapper; +static uint8_t submapper; -static void BMC8IN1CW(uint32 A, uint8 V) { +static void BMC8IN1CW(uint32_t A, uint8_t V) { setchr1(A, ((EXPREGS[0] & 0xC) << 5) | (V & 0x7F)); } -static void BMC8IN1PW(uint32 A, uint8 V) { +static void BMC8IN1PW(uint32_t A, uint8_t V) { if(EXPREGS[0] & 0x10 || submapper == 1) { /* MMC3 mode */ setprg8(A, ((EXPREGS[0] & 0xC) << 2) | (V & 0xF)); } else { diff --git a/src/boards/91.c b/src/boards/91.c index 4e9ccfe..881921f 100644 --- a/src/boards/91.c +++ b/src/boards/91.c @@ -28,11 +28,11 @@ #include "mapinc.h" -static uint8 cregs[4], pregs[2]; -static uint8 IRQCount, IRQa; -static uint8 submapper; -static uint8 outerbank; -static uint8 mirr; +static uint8_t cregs[4], pregs[2]; +static uint8_t IRQCount, IRQa; +static uint8_t submapper; +static uint8_t outerbank; +static uint8_t mirr; static SFORMAT StateRegs[] = { diff --git a/src/boards/96.c b/src/boards/96.c index de59381..ec42d16 100644 --- a/src/boards/96.c +++ b/src/boards/96.c @@ -29,7 +29,7 @@ #include "mapinc.h" -static uint8 reg, ppulatch; +static uint8_t reg, ppulatch; static SFORMAT StateRegs[] = { @@ -50,7 +50,7 @@ static DECLFW(M96Write) { Sync(); } -static void FP_FASTAPASS(1) M96Hook(uint32 A) { +static void FP_FASTAPASS(1) M96Hook(uint32_t A) { if ((A & 0x3000) == 0x2000) { ppulatch = (A >> 8) & 3; Sync(); diff --git a/src/boards/99.c b/src/boards/99.c index c6a3eb3..45b8a9c 100644 --- a/src/boards/99.c +++ b/src/boards/99.c @@ -20,9 +20,9 @@ #include "mapinc.h" -static uint8 latch; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t latch; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static writefunc old4016; static SFORMAT StateRegs[] = @@ -69,7 +69,7 @@ void Mapper99_Init(CartInfo *info) { info->Close = M99Close; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); diff --git a/src/boards/BMW8544.c b/src/boards/BMW8544.c index 4f13887..a7ff146 100644 --- a/src/boards/BMW8544.c +++ b/src/boards/BMW8544.c @@ -26,7 +26,7 @@ #include "mapinc.h" #include "mmc3.h" -static void UNLBMW8544PW(uint32 A, uint8 V) { +static void UNLBMW8544PW(uint32_t A, uint8_t V) { if(A == 0x8000) setprg8(A,EXPREGS[0] & 0x1F); /* the real hardware has this bank overrided with it's own register, * but MMC3 prg swap still works and you can actually change bank C000 at the same time if use 0x46 cmd @@ -35,7 +35,7 @@ static void UNLBMW8544PW(uint32 A, uint8 V) { setprg8(A,V); } -static void UNLBMW8544CW(uint32 A, uint8 V) { +static void UNLBMW8544CW(uint32_t A, uint8_t V) { if(A == 0x0000) setchr2(0x0000,(V >> 1) ^ EXPREGS[1]); else if (A == 0x0800) diff --git a/src/boards/KG256.c b/src/boards/KG256.c index a2ac180..4bbc252 100644 --- a/src/boards/KG256.c +++ b/src/boards/KG256.c @@ -23,7 +23,7 @@ #include "mapinc.h" -static uint8 regs[4]; +static uint8_t regs[4]; static SFORMAT StateRegs[] = { @@ -33,7 +33,7 @@ static SFORMAT StateRegs[] = static void Sync(void) { - uint8 mirr; + uint8_t mirr; int r = 0; if ((regs[1]) & 0x20) diff --git a/src/boards/KS7012.c b/src/boards/KS7012.c index c4dbcb7..00da4dd 100644 --- a/src/boards/KS7012.c +++ b/src/boards/KS7012.c @@ -23,9 +23,9 @@ #include "mapinc.h" -static uint8 reg; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t reg; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -78,7 +78,7 @@ void UNLKS7012_Init(CartInfo *info) { info->Close = UNLKS7012Close; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); diff --git a/src/boards/KS7013.c b/src/boards/KS7013.c index 1ec7b8b..c9b1e3e 100644 --- a/src/boards/KS7013.c +++ b/src/boards/KS7013.c @@ -24,7 +24,7 @@ #include "mapinc.h" -static uint8 reg, mirr; +static uint8_t reg, mirr; static SFORMAT StateRegs[] = { diff --git a/src/boards/KS7016.c b/src/boards/KS7016.c index 18c54d4..d6935e0 100644 --- a/src/boards/KS7016.c +++ b/src/boards/KS7016.c @@ -27,7 +27,7 @@ #include "mapinc.h" #include "../fds_apu.h" -static uint8 preg; +static uint8_t preg; static SFORMAT StateRegs[] = { diff --git a/src/boards/KS7017.c b/src/boards/KS7017.c index 8a5549a..d0953db 100644 --- a/src/boards/KS7017.c +++ b/src/boards/KS7017.c @@ -24,10 +24,10 @@ #include "mapinc.h" #include "../fds_apu.h" -static uint8 latche, reg, mirr; -static int32 IRQa, IRQCount, IRQLatch; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t latche, reg, mirr; +static int32_t IRQa, IRQCount, IRQLatch; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -114,7 +114,7 @@ void UNLKS7017_Init(CartInfo *info) { MapIRQHook = UNL7017IRQ; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); diff --git a/src/boards/KS7030.c b/src/boards/KS7030.c index a35b184..4216985 100644 --- a/src/boards/KS7030.c +++ b/src/boards/KS7030.c @@ -39,9 +39,9 @@ #include "mapinc.h" #include "../fds_apu.h" -static uint8 reg0, reg1; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t reg0, reg1; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -149,7 +149,7 @@ void UNLKS7030_Init(CartInfo *info) { GameStateRestore = StateRestore; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); AddExState(&StateRegs, ~0, 0, 0); diff --git a/src/boards/KS7031.c b/src/boards/KS7031.c index 4f961f4..09b92aa 100644 --- a/src/boards/KS7031.c +++ b/src/boards/KS7031.c @@ -24,7 +24,7 @@ #include "mapinc.h" #include "fds_apu.h" -static uint8 reg[4]; +static uint8_t reg[4]; static SFORMAT StateRegs[] = { diff --git a/src/boards/KS7032.c b/src/boards/KS7032.c index a435b3c..8a6e93b 100644 --- a/src/boards/KS7032.c +++ b/src/boards/KS7032.c @@ -31,11 +31,11 @@ #include "mapinc.h" -static uint8 reg[8], creg[8], mirr, cmd, IRQa = 0; -static int32 IRQCount, IRQLatch; -static uint8 KS7032; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t reg[8], creg[8], mirr, cmd, IRQa = 0; +static int32_t IRQCount, IRQLatch; +static uint8_t KS7032; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegsKS7032[] = { @@ -91,7 +91,7 @@ static DECLFW(UNLKS7032Write) { case 0xD000: X6502_IRQEnd(FCEU_IQEXT); break; case 0xE000: cmd = V & 7; break; case 0xF000: { - uint8 bank = (cmd - 1); + uint8_t bank = (cmd - 1); if (bank < 3) reg[bank] = (reg[bank] & 0x10) | (V & 0x0F); else if (bank < 4) @@ -168,7 +168,7 @@ void UNLKS202_Init(CartInfo *info) { AddExState(&StateRegsKS202, ~0, 0, 0); WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); if (info->battery) { info->SaveGame[0] = WRAM; diff --git a/src/boards/KS7037.c b/src/boards/KS7037.c index 0835f64..f1b2a82 100644 --- a/src/boards/KS7037.c +++ b/src/boards/KS7037.c @@ -24,9 +24,9 @@ #include "mapinc.h" #include "../fds_apu.h" -static uint8 reg[8], cmd; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t reg[8], cmd; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static void (*WSync)(void); @@ -105,7 +105,7 @@ void UNLKS7037_Init(CartInfo *info) { WSync = SyncKS7037; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); @@ -120,7 +120,7 @@ void LH10_Init(CartInfo *info) { WSync = SyncLH10; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); diff --git a/src/boards/KS7057.c b/src/boards/KS7057.c index be32d24..8f64264 100644 --- a/src/boards/KS7057.c +++ b/src/boards/KS7057.c @@ -23,7 +23,7 @@ #include "mapinc.h" -static uint8 reg[8], mirror; +static uint8_t reg[8], mirror; static SFORMAT StateRegs[] = { { reg, 8, "PRG" }, diff --git a/src/boards/SA-9602B.c b/src/boards/SA-9602B.c index 10b4315..f5882e7 100644 --- a/src/boards/SA-9602B.c +++ b/src/boards/SA-9602B.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "mmc3.h" -static void SA9602BPW(uint32 A, uint8 V) { +static void SA9602BPW(uint32_t A, uint8_t V) { setprg8(A, (EXPREGS[1] & 0xC0) | (V & 0x3F)); if (MMC3_cmd & 0x40) setprg8(0x8000, 62); diff --git a/src/boards/__dummy_mapper.c b/src/boards/__dummy_mapper.c index 91275ac..6763f95 100644 --- a/src/boards/__dummy_mapper.c +++ b/src/boards/__dummy_mapper.c @@ -20,14 +20,14 @@ #include "mapinc.h" -static uint8 reg[8]; -static uint8 IRQa; -static int16 IRQCount, IRQLatch; +static uint8_t reg[8]; +static uint8_t IRQa; +static int16_t IRQCount, IRQLatch; /* -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; -static uint8 *CHRRAM = NULL; -static uint32 CHRRAMSIZE; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; +static uint8_t *CHRRAM = NULL; +static uint32_t CHRRAMSIZE; */ static SFORMAT StateRegs[] = @@ -81,12 +81,12 @@ void MapperNNN_Init(CartInfo *info) { GameStateRestore = StateRestore; #if 0 CHRRAMSIZE = 8192; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM = (uint8_t*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM"); WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); if (info->battery) { diff --git a/src/boards/__serial.c b/src/boards/__serial.c index db56841..24c29b6 100644 --- a/src/boards/__serial.c +++ b/src/boards/__serial.c @@ -91,7 +91,7 @@ int SerialIsOpen(void) { } int SerialGetChar(void) { - uint8 ch; + uint8_t ch; DWORD cr; if (SerialPort != NULL) { if (ReadFile(SerialPort, &ch, 1, (LPDWORD)&cr, NULL) && cr) @@ -100,14 +100,14 @@ int SerialGetChar(void) { return EOF; } -void SendCmd(uint8 *cmd, int size) { +void SendCmd(uint8_t *cmd, int size) { int i; for (i = 0; i < size; i++) { SerialSendChar(cmd[i]); } } -int ReadResp(uint8 *resp, int size) { +int ReadResp(uint8_t *resp, int size) { int i = 0, sum = 0, data; while (i < size) { while ((data = SerialGetChar()) == EOF) { @@ -141,10 +141,10 @@ int SerialGetChar(void) { return EOF; } -void SendCmd(uint8 *cmd, int size) { +void SendCmd(uint8_t *cmd, int size) { } -int ReadResp(uint8 *resp, int size) { +int ReadResp(uint8_t *resp, int size) { return 0; } diff --git a/src/boards/__serial.h b/src/boards/__serial.h index 56d35c3..f85087c 100644 --- a/src/boards/__serial.h +++ b/src/boards/__serial.h @@ -13,11 +13,11 @@ typedef int BOOL; #include "../fceu-types.h" -void SendCmd(uint8 *cmd, int size); -int ReadResp(uint8 *resp, int size); +void SendCmd(uint8_t *cmd, int size); +int ReadResp(uint8_t *resp, int size); -#define SEND(cmd) SendCmd((uint8*)&cmd[0], sizeof(cmd)) -#define GET(buf, size) ReadResp((uint8*)&buf, size) +#define SEND(cmd) SendCmd((uint8_t*)&cmd[0], sizeof(cmd)) +#define GET(buf, size) ReadResp((uint8_t*)&buf, size) #define SENDGET(cmd, buf, size) SEND(cmd); GET(buf, size) BOOL SerialOpen(int port, int baud); diff --git a/src/boards/a9746.c b/src/boards/a9746.c index 009c7fb..add889f 100644 --- a/src/boards/a9746.c +++ b/src/boards/a9746.c @@ -21,13 +21,13 @@ #include "mapinc.h" #include "mmc3.h" -static void UNLA9746PWrap(uint32 A, uint8 V) { +static void UNLA9746PWrap(uint32_t A, uint8_t V) { int prgAND = EXPREGS[0] &0x40? 0x0F: 0x1F; int prgOR = EXPREGS[0] <<4 &0x10 | EXPREGS[1] &0x20; setprg8(A, V &prgAND | prgOR &~prgAND); } -static void UNLA9746CWrap(uint32 A, uint8 V) { +static void UNLA9746CWrap(uint32_t A, uint8_t V) { int chrAND = EXPREGS[0] &0x80? 0x7F: 0xFF; int chrOR = EXPREGS[0] <<4 &0x80 | EXPREGS[1] <<3 &0x100; setchr1(A, V &chrAND | chrOR &~chrAND); diff --git a/src/boards/ac-08.c b/src/boards/ac-08.c index da26e39..798fb45 100644 --- a/src/boards/ac-08.c +++ b/src/boards/ac-08.c @@ -26,8 +26,8 @@ #include "mapinc.h" #include "../fds_apu.h" -static uint8 reg, mirr; -static uint8 prg; +static uint8_t reg, mirr; +static uint8_t prg; static SFORMAT StateRegs[] = { diff --git a/src/boards/addrlatch.c b/src/boards/addrlatch.c index 770bf9e..3225491 100644 --- a/src/boards/addrlatch.c +++ b/src/boards/addrlatch.c @@ -20,15 +20,15 @@ #include "mapinc.h" -static uint16 latche, latcheinit; -static uint16 addrreg0, addrreg1; -static uint8 dipswitch; +static uint16_t latche, latcheinit; +static uint16_t addrreg0, addrreg1; +static uint8_t dipswitch; static void (*WSync)(void); static readfunc defread; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; -static uint32 hasBattery; -static uint32 submapper = 0; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; +static uint32_t hasBattery; +static uint32_t submapper = 0; static DECLFW(LatchWrite) { latche = A; @@ -62,7 +62,7 @@ static void StateRestore(int version) { WSync(); } -static void Latch_Init(CartInfo *info, void (*proc)(void), readfunc func, uint16 linit, uint16 adr0, uint16 adr1, uint8 wram) { +static void Latch_Init(CartInfo *info, void (*proc)(void), readfunc func, uint16_t linit, uint16_t adr0, uint16_t adr1, uint8_t wram) { latcheinit = linit; addrreg0 = adr0; addrreg1 = adr1; @@ -77,7 +77,7 @@ static void Latch_Init(CartInfo *info, void (*proc)(void), readfunc func, uint16 info->Close = LatchClose; if (wram) { WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); if (info->battery) { hasBattery = 1; @@ -210,7 +210,7 @@ void Mapper61_Init(CartInfo *info) { * Submapper 1: * - NTDEC 82-in-1 */ -static uint16 openBus; +static uint16_t openBus; static DECLFR(M63Read) { if (openBus) @@ -219,7 +219,7 @@ static DECLFR(M63Read) { } static void M63Sync(void) { - uint16 prg =latche >>2 &(submapper ==1? 0x7F: 0xFF); + uint16_t prg =latche >>2 &(submapper ==1? 0x7F: 0xFF); if (latche &2) setprg32(0x8000, prg >>1); else { @@ -245,7 +245,7 @@ void Mapper63_Init(CartInfo *info) { */ static void M92Sync(void) { - uint8 reg = latche & 0xF0; + uint8_t reg = latche & 0xF0; setprg16(0x8000, 0); if (latche >= 0x9000) { switch (reg) { @@ -294,9 +294,9 @@ void Mapper201_Init(CartInfo *info) { static void M202Sync(void) { /* According to more carefull hardware tests and PCB study */ - int32 mirror = latche & 1; - int32 bank = (latche >> 1) & 0x7; - int32 select = (mirror & (bank >> 2)); + int32_t mirror = latche & 1; + int32_t bank = (latche >> 1) & 0x7; + int32_t select = (mirror & (bank >> 2)); setprg16(0x8000, select ? (bank & 6) | 0 : bank); setprg16(0xc000, select ? (bank & 6) | 1 : bank); setmirror(mirror ^ 1); @@ -310,8 +310,8 @@ void Mapper202_Init(CartInfo *info) { /*------------------ Map 204 ---------------------------*/ static void M204Sync(void) { - int32 tmp2 = latche & 0x6; - int32 tmp1 = tmp2 + ((tmp2 == 0x6) ? 0 : (latche & 1)); + int32_t tmp2 = latche & 0x6; + int32_t tmp1 = tmp2 + ((tmp2 == 0x6) ? 0 : (latche & 1)); setprg16(0x8000, tmp1); setprg16(0xc000, tmp2 + ((tmp2 == 0x6) ? 1 : (latche & 1))); setchr8(tmp1); @@ -325,7 +325,7 @@ void Mapper204_Init(CartInfo *info) { /*------------------ Map 212 ---------------------------*/ static DECLFR(M212Read) { - uint8 ret = CartBROB(A); + uint8_t ret = CartBROB(A); if ((A & 0xE010) == 0x6000) ret |= 0x80; return ret; @@ -372,9 +372,9 @@ void Mapper217_Init(CartInfo *info) { /*------------------ Map 227 ---------------------------*/ static void M227Sync(void) { - uint32 S = latche & 1; - uint32 p = ((latche >> 2) & 0x1F) + ((latche & 0x100) >> 3); - uint32 L = (latche >> 9) & 1; + uint32_t S = latche & 1; + uint32_t p = ((latche >> 2) & 0x1F) + ((latche & 0x100) >> 3); + uint32_t L = (latche >> 9) & 1; if ((latche >> 7) & 1) { if (S) { @@ -470,11 +470,11 @@ void Mapper231_Init(CartInfo *info) { } /*------------------ Map 242 ---------------------------*/ -static uint8 M242TwoChips; +static uint8_t M242TwoChips; static void M242Sync(void) { - uint32 S = latche & 1; - uint32 p = (latche >> 2) & 0x1F; - uint32 L = (latche >> 9) & 1; + uint32_t S = latche & 1; + uint32_t p = (latche >> 2) & 0x1F; + uint32_t L = (latche >> 9) & 1; if (M242TwoChips) { if (latche &0x600) @@ -582,8 +582,8 @@ void Mapper288_Init(CartInfo *info) { /*------------------ Map 385 ---------------------------*/ static void M385Sync(void) { - int32 mirror = latche & 1; - int32 bank = (latche >> 1) & 0x7; + int32_t mirror = latche & 1; + int32_t bank = (latche >> 1) & 0x7; setprg16(0x8000, bank); setprg16(0xc000, bank); setmirror(mirror ^ 1); @@ -629,7 +629,7 @@ void BMC190in1_Init(CartInfo *info) { /*-------------- BMC810544-C-A1 ------------------------*/ static void BMC810544CA1Sync(void) { - uint32 bank = latche >> 7; + uint32_t bank = latche >> 7; if (latche & 0x40) setprg32(0x8000, bank); else { @@ -659,8 +659,8 @@ static void BMCNTD03Sync(void) { * 1001 1100 0000 0100 h * 1011 1010 1100 0100 */ - uint32 prg = ((latche >> 10) & 0x1e); - uint32 chr = ((latche & 0x0300) >> 5) | (latche & 7); + uint32_t prg = ((latche >> 10) & 0x1e); + uint32_t chr = ((latche & 0x0300) >> 5) | (latche & 7); if (latche & 0x80) { setprg16(0x8000, prg | ((latche >> 6) & 1)); setprg16(0xC000, prg | ((latche >> 6) & 1)); @@ -718,13 +718,13 @@ static void J2282Sync(void) setchr8(0); if ((latche & 0x40)) { - uint8 bank = (latche >> 0) & 0x1F; + uint8_t bank = (latche >> 0) & 0x1F; setprg16(0x8000, bank); setprg16(0xC000, bank); } else { - uint8 bank; + uint8_t bank; if (latche & 0x800) { setprg8(0x6000, ((latche << 1) & 0x3F) | 3); diff --git a/src/boards/asic_fme7.c b/src/boards/asic_fme7.c index 2cb4a09..93cb4df 100644 --- a/src/boards/asic_fme7.c +++ b/src/boards/asic_fme7.c @@ -22,8 +22,8 @@ #include "asic_fme7.h" static void (*FME7_cbSync)(); -static uint8 FME7_index; -static uint8 FME7_reg[16]; +static uint8_t FME7_index; +static uint8_t FME7_reg[16]; static SFORMAT FME7_stateRegs[] = { { &FME7_index, 1, "FM7I" }, @@ -102,7 +102,7 @@ static void FME7_configure (void (*sync)()) { FME7_cbSync = sync; } -void FME7_activate (uint8 clear, void (*sync)()) { +void FME7_activate (uint8_t clear, void (*sync)()) { FME7_configure(sync); FME7_setHandlers(); if (clear) diff --git a/src/boards/asic_fme7.h b/src/boards/asic_fme7.h index 06994d3..c6278b7 100644 --- a/src/boards/asic_fme7.h +++ b/src/boards/asic_fme7.h @@ -30,7 +30,7 @@ DECLFW (FME7_writeWRAM); DECLFW (FME7_writeReg); void FP_FASTAPASS(1) FME7_cpuCycle (int); void FME7_clear (); -void FME7_activate (uint8, void (*)()); +void FME7_activate (uint8_t, void (*)()); void FME7_addExState (); void FME7_restore (int); void FME7_power (); diff --git a/src/boards/asic_h3001.c b/src/boards/asic_h3001.c index e4dd57c..e02f7e1 100644 --- a/src/boards/asic_h3001.c +++ b/src/boards/asic_h3001.c @@ -22,13 +22,13 @@ #include "asic_h3001.h" static void (*H3001_cbSync)(); -static uint8 H3001_prg[2]; -static uint8 H3001_chr[8]; -static uint8 H3001_layout; -static uint8 H3001_nt; -static uint8 H3001_irq; -static uint16 H3001_reload; -static uint16 H3001_count; +static uint8_t H3001_prg[2]; +static uint8_t H3001_chr[8]; +static uint8_t H3001_layout; +static uint8_t H3001_nt; +static uint8_t H3001_irq; +static uint16_t H3001_reload; +static uint16_t H3001_count; static SFORMAT H3001_state[] = { { H3001_prg, 2, "H31P" }, @@ -41,7 +41,7 @@ static SFORMAT H3001_state[] = { { 0 } }; -static int H3001_getPRGBank (uint8 bank) { +static int H3001_getPRGBank (uint8_t bank) { if (H3001_layout &0x80 && ~bank &1) bank ^= 2; return bank &2? 0xFE | bank &1: H3001_prg[bank &1]; } @@ -133,7 +133,7 @@ static void H3001_configure (void (*sync)()) { H3001_cbSync = sync; } -void H3001_activate (uint8 clear, void (*sync)()) { +void H3001_activate (uint8_t clear, void (*sync)()) { H3001_configure(sync); H3001_setHandlers(); if (clear) diff --git a/src/boards/asic_h3001.h b/src/boards/asic_h3001.h index 1c5122e..1b99644 100644 --- a/src/boards/asic_h3001.h +++ b/src/boards/asic_h3001.h @@ -26,7 +26,7 @@ void H3001_syncCHR (int, int); void H3001_syncMirror (); DECLFW (H3001_write); void H3001_clear (); -void H3001_activate (uint8, void (*)()); +void H3001_activate (uint8_t, void (*)()); void H3001_addExState (); void H3001_restore (int); void H3001_power (); diff --git a/src/boards/asic_latch.c b/src/boards/asic_latch.c index c40d263..889a153 100644 --- a/src/boards/asic_latch.c +++ b/src/boards/asic_latch.c @@ -22,10 +22,10 @@ #include "asic_latch.h" static void (*Latch_cbSync)(); -static uint16 Latch_from, Latch_to; -static void (*Latch_cbWrite)(uint16*, uint8*, uint8); -uint16 Latch_address; -uint8 Latch_data; +static uint16_t Latch_from, Latch_to; +static void (*Latch_cbWrite)(uint16_t*, uint8_t*, uint8_t); +uint16_t Latch_address; +uint8_t Latch_data; static SFORMAT Latch_state[] = { {&Latch_address, 2 | FCEUSTATE_RLSB, "LATA" }, @@ -34,7 +34,7 @@ static SFORMAT Latch_state[] = { }; DECLFW (Latch_write) { - uint16 newAddress = A &0xFFFF; + uint16_t newAddress = A &0xFFFF; if (Latch_cbWrite) Latch_cbWrite(&newAddress, &V, CartBR(A)); Latch_address = newAddress; Latch_data = V; @@ -53,14 +53,14 @@ static void Latch_setHandlers() { SetWriteHandler(Latch_from, Latch_to, Latch_write); } -static void Latch_configure (void (*sync)(), uint16 from, uint16 to, void (*write)(uint16*, uint8*, uint8)) { +static void Latch_configure (void (*sync)(), uint16_t from, uint16_t to, void (*write)(uint16_t*, uint8_t*, uint8_t)) { Latch_cbSync = sync; Latch_from = from; Latch_to = to; Latch_cbWrite = write; } -void Latch_activate (uint8 clear, void (*sync)(), uint16 from, uint16 to, void (*write)(uint16*, uint8*, uint8)) { +void Latch_activate (uint8_t clear, void (*sync)(), uint16_t from, uint16_t to, void (*write)(uint16_t*, uint8_t*, uint8_t)) { Latch_configure(sync, from, to, write); Latch_setHandlers(); if (clear) @@ -82,7 +82,7 @@ void Latch_power () { Latch_clear(); } -void Latch_init (CartInfo *info, void (*sync)(), uint16 from, uint16 to, void (*write)(uint16*, uint8*, uint8)) { +void Latch_init (CartInfo *info, void (*sync)(), uint16_t from, uint16_t to, void (*write)(uint16_t*, uint8_t*, uint8_t)) { Latch_addExState(); Latch_configure(sync, from, to, write); info->Power = Latch_power; diff --git a/src/boards/asic_latch.h b/src/boards/asic_latch.h index 80c9ef2..37e07b0 100644 --- a/src/boards/asic_latch.h +++ b/src/boards/asic_latch.h @@ -21,16 +21,16 @@ #ifndef _ASIC_LATCH_H #define _ASIC_LATCH_H -extern uint16 Latch_address; -extern uint8 Latch_data; +extern uint16_t Latch_address; +extern uint8_t Latch_data; DECLFW (Latch_write); void Latch_addExState (); void Latch_restore (int); void Latch_clear (); void Latch_power (); -void Latch_activate (uint8, void (*)(), uint16, uint16, void (*)(uint16*, uint8*, uint8)); -void Latch6_activate (uint8, void (*)(), uint16, uint16, void (*)(uint16*, uint8*, uint8)); -void Latch_init (CartInfo *, void (*)(), uint16, uint16, void (*)(uint16*, uint8*, uint8)); +void Latch_activate (uint8_t, void (*)(), uint16_t, uint16_t, void (*)(uint16_t*, uint8_t*, uint8_t)); +void Latch6_activate (uint8_t, void (*)(), uint16_t, uint16_t, void (*)(uint16_t*, uint8_t*, uint8_t)); +void Latch_init (CartInfo *, void (*)(), uint16_t, uint16_t, void (*)(uint16_t*, uint8_t*, uint8_t)); #endif diff --git a/src/boards/asic_mmc1.c b/src/boards/asic_mmc1.c index 1c5a5de..3327dc6 100644 --- a/src/boards/asic_mmc1.c +++ b/src/boards/asic_mmc1.c @@ -22,15 +22,15 @@ #include "asic_mmc1.h" static void (*MMC1_cbSync)(); -static int (*MMC1_cbGetPRGBank)(uint8); -static int (*MMC1_cbGetCHRBank)(uint8); +static int (*MMC1_cbGetPRGBank)(uint8_t); +static int (*MMC1_cbGetCHRBank)(uint8_t); static DECLFR ((*MMC1_cbReadWRAM)); static DECLFW ((*MMC1_cbWriteWRAM)); -static uint8 MMC1_type; -static uint8 MMC1_bits; -static uint8 MMC1_shift; -static uint8 MMC1_filter; -static uint8 MMC1_reg[4]; +static uint8_t MMC1_type; +static uint8_t MMC1_bits; +static uint8_t MMC1_shift; +static uint8_t MMC1_filter; +static uint8_t MMC1_reg[4]; static SFORMAT MMC1_state[] = { { MMC1_reg, 4, "MC1R" }, @@ -44,7 +44,7 @@ void MMC1_syncWRAM (int OR) { if (PRGsize[0x10]) setprg8r(0x10, 0x6000, OR); } -int MMC1_getPRGBank (uint8 bank) { +int MMC1_getPRGBank (uint8_t bank) { int result; if (MMC1_reg[0] &0x08) result = MMC1_reg[0] &0x04? (MMC1_reg[3] |bank*0xF): (MMC1_reg[3] &bank*0xF); @@ -57,7 +57,7 @@ int MMC1_getPRGBank (uint8 bank) { return result &0x0F; } -int MMC1_getCHRBank (uint8 bank) { +int MMC1_getCHRBank (uint8_t bank) { if (MMC1_reg[0] &0x10) return MMC1_reg[1 +bank]; else @@ -129,7 +129,7 @@ static void MMC1_setHandlers () { MapIRQHook = MMC1_cpuCycle; } -static void MMC1_configure (void (*sync)(), uint8 type, int (*prg)(uint8), int (*chr)(uint8), DECLFR((*read)), DECLFW((*write))) { +static void MMC1_configure (void (*sync)(), uint8_t type, int (*prg)(uint8_t), int (*chr)(uint8_t), DECLFR((*read)), DECLFW((*write))) { MMC1_type = type; MMC1_cbSync = sync; MMC1_cbGetPRGBank = prg? prg: MMC1_getPRGBank; @@ -138,7 +138,7 @@ static void MMC1_configure (void (*sync)(), uint8 type, int (*prg)(uint8), int ( MMC1_cbWriteWRAM = write; } -void MMC1_activate (uint8 clear, void (*sync)(), uint8 type, int (*prg)(uint8), int (*chr)(uint8), DECLFR((*read)), DECLFW((*write))) { +void MMC1_activate (uint8_t clear, void (*sync)(), uint8_t type, int (*prg)(uint8_t), int (*chr)(uint8_t), DECLFR((*read)), DECLFW((*write))) { MMC1_configure(sync, type, prg, chr, read, write); MMC1_setHandlers(); if (clear) @@ -160,7 +160,7 @@ void MMC1_power () { MMC1_clear(); } -void MMC1_init (CartInfo *info, void (*sync)(), uint8 type, int (*prg)(uint8), int (*chr)(uint8), DECLFR((*read)), DECLFW((*write))) { +void MMC1_init (CartInfo *info, void (*sync)(), uint8_t type, int (*prg)(uint8_t), int (*chr)(uint8_t), DECLFR((*read)), DECLFW((*write))) { MMC1_addExState(); MMC1_configure(sync, type, prg, chr, read, write); info->Power = MMC1_power; diff --git a/src/boards/asic_mmc1.h b/src/boards/asic_mmc1.h index e72260c..3b7adc0 100644 --- a/src/boards/asic_mmc1.h +++ b/src/boards/asic_mmc1.h @@ -25,8 +25,8 @@ #define MMC1_TYPE_MMC1B 1 void MMC1_syncWRAM (int); -int MMC1_getPRGBank (uint8); -int MMC1_getCHRBank (uint8); +int MMC1_getPRGBank (uint8_t); +int MMC1_getCHRBank (uint8_t); void MMC1_syncPRG (int, int); void MMC1_syncCHR (int, int); void MMC1_syncMirror (); @@ -36,7 +36,7 @@ void MMC1_clear (); void MMC1_addExState (); void MMC1_restore (int); void MMC1_power (); -void MMC1_activate (uint8, void (*)(), uint8, int (*)(uint8), int (*)(uint8), DECLFR((*)), DECLFW((*))); -void MMC1_init (CartInfo *, void (*)(), uint8, int (*)(uint8), int (*)(uint8), DECLFR((*)), DECLFW((*))); +void MMC1_activate (uint8_t, void (*)(), uint8_t, int (*)(uint8_t), int (*)(uint8_t), DECLFR((*)), DECLFW((*))); +void MMC1_init (CartInfo *, void (*)(), uint8_t, int (*)(uint8_t), int (*)(uint8_t), DECLFR((*)), DECLFW((*))); #endif diff --git a/src/boards/asic_mmc2and4.c b/src/boards/asic_mmc2and4.c index fd6c5f2..7a7fc83 100644 --- a/src/boards/asic_mmc2and4.c +++ b/src/boards/asic_mmc2and4.c @@ -22,8 +22,8 @@ #include "asic_mmc2and4.h" static void (*MMC24_cbSync)(); -static uint8 MMC24_reg[6]; -static uint8 MMC24_latch[2]; +static uint8_t MMC24_reg[6]; +static uint8_t MMC24_latch[2]; static SFORMAT MMC24_state[] = { { MMC24_reg, 6, "MC2R" }, @@ -58,7 +58,7 @@ void MMC24_syncMirror () { setmirror(MMC24_reg[5] &1? MI_H: MI_V); } -static void FP_FASTAPASS(1) MMC24_trapPPUAddressChange (uint32 A) { +static void FP_FASTAPASS(1) MMC24_trapPPUAddressChange (uint32_t A) { if ((A &0x2FF0) == 0xFD0 || (A &0x2FF0) == 0xFE0) { MMC24_latch[A >>12 &1] = A >>5 &1; MMC24_cbSync(); @@ -86,7 +86,7 @@ static void MMC24_configure (void (*sync)()) { MMC24_cbSync = sync; } -void MMC24_activate (uint8 clear, void (*sync)()) { +void MMC24_activate (uint8_t clear, void (*sync)()) { MMC24_configure(sync); MMC24_setHandlers(); if (clear) diff --git a/src/boards/asic_mmc2and4.h b/src/boards/asic_mmc2and4.h index 5c408a3..1149989 100644 --- a/src/boards/asic_mmc2and4.h +++ b/src/boards/asic_mmc2and4.h @@ -31,7 +31,7 @@ void MMC24_clear (); void MMC24_power (); void MMC24_restore (int); void MMC24_addExState (); -void MMC24_activate (uint8, void (*)()); +void MMC24_activate (uint8_t, void (*)()); void MMC24_init (CartInfo *, void (*)()); #endif diff --git a/src/boards/asic_mmc3.c b/src/boards/asic_mmc3.c index 4293d60..4336c3a 100644 --- a/src/boards/asic_mmc3.c +++ b/src/boards/asic_mmc3.c @@ -22,19 +22,19 @@ #include "asic_mmc3.h" static void (*MMC3_cbSync)(); -static int (*MMC3_cbGetPRGBank)(uint8); -static int (*MMC3_cbGetCHRBank)(uint8); +static int (*MMC3_cbGetPRGBank)(uint8_t); +static int (*MMC3_cbGetCHRBank)(uint8_t); static DECLFR ((*MMC3_cbReadWRAM)); static DECLFW ((*MMC3_cbWriteWRAM)); -static uint8 MMC3_type; -static uint8 MMC3_index; -static uint8 MMC3_reg[8]; -static uint8 MMC3_mirroring; -static uint8 MMC3_wramControl; -static uint8 MMC3_reloadValue; -static uint8 MMC3_reloadRequest; -static uint8 MMC3_irqEnable; -static uint8 MMC3_counter; +static uint8_t MMC3_type; +static uint8_t MMC3_index; +static uint8_t MMC3_reg[8]; +static uint8_t MMC3_mirroring; +static uint8_t MMC3_wramControl; +static uint8_t MMC3_reloadValue; +static uint8_t MMC3_reloadRequest; +static uint8_t MMC3_irqEnable; +static uint8_t MMC3_counter; static SFORMAT MMC3_state[] = { { MMC3_reg, 8, "M3GS" }, @@ -52,19 +52,19 @@ void MMC3_syncWRAM (int OR) { if (PRGsize[0x10]) setprg8r(0x10, 0x6000, OR); } -int MMC3_getPRGBank (uint8 bank) { +int MMC3_getPRGBank (uint8_t bank) { bank &= 3; if (MMC3_index &0x40 && ~bank &1) bank ^= 2; return bank &2? 0xFE | bank &1: MMC3_reg[6 | bank &1]; } -int MMC3_getCHRBank (uint8 bank) { +int MMC3_getCHRBank (uint8_t bank) { bank &= 7; if (MMC3_index &0x80) bank ^= 4; return bank &4? MMC3_reg[bank -2]: MMC3_reg[bank >>1] &~1 | bank &1; } -uint8 MMC3_getMirroring (void) { +uint8_t MMC3_getMirroring (void) { return MMC3_mirroring; } @@ -106,7 +106,7 @@ void MMC3_syncMirror () { } void MMC3_clockCounter () { - uint8 prevCounter = MMC3_counter; + uint8_t prevCounter = MMC3_counter; if (MMC3_reloadRequest || !MMC3_counter) MMC3_counter = MMC3_reloadValue; else @@ -148,7 +148,7 @@ static void MMC3_setHandlers () { GameHBIRQHook = MMC3_clockCounter; } -static void MMC3_configure (void (*sync)(), uint8 type, int (*prg)(uint8), int (*chr)(uint8), DECLFR((*read)), DECLFW((*write))) { +static void MMC3_configure (void (*sync)(), uint8_t type, int (*prg)(uint8_t), int (*chr)(uint8_t), DECLFR((*read)), DECLFW((*write))) { MMC3_type = type; MMC3_cbSync = sync; MMC3_cbGetPRGBank = prg? prg: MMC3_getPRGBank; @@ -157,7 +157,7 @@ static void MMC3_configure (void (*sync)(), uint8 type, int (*prg)(uint8), int ( MMC3_cbWriteWRAM = write; } -void MMC3_activate (uint8 clear, void (*sync)(), uint8 type, int (*prg)(uint8), int (*chr)(uint8), DECLFR((*read)), DECLFW((*write))) { +void MMC3_activate (uint8_t clear, void (*sync)(), uint8_t type, int (*prg)(uint8_t), int (*chr)(uint8_t), DECLFR((*read)), DECLFW((*write))) { MMC3_configure(sync, type, prg, chr, read, write); MMC3_setHandlers(); if (clear) @@ -179,7 +179,7 @@ void MMC3_power () { MMC3_clear(); } -void MMC3_init (CartInfo *info, void (*sync)(), uint8 type, int (*prg)(uint8), int (*chr)(uint8), DECLFR((*read)), DECLFW((*write))) { +void MMC3_init (CartInfo *info, void (*sync)(), uint8_t type, int (*prg)(uint8_t), int (*chr)(uint8_t), DECLFR((*read)), DECLFW((*write))) { MMC3_addExState(); MMC3_configure(sync, type, prg, chr, read, write); info->Power = MMC3_power; diff --git a/src/boards/asic_mmc3.h b/src/boards/asic_mmc3.h index a782d62..83ab3cd 100644 --- a/src/boards/asic_mmc3.h +++ b/src/boards/asic_mmc3.h @@ -28,9 +28,9 @@ #define MMC3_TYPE_MMC6 4 /* 1 KiB of built-in WRAM */ void MMC3_syncWRAM (int); -int MMC3_getPRGBank (uint8); -int MMC3_getCHRBank (uint8); -uint8 MMC3_getMirroring (void); +int MMC3_getPRGBank (uint8_t); +int MMC3_getCHRBank (uint8_t); +uint8_t MMC3_getMirroring (void); void MMC3_syncPRG (int, int); void MMC3_syncCHR (int, int); void MMC3_syncMirror (); @@ -38,10 +38,10 @@ void MMC3_clockCounter (); void MMC3_clockCounter_KickMaster (); DECLFW (MMC3_writeReg); void MMC3_clear (); -void MMC3_activate (uint8, void (*)(), uint8, int (*)(uint8), int (*)(uint8), DECLFR((*)), DECLFW((*))); +void MMC3_activate (uint8_t, void (*)(), uint8_t, int (*)(uint8_t), int (*)(uint8_t), DECLFR((*)), DECLFW((*))); void MMC3_addExState(); void MMC3_restore (int); void MMC3_power (); -void MMC3_init (CartInfo *, void (*)(), uint8, int (*)(uint8), int (*)(uint8), DECLFR((*)), DECLFW((*))); +void MMC3_init (CartInfo *, void (*)(), uint8_t, int (*)(uint8_t), int (*)(uint8_t), DECLFR((*)), DECLFW((*))); #endif diff --git a/src/boards/asic_n118.c b/src/boards/asic_n118.c index 4ef93d3..8b2f27f 100644 --- a/src/boards/asic_n118.c +++ b/src/boards/asic_n118.c @@ -22,10 +22,10 @@ #include "asic_n118.h" static void (*N118_cbSync)(); -static int (*N118_cbGetPRGBank)(uint8); -static int (*N118_cbGetCHRBank)(uint8); -static uint8 N118_index; -static uint8 N118_reg[8]; +static int (*N118_cbGetPRGBank)(uint8_t); +static int (*N118_cbGetCHRBank)(uint8_t); +static uint8_t N118_index; +static uint8_t N118_reg[8]; static SFORMAT N118_state[] = { { N118_reg, 8, "N8RG" }, @@ -33,11 +33,11 @@ static SFORMAT N118_state[] = { { 0 } }; -int N118_getPRGBank (uint8 bank) { +int N118_getPRGBank (uint8_t bank) { return bank &2? (0xFE | bank &1): N118_reg[6 | bank &1]; } -int N118_getCHRBank (uint8 bank) { +int N118_getCHRBank (uint8_t bank) { return bank &4? N118_reg[bank -2]: (N118_reg[bank >>1] &~1 | bank &1); } @@ -71,13 +71,13 @@ static void N118_setHandlers () { SetWriteHandler(0x8000, 0x9FFF, N118_writeReg); } -static void N118_configure (void (*sync)(), int (*prg)(uint8), int (*chr)(uint8)) { +static void N118_configure (void (*sync)(), int (*prg)(uint8_t), int (*chr)(uint8_t)) { N118_cbSync = sync; N118_cbGetPRGBank = prg? prg: N118_getPRGBank; N118_cbGetCHRBank = chr? chr: N118_getCHRBank; } -void N118_activate (uint8 clear, void (*sync)(), int (*prg)(uint8), int (*chr)(uint8)) { +void N118_activate (uint8_t clear, void (*sync)(), int (*prg)(uint8_t), int (*chr)(uint8_t)) { N118_configure(sync, prg, chr); N118_setHandlers(); if (clear) @@ -99,7 +99,7 @@ void N118_power () { N118_clear(); } -void N118_init (CartInfo *info, void (*sync)(), int (*prg)(uint8), int (*chr)(uint8)) { +void N118_init (CartInfo *info, void (*sync)(), int (*prg)(uint8_t), int (*chr)(uint8_t)) { N118_addExState(); N118_configure(sync, prg, chr); info->Power = N118_power; diff --git a/src/boards/asic_n118.h b/src/boards/asic_n118.h index 77438ae..8b7cde2 100644 --- a/src/boards/asic_n118.h +++ b/src/boards/asic_n118.h @@ -21,16 +21,16 @@ #ifndef _ASIC_N118_H #define _ASIC_N118_H -int N118_getPRGBank (uint8); -int N118_getCHRBank (uint8); +int N118_getPRGBank (uint8_t); +int N118_getCHRBank (uint8_t); void N118_syncPRG (int, int); void N118_syncCHR (int, int); DECLFW (N118_writeReg); void N118_clear (); -void N118_activate (uint8, void (*)(), int (*)(uint8), int (*)(uint8)); +void N118_activate (uint8_t, void (*)(), int (*)(uint8_t), int (*)(uint8_t)); void N118_addExState(); void N118_restore (int); void N118_power (); -void N118_init (CartInfo *, void (*)(), int (*)(uint8), int (*)(uint8)); +void N118_init (CartInfo *, void (*)(), int (*)(uint8_t), int (*)(uint8_t)); #endif diff --git a/src/boards/asic_pt8154.c b/src/boards/asic_pt8154.c index 9a80a1d..4e57bef 100644 --- a/src/boards/asic_pt8154.c +++ b/src/boards/asic_pt8154.c @@ -23,7 +23,7 @@ #include "asic_mmc3.h" static void (*PT8154_cbSync)(); -static uint8 PT8154_reg; +static uint8_t PT8154_reg; static SFORMAT PT8154_state[] = { {&PT8154_reg, 1, "189R" }, @@ -69,7 +69,7 @@ static void PT8154_configure (void (*sync)()) { PT8154_cbSync = sync; } -void PT8154_activate (uint8 clear, void (*sync)()) { +void PT8154_activate (uint8_t clear, void (*sync)()) { MMC3_activate(clear, sync, MMC3_TYPE_AX5202P, NULL, NULL, NULL, PT8154_writeWRAM); PT8154_configure(sync); PT8154_setHandlers(); diff --git a/src/boards/asic_pt8154.h b/src/boards/asic_pt8154.h index 1991d25..9ffa0d6 100644 --- a/src/boards/asic_pt8154.h +++ b/src/boards/asic_pt8154.h @@ -27,7 +27,7 @@ void PT8154_syncMirror (); DECLFW (PT8154_writeExtra); DECLFW (PT8154_writeWRAM); void PT8154_clear (); -void PT8154_activate (uint8, void (*)()); +void PT8154_activate (uint8_t, void (*)()); void PT8154_addExState (); void PT8154_restore (int); void PT8154_power (); diff --git a/src/boards/asic_qj.c b/src/boards/asic_qj.c index 1562d73..2bda197 100644 --- a/src/boards/asic_qj.c +++ b/src/boards/asic_qj.c @@ -23,7 +23,7 @@ #include "asic_mmc3.h" static void (*QJ_cbSync)(); -static uint8 QJ_reg; +static uint8_t QJ_reg; static SFORMAT QJ_state[] = { {&QJ_reg, 1, "QJRG" }, @@ -59,7 +59,7 @@ static void QJ_configure (void (*sync)()) { QJ_cbSync = sync; } -void QJ_activate (uint8 clear, void (*sync)()) { +void QJ_activate (uint8_t clear, void (*sync)()) { MMC3_activate(clear, sync, MMC3_TYPE_SHARP, NULL, NULL, NULL, QJ_writeWRAM); QJ_configure(sync); QJ_setHandlers(); diff --git a/src/boards/asic_qj.h b/src/boards/asic_qj.h index 28ecd9e..3d58f5a 100644 --- a/src/boards/asic_qj.h +++ b/src/boards/asic_qj.h @@ -27,7 +27,7 @@ void QJ_syncCHR (int, int); void QJ_syncMirror (); DECLFW (QJ_write); void QJ_clear (); -void QJ_activate (uint8, void (*)()); +void QJ_activate (uint8_t, void (*)()); void QJ_addExState (); void QJ_restore (int); void QJ_power (); diff --git a/src/boards/asic_tc3294.c b/src/boards/asic_tc3294.c index a22de7b..2871477 100644 --- a/src/boards/asic_tc3294.c +++ b/src/boards/asic_tc3294.c @@ -23,8 +23,8 @@ #include "asic_mmc3.h" static void (*TC3294_cbSync)(); -static uint8 TC3294_index; -uint8 TC3294_reg[4]; +static uint8_t TC3294_index; +uint8_t TC3294_reg[4]; static SFORMAT TC3294_state[] = { { TC3294_reg, 4, "329S" }, @@ -72,7 +72,7 @@ static void TC3294_configure (void (*sync)()) { TC3294_cbSync = sync; } -void TC3294_activate (uint8 clear, void (*sync)()) { +void TC3294_activate (uint8_t clear, void (*sync)()) { MMC3_activate(clear, sync, MMC3_TYPE_AX5202P, NULL, NULL, NULL, TC3294_writeReg); TC3294_configure(sync); TC3294_setHandlers(); diff --git a/src/boards/asic_tc3294.h b/src/boards/asic_tc3294.h index a1ba78b..1a75ac2 100644 --- a/src/boards/asic_tc3294.h +++ b/src/boards/asic_tc3294.h @@ -21,14 +21,14 @@ #ifndef _ASIC_TC3294_H #define _ASIC_TC3294_H -extern uint8 TC3294_reg[4]; +extern uint8_t TC3294_reg[4]; void TC3294_syncWRAM (int); void TC3294_syncPRG (int, int); void TC3294_syncCHR (int, int); void TC3294_syncMirror (); DECLFW (TC3294_writeReg); void TC3294_clear (); -void TC3294_activate (uint8, void (*)()); +void TC3294_activate (uint8_t, void (*)()); void TC3294_addExState (); void TC3294_restore (int); void TC3294_power (); diff --git a/src/boards/asic_vrc1.c b/src/boards/asic_vrc1.c index c25ef2c..862c56c 100644 --- a/src/boards/asic_vrc1.c +++ b/src/boards/asic_vrc1.c @@ -22,7 +22,7 @@ #include "asic_vrc1.h" static void (*VRC1_cbSync)(); -static uint8 VRC1_reg[8]; +static uint8_t VRC1_reg[8]; static SFORMAT VRC1_state[] = { { VRC1_reg, 8, "VC1R" }, @@ -64,7 +64,7 @@ static void VRC1_configure (void (*sync)()) { VRC1_cbSync = sync; } -void VRC1_activate (uint8 clear, void (*sync)()) { +void VRC1_activate (uint8_t clear, void (*sync)()) { VRC1_configure(sync); VRC1_setHandlers(); if (clear) diff --git a/src/boards/asic_vrc1.h b/src/boards/asic_vrc1.h index ed44fd6..ea65f28 100644 --- a/src/boards/asic_vrc1.h +++ b/src/boards/asic_vrc1.h @@ -26,7 +26,7 @@ void VRC1_syncCHR (int, int); void VRC1_syncMirror (); DECLFW (VRC1_writeReg); void VRC1_clear (); -void VRC1_activate (uint8, void (*)()); +void VRC1_activate (uint8_t, void (*)()); void VRC1_addExState (); void VRC1_restore (int); void VRC1_power (); diff --git a/src/boards/asic_vrc2and4.c b/src/boards/asic_vrc2and4.c index e611074..5bb7428 100644 --- a/src/boards/asic_vrc2and4.c +++ b/src/boards/asic_vrc2and4.c @@ -24,21 +24,21 @@ static void (*VRC24_cbSync)(); static int VRC24_A0, VRC24_A1; -static int (*VRC24_cbGetPRGBank)(uint8); -static int (*VRC24_cbGetCHRBank)(uint8); +static int (*VRC24_cbGetPRGBank)(uint8_t); +static int (*VRC24_cbGetCHRBank)(uint8_t); static DECLFR((*VRC24_cbReadWRAM)); static DECLFW((*VRC24_cbWriteWRAM)); static DECLFW((*VRC24_cbExternalSelect)); -static uint8 VRC24_isVRC4; /* VRC2 or VRC4? VRC2 has no single-screen mirroring, no PRG A14 swap and no IRQ counter */ -static uint8 VRC24_useRepeatBit; /* Some VRC4 clones ignore the "repeat" bit in the IRQ Mode register */ -static uint8 VRC24_prg[2]; -static uint16 VRC24_chr[8]; -static uint8 VRC24_mirroring; -static uint8 VRC24_misc; -uint8 VRC2_pins; /* EEPROM interface */ -static uint8 VRC4_latch; -static uint8 VRC4_mode; -static uint8 VRC4_count; +static uint8_t VRC24_isVRC4; /* VRC2 or VRC4? VRC2 has no single-screen mirroring, no PRG A14 swap and no IRQ counter */ +static uint8_t VRC24_useRepeatBit; /* Some VRC4 clones ignore the "repeat" bit in the IRQ Mode register */ +static uint8_t VRC24_prg[2]; +static uint16_t VRC24_chr[8]; +static uint8_t VRC24_mirroring; +static uint8_t VRC24_misc; +uint8_t VRC2_pins; /* EEPROM interface */ +static uint8_t VRC4_latch; +static uint8_t VRC4_mode; +static uint8_t VRC4_count; static signed short int VRC4_cycles; static SFORMAT VRC24_stateRegs[] = { @@ -90,12 +90,12 @@ void VRC24_syncWRAM (int OR) { if (PRGsize[0x10]) setprg8r(0x10, 0x6000, OR); } -int VRC24_getPRGBank (uint8 bank) { +int VRC24_getPRGBank (uint8_t bank) { if (~bank &1 && VRC24_misc &2) bank ^= 2; return bank &2? (0xFE | bank &1): VRC24_prg[bank &1]; } -int VRC24_getCHRBank (uint8 bank) { +int VRC24_getCHRBank (uint8_t bank) { return VRC24_chr[bank &7]; } @@ -215,7 +215,7 @@ static void VRC24_setHandlers () { if (VRC24_isVRC4) MapIRQHook = VRC4_cpuCycle; } -static void VRC2_configure (void (*sync)(), int A0, int A1, int (*prg)(uint8), int (*chr)(uint8), DECLFR((*read)), DECLFW((*write))) { +static void VRC2_configure (void (*sync)(), int A0, int A1, int (*prg)(uint8_t), int (*chr)(uint8_t), DECLFR((*read)), DECLFW((*write))) { VRC24_cbSync = sync; VRC24_A0 = A0; VRC24_A1 = A1; @@ -227,7 +227,7 @@ static void VRC2_configure (void (*sync)(), int A0, int A1, int (*prg)(uint8), i VRC24_cbExternalSelect = NULL; } -static void VRC4_configure (void (*sync)(), int A0, int A1, uint8 useRepeatBit, int (*prg)(uint8), int (*chr)(uint8), DECLFR((*read)), DECLFW((*write)), DECLFW((*externalSelect))) { +static void VRC4_configure (void (*sync)(), int A0, int A1, uint8_t useRepeatBit, int (*prg)(uint8_t), int (*chr)(uint8_t), DECLFR((*read)), DECLFW((*write)), DECLFW((*externalSelect))) { VRC24_cbSync = sync; VRC24_A0 = A0; VRC24_A1 = A1; @@ -245,7 +245,7 @@ void VRC24_reconfigure(int A0, int A1) { VRC24_A1 = A1; } -void VRC2_activate (uint8 clear, void (*sync)(), int A0, int A1, int (*prg)(uint8), int (*chr)(uint8), DECLFR((*read)), DECLFW((*write))) { +void VRC2_activate (uint8_t clear, void (*sync)(), int A0, int A1, int (*prg)(uint8_t), int (*chr)(uint8_t), DECLFR((*read)), DECLFW((*write))) { VRC2_configure(sync, A0, A1, prg, chr, read, write); VRC24_setHandlers(); if (clear) @@ -254,7 +254,7 @@ void VRC2_activate (uint8 clear, void (*sync)(), int A0, int A1, int (*prg)(uint VRC24_cbSync(); } -void VRC4_activate (uint8 clear, void (*sync)(), int A0, int A1, uint8 useRepeatBit, int (*prg)(uint8), int (*chr)(uint8), DECLFR((*read)), DECLFW((*write)), DECLFW((*externalSelect))) { +void VRC4_activate (uint8_t clear, void (*sync)(), int A0, int A1, uint8_t useRepeatBit, int (*prg)(uint8_t), int (*chr)(uint8_t), DECLFR((*read)), DECLFW((*write)), DECLFW((*externalSelect))) { VRC4_configure(sync, A0, A1, useRepeatBit, prg, chr, read, write, externalSelect); VRC24_setHandlers(); if (clear) @@ -288,14 +288,14 @@ void VRC24_power () { VRC24_clear(); } -void VRC2_init (CartInfo *info, void (*sync)(), int A0, int A1, int (*prg)(uint8), int (*chr)(uint8), DECLFR((*read)), DECLFW((*write))) { +void VRC2_init (CartInfo *info, void (*sync)(), int A0, int A1, int (*prg)(uint8_t), int (*chr)(uint8_t), DECLFR((*read)), DECLFW((*write))) { VRC2_addExState(); VRC2_configure(sync, A0, A1, prg, chr, read, write); info->Power = VRC24_power; GameStateRestore = VRC24_restore; } -void VRC4_init (CartInfo *info, void (*sync)(), int A0, int A1, uint8 useRepeatBit, int (*prg)(uint8), int (*chr)(uint8), DECLFR((*read)), DECLFW((*write)), DECLFW((*externalSelect))) { +void VRC4_init (CartInfo *info, void (*sync)(), int A0, int A1, uint8_t useRepeatBit, int (*prg)(uint8_t), int (*chr)(uint8_t), DECLFR((*read)), DECLFW((*write)), DECLFW((*externalSelect))) { VRC4_addExState(); VRC4_configure(sync, A0, A1, useRepeatBit, prg, chr, read, write, externalSelect); info->Power = VRC24_power; diff --git a/src/boards/asic_vrc2and4.h b/src/boards/asic_vrc2and4.h index 0dcc8f7..aceccd0 100644 --- a/src/boards/asic_vrc2and4.h +++ b/src/boards/asic_vrc2and4.h @@ -21,7 +21,7 @@ #ifndef _VRC2AND4_H #define _VRC2AND4_H -extern uint8 VRC2_pins; +extern uint8_t VRC2_pins; DECLFR(VRC2_readMicrowire); DECLFW(VRC2_writeMicrowire); @@ -31,22 +31,22 @@ DECLFW(VRC24_writeWRAM); void VRC24_syncWRAM (int); void VRC24_syncPRG (int, int); void VRC24_syncCHR (int, int); -int VRC24_getPRGBank (uint8); -int VRC24_getCHRBank (uint8); +int VRC24_getPRGBank (uint8_t); +int VRC24_getCHRBank (uint8_t); void VRC24_syncMirror (); DECLFW(VRC24_writeReg); void FP_FASTAPASS(1) VRC4_cpuCycle(int); void VRC24_reconfigure (int, int); void VRC24_clear (); -void VRC2_activate (uint8, void (*)(), int, int, int (*)(uint8), int (*)(uint8), DECLFR((*)), DECLFW((*))); -void VRC4_activate (uint8, void (*)(), int, int, uint8, int (*)(uint8), int (*)(uint8), DECLFR((*)), DECLFW((*)), DECLFW((*))); +void VRC2_activate (uint8_t, void (*)(), int, int, int (*)(uint8_t), int (*)(uint8_t), DECLFR((*)), DECLFW((*))); +void VRC4_activate (uint8_t, void (*)(), int, int, uint8_t, int (*)(uint8_t), int (*)(uint8_t), DECLFR((*)), DECLFW((*)), DECLFW((*))); void VRC2_addExState (); void VRC4_addExState (); void VRC24_addExState (); void VRC24_restore (int); void VRC24_power (); -void VRC2_init (CartInfo *, void (*)(), int, int, int (*)(uint8), int (*)(uint8), DECLFR((*)), DECLFW((*))); -void VRC4_init (CartInfo *, void (*)(), int, int, uint8, int (*)(uint8), int (*)(uint8), DECLFR((*)), DECLFW((*)), DECLFW((*))); +void VRC2_init (CartInfo *, void (*)(), int, int, int (*)(uint8_t), int (*)(uint8_t), DECLFR((*)), DECLFW((*))); +void VRC4_init (CartInfo *, void (*)(), int, int, uint8_t, int (*)(uint8_t), int (*)(uint8_t), DECLFR((*)), DECLFW((*)), DECLFW((*))); #endif diff --git a/src/boards/asic_vrc3.c b/src/boards/asic_vrc3.c index 9f1fa0b..1b76132 100644 --- a/src/boards/asic_vrc3.c +++ b/src/boards/asic_vrc3.c @@ -22,10 +22,10 @@ #include "asic_vrc3.h" static void (*VRC3_cbSync)(); -static uint8 VRC3_prg; -static uint8 VRC3_irq; -static uint16 VRC3_count; -static uint16 VRC3_reload; +static uint8_t VRC3_prg; +static uint8_t VRC3_irq; +static uint16_t VRC3_count; +static uint16_t VRC3_reload; static SFORMAT VRC3_state[] = { {&VRC3_prg, 1, "VC3P" }, @@ -98,7 +98,7 @@ static void VRC3_configure (void (*sync)()) { VRC3_cbSync = sync; } -void VRC3_activate (uint8 clear, void (*sync)()) { +void VRC3_activate (uint8_t clear, void (*sync)()) { VRC3_configure(sync); VRC3_setHandlers(); if (clear) diff --git a/src/boards/asic_vrc3.h b/src/boards/asic_vrc3.h index 2c73fd5..ed646a7 100644 --- a/src/boards/asic_vrc3.h +++ b/src/boards/asic_vrc3.h @@ -26,7 +26,7 @@ void VRC3_syncPRG (int, int); void VRC3_syncCHR (int, int); DECLFW (VRC3_write); void VRC3_clear (); -void VRC3_activate (uint8, void (*)()); +void VRC3_activate (uint8_t, void (*)()); void VRC3_addExState (); void VRC3_restore (int); void VRC3_power (); diff --git a/src/boards/asic_vrc6.c b/src/boards/asic_vrc6.c index 3748322..0e79747 100644 --- a/src/boards/asic_vrc6.c +++ b/src/boards/asic_vrc6.c @@ -23,16 +23,16 @@ static void (*VRC6_cbSync)(); static int VRC6_A0, VRC6_A1; -static int (*VRC6_cbGetPRGBank)(uint8); -static int (*VRC6_cbGetCHRBank)(uint8); +static int (*VRC6_cbGetPRGBank)(uint8_t); +static int (*VRC6_cbGetCHRBank)(uint8_t); static DECLFR ((*VRC6_cbReadWRAM)); static DECLFW ((*VRC6_cbWriteWRAM)); -static uint8 VRC6_prg[2]; -static uint8 VRC6_chr[8]; -static uint8 VRC6_misc; -static uint8 VRC6_latch; -static uint8 VRC6_mode; -static uint8 VRC6_count; +static uint8_t VRC6_prg[2]; +static uint8_t VRC6_chr[8]; +static uint8_t VRC6_misc; +static uint8_t VRC6_latch; +static uint8_t VRC6_mode; +static uint8_t VRC6_count; static signed short int VRC6_cycles; static SFORMAT VRC6_stateRegs[] = { @@ -72,14 +72,14 @@ void VRC6_syncMirror () { /* Only emulates features used by known games, meaning setmirror(VRC6_misc &8? (VRC6_misc &4? MI_1: MI_0): VRC6_misc &4? MI_H: MI_V); } -int VRC6_getPRGBank (uint8 bank) { +int VRC6_getPRGBank (uint8_t bank) { if (bank &2) return bank &1? 0xFF: VRC6_prg[1]; else return VRC6_prg[0] <<1 | bank &1; } -int VRC6_getCHRBank (uint8 bank) { /* Only emulates features used by known games, meaning mode 0 with CHR A10 substitution */ +int VRC6_getCHRBank (uint8_t bank) { /* Only emulates features used by known games, meaning mode 0 with CHR A10 substitution */ return VRC6_chr[bank &7]; } @@ -166,7 +166,7 @@ static void VRC6_setHandlers () { MapIRQHook =VRC6_cpuCycle; } -static void VRC6_configure (void (*sync)(), int A0, int A1, int (*prg)(uint8), int (*chr)(uint8), DECLFR((*read)), DECLFW((*write))) { +static void VRC6_configure (void (*sync)(), int A0, int A1, int (*prg)(uint8_t), int (*chr)(uint8_t), DECLFR((*read)), DECLFW((*write))) { VRC6_A0 = A0; VRC6_A1 = A1; VRC6_cbSync = sync; @@ -176,7 +176,7 @@ static void VRC6_configure (void (*sync)(), int A0, int A1, int (*prg)(uint8), i VRC6_cbWriteWRAM = write; } -void VRC6_activate (uint8 clear, void (*sync)(), int A0, int A1, int (*prg)(uint8), int (*chr)(uint8), DECLFR((*read)), DECLFW((*write))) { +void VRC6_activate (uint8_t clear, void (*sync)(), int A0, int A1, int (*prg)(uint8_t), int (*chr)(uint8_t), DECLFR((*read)), DECLFW((*write))) { VRC6_configure(sync, A0, A1, prg, chr, read, write); VRC6_setHandlers(); if (clear) @@ -198,7 +198,7 @@ void VRC6_power () { VRC6_clear(); } -void VRC6_init (CartInfo *info, void (*sync)(), int A0, int A1, int (*prg)(uint8), int (*chr)(uint8), DECLFR((*read)), DECLFW((*write))) { +void VRC6_init (CartInfo *info, void (*sync)(), int A0, int A1, int (*prg)(uint8_t), int (*chr)(uint8_t), DECLFR((*read)), DECLFW((*write))) { VRC6_addExState(); VRC6_configure(sync, A0, A1, prg, chr, read, write); info->Power = VRC6_power; diff --git a/src/boards/asic_vrc6.h b/src/boards/asic_vrc6.h index 4d3fe8b..e9c4a14 100644 --- a/src/boards/asic_vrc6.h +++ b/src/boards/asic_vrc6.h @@ -25,17 +25,17 @@ void VRC6_syncWRAM (int); void VRC6_syncPRG (int, int); void VRC6_syncCHR (int, int); void VRC6_syncMirror (); -int VRC6_getPRGBank (uint8); -int VRC6_getCHRBank (uint8); +int VRC6_getPRGBank (uint8_t); +int VRC6_getCHRBank (uint8_t); DECLFR(VRC6_readWRAM); DECLFW(MMC3_writeWRAM); DECLFW(VRC6_writeReg); void FP_FASTAPASS(1) VRC6_cpuCycle (int); void VRC6_clear (); -void VRC6_activate (uint8, void (*)(), int, int, int (*)(uint8), int (*)(uint8), DECLFR((*)), DECLFW((*))); +void VRC6_activate (uint8_t, void (*)(), int, int, int (*)(uint8_t), int (*)(uint8_t), DECLFR((*)), DECLFW((*))); void VRC6_addExState (); void VRC6_restore (int); void VRC6_power (); -void VRC6_init (CartInfo *, void (*)(), int, int, int (*)(uint8), int (*)(uint8), DECLFR((*)), DECLFW((*))); +void VRC6_init (CartInfo *, void (*)(), int, int, int (*)(uint8_t), int (*)(uint8_t), DECLFR((*)), DECLFW((*))); #endif \ No newline at end of file diff --git a/src/boards/asic_vrc7.c b/src/boards/asic_vrc7.c index 54ee04b..804dcc9 100644 --- a/src/boards/asic_vrc7.c +++ b/src/boards/asic_vrc7.c @@ -23,12 +23,12 @@ static void (*VRC7_cbSync)(); static int VRC7_A0; -static uint8 VRC7_prg[3]; -static uint8 VRC7_chr[8]; -static uint8 VRC7_misc; -static uint8 VRC7_latch; -static uint8 VRC7_mode; -static uint8 VRC7_count; +static uint8_t VRC7_prg[3]; +static uint8_t VRC7_chr[8]; +static uint8_t VRC7_misc; +static uint8_t VRC7_latch; +static uint8_t VRC7_mode; +static uint8_t VRC7_count; static signed short int VRC7_cycles; static SFORMAT VRC7_stateRegs[] = { @@ -148,7 +148,7 @@ static void VRC7_configure (void (*sync)(), int A0) { VRC7_cbSync = sync; } -void VRC7_activate (uint8 clear, void (*sync)(), int A0) { +void VRC7_activate (uint8_t clear, void (*sync)(), int A0) { VRC7_configure(sync, A0); VRC7_setHandlers(); if (clear) diff --git a/src/boards/asic_vrc7.h b/src/boards/asic_vrc7.h index 3431774..975c0bb 100644 --- a/src/boards/asic_vrc7.h +++ b/src/boards/asic_vrc7.h @@ -30,7 +30,7 @@ DECLFW(MMC3_writeWRAM); DECLFW(VRC7_writeReg); void FP_FASTAPASS(1) VRC7_cpuCycle (int); void VRC7_clear (); -void VRC7_activate (uint8, void (*)(), int); +void VRC7_activate (uint8_t, void (*)(), int); void VRC7_addExState (); void VRC7_restore (int); void VRC7_power (); diff --git a/src/boards/bandai.c b/src/boards/bandai.c index 99d04a0..348a879 100644 --- a/src/boards/bandai.c +++ b/src/boards/bandai.c @@ -24,12 +24,12 @@ #include "mapinc.h" -static uint8 reg[16], is153, x24c02; -static uint8 IRQa; -static int16 IRQCount, IRQLatch; +static uint8_t reg[16], is153, x24c02; +static uint8_t IRQa; +static int16_t IRQCount, IRQLatch; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; /* TODO: Clean this up. State variables are expanded for * big-endian compatibility when saving and loading states */ @@ -65,15 +65,15 @@ static SFORMAT StateRegs[] = #define X24C0X_READ 3 #define X24C0X_WRITE 4 -static uint8 x24c0x_data[512]; +static uint8_t x24c0x_data[512]; -static uint8 x24c01_state; -static uint8 x24c01_addr, x24c01_word, x24c01_latch, x24c01_bitcount; -static uint8 x24c01_sda, x24c01_scl, x24c01_out; +static uint8_t x24c01_state; +static uint8_t x24c01_addr, x24c01_word, x24c01_latch, x24c01_bitcount; +static uint8_t x24c01_sda, x24c01_scl, x24c01_out; -static uint8 x24c02_state; -static uint8 x24c02_addr, x24c02_word, x24c02_latch, x24c02_bitcount; -static uint8 x24c02_sda, x24c02_scl, x24c02_out; +static uint8_t x24c02_state; +static uint8_t x24c02_addr, x24c02_word, x24c02_latch, x24c02_bitcount; +static uint8_t x24c02_sda, x24c02_scl, x24c02_out; static SFORMAT x24c01StateRegs[] = { @@ -111,9 +111,9 @@ static void x24c02_init(void) { x24c02_state = X24C0X_STANDBY; } -static void x24c01_write(uint8 data) { - uint8 scl = (data >> 5) & 1; - uint8 sda = (data >> 6) & 1; +static void x24c01_write(uint8_t data) { + uint8_t scl = (data >> 5) & 1; + uint8_t sda = (data >> 6) & 1; if(x24c01_scl && scl) { if(x24c01_sda && !sda) { /* START */ @@ -176,9 +176,9 @@ static void x24c01_write(uint8 data) { x24c01_scl = scl; } -static void x24c02_write(uint8 data) { - uint8 scl = (data >> 5) & 1; - uint8 sda = (data >> 6) & 1; +static void x24c02_write(uint8_t data) { + uint8_t scl = (data >> 5) & 1; + uint8_t sda = (data >> 6) & 1; if (x24c02_scl && scl) { if (x24c02_sda && !sda) { /* START */ @@ -395,7 +395,7 @@ void Mapper153_Init(CartInfo *info) { MapIRQHook = BandaiIRQHook; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); @@ -410,14 +410,14 @@ void Mapper153_Init(CartInfo *info) { /* Datach Barcode Battler */ -static uint8 BarcodeData[256]; +static uint8_t BarcodeData[256]; static int BarcodeReadPos; static int BarcodeCycleCount; -static uint32 BarcodeOut; +static uint32_t BarcodeOut; /* #define INTERL2OF5 */ -int FCEUI_DatachSet(uint8 *rcode) { +int FCEUI_DatachSet(uint8_t *rcode) { int prefix_parity_type[10][6] = { { 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, 0, 1, 1 }, { 0, 0, 1, 1, 0, 1 }, { 0, 0, 1, 1, 1, 0 }, { 0, 1, 0, 0, 1, 1 }, { 0, 1, 1, 0, 0, 1 }, { 0, 1, 1, 1, 0, 0 }, { 0, 1, 0, 1, 0, 1 }, @@ -438,9 +438,9 @@ int FCEUI_DatachSet(uint8 *rcode) { { 1, 0, 1, 1, 1, 0, 0 }, { 1, 0, 0, 1, 1, 1, 0 }, { 1, 0, 1, 0, 0, 0, 0 }, { 1, 0, 0, 0, 1, 0, 0 }, { 1, 0, 0, 1, 0, 0, 0 }, { 1, 1, 1, 0, 1, 0, 0 } }; - uint8 code[13 + 1]; - uint32 tmp_p = 0; - uint32 csum = 0; + uint8_t code[13 + 1]; + uint32_t tmp_p = 0; + uint32_t csum = 0; int i, j; int len; diff --git a/src/boards/bb.c b/src/boards/bb.c index 1541f28..1d16f88 100644 --- a/src/boards/bb.c +++ b/src/boards/bb.c @@ -25,7 +25,7 @@ #include "mapinc.h" -static uint8 reg, chr; +static uint8_t reg, chr; static SFORMAT StateRegs[] = { diff --git a/src/boards/bj56.c b/src/boards/bj56.c index 852b341..7499518 100644 --- a/src/boards/bj56.c +++ b/src/boards/bj56.c @@ -26,10 +26,10 @@ #include "mapinc.h" -static uint8 preg[4], creg[8]; -static uint32 IRQCount; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t preg[4], creg[8]; +static uint32_t IRQCount; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -40,7 +40,7 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { - uint8 i; + uint8_t i; setprg8r(0x10, 0x6000, 0); setprg8(0x8000, preg[0]); setprg8(0xA000, preg[1]); @@ -108,7 +108,7 @@ void UNLBJ56_Init(CartInfo *info) { MapIRQHook = UNLBJ56IRQHook; GameStateRestore = StateRestore; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); if (info->battery) { info->SaveGame[0] = WRAM; diff --git a/src/boards/bmc42in1r.c b/src/boards/bmc42in1r.c index 8675bbb..da0fb6e 100644 --- a/src/boards/bmc42in1r.c +++ b/src/boards/bmc42in1r.c @@ -27,9 +27,9 @@ #include "mapinc.h" -static uint8 reorder_banks = 0; -static uint8 latche[2], reset; -static uint8 banks[4] = { 0, 0, 1, 2 }; +static uint8_t reorder_banks = 0; +static uint8_t latche[2], reset; +static uint8_t banks[4] = { 0, 0, 1, 2 }; static SFORMAT StateRegs[] = { { &reset, 1, "RST" }, @@ -38,8 +38,8 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { - uint8 bank = 0; - uint8 base = ((latche[0] & 0x80) >> 7) | ((latche[1] & 1) << 1); + uint8_t bank = 0; + uint8_t base = ((latche[0] & 0x80) >> 7) | ((latche[1] & 1) << 1); if (reorder_banks) /* for 1536 KB prg roms */ base = banks[base]; diff --git a/src/boards/bmc60311c.c b/src/boards/bmc60311c.c index 23b99c6..e79e51f 100644 --- a/src/boards/bmc60311c.c +++ b/src/boards/bmc60311c.c @@ -24,7 +24,7 @@ #include "mapinc.h" -static uint8 latch, reg[2], solderPad; +static uint8_t latch, reg[2], solderPad; static SFORMAT StateRegs[] = { diff --git a/src/boards/bmc64in1nr.c b/src/boards/bmc64in1nr.c index 86d2abe..b5ba287 100644 --- a/src/boards/bmc64in1nr.c +++ b/src/boards/bmc64in1nr.c @@ -22,7 +22,7 @@ #include "mapinc.h" -static uint8 regs[4]; +static uint8_t regs[4]; static SFORMAT StateRegs[] = { diff --git a/src/boards/bmc80013b.c b/src/boards/bmc80013b.c index 6bd8460..6bfa825 100644 --- a/src/boards/bmc80013b.c +++ b/src/boards/bmc80013b.c @@ -25,7 +25,7 @@ #include "mapinc.h" -static uint8 regs[2], mode; +static uint8_t regs[2], mode; static SFORMAT StateRegs[] = { @@ -45,7 +45,7 @@ static void Sync(void) { } static DECLFW(BMC80013BWrite) { - uint8 reg = (A >> 13) & 0x03; + uint8_t reg = (A >> 13) & 0x03; if (!reg) regs[0] = V & 0x1F; else { diff --git a/src/boards/bmc830425C4391t.c b/src/boards/bmc830425C4391t.c index 475c097..7cc9042 100644 --- a/src/boards/bmc830425C4391t.c +++ b/src/boards/bmc830425C4391t.c @@ -26,9 +26,9 @@ #include "mapinc.h" -static uint8 bank_size; -static uint8 inner_bank; -static uint8 outer_bank; +static uint8_t bank_size; +static uint8_t inner_bank; +static uint8_t outer_bank; static SFORMAT StateRegs[] = { diff --git a/src/boards/bmcctc09.c b/src/boards/bmcctc09.c index 2ad8a22..8e422f1 100644 --- a/src/boards/bmcctc09.c +++ b/src/boards/bmcctc09.c @@ -27,7 +27,7 @@ #define PRG 0 #define CHR 1 -static uint8 regs[2]; +static uint8_t regs[2]; static SFORMAT StateRegs[] = { diff --git a/src/boards/bmcgamecard.c b/src/boards/bmcgamecard.c index aab0e4c..c5481cc 100644 --- a/src/boards/bmcgamecard.c +++ b/src/boards/bmcgamecard.c @@ -29,7 +29,7 @@ #include "mapinc.h" -static uint8 latche, m350; +static uint8_t latche, m350; static SFORMAT StateRegs[] = { @@ -39,9 +39,9 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { - uint8 mirroring = m350 ? ((latche >> 7) & 1) : ((latche >> 5) & 1); - uint8 mode = m350 ? ((latche >> 5) & 0x03) : ((latche >> 6) & 0x03); - uint8 base = m350 ? ((latche & 0x40) ? (latche & 0x20) : 0) : 0; + uint8_t mirroring = m350 ? ((latche >> 7) & 1) : ((latche >> 5) & 1); + uint8_t mode = m350 ? ((latche >> 5) & 0x03) : ((latche >> 6) & 0x03); + uint8_t base = m350 ? ((latche & 0x40) ? (latche & 0x20) : 0) : 0; setchr8(0); setprg8(0x6000, 1); diff --git a/src/boards/bmck3006.c b/src/boards/bmck3006.c index ba55a0a..aea6377 100644 --- a/src/boards/bmck3006.c +++ b/src/boards/bmck3006.c @@ -26,17 +26,17 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 submapper; /* 0: K-3006, 1: unmarked, 2: TL 8058, 3: K-3091/GN-16 */ +static uint8_t submapper; /* 0: K-3006, 1: unmarked, 2: TL 8058, 3: K-3091/GN-16 */ static DECLFR (readPad) { return CartBR(A &~3 | EXPREGS[1] &3); } -static void BMCK3006CW(uint32 A, uint8 V) { +static void BMCK3006CW(uint32_t A, uint8_t V) { setchr1(A, (V & 0x7F) | (EXPREGS[0] & 0x18) << 4); } -static void BMCK3006PW(uint32 A, uint8 V) { +static void BMCK3006PW(uint32_t A, uint8_t V) { if (EXPREGS[0] & 0x20) { /* MMC3 mode */ setprg8(A, (V & 0x0F) | (EXPREGS[0] & 0x18) << 1); } else { diff --git a/src/boards/bmck3033.c b/src/boards/bmck3033.c index 686d278..6d997d8 100644 --- a/src/boards/bmck3033.c +++ b/src/boards/bmck3033.c @@ -27,7 +27,7 @@ #include "mapinc.h" #include "mmc3.h" -static void BMCK3033CW(uint32 A, uint8 V) { +static void BMCK3033CW(uint32_t A, uint8_t V) { if (EXPREGS[2]) { if (EXPREGS[3]) { /* FCEU_printf("MMC3-256: A:%04x V:%02x R1:%02x\n", A, V, EXPREGS[1]); */ @@ -42,7 +42,7 @@ static void BMCK3033CW(uint32 A, uint8 V) { } } -static void BMCK3033PW(uint32 A, uint8 V) { +static void BMCK3033PW(uint32_t A, uint8_t V) { if (EXPREGS[2]) { if (EXPREGS[3] ) { /* FCEU_printf("MMC3-256 A:%04x V:%02x chip:%02x\n", A, V, EXPREGS[1] & ~0x01); */ @@ -52,7 +52,7 @@ static void BMCK3033PW(uint32 A, uint8 V) { setprg8(A, (EXPREGS[1] << 4) | (V & 0x0F)); } } else { - uint32 base = (EXPREGS[1] << 3); + uint32_t base = (EXPREGS[1] << 3); if (EXPREGS[0] & 0x03) { /* FCEU_printf("NROM-256 base:%02x chip:%02x\n", EXPREGS[0] >> 1, EXPREGS[1]); */ setprg32(0x8000, base | EXPREGS[0] >> 1); diff --git a/src/boards/bmcl6in1.c b/src/boards/bmcl6in1.c index f788537..2e20142 100644 --- a/src/boards/bmcl6in1.c +++ b/src/boards/bmcl6in1.c @@ -27,18 +27,18 @@ #include "mapinc.h" #include "mmc3.h" -static void BMCL6IN1CW(uint32 A, uint8 V) { +static void BMCL6IN1CW(uint32_t A, uint8_t V) { setchr8(V); } -static void BMCL6IN1PW(uint32 A, uint8 V) { +static void BMCL6IN1PW(uint32_t A, uint8_t V) { if (EXPREGS[0] & 0x0C) setprg8(A, (V & 0x0F) | (EXPREGS[0] & 0xC0) >> 2); else setprg32(0x8000, ((EXPREGS[0] & 0xC0) >> 4) | (EXPREGS[0] & 0x03)); } -static void BMCL6IN1MW(uint8 V) { +static void BMCL6IN1MW(uint8_t V) { if (EXPREGS[0] & 0x20) setmirror(MI_0 + ((EXPREGS[0] & 0x10) >> 1)); else { diff --git a/src/boards/bonza.c b/src/boards/bonza.c index b4b3754..a869273 100644 --- a/src/boards/bonza.c +++ b/src/boards/bonza.c @@ -22,8 +22,8 @@ #define CARD_EXTERNAL_INSERED 0x80 -static uint8 prg_reg; -static uint8 chr_reg; +static uint8_t prg_reg; +static uint8_t chr_reg; static SFORMAT StateRegs[] = { { &prg_reg, 1, "PREG" }, @@ -85,7 +85,7 @@ byte_8CC6: .BYTE 0,$78, 0, 0,$12 #endif #if 0 /* Silenced since unused */ -static uint8 sim0reset[0x1F] = { +static uint8_t sim0reset[0x1F] = { 0x3B, 0xE9, 0x00, 0xFF, 0xC1, 0x10, 0x31, 0xFE, 0x55, 0xC8, 0x10, 0x20, 0x55, 0x47, 0x4F, 0x53, 0x56, 0x53, 0x43, 0xAD, 0x10, 0x10, 0x10, 0x10, diff --git a/src/boards/bs-5.c b/src/boards/bs-5.c index f00f4f9..ff871bb 100644 --- a/src/boards/bs-5.c +++ b/src/boards/bs-5.c @@ -20,9 +20,9 @@ #include "mapinc.h" -static uint8 reg_prg[4]; -static uint8 reg_chr[4]; -static uint8 dip_switch; +static uint8_t reg_prg[4]; +static uint8_t reg_chr[4]; +static uint8_t dip_switch; static SFORMAT StateRegs[] = { diff --git a/src/boards/cartram.c b/src/boards/cartram.c index 02d04de..fb8e194 100644 --- a/src/boards/cartram.c +++ b/src/boards/cartram.c @@ -21,10 +21,10 @@ #include "mapinc.h" #include "cartram.h" -static uint8 *CHRRAMData = NULL; -static uint8 *WRAMData = NULL; -uint32 CHRRAMSize = 0; -uint32 WRAMSize = 0; +static uint8_t *CHRRAMData = NULL; +static uint8_t *WRAMData = NULL; +uint32_t CHRRAMSize = 0; +uint32_t WRAMSize = 0; void CartRAM_close (void) { /* Need to combine this in one function to avoid the problem of having to properly cascade two separate Close() functions for WRAM and CHR-RAM each */ if (WRAMData) { @@ -37,10 +37,10 @@ void CartRAM_close (void) { /* Need to combine this in one function to avoid the } } -void CartRAM_init (CartInfo *info, uint8 defaultWRAMSizeKiB, uint8 defaultCHRRAMSizeKiB) { +void CartRAM_init (CartInfo *info, uint8_t defaultWRAMSizeKiB, uint8_t defaultCHRRAMSizeKiB) { WRAMSize = info->iNES2? (info->PRGRamSize +info->PRGRamSaveSize): (defaultWRAMSizeKiB *1024); if (WRAMSize) { - WRAMData = (uint8*)FCEU_gmalloc(WRAMSize); + WRAMData = (uint8_t*)FCEU_gmalloc(WRAMSize); SetupCartPRGMapping(0x10, WRAMData, WRAMSize, 1); AddExState(WRAMData, WRAMSize, 0, "WRAM"); if (info->battery && (info->PRGRamSaveSize || !info->iNES2)) { @@ -51,7 +51,7 @@ void CartRAM_init (CartInfo *info, uint8 defaultWRAMSizeKiB, uint8 defaultCHRRAM CHRRAMSize = info->iNES2? (info->CHRRamSize +info->CHRRamSaveSize): (defaultCHRRAMSizeKiB *1024); if (ROM_size == 0) CHRRAMSize = 0; /* If there is no CHR-ROM, then any CHR-RAM will not be "extra" and therefore will be handled by ines.c, not here. */ if (CHRRAMSize) { - CHRRAMData = (uint8*)FCEU_gmalloc(CHRRAMSize); + CHRRAMData = (uint8_t*)FCEU_gmalloc(CHRRAMSize); SetupCartCHRMapping(0x10, CHRRAMData, CHRRAMSize, 1); AddExState(CHRRAMData, CHRRAMSize, 0, "CRAM"); if (info->battery && (info->CHRRamSaveSize || !info->iNES2)) { @@ -62,10 +62,10 @@ void CartRAM_init (CartInfo *info, uint8 defaultWRAMSizeKiB, uint8 defaultCHRRAM if (WRAMSize || CHRRAMSize) info->Close = CartRAM_close; } -void CHRRAM_init (CartInfo *info, uint8 defaultCHRRAMSizeKiB) { +void CHRRAM_init (CartInfo *info, uint8_t defaultCHRRAMSizeKiB) { CartRAM_init(info, 0, defaultCHRRAMSizeKiB); } -void WRAM_init (CartInfo *info, uint8 defaultWRAMSizeKiB) { +void WRAM_init (CartInfo *info, uint8_t defaultWRAMSizeKiB) { CartRAM_init(info, defaultWRAMSizeKiB, 0); } diff --git a/src/boards/cartram.h b/src/boards/cartram.h index de46253..bc1ef03 100644 --- a/src/boards/cartram.h +++ b/src/boards/cartram.h @@ -21,11 +21,11 @@ #ifndef _CARTRAM_H #define _CARTRAM_H -extern uint32 CHRRAMSize; -extern uint32 WRAMSize; -void CartRAM_init (CartInfo *, uint8, uint8); -void CHRRAM_init (CartInfo *, uint8); -void WRAM_init (CartInfo *, uint8); +extern uint32_t CHRRAMSize; +extern uint32_t WRAMSize; +void CartRAM_init (CartInfo *, uint8_t, uint8_t); +void CHRRAM_init (CartInfo *, uint8_t); +void WRAM_init (CartInfo *, uint8_t); void CartRAM_close (); #endif diff --git a/src/boards/cheapocabra.c b/src/boards/cheapocabra.c index 4535986..81cf7d3 100644 --- a/src/boards/cheapocabra.c +++ b/src/boards/cheapocabra.c @@ -32,16 +32,16 @@ #include "mapinc.h" -static uint8 reg; -static uint8 *CHRRAM = NULL; -static uint32 CHRRAMSIZE; +static uint8_t reg; +static uint8_t *CHRRAM = NULL; +static uint32_t CHRRAMSIZE; -static uint8 flash = 0; -static uint8 flash_mode; -static uint8 flash_sequence; -static uint8 flash_id; -static uint8 *FLASHROM = NULL; -static uint32 FLASHROMSIZE; +static uint8_t flash = 0; +static uint8_t flash_mode; +static uint8_t flash_sequence; +static uint8_t flash_id; +static uint8_t *FLASHROM = NULL; +static uint32_t FLASHROMSIZE; static SFORMAT StateRegs[] = { { ®, 1, "REG" }, @@ -58,7 +58,7 @@ static SFORMAT FlashRegs[] = { static void Sync(void) { /* bit 7 controls green LED */ /* bit 6 controls red LED */ - uint32 prg_chip = flash ? 0x10 : 0; + uint32_t prg_chip = flash ? 0x10 : 0; int nt = (reg & 0x20) ? 8192 : 0; /* bit 5 controls 8k nametable page */ int chr = (reg & 0x10) ? 1 : 0; /* bit 4 selects 8k CHR page */ int prg = (reg & 0x0F); /* bits 0-3 select 32k PRG page */ @@ -85,7 +85,7 @@ static DECLFR(M111FlashID) { * http://forums.nesdev.com/viewtopic.php?p=178728#p178728 */ - uint32 aid = A & 0x1FF; + uint32_t aid = A & 0x1FF; switch (aid) { case 0: return 0xBF; @@ -118,8 +118,8 @@ enum { }; static DECLFW(M111Flash) { - uint32 flash_addr = 0; - uint32 command_addr = 0; + uint32_t flash_addr = 0; + uint32_t command_addr = 0; if (A < 0x8000 || A > 0xFFFF) return; @@ -191,7 +191,7 @@ static DECLFW(M111Flash) { memset(FLASHROM, 0xFF, FLASHROMSIZE); } else if (V == 0x30) /* erase 4k sector */ { - uint32 sector = flash_addr & 0x7F000; + uint32_t sector = flash_addr & 0x7F000; memset(FLASHROM + sector, 0xFF, 1024 * 4); } flash_mode = FLASH_MODE_READY; @@ -235,7 +235,7 @@ void Mapper111_Init(CartInfo* info) { info->Close = M111Close; CHRRAMSIZE = 1024 * 32; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM = (uint8_t*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); GameStateRestore = StateRestore; @@ -244,12 +244,12 @@ void Mapper111_Init(CartInfo* info) { flash = (info->battery != 0); if (flash) { - uint32 PRGSIZE = 0; - uint32 w = 0; - uint32 r = 0; + uint32_t PRGSIZE = 0; + uint32_t w = 0; + uint32_t r = 0; FLASHROMSIZE = 1024 * 512; - FLASHROM = (uint8*)FCEU_gmalloc(FLASHROMSIZE); + FLASHROM = (uint8_t*)FCEU_gmalloc(FLASHROMSIZE); info->SaveGame[0] = FLASHROM; info->SaveGameLen[0] = FLASHROMSIZE; AddExState(FLASHROM, FLASHROMSIZE, 0, "FROM"); diff --git a/src/boards/coolgirl.c b/src/boards/coolgirl.c index 2d6ba3f..59a7009 100644 --- a/src/boards/coolgirl.c +++ b/src/boards/coolgirl.c @@ -99,136 +99,136 @@ #include #include "mapinc.h" -const uint32 SAVE_FLASH_SIZE = 1024 * 1024 * 8; -const uint32 FLASH_SECTOR_SIZE = 128 * 1024; +const uint32_t SAVE_FLASH_SIZE = 1024 * 1024 * 8; +const uint32_t FLASH_SECTOR_SIZE = 128 * 1024; const int ROM_CHIP = 0x00; const int WRAM_CHIP = 0x10; const int FLASH_CHIP = 0x11; const int CFI_CHIP = 0x13; static int CHR_SIZE = 0; -static uint32 WRAM_SIZE = 0; -static uint8 *WRAM = NULL; -static uint8 *SAVE_FLASH = NULL; -static uint8* CFI; +static uint32_t WRAM_SIZE = 0; +static uint8_t *WRAM = NULL; +static uint8_t *SAVE_FLASH = NULL; +static uint8_t* CFI; -static uint8 sram_enabled = 0; -static uint8 sram_page = 0; /* [1:0] */ -static uint8 can_write_chr = 0; -static uint8 map_rom_on_6000 = 0; -static uint8 flags = 0; /* [2:0] */ -static uint8 mapper = 0; /* [5:0] */ -static uint8 can_write_flash = 0; -static uint8 mirroring = 0; /* [1:0] */ -static uint8 four_screen = 0; -static uint8 lockout = 0; +static uint8_t sram_enabled = 0; +static uint8_t sram_page = 0; /* [1:0] */ +static uint8_t can_write_chr = 0; +static uint8_t map_rom_on_6000 = 0; +static uint8_t flags = 0; /* [2:0] */ +static uint8_t mapper = 0; /* [5:0] */ +static uint8_t can_write_flash = 0; +static uint8_t mirroring = 0; /* [1:0] */ +static uint8_t four_screen = 0; +static uint8_t lockout = 0; -static uint32 prg_base = 0; /* [26:14] */ -static uint32 prg_mask = 0xF8 << 14; /* 11111000, 128KB [20:14] */ -static uint8 prg_mode = 0; /* [2:0] */ -static uint8 prg_bank_6000 = 0; /* [7:0] */ -static uint8 prg_bank_a = 0; /* [7:0] */ -static uint8 prg_bank_b = 1; /* [7:0] */ -static uint8 prg_bank_c = ~1; /* [7:0] */ -static uint8 prg_bank_d = ~0; /* [7:0] */ +static uint32_t prg_base = 0; /* [26:14] */ +static uint32_t prg_mask = 0xF8 << 14; /* 11111000, 128KB [20:14] */ +static uint8_t prg_mode = 0; /* [2:0] */ +static uint8_t prg_bank_6000 = 0; /* [7:0] */ +static uint8_t prg_bank_a = 0; /* [7:0] */ +static uint8_t prg_bank_b = 1; /* [7:0] */ +static uint8_t prg_bank_c = ~1; /* [7:0] */ +static uint8_t prg_bank_d = ~0; /* [7:0] */ -static uint32 chr_mask = 0; /* [18:13] */ -static uint8 chr_mode = 0; /* [2:0] */ -static uint16 chr_bank_a = 0; /* [8:0] */ -static uint16 chr_bank_b = 1; /* [8:0] */ -static uint16 chr_bank_c = 2; /* [8:0] */ -static uint16 chr_bank_d = 3; /* [8:0] */ -static uint16 chr_bank_e = 4; /* [8:0] */ -static uint16 chr_bank_f = 5; /* [8:0] */ -static uint16 chr_bank_g = 6; /* [8:0] */ -static uint16 chr_bank_h = 7; /* [8:0] */ +static uint32_t chr_mask = 0; /* [18:13] */ +static uint8_t chr_mode = 0; /* [2:0] */ +static uint16_t chr_bank_a = 0; /* [8:0] */ +static uint16_t chr_bank_b = 1; /* [8:0] */ +static uint16_t chr_bank_c = 2; /* [8:0] */ +static uint16_t chr_bank_d = 3; /* [8:0] */ +static uint16_t chr_bank_e = 4; /* [8:0] */ +static uint16_t chr_bank_f = 5; /* [8:0] */ +static uint16_t chr_bank_g = 6; /* [8:0] */ +static uint16_t chr_bank_h = 7; /* [8:0] */ -static uint8 TKSMIR[8]; +static uint8_t TKSMIR[8]; -static uint32 prg_bank_6000_mapped = 0; -static uint32 prg_bank_a_mapped = 0; -static uint32 prg_bank_b_mapped = 0; -static uint32 prg_bank_c_mapped = 0; -static uint32 prg_bank_d_mapped = 0; +static uint32_t prg_bank_6000_mapped = 0; +static uint32_t prg_bank_a_mapped = 0; +static uint32_t prg_bank_b_mapped = 0; +static uint32_t prg_bank_c_mapped = 0; +static uint32_t prg_bank_d_mapped = 0; /* for MMC2/MMC4 */ -static uint8 ppu_latch0 = 0; -static uint8 ppu_latch1 = 0; +static uint8_t ppu_latch0 = 0; +static uint8_t ppu_latch1 = 0; /* for MMC1 */ -static uint64 lreset = 0; -static uint8 mmc1_load_register = 0; /* [5:0] */ +static uint64_t lreset = 0; +static uint8_t mmc1_load_register = 0; /* [5:0] */ /* for MMC3 */ -static uint8 mmc3_internal = 0; /* [2:0] */ +static uint8_t mmc3_internal = 0; /* [2:0] */ /* for mapper #69 */ -static uint8 mapper69_internal = 0; /* [3:0] */ +static uint8_t mapper69_internal = 0; /* [3:0] */ /* for mapper #112 */ -static uint8 mapper112_internal = 0; /* [2:0] */ +static uint8_t mapper112_internal = 0; /* [2:0] */ /* for mapper #163 */ -static uint8 mapper_163_latch = 0; -static uint8 mapper163_r0 = 0; /* [7:0] */ -static uint8 mapper163_r1 = 0; /* [7:0] */ -static uint8 mapper163_r2 = 0; /* [7:0] */ -static uint8 mapper163_r3 = 0; /* [7:0] */ -static uint8 mapper163_r4 = 0; /* [7:0] */ -static uint8 mapper163_r5 = 0; /* [7:0] */ +static uint8_t mapper_163_latch = 0; +static uint8_t mapper163_r0 = 0; /* [7:0] */ +static uint8_t mapper163_r1 = 0; /* [7:0] */ +static uint8_t mapper163_r2 = 0; /* [7:0] */ +static uint8_t mapper163_r3 = 0; /* [7:0] */ +static uint8_t mapper163_r4 = 0; /* [7:0] */ +static uint8_t mapper163_r5 = 0; /* [7:0] */ /* For mapper #90 */ -static uint8 mul1 = 0; -static uint8 mul2 = 0; +static uint8_t mul1 = 0; +static uint8_t mul2 = 0; /* for MMC3 scanline-based interrupts, counts A12 rises after long A12 falls */ -static uint8 mmc3_irq_enabled = 0; /* register to enable/disable counter */ -static uint8 mmc3_irq_latch = 0; /* [7:0], stores counter reload latch value */ -static uint8 mmc3_irq_counter = 0; /* [7:0], counter itself (downcounting) */ -static uint8 mmc3_irq_reload = 0; /* flag to reload counter from latch */ +static uint8_t mmc3_irq_enabled = 0; /* register to enable/disable counter */ +static uint8_t mmc3_irq_latch = 0; /* [7:0], stores counter reload latch value */ +static uint8_t mmc3_irq_counter = 0; /* [7:0], counter itself (downcounting) */ +static uint8_t mmc3_irq_reload = 0; /* flag to reload counter from latch */ /* for MMC5 scanline-based interrupts, counts dummy PPU reads */ -static uint8 mmc5_irq_enabled = 0; /* register to enable/disable counter */ -static uint8 mmc5_irq_line = 0; /* [7:0], scanline on which IRQ will be triggered */ -static uint8 mmc5_irq_out = 0; /* stores 1 when IRQ is triggered */ +static uint8_t mmc5_irq_enabled = 0; /* register to enable/disable counter */ +static uint8_t mmc5_irq_line = 0; /* [7:0], scanline on which IRQ will be triggered */ +static uint8_t mmc5_irq_out = 0; /* stores 1 when IRQ is triggered */ /* for mapper #18 */ -static uint16 mapper18_irq_value = 0; /* [15:0], counter itself (downcounting) */ -static uint8 mapper18_irq_control = 0; /* [3:0], IRQ settings */ -static uint16 mapper18_irq_latch = 0; /* [15:0], stores counter reload latch value */ +static uint16_t mapper18_irq_value = 0; /* [15:0], counter itself (downcounting) */ +static uint8_t mapper18_irq_control = 0; /* [3:0], IRQ settings */ +static uint16_t mapper18_irq_latch = 0; /* [15:0], stores counter reload latch value */ /* for mapper #65 */ -static uint8 mapper65_irq_enabled = 0; /* register to enable/disable IRQ */ -static uint16 mapper65_irq_value = 0; /* [15:0], counter itself (downcounting) */ -static uint16 mapper65_irq_latch = 0; /* [15:0], stores counter reload latch value */ +static uint8_t mapper65_irq_enabled = 0; /* register to enable/disable IRQ */ +static uint16_t mapper65_irq_value = 0; /* [15:0], counter itself (downcounting) */ +static uint16_t mapper65_irq_latch = 0; /* [15:0], stores counter reload latch value */ /* reg mapper65_irq_out = 0; * for Sunsoft FME-7 */ -static uint8 mapper69_irq_enabled = 0; /* register to enable/disable IRQ */ -static uint8 mapper69_counter_enabled = 0; /* register to enable/disable counter */ -static uint16 mapper69_irq_value = 0; /* counter itself (downcounting) */ +static uint8_t mapper69_irq_enabled = 0; /* register to enable/disable IRQ */ +static uint8_t mapper69_counter_enabled = 0; /* register to enable/disable counter */ +static uint16_t mapper69_irq_value = 0; /* counter itself (downcounting) */ /* for VRC4 CPU-based interrupts */ -static uint8 vrc4_irq_value = 0; /* [7:0], counter itself (upcounting) */ -static uint8 vrc4_irq_control = 0; /* [2:0]� IRQ settings */ -static uint8 vrc4_irq_latch = 0; /* [7:0], stores counter reload latch value */ -static uint8 vrc4_irq_prescaler = 0; /* [6:0], prescaler counter for VRC4 */ -static uint8 vrc4_irq_prescaler_counter = 0; /* prescaler cicles counter for VRC4 */ +static uint8_t vrc4_irq_value = 0; /* [7:0], counter itself (upcounting) */ +static uint8_t vrc4_irq_control = 0; /* [2:0]� IRQ settings */ +static uint8_t vrc4_irq_latch = 0; /* [7:0], stores counter reload latch value */ +static uint8_t vrc4_irq_prescaler = 0; /* [6:0], prescaler counter for VRC4 */ +static uint8_t vrc4_irq_prescaler_counter = 0; /* prescaler cicles counter for VRC4 */ /* for VRC3 CPU-based interrupts */ -static uint16 vrc3_irq_value = 0; /* [15:0], counter itself (upcounting) */ -static uint8 vrc3_irq_control = 0; /* [3:0], IRQ settings */ -static uint16 vrc3_irq_latch = 0; /* [15:0], stores counter reload latch value */ +static uint16_t vrc3_irq_value = 0; /* [15:0], counter itself (upcounting) */ +static uint8_t vrc3_irq_control = 0; /* [3:0], IRQ settings */ +static uint16_t vrc3_irq_latch = 0; /* [15:0], stores counter reload latch value */ /* for mapper #42 (only Baby Mario) */ -static uint8 mapper42_irq_enabled = 0; /* register to enable/disable counter */ -static uint16 mapper42_irq_value = 0; /* [14:0], counter itself (upcounting) */ +static uint8_t mapper42_irq_enabled = 0; /* register to enable/disable counter */ +static uint16_t mapper42_irq_value = 0; /* [14:0], counter itself (upcounting) */ /* for mapper #83 */ -static uint8 mapper83_irq_enabled_latch = 0; -static uint8 mapper83_irq_enabled = 0; -static uint16 mapper83_irq_counter = 0; +static uint8_t mapper83_irq_enabled_latch = 0; +static uint8_t mapper83_irq_enabled = 0; +static uint16_t mapper83_irq_counter = 0; /* for mapper #90 */ -static uint8 mapper90_xor = 0; +static uint8_t mapper90_xor = 0; /* for mapper #67 */ -static uint8 mapper67_irq_enabled = 0; -static uint8 mapper67_irq_latch = 0; -static uint16 mapper67_irq_counter = 0; +static uint8_t mapper67_irq_enabled = 0; +static uint8_t mapper67_irq_latch = 0; +static uint16_t mapper67_irq_counter = 0; -static uint8 flash_state = 0; -static uint16 flash_buffer_a[10]; -static uint8 flash_buffer_v[10]; -static uint8 cfi_mode = 0; +static uint8_t flash_state = 0; +static uint16_t flash_buffer_a[10]; +static uint8_t flash_buffer_v[10]; +static uint8_t cfi_mode = 0; /* Micron 4-gbit memory CFI data */ -const uint8 cfi_data[] = +const uint8_t cfi_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x52, 0x59, 0x02, 0x00, 0x40, 0x00, 0x00, @@ -248,10 +248,10 @@ const uint8 cfi_data[] = #define SET_BITS(target, target_bits, source, source_bits) target = set_bits(target, target_bits, get_bits(source, source_bits)) -static INLINE uint8 string_to_bits(char* bitsstr, int* bits) +static INLINE uint8_t string_to_bits(char* bitsstr, int* bits) { int i; - uint8 bit1, bit2, count = 0; + uint8_t bit1, bit2, count = 0; for (i = 0; i < 32; i++) bits[i] = -1; while (*bitsstr) @@ -300,10 +300,10 @@ static INLINE uint8 string_to_bits(char* bitsstr, int* bits) return count; } -static INLINE uint32 get_bits(uint32 V, char* bitsstr) +static INLINE uint32_t get_bits(uint32_t V, char* bitsstr) { int i; - uint32 result = 0; + uint32_t result = 0; int bits[32]; string_to_bits(bitsstr, bits); for (i = 0; bits[i] >= 0; i++) @@ -314,11 +314,11 @@ static INLINE uint32 get_bits(uint32 V, char* bitsstr) return result; } -static INLINE uint32 set_bits(uint32 V, char* bitsstr, uint32 new_bits) +static INLINE uint32_t set_bits(uint32_t V, char* bitsstr, uint32_t new_bits) { int i; int bits[32]; - uint8 count = string_to_bits(bitsstr, bits); + uint8_t count = string_to_bits(bitsstr, bits); for (i = 0; i < count; i++) { if ((new_bits >> (count - i - 1)) & 1) @@ -330,7 +330,7 @@ static INLINE uint32 set_bits(uint32 V, char* bitsstr, uint32 new_bits) } static void COOLGIRL_Sync_PRG(void) { - uint8 REG_A_CHIP, REG_B_CHIP, REG_C_CHIP, REG_D_CHIP; + uint8_t REG_A_CHIP, REG_B_CHIP, REG_C_CHIP, REG_D_CHIP; prg_bank_6000_mapped = (prg_base >> 13) | (prg_bank_6000 & ((~(prg_mask >> 13) & 0xFE) | 1)); prg_bank_a_mapped = (prg_base >> 13) | (prg_bank_a & ((~(prg_mask >> 13) & 0xFE) | 1)); prg_bank_b_mapped = (prg_base >> 13) | (prg_bank_b & ((~(prg_mask >> 13) & 0xFE) | 1)); @@ -486,7 +486,7 @@ static void COOLGIRL_Sync(void) { static DECLFW(COOLGIRL_Flash_Write) { int sector; - uint32 i, flash_addr; + uint32_t i, flash_addr; if (flash_state < sizeof(flash_buffer_a) / sizeof(flash_buffer_a[0])) { flash_buffer_a[flash_state] = A & 0xFFF; @@ -550,7 +550,7 @@ static DECLFW(COOLGIRL_Flash_Write) { } static DECLFW(COOLGIRL_WRITE) { - uint8 vrc_2b_hi, vrc_2b_low; + uint8_t vrc_2b_hi, vrc_2b_low; if (sram_enabled && A >= 0x6000 && A < 0x8000 && !map_rom_on_6000) CartBW(A, V); /* SRAM is enabled and writable */ @@ -1880,7 +1880,7 @@ static DECLFW(COOLGIRL_WRITE) { static DECLFR(MAFRAM) { int ppuon; - uint8 r, p; + uint8_t r, p; if ((mapper == 0x00) && (A >= 0x5000) && (A < 0x6000)) return 0; @@ -1961,7 +1961,7 @@ static void COOLGIRL_ScanlineCounter(void) { } static void COOLGIRL_CpuCounter(int a) { - uint8 carry; + uint8_t carry; while (a--) { @@ -2118,7 +2118,7 @@ static void COOLGIRL_CpuCounter(int a) { } } -static void COOLGIRL_PPUHook(uint32 A) { +static void COOLGIRL_PPUHook(uint32_t A) { /* For TxROM */ if ((mapper == 0x14) && (flags & 1)) { @@ -2267,7 +2267,7 @@ void COOLGIRL_Init(CartInfo *info) { WRAM_SIZE = (info->PRGRamSize + info->PRGRamSaveSize) ? (info->PRGRamSize + info->PRGRamSaveSize) : (32 * 1024); if (WRAM_SIZE > 0) { - WRAM = (uint8*)FCEU_gmalloc(WRAM_SIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAM_SIZE); memset(WRAM, 0, WRAM_SIZE); SetupCartPRGMapping(WRAM_CHIP, WRAM, WRAM_SIZE, 1); AddExState(WRAM, 32 * 1024, 0, "SRAM"); @@ -2280,13 +2280,13 @@ void COOLGIRL_Init(CartInfo *info) { if (info->battery) { - SAVE_FLASH = (uint8*)FCEU_gmalloc(SAVE_FLASH_SIZE); + SAVE_FLASH = (uint8_t*)FCEU_gmalloc(SAVE_FLASH_SIZE); SetupCartPRGMapping(FLASH_CHIP, SAVE_FLASH, SAVE_FLASH_SIZE, 1); info->SaveGame[1] = SAVE_FLASH; info->SaveGameLen[1] = SAVE_FLASH_SIZE; } - CFI = (uint8*)FCEU_gmalloc(sizeof(cfi_data) * 2); + CFI = (uint8_t*)FCEU_gmalloc(sizeof(cfi_data) * 2); for (i = 0; i < sizeof(cfi_data); i++) CFI[i * 2] = CFI[i * 2 + 1] = cfi_data[i]; SetupCartPRGMapping(CFI_CHIP, CFI, sizeof(cfi_data) * 2, 0); diff --git a/src/boards/datalatch.c b/src/boards/datalatch.c index 127de4f..fd4c14c 100644 --- a/src/boards/datalatch.c +++ b/src/boards/datalatch.c @@ -21,12 +21,12 @@ #include "mapinc.h" #include "../fds_apu.h" -static uint8 latche, latcheinit, bus_conflict; -static uint16 addrreg0, addrreg1; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t latche, latcheinit, bus_conflict; +static uint16_t addrreg0, addrreg1; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static void (*WSync)(void); -static uint8 submapper; +static uint8_t submapper; static DECLFW(LatchWrite) { /* FCEU_printf("bs %04x %02x\n",A,V); */ @@ -60,7 +60,7 @@ static void StateRestore(int version) { WSync(); } -static void Latch_Init(CartInfo *info, void (*proc)(void), uint8 init, uint16 adr0, uint16 adr1, uint8 wram, uint8 busc) { +static void Latch_Init(CartInfo *info, void (*proc)(void), uint8_t init, uint16_t adr0, uint16_t adr1, uint8_t wram, uint8_t busc) { bus_conflict = busc; latcheinit = init; addrreg0 = adr0; @@ -71,7 +71,7 @@ static void Latch_Init(CartInfo *info, void (*proc)(void), uint8 init, uint16 ad GameStateRestore = StateRestore; if (wram) { WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); if (info->battery) { info->SaveGame[0] = WRAM; @@ -114,7 +114,7 @@ void NROM_Init(CartInfo *info) { info->Close = LatchClose; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); if (info->battery) { info->SaveGame[0] = WRAM; @@ -463,7 +463,7 @@ void Mapper271_Init(CartInfo *info) { /*------------------ Map 381 ---------------------------*/ /* 2-in-1 High Standard Game (BC-019), reset-based */ -static uint8 reset = 0; +static uint8_t reset = 0; static void M381Sync(void) { setprg16(0x8000, ((latche & 0x10) >> 4) | ((latche & 7) << 1) | (reset << 4)); setprg16(0xC000, 15 | (reset << 4)); @@ -486,7 +486,7 @@ void Mapper381_Init(CartInfo *info) { * bootleg cartridge conversion named Super Soccer Champion * of the Konami FDS game Exciting Soccer. */ -static uint8 M538Banks[16] = { 0, 1, 2, 1, 3, 1, 4, 1, 5, 5, 1, 1, 6, 6, 7, 7 }; +static uint8_t M538Banks[16] = { 0, 1, 2, 1, 3, 1, 4, 1, 5, 5, 1, 1, 6, 6, 7, 7 }; static void M538Sync(void) { setprg8(0x6000, (latche >> 1) | 8); setprg8(0x8000, M538Banks[latche & 15]); @@ -511,7 +511,7 @@ void Mapper538_Init(CartInfo *info) { /* Simple BMC discrete mapper by TXC */ static void BMC11160Sync(void) { - uint32 bank = (latche >> 4) & 7; + uint32_t bank = (latche >> 4) & 7; setprg32(0x8000, bank); setchr8((bank << 2) | (latche & 3)); setmirror((latche >> 7) & 1); @@ -595,7 +595,7 @@ void Mapper415_Init(CartInfo *info) { } /*------------------ Mapper 462 ---------------------------*/ -static uint8 M462OuterBank; +static uint8_t M462OuterBank; static void Mapper462_Sync(void) { if (M462OuterBank &0x40) { diff --git a/src/boards/dream.c b/src/boards/dream.c index bdc4394..37e6131 100644 --- a/src/boards/dream.c +++ b/src/boards/dream.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 latche; +static uint8_t latche; static void Sync(void) { setprg16(0x8000, latche); diff --git a/src/boards/edu2000.c b/src/boards/edu2000.c index b8dd5bc..0cfed14 100644 --- a/src/boards/edu2000.c +++ b/src/boards/edu2000.c @@ -21,8 +21,8 @@ #include "mapinc.h" -static uint8 *WRAM = NULL; -static uint8 reg; +static uint8_t *WRAM = NULL; +static uint8_t reg; static SFORMAT StateRegs[] = { @@ -67,7 +67,7 @@ void UNLEDU2000_Init(CartInfo *info) { info->Power = UNLEDU2000Power; info->Close = UNLEDU2000Close; GameStateRestore = UNLEDU2000Restore; - WRAM = (uint8*)FCEU_gmalloc(32768); + WRAM = (uint8_t*)FCEU_gmalloc(32768); SetupCartPRGMapping(0x10, WRAM, 32768, 1); if (info->battery) { info->SaveGame[0] = WRAM; diff --git a/src/boards/eeprom_93Cx6.c b/src/boards/eeprom_93Cx6.c index 0ea16ee..b3ae0ae 100644 --- a/src/boards/eeprom_93Cx6.c +++ b/src/boards/eeprom_93Cx6.c @@ -1,18 +1,18 @@ #include "eeprom_93Cx6.h" -uint8* eeprom_93Cx6_storage; -uint8 eeprom_93Cx6_opcode; -uint16 eeprom_93Cx6_data; -uint16 eeprom_93Cx6_address; -uint8 eeprom_93Cx6_state; -uint8 eeprom_93Cx6_lastCLK; -uint8 eeprom_93Cx6_writeEnabled; -uint8 eeprom_93Cx6_output; +uint8_t* eeprom_93Cx6_storage; +uint8_t eeprom_93Cx6_opcode; +uint16_t eeprom_93Cx6_data; +uint16_t eeprom_93Cx6_address; +uint8_t eeprom_93Cx6_state; +uint8_t eeprom_93Cx6_lastCLK; +uint8_t eeprom_93Cx6_writeEnabled; +uint8_t eeprom_93Cx6_output; size_t eeprom_93Cx6_capacity; -uint8 eeprom_93Cx6_wordSize; +uint8_t eeprom_93Cx6_wordSize; -static uint8 STATE_ADDRESS; -static uint8 STATE_DATA; +static uint8_t STATE_ADDRESS; +static uint8_t STATE_DATA; #define OPCODE_MISC 0 #define OPCODE_WRITE 1 @@ -32,7 +32,7 @@ static uint8 STATE_DATA; #define STATE_DATA16 27 #define STATE_FINISHED 99 -void eeprom_93Cx6_init (size_t capacity, uint8 wordSize) { +void eeprom_93Cx6_init (size_t capacity, uint8_t wordSize) { eeprom_93Cx6_capacity =capacity; eeprom_93Cx6_wordSize =wordSize; eeprom_93Cx6_address =0; @@ -47,11 +47,11 @@ void eeprom_93Cx6_init (size_t capacity, uint8 wordSize) { } } -uint8 eeprom_93Cx6_read () { +uint8_t eeprom_93Cx6_read () { return eeprom_93Cx6_output; } -void eeprom_93Cx6_write (uint8 CS, uint8 CLK, uint8 DAT) { +void eeprom_93Cx6_write (uint8_t CS, uint8_t CLK, uint8_t DAT) { if (!CS && eeprom_93Cx6_state <= STATE_ADDRESS) eeprom_93Cx6_state =STATE_STANDBY; else diff --git a/src/boards/eeprom_93Cx6.h b/src/boards/eeprom_93Cx6.h index 5606d8d..bbf9739 100644 --- a/src/boards/eeprom_93Cx6.h +++ b/src/boards/eeprom_93Cx6.h @@ -2,9 +2,9 @@ #define _EEPROM_93CX6_H #include "mapinc.h" -extern uint8* eeprom_93Cx6_storage; +extern uint8_t* eeprom_93Cx6_storage; -void eeprom_93Cx6_init (size_t capacity, uint8 wordSize); -uint8 eeprom_93Cx6_read (); -void eeprom_93Cx6_write (uint8 CS, uint8 CLK, uint8 DAT); +void eeprom_93Cx6_init (size_t capacity, uint8_t wordSize); +uint8_t eeprom_93Cx6_read (); +void eeprom_93Cx6_write (uint8_t CS, uint8_t CLK, uint8_t DAT); #endif diff --git a/src/boards/eh8813a.c b/src/boards/eh8813a.c index d8998a3..f32eee8 100644 --- a/src/boards/eh8813a.c +++ b/src/boards/eh8813a.c @@ -22,7 +22,7 @@ #include "mapinc.h" -static uint8 datalatch, addrlatch, lock, hw_mode; +static uint8_t datalatch, addrlatch, lock, hw_mode; static SFORMAT StateRegs[] = { @@ -34,7 +34,7 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { - uint8 prg = (addrlatch & 0x3F); + uint8_t prg = (addrlatch & 0x3F); setchr8(datalatch); if (addrlatch & 0x80) { setprg16(0x8000,prg); diff --git a/src/boards/emu2413.c b/src/boards/emu2413.c index 7859c73..2dabbfa 100644 --- a/src/boards/emu2413.c +++ b/src/boards/emu2413.c @@ -97,12 +97,12 @@ static const unsigned char default_inst[15][8] = { #define SL_BITS 4 #define SL_MUTE (1 << SL_BITS) -#define EG2DB(d) ((d) * (int32)(EG_STEP / DB_STEP)) -#define TL2EG(d) ((d) * (int32)(TL_STEP / EG_STEP)) -#define SL2EG(d) ((d) * (int32)(SL_STEP / EG_STEP)) +#define EG2DB(d) ((d) * (int32_t)(EG_STEP / DB_STEP)) +#define TL2EG(d) ((d) * (int32_t)(TL_STEP / EG_STEP)) +#define SL2EG(d) ((d) * (int32_t)(SL_STEP / EG_STEP)) -#define DB_POS(x) (uint32)((x) / DB_STEP) -#define DB_NEG(x) (uint32)(DB_MUTE + DB_MUTE + (x) / DB_STEP) +#define DB_POS(x) (uint32_t)((x) / DB_STEP) +#define DB_NEG(x) (uint32_t)(DB_MUTE + DB_MUTE + (x) / DB_STEP) /* Bits for liner value */ #define DB2LIN_AMP_BITS 11 @@ -148,7 +148,7 @@ static const unsigned char default_inst[15][8] = { #define EXPAND_BITS_X(x, s, d) (((x) << ((d) - (s))) | ((1 << ((d) - (s))) - 1)) /* Adjust envelope speed which depends on sampling rate. */ -#define rate_adjust(x) (rate == 49716 ? x : (uint32)((double)(x) * clk / 72 / rate + 0.5)) /* added 0.5 to round the value*/ +#define rate_adjust(x) (rate == 49716 ? x : (uint32_t)((double)(x) * clk / 72 / rate + 0.5)) /* added 0.5 to round the value*/ #define MOD(o, x) (&(o)->slot[(x) << 1]) #define CAR(o, x) (&(o)->slot[((x) << 1) | 1]) @@ -156,52 +156,52 @@ static const unsigned char default_inst[15][8] = { #define BIT(s, b) (((s) >> (b)) & 1) /* Input clock */ -static uint32 clk = 844451141; +static uint32_t clk = 844451141; /* Sampling rate */ -static uint32 rate = 3354932; +static uint32_t rate = 3354932; /* WaveTable for each envelope amp */ -static uint16 fullsintable[PG_WIDTH]; -static uint16 halfsintable[PG_WIDTH]; +static uint16_t fullsintable[PG_WIDTH]; +static uint16_t halfsintable[PG_WIDTH]; -static uint16 *waveform[2] = { fullsintable, halfsintable }; +static uint16_t *waveform[2] = { fullsintable, halfsintable }; /* LFO Table */ -static int32 pmtable[PM_PG_WIDTH]; -static int32 amtable[AM_PG_WIDTH]; +static int32_t pmtable[PM_PG_WIDTH]; +static int32_t amtable[AM_PG_WIDTH]; /* Phase delta for LFO */ -static uint32 pm_dphase; -static uint32 am_dphase; +static uint32_t pm_dphase; +static uint32_t am_dphase; /* dB to Liner table */ -static int16 DB2LIN_TABLE[(DB_MUTE + DB_MUTE) * 2]; +static int16_t DB2LIN_TABLE[(DB_MUTE + DB_MUTE) * 2]; /* Liner to Log curve conversion table (for Attack rate). */ -static uint16 AR_ADJUST_TABLE[1 << EG_BITS]; +static uint16_t AR_ADJUST_TABLE[1 << EG_BITS]; /* Definition of envelope mode */ enum { SETTLE, ATTACK, DECAY, SUSHOLD, SUSTINE, RELEASE, FINISH }; /* Phase incr table for Attack */ -static uint32 dphaseARTable[16][16]; +static uint32_t dphaseARTable[16][16]; /* Phase incr table for Decay and Release */ -static uint32 dphaseDRTable[16][16]; +static uint32_t dphaseDRTable[16][16]; /* KSL + TL Table */ -static uint32 tllTable[16][8][1 << TL_BITS][4]; -static int32 rksTable[2][8][2]; +static uint32_t tllTable[16][8][1 << TL_BITS][4]; +static int32_t rksTable[2][8][2]; /* Phase incr table for PG */ -static uint32 dphaseTable[512][8][16]; +static uint32_t dphaseTable[512][8][16]; /*************************************************** Create tables ****************************************************/ -INLINE static int32 Min(int32 i, int32 j) { +INLINE static int32_t Min(int32_t i, int32_t j) { if (i < j) return i; else @@ -210,40 +210,40 @@ INLINE static int32 Min(int32 i, int32 j) { /* Table for AR to LogCurve. */ static void makeAdjustTable(void) { - int32 i; + int32_t i; AR_ADJUST_TABLE[0] = (1 << EG_BITS); for (i = 1; i < 128; i++) - AR_ADJUST_TABLE[i] = (uint16)((double)(1 << EG_BITS) - 1 - (1 << EG_BITS) * log(i) / log(128)); + AR_ADJUST_TABLE[i] = (uint16_t)((double)(1 << EG_BITS) - 1 - (1 << EG_BITS) * log(i) / log(128)); } /* Table for dB(0 -- (1<= DB_MUTE) DB2LIN_TABLE[i] = 0; - DB2LIN_TABLE[i + DB_MUTE + DB_MUTE] = (int16)(-DB2LIN_TABLE[i]); + DB2LIN_TABLE[i + DB_MUTE + DB_MUTE] = (int16_t)(-DB2LIN_TABLE[i]); } } /* Liner(+0.0 - +1.0) to dB((1<> (3 - KL)) / EG_STEP) + TL2EG(TL); + tllTable[fnum][block][TL][KL] = (uint32_t)((tmp >> (3 - KL)) / EG_STEP) + TL2EG(TL); } } } /* Rate Table for Attack */ static void makeDphaseARTable(void) { - int32 AR, Rks, RM, RL; + int32_t AR, Rks, RM, RL; for (AR = 0; AR < 16; AR++) for (Rks = 0; Rks < 16; Rks++) { RM = AR + (Rks >> 2); @@ -340,7 +340,7 @@ static void makeDphaseARTable(void) { /* Rate Table for Decay and Release */ static void makeDphaseDRTable(void) { - int32 DR, Rks, RM, RL; + int32_t DR, Rks, RM, RL; for (DR = 0; DR < 16; DR++) for (Rks = 0; Rks < 16; Rks++) { @@ -360,7 +360,7 @@ static void makeDphaseDRTable(void) { } static void makeRksTable(void) { - int32 fnum8, block, KR; + int32_t fnum8, block, KR; for (fnum8 = 0; fnum8 < 2; fnum8++) for (block = 0; block < 8; block++) @@ -378,7 +378,7 @@ static void makeRksTable(void) { ************************************************************/ -INLINE static uint32 calc_eg_dphase(OPLL_SLOT * slot) { +INLINE static uint32_t calc_eg_dphase(OPLL_SLOT * slot) { switch (slot->eg_mode) { case ATTACK: return dphaseARTable[slot->patch.AR][slot->rks]; @@ -451,7 +451,7 @@ INLINE static void slotOff(OPLL_SLOT * slot) { } /* Channel key on */ -INLINE static void keyOn(OPLL * opll, int32 i) { +INLINE static void keyOn(OPLL * opll, int32_t i) { if (!opll->slot_on_flag[i * 2]) slotOn(MOD(opll, i)); if (!opll->slot_on_flag[i * 2 + 1]) @@ -460,36 +460,36 @@ INLINE static void keyOn(OPLL * opll, int32 i) { } /* Channel key off */ -INLINE static void keyOff(OPLL * opll, int32 i) { +INLINE static void keyOff(OPLL * opll, int32_t i) { if (opll->slot_on_flag[i * 2 + 1]) slotOff(CAR(opll, i)); opll->key_status[i] = 0; } /* Set sustine parameter */ -INLINE static void setSustine(OPLL * opll, int32 c, int32 sustine) { +INLINE static void setSustine(OPLL * opll, int32_t c, int32_t sustine) { CAR(opll, c)->sustine = sustine; if (MOD(opll, c)->type) MOD(opll, c)->sustine = sustine; } /* Volume : 6bit ( Volume register << 2 ) */ -INLINE static void setVolume(OPLL * opll, int32 c, int32 volume) { +INLINE static void setVolume(OPLL * opll, int32_t c, int32_t volume) { CAR(opll, c)->volume = volume; } -INLINE static void setSlotVolume(OPLL_SLOT * slot, int32 volume) { +INLINE static void setSlotVolume(OPLL_SLOT * slot, int32_t volume) { slot->volume = volume; } /* Set F-Number ( fnum : 9bit ) */ -INLINE static void setFnumber(OPLL * opll, int32 c, int32 fnum) { +INLINE static void setFnumber(OPLL * opll, int32_t c, int32_t fnum) { CAR(opll, c)->fnum = fnum; MOD(opll, c)->fnum = fnum; } /* Set Block data (block : 3bit ) */ -INLINE static void setBlock(OPLL * opll, int32 c, int32 block) { +INLINE static void setBlock(OPLL * opll, int32_t c, int32_t block) { CAR(opll, c)->block = block; MOD(opll, c)->block = block; } @@ -532,11 +532,11 @@ static void internal_refresh(void) { makeDphaseTable(); makeDphaseARTable(); makeDphaseDRTable(); - pm_dphase = (uint32)rate_adjust(PM_SPEED * PM_DP_WIDTH / (clk / 72)); - am_dphase = (uint32)rate_adjust(AM_SPEED * AM_DP_WIDTH / (clk / 72)); + pm_dphase = (uint32_t)rate_adjust(PM_SPEED * PM_DP_WIDTH / (clk / 72)); + am_dphase = (uint32_t)rate_adjust(AM_SPEED * AM_DP_WIDTH / (clk / 72)); } -static void maketables(uint32 c, uint32 r) { +static void maketables(uint32_t c, uint32_t r) { if (c != clk) { clk = c; makePmTable(); @@ -555,7 +555,7 @@ static void maketables(uint32 c, uint32 r) { } } -OPLL *OPLL_new(uint32 _clk, uint32 _rate) { +OPLL *OPLL_new(uint32_t _clk, uint32_t _rate) { OPLL *opll; maketables(_clk, _rate); @@ -578,7 +578,7 @@ void OPLL_delete(OPLL * opll) { /* Reset whole of OPLL except patch datas. */ void OPLL_reset(OPLL * opll) { - int32 i; + int32_t i; if (!opll) return; @@ -602,14 +602,14 @@ void OPLL_reset(OPLL * opll) { for (i = 0; i < 0x40; i++) OPLL_writeReg(opll, i, 0); - opll->realstep = (uint32)((1 << 31) / rate); - opll->opllstep = (uint32)((1 << 31) / (clk / 72)); + opll->realstep = (uint32_t)((1 << 31) / rate); + opll->opllstep = (uint32_t)((1 << 31) / (clk / 72)); opll->oplltime = 0; } /* Force Refresh (When external program changes some parameters). */ void OPLL_forceRefresh(OPLL * opll) { - int32 i; + int32_t i; if (opll == NULL) return; @@ -623,7 +623,7 @@ void OPLL_forceRefresh(OPLL * opll) { } } -void OPLL_set_rate(OPLL * opll, uint32 r) { +void OPLL_set_rate(OPLL * opll, uint32_t r) { if (opll->quality) rate = 49716; else @@ -632,7 +632,7 @@ void OPLL_set_rate(OPLL * opll, uint32 r) { rate = r; } -void OPLL_set_quality(OPLL * opll, uint32 q) { +void OPLL_set_quality(OPLL * opll, uint32_t q) { opll->quality = q; OPLL_set_rate(opll, rate); } @@ -678,7 +678,7 @@ static void update_ampm(OPLL * opll) { } /* PG */ -INLINE static void calc_phase(OPLL_SLOT * slot, int32 lfo) { +INLINE static void calc_phase(OPLL_SLOT * slot, int32_t lfo) { if (slot->patch.PM) slot->phase += (slot->dphase * lfo) >> PM_AMP_BITS; else @@ -690,15 +690,15 @@ INLINE static void calc_phase(OPLL_SLOT * slot, int32 lfo) { } /* EG */ -static void calc_envelope(OPLL_SLOT * slot, int32 lfo) { -#define S2E(x) (SL2EG((int32)(x / SL_STEP)) << (EG_DP_BITS - EG_BITS)) +static void calc_envelope(OPLL_SLOT * slot, int32_t lfo) { +#define S2E(x) (SL2EG((int32_t)(x / SL_STEP)) << (EG_DP_BITS - EG_BITS)) - static uint32 SL[16] = { + static uint32_t SL[16] = { S2E(0.0), S2E(3.0), S2E(6.0), S2E(9.0), S2E(12.0), S2E(15.0), S2E(18.0), S2E(21.0), S2E(24.0), S2E(27.0), S2E(30.0), S2E(33.0), S2E(36.0), S2E(39.0), S2E(42.0), S2E(48.0) }; - uint32 egout; + uint32_t egout; switch (slot->eg_mode) { case ATTACK: @@ -767,7 +767,7 @@ static void calc_envelope(OPLL_SLOT * slot, int32 lfo) { } /* CARRIOR */ -INLINE static int32 calc_slot_car(OPLL_SLOT * slot, int32 fm) { +INLINE static int32_t calc_slot_car(OPLL_SLOT * slot, int32_t fm) { slot->output[1] = slot->output[0]; if (slot->egout >= (DB_MUTE - 1)) { @@ -780,8 +780,8 @@ INLINE static int32 calc_slot_car(OPLL_SLOT * slot, int32 fm) { } /* MODULATOR */ -INLINE static int32 calc_slot_mod(OPLL_SLOT * slot) { - int32 fm; +INLINE static int32_t calc_slot_mod(OPLL_SLOT * slot) { + int32_t fm; slot->output[1] = slot->output[0]; @@ -799,9 +799,9 @@ INLINE static int32 calc_slot_mod(OPLL_SLOT * slot) { return slot->feedback; } -static INLINE int16 calc(OPLL * opll) { - int32 inst = 0, out = 0; - int32 i; +static INLINE int16_t calc(OPLL * opll) { + int32_t inst = 0, out = 0; + int32_t i; update_ampm(opll); @@ -815,10 +815,10 @@ static INLINE int16 calc(OPLL * opll) { inst += calc_slot_car(CAR(opll, i), calc_slot_mod(MOD(opll, i))); out = inst; - return (int16)out; + return (int16_t)out; } -void OPLL_fillbuf(OPLL* opll, int32 *buf, int32 len, int shift) { +void OPLL_fillbuf(OPLL* opll, int32_t *buf, int32_t len, int shift) { while (len > 0) { *buf += (calc(opll) + 32768) << shift; buf++; @@ -826,7 +826,7 @@ void OPLL_fillbuf(OPLL* opll, int32 *buf, int32 len, int shift) { } } -int16 OPLL_calc(OPLL * opll) { +int16_t OPLL_calc(OPLL * opll) { if (!opll->quality) return calc(opll); @@ -837,14 +837,14 @@ int16 OPLL_calc(OPLL * opll) { } opll->oplltime -= opll->realstep; - opll->out = (int16)(((double)opll->next * (opll->opllstep - opll->oplltime) + opll->out = (int16_t)(((double)opll->next * (opll->opllstep - opll->oplltime) + (double)opll->prev * opll->oplltime) / opll->opllstep); - return (int16)opll->out; + return (int16_t)opll->out; } -uint32 OPLL_setMask(OPLL * opll, uint32 mask) { - uint32 ret; +uint32_t OPLL_setMask(OPLL * opll, uint32_t mask) { + uint32_t ret; if (opll) { ret = opll->mask; @@ -854,8 +854,8 @@ uint32 OPLL_setMask(OPLL * opll, uint32 mask) { return 0; } -uint32 OPLL_toggleMask(OPLL * opll, uint32 mask) { - uint32 ret; +uint32_t OPLL_toggleMask(OPLL * opll, uint32_t mask) { + uint32_t ret; if (opll) { ret = opll->mask; @@ -871,8 +871,8 @@ uint32 OPLL_toggleMask(OPLL * opll, uint32 mask) { *****************************************************/ -static void setInstrument(OPLL * opll, uint32 i, uint32 inst) { - const uint8 *src; +static void setInstrument(OPLL * opll, uint32_t i, uint32_t inst) { + const uint8_t *src; OPLL_PATCH *modp, *carp; opll->patch_number[i] = inst; @@ -921,8 +921,8 @@ static void setInstrument(OPLL * opll, uint32 i, uint32 inst) { } -void OPLL_writeReg(OPLL * opll, uint32 reg, uint32 data) { - int32 i, v, ch; +void OPLL_writeReg(OPLL * opll, uint32_t reg, uint32_t data) { + int32_t i, v, ch; data = data & 0xff; reg = reg & 0x3f; @@ -1067,7 +1067,7 @@ void OPLL_writeReg(OPLL * opll, uint32 reg, uint32 data) { } } -void OPLL_writeIO(OPLL * opll, uint32 adr, uint32 val) { +void OPLL_writeIO(OPLL * opll, uint32_t adr, uint32_t val) { if (adr & 1) OPLL_writeReg(opll, opll->adr, val); else diff --git a/src/boards/emu2413.h b/src/boards/emu2413.h index b14833b..7f30ee4 100644 --- a/src/boards/emu2413.h +++ b/src/boards/emu2413.h @@ -16,36 +16,36 @@ enum { OPLL_VRC7_TONE=0 }; /* voice data */ typedef struct { - uint32 TL, FB, EG, ML, AR, DR, SL, RR, KR, KL, AM, PM, WF; + uint32_t TL, FB, EG, ML, AR, DR, SL, RR, KR, KL, AM, PM, WF; } OPLL_PATCH; /* slot */ typedef struct { OPLL_PATCH patch; - int32 type; /* 0 : modulator 1 : carrier */ + int32_t type; /* 0 : modulator 1 : carrier */ /* OUTPUT */ - int32 feedback; - int32 output[2]; /* Output value of slot */ + int32_t feedback; + int32_t output[2]; /* Output value of slot */ /* for Phase Generator (PG) */ - uint16 *sintbl; /* Wavetable */ - uint32 phase; /* Phase */ - uint32 dphase; /* Phase increment amount */ - uint32 pgout; /* output */ + uint16_t *sintbl; /* Wavetable */ + uint32_t phase; /* Phase */ + uint32_t dphase; /* Phase increment amount */ + uint32_t pgout; /* output */ /* for Envelope Generator (EG) */ - int32 fnum; /* F-Number */ - int32 block; /* Block */ - int32 volume; /* Current volume */ - int32 sustine; /* Sustine 1 = ON, 0 = OFF */ - uint32 tll; /* Total Level + Key scale level*/ - uint32 rks; /* Key scale offset (Rks) */ - int32 eg_mode; /* Current state */ - uint32 eg_phase; /* Phase */ - uint32 eg_dphase; /* Phase increment amount */ - uint32 egout; /* output */ + int32_t fnum; /* F-Number */ + int32_t block; /* Block */ + int32_t volume; /* Current volume */ + int32_t sustine; /* Sustine 1 = ON, 0 = OFF */ + uint32_t tll; /* Total Level + Key scale level*/ + uint32_t rks; /* Key scale offset (Rks) */ + int32_t eg_mode; /* Current state */ + uint32_t eg_phase; /* Phase */ + uint32_t eg_dphase; /* Phase increment amount */ + uint32_t egout; /* output */ } OPLL_SLOT; /* Mask */ @@ -53,68 +53,68 @@ typedef struct { /* opll */ typedef struct { - uint32 adr; - int32 out; + uint32_t adr; + int32_t out; - uint32 realstep; - uint32 oplltime; - uint32 opllstep; - int32 prev, next; + uint32_t realstep; + uint32_t oplltime; + uint32_t opllstep; + int32_t prev, next; /* Register */ - uint8 LowFreq[6]; - uint8 HiFreq[6]; - uint8 InstVol[6]; + uint8_t LowFreq[6]; + uint8_t HiFreq[6]; + uint8_t InstVol[6]; - uint8 CustInst[8]; + uint8_t CustInst[8]; - int32 slot_on_flag[6 * 2]; + int32_t slot_on_flag[6 * 2]; /* Pitch Modulator */ - uint32 pm_phase; - int32 lfo_pm; + uint32_t pm_phase; + int32_t lfo_pm; /* Amp Modulator */ - int32 am_phase; - int32 lfo_am; + int32_t am_phase; + int32_t lfo_am; - uint32 quality; + uint32_t quality; /* Channel Data */ - int32 patch_number[6]; - int32 key_status[6]; + int32_t patch_number[6]; + int32_t key_status[6]; /* Slot */ OPLL_SLOT slot[6 * 2]; - uint32 mask; + uint32_t mask; } OPLL; /* Create Object */ -OPLL *OPLL_new(uint32 clk, uint32 rate); +OPLL *OPLL_new(uint32_t clk, uint32_t rate); void OPLL_delete(OPLL *); /* Setup */ void OPLL_reset(OPLL *); -void OPLL_set_rate(OPLL *opll, uint32 r); -void OPLL_set_quality(OPLL *opll, uint32 q); +void OPLL_set_rate(OPLL *opll, uint32_t r); +void OPLL_set_quality(OPLL *opll, uint32_t q); /* Port/Register access */ -void OPLL_writeIO(OPLL *, uint32 reg, uint32 val); -void OPLL_writeReg(OPLL *, uint32 reg, uint32 val); +void OPLL_writeIO(OPLL *, uint32_t reg, uint32_t val); +void OPLL_writeReg(OPLL *, uint32_t reg, uint32_t val); /* Synthsize */ -int16 OPLL_calc(OPLL *); +int16_t OPLL_calc(OPLL *); /* Misc */ void OPLL_forceRefresh(OPLL *); /* Channel Mask */ -uint32 OPLL_setMask(OPLL *, uint32 mask); -uint32 OPLL_toggleMask(OPLL *, uint32 mask); +uint32_t OPLL_setMask(OPLL *, uint32_t mask); +uint32_t OPLL_toggleMask(OPLL *, uint32_t mask); -void OPLL_fillbuf(OPLL* opll, int32 *buf, int32 len, int shift); +void OPLL_fillbuf(OPLL* opll, int32_t *buf, int32_t len, int shift); #ifdef __cplusplus } diff --git a/src/boards/et-100.c b/src/boards/et-100.c index 1ad553c..0eabcd7 100644 --- a/src/boards/et-100.c +++ b/src/boards/et-100.c @@ -41,18 +41,18 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 submapper; -static uint8 *CHRRAM = NULL; -static uint32 CHRRAMSize; +static uint8_t submapper; +static uint8_t *CHRRAM = NULL; +static uint32_t CHRRAMSize; -static void BMC1024CA1PW(uint32 A, uint8 V) { +static void BMC1024CA1PW(uint32_t A, uint8_t V) { if ((EXPREGS[0]>>3)&1) setprg8(A, (V&0x1F) | ((EXPREGS[0] & 7) << 4)); else setprg8(A, (V&0x0F) | ((EXPREGS[0] & 7) << 4)); } -static void BMC1024CA1CW(uint32 A, uint8 V) { +static void BMC1024CA1CW(uint32_t A, uint8_t V) { if ((EXPREGS[0]>>4)&1) setchr1r(0x10, A, V); else if (((EXPREGS[0]>>5)&1) && ((EXPREGS[0]>>3)&1)) @@ -63,7 +63,7 @@ static void BMC1024CA1CW(uint32 A, uint8 V) { if (submapper == 1 && EXPREGS[0] &0x08) setmirror(DRegBuf[MMC3_cmd &0x80? 2: 0] &0x80? MI_1: MI_0); } -static void BMC1024CA1MW(uint8 V) { +static void BMC1024CA1MW(uint8_t V) { A000B = V; if (EXPREGS[0] &0x08) setmirror(DRegBuf[MMC3_cmd &0x80? 2: 0] &0x80? MI_1: MI_0); @@ -104,7 +104,7 @@ void BMC1024CA1_Init(CartInfo *info) { submapper = info->submapper; GenMMC3_Init(info, 256, 256, 8, 0); CHRRAMSize = 8192; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSize); + CHRRAM = (uint8_t*)FCEU_gmalloc(CHRRAMSize); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1); AddExState(CHRRAM, CHRRAMSize, 0, "CHRR"); pwrap = BMC1024CA1PW; diff --git a/src/boards/et-4320.c b/src/boards/et-4320.c index 0f32942..0e986f2 100644 --- a/src/boards/et-4320.c +++ b/src/boards/et-4320.c @@ -41,19 +41,19 @@ Example Game: #include "mapinc.h" #include "mmc3.h" -static uint8 *CHRRAM; -static uint32 CHRRAMSize; -static uint8 PPUCHRBus; -static uint8 TKSMIR[8]; +static uint8_t *CHRRAM; +static uint32_t CHRRAMSize; +static uint8_t PPUCHRBus; +static uint8_t TKSMIR[8]; -static void BMC810131C_PW(uint32 A, uint8 V) { +static void BMC810131C_PW(uint32_t A, uint8_t V) { if ((EXPREGS[0] >> 3) & 1) setprg8(A, (V & 0x1F) | ((EXPREGS[0] & 7) << 4)); else setprg8(A, (V & 0x0F) | ((EXPREGS[0] & 7) << 4)); } -static void BMC810131C_CW(uint32 A, uint8 V) { +static void BMC810131C_CW(uint32_t A, uint8_t V) { if ((EXPREGS[0] >> 4) & 1) setchr1r(0x10, A, V); else if (((EXPREGS[0] >> 5) & 1) && ((EXPREGS[0] >> 3) & 1)) @@ -96,7 +96,7 @@ static void BMC810131C_Close(void) { CHRRAM = NULL; } -static void TKSPPU(uint32 A) { +static void TKSPPU(uint32_t A) { A &= 0x1FFF; A >>= 10; PPUCHRBus = A; @@ -107,7 +107,7 @@ static void TKSPPU(uint32 A) { void BMC810131C_Init(CartInfo *info) { GenMMC3_Init(info, 256, 256, 8, 0); CHRRAMSize = 8192; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSize); + CHRRAM = (uint8_t*)FCEU_gmalloc(CHRRAMSize); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1); AddExState(CHRRAM, CHRRAMSize, 0, "CHRR"); pwrap = BMC810131C_PW; diff --git a/src/boards/f-15.c b/src/boards/f-15.c index cb6b254..7dea254 100644 --- a/src/boards/f-15.c +++ b/src/boards/f-15.c @@ -33,10 +33,10 @@ #include "mapinc.h" #include "mmc3.h" -static void BMCF15PW(uint32 A, uint8 V) { - uint32 bank = EXPREGS[0] & 0xF; - uint32 mode = (EXPREGS[0] & 8) >> 3; - uint32 mask = ~(mode); +static void BMCF15PW(uint32_t A, uint8_t V) { + uint32_t bank = EXPREGS[0] & 0xF; + uint32_t mode = (EXPREGS[0] & 8) >> 3; + uint32_t mask = ~(mode); setprg16(0x8000, (bank & mask)); setprg16(0xC000, (bank & mask) | mode); } diff --git a/src/boards/famicombox.c b/src/boards/famicombox.c index 8be1a60..b2ae7e1 100644 --- a/src/boards/famicombox.c +++ b/src/boards/famicombox.c @@ -20,9 +20,9 @@ #include "mapinc.h" -static uint8 regs[8]; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t regs[8]; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -112,7 +112,7 @@ void SSSNROM_Init(CartInfo *info) { GameStateRestore = StateRestore; WRAMSIZE = 16384; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); AddExState(&StateRegs, ~0, 0, 0); diff --git a/src/boards/faridunrom.c b/src/boards/faridunrom.c index 219b8d7..a56cf0e 100644 --- a/src/boards/faridunrom.c +++ b/src/boards/faridunrom.c @@ -25,7 +25,7 @@ #include "mapinc.h" -static uint8 latch; +static uint8_t latch; static SFORMAT StateRegs[] = { diff --git a/src/boards/fifo.c b/src/boards/fifo.c index e66419a..097b4c6 100644 --- a/src/boards/fifo.c +++ b/src/boards/fifo.c @@ -29,7 +29,7 @@ size_t FIFO_size (FIFO *fifo) { return (fifo->back -fifo->front +fifo->capacity) %fifo->capacity; } -uint8 FIFO_halfFull (FIFO *fifo) { +uint8_t FIFO_halfFull (FIFO *fifo) { return FIFO_size(fifo) >= fifo->capacity /2; } @@ -38,7 +38,7 @@ int FIFO_retrieve (FIFO *fifo) { return FIFO_size(fifo)? fifo->data[fifo->front++]: 0; } -void FIFO_add (FIFO *fifo, uint8 value) { +void FIFO_add (FIFO *fifo, uint8_t value) { fifo->back %= fifo->capacity; if (FIFO_size(fifo) capacity) fifo->data[fifo->back++] = value; } @@ -49,7 +49,7 @@ void FIFO_reset (FIFO *fifo) { void FIFO_init (FIFO *fifo, size_t newCapacity) { fifo->capacity = newCapacity; - fifo->data = (uint8*)FCEU_gmalloc(newCapacity); + fifo->data = (uint8_t*)FCEU_gmalloc(newCapacity); AddExState(fifo->data, fifo->capacity, 0, "FIFD"); AddExState(&fifo->front, 2 | FCEUSTATE_RLSB, 0, "FIFF"); AddExState(&fifo->back, 2 | FCEUSTATE_RLSB, 0, "FIFB"); diff --git a/src/boards/fifo.h b/src/boards/fifo.h index 377452c..9bcadcb 100644 --- a/src/boards/fifo.h +++ b/src/boards/fifo.h @@ -3,15 +3,15 @@ typedef struct { size_t capacity; - uint8 *data; - int16 front; - int16 back; + uint8_t *data; + int16_t front; + int16_t back; } FIFO; size_t FIFO_size (FIFO *); -uint8 FIFO_halfFull (FIFO *); +uint8_t FIFO_halfFull (FIFO *); int FIFO_retrieve (FIFO *); -void FIFO_add (FIFO *, uint8); +void FIFO_add (FIFO *, uint8_t); void FIFO_reset (FIFO *); void FIFO_init (FIFO *, size_t); void FIFO_close (FIFO *); diff --git a/src/boards/fk23c.c b/src/boards/fk23c.c index 5218f3f..413bec0 100644 --- a/src/boards/fk23c.c +++ b/src/boards/fk23c.c @@ -42,29 +42,29 @@ #include "mapinc.h" -static uint8 *WRAM = NULL; -static uint8 *CHRRAM = NULL; -static uint32 WRAMSIZE = 0; -static uint32 CHRRAMSIZE = 0; +static uint8_t *WRAM = NULL; +static uint8_t *CHRRAM = NULL; +static uint32_t WRAMSIZE = 0; +static uint32_t CHRRAMSIZE = 0; -static uint8 fk23_regs[8] = { 0 }; /* JX9003B has eight registers, all others have four */ -static uint8 mmc3_regs[12] = { 0 }; -static uint8 mmc3_ctrl = 0; -static uint8 mmc3_mirr = 0; -static uint8 mmc3_wram = 0; -static uint8 irq_count = 0; -static uint8 irq_latch = 0; -static uint8 irq_enabled = 0; -static uint8 irq_reload = 0; -static uint8 latch = 0; -static uint8 dipswitch = 0; -static uint8 subType = 0; /* NES 2.0 Submapper, denoting PCB variants */ -static uint8 jncota523 = 0; /* Jncota board with unusual wiring that turns 1 KiB CHR banks into 2 KiB banks, and has hard-wired nametable mirroring. */ -static uint8 dipsw_enable = 0; /* Change the address mask on every reset? */ -static uint8 after_power = 0; /* Used for detecting whether a DIP switch is used or not (see above) */ +static uint8_t fk23_regs[8] = { 0 }; /* JX9003B has eight registers, all others have four */ +static uint8_t mmc3_regs[12] = { 0 }; +static uint8_t mmc3_ctrl = 0; +static uint8_t mmc3_mirr = 0; +static uint8_t mmc3_wram = 0; +static uint8_t irq_count = 0; +static uint8_t irq_latch = 0; +static uint8_t irq_enabled = 0; +static uint8_t irq_reload = 0; +static uint8_t latch = 0; +static uint8_t dipswitch = 0; +static uint8_t subType = 0; /* NES 2.0 Submapper, denoting PCB variants */ +static uint8_t jncota523 = 0; /* Jncota board with unusual wiring that turns 1 KiB CHR banks into 2 KiB banks, and has hard-wired nametable mirroring. */ +static uint8_t dipsw_enable = 0; /* Change the address mask on every reset? */ +static uint8_t after_power = 0; /* Used for detecting whether a DIP switch is used or not (see above) */ -extern uint32 ROM_size; -extern uint32 VROM_size; +extern uint32_t ROM_size; +extern uint32_t VROM_size; static SFORMAT StateRegs[] = { { fk23_regs, 8, "EXPR" }, @@ -94,7 +94,7 @@ static SFORMAT StateRegs[] = { #define CHR_OUTER_BANK_SIZE !!( fk23_regs[0] & 0x10) /* Switch between 256 and 128 KiB CHR, or 32 and 16 KiB CHR in CNROM mode */ #define CHR_MIXED !!(WRAM_EXTENDED && mmc3_wram &0x04) /* First 8 KiB of CHR address space are RAM, then ROM */ -static void cwrap(uint32 A, uint32 V) +static void cwrap(uint32_t A, uint32_t V) { int bank = 0; @@ -118,12 +118,12 @@ static void cwrap(uint32 A, uint32 V) static void SyncCHR(void) { - uint32 outer = fk23_regs[2] | (subType == 3? (fk23_regs[6] << 8): 0); /* Outer 8 KiB CHR bank. Subtype 3 has an MSB register providing more bits. */ + uint32_t outer = fk23_regs[2] | (subType == 3? (fk23_regs[6] << 8): 0); /* Outer 8 KiB CHR bank. Subtype 3 has an MSB register providing more bits. */ if (CHR_8K_MODE) { - uint32 mask = (CHR_CNROM_MODE? (CHR_OUTER_BANK_SIZE? 0x01: 0x03): 0x00); + uint32_t mask = (CHR_CNROM_MODE? (CHR_OUTER_BANK_SIZE? 0x01: 0x03): 0x00); /* In Submapper 1, address bits come either from outer bank or from latch. In Submapper 5, they are OR'd. Both verified on original hardware. */ - uint32 bank = ((subType ==5? outer: (outer & ~mask)) | (latch & mask)) << 3; + uint32_t bank = ((subType ==5? outer: (outer & ~mask)) | (latch & mask)) << 3; cwrap(0x0000, bank + 0); cwrap(0x0400, bank + 1); @@ -137,8 +137,8 @@ static void SyncCHR(void) } else { - uint32 cbase = (INVERT_CHR? 0x1000: 0); - uint32 mask = (CHR_OUTER_BANK_SIZE? 0x7F: 0xFF); + uint32_t cbase = (INVERT_CHR? 0x1000: 0); + uint32_t mask = (CHR_OUTER_BANK_SIZE? 0x7F: 0xFF); outer = (outer << 3) & ~mask; /* From 8 KiB to 1 KiB banks. Address bits are never OR'd; they either come from the outer bank or from the MMC3. */ if (MMC3_EXTENDED) @@ -170,8 +170,8 @@ static void SyncCHR(void) static void SyncPRG(void) { - uint32 mask = 0x3F >> PRG_MODE; /* For PRG modes 0-2, the mode# decides how many bits of the inner 8 KiB bank are used. This is greatly relevant to map the correct bank that contains the reset vectors. */ - uint32 prg_base = fk23_regs[1] & 0x7F; /* The bits for the first 2 MiB are the same between all the variants. */ + uint32_t mask = 0x3F >> PRG_MODE; /* For PRG modes 0-2, the mode# decides how many bits of the inner 8 KiB bank are used. This is greatly relevant to map the correct bank that contains the reset vectors. */ + uint32_t prg_base = fk23_regs[1] & 0x7F; /* The bits for the first 2 MiB are the same between all the variants. */ switch (subType) { case 1: /* FK-xxx */ @@ -198,7 +198,7 @@ static void SyncPRG(void) case 1: /* MMC3 with 256 KiB addressable */ case 2: /* MMC3 with 128 KiB addressable */ { - uint32 cbase = (INVERT_PRG ? 0x4000 : 0); + uint32_t cbase = (INVERT_PRG ? 0x4000 : 0); prg_base =(prg_base << 1) & ~mask; /* from 16 to 8 KiB. Address bits are never OR'd; they either come from the outer bank or from the MMC3. */ @@ -302,7 +302,7 @@ static DECLFW(Write8000) { case 0x8000: { - uint8 old_ctrl; + uint8_t 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. */ old_ctrl = mmc3_ctrl; @@ -328,7 +328,7 @@ static DECLFW(Write8000) } case 0x8001: { - uint8 ctrl_mask; + uint8_t 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. */ ctrl_mask = MMC3_EXTENDED ? 0x0F : 0x07; @@ -477,14 +477,14 @@ void Init(CartInfo *info) if (CHRRAMSIZE) { - CHRRAM = (uint8 *)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM = (uint8_t *)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM"); } if (WRAMSIZE) { - WRAM = (uint8 *)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t *)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); diff --git a/src/boards/flashrom.c b/src/boards/flashrom.c index b02d038..85292c9 100644 --- a/src/boards/flashrom.c +++ b/src/boards/flashrom.c @@ -1,15 +1,15 @@ #include "flashrom.h" -uint8 flashrom_manufacturerID; -uint8 flashrom_modelID; +uint8_t flashrom_manufacturerID; +uint8_t flashrom_modelID; int flashrom_state; -uint32 flashrom_sectorSize; +uint32_t flashrom_sectorSize; int flashrom_timeOut; -uint32 flashrom_magicAddr1; -uint32 flashrom_magicAddr2; -uint32 flashrom_magicMask; +uint32_t flashrom_magicAddr1; +uint32_t flashrom_magicAddr2; +uint32_t flashrom_magicMask; -void flashrom_init (uint8 manufacturerID, uint8 modelID, uint32 sectorSize, uint32 magicAddr1, uint32 magicAddr2, uint32 magicMask) { +void flashrom_init (uint8_t manufacturerID, uint8_t modelID, uint32_t sectorSize, uint32_t magicAddr1, uint32_t magicAddr2, uint32_t magicMask) { flashrom_manufacturerID =manufacturerID; flashrom_modelID =modelID; flashrom_sectorSize =sectorSize; @@ -18,7 +18,7 @@ void flashrom_init (uint8 manufacturerID, uint8 modelID, uint32 sectorSize, uint flashrom_magicMask =magicMask; } -uint8 flashrom_read (uint32 A) { +uint8_t flashrom_read (uint32_t A) { if (flashrom_state ==0x90) /* software ID */ return A &1? flashrom_modelID: flashrom_manufacturerID; else @@ -28,10 +28,10 @@ uint8 flashrom_read (uint32 A) { return CartBR(A); } -void flashrom_write (uint32 fullAddress, uint8 V) { - uint32 i; - uint8* sector =NULL; - uint32 compare =fullAddress &flashrom_magicMask; +void flashrom_write (uint32_t fullAddress, uint8_t V) { + uint32_t i; + uint8_t* sector =NULL; + uint32_t compare =fullAddress &flashrom_magicMask; fullAddress &=PRGsize[0] -1; switch (flashrom_state) { /* command start */ diff --git a/src/boards/flashrom.h b/src/boards/flashrom.h index 6baa19e..f7950ef 100644 --- a/src/boards/flashrom.h +++ b/src/boards/flashrom.h @@ -2,18 +2,18 @@ #define _FLASHROM_H #include "mapinc.h" -extern uint8 flashrom_manufacturerID; -extern uint8 flashrom_modelID; +extern uint8_t flashrom_manufacturerID; +extern uint8_t flashrom_modelID; extern int flashrom_state; -extern uint32 flashrom_sectorSize; +extern uint32_t flashrom_sectorSize; extern int flashrom_timeOut; -extern uint32 flashrom_magicAddr1; -extern uint32 flashrom_magicAddr2; -extern uint32 flashrom_magicMask; +extern uint32_t flashrom_magicAddr1; +extern uint32_t flashrom_magicAddr2; +extern uint32_t flashrom_magicMask; -void flashrom_init (uint8, uint8, uint32, uint32, uint32, uint32); -uint8 flashrom_read (uint32); -void flashrom_write (uint32, uint8); +void flashrom_init (uint8_t, uint8_t, uint32_t, uint32_t, uint32_t, uint32_t); +uint8_t flashrom_read (uint32_t); +void flashrom_write (uint32_t, uint8_t); void FP_FASTAPASS(1) flashrom_cpuCycle(int); #endif diff --git a/src/boards/gn26.c b/src/boards/gn26.c index f5c0ad9..8087845 100644 --- a/src/boards/gn26.c +++ b/src/boards/gn26.c @@ -26,13 +26,13 @@ #include "mapinc.h" #include "mmc3.h" -static void BMCGN26CW(uint32 A, uint8 V) { +static void BMCGN26CW(uint32_t A, uint8_t V) { int chrAND = EXPREGS[0]&0x04? 0xFF: 0x7F; int chrOR = EXPREGS[0] <<7; setchr1(A, V &chrAND | chrOR &~chrAND); } -static void BMCGN26PW(uint32 A, uint8 V) { +static void BMCGN26PW(uint32_t A, uint8_t V) { if (EXPREGS[0] & 4) { if (A == 0x8000) setprg32(0x8000, (EXPREGS[0] << 2) | (V >> 2)); diff --git a/src/boards/h2288.c b/src/boards/h2288.c index 797c976..5c42bd4 100644 --- a/src/boards/h2288.c +++ b/src/boards/h2288.c @@ -21,11 +21,11 @@ #include "mapinc.h" #include "mmc3.h" -extern uint8 m114_perm[8]; +extern uint8_t m114_perm[8]; -static void H2288PW(uint32 A, uint8 V) { +static void H2288PW(uint32_t A, uint8_t V) { if (EXPREGS[0] & 0x40) { - uint8 bank = (EXPREGS[0] & 5) | ((EXPREGS[0] & 8) >> 2) | ((EXPREGS[0] & 0x20) >> 2); + uint8_t bank = (EXPREGS[0] & 5) | ((EXPREGS[0] & 8) >> 2) | ((EXPREGS[0] & 0x20) >> 2); if (EXPREGS[0] & 2) setprg32(0x8000, bank >> 1); else { diff --git a/src/boards/hp10xx_hp20xx.c b/src/boards/hp10xx_hp20xx.c index 496c1e0..e767892 100644 --- a/src/boards/hp10xx_hp20xx.c +++ b/src/boards/hp10xx_hp20xx.c @@ -28,10 +28,10 @@ * the games on the regular FK23C boards couldn't run on this mapper and vice versa... */ -static uint8 unromchr, lock; -static uint32 dipswitch; +static uint8_t unromchr, lock; +static uint32_t dipswitch; -static void BMCHPxxCW(uint32 A, uint8 V) { +static void BMCHPxxCW(uint32_t A, uint8_t V) { if (EXPREGS[0] & 4) { /* custom banking */ switch(EXPREGS[0] & 3) { case 0: @@ -63,7 +63,7 @@ static void BMCHPxxCW(uint32 A, uint8 V) { } /* PRG wrapper */ -static void BMCHPxxPW(uint32 A, uint8 V) { +static void BMCHPxxPW(uint32_t A, uint8_t V) { if(EXPREGS[0] & 4) { /* custom banking */ if((EXPREGS[0] & 0xF) == 4) { /* 16K mode */ /* FCEU_printf("\tPRG16 %02X\n",EXPREGS[1]&0x1F); */ @@ -74,7 +74,7 @@ static void BMCHPxxPW(uint32 A, uint8 V) { setprg32(0x8000, (EXPREGS[1] & 0x1F) >> 1); } } else { /* mmc3 banking */ - uint8 base, mask; + uint8_t base, mask; if(EXPREGS[0] & 2) { /* 128K mode */ base = EXPREGS[1] & 0x18; mask = 0x0F; @@ -89,7 +89,7 @@ static void BMCHPxxPW(uint32 A, uint8 V) { } /* MIRROR wrapper */ -static void BMCHPxxMW(uint8 V) { +static void BMCHPxxMW(uint8_t V) { if(EXPREGS[0] & 4) { /* custom banking */ /* FCEU_printf("CUSTOM MIRR: %d\n",(unromchr>>2)&1); */ setmirror(((unromchr >> 2) & 1) ^ 1); diff --git a/src/boards/hp898f.c b/src/boards/hp898f.c index 5ce27df..7323ffe 100644 --- a/src/boards/hp898f.c +++ b/src/boards/hp898f.c @@ -23,7 +23,7 @@ /* This source code file only applies to Sanchez' original UNIF file with the incorrect bank order. The correctly-specified mapper, used for all NES 2.0 ROM files, is implemented in 319.c. */ -static uint8 regs[2]; +static uint8_t regs[2]; static SFORMAT StateRegs[] = { @@ -32,9 +32,9 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { - uint8 chr = (regs[0] >> 4) & 7; - uint8 prg = (regs[1] >> 3) & 7; - uint8 dec = (regs[1] >> 4) & 4; + uint8_t chr = (regs[0] >> 4) & 7; + uint8_t prg = (regs[1] >> 3) & 7; + uint8_t dec = (regs[1] >> 4) & 4; setchr8(chr & (~(((regs[0] & 1) << 2) | (regs[0] & 2)))); setprg16(0x8000, prg & (~dec)); setprg16(0xC000, prg | dec); diff --git a/src/boards/inx007t.c b/src/boards/inx007t.c index db833d9..cccb803 100644 --- a/src/boards/inx007t.c +++ b/src/boards/inx007t.c @@ -41,7 +41,7 @@ #include "mapinc.h" -static uint8 latch_out, latch_in; +static uint8_t latch_out, latch_in; static void INX_007T_Sync() { setprg32(0x8000, (latch_in & 7) | (latch_out << 3)); diff --git a/src/boards/jyasic.c b/src/boards/jyasic.c index 5ef5f1c..cdeb83f 100644 --- a/src/boards/jyasic.c +++ b/src/boards/jyasic.c @@ -24,30 +24,30 @@ #include "mmc3.h" void (*sync)(void); -static uint8 allowExtendedMirroring; +static uint8_t allowExtendedMirroring; -static uint8 mode[4]; -static uint8* WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t mode[4]; +static uint8_t* WRAM = NULL; +static uint32_t WRAMSIZE; -static uint8 irqControl; -static uint8 irqEnabled; -static uint8 irqPrescaler; -static uint8 irqCounter; -static uint8 irqXor; -static uint32 lastPPUAddress; +static uint8_t irqControl; +static uint8_t irqEnabled; +static uint8_t irqPrescaler; +static uint8_t irqCounter; +static uint8_t irqXor; +static uint32_t lastPPUAddress; -static uint8 prg[4]; -static uint16 chr[8]; -static uint16 nt[4]; -static uint8 latch[2]; -static uint8 mul[2]; -static uint8 adder; -static uint8 test; -static uint8 dipSwitch; -static uint8 submapper; +static uint8_t prg[4]; +static uint16_t chr[8]; +static uint16_t nt[4]; +static uint8_t latch[2]; +static uint8_t mul[2]; +static uint8_t adder; +static uint8_t test; +static uint8_t dipSwitch; +static uint8_t submapper; -static uint8 cpuWriteHandlersSet; +static uint8_t cpuWriteHandlersSet; static writefunc cpuWriteHandlers[0x10000]; /* Actual write handlers for CPU write trapping as a method fo IRQ clocking */ static SFORMAT JYASIC_stateRegs[] = { @@ -71,7 +71,7 @@ static SFORMAT JYASIC_stateRegs[] = { { 0 } }; -static uint8 rev (uint8_t val) +static uint8_t rev (uint8_t val) { return ((val <<6) &0x40) | ((val <<4) &0x20) | ((val <<2) &0x10) | (val &0x08) | ((val >>2) &0x04) | ((val >>4) &0x02) | ((val >>6) &0x01); } @@ -218,7 +218,7 @@ static DECLFW(trapCPUWrite) cpuWriteHandlers[A](A, V); } -static void FP_FASTAPASS(1) trapPPUAddressChange (uint32 A) +static void FP_FASTAPASS(1) trapPPUAddressChange (uint32_t A) { if ((irqControl &0x03) ==0x02 && lastPPUAddress !=A) { @@ -460,7 +460,7 @@ void JYASIC_init (CartInfo *info) if (WRAMSIZE) { - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM); } @@ -691,7 +691,7 @@ void Mapper421_Init(CartInfo *info) } /* Mapper 394: HSK007 circuit board that can simulate J.Y. ASIC, MMC3, and NROM. */ -static uint8 HSK007Reg[4]; +static uint8_t HSK007Reg[4]; void sync394 (void) /* Called when J.Y. ASIC is active */ { int prgOR =HSK007Reg[3] <<1 &0x010 | HSK007Reg[1] <<5 &0x060; @@ -700,7 +700,7 @@ void sync394 (void) /* Called when J.Y. ASIC is active */ syncCHR(0xFF, chrOR); syncNT (0xFF, chrOR); } -static void Mapper394_PWrap(uint32 A, uint8 V) +static void Mapper394_PWrap(uint32_t A, uint8_t V) { int prgAND =HSK007Reg[3] &0x10? 0x1F: 0x0F; int prgOR =HSK007Reg[3] <<1 &0x010 | HSK007Reg[1] <<5 &0x060; @@ -711,7 +711,7 @@ static void Mapper394_PWrap(uint32 A, uint8 V) setprg32(A, (prgOR | HSK007Reg[3] <<1 &0x0F) >>2); } -static void Mapper394_CWrap(uint32 A, uint8 V) +static void Mapper394_CWrap(uint32_t A, uint8_t V) { int chrAND =HSK007Reg[3] &0x80? 0xFF: 0x7F; int chrOR =submapper ==1? (HSK007Reg[3] <<1 &0x080 | HSK007Reg[1] <<8 &0x200 | HSK007Reg[1] <<6 &0x100): (HSK007Reg[3] <<1 &0x080 | HSK007Reg[1] <<8 &0x300); @@ -719,7 +719,7 @@ static void Mapper394_CWrap(uint32 A, uint8 V) } static DECLFW(Mapper394_Write) { - uint8 oldMode =HSK007Reg[1]; + uint8_t oldMode =HSK007Reg[1]; A &=3; HSK007Reg[A] =V; if (A ==1) diff --git a/src/boards/karaoke.c b/src/boards/karaoke.c index 81d9dbc..7078e9f 100644 --- a/src/boards/karaoke.c +++ b/src/boards/karaoke.c @@ -20,8 +20,8 @@ #include "mapinc.h" -extern uint32 ROM_size; -static uint8 latche; +extern uint32_t ROM_size; +static uint8_t latche; static void Sync(void) { if (latche) { diff --git a/src/boards/latch.c b/src/boards/latch.c index 0db1ca4..9e20064 100644 --- a/src/boards/latch.c +++ b/src/boards/latch.c @@ -21,9 +21,9 @@ #include "mapinc.h" #include "latch.h" -static uint8 bus_conflict; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t bus_conflict; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static void (*WSync)(void); static readfunc defread; @@ -72,7 +72,7 @@ static void StateRestore(int version) { } void Latch_Init(CartInfo *info, void (*proc)(void), readfunc func, - uint8 wram, uint8 busc) { + uint8_t wram, uint8_t busc) { bus_conflict = busc; WSync = proc; if (func != NULL) @@ -85,7 +85,7 @@ void Latch_Init(CartInfo *info, void (*proc)(void), readfunc func, GameStateRestore = StateRestore; if (wram) { WRAMSIZE = 8192; - WRAM = (uint8 *)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t *)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); if (info->battery) { info->SaveGame[0] = WRAM; diff --git a/src/boards/latch.h b/src/boards/latch.h index 2eeebd6..afaa557 100644 --- a/src/boards/latch.h +++ b/src/boards/latch.h @@ -2,16 +2,16 @@ #define _FCEU_LATCH_H typedef struct { - uint16 addr; - uint8 data; + uint16_t addr; + uint8_t data; } LATCH; extern LATCH latch; -void Latch_Init(CartInfo *info, void (*proc)(void), readfunc func, uint8 wram, uint8 busc); +void Latch_Init(CartInfo *info, void (*proc)(void), readfunc func, uint8_t wram, uint8_t busc); void LatchPower(void); void LatchClose(void); -void LatchWrite(uint32 A, uint8 V); +void LatchWrite(uint32_t A, uint8_t V); void LatchHardReset(); #endif /* _FCEU_LATCH_H */ diff --git a/src/boards/le05.c b/src/boards/le05.c index cd2000e..c15bd00 100644 --- a/src/boards/le05.c +++ b/src/boards/le05.c @@ -23,7 +23,7 @@ #include "mapinc.h" -static uint8 chr; +static uint8_t chr; static SFORMAT StateRegs[] = { { &chr, 1, "CHR" }, diff --git a/src/boards/lh32.c b/src/boards/lh32.c index b0635a9..2a77994 100644 --- a/src/boards/lh32.c +++ b/src/boards/lh32.c @@ -24,9 +24,9 @@ #include "mapinc.h" #include "../fds_apu.h" -static uint8 reg; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t reg; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -72,7 +72,7 @@ void LH32_Init(CartInfo *info) { info->Close = LH32Close; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); diff --git a/src/boards/lh51.c b/src/boards/lh51.c index 4a559bb..acef720 100644 --- a/src/boards/lh51.c +++ b/src/boards/lh51.c @@ -28,9 +28,9 @@ #include "mapinc.h" #include "../fds_apu.h" -static uint8 reg, mirr; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t reg, mirr; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -81,7 +81,7 @@ void LH51_Init(CartInfo *info) { GameStateRestore = StateRestore; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); diff --git a/src/boards/lh53.c b/src/boards/lh53.c index 6dc42bb..0dede6c 100644 --- a/src/boards/lh53.c +++ b/src/boards/lh53.c @@ -24,10 +24,10 @@ #include "mapinc.h" #include "../fds_apu.h" -static uint8 reg, IRQa; -static int32 IRQCount; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t reg, IRQa; +static int32_t IRQCount; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -102,7 +102,7 @@ void LH53_Init(CartInfo *info) { GameStateRestore = StateRestore; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); diff --git a/src/boards/malee.c b/src/boards/malee.c index a4a0721..10eabe7 100644 --- a/src/boards/malee.c +++ b/src/boards/malee.c @@ -23,7 +23,7 @@ #include "mapinc.h" -static uint8 WRAM[2048]; +static uint8_t WRAM[2048]; static void MALEEPower(void) { setprg2r(0x10, 0x7000, 0); diff --git a/src/boards/mihunche.c b/src/boards/mihunche.c index 9f378c9..93dd0a1 100644 --- a/src/boards/mihunche.c +++ b/src/boards/mihunche.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint16 latche; +static uint16_t latche; static SFORMAT StateRegs[] = { diff --git a/src/boards/mmc1.c b/src/boards/mmc1.c index 310c4a3..b3cc327 100644 --- a/src/boards/mmc1.c +++ b/src/boards/mmc1.c @@ -24,35 +24,35 @@ static void GenMMC1Power(void); static void GenMMC1Init(CartInfo *info, int prg, int chr, int wram, int saveram); -static uint8 submapper; -static uint8 DRegs[4]; -static uint8 Buffer, BufferShift; +static uint8_t submapper; +static uint8_t DRegs[4]; +static uint8_t Buffer, BufferShift; -static uint32 WRAMSIZE = 0; +static uint32_t WRAMSIZE = 0; /* size of non-battery-backed portion of WRAM */ /* serves as starting offset for actual save ram from total wram size */ /* returns 0 if entire work ram is battery backed ram */ -static uint32 NONSaveRAMSIZE = 0; +static uint32_t NONSaveRAMSIZE = 0; -static void (*MMC1CHRHook4)(uint32 A, uint8 V); -static void (*MMC1PRGHook16)(uint32 A, uint8 V); +static void (*MMC1CHRHook4)(uint32_t A, uint8_t V); +static void (*MMC1PRGHook16)(uint32_t A, uint8_t V); /* Used to override default wram behavior */ /* NULL uses default MMC1 wram. Set after GenMMC1Init() is called to override */ static void (*MMC1WRAMHook8)(void); -static uint8 *WRAM = NULL; -static uint8 *CHRRAM = NULL; +static uint8_t *WRAM = NULL; +static uint8_t *CHRRAM = NULL; static int is155; -static uint32 MMC1GetCHRBank (uint32 bank) { +static uint32_t MMC1GetCHRBank (uint32_t bank) { if (DRegs[0] & 0x10) /* 4 KiB mode */ return (DRegs[1 + bank]); else /* 8 KiB mode */ return ((DRegs[1] & ~1) | bank); } -static uint8 MMC1WRAMEnabled(void) { +static uint8_t MMC1WRAMEnabled(void) { return !(DRegs[3] & 0x10); } @@ -100,7 +100,7 @@ static void MMC1CHR(void) { } static void MMC1PRG(void) { - uint8 offs = DRegs[1] & 0x10; + uint8_t offs = DRegs[1] & 0x10; if (MMC1PRGHook16) { switch (DRegs[0] & 0xC) { case 0xC: @@ -146,7 +146,7 @@ static void MMC1MIRROR(void) { } } -static uint64 lreset; +static uint64_t lreset; static DECLFW(MMC1_write) { int n = (A >> 13) - 4; @@ -233,9 +233,9 @@ static int DetectMMC1WRAMSize(CartInfo *info, int *saveRAM) { return workRAM; } -static uint32 NWCIRQCount; -static uint8 NWCRec; -static uint32 nwcdip = 0x4; +static uint32_t NWCIRQCount; +static uint8_t NWCRec; +static uint32_t nwcdip = 0x4; static void NWCIRQHook(int a) { if (!(NWCRec & 0x10)) { @@ -247,7 +247,7 @@ static void NWCIRQHook(int a) { } } -static void NWCCHRHook(uint32 A, uint8 V) { +static void NWCCHRHook(uint32_t A, uint8_t V) { if ((V & 0x10)) { /* && !(NWCRec&0x10)) */ NWCIRQCount = 0; X6502_IRQEnd(FCEU_IQEXT); @@ -260,7 +260,7 @@ static void NWCCHRHook(uint32 A, uint8 V) { setprg32(0x8000, (V >> 1) & 3); } -static void NWCPRGHook(uint32 A, uint8 V) { +static void NWCPRGHook(uint32_t A, uint8_t V) { if (NWCRec & 0x8) setprg16(A, 8 | (V & 0x7)); else @@ -270,11 +270,11 @@ static void NWCPRGHook(uint32 A, uint8 V) { static void NWCPower(void) { GenMMC1Power(); setchr8r(0, 0); - nwcdip = 0x20000000 | ((uint32)GameInfo->cspecial << 25); + nwcdip = 0x20000000 | ((uint32_t)GameInfo->cspecial << 25); } static void NWCReset(void) { - nwcdip = 0x20000000 | ((uint32)GameInfo->cspecial << 25); + nwcdip = 0x20000000 | ((uint32_t)GameInfo->cspecial << 25); MMC1CMReset(); } @@ -331,7 +331,7 @@ static void GenMMC1Init(CartInfo *info, int prg, int chr, int wram, int saveram) CHRmask8[0] &= (chr >> 13) - 1; if (WRAMSIZE) { - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); if (saveram) { @@ -340,7 +340,7 @@ static void GenMMC1Init(CartInfo *info, int prg, int chr, int wram, int saveram) } } if (!chr) { - CHRRAM = (uint8*)FCEU_gmalloc(8192); + CHRRAM = (uint8_t*)FCEU_gmalloc(8192); SetupCartCHRMapping(0, CHRRAM, 8192, 1); AddExState(CHRRAM, 8192, 0, "CHRR"); } @@ -429,13 +429,13 @@ void SOROM_Init(CartInfo *info) { /* NES 2.0 Mapper 323 - UNIF FARID_SLROM_8-IN-1 */ -static uint8 reg, lock; +static uint8_t reg, lock; -static void FARIDSLROM8IN1PRGHook(uint32 A, uint8 V) { +static void FARIDSLROM8IN1PRGHook(uint32_t A, uint8_t V) { setprg16(A, (V & 0x07) | (reg << 3)); } -static void FARIDSLROM8IN1CHRHook(uint32 A, uint8 V) { +static void FARIDSLROM8IN1CHRHook(uint32_t A, uint8_t V) { setchr4(A, (V & 0x1F) | (reg << 5)); } @@ -474,12 +474,12 @@ void FARIDSLROM8IN1_Init(CartInfo *info) { /* 1995 Super HiK 4-in-1 - 新系列機器戰警组合卡 (JY-022) * 1996 Super HiK 4-in-1 - 新系列超級飛狼組合卡 (JY-051) */ -static uint8 game = 0; -static void M374PRG(uint32 A, uint8 V) { +static uint8_t game = 0; +static void M374PRG(uint32_t A, uint8_t V) { setprg16(A, (V & 0x07) | (game << 3)); } -static void M374CHR(uint32 A, uint8 V) { +static void M374CHR(uint32_t A, uint8_t V) { setchr4(A, (V & 0x1F) | (game << 5)); } @@ -499,14 +499,14 @@ void Mapper374_Init(CartInfo *info) { /* ---------------------------- Mapper 297 -------------------------------- */ /* NES 2.0 Mapper 297 - 2-in-1 Uzi Lightgun (MGC-002) */ -static uint8 mode; -static uint8 latch; +static uint8_t mode; +static uint8_t latch; -static void M297PRG(uint32 A, uint8 V) { +static void M297PRG(uint32_t A, uint8_t V) { setprg16(A, (V & 0x07) | ((mode & 1) << 3)); } -static void M297CHR(uint32 A, uint8 V) { +static void M297CHR(uint32_t A, uint8_t V) { setchr4(A, (V & 0x1F) | ((mode & 1) << 5)); } @@ -572,16 +572,16 @@ static uint8_t outerBank; static uint8_t bits; static uint8_t shift; -static void M543PRG16(uint32 A, uint8 V) { +static void M543PRG16(uint32_t A, uint8_t V) { setprg16(A, (V & 0x0F) | (outerBank << 4)); } -static void M543CHR4(uint32 A, uint8 V) { +static void M543CHR4(uint32_t A, uint8_t V) { setchr4(A, (V & 7)); } static void M543WRAM8(void) { - uint32 wramBank; + uint32_t wramBank; if (outerBank & 2) wramBank = 4 | ((outerBank >> 1) & 2) | (outerBank & 1) ; else @@ -636,14 +636,14 @@ void Mapper543_Init(CartInfo *info) { static uint8_t latch; static uint8_t outerBank; -static void M550PRG16(uint32 A, uint8 V) { +static void M550PRG16(uint32_t A, uint8_t V) { if ((outerBank & 6) == 6) setprg16(A, (V & 7) | (outerBank << 2)); else setprg32(0x8000, (latch >> 4) | (outerBank << 1)); } -static void M550CHR4(uint32 A, uint8 V) { +static void M550CHR4(uint32_t A, uint8_t V) { if ((outerBank & 6) == 6) setchr4(A, (V & 7) | ((outerBank << 2) & 0x18)); else @@ -697,12 +697,12 @@ void Mapper550_Init(CartInfo *info) { static uint8_t outerBank; -static void M404PRG16(uint32 A, uint8 V) { - uint8 mask = outerBank & 0x40 ? 0x07 : 0x0F; +static void M404PRG16(uint32_t A, uint8_t V) { + uint8_t mask = outerBank & 0x40 ? 0x07 : 0x0F; setprg16(A, (V & mask) | (outerBank << 3) & ~mask); } -static void M404CHR4(uint32 A, uint8 V) { +static void M404CHR4(uint32_t A, uint8_t V) { setchr4(A, (V & 0x1F) | outerBank << 5); } diff --git a/src/boards/mmc2and4.c b/src/boards/mmc2and4.c index d3e7b88..191b61f 100644 --- a/src/boards/mmc2and4.c +++ b/src/boards/mmc2and4.c @@ -22,10 +22,10 @@ #include "mapinc.h" -static uint8 is10, isPC10; -static uint8 creg[4], latch0, latch1, preg, mirr; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t is10, isPC10; +static uint8_t creg[4], latch0, latch1, preg, mirr; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -65,8 +65,8 @@ DECLFW(MMC2and4Write) { } } -static void FP_FASTAPASS(1) MMC2and4PPUHook(uint32 A) { - uint8 l, h = A >> 8; +static void FP_FASTAPASS(1) MMC2and4PPUHook(uint32_t A) { + uint8_t l, h = A >> 8; if (h >= 0x20 || ((h & 0xF) != 0xF)) return; l = A & 0xF0; @@ -126,7 +126,7 @@ void Mapper9_Init(CartInfo *info) { if (info->battery) { /* Mike Tyson's Punch-Out!! (PC10) supports save ram */ isPC10 = 1; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); if (info->battery) { @@ -145,7 +145,7 @@ void Mapper10_Init(CartInfo *info) { info->Close = MMC2and4Close; PPU_hook = MMC2and4PPUHook; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); if (info->battery) { diff --git a/src/boards/mmc3.c b/src/boards/mmc3.c index baeded3..610565f 100644 --- a/src/boards/mmc3.c +++ b/src/boards/mmc3.c @@ -27,19 +27,19 @@ #include "mapinc.h" #include "mmc3.h" -uint8 MMC3_cmd; -static uint8 *WRAM; -static uint32 WRAMSIZE; -static uint8 *CHRRAM; -static uint32 CHRRAMSIZE; -uint8 DRegBuf[8]; -uint8 EXPREGS[8]; /* For bootleg games, mostly. */ -uint8 A000B, A001B; -uint8 mmc3opts = 0; +uint8_t MMC3_cmd; +static uint8_t *WRAM; +static uint32_t WRAMSIZE; +static uint8_t *CHRRAM; +static uint32_t CHRRAMSIZE; +uint8_t DRegBuf[8]; +uint8_t EXPREGS[8]; /* For bootleg games, mostly. */ +uint8_t A000B, A001B; +uint8_t mmc3opts = 0; -static uint8 IRQCount, IRQLatch, IRQa; -static uint8 IRQReload; -static uint8 submapper; +static uint8_t IRQCount, IRQLatch, IRQa; +static uint8_t IRQReload; +static uint8_t submapper; static SFORMAT MMC3_StateRegs[] = { @@ -56,9 +56,9 @@ static SFORMAT MMC3_StateRegs[] = static int isRevB = 1; -void (*pwrap)(uint32 A, uint8 V); -void (*cwrap)(uint32 A, uint8 V); -void (*mwrap)(uint8 V); +void (*pwrap)(uint32_t A, uint8_t V); +void (*cwrap)(uint32_t A, uint8_t V); +void (*mwrap)(uint8_t V); void GenMMC3Power(void); void FixMMC3PRG(int V); @@ -229,23 +229,23 @@ void GenMMC3Restore(int version) { FixMMC3CHR(MMC3_cmd); } -static void GENCWRAP(uint32 A, uint8 V) { +static void GENCWRAP(uint32_t A, uint8_t V) { setchr1(A, V); /* Business Wars NEEDS THIS for 8K CHR-RAM */ } -static void GENPWRAP(uint32 A, uint8 V) { +static void GENPWRAP(uint32_t A, uint8_t V) { /* [NJ102] Mo Dao Jie (C) has 1024Mb MMC3 BOARD, maybe something other will be broken * also HengGe BBC-2x boards enables this mode as default board mode at boot up */ setprg8(A, (V & 0x7F)); } -static void GENMWRAP(uint8 V) { +static void GENMWRAP(uint8_t V) { A000B = V; setmirror((V & 1) ^ 1); } -static void GENNOMWRAP(uint8 V) { +static void GENNOMWRAP(uint8_t V) { A000B = V; } @@ -306,7 +306,7 @@ void GenMMC3_Init(CartInfo *info, int prg, int chr, int wram, int battery) { if (wram) { mmc3opts |= 1; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); } @@ -366,7 +366,7 @@ void Mapper4_Init(CartInfo *info) { /* ---------------------------- Mapper 12 ------------------------------- */ -static void M12CW(uint32 A, uint8 V) { +static void M12CW(uint32_t A, uint8_t V) { setchr1(A, (EXPREGS[(A & 0x1000) >> 12] << 8) + V); } @@ -409,7 +409,7 @@ void Mapper12_Init(CartInfo *info) { /* ---------------------------- Mapper 37 ------------------------------- */ -static void M37PW(uint32 A, uint8 V) { +static void M37PW(uint32_t A, uint8_t V) { if (EXPREGS[0] != 2) V &= 0x7; else @@ -418,8 +418,8 @@ static void M37PW(uint32 A, uint8 V) { setprg8(A, V); } -static void M37CW(uint32 A, uint8 V) { - uint32 NV = V; +static void M37CW(uint32_t A, uint8_t V) { + uint32_t NV = V; NV &= 0x7F; NV |= EXPREGS[0] << 6; setchr1(A, NV); @@ -453,16 +453,16 @@ void Mapper37_Init(CartInfo *info) { /* ---------------------------- Mapper 44 ------------------------------- */ -static void M44PW(uint32 A, uint8 V) { - uint32 NV = V; +static void M44PW(uint32_t A, uint8_t V) { + uint32_t NV = V; if (EXPREGS[0] >= 6) NV &= 0x1F; else NV &= 0x0F; NV |= EXPREGS[0] << 4; setprg8(A, NV); } -static void M44CW(uint32 A, uint8 V) { - uint32 NV = V; +static void M44CW(uint32_t A, uint8_t V) { + uint32_t NV = V; if (EXPREGS[0] < 6) NV &= 0x7F; NV |= EXPREGS[0] << 7; setchr1(A, NV); @@ -502,7 +502,7 @@ void Mapper44_Init(CartInfo *info) { /* ---------------------------- Mapper 45 ------------------------------- */ -static void M45CW(uint32 A, uint8 V) { +static void M45CW(uint32_t A, uint8_t V) { if (CHRsize[0] ==8192) setchr1(A, V); else { @@ -516,7 +516,7 @@ static DECLFR(M45ReadOB) { return X.DB; } -static void M45PW(uint32 A, uint8 V) { +static void M45PW(uint32_t A, uint8_t V) { int prgAND =~EXPREGS[3] &0x3F; int prgOR =EXPREGS[1] | EXPREGS[2] <<2 &0x300; setprg8(A, V &prgAND | prgOR &~prgAND); @@ -532,7 +532,7 @@ static void M45PW(uint32 A, uint8 V) { SetReadHandler(0x8000, 0xFFFF, CartBR); } -static void M373PW(uint32 A, uint8 V) { +static void M373PW(uint32_t A, uint8_t V) { int prgAND =~EXPREGS[3] &0x3F; int prgOR =EXPREGS[1] | EXPREGS[2] <<2 &0x300; if (EXPREGS[2] &0x20) { @@ -556,7 +556,7 @@ static DECLFW(M45Write) { } static DECLFR(M45Read) { - uint32 addr = 1 << (EXPREGS[5] + 4); + uint32_t addr = 1 << (EXPREGS[5] + 4); if (A & (addr | (addr - 1))) return X.DB | 1; else @@ -599,14 +599,14 @@ void Mapper373_Init(CartInfo *info) { /* ---------------------------- Mapper 47 ------------------------------- */ -static void M47PW(uint32 A, uint8 V) { +static void M47PW(uint32_t A, uint8_t V) { V &= 0xF; V |= EXPREGS[0] << 4; setprg8(A, V); } -static void M47CW(uint32 A, uint8 V) { - uint32 NV = V; +static void M47CW(uint32_t A, uint8_t V) { + uint32_t NV = V; NV &= 0x7F; NV |= EXPREGS[0] << 7; setchr1(A, NV); @@ -650,7 +650,7 @@ void Mapper47_Init(CartInfo *info) { * BMC-STREETFIGTER-GAME4IN1 - Sic. $6000 set to $41 rather than $00 on power-up. */ -static void M49PW(uint32 A, uint8 V) { +static void M49PW(uint32_t A, uint8_t V) { if (EXPREGS[0] & 1) { V &= 0xF; V |= (EXPREGS[0] & 0xC0) >> 2; @@ -659,8 +659,8 @@ static void M49PW(uint32 A, uint8 V) { setprg32(0x8000, (EXPREGS[0] >> 4) & 15); } -static void M49CW(uint32 A, uint8 V) { - uint32 NV = V; +static void M49CW(uint32_t A, uint8_t V) { + uint32_t NV = V; NV &= 0x7F; NV |= (EXPREGS[0] & 0xC0) << 1; setchr1(A, NV); @@ -707,24 +707,24 @@ void BMCSFGAME4IN1_Init(CartInfo *info) { } /* ---------------------------- Mapper 52 ------------------------------- */ -static void M52PW(uint32 A, uint8 V) { - uint32 mask = 0x1F ^ ((EXPREGS[0] & 8) << 1); - uint32 bank = ((EXPREGS[0] & 6) | ((EXPREGS[0] >> 3) & EXPREGS[0] & 1)) << 4; +static void M52PW(uint32_t A, uint8_t V) { + uint32_t mask = 0x1F ^ ((EXPREGS[0] & 8) << 1); + uint32_t bank = ((EXPREGS[0] & 6) | ((EXPREGS[0] >> 3) & EXPREGS[0] & 1)) << 4; setprg8(A, bank | (V & mask)); } -static void M52CW(uint32 A, uint8 V) { - uint32 mask = 0xFF ^ ((EXPREGS[0] & 0x40) << 1); - uint32 bank = (((EXPREGS[0] >> 4) & 2) | (EXPREGS[0] & 4) | ((EXPREGS[0] >> 6) & (EXPREGS[0] >> 4) & 1)) << 7; /* actually 256K CHR banks index bits is inverted! */ +static void M52CW(uint32_t A, uint8_t V) { + uint32_t mask = 0xFF ^ ((EXPREGS[0] & 0x40) << 1); + uint32_t bank = (((EXPREGS[0] >> 4) & 2) | (EXPREGS[0] & 4) | ((EXPREGS[0] >> 6) & (EXPREGS[0] >> 4) & 1)) << 7; /* actually 256K CHR banks index bits is inverted! */ if (CHRRAM && (EXPREGS[0] &3) ==3) setchr1r(0x10, A, bank | (V & mask)); else setchr1(A, bank | (V & mask)); } -static void M52S14CW(uint32 A, uint8 V) { - uint32 mask = 0xFF ^ ((EXPREGS[0] & 0x40) << 1); - uint32 bank = EXPREGS[0] <<3 &0x80 | EXPREGS[0] <<7 &0x300; +static void M52S14CW(uint32_t A, uint8_t V) { + uint32_t mask = 0xFF ^ ((EXPREGS[0] & 0x40) << 1); + uint32_t bank = EXPREGS[0] <<3 &0x80 | EXPREGS[0] <<7 &0x300; if (CHRRAM && EXPREGS[0] &0x20) setchr1r(0x10, A, bank | (V & mask)); else @@ -763,7 +763,7 @@ void Mapper52_Init(CartInfo *info) { AddExState(EXPREGS, 2, 0, "EXPR"); if (info->iNES2 && info->CHRRomSize && info->CHRRamSize) { CHRRAMSIZE = 8192; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM = (uint8_t*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR"); } @@ -771,7 +771,7 @@ void Mapper52_Init(CartInfo *info) { /* ---------------------------- Mapper 76 ------------------------------- */ -static void M76CW(uint32 A, uint8 V) { +static void M76CW(uint32_t A, uint8_t V) { if (A >= 0x1000) setchr2((A & 0xC00) << 1, V); } @@ -783,7 +783,7 @@ void Mapper76_Init(CartInfo *info) { /* ---------------------------- Mapper 74 ------------------------------- */ -static void M74CW(uint32 A, uint8 V) { +static void M74CW(uint32_t A, uint8_t V) { if ((V == 8) || (V == 9)) /* Di 4 Ci - Ji Qi Ren Dai Zhan (As).nes, Ji Jia Zhan Shi (As).nes */ setchr1r(0x10, A, V); else @@ -794,18 +794,18 @@ void Mapper74_Init(CartInfo *info) { GenMMC3_Init(info, 512, 256, 8, info->battery); cwrap = M74CW; CHRRAMSIZE = 2048; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM = (uint8_t*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR"); } /* ---------------------------- Mapper 114 ------------------------------ */ -static uint8 cmdin, type_Boogerman = 0; -uint8 boogerman_perm[8] = { 0, 2, 5, 3, 6, 1, 7, 4 }; -uint8 m114_perm[8] = { 0, 3, 1, 5, 6, 7, 2, 4 }; +static uint8_t cmdin, type_Boogerman = 0; +uint8_t boogerman_perm[8] = { 0, 2, 5, 3, 6, 1, 7, 4 }; +uint8_t m114_perm[8] = { 0, 3, 1, 5, 6, 7, 2, 4 }; -static void M114PWRAP(uint32 A, uint8 V) { +static void M114PWRAP(uint32_t A, uint8_t V) { if (EXPREGS[0] & 0x80) { if (EXPREGS[0] & 0x20) setprg32(0x8000, (EXPREGS[0] & 0x0F) >> 1); @@ -817,8 +817,8 @@ static void M114PWRAP(uint32 A, uint8 V) { setprg8(A, V); } -static void M114CWRAP(uint32 A, uint8 V) { - setchr1(A, (uint32)V | ((EXPREGS[1] & 1) << 8)); +static void M114CWRAP(uint32_t A, uint8_t V) { + setchr1(A, (uint32_t)V | ((EXPREGS[1] & 1) << 8)); } static DECLFW(M114Write) { @@ -885,7 +885,7 @@ void Mapper114_Init(CartInfo *info) { /* ---------------------------- Mapper 115 KN-658 board ------------------------------ */ -static void M115PW(uint32 A, uint8 V) { +static void M115PW(uint32_t A, uint8_t V) { int prgOR =EXPREGS[0] &0xF | EXPREGS[0] >>2 &0x10; if (EXPREGS[0] & 0x80) { if (EXPREGS[0] & 0x20) @@ -898,7 +898,7 @@ static void M115PW(uint32 A, uint8 V) { setprg8(A, V &0x1F | prgOR <<1 &~0x1F); } -static void M115CW(uint32 A, uint8 V) { +static void M115CW(uint32_t A, uint8_t V) { setchr1(A, V | EXPREGS[1] <<8); } @@ -934,17 +934,17 @@ void Mapper115_Init(CartInfo *info) { /* ---------------------------- Mapper 118 ------------------------------ */ -static uint8 PPUCHRBus; -static uint8 TKSMIR[8]; +static uint8_t PPUCHRBus; +static uint8_t TKSMIR[8]; -static void FP_FASTAPASS(1) TKSPPU(uint32 A) { +static void FP_FASTAPASS(1) TKSPPU(uint32_t A) { A &= 0x1FFF; A >>= 10; PPUCHRBus = A; setmirror(MI_0 + TKSMIR[A]); } -static void TKSWRAP(uint32 A, uint8 V) { +static void TKSWRAP(uint32_t A, uint8_t V) { TKSMIR[A >> 10] = V >> 7; setchr1(A, V & 0x7F); if (PPUCHRBus == (A >> 10)) @@ -953,7 +953,7 @@ static void TKSWRAP(uint32 A, uint8 V) { /* ---------------------------- Mapper 119 ------------------------------ */ -static void TQWRAP(uint32 A, uint8 V) { +static void TQWRAP(uint32_t A, uint8_t V) { setchr1r((V & 0x40) >> 2, A, V & 0x3F); } @@ -961,14 +961,14 @@ void Mapper119_Init(CartInfo *info) { GenMMC3_Init(info, 512, 64, 0, 0); cwrap = TQWRAP; CHRRAMSIZE = 8192; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM = (uint8_t*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR"); } /* ---------------------------- Mapper 165 ------------------------------ */ -static void M165CW(uint32 A, uint8 V) { +static void M165CW(uint32_t A, uint8_t V) { if (V == 0) setchr4r(0x10, A, 0); else @@ -989,14 +989,14 @@ static void M165PPUFE(void) { } } -static void M165CWM(uint32 A, uint8 V) { +static void M165CWM(uint32_t A, uint8_t V) { if (((MMC3_cmd & 0x7) == 0) || ((MMC3_cmd & 0x7) == 2)) M165PPUFD(); if (((MMC3_cmd & 0x7) == 1) || ((MMC3_cmd & 0x7) == 4)) M165PPUFE(); } -static void FP_FASTAPASS(1) M165PPU(uint32 A) { +static void FP_FASTAPASS(1) M165PPU(uint32_t A) { if ((A & 0x1FF0) == 0x1FD0) { EXPREGS[0] = 0xFD; M165PPUFD(); @@ -1017,7 +1017,7 @@ void Mapper165_Init(CartInfo *info) { PPU_hook = M165PPU; info->Power = M165Power; CHRRAMSIZE = 4096; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM = (uint8_t*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR"); AddExState(EXPREGS, 4, 0, "EXPR"); @@ -1025,7 +1025,7 @@ void Mapper165_Init(CartInfo *info) { /* ---------------------------- Mapper 192 ------------------------------- */ -static void M192CW(uint32 A, uint8 V) { +static void M192CW(uint32_t A, uint8_t V) { /* Ying Lie Qun Xia Zhuan (Chinese), * You Ling Xing Dong (China) (Unl) [this will be mistakenly headered as m074 sometimes] */ @@ -1039,14 +1039,14 @@ void Mapper192_Init(CartInfo *info) { GenMMC3_Init(info, 512, 256, 8, info->battery); cwrap = M192CW; CHRRAMSIZE = 4096; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM = (uint8_t*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR"); } /* ---------------------------- Mapper 194 ------------------------------- */ -static void M194CW(uint32 A, uint8 V) { +static void M194CW(uint32_t A, uint8_t V) { if (V <= 1) /* Dai-2-Ji - Super Robot Taisen (As).nes */ setchr1r(0x10, A, V); else @@ -1057,7 +1057,7 @@ void Mapper194_Init(CartInfo *info) { GenMMC3_Init(info, 512, 256, 8, info->battery); cwrap = M194CW; CHRRAMSIZE = 2048; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM = (uint8_t*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR"); } @@ -1069,7 +1069,7 @@ void Mapper194_Init(CartInfo *info) { * game */ -static void M196PW(uint32 A, uint8 V) { +static void M196PW(uint32_t A, uint8_t V) { if (EXPREGS[0]) setprg32(0x8000, EXPREGS[1]); else @@ -1109,11 +1109,11 @@ void Mapper196_Init(CartInfo *info) { * all data bits merged, because it's using one of them as 8000 reg... */ -static void UNLMaliSBPW(uint32 A, uint8 V) { +static void UNLMaliSBPW(uint32_t A, uint8_t V) { setprg8(A, (V & 3) | ((V & 8) >> 1) | ((V & 4) << 1)); } -static void UNLMaliSBCW(uint32 A, uint8 V) { +static void UNLMaliSBCW(uint32_t A, uint8_t V) { setchr1(A, (V & 0xDD) | ((V & 0x20) >> 4) | ((V & 2) << 4)); } @@ -1141,7 +1141,7 @@ void UNLMaliSB_Init(CartInfo *info) { /* ---------------------------- Mapper 197 ------------------------------- */ -static void M197S0CW(uint32 A, uint8 V) { +static void M197S0CW(uint32_t A, uint8_t V) { switch(A) { case 0x0000: setchr2(0x0000, V); break; case 0x0400: setchr2(0x0800, V); break; @@ -1150,7 +1150,7 @@ static void M197S0CW(uint32 A, uint8 V) { } } -static void M197S1CW(uint32 A, uint8 V) { +static void M197S1CW(uint32_t A, uint8_t V) { switch(A) { case 0x0800: setchr2(0x0000, V); break; case 0x0C00: setchr2(0x0800, V); break; @@ -1159,7 +1159,7 @@ static void M197S1CW(uint32 A, uint8 V) { } } -static void M197S2CW(uint32 A, uint8 V) { +static void M197S2CW(uint32_t A, uint8_t V) { switch(A) { case 0x0000: setchr2(0x0000, V); break; case 0x0C00: setchr2(0x0800, V); break; @@ -1168,7 +1168,7 @@ static void M197S2CW(uint32 A, uint8 V) { } } -static void M197S3CW(uint32 A, uint8 V) { +static void M197S3CW(uint32_t A, uint8_t V) { switch(A) { case 0x0000: setchr2(0x0000, V | EXPREGS[0] <<7 &0x100); break; case 0x0400: setchr2(0x0800, V | EXPREGS[0] <<7 &0x100); break; @@ -1177,7 +1177,7 @@ static void M197S3CW(uint32 A, uint8 V) { } } -static void M197S3PW(uint32 A, uint8 V) { +static void M197S3PW(uint32_t A, uint8_t V) { setprg8(A, V &(EXPREGS[0] &8? 0x0F: 0x1F) | EXPREGS[0] <<4); } @@ -1225,7 +1225,7 @@ static void M198Power(void) { SetReadHandler(0x5000, 0x5fff, CartBR); } -static void M198PW(uint32 A, uint8 V) { +static void M198PW(uint32_t A, uint8_t V) { if (V >= 0x50) /* Tenchi o Kurau II - Shokatsu Koumei Den (J) (C).nes */ setprg8(A, V & 0x4F); else @@ -1242,13 +1242,13 @@ void Mapper198_Init(CartInfo *info) { /* UNIF boardname BMC-JC-016-2 https://wiki.nesdev.com/w/index.php/INES_Mapper_205 */ -static void M205_367PW(uint32 A, uint8 V) { - uint8 bank = V & ((EXPREGS[0] & 0x02) ? 0x0F : 0x1F); +static void M205_367PW(uint32_t A, uint8_t V) { + uint8_t bank = V & ((EXPREGS[0] & 0x02) ? 0x0F : 0x1F); setprg8(A, EXPREGS[0] << 4 | bank); } -static void M205_367CW(uint32 A, uint8 V) { - uint8 bank = V & ((EXPREGS[0] & 0x02) ? 0x7F : 0xFF); +static void M205_367CW(uint32_t A, uint8_t V) { + uint8_t bank = V & ((EXPREGS[0] & 0x02) ? 0x7F : 0xFF); setchr1(A, (EXPREGS[0] << 7) | bank); } @@ -1302,12 +1302,12 @@ void Mapper367_Init(CartInfo *info) { /* --------------------------- GN-45 BOARD ------------------------------ */ /* Mapper 361 and 366, previously assigned as Mapper 205 */ -static void GN45PW(uint32 A, uint8 V) { +static void GN45PW(uint32_t A, uint8_t V) { /* GN-30A - \ED\E0\F7\E0\EB\FC\ED\E0\FF \EC\E0\F1\EA\E0 \E4\EE\EB\E6\ED\E0 \E1\FB\F2\FC 1F + \E0\EF\EF\E0\F0\E0\F2\ED\FB\E9 \EF\E5\F0\E5\EA\EB\FE\F7\E0\F2\E5\EB\FC \ED\E0 \F8\E8\ED\E5 \E0\E4\F0\E5\F1\E0 */ setprg8(A, (V & 0x0f) | EXPREGS[0] &~0x0F); } -static void GN45CW(uint32 A, uint8 V) { +static void GN45CW(uint32_t A, uint8_t V) { /* GN-30A - \ED\E0\F7\E0\EB\FC\ED\E0\FF \EC\E0\F1\EA\E0 \E4\EE\EB\E6\ED\E0 \E1\FB\F2\FC FF */ setchr1(A, (V & 0x7F) | (EXPREGS[0] << 3 &~0x7F)); } @@ -1354,14 +1354,14 @@ void GN45_Init(CartInfo *info) { /* ---------------------------- Mapper 245 ------------------------------ */ -static void M245CW(uint32 A, uint8 V) { +static void M245CW(uint32_t A, uint8_t V) { if (!UNIFchrrama) /* Yong Zhe Dou E Long - Dragon Quest VI (As).nes NEEDS THIS for RAM cart */ setchr1(A, V & 7); EXPREGS[0] = V; FixMMC3PRG(MMC3_cmd); } -static void M245PW(uint32 A, uint8 V) { +static void M245PW(uint32_t A, uint8_t V) { setprg8(A, (V & 0x3F) | ((EXPREGS[0] & 2) << 5)); } @@ -1380,7 +1380,7 @@ void Mapper245_Init(CartInfo *info) { /* ---------------------------- Mapper 249 ------------------------------ */ -static void M249PW(uint32 A, uint8 V) { +static void M249PW(uint32_t A, uint8_t V) { if (EXPREGS[0] & 0x2) { if (V < 0x20) V = (V & 1) | ((V >> 3) & 2) | ((V >> 1) & 4) | ((V << 2) & 8) | ((V << 2) & 0x10); @@ -1392,7 +1392,7 @@ static void M249PW(uint32 A, uint8 V) { setprg8(A, V); } -static void M249CW(uint32 A, uint8 V) { +static void M249CW(uint32_t A, uint8_t V) { if (EXPREGS[0] & 0x2) V = (V & 3) | ((V >> 1) & 4) | ((V >> 4) & 8) | ((V >> 2) & 0x10) | ((V << 3) & 0x20) | ((V << 2) & 0xC0); setchr1(A, V); @@ -1469,11 +1469,11 @@ void Mapper254_Init(CartInfo *info) { } /* ---------------------------- Mapper 472 ------------------------------ */ -static void M472PW(uint32 A, uint8 V) { +static void M472PW(uint32_t A, uint8_t V) { setprg8(A, V &0x0F | EXPREGS[0] &0xF0); } -static void M472CW(uint32 A, uint8 V) { +static void M472CW(uint32_t A, uint8_t V) { int chrAND =EXPREGS[0] &0x20? 0x7F: 0xFF; setchr1(A, V &chrAND | EXPREGS[0] <<3 &~chrAND); } @@ -1513,10 +1513,10 @@ void Mapper472_Init(CartInfo *info) { /* ---------------------------- Mapper 555 ------------------------------ */ -static uint8 m555_reg[2]; -static uint8 m555_count_expired; -static uint32 m555_count; -static uint32 m555_count_target = 0x20000000; +static uint8_t m555_reg[2]; +static uint8_t m555_count_expired; +static uint32_t m555_count; +static uint32_t m555_count_target = 0x20000000; static SFORMAT M555StateRegs[] = { { m555_reg, 2, "REGS" }, @@ -1525,9 +1525,9 @@ static SFORMAT M555StateRegs[] = { { 0 } }; -static void M555CW(uint32 A, uint8 V) +static void M555CW(uint32_t A, uint8_t V) { - uint16 base = (m555_reg[0] << 5) & 0x80; + uint16_t base = (m555_reg[0] << 5) & 0x80; if ((m555_reg[0] & 0x06) == 0x02) { if (V & 0x40) { @@ -1540,9 +1540,9 @@ static void M555CW(uint32 A, uint8 V) } } -static void M555PW(uint32 A, uint8 V) { - uint16 mask = ((m555_reg[0] << 3) & 0x18) | 0x07; - uint16 base = ((m555_reg[0] << 3) & 0x20); +static void M555PW(uint32_t A, uint8_t V) { + uint16_t mask = ((m555_reg[0] << 3) & 0x18) | 0x07; + uint16_t base = ((m555_reg[0] << 3) & 0x20); setprg8(A, base | (V & mask)); } @@ -1565,14 +1565,14 @@ static DECLFW(M555Write5) { } static void M555Reset(void) { - m555_count_target = 0x20000000 | ((uint32)GameInfo->cspecial << 25); + m555_count_target = 0x20000000 | ((uint32_t)GameInfo->cspecial << 25); m555_count = 0; memset(m555_reg, 0, sizeof(m555_reg)); MMC3RegReset(); } static void M555Power(void) { - m555_count_target = 0x20000000 | ((uint32)GameInfo->cspecial << 25); + m555_count_target = 0x20000000 | ((uint32_t)GameInfo->cspecial << 25); m555_count = 0; memset(m555_reg, 0, sizeof(m555_reg)); GenMMC3Power(); @@ -1610,25 +1610,25 @@ void Mapper555_Init(CartInfo *info) { AddExState(M555StateRegs, ~0, 0, NULL); WRAMSIZE = 16 * 1024; - WRAM = (uint8 *)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t *)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); CHRRAMSIZE = 8 * 1024; - CHRRAM = (uint8 *)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM = (uint8_t *)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR"); } /* ---------------------------- Mapper 392 ------------------------------ */ -static void M392PW(uint32 A, uint8 V) { +static void M392PW(uint32_t A, uint8_t V) { if (EXPREGS[0] &0x10) setprg8(A, V &0x0F | EXPREGS[0] <<4); else setprg32(0x8000, 0x20); } -static void M392CW(uint32 A, uint8 V) { +static void M392CW(uint32_t A, uint8_t V) { if (EXPREGS[0] &0x10) setchr1(A, V &0x7F | EXPREGS[0] <<7); else @@ -1665,7 +1665,7 @@ void Mapper392_Init(CartInfo *info) { AddExState(EXPREGS, 1, 0, "EXPR"); CHRRAMSIZE = 8 * 1024; - CHRRAM = (uint8 *)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM = (uint8_t *)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); } @@ -1719,7 +1719,7 @@ void TQROM_Init(CartInfo *info) { GenMMC3_Init(info, 512, 64, 0, 0); cwrap = TQWRAP; CHRRAMSIZE = 8192; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM = (uint8_t*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR"); } diff --git a/src/boards/mmc3.h b/src/boards/mmc3.h index 911b635..7e187c5 100644 --- a/src/boards/mmc3.h +++ b/src/boards/mmc3.h @@ -1,16 +1,16 @@ #ifndef _MMC3_H #define _MMC3_H -extern uint8 MMC3_cmd; -extern uint8 mmc3opts; -extern uint8 A000B; -extern uint8 A001B; -extern uint8 EXPREGS[8]; -extern uint8 DRegBuf[8]; +extern uint8_t MMC3_cmd; +extern uint8_t mmc3opts; +extern uint8_t A000B; +extern uint8_t A001B; +extern uint8_t EXPREGS[8]; +extern uint8_t DRegBuf[8]; -extern void (*pwrap)(uint32 A, uint8 V); -extern void (*cwrap)(uint32 A, uint8 V); -extern void (*mwrap)(uint8 V); +extern void (*pwrap)(uint32_t A, uint8_t V); +extern void (*cwrap)(uint32_t A, uint8_t V); +extern void (*mwrap)(uint8_t V); void GenMMC3Power(void); void GenMMC3Restore(int version); diff --git a/src/boards/mmc5.c b/src/boards/mmc5.c index 5a0f788..c77eacf 100644 --- a/src/boards/mmc5.c +++ b/src/boards/mmc5.c @@ -28,76 +28,76 @@ static void (*psfun)(void); void MMC5RunSound(int Count); void MMC5RunSoundHQ(void); -static INLINE void MMC5SPRVROM_BANK1(uint32 A, uint32 V) { +static INLINE void MMC5SPRVROM_BANK1(uint32_t A, uint32_t V) { if (CHRptr[0]) { V &= CHRmask1[0]; MMC5SPRVPage[(A) >> 10] = &CHRptr[0][(V) << 10] - (A); } } -static INLINE void MMC5BGVROM_BANK1(uint32 A, uint32 V) { +static INLINE void MMC5BGVROM_BANK1(uint32_t A, uint32_t V) { if (CHRptr[0]) { V &= CHRmask1[0]; MMC5BGVPage[(A) >> 10] = &CHRptr[0][(V) << 10] - (A); } } -static INLINE void MMC5SPRVROM_BANK2(uint32 A, uint32 V) { +static INLINE void MMC5SPRVROM_BANK2(uint32_t A, uint32_t V) { if (CHRptr[0]) { V &= CHRmask2[0]; MMC5SPRVPage[(A) >> 10] = MMC5SPRVPage[((A) >> 10) + 1] = &CHRptr[0][(V) << 11] - (A); } } -static INLINE void MMC5BGVROM_BANK2(uint32 A, uint32 V) { +static INLINE void MMC5BGVROM_BANK2(uint32_t A, uint32_t V) { if (CHRptr[0]) { V &= CHRmask2[0]; MMC5BGVPage[(A) >> 10] = MMC5BGVPage[((A) >> 10) + 1] = &CHRptr[0][(V) << 11] - (A); } } -static INLINE void MMC5SPRVROM_BANK4(uint32 A, uint32 V) { +static INLINE void MMC5SPRVROM_BANK4(uint32_t A, uint32_t V) { if (CHRptr[0]) { V &= CHRmask4[0]; MMC5SPRVPage[(A) >> 10] = MMC5SPRVPage[((A) >> 10) + 1] = MMC5SPRVPage[((A) >> 10) + 2] = MMC5SPRVPage[((A) >> 10) + 3] = &CHRptr[0][(V) << 12] - (A); } } -static INLINE void MMC5BGVROM_BANK4(uint32 A, uint32 V) { +static INLINE void MMC5BGVROM_BANK4(uint32_t A, uint32_t V) { if (CHRptr[0]) { V &= CHRmask4[0]; MMC5BGVPage[(A) >> 10] = MMC5BGVPage[((A) >> 10) + 1] = MMC5BGVPage[((A) >> 10) + 2] = MMC5BGVPage[((A) >> 10) + 3] = &CHRptr[0][(V) << 12] - (A); } } -static INLINE void MMC5SPRVROM_BANK8(uint32 V) { +static INLINE void MMC5SPRVROM_BANK8(uint32_t V) { if (CHRptr[0]) { V &= CHRmask8[0]; MMC5SPRVPage[0] = MMC5SPRVPage[1] = MMC5SPRVPage[2] = MMC5SPRVPage[3] = MMC5SPRVPage[4] = MMC5SPRVPage[5] = MMC5SPRVPage[6] = MMC5SPRVPage[7] = &CHRptr[0][(V) << 13]; } } -static INLINE void MMC5BGVROM_BANK8(uint32 V) { +static INLINE void MMC5BGVROM_BANK8(uint32_t V) { if (CHRptr[0]) { V &= CHRmask8[0]; MMC5BGVPage[0] = MMC5BGVPage[1] = MMC5BGVPage[2] = MMC5BGVPage[3] = MMC5BGVPage[4] = MMC5BGVPage[5] = MMC5BGVPage[6] = MMC5BGVPage[7] = &CHRptr[0][(V) << 13]; } } -static uint8 PRGBanks[4]; -static uint8 WRAMPage; -static uint16 CHRBanksA[8], CHRBanksB[4]; -static uint8 WRAMMaskEnable[2]; -uint8 mmc5ABMode; /* A=0, B=1 */ +static uint8_t PRGBanks[4]; +static uint8_t WRAMPage; +static uint16_t CHRBanksA[8], CHRBanksB[4]; +static uint8_t WRAMMaskEnable[2]; +uint8_t mmc5ABMode; /* A=0, B=1 */ -static uint8 IRQScanline, IRQEnable; -static uint8 CHRMode, NTAMirroring, NTFill, ATFill; +static uint8_t IRQScanline, IRQEnable; +static uint8_t CHRMode, NTAMirroring, NTFill, ATFill; -static uint8 MMC5IRQR; -static uint8 MMC5LineCounter; -static uint8 mmc5psize, mmc5vsize; -static uint8 mul[2]; +static uint8_t MMC5IRQR; +static uint8_t MMC5LineCounter; +static uint8_t mmc5psize, mmc5vsize; +static uint8_t mul[2]; -static uint32 WRAMSIZE = 0; -static uint8 *WRAM = NULL; -static uint8 *MMC5fill = NULL; -static uint8 *ExRAM = NULL; +static uint32_t WRAMSIZE = 0; +static uint8_t *WRAM = NULL; +static uint8_t *MMC5fill = NULL; +static uint8_t *ExRAM = NULL; -static uint8 MMC5WRAMsize; /* configuration, not state */ -static uint8 MMC5WRAMIndex[8]; /* configuration, not state */ +static uint8_t MMC5WRAMsize; /* configuration, not state */ +static uint8_t MMC5WRAMIndex[8]; /* configuration, not state */ -static uint8 MMC5ROMWrProtect[4]; -static uint8 MMC5MemIn[5]; +static uint8_t MMC5ROMWrProtect[4]; +static uint8_t MMC5MemIn[5]; static void MMC5CHRA(void); static void MMC5CHRB(void); @@ -179,7 +179,7 @@ static void MMC5CHRB(void) { } } -static void FASTAPASS(2) MMC5WRAM(uint32 A, uint32 V) { +static void FASTAPASS(2) MMC5WRAM(uint32_t A, uint32_t V) { V = MMC5WRAMIndex[V & 7]; if (V != 255) { setprg8r(0x10, A, V); @@ -372,7 +372,7 @@ static DECLFR(MMC5_ExRAMRd) { static DECLFR(MMC5_read) { switch (A) { case 0x5204: { - uint8 x; + uint8_t x; X6502_IRQEnd(FCEU_IQEXT); x = MMC5IRQR; #ifdef FCEUDEF_DEBUGGER @@ -468,23 +468,23 @@ void MMC5_StateRestore(int version) { } typedef struct { - uint16 wl[2]; - uint8 env[2]; - uint8 enable; - uint8 running; - uint8 raw; - uint8 rawcontrol; - int32 dcount[2]; - int32 BC[3]; - int32 vcount[2]; + uint16_t wl[2]; + uint8_t env[2]; + uint8_t enable; + uint8_t running; + uint8_t raw; + uint8_t rawcontrol; + int32_t dcount[2]; + int32_t BC[3]; + int32_t vcount[2]; } MMC5APU; static MMC5APU MMC5Sound; static void Do5PCM(void) { - int32 V; - int32 start, end; + int32_t V; + int32_t start, end; start = MMC5Sound.BC[2]; end = (SOUNDTS << 16) / soundtsinc; @@ -497,7 +497,7 @@ static void Do5PCM(void) { } static void Do5PCMHQ(void) { - uint32 V; + uint32_t V; if (!(MMC5Sound.rawcontrol & 0x40) && MMC5Sound.raw) for (V = MMC5Sound.BC[2]; V < SOUNDTS; V++) WaveHi[V] += MMC5Sound.raw << 5; @@ -545,8 +545,8 @@ static DECLFW(Mapper5_SW) { static void Do5SQ(int P) { static int tal[4] = { 1, 2, 4, 6 }; - int32 V, amp, rthresh, wl; - int32 start, end; + int32_t V, amp, rthresh, wl; + int32_t start, end; start = MMC5Sound.BC[P]; end = (SOUNDTS << 16) / soundtsinc; @@ -580,8 +580,8 @@ static void Do5SQ(int P) { static void Do5SQHQ(int P) { static int tal[4] = { 1, 2, 4, 6 }; - uint32 V; - int32 amp, rthresh, wl; + uint32_t V; + int32_t amp, rthresh, wl; wl = MMC5Sound.wl[P] + 1; amp = ((MMC5Sound.env[P] & 0xF) << 8); @@ -615,7 +615,7 @@ void MMC5RunSoundHQ(void) { Do5PCMHQ(); } -void MMC5HiSync(int32 ts) { +void MMC5HiSync(int32_t ts) { int x; for (x = 0; x < 3; x++) MMC5Sound.BC[x] = ts; @@ -652,7 +652,7 @@ void Mapper5_ESI(void) { void NSFMMC5_Init(void) { memset(&MMC5Sound, 0, sizeof(MMC5Sound)); mul[0] = mul[1] = 0; - ExRAM = (uint8*)FCEU_gmalloc(1024); + ExRAM = (uint8_t*)FCEU_gmalloc(1024); Mapper5_ESI(); SetWriteHandler(0x5c00, 0x5fef, MMC5_ExRAMWr); SetReadHandler(0x5c00, 0x5fef, MMC5_ExRAMRd); @@ -793,13 +793,13 @@ static SFORMAT MMC5_StateRegs[] = { static void GenMMC5_Init(CartInfo *info, int wsize, int battery) { if (wsize) { - WRAM = (uint8*)FCEU_gmalloc(wsize * 1024); + WRAM = (uint8_t*)FCEU_gmalloc(wsize * 1024); SetupCartPRGMapping(0x10, WRAM, wsize * 1024, 1); AddExState(WRAM, wsize * 1024, 0, "WRAM"); } - MMC5fill = (uint8*)FCEU_gmalloc(1024); - ExRAM = (uint8*)FCEU_gmalloc(1024); + MMC5fill = (uint8_t*)FCEU_gmalloc(1024); + ExRAM = (uint8_t*)FCEU_gmalloc(1024); AddExState(ExRAM, 1024, 0, "ERAM"); AddExState(&MMC5HackSPMode, 1, 0, "SPLM"); diff --git a/src/boards/msm6585.c b/src/boards/msm6585.c index 0d3880d..fb63eff 100644 --- a/src/boards/msm6585.c +++ b/src/boards/msm6585.c @@ -74,7 +74,7 @@ static const int16_t diff_lookup[49*16] = { }; static const int16_t index_shift[8] = { -1, -1, -1, -1, 2, 4, 6, 8 }; -void MSM6585_init (MSM6585* chip, int32 newHostClock, int (*newGetInput)(void)) { +void MSM6585_init (MSM6585* chip, int32_t newHostClock, int (*newGetInput)(void)) { chip->hostClock = newHostClock; chip->getInput = newGetInput; AddExState(&chip->whichNibble, 1, 0, "MSMW"); @@ -91,7 +91,7 @@ void MSM6585_reset (MSM6585* chip) { chip->signal = -2; } -void MSM6585_setRate (MSM6585* chip, uint8 rateByte) { +void MSM6585_setRate (MSM6585* chip, uint8_t rateByte) { chip->rate = 4000 <<(rateByte &3); } diff --git a/src/boards/msm6585.h b/src/boards/msm6585.h index ce50d04..13c7c2b 100644 --- a/src/boards/msm6585.h +++ b/src/boards/msm6585.h @@ -1,19 +1,19 @@ #ifndef _MSM6585_H #define _MSM6585_H typedef struct { - uint8 whichNibble; - uint8 input; - int16 signal; - int32 count; - int32 hostClock; - int32 rate; - int16 step; + uint8_t whichNibble; + uint8_t input; + int16_t signal; + int32_t count; + int32_t hostClock; + int32_t rate; + int16_t step; int (*getInput)(void); } MSM6585; -void MSM6585_init (MSM6585*, int32, int (*)(void)); +void MSM6585_init (MSM6585*, int32_t, int (*)(void)); void MSM6585_reset (MSM6585*); -void MSM6585_setRate (MSM6585*, uint8); +void MSM6585_setRate (MSM6585*, uint8_t); void MSM6585_run (MSM6585*); int32_t MSM6585_getOutput (MSM6585*); #endif diff --git a/src/boards/n106.c b/src/boards/n106.c index 1f26048..1c1e265 100644 --- a/src/boards/n106.c +++ b/src/boards/n106.c @@ -20,11 +20,11 @@ #include "mapinc.h" -static uint16 IRQCount; -static uint8 IRQa; +static uint16_t IRQCount; +static uint8_t IRQa; -static uint8 WRAM[8192]; -static uint8 IRAM[128]; +static uint8_t WRAM[8192]; +static uint8_t IRAM[128]; static DECLFR(AWRAM) { return(WRAM[A - 0x6000]); @@ -36,22 +36,22 @@ static DECLFW(BWRAM) { void Mapper19_ESI(void); -static uint8 NTAPage[4]; +static uint8_t NTAPage[4]; -static uint8 dopol; -static uint8 gorfus; -static uint8 gorko; +static uint8_t dopol; +static uint8_t gorfus; +static uint8_t gorko; static void NamcoSound(int Count); static void NamcoSoundHack(void); -static void DoNamcoSound(int32 *Wave, int Count); +static void DoNamcoSound(int32_t *Wave, int Count); static void DoNamcoSoundHQ(void); -static void SyncHQ(int32 ts); +static void SyncHQ(int32_t ts); static int is210; /* Lesser mapper. */ -static uint8 PRG[3]; -static uint8 CHR[8]; +static uint8_t PRG[3]; +static uint8_t CHR[8]; static SFORMAT N106_StateRegs[] = { { PRG, 3, "PRG" }, @@ -93,7 +93,7 @@ static void FP_FASTAPASS(1) NamcoIRQHook(int a) { } static DECLFR(Namco_Read4800) { - uint8 ret = IRAM[dopol & 0x7f]; + uint8_t ret = IRAM[dopol & 0x7f]; /* Maybe I should call NamcoSoundHack() here? */ #ifdef FCEUDEF_DEBUGGER if (!fceuindbg) @@ -111,7 +111,7 @@ static DECLFR(Namco_Read5800) { return(IRQCount >> 8); } -static void FASTAPASS(2) DoNTARAMROM(int w, uint8 V) { +static void FASTAPASS(2) DoNTARAMROM(int w, uint8_t V) { NTAPage[w] = V; if (V >= 0xE0) setntamem(NTARAM + ((V & 1) << 10), 1, w); @@ -127,7 +127,7 @@ static void FixNTAR(void) { DoNTARAMROM(x, NTAPage[x]); } -static void FASTAPASS(2) DoCHRRAMROM(int x, uint8 V) { +static void FASTAPASS(2) DoCHRRAMROM(int x, uint8_t V) { CHR[x] = V; if (!is210 && !((gorfus >> ((x >> 2) + 6)) & 1) && (V >= 0xE0)) { } else @@ -144,9 +144,9 @@ static DECLFW(Mapper19C0D8_write) { DoNTARAMROM((A - 0xC000) >> 11, V); } -static uint32 FreqCache[8]; -static uint32 EnvCache[8]; -static uint32 LengthCache[8]; +static uint32_t FreqCache[8]; +static uint32_t EnvCache[8]; +static uint32_t LengthCache[8]; static void FixCache(int a, int V) { int w = (a >> 3) & 0x7; @@ -218,7 +218,7 @@ static DECLFW(Mapper19_write) { static int dwave = 0; static void NamcoSoundHack(void) { - int32 z, a; + int32_t z, a; if (FSettings.soundq >= 1) { DoNamcoSoundHQ(); return; @@ -230,16 +230,16 @@ static void NamcoSoundHack(void) { } static void NamcoSound(int Count) { - int32 z, a; + int32_t z, a; z = ((SOUNDTS << 16) / soundtsinc) >> 4; a = z - dwave; if (a) DoNamcoSound(&Wave[dwave], a); dwave = 0; } -static uint32 PlayIndex[8]; -static int32 vcount[8]; -static int32 CVBC; +static uint32_t PlayIndex[8]; +static int32_t vcount[8]; +static int32_t CVBC; #define TOINDEX (16 + 1) @@ -266,7 +266,7 @@ static SFORMAT N106_SStateRegs[] = }; /* 16:15 */ -static void SyncHQ(int32 ts) { +static void SyncHQ(int32_t ts) { CVBC = ts; } @@ -279,8 +279,8 @@ static void SyncHQ(int32 ts) { ...? */ -static INLINE uint32 FetchDuff(uint32 P, uint32 envelope) { - uint32 duff; +static INLINE uint32_t FetchDuff(uint32_t P, uint32_t envelope) { + uint32_t duff; duff = IRAM[((IRAM[0x46 + (P << 3)] + (PlayIndex[P] >> TOINDEX)) & 0xFF) >> 1]; if ((IRAM[0x46 + (P << 3)] + (PlayIndex[P] >> TOINDEX)) & 1) duff >>= 4; @@ -290,14 +290,14 @@ static INLINE uint32 FetchDuff(uint32 P, uint32 envelope) { } static void DoNamcoSoundHQ(void) { - int32 P, V; - int32 cyclesuck = (((IRAM[0x7F] >> 4) & 7) + 1) * 15; + int32_t P, V; + int32_t cyclesuck = (((IRAM[0x7F] >> 4) & 7) + 1) * 15; for (P = 7; P >= (7 - ((IRAM[0x7F] >> 4) & 7)); P--) { if ((IRAM[0x44 + (P << 3)] & 0xE0) && (IRAM[0x47 + (P << 3)] & 0xF)) { - uint32 freq; - int32 vco; - uint32 duff2, lengo, envelope; + uint32_t freq; + int32_t vco; + uint32_t duff2, lengo, envelope; vco = vcount[P]; freq = FreqCache[P]; @@ -322,14 +322,14 @@ static void DoNamcoSoundHQ(void) { } -static void DoNamcoSound(int32 *Wave, int Count) { +static void DoNamcoSound(int32_t *Wave, int Count) { int P, V; for (P = 7; P >= 7 - ((IRAM[0x7F] >> 4) & 7); P--) { if ((IRAM[0x44 + (P << 3)] & 0xE0) && (IRAM[0x47 + (P << 3)] & 0xF)) { - int32 inc; - uint32 freq; - int32 vco; - uint32 duff, duff2, lengo, envelope; + int32_t inc; + uint32_t freq; + int32_t vco; + uint32_t duff, duff2, lengo, envelope; vco = vcount[P]; freq = FreqCache[P]; @@ -341,7 +341,11 @@ static void DoNamcoSound(int32 *Wave, int Count) { { int c = ((IRAM[0x7F] >> 4) & 7) + 1; - inc = (long double)(FSettings.SndRate << 15) / ((long double)freq * 21477272 / ((long double)0x400000 * c * 45)); + /* Use double rather than long double for cross-platform + * FP determinism (long double is 80-bit on x87, 64-bit + * with SSE math, 128-bit elsewhere - the truncated + * int32 result varies). */ + inc = (int32_t)((double)(FSettings.SndRate << 15) / ((double)freq * 21477272.0 / ((double)0x400000 * c * 45))); } duff = IRAM[(((IRAM[0x46 + (P << 3)] + PlayIndex[P]) & 0xFF) >> 1)]; diff --git a/src/boards/n625092.c b/src/boards/n625092.c index 860655e..15bdbd4 100644 --- a/src/boards/n625092.c +++ b/src/boards/n625092.c @@ -23,8 +23,8 @@ #include "mapinc.h" -static uint16 reg[2]; -static uint8 submapper; +static uint16_t reg[2]; +static uint8_t submapper; static SFORMAT StateRegs[] ={ { reg, 4 | FCEUSTATE_RLSB, "REGS" }, @@ -37,7 +37,7 @@ static DECLFR(Mapper221_ReadOB) } static void sync(void) { - uint8 prg =reg[0] >>(submapper ==1? 2: 3) &0x40 | reg[0] >>2 &0x38 | reg[1] &0x07; + uint8_t prg =reg[0] >>(submapper ==1? 2: 3) &0x40 | reg[0] >>2 &0x38 | reg[1] &0x07; SetReadHandler(0x8000, 0xFFFF, prg <<14 >=PRGsize[0]? Mapper221_ReadOB: CartBR); /* Selecting unpopulated banks results in open bus */ if (reg[0] &(submapper ==1? 0x200: 0x100)) { /* UNROM */ setprg16(0x8000, prg); diff --git a/src/boards/novel.c b/src/boards/novel.c index c6dca06..929262e 100644 --- a/src/boards/novel.c +++ b/src/boards/novel.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 latch; +static uint8_t latch; static void DoNovel(void) { setprg32(0x8000, latch & 3); diff --git a/src/boards/onebus.c b/src/boards/onebus.c index 673c61d..5b462e9 100644 --- a/src/boards/onebus.c +++ b/src/boards/onebus.c @@ -27,17 +27,17 @@ #include "mapinc.h" -static uint8 submapper; +static uint8_t submapper; static void (*Sync)(void); -static uint8 *CHRRAM; -static uint32 CHRRAMSIZE; +static uint8_t *CHRRAM; +static uint32_t CHRRAMSIZE; /* General Purpose Registers */ -static uint8 cpu410x[64], ppu201x[16], apu40xx[64], reg4242, dipswitch; -static const uint8 *cpuMangle, *ppuMangle, *mmc3Mangle; +static uint8_t cpu410x[64], ppu201x[16], apu40xx[64], reg4242, dipswitch; +static const uint8_t *cpuMangle, *ppuMangle, *mmc3Mangle; /* IRQ Registers */ -static uint8 IRQCount, IRQa, IRQReload; +static uint8_t IRQCount, IRQa, IRQReload; #define IRQLatch cpu410x[0x1] /* accc cccc, a = 0, AD12 switching, a = 1, HSYNC switching */ /* MMC3 Registers */ @@ -45,8 +45,8 @@ static uint8 IRQCount, IRQa, IRQReload; #define mirror cpu410x[0x6] /* ---- ---m, m = 0 - H, m = 1 - V */ /* APU Registers */ -static uint8 pcm_enable = 0, pcm_irq = 0; -static int16 pcm_addr, pcm_size, pcm_latch, pcm_clock = 0xE1; +static uint8_t pcm_enable = 0, pcm_irq = 0; +static int16_t pcm_addr, pcm_size, pcm_latch, pcm_clock = 0xE1; static writefunc defapuwrite[64]; static readfunc defapuread[64]; @@ -70,18 +70,18 @@ static SFORMAT StateRegs[] = { 0 } }; -static uint8 *WRAM; +static uint8_t *WRAM; static void PSync(int AND, int OR) { - uint8 bankmode = cpu410x[0xb] & 7; - uint8 mask = (bankmode == 0x7) ? (0xff) : (0x3f >> bankmode); - uint32 block = ((cpu410x[0x0] & 0xf0) << 4) + (cpu410x[0xa] & (~mask)); - uint32 pswap = (mmc3cmd & 0x40) << 8; + uint8_t bankmode = cpu410x[0xb] & 7; + uint8_t mask = (bankmode == 0x7) ? (0xff) : (0x3f >> bankmode); + uint32_t block = ((cpu410x[0x0] & 0xf0) << 4) + (cpu410x[0xa] & (~mask)); + uint32_t pswap = (mmc3cmd & 0x40) << 8; - uint8 bank0 = cpu410x[0x7]; - uint8 bank1 = cpu410x[0x8]; - uint8 bank2 = (cpu410x[0xb] & 0x40) ? (cpu410x[0x9]) : (~1); - uint8 bank3 = ~0; + uint8_t bank0 = cpu410x[0x7]; + uint8_t bank1 = cpu410x[0x8]; + uint8_t bank2 = (cpu410x[0xb] & 0x40) ? (cpu410x[0x9]) : (~1); + uint8_t bank3 = ~0; setprg8(0x8000 ^ pswap,(block | (bank0 & mask)) &AND | OR); setprg8(0xa000, (block | (bank1 & mask)) &AND | OR); @@ -90,19 +90,19 @@ static void PSync(int AND, int OR) { } static void CSync(int AND, int OR) { - static const uint8 midx[8] = { 0, 1, 2, 0, 3, 4, 5, 0 }; - uint8 mask = 0xff >> midx[ppu201x[0xa] & 7]; - uint32 block = ((cpu410x[0x0] & 0x0f) << 11) + ((ppu201x[0x8] & 0x70) << 4) + (ppu201x[0xa] & (~mask)); - uint32 cswap = (mmc3cmd & 0x80) << 5; + static const uint8_t midx[8] = { 0, 1, 2, 0, 3, 4, 5, 0 }; + uint8_t mask = 0xff >> midx[ppu201x[0xa] & 7]; + uint32_t block = ((cpu410x[0x0] & 0x0f) << 11) + ((ppu201x[0x8] & 0x70) << 4) + (ppu201x[0xa] & (~mask)); + uint32_t cswap = (mmc3cmd & 0x80) << 5; - uint8 bank0 = ppu201x[0x6] & (~1); - uint8 bank1 = ppu201x[0x6] | 1; - uint8 bank2 = ppu201x[0x7] & (~1); - uint8 bank3 = ppu201x[0x7] | 1; - uint8 bank4 = ppu201x[0x2]; - uint8 bank5 = ppu201x[0x3]; - uint8 bank6 = ppu201x[0x4]; - uint8 bank7 = ppu201x[0x5]; + uint8_t bank0 = ppu201x[0x6] & (~1); + uint8_t bank1 = ppu201x[0x6] | 1; + uint8_t bank2 = ppu201x[0x7] & (~1); + uint8_t bank3 = ppu201x[0x7] | 1; + uint8_t bank4 = ppu201x[0x2]; + uint8_t bank5 = ppu201x[0x3]; + uint8_t bank6 = ppu201x[0x4]; + uint8_t bank7 = ppu201x[0x5]; setchr1(0x0000 ^ cswap,(block | (bank0 & mask)) &AND | OR); setchr1(0x0400 ^ cswap,(block | (bank1 & mask)) &AND | OR); @@ -124,7 +124,7 @@ static void Sync256(void) { if (submapper ==14 && cpu410x[0x1C] &0x40) encryptOpcodes =14; } -static const uint8 cpuMangles[16][4] = { +static const uint8_t cpuMangles[16][4] = { { 0, 1, 2, 3 }, /* Submapper 0: Normal */ { 0, 1, 2, 3 }, /* Submapper 1: Waixing VT03 */ { 1, 0, 2, 3 }, /* Submapper 2: Trump Grand */ @@ -162,7 +162,7 @@ static DECLFW(UNLOneBusWriteCPU4242) { Sync(); } -static const uint8 ppuMangles[16][6] = { +static const uint8_t ppuMangles[16][6] = { { 0, 1, 2, 3, 4, 5 }, /* Submapper 0: Normal */ { 1, 0, 5, 4, 3, 2 }, /* Submapper 1: Waixing VT03 */ { 0, 1, 2, 3, 4, 5 }, /* Submapper 2: Trump Grand */ @@ -188,7 +188,7 @@ static DECLFW(UNLOneBusWritePPU201X) { Sync(); } -static const uint8 mmc3Mangles[16][8] = { +static const uint8_t mmc3Mangles[16][8] = { { 0, 1, 2, 3, 4, 5, 6, 7 }, /* Submapper 0: Normal */ { 5, 4, 3, 2, 1, 0, 6, 7 }, /* Submapper 1: Waixing VT03 */ { 0, 1, 2, 3, 4, 5, 7, 6 }, /* Submapper 2: Trump Grand */ @@ -238,7 +238,7 @@ static DECLFW(UNLOneBusWriteMMC3) { } static void UNLOneBusIRQHook(void) { - uint32 count = IRQCount; + uint32_t count = IRQCount; if (!count || IRQReload) { IRQCount = IRQLatch; IRQReload = 0; @@ -281,7 +281,7 @@ static DECLFW(UNLOneBusWriteAPU40XX) { } static DECLFR(UNLOneBusReadAPU40XX) { - uint8 result = defapuread[A & 0x3f](A); + uint8_t result = defapuread[A & 0x3f](A); /* FCEU_printf("read %04x, %02x\n",A,result); */ switch (A & 0x3f) { case 0x15: @@ -310,8 +310,8 @@ static void UNLOneBusCpuHook(int a) { pcm_enable = 0; X6502_IRQBegin(FCEU_IQEXT); } else { - uint16 addr = pcm_addr | ((apu40xx[0x30]^3) << 14); - uint8 raw_pcm = ARead[addr](addr) >> 1; + uint16_t addr = pcm_addr | ((apu40xx[0x30]^3) << 14); + uint8_t raw_pcm = ARead[addr](addr) >> 1; defapuwrite[0x11](0x4011, raw_pcm); pcm_addr++; pcm_addr &= 0x7FFF; @@ -321,7 +321,7 @@ static void UNLOneBusCpuHook(int a) { } static void UNLOneBusPower(void) { - uint32 i; + uint32_t i; IRQReload = IRQCount = IRQa = 0; memset(cpu410x, 0x00, sizeof(cpu410x)); @@ -393,10 +393,10 @@ void UNLOneBus_Init(CartInfo *info) { submapper =info->submapper; else { /* Compare the first four MD5 bytes literally to avoid the previous - * endian-dependent (uint32) reinterpretation, which silently + * endian-dependent (uint32_t) reinterpretation, which silently * mismatched on big-endian hosts and disabled the PowerJoy Supermax * variant detection. */ - const uint8 *md5 = info->MD5; + const uint8_t *md5 = info->MD5; int is_305fcdc3 = (md5[0] == 0xc3 && md5[1] == 0xcd && md5[2] == 0x5f && md5[3] == 0x30); int is_6abfce8e = (md5[0] == 0x8e && md5[1] == 0xce && md5[2] == 0xbf && md5[3] == 0x6a); submapper = (is_305fcdc3 || is_6abfce8e) ? 2 : 0; /* PowerJoy Supermax Carts */ @@ -411,7 +411,7 @@ void UNLOneBus_Init(CartInfo *info) { GameStateRestore = StateRestore; AddExState(&StateRegs, ~0, 0, 0); - WRAM = (uint8*)FCEU_gmalloc(8192); + WRAM = (uint8_t*)FCEU_gmalloc(8192); SetupCartPRGMapping(0x10, WRAM, 8192, 1); } @@ -444,7 +444,7 @@ void Mapper270_Init(CartInfo *info) { mmc3Mangle =mmc3Mangles[0]; CHRRAMSIZE = 8192; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM = (uint8_t*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR"); @@ -471,7 +471,7 @@ void Mapper436_Init(CartInfo *info) { mmc3Mangle =mmc3Mangles[0]; CHRRAMSIZE = 8192; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); + CHRRAM = (uint8_t*)FCEU_gmalloc(CHRRAMSIZE); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR"); diff --git a/src/boards/pec-586.c b/src/boards/pec-586.c index 007c521..21d466d 100644 --- a/src/boards/pec-586.c +++ b/src/boards/pec-586.c @@ -20,10 +20,10 @@ #include "mapinc.h" -static uint8 reg[8]; -static uint32 lastnt = 0; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t reg[8]; +static uint32_t lastnt = 0; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -32,7 +32,7 @@ static SFORMAT StateRegs[] = { 0 } }; -static uint8 bs_tbl[128] = { +static uint8_t bs_tbl[128] = { 0x03, 0x13, 0x23, 0x33, 0x03, 0x13, 0x23, 0x33, 0x03, 0x13, 0x23, 0x33, 0x03, 0x13, 0x23, 0x33, /* 00 */ 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, /* 10 */ 0x03, 0x13, 0x23, 0x33, 0x03, 0x13, 0x23, 0x33, 0x03, 0x13, 0x23, 0x33, 0x03, 0x13, 0x23, 0x33, /* 20 */ @@ -43,7 +43,7 @@ static uint8 bs_tbl[128] = { 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, /* 70 */ }; -static uint8 br_tbl[16] = { +static uint8_t br_tbl[16] = { 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, }; @@ -120,7 +120,7 @@ void UNLPEC586Init(CartInfo *info) { GameStateRestore = StateRestore; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); diff --git a/src/boards/pic16c5x.c b/src/boards/pic16c5x.c index 775c530..8179a76 100644 --- a/src/boards/pic16c5x.c +++ b/src/boards/pic16c5x.c @@ -75,31 +75,31 @@ #include "pic16c5x.h" /******************** CPU Internal Registers *******************/ -static uint16 m_PC; -static uint16 m_PREVPC; /* previous program counter */ -static uint8 m_W; -static uint8 m_OPTION; -static uint16 m_CONFIG; -static uint8 m_ALU; -static uint16 m_WDT; -static uint8 m_TRISA; -static uint8 m_TRISB; -static uint8 m_TRISC; -static uint16 m_STACK[2]; -static uint16 m_prescaler; /* Note: this is really an 8-bit register */ -static uint16 m_opcode; -static uint8 m_internalram[128]; -static uint8 *m_rom; +static uint16_t m_PC; +static uint16_t m_PREVPC; /* previous program counter */ +static uint8_t m_W; +static uint8_t m_OPTION; +static uint16_t m_CONFIG; +static uint8_t m_ALU; +static uint16_t m_WDT; +static uint8_t m_TRISA; +static uint8_t m_TRISB; +static uint8_t m_TRISC; +static uint16_t m_STACK[2]; +static uint16_t m_prescaler; /* Note: this is really an 8-bit register */ +static uint16_t m_opcode; +static uint8_t m_internalram[128]; +static uint8_t *m_rom; static int m_icount; static int m_picmodel; static int m_delay_timer; -static uint16 m_temp_config; +static uint16_t m_temp_config; static int m_rtcc; -static uint8 m_count_pending; /* boolean type */ -static int8 m_old_data; -static uint8 m_picRAMmask; -static uint16 m_picROMmask; +static uint8_t m_count_pending; /* boolean type */ +static int8_t m_old_data; +static uint8_t m_picRAMmask; +static uint16_t m_picROMmask; static int m_inst_cycles; static int m_clock2cycle; @@ -111,7 +111,7 @@ address_space *m_data;*/ static pic16c5x_readfunc m_read; static pic16c5x_writefunc m_write; -static void PIC16C5x(int program_width, int data_width, int picmodel, uint8 *rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr) +static void PIC16C5x(int program_width, int data_width, int picmodel, uint8_t *rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr) { m_rom = rom; m_picmodel = picmodel; @@ -140,13 +140,13 @@ static void PIC16C5x(int program_width, int data_width, int picmodel, uint8 *rom m_clock2cycle = 0; } -void pic16c54_init(uint8 *rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr) { PIC16C5x( 9, 5, 0x16C54, rom, _rd, _wr); } -void pic16c55_init(uint8 *rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr) { PIC16C5x( 9, 5, 0x16C55, rom, _rd, _wr); } -void pic16c56_init(uint8 *rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr) { PIC16C5x(10, 5, 0x16C56, rom, _rd, _wr); } -void pic16c57_init(uint8 *rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr) { PIC16C5x(11, 7, 0x16C57, rom, _rd, _wr); } -void pic16c58_init(uint8 *rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr) { PIC16C5x(11, 7, 0x16C58, rom, _rd, _wr); } -void pic1650_init (uint8 *rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr) { PIC16C5x( 9, 5, 0x1650, rom, _rd, _wr); } -void pic1655_init (uint8 *rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr) { PIC16C5x( 9, 5, 0x1655, rom, _rd, _wr); } +void pic16c54_init(uint8_t *rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr) { PIC16C5x( 9, 5, 0x16C54, rom, _rd, _wr); } +void pic16c55_init(uint8_t *rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr) { PIC16C5x( 9, 5, 0x16C55, rom, _rd, _wr); } +void pic16c56_init(uint8_t *rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr) { PIC16C5x(10, 5, 0x16C56, rom, _rd, _wr); } +void pic16c57_init(uint8_t *rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr) { PIC16C5x(11, 7, 0x16C57, rom, _rd, _wr); } +void pic16c58_init(uint8_t *rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr) { PIC16C5x(11, 7, 0x16C58, rom, _rd, _wr); } +void pic1650_init (uint8_t *rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr) { PIC16C5x( 9, 5, 0x1650, rom, _rd, _wr); } +void pic1655_init (uint8_t *rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr) { PIC16C5x( 9, 5, 0x1655, rom, _rd, _wr); } #define M_OPCODE_B0 (m_opcode & 0xFF) #define M_OPCODE_B1 ((m_opcode >> 8) & 0xFF) @@ -217,7 +217,7 @@ void pic1655_init (uint8 *rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr) { * Shortcuts ************************************************************************/ -#define CLR(flagreg, flag) ( flagreg &= (uint8)(~flag) ) +#define CLR(flagreg, flag) ( flagreg &= (uint8_t)(~flag) ) #define SET(flagreg, flag) ( flagreg |= flag ) @@ -234,7 +234,7 @@ static INLINE void CALCULATE_Z_FLAG(void) static INLINE void CALCULATE_ADD_CARRY(void) { - if ((uint8)(m_old_data) > (uint8)(m_ALU)) { + if ((uint8_t)(m_old_data) > (uint8_t)(m_ALU)) { SET(STATUS, C_FLAG); } else { @@ -244,7 +244,7 @@ static INLINE void CALCULATE_ADD_CARRY(void) static INLINE void CALCULATE_ADD_DIGITCARRY(void) { - if (((uint8)(m_old_data) & 0x0f) > ((uint8)(m_ALU) & 0x0f)) { + if (((uint8_t)(m_old_data) & 0x0f) > ((uint8_t)(m_ALU) & 0x0f)) { SET(STATUS, DC_FLAG); } else { @@ -254,7 +254,7 @@ static INLINE void CALCULATE_ADD_DIGITCARRY(void) static INLINE void CALCULATE_SUB_CARRY(void) { - if ((uint8)(m_old_data) < (uint8)(m_ALU)) { + if ((uint8_t)(m_old_data) < (uint8_t)(m_ALU)) { CLR(STATUS, C_FLAG); } else { @@ -264,7 +264,7 @@ static INLINE void CALCULATE_SUB_CARRY(void) static INLINE void CALCULATE_SUB_DIGITCARRY(void) { - if (((uint8)(m_old_data) & 0x0f) < ((uint8)(m_ALU) & 0x0f)) { + if (((uint8_t)(m_old_data) & 0x0f) < ((uint8_t)(m_ALU) & 0x0f)) { CLR(STATUS, DC_FLAG); } else { @@ -274,13 +274,13 @@ static INLINE void CALCULATE_SUB_DIGITCARRY(void) -static INLINE uint16 POP_STACK(void) +static INLINE uint16_t POP_STACK(void) { - uint16 data = m_STACK[1]; + uint16_t data = m_STACK[1]; m_STACK[1] = m_STACK[0]; return (data & ADDR_MASK); } -static INLINE void PUSH_STACK(uint16 data) +static INLINE void PUSH_STACK(uint16_t data) { m_STACK[0] = m_STACK[1]; m_STACK[1] = (data & ADDR_MASK); @@ -288,9 +288,9 @@ static INLINE void PUSH_STACK(uint16 data) -static INLINE uint8 GET_REGFILE(uint32_t addr) /* Read from internal memory */ +static INLINE uint8_t GET_REGFILE(uint32_t addr) /* Read from internal memory */ { - uint8 data = 0; + uint8_t data = 0; if (addr == 0) { /* Indirect addressing */ addr = (FSR & m_picRAMmask); @@ -307,7 +307,7 @@ static INLINE uint8 GET_REGFILE(uint32_t addr) /* Read from internal memory */ case 0: /* Not an actual register, so return 0 */ data = 0; break; - case 4: data = (FSR | (uint8)(~m_picRAMmask)); + case 4: data = (FSR | (uint8_t)(~m_picRAMmask)); break; case 5: /* read port A */ if (m_picmodel == 0x1650) { @@ -319,7 +319,7 @@ static INLINE uint8 GET_REGFILE(uint32_t addr) /* Read from internal memory */ else { data = m_read(PIC16C5x_PORTA); data &= m_TRISA; - data |= ((uint8)(~m_TRISA) & PORTA); + data |= ((uint8_t)(~m_TRISA) & PORTA); data &= 0x0f; /* 4-bit port (only lower 4 bits used) */ } break; @@ -330,7 +330,7 @@ static INLINE uint8 GET_REGFILE(uint32_t addr) /* Read from internal memory */ else if (m_picmodel != 0x1655) { /* B is output-only on 1655 */ data = m_read(PIC16C5x_PORTB); data &= m_TRISB; - data |= ((uint8)(~m_TRISB) & PORTB); + data |= ((uint8_t)(~m_TRISB) & PORTB); } break; case 7: /* read port C */ @@ -340,7 +340,7 @@ static INLINE uint8 GET_REGFILE(uint32_t addr) /* Read from internal memory */ else if ((m_picmodel == 0x16C55) || (m_picmodel == 0x16C57)) { data = m_read(PIC16C5x_PORTC); data &= m_TRISC; - data |= ((uint8)(~m_TRISC) & PORTC); + data |= ((uint8_t)(~m_TRISC) & PORTC); } else { /* PIC16C54, PIC16C56, PIC16C58 */ data = M_RDRAM(addr); @@ -360,7 +360,7 @@ static INLINE uint8 GET_REGFILE(uint32_t addr) /* Read from internal memory */ return data; } -static INLINE void STORE_REGFILE(uint32_t addr, uint8 data) /* Write to internal memory */ +static INLINE void STORE_REGFILE(uint32_t addr, uint8_t data) /* Write to internal memory */ { if (addr == 0) { /* Indirect addressing */ addr = (FSR & m_picRAMmask); @@ -383,9 +383,9 @@ static INLINE void STORE_REGFILE(uint32_t addr, uint8 data) /* Write to inter case 2: PCL = data; m_PC = ((STATUS & PA_REG) << 4) | data; break; - case 3: STATUS = (STATUS & (TO_FLAG | PD_FLAG)) | (data & (uint8)(~(TO_FLAG | PD_FLAG))); + case 3: STATUS = (STATUS & (TO_FLAG | PD_FLAG)) | (data & (uint8_t)(~(TO_FLAG | PD_FLAG))); break; - case 4: FSR = (data | (uint8)(~m_picRAMmask)); + case 4: FSR = (data | (uint8_t)(~m_picRAMmask)); break; case 5: /* write port A */ if (m_picmodel == 0x1650) { @@ -393,7 +393,7 @@ static INLINE void STORE_REGFILE(uint32_t addr, uint8 data) /* Write to inter } else if (m_picmodel != 0x1655) { /* A is input-only on 1655 */ data &= 0x0f; /* 4-bit port (only lower 4 bits used) */ - m_write(PIC16C5x_PORTA, data & (uint8)(~m_TRISA)); + m_write(PIC16C5x_PORTA, data & (uint8_t)(~m_TRISA)); } PORTA = data; break; @@ -402,7 +402,7 @@ static INLINE void STORE_REGFILE(uint32_t addr, uint8 data) /* Write to inter m_write(PIC16C5x_PORTB, data); } else { - m_write(PIC16C5x_PORTB, data & (uint8)(~m_TRISB)); + m_write(PIC16C5x_PORTB, data & (uint8_t)(~m_TRISB)); } PORTB = data; break; @@ -411,7 +411,7 @@ static INLINE void STORE_REGFILE(uint32_t addr, uint8 data) /* Write to inter m_write(PIC16C5x_PORTC, data); } else if ((m_picmodel == 0x16C55) || (m_picmodel == 0x16C57)) { - m_write(PIC16C5x_PORTC, data & (uint8)(~m_TRISC)); + m_write(PIC16C5x_PORTC, data & (uint8_t)(~m_TRISC)); } PORTC = data; /* also writes to RAM */ break; @@ -427,7 +427,7 @@ static INLINE void STORE_REGFILE(uint32_t addr, uint8 data) /* Write to inter } -static INLINE void STORE_RESULT(uint32_t addr, uint8 data) +static INLINE void STORE_RESULT(uint32_t addr, uint8_t data) { if (M_OPCODE_B0 & 0x20) { @@ -550,7 +550,7 @@ static INLINE void clrwdt(void) static INLINE void comf(void) { - m_ALU = (uint8)(~(GET_REGFILE(ADDR))); + m_ALU = (uint8_t)(~(GET_REGFILE(ADDR))); STORE_RESULT(ADDR, m_ALU); CALCULATE_Z_FLAG(); } @@ -650,7 +650,7 @@ static INLINE void retlw(void) static INLINE void rlf(void) { - uint8 bit7; + uint8_t bit7; m_ALU = GET_REGFILE(ADDR); bit7 = m_ALU & 0x80; m_ALU <<= 1; @@ -662,7 +662,7 @@ static INLINE void rlf(void) static INLINE void rrf(void) { - uint8 bit0; + uint8_t bit0; m_ALU = GET_REGFILE(ADDR); bit0 = m_ALU & 1; m_ALU >>= 1; @@ -702,12 +702,12 @@ static INLINE void tris(void) switch(M_OPCODE_B0 & 0x7) { case 5: if (m_TRISA == m_W) break; - else { m_TRISA = m_W | 0xf0; m_write(PIC16C5x_PORTA, 0x1000 | (PORTA & (uint8)(~m_TRISA) & 0x0f)); break; } + else { m_TRISA = m_W | 0xf0; m_write(PIC16C5x_PORTA, 0x1000 | (PORTA & (uint8_t)(~m_TRISA) & 0x0f)); break; } case 6: if (m_TRISB == m_W) break; - else { m_TRISB = m_W; m_write(PIC16C5x_PORTB, 0x1000 | (PORTB & (uint8)(~m_TRISB))); break; } + else { m_TRISB = m_W; m_write(PIC16C5x_PORTB, 0x1000 | (PORTB & (uint8_t)(~m_TRISB))); break; } case 7: if ((m_picmodel == 0x16C55) || (m_picmodel == 0x16C57)) { if (m_TRISC == m_W) break; - else { m_TRISC = m_W; m_write(PIC16C5x_PORTC, 0x1000 | (PORTC & (uint8)(~m_TRISC))); break; } + else { m_TRISC = m_W; m_write(PIC16C5x_PORTC, 0x1000 | (PORTC & (uint8_t)(~m_TRISC))); break; } } else { illegal(); break; @@ -737,7 +737,7 @@ static INLINE void xorwf(void) * Opcode Table (Cycles, Instruction) ***********************************************************************/ -static const uint8 s_opcode_main_cycles[256] = { +static const uint8_t s_opcode_main_cycles[256] = { /*00*/ 1, 1, 1, 1, 1, 1, 1, 1, /*08*/ 1, 1, 1, 1, 1, 1, 1, 1, /*10*/ 1, 1, 1, 1, 1, 1, 1, 1, @@ -774,7 +774,7 @@ static const uint8 s_opcode_main_cycles[256] = { /*F8*/ 1, 1, 1, 1, 1, 1, 1, 1 }; -static const uint8 s_opcode_00x_cycles[16] = { +static const uint8_t s_opcode_00x_cycles[16] = { /*00*/ 1, 1, 1, 1, 1, 1, 1, 1, /*08*/ 1, 1, 1, 1, 1, 1, 1, 1 }; @@ -807,14 +807,14 @@ static INLINE void PIC16C5x_reset_regs(void) m_TRISC = 0xff; m_OPTION = (T0CS_FLAG | T0SE_FLAG | PSA_FLAG | PS_REG); PCL = 0xff; - FSR |= (uint8)(~m_picRAMmask); + FSR |= (uint8_t)(~m_picRAMmask); m_prescaler = 0; m_delay_timer = 0; m_inst_cycles = 0; m_count_pending = 0; } -void pic16c5x_reset(uint8 hard) +void pic16c5x_reset(uint8_t hard) { if (hard) { memset(m_internalram, 0, sizeof(m_internalram)); @@ -829,7 +829,7 @@ void pic16c5x_reset(uint8 hard) } } -void pic16c5x_set_config(uint16 data) +void pic16c5x_set_config(uint16_t data) { m_temp_config = data; } @@ -851,7 +851,7 @@ static INLINE void PIC16C5x_update_watchdog(int counts) if ((M_OPCODE_S0 != 3) && (M_OPCODE_S0 != 4)) { - uint16 old_WDT = m_WDT; + uint16_t old_WDT = m_WDT; m_WDT -= counts; @@ -943,14 +943,14 @@ void pic16c5x_run(void) PCL++; if (m_picmodel == 0x1650 || m_picmodel == 0x1655 || (M_OPCODE_S0 & 0xff0) != 0x000) { /* Do all opcodes except the 00? ones */ - uint8 b1 = (M_OPCODE_S0 >> 4) & 0xff; + uint8_t b1 = (M_OPCODE_S0 >> 4) & 0xff; m_inst_cycles = s_opcode_main_cycles[b1]; switch (b1) { #include "pic16c5x_ops_main.inc" } } else { /* Opcode 0x00? has many opcodes in its minor nibble */ - uint8 b1 = M_OPCODE_B0 & 0x1f; + uint8_t b1 = M_OPCODE_B0 & 0x1f; m_inst_cycles = s_opcode_00x_cycles[b1]; switch (b1) { #include "pic16c5x_ops_00x.inc" @@ -974,7 +974,7 @@ void pic16c5x_run(void) } } -void AddExState(void *v, uint32 s, int type, char *desc); +void AddExState(void *v, uint32_t s, int type, char *desc); void pic16c5x_add_statesinfo(void) { AddExState(&m_PC, sizeof(m_PC), 1, "PC00"); diff --git a/src/boards/pic16c5x.h b/src/boards/pic16c5x.h index 67c03dc..a9fb6e9 100644 --- a/src/boards/pic16c5x.h +++ b/src/boards/pic16c5x.h @@ -16,7 +16,7 @@ #include "../../fceu-types.h" -typedef uint8 (*pic16c5x_readfunc)(int); +typedef uint8_t (*pic16c5x_readfunc)(int); typedef void (*pic16c5x_writefunc)(int, int); enum { @@ -41,17 +41,17 @@ enum { * the value if known (available in HEX dumps of the ROM). */ void pic16c5x_set_input(int line, int state); -void pic16c5x_set_config(uint16 data); -void pic16c5x_reset(uint8 hard); +void pic16c5x_set_config(uint16_t data); +void pic16c5x_reset(uint8_t hard); void pic16c5x_run(void); void pic16c5x_add_statesinfo(void); -void pic16c54_init(uint8* rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr); -void pic16c55_init(uint8* rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr); -void pic16c56_init(uint8* rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr); -void pic16c57_init(uint8* rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr); -void pic16c58_init(uint8* rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr); -void pic1650_init(uint8* rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr); -void pic1655_init(uint8* rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr); +void pic16c54_init(uint8_t* rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr); +void pic16c55_init(uint8_t* rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr); +void pic16c56_init(uint8_t* rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr); +void pic16c57_init(uint8_t* rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr); +void pic16c58_init(uint8_t* rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr); +void pic1650_init(uint8_t* rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr); +void pic1655_init(uint8_t* rom, pic16c5x_readfunc _rd, pic16c5x_writefunc _wr); #endif /* _PIC16C5x_H */ diff --git a/src/boards/resetnromxin1.c b/src/boards/resetnromxin1.c index 0f0372f..ac708d9 100644 --- a/src/boards/resetnromxin1.c +++ b/src/boards/resetnromxin1.c @@ -29,7 +29,7 @@ #include "mapinc.h" -static uint8 gameblock, limit; +static uint8_t gameblock, limit; static SFORMAT StateRegs[] = { diff --git a/src/boards/resettxrom.c b/src/boards/resettxrom.c index 6d5537d..1f6eaa4 100644 --- a/src/boards/resettxrom.c +++ b/src/boards/resettxrom.c @@ -28,9 +28,9 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 submapper; +static uint8_t submapper; -static void M313CW(uint32 A, uint8 V) { +static void M313CW(uint32_t A, uint8_t V) { /*FCEU_printf("CHR: A:%04x V:%02x 0:%02x\n", A, V, EXPREGS[0]);*/ uint32_t bank; switch (submapper) { @@ -43,7 +43,7 @@ static void M313CW(uint32 A, uint8 V) { setchr1(A, bank); } -static void M313PW(uint32 A, uint8 V) { +static void M313PW(uint32_t A, uint8_t V) { /*FCEU_printf("PRG: A:%04x V:%02x 0:%02x\n", A, V, EXPREGS[0]);*/ uint32_t bank; switch (submapper) { diff --git a/src/boards/rt-01.c b/src/boards/rt-01.c index 866bb92..d69b46d 100644 --- a/src/boards/rt-01.c +++ b/src/boards/rt-01.c @@ -24,9 +24,24 @@ * */ -#include #include "mapinc.h" +/* Use a local xorshift32 instead of libc rand() so weak-bit reads are + * deterministic across runs and reproducible in replay/netplay. The + * sequence still appears "noisy" to the game's protection check (which + * just samples bits at runtime), but two emulator runs that read the + * same protected addresses in the same order will see the same bits. */ +static uint32_t weakbits_state = 0x13371337; + +static INLINE uint8_t weakbits_next(void) { + uint32_t x = weakbits_state; + x ^= x << 13; + x ^= x >> 17; + x ^= x << 5; + weakbits_state = x; + return (uint8_t)x; +} + static DECLFR(UNLRT01Read) { #if 0 u16 i, prot_areas[2][2] = { @@ -36,12 +51,13 @@ static DECLFR(UNLRT01Read) { #endif if(((A >= 0xCE80) && (A < 0xCF00)) || ((A >= 0xFE80) && (A < 0xFF00))) { - return 0xF2 | (rand() & 0x0D); + return 0xF2 | (weakbits_next() & 0x0D); } else return CartBR(A); } static void UNLRT01Power(void) { + weakbits_state = 0x13371337; /* deterministic at every power-on */ setprg16(0x8000, 0); setprg16(0xC000, 0); setchr2(0x0000,0); @@ -53,4 +69,7 @@ static void UNLRT01Power(void) { void UNLRT01_Init(CartInfo *info) { info->Power = UNLRT01Power; + /* Save weak-bits PRNG state so savestate/rewind/netplay round-trips + * stay deterministic. */ + AddExState(&weakbits_state, 4 | FCEUSTATE_RLSB, 0, "WBKS"); } diff --git a/src/boards/sachen.c b/src/boards/sachen.c index 7ee97a3..2a5c59b 100644 --- a/src/boards/sachen.c +++ b/src/boards/sachen.c @@ -23,9 +23,9 @@ #include "mapinc.h" -static uint8 cmd, dip; -static uint8 latch[8]; -static uint8 mapperNum; +static uint8_t cmd, dip; +static uint8_t latch[8]; +static uint8_t mapperNum; static int type; static void S8259Synco(void) { @@ -227,7 +227,7 @@ void SA0037_Init(CartInfo *info) { /* --------------------------------------------- */ static DECLFR(TCA01Read) { - uint8 ret; + uint8_t ret; if ((A & 0x4100) == 0x4100) ret = (X.DB & 0xC0) | ((~A) & 0x3F); else @@ -254,7 +254,7 @@ void TCA01_Init(CartInfo *info) { /* Mapper 243 - SA-020A */ static void S74LS374NSynco(void) { - uint32 chrBank; + uint32_t chrBank; if (mapperNum == 150) chrBank = (latch[6] & 3) | ((latch[4] << 2) & 4) | (latch[2] << 3); else @@ -272,7 +272,7 @@ static void S74LS374NSynco(void) { } static DECLFR(S74LS374NRead) { - uint8 ret; + uint8_t ret; if ((A & 0xC101) == 0x4101) { if (dip & 1) ret = (latch[cmd] & 3) | (X.DB & 0xFC); diff --git a/src/boards/sheroes.c b/src/boards/sheroes.c index ef84d04..b29936f 100644 --- a/src/boards/sheroes.c +++ b/src/boards/sheroes.c @@ -21,10 +21,10 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 *CHRRAM; -static uint8 tekker; +static uint8_t *CHRRAM; +static uint8_t tekker; -static void MSHCW(uint32 A, uint8 V) { +static void MSHCW(uint32_t A, uint8_t V) { if (EXPREGS[0] & 0x40) setchr8r(0x10, 0); else { @@ -73,7 +73,7 @@ void UNLSHeroes_Init(CartInfo *info) { info->Power = MSHPower; info->Reset = MSHReset; info->Close = MSHClose; - CHRRAM = (uint8*)FCEU_gmalloc(8192); + CHRRAM = (uint8_t*)FCEU_gmalloc(8192); SetupCartCHRMapping(0x10, CHRRAM, 8192, 1); AddExState(EXPREGS, 4, 0, "EXPR"); AddExState(&tekker, 1, 0, "DIPSW"); diff --git a/src/boards/subor.c b/src/boards/subor.c index 913bf27..6146d09 100644 --- a/src/boards/subor.c +++ b/src/boards/subor.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 is167, regs[4]; +static uint8_t is167, regs[4]; static SFORMAT StateRegs[] = { diff --git a/src/boards/super40in1.c b/src/boards/super40in1.c index 7d954be..4a61cf7 100644 --- a/src/boards/super40in1.c +++ b/src/boards/super40in1.c @@ -23,7 +23,7 @@ #include "mapinc.h" -static uint8 preg, creg, latch, dipSwitch; +static uint8_t preg, creg, latch, dipSwitch; static SFORMAT StateRegs[] = { diff --git a/src/boards/supervision.c b/src/boards/supervision.c index 43b67f5..ebab5de 100644 --- a/src/boards/supervision.c +++ b/src/boards/supervision.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 cmd0, cmd1; +static uint8_t cmd0, cmd1; static SFORMAT StateRegs[] = { { &cmd0, 1, "L1" }, diff --git a/src/boards/t-227-1.c b/src/boards/t-227-1.c index 847c9c0..25a7cff 100644 --- a/src/boards/t-227-1.c +++ b/src/boards/t-227-1.c @@ -23,10 +23,10 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 reset_flag = 0x07; +static uint8_t reset_flag = 0x07; -static void BMCT2271CW(uint32 A, uint8 V) { - uint32 va = V; +static void BMCT2271CW(uint32_t A, uint8_t V) { + uint32_t va = V; if (EXPREGS[0] & 0x20) { va |= 0x200; va |= (EXPREGS[0] & 0x10) << 4; @@ -37,8 +37,8 @@ static void BMCT2271CW(uint32 A, uint8 V) { setchr1(A, va); } -static void BMCT2271PW(uint32 A, uint8 V) { - uint32 va = V & 0x3F; +static void BMCT2271PW(uint32_t A, uint8_t V) { + uint32_t va = V & 0x3F; if (EXPREGS[0] & 0x20) { va &= 0x1F; va |= 0x40; @@ -71,7 +71,7 @@ static DECLFW(BMCT2271LoWrite) { } static DECLFR(BMCT2271HiRead) { - uint32 av = A; + uint32_t av = A; if (EXPREGS[0] & 0x40) av = (av & 0xFFF0) | reset_flag; return CartBR(av); } diff --git a/src/boards/t-262.c b/src/boards/t-262.c index ae8c818..66b07ed 100644 --- a/src/boards/t-262.c +++ b/src/boards/t-262.c @@ -20,7 +20,7 @@ #include "mapinc.h" -static uint8 bank, base, lock, mirr, mode; +static uint8_t bank, base, lock, mirr, mode; static SFORMAT StateRegs[] = { { &bank, 1, "BANK" }, diff --git a/src/boards/tengen.c b/src/boards/tengen.c index a3ed946..6abf140 100644 --- a/src/boards/tengen.c +++ b/src/boards/tengen.c @@ -24,10 +24,10 @@ #include "mapinc.h" -static uint8 cmd, mirr, regs[11]; -static uint8 rmode, IRQmode, IRQCount, IRQa, IRQLatch; +static uint8_t cmd, mirr, regs[11]; +static uint8_t rmode, IRQmode, IRQCount, IRQa, IRQLatch; -static void (*cwrap)(uint32 A, uint8 V); +static void (*cwrap)(uint32_t A, uint8_t V); static int _isM158; static SFORMAT StateRegs[] = { @@ -43,7 +43,7 @@ static SFORMAT StateRegs[] = { }; static void FP_FASTAPASS(1) RAMBO1IRQHook(int a) { - static int32 smallcount; + static int32_t smallcount; if (IRQmode) { smallcount += a; while (smallcount >= 4) { @@ -155,7 +155,7 @@ static void RAMBO1_Init(CartInfo *info) { AddExState(&StateRegs, ~0, 0, 0); } -static void M64CWRAP(uint32 A, uint8 V) { +static void M64CWRAP(uint32_t A, uint8_t V) { setchr1(A, V); } @@ -165,17 +165,17 @@ void Mapper64_Init(CartInfo *info) { RAMBO1_Init(info); } -static uint8 M158MIR[8]; -static uint8 PPUCHRBus; +static uint8_t M158MIR[8]; +static uint8_t PPUCHRBus; -static void FP_FASTAPASS(1) M158PPU(uint32 A) { +static void FP_FASTAPASS(1) M158PPU(uint32_t A) { A &= 0x1FFF; A >>= 10; PPUCHRBus = A; setmirror(MI_0 + M158MIR[A]); } -static void M158CWRAP(uint32 A, uint8 V) { +static void M158CWRAP(uint32_t A, uint8_t V) { M158MIR[A >> 10] = (V >> 7) & 1; setchr1(A, V); if (PPUCHRBus == (A >> 10)) diff --git a/src/boards/transformer.c b/src/boards/transformer.c index cef9514..2798dc7 100644 --- a/src/boards/transformer.c +++ b/src/boards/transformer.c @@ -33,8 +33,8 @@ #include "mapinc.h" -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; char *GetKeyboard(void); @@ -44,7 +44,7 @@ static int TransformerCycleCount, TransformerChar = 0; static void FP_FASTAPASS(1) TransformerIRQHook(int a) { TransformerCycleCount += a; if (TransformerCycleCount >= 1000) { - uint32 i; + uint32_t i; TransformerCycleCount -= 1000; TransformerKeys = GetKeyboard(); @@ -63,7 +63,7 @@ static void FP_FASTAPASS(1) TransformerIRQHook(int a) { } static DECLFR(TransformerRead) { - uint8 ret = 0; + uint8_t ret = 0; switch (A & 3) { case 0: ret = TransformerChar & 15; break; case 1: ret = (TransformerChar >> 4); break; @@ -99,7 +99,7 @@ void Transformer_Init(CartInfo *info) { info->Close = TransformerClose; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); if (info->battery) { info->SaveGame[0] = WRAM; diff --git a/src/boards/txcchip.c b/src/boards/txcchip.c index 69fbb56..5cb4b1a 100644 --- a/src/boards/txcchip.c +++ b/src/boards/txcchip.c @@ -52,15 +52,15 @@ #include "mapinc.h" typedef struct { - uint8 mask; - uint8 isJV001; - uint8 accumulator; - uint8 inverter; - uint8 staging; - uint8 output; - uint8 increase; - uint8 Y; - uint8 invert; + uint8_t mask; + uint8_t isJV001; + uint8_t accumulator; + uint8_t inverter; + uint8_t staging; + uint8_t output; + uint8_t increase; + uint8_t Y; + uint8_t invert; } TXC; static TXC txc; @@ -80,8 +80,8 @@ static SFORMAT StateRegs[] = { 0 } }; -static uint8 TXC_CMDRead(void) { - uint8 ret = ((txc.accumulator & txc.mask) | ((txc.inverter ^ txc.invert) & ~txc.mask)); +static uint8_t TXC_CMDRead(void) { + uint8_t ret = ((txc.accumulator & txc.mask) | ((txc.inverter ^ txc.invert) & ~txc.mask)); txc.Y = !txc.invert || ((ret & 0x10) != 0); WSync(); return ret; @@ -138,7 +138,7 @@ static void StateRestore(int version) { WSync(); } -static void GenTXC_Init(CartInfo *info, void (*proc)(void), uint32 jv001) { +static void GenTXC_Init(CartInfo *info, void (*proc)(void), uint32_t jv001) { txc.isJV001 = jv001; WSync = proc; GameStateRestore = StateRestore; @@ -147,12 +147,12 @@ static void GenTXC_Init(CartInfo *info, void (*proc)(void), uint32 jv001) { static int CheckHash(CartInfo *info) { int x = 0; - uint64 partialmd5 = 0; + uint64_t partialmd5 = 0; /* These carts do not work with new mapper implementation. * This is a hack to use previous mapper implementation for such carts. */ for (x = 0; x < 8; x++) - partialmd5 |= (uint64)info->MD5[15 - x] << (x * 8); + partialmd5 |= (uint64_t)info->MD5[15 - x] << (x * 8); switch (partialmd5) { case 0x2dd8f958850f21f4LL: /* Jin Gwok Sei Chuen Saang (Ch) [U][!] */ FCEU_printf(" WARNING: Using alternate mapper implementation.\n"); @@ -164,7 +164,7 @@ static int CheckHash(CartInfo *info) { /* --------------- Mapper 36 --------------- */ -static uint8 creg = 0; +static uint8_t creg = 0; static void M36Sync(void) { setprg32(0x8000, txc.output & 0x03); @@ -177,7 +177,7 @@ static DECLFW(M36Write) { } static DECLFR(M36Read) { - uint8 ret = X.DB; + uint8_t ret = X.DB; if ((A & 0x103) == 0x100) ret = (X.DB & 0xCF) | ((TXC_CMDRead() << 4) & 0x30); return ret; @@ -209,7 +209,7 @@ static DECLFW(M132Write) { } static DECLFR(M132Read) { - uint8 ret = X.DB; + uint8_t ret = X.DB; if ((A & 0x103) == 0x100) ret = ((X.DB & 0xF0) | (TXC_CMDRead() & 0x0F)); return ret; @@ -257,7 +257,7 @@ static DECLFW(M136Write) { } static DECLFR(M136Read) { - uint8 ret = X.DB; + uint8_t ret = X.DB; if ((A & 0x103) == 0x100) ret = ((X.DB & 0xC0) | (TXC_CMDRead() & 0x3F)); return ret; @@ -287,9 +287,9 @@ static DECLFW(M147Write) { } static DECLFR(M147Read) { - uint8 ret = X.DB; + uint8_t ret = X.DB; if ((A & 0x103) == 0x100) { - uint8 value = TXC_CMDRead(); + uint8_t value = TXC_CMDRead(); ret = ((value << 2) & 0xFC) | ((value >> 6) & 0x03); } return ret; @@ -315,7 +315,7 @@ static void M172Sync(void) { setmirror(txc.invert ? 1 : 0); } -static uint8 GetValue(uint8 value) { +static uint8_t GetValue(uint8_t value) { return (((value << 5) & 0x20) | ((value << 3) & 0x10) | ((value << 1) & 0x08) | ((value >> 1) & 0x04) | ((value >> 3) & 0x02) | ((value >> 5) & 0x01)); } @@ -325,7 +325,7 @@ static DECLFW(M172Write) { } static DECLFR(M172Read) { - uint8 ret = X.DB; + uint8_t ret = X.DB; if ((A & 0x103) == 0x100) ret = (X.DB & 0xC0) | GetValue(TXC_CMDRead()); return ret; @@ -345,7 +345,7 @@ void Mapper172_Init(CartInfo *info) { /* === LEGACY MAPPER IMPLEMENTATION === */ -static uint8 reg[4], cmd, is172, is173; +static uint8_t reg[4], cmd, is172, is173; static SFORMAT UNL22211StateRegs[] = { diff --git a/src/boards/unrom512.c b/src/boards/unrom512.c index 1da73f1..a96ce18 100644 --- a/src/boards/unrom512.c +++ b/src/boards/unrom512.c @@ -39,25 +39,25 @@ /* Workaround for libretro api compatibility */ #define ROM_size_max 32 #define flashdata_size (ROM_size_max * 0x4000) -#define flash_write_count_size (ROM_size_max * 4 * sizeof(uint32)) -static uint8 fceumm_flash_buf[flashdata_size + flash_write_count_size]; -static uint32 fceumm_flash_buf_size = sizeof(fceumm_flash_buf); +#define flash_write_count_size (ROM_size_max * 4 * sizeof(uint32_t)) +static uint8_t fceumm_flash_buf[flashdata_size + flash_write_count_size]; +static uint32_t fceumm_flash_buf_size = sizeof(fceumm_flash_buf); -static uint8 submapper; -static uint8 latche, latcheinit, bus_conflict, chrram_mask, software_id=0; -static uint16 latcha; -static uint8 *flashdata = fceumm_flash_buf + flash_write_count_size; -static uint32 *flash_write_count = (uint32*)fceumm_flash_buf; -static uint8 *FlashPage[32]; -/* static uint32 *FlashWriteCountPage[32]; */ -/* static uint8 flashloaded = 0; */ +static uint8_t submapper; +static uint8_t latche, latcheinit, bus_conflict, chrram_mask, software_id=0; +static uint16_t latcha; +static uint8_t *flashdata = fceumm_flash_buf + flash_write_count_size; +static uint32_t *flash_write_count = (uint32_t*)fceumm_flash_buf; +static uint8_t *FlashPage[32]; +/* static uint32_t *FlashWriteCountPage[32]; */ +/* static uint8_t flashloaded = 0; */ -static uint8 flash_save = 0, flash_state = 0, flash_mode = 0, flash_bank; +static uint8_t flash_save = 0, flash_state = 0, flash_mode = 0, flash_bank; static void (*WLSync)(void); static void (*WHSync)(void); -static INLINE void setfpageptr(int s, uint32 A, uint8 *p) { - uint32 AB = A >> 11; +static INLINE void setfpageptr(int s, uint32_t A, uint8_t *p) { + uint32_t AB = A >> 11; int x; if (p) @@ -70,13 +70,13 @@ static INLINE void setfpageptr(int s, uint32 A, uint8 *p) { } } -void setfprg16(uint32 A, uint32 V) { +void setfprg16(uint32_t A, uint32_t V) { if (PRGsize[0] >= 16384) { V &= PRGmask16[0]; setfpageptr(16, A, flashdata ? (&flashdata[V << 14]) : 0); } else { int x; - uint32 VA = V << 3; + uint32_t VA = V << 3; for (x = 0; x < 8; x++) setfpageptr(2, A + (x << 11), flashdata ? (&flashdata[((VA + x) & PRGmask2[0]) << 11]) : 0); @@ -88,35 +88,35 @@ void setfprg16(uint32 A, uint32 V) { * RAM. To keep .srm files portable between LE and BE builds, we always * store the counters as little-endian on disk; on BE hosts that means * byte-swapping at every counter access. */ -static INLINE uint32 fwc_load(uint32 idx) { +static INLINE uint32_t fwc_load(uint32_t idx) { #ifdef MSB_FIRST - uint8 *p = (uint8 *)&flash_write_count[idx]; - return (uint32)p[0] | ((uint32)p[1] << 8) | ((uint32)p[2] << 16) | ((uint32)p[3] << 24); + uint8_t *p = (uint8_t *)&flash_write_count[idx]; + return (uint32_t)p[0] | ((uint32_t)p[1] << 8) | ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24); #else return flash_write_count[idx]; #endif } -static INLINE void fwc_store(uint32 idx, uint32 v) { +static INLINE void fwc_store(uint32_t idx, uint32_t v) { #ifdef MSB_FIRST - uint8 *p = (uint8 *)&flash_write_count[idx]; - p[0] = (uint8)v; - p[1] = (uint8)(v >> 8); - p[2] = (uint8)(v >> 16); - p[3] = (uint8)(v >> 24); + uint8_t *p = (uint8_t *)&flash_write_count[idx]; + p[0] = (uint8_t)v; + p[1] = (uint8_t)(v >> 8); + p[2] = (uint8_t)(v >> 16); + p[3] = (uint8_t)(v >> 24); #else flash_write_count[idx] = v; #endif } -void inc_flash_write_count(uint8 bank, uint32 A) { - uint32 idx = (bank * 4) + ((A & 0x3000) >> 12); - uint32 v = fwc_load(idx) + 1; +void inc_flash_write_count(uint8_t bank, uint32_t A) { + uint32_t idx = (bank * 4) + ((A & 0x3000) >> 12); + uint32_t v = fwc_load(idx) + 1; if (v == 0) v = 1; /* avoid wrap to 0 (which means "never written") */ fwc_store(idx, v); } -uint32 GetFlashWriteCount(uint8 bank, uint32 A) { +uint32_t GetFlashWriteCount(uint8_t bank, uint32_t A) { return fwc_load((bank * 4) + ((A & 0x3000) >> 12)); } @@ -147,7 +147,7 @@ static DECLFW(UNROM512HLatchWrite) { } static DECLFR(UNROM512LatchRead) { - uint8 flash_id[3] = { 0xB5, 0xB6, 0xB7 }; + uint8_t flash_id[3] = { 0xB5, 0xB6, 0xB7 }; if (software_id) { if (A & 1) return flash_id[ROM_size >> 4]; @@ -213,7 +213,7 @@ static void UNROM512LSync(void) { memset(&FlashPage[(latcha & 0xF000) >> 11][latcha & 0xF000], 0xFF, 0x1000); } else if (latche == 0x10) { - uint32 i; + uint32_t i; for(i = 0; i < (ROM_size * 4); i++) inc_flash_write_count(i >> 2,i << 12); memset(flashdata, 0xFF, ROM_size * 0x4000); /* Erasing the rom chip as instructed. Crash rate calulated to be 99.9% :) */ @@ -290,7 +290,7 @@ void UNROM512_Init(CartInfo *info) { { info->SaveGame[0] = fceumm_flash_buf; info->SaveGameLen[0] = fceumm_flash_buf_size; - AddExState(flash_write_count,ROM_size * 4 * sizeof(uint32), 0, "FLASH_WRITE_COUNT"); + AddExState(flash_write_count,ROM_size * 4 * sizeof(uint32_t), 0, "FLASH_WRITE_COUNT"); AddExState(flashdata,ROM_size * 0x4000, 0, "FLASH_DATA"); AddExState(&flash_state, 1, 0, "FLASH_STATE"); AddExState(&flash_mode, 1, 0, "FLASH_MODE"); diff --git a/src/boards/vrc1.c b/src/boards/vrc1.c index eec2d9d..4b9f8e1 100644 --- a/src/boards/vrc1.c +++ b/src/boards/vrc1.c @@ -23,7 +23,7 @@ #include "mapinc.h" -static uint8 preg[3], creg[2], mode; +static uint8_t preg[3], creg[2], mode; static SFORMAT StateRegs[] = { { &mode, 1, "MODE" }, diff --git a/src/boards/vrc3.c b/src/boards/vrc3.c index 59be687..adf6962 100644 --- a/src/boards/vrc3.c +++ b/src/boards/vrc3.c @@ -23,13 +23,13 @@ #include "mapinc.h" -static uint8 preg; -static uint8 IRQx; /* autoenable */ -static uint8 IRQm; /* mode */ -static uint8 IRQa; -static uint16 IRQReload, IRQCount; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t preg; +static uint8_t IRQx; /* autoenable */ +static uint8_t IRQm; /* mode */ +static uint8_t IRQa; +static uint16_t IRQReload, IRQCount; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -74,16 +74,16 @@ static DECLFW(M73Write) { } static void M73IRQHook(int a) { - int32 i; + int32_t i; if (!IRQa) return; for (i = 0; i < a; i++) { if (IRQm) { - uint16 temp = IRQCount; + uint16_t temp = IRQCount; temp &= 0xFF; IRQCount &= 0xFF00; if (temp == 0xFF) { IRQCount = IRQReload; - IRQCount |= (uint16)(IRQReload & 0xFF); + IRQCount |= (uint16_t)(IRQReload & 0xFF); X6502_IRQBegin(FCEU_IQEXT); } else { temp++; @@ -125,7 +125,7 @@ void Mapper73_Init(CartInfo *info) { MapIRQHook = M73IRQHook; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); diff --git a/src/boards/vrc6.c b/src/boards/vrc6.c index b58881f..90318e4 100644 --- a/src/boards/vrc6.c +++ b/src/boards/vrc6.c @@ -23,12 +23,12 @@ #include "mapinc.h" -static uint8 is26; -static uint8 prg[2], chr[8], mirr; -static uint8 IRQLatch, IRQa, IRQd; -static int32 IRQCount, CycleCount; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t is26; +static uint8_t prg[2], chr[8], mirr; +static uint8_t IRQLatch, IRQa, IRQd; +static int32_t IRQCount, CycleCount; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -45,12 +45,12 @@ static SFORMAT StateRegs[] = static void(*sfun[3]) (void); -static uint8 vpsg1[8]; -static uint8 vpsg2[4]; -static int32 cvbc[3]; -static int32 vcount[3]; -static int32 dcount[3]; -static int32 phaseacc; +static uint8_t vpsg1[8]; +static uint8_t vpsg2[4]; +static int32_t cvbc[3]; +static int32_t vcount[3]; +static int32_t dcount[3]; +static int32_t phaseacc; static SFORMAT SStateRegs[] = { @@ -75,7 +75,7 @@ static SFORMAT SStateRegs[] = }; static void Sync(void) { - uint8 i; + uint8_t i; if (is26) setprg8r(0x10, 0x6000, 0); setprg16(0x8000, prg[0]); @@ -178,9 +178,9 @@ static void DoSQV2(void); static void DoSawV(void); static INLINE void DoSQV(int x) { - int32 V; - int32 amp = (((vpsg1[x << 2] & 15) << 8) * 6 / 8) >> 4; - int32 start, end; + int32_t V; + int32_t amp = (((vpsg1[x << 2] & 15) << 8) * 6 / 8) >> 4; + int32_t start, end; start = cvbc[x]; end = (SOUNDTS << 16) / soundtsinc; @@ -192,10 +192,10 @@ static INLINE void DoSQV(int x) { for (V = start; V < end; V++) Wave[V >> 4] += amp; } else { - int32 thresh = (vpsg1[x << 2] >> 4) & 7; - int32 freq = ((vpsg1[(x << 2) | 0x1] | ((vpsg1[(x << 2) | 0x2] & 15) << 8)) + 1) << 17; - int32 dc = dcount[x]; - int32 vc = vcount[x]; + int32_t thresh = (vpsg1[x << 2] >> 4) & 7; + int32_t freq = ((vpsg1[(x << 2) | 0x1] | ((vpsg1[(x << 2) | 0x2] & 15) << 8)) + 1) << 17; + int32_t dc = dcount[x]; + int32_t vc = vcount[x]; for (V = start; V < end; V++) { if (dc > thresh) @@ -222,7 +222,7 @@ static void DoSQV2(void) { static void DoSawV(void) { int V; - int32 start, end; + int32_t start, end; start = cvbc[2]; end = (SOUNDTS << 16) / soundtsinc; @@ -230,15 +230,15 @@ static void DoSawV(void) { cvbc[2] = end; if (vpsg2[2] & 0x80) { - uint32 freq3; - static uint32 duff = 0; + uint32_t freq3; + static uint32_t duff = 0; freq3 = (vpsg2[1] + ((vpsg2[2] & 15) << 8) + 1); for (V = start; V < end; V++) { vcount[2] -= nesincsize; if (vcount[2] <= 0) { - int32 t; + int32_t t; rea: t = freq3; t <<= 18; @@ -259,17 +259,17 @@ static void DoSawV(void) { } static INLINE void DoSQVHQ(int x) { - int32 V; - int32 amp = ((vpsg1[x << 2] & 15) << 8) * 6 / 8; + int32_t V; + int32_t amp = ((vpsg1[x << 2] & 15) << 8) * 6 / 8; if (vpsg1[(x << 2) | 0x2] & 0x80) { if (vpsg1[x << 2] & 0x80) { for (V = cvbc[x]; V < (int)SOUNDTS; V++) WaveHi[V] += amp; } else { - int32 thresh = (vpsg1[x << 2] >> 4) & 7; - int32 dc = dcount[x]; - int32 vc = vcount[x]; + int32_t thresh = (vpsg1[x << 2] >> 4) & 7; + int32_t dc = dcount[x]; + int32_t vc = vcount[x]; for (V = cvbc[x]; V < (int)SOUNDTS; V++) { if (dc > thresh) @@ -296,7 +296,7 @@ static void DoSQV2HQ(void) { } static void DoSawVHQ(void) { - int32 V; + int32_t V; if (vpsg2[2] & 0x80) { for (V = cvbc[2]; V < (int)SOUNDTS; V++) { @@ -332,7 +332,7 @@ void VRC6SoundHQ(void) { DoSawVHQ(); } -void VRC6SyncHQ(int32 ts) { +void VRC6SyncHQ(int32_t ts) { int x; for (x = 0; x < 3; x++) cvbc[x] = ts; } @@ -382,7 +382,7 @@ void Mapper26_Init(CartInfo *info) { GameStateRestore = StateRestore; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); if (info->battery) { diff --git a/src/boards/vrc7.c b/src/boards/vrc7.c index 694d159..e0c462e 100644 --- a/src/boards/vrc7.c +++ b/src/boards/vrc7.c @@ -21,13 +21,13 @@ #include "mapinc.h" #include "emu2413.h" -static int32 dwave = 0; +static int32_t dwave = 0; static OPLL *VRC7Sound = NULL; -static uint8 vrc7idx, preg[3], creg[8], mirr; -static uint8 IRQLatch, IRQa, IRQd; -static int32 IRQCount, CycleCount; -static uint8 *WRAM = NULL; -static uint32 WRAMSIZE; +static uint8_t vrc7idx, preg[3], creg[8], mirr; +static uint8_t IRQLatch, IRQa, IRQd; +static int32_t IRQCount, CycleCount; +static uint8_t *WRAM = NULL; +static uint32_t WRAMSIZE; static SFORMAT StateRegs[] = { @@ -46,7 +46,7 @@ static SFORMAT StateRegs[] = /* VRC7 Sound */ void DoVRC7Sound(void) { - int32 z, a; + int32_t z, a; if (FSettings.soundq >= 1) return; z = ((SOUNDTS << 16) / soundtsinc) >> 4; @@ -55,12 +55,12 @@ void DoVRC7Sound(void) { dwave += a; } -void UpdateOPLNEO(int32 *Wave, int Count) { +void UpdateOPLNEO(int32_t *Wave, int Count) { OPLL_fillbuf(VRC7Sound, Wave, Count, 4); } void UpdateOPL(int Count) { - int32 z, a; + int32_t z, a; z = ((SOUNDTS << 16) / soundtsinc) >> 4; a = z - dwave; if (VRC7Sound && a) @@ -90,7 +90,7 @@ static void VRC7_ESI(void) { /* VRC7 Sound */ static void Sync(void) { - uint8 i; + uint8_t i; setprg8r(0x10, 0x6000, 0); setprg8(0x8000, preg[0]); setprg8(0xA000, preg[1]); @@ -185,7 +185,7 @@ void Mapper85_Init(CartInfo *info) { info->Close = VRC7Close; MapIRQHook = VRC7IRQHook; WRAMSIZE = 8192; - WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); + WRAM = (uint8_t*)FCEU_gmalloc(WRAMSIZE); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); AddExState(WRAM, WRAMSIZE, 0, "WRAM"); if (info->battery) { @@ -218,7 +218,7 @@ void Mapper85_Init(CartInfo *info) { AddExState(&VRC7Sound->patch_number, sizeof(VRC7Sound->patch_number), 0, "PNUM"); AddExState(&VRC7Sound->key_status, sizeof(VRC7Sound->key_status), 0, "KET"); AddExState(&VRC7Sound->mask, sizeof(VRC7Sound->mask), 0, "MASK"); - AddExState((uint8 *)VRC7Sound->slot, sizeof(VRC7Sound->slot), 0, "SLOT"); + AddExState((uint8_t *)VRC7Sound->slot, sizeof(VRC7Sound->slot), 0, "SLOT"); #endif } diff --git a/src/boards/vrc7p.c b/src/boards/vrc7p.c index 4e70a05..5c28e2f 100644 --- a/src/boards/vrc7p.c +++ b/src/boards/vrc7p.c @@ -22,9 +22,9 @@ #include "mapinc.h" -static uint8 prg[3], chr[8], mirr; -static uint8 IRQLatch, IRQa, IRQd; -static int32 IRQCount, CycleCount; +static uint8_t prg[3], chr[8], mirr; +static uint8_t IRQLatch, IRQa, IRQd; +static int32_t IRQCount, CycleCount; static SFORMAT StateRegs[] = { @@ -40,7 +40,7 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { - uint8 i; + uint8_t i; setprg8(0x8000, prg[0]); setprg8(0xa000, prg[1]); setprg8(0xc000, prg[2]); diff --git a/src/boards/vrcirq.c b/src/boards/vrcirq.c index 4639170..524a337 100644 --- a/src/boards/vrcirq.c +++ b/src/boards/vrcirq.c @@ -1,12 +1,12 @@ #include "mapinc.h" #include "vrcirq.h" -static int16 IRQPrescaler; -static uint8 IRQCount; -static uint8 IRQLatch; -static uint8 IRQd; -static uint8 IRQa; -static uint8 IRQm; +static int16_t IRQPrescaler; +static uint8_t IRQCount; +static uint8_t IRQLatch; +static uint8_t IRQd; +static uint8_t IRQa; +static uint8_t IRQm; static SFORMAT StateRegs[] = { @@ -56,12 +56,12 @@ void VRCIRQ_Init(void) AddExState(&StateRegs, ~0, 0, 0); } -void VRCIRQ_Latch(uint8 V) +void VRCIRQ_Latch(uint8_t V) { IRQLatch = V; } -void VRCIRQ_LatchNibble(uint8 V, uint8 highBit) +void VRCIRQ_LatchNibble(uint8_t V, uint8_t highBit) { if (highBit) { IRQLatch &= 0x0F; @@ -72,7 +72,7 @@ void VRCIRQ_LatchNibble(uint8 V, uint8 highBit) } } -void VRCIRQ_Control(uint8 V) +void VRCIRQ_Control(uint8_t V) { IRQd = (V & 0x01) == 0x01; IRQa = (V & 0x02) == 0x02; diff --git a/src/boards/vrcirq.h b/src/boards/vrcirq.h index 5a98137..5a7cf13 100644 --- a/src/boards/vrcirq.h +++ b/src/boards/vrcirq.h @@ -2,9 +2,9 @@ #define _VRCIRQ_H void VRCIRQ_Init(void); -void VRCIRQ_Latch(uint8 V); -void VRCIRQ_LatchNibble(uint8 V, uint8 highBit); -void VRCIRQ_Control(uint8 V); +void VRCIRQ_Latch(uint8_t V); +void VRCIRQ_LatchNibble(uint8_t V, uint8_t highBit); +void VRCIRQ_Control(uint8_t V); void VRCIRQ_Acknowledge(void); #endif /* _VRCIRQ_H */ \ No newline at end of file diff --git a/src/cart.c b/src/cart.c index 05b595c..cde8275 100644 --- a/src/cart.c +++ b/src/cart.c @@ -41,46 +41,46 @@ It's also (ab)used by the NSF code. */ -uint8 *Page[32], *VPage[8]; -uint8 **VPageR = VPage; -uint8 *VPageG[8]; -uint8 *MMC5SPRVPage[8]; -uint8 *MMC5BGVPage[8]; +uint8_t *Page[32], *VPage[8]; +uint8_t **VPageR = VPage; +uint8_t *VPageG[8]; +uint8_t *MMC5SPRVPage[8]; +uint8_t *MMC5BGVPage[8]; -static uint8 PRGIsRAM[32]; /* This page is/is not PRG RAM. */ +static uint8_t PRGIsRAM[32]; /* This page is/is not PRG RAM. */ /* 16 are (sort of) reserved for UNIF/iNES and 16 to map other stuff. */ static int CHRram[32]; static int PRGram[32]; -uint8 *PRGptr[32]; -uint8 *CHRptr[32]; +uint8_t *PRGptr[32]; +uint8_t *CHRptr[32]; -uint32 PRGsize[32]; -uint32 CHRsize[32]; +uint32_t PRGsize[32]; +uint32_t CHRsize[32]; -uint32 PRGmask2[32]; -uint32 PRGmask4[32]; -uint32 PRGmask8[32]; -uint32 PRGmask16[32]; -uint32 PRGmask32[32]; +uint32_t PRGmask2[32]; +uint32_t PRGmask4[32]; +uint32_t PRGmask8[32]; +uint32_t PRGmask16[32]; +uint32_t PRGmask32[32]; -uint32 CHRmask1[32]; -uint32 CHRmask2[32]; -uint32 CHRmask4[32]; -uint32 CHRmask8[32]; +uint32_t CHRmask1[32]; +uint32_t CHRmask2[32]; +uint32_t CHRmask4[32]; +uint32_t CHRmask8[32]; int geniestage = 0; int modcon; -uint8 genieval[3]; -uint8 geniech[3]; +uint8_t genieval[3]; +uint8_t geniech[3]; -uint32 genieaddr[3]; +uint32_t genieaddr[3]; -static INLINE void setpageptr(int s, uint32 A, uint8 *p, int ram) { - uint32 AB = A >> 11; +static INLINE void setpageptr(int s, uint32_t A, uint8_t *p, int ram) { + uint32_t AB = A >> 11; int x; if (p) @@ -95,7 +95,7 @@ static INLINE void setpageptr(int s, uint32 A, uint8 *p, int ram) { } } -static uint8 nothing[8192]; +static uint8_t nothing[8192]; void ResetCartMapping(void) { int x; @@ -109,7 +109,7 @@ void ResetCartMapping(void) { } } -void SetupCartPRGMapping(int chip, uint8 *p, uint32 size, int ram) { +void SetupCartPRGMapping(int chip, uint8_t *p, uint32_t size, int ram) { PRGptr[chip] = p; PRGsize[chip] = size; @@ -122,7 +122,7 @@ void SetupCartPRGMapping(int chip, uint8 *p, uint32 size, int ram) { PRGram[chip] = ram ? 1 : 0; } -void SetupCartCHRMapping(int chip, uint8 *p, uint32 size, int ram) { +void SetupCartCHRMapping(int chip, uint8_t *p, uint32_t size, int ram) { CHRptr[chip] = p; CHRsize[chip] = size; @@ -150,7 +150,7 @@ DECLFR(CartBROB) { return Page[A >> 11][A]; } -void FASTAPASS(3) setprg2r(int r, uint32 A, uint32 V) { +void FASTAPASS(3) setprg2r(int r, uint32_t A, uint32_t V) { /* If the registered chip size is < 2KB, PRGmask2[r] underflowed to * 0xFFFFFFFF in SetupCartPRGMapping. Clear the page rather than * indexing past PRGptr[r]. (The only currently-shipped caller that @@ -165,17 +165,17 @@ void FASTAPASS(3) setprg2r(int r, uint32 A, uint32 V) { setpageptr(2, A, &PRGptr[r][V << 11], PRGram[r]); } -void FASTAPASS(2) setprg2(uint32 A, uint32 V) { +void FASTAPASS(2) setprg2(uint32_t A, uint32_t V) { setprg2r(0, A, V); } -void FASTAPASS(3) setprg4r(int r, uint32 A, uint32 V) { +void FASTAPASS(3) setprg4r(int r, uint32_t A, uint32_t V) { if (!PRGptr[r] || PRGsize[r] < 4096) { /* Fall back to two 2KB pages if size is at least 2KB; else * clear both 2KB pages. */ if (PRGptr[r] && PRGsize[r] >= 2048) { - uint32 mask2 = PRGmask2[r]; - uint32 VA = V << 1; + uint32_t mask2 = PRGmask2[r]; + uint32_t VA = V << 1; int x; for (x = 0; x < 2; x++) setpageptr(2, A + (x << 11), &PRGptr[r][((VA + x) & mask2) << 11], PRGram[r]); @@ -189,32 +189,32 @@ void FASTAPASS(3) setprg4r(int r, uint32 A, uint32 V) { setpageptr(4, A, &PRGptr[r][V << 12], PRGram[r]); } -void FASTAPASS(2) setprg4(uint32 A, uint32 V) { +void FASTAPASS(2) setprg4(uint32_t A, uint32_t V) { setprg4r(0, A, V); } -void FASTAPASS(3) setprg8r(int r, uint32 A, uint32 V) { +void FASTAPASS(3) setprg8r(int r, uint32_t A, uint32_t V) { if (PRGsize[r] >= 8192) { V &= PRGmask8[r]; setpageptr(8, A, PRGptr[r] ? (&PRGptr[r][V << 13]) : 0, PRGram[r]); } else { - uint32 VA = V << 2; + uint32_t VA = V << 2; int x; for (x = 0; x < 4; x++) setpageptr(2, A + (x << 11), PRGptr[r] ? (&PRGptr[r][((VA + x) & PRGmask2[r]) << 11]) : 0, PRGram[r]); } } -void FASTAPASS(2) setprg8(uint32 A, uint32 V) { +void FASTAPASS(2) setprg8(uint32_t A, uint32_t V) { setprg8r(0, A, V); } -void FASTAPASS(3) setprg16r(int r, uint32 A, uint32 V) { +void FASTAPASS(3) setprg16r(int r, uint32_t A, uint32_t V) { if (PRGsize[r] >= 16384) { V &= PRGmask16[r]; setpageptr(16, A, PRGptr[r] ? (&PRGptr[r][V << 14]) : 0, PRGram[r]); } else { - uint32 VA = V << 3; + uint32_t VA = V << 3; int x; for (x = 0; x < 8; x++) @@ -222,16 +222,16 @@ void FASTAPASS(3) setprg16r(int r, uint32 A, uint32 V) { } } -void FASTAPASS(2) setprg16(uint32 A, uint32 V) { +void FASTAPASS(2) setprg16(uint32_t A, uint32_t V) { setprg16r(0, A, V); } -void FASTAPASS(3) setprg32r(int r, uint32 A, uint32 V) { +void FASTAPASS(3) setprg32r(int r, uint32_t A, uint32_t V) { if (PRGsize[r] >= 32768) { V &= PRGmask32[r]; setpageptr(32, A, PRGptr[r] ? (&PRGptr[r][V << 15]) : 0, PRGram[r]); } else { - uint32 VA = V << 4; + uint32_t VA = V << 4; int x; for (x = 0; x < 16; x++) @@ -239,11 +239,11 @@ void FASTAPASS(3) setprg32r(int r, uint32 A, uint32 V) { } } -void FASTAPASS(2) setprg32(uint32 A, uint32 V) { +void FASTAPASS(2) setprg32(uint32_t A, uint32_t V) { setprg32r(0, A, V); } -void FASTAPASS(3) setchr1r(int r, uint32 A, uint32 V) { +void FASTAPASS(3) setchr1r(int r, uint32_t A, uint32_t V) { if (!CHRptr[r]) return; if (CHRsize[r] < 1024) return; /* mask underflow guard */ FCEUPPU_LineUpdate(); @@ -255,7 +255,7 @@ void FASTAPASS(3) setchr1r(int r, uint32 A, uint32 V) { VPageR[(A) >> 10] = &CHRptr[r][(V) << 10] - (A); } -void FASTAPASS(3) setchr2r(int r, uint32 A, uint32 V) { +void FASTAPASS(3) setchr2r(int r, uint32_t A, uint32_t V) { if (!CHRptr[r]) return; if (CHRsize[r] < 2048) return; /* mask underflow guard */ FCEUPPU_LineUpdate(); @@ -267,7 +267,7 @@ void FASTAPASS(3) setchr2r(int r, uint32 A, uint32 V) { PPUCHRRAM &= ~(3 << (A >> 10)); } -void FASTAPASS(3) setchr4r(int r, uint32 A, uint32 V) { +void FASTAPASS(3) setchr4r(int r, uint32_t A, uint32_t V) { if (!CHRptr[r]) return; if (CHRsize[r] < 4096) return; /* mask underflow guard */ FCEUPPU_LineUpdate(); @@ -280,7 +280,7 @@ void FASTAPASS(3) setchr4r(int r, uint32 A, uint32 V) { PPUCHRRAM &= ~(15 << (A >> 10)); } -void FASTAPASS(2) setchr8r(int r, uint32 V) { +void FASTAPASS(2) setchr8r(int r, uint32_t V) { int x; if (!CHRptr[r]) return; @@ -302,25 +302,25 @@ void FASTAPASS(2) setchr8r(int r, uint32 V) { PPUCHRRAM = 0; } -void FASTAPASS(2) setchr1(uint32 A, uint32 V) { +void FASTAPASS(2) setchr1(uint32_t A, uint32_t V) { setchr1r(0, A, V); } -void FASTAPASS(2) setchr2(uint32 A, uint32 V) { +void FASTAPASS(2) setchr2(uint32_t A, uint32_t V) { setchr2r(0, A, V); } -void FASTAPASS(2) setchr4(uint32 A, uint32 V) { +void FASTAPASS(2) setchr4(uint32_t A, uint32_t V) { setchr4r(0, A, V); } -void FASTAPASS(1) setchr8(uint32 V) { +void FASTAPASS(1) setchr8(uint32_t V) { setchr8r(0, V); } /* This function can be called without calling SetupCartMirroring(). */ -void FASTAPASS(3) setntamem(uint8 * p, int ram, uint32 b) { +void FASTAPASS(3) setntamem(uint8_t * p, int ram, uint32_t b) { FCEUPPU_LineUpdate(); vnapage[b] = p; PPUNTARAM &= ~(1 << b); @@ -358,7 +358,7 @@ void FASTAPASS(1) setmirror(int t) { } } -void SetupCartMirroring(int m, int hard, uint8 *extra) { +void SetupCartMirroring(int m, int hard, uint8_t *extra) { if (m < 4) { mirrorhard = 0; setmirror(m); @@ -372,7 +372,7 @@ void SetupCartMirroring(int m, int hard, uint8 *extra) { mirrorhard = hard; } -static uint8 *GENIEROM = 0; +static uint8_t *GENIEROM = 0; void FixGenieMap(void); @@ -384,7 +384,7 @@ void FCEU_OpenGenie(void) { if (!GENIEROM) { char *fn; - if (!(GENIEROM = (uint8*)FCEU_malloc(4096 + 1024))) return; + if (!(GENIEROM = (uint8_t*)FCEU_malloc(4096 + 1024))) return; fn = FCEU_MakeFName(FCEUMKF_GGROM, 0, 0); @@ -485,7 +485,7 @@ static DECLFW(GenieWrite) { static readfunc GenieBackup[3]; static DECLFR(GenieFix1) { - uint8 r = GenieBackup[0](A); + uint8_t r = GenieBackup[0](A); if ((modcon >> 1) & 1) /* No check */ return genieval[0]; @@ -496,7 +496,7 @@ static DECLFR(GenieFix1) { } static DECLFR(GenieFix2) { - uint8 r = GenieBackup[1](A); + uint8_t r = GenieBackup[1](A); if ((modcon >> 2) & 1) /* No check */ return genieval[1]; @@ -507,7 +507,7 @@ static DECLFR(GenieFix2) { } static DECLFR(GenieFix3) { - uint8 r = GenieBackup[2](A); + uint8_t r = GenieBackup[2](A); if ((modcon >> 3) & 1) /* No check */ return genieval[2]; @@ -537,7 +537,7 @@ void FixGenieMap(void) { } void FCEU_GeniePower(void) { - uint32 x; + uint32_t x; if (!geniestage) return; diff --git a/src/cart.h b/src/cart.h index ed0f4e3..1861d55 100644 --- a/src/cart.h +++ b/src/cart.h @@ -6,8 +6,8 @@ typedef struct { void (*Power)(void); void (*Reset)(void); void (*Close)(void); - uint8 *SaveGame[4]; /* Pointers to memory to save/load. */ - uint32 SaveGameLen[4]; /* How much memory to save/load. */ + uint8_t *SaveGame[4]; /* Pointers to memory to save/load. */ + uint32_t SaveGameLen[4]; /* How much memory to save/load. */ /* Set by iNES/UNIF loading code. */ int iNES2; /* iNES version */ @@ -28,71 +28,71 @@ typedef struct { int CHRRamSaveSize; /* chr ram size in bytes (non-volatile or battery backed) */ int miscROMSize; int miscROMNumber; - uint64 totalFileSize; + uint64_t totalFileSize; int region; /* video system timing (ntsc, pal, dendy */ - uint8 MD5[16]; - uint32 PRGCRC32; - uint32 CHRCRC32; - uint32 CRC32; /* Should be set by the iNES/UNIF loading + uint8_t MD5[16]; + uint32_t PRGCRC32; + uint32_t CHRCRC32; + uint32_t CRC32; /* Should be set by the iNES/UNIF loading * code, used by mapper/board code, maybe * other code in the future. */ } CartInfo; -extern uint8 *Page[32], *VPage[8], *MMC5SPRVPage[8], *MMC5BGVPage[8]; +extern uint8_t *Page[32], *VPage[8], *MMC5SPRVPage[8], *MMC5BGVPage[8]; void ResetCartMapping(void); -void SetupCartPRGMapping(int chip, uint8 *p, uint32 size, int ram); -void SetupCartCHRMapping(int chip, uint8 *p, uint32 size, int ram); -void SetupCartMirroring(int m, int hard, uint8 *extra); +void SetupCartPRGMapping(int chip, uint8_t *p, uint32_t size, int ram); +void SetupCartCHRMapping(int chip, uint8_t *p, uint32_t size, int ram); +void SetupCartMirroring(int m, int hard, uint8_t *extra); DECLFR(CartBROB); DECLFR(CartBR); DECLFW(CartBW); -extern uint8 *PRGptr[32]; -extern uint8 *CHRptr[32]; +extern uint8_t *PRGptr[32]; +extern uint8_t *CHRptr[32]; -extern uint32 PRGsize[32]; -extern uint32 CHRsize[32]; +extern uint32_t PRGsize[32]; +extern uint32_t CHRsize[32]; -extern uint32 PRGmask2[32]; -extern uint32 PRGmask4[32]; -extern uint32 PRGmask8[32]; -extern uint32 PRGmask16[32]; -extern uint32 PRGmask32[32]; +extern uint32_t PRGmask2[32]; +extern uint32_t PRGmask4[32]; +extern uint32_t PRGmask8[32]; +extern uint32_t PRGmask16[32]; +extern uint32_t PRGmask32[32]; -extern uint32 CHRmask1[32]; -extern uint32 CHRmask2[32]; -extern uint32 CHRmask4[32]; -extern uint32 CHRmask8[32]; +extern uint32_t CHRmask1[32]; +extern uint32_t CHRmask2[32]; +extern uint32_t CHRmask4[32]; +extern uint32_t CHRmask8[32]; -void FASTAPASS(2) setprg2(uint32 A, uint32 V); -void FASTAPASS(2) setprg4(uint32 A, uint32 V); -void FASTAPASS(2) setprg8(uint32 A, uint32 V); -void FASTAPASS(2) setprg16(uint32 A, uint32 V); -void FASTAPASS(2) setprg32(uint32 A, uint32 V); +void FASTAPASS(2) setprg2(uint32_t A, uint32_t V); +void FASTAPASS(2) setprg4(uint32_t A, uint32_t V); +void FASTAPASS(2) setprg8(uint32_t A, uint32_t V); +void FASTAPASS(2) setprg16(uint32_t A, uint32_t V); +void FASTAPASS(2) setprg32(uint32_t A, uint32_t V); -void FASTAPASS(3) setprg2r(int r, uint32 A, uint32 V); -void FASTAPASS(3) setprg4r(int r, uint32 A, uint32 V); -void FASTAPASS(3) setprg8r(int r, uint32 A, uint32 V); -void FASTAPASS(3) setprg16r(int r, uint32 A, uint32 V); -void FASTAPASS(3) setprg32r(int r, uint32 A, uint32 V); +void FASTAPASS(3) setprg2r(int r, uint32_t A, uint32_t V); +void FASTAPASS(3) setprg4r(int r, uint32_t A, uint32_t V); +void FASTAPASS(3) setprg8r(int r, uint32_t A, uint32_t V); +void FASTAPASS(3) setprg16r(int r, uint32_t A, uint32_t V); +void FASTAPASS(3) setprg32r(int r, uint32_t A, uint32_t V); -void FASTAPASS(3) setchr1r(int r, uint32 A, uint32 V); -void FASTAPASS(3) setchr2r(int r, uint32 A, uint32 V); -void FASTAPASS(3) setchr4r(int r, uint32 A, uint32 V); -void FASTAPASS(2) setchr8r(int r, uint32 V); +void FASTAPASS(3) setchr1r(int r, uint32_t A, uint32_t V); +void FASTAPASS(3) setchr2r(int r, uint32_t A, uint32_t V); +void FASTAPASS(3) setchr4r(int r, uint32_t A, uint32_t V); +void FASTAPASS(2) setchr8r(int r, uint32_t V); -void FASTAPASS(2) setchr1(uint32 A, uint32 V); -void FASTAPASS(2) setchr2(uint32 A, uint32 V); -void FASTAPASS(2) setchr4(uint32 A, uint32 V); -void FASTAPASS(2) setchr8(uint32 V); +void FASTAPASS(2) setchr1(uint32_t A, uint32_t V); +void FASTAPASS(2) setchr2(uint32_t A, uint32_t V); +void FASTAPASS(2) setchr4(uint32_t A, uint32_t V); +void FASTAPASS(2) setchr8(uint32_t V); void FASTAPASS(1) setmirror(int t); void setmirrorw(int a, int b, int c, int d); -void FASTAPASS(3) setntamem(uint8 *p, int ram, uint32 b); +void FASTAPASS(3) setntamem(uint8_t *p, int ram, uint32_t b); #define MI_H 0 #define MI_V 1 diff --git a/src/cheat.c b/src/cheat.c index 2161416..4016c47 100644 --- a/src/cheat.c +++ b/src/cheat.c @@ -31,8 +31,8 @@ #include "cart.h" #include "fceu-memory.h" -static uint8 *CheatRPtrs[64]; -uint8 *MMapPtrs[64]; +static uint8_t *CheatRPtrs[64]; +uint8_t *MMapPtrs[64]; void FCEU_CheatResetRAM(void) { int x; @@ -41,8 +41,8 @@ void FCEU_CheatResetRAM(void) { CheatRPtrs[x] = 0; } -void FCEU_CheatAddRAM(int s, uint32 A, uint8 *p) { - uint32 AB = A >> 10; +void FCEU_CheatAddRAM(int s, uint32_t A, uint8_t *p) { + uint32_t AB = A >> 10; int x; for (x = s - 1; x >= 0; x--) { @@ -55,16 +55,16 @@ void FCEU_CheatAddRAM(int s, uint32 A, uint8 *p) { struct CHEATF { struct CHEATF *next; char *name; - uint16 addr; - uint8 val; + uint16_t addr; + uint8_t val; int compare; /* -1 for no compare. */ int type; /* 0 for replace, 1 for substitute(GG). */ int status; }; typedef struct { - uint16 addr; - uint8 val; + uint16_t addr; + uint8_t val; int compare; readfunc PrevRead; } CHEATF_SUBFAST; @@ -79,7 +79,7 @@ struct CHEATF *cheats = 0, *cheatsl = 0; #define CHEATC_EXCLUDED 0x4000 #define CHEATC_NOSHOW 0xC000 -static uint16 *CheatComp = 0; +static uint16_t *CheatComp = 0; static int savecheats; static DECLFR(SubCheatsRead) { @@ -89,7 +89,7 @@ static DECLFR(SubCheatsRead) { do { if (s->addr == A) { if (s->compare >= 0) { - uint8 pv = s->PrevRead(A); + uint8_t pv = s->PrevRead(A); if (pv == s->compare) return(s->val); @@ -140,13 +140,13 @@ void FCEU_PowerCheats() { RebuildSubCheats(); } -static int AddCheatEntry(char *name, uint32 addr, uint8 val, int compare, int status, int type); +static int AddCheatEntry(char *name, uint32_t addr, uint8_t val, int compare, int status, int type); static void CheatMemErr(void) { FCEUD_PrintError("Error allocating memory for cheat data."); } /* This function doesn't allocate any memory for "name" */ -static int AddCheatEntry(char *name, uint32 addr, uint8 val, int compare, int status, int type) { +static int AddCheatEntry(char *name, uint32_t addr, uint8_t val, int compare, int status, int type) { struct CHEATF *temp; if (!(temp = (struct CHEATF*)malloc(sizeof(struct CHEATF)))) { CheatMemErr(); @@ -208,7 +208,7 @@ void FCEU_ResetCheats(void) } -int FCEUI_AddCheat(const char *name, uint32 addr, uint8 val, int compare, int type) { +int FCEUI_AddCheat(const char *name, uint32_t addr, uint8_t val, int compare, int type) { char *t; if (!(t = (char*)malloc(strlen(name) + 1))) { @@ -225,10 +225,10 @@ int FCEUI_AddCheat(const char *name, uint32 addr, uint8 val, int compare, int ty return(1); } -int FCEUI_DelCheat(uint32 which) { +int FCEUI_DelCheat(uint32_t which) { struct CHEATF *prev; struct CHEATF *cur; - uint32 x = 0; + uint32_t x = 0; for (prev = 0, cur = cheats;; ) { if (x == which) { /* Remove this cheat. */ @@ -280,7 +280,7 @@ void FCEU_ApplyPeriodicCheats(void) { } -void FCEUI_ListCheats(int (*callb)(char *name, uint32 a, uint8 v, int compare, int s, int type, void *data), void *data) { +void FCEUI_ListCheats(int (*callb)(char *name, uint32_t a, uint8_t v, int compare, int s, int type, void *data), void *data) { struct CHEATF *next = cheats; while (next) { @@ -289,9 +289,9 @@ void FCEUI_ListCheats(int (*callb)(char *name, uint32 a, uint8 v, int compare, i } } -int FCEUI_GetCheat(uint32 which, char **name, uint32 *a, uint8 *v, int *compare, int *s, int *type) { +int FCEUI_GetCheat(uint32_t which, char **name, uint32_t *a, uint8_t *v, int *compare, int *s, int *type) { struct CHEATF *next = cheats; - uint32 x = 0; + uint32_t x = 0; while (next) { if (x == which) { @@ -325,11 +325,11 @@ static int GGtobin(char c) { } /* Returns 1 on success, 0 on failure. Sets *a,*v,*c. */ -int FCEUI_DecodeGG(const char *str, uint16 *a, uint8 *v, int *c) { - uint8 t; - uint16 A = 0x8000; - uint8 V = 0; - uint8 C = 0; +int FCEUI_DecodeGG(const char *str, uint16_t *a, uint8_t *v, int *c) { + uint8_t t; + uint16_t A = 0x8000; + uint8_t V = 0; + uint8_t C = 0; int s = strlen(str); if (s != 6 && s != 8) return(0); @@ -382,7 +382,7 @@ int FCEUI_DecodeGG(const char *str, uint16 *a, uint8 *v, int *c) { return(0); } -int FCEUI_DecodePAR(const char *str, uint16 *a, uint8 *v, int *c, int *type) { +int FCEUI_DecodePAR(const char *str, uint16_t *a, uint8_t *v, int *c, int *type) { int boo[4]; if (strlen(str) != 8) return(0); @@ -418,9 +418,9 @@ int FCEUI_DecodePAR(const char *str, uint16 *a, uint8 *v, int *c, int *type) { /* name can be NULL if the name isn't going to be changed. */ /* same goes for a, v, and s(except the values of each one must be <0) */ -int FCEUI_SetCheat(uint32 which, const char *name, int32 a, int32 v, int compare, int s, int type) { +int FCEUI_SetCheat(uint32_t which, const char *name, int32_t a, int32_t v, int compare, int s, int type) { struct CHEATF *next = cheats; - uint32 x = 0; + uint32_t x = 0; while (next) { if (x == which) { @@ -455,9 +455,9 @@ int FCEUI_SetCheat(uint32 which, const char *name, int32 a, int32 v, int compare } /* Convenience function. */ -int FCEUI_ToggleCheat(uint32 which) { +int FCEUI_ToggleCheat(uint32_t which) { struct CHEATF *next = cheats; - uint32 x = 0; + uint32_t x = 0; while (next) { if (x == which) { @@ -474,9 +474,9 @@ int FCEUI_ToggleCheat(uint32 which) { } static int InitCheatComp(void) { - uint32 x; + uint32_t x; - CheatComp = (uint16*)malloc(65536 * sizeof(uint16)); + CheatComp = (uint16_t*)malloc(65536 * sizeof(uint16_t)); if (!CheatComp) { CheatMemErr(); return(0); @@ -488,7 +488,7 @@ static int InitCheatComp(void) { } void FCEUI_CheatSearchSetCurrentAsOriginal(void) { - uint32 x; + uint32_t x; for (x = 0x000; x < 0x10000; x++) if (!(CheatComp[x] & CHEATC_NOSHOW)) { if (CheatRPtrs[x >> 10]) @@ -499,15 +499,15 @@ void FCEUI_CheatSearchSetCurrentAsOriginal(void) { } void FCEUI_CheatSearchShowExcluded(void) { - uint32 x; + uint32_t x; for (x = 0x000; x < 0x10000; x++) CheatComp[x] &= ~CHEATC_EXCLUDED; } -int32 FCEUI_CheatSearchGetCount(void) { - uint32 x, c = 0; +int32_t FCEUI_CheatSearchGetCount(void) { + uint32_t x, c = 0; if (CheatComp) { for (x = 0x0000; x < 0x10000; x++) @@ -519,8 +519,8 @@ int32 FCEUI_CheatSearchGetCount(void) { } /* This function will give the initial value of the search and the current value at a location. */ -void FCEUI_CheatSearchGet(int (*callb)(uint32 a, uint8 last, uint8 current, void *data), void *data) { - uint32 x; +void FCEUI_CheatSearchGet(int (*callb)(uint32_t a, uint8_t last, uint8_t current, void *data), void *data) { + uint32_t x; if (!CheatComp) { if (!InitCheatComp()) @@ -534,9 +534,9 @@ void FCEUI_CheatSearchGet(int (*callb)(uint32 a, uint8 last, uint8 current, void break; } -void FCEUI_CheatSearchGetRange(uint32 first, uint32 last, int (*callb)(uint32 a, uint8 last, uint8 current)) { - uint32 x; - uint32 in = 0; +void FCEUI_CheatSearchGetRange(uint32_t first, uint32_t last, int (*callb)(uint32_t a, uint8_t last, uint8_t current)) { + uint32_t x; + uint32_t in = 0; if (!CheatComp) { if (!InitCheatComp()) @@ -555,7 +555,7 @@ void FCEUI_CheatSearchGetRange(uint32 first, uint32 last, int (*callb)(uint32 a, } void FCEUI_CheatSearchBegin(void) { - uint32 x; + uint32_t x; if (!CheatComp) { if (!InitCheatComp()) { @@ -578,8 +578,8 @@ static INLINE int CAbs(int x) { return x; } -void FCEUI_CheatSearchEnd(int type, uint8 v1, uint8 v2) { - uint32 x; +void FCEUI_CheatSearchEnd(int type, uint8_t v1, uint8_t v2) { + uint32_t x; if (!CheatComp) { if (!InitCheatComp()) { diff --git a/src/cheat.h b/src/cheat.h index 3052f54..4e78ea5 100644 --- a/src/cheat.h +++ b/src/cheat.h @@ -1,10 +1,10 @@ #ifndef _FCEU_CHEAT_H #define _FCEU_CHEAT_H -extern uint8 *MMapPtrs[64]; +extern uint8_t *MMapPtrs[64]; void FCEU_CheatResetRAM(void); -void FCEU_CheatAddRAM(int s, uint32 A, uint8 *p); +void FCEU_CheatAddRAM(int s, uint32_t A, uint8_t *p); void FCEU_LoadGameCheats(void); void FCEU_FlushGameCheats(void); diff --git a/src/crc32.c b/src/crc32.c index fc70611..ea30a82 100644 --- a/src/crc32.c +++ b/src/crc32.c @@ -99,7 +99,7 @@ static unsigned long crc32(unsigned long crc, const unsigned char *buf, unsigned return crc ^ 0xffffffffL; } -uint32 CalcCRC32(uint32 crc, uint8 *buf, uint32 len) +uint32_t CalcCRC32(uint32_t crc, uint8_t *buf, uint32_t len) { return(crc32(crc, buf, len)); } diff --git a/src/crc32.h b/src/crc32.h index c035968..cec03aa 100644 --- a/src/crc32.h +++ b/src/crc32.h @@ -1,6 +1,6 @@ #ifndef _FCEU_CRC32_H #define _FCEU_CRC32_H -uint32 CalcCRC32(uint32 crc, uint8 *buf, uint32 len); +uint32_t CalcCRC32(uint32_t crc, uint8_t *buf, uint32_t len); #endif diff --git a/src/debug.c b/src/debug.c index 1786a89..1ef515d 100644 --- a/src/debug.c +++ b/src/debug.c @@ -29,7 +29,7 @@ #include "debug.h" #include "cart.h" -void FCEUI_DumpVid(const char *fname, uint32 start, uint32 end) { +void FCEUI_DumpVid(const char *fname, uint32_t start, uint32_t end) { RFILE *fp = filestream_open(fname, RETRO_VFS_FILE_ACCESS_WRITE, RETRO_VFS_FILE_ACCESS_HINT_NONE); @@ -42,7 +42,7 @@ void FCEUI_DumpVid(const char *fname, uint32 start, uint32 end) { fceuindbg = 0; } -void FCEUI_DumpMem(const char *fname, uint32 start, uint32 end) { +void FCEUI_DumpMem(const char *fname, uint32_t start, uint32_t end) { RFILE *fp = filestream_open(fname, RETRO_VFS_FILE_ACCESS_WRITE, RETRO_VFS_FILE_ACCESS_HINT_NONE); @@ -53,7 +53,7 @@ void FCEUI_DumpMem(const char *fname, uint32 start, uint32 end) { fceuindbg = 0; } -void FCEUI_LoadMem(const char *fname, uint32 start, int hl) { +void FCEUI_LoadMem(const char *fname, uint32_t start, int hl) { int t; RFILE *fp = filestream_open(fname, RETRO_VFS_FILE_ACCESS_READ, @@ -61,7 +61,7 @@ void FCEUI_LoadMem(const char *fname, uint32 start, int hl) { while ((t = filestream_getc(fp)) >= 0) { if (start > 0xFFFF) break; if (hl) { - extern uint8 *Page[32]; + extern uint8_t *Page[32]; if (Page[start / 2048]) Page[start / 2048][start] = t; } else @@ -106,7 +106,7 @@ static int flengths[12] = { 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 0 }; typedef struct { char *name; int type; /* 1 for read, 2 for write, 3 for r then write. */ - int32 modes[10]; + int32_t modes[10]; } OPS; #define NUMOPS 56 static OPS optable[NUMOPS] = @@ -177,11 +177,11 @@ static OPS optable[NUMOPS] = { "BVS", 1, { REL(0x70), -1 } }, }; -uint16 FCEUI_Disassemble(void *XA, uint16 a, char *stringo) { +uint16_t FCEUI_Disassemble(void *XA, uint16_t a, char *stringo) { X6502 *X = XA; - uint8 buf; - uint32 arg; - int32 info; + uint8_t buf; + uint32_t arg; + int32_t info; int x; int y; @@ -235,7 +235,7 @@ uint16 FCEUI_Disassemble(void *XA, uint16 a, char *stringo) { 11 #define IMP(x) ((11<<16)|x) */ { - uint32 tmp; + uint32_t tmp; switch (info >> 16) { case 2: tmp = arg; if (optable[x].type & 1) { @@ -296,7 +296,7 @@ uint16 FCEUI_Disassemble(void *XA, uint16 a, char *stringo) { return(a); } -void FCEUI_MemDump(uint16 a, int32 len, void (*callb)(uint16 a, uint8 v)) { +void FCEUI_MemDump(uint16_t a, int32_t len, void (*callb)(uint16_t a, uint8_t v)) { fceuindbg = 1; while (len) { callb(a, ARead[a](a)); @@ -306,8 +306,8 @@ void FCEUI_MemDump(uint16 a, int32 len, void (*callb)(uint16 a, uint8 v)) { fceuindbg = 0; } -uint8 FCEUI_MemSafePeek(uint16 A) { - uint8 ret; +uint8_t FCEUI_MemSafePeek(uint16_t A) { + uint8_t ret; fceuindbg = 1; ret = ARead[A](A); @@ -315,8 +315,8 @@ uint8 FCEUI_MemSafePeek(uint16 A) { return(ret); } -void FCEUI_MemPoke(uint16 a, uint8 v, int hl) { - extern uint8 *Page[32]; +void FCEUI_MemPoke(uint16_t a, uint8_t v, int hl) { + extern uint8_t *Page[32]; if (hl) { if (Page[a / 2048]) Page[a / 2048][a] = v; @@ -326,8 +326,8 @@ void FCEUI_MemPoke(uint16 a, uint8 v, int hl) { typedef struct __BPOINT { struct __BPOINT *next; - void (*Handler)(X6502 *X, int type, uint32 A); - uint32 A[2]; + void (*Handler)(X6502 *X, int type, uint32_t A); + uint32_t A[2]; int type; } BPOINT; @@ -336,7 +336,7 @@ static BPOINT *LastBP = NULL; static void (*CPUHook)(X6502 *) = NULL; -static int FindBPoint(X6502 *X, int who, uint32 A) { +static int FindBPoint(X6502 *X, int who, uint32_t A) { BPOINT *tmp; tmp = BreakPoints; @@ -367,7 +367,7 @@ static int FindBPoint(X6502 *X, int who, uint32 A) { return(0); } -static uint8 ReadHandler(X6502 *X, uint32 A) { +static uint8_t ReadHandler(X6502 *X, uint32_t A) { extern X6502 XSave; if (X->preexec) @@ -375,7 +375,7 @@ static uint8 ReadHandler(X6502 *X, uint32 A) { return(ARead[A](A)); } -static void WriteHandler(X6502 *X, uint32 A, uint8 V) { +static void WriteHandler(X6502 *X, uint32_t A, uint8_t V) { extern X6502 XSave; if (X->preexec) @@ -384,8 +384,8 @@ static void WriteHandler(X6502 *X, uint32 A, uint8 V) { BWrite[A](A, V); } -int FCEUI_AddBreakPoint(int type, uint32 A1, uint32 A2, - void (*Handler)(X6502 *, int type, uint32 A)) { +int FCEUI_AddBreakPoint(int type, uint32_t A1, uint32_t A2, + void (*Handler)(X6502 *, int type, uint32_t A)) { BPOINT *tmp; tmp = (BPOINT*)malloc(sizeof(BPOINT)); @@ -407,9 +407,9 @@ int FCEUI_AddBreakPoint(int type, uint32 A1, uint32 A2, return(1); } -int FCEUI_SetBreakPoint(uint32 w, int type, uint32 A1, uint32 A2, - void (*Handler)(X6502 *, int type, uint32 A)) { - uint32 x = 0; +int FCEUI_SetBreakPoint(uint32_t w, int type, uint32_t A1, uint32_t A2, + void (*Handler)(X6502 *, int type, uint32_t A)) { + uint32_t x = 0; BPOINT *tmp; tmp = BreakPoints; @@ -428,9 +428,9 @@ int FCEUI_SetBreakPoint(uint32 w, int type, uint32 A1, uint32 A2, return(0); } -int FCEUI_GetBreakPoint(uint32 w, int *type, uint32 *A1, uint32 *A2, - void(**Handler) (X6502 *, int type, uint32 A)) { - uint32 x = 0; +int FCEUI_GetBreakPoint(uint32_t w, int *type, uint32_t *A1, uint32_t *A2, + void(**Handler) (X6502 *, int type, uint32_t A)) { + uint32_t x = 0; BPOINT *tmp; tmp = BreakPoints; @@ -449,8 +449,8 @@ int FCEUI_GetBreakPoint(uint32 w, int *type, uint32 *A1, uint32 *A2, return(0); } -int FCEUI_ListBreakPoints(int (*callb)(int type, uint32 A1, uint32 A2, - void (*Handler)(X6502 *, int type, uint32 A))) { +int FCEUI_ListBreakPoints(int (*callb)(int type, uint32_t A1, uint32_t A2, + void (*Handler)(X6502 *, int type, uint32_t A))) { BPOINT *tmp; tmp = BreakPoints; while (tmp) { @@ -460,9 +460,9 @@ int FCEUI_ListBreakPoints(int (*callb)(int type, uint32 A1, uint32 A2, return(1); } -int FCEUI_DeleteBreakPoint(uint32 w) { +int FCEUI_DeleteBreakPoint(uint32_t w) { BPOINT *tmp, *prev = NULL; - uint32 x = 0; + uint32_t x = 0; tmp = BreakPoints; diff --git a/src/debug.h b/src/debug.h index bfb481a..20c0a83 100644 --- a/src/debug.h +++ b/src/debug.h @@ -1,9 +1,9 @@ #ifndef _FCEU_DEBUG_H #define _FCEU_DEBUG_H -void FCEUI_DumpMem(const char *fname, uint32 start, uint32 end); -void FCEUI_DumpVid(const char *fname, uint32 start, uint32 end); -void FCEUI_LoadMem(const char *fname, uint32 start, int hl); +void FCEUI_DumpMem(const char *fname, uint32_t start, uint32_t end); +void FCEUI_DumpVid(const char *fname, uint32_t start, uint32_t end); +void FCEUI_LoadMem(const char *fname, uint32_t start, int hl); #ifdef FCEUDEF_DEBUGGER @@ -16,12 +16,12 @@ void FCEUI_LoadMem(const char *fname, uint32 start, int hl); #include "x6502struct.h" void FCEUI_SetCPUCallback(void (*callb)(X6502 *X)); -int FCEUI_DeleteBreakPoint(uint32 w); +int FCEUI_DeleteBreakPoint(uint32_t w); int FCEUI_ListBreakPoints(int (*callb)(int type, unsigned int A1, unsigned int A2, void (*Handler)(X6502 *, int type, unsigned int A))); -int FCEUI_GetBreakPoint(uint32 w, int *type, unsigned int *A1, unsigned int *A2, +int FCEUI_GetBreakPoint(uint32_t w, int *type, unsigned int *A1, unsigned int *A2, void(**Handler) (X6502 *, int type, unsigned int A)); -int FCEUI_SetBreakPoint(uint32 w, int type, unsigned int A1, unsigned int A2, +int FCEUI_SetBreakPoint(uint32_t w, int type, unsigned int A1, unsigned int A2, void (*Handler)(X6502 *, int type, unsigned int A)); int FCEUI_AddBreakPoint(int type, unsigned int A1, unsigned int A2, void (*Handler)(X6502 *, int type, unsigned int A)); diff --git a/src/drawing.h b/src/drawing.h index 110dd48..a290569 100644 --- a/src/drawing.h +++ b/src/drawing.h @@ -1,7 +1,7 @@ #ifndef _FCEU_DRAWING_H #define _FCEU_DRAWING_H -uint8 fontdata2[2048] = +uint8_t fontdata2[2048] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x81,0xa5,0x81,0xbd,0x99,0x81,0x7e,0x7e,0xff,0xdb,0xff,0xc3,0xe7,0xff,0x7e,0x36,0x7f,0x7f,0x7f,0x3e,0x1c,0x08,0x00, 0x08,0x1c,0x3e,0x7f,0x3e,0x1c,0x08,0x00,0x1c,0x3e,0x1c,0x7f,0x7f,0x3e,0x1c,0x3e,0x08,0x08,0x1c,0x3e,0x7f,0x3e,0x1c,0x3e,0x00,0x00,0x18,0x3c,0x3c,0x18,0x00,0x00, @@ -69,11 +69,11 @@ uint8 fontdata2[2048] = 0x1e,0x36,0x36,0x36,0x36,0x00,0x00,0x00,0x0e,0x18,0x0c,0x06,0x1e,0x00,0x00,0x00,0x00,0x00,0x3c,0x3c,0x3c,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; -void DrawTextTrans(uint8 *dest, uint32 width, uint8 *textmsg, uint8 fgcolor) { - uint8 length = strlen((char*)textmsg); - uint8 x; - uint8 y; - uint8 z; +void DrawTextTrans(uint8_t *dest, uint32_t width, uint8_t *textmsg, uint8_t fgcolor) { + uint8_t length = strlen((char*)textmsg); + uint8_t x; + uint8_t y; + uint8_t z; for (x = 0; x < length; x++) for (y = 0; y < 8; y++) @@ -81,7 +81,7 @@ void DrawTextTrans(uint8 *dest, uint32 width, uint8 *textmsg, uint8 fgcolor) { if ((fontdata2[(textmsg[x] << 3) + y] >> z) & 1) dest[y * width + (x << 3) + z] = fgcolor; } -static uint8 sstat[2541] = +static uint8_t sstat[2541] = { 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83, 0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80, @@ -165,8 +165,8 @@ static uint8 sstat[2541] = 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80 }; -void FCEU_DrawNumberRow(uint8 *XBuf, int *nstatus, int cur) { - uint8 *XBaf; +void FCEU_DrawNumberRow(uint8_t *XBuf, int *nstatus, int cur) { + uint8_t *XBaf; int z, x, y; XBaf = XBuf - 4 + (FSettings.LastSLine - 34) * 256; diff --git a/src/driver.h b/src/driver.h index e7664ad..a6bd592 100644 --- a/src/driver.h +++ b/src/driver.h @@ -32,7 +32,7 @@ void FCEU_printf(char *format, ...); #define FCEUI_printf FCEU_printf /* Video interface */ -void FCEUD_SetPalette(uint16 index, uint8 r, uint8 g, uint8 b); +void FCEUD_SetPalette(uint16_t index, uint8_t r, uint8_t g, uint8_t b); /* Displays an error. Can block or not. */ void FCEUD_PrintError(char *s); @@ -101,7 +101,7 @@ FCEUGI *FCEUI_LoadGame(const char *name, const uint8_t *databuf, size_t databufs int FCEUI_Initialize(void); /* Emulates a frame. */ -void FCEUI_Emulate(uint8 **, int32 **, int32 *, int); +void FCEUI_Emulate(uint8_t **, int32_t **, int32_t *, int); /* Closes currently loaded game */ void FCEUI_CloseGame(void); @@ -136,7 +136,7 @@ void FCEUI_SetBaseDirectory(const char *dir); /* Tells FCE Ultra to copy the palette data pointed to by pal and use it. Data pointed to by pal needs to be 64*3 bytes in length. */ -void FCEUI_SetPaletteArray(uint8 *pal, int nEntries); +void FCEUI_SetPaletteArray(uint8_t *pal, int nEntries); /* Sets up sound code to render sound at the specified rate, in samples per second. Only sample rates of 44100, 48000, and 96000 are currently @@ -144,49 +144,49 @@ void FCEUI_SetPaletteArray(uint8 *pal, int nEntries); If "Rate" equals 0, sound is disabled. */ void FCEUI_Sound(int Rate); -void FCEUI_SetSoundVolume(uint32 volume); +void FCEUI_SetSoundVolume(uint32_t volume); void FCEUI_SetSoundQuality(int quality); -int32 FCEUI_GetDesiredFPS(void); +int32_t FCEUI_GetDesiredFPS(void); -int FCEUI_DecodePAR(const char *code, uint16 *a, uint8 *v, int *c, int *type); -int FCEUI_DecodeGG(const char *str, uint16 *a, uint8 *v, int *c); -int FCEUI_AddCheat(const char *name, uint32 addr, uint8 val, int compare, int type); -int FCEUI_DelCheat(uint32 which); -int FCEUI_ToggleCheat(uint32 which); +int FCEUI_DecodePAR(const char *code, uint16_t *a, uint8_t *v, int *c, int *type); +int FCEUI_DecodeGG(const char *str, uint16_t *a, uint8_t *v, int *c); +int FCEUI_AddCheat(const char *name, uint32_t addr, uint8_t val, int compare, int type); +int FCEUI_DelCheat(uint32_t which); +int FCEUI_ToggleCheat(uint32_t which); -int32 FCEUI_CheatSearchGetCount(void); -void FCEUI_CheatSearchGetRange(uint32 first, uint32 last, int (*callb)(uint32 a, uint8 last, uint8 current)); -void FCEUI_CheatSearchGet(int (*callb)(uint32 a, uint8 last, uint8 current, void *data), void *data); +int32_t FCEUI_CheatSearchGetCount(void); +void FCEUI_CheatSearchGetRange(uint32_t first, uint32_t last, int (*callb)(uint32_t a, uint8_t last, uint8_t current)); +void FCEUI_CheatSearchGet(int (*callb)(uint32_t a, uint8_t last, uint8_t current, void *data), void *data); void FCEUI_CheatSearchBegin(void); -void FCEUI_CheatSearchEnd(int type, uint8 v1, uint8 v2); -void FCEUI_ListCheats(int (*callb)(char *name, uint32 a, uint8 v, int compare, int s, int type, void *data), void *data); +void FCEUI_CheatSearchEnd(int type, uint8_t v1, uint8_t v2); +void FCEUI_ListCheats(int (*callb)(char *name, uint32_t a, uint8_t v, int compare, int s, int type, void *data), void *data); -int FCEUI_GetCheat(uint32 which, char **name, uint32 *a, uint8 *v, int *compare, int *s, int *type); -int FCEUI_SetCheat(uint32 which, const char *name, int32 a, int32 v, int compare, int s, int type); +int FCEUI_GetCheat(uint32_t which, char **name, uint32_t *a, uint8_t *v, int *compare, int *s, int *type); +int FCEUI_SetCheat(uint32_t which, const char *name, int32_t a, int32_t v, int compare, int s, int type); void FCEUI_CheatSearchShowExcluded(void); void FCEUI_CheatSearchSetCurrentAsOriginal(void); #ifdef FCEUDEF_DEBUGGER -void FCEUI_MemDump(uint16 a, int32 len, void (*callb)(uint16 a, uint8 v)); -uint8 FCEUI_MemSafePeek(uint16 A); -void FCEUI_MemPoke(uint16 a, uint8 v, int hl); +void FCEUI_MemDump(uint16_t a, int32_t len, void (*callb)(uint16_t a, uint8_t v)); +uint8_t FCEUI_MemSafePeek(uint16_t A); +void FCEUI_MemPoke(uint16_t a, uint8_t v, int hl); void FCEUI_NMI(void); void FCEUI_IRQ(void); -uint16 FCEUI_Disassemble(void *XA, uint16 a, char *stringo); -void FCEUI_GetIVectors(uint16 *reset, uint16 *irq, uint16 *nmi); +uint16_t FCEUI_Disassemble(void *XA, uint16_t a, char *stringo); +void FCEUI_GetIVectors(uint16_t *reset, uint16_t *irq, uint16_t *nmi); #endif void FCEUI_SetLowPass(int q); void FCEUI_NSFSetVis(int mode); int FCEUI_NSFChange(int amount); -int FCEUI_NSFGetInfo(uint8 *name, uint8 *artist, uint8 *copyright, int maxlen); +int FCEUI_NSFGetInfo(uint8_t *name, uint8_t *artist, uint8_t *copyright, int maxlen); void FCEUI_VSUniToggleDIPView(void); void FCEUI_VSUniToggleDIP(int w); -uint8 FCEUI_VSUniGetDIPs(void); +uint8_t FCEUI_VSUniGetDIPs(void); void FCEUI_VSUniSetDIP(int w, int state); void FCEUI_VSUniCoin(void); @@ -194,7 +194,7 @@ int FCEUI_FDSInsert(int oride); int FCEUI_FDSEject(void); void FCEUI_FDSSelect(void); -int FCEUI_DatachSet(uint8 *rcode); +int FCEUI_DatachSet(uint8_t *rcode); #ifdef __cplusplus } diff --git a/src/drivers/libretro/libretro.c b/src/drivers/libretro/libretro.c index 81b5902..c7fc98c 100644 --- a/src/drivers/libretro/libretro.c +++ b/src/drivers/libretro/libretro.c @@ -50,7 +50,7 @@ #define RED_EXPAND 3 #define GREEN_EXPAND 2 #define BLUE_EXPAND 3 -typedef uint16 bpp_t; +typedef uint16_t bpp_t; #elif defined (FRONTEND_SUPPORTS_ABGR1555) #define RED_SHIFT 0 #define GREEN_SHIFT 5 @@ -61,7 +61,7 @@ typedef uint16 bpp_t; #define RED_MASK 0x1F #define GREEN_MASK 0x3E0 #define BLUE_MASK 0x7C00 -typedef uint16 bpp_t; +typedef uint16_t bpp_t; #elif defined (FRONTEND_SUPPORTS_RGB888) #define RED_SHIFT 16 #define GREEN_SHIFT 8 @@ -72,7 +72,7 @@ typedef uint16 bpp_t; #define RED_MASK 0xFF0000 #define GREEN_MASK 0x00FF00 #define BLUE_MASK 0x0000FF -typedef uint32 bpp_t; +typedef uint32_t bpp_t; #elif defined (FRONTEND_SUPPORTS_RGB565) #define RED_SHIFT 11 #define GREEN_SHIFT 5 @@ -83,7 +83,7 @@ typedef uint32 bpp_t; #define RED_MASK 0xF800 #define GREEN_MASK 0x7e0 #define BLUE_MASK 0x1f -typedef uint16 bpp_t; +typedef uint16_t bpp_t; #else #define RED_SHIFT 10 #define GREEN_SHIFT 5 @@ -91,7 +91,7 @@ typedef uint16 bpp_t; #define RED_EXPAND 3 #define GREEN_EXPAND 3 #define BLUE_EXPAND 3 -typedef uint16 bpp_t; +typedef uint16_t bpp_t; #endif #define MAX_PLAYERS 4 /* max supported players */ @@ -255,7 +255,7 @@ static unsigned libretro_msg_interface_version = 0; const size_t PPU_BIT = 1ULL << 31ULL; -extern uint8 NTARAM[0x800], PALRAM[0x20], SPRAM[0x100], PPU[4]; +extern uint8_t NTARAM[0x800], PALRAM[0x20], SPRAM[0x100], PPU[4]; /* overclock the console by adding dummy scanlines to PPU loop * disables DMC DMA and WaveHi filling for these dummies @@ -298,7 +298,7 @@ static unsigned serialize_size; /* extern forward decls.*/ extern FCEUGI *GameInfo; -extern uint8 *XBuf; +extern uint8_t *XBuf; extern CartInfo iNESCart; extern CartInfo UNIFCart; extern int show_crosshair; @@ -315,9 +315,9 @@ const char * GetKeyboard(void) #define BUILD_PIXEL_RGB565(R,G,B) (((int) ((R)&0x1f) << RED_SHIFT) | ((int) ((G)&0x3f) << GREEN_SHIFT) | ((int) ((B)&0x1f) << BLUE_SHIFT)) -void FCEUD_SetPalette(uint16 index, uint8_t r, uint8_t g, uint8_t b) +void FCEUD_SetPalette(uint16_t index, uint8_t r, uint8_t g, uint8_t b) { - uint16 index_to_write = index; + uint16_t index_to_write = index; #if defined(RENDER_GSKIT_PS2) /* Index correction for PS2 GS */ int modi = index & 63; @@ -418,7 +418,7 @@ void FCEUD_SoundToggle (void) #define PAL_CUSTOM (PAL_INTERNAL + 3) #define PAL_TOTAL PAL_CUSTOM -static uint8 external_palette_exist = false; +static uint8_t external_palette_exist = false; /* table for currently loaded palette */ static uint8_t base_palette[192]; @@ -2455,7 +2455,7 @@ static void check_variables(bool startup) update_option_visibility(); } -void add_powerpad_input(unsigned port, uint32 variant, uint32_t *ppdata) { +void add_powerpad_input(unsigned port, uint32_t variant, uint32_t *ppdata) { unsigned k; const uint32_t* map = powerpadmap; for (k = 0 ; k < 12 ; k++) @@ -2463,7 +2463,7 @@ void add_powerpad_input(unsigned port, uint32 variant, uint32_t *ppdata) { *ppdata |= (1 << k); } -void add_fkb_input(unsigned port, uint32 variant, uint8_t *fkbkeys) { +void add_fkb_input(unsigned port, uint32_t variant, uint8_t *fkbkeys) { unsigned k; const uint32_t* map = fkbmap; for (k = 0 ; k < 0x48 ; k++) @@ -2473,7 +2473,7 @@ void add_fkb_input(unsigned port, uint32 variant, uint8_t *fkbkeys) { fkbkeys[k]=0; } -void add_suborkey_input(unsigned port, uint32 variant, uint8_t *suborkeys) { +void add_suborkey_input(unsigned port, uint32_t variant, uint8_t *suborkeys) { unsigned k; const uint32_t* map = suborkbmap; for (k = 0 ; k < 0x65 ; k++) @@ -2485,7 +2485,7 @@ void add_suborkey_input(unsigned port, uint32 variant, uint8_t *suborkeys) { static int mzx = 0, mzy = 0; -void get_mouse_input(unsigned port, uint32 variant, uint32_t *mousedata) +void get_mouse_input(unsigned port, uint32_t variant, uint32_t *mousedata) { int min_width, min_height, max_width, max_height; @@ -2565,7 +2565,7 @@ void get_mouse_input(unsigned port, uint32 variant, uint32_t *mousedata) if (_x != 0 || _y != 0) { - int32 raw = (_x + (0x7FFF + offset_x)) * max_width / ((0x7FFF + offset_x) * 2); + int32_t raw = (_x + (0x7FFF + offset_x)) * max_width / ((0x7FFF + offset_x) * 2); if (arkanoidmode == RetroArkanoidAbsMouse) { /* remap so full screen movement ends up within the encoder range 0-240 game board: 176 wide @@ -2907,7 +2907,7 @@ static void FCEUD_UpdateInput(void) palette_switch_counter = 0; } -void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count) +void FCEUD_Update(uint8_t *XBuf, int32_t *Buffer, int Count) { } @@ -3039,7 +3039,7 @@ static void retro_run_blit(uint8_t *gfx) } else { - uint8 pixel_mask = use_raw_palette ? 0x3F : 0xFF; + uint8_t pixel_mask = use_raw_palette ? 0x3F : 0xFF; fceu_video_out[y * width + x] = retro_palette[*gfx & pixel_mask]; } } @@ -3131,7 +3131,7 @@ static int checkGG(char c) static int GGisvalid(const char *code) { size_t len = strlen(code); - uint32 i; + uint32_t i; if (len != 6 && len != 8) return 0; @@ -3152,8 +3152,8 @@ void retro_cheat_set(unsigned index, bool enabled, const char *code) char name[256]; char temp[1024]; char *codepart; - uint16 a; - uint8 v; + uint16_t a; + uint8_t v; int c; int type = 1; diff --git a/src/drivers/libretro/libretro_dipswitch.c b/src/drivers/libretro/libretro_dipswitch.c index 49b2898..ad2be44 100644 --- a/src/drivers/libretro/libretro_dipswitch.c +++ b/src/drivers/libretro/libretro_dipswitch.c @@ -19,7 +19,7 @@ extern CartInfo iNESCart; typedef struct { const char *name; - uint8 value; + uint8_t value; } SETTING; typedef struct { @@ -1077,7 +1077,7 @@ static char *core_key[MAX_CORE_OPTIONS]; static unsigned dipswitch_type = DPSW_NONE; static unsigned numCoreOptions = 0; static unsigned numValues[MAX_VALUES] = {0}; -static uint8 dipswitchPreset = 0; +static uint8_t dipswitchPreset = 0; static const char *str_to_corekey(char *s) { @@ -1199,8 +1199,8 @@ static VSUNIGAME *get_vsuni_dipswitch(unsigned id) static void update_dipswitch_vsuni(void) { unsigned index_key; - uint8 vsdip_new = 0; - uint8 last_vsdip = FCEUI_VSUniGetDIPs(); + uint8_t vsdip_new = 0; + uint8_t last_vsdip = FCEUI_VSUniGetDIPs(); for (index_key = 0; index_key < numCoreOptions; index_key++) { @@ -1215,7 +1215,7 @@ static void update_dipswitch_vsuni(void) for (index_value = 0; index_value < numValues[index_key]; index_value++) { const char *var_value = vscoreopt[index_key].values[index_value].value; - uint8 value = 0; + uint8_t value = 0; if (strcmp(var.value, var_value) != 0) continue; diff --git a/src/fceu-endian.c b/src/fceu-endian.c index 8a322dc..206ecdb 100644 --- a/src/fceu-endian.c +++ b/src/fceu-endian.c @@ -21,14 +21,16 @@ /* Contains file I/O functions that write/read data */ /* LSB first. */ +#include + #include "fceu-memory.h" #include "fceu-types.h" #include "fceu-endian.h" -void FlipByteOrder(uint8 *src, uint32 count) +void FlipByteOrder(uint8_t *src, uint32_t count) { - uint8 *start = src; - uint8 *end; + uint8_t *start = src; + uint8_t *end; if ((count & 1) || !count) return; /* This shouldn't happen. */ @@ -40,7 +42,7 @@ void FlipByteOrder(uint8 *src, uint32 count) * FCEUSTATE_RLSB-marked field. */ while (start < end) { - uint8 tmp; + uint8_t tmp; tmp = *end; *end = *start; @@ -50,38 +52,60 @@ void FlipByteOrder(uint8 *src, uint32 count) } } -int write32le_mem(uint32 b, memstream_t *mem) +int write32le_mem(uint32_t b, memstream_t *mem) { - uint8 s[4]; + uint8_t s[4]; +#ifndef MSB_FIRST + /* On LE hosts the in-memory representation already matches the + * on-disk LE format. Copy the four bytes directly, letting the + * compiler emit a single 32-bit store. */ + memcpy(s, &b, 4); +#else s[0]=b; s[1]=b>>8; s[2]=b>>16; s[3]=b>>24; +#endif return((memstream_write(mem, s, 4)<4)?0:4); } -int read32le_mem(uint32 *Bufo, memstream_t *mem) +int read32le_mem(uint32_t *Bufo, memstream_t *mem) { - uint32 buf; + uint32_t buf; if(memstream_read(mem, &buf, 4)<4) return 0; #ifdef MSB_FIRST - *(uint32*)Bufo=((buf&0xFF)<<24)|((buf&0xFF00)<<8)|((buf&0xFF0000)>>8)|((buf&0xFF000000)>>24); + *Bufo = ((buf&0xFF)<<24)|((buf&0xFF00)<<8)|((buf&0xFF0000)>>8)|((buf&0xFF000000)>>24); #else - *(uint32*)Bufo=buf; + /* LE: bytes already in place. Use memcpy rather than the previous + * '*(uint32_t*)Bufo = buf;' which aliased through a uint32_t* into + * what's nominally a uint32_t already - functionally equivalent + * but cleaner. */ + *Bufo = buf; #endif return 1; } -void FCEU_en32lsb(uint8 *buf, uint32 morp) +void FCEU_en32lsb(uint8_t *buf, uint32_t morp) { +#ifndef MSB_FIRST + /* LE in-memory layout matches the desired LE on-disk layout. */ + memcpy(buf, &morp, 4); +#else buf[0] = morp; buf[1] = morp >> 8; buf[2] = morp >> 16; buf[3] = morp >> 24; +#endif } -uint32 FCEU_de32lsb(const uint8 *morp) +uint32_t FCEU_de32lsb(const uint8_t *morp) { +#ifndef MSB_FIRST + uint32_t v; + memcpy(&v, morp, 4); + return v; +#else return(morp[0] | (morp[1] << 8) | (morp[2] << 16) | (morp[3] << 24)); +#endif } diff --git a/src/fceu-endian.h b/src/fceu-endian.h index d085a7c..4a1aa29 100644 --- a/src/fceu-endian.h +++ b/src/fceu-endian.h @@ -4,12 +4,12 @@ #include "fceu-memory.h" #include -int write32le_mem(uint32 b, memstream_t *mem); -int read32le_mem(uint32 *Bufo, memstream_t *mem); +int write32le_mem(uint32_t b, memstream_t *mem); +int read32le_mem(uint32_t *Bufo, memstream_t *mem); -void FlipByteOrder(uint8 *src, uint32 count); +void FlipByteOrder(uint8_t *src, uint32_t count); -void FCEU_en32lsb(uint8 *, uint32); -uint32 FCEU_de32lsb(const uint8 *); +void FCEU_en32lsb(uint8_t *, uint32_t); +uint32_t FCEU_de32lsb(const uint8_t *); #endif diff --git a/src/fceu-memory.c b/src/fceu-memory.c index 69c64b7..394a025 100644 --- a/src/fceu-memory.c +++ b/src/fceu-memory.c @@ -26,7 +26,7 @@ #include "fceu-memory.h" #include "general.h" -void *FCEU_gmalloc(uint32 size) +void *FCEU_gmalloc(uint32_t size) { void *ret = malloc(size); if (!ret) @@ -38,7 +38,7 @@ void *FCEU_gmalloc(uint32 size) return ret; } -void *FCEU_malloc(uint32 size) +void *FCEU_malloc(uint32_t size) { void *ret = (void*)malloc(size); diff --git a/src/fceu-memory.h b/src/fceu-memory.h index bd61d6b..198fc81 100644 --- a/src/fceu-memory.h +++ b/src/fceu-memory.h @@ -27,10 +27,10 @@ #include "fceu-types.h" -#define FCEU_dwmemset(d, c, n) { int _x; for (_x = n - 4; _x >= 0; _x -= 4) *(uint32*)& (d)[_x] = c; } +#define FCEU_dwmemset(d, c, n) { int _x; for (_x = n - 4; _x >= 0; _x -= 4) *(uint32_t*)& (d)[_x] = c; } -void *FCEU_malloc(uint32 size); -void *FCEU_gmalloc(uint32 size); +void *FCEU_malloc(uint32_t size); +void *FCEU_gmalloc(uint32_t size); void FCEU_gfree(void *ptr); void FCEU_free(void *ptr); diff --git a/src/fceu-types.h b/src/fceu-types.h index 0ea2f4b..c0119ad 100644 --- a/src/fceu-types.h +++ b/src/fceu-types.h @@ -23,27 +23,19 @@ #define __FCEU_TYPES_H #include -typedef int8_t int8; -typedef int16_t int16; -typedef int32_t int32; -typedef uint8_t uint8; -typedef uint16_t uint16; -typedef uint32_t uint32; +/* The custom int8/int16/int32/int64/uint8/uint16/uint32/uint64 typedefs + * that lived here have been replaced throughout the codebase with the + * C99 stdint.h equivalents (int8_t/uint8_t/etc). This header is kept + * for the GINLINE / INLINE / FASTAPASS / FP_FASTAPASS macros and the + * readfunc/writefunc function-pointer typedefs that depend on them. */ #ifdef __GNUC__ -typedef unsigned long long uint64; -typedef long long int64; #define GINLINE inline #elif MSVC | _MSC_VER -typedef __int64 int64; -typedef unsigned __int64 uint64; #define GINLINE /* Can't declare a function INLINE * and global in MSVC. Bummer. */ -#else -typedef unsigned long long uint64; -typedef long long int64; #endif #ifndef INLINE @@ -75,7 +67,7 @@ typedef long long int64; #define FASTAPASS(x) #endif -typedef void (FP_FASTAPASS(2) *writefunc)(uint32 A, uint8 V); -typedef uint8 (FP_FASTAPASS(1) *readfunc)(uint32 A); +typedef void (FP_FASTAPASS(2) *writefunc)(uint32_t A, uint8_t V); +typedef uint8_t (FP_FASTAPASS(1) *readfunc)(uint32_t A); #endif diff --git a/src/fceu.c b/src/fceu.c index 6214fc1..16887ab 100644 --- a/src/fceu.c +++ b/src/fceu.c @@ -47,7 +47,7 @@ #include "crc32.h" #include "vsuni.h" -uint64 timestampbase; +uint64_t timestampbase; FCEUGI *GameInfo = NULL; void (*GameInterface)(int h); @@ -101,7 +101,7 @@ int AllocGenieRW(void) void FlushGenieRW(void) { - int32 x; + int32_t x; if (RWWrap) { @@ -118,7 +118,7 @@ void FlushGenieRW(void) RWWrap = 0; } -readfunc FASTAPASS(1) GetReadHandler(int32 a) +readfunc FASTAPASS(1) GetReadHandler(int32_t a) { if (a >= 0x8000 && RWWrap) return AReadG[a - 0x8000]; @@ -126,9 +126,9 @@ readfunc FASTAPASS(1) GetReadHandler(int32 a) return ARead[a]; } -void FASTAPASS(3) SetReadHandler(int32 start, int32 end, readfunc func) +void FASTAPASS(3) SetReadHandler(int32_t start, int32_t end, readfunc func) { - int32 x; + int32_t x; if (!func) func = ANull; @@ -146,7 +146,7 @@ void FASTAPASS(3) SetReadHandler(int32 start, int32 end, readfunc func) ARead[x] = func; } -writefunc FASTAPASS(1) GetWriteHandler(int32 a) +writefunc FASTAPASS(1) GetWriteHandler(int32_t a) { if (RWWrap && a >= 0x8000) return BWriteG[a - 0x8000]; @@ -154,9 +154,9 @@ writefunc FASTAPASS(1) GetWriteHandler(int32 a) return BWrite[a]; } -void FASTAPASS(3) SetWriteHandler(int32 start, int32 end, writefunc func) +void FASTAPASS(3) SetWriteHandler(int32_t start, int32_t end, writefunc func) { - int32 x; + int32_t x; if (!func) func = BNull; @@ -174,9 +174,9 @@ void FASTAPASS(3) SetWriteHandler(int32 start, int32 end, writefunc func) BWrite[x] = func; } -uint8 RAM[0x800]; +uint8_t RAM[0x800]; -uint8 PAL = 0; +uint8_t PAL = 0; static DECLFW(BRAML) { @@ -334,7 +334,7 @@ void FCEUI_Kill(void) { FCEU_KillGenie(); } -void FCEUI_Emulate(uint8 **pXBuf, int32 **SoundBuf, int32 *SoundBufSize, int skip) { +void FCEUI_Emulate(uint8_t **pXBuf, int32_t **SoundBuf, int32_t *SoundBufSize, int skip) { int r, ssize; FCEU_UpdateInput(); @@ -366,7 +366,35 @@ void ResetNES(void) int option_ramstate = 0; -void FCEU_MemoryRand(uint8 *ptr, uint32 size) +/* Deterministic PRNG state for FCEU_MemoryRand. We use a local xorshift32 + * seeded from a ROM-identity-derived constant rather than libc rand() so + * that the same ROM produces the same initial RAM/CHRRAM contents across + * runs and across builds. This matters for replay and netplay frame- + * determinism: games that read uninitialised memory (NES titles do this + * routinely) would otherwise diverge based on libc rand() state. The + * seed is reset by FCEU_MemoryRand_Reseed() before each cart's power-on + * sequence so multiple FCEU_MemoryRand calls during one cart load share + * a single advancing state, and so different ROMs get different patterns. */ +static uint32_t fceu_memrand_state = 0xDEADBEEF; + +void FCEU_MemoryRand_Reseed(uint32_t seed) +{ + /* Avoid the all-zero fixed point of xorshift; if seed is 0, use a + * sentinel. */ + fceu_memrand_state = seed ? seed : 0xDEADBEEF; +} + +static INLINE uint32_t fceu_memrand_step(void) +{ + uint32_t x = fceu_memrand_state; + x ^= x << 13; + x ^= x >> 17; + x ^= x << 5; + fceu_memrand_state = x; + return x; +} + +void FCEU_MemoryRand(uint8_t *ptr, uint32_t size) { int x = 0; while (size) { @@ -384,7 +412,7 @@ void FCEU_MemoryRand(uint8 *ptr, uint32 size) { case 0: v = 0xff; break; case 1: v = 0x00; break; - case 2: v = (uint8_t)rand(); break; + case 2: v = (uint8_t)fceu_memrand_step(); break; } *ptr = v; x++; @@ -393,12 +421,14 @@ void FCEU_MemoryRand(uint8 *ptr, uint32 size) } } -void hand(X6502 *X, int type, uint32 A) +void hand(X6502 *X, int type, uint32_t A) { } void PowerNES(void) { + uint32_t md5_seed; + if (!GameInfo) return; @@ -409,6 +439,15 @@ void PowerNES(void) FCEU_GeniePower(); + /* Seed the deterministic memory PRNG from the cart's MD5 so the same + * ROM gets the same RAM contents but different ROMs differ. The MD5 + * is set by all loaders (iNES/UNIF/FDS/NSF) before PowerNES runs. */ + md5_seed = ((uint32_t)GameInfo->MD5[0]) + | ((uint32_t)GameInfo->MD5[1] << 8) + | ((uint32_t)GameInfo->MD5[2] << 16) + | ((uint32_t)GameInfo->MD5[3] << 24); + FCEU_MemoryRand_Reseed(md5_seed); + FCEU_MemoryRand(RAM, 0x800); SetReadHandler(0x0000, 0xFFFF, ANull); @@ -536,7 +575,7 @@ void FCEUI_SetGameGenie(int a) FSettings.GameGenie = a ? 1 : 0; } -int32 FCEUI_GetDesiredFPS(void) +int32_t FCEUI_GetDesiredFPS(void) { if (PAL || dendy) return(838977920); /* ~50.007 */ diff --git a/src/fceu.h b/src/fceu.h index dd578be..9a093c6 100644 --- a/src/fceu.h +++ b/src/fceu.h @@ -25,14 +25,15 @@ extern unsigned swapDuty; /* Swap bits 6 & 7 of $4000/$4004 to mimic bug void ResetGameLoaded(void); -#define DECLFR(x) uint8 FP_FASTAPASS(1) x(uint32 A) -#define DECLFW(x) void FP_FASTAPASS(2) x(uint32 A, uint8 V) +#define DECLFR(x) uint8_t FP_FASTAPASS(1) x(uint32_t A) +#define DECLFW(x) void FP_FASTAPASS(2) x(uint32_t A, uint8_t V) -void FCEU_MemoryRand(uint8 *ptr, uint32 size); -void FASTAPASS(3) SetReadHandler(int32 start, int32 end, readfunc func); -void FASTAPASS(3) SetWriteHandler(int32 start, int32 end, writefunc func); -writefunc FASTAPASS(1) GetWriteHandler(int32 a); -readfunc FASTAPASS(1) GetReadHandler(int32 a); +void FCEU_MemoryRand(uint8_t *ptr, uint32_t size); +void FCEU_MemoryRand_Reseed(uint32_t seed); +void FASTAPASS(3) SetReadHandler(int32_t start, int32_t end, readfunc func); +void FASTAPASS(3) SetWriteHandler(int32_t start, int32_t end, writefunc func); +writefunc FASTAPASS(1) GetWriteHandler(int32_t a); +readfunc FASTAPASS(1) GetReadHandler(int32_t a); int AllocGenieRW(void); void FlushGenieRW(void); @@ -44,18 +45,18 @@ void ResetNES(void); void PowerNES(void); -extern uint64 timestampbase; -extern uint32 MMC5HackVROMMask; -extern uint8 *MMC5HackExNTARAMPtr; +extern uint64_t timestampbase; +extern uint32_t MMC5HackVROMMask; +extern uint8_t *MMC5HackExNTARAMPtr; extern int MMC5Hack, PEC586Hack; -extern uint8 *MMC5HackVROMPTR; -extern uint8 MMC5HackCHRMode; -extern uint8 MMC5HackSPMode; -extern uint8 MMC50x5130; -extern uint8 MMC5HackSPScroll; -extern uint8 MMC5HackSPPage; +extern uint8_t *MMC5HackVROMPTR; +extern uint8_t MMC5HackCHRMode; +extern uint8_t MMC5HackSPMode; +extern uint8_t MMC50x5130; +extern uint8_t MMC5HackSPScroll; +extern uint8_t MMC5HackSPPage; -extern uint8 RAM[0x800]; +extern uint8_t RAM[0x800]; extern readfunc ARead[0x10000]; extern writefunc BWrite[0x10000]; @@ -70,7 +71,7 @@ extern void (*GameStateRestore)(int version); #include "git.h" extern FCEUGI *GameInfo; -extern uint8 PAL; +extern uint8_t PAL; #include "driver.h" @@ -92,7 +93,7 @@ typedef struct { */ int UsrFirstSLine[2]; int UsrLastSLine[2]; - uint32 SndRate; + uint32_t SndRate; int soundq; int lowpass; } FCEUS; @@ -102,16 +103,16 @@ extern FCEUS FSettings; void FCEU_PrintError(char *format, ...); void FCEU_printf(char *format, ...); -void SetNESDeemph(uint8 d, int force); -void DrawTextTrans(uint8 *dest, uint32 width, uint8 *textmsg, uint8 fgcolor); +void SetNESDeemph(uint8_t d, int force); +void DrawTextTrans(uint8_t *dest, uint32_t width, uint8_t *textmsg, uint8_t fgcolor); void FCEU_PutImage(void); #ifdef FRAMESKIP void FCEU_PutImageDummy(void); #endif -extern uint8 Exit; -extern uint8 default_palette_selected; -extern uint8 vsdip; +extern uint8_t Exit; +extern uint8_t default_palette_selected; +extern uint8_t vsdip; #define JOY_A 0x01 #define JOY_B 0x02 diff --git a/src/fcoeffs.h b/src/fcoeffs.h index c5f4199..063c88b 100644 --- a/src/fcoeffs.h +++ b/src/fcoeffs.h @@ -3,41 +3,41 @@ #define SQ2NCOEFFS 1024 -static int32 sq2coeffs[SQ2NCOEFFS]; +static int32_t sq2coeffs[SQ2NCOEFFS]; -static int32 SQ2C44100NTSC[SQ2NCOEFFS / 2] = +static int32_t SQ2C44100NTSC[SQ2NCOEFFS / 2] = { #include "fir/c44100ntsc.h" }; -static int32 SQ2C48000NTSC[SQ2NCOEFFS / 2] = +static int32_t SQ2C48000NTSC[SQ2NCOEFFS / 2] = { #include "fir/c48000ntsc.h" }; -static int32 SQ2C96000NTSC[SQ2NCOEFFS / 2] = +static int32_t SQ2C96000NTSC[SQ2NCOEFFS / 2] = { #include "fir/c96000ntsc.h" }; -static int32 SQ2C44100PAL[SQ2NCOEFFS / 2] = +static int32_t SQ2C44100PAL[SQ2NCOEFFS / 2] = { #include "fir/c44100pal.h" }; -static int32 SQ2C48000PAL[SQ2NCOEFFS / 2] = +static int32_t SQ2C48000PAL[SQ2NCOEFFS / 2] = { #include "fir/c48000pal.h" }; -static int32 SQ2C96000PAL[SQ2NCOEFFS / 2] = +static int32_t SQ2C96000PAL[SQ2NCOEFFS / 2] = { #include "fir/c96000pal.h" }; #define NCOEFFS 484 -static int32 coeffs[NCOEFFS]; +static int32_t coeffs[NCOEFFS]; /* 96000hz filter could probably be improved. */ @@ -53,7 +53,7 @@ Stopband attenuation: 103.0 dB Coefficients: */ -static int32 C96000NTSC[NCOEFFS / 2] = +static int32_t C96000NTSC[NCOEFFS / 2] = { /*0*/ 65536 * 16 * -5.9950991853042605E-6 /*1*/, 65536 * 16 * -3.0394382502604395E-6 @@ -312,7 +312,7 @@ Stopband attenuation: 114.0 dB Coefficients: */ -static int32 C96000PAL[NCOEFFS / 2] = +static int32_t C96000PAL[NCOEFFS / 2] = { /*0*/ 65536 * 16 * 3.850781559466991E-7 /*1*/, 65536 * 16 * -1.280019401722687E-6 @@ -568,7 +568,7 @@ Passband ripple: 0.1 dB Transition band: 0.005625 Stopband attenuation: 60.0 dB */ -static int32 C48000NTSC[NCOEFFS / 2] = +static int32_t C48000NTSC[NCOEFFS / 2] = { /*0*/ 65536 * 16 * -1.2211019733097893E-4 /*1*/, 65536 * 16 * 5.374660789759626E-4 @@ -829,7 +829,7 @@ Stopband attenuation: 66.4 dB Coefficients: */ -static int32 C44100NTSC[NCOEFFS / 2] = +static int32_t C44100NTSC[NCOEFFS / 2] = { /*0*/ 65536 * 16 * 2.7250584077004043E-4 /*1*/, 65536 * 16 * -5.6651407794062126E-5 @@ -1087,7 +1087,7 @@ Stopband attenuation: 63.0 dB Coefficients: */ -static int32 C48000PAL[NCOEFFS / 2] = +static int32_t C48000PAL[NCOEFFS / 2] = { /*0*/ 65536 * 16 * -4.8720337170268194E-4 /*1*/, 65536 * 16 * 7.629902642634879E-7 @@ -1345,7 +1345,7 @@ Stopband attenuation: 60.5 dB Coefficients: */ -static int32 C44100PAL[NCOEFFS / 2] = +static int32_t C44100PAL[NCOEFFS / 2] = { /*0*/ 65536 * 16 * 5.793783958720019E-4 /*1*/, 65536 * 16 * 1.0571291666629312E-4 diff --git a/src/fds.c b/src/fds.c index eb9124a..23825b9 100644 --- a/src/fds.c +++ b/src/fds.c @@ -56,29 +56,29 @@ static void FDSClose(void); static void FP_FASTAPASS(1) FDSFix(int a); -static uint8 FDSRegs[6]; -static int32 IRQLatch, IRQCount; -static uint8 IRQa; +static uint8_t FDSRegs[6]; +static int32_t IRQLatch, IRQCount; +static uint8_t IRQa; -static uint8 *FDSROM = NULL; -static uint32 FDSROMSize = 0; -static uint8 *FDSRAM = NULL; -static uint32 FDSRAMSize; -static uint8 *FDSBIOS = NULL; -static uint32 FDSBIOSsize; -static uint8 *CHRRAM = NULL; -static uint32 CHRRAMSize; +static uint8_t *FDSROM = NULL; +static uint32_t FDSROMSize = 0; +static uint8_t *FDSRAM = NULL; +static uint32_t FDSRAMSize; +static uint8_t *FDSBIOS = NULL; +static uint32_t FDSBIOSsize; +static uint8_t *CHRRAM = NULL; +static uint32_t CHRRAMSize; /* Original disk data backup, to help in creating save states. */ -static uint8 *diskdatao[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -static uint8 *diskdata[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +static uint8_t *diskdatao[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +static uint8_t *diskdata[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -static uint32 TotalSides; -static uint8 DiskWritten = 0; /* Set to 1 if disk was written to. */ -static uint8 writeskip; -static int32 DiskPtr; -static int32 DiskSeekIRQ; -static uint8 SelectDisk, InDisk; +static uint32_t TotalSides; +static uint8_t DiskWritten = 0; /* Set to 1 if disk was written to. */ +static uint8_t writeskip; +static int32_t DiskPtr; +static int32_t DiskSeekIRQ; +static uint8_t SelectDisk, InDisk; enum FDS_DiskBlockIDs { DSK_INIT = 0, @@ -88,13 +88,13 @@ enum FDS_DiskBlockIDs { DSK_FILEDATA }; -static uint8 mapperFDS_control; /* 4025(w) control register */ -static uint16 mapperFDS_filesize; /* size of file being read/written */ -static uint8 mapperFDS_block; /* block-id of current block */ -static uint16 mapperFDS_blockstart; /* start-address of current block */ -static uint16 mapperFDS_blocklen; /* length of current block */ -static uint16 mapperFDS_diskaddr; /* current address relative to blockstart */ -static uint8 mapperFDS_diskaccess; /* disk needs to be accessed at least once before writing */ +static uint8_t mapperFDS_control; /* 4025(w) control register */ +static uint16_t mapperFDS_filesize; /* size of file being read/written */ +static uint8_t mapperFDS_block; /* block-id of current block */ +static uint16_t mapperFDS_blockstart; /* start-address of current block */ +static uint16_t mapperFDS_blocklen; /* length of current block */ +static uint16_t mapperFDS_diskaddr; /* current address relative to blockstart */ +static uint8_t mapperFDS_diskaccess; /* disk needs to be accessed at least once before writing */ #define GET_FDS_DISK() (diskdata[InDisk][mapperFDS_blockstart + mapperFDS_diskaddr]) #define FDS_DISK_INSERTED (InDisk != 255) @@ -102,11 +102,11 @@ static uint8 mapperFDS_diskaccess; /* disk needs to be accessed at least once b #define DC_INC 1 #define BYTES_PER_SIDE 65500 -uint8 *FDSROM_ptr(void) { +uint8_t *FDSROM_ptr(void) { return (FDSROM); } -uint32 FDSROM_size(void) { +uint32_t FDSROM_size(void) { return (FDSROMSize); } @@ -249,7 +249,7 @@ static void FP_FASTAPASS(1) FDSFix(int a) { } static DECLFR(FDSRead4030) { - uint8 ret = 0; + uint8_t ret = 0; /* Cheap hack. */ if (X.IRQlow & FCEU_IQEXT) ret |= 1; @@ -266,7 +266,7 @@ static DECLFR(FDSRead4030) { } static DECLFR(FDSRead4031) { - uint8 ret = 0xff; + uint8_t ret = 0xff; if (FDS_DISK_INSERTED && mapperFDS_control & 0x04) { mapperFDS_diskaccess = 1; @@ -303,7 +303,7 @@ static DECLFR(FDSRead4031) { } static DECLFR(FDSRead4032) { - uint8 ret; + uint8_t ret; ret = X.DB & ~7; if (InDisk == 255) @@ -430,7 +430,7 @@ static DECLFW(FDSWrite) { } struct codes_t { - uint8 code; + uint8_t code; char *name; }; @@ -574,7 +574,7 @@ static const struct codes_t list[] = { { 0 } }; -static const char *getManufacturer(uint8 code) +static const char *getManufacturer(uint8_t code) { int x = 0; char *ret = "unlicensed"; @@ -607,9 +607,9 @@ static void FreeFDSMemory(void) { static int SubLoad(FCEUFILE *fp) { struct md5_context md5; - uint8 header[16]; + uint8_t header[16]; int x; - uint64 fsize = FCEU_fgetsize(fp); + uint64_t fsize = FCEU_fgetsize(fp); /* Reject files too short to contain a 16-byte header. Otherwise the * subsequent FCEU_fread leaves header[] partially uninitialised, and @@ -637,7 +637,7 @@ static int SubLoad(FCEUFILE *fp) { if (TotalSides < 1) TotalSides = 1; FDSROMSize = TotalSides * BYTES_PER_SIDE; - FDSROM = (uint8*)FCEU_malloc(FDSROMSize); + FDSROM = (uint8_t*)FCEU_malloc(FDSROMSize); if (!FDSROM) return (0); @@ -693,7 +693,7 @@ int FDSLoad(const char *name, FCEUFILE *fp) { ResetCartMapping(); FDSBIOSsize = 8192; - FDSBIOS = (uint8*)FCEU_gmalloc(FDSBIOSsize); + FDSBIOS = (uint8_t*)FCEU_gmalloc(FDSBIOSsize); SetupCartPRGMapping(0, FDSBIOS, FDSBIOSsize, 0); if (FCEU_fread(FDSBIOS, 1, FDSBIOSsize, zp) != FDSBIOSsize) { @@ -718,7 +718,7 @@ int FDSLoad(const char *name, FCEUFILE *fp) { } for (x = 0; x < TotalSides; x++) { - diskdatao[x] = (uint8*)FCEU_malloc(65500); + diskdatao[x] = (uint8_t*)FCEU_malloc(65500); if (!diskdatao[x]) { int y; for (y = 0; y < x; y++) { @@ -777,12 +777,12 @@ int FDSLoad(const char *name, FCEUFILE *fp) { AddExState(&mapperFDS_diskaccess, 1, 0, "DACC"); CHRRAMSize = 8192; - CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSize); + CHRRAM = (uint8_t*)FCEU_gmalloc(CHRRAMSize); SetupCartCHRMapping(0, CHRRAM, CHRRAMSize, 1); AddExState(CHRRAM, CHRRAMSize, 0, "CHRR"); FDSRAMSize = 32768; - FDSRAM = (uint8*)FCEU_gmalloc(FDSRAMSize); + FDSRAM = (uint8_t*)FCEU_gmalloc(FDSRAMSize); SetupCartPRGMapping(1, FDSRAM, FDSRAMSize, 1); AddExState(FDSRAM, FDSRAMSize, 0, "FDSR"); diff --git a/src/fds.h b/src/fds.h index 47b6412..ea89327 100644 --- a/src/fds.h +++ b/src/fds.h @@ -1,8 +1,8 @@ #ifndef _FCEU_FDS_H #define _FCEU_FDS_H -uint8 *FDSROM_ptr(void); -uint32 FDSROM_size(void); +uint8_t *FDSROM_ptr(void); +uint32_t FDSROM_size(void); void FCEU_FDSInsert(int oride); void FCEU_FDSEject(void); diff --git a/src/fds_apu.c b/src/fds_apu.c index f57d480..716846f 100644 --- a/src/fds_apu.c +++ b/src/fds_apu.c @@ -29,22 +29,22 @@ #define FDSClock (1789772.7272727272727272 / 2) typedef struct { - int64 cycles; /* Cycles per PCM sample */ - int64 count; /* Cycle counter */ - int64 envcount; /* Envelope cycle counter */ - uint32 b19shiftreg60; - uint32 b24adder66; - uint32 b24latch68; - uint32 b17latch76; - int32 clockcount; /* Counter to divide frequency by 8. */ - uint8 b8shiftreg88; /* Modulation register. */ - uint8 amplitude[2]; /* Current amplitudes. */ - uint8 speedo[2]; - uint8 mwcount; - uint8 mwstart; - uint8 mwave[0x20]; /* Modulation waveform */ - uint8 cwave[0x40]; /* Game-defined waveform(carrier) */ - uint8 SPSG[0xB]; + int64_t cycles; /* Cycles per PCM sample */ + int64_t count; /* Cycle counter */ + int64_t envcount; /* Envelope cycle counter */ + uint32_t b19shiftreg60; + uint32_t b24adder66; + uint32_t b24latch68; + uint32_t b17latch76; + int32_t clockcount; /* Counter to divide frequency by 8. */ + uint8_t b8shiftreg88; /* Modulation register. */ + uint8_t amplitude[2]; /* Current amplitudes. */ + uint8_t speedo[2]; + uint8_t mwcount; + uint8_t mwstart; + uint8_t mwave[0x20]; /* Modulation waveform */ + uint8_t cwave[0x40]; /* Game-defined waveform(carrier) */ + uint8_t SPSG[0xB]; } FDSSOUND; static FDSSOUND fdso; @@ -193,11 +193,11 @@ static INLINE void ClockFall(void) { clockcount = (clockcount + 1) & 7; } -static INLINE int32 FDSDoSound(void) { +static INLINE int32_t FDSDoSound(void) { fdso.count += fdso.cycles; - if (fdso.count >= ((int64)1 << 40)) { + if (fdso.count >= ((int64_t)1 << 40)) { dogk: - fdso.count -= (int64)1 << 40; + fdso.count -= (int64_t)1 << 40; ClockRise(); ClockFall(); fdso.envcount--; @@ -216,11 +216,11 @@ static INLINE int32 FDSDoSound(void) { } } -static int32 FBC = 0; +static int32_t FBC = 0; static void RenderSound(void) { - int32 end, start; - int32 x; + int32_t end, start; + int32_t x; start = FBC; end = (SOUNDTS << 16) / soundtsinc; @@ -230,7 +230,7 @@ static void RenderSound(void) { if (!(SPSG[0x9] & 0x80)) for (x = start; x < end; x++) { - uint32 t = FDSDoSound(); + uint32_t t = FDSDoSound(); t += t >> 1; t >>= 4; Wave[x >> 4] += t; /* (t>>2)-(t>>3); */ /* >>3; */ @@ -238,18 +238,18 @@ static void RenderSound(void) { } static void RenderSoundHQ(void) { - uint32 x; + uint32_t x; if (!(SPSG[0x9] & 0x80)) for (x = FBC; x < SOUNDTS; x++) { - uint32 t = FDSDoSound(); + uint32_t t = FDSDoSound(); t += t >> 1; WaveHi[x] += t; /* (t<<2)-(t<<1); */ } FBC = SOUNDTS; } -static void HQSync(int32 ts) { +static void HQSync(int32_t ts) { FBC = ts; } @@ -261,9 +261,9 @@ void FDSSound(int c) { static void FDS_ESI(void) { if (FSettings.SndRate) { if (FSettings.soundq >= 1) { - fdso.cycles = (int64)1 << 39; + fdso.cycles = (int64_t)1 << 39; } else { - fdso.cycles = ((int64)1 << 40) * FDSClock; + fdso.cycles = ((int64_t)1 << 40) * FDSClock; fdso.cycles /= FSettings.SndRate * 16; } } @@ -282,13 +282,13 @@ void FDSSoundReset(void) { GameExpSound.RChange = FDS_ESI; } -uint8 FDSSoundRead(uint32 A) { +uint8_t FDSSoundRead(uint32_t A) { if (A >= 0x4040 && A < 0x4080) return FDSWaveRead(A); if (A >= 0x4090 && A < 0x4093) return FDSSRead(A); return X.DB; } -void FDSSoundWrite(uint32 A, uint8 V) { +void FDSSoundWrite(uint32_t A, uint8_t V) { if (A >= 0x4040 && A < 0x4080) FDSWaveWrite(A, V); else if (A >= 0x4080 && A < 0x408B) FDSSWrite(A, V); } diff --git a/src/fds_apu.h b/src/fds_apu.h index 92902a3..3063778 100644 --- a/src/fds_apu.h +++ b/src/fds_apu.h @@ -8,7 +8,7 @@ void FDSSoundStateAdd(void); /* Used for FDS conversion-based mappers to allow access to FDS APU registers */ void FDSSoundPower(void); -uint8 FDSSoundRead(uint32 A); /* $4040-$407F, $4090-$4092 */ -void FDSSoundWrite(uint32 A, uint8 V); /* $4040-$407F, $4080-$408A */ +uint8_t FDSSoundRead(uint32_t A); /* $4040-$407F, $4090-$4092 */ +void FDSSoundWrite(uint32_t A, uint8_t V); /* $4040-$407F, $4080-$408A */ #endif /* FDS_APU_H */ diff --git a/src/file.c b/src/file.c index 2c477b3..3f6ba24 100644 --- a/src/file.c +++ b/src/file.c @@ -55,7 +55,7 @@ static MEMWRAP *MakeMemWrap(RFILE *tz) tmp->location = 0; tmp->size = (size_t)fsize; - if (tmp->size && !(tmp->data_int = (uint8*)FCEU_malloc(tmp->size))) + if (tmp->size && !(tmp->data_int = (uint8_t*)FCEU_malloc(tmp->size))) { free(tmp); tmp = NULL; @@ -70,7 +70,7 @@ doret: return tmp; } -static MEMWRAP *MakeMemWrapBuffer(const uint8 *buffer, size_t bufsize) +static MEMWRAP *MakeMemWrapBuffer(const uint8_t *buffer, size_t bufsize) { MEMWRAP *tmp = (MEMWRAP*)FCEU_malloc(sizeof(MEMWRAP)); @@ -85,7 +85,7 @@ static MEMWRAP *MakeMemWrapBuffer(const uint8 *buffer, size_t bufsize) return tmp; } -FCEUFILE * FCEU_fopen(const char *path, const uint8 *buffer, size_t bufsize) +FCEUFILE * FCEU_fopen(const char *path, const uint8_t *buffer, size_t bufsize) { FCEUFILE *fceufp = (FCEUFILE*)malloc(sizeof(FCEUFILE)); @@ -149,7 +149,7 @@ int FCEU_fclose(FCEUFILE *fp) return 1; } -uint64 FCEU_fread(void *ptr, size_t element_size, size_t nmemb, FCEUFILE *fp) +uint64_t FCEU_fread(void *ptr, size_t element_size, size_t nmemb, FCEUFILE *fp) { uint32_t total = nmemb * element_size; @@ -195,7 +195,7 @@ int FCEU_fseek(FCEUFILE *fp, long offset, int whence) return 0; } -int FCEU_read32le(uint32 *Bufo, FCEUFILE *fp) +int FCEU_read32le(uint32_t *Bufo, FCEUFILE *fp) { if ((fp->fp->location + 4) > fp->fp->size) return 0; @@ -215,12 +215,12 @@ int FCEU_fgetc(FCEUFILE *fp) return EOF; } -uint64 FCEU_ftell(FCEUFILE *fp) +uint64_t FCEU_ftell(FCEUFILE *fp) { return fp->fp->location; } -uint64 FCEU_fgetsize(FCEUFILE *fp) +uint64_t FCEU_fgetsize(FCEUFILE *fp) { return fp->fp->size; } diff --git a/src/file.h b/src/file.h index 09167dd..58c749c 100644 --- a/src/file.h +++ b/src/file.h @@ -2,23 +2,23 @@ #define _FCEU_FILE_H typedef struct { - uint8 *data_int; - const uint8 *data; - uint32 size; - uint32 location; + uint8_t *data_int; + const uint8_t *data; + uint32_t size; + uint32_t location; } MEMWRAP; typedef struct { MEMWRAP *fp; } FCEUFILE; -FCEUFILE *FCEU_fopen(const char *path, const uint8 *buffer, size_t bufsize); +FCEUFILE *FCEU_fopen(const char *path, const uint8_t *buffer, size_t bufsize); int FCEU_fclose(FCEUFILE*); -uint64 FCEU_fread(void *ptr, size_t size, size_t nmemb, FCEUFILE*); +uint64_t FCEU_fread(void *ptr, size_t size, size_t nmemb, FCEUFILE*); int FCEU_fseek(FCEUFILE*, long offset, int whence); -uint64 FCEU_ftell(FCEUFILE*); -int FCEU_read32le(uint32 *Bufo, FCEUFILE*); +uint64_t FCEU_ftell(FCEUFILE*); +int FCEU_read32le(uint32_t *Bufo, FCEUFILE*); int FCEU_fgetc(FCEUFILE*); -uint64 FCEU_fgetsize(FCEUFILE*); +uint64_t FCEU_fgetsize(FCEUFILE*); #endif diff --git a/src/filter.c b/src/filter.c index fcc752e..3e4f364 100644 --- a/src/filter.c +++ b/src/filter.c @@ -8,41 +8,41 @@ #include "fcoeffs.h" -static uint32 mrindex; -static uint32 mrratio; +static uint32_t mrindex; +static uint32_t mrratio; -void SexyFilter2(int32 *in, int32 count) { +void SexyFilter2(int32_t *in, int32_t count) { #ifdef moo - static int64 acc = 0; + static int64_t acc = 0; double x, p; - int64 c; + int64_t c; x = 2 * M_PI * 6000 / FSettings.SndRate; p = ((double)2 - cos(x)) - sqrt(pow((double)2 - cos(x), 2) - 1); c = p * 0x100000; #endif - static int64 acc = 0; + static int64_t acc = 0; while (count--) { - int64 dropcurrent; + int64_t dropcurrent; dropcurrent = ((*in << 16) - acc) >> 3; acc += dropcurrent; *in = acc >> 16; in++; #if 0 - acc=((int64)0x100000-c)* *in + ((c*acc)>>20); + acc=((int64_t)0x100000-c)* *in + ((c*acc)>>20); *in=acc>>20; in++; #endif } } -int64 sexyfilter_acc1 = 0, sexyfilter_acc2 = 0; +int64_t sexyfilter_acc1 = 0, sexyfilter_acc2 = 0; -void SexyFilter(int32 *in, int32 *out, int32 count) { - int32 mul1, mul2, vmul; +void SexyFilter(int32_t *in, int32_t *out, int32_t count) { + int32_t mul1, mul2, vmul; mul1 = (94 << 16) / FSettings.SndRate; mul2 = (24 << 16) / FSettings.SndRate; @@ -54,12 +54,12 @@ void SexyFilter(int32 *in, int32 *out, int32 count) { vmul *= 2; /* TODO: Increase volume in low quality sound rendering code itself */ while (count) { - int64 ino = (int64) * in * vmul; + int64_t ino = (int64_t) * in * vmul; sexyfilter_acc1 += ((ino - sexyfilter_acc1) * mul1) >> 16; sexyfilter_acc2 += ((ino - sexyfilter_acc1 - sexyfilter_acc2) * mul2) >> 16; *in = 0; { - int32 t = (sexyfilter_acc1 - ino + sexyfilter_acc2) >> 16; + int32_t t = (sexyfilter_acc1 - ino + sexyfilter_acc2) >> 16; if (t > 32767) t = 32767; if (t < -32768) t = -32768; *out = t; @@ -75,47 +75,47 @@ void SexyFilter(int32 *in, int32 *out, int32 count) { from the end of in to the beginning of in. */ -/* static uint32 mva=1000; */ +/* static uint32_t mva=1000; */ /* This filtering code assumes that almost all input values stay below 32767. Do not adjust the volume in the wlookup tables and the expansion sound code to be higher, or you *might* overflow the FIR code. */ -int32 NeoFilterSound(int32 *in, int32 *out, uint32 inlen, int32 *leftover) { - uint32 x; - int32 *outsave = out; - int32 count = 0; - uint32 max = (inlen - 1) << 16; +int32_t NeoFilterSound(int32_t *in, int32_t *out, uint32_t inlen, int32_t *leftover) { + uint32_t x; + int32_t *outsave = out; + int32_t count = 0; + uint32_t max = (inlen - 1) << 16; if (FSettings.soundq == 2) { for (x = mrindex; x < max; x += mrratio) { - int32 acc = 0, acc2 = 0; - uint32 c; - int32 *S, *D; + int32_t acc = 0, acc2 = 0; + uint32_t c; + int32_t *S, *D; for (c = SQ2NCOEFFS, S = &in[(x >> 16) - SQ2NCOEFFS], D = sq2coeffs; c; c--, D++) { acc += (S[c] * *D) >> 6; acc2 += (S[1 + c] * *D) >> 6; } - acc = ((int64)acc * (65536 - (x & 65535)) + (int64)acc2 * (x & 65535)) >> (16 + 11); + acc = ((int64_t)acc * (65536 - (x & 65535)) + (int64_t)acc2 * (x & 65535)) >> (16 + 11); *out = acc; out++; count++; } } else { for (x = mrindex; x < max; x += mrratio) { - int32 acc = 0, acc2 = 0; - uint32 c; - int32 *S, *D; + int32_t acc = 0, acc2 = 0; + uint32_t c; + int32_t *S, *D; for (c = NCOEFFS, S = &in[(x >> 16) - NCOEFFS], D = coeffs; c; c--, D++) { acc += (S[c] * *D) >> 6; acc2 += (S[1 + c] * *D) >> 6; } - acc = ((int64)acc * (65536 - (x & 65535)) + (int64)acc2 * (x & 65535)) >> (16 + 11); + acc = ((int64_t)acc * (65536 - (x & 65535)) + (int64_t)acc2 * (x & 65535)) >> (16 + 11); *out = acc; out++; count++; @@ -141,15 +141,15 @@ int32 NeoFilterSound(int32 *in, int32 *out, uint32 inlen, int32 *leftover) { return(count); } -void MakeFilters(int32 rate) { - int32 *tabs[6] = { C44100NTSC, C44100PAL, C48000NTSC, C48000PAL, C96000NTSC, +void MakeFilters(int32_t rate) { + int32_t *tabs[6] = { C44100NTSC, C44100PAL, C48000NTSC, C48000PAL, C96000NTSC, C96000PAL }; - int32 *sq2tabs[6] = { SQ2C44100NTSC, SQ2C44100PAL, SQ2C48000NTSC, SQ2C48000PAL, + int32_t *sq2tabs[6] = { SQ2C44100NTSC, SQ2C44100PAL, SQ2C48000NTSC, SQ2C48000PAL, SQ2C96000NTSC, SQ2C96000PAL }; - int32 *tmp; - int32 x; - uint32 nco; + int32_t *tmp; + int32_t x; + uint32_t nco; if (FSettings.soundq == 2) nco = SQ2NCOEFFS; @@ -157,7 +157,7 @@ void MakeFilters(int32 rate) { nco = NCOEFFS; mrindex = (nco + 1) << 16; - mrratio = (PAL ? (int64)(PAL_CPU * 65536) : (int64)(NTSC_CPU * 65536)) / rate; + mrratio = (PAL ? (int64_t)(PAL_CPU * 65536) : (int64_t)(NTSC_CPU * 65536)) / rate; if (FSettings.soundq == 2) tmp = sq2tabs[(PAL ? 1 : 0) | (rate == 48000 ? 2 : 0) | (rate == 96000 ? 4 : 0)]; diff --git a/src/filter.h b/src/filter.h index 34c0338..e881280 100644 --- a/src/filter.h +++ b/src/filter.h @@ -1,11 +1,11 @@ #ifndef _FCEU_FILTER_H #define _FCEU_FILTER_H -int32 NeoFilterSound(int32 *in, int32 *out, uint32 inlen, int32 *leftover); -void MakeFilters(int32 rate); -void SexyFilter(int32 *in, int32 *out, int32 count); -void SexyFilter2(int32 *in, int32 count); +int32_t NeoFilterSound(int32_t *in, int32_t *out, uint32_t inlen, int32_t *leftover); +void MakeFilters(int32_t rate); +void SexyFilter(int32_t *in, int32_t *out, int32_t count); +void SexyFilter2(int32_t *in, int32_t count); -extern int64 sexyfilter_acc1, sexyfilter_acc2; +extern int64_t sexyfilter_acc1, sexyfilter_acc2; #endif diff --git a/src/general.c b/src/general.c index 1eca210..2d34b63 100644 --- a/src/general.c +++ b/src/general.c @@ -81,7 +81,7 @@ char *FCEU_MakeFName(int type, int id1, char *cd1) return(ret); } -uint32 uppow2(uint32 n) +uint32_t uppow2(uint32_t n) { int x; diff --git a/src/general.h b/src/general.h index f7bbd0c..05878af 100644 --- a/src/general.h +++ b/src/general.h @@ -1,7 +1,7 @@ #ifndef _FCEU_GENERAL_H #define _FCEU_GENERAL_H -extern uint32 uppow2(uint32 n); +extern uint32_t uppow2(uint32_t n); char *FCEU_MakeFName(int type, int id1, char *cd1); diff --git a/src/git.h b/src/git.h index d14e792..4d19422 100644 --- a/src/git.h +++ b/src/git.h @@ -12,7 +12,7 @@ #define GIV_USER 2 /* What was set by FCEUI_SetVidSys(). */ typedef struct { - uint8 *name; /* Game name, UTF8 encoding */ + uint8_t *name; /* Game name, UTF8 encoding */ int type; /* GIT_* */ int vidsys; /* Current emulated video system; GIV_* */ @@ -22,7 +22,7 @@ typedef struct { desired input. */ int cspecial; /* Special cart expansion: DIP switches, barcode reader, etc. */ - uint8 MD5[16]; + uint8_t MD5[16]; int soundrate; /* For Ogg Vorbis expansion sound wacky support. 0 for default. */ int soundchan; /* Number of sound channels. */ int gameid; /* Currently used for VS game id for per-game dipswitch */ diff --git a/src/ines.c b/src/ines.c index 5f1d807..0fce905 100644 --- a/src/ines.c +++ b/src/ines.c @@ -43,17 +43,17 @@ extern SFORMAT FCEUVSUNI_STATEINFO[]; -uint8 *trainerpoo = NULL; -uint8 *ROM = NULL; -uint8 *VROM = NULL; -uint8 *ExtraNTARAM = NULL; -uint8 *MiscROM = NULL; +uint8_t *trainerpoo = NULL; +uint8_t *ROM = NULL; +uint8_t *VROM = NULL; +uint8_t *ExtraNTARAM = NULL; +uint8_t *MiscROM = NULL; iNES_HEADER head = {0}; CartInfo iNESCart = {0}; -uint32 ROM_size = 0; -uint32 VROM_size = 0; +uint32_t ROM_size = 0; +uint32_t VROM_size = 0; static int CHRRAMSize = -1; @@ -117,12 +117,12 @@ static void iNESGI(int h) { } struct CRCMATCH { - uint32 crc; + uint32_t crc; char *name; }; struct INPSEL { - uint32 crc32; + uint32_t crc32; int input1; int input2; int inputfc; @@ -247,9 +247,9 @@ static void SetInput(void) { #define INESB_HACKED 4 struct BADINF { - uint64 md5partial; - uint8 *name; - uint32 type; + uint64_t md5partial; + uint8_t *name; + uint32_t type; }; static struct BADINF BadROMImages[] = @@ -257,9 +257,9 @@ static struct BADINF BadROMImages[] = #include "ines-bad.h" }; -static void CheckBad(uint64 md5partial) +static void CheckBad(uint64_t md5partial) { - int32 x = 0; + int32_t x = 0; while (BadROMImages[x].name) { if (BadROMImages[x].md5partial == md5partial) @@ -272,15 +272,15 @@ static void CheckBad(uint64 md5partial) } struct CHINF { - uint32 crc32; - int32 mapper; - int32 submapper; - int32 mirror; - int32 battery; - int32 prgram; /* ines2 prgram format */ - int32 chrram; /* ines2 chrram format */ - int32 region; - int32 extra; + uint32_t crc32; + int32_t mapper; + int32_t submapper; + int32_t mirror; + int32_t battery; + int32_t prgram; /* ines2 prgram format */ + int32_t chrram; /* ines2 chrram format */ + int32_t region; + int32_t extra; }; static void CheckHInfo(void) @@ -301,13 +301,13 @@ static void CheckHInfo(void) { #include "ines-correct.h" }; - int32 tofix = 0, x; - uint64 partialmd5 = 0; - int32 current_mapper = 0; - int32 cur_mirr = 0; + int32_t tofix = 0, x; + uint64_t partialmd5 = 0; + int32_t current_mapper = 0; + int32_t cur_mirr = 0; for (x = 0; x < 8; x++) - partialmd5 |= (uint64)iNESCart.MD5[15 - x] << (x * 8); + partialmd5 |= (uint64_t)iNESCart.MD5[15 - x] << (x * 8); CheckBad(partialmd5); x = 0; @@ -401,7 +401,7 @@ static void CheckHInfo(void) if (tofix & 1) sprintf(gigastr + gigastr_len, "Current mapper # is %d. The mapper number should be set to %d. ", current_mapper, iNESCart.mapper); if (tofix & 2) { - uint8 *mstr[3] = { (uint8_t*)"Horizontal", (uint8_t*)"Vertical", (uint8_t*)"Four-screen" }; + uint8_t *mstr[3] = { (uint8_t*)"Horizontal", (uint8_t*)"Vertical", (uint8_t*)"Four-screen" }; sprintf(gigastr + gigastr_len, "Current mirroring is %s. Mirroring should be set to \"%s\". ", mstr[cur_mirr & 3], mstr[iNESCart.mirror & 3]); } if (tofix & 4) @@ -409,7 +409,7 @@ static void CheckHInfo(void) if (tofix & 8) strcat(gigastr, "This game should not have any CHR ROM. "); if (tofix & 16) { - uint8 *rstr[4] = { (uint8*)"NTSC", (uint8*)"PAL", (uint8*)"Multi", (uint8*)"Dendy" }; + uint8_t *rstr[4] = { (uint8_t*)"NTSC", (uint8_t*)"PAL", (uint8_t*)"Multi", (uint8_t*)"Dendy" }; sprintf(gigastr + gigastr_len, "This game should run with \"%s\" timings.", rstr[iNESCart.region]); } if (tofix & 32) { @@ -438,13 +438,13 @@ static void CheckHInfo(void) } typedef struct { - int32 mapper; + int32_t mapper; void (*init)(CartInfo *); } NewMI; typedef struct { - uint8 *name; - int32 number; + uint8_t *name; + int32_t number; void (*init)(CartInfo *); } BMAPPINGLocal; @@ -1039,15 +1039,15 @@ INES_BOARD_BEGIN() INES_BOARD( "FC 4-in-1 (NS32)", 618, Mapper618_Init ) INES_BOARD_END() -static uint32 iNES_get_mapper_id(void) +static uint32_t iNES_get_mapper_id(void) { /* If byte 7 AND $0C = $08, and the size taking into account byte 9 does not exceed the actual size of the ROM image, then NES 2.0. * If byte 7 AND $0C = $00, and bytes 12-15 are all 0, then iNES. * Otherwise, archaic iNES. - nesdev*/ - uint32 ret; + uint32_t ret; switch (head.ROM_type2 & 0x0C) { case 0x08: /* header version is NES 2.0 */ - ret = (((uint32)head.ROM_type3 << 8) & 0xF00) | (head.ROM_type2 & 0xF0) | (head.ROM_type >> 4); + ret = (((uint32_t)head.ROM_type3 << 8) & 0xF00) | (head.ROM_type2 & 0xF0) | (head.ROM_type >> 4); break; case 0x00: /* header version is iNES */ ret = (head.ROM_type2 & 0xF0) | (head.ROM_type >> 4); @@ -1079,21 +1079,21 @@ static void iNES_read_header_info(void) { /* iNES 2.0 exponent encoding: when the 12-bit count >= 0xF00, the byte * encodes (multiplier * 2^exponent) where exponent = byte>>2 (0..63) and * multiplier = (byte&3)*2+1. Cap exponent so the result stays well - * within uint32 (and a sane size); otherwise pow(2, 63) overflows - * uint32 implicitly with undefined results, and downstream uppow2() + * within uint32_t (and a sane size); otherwise pow(2, 63) overflows + * uint32_t implicitly with undefined results, and downstream uppow2() * truncates back to a small allocation, leading to a heap overflow on * the subsequent fread. Cap at 30 so the maximum is 7 << 30 = ~7 GiB - * which still fits in uint32 (truncated to ~3 GiB) but is far above + * which still fits in uint32_t (truncated to ~3 GiB) but is far above * any real cart and gets caught by sane validation. We additionally * clamp the final value to a safe ceiling. */ { - uint32 exp_prg = head.ROM_size >> 2; - uint32 exp_chr = head.VROM_size >> 2; - uint32 prg, chr; + uint32_t exp_prg = head.ROM_size >> 2; + uint32_t exp_chr = head.VROM_size >> 2; + uint32_t prg, chr; if (exp_prg > 30) exp_prg = 30; if (exp_chr > 30) exp_chr = 30; - prg = ROM_size >= 0xF00 ? ((uint32)1 << exp_prg) * ((head.ROM_size & 3) * 2 + 1) : (ROM_size * 0x4000); - chr = VROM_size >= 0xF00 ? ((uint32)1 << exp_chr) * ((head.VROM_size & 3) * 2 + 1) : (VROM_size * 0x2000); + prg = ROM_size >= 0xF00 ? ((uint32_t)1 << exp_prg) * ((head.ROM_size & 3) * 2 + 1) : (ROM_size * 0x4000); + chr = VROM_size >= 0xF00 ? ((uint32_t)1 << exp_chr) * ((head.VROM_size & 3) * 2 + 1) : (VROM_size * 0x2000); /* Cap below 2 GiB so the value fits comfortably in the * downstream int PRGRomSize / CHRRomSize fields without * going negative, and so uppow2 returns a finite power-of-two @@ -1105,15 +1105,15 @@ static void iNES_read_header_info(void) { } iNESCart.miscROMNumber =head.MiscRoms; if (iNESCart.miscROMNumber) { - /* Compute miscROMSize as int64 to avoid silent wraparound when + /* Compute miscROMSize as int64_t to avoid silent wraparound when * the (attacker-controlled) PRGRomSize / CHRRomSize fields * exceed the file size. Reject negative or absurdly large * results rather than passing a wrapped value to malloc. */ - int64 misc = (int64)iNESCart.totalFileSize + int64_t misc = (int64_t)iNESCart.totalFileSize - 16 - ((head.ROM_type & 4) ? 512 : 0) - - (int64)iNESCart.PRGRomSize - - (int64)iNESCart.CHRRomSize; + - (int64_t)iNESCart.PRGRomSize + - (int64_t)iNESCart.CHRRomSize; if (misc <= 0 || misc > 0x8000000) /* > 128 MiB is suspect */ iNESCart.miscROMSize = 0; else @@ -1134,13 +1134,13 @@ int iNESLoad(const char *name, FCEUFILE *fp) struct md5_context md5; #ifdef DEBUG char* mappername = NULL; - uint32 mappertest = 0; + uint32_t mappertest = 0; #endif - uint64 filesize = FCEU_fgetsize(fp); /* size of file including header */ - uint64 romSize = 0; /* size of PRG + CHR rom */ + uint64_t filesize = FCEU_fgetsize(fp); /* size of file including header */ + uint64_t romSize = 0; /* size of PRG + CHR rom */ /* used for malloc and cart mapping */ - uint32 rom_size_pow2 = 0; - uint32 vrom_size_pow2 = 0; + uint32_t rom_size_pow2 = 0; + uint32_t vrom_size_pow2 = 0; if (FCEU_fread(&head, 1, 16, fp) != 16) return 0; @@ -1178,7 +1178,7 @@ int iNESLoad(const char *name, FCEUFILE *fp) /* Trainer */ if (head.ROM_type & 4) { - trainerpoo = (uint8*)FCEU_gmalloc(512); + trainerpoo = (uint8_t*)FCEU_gmalloc(512); FCEU_fread(trainerpoo, 512, 1, fp); filesize -= 512; } @@ -1194,7 +1194,7 @@ int iNESLoad(const char *name, FCEUFILE *fp) rom_size_pow2 = uppow2(iNESCart.PRGRomSize); - if ((ROM = (uint8*)FCEU_malloc(rom_size_pow2)) == NULL) + if ((ROM = (uint8_t*)FCEU_malloc(rom_size_pow2)) == NULL) return 0; memset(ROM, 0xFF, rom_size_pow2); @@ -1203,7 +1203,7 @@ int iNESLoad(const char *name, FCEUFILE *fp) if (iNESCart.CHRRomSize) { vrom_size_pow2 = uppow2(iNESCart.CHRRomSize); - if ((VROM = (uint8*)FCEU_malloc(vrom_size_pow2)) == NULL) + if ((VROM = (uint8_t*)FCEU_malloc(vrom_size_pow2)) == NULL) { free(ROM); ROM = NULL; @@ -1215,7 +1215,7 @@ int iNESLoad(const char *name, FCEUFILE *fp) } if (iNESCart.miscROMSize) { - MiscROM =(uint8*) FCEU_malloc(iNESCart.miscROMSize); + MiscROM =(uint8_t*) FCEU_malloc(iNESCart.miscROMSize); if (!MiscROM) { free(VROM); free(ROM); @@ -1315,12 +1315,12 @@ int iNESLoad(const char *name, FCEUFILE *fp) { int x; - uint64 partialmd5 = 0; + uint64_t partialmd5 = 0; int mapper = iNESCart.mapper; int mirroring = iNESCart.mirror; for (x = 0; x < 8; x++) - partialmd5 |= (uint64)iNESCart.MD5[7 - x] << (x * 8); + partialmd5 |= (uint64_t)iNESCart.MD5[7 - x] << (x * 8); FCEU_VSUniCheck(partialmd5, &mapper, &mirroring); @@ -1346,7 +1346,7 @@ int iNESLoad(const char *name, FCEUFILE *fp) if (iNESCart.mirror == 2) { - ExtraNTARAM = (uint8*)FCEU_gmalloc(2048); + ExtraNTARAM = (uint8_t*)FCEU_gmalloc(2048); SetupCartMirroring(4, 1, ExtraNTARAM); } else if (iNESCart.mirror >= 0x10) @@ -1409,7 +1409,12 @@ static int iNES_Init(int num) { iNESCart.CHRRamSize = CHRRAMSize; } if (CHRRAMSize > 0) { /* TODO: CHR-RAM are sometimes handled in mappers e.g. MMC1 using submapper 1/2/4 and CHR-RAM can be zero here */ - if ((VROM = (uint8*)malloc(CHRRAMSize)) == NULL) return 0; + if ((VROM = (uint8_t*)malloc(CHRRAMSize)) == NULL) return 0; + /* Seed the deterministic memory PRNG from the cart's + * PRG CRC32 so the same ROM always produces the same + * initial CHR-RAM contents but different ROMs differ. + * iNESCart.PRGCRC32 was set above. */ + FCEU_MemoryRand_Reseed(iNESCart.PRGCRC32); FCEU_MemoryRand(VROM, CHRRAMSize); UNIFchrrama = VROM; SetupCartCHRMapping(0, VROM, CHRRAMSize, 1); diff --git a/src/ines.h b/src/ines.h index ed9e299..b87ec17 100644 --- a/src/ines.h +++ b/src/ines.h @@ -24,27 +24,27 @@ typedef struct { char ID[4]; /*NES^Z*/ - uint8 ROM_size; - uint8 VROM_size; - uint8 ROM_type; - uint8 ROM_type2; - uint8 ROM_type3; - uint8 upper_PRG_CHR_size; - uint8 PRGRAM_size; - uint8 CHRRAM_size; - uint8 Region; - uint8 VS_hardware; - uint8 MiscRoms; - uint8 ExpDevice; + uint8_t ROM_size; + uint8_t VROM_size; + uint8_t ROM_type; + uint8_t ROM_type2; + uint8_t ROM_type3; + uint8_t upper_PRG_CHR_size; + uint8_t PRGRAM_size; + uint8_t CHRRAM_size; + uint8_t Region; + uint8_t VS_hardware; + uint8_t MiscRoms; + uint8_t ExpDevice; } iNES_HEADER; -extern uint8 *trainerpoo; -extern uint8 *ROM; -extern uint8 *VROM; -extern uint8 *MiscROM; -extern uint32 ROM_size; /* prg size in 16K chunks */ -extern uint32 VROM_size; /* chr size in 8K chunks */ -extern uint32 MiscROM_size; +extern uint8_t *trainerpoo; +extern uint8_t *ROM; +extern uint8_t *VROM; +extern uint8_t *MiscROM; +extern uint32_t ROM_size; /* prg size in 16K chunks */ +extern uint32_t VROM_size; /* chr size in 8K chunks */ +extern uint32_t MiscROM_size; extern iNES_HEADER head; void NSFVRC6_Init(void); diff --git a/src/input.c b/src/input.c index 36f48b6..4f5c50a 100644 --- a/src/input.c +++ b/src/input.c @@ -53,11 +53,11 @@ extern INPUTCFC *FCEU_InitOekaKids(void); extern INPUTCFC *FCEU_InitTopRider(void); extern INPUTCFC *FCEU_InitBarcodeWorld(void); -static uint8 joy_readbit[2]; -static uint8 joy[4] = { 0, 0, 0, 0 }; -static uint8 LastStrobe; +static uint8_t joy_readbit[2]; +static uint8_t joy[4] = { 0, 0, 0, 0 }; +static uint8_t LastStrobe; -extern uint8 coinon; +extern uint8_t coinon; static int FSDisable = 0; /* Set to 1 if NES-style four-player adapter is disabled. */ static int JPAttrib[2] = { 0, 0 }; @@ -72,11 +72,11 @@ static INPUTC DummyJPort = { 0, 0, 0, 0, 0, 0 }; static INPUTC *JPorts[2] = { &DummyJPort, &DummyJPort }; static INPUTCFC *FCExp = 0; -void (*InputScanlineHook)(uint8 *bg, uint8 *spr, uint32 linets, int final); +void (*InputScanlineHook)(uint8_t *bg, uint8_t *spr, uint32_t linets, int final); static DECLFR(JPRead) { - uint8 ret = 0; + uint8_t ret = 0; if (JPorts[A & 1]->Read) ret |= JPorts[A & 1]->Read(A & 1); @@ -114,7 +114,7 @@ static DECLFW(B4016) LastStrobe = V & 0x1; } -void FCEU_DrawInput(uint8 *buf) +void FCEU_DrawInput(uint8_t *buf) { int x; @@ -130,18 +130,18 @@ void FCEU_DrawInput(uint8 *buf) /* This function is a quick hack to get the NSF player to use emulated gamepad input. */ -uint8 FCEU_GetJoyJoy(void) { +uint8_t FCEU_GetJoyJoy(void) { return(joy[0] | joy[1] | joy[2] | joy[3]); } /* 4-player support for famicom expansion */ -static uint8 F4ReadBit[2]; +static uint8_t F4ReadBit[2]; static void StrobeFami4(void) { F4ReadBit[0] = F4ReadBit[1] = 0; } -static uint8 FP_FASTAPASS(2) ReadFami4(int w, uint8 ret) { +static uint8_t FP_FASTAPASS(2) ReadFami4(int w, uint8_t ret) { ret &= 1; ret |= ((joy[2 + w] >> (F4ReadBit[w])) & 1) << 1; if (F4ReadBit[w] >= 8) ret |= 2; @@ -150,8 +150,8 @@ static uint8 FP_FASTAPASS(2) ReadFami4(int w, uint8 ret) { } /* VS. Unisystem inputs */ -static uint8 FP_FASTAPASS(1) ReadGPVS(int w) { - uint8 ret = 0; +static uint8_t FP_FASTAPASS(1) ReadGPVS(int w) { + uint8_t ret = 0; if (joy_readbit[w] >= 8) ret = 1; else { @@ -165,8 +165,8 @@ static uint8 FP_FASTAPASS(1) ReadGPVS(int w) { } /* standard gamepad inputs */ -static uint8 FP_FASTAPASS(1) ReadGP(int w) { - uint8 ret; +static uint8_t FP_FASTAPASS(1) ReadGP(int w) { + uint8_t ret; if (joy_readbit[w] >= 8) ret = ((joy[2 + w] >> (joy_readbit[w] & 7)) & 1); else @@ -187,17 +187,17 @@ static uint8 FP_FASTAPASS(1) ReadGP(int w) { } static void FP_FASTAPASS(3) UpdateGP(int w, void *data, int arg) { - /* JSReturn is constructed by the libretro frontend as a uint32 with - * player N at bits (N<<3)..(N<<3)+7. Reading via host-endian uint32 + /* JSReturn is constructed by the libretro frontend as a uint32_t with + * player N at bits (N<<3)..(N<<3)+7. Reading via host-endian uint32_t * cast and shifting gives the correct player byte regardless of host * endianness, because the writer used the matching shift. */ - uint32 *ptr = (uint32*)data; + uint32_t *ptr = (uint32_t*)data; if (!w) { - joy[0] = *(uint32*)ptr; - joy[2] = *(uint32*)ptr >> 16; + joy[0] = *(uint32_t*)ptr; + joy[2] = *(uint32_t*)ptr >> 16; } else { - joy[1] = *(uint32*)ptr >> 8; - joy[3] = *(uint32*)ptr >> 24; + joy[1] = *(uint32_t*)ptr >> 8; + joy[3] = *(uint32_t*)ptr >> 24; } } @@ -233,7 +233,7 @@ void FCEU_UpdateInput(void) static DECLFR(VSUNIRead0) { - uint8 ret = 0; + uint8_t ret = 0; if (JPorts[0]->Read) ret |= (JPorts[0]->Read(0)) & 1; @@ -246,7 +246,7 @@ static DECLFR(VSUNIRead0) static DECLFR(VSUNIRead1) { - uint8 ret = 0; + uint8_t ret = 0; if (JPorts[1] && JPorts[1]->Read) ret |= (JPorts[1]->Read(1)) & 1; @@ -254,7 +254,7 @@ static DECLFR(VSUNIRead1) return ret; } -static void SLHLHook(uint8 *bg, uint8 *spr, uint32 linets, int final) +static void SLHLHook(uint8_t *bg, uint8_t *spr, uint32_t linets, int final) { int x; diff --git a/src/input.h b/src/input.h index 0dcaa06..70e5828 100644 --- a/src/input.h +++ b/src/input.h @@ -2,28 +2,28 @@ #define _FCEU_INPUT_H typedef struct { - uint8 FP_FASTAPASS(1) (*Read)(int w); - void FP_FASTAPASS(1) (*Write)(uint8 v); + uint8_t FP_FASTAPASS(1) (*Read)(int w); + void FP_FASTAPASS(1) (*Write)(uint8_t v); void FP_FASTAPASS(1) (*Strobe)(int w); void FP_FASTAPASS(3) (*Update)(int w, void *data, int arg); - void FP_FASTAPASS(3) (*SLHook)(int w, uint8 *bg, uint8 *spr, uint32 linets, int final); - void FP_FASTAPASS(3) (*Draw)(int w, uint8 *buf, int arg); + void FP_FASTAPASS(3) (*SLHook)(int w, uint8_t *bg, uint8_t *spr, uint32_t linets, int final); + void FP_FASTAPASS(3) (*Draw)(int w, uint8_t *buf, int arg); } INPUTC; typedef struct { - uint8 FP_FASTAPASS(2) (*Read)(int w, uint8 ret); - void FP_FASTAPASS(1) (*Write)(uint8 v); + uint8_t FP_FASTAPASS(2) (*Read)(int w, uint8_t ret); + void FP_FASTAPASS(1) (*Write)(uint8_t v); void (*Strobe)(void); void FP_FASTAPASS(2) (*Update)(void *data, int arg); - void FP_FASTAPASS(3) (*SLHook)(uint8 *bg, uint8 *spr, uint32 linets, int final); - void FP_FASTAPASS(2) (*Draw)(uint8 *buf, int arg); + void FP_FASTAPASS(3) (*SLHook)(uint8_t *bg, uint8_t *spr, uint32_t linets, int final); + void FP_FASTAPASS(2) (*Draw)(uint8_t *buf, int arg); } INPUTCFC; -void FCEU_DrawInput(uint8 *buf); +void FCEU_DrawInput(uint8_t *buf); void FCEU_UpdateInput(void); void InitializeInput(void); extern void (*PStrobe[2])(void); -extern void (*InputScanlineHook)(uint8 *bg, uint8 *spr, uint32 linets, int final); +extern void (*InputScanlineHook)(uint8_t *bg, uint8_t *spr, uint32_t linets, int final); void FCEU_DoSimpleCommand(int cmd); diff --git a/src/input/arkanoid.c b/src/input/arkanoid.c index 453dfdf..9450eb3 100644 --- a/src/input/arkanoid.c +++ b/src/input/arkanoid.c @@ -23,8 +23,8 @@ #include "share.h" typedef struct { - uint32 mzx, mzb; - uint32 readbit; + uint32_t mzx, mzb; + uint32_t readbit; } ARK; static ARK NESArk[2]; @@ -34,7 +34,7 @@ static void StrobeARKFC(void) { FCArk.readbit = 0; } -static uint8 FP_FASTAPASS(2) ReadARKFC(int w, uint8 ret) { +static uint8_t FP_FASTAPASS(2) ReadARKFC(int w, uint8_t ret) { ret &= ~2; if (w) { if (FCArk.readbit >= 8) @@ -51,7 +51,7 @@ static uint8 FP_FASTAPASS(2) ReadARKFC(int w, uint8 ret) { return(ret); } -static uint32 FixX(uint32 x) { +static uint32_t FixX(uint32_t x) { x = 98 + x * 144 / 240; if (x > 242) x = 242; x = ~x; @@ -59,7 +59,7 @@ static uint32 FixX(uint32 x) { } static void FP_FASTAPASS(2) UpdateARKFC(void *data, int arg) { - uint32 *ptr = (uint32*)data; + uint32_t *ptr = (uint32_t*)data; FCArk.mzx = FixX(ptr[0]); FCArk.mzb = ptr[2] ? 1 : 0; } @@ -72,8 +72,8 @@ INPUTCFC *FCEU_InitArkanoidFC(void) { return(&ARKCFC); } -static uint8 FP_FASTAPASS(1) ReadARK(int w) { - uint8 ret = 0; +static uint8_t FP_FASTAPASS(1) ReadARK(int w) { + uint8_t ret = 0; if (NESArk[w].readbit >= 8) ret |= 1 << 4; else { @@ -92,7 +92,7 @@ static void FP_FASTAPASS(1) StrobeARK(int w) { } static void FP_FASTAPASS(3) UpdateARK(int w, void *data, int arg) { - uint32 *ptr = (uint32*)data; + uint32_t *ptr = (uint32_t*)data; NESArk[w].mzx = FixX(ptr[0]); NESArk[w].mzb = ptr[2] ? 1 : 0; } diff --git a/src/input/bbox.c b/src/input/bbox.c index 5622455..7b666d6 100644 --- a/src/input/bbox.c +++ b/src/input/bbox.c @@ -31,27 +31,27 @@ typedef struct { - uint8 state; - uint8 cmd; - uint8 addr; - uint8 iswritable; - uint16 acc; - uint16 data[128]; + uint8_t state; + uint8_t cmd; + uint8_t addr; + uint8_t iswritable; + uint16_t acc; + uint16_t data[128]; } EEPROM; EEPROM serialROM[2]; -uint8 oldCLK, bankFlip, DIFlip, OUT0state; +uint8_t oldCLK, bankFlip, DIFlip, OUT0state; -uint8 serialROMautomat(uint8 chip, uint16 data) +uint8_t serialROMautomat(uint8_t chip, uint16_t data) { - uint8 resp = 1; + uint8_t resp = 1; chip &= 1; if(!(data & CS)) { if(!(data & CLK)) { - uint8 state = serialROM[chip].state; - uint8 mask, i; + uint8_t state = serialROM[chip].state; + uint8_t mask, i; switch (serialROM[chip].cmd) { case 0x00: @@ -141,9 +141,9 @@ uint8 serialROMautomat(uint8 chip, uint16 data) return resp; } -uint8 serialROMstate(uint8 linestate) +uint8_t serialROMstate(uint8_t linestate) { - uint8 answ = 0, newCLK = linestate & CLK; + uint8_t answ = 0, newCLK = linestate & CLK; if((!oldCLK)&&newCLK) { DIFlip^=1; @@ -160,7 +160,7 @@ uint8 serialROMstate(uint8 linestate) return answ; } -static uint8 FP_FASTAPASS(2) BBRead(int w, uint8 ret) +static uint8_t FP_FASTAPASS(2) BBRead(int w, uint8_t ret) { if(w) { @@ -170,7 +170,7 @@ static uint8 FP_FASTAPASS(2) BBRead(int w, uint8 ret) return(ret); } -static void FP_FASTAPASS(1) BBWrite(uint8 V) +static void FP_FASTAPASS(1) BBWrite(uint8_t V) { OUT0state = V; serialROMstate(OUT0state?OUT0:0); diff --git a/src/input/bworld.c b/src/input/bworld.c index 90b1669..9a46745 100644 --- a/src/input/bworld.c +++ b/src/input/bworld.c @@ -22,10 +22,10 @@ #include "share.h" static int seq, ptr, bit, cnt, have; -static uint8 bdata[20]; +static uint8_t bdata[20]; -static uint8 FP_FASTAPASS(2) Read(int w, uint8 ret) { +static uint8_t FP_FASTAPASS(2) Read(int w, uint8_t ret) { if (w && have) { switch (seq) { case 0: seq++; ptr = 0; ret |= 0x4; break; @@ -43,14 +43,14 @@ static uint8 FP_FASTAPASS(2) Read(int w, uint8 ret) { return(ret); } -static void FP_FASTAPASS(1) Write(uint8 V) { +static void FP_FASTAPASS(1) Write(uint8_t V) { } static void FP_FASTAPASS(2) Update(void *data, int arg) { - if (*(uint8*)data) { + if (*(uint8_t*)data) { size_t i; - const uint8 *src = (uint8*)data + 1; - *(uint8*)data = 0; + const uint8_t *src = (uint8_t*)data + 1; + *(uint8_t*)data = 0; seq = ptr = 0; have = 1; /* bdata is 20 bytes total; bytes 13..19 are filled by the diff --git a/src/input/cursor.c b/src/input/cursor.c index 7f88573..8384d36 100644 --- a/src/input/cursor.c +++ b/src/input/cursor.c @@ -1,6 +1,6 @@ #include "share.h" -static uint8 GunSight[] = { +static uint8_t GunSight[] = { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, @@ -15,7 +15,7 @@ static uint8 GunSight[] = { 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, }; -static uint8 FCEUcursor[11 * 19] = +static uint8_t FCEUcursor[11 * 19] = { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -38,13 +38,13 @@ static uint8 FCEUcursor[11 * 19] = 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, }; -void FCEU_DrawGunSight(uint8 *buf, int xc, int yc) { +void FCEU_DrawGunSight(uint8_t *buf, int xc, int yc) { int x, y; int c, d; for (y = 0; y < 13; y++) for (x = 0; x < 13; x++) { - uint8 a; + uint8_t a; a = GunSight[y * 13 + x]; if (a) { c = (yc + y - 7); @@ -60,14 +60,14 @@ void FCEU_DrawGunSight(uint8 *buf, int xc, int yc) { } -void FCEU_DrawCursor(uint8 *buf, int xc, int yc) { +void FCEU_DrawCursor(uint8_t *buf, int xc, int yc) { int x, y; int c, d; if (xc < 256 && yc < 240) for (y = 0; y < 19; y++) for (x = 0; x < 11; x++) { - uint8 a; + uint8_t a; a = FCEUcursor[y * 11 + x]; if (a) { c = (yc + y); diff --git a/src/input/fkb.c b/src/input/fkb.c index 1f39619..dcafd15 100644 --- a/src/input/fkb.c +++ b/src/input/fkb.c @@ -23,11 +23,11 @@ #include "fkb.h" #define AK(x) FKB_ ## x -static uint8 bufit[0x49]; -static uint8 ksmode; -static uint8 ksindex; +static uint8_t bufit[0x49]; +static uint8_t ksmode; +static uint8_t ksindex; -static uint16 matrix[9][2][4] = +static uint16_t matrix[9][2][4] = { { { AK(F8), AK(RETURN), AK(BRACKETLEFT), AK(BRACKETRIGHT) }, { AK(KANA), AK(RIGHTSHIFT), AK(BACKSLASH), AK(STOP) } }, @@ -49,7 +49,7 @@ static uint16 matrix[9][2][4] = { AK(DOWN), AK(SPACE), AK(DELETE), AK(INSERT) } }, }; -static void FP_FASTAPASS(1) FKB_Write(uint8 v) { +static void FP_FASTAPASS(1) FKB_Write(uint8_t v) { v >>= 1; if (v & 2) { if ((ksmode & 1) && !(v & 1)) @@ -58,7 +58,7 @@ static void FP_FASTAPASS(1) FKB_Write(uint8 v) { ksmode = v; } -static uint8 FP_FASTAPASS(2) FKB_Read(int w, uint8 ret) { +static uint8_t FP_FASTAPASS(2) FKB_Read(int w, uint8_t ret) { if (w) { int x; diff --git a/src/input/ftrainer.c b/src/input/ftrainer.c index a018e9c..33c1dd8 100644 --- a/src/input/ftrainer.c +++ b/src/input/ftrainer.c @@ -22,17 +22,17 @@ #include #include "share.h" -static uint32 FTVal, FTValR; +static uint32_t FTVal, FTValR; static char side; -static uint8 FP_FASTAPASS(2) FT_Read(int w, uint8 ret) { +static uint8_t FP_FASTAPASS(2) FT_Read(int w, uint8_t ret) { if (w) { ret |= FTValR; } return(ret); } -static void FP_FASTAPASS(1) FT_Write(uint8 V) { +static void FP_FASTAPASS(1) FT_Write(uint8_t V) { FTValR = 0; if (!(V & 0x1)) @@ -49,7 +49,7 @@ static void FP_FASTAPASS(1) FT_Write(uint8 V) { } static void FP_FASTAPASS(2) FT_Update(void *data, int arg) { - FTVal = *(uint32*)data; + FTVal = *(uint32_t*)data; } static INPUTCFC FamilyTrainer = { FT_Read, FT_Write, 0, FT_Update, 0, 0 }; diff --git a/src/input/hypershot.c b/src/input/hypershot.c index d62c623..eab79cd 100644 --- a/src/input/hypershot.c +++ b/src/input/hypershot.c @@ -21,10 +21,10 @@ #include #include "share.h" -static uint8 HSVal, HSValR; +static uint8_t HSVal, HSValR; -static uint8 FP_FASTAPASS(2) HS_Read(int w, uint8 ret) { +static uint8_t FP_FASTAPASS(2) HS_Read(int w, uint8_t ret) { if (w) ret |= HSValR; return(ret); @@ -35,7 +35,7 @@ static void HS_Strobe(void) { } static void FP_FASTAPASS(2) HS_Update(void *data, int arg) { - HSVal = *(uint8*)data; + HSVal = *(uint8_t*)data; } static INPUTCFC HyperShot = { HS_Read, 0, HS_Strobe, HS_Update, 0, 0 }; diff --git a/src/input/mahjong.c b/src/input/mahjong.c index 497563a..dd8dae3 100644 --- a/src/input/mahjong.c +++ b/src/input/mahjong.c @@ -21,9 +21,9 @@ #include #include "share.h" -static uint32 MReal, MRet; +static uint32_t MReal, MRet; -static uint8 FP_FASTAPASS(2) MJ_Read(int w, uint8 ret) { +static uint8_t FP_FASTAPASS(2) MJ_Read(int w, uint8_t ret) { if (w) { /* ret|=(MRet&1)<<1; */ ret |= ((MRet & 0x80) >> 6) & 2; @@ -36,7 +36,7 @@ static uint8 FP_FASTAPASS(2) MJ_Read(int w, uint8 ret) { return(ret); } -static void FP_FASTAPASS(1) MJ_Write(uint8 v) { +static void FP_FASTAPASS(1) MJ_Write(uint8_t v) { /* 1: I-D7, J-D6, K-D5, L-D4, M-D3, Big Red-D2 2: A-D7, B-D6, C-D5, D-D4, E-D3, F-D2, G-D1, H-D0 3: Sel-D6, Start-D7, D5, D4, D3, D2, D1 @@ -55,7 +55,7 @@ static void FP_FASTAPASS(1) MJ_Write(uint8 v) { } static void FP_FASTAPASS(2) MJ_Update(void *data, int arg) { - MReal = *(uint32*)data; + MReal = *(uint32_t*)data; } static INPUTCFC Mahjong = { MJ_Read, MJ_Write, 0, MJ_Update, 0, 0 }; diff --git a/src/input/mouse.c b/src/input/mouse.c index 28f2e64..6a844e3 100644 --- a/src/input/mouse.c +++ b/src/input/mouse.c @@ -23,9 +23,9 @@ #include "share.h" typedef struct { - int32 mzx, mzy, mzxold, mzyold; - uint32 readbit; - uint32 data; + int32_t mzx, mzy, mzxold, mzyold; + uint32_t readbit; + uint32_t data; } MOUSE; static MOUSE Mouse; @@ -42,8 +42,8 @@ static void FP_FASTAPASS(1) StrobeMOUSE(int w) { Mouse.data |= 0x10; } -static uint8 FP_FASTAPASS(1) ReadMOUSE(int w) { - uint8 ret = 0; +static uint8_t FP_FASTAPASS(1) ReadMOUSE(int w) { + uint8_t ret = 0; if (Mouse.readbit >= 8) ret |= 1; else { @@ -57,7 +57,7 @@ static uint8 FP_FASTAPASS(1) ReadMOUSE(int w) { } static void FP_FASTAPASS(3) UpdateMOUSE(int w, void *data, int arg) { - uint32 *ptr = (uint32*)data; + uint32_t *ptr = (uint32_t*)data; Mouse.data = 0; Mouse.mzxold = Mouse.mzx; Mouse.mzyold = Mouse.mzy; diff --git a/src/input/oekakids.c b/src/input/oekakids.c index a6a5c57..172d9e0 100644 --- a/src/input/oekakids.c +++ b/src/input/oekakids.c @@ -21,20 +21,20 @@ #include #include "share.h" -static uint8 OKValR, LastWR; -static uint32 OKData; -static uint32 OKX, OKY, OKB; +static uint8_t OKValR, LastWR; +static uint32_t OKData; +static uint32_t OKX, OKY, OKB; -static uint8 FP_FASTAPASS(2) OK_Read(int w, uint8 ret) { +static uint8_t FP_FASTAPASS(2) OK_Read(int w, uint8_t ret) { if (w) { ret |= OKValR; } return(ret); } -static void FP_FASTAPASS(1) OK_Write(uint8 V) { +static void FP_FASTAPASS(1) OK_Write(uint8_t V) { if (!(V & 0x1)) { - int32 vx, vy; + int32_t vx, vy; OKValR = OKData = 0; @@ -65,12 +65,12 @@ static void FP_FASTAPASS(1) OK_Write(uint8 V) { } static void FP_FASTAPASS(2) OK_Update(void *data, int arg) { - OKX = ((uint32*)data)[0]; - OKY = ((uint32*)data)[1]; - OKB = ((uint32*)data)[2]; + OKX = ((uint32_t*)data)[0]; + OKY = ((uint32_t*)data)[1]; + OKB = ((uint32_t*)data)[2]; } -static void FP_FASTAPASS(2) DrawOeka(uint8 * buf, int arg) { +static void FP_FASTAPASS(2) DrawOeka(uint8_t * buf, int arg) { if (arg && OKY < 44) FCEU_DrawCursor(buf, OKX, OKY); } diff --git a/src/input/pec586kb.c b/src/input/pec586kb.c index 3ab947e..6a70367 100644 --- a/src/input/pec586kb.c +++ b/src/input/pec586kb.c @@ -24,13 +24,13 @@ #define AK(x) FKB_ ## x -static uint8 bufit[0x66]; -static uint8 kspos, kstrobe; -static uint8 ksindex; +static uint8_t bufit[0x66]; +static uint8_t kspos, kstrobe; +static uint8_t ksindex; /* TODO: check all keys, some of the are wrong */ -static uint16 matrix[13][8] = +static uint16_t matrix[13][8] = { { AK(ESCAPE),AK(SPACE),AK(LMENU),AK(LCONTROL),AK(LSHIFT),AK(GRAVE),AK(TAB),AK(CAPITAL) }, { AK(F6),AK(F7),AK(F5),AK(F4),AK(F8),AK(F2),AK(F1),AK(F3) }, @@ -47,7 +47,7 @@ static uint16 matrix[13][8] = { AK(INSERT),AK(NUMPAD1),AK(HOME),AK(PRIOR),AK(DELETE),AK(END),AK(NEXT),AK(NUMLOCK) }, }; -static void FP_FASTAPASS(1) PEC586KB_Write(uint8 v) { +static void FP_FASTAPASS(1) PEC586KB_Write(uint8_t v) { if (!(kstrobe & 2) && (v & 2)) { kspos = 0; } @@ -61,7 +61,7 @@ static void FP_FASTAPASS(1) PEC586KB_Write(uint8 v) { kstrobe = v; } -static uint8 FP_FASTAPASS(2) PEC586KB_Read(int w, uint8 ret) { +static uint8_t FP_FASTAPASS(2) PEC586KB_Read(int w, uint8_t ret) { #ifdef FCEUDEF_DEBUGGER if (!fceuindbg) { #endif diff --git a/src/input/powerpad.c b/src/input/powerpad.c index 62bed8e..d581bc0 100644 --- a/src/input/powerpad.c +++ b/src/input/powerpad.c @@ -24,11 +24,11 @@ static char side; -static uint32 pprsb[2]; -static uint32 pprdata[2]; +static uint32_t pprsb[2]; +static uint32_t pprdata[2]; -static uint8 FP_FASTAPASS(1) ReadPP(int w) { - uint8 ret = 0; +static uint8_t FP_FASTAPASS(1) ReadPP(int w) { + uint8_t ret = 0; ret |= ((pprdata[w] >> pprsb[w]) & 1) << 3; ret |= ((pprdata[w] >> (pprsb[w] + 8)) & 1) << 4; if (pprsb[w] >= 4) { @@ -56,10 +56,10 @@ void FP_FASTAPASS(3) UpdatePP(int w, void *data, int arg) { if (side == 'A') for (x = 0; x < 12; x++) - pprdata[w] |= (((*(uint32*)data) >> x) & 1) << shifttableA[x]; + pprdata[w] |= (((*(uint32_t*)data) >> x) & 1) << shifttableA[x]; else for (x = 0; x < 12; x++) - pprdata[w] |= (((*(uint32*)data) >> x) & 1) << shifttableB[x]; + pprdata[w] |= (((*(uint32_t*)data) >> x) & 1) << shifttableB[x]; } static INPUTC PwrPadCtrl = { ReadPP, 0, StrobePP, UpdatePP, 0, 0 }; diff --git a/src/input/quiz.c b/src/input/quiz.c index 77bbb4f..26d51b6 100644 --- a/src/input/quiz.c +++ b/src/input/quiz.c @@ -21,10 +21,10 @@ #include #include "share.h" -static uint8 QZVal, QZValR; -static uint8 FunkyMode; +static uint8_t QZVal, QZValR; +static uint8_t FunkyMode; -static uint8 FP_FASTAPASS(2) QZ_Read(int w, uint8 ret) { +static uint8_t FP_FASTAPASS(2) QZ_Read(int w, uint8_t ret) { if (w) { ret |= (QZValR & 0x7) << 2; QZValR = QZValR >> 3; @@ -42,12 +42,12 @@ static void QZ_Strobe(void) { QZValR = QZVal; } -static void FP_FASTAPASS(1) QZ_Write(uint8 V) { +static void FP_FASTAPASS(1) QZ_Write(uint8_t V) { FunkyMode = V & 4; } static void FP_FASTAPASS(2) QZ_Update(void *data, int arg) { - QZVal = *(uint8*)data; + QZVal = *(uint8_t*)data; } static INPUTCFC QuizKing = { QZ_Read, QZ_Write, QZ_Strobe, QZ_Update, 0, 0 }; diff --git a/src/input/shadow.c b/src/input/shadow.c index e8b0aa9..2167ac4 100644 --- a/src/input/shadow.c +++ b/src/input/shadow.c @@ -24,16 +24,16 @@ #include "share.h" typedef struct { - uint32 mzx, mzy, mzb; + uint32_t mzx, mzy, mzb; int zap_readbit; int bogo; int zappo; - uint64 zaphit; + uint64_t zaphit; } ZAPPER; static ZAPPER ZD; -static void FP_FASTAPASS(3) ZapperFrapper(uint8 * bg, uint8 * spr, uint32 linets, int final) { +static void FP_FASTAPASS(3) ZapperFrapper(uint8_t * bg, uint8_t * spr, uint32_t linets, int final) { int xs, xe; int zx, zy; @@ -51,8 +51,8 @@ static void FP_FASTAPASS(3) ZapperFrapper(uint8 * bg, uint8 * spr, uint32 linets if (scanline >= (zy - 4) && scanline <= (zy + 4)) { while (xs < xe) { - uint8 a1, a2; - uint32 sum; + uint8_t a1, a2; + uint32_t sum; if (xs <= (zx + 4) && xs >= (zx - 4)) { a1 = bg[xs]; if (spr) { @@ -66,7 +66,7 @@ static void FP_FASTAPASS(3) ZapperFrapper(uint8 * bg, uint8 * spr, uint32 linets sum = palo[a1].r + palo[a1].g + palo[a1].b; if (sum >= 100 * 3) { - ZD.zaphit = ((uint64)linets + (uint64)(xs + 16) * (PAL ? 15 : 16)) / 48 + timestampbase; + ZD.zaphit = ((uint64_t)linets + (uint64_t)(xs + 16) * (PAL ? 15 : 16)) / 48 + timestampbase; goto endo; } } @@ -86,7 +86,7 @@ static INLINE int CheckColor(void) { } -static uint8 FP_FASTAPASS(2) ReadZapper(int w, uint8 ret) { +static uint8_t FP_FASTAPASS(2) ReadZapper(int w, uint8_t ret) { if (w) { ret &= ~0x18; if (ZD.bogo) @@ -104,13 +104,13 @@ static uint8 FP_FASTAPASS(2) ReadZapper(int w, uint8 ret) { return ret; } -static void FP_FASTAPASS(2) DrawZapper(uint8 * buf, int arg) { +static void FP_FASTAPASS(2) DrawZapper(uint8_t * buf, int arg) { if (arg) FCEU_DrawGunSight(buf, ZD.mzx, ZD.mzy); } static void FP_FASTAPASS(2) UpdateZapper(void *data, int arg) { - uint32 *ptr = (uint32*)data; + uint32_t *ptr = (uint32_t*)data; if (ZD.bogo) ZD.bogo--; diff --git a/src/input/share.h b/src/input/share.h index 8a3d2c5..0f7f299 100644 --- a/src/input/share.h +++ b/src/input/share.h @@ -9,7 +9,7 @@ #include "../palette.h" #include "../state.h" -void FCEU_DrawCursor(uint8 *buf, int xc, int yc); -void FCEU_DrawGunSight(uint8 *buf, int xc, int yc); +void FCEU_DrawCursor(uint8_t *buf, int xc, int yc); +void FCEU_DrawGunSight(uint8_t *buf, int xc, int yc); #endif /* _SHARE_H */ diff --git a/src/input/suborkb.c b/src/input/suborkb.c index abf02c7..787be41 100644 --- a/src/input/suborkb.c +++ b/src/input/suborkb.c @@ -23,11 +23,11 @@ #include "suborkb.h" #define AK(x) FKB_ ## x -static uint8 bufit[0x66]; -static uint8 ksmode; -static uint8 ksindex; +static uint8_t bufit[0x66]; +static uint8_t ksmode; +static uint8_t ksindex; -static uint16 matrix[13][2][4] = +static uint16_t matrix[13][2][4] = { { { AK(4), AK(G), AK(F), AK(C) }, { AK(F2), AK(E), AK(5), AK(V) } }, { { AK(2), AK(D), AK(S), AK(END) }, { AK(F1), AK(W), AK(3), AK(X) } }, @@ -44,7 +44,7 @@ static uint16 matrix[13][2][4] = { { AK(GRAVE), AK(NUMPAD6), AK(PAUSE), AK(SPACE) }, { AK(F9), AK(NUMPAD3), AK(DECIMAL), AK(NUMPAD0) } }, }; -static void FP_FASTAPASS(1) SuborKB_Write(uint8 v) { +static void FP_FASTAPASS(1) SuborKB_Write(uint8_t v) { v >>= 1; if (v & 2) { if ((ksmode & 1) && !(v & 1)) @@ -53,7 +53,7 @@ static void FP_FASTAPASS(1) SuborKB_Write(uint8 v) { ksmode = v; } -static uint8 FP_FASTAPASS(2) SuborKB_Read(int w, uint8 ret) { +static uint8_t FP_FASTAPASS(2) SuborKB_Read(int w, uint8_t ret) { if (w) { int x; diff --git a/src/input/toprider.c b/src/input/toprider.c index e05bbe2..4bfcb6f 100644 --- a/src/input/toprider.c +++ b/src/input/toprider.c @@ -21,10 +21,10 @@ #include #include "share.h" -static uint32 bs, bss; -static uint32 boop; +static uint32_t bs, bss; +static uint32_t boop; -static uint8 FP_FASTAPASS(2) Read(int w, uint8 ret) { +static uint8_t FP_FASTAPASS(2) Read(int w, uint8_t ret) { if (w) { ret |= (bs & 1) << 3; ret |= (boop & 1) << 4; @@ -34,12 +34,12 @@ static uint8 FP_FASTAPASS(2) Read(int w, uint8 ret) { return(ret); } -static void FP_FASTAPASS(1) Write(uint8 V) { +static void FP_FASTAPASS(1) Write(uint8_t V) { bs = bss; } static void FP_FASTAPASS(2) Update(void *data, int arg) { - bss = *(uint8*)data; + bss = *(uint8_t*)data; bss |= bss << 8; bss |= bss << 8; } diff --git a/src/input/zapper.c b/src/input/zapper.c index 49caae3..2ec91f1 100644 --- a/src/input/zapper.c +++ b/src/input/zapper.c @@ -26,27 +26,27 @@ #define ROUNDED_TARGET #ifdef ROUNDED_TARGET #define MAX_TOLERANCE 20 -static uint32 targetExpansion[MAX_TOLERANCE+1]; +static uint32_t targetExpansion[MAX_TOLERANCE+1]; #endif -static uint32 tolerance; -static uint32 ZapperStrobe[2]; +static uint32_t tolerance; +static uint32_t ZapperStrobe[2]; int switchZapper = 0; int zapper_trigger_invert_option = 1; int zapper_sensor_invert_option = 1; typedef struct { - uint32 mzx, mzy, mzb, mzs; /* sequential targets lightgun sensor added */ + uint32_t mzx, mzy, mzb, mzs; /* sequential targets lightgun sensor added */ int zap_readbit; int bogo; int zappo; - uint64 zaphit; + uint64_t zaphit; } ZAPPER; static ZAPPER ZD[2]; -static void FP_FASTAPASS(3) ZapperFrapper(int w, uint8 * bg, uint8 * spr, uint32 linets, int final) { +static void FP_FASTAPASS(3) ZapperFrapper(int w, uint8_t * bg, uint8_t * spr, uint32_t linets, int final) { if (!switchZapper) { int xs, xe; int zx, zy; @@ -74,8 +74,8 @@ static void FP_FASTAPASS(3) ZapperFrapper(int w, uint8 * bg, uint8 * spr, uint32 int spread = tolerance; #endif while (xs < xe) { - uint8 a1, a2; - uint32 sum; + uint8_t a1, a2; + uint32_t sum; if (xs <= (zx + spread) && xs >= (zx - spread)) { a1 = bg[xs]; if (spr) { @@ -89,7 +89,7 @@ static void FP_FASTAPASS(3) ZapperFrapper(int w, uint8 * bg, uint8 * spr, uint32 sum = palo[a1].r + palo[a1].g + palo[a1].b; if (sum >= 100 * 3) { - ZD[w].zaphit = ((uint64)linets + (uint64)(xs + 16) * (PAL ? 15 : 16)) / 48 + timestampbase; + ZD[w].zaphit = ((uint64_t)linets + (uint64_t)(xs + 16) * (PAL ? 15 : 16)) / 48 + timestampbase; goto endo; } } @@ -113,8 +113,8 @@ static INLINE int CheckColor(int w) { return(1); } -static uint8 FP_FASTAPASS(1) ReadZapperVS(int w) { - uint8 ret = 0; +static uint8_t FP_FASTAPASS(1) ReadZapperVS(int w) { + uint8_t ret = 0; if (ZD[w].zap_readbit == 4) ret = 1; @@ -143,8 +143,8 @@ static void FP_FASTAPASS(1) StrobeZapperVS(int w) { ZD[w].zap_readbit = 0; } -static uint8 FP_FASTAPASS(1) ReadZapper(int w) { - uint8 ret = 0; +static uint8_t FP_FASTAPASS(1) ReadZapper(int w) { + uint8_t ret = 0; if (ZD[w].bogo) ret |= 0x10; @@ -159,13 +159,13 @@ static uint8 FP_FASTAPASS(1) ReadZapper(int w) { return ret; } -static void FASTAPASS(3) DrawZapper(int w, uint8 * buf, int arg) { +static void FASTAPASS(3) DrawZapper(int w, uint8_t * buf, int arg) { if (arg && !switchZapper) FCEU_DrawGunSight(buf, ZD[w].mzx, ZD[w].mzy); } static void FP_FASTAPASS(3) UpdateZapper(int w, void *data, int arg) { - uint32 *ptr = (uint32*)data; + uint32_t *ptr = (uint32_t*)data; if (ZD[w].bogo) ZD[w].bogo--; @@ -190,8 +190,8 @@ static INPUTC ZAPC = { ReadZapper, 0, 0, UpdateZapper, ZapperFrapper, DrawZapper static INPUTC ZAPVSC = { ReadZapperVS, 0, StrobeZapperVS, UpdateZapper, ZapperFrapper, DrawZapper }; #ifdef ROUNDED_TARGET -static uint32 InefficientSqrt(uint32 z) { - uint32 i; +static uint32_t InefficientSqrt(uint32_t z) { + uint32_t i; for (i = 0 ; i * i <= z ; i++) ; return i-1; } @@ -200,7 +200,7 @@ static uint32 InefficientSqrt(uint32 z) { void FCEU_ZapperSetTolerance(int t) { #ifdef ROUNDED_TARGET - uint32 y; + uint32_t y; tolerance = t <= MAX_TOLERANCE ? t : MAX_TOLERANCE; for (y = 0; y <= tolerance; y++) targetExpansion[y] = InefficientSqrt(tolerance*tolerance-y*y); diff --git a/src/md5.c b/src/md5.c index f674bbc..d933e98 100644 --- a/src/md5.c +++ b/src/md5.c @@ -17,18 +17,18 @@ #define GET_UINT32(n, b, i) \ { \ - (n) = ((uint32)(b)[(i) + 3] << 24) | \ - ((uint32)(b)[(i) + 2] << 16) | \ - ((uint32)(b)[(i) + 1] << 8) | \ - ((uint32)(b)[(i) ]); \ + (n) = ((uint32_t)(b)[(i) + 3] << 24) | \ + ((uint32_t)(b)[(i) + 2] << 16) | \ + ((uint32_t)(b)[(i) + 1] << 8) | \ + ((uint32_t)(b)[(i) ]); \ } #define PUT_UINT32(n, b, i) \ { \ - (b)[(i) ] = (uint8)((n)); \ - (b)[(i) + 1] = (uint8)((n) >> 8); \ - (b)[(i) + 2] = (uint8)((n) >> 16); \ - (b)[(i) + 3] = (uint8)((n) >> 24); \ + (b)[(i) ] = (uint8_t)((n)); \ + (b)[(i) + 1] = (uint8_t)((n) >> 8); \ + (b)[(i) + 2] = (uint8_t)((n) >> 16); \ + (b)[(i) + 3] = (uint8_t)((n) >> 24); \ } void md5_starts(struct md5_context *ctx) { @@ -40,8 +40,8 @@ void md5_starts(struct md5_context *ctx) { ctx->state[3] = 0x10325476; } -void md5_process(struct md5_context *ctx, uint8 data[64]) { - uint32 A, B, C, D, X[16]; +void md5_process(struct md5_context *ctx, uint8_t data[64]) { + uint32_t A, B, C, D, X[16]; GET_UINT32(X[0], data, 0); GET_UINT32(X[1], data, 4); @@ -162,8 +162,8 @@ void md5_process(struct md5_context *ctx, uint8 data[64]) { ctx->state[3] += D; } -void md5_update(struct md5_context *ctx, uint8 *input, uint32 length) { - uint32 left, fill; +void md5_update(struct md5_context *ctx, uint8_t *input, uint32_t length) { + uint32_t left, fill; if (!length) return; @@ -195,7 +195,7 @@ void md5_update(struct md5_context *ctx, uint8 *input, uint32 length) { } } -static uint8 md5_padding[64] = +static uint8_t md5_padding[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -203,9 +203,9 @@ static uint8 md5_padding[64] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -void md5_finish(struct md5_context *ctx, uint8 digest[16]) { - uint32 last, padn; - uint8 msglen[8]; +void md5_finish(struct md5_context *ctx, uint8_t digest[16]) { + uint32_t last, padn; + uint8_t msglen[8]; PUT_UINT32(ctx->total[0], msglen, 0); PUT_UINT32(ctx->total[1], msglen, 4); @@ -224,7 +224,7 @@ void md5_finish(struct md5_context *ctx, uint8 digest[16]) { /* Uses a static buffer, so beware of how it's used. */ -char *md5_asciistr(uint8 digest[16]) { +char *md5_asciistr(uint8_t digest[16]) { static char str[33]; static char trans[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; int x; diff --git a/src/md5.h b/src/md5.h index dfe7330..f32a5f4 100644 --- a/src/md5.h +++ b/src/md5.h @@ -2,16 +2,16 @@ #define _MD5_H struct md5_context { - uint32 total[2]; - uint32 state[4]; - uint8 buffer[64]; + uint32_t total[2]; + uint32_t state[4]; + uint8_t buffer[64]; }; void md5_starts(struct md5_context *ctx); -void md5_update(struct md5_context *ctx, uint8 *input, uint32 length); -void md5_finish(struct md5_context *ctx, uint8 digest[16]); +void md5_update(struct md5_context *ctx, uint8_t *input, uint32_t length); +void md5_finish(struct md5_context *ctx, uint8_t digest[16]); /* Uses a static buffer, so beware of how it's used. */ -char *md5_asciistr(uint8 digest[16]); +char *md5_asciistr(uint8_t digest[16]); #endif /* md5.h */ diff --git a/src/nsf.c b/src/nsf.c index c39dade..0087ae1 100644 --- a/src/nsf.c +++ b/src/nsf.c @@ -41,7 +41,7 @@ #define M_PI 3.14159265358979323846 #endif -static uint8 SongReload; +static uint8_t SongReload; static int CurrentSong; static DECLFW(NSF_write); @@ -49,7 +49,7 @@ static DECLFR(NSF_read); static int vismode = 1; -static uint8 NSFROM[0x30 + 6] = +static uint8_t NSFROM[0x30 + 6] = { /* 0x00 - NMI */ 0x8D, 0xF4, 0x3F, /* Stop play routine NMIs. */ @@ -81,19 +81,19 @@ static DECLFR(NSFROMRead) { static int doreset = 0; static int NSFNMIFlags; -static uint8 *NSFDATA = 0; +static uint8_t *NSFDATA = 0; static int NSFMaxBank; static int NSFSize; -static uint8 BSon; -static uint16 PlayAddr; -static uint16 InitAddr; -static uint16 LoadAddr; +static uint8_t BSon; +static uint16_t PlayAddr; +static uint16_t InitAddr; +static uint16_t LoadAddr; static NSF_HEADER NSFHeader; void NSFMMC5_Close(void); -static uint8 *ExWRAM = 0; +static uint8_t *ExWRAM = 0; void NSFGI(int h) { switch (h) { @@ -125,7 +125,7 @@ void NSFGI(int h) { /* First 32KB is reserved for sound chip emulation in the iNES mapper code. */ -static INLINE void BANKSET(uint32 A, uint32 bank) { +static INLINE void BANKSET(uint32_t A, uint32_t bank) { bank &= NSFMaxBank; if (NSFHeader.SoundChip & 4) memcpy(ExWRAM + (A - 0x6000), NSFDATA + (bank << 12), 4096); @@ -135,7 +135,7 @@ static INLINE void BANKSET(uint32 A, uint32 bank) { int NSFLoad(FCEUFILE *fp) { int x; - uint64 fsize; + uint64_t fsize; FCEU_fseek(fp, 0, SEEK_SET); /* NSFHeader is file-scope static; if a previous successful load left @@ -161,7 +161,7 @@ int NSFLoad(FCEUFILE *fp) { PlayAddr |= NSFHeader.PlayAddressHigh << 8; /* Validate that there is data past the 0x80-byte header before - * subtracting; otherwise NSFSize underflows uint64 and propagates a + * subtracting; otherwise NSFSize underflows uint64_t and propagates a * huge size into NSFMaxBank/uppow2/FCEU_malloc, leading to a heap * overflow on the subsequent fread. Also cap at a sane ceiling. */ fsize = FCEU_fgetsize(fp); @@ -187,7 +187,7 @@ int NSFLoad(FCEUFILE *fp) { return(0); } - if (!(NSFDATA = (uint8*)FCEU_malloc(NSFMaxBank * 4096))) + if (!(NSFDATA = (uint8_t*)FCEU_malloc(NSFMaxBank * 4096))) return 0; FCEU_fseek(fp, 0x80, SEEK_SET); @@ -287,14 +287,14 @@ void NSF_init(void) { } if (BSon) { - int32 x; + int32_t x; for (x = 0; x < 8; x++) { if (NSFHeader.SoundChip & 4 && x >= 6) BANKSET(0x6000 + (x - 6) * 4096, NSFHeader.BankSwitch[x]); BANKSET(0x8000 + x * 4096, NSFHeader.BankSwitch[x]); } } else { - int32 x; + int32_t x; for (x = (LoadAddr & 0xF000); x < 0x10000; x += 0x1000) BANKSET(x, ((x - (LoadAddr & 0x7000)) >> 12)); } @@ -396,11 +396,11 @@ static DECLFR(NSF_read) { return 0; } -uint8 FCEU_GetJoyJoy(void); +uint8_t FCEU_GetJoyJoy(void); static int special = 0; -void DrawNSF(uint8 *XBuf) { +void DrawNSF(uint8_t *XBuf) { char snbuf[16]; int x; @@ -410,8 +410,8 @@ void DrawNSF(uint8 *XBuf) { { - int32 *Bufpl; - int32 mul = 0; + int32_t *Bufpl; + int32_t mul = 0; int l; l = GetSoundBuffer(&Bufpl); @@ -420,7 +420,7 @@ void DrawNSF(uint8 *XBuf) { if (FSettings.SoundVolume) mul = 8192 * 240 / (16384 * FSettings.SoundVolume / 50); for (x = 0; x < 256; x++) { - uint32 y; + uint32_t y; y = 142 + ((Bufpl[(x * l) >> 8] * mul) >> 14); if (y < 240) XBuf[x + y * 256] = 3; @@ -430,7 +430,7 @@ void DrawNSF(uint8 *XBuf) { mul = 8192 * 240 / (8192 * FSettings.SoundVolume / 50); for (x = 0; x < 256; x++) { double r; - uint32 xp, yp; + uint32_t xp, yp; r = (Bufpl[(x * l) >> 8] * mul) >> 14; xp = 128 + r*cos(x*M_PI*2 / 256); @@ -446,7 +446,7 @@ void DrawNSF(uint8 *XBuf) { for (x = 0; x < 128; x++) { double xc, yc; double r, t; - uint32 m, n; + uint32_t m, n; xc = (double)128 - x; yc = 0 - ((double)(((Bufpl[(x * l) >> 8]) * mul) >> 14)); @@ -463,7 +463,7 @@ void DrawNSF(uint8 *XBuf) { for (x = 128; x < 256; x++) { double xc, yc; double r, t; - uint32 m, n; + uint32_t m, n; xc = (double)x - 128; yc = (double)((Bufpl[(x * l) >> 8] * mul) >> 14); @@ -485,13 +485,13 @@ void DrawNSF(uint8 *XBuf) { DrawTextTrans(XBuf + 26 * 256 + 4 + (((31 - strlen((char*)NSFHeader.Artist)) << 2)), 256, NSFHeader.Artist, 6); DrawTextTrans(XBuf + 42 * 256 + 4 + (((31 - strlen((char*)NSFHeader.Copyright)) << 2)), 256, NSFHeader.Copyright, 6); - DrawTextTrans(XBuf + 70 * 256 + 4 + (((31 - strlen("Song:")) << 2)), 256, (uint8*)"Song:", 6); + DrawTextTrans(XBuf + 70 * 256 + 4 + (((31 - strlen("Song:")) << 2)), 256, (uint8_t*)"Song:", 6); sprintf(snbuf, "<%d/%d>", CurrentSong, NSFHeader.TotalSongs); - DrawTextTrans(XBuf + 82 * 256 + 4 + (((31 - strlen(snbuf)) << 2)), 256, (uint8*)snbuf, 6); + DrawTextTrans(XBuf + 82 * 256 + 4 + (((31 - strlen(snbuf)) << 2)), 256, (uint8_t*)snbuf, 6); { - static uint8 last = 0; - uint8 tmp; + static uint8_t last = 0; + uint8_t tmp; tmp = FCEU_GetJoyJoy(); if ((tmp & JOY_RIGHT) && !(last & JOY_RIGHT)) { if (CurrentSong < NSFHeader.TotalSongs) { @@ -539,7 +539,7 @@ int FCEUI_NSFChange(int amount) { } /* Returns total songs */ -int FCEUI_NSFGetInfo(uint8 *name, uint8 *artist, uint8 *copyright, int maxlen) { +int FCEUI_NSFGetInfo(uint8_t *name, uint8_t *artist, uint8_t *copyright, int maxlen) { strncpy((char*)name, (const char*)NSFHeader.SongName, (size_t)maxlen); strncpy((char*)artist, (const char*)NSFHeader.Artist, (size_t)maxlen); strncpy((char*)copyright, (const char*)NSFHeader.Copyright, (size_t)maxlen); diff --git a/src/nsf.h b/src/nsf.h index 2fe0bc4..7b7ec9a 100644 --- a/src/nsf.h +++ b/src/nsf.h @@ -23,28 +23,28 @@ typedef struct { char ID[5]; /* NESM^Z */ - uint8 Version; - uint8 TotalSongs; - uint8 StartingSong; - uint8 LoadAddressLow; - uint8 LoadAddressHigh; - uint8 InitAddressLow; - uint8 InitAddressHigh; - uint8 PlayAddressLow; - uint8 PlayAddressHigh; - uint8 SongName[32]; - uint8 Artist[32]; - uint8 Copyright[32]; - uint8 NTSCspeed[2]; /* Unused */ - uint8 BankSwitch[8]; - uint8 PALspeed[2]; /* Unused */ - uint8 VideoSystem; - uint8 SoundChip; - uint8 Expansion[4]; - uint8 reserve[8]; + uint8_t Version; + uint8_t TotalSongs; + uint8_t StartingSong; + uint8_t LoadAddressLow; + uint8_t LoadAddressHigh; + uint8_t InitAddressLow; + uint8_t InitAddressHigh; + uint8_t PlayAddressLow; + uint8_t PlayAddressHigh; + uint8_t SongName[32]; + uint8_t Artist[32]; + uint8_t Copyright[32]; + uint8_t NTSCspeed[2]; /* Unused */ + uint8_t BankSwitch[8]; + uint8_t PALspeed[2]; /* Unused */ + uint8_t VideoSystem; + uint8_t SoundChip; + uint8_t Expansion[4]; + uint8_t reserve[8]; } NSF_HEADER; void NSF_init(void); -void DrawNSF(uint8 *XBuf); +void DrawNSF(uint8_t *XBuf); void NSFDealloc(void); void NSFDodo(void); void DoNSFFrame(void); diff --git a/src/ops.h b/src/ops.h index db8e9f2..a22d4a9 100644 --- a/src/ops.h +++ b/src/ops.h @@ -61,8 +61,8 @@ case 0x28: /* PLP */ break; case 0x4C: { - uint16 ptmp=_PC; - uint32 npc; + uint16_t ptmp=_PC; + uint32_t npc; npc=RdMem(ptmp); ptmp++; @@ -72,7 +72,7 @@ case 0x4C: break; /* JMP ABSOLUTE */ case 0x6C: { - uint32 tmp; + uint32_t tmp; GetAB(tmp); _PC=RdMem(tmp); _PC|=RdMem( ((tmp+1)&0x00FF) | (tmp&0xFF00))<<8; @@ -80,7 +80,7 @@ case 0x6C: break; case 0x20: /* JSR */ { - uint8 npc; + uint8_t npc; npc=RdMem(_PC); _PC++; PUSH(_PC>>8); @@ -334,7 +334,7 @@ case 0x83: ST_IX(_A&_X); /* ARR - ARGH, MATEY! */ case 0x6B: { - uint8 arrtmp; + uint8_t arrtmp; LD_IM(AND;_P&=~V_FLAG;_P|=(_A^(_A>>1))&0x40;arrtmp=_A>>7;_A>>=1;_A|=(_P&C_FLAG)<<7;_P&=~C_FLAG;_P|=arrtmp;X_ZN(_A)); } /* ASR */ diff --git a/src/palette.c b/src/palette.c index 994cd4d..cef3b19 100644 --- a/src/palette.c +++ b/src/palette.c @@ -37,12 +37,12 @@ static pal palette_game[512]; /* Custom palette for an individual game. */ static pal palette_user[512]; /* Custom "global" palette. */ -uint8 palette_game_available = false; -uint8 palette_user_available = false; +uint8_t palette_game_available = false; +uint8_t palette_user_available = false; static void ChoosePalette(void); static void WritePalette(void); -uint8 default_palette_selected = 0; +uint8_t default_palette_selected = 0; pal *palo; static pal *default_palette[8] = @@ -55,7 +55,7 @@ static pal *default_palette[8] = rp2c03, }; -static void ApplyDeemphasisClassic(int entry, uint8 *r, uint8 *g, uint8 *b) { +static void ApplyDeemphasisClassic(int entry, uint8_t *r, uint8_t *g, uint8_t *b) { static const float rtmul[] = { 1.239f, 0.794f, 1.019f, 0.905f, 1.023f, 0.741f, 0.75f }; static const float gtmul[] = { 0.915f, 1.086f, 0.98f, 1.026f, 0.908f, 0.987f, 0.75f }; static const float btmul[] = { 0.743f, 0.882f, 0.653f, 1.277f, 0.979f, 0.101f, 0.75f }; @@ -75,9 +75,9 @@ static void ApplyDeemphasisClassic(int entry, uint8 *r, uint8 *g, uint8 *b) { if (nr > 0xFF) nr = 0xFF; if (ng > 0xFF) ng = 0xFF; if (nb > 0xFF) nb = 0xFF; - *r = (uint8)nr; - *g = (uint8)ng; - *b = (uint8)nb; + *r = (uint8_t)nr; + *g = (uint8_t)ng; + *b = (uint8_t)nb; } static void ApplyDeemphasisComplete(pal *pal512) { @@ -93,16 +93,16 @@ static void ApplyDeemphasisComplete(pal *pal512) { } } -void FCEUI_SetPaletteArray(uint8 *pal, int nEntries) { +void FCEUI_SetPaletteArray(uint8_t *pal, int nEntries) { if (!pal || !nEntries) palette_user_available = false; else { int x; palette_user_available = true; for (x = 0; x < nEntries; x++) { - palette_user[x].r = *((uint8*)pal + x + x + x); - palette_user[x].g = *((uint8*)pal + x + x + x + 1); - palette_user[x].b = *((uint8*)pal + x + x + x + 2); + palette_user[x].r = *((uint8_t*)pal + x + x + x); + palette_user[x].g = *((uint8_t*)pal + x + x + x + 1); + palette_user[x].b = *((uint8_t*)pal + x + x + x + 2); } if (nEntries != 512) { ApplyDeemphasisComplete(palette_user); @@ -111,12 +111,12 @@ void FCEUI_SetPaletteArray(uint8 *pal, int nEntries) { FCEU_ResetPalette(); } -static uint8 lastd = 0; -void SetNESDeemph(uint8 d, int force) { - static uint16 rtmul[7] = { 32768 * 1.239, 32768 * .794, 32768 * 1.019, 32768 * .905, 32768 * 1.023, 32768 * .741, 32768 * .75 }; - static uint16 gtmul[7] = { 32768 * .915, 32768 * 1.086, 32768 * .98, 32768 * 1.026, 32768 * .908, 32768 * .987, 32768 * .75 }; - static uint16 btmul[7] = { 32768 * .743, 32768 * .882, 32768 * .653, 32768 * 1.277, 32768 * .979, 32768 * .101, 32768 * .75 }; - uint32 r, g, b; +static uint8_t lastd = 0; +void SetNESDeemph(uint8_t d, int force) { + static uint16_t rtmul[7] = { 32768 * 1.239, 32768 * .794, 32768 * 1.019, 32768 * .905, 32768 * 1.023, 32768 * .741, 32768 * .75 }; + static uint16_t gtmul[7] = { 32768 * .915, 32768 * 1.086, 32768 * .98, 32768 * 1.026, 32768 * .908, 32768 * .987, 32768 * .75 }; + static uint16_t btmul[7] = { 32768 * .743, 32768 * .882, 32768 * .653, 32768 * 1.277, 32768 * .979, 32768 * .101, 32768 * .75 }; + uint32_t r, g, b; int x; /* If it's not forced(only forced when the palette changes), @@ -130,7 +130,7 @@ void SetNESDeemph(uint8 d, int force) { b = rtmul[6]; for (x = 0; x < 0x40; x++) { - uint32 m, n, o; + uint32_t m, n, o; m = palo[x].r; n = palo[x].g; o = palo[x].b; @@ -150,7 +150,7 @@ void SetNESDeemph(uint8 d, int force) { b = btmul[d - 1]; for (x = 0; x < 0x40; x++) { - uint32 m, n, o; + uint32_t m, n, o; m = palo[x].r; n = palo[x].g; @@ -169,7 +169,7 @@ void SetNESDeemph(uint8 d, int force) { } void FCEU_LoadGamePalette(void) { - uint8 ptmp[64 * 8 * 3]; + uint8_t ptmp[64 * 8 * 3]; RFILE *fp = NULL; char *fn = NULL; diff --git a/src/palette.h b/src/palette.h index d01b807..946fae3 100644 --- a/src/palette.h +++ b/src/palette.h @@ -2,11 +2,11 @@ #define _FCEU_PALETTE_H typedef struct { - uint8 r, g, b; + uint8_t r, g, b; } pal; extern pal *palo; -extern uint8 palette_game_available; +extern uint8_t palette_game_available; void FCEU_ResetPalette(void); void FCEU_ResetPalette(void); diff --git a/src/ppu.c b/src/ppu.c index 628e564..d286685 100644 --- a/src/ppu.c +++ b/src/ppu.c @@ -55,12 +55,12 @@ static void FetchSpriteData(void); static void FASTAPASS(1) RefreshLine(int lastpixel); static void RefreshSprites(void); -static void CopySprites(uint8 *target); +static void CopySprites(uint8_t *target); static void Fixit1(void); -static uint32 ppulut1[256]; -static uint32 ppulut2[256]; -static uint32 ppulut3[128]; +static uint32_t ppulut1[256]; +static uint32_t ppulut2[256]; +static uint32_t ppulut3[128]; static void makeppulut(void) { int x; @@ -88,56 +88,56 @@ static void makeppulut(void) { } } -static uint8 ppudead = 1; -static uint8 kook = 0; +static uint8_t ppudead = 1; +static uint8_t kook = 0; int fceuindbg = 0; int MMC5Hack = 0, PEC586Hack = 0; -uint32 MMC5HackVROMMask = 0; -uint8 *MMC5HackExNTARAMPtr = 0; -uint8 *MMC5HackVROMPTR = 0; -uint8 MMC5HackCHRMode = 0; -uint8 MMC5HackSPMode = 0; -uint8 MMC50x5130 = 0; -uint8 MMC5HackSPScroll = 0; -uint8 MMC5HackSPPage = 0; +uint32_t MMC5HackVROMMask = 0; +uint8_t *MMC5HackExNTARAMPtr = 0; +uint8_t *MMC5HackVROMPTR = 0; +uint8_t MMC5HackCHRMode = 0; +uint8_t MMC5HackSPMode = 0; +uint8_t MMC50x5130 = 0; +uint8_t MMC5HackSPScroll = 0; +uint8_t MMC5HackSPPage = 0; -uint8 VRAMBuffer = 0, PPUGenLatch = 0; -uint8 *vnapage[4]; -uint8 PPUNTARAM = 0; -uint8 PPUCHRRAM = 0; +uint8_t VRAMBuffer = 0, PPUGenLatch = 0; +uint8_t *vnapage[4]; +uint8_t PPUNTARAM = 0; +uint8_t PPUCHRRAM = 0; /* Color deemphasis emulation. Joy... */ -static uint8 deemp = 0; +static uint8_t deemp = 0; static int deempcnt[8]; void (*GameHBIRQHook)(void), (*GameHBIRQHook2)(void); -void FP_FASTAPASS(1) (*PPU_hook)(uint32 A); +void FP_FASTAPASS(1) (*PPU_hook)(uint32_t A); -uint8 vtoggle = 0; -uint8 XOffset = 0; +uint8_t vtoggle = 0; +uint8_t XOffset = 0; -uint32 TempAddr = 0, RefreshAddr = 0; +uint32_t TempAddr = 0, RefreshAddr = 0; static int maxsprites = 8; /* scanline is equal to the current visible scanline we're on. */ int scanline; -static uint32 scanlines_per_frame; +static uint32_t scanlines_per_frame; -uint8 PPU[4]; -uint8 PPUSPL; -uint8 NTARAM[0x800], PALRAM[0x20], SPRAM[0x100], SPRBUF[0x100]; -uint8 UPALRAM[0x03];/* for 0x4/0x8/0xC addresses in palette, the ones in +uint8_t PPU[4]; +uint8_t PPUSPL; +uint8_t NTARAM[0x800], PALRAM[0x20], SPRAM[0x100], SPRBUF[0x100]; +uint8_t UPALRAM[0x03];/* for 0x4/0x8/0xC addresses in palette, the ones in * 0x20 are 0 to not break fceu rendering. */ #define MMC5SPRVRAMADR(V) &MMC5SPRVPage[(V) >> 10][(V)] #define VRAMADR(V) &VPage[(V) >> 10][(V)] -uint8 * MMC5BGVRAMADR(uint32 V) { +uint8_t * MMC5BGVRAMADR(uint32_t V) { if (!Sprite16) { - extern uint8 mmc5ABMode; /* A=0, B=1 */ + extern uint8_t mmc5ABMode; /* A=0, B=1 */ if (mmc5ABMode == 0) return MMC5SPRVRAMADR(V); else @@ -146,7 +146,7 @@ uint8 * MMC5BGVRAMADR(uint32 V) { } static DECLFR(A2002) { - uint8 ret; + uint8_t ret; FCEUPPU_LineUpdate(); ret = PPU_status; @@ -170,8 +170,8 @@ static DECLFR(A200x) { /* Not correct for $2004 reads. */ } static DECLFR(A2007) { - uint8 ret; - uint32 tmp = RefreshAddr & 0x3FFF; + uint8_t ret; + uint32_t tmp = RefreshAddr & 0x3FFF; FCEUPPU_LineUpdate(); @@ -215,7 +215,7 @@ static DECLFR(A2007) { #endif { if ((ScreenON || SpriteON) && (scanline < 240)) { - uint32 rad = RefreshAddr; + uint32_t rad = RefreshAddr; if ((rad & 0x7000) == 0x7000) { rad ^= 0x7000; if ((rad & 0x3E0) == 0x3A0) @@ -281,7 +281,7 @@ static DECLFW(B2004) { } static DECLFW(B2005) { - uint32 tmp = TempAddr; + uint32_t tmp = TempAddr; FCEUPPU_LineUpdate(); PPUGenLatch = V; if (!vtoggle) { @@ -317,7 +317,7 @@ static DECLFW(B2006) { } static DECLFW(B2007) { - uint32 tmp = RefreshAddr & 0x3FFF; + uint32_t tmp = RefreshAddr & 0x3FFF; PPUGenLatch = V; if (tmp < 0x2000) { if (PPUCHRRAM & (1 << (tmp >> 10))) @@ -343,7 +343,7 @@ static DECLFW(B2007) { } static DECLFW(B4014) { - uint32 t = V << 8; + uint32_t t = V << 8; int x; for (x = 0; x < 256; x++) @@ -354,12 +354,12 @@ static DECLFW(B4014) { #define GETLASTPIXEL (PAL ? ((timestamp * 48 - linestartts) / 15) : ((timestamp * 48 - linestartts) >> 4)) -static uint8 *Pline, *Plinef; +static uint8_t *Pline, *Plinef; static int firsttile; static int linestartts; static int tofix = 0; -static void ResetRL(uint8 *target) { +static void ResetRL(uint8_t *target) { memset(target, 0xFF, 256); if (InputScanlineHook) InputScanlineHook(0, 0, 0, 0); @@ -372,7 +372,7 @@ static void ResetRL(uint8 *target) { tofix = 1; } -static uint8 sprlinebuf[256 + 8]; +static uint8_t sprlinebuf[256 + 8]; void FCEUPPU_LineUpdate(void) { #ifdef FCEUDEF_DEBUGGER @@ -407,8 +407,8 @@ static void EndRL(void) { Pline = 0; } -static int32 sphitx; -static uint8 sphitdata; +static int32_t sphitx; +static uint8_t sphitdata; static void CheckSpriteHit(int p) { int l = p - 16; @@ -432,15 +432,15 @@ static int spork = 0; /* lasttile is really "second to last tile." */ static void FASTAPASS(1) RefreshLine(int lastpixel) { - static uint32 pshift[2]; - static uint32 atlatch; - uint32 smorkus = RefreshAddr; + static uint32_t pshift[2]; + static uint32_t atlatch; + uint32_t smorkus = RefreshAddr; #define RefreshAddr smorkus - uint32 vofs; + uint32_t vofs; int X1; - register uint8 *P = Pline; + register uint8_t *P = Pline; int lasttile = lastpixel >> 3; int numtiles; static int norecurse = 0; /* Yeah, recursion would be bad. @@ -471,7 +471,7 @@ static void FASTAPASS(1) RefreshLine(int lastpixel) { vofs = ((PPU[0] & 0x10) << 8) | ((RefreshAddr >> 12) & 7); if (!ScreenON && !SpriteON) { - uint32 tem; + uint32_t tem; tem = Pal[0] | (Pal[0] << 8) | (Pal[0] << 16) | (Pal[0] << 24); tem |= 0x40404040; FCEU_dwmemset(Pline, tem, numtiles * 8); @@ -582,14 +582,14 @@ static void FASTAPASS(1) RefreshLine(int lastpixel) { RefreshAddr = smorkus; if (firsttile <= 2 && 2 < lasttile && !(PPU[1] & 2)) { - uint32 tem; + uint32_t tem; tem = Pal[0] | (Pal[0] << 8) | (Pal[0] << 16) | (Pal[0] << 24); tem |= 0x40404040; - *(uint32*)Plinef = *(uint32*)(Plinef + 4) = tem; + *(uint32_t*)Plinef = *(uint32_t*)(Plinef + 4) = tem; } if (!ScreenON) { - uint32 tem; + uint32_t tem; int tstart, tcount; tem = Pal[0] | (Pal[0] << 8) | (Pal[0] << 16) | (Pal[0] << 24); tem |= 0x40404040; @@ -621,7 +621,7 @@ static void FASTAPASS(1) RefreshLine(int lastpixel) { static INLINE void Fixit2(void) { if (ScreenON || SpriteON) { - uint32 rad = RefreshAddr; + uint32_t rad = RefreshAddr; rad &= 0xFBE0; rad |= TempAddr & 0x041f; RefreshAddr = rad; @@ -630,7 +630,7 @@ static INLINE void Fixit2(void) { static void Fixit1(void) { if (ScreenON || SpriteON) { - uint32 rad = RefreshAddr; + uint32_t rad = RefreshAddr; if ((rad & 0x7000) == 0x7000) { rad ^= 0x7000; @@ -650,8 +650,8 @@ void MMC5_hb(int); /* Ugh ugh ugh. */ static void DoLine(void) { int x, colour_emphasis; - uint8 *target = NULL; - uint8 *dtarget = NULL; + uint8_t *target = NULL; + uint8_t *dtarget = NULL; if (scanline >= 240 && scanline != totalscanlines) { @@ -670,7 +670,7 @@ static void DoLine(void) EndRL(); if (rendis & 2) {/* User asked to not display background data. */ - uint32 tem; + uint32_t tem; tem = Pal[0] | (Pal[0] << 8) | (Pal[0] << 16) | (Pal[0] << 24); tem |= 0x40404040; FCEU_dwmemset(target, tem, 256); @@ -682,23 +682,23 @@ static void DoLine(void) if (ScreenON || SpriteON) { /* Yes, very el-cheapo. */ if (PPU[1] & 0x01) { for (x = 63; x >= 0; x--) - *(uint32*)&target[x << 2] = (*(uint32*)&target[x << 2]) & 0x30303030; + *(uint32_t*)&target[x << 2] = (*(uint32_t*)&target[x << 2]) & 0x30303030; } } if ((PPU[1] >> 5) == 0x7) { for (x = 63; x >= 0; x--) - *(uint32*)&target[x << 2] = ((*(uint32*)&target[x << 2]) & 0x3f3f3f3f) | 0xc0c0c0c0; + *(uint32_t*)&target[x << 2] = ((*(uint32_t*)&target[x << 2]) & 0x3f3f3f3f) | 0xc0c0c0c0; } else if (PPU[1] & 0xE0) for (x = 63; x >= 0; x--) - *(uint32*)&target[x << 2] = (*(uint32*)&target[x << 2]) | 0x40404040; + *(uint32_t*)&target[x << 2] = (*(uint32_t*)&target[x << 2]) | 0x40404040; else for (x = 63; x >= 0; x--) - *(uint32*)&target[x << 2] = ((*(uint32*)&target[x << 2]) & 0x3f3f3f3f) | 0x80808080; + *(uint32_t*)&target[x << 2] = ((*(uint32_t*)&target[x << 2]) & 0x3f3f3f3f) | 0x80808080; /* write the actual colour emphasis */ colour_emphasis = ((PPU[1] >> 5) << 24) | ((PPU[1] >> 5) << 16) | ((PPU[1] >> 5) << 8) | ((PPU[1] >> 5) << 0); for (x = 63; x >= 0; x--) - *(uint32*)&dtarget[x << 2] = colour_emphasis; + *(uint32_t*)&dtarget[x << 2] = colour_emphasis; sphitx = 0x100; @@ -737,45 +737,45 @@ static void DoLine(void) #define SP_BACK 0x20 typedef struct { - uint8 y, no, atr, x; + uint8_t y, no, atr, x; } SPR; typedef struct { - uint8 ca[2], atr, x; + uint8_t ca[2], atr, x; } SPRB; void FCEUI_DisableSpriteLimitation(int a) { maxsprites = a ? 64 : 8; } -static uint8 numsprites, SpriteBlurp; +static uint8_t numsprites, SpriteBlurp; static void FetchSpriteData(void) { - uint8 ns, sb; + uint8_t ns, sb; SPR *spr; - uint8 H; + uint8_t H; int n; int vofs; - uint8 P0 = PPU[0]; + uint8_t P0 = PPU[0]; spr = (SPR*)SPRAM; H = 8; ns = sb = 0; - vofs = (uint32)(P0 & 0x8 & (((P0 & 0x20) ^ 0x20) >> 2)) << 9; + vofs = (uint32_t)(P0 & 0x8 & (((P0 & 0x20) ^ 0x20) >> 2)) << 9; H += (P0 & 0x20) >> 2; if (!PPU_hook) for (n = 63; n >= 0; n--, spr++) { - if ((uint32)(scanline - spr->y) >= H) continue; + if ((uint32_t)(scanline - spr->y) >= H) continue; if (ns < maxsprites) { if (n == 63) sb = 1; { SPRB dst; - uint8 *C; + uint8_t *C; int t; - uint32 vadr; + uint32_t vadr; t = (int)scanline - (spr->y); @@ -805,7 +805,7 @@ static void FetchSpriteData(void) { dst.x = spr->x; dst.atr = spr->atr; - *(uint32*)&SPRBUF[ns << 2] = *(uint32*)&dst; + *(uint32_t*)&SPRBUF[ns << 2] = *(uint32_t*)&dst; } ns++; @@ -816,16 +816,16 @@ static void FetchSpriteData(void) { } else for (n = 63; n >= 0; n--, spr++) { - if ((uint32)(scanline - spr->y) >= H) continue; + if ((uint32_t)(scanline - spr->y) >= H) continue; if (ns < maxsprites) { if (n == 63) sb = 1; { SPRB dst; - uint8 *C; + uint8_t *C; int t; - uint32 vadr; + uint32_t vadr; t = (int)scanline - (spr->y); @@ -858,7 +858,7 @@ static void FetchSpriteData(void) { dst.atr = spr->atr; - *(uint32*)&SPRBUF[ns << 2] = *(uint32*)&dst; + *(uint32_t*)&SPRBUF[ns << 2] = *(uint32_t*)&dst; } ns++; @@ -892,12 +892,12 @@ static void RefreshSprites(void) { spr = (SPRB*)SPRBUF + numsprites; for (n = numsprites; n >= 0; n--, spr--) { - register uint32 pixdata; - register uint8 J, atr; + register uint32_t pixdata; + register uint8_t J, atr; int x = spr->x; - uint8 *C; - uint8 *VB; + uint8_t *C; + uint8_t *VB; pixdata = ppulut1[spr->ca[0]] | ppulut2[spr->ca[1]]; J = spr->ca[0] | spr->ca[1]; @@ -996,9 +996,9 @@ static void RefreshSprites(void) { spork = 1; } -static void CopySprites(uint8 *target) { - uint8 n = ((PPU[1] & 4) ^ 4) << 1; - uint8 *P = target; +static void CopySprites(uint8_t *target) { + uint8_t n = ((PPU[1] & 4) ^ 4) << 1; + uint8_t *P = target; if (!spork) return; spork = 0; @@ -1007,7 +1007,7 @@ static void CopySprites(uint8 *target) { do { - uint32 t = *(uint32*)(sprlinebuf + n); + uint32_t t = *(uint32_t*)(sprlinebuf + n); if (t != 0x80808080) { #ifdef MSB_FIRST @@ -1249,7 +1249,7 @@ int FCEUPPU_Loop(int skip) { } } -static uint16 TempAddrT, RefreshAddrT; +static uint16_t TempAddrT, RefreshAddrT; void FCEUPPU_LoadState(int version) { TempAddr = TempAddrT; diff --git a/src/ppu.h b/src/ppu.h index e3f6cfd..6b9533e 100644 --- a/src/ppu.h +++ b/src/ppu.h @@ -10,17 +10,17 @@ void FCEUPPU_LineUpdate(void); void FCEUPPU_SetVideoSystem(int w); extern void (*GameHBIRQHook)(void), (*GameHBIRQHook2)(void); -extern void FP_FASTAPASS(1) (*PPU_hook)(uint32 A); +extern void FP_FASTAPASS(1) (*PPU_hook)(uint32_t A); /* For cart.c and banksw.h, mostly */ -extern uint8 NTARAM[0x800], *vnapage[4]; -extern uint8 PPUNTARAM; -extern uint8 PPUCHRRAM; +extern uint8_t NTARAM[0x800], *vnapage[4]; +extern uint8_t PPUNTARAM; +extern uint8_t PPUCHRRAM; void FCEUPPU_SaveState(void); void FCEUPPU_LoadState(int version); extern int scanline; -extern uint8 PPU[4]; +extern uint8_t PPU[4]; #endif diff --git a/src/pputile.h b/src/pputile.h index aca6ae6..aed172b 100644 --- a/src/pputile.h +++ b/src/pputile.h @@ -1,19 +1,19 @@ -uint8 *C; -uint8 cc; -uint32 vadr; +uint8_t *C; +uint8_t cc; +uint32_t vadr; #ifndef PPUT_MMC5SP - uint8 zz; + uint8_t zz; #else - uint8 xs, ys; + uint8_t xs, ys; xs = X1; ys = ((scanline >> 3) + MMC5HackSPScroll) & 0x1F; if (ys >= 0x1E) ys -= 0x1E; #endif if (X1 >= 2) { - uint8 *S = PALRAM; - uint32 pixdata; + uint8_t *S = PALRAM; + uint32_t pixdata; pixdata = ppulut1[(pshift[0] >> (8 - XOffset)) & 0xFF] | ppulut2[(pshift[1] >> (8 - XOffset)) & 0xFF]; diff --git a/src/sound.c b/src/sound.c index 49efcc4..7272acf 100644 --- a/src/sound.c +++ b/src/sound.c @@ -30,33 +30,33 @@ #include "filter.h" #include "state.h" -static uint32 wlookup1[32]; -static uint32 wlookup2[203]; +static uint32_t wlookup1[32]; +static uint32_t wlookup2[203]; -int32 Wave[2048 + 512]; -int32 WaveHi[40000]; -int32 WaveFinal[2048 + 512]; +int32_t Wave[2048 + 512]; +int32_t WaveHi[40000]; +int32_t WaveFinal[2048 + 512]; EXPSOUND GameExpSound = { 0, 0, 0, 0, 0, 0 }; -static uint8 TriCount = 0; -static uint8 TriMode = 0; +static uint8_t TriCount = 0; +static uint8_t TriMode = 0; -static int32 tristep = 0; +static int32_t tristep = 0; -static int32 wlcount[4] = { 0, 0, 0, 0 }; /* Wave length counters. */ +static int32_t wlcount[4] = { 0, 0, 0, 0 }; /* Wave length counters. */ -static uint8 IRQFrameMode = 0; /* $4017 / xx000000 */ -static uint8 PSG[0x10]; -static uint8 RawDALatch = 0; /* $4011 0xxxxxxx */ +static uint8_t IRQFrameMode = 0; /* $4017 / xx000000 */ +static uint8_t PSG[0x10]; +static uint8_t RawDALatch = 0; /* $4011 0xxxxxxx */ -uint8 EnabledChannels = 0; /* Byte written to $4015 */ +uint8_t EnabledChannels = 0; /* Byte written to $4015 */ typedef struct { - uint8 Speed; - uint8 Mode; /* Fixed volume(1), and loop(2) */ - uint8 DecCountTo1; - uint8 decvolume; + uint8_t Speed; + uint8_t Mode; /* Fixed volume(1), and loop(2) */ + uint8_t DecCountTo1; + uint8_t decvolume; int reloaddec; } ENVUNIT; @@ -65,32 +65,32 @@ static ENVUNIT EnvUnits[3]; static const int RectDuties[4] = { 1, 2, 4, 6 }; -static int32 RectDutyCount[2]; -static uint8 sweepon[2]; -static int32 curfreq[2]; -static uint8 SweepCount[2]; -static uint8 sweepReload[2]; +static int32_t RectDutyCount[2]; +static uint8_t sweepon[2]; +static int32_t curfreq[2]; +static uint8_t SweepCount[2]; +static uint8_t sweepReload[2]; -static uint16 nreg = 0; +static uint16_t nreg = 0; -static uint8 fcnt = 0; -static int32 fhcnt = 0; -static int32 fhinc = 0; +static uint8_t fcnt = 0; +static int32_t fhcnt = 0; +static int32_t fhinc = 0; -uint32 soundtsoffs = 0; +uint32_t soundtsoffs = 0; /* Variables exclusively for low-quality sound. */ -int32 nesincsize = 0; -uint32 soundtsinc = 0; -uint32 soundtsi = 0; -static int32 sqacc[2]; -static uint32 lq_tcout; -static int32 lq_triacc; -static int32 lq_noiseacc; +int32_t nesincsize = 0; +uint32_t soundtsinc = 0; +uint32_t soundtsi = 0; +static int32_t sqacc[2]; +static uint32_t lq_tcout; +static int32_t lq_triacc; +static int32_t lq_noiseacc; /* LQ variables segment ends. */ -static int32 lengthcount[4]; -static const uint8 lengthtable[0x20] = +static int32_t lengthcount[4]; +static const uint8_t lengthtable[0x20] = { 0x0A, 0xFE, 0x14, 0x02, 0x28, 0x04, 0x50, 0x06, 0xa0, 0x08, 0x3c, 0x0a, 0x0e, 0x0c, 0x1a, 0x0e, @@ -98,25 +98,25 @@ static const uint8 lengthtable[0x20] = 0xc0, 0x18, 0x48, 0x1a, 0x10, 0x1c, 0x20, 0x1E }; -static const uint32 NTSCNoiseFreqTable[0x10] = +static const uint32_t NTSCNoiseFreqTable[0x10] = { 0x004, 0x008, 0x010, 0x020, 0x040, 0x060, 0x080, 0x0A0, 0x0CA, 0x0FE, 0x17C, 0x1FC, 0x2FA, 0x3F8, 0x7F2, 0xFE4 }; -static const uint32 PALNoiseFreqTable[0x10] = +static const uint32_t PALNoiseFreqTable[0x10] = { 0x004, 0x008, 0x00E, 0x01E, 0x03C, 0x058, 0x076, 0x094, 0x0BC, 0x0EC, 0x162, 0x1D8, 0x2C4, 0x3B0, 0x762, 0xEC2 }; -static const uint32 NTSCDMCTable[0x10] = +static const uint32_t NTSCDMCTable[0x10] = { 0x1AC, 0x17C, 0x154, 0x140, 0x11E, 0x0FE, 0x0E2, 0x0D6, 0x0BE, 0x0A0, 0x08E, 0x080, 0x06A, 0x054, 0x048, 0x036 }; -static const uint32 PALDMCTable[0x10] = +static const uint32_t PALDMCTable[0x10] = { 0x18E, 0x162, 0x13C, 0x12A, 0x114, 0x0EC, 0x0D2, 0x0C6, 0x0B0, 0x094, 0x084, 0x076, 0x062, 0x04E, 0x042, 0x032 @@ -128,20 +128,20 @@ static const uint32 PALDMCTable[0x10] = * $4013 - Size register: Size in bytes = (V+1)*64 */ -static int32 DMCacc = 1; -static int32 DMCPeriod = 0; -static uint8 DMCBitCount = 0; +static int32_t DMCacc = 1; +static int32_t DMCPeriod = 0; +static uint8_t DMCBitCount = 0; -static uint8 DMCAddressLatch = 0, DMCSizeLatch = 0; /* writes to 4012 and 4013 */ -static uint8 DMCFormat = 0; /* Write to $4010 */ +static uint8_t DMCAddressLatch = 0, DMCSizeLatch = 0; /* writes to 4012 and 4013 */ +static uint8_t DMCFormat = 0; /* Write to $4010 */ -static uint32 DMCAddress = 0; -static int32 DMCSize = 0; -static uint8 DMCShift = 0; -static uint8 SIRQStat = 0; +static uint32_t DMCAddress = 0; +static int32_t DMCSize = 0; +static uint8_t DMCShift = 0; +static uint8_t SIRQStat = 0; static char DMCHaveDMA = 0; -static uint8 DMCDMABuf = 0; +static uint8_t DMCDMABuf = 0; static char DMCHaveSample = 0; static void Dummyfunc(void) { } @@ -151,9 +151,9 @@ static void (*DoPCM)(void) = Dummyfunc; static void (*DoSQ1)(void) = Dummyfunc; static void (*DoSQ2)(void) = Dummyfunc; -static uint32 ChannelBC[5]; +static uint32_t ChannelBC[5]; -static void LoadDMCPeriod(uint8 V) { +static void LoadDMCPeriod(uint8_t V) { if (PAL) DMCPeriod = PALDMCTable[V]; else @@ -167,8 +167,8 @@ static void PrepDPCM() { /* Instantaneous? Maybe the new freq value is being calculated all of the time... */ -static int FASTAPASS(2) CheckFreq(uint32 cf, uint8 sr) { - uint32 mod; +static int FASTAPASS(2) CheckFreq(uint32_t cf, uint8_t sr) { + uint32_t mod; if (!(sr & 0x8)) { mod = cf >> (sr & 7); if ((mod + cf) & 0x800) @@ -177,7 +177,7 @@ static int FASTAPASS(2) CheckFreq(uint32 cf, uint8 sr) { return(1); } -static void SQReload(int x, uint8 V) { +static void SQReload(int x, uint8_t V) { if (EnabledChannels & (1 << x)) lengthcount[x] = lengthtable[(V >> 3) & 0x1f]; @@ -327,7 +327,7 @@ static DECLFW(StatusWrite) { static DECLFR(StatusRead) { int x; - uint8 ret; + uint8_t ret; ret = SIRQStat; @@ -372,9 +372,9 @@ static void FASTAPASS(1) FrameSoundStuff(int V) { /* http://wiki.nesdev.com/w/index.php/APU_Sweep */ if (SweepCount[P] > 0) SweepCount[P]--; if (SweepCount[P] <= 0) { - uint32 sweepShift = (PSG[(P << 2) + 0x1] & 7); + uint32_t sweepShift = (PSG[(P << 2) + 0x1] & 7); if (sweepon[P] && sweepShift && curfreq[P] >= 8) { - int32 mod = (curfreq[P] >> sweepShift); + int32_t mod = (curfreq[P] >> sweepShift); if (PSG[(P << 2) + 0x1] & 0x8) { curfreq[P] -= (mod + (P ^ 1)); } else if ((mod + curfreq[P]) < 0x800) { @@ -488,7 +488,7 @@ void FASTAPASS(1) FCEU_SoundCPUHook(int cycles) { while (DMCacc <= 0) { if (DMCHaveSample) { - uint8 bah = RawDALatch; + uint8_t bah = RawDALatch; int t = ((DMCShift & 1) << 2) - 2; /* Unbelievably ugly hack */ if (FSettings.SndRate) { @@ -509,7 +509,7 @@ void FASTAPASS(1) FCEU_SoundCPUHook(int cycles) { } void RDoPCM(void) { - uint32 V; + uint32_t V; for (V = ChannelBC[4]; V < SOUNDTS; V++) /* TODO: get rid of floating calculations to binary. set log volume scaling. */ @@ -520,13 +520,13 @@ void RDoPCM(void) { /* This has the correct phase. Don't mess with it. */ static INLINE void RDoSQ(int x) { - int32 V; - int32 amp; - int32 rthresh; - int32 *D; - int32 currdc; - int32 cf; - int32 rc; + int32_t V; + int32_t amp; + int32_t rthresh; + int32_t *D; + int32_t currdc; + int32_t cf; + int32_t rc; V = SOUNDTS - ChannelBC[x]; cf = (curfreq[x] + 1) * 2; @@ -592,16 +592,16 @@ static void RDoSQ2(void) { } static void RDoSQLQ(void) { - int32 start, end; - int32 V; - int32 amp[2]; - int32 rthresh[2]; - int32 freq[2]; + int32_t start, end; + int32_t V; + int32_t amp[2]; + int32_t rthresh[2]; + int32_t freq[2]; int x; - int32 inie[2]; + int32_t inie[2]; - int32 ttable[2][8]; - int32 totalout; + int32_t ttable[2][8]; + int32_t totalout; start = ChannelBC[0]; end = (SOUNDTS << 16) / soundtsinc; @@ -690,14 +690,14 @@ static void RDoSQLQ(void) { } static void RDoTriangle(void) { - int32 V; - int32 tcout = (tristep & 0xF); + int32_t V; + int32_t tcout = (tristep & 0xF); if (!(tristep & 0x10)) tcout ^= 0xF; tcout = (tcout * 3) << 16; /* (tcout<<1); */ if (!lengthcount[2] || !TriCount) { /* Counter is halted, but we still need to output. */ - int32 *start = &WaveHi[ChannelBC[2]]; - int32 count = SOUNDTS - ChannelBC[2]; + int32_t *start = &WaveHi[ChannelBC[2]]; + int32_t count = SOUNDTS - ChannelBC[2]; while (count--) { *start += (tcout / 256 * FSettings.TriangleVolume) & (~0xFFFF); /* TODO OPTIMIZE ME */ start++; @@ -725,15 +725,15 @@ static void RDoTriangle(void) { } static void RDoTriangleNoisePCMLQ(void) { - int32 V; - int32 start, end; - int32 freq[2]; - int32 inie[2]; - uint32 amptab[2]; - uint32 noiseout; + int32_t V; + int32_t start, end; + int32_t freq[2]; + int32_t inie[2]; + uint32_t amptab[2]; + uint32_t noiseout; int nshift; - int32 totalout; + int32_t totalout; start = ChannelBC[2]; end = (SOUNDTS << 16) / soundtsinc; @@ -854,9 +854,9 @@ static void RDoTriangleNoisePCMLQ(void) { } static void RDoNoise(void) { - uint32 V; - int32 outo; - uint32 amptab[2]; + uint32_t V; + int32_t outo; + uint32_t amptab[2]; if (EnvUnits[2].Mode & 0x1) amptab[0] = EnvUnits[2].Speed; @@ -887,7 +887,7 @@ static void RDoNoise(void) { WaveHi[V] += outo; wlcount[3]--; if (!wlcount[3]) { - uint8 feedback; + uint8_t feedback; if (PAL) wlcount[3] = PALNoiseFreqTable[PSG[0xE] & 0xF]; else @@ -903,7 +903,7 @@ static void RDoNoise(void) { WaveHi[V] += outo; wlcount[3]--; if (!wlcount[3]) { - uint8 feedback; + uint8_t feedback; if (PAL) wlcount[3] = PALNoiseFreqTable[PSG[0xE] & 0xF]; else @@ -941,10 +941,10 @@ void SetNESSoundMap(void) { SetReadHandler(0x4015, 0x4015, StatusRead); } -static int32 inbuf = 0; +static int32_t inbuf = 0; int FlushEmulateSound(void) { int x; - int32 end, left; + int32_t end, left; if (!sound_timestamp) return(0); @@ -961,20 +961,20 @@ int FlushEmulateSound(void) { DoPCM(); if (FSettings.soundq >= 1) { - int32 *tmpo = &WaveHi[soundtsoffs]; + int32_t *tmpo = &WaveHi[soundtsoffs]; if (GameExpSound.HiFill) GameExpSound.HiFill(); for (x = sound_timestamp; x; x--) { - uint32 b = *tmpo; + uint32_t b = *tmpo; *tmpo = (b & 65535) + wlookup2[(b >> 16) & 255] + wlookup1[b >> 24]; tmpo++; } end = NeoFilterSound(WaveHi, WaveFinal, SOUNDTS, &left); - memmove(WaveHi, WaveHi + SOUNDTS - left, left * sizeof(uint32)); - memset(WaveHi + left, 0, sizeof(WaveHi) - left * sizeof(uint32)); + memmove(WaveHi, WaveHi + SOUNDTS - left, left * sizeof(uint32_t)); + memset(WaveHi + left, 0, sizeof(WaveHi) - left * sizeof(uint32_t)); if (GameExpSound.HiSync) GameExpSound.HiSync(left); for (x = 0; x < 5; x++) @@ -1008,7 +1008,7 @@ int FlushEmulateSound(void) { return end; } -int GetSoundBuffer(int32 **W) { +int GetSoundBuffer(int32_t **W) { *W = WaveFinal; return(inbuf); } @@ -1027,7 +1027,7 @@ void FCEUSND_Reset(void) { for (x = 0; x < 2; x++) { wlcount[x] = 2048; if (nesincsize) /* lq mode */ - sqacc[x] = ((uint32)2048 << 17) / nesincsize; + sqacc[x] = ((uint32_t)2048 << 17) / nesincsize; else sqacc[x] = 1; sweepon[x] = 0; @@ -1116,13 +1116,19 @@ void SetSoundVariables(void) { if (GameExpSound.RChange) GameExpSound.RChange(); - nesincsize = (int64)(((int64)1 << 17) * (double)(PAL ? PAL_CPU : NTSC_CPU) / (FSettings.SndRate * 16)); + nesincsize = (int64_t)(((int64_t)1 << 17) * (double)(PAL ? PAL_CPU : NTSC_CPU) / (FSettings.SndRate * 16)); memset(sqacc, 0, sizeof(sqacc)); memset(ChannelBC, 0, sizeof(ChannelBC)); LoadDMCPeriod(DMCFormat & 0xF); /* For changing from PAL to NTSC */ - soundtsinc = (uint32)((uint64)(PAL ? (long double)PAL_CPU * 65536 : (long double)NTSC_CPU * 65536) / (FSettings.SndRate * 16)); + /* Use double rather than long double here. long double has + * platform-dependent precision (80-bit on x87, 64-bit with + * -mfpmath=sse, 128-bit on some non-x86), so the cast-to-uint32 + * result varies across platforms. double is guaranteed 64-bit + * IEEE-754 on every platform we target, keeping soundtsinc + * deterministic across builds for replay/netplay. */ + soundtsinc = (uint32_t)((uint64_t)((double)(PAL ? PAL_CPU : NTSC_CPU) * 65536.0) / (FSettings.SndRate * 16)); } void FCEUI_Sound(int Rate) { @@ -1139,7 +1145,7 @@ void FCEUI_SetSoundQuality(int quality) { SetSoundVariables(); } -void FCEUI_SetSoundVolume(uint32 volume) { +void FCEUI_SetSoundVolume(uint32_t volume) { FSettings.SoundVolume = volume; } @@ -1227,7 +1233,7 @@ SFORMAT FCEUSND_STATEINFO[] = { /* UPDATE: Try to ignore this for all big-endian for now */ #ifndef MSB_FIRST /* wave buffer is used for filtering, only need first 17 values from it */ - { &Wave, 32 * sizeof(int32), "WAVE"}, + { &Wave, 32 * sizeof(int32_t), "WAVE"}, #endif { 0 } @@ -1245,7 +1251,7 @@ void FCEUSND_LoadState(int version) { /* minimal validation */ for (i = 0; i < 5; i++) { - uint32 BC_max = 15; + uint32_t BC_max = 15; if (FSettings.soundq == 2) { diff --git a/src/sound.h b/src/sound.h index c4413cc..3b1eeab 100644 --- a/src/sound.h +++ b/src/sound.h @@ -30,9 +30,9 @@ typedef struct { often) in lq mode than in high-quality mode. Maybe that should be fixed. :) */ - void (*NeoFill)(int32 *Wave, int Count); + void (*NeoFill)(int32_t *Wave, int Count); void (*HiFill)(void); - void (*HiSync)(int32 ts); + void (*HiSync)(int32_t ts); void (*RChange)(void); void (*Kill)(void); @@ -40,18 +40,18 @@ typedef struct { extern EXPSOUND GameExpSound; -extern int32 nesincsize; +extern int32_t nesincsize; void SetSoundVariables(void); -int GetSoundBuffer(int32 **W); +int GetSoundBuffer(int32_t **W); int FlushEmulateSound(void); -extern int32 Wave[2048 + 512]; -extern int32 WaveFinal[2048 + 512]; -extern int32 WaveHi[]; -extern uint32 soundtsinc; +extern int32_t Wave[2048 + 512]; +extern int32_t WaveFinal[2048 + 512]; +extern int32_t WaveHi[]; +extern uint32_t soundtsinc; -extern uint32 soundtsoffs; +extern uint32_t soundtsoffs; #define SOUNDTS (sound_timestamp + soundtsoffs) void SetNESSoundMap(void); diff --git a/src/state.c b/src/state.c index 1cd82ea..0343f0b 100644 --- a/src/state.c +++ b/src/state.c @@ -77,13 +77,13 @@ SFORMAT SFCPUC[] = { static int SubWrite(memstream_t *mem, SFORMAT *sf) { - uint32 acc = 0; + uint32_t acc = 0; while(sf->v) { - if(sf->s == (~(uint32)0)) /* Link to another struct. */ + if(sf->s == (~(uint32_t)0)) /* Link to another struct. */ { - uint32 tmp; + uint32_t tmp; if(!(tmp = SubWrite(mem, (SFORMAT *)sf->v))) return(0); @@ -102,14 +102,14 @@ static int SubWrite(memstream_t *mem, SFORMAT *sf) #ifdef MSB_FIRST if(sf->s & RLSB) - FlipByteOrder((uint8 *)sf->v, sf->s & (~RLSB)); + FlipByteOrder((uint8_t *)sf->v, sf->s & (~RLSB)); #endif memstream_write(mem, (char *)sf->v, sf->s & (~RLSB)); /* Now restore the original byte order. */ #ifdef MSB_FIRST if(sf->s & RLSB) - FlipByteOrder((uint8 *)sf->v, sf->s & (~RLSB)); + FlipByteOrder((uint8_t *)sf->v, sf->s & (~RLSB)); #endif } sf++; @@ -132,11 +132,11 @@ static int WriteStateChunk(memstream_t *mem, int type, SFORMAT *sf) return bsize + 5; } -static SFORMAT *CheckS(SFORMAT *sf, uint32 tsize, char *desc) +static SFORMAT *CheckS(SFORMAT *sf, uint32_t tsize, char *desc) { while (sf->v) { - if (sf->s == (~(uint32)0)) + if (sf->s == (~(uint32_t)0)) { /* Link to another SFORMAT structure. */ SFORMAT *tmp; if ((tmp = CheckS((SFORMAT*)sf->v, tsize, desc))) @@ -158,12 +158,12 @@ static SFORMAT *CheckS(SFORMAT *sf, uint32 tsize, char *desc) static int ReadStateChunk(memstream_t *mem, SFORMAT *sf, int size) { SFORMAT *tmp; - uint64 temp; + uint64_t temp; temp = memstream_pos(mem); while(memstream_pos(mem) < (temp + size)) { - uint32 tsize; + uint32_t tsize; char toa[4]; if(memstream_read(mem, toa, 4) <= 0) return 0; @@ -176,7 +176,7 @@ static int ReadStateChunk(memstream_t *mem, SFORMAT *sf, int size) #ifdef MSB_FIRST if(tmp->s & RLSB) - FlipByteOrder((uint8 *)tmp->v, tmp->s & (~RLSB)); + FlipByteOrder((uint8_t *)tmp->v, tmp->s & (~RLSB)); #endif } else @@ -185,10 +185,10 @@ static int ReadStateChunk(memstream_t *mem, SFORMAT *sf, int size) return 1; } -static int ReadStateChunks(memstream_t *st, int32 totalsize) +static int ReadStateChunks(memstream_t *st, int32_t totalsize) { int t; - uint32 size; + uint32_t size; int ret = 1; while (totalsize > 0) @@ -244,8 +244,8 @@ void FCEUSS_Save_Mem(void) { memstream_t *mem = memstream_open(1); - uint32 totalsize; - uint8 header[16] = {0}; + uint32_t totalsize; + uint8_t header[16] = {0}; header[0] = 'F'; header[1] = 'C'; @@ -280,7 +280,7 @@ void FCEUSS_Load_Mem(void) { memstream_t *mem = memstream_open(0); - uint8 header[16]; + uint8_t header[16]; int stateversion; int totalsize; int x; @@ -322,7 +322,7 @@ void ResetExState(void (*PreSave)(void), void (*PostSave)(void)) SFMDATA[0].s = 0; } -void AddExState(void *v, uint32 s, int type, char *desc) +void AddExState(void *v, uint32_t s, int type, char *desc) { /* prevent adding a terminator to the list if a NULL pointer was provided */ if (v == NULL) return; @@ -353,7 +353,7 @@ void AddExState(void *v, uint32 s, int type, char *desc) SFMDATA[SFEXINDEX].v = 0; /* End marker. */ } -void FCEU_DrawSaveStates(uint8 *XBuf) +void FCEU_DrawSaveStates(uint8_t *XBuf) { } diff --git a/src/state.h b/src/state.h index c5a1eb3..2e98831 100644 --- a/src/state.h +++ b/src/state.h @@ -28,15 +28,15 @@ void FCEUSS_Save_Mem(void); typedef struct { void *v; - uint32 s; + uint32_t s; char desc[5]; } SFORMAT; void ResetExState(void (*PreSave)(void), void (*PostSave)(void)); -void AddExState(void *v, uint32 s, int type, char *desc); +void AddExState(void *v, uint32_t s, int type, char *desc); #define FCEUSTATE_RLSB 0x80000000 -void FCEU_DrawSaveStates(uint8 *XBuf); +void FCEU_DrawSaveStates(uint8_t *XBuf); #endif diff --git a/src/unif.c b/src/unif.c index 41223e2..4678ea9 100644 --- a/src/unif.c +++ b/src/unif.c @@ -45,7 +45,7 @@ typedef struct { char ID[4]; - uint32 info; + uint32_t info; } UNIF_HEADER; typedef struct { @@ -66,30 +66,30 @@ static int vramo; static int mirrortodo; static int submapper; static int cspecial; -static uint8 *boardname; -static uint8 *sboardname; +static uint8_t *boardname; +static uint8_t *sboardname; -static uint32 CHRRAMSize; -uint8 *UNIFchrrama = 0; +static uint32_t CHRRAMSize; +uint8_t *UNIFchrrama = 0; static UNIF_HEADER unhead; static UNIF_HEADER uchead; -static uint8 *malloced[32]; -static uint32 mallocedsizes[32]; +static uint8_t *malloced[32]; +static uint32_t mallocedsizes[32]; /* used to preserve the rom order as found in the rom file * at least one mapper has bank 4 at the beginning for e.g. */ -static uint32 prg_idx[16]; -static uint32 chr_idx[16]; +static uint32_t prg_idx[16]; +static uint32_t chr_idx[16]; -static uint32 prg_chip_count; -static uint32 chr_chip_count; +static uint32_t prg_chip_count; +static uint32_t chr_chip_count; -static uint64 UNIF_PRGROMSize, UNIF_CHRROMSize; +static uint64_t UNIF_PRGROMSize, UNIF_CHRROMSize; -static int FixRomSize(uint32 size, uint32 minimum) { - uint32 x = 1; +static int FixRomSize(uint32_t size, uint32_t minimum) { + uint32_t x = 1; if (size < minimum) return minimum; @@ -147,7 +147,7 @@ static void Cleanup(void) { ResetUNIF(); } -static uint8 exntar[2048]; +static uint8_t exntar[2048]; static void MooMirroring(void) { if (mirrortodo < 0x4) @@ -162,7 +162,7 @@ static void MooMirroring(void) { static int DoMirroring(FCEUFILE *fp) { int t; - uint32 i; + uint32_t i; if (uchead.info == 1) { if ((t = FCEU_fgetc(fp)) == EOF) return(0); @@ -211,8 +211,8 @@ static int NAME(FCEUFILE *fp) { static int DINF(FCEUFILE *fp) { char name[100], method[100]; - uint8 d, m; - uint16 y; + uint8_t d, m; + uint16_t y; int t; if (FCEU_fread(name, 1, 100, fp) != 100) @@ -246,7 +246,7 @@ static int DINF(FCEUFILE *fp) { static int CTRL(FCEUFILE *fp) { int t; - uint32 i; + uint32_t i; if (uchead.info == 1) { if ((t = FCEU_fgetc(fp)) == EOF) return(0); @@ -297,12 +297,12 @@ static int EnableBattery(FCEUFILE *fp) { static int LoadPRG(FCEUFILE *fp) { int z; - uint32 t; + uint32_t t; z = uchead.ID[3] - '0'; if (z < 0 || z > 15) return(0); - /* uchead.info is uint32 from the file; reject sizes that would either + /* uchead.info is uint32_t from the file; reject sizes that would either * overflow when added below, or that are obviously bogus. The largest * legitimate single PRG chunk is in the low MiB. Cap at 64 MiB which * is well above reality but still safe. */ @@ -312,7 +312,7 @@ static int LoadPRG(FCEUFILE *fp) { if (malloced[z]) free(malloced[z]); t = uchead.info; - if (!(malloced[z] = (uint8*)FCEU_malloc(t))) + if (!(malloced[z] = (uint8_t*)FCEU_malloc(t))) return(0); mallocedsizes[z] = t; if (FCEU_fread(malloced[z], 1, uchead.info, fp) != uchead.info) { @@ -336,12 +336,12 @@ static int SetBoardName(FCEUFILE *fp) { FCEU_PrintError(" MAPR chunk too small (%u bytes); ignoring.\n", (unsigned)uchead.info); return 0; } - if (!(boardname = (uint8*)FCEU_malloc(uchead.info + 1))) + if (!(boardname = (uint8_t*)FCEU_malloc(uchead.info + 1))) return(0); FCEU_fread(boardname, 1, uchead.info, fp); boardname[uchead.info] = 0; /* strip whitespaces */ - boardname = (uint8*)string_trim_whitespace((char *const)boardname); + boardname = (uint8_t*)string_trim_whitespace((char *const)boardname); FCEU_printf(" Board name: %s\n", boardname); sboardname = boardname; if (!memcmp(boardname, "NES-", 4) || !memcmp(boardname, "UNL-", 4) || @@ -354,7 +354,7 @@ static int SetBoardName(FCEUFILE *fp) { static int LoadCHR(FCEUFILE *fp) { int z; - uint32 t; + uint32_t t; z = uchead.ID[3] - '0'; if (z < 0 || z > 15) return(0); @@ -364,7 +364,7 @@ static int LoadCHR(FCEUFILE *fp) { if (malloced[16 + z]) free(malloced[16 + z]); t = uchead.info; - if (!(malloced[16 + z] = (uint8*)FCEU_malloc(t))) + if (!(malloced[16 + z] = (uint8_t*)FCEU_malloc(t))) return(0); mallocedsizes[16 + z] = t; if (FCEU_fread(malloced[16 + z], 1, uchead.info, fp) != uchead.info) { @@ -382,7 +382,7 @@ static int LoadCHR(FCEUFILE *fp) { #define NO_BUSC 1 struct _unif_db { - uint64 partialMD5; + uint64_t partialMD5; char *boardname; int submapper; int mirroring; @@ -399,10 +399,10 @@ static struct _unif_db unif_db[] = { static void CheckHashInfo(void) { unsigned x = 0; - uint64 partialMD5 = 0; + uint64_t partialMD5 = 0; for (x = 0; x < 8; x++) - partialMD5 |= (uint64)UNIFCart.MD5[15 - x] << (x * 8); + partialMD5 |= (uint64_t)UNIFCart.MD5[15 - x] << (x * 8); x = 0; do { @@ -412,7 +412,7 @@ static void CheckHashInfo(void) { FCEU_PrintError(" For now, the information will be corrected in RAM.\n"); if (unif_db[x].boardname != NULL && strcmp((char*)unif_db[x].boardname, (char*)sboardname) != 0) { FCEU_printf(" Boardname should be set to %s\n", unif_db[x].boardname); - sboardname = (uint8*)unif_db[x].boardname; + sboardname = (uint8_t*)unif_db[x].boardname; } if (unif_db[x].submapper >= 0 && unif_db[x].submapper != submapper) { FCEU_PrintError(" Submapper should be set to %d\n", unif_db[x].submapper); @@ -727,7 +727,7 @@ static int InitializeBoard(void) { else CHRRAMSize = 8; CHRRAMSize <<= 10; - if ((UNIFchrrama = (uint8*)FCEU_malloc(CHRRAMSize))) { + if ((UNIFchrrama = (uint8_t*)FCEU_malloc(CHRRAMSize))) { SetupCartCHRMapping(0, UNIFchrrama, CHRRAMSize, 1); AddExState(UNIFchrrama, CHRRAMSize, 0, "CHRR"); } else @@ -772,7 +772,7 @@ static void UNIFGI(int h) { int UNIFLoad(const char *name, FCEUFILE *fp) { struct md5_context md5; - uint64 prg_size_bytes = 0, chr_size_bytes = 0; + uint64_t prg_size_bytes = 0, chr_size_bytes = 0; int x = 0; FCEU_fseek(fp, 0, SEEK_SET); @@ -815,12 +815,12 @@ int UNIFLoad(const char *name, FCEUFILE *fp) { /* Note: Use rounded size for memory allocations and board mapping */ - if (!(ROM = (uint8*)malloc(UNIF_PRGROMSize))) { + if (!(ROM = (uint8_t*)malloc(UNIF_PRGROMSize))) { Cleanup(); return 0; } if (UNIF_CHRROMSize) { - if (!(VROM = (uint8*)malloc(UNIF_CHRROMSize))) { + if (!(VROM = (uint8_t*)malloc(UNIF_CHRROMSize))) { Cleanup(); return 0; } diff --git a/src/unif.h b/src/unif.h index 6c96479..e60ae3d 100644 --- a/src/unif.h +++ b/src/unif.h @@ -186,7 +186,7 @@ void Mapper422_Init(CartInfo *info); void Mapper444_Init(CartInfo *info); void COOLGIRL_Init(CartInfo* info); /* m342 */ -extern uint8 *UNIFchrrama; /* Meh. So I can stop CHR RAM +extern uint8_t *UNIFchrrama; /* Meh. So I can stop CHR RAM * bank switcherooing with certain boards... */ diff --git a/src/video.c b/src/video.c index c1e4347..5e615a3 100644 --- a/src/video.c +++ b/src/video.c @@ -35,8 +35,8 @@ #include "input.h" #include "vsuni.h" -uint8 *XBuf = NULL; -uint8 *XDBuf = NULL; +uint8_t *XBuf = NULL; +uint8_t *XDBuf = NULL; int show_crosshair = 0; void FCEU_KillVirtualVideo(void) @@ -53,9 +53,9 @@ int FCEU_InitVirtualVideo(void) { /* 256 bytes per scanline, * 240 scanline maximum, +8 for alignment, */ if (!XBuf) - XBuf = (uint8*)(FCEU_malloc(256 * (256 + extrascanlines + 8))); + XBuf = (uint8_t*)(FCEU_malloc(256 * (256 + extrascanlines + 8))); if (!XDBuf) - XDBuf = (uint8*)(FCEU_malloc(256 * (256 + extrascanlines + 8))); + XDBuf = (uint8_t*)(FCEU_malloc(256 * (256 + extrascanlines + 8))); if (!XBuf || !XDBuf) { diff --git a/src/video.h b/src/video.h index 34873d6..3b9fa63 100644 --- a/src/video.h +++ b/src/video.h @@ -3,9 +3,9 @@ int FCEU_InitVirtualVideo(void); void FCEU_KillVirtualVideo(void); -extern uint8 *XBuf; -extern uint8 *XDBuf; +extern uint8_t *XBuf; +extern uint8_t *XDBuf; extern int show_crosshair; -void FCEU_DrawNumberRow(uint8 *XBuf, int *nstatus, int cur); +void FCEU_DrawNumberRow(uint8_t *XBuf, int *nstatus, int cur); #endif diff --git a/src/vsuni.c b/src/vsuni.c index 92f8c2e..93dcacb 100644 --- a/src/vsuni.c +++ b/src/vsuni.c @@ -34,7 +34,7 @@ typedef struct { char *name; int gameid; - uint64 md5partial; + uint64_t md5partial; int mapper; int mirroring; int ppu; @@ -44,8 +44,8 @@ typedef struct { VSUNIENTRY *curvs; -static uint8 DIPS = 0; -uint8 vsdip = 0; +static uint8_t DIPS = 0; +uint8_t vsdip = 0; void FCEUI_VSUniToggleDIPView(void) { DIPS = !DIPS; @@ -60,11 +60,11 @@ void FCEUI_VSUniSetDIP(int w, int state) { FCEUI_VSUniToggleDIP(w); } -uint8 FCEUI_VSUniGetDIPs(void) { +uint8_t FCEUI_VSUniGetDIPs(void) { return(vsdip); } -static uint8 secdata[2][32] = { +static uint8_t secdata[2][32] = { { 0xff, 0xbf, 0xb7, 0x97, 0x97, 0x17, 0x57, 0x4f, 0x6f, 0x6b, 0xeb, 0xa9, 0xb1, 0x90, 0x94, 0x14, 0x56, 0x4e, 0x6f, 0x6b, 0xeb, 0xa9, 0xb1, 0x90, @@ -75,9 +75,9 @@ static uint8 secdata[2][32] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }; -static uint8 *secptr; +static uint8_t *secptr; -static uint8 VSindex; +static uint8_t VSindex; static DECLFR(VSSecRead) { switch (A) { @@ -86,14 +86,14 @@ static DECLFR(VSSecRead) { } return(0x00); } -uint8 coinon = 0; +uint8_t coinon = 0; void FCEU_VSUniCoin(void) { coinon = 6; } static int curppu; -static int64 curmd5; +static int64_t curmd5; #define RP2C04_0001 1 #define RP2C04_0002 2 @@ -123,7 +123,7 @@ static DECLFR(A2002_MBJ) { /* Mighty Bomb Jack */ static DECLFW(B2000_2001_2C05) { OldWritePPU[(A & 1) ^ 1](A ^ 1, V); } -static uint8 xevselect = 0; +static uint8_t xevselect = 0; static DECLFR(XevRead) { if (A == 0x54FF) { return(0x5); @@ -138,9 +138,9 @@ static DECLFR(XevRead) { return(X.DB); } -void FCEU_VSUniSwap(uint8 *j0, uint8 *j1) { +void FCEU_VSUniSwap(uint8_t *j0, uint8_t *j1) { if (curvs->ioption & IOPTION_SWAPDIRAB) { - uint16 t = *j0; + uint16_t t = *j0; *j0 = (*j0 & 0xC) | (*j1 & 0xF3); *j1 = (*j1 & 0xC) | (t & 0xF3); } @@ -287,7 +287,7 @@ VSUNIENTRY VSUniGames[] = { 0 } }; -void FCEU_VSUniCheck(uint64 md5partial, int *MapperNo, int *Mirroring) { +void FCEU_VSUniCheck(uint64_t md5partial, int *MapperNo, int *Mirroring) { VSUNIENTRY *vs = VSUniGames; while (vs->name) { @@ -330,28 +330,28 @@ void FCEU_VSUniCheck(uint64 md5partial, int *MapperNo, int *Mirroring) { } } -void FCEU_VSUniDraw(uint8 *XBuf) { - uint32 *dest; +void FCEU_VSUniDraw(uint8_t *XBuf) { + uint32_t *dest; int y, x; if (!DIPS) return; - dest = (uint32*)(XBuf + 256 * 12 + 164); + dest = (uint32_t*)(XBuf + 256 * 12 + 164); for (y = 24; y; y--, dest += (256 - 72) >> 2) { for (x = 72 >> 2; x; x--, dest++) *dest = 0; } - dest = (uint32*)(XBuf + 256 * (12 + 4) + 164 + 6); + dest = (uint32_t*)(XBuf + 256 * (12 + 4) + 164 + 6); for (y = 16; y; y--, dest += (256 >> 2) - 16) for (x = 8; x; x--) { *dest = 0x01010101; dest += 2; } - dest = (uint32*)(XBuf + 256 * (12 + 4) + 164 + 6); + dest = (uint32_t*)(XBuf + 256 * (12 + 4) + 164 + 6); for (x = 0; x < 8; x++, dest += 2) { - uint32 *da = dest + (256 >> 2); + uint32_t *da = dest + (256 >> 2); if (!((vsdip >> x) & 1)) da += (256 >> 2) * 10; diff --git a/src/vsuni.h b/src/vsuni.h index e84141c..3e925eb 100644 --- a/src/vsuni.h +++ b/src/vsuni.h @@ -2,12 +2,12 @@ #define _FCEU_VSUNI_H void FCEU_VSUniPower(void); -void FCEU_VSUniCheck(uint64 md5partial, int *, int *); -void FCEU_VSUniDraw(uint8 *XBuf); +void FCEU_VSUniCheck(uint64_t md5partial, int *, int *); +void FCEU_VSUniDraw(uint8_t *XBuf); void FCEU_VSUniToggleDIP(int); /* For movies and netplay */ void FCEU_VSUniCoin(void); -void FCEU_VSUniSwap(uint8 *j0, uint8 *j1); +void FCEU_VSUniSwap(uint8_t *j0, uint8_t *j1); enum { VS_BASEBALL = 1, diff --git a/src/x6502.c b/src/x6502.c index 6c820cd..4f4f173 100644 --- a/src/x6502.c +++ b/src/x6502.c @@ -27,14 +27,14 @@ #include "sound.h" X6502 X; -uint8 encryptOpcodes =0; +uint8_t encryptOpcodes =0; #ifdef FCEUDEF_DEBUGGER -void (*X6502_Run)(int32 cycles); +void (*X6502_Run)(int32_t cycles); #endif -uint32 timestamp; -uint32 sound_timestamp; +uint32_t timestamp; +uint32_t sound_timestamp; void FP_FASTAPASS(1) (*MapIRQHook)(int a); #define _PC X.PC @@ -58,25 +58,25 @@ void FP_FASTAPASS(1) (*MapIRQHook)(int a); if (!overclocked) sound_timestamp += __x; \ } -static INLINE uint8 RdMemNorm(uint32 A) { +static INLINE uint8_t RdMemNorm(uint32_t A) { return(_DB = ARead[A](A)); } -static INLINE void WrMemNorm(uint32 A, uint8 V) { +static INLINE void WrMemNorm(uint32_t A, uint8_t V) { BWrite[A](A, V); } #ifdef FCEUDEF_DEBUGGER X6502 XSave; /* This is getting ugly. */ -static INLINE uint8 RdMemHook(uint32 A) { +static INLINE uint8_t RdMemHook(uint32_t A) { if (X.ReadHook) return(_DB = X.ReadHook(&X, A)); else return(_DB = ARead[A](A)); } -static INLINE void WrMemHook(uint32 A, uint8 V) { +static INLINE void WrMemHook(uint32_t A, uint8_t V) { if (X.WriteHook) X.WriteHook(&X, A, V); else @@ -84,33 +84,33 @@ static INLINE void WrMemHook(uint32 A, uint8 V) { } #endif -static INLINE uint8 RdRAMFast(uint32 A) { +static INLINE uint8_t RdRAMFast(uint32_t A) { return(_DB = RAM[A]); } -static INLINE void WrRAMFast(uint32 A, uint8 V) { +static INLINE void WrRAMFast(uint32_t A, uint8_t V) { RAM[A] = V; } -uint8 FASTAPASS(1) X6502_DMR(uint32 A) { +uint8_t FASTAPASS(1) X6502_DMR(uint32_t A) { ADDCYC(1); return(X.DB = ARead[A](A)); } -void FASTAPASS(2) X6502_DMW(uint32 A, uint8 V) { +void FASTAPASS(2) X6502_DMW(uint32_t A, uint8_t V) { ADDCYC(1); BWrite[A](A, V); } #define PUSH(V) { \ - uint8 VTMP = V; \ + uint8_t VTMP = V; \ WrRAM(0x100 + _S, VTMP); \ _S--; \ } #define POP() RdRAM(0x100 + (++_S)) -static uint8 ZNTable[256]; +static uint8_t ZNTable[256]; /* Some of these operations will only make sense if you know what the flag constants are. */ #define X_ZN(zort) _P &= ~(Z_FLAG | N_FLAG); _P |= ZNTable[zort] @@ -119,9 +119,9 @@ static uint8 ZNTable[256]; #define JR(cond) { \ if (cond) \ { \ - uint32 tmp; \ - int32 disp; \ - disp = (int8)RdMem(_PC); \ + uint32_t tmp; \ + int32_t disp; \ + disp = (int8_t)RdMem(_PC); \ _PC++; \ ADDCYC(1); \ tmp = _PC; \ @@ -142,7 +142,7 @@ static uint8 ZNTable[256]; #define ORA _A |= x; X_ZN(_A) #define ADC { \ - uint32 l = _A + x + (_P & 1); \ + uint32_t l = _A + x + (_P & 1); \ _P &= ~(Z_FLAG | C_FLAG | N_FLAG | V_FLAG); \ _P |= ((((_A ^ x) & 0x80) ^ 0x80) & ((_A ^ l) & 0x80)) >> 1; \ _P |= (l >> 8) & C_FLAG; \ @@ -151,7 +151,7 @@ static uint8 ZNTable[256]; } #define SBC { \ - uint32 l = _A - x - ((_P & 1) ^ 1); \ + uint32_t l = _A - x - ((_P & 1) ^ 1); \ _P &= ~(Z_FLAG | C_FLAG | N_FLAG | V_FLAG); \ _P |= ((_A ^ l) & (_A ^ x) & 0x80) >> 1; \ _P |= ((l >> 8) & C_FLAG) ^ C_FLAG; \ @@ -160,7 +160,7 @@ static uint8 ZNTable[256]; } #define CMPL(a1, a2) { \ - uint32 t = a1 - a2; \ + uint32_t t = a1 - a2; \ X_ZN(t & 0xFF); \ _P &= ~C_FLAG; \ _P |= ((t >> 8) & C_FLAG) ^ C_FLAG; \ @@ -168,7 +168,7 @@ static uint8 ZNTable[256]; /* Special undocumented operation. Very similar to CMP. */ #define AXS { \ - uint32 t = (_A & _X) - x; \ + uint32_t t = (_A & _X) - x; \ X_ZN(t & 0xFF); \ _P &= ~C_FLAG; \ _P |= ((t >> 8) & C_FLAG) ^ C_FLAG; \ @@ -190,7 +190,7 @@ static uint8 ZNTable[256]; #define LSRA _P &= ~(C_FLAG | N_FLAG | Z_FLAG); _P |= _A & 1; _A >>= 1; X_ZNT(_A) #define ROL { \ - uint8 l = x >> 7; \ + uint8_t l = x >> 7; \ x <<= 1; \ x |= _P & C_FLAG; \ _P &= ~(Z_FLAG | N_FLAG | C_FLAG); \ @@ -199,7 +199,7 @@ static uint8 ZNTable[256]; } #define ROR { \ - uint8 l = x & 1; \ + uint8_t l = x & 1; \ x >>= 1; \ x |= (_P & C_FLAG) << 7; \ _P &= ~(Z_FLAG | N_FLAG | C_FLAG); \ @@ -221,7 +221,7 @@ static uint8 ZNTable[256]; /* Absolute Indexed(for reads) */ #define GetABIRD(target, i) { \ - uint32 tmp; \ + uint32_t tmp; \ GetAB(tmp); \ target = tmp; \ target += i; \ @@ -234,7 +234,7 @@ static uint8 ZNTable[256]; /* Absolute Indexed(for writes and rmws) */ #define GetABIWR(target, i) { \ - uint32 rt; \ + uint32_t rt; \ GetAB(rt); \ target = rt; \ target += i; \ @@ -256,7 +256,7 @@ static uint8 ZNTable[256]; /* Indexed Indirect */ #define GetIX(target) { \ - uint8 tmp; \ + uint8_t tmp; \ tmp = RdMem(_PC); \ _PC++; \ tmp += _X; \ @@ -267,8 +267,8 @@ static uint8 ZNTable[256]; /* Indirect Indexed(for reads) */ #define GetIYRD(target) { \ - uint32 rt; \ - uint8 tmp; \ + uint32_t rt; \ + uint8_t tmp; \ tmp = RdMem(_PC); \ _PC++; \ rt = RdRAM(tmp); \ @@ -285,8 +285,8 @@ static uint8 ZNTable[256]; /* Indirect Indexed(for writes and rmws) */ #define GetIYWR(target) { \ - uint32 rt; \ - uint8 tmp; \ + uint32_t rt; \ + uint8_t tmp; \ tmp = RdMem(_PC); \ _PC++; \ rt = RdRAM(tmp); \ @@ -303,38 +303,38 @@ and operation macros. Note that operation macros will always operate(redundant redundant) on the variable "x". */ -#define RMW_A(op) { uint8 x = _A; op; _A = x; break; } /* Meh... */ -#define RMW_AB(op) { uint32 A; uint8 x; GetAB(A); x = RdMem(A); WrMem(A, x); op; WrMem(A, x); break; } -#define RMW_ABI(reg, op) { uint32 A; uint8 x; GetABIWR(A, reg); x = RdMem(A); WrMem(A, x); op; WrMem(A, x); break; } +#define RMW_A(op) { uint8_t x = _A; op; _A = x; break; } /* Meh... */ +#define RMW_AB(op) { uint32_t A; uint8_t x; GetAB(A); x = RdMem(A); WrMem(A, x); op; WrMem(A, x); break; } +#define RMW_ABI(reg, op) { uint32_t A; uint8_t x; GetABIWR(A, reg); x = RdMem(A); WrMem(A, x); op; WrMem(A, x); break; } #define RMW_ABX(op) RMW_ABI(_X, op) #define RMW_ABY(op) RMW_ABI(_Y, op) -#define RMW_IX(op) { uint32 A; uint8 x; GetIX(A); x = RdMem(A); WrMem(A, x); op; WrMem(A, x); break; } -#define RMW_IY(op) { uint32 A; uint8 x; GetIYWR(A); x = RdMem(A); WrMem(A, x); op; WrMem(A, x); break; } -#define RMW_ZP(op) { uint8 A; uint8 x; GetZP(A); x = RdRAM(A); op; WrRAM(A, x); break; } -#define RMW_ZPX(op) { uint8 A; uint8 x; GetZPI(A, _X); x = RdRAM(A); op; WrRAM(A, x); break; } +#define RMW_IX(op) { uint32_t A; uint8_t x; GetIX(A); x = RdMem(A); WrMem(A, x); op; WrMem(A, x); break; } +#define RMW_IY(op) { uint32_t A; uint8_t x; GetIYWR(A); x = RdMem(A); WrMem(A, x); op; WrMem(A, x); break; } +#define RMW_ZP(op) { uint8_t A; uint8_t x; GetZP(A); x = RdRAM(A); op; WrRAM(A, x); break; } +#define RMW_ZPX(op) { uint8_t A; uint8_t x; GetZPI(A, _X); x = RdRAM(A); op; WrRAM(A, x); break; } -#define LD_IM(op) { uint8 x; x = RdMem(_PC); _PC++; op; break; } -#define LD_ZP(op) { uint8 A; uint8 x; GetZP(A); x = RdRAM(A); op; break; } -#define LD_ZPX(op) { uint8 A; uint8 x; GetZPI(A, _X); x = RdRAM(A); op; break; } -#define LD_ZPY(op) { uint8 A; uint8 x; GetZPI(A, _Y); x = RdRAM(A); op; break; } -#define LD_AB(op) { uint32 A; uint8 x; GetAB(A); x = RdMem(A); op; break; } -#define LD_ABI(reg, op) { uint32 A; uint8 x; GetABIRD(A, reg); x = RdMem(A); op; break; } +#define LD_IM(op) { uint8_t x; x = RdMem(_PC); _PC++; op; break; } +#define LD_ZP(op) { uint8_t A; uint8_t x; GetZP(A); x = RdRAM(A); op; break; } +#define LD_ZPX(op) { uint8_t A; uint8_t x; GetZPI(A, _X); x = RdRAM(A); op; break; } +#define LD_ZPY(op) { uint8_t A; uint8_t x; GetZPI(A, _Y); x = RdRAM(A); op; break; } +#define LD_AB(op) { uint32_t A; uint8_t x; GetAB(A); x = RdMem(A); op; break; } +#define LD_ABI(reg, op) { uint32_t A; uint8_t x; GetABIRD(A, reg); x = RdMem(A); op; break; } #define LD_ABX(op) LD_ABI(_X, op) #define LD_ABY(op) LD_ABI(_Y, op) -#define LD_IX(op) { uint32 A; uint8 x; GetIX(A); x = RdMem(A); op; break; } -#define LD_IY(op) { uint32 A; uint8 x; GetIYRD(A); x = RdMem(A); op; break; } +#define LD_IX(op) { uint32_t A; uint8_t x; GetIX(A); x = RdMem(A); op; break; } +#define LD_IY(op) { uint32_t A; uint8_t x; GetIYRD(A); x = RdMem(A); op; break; } -#define ST_ZP(r) { uint8 A; GetZP(A); WrRAM(A, r); break; } -#define ST_ZPX(r) { uint8 A; GetZPI(A, _X); WrRAM(A, r); break; } -#define ST_ZPY(r) { uint8 A; GetZPI(A, _Y); WrRAM(A, r); break; } -#define ST_AB(r) { uint32 A; GetAB(A); WrMem(A, r); break; } -#define ST_ABI(reg, r) { uint32 A; GetABIWR(A, reg); WrMem(A, r); break; } +#define ST_ZP(r) { uint8_t A; GetZP(A); WrRAM(A, r); break; } +#define ST_ZPX(r) { uint8_t A; GetZPI(A, _X); WrRAM(A, r); break; } +#define ST_ZPY(r) { uint8_t A; GetZPI(A, _Y); WrRAM(A, r); break; } +#define ST_AB(r) { uint32_t A; GetAB(A); WrMem(A, r); break; } +#define ST_ABI(reg, r) { uint32_t A; GetABIWR(A, reg); WrMem(A, r); break; } #define ST_ABX(r) ST_ABI(_X, r) #define ST_ABY(r) ST_ABI(_Y, r) -#define ST_IX(r) { uint32 A; GetIX(A); WrMem(A, r); break; } -#define ST_IY(r) { uint32 A; GetIYWR(A); WrMem(A, r); break; } +#define ST_IX(r) { uint32_t A; GetIX(A); WrMem(A, r); break; } +#define ST_IY(r) { uint32_t A; GetIYWR(A); WrMem(A, r); break; } -static uint8 CycTable[256] = +static uint8_t CycTable[256] = { /*0x00*/ 7, 6, 2, 8, 3, 3, 5, 5, 3, 2, 2, 2, 4, 4, 6, 6, /*0x10*/ 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, @@ -380,7 +380,7 @@ void FCEUI_IRQ(void) { _IRQlow |= FCEU_IQTEMP; } -void FCEUI_GetIVectors(uint16 *reset, uint16 *irq, uint16 *nmi) { +void FCEUI_GetIVectors(uint16_t *reset, uint16_t *irq, uint16_t *nmi) { fceuindbg = 1; *reset = RdMemNorm(0xFFFC); @@ -422,7 +422,7 @@ void X6502_Power(void) { } #ifdef FCEUDEF_DEBUGGER -static void X6502_RunDebug(int32 cycles) { +static void X6502_RunDebug(int32_t cycles) { #define RdRAM RdMemHook #define WrRAM WrMemHook #define RdMem RdMemHook @@ -436,8 +436,8 @@ static void X6502_RunDebug(int32 cycles) { _count += cycles; while (_count > 0) { - int32 temp; - uint8 b1; + int32_t temp; + uint8_t b1; if (_IRQlow) { if (_IRQlow & FCEU_IQRESET) { @@ -485,7 +485,7 @@ static void X6502_RunDebug(int32 cycles) { * Do the pre-exec voodoo. */ if (X.ReadHook || X.WriteHook) { - uint32 tsave = timestamp; + uint32_t tsave = timestamp; XSave = X; fceuindbg = 1; @@ -535,9 +535,9 @@ static void X6502_RunDebug(int32 cycles) { #undef WrMem } -static void X6502_RunNormal(int32 cycles) +static void X6502_RunNormal(int32_t cycles) #else -void X6502_Run(int32 cycles) +void X6502_Run(int32_t cycles) #endif { #define RdRAM RdRAMFast @@ -547,9 +547,9 @@ void X6502_Run(int32 cycles) #if (defined(C80x86) && defined(__GNUC__)) /* Gives a nice little speed boost. */ - register uint16 pbackus asm ("edi"); + register uint16_t pbackus asm ("edi"); #else - uint16 pbackus; + uint16_t pbackus; #endif pbackus = _PC; @@ -565,8 +565,8 @@ void X6502_Run(int32 cycles) _count += cycles; while (_count > 0) { - int32 temp; - uint8 b1; + int32_t temp; + uint8_t b1; if (_IRQlow) { if (_IRQlow & FCEU_IQRESET) { @@ -637,7 +637,7 @@ void X6502_Run(int32 cycles) } #ifdef FCEUDEF_DEBUGGER -void X6502_Debug(void (*CPUHook)(X6502 *), uint8 (*ReadHook)(X6502 *, uint32), void (*WriteHook)(X6502 *, uint32, uint8)) { +void X6502_Debug(void (*CPUHook)(X6502 *), uint8_t (*ReadHook)(X6502 *, uint32_t), void (*WriteHook)(X6502 *, uint32_t, uint8_t)) { debugmode = (ReadHook || WriteHook || CPUHook) ? 1 : 0; X.ReadHook = ReadHook; X.WriteHook = WriteHook; diff --git a/src/x6502.h b/src/x6502.h index 436bb1d..e62b5bd 100644 --- a/src/x6502.h +++ b/src/x6502.h @@ -25,18 +25,18 @@ #ifdef FCEUDEF_DEBUGGER void X6502_Debug(void (*CPUHook)(X6502 *), - uint8 (*ReadHook)(X6502 *, uint32), - void (*WriteHook)(X6502 *, uint32, uint8)); + uint8_t (*ReadHook)(X6502 *, uint32_t), + void (*WriteHook)(X6502 *, uint32_t, uint8_t)); -extern void (*X6502_Run)(int32 cycles); +extern void (*X6502_Run)(int32_t cycles); #else -void X6502_Run(int32 cycles); +void X6502_Run(int32_t cycles); #endif -extern uint32 timestamp; -extern uint32 sound_timestamp; +extern uint32_t timestamp; +extern uint32_t sound_timestamp; extern X6502 X; -extern uint8 encryptOpcodes; +extern uint8_t encryptOpcodes; #define N_FLAG 0x80 #define V_FLAG 0x40 @@ -69,8 +69,8 @@ void X6502_Power(void); void TriggerNMI(void); void TriggerNMI2(void); -uint8 FASTAPASS(1) X6502_DMR(uint32 A); -void FASTAPASS(2) X6502_DMW(uint32 A, uint8 V); +uint8_t FASTAPASS(1) X6502_DMR(uint32_t A); +void FASTAPASS(2) X6502_DMW(uint32_t A, uint8_t V); void FASTAPASS(1) X6502_IRQBegin(int w); void FASTAPASS(1) X6502_IRQEnd(int w); diff --git a/src/x6502struct.h b/src/x6502struct.h index fec3003..8aac6f2 100644 --- a/src/x6502struct.h +++ b/src/x6502struct.h @@ -2,24 +2,24 @@ #define _X6502STRUCTH typedef struct __X6502 { - int32 tcount; /* Temporary cycle counter */ - uint16 PC; /* I'll change this to uint32 later... */ + int32_t tcount; /* Temporary cycle counter */ + uint16_t PC; /* I'll change this to uint32_t later... */ /* I'll need to AND PC after increments to 0xFFFF */ /* when I do, though. Perhaps an IPC() macro? */ - uint8 A, X, Y, S, P, mooPI; - uint8 jammed; + uint8_t A, X, Y, S, P, mooPI; + uint8_t jammed; - int32 count; - uint32 IRQlow; /* Simulated IRQ pin held low(or is it high?). + int32_t count; + uint32_t IRQlow; /* Simulated IRQ pin held low(or is it high?). And other junk hooked on for speed reasons.*/ - uint8 DB; /* Data bus "cache" for reads from certain areas */ + uint8_t DB; /* Data bus "cache" for reads from certain areas */ int preexec; /* Pre-exec'ing for debug breakpoints. */ #ifdef FCEUDEF_DEBUGGER void (*CPUHook)(struct __X6502 *); - uint8 (*ReadHook)(struct __X6502 *, uint32); - void (*WriteHook)(struct __X6502 *, uint32, uint8); + uint8_t (*ReadHook)(struct __X6502 *, uint32_t); + void (*WriteHook)(struct __X6502 *, uint32_t, uint8_t); #endif } X6502;