reaperman says chr ram isnt getting reset sometimes when the system gets power cycled. i can't reset it all the time since 100 mappers may maintain their own chr ram, but at least for boards that use the ines generic chr ram handling, i can reset it.
This commit is contained in:
parent
306b8a5278
commit
6632b06871
59
src/ines.cpp
59
src/ines.cpp
|
@ -63,6 +63,7 @@ uint32 ROM_size=0;
|
||||||
uint32 VROM_size=0;
|
uint32 VROM_size=0;
|
||||||
char LoadedRomFName[2048]; //mbg merge 7/17/06 added
|
char LoadedRomFName[2048]; //mbg merge 7/17/06 added
|
||||||
|
|
||||||
|
static int CHRRAMSize = -1;
|
||||||
static void iNESPower(void);
|
static void iNESPower(void);
|
||||||
static int NewiNES_Init(int num);
|
static int NewiNES_Init(int num);
|
||||||
|
|
||||||
|
@ -81,6 +82,28 @@ static DECLFR(TrainerRead)
|
||||||
return(trainerpoo[A&0x1FF]);
|
return(trainerpoo[A&0x1FF]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void iNES_ExecPower()
|
||||||
|
{
|
||||||
|
if(CHRRAMSize != -1)
|
||||||
|
FCEU_MemoryRand(VROM,CHRRAMSize);
|
||||||
|
|
||||||
|
if(iNESCart.Power)
|
||||||
|
iNESCart.Power();
|
||||||
|
|
||||||
|
if(trainerpoo)
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
for(x=0;x<512;x++)
|
||||||
|
{
|
||||||
|
X6502_DMW(0x7000+x,trainerpoo[x]);
|
||||||
|
if(X6502_DMR(0x7000+x)!=trainerpoo[x])
|
||||||
|
{
|
||||||
|
SetReadHandler(0x7000,0x71FF,TrainerRead);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void iNESGI(GI h) //bbit edited: removed static keyword
|
void iNESGI(GI h) //bbit edited: removed static keyword
|
||||||
{
|
{
|
||||||
|
@ -97,21 +120,8 @@ void iNESGI(GI h) //bbit edited: removed static keyword
|
||||||
iNESCart.Reset();
|
iNESCart.Reset();
|
||||||
break;
|
break;
|
||||||
case GI_POWER:
|
case GI_POWER:
|
||||||
if(iNESCart.Power)
|
iNES_ExecPower();
|
||||||
iNESCart.Power();
|
|
||||||
if(trainerpoo)
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
for(x=0;x<512;x++)
|
|
||||||
{
|
|
||||||
X6502_DMW(0x7000+x,trainerpoo[x]);
|
|
||||||
if(X6502_DMR(0x7000+x)!=trainerpoo[x])
|
|
||||||
{
|
|
||||||
SetReadHandler(0x7000,0x71FF,TrainerRead);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case GI_CLOSE:
|
case GI_CLOSE:
|
||||||
{
|
{
|
||||||
|
@ -1306,12 +1316,12 @@ void iNESStateRestore(int version)
|
||||||
|
|
||||||
if(0) switch(Mirroring)
|
if(0) switch(Mirroring)
|
||||||
{
|
{
|
||||||
case 0:setmirror(MI_H);break;
|
case 0:setmirror(MI_H);break;
|
||||||
case 1:setmirror(MI_V);break;
|
case 1:setmirror(MI_V);break;
|
||||||
case 0x12:
|
case 0x12:
|
||||||
case 0x10:setmirror(MI_0);break;
|
case 0x10:setmirror(MI_0);break;
|
||||||
case 0x13:
|
case 0x13:
|
||||||
case 0x11:setmirror(MI_1);break;
|
case 0x11:setmirror(MI_1);break;
|
||||||
}
|
}
|
||||||
if(MapStateRestore) MapStateRestore(version);
|
if(MapStateRestore) MapStateRestore(version);
|
||||||
}
|
}
|
||||||
|
@ -1337,9 +1347,9 @@ static void iNESPower(void)
|
||||||
all of the iNES mapper code... */
|
all of the iNES mapper code... */
|
||||||
IRQCount=IRQLatch=IRQa=0;
|
IRQCount=IRQLatch=IRQa=0;
|
||||||
if(head.ROM_type&2)
|
if(head.ROM_type&2)
|
||||||
memset(GameMemBlock+8192,0,GAME_MEM_BLOCK_SIZE-8192);
|
memset(GameMemBlock+8192,0,GAME_MEM_BLOCK_SIZE-8192);
|
||||||
else
|
else
|
||||||
memset(GameMemBlock,0,GAME_MEM_BLOCK_SIZE);
|
memset(GameMemBlock,0,GAME_MEM_BLOCK_SIZE);
|
||||||
|
|
||||||
NONE_init();
|
NONE_init();
|
||||||
ResetExState(0,0);
|
ResetExState(0,0);
|
||||||
|
@ -1384,6 +1394,8 @@ static int NewiNES_Init(int num)
|
||||||
{
|
{
|
||||||
BMAPPINGLocal *tmp=bmap;
|
BMAPPINGLocal *tmp=bmap;
|
||||||
|
|
||||||
|
CHRRAMSize = -1;
|
||||||
|
|
||||||
if(GameInfo->type == GIT_VSUNI)
|
if(GameInfo->type == GIT_VSUNI)
|
||||||
AddExState(FCEUVSUNI_STATEINFO, ~0, 0, 0);
|
AddExState(FCEUVSUNI_STATEINFO, ~0, 0, 0);
|
||||||
|
|
||||||
|
@ -1394,7 +1406,6 @@ static int NewiNES_Init(int num)
|
||||||
UNIFchrrama=0; // need here for compatibility with UNIF mapper code
|
UNIFchrrama=0; // need here for compatibility with UNIF mapper code
|
||||||
if(!VROM_size)
|
if(!VROM_size)
|
||||||
{
|
{
|
||||||
int CHRRAMSize;
|
|
||||||
if(num==13)
|
if(num==13)
|
||||||
{
|
{
|
||||||
CHRRAMSize=16384;
|
CHRRAMSize=16384;
|
||||||
|
|
Loading…
Reference in New Issue