Get rid of messy 'all_users_control_menu' hack - will be dealt

with better once menu_input branch has been merged
This commit is contained in:
twinaphex 2016-10-27 07:00:13 +02:00
parent 65685c3a9d
commit d246d320c7
14 changed files with 42 additions and 188 deletions

View File

@ -1162,24 +1162,14 @@ static bool android_input_key_pressed(void *data, int key)
{
android_input_t *android = (android_input_t*)data;
settings_t *settings = config_get_ptr();
int port = 0;
if(settings->input.binds[0][key].valid && android_keyboard_port_input_pressed(settings->input.binds[0],key))
return true;
if (settings->input.all_users_control_menu)
{
for (port = 0; port < MAX_USERS; port++)
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(android->joypad,
port, settings->input.binds[0], key))
return true;
}
else
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(android->joypad,
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(android->joypad,
0, settings->input.binds[0], key))
return true;
return true;
return false;
}

View File

@ -315,41 +315,20 @@ static bool cocoa_input_key_pressed(void *data, int key)
{
cocoa_input_data_t *apple = (cocoa_input_data_t*)data;
settings_t *settings = config_get_ptr();
int port = 0;
if (settings->input.binds[0][key].valid && apple_input_is_pressed(0, settings->input.binds[0], key))
return true;
if (settings->input.all_users_control_menu)
if (settings->input.binds[0][key].valid)
{
for (port = 0; port < MAX_USERS; port++)
{
if (settings->input.binds[0][key].valid)
{
if (input_joypad_pressed(apple->joypad,
port, settings->input.binds[0], key))
return true;
if (input_joypad_pressed(apple->joypad,
0, settings->input.binds[0], key))
return true;
#ifdef HAVE_MFI
if (input_joypad_pressed(apple->sec_joypad, port, settings->input.binds[0], key))
return true;
if (input_joypad_pressed(apple->sec_joypad, 0, settings->input.binds[0], key))
return true;
#endif
}
}
}
else
{
if (settings->input.binds[0][key].valid)
{
if (input_joypad_pressed(apple->joypad,
0, settings->input.binds[0], key))
return true;
#ifdef HAVE_MFI
if (input_joypad_pressed(apple->sec_joypad, 0, settings->input.binds[0], key))
return true;
#endif
}
}
return false;

View File

@ -95,21 +95,11 @@ static bool ctr_input_key_pressed(void *data, int key)
{
settings_t *settings = config_get_ptr();
ctr_input_t *ctr = (ctr_input_t*)data;
int port = 0;
if (settings->input.all_users_control_menu)
{
for (port = 0; port < MAX_USERS; port++)
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(ctr->joypad,
port, settings->input.binds[0], key))
return true;
}
else
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(ctr->joypad,
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(ctr->joypad,
0, settings->input.binds[0], key))
return true;
return true;
return false;
}

View File

@ -314,19 +314,10 @@ static int16_t dinput_pressed_analog(struct dinput_input *di,
static bool dinput_key_pressed(void *data, int key)
{
settings_t *settings = config_get_ptr();
int port = 0;
if (settings->input.all_users_control_menu)
{
for (port = 0; port < MAX_USERS; port++)
if (dinput_is_pressed((struct dinput_input*)data,
settings->input.binds[0], port, key))
return true;
}
else
if (dinput_is_pressed((struct dinput_input*)data,
if (dinput_is_pressed((struct dinput_input*)data,
settings->input.binds[0], 0, key))
return true;
return true;
return false;
}

View File

@ -100,21 +100,11 @@ static bool gx_input_key_pressed(void *data, int key)
{
settings_t *settings = config_get_ptr();
gx_input_t *gx = (gx_input_t*)data;
int port = 0;
if (settings->input.all_users_control_menu)
{
for (port = 0; port < MAX_USERS; port++)
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(gx->joypad,
port, settings->input.binds[0], key))
return true;
}
else
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(gx->joypad,
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(gx->joypad,
0, settings->input.binds[0], key))
return true;
return true;
return false;
}

View File

@ -111,24 +111,14 @@ static bool linuxraw_input_key_pressed(void *data, int key)
{
linuxraw_input_t *linuxraw = (linuxraw_input_t*)data;
settings_t *settings = config_get_ptr();
int port = 0;
if (linuxraw_is_pressed(linuxraw, settings->input.binds[0], key))
return true;
if (settings->input.all_users_control_menu)
{
for (port = 0; port < MAX_USERS; port++)
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(linuxraw->joypad,
port, settings->input.binds[0], key))
return true;
}
else
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(linuxraw->joypad,
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(linuxraw->joypad,
0, settings->input.binds[0], key))
return true;
return true;
return false;
}

View File

@ -186,19 +186,10 @@ static bool ps3_input_key_pressed(void *data, int key)
{
ps3_input_t *ps3 = (ps3_input_t*)data;
settings_t *settings = config_get_ptr();
int port = 0;
if (settings->input.all_users_control_menu)
{
for (port = 0; port < MAX_USERS; port++)
if (input_joypad_pressed(ps3->joypad,
port, settings->input.binds[0], key))
return true;
}
else
if (input_joypad_pressed(ps3->joypad,
if (input_joypad_pressed(ps3->joypad,
0, settings->input.binds[0], key))
return true;
return true;
return false;
}

View File

@ -113,19 +113,10 @@ static bool psp_input_key_pressed(void *data, int key)
{
settings_t *settings = config_get_ptr();
psp_input_t *psp = (psp_input_t*)data;
int port = 0;
if (settings->input.all_users_control_menu)
{
for (port = 0; port < MAX_USERS; port++)
if (input_joypad_pressed(psp->joypad,
port, settings->input.binds[0], key))
return true;
}
else
if (input_joypad_pressed(psp->joypad,
if (input_joypad_pressed(psp->joypad,
0, settings->input.binds[0], key))
return true;
return true;
return false;
}

View File

@ -798,19 +798,10 @@ static bool qnx_input_key_pressed(void *data, int key)
{
qnx_input_t *qnx = (qnx_input_t*)data;
settings_t *settings = config_get_ptr();
int port = 0;
if (settings->input.all_users_control_menu)
{
for (port = 0; port < MAX_USERS; port++)
if (input_joypad_pressed(qnx->joypad,
port, settings->input.binds[0], key))
return true;
}
else
if (input_joypad_pressed(qnx->joypad,
if (input_joypad_pressed(qnx->joypad,
0, settings->input.binds[0], key))
return true;
return true;
return false;
}

View File

@ -110,27 +110,17 @@ static bool sdl_input_key_pressed(void *data, int key)
{
if (key >= 0 && key < RARCH_BIND_LIST_END)
{
sdl_input_t *sdl = (sdl_input_t*)data;
settings_t *settings = config_get_ptr();
int port = 0;
sdl_input_t *sdl = (sdl_input_t*)data;
settings_t *settings = config_get_ptr();
const struct retro_keybind *binds = settings->input.binds[0];
if (sdl_is_pressed(sdl, 0, binds, key))
return true;
if (settings->input.all_users_control_menu)
{
for (port = 0; port < MAX_USERS; port++)
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(sdl->joypad,
port, settings->input.binds[0], key))
return true;
}
else
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(sdl->joypad,
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(sdl->joypad,
0, settings->input.binds[0], key))
return true;
return true;
}
return false;

View File

@ -552,25 +552,15 @@ static bool udev_input_key_pressed(void *data, int key)
{
udev_input_t *udev = (udev_input_t*)data;
settings_t *settings = config_get_ptr();
int port = 0;
if (settings->input.binds[0][key].valid
&& udev_input_is_pressed(settings->input.binds[0], key))
return true;
if (settings->input.all_users_control_menu)
{
for (port = 0; port < MAX_USERS; port++)
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(udev->joypad,
port, settings->input.binds[0], key))
return true;
}
else
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(udev->joypad,
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(udev->joypad,
0, settings->input.binds[0], key))
return true;
return true;
return false;
}

View File

@ -98,21 +98,11 @@ static bool wiiu_input_key_pressed(void *data, int key)
{
settings_t *settings = config_get_ptr();
wiiu_input_t *wiiu = (wiiu_input_t*)data;
int port = 0;
if (settings->input.all_users_control_menu)
{
for (port = 0; port < MAX_USERS; port++)
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(wiiu->joypad,
port, settings->input.binds[0], key))
return true;
}
else
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(wiiu->joypad,
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(wiiu->joypad,
0, settings->input.binds[0], key))
return true;
return true;
return false;
}

View File

@ -123,22 +123,13 @@ static bool x_input_key_pressed(void *data, int key)
{
x11_input_t *x11 = (x11_input_t*)data;
settings_t *settings = config_get_ptr();
int port = 0;
if (settings->input.binds[0][key].valid && x_is_pressed(x11, settings->input.binds[0], key))
return true;
if (settings->input.all_users_control_menu)
{
for (port = 0; port < MAX_USERS; port++)
if (input_joypad_pressed(x11->joypad,
port, settings->input.binds[0], key))
return true;
}
else
if (input_joypad_pressed(x11->joypad,
if (input_joypad_pressed(x11->joypad,
0, settings->input.binds[0], key))
return true;
return true;
return false;
}

View File

@ -100,21 +100,11 @@ static bool xdk_input_key_pressed(void *data, int key)
{
xdk_input_t *xdk = (xdk_input_t*)data;
settings_t *settings = config_get_ptr();
int port = 0;
if (settings->input.all_users_control_menu)
{
for (port = 0; port < MAX_USERS; port++)
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(xdk->joypad,
port, settings->input.binds[0], key))
return true;
}
else
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(xdk->joypad,
if (settings->input.binds[0][key].valid &&
input_joypad_pressed(xdk->joypad,
0, settings->input.binds[0], key))
return true;
return true;
return false;
}