diff --git a/src/burner/libretro/libretro.cpp b/src/burner/libretro/libretro.cpp index 8331ce8f26..eee19318e8 100644 --- a/src/burner/libretro/libretro.cpp +++ b/src/burner/libretro/libretro.cpp @@ -2028,6 +2028,8 @@ static bool retro_load_game_common() } bIsNeogeoCartGame = ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_NEOGEO); + bIsPgmCartGame = ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_IGS_PGM); + bIsCps1CartGame = ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_CAPCOM_CPS1 || (BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_CAPCOM_CPS1_QSOUND); // Define nMaxPlayers early; nMaxPlayers = BurnDrvGetMaxPlayers(); diff --git a/src/burner/libretro/retro_common.cpp b/src/burner/libretro/retro_common.cpp index eb1eb919fe..594806beaa 100644 --- a/src/burner/libretro/retro_common.cpp +++ b/src/burner/libretro/retro_common.cpp @@ -43,6 +43,8 @@ struct GameInp *pgi_diag; struct GameInp *pgi_debug_dip_1; struct GameInp *pgi_debug_dip_2; bool bIsNeogeoCartGame = false; +bool bIsPgmCartGame = false; +bool bIsCps1CartGame = false; bool allow_neogeo_mode = true; bool neogeo_use_specific_default_bios = false; bool bAllowDepth32 = false; diff --git a/src/burner/libretro/retro_common.h b/src/burner/libretro/retro_common.h index 5364d0794c..8e0c320b76 100644 --- a/src/burner/libretro/retro_common.h +++ b/src/burner/libretro/retro_common.h @@ -236,6 +236,8 @@ extern struct GameInp *pgi_diag; extern struct GameInp *pgi_debug_dip_1; extern struct GameInp *pgi_debug_dip_2; extern bool bIsNeogeoCartGame; +extern bool bIsPgmCartGame; +extern bool bIsCps1CartGame; extern bool allow_neogeo_mode; extern bool core_aspect_par; extern bool bAllowDepth32; diff --git a/src/burner/libretro/retro_input.cpp b/src/burner/libretro/retro_input.cpp index cbd69178b9..d57eb664cb 100644 --- a/src/burner/libretro/retro_input.cpp +++ b/src/burner/libretro/retro_input.cpp @@ -106,6 +106,8 @@ static void AnalyzeGameLayout() INT32 nKickx3[MAX_PLAYERS] = {0, }; INT32 nKickInputs[MAX_PLAYERS][3]; INT32 nNeogeoButtons[MAX_PLAYERS][4]; + INT32 nPgmButtons[MAX_PLAYERS][4]; + INT32 nCps1Buttons[MAX_PLAYERS][2]; bStreetFighterLayout = false; nMahjongKeyboards = 0; @@ -189,6 +191,28 @@ static void AnalyzeGameLayout() nNeogeoButtons[nPlayer][3] = i; } } + if (bIsPgmCartGame) { + if (_stricmp(" fire 1", bii.szInfo + 2) == 0) { + nPgmButtons[nPlayer][0] = i; + } + if (_stricmp(" fire 2", bii.szInfo + 2) == 0) { + nPgmButtons[nPlayer][1] = i; + } + if (_stricmp(" fire 3", bii.szInfo + 2) == 0) { + nPgmButtons[nPlayer][2] = i; + } + if (_stricmp(" fire 4", bii.szInfo + 2) == 0) { + nPgmButtons[nPlayer][3] = i; + } + } + if (bIsCps1CartGame) { + if (_stricmp(" fire 1", bii.szInfo + 2) == 0) { + nCps1Buttons[nPlayer][0] = i; + } + if (_stricmp(" fire 2", bii.szInfo + 2) == 0) { + nCps1Buttons[nPlayer][1] = i; + } + } } } @@ -271,18 +295,85 @@ static void AnalyzeGameLayout() pgi->nInput = GIT_MACRO_AUTO; pgi->nType = BIT_DIGITAL; pgi->Macro.nMode = 0; - sprintf(pgi->Macro.szName, "P%i Buttons BCD", nPlayer + 1); + sprintf(pgi->Macro.szName, "P%i Buttons BC", nPlayer + 1); BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][1]); pgi->Macro.pVal[0] = bii.pVal; pgi->Macro.nVal[0] = 1; BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][2]); pgi->Macro.pVal[1] = bii.pVal; pgi->Macro.nVal[1] = 1; - BurnDrvGetInputInfo(&bii, nNeogeoButtons[nPlayer][3]); + nMacroCount++; + pgi++; + } + if (bIsPgmCartGame) { + pgi->nInput = GIT_MACRO_AUTO; + pgi->nType = BIT_DIGITAL; + pgi->Macro.nMode = 0; + sprintf(pgi->Macro.szName, "P%i Buttons AB", nPlayer + 1); + BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][0]); + pgi->Macro.pVal[0] = bii.pVal; + pgi->Macro.nVal[0] = 1; + BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][1]); + pgi->Macro.pVal[1] = bii.pVal; + pgi->Macro.nVal[1] = 1; + nMacroCount++; + pgi++; + + pgi->nInput = GIT_MACRO_AUTO; + pgi->nType = BIT_DIGITAL; + pgi->Macro.nMode = 0; + sprintf(pgi->Macro.szName, "P%i Buttons CD", nPlayer + 1); + BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][2]); + pgi->Macro.pVal[0] = bii.pVal; + pgi->Macro.nVal[0] = 1; + BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][3]); + pgi->Macro.pVal[1] = bii.pVal; + pgi->Macro.nVal[1] = 1; + nMacroCount++; + pgi++; + + pgi->nInput = GIT_MACRO_AUTO; + pgi->nType = BIT_DIGITAL; + pgi->Macro.nMode = 0; + sprintf(pgi->Macro.szName, "P%i Buttons ABC", nPlayer + 1); + BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][0]); + pgi->Macro.pVal[0] = bii.pVal; + pgi->Macro.nVal[0] = 1; + BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][1]); + pgi->Macro.pVal[1] = bii.pVal; + pgi->Macro.nVal[1] = 1; + BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][2]); pgi->Macro.pVal[2] = bii.pVal; pgi->Macro.nVal[2] = 1; nMacroCount++; pgi++; + + pgi->nInput = GIT_MACRO_AUTO; + pgi->nType = BIT_DIGITAL; + pgi->Macro.nMode = 0; + sprintf(pgi->Macro.szName, "P%i Buttons BC", nPlayer + 1); + BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][1]); + pgi->Macro.pVal[0] = bii.pVal; + pgi->Macro.nVal[0] = 1; + BurnDrvGetInputInfo(&bii, nPgmButtons[nPlayer][2]); + pgi->Macro.pVal[1] = bii.pVal; + pgi->Macro.nVal[1] = 1; + nMacroCount++; + pgi++; + } + if (bIsCps1CartGame) { + pgi->nInput = GIT_MACRO_AUTO; + pgi->nType = BIT_DIGITAL; + pgi->Macro.nMode = 0; + sprintf(pgi->Macro.szName, "P%i Buttons AB", nPlayer + 1); + BurnDrvGetInputInfo(&bii, nCps1Buttons[nPlayer][0]); + pgi->Macro.pVal[0] = bii.pVal; + pgi->Macro.nVal[0] = 1; + BurnDrvGetInputInfo(&bii, nCps1Buttons[nPlayer][1]); + pgi->Macro.pVal[1] = bii.pVal; + pgi->Macro.nVal[1] = 1; + nMacroCount++; + pgi++; } } @@ -1942,13 +2033,27 @@ static INT32 GameInpSpecialOne(struct GameInp* pgi, INT32 nPlayer, char* szb, ch if (bIsNeogeoCartGame || (nGameType == RETRO_GAME_TYPE_NEOCD)) { if (strncmp("Buttons ABC", description, 11) == 0) GameInpDigital2RetroInpKey(pgi, nPlayer, RETRO_DEVICE_ID_4TH_COL_BOTTOM, description, RETRO_DEVICE_JOYPAD, GIT_MACRO_AUTO); - if (strncmp("Buttons BCD", description, 11) == 0) + if (strncmp("Buttons BC", description, 10) == 0) + GameInpDigital2RetroInpKey(pgi, nPlayer, RETRO_DEVICE_ID_4TH_COL_TOP, description, RETRO_DEVICE_JOYPAD, GIT_MACRO_AUTO); + if (strncmp("Buttons AB", description, 10) == 0) + GameInpDigital2RetroInpKey(pgi, nPlayer, RETRO_DEVICE_ID_3RD_COL_BOTTOM, description, RETRO_DEVICE_JOYPAD, GIT_MACRO_AUTO); + if (strncmp("Buttons CD", description, 10) == 0) + GameInpDigital2RetroInpKey(pgi, nPlayer, RETRO_DEVICE_ID_3RD_COL_TOP, description, RETRO_DEVICE_JOYPAD, GIT_MACRO_AUTO); + } + if (bIsPgmCartGame) { + if (strncmp("Buttons ABC", description, 11) == 0) + GameInpDigital2RetroInpKey(pgi, nPlayer, RETRO_DEVICE_ID_4TH_COL_BOTTOM, description, RETRO_DEVICE_JOYPAD, GIT_MACRO_AUTO); + if (strncmp("Buttons BC", description, 10) == 0) GameInpDigital2RetroInpKey(pgi, nPlayer, RETRO_DEVICE_ID_4TH_COL_TOP, description, RETRO_DEVICE_JOYPAD, GIT_MACRO_AUTO); if (strncmp("Buttons AB", description, 10) == 0) GameInpDigital2RetroInpKey(pgi, nPlayer, RETRO_DEVICE_ID_3RD_COL_BOTTOM, description, RETRO_DEVICE_JOYPAD, GIT_MACRO_AUTO); if (strncmp("Buttons CD", description, 10) == 0) GameInpDigital2RetroInpKey(pgi, nPlayer, RETRO_DEVICE_ID_3RD_COL_TOP, description, RETRO_DEVICE_JOYPAD, GIT_MACRO_AUTO); } + if (bIsCps1CartGame && !bStreetFighterLayout) { + if (strncmp("Buttons AB", description, 10) == 0) + GameInpDigital2RetroInpKey(pgi, nPlayer, RETRO_DEVICE_ID_4TH_COL_BOTTOM, description, RETRO_DEVICE_JOYPAD, GIT_MACRO_AUTO); + } // Handle megadrive if ((nHardwareCode & HARDWARE_PUBLIC_MASK) == HARDWARE_SEGA_MEGADRIVE) {