mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-23 11:18:25 +00:00
Only destroy dinput if non-NULL.
This commit is contained in:
parent
8b5e950eef
commit
682bd74a28
@ -451,34 +451,35 @@ bool dinput_handle_message(void *dinput, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
*/
|
*/
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_POINTERDOWN:
|
case WM_POINTERDOWN:
|
||||||
{
|
{
|
||||||
struct pointer_status *new_pointer = (struct pointer_status *)malloc(sizeof(struct pointer_status));
|
struct pointer_status *new_pointer = (struct pointer_status *)malloc(sizeof(struct pointer_status));
|
||||||
new_pointer->pointer_id = GET_POINTERID_WPARAM(wParam);
|
new_pointer->pointer_id = GET_POINTERID_WPARAM(wParam);
|
||||||
dinput_pointer_store_pos(new_pointer, lParam);
|
dinput_pointer_store_pos(new_pointer, lParam);
|
||||||
dinput_add_pointer(di, new_pointer);
|
dinput_add_pointer(di, new_pointer);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case WM_POINTERUP:
|
case WM_POINTERUP:
|
||||||
{
|
{
|
||||||
int pointer_id = GET_POINTERID_WPARAM(wParam);
|
int pointer_id = GET_POINTERID_WPARAM(wParam);
|
||||||
dinput_delete_pointer(di, pointer_id);
|
dinput_delete_pointer(di, pointer_id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case WM_POINTERUPDATE:
|
case WM_POINTERUPDATE:
|
||||||
{
|
{
|
||||||
int pointer_id = GET_POINTERID_WPARAM(wParam);
|
int pointer_id = GET_POINTERID_WPARAM(wParam);
|
||||||
struct pointer_status *pointer = dinput_find_pointer(di, pointer_id);
|
struct pointer_status *pointer = dinput_find_pointer(di, pointer_id);
|
||||||
if (pointer)
|
if (pointer)
|
||||||
dinput_pointer_store_pos(pointer, lParam);
|
dinput_pointer_store_pos(pointer, lParam);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case WM_DEVICECHANGE:
|
case WM_DEVICECHANGE:
|
||||||
{
|
{
|
||||||
di->joypad->destroy();
|
if (di->joypad)
|
||||||
di->joypad = input_joypad_init_driver(g_settings.input.joypad_driver);
|
di->joypad->destroy();
|
||||||
break;
|
di->joypad = input_joypad_init_driver(g_settings.input.joypad_driver);
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -491,7 +492,8 @@ static void dinput_free(void *data)
|
|||||||
if (di)
|
if (di)
|
||||||
{
|
{
|
||||||
g_ctx = NULL; // Prevent a joypad driver to kill our context prematurely.
|
g_ctx = NULL; // Prevent a joypad driver to kill our context prematurely.
|
||||||
di->joypad->destroy();
|
if (di->joypad)
|
||||||
|
di->joypad->destroy();
|
||||||
g_ctx = hold_ctx;
|
g_ctx = hold_ctx;
|
||||||
|
|
||||||
dinput_clear_pointers(di); // clear any leftover pointers
|
dinput_clear_pointers(di); // clear any leftover pointers
|
||||||
|
Loading…
Reference in New Issue
Block a user