sync to FCEUX r2815

This commit is contained in:
dborth 2013-01-01 23:27:33 +00:00
parent c67924525b
commit 50372e3236
31 changed files with 950 additions and 966 deletions

View File

@ -392,6 +392,7 @@ int main(int argc, char *argv[])
FCEUI_SetGameGenie(1); // 0 - OFF, 1 - ON
FDSBIOS=(uint8 *)malloc(8192);
memset(FDSBIOS, 0, sizeof(FDSBIOS)); // clear FDS BIOS memory
FCEUI_SetSoundQuality(1); // 0 - low, 1 - high, 2 - high (alt.)

View File

@ -24,7 +24,7 @@
extern uint32 ROM_size;
static uint8 prg[4], chr, sbw, we_sram;
static uint8 *WRAM=NULL;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
@ -130,7 +130,7 @@ static void M176Close(void)
{
if(WRAM)
FCEU_gfree(WRAM);
WRAM=NULL;
WRAM = NULL;
}
static void StateRestore(int version)

View File

@ -23,6 +23,8 @@
static uint8 preg[4], creg[8];
static uint8 IRQa, mirr;
static int32 IRQCount, IRQLatch;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[] =
{
@ -38,6 +40,7 @@ static SFORMAT StateRegs[] =
static void Sync(void) {
int i;
for (i = 0; i < 8; i++) setchr1(i << 10, creg[i]);
setprg8r(0x10, 0x6000, 0);
setprg8(0x8000, preg[0]);
setprg8(0xA000, preg[1]);
setprg8(0xC000, preg[2]);
@ -75,12 +78,14 @@ static DECLFW(M18WriteChr) {
}
static void M18Power(void) {
IRQa = 0;
preg[0] = 0;
preg[1] = 1;
preg[2] = ~1;
preg[3] = ~0;
Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW);
SetWriteHandler(0x8000, 0x9FFF, M18WritePrg);
SetWriteHandler(0xA000, 0xDFFF, M18WriteChr);
SetWriteHandler(0xE000, 0xFFFF, M18WriteIRQ);
@ -97,15 +102,32 @@ static void M18IRQHook(int a) {
}
}
static void M18Close(void)
{
if (WRAM)
FCEU_gfree(WRAM);
WRAM = NULL;
}
static void StateRestore(int version) {
Sync();
}
void Mapper18_Init(CartInfo *info) {
info->Power = M18Power;
info->Close = M18Close;
MapIRQHook = M18IRQHook;
GameStateRestore = StateRestore;
WRAMSIZE = 8192;
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
if (info->battery) {
info->SaveGame[0] = WRAM;
info->SaveGameLen[0] = WRAMSIZE;
}
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@ -61,6 +61,7 @@ static DECLFW(M228Write) {
static void M228Reset(void) {
areg = 0x8000;
vreg = 0;
memset(mram, 0, sizeof(mram));
Sync();
}

View File

@ -21,7 +21,7 @@
#include "mapinc.h"
static uint8 regs[8];
static uint8 *WRAM=NULL;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[] =

View File

@ -22,7 +22,7 @@
static uint8 preg[2], creg[8], mirr;
static uint8 *WRAM=NULL;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[] =

View File

@ -23,7 +23,7 @@
static uint8 cmdreg, preg[4], creg[8], mirr;
static uint8 IRQa;
static int32 IRQCount;
static uint8 *WRAM=NULL;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[] =

View File

@ -21,7 +21,7 @@
#include "mapinc.h"
static uint8 latch;
static uint8 *WRAM=NULL;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static writefunc old4016;

View File

@ -24,9 +24,9 @@ static uint8 reg[8];
static uint8 IRQa;
static int16 IRQCount, IRQLatch;
/*
static uint8 *WRAM=NULL;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static uint8 *CHRRAM=NULL;
static uint8 *CHRRAM = NULL;
static uint32 CHRRAMSIZE;
*/

View File

@ -26,7 +26,7 @@
static uint8 preg[4], creg[8], latch, ffemode;
static uint8 IRQa, mirr;
static int32 IRQCount, IRQLatch;
static uint8 *WRAM=NULL;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[] =

View File

@ -23,7 +23,7 @@
static uint8 is10;
static uint8 creg[4], latch0, latch1, preg, mirr;
static uint8 *WRAM=NULL;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[] =

View File

@ -21,7 +21,7 @@
*/
/* Code for emulating iNES mappers 4,12,44,45,47,49,52,74,114,115,116,118,
119,165,205,245,249,250,254
119,165,205,245,249,250,254
*/
#include "mapinc.h"
@ -29,8 +29,9 @@
uint8 MMC3_cmd;
uint8 *WRAM;
uint32 WRAMSIZE;
uint8 *CHRRAM;
uint32 CHRRAMSize;
uint32 CHRRAMSIZE;
uint8 DRegBuf[8];
uint8 EXPREGS[8]; /* For bootleg games, mostly. */
uint8 A000B, A001B;
@ -55,7 +56,6 @@ static SFORMAT MMC3_StateRegs[] =
{ 0 }
};
static int wrams;
static int isRevB = 1;
void (*pwrap)(uint32 A, uint8 V);
@ -249,22 +249,22 @@ void GenMMC3Power(void) {
A001B = A000B = 0;
setmirror(1);
if (mmc3opts & 1) {
if (wrams == 1024) {
if (WRAMSIZE == 1024) {
FCEU_CheatAddRAM(1, 0x7000, WRAM);
SetReadHandler(0x7000, 0x7FFF, MAWRAMMMC6);
SetWriteHandler(0x7000, 0x7FFF, MBWRAMMMC6);
} else {
FCEU_CheatAddRAM((wrams & 0x1fff) >> 10, 0x6000, WRAM);
SetWriteHandler(0x6000, 0x6000 + ((wrams - 1) & 0x1fff), CartBW);
SetReadHandler(0x6000, 0x6000 + ((wrams - 1) & 0x1fff), CartBR);
FCEU_CheatAddRAM((WRAMSIZE & 0x1fff) >> 10, 0x6000, WRAM);
SetWriteHandler(0x6000, 0x6000 + ((WRAMSIZE - 1) & 0x1fff), CartBW);
SetReadHandler(0x6000, 0x6000 + ((WRAMSIZE - 1) & 0x1fff), CartBR);
setprg8r(0x10, 0x6000, 0);
}
if (!(mmc3opts & 2))
FCEU_dwmemset(WRAM, 0, wrams);
FCEU_dwmemset(WRAM, 0, WRAMSIZE);
}
MMC3RegReset();
if (CHRRAM)
FCEU_dwmemset(CHRRAM, 0, CHRRAMSize);
FCEU_dwmemset(CHRRAM, 0, CHRRAMSIZE);
}
static void GenMMC3Close(void) {
@ -280,7 +280,7 @@ void GenMMC3_Init(CartInfo *info, int prg, int chr, int wram, int battery) {
cwrap = GENCWRAP;
mwrap = GENMWRAP;
wrams = wram << 10;
WRAMSIZE = wram << 10;
PRGmask8[0] &= (prg >> 13) - 1;
CHRmask1[0] &= (chr >> 10) - 1;
@ -288,15 +288,15 @@ void GenMMC3_Init(CartInfo *info, int prg, int chr, int wram, int battery) {
if (wram) {
mmc3opts |= 1;
WRAM = (uint8*)FCEU_gmalloc(wrams);
SetupCartPRGMapping(0x10, WRAM, wrams, 1);
AddExState(WRAM, wrams, 0, "MRAM");
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
}
if (battery) {
mmc3opts |= 2;
info->SaveGame[0] = WRAM;
info->SaveGameLen[0] = wrams;
info->SaveGameLen[0] = WRAMSIZE;
}
AddExState(MMC3_StateRegs, ~0, 0, 0);
@ -668,10 +668,10 @@ static void M74CW(uint32 A, uint8 V) {
void Mapper74_Init(CartInfo *info) {
GenMMC3_Init(info, 512, 256, 8, info->battery);
cwrap = M74CW;
CHRRAMSize = 2048;
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSize);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
AddExState(CHRRAM, CHRRAMSize, 0, "CHRR");
CHRRAMSIZE = 2048;
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR");
}
// ---------------------------- Mapper 114 ------------------------------
@ -733,10 +733,13 @@ void Mapper114_Init(CartInfo *info) {
// ---------------------------- Mapper 115 KN-658 board ------------------------------
static void M115PW(uint32 A, uint8 V) {
//zero 09-apr-2012 - #3515357 - changed to support Bao Qing Tian (mapper 248) which was missing BG gfx. 115 game(s?) seem still to work OK.
setprg8(A, V);
if (A == 0x8000 && EXPREGS[0] & 0x80)
setprg16(0x8000, (EXPREGS[0] & 0xF));
if (EXPREGS[0] & 0x80) {
if (EXPREGS[0] & 0x40)
setprg32(0x8000, (EXPREGS[0] & 0x0F) >> 1); // looks like another 2-in-1, Thunderbolt need it
else
setprg16(0x8000, (EXPREGS[0] & 0x0F));
}
}
static void M115CW(uint32 A, uint8 V) {
@ -799,9 +802,9 @@ static void TQWRAP(uint32 A, uint8 V) {
void Mapper119_Init(CartInfo *info) {
GenMMC3_Init(info, 512, 64, 0, 0);
cwrap = TQWRAP;
CHRRAMSize = 8192;
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSize);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
CHRRAMSIZE = 8192;
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
}
// ---------------------------- Mapper 134 ------------------------------
@ -890,10 +893,10 @@ void Mapper165_Init(CartInfo *info) {
cwrap = M165CWM;
PPU_hook = M165PPU;
info->Power = M165Power;
CHRRAMSize = 4096;
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSize);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
AddExState(CHRRAM, CHRRAMSize, 0, "CHRR");
CHRRAMSIZE = 4096;
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR");
AddExState(EXPREGS, 4, 0, "EXPR");
}
@ -906,10 +909,10 @@ static void M191CW(uint32 A, uint8 V) {
void Mapper191_Init(CartInfo *info) {
GenMMC3_Init(info, 256, 256, 8, info->battery);
cwrap = M191CW;
CHRRAMSize = 2048;
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSize);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
AddExState(CHRRAM, CHRRAMSize, 0, "CHRR");
CHRRAMSIZE = 2048;
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR");
}
// ---------------------------- Mapper 192 -------------------------------
@ -926,10 +929,10 @@ static void M192CW(uint32 A, uint8 V) {
void Mapper192_Init(CartInfo *info) {
GenMMC3_Init(info, 512, 256, 8, info->battery);
cwrap = M192CW;
CHRRAMSize = 4096;
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSize);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
AddExState(CHRRAM, CHRRAMSize, 0, "CHRR");
CHRRAMSIZE = 4096;
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR");
}
// ---------------------------- Mapper 194 -------------------------------
@ -944,16 +947,13 @@ static void M194CW(uint32 A, uint8 V) {
void Mapper194_Init(CartInfo *info) {
GenMMC3_Init(info, 512, 256, 8, info->battery);
cwrap = M194CW;
CHRRAMSize = 2048;
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSize);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
AddExState(CHRRAM, CHRRAMSize, 0, "CHRR");
CHRRAMSIZE = 2048;
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR");
}
// ---------------------------- Mapper 195 -------------------------------
static uint8 *wramtw;
static uint16 wramsize;
static void M195CW(uint32 A, uint8 V) {
if (V <= 3) // Crystalis (c).nes, Captain Tsubasa Vol 2 - Super Striker (C)
setchr1r(0x10, A, V);
@ -963,30 +963,19 @@ static void M195CW(uint32 A, uint8 V) {
static void M195Power(void) {
GenMMC3Power();
setprg4r(0x10, 0x5000, 0);
setprg4r(0x10, 0x5000, 2);
SetWriteHandler(0x5000, 0x5fff, CartBW);
SetReadHandler(0x5000, 0x5fff, CartBR);
}
static void M195Close(void) {
if (wramtw)
FCEU_gfree(wramtw);
wramtw = NULL;
}
void Mapper195_Init(CartInfo *info) {
GenMMC3_Init(info, 512, 256, 8, info->battery);
GenMMC3_Init(info, 512, 256, 16, info->battery);
cwrap = M195CW;
info->Power = M195Power;
info->Close = M195Close;
CHRRAMSize = 4096;
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSize);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
wramsize = 4096;
wramtw = (uint8*)FCEU_gmalloc(wramsize);
SetupCartPRGMapping(0x10, wramtw, wramsize, 1);
AddExState(CHRRAM, CHRRAMSize, 0, "CHRR");
AddExState(wramtw, wramsize, 0, "TRAM");
CHRRAMSIZE = 4096;
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR");
}
// ---------------------------- Mapper 196 -------------------------------
@ -1065,14 +1054,9 @@ static void M198PW(uint32 A, uint8 V) {
}
void Mapper198_Init(CartInfo *info) {
GenMMC3_Init(info, 1024, 256, 8, info->battery);
GenMMC3_Init(info, 1024, 0, 16, info->battery);
pwrap = M198PW;
info->Power = M195Power;
info->Close = M195Close;
wramsize = 4096;
wramtw = (uint8*)FCEU_gmalloc(wramsize);
SetupCartPRGMapping(0x10, wramtw, wramsize, 1);
AddExState(wramtw, wramsize, 0, "TRAM");
}
// ---------------------------- Mapper 205 ------------------------------
@ -1292,9 +1276,9 @@ void TKSROM_Init(CartInfo *info) {
void TQROM_Init(CartInfo *info) {
GenMMC3_Init(info, 512, 64, 0, 0);
cwrap = TQWRAP;
CHRRAMSize = 8192;
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSize);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
CHRRAMSIZE = 8192;
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
}
void HKROM_Init(CartInfo *info) {

View File

@ -28,7 +28,7 @@ static uint8 IRQx; //autoenable
static uint8 IRQm; //mode
static uint8 IRQa;
static uint16 IRQReload, IRQCount;
static uint8 *WRAM=NULL;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[] =

View File

@ -26,7 +26,9 @@
static uint8 is26;
static uint8 prg[2], chr[8], mirr;
static uint8 IRQLatch, IRQa, IRQd;
static uint32 IRQCount, CycleCount;
static int32 IRQCount, CycleCount;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[] =
{
@ -42,21 +44,23 @@ static SFORMAT StateRegs[] =
};
static void(*sfun[3]) (void);
static uint8 vpsg1[8];
static uint8 vpsg2[4];
static uint8 vpsg1[4];
static int32 cvbc[3];
static int32 vcount[3];
static int32 dcount[2];
static SFORMAT SStateRegs[] =
{
{ vpsg1, 4, "PSG1" },
{ vpsg1, 8, "PSG1" },
{ vpsg2, 4, "PSG2" },
{ 0 }
};
static void Sync(void) {
uint8 i;
if (is26)
setprg8r(0x10, 0x6000, 0);
setprg16(0x8000, prg[0]);
setprg8(0xc000, prg[1]);
setprg8(0xe000, ~0);
@ -103,14 +107,13 @@ static DECLFW(VRC6Write) {
case 0xE001: chr[5] = V; Sync(); break;
case 0xE002: chr[6] = V; Sync(); break;
case 0xE003: chr[7] = V; Sync(); break;
case 0xF000: IRQLatch = V; break;
case 0xF000: IRQLatch = V; X6502_IRQEnd(FCEU_IQEXT); break;
case 0xF001:
IRQa = V & 2;
IRQd = V & 1;
if (V & 2) {
if (V & 2)
IRQCount = IRQLatch;
CycleCount = 0;
}
CycleCount = 0;
X6502_IRQEnd(FCEU_IQEXT);
break;
case 0xF002:
@ -121,26 +124,32 @@ static DECLFW(VRC6Write) {
static void VRC6Power(void) {
Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW);
SetWriteHandler(0x8000, 0xFFFF, VRC6Write);
}
static void VRC6IRQHook(int a) {
if (IRQa) {
CycleCount += a * 3;
if (CycleCount >= 341) {
while(CycleCount >= 341) {
CycleCount -= 341;
IRQCount++;
if (IRQCount == 0x100) {
X6502_IRQBegin(FCEU_IQEXT);
IRQCount = IRQLatch;
}
while(CycleCount >= 341) {
CycleCount -= 341;
IRQCount++;
if (IRQCount == 0x100) {
IRQCount = IRQLatch;
X6502_IRQBegin(FCEU_IQEXT);
}
}
}
}
static void VRC6Close(void)
{
if (WRAM)
FCEU_gfree(WRAM);
WRAM = NULL;
}
static void StateRestore(int version) {
Sync();
}
@ -231,7 +240,7 @@ static void DoSawV(void) {
}
static INLINE void DoSQVHQ(int x) {
uint32 V;
int32 V;
int32 amp = ((vpsg1[x << 2] & 15) << 8) * 6 / 8;
if (vpsg1[(x << 2) | 0x2] & 0x80) {
@ -265,7 +274,7 @@ static void DoSQV2HQ(void) {
static void DoSawVHQ(void) {
static uint8 b3 = 0;
static int32 phaseacc = 0;
uint32 V;
int32 V;
if (vpsg2[2] & 0x80) {
for (V = cvbc[2]; V < SOUNDTS; V++) {
@ -345,9 +354,20 @@ void Mapper24_Init(CartInfo *info) {
void Mapper26_Init(CartInfo *info) {
is26 = 1;
info->Power = VRC6Power;
info->Close = VRC6Close;
MapIRQHook = VRC6IRQHook;
VRC6_ESI();
GameStateRestore = StateRestore;
WRAMSIZE = 8192;
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
if (info->battery) {
info->SaveGame[0] = WRAM;
info->SaveGameLen[0] = WRAMSIZE;
}
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@ -22,8 +22,8 @@
static uint8 vrc7idx, preg[3], creg[8], mirr;
static uint8 IRQLatch, IRQa, IRQd;
static uint32 IRQCount, CycleCount;
static uint8 *WRAM=NULL;
static int32 IRQCount, CycleCount;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[] =
@ -163,14 +163,12 @@ static void VRC7Close(void)
static void VRC7IRQHook(int a) {
if (IRQa) {
CycleCount += a * 3;
if (CycleCount >= 341) {
while(CycleCount >= 341) {
CycleCount -= 341;
IRQCount++;
if (IRQCount & 0x100) {
IRQCount = IRQLatch;
X6502_IRQBegin(FCEU_IQEXT);
}
while(CycleCount >= 341) {
CycleCount -= 341;
IRQCount++;
if (IRQCount == 0x100) {
IRQCount = IRQLatch;
X6502_IRQBegin(FCEU_IQEXT);
}
}
}

View File

@ -24,7 +24,7 @@
static uint8 prg[3], chr[8], mirr;
static uint8 IRQLatch, IRQa, IRQd;
static uint32 IRQCount, CycleCount;
static int32 IRQCount, CycleCount;
static SFORMAT StateRegs[] =
{
@ -69,10 +69,7 @@ static DECLFW(UNLVRC7Write) {
case 0xd000: chr[6] = V; Sync(); break;
case 0xd008: chr[7] = V; Sync(); break;
case 0xe000: mirr = V; Sync(); break;
case 0xe008:
IRQLatch = V;
X6502_IRQEnd(FCEU_IQEXT);
break;
case 0xe008: IRQLatch = V; X6502_IRQEnd(FCEU_IQEXT); break;
case 0xf000:
IRQa = V & 2;
IRQd = V & 1;
@ -104,8 +101,8 @@ static void UNLVRC7IRQHook(int a) {
CycleCount -= 341;
IRQCount++;
if (IRQCount == 248) {
X6502_IRQBegin(FCEU_IQEXT);
IRQCount = IRQLatch;
X6502_IRQBegin(FCEU_IQEXT);
}
}
}

View File

@ -86,8 +86,8 @@ struct CHEATF *cheats=0,*cheatsl=0;
#define CHEATC_EXCLUDED 0x4000
#define CHEATC_NOSHOW 0xC000
static uint16 *CheatComp=0;
static int savecheats;
static uint16 *CheatComp = 0;
int savecheats = 0;
static DECLFR(SubCheatsRead)
{
@ -213,7 +213,6 @@ void FCEU_LoadGameCheats(FILE *override)
}
FCEU_DispMessage("Cheats file loaded.",0); //Tells user a cheats file was loaded.
FCEU_printf("Cheats file loaded.\n",0); //Sends message to message log.
while(fgets(linebuf,2048,fp)>0)
{
char *tbuf=linebuf;

View File

@ -8,3 +8,5 @@ void FCEU_PowerCheats(void);
int FCEU_CheatGetByte(uint32 A);
void FCEU_CheatSetByte(uint32 A, uint8 V);
extern int savecheats;

View File

@ -413,7 +413,7 @@ void DrawTextTransWH(uint8 *dest, uint32 width, uint8 *textmsg, uint8 fgcolor, i
if (max_w > 256) max_w = 256;
if (max_h > 64) max_h = 64;
int ch, wid, nx, ny, max_x = x, offs;
int ch = 0, wid = 0, nx = 0, ny = 0, max_x = x, offs = 0;
int pixel_color;
for(; *textmsg; ++textmsg)
{

View File

@ -96,11 +96,11 @@ void FCEUI_SetRenderPlanes(bool sprites, bool bg);
void FCEUI_GetRenderPlanes(bool& sprites, bool& bg);
//name=path and file to load. returns null if it failed
FCEUGI *FCEUI_LoadGame(const char *name, int OverwriteVidMode);
FCEUGI *FCEUI_LoadGame(const char *name, int OverwriteVidMode, bool silent = false);
//same as FCEUI_LoadGame, except that it can load from a tempfile.
//name is the logical path to open; archiveFilename is the archive which contains name
FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode);
FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silent = false);
//general purpose emulator initialization. returns true if successful
bool FCEUI_Initialize();

View File

@ -96,6 +96,8 @@ bool frameAdvanceLagSkip = false; //If this is true, frame advance will skip ove
bool AutoSS = false; //Flagged true when the first auto-savestate is made while a game is loaded, flagged false on game close
bool movieSubtitles = true; //Toggle for displaying movie subtitles
bool DebuggerWasUpdated = false; //To prevent the debugger from updating things without being updated.
bool AutoResumePlay = false;
char rom_name_when_closing_emulator[129] = {0};
FCEUGI::FCEUGI()
: filename(0)
@ -137,13 +139,20 @@ void FCEU_TogglePPU(void) {
#endif
}
static void FCEU_CloseGame(void) {
if (GameInfo) {
#ifdef WIN32
//SP CODE
extern char LoadedRomFName[2048];
static void FCEU_CloseGame(void)
{
if (GameInfo)
{
if (AutoResumePlay && (GameInfo->type != GIT_NSF))
{
// save "-resume" savestate
FCEUSS_Save(FCEU_MakeFName(FCEUMKF_RESUMESTATE, 0, 0).c_str());
}
if (storePreferences(LoadedRomFName)) {
#ifdef WIN32
extern char LoadedRomFName[2048];
if (storePreferences(LoadedRomFName))
{
FCEUD_PrintError("Couldn't store debugging data");
}
#endif
@ -309,19 +318,16 @@ void SetWriteHandler(int32 start, int32 end, writefunc func) {
BWrite[x] = func;
}
uint8 *GameMemBlock;
uint8 *RAM;
//---------
//windows might need to allocate these differently, so we have some special code
static void AllocBuffers() {
GameMemBlock = (uint8*)FCEU_gmalloc(GAME_MEM_BLOCK_SIZE);
RAM = (uint8*)FCEU_gmalloc(0x800);
}
static void FreeBuffers() {
FCEU_free(GameMemBlock);
FCEU_free(RAM);
}
//------
@ -376,12 +382,8 @@ int NSFLoad(const char *name, FCEUFILE *fp);
//char lastLoadedGameName [2048] = {0,}; // hack for movie WRAM clearing on record from poweron
//name should be UTF-8, hopefully, or else there may be trouble
FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode) {
//mbg merge 7/17/07 - why is this here
//#ifdef WIN32
// StopSound();
//#endif
FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silent)
{
//----------
//attempt to open the files
FCEUFILE *fp;
@ -391,8 +393,10 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode) {
const char* romextensions[] = { "nes", "fds", 0 };
fp = FCEU_fopen(name, 0, "rb", 0, -1, romextensions);
if (!fp) {
FCEU_PrintError("Error opening \"%s\"!", name);
if (!fp)
{
if (!silent)
FCEU_PrintError("Error opening \"%s\"!", name);
return 0;
}
@ -441,7 +445,8 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode) {
if (FDSLoad(name, fp))
goto endlseq;
FCEU_PrintError("An error occurred while loading the file.");
if (!silent)
FCEU_PrintError("An error occurred while loading the file.");
FCEU_fclose(fp);
delete GameInfo;
@ -459,7 +464,8 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode) {
extern int loadDebugDataFailed;
if ((loadDebugDataFailed = loadPreferences(LoadedRomFName)))
FCEU_printf("Couldn't load debugging data.\n");
if (!silent)
FCEU_printf("Couldn't load debugging data.\n");
// ################################## End of SP CODE ###########################
#endif
@ -484,13 +490,23 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode) {
DoDebuggerDataReload(); // Reloads data without reopening window
#endif
if (AutoResumePlay && (GameInfo->type != GIT_NSF))
{
// load "-resume" savestate
if (FCEUSS_Load(FCEU_MakeFName(FCEUMKF_RESUMESTATE, 0, 0).c_str()))
FCEU_DispMessage("Old play session resumed.", 0);
else
FCEU_DispMessage("", 0);
}
ResetScreenshotsCounter();
return GameInfo;
}
FCEUGI *FCEUI_LoadGame(const char *name, int OverwriteVidMode) {
return FCEUI_LoadGameVirtual(name, OverwriteVidMode);
FCEUGI *FCEUI_LoadGame(const char *name, int OverwriteVidMode, bool silent)
{
return FCEUI_LoadGameVirtual(name, OverwriteVidMode, silent);
}
@ -661,6 +677,7 @@ void FCEUI_Emulate(uint8 **pXBuf, int32 **SoundBuf, int32 *SoundBufSize, int ski
Update_RAM_Search(); // Update_RAM_Watch() is also called.
RamChange();
//FCEUI_AviVideoUpdate(XBuf);
extern int KillFCEUXonFrame;
if (KillFCEUXonFrame && (FCEUMOV_GetFrame() >= KillFCEUXonFrame))
DoFCEUExit();

View File

@ -5,6 +5,9 @@ extern int fceuindbg;
extern int newppu;
void ResetGameLoaded(void);
extern bool AutoResumePlay;
extern char rom_name_when_closing_emulator[];
#define DECLFR(x) uint8 x (uint32 A)
#define DECLFW(x) void x (uint32 A, uint8 V)
@ -46,7 +49,6 @@ extern uint8 MMC5HackSPPage;
#define GAME_MEM_BLOCK_SIZE 131072
extern uint8 *RAM; //shared memory modifications
extern uint8 *GameMemBlock; //shared memory modifications
extern int EmulationPaused;
uint8 FCEU_ReadRomByte(uint32 i);

File diff suppressed because it is too large Load Diff

View File

@ -481,66 +481,90 @@ void FCEUI_SetDirOverride(int which, char *n)
std::string FCEU_GetPath(int type)
{
char ret[FILENAME_MAX];
switch(type)
switch (type)
{
case FCEUMKF_STATE:
{
if(odirs[FCEUIOD_STATES])
return (odirs[FCEUIOD_STATES]);
else
return BaseDirectory + PSS + "fcs";
break;
}
case FCEUMKF_CHEAT:
{
if(odirs[FCEUIOD_CHEATS])
return (odirs[FCEUIOD_CHEATS]);
else
return BaseDirectory + PSS + "cheats";
break;
}
case FCEUMKF_MOVIE:
{
if(odirs[FCEUIOD_MOVIES])
return (odirs[FCEUIOD_MOVIES]);
else
return BaseDirectory + PSS + "movies";
break;
}
case FCEUMKF_MEMW:
{
if(odirs[FCEUIOD_MEMW])
return (odirs[FCEUIOD_MEMW]);
else
return ""; //adelikat: 03/02/09 - return null so it defaults to last directory used
//return BaseDirectory + PSS + "tools";
break;
}
//adelikat: TODO: this no longer exist and could be removed (but that would require changing a lot of other directory arrays
case FCEUMKF_BBOT:
{
if(odirs[FCEUIOD_BBOT])
return (odirs[FCEUIOD_BBOT]);
else
return BaseDirectory + PSS + "tools";
break;
}
case FCEUMKF_ROMS:
{
if(odirs[FCEUIOD_ROMS])
return (odirs[FCEUIOD_ROMS]);
else
return ""; //adelikat: removing base directory return, should return null it goes to last used directory
break;
}
case FCEUMKF_INPUT:
{
if(odirs[FCEUIOD_INPUT])
return (odirs[FCEUIOD_INPUT]);
else
return BaseDirectory + PSS + "tools";
break;
}
case FCEUMKF_LUA:
{
if(odirs[FCEUIOD_LUA])
return (odirs[FCEUIOD_LUA]);
else
return ""; //adelikat: 03/02/09 - return null so it defaults to last directory used //return BaseDirectory + PSS + "tools";
break;
}
case FCEUMKF_AVI:
{
if(odirs[FCEUIOD_AVI])
return (odirs[FCEUIOD_AVI]);
else
return ""; //adelikat - 03/02/09 - if no override, should return null and allow the last directory to be used intead
//return BaseDirectory + PSS + "tools";
break;
}
case FCEUMKF_TASEDITOR:
{
return BaseDirectory + PSS + "tools";
break;
}
}
return ret;
return "";
}
std::string FCEU_MakePath(int type, const char* filebase)
@ -605,8 +629,7 @@ std::string FCEU_MakeFName(int type, int id1, const char *cd1)
if(odirs[FCEUIOD_STATES])
{
sprintf(ret,"%s"PSS"%s%s.fc%d",odirs[FCEUIOD_STATES],FileBase,mfn,id1);
}
else
} else
{
sprintf(ret,"%s"PSS"fcs"PSS"%s%s.fc%d",BaseDirectory.c_str(),FileBase,mfn,id1);
}
@ -615,14 +638,34 @@ std::string FCEU_MakeFName(int type, int id1, const char *cd1)
if(odirs[FCEUIOD_STATES])
{
sprintf(ret,"%s"PSS"%s%s.fc%d",odirs[FCEUIOD_STATES],FileBase,mfn,id1);
}
else
} else
{
sprintf(ret,"%s"PSS"fcs"PSS"%s%s.fc%d",BaseDirectory.c_str(),FileBase,mfn,id1);
}
}
}
break;
case FCEUMKF_RESUMESTATE:
{
if(odirs[FCEUIOD_STATES])
{
sprintf(ret,"%s"PSS"%s-resume.fcs",odirs[FCEUIOD_STATES],FileBase);
} else
{
sprintf(ret,"%s"PSS"fcs"PSS"%s-resume.fcs",BaseDirectory.c_str(),FileBase);
}
if(stat(ret,&tmpstat)==-1)
{
if(odirs[FCEUIOD_STATES])
{
sprintf(ret,"%s"PSS"%s-resume.fcs",odirs[FCEUIOD_STATES],FileBase);
} else
{
sprintf(ret,"%s"PSS"fcs"PSS"%s-resume.fcs",BaseDirectory.c_str(),FileBase);
}
}
}
break;
case FCEUMKF_SNAP:
if(odirs[FCEUIOD_SNAPS])
sprintf(ret,"%s"PSS"%s-%d.%s",odirs[FCEUIOD_SNAPS],FileBase,id1,cd1);
@ -650,12 +693,21 @@ std::string FCEU_MakeFName(int type, int id1, const char *cd1)
break;
case FCEUMKF_AUTOSTATE:
mfnString = GetMfn();
mfn = mfnString.c_str();
if (mfnString.length() <= MAX_MOVIEFILENAME_LEN)
{
mfn = mfnString.c_str();
} else
{
//This caps the movie filename length before adding it to the savestate filename.
//This helps prevent possible crashes from savestate filenames of excessive length.
mfnString = mfnString.substr(0, MAX_MOVIEFILENAME_LEN);
mfn = mfnString.c_str();
}
if(odirs[FCEUIOD_STATES])
{
sprintf(ret,"%s"PSS"%s%s-autosave%d.fcs",odirs[FCEUIOD_STATES],FileBase,mfn,id1);
}
else
} else
{
sprintf(ret,"%s"PSS"fcs"PSS"%s%s-autosave%d.fcs",BaseDirectory.c_str(),FileBase,mfn,id1);
}
@ -664,8 +716,7 @@ std::string FCEU_MakeFName(int type, int id1, const char *cd1)
if(odirs[FCEUIOD_STATES])
{
sprintf(ret,"%s"PSS"%s%s-autosave%d.fcs",odirs[FCEUIOD_STATES],FileBase,mfn,id1);
}
else
} else
{
sprintf(ret,"%s"PSS"fcs"PSS"%s%s-autosave%d.fcs",BaseDirectory.c_str(),FileBase,mfn,id1);
}

View File

@ -165,4 +165,5 @@ void FCEU_SplitArchiveFilename(std::string src, std::string& archive, std::strin
#define FCEUMKF_LUA 20
#define FCEUMKF_AVI 21
#define FCEUMKF_TASEDITOR 22
#define FCEUMKF_RESUMESTATE 23
#endif

View File

@ -5,6 +5,7 @@
{0x82f204ae, -1, 1}, /* Liang Shan Ying Xiong (NJ023) (Ch) [!] */
{0x684afccd, -1, 1}, /* Space Hunter (J) */
{0xad9c63e2, -1, 1}, /* Space Shadow (J) */
{0xe1526228, -1, 1}, /* Quest of Ki */
{0xaf5d7aa2, -1, 0}, /* Clu Clu Land */
{0xcfb224e6, -1, 1}, /* Dragon Ninja (J) [p1][!].nes */
{0x4f2f1846, -1, 1}, /* Famista '89 - Kaimaku Han!! (J) */

View File

@ -29,7 +29,6 @@
#include "cart.h"
#include "ppu.h"
#define INESPRIV
#include "ines.h"
#include "unif.h"
#include "state.h"
@ -49,6 +48,7 @@ extern SFORMAT FCEUVSUNI_STATEINFO[];
uint8 *trainerpoo = 0;
uint8 *ROM = NULL;
uint8 *VROM = NULL;
uint8 *ExtraNTARAM = NULL;
iNES_HEADER head;
#ifdef GEKKO
@ -108,7 +108,6 @@ void iNESGI(GI h) { //bbit edited: removed static keyword
#ifndef GEKKO
FCEU_SaveGameSave(&iNESCart);
#endif
if (iNESCart.Close)
iNESCart.Close();
if (ROM) {
@ -120,9 +119,13 @@ void iNESGI(GI h) { //bbit edited: removed static keyword
VROM = NULL;
}
if (trainerpoo) {
FCEU_gfree(trainerpoo);
free(trainerpoo);
trainerpoo = NULL;
}
if (ExtraNTARAM) {
free(ExtraNTARAM);
ExtraNTARAM = NULL;
}
}
break;
}
@ -439,7 +442,7 @@ typedef struct {
//size
static int not_power2[] =
{
228
198, 228
};
typedef struct {
char *name;
@ -454,19 +457,19 @@ static BMAPPINGLocal bmap[] = {
{"CNROM", 3, CNROM_Init},
{"MMC3", 4, Mapper4_Init},
{"MMC5", 5, Mapper5_Init},
{"FFE", 6, Mapper6_Init},
{"FFE Rev. A", 6, Mapper6_Init},
{"ANROM", 7, ANROM_Init},
{"", 8, Mapper8_Init}, // Nogaems, it's worthless
{"MMC2", 9, Mapper9_Init},
{"MMC4", 10, Mapper10_Init},
{"Color Dreams", 11, Mapper11_Init},
{"", 12, Mapper12_Init},
{"REX DBZ 5", 12, Mapper12_Init},
{"CPROM", 13, CPROM_Init},
// {"", 14, Mapper14_Init},
{"100-in-1", 15, Mapper15_Init},
{"Bandai", 16, Mapper16_Init},
{"", 17, Mapper17_Init},
{"", 18, Mapper18_Init},
{"FFE Rev. B", 17, Mapper17_Init},
{"JALECO SS880006", 18, Mapper18_Init}, // JF-NNX (EB89018-30007) boards
{"Namcot 106", 19, Mapper19_Init},
// {"", 20, Mapper20_Init},
{"Konami VRC2/VRC4 A", 21, Mapper21_Init},
@ -482,34 +485,34 @@ static BMAPPINGLocal bmap[] = {
// {"", 31, Mapper31_Init},
{"IREM G-101", 32, Mapper32_Init},
{"TC0190FMC/TC0350FMR", 33, Mapper33_Init},
{"", 34, Mapper34_Init},
{"IREM I-IM/BNROM", 34, Mapper34_Init},
{"Wario Land 2", 35, UNLSC127_Init},
{"TXC Policeman", 36, Mapper36_Init},
{"", 37, Mapper37_Init},
{"PAL-ZZ SMB/TETRIS/NWC",37, Mapper37_Init},
{"Bit Corp.", 38, Mapper38_Init}, // Crime Busters
// {"", 39, Mapper39_Init},
{"SMB2j FDS", 40, Mapper40_Init},
{"CALTRON 6-in-1", 41, Mapper41_Init},
{"BIO MIRACLE FDS", 42, Mapper42_Init},
{"", 43, Mapper43_Init},
{"", 44, Mapper44_Init},
{"", 45, Mapper45_Init},
{"FDS SMB2j LF36", 43, Mapper43_Init},
{"MMC3 BMC PIRATE A", 44, Mapper44_Init},
{"MMC3 BMC PIRATE B", 45, Mapper45_Init},
{"RUMBLESTATION 15-in-1",46, Mapper46_Init},
{"", 47, Mapper47_Init},
{"NES-QJ SSVB/NWC", 47, Mapper47_Init},
{"TAITO TCxxx", 48, Mapper48_Init},
{"", 49, Mapper49_Init},
{"SMB2j FDS REV A", 50, Mapper50_Init},
{"MMC3 BMC PIRATE C", 49, Mapper49_Init},
{"SMB2j FDS Rev. A", 50, Mapper50_Init},
{"11-in-1 BALL SERIES", 51, Mapper51_Init}, // 1993 year version
{"", 52, Mapper52_Init},
{"MMC3 BMC PIRATE D", 52, Mapper52_Init},
// {"", 53, Mapper53_Init}, // iNES version of complex UNIF board, can't emulate properly as iNES
// {"", 54, Mapper54_Init},
// {"", 55, Mapper55_Init},
// {"", 56, Mapper56_Init},
{"", 57, Mapper57_Init},
{"", 58, BMCGK192_Init},
{"SIMBPLE BMC PIRATE A", 57, Mapper57_Init},
{"SIMBPLE BMC PIRATE B", 58, BMCGK192_Init},
{"", 59, Mapper59_Init}, // Check this out
{"", 60, BMCD1038_Init},
{"20-in-1 KAISER REV A", 61, Mapper61_Init},
{"SIMBPLE BMC PIRATE C", 60, BMCD1038_Init},
{"20-in-1 KAISER Rev. A",61, Mapper61_Init},
{"700-in-1", 62, Mapper62_Init},
// {"", 63, Mapper63_Init},
{"TENGEN RAMBO1", 64, Mapper64_Init},
@ -522,77 +525,77 @@ static BMAPPINGLocal bmap[] = {
{"CAMERICA BF9093", 71, Mapper71_Init},
{"JALECO JF-17", 72, Mapper72_Init},
{"KONAMI VRC3", 73, Mapper73_Init},
{"TW MMC3+VRAM VER. A", 74, Mapper74_Init},
{"TW MMC3+VRAM Rev. A", 74, Mapper74_Init},
{"KONAMI VRC1", 75, Mapper75_Init},
{"NAMCOT 108 VER. A", 76, Mapper76_Init},
{"NAMCOT 108 Rev. A", 76, Mapper76_Init},
{"IREM LROG017", 77, Mapper77_Init},
{"Irem 74HC161/32", 78, Mapper78_Init},
{"AVE/C&E/TXC BOARD", 79, Mapper79_Init},
{"TAITO X1-005 VER. A", 80, Mapper80_Init},
{"TAITO X1-005 Rev. A", 80, Mapper80_Init},
// {"", 81, Mapper81_Init},
{"", 82, Mapper82_Init},
{"", 83, Mapper83_Init},
{"TAITO X1-017", 82, Mapper82_Init},
{"YOKO VRC Rev. B", 83, Mapper83_Init},
// {"", 84, Mapper84_Init},
{"KONAMI VRC7", 85, Mapper85_Init},
{"", 86, Mapper86_Init},
{"", 87, Mapper87_Init},
{"", 88, Mapper88_Init},
{"JALECO JF-13", 86, Mapper86_Init},
{"74*139/74 DISCRETE", 87, Mapper87_Init},
{"NAMCO 3433", 88, Mapper88_Init},
{"SUNSOFT-3", 89, Mapper89_Init}, // SUNSOFT-2 mapper
{"", 90, Mapper90_Init},
{"", 91, Mapper91_Init},
{"", 92, Mapper92_Init},
{"HUMMER/JY BOARD", 90, Mapper90_Init},
{"EARLY HUMMER/JY BOARD",91, Mapper91_Init},
{"JALECO JF-19", 92, Mapper92_Init},
{"SUNSOFT-3R", 93, SUNSOFT_UNROM_Init}, // SUNSOFT-2 mapper with VRAM, different wiring
{"", 94, Mapper94_Init},
{"NAMCOT 108 VER. B", 95, Mapper95_Init},
{"", 96, Mapper96_Init},
{"", 97, Mapper97_Init},
{"HVC-UN1ROM", 94, Mapper94_Init},
{"NAMCOT 108 Rev. B", 95, Mapper95_Init},
{"BANDAI OEKAKIDS", 96, Mapper96_Init},
{"IREM TAM-S1", 97, Mapper97_Init},
// {"", 98, Mapper98_Init},
{"", 99, Mapper99_Init},
{"VS Uni/Dual- system", 99, Mapper99_Init},
// {"", 100, Mapper100_Init},
{"", 101, Mapper101_Init},
// {"", 102, Mapper102_Init},
{"", 103, Mapper103_Init},
{"FDS DOKIDOKI FULL", 103, Mapper103_Init},
// {"", 104, Mapper104_Init},
{"", 105, Mapper105_Init},
{"", 106, Mapper106_Init},
{"", 107, Mapper107_Init},
{"", 108, Mapper108_Init},
{"NES-EVENT NWC1990", 105, Mapper105_Init},
{"SMB3 PIRATE A", 106, Mapper106_Init},
{"MAGIC CORP A", 107, Mapper107_Init},
{"FDS UNROM BOARD", 108, Mapper108_Init},
// {"", 109, Mapper109_Init},
// {"", 110, Mapper110_Init},
// {"", 111, Mapper111_Init},
{"", 112, Mapper112_Init},
{"", 113, Mapper113_Init},
{"", 114, Mapper114_Init},
{"", 115, Mapper115_Init},
{"", 116, UNLSL12_Init},
{"", 117, Mapper117_Init},
{"ASDER/NTDEC BOARD", 112, Mapper112_Init},
{"HACKER/SACHEN BOARD", 113, Mapper113_Init},
{"MMC3 SG PROT. A", 114, Mapper114_Init},
{"MMC3 PIRATE A", 115, Mapper115_Init},
{"MMC1/MMC3/VRC PIRATE",116, UNLSL12_Init},
{"FUTURE MEDIA BOARD", 117, Mapper117_Init},
{"TSKROM", 118, TKSROM_Init},
{"", 119, Mapper119_Init},
{"", 120, Mapper120_Init},
{"", 121, Mapper121_Init},
{"NES-TQROM", 119, Mapper119_Init},
{"FDS TOBIDASE", 120, Mapper120_Init},
{"MMC3 PIRATE PROT. A", 121, Mapper121_Init},
// {"", 122, Mapper122_Init},
{"UNLH2288", 123, UNLH2288_Init},
{"MMC3 PIRATE H2288", 123, UNLH2288_Init},
// {"", 124, Mapper124_Init},
{"", 125, LH32_Init},
{"FDS LH32", 125, LH32_Init},
// {"", 126, Mapper126_Init},
// {"", 127, Mapper127_Init},
// {"", 128, Mapper128_Init},
// {"", 129, Mapper129_Init},
// {"", 130, Mapper130_Init},
// {"", 131, Mapper131_Init},
{"UNL22211", 132, UNL22211_Init},
{"TXC/MGENIUS 22111", 132, UNL22211_Init},
{"SA72008", 133, SA72008_Init},
{"", 134, Mapper134_Init},
{"MMC3 BMC PIRATE", 134, Mapper134_Init},
// {"", 135, Mapper135_Init},
{"TCU02", 136, TCU02_Init},
{"S8259D", 137, S8259D_Init},
{"S8259B", 138, S8259B_Init},
{"S8259C", 139, S8259C_Init},
{"", 140, Mapper140_Init},
{"JALECO JF-11/14", 140, Mapper140_Init},
{"S8259A", 141, S8259A_Init},
{"UNLKS7032", 142, UNLKS7032_Init},
{"TCA01", 143, TCA01_Init},
{"", 144, Mapper144_Init},
{"AGCI 50282", 144, Mapper144_Init},
{"SA72007", 145, SA72007_Init},
{"SA0161M", 146, SA0161M_Init},
{"TCU01", 147, TCU01_Init},
@ -640,13 +643,13 @@ static BMAPPINGLocal bmap[] = {
{"", 189, Mapper189_Init},
// {"", 190, Mapper190_Init},
{"", 191, Mapper191_Init},
{"TW MMC3+VRAM VER. B", 192, Mapper192_Init},
{"TW MMC3+VRAM Rev. B", 192, Mapper192_Init},
{"NTDEC TC-112", 193, Mapper193_Init}, // War in the Gulf
{"TW MMC3+VRAM VER. C", 194, Mapper194_Init},
{"TW MMC3+VRAM VER. D", 195, Mapper195_Init},
{"TW MMC3+VRAM Rev. C", 194, Mapper194_Init},
{"TW MMC3+VRAM Rev. D", 195, Mapper195_Init},
{"", 196, Mapper196_Init},
{"", 197, Mapper197_Init},
{"", 198, Mapper198_Init},
{"TW MMC3+VRAM Rev. E", 198, Mapper198_Init},
{"", 199, Mapper199_Init},
{"", 200, Mapper200_Init},
{"", 201, Mapper201_Init},
@ -654,8 +657,8 @@ static BMAPPINGLocal bmap[] = {
{"", 203, Mapper203_Init},
{"", 204, Mapper204_Init},
{"", 205, Mapper205_Init},
{"NAMCOT 108 VER. C", 206, Mapper206_Init}, // Deprecated, Used to be "DEIROM" whatever it means, but actually simple version of MMC3
{"TAITO X1-005 VER. B", 207, Mapper207_Init},
{"NAMCOT 108 Rev. C", 206, Mapper206_Init}, // Deprecated, Used to be "DEIROM" whatever it means, but actually simple version of MMC3
{"TAITO X1-005 Rev. B", 207, Mapper207_Init},
{"", 208, Mapper208_Init},
{"", 209, Mapper209_Init},
{"", 210, Mapper210_Init},
@ -744,10 +747,13 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) {
}
}
if (head.ROM_type & 8) Mirroring = 2;
if (head.ROM_type & 8) {
Mirroring = 2;
}
if ((ROM = (uint8*)FCEU_malloc(ROM_size << 14)) == NULL)
return 0;
memset(ROM, 0xFF, ROM_size << 14);
if (VROM_size) {
if ((VROM = (uint8*)FCEU_malloc(VROM_size << 13)) == NULL) {
@ -755,9 +761,9 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) {
ROM = NULL;
return 0;
}
memset(VROM, 0xFF, VROM_size << 13);
}
memset(ROM, 0xFF, ROM_size << 14);
if (VROM_size) memset(VROM, 0xFF, VROM_size << 13);
if (head.ROM_type & 4) { /* Trainer */
trainerpoo = (uint8*)FCEU_gmalloc(512);
FCEU_fread(trainerpoo, 512, 1, fp);
@ -766,12 +772,12 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) {
ResetCartMapping();
ResetExState(0, 0);
SetupCartPRGMapping(0, ROM, ROM_size * 0x4000, 0);
SetupCartPRGMapping(0, ROM, ROM_size << 14, 0);
FCEU_fread(ROM, 0x4000, (round) ? ROM_size : head.ROM_size, fp);
if (VROM_size)
FCEU_fread(VROM, 0x2000, head.VROM_size, fp);
FCEU_fread(VROM, 0x2000, VROM_size, fp);
md5_starts(&md5);
md5_update(&md5, ROM, ROM_size << 14);
@ -831,9 +837,10 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) {
if (VROM_size)
SetupCartCHRMapping(0, VROM, VROM_size * 0x2000, 0);
if (Mirroring == 2)
if (Mirroring == 2) {
ExtraNTARAM = (uint8*)FCEU_gmalloc(2048);
SetupCartMirroring(4, 1, ExtraNTARAM);
else if (Mirroring >= 0x10)
} else if (Mirroring >= 0x10)
SetupCartMirroring(2 + (Mirroring & 1), 1, 0);
else
SetupCartMirroring(Mirroring & 1, (Mirroring & 4) >> 2, 0);

View File

@ -24,21 +24,6 @@
#include <stdlib.h>
#include <string.h>
#include <map>
#ifdef INESPRIV
/* This order is necessary */
#define WRAM (GameMemBlock)
#define sizeofWRAM 8192
/* for the MMC5 code to work properly. It might be fixed later... */
#define CHRRAM (GameMemBlock + sizeofWRAM)
#define sizeofCHRRAM 8192
#define ExtraNTARAM (GameMemBlock + sizeofWRAM + sizeofCHRRAM)
#define sizeofExtraNTARAM 2048
#else
#endif
struct TMasterRomInfo
{
@ -57,6 +42,7 @@ extern uint8 *ROM;
extern uint8 *VROM;
extern uint32 VROM_size;
extern uint32 ROM_size;
extern uint8 *ExtraNTARAM;
extern int iNesSave(); //bbit Edited: line added
extern int iNesSaveAs(char* name);
extern char LoadedRomFName[2048]; //bbit Edited: line added

View File

@ -1179,7 +1179,7 @@ void ToggleFullscreen()
changerecursive=1;
int oldmode = fullscreen;
if(!SetVideoMode(oldmode ^1))
if(!SetVideoMode(oldmode ^ 1))
SetVideoMode(oldmode);
changerecursive=0;
#endif

View File

@ -518,7 +518,7 @@ void FCEUSS_Save(const char *fname)
SaveStateStatus[CurrentState]=1;
FCEU_DispMessage("State %d saved.",0,CurrentState);
}
redoSS = false; //we have a new savestate so redo is not possible
redoSS = false; //we have a new savestate so redo is not possible
}
int FCEUSS_LoadFP_old(EMUFILE* is, ENUM_SSLOADPARAMS params)

View File

@ -41,7 +41,7 @@ extern int FDSLoad(const char *name, FCEUFILE *fp);
extern int iNESLoad(const char *name, FCEUFILE *fp, int o);
extern int UNIFLoad(const char *name, FCEUFILE *fp);
extern int NSFLoad(const char *name, FCEUFILE *fp);
extern uint8 FDSBIOS[8192];
extern uint8 *FDSBIOS;
extern uint8 *GENIEROM;
extern FCEUGI *GameInfo;
extern int CloseGame();