mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
5510bfcb36
@ -369,7 +369,8 @@ endif
|
||||
ifeq ($(HAVE_DINPUT), 1)
|
||||
LIBS += -ldinput8 -ldxguid -lole32
|
||||
DEFINES += -DHAVE_DINPUT
|
||||
OBJ += input/drivers/dinput.o
|
||||
OBJ += input/drivers/dinput.o \
|
||||
input/drivers_joypad/dinput_joypad.o
|
||||
JOYCONFIG_LIBS += -ldinput8 -ldxguid -lole32
|
||||
endif
|
||||
|
||||
@ -709,7 +710,8 @@ ifneq ($(findstring Win32,$(OS)),)
|
||||
OBJ += media/rarch.o \
|
||||
input/drivers_keyboard/keyboard_event_win32.o \
|
||||
gfx/drivers_wm/win32_common.o \
|
||||
gfx/drivers_wm/win32_dwm_common.o
|
||||
gfx/drivers_wm/win32_dwm_common.o \
|
||||
frontend/drivers/platform_win32.o
|
||||
endif
|
||||
|
||||
# Record
|
||||
|
@ -866,6 +866,7 @@ const frontend_ctx_driver_t frontend_ctx_android = {
|
||||
NULL, /* set_fork */
|
||||
frontend_android_shutdown, /* shutdown */
|
||||
frontend_android_get_name, /* get_name */
|
||||
NULL, /* get_os */
|
||||
frontend_android_get_rating, /* get_rating */
|
||||
NULL, /* load_content */
|
||||
"android",
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "../../apple/common/CFExtensions.h"
|
||||
|
||||
#include "../frontend.h"
|
||||
#include "../frontend_driver.h"
|
||||
#ifdef IOS
|
||||
#include "../../menu/drivers/ios.h"
|
||||
#endif
|
||||
@ -27,6 +27,111 @@
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
static bool CopyModel(char** model, uint32_t *majorRev, uint32_t *minorRev)
|
||||
{
|
||||
#ifdef OSX
|
||||
int mib[2];
|
||||
int count;
|
||||
unsigned long modelLen;
|
||||
char *revStr;
|
||||
#endif
|
||||
char *machineModel;
|
||||
bool success = true;
|
||||
size_t length = 1024;
|
||||
|
||||
if (!model || !majorRev || !minorRev)
|
||||
{
|
||||
RARCH_ERR("CopyModel: Passing NULL arguments\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef IOS
|
||||
sysctlbyname("hw.machine", NULL, &length, NULL, 0);
|
||||
#endif
|
||||
|
||||
machineModel = malloc(length);
|
||||
|
||||
if (!machineModel)
|
||||
{
|
||||
success = false;
|
||||
goto exit;
|
||||
}
|
||||
#ifdef IOS
|
||||
sysctlbyname("hw.machine", machineModel, &length, NULL, 0);
|
||||
*model = strndup(machineModel, length);
|
||||
#else
|
||||
mib[0] = CTL_HW;
|
||||
mib[1] = HW_MODEL;
|
||||
|
||||
if (sysctl(mib, 2, machineModel, &length, NULL, 0))
|
||||
{
|
||||
printf("CopyModel: sysctl (error %d)\n", errno);
|
||||
success = false;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
modelLen = strcspn(machineModel, "0123456789");
|
||||
|
||||
if (modelLen == 0)
|
||||
{
|
||||
RARCH_ERR("CopyModel: Could not find machine model name\n");
|
||||
success = false;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
*model = strndup(machineModel, modelLen);
|
||||
|
||||
if (*model == NULL)
|
||||
{
|
||||
RARCH_ERR("CopyModel: Could not find machine model name\n");
|
||||
success = false;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
*majorRev = 0;
|
||||
*minorRev = 0;
|
||||
revStr = strpbrk(machineModel, "0123456789");
|
||||
|
||||
if (!revStr)
|
||||
{
|
||||
RARCH_ERR("CopyModel: Could not find machine version number, inferred value is 0,0\n");
|
||||
success = true;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
count = sscanf(revStr, "%d,%d", majorRev, minorRev);
|
||||
|
||||
if (count < 2)
|
||||
{
|
||||
RARCH_ERR("CopyModel: Could not find machine version number\n");
|
||||
if (count < 1)
|
||||
*majorRev = 0;
|
||||
*minorRev = 0;
|
||||
success = true;
|
||||
goto exit;
|
||||
}
|
||||
#endif
|
||||
|
||||
exit:
|
||||
if (machineModel)
|
||||
free(machineModel);
|
||||
if (!success)
|
||||
{
|
||||
if (*model)
|
||||
free(*model);
|
||||
*model = NULL;
|
||||
*majorRev = 0;
|
||||
*minorRev = 0;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
static void frontend_apple_get_name(char *name, size_t sizeof_name)
|
||||
{
|
||||
uint32_t major_rev, minor_rev;
|
||||
CopyModel(&name, &major_rev, &minor_rev);
|
||||
}
|
||||
|
||||
static void frontend_apple_get_environment_settings(int *argc, char *argv[],
|
||||
void *args, void *params_data)
|
||||
{
|
||||
@ -125,10 +230,69 @@ static void frontend_apple_shutdown(bool unused)
|
||||
|
||||
static int frontend_apple_get_rating(void)
|
||||
{
|
||||
/* TODO/FIXME - look at unique identifier per device and
|
||||
* determine rating for some */
|
||||
char model[PATH_MAX_LENGTH];
|
||||
|
||||
frontend_apple_get_name(model, sizeof(model));
|
||||
|
||||
/* iPhone 4 */
|
||||
#if 0
|
||||
if (strstr(model, "iPhone3"))
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
/* iPad 1 */
|
||||
#if 0
|
||||
if (strstr(model, "iPad1,1"))
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
/* iPhone 4S */
|
||||
if (strstr(model, "iPhone4,1"))
|
||||
return 8;
|
||||
|
||||
/* iPad 2/iPad Mini 1 */
|
||||
if (strstr(model, "iPad2"))
|
||||
return 9;
|
||||
|
||||
/* iPhone 5/5C */
|
||||
if (strstr(model, "iPhone5"))
|
||||
return 13;
|
||||
|
||||
/* iPhone 5S */
|
||||
if (strstr(model, "iPhone6,1") || strstr(model, "iPhone6,2"))
|
||||
return 14;
|
||||
|
||||
/* iPad Mini 2/3 */
|
||||
if ( strstr(model, "iPad4,4")
|
||||
|| strstr(model, "iPad4,5")
|
||||
|| strstr(model, "iPad4,6")
|
||||
|| strstr(model, "iPad4,7")
|
||||
|| strstr(model, "iPad4,8")
|
||||
|| strstr(model, "iPad4,9")
|
||||
)
|
||||
return 15;
|
||||
|
||||
/* iPad Air */
|
||||
if ( strstr(model, "iPad4,1")
|
||||
|| strstr(model, "iPad4,2")
|
||||
|| strstr(model, "iPad4,3")
|
||||
)
|
||||
return 16;
|
||||
|
||||
/* iPhone 6, iPhone 6 Plus */
|
||||
if (strstr(model, "iPhone7"))
|
||||
return 17;
|
||||
|
||||
/* iPad Air 2 */
|
||||
if (strstr(model, "iPad5,3") || strstr(model, "iPad5,4"))
|
||||
return 18;
|
||||
|
||||
/* TODO/FIXME -
|
||||
- more ratings for more systems
|
||||
- determine rating more intelligently*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
const frontend_ctx_driver_t frontend_ctx_apple = {
|
||||
frontend_apple_get_environment_settings, /* environment_get */
|
||||
NULL, /* init */
|
||||
@ -138,7 +302,8 @@ const frontend_ctx_driver_t frontend_ctx_apple = {
|
||||
NULL, /* exec */
|
||||
NULL, /* set_fork */
|
||||
frontend_apple_shutdown, /* shutdown */
|
||||
NULL, /* get_name */
|
||||
frontend_apple_get_name, /* get_name */
|
||||
NULL, /* get_os */
|
||||
frontend_apple_get_rating, /* get_rating */
|
||||
frontend_apple_load_content, /* load_content */
|
||||
"apple",
|
||||
|
@ -186,6 +186,7 @@ const frontend_ctx_driver_t frontend_ctx_ctr = {
|
||||
NULL, /* set_fork */
|
||||
frontend_ctr_shutdown, /* shutdown */
|
||||
NULL, /* get_name */
|
||||
NULL, /* get_os */
|
||||
frontend_ctr_get_rating, /* get_rating */
|
||||
NULL, /* load_content */
|
||||
"ctr",
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "../../general.h"
|
||||
#include <file/config_file.h>
|
||||
#include "../../content.h"
|
||||
#include "../frontend.h"
|
||||
#include "../frontend_driver.h"
|
||||
|
||||
static void emscripten_mainloop(void)
|
||||
{
|
||||
|
@ -386,6 +386,7 @@ const frontend_ctx_driver_t frontend_ctx_gx = {
|
||||
frontend_gx_set_fork, /* set_fork */
|
||||
NULL, /* shutdown */
|
||||
NULL, /* get_name */
|
||||
NULL, /* get_os */
|
||||
frontend_gx_get_rating, /* get_rating */
|
||||
NULL, /* load_content */
|
||||
"gx",
|
||||
|
@ -31,6 +31,7 @@ const frontend_ctx_driver_t frontend_ctx_null = {
|
||||
NULL, /* set_fork */
|
||||
NULL, /* shutdown */
|
||||
NULL, /* get_name */
|
||||
NULL, /* get_os */
|
||||
NULL, /* get_rating */
|
||||
NULL, /* load_content */
|
||||
"null",
|
||||
|
@ -449,6 +449,7 @@ const frontend_ctx_driver_t frontend_ctx_ps3 = {
|
||||
frontend_ps3_set_fork, /* set_fork */
|
||||
NULL, /* shutdown */
|
||||
NULL, /* get_name */
|
||||
NULL, /* get_os */
|
||||
frontend_ps3_get_rating, /* get_rating */
|
||||
NULL, /* load_content */
|
||||
"ps3",
|
||||
|
@ -248,6 +248,7 @@ const frontend_ctx_driver_t frontend_ctx_psp = {
|
||||
frontend_psp_set_fork, /* set_fork */
|
||||
frontend_psp_shutdown, /* shutdown */
|
||||
NULL, /* get_name */
|
||||
NULL, /* get_os */
|
||||
frontend_psp_get_rating, /* get_rating */
|
||||
NULL, /* load_content */
|
||||
"psp",
|
||||
|
@ -69,6 +69,7 @@ const frontend_ctx_driver_t frontend_ctx_qnx = {
|
||||
NULL, /* set_fork */
|
||||
frontend_qnx_shutdown, /* shutdown */
|
||||
NULL, /* get_name */
|
||||
NULL, /* get_os */
|
||||
frontend_qnx_get_rating, /* get_rating */
|
||||
NULL, /* load_content */
|
||||
"qnx",
|
||||
|
62
frontend/drivers/platform_win32.c
Normal file
62
frontend/drivers/platform_win32.c
Normal file
@ -0,0 +1,62 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2015 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
* * You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef _XBOX
|
||||
#include <xtl.h>
|
||||
#else
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <retro_miscellaneous.h>
|
||||
#include "../frontend_driver.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
static void frontend_win32_get_os(char *name, size_t sizeof_name, int *major, int *minor)
|
||||
{
|
||||
uint32_t version = GetVersion();
|
||||
|
||||
*major = (DWORD)(LOBYTE(LOWORD(version)));
|
||||
*minor = (DWORD)(HIBYTE(LOWORD(version)));
|
||||
}
|
||||
|
||||
static void frontend_win32_init(void *data)
|
||||
{
|
||||
char os_version[PATH_MAX_LENGTH];
|
||||
int major, minor;
|
||||
|
||||
(void)data;
|
||||
|
||||
frontend_win32_get_os(os_version, sizeof(os_version), &major, &minor);
|
||||
|
||||
|
||||
}
|
||||
|
||||
const frontend_ctx_driver_t frontend_ctx_win32 = {
|
||||
NULL, /* environment_get */
|
||||
frontend_win32_init, /* init */
|
||||
NULL, /* deinit */
|
||||
NULL, /* exitspawn */
|
||||
NULL, /* process_args */
|
||||
NULL, /* exec */
|
||||
NULL, /* set_fork */
|
||||
NULL, /* shutdown */
|
||||
NULL, /* get_name */
|
||||
frontend_win32_get_os, /* get_os */
|
||||
NULL, /* get_rating */
|
||||
NULL, /* load_content */
|
||||
"win32",
|
||||
};
|
@ -377,6 +377,7 @@ const frontend_ctx_driver_t frontend_ctx_xdk = {
|
||||
frontend_xdk_set_fork, /* set_fork */
|
||||
NULL, /* shutdown */
|
||||
NULL, /* get_name */
|
||||
NULL, /* get_os */
|
||||
frontend_xdk_get_rating, /* get_rating */
|
||||
NULL, /* load_content */
|
||||
"xdk",
|
||||
|
@ -87,11 +87,12 @@ void main_exit_save_config(void)
|
||||
**/
|
||||
void main_exit(args_type() args)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
const frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
||||
|
||||
global->system.shutdown = false;
|
||||
global->system.shutdown = false;
|
||||
|
||||
main_exit_save_config();
|
||||
|
||||
@ -110,17 +111,23 @@ void main_exit(args_type() args)
|
||||
logger_shutdown();
|
||||
#endif
|
||||
|
||||
if (driver->frontend_ctx && driver->frontend_ctx->deinit)
|
||||
driver->frontend_ctx->deinit(args);
|
||||
if (frontend)
|
||||
{
|
||||
if (frontend->deinit)
|
||||
frontend->deinit(args);
|
||||
|
||||
if (driver->frontend_ctx && driver->frontend_ctx->exitspawn)
|
||||
driver->frontend_ctx->exitspawn(settings->libretro,
|
||||
sizeof(settings->libretro));
|
||||
if (frontend->exitspawn)
|
||||
frontend->exitspawn(settings->libretro,
|
||||
sizeof(settings->libretro));
|
||||
}
|
||||
|
||||
rarch_main_free();
|
||||
|
||||
if (driver->frontend_ctx && driver->frontend_ctx->shutdown)
|
||||
driver->frontend_ctx->shutdown(false);
|
||||
if (frontend)
|
||||
{
|
||||
if (frontend->shutdown)
|
||||
frontend->shutdown(false);
|
||||
}
|
||||
|
||||
driver_free();
|
||||
}
|
||||
@ -281,10 +288,10 @@ returntype main_entry(signature())
|
||||
{
|
||||
declare_argc();
|
||||
declare_argv();
|
||||
args_type() args = (args_type())args_initial_ptr();
|
||||
int ret = 0;
|
||||
settings_t *settings = NULL;
|
||||
driver_t *driver = NULL;
|
||||
args_type() args = (args_type())args_initial_ptr();
|
||||
int ret = 0;
|
||||
settings_t *settings = NULL;
|
||||
driver_t *driver = NULL;
|
||||
|
||||
rarch_main_alloc();
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
#include "frontend_driver.h"
|
||||
#include "../driver.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -45,6 +46,9 @@ static const frontend_ctx_driver_t *frontend_ctx_drivers[] = {
|
||||
#endif
|
||||
#if defined(_3DS)
|
||||
&frontend_ctx_ctr,
|
||||
#endif
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
&frontend_ctx_win32,
|
||||
#endif
|
||||
&frontend_ctx_null,
|
||||
NULL
|
||||
@ -87,3 +91,11 @@ const frontend_ctx_driver_t *frontend_ctx_init_first(void)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const frontend_ctx_driver_t *frontend_get_ptr(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return NULL;
|
||||
return driver->frontend_ctx;
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ typedef struct frontend_ctx_driver
|
||||
void (*set_fork)(bool exitspawn, bool start_game);
|
||||
void (*shutdown)(bool);
|
||||
void (*get_name)(char *, size_t);
|
||||
void (*get_os)(char *, size_t, int *major, int *minor);
|
||||
int (*get_rating)(void);
|
||||
void (*content_loaded)(void);
|
||||
|
||||
@ -60,6 +61,7 @@ extern const frontend_ctx_driver_t frontend_ctx_apple;
|
||||
extern const frontend_ctx_driver_t frontend_ctx_android;
|
||||
extern const frontend_ctx_driver_t frontend_ctx_psp;
|
||||
extern const frontend_ctx_driver_t frontend_ctx_ctr;
|
||||
extern const frontend_ctx_driver_t frontend_ctx_win32;
|
||||
extern const frontend_ctx_driver_t frontend_ctx_null;
|
||||
|
||||
/**
|
||||
@ -72,6 +74,8 @@ extern const frontend_ctx_driver_t frontend_ctx_null;
|
||||
**/
|
||||
const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident);
|
||||
|
||||
const frontend_ctx_driver_t *frontend_get_ptr(void);
|
||||
|
||||
/**
|
||||
* frontend_ctx_init_first:
|
||||
*
|
||||
|
@ -22,6 +22,10 @@
|
||||
#include "../../libretro.h"
|
||||
#include "d3d_defines.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct LinkInfo
|
||||
{
|
||||
unsigned tex_w, tex_h;
|
||||
@ -72,5 +76,9 @@ extern renderchain_driver_t null_renderchain;
|
||||
bool renderchain_init_first(const renderchain_driver_t **renderchain_driver,
|
||||
void **renderchain_handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -226,14 +226,14 @@ VIDEO DRIVER
|
||||
#if defined(HAVE_D3D)
|
||||
#include "../gfx/d3d/d3d_wrapper.cpp"
|
||||
#include "../gfx/d3d/d3d.cpp"
|
||||
#include "../gfx/d3d/render_chain_driver.cpp"
|
||||
#include "../gfx/d3d/render_chain_driver.c"
|
||||
#ifdef _XBOX
|
||||
#include "../gfx/d3d/render_chain_xdk.cpp"
|
||||
#endif
|
||||
#ifdef HAVE_CG
|
||||
#include "../gfx/d3d/render_chain_cg.cpp"
|
||||
#endif
|
||||
#include "../gfx/d3d/render_chain_null.cpp"
|
||||
#include "../gfx/d3d/render_chain_null.c"
|
||||
#endif
|
||||
|
||||
#if defined(GEKKO)
|
||||
@ -341,6 +341,7 @@ INPUT
|
||||
|
||||
#ifdef HAVE_DINPUT
|
||||
#include "../input/drivers/dinput.c"
|
||||
#include "../input/drivers_joypad/dinput_joypad.c"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XINPUT
|
||||
@ -606,6 +607,9 @@ FRONTEND
|
||||
|
||||
#include "../frontend/frontend_driver.c"
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#include "../frontend/drivers/platform_win32.c"
|
||||
#endif
|
||||
#if defined(__CELLOS_LV2__)
|
||||
#include "../frontend/drivers/platform_ps3.c"
|
||||
#elif defined(GEKKO)
|
||||
|
@ -49,8 +49,8 @@ static void hidpad_ps3_send_control(struct hidpad_ps3_data* device)
|
||||
};
|
||||
|
||||
report_buffer[11] = 1 << ((device->slot % 4) + 1);
|
||||
report_buffer[4] = device->motors[1] >> 8;
|
||||
report_buffer[6] = device->motors[0] >> 8;
|
||||
report_buffer[4] = device->motors[1] >> 8;
|
||||
report_buffer[6] = device->motors[0] >> 8;
|
||||
|
||||
device->send_control(device->connection, report_buffer, sizeof(report_buffer));
|
||||
}
|
||||
@ -59,10 +59,10 @@ static void* hidpad_ps3_init(void *data, uint32_t slot, send_control_t ptr)
|
||||
{
|
||||
#ifdef IOS
|
||||
/* Magic packet to start reports. */
|
||||
static uint8_t magic_data[] = {0x53, 0xF4, 0x42, 0x03, 0x00, 0x00};
|
||||
static uint8_t magic_data[] = {0x53, 0xF4, 0x42, 0x03, 0x00, 0x00};
|
||||
#endif
|
||||
struct pad_connection* connection = (struct pad_connection*)data;
|
||||
struct hidpad_ps3_data* device = (struct hidpad_ps3_data*)
|
||||
struct hidpad_ps3_data* device = (struct hidpad_ps3_data*)
|
||||
calloc(1, sizeof(struct hidpad_ps3_data));
|
||||
|
||||
if (!device)
|
||||
@ -74,8 +74,8 @@ static void* hidpad_ps3_init(void *data, uint32_t slot, send_control_t ptr)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
device->connection = connection;
|
||||
device->slot = slot;
|
||||
device->connection = connection;
|
||||
device->slot = slot;
|
||||
device->send_control = ptr;
|
||||
|
||||
#ifdef IOS
|
||||
@ -154,9 +154,9 @@ static void hidpad_ps3_packet_handler(void *data, uint8_t *packet, uint16_t size
|
||||
|
||||
memcpy(device->data, packet, size);
|
||||
|
||||
device->buttons = 0;
|
||||
device->buttons = 0;
|
||||
|
||||
pressed_keys = device->data[3] | (device->data[4] << 8) |
|
||||
pressed_keys = device->data[3] | (device->data[4] << 8) |
|
||||
((device->data[5] & 1) << 16);
|
||||
|
||||
for (i = 0; i < 17; i ++)
|
||||
|
@ -94,7 +94,7 @@ static void* hidpad_ps4_init(void *data, uint32_t slot, send_control_t ptr)
|
||||
{
|
||||
uint8_t magic_data[0x25];
|
||||
struct pad_connection* connection = (struct pad_connection*)data;
|
||||
struct hidpad_ps4_data* device = (struct hidpad_ps4_data*)
|
||||
struct hidpad_ps4_data* device = (struct hidpad_ps4_data*)
|
||||
calloc(1, sizeof(struct hidpad_ps4_data));
|
||||
|
||||
if (!device)
|
||||
@ -151,7 +151,7 @@ static bool hidpad_ps4_check_dpad(struct ps4 *rpt, unsigned id)
|
||||
|
||||
static uint64_t hidpad_ps4_get_buttons(void *data)
|
||||
{
|
||||
uint64_t buttonstate = 0;
|
||||
uint64_t buttonstate = 0;
|
||||
struct hidpad_ps4_data *device = (struct hidpad_ps4_data*)data;
|
||||
struct ps4 *rpt = device ? (struct ps4*)&device->data : NULL;
|
||||
|
||||
|
@ -39,8 +39,16 @@
|
||||
#include <string.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
/* Keep track of which pad indexes are 360 controllers.
|
||||
* Not static, will be read in xinput_joypad.c
|
||||
* -1 = not xbox pad, otherwise 0..3
|
||||
*/
|
||||
|
||||
int g_xinput_pad_indexes[MAX_USERS];
|
||||
bool g_xinput_block_pads;
|
||||
|
||||
/* Context has to be global as joypads also ride on this context. */
|
||||
static LPDIRECTINPUT8 g_ctx;
|
||||
LPDIRECTINPUT8 g_dinput_ctx;
|
||||
|
||||
struct pointer_status
|
||||
{
|
||||
@ -65,28 +73,18 @@ struct dinput_input
|
||||
struct pointer_status pointer_head; /* dummy head for easier iteration */
|
||||
};
|
||||
|
||||
struct dinput_joypad
|
||||
void dinput_destroy_context(void)
|
||||
{
|
||||
LPDIRECTINPUTDEVICE8 joypad;
|
||||
DIJOYSTATE2 joy_state;
|
||||
char* joy_name;
|
||||
};
|
||||
|
||||
static unsigned g_joypad_cnt;
|
||||
static struct dinput_joypad g_pads[MAX_USERS];
|
||||
|
||||
static void dinput_destroy_context(void)
|
||||
{
|
||||
if (!g_ctx)
|
||||
if (!g_dinput_ctx)
|
||||
return;
|
||||
|
||||
IDirectInput8_Release(g_ctx);
|
||||
g_ctx = NULL;
|
||||
IDirectInput8_Release(g_dinput_ctx);
|
||||
g_dinput_ctx = NULL;
|
||||
}
|
||||
|
||||
static bool dinput_init_context(void)
|
||||
bool dinput_init_context(void)
|
||||
{
|
||||
if (g_ctx)
|
||||
if (g_dinput_ctx)
|
||||
return true;
|
||||
|
||||
CoInitialize(NULL);
|
||||
@ -95,11 +93,11 @@ static bool dinput_init_context(void)
|
||||
#ifdef __cplusplus
|
||||
if (FAILED(DirectInput8Create(
|
||||
GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8,
|
||||
(void**)&g_ctx, NULL)))
|
||||
(void**)&g_dinput_ctx, NULL)))
|
||||
#else
|
||||
if (FAILED(DirectInput8Create(
|
||||
GetModuleHandle(NULL), DIRECTINPUT_VERSION, &IID_IDirectInput8,
|
||||
(void**)&g_ctx, NULL)))
|
||||
(void**)&g_dinput_ctx, NULL)))
|
||||
#endif
|
||||
{
|
||||
RARCH_ERR("Failed to init DirectInput.\n");
|
||||
@ -126,24 +124,24 @@ static void *dinput_init(void)
|
||||
return NULL;
|
||||
|
||||
#ifdef __cplusplus
|
||||
if (FAILED(IDirectInput8_CreateDevice(g_ctx, GUID_SysKeyboard, &di->keyboard, NULL)))
|
||||
if (FAILED(IDirectInput8_CreateDevice(g_dinput_ctx, GUID_SysKeyboard, &di->keyboard, NULL)))
|
||||
{
|
||||
RARCH_ERR("Failed to create keyboard device.\n");
|
||||
di->keyboard = NULL;
|
||||
}
|
||||
|
||||
if (FAILED(IDirectInput8_CreateDevice(g_ctx, GUID_SysMouse, &di->mouse, NULL)))
|
||||
if (FAILED(IDirectInput8_CreateDevice(g_dinput_ctx, GUID_SysMouse, &di->mouse, NULL)))
|
||||
{
|
||||
RARCH_ERR("Failed to create mouse device.\n");
|
||||
di->mouse = NULL;
|
||||
}
|
||||
#else
|
||||
if (FAILED(IDirectInput8_CreateDevice(g_ctx, &GUID_SysKeyboard, &di->keyboard, NULL)))
|
||||
if (FAILED(IDirectInput8_CreateDevice(g_dinput_ctx, &GUID_SysKeyboard, &di->keyboard, NULL)))
|
||||
{
|
||||
RARCH_ERR("Failed to create keyboard device.\n");
|
||||
di->keyboard = NULL;
|
||||
}
|
||||
if (FAILED(IDirectInput8_CreateDevice(g_ctx, &GUID_SysMouse, &di->mouse, NULL)))
|
||||
if (FAILED(IDirectInput8_CreateDevice(g_dinput_ctx, &GUID_SysMouse, &di->mouse, NULL)))
|
||||
{
|
||||
RARCH_ERR("Failed to create mouse device.\n");
|
||||
di->mouse = NULL;
|
||||
@ -302,6 +300,8 @@ static int16_t dinput_lightgun_state(struct dinput_input *di, unsigned id)
|
||||
|
||||
static int16_t dinput_mouse_state(struct dinput_input *di, unsigned id)
|
||||
{
|
||||
int16_t state = 0;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case RETRO_DEVICE_ID_MOUSE_X:
|
||||
@ -313,29 +313,25 @@ static int16_t dinput_mouse_state(struct dinput_input *di, unsigned id)
|
||||
case RETRO_DEVICE_ID_MOUSE_RIGHT:
|
||||
return di->mouse_r;
|
||||
case RETRO_DEVICE_ID_MOUSE_WHEELUP:
|
||||
{
|
||||
int16_t state = di->mouse_wu ? 1 : 0;
|
||||
di->mouse_wu = false;
|
||||
return state;
|
||||
}
|
||||
if (di->mouse_wu)
|
||||
state = 1;
|
||||
di->mouse_wu = false;
|
||||
return state;
|
||||
case RETRO_DEVICE_ID_MOUSE_WHEELDOWN:
|
||||
{
|
||||
int16_t state = di->mouse_wd ? 1 : 0;
|
||||
di->mouse_wd = false;
|
||||
return state;
|
||||
}
|
||||
if (di->mouse_wd)
|
||||
state = 1;
|
||||
di->mouse_wd = false;
|
||||
return state;
|
||||
case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELUP:
|
||||
{
|
||||
int16_t state = di->mouse_hwu ? 1 : 0;
|
||||
di->mouse_hwu = false;
|
||||
return state;
|
||||
}
|
||||
if (di->mouse_hwu)
|
||||
state = 1;
|
||||
di->mouse_hwu = false;
|
||||
return state;
|
||||
case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELDOWN:
|
||||
{
|
||||
int16_t state = di->mouse_hwd ? 1 : 0;
|
||||
di->mouse_hwd = false;
|
||||
return state;
|
||||
}
|
||||
if (di->mouse_hwd)
|
||||
state = 1;
|
||||
di->mouse_hwd = false;
|
||||
return state;
|
||||
case RETRO_DEVICE_ID_MOUSE_MIDDLE:
|
||||
return di->mouse_m;
|
||||
}
|
||||
@ -355,16 +351,23 @@ static int16_t dinput_pointer_state(struct dinput_input *di,
|
||||
while (check_pos && num < idx)
|
||||
{
|
||||
num++;
|
||||
check_pos = check_pos->next;
|
||||
check_pos = check_pos->next;
|
||||
}
|
||||
if (!check_pos && idx > 0) /* idx = 0 has mouse fallback. */
|
||||
return 0;
|
||||
|
||||
x = check_pos ? check_pos->pointer_x : di->mouse_x;
|
||||
y = check_pos ? check_pos->pointer_y : di->mouse_y;
|
||||
pointer_down = check_pos ? true : di->mouse_l;
|
||||
x = di->mouse_x;
|
||||
y = di->mouse_y;
|
||||
pointer_down = di->mouse_l;
|
||||
|
||||
valid = input_translate_coord_viewport(x, y,
|
||||
if (check_pos)
|
||||
{
|
||||
x = check_pos->pointer_x;
|
||||
y = check_pos->pointer_y;
|
||||
pointer_down = true;
|
||||
}
|
||||
|
||||
valid = input_translate_coord_viewport(x, y,
|
||||
&res_x, &res_y, &res_screen_x, &res_screen_y);
|
||||
|
||||
if (!valid)
|
||||
@ -372,8 +375,8 @@ static int16_t dinput_pointer_state(struct dinput_input *di,
|
||||
|
||||
if (screen)
|
||||
{
|
||||
res_x = res_screen_x;
|
||||
res_y = res_screen_y;
|
||||
res_x = res_screen_x;
|
||||
res_y = res_screen_y;
|
||||
}
|
||||
|
||||
inside = (res_x >= -0x7fff) && (res_y >= -0x7fff);
|
||||
@ -451,7 +454,8 @@ static int16_t dinput_input_state(void *data,
|
||||
#endif
|
||||
|
||||
/* Stores x/y in client coordinates. */
|
||||
void dinput_pointer_store_pos(struct pointer_status *pointer, WPARAM lParam)
|
||||
static void dinput_pointer_store_pos(
|
||||
struct pointer_status *pointer, WPARAM lParam)
|
||||
{
|
||||
POINT point;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
@ -463,7 +467,7 @@ void dinput_pointer_store_pos(struct pointer_status *pointer, WPARAM lParam)
|
||||
pointer->pointer_y = point.y;
|
||||
}
|
||||
|
||||
void dinput_add_pointer(struct dinput_input *di,
|
||||
static void dinput_add_pointer(struct dinput_input *di,
|
||||
struct pointer_status *new_pointer)
|
||||
{
|
||||
struct pointer_status *insert_pos = NULL;
|
||||
@ -476,7 +480,7 @@ void dinput_add_pointer(struct dinput_input *di,
|
||||
insert_pos->next = new_pointer;
|
||||
}
|
||||
|
||||
void dinput_delete_pointer(struct dinput_input *di, int pointer_id)
|
||||
static void dinput_delete_pointer(struct dinput_input *di, int pointer_id)
|
||||
{
|
||||
struct pointer_status *check_pos = &di->pointer_head;
|
||||
|
||||
@ -493,8 +497,8 @@ void dinput_delete_pointer(struct dinput_input *di, int pointer_id)
|
||||
}
|
||||
}
|
||||
|
||||
struct pointer_status *dinput_find_pointer(struct dinput_input *di,
|
||||
int pointer_id)
|
||||
static struct pointer_status *dinput_find_pointer(
|
||||
struct dinput_input *di, int pointer_id)
|
||||
{
|
||||
struct pointer_status *check_pos = di->pointer_head.next;
|
||||
|
||||
@ -508,7 +512,7 @@ struct pointer_status *dinput_find_pointer(struct dinput_input *di,
|
||||
return check_pos;
|
||||
}
|
||||
|
||||
void dinput_clear_pointers(struct dinput_input *di)
|
||||
static void dinput_clear_pointers(struct dinput_input *di)
|
||||
{
|
||||
struct pointer_status *pointer = &di->pointer_head;
|
||||
|
||||
@ -599,15 +603,15 @@ bool dinput_handle_message(void *dinput, UINT message, WPARAM wParam, LPARAM lPa
|
||||
static void dinput_free(void *data)
|
||||
{
|
||||
struct dinput_input *di = (struct dinput_input*)data;
|
||||
LPDIRECTINPUT8 hold_ctx = g_ctx;
|
||||
LPDIRECTINPUT8 hold_ctx = g_dinput_ctx;
|
||||
|
||||
if (di)
|
||||
{
|
||||
/* Prevent a joypad driver to kill our context prematurely. */
|
||||
g_ctx = NULL;
|
||||
g_dinput_ctx = NULL;
|
||||
if (di->joypad)
|
||||
di->joypad->destroy();
|
||||
g_ctx = hold_ctx;
|
||||
g_dinput_ctx = hold_ctx;
|
||||
|
||||
/* Clear any leftover pointers. */
|
||||
dinput_clear_pointers(di);
|
||||
@ -685,392 +689,3 @@ input_driver_t input_dinput = {
|
||||
dinput_get_joypad_driver,
|
||||
};
|
||||
|
||||
/* Keep track of which pad indexes are 360 controllers.
|
||||
* Not static, will be read in xinput_joypad.c
|
||||
* -1 = not xbox pad, otherwise 0..3
|
||||
*/
|
||||
|
||||
int g_xinput_pad_indexes[MAX_USERS];
|
||||
bool g_xinput_block_pads;
|
||||
|
||||
static void dinput_joypad_destroy(void)
|
||||
{
|
||||
unsigned i;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
{
|
||||
if (g_pads[i].joypad)
|
||||
{
|
||||
IDirectInputDevice8_Unacquire(g_pads[i].joypad);
|
||||
IDirectInputDevice8_Release(g_pads[i].joypad);
|
||||
}
|
||||
|
||||
free(g_pads[i].joy_name);
|
||||
g_pads[i].joy_name = NULL;
|
||||
*settings->input.device_names[i] = '\0';
|
||||
}
|
||||
|
||||
g_joypad_cnt = 0;
|
||||
memset(g_pads, 0, sizeof(g_pads));
|
||||
|
||||
/* Can be blocked by global Dinput context. */
|
||||
dinput_destroy_context();
|
||||
}
|
||||
|
||||
static BOOL CALLBACK enum_axes_cb(
|
||||
const DIDEVICEOBJECTINSTANCE *inst, void *p)
|
||||
{
|
||||
DIPROPRANGE range;
|
||||
LPDIRECTINPUTDEVICE8 joypad = (LPDIRECTINPUTDEVICE8)p;
|
||||
|
||||
memset(&range, 0, sizeof(range));
|
||||
range.diph.dwSize = sizeof(DIPROPRANGE);
|
||||
range.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
||||
range.diph.dwHow = DIPH_BYID;
|
||||
range.diph.dwObj = inst->dwType;
|
||||
range.lMin = -0x7fff;
|
||||
range.lMax = 0x7fff;
|
||||
IDirectInputDevice8_SetProperty(joypad, DIPROP_RANGE, &range.diph);
|
||||
|
||||
return DIENUM_CONTINUE;
|
||||
}
|
||||
|
||||
static const GUID common_xinput_guids[] = {
|
||||
{MAKELONG(0x28DE, 0x11FF),0x0000,0x0000,{0x00,0x00,0x50,0x49,0x44,0x56,0x49,0x44}}, /* Valve streaming pad */
|
||||
{MAKELONG(0x045E, 0x02A1),0x0000,0x0000,{0x00,0x00,0x50,0x49,0x44,0x56,0x49,0x44}}, /* Wired 360 pad */
|
||||
{MAKELONG(0x045E, 0x028E),0x0000,0x0000,{0x00,0x00,0x50,0x49,0x44,0x56,0x49,0x44}} /* wireless 360 pad */
|
||||
};
|
||||
|
||||
/* Based on SDL2's implementation. */
|
||||
static bool guid_is_xinput_device(const GUID* product_guid)
|
||||
{
|
||||
unsigned i, num_raw_devs = 0;
|
||||
PRAWINPUTDEVICELIST raw_devs = NULL;
|
||||
|
||||
/* Check for well known XInput device GUIDs,
|
||||
* thereby removing the need for the IG_ check.
|
||||
* This lets us skip RAWINPUT for popular devices.
|
||||
*
|
||||
* Also, we need to do this for the Valve Streaming Gamepad
|
||||
* because it's virtualized and doesn't show up in the device list. */
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(common_xinput_guids); ++i)
|
||||
{
|
||||
if (memcmp(product_guid, &common_xinput_guids[i], sizeof(GUID)) == 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Go through RAWINPUT (WinXP and later) to find HID devices. */
|
||||
if (!raw_devs)
|
||||
{
|
||||
if ((GetRawInputDeviceList(NULL, &num_raw_devs,
|
||||
sizeof(RAWINPUTDEVICELIST)) == (UINT)-1) || (!num_raw_devs))
|
||||
return false;
|
||||
|
||||
raw_devs = (PRAWINPUTDEVICELIST)
|
||||
malloc(sizeof(RAWINPUTDEVICELIST) * num_raw_devs);
|
||||
if (!raw_devs)
|
||||
return false;
|
||||
|
||||
if (GetRawInputDeviceList(raw_devs, &num_raw_devs,
|
||||
sizeof(RAWINPUTDEVICELIST)) == (UINT)-1)
|
||||
{
|
||||
free(raw_devs);
|
||||
raw_devs = NULL;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < num_raw_devs; i++)
|
||||
{
|
||||
RID_DEVICE_INFO rdi;
|
||||
char devName[128];
|
||||
UINT rdiSize = sizeof(rdi);
|
||||
UINT nameSize = sizeof(devName);
|
||||
|
||||
rdi.cbSize = sizeof (rdi);
|
||||
|
||||
if ((raw_devs[i].dwType == RIM_TYPEHID) &&
|
||||
(GetRawInputDeviceInfoA(raw_devs[i].hDevice, RIDI_DEVICEINFO, &rdi, &rdiSize) != ((UINT)-1)) &&
|
||||
(MAKELONG(rdi.hid.dwVendorId, rdi.hid.dwProductId) == ((LONG)product_guid->Data1)) &&
|
||||
(GetRawInputDeviceInfoA(raw_devs[i].hDevice, RIDI_DEVICENAME, devName, &nameSize) != ((UINT)-1)) &&
|
||||
(strstr(devName, "IG_") != NULL) )
|
||||
{
|
||||
free(raw_devs);
|
||||
raw_devs = NULL;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
free(raw_devs);
|
||||
raw_devs = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Forward declaration */
|
||||
static const char *dinput_joypad_name(unsigned pad);
|
||||
|
||||
static unsigned g_last_xinput_pad_idx;
|
||||
|
||||
static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
|
||||
{
|
||||
bool is_xinput_pad;
|
||||
LPDIRECTINPUTDEVICE8 *pad = NULL;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)p;
|
||||
|
||||
if (g_joypad_cnt == MAX_USERS)
|
||||
return DIENUM_STOP;
|
||||
|
||||
pad = &g_pads[g_joypad_cnt].joypad;
|
||||
|
||||
#ifdef __cplusplus
|
||||
if (FAILED(IDirectInput8_CreateDevice(
|
||||
g_ctx, inst->guidInstance, pad, NULL)))
|
||||
#else
|
||||
if (FAILED(IDirectInput8_CreateDevice(
|
||||
g_ctx, &inst->guidInstance, pad, NULL)))
|
||||
#endif
|
||||
return DIENUM_CONTINUE;
|
||||
|
||||
g_pads[g_joypad_cnt].joy_name = strdup(inst->tszProductName);
|
||||
|
||||
#ifdef HAVE_XINPUT
|
||||
#if 0
|
||||
is_xinput_pad = g_xinput_block_pads
|
||||
&& name_is_xinput_pad(inst->tszProductName);
|
||||
#endif
|
||||
is_xinput_pad = g_xinput_block_pads
|
||||
&& guid_is_xinput_device(&inst->guidProduct);
|
||||
|
||||
if (is_xinput_pad)
|
||||
{
|
||||
if (g_last_xinput_pad_idx < 4)
|
||||
g_xinput_pad_indexes[g_joypad_cnt] = g_last_xinput_pad_idx++;
|
||||
goto enum_iteration_done;
|
||||
}
|
||||
#endif
|
||||
|
||||
IDirectInputDevice8_SetDataFormat(*pad, &c_dfDIJoystick2);
|
||||
IDirectInputDevice8_SetCooperativeLevel(*pad, (HWND)driver->video_window,
|
||||
DISCL_NONEXCLUSIVE | DISCL_BACKGROUND);
|
||||
|
||||
IDirectInputDevice8_EnumObjects(*pad, enum_axes_cb,
|
||||
*pad, DIDFT_ABSAXIS);
|
||||
|
||||
#ifdef HAVE_XINPUT
|
||||
if (!is_xinput_pad)
|
||||
#endif
|
||||
{
|
||||
autoconfig_params_t params = {{0}};
|
||||
|
||||
strlcpy(settings->input.device_names[g_joypad_cnt],
|
||||
dinput_joypad_name(g_joypad_cnt),
|
||||
sizeof(settings->input.device_names[g_joypad_cnt]));
|
||||
|
||||
/* TODO - implement VID/PID? */
|
||||
params.idx = g_joypad_cnt;
|
||||
strlcpy(params.name, dinput_joypad_name(g_joypad_cnt), sizeof(params.name));
|
||||
strlcpy(params.driver, dinput_joypad.ident, sizeof(params.driver));
|
||||
input_config_autoconfigure_joypad(¶ms);
|
||||
}
|
||||
|
||||
enum_iteration_done:
|
||||
g_joypad_cnt++;
|
||||
return DIENUM_CONTINUE;
|
||||
}
|
||||
|
||||
static bool dinput_joypad_init(void)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
if (!dinput_init_context())
|
||||
return false;
|
||||
|
||||
g_last_xinput_pad_idx = 0;
|
||||
|
||||
for (i = 0; i < MAX_USERS; ++i)
|
||||
{
|
||||
g_xinput_pad_indexes[i] = -1;
|
||||
g_pads[i].joy_name = NULL;
|
||||
}
|
||||
|
||||
RARCH_LOG("Enumerating DInput joypads ...\n");
|
||||
IDirectInput8_EnumDevices(g_ctx, DI8DEVCLASS_GAMECTRL,
|
||||
enum_joypad_cb, NULL, DIEDFL_ATTACHEDONLY);
|
||||
RARCH_LOG("Done enumerating DInput joypads ...\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool dinput_joypad_button(unsigned port_num, uint16_t joykey)
|
||||
{
|
||||
const struct dinput_joypad *pad = NULL;
|
||||
|
||||
if (joykey == NO_BTN)
|
||||
return false;
|
||||
|
||||
pad = &g_pads[port_num];
|
||||
if (!pad->joypad)
|
||||
return false;
|
||||
|
||||
/* Check hat. */
|
||||
if (GET_HAT_DIR(joykey))
|
||||
{
|
||||
unsigned pov;
|
||||
unsigned hat = GET_HAT(joykey);
|
||||
unsigned elems = sizeof(pad->joy_state.rgdwPOV) /
|
||||
sizeof(pad->joy_state.rgdwPOV[0]);
|
||||
|
||||
if (hat >= elems)
|
||||
return false;
|
||||
|
||||
pov = pad->joy_state.rgdwPOV[hat];
|
||||
|
||||
/* Magic numbers I'm not sure where originate from. */
|
||||
if (pov < 36000)
|
||||
{
|
||||
switch (GET_HAT_DIR(joykey))
|
||||
{
|
||||
case HAT_UP_MASK:
|
||||
return (pov >= 31500) || (pov <= 4500);
|
||||
case HAT_RIGHT_MASK:
|
||||
return (pov >= 4500) && (pov <= 13500);
|
||||
case HAT_DOWN_MASK:
|
||||
return (pov >= 13500) && (pov <= 22500);
|
||||
case HAT_LEFT_MASK:
|
||||
return (pov >= 22500) && (pov <= 31500);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned elems = sizeof(pad->joy_state.rgbButtons) /
|
||||
sizeof(pad->joy_state.rgbButtons[0]);
|
||||
|
||||
if (joykey < elems)
|
||||
return pad->joy_state.rgbButtons[joykey];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static int16_t dinput_joypad_axis(unsigned port_num, uint32_t joyaxis)
|
||||
{
|
||||
const struct dinput_joypad *pad = NULL;
|
||||
int val = 0;
|
||||
int axis = -1;
|
||||
bool is_neg = false;
|
||||
bool is_pos = false;
|
||||
|
||||
if (joyaxis == AXIS_NONE)
|
||||
return 0;
|
||||
|
||||
pad = &g_pads[port_num];
|
||||
if (!pad->joypad)
|
||||
return 0;
|
||||
|
||||
if (AXIS_NEG_GET(joyaxis) <= 5)
|
||||
{
|
||||
axis = AXIS_NEG_GET(joyaxis);
|
||||
is_neg = true;
|
||||
}
|
||||
else if (AXIS_POS_GET(joyaxis) <= 5)
|
||||
{
|
||||
axis = AXIS_POS_GET(joyaxis);
|
||||
is_pos = true;
|
||||
}
|
||||
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
val = pad->joy_state.lX;
|
||||
break;
|
||||
case 1:
|
||||
val = pad->joy_state.lY;
|
||||
break;
|
||||
case 2:
|
||||
val = pad->joy_state.lZ;
|
||||
break;
|
||||
case 3:
|
||||
val = pad->joy_state.lRx;
|
||||
break;
|
||||
case 4:
|
||||
val = pad->joy_state.lRy;
|
||||
break;
|
||||
case 5:
|
||||
val = pad->joy_state.lRz;
|
||||
break;
|
||||
}
|
||||
|
||||
if (is_neg && val > 0)
|
||||
val = 0;
|
||||
else if (is_pos && val < 0)
|
||||
val = 0;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
static void dinput_joypad_poll(void)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
{
|
||||
struct dinput_joypad *pad = &g_pads[i];
|
||||
bool polled = g_xinput_pad_indexes[i] < 0;
|
||||
|
||||
if (!pad || !pad->joypad || !polled)
|
||||
continue;
|
||||
|
||||
memset(&pad->joy_state, 0, sizeof(pad->joy_state));
|
||||
|
||||
if (FAILED(IDirectInputDevice8_Poll(pad->joypad)))
|
||||
{
|
||||
if (FAILED(IDirectInputDevice8_Acquire(pad->joypad)))
|
||||
{
|
||||
memset(&pad->joy_state, 0, sizeof(DIJOYSTATE2));
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If this fails, something *really* bad must have happened. */
|
||||
if (FAILED(IDirectInputDevice8_Poll(pad->joypad)))
|
||||
{
|
||||
memset(&pad->joy_state, 0, sizeof(DIJOYSTATE2));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
IDirectInputDevice8_GetDeviceState(pad->joypad,
|
||||
sizeof(DIJOYSTATE2), &pad->joy_state);
|
||||
}
|
||||
}
|
||||
|
||||
static bool dinput_joypad_query_pad(unsigned pad)
|
||||
{
|
||||
return pad < MAX_USERS && g_pads[pad].joypad;
|
||||
}
|
||||
|
||||
static const char *dinput_joypad_name(unsigned pad)
|
||||
{
|
||||
if (pad < MAX_USERS)
|
||||
return g_pads[pad].joy_name;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rarch_joypad_driver_t dinput_joypad = {
|
||||
dinput_joypad_init,
|
||||
dinput_joypad_query_pad,
|
||||
dinput_joypad_destroy,
|
||||
dinput_joypad_button,
|
||||
NULL,
|
||||
dinput_joypad_axis,
|
||||
dinput_joypad_poll,
|
||||
NULL,
|
||||
dinput_joypad_name,
|
||||
"dinput",
|
||||
};
|
||||
|
@ -99,10 +99,6 @@ static void adapter_thread(void *data)
|
||||
|
||||
libusb_interrupt_transfer(adapter->handle, adapter->endpoint_in, &adapter->data[1], adapter->endpoint_in_max_size, &size, 1000);
|
||||
|
||||
#if 0
|
||||
static unsigned count;
|
||||
fprintf(stderr, "[%s] Gets here, count: %d\n", adapter->name, count++);
|
||||
#endif
|
||||
if (adapter && hid && hid->slots && size)
|
||||
pad_connection_packet(&hid->slots[adapter->slot], adapter->slot,
|
||||
adapter->data, size+1);
|
||||
@ -272,10 +268,12 @@ static int add_adapter(void *data, struct libusb_device *dev)
|
||||
|
||||
if (!pad_connection_has_interface(hid->slots, adapter->slot))
|
||||
{
|
||||
//fprintf(stderr, " Interface not found (%s).\n", adapter->name);
|
||||
fprintf(stderr, " Interface not found (%s).\n", adapter->name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Interface found: [%s].\n", adapter->name);
|
||||
|
||||
if (libusb_kernel_driver_active(adapter->handle, 0) == 1
|
||||
&& libusb_detach_kernel_driver(adapter->handle, 0))
|
||||
{
|
||||
|
426
input/drivers_joypad/dinput_joypad.c
Normal file
426
input/drivers_joypad/dinput_joypad.c
Normal file
@ -0,0 +1,426 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2015 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <dinput.h>
|
||||
|
||||
#include "../../general.h"
|
||||
#include <boolean.h>
|
||||
#include "../input_autodetect.h"
|
||||
#include "../input_common.h"
|
||||
#include "../input_joypad.h"
|
||||
#include "../input_keymaps.h"
|
||||
#include "../../retroarch_logger.h"
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
struct dinput_joypad
|
||||
{
|
||||
LPDIRECTINPUTDEVICE8 joypad;
|
||||
DIJOYSTATE2 joy_state;
|
||||
char* joy_name;
|
||||
};
|
||||
|
||||
static struct dinput_joypad g_pads[MAX_USERS];
|
||||
static unsigned g_joypad_cnt;
|
||||
static unsigned g_last_xinput_pad_idx;
|
||||
|
||||
static const GUID common_xinput_guids[] = {
|
||||
{MAKELONG(0x28DE, 0x11FF),0x0000,0x0000,{0x00,0x00,0x50,0x49,0x44,0x56,0x49,0x44}}, /* Valve streaming pad */
|
||||
{MAKELONG(0x045E, 0x02A1),0x0000,0x0000,{0x00,0x00,0x50,0x49,0x44,0x56,0x49,0x44}}, /* Wired 360 pad */
|
||||
{MAKELONG(0x045E, 0x028E),0x0000,0x0000,{0x00,0x00,0x50,0x49,0x44,0x56,0x49,0x44}} /* wireless 360 pad */
|
||||
};
|
||||
|
||||
/* forward declarations */
|
||||
void dinput_destroy_context(void);
|
||||
bool dinput_init_context(void);
|
||||
|
||||
extern bool g_xinput_block_pads;
|
||||
extern int g_xinput_pad_indexes[MAX_USERS];
|
||||
extern LPDIRECTINPUT8 g_dinput_ctx;
|
||||
|
||||
static void dinput_joypad_destroy(void)
|
||||
{
|
||||
unsigned i;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
{
|
||||
if (g_pads[i].joypad)
|
||||
{
|
||||
IDirectInputDevice8_Unacquire(g_pads[i].joypad);
|
||||
IDirectInputDevice8_Release(g_pads[i].joypad);
|
||||
}
|
||||
|
||||
free(g_pads[i].joy_name);
|
||||
g_pads[i].joy_name = NULL;
|
||||
*settings->input.device_names[i] = '\0';
|
||||
}
|
||||
|
||||
g_joypad_cnt = 0;
|
||||
memset(g_pads, 0, sizeof(g_pads));
|
||||
|
||||
/* Can be blocked by global Dinput context. */
|
||||
dinput_destroy_context();
|
||||
}
|
||||
|
||||
static BOOL CALLBACK enum_axes_cb(const DIDEVICEOBJECTINSTANCE *inst, void *p)
|
||||
{
|
||||
DIPROPRANGE range;
|
||||
LPDIRECTINPUTDEVICE8 joypad = (LPDIRECTINPUTDEVICE8)p;
|
||||
|
||||
memset(&range, 0, sizeof(range));
|
||||
range.diph.dwSize = sizeof(DIPROPRANGE);
|
||||
range.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
||||
range.diph.dwHow = DIPH_BYID;
|
||||
range.diph.dwObj = inst->dwType;
|
||||
range.lMin = -0x7fff;
|
||||
range.lMax = 0x7fff;
|
||||
IDirectInputDevice8_SetProperty(joypad, DIPROP_RANGE, &range.diph);
|
||||
|
||||
return DIENUM_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
/* Based on SDL2's implementation. */
|
||||
static bool guid_is_xinput_device(const GUID* product_guid)
|
||||
{
|
||||
unsigned i, num_raw_devs = 0;
|
||||
PRAWINPUTDEVICELIST raw_devs = NULL;
|
||||
|
||||
/* Check for well known XInput device GUIDs,
|
||||
* thereby removing the need for the IG_ check.
|
||||
* This lets us skip RAWINPUT for popular devices.
|
||||
*
|
||||
* Also, we need to do this for the Valve Streaming Gamepad
|
||||
* because it's virtualized and doesn't show up in the device list. */
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(common_xinput_guids); ++i)
|
||||
{
|
||||
if (memcmp(product_guid, &common_xinput_guids[i], sizeof(GUID)) == 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Go through RAWINPUT (WinXP and later) to find HID devices. */
|
||||
if (!raw_devs)
|
||||
{
|
||||
if ((GetRawInputDeviceList(NULL, &num_raw_devs,
|
||||
sizeof(RAWINPUTDEVICELIST)) == (UINT)-1) || (!num_raw_devs))
|
||||
return false;
|
||||
|
||||
raw_devs = (PRAWINPUTDEVICELIST)
|
||||
malloc(sizeof(RAWINPUTDEVICELIST) * num_raw_devs);
|
||||
if (!raw_devs)
|
||||
return false;
|
||||
|
||||
if (GetRawInputDeviceList(raw_devs, &num_raw_devs,
|
||||
sizeof(RAWINPUTDEVICELIST)) == (UINT)-1)
|
||||
{
|
||||
free(raw_devs);
|
||||
raw_devs = NULL;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < num_raw_devs; i++)
|
||||
{
|
||||
RID_DEVICE_INFO rdi;
|
||||
char devName[128];
|
||||
UINT rdiSize = sizeof(rdi);
|
||||
UINT nameSize = sizeof(devName);
|
||||
|
||||
rdi.cbSize = sizeof (rdi);
|
||||
|
||||
if ((raw_devs[i].dwType == RIM_TYPEHID) &&
|
||||
(GetRawInputDeviceInfoA(raw_devs[i].hDevice, RIDI_DEVICEINFO, &rdi, &rdiSize) != ((UINT)-1)) &&
|
||||
(MAKELONG(rdi.hid.dwVendorId, rdi.hid.dwProductId) == ((LONG)product_guid->Data1)) &&
|
||||
(GetRawInputDeviceInfoA(raw_devs[i].hDevice, RIDI_DEVICENAME, devName, &nameSize) != ((UINT)-1)) &&
|
||||
(strstr(devName, "IG_") != NULL) )
|
||||
{
|
||||
free(raw_devs);
|
||||
raw_devs = NULL;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
free(raw_devs);
|
||||
raw_devs = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
static const char *dinput_joypad_name(unsigned pad)
|
||||
{
|
||||
if (pad < MAX_USERS)
|
||||
return g_pads[pad].joy_name;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
|
||||
{
|
||||
bool is_xinput_pad;
|
||||
LPDIRECTINPUTDEVICE8 *pad = NULL;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)p;
|
||||
|
||||
if (g_joypad_cnt == MAX_USERS)
|
||||
return DIENUM_STOP;
|
||||
|
||||
pad = &g_pads[g_joypad_cnt].joypad;
|
||||
|
||||
#ifdef __cplusplus
|
||||
if (FAILED(IDirectInput8_CreateDevice(
|
||||
g_dinput_ctx, inst->guidInstance, pad, NULL)))
|
||||
#else
|
||||
if (FAILED(IDirectInput8_CreateDevice(
|
||||
g_dinput_ctx, &inst->guidInstance, pad, NULL)))
|
||||
#endif
|
||||
return DIENUM_CONTINUE;
|
||||
|
||||
g_pads[g_joypad_cnt].joy_name = strdup(inst->tszProductName);
|
||||
|
||||
#ifdef HAVE_XINPUT
|
||||
#if 0
|
||||
is_xinput_pad = g_xinput_block_pads
|
||||
&& name_is_xinput_pad(inst->tszProductName);
|
||||
#endif
|
||||
is_xinput_pad = g_xinput_block_pads
|
||||
&& guid_is_xinput_device(&inst->guidProduct);
|
||||
|
||||
if (is_xinput_pad)
|
||||
{
|
||||
if (g_last_xinput_pad_idx < 4)
|
||||
g_xinput_pad_indexes[g_joypad_cnt] = g_last_xinput_pad_idx++;
|
||||
goto enum_iteration_done;
|
||||
}
|
||||
#endif
|
||||
|
||||
IDirectInputDevice8_SetDataFormat(*pad, &c_dfDIJoystick2);
|
||||
IDirectInputDevice8_SetCooperativeLevel(*pad, (HWND)driver->video_window,
|
||||
DISCL_NONEXCLUSIVE | DISCL_BACKGROUND);
|
||||
|
||||
IDirectInputDevice8_EnumObjects(*pad, enum_axes_cb,
|
||||
*pad, DIDFT_ABSAXIS);
|
||||
|
||||
#ifdef HAVE_XINPUT
|
||||
if (!is_xinput_pad)
|
||||
#endif
|
||||
{
|
||||
autoconfig_params_t params = {{0}};
|
||||
|
||||
strlcpy(settings->input.device_names[g_joypad_cnt],
|
||||
dinput_joypad_name(g_joypad_cnt),
|
||||
sizeof(settings->input.device_names[g_joypad_cnt]));
|
||||
|
||||
/* TODO - implement VID/PID? */
|
||||
params.idx = g_joypad_cnt;
|
||||
strlcpy(params.name, dinput_joypad_name(g_joypad_cnt), sizeof(params.name));
|
||||
strlcpy(params.driver, dinput_joypad.ident, sizeof(params.driver));
|
||||
input_config_autoconfigure_joypad(¶ms);
|
||||
}
|
||||
|
||||
enum_iteration_done:
|
||||
g_joypad_cnt++;
|
||||
return DIENUM_CONTINUE;
|
||||
}
|
||||
|
||||
static bool dinput_joypad_init(void)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
if (!dinput_init_context())
|
||||
return false;
|
||||
|
||||
g_last_xinput_pad_idx = 0;
|
||||
|
||||
for (i = 0; i < MAX_USERS; ++i)
|
||||
{
|
||||
g_xinput_pad_indexes[i] = -1;
|
||||
g_pads[i].joy_name = NULL;
|
||||
}
|
||||
|
||||
RARCH_LOG("Enumerating DInput joypads ...\n");
|
||||
IDirectInput8_EnumDevices(g_dinput_ctx, DI8DEVCLASS_GAMECTRL,
|
||||
enum_joypad_cb, NULL, DIEDFL_ATTACHEDONLY);
|
||||
RARCH_LOG("Done enumerating DInput joypads ...\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool dinput_joypad_button(unsigned port_num, uint16_t joykey)
|
||||
{
|
||||
const struct dinput_joypad *pad = NULL;
|
||||
|
||||
if (joykey == NO_BTN)
|
||||
return false;
|
||||
|
||||
pad = &g_pads[port_num];
|
||||
if (!pad->joypad)
|
||||
return false;
|
||||
|
||||
/* Check hat. */
|
||||
if (GET_HAT_DIR(joykey))
|
||||
{
|
||||
unsigned pov;
|
||||
unsigned hat = GET_HAT(joykey);
|
||||
unsigned elems = sizeof(pad->joy_state.rgdwPOV) /
|
||||
sizeof(pad->joy_state.rgdwPOV[0]);
|
||||
|
||||
if (hat >= elems)
|
||||
return false;
|
||||
|
||||
pov = pad->joy_state.rgdwPOV[hat];
|
||||
|
||||
/* Magic numbers I'm not sure where originate from. */
|
||||
if (pov < 36000)
|
||||
{
|
||||
switch (GET_HAT_DIR(joykey))
|
||||
{
|
||||
case HAT_UP_MASK:
|
||||
return (pov >= 31500) || (pov <= 4500);
|
||||
case HAT_RIGHT_MASK:
|
||||
return (pov >= 4500) && (pov <= 13500);
|
||||
case HAT_DOWN_MASK:
|
||||
return (pov >= 13500) && (pov <= 22500);
|
||||
case HAT_LEFT_MASK:
|
||||
return (pov >= 22500) && (pov <= 31500);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned elems = sizeof(pad->joy_state.rgbButtons) /
|
||||
sizeof(pad->joy_state.rgbButtons[0]);
|
||||
|
||||
if (joykey < elems)
|
||||
return pad->joy_state.rgbButtons[joykey];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static int16_t dinput_joypad_axis(unsigned port_num, uint32_t joyaxis)
|
||||
{
|
||||
const struct dinput_joypad *pad = NULL;
|
||||
int val = 0;
|
||||
int axis = -1;
|
||||
bool is_neg = false;
|
||||
bool is_pos = false;
|
||||
|
||||
if (joyaxis == AXIS_NONE)
|
||||
return 0;
|
||||
|
||||
pad = &g_pads[port_num];
|
||||
if (!pad->joypad)
|
||||
return 0;
|
||||
|
||||
if (AXIS_NEG_GET(joyaxis) <= 5)
|
||||
{
|
||||
axis = AXIS_NEG_GET(joyaxis);
|
||||
is_neg = true;
|
||||
}
|
||||
else if (AXIS_POS_GET(joyaxis) <= 5)
|
||||
{
|
||||
axis = AXIS_POS_GET(joyaxis);
|
||||
is_pos = true;
|
||||
}
|
||||
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
val = pad->joy_state.lX;
|
||||
break;
|
||||
case 1:
|
||||
val = pad->joy_state.lY;
|
||||
break;
|
||||
case 2:
|
||||
val = pad->joy_state.lZ;
|
||||
break;
|
||||
case 3:
|
||||
val = pad->joy_state.lRx;
|
||||
break;
|
||||
case 4:
|
||||
val = pad->joy_state.lRy;
|
||||
break;
|
||||
case 5:
|
||||
val = pad->joy_state.lRz;
|
||||
break;
|
||||
}
|
||||
|
||||
if (is_neg && val > 0)
|
||||
val = 0;
|
||||
else if (is_pos && val < 0)
|
||||
val = 0;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
static void dinput_joypad_poll(void)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
{
|
||||
struct dinput_joypad *pad = &g_pads[i];
|
||||
bool polled = g_xinput_pad_indexes[i] < 0;
|
||||
|
||||
if (!pad || !pad->joypad || !polled)
|
||||
continue;
|
||||
|
||||
memset(&pad->joy_state, 0, sizeof(pad->joy_state));
|
||||
|
||||
if (FAILED(IDirectInputDevice8_Poll(pad->joypad)))
|
||||
{
|
||||
if (FAILED(IDirectInputDevice8_Acquire(pad->joypad)))
|
||||
{
|
||||
memset(&pad->joy_state, 0, sizeof(DIJOYSTATE2));
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If this fails, something *really* bad must have happened. */
|
||||
if (FAILED(IDirectInputDevice8_Poll(pad->joypad)))
|
||||
{
|
||||
memset(&pad->joy_state, 0, sizeof(DIJOYSTATE2));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
IDirectInputDevice8_GetDeviceState(pad->joypad,
|
||||
sizeof(DIJOYSTATE2), &pad->joy_state);
|
||||
}
|
||||
}
|
||||
|
||||
static bool dinput_joypad_query_pad(unsigned pad)
|
||||
{
|
||||
return pad < MAX_USERS && g_pads[pad].joypad;
|
||||
}
|
||||
|
||||
|
||||
rarch_joypad_driver_t dinput_joypad = {
|
||||
dinput_joypad_init,
|
||||
dinput_joypad_query_pad,
|
||||
dinput_joypad_destroy,
|
||||
dinput_joypad_button,
|
||||
NULL,
|
||||
dinput_joypad_axis,
|
||||
dinput_joypad_poll,
|
||||
NULL,
|
||||
dinput_joypad_name,
|
||||
"dinput",
|
||||
};
|
@ -21,7 +21,6 @@
|
||||
#include "../dynamic.h"
|
||||
#include "../frontend/frontend.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../runloop.h"
|
||||
#include "../../performance.h"
|
||||
#include <file/file_path.h>
|
||||
|
||||
|
@ -213,7 +213,7 @@ if [ "$HAVE_SDL2" = 'yes' ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
check_lib LIBUSB -lusb
|
||||
check_lib LIBUSB -lusb-1.0
|
||||
|
||||
if [ "$OS" = 'Win32' ]; then
|
||||
check_lib DINPUT -ldinput8
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#if defined(HAVE_DINPUT)
|
||||
#include "../input/drivers/dinput.c"
|
||||
#include "../input/drivers_joypad/dinput_joypad.c"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_XINPUT)
|
||||
|
Loading…
x
Reference in New Issue
Block a user