diff --git a/src/boards/01-222.cpp b/src/boards/01-222.cpp index ea08ffc8..c5f5e683 100644 --- a/src/boards/01-222.cpp +++ b/src/boards/01-222.cpp @@ -36,7 +36,7 @@ static void Sync(void) setchr8((((cmd^reg[2])>>3)&2)|(((cmd^reg[2])>>5)&1)); // 1991 DU MA Racing probably CHR bank sequence is WRONG, so it is possible to // rearrange CHR banks for normal UNIF board and mapper 172 is unneccessary else - setchr8(reg[2]&3); + setchr8(reg[2]&3); } static DECLFW(UNL22211WriteLo) diff --git a/src/boards/121.cpp b/src/boards/121.cpp index 1e5e0152..ead92fb8 100644 --- a/src/boards/121.cpp +++ b/src/boards/121.cpp @@ -28,7 +28,7 @@ static uint8 readbyte = 0; static DECLFW(M121Write) { - FCEU_printf("write: %04x:%04x\n",A&0xE003,V); +// FCEU_printf("write: %04x:%04x\n",A&0xE003,V); if((A&0xF003)==0x8003) { // FCEU_printf(" prot write"); @@ -65,12 +65,12 @@ static uint8 prot_array[16] = { 0x83, 0x83, 0x42, 0x00 }; static DECLFW(M121LoWrite) { EXPREGS[0] = prot_array[V&3]; // 0x100 bit in address seems to be switch arrays 0, 2, 2, 3 (Contra Fighter) - FCEU_printf("write: %04x:%04x\n",A,V); +// FCEU_printf("write: %04x:%04x\n",A,V); } static DECLFR(M121Read) { - FCEU_printf("read: %04x\n",A); +// FCEU_printf("read: %04x\n",A); return EXPREGS[0]; } diff --git a/src/boards/175.cpp b/src/boards/175.cpp new file mode 100644 index 00000000..13bbddde --- /dev/null +++ b/src/boards/175.cpp @@ -0,0 +1,88 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2007 CaH4e3 + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "mapinc.h" + +static uint8 reg, delay, mirr; + +static SFORMAT StateRegs[]= +{ + {®, 1, "REG"}, + {&mirr, 1, "MIRR"}, + {0} +}; + +static void Sync(void) +{ + setchr8(reg); + if(!delay) + { + setprg16(0x8000,reg); + setprg8(0xC000,reg << 1); + } + setprg8(0xE000,(reg << 1) + 1); + setmirror(((mirr&4)>>2)^1); +} + +static DECLFW(M175Write1) +{ + mirr = V; + delay = 1; + Sync(); +} + +static DECLFW(M175Write2) +{ + reg = V & 0x0F; + delay = 1; + Sync(); +} + +static DECLFR(M175Read) +{ + if(A==0xFFFC) + { + delay = 0; + Sync(); + } + return CartBR(A); +} + +static void M175Power(void) +{ + reg = mirr = delay = 0; + SetReadHandler(0x8000,0xFFFF,M175Read); + SetWriteHandler(0x8000,0x8000,M175Write1); + SetWriteHandler(0xA000,0xA000,M175Write2); + Sync(); +} + +static void StateRestore(int version) +{ + Sync(); +} + +void Mapper175_Init(CartInfo *info) +{ + info->Power=M175Power; + GameStateRestore=StateRestore; + + AddExState(&StateRegs, ~0, 0, 0); +} diff --git a/src/boards/176.cpp b/src/boards/176.cpp new file mode 100644 index 00000000..1d7b5d19 --- /dev/null +++ b/src/boards/176.cpp @@ -0,0 +1,89 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2007 CaH4e3 + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "mapinc.h" + +static uint8 prg, chr; +static uint8 *WRAM=NULL; +static uint32 WRAMSIZE; + +static SFORMAT StateRegs[]= +{ + {&prg, 1, "PRG"}, + {&chr, 1, "CHR"}, + {0} +}; + +static void Sync(void) +{ + setprg8r(0x10,0x6000,0); + setprg32(0x8000,prg>>1); + setchr8(chr); +} + +static DECLFW(M176Write1) +{ + prg = V; + Sync(); +} + +static DECLFW(M176Write2) +{ + chr = V; + Sync(); +} + +static void M176Power(void) +{ + prg = ~0; + SetReadHandler(0x6000,0x7fff,CartBR); + SetWriteHandler(0x6000,0x7fff,CartBW); + SetReadHandler(0x8000,0xFFFF,CartBR); + SetWriteHandler(0x5ff1,0x5ff1,M176Write1); + SetWriteHandler(0x5ff2,0x5ff2,M176Write2); + Sync(); +} + + +static void M176Close(void) +{ + if(WRAM) + FCEU_gfree(WRAM); + WRAM=NULL; +} + +static void StateRestore(int version) +{ + Sync(); +} + +void Mapper176_Init(CartInfo *info) +{ + info->Power=M176Power; + info->Close=M176Close; + + GameStateRestore=StateRestore; + + WRAMSIZE=8192; + WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE); + SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1); + AddExState(WRAM, WRAMSIZE, 0, "WRAM"); + AddExState(&StateRegs, ~0, 0, 0); +} diff --git a/src/boards/187.cpp b/src/boards/187.cpp index b4531103..008cdefb 100644 --- a/src/boards/187.cpp +++ b/src/boards/187.cpp @@ -86,7 +86,6 @@ static void M187Power(void) { EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=0; GenMMC3Power(); -// Write_IRQFM(0x4017,0x40); SetReadHandler(0x5000,0x5FFF,M187Read); SetWriteHandler(0x5000,0x5FFF,M187WriteLo); SetWriteHandler(0x8000,0x8000,M187Write8000); diff --git a/src/boards/__dummy_mapper.cpp b/src/boards/__dummy_mapper.cpp index 08769b96..ac40c54d 100644 --- a/src/boards/__dummy_mapper.cpp +++ b/src/boards/__dummy_mapper.cpp @@ -1,7 +1,7 @@ /* FCE Ultra - NES/Famicom Emulator * * Copyright notice for this file: - * Copyright (C) 2006-2007 CaH4e3 + * Copyright (C) 2009 CaH4e3 * * 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 @@ -44,6 +44,8 @@ static DECLFW(MNNNWrite) static void MNNNPower(void) { +// SetReadHandler(0x6000,0x7fff,CartBR); +// SetWriteHandler(0x6000,0x7fff,CartBW); SetReadHandler(0x8000,0xFFFF,CartBR); SetWriteHandler(0x8000,0xFFFF,MNNNWrite); } diff --git a/src/boards/bonza.cpp b/src/boards/bonza.cpp index 812683f4..66429238 100644 --- a/src/boards/bonza.cpp +++ b/src/boards/bonza.cpp @@ -20,26 +20,10 @@ #include "mapinc.h" +#define CARD_EXTERNAL_INSERED 0x80 + static uint8 prg_reg; static uint8 chr_reg; - -static uint8 sim0reg, sim0bit, sim0byte, sim0parity, sim0bcnt; -static uint8 sim0bitw, sim0bytew, sim0parityw, sim0bcntw; - -static uint16 sim0data, sim0dataw, sim0iswrite; -static uint8 sim0array[128] = -{ - 0x14, 0x55, 0x45, 0xd3, 0x18, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xAA, -}; -static uint8 sim0cmd[16]; - static SFORMAT StateRegs[]= { {&prg_reg, 1, "PREG"}, @@ -47,6 +31,58 @@ static SFORMAT StateRegs[]= {0} }; +/* + +_GET_CHALLENGE: .BYTE 0,$B4, 0, 0,$62 + +_SELECT_FILE_1_0200: .BYTE 0,$A4, 1, 0, 2, 2, 0 +_SELECT_FILE_2_0201: .BYTE 0,$A4, 2, 0, 2, 2, 1 +_SELECT_FILE_2_0203: .BYTE 0,$A4, 2, 0, 2, 2, 3 +_SELECT_FILE_2_0204: .BYTE 0,$A4, 2, 0, 2, 2, 4 +_SELECT_FILE_2_0205: .BYTE 0,$A4, 2, 0, 2, 2, 5 +_SELECT_FILE_2_3F04: .BYTE 0,$A4, 2, 0, 2,$3F, 4 +_SELECT_FILE_2_4F00: .BYTE 0,$A4, 2, 0, 2,$4F, 0 + +_READ_BINARY_5: .BYTE 0,$B0,$85, 0, 2 +_READ_BINARY_6: .BYTE 0,$B0,$86, 0, 4 +_READ_BINARY_6_0: .BYTE 0,$B0,$86, 0,$18 +_READ_BINARY_0: .BYTE 0,$B0, 0, 2, 3 +_READ_BINARY_0_0: .BYTE 0,$B0, 0, 0, 4 +_READ_BINARY_0_1: .BYTE 0,$B0, 0, 0, $C +_READ_BINARY_0_2: .BYTE 0,$B0, 0, 0,$10 + +_UPDATE_BINARY: .BYTE 0,$D6, 0, 0, 4 +_UPDATE_BINARY_0: .BYTE 0,$D6, 0, 0,$10 + +_GET_RESPONSE: .BYTE $80,$C0, 2,$A1, 8 +_GET_RESPONSE_0: .BYTE 0,$C0, 0, 0, 2 +_GET_RESPONSE_1: .BYTE 0,$C0, 0, 0, 6 +_GET_RESPONSE_2: .BYTE 0,$C0, 0, 0, 8 +_GET_RESPONSE_3: .BYTE 0,$C0, 0, 0, $C +_GET_RESPONSE_4: .BYTE 0,$C0, 0, 0,$10 + +byte_8C0B: .BYTE $80,$30, 0, 2, $A, 0, 1 +byte_8C48: .BYTE $80,$32, 0, 1, 4 +byte_8C89: .BYTE $80,$34, 0, 0, 8, 0, 0 +byte_8D01: .BYTE $80,$36, 0, 0, $C +byte_8CA7: .BYTE $80,$38, 0, 2, 4 +byte_8BEC: .BYTE $80,$3A, 0, 3, 0 + +byte_89A0: .BYTE 0,$48, 0, 0, 6 +byte_8808: .BYTE 0,$54, 0, 0,$1C +byte_89BF: .BYTE 0,$58, 0, 0,$1C + +_MANAGE_CHANNEL: .BYTE 0,$70, 0, 0, 8 +byte_8CE5: .BYTE 0,$74, 0, 0,$12 +byte_8C29: .BYTE 0,$76, 0, 0, 8 +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 }; + static void Sync(void) { setprg32(0x8000, prg_reg); @@ -60,7 +96,6 @@ static void StateRestore(int version) static DECLFW(M216WriteHi) { -// FCEU_printf("%04x:%04x\n",A,V); prg_reg=A&1; chr_reg=(A&0x0E)>>1; Sync(); @@ -68,100 +103,13 @@ static DECLFW(M216WriteHi) static DECLFW(M216Write5000) { - sim0reg=V; - if(!sim0reg) - { - sim0bit=sim0byte=sim0parity=0; - sim0bitw=sim0bytew=sim0parityw=0; - sim0data=sim0array[0]; - sim0bcnt=0x7F; - } - if(sim0reg&0x20) - { - sim0bcnt=0x1E; - sim0bcntw=4; - } - if(sim0reg&0x08) - { - uint8 sim0in=0; - sim0iswrite=0x2C; - if(sim0bitw<8) - { - sim0in=(V&0x10)>>4; - sim0parityw+=sim0in; - sim0dataw|=sim0in<<7; - sim0dataw>>=1; - sim0bitw++; - } - else if(sim0bitw==8) - { - sim0bitw++; - } - else if(sim0bitw==9) - { - sim0parityw=0; - sim0bitw=0; - if(sim0bytew==sim0bcntw) - { - sim0reg=0x60; - sim0iswrite=0; - } - else - { - sim0cmd[sim0bytew++]=sim0dataw; - sim0dataw=0; - } - } - } - - FCEU_printf("WRITE: %04x:%04x (PC=%02x cnt=%02x)\n",A,V,X.PC,sim0bcnt); +// FCEU_printf("WRITE: %04x:%04x (PC=%02x cnt=%02x)\n",A,V,X.PC,sim0bcnt); } static DECLFR(M216Read5000) { - if(sim0reg&0x60) - { - if(sim0iswrite) - sim0iswrite--; - else - sim0reg=(sim0reg^(sim0reg<<1))&0x40; - FCEU_printf("READ: %04x PC=%04x reg=%02x\n",A,X.PC,sim0reg); - return sim0reg; - } - else - { - uint8 sim0out=0; - if(sim0bit<8) - { - sim0out=(sim0data&0x80)>>7; - sim0parity+=sim0out; - sim0out<<=6; - sim0data<<=1; - sim0bit++; - } - else if(sim0bit==8) - { - sim0bit++; - sim0out=(sim0parity&1)<<6; - } - else if(sim0bit==9) - { - sim0parity=0; - sim0bit=0; - if(sim0byte==sim0bcnt) - { - sim0reg=0x40; - sim0out=0x60; - } - else - { - sim0out=0; - sim0data=sim0array[sim0byte++]; - } - } - FCEU_printf("READ: %04x PC=%04x out=%02x byte=%02x cnt=%02x bit=%02x\n",A,X.PC,sim0out,sim0byte,sim0bcnt,sim0bit); - return sim0out; - } +// FCEU_printf("READ: %04x PC=%04x out=%02x byte=%02x cnt=%02x bit=%02x\n",A,X.PC,sim0out,sim0byte,sim0bcnt,sim0bit); + return 0; } static void Power(void) diff --git a/src/boards/copyfami_mmc3.cpp b/src/boards/copyfami_mmc3.cpp index 871c9daa..0f23c4dc 100644 --- a/src/boards/copyfami_mmc3.cpp +++ b/src/boards/copyfami_mmc3.cpp @@ -45,7 +45,7 @@ D6-D0 - Small Page High Address (D6,D5,D4,D3,D2,D1,D0,A11,A10,A9,A8,A7,A6,A5,A4, static uint8 reg[3]; -//static uint8 *CHRRAM=NULL; +static uint8 *CHRRAM=NULL; static uint32 CHRRAMSIZE; static SFORMAT StateRegs[]= diff --git a/src/boards/dance.cpp b/src/boards/dance.cpp new file mode 100644 index 00000000..9afe721e --- /dev/null +++ b/src/boards/dance.cpp @@ -0,0 +1,205 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2007 CaH4e3 + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Street Dance (Dance pad) (Unl) + */ + +#include "mapinc.h" + +static uint8 reg4[16]; +static uint8 regc[6]; +static uint8 reg2000, mmc3cmd, pcm_enable = 0, pcm_irq = 0; +static int16 pcm_addr, pcm_size, pcm_latch, pcm_clock = 0xF6; +static writefunc old4011write, old4012write, old4013write, old4015write; +static readfunc old4015read; + +static SFORMAT StateRegs[]= +{ + {reg4, 16, "reg4"}, + {regc, 6, "REGSC"}, + {®2000, 1, "REGS2"}, + {&pcm_enable, 1, "PCME"}, + {&pcm_irq, 1, "PCMIRQ"}, + {&pcm_addr, 2, "PCMADDR"}, + {&pcm_size, 2, "PCMSIZE"}, + {&pcm_latch, 2, "PCMLATCH"}, + {&pcm_clock, 2, "PCMCLOCK"}, + {&mmc3cmd, 1, "MMC3CMD"}, + {0} +}; + +static void Sync(void) +{ + uint8 cbase = reg2000 - ((reg4[0x0B]&4)?6:0); + uint8 pbase = reg4[0x09] & 0xC0; + + setchr1(0x0000,cbase|(regc[0]&(~1))); + setchr1(0x0400,cbase|(regc[0]|1)); + setchr1(0x0800,cbase|(regc[1]&(-1))); + setchr1(0x0c00,cbase|(regc[1]|1)); + setchr1(0x1000,cbase|regc[2]); + setchr1(0x1400,cbase|regc[3]); + setchr1(0x1800,cbase|regc[4]); + setchr1(0x1c00,cbase|regc[5]); + + + if(reg4[0x0B]&1) + { + setprg8(0x8000,reg4[0x07] + 0x20); + setprg8(0xA000,reg4[0x08] + 0x20); + } + else + { + setprg8(0x8000,reg4[0x07] + pbase); + setprg8(0xA000,reg4[0x08] + pbase); + } + + setprg8(0xC000,reg4[0x09]); + setprg8(0xE000,reg4[0x0A]); +} + +static DECLFW(UNLDANCEWrite2) +{ + reg2000 = V; + Sync(); + //FCEU_printf("write %04x:%04x\n",A,V); +} + +static DECLFW(UNLDANCEWrite4) +{ + reg4[A & 0x0F] = V; + Sync(); + //FCEU_printf("write %04x:%04x\n",A,V); +} + +static DECLFW(UNLDANCEWrite8) +{ + if(A&1) + { + if(mmc3cmd<6) + regc[mmc3cmd] = V; + else + reg4[0x07 + mmc3cmd - 6] = V; + } + else + mmc3cmd = V & 7; + Sync(); + //FCEU_printf("write %04x:%04x\n",A,V); +} + +static DECLFW(UNLDANCEWrite4012) +{ + pcm_addr = V << 6; + old4012write(A,V); +} + +static DECLFW(UNLDANCEWrite4013) +{ + pcm_size = (V << 4) + 1; + old4013write(A,V); +} + +static DECLFW(UNLDANCEWrite4015) +{ + pcm_enable = V&0x10; + if(pcm_irq) + { + X6502_IRQEnd(FCEU_IQEXT); + pcm_irq = 0; + } + if(pcm_enable) + pcm_latch = pcm_clock; + old4015write(A,V&0xEF); +} + +static DECLFR(UNLDANCERead4015) +{ + return (old4015read(A) & 0x7F) | pcm_irq; +} + +static void UNLDANCECpuHook(int a) +{ + if(pcm_enable) + { + pcm_latch-=a; + if(pcm_latch<=0) + { + pcm_latch+=pcm_clock; + pcm_size--; + if(pcm_size<0) + { + pcm_irq = 0x80; + pcm_enable = 0; + X6502_IRQBegin(FCEU_IQEXT); + } + else + { + uint8 raw_pcm = ARead[pcm_addr](pcm_addr) >> 1; + old4011write(0x4011,raw_pcm); + pcm_addr++; + pcm_addr&=0x7FFF; + } + } + } +} + +static void UNLDANCEPower(void) +{ + reg4[0x09]=0x3E; + reg4[0x0A]=0x3F; + SetupCartCHRMapping(0,PRGptr[0],512 * 1024,0); + + old4015read=GetReadHandler(0x4015); + SetReadHandler(0x4015,0x4015,UNLDANCERead4015); + SetReadHandler(0x8000,0xFFFF,CartBR); + + old4011write=GetWriteHandler(0x4011); + old4012write=GetWriteHandler(0x4012); + SetWriteHandler(0x4012,0x4012,UNLDANCEWrite4012); + old4013write=GetWriteHandler(0x4013); + SetWriteHandler(0x4013,0x4013,UNLDANCEWrite4013); + old4015write=GetWriteHandler(0x4015); + SetWriteHandler(0x4015,0x4015,UNLDANCEWrite4015); + + SetWriteHandler(0x201A,0x201A,UNLDANCEWrite2); + SetWriteHandler(0x4100,0x410F,UNLDANCEWrite4); + SetWriteHandler(0x8000,0x8001,UNLDANCEWrite8); + Sync(); +} + +static void UNLDANCEReset(void) +{ + reg4[0x09]=0x3E; + reg4[0x0A]=0x3F; + Sync(); +} + +static void StateRestore(int version) +{ + Sync(); +} + +void UNLDANCE_Init(CartInfo *info) +{ + info->Power=UNLDANCEPower; + info->Reset=UNLDANCEReset; + MapIRQHook=UNLDANCECpuHook; + GameStateRestore=StateRestore; + AddExState(&StateRegs, ~0, 0, 0); +} diff --git a/src/boards/fk23c.cpp b/src/boards/fk23c.cpp index 62eda01d..7be10d6c 100644 --- a/src/boards/fk23c.cpp +++ b/src/boards/fk23c.cpp @@ -108,15 +108,20 @@ static void BMCFK23CReset(void) EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0; EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF; MMC3RegReset(); + FixMMC3PRG(MMC3_cmd); + FixMMC3CHR(MMC3_cmd); } static void BMCFK23CPower(void) { + GenMMC3Power(); EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0; EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF; GenMMC3Power(); SetWriteHandler(0x5000,0x5fff,BMCFK23CWrite); SetWriteHandler(0x8000,0xFFFF,BMCFK23CHiWrite); + FixMMC3PRG(MMC3_cmd); + FixMMC3CHR(MMC3_cmd); } void BMCFK23C_Init(CartInfo *info) diff --git a/src/boards/konami-qtai.cpp b/src/boards/konami-qtai.cpp index 0e6f9bcf..b1c59e5a 100644 --- a/src/boards/konami-qtai.cpp +++ b/src/boards/konami-qtai.cpp @@ -147,15 +147,18 @@ static void VRC5IRQ(int a) if(IRQCount&0x10000) { X6502_IRQBegin(FCEU_IQEXT); - IRQCount=IRQLatch; +// IRQCount=IRQLatch; } } } static void Mapper190_PPU(uint32 A) { - if(A<0x2000) + if(A>=0x2000) + { + setchr4r(0x10,0x0000,QTAINTRAM[A&0x1FFF]&1); setchr4r(0x10,0x1000,QTAINTRAM[A&0x1FFF]&1); + } // else // chrSync(); } @@ -219,7 +222,7 @@ void Mapper190_Init(CartInfo *info) GameStateRestore=StateRestore; MapIRQHook=VRC5IRQ; -// PPU_hook=Mapper190_PPU; + //PPU_hook=Mapper190_PPU; CHRRAM=(uint8*)FCEU_gmalloc(CHRSIZE); SetupCartCHRMapping(0x10,CHRRAM,CHRSIZE,1); diff --git a/src/boards/mmc5.cpp b/src/boards/mmc5.cpp index 2fbd03e2..120bb3c5 100644 --- a/src/boards/mmc5.cpp +++ b/src/boards/mmc5.cpp @@ -130,10 +130,10 @@ uint8 mmc5_PPURead(uint32 A) { -// ETROM seems to have 16KB of WRAM, ELROM seems to have 8KB +// ELROM seems to have 8KB of RAM +// ETROM seems to have 16KB of WRAM // EWROM seems to have 32KB of WRAM - cartdata MMC5CartList[]= { {0x9c18762b,2}, /* L'Empereur */ @@ -864,8 +864,8 @@ static void GenMMC5_Init(CartInfo *info, int wsize, int battery) MMC5HackSPMode=MMC5HackSPScroll=MMC5HackSPPage=0; Mapper5_ESI(); - FFCEUX_PPURead = mmc5_PPURead; - FFCEUX_PPUWrite = mmc5_PPUWrite; + FFCEUX_PPURead = mmc5_PPURead; + FFCEUX_PPUWrite = mmc5_PPUWrite; } void Mapper5_Init(CartInfo *info) diff --git a/src/boards/sc-127.cpp b/src/boards/sc-127.cpp new file mode 100644 index 00000000..9aee7d21 --- /dev/null +++ b/src/boards/sc-127.cpp @@ -0,0 +1,125 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2009 CaH4e3 + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Wario Land II (Kirby hack) + */ + +#include "mapinc.h" + +static uint8 reg[8], chr[8]; +static uint8 *WRAM=NULL; +static uint32 WRAMSIZE; +static uint16 IRQCount, IRQa; + +static SFORMAT StateRegs[]= +{ + {reg, 8, "REGS"}, + {chr, 8, "CHRS"}, + {&IRQCount, 16, "IRQc"}, + {&IRQa, 16, "IRQa"}, + {0} +}; + +static void Sync(void) +{ + int i; + setprg8(0x8000,reg[0]); + setprg8(0xA000,reg[1]); + setprg8(0xC000,reg[2]); + for(i=0; i<8; i++) + setchr1(i << 10,chr[i]); + setmirror(reg[3]^1); +} + +static DECLFW(UNLSC127Write) +{ + switch(A) + { + case 0x8000: reg[0] = V; break; + case 0x8001: reg[1] = V; break; + case 0x8002: reg[2] = V; break; + case 0x9000: chr[0] = V; break; + case 0x9001: chr[1] = V; break; + case 0x9002: chr[2] = V; break; + case 0x9003: chr[3] = V; break; + case 0x9004: chr[4] = V; break; + case 0x9005: chr[5] = V; break; + case 0x9006: chr[6] = V; break; + case 0x9007: chr[7] = V; break; + case 0xC002: IRQa=0; X6502_IRQEnd(FCEU_IQEXT); break; + case 0xC005: IRQCount=V; break; + case 0xC003: IRQa=1; break; + case 0xD001: reg[3] = V; break; + } + Sync(); +} + +static void UNLSC127Power(void) +{ + Sync(); + setprg8r(0x10,0x6000,0); + setprg8(0xE000,~0); + SetReadHandler(0x6000,0x7fff,CartBR); + SetWriteHandler(0x6000,0x7fff,CartBW); + SetReadHandler(0x8000,0xFFFF,CartBR); + SetWriteHandler(0x8000,0xFFFF,UNLSC127Write); +} + +static void UNLSC127IRQ(void) +{ + if(IRQa) + { + IRQCount--; + if(IRQCount==0) + { + X6502_IRQBegin(FCEU_IQEXT); + IRQa=0; + } + } +} + +static void UNLSC127Reset(void) +{ +} + +static void UNLSC127Close(void) +{ + if(WRAM) + FCEU_gfree(WRAM); + WRAM=NULL; +} + +static void StateRestore(int version) +{ + Sync(); +} + +void UNLSC127_Init(CartInfo *info) +{ + info->Reset=UNLSC127Reset; + info->Power=UNLSC127Power; + info->Close=UNLSC127Close; + GameHBIRQHook=UNLSC127IRQ; + GameStateRestore=StateRestore; + WRAMSIZE=8192; + WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE); + SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1); + AddExState(WRAM, WRAMSIZE, 0, "WRAM"); + AddExState(&StateRegs, ~0, 0, 0); +} diff --git a/src/boards/sheroes.cpp b/src/boards/sheroes.cpp index 49f349eb..3b4a1b36 100644 --- a/src/boards/sheroes.cpp +++ b/src/boards/sheroes.cpp @@ -21,7 +21,7 @@ #include "mapinc.h" #include "mmc3.h" -//static uint8 *CHRRAM; +static uint8 *CHRRAM; static uint8 tekker; static void MSHCW(uint32 A, uint8 V) diff --git a/src/boards/super24.cpp b/src/boards/super24.cpp index 205c8d2c..745e723e 100644 --- a/src/boards/super24.cpp +++ b/src/boards/super24.cpp @@ -21,7 +21,7 @@ #include "mapinc.h" #include "mmc3.h" -//static uint8 *CHRRAM = NULL; +static uint8 *CHRRAM = NULL; static int masko8[8]={63,31,15,1,3,0,0,0}; static void Super24PW(uint32 A, uint8 V) diff --git a/src/debug.cpp b/src/debug.cpp index 7e95b319..060360f6 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -504,7 +504,7 @@ void BreakHit(bool force = false) { ///fires a breakpoint void breakpoint() { - int i; + int i; uint16 A=0; uint8 brk_type,opcode[3] = {0}; diff --git a/src/driver.h b/src/driver.h index 264c472e..65655605 100644 --- a/src/driver.h +++ b/src/driver.h @@ -84,7 +84,8 @@ void FCEUI_UseInputPreset(int preset); //New interface functions //0 to order screen snapshots numerically(0.png), 1 to order them file base-numerically(smb3-0.png). -void FCEUI_SetSnapName(bool a); +//this variable isn't used at all, snap is always name-based +//void FCEUI_SetSnapName(bool a); //0 to keep 8-sprites limitation, 1 to remove it void FCEUI_DisableSpriteLimitation(int a); diff --git a/src/drivers/win/common.h b/src/drivers/win/common.h index 412753e6..4f520341 100644 --- a/src/drivers/win/common.h +++ b/src/drivers/win/common.h @@ -54,7 +54,8 @@ extern int eoptions; #define EO_FOAFTERSTART 64 #define EO_NOTHROTTLE 128 #define EO_CLIPSIDES 256 -#define EO_SNAPNAME 512 +//ch4: this constant isn't used at all, snap is always name-based +//#define EO_SNAPNAME 512 #define EO_HIDEMENU 2048 #define EO_HIGHPRIO 4096 #define EO_FORCEASPECT 8192 diff --git a/src/drivers/win/config.cpp b/src/drivers/win/config.cpp index 5c49cd49..ada56b5c 100644 --- a/src/drivers/win/config.cpp +++ b/src/drivers/win/config.cpp @@ -110,7 +110,8 @@ static CFGSTRUCT fceuconfig[] = { NAC("vgamode",vmod), NAC("sound",soundo), NAC("sicon",status_icon), - AC(newppu), + //ch4: cause newppu mode fixation after changing through config file lol + //AC(newppu), NACS("odroms",directory_names[0]), NACS("odnonvol",directory_names[1]), diff --git a/src/drivers/win/debugger.h b/src/drivers/win/debugger.h index 9536135f..6c8b9d90 100644 --- a/src/drivers/win/debugger.h +++ b/src/drivers/win/debugger.h @@ -38,7 +38,7 @@ public: HFONT hFixedFont; static const int fixedFontWidth = 8; - static const int fixedFontHeight = 13; + static const int fixedFontHeight = 14; } *debugSystem; diff --git a/src/drivers/win/directories.cpp b/src/drivers/win/directories.cpp index 352db5bb..4319c3ae 100644 --- a/src/drivers/win/directories.cpp +++ b/src/drivers/win/directories.cpp @@ -8,14 +8,16 @@ void CloseDirectoriesDialog(HWND hwndDlg) { // Update the information from the screenshot naming checkbox - if(IsDlgButtonChecked(hwndDlg, CHECK_SCREENSHOT_NAMES) == BST_CHECKED) - { - eoptions |= EO_SNAPNAME; - } - else - { - eoptions &= ~EO_SNAPNAME; - } + + // this variable isn't used at all, snap is always name-based + //if(IsDlgButtonChecked(hwndDlg, CHECK_SCREENSHOT_NAMES) == BST_CHECKED) + //{ + // eoptions |= EO_SNAPNAME; + //} + //else + //{ + // eoptions &= ~EO_SNAPNAME; + //} RemoveDirs(); // Remove empty directories. @@ -99,10 +101,11 @@ static BOOL CALLBACK DirConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM } // Check the screenshot naming checkbox if necessary - if(eoptions & EO_SNAPNAME) - { - CheckDlgButton(hwndDlg, CHECK_SCREENSHOT_NAMES, BST_CHECKED); - } + // this variable isn't used at all, snap is always name-based + //if(eoptions & EO_SNAPNAME) + //{ + // CheckDlgButton(hwndDlg, CHECK_SCREENSHOT_NAMES, BST_CHECKED); + //} CenterWindowOnScreen(hwndDlg); diff --git a/src/drivers/win/main.cpp b/src/drivers/win/main.cpp index b438c851..e2848000 100644 --- a/src/drivers/win/main.cpp +++ b/src/drivers/win/main.cpp @@ -124,11 +124,11 @@ int soundquality = 1; //Sound volume controls (range 0-150 by 10's)j----- int soundvolume = 150; //Master sound volume -int soundTrianglevol = 100; //Sound channel Triangle - volume control -int soundSquare1vol = 100; //Sound channel Square1 - volume control -int soundSquare2vol = 100; //Sound channel Square2 - volume control -int soundNoisevol = 100; //Sound channel Noise - volume control -int soundPCMvol = 100; //Sound channel PCM - volume control +int soundTrianglevol = 256; //Sound channel Triangle - volume control +int soundSquare1vol = 256; //Sound channel Square1 - volume control +int soundSquare2vol = 256; //Sound channel Square2 - volume control +int soundNoisevol = 256; //Sound channel Noise - volume control +int soundPCMvol = 256; //Sound channel PCM - volume control //------------------------------------------------- double saspectw = 1, saspecth = 1; @@ -207,7 +207,7 @@ void SetDirs() FCEUIOD_AVI, FCEUIOD__COUNT}; - FCEUI_SetSnapName((eoptions & EO_SNAPNAME)!=0); +// FCEUI_SetSnapName((eoptions & EO_SNAPNAME)!=0); for(x=0; x < sizeof(jlist) / sizeof(*jlist); x++) { diff --git a/src/drivers/win/mapinput.cpp b/src/drivers/win/mapinput.cpp index a9457c85..c7de1b7d 100644 --- a/src/drivers/win/mapinput.cpp +++ b/src/drivers/win/mapinput.cpp @@ -22,10 +22,10 @@ static struct int key; } DefaultCommandMapping[]= { - { EMUCMD_RESET, SCAN_R | CMD_KEY_CTRL }, + { EMUCMD_RESET, SCAN_R | CMD_KEY_CTRL, }, { EMUCMD_PAUSE, SCAN_PAUSE, }, { EMUCMD_FRAME_ADVANCE, SCAN_BACKSLASH, }, - { EMUCMD_SCREENSHOT, SCAN_F12 }, + { EMUCMD_SCREENSHOT, SCAN_F12, }, { EMUCMD_HIDE_MENU_TOGGLE, SCAN_ESCAPE }, { EMUCMD_SPEED_SLOWER, SCAN_MINUS, }, { EMUCMD_SPEED_FASTER, SCAN_EQUAL, }, @@ -65,11 +65,11 @@ static struct { EMUCMD_LOAD_STATE_SLOT_7, SCAN_F7, }, { EMUCMD_LOAD_STATE_SLOT_8, SCAN_F8, }, { EMUCMD_LOAD_STATE_SLOT_9, SCAN_F9, }, - { EMUCMD_MOVIE_PLAY_FROM_BEGINNING, SCAN_R | CMD_KEY_SHIFT }, - { EMUCMD_SCRIPT_RELOAD, SCAN_L | CMD_KEY_SHIFT }, - { EMUCMD_OPENROM, SCAN_O | CMD_KEY_CTRL }, - { EMUCMD_CLOSEROM, SCAN_W | CMD_KEY_CTRL }, - { EMUCMD_MISC_UNDOREDOSAVESTATE, SCAN_Z | CMD_KEY_CTRL }, + { EMUCMD_MOVIE_PLAY_FROM_BEGINNING, SCAN_R | CMD_KEY_SHIFT, }, + { EMUCMD_SCRIPT_RELOAD, SCAN_L | CMD_KEY_SHIFT, }, + { EMUCMD_OPENROM, SCAN_O | CMD_KEY_CTRL, }, + { EMUCMD_CLOSEROM, SCAN_W | CMD_KEY_CTRL, }, + { EMUCMD_MISC_UNDOREDOSAVESTATE, SCAN_Z | CMD_KEY_CTRL, }, }; #define NUM_DEFAULT_MAPPINGS (sizeof(DefaultCommandMapping)/sizeof(DefaultCommandMapping[0])) @@ -333,21 +333,21 @@ BOOL CALLBACK ChangeInputDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR return FALSE; case WM_COMMAND: - if(LOWORD(wParam) == BTN_CANCELED && HIWORD(wParam) == BN_CLICKED) //adelikat: changed BTN_CANCEL to BTN_CANCELED so that the esc key does not default to this button (so it can be assigned as a hotkey) + switch(LOWORD(wParam)) // CaH4e3: BN_CLICKED redundant define removed since it always 0, Esc mapping used to be handled as well (I need it too :)) { - key = 0; - - // Send quit message. - PostMessage(hwndDlg, WM_USER + 1, 0, 0); + case BTN_CANCEL: + key = 0; + // Send quit message. + PostMessage(hwndDlg, WM_USER + 1, 0, 0); + break; + case BTN_CLEAR: + key = -1; + // Send quit message. + PostMessage(hwndDlg, WM_USER + 1, 0, 0); + break; + default: + break; } - else if(LOWORD(wParam) == BTN_CLEAR && HIWORD(wParam) == BN_CLICKED) - { - key = -1; - - // Send quit message. - PostMessage(hwndDlg, WM_USER+1, 0, 0); - } - break; case WM_USER: @@ -700,7 +700,7 @@ BOOL CALLBACK MapInputDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM EndDialog(hwndDlg, 1); return TRUE; - case IDCANCEL: + case BTN_CANCEL: // here true cause of ESC button handling as EXIT ;) EndDialog(hwndDlg, 0); return TRUE; diff --git a/src/drivers/win/memview.cpp b/src/drivers/win/memview.cpp index 4e0bf2b1..10068c3c 100644 --- a/src/drivers/win/memview.cpp +++ b/src/drivers/win/memview.cpp @@ -846,7 +846,7 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa SCROLLINFO si; int x, y, i, j; int tempAddy; - RECT wrect; + RECT wrect; const int MemFontWidth = debugSystem->fixedFontWidth; const int MemFontHeight = debugSystem->fixedFontHeight; diff --git a/src/drivers/win/memviewsp.cpp b/src/drivers/win/memviewsp.cpp index 1cda5cae..fdc305f7 100644 --- a/src/drivers/win/memviewsp.cpp +++ b/src/drivers/win/memviewsp.cpp @@ -172,7 +172,7 @@ void updateBookmarkMenus(HMENU menu) for (i = 0;i-.png"".",CHECK_SCREENSHOT_NAMES, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,71,114,158,12 - EDITTEXT 105,71,129,158,12,ES_AUTOHSCROLL - EDITTEXT 106,71,147,158,12,ES_AUTOHSCROLL - EDITTEXT 107,71,165,158,12,ES_AUTOHSCROLL - EDITTEXT 110,71,183,158,12,ES_AUTOHSCROLL - EDITTEXT 111,71,201,158,12,ES_AUTOHSCROLL + EDITTEXT 105,71,117,158,12,ES_AUTOHSCROLL + EDITTEXT 106,71,135,158,12,ES_AUTOHSCROLL + EDITTEXT 107,71,153,158,12,ES_AUTOHSCROLL + EDITTEXT 110,71,171,158,12,ES_AUTOHSCROLL + EDITTEXT 111,71,189,158,12,ES_AUTOHSCROLL + EDITTEXT 112,71,207,158,12,ES_AUTOHSCROLL PUSHBUTTON "Browse...",213,239,8,56,14 PUSHBUTTON "Browse...",BUTTON_ROMS,239,26,56,14 PUSHBUTTON "Browse...",201,239,44,56,14 PUSHBUTTON "Browse...",202,239,62,56,14 PUSHBUTTON "Browse...",203,239,80,56,14 PUSHBUTTON "Browse...",204,239,98,56,14 - PUSHBUTTON "Browse...",205,239,128,56,14 - PUSHBUTTON "Browse...",206,239,146,56,14 - PUSHBUTTON "Browse...",207,239,164,56,14 - PUSHBUTTON "Browse...",210,239,182,56,14 - PUSHBUTTON "Browse...",211,239,200,56,14 + PUSHBUTTON "Browse...",205,239,116,56,14 + PUSHBUTTON "Browse...",206,239,134,56,14 + PUSHBUTTON "Browse...",207,239,152,56,14 + PUSHBUTTON "Browse...",210,239,170,56,14 + PUSHBUTTON "Browse...",211,239,188,56,14 + PUSHBUTTON "Browse...",212,239,206,56,14 LTEXT "Base Directory",IDC_STATIC,10,10,47,8 LTEXT "Roms",IDC_STATIC,10,28,19,8 LTEXT "Battery Saves",IDC_STATIC,10,46,45,8 LTEXT "Save States",IDC_STATIC,10,64,41,9 LTEXT "FDS Bios Rom",IDC_STATIC,10,82,47,8 LTEXT "Screenshots",IDC_STATIC,10,100,40,8 - LTEXT "Cheats",IDC_STATIC,10,130,23,8 - LTEXT "Movies",IDC_STATIC,10,148,24,8 - LTEXT "Memory Watch",IDC_STATIC,10,166,52,9 - LTEXT "Input Presets",IDC_STATIC,10,184,42,8 - LTEXT "Lua Scripts",IDC_STATIC,10,202,36,8 - EDITTEXT 112,71,219,158,12,ES_AUTOHSCROLL - PUSHBUTTON "Browse...",212,239,218,56,14 - LTEXT "Avi Output",IDC_STATIC,9,219,34,8 + LTEXT "Cheats",IDC_STATIC,10,118,23,8 + LTEXT "Movies",IDC_STATIC,10,136,24,8 + LTEXT "Memory Watch",IDC_STATIC,10,154,52,9 + LTEXT "Input Presets",IDC_STATIC,10,172,42,8 + LTEXT "Lua Scripts",IDC_STATIC,10,190,36,8 + LTEXT "Avi Output",IDC_STATIC,10,208,34,8 END DWBDIALOG DIALOG 33, 99, 250, 56 @@ -649,8 +648,8 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Hotkeys" FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN - DEFPUSHBUTTON "OK",1,265,274,50,14 - PUSHBUTTON "Cancel",2,209,274,50,14 + DEFPUSHBUTTON "OK",IDOK,265,274,50,14 + PUSHBUTTON "Cancel",BTN_CANCEL,209,274,50,14 CONTROL "List2",LV_MAPPING,"SysListView32",LVS_REPORT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,308,243 PUSHBUTTON "Restore Defaults",BTN_RESTORE_DEFAULTS,7,274,75,14 COMBOBOX COMBO_FILTER,32,255,283,193,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP @@ -693,7 +692,7 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Enter New Input" FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN - PUSHBUTTON "Cancel",BTN_CANCELED,40,45,50,14 + PUSHBUTTON "Cancel",BTN_CANCEL,40,45,50,14 CTEXT "Press a key",LBL_KEY_COMBO,47,14,90,12 PUSHBUTTON "Clear",BTN_CLEAR,95,45,50,14 END @@ -1780,7 +1779,8 @@ IDB_TE_ARROW BITMAP "res/te_arrow.bmp" // // Generated from the TEXTINCLUDE 3 resource. // - + + ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index 0787a1cf..23868477 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -5,7 +5,7 @@ #define CLOSE_BUTTON 1 #define BUTTON_CLOSE 1 #define BTN_CLOSE 1 -#define BTN_CANCEL 2 +#define BTN_CANCEL 800 #define MENU_OPEN_FILE 100 #define EDIT_ROMS 100 #define LBL_LOG_TEXT 100 @@ -202,7 +202,7 @@ #define IDC_DEBUGGER_ENABLE_SYMBOLIC 208 #define BTN_NETMOO_CONNECT 250 #define MENU_HIDE_MENU 300 -#define CHECK_SCREENSHOT_NAMES 300 +//#define CHECK_SCREENSHOT_NAMES 300 #define COMBO_FILTER 300 #define IDC_EDIT_AUTHORINFO 300 #define IDC_LABEL_LENGTH 300 diff --git a/src/drivers/win/sound.cpp b/src/drivers/win/sound.cpp index c805fd49..a8ca3fc3 100644 --- a/src/drivers/win/sound.cpp +++ b/src/drivers/win/sound.cpp @@ -483,28 +483,28 @@ case WM_INITDIALOG: SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR,TBM_SETTICFREQ,25,0); SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR,TBM_SETPOS,1,150-soundvolume); //Triangle - SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_TRIANGLE,TBM_SETRANGE,1,MAKELONG(0,100)); - SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_TRIANGLE,TBM_SETTICFREQ,25,0); - SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_TRIANGLE,TBM_SETPOS,1,100-soundTrianglevol); + SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_TRIANGLE,TBM_SETRANGE,1,MAKELONG(0,256)); + SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_TRIANGLE,TBM_SETTICFREQ,32,0); + SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_TRIANGLE,TBM_SETPOS,1,256-soundTrianglevol); //Square1 - SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE1,TBM_SETRANGE,1,MAKELONG(0,100)); - SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE1,TBM_SETTICFREQ,25,0); - SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE1,TBM_SETPOS,1,100-soundSquare1vol); + SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE1,TBM_SETRANGE,1,MAKELONG(0,256)); + SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE1,TBM_SETTICFREQ,32,0); + SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE1,TBM_SETPOS,1,256-soundSquare1vol); //Square2 - SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE2,TBM_SETRANGE,1,MAKELONG(0,100)); - SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE2,TBM_SETTICFREQ,25,0); - SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE2,TBM_SETPOS,1,100-soundSquare2vol); + SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE2,TBM_SETRANGE,1,MAKELONG(0,256)); + SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE2,TBM_SETTICFREQ,32,0); + SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE2,TBM_SETPOS,1,256-soundSquare2vol); //Noise - SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_NOISE,TBM_SETRANGE,1,MAKELONG(0,100)); - SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_NOISE,TBM_SETTICFREQ,25,0); - SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_NOISE,TBM_SETPOS,1,100-soundNoisevol); + SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_NOISE,TBM_SETRANGE,1,MAKELONG(0,256)); + SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_NOISE,TBM_SETTICFREQ,32,0); + SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_NOISE,TBM_SETPOS,1,256-soundNoisevol); //PCM - SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_PCM,TBM_SETRANGE,1,MAKELONG(0,100)); - SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_PCM,TBM_SETTICFREQ,25,0); - SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_PCM,TBM_SETPOS,1,100-soundPCMvol); + SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_PCM,TBM_SETRANGE,1,MAKELONG(0,256)); + SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_PCM,TBM_SETTICFREQ,32,0); + SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_PCM,TBM_SETPOS,1,256-soundPCMvol); /* buffer size time trackbar */ SendDlgItemMessage(hwndDlg,CTL_LATENCY_TRACKBAR,TBM_SETRANGE,1,MAKELONG(15,200)); @@ -543,23 +543,23 @@ case WM_VSCROLL: FCEUI_SetSoundVolume(soundvolume); break; case CTL_VOLUME_TRACKBAR_TRIANGLE: - soundTrianglevol=100-SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_TRIANGLE,TBM_GETPOS,0,0); + soundTrianglevol=256-SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_TRIANGLE,TBM_GETPOS,0,0); FCEUI_SetTriangleVolume(soundTrianglevol); break; case CTL_VOLUME_TRACKBAR_SQUARE1: - soundSquare1vol=100-SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE1,TBM_GETPOS,0,0); + soundSquare1vol=256-SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE1,TBM_GETPOS,0,0); FCEUI_SetSquare1Volume(soundSquare1vol); break; case CTL_VOLUME_TRACKBAR_SQUARE2: - soundSquare2vol=100-SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE2,TBM_GETPOS,0,0); + soundSquare2vol=256-SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE2,TBM_GETPOS,0,0); FCEUI_SetSquare2Volume(soundSquare2vol); break; case CTL_VOLUME_TRACKBAR_NOISE: - soundNoisevol=100-SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_NOISE,TBM_GETPOS,0,0); + soundNoisevol=256-SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_NOISE,TBM_GETPOS,0,0); FCEUI_SetNoiseVolume(soundNoisevol); break; case CTL_VOLUME_TRACKBAR_PCM: - soundPCMvol=100-SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_PCM,TBM_GETPOS,0,0); + soundPCMvol=256-SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_PCM,TBM_GETPOS,0,0); FCEUI_SetPCMVolume(soundPCMvol); break; default: @@ -675,18 +675,18 @@ case WM_COMMAND: case IDC_SOUND_RESTOREDEFAULTVOL: //Restore default values soundvolume = 150; - soundTrianglevol = 100; - soundSquare1vol = 100; - soundSquare2vol = 100; - soundNoisevol = 100; - soundPCMvol = 100; + soundTrianglevol = 256; + soundSquare1vol = 256; + soundSquare2vol = 256; + soundNoisevol = 256; + soundPCMvol = 256; //Update trackbars SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR,TBM_SETPOS,1,150-soundvolume); - SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_TRIANGLE,TBM_SETPOS,1,100-soundTrianglevol); - SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE1,TBM_SETPOS,1,100-soundSquare1vol); - SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE2,TBM_SETPOS,1,100-soundSquare2vol); - SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_NOISE,TBM_SETPOS,1,100-soundNoisevol); - SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_PCM,TBM_SETPOS,1,100-soundPCMvol); + SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_TRIANGLE,TBM_SETPOS,1,256-soundTrianglevol); + SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE1,TBM_SETPOS,1,256-soundSquare1vol); + SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE2,TBM_SETPOS,1,256-soundSquare2vol); + SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_NOISE,TBM_SETPOS,1,256-soundNoisevol); + SendDlgItemMessage(hwndDlg,CTL_VOLUME_TRACKBAR_PCM,TBM_SETPOS,1,256-soundPCMvol); //Set sound volumes FCEUI_SetSoundVolume(soundvolume); diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index 8465b7e1..b8bfb68f 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -1578,13 +1578,13 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) if(wParam==SC_KEYMENU) { - if(GameInfo && InputType[2]==SIFC_FKB && cidisabled) + if(GameInfo && ((InputType[2]==SIFC_FKB) || (InputType[2]==SIFC_SUBORKB)) && cidisabled) break; if(lParam == VK_RETURN || fullscreen || tog) break; } goto proco; case WM_SYSKEYDOWN: - if(GameInfo && InputType[2]==SIFC_FKB && cidisabled) + if(GameInfo && ((InputType[2]==SIFC_FKB) || (InputType[2]==SIFC_SUBORKB)) && cidisabled) break; // Hopefully this won't break DInput... if(fullscreen || tog) @@ -1593,6 +1593,9 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) break; } + if(wParam==VK_F10) + break; // 11.12.08 CH4 Disable F10 as System Key dammit + if(wParam == VK_RETURN) { if(!(lParam&(1<<30))) @@ -1621,6 +1624,16 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) if(cidisabled) break; // Hopefully this won't break DInput... } + if(InputType[2]==SIFC_SUBORKB) + { + if(wParam==VK_SCROLL) + { + cidisabled^=1; + FCEUI_DispMessage("Subor Keyboard %sabled.",cidisabled?"en":"dis"); + } + if(cidisabled) + break; + } } goto proco; diff --git a/src/fceu.cpp b/src/fceu.cpp index c7ee63ba..8ae3586c 100644 --- a/src/fceu.cpp +++ b/src/fceu.cpp @@ -483,11 +483,11 @@ bool FCEUI_Initialize() FSettings.UsrLastSLine[0]=239; FSettings.UsrLastSLine[1]=239; FSettings.SoundVolume=150; //0-150 scale - FSettings.TriangleVolume=100; //0-100 scale (100 is max volume) - FSettings.Square1Volume=100; //0-100 scale (100 is max volume) - FSettings.Square2Volume=100; //0-100 scale (100 is max volume) - FSettings.NoiseVolume=100; //0-100 scale (100 is max volume) - FSettings.PCMVolume=100; //0-100 scale (100 is max volume) + FSettings.TriangleVolume=256; //0-256 scale (256 is max volume) + FSettings.Square1Volume=256; //0-256 scale (256 is max volume) + FSettings.Square2Volume=256; //0-256 scale (256 is max volume) + FSettings.NoiseVolume=256; //0-256 scale (256 is max volume) + FSettings.PCMVolume=256; //0-256 scale (256 is max volume) FCEUPPU_Init(); @@ -833,10 +833,11 @@ void FCEUI_SetGameGenie(bool a) FSettings.GameGenie = a; } -void FCEUI_SetSnapName(bool a) -{ - FSettings.SnapName = a; -} +//this variable isn't used at all, snap is always name-based +//void FCEUI_SetSnapName(bool a) +//{ +// FSettings.SnapName = a; +//} int32 FCEUI_GetDesiredFPS(void) { diff --git a/src/fceu.h b/src/fceu.h index 6198aa7c..0611bc4c 100644 --- a/src/fceu.h +++ b/src/fceu.h @@ -92,7 +92,8 @@ typedef struct { int UsrFirstSLine[2]; int UsrLastSLine[2]; - int SnapName; + //this variable isn't used at all, snap is always name-based + //bool SnapName; uint32 SndRate; int soundq; int lowpass; diff --git a/src/ines-correct.h b/src/ines-correct.h index 1fa61af7..46c4792e 100644 --- a/src/ines-correct.h +++ b/src/ines-correct.h @@ -242,7 +242,7 @@ {0x22d6d5bd,4,1}, {0x6a03d3f3,114,-1}, - {0x02c41438,179,-1}, /* Xing He Zhan Shi (C) */ + {0x02c41438,176,-1}, /* Xing He Zhan Shi (C) */ {0x0da5e32e,101,-1}, /* new Uruusey Yatsura */ {0x4f2f1846,-1,1}, /* Famista '89 - Kaimaku Han!! (J) */ diff --git a/src/ines.cpp b/src/ines.cpp index ff50a8c6..53ca4358 100644 --- a/src/ines.cpp +++ b/src/ines.cpp @@ -1254,6 +1254,7 @@ static BMAPPING bmap[] = { {16, Mapper16_Init}, {19, Mapper19_Init}, {23, Mapper23_Init}, + {35, UNLSC127_Init}, // Wario Land 2 {36, Mapper36_Init}, // TXC Policeman {37, Mapper37_Init}, {38, Mapper38_Init}, // Bit Corp. Crime Busters @@ -1325,9 +1326,10 @@ static BMAPPING bmap[] = { {171, Mapper171_Init}, {172, Mapper172_Init}, {173, Mapper173_Init}, + {175, Mapper175_Init}, + {176, BMCFK23C_Init}, {177, Mapper177_Init}, {178, Mapper178_Init}, - {179, Mapper179_Init}, {180, Mapper180_Init}, {181, Mapper181_Init}, {182, Mapper182_Init}, @@ -1363,7 +1365,8 @@ static BMAPPING bmap[] = { // {220, UNLTF1201_Init}, // {220, TCU02_Init}, // {220, UNLCN22M_Init}, - {220, BMCT2271_Init}, +// {220, BMCT2271_Init}, +// {220, UNLDANCE_Init}, {221, UNLN625092_Init}, {222, Mapper222_Init}, diff --git a/src/ines.h b/src/ines.h index a285b6b5..91e6ac2d 100644 --- a/src/ines.h +++ b/src/ines.h @@ -411,9 +411,9 @@ void Mapper165_Init(CartInfo *); void Mapper171_Init(CartInfo *); void Mapper172_Init(CartInfo *); void Mapper173_Init(CartInfo *); +void Mapper175_Init(CartInfo *); void Mapper177_Init(CartInfo *); void Mapper178_Init(CartInfo *); -void Mapper179_Init(CartInfo *); void Mapper180_Init(CartInfo *); void Mapper181_Init(CartInfo *); void Mapper182_Init(CartInfo *); diff --git a/src/input.cpp b/src/input.cpp index 84febdd6..faad5019 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -617,6 +617,7 @@ struct EMUCMDTABLE FCEUI_CommandTable[]= { EMUCMD_FRAME_ADVANCE, EMUCMDTYPE_MISC, FCEUI_FrameAdvance, FCEUI_FrameAdvanceEnd, 0, "Frame Advance", EMUCMDFLAG_TASEDIT }, { EMUCMD_SCREENSHOT, EMUCMDTYPE_MISC, FCEUI_SaveSnapshot, 0, 0, "Screenshot", EMUCMDFLAG_TASEDIT }, { EMUCMD_HIDE_MENU_TOGGLE, EMUCMDTYPE_MISC, FCEUD_HideMenuToggle, 0, 0, "Hide Menu Toggle", EMUCMDFLAG_TASEDIT }, + { EMUCMD_EXIT, EMUCMDTYPE_MISC, DoFCEUExit, 0, 0, "Exit", 0}, { EMUCMD_SPEED_SLOWEST, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Slowest Speed", 0 }, { EMUCMD_SPEED_SLOWER, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Speed Down", 0 }, diff --git a/src/input.h b/src/input.h index 7601018d..c07a3ca4 100644 --- a/src/input.h +++ b/src/input.h @@ -213,7 +213,9 @@ enum EMUCMD //----------------------------- EMUCMD_MISC_DISPLAY_MOVIESUBTITLES, EMUCMD_MISC_UNDOREDOSAVESTATE, - EMUCMD_MAX + EMUCMD_MAX, + //For campatibility with old configuration files + EMUCMD_EXIT }; enum EMUCMDTYPE diff --git a/src/ppu.cpp b/src/ppu.cpp index eabb616f..6d9965e4 100644 --- a/src/ppu.cpp +++ b/src/ppu.cpp @@ -388,8 +388,8 @@ void (*FFCEUX_PPUWrite)(uint32 A, uint8 V) = 0; #define CALL_PPUWRITE(A,V) (FFCEUX_PPUWrite?FFCEUX_PPUWrite(A,V):FFCEUX_PPUWrite_Default(A,V)) -//whether to use the new ppu -int newppu=0; +//whether to use the new ppu (new PPU doesn't handle MMC5 extra nametables at all +int newppu = 0; //--------------- static DECLFR(A2002) @@ -1854,7 +1854,7 @@ int FCEUX_PPU_Loop(int skip) { ppuphase = PPUPHASE_BG; - if(sl != 0) { + if(sl != 0) { DEBUG(FCEUD_UpdatePPUView(scanline=yp,1)); DEBUG(FCEUD_UpdateNTView(scanline=yp,1)); } diff --git a/src/sound.cpp b/src/sound.cpp index eb4c7ee3..2f5f37ec 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -546,7 +546,7 @@ void RDoPCM(void) uint32 V; //mbg merge 7/17/06 made uint32 for(V=ChannelBC[4];V + + + + @@ -417,10 +425,6 @@ RelativePath="..\src\boards\178.cpp" > - - @@ -565,6 +569,10 @@ RelativePath="..\src\boards\copyfami_mmc3.cpp" > + + @@ -653,6 +661,10 @@ RelativePath="..\src\boards\sachen.cpp" > + + @@ -1706,8 +1718,7 @@ > @@ -2481,8 +2491,7 @@ >