Merge pull request #5133 from fr500/master

Fix #5091
This commit is contained in:
Twinaphex 2017-07-01 04:35:59 +02:00 committed by GitHub
commit 6995154a9a
5 changed files with 32 additions and 21 deletions

View File

@ -125,17 +125,19 @@ bool dinput_init_context(void)
return true;
error:
RARCH_ERR("Failed to initialize DirectInput.\n");
RARCH_ERR("[DINPUT] Failed to initialize DirectInput.\n");
return false;
}
static void *dinput_init(const char *joypad_driver)
{
struct dinput_input *di = NULL;
if (!dinput_init_context())
{
RARCH_ERR("Failed to start DirectInput driver.\n");
RARCH_ERR("[DINPUT] Failed to start DirectInput driver.\n");
return NULL;
}
@ -149,24 +151,24 @@ static void *dinput_init(const char *joypad_driver)
#ifdef __cplusplus
if (FAILED(IDirectInput8_CreateDevice(g_dinput_ctx, GUID_SysKeyboard, &di->keyboard, NULL)))
{
RARCH_ERR("Failed to create keyboard device.\n");
RARCH_ERR("[DINPUT] Failed to create keyboard device.\n");
di->keyboard = NULL;
}
if (FAILED(IDirectInput8_CreateDevice(g_dinput_ctx, GUID_SysMouse, &di->mouse, NULL)))
{
RARCH_ERR("Failed to create mouse device.\n");
RARCH_ERR("[DINPUT] Failed to create mouse device.\n");
di->mouse = NULL;
}
#else
if (FAILED(IDirectInput8_CreateDevice(g_dinput_ctx, &GUID_SysKeyboard, &di->keyboard, NULL)))
{
RARCH_ERR("Failed to create keyboard device.\n");
RARCH_ERR("[DINPUT] Failed to create keyboard device.\n");
di->keyboard = NULL;
}
if (FAILED(IDirectInput8_CreateDevice(g_dinput_ctx, &GUID_SysMouse, &di->mouse, NULL)))
{
RARCH_ERR("Failed to create mouse device.\n");
RARCH_ERR("[DINPUT] Failed to create mouse device.\n");
di->mouse = NULL;
}
#endif
@ -626,7 +628,7 @@ bool dinput_handle_message(void *dinput, UINT message, WPARAM wParam, LPARAM lPa
if (!new_pointer)
{
RARCH_ERR("dinput_handle_message: pointer allocation in WM_POINTERDOWN failed.\n");
RARCH_ERR("[DINPUT] dinput_handle_message: pointer allocation in WM_POINTERDOWN failed.\n");
return false;
}

View File

@ -239,7 +239,7 @@ static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
g_pads[g_joypad_cnt].vid = inst->guidProduct.Data1 % 0x10000;
g_pads[g_joypad_cnt].pid = inst->guidProduct.Data1 / 0x10000;
RARCH_LOG("Device #%u PID: {%04lX} VID:{%04lX}\n", g_joypad_cnt, g_pads[g_joypad_cnt].pid, g_pads[g_joypad_cnt].vid);
RARCH_LOG("[DINPUT] Device #%u PID: {%04lX} VID:{%04lX}\n", g_joypad_cnt, g_pads[g_joypad_cnt].pid, g_pads[g_joypad_cnt].vid);
#ifdef HAVE_XINPUT
is_xinput_pad = g_xinput_block_pads
@ -299,10 +299,10 @@ static bool dinput_joypad_init(void *data)
g_pads[i].joy_friendly_name = NULL;
}
RARCH_LOG("Enumerating DInput joypads ...\n");
RARCH_LOG("[DINPUT] Enumerating joypads ...\n");
IDirectInput8_EnumDevices(g_dinput_ctx, DI8DEVCLASS_GAMECTRL,
enum_joypad_cb, NULL, DIEDFL_ATTACHEDONLY);
RARCH_LOG("Done enumerating DInput joypads ...\n");
RARCH_LOG("[DINPUT] Done enumerating joypads ...\n");
return true;
}

View File

@ -197,11 +197,11 @@ static bool xinput_joypad_init(void *data)
if (!g_xinput_dll)
{
RARCH_ERR("Failed to load XInput, ensure DirectX and controller drivers are up to date.\n");
RARCH_ERR("[XInput] Failed to load XInput, ensure DirectX and controller drivers are up to date.\n");
return false;
}
RARCH_LOG("Found XInput v%s.\n", version);
RARCH_LOG("[XInput] Found XInput v%s.\n", version);
/* If we get here then an xinput DLL is correctly loaded.
* First try to load ordinal 100 (XInputGetStateEx).
@ -219,17 +219,17 @@ static bool xinput_joypad_init(void *data)
if (!g_XInputGetStateEx)
{
RARCH_ERR("Failed to init XInput: DLL is invalid or corrupt.\n");
RARCH_ERR("[XInput] Failed to init: DLL is invalid or corrupt.\n");
dylib_close(g_xinput_dll);
return false; /* DLL was loaded but did not contain the correct function. */
}
RARCH_WARN("XInput: No guide button support.\n");
RARCH_WARN("[XInput] No guide button support.\n");
}
g_XInputSetState = (XInputSetState_t)dylib_proc(g_xinput_dll, "XInputSetState");
if (!g_XInputSetState)
{
RARCH_ERR("Failed to init XInput: DLL is invalid or corrupt.\n");
RARCH_ERR("[XInput] Failed to init: DLL is invalid or corrupt.\n");
dylib_close(g_xinput_dll);
return false; /* DLL was loaded but did not contain the correct function. */
}
@ -243,7 +243,7 @@ static bool xinput_joypad_init(void *data)
{
g_xinput_states[i].connected = !(g_XInputGetStateEx(i, &dummy_state) == ERROR_DEVICE_NOT_CONNECTED);
if (g_xinput_states[i].connected)
RARCH_LOG("Found XInput controller, user #%u\n", i);
RARCH_LOG("[XInput] Found controller, user #%u\n", i);
}
if ((!g_xinput_states[0].connected) &&
@ -251,7 +251,13 @@ static bool xinput_joypad_init(void *data)
(!g_xinput_states[2].connected) &&
(!g_xinput_states[3].connected))
return false;
#if (1)
else
{
RARCH_LOG("[XInput] Pads connected: %d\n", g_xinput_states[0].connected +
g_xinput_states[1].connected + g_xinput_states[2].connected + g_xinput_states[3].connected);
}
#endif
g_xinput_block_pads = true;
/* We're going to have to be buddies with dinput if we want to be able
@ -264,6 +270,7 @@ static bool xinput_joypad_init(void *data)
for (j = 0; j < MAX_USERS; j++)
{
RARCH_LOG("[XInput] Attempting autoconf for, user #%u\n", j);
if (pad_index_to_xuser_index(j) > -1)
{
if (!input_autoconfigure_connect(

View File

@ -853,6 +853,8 @@ MSG_HASH(MENU_ENUM_LABEL_SAVESTATE_AUTO_INDEX,
"savestate_auto_index")
MSG_HASH(MENU_ENUM_LABEL_SAVESTATE_AUTO_LOAD,
"savestate_auto_load")
MSG_HASH(MENU_ENUM_LABEL_SAVESTATE_THUMBNAIL_ENABLE,
"savestate_thumbnails")
MSG_HASH(MENU_ENUM_LABEL_SAVESTATE_AUTO_SAVE,
"savestate_auto_save")
MSG_HASH(MENU_ENUM_LABEL_SAVESTATE_DIRECTORY,

View File

@ -245,7 +245,7 @@ static bool input_autoconfigure_joypad_from_conf_dir(
if(!list)
return false;
RARCH_LOG("[Autodetect]: %d profiles found.\n", list->size);
RARCH_LOG("[Autoconf]: %d profiles found.\n", list->size);
for (i = 0; i < list->size; i++)
{
@ -274,7 +274,7 @@ static bool input_autoconfigure_joypad_from_conf_dir(
config_get_config_path(conf, conf_path, sizeof(conf_path));
RARCH_LOG("[Autodetect]: 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;
@ -326,7 +326,7 @@ static void input_autoconfigure_connect_handler(retro_task_t *task)
strlcpy(params->name, "Android Gamepad", sizeof(params->name));
if(input_autoconfigure_joypad_from_conf_internal(params, task))
{
RARCH_LOG("[Autodetect]: no profiles found for %s (%d/%d). Using fallback\n",
RARCH_LOG("[Autoconf]: no profiles found for %s (%d/%d). Using fallback\n",
params->name, params->vid, params->pid);
snprintf(msg, sizeof(msg), "%s (%ld/%ld) %s.",
@ -334,7 +334,7 @@ static void input_autoconfigure_connect_handler(retro_task_t *task)
msg_hash_to_str(MSG_DEVICE_NOT_CONFIGURED_FALLBACK));
}
#else
RARCH_LOG("[Autodetect]: no profiles found for %s (%d/%d).\n",
RARCH_LOG("[Autoconf]: no profiles found for %s (%d/%d).\n",
params->name, params->vid, params->pid);
snprintf(msg, sizeof(msg), "%s (%ld/%ld) %s.",