[libretro] bugfix & code cleanup

This commit is contained in:
EkeEke 2017-08-08 16:46:11 +02:00
parent 147ad71a3c
commit 51f77aa38c
2 changed files with 16 additions and 15 deletions

Binary file not shown.

View File

@ -3,7 +3,7 @@
*
* Genesis Plus GX libretro port
*
* Copyright Eke-Eke (2007-2016)
* Copyright Eke-Eke (2007-2017)
*
* Copyright Daniel De Matteis (2012-2016)
*
@ -1792,7 +1792,7 @@ void retro_set_controller_port_device(unsigned port, unsigned device)
break;
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;
else
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:
{
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;
else
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:
{
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;
else
config.input[port].padtype = DEVICE_PAD2B;
@ -1894,7 +1894,7 @@ void retro_set_controller_port_device(unsigned port, unsigned device)
case RETRO_DEVICE_JOYPAD:
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;
else
config.input[port].padtype = DEVICE_PAD2B | DEVICE_PAD6B | DEVICE_PAD3B;
@ -1946,14 +1946,15 @@ void retro_cheat_set(unsigned index, bool enabled, const char *code)
char codeCopy[256];
char *buff;
/* Avoid crashing when giving empty input */
if (code=='\0') return;
/* Avoid crashing when giving no input */
if (code==NULL) return;
/* clear existing ROM patches */
clear_cheats();
/* Detect and split multiline cheats */
strcpy(codeCopy,code);
strncpy(codeCopy,code,255);
codeCopy[255] = '\0';
buff = strtok(codeCopy,"+");
while (buff != NULL)