mirror of
https://github.com/libretro/RetroArch
synced 2025-02-19 21:40:49 +00:00
more small style tweaks
This commit is contained in:
parent
ef8a86e794
commit
333ae68163
@ -64,7 +64,7 @@ HAVE_THREADS = 1
|
||||
HAVE_RGUI = 1
|
||||
DYNAMIC = 1
|
||||
|
||||
USE_WINXINPUT = 1
|
||||
HAVE_WINXINPUT = 1
|
||||
|
||||
ifeq ($(SLIM),)
|
||||
HAVE_SDL = 1
|
||||
@ -215,8 +215,8 @@ ifeq ($(HAVE_PYTHON), 1)
|
||||
OBJ += gfx/py_state/py_state.o
|
||||
endif
|
||||
|
||||
ifeq ($(USE_WINXINPUT), 1)
|
||||
DEFINES += -DUSE_WINXINPUT
|
||||
ifeq ($(HAVE_WINXINPUT), 1)
|
||||
DEFINES += -DHAVE_WINXINPUT
|
||||
OBJ += input/winxinput_joypad.o
|
||||
endif
|
||||
|
||||
|
@ -41,10 +41,8 @@ static const frontend_ctx_driver_t *frontend_ctx_drivers[] = {
|
||||
|
||||
const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident)
|
||||
{
|
||||
for (unsigned i = 0; i < sizeof(frontend_ctx_drivers) / sizeof(frontend_ctx_drivers[0]); i++)
|
||||
for (unsigned i = 0; frontend_ctx_drivers[i]; i++)
|
||||
{
|
||||
if (!frontend_ctx_drivers[i]) // check for dummy NULL
|
||||
continue;
|
||||
if (strcmp(frontend_ctx_drivers[i]->ident, ident) == 0)
|
||||
return frontend_ctx_drivers[i];
|
||||
}
|
||||
@ -54,7 +52,7 @@ const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident)
|
||||
|
||||
const frontend_ctx_driver_t *frontend_ctx_init_first(void)
|
||||
{
|
||||
for (unsigned i = 0; i < sizeof(frontend_ctx_drivers) / sizeof(frontend_ctx_drivers[0]); i++)
|
||||
for (unsigned i = 0; frontend_ctx_drivers[i]; i++)
|
||||
return frontend_ctx_drivers[i];
|
||||
|
||||
return NULL;
|
||||
|
@ -68,12 +68,6 @@ static bool dinput_init_context(void)
|
||||
if (g_ctx)
|
||||
return true;
|
||||
|
||||
/*if (driver.display_type != RARCH_DISPLAY_WIN32)
|
||||
{
|
||||
RARCH_ERR("Cannot open DInput as no Win32 window is present.\n");
|
||||
return false;
|
||||
}*/ // Not needed, interferes with joyconfig
|
||||
|
||||
CoInitialize(NULL);
|
||||
|
||||
// Who said we shouldn't have same call signature in a COM API? <_<
|
||||
@ -431,7 +425,7 @@ static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
|
||||
#endif
|
||||
return DIENUM_CONTINUE;
|
||||
|
||||
#ifdef USE_WINXINPUT
|
||||
#ifdef HAVE_WINXINPUT
|
||||
int last_xbox_pad_index = 0;
|
||||
|
||||
if (name_is_360_pad(inst->tszProductName))
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
static const rarch_joypad_driver_t *joypad_drivers[] = {
|
||||
#ifndef IS_RETROLAUNCH
|
||||
#ifdef USE_WINXINPUT
|
||||
#ifdef HAVE_WINXINPUT
|
||||
&winxinput_joypad,
|
||||
#endif
|
||||
#ifdef HAVE_DINPUT
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2013 - Hans-Kristian Arntzen
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
@ -33,37 +32,37 @@
|
||||
// Official and mingw xinput headers have different include guards
|
||||
#if ((!_XINPUT_H_) && (!__WINE_XINPUT_H))
|
||||
|
||||
#define XINPUT_GAMEPAD_DPAD_UP 0x0001
|
||||
#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002
|
||||
#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004
|
||||
#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
|
||||
#define XINPUT_GAMEPAD_START 0x0010
|
||||
#define XINPUT_GAMEPAD_BACK 0x0020
|
||||
#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040
|
||||
#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
|
||||
#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100
|
||||
#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200
|
||||
#define XINPUT_GAMEPAD_A 0x1000
|
||||
#define XINPUT_GAMEPAD_B 0x2000
|
||||
#define XINPUT_GAMEPAD_X 0x4000
|
||||
#define XINPUT_GAMEPAD_Y 0x8000
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t wButtons;
|
||||
uint8_t bLeftTrigger;
|
||||
uint8_t bRightTrigger;
|
||||
int16_t sThumbLX;
|
||||
int16_t sThumbLY;
|
||||
int16_t sThumbRX;
|
||||
int16_t sThumbRY;
|
||||
} XINPUT_GAMEPAD;
|
||||
#define XINPUT_GAMEPAD_DPAD_UP 0x0001
|
||||
#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002
|
||||
#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004
|
||||
#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
|
||||
#define XINPUT_GAMEPAD_START 0x0010
|
||||
#define XINPUT_GAMEPAD_BACK 0x0020
|
||||
#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040
|
||||
#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
|
||||
#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100
|
||||
#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200
|
||||
#define XINPUT_GAMEPAD_A 0x1000
|
||||
#define XINPUT_GAMEPAD_B 0x2000
|
||||
#define XINPUT_GAMEPAD_X 0x4000
|
||||
#define XINPUT_GAMEPAD_Y 0x8000
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t dwPacketNumber;
|
||||
XINPUT_GAMEPAD Gamepad;
|
||||
} XINPUT_STATE;
|
||||
typedef struct
|
||||
{
|
||||
uint16_t wButtons;
|
||||
uint8_t bLeftTrigger;
|
||||
uint8_t bRightTrigger;
|
||||
int16_t sThumbLX;
|
||||
int16_t sThumbLY;
|
||||
int16_t sThumbRX;
|
||||
int16_t sThumbRY;
|
||||
} XINPUT_GAMEPAD;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t dwPacketNumber;
|
||||
XINPUT_GAMEPAD Gamepad;
|
||||
} XINPUT_STATE;
|
||||
|
||||
#endif
|
||||
|
||||
@ -71,11 +70,11 @@
|
||||
#define XINPUT_GAMEPAD_GUIDE 0x0400
|
||||
|
||||
#ifndef ERROR_DEVICE_NOT_CONNECTED
|
||||
#define ERROR_DEVICE_NOT_CONNECTED 1167
|
||||
#define ERROR_DEVICE_NOT_CONNECTED 1167
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DINPUT
|
||||
#error Cannot compile xinput without dinput.
|
||||
#error Cannot compile xinput without dinput.
|
||||
#endif
|
||||
|
||||
// Due to 360 pads showing up under both XI and DI, and since we are going
|
||||
@ -120,20 +119,20 @@ static bool winxinput_joypad_init(void)
|
||||
|
||||
// No need to check for existance as we will be checking LoadLibrary's
|
||||
// success anyway.
|
||||
char dll_path[MAX_PATH];
|
||||
strcpy(dll_path, "xinput1_3.dll");
|
||||
g_winxinput_dll = LoadLibrary(dll_path);
|
||||
const char* DLL_NAME = "xinput1_3.dll";
|
||||
g_winxinput_dll = LoadLibrary(DLL_NAME); // Using dylib_* complicates building joyconfig.
|
||||
if (!g_winxinput_dll)
|
||||
{
|
||||
// Loading from working dir failed, try to load from system.
|
||||
char dll_path[MAX_PATH];
|
||||
GetSystemDirectory(dll_path, sizeof(dll_path));
|
||||
strcat(dll_path, "\\xinput1_3.dll");
|
||||
strlcat(dll_path, "\\", 1);
|
||||
strlcat(dll_path, DLL_NAME, sizeof(DLL_NAME));
|
||||
g_winxinput_dll = LoadLibrary(dll_path);
|
||||
|
||||
if (!g_winxinput_dll)
|
||||
{
|
||||
RARCH_ERR("Failed to init XInput, ensure DirectX and controller drivers are up to date.\n");
|
||||
//g_dinput_should_filter_xinput_controllers = false;
|
||||
RARCH_ERR("Failed to load xinput1_3.dll, ensure DirectX and controller drivers are up to date.\n");
|
||||
return false; // DLL does not exist or is invalid
|
||||
}
|
||||
|
||||
@ -152,8 +151,7 @@ static bool winxinput_joypad_init(void)
|
||||
g_XInputGetStateEx = (XInputGetStateEx_t) GetProcAddress(g_winxinput_dll, "XInputGetState");
|
||||
if (!g_XInputGetStateEx)
|
||||
{
|
||||
RARCH_ERR("Failed to init XInput: Found an XInput DLL but it is invalid or corrupt.\n");
|
||||
//g_dinput_should_filter_xinput_controllers = false;
|
||||
RARCH_ERR("Failed to init XInput: xinput1_3.dll is invalid or corrupt.\n");
|
||||
return false; // DLL was loaded but did not contain the correct function.
|
||||
}
|
||||
RARCH_WARN("XInput: No guide button support.\n");
|
||||
@ -173,12 +171,11 @@ static bool winxinput_joypad_init(void)
|
||||
}
|
||||
|
||||
if ((!g_winxinput_states[0].connected) &&
|
||||
(!g_winxinput_states[1].connected) &&
|
||||
(!g_winxinput_states[2].connected) &&
|
||||
(!g_winxinput_states[3].connected))
|
||||
return false;
|
||||
(!g_winxinput_states[1].connected) &&
|
||||
(!g_winxinput_states[2].connected) &&
|
||||
(!g_winxinput_states[3].connected))
|
||||
return false;
|
||||
|
||||
|
||||
// We're going to have to be buddies with dinput if we want to be able
|
||||
// to use XI and non-XI controllers together.
|
||||
return dinput_joypad.init();
|
||||
@ -209,16 +206,16 @@ static void winxinput_joypad_destroy(void)
|
||||
// Map from rarch button index (0..10) to a mask to bitwise-& the buttons against.
|
||||
// dpad is handled seperately.
|
||||
static const uint16_t button_index_to_bitmap_code[] = {
|
||||
XINPUT_GAMEPAD_A ,
|
||||
XINPUT_GAMEPAD_B ,
|
||||
XINPUT_GAMEPAD_X ,
|
||||
XINPUT_GAMEPAD_Y ,
|
||||
XINPUT_GAMEPAD_LEFT_SHOULDER ,
|
||||
XINPUT_GAMEPAD_A,
|
||||
XINPUT_GAMEPAD_B,
|
||||
XINPUT_GAMEPAD_X,
|
||||
XINPUT_GAMEPAD_Y,
|
||||
XINPUT_GAMEPAD_LEFT_SHOULDER,
|
||||
XINPUT_GAMEPAD_RIGHT_SHOULDER,
|
||||
XINPUT_GAMEPAD_START ,
|
||||
XINPUT_GAMEPAD_BACK ,
|
||||
XINPUT_GAMEPAD_LEFT_THUMB ,
|
||||
XINPUT_GAMEPAD_RIGHT_THUMB ,
|
||||
XINPUT_GAMEPAD_START,
|
||||
XINPUT_GAMEPAD_BACK,
|
||||
XINPUT_GAMEPAD_LEFT_THUMB,
|
||||
XINPUT_GAMEPAD_RIGHT_THUMB,
|
||||
XINPUT_GAMEPAD_GUIDE
|
||||
};
|
||||
|
||||
|
@ -88,7 +88,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;HAVE_WIN32_D3D9;HAVE_CG;HAVE_GLSL;HAVE_FBO;HAVE_ZLIB;WANT_MINIZ;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_SCREENSHOTS;HAVE_BSV_MOVIE;HAVE_DINPUT;USE_WINXINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETPLAY;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;HAVE_WIN32_D3D9;HAVE_CG;HAVE_GLSL;HAVE_FBO;HAVE_ZLIB;WANT_MINIZ;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_SCREENSHOTS;HAVE_BSV_MOVIE;HAVE_DINPUT;HAVE_WINXINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETPLAY;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\;$(CG_INC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
@ -108,7 +108,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;HAVE_WIN32_D3D9;HAVE_CG;HAVE_GLSL;HAVE_FBO;HAVE_ZLIB;WANT_MINIZ;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_SCREENSHOTS;HAVE_BSV_MOVIE;HAVE_DINPUT;USE_WINXINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETPLAY;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;HAVE_WIN32_D3D9;HAVE_CG;HAVE_GLSL;HAVE_FBO;HAVE_ZLIB;WANT_MINIZ;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_SCREENSHOTS;HAVE_BSV_MOVIE;HAVE_DINPUT;HAVE_WINXINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETPLAY;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\;$(CG_INC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
@ -130,7 +130,7 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;HAVE_WIN32_D3D9;HAVE_CG;HAVE_GLSL;HAVE_FBO;HAVE_ZLIB;WANT_MINIZ;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_SCREENSHOTS;HAVE_BSV_MOVIE;HAVE_DINPUT;USE_WINXINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETPLAY;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;HAVE_WIN32_D3D9;HAVE_CG;HAVE_GLSL;HAVE_FBO;HAVE_ZLIB;WANT_MINIZ;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_SCREENSHOTS;HAVE_BSV_MOVIE;HAVE_DINPUT;HAVE_WINXINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETPLAY;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\;$(CG_INC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
@ -154,7 +154,7 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;HAVE_WIN32_D3D9;HAVE_CG;HAVE_GLSL;HAVE_FBO;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_SCREENSHOTS;HAVE_BSV_MOVIE;HAVE_DINPUT;USE_WINXINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETPLAY;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;HAVE_ZLIB;WANT_MINIZ;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;HAVE_WIN32_D3D9;HAVE_CG;HAVE_GLSL;HAVE_FBO;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_SCREENSHOTS;HAVE_BSV_MOVIE;HAVE_DINPUT;HAVE_WINXINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETPLAY;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;HAVE_ZLIB;WANT_MINIZ;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\;$(CG_INC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
|
Loading…
x
Reference in New Issue
Block a user