diff --git a/src/boards/bandai.cpp b/src/boards/bandai.cpp index 24043a99..73efbbec 100644 --- a/src/boards/bandai.cpp +++ b/src/boards/bandai.cpp @@ -48,120 +48,205 @@ static SFORMAT StateRegs[] = #define X24C0X_READ 3 #define X24C0X_WRITE 4 -static uint8 x24c0x_data[256], x24c0x_state; -static uint8 x24c0x_addr, x24c0x_word, x24c0x_latch, x24c0x_bitcount; -static uint8 x24c0x_sda, x24c0x_scl, x24c0x_out, x24c0x_oe; +static uint8 x24c0x_data[512]; -static SFORMAT x24c0xStateRegs[] = +static uint8 x24c01_state; +static uint8 x24c01_addr, x24c01_word, x24c01_latch, x24c01_bitcount; +static uint8 x24c01_sda, x24c01_scl, x24c01_out; + +static uint8 x24c02_state; +static uint8 x24c02_addr, x24c02_word, x24c02_latch, x24c02_bitcount; +static uint8 x24c02_sda, x24c02_scl, x24c02_out; + +static SFORMAT x24c01StateRegs[] = { - { &x24c0x_addr, 1, "ADDR" }, - { &x24c0x_word, 1, "WORD" }, - { &x24c0x_latch, 1, "LATC" }, - { &x24c0x_bitcount, 1, "BITC" }, - { &x24c0x_sda, 1, "SDA" }, - { &x24c0x_scl, 1, "SCL" }, - { &x24c0x_out, 1, "OUT" }, - { &x24c0x_oe, 1, "OE" }, - { &x24c0x_state, 1, "STAT" }, + { &x24c01_addr, 1, "ADDR" }, + { &x24c01_word, 1, "WORD" }, + { &x24c01_latch, 1, "LATC" }, + { &x24c01_bitcount, 1, "BITC" }, + { &x24c01_sda, 1, "SDA" }, + { &x24c01_scl, 1, "SCL" }, + { &x24c01_out, 1, "OUT" }, + { &x24c01_state, 1, "STAT" }, { 0 } }; -static void x24c0x_init() { - x24c0x_addr = x24c0x_word = x24c0x_latch = x24c0x_bitcount = x24c0x_sda = x24c0x_scl = x24c0x_oe = 0; - x24c0x_state = X24C0X_STANDBY; +static SFORMAT x24c02StateRegs[] = +{ + { &x24c02_addr, 1, "ADDR" }, + { &x24c02_word, 1, "WORD" }, + { &x24c02_latch, 1, "LATC" }, + { &x24c02_bitcount, 1, "BITC" }, + { &x24c02_sda, 1, "SDA" }, + { &x24c02_scl, 1, "SCL" }, + { &x24c02_out, 1, "OUT" }, + { &x24c02_state, 1, "STAT" }, + { 0 } +}; + +static void x24c01_init() { + x24c01_addr = x24c01_word = x24c01_latch = x24c01_bitcount = x24c01_sda = x24c01_scl = 0; + x24c01_state = X24C0X_STANDBY; } -static void x24c0x_write(uint8 data) { - uint8 sda = (data >> 6) & 1; - uint8 scl = (data >> 5) & 1; - x24c0x_oe = (data >> 7); +static void x24c02_init() { + x24c02_addr = x24c02_word = x24c02_latch = x24c02_bitcount = x24c02_sda = x24c02_scl = 0; + x24c02_state = X24C0X_STANDBY; +} - if(x24c0x_scl && scl) { - if(x24c0x_sda && !sda) { // START - x24c0x_state = X24C0X_ADDRESS; - x24c0x_bitcount = 0; - x24c0x_addr = 0; - } else if(!x24c0x_sda && sda) { //STOP - x24c0x_state = X24C0X_STANDBY; +static void x24c01_write(uint8 data) { + uint8 scl = (data >> 5) & 1; + uint8 sda = (data >> 6) & 1; + + if(x24c01_scl && scl) { + if(x24c01_sda && !sda) { // START + x24c01_state = X24C0X_ADDRESS; + x24c01_bitcount = 0; + x24c01_addr = 0; + } else if(!x24c01_sda && sda) { //STOP + x24c01_state = X24C0X_STANDBY; } - } else if(!x24c0x_scl && scl) { // RISING EDGE - switch(x24c0x_state) { + } else if(!x24c01_scl && scl) { // RISING EDGE + switch(x24c01_state) { case X24C0X_ADDRESS: - if(x24c0x_bitcount < 7) { - x24c0x_addr <<= 1; - x24c0x_addr |= sda; + if(x24c01_bitcount < 7) { + x24c01_addr <<= 1; + x24c01_addr |= sda; } else { - if(!x24c02) // X24C01 mode - x24c0x_word = x24c0x_addr; - if(sda) { // READ COMMAND - x24c0x_state = X24C0X_READ; - } else { // WRITE COMMAND - if(x24c02) // X24C02 mode - x24c0x_state = X24C0X_WORD; - else - x24c0x_state = X24C0X_WRITE; - } + x24c01_word = x24c01_addr; + if(sda) // READ COMMAND + x24c01_state = X24C0X_READ; + else // WRITE COMMAND + x24c01_state = X24C0X_WRITE; } - x24c0x_bitcount++; - break; - case X24C0X_WORD: - if(x24c0x_bitcount == 8) { // ACK - x24c0x_word = 0; - x24c0x_out = 0; - } else { // WORD ADDRESS INPUT - x24c0x_word <<= 1; - x24c0x_word |= sda; - if(x24c0x_bitcount == 16) { // END OF ADDRESS INPUT - x24c0x_bitcount = 7; - x24c0x_state = X24C0X_WRITE; - } - } - x24c0x_bitcount++; + x24c01_bitcount++; break; case X24C0X_READ: - if (x24c0x_bitcount == 8) { // ACK - x24c0x_out = 0; - x24c0x_latch = x24c0x_data[x24c0x_word]; - x24c0x_bitcount = 0; - } else { // REAL OUTPUT - x24c0x_out = x24c0x_latch >> 7; - x24c0x_latch <<= 1; - x24c0x_bitcount++; - if(x24c0x_bitcount == 8) { - x24c0x_word++; - x24c0x_word &= 0xff; + if (x24c01_bitcount == 8) { // ACK + x24c01_out = 0; + x24c01_latch = x24c0x_data[x24c01_word]; + x24c01_bitcount = 0; + } else { // REAL OUTPUT + x24c01_out = x24c01_latch >> 7; + x24c01_latch <<= 1; + x24c01_bitcount++; + if(x24c01_bitcount == 8) { + x24c01_word++; + x24c01_word &= 0xff; } } break; case X24C0X_WRITE: - if (x24c0x_bitcount == 8) { // ACK - x24c0x_out = 0; - x24c0x_latch = 0; - x24c0x_bitcount = 0; - } else { // REAL INPUT - x24c0x_latch <<= 1; - x24c0x_latch |= sda; - x24c0x_bitcount++; - if(x24c0x_bitcount == 8) { - x24c0x_data[x24c0x_word] = x24c0x_latch; - x24c0x_word++; - x24c0x_word &= 0xff; + if (x24c01_bitcount == 8) { // ACK + x24c01_out = 0; + x24c01_latch = 0; + x24c01_bitcount = 0; + } else { // REAL INPUT + x24c01_latch <<= 1; + x24c01_latch |= sda; + x24c01_bitcount++; + if(x24c01_bitcount == 8) { + x24c0x_data[x24c01_word] = x24c01_latch; + x24c01_word++; + x24c01_word &= 0xff; } } break; } } - x24c0x_sda = sda; - x24c0x_scl = scl; + x24c01_sda = sda; + x24c01_scl = scl; } -static uint8 x24c0x_read() { - return x24c0x_out << 4; +static void x24c02_write(uint8 data) { + uint8 scl = (data >> 5) & 1; + uint8 sda = (data >> 6) & 1; + + if (x24c02_scl && scl) { + if (x24c02_sda && !sda) { // START + x24c02_state = X24C0X_ADDRESS; + x24c02_bitcount = 0; + x24c02_addr = 0; + } else if (!x24c02_sda && sda) { //STOP + x24c02_state = X24C0X_STANDBY; + } + } else if (!x24c02_scl && scl) { // RISING EDGE + switch (x24c02_state) { + case X24C0X_ADDRESS: + if (x24c02_bitcount < 7) { + x24c02_addr <<= 1; + x24c02_addr |= sda; + } else { + if (sda) // READ COMMAND + x24c02_state = X24C0X_READ; + else // WRITE COMMAND + x24c02_state = X24C0X_WORD; + } + x24c02_bitcount++; + break; + case X24C0X_WORD: + if (x24c02_bitcount == 8) { // ACK + x24c02_word = 0; + x24c02_out = 0; + } else { // WORD ADDRESS INPUT + x24c02_word <<= 1; + x24c02_word |= sda; + if (x24c02_bitcount == 16) {// END OF ADDRESS INPUT + x24c02_bitcount = 7; + x24c02_state = X24C0X_WRITE; + } + } + x24c02_bitcount++; + break; + case X24C0X_READ: + if (x24c02_bitcount == 8) { // ACK + x24c02_out = 0; + x24c02_latch = x24c0x_data[x24c02_word|0x100]; + x24c02_bitcount = 0; + } else { // REAL OUTPUT + x24c02_out = x24c02_latch >> 7; + x24c02_latch <<= 1; + x24c02_bitcount++; + if (x24c02_bitcount == 8) { + x24c02_word++; + x24c02_word &= 0xff; + } + } + break; + case X24C0X_WRITE: + if (x24c02_bitcount == 8) { // ACK + x24c02_out = 0; + x24c02_latch = 0; + x24c02_bitcount = 0; + } else { // REAL INPUT + x24c02_latch <<= 1; + x24c02_latch |= sda; + x24c02_bitcount++; + if (x24c02_bitcount == 8) { + x24c0x_data[x24c02_word|0x100] = x24c02_latch; + x24c02_word++; + x24c02_word &= 0xff; + } + } + break; + } + } + x24c02_sda = sda; + x24c02_scl = scl; } // +static void SyncMirror(void) { + switch (reg[9] & 3) { + case 0: setmirror(MI_V); break; + case 1: setmirror(MI_H); break; + case 2: setmirror(MI_0); break; + case 3: setmirror(MI_1); break; + } +} + static void Sync(void) { if (is153) { int base = (reg[0] & 1) << 4; @@ -174,12 +259,7 @@ static void Sync(void) { setprg16(0x8000, reg[8]); setprg16(0xC000, ~0); } - switch (reg[9] & 3) { - case 0: setmirror(MI_V); break; - case 1: setmirror(MI_H); break; - case 2: setmirror(MI_0); break; - case 3: setmirror(MI_1); break; - } + SyncMirror(); } static DECLFW(BandaiWrite) { @@ -192,12 +272,15 @@ static DECLFW(BandaiWrite) { case 0x0A: X6502_IRQEnd(FCEU_IQEXT); IRQa = V & 1; IRQCount = IRQLatch; break; case 0x0B: IRQLatch &= 0xFF00; IRQLatch |= V; break; case 0x0C: IRQLatch &= 0xFF; IRQLatch |= V << 8; break; - case 0x0D: x24c0x_write(V); break; + case 0x0D: if(x24c02) x24c02_write(V); else x24c01_write(V); break; } } static DECLFR(BandaiRead) { - return (X.DB & 0xEF) | x24c0x_read(); + if(x24c02) + return (X.DB & 0xEF) | (x24c02_out << 4); + else + return (X.DB & 0xEF) | (x24c01_out << 4); } static void BandaiIRQHook(int a) { @@ -213,11 +296,14 @@ static void BandaiIRQHook(int a) { static void BandaiPower(void) { IRQa = 0; - x24c0x_init(); + if(x24c02) + x24c02_init(); + else + x24c01_init(); Sync(); SetReadHandler(0x6000, 0x7FFF, BandaiRead); SetReadHandler(0x8000, 0xFFFF, CartBR); - SetWriteHandler(0x6000, 0xFFFF, BandaiWrite); + SetWriteHandler(0x8000, 0xFFFF, BandaiWrite); } static void StateRestore(int version) { @@ -231,12 +317,12 @@ void Mapper16_Init(CartInfo *info) { MapIRQHook = BandaiIRQHook; info->battery = 1; - info->SaveGame[0] = x24c0x_data; + info->SaveGame[0] = x24c0x_data + 256; info->SaveGameLen[0] = 256; AddExState(x24c0x_data, 256, 0, "DATA"); + AddExState(&x24c02StateRegs, ~0, 0, 0); GameStateRestore = StateRestore; - AddExState(&x24c0xStateRegs, ~0, 0, 0); AddExState(&StateRegs, ~0, 0, 0); } @@ -250,9 +336,9 @@ void Mapper159_Init(CartInfo *info) { info->SaveGame[0] = x24c0x_data; info->SaveGameLen[0] = 128; AddExState(x24c0x_data, 128, 0, "DATA"); + AddExState(&x24c01StateRegs, ~0, 0, 0); GameStateRestore = StateRestore; - AddExState(&x24c0xStateRegs, ~0, 0, 0); AddExState(&StateRegs, ~0, 0, 0); } @@ -343,7 +429,7 @@ int FCEUI_DatachSet(const uint8 *rcode) { #define BS(x) BarcodeData[tmp_p] = x; tmp_p++ - for (j = 0; j < 32; j++) { + for (j = 0; j < 32; j++) { // delay before sending a code BS(0x00); } @@ -419,6 +505,26 @@ int FCEUI_DatachSet(const uint8 *rcode) { return(1); } +static void BarcodeSync(void) { + setchr8(0); + setprg16(0x8000, (reg[8] & 0x0F)); + setprg16(0xC000, 0x0F); + SyncMirror(); +} + +static DECLFW(BarcodeWrite) { + A &= 0x0F; + switch (A) { + case 0x00: reg[0] = (V & 8) << 2; x24c01_write(reg[0xD] | reg[0]); break; // extra EEPROM x24C01 used in Battle Rush mini-cart + case 0x08: + case 0x09: reg[A] = V; BarcodeSync(); break; + case 0x0A: X6502_IRQEnd(FCEU_IQEXT); IRQa = V & 1; IRQCount = IRQLatch; break; + case 0x0B: IRQLatch &= 0xFF00; IRQLatch |= V; break; + case 0x0C: IRQLatch &= 0xFF; IRQLatch |= V << 8; break; + case 0x0D: reg[0xD] = V & (~0x20); x24c01_write(reg[0xD] | reg[0]); x24c02_write(V); break; + } +} + static void BarcodeIRQHook(int a) { BandaiIRQHook(a); @@ -436,7 +542,7 @@ static void BarcodeIRQHook(int a) { } static DECLFR(BarcodeRead) { - return BarcodeOut; + return (X.DB & 0xE7) | ((x24c02_out | x24c01_out) << 4) | BarcodeOut; } static void M157Power(void) { @@ -446,20 +552,29 @@ static void M157Power(void) { BarcodeOut = 0; BarcodeCycleCount = 0; - Sync(); + x24c01_init(); + x24c02_init(); + BarcodeSync(); - SetWriteHandler(0x6000, 0xFFFF, BandaiWrite); SetReadHandler(0x6000, 0x7FFF, BarcodeRead); SetReadHandler(0x8000, 0xFFFF, CartBR); + SetWriteHandler(0x8000, 0xFFFF, BarcodeWrite); } void Mapper157_Init(CartInfo *info) { - is153 = 1; + x24c02 = 1; info->Power = M157Power; MapIRQHook = BarcodeIRQHook; GameInfo->cspecial = SIS_DATACH; + info->battery = 1; + info->SaveGame[0] = x24c0x_data; + info->SaveGameLen[0] = 512; + AddExState(x24c0x_data, 512, 0, "DATA"); + AddExState(&x24c01StateRegs, ~0, 0, 0); + AddExState(&x24c02StateRegs, ~0, 0, 0); + GameStateRestore = StateRestore; GameStateRestore = StateRestore; AddExState(&StateRegs, ~0, 0, 0); } diff --git a/src/boards/fns.cpp b/src/boards/fns.cpp index facb3c5e..08bbe24e 100644 --- a/src/boards/fns.cpp +++ b/src/boards/fns.cpp @@ -52,7 +52,9 @@ static void MMC1CHR(void) { static void MMC1PRG(void) { uint8 offs_16banks = DRegs[1] & 0x10; uint8 prg_reg = DRegs[3] & 0xF; + setprg8r(0x10, 0x6000, DRegs[1] & 3); + switch (DRegs[0] & 0xC) { case 0xC: setprg16(0x8000, (prg_reg + offs_16banks)); @@ -96,13 +98,13 @@ static DECLFW(MMC1_write) { Buffer |= (V & 1) << (BufferShift++); if (BufferShift == 5) { + FCEU_printf("MMC1 REG%d:%02x (PC %04x)\n", n, Buffer, X.PC); DRegs[n] = Buffer; - // FCEU_printf("MMC1 REG%d:%02x\n", n, Buffer); BufferShift = Buffer = 0; switch (n) { - case 0: MMC1MIRROR(); // break; - case 1: // break; -// case 2: MMC1CHR(); break; + case 0: MMC1MIRROR(); + case 1: + case 2: case 3: MMC1PRG(); break; } } @@ -151,13 +153,13 @@ static DECLFW(FNC_cmd_write) { break; } case 0x40C0: { -// FCEU_printf("FNS W %04x:%02x\n", A, V); + FCEU_printf("FNS W %04x:%02x (PC %04x)\n", A, V, X.PC); r40C0 = V; MMC1CHR(); break; } -// default: -// FCEU_printf("FNS W %04x:%02x\n", A, V); + default: + FCEU_printf("FNS W %04x:%02x (PC %04x)\n", A, V, X.PC); } } @@ -169,23 +171,32 @@ static DECLFR(FNC_stat_read) { IRQa = 0; return ret; } + case 0x40AC: { // NMI/IRQ state reset (lookalike) + return 0; + } case 0x40B0: { kanji_pos = 0; return 0; } case 0x40C0: { -// FCEU_printf("FNS R %04x\n", A); + FCEU_printf("FNS R %04x (PC %04x)\n", A, X.PC); int ret = r40C0; r40C0 &= 0; return ret; } default: { -// FCEU_printf("FNS R %04x\n", A); + FCEU_printf("FNS R %04x (PC %04x)\n", A, X.PC); return 0xff; } } } +static DECLFR(FNC_cart_i2c_read) { + FCEU_printf("I2C R %04x (PC %04x)\n", A, X.PC); + return 0; +} + + static DECLFR(FNC_kanji_read) { int32 ofs = ((A & 0xFFF) << 5) + kanji_pos; kanji_pos++; @@ -217,8 +228,9 @@ static void FNS_Power(void) { SetReadHandler(0x4080, 0x40FF, FNC_stat_read); SetReadHandler(0x5000, 0x5FFF, FNC_kanji_read); - SetReadHandler(0x6000, 0x7FFF, MAWRAM); - SetWriteHandler(0x6000, 0x7FFF, MBWRAM); + SetReadHandler(0x6000, 0x6000, FNC_cart_i2c_read); + SetReadHandler(0x6001, 0x7FFF, CartBR); + SetWriteHandler(0x6000, 0x7FFF, CartBW); FCEU_CheatAddRAM(8, 0x6000, WRAM); MMC1CMReset(); diff --git a/src/cheat.cpp b/src/cheat.cpp index 10ee4105..3934e73d 100644 --- a/src/cheat.cpp +++ b/src/cheat.cpp @@ -921,7 +921,7 @@ inline void FCEUI_CreateCheatMap() inline void FCEUI_RefreshCheatMap() { memset(cheatMap, 0, CHEATMAP_SIZE); - for (int i = 0; i < numsubcheats; ++i) + for (uint32 i = 0; i < numsubcheats; ++i) FCEUI_SetCheatMapByte(SubCheats[i].addr, true); } diff --git a/src/driver.h b/src/driver.h index 9987643c..d2e22c67 100644 --- a/src/driver.h +++ b/src/driver.h @@ -341,7 +341,7 @@ enum EFCEUI FCEUI_STOPMOVIE, FCEUI_RECORDMOVIE, FCEUI_PLAYMOVIE, FCEUI_OPENGAME, FCEUI_CLOSEGAME, FCEUI_TASEDITOR, - FCEUI_RESET, FCEUI_POWER, FCEUI_PLAYFROMBEGINNING, FCEUI_EJECT_DISK, FCEUI_SWITCH_DISK, FCEUI_INSERT_COIN, + FCEUI_RESET, FCEUI_POWER, FCEUI_PLAYFROMBEGINNING, FCEUI_EJECT_DISK, FCEUI_SWITCH_DISK, FCEUI_INSERT_COIN, FCEUI_INPUT_BARCODE, FCEUI_TOGGLERECORDINGMOVIE, FCEUI_TRUNCATEMOVIE, FCEUI_INSERT1FRAME, FCEUI_DELETE1FRAME }; diff --git a/src/drivers/win/Win32InputBox.cpp b/src/drivers/win/Win32InputBox.cpp index 3c4ce64d..9306e61f 100644 --- a/src/drivers/win/Win32InputBox.cpp +++ b/src/drivers/win/Win32InputBox.cpp @@ -246,6 +246,29 @@ INT_PTR CWin32InputBox::GetInteger( return ret; } +INT_PTR CWin32InputBox::GetString( + LPCTSTR szTitle, + LPCTSTR szPrompt, + CHAR* result, + HWND hwndParent) +{ + WIN32INPUTBOX_PARAM param; + + char szResult[32+1]; + sprintf(szResult, ""); + param.szTitle = szTitle; + param.szPrompt = szPrompt; + param.szResult = szResult; + param.nResultSize = sizeof(szResult); + param.bMultiline = false; + param.hwndOwner = hwndParent; + + INT_PTR ret = InputBoxEx(¶m); + if (ret == IDOK) + sprintf(result, "%s", szResult); + return ret; +} + void CWin32InputBox::InitDialog() { // Set the button captions diff --git a/src/drivers/win/Win32InputBox.h b/src/drivers/win/Win32InputBox.h index e7c87fbf..8d03cef0 100644 --- a/src/drivers/win/Win32InputBox.h +++ b/src/drivers/win/Win32InputBox.h @@ -99,6 +99,12 @@ public: LPCTSTR szPrompt, int& result, HWND hwndParent = 0); + + static INT_PTR GetString( + LPCTSTR szTitle, + LPCTSTR szPrompt, + CHAR* result, + HWND hwndParent = 0); }; #endif \ No newline at end of file diff --git a/src/drivers/win/input.cpp b/src/drivers/win/input.cpp index 3420e8b9..dde34a06 100644 --- a/src/drivers/win/input.cpp +++ b/src/drivers/win/input.cpp @@ -106,8 +106,6 @@ static uint32 FTrainerData=0; static uint8 TopRiderData=0; static uint32 FamiNetSysData = 0; -static uint8 BWorldData[1+13+1]; - static void UpdateFKB(void); static void UpdateSuborKB(void); void UpdateGamepad(void); diff --git a/src/drivers/win/input.h b/src/drivers/win/input.h index 015eec49..beca0918 100644 --- a/src/drivers/win/input.h +++ b/src/drivers/win/input.h @@ -1,5 +1,5 @@ #ifndef WIN_INPUT_H -#define WIN_INPU_H +#define WIN_INPUT_H #include "dinput.h" @@ -30,6 +30,8 @@ extern LPDIRECTINPUT7 lpDI; extern int InputType[3]; //extern int UsrInputType[3]; extern int cidisabled; +extern uint8 BWorldData[1 + 13 + 1]; + #ifndef _aosdfjk02fmasf #define _aosdfjk02fmasf diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index 3daca457..e409ec93 100644 --- a/src/drivers/win/res.rc +++ b/src/drivers/win/res.rc @@ -50,10 +50,14 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDI_ICON3 ICON "res/taseditor-icon.ico" + IDI_ICON4 ICON "res/taseditor-icon32.ico" + ICON_1 ICON "res/ICON_1.ico" + ICON_2 ICON "res/ICON_2.ico" + ///////////////////////////////////////////////////////////////////////////// // // Menu @@ -133,6 +137,7 @@ BEGIN MENUITEM "&Eject/Insert Disk", MENU_EJECT_DISK MENUITEM "&Switch Disk Side", MENU_SWITCH_DISK MENUITEM "&Insert Coin", MENU_INSERT_COIN + MENUITEM "Input &Barcode", MENU_INPUT_BARCODE MENUITEM SEPARATOR POPUP "E&mulation Speed" BEGIN @@ -1086,20 +1091,20 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN DEFPUSHBUTTON "Close",BTN_CLOSE,177,97,56,14 GROUPBOX "",GRP_GAMEPAD1,4,8,232,82,WS_GROUP - PUSHBUTTON "Up", 304, 40,36,30,12 - PUSHBUTTON "Left", 306, 10,50,30,12 - PUSHBUTTON "Right", 307, 70,50,30,12 - PUSHBUTTON "Down", 305, 40,64,30,12 - PUSHBUTTON "Select",302, 46,19,32,12 - PUSHBUTTON "Start", 303, 82,19,32,12 - PUSHBUTTON "Left", 301,140,50,30,12 - PUSHBUTTON "Down", 300,170,64,30,12 - PUSHBUTTON "Right", 308,200,50,30,12 - PUSHBUTTON "Up", 309,170,36,30,12 - PUSHBUTTON "L", 310, 10,19,32,12 - PUSHBUTTON "R", 311,198,19,32,12 - PUSHBUTTON "B", 312,126,19,32,12 - PUSHBUTTON "A", 313,162,19,32,12 + PUSHBUTTON "Up",304,40,36,30,12 + PUSHBUTTON "Left",306,10,50,30,12 + PUSHBUTTON "Right",307,70,50,30,12 + PUSHBUTTON "Down",305,40,64,30,12 + PUSHBUTTON "Select",302,46,19,32,12 + PUSHBUTTON "Start",303,82,19,32,12 + PUSHBUTTON "Left",301,140,50,30,12 + PUSHBUTTON "Down",300,170,64,30,12 + PUSHBUTTON "Right",308,200,50,30,12 + PUSHBUTTON "Up",309,170,36,30,12 + PUSHBUTTON "L",310,10,19,32,12 + PUSHBUTTON "R",311,198,19,32,12 + PUSHBUTTON "B",312,126,19,32,12 + PUSHBUTTON "A",313,162,19,32,12 END QUIZKINGDIALOG DIALOG 30, 123, 160, 74 @@ -2859,109 +2864,213 @@ END // IDB_BITMAP0 BITMAP "res\\te_0.bmp" + IDB_BITMAP1 BITMAP "res\\te_1.bmp" + IDB_BITMAP2 BITMAP "res\\te_2.bmp" + IDB_BITMAP3 BITMAP "res\\te_3.bmp" + IDB_BITMAP4 BITMAP "res\\te_4.bmp" + IDB_BITMAP5 BITMAP "res\\te_5.bmp" + IDB_BITMAP6 BITMAP "res\\te_6.bmp" + IDB_BITMAP7 BITMAP "res\\te_7.bmp" + IDB_BITMAP8 BITMAP "res\\te_8.bmp" + IDB_BITMAP9 BITMAP "res\\te_9.bmp" + IDB_BITMAP10 BITMAP "res\\te_10.bmp" + IDB_BITMAP11 BITMAP "res\\te_11.bmp" + IDB_BITMAP12 BITMAP "res\\te_12.bmp" + IDB_BITMAP13 BITMAP "res\\te_13.bmp" + IDB_BITMAP14 BITMAP "res\\te_14.bmp" + IDB_BITMAP15 BITMAP "res\\te_15.bmp" + IDB_BITMAP16 BITMAP "res\\te_16.bmp" + IDB_BITMAP17 BITMAP "res\\te_17.bmp" + IDB_BITMAP18 BITMAP "res\\te_18.bmp" + IDB_BITMAP19 BITMAP "res\\te_19.bmp" + IDB_TE_ARROW BITMAP "res\\te_arrow.bmp" + IDB_TE_GREEN_ARROW BITMAP "res\\te_green_arrow.bmp" + IDB_TE_GREEN_BLUE_ARROW BITMAP "res\\te_green_blue_arrow.bmp" + IDB_PIANO_0 BITMAP "res\\te_piano_0.bmp" + IDB_PIANO_1 BITMAP "res\\te_piano_1.bmp" + IDB_PIANO_2 BITMAP "res\\te_piano_2.bmp" + IDB_PIANO_3 BITMAP "res\\te_piano_3.bmp" + IDB_PIANO_4 BITMAP "res\\te_piano_4.bmp" + IDB_PIANO_5 BITMAP "res\\te_piano_5.bmp" + IDB_PIANO_6 BITMAP "res\\te_piano_6.bmp" + IDB_PIANO_7 BITMAP "res\\te_piano_7.bmp" + IDB_PIANO_8 BITMAP "res\\te_piano_8.bmp" + IDB_PIANO_9 BITMAP "res\\te_piano_9.bmp" + IDB_PIANO_10 BITMAP "res\\te_piano_10.bmp" + IDB_PIANO_11 BITMAP "res\\te_piano_11.bmp" + IDB_PIANO_12 BITMAP "res\\te_piano_12.bmp" + IDB_PIANO_13 BITMAP "res\\te_piano_13.bmp" + IDB_PIANO_14 BITMAP "res\\te_piano_14.bmp" + IDB_PIANO_15 BITMAP "res\\te_piano_15.bmp" + IDB_PIANO_16 BITMAP "res\\te_piano_16.bmp" + IDB_PIANO_17 BITMAP "res\\te_piano_17.bmp" + IDB_PIANO_18 BITMAP "res\\te_piano_18.bmp" + IDB_PIANO_19 BITMAP "res\\te_piano_19.bmp" + IDB_PIANO_PLAYBACK_0 BITMAP "res\\te_piano_0_playback.bmp" + IDB_PIANO_PLAYBACK_1 BITMAP "res\\te_piano_1_playback.bmp" + IDB_PIANO_PLAYBACK_2 BITMAP "res\\te_piano_2_playback.bmp" + IDB_PIANO_PLAYBACK_3 BITMAP "res\\te_piano_3_playback.bmp" + IDB_PIANO_PLAYBACK_4 BITMAP "res\\te_piano_4_playback.bmp" + IDB_PIANO_PLAYBACK_5 BITMAP "res\\te_piano_5_playback.bmp" + IDB_PIANO_PLAYBACK_6 BITMAP "res\\te_piano_6_playback.bmp" + IDB_PIANO_PLAYBACK_7 BITMAP "res\\te_piano_7_playback.bmp" + IDB_PIANO_PLAYBACK_8 BITMAP "res\\te_piano_8_playback.bmp" + IDB_PIANO_PLAYBACK_9 BITMAP "res\\te_piano_9_playback.bmp" + IDB_PIANO_PLAYBACK_10 BITMAP "res\\te_piano_10_playback.bmp" + IDB_PIANO_PLAYBACK_11 BITMAP "res\\te_piano_11_playback.bmp" + IDB_PIANO_PLAYBACK_12 BITMAP "res\\te_piano_12_playback.bmp" + IDB_PIANO_PLAYBACK_13 BITMAP "res\\te_piano_13_playback.bmp" + IDB_PIANO_PLAYBACK_14 BITMAP "res\\te_piano_14_playback.bmp" + IDB_PIANO_PLAYBACK_15 BITMAP "res\\te_piano_15_playback.bmp" + IDB_PIANO_PLAYBACK_16 BITMAP "res\\te_piano_16_playback.bmp" + IDB_PIANO_PLAYBACK_17 BITMAP "res\\te_piano_17_playback.bmp" + IDB_PIANO_PLAYBACK_18 BITMAP "res\\te_piano_18_playback.bmp" + IDB_PIANO_PLAYBACK_19 BITMAP "res\\te_piano_19_playback.bmp" + IDB_PIANO_LOSTPOS_0 BITMAP "res\\te_piano_0_lostpos.bmp" + IDB_PIANO_LOSTPOS_1 BITMAP "res\\te_piano_1_lostpos.bmp" + IDB_PIANO_LOSTPOS_2 BITMAP "res\\te_piano_2_lostpos.bmp" + IDB_PIANO_LOSTPOS_3 BITMAP "res\\te_piano_3_lostpos.bmp" + IDB_PIANO_LOSTPOS_4 BITMAP "res\\te_piano_4_lostpos.bmp" + IDB_PIANO_LOSTPOS_5 BITMAP "res\\te_piano_5_lostpos.bmp" + IDB_PIANO_LOSTPOS_6 BITMAP "res\\te_piano_6_lostpos.bmp" + IDB_PIANO_LOSTPOS_7 BITMAP "res\\te_piano_7_lostpos.bmp" + IDB_PIANO_LOSTPOS_8 BITMAP "res\\te_piano_8_lostpos.bmp" + IDB_PIANO_LOSTPOS_9 BITMAP "res\\te_piano_9_lostpos.bmp" + IDB_PIANO_LOSTPOS_10 BITMAP "res\\te_piano_10_lostpos.bmp" + IDB_PIANO_LOSTPOS_11 BITMAP "res\\te_piano_11_lostpos.bmp" + IDB_PIANO_LOSTPOS_12 BITMAP "res\\te_piano_12_lostpos.bmp" + IDB_PIANO_LOSTPOS_13 BITMAP "res\\te_piano_13_lostpos.bmp" + IDB_PIANO_LOSTPOS_14 BITMAP "res\\te_piano_14_lostpos.bmp" + IDB_PIANO_LOSTPOS_15 BITMAP "res\\te_piano_15_lostpos.bmp" + IDB_PIANO_LOSTPOS_16 BITMAP "res\\te_piano_16_lostpos.bmp" + IDB_PIANO_LOSTPOS_17 BITMAP "res\\te_piano_17_lostpos.bmp" + IDB_PIANO_LOSTPOS_18 BITMAP "res\\te_piano_18_lostpos.bmp" + IDB_PIANO_LOSTPOS_19 BITMAP "res\\te_piano_19_lostpos.bmp" + IDB_BITMAP_SELECTED0 BITMAP "res\\te_0_selected.bmp" + IDB_BITMAP_SELECTED1 BITMAP "res\\te_1_selected.bmp" + IDB_BITMAP_SELECTED2 BITMAP "res\\te_2_selected.bmp" + IDB_BITMAP_SELECTED3 BITMAP "res\\te_3_selected.bmp" + IDB_BITMAP_SELECTED4 BITMAP "res\\te_4_selected.bmp" + IDB_BITMAP_SELECTED5 BITMAP "res\\te_5_selected.bmp" + IDB_BITMAP_SELECTED6 BITMAP "res\\te_6_selected.bmp" + IDB_BITMAP_SELECTED7 BITMAP "res\\te_7_selected.bmp" + IDB_BITMAP_SELECTED8 BITMAP "res\\te_8_selected.bmp" + IDB_BITMAP_SELECTED9 BITMAP "res\\te_9_selected.bmp" + IDB_BITMAP_SELECTED10 BITMAP "res\\te_10_selected.bmp" + IDB_BITMAP_SELECTED11 BITMAP "res\\te_11_selected.bmp" + IDB_BITMAP_SELECTED12 BITMAP "res\\te_12_selected.bmp" + IDB_BITMAP_SELECTED13 BITMAP "res\\te_13_selected.bmp" + IDB_BITMAP_SELECTED14 BITMAP "res\\te_14_selected.bmp" + IDB_BITMAP_SELECTED15 BITMAP "res\\te_15_selected.bmp" + IDB_BITMAP_SELECTED16 BITMAP "res\\te_16_selected.bmp" + IDB_BITMAP_SELECTED17 BITMAP "res\\te_17_selected.bmp" + IDB_BITMAP_SELECTED18 BITMAP "res\\te_18_selected.bmp" + IDB_BITMAP_SELECTED19 BITMAP "res\\te_19_selected.bmp" + IDB_BRANCH_SPRITESHEET BITMAP "res\\branch_spritesheet.bmp" + #endif // English (United States) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index a6696e94..57fbea09 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used for res.rc +// Used by res.rc // #define CLOSE_BUTTON 1 #define BUTTON_CLOSE 1 @@ -867,6 +867,7 @@ #define IDC_BINARY 1317 #define IDC_GAME_GENIE_ADDR 1501 #define MENU_INESHEADEREDITOR 40001 +#define MENU_INPUT_BARCODE 40004 #define MENU_NETWORK 40040 #define MENU_PALETTE 40041 #define MENU_SOUND 40042 @@ -1163,7 +1164,7 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 306 -#define _APS_NEXT_COMMAND_VALUE 40002 +#define _APS_NEXT_COMMAND_VALUE 40005 #define _APS_NEXT_CONTROL_VALUE 1101 #define _APS_NEXT_SYMED_VALUE 101 #endif diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index 548d621d..dd69c282 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -148,6 +148,7 @@ int menuYoffset = 0; bool wasPausedByCheats = false; //For unpausing the emulator if paused by the cheats dialog bool rightClickEnabled = true; //If set to false, the right click context menu will be disabled. bool fullscreenByDoubleclick = false; +uint8 BWorldData[1 + 13 + 1]; //Function Prototypes void ChangeMenuItemText(int menuitem, string text); //Alters a menu item name @@ -381,6 +382,7 @@ void updateGameDependentMenus() MENU_SWITCH_DISK, MENU_EJECT_DISK, MENU_RECORD_AVI, + MENU_INPUT_BARCODE, MENU_STOP_AVI, MENU_RECORD_WAV, MENU_STOP_WAV, @@ -1930,7 +1932,23 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) case MENU_INSERT_COIN: FCEUI_VSUniCoin(); break; - + case MENU_INPUT_BARCODE: + char bbuf[32 + 1]; + if ((CWin32InputBox::GetString("Input Barcode", "Enter 13-digit decimal number.", bbuf, hWnd) == IDOK)) { + if (strlen(bbuf) == 13) { + if (InputType[2] == SIFC_BWORLD) { + strcpy((char *)&BWorldData[1], (char *)bbuf); + BWorldData[0] = 1; + } + else + FCEUI_DatachSet((uint8 *)bbuf); + FCEU_DispMessage("Barcode entered: %s", 0, bbuf); + } + else + FCEU_DispMessage("Wrong Barcode!", 0); + } + break; + //Emulation submenu case ID_NES_PAUSE: FCEUI_ToggleEmulationPause(); @@ -2521,6 +2539,7 @@ adelikat: Outsourced this to a remappable hotkey EnableMenuItem(fceumenu,MENU_EJECT_DISK,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_EJECT_DISK)?MF_ENABLED:MF_GRAYED)); EnableMenuItem(fceumenu,MENU_SWITCH_DISK,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_SWITCH_DISK)?MF_ENABLED:MF_GRAYED)); EnableMenuItem(fceumenu,MENU_INSERT_COIN,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_INSERT_COIN)?MF_ENABLED:MF_GRAYED)); + EnableMenuItem(fceumenu,MENU_INPUT_BARCODE,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_INPUT_BARCODE)?MF_ENABLED:MF_GRAYED)); EnableMenuItem(fceumenu,MENU_TASEDITOR,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_TASEDITOR)?MF_ENABLED:MF_GRAYED)); EnableMenuItem(fceumenu,MENU_CLOSE_FILE,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_CLOSEGAME) && GameInfo ?MF_ENABLED:MF_GRAYED)); EnableMenuItem(fceumenu,MENU_RECENT_FILES,MF_BYCOMMAND | ((FCEU_IsValidUI(FCEUI_OPENGAME) && HasRecentFiles()) ?MF_ENABLED:MF_GRAYED)); //adelikat - added && recent_files, otherwise this line prevents recent from ever being gray when TAS Editor is not engaged