mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Warp back to 1983!!! (rev 1983, that is, not the year :P)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1997 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Version="9.00"
|
||||
Name="InputCommon"
|
||||
ProjectGUID="{C7E5D50A-2916-464B-86A7-E10B3CC88ADA}"
|
||||
RootNamespace="VideoCommon"
|
||||
@ -44,7 +44,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc;"$(SolutionDir)..\Externals\SDL\Include""
|
||||
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@ -109,7 +109,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc;"$(SolutionDir)..\Externals\SDL\Include""
|
||||
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_SECURE_SCL=0;_LIB;__WXMSW__;wxUSE_BASE=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@ -175,7 +175,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc;..\..\..\Externals\SDL\Include"
|
||||
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
@ -245,7 +245,7 @@
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="false"
|
||||
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc;"$(SolutionDir)..\Externals\SDL\Include""
|
||||
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
@ -307,7 +307,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc;"$(SolutionDir)..\Externals\SDL\Include""
|
||||
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
@ -370,7 +370,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc;"$(SolutionDir)..\Externals\SDL\Include""
|
||||
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0;__WXMSW__;wxUSE_BASE=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
@ -431,14 +431,6 @@
|
||||
RelativePath=".\Src\InputCommon.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\InputManager.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\InputManager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\SConscript"
|
||||
>
|
||||
|
@ -1,94 +0,0 @@
|
||||
#include "InputManager.h"
|
||||
|
||||
bool InputManager::Init() {
|
||||
|
||||
if (! SDLInit())
|
||||
return false;
|
||||
|
||||
ScanDevices();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InputManager::Shutdown() {
|
||||
SDLShutdown();
|
||||
sdlInit = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InputManager::SDLInit() {
|
||||
#ifdef HAVE_SDL
|
||||
// Move also joystick opening code here.
|
||||
if (! sdlInit) {
|
||||
/* SDL 1.3 use DirectInput instead of the old Microsoft Multimeda API,
|
||||
and with this we need the SDL_INIT_VIDEO flag as well */
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {
|
||||
PanicAlert("Could not initialize SDL! (%s)\n", SDL_GetError());
|
||||
} else {
|
||||
sdlInit = true;
|
||||
}
|
||||
}
|
||||
return sdlInit;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
void InputManager::SDLShutdown() {
|
||||
for(int i = 0; i < numjoy; i++ ) {
|
||||
if (SDL_JoystickOpened(m_joyinfo[i].ID))
|
||||
SDL_JoystickClose(m_joyinfo[i].joy);
|
||||
}
|
||||
SDL_Quit();
|
||||
}
|
||||
|
||||
int InputManager::ScanDevices() {
|
||||
|
||||
int res = SDLScanDevices();
|
||||
return res;
|
||||
}
|
||||
|
||||
int InputManager::SDLScanDevices() {
|
||||
#if defined HAVE_SDL && HAVE_SDL
|
||||
numjoy = SDL_NumJoysticks();
|
||||
|
||||
if(numjoy == 0) {
|
||||
PanicAlert("No Joystick detected!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(m_joyinfo)
|
||||
delete [] m_joyinfo;
|
||||
|
||||
m_joyinfo = new ControllerInfo[numjoy];
|
||||
|
||||
#ifdef _DEBUG
|
||||
fprintf(pFile, "Scanning for devices\n");
|
||||
fprintf(pFile, "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\n");
|
||||
#endif
|
||||
|
||||
for(int i = 0; i < numjoy; i++ ) {
|
||||
m_joyinfo[i].joy = SDL_JoystickOpen(i);
|
||||
m_joyinfo[i].ID = i;
|
||||
m_joyinfo[i].NumAxes = SDL_JoystickNumAxes(m_joyinfo[i].joy);
|
||||
m_joyinfo[i].NumButtons = SDL_JoystickNumButtons(m_joyinfo[i].joy);
|
||||
m_joyinfo[i].NumBalls = SDL_JoystickNumBalls(m_joyinfo[i].joy);
|
||||
m_joyinfo[i].NumHats = SDL_JoystickNumHats(m_joyinfo[i].joy);
|
||||
m_joyinfo[i].Name = SDL_JoystickName(i);
|
||||
|
||||
printf("ID: %d\n", i);
|
||||
printf("Name: %s\n", m_joyinfo[i].Name);
|
||||
printf("Buttons: %d\n", m_joyinfo[i].NumButtons);
|
||||
printf("Axises: %d\n", m_joyinfo[i].NumAxes);
|
||||
printf("Hats: %d\n", m_joyinfo[i].NumHats);
|
||||
printf("Balls: %d\n\n", m_joyinfo[i].NumBalls);
|
||||
|
||||
// Close if opened
|
||||
if(SDL_JoystickOpened(i))
|
||||
SDL_JoystickClose(m_joyinfo[i].joy);
|
||||
}
|
||||
|
||||
return numjoy;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
#ifndef INPUTMANAGER_H
|
||||
#define INPUTMANAGER_H
|
||||
#include "Common.h"
|
||||
|
||||
#if defined HAVE_SDL && HAVE_SDL
|
||||
#include <SDL.h>
|
||||
|
||||
|
||||
struct ControllerInfo { // CONNECTED WINDOWS DEVICES INFO
|
||||
int NumAxes; // Amount of Axes
|
||||
int NumButtons; // Amount of Buttons
|
||||
int NumBalls; // Amount of Balls
|
||||
int NumHats; // Amount of Hats (POV)
|
||||
const char *Name; // Joypad/stickname
|
||||
int ID; // SDL joystick device ID
|
||||
SDL_Joystick *joy; // SDL joystick device
|
||||
};
|
||||
#endif
|
||||
|
||||
class InputManager {
|
||||
|
||||
public:
|
||||
bool Init();
|
||||
bool Shutdown();
|
||||
|
||||
InputManager(): sdlInit(false) {}
|
||||
~InputManager() {
|
||||
if(m_joyinfo)
|
||||
delete [] m_joyinfo;
|
||||
}
|
||||
|
||||
private:
|
||||
bool sdlInit;
|
||||
int ScanDevices();
|
||||
|
||||
// sdl specific
|
||||
bool SDLInit();
|
||||
void SDLShutdown();
|
||||
int SDLScanDevices();
|
||||
ControllerInfo *m_joyinfo;
|
||||
int numjoy;
|
||||
};
|
||||
#endif
|
@ -5,7 +5,6 @@ Import('env')
|
||||
files = [
|
||||
'EventHandler.cpp',
|
||||
'InputCommon.cpp',
|
||||
"InputManager.cpp",
|
||||
]
|
||||
|
||||
env_inputcommon = env.Clone()
|
||||
|
Reference in New Issue
Block a user