mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-26 21:36:26 +00:00
(dinput.c) remove dependency on settings struct
This commit is contained in:
parent
db725155c1
commit
f3de77e93c
@ -42,7 +42,6 @@
|
|||||||
#include "../../config.h"
|
#include "../../config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../../configuration.h"
|
|
||||||
#include "../../verbosity.h"
|
#include "../../verbosity.h"
|
||||||
#include "../../tasks/tasks_internal.h"
|
#include "../../tasks/tasks_internal.h"
|
||||||
#include "../../gfx/video_driver.h"
|
#include "../../gfx/video_driver.h"
|
||||||
@ -72,6 +71,7 @@ struct pointer_status
|
|||||||
|
|
||||||
struct dinput_input
|
struct dinput_input
|
||||||
{
|
{
|
||||||
|
char *joypad_driver_name;
|
||||||
bool blocked;
|
bool blocked;
|
||||||
LPDIRECTINPUTDEVICE8 keyboard;
|
LPDIRECTINPUTDEVICE8 keyboard;
|
||||||
LPDIRECTINPUTDEVICE8 mouse;
|
LPDIRECTINPUTDEVICE8 mouse;
|
||||||
@ -140,6 +140,9 @@ static void *dinput_init(const char *joypad_driver)
|
|||||||
if (!di)
|
if (!di)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (!string_is_empty(joypad_driver))
|
||||||
|
di->joypad_driver_name = strdup(joypad_driver);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
if (FAILED(IDirectInput8_CreateDevice(g_dinput_ctx, GUID_SysKeyboard, &di->keyboard, NULL)))
|
if (FAILED(IDirectInput8_CreateDevice(g_dinput_ctx, GUID_SysKeyboard, &di->keyboard, NULL)))
|
||||||
{
|
{
|
||||||
@ -478,12 +481,10 @@ static int16_t dinput_input_state(void *data,
|
|||||||
case RETRO_DEVICE_ANALOG:
|
case RETRO_DEVICE_ANALOG:
|
||||||
if (binds[port])
|
if (binds[port])
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
|
||||||
ret = dinput_pressed_analog(di, binds[port], idx, id);
|
ret = dinput_pressed_analog(di, binds[port], idx, id);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
ret = input_joypad_analog(di->joypad, joypad_info,
|
ret = input_joypad_analog(di->joypad, joypad_info,
|
||||||
port,
|
port, idx, id, binds[port]);
|
||||||
idx, id, settings->input.binds[port]);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -601,7 +602,6 @@ extern "C"
|
|||||||
bool dinput_handle_message(void *dinput, UINT message, WPARAM wParam, LPARAM lParam)
|
bool dinput_handle_message(void *dinput, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
struct dinput_input *di = (struct dinput_input *)dinput;
|
struct dinput_input *di = (struct dinput_input *)dinput;
|
||||||
settings_t *settings = config_get_ptr();
|
|
||||||
/* WM_POINTERDOWN : Arrives for each new touch event
|
/* WM_POINTERDOWN : Arrives for each new touch event
|
||||||
* with a new ID - add to list.
|
* with a new ID - add to list.
|
||||||
* WM_POINTERUP : Arrives once the pointer is no
|
* WM_POINTERUP : Arrives once the pointer is no
|
||||||
@ -649,7 +649,7 @@ bool dinput_handle_message(void *dinput, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
case WM_DEVICECHANGE:
|
case WM_DEVICECHANGE:
|
||||||
if (di->joypad)
|
if (di->joypad)
|
||||||
di->joypad->destroy();
|
di->joypad->destroy();
|
||||||
di->joypad = input_joypad_init_driver(settings->input.joypad_driver, di);
|
di->joypad = input_joypad_init_driver(di->joypad_driver_name, di);
|
||||||
break;
|
break;
|
||||||
case WM_MOUSEWHEEL:
|
case WM_MOUSEWHEEL:
|
||||||
if (((short) HIWORD(wParam))/120 > 0)
|
if (((short) HIWORD(wParam))/120 > 0)
|
||||||
@ -692,6 +692,9 @@ static void dinput_free(void *data)
|
|||||||
if (di->mouse)
|
if (di->mouse)
|
||||||
IDirectInputDevice8_Release(di->mouse);
|
IDirectInputDevice8_Release(di->mouse);
|
||||||
|
|
||||||
|
if (string_is_empty(di->joypad_driver_name))
|
||||||
|
free(di->joypad_driver_name);
|
||||||
|
|
||||||
free(di);
|
free(di);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user