diff --git a/src/boards/coolboy.cpp b/src/boards/coolboy.cpp index 7b050fe2..e220ae80 100644 --- a/src/boards/coolboy.cpp +++ b/src/boards/coolboy.cpp @@ -17,10 +17,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * CoolBoy 400-in-1 FK23C-mimic mapper 16Mb/32Mb PROM + 128K/256K CHR RAM, optional SRAM, optional battery - * only MMC3 mode + * SMD132 and SMD133 ASICs, MMC3 clones that can address up to 32 MiB of PRG-ROM, 256 KiB of CHR-RAM, and 8 KiB of WRAM. * - * $6000 + * COOLBOY cartridges use registers at address $6xxx + * MINDKIDS cartridges use a solder pad labelled "5/6K" to select between $5000 and $6000 + * + * $xxx0 * 7 bit 0 * ---- ---- * ABCC DEEE @@ -31,7 +33,7 @@ * |+--------- PRG mask (PRG A17 from 0: MMC3; 1: offset) * +---------- CHR mask (CHR A17 from 0: MMC3; 1: alternate) * - * $6001 + * $xxx1 * * 7 bit 0 * ---- ---- @@ -43,14 +45,14 @@ * |+--------- PRG mask (PRG A19 from 0: offset; 1: MMC3) * +---------- PRG mask (PRG A18 from 0: MMC3; 1: offset) * - * $6002 + * $xxx2 * 7 bit 0 * ---- ---- * xxxx MMMM * |||| * ++++-- CHR offset for GNROM mode (CHR A16, A15, A14, A13) * - * $6003 + * $xxx3 * 7 bit 0 * ---- ---- * NPxP QQRx @@ -63,9 +65,6 @@ * |+--------- "Weird MMC3 mode" * +---------- Lockout (prevent further writes to these four registers, only works in MMC3 mode) * - * There is also alternative version from MINDKIDS, - * the only difference is register addresses - 500x instead of 600x - * * Also some new cartridges from MINDKIDS have /WE and /OE pins connected to mapper, * which allows you to rewrite flash memory without soldering. * This also allows console to write data to the cartridge. @@ -177,6 +176,7 @@ static void MINDKIDSPower(void) { SetWriteHandler(0x5000, 0x5fff, COOLBOYWrite); } +// Registers at $6xxx void COOLBOY_Init(CartInfo *info) { GenMMC3_Init(info, 2048, 256, 8, 1); pwrap = COOLBOYPW; @@ -186,6 +186,7 @@ void COOLBOY_Init(CartInfo *info) { AddExState(EXPREGS, 4, 0, "EXPR"); } +// Registers at $5xxx void MINDKIDS_Init(CartInfo *info) { GenMMC3_Init(info, 2048, 256, 8, 1); pwrap = COOLBOYPW; @@ -194,3 +195,19 @@ void MINDKIDS_Init(CartInfo *info) { info->Reset = COOLBOYReset; AddExState(EXPREGS, 4, 0, "EXPR"); } + +// For NES 2.0 loader +void SMD132_SMD133_Init(CartInfo *info) { + switch (info->submapper) + { + case 0: + COOLBOY_Init(info); + break; + case 1: + MINDKIDS_Init(info); + break; + default: + FCEU_PrintError("Unknown submapper: #%d.", info->submapper); + break; + } +} diff --git a/src/drivers/win/input.cpp b/src/drivers/win/input.cpp index b629324b..c929f457 100644 --- a/src/drivers/win/input.cpp +++ b/src/drivers/win/input.cpp @@ -213,7 +213,14 @@ uint32 GetGamepadPressedImmediate() return JSButtons; } -int DTestButton(ButtConfig *bc, uint8_t just_down) + +// Function to check if key/button/combination is pressed/held +// bc: button mapping structure +// just_down: indicates that only new button presses should be logged, not held down +// block_meta: indicates that key can't be pressed in combination with meta keys +// if it's not set explicitly, +// e.g. do not trigger "F1" if "Ctrl+F1" is pressed +int DTestButton(ButtConfig *bc, uint8_t just_down, uint8_t block_meta) { static unsigned int *keys_data = !just_down ? GetKeyboard_nr() : GetKeyboard_jd(); @@ -230,10 +237,10 @@ int DTestButton(ButtConfig *bc, uint8_t just_down) int ctlstate = (cmd & CMD_KEY_LALT) ? keys_data[SCAN_LEFTALT] : 0; ctlstate |= (cmd & CMD_KEY_RALT) ? keys_data[SCAN_RIGHTALT] : 0; if (!ctlstate) - return 0; + continue; } - else if ((cmdmask != SCAN_LEFTALT && keys_data[SCAN_LEFTALT]) || (cmdmask != SCAN_RIGHTALT && keys_data[SCAN_RIGHTALT])) - return 0; + else if (block_meta && ((cmdmask != SCAN_LEFTALT && keys_data[SCAN_LEFTALT]) || (cmdmask != SCAN_RIGHTALT && keys_data[SCAN_RIGHTALT]))) + continue; if (cmd & CMD_KEY_CTRL) { @@ -242,7 +249,7 @@ int DTestButton(ButtConfig *bc, uint8_t just_down) if (!ctlstate) continue; } - else if ((cmdmask != SCAN_LEFTCONTROL && keys_data[SCAN_LEFTCONTROL]) || (cmdmask != SCAN_RIGHTCONTROL && keys_data[SCAN_RIGHTCONTROL])) + else if (block_meta && ((cmdmask != SCAN_LEFTCONTROL && keys_data[SCAN_LEFTCONTROL]) || (cmdmask != SCAN_RIGHTCONTROL && keys_data[SCAN_RIGHTCONTROL]))) continue; if (cmd & CMD_KEY_SHIFT) @@ -252,7 +259,7 @@ int DTestButton(ButtConfig *bc, uint8_t just_down) if (!ctlstate) continue; } - else if ((cmdmask != SCAN_LEFTSHIFT && keys_data[SCAN_LEFTSHIFT]) || (cmdmask != SCAN_RIGHTSHIFT && keys_data[SCAN_RIGHTSHIFT])) + else if (block_meta && ((cmdmask != SCAN_LEFTSHIFT && keys_data[SCAN_LEFTSHIFT]) || (cmdmask != SCAN_RIGHTSHIFT && keys_data[SCAN_RIGHTSHIFT]))) continue; if (cmd & CMD_KEY_WIN) @@ -262,7 +269,7 @@ int DTestButton(ButtConfig *bc, uint8_t just_down) if (!ctlstate) continue; } - else if ((cmdmask != SCAN_LEFTWIN && keys_data[SCAN_LEFTWIN]) || (cmdmask != SCAN_RIGHTWIN && keys_data[SCAN_RIGHTWIN])) + else if (block_meta && ((cmdmask != SCAN_LEFTWIN && keys_data[SCAN_LEFTWIN]) || (cmdmask != SCAN_RIGHTWIN && keys_data[SCAN_RIGHTWIN]))) continue; if(keys_data[cmdmask]) @@ -1841,9 +1848,12 @@ int FCEUD_TestCommandState(int c) case EMUCMD_FRAME_ADVANCE: case EMUCMD_SPEED_TURBO: case EMUCMD_TASEDITOR_REWIND: + // Check that key/button is held down return DTestButton(&FCEUD_CommandMapping[c], 0); default: - return DTestButton(&FCEUD_CommandMapping[c], 1); + // Check that key/button is just pressed, not held down + // Register only if no additional meta keys are pressed + return DTestButton(&FCEUD_CommandMapping[c], 1, 1); } } diff --git a/src/drivers/win/input.h b/src/drivers/win/input.h index b9d4799c..70b5dc92 100644 --- a/src/drivers/win/input.h +++ b/src/drivers/win/input.h @@ -66,7 +66,7 @@ void ParseGIInput(FCEUGI *GameInfo); int FCEUD_TestCommandState(int c); void FCEUD_UpdateInput(); int DWaitButton(HWND hParent, const char *text, ButtConfig *bc); -int DTestButton(ButtConfig *bc, uint8_t just_down = 0); +int DTestButton(ButtConfig *bc, uint8_t just_down = 0, uint8_t block_meta = 0); char *MakeButtString(ButtConfig *bc, int appendKB = 1); extern CFGSTRUCT HotkeyConfig[]; diff --git a/src/ines.cpp b/src/ines.cpp index 56782613..35123667 100644 --- a/src/ines.cpp +++ b/src/ines.cpp @@ -727,6 +727,7 @@ BMAPPINGLocal bmap[] = { {"F-15 MMC3 Based", 259, BMCF15_Init}, {"HP10xx/H20xx Boards", 260, BMCHPxx_Init}, {"810544-CA-1", 261, BMC810544CA1_Init}, + {"SMD132/SMD133", 268, SMD132_SMD133_Init}, {"Impact Soft MMC3 Flash Board", 406, Mapper406_Init }, diff --git a/src/unif.h b/src/unif.h index b91bbbd2..b6759bdf 100644 --- a/src/unif.h +++ b/src/unif.h @@ -162,6 +162,7 @@ void MINDKIDS_Init(CartInfo *info); void FNS_Init(CartInfo *info); void BS400R_Init(CartInfo *info); void BS4040R_Init(CartInfo *info); +void SMD132_SMD133_Init(CartInfo *info); extern uint8 *UNIFchrrama; // Meh. So I can stop CHR RAM // bank switcherooing with certain boards...