cleanup and version bum... hmmm (not no mention something else)

This commit is contained in:
CaH4e3 2012-10-21 16:40:04 +00:00
parent 3bab128770
commit 43ee931dec
100 changed files with 1002 additions and 908 deletions

View File

@ -15,7 +15,7 @@ int Assemble(unsigned char *output, int addr, char *str) {
//unsigned char opcode[3] = { 0,0,0 };
output[0] = output[1] = output[2] = 0;
char astr[128],ins[4];
int len = strlen(str);
int len = strlen(str);
if ((!len) || (len > 0x127)) return 1;
strcpy(astr,str);
@ -40,7 +40,7 @@ int Assemble(unsigned char *output, int addr, char *str) {
// 1) Sets opcode[0] on success, else returns 1.
// 2) Parses text in *astr to build the rest of the assembled
// data in 'opcode', else returns 1 on error.
if (!strlen(astr)) {
//Implied instructions
if (!strcmp(ins,"BRK")) output[0] = 0x00;
@ -517,6 +517,6 @@ char *Disassemble(int addr, uint8 *opcode) {
default: strcpy(str,"ERROR"); break;
}
return str;
}

View File

@ -86,7 +86,7 @@ void UNL22211_Init(CartInfo *info)
void Mapper172_Init(CartInfo *info)
{
is172=1;
is172=1;
is173=0;
info->Power=UNL22211Power;
GameStateRestore=StateRestore;
@ -95,7 +95,7 @@ void Mapper172_Init(CartInfo *info)
void Mapper173_Init(CartInfo *info)
{
is172=0;
is172=0;
is173=1;
info->Power=UNL22211Power;
GameStateRestore=StateRestore;

View File

@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*
* SL12 Protected 3-in-1 mapper hardware (VRC2, MMC3, MMC1)
* the same as 603-5052 board (TODO: add reading registers, merge)
* SL1632 2-in-1 protected board, similar to SL12 (TODO: find difference)
@ -272,7 +272,7 @@ static DECLFW(UNLSL12Write)
mmc1_buffer = mmc1_shift = 0;
switch(n) {
case 0: SyncMIR();
case 2: SyncCHR();
case 2: SyncCHR();
case 3:
case 1: SyncPRG();
}

View File

@ -37,13 +37,13 @@ static SFORMAT StateRegs[]=
static void Sync(void)
{
int i;
setprg8(0x8000,prgreg[0]);
setprg8(0xa000,prgreg[1]);
setprg8(0xc000,prgreg[2]);
setprg8(0x8000,prgreg[0]);
setprg8(0xa000,prgreg[1]);
setprg8(0xc000,prgreg[2]);
setprg8(0xe000,prgreg[3]);
for(i=0; i<8; i++)
setchr1(i<<10,chrreg[i]);
setmirror(mirror^1);
setchr1(i<<10,chrreg[i]);
setmirror(mirror^1);
}
static DECLFW(M117Write)
@ -52,7 +52,7 @@ static DECLFW(M117Write)
{
prgreg[A&3]=V;
Sync();
}
}
else if((A>=0xA000)&&(A<=0xA007))
{
chrreg[A&7]=V;

View File

@ -37,7 +37,7 @@ static void Sync()
case 0x26: EXPREGS[7] = 0; EXPREGS[0]=EXPREGS[6]; break;
case 0x2B: EXPREGS[7] = 1; EXPREGS[0]=EXPREGS[6]; break;
case 0x2C: EXPREGS[7] = 1; if(EXPREGS[6]) EXPREGS[0]=EXPREGS[6]; break;
case 0x3C:
case 0x3C:
case 0x3F: EXPREGS[7] = 1; EXPREGS[0]=EXPREGS[6]; break;
case 0x28: EXPREGS[7] = 0; EXPREGS[1]=EXPREGS[6]; break;
case 0x2A: EXPREGS[7] = 0; EXPREGS[2]=EXPREGS[6]; break;

View File

@ -16,145 +16,236 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Actually, all this may be the same mapper with different switcheable banking modes, maybe it's just an subtypes
* of the same one board with various modes locked just like SuperGame boards, based on 215 mapper
*
*/
#include "mapinc.h"
static uint8 cmd, laststrobe, trigger;
static uint8 DRegs[8];
static uint8 laststrobe, trigger;
static uint8 reg[8];
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static void(*WSync)(void);
static SFORMAT StateRegs[]=
{
{&cmd, 1, "CMD"},
{&laststrobe, 1, "STB"},
{&trigger, 1, "TRG"},
{DRegs, 8, "DREG"},
{0}
{&laststrobe, 1, "STB"},
{&trigger, 1, "TRG"},
{reg, 8, "REGS"},
{0}
};
static void Sync(void)
{
setprg32(0x8000,(DRegs[0]<<4)|(DRegs[1]&0xF));
setprg8r(0x10,0x6000,0);
setprg32(0x8000,(reg[0]<<4)|(reg[1]&0xF));
setchr8(0);
}
static void StateRestore(int version)
{
Sync();
WSync();
}
static DECLFR(ReadLow)
{
switch (A&0x7700)
{
case 0x5100: return DRegs[2]; break;
case 0x5500: if(trigger)
return DRegs[2];
else
return 0;
}
return 4;
}
static DECLFW(Write)
{
switch (A&0x7300)
{
case 0x5100: DRegs[0]=V; Sync(); break;
case 0x5000: DRegs[1]=V; Sync(); break;
case 0x5300: DRegs[2]=V; break;
}
}
static DECLFW(Write2)
{
if(A==0x5101)
{
if(laststrobe&&!V)
{
trigger^=1;
}
laststrobe=V;
}else if(A==0x5100&&V==6) //damn thoose protected games
setprg32(0x8000,3);
else
switch (A&0x7300)
{
case 0x5200: DRegs[0]=V; Sync(); break;
case 0x5000: DRegs[1]=V; Sync(); if(!(DRegs[1]&0x80)&&(scanline<128)) setchr8(0); break;
case 0x5300: DRegs[2]=V; break;
}
}
static uint8 WRAM[8192];
static DECLFR(AWRAM)
{
return(WRAM[A-0x6000]);
}
static DECLFW(BWRAM)
{
WRAM[A-0x6000]=V;
}
static void Power(void)
{
memset(DRegs,0,8);
DRegs[1]=0xFF;
cmd=0;
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4020,0x5FFF,Write);
SetReadHandler(0x6000,0x7FFF,AWRAM);
SetWriteHandler(0x6000,0x7FFF,BWRAM);
setchr8(0);
Sync();
switch (A&0x7700)
{
case 0x5100:
return reg[2]|reg[0]|reg[1]|reg[3]^0xff; break;
case 0x5500:
if(trigger)
return reg[2]|reg[1]; // Lei Dian Huang Bi Ka Qiu Chuan Shuo (NJ046) may broke other games
else
return 0;
}
return 4;
}
static void M163HB(void)
{
if(DRegs[1]&0x80)
{
if(scanline==239)
{
setchr4(0x0000,0);
setchr4(0x1000,0);
}
else if(scanline==127)
{
setchr4(0x0000,1);
setchr4(0x1000,1);
}
}
if(reg[1]&0x80)
{
if(scanline==239)
{
setchr4(0x0000,0);
setchr4(0x1000,0);
}
else if(scanline==127)
{
setchr4(0x0000,1);
setchr4(0x1000,1);
}
/*
if(scanline>=127) // Hu Lu Jin Gang (NJ039) (Ch) [!] don't like it
{
setchr4(0x0000,1);
setchr4(0x1000,1);
}
else
{
setchr4(0x0000,0);
setchr4(0x1000,0);
}
*/
}
}
static void Power2(void)
static DECLFW(Write)
{
memset(DRegs,0,8);
DRegs[1]=0xFF;
laststrobe=1;
cmd=0;
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4020,0x5FFF,Write2);
SetReadHandler(0x6000,0x7FFF,AWRAM);
SetWriteHandler(0x6000,0x7FFF,BWRAM);
SetReadHandler(0x5000,0x5FFF,ReadLow);
setchr8(0);
Sync();
switch (A&0x7300)
{
case 0x5100: reg[0]=V; WSync(); break;
case 0x5000: reg[1]=V; WSync(); break;
case 0x5300: reg[2]=V; break;
case 0x5200: reg[3]=V; WSync(); break;
}
}
static void Power(void)
{
memset(reg,0,8);
reg[1]=0xFF;
SetWriteHandler(0x5000,0x5FFF,Write);
SetReadHandler(0x6000,0xFFFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
WSync();
}
static void Close(void)
{
if(WRAM)
FCEU_gfree(WRAM);
WRAM=NULL;
}
void Mapper164_Init(CartInfo *info)
{
info->Power=Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
AddExState(WRAM, 8192, 0, "WRAM");
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=8192;
info->Power=Power;
info->Close=Close;
WSync = Sync;
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;
}
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
static DECLFW(Write2)
{
if(A==0x5101)
{
if(laststrobe&&!V)
trigger^=1;
laststrobe=V;
}else if(A==0x5100&&V==6) //damn thoose protected games
setprg32(0x8000,3);
else
switch (A&0x7300)
{
case 0x5200: reg[0]=V; WSync(); break;
case 0x5000: reg[1]=V; WSync(); if(!(reg[1]&0x80)&&(scanline<128)) setchr8(0); /* setchr8(0); */ break;
case 0x5300: reg[2]=V; break;
case 0x5100: reg[3]=V; WSync(); break;
}
}
static void Power2(void)
{
memset(reg,0,8);
laststrobe=1;
SetReadHandler(0x5000,0x5FFF,ReadLow);
SetWriteHandler(0x5000,0x5FFF,Write2);
SetReadHandler(0x6000,0xFFFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
WSync();
}
void Mapper163_Init(CartInfo *info)
{
info->Power=Power2;
GameHBIRQHook=M163HB;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
AddExState(WRAM, 8192, 0, "WRAM");
info->Power=Power2;
info->Close=Close;
WSync = Sync;
GameHBIRQHook=M163HB;
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;
}
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
static void Sync3(void)
{
setchr8(0);
setprg8r(0x10,0x6000,0);
switch(reg[3]&7){
case 0:
case 2: setprg32(0x8000,(reg[0]&0xc)|(reg[1]&2)|((reg[2]&0xf)<<4)); break;
case 1:
case 3: setprg32(0x8000,(reg[0]&0xc)|(reg[2]&0xf)<<4); break;
case 4:
case 6: setprg32(0x8000,(reg[0]&0xe)|((reg[1]>>1)&1)|((reg[2]&0xf)<<4)); break;
case 5:
case 7: setprg32(0x8000,(reg[0]&0xf)|((reg[2]&0xf)<<4)); break;
}
}
static DECLFW(Write3)
{
reg[(A>>8)&3]=V;
WSync();
}
static void Power3(void)
{
reg[0]=3;
reg[1]=0;
reg[2]=0;
reg[3]=7;
SetWriteHandler(0x5000,0x5FFF,Write3);
SetReadHandler(0x6000,0xFFFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
WSync();
}
void UNLFS304_Init(CartInfo *info)
{
info->Power=Power3;
info->Close=Close;
WSync = Sync3;
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;
}
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@ -71,7 +71,7 @@ static void M175Power(void)
SetReadHandler(0x8000,0xFFFF,M175Read);
SetWriteHandler(0x8000,0x8000,M175Write1);
SetWriteHandler(0xA000,0xA000,M175Write2);
Sync();
Sync();
}
static void StateRestore(int version)

View File

@ -47,7 +47,7 @@ static void Sync(void)
}
static DECLFW(M176Write_5001)
{
{
printf("%04X = $%02X\n",A,V);
if(sbw)
{
@ -60,14 +60,14 @@ static DECLFW(M176Write_5001)
}
static DECLFW(M176Write_5010)
{
{
printf("%04X = $%02X\n",A,V);
if(V == 0x24) sbw = 1;
Sync();
}
static DECLFW(M176Write_5011)
{
{
printf("%04X = $%02X\n",A,V);
V >>= 1;
if(sbw)
@ -81,7 +81,7 @@ static DECLFW(M176Write_5011)
}
static DECLFW(M176Write_5FF1)
{
{
printf("%04X = $%02X\n",A,V);
V >>= 1;
prg[0] = V*4;
@ -92,7 +92,7 @@ static DECLFW(M176Write_5FF1)
}
static DECLFW(M176Write_5FF2)
{
{
printf("%04X = $%02X\n",A,V);
chr = V;
Sync();
@ -120,7 +120,7 @@ static void M176Power(void)
SetWriteHandler(0x5011,0x5011,M176Write_5011);
SetWriteHandler(0x5ff1,0x5ff1,M176Write_5FF1);
SetWriteHandler(0x5ff2,0x5ff2,M176Write_5FF2);
we_sram = 0;
sbw = 0;
prg[0] = 0;

View File

@ -48,7 +48,7 @@ static DECLFW(M177Write)
static void M177Power(void)
{
reg=0;
Sync();
Sync();
SetReadHandler(0x6000,0x7fff,CartBR);
SetWriteHandler(0x6000,0x7fff,CartBW);
SetReadHandler(0x8000,0xFFFF,CartBR);

View File

@ -54,7 +54,7 @@ static DECLFW(M179WriteLo)
static void M179Power(void)
{
reg[0]=reg[1]=0;
Sync();
Sync();
SetWriteHandler(0x4020,0x5fff,M179WriteLo);
SetReadHandler(0x6000,0x7fff,CartBR);
SetWriteHandler(0x6000,0x7fff,CartBW);

View File

@ -32,7 +32,7 @@ static SFORMAT StateRegs[]=
{0}
};
// on off
// on off
//1 0x0F, 0xF0 - Bird Week
//2 0x33, 0x00 - B-Wings
//3 0x11, 0x00 - Mighty Bomb Jack

View File

@ -65,7 +65,7 @@ static DECLFW(M199Write)
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
else
else
if(A<0xC000)
MMC3_CMDWrite(A,V);
else

View File

@ -45,7 +45,7 @@ static void M222IRQ(void)
if(IRQCount>=238)
{
X6502_IRQBegin(FCEU_IQEXT);
// IRQa=0;
// IRQa=0;
}
}
}
@ -75,11 +75,11 @@ static DECLFW(M222Write)
case 0xD002: chr_reg[5]=V; break;
case 0xE000: chr_reg[6]=V; break;
case 0xE002: chr_reg[7]=V; break;
// case 0xF000: FCEU_printf("%04x:%02x %d\n",A,V,scanline); IRQa=V; if(!V)IRQPre=0; X6502_IRQEnd(FCEU_IQEXT); break;
// / case 0xF001: FCEU_printf("%04x:%02x %d\n",A,V,scanline); IRQCount=V; break;
// case 0xF002: FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
// case 0xD001: IRQa=V; X6502_IRQEnd(FCEU_IQEXT); FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
// case 0xC001: IRQPre=16; FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
// case 0xF000: FCEU_printf("%04x:%02x %d\n",A,V,scanline); IRQa=V; if(!V)IRQPre=0; X6502_IRQEnd(FCEU_IQEXT); break;
// / case 0xF001: FCEU_printf("%04x:%02x %d\n",A,V,scanline); IRQCount=V; break;
// case 0xF002: FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
// case 0xD001: IRQa=V; X6502_IRQEnd(FCEU_IQEXT); FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
// case 0xC001: IRQPre=16; FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
case 0xF000: IRQa=IRQCount=V; if(scanline<240) IRQCount-=8; else IRQCount+=4; X6502_IRQEnd(FCEU_IQEXT); break;
}
Sync();

View File

@ -87,7 +87,7 @@ static DECLFW(M23Write)
if(UNIFchrrama)
big_bank=(V&8)<<2; // my personally many-in-one feature ;) just for support pirate cart 2-in-1
else
{
{
uint16 i=((A>>1)&1)|((A-0xB000)>>11);
chrreg[i]&=(0xF0)>>((A&1)<<2);
chrreg[i]|=(V&0xF)<<((A&1)<<2);
@ -97,18 +97,18 @@ static DECLFW(M23Write)
else
switch(A&0xF003)
{
case 0x8000:
case 0x8001:
case 0x8002:
case 0x8003: if(is23)
prgreg[0]=V&0x1F;
Sync();
case 0x8000:
case 0x8001:
case 0x8002:
case 0x8003: if(is23)
prgreg[0]=V&0x1F;
Sync();
break;
case 0xA000:
case 0xA001:
case 0xA002:
case 0xA003: if(is23)
prgreg[1]=V&0x1F;
case 0xA000:
case 0xA001:
case 0xA002:
case 0xA003: if(is23)
prgreg[1]=V&0x1F;
else
{
prgreg[0]=(V<<1)&0x1F;
@ -118,7 +118,7 @@ static DECLFW(M23Write)
break;
case 0x9000:
case 0x9001: if(V!=0xFF) mirr=V; Sync(); break;
case 0x9002:
case 0x9002:
case 0x9003: regcmd=V; Sync(); break;
case 0xF000: X6502_IRQEnd(FCEU_IQEXT); IRQLatch&=0xF0; IRQLatch|=V&0xF; break;
case 0xF001: X6502_IRQEnd(FCEU_IQEXT); IRQLatch&=0x0F; IRQLatch|=V<<4; break;
@ -129,7 +129,7 @@ static DECLFW(M23Write)
static void M23Power(void)
{
big_bank=0x20;
big_bank=0x20;
Sync();
setprg8r(0x10,0x6000,0); // another many-in-one code, WRAM actually contain only WaiWaiWorld game
SetReadHandler(0x6000,0x7FFF,CartBR);
@ -154,7 +154,7 @@ void M23IRQHook(int a)
{
acount-=LCYCS;
IRQCount++;
if(IRQCount&0x100)
if(IRQCount&0x100)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQCount=IRQLatch;

View File

@ -21,7 +21,7 @@
#include "mapinc.h"
static uint8 chrlo[8], chrhi[8], prg[2], mirr, vlock;
static int32 IRQa, IRQCount, IRQLatch, IRQClock;
static int32 IRQa, IRQCount, IRQLatch, IRQClock;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static uint8 *CHRRAM=NULL;
@ -127,18 +127,18 @@ static void M253Close(void)
static void M253IRQ(int cycles)
{
if(IRQa&2)
if(IRQa&2)
{
if((IRQClock+=cycles)>=0x72)
if((IRQClock+=cycles)>=0x72)
{
IRQClock -= 0x72;
if(IRQCount==0xFF)
if(IRQCount==0xFF)
{
IRQCount = IRQLatch;
IRQa = IRQa|((IRQa&1)<<1);
X6502_IRQBegin(FCEU_IQEXT);
}
else
else
IRQCount++;
}
}

View File

@ -54,7 +54,7 @@ static DECLFW(UNL3DBlockWrite)
case 0x4900: reg[1]=V; break;
case 0x4a00: reg[2]=V; break;
case 0x4e00: reg[3]=V; IRQCount=Count; IRQPause=Pause; IRQa=1; X6502_IRQEnd(FCEU_IQEXT); break;
}
}
}
static void UNL3DBlockPower(void)
@ -87,7 +87,7 @@ static void UNL3DBlockIRQHook(int a)
}
else
{
IRQCount=Count;
IRQCount=Count;
IRQPause=Pause;
X6502_IRQEnd(FCEU_IQEXT);
}

View File

@ -36,7 +36,7 @@ static SFORMAT StateRegs[]=
static void Sync(void)
{
setprg4(0x5000,16);
setprg4(0x5000,16);
setprg8(0x6000,2);
setprg8(0x8000,1);
setprg8(0xa000,0);

View File

@ -25,7 +25,7 @@ static uint8 lut[4] = { 0x00, 0x02, 0x02, 0x03 };
static DECLFW(UNL6035052ProtWrite)
{
EXPREGS[0]=lut[V&3];
EXPREGS[0]=lut[V&3];
}
static DECLFR(UNL6035052ProtRead)

View File

@ -92,7 +92,7 @@ static DECLFR(M68Read)
static DECLFW(M68WriteLo)
{
if(!V)
{
{
count = 0;
setprg16r((PRGptr[1])?kogame:0,0x8000,prg_reg);
}
@ -106,13 +106,13 @@ static DECLFW(M68WriteCHR)
static DECLFW(M68WriteNT1)
{
nt1 = V;
nt1 = V;
M68NTfix();
}
static DECLFW(M68WriteNT2)
{
nt2 = V;
nt2 = V;
M68NTfix();
}

View File

@ -24,7 +24,7 @@ static uint16 cmdreg;
static uint8 invalid_data;
static SFORMAT StateRegs[]=
{
{&invalid_data, 1, "INVD"},
{&invalid_data, 1, "INVD"},
{&cmdreg, 2, "CMDREG"},
{0}
};

View File

@ -27,7 +27,7 @@
static uint8 cmdin;
static uint8 regperm[8][8] =
static uint8 regperm[8][8] =
{
{0, 1, 2, 3, 4, 5, 6, 7},
{0, 2, 6, 1, 7, 3, 4, 5},
@ -39,7 +39,7 @@ static uint8 regperm[8][8] =
{0, 1, 2, 3, 4, 5, 6, 7}, // empty
};
static uint8 adrperm[8][8] =
static uint8 adrperm[8][8] =
{
{0, 1, 2, 3, 4, 5, 6, 7},
{3, 2, 0, 4, 1, 5, 6, 7},
@ -151,7 +151,7 @@ static DECLFW(UNL8237Write)
dat = (dat & 0xC0)|(regperm[EXPREGS[2]][dat & 7]);
MMC3_CMDWrite(addr,dat);
}
else
else
MMC3_IRQWrite(addr,dat);
}

View File

@ -32,8 +32,8 @@ static void BMC830118CCW(uint32 A, uint8 V)
static void BMC830118CPW(uint32 A, uint8 V)
{
if((EXPREGS[0]&0x0C)==0x0C)
{
if((EXPREGS[0]&0x0C)==0x0C)
{
if(A==0x8000)
{
setprg8(A,(V&0x0F)|((EXPREGS[0]&0x0c)<<2));

View File

@ -72,7 +72,7 @@ static void StateRestore(int version)
void Mapper88_Init(CartInfo *info)
{
is154=0;
is154=0;
info->Power=M88Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);

View File

@ -26,7 +26,7 @@
// Mapper 209 much compicated hardware with decribed above features disabled by default and switchable by command
// Mapper 211 the same mapper 209 but with forced nametable control
static int is209;
static int is209;
static int is211;
static uint8 IRQMode; // from $c001
@ -287,7 +287,7 @@ static DECLFW(M90ModeWrite)
tekprom();
tekvrom();
mira();
#ifdef DEBUG90
switch (A&3)
{
@ -390,7 +390,7 @@ static void M90PPU(uint32 A)
}
lastread=A;
}
if(is209)
{
uint8 l,h;

View File

@ -44,7 +44,7 @@ static DECLFW(MNNNWrite)
static void MNNNPower(void)
{
// SetReadHandler(0x6000,0x7fff,CartBR);
// SetReadHandler(0x6000,0x7fff,CartBR);
// SetWriteHandler(0x6000,0x7fff,CartBW);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,MNNNWrite);
@ -79,7 +79,7 @@ void MapperNNN_Init(CartInfo *info)
{
info->Reset=MNNNReset;
info->Power=MNNNPower;
// info->Close=MNNNClose;
// info->Close=MNNNClose;
GameHBIRQHook=MNNNIRQHook;
GameStateRestore=StateRestore;
/*

View File

@ -31,14 +31,14 @@ static void UNLA9711PW(uint32 A, uint8 V)
setprg8(0xA000, 0x13);
setprg8(0xC000, 0x13);
setprg8(0xE000, 0x0);
// uint8 bank=EXPREGS[0]&0x1F;
// if(EXPREGS[0]&0x20)
// setprg32(0x8000,bank>>2);
// else
// {
// setprg16(0x8000,bank);
// setprg16(0xC000,bank);
// }
// uint8 bank=EXPREGS[0]&0x1F;
// if(EXPREGS[0]&0x20)
// setprg32(0x8000,bank>>2);
// else
// {
// setprg16(0x8000,bank);
// setprg16(0xC000,bank);
// }
}
else
setprg8(A,V&0x3F);
@ -46,12 +46,12 @@ static void UNLA9711PW(uint32 A, uint8 V)
//static DECLFW(UNLA9711Write8000)
//{
// FCEU_printf("bs %04x %02x\n",A,V);
// if(V&0x80)
// MMC3_CMDWrite(A,V);
// else
// MMC3_CMDWrite(A,m_perm[V&7]);
// if(V!=0x86) MMC3_CMDWrite(A,V);
// FCEU_printf("bs %04x %02x\n",A,V);
// if(V&0x80)
// MMC3_CMDWrite(A,V);
// else
// MMC3_CMDWrite(A,m_perm[V&7]);
// if(V!=0x86) MMC3_CMDWrite(A,V);
//}
static DECLFW(UNLA9711WriteLo)
@ -66,7 +66,7 @@ static void UNLA9711Power(void)
EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=0;
GenMMC3Power();
SetWriteHandler(0x5000,0x5FFF,UNLA9711WriteLo);
// SetWriteHandler(0x8000,0xbfff,UNLA9711Write8000);
// SetWriteHandler(0x8000,0xbfff,UNLA9711Write8000);
}
void UNLA9711_Init(CartInfo *info)

View File

@ -37,23 +37,23 @@ static SFORMAT StateRegs[]=
static void Sync(void)
{
setprg8(0x8000, prg_reg[0]);
setprg8(0xA000, prg_reg[1]);
setprg8(0xC000, prg_reg[2]);
setprg8(0xA000, prg_reg[1]);
setprg8(0xC000, prg_reg[2]);
setprg8(0xE000, prg_reg[3]);
setchr2(0x0000, chr_reg[0]);
setchr2(0x0800, chr_reg[1]);
setchr1(0x1000, chr_reg[2]);
setchr2(0x0800, chr_reg[1]);
setchr1(0x1000, chr_reg[2]);
setchr1(0x1400, chr_reg[3]);
setchr1(0x1800, chr_reg[4]);
setchr1(0x1c00, chr_reg[5]);
setchr1(0x1c00, chr_reg[5]);
setmirror(mirror);
}
static DECLFW(UNLA9746Write)
{
uint8 bits_rev;
uint8 bits_rev;
// FCEU_printf("write raw %04x:%02x\n",A,V);
switch (A&0xE003)
{
@ -139,8 +139,8 @@ static DECLFW(UNLA9746Write)
switch(EXPREGS[0])
{
case 0x26: setprg8(0x8000, bits_rev); break;
case 0x25: setprg8(0xA000, bits_rev); break;
case 0x24: setprg8(0xC000, bits_rev); break;
case 0x25: setprg8(0xA000, bits_rev); break;
case 0x24: setprg8(0xC000, bits_rev); break;
case 0x23: setprg8(0xE000, bits_rev); break;
}
switch(EXPREGS[1])

View File

@ -77,7 +77,7 @@ static void UNLCC21Sync(void)
}
void UNLCC21_Init(CartInfo *info)
{
{
Latch_Init(info, UNLCC21Sync, 0, 0, 0x8000, 0xFFFF);
}
@ -108,11 +108,11 @@ static DECLFR(BMCD1038Read)
static void BMCD1038Reset(void)
{
dipswitch++;
dipswitch&=3;
dipswitch&=3;
}
void BMCD1038_Init(CartInfo *info)
{
{
Latch_Init(info, BMCD1038Sync, BMCD1038Read, 0, 0x8000, 0xFFFF);
info->Reset=BMCD1038Reset;
AddExState(&dipswitch, 1, 0, "DIPSW");
@ -151,7 +151,7 @@ static void M200Sync(void)
}
void Mapper200_Init(CartInfo *info)
{
{
Latch_Init(info, M200Sync, 0, 0xff, 0x8000, 0xFFFF);
}
@ -166,7 +166,7 @@ static void BMC190in1Sync(void)
}
void BMC190in1_Init(CartInfo *info)
{
{
Latch_Init(info, BMC190in1Sync, 0, 0, 0x8000, 0xFFFF);
}

View File

@ -60,8 +60,8 @@ static void Sync(void)
setprg8(0xC000,~1);
setprg8(0xE000,~0);
for(i=0; i<8; i++)
setchr1(i<<10,chr_reg[i]);
setmirror(mirr^1);
setchr1(i<<10,chr_reg[i]);
setmirror(mirr^1);
}
static DECLFW(UNLAX5705Write)
@ -73,7 +73,7 @@ static DECLFW(UNLAX5705Write)
// chr_reg[ind]=(chr_reg[ind]&(0xF0>>sar))|((V&0x0F)<<sar);
// SyncChr();
// }
// else
// else
switch(A&0xF00F)
{
case 0x8000: prg_reg[0]=((V&2)<<2)|((V&8)>>2)|(V&5); break; // EPROM dump have mixed PRG and CHR banks, data lines to mapper seems to be mixed

View File

@ -23,7 +23,7 @@
*/
//Famicom Jump 2 should get transformed to m153
//All other games are not supporting EEPROM saving right now.
//All other games are not supporting EEPROM saving right now.
//We may need to distinguish between 16 and 159 in order to know the EEPROM configuration.
//Until then, we just return 0x00 from the EEPROM read

View File

@ -32,7 +32,7 @@ static SFORMAT StateRegs[]=
static void Sync(void)
{
FCEU_printf("%02x: %02x %02x\n", bank_mode, bank_value, prgb[0]);
FCEU_printf("%02x: %02x %02x\n", bank_mode, bank_value, prgb[0]);
switch(bank_mode&7)
{
case 0:

View File

@ -59,10 +59,10 @@ static void Sync(void)
static DECLFR(BMC70in1Read)
{
if(bank_mode==0x10)
// if(is_large_banks)
// if(is_large_banks)
return CartBR((A&0xFFF0)|hw_switch);
// else
// return CartBR((A&0xFFF0)|hw_switch);
// else
// return CartBR((A&0xFFF0)|hw_switch);
else
return CartBR(A);
}

View File

@ -81,7 +81,7 @@ byte_8CC6: .BYTE 0,$78, 0, 0,$12
static uint8 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,
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10 };
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10 };
static void Sync(void)
{

View File

@ -64,14 +64,14 @@ static void MBS5Reset(void)
{
dip_switch++;
dip_switch&=3;
reg_prg[0]=reg_prg[1]=reg_prg[2]=reg_prg[3]=~0;
reg_prg[0]=reg_prg[1]=reg_prg[2]=reg_prg[3]=~0;
Sync();
}
static void MBS5Power(void)
{
dip_switch=0;
reg_prg[0]=reg_prg[1]=reg_prg[2]=reg_prg[3]=~0;
reg_prg[0]=reg_prg[1]=reg_prg[2]=reg_prg[3]=~0;
Sync();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,MBS5Write);

View File

@ -66,8 +66,8 @@ static DECLFW(UNLCITYFIGHTWrite)
case 0x9008:
case 0x900C:
if(A&0x800)
pcmwrite(0x4011,(V&0xf)<<3);
else
pcmwrite(0x4011,(V&0xf)<<3);
else
prg_reg=V&0xC;
break;
case 0xC000:

View File

@ -29,7 +29,7 @@ static void(*WSync)(void);
static DECLFW(LatchWrite)
{
// FCEU_printf("bs %04x %02x\n",A,V);
// FCEU_printf("bs %04x %02x\n",A,V);
if(bus_conflict)
latche=V&CartBR(A);
else
@ -227,7 +227,7 @@ static void M87Sync(void)
setprg16(0x8000,0);
setprg16(0xC000,1);
setchr8(((latche>>1)&1)|((latche<<1)&2));
// setchr8(latche);
// setchr8(latche);
}
void Mapper87_Init(CartInfo *info)
@ -367,7 +367,7 @@ static void M113Sync(void)
{
setprg32(0x8000,(latche>>3)&7);
setchr8(((latche>>3)&8)|(latche&7));
// setmirror(latche>>7); // only for HES 6in1
// setmirror(latche>>7); // only for HES 6in1
}
void Mapper113_Init(CartInfo *info)

View File

@ -35,12 +35,12 @@ static void Sync(void)
setchr8(0);
setprg8r(0x10,0x6000,(reg&0xC0)>>6);
setprg32(0x8000,reg&0x1F);
// setmirror(((reg&0x20)>>5));
// setmirror(((reg&0x20)>>5));
}
static DECLFW(UNLEDU2000HiWrite)
{
// FCEU_printf("%04x:%02x\n",A,V);
// FCEU_printf("%04x:%02x\n",A,V);
reg=V;
Sync();
}

View File

@ -53,7 +53,7 @@ static DECLFW(BMCGhostbusters63in1Write)
{
reg[A&1]=V;
bank=((reg[0]&0x80)>>7)|((reg[1]&1)<<1);
// FCEU_printf("reg[0]=%02x, reg[1]=%02x, bank=%02x\n",reg[0],reg[1],bank);
// FCEU_printf("reg[0]=%02x, reg[1]=%02x, bank=%02x\n",reg[0],reg[1],bank);
Sync();
}

View File

@ -24,7 +24,7 @@
static DECLFW(UNLKOF97CMDWrite)
{
V=(V&0xD8)|((V&0x20)>>4)|((V&4)<<3)|((V&2)>>1)|((V&1)<<2); //76143502
if(A==0x9000) A=0x8001;
if(A==0x9000) A=0x8001;
MMC3_CMDWrite(A,V);
}

View File

@ -125,7 +125,7 @@ static DECLFW(M190Write)
// FCEU_printf("write %04x:%04x %d, %d\n",A,V,scanline,timestamp);
regs[(A&0x0F00)>>8]=V;
switch(A)
{
{
case 0xd600:IRQLatch&=0xFF00;IRQLatch|=V;break;
case 0xd700:IRQLatch&=0x00FF;IRQLatch|=V<<8;break;
case 0xd900:IRQCount=IRQLatch;IRQa=V&2;K4IRQ=V&1;X6502_IRQEnd(FCEU_IQEXT);break;
@ -185,7 +185,7 @@ static void M190Power(void)
test[5]=5;
test[6]=6;
test[7]=7;
*/
*/
setprg4r(0x10,0x7000,2);
old2007wrap=GetWriteHandler(0x2007);

View File

@ -44,10 +44,10 @@ static void Sync(void)
static DECLFW(UNLKS7032Write)
{
// FCEU_printf("bs %04x %02x\n",A,V);
// FCEU_printf("bs %04x %02x\n",A,V);
switch(A)
{
// case 0x8FFF: reg[4]=V; Sync(); break;
// case 0x8FFF: reg[4]=V; Sync(); break;
case 0x8000: X6502_IRQEnd(FCEU_IQEXT); IRQCount=(IRQCount&0x000F)|(V&0x0F); break;
case 0x9000: X6502_IRQEnd(FCEU_IQEXT); IRQCount=(IRQCount&0x00F0)|((V&0x0F)<<4); break;
case 0xA000: X6502_IRQEnd(FCEU_IQEXT); IRQCount=(IRQCount&0x0F00)|((V&0x0F)<<8); break;

View File

@ -54,9 +54,9 @@ static DECLFW(UNLKS7057Write)
case 0x8001:
case 0x8002:
case 0x8003:
case 0x9000:
case 0x9001:
case 0x9002:
case 0x9000:
case 0x9001:
case 0x9002:
case 0x9003: mirror = V & 1; Sync(); break;
case 0xB000: reg[0] = (reg[0] & 0xF0) | (V & 0x0F); Sync(); break;
case 0xB001: reg[0] = (reg[0] & 0x0F) | (V << 4); Sync(); break;

View File

@ -125,7 +125,7 @@ static void MMC1PRG(void)
static void MMC1MIRROR(void)
{
if(!is171)
if(!is171)
switch(DRegs[0]&3)
{
case 2: setmirror(MI_V); break;

View File

@ -534,7 +534,7 @@ static DECLFW(M45Write)
}
EXPREGS[EXPREGS[4]]=V;
EXPREGS[4]=(EXPREGS[4]+1)&3;
// if(!EXPREGS[4])
// if(!EXPREGS[4])
// {
// FCEU_printf("CHROR %02x, PRGOR %02x, CHRAND %02x, PRGAND %02x\n",EXPREGS[0],EXPREGS[1],EXPREGS[2],EXPREGS[3]);
// FCEU_printf("CHR0 %03x, CHR1 %03x, PRG0 %03x, PRG1 %03x\n",

View File

@ -80,14 +80,14 @@ typedef struct __cartdata {
uint8 size;
} cartdata;
#define Sprite16 (PPU[0]&0x20) //Sprites 8x16/8x8
#define Sprite16 (PPU[0]&0x20) //Sprites 8x16/8x8
//#define MMC5SPRVRAMADR(V) &MMC5SPRVPage[(V)>>10][(V)]
static inline uint8 * MMC5BGVRAMADR(uint32 A)
{
if(!Sprite16) {
if(mmc5ABMode==0)
return &MMC5SPRVPage[(A)>>10][(A)];
else
else
return &MMC5BGVPage[(A)>>10][(A)];
} else return &MMC5BGVPage[(A)>>10][(A)];
}
@ -107,7 +107,7 @@ static void mmc5_PPUWrite(uint32 A, uint8 V) {
{
if(PPUCHRRAM&(1<<(tmp>>10)))
VPage[tmp>>10][tmp]=V;
}
}
else
{
if(PPUNTARAM&(1<<((tmp&0xF00)>>10)))
@ -123,7 +123,7 @@ uint8 FASTCALL mmc5_PPURead(uint32 A) {
else return MMC5SPRVPage[(A)>>10][(A)];
}
else
{
{
return vnapage[(A>>10)&0x3][A&0x3FF];
}
}
@ -188,11 +188,11 @@ static void BuildWRAMSizeTable(void)
case 1: MMC5WRAMIndex[x]=(x>3)?255:0; break; //0,0,0,0,X,X,X,X
case 2: MMC5WRAMIndex[x]=(x&4)>>2; break; //0,0,0,0,1,1,1,1
case 4: MMC5WRAMIndex[x]=(x>3)?255:(x&3); break; //0,1,2,3,X,X,X,X
case 8: MMC5WRAMIndex[x]=x; break; //0,1,2,3,4,5,6,7,8
case 8: MMC5WRAMIndex[x]=x; break; //0,1,2,3,4,5,6,7,8
//mbg 8/6/08 - i added this to support 64KB of wram
//now, I have at least one example (laser invasion) which actually uses size 1 but isnt in the crc list
//so, whereas before my change on 8/4/08 we would have selected size 1, now we select size 8
//this means that we could have just introduced an emulation bug, in case those games happened to
//this means that we could have just introduced an emulation bug, in case those games happened to
//address, say, page 3. with size 1 that would resolve to [0] but in size 8 it resolves to [3].
//so, you know what to do if there are problems.
}
@ -442,7 +442,7 @@ static DECLFW(MMC5_WriteROMRAM)
if(A>=0x8000)
if(MMC5ROMWrProtect[(A-0x8000)>>13]) return;
if(MMC5MemIn[(A-0x6000)>>13])
if(((WRAMMaskEnable[0]&3)|((WRAMMaskEnable[1]&3)<<2)) == 6)
if(((WRAMMaskEnable[0]&3)|((WRAMMaskEnable[1]&3)<<2)) == 6)
Page[A>>11][A]=V;
}

View File

@ -65,7 +65,7 @@ static DECLFW(MCN22MWrite)
static void MCN22MPower(void)
{
reg[0]=reg[1]=reg[2]=0;
Sync();
Sync();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,MCN22MWrite);
}

View File

@ -275,7 +275,7 @@ static INLINE uint32 FetchDuff(uint32 P, uint32 envelope)
static void DoNamcoSoundHQ(void)
{
uint32 V; //mbg merge 7/17/06 made uint32
int32 P;
int32 P;
int32 cyclesuck=(((IRAM[0x7F]>>4)&7)+1)*15;
for(P=7;P>=(7-((IRAM[0x7F]>>4)&7));P--)

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* 700in1 and 400in1 carts
*/
#include "mapinc.h"
@ -40,29 +40,29 @@ static void Sync(void)
if(cmd&0x100)
{
setprg16(0x8000,((cmd&0xe0)>>2)|bank);
setprg16(0xC000,((cmd&0xe0)>>2)|7);
setprg16(0xC000,((cmd&0xe0)>>2)|7);
}
else
{
setprg16(0x8000,((cmd&0xe0)>>2)|(bank&6));
setprg16(0xC000,((cmd&0xe0)>>2)|((bank&6)|1));
setprg16(0xC000,((cmd&0xe0)>>2)|((bank&6)|1));
}
}
else
{
setprg16(0x8000,((cmd&0xe0)>>2)|bank);
setprg16(0xC000,((cmd&0xe0)>>2)|bank);
}
}
}
static DECLFW(UNLN625092WriteCommand)
{
cmd=A;
cmd=A;
Sync();
}
static DECLFW(UNLN625092WriteBank)
{
{
bank=A&7;
Sync();
}

View File

@ -37,7 +37,7 @@ static DECLFW(NovelWrite)
static void NovelReset(void)
{
SetWriteHandler(0x8000,0xFFFF,NovelWrite);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetReadHandler(0x8000,0xFFFF,CartBR);
setprg32(0x8000,0);
setchr8(0);
}

View File

@ -86,7 +86,7 @@ static void Sync(void)
static DECLFW(UNLOneBusWrite20XX)
{
// FCEU_printf("PPU %04x:%04x\n",A,V);
// FCEU_printf("PPU %04x:%04x\n",A,V);
if(A == 0x201A)
regs[0xd] = V;
else if(A == 0x2018)
@ -96,26 +96,26 @@ static DECLFW(UNLOneBusWrite20XX)
static DECLFW(UNLOneBusWriteExp)
{
// FCEU_printf("EXP %04x:%04x\n",A,V);
// switch(A & 0x0F)
// {
// case 2: pcm_latch = pcm_clock; FCEU_printf("write %04x:%04x\n",A,V); break;
// case 3: pcm_irqa = 0; X6502_IRQEnd(FCEU_IQEXT); pcm_irq = 0; FCEU_printf("write %04x:%04x\n",A,V); break;
// case 4: pcm_irqa = 1; FCEU_printf("write %04x:%04x\n",A,V); break;
// default:
// FCEU_printf("EXP %04x:%04x\n",A,V);
// switch(A & 0x0F)
// {
// case 2: pcm_latch = pcm_clock; FCEU_printf("write %04x:%04x\n",A,V); break;
// case 3: pcm_irqa = 0; X6502_IRQEnd(FCEU_IQEXT); pcm_irq = 0; FCEU_printf("write %04x:%04x\n",A,V); break;
// case 4: pcm_irqa = 1; FCEU_printf("write %04x:%04x\n",A,V); break;
// default:
regs[A & 0x0F] = V;
Sync();
// }
// }
}
static DECLFW(UNLOneBusWriteDebug)
{
// FCEU_printf("write %04x:%04x\n",A,V);
// FCEU_printf("write %04x:%04x\n",A,V);
}
static DECLFW(UNLOneBusWriteMMC)
{
// FCEU_printf("MMC %04x:%04x\n",A,V);
// FCEU_printf("MMC %04x:%04x\n",A,V);
switch(A&0xE001)
{
case 0x8000: regs[0xf] = V; Sync(); break;
@ -173,27 +173,27 @@ static void UNLOneBusIRQHook(void)
static DECLFW(UNLOneBusWriteAPU2)
{
// FCEU_printf("APU2 %04x:%04x\n",A,V);
// FCEU_printf("APU2 %04x:%04x\n",A,V);
CartBW(A&0xffdf,V);
}
static DECLFW(UNLOneBusWrite4012)
{
// FCEU_printf("write %04x:%04x\n",A,V);
// FCEU_printf("write %04x:%04x\n",A,V);
pcm_addr = V << 6;
old4012write(A,V);
}
static DECLFW(UNLOneBusWrite4013)
{
// FCEU_printf("write %04x:%04x\n",A,V);
// FCEU_printf("write %04x:%04x\n",A,V);
pcm_size = (V << 4) + 1;
old4013write(A,V);
}
static DECLFW(UNLOneBusWrite4015)
{
// FCEU_printf("write %04x:%04x\n",A,V);
// FCEU_printf("write %04x:%04x\n",A,V);
pcm_enable = V&0x10;
if(pcm_irq)
{
@ -208,7 +208,7 @@ static DECLFW(UNLOneBusWrite4015)
static DECLFR(UNLOneBusRead4015)
{
uint8 result = (old4015read(A) & 0x7F)|pcm_irq;
// FCEU_printf("read %04x, %02x\n",A,result);
// FCEU_printf("read %04x, %02x\n",A,result);
return result;
}
@ -263,8 +263,8 @@ static void UNLOneBusPower(void)
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x2009,0x2fff,UNLOneBusWrite20XX);
// SetWriteHandler(0x4020,0xffff,UNLOneBusWriteDebug);
// SetWriteHandler(0x4020,0x4040,UNLOneBusWriteAPU2);
// SetWriteHandler(0x4020,0xffff,UNLOneBusWriteDebug);
// SetWriteHandler(0x4020,0x4040,UNLOneBusWriteAPU2);
SetWriteHandler(0x4100,0x410f,UNLOneBusWriteExp);
SetWriteHandler(0x8000,0xefff,UNLOneBusWriteMMC);
Sync();
@ -291,7 +291,7 @@ void UNLOneBus_Init(CartInfo *info)
info->Power=UNLOneBusPower;
info->Reset=UNLOneBusReset;
GameHBIRQHook=UNLOneBusIRQHook;
// MapIRQHook=UNLOneBusCpuHook;
// MapIRQHook=UNLOneBusCpuHook;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@ -64,7 +64,7 @@ static DECLFR(S74LS374NRead)
{
uint8 ret;
if((A&0x4100)==0x4100)
// ret=(X.DB&0xC0)|((~cmd)&0x3F);
// ret=(X.DB&0xC0)|((~cmd)&0x3F);
ret=((~cmd)&0x3F)^dip;
else
ret=X.DB;

View File

@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*
* Wario Land II (Kirby hack)
*/
@ -51,7 +51,7 @@ static DECLFW(UNLSC127Write)
{
switch(A)
{
case 0x8000: reg[0] = V; break;
case 0x8000: reg[0] = V; break;
case 0x8001: reg[1] = V; break;
case 0x8002: reg[2] = V; break;
case 0x9000: chr[0] = V; break;

View File

@ -56,7 +56,7 @@ static DECLFR(MSHRead)
static void MSHReset(void)
{
MMC3RegReset();
tekker^=0xFF;
tekker^=0xFF;
}
static void MSHPower(void)

View File

@ -66,7 +66,7 @@ static void UNLSMB2JPower(void)
}
static void UNLSMB2JReset(void)
{
{
prg=~0;
Sync();
}

View File

@ -54,7 +54,7 @@ static void SuperReset(void)
{
SetWriteHandler(0x6000,0x7FFF,SuperWrite);
SetWriteHandler(0x8000,0xFFFF,SuperHi);
SetReadHandler(0x6000,0xFFFF,CartBR);
SetReadHandler(0x6000,0xFFFF,CartBR);
cmd0=cmd1=0;
setprg32r(4,0x8000,0);
setchr8(0);

View File

@ -27,7 +27,7 @@ static uint8 reset_flag = 0x07;
static void BMCT2271CW(uint32 A, uint8 V)
{
uint32 va = V;
uint32 va = V;
if(EXPREGS[0]&0x20)
{
va|=0x200;
@ -43,7 +43,7 @@ static void BMCT2271CW(uint32 A, uint8 V)
static void BMCT2271PW(uint32 A, uint8 V)
{
uint32 va = V & 0x3F;
uint32 va = V & 0x3F;
if(EXPREGS[0]&0x20)
{
va&=0x1F;
@ -58,22 +58,22 @@ static void BMCT2271PW(uint32 A, uint8 V)
switch(EXPREGS[0]&3)
{
case 0x00: setprg8(A,va); break;
case 0x02:
case 0x02:
{
va=(va&0xFD)|((EXPREGS[0]&4)>>1);
if(A<0xC000)
{
setprg16(0x8000,va >> 1);
setprg16(0xC000,va >> 1);
setprg16(0x8000,va >> 1);
setprg16(0xC000,va >> 1);
}
break;
}
case 0x01:
case 0x01:
case 0x03: if(A<0xC000) setprg32(0x8000,va >> 2); break;
}
}
static DECLFW(BMCT2271LoWrite)
{
if(!(EXPREGS[0]&0x80))

View File

@ -33,7 +33,7 @@ static SFORMAT StateRegs[]=
static void Sync(void)
{
uint16 base=((addrreg&0x60)>>2)|((addrreg&0x100)>>3);
uint16 base=((addrreg&0x60)>>2)|((addrreg&0x100)>>3);
setprg16(0x8000,(datareg&7)|base);
setprg16(0xC000,7|base);
setmirror(((addrreg&2)>>1)^1);

View File

@ -104,7 +104,7 @@ static DECLFW(RAMBO1_write)
switch(A&0xF001)
{
case 0xa000: mir=V&1;
// if(!nomirror)
// if(!nomirror)
setmirror(mir^1);
break;
case 0x8000: cmd = V;
@ -138,7 +138,7 @@ static DECLFW(RAMBO1_write)
static void RAMBO1_Restore(int version)
{
Synco();
// if(!nomirror)
// if(!nomirror)
setmirror(mir^1);
}
@ -148,7 +148,7 @@ static void RAMBO1_init(void)
for(x=0;x<11;x++)
DRegs[x]=~0;
cmd=mir=0;
// if(!nomirror)
// if(!nomirror)
setmirror(1);
Synco();
GameHBIRQHook=RAMBO1_hb;
@ -166,7 +166,7 @@ static void CHRWrap(unsigned int A, unsigned int V)
void Mapper64_init(void)
{
setchr1wrap=CHRWrap;
// nomirror=0;
// nomirror=0;
RAMBO1_init();
}
/*

View File

@ -24,7 +24,7 @@
static uint8 prg0, prg1, mirr, swap;
static uint8 chr[8];
static uint8 IRQCount;
static uint8 IRQCount;
static uint8 IRQPre;
static uint8 IRQa;
@ -47,7 +47,7 @@ static void SyncPrg(void)
{
setprg8(0x8000,~1);
setprg8(0xC000,prg0);
}
}
else
{
setprg8(0x8000,prg0);
@ -89,11 +89,11 @@ static DECLFW(UNLTF1201Write)
case 0x9001: swap=V&3; SyncPrg(); break;
case 0xF000: IRQCount=((IRQCount&0xF0)|(V&0xF)); break;
case 0xF002: IRQCount=((IRQCount&0x0F)|((V&0xF)<<4)); break;
case 0xF001:
case 0xF001:
case 0xF003: IRQa=V&2; X6502_IRQEnd(FCEU_IQEXT); if(scanline<240) IRQCount-=8; break;
}
}
static void UNLTF1201IRQCounter(void)
{
if(IRQa)
@ -105,7 +105,7 @@ static void UNLTF1201IRQCounter(void)
}
}
}
static void UNLTF1201Power(void)
{
IRQPre=IRQCount=IRQa=0;

View File

@ -295,7 +295,7 @@ void setchr8r(int r, unsigned int V)
if(CHRram[r])
PPUCHRRAM|=(255);
else
PPUCHRRAM=0;
PPUCHRRAM=0;
}
void setchr1(unsigned int A, unsigned int V)
@ -435,7 +435,7 @@ static uint8 *GENIEROM=0;
void FixGenieMap(void);
// Called when a game(file) is opened successfully.
// Called when a game(file) is opened successfully.
void OpenGenie(void)
{
FILE *fp;

View File

@ -269,7 +269,7 @@ void FCEU_LoadGameCheats(FILE *override)
namebuf[x]=0;
break;
}
else if(namebuf[x] > 0x00 && namebuf[x] < 0x20)
else if(namebuf[x] > 0x00 && namebuf[x] < 0x20)
namebuf[x]=0x20;
}
@ -380,7 +380,7 @@ int FCEUI_AddCheat(const char *name, uint32 addr, uint8 val, int compare, int ty
}
savecheats=1;
RebuildSubCheats();
return(1);
}
@ -952,7 +952,7 @@ void UpdateFrozenList(void)
//The purpose of this function is to keep an up to date list of addresses that are currently frozen
//and make these accessible to other dialogs that deal with memory addresses such as
//memwatch, hex editor, ramfilter, etc.
int x;
FrozenAddresses.clear(); //Clear vector and repopulate
for(x=0;x<numsubcheats;x++)

View File

@ -25,7 +25,7 @@
* http://www.engr.mun.ca/~theo/Misc/exp_parsing.htm
*
* Grammar of the parser:
*
*
* P -> Connect
* Connect -> Compare {('||' | '&&') Compare}
* Compare -> Sum {('==' | '!=' | '<=' | '>=' | '<' | '>') Sum}
@ -152,7 +152,7 @@ int getNumber(unsigned int* number, const char** str)
{
return 0;
}
// Older, inferior version which doesn't work with leading zeros
// sprintf(buffer, "%X", *number);
// *str += strlen(buffer);
@ -358,7 +358,7 @@ Condition* Term(const char** str)
if (!(mid = (Condition*)FCEU_dmalloc(sizeof(Condition))))
return NULL;
memset(mid, 0, sizeof(Condition));
mid->lhs = t;

View File

@ -15,7 +15,7 @@ static char *aboutString = 0;
///returns a string suitable for use in an aboutbox
char *FCEUI_GetAboutString() {
const char *aboutTemplate =
const char *aboutTemplate =
FCEU_NAME_AND_VERSION "\n\n\
Administrators:\n\
zeromus, adelikat, AnS\n\n\
@ -51,7 +51,7 @@ ugetab\n\
//allocate the string and concatenate the template with the compiler string
if (!(aboutString = (char*)FCEU_dmalloc(strlen(aboutTemplate) + strlen(compilerString) + 1)))
return NULL;
sprintf(aboutString,"%s%s",aboutTemplate,compilerString);
return aboutString;
}

View File

@ -1,4 +1,4 @@
/// \file
/// \file
/// \brief Implements core debugging facilities
#include <stdlib.h>
@ -94,11 +94,11 @@ int getValue(int type)
int checkCondition(const char* condition, int num)
{
const char* b = condition;
// Check if the condition isn't just all spaces.
int onlySpaces = 1;
while (*b)
{
if (*b != ' ')
@ -106,13 +106,13 @@ int checkCondition(const char* condition, int num)
onlySpaces = 0;
break;
}
++b;
}
// If there's an actual condition create the BP condition object now
if (*condition && !onlySpaces)
{
Condition* c = generateCondition(condition);
@ -129,7 +129,7 @@ int checkCondition(const char* condition, int num)
// If the creation of the BP condition object was succesful
// the condition is apparently valid. It can be added to the
// breakpoint now.
if (c)
{
watchpoint[num].cond = c;
@ -142,7 +142,7 @@ int checkCondition(const char* condition, int num)
{
watchpoint[num].cond = 0;
}
return watchpoint[num].cond == 0 ? 2 : 0;
}
else
@ -164,7 +164,7 @@ int checkCondition(const char* condition, int num)
*
* @param hwndDlg Handle of the debugger window
* @param num Number of the breakpoint
* @param
* @param
**/
unsigned int NewBreak(const char* name, int start, int end, unsigned int type, const char* condition, unsigned int num, bool enable)
{
@ -199,7 +199,7 @@ unsigned int NewBreak(const char* name, int start, int end, unsigned int type, c
watchpoint[num].desc = (char*)malloc(strlen(name) + 1);
strcpy(watchpoint[num].desc, name);
return checkCondition(condition, num);
}
@ -215,7 +215,7 @@ int GetPRGAddress(int A){
* Returns the bank for a given offset.
* Technically speaking this function does not calculate the actual bank
* where the offset resides but the 0x4000 bytes large chunk of the ROM of the offset.
*
*
* @param offs The offset
* @return The bank of that offset or -1 if the offset is not part of the ROM.
**/
@ -383,7 +383,7 @@ void LogCDVectors(int which){
if(!(cdloggerdata[j] & 1))undefinedcount--;
}
j++;
if(!(cdloggerdata[j] & 2)){
cdloggerdata[j] |= 0x0E;
datacount++;
@ -395,13 +395,13 @@ void LogCDData(uint8 *opcode, uint16 A, int size) {
int i, j;
uint8 memop = 0;
if((j = GetPRGAddress(_PC)) != -1)
if((j = GetPRGAddress(_PC)) != -1)
for (i = 0; i < size; i++) {
if(cdloggerdata[j+i] & 1)continue; //this has been logged so skip
cdloggerdata[j+i] |= 1;
cdloggerdata[j+i] |=((_PC+i)>>11)&0x0c;
if(indirectnext)cdloggerdata[j+i] |= 0x10;
codecount++;
codecount++;
if(!(cdloggerdata[j+i] & 2))undefinedcount--;
}
@ -421,7 +421,7 @@ void LogCDData(uint8 *opcode, uint16 A, int size) {
cdloggerdata[j] |= 2;
cdloggerdata[j] |=(A>>11)&0x0c;
cdloggerdata[j] |= memop;
datacount++;
datacount++;
if(!(cdloggerdata[j] & 1))undefinedcount--;
}
}
@ -469,7 +469,7 @@ void IncrementInstructionsCounters()
void BreakHit(int bp_num, bool force = false)
{
if(!force) {
//check to see whether we fall in any forbid zone
for (int i = 0; i < numWPs; i++) {
watchpointinfo& wp = watchpoint[i];
@ -490,8 +490,8 @@ void BreakHit(int bp_num, bool force = false)
}
FCEUI_SetEmulationPaused(1); //mbg merge 7/19/06 changed to use EmulationPaused()
#ifdef WIN32
#ifdef WIN32
FCEUD_DebugBreakpoint(bp_num);
#endif
}
@ -658,7 +658,7 @@ static void breakpoint(uint8 *opcode, uint16 A, int size) {
{
// Used to make it ignore the unannounced stack code one time
StackNextIgnorePC = 0xFFFF;
} else
} else
{
if ((X.S < StackAddrBackup) && (stackop==0))
{
@ -734,8 +734,8 @@ void DebugCycle()
}
else
vblankScanLines = 0;
if (GameInfo->type==GIT_NSF)
if (GameInfo->type==GIT_NSF)
{
if ((_PC >= 0x3801) && (_PC <= 0x3824)) return;
}
@ -774,9 +774,9 @@ void DebugCycle()
if(debug_loggingCD)
LogCDData(opcode, A, size);
#ifdef WIN32
//This needs to be windows only or else the linux build system will fail since logging is declared in a
//This needs to be windows only or else the linux build system will fail since logging is declared in a
//windows source file
FCEUD_TraceInstruction(opcode, size);
#endif

View File

@ -114,7 +114,7 @@ void DrawTextLineBG(uint8 *dest)
int offs;
if(y>=7) offs=otable[13-y];
else offs=otable[y];
else offs=otable[y];
for(x=offs;x<(256-offs);x++)
{
@ -136,7 +136,7 @@ void DrawMessage(bool beforeMovie)
uint8 *t;
guiMessage.howlong--;
if (guiMessage.linesFromBottom > 0)
if (guiMessage.linesFromBottom > 0)
t=XBuf+FCEU_TextScanlineOffsetFromBottom(guiMessage.linesFromBottom)+1;
else
t=XBuf+FCEU_TextScanlineOffsetFromBottom(20)+1;
@ -169,7 +169,7 @@ void DrawMessage(bool beforeMovie)
//don't display movie messages if we're not before the movie
if(beforeMovie && !subtitleMessage.isMovieMessage)
return;
uint8 *tt;
subtitleMessage.howlong--;
tt=XBuf+FCEU_TextScanlineOffsetFromBottom(216);
@ -307,7 +307,7 @@ static void drawstatus(uint8* XBuf, int n, int y, int xofs)
uint8* slines=sline_icons[n];
int i;
XBuf += FCEU_TextScanlineOffsetFromBottom(y) + 240 + 255 + xofs;
for(i=0; slines[i]!=99; i+=3)
{
@ -334,7 +334,7 @@ void FCEU_DrawRecordingStatus(uint8* XBuf)
{
if(FCEUD_ShowStatusIcon())
{
bool hasPlayRecIcon = false;
bool hasPlayRecIcon = false;
if(FCEUMOV_Mode(MOVIEMODE_RECORD))
{
drawstatus(XBuf-ClipSidesOffset,2,28,0);
@ -388,7 +388,7 @@ void FCEU_DrawNumberRow(uint8 *XBuf, int *nstatus, int cur)
XBaf[12*256+x+z*21+z*1]=4;
}
}
}
}
static int FixJoedChar(uint8 ch)
{

View File

@ -98,7 +98,7 @@ 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);
//same as FCEUI_LoadGame, except that it can load from a tempfile.
//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);
@ -203,8 +203,8 @@ void FCEUI_CheatSearchSetCurrentAsOriginal(void);
//.rom
#define FCEUIOD_ROMS 0 //Roms
#define FCEUIOD_NV 1 //NV = nonvolatile. save data.
#define FCEUIOD_STATES 2 //savestates
#define FCEUIOD_NV 1 //NV = nonvolatile. save data.
#define FCEUIOD_STATES 2 //savestates
#define FCEUIOD_FDSROM 3 //disksys.rom
#define FCEUIOD_SNAPS 4 //screenshots
#define FCEUIOD_CHEATS 5 //cheats

View File

@ -1,4 +1,4 @@
/*
/*
Copyright (C) 2009-2010 DeSmuME team
Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -1,4 +1,4 @@
/*
/*
Copyright (C) 2009-2010 DeSmuME team
Permission is hereby granted, free of charge, to any person obtaining a copy
@ -53,7 +53,7 @@ public:
virtual EMUFILE* memwrap() = 0;
virtual ~EMUFILE() {}
static bool readAllBytes(std::vector<u8>* buf, const std::string& fname);
bool fail(bool unset=false) { bool ret = failbit; if(unset) unfail(); return ret; }
@ -119,7 +119,7 @@ public:
};
//todo - handle read-only specially?
class EMUFILE_MEMORY : public EMUFILE {
class EMUFILE_MEMORY : public EMUFILE {
protected:
std::vector<u8> *vec;
bool ownvec;
@ -133,12 +133,12 @@ protected:
public:
EMUFILE_MEMORY(std::vector<u8> *underlying) : vec(underlying), ownvec(false), pos(0), len((s32)underlying->size()) { }
EMUFILE_MEMORY(u32 preallocate) : vec(new std::vector<u8>()), ownvec(true), pos(0), len(0) {
EMUFILE_MEMORY(u32 preallocate) : vec(new std::vector<u8>()), ownvec(true), pos(0), len(0) {
vec->resize(preallocate);
len = preallocate;
}
EMUFILE_MEMORY() : vec(new std::vector<u8>()), ownvec(true), pos(0), len(0) { vec->reserve(1024); }
EMUFILE_MEMORY(void* buf, s32 size) : vec(new std::vector<u8>()), ownvec(true), pos(0), len(size) {
EMUFILE_MEMORY(void* buf, s32 size) : vec(new std::vector<u8>()), ownvec(true), pos(0), len(size) {
vec->resize(size);
if(size != 0)
memcpy(&vec->front(),buf,size);
@ -157,7 +157,7 @@ public:
if(pos>length) pos=length;
}
u8* buf() {
u8* buf() {
if(size()==0) reserve(1);
return &(*vec)[0];
}
@ -177,10 +177,10 @@ public:
va_end(argptr);
va_start(argptr, format);
vsprintf(tempbuf,format,argptr);
fwrite(tempbuf,amt);
delete[] tempbuf;
va_end(argptr);
return amt;
};
@ -222,7 +222,7 @@ public:
len = std::max(pos,len);
}
virtual int fseek(int offset, int origin){
virtual int fseek(int offset, int origin){
//work differently for read-only...?
switch(origin) {
case SEEK_SET:
@ -261,7 +261,7 @@ public:
virtual int size() { return (int)len; }
};
class EMUFILE_FILE : public EMUFILE {
class EMUFILE_FILE : public EMUFILE {
protected:
FILE* fp;
std::string fname;
@ -281,7 +281,7 @@ public:
}
virtual FILE *get_fp() {
return fp;
return fp;
}
virtual EMUFILE* memwrap();
@ -321,7 +321,7 @@ public:
failbit = true;
}
virtual int fseek(int offset, int origin) {
virtual int fseek(int offset, int origin) {
return ::fseek(fp, offset, origin);
}
@ -329,7 +329,7 @@ public:
return (u32)::ftell(fp);
}
virtual int size() {
virtual int size() {
int oldpos = ftell();
fseek(0,SEEK_END);
int len = ftell();

View File

@ -106,16 +106,16 @@ bool CheckFileExists(const char* filename)
if (!filename) return false;
fstream test;
test.open(filename,fstream::in);
if (test.fail())
{
test.close();
return false;
return false;
}
else
{
test.close();
return true;
return true;
}
}
@ -180,7 +180,7 @@ static void FCEU_CloseGame(void)
delete GameInfo;
GameInfo = NULL;
currFrameCounter = 0;
//Reset flags for Undo/Redo/Auto Savestating //adelikat: TODO: maybe this stuff would be cleaner as a struct or class
@ -598,7 +598,7 @@ void SetAutoFireOffset(int offset)
void AutoFire(void)
{
static int counter = 0;
if (justLagged == false)
if (justLagged == false)
counter = (counter + 1) % (8*7*5*3);
//If recording a movie, use the frame # for the autofire so the offset
//doesn't get screwed up when loading.

View File

@ -64,7 +64,7 @@ private:
void CallRegisteredLuaSaveFunctions(int savestateNumber, LuaSaveData& saveData);
void CallRegisteredLuaLoadFunctions(int savestateNumber, const LuaSaveData& saveData);
// Just forward function declarations
// Just forward function declarations
void FCEU_LuaFrameBoundary();
int FCEU_LoadLuaCode(const char *filename, const char *arg=NULL);

View File

@ -41,7 +41,7 @@
// and the when it can be successfully read/written to. This should
// prevent writes to wrong places OR add code to prevent disk ejects
// when the virtual motor is on(mmm...virtual motor).
extern int disableBatteryLoading;
extern int disableBatteryLoading;
bool isFDS = false; //flag for determining if a FDS game is loaded, movie.cpp needs this
@ -97,7 +97,7 @@ void FDSGI(GI h)
}
static void FDSStateRestore(int version)
{
{
int x;
setmirror(((FDSRegs[5]&8)>>3)^1);
@ -136,7 +136,7 @@ static void FDSInit(void)
SetReadHandler(0x4032,0x4032,FDSRead4032);
SetReadHandler(0x4033,0x4033,FDSRead4033);
SetWriteHandler(0x4020,0x4025,FDSWrite);
SetWriteHandler(0x4020,0x4025,FDSWrite);
SetWriteHandler(0x6000,0xdfff,FDSRAMWrite);
SetReadHandler(0x6000,0xdfff,FDSRAMRead);
@ -157,15 +157,15 @@ void FCEU_FDSInsert(void)
if(TotalSides==0)
{
FCEU_DispMessage("Not FDS; can't eject disk.",0);
FCEU_DispMessage("Not FDS; can't eject disk.",0);
return;
}
if(InDisk==255)
{
FCEU_DispMessage("Disk %d Side %s Inserted",0,SelectDisk>>1,(SelectDisk&1)?"B":"A");
FCEU_DispMessage("Disk %d Side %s Inserted",0,SelectDisk>>1,(SelectDisk&1)?"B":"A");
InDisk=SelectDisk;
}
else
else
{
FCEU_DispMessage("Disk %d Side %s Ejected",0,SelectDisk>>1,(SelectDisk&1)?"B":"A");
InDisk=255;
@ -211,14 +211,14 @@ static void FDSFix(int a)
IRQCount=IRQLatch=0;
}
else
IRQCount=IRQLatch;
IRQCount=IRQLatch;
//IRQCount=IRQLatch; //0xFFFF;
X6502_IRQBegin(FCEU_IQEXT);
//printf("IRQ: %d\n",timestamp);
// printf("IRQ: %d\n",scanline);
}
}
if(DiskSeekIRQ>0)
if(DiskSeekIRQ>0)
{
DiskSeekIRQ-=a;
if(DiskSeekIRQ<=0)
@ -263,14 +263,14 @@ static DECLFR(FDSRead4031)
return z;
}
static DECLFR(FDSRead4032)
{
{
uint8 ret;
ret=X.DB&~7;
if(InDisk==255)
ret|=5;
if(InDisk==255 || !(FDSRegs[5]&1) || (FDSRegs[5]&2))
if(InDisk==255 || !(FDSRegs[5]&1) || (FDSRegs[5]&2))
ret|=2;
return ret;
}
@ -369,7 +369,7 @@ static DECLFW(FDSSWrite)
A-=0x4080;
switch(A)
{
case 0x0:
case 0x0:
case 0x4: if(V&0x80)
amplitude[(A&0xF)>>2]=V&0x3F; //)>0x20?0x20:(V&0x3F);
break;
@ -385,7 +385,7 @@ static DECLFW(FDSSWrite)
break;
}
//if(A>=0x7 && A!=0x8 && A<=0xF)
//if(A==0xA || A==0x9)
//if(A==0xA || A==0x9)
//printf("$%04x:$%02x\n",A,V);
SPSG[A]=V;
}
@ -452,7 +452,7 @@ static INLINE void ClockRise(void)
b19shiftreg60=(SPSG[0x2]|((SPSG[0x3]&0xF)<<8));
b17latch76=(SPSG[0x6]|((SPSG[0x07]&0xF)<<8))+b17latch76;
if(!(SPSG[0x7]&0x80))
if(!(SPSG[0x7]&0x80))
{
int t=fdso.mwave[(b17latch76>>13)&0x1F]&7;
int t2=amplitude[1];
@ -472,13 +472,13 @@ static INLINE void ClockRise(void)
b8shiftreg88=0x80 + adj;
}
else
{
{
b8shiftreg88=0x80;
}
}
else
{
b19shiftreg60<<=1;
b19shiftreg60<<=1;
b8shiftreg88>>=1;
}
// b24adder66=(b24latch68+b19shiftreg60)&0x3FFFFFF;
@ -508,7 +508,7 @@ dogk:
if(fdso.envcount<=0)
{
fdso.envcount+=SPSG[0xA]*3;
DoEnv();
DoEnv();
}
}
if(fdso.count>=32768) goto dogk;
@ -715,7 +715,7 @@ static int SubLoad(FCEUFILE *fp)
}
else
return(0);
}
}
else
TotalSides=header[4];
@ -765,7 +765,7 @@ static void PostSave(void)
for(b=0; b<65500; b++)
diskdata[x][b] ^= diskdatao[x][b];
}
}
}
@ -777,13 +777,13 @@ int FDSLoad(const char *name, FCEUFILE *fp)
FCEU_fseek(fp,0,SEEK_SET);
if(!SubLoad(fp))
if(!SubLoad(fp))
return(0);
fn = strdup(FCEU_MakeFName(FCEUMKF_FDSROM,0,0).c_str());
if(!(zp=FCEUD_UTF8fopen(fn,"rb")))
if(!(zp=FCEUD_UTF8fopen(fn,"rb")))
{
FCEU_PrintError("FDS BIOS ROM image missing: %s", FCEU_MakeFName(FCEUMKF_FDSROM,0,0).c_str());
FreeFDSMemory();
@ -854,7 +854,7 @@ int FDSLoad(const char *name, FCEUFILE *fp)
for(x=0;x<TotalSides;x++)
{
char temp[5];
char temp[5];
sprintf(temp,"DDT%d",x);
AddExState(diskdata[x],65500,0,temp);
}
@ -901,7 +901,7 @@ void FDSClose(void)
for(x=0;x<TotalSides;x++)
{
if(fwrite(diskdata[x],1,65500,fp)!=65500)
if(fwrite(diskdata[x],1,65500,fp)!=65500)
{
FCEU_PrintError("Error saving FDS image!");
fclose(fp);

View File

@ -173,11 +173,11 @@ FileBaseInfo DetermineFileBase(const char *f) {
char drv[PATH_MAX], dir[PATH_MAX], name[PATH_MAX], ext[PATH_MAX];
splitpath(f,drv,dir,name,ext);
if(dir[0] == 0) strcpy(dir,".");
return FileBaseInfo((std::string)drv + dir,name,ext);
return FileBaseInfo((std::string)drv + dir,name,ext);
}
inline FileBaseInfo DetermineFileBase(const std::string& str) { return DetermineFileBase(str.c_str()); }
@ -235,7 +235,7 @@ zpfail:
unz_file_info ufo;
unzGetCurrentFileInfo(tz,&ufo,0,0,0,0,0,0);
int size = ufo.uncompressed_size;
EMUFILE_MEMORY* ms = new EMUFILE_MEMORY(size);
unzReadCurrentFile(tz,ms->buf(),ufo.uncompressed_size);
@ -246,7 +246,7 @@ zpfail:
fceufp->stream = ms;
fceufp->size = size;
return fceufp;
}
return 0;
@ -267,7 +267,7 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext
std::string archive,fname,fileToOpen;
FCEU_SplitArchiveFilename(path,archive,fname,fileToOpen);
//try to setup the ips file
if(ipsfn && read)
@ -301,14 +301,14 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext
//try to read a gzipped file
{
uint32 magic;
magic = fp->fgetc();
magic|=fp->fgetc()<<8;
magic|=fp->fgetc()<<16;
fp->fseek(0,SEEK_SET);
if(magic==0x088b1f) {
// maybe gzip...
// maybe gzip...
gzFile gzfile = gzopen(fileToOpen.c_str(),"rb");
if(gzfile) {
@ -333,7 +333,7 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext
}
}
//open a plain old file
fceufp = new FCEUFILE();
fceufp->filename = fileToOpen;
@ -352,7 +352,7 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext
if(archive == "")
if(index != -1)
fceufp = FCEUD_OpenArchiveIndex(asr, fileToOpen, index);
else
else
fceufp = FCEUD_OpenArchive(asr, fileToOpen, 0);
else
fceufp = FCEUD_OpenArchive(asr, archive, &fname);
@ -571,7 +571,7 @@ std::string FCEU_MakeFName(int type, int id1, const char *cd1)
switch(type)
{
case FCEUMKF_MOVIE:
struct stat fileInfo;
struct stat fileInfo;
do {
if(odirs[FCEUIOD_MOVIES])
sprintf(ret,"%s"PSS"%s-%d.fm2",odirs[FCEUIOD_MOVIES],FileBase, id1);
@ -586,18 +586,18 @@ std::string FCEU_MakeFName(int type, int id1, const char *cd1)
mfnString = GetMfn();
else
mfnString = "";
if (mfnString.length() <= MAX_MOVIEFILENAME_LEN)
{
mfn = mfnString.c_str();
mfn = mfnString.c_str();
} else
{
//This caps the movie filename length before adding it to the savestate filename.
//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.fc%d",odirs[FCEUIOD_STATES],FileBase,mfn,id1);
@ -699,7 +699,7 @@ std::string FCEU_MakeFName(int type, int id1, const char *cd1)
sprintf(ret,"%s"PSS"fcs"PSS"%s*.fc?",BaseDirectory.c_str(),FileBase);
break;
}
//convert | to . for archive filenames.
return mass_replace(ret,"|",".");
}

View File

@ -20,7 +20,7 @@ struct FCEUFILE {
//a weirdly derived value.. maybe a path to a file, or maybe a path to a file which doesnt exist but which is in an archive in the same directory
std::string logicalPath;
//the filename of the archive (maybe "" if it is not in an archive)
std::string archiveFilename;
@ -43,7 +43,7 @@ struct FCEUFILE {
: stream(0)
, archiveCount(-1)
{}
~FCEUFILE()
{
if(stream) delete stream;
@ -58,8 +58,8 @@ struct FCEUFILE {
EMUFILE_MEMORY* ret = dynamic_cast<EMUFILE_MEMORY*>(stream);
if(ret) return ret;
//nope, we need to create it: copy the contents
//nope, we need to create it: copy the contents
ret = new EMUFILE_MEMORY(size);
stream->fread(ret->buf(),size);
delete stream;
@ -95,11 +95,11 @@ struct FileBaseInfo {
filebase = fb;
ext = ex;
}
};
struct ArchiveScanRecord
{
{
ArchiveScanRecord()
: type(-1)
, numFilesInArchive(0)

View File

@ -61,27 +61,27 @@ void SexyFilter(int32 *in, int32 *out, int32 count)
else vmul*=2; /* TODO: Increase volume in low quality sound rendering code itself */
while(count)
{
{
int64 ino=(int64)*in*vmul;
acc1+=((ino-acc1)*mul1)>>16;
acc2+=((ino-acc1-acc2)*mul2)>>16;
//printf("%d ",*in);
*in=0;
{
*in=0;
{
int32 t=(acc1-ino+acc2)>>16;
//if(t>32767 || t<-32768) printf("Flow: %d\n",t);
if(t>32767) t=32767;
if(t<-32768) t=-32768;
if(t<-32768) t=-32768;
*out=t;
}
in++;
out++;
count--;
}
in++;
out++;
count--;
}
}
/* Returns number of samples written to out. */
/* leftover is set to the number of samples that need to be copied
/* leftover is set to the number of samples that need to be copied
from the end of in to the beginning of in.
*/
@ -111,7 +111,7 @@ int32 NeoFilterSound(int32 *in, int32 *out, uint32 inlen, int32 *leftover)
int32 acc=0,acc2=0;
unsigned int c;
int32 *S,*D;
for(c=SQ2NCOEFFS,S=&in[(x>>16)-SQ2NCOEFFS],D=sq2coeffs;c;c--,D++)
{
acc+=(S[c]**D)>>6;
@ -120,8 +120,8 @@ int32 NeoFilterSound(int32 *in, int32 *out, uint32 inlen, int32 *leftover)
acc=((int64)acc*(65536-(x&65535))+(int64)acc2*(x&65535))>>(16+11);
*out=acc;
out++;
count++;
out++;
count++;
}
else
for(x=mrindex;x<max;x+=mrratio)
@ -129,14 +129,14 @@ int32 NeoFilterSound(int32 *in, int32 *out, uint32 inlen, int32 *leftover)
int32 acc=0,acc2=0;
unsigned int c;
const int32 *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)acc*(65536-(x&65535))+(int64)acc2*(x&65535))>>(16+11);
*out=acc;
out++;
count++;

View File

@ -77,7 +77,7 @@ enum ESIFC
SIFC_OEKAKIDS = 11,
SIFC_BWORLD = 12,
SIFC_TOPRIDER = 13,
SIFC_COUNT = SIFC_TOPRIDER
};
@ -118,12 +118,12 @@ struct FCEUGI
uint8 *name; //Game name, UTF8 encoding
int mappernum;
EGIT type;
EGIT type;
EGIV vidsys; //Current emulated video system;
ESI input[2]; //Desired input for emulated input ports 1 and 2; -1 for unknown desired input.
ESIFC inputfc; //Desired Famicom expansion port device. -1 for unknown desired input.
ESIS cspecial; //Special cart expansion: DIP switches, barcode reader, etc.
MD5DATA MD5;
//mbg 6/8/08 - ???

View File

@ -196,7 +196,7 @@
{0xcfb224e6,-1,1}, /* Dragon Ninja (J) [p1][!].nes */
{0xf46ef39a,37,-1}, /* Super Mario Bros. + Tetris + Nintendo World Cup (E) [!] */
{0x0f05ff0a,181,-1}, /* Seicross (redump) */
{0x054bd3e9,74,-1}, /* Di 4 Ci - Ji Qi Ren Dai Zhan (As) */
{0x496ac8f7,74,-1}, /* Ji Jia Zhan Shi (As) */
{0xae854cef,74,-1}, /* Jia A Fung Yun (Chinese) */
@ -224,7 +224,7 @@
{0x44c20420,199,-1},/* San Guo Zhi 2 (C) */
{0xa1dc16c0,116,-1},
{0xcc868d4e,149,-1}, /* 16 Mahjong [p1][!] */
{0x48239b42,146,-1}, /* Mahjong Companion (Sachen) [!] */
{0xb6a727fa,146,-1}, /* Papillion (As) [!] */
@ -236,22 +236,22 @@
{0x40dbf7a2,150,-1},
{0x5aefbc94,133,-1}, /* Jovial Race (Sachen) [a1][!] */
{0x58152b42,160,1}, /* Pipe 5 (Sachen) */
{0x22d6d5bd,4,1},
{0x6a03d3f3,114,-1},
{0x0d98db53,114,-1}, /* Pocahontas */
{0x4e7729ff,114,-1}, /* Super Donkey Kong */
{0x02c41438,176,-1}, /* Xing He Zhan Shi (C) */
{0xfb2b6b10,241,-1}, /* Fan Kong Jing Ying (Ch) */
{0xb5e83c9a,241,-1}, /* Xing Ji Zheng Ba (Ch) */
{0xfb2b6b10,241,-1}, /* Fan Kong Jing Ying (Ch) */
{0xb5e83c9a,241,-1}, /* Xing Ji Zheng Ba (Ch) */
{0x081caaff,163,-1}, /* Commandos (Ch) */
{0x0da5e32e,101,-1}, /* new Uruusey Yatsura */
{0x4f2f1846,-1,1}, /* Famista '89 - Kaimaku Han!! (J) */
{0x6c71feae,45,-1}, /* Kunio 8-in-1 */
// {0xbdbe3c96,238,-1}, /* Contra Fighter iNES version */
{0xd97c31b0,4,1}, //Rasaaru Ishii no Childs Quest (J)
{0,-1,-1}

View File

@ -612,8 +612,9 @@ static BMAPPINGLocal bmap[] = {
{"", 154, Mapper154_Init},
{"", 155, Mapper155_Init},
{"", 156, Mapper156_Init},
{"", 159, Mapper159_Init},
{"", 159, Mapper159_Init},
{"SA009", 160, SA009_Init},
{"", 162, UNLFS304_Init},
{"", 163, Mapper163_Init},
{"", 164, Mapper164_Init},
{"", 165, Mapper165_Init},

View File

@ -69,17 +69,17 @@ extern uint8 iNESIRQa;
#else
#endif
struct TMasterRomInfo
{
uint64 md5lower;
const char* params;
};
class TMasterRomInfoParams : public std::map<std::string,std::string>
{
public:
bool ContainsKey(const std::string& key) { return find(key) != end(); }
};
struct TMasterRomInfo
{
uint64 md5lower;
const char* params;
};
class TMasterRomInfoParams : public std::map<std::string,std::string>
{
public:
bool ContainsKey(const std::string& key) { return find(key) != end(); }
};
//mbg merge 6/29/06
extern uint8 *ROM;

View File

@ -157,7 +157,7 @@ static DECLFW(B4016)
//what's really going on. But who wants accuracy? ;)
//Seriously, though, this shouldn't be a problem.
//new comment:
//mbg 6/7/08 - I guess he means that the input drivers could track the strobing themselves
//I dont see why it is unreasonable here.
for(int i=0;i<2;i++)
@ -322,7 +322,7 @@ void FCEU_UpdateInput(void)
for(int port=0;port<2;port++)
joyports[port].driver->Update(port,joyports[port].ptr,joyports[port].attrib);
portFC.driver->Update(portFC.ptr,portFC.attrib);
}
}
if(GameInfo->type==GIT_VSUNI)
if(coinon) coinon--;
@ -331,7 +331,7 @@ void FCEU_UpdateInput(void)
NetplayUpdate(joy);
FCEUMOV_AddInputState();
//TODO - should this apply to the movie data? should this be displayed in the input hud?
if(GameInfo->type==GIT_VSUNI)
FCEU_VSUniSwap(&joy[0],&joy[1]);
@ -404,7 +404,7 @@ static void SetInputStuffFC()
{
switch(portFC.type)
{
case SIFC_NONE:
case SIFC_NONE:
portFC.driver=&DummyPortFC;
break;
case SIFC_ARKANOID:
@ -525,7 +525,7 @@ void FCEU_DoSimpleCommand(int cmd)
case FCEUNPCMD_FDSINSERT: FCEU_FDSInsert();break;
case FCEUNPCMD_FDSSELECT: FCEU_FDSSelect();break;
case FCEUNPCMD_VSUNICOIN: FCEU_VSUniCoin(); break;
case FCEUNPCMD_VSUNIDIP0:
case FCEUNPCMD_VSUNIDIP0:
case FCEUNPCMD_VSUNIDIP0+1:
case FCEUNPCMD_VSUNIDIP0+2:
case FCEUNPCMD_VSUNIDIP0+3:
@ -717,7 +717,7 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
{ EMUCMD_LOAD_STATE_SLOT_7, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 7", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_LOAD_STATE_SLOT_8, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 8", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_LOAD_STATE_SLOT_9, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 9", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MOVIE_RECORD_TO, EMUCMDTYPE_MOVIE, FCEUD_MovieRecordTo, 0, 0, "Record Movie To...", 0 },
{ EMUCMD_MOVIE_REPLAY_FROM, EMUCMDTYPE_MOVIE, FCEUD_MovieReplayFrom, 0, 0, "Play Movie From...", 0 },
{ EMUCMD_MOVIE_PLAY_FROM_BEGINNING, EMUCMDTYPE_MOVIE, FCEUI_MoviePlayFromBeginning, 0, 0, "Play Movie From Beginning", EMUCMDFLAG_TASEDITOR },
@ -813,7 +813,7 @@ void FCEUI_HandleEmuCommands(TestCommandState* testfn)
bool allow = true;
if(taseditor && !(FCEUI_CommandTable[i].flags & EMUCMDFLAG_TASEDITOR))
allow = false;
if(allow)
{
if (new_state == 1 && old_state == 0 && FCEUI_CommandTable[i].fn_on)
@ -1166,7 +1166,7 @@ void ToggleFullscreen()
#ifdef WIN32
extern int SetVideoMode(int fs); //adelikat: Yeah, I know, hacky
extern void UpdateCheckedMenuItems();
UpdateCheckedMenuItems();
changerecursive=1;

View File

@ -69,7 +69,7 @@ struct INPUTCFC
extern struct JOYPORT
{
JOYPORT(int _w)
: w(_w)
: w(_w)
{}
int w;
@ -111,7 +111,7 @@ enum EMUCMD
EMUCMD_SCREENSHOT,
EMUCMD_HIDE_MENU_TOGGLE,
//fixed: current command key handling handle only command table record index with
//the same as cmd enumerarot index, or else does wrong key mapping, fixed it but placed this enum here anyway
//the same as cmd enumerarot index, or else does wrong key mapping, fixed it but placed this enum here anyway
//...i returned it back.
//adelikat, try to find true cause of problem before reversing it
EMUCMD_EXIT,
@ -202,10 +202,10 @@ enum EMUCMD
EMUCMD_MISC_DISPLAY_BG_TOGGLE,
EMUCMD_MISC_DISPLAY_OBJ_TOGGLE,
EMUCMD_MISC_DISPLAY_LAGCOUNTER_TOGGLE,
//Currently Windows only------
EMUCMD_MISC_OPENTASEDITOR,
EMUCMD_TOOL_OPENMEMORYWATCH,
EMUCMD_TOOL_OPENMEMORYWATCH,
EMUCMD_TOOL_OPENCHEATS,
EMUCMD_TOOL_OPENDEBUGGER,
EMUCMD_TOOL_OPENHEX,

View File

@ -7,7 +7,7 @@
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
@ -73,11 +73,11 @@ extern "C"
#ifndef _MSC_VER
#define stricmp strcasecmp
#define strnicmp strncasecmp
#ifdef __GNUC__
#define __forceinline __attribute__ ((always_inline))
#else
#define __forceinline
#else
#define __forceinline
#endif
#endif
@ -92,7 +92,7 @@ struct LuaSaveState {
EMUFILE_MEMORY *data;
bool anonymous, persisted;
LuaSaveState()
: data(0)
: data(0)
, anonymous(false)
, persisted(false)
{}
@ -230,7 +230,7 @@ static const char* toCString(lua_State* L, int idx=0);
/**
* Resets emulator speed / pause states after script exit.
*/
static void FCEU_LuaOnStop()
static void FCEU_LuaOnStop()
{
luaRunning = FALSE;
for (int i = 0 ; i < 4 ; i++ ){
@ -319,7 +319,7 @@ static int emu_setrenderplanes(lua_State *L) {
// TODO: better enforcement, done in the same way as basicbot...
static int emu_speedmode(lua_State *L) {
const char *mode = luaL_checkstring(L,1);
if (strcasecmp(mode, "normal")==0) {
speedmode = SPEED_NORMAL;
} else if (strcasecmp(mode, "nothrottle")==0) {
@ -330,9 +330,9 @@ static int emu_speedmode(lua_State *L) {
speedmode = SPEED_MAXIMUM;
} else
luaL_error(L, "Invalid mode %s to emu.speedmode",mode);
//printf("new speed mode: %d\n", speedmode);
if (speedmode == SPEED_NORMAL)
if (speedmode == SPEED_NORMAL)
{
FCEUD_SetEmulationSpeed(EMUSPEED_NORMAL);
FCEUD_TurboOff();
@ -340,7 +340,7 @@ static int emu_speedmode(lua_State *L) {
else if (speedmode == SPEED_TURBO) //adelikat: Making turbo actually use turbo.
FCEUD_TurboOn(); //Turbo and max speed are two different results. Turbo employs frame skipping and sound bypassing if mute turbo option is enabled.
//This makes it faster but with frame skipping. Therefore, maximum is still a useful feature, in case the user is recording an avi or making screenshots (or something else that needs all frames)
else
else
FCEUD_SetEmulationSpeed(EMUSPEED_FASTEST); //TODO: Make nothrottle turn off throttle, or remove the option
return 0;
}
@ -351,7 +351,7 @@ static int emu_speedmode(lua_State *L) {
static int emu_poweron(lua_State *L) {
if (GameInfo)
FCEUI_PowerNES();
return 0;
}
@ -361,7 +361,7 @@ static int emu_poweron(lua_State *L) {
static int emu_softreset(lua_State *L) {
if (GameInfo)
FCEUI_ResetNES();
return 0;
}
@ -372,12 +372,12 @@ static int emu_softreset(lua_State *L) {
static int emu_frameadvance(lua_State *L) {
// We're going to sleep for a frame-advance. Take notes.
if (frameAdvanceWaiting)
if (frameAdvanceWaiting)
return luaL_error(L, "can't call emu.frameadvance() from here");
frameAdvanceWaiting = TRUE;
// Now we can yield to the main
// Now we can yield to the main
return lua_yield(L, 0);
@ -419,7 +419,7 @@ static int emu_message(lua_State *L) {
const char *msg = luaL_checkstring(L,1);
FCEU_DispMessage("%s",0, msg);
return 0;
}
@ -459,7 +459,7 @@ static int emu_registerexit(lua_State *L) {
}
static int emu_addgamegenie(lua_State *L) {
const char *msg = luaL_checkstring(L,1);
// Add a Game Genie code if it hasn't already been added
@ -469,7 +469,7 @@ static int emu_addgamegenie(lua_State *L) {
uint32 Caddr;
uint8 Cval;
int Ccompare, Ctype;
if (!FCEUI_DecodeGG(msg, &GGaddr, &GGval, &GGcomp)) {
luaL_error(L, "Failed to decode game genie code");
lua_pushboolean(L, false);
@ -486,7 +486,7 @@ static int emu_addgamegenie(lua_State *L) {
i = i + 1;
}
if (FCEUI_AddCheat(msg,GGaddr,GGval,GGcomp,1)) {
// Code was added
// Can't manage the display update the way I want, so I won't bother with it
@ -501,7 +501,7 @@ static int emu_addgamegenie(lua_State *L) {
}
static int emu_delgamegenie(lua_State *L) {
const char *msg = luaL_checkstring(L,1);
// Remove a Game Genie code. Very restrictive about deleted code.
@ -512,7 +512,7 @@ static int emu_delgamegenie(lua_State *L) {
uint32 Caddr;
uint8 Cval;
int Ccompare, Ctype;
if (!FCEUI_DecodeGG(msg, &GGaddr, &GGval, &GGcomp)) {
luaL_error(L, "Failed to decode game genie code");
lua_pushboolean(L, false);
@ -1122,7 +1122,7 @@ void CallRegisteredLuaSaveFunctions(int savestateNumber, LuaSaveData& saveData)
{
lua_settop(L, 0);
lua_getfield(L, LUA_REGISTRYINDEX, luaCallIDStrings[LUACALL_BEFORESAVE]);
if (lua_isfunction(L, -1))
{
lua_pushinteger(L, savestateNumber);
@ -1154,7 +1154,7 @@ void CallRegisteredLuaLoadFunctions(int savestateNumber, const LuaSaveData& save
{
lua_settop(L, 0);
lua_getfield(L, LUA_REGISTRYINDEX, luaCallIDStrings[LUACALL_AFTERLOAD]);
if (lua_isfunction(L, -1))
{
// since the scriptdata can be very expensive to load
@ -1224,7 +1224,7 @@ static int memory_readbyterange(lua_State *L) {
}
lua_pushlstring(L,buf,range_size);
return 1;
}
@ -1266,23 +1266,23 @@ static void toCStringConverter(lua_State* L, int i, char*& ptr, int& remaining)
case LUA_TBOOLEAN: APPENDPRINT lua_toboolean(L,i) ? "true" : "false" END break;
case LUA_TSTRING: APPENDPRINT "%s",lua_tostring(L,i) END break;
case LUA_TNUMBER: APPENDPRINT "%.12Lg",lua_tonumber(L,i) END break;
case LUA_TFUNCTION:
case LUA_TFUNCTION:
/*if((L->base + i-1)->value.gc->cl.c.isC)
{
//lua_CFunction func = lua_tocfunction(L, i);
//std::map<lua_CFunction, const char*>::iterator iter = s_cFuncInfoMap.find(func);
//if(iter == s_cFuncInfoMap.end())
goto defcase;
//APPENDPRINT "function(%s)", iter->second END
//APPENDPRINT "function(%s)", iter->second END
}
else
{
APPENDPRINT "function(" END
APPENDPRINT "function(" END
Proto* p = (L->base + i-1)->value.gc->cl.l.p;
int numParams = p->numparams + (p->is_vararg?1:0);
for (int n=0; n<p->numparams; n++)
{
APPENDPRINT "%s", getstr(p->locvars[n].varname) END
APPENDPRINT "%s", getstr(p->locvars[n].varname) END
if(n != numParams-1)
APPENDPRINT "," END
}
@ -1505,7 +1505,7 @@ static int copytable(lua_State *L)
lua_pushnil(L);
return 1;
}
lua_createtable(L, lua_objlen(L,1), 0);
int copyIndex = lua_gettop(L);
@ -2180,7 +2180,7 @@ static int input_get(lua_State *L) {
#endif
// mouse position in game screen pixel coordinates
extern void GetMouseData(uint32 (&md)[3]);
uint32 MouseData[3];
@ -2194,16 +2194,16 @@ static int input_get(lua_State *L) {
lua_pushinteger(L, y);
lua_setfield(L, -2, "ymouse");
lua_pushinteger(L, click);
lua_setfield(L, -2, "click");
lua_setfield(L, -2, "click");
return 1;
}
// table zapper.read
// table zapper.read
//int which unecessary because zapper is always controller 2
//Reads the zapper coordinates and a click value (1 if clicked, 0 if not, 2 if right click (but this is not used for zapper input)
static int zapper_read(lua_State *L){
lua_newtable(L);
int z = 0;
extern void GetMouseData(uint32 (&md)[3]); //adelikat: shouldn't this be ifdef'ed for Win32?
@ -2225,7 +2225,7 @@ static int zapper_read(lua_State *L){
GetMouseData (MouseData);
x = MouseData[0];
y = MouseData[1];
click = MouseData[2];
click = MouseData[2];
if (click > 1)
click = 1; //adelikat: This is zapper.read() thus should only give valid zapper input (instead of simply mouse input
}
@ -2234,7 +2234,7 @@ static int zapper_read(lua_State *L){
lua_pushinteger(L, y);
lua_setfield(L, -2, "y");
lua_pushinteger(L, click);
lua_setfield(L, -2, "fire");
lua_setfield(L, -2, "fire");
return 1;
}
@ -2248,17 +2248,17 @@ static int joy_get_internal(lua_State *L, bool reportUp, bool reportDown) {
// Reads the joypads as inputted by the user
int which = luaL_checkinteger(L,1);
if (which < 1 || which > 4) {
luaL_error(L,"Invalid input port (valid range 1-4, specified %d)", which);
}
// Use the OS-specific code to do the reading.
extern SFORMAT FCEUCTRL_STATEINFO[];
uint8 buttons = ((uint8 *) FCEUCTRL_STATEINFO[1].v)[which - 1];
lua_newtable(L);
int i;
for (i = 0; i < 8; i++) {
bool pressed = (buttons & (1<<i))!=0;
@ -2267,7 +2267,7 @@ static int joy_get_internal(lua_State *L, bool reportUp, bool reportDown) {
lua_setfield(L, -2, button_mappings[i]);
}
}
return 1;
}
// joypad.get(which)
@ -2305,7 +2305,7 @@ static int joypad_getimmediate(lua_State *L)
#ifdef WIN32
extern uint32 GetGamepadPressedImmediate();
uint8 buttons = GetGamepadPressedImmediate() >> ((which - 1) * 8);
lua_newtable(L);
for (int i = 0; i < 8; ++i)
{
@ -2322,7 +2322,7 @@ static int joypad_getimmediate(lua_State *L)
// joypad.set(int which, table buttons)
//
// Sets the given buttons to be pressed during the next
// frame advance. The table should have the right
// frame advance. The table should have the right
// keys (no pun intended) set.
/*FatRatKnight: I changed some of the logic.
Now with 4 options!*/
@ -2345,9 +2345,9 @@ static int joypad_set(lua_State *L) {
int i;
for (i=0; i < 8; i++) {
lua_getfield(L, 2, button_mappings[i]);
//Button is not nil, so find out if it is true/false
if (!lua_isnil(L,-1))
if (!lua_isnil(L,-1))
{
if (lua_toboolean(L,-1)) //True or string
luajoypads2[which-1] |= 1 << i;
@ -2361,28 +2361,28 @@ static int joypad_set(lua_State *L) {
}
lua_pop(L,1);
}
return 0;
}
// Helper function to convert a savestate object to the filename it represents.
static const char *savestateobj2filename(lua_State *L, int offset) {
// First we get the metatable of the indicated object
int result = lua_getmetatable(L, offset);
if (!result)
luaL_error(L, "object not a savestate object");
// Also check that the type entry is set
lua_getfield(L, -1, "__metatable");
if (strcmp(lua_tostring(L,-1), "FCEU Savestate") != 0)
luaL_error(L, "object not a savestate object");
lua_pop(L,1);
// Now, get the field we want
lua_getfield(L, -1, "filename");
// Return it
return lua_tostring(L, -1);
}
@ -2406,7 +2406,7 @@ static int savestate_gc(lua_State *L) {
//// Delete the file
//remove(filename);
//
// We exit, and the garbage collector takes care of the rest.
return 0;
}
@ -2443,22 +2443,22 @@ static int savestate_create_aliased(lua_State *L, bool newnumbering) {
// Also makes it persistent, but files are like that
if (CheckFileExists(ss->filename.c_str()))
ss->ensureLoad();
}
else {
//char tempbuf[100] = "snluaXXXXXX";
//filename = mktemp(tempbuf);
//doesnt work -^
//mbg 8/13/08 - this needs to be this way. we'll make a better system later:
ss->filename = tempnam(NULL, "snlua");
ss->anonymous = true;
}
// The metatable we use, protected from Lua and contains garbage collection info and stuff.
lua_newtable(L);
//// First, we must protect it
lua_pushstring(L, "FCEU Savestate");
lua_setfield(L, -2, "__metatable");
@ -2467,13 +2467,13 @@ static int savestate_create_aliased(lua_State *L, bool newnumbering) {
//// Now we need to save the file itself.
//lua_pushstring(L, filename.c_str());
//lua_setfield(L, -2, "filename");
// If it's an anonymous savestate, we must delete the file from disk should it be gargage collected
//if (which < 0) {
lua_pushcfunction(L, savestate_gc);
lua_setfield(L, -2, "__gc");
//}
// Set the metatable
lua_setmetatable(L, -2);
@ -2567,7 +2567,7 @@ static int savestate_load(lua_State *L) {
}
static int savestate_registersave(lua_State *L) {
lua_settop(L,1);
if (!lua_isnil(L,1))
luaL_checktype(L, 1, LUA_TFUNCTION);
@ -2619,7 +2619,7 @@ static int savestate_loadscriptdata(lua_State *L) {
//
// Gets the frame counter
int emu_framecount(lua_State *L) {
lua_pushinteger(L, FCEUMOV_GetFrame());
return 1;
}
@ -2691,7 +2691,7 @@ static int movie_rerecordcounting(lua_State *L) {
static int movie_stop(lua_State *L) {
if (!FCEUMOV_IsRecording() && !FCEUMOV_IsPlaying())
luaL_error(L, "no movie");
FCEUI_StopMovie();
return 0;
@ -2729,7 +2729,7 @@ static int movie_rerecordcount (lua_State *L) {
luaL_error(L, "No movie loaded.");
lua_pushinteger(L, FCEUI_GetMovieRerecordCount());
return 1;
}
@ -2761,7 +2761,7 @@ static int movie_getreadonly (lua_State *L) {
static int movie_setreadonly (lua_State *L) {
bool which = (lua_toboolean( L, 1 ) == 1);
FCEUI_SetMovieToggleReadOnly(which);
return 0;
}
@ -2772,7 +2772,7 @@ static int movie_getname (lua_State *L) {
if (!FCEUMOV_IsRecording() && !FCEUMOV_IsPlaying() && !FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
luaL_error(L, "No movie loaded.");
std::string name = FCEUI_GetMovieName();
lua_pushstring(L, name.c_str());
return 1;
@ -2782,10 +2782,10 @@ static int movie_getname (lua_State *L) {
//
//returns the filename of movie loaded with no path
static int movie_getfilename (lua_State *L) {
if (!FCEUMOV_IsRecording() && !FCEUMOV_IsPlaying() && !FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
luaL_error(L, "No movie loaded.");
std::string name = FCEUI_GetMovieName();
int x = name.find_last_of("/\\") + 1;
if (x)
@ -2976,9 +2976,9 @@ static void gui_drawline_internal(int x1, int y1, int x2, int y2, bool lastPixel
// draw a rect on gui_data
static void gui_drawbox_internal(int x1, int y1, int x2, int y2, uint32 colour) {
if (x1 > x2)
if (x1 > x2)
swap<int>(x1, x2);
if (y1 > y2)
if (y1 > y2)
swap<int>(y1, y2);
if (x1 < 0)
x1 = -1;
@ -3142,7 +3142,7 @@ static inline bool str2colour(uint32 *colour, lua_State *L, const char *str) {
luaL_error(L, "palettes range from P00 to P7F");
return false;
}
FCEUD_GetPalette(palette + 0x80, &tr, &tg, &tb);
// Feeding it RGBA, because it will spit out the right value for me
*colour = LUA_BUILD_PIXEL(tr, tg, tb, 0xFF);
@ -3266,11 +3266,11 @@ static int gui_pixel(lua_State *L) {
return 0;
}
// Usage:
// Usage:
// local r,g,b,a = gui.getpixel(255, 223)
// Gets the LUA set pixel color
static int gui_getpixel(lua_State *L) {
int x = luaL_checkinteger(L, 1);
int y = luaL_checkinteger(L,2);
@ -3288,9 +3288,9 @@ static int gui_getpixel(lua_State *L) {
lua_pushinteger(L, 0);
return 4;
}
//uint8 *dst = (uint8*) &gui_data[(y*LUA_SCREEN_WIDTH+x)*4];
//uint32 color = *(uint32*) &gui_data[(y*LUA_SCREEN_WIDTH+x)*4];
LUA_DECOMPOSE_PIXEL(*(uint32*) &gui_data[(y*LUA_SCREEN_WIDTH+x)*4], a, r, g, b);
@ -3303,12 +3303,12 @@ static int gui_getpixel(lua_State *L) {
}
// Usage:
// Usage:
// local r,g,b,palette = gui.getpixel(255, 255)
// Gets the screen pixel color
// Palette will be 254 on error
static int emu_getscreenpixel(lua_State *L) {
int x = luaL_checkinteger(L, 1);
int y = luaL_checkinteger(L,2);
bool getemuscreen = (lua_toboolean(L,3) == 1);
@ -3325,7 +3325,7 @@ static int emu_getscreenpixel(lua_State *L) {
lua_pushinteger(L, 254);
return 4;
}
if (!XBuf) {
lua_pushinteger(L, 0);
lua_pushinteger(L, 0);
@ -3333,7 +3333,7 @@ static int emu_getscreenpixel(lua_State *L) {
lua_pushinteger(L, 254);
return 4;
}
uint32 pixelinfo = GetScreenPixel(x,y,getemuscreen);
LUA_DECOMPOSE_PIXEL(pixelinfo, palette, r, g, b);
@ -3380,9 +3380,9 @@ static int gui_box(lua_State *L) {
fillcolor = gui_optcolour(L,5,LUA_BUILD_PIXEL(63, 255, 255, 255));
outlinecolor = gui_optcolour(L,6,LUA_BUILD_PIXEL(255, LUA_PIXEL_R(fillcolor), LUA_PIXEL_G(fillcolor), LUA_PIXEL_B(fillcolor)));
if (x1 > x2)
if (x1 > x2)
std::swap(x1, x2);
if (y1 > y2)
if (y1 > y2)
std::swap(y1, y2);
gui_prepare();
@ -3437,7 +3437,7 @@ static int gui_parsecolor(lua_State *L)
// Causes FCEUX to write a screenshot to a file based on a received filename, caution: will overwrite existing screenshot files
//
// Unconditionally retrns 1; any failure in taking a screenshot would be reported on-screen
// from the function ReallySnap().
// from the function ReallySnap().
static int gui_savescreenshotas(lua_State *L) {
const char* name = NULL;
size_t l;
@ -3454,10 +3454,10 @@ static int gui_savescreenshotas(lua_State *L) {
// gui.savescreenshot()
//
// Causes FCEUX to write a screenshot to a file as if the user pressed the associated hotkey.
// Causes FCEUX to write a screenshot to a file as if the user pressed the associated hotkey.
//
// Unconditionally retrns 1; any failure in taking a screenshot would be reported on-screen
// from the function ReallySnap().
// from the function ReallySnap().
static int gui_savescreenshot(lua_State *L) {
FCEUI_SaveSnapshot();
return 1;
@ -3529,7 +3529,7 @@ static int gui_setopacity(lua_State *L) {
// gui.transparency(int strength)
//
// 0 = solid,
// 0 = solid,
static int gui_transparency(lua_State *L) {
double trans = luaL_checknumber(L,1);
transparencyModifier = (int) ((4.0 - trans) / 4.0 * 255);
@ -3541,7 +3541,7 @@ static int gui_transparency(lua_State *L) {
static const uint32 Small_Font_Data[] =
{
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 32
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 32
0x00000000, 0x00000300, 0x00000400, 0x00000500, 0x00000000, 0x00000700, 0x00000000, // 33 !
0x00000000, 0x00040002, 0x00050003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 34 "
0x00000000, 0x00040002, 0x00050403, 0x00060004, 0x00070605, 0x00080006, 0x00000000, // 35 #
@ -4149,18 +4149,18 @@ static int gui_register(lua_State *L) {
// First set up the stack.
lua_settop(L,1);
// Verify the validity of the entry
if (!lua_isnil(L,1))
luaL_checktype(L, 1, LUA_TFUNCTION);
// Get the old value
lua_getfield(L, LUA_REGISTRYINDEX, guiCallbackTable);
// Save the new value
lua_pushvalue(L,1);
lua_setfield(L, LUA_REGISTRYINDEX, guiCallbackTable);
// The old value is on top of the stack. Return it.
return 1;
@ -4168,12 +4168,12 @@ static int gui_register(lua_State *L) {
// table sound.get()
static int sound_get(lua_State *L)
{
{
extern ENVUNIT EnvUnits[3];
extern int CheckFreq(uint32 cf, uint8 sr);
extern int32 curfreq[2];
extern uint8 PSG[0x10];
extern int32 lengthcount[4];
extern int32 lengthcount[4];
extern uint8 TriCount;
extern const uint32 *NoiseFreqTable;
extern int32 DMCPeriod;
@ -4680,35 +4680,35 @@ static int doPopup(lua_State *L, const char* deftype, const char* deficon) {
return luaL_error(L, "invalid popup type \"%s\"", type);
// Can we find a copy of xmessage? Search the path.
char *path = strdup(getenv("PATH"));
char *current = path;
char *colon;
int found = 0;
while (current) {
colon = strchr(current, ':');
// Clip off the colon.
*colon++ = 0;
int len = strlen(current);
char *filename = (char*)FCEU_dmalloc(len + 12); // always give excess
snprintf(filename, len+12, "%s/xmessage", current);
if (access(filename, X_OK) == 0) {
free(filename);
found = 1;
break;
}
// Failed, move on.
current = colon;
free(filename);
}
free(path);
@ -4719,13 +4719,13 @@ static int doPopup(lua_State *L, const char* deftype, const char* deficon) {
pid = fork();
if (pid == 0) {// I'm the virgin sacrifice
// I'm gonna be dead in a matter of microseconds anyways, so wasted memory doesn't matter to me.
// Go ahead and abuse strdup.
char * parameters[] = {"xmessage", "-buttons", t, strdup(str), NULL};
execvp("xmessage", parameters);
// Aw shitty
perror("exec xmessage");
exit(1);
@ -4738,13 +4738,13 @@ static int doPopup(lua_State *L, const char* deftype, const char* deficon) {
int res = waitpid(pid, &r, 0);
if (res < 0) // wtf?
goto use_console;
// The return value gets copmlicated...
if (!WIFEXITED(r)) {
luaL_error(L, "don't screw with my xmessage process!");
}
r = WEXITSTATUS(r);
// We assume it's worked.
if (r == 0)
{
@ -4762,7 +4762,7 @@ static int doPopup(lua_State *L, const char* deftype, const char* deficon) {
lua_pushstring(L, "cancel");
return 1;
}
// Wtf?
return luaL_error(L, "popup failed due to unknown results involving xmessage (%d)", r);
}
@ -4796,7 +4796,7 @@ use_console:
}
fprintf(stderr, "(%s): ", t);
fgets(buffer, sizeof(buffer), stdin);
// Check if the option is in the list
if (strchr(t, tolower(buffer[0]))) {
switch (tolower(buffer[0])) {
@ -4811,12 +4811,12 @@ use_console:
return 1;
default:
luaL_error(L, "internal logic error in console based prompts for gui.popup");
}
}
// We fell through, so we assume the user answered wrong and prompt again.
}
// Nothing here, since the only way out is in the loop.
@ -5080,7 +5080,7 @@ static int bitbit(lua_State *L)
// The function called periodically to ensure Lua doesn't run amok.
static void FCEU_LuaHookFunction(lua_State *L, lua_Debug *dbg) {
if (numTries-- == 0) {
int kill = 0;
@ -5089,7 +5089,7 @@ static void FCEU_LuaHookFunction(lua_State *L, lua_Debug *dbg) {
// Uh oh
//StopSound(); //mbg merge 7/23/08
int ret = MessageBox(hAppWnd, "The Lua script running has been running a long time. It may have gone crazy. Kill it?\n\n(No = don't check anymore either)", "Lua Script Gone Nuts?", MB_YESNO);
if (ret == IDYES) {
kill = 1;
}
@ -5104,7 +5104,7 @@ static void FCEU_LuaHookFunction(lua_State *L, lua_Debug *dbg) {
kill = 1;
break;
}
if (buffer[0] == 'n' || buffer[0] == 'N')
break;
}
@ -5118,7 +5118,7 @@ static void FCEU_LuaHookFunction(lua_State *L, lua_Debug *dbg) {
// else, kill the debug hook.
lua_sethook(L, NULL, 0, 0);
}
}
@ -5172,7 +5172,7 @@ static int emu_exec_time(lua_State *L)
SetEvent(goEvent);
//wait for the lua thread to finish, but no more than the specified amount of time
WaitForSingleObject(readyEvent,count);
//kill lua (if it hasnt already been killed)
lua_sethook(L, emu_exec_time_hook, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
@ -5181,7 +5181,7 @@ static int emu_exec_time(lua_State *L)
//clear the lua thread-killer
lua_sethook(L, NULL, 0, 0);
CloseHandle(readyEvent);
CloseHandle(goEvent);
CloseHandle(thread);
@ -5192,7 +5192,7 @@ static int emu_exec_time(lua_State *L)
#else
static int emu_exec_time(lua_State *L) { return 0; }
#endif
static const struct luaL_reg emulib [] = {
{"poweron", emu_poweron},
@ -5244,7 +5244,7 @@ static const struct luaL_reg memorylib [] = {
{"writebyte", memory_writebyte},
{"getregister", memory_getregister},
{"setregister", memory_setregister},
// memory hooks
{"registerwrite", memory_registerwrite},
//{"registerread", memory_registerread}, TODO
@ -5334,7 +5334,7 @@ static const struct luaL_reg movielib[] = {
static const struct luaL_reg guilib[] = {
{"pixel", gui_pixel},
{"getpixel", gui_getpixel},
{"line", gui_line},
@ -5366,13 +5366,13 @@ static const struct luaL_reg guilib[] = {
};
static const struct luaL_reg soundlib[] = {
{"get", sound_get},
{NULL,NULL}
};
static const struct luaL_reg taseditorlib[] = {
{"registerauto", taseditor_registerauto},
{"registermanual", taseditor_registermanual},
{"engaged", taseditor_engaged},
@ -5430,7 +5430,7 @@ void FCEU_LuaFrameBoundary()
// Our function needs calling
lua_settop(L,0);
lua_getfield(L, LUA_REGISTRYINDEX, frameAdvanceThread);
lua_State *thread = lua_tothread(L,1);
lua_State *thread = lua_tothread(L,1);
// Lua calling C must know that we're busy inside a frame boundary
frameBoundary = TRUE;
@ -5438,7 +5438,7 @@ void FCEU_LuaFrameBoundary()
numTries = 1000;
int result = lua_resume(thread, 0);
if (result == LUA_YIELD) {
// Okay, we're fine with that.
} else if (result != 0) {
@ -5446,7 +5446,7 @@ void FCEU_LuaFrameBoundary()
FCEU_LuaOnStop();
lua_pushnil(L);
lua_setfield(L, LUA_REGISTRYINDEX, frameAdvanceThread);
// Error?
#ifdef WIN32
//StopSound();//StopSound(); //mbg merge 7/23/08
@ -5499,14 +5499,14 @@ int FCEU_LoadLuaCode(const char *filename, const char *arg) {
luaexiterrorcount = 8;
if (!L) {
L = lua_open();
luaL_openlibs(L);
#if defined( WIN32) && !defined(NEED_MINGW_HACKS)
iuplua_open(L);
iupcontrolslua_open(L);
luaopen_winapi(L);
//luasocket - yeah, have to open this in a weird way
lua_pushcfunction(L,luaopen_socket_core);
lua_setglobal(L,"tmp");
@ -5567,8 +5567,8 @@ int FCEU_LoadLuaCode(const char *filename, const char *arg) {
// We make our thread NOW because we want it at the bottom of the stack.
// If all goes wrong, we let the garbage collector remove it.
lua_State *thread = lua_newthread(L);
// Load the data
// Load the data
int result = luaL_loadfile(L,filename);
if (result) {
@ -5587,13 +5587,13 @@ int FCEU_LoadLuaCode(const char *filename, const char *arg) {
#ifdef WIN32
AddRecentLuaFile(filename); //Add the filename to our recent lua menu
#endif
// Get our function into it
lua_xmove(L, thread, 1);
// Save the thread to the registry. This is why I make the thread FIRST.
lua_setfield(L, LUA_REGISTRYINDEX, frameAdvanceThread);
// Initialize settings
luaRunning = TRUE;
@ -5752,7 +5752,7 @@ void FCEU_LuaGui(uint8 *XBuf)
// First, check if we're being called by anybody
lua_getfield(L, LUA_REGISTRYINDEX, guiCallbackTable);
if (lua_isfunction(L, -1)) {
// We call it now
numTries = 1000;
@ -5767,7 +5767,7 @@ void FCEU_LuaGui(uint8 *XBuf)
// This is grounds for trashing the function
lua_pushnil(L);
lua_setfield(L, LUA_REGISTRYINDEX, guiCallbackTable);
}
}

View File

@ -46,7 +46,7 @@ extern bool emulator_must_run_taseditor;
using namespace std;
#define MOVIE_VERSION 3
#define MOVIE_VERSION 3
extern char FileBase[];
extern bool AutoSS; //Declared in fceu.cpp, keeps track if a auto-savestate has been made
@ -127,7 +127,7 @@ void MovieData::insertEmpty(int at, int frames)
void MovieData::cloneRegion(int at, int frames)
{
if (at < 0) return;
records.insert(records.begin() + at, frames, MovieRecord());
for(int i = 0; i < frames; i++)
@ -142,7 +142,7 @@ MovieRecord::MovieRecord()
}
void MovieRecord::clear()
{
{
commands = 0;
*(uint32*)&joysticks = 0;
memset(zappers, 0, sizeof(zappers));
@ -151,7 +151,7 @@ void MovieRecord::clear()
bool MovieRecord::Compare(MovieRecord& compareRec)
{
//Joysticks, Zappers, and commands
if (this->commands != compareRec.commands)
return false;
if ((*(uint32*)&(this->joysticks)) != (*(uint32*)&(compareRec.joysticks)))
@ -160,7 +160,7 @@ bool MovieRecord::Compare(MovieRecord& compareRec)
return false;
/*
if (this->joysticks != compareRec.joysticks)
if (this->joysticks != compareRec.joysticks)
return false;
//if new commands are ever recordable, they need to be added here if we go with this method
@ -168,7 +168,7 @@ bool MovieRecord::Compare(MovieRecord& compareRec)
if(this->command_power() != compareRec.command_power()) return false;
if(this->command_fds_insert() != compareRec.command_fds_insert()) return false;
if(this->command_fds_select() != compareRec.command_fds_select()) return false;
if (this->zappers[0].x != compareRec.zappers[0].x) return false;
if (this->zappers[0].y != compareRec.zappers[0].y) return false;
if (this->zappers[0].zaphit != compareRec.zappers[0].zaphit) return false;
@ -254,7 +254,7 @@ void MovieRecord::parse(MovieData* md, EMUFILE* is)
zappers[port].bogo = uint32DecFromIstream(is);
zappers[port].zaphit = uint64DecFromIstream(is);
}
is->fgetc(); //eat the pipe
}
}
@ -358,7 +358,7 @@ void MovieRecord::dump(MovieData* md, EMUFILE* os, int index)
}
os->fputc('|');
}
//(no fcexp data is logged right now)
os->fputc('|');
@ -460,10 +460,10 @@ int MovieData::dump(EMUFILE *os, bool binary)
for(uint32 i=0;i<subtitles.size();i++)
os->fprintf("subtitle %s\n" , subtitles[i].c_str() );
if(binary)
os->fprintf("binary 1\n" );
if(savestate.size())
os->fprintf("savestate %s\n" , BytesToString(&savestate[0],savestate.size()).c_str() );
@ -602,7 +602,7 @@ bool LoadFM2(MovieData& movieData, EMUFILE* fp, int size, bool stopAfterHeader)
fp->fread(buf,9);
fp->fseek(curr,SEEK_SET);
if(fp->fail()) return false;
if(memcmp(buf,"version 3",9))
if(memcmp(buf,"version 3",9))
return false;
std::string key,value;
@ -633,7 +633,7 @@ bool LoadFM2(MovieData& movieData, EMUFILE* fp, int size, bool stopAfterHeader)
case NEWLINE:
if(isnewline) goto done;
if(iswhitespace) goto done;
if(isrecchar)
if(isrecchar)
goto dorecord;
//must be a key
key = "";
@ -723,7 +723,7 @@ static void StopRecording()
{
FCEU_DispMessage("Movie recording stopped.",0);
movieMode = MOVIEMODE_INACTIVE;
closeRecordingMovie();
}
@ -731,7 +731,7 @@ void FCEUI_StopMovie()
{
if(suppressMovieStop)
return;
if(movieMode == MOVIEMODE_PLAY || movieMode == MOVIEMODE_FINISHED)
StopPlayback();
else if(movieMode == MOVIEMODE_RECORD)
@ -828,7 +828,7 @@ bool FCEUI_LoadMovie(const char *fname, bool _read_only, int _pauseframe)
//--------------
currMovieData = MovieData();
strcpy(curMovieFilename, fname);
FCEUFILE *fp = FCEU_fopen(fname,0,"rb",0);
if (!fp) return false;
@ -889,7 +889,7 @@ bool FCEUI_LoadMovie(const char *fname, bool _read_only, int _pauseframe)
FCEU_DispMessage("Replay started Read-Only.",0);
else
FCEU_DispMessage("Replay started Read+Write.",0);
#ifdef WIN32
SetMainWindowText();
#endif
@ -901,7 +901,7 @@ bool FCEUI_LoadMovie(const char *fname, bool _read_only, int _pauseframe)
LoggingEnabled = 2;
}
#endif
return true;
}
@ -955,7 +955,7 @@ void FCEUI_SaveMovie(const char *fname, EMOVIE_FLAG flags, std::wstring author)
movieMode = MOVIEMODE_RECORD;
movie_readonly = false;
currRerecordCount = 0;
FCEU_DispMessage("Movie recording started.",0);
}
@ -1009,7 +1009,7 @@ void FCEUMOV_AddInputState()
else
{
MovieRecord* mr = &currMovieData.records[currFrameCounter];
//reset and power cycle if necessary
if(mr->command_power())
PowerNES();
@ -1033,13 +1033,13 @@ void FCEUMOV_AddInputState()
}
}
//pause the movie at a specified frame
//pause the movie at a specified frame
if(FCEUMOV_ShouldPause() && FCEUI_EmulationPaused()==0)
{
FCEUI_ToggleEmulationPause();
FCEU_DispMessage("Paused at specified movie frame",0);
}
}
else if(movieMode == MOVIEMODE_RECORD)
{
@ -1067,7 +1067,7 @@ void FCEUMOV_AddInputState()
}
//TODO
//TODO
void FCEUMOV_AddCommand(int cmd)
{
// do nothing if not recording a movie
@ -1093,7 +1093,7 @@ void FCEU_DrawMovies(uint8 *XBuf)
int color = 0x20;
if(movieMode == MOVIEMODE_PLAY)
sprintf(counterbuf,"%d/%d",currFrameCounter,currMovieData.records.size());
else if(movieMode == MOVIEMODE_RECORD)
else if(movieMode == MOVIEMODE_RECORD)
sprintf(counterbuf,"%d",currFrameCounter);
else if (movieMode == MOVIEMODE_FINISHED)
{
@ -1110,9 +1110,9 @@ void FCEU_DrawMovies(uint8 *XBuf)
}
if(rerecord_display && movieMode != MOVIEMODE_INACTIVE)
{
char counterbuf[32] = {0};
char counterbuf[32] = {0};
sprintf(counterbuf,"%d",currMovieData.rerecordCount);
if(counterbuf[0])
DrawTextTrans(ClipSidesOffset+XBuf+FCEU_TextScanlineOffsetFromBottom(50)+1, 256, (uint8*)counterbuf, 0x28+0x80);
}
@ -1121,15 +1121,15 @@ void FCEU_DrawMovies(uint8 *XBuf)
void FCEU_DrawLagCounter(uint8 *XBuf)
{
uint8 color;
if (lagFlag) color = 0x16+0x80; //If currently lagging display red
else color = 0x2A+0x80; //else display green
if(lagCounterDisplay)
{
char counterbuf[32] = {0};
char counterbuf[32] = {0};
sprintf(counterbuf,"%d",lagCounter);
if(counterbuf[0])
DrawTextTrans(ClipSidesOffset+XBuf+FCEU_TextScanlineOffsetFromBottom(40)+1, 256, (uint8*)counterbuf, color); //0x20+0x80
}
@ -1143,7 +1143,7 @@ int FCEUMOV_WriteState(EMUFILE* os)
else return 0;
}
// returns
// returns
int CheckTimelines(MovieData& stateMovie, MovieData& currMovie)
{
// end_frame = min(urrMovie.records.size(), stateMovie.records.size(), currFrameCounter)
@ -1198,7 +1198,7 @@ bool FCEUMOV_ReadState(EMUFILE* is, uint32 size)
extern bool FCEU_state_loading_old_format;
if(FCEU_state_loading_old_format) {
if(movieMode == MOVIEMODE_PLAY || movieMode == MOVIEMODE_RECORD || movieMode == MOVIEMODE_FINISHED) {
//FCEUI_StopMovie(); //No reason to stop the movie, nothing destructive has happened yet.
//FCEUI_StopMovie(); //No reason to stop the movie, nothing destructive has happened yet.
FCEU_PrintError("You have tried to use an old savestate while playing a movie. This is unsupported (since the old savestate has old-format movie data in it which can't be converted on the fly)");
}
}
@ -1210,7 +1210,7 @@ bool FCEUMOV_ReadState(EMUFILE* is, uint32 size)
//fully conforms to the savestate logic documented in the Laws of TAS
//http://tasvideos.org/LawsOfTAS/OnSavestates.html
//----------------
/*
Playback or Recording + Read-only
@ -1228,7 +1228,7 @@ bool FCEUMOV_ReadState(EMUFILE* is, uint32 size)
+ failstate - loadstate attempt cancelled, movie can resume if user has backup savesattes enabled, else stop movie
* All error checks have passed, state will be loaded
* Movie contained in the savestate will be discarded
* Movie is now in Playback mode
* Movie is now in Playback mode
Playback, Recording + Read+write
@ -1236,23 +1236,23 @@ bool FCEUMOV_ReadState(EMUFILE* is, uint32 size)
o on error: a message informing that the savestate doesn't belong to this movie. This is a GUID mismatch error. Give user a choice to load it anyway.
+ failstate: if use declines, loadstate attempt canceled, movie can resume as if not attempted (stop movie if resume fails)canceled, movie can resume if backup savestates enabled else stopmovie
* Check that savestate framcount <= savestate movie length. If not this is a post-movie savestate
o on post-movie: See post-movie event section.
o on post-movie: See post-movie event section.
* savestate passed all error checks and will now be loaded in its entirety and replace movie (note: there will be no truncation yet)
* current framecount will be set to savestate framecount
* on the next frame of input, movie will be truncated to framecount
o (note: savestate-movie can be a future event of the movie timeline, or a completely new timeline and it is still allowed)
o (note: savestate-movie can be a future event of the movie timeline, or a completely new timeline and it is still allowed)
* Rerecord count of movie will be incremented
* Movie is now in record mode
* Movie is now in record mode
Post-movie savestate event
* Whan a savestate is loaded and is determined that the savestate-movie length is less than the savestate framecount then it is a post-movie savestate. These occur when a savestate was made during Movie Finished mode.
* Whan a savestate is loaded and is determined that the savestate-movie length is less than the savestate framecount then it is a post-movie savestate. These occur when a savestate was made during Movie Finished mode.
* If read+write, the entire savestate movie will be loaded and replace current movie.
* If read-only, the savestate movie will be discarded
* Mode will be switched to Move Finished
* Savestate will be loaded
* Current framecount changes to savestate framecount
* User will have control of input as if Movie inactive mode
* User will have control of input as if Movie inactive mode
*/
if(movieMode == MOVIEMODE_PLAY || movieMode == MOVIEMODE_RECORD || movieMode == MOVIEMODE_FINISHED)
@ -1345,7 +1345,7 @@ bool FCEUMOV_ReadState(EMUFILE* is, uint32 size)
{
//This is a post movie savestate, handle it differently
//Replace movie contents but then switch to movie finished mode
currMovieData = tempMovieData;
currMovieData = tempMovieData;
openRecordingMovie(curMovieFilename);
currMovieData.dump(osRecordingMovie, false/*currMovieData.binaryFlag*/);
FinishPlayback();
@ -1355,7 +1355,7 @@ bool FCEUMOV_ReadState(EMUFILE* is, uint32 size)
//truncate before we copy, just to save some time, unless the user selects a full copy option
if (!fullSaveStateLoads)
tempMovieData.truncateAt(currFrameCounter); //we can only assume this here since we have checked that the frame counter is not greater than the movie data
currMovieData = tempMovieData;
currMovieData = tempMovieData;
#ifdef _S9XLUA_H
if(!FCEU_LuaRerecordCountSkip())
currRerecordCount++;
@ -1370,7 +1370,7 @@ bool FCEUMOV_ReadState(EMUFILE* is, uint32 size)
}
}
}
load_successful = true;
return true;
@ -1459,19 +1459,19 @@ void FCEUI_SetMovieToggleReadOnly(bool which)
void FCEUI_MovieToggleReadOnly()
{
char message[260];
if(movie_readonly)
strcpy(message, "Movie is now Read+Write");
else
{
strcpy(message, "Movie is now Read-Only");
}
if(movieMode == MOVIEMODE_INACTIVE)
strcat(message, " (no movie)");
else if (movieMode == MOVIEMODE_FINISHED)
strcat(message, " (finished)");
FCEU_DispMessage(message,0);
movie_readonly = !movie_readonly;
}
@ -1489,7 +1489,7 @@ void FCEUI_MoviePlayFromBeginning(void)
{
movie_readonly=true;
movieMode = MOVIEMODE_PLAY;
poweron(true);
poweron(true);
currFrameCounter=0;
FCEU_DispMessage("Movie is now Read-Only. Playing from beginning.",0);
}
@ -1522,7 +1522,7 @@ bool FCEUI_MovieGetInfo(FCEUFILE* fp, MOVIE_INFO& info, bool skipFrameCount)
MovieData md;
if(!LoadFM2(md, fp->stream, fp->size, skipFrameCount))
return false;
info.movie_version = md.version;
info.poweron = md.savestate.size()==0;
info.reset = false; //Soft-reset isn't used from starting movies anymore, so this will be false, better for FCEUFILE to have that info (as |1| on the first frame indicates it
@ -1551,7 +1551,7 @@ void LoadSubtitles(MovieData &moviedata)
std::string& subtitle = moviedata.subtitles[i];
size_t splitat = subtitle.find_first_of(' ');
std::string key, value;
//If we can't split them, then don't process this one
if(splitat == std::string::npos)
{
@ -1630,13 +1630,13 @@ void FCEUI_MakeBackupMovie(bool dispMessage)
backupFn.append(".bak"); //add extension
exist = CheckFileExists(backupFn.c_str()); //Check if file exists
if (!exist)
if (!exist)
break; //Yeah yeah, I should use a do loop or something
else
{
backupFn = tempFn; //Before we loop again, reset the filename
if (backNum == 999) //If 999 exists, we have overflowed, let's handle that
{
backupFn.append("-001.bak"); //We are going to simply overwrite 001.bak
@ -1646,10 +1646,10 @@ void FCEUI_MakeBackupMovie(bool dispMessage)
}
}
FCEUI_CreateMovieFile(backupFn);
//TODO, decide if fstream successfully opened the file and print error message if it doesn't
if (dispMessage) //If we should inform the user
if (dispMessage) //If we should inform the user
{
if (overflow)
FCEUI_DispMessage("Backup overflow, overwriting %s",0,backupFn.c_str()); //Inform user of overflow

View File

@ -20,7 +20,7 @@ enum EMOVIE_FLAG
//an ARCHAIC flag which means the movie was recorded from a soft reset.
//WHY would you do this?? do not create any new movies with this flag
MOVIE_FLAG_FROM_RESET = (1<<1),
MOVIE_FLAG_PAL = (1<<2),
//movie was recorded from poweron. the alternative is from a savestate (or from reset)
@ -101,7 +101,7 @@ class MovieRecord
public:
MovieRecord();
ValueArray<uint8,4> joysticks;
struct {
uint8 x,y,b,bogo;
uint64 zaphit;
@ -145,14 +145,14 @@ public:
bool Compare(MovieRecord& compareRec);
void Clone(MovieRecord& sourceRec);
void clear();
void parse(MovieData* md, EMUFILE* is);
bool parseBinary(MovieData* md, EMUFILE* is);
void dump(MovieData* md, EMUFILE* os, int index);
void dumpBinary(MovieData* md, EMUFILE* os, int index);
void parseJoy(EMUFILE* is, uint8& joystate);
void dumpJoy(EMUFILE* os, uint8 joystate);
static const char mnemonics[8];
private:
@ -192,7 +192,7 @@ public:
bool fourscore;
//whether microphone is enabled
bool microphone;
int getNumRecords() { return records.size(); }
class TDictionary : public std::map<std::string,std::string>
@ -230,7 +230,7 @@ public:
void clearRecordRange(int start, int len);
void insertEmpty(int at, int frames);
void cloneRegion(int at, int frames);
static bool loadSavestateFrom(std::vector<uint8>* buf);
static void dumpSavestateTo(std::vector<uint8>* buf, int compressionLevel);

View File

@ -70,7 +70,7 @@ int FCEUI_NetplayStart(int nlocal, int divisor)
{
FCEU_FlushGameCheats(0, 0); //Save our pre-netplay cheats.
FCEU_LoadGameCheats(0); // Load them again, for pre-multiplayer action.
FCEUnetplay = 1;
memset(netjoy,0,sizeof(netjoy));
numlocal = nlocal;
@ -89,7 +89,7 @@ int FCEUNET_SendCommand(uint8 cmd, uint32 len)
buf[0] = 0xFF;
FCEU_en32lsb(&buf[numlocal], len);
buf[numlocal + 4] = cmd;
if(!FCEUD_SendData(buf,numlocal + 1 + 4))
if(!FCEUD_SendData(buf,numlocal + 1 + 4))
{
NetError();
return(0);
@ -155,7 +155,7 @@ static FILE *FetchFile(uint32 remlen)
uint32 clen = remlen;
char *cbuf;
uLongf len;
char *buf;
char *buf;
FILE *fp;
if(clen > 500000) // Sanity check
@ -203,7 +203,7 @@ void NetplayUpdate(uint8 *joyp)
memcpy(joypb,joyp,4);
/* This shouldn't happen, but just in case. 0xFF is used as a command escape elsewhere. */
if(joypb[0] == 0xFF)
if(joypb[0] == 0xFF)
joypb[0] = 0xF;
if(!netdcount)
if(!FCEUD_SendData(joypb,numlocal))
@ -247,7 +247,7 @@ void NetplayUpdate(uint8 *joyp)
free(tbuf);
}
break;
case FCEUNPCMD_SAVESTATE:
case FCEUNPCMD_SAVESTATE:
{
//mbg todo netplay
//char *fn;
@ -310,7 +310,7 @@ void NetplayUpdate(uint8 *joyp)
if(!fp) return;
if(FCEUSS_LoadFP(fp,SSLOADPARAM_BACKUP))
{
fclose(fp);
fclose(fp);
FCEU_DispMessage("Remote state loaded.",0);
} else FCEUD_PrintError("File error. (K)ill, (M)aim, (D)estroy?");
}

View File

@ -160,7 +160,7 @@ static INLINE void BANKSET(uint32 A, uint32 bank)
bank&=NSFMaxBank;
if(NSFHeader.SoundChip&4)
memcpy(ExWRAM+(A-0x6000),NSFDATA+(bank<<12),4096);
else
else
setprg4(A,bank);
}
@ -211,7 +211,7 @@ int NSFLoad(const char *name, FCEUFILE *fp)
if(BSon==0)
{
BankCounter=0x00;
if ((NSFHeader.LoadAddressHigh & 0x70) >= 0x70)
{
//Ice Climber, and other F000 base address tunes need this
@ -221,7 +221,7 @@ int NSFLoad(const char *name, FCEUFILE *fp)
for(x=(NSFHeader.LoadAddressHigh & 0x70) / 0x10;x<8;x++)
{
NSFHeader.BankSwitch[x]=BankCounter;
BankCounter+=0x01;
BankCounter+=0x01;
}
BSon=0;
}
@ -360,7 +360,7 @@ void NSF_init(void)
SetReadHandler(0x3ff0,0x3fff,NSF_read);
if(NSFHeader.SoundChip&1) {
if(NSFHeader.SoundChip&1) {
NSFVRC6_Init();
} else if(NSFHeader.SoundChip&2) {
NSFVRC7_Init();
@ -399,7 +399,7 @@ static DECLFW(NSF_write)
A&=0xF;
BANKSET((A*4096),V);
break;
}
}
}
static DECLFR(NSF_read)
@ -422,13 +422,13 @@ static DECLFR(NSF_read)
BWrite[0x4000+x](0x4000+x,0);
BWrite[0x4015](0x4015,0xF);
if(NSFHeader.SoundChip&4)
if(NSFHeader.SoundChip&4)
{
BWrite[0x4017](0x4017,0xC0); /* FDS BIOS writes $C0 */
BWrite[0x4089](0x4089,0x80);
BWrite[0x408A](0x408A,0xE8);
}
else
else
{
memset(ExWRAM,0x00,8192);
BWrite[0x4017](0x4017,0xC0);
@ -482,8 +482,8 @@ void DrawNSF(uint8 *XBuf)
y=142+((Bufpl[(x*l)>>8]*mul)>>14);
if(y<240)
XBuf[x+y*256]=3;
}
}
}
}
else if(special==1)
{
if(FSettings.SoundVolume)
@ -522,7 +522,7 @@ void DrawNSF(uint8 *XBuf)
n=120+r*sin(t);
if(m<256 && n<240)
XBuf[m+n*256]=3;
XBuf[m+n*256]=3;
}
for(x=128;x<256;x++)
@ -562,9 +562,9 @@ void DrawNSF(uint8 *XBuf)
tmp=FCEU_GetJoyJoy();
if((tmp&JOY_RIGHT) && !(last&JOY_RIGHT))
{
if(CurrentSong<NSFHeader.TotalSongs)
if(CurrentSong<NSFHeader.TotalSongs)
{
CurrentSong++;
CurrentSong++;
SongReload=0xFF;
}
}

View File

@ -15,10 +15,10 @@ using namespace std;
// FCM\x1a
#define MOVIE_MAGIC 0x1a4d4346
// still at 2 since the format itself is still compatible
// to detect which version the movie was made with, check the fceu version stored in the movie header
// still at 2 since the format itself is still compatible
// to detect which version the movie was made with, check the fceu version stored in the movie header
// (e.g against FCEU_VERSION_NUMERIC)
#define MOVIE_VERSION 2
#define MOVIE_VERSION 2
//-------
//this is just supposed to be a comment describing the disk format
@ -223,7 +223,7 @@ static void FCEUI_LoadMovie_v1(char *fname, int _read_only);
// }
//
// //don't really load, just load to find what's there then load backup
// if(!FCEUSS_LoadFP(fp,SSLOADPARAM_DUMMY)) return 0;
// if(!FCEUSS_LoadFP(fp,SSLOADPARAM_DUMMY)) return 0;
// }
//
// fclose(fp);
@ -519,7 +519,7 @@ static void _addjoy()
// This fixes a bug in movies recorded before version 0.98.11
// It's probably not necessary, but it may keep away CRAZY PEOPLE who recorded
// movies on <= 0.98.10 and don't work on playback.
if(tmpfix == 1 && !nextts)
if(tmpfix == 1 && !nextts)
{nextts |= movie_readchar()<<8; }
else if(tmpfix == 2 && !nextts) {nextts |= movie_readchar()<<16; }
@ -575,7 +575,7 @@ EFCM_CONVERTRESULT convert_fcm(MovieData& md, std::string fname)
return FCM_CONVERTRESULT_UNSUPPORTEDVERSION;
}
fp->fread((char*)&flags,4);
read32le(&framecount, fp);
read32le(&rerecord_count, fp);

View File

@ -1,5 +1,5 @@
/* FCE Ultra - NES/Famicom Emulator
*
*
* Copyright notice for this file:
* Copyright (C) 2002,2003 Xodnizel
*
@ -20,7 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <math.h>
#include <string.h>
@ -50,7 +50,7 @@ bool force_grayscale = false;
/* These are dynamically filled/generated palettes: */
pal palettei[64]; // Custom palette for an individual game.
pal palettec[64]; // Custom "global" palette.
pal palettec[64]; // Custom "global" palette.
pal paletten[64]; // Mathematically generated palette.
static void CalculatePalette(void);
@ -69,7 +69,7 @@ static pal *palpoint[8]=
};
void FCEUI_SetPaletteArray(uint8 *pal)
{
{
if(!pal)
palpoint[0]=palette;
else
@ -125,18 +125,18 @@ void SetNESDeemph(uint8 d, int force)
for(x=0;x<0x40;x++)
{
uint32 m,n,o;
m=palo[x].r;
n=palo[x].g;
o=palo[x].b;
m=(m*r)>>15;
n=(n*g)>>15;
o=(o*b)>>15;
m=palo[x].r;
n=palo[x].g;
o=palo[x].b;
m=(m*r)>>15;
n=(n*g)>>15;
o=(o*b)>>15;
if(m>0xff) m=0xff;
if(n>0xff) n=0xff;
if(o>0xff) o=0xff;
FCEUD_SetPalette(x|0xC0,m,n,o);
}
}
}
if(!d) return; /* No deemphasis, so return. */
r=rtmul[d-1];
@ -166,7 +166,7 @@ void SetNESDeemph(uint8 d, int force)
#endif
}
// Converted from Kevin Horton's qbasic palette generator.
// Converted from Kevin Horton's qbasic palette generator.
static void CalculatePalette(void)
{
int x,z;
@ -175,7 +175,7 @@ static void CalculatePalette(void)
static uint8 cols[16]={0,24,21,18,15,12,9,6,3,0,33,30,27,0,0,0};
static uint8 br1[4]={6,9,12,12};
static double br2[4]={.29,.45,.73,.9};
static double br3[4]={0,.24,.47,.77};
static double br3[4]={0,.24,.47,.77};
for(x=0;x<=3;x++)
for(z=0;z<16;z++)
@ -211,7 +211,7 @@ static void CalculatePalette(void)
WritePalette();
}
static int ipalette=0;
static int ipalette=0;
void FCEU_LoadGamePalette(void)
{
@ -228,7 +228,7 @@ void FCEU_LoadGamePalette(void)
int x;
fread(ptmp,1,192,fp);
fclose(fp);
for(x=0;x<64;x++)
for(x=0;x<64;x++)
{
palettei[x].r=ptmp[x+x+x];
palettei[x].g=ptmp[x+x+x+1];
@ -244,7 +244,7 @@ void FCEU_ResetPalette(void)
if(GameInfo)
{
ChoosePalette();
WritePalette();
WritePalette();
}
}
@ -253,7 +253,7 @@ static void ChoosePalette(void)
if(GameInfo->type==GIT_NSF)
palo=0;
else if(ipalette)
palo=palettei;
palo=palettei;
else if(ntsccol && !PAL && GameInfo->type!=GIT_VSUNI)
{
palo=paletten;
@ -278,7 +278,7 @@ void WritePalette(void)
// FCEUD_SetPalette(x,x,0,x);
}
else
{
{
for(x=0;x<64;x++)
FCEUD_SetPalette(128+x,palo[x].r,palo[x].g,palo[x].b);
SetNESDeemph(lastd,1);
@ -289,7 +289,7 @@ void FCEUI_GetNTSCTH(int *tint, int *hue)
{
*tint = ntsctint;
*hue = ntschue;
}
}
static int controlselect=0;
static int controllength=0;
@ -312,7 +312,7 @@ void FCEUI_NTSCDEC(void)
CalculatePalette();
}
controllength=360;
}
}
}
}
@ -381,6 +381,6 @@ void FCEU_DrawNTSCControlBars(uint8 *XBuf)
for(;x<256;x+=2)
{
for(x2=2;x2>=-2;x2--)
XBaf[x-256*x2]=0x85;
XBaf[x-256*x2]=0x85;
}
}

View File

@ -459,7 +459,7 @@ uint8 FASTCALL FFCEUX_PPURead_Default(uint32 A) {
if(debug_loggingCD)
{
int addr = GetCHRAddress(tmp);
if(addr != -1)
if(addr != -1)
{
if(!(cdloggervdata[addr] & 1))
{
@ -772,7 +772,7 @@ static DECLFR(A2007)
if(debug_loggingCD)
{
if(!DummyRead && (LogAddress != -1))
if(!DummyRead && (LogAddress != -1))
{
if(!(cdloggervdata[LogAddress] & 2))
{

View File

@ -25,7 +25,7 @@ typedef struct {
void (*Fill)(int Count); /* Low quality ext sound. */
/* NeoFill is for sound devices that are emulated in a more
high-level manner(VRC7) in HQ mode. Interestingly,
high-level manner(VRC7) in HQ mode. Interestingly,
this device has slightly better sound quality(updated more
often) in lq mode than in high-quality mode. Maybe that
should be fixed. :)

View File

@ -476,7 +476,7 @@ void FCEUSS_Save(const char *fname)
}
else
undoSS = false; //so backup made so lastSavestateMade does have a backup file, so no undo
st = FCEUD_UTF8_fstream(fn,"wb");
}
@ -542,7 +542,7 @@ int FCEUSS_LoadFP_old(EMUFILE* is, ENUM_SSLOADPARAMS params)
//{
// fn=FCEU_MakeFName(FCEUMKF_NPTEMP,0,0);
// FILE *fp;
//
//
// if((fp=fopen(fn,"wb")))
// {
// if(FCEUSS_SaveFP(fp))
@ -597,7 +597,7 @@ int FCEUSS_LoadFP_old(EMUFILE* is, ENUM_SSLOADPARAMS params)
if(x)
{
FCEUPPU_LoadState(stateversion);
FCEUSND_LoadState(stateversion);
FCEUSND_LoadState(stateversion);
x=FCEUMOV_PostLoad();
}
if(fn)
@ -606,7 +606,7 @@ int FCEUSS_LoadFP_old(EMUFILE* is, ENUM_SSLOADPARAMS params)
//{
// * Oops! Load the temporary savestate */
// FILE *fp;
//
//
// if((fp=fopen(fn,"rb")))
// {
// FCEUSS_LoadFP(fp,SSLOADPARAM_NOBACKUP);
@ -645,7 +645,7 @@ bool FCEUSS_LoadFP(EMUFILE* is, ENUM_SSLOADPARAMS params)
if(!ret && backup) FCEUSS_LoadFP(&msBackupSavestate,SSLOADPARAM_NOBACKUP);
return ret;
}
int totalsize = FCEU_de32lsb(header + 4);
int stateversion = FCEU_de32lsb(header + 8);
int comprlen = FCEU_de32lsb(header + 12);
@ -737,7 +737,7 @@ bool FCEUSS_Load(const char *fname)
SaveStateStatus[CurrentState]=0;
return false;
}
//If in bot mode, don't do a backup when loading.
//Otherwise you eat at the hard disk, since so many
//states are being loaded.
@ -781,13 +781,13 @@ bool FCEUSS_Load(const char *fname)
#ifdef WIN32
Update_RAM_Search(); // Update_RAM_Watch() is also called.
#endif
//Update input display if movie is loaded
extern uint32 cur_input_display;
extern uint8 FCEU_GetJoyJoy(void);
cur_input_display = FCEU_GetJoyJoy(); //Input display should show the last buttons pressed (stored in the savestate)
return true;
}
else
@ -833,8 +833,8 @@ void ResetExState(void (*PreSave)(void), void (*PostSave)(void))
free(SFMDATA[x].desc);
}
// adelikat, 3/14/09: had to add this to clear out the size parameter. NROM(mapper 0) games were having savestate crashes if loaded after a non NROM game because the size variable was carrying over and causing savestates to save too much data
SFMDATA[0].s = 0;
SFMDATA[0].s = 0;
SPreSave = PreSave;
SPostSave = PostSave;
SFEXINDEX=0;
@ -918,7 +918,7 @@ void FCEUI_SaveState(const char *fname)
if(!FCEU_IsValidUI(FCEUI_SAVESTATE)) return;
StateShow=0;
FCEUSS_Save(fname);
}
@ -946,10 +946,10 @@ void FCEUI_LoadState(const char *fname)
from this ;)).
*/
if (backupSavestates) BackupLoadState(); //If allowed, backup the current state before loading a new one
if (!movie_readonly && autoMovieBackup && freshMovie) //If auto-backup is on, movie has not been altered this session and the movie is in read+write mode
{
FCEUI_MakeBackupMovie(false); //Backup the movie before the contents get altered, but do not display messages
FCEUI_MakeBackupMovie(false); //Backup the movie before the contents get altered, but do not display messages
}
if (fname != NULL && !file_exists(fname))
{
@ -1008,8 +1008,8 @@ string GenerateBackupSaveStateFn(const char *fname)
string filename;
filename = fname; //Convert fname to a string object
int x = filename.find_last_of("."); //Find file extension
filename.insert(x,"-bak"); //add "-bak" before the dot.
filename.insert(x,"-bak"); //add "-bak" before the dot.
return filename;
}
@ -1028,15 +1028,15 @@ void SwapSaveState()
//--------------------------------------------------------------------------------------------
//Both files must exist
//--------------------------------------------------------------------------------------------
if (!lastSavestateMade)
if (!lastSavestateMade)
{
FCEUI_DispMessage("Can't Undo",0);
FCEUI_printf("Undo savestate was attempted but unsuccessful because there was not a recently used savestate.\n");
return; //If there is no last savestate, can't undo
}
string backup = GenerateBackupSaveStateFn(lastSavestateMade); //Get filename of backup state
if (!CheckFileExists(backup.c_str()))
if (!CheckFileExists(backup.c_str()))
{
FCEUI_DispMessage("Can't Undo",0);
FCEUI_printf("Undo savestate was attempted but unsuccessful because there was not a backup of the last used savestate.\n");
@ -1048,11 +1048,11 @@ void SwapSaveState()
//--------------------------------------------------------------------------------------------
string temp = backup; //Put backup filename in temp
temp.append("x"); //Add x
rename(backup.c_str(),temp.c_str()); //rename backup file to temp file
rename(lastSavestateMade,backup.c_str()); //rename current as backup
rename(temp.c_str(),lastSavestateMade); //rename backup as current
undoSS = true; //Just in case, if this was run, then there is definately a last savestate and backup
if (redoSS) //This was a redo function, so if run again it will be an undo again
redoSS = false;
@ -1061,8 +1061,8 @@ void SwapSaveState()
FCEUI_DispMessage("%s restored",0,backup.c_str());
FCEUI_printf("%s restored\n",backup.c_str());
}
}
//------------------------------------------------------------------------------------------------------------------------------------------------------
//*************************************************************************
//Loadstate backup functions
@ -1075,7 +1075,7 @@ string GetBackupFileName()
//particularly from unintentional loadstating
string filename;
int x;
filename = strdup(FCEU_MakeFName(FCEUMKF_STATE,CurrentState,0).c_str()); //Generate normal savestate filename
x = filename.find_last_of("."); //Find last dot
filename = filename.substr(0,x); //Chop off file extension
@ -1089,11 +1089,11 @@ bool CheckBackupSaveStateExist()
//This function simply checks to see if the backup loadstate exists, the backup loadstate is a special savestate
//That is made before loading any state, so that the user never loses his data
string filename = GetBackupFileName(); //Get backup savestate filename
//Check if this filename exists
fstream test;
test.open(filename.c_str(),fstream::in);
if (test.fail())
{
test.close();

View File

@ -79,7 +79,7 @@
#undef ENABLE_SSE2
#endif
#ifdef _MSC_VER
#ifdef _MSC_VER
#define strcasecmp(x,y) _stricmp(x,y)
#define snprintf _snprintf
#else
@ -146,7 +146,7 @@
#define FORCEINLINE __forceinline
#define MSC_FORCEINLINE __forceinline
#else
#define FORCEINLINE inline __attribute__((always_inline))
#define FORCEINLINE inline __attribute__((always_inline))
#define MSC_FORCEINLINE
#endif
#endif
@ -340,12 +340,12 @@ inline float u32_to_float(u32 u) {
///stores a 32bit value into the provided byte array in guaranteed little endian form
inline void en32lsb(u8 *buf, u32 morp)
{
{
buf[0]=(u8)(morp);
buf[1]=(u8)(morp>>8);
buf[2]=(u8)(morp>>16);
buf[3]=(u8)(morp>>24);
}
}
inline void en16lsb(u8* buf, u16 morp)
{
@ -413,7 +413,7 @@ char (*BLAHBLAHBLAH( UNALIGNED T (&)[N] ))[N];
//8-bit constants max value 0x11111111, always fits in unsigned long
#define HEX__(n) 0x##n##LU
//8-bit conversion function
//8-bit conversion function
#define B8__(x) ((x&0x0000000FLU)?1:0) \
+((x&0x000000F0LU)?2:0) \
+((x&0x00000F00LU)?4:0) \
@ -449,7 +449,7 @@ char (*BLAHBLAHBLAH( UNALIGNED T (&)[N] ))[N];
static const char hexValid[23] = {"0123456789ABCDEFabcdef"};
template<typename T> inline void reconstruct(T* t) {
template<typename T> inline void reconstruct(T* t) {
t->~T();
new(t) T();
}

View File

@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*/
#ifndef __FCEU_TYPES
#define __FCEU_TYPES
@ -79,7 +79,7 @@ typedef uint32_t uint32;
#elif MSVC
typedef __int64 int64;
typedef unsigned __int64 uint64;
#define __restrict__
#define __restrict__
#define INLINE __inline
#define GINLINE /* Can't declare a function INLINE
and global in MSVC. Bummer.
@ -88,7 +88,7 @@ typedef uint32_t uint32;
other than Windows/DOS targets?
*/
#if _MSC_VER >= 1300
#if _MSC_VER >= 1300
#pragma warning(disable:4244) //warning C4244: '=' : conversion from 'uint32' to 'uint8', possible loss of data
#pragma warning(disable:4996) //'strdup' was declared deprecated
#endif
@ -120,7 +120,7 @@ typedef uint32_t uint32;
#else
#error PSS_STYLE undefined or invalid; see "types.h" for possible values, and add as compile-time option.
#error PSS_STYLE undefined or invalid; see "types.h" for possible values, and add as compile-time option.
#endif

View File

@ -402,6 +402,7 @@ static BMAPPING bmap[] = {
{ "8157", UNL8157_Init,0},
{ "T-262", BMCT262_Init,0},
{ "FK23C", BMCFK23C_Init,0},
{ "FS304", UNLFS304_Init,0},
{ "A65AS", BMCA65AS_Init,0},
{ "C-N22M", UNLCN22M_Init,0},
{ "EDU2000", UNLEDU2000_Init,0},
@ -441,8 +442,8 @@ static BMAPPING bmap[] = {
{ "TEK90", Mapper90_Init,0},
{ "FK23C", BMCFK23C_Init,BMCFLAG_EXPCHRR},
{ "FK23CA", BMCFK23CA_Init,BMCFLAG_EXPCHRR},
{ "FK23C", BMCFK23C_Init,BMCFLAG_EXPCHRR},
{ "FK23CA", BMCFK23CA_Init,BMCFLAG_EXPCHRR},
{0,0,0}
};

View File

@ -1,135 +1,136 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
void ANROM_Init(CartInfo *info);
void HKROM_Init(CartInfo *info);
void ETROM_Init(CartInfo *info);
void EKROM_Init(CartInfo *info);
void ELROM_Init(CartInfo *info);
void EWROM_Init(CartInfo *info);
void SAROM_Init(CartInfo *info);
void SBROM_Init(CartInfo *info);
void SCROM_Init(CartInfo *info);
void SEROM_Init(CartInfo *info);
void SGROM_Init(CartInfo *info);
void SKROM_Init(CartInfo *info);
void SLROM_Init(CartInfo *info);
void SL1ROM_Init(CartInfo *info);
void SNROM_Init(CartInfo *info);
void SOROM_Init(CartInfo *info);
void NROM_Init(CartInfo *info);
void MHROM_Init(CartInfo *info);
void UNROM_Init(CartInfo *info);
void SUNSOFT_UNROM_Init(CartInfo *info); // "Shanghi" original version mapper
void MALEE_Init(CartInfo *info);
void CNROM_Init(CartInfo *info);
void CPROM_Init(CartInfo *info);
void GNROM_Init(CartInfo *info);
void UNL3DBlock_Init(CartInfo *info);
void TBROM_Init(CartInfo *info);
void TEROM_Init(CartInfo *info);
void TFROM_Init(CartInfo *info);
void TGROM_Init(CartInfo *info);
void TKROM_Init(CartInfo *info);
void TSROM_Init(CartInfo *info);
void TLROM_Init(CartInfo *info);
void TLSROM_Init(CartInfo *info);
void TKSROM_Init(CartInfo *info);
void TQROM_Init(CartInfo *info);
void TQROM_Init(CartInfo *info);
void DEIROM_Init(CartInfo *info);
void TCA01_Init(CartInfo *info);
void TCU01_Init(CartInfo *info);
void TCU02_Init(CartInfo *info);
void S8259A_Init(CartInfo *info);
void S8259B_Init(CartInfo *info);
void S8259C_Init(CartInfo *info);
void S8259D_Init(CartInfo *info);
void S74LS374N_Init(CartInfo *info);
void S74LS374NA_Init(CartInfo *info);
void SA0161M_Init(CartInfo *info);
void SA72007_Init(CartInfo *info);
void SA72008_Init(CartInfo *info);
void SA009_Init(CartInfo *info);
void SA0036_Init(CartInfo *info);
void SA0037_Init(CartInfo *info);
void Supervision16_Init(CartInfo *info);
void Super24_Init(CartInfo *info);
void Novel_Init(CartInfo *info);
void BMC64in1nr_Init(CartInfo *info);
void BMC70in1_Init(CartInfo *info);
void BMC70in1B_Init(CartInfo *info);
void BMC13in1JY110_Init(CartInfo *info);
void BMCT262_Init(CartInfo *info);
void BMCFK23C_Init(CartInfo *info);
void BMCFK23CA_Init(CartInfo *info);
void BMCD1038_Init(CartInfo *info);
void BMCA65AS_Init(CartInfo *info);
void BMCGK192_Init(CartInfo *info);
void BMCGS2004_Init(CartInfo *info);
void BMCGS2013_Init(CartInfo *info);
void BMC190in1_Init(CartInfo *info);
void BMCGhostbusters63in1_Init(CartInfo *info);
void BMCBS5_Init(CartInfo *info);
void DreamTech01_Init(CartInfo *info);
void Mapper190_Init(CartInfo *info);
void UNLCC21_Init(CartInfo *info);
void UNLCN22M_Init(CartInfo *info);
void UNLSL1632_Init(CartInfo *info);
void UNLKOF97_Init(CartInfo *info);
void UNLA9746_Init(CartInfo *info);
void UNLSHeroes_Init(CartInfo *info);
void UNLH2288_Init(CartInfo *info);
void UNL8237_Init(CartInfo *info);
void UNL8237A_Init(CartInfo *info);
void UNL8157_Init(CartInfo *info);
void UNL22211_Init(CartInfo *info);
void UNLTF1201_Init(CartInfo *info);
void UNLKS7032_Init(CartInfo *info);
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
void ANROM_Init(CartInfo *info);
void HKROM_Init(CartInfo *info);
void ETROM_Init(CartInfo *info);
void EKROM_Init(CartInfo *info);
void ELROM_Init(CartInfo *info);
void EWROM_Init(CartInfo *info);
void SAROM_Init(CartInfo *info);
void SBROM_Init(CartInfo *info);
void SCROM_Init(CartInfo *info);
void SEROM_Init(CartInfo *info);
void SGROM_Init(CartInfo *info);
void SKROM_Init(CartInfo *info);
void SLROM_Init(CartInfo *info);
void SL1ROM_Init(CartInfo *info);
void SNROM_Init(CartInfo *info);
void SOROM_Init(CartInfo *info);
void NROM_Init(CartInfo *info);
void MHROM_Init(CartInfo *info);
void UNROM_Init(CartInfo *info);
void SUNSOFT_UNROM_Init(CartInfo *info); // "Shanghi" original version mapper
void MALEE_Init(CartInfo *info);
void CNROM_Init(CartInfo *info);
void CPROM_Init(CartInfo *info);
void GNROM_Init(CartInfo *info);
void UNL3DBlock_Init(CartInfo *info);
void TBROM_Init(CartInfo *info);
void TEROM_Init(CartInfo *info);
void TFROM_Init(CartInfo *info);
void TGROM_Init(CartInfo *info);
void TKROM_Init(CartInfo *info);
void TSROM_Init(CartInfo *info);
void TLROM_Init(CartInfo *info);
void TLSROM_Init(CartInfo *info);
void TKSROM_Init(CartInfo *info);
void TQROM_Init(CartInfo *info);
void TQROM_Init(CartInfo *info);
void DEIROM_Init(CartInfo *info);
void TCA01_Init(CartInfo *info);
void TCU01_Init(CartInfo *info);
void TCU02_Init(CartInfo *info);
void S8259A_Init(CartInfo *info);
void S8259B_Init(CartInfo *info);
void S8259C_Init(CartInfo *info);
void S8259D_Init(CartInfo *info);
void S74LS374N_Init(CartInfo *info);
void S74LS374NA_Init(CartInfo *info);
void SA0161M_Init(CartInfo *info);
void SA72007_Init(CartInfo *info);
void SA72008_Init(CartInfo *info);
void SA009_Init(CartInfo *info);
void SA0036_Init(CartInfo *info);
void SA0037_Init(CartInfo *info);
void Supervision16_Init(CartInfo *info);
void Super24_Init(CartInfo *info);
void Novel_Init(CartInfo *info);
void BMC64in1nr_Init(CartInfo *info);
void BMC70in1_Init(CartInfo *info);
void BMC70in1B_Init(CartInfo *info);
void BMC13in1JY110_Init(CartInfo *info);
void BMCT262_Init(CartInfo *info);
void BMCFK23C_Init(CartInfo *info);
void BMCFK23CA_Init(CartInfo *info);
void BMCD1038_Init(CartInfo *info);
void BMCA65AS_Init(CartInfo *info);
void BMCGK192_Init(CartInfo *info);
void BMCGS2004_Init(CartInfo *info);
void BMCGS2013_Init(CartInfo *info);
void BMC190in1_Init(CartInfo *info);
void BMCGhostbusters63in1_Init(CartInfo *info);
void BMCBS5_Init(CartInfo *info);
void DreamTech01_Init(CartInfo *info);
void UNLFS304_Init(CartInfo *info);
void Mapper190_Init(CartInfo *info);
void UNLCC21_Init(CartInfo *info);
void UNLCN22M_Init(CartInfo *info);
void UNLSL1632_Init(CartInfo *info);
void UNLKOF97_Init(CartInfo *info);
void UNLA9746_Init(CartInfo *info);
void UNLSHeroes_Init(CartInfo *info);
void UNLH2288_Init(CartInfo *info);
void UNL8237_Init(CartInfo *info);
void UNL8237A_Init(CartInfo *info);
void UNL8157_Init(CartInfo *info);
void UNL22211_Init(CartInfo *info);
void UNLTF1201_Init(CartInfo *info);
void UNLKS7032_Init(CartInfo *info);
void UNLKS7057_Init(CartInfo *info);
void UNLT230_Init(CartInfo *info);
void UNLCITYFIGHT_Init(CartInfo *info);
void UNLAX5705_Init(CartInfo *info);
void UNLDANCE_Init(CartInfo *info);
void UNLOneBus_Init(CartInfo *info);
void UNLSC127_Init(CartInfo *info);
void UNLEDU2000_Init(CartInfo *info);
void UNL6035052_Init(CartInfo *info);
void UNLN625092_Init(CartInfo *info);
void UNLSMB2J_Init(CartInfo *info);
//void UNL09034A_Init(CartInfo *info);
void BMC411120C_Init(CartInfo *info);
void BMC830118C_Init(CartInfo *info);
void BMCT2271_Init(CartInfo *info);
extern uint8 *UNIFchrrama; // Meh. So I can stop CHR RAM
// bank switcherooing with certain boards...
void UNLT230_Init(CartInfo *info);
void UNLCITYFIGHT_Init(CartInfo *info);
void UNLAX5705_Init(CartInfo *info);
void UNLDANCE_Init(CartInfo *info);
void UNLOneBus_Init(CartInfo *info);
void UNLSC127_Init(CartInfo *info);
void UNLEDU2000_Init(CartInfo *info);
void UNL6035052_Init(CartInfo *info);
void UNLN625092_Init(CartInfo *info);
void UNLSMB2J_Init(CartInfo *info);
//void UNL09034A_Init(CartInfo *info);
void BMC411120C_Init(CartInfo *info);
void BMC830118C_Init(CartInfo *info);
void BMCT2271_Init(CartInfo *info);
extern uint8 *UNIFchrrama; // Meh. So I can stop CHR RAM
// bank switcherooing with certain boards...

View File

@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*/
#ifndef __FCEU_VERSION
#define __FCEU_VERSION

View File

@ -184,7 +184,7 @@ void FCEU_PutImage(void)
ReallySnap();
dosnapsave=0;
}
}
}
else
{
//Save backbuffer before overlay stuff is written.
@ -228,14 +228,14 @@ void FCEU_PutImage(void)
extern uint32 JSAutoHeld;
uint32 held;
int controller, c, ci, color;
int controller, c, ci, color;
int i, j;
uint32 on = FCEUMOV_Mode(MOVIEMODE_PLAY) ? 0x90:0xA7; //Standard, or Gray depending on movie mode
uint32 oni = 0xA0; //Color for immediate keyboard buttons
uint32 blend = 0xB6; //Blend of immiate and last held buttons
uint32 ahold = 0x87; //Auto hold
uint32 off = 0xCF;
uint8 *t = XBuf+(FSettings.LastSLine-9)*256 + 20; //mbg merge 7/17/06 changed t to uint8*
if(input_display > 4) input_display = 4;
for(controller = 0; controller < input_display; controller++, t += 56)
@ -265,8 +265,8 @@ void FCEU_PutImage(void)
//adelikat: I apologize to anyone who ever sifts through this color assignment
//A
if (held&1) { //If auto-hold
if (!(ci&1) ) color = ahold;
else
if (!(ci&1) ) color = ahold;
else
color = (c&1) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
}
else {
@ -284,8 +284,8 @@ void FCEU_PutImage(void)
}
//B
if (held&2) { //If auto-hold
if (!(ci&2) ) color = ahold;
else
if (!(ci&2) ) color = ahold;
else
color = (c&2) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
}
else {
@ -303,8 +303,8 @@ void FCEU_PutImage(void)
}
//Select
if (held&4) { //If auto-hold
if (!(ci&4) ) color = ahold;
else
if (!(ci&4) ) color = ahold;
else
color = (c&4) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
}
else {
@ -318,8 +318,8 @@ void FCEU_PutImage(void)
}
//Start
if (held&8) { //If auto-hold
if (!(ci&8) ) color = ahold;
else
if (!(ci&8) ) color = ahold;
else
color = (c&8) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
}
else {
@ -333,8 +333,8 @@ void FCEU_PutImage(void)
}
//Up
if (held&16) { //If auto-hold
if (!(ci&16) ) color = ahold;
else
if (!(ci&16) ) color = ahold;
else
color = (c&16) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
}
else {
@ -350,7 +350,7 @@ void FCEU_PutImage(void)
}
//Down
if (held&32) { //If auto-hold
if (!(ci&32) ) color = ahold;
if (!(ci&32) ) color = ahold;
else
color = (c&32) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
}
@ -367,8 +367,8 @@ void FCEU_PutImage(void)
}
//Left
if (held&64) { //If auto-hold
if (!(ci&64) ) color = ahold;
else
if (!(ci&64) ) color = ahold;
else
color = (c&64) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
}
else {
@ -384,8 +384,8 @@ void FCEU_PutImage(void)
}
//Right
if (held&128) { //If auto-hold
if (!(ci&128) ) color = ahold;
else
if (!(ci&128) ) color = ahold;
else
color = (c&128) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
}
else {
@ -513,7 +513,7 @@ static int WritePNGChunk(FILE *fp, uint32 size, char *type, uint8 *data)
}
uint32 GetScreenPixel(int x, int y, bool usebackup) {
uint8 r,g,b;
if (((x < 0) || (x > 255)) || ((y < 0) || (y > 255)))
@ -614,7 +614,7 @@ int SaveSnapshot(void)
*dest=0; // No filter.
dest++;
for(x=256;x;x--,tmp++,dest++)
*dest=*tmp;
*dest=*tmp;
}
if(compress(compmem,&compmemsize,mork,(totallines<<8)+totallines)!=Z_OK)
@ -707,7 +707,7 @@ int SaveSnapshot(char fileName[512])
*dest=0; // No filter.
dest++;
for(x=256;x;x--,tmp++,dest++)
*dest=*tmp;
*dest=*tmp;
}
if(compress(compmem,&compmemsize,mork,(totallines<<8)+totallines)!=Z_OK)
@ -756,7 +756,7 @@ static uint64 boop[60];
static int boopcount = 0;
void ShowFPS(void)
{
{
if(Show_FPS == false)
return;
uint64 da = FCEUD_GetTime() - boop[boopcount];

View File

@ -32,7 +32,7 @@
#define IOPTION_GUN 0x1
#define IOPTION_SWAPDIRAB 0x2
#define IOPTION_PREDIP 0x10
typedef struct
{
@ -65,7 +65,7 @@ void FCEUI_VSUniSetDIP(int w, int state)
if(((vsdip >> w) & 1) != state)
FCEUI_VSUniToggleDIP(w);
}
uint8 FCEUI_VSUniGetDIPs(void)
{
return(vsdip);
@ -90,14 +90,14 @@ static uint8 secdata[2][32]=
static uint8 *secptr;
static uint8 VSindex;
static DECLFR(VSSecRead)
{
switch(A)
{
case 0x5e00: VSindex=0;return X.DB;
case 0x5e01: return(secptr[(VSindex++)&0x1F]);
}
}
return(0x00);
}
uint8 coinon=0;
@ -111,7 +111,7 @@ static int curppu;
static int64 curmd5;
#define RP2C04_001 1
#define RP2C04_002 2
#define RP2C04_002 2
#define RP2C04_003 3
#define RP2C05_004 4
#define RCP2C03B 5
@ -186,7 +186,7 @@ void FCEU_VSUniPower(void)
if(curppu == RC2C05_04)
{
OldReadPPU = GetReadHandler(0x2002);
OldReadPPU = GetReadHandler(0x2002);
SetReadHandler(0x2002, 0x2002, A2002_Topgun);
}
else if(curppu == RC2C05_03)
@ -224,17 +224,17 @@ void FCEU_VSUniPower(void)
this list as "this game must use this PPU".
RP2C04-001:
- Baseball
- Baseball
- Freedom Force
- Gradius
- Hogan's Alley
- Mach Rider (Japan, Fighting Course)
- Pinball
- Platoon
- Platoon
- Super Xevious
RP2C04-002:
- Castlevania
- Castlevania
- Ladies golf
- Mach Rider (Endurance Course)
- Raid on Bungeling Bay (Japan)
@ -253,7 +253,7 @@ RP2c05-004:
- Clu Clu Land
- Excite Bike (Japan)
- Ice Climber
- Ice Climber Dual (Japan)
- Ice Climber Dual (Japan)
- Super Mario Bros.
Rcp2c03b:
@ -262,7 +262,7 @@ Rcp2c03b:
- Mahjang
- Pinball (Japan)
- Rbi Baseball
- Star Luster
- Star Luster
- Stroke and Match Golf (Japan)
- Super Skykid
- Tennis
@ -275,9 +275,9 @@ RC2C05-02:
- Mighty Bomb Jack (Japan)
RC2C05-03:
- Gumshoe
- Gumshoe
RC2C05-04:
RC2C05-04:
- Top Gun
*/
@ -348,9 +348,9 @@ void FCEU_VSUniCheck(uint64 md5partial, int *MapperNo, uint8 *Mirroring)
{
static int64 tko=0x6e1ee06171d8ce3aULL, rbi=0x6a02d345812938afULL;
if(md5partial == tko)
secptr=secdata[0];
secptr=secdata[0];
if(md5partial == rbi)
secptr = secdata[1];
secptr = secdata[1];
}
vsdip = 0x0;
@ -384,10 +384,10 @@ void FCEU_VSUniDraw(uint8 *XBuf)
dest=(uint32 *)(XBuf+256*12+164);
for(y=24;y;y--,dest+=(256-72)>>2)
{
for(x=72>>2;x;x--,dest++)
for(x=72>>2;x;x--,dest++)
*dest=0;
}
dest=(uint32 *)(XBuf+256*(12+4)+164+6 );
for(y=16;y;y--,dest+=(256>>2)-16)
for(x=8;x;x--)
@ -405,13 +405,13 @@ void FCEU_VSUniDraw(uint8 *XBuf)
da+=(256>>2)*10;
for(y=4;y;y--,da+=256>>2)
*da=0;
}
}
}
SFORMAT FCEUVSUNI_STATEINFO[]={
{ &vsdip, 1, "vsdp"},
{ &coinon, 1, "vscn"},
{ &coinon, 1, "vscn"},
{ &VSindex, 1, "vsin"},
{ 0}
};

View File

@ -11,7 +11,7 @@
static FILE *soundlog=0;
static long wsize;
/* Checking whether the file exists before wiping it out is left up to the
/* Checking whether the file exists before wiping it out is left up to the
reader..err...I mean, the driver code, if it feels so inclined(I don't feel
so).
*/
@ -65,14 +65,14 @@ int FCEUI_EndWaveRecord()
fputc((s>>8)&0xFF,soundlog);
fputc((s>>16)&0xFF,soundlog);
fputc((s>>24)&0xFF,soundlog);
fseek(soundlog,0x28,SEEK_SET);
s=wsize;
fputc(s&0xFF,soundlog);
fputc((s>>8)&0xFF,soundlog);
fputc((s>>16)&0xFF,soundlog);
fputc((s>>24)&0xFF,soundlog);
fclose(soundlog);
soundlog=0;
return 1;
@ -118,7 +118,7 @@ bool FCEUI_BeginWaveRecord(const char *fn)
fputc(0,soundlog);
fputc(16,soundlog);
fputc(0,soundlog);
fputs("data",soundlog);
fseek(soundlog,4,SEEK_CUR);

View File

@ -1,4 +1,4 @@
#include "types.h"
void FCEU_WriteWaveData(int32 *Buffer, int Count);
int FCEUI_EndWaveRecord();
int FCEUI_EndWaveRecord();

View File

@ -56,11 +56,11 @@ static INLINE void WrMem(unsigned int A, uint8 V)
#endif
}
static INLINE uint8 RdRAM(unsigned int A)
static INLINE uint8 RdRAM(unsigned int A)
{
//bbit edited: this was changed so cheat substituion would work
return(_DB=ARead[A](A));
// return(_DB=RAM[A]);
// return(_DB=RAM[A]);
}
static INLINE void WrRAM(unsigned int A, uint8 V)
@ -91,7 +91,7 @@ void X6502_DMW(uint32 A, uint8 V)
uint8 VTMP=V; \
WrRAM(0x100+_S,VTMP); \
_S--; \
}
}
#define POP() RdRAM(0x100+(++_S))
@ -194,7 +194,7 @@ static uint8 ZNTable[256];
_P|=l; \
X_ZNT(x); \
}
/* Icky icky thing for some undocumented instructions. Can easily be
broken if names of local variables are changed.
*/
@ -333,7 +333,7 @@ static uint8 ZNTable[256];
#define ST_IY(r) {unsigned int A; GetIYWR(A); WrMem(A,r); break; }
static uint8 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,
/*0x20*/ 6,6,2,8,3,3,5,5,4,2,2,2,4,4,6,6,
@ -368,7 +368,7 @@ void TriggerNMI(void)
}
void TriggerNMI2(void)
{
{
_IRQlow|=FCEU_IQNMI2;
}