mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-19 00:41:53 +00:00
Fix bug in autodetect macro, gamepad now works properly
== DETAILS The gamepad didn't work because I had tried to rename the pad from 'WIIU Gamepad' to 'WiiU Gamepad'. I added some debug logging and (to cut out a lot of trial-and-error) discovered that the reason it didn't work was because a bug in a macro was using the define literally instead of substituting it (so e.g. the autodetect handler was trying to match 'WiiU Gamepad' against the literal string 'PAD_NAME_WIIU_GAMEPAD'). - Fixed the macro bug - Left a minimal amount of the debug logging in place; may come in handy for someone else. - Updated wpad/kpad/hidpad to use the define constants == TESTING Did a test build and confirmed the gamepad responded.
This commit is contained in:
parent
0ae7ffe0d3
commit
704cc61fd8
@ -28,12 +28,16 @@
|
||||
#include <screen/screen.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIIU
|
||||
#include <wiiu/pad_driver.h>
|
||||
#endif
|
||||
|
||||
#define DECL_BTN(btn, bind) "input_" #btn "_btn = " #bind "\n"
|
||||
#define DECL_BTN_EX(btn, bind, name) "input_" #btn "_btn = " #bind "\ninput_" #btn "_btn_label = \"" name "\"\n"
|
||||
#define DECL_AXIS(axis, bind) "input_" #axis "_axis = " #bind "\n"
|
||||
#define DECL_AXIS_EX(axis, bind, name) "input_" #axis "_axis = " #bind "\ninput_" #axis "_axis_label = \"" name "\"\n"
|
||||
#define DECL_MENU(btn) "input_menu_toggle_btn = " #btn "\n"
|
||||
#define DECL_AUTOCONF_DEVICE(device, driver, binds) "input_device = \"" #device "\" \ninput_driver = \"" #driver "\" \n" binds
|
||||
#define DECL_AUTOCONF_DEVICE(device, driver, binds) "input_device = \"" device "\" \ninput_driver = \"" driver "\" \n" binds
|
||||
|
||||
/* TODO/FIXME - Missing L2/R2 */
|
||||
|
||||
@ -546,14 +550,12 @@ const char* const input_builtin_autoconfs[] =
|
||||
#endif
|
||||
#endif
|
||||
#ifdef WIIU
|
||||
DECL_AUTOCONF_DEVICE("WIIU Gamepad", "wiiu", WIIUINPUT_GAMEPAD_DEFAULT_BINDS),
|
||||
DECL_AUTOCONF_DEVICE("WIIU Pro Controller", "wiiu", WIIUINPUT_PRO_CONTROLLER_DEFAULT_BINDS),
|
||||
DECL_AUTOCONF_DEVICE("Wiimote Controller", "wiiu", WIIUINPUT_WIIMOTE_DEFAULT_BINDS),
|
||||
DECL_AUTOCONF_DEVICE("Nunchuk Controller", "wiiu", WIIUINPUT_NUNCHUK_DEFAULT_BINDS),
|
||||
DECL_AUTOCONF_DEVICE("Classic Controller", "wiiu", WIIUINPUT_CLASSIC_CONTROLLER_DEFAULT_BINDS),
|
||||
#if defined(ENABLE_CONTROLLER_PATCHER)
|
||||
DECL_AUTOCONF_DEVICE("HID Controller", "wiiu", WIIUINPUT_GAMEPAD_DEFAULT_BINDS),
|
||||
#endif
|
||||
DECL_AUTOCONF_DEVICE(PAD_NAME_WIIU_GAMEPAD, "wiiu", WIIUINPUT_GAMEPAD_DEFAULT_BINDS),
|
||||
DECL_AUTOCONF_DEVICE(PAD_NAME_WIIU_PRO, "wiiu", WIIUINPUT_PRO_CONTROLLER_DEFAULT_BINDS),
|
||||
DECL_AUTOCONF_DEVICE(PAD_NAME_WIIMOTE, "wiiu", WIIUINPUT_WIIMOTE_DEFAULT_BINDS),
|
||||
DECL_AUTOCONF_DEVICE(PAD_NAME_NUNCHUK, "wiiu", WIIUINPUT_NUNCHUK_DEFAULT_BINDS),
|
||||
DECL_AUTOCONF_DEVICE(PAD_NAME_CLASSIC, "wiiu", WIIUINPUT_CLASSIC_CONTROLLER_DEFAULT_BINDS),
|
||||
DECL_AUTOCONF_DEVICE(PAD_NAME_HID, "wiiu", WIIUINPUT_GAMEPAD_DEFAULT_BINDS),
|
||||
#endif
|
||||
#ifdef __CELLOS_LV2__
|
||||
DECL_AUTOCONF_DEVICE("SixAxis Controller", "ps3", PS3INPUT_DEFAULT_BINDS),
|
||||
|
@ -194,7 +194,17 @@ static int input_autoconfigure_joypad_try_from_conf(config_file_t *conf,
|
||||
if (!string_is_empty(params->name)
|
||||
&& !string_is_empty(ident)
|
||||
&& string_is_equal(ident, params->name))
|
||||
{
|
||||
score += 2;
|
||||
} else {
|
||||
if(string_is_empty(params->name))
|
||||
RARCH_LOG("[autoconf]: failed match because params->name was empty\n");
|
||||
else if(string_is_empty(ident))
|
||||
RARCH_LOG("[autoconf]: failed match because ident was empty\n");
|
||||
else
|
||||
RARCH_LOG("[autoconf]: failed match because ident '%s' != param->name '%s'\n",
|
||||
ident, params->name);
|
||||
}
|
||||
|
||||
return score;
|
||||
}
|
||||
@ -274,8 +284,9 @@ static int input_autoconfigure_joypad_from_conf(
|
||||
int ret = input_autoconfigure_joypad_try_from_conf(conf,
|
||||
params);
|
||||
|
||||
if (ret)
|
||||
if (ret) {
|
||||
input_autoconfigure_joypad_add(conf, params, task);
|
||||
}
|
||||
|
||||
config_file_free(conf);
|
||||
|
||||
@ -312,8 +323,10 @@ static bool input_autoconfigure_joypad_from_conf_dir(
|
||||
DIR_LIST_AUTOCONFIG, "cfg");
|
||||
}
|
||||
|
||||
if(!list)
|
||||
if(!list) {
|
||||
RARCH_LOG("[autoconf]: No profiles found.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (list)
|
||||
{
|
||||
@ -347,7 +360,7 @@ static bool input_autoconfigure_joypad_from_conf_dir(
|
||||
|
||||
config_get_config_path(conf, conf_path, sizeof(conf_path));
|
||||
|
||||
RARCH_LOG("[Autoconf]: selected configuration: %s\n", conf_path);
|
||||
RARCH_LOG("[autoconf]: selected configuration: %s\n", conf_path);
|
||||
input_autoconfigure_joypad_add(conf, params, task);
|
||||
config_file_free(conf);
|
||||
ret = 1;
|
||||
@ -374,7 +387,7 @@ static bool input_autoconfigure_joypad_from_conf_internal(
|
||||
config_file_t *conf = config_file_new_from_string(
|
||||
input_builtin_autoconfs[i]);
|
||||
if (conf && input_autoconfigure_joypad_from_conf(conf, params, task))
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (string_is_empty(params->autoconfig_directory))
|
||||
|
@ -81,7 +81,7 @@ static const char *hidpad_name(unsigned pad)
|
||||
if(!hidpad_query_pad(pad))
|
||||
return "n/a";
|
||||
|
||||
return "Unknown";
|
||||
return PAD_NAME_HID;
|
||||
}
|
||||
|
||||
input_device_driver_t hidpad_driver =
|
||||
|
@ -167,13 +167,13 @@ static const char *kpad_name(unsigned pad)
|
||||
switch(wiimotes[pad].type)
|
||||
{
|
||||
case WIIMOTE_TYPE_PRO:
|
||||
return "WiiU Pro Controller";
|
||||
return PAD_NAME_WIIU_PRO;
|
||||
case WIIMOTE_TYPE_CLASSIC:
|
||||
return "Classic Controller";
|
||||
return PAD_NAME_CLASSIC;
|
||||
case WIIMOTE_TYPE_NUNCHUK:
|
||||
return "Wiimote+Nunchuk Controller";
|
||||
return PAD_NAME_NUNCHUK;
|
||||
case WIIMOTE_TYPE_WIIPLUS:
|
||||
return "Wiimote Controller";
|
||||
return PAD_NAME_WIIMOTE;
|
||||
case WIIMOTE_TYPE_NONE:
|
||||
default:
|
||||
return "N/A";
|
||||
|
@ -190,7 +190,7 @@ static int16_t scale_touchpad(int16_t from_min, int16_t from_max,
|
||||
}
|
||||
|
||||
static const char *wpad_name(unsigned pad) {
|
||||
return "WiiU Gamepad";
|
||||
return PAD_NAME_WIIU_GAMEPAD;
|
||||
}
|
||||
|
||||
input_device_driver_t wpad_driver =
|
||||
|
Loading…
Reference in New Issue
Block a user