mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-12-26 19:21:49 +01:00
[libretro] bugfix & code cleanup
This commit is contained in:
parent
147ad71a3c
commit
51f77aa38c
Binary file not shown.
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX libretro port
|
* Genesis Plus GX libretro port
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2016)
|
* Copyright Eke-Eke (2007-2017)
|
||||||
*
|
*
|
||||||
* Copyright Daniel De Matteis (2012-2016)
|
* Copyright Daniel De Matteis (2012-2016)
|
||||||
*
|
*
|
||||||
@ -1792,7 +1792,7 @@ void retro_set_controller_port_device(unsigned port, unsigned device)
|
|||||||
break;
|
break;
|
||||||
case RETRO_DEVICE_MDPAD_3B:
|
case RETRO_DEVICE_MDPAD_3B:
|
||||||
{
|
{
|
||||||
if (port && (input.system[0] >= RETRO_DEVICE_MDPAD_3B_WAYPLAY) && (input.system[0] <= RETRO_DEVICE_MSPAD_2B_MASTERTAP))
|
if (port && (input.system[0] >= SYSTEM_MASTERTAP) && (input.system[0] <= SYSTEM_WAYPLAY))
|
||||||
config.input[4].padtype = DEVICE_PAD3B;
|
config.input[4].padtype = DEVICE_PAD3B;
|
||||||
else
|
else
|
||||||
config.input[port].padtype = DEVICE_PAD3B;
|
config.input[port].padtype = DEVICE_PAD3B;
|
||||||
@ -1801,7 +1801,7 @@ void retro_set_controller_port_device(unsigned port, unsigned device)
|
|||||||
}
|
}
|
||||||
case RETRO_DEVICE_MDPAD_6B:
|
case RETRO_DEVICE_MDPAD_6B:
|
||||||
{
|
{
|
||||||
if (port && (input.system[0] >= RETRO_DEVICE_MDPAD_3B_WAYPLAY) && (input.system[0] <= RETRO_DEVICE_MSPAD_2B_MASTERTAP))
|
if (port && (input.system[0] >= SYSTEM_MASTERTAP) && (input.system[0] <= SYSTEM_WAYPLAY))
|
||||||
config.input[4].padtype = DEVICE_PAD6B;
|
config.input[4].padtype = DEVICE_PAD6B;
|
||||||
else
|
else
|
||||||
config.input[port].padtype = DEVICE_PAD6B;
|
config.input[port].padtype = DEVICE_PAD6B;
|
||||||
@ -1810,7 +1810,7 @@ void retro_set_controller_port_device(unsigned port, unsigned device)
|
|||||||
}
|
}
|
||||||
case RETRO_DEVICE_MSPAD_2B:
|
case RETRO_DEVICE_MSPAD_2B:
|
||||||
{
|
{
|
||||||
if (port && (input.system[0] >= RETRO_DEVICE_MDPAD_3B_WAYPLAY) && (input.system[0] <= RETRO_DEVICE_MSPAD_2B_MASTERTAP))
|
if (port && (input.system[0] >= SYSTEM_MASTERTAP) && (input.system[0] <= SYSTEM_WAYPLAY))
|
||||||
config.input[4].padtype = DEVICE_PAD2B;
|
config.input[4].padtype = DEVICE_PAD2B;
|
||||||
else
|
else
|
||||||
config.input[port].padtype = DEVICE_PAD2B;
|
config.input[port].padtype = DEVICE_PAD2B;
|
||||||
@ -1894,7 +1894,7 @@ void retro_set_controller_port_device(unsigned port, unsigned device)
|
|||||||
case RETRO_DEVICE_JOYPAD:
|
case RETRO_DEVICE_JOYPAD:
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
if (port && (input.system[0] >= RETRO_DEVICE_MDPAD_3B_WAYPLAY) && (input.system[0] <= RETRO_DEVICE_MSPAD_2B_MASTERTAP))
|
if (port && (input.system[0] >= SYSTEM_MASTERTAP) && (input.system[0] <= SYSTEM_WAYPLAY))
|
||||||
config.input[4].padtype = DEVICE_PAD2B | DEVICE_PAD6B | DEVICE_PAD3B;
|
config.input[4].padtype = DEVICE_PAD2B | DEVICE_PAD6B | DEVICE_PAD3B;
|
||||||
else
|
else
|
||||||
config.input[port].padtype = DEVICE_PAD2B | DEVICE_PAD6B | DEVICE_PAD3B;
|
config.input[port].padtype = DEVICE_PAD2B | DEVICE_PAD6B | DEVICE_PAD3B;
|
||||||
@ -1945,16 +1945,17 @@ void retro_cheat_set(unsigned index, bool enabled, const char *code)
|
|||||||
{
|
{
|
||||||
char codeCopy[256];
|
char codeCopy[256];
|
||||||
char *buff;
|
char *buff;
|
||||||
|
|
||||||
/* Avoid crashing when giving empty input */
|
|
||||||
if (code=='\0') return;
|
|
||||||
|
|
||||||
/* clear existing ROM patches */
|
/* Avoid crashing when giving no input */
|
||||||
clear_cheats();
|
if (code==NULL) return;
|
||||||
|
|
||||||
/* Detect and split multiline cheats */
|
/* clear existing ROM patches */
|
||||||
strcpy(codeCopy,code);
|
clear_cheats();
|
||||||
buff = strtok(codeCopy,"+");
|
|
||||||
|
/* Detect and split multiline cheats */
|
||||||
|
strncpy(codeCopy,code,255);
|
||||||
|
codeCopy[255] = '\0';
|
||||||
|
buff = strtok(codeCopy,"+");
|
||||||
|
|
||||||
while (buff != NULL)
|
while (buff != NULL)
|
||||||
{
|
{
|
||||||
@ -1984,8 +1985,8 @@ void retro_cheat_set(unsigned index, bool enabled, const char *code)
|
|||||||
buff = strtok(NULL,"+");
|
buff = strtok(NULL,"+");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* apply ROM patches */
|
/* apply ROM patches */
|
||||||
apply_cheats();
|
apply_cheats();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool retro_load_game(const struct retro_game_info *info)
|
bool retro_load_game(const struct retro_game_info *info)
|
||||||
|
Loading…
Reference in New Issue
Block a user