Просмотр исходного кода

build: split the D3d9 build flags into D3d9 and Xinput for situations where

we want Xinput but not D3D (ie. OpenGL).
legacy
Sam Hocevar sam 12 лет назад
Родитель
Сommit
0f14383241
5 измененных файлов: 28 добавлений и 14 удалений
  1. +4
    -3
      build/vs2010/Lol.Core.Rules.props
  2. +12
    -2
      build/vs2010/Lol.Core.Vars.props
  3. +5
    -5
      src/platform/d3d9/d3d9input.cpp
  4. +2
    -2
      src/platform/sdl/sdlapp.cpp
  5. +5
    -2
      src/platform/sdl/sdlinput.cpp

+ 4
- 3
build/vs2010/Lol.Core.Rules.props Просмотреть файл

@@ -10,8 +10,8 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<FloatingPointModel>Fast</FloatingPointModel>
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\src;$(SolutionDir)\..\..\src\bullet;$(FlexIncludes);$(BtPhysIncludes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Platform)'=='Win32'">$(GlIncludes);$(SdlIncludes);$(D3d9Includes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Platform)'=='x64'">$(GlIncludes);$(SdlIncludes);$(D3d9Includes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Platform)'=='Win32'">$(GlIncludes);$(SdlIncludes);$(D3d9Includes);$(XinputIncludes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Platform)'=='x64'">$(GlIncludes);$(SdlIncludes);$(D3d9Includes);$(XinputIncludes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NOMINMAX;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='Win32'">WIN32;$(Win32Defines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='x64'">WIN32;$(Win32Defines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -43,13 +43,14 @@

<Link>
<!-- FIXME: not for the static library! -->
<AdditionalDependencies Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;$(SdlDeps);$(GdiDeps);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;$(SdlDeps);$(GdiDeps);$(XinputDeps);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies Condition="'$(UseOpenGL)'=='true' And ('$(Platform)'=='Win32' Or '$(Platform)'=='x64')">$(GlDeps);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies Condition="'$(UseOpenGL)'=='false' And ('$(Platform)'=='Win32' Or '$(Platform)'=='x64')">$(D3d9Deps);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">$(SdlLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">$(GlLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">$(D3d9Libs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">$(XinputLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Debug|Xbox 360'">xapilibd.lib;d3d9d.lib;d3dx9d.lib;xgraphicsd.lib;xboxkrnl.lib;xnetd.lib;xaudiod2.lib;xactd3.lib;x3daudiod.lib;xmcored.lib;xbdm.lib;vcompd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|Xbox 360'">xapilib.lib;d3d9.lib;d3dx9.lib;xgraphics.lib;xboxkrnl.lib;xnet.lib;xaudio2.lib;xact3.lib;x3daudio.lib;xmcore.lib;vcomp.lib;%(AdditionalDependencies)</AdditionalDependencies>


+ 12
- 2
build/vs2010/Lol.Core.Vars.props Просмотреть файл

@@ -61,10 +61,17 @@
<D3d9Includes>$(DXSDK_DIR)\Include</D3d9Includes>
<D3d9Libs Condition="'$(Platform)'=='Win32'">$(DXSDK_DIR)\Lib\x86</D3d9Libs>
<D3d9Libs Condition="'$(Platform)'=='x64'">$(DXSDK_DIR)\Lib\x64</D3d9Libs>
<D3d9Deps Condition="'$(Configuration)'=='Release'">d3d9.lib;d3dx9.lib;xinput.lib</D3d9Deps>
<D3d9Deps Condition="'$(Configuration)'=='Debug'">d3d9.lib;d3dx9d.lib;xinput.lib</D3d9Deps>
<D3d9Deps Condition="'$(Configuration)'=='Release'">d3d9.lib;d3dx9.lib</D3d9Deps>
<D3d9Deps Condition="'$(Configuration)'=='Debug'">d3d9.lib;d3dx9d.lib</D3d9Deps>
<Win32Defines Condition="'$(UseOpenGL)'=='false'">USE_D3D9;$(Win32Defines)</Win32Defines>

<!-- Xinput -->
<XinputIncludes>$(DXSDK_DIR)\Include</XinputIncludes>
<XinputLibs Condition="'$(Platform)'=='Win32'">$(DXSDK_DIR)\Lib\x86</XinputLibs>
<XinputLibs Condition="'$(Platform)'=='x64'">$(DXSDK_DIR)\Lib\x64</XinputLibs>
<XinputDeps>xinput.lib</XinputDeps>
<Win32Defines>USE_XINPUT;$(Win32Defines)</Win32Defines>

<!-- PS3-specific -->
<Ps3Deps>libsysmodule_stub.a;libsysutil_stub.a;libresc_stub.a;
libpngdec_stub.a;
@@ -104,6 +111,9 @@
<BuildMacro Include="D3d9Includes"><Value>$(D3d9Includes)</Value></BuildMacro>
<BuildMacro Include="D3d9Libs"><Value>$(D3d9Libs)</Value></BuildMacro>
<BuildMacro Include="D3d9Deps"><Value>$(D3d9Deps)</Value></BuildMacro>
<BuildMacro Include="XinputIncludes"><Value>$(XinputIncludes)</Value></BuildMacro>
<BuildMacro Include="XinputLibs"><Value>$(XinputLibs)</Value></BuildMacro>
<BuildMacro Include="XinputDeps"><Value>$(XinputDeps)</Value></BuildMacro>
<BuildMacro Include="Win32Defines"><Value>$(Win32Defines)</Value></BuildMacro>
<BuildMacro Include="XboxDefines"><Value>$(XboxDefines)</Value></BuildMacro>
<BuildMacro Include="Ps3Deps"><Value>$(Ps3Deps)</Value></BuildMacro>


+ 5
- 5
src/platform/d3d9/d3d9input.cpp Просмотреть файл

@@ -12,7 +12,7 @@
# include "config.h"
#endif

#if defined USE_D3D9
#if defined USE_XINPUT
# include <d3d9.h>
# include <xinput.h>
#endif
@@ -32,7 +32,7 @@ class D3d9InputData
friend class D3d9Input;

private:
#if defined USE_D3D9
#if defined USE_XINPUT
Array<int, Stick *> m_joysticks;
#endif
};
@@ -44,7 +44,7 @@ private:
D3d9Input::D3d9Input()
: m_data(new D3d9InputData())
{
#if defined USE_D3D9
#if defined USE_XINPUT
for (int i = 0; i < XUSER_MAX_COUNT; i++)
{
XINPUT_STATE state;
@@ -63,7 +63,7 @@ D3d9Input::D3d9Input()

D3d9Input::~D3d9Input()
{
#if defined USE_D3D9
#if defined USE_XINPUT
/* Unregister all the joysticks we added */
while (m_data->m_joysticks.Count())
{
@@ -83,7 +83,7 @@ void D3d9Input::TickDraw(float seconds)
{
Entity::TickDraw(seconds);

#if defined USE_D3D9
#if defined USE_XINPUT
for (int i = 0; i < m_data->m_joysticks.Count(); i++)
{
XINPUT_STATE state;


+ 2
- 2
src/platform/sdl/sdlapp.cpp Просмотреть файл

@@ -28,7 +28,7 @@
#include "lolgl.h"
#include "platform/sdl/sdlapp.h"
#include "platform/sdl/sdlinput.h"
#if defined USE_D3D9
#if defined USE_XINPUT
# include "platform/d3d9/d3d9input.h"
#endif

@@ -93,7 +93,7 @@ SdlApp::SdlApp(char const *title, ivec2 res, float fps) :
Audio::Setup(2);

/* Autoreleased objects */
# if defined USE_D3D9
# if defined USE_XINPUT
/* Prefer D3d9 for joysticks on Windows, because the X360 pads are not
* advertised with the proper number of axes. */
new D3d9Input();


+ 5
- 2
src/platform/sdl/sdlinput.cpp Просмотреть файл

@@ -69,10 +69,13 @@ SdlInput::SdlInput()
{
SDL_Joystick *sdlstick = SDL_JoystickOpen(i);

/* Blacklist HDAPS, it's not a real joystick */
/* Blacklist some devices:
* - HDAPS, it's not a real joystick.
* - X360 controllers, Xinput handles them better since
* it won't think there is only one trigger axis. */
char const *name = SDL_JoystickName(i);
if (strstr(name, "HDAPS")
# if !defined USE_D3D9
# if defined USE_XINPUT
|| strstr(name, "XBOX 360 For Windows")
# endif
|| false)


Загрузка…
Отмена
Сохранить