Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify and add new combination button. #1084

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/burner/libretro/libretro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions src/burner/libretro/retro_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/burner/libretro/retro_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
111 changes: 108 additions & 3 deletions src/burner/libretro/retro_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
}
}

Expand Down Expand Up @@ -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++;
}
}

Expand Down Expand Up @@ -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) {
Expand Down