removed the failed gltest code
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4238 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
c1665ec6cd
commit
bc6323ea0e
|
@ -81,7 +81,6 @@ dirs = [
|
|||
'Source/Plugins/Plugin_DSP_HLE/Src',
|
||||
'Source/Plugins/Plugin_DSP_LLE/Src',
|
||||
'Source/Plugins/Plugin_PadSimple/Src',
|
||||
'Source/Plugins/Plugin_PadSimpleEvnt/Src',
|
||||
'Source/Plugins/Plugin_nJoy_SDL/Src',
|
||||
'Source/Plugins/Plugin_Wiimote/Src',
|
||||
'Source/Core/DolphinWX/Src',
|
||||
|
@ -109,7 +108,6 @@ vars.AddVariables(
|
|||
BoolVariable('nowx', 'Set For Building with no WX libs (WIP)', False),
|
||||
BoolVariable('wxgl', 'Set For Building with WX GL libs (WIP)', False),
|
||||
BoolVariable('sdlgl', 'Set For Building with SDL GL libs (WIP)', False),
|
||||
BoolVariable('gltest', 'temp don\'t use (WIP)', False),
|
||||
BoolVariable('jittest', 'temp don\'t use (WIP)', False),
|
||||
BoolVariable('nojit', 'Remove entire jit cores', False),
|
||||
EnumVariable('flavor', 'Choose a build flavor', 'release',
|
||||
|
@ -304,12 +302,6 @@ if env['sdlgl']:
|
|||
env['HAVE_COCOA'] = 0
|
||||
env['USE_WX'] = 0
|
||||
|
||||
env['GLTEST'] = 0
|
||||
if env['gltest']:
|
||||
env['GLTEST'] = 1
|
||||
|
||||
conf.Define('GLTEST', env['GLTEST'])
|
||||
|
||||
env['JITTEST'] = 0
|
||||
if env['jittest']:
|
||||
env['JITTEST'] = 1
|
||||
|
|
|
@ -1,658 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="Plugin_PadSimpleEvnt"
|
||||
ProjectGUID="{58E81545-241B-416E-8088-E62452EB25FA}"
|
||||
RootNamespace="Plugin_PadSimpleEvnt"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Release/Pad_Simple.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\Core\Common\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
EnableFunctionLevelLinking="true"
|
||||
EnableEnhancedInstructionSet="2"
|
||||
FloatingPointModel="0"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
|
||||
AssemblerListingLocation="$(IntDir)\"
|
||||
ObjectFile="$(IntDir)\"
|
||||
ProgramDataBaseFileName="$(IntDir)\"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
ForcedIncludeFiles="stdafx.h"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1053"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="comctl32.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib"
|
||||
OutputFile="..\..\..\Binary\Win32\plugins\Plugin_PadSimpleEvnt.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=";..\..\..\Externals\wxWidgets\lib\vc_lib\Win32"
|
||||
GenerateManifest="false"
|
||||
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(PlatformName)\$(ConfigurationName)\$(TargetName).lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="3"
|
||||
TypeLibraryName=".\Release/Pad_Simple.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\Core\Common\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
|
||||
PreprocessorDefinitions="_SECURE_SCL=0;WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;__WXMSW__;NOPCH"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
EnableFunctionLevelLinking="true"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
FloatingPointModel="0"
|
||||
UsePrecompiledHeader="1"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
|
||||
AssemblerListingLocation="$(IntDir)\"
|
||||
ObjectFile="$(IntDir)\"
|
||||
ProgramDataBaseFileName="$(IntDir)\"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
ForcedIncludeFiles="stdafx.h"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1053"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="comctl32.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib"
|
||||
OutputFile="..\..\..\Binary\x64\plugins\Plugin_PadSimpleEvnt.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\..\Externals\wxWidgets\lib\vc_lib\x64"
|
||||
GenerateManifest="false"
|
||||
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
|
||||
LinkTimeCodeGeneration="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(PlatformName)\$(ConfigurationName)\$(TargetName).lib"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Debug/Pad_Simple.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\Core\Common\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
FloatingPointModel="0"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
|
||||
AssemblerListingLocation="$(IntDir)\"
|
||||
ObjectFile="$(IntDir)\"
|
||||
ProgramDataBaseFileName="$(IntDir)\"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
ForcedIncludeFiles="stdafx.h"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1053"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="comctl32.lib winmm.lib rpcrt4.lib wxbase28ud.lib wxmsw28ud_core.lib "
|
||||
OutputFile="..\..\..\Binary\Win32/plugins\Plugin_PadSimpleEvntD.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=";..\..\..\Externals\wxWidgets\lib\vc_lib\Win32"
|
||||
GenerateManifest="false"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(PlatformName)\$(ConfigurationName)\$(TargetName).lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="3"
|
||||
TypeLibraryName=".\Debug/Pad_Simple.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\Core\Common\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
|
||||
PreprocessorDefinitions="_SECURE_SCL=0;WIN32;_DEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
FloatingPointModel="0"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
|
||||
AssemblerListingLocation="$(IntDir)\"
|
||||
ObjectFile="$(IntDir)\"
|
||||
ProgramDataBaseFileName="$(IntDir)\"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
ForcedIncludeFiles="stdafx.h"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1053"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="comctl32.lib winmm.lib rpcrt4.lib wxbase28ud.lib wxmsw28ud_core.lib "
|
||||
OutputFile="..\..\..\Binary\x64\plugins\Plugin_PadSimpleEvntD.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\..\Externals\wxWidgets\lib\vc_lib\x64"
|
||||
GenerateManifest="false"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(PlatformName)\$(ConfigurationName)\$(TargetName).lib"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="DebugFast|Win32"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Release/Pad_Simple.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\Core\Common\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;DEBUGFAST;_SECURE_SCL=0"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
EnableFunctionLevelLinking="true"
|
||||
EnableEnhancedInstructionSet="2"
|
||||
FloatingPointModel="0"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
|
||||
AssemblerListingLocation="$(IntDir)\"
|
||||
ObjectFile="$(IntDir)\"
|
||||
ProgramDataBaseFileName="$(IntDir)\"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
ForcedIncludeFiles="stdafx.h"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1053"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="comctl32.lib winmm.lib rpcrt4.lib wxbase28u.lib wxmsw28u_core.lib"
|
||||
OutputFile="..\..\..\Binary\Win32\plugins\Plugin_PadSimpleEvntDF.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=";..\..\..\Externals\wxWidgets\lib\vc_lib\Win32"
|
||||
GenerateManifest="false"
|
||||
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(PlatformName)\$(ConfigurationName)\$(TargetName).lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="DebugFast|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="3"
|
||||
TypeLibraryName=".\Release/Pad_Simple.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\Core\Common\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
|
||||
PreprocessorDefinitions="_SECURE_SCL=0;WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;DEBUGFAST"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
EnableFunctionLevelLinking="true"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
FloatingPointModel="0"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
|
||||
AssemblerListingLocation="$(IntDir)\"
|
||||
ObjectFile="$(IntDir)\"
|
||||
ProgramDataBaseFileName="$(IntDir)\"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
ForcedIncludeFiles="stdafx.h"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1053"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="comctl32.lib winmm.lib rpcrt4.lib wxbase28u.lib wxmsw28u_core.lib"
|
||||
OutputFile="..\..\..\Binary\x64\plugins\Plugin_PadSimpleEvntDF.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\..\Externals\wxWidgets\lib\vc_lib\x64"
|
||||
GenerateManifest="false"
|
||||
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(PlatformName)\$(ConfigurationName)\$(TargetName).lib"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="GUI"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Src\GUI\ConfigDlg.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\GUI\ConfigDlg.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\Src\PadSimple.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\PadSimple.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\PluginSpecs\pluginspecs_pad.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\SConscript"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -1,247 +0,0 @@
|
|||
// Copyright (C) 2003 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/
|
||||
|
||||
|
||||
#include "ConfigDlg.h"
|
||||
#include "../PadSimple.h"
|
||||
#include "EventHandler.h"
|
||||
|
||||
BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
|
||||
EVT_CLOSE(ConfigDialog::OnClose)
|
||||
EVT_BUTTON(ID_CLOSE,ConfigDialog::OnCloseClick)
|
||||
EVT_BUTTON(ID_PAD_ABOUT,ConfigDialog::DllAbout)
|
||||
EVT_CHECKBOX(ID_ATTACHED,ConfigDialog::ControllerSettingsChanged)
|
||||
EVT_CHECKBOX(ID_X360PAD,ConfigDialog::ControllerSettingsChanged)
|
||||
EVT_CHOICE(ID_X360PAD_CHOICE,ConfigDialog::ControllerSettingsChanged)
|
||||
EVT_CHECKBOX(ID_RUMBLE,ConfigDialog::ControllerSettingsChanged)
|
||||
EVT_CHECKBOX(ID_DISABLE,ConfigDialog::ControllerSettingsChanged)
|
||||
EVT_BUTTON(CTL_A,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_B,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_X,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_Y,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_Z,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_START,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_L,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_R,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_MAINUP,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_MAINDOWN,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_MAINLEFT,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_MAINRIGHT,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_SUBUP,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_SUBDOWN,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_SUBLEFT,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_SUBRIGHT,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_DPADUP,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_DPADDOWN,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_DPADLEFT,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_DPADRIGHT,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_HALFPRESS,ConfigDialog::OnButtonClick)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
|
||||
: wxDialog(parent, id, title, position, size, style)
|
||||
{
|
||||
clickedButton = NULL;
|
||||
CreateGUIControls();
|
||||
Fit();
|
||||
}
|
||||
|
||||
ConfigDialog::~ConfigDialog()
|
||||
{
|
||||
}
|
||||
|
||||
inline void AddControl(wxPanel *pan, wxButton **button, wxStaticBoxSizer *sizer,
|
||||
const char *name, int ctl, int controller) {
|
||||
wxBoxSizer *hButton = new wxBoxSizer(wxHORIZONTAL);
|
||||
char keyStr[10] = {0};
|
||||
|
||||
hButton->Add(new wxStaticText(pan, 0, wxString::FromAscii(name),
|
||||
wxDefaultPosition, wxDefaultSize), 0,
|
||||
wxALIGN_CENTER_VERTICAL|wxALL);
|
||||
((EventHandler *)globals->eventHandler)->SFKeyToString
|
||||
(pad[controller].keyForControl[ctl], keyStr);
|
||||
|
||||
*button = new wxButton(pan, ctl, wxString::FromAscii(keyStr),
|
||||
wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS);
|
||||
|
||||
hButton->Add(*button, 0, wxALIGN_RIGHT|wxALL);
|
||||
|
||||
sizer->Add(hButton, 0, wxALIGN_RIGHT|wxALL);
|
||||
}
|
||||
|
||||
void ConfigDialog::CreateGUIControls() {
|
||||
// Notebook
|
||||
m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
// Controller pages
|
||||
m_Controller[0] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE1, wxDefaultPosition, wxDefaultSize);
|
||||
m_Notebook->AddPage(m_Controller[0], wxT("Controller 1"));
|
||||
m_Controller[1] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE2, wxDefaultPosition, wxDefaultSize);
|
||||
m_Notebook->AddPage(m_Controller[1], wxT("Controller 2"));
|
||||
m_Controller[2] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE3, wxDefaultPosition, wxDefaultSize);
|
||||
m_Notebook->AddPage(m_Controller[2], wxT("Controller 3"));
|
||||
m_Controller[3] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE4, wxDefaultPosition, wxDefaultSize);
|
||||
m_Notebook->AddPage(m_Controller[3], wxT("Controller 4"));
|
||||
|
||||
// Standard buttons
|
||||
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_About = new wxButton(this, ID_PAD_ABOUT, wxT("About"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
|
||||
// Put notebook and standard buttons in sizers
|
||||
wxBoxSizer* sSButtons;
|
||||
sSButtons = new wxBoxSizer(wxHORIZONTAL);
|
||||
sSButtons->Add(m_About,0,wxALL, 5);
|
||||
sSButtons->Add(0, 0, 1, wxEXPAND, 5);
|
||||
sSButtons->Add(m_Close, 0, wxALL, 5);
|
||||
|
||||
wxBoxSizer* sMain;
|
||||
sMain = new wxBoxSizer(wxVERTICAL);
|
||||
sMain->Add(m_Notebook, 1, wxEXPAND|wxALL, 5);
|
||||
sMain->Add(sSButtons, 0, wxEXPAND, 5);
|
||||
|
||||
this->SetSizer(sMain);
|
||||
this->Layout();
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
sbDevice[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Controller Settings"));
|
||||
sDevice[i] = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_Attached[i] = new wxCheckBox(m_Controller[i], ID_ATTACHED, wxT("Controller attached"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_Disable[i] = new wxCheckBox(m_Controller[i], ID_DISABLE, wxT("Disable when Dolphin is not in focus"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_Attached[i]->SetValue(pad[i].bAttached);
|
||||
m_Disable[i]->SetValue(pad[i].bDisable);
|
||||
|
||||
sDevice[i]->Add(m_Attached[i], 0, wxEXPAND|wxALL, 1);
|
||||
sDevice[i]->AddStretchSpacer();
|
||||
sDevice[i]->Add(m_Disable[i], 0, wxEXPAND|wxALL, 1);
|
||||
sbDevice[i]->Add(sDevice[i], 0, wxEXPAND|wxALL, 1);
|
||||
|
||||
sButtons[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Buttons"));
|
||||
|
||||
AddControl(m_Controller[i], &(m_ButtonA[i]), sButtons[i], "A: ", CTL_A, i);
|
||||
AddControl(m_Controller[i], &(m_ButtonB[i]), sButtons[i], "B: ", CTL_B, i);
|
||||
AddControl(m_Controller[i], &(m_ButtonX[i]), sButtons[i], "X: ", CTL_X, i);
|
||||
AddControl(m_Controller[i], &(m_ButtonY[i]), sButtons[i], "Y: ", CTL_Y, i);
|
||||
AddControl(m_Controller[i], &(m_ButtonZ[i]), sButtons[i], "Z: ", CTL_Z, i);
|
||||
AddControl(m_Controller[i], &(m_ButtonStart[i]), sButtons[i], "Start: ", CTL_START, i);
|
||||
|
||||
sTriggers[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Triggers"));
|
||||
|
||||
AddControl(m_Controller[i], &(m_ButtonL[i]), sTriggers[i], " L: ", CTL_L, i);
|
||||
AddControl(m_Controller[i], &(m_ButtonR[i]), sTriggers[i], " R: ", CTL_R, i);
|
||||
|
||||
sModifiers[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Modifiers"));
|
||||
|
||||
AddControl(m_Controller[i], &(m_HalfPress[i]), sModifiers[i], "1/2 Press: ", CTL_HALFPRESS, i);
|
||||
|
||||
sStick[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Main Stick"));
|
||||
|
||||
AddControl(m_Controller[i], &(m_StickUp[i]), sStick[i], "Up: ", CTL_MAINUP, i);
|
||||
AddControl(m_Controller[i], &(m_StickDown[i]), sStick[i], "Down: ", CTL_MAINDOWN, i);
|
||||
AddControl(m_Controller[i], &(m_StickLeft[i]), sStick[i], "Left: ", CTL_MAINLEFT, i);
|
||||
AddControl(m_Controller[i], &(m_StickRight[i]), sStick[i], "Right: ", CTL_MAINRIGHT, i);
|
||||
|
||||
sDPad[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("D-Pad"));
|
||||
|
||||
AddControl(m_Controller[i], &(m_DPadUp[i]), sDPad[i], "Up: ", CTL_DPADUP, i);
|
||||
AddControl(m_Controller[i], &(m_DPadDown[i]), sDPad[i], "Down: ", CTL_DPADDOWN, i);
|
||||
AddControl(m_Controller[i], &(m_DPadLeft[i]), sDPad[i], "Left: ", CTL_DPADLEFT, i);
|
||||
AddControl(m_Controller[i], &(m_DPadRight[i]), sDPad[i], "Right: ", CTL_DPADRIGHT, i);
|
||||
|
||||
sCStick[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("C-Stick"));
|
||||
|
||||
AddControl(m_Controller[i], &(m_CStickUp[i]), sCStick[i], "Up: ", CTL_SUBUP, i);
|
||||
AddControl(m_Controller[i], &(m_CStickDown[i]), sCStick[i], "Down: ", CTL_SUBDOWN, i);
|
||||
AddControl(m_Controller[i], &(m_CStickLeft[i]), sCStick[i], "Left: ", CTL_SUBLEFT, i);
|
||||
AddControl(m_Controller[i], &(m_CStickRight[i]), sCStick[i], "Right: ", CTL_SUBRIGHT, i);
|
||||
|
||||
sPage[i] = new wxGridBagSizer(0, 0);
|
||||
sPage[i]->SetFlexibleDirection(wxBOTH);
|
||||
sPage[i]->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
||||
sPage[i]->Add(sbDevice[i], wxGBPosition(0, 0), wxGBSpan(1, 5), wxEXPAND|wxALL, 1);
|
||||
sPage[i]->Add(sButtons[i], wxGBPosition(1, 0), wxGBSpan(2, 1), wxALL, 1);
|
||||
sPage[i]->Add(sTriggers[i], wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 1);
|
||||
sPage[i]->Add(sModifiers[i], wxGBPosition(2, 1), wxGBSpan(1, 1), wxALL, 1);
|
||||
sPage[i]->Add(sStick[i], wxGBPosition(1, 2), wxGBSpan(2, 1), wxALL, 1);
|
||||
sPage[i]->Add(sDPad[i], wxGBPosition(1, 3), wxGBSpan(2, 1), wxALL, 1);
|
||||
sPage[i]->Add(sCStick[i], wxGBPosition(1, 4), wxGBSpan(2, 1), wxALL, 1);
|
||||
m_Controller[i]->SetSizer(sPage[i]);
|
||||
sPage[i]->Layout();
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigDialog::OnClose(wxCloseEvent& event) {
|
||||
EndModal(0);
|
||||
}
|
||||
|
||||
void ConfigDialog::OnKeyDown(wxKeyEvent& event) {
|
||||
if(clickedButton != NULL) {
|
||||
int page = m_Notebook->GetSelection();
|
||||
EventHandler *eventHandler = (EventHandler *)globals->eventHandler;
|
||||
fprintf(stderr, "Got key code %d\n",event.GetKeyCode());
|
||||
sf::Key::Code sfcode = eventHandler->wxCharCodeToSF(event.GetKeyCode());
|
||||
char sfstr[100];
|
||||
eventHandler->SFKeyToString(sfcode, sfstr);
|
||||
|
||||
if (registerKey(page, clickedButton->GetId(), sfcode))
|
||||
clickedButton->SetLabel(wxString::FromAscii(sfstr));
|
||||
clickedButton->Disconnect();
|
||||
}
|
||||
|
||||
clickedButton = NULL;
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void ConfigDialog::OnCloseClick(wxCommandEvent& event)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
void ConfigDialog::ControllerSettingsChanged(wxCommandEvent& event)
|
||||
{
|
||||
int page = m_Notebook->GetSelection();
|
||||
|
||||
switch (event.GetId()) {
|
||||
case ID_ATTACHED:
|
||||
pad[page].bAttached = m_Attached[page]->GetValue();
|
||||
break;
|
||||
case ID_DISABLE:
|
||||
pad[page].bDisable = m_Disable[page]->GetValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigDialog::OnButtonClick(wxCommandEvent& event)
|
||||
{
|
||||
if(clickedButton) {
|
||||
clickedButton->SetLabel(oldLabel);
|
||||
}
|
||||
clickedButton = (wxButton *)event.GetEventObject();
|
||||
oldLabel = clickedButton->GetLabel();
|
||||
clickedButton->SetLabel(_("Press Key"));
|
||||
|
||||
clickedButton->Connect(wxID_ANY, wxEVT_KEY_DOWN,
|
||||
wxKeyEventHandler(ConfigDialog::OnKeyDown),
|
||||
(wxObject*)NULL, this);
|
||||
}
|
||||
void ConfigDialog::DllAbout(wxCommandEvent& event)
|
||||
{
|
||||
wxString message;
|
||||
message = _("A simple keyboard plugin for dolphin.");
|
||||
|
||||
wxMessageBox(_T("Dolphin PadSimple Event Plugin\nBy ector and F|RES\n\n" + message),
|
||||
_T("Dolphin PadSimple Event"), wxOK, this);
|
||||
}
|
|
@ -1,119 +0,0 @@
|
|||
// Copyright (C) 2003 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/
|
||||
|
||||
#ifndef __CONFIGDLG_H__
|
||||
#define __CONFIGDLG_H__
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/gbsizer.h>
|
||||
|
||||
class ConfigDialog : public wxDialog
|
||||
{
|
||||
|
||||
|
||||
public:
|
||||
ConfigDialog(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Pad Configuration"),
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE);
|
||||
|
||||
virtual ~ConfigDialog();
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
wxNotebook *m_Notebook;
|
||||
wxPanel *m_Controller[4];
|
||||
wxButton *m_About;
|
||||
wxButton *m_Close;
|
||||
|
||||
wxStaticBoxSizer *sbDevice[4];
|
||||
wxBoxSizer *sDevice[4];
|
||||
wxGridBagSizer *sPage[4];
|
||||
wxStaticBoxSizer *sButtons[4];
|
||||
wxStaticBoxSizer *sTriggers[4];
|
||||
wxStaticBoxSizer *sModifiers[4];
|
||||
wxStaticBoxSizer *sStick[4];
|
||||
wxStaticBoxSizer *sCStick[4];
|
||||
wxStaticBoxSizer *sDPad[4];
|
||||
|
||||
wxArrayString arrayStringFor_X360Pad;
|
||||
wxCheckBox *m_X360Pad[4];
|
||||
wxChoice *m_X360PadC[4];
|
||||
wxCheckBox *m_Attached[4];
|
||||
wxCheckBox *m_Disable[4];
|
||||
wxCheckBox *m_Rumble[4];
|
||||
|
||||
wxButton *m_ButtonA[4];
|
||||
wxButton *m_ButtonB[4];
|
||||
wxButton *m_ButtonX[4];
|
||||
wxButton *m_ButtonY[4];
|
||||
wxButton *m_ButtonZ[4];
|
||||
wxButton *m_ButtonStart[4];
|
||||
wxButton *m_ButtonL[4];
|
||||
wxButton *m_ButtonR[4];
|
||||
wxButton *m_HalfPress[4];
|
||||
wxButton *m_StickUp[4];
|
||||
wxButton *m_StickDown[4];
|
||||
wxButton *m_StickLeft[4];
|
||||
wxButton *m_StickRight[4];
|
||||
wxButton *m_CStickUp[4];
|
||||
wxButton *m_CStickDown[4];
|
||||
wxButton *m_CStickLeft[4];
|
||||
wxButton *m_CStickRight[4];
|
||||
wxButton *m_DPadUp[4];
|
||||
wxButton *m_DPadDown[4];
|
||||
wxButton *m_DPadLeft[4];
|
||||
wxButton *m_DPadRight[4];
|
||||
|
||||
enum
|
||||
{
|
||||
////GUI Enum Control ID Start
|
||||
ID_CLOSE = 1000,
|
||||
ID_NOTEBOOK,
|
||||
ID_CONTROLLERPAGE1,
|
||||
ID_CONTROLLERPAGE2,
|
||||
ID_CONTROLLERPAGE3,
|
||||
ID_CONTROLLERPAGE4,
|
||||
|
||||
ID_X360PAD_CHOICE,
|
||||
ID_X360PAD,
|
||||
ID_ATTACHED,
|
||||
ID_DISABLE,
|
||||
ID_RUMBLE,
|
||||
ID_PAD_ABOUT
|
||||
};
|
||||
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void CreateGUIControls();
|
||||
void OnCloseClick(wxCommandEvent& event);
|
||||
void OnKeyDown(wxKeyEvent& event);
|
||||
void ControllerSettingsChanged(wxCommandEvent& event);
|
||||
void OnButtonClick(wxCommandEvent& event);
|
||||
void DllAbout(wxCommandEvent& event);
|
||||
|
||||
int keyPress;
|
||||
wxButton *clickedButton;
|
||||
wxString oldLabel;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,434 +0,0 @@
|
|||
// Copyright (C) 2003 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/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
#include "pluginspecs_pad.h"
|
||||
#include "PadSimple.h"
|
||||
#include "IniFile.h"
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
#include "GUI/ConfigDlg.h"
|
||||
#endif
|
||||
|
||||
// Control names
|
||||
static const char* controlNames[] =
|
||||
{
|
||||
"A_button",
|
||||
"B_button",
|
||||
"X_button",
|
||||
"Y_button",
|
||||
"Z_trigger",
|
||||
"Start",
|
||||
"L_button",
|
||||
"R_button",
|
||||
"Main_stick_up",
|
||||
"Main_stick_down",
|
||||
"Main_stick_left",
|
||||
"Main_stick_right",
|
||||
"Sub_stick_up",
|
||||
"Sub_stick_down",
|
||||
"Sub_stick_left",
|
||||
"Sub_stick_right",
|
||||
"D-Pad_up",
|
||||
"D-Pad_down",
|
||||
"D-Pad_left",
|
||||
"D-Pad_right",
|
||||
"half_press_toggle",
|
||||
"Mic-button",
|
||||
};
|
||||
|
||||
PLUGIN_GLOBALS* globals = NULL;
|
||||
|
||||
SPads pad[4];
|
||||
bool KeyStatus[NUMCONTROLS];
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
SPADInitialize g_PADInitialize;
|
||||
|
||||
#define RECORD_SIZE (1024 * 128)
|
||||
SPADStatus recordBuffer[RECORD_SIZE];
|
||||
int count = 0;
|
||||
|
||||
void RecordInput(const SPADStatus& _rPADStatus)
|
||||
{
|
||||
if (count >= RECORD_SIZE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
recordBuffer[count++] = _rPADStatus;
|
||||
}
|
||||
|
||||
|
||||
const SPADStatus& PlayRecord()
|
||||
{
|
||||
if (count >= RECORD_SIZE){return(recordBuffer[0]);}
|
||||
|
||||
return(recordBuffer[count++]);
|
||||
}
|
||||
|
||||
bool registerKey(int nPad, int id, sf::Key::Code code, int mods) {
|
||||
|
||||
Keys key, oldKey;
|
||||
EventHandler *eventHandler = (EventHandler *)globals->eventHandler;
|
||||
|
||||
key.inputType = KeyboardInput;
|
||||
key.keyCode = code;
|
||||
key.mods = mods;
|
||||
|
||||
if (!eventHandler) {
|
||||
PanicAlert("Can't get event handler");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// We need to handle mod change
|
||||
// and double registers
|
||||
if (pad[nPad].keyForControl[id] != 0) {
|
||||
|
||||
oldKey.inputType = KeyboardInput;
|
||||
oldKey.keyCode = pad[nPad].keyForControl[id];
|
||||
oldKey.mods = mods;
|
||||
|
||||
|
||||
// Might be not be registered yet
|
||||
eventHandler->RemoveEventListener(oldKey);
|
||||
}
|
||||
|
||||
if (!eventHandler->RegisterEventListener(ParseKeyEvent, key)) {
|
||||
char codestr[100];
|
||||
eventHandler->SFKeyToString(code, codestr);
|
||||
PanicAlert("Failed to register %s, might be already in use", codestr);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
pad[nPad].keyForControl[id] = code;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void LoadRecord()
|
||||
{
|
||||
FILE* pStream = fopen("c:\\pad-record.bin", "rb");
|
||||
|
||||
if (pStream != NULL)
|
||||
{
|
||||
fread(recordBuffer, 1, RECORD_SIZE * sizeof(SPADStatus), pStream);
|
||||
fclose(pStream);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SaveRecord()
|
||||
{
|
||||
FILE* pStream = fopen("c:\\pad-record.bin", "wb");
|
||||
|
||||
if (pStream != NULL)
|
||||
{
|
||||
fwrite(recordBuffer, 1, RECORD_SIZE * sizeof(SPADStatus), pStream);
|
||||
fclose(pStream);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
class wxDLLApp : public wxApp
|
||||
{
|
||||
bool OnInit()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
|
||||
|
||||
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
|
||||
|
||||
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
|
||||
DWORD dwReason, // reason called
|
||||
LPVOID lpvReserved) // reserved
|
||||
{
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{ //use wxInitialize() if you don't want GUI instead of the following 12 lines
|
||||
wxSetInstance((HINSTANCE)hinstDLL);
|
||||
int argc = 0;
|
||||
char **argv = NULL;
|
||||
wxEntryStart(argc, argv);
|
||||
if ( !wxTheApp || !wxTheApp->CallOnInit() )
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
g_hInstance = hinstDLL;
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void GetDllInfo(PLUGIN_INFO* _PluginInfo)
|
||||
{
|
||||
_PluginInfo->Version = 0x0100;
|
||||
_PluginInfo->Type = PLUGIN_TYPE_PAD;
|
||||
|
||||
#ifdef DEBUGFAST
|
||||
sprintf(_PluginInfo->Name, "Dolphin event pad (DebugFast)");
|
||||
#elif defined _DEBUG
|
||||
sprintf(_PluginInfo->Name, "Dolphin event pad (Debug)");
|
||||
#else
|
||||
sprintf(_PluginInfo->Name, "Dolphin event pad");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
|
||||
globals = _pPluginGlobals;
|
||||
// LogManager::SetInstance((LogManager *)globals->logManager);
|
||||
|
||||
}
|
||||
|
||||
void DllConfig(HWND _hParent)
|
||||
{
|
||||
LoadConfig();
|
||||
ConfigDialog frame(NULL);
|
||||
frame.ShowModal();
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
void DllDebugger(HWND _hParent, bool Show) {
|
||||
}
|
||||
|
||||
void DoState(unsigned char **ptr, int mode) {
|
||||
}
|
||||
|
||||
void Initialize(void *init)
|
||||
{
|
||||
#ifdef RECORD_REPLAY
|
||||
LoadRecord();
|
||||
#endif
|
||||
g_PADInitialize = *(SPADInitialize*)init;
|
||||
LoadConfig();
|
||||
}
|
||||
|
||||
|
||||
void Shutdown()
|
||||
{
|
||||
#ifdef RECORD_STORE
|
||||
SaveRecord();
|
||||
#endif
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
bool ParseKeyEvent(sf::Event ev) {
|
||||
fprintf(stderr, "parsing type %d code %d\n", ev.Type, ev.Key.Code);
|
||||
|
||||
// FIXME: should we support more than one control?
|
||||
for (int i = 0; i < NUMCONTROLS; i++) {
|
||||
if (ev.Key.Code == pad[0].keyForControl[i]) {
|
||||
KeyStatus[i] = (ev.Type == sf::Event::KeyPressed);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
void PAD_Input(u16 _Key, u8 _UpDown) {
|
||||
}
|
||||
|
||||
void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
||||
{
|
||||
// Check if all is okay
|
||||
if ((_pPADStatus == NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef RECORD_REPLAY
|
||||
*_pPADStatus = PlayRecord();
|
||||
return;
|
||||
#endif
|
||||
|
||||
const int base = 0x80;
|
||||
// Clear pad
|
||||
memset(_pPADStatus, 0, sizeof(SPADStatus));
|
||||
|
||||
_pPADStatus->stickY = base;
|
||||
_pPADStatus->stickX = base;
|
||||
_pPADStatus->substickX = base;
|
||||
_pPADStatus->substickY = base;
|
||||
_pPADStatus->button |= PAD_USE_ORIGIN;
|
||||
|
||||
_pPADStatus->err = PAD_ERR_NONE;
|
||||
|
||||
int stickvalue = (KeyStatus[CTL_HALFPRESS]) ? 40 : 100;
|
||||
int triggervalue = (KeyStatus[CTL_HALFPRESS]) ? 100 : 255;
|
||||
int sensevalue = (KeyStatus[CTL_HALFPRESS]) ? 100 : 255;
|
||||
|
||||
if (KeyStatus[CTL_MAINLEFT]){_pPADStatus->stickX -= stickvalue;}
|
||||
if (KeyStatus[CTL_MAINUP]){_pPADStatus->stickY += stickvalue;}
|
||||
if (KeyStatus[CTL_MAINRIGHT]){_pPADStatus->stickX += stickvalue;}
|
||||
if (KeyStatus[CTL_MAINDOWN]){_pPADStatus->stickY -= stickvalue;}
|
||||
|
||||
if (KeyStatus[CTL_SUBLEFT]){_pPADStatus->substickX -= stickvalue;}
|
||||
if (KeyStatus[CTL_SUBUP]){_pPADStatus->substickY += stickvalue;}
|
||||
if (KeyStatus[CTL_SUBRIGHT]){_pPADStatus->substickX += stickvalue;}
|
||||
if (KeyStatus[CTL_SUBDOWN]){_pPADStatus->substickY -= stickvalue;}
|
||||
|
||||
if (KeyStatus[CTL_DPADLEFT]){_pPADStatus->button |= PAD_BUTTON_LEFT;}
|
||||
if (KeyStatus[CTL_DPADUP]){_pPADStatus->button |= PAD_BUTTON_UP;}
|
||||
if (KeyStatus[CTL_DPADRIGHT]){_pPADStatus->button |= PAD_BUTTON_RIGHT;}
|
||||
if (KeyStatus[CTL_DPADDOWN]){_pPADStatus->button |= PAD_BUTTON_DOWN;}
|
||||
|
||||
if (KeyStatus[CTL_A]) {
|
||||
_pPADStatus->button |= PAD_BUTTON_A;
|
||||
_pPADStatus->analogA = sensevalue;
|
||||
}
|
||||
|
||||
if (KeyStatus[CTL_B]) {
|
||||
_pPADStatus->button |= PAD_BUTTON_B;
|
||||
_pPADStatus->analogB = sensevalue;
|
||||
}
|
||||
|
||||
if (KeyStatus[CTL_X]){_pPADStatus->button |= PAD_BUTTON_X;}
|
||||
if (KeyStatus[CTL_Y]){_pPADStatus->button |= PAD_BUTTON_Y;}
|
||||
if (KeyStatus[CTL_Z]){_pPADStatus->button |= PAD_TRIGGER_Z;}
|
||||
|
||||
if (KeyStatus[CTL_L]) {
|
||||
_pPADStatus->button |= PAD_TRIGGER_L;
|
||||
_pPADStatus->triggerLeft = triggervalue;
|
||||
}
|
||||
|
||||
if (KeyStatus[CTL_R]) {
|
||||
_pPADStatus->button |= PAD_TRIGGER_R;
|
||||
_pPADStatus->triggerRight = triggervalue;
|
||||
}
|
||||
|
||||
if (KeyStatus[CTL_START]){_pPADStatus->button |= PAD_BUTTON_START;}
|
||||
if (KeyStatus[CTL_MIC])
|
||||
_pPADStatus->MicButton = true;
|
||||
else
|
||||
_pPADStatus->MicButton = false;
|
||||
#ifdef RECORD_STORE
|
||||
RecordInput(*_pPADStatus);
|
||||
#endif
|
||||
}
|
||||
|
||||
void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength) {
|
||||
}
|
||||
|
||||
unsigned int PAD_GetAttachedPads()
|
||||
{
|
||||
unsigned int connected = 0;
|
||||
|
||||
LoadConfig();
|
||||
|
||||
if(pad[0].bAttached)
|
||||
connected |= 1;
|
||||
if(pad[1].bAttached)
|
||||
connected |= 2;
|
||||
if(pad[2].bAttached)
|
||||
connected |= 4;
|
||||
if(pad[3].bAttached)
|
||||
connected |= 8;
|
||||
|
||||
return connected;
|
||||
}
|
||||
|
||||
|
||||
void LoadConfig()
|
||||
{
|
||||
const int defaultKeyForControl[NUMCONTROLS] = {
|
||||
sf::Key::X, //A
|
||||
sf::Key::Z,
|
||||
sf::Key::S,
|
||||
sf::Key::C,
|
||||
sf::Key::D,
|
||||
sf::Key::Return,
|
||||
sf::Key::Q,
|
||||
sf::Key::W,
|
||||
sf::Key::Up, //mainstick
|
||||
sf::Key::Down,
|
||||
sf::Key::Left,
|
||||
sf::Key::Right,
|
||||
sf::Key::I, //substick
|
||||
sf::Key::K,
|
||||
sf::Key::J,
|
||||
sf::Key::L,
|
||||
sf::Key::T, //dpad
|
||||
sf::Key::G,
|
||||
sf::Key::F,
|
||||
sf::Key::H,
|
||||
sf::Key::LShift, //halfpress
|
||||
sf::Key::P // mic
|
||||
};
|
||||
|
||||
IniFile file;
|
||||
file.Load(FULL_CONFIG_DIR EPAD_CONFIG_FILE);
|
||||
|
||||
for(int i = 0; i < 1; i++) {
|
||||
char SectionName[32];
|
||||
sprintf(SectionName, "PAD%i", i+1);
|
||||
|
||||
file.Get(SectionName, "Attached", &pad[i].bAttached, i==0);
|
||||
file.Get(SectionName, "DisableOnBackground", &pad[i].bDisable, false);
|
||||
for (int x = 0; x < NUMCONTROLS; x++) {
|
||||
int key;
|
||||
file.Get(SectionName, controlNames[x],
|
||||
&key, (i==0)?defaultKeyForControl[x]:0);
|
||||
|
||||
if (i == g_PADInitialize.padNumber && pad[i].bAttached)
|
||||
registerKey(i, x, (sf::Key::Code)key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SaveConfig()
|
||||
{
|
||||
IniFile file;
|
||||
file.Load(FULL_CONFIG_DIR EPAD_CONFIG_FILE);
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
char SectionName[32];
|
||||
sprintf(SectionName, "PAD%i", i+1);
|
||||
|
||||
file.Set(SectionName, "Attached", pad[i].bAttached);
|
||||
file.Set(SectionName, "DisableOnBackground", pad[i].bDisable);
|
||||
|
||||
for (int x = 0; x < NUMCONTROLS; x++) {
|
||||
file.Set(SectionName, controlNames[x], pad[i].keyForControl[x]);
|
||||
}
|
||||
}
|
||||
file.Save(FULL_CONFIG_DIR EPAD_CONFIG_FILE);
|
||||
}
|
||||
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
// Copyright (C) 2003 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/
|
||||
|
||||
#ifndef __PADSIMPLE_H__
|
||||
#define __PADSIMPLE_H__
|
||||
|
||||
#include "InputCommon.h"
|
||||
#include "pluginspecs_pad.h"
|
||||
|
||||
#define EPAD_CONFIG_FILE "epad.ini"
|
||||
// Controls
|
||||
enum
|
||||
{
|
||||
CTL_A = 0,
|
||||
CTL_B,
|
||||
CTL_X,
|
||||
CTL_Y,
|
||||
CTL_Z,
|
||||
CTL_START,
|
||||
CTL_L,
|
||||
CTL_R,
|
||||
CTL_MAINUP,
|
||||
CTL_MAINDOWN,
|
||||
CTL_MAINLEFT,
|
||||
CTL_MAINRIGHT,
|
||||
CTL_SUBUP,
|
||||
CTL_SUBDOWN,
|
||||
CTL_SUBLEFT,
|
||||
CTL_SUBRIGHT,
|
||||
CTL_DPADUP,
|
||||
CTL_DPADDOWN,
|
||||
CTL_DPADLEFT,
|
||||
CTL_DPADRIGHT,
|
||||
CTL_HALFPRESS,
|
||||
CTL_MIC,
|
||||
NUMCONTROLS
|
||||
};
|
||||
|
||||
|
||||
struct SPads {
|
||||
bool bAttached; // Pad is "attached" to the gamecube/wii
|
||||
bool bDisable; // Disabled when dolphin isn't in focus
|
||||
sf::Key::Code keyForControl[NUMCONTROLS];// Keyboard mapping
|
||||
};
|
||||
|
||||
extern SPads pad[];
|
||||
extern PLUGIN_GLOBALS* globals;
|
||||
|
||||
void LoadConfig();
|
||||
void SaveConfig();
|
||||
bool registerKey(int nPad, int id, sf::Key::Code code, int mods = 0);
|
||||
bool ParseKeyEvent(sf::Event ev);
|
||||
|
||||
#endif
|
|
@ -1,24 +0,0 @@
|
|||
# -*- python -*-
|
||||
|
||||
Import('env')
|
||||
import sys
|
||||
|
||||
name = "Plugin_PadSimpleEvnt"
|
||||
|
||||
if not env['GLTEST']:
|
||||
print name + " Doesn't work without testgl"
|
||||
Return()
|
||||
|
||||
files = [
|
||||
"PadSimple.cpp",
|
||||
]
|
||||
padeenv = env.Clone()
|
||||
|
||||
if padeenv['HAVE_WX']:
|
||||
files += [
|
||||
"GUI/ConfigDlg.cpp",
|
||||
]
|
||||
|
||||
padeenv.Append(LIBS = [ 'inputcommon', 'common' ])
|
||||
|
||||
padeenv.SharedLibrary(env['plugin_dir']+name, files)
|
|
@ -124,18 +124,13 @@ void UpdateFPSDisplay(const char *text)
|
|||
sprintf(temp, "SVN R%s: GL: %s", SVN_REV_STR, text);
|
||||
OpenGL_SetWindowText(temp);
|
||||
}
|
||||
// =========================
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Create rendering window.
|
||||
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
|
||||
// ------------------
|
||||
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight)
|
||||
{
|
||||
// --------------------------------------------
|
||||
// Check for fullscreen mode
|
||||
// ---------------
|
||||
int _twidth, _theight;
|
||||
if (g_Config.bFullscreen)
|
||||
{
|
||||
|
@ -165,21 +160,14 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
|||
#if defined(_WIN32)
|
||||
EmuWindow::SetSize(_twidth, _theight);
|
||||
#endif
|
||||
// ----------------------------
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// Control window size and picture scaling
|
||||
// ------------------
|
||||
s_backbuffer_width = _twidth;
|
||||
s_backbuffer_height = _theight;
|
||||
|
||||
g_VideoInitialize.pPeekMessages = &Callback_PeekMessages;
|
||||
g_VideoInitialize.pUpdateFPSDisplay = &UpdateFPSDisplay;
|
||||
|
||||
//char buff[100];
|
||||
//sprintf(buff, "%i %i %d %d %d", s_backbuffer_width, s_backbuffer_height, Max, MValueX, MValueY);
|
||||
//MessageBox(0, buff, "", 0);
|
||||
|
||||
#if USE_SDL
|
||||
//init sdl video
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||
|
@ -223,15 +211,11 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
|||
GLWin.glCanvas->SetCurrent();
|
||||
#else
|
||||
GLWin.glCanvas->SetCurrent(*GLWin.glCtxt);
|
||||
// GLWin.glCtxt->SetCurrent(*GLWin.glCanvas);
|
||||
#endif
|
||||
|
||||
|
||||
#elif defined(_WIN32)
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// Create rendering window in Windows
|
||||
// ----------------------
|
||||
|
||||
// Create a separate window
|
||||
if (!g_Config.RenderToMainframe || g_VideoInitialize.pWindowHandle == NULL)
|
||||
g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create(NULL, g_hInstance, _T("Please wait..."));
|
||||
|
@ -783,3 +767,4 @@ bool OpenGL_ReportFBOError(const char *function, const char *file, int line)
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
#ifndef _GLINIT_H_
|
||||
#define _GLINIT_H_
|
||||
|
||||
#if defined GLTEST && GLTEST
|
||||
#include "nGLUtil.h"
|
||||
#else
|
||||
#include "Config.h"
|
||||
#include "MathUtil.h"
|
||||
#include "pluginspecs_video.h"
|
||||
|
@ -148,8 +145,6 @@ bool OpenGL_ReportFBOError(const char *function, const char *file, int line);
|
|||
#define GL_REPORT_ERRORD()
|
||||
#endif
|
||||
|
||||
#endif // GLTEST ??
|
||||
|
||||
#include <Cg/cg.h>
|
||||
#include <Cg/cgGL.h>
|
||||
|
||||
|
|
|
@ -37,17 +37,11 @@ libs = [
|
|||
|
||||
gfxenv = env.Clone()
|
||||
|
||||
if gfxenv['GLTEST']:
|
||||
files += [
|
||||
'nmain.cpp',
|
||||
'nGLUtil.cpp',
|
||||
]
|
||||
libs += [ 'inputcommon' ]
|
||||
else:
|
||||
files += [
|
||||
'main.cpp',
|
||||
'GLUtil.cpp',
|
||||
]
|
||||
files += [
|
||||
'main.cpp',
|
||||
'GLUtil.cpp',
|
||||
]
|
||||
|
||||
if gfxenv['HAVE_WX']:
|
||||
files += [
|
||||
'GUI/ConfigDlg.cpp',
|
||||
|
@ -110,21 +104,6 @@ conf.Define('HAVE_XXF86VM', gfxenv['HAVE_XXF86VM'])
|
|||
|
||||
conf.Finish()
|
||||
|
||||
if gfxenv['GLTEST']:
|
||||
if gfxenv['HAVE_XXF86VM']:
|
||||
files += [
|
||||
'X11Window.cpp',
|
||||
]
|
||||
|
||||
if gfxenv['HAVE_SDL']:
|
||||
files += [
|
||||
'SDLWindow.cpp',
|
||||
]
|
||||
if gfxenv['USE_WX']:
|
||||
files += [
|
||||
'WXGLWindow.cpp',
|
||||
]
|
||||
|
||||
# Sanity check
|
||||
if gfxenv['USE_WX'] and not gfxenv['HAVE_WX']:
|
||||
print "Must have wx to use wxgl"
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
#include "SDLWindow.h"
|
||||
|
||||
void SDLWindow::SwapBuffers() {
|
||||
SDL_GL_SwapBuffers();
|
||||
}
|
||||
|
||||
void SDLWindow::SetWindowText(const char *text) {
|
||||
SDL_WM_SetCaption(text, NULL);
|
||||
}
|
||||
|
||||
bool SDLWindow::PeekMessages() {
|
||||
// TODO implement
|
||||
return false;
|
||||
}
|
||||
|
||||
void SDLWindow::Update() {
|
||||
|
||||
SDL_Surface *surface = SDL_GetVideoSurface();
|
||||
if (!surface) {
|
||||
PanicAlert("Can't get surface to update");
|
||||
return;
|
||||
}
|
||||
|
||||
//SetSize(surface->w, surface->h);
|
||||
updateDim();
|
||||
|
||||
}
|
||||
|
||||
bool SDLWindow::MakeCurrent() {
|
||||
/* Note: The reason for having the call to SDL_SetVideoMode in here instead
|
||||
of in OpenGL_Create() is that "make current" is part of the video
|
||||
mode setting and is not available as a separate call in SDL. We
|
||||
have to do "make current" here because this method runs in the CPU
|
||||
thread while OpenGL_Create() runs in a diferent thread and "make
|
||||
current" has to be done in the same thread that will be making
|
||||
calls to OpenGL. */
|
||||
|
||||
// Fetch video info.
|
||||
const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo();
|
||||
if (!videoInfo) {
|
||||
PanicAlert("Couldn't get video info");
|
||||
SDL_Quit();
|
||||
return false;
|
||||
}
|
||||
// Compute video mode flags.
|
||||
const int videoFlags = SDL_OPENGL
|
||||
| ( videoInfo->hw_available ? SDL_HWSURFACE : SDL_SWSURFACE )
|
||||
| ( g_Config.bFullscreen ? SDL_FULLSCREEN : 0);
|
||||
// Set vide mode.
|
||||
// TODO: Can we use this field or is a separate field needed?
|
||||
SDL_Surface *screen = SDL_SetVideoMode(GetXwin(), GetYwin(),
|
||||
0, videoFlags);
|
||||
if (!screen) {
|
||||
PanicAlert("Couldn't set video mode");
|
||||
SDL_Quit();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
SDLWindow::~SDLWindow() {
|
||||
SDL_Quit();
|
||||
}
|
||||
|
||||
SDLWindow::SDLWindow() : GLWindow() {
|
||||
|
||||
//init sdl video
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||
PanicAlert("Failed to init SDL: %s", SDL_GetError());
|
||||
SDL_Quit();
|
||||
//return NULL;
|
||||
}
|
||||
|
||||
// Setup ogl to use double buffering
|
||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef _SDLWINDOW_H
|
||||
#define _SDLWINDOW_H
|
||||
|
||||
#include "GLWindow.h"
|
||||
#if defined HAVE_SDL && HAVE_SDL
|
||||
#include <SDL.h>
|
||||
|
||||
class SDLWindow : public GLWindow
|
||||
{
|
||||
public:
|
||||
virtual void SwapBuffers();
|
||||
virtual void SetWindowText(const char *text);
|
||||
virtual bool PeekMessages();
|
||||
virtual void Update();
|
||||
virtual bool MakeCurrent();
|
||||
|
||||
static bool valid() { return true; }
|
||||
~SDLWindow();
|
||||
SDLWindow();
|
||||
|
||||
};
|
||||
#else
|
||||
class SDLWindow : public GLWindow
|
||||
{
|
||||
public:
|
||||
SDLWindow() {}
|
||||
};
|
||||
#endif
|
||||
#endif
|
|
@ -1,803 +0,0 @@
|
|||
#include "Win32Window.h"
|
||||
|
||||
// Static member data
|
||||
unsigned int Win32Window::ourWindowCount = 0;
|
||||
const char* Win32Window::ourClassName = _T("DolphinEmuWnd");
|
||||
Win32Window* Win32Window::ourFullscreenWindow = NULL;
|
||||
|
||||
|
||||
Win32Window::Win32Window() : GLWindow(),
|
||||
myHandle (NULL),
|
||||
myCallback (0),
|
||||
myCursor (NULL),
|
||||
myIcon (NULL),
|
||||
myKeyRepeatEnabled (true),
|
||||
myIsCursorIn (false)
|
||||
{
|
||||
// Register the window class at first call
|
||||
if (ourWindowCount == 0)
|
||||
RegisterWindowClass();
|
||||
|
||||
// Use small dimensions
|
||||
//SetWinSize(1, 1);
|
||||
|
||||
// Create the rendering window
|
||||
if (!(myHandle = CreateWindow(ourClassName, _T(""), WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
GetXwin(), GetYwin(), NULL, NULL, myhInstance, this))) {
|
||||
PanicAlert("Error creating GL Window");
|
||||
}
|
||||
|
||||
ShowWindow(myHandle, SW_SHOW);
|
||||
|
||||
// Create the rendering context
|
||||
if (myHandle)
|
||||
{
|
||||
VideoMode Mode;
|
||||
Mode.Width = GetXwin();
|
||||
Mode.Height = GetYwin();
|
||||
Mode.BitsPerPixel = 32;
|
||||
Mode.DepthBits = 24;
|
||||
Mode.StencilBits = 8;
|
||||
Mode.AntialiasingLevel = 0;
|
||||
CreateContext(Mode);
|
||||
|
||||
// Don't activate by default
|
||||
//SetNotActive();
|
||||
}
|
||||
}
|
||||
|
||||
Win32Window::~Win32Window()
|
||||
{
|
||||
// Destroy the custom icon, if any
|
||||
if (myIcon)
|
||||
DestroyIcon(myIcon);
|
||||
|
||||
if (!myCallback)
|
||||
{
|
||||
// Destroy the window
|
||||
if (myHandle)
|
||||
DestroyWindow(myHandle);
|
||||
|
||||
// Decrement the window count
|
||||
ourWindowCount--;
|
||||
|
||||
// Unregister window class if we were the last window
|
||||
if (ourWindowCount == 0)
|
||||
UnregisterClass(ourClassName, GetModuleHandle(NULL));
|
||||
}
|
||||
else
|
||||
{
|
||||
// The window is external : remove the hook on its message callback
|
||||
SetWindowLongPtr(myHandle, GWLP_WNDPROC, myCallback);
|
||||
}
|
||||
}
|
||||
|
||||
void Win32Window::SwapBuffers()
|
||||
{
|
||||
if (myDeviceContext && myGLContext)
|
||||
::SwapBuffers(myDeviceContext);
|
||||
}
|
||||
|
||||
void Win32Window::SetWindowText(const char *text)
|
||||
{
|
||||
::SetWindowText(GetWnd(), text);
|
||||
}
|
||||
|
||||
void Win32Window::ShowMouseCursor(bool Show)
|
||||
{
|
||||
if (Show)
|
||||
myCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
else
|
||||
myCursor = NULL;
|
||||
|
||||
SetCursor(myCursor);
|
||||
}
|
||||
|
||||
bool Win32Window::PeekMessages()
|
||||
{
|
||||
// We update the window only if we own it
|
||||
if (!myCallback)
|
||||
{
|
||||
MSG Message;
|
||||
while (PeekMessage(&Message, myHandle, 0, 0, PM_REMOVE))
|
||||
{
|
||||
TranslateMessage(&Message);
|
||||
DispatchMessage(&Message);
|
||||
}
|
||||
}
|
||||
return true; // I don't know why this is bool...
|
||||
}
|
||||
|
||||
void Win32Window::Update()
|
||||
{
|
||||
// We just check all of our events here
|
||||
// TODO
|
||||
PeekMessages();
|
||||
eventHandler->Update();
|
||||
updateDim();
|
||||
}
|
||||
|
||||
bool Win32Window::MakeCurrent()
|
||||
{
|
||||
if (myDeviceContext && myGLContext && (wglGetCurrentContext() != myGLContext))
|
||||
{
|
||||
wglMakeCurrent(myDeviceContext, myGLContext);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void Win32Window::RegisterWindowClass()
|
||||
{
|
||||
WNDCLASS WindowClass;
|
||||
myhInstance = GetModuleHandle(NULL);
|
||||
WindowClass.style = CS_OWNDC;
|
||||
WindowClass.lpfnWndProc = &Win32Window::GlobalOnEvent;
|
||||
WindowClass.cbClsExtra = 0;
|
||||
WindowClass.cbWndExtra = 0;
|
||||
WindowClass.hInstance = myhInstance;
|
||||
WindowClass.hIcon = NULL;
|
||||
WindowClass.hCursor = 0;
|
||||
WindowClass.hbrBackground = 0;
|
||||
WindowClass.lpszMenuName = NULL;
|
||||
WindowClass.lpszClassName = ourClassName;
|
||||
if (!RegisterClass(&WindowClass))
|
||||
ERROR_LOG("Failed To Register The Window Class\n");
|
||||
}
|
||||
|
||||
void Win32Window::SwitchToFullscreen(const VideoMode& Mode)
|
||||
{
|
||||
DEVMODE DevMode;
|
||||
DevMode.dmSize = sizeof(DEVMODE);
|
||||
DevMode.dmPelsWidth = Mode.Width;
|
||||
DevMode.dmPelsHeight = Mode.Height;
|
||||
DevMode.dmBitsPerPel = Mode.BitsPerPixel;
|
||||
DevMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;
|
||||
|
||||
// Apply fullscreen mode
|
||||
if (ChangeDisplaySettings(&DevMode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
|
||||
{
|
||||
ERROR_LOG("Failed to change display mode for fullscreen\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Change window style (no border, no titlebar, ...)
|
||||
SetWindowLong(myHandle, GWL_STYLE, WS_POPUP);
|
||||
SetWindowLong(myHandle, GWL_EXSTYLE, WS_EX_APPWINDOW);
|
||||
|
||||
// And resize it so that it fits the entire screen
|
||||
SetWindowPos(myHandle, HWND_TOP, 0, 0, Mode.Width, Mode.Height, SWP_FRAMECHANGED);
|
||||
ShowWindow(myHandle, SW_SHOW);
|
||||
|
||||
// Set "this" as the current fullscreen window
|
||||
ourFullscreenWindow = this;
|
||||
|
||||
// SetPixelFormat can fail (really ?) if window style doesn't contain these flags
|
||||
long Style = GetWindowLong(myHandle, GWL_STYLE);
|
||||
SetWindowLong(myHandle, GWL_STYLE, Style | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
|
||||
}
|
||||
|
||||
//VideoMode Win32Window::GetSupportedVideoModes(std::vector<VideoMode>& Modes)
|
||||
//{
|
||||
// // First, clear array to fill
|
||||
// Modes.clear();
|
||||
//
|
||||
// // Enumerate all available video modes for primary display adapter
|
||||
// DEVMODE Win32Mode;
|
||||
// Win32Mode.dmSize = sizeof(DEVMODE);
|
||||
// for (int Count = 0; EnumDisplaySettings(NULL, Count, &Win32Mode); ++Count)
|
||||
// {
|
||||
// // Convert to sfVideoMode
|
||||
// VideoMode Mode(Win32Mode.dmPelsWidth, Win32Mode.dmPelsHeight, Win32Mode.dmBitsPerPel);
|
||||
//
|
||||
// // Add it only if it is not already in the array
|
||||
// if (std::find(Modes.begin(), Modes.end(), Mode) == Modes.end())
|
||||
// Modes.push_back(Mode);
|
||||
// }
|
||||
//}
|
||||
|
||||
void Win32Window::CreateContext(VideoMode& Mode)
|
||||
{
|
||||
// TESTING
|
||||
Mode.DepthBits = 24;
|
||||
Mode.StencilBits = 8;
|
||||
//Mode.AntialiasingLevel = 4;
|
||||
|
||||
// Get the device context attached to the window
|
||||
myDeviceContext = GetDC(myHandle);
|
||||
if (myDeviceContext == NULL)
|
||||
{
|
||||
ERROR_LOG("Failed to get device context of window -- cannot create OpenGL context\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Let's find a suitable pixel format -- first try with antialiasing
|
||||
int BestFormat = 0;
|
||||
if (Mode.AntialiasingLevel > 0)
|
||||
{
|
||||
// Get the wglChoosePixelFormatARB function (it is an extension)
|
||||
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = reinterpret_cast<PFNWGLCHOOSEPIXELFORMATARBPROC>(wglGetProcAddress("wglChoosePixelFormatARB"));
|
||||
|
||||
// Define the basic attributes we want for our window
|
||||
int IntAttributes[] =
|
||||
{
|
||||
WGL_DRAW_TO_WINDOW_ARB, GL_TRUE,
|
||||
WGL_SUPPORT_OPENGL_ARB, GL_TRUE,
|
||||
WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,
|
||||
WGL_DOUBLE_BUFFER_ARB, GL_TRUE,
|
||||
WGL_SAMPLE_BUFFERS_ARB, (Mode.AntialiasingLevel ? GL_TRUE : GL_FALSE),
|
||||
WGL_SAMPLES_ARB, Mode.AntialiasingLevel,
|
||||
0, 0
|
||||
};
|
||||
|
||||
// Let's check how many formats are supporting our requirements
|
||||
int Formats[128];
|
||||
UINT NbFormats;
|
||||
float FloatAttributes[] = {0, 0};
|
||||
bool IsValid = wglChoosePixelFormatARB(myDeviceContext, IntAttributes, FloatAttributes, sizeof(Formats) / sizeof(*Formats), Formats, &NbFormats) != 0;
|
||||
if (!IsValid || (NbFormats == 0))
|
||||
{
|
||||
if (Mode.AntialiasingLevel > 2)
|
||||
{
|
||||
// No format matching our needs : reduce the multisampling level
|
||||
char errMsg[256];
|
||||
sprintf(errMsg, "Failed to find a pixel format supporting %u antialiasing levels ; trying with 2 levels\n", Mode.AntialiasingLevel);
|
||||
ERROR_LOG(errMsg);
|
||||
|
||||
Mode.AntialiasingLevel = IntAttributes[1] = 2;
|
||||
IsValid = wglChoosePixelFormatARB(myDeviceContext, IntAttributes, FloatAttributes, sizeof(Formats) / sizeof(*Formats), Formats, &NbFormats) != 0;
|
||||
}
|
||||
|
||||
if (!IsValid || (NbFormats == 0))
|
||||
{
|
||||
// Cannot find any pixel format supporting multisampling ; disabling antialiasing
|
||||
ERROR_LOG("Failed to find a pixel format supporting antialiasing ; antialiasing will be disabled\n");
|
||||
Mode.AntialiasingLevel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the best format among the returned ones
|
||||
if (IsValid && (NbFormats > 0))
|
||||
{
|
||||
int BestScore = 0xFFFF;
|
||||
for (UINT i = 0; i < NbFormats; ++i)
|
||||
{
|
||||
// Get the current format's attributes
|
||||
PIXELFORMATDESCRIPTOR Attribs;
|
||||
Attribs.nSize = sizeof(PIXELFORMATDESCRIPTOR);
|
||||
Attribs.nVersion = 1;
|
||||
DescribePixelFormat(myDeviceContext, Formats[i], sizeof(PIXELFORMATDESCRIPTOR), &Attribs);
|
||||
|
||||
// Evaluate the current configuration
|
||||
int Color = Attribs.cRedBits + Attribs.cGreenBits + Attribs.cBlueBits + Attribs.cAlphaBits;
|
||||
int Score = abs(static_cast<int>(Mode.BitsPerPixel - Color)) + // The EvaluateConfig function
|
||||
abs(static_cast<int>(Mode.DepthBits - Attribs.cDepthBits)) +
|
||||
abs(static_cast<int>(Mode.StencilBits - Attribs.cStencilBits));
|
||||
|
||||
// Keep it if it's better than the current best
|
||||
if (Score < BestScore)
|
||||
{
|
||||
BestScore = Score;
|
||||
BestFormat = Formats[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find a pixel format with no antialiasing, if not needed or not supported
|
||||
if (BestFormat == 0)
|
||||
{
|
||||
// Setup a pixel format descriptor from the rendering settings
|
||||
PIXELFORMATDESCRIPTOR PixelDescriptor;
|
||||
ZeroMemory(&PixelDescriptor, sizeof(PIXELFORMATDESCRIPTOR));
|
||||
PixelDescriptor.nSize = sizeof(PIXELFORMATDESCRIPTOR);
|
||||
PixelDescriptor.nVersion = 1;
|
||||
PixelDescriptor.iLayerType = PFD_MAIN_PLANE;
|
||||
PixelDescriptor.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
|
||||
PixelDescriptor.iPixelType = PFD_TYPE_RGBA;
|
||||
PixelDescriptor.cColorBits = static_cast<BYTE>(Mode.BitsPerPixel);
|
||||
PixelDescriptor.cDepthBits = static_cast<BYTE>(Mode.DepthBits);
|
||||
PixelDescriptor.cStencilBits = static_cast<BYTE>(Mode.StencilBits);
|
||||
|
||||
// Get the pixel format that best matches our requirements
|
||||
BestFormat = ChoosePixelFormat(myDeviceContext, &PixelDescriptor);
|
||||
if (BestFormat == 0)
|
||||
{
|
||||
ERROR_LOG("Failed to find a suitable pixel format for device context -- cannot create OpenGL context\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Extract the depth and stencil bits from the chosen format
|
||||
PIXELFORMATDESCRIPTOR ActualFormat;
|
||||
ActualFormat.nSize = sizeof(PIXELFORMATDESCRIPTOR);
|
||||
ActualFormat.nVersion = 1;
|
||||
DescribePixelFormat(myDeviceContext, BestFormat, sizeof(PIXELFORMATDESCRIPTOR), &ActualFormat);
|
||||
Mode.DepthBits = ActualFormat.cDepthBits;
|
||||
Mode.StencilBits = ActualFormat.cStencilBits;
|
||||
|
||||
// Set the chosen pixel format
|
||||
if (!SetPixelFormat(myDeviceContext, BestFormat, &ActualFormat))
|
||||
{
|
||||
ERROR_LOG("Failed to set pixel format for device context -- cannot create OpenGL context\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the OpenGL context from the device context
|
||||
myGLContext = wglCreateContext(myDeviceContext);
|
||||
if (myGLContext == NULL)
|
||||
{
|
||||
ERROR_LOG("Failed to create an OpenGL context for this window\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Share display lists with other contexts
|
||||
HGLRC CurrentContext = wglGetCurrentContext();
|
||||
if (CurrentContext)
|
||||
wglShareLists(CurrentContext, myGLContext);
|
||||
|
||||
// Activate the context
|
||||
MakeCurrent();
|
||||
|
||||
// Enable multisampling
|
||||
if (Mode.AntialiasingLevel > 0)
|
||||
glEnable(GL_MULTISAMPLE_ARB);
|
||||
}
|
||||
|
||||
void Win32Window::Cleanup()
|
||||
{
|
||||
// Restore the previous video mode (in case we were running in fullscreen)
|
||||
if (ourFullscreenWindow == this)
|
||||
{
|
||||
ChangeDisplaySettings(NULL, 0);
|
||||
ourFullscreenWindow = NULL;
|
||||
}
|
||||
|
||||
// Unhide the mouse cursor (in case it was hidden)
|
||||
ShowMouseCursor(true);
|
||||
//GetProperty(OGL_HIDECURSOR)
|
||||
|
||||
// Destroy the OpenGL context
|
||||
if (myGLContext)
|
||||
{
|
||||
// Unbind the context before destroying it
|
||||
//SetNotActive();
|
||||
|
||||
wglDeleteContext(myGLContext);
|
||||
myGLContext = NULL;
|
||||
}
|
||||
if (myDeviceContext)
|
||||
{
|
||||
ReleaseDC(myHandle, myDeviceContext);
|
||||
myDeviceContext = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Process a Win32 Event
|
||||
|
||||
void Win32Window::ProcessEvent(UINT Message, WPARAM WParam, LPARAM LParam)
|
||||
{
|
||||
// Don't process any message until window is created
|
||||
if (myHandle == NULL)
|
||||
return;
|
||||
|
||||
switch (Message)
|
||||
{
|
||||
// Destroy Event
|
||||
case WM_DESTROY :
|
||||
{
|
||||
// Here we must cleanup resources !
|
||||
Cleanup();
|
||||
break;
|
||||
}
|
||||
|
||||
// Set cursor Event
|
||||
case WM_SETCURSOR :
|
||||
{
|
||||
// The mouse has moved, if the cursor is in our window we must refresh the cursor
|
||||
if (LOWORD(LParam) == HTCLIENT)
|
||||
SetCursor(myCursor);
|
||||
break;
|
||||
}
|
||||
case WM_CLOSE :
|
||||
{
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::Closed;
|
||||
eventHandler->addEvent(&Evt);
|
||||
break;
|
||||
}
|
||||
|
||||
// Resize Event
|
||||
case WM_SIZE :
|
||||
{
|
||||
// Update window size
|
||||
RECT Rect;
|
||||
GetClientRect(myHandle, &Rect);
|
||||
SetWinSize(Rect.right - Rect.left, Rect.bottom - Rect.top);
|
||||
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::Resized;
|
||||
Evt.Size.Width = GetXwin();
|
||||
Evt.Size.Height = GetYwin();
|
||||
eventHandler->addEvent(&Evt);
|
||||
break;
|
||||
}
|
||||
// Gain focus Event
|
||||
case WM_SETFOCUS :
|
||||
{
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::GainedFocus;
|
||||
eventHandler->addEvent(&Evt);
|
||||
break;
|
||||
}
|
||||
|
||||
// Lost focus Event
|
||||
case WM_KILLFOCUS :
|
||||
{
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::LostFocus;
|
||||
eventHandler->addEvent(&Evt);
|
||||
break;
|
||||
}
|
||||
|
||||
// Text Event
|
||||
case WM_CHAR :
|
||||
{
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::TextEntered;
|
||||
Evt.Text.Unicode = static_cast<u32>(WParam);
|
||||
eventHandler->addEvent(&Evt);
|
||||
break;
|
||||
}
|
||||
// Keydown Event
|
||||
case WM_KEYDOWN :
|
||||
case WM_SYSKEYDOWN :
|
||||
{
|
||||
if (myKeyRepeatEnabled || ((LParam & (1 << 30)) == 0))
|
||||
{
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::KeyPressed;
|
||||
Evt.Key.Code = (WParam == VK_SHIFT) ? GetShiftState(true) : VirtualKeyCodeToSF(WParam, LParam);
|
||||
Evt.Key.Alt = HIWORD(GetAsyncKeyState(VK_MENU)) != 0;
|
||||
Evt.Key.Control = HIWORD(GetAsyncKeyState(VK_CONTROL)) != 0;
|
||||
Evt.Key.Shift = HIWORD(GetAsyncKeyState(VK_SHIFT)) != 0;
|
||||
eventHandler->addEvent(&Evt);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Keyup Event
|
||||
case WM_KEYUP :
|
||||
case WM_SYSKEYUP :
|
||||
{
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::KeyReleased;
|
||||
Evt.Key.Code = (WParam == VK_SHIFT) ? GetShiftState(false) : VirtualKeyCodeToSF(WParam, LParam);
|
||||
Evt.Key.Alt = HIWORD(GetAsyncKeyState(VK_MENU)) != 0;
|
||||
Evt.Key.Control = HIWORD(GetAsyncKeyState(VK_CONTROL)) != 0;
|
||||
Evt.Key.Shift = HIWORD(GetAsyncKeyState(VK_SHIFT)) != 0;
|
||||
eventHandler->addEvent(&Evt);
|
||||
break;
|
||||
}
|
||||
|
||||
// Mouse wheel Event
|
||||
case WM_MOUSEWHEEL :
|
||||
{
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::MouseWheelMoved;
|
||||
Evt.MouseWheel.Delta = static_cast<s16>(HIWORD(WParam)) / 120;
|
||||
eventHandler->addEvent(&Evt);
|
||||
break;
|
||||
}
|
||||
|
||||
// Mouse left button down Event
|
||||
case WM_LBUTTONDOWN :
|
||||
{
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::MouseButtonPressed;
|
||||
Evt.MouseButton.Button = sf::Mouse::Left;
|
||||
Evt.MouseButton.X = LOWORD(LParam);
|
||||
Evt.MouseButton.Y = HIWORD(LParam);
|
||||
eventHandler->addEvent(&Evt);
|
||||
break;
|
||||
}
|
||||
|
||||
// Mouse left button up Event
|
||||
case WM_LBUTTONUP :
|
||||
{
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::MouseButtonReleased;
|
||||
Evt.MouseButton.Button = sf::Mouse::Left;
|
||||
Evt.MouseButton.X = LOWORD(LParam);
|
||||
Evt.MouseButton.Y = HIWORD(LParam);
|
||||
eventHandler->addEvent(&Evt);
|
||||
break;
|
||||
}
|
||||
|
||||
// Mouse right button down Event
|
||||
case WM_RBUTTONDOWN :
|
||||
{
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::MouseButtonPressed;
|
||||
Evt.MouseButton.Button = sf::Mouse::Right;
|
||||
Evt.MouseButton.X = LOWORD(LParam);
|
||||
Evt.MouseButton.Y = HIWORD(LParam);
|
||||
eventHandler->addEvent(&Evt);
|
||||
break;
|
||||
}
|
||||
|
||||
// Mouse right button up Event
|
||||
case WM_RBUTTONUP :
|
||||
{
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::MouseButtonReleased;
|
||||
Evt.MouseButton.Button = sf::Mouse::Right;
|
||||
Evt.MouseButton.X = LOWORD(LParam);
|
||||
Evt.MouseButton.Y = HIWORD(LParam);
|
||||
eventHandler->addEvent(&Evt);
|
||||
break;
|
||||
}
|
||||
|
||||
// Mouse wheel button down Event
|
||||
case WM_MBUTTONDOWN :
|
||||
{
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::MouseButtonPressed;
|
||||
Evt.MouseButton.Button = sf::Mouse::Middle;
|
||||
Evt.MouseButton.X = LOWORD(LParam);
|
||||
Evt.MouseButton.Y = HIWORD(LParam);
|
||||
eventHandler->addEvent(&Evt);
|
||||
break;
|
||||
}
|
||||
|
||||
// Mouse wheel button up Event
|
||||
case WM_MBUTTONUP :
|
||||
{
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::MouseButtonReleased;
|
||||
Evt.MouseButton.Button = sf::Mouse::Middle;
|
||||
Evt.MouseButton.X = LOWORD(LParam);
|
||||
Evt.MouseButton.Y = HIWORD(LParam);
|
||||
eventHandler->addEvent(&Evt);
|
||||
break;
|
||||
}
|
||||
|
||||
// Mouse X button down Event
|
||||
case WM_XBUTTONDOWN :
|
||||
{
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::MouseButtonPressed;
|
||||
Evt.MouseButton.Button = HIWORD(WParam) == XBUTTON1 ? sf::Mouse::XButton1 : sf::Mouse::XButton2;
|
||||
Evt.MouseButton.X = LOWORD(LParam);
|
||||
Evt.MouseButton.Y = HIWORD(LParam);
|
||||
eventHandler->addEvent(&Evt);
|
||||
break;
|
||||
}
|
||||
|
||||
// Mouse X button up Event
|
||||
case WM_XBUTTONUP :
|
||||
{
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::MouseButtonReleased;
|
||||
Evt.MouseButton.Button = HIWORD(WParam) == XBUTTON1 ? sf::Mouse::XButton1 : sf::Mouse::XButton2;
|
||||
Evt.MouseButton.X = LOWORD(LParam);
|
||||
eventHandler->addEvent(&Evt);
|
||||
break;
|
||||
}
|
||||
|
||||
// Mouse move Event
|
||||
case WM_MOUSEMOVE :
|
||||
{
|
||||
// Check if we need to generate a MouseEntered Event
|
||||
if (!myIsCursorIn)
|
||||
{
|
||||
TRACKMOUSEEVENT MouseEvent;
|
||||
MouseEvent.cbSize = sizeof(TRACKMOUSEEVENT);
|
||||
MouseEvent.hwndTrack = myHandle;
|
||||
MouseEvent.dwFlags = TME_LEAVE;
|
||||
TrackMouseEvent(&MouseEvent);
|
||||
|
||||
myIsCursorIn = true;
|
||||
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::MouseEntered;
|
||||
eventHandler->addEvent(&Evt);
|
||||
}
|
||||
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::MouseMoved;
|
||||
Evt.MouseMove.X = LOWORD(LParam);
|
||||
Evt.MouseMove.Y = HIWORD(LParam); // (shuffle2) Added this, check to see if it's good
|
||||
eventHandler->addEvent(&Evt);
|
||||
break;
|
||||
}
|
||||
|
||||
// Mouse leave Event
|
||||
case WM_MOUSELEAVE :
|
||||
{
|
||||
myIsCursorIn = false;
|
||||
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::MouseLeft;
|
||||
eventHandler->addEvent(&Evt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Check the state of the shift keys on a key sf::Event,
|
||||
/// and return the corresponding SF key code
|
||||
|
||||
sf::Key::Code Win32Window::GetShiftState(bool KeyDown)
|
||||
{
|
||||
static bool LShiftPrevDown = false;
|
||||
static bool RShiftPrevDown = false;
|
||||
|
||||
bool LShiftDown = (HIWORD(GetAsyncKeyState(VK_LSHIFT)) != 0);
|
||||
bool RShiftDown = (HIWORD(GetAsyncKeyState(VK_RSHIFT)) != 0);
|
||||
|
||||
sf::Key::Code Code = sf::Key::Code(0);
|
||||
if (KeyDown)
|
||||
{
|
||||
if (!LShiftPrevDown && LShiftDown) Code = sf::Key::LShift;
|
||||
else if (!RShiftPrevDown && RShiftDown) Code = sf::Key::RShift;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LShiftPrevDown && !LShiftDown) Code = sf::Key::LShift;
|
||||
else if (RShiftPrevDown && !RShiftDown) Code = sf::Key::RShift;
|
||||
}
|
||||
|
||||
LShiftPrevDown = LShiftDown;
|
||||
RShiftPrevDown = RShiftDown;
|
||||
|
||||
return Code;
|
||||
}
|
||||
|
||||
|
||||
/// Convert a Win32 virtual key code to a SFML key code
|
||||
|
||||
sf::Key::Code Win32Window::VirtualKeyCodeToSF(WPARAM VirtualKey, LPARAM Flags)
|
||||
{
|
||||
switch (VirtualKey)
|
||||
{
|
||||
// VK_SHIFT is handled by the GetShiftState function
|
||||
case VK_MENU : return (Flags & (1 << 24)) ? sf::Key::RAlt : sf::Key::LAlt;
|
||||
case VK_CONTROL : return (Flags & (1 << 24)) ? sf::Key::RControl : sf::Key::LControl;
|
||||
case VK_LWIN : return sf::Key::LSystem;
|
||||
case VK_RWIN : return sf::Key::RSystem;
|
||||
case VK_APPS : return sf::Key::Menu;
|
||||
case VK_OEM_1 : return sf::Key::SemiColon;
|
||||
case VK_OEM_2 : return sf::Key::Slash;
|
||||
case VK_OEM_PLUS : return sf::Key::Equal;
|
||||
case VK_OEM_MINUS : return sf::Key::Dash;
|
||||
case VK_OEM_4 : return sf::Key::LBracket;
|
||||
case VK_OEM_6 : return sf::Key::RBracket;
|
||||
case VK_OEM_COMMA : return sf::Key::Comma;
|
||||
case VK_OEM_PERIOD : return sf::Key::Period;
|
||||
case VK_OEM_7 : return sf::Key::Quote;
|
||||
case VK_OEM_5 : return sf::Key::BackSlash;
|
||||
case VK_OEM_3 : return sf::Key::Tilde;
|
||||
case VK_ESCAPE : return sf::Key::Escape;
|
||||
case VK_SPACE : return sf::Key::Space;
|
||||
case VK_RETURN : return sf::Key::Return;
|
||||
case VK_BACK : return sf::Key::Back;
|
||||
case VK_TAB : return sf::Key::Tab;
|
||||
case VK_PRIOR : return sf::Key::PageUp;
|
||||
case VK_NEXT : return sf::Key::PageDown;
|
||||
case VK_END : return sf::Key::End;
|
||||
case VK_HOME : return sf::Key::Home;
|
||||
case VK_INSERT : return sf::Key::Insert;
|
||||
case VK_DELETE : return sf::Key::Delete;
|
||||
case VK_ADD : return sf::Key::Add;
|
||||
case VK_SUBTRACT : return sf::Key::Subtract;
|
||||
case VK_MULTIPLY : return sf::Key::Multiply;
|
||||
case VK_DIVIDE : return sf::Key::Divide;
|
||||
case VK_PAUSE : return sf::Key::Pause;
|
||||
case VK_F1 : return sf::Key::F1;
|
||||
case VK_F2 : return sf::Key::F2;
|
||||
case VK_F3 : return sf::Key::F3;
|
||||
case VK_F4 : return sf::Key::F4;
|
||||
case VK_F5 : return sf::Key::F5;
|
||||
case VK_F6 : return sf::Key::F6;
|
||||
case VK_F7 : return sf::Key::F7;
|
||||
case VK_F8 : return sf::Key::F8;
|
||||
case VK_F9 : return sf::Key::F9;
|
||||
case VK_F10 : return sf::Key::F10;
|
||||
case VK_F11 : return sf::Key::F11;
|
||||
case VK_F12 : return sf::Key::F12;
|
||||
case VK_F13 : return sf::Key::F13;
|
||||
case VK_F14 : return sf::Key::F14;
|
||||
case VK_F15 : return sf::Key::F15;
|
||||
case VK_LEFT : return sf::Key::Left;
|
||||
case VK_RIGHT : return sf::Key::Right;
|
||||
case VK_UP : return sf::Key::Up;
|
||||
case VK_DOWN : return sf::Key::Down;
|
||||
case VK_NUMPAD0 : return sf::Key::Numpad0;
|
||||
case VK_NUMPAD1 : return sf::Key::Numpad1;
|
||||
case VK_NUMPAD2 : return sf::Key::Numpad2;
|
||||
case VK_NUMPAD3 : return sf::Key::Numpad3;
|
||||
case VK_NUMPAD4 : return sf::Key::Numpad4;
|
||||
case VK_NUMPAD5 : return sf::Key::Numpad5;
|
||||
case VK_NUMPAD6 : return sf::Key::Numpad6;
|
||||
case VK_NUMPAD7 : return sf::Key::Numpad7;
|
||||
case VK_NUMPAD8 : return sf::Key::Numpad8;
|
||||
case VK_NUMPAD9 : return sf::Key::Numpad9;
|
||||
case 'A' : return sf::Key::A;
|
||||
case 'Z' : return sf::Key::Z;
|
||||
case 'E' : return sf::Key::E;
|
||||
case 'R' : return sf::Key::R;
|
||||
case 'T' : return sf::Key::T;
|
||||
case 'Y' : return sf::Key::Y;
|
||||
case 'U' : return sf::Key::U;
|
||||
case 'I' : return sf::Key::I;
|
||||
case 'O' : return sf::Key::O;
|
||||
case 'P' : return sf::Key::P;
|
||||
case 'Q' : return sf::Key::Q;
|
||||
case 'S' : return sf::Key::S;
|
||||
case 'D' : return sf::Key::D;
|
||||
case 'F' : return sf::Key::F;
|
||||
case 'G' : return sf::Key::G;
|
||||
case 'H' : return sf::Key::H;
|
||||
case 'J' : return sf::Key::J;
|
||||
case 'K' : return sf::Key::K;
|
||||
case 'L' : return sf::Key::L;
|
||||
case 'M' : return sf::Key::M;
|
||||
case 'W' : return sf::Key::W;
|
||||
case 'X' : return sf::Key::X;
|
||||
case 'C' : return sf::Key::C;
|
||||
case 'V' : return sf::Key::V;
|
||||
case 'B' : return sf::Key::B;
|
||||
case 'N' : return sf::Key::N;
|
||||
case '0' : return sf::Key::Num0;
|
||||
case '1' : return sf::Key::Num1;
|
||||
case '2' : return sf::Key::Num2;
|
||||
case '3' : return sf::Key::Num3;
|
||||
case '4' : return sf::Key::Num4;
|
||||
case '5' : return sf::Key::Num5;
|
||||
case '6' : return sf::Key::Num6;
|
||||
case '7' : return sf::Key::Num7;
|
||||
case '8' : return sf::Key::Num8;
|
||||
case '9' : return sf::Key::Num9;
|
||||
}
|
||||
|
||||
return sf::Key::Code(0);
|
||||
}
|
||||
|
||||
|
||||
/// Win32 Callback for the window class
|
||||
|
||||
LRESULT CALLBACK Win32Window::GlobalOnEvent(HWND Handle, UINT Message, WPARAM WParam, LPARAM LParam)
|
||||
{
|
||||
// Associate handle and Window instance when the creation message is received
|
||||
if (Message == WM_CREATE)
|
||||
{
|
||||
// Get Win32Window instance (it was passed as the last argument of CreateWindow)
|
||||
long This = reinterpret_cast<long>(reinterpret_cast<CREATESTRUCT*>(LParam)->lpCreateParams);
|
||||
|
||||
// Set as the "user data" parameter of the window
|
||||
SetWindowLongPtr(Handle, GWLP_USERDATA, This);
|
||||
}
|
||||
|
||||
// Get the GLWindow instance corresponding to the window handle
|
||||
Win32Window* Window = reinterpret_cast<Win32Window*>(GetWindowLongPtr(Handle, GWLP_USERDATA));
|
||||
|
||||
// Forward the event to the appropriate function
|
||||
if (Window)
|
||||
{
|
||||
Window->ProcessEvent(Message, WParam, LParam);
|
||||
|
||||
if (Window->myCallback)
|
||||
return CallWindowProc(reinterpret_cast<WNDPROC>(Window->myCallback), Handle, Message, WParam, LParam);
|
||||
}
|
||||
|
||||
// We don't forward the WM_CLOSE message to prevent the OS from automatically destroying the window
|
||||
if (Message == WM_CLOSE)
|
||||
return 0;
|
||||
|
||||
return DefWindowProc(Handle, Message, WParam, LParam);
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
#ifndef _WIN32WINDOW_H
|
||||
#define _WIN32WINDOW_H
|
||||
|
||||
#include "GLWindow.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
class Win32Window : public GLWindow
|
||||
{
|
||||
public:
|
||||
virtual void SwapBuffers();
|
||||
virtual void SetWindowText(const char *text);
|
||||
virtual bool PeekMessages();
|
||||
virtual void Update();
|
||||
virtual bool MakeCurrent();
|
||||
HWND GetWnd(){return myHandle;};
|
||||
HWND GetParentWnd(){return myParent;};
|
||||
|
||||
static bool valid() { return true; }
|
||||
~Win32Window();
|
||||
Win32Window();
|
||||
static sf::Key::Code VirtualKeyCodeToSF(WPARAM VirtualKey, LPARAM Flags);
|
||||
static sf::Key::Code GetShiftState(bool KeyDown);
|
||||
|
||||
private:
|
||||
struct VideoMode
|
||||
{
|
||||
unsigned int Width;
|
||||
unsigned int Height;
|
||||
unsigned int BitsPerPixel;
|
||||
unsigned int DepthBits;
|
||||
unsigned int StencilBits;
|
||||
unsigned int AntialiasingLevel;
|
||||
};
|
||||
|
||||
virtual void ShowMouseCursor(bool Show);
|
||||
void RegisterWindowClass();
|
||||
void SwitchToFullscreen(const VideoMode& Mode);
|
||||
void CreateContext(VideoMode& Mode);
|
||||
void Cleanup();
|
||||
void ProcessEvent(UINT Message, WPARAM WParam, LPARAM LParam);
|
||||
static LRESULT CALLBACK GlobalOnEvent(HWND Handle, UINT Message, WPARAM WParam, LPARAM LParam);
|
||||
|
||||
// Static member data
|
||||
static unsigned int ourWindowCount;
|
||||
static const char* ourClassName;
|
||||
static Win32Window* ourFullscreenWindow;
|
||||
|
||||
// Member data
|
||||
HWND myHandle;
|
||||
HINSTANCE myhInstance;
|
||||
HWND myParent; // Possibly not wanted here
|
||||
long myCallback;
|
||||
HCURSOR myCursor;
|
||||
HICON myIcon;
|
||||
bool myKeyRepeatEnabled;
|
||||
bool myIsCursorIn;
|
||||
HDC myDeviceContext;
|
||||
HGLRC myGLContext;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
class Win32Window : public GLWindow
|
||||
{
|
||||
public:
|
||||
Win32Window() {}
|
||||
};
|
||||
|
||||
#endif //_WIN32
|
||||
#endif //_WIN32WINDOW_H
|
|
@ -1,392 +0,0 @@
|
|||
#include "X11Window.h"
|
||||
|
||||
X11Window::X11Window() : GLWindow() {
|
||||
|
||||
XVisualInfo *vi;
|
||||
Colormap cmap;
|
||||
int dpyWidth, dpyHeight;
|
||||
int glxMajorVersion, glxMinorVersion;
|
||||
int vidModeMajorVersion, vidModeMinorVersion;
|
||||
Atom wmDelete;
|
||||
|
||||
// attributes for a single buffered visual in RGBA format with at least
|
||||
// 8 bits per color and a 24 bit depth buffer
|
||||
int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 8,
|
||||
GLX_GREEN_SIZE, 8,
|
||||
GLX_BLUE_SIZE, 8,
|
||||
GLX_DEPTH_SIZE, 24,
|
||||
None};
|
||||
|
||||
// attributes for a double buffered visual in RGBA format with at least
|
||||
// 8 bits per color and a 24 bit depth buffer
|
||||
int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER,
|
||||
GLX_RED_SIZE, 8,
|
||||
GLX_GREEN_SIZE, 8,
|
||||
GLX_BLUE_SIZE, 8,
|
||||
GLX_DEPTH_SIZE, 24,
|
||||
GLX_SAMPLE_BUFFERS_ARB,
|
||||
g_Config.iMultisampleMode,
|
||||
GLX_SAMPLES_ARB, 1, None };
|
||||
dpy = XOpenDisplay(0);
|
||||
g_VideoInitialize.pWindowHandle = (HWND)dpy;
|
||||
screen = DefaultScreen(dpy);
|
||||
|
||||
fs = g_Config.bFullscreen; //Set to setting in Options
|
||||
|
||||
/* get an appropriate visual */
|
||||
vi = glXChooseVisual(dpy, screen, attrListDbl);
|
||||
if (vi == NULL) {
|
||||
vi = glXChooseVisual(dpy, screen, attrListSgl);
|
||||
doubleBuffered = False;
|
||||
ERROR_LOG("Only Singlebuffered Visual!\n");
|
||||
} else {
|
||||
doubleBuffered = True;
|
||||
NOTICE_LOG("Got Doublebuffered Visual!\n");
|
||||
}
|
||||
|
||||
glXQueryVersion(dpy, &glxMajorVersion, &glxMinorVersion);
|
||||
NOTICE_LOG("glX-Version %d.%d\n", glxMajorVersion, glxMinorVersion);
|
||||
/* create a GLX context */
|
||||
ctx = glXCreateContext(dpy, vi, 0, GL_TRUE);
|
||||
if(!ctx) {
|
||||
ERROR_LOG("Couldn't Create GLX context.Quit");
|
||||
exit(0); // TODO: Don't bring down entire Emu
|
||||
}
|
||||
|
||||
/* create a color map */
|
||||
cmap = XCreateColormap(dpy, RootWindow(dpy, vi->screen),
|
||||
vi->visual, AllocNone);
|
||||
attr.colormap = cmap;
|
||||
attr.border_pixel = 0;
|
||||
|
||||
XkbSetDetectableAutoRepeat(dpy, True, NULL);
|
||||
|
||||
// get a connection
|
||||
XF86VidModeQueryVersion(dpy, &vidModeMajorVersion, &vidModeMinorVersion);
|
||||
|
||||
if (fs) {
|
||||
|
||||
XF86VidModeModeInfo **modes = NULL;
|
||||
int modeNum = 0;
|
||||
int bestMode = 0;
|
||||
|
||||
// set best mode to current
|
||||
bestMode = 0;
|
||||
NOTICE_LOG("XF86VidModeExtension-Version %d.%d\n", vidModeMajorVersion, vidModeMinorVersion);
|
||||
XF86VidModeGetAllModeLines(dpy, screen, &modeNum, &modes);
|
||||
|
||||
if (modeNum > 0 && modes != NULL) {
|
||||
/* save desktop-resolution before switching modes */
|
||||
deskMode = *modes[0];
|
||||
/* look for mode with requested resolution */
|
||||
for (int i = 0; i < modeNum; i++) {
|
||||
if ((modes[i]->hdisplay == GetXwin()) &&
|
||||
(modes[i]->vdisplay == GetYwin())) {
|
||||
bestMode = i;
|
||||
}
|
||||
}
|
||||
|
||||
XF86VidModeSwitchToMode(dpy, screen, modes[bestMode]);
|
||||
XF86VidModeSetViewPort(dpy, screen, 0, 0);
|
||||
dpyWidth = modes[bestMode]->hdisplay;
|
||||
dpyHeight = modes[bestMode]->vdisplay;
|
||||
NOTICE_LOG("Resolution %dx%d\n", dpyWidth, dpyHeight);
|
||||
XFree(modes);
|
||||
|
||||
/* create a fullscreen window */
|
||||
attr.override_redirect = True;
|
||||
attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask |
|
||||
KeyReleaseMask | ButtonReleaseMask | StructureNotifyMask;
|
||||
win = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 0, 0,
|
||||
dpyWidth, dpyHeight, 0, vi->depth, InputOutput,
|
||||
vi->visual, CWBorderPixel | CWColormap |
|
||||
CWEventMask | CWOverrideRedirect, &attr);
|
||||
XWarpPointer(dpy, None, win, 0, 0, 0, 0, 0, 0);
|
||||
XMapRaised(dpy, win);
|
||||
XGrabKeyboard(dpy, win, True, GrabModeAsync,
|
||||
GrabModeAsync, CurrentTime);
|
||||
XGrabPointer(dpy, win, True, ButtonPressMask,
|
||||
GrabModeAsync, GrabModeAsync, win, None, CurrentTime);
|
||||
}
|
||||
else {
|
||||
ERROR_LOG("Failed to start fullscreen. If you received the \n"
|
||||
"\"XFree86-VidModeExtension\" extension is missing, add\n"
|
||||
"Load \"extmod\"\n"
|
||||
"to your X configuration file (under the Module Section)\n");
|
||||
fs = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!fs) {
|
||||
|
||||
// create a window in window mode
|
||||
attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask |
|
||||
KeyReleaseMask | ButtonReleaseMask |
|
||||
StructureNotifyMask | ResizeRedirectMask;
|
||||
win = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, GetXwin(),
|
||||
GetYwin(), 0, vi->depth, InputOutput, vi->visual,
|
||||
CWBorderPixel | CWColormap | CWEventMask, &attr);
|
||||
// only set window title and handle wm_delete_events if in windowed mode
|
||||
wmDelete = XInternAtom(dpy, "WM_DELETE_WINDOW", True);
|
||||
XSetWMProtocols(dpy, win, &wmDelete, 1);
|
||||
XSetStandardProperties(dpy, win, "GPU",
|
||||
"GPU", None, NULL, 0, NULL);
|
||||
XMapRaised(dpy, win);
|
||||
}
|
||||
}
|
||||
|
||||
X11Window::~X11Window() {
|
||||
if (ctx) {
|
||||
if (!glXMakeCurrent(dpy, None, NULL)) {
|
||||
ERROR_LOG("Could not release drawing context.\n");
|
||||
}
|
||||
XUnmapWindow(dpy, win);
|
||||
glXDestroyContext(dpy, ctx);
|
||||
XCloseDisplay(dpy);
|
||||
ctx = NULL;
|
||||
}
|
||||
/* switch back to original desktop resolution if we were in fs */
|
||||
if (dpy != NULL) {
|
||||
if (fs) {
|
||||
XF86VidModeSwitchToMode(dpy, screen, &deskMode);
|
||||
XF86VidModeSetViewPort(dpy, screen, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void X11Window::SwapBuffers() {
|
||||
glXSwapBuffers(dpy, win);
|
||||
}
|
||||
|
||||
void X11Window::SetWindowText(const char *text) {
|
||||
/**
|
||||
* Tell X to ask the window manager to set the window title. (X
|
||||
* itself doesn't provide window title functionality.)
|
||||
*/
|
||||
XStoreName(dpy, win, text);
|
||||
}
|
||||
|
||||
bool X11Window::PeekMessages() {
|
||||
// TODO: implement
|
||||
return false;
|
||||
}
|
||||
|
||||
// Taken from sfml code
|
||||
void X11Window::ProcessEvent(XEvent WinEvent) {
|
||||
switch (WinEvent.type) {
|
||||
|
||||
case KeyPress :
|
||||
{
|
||||
// Get the keysym of the key that has been pressed
|
||||
static XComposeStatus KeyboardStatus;
|
||||
char Buffer[32];
|
||||
KeySym Sym;
|
||||
XLookupString(&WinEvent.xkey, Buffer, sizeof(Buffer), &Sym, &KeyboardStatus);
|
||||
|
||||
// Fill the event parameters
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::KeyPressed;
|
||||
Evt.Key.Code = KeysymToSF(Sym);
|
||||
Evt.Key.Alt = WinEvent.xkey.state & Mod1Mask;
|
||||
Evt.Key.Control = WinEvent.xkey.state & ControlMask;
|
||||
Evt.Key.Shift = WinEvent.xkey.state & ShiftMask;
|
||||
eventHandler->addEvent(&Evt);
|
||||
break;
|
||||
}
|
||||
// Key up event
|
||||
case KeyRelease :
|
||||
{
|
||||
// Get the keysym of the key that has been pressed
|
||||
char Buffer[32];
|
||||
KeySym Sym;
|
||||
XLookupString(&WinEvent.xkey, Buffer, 32, &Sym, NULL);
|
||||
|
||||
// Fill the event parameters
|
||||
sf::Event Evt;
|
||||
Evt.Type = sf::Event::KeyReleased;
|
||||
Evt.Key.Code = KeysymToSF(Sym);
|
||||
Evt.Key.Alt = WinEvent.xkey.state & Mod1Mask;
|
||||
Evt.Key.Control = WinEvent.xkey.state & ControlMask;
|
||||
Evt.Key.Shift = WinEvent.xkey.state & ShiftMask;
|
||||
eventHandler->addEvent(&Evt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void X11Window::Update() {
|
||||
// We just check all of our events here
|
||||
XEvent event;
|
||||
// KeySym key;
|
||||
// int x,y;
|
||||
// u32 w,h,depth;
|
||||
|
||||
int num_events;
|
||||
for (num_events = XPending(dpy);num_events > 0;num_events--) {
|
||||
XNextEvent(dpy, &event);
|
||||
ProcessEvent(event);
|
||||
/* case ButtonPress:
|
||||
case ButtonRelease:
|
||||
XPutBackEvent(dpy, &event);
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
Window winDummy;
|
||||
unsigned int borderDummy;
|
||||
XGetGeometry(dpy, win, &winDummy, &x, &y,
|
||||
&w, &h, &borderDummy, &depth);
|
||||
SetSize(w, h);
|
||||
break;
|
||||
case ClientMessage: //TODO: We aren't reading this correctly, It could be anything, highest chance is that it's a close event though
|
||||
Video_Shutdown(); // Calling from here since returning false does nothing
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
//TODO: Should we put the event back if we don't handle it?
|
||||
// I think we handle all the needed ones, the rest shouldn't matter
|
||||
// But to be safe, let's but them back anyway
|
||||
//XPutBackEvent(dpy, &event);
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
|
||||
eventHandler->Update();
|
||||
updateDim();
|
||||
}
|
||||
|
||||
bool X11Window::MakeCurrent() {
|
||||
|
||||
Window winDummy;
|
||||
unsigned int borderDummy;
|
||||
int x,y;
|
||||
u32 w,h,depth;
|
||||
// connect the glx-context to the window
|
||||
glXMakeCurrent(dpy, win, ctx);
|
||||
XGetGeometry(dpy, win, &winDummy, &x, &y,
|
||||
&w, &h, &borderDummy, &depth);
|
||||
|
||||
NOTICE_LOG("GLWin Depth %d", depth);
|
||||
if (glXIsDirect(dpy, ctx)) {
|
||||
ERROR_LOG("you have Direct Rendering!");
|
||||
} else {
|
||||
NOTICE_LOG("no Direct Rendering possible!");
|
||||
}
|
||||
|
||||
// better for pad plugin key input (thc)
|
||||
XSelectInput(dpy, win, ExposureMask | KeyPressMask | ButtonPressMask |
|
||||
KeyReleaseMask | ButtonReleaseMask | StructureNotifyMask |
|
||||
EnterWindowMask | LeaveWindowMask | FocusChangeMask);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Taken from SF code
|
||||
sf::Key::Code X11Window::KeysymToSF(KeySym Sym) {
|
||||
// First convert to uppercase (to avoid dealing with two different keysyms for the same key)
|
||||
KeySym Lower, Key;
|
||||
XConvertCase(Sym, &Lower, &Key);
|
||||
|
||||
switch (Key)
|
||||
{
|
||||
case XK_Shift_L : return sf::Key::LShift;
|
||||
case XK_Shift_R : return sf::Key::RShift;
|
||||
case XK_Control_L : return sf::Key::LControl;
|
||||
case XK_Control_R : return sf::Key::RControl;
|
||||
case XK_Alt_L : return sf::Key::LAlt;
|
||||
case XK_Alt_R : return sf::Key::RAlt;
|
||||
case XK_Super_L : return sf::Key::LSystem;
|
||||
case XK_Super_R : return sf::Key::RSystem;
|
||||
case XK_Menu : return sf::Key::Menu;
|
||||
case XK_Escape : return sf::Key::Escape;
|
||||
case XK_semicolon : return sf::Key::SemiColon;
|
||||
case XK_slash : return sf::Key::Slash;
|
||||
case XK_equal : return sf::Key::Equal;
|
||||
case XK_minus : return sf::Key::Dash;
|
||||
case XK_bracketleft : return sf::Key::LBracket;
|
||||
case XK_bracketright : return sf::Key::RBracket;
|
||||
case XK_comma : return sf::Key::Comma;
|
||||
case XK_period : return sf::Key::Period;
|
||||
case XK_dead_acute : return sf::Key::Quote;
|
||||
case XK_backslash : return sf::Key::BackSlash;
|
||||
case XK_dead_grave : return sf::Key::Tilde;
|
||||
case XK_space : return sf::Key::Space;
|
||||
case XK_Return : return sf::Key::Return;
|
||||
case XK_KP_Enter : return sf::Key::Return;
|
||||
case XK_BackSpace : return sf::Key::Back;
|
||||
case XK_Tab : return sf::Key::Tab;
|
||||
case XK_Prior : return sf::Key::PageUp;
|
||||
case XK_Next : return sf::Key::PageDown;
|
||||
case XK_End : return sf::Key::End;
|
||||
case XK_Home : return sf::Key::Home;
|
||||
case XK_Insert : return sf::Key::Insert;
|
||||
case XK_Delete : return sf::Key::Delete;
|
||||
case XK_KP_Add : return sf::Key::Add;
|
||||
case XK_KP_Subtract : return sf::Key::Subtract;
|
||||
case XK_KP_Multiply : return sf::Key::Multiply;
|
||||
case XK_KP_Divide : return sf::Key::Divide;
|
||||
case XK_Pause : return sf::Key::Pause;
|
||||
case XK_F1 : return sf::Key::F1;
|
||||
case XK_F2 : return sf::Key::F2;
|
||||
case XK_F3 : return sf::Key::F3;
|
||||
case XK_F4 : return sf::Key::F4;
|
||||
case XK_F5 : return sf::Key::F5;
|
||||
case XK_F6 : return sf::Key::F6;
|
||||
case XK_F7 : return sf::Key::F7;
|
||||
case XK_F8 : return sf::Key::F8;
|
||||
case XK_F9 : return sf::Key::F9;
|
||||
case XK_F10 : return sf::Key::F10;
|
||||
case XK_F11 : return sf::Key::F11;
|
||||
case XK_F12 : return sf::Key::F12;
|
||||
case XK_F13 : return sf::Key::F13;
|
||||
case XK_F14 : return sf::Key::F14;
|
||||
case XK_F15 : return sf::Key::F15;
|
||||
case XK_Left : return sf::Key::Left;
|
||||
case XK_Right : return sf::Key::Right;
|
||||
case XK_Up : return sf::Key::Up;
|
||||
case XK_Down : return sf::Key::Down;
|
||||
case XK_KP_0 : return sf::Key::Numpad0;
|
||||
case XK_KP_1 : return sf::Key::Numpad1;
|
||||
case XK_KP_2 : return sf::Key::Numpad2;
|
||||
case XK_KP_3 : return sf::Key::Numpad3;
|
||||
case XK_KP_4 : return sf::Key::Numpad4;
|
||||
case XK_KP_5 : return sf::Key::Numpad5;
|
||||
case XK_KP_6 : return sf::Key::Numpad6;
|
||||
case XK_KP_7 : return sf::Key::Numpad7;
|
||||
case XK_KP_8 : return sf::Key::Numpad8;
|
||||
case XK_Z : return sf::Key::Z;
|
||||
case XK_E : return sf::Key::E;
|
||||
case XK_R : return sf::Key::R;
|
||||
case XK_T : return sf::Key::T;
|
||||
case XK_Y : return sf::Key::Y;
|
||||
case XK_U : return sf::Key::U;
|
||||
case XK_I : return sf::Key::I;
|
||||
case XK_O : return sf::Key::O;
|
||||
case XK_P : return sf::Key::P;
|
||||
case XK_Q : return sf::Key::Q;
|
||||
case XK_S : return sf::Key::S;
|
||||
case XK_D : return sf::Key::D;
|
||||
case XK_F : return sf::Key::F;
|
||||
case XK_G : return sf::Key::G;
|
||||
case XK_H : return sf::Key::H;
|
||||
case XK_J : return sf::Key::J;
|
||||
case XK_K : return sf::Key::K;
|
||||
case XK_L : return sf::Key::L;
|
||||
case XK_M : return sf::Key::M;
|
||||
case XK_W : return sf::Key::W;
|
||||
case XK_X : return sf::Key::X;
|
||||
case XK_C : return sf::Key::C;
|
||||
case XK_V : return sf::Key::V;
|
||||
case XK_B : return sf::Key::B;
|
||||
case XK_N : return sf::Key::N;
|
||||
case XK_0 : return sf::Key::Num0;
|
||||
case XK_1 : return sf::Key::Num1;
|
||||
case XK_2 : return sf::Key::Num2;
|
||||
case XK_3 : return sf::Key::Num3;
|
||||
case XK_4 : return sf::Key::Num4;
|
||||
case XK_5 : return sf::Key::Num5;
|
||||
case XK_6 : return sf::Key::Num6;
|
||||
case XK_7 : return sf::Key::Num7;
|
||||
case XK_8 : return sf::Key::Num8;
|
||||
case XK_9 : return sf::Key::Num9;
|
||||
}
|
||||
return sf::Key::Code(0);
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
#ifndef _X11WINDOW_H
|
||||
#define _X11WINDOW_H
|
||||
|
||||
#include "GLWindow.h"
|
||||
#if defined HAVE_X11 && HAVE_X11
|
||||
#include <GL/glxew.h>
|
||||
#include <GL/gl.h>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
|
||||
#include <X11/extensions/xf86vmode.h>
|
||||
#include <X11/XKBlib.h>
|
||||
|
||||
class X11Window : public GLWindow
|
||||
{
|
||||
public:
|
||||
int screen;
|
||||
Window win;
|
||||
Display *dpy;
|
||||
GLXContext ctx;
|
||||
XSetWindowAttributes attr;
|
||||
Bool fs;
|
||||
Bool doubleBuffered;
|
||||
XF86VidModeModeInfo deskMode;
|
||||
|
||||
virtual void SwapBuffers();
|
||||
virtual void SetWindowText(const char *text);
|
||||
virtual bool PeekMessages();
|
||||
virtual void Update();
|
||||
virtual bool MakeCurrent();
|
||||
|
||||
static bool valid() { return true; }
|
||||
~X11Window();
|
||||
X11Window();
|
||||
static sf::Key::Code KeysymToSF(KeySym Sym);
|
||||
private:
|
||||
void ProcessEvent(XEvent WinEvent);
|
||||
|
||||
};
|
||||
#else
|
||||
class X11Window : public GLWindow
|
||||
{
|
||||
public:
|
||||
X11Window() {}
|
||||
};
|
||||
#endif
|
||||
#endif
|
|
@ -22,29 +22,29 @@
|
|||
|
||||
1.1 Display settings
|
||||
|
||||
Internal and fullscreen resolution: Since the only internal resolutions allowed are also
|
||||
fullscreen resolution allowed by the system there is only need for one resolution setting
|
||||
that applies to both the internal resolution and the fullscreen resolution.
|
||||
- Apparently no, someone else doesn't agree
|
||||
Internal and fullscreen resolution: Since the only internal resolutions allowed
|
||||
are also fullscreen resolution allowed by the system there is only need for one
|
||||
resolution setting that applies to both the internal resolution and the
|
||||
fullscreen resolution. - Apparently no, someone else doesn't agree
|
||||
|
||||
Todo: Make the internal resolution option apply instantly, currently only the native and 2x option
|
||||
applies instantly. To do this we need to be able to change the reinitialize FramebufferManager:Init()
|
||||
while a game is running.
|
||||
Todo: Make the internal resolution option apply instantly, currently only the
|
||||
native and 2x option applies instantly. To do this we need to be able to change
|
||||
the reinitialize FramebufferManager:Init() while a game is running.
|
||||
|
||||
1.2 Screenshots
|
||||
|
||||
|
||||
The screenshots should be taken from the internal representation of the picture regardless of
|
||||
what the current window size is. Since AA and wireframe is applied together with the picture resizing
|
||||
this rule is not currently applied to AA or wireframe pictures, they are instead taken from whatever
|
||||
the window size is.
|
||||
The screenshots should be taken from the internal representation of the picture
|
||||
regardless of what the current window size is. Since AA and wireframe is
|
||||
applied together with the picture resizing this rule is not currently applied
|
||||
to AA or wireframe pictures, they are instead taken from whatever the window
|
||||
size is.
|
||||
|
||||
Todo: Render AA and wireframe to a separate picture used for the screenshot in addition to the one
|
||||
for display.
|
||||
Todo: Render AA and wireframe to a separate picture used for the screenshot in
|
||||
addition to the one for display.
|
||||
|
||||
1.3 AA
|
||||
|
||||
|
||||
Make AA apply instantly during gameplay if possible
|
||||
|
||||
*/
|
||||
|
@ -115,12 +115,10 @@ void GetDllInfo (PLUGIN_INFO* _PluginInfo)
|
|||
_PluginInfo->Type = PLUGIN_TYPE_VIDEO;
|
||||
#ifdef DEBUGFAST
|
||||
sprintf(_PluginInfo->Name, "Dolphin OpenGL (DebugFast)");
|
||||
#else
|
||||
#ifndef _DEBUG
|
||||
sprintf(_PluginInfo->Name, "Dolphin OpenGL");
|
||||
#else
|
||||
#elif defined _DEBUG
|
||||
sprintf(_PluginInfo->Name, "Dolphin OpenGL (Debug)");
|
||||
#endif
|
||||
#else
|
||||
sprintf(_PluginInfo->Name, "Dolphin OpenGL");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -151,39 +149,21 @@ wxWindow* GetParentedWxWindow(HWND Parent)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
void DllDebugger(HWND _hParent, bool Show)
|
||||
{
|
||||
if (Show)
|
||||
{
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
if (Show) {
|
||||
if (!m_DebuggerFrame)
|
||||
m_DebuggerFrame = new GFXDebuggerOGL(NULL);
|
||||
//m_DebuggerFrame = new GFXDebuggerOGL(GetParentedWxWindow(_hParent));
|
||||
m_DebuggerFrame->Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (m_DebuggerFrame) m_DebuggerFrame->Hide();
|
||||
}
|
||||
}
|
||||
#else
|
||||
void DllDebugger(HWND _hParent, bool Show) { }
|
||||
#endif
|
||||
}
|
||||
|
||||
void DllConfig(HWND _hParent)
|
||||
{
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
//if (!m_ConfigFrame)
|
||||
if (allowConfigShow) // Prevent user to show more than 1 config window at same time
|
||||
{
|
||||
m_ConfigFrame = new GFXConfigDialogOGL(GetParentedWxWindow(_hParent));
|
||||
|
||||
//else if (!m_ConfigFrame->GetParent()->IsShown())
|
||||
// m_ConfigFrame->Close(true);
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
void Win32AddResolutions() {
|
||||
// Search for avaliable resolutions
|
||||
|
||||
DWORD iModeNum = 0;
|
||||
|
@ -199,7 +179,8 @@ if (allowConfigShow) // Prevent user to show more than 1 config window at same t
|
|||
char szBuffer[100];
|
||||
sprintf(szBuffer, "%dx%d", dmi.dmPelsWidth, dmi.dmPelsHeight);
|
||||
std::string strBuffer(szBuffer);
|
||||
// Create a check loop to check every pointer of resolutions to see if the res is added or not
|
||||
// Create a check loop to check every pointer of resolutions to see if
|
||||
// the res is added or not
|
||||
int b = 0;
|
||||
bool resFound = false;
|
||||
while (b < i && !resFound)
|
||||
|
@ -209,7 +190,8 @@ if (allowConfigShow) // Prevent user to show more than 1 config window at same t
|
|||
b++;
|
||||
}
|
||||
// Add the resolution
|
||||
if (!resFound && i < 100) // don't want to overflow resos array. not likely to happen, but you never know.
|
||||
if (!resFound && i < 100) // don't want to overflow resos array. not
|
||||
// likely to happen, but you never know.
|
||||
{
|
||||
resos.push_back(strBuffer);
|
||||
i++;
|
||||
|
@ -218,11 +200,11 @@ if (allowConfigShow) // Prevent user to show more than 1 config window at same t
|
|||
}
|
||||
ZeroMemory(&dmi, sizeof(dmi));
|
||||
}
|
||||
|
||||
#elif defined(HAVE_X11) && HAVE_X11 && defined(HAVE_XXF86VM) && HAVE_XXF86VM
|
||||
|
||||
int glxMajorVersion, glxMinorVersion;
|
||||
int vidModeMajorVersion, vidModeMinorVersion;
|
||||
}
|
||||
#elif defined(HAVE_X11) && HAVE_X11 && defined(HAVE_XXF86VM) && HAVE_XXF86VM
|
||||
void X11AddResolutions() {
|
||||
int glxMajorVersion, glxMinorVersion;
|
||||
int vidModeMajorVersion, vidModeMinorVersion;
|
||||
GLWin.dpy = XOpenDisplay(0);
|
||||
glXQueryVersion(GLWin.dpy, &glxMajorVersion, &glxMinorVersion);
|
||||
XF86VidModeQueryVersion(GLWin.dpy, &vidModeMajorVersion, &vidModeMinorVersion);
|
||||
|
@ -244,45 +226,47 @@ if (allowConfigShow) // Prevent user to show more than 1 config window at same t
|
|||
char temp[32];
|
||||
sprintf(temp,"%dx%d", modes[i]->hdisplay, modes[i]->vdisplay);
|
||||
m_ConfigFrame->AddFSReso(temp);
|
||||
m_ConfigFrame->AddWindowReso(temp);//Add same to Window ones, since they should be nearly all that's needed
|
||||
px = modes[i]->hdisplay;//Used to remove repeating from different screen depths
|
||||
m_ConfigFrame->AddWindowReso(temp);//Add same to Window ones,
|
||||
//since they should be
|
||||
//nearly all that's needed
|
||||
px = modes[i]->hdisplay;//Used to remove repeating from
|
||||
//different screen depths
|
||||
py = modes[i]->vdisplay;
|
||||
}
|
||||
}
|
||||
}
|
||||
XFree(modes);
|
||||
|
||||
}
|
||||
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||
|
||||
void CocaAddResolutions() {
|
||||
|
||||
CFArrayRef modes;
|
||||
CFRange range;
|
||||
CFDictionaryRef modesDict;
|
||||
CFNumberRef modeValue;
|
||||
|
||||
|
||||
int modeWidth;
|
||||
int modeHeight;
|
||||
int modeBpp;
|
||||
int modeIndex;
|
||||
int px = 0, py = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
modes = CGDisplayAvailableModes(CGMainDisplayID());
|
||||
|
||||
|
||||
range.location = 0;
|
||||
range.length = CFArrayGetCount(modes);
|
||||
|
||||
for (modeIndex=0; modeIndex<range.length; modeIndex++)
|
||||
{
|
||||
|
||||
for (modeIndex=0; modeIndex<range.length; modeIndex++) {
|
||||
modesDict = (CFDictionaryRef)CFArrayGetValueAtIndex(modes, modeIndex);
|
||||
modeValue = (CFNumberRef) CFDictionaryGetValue(modesDict, kCGDisplayWidth);
|
||||
CFNumberGetValue(modeValue, kCFNumberLongType, &modeWidth);
|
||||
CFNumberGetValue(modeValue, kCFNumberLongType, &modeWidth);
|
||||
modeValue = (CFNumberRef) CFDictionaryGetValue(modesDict, kCGDisplayHeight);
|
||||
CFNumberGetValue(modeValue, kCFNumberLongType, &modeHeight);
|
||||
CFNumberGetValue(modeValue, kCFNumberLongType, &modeHeight);
|
||||
modeValue = (CFNumberRef) CFDictionaryGetValue(modesDict, kCGDisplayBitsPerPixel);
|
||||
CFNumberGetValue(modeValue, kCFNumberLongType, &modeBpp);
|
||||
|
||||
if (px != modeWidth && py != modeHeight)
|
||||
{
|
||||
CFNumberGetValue(modeValue, kCFNumberLongType, &modeBpp);
|
||||
|
||||
if (px != modeWidth && py != modeHeight) {
|
||||
char temp[32];
|
||||
sprintf(temp,"%dx%d", modeWidth, modeHeight);
|
||||
m_ConfigFrame->AddFSReso(temp);
|
||||
|
@ -291,27 +275,34 @@ if (allowConfigShow) // Prevent user to show more than 1 config window at same t
|
|||
py = modeHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void DllConfig(HWND _hParent)
|
||||
{
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
// Prevent user to show more than 1 config window at same time
|
||||
if (allowConfigShow) {
|
||||
m_ConfigFrame = new GFXConfigDialogOGL(GetParentedWxWindow(_hParent));
|
||||
|
||||
#if defined(_WIN32)
|
||||
Win32AddResolutions();
|
||||
#elif defined(HAVE_X11) && HAVE_X11 && defined(HAVE_XXF86VM) && HAVE_XXF86VM
|
||||
X11AddResolutions();
|
||||
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||
CocaAddResolutions();
|
||||
#endif
|
||||
|
||||
// Check if at least one resolution was found. If we don't and the resolution array is empty
|
||||
// CreateGUIControls() will crash because the array is empty.
|
||||
if (m_ConfigFrame->arrayStringFor_FullscreenCB.size() == 0)
|
||||
{
|
||||
if (m_ConfigFrame->arrayStringFor_FullscreenCB.size() == 0) {
|
||||
m_ConfigFrame->AddFSReso("<No resolutions found>");
|
||||
m_ConfigFrame->AddWindowReso("<No resolutions found>");
|
||||
}
|
||||
|
||||
// Only allow one open at a time
|
||||
//if (!m_ConfigFrame->IsShown())
|
||||
//{
|
||||
|
||||
allowConfigShow = false;
|
||||
m_ConfigFrame->CreateGUIControls();
|
||||
allowConfigShow = m_ConfigFrame->ShowModal() == 1 ? true : false;
|
||||
}
|
||||
//}
|
||||
//else
|
||||
// m_ConfigFrame->Hide();
|
||||
|
||||
allowConfigShow = false;
|
||||
m_ConfigFrame->CreateGUIControls();
|
||||
allowConfigShow = m_ConfigFrame->ShowModal() == 1 ? true : false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -319,10 +310,11 @@ void Initialize(void *init)
|
|||
{
|
||||
frameCount = 0;
|
||||
SVideoInitialize *_pVideoInitialize = (SVideoInitialize*)init;
|
||||
g_VideoInitialize = *(_pVideoInitialize); // Create a shortcut to _pVideoInitialize that can also update it
|
||||
// Create a shortcut to _pVideoInitialize that can also update it
|
||||
g_VideoInitialize = *(_pVideoInitialize);
|
||||
InitXFBConvTables();
|
||||
|
||||
g_Config.Load();
|
||||
|
||||
g_Config.GameIniLoad();
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
|
@ -331,8 +323,7 @@ void Initialize(void *init)
|
|||
wxImage::AddHandler( new wxPNGHandler );
|
||||
#endif
|
||||
|
||||
if (!OpenGL_Create(g_VideoInitialize, 640, 480)) // 640x480 will be the default if all else fails
|
||||
{
|
||||
if (!OpenGL_Create(g_VideoInitialize, 640, 480)) {
|
||||
g_VideoInitialize.pLog("Renderer::Create failed\n", TRUE);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,139 +0,0 @@
|
|||
// Copyright (C) 2003 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/
|
||||
|
||||
#include "Globals.h"
|
||||
#include "IniFile.h"
|
||||
#include "svnrev.h"
|
||||
#include "Config.h"
|
||||
#include "Render.h"
|
||||
#include "nGLUtil.h"
|
||||
|
||||
GLWindow *glWin = NULL;
|
||||
|
||||
void OpenGL_SwapBuffers()
|
||||
{
|
||||
glWin->SwapBuffers();
|
||||
}
|
||||
|
||||
void OpenGL_SetWindowText(const char *text)
|
||||
{
|
||||
glWin->SetWindowText(text);
|
||||
}
|
||||
|
||||
unsigned int Callback_PeekMessages()
|
||||
{
|
||||
return glWin->PeekMessages();
|
||||
}
|
||||
|
||||
void UpdateFPSDisplay(const char *text)
|
||||
{
|
||||
char temp[512];
|
||||
sprintf(temp, "SVN R%s: GL: %s", SVN_REV_STR, text);
|
||||
OpenGL_SetWindowText(temp);
|
||||
|
||||
}
|
||||
|
||||
// =======================================================================================
|
||||
// Create window. Called from main.cpp
|
||||
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int width, int height)
|
||||
{
|
||||
g_VideoInitialize.pPeekMessages = &Callback_PeekMessages;
|
||||
g_VideoInitialize.pUpdateFPSDisplay = &UpdateFPSDisplay;
|
||||
|
||||
if (strncasecmp(g_Config.iBackend, "sdl", 10) == 0)
|
||||
glWin = new SDLWindow();
|
||||
else if (strncasecmp(g_Config.iBackend, "x11", 10) == 0)
|
||||
glWin = new X11Window();
|
||||
else if (strncasecmp(g_Config.iBackend, "wxgl", 10) == 0)
|
||||
glWin = new WXGLWindow();
|
||||
else if (strncasecmp(g_Config.iBackend, "windows", 10) == 0)
|
||||
glWin = new Win32Window();
|
||||
else
|
||||
PanicAlert("Invalid backend %s", g_Config.iBackend);
|
||||
|
||||
if (! glWin)
|
||||
return false;
|
||||
|
||||
glWin->SetEventHandler((EventHandler *)globals->eventHandler);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OpenGL_MakeCurrent()
|
||||
{
|
||||
return glWin->MakeCurrent();
|
||||
}
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Update window width, size and etc. Called from Render.cpp and XFB.cpp
|
||||
// ----------------
|
||||
void OpenGL_Update()
|
||||
{
|
||||
glWin->Update();
|
||||
}
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Close plugin
|
||||
// ----------------
|
||||
void OpenGL_Shutdown()
|
||||
{
|
||||
delete glWin;
|
||||
}
|
||||
|
||||
u32 OpenGL_GetWidth() {
|
||||
return glWin->GetXwin();
|
||||
}
|
||||
|
||||
u32 OpenGL_GetHeight() {
|
||||
return glWin->GetYwin();
|
||||
}
|
||||
|
||||
void OpenGL_SetSize(u32 width, u32 height) {
|
||||
glWin->SetWinSize(width, height);
|
||||
}
|
||||
|
||||
int OpenGL_GetXoff() {
|
||||
return glWin->GetXoff();
|
||||
}
|
||||
|
||||
int OpenGL_GetYoff() {
|
||||
return glWin->GetYoff();
|
||||
}
|
||||
|
||||
float OpenGL_GetXmax() {
|
||||
return glWin->GetXmax();
|
||||
}
|
||||
|
||||
float OpenGL_GetYmax() {
|
||||
return glWin->GetYmax();
|
||||
}
|
||||
|
||||
void OpenGL_AddBackends(ConfigDialog *frame) {
|
||||
if(SDLWindow::valid())
|
||||
frame->AddRenderBackend("SDL");
|
||||
if(X11Window::valid())
|
||||
frame->AddRenderBackend("X11");
|
||||
if(WXGLWindow::valid())
|
||||
frame->AddRenderBackend("WXGL");
|
||||
if(Win32Window::valid())
|
||||
frame->AddRenderBackend("Windows"); // Not "Win32" because retarded people will ask where "win64" is...
|
||||
}
|
||||
|
||||
void OpenGL_AddResolutions(ConfigDialog *frame) {
|
||||
// TODO get resolution iter
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
// Copyright (C) 2003 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/
|
||||
|
||||
#ifndef _NGLINIT_H
|
||||
#define _NGLINIT_H
|
||||
|
||||
#include "Config.h"
|
||||
#include "pluginspecs_video.h"
|
||||
#include "GUI/ConfigDlg.h"
|
||||
#include "GLWindow.h"
|
||||
// backends
|
||||
#include "SDLWindow.h"
|
||||
#include "X11Window.h"
|
||||
#include "WXGLWindow.h"
|
||||
#include "Win32Window.h"
|
||||
|
||||
#ifndef GL_DEPTH24_STENCIL8_EXT // allows FBOs to support stencils
|
||||
#define GL_DEPTH_STENCIL_EXT 0x84F9
|
||||
#define GL_UNSIGNED_INT_24_8_EXT 0x84FA
|
||||
#define GL_DEPTH24_STENCIL8_EXT 0x88F0
|
||||
#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1
|
||||
#endif
|
||||
|
||||
#define GL_REPORT_ERROR() { err = glGetError(); if( err != GL_NO_ERROR ) { ERROR_LOG("%s:%d: gl error 0x%x\n", __FILE__, (int)__LINE__, err); HandleGLError(); } }
|
||||
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
#define GL_REPORT_ERRORD() { GLenum err = glGetError(); if( err != GL_NO_ERROR ) { ERROR_LOG("%s:%d: gl error 0x%x\n", __FILE__, (int)__LINE__, err); HandleGLError(); } }
|
||||
#else
|
||||
#define GL_REPORT_ERRORD()
|
||||
#endif
|
||||
|
||||
void OpenGL_AddBackends(ConfigDialog *frame);
|
||||
void OpenGL_AddResolutions(ConfigDialog *frame);
|
||||
|
||||
// TODO old interface removal
|
||||
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _width, int _height);
|
||||
bool OpenGL_MakeCurrent();
|
||||
void OpenGL_SwapBuffers();
|
||||
void OpenGL_SetWindowText(const char *text);
|
||||
void OpenGL_Shutdown();
|
||||
void OpenGL_Update();
|
||||
u32 OpenGL_GetWidth();
|
||||
u32 OpenGL_GetHeight();
|
||||
void OpenGL_SetSize(u32 width, u32 height);
|
||||
int OpenGL_GetXoff();
|
||||
int OpenGL_GetYoff();
|
||||
float OpenGL_GetXmax();
|
||||
float OpenGL_GetYmax();
|
||||
|
||||
#endif
|
|
@ -1,300 +0,0 @@
|
|||
// Copyright (C) 2003 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/
|
||||
|
||||
#include "Globals.h"
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
#include "GUI/ConfigDlg.h"
|
||||
#include "Debugger/Debugger.h" // for the CDebugger class
|
||||
#endif
|
||||
|
||||
#include "Config.h"
|
||||
#include "LookUpTables.h"
|
||||
#include "ImageWrite.h"
|
||||
#include "Render.h"
|
||||
#include "nGLUtil.h"
|
||||
#include "Fifo.h"
|
||||
#include "OpcodeDecoding.h"
|
||||
#include "TextureMngr.h"
|
||||
#include "BPStructs.h"
|
||||
#include "VertexLoader.h"
|
||||
#include "VertexLoaderManager.h"
|
||||
#include "VertexManager.h"
|
||||
#include "PixelShaderCache.h"
|
||||
#include "PixelShaderManager.h"
|
||||
#include "VertexShaderCache.h"
|
||||
#include "VertexShaderManager.h"
|
||||
#include "XFB.h"
|
||||
#include "XFBConvert.h"
|
||||
#include "TextureConverter.h"
|
||||
|
||||
#include "VideoState.h"
|
||||
|
||||
SVideoInitialize g_VideoInitialize;
|
||||
PLUGIN_GLOBALS* globals;
|
||||
|
||||
|
||||
// Nasty stuff which win32 needs for wxw
|
||||
|
||||
#if defined(_WIN32) && defined(HAVE_WX) && HAVE_WX
|
||||
HINSTANCE g_hInstance;
|
||||
|
||||
class wxDLLApp : public wxApp
|
||||
{
|
||||
bool OnInit()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
|
||||
|
||||
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
|
||||
|
||||
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
|
||||
DWORD dwReason, // reason called
|
||||
LPVOID lpvReserved) // reserved
|
||||
{
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{ // Use wxInitialize() if you don't want GUI instead of the following 12 lines
|
||||
wxSetInstance((HINSTANCE)hinstDLL);
|
||||
int argc = 0;
|
||||
char **argv = NULL;
|
||||
wxEntryStart(argc, argv);
|
||||
if ( !wxTheApp || !wxTheApp->CallOnInit() )
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
wxEntryCleanup(); // Use wxUninitialize() if you don't want GUI
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
g_hInstance = hinstDLL;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Create debugging window. There's currently a strange crash that occurs whe a game is loaded
|
||||
if the OpenGL plugin was loaded before. I'll try to fix that. Currently you may have to
|
||||
clsoe the window if it has auto started, and then restart it after the dll has loaded
|
||||
for the purpose of the game. At that point there is no need to use the same dll instance
|
||||
as the one that is rendering the game. However, that could be done. */
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
CDebugger *m_frame;
|
||||
void DllDebugger(HWND _hParent, bool Show)
|
||||
{
|
||||
if(!m_frame && Show)
|
||||
{
|
||||
m_frame = new CDebugger(NULL);
|
||||
m_frame->Show();
|
||||
}
|
||||
else if (m_frame && !Show)
|
||||
{
|
||||
if(m_frame->Close())
|
||||
m_frame = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void DoDllDebugger(){}
|
||||
#else
|
||||
void DllDebugger(HWND _hParent, bool Show) { }
|
||||
void DoDllDebugger() { }
|
||||
#endif
|
||||
|
||||
|
||||
void GetDllInfo (PLUGIN_INFO* _PluginInfo)
|
||||
{
|
||||
_PluginInfo->Version = 0x0100;
|
||||
_PluginInfo->Type = PLUGIN_TYPE_VIDEO;
|
||||
#ifdef DEBUGFAST
|
||||
sprintf(_PluginInfo->Name, "Dolphin OpenGL (DebugFast)");
|
||||
#elif defined _DEBUG
|
||||
sprintf(_PluginInfo->Name, "Dolphin OpenGL (Debug)");
|
||||
#else
|
||||
sprintf(_PluginInfo->Name, "Dolphin OpenGL");
|
||||
#endif
|
||||
}
|
||||
|
||||
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
|
||||
globals = _pPluginGlobals;
|
||||
}
|
||||
|
||||
void DllConfig(HWND _hParent)
|
||||
{
|
||||
wxWindow * win = new wxWindow();
|
||||
#ifdef _WIN32
|
||||
win->SetHWND((WXHWND)_hParent);
|
||||
win->AdoptAttributesFromHWND();
|
||||
#endif
|
||||
//win->Reparent(wxGetApp().GetTopWindow());
|
||||
ConfigDialog *frame = new ConfigDialog(win);
|
||||
OpenGL_AddBackends(frame);
|
||||
OpenGL_AddResolutions(frame);
|
||||
frame->ShowModal();
|
||||
}
|
||||
|
||||
void Initialize(void *init)
|
||||
{
|
||||
frameCount = 0;
|
||||
SVideoInitialize *_pVideoInitialize = (SVideoInitialize*)init;
|
||||
g_VideoInitialize = *(_pVideoInitialize); // Create a shortcut to _pVideoInitialize that can also update it
|
||||
|
||||
InitLUTs();
|
||||
InitXFBConvTables();
|
||||
g_Config.Load();
|
||||
|
||||
if (!OpenGL_Create(g_VideoInitialize, 640, 480)) { //640x480 will be the default if all else fails//
|
||||
g_VideoInitialize.pLog("Renderer::Create failed\n", TRUE);
|
||||
return;
|
||||
}
|
||||
_pVideoInitialize->pPeekMessages = g_VideoInitialize.pPeekMessages;
|
||||
_pVideoInitialize->pUpdateFPSDisplay = g_VideoInitialize.pUpdateFPSDisplay;
|
||||
_pVideoInitialize->pWindowHandle = g_VideoInitialize.pWindowHandle;
|
||||
|
||||
Renderer::AddMessage("Dolphin OpenGL Video Plugin" ,5000);
|
||||
}
|
||||
|
||||
void DoState(unsigned char **ptr, int mode) {
|
||||
#ifndef _WIN32
|
||||
OpenGL_MakeCurrent();
|
||||
#endif
|
||||
// Clear all caches that touch RAM
|
||||
TextureMngr::Invalidate();
|
||||
// DisplayListManager::Invalidate();
|
||||
|
||||
VertexLoaderManager::MarkAllDirty();
|
||||
|
||||
PointerWrap p(ptr, mode);
|
||||
VideoCommon_DoState(p);
|
||||
|
||||
// Refresh state.
|
||||
if (mode == PointerWrap::MODE_READ)
|
||||
BPReload();
|
||||
}
|
||||
|
||||
// This is called after Video_Initialize() from the Core
|
||||
void Video_Prepare(void)
|
||||
{
|
||||
OpenGL_MakeCurrent();
|
||||
if (!Renderer::Init()) {
|
||||
g_VideoInitialize.pLog("Renderer::Create failed\n", TRUE);
|
||||
PanicAlert("Can't create opengl renderer. You might be missing some required opengl extensions, check the logs for more info");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
TextureMngr::Init();
|
||||
|
||||
BPInit();
|
||||
VertexManager::Init();
|
||||
Fifo_Init(); // must be done before OpcodeDecoder_Init()
|
||||
OpcodeDecoder_Init();
|
||||
VertexShaderCache::Init();
|
||||
VertexShaderManager::Init();
|
||||
PixelShaderCache::Init();
|
||||
PixelShaderManager::Init();
|
||||
GL_REPORT_ERRORD();
|
||||
VertexLoaderManager::Init();
|
||||
TextureConverter::Init();
|
||||
}
|
||||
|
||||
void Shutdown(void)
|
||||
{
|
||||
TextureConverter::Shutdown();
|
||||
VertexLoaderManager::Shutdown();
|
||||
VertexShaderCache::Shutdown();
|
||||
VertexShaderManager::Shutdown();
|
||||
PixelShaderManager::Shutdown();
|
||||
PixelShaderCache::Shutdown();
|
||||
Fifo_Shutdown();
|
||||
VertexManager::Shutdown();
|
||||
TextureMngr::Shutdown();
|
||||
OpcodeDecoder_Shutdown();
|
||||
Renderer::Shutdown();
|
||||
OpenGL_Shutdown();
|
||||
}
|
||||
|
||||
void Video_Stop(void)
|
||||
{
|
||||
Fifo_Stop();
|
||||
}
|
||||
|
||||
void Video_EnterLoop()
|
||||
{
|
||||
Fifo_EnterLoop(g_VideoInitialize);
|
||||
}
|
||||
|
||||
bool ScreenShot(TCHAR *File)
|
||||
{
|
||||
char str[64];
|
||||
int left = 200, top = 15;
|
||||
sprintf(str, "Dolphin OpenGL");
|
||||
|
||||
Renderer::ResetGLState();
|
||||
Renderer::RenderText(str, left+1, top+1, 0xff000000);
|
||||
Renderer::RenderText(str, left, top, 0xffc0ffff);
|
||||
Renderer::RestoreGLState();
|
||||
|
||||
if (Renderer::SaveRenderTarget(File, 0)) {
|
||||
char msg[255];
|
||||
sprintf(msg, "saved %s\n", File);
|
||||
Renderer::AddMessage(msg, 500);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned int Video_Screenshot(TCHAR* _szFilename)
|
||||
{
|
||||
if (ScreenShot(_szFilename))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void Video_AddMessage(const char* pstr, u32 milliseconds)
|
||||
{
|
||||
Renderer::AddMessage(pstr,milliseconds);
|
||||
}
|
||||
|
||||
void Video_UpdateXFB(u8* _pXFB, u32 _dwWidth, u32 _dwHeight, s32 _dwYOffset, bool scheduling)
|
||||
{
|
||||
if(g_Config.bUseXFB && XFB_isInit())
|
||||
{
|
||||
if (scheduling) // from CPU in DC without fifo&CP (some 2D homebrews)
|
||||
{
|
||||
XFB_SetUpdateArgs(_pXFB, _dwWidth, _dwHeight, _dwYOffset);
|
||||
g_XFBUpdateRequested = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_pXFB) // from CPU in SC mode
|
||||
XFB_Draw(_pXFB, _dwWidth, _dwHeight, _dwYOffset);
|
||||
else // from GP in DC without fifo&CP (some 2D homebrews)
|
||||
{
|
||||
XFB_Draw();
|
||||
g_XFBUpdateRequested = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue