removed old njoy structure

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@52 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
fires.gc 2008-07-22 09:03:22 +00:00
parent e8b40c07a3
commit adde012508
13 changed files with 4 additions and 2352 deletions

View File

@ -81,7 +81,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VideoCommon", "Core\VideoCo
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_PadDX9", "Plugins\Plugin_PadDX9\Plugin_PadDX9.vcproj", "{805B34AA-82A5-4875-8DC7-3C85BDC0BCEE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_nJoy_SDL", "Plugins\Plugin_nJoy_SDL\Plugin_nJoy_SDL\Plugin_nJoy_SDL.vcproj", "{521498BE-6089-4780-8223-E67C22F4E068}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_nJoy_SDL", "Plugins\Plugin_nJoy_SDL\Plugin_nJoy_SDL.vcproj", "{521498BE-6089-4780-8223-E67C22F4E068}"
ProjectSection(ProjectDependencies) = postProject
{C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -1,153 +0,0 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program 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 Foundation, version 2.0.
// This program 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
/////////////////////////////////////////////////////////////////////////////////////////////////////
// M O D U L E B E G I N ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
#include "nJoy.h"
/////////////////////////////////////////////////////////////////////////////////////////////////////
// I M P L E M E N T A T I O N //////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
// ________________________________________________________________________________________ __________
// constructor
//
IniFile::IniFile(void)
{
}
// ________________________________________________________________________________________ __________
// destructor
//
IniFile::~IniFile(void)
{
}
// ________________________________________________________________________________________ __________
// SetFile
//
void
IniFile::SetFile(const TCHAR* _filename)
{
if (_filename)
{
char path_buffer[_MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR];
char fname[_MAX_FNAME],ext[_MAX_EXT];
GetModuleFileName(NULL,path_buffer,sizeof(path_buffer));
_splitpath( path_buffer, drive, dir, fname, ext );
_makepath( filename, drive, dir, _filename, ".ini");
}
}
// ________________________________________________________________________________________ __________
// SetSection
//
void
IniFile::SetSection(const TCHAR *_section)
{
_tcscpy(section,_section);
}
// ________________________________________________________________________________________ __________
// ReadInt
//
int
IniFile::ReadInt(const TCHAR *key, int def)
{
return GetPrivateProfileInt(section, key, def, filename);
}
// ________________________________________________________________________________________ __________
// WriteInt
//
void
IniFile::WriteInt(const TCHAR *key, int value)
{
char temp[256];
WritePrivateProfileString(section, key, _itoa(value,temp,10), filename);
}
// ________________________________________________________________________________________ __________
// ReadBool
//
bool
IniFile::ReadBool(const TCHAR *key, bool def)
{
return ReadInt(key,def?1:0) == 0 ? false : true;
}
// ________________________________________________________________________________________ __________
// WriteBool
//
void
IniFile::WriteBool(const TCHAR *key, bool value)
{
WriteInt(key,value?1:0);
}
// ________________________________________________________________________________________ __________
// ReadString
//
void
IniFile::ReadString(const TCHAR *key, const TCHAR *def, TCHAR *out, int size)
{
GetPrivateProfileString(section, key, def, out, size, filename);
}
// ________________________________________________________________________________________ __________
// WriteString
//
void
IniFile::WriteString(const TCHAR *key, const TCHAR *value)
{
WritePrivateProfileString(section, key, value, filename);
}
// ________________________________________________________________________________________ __________
// ReadStringList
//
void
IniFile::ReadStringList(const TCHAR *key, std::vector<std::string> &list)
{
int count = ReadInt(key);
for (int i=0; i<count; i++)
{
char temp[256], temp2[256];
sprintf(temp,"%s%i",key,i);
ReadString(temp,"",temp2,256);
list.push_back(std::string(temp2));
}
}
// ________________________________________________________________________________________ __________
// WriteStringList
//
void
IniFile::WriteStringList(const TCHAR *key, std::vector<std::string> &list)
{
WriteInt(key,(int)list.size());
int i=0;
for (std::vector<std::string>::iterator iter = list.begin(); iter!=list.end(); iter++)
{
char temp[256];
sprintf(temp,"%s%i",key,i);
WriteString(temp,iter->c_str());
i++;
}
}

View File

@ -1,48 +0,0 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program 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 Foundation, version 2.0.
// This program 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
/////////////////////////////////////////////////////////////////////////////////////////////////////
// M O D U L E B E G I N ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
/////////////////////////////////////////////////////////////////////////////////////////////////////
// C L A S S ////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
class IniFile
{
public:
IniFile(void);
~IniFile(void);
void SetFile(const TCHAR *fname);
void SetSection(const TCHAR *section);
int ReadInt (const TCHAR *key, int def = 0);
void WriteInt (const TCHAR *key, int value);
bool ReadBool (const TCHAR *key, bool def = false);
void WriteBool (const TCHAR *key, bool value);
void ReadString (const TCHAR *key, const TCHAR *def, TCHAR *out, int size = 255);
void WriteString(const TCHAR *key, const TCHAR *value);
void ReadStringList (const TCHAR *key, std::vector<std::string> &list);
void WriteStringList(const TCHAR *key, std::vector<std::string> &list);
private:
TCHAR filename[512];
TCHAR section[256];
};

View File

@ -1,158 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Dutch (Netherlands) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NLD)
#ifdef _WIN32
LANGUAGE LANG_DUTCH, SUBLANG_DUTCH
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_CONFIG DIALOGEX 0, 0, 411, 282
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_SYSMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
COMBOBOX IDC_JOYNAME,8,18,317,30,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Controller:",IDC_STATIC,3,7,405,28
CONTROL 102,IDC_STATIC,"Static",SS_BITMAP | SS_REALSIZEIMAGE | SS_SUNKEN,65,46,281,187
CONTROL "Controller attached",IDC_JOYATTACH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,330,19,73,10
PUSHBUTTON "",IDC_SHOULDERL,46,50,15,10,0,WS_EX_STATICEDGE
PUSHBUTTON "",IDC_B,350,50,15,10,0,WS_EX_STATICEDGE
PUSHBUTTON "",IDC_SHOULDERR,350,66,15,10,0,WS_EX_STATICEDGE
PUSHBUTTON "",IDC_Z,350,90,15,10,0,WS_EX_STATICEDGE
PUSHBUTTON "",IDC_Y,350,106,15,10,0,WS_EX_STATICEDGE
PUSHBUTTON "",IDC_X,350,150,15,10,0,WS_EX_STATICEDGE
PUSHBUTTON "",IDC_A,350,173,15,10,0,WS_EX_STATICEDGE
PUSHBUTTON "",IDC_SX,351,217,15,10,0,WS_EX_STATICEDGE
PUSHBUTTON "",IDC_START,197,236,15,10,0,WS_EX_STATICEDGE
PUSHBUTTON "",IDC_DPAD,46,183,15,10,0,WS_EX_STATICEDGE
PUSHBUTTON "",IDC_MX,46,135,15,10,0,WS_EX_STATICEDGE
CTEXT "",IDTEXT_SHOULDERL,4,49,40,12,WS_BORDER
CTEXT "",IDTEXT_B,368,49,40,12,WS_BORDER
CTEXT "",IDTEXT_SHOULDERR,368,65,40,12,WS_BORDER
CTEXT "",IDTEXT_Z,368,89,40,12,WS_BORDER
CTEXT "",IDTEXT_Y,368,105,40,12,WS_BORDER
CTEXT "",IDTEXT_X,368,149,40,12,WS_BORDER
CTEXT "",IDTEXT_A,368,172,40,12,WS_BORDER
CTEXT "",IDTEXT_MX,4,134,40,12,WS_BORDER
CTEXT "",IDTEXT_DPAD,4,182,40,12,WS_BORDER
CTEXT "",IDTEXT_START,185,248,40,12,WS_BORDER
CTEXT "",IDTEXT_MY,3,157,40,12,WS_BORDER
LTEXT "X-axis",IDC_STATIC,4,124,20,8
LTEXT "Y-axis",IDC_STATIC,4,147,20,8
CTEXT "",IDTEXT_SX,368,216,40,12,WS_BORDER
CTEXT "",IDTEXT_SY,367,239,40,12,WS_BORDER
LTEXT "X-axis",IDC_STATIC,368,206,20,8
LTEXT "Y-axis",IDC_STATIC,368,229,20,8
PUSHBUTTON "",IDC_SY,351,240,15,10,0,WS_EX_STATICEDGE
PUSHBUTTON "",IDC_MY,46,158,15,10,0,WS_EX_STATICEDGE
GROUPBOX "Extra settings",IDC_STATIC,3,236,95,43
LTEXT "Deadzone",IDC_STATIC,11,248,33,8
LTEXT "Half press",IDC_STATIC,11,263,33,8
COMBOBOX IDC_DEADZONE,45,246,48,30,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_HALFPRESS,45,261,48,30,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
LTEXT "www.multigesture.net",IDC_STATIC,336,271,72,8
END
IDD_ABOUT DIALOGEX 0, 0, 133, 227
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION
CAPTION "About: nJoy Input Plugin"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,75,209,50,14
CONTROL 104,IDC_STATIC,"Static",SS_BITMAP,0,0,133,37
GROUPBOX "Plugin info:",IDC_STATIC,7,39,120,42
GROUPBOX "Special thanks to:",IDC_STATIC,7,84,120,24
GROUPBOX "Greetings to:",IDC_STATIC,7,112,120,95
LTEXT "",IDC_ABOUT_TEXT,13,51,108,24
LTEXT "F|RES and ector.",IDC_STATIC,13,95,108,8
LTEXT "Static",IDC_ABOUT_TEXT2,13,123,111,82
LTEXT "BETA RELEASE",IDC_ABOUT_TEXT3,10,211,62,13
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_CONFIG, DIALOG
BEGIN
LEFTMARGIN, 3
RIGHTMARGIN, 408
TOPMARGIN, 7
BOTTOMMARGIN, 279
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_BITMAP1 BITMAP "images\\controller.bmp"
IDB_BITMAP2 BITMAP "images\\njoy.bmp"
#endif // Dutch (Netherlands) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -1,567 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="Plugin_nJoy_SDL"
ProjectGUID="{521498BE-6089-4780-8223-E67C22F4E068}"
RootNamespace="Plugin_nJoy_SDL"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\PluginSpecs;..\..\..\..\Externals\SDL\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PLUGIN_NJOY_SDL_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\..\..\Binary\Win32\Plugins\$(ProjectName)d.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\..\Externals\SDL\win32"
GenerateManifest="false"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\PluginSpecs;..\..\..\..\Externals\SDL\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_NJOY_SDL_EXPORTS"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\..\..\Binary\Win32\Plugins\$(ProjectName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\..\Externals\SDL\win32"
GenerateManifest="false"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="DebugFast|Win32"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\PluginSpecs;..\..\..\..\Externals\SDL\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_NJOY_SDL_EXPORTS"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\..\..\Binary\Win32\Plugins\$(ProjectName)df.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\..\Externals\SDL\win32"
GenerateManifest="false"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\PluginSpecs;..\..\..\..\Externals\SDL\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PLUGIN_NJOY_SDL_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\..\..\Binary\x64\Plugins\$(ProjectName)d.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\..\Externals\SDL\x64"
GenerateManifest="false"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\PluginSpecs;..\..\..\..\Externals\SDL\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_NJOY_SDL_EXPORTS"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\..\..\Binary\x64\Plugins\$(ProjectName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\..\Externals\SDL\x64"
GenerateManifest="false"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="DebugFast|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\PluginSpecs;..\..\..\..\Externals\SDL\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_NJOY_SDL_EXPORTS"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\..\..\Binary\x64\Plugins\$(ProjectName)DF.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\..\Externals\SDL\x64"
GenerateManifest="false"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\config.cpp"
>
</File>
<File
RelativePath=".\IniFile.cpp"
>
</File>
<File
RelativePath=".\nJoy.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\config.h"
>
</File>
<File
RelativePath=".\IniFile.h"
>
</File>
<File
RelativePath=".\nJoy.h"
>
</File>
<File
RelativePath=".\resource.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\images\controller.bmp"
>
</File>
<File
RelativePath=".\images\njoy.bmp"
>
</File>
<File
RelativePath=".\Plugin_nJoy_SDL.rc"
>
</File>
</Filter>
<File
RelativePath=".\readme.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,520 +0,0 @@
//////////////////////////////////////////////////////////////////////////////////////////
// Project description
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// Name: nJoy
// Description: A Dolphin Compatible Input Plugin
//
// Author: Falcon4ever (nJoy@falcon4ever.com)
// Site: www.multigesture.net
// Copyright (C) 2003-2008 Dolphin Project.
//
//////////////////////////////////////////////////////////////////////////////////////////
//
// Licensetype: GNU General Public License (GPL)
//
// This program 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 Foundation, version 2.0.
//
// This program 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 2.0 for more details.
//
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
//
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
//
//////////////////////////////////////////////////////////////////////////////////////////
#include "nJoy.h"
extern CONTROLLER_INFO *joyinfo;
extern CONTROLLER_MAPPING joysticks[4];
extern bool emulator_running;
// Create dialog and pages
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
int OpenConfig(HINSTANCE hInst, HWND _hParent)
{
PROPSHEETPAGE psp[4];
PROPSHEETHEADER psh;
psp[0].dwSize = sizeof(PROPSHEETPAGE);
psp[0].dwFlags = PSP_USETITLE;
psp[0].hInstance = hInst;
psp[0].pszTemplate = MAKEINTRESOURCE(IDD_CONFIG);
psp[0].pszIcon = NULL;
psp[0].pfnDlgProc = (DLGPROC)ControllerTab1;
psp[0].pszTitle = "Controller 1";
psp[0].lParam = 0;
psp[1].dwSize = sizeof(PROPSHEETPAGE);
psp[1].dwFlags = PSP_USETITLE;
psp[1].hInstance = hInst;
psp[1].pszTemplate = MAKEINTRESOURCE(IDD_CONFIG);
psp[1].pszIcon = NULL;
psp[1].pfnDlgProc = (DLGPROC)ControllerTab2;
psp[1].pszTitle = "Controller 2";
psp[1].lParam = 0;
psp[2].dwSize = sizeof(PROPSHEETPAGE);
psp[2].dwFlags = PSP_USETITLE;
psp[2].hInstance = hInst;
psp[2].pszTemplate = MAKEINTRESOURCE(IDD_CONFIG);
psp[2].pszIcon = NULL;
psp[2].pfnDlgProc = (DLGPROC)ControllerTab3;
psp[2].pszTitle = "Controller 3";
psp[2].lParam = 0;
psp[3].dwSize = sizeof(PROPSHEETPAGE);
psp[3].dwFlags = PSP_USETITLE;
psp[3].hInstance = hInst;
psp[3].pszTemplate = MAKEINTRESOURCE(IDD_CONFIG);
psp[3].pszIcon = NULL;
psp[3].pfnDlgProc = (DLGPROC)ControllerTab4;
psp[3].pszTitle = "Controller 4";
psp[3].lParam = 0;
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP;
psh.hwndParent = _hParent;
psh.hInstance = hInst;
psh.pszIcon = NULL;
#ifndef _DEBUG
psh.pszCaption = (LPSTR) "Configure: nJoy v"INPUT_VERSION " Input Plugin";
#else
psh.pszCaption = (LPSTR) "Configure: nJoy v"INPUT_VERSION " (Debug) Input Plugin";
#endif
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
psh.ppsp = (LPCPROPSHEETPAGE) &psp;
return (int)(PropertySheet(&psh));
}
// Create Tab
// ¯¯¯¯¯¯¯¯¯¯
BOOL APIENTRY ControllerTab1(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
return ControllerTab(hDlg, message, wParam, lParam, 0);
}
BOOL APIENTRY ControllerTab2(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
return ControllerTab(hDlg, message, wParam, lParam, 1);
}
BOOL APIENTRY ControllerTab3(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
return ControllerTab(hDlg, message, wParam, lParam, 2);
}
BOOL APIENTRY ControllerTab4(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
return ControllerTab(hDlg, message, wParam, lParam, 3);
}
// Create Controller Tab
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
BOOL ControllerTab(HWND hDlg, UINT message, UINT wParam, LONG lParam, int controller)
{
switch (message)
{
case WM_INITDIALOG:
// Prevent user from changing the joystick while emulation is running
if(emulator_running)
{
ComboBox_Enable(GetDlgItem(hDlg, IDC_JOYNAME), FALSE);
Button_Enable(GetDlgItem(hDlg, IDC_JOYATTACH), FALSE);
}
else
{
ComboBox_Enable(GetDlgItem(hDlg, IDC_JOYNAME), TRUE);
Button_Enable(GetDlgItem(hDlg, IDC_JOYATTACH), TRUE);
}
// Search for devices and add the to the device list
if(Search_Devices())
{
HWND CB = GetDlgItem(hDlg, IDC_JOYNAME);
for(int x = 0; x < SDL_NumJoysticks(); x++)
{
SendMessage(CB, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>((LPCTSTR)joyinfo[x].Name));
}
char buffer [8];
CB = GetDlgItem(hDlg, IDC_DEADZONE);
SendMessage(CB, CB_RESETCONTENT, 0, 0);
for(int x = 1; x <= 100; x++)
{
sprintf (buffer, "%d %%", x);
SendMessage(CB, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>((LPCTSTR)buffer));
}
SetControllerAll(hDlg, controller);
return TRUE;
}
else
{
HWND CB = GetDlgItem(hDlg, IDC_JOYNAME);
SendMessage(CB, CB_ADDSTRING, 0, (LPARAM)"No Joystick detected!");
SendMessage(CB, CB_SETCURSEL, 0, 0);
return FALSE;
}
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_JOYNAME:
{
// Selected a different joystick
if(HIWORD(wParam) == CBN_SELCHANGE)
{
joysticks[controller].ID = (int)SendMessage(GetDlgItem(hDlg, IDC_JOYNAME), CB_GETCURSEL, 0, 0);
}
return TRUE;
}
break;
case IDC_SHOULDERL:
case IDC_SHOULDERR:
case IDC_A:
case IDC_B:
case IDC_X:
case IDC_Y:
case IDC_Z:
case IDC_START:
{
GetButtons(hDlg, LOWORD(wParam), controller);
return TRUE;
}
break;
case IDC_DPAD:
{
GetHats(hDlg, LOWORD(wParam), controller);
return TRUE;
}
break;
case IDC_SX:
case IDC_SY:
case IDC_MX:
case IDC_MY:
{
GetAxis(hDlg, LOWORD(wParam), controller);
return TRUE;
}
break;
}
break;
case WM_DESTROY:
GetControllerAll(hDlg, controller);
break;
}
return FALSE;
}
// Wait for button press
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
bool GetButtons(HWND hDlg, int buttonid, int controller)
{
buttonid += 1000;
SDL_Joystick *joy;
joy=SDL_JoystickOpen(joysticks[controller].ID);
char format[128];
int buttons = SDL_JoystickNumButtons(joy);
bool waiting = true;
bool succeed = false;
int pressed = 0;
int counter1 = 0;
int counter2 = 10;
sprintf(format, "[%d]", counter2);
SetDlgItemText(hDlg, buttonid, format);
while(waiting)
{
SDL_JoystickUpdate();
for(int b = 0; b < buttons; b++)
{
if(SDL_JoystickGetButton(joy, b))
{
pressed = b;
waiting = false;
succeed = true;
break;
}
}
counter1++;
if(counter1==100)
{
counter1=0;
counter2--;
sprintf(format, "[%d]", counter2);
SetDlgItemText(hDlg, buttonid, format);
if(counter2<0)
waiting = false;
}
Sleep(10);
}
if(succeed)
sprintf(format, "%d", pressed);
else
sprintf(format, "-1", pressed);
SetDlgItemText(hDlg, buttonid, format);
if(SDL_JoystickOpened(joysticks[controller].ID))
SDL_JoystickClose(joy);
return true;
}
// Wait for D-Pad
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
bool GetHats(HWND hDlg, int buttonid, int controller)
{
buttonid += 1000;
SDL_Joystick *joy;
joy=SDL_JoystickOpen(joysticks[controller].ID);
char format[128];
int hats = SDL_JoystickNumHats(joy);
bool waiting = true;
bool succeed = false;
int pressed = 0;
int counter1 = 0;
int counter2 = 10;
sprintf(format, "[%d]", counter2);
SetDlgItemText(hDlg, buttonid, format);
while(waiting)
{
SDL_JoystickUpdate();
for(int b = 0; b < hats; b++)
{
if(SDL_JoystickGetHat(joy, b))
{
pressed = b;
waiting = false;
succeed = true;
break;
}
}
counter1++;
if(counter1==100)
{
counter1=0;
counter2--;
sprintf(format, "[%d]", counter2);
SetDlgItemText(hDlg, buttonid, format);
if(counter2<0)
waiting = false;
}
Sleep(10);
}
if(succeed)
sprintf(format, "%d", pressed);
else
sprintf(format, "-1", pressed);
SetDlgItemText(hDlg, buttonid, format);
if(SDL_JoystickOpened(joysticks[controller].ID))
SDL_JoystickClose(joy);
return true;
}
// Wait for Analog
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
bool GetAxis(HWND hDlg, int buttonid, int controller)
{
buttonid += 1000;
SDL_Joystick *joy;
joy=SDL_JoystickOpen(joysticks[controller].ID);
char format[128];
int axes = SDL_JoystickNumAxes(joy);
bool waiting = true;
bool succeed = false;
int pressed = 0;
Sint16 value;
int counter1 = 0;
int counter2 = 10;
sprintf(format, "[%d]", counter2);
SetDlgItemText(hDlg, buttonid, format);
while(waiting)
{
SDL_JoystickUpdate();
for(int b = 0; b < axes; b++)
{
value = SDL_JoystickGetAxis(joy, b);
if(value < -10000 || value > 10000)
{
pressed = b;
waiting = false;
succeed = true;
break;
}
}
counter1++;
if(counter1==100)
{
counter1=0;
counter2--;
sprintf(format, "[%d]", counter2);
SetDlgItemText(hDlg, buttonid, format);
if(counter2<0)
waiting = false;
}
Sleep(10);
}
if(succeed)
sprintf(format, "%d", pressed);
else
sprintf(format, "-1", pressed);
SetDlgItemText(hDlg, buttonid, format);
if(SDL_JoystickOpened(joysticks[controller].ID))
SDL_JoystickClose(joy);
return true;
}
// Set dialog items
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void SetControllerAll(HWND hDlg, int controller)
{
SendMessage(GetDlgItem(hDlg, IDC_JOYNAME), CB_SETCURSEL, joysticks[controller].ID, 0);
SetButton(hDlg, IDTEXT_SHOULDERL, joysticks[controller].buttons[CTL_L_SHOULDER]);
SetButton(hDlg, IDTEXT_SHOULDERR, joysticks[controller].buttons[CTL_R_SHOULDER]);
SetButton(hDlg, IDTEXT_A, joysticks[controller].buttons[CTL_A_BUTTON]);
SetButton(hDlg, IDTEXT_B, joysticks[controller].buttons[CTL_B_BUTTON]);
SetButton(hDlg, IDTEXT_X, joysticks[controller].buttons[CTL_X_BUTTON]);
SetButton(hDlg, IDTEXT_Y, joysticks[controller].buttons[CTL_Y_BUTTON]);
SetButton(hDlg, IDTEXT_Z, joysticks[controller].buttons[CTL_Z_TRIGGER]);
SetButton(hDlg, IDTEXT_START, joysticks[controller].buttons[CTL_START]);
SetButton(hDlg, IDTEXT_DPAD, joysticks[controller].dpad);
SetButton(hDlg, IDTEXT_MX, joysticks[controller].axis[CTL_MAIN_X]);
SetButton(hDlg, IDTEXT_MY, joysticks[controller].axis[CTL_MAIN_Y]);
SetButton(hDlg, IDTEXT_SX, joysticks[controller].axis[CTL_SUB_X]);
SetButton(hDlg, IDTEXT_SY, joysticks[controller].axis[CTL_SUB_Y]);
SendDlgItemMessage(hDlg, IDC_JOYATTACH, BM_SETCHECK, joysticks[controller].enabled, 0);
SendMessage(GetDlgItem(hDlg, IDC_DEADZONE), CB_SETCURSEL, joysticks[controller].deadzone, 0);
}
// Get dialog items
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void GetControllerAll(HWND hDlg, int controller)
{
joysticks[controller].ID = (int)SendMessage(GetDlgItem(hDlg, IDC_JOYNAME), CB_GETCURSEL, 0, 0);
joysticks[controller].buttons[CTL_L_SHOULDER] = GetButton(hDlg, IDTEXT_SHOULDERL);
joysticks[controller].buttons[CTL_R_SHOULDER] = GetButton(hDlg, IDTEXT_SHOULDERR);
joysticks[controller].buttons[CTL_A_BUTTON] = GetButton(hDlg, IDTEXT_A);
joysticks[controller].buttons[CTL_B_BUTTON] = GetButton(hDlg, IDTEXT_B);
joysticks[controller].buttons[CTL_X_BUTTON] = GetButton(hDlg, IDTEXT_X);
joysticks[controller].buttons[CTL_Y_BUTTON] = GetButton(hDlg, IDTEXT_Y);
joysticks[controller].buttons[CTL_Z_TRIGGER] = GetButton(hDlg, IDTEXT_Z);
joysticks[controller].buttons[CTL_START] = GetButton(hDlg, IDTEXT_START);
joysticks[controller].dpad = GetButton(hDlg, IDTEXT_DPAD);
joysticks[controller].axis[CTL_MAIN_X] = GetButton(hDlg, IDTEXT_MX);
joysticks[controller].axis[CTL_MAIN_Y] = GetButton(hDlg, IDTEXT_MY);
joysticks[controller].axis[CTL_SUB_X] = GetButton(hDlg, IDTEXT_SX);
joysticks[controller].axis[CTL_SUB_Y] = GetButton(hDlg, IDTEXT_SY);
joysticks[controller].enabled = (int)SendMessage(GetDlgItem(hDlg, IDC_JOYATTACH), BM_GETCHECK, 0, 0);
joysticks[controller].deadzone = (int)SendMessage(GetDlgItem(hDlg, IDC_DEADZONE), CB_GETCURSEL, 0, 0);
}
// Set text in static text item
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void SetButton(HWND hDlg, int item, int value)
{
char format[8];
sprintf(format, "%d", value);
SetDlgItemText(hDlg, item, format);
}
// Get text from static text item
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
int GetButton(HWND hDlg, int item)
{
char format[8];
GetDlgItemText(hDlg, item, format, sizeof(format));
return atoi(format);
}
//////////////////////////////////////////////////////////////////////////////////////////
// About dialog functions
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void OpenAbout(HINSTANCE hInst, HWND _hParent)
{
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), _hParent, (DLGPROC)AboutDlg);
}
BOOL CALLBACK AboutDlg(HWND abouthWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
char format[0xFFF];
switch (message)
{
case WM_INITDIALOG:
sprintf(format,"nJoy v"INPUT_VERSION" by Falcon4ever\n"
"Release: "RELDAY"/"RELMONTH"/"RELYEAR"\n"
"www.multigesture.net");
SetDlgItemText(abouthWnd,IDC_ABOUT_TEXT,format);
sprintf(format, THANKYOU);
SetDlgItemText(abouthWnd,IDC_ABOUT_TEXT2,format);
sprintf(format, INPUT_STATE);
SetDlgItemText(abouthWnd,IDC_ABOUT_TEXT3,format);
break;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK)
{
EndDialog(abouthWnd, LOWORD(wParam));
return TRUE;
}
break;
}
return FALSE;
}

View File

@ -1,67 +0,0 @@
//////////////////////////////////////////////////////////////////////////////////////////
// Project description
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// Name: nJoy
// Description: A Dolphin Compatible Input Plugin
//
// Author: Falcon4ever (nJoy@falcon4ever.com)
// Site: www.multigesture.net
// Copyright (C) 2003-2008 Dolphin Project.
//
//////////////////////////////////////////////////////////////////////////////////////////
//
// Licensetype: GNU General Public License (GPL)
//
// This program 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 Foundation, version 2.0.
//
// This program 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 2.0 for more details.
//
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
//
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
//
//////////////////////////////////////////////////////////////////////////////////////////
#include <windows.h> // includes basic windows functionality
#include <Windowsx.h>
#include <stdio.h>
#include <commctrl.h> // includes the common control header
#include "resource.h" // includes GUI IDs
#pragma comment(lib, "comctl32.lib")
//////////////////////////////////////////////////////////////////////////////////////////
// Config dialog functions
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
int OpenConfig(HINSTANCE hInst, HWND _hParent);
BOOL ControllerTab(HWND hDlg, UINT message, UINT wParam, LONG lParam, int controller);
BOOL APIENTRY ControllerTab1(HWND hDlg, UINT message, UINT wParam, LONG lParam);
BOOL APIENTRY ControllerTab2(HWND hDlg, UINT message, UINT wParam, LONG lParam);
BOOL APIENTRY ControllerTab3(HWND hDlg, UINT message, UINT wParam, LONG lParam);
BOOL APIENTRY ControllerTab4(HWND hDlg, UINT message, UINT wParam, LONG lParam);
bool GetButtons(HWND hDlg, int buttonid, int controller);
bool GetHats(HWND hDlg, int buttonid, int controller);
bool GetAxis(HWND hDlg, int buttonid, int controller);
void GetControllerAll(HWND hDlg, int controller);
void SetControllerAll(HWND hDlg, int controller);
int GetButton(HWND hDlg, int item);
void SetButton(HWND hDlg, int item, int value);
//////////////////////////////////////////////////////////////////////////////////////////
// About dialog functions
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void OpenAbout(HINSTANCE hInst, HWND _hParent);
BOOL CALLBACK AboutDlg(HWND abouthWnd, UINT message, WPARAM wParam, LPARAM lParam);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

View File

@ -1,547 +0,0 @@
//////////////////////////////////////////////////////////////////////////////////////////
// Project description
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// Name: nJoy
// Description: A Dolphin Compatible Input Plugin
//
// Author: Falcon4ever (nJoy@falcon4ever.com)
// Site: www.multigesture.net
// Copyright (C) 2003-2008 Dolphin Project.
//
//////////////////////////////////////////////////////////////////////////////////////////
//
// Licensetype: GNU General Public License (GPL)
//
// This program 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 Foundation, version 2.0.
//
// This program 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 2.0 for more details.
//
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
//
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
//
//////////////////////////////////////////////////////////////////////////////////////////
#include "nJoy.h"
//////////////////////////////////////////////////////////////////////////////////////////
// Variables
// ¯¯¯¯¯¯¯¯¯
FILE *pFile;
HINSTANCE nJoy_hInst = NULL;
CONTROLLER_INFO *joyinfo = 0;
CONTROLLER_STATE joystate[4];
CONTROLLER_MAPPING joysticks[4];
bool emulator_running = FALSE;
//////////////////////////////////////////////////////////////////////////////////////////
// DllMain
// ¯¯¯¯¯¯¯
BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle
DWORD dwReason, // reason called
LPVOID lpvReserved) // reserved
{
InitCommonControls();
nJoy_hInst = hinstDLL;
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////////////////
// Input Plugin Functions (from spec's)
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// Get properties of plugin
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void GetDllInfo(PLUGIN_INFO* _PluginInfo)
{
_PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_PAD;
#ifndef _DEBUG
sprintf(_PluginInfo->Name, "nJoy v"INPUT_VERSION " by Falcon4ever");
#else
sprintf(_PluginInfo->Name, "nJoy v"INPUT_VERSION" (Debug) by Falcon4ever");
#endif
}
// Call about dialog
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void DllAbout(HWND _hParent)
{
OpenAbout(nJoy_hInst, _hParent);
}
// Call config dialog
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void DllConfig(HWND _hParent)
{
if(SDL_Init(SDL_INIT_JOYSTICK ) < 0)
{
MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR);
return;
}
LoadConfig();
if(OpenConfig(nJoy_hInst, _hParent))
SaveConfig();
}
// Init PAD (start emulation)
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void PAD_Initialize(SPADInitialize _PADInitialize)
{
emulator_running = TRUE;
#ifdef _DEBUG
DEBUG_INIT();
#endif
if(SDL_Init(SDL_INIT_JOYSTICK ) < 0)
{
MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR);
return;
}
LoadConfig(); // Load joystick mapping
if(joysticks[0].enabled)
joystate[0].joy = SDL_JoystickOpen(joysticks[0].ID);
if(joysticks[1].enabled)
joystate[1].joy = SDL_JoystickOpen(joysticks[1].ID);
if(joysticks[2].enabled)
joystate[2].joy = SDL_JoystickOpen(joysticks[2].ID);
if(joysticks[3].enabled)
joystate[3].joy = SDL_JoystickOpen(joysticks[3].ID);
}
// Shutdown PAD (stop emulation)
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void PAD_Shutdown()
{
if(joysticks[0].enabled)
SDL_JoystickClose(joystate[0].joy);
if(joysticks[1].enabled)
SDL_JoystickClose(joystate[1].joy);
if(joysticks[2].enabled)
SDL_JoystickClose(joystate[2].joy);
if(joysticks[3].enabled)
SDL_JoystickClose(joystate[3].joy);
SDL_Quit();
#ifdef _DEBUG
DEBUG_QUIT();
#endif
delete [] joyinfo;
emulator_running = FALSE;
}
// Set PAD status
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus)
{
if(!joysticks[_numPAD].enabled)
return;
// clear pad status
memset(_pPADStatus, 0, sizeof(SPADStatus));
// get pad status
GetJoyState(_numPAD);
// Reset!
int base = 0x80;
_pPADStatus->stickY = base;
_pPADStatus->stickX = base;
_pPADStatus->substickX = base;
_pPADStatus->substickY = base;
_pPADStatus->button |= PAD_USE_ORIGIN;
// Set analog controllers
// Set Deadzones perhaps out of function
int deadzone = ((float)(128.00/100.00)) * (float)(joysticks[_numPAD].deadzone+1);
int deadzone2 = ((float)(-128.00/100.00)) * (float)(joysticks[_numPAD].deadzone+1);
// Adjust range
// The value returned by SDL_JoystickGetAxis is a signed integer (-32768 to 32768)
// The value used for the gamecube controller is an unsigned char (0 to 255)
int main_stick_x = (joystate[_numPAD].axis[CTL_MAIN_X]>>8);
int main_stick_y = (joystate[_numPAD].axis[CTL_MAIN_Y]>>8);
int sub_stick_x = (joystate[_numPAD].axis[CTL_SUB_X]>>8);
int sub_stick_y = (joystate[_numPAD].axis[CTL_SUB_Y]>>8);
// Quick fix
if(main_stick_x > 127)
main_stick_x = 127;
if(main_stick_y > 127)
main_stick_y = 127;
if(sub_stick_x > 127)
sub_stick_x = 127;
if(sub_stick_y > 127)
sub_stick_y = 127;
if(main_stick_x < -128)
main_stick_x = -128;
if(main_stick_y < -128)
main_stick_y = -128;
if(sub_stick_x < -128)
sub_stick_x = -128;
if(sub_stick_y < -128)
sub_stick_y = -128;
// Send values to Dolpin
if ((main_stick_x < deadzone2) || (main_stick_x > deadzone)) _pPADStatus->stickX += main_stick_x;
if ((main_stick_y < deadzone2) || (main_stick_y > deadzone)) _pPADStatus->stickY -= main_stick_y;
if ((sub_stick_x < deadzone2) || (sub_stick_x > deadzone)) _pPADStatus->substickX += sub_stick_x;
if ((sub_stick_y < deadzone2) || (sub_stick_y > deadzone)) _pPADStatus->substickY -= sub_stick_y;
// Set buttons
if (joystate[_numPAD].buttons[CTL_L_SHOULDER]) _pPADStatus->button|=PAD_TRIGGER_L;
if (joystate[_numPAD].buttons[CTL_R_SHOULDER]) _pPADStatus->button|=PAD_TRIGGER_R;
if (joystate[_numPAD].buttons[CTL_A_BUTTON]) _pPADStatus->button|=PAD_BUTTON_A;
if (joystate[_numPAD].buttons[CTL_B_BUTTON]) _pPADStatus->button|=PAD_BUTTON_B;
if (joystate[_numPAD].buttons[CTL_X_BUTTON]) _pPADStatus->button|=PAD_BUTTON_X;
if (joystate[_numPAD].buttons[CTL_Y_BUTTON]) _pPADStatus->button|=PAD_BUTTON_Y;
if (joystate[_numPAD].buttons[CTL_Z_TRIGGER]) _pPADStatus->button|=PAD_TRIGGER_Z;
if (joystate[_numPAD].buttons[CTL_START]) _pPADStatus->button|=PAD_BUTTON_START;
// Set D-pad
if(joystate[_numPAD].dpad == SDL_HAT_LEFTUP || joystate[_numPAD].dpad == SDL_HAT_UP || joystate[_numPAD].dpad == SDL_HAT_RIGHTUP ) _pPADStatus->button|=PAD_BUTTON_UP;
if(joystate[_numPAD].dpad == SDL_HAT_LEFTUP || joystate[_numPAD].dpad == SDL_HAT_LEFT || joystate[_numPAD].dpad == SDL_HAT_LEFTDOWN ) _pPADStatus->button|=PAD_BUTTON_LEFT;
if(joystate[_numPAD].dpad == SDL_HAT_LEFTDOWN || joystate[_numPAD].dpad == SDL_HAT_DOWN || joystate[_numPAD].dpad == SDL_HAT_RIGHTDOWN ) _pPADStatus->button|=PAD_BUTTON_DOWN;
if(joystate[_numPAD].dpad == SDL_HAT_RIGHTUP || joystate[_numPAD].dpad == SDL_HAT_RIGHT || joystate[_numPAD].dpad == SDL_HAT_RIGHTDOWN ) _pPADStatus->button|=PAD_BUTTON_RIGHT;
_pPADStatus->err = PAD_ERR_NONE;
}
// Set PAD rumble
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void PAD_Rumble(BYTE _numPAD, unsigned int _uType, unsigned int _uStrength)
{
// not supported by SDL
}
// Set PAD attached pads
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
unsigned int PAD_GetAttachedPads()
{
unsigned int connected = 0;
LoadConfig();
if(joysticks[0].enabled)
connected |= 1;
if(joysticks[1].enabled)
connected |= 2;
if(joysticks[2].enabled)
connected |= 4;
if(joysticks[3].enabled)
connected |= 8;
return connected;
}
// Savestates
// ¯¯¯¯¯¯¯¯¯¯
unsigned int SaveLoadState(char *ptr, BOOL save)
{
// not used
return 0;
}
//////////////////////////////////////////////////////////////////////////////////////////
// Custom Functions
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// Request joystick state
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void GetJoyState(int controller)
{
SDL_JoystickUpdate();
joystate[controller].axis[CTL_MAIN_X] = SDL_JoystickGetAxis(joystate[controller].joy, joysticks[controller].axis[CTL_MAIN_X]);
joystate[controller].axis[CTL_MAIN_Y] = SDL_JoystickGetAxis(joystate[controller].joy, joysticks[controller].axis[CTL_MAIN_Y]);
joystate[controller].axis[CTL_SUB_X] = SDL_JoystickGetAxis(joystate[controller].joy, joysticks[controller].axis[CTL_SUB_X]);
joystate[controller].axis[CTL_SUB_Y] = SDL_JoystickGetAxis(joystate[controller].joy, joysticks[controller].axis[CTL_SUB_Y]);
joystate[controller].buttons[CTL_L_SHOULDER] = SDL_JoystickGetButton(joystate[controller].joy, joysticks[controller].buttons[CTL_L_SHOULDER]);
joystate[controller].buttons[CTL_R_SHOULDER] = SDL_JoystickGetButton(joystate[controller].joy, joysticks[controller].buttons[CTL_R_SHOULDER]);
joystate[controller].buttons[CTL_A_BUTTON] = SDL_JoystickGetButton(joystate[controller].joy, joysticks[controller].buttons[CTL_A_BUTTON]);
joystate[controller].buttons[CTL_B_BUTTON] = SDL_JoystickGetButton(joystate[controller].joy, joysticks[controller].buttons[CTL_B_BUTTON]);
joystate[controller].buttons[CTL_X_BUTTON] = SDL_JoystickGetButton(joystate[controller].joy, joysticks[controller].buttons[CTL_X_BUTTON]);
joystate[controller].buttons[CTL_Y_BUTTON] = SDL_JoystickGetButton(joystate[controller].joy, joysticks[controller].buttons[CTL_Y_BUTTON]);
joystate[controller].buttons[CTL_Z_TRIGGER] = SDL_JoystickGetButton(joystate[controller].joy, joysticks[controller].buttons[CTL_Z_TRIGGER]);
joystate[controller].buttons[CTL_START] = SDL_JoystickGetButton(joystate[controller].joy, joysticks[controller].buttons[CTL_START]);
joystate[controller].dpad = SDL_JoystickGetHat(joystate[controller].joy, joysticks[controller].dpad);
}
// Search attached devices
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
int Search_Devices()
{
// load config
#ifdef _DEBUG
DEBUG_INIT();
#endif
int numjoy = SDL_NumJoysticks();
if(numjoy == 0)
{
MessageBox(NULL, "No Joystick detected!", NULL, MB_ICONWARNING);
return 0;
}
if(joyinfo)
{
delete [] joyinfo;
joyinfo = new CONTROLLER_INFO [numjoy];
}
else
{
joyinfo = new CONTROLLER_INFO [numjoy];
}
#ifdef _DEBUG
fprintf(pFile, "Scanning for devices\n");
fprintf(pFile, "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\n");
#endif
for(int i = 0; i < numjoy; i++ )
{
joyinfo[i].joy = SDL_JoystickOpen(i);
joyinfo[i].ID = i;
joyinfo[i].NumAxes = SDL_JoystickNumAxes(joyinfo[i].joy);
joyinfo[i].NumButtons = SDL_JoystickNumButtons(joyinfo[i].joy);
joyinfo[i].NumBalls = SDL_JoystickNumBalls(joyinfo[i].joy);
joyinfo[i].NumHats = SDL_JoystickNumHats(joyinfo[i].joy);
joyinfo[i].Name = SDL_JoystickName(i);
#ifdef _DEBUG
fprintf(pFile, "ID: %d\n", i);
fprintf(pFile, "Name: %s\n", joyinfo[i].Name);
fprintf(pFile, "Buttons: %d\n", joyinfo[i].NumButtons);
fprintf(pFile, "Axes: %d\n", joyinfo[i].NumAxes);
fprintf(pFile, "Hats: %d\n", joyinfo[i].NumHats);
fprintf(pFile, "Balls: %d\n\n", joyinfo[i].NumBalls);
#endif
// Close if opened
if(SDL_JoystickOpened(i))
SDL_JoystickClose(joyinfo[i].joy);
}
return numjoy;
}
// Enable output log
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void DEBUG_INIT()
{
if(pFile)
return;
char dateStr [9];
_strdate( dateStr);
char timeStr [9];
_strtime( timeStr );
pFile = fopen ("nJoy-debug.txt","wt");
fprintf(pFile, "nJoy v"INPUT_VERSION" Debug\n");
fprintf(pFile, "Date: %s\nTime: %s\n", dateStr, timeStr);
fprintf(pFile, "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\n");
}
// Disable output log
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void DEBUG_QUIT()
{
if(!pFile)
return;
char timeStr [9];
_strtime(timeStr);
fprintf(pFile, "_______________\n");
fprintf(pFile, "Time: %s", timeStr);
fclose(pFile);
}
// Save settings to file
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void SaveConfig()
{
IniFile file;
file.SetFile("nJoy");
file.SetSection("PAD1");
file.WriteInt("l_shoulder", joysticks[0].buttons[CTL_L_SHOULDER]);
file.WriteInt("r_shoulder", joysticks[0].buttons[CTL_R_SHOULDER]);
file.WriteInt("a_button", joysticks[0].buttons[CTL_A_BUTTON]);
file.WriteInt("b_button", joysticks[0].buttons[CTL_B_BUTTON]);
file.WriteInt("x_button", joysticks[0].buttons[CTL_X_BUTTON]);
file.WriteInt("y_button", joysticks[0].buttons[CTL_Y_BUTTON]);
file.WriteInt("z_trigger", joysticks[0].buttons[CTL_Z_TRIGGER]);
file.WriteInt("start_button", joysticks[0].buttons[CTL_START]);
file.WriteInt("dpad", joysticks[0].dpad);
file.WriteInt("main_x", joysticks[0].axis[CTL_MAIN_X]);
file.WriteInt("main_y", joysticks[0].axis[CTL_MAIN_Y]);
file.WriteInt("sub_x", joysticks[0].axis[CTL_SUB_X]);
file.WriteInt("sub_y", joysticks[0].axis[CTL_SUB_Y]);
file.WriteInt("enabled", joysticks[0].enabled);
file.WriteInt("deadzone", joysticks[0].deadzone);
file.WriteInt("halfpress", joysticks[0].halfpress);
file.WriteInt("joy_id", joysticks[0].ID);
file.SetSection("PAD2");
file.WriteInt("l_shoulder", joysticks[1].buttons[CTL_L_SHOULDER]);
file.WriteInt("r_shoulder", joysticks[1].buttons[CTL_R_SHOULDER]);
file.WriteInt("a_button", joysticks[1].buttons[CTL_A_BUTTON]);
file.WriteInt("b_button", joysticks[1].buttons[CTL_B_BUTTON]);
file.WriteInt("x_button", joysticks[1].buttons[CTL_X_BUTTON]);
file.WriteInt("y_button", joysticks[1].buttons[CTL_Y_BUTTON]);
file.WriteInt("z_trigger", joysticks[1].buttons[CTL_Z_TRIGGER]);
file.WriteInt("start_button", joysticks[1].buttons[CTL_START]);
file.WriteInt("dpad", joysticks[1].dpad);
file.WriteInt("main_x", joysticks[1].axis[CTL_MAIN_X]);
file.WriteInt("main_y", joysticks[1].axis[CTL_MAIN_Y]);
file.WriteInt("sub_x", joysticks[1].axis[CTL_SUB_X]);
file.WriteInt("sub_y", joysticks[1].axis[CTL_SUB_Y]);
file.WriteInt("enabled", joysticks[1].enabled);
file.WriteInt("deadzone", joysticks[1].deadzone);
file.WriteInt("halfpress", joysticks[1].halfpress);
file.WriteInt("joy_id", joysticks[1].ID);
file.SetSection("PAD3");
file.WriteInt("l_shoulder", joysticks[2].buttons[CTL_L_SHOULDER]);
file.WriteInt("r_shoulder", joysticks[2].buttons[CTL_R_SHOULDER]);
file.WriteInt("a_button", joysticks[2].buttons[CTL_A_BUTTON]);
file.WriteInt("b_button", joysticks[2].buttons[CTL_B_BUTTON]);
file.WriteInt("x_button", joysticks[2].buttons[CTL_X_BUTTON]);
file.WriteInt("y_button", joysticks[2].buttons[CTL_Y_BUTTON]);
file.WriteInt("z_trigger", joysticks[2].buttons[CTL_Z_TRIGGER]);
file.WriteInt("start_button", joysticks[2].buttons[CTL_START]);
file.WriteInt("dpad", joysticks[2].dpad);
file.WriteInt("main_x", joysticks[2].axis[CTL_MAIN_X]);
file.WriteInt("main_y", joysticks[2].axis[CTL_MAIN_Y]);
file.WriteInt("sub_x", joysticks[2].axis[CTL_SUB_X]);
file.WriteInt("sub_y", joysticks[2].axis[CTL_SUB_Y]);
file.WriteInt("enabled", joysticks[2].enabled);
file.WriteInt("deadzone", joysticks[2].deadzone);
file.WriteInt("halfpress", joysticks[2].halfpress);
file.WriteInt("joy_id", joysticks[2].ID);
file.SetSection("PAD4");
file.WriteInt("l_shoulder", joysticks[3].buttons[CTL_L_SHOULDER]);
file.WriteInt("r_shoulder", joysticks[3].buttons[CTL_R_SHOULDER]);
file.WriteInt("a_button", joysticks[3].buttons[CTL_A_BUTTON]);
file.WriteInt("b_button", joysticks[3].buttons[CTL_B_BUTTON]);
file.WriteInt("x_button", joysticks[3].buttons[CTL_X_BUTTON]);
file.WriteInt("y_button", joysticks[3].buttons[CTL_Y_BUTTON]);
file.WriteInt("z_trigger", joysticks[3].buttons[CTL_Z_TRIGGER]);
file.WriteInt("start_button", joysticks[3].buttons[CTL_START]);
file.WriteInt("dpad", joysticks[3].dpad);
file.WriteInt("main_x", joysticks[3].axis[CTL_MAIN_X]);
file.WriteInt("main_y", joysticks[3].axis[CTL_MAIN_Y]);
file.WriteInt("sub_x", joysticks[3].axis[CTL_SUB_X]);
file.WriteInt("sub_y", joysticks[3].axis[CTL_SUB_Y]);
file.WriteInt("enabled", joysticks[3].enabled);
file.WriteInt("deadzone", joysticks[3].deadzone);
file.WriteInt("halfpress", joysticks[3].halfpress);
file.WriteInt("joy_id", joysticks[3].ID);
}
// Load settings from file
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void LoadConfig()
{
IniFile file;
file.SetFile("nJoy");
file.SetSection("PAD1");
joysticks[0].buttons[CTL_L_SHOULDER] = file.ReadInt("l_shoulder", 4);
joysticks[0].buttons[CTL_R_SHOULDER] = file.ReadInt("r_shoulder", 5);
joysticks[0].buttons[CTL_A_BUTTON] = file.ReadInt("a_button", 0);
joysticks[0].buttons[CTL_B_BUTTON] = file.ReadInt("b_button", 1);
joysticks[0].buttons[CTL_X_BUTTON] = file.ReadInt("x_button", 3);
joysticks[0].buttons[CTL_Y_BUTTON] = file.ReadInt("y_button", 2);
joysticks[0].buttons[CTL_Z_TRIGGER] = file.ReadInt("z_trigger", 7);
joysticks[0].buttons[CTL_START] = file.ReadInt("start_button", 9);
joysticks[0].dpad = file.ReadInt("dpad", 0);
joysticks[0].axis[CTL_MAIN_X] = file.ReadInt("main_x", 0);
joysticks[0].axis[CTL_MAIN_Y] = file.ReadInt("main_y", 1);
joysticks[0].axis[CTL_SUB_X] = file.ReadInt("sub_x", 2);
joysticks[0].axis[CTL_SUB_Y] = file.ReadInt("sub_y", 3);
joysticks[0].enabled = file.ReadInt("enabled", 1);
joysticks[0].deadzone = file.ReadInt("deadzone", 9);
joysticks[0].halfpress = file.ReadInt("halfpress", 0);
joysticks[0].ID = file.ReadInt("joy_id", 0);
file.SetSection("PAD2");
joysticks[1].buttons[CTL_L_SHOULDER] = file.ReadInt("l_shoulder", 4);
joysticks[1].buttons[CTL_R_SHOULDER] = file.ReadInt("r_shoulder", 5);
joysticks[1].buttons[CTL_A_BUTTON] = file.ReadInt("a_button", 0);
joysticks[1].buttons[CTL_B_BUTTON] = file.ReadInt("b_button", 1);
joysticks[1].buttons[CTL_X_BUTTON] = file.ReadInt("x_button", 3);
joysticks[1].buttons[CTL_Y_BUTTON] = file.ReadInt("y_button", 2);
joysticks[1].buttons[CTL_Z_TRIGGER] = file.ReadInt("z_trigger", 7);
joysticks[1].buttons[CTL_START] = file.ReadInt("start_button", 9);
joysticks[1].dpad = file.ReadInt("dpad", 0);
joysticks[1].axis[CTL_MAIN_X] = file.ReadInt("main_x", 0);
joysticks[1].axis[CTL_MAIN_Y] = file.ReadInt("main_y", 1);
joysticks[1].axis[CTL_SUB_X] = file.ReadInt("sub_x", 2);
joysticks[1].axis[CTL_SUB_Y] = file.ReadInt("sub_y", 3);
joysticks[1].enabled = file.ReadInt("enabled", 0);
joysticks[1].deadzone = file.ReadInt("deadzone", 9);
joysticks[1].halfpress = file.ReadInt("halfpress", 0);
joysticks[1].ID = file.ReadInt("joy_id", 0);
file.SetSection("PAD3");
joysticks[2].buttons[CTL_L_SHOULDER] = file.ReadInt("l_shoulder", 4);
joysticks[2].buttons[CTL_R_SHOULDER] = file.ReadInt("r_shoulder", 5);
joysticks[2].buttons[CTL_A_BUTTON] = file.ReadInt("a_button", 0);
joysticks[2].buttons[CTL_B_BUTTON] = file.ReadInt("b_button", 1);
joysticks[2].buttons[CTL_X_BUTTON] = file.ReadInt("x_button", 3);
joysticks[2].buttons[CTL_Y_BUTTON] = file.ReadInt("y_button", 2);
joysticks[2].buttons[CTL_Z_TRIGGER] = file.ReadInt("z_trigger", 7);
joysticks[2].buttons[CTL_START] = file.ReadInt("start_button", 9);
joysticks[2].dpad = file.ReadInt("dpad", 0);
joysticks[2].axis[CTL_MAIN_X] = file.ReadInt("main_x", 0);
joysticks[2].axis[CTL_MAIN_Y] = file.ReadInt("main_y", 1);
joysticks[2].axis[CTL_SUB_X] = file.ReadInt("sub_x", 2);
joysticks[2].axis[CTL_SUB_Y] = file.ReadInt("sub_y", 3);
joysticks[2].enabled = file.ReadInt("enabled", 0);
joysticks[2].deadzone = file.ReadInt("deadzone", 9);
joysticks[2].halfpress = file.ReadInt("halfpress", 0);
joysticks[2].ID = file.ReadInt("joy_id", 0);
file.SetSection("PAD4");
joysticks[3].buttons[CTL_L_SHOULDER] = file.ReadInt("l_shoulder", 4);
joysticks[3].buttons[CTL_R_SHOULDER] = file.ReadInt("r_shoulder", 5);
joysticks[3].buttons[CTL_A_BUTTON] = file.ReadInt("a_button", 0);
joysticks[3].buttons[CTL_B_BUTTON] = file.ReadInt("b_button", 1);
joysticks[3].buttons[CTL_X_BUTTON] = file.ReadInt("x_button", 3);
joysticks[3].buttons[CTL_Y_BUTTON] = file.ReadInt("y_button", 2);
joysticks[3].buttons[CTL_Z_TRIGGER] = file.ReadInt("z_trigger", 7);
joysticks[3].buttons[CTL_START] = file.ReadInt("start_button", 9);
joysticks[3].dpad = file.ReadInt("dpad", 0);
joysticks[3].axis[CTL_MAIN_X] = file.ReadInt("main_x", 0);
joysticks[3].axis[CTL_MAIN_Y] = file.ReadInt("main_y", 1);
joysticks[3].axis[CTL_SUB_X] = file.ReadInt("sub_x", 2);
joysticks[3].axis[CTL_SUB_Y] = file.ReadInt("sub_y", 3);
joysticks[3].enabled = file.ReadInt("enabled", 0);
joysticks[3].deadzone = file.ReadInt("deadzone", 9);
joysticks[3].halfpress = file.ReadInt("halfpress", 0);
joysticks[3].ID = file.ReadInt("joy_id", 0);
}

View File

@ -1,116 +0,0 @@
//////////////////////////////////////////////////////////////////////////////////////////
// Project description
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// Name: nJoy
// Description: A Dolphin Compatible Input Plugin
//
// Author: Falcon4ever (nJoy@falcon4ever.com)
// Site: www.multigesture.net
// Copyright (C) 2003-2008 Dolphin Project.
//
//////////////////////////////////////////////////////////////////////////////////////////
//
// Licensetype: GNU General Public License (GPL)
//
// This program 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 Foundation, version 2.0.
//
// This program 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 2.0 for more details.
//
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
//
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
//
//////////////////////////////////////////////////////////////////////////////////////////
#define _CRT_SECURE_NO_WARNINGS
#define WIN32_LEAN_AND_MEAN
#include <tchar.h>
#include <vector>
#include <stdio.h>
#include <time.h>
#include <SDL.h> // includes SDL
#include "pluginspecs_pad.h"
#include "config.h"
#include "IniFile.h"
#pragma comment(lib, "SDL.lib")
// #pragma comment(lib, "SDLmain.lib")
//////////////////////////////////////////////////////////////////////////////////////////
// Define
// ¯¯¯¯¯¯
#define INPUT_VERSION "0.3"
#define INPUT_STATE "PUBLIC RELEASE"
#define RELDAY "21"
#define RELMONTH "07"
#define RELYEAR "2008"
#define THANKYOU "`plot`, Absolute0, Aprentice, Bositman, Brice, ChaosCode, CKemu, CoDeX, Dave2001, dn, drk||Raziel, Florin, Gent, Gigaherz, Hacktarux, JegHegy, Linker, Linuzappz, Martin64, Muad, Knuckles, Raziel, Refraction, Rudy_x, Shadowprince, Snake785, Saqib, vEX, yaz0r, Zilmar, Zenogais and ZeZu."
struct CONTROLLER_STATE{ // GC PAD INFO/STATE
int buttons[8]; // Amount of buttons (A B X Y Z, L-Trigger R-Trigger Start) might need to change the triggers buttons
int dpad; // 1 HAT (8 directions + neutral)
int axis[4]; // 2 x 2 Axes (Main & Sub)
SDL_Joystick *joy; // SDL joystick device
};
struct CONTROLLER_MAPPING{ // GC PAD MAPPING
int buttons[8]; // Amount of buttons (A B X Y Z, L-Trigger R-Trigger Start) might need to change the triggers buttons
int dpad; // 1 HAT (8 directions + neutral)
int axis[4]; // 2 x 2 Axes (Main & Sub)
int enabled; // Pad attached?
int deadzone; // Deadzone... what else?
int halfpress; // Not implemented
int ID; // SDL joystick device ID
};
struct CONTROLLER_INFO{ // 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
};
enum
{
CTL_MAIN_X = 0,
CTL_MAIN_Y,
CTL_SUB_X,
CTL_SUB_Y,
};
enum
{
CTL_L_SHOULDER = 0,
CTL_R_SHOULDER,
CTL_A_BUTTON,
CTL_B_BUTTON,
CTL_X_BUTTON,
CTL_Y_BUTTON,
CTL_Z_TRIGGER,
CTL_START
};
//////////////////////////////////////////////////////////////////////////////////////////
// Custom Functions
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void GetJoyState(int controller);
int Search_Devices();
void DEBUG_INIT();
void DEBUG_QUIT();
void SaveConfig();
void LoadConfig();

View File

@ -1,115 +0,0 @@
nJoy v0.3 by Falcon4ever 2008
A Dolphin Compatible Input Plugin
Copyright (C) 2003-2008 Dolphin Project.
Changelog
==========================================================================
0.3: 3nd version of nJoy
- Release: July 2008
- Support for four players
- Misc. improvements
0.2: 2nd version of nJoy
- Release: 14th July 2005
- Now using SDL instead of DirectInput9
- Config/INI support
- Adjustable deadzone
- First public release
0.1: First version of nJoy
- Private Release: january 2005
- Using DirectInput9
- Specially made for the Logitech Rumblepad 2, but other joypads work too
- Advanced debug window, activated during gameplay
- No deadzone configurable
- No config/Ini
The Author
==========================================================================
* Falcon4ever (nJoy@falcon4ever.com)
System and Software Requirements
==========================================================================
Dolphin
The latest Dolphin release, avaible at www.dolphin-emu.com
SDL.dll (SDL-1.2.13)
(included with this release)
latest version avaible at www.libsdl.org
A Joystick
A Windows 9x compatible input device
Plugin Information
==========================================================================
nJoy was written in C++, compiled with Microsoft Visual Studio 2005 Professional Edition.
nJoy uses SDL for joysticks, mouse and keyboard.
For the graphical interface plain Win32 code was used.
How to install
==========================================================================
Just unzip the content of the zipfile to your dolphin plugin dir and place
sdl.dll in the root dir.
example config:
[C:]
|
+-Dolphin Dir
+-DolphinWx.exe File
+-SDL.dll File
|
+-Plugins Dir
+-nJoy.dll File
FAQ
==========================================================================
What's SDL???
SDL is the Simple DirectMedia Layer written by Sam Lantinga.
It provides an API for audio, video, input ...
For more information go to http://www.libsdl.org/
Where can I download the latest releases???
nJoy will be released @ www.multigesture.net
Can I mirror this file???
Sure, just don't forget to add a link to:
www.multigesture.net OR www.dolphin-emu.com
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Why should I use nJoy instead of the default input plugin???
At this moment the default plugin only supports keyboard input.
nJoy supports Joysticks. And besides that, if you have an GC-adapter
you can use your original GC controllers with dolphin !
Could you add [insert feature here] please???
no.
But perhaps...
NO!
Hmm... There is coming smoke out of my pc, wtf?
err, this plugin comes without any warranty,
use it at own risk :)
What should I do if my question isn't listed here???
Just panic, call 911 or leave a message on:
(1) Emutalk http://www.emutalk.net/forumdisplay.php?f=100
(2) NGemu http://forums.ngemu.com/dolphin-discussion/
Thanks / Greetings
==========================================================================
Special Thanks too:
F|RES & ector
Greetings too:
`plot`, Absolute0, Aprentice, Bositman, Brice, ChaosCode, CKemu,
CoDeX, Dave2001, dn, drk||Raziel, Florin, Gent, Gigaherz, Hacktarux,
icepir8, JegHegy, Linker, Linuzappz, Martin64, Muad, Knuckles, Raziel,
Refraction, Rudy_x, Shadowprince, Snake785, Saqib, vEX, yaz0r,
Zilmar, Zenogais and ZeZu.
AAaannd everyone else I forgot ;)...

View File

@ -1,60 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Plugin_nJoy_SDL.rc
//
#define IDD_CONFIG 101
#define IDB_BITMAP1 102
#define IDD_ABOUT 103
#define IDB_BITMAP2 104
#define IDC_JOYNAME 1001
#define IDC_JOYATTACH 1002
#define IDC_SHOULDERL 1010
#define IDC_SHOULDERR 1011
#define IDC_A 1012
#define IDC_B 1013
#define IDC_X 1014
#define IDC_Y 1015
#define IDC_Z 1016
#define IDC_START 1017
#define IDC_DPAD 1018
#define IDC_MX 1019
#define IDC_MY 1020
#define IDC_SX 1021
#define IDC_SY 1022
#define IDC_DEADZONE 1023
#define IDC_HALFPRESS 1024
#define IDTEXT_SHOULDERL 2010
#define IDTEXT_SHOULDERR 2011
#define IDTEXT_A 2012
#define IDTEXT_B 2013
#define IDTEXT_X 2014
#define IDTEXT_Y 2015
#define IDTEXT_Z 2016
#define IDTEXT_START 2017
#define IDTEXT_DPAD 2018
#define IDTEXT_MX 2019
#define IDTEXT_MY 2020
#define IDTEXT_SX 2021
#define IDTEXT_SY 2022
#define IDC_ABOUT_TEXT 1032
#define IDC_ABOUT_TEXT2 1033
#define IDC_ABOUT_TEXT3 1034
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1036
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif