1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00

Add GLideNUI-wtl

This commit is contained in:
zilmar 2020-03-23 17:54:53 +10:30 committed by Sergey Lipskiy
parent 3726fe4d7e
commit f2e32892a3
89 changed files with 63825 additions and 65 deletions

View File

@ -15,78 +15,134 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osal", "osal.vcxproj", "{7B
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GLideNUI", "GLideNUI.vcxproj", "{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GLideNUI-wtl", "GLideNUI-wtl.vcxproj", "{9E05B70F-A294-44A9-A151-B2CC95AA884E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug_mupenplus|Win32 = Debug_mupenplus|Win32
Debug_mupenplus|x64 = Debug_mupenplus|x64
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Debug_qt|Win32 = Debug_qt|Win32
Debug_qt|x64 = Debug_qt|x64
Debug_wtl|Win32 = Debug_wtl|Win32
Debug_wtl|x64 = Debug_wtl|x64
Release_mupenplus|Win32 = Release_mupenplus|Win32
Release_mupenplus|x64 = Release_mupenplus|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
Release_qt|Win32 = Release_qt|Win32
Release_qt|x64 = Release_qt|x64
Release_wtl|Win32 = Release_wtl|Win32
Release_wtl|x64 = Release_wtl|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_mupenplus|Win32.ActiveCfg = Debug_mupenplus|Win32
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_mupenplus|Win32.Build.0 = Debug_mupenplus|Win32
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_mupenplus|x64.ActiveCfg = Debug_mupenplus|x64
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_mupenplus|x64.Build.0 = Debug_mupenplus|x64
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug|Win32.ActiveCfg = Debug|Win32
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug|Win32.Build.0 = Debug|Win32
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug|x64.ActiveCfg = Debug|x64
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug|x64.Build.0 = Debug|x64
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_qt|Win32.ActiveCfg = Debug_qt|Win32
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_qt|Win32.Build.0 = Debug_qt|Win32
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_qt|x64.ActiveCfg = Debug_qt|x64
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_qt|x64.Build.0 = Debug_qt|x64
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_wtl|Win32.ActiveCfg = Debug_wtl|Win32
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_wtl|Win32.Build.0 = Debug_wtl|Win32
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_wtl|x64.ActiveCfg = Debug_mupenplus|x64
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Debug_wtl|x64.Build.0 = Debug_mupenplus|x64
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_mupenplus|Win32.ActiveCfg = Release_mupenplus|Win32
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_mupenplus|Win32.Build.0 = Release_mupenplus|Win32
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_mupenplus|x64.ActiveCfg = Release_mupenplus|x64
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_mupenplus|x64.Build.0 = Release_mupenplus|x64
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release|Win32.ActiveCfg = Release|Win32
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release|Win32.Build.0 = Release|Win32
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release|x64.ActiveCfg = Release|x64
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release|x64.Build.0 = Release|x64
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_qt|Win32.ActiveCfg = Release_qt|Win32
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_qt|Win32.Build.0 = Release_qt|Win32
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_qt|x64.ActiveCfg = Release_qt|x64
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_qt|x64.Build.0 = Release_qt|x64
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_wtl|Win32.ActiveCfg = Release_wtl|Win32
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_wtl|Win32.Build.0 = Release_wtl|Win32
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_wtl|x64.ActiveCfg = Release_mupenplus|x64
{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}.Release_wtl|x64.Build.0 = Release_mupenplus|x64
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_mupenplus|Win32.ActiveCfg = Debug|Win32
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_mupenplus|Win32.Build.0 = Debug|Win32
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_mupenplus|x64.ActiveCfg = Debug|x64
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_mupenplus|x64.Build.0 = Debug|x64
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug|Win32.ActiveCfg = Debug|Win32
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug|Win32.Build.0 = Debug|Win32
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug|x64.ActiveCfg = Debug|x64
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug|x64.Build.0 = Debug|x64
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_qt|Win32.ActiveCfg = Debug|Win32
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_qt|Win32.Build.0 = Debug|Win32
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_qt|x64.ActiveCfg = Debug|x64
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_qt|x64.Build.0 = Debug|x64
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_wtl|Win32.ActiveCfg = Debug|Win32
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_wtl|Win32.Build.0 = Debug|Win32
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_wtl|x64.ActiveCfg = Debug|x64
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Debug_wtl|x64.Build.0 = Debug|x64
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_mupenplus|Win32.ActiveCfg = Release|Win32
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_mupenplus|Win32.Build.0 = Release|Win32
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_mupenplus|x64.ActiveCfg = Release|x64
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_mupenplus|x64.Build.0 = Release|x64
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release|Win32.ActiveCfg = Release|Win32
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release|Win32.Build.0 = Release|Win32
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release|x64.ActiveCfg = Release|x64
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release|x64.Build.0 = Release|x64
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_qt|Win32.ActiveCfg = Release|Win32
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_qt|Win32.Build.0 = Release|Win32
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_qt|x64.ActiveCfg = Release|x64
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_qt|x64.Build.0 = Release|x64
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_wtl|Win32.ActiveCfg = Release|Win32
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_wtl|Win32.Build.0 = Release|Win32
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_wtl|x64.ActiveCfg = Release|x64
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756}.Release_wtl|x64.Build.0 = Release|x64
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_mupenplus|Win32.ActiveCfg = Debug|Win32
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_mupenplus|Win32.Build.0 = Debug|Win32
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_mupenplus|x64.ActiveCfg = Debug|x64
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_mupenplus|x64.Build.0 = Debug|x64
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug|Win32.ActiveCfg = Debug|Win32
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug|Win32.Build.0 = Debug|Win32
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug|x64.ActiveCfg = Debug|x64
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug|x64.Build.0 = Debug|x64
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_qt|Win32.ActiveCfg = Debug|Win32
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_qt|Win32.Build.0 = Debug|Win32
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_qt|x64.ActiveCfg = Debug|x64
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_qt|x64.Build.0 = Debug|x64
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_wtl|Win32.ActiveCfg = Debug|Win32
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_wtl|Win32.Build.0 = Debug|Win32
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_wtl|x64.ActiveCfg = Debug|x64
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Debug_wtl|x64.Build.0 = Debug|x64
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_mupenplus|Win32.ActiveCfg = Release|Win32
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_mupenplus|Win32.Build.0 = Release|Win32
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_mupenplus|x64.ActiveCfg = Release|x64
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_mupenplus|x64.Build.0 = Release|x64
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release|Win32.ActiveCfg = Release|Win32
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release|Win32.Build.0 = Release|Win32
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release|x64.ActiveCfg = Release|x64
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release|x64.Build.0 = Release|x64
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_qt|Win32.ActiveCfg = Release|Win32
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_qt|Win32.Build.0 = Release|Win32
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_qt|x64.ActiveCfg = Release|x64
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_qt|x64.Build.0 = Release|x64
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_wtl|Win32.ActiveCfg = Release|Win32
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_wtl|Win32.Build.0 = Release|Win32
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_wtl|x64.ActiveCfg = Release|x64
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release_wtl|x64.Build.0 = Release|x64
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug_mupenplus|Win32.ActiveCfg = Debug|Win32
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug_mupenplus|x64.ActiveCfg = Debug|x64
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug|Win32.ActiveCfg = Debug|Win32
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug|Win32.Build.0 = Debug|Win32
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug|x64.ActiveCfg = Debug|x64
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug|x64.Build.0 = Debug|x64
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug_qt|Win32.ActiveCfg = Debug|Win32
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug_qt|Win32.Build.0 = Debug|Win32
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug_qt|x64.ActiveCfg = Debug|x64
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug_qt|x64.Build.0 = Debug|x64
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug_wtl|Win32.ActiveCfg = Debug|Win32
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug_wtl|x64.ActiveCfg = Debug|x64
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Debug_wtl|x64.Build.0 = Debug|x64
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release_mupenplus|Win32.ActiveCfg = Release|Win32
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release_mupenplus|x64.ActiveCfg = Release|x64
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release|Win32.ActiveCfg = Release|Win32
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release|Win32.Build.0 = Release|Win32
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release|x64.ActiveCfg = Release|x64
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release|x64.Build.0 = Release|x64
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release_qt|Win32.ActiveCfg = Release|Win32
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release_qt|Win32.Build.0 = Release|Win32
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release_qt|x64.ActiveCfg = Release|x64
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release_qt|x64.Build.0 = Release|x64
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release_wtl|Win32.ActiveCfg = Release|Win32
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release_wtl|x64.ActiveCfg = Release|x64
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}.Release_wtl|x64.Build.0 = Release|x64
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Debug_mupenplus|Win32.ActiveCfg = Debug|Win32
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Debug_mupenplus|x64.ActiveCfg = Debug|x64
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Debug_mupenplus|x64.Build.0 = Debug|x64
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Debug_qt|Win32.ActiveCfg = Debug|Win32
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Debug_qt|x64.ActiveCfg = Debug|x64
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Debug_qt|x64.Build.0 = Debug|x64
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Debug_wtl|Win32.ActiveCfg = Debug|Win32
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Debug_wtl|Win32.Build.0 = Debug|Win32
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Debug_wtl|x64.ActiveCfg = Debug|x64
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Debug_wtl|x64.Build.0 = Debug|x64
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_mupenplus|Win32.ActiveCfg = Release|Win32
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_mupenplus|x64.ActiveCfg = Release|x64
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_mupenplus|x64.Build.0 = Release|x64
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_qt|Win32.ActiveCfg = Release|Win32
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_qt|x64.ActiveCfg = Release|x64
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_qt|x64.Build.0 = Release|x64
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_wtl|Win32.ActiveCfg = Release|Win32
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_wtl|Win32.Build.0 = Release|Win32
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_wtl|x64.ActiveCfg = Release|x64
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_wtl|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -9,12 +9,20 @@
<Configuration>Debug_mupenplus</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<ProjectConfiguration Include="Debug_qt|Win32">
<Configuration>Debug_qt</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<ProjectConfiguration Include="Debug_qt|x64">
<Configuration>Debug_qt</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug_wtl|Win32">
<Configuration>Debug_wtl</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug_wtl|x64">
<Configuration>Debug_wtl</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release_mupenplus|Win32">
@ -25,12 +33,20 @@
<Configuration>Release_mupenplus</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<ProjectConfiguration Include="Release_qt|Win32">
<Configuration>Release_qt</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<ProjectConfiguration Include="Release_qt|x64">
<Configuration>Release_qt</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release_wtl|Win32">
<Configuration>Release_wtl</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release_wtl|x64">
<Configuration>Release_wtl</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
@ -60,10 +76,10 @@
<OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Debug_mupenplus'">
<PropertyGroup Condition="'$(Configuration)'=='Debug_qt' Or '$(Configuration)'=='Debug_wtl' Or'$(Configuration)'=='Debug_mupenplus'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release' Or '$(Configuration)'=='Release_mupenplus'">
<PropertyGroup Condition="'$(Configuration)'=='Release_qt' Or '$(Configuration)'=='Release_wtl' Or '$(Configuration)'=='Release_mupenplus'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug_mupenplus' Or '$(Configuration)'=='Release_mupenplus'">
@ -90,7 +106,7 @@
<Command>call ..\..\src\getRevision.bat</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Debug_mupenplus'">
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug_qt' Or '$(Configuration)'=='Debug_wtl' Or '$(Configuration)'=='Debug_mupenplus'">
<ClCompile>
<PreprocessorDefinitions>GL_DEBUG;DEBUG_DUMP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Optimization>Disabled</Optimization>
@ -103,7 +119,7 @@
<AdditionalDependencies>freetype253MT_D.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release' Or '$(Configuration)'=='Release_mupenplus'">
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release_qt' Or '$(Configuration)'=='Release_wtl' Or '$(Configuration)'=='Release_mupenplus'">
<ClCompile>
<Optimization>Full</Optimization>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
@ -142,29 +158,34 @@
<AdditionalDependencies>legacy_stdio_definitions.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="('$(Configuration)'=='Debug' Or '$(Configuration)'=='Debug_mupenplus') And '$(Platform)'=='Win32'">
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug_wtl' Or '$(Configuration)'=='Release_wtl'">
<ClCompile>
<PreprocessorDefinitions>WTL_UI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="('$(Configuration)'=='Debug_qt' Or '$(Configuration)'=='Debug_wtl' Or '$(Configuration)'=='Debug_mupenplus') And '$(Platform)'=='Win32'">
<Link>
<AdditionalLibraryDirectories Condition="'$(MSBuildAssemblyVersion)'=='12.0'">lib/msvc12/dbg</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories Condition="'$(MSBuildAssemblyVersion)'!='12.0'">lib/dbg</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="('$(Configuration)'=='Debug' Or '$(Configuration)'=='Debug_mupenplus') And '$(Platform)'=='x64'">
<ItemDefinitionGroup Condition="('$(Configuration)'=='Debug_qt' Or '$(Configuration)'=='Debug_wtl' Or '$(Configuration)'=='Debug_mupenplus') And '$(Platform)'=='x64'">
<Link>
<AdditionalLibraryDirectories>lib/x64/dbg</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="('$(Configuration)'=='Release' Or '$(Configuration)'=='Release_mupenplus') And '$(Platform)'=='Win32'">
<ItemDefinitionGroup Condition="('$(Configuration)'=='Release_qt' Or '$(Configuration)'=='Release_wtl' Or '$(Configuration)'=='Release_mupenplus') And '$(Platform)'=='Win32'">
<Link>
<AdditionalLibraryDirectories Condition="'$(MSBuildAssemblyVersion)'=='12.0'">lib/msvc12/rel</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories Condition="'$(MSBuildAssemblyVersion)'!='12.0'">lib/rel</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="('$(Configuration)'=='Release' Or '$(Configuration)'=='Release_mupenplus') And '$(Platform)'=='x64'">
<ItemDefinitionGroup Condition="('$(Configuration)'=='Release_qt' Or '$(Configuration)'=='Release_wtl' Or '$(Configuration)'=='Release_mupenplus') And '$(Platform)'=='x64'">
<Link>
<AdditionalLibraryDirectories>lib/x64/rel</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'">
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug_qt' Or '$(Configuration)'=='Debug_wtl' Or '$(Configuration)'=='Release_qt' Or '$(Configuration)'=='Release_wtl'">
<ClCompile>
<PreprocessorDefinitions>GL_USE_UNIFORMBLOCK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
@ -191,18 +212,28 @@ copy /Y "$(OutDir)$(TargetName).*" "$(Mupen64PluginsDir)")</Command>
copy /Y "$(OutDir)$(TargetName).*" "$(Mupen64PluginsDir_x64)")</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug_qt'">
<Link>
<AdditionalDependencies>bin\$(Platform)\Debug\lib\GLideNUI.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug_wtl'">
<Link>
<AdditionalDependencies>bin\$(Platform)\Debug\lib\GLideNUI-wtl.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release_qt'">
<Link>
<AdditionalDependencies>bin\$(Platform)\Release\lib\GLideNUI.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>/LTCG %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Debug_mupenplus' Or '$(Configuration)'=='Release' Or '$(Configuration)'=='Release_mupenplus'">
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release_wtl'">
<Link>
<AdditionalDependencies>bin\$(Platform)\Release\lib\GLideNUI-wtl.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug_qt' Or '$(Configuration)'=='Debug_wtl' Or '$(Configuration)'=='Debug_mupenplus' Or '$(Configuration)'=='Release_qt' Or '$(Configuration)'=='Release_wtl' Or '$(Configuration)'=='Release_mupenplus'">
<ClCompile>
<AdditionalIncludeDirectories>../../src/inc/freetype/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
@ -246,7 +277,7 @@ copy /Y "$(OutDir)$(TargetName).*" "$(Mupen64PluginsDir_x64)")</Command>
<ClCompile Include="..\..\src\Graphics\OpenGLContext\GLSL\glsl_SpecialShadersFactory.cpp" />
<ClCompile Include="..\..\src\Graphics\OpenGLContext\GLSL\glsl_Utils.cpp" />
<ClCompile Include="..\..\src\Graphics\OpenGLContext\mupen64plus\mupen64plus_DisplayWindow.cpp">
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug_qt' Or '$(Configuration)'=='Debug_wtl' Or '$(Configuration)'=='Release_qt' Or '$(Configuration)'=='Release_wtl'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\Graphics\OpenGLContext\opengl_Attributes.cpp" />
<ClCompile Include="..\..\src\Graphics\OpenGLContext\opengl_BufferManipulationObjectFactory.cpp" />
@ -279,19 +310,19 @@ copy /Y "$(OutDir)$(TargetName).*" "$(Mupen64PluginsDir_x64)")</Command>
<ClCompile Include="..\..\src\Keys.cpp" />
<ClCompile Include="..\..\src\Log.cpp" />
<ClCompile Include="..\..\src\MupenPlusPluginAPI.cpp">
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug_qt' Or '$(Configuration)'=='Debug_wtl' Or '$(Configuration)'=='Release_qt' Or '$(Configuration)'=='Release_wtl'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\mupenplus\CommonAPIImpl_mupenplus.cpp">
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug_qt' Or '$(Configuration)'=='Debug_wtl' Or '$(Configuration)'=='Release_qt' Or '$(Configuration)'=='Release_wtl'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\mupenplus\Config_mupenplus.cpp">
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug_qt' Or '$(Configuration)'=='Debug_wtl' Or '$(Configuration)'=='Release_qt' Or '$(Configuration)'=='Release_wtl'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\mupenplus\MemoryStatus_mupenplus.cpp">
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug_qt' Or '$(Configuration)'=='Debug_wtl' Or '$(Configuration)'=='Release_qt' Or '$(Configuration)'=='Release_wtl'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\mupenplus\MupenPlusAPIImpl.cpp">
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug_qt' Or '$(Configuration)'=='Debug_wtl' Or '$(Configuration)'=='Release_qt' Or '$(Configuration)'=='Release_wtl'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\N64.cpp" />
<ClCompile Include="..\..\src\NoiseTexture.cpp" />
@ -434,7 +465,7 @@ copy /Y "$(OutDir)$(TargetName).*" "$(Mupen64PluginsDir_x64)")</Command>
<ClInclude Include="..\..\src\Log.h" />
<ClInclude Include="..\..\src\MemoryStatus.h" />
<ClInclude Include="..\..\src\mupenplus\GLideN64_mupenplus.h">
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug_qt' Or '$(Configuration)'=='Debug_wtl' Or '$(Configuration)'=='Release_qt' Or '$(Configuration)'=='Release_wtl'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\..\src\N64.h" />
<ClInclude Include="..\..\src\NoiseTexture.h" />
@ -486,6 +517,16 @@ copy /Y "$(OutDir)$(TargetName).*" "$(Mupen64PluginsDir_x64)")</Command>
</ClInclude>
<ClInclude Include="..\..\src\ZlutTexture.h" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'=='Debug_qt' Or '$(Configuration)'=='Release_qt'">
<ProjectReference Include="GLideNUI.vcxproj" >
<Project>{37cab375-a7a6-3cab-bd56-0e954d3fd2fe}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'=='Debug_wtl' Or '$(Configuration)'=='Release_wtl'">
<ProjectReference Include="GLideNUI-wtl.vcxproj">
<Project>{9e05b70f-a294-44a9-a151-b2cc95aa884e}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="libGLideNHQ.vcxproj">
<Project>{da965bcf-2219-47af-ace7-eaf76d5d4756}</Project>

View File

@ -0,0 +1,182 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{9E05B70F-A294-44A9-A151-B2CC95AA884E}</ProjectGuid>
<RootNamespace>GLideNUIwtl</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<PlatformToolSet>$(DefaultPlatformToolset)</PlatformToolSet>
<ATLMinimizesCRunTimeLibraryUsage>false</ATLMinimizesCRunTimeLibraryUsage>
<CharacterSet>NotSet</CharacterSet>
<ConfigurationType>StaticLibrary</ConfigurationType>
<PrimaryOutput>GLideNUI-wtl</PrimaryOutput>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\lib\</OutDir>
<IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
<TargetName>$(ProjectName)</TargetName>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>_WINDOWS;UNICODE;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>-Zm200 -w34100 -w34189 %(AdditionalOptions)</AdditionalOptions>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<BrowseInformation>false</BrowseInformation>
<ExceptionHandling>Sync</ExceptionHandling>
<ObjectFileName>$(IntDir)</ObjectFileName>
<PreprocessorDefinitions>OS_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessToFile>false</PreprocessToFile>
<ProgramDataBaseFileName>$(IntDir)vc$(VisualStudioVersion).pdb</ProgramDataBaseFileName>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<WarningLevel>Level3</WarningLevel>
<OutputFile>$(OutDir)\GLideNUI-wtl.lib</OutputFile>
</ClCompile>
<Lib>
<AdditionalDependencies>imm32.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<PreprocessorDefinitions>DEBUG_DUMP;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<DebugInformationFormat>None</DebugInformationFormat>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<WholeProgramOptimization>false</WholeProgramOptimization>
</ClCompile>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\src\GLideNUI-wtl\About.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\config-debug.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\config-emulation.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\config-framebuffer.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\config-osd.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\config-overscan.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\config-tab.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\config-texture.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\config-video.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\ConfigDlg.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\FileClass.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\FontInfo.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\fullscreenresolutions_windows.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\GLideNUI.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\GlSettings.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\IniFileClass.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\ScreenShot.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\Settings.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\util.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\wtl-BitmapPicture.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\wtl-ColorButton.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\wtl-OsdButton.cpp" />
<ClCompile Include="..\..\src\GLideNUI-wtl\wtl-OsdPreview.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\GLideNUI-wtl\About.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\config-debug.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\config-emulation.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\config-framebuffer.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\config-osd.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\config-overscan.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\config-tab.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\config-texture.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\config-video.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\ConfigDlg.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\FileClass.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\FontInfo.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\FullscreenResolutions.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\GLideNUI.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\GlSettings.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\IniFileClass.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\resource.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\Settings.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\util.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\wtl-BitmapPicture.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\wtl-ColorButton.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\wtl-OsdButton.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\wtl-OsdPreview.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\wtl-WindowFont.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\wtl.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlapp.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlcrack.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlctrls.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlctrlw.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlctrlx.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlddx.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atldlgs.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atldwm.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlfind.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlframe.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlgdi.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlmisc.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlprint.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlres.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlresce.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlribbon.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlscrl.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlsplit.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atltheme.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atluser.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlwince.h" />
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlwinx.h" />
</ItemGroup>
<ItemGroup>
<Image Include="..\..\src\GLideNUI-wtl\BottomLeft.ico" />
<Image Include="..\..\src\GLideNUI-wtl\BottomRight.ico" />
<Image Include="..\..\src\GLideNUI-wtl\Down.ico" />
<Image Include="..\..\src\GLideNUI-wtl\Icon-Original.ico" />
<Image Include="..\..\src\GLideNUI-wtl\Icon.ico" />
<Image Include="..\..\src\GLideNUI-wtl\Info.ico" />
<Image Include="..\..\src\GLideNUI-wtl\Left.ico" />
<Image Include="..\..\src\GLideNUI-wtl\Right.ico" />
<Image Include="..\..\src\GLideNUI-wtl\TopLeft.ico" />
<Image Include="..\..\src\GLideNUI-wtl\TopRight.ico" />
<Image Include="..\..\src\GLideNUI-wtl\Up.ico" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\src\GLideNUI-wtl\GLideNUI.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
<ProjectExtensions>
</ProjectExtensions>
</Project>

View File

@ -0,0 +1,274 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Header Files\WTL">
<UniqueIdentifier>{b0c2b4e8-31f7-46e5-9b96-cfe8b94db5cf}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\GLideNUI-wtl\About.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\config-debug.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\ConfigDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\config-emulation.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\config-framebuffer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\config-osd.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\config-overscan.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\config-tab.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\config-texture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\config-video.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\FileClass.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\FontInfo.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\fullscreenresolutions_windows.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\GLideNUI.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\GlSettings.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\IniFileClass.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\ScreenShot.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\Settings.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\util.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\wtl-BitmapPicture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\wtl-ColorButton.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\wtl-OsdButton.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GLideNUI-wtl\wtl-OsdPreview.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\GLideNUI-wtl\About.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\config-debug.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\ConfigDlg.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\config-emulation.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\config-framebuffer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\config-osd.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\config-overscan.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\config-tab.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\config-texture.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\config-video.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\FileClass.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\FontInfo.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\FullscreenResolutions.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\GLideNUI.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\GlSettings.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\IniFileClass.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\Settings.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\util.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\wtl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\wtl-BitmapPicture.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\wtl-ColorButton.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\wtl-OsdButton.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\wtl-OsdPreview.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\wtl-WindowFont.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlapp.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlcrack.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlctrls.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlctrlw.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlctrlx.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlddx.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atldlgs.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atldwm.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlfind.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlframe.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlgdi.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlmisc.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlprint.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlres.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlresce.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlribbon.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlscrl.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlsplit.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atltheme.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atluser.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlwince.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\GLideNUI-wtl\WTL\atlwinx.h">
<Filter>Header Files\WTL</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="..\..\src\GLideNUI-wtl\BottomLeft.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="..\..\src\GLideNUI-wtl\BottomRight.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="..\..\src\GLideNUI-wtl\Down.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="..\..\src\GLideNUI-wtl\Icon.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="..\..\src\GLideNUI-wtl\Icon-Original.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="..\..\src\GLideNUI-wtl\Info.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="..\..\src\GLideNUI-wtl\Left.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="..\..\src\GLideNUI-wtl\Right.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="..\..\src\GLideNUI-wtl\TopLeft.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="..\..\src\GLideNUI-wtl\TopRight.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="..\..\src\GLideNUI-wtl\Up.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\src\GLideNUI-wtl\GLideNUI.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>

381
src/GLideNUI-wtl/About.cpp Normal file
View File

@ -0,0 +1,381 @@
#include "About.h"
#include "resource.h"
extern HINSTANCE hInstance;
class CAboutContributersTab :
public CAboutTab
{
public:
BEGIN_MSG_MAP(CAboutContributersTab)
MSG_WM_INITDIALOG(OnInitDialog)
MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic)
MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic)
END_MSG_MAP()
CAboutContributersTab() :
CAboutTab(IDD_TAB_CONTRIBUTORS)
{
}
BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/)
{
const TCHAR Contributors[] =
{
L"Logan McNaughton\r\n\r\n"
L"Francisco Zurita\r\n\r\n"
L"gizmo98\r\n\r\n"
L"purplemarshmallow\r\n\r\n"
L"zilmar\r\n\r\n"
L"matthewharvey\r\n\r\n"
L"lioncash\r\n\r\n"
L"Predator82Germany\r\n\r\n"
L"AmbientMalice\r\n\r\n"
L"baptiste0602\r\n\r\n"
L"Gilles Siberlin\r\n\r\n"
L"Daniel Eck\r\n\r\n"
L"Víctor \"IlDucci\"\r\n\r\n"
L"orbea\r\n\r\n"
L"BenjaminSiskoo\r\n\r\n"
L"ptitSeb\r\n\r\n"
L"Kimberly J.Ortega\r\n\r\n"
L"Maxime Morel\r\n\r\n"
L"tony971\r\n\r\n"
L"SigmaVirus\r\n\r\n"
L"Jools Wills\r\n\r\n"
L"Nekokabu\r\n\r\n"
L"nicklauslittle\r\n\r\n"
L"Nebuleon\r\n\r\n"
L"sergiobenrocha2\r\n\r\n"
L"Michał Durak\r\n\r\n"
L"Mushman"
};
GetDlgItem(IDC_CONTRIBUTORS).SetWindowText(Contributors);
return true;
}
LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/)
{
if ((HWND)lParam == GetDlgItem(IDC_CONTRIBUTORS))
{
SetBkMode((HDC)wParam, TRANSPARENT);
return (LRESULT)GetSysColorBrush(COLOR_3DFACE);
}
return (LRESULT)GetStockObject(WHITE_BRUSH);
}
};
class CAboutFundersTab :
public CAboutTab
{
public:
BEGIN_MSG_MAP(CAboutFundersTab)
MSG_WM_INITDIALOG(OnInitDialog)
MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic)
MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic)
END_MSG_MAP()
CAboutFundersTab() :
CAboutTab(IDD_TAB_FUNDERS)
{
}
BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/)
{
const TCHAR Funders1[] =
{
L"zolcos\r\n"
L"Mush Man\r\n"
L"nesplayer4life\r\n"
L"neko9876\r\n"
L"AnthonyHeathcoat\r\n"
L"daman6009\r\n"
L"Paul Lamb\r\n"
L"zilmar\r\n"
};
const TCHAR FundersList[] =
{
L"Ryan Rosser\r\n"
L"Amadeus Sterl\r\n"
L"Narann\r\n"
L"camara_luiz\r\n"
L"weinerschnitzel\r\n"
L"microdev\r\n"
L"Thomas Ginelli\r\n"
L"ace977\r\n"
L"patryk.szalanski\r\n"
L"Detomine\r\n"
L"itasovski\r\n"
L"keithclark1985\r\n"
L"josephrmoore\r\n"
L"fckyourlies\r\n"
L"dougforr\r\n"
L"camdenfurse\r\n"
L"grandslam810\r\n"
L"rictic\r\n"
L"Fred Lambes\r\n"
L"David Vercruyssen\r\n"
L"danielgormly\r\n"
L"lukecool\r\n"
L"rhilsky\r\n"
L"phillipstuerzl\r\n"
L"killjoy1337\r\n"
L"ratop46\r\n"
L"william.a.moore\r\n"
L"RSP16\r\n"
L"kzidek127\r\n"
L"Dan Holberg\r\n"
L"178amm\r\n"
L"peterchrjoergensen\r\n"
L"hill_jm\r\n"
L"petercullenbryan\r\n"
L"Christopher M Rock\r\n"
L"Kenny.R.Mitchell\r\n"
L"Kevin Grasso\r\n"
L"mtgyure\r\n"
L"Anthony Heathcoat\r\n"
L"Liam Burns\r\n"
L"Steven Impson\r\n"
L"Gwyn.Whieldon\r\n"
L"hipnotoad\r\n"
L"shmuklidooha\r\n"
L"bcanard123\r\n"
L"Ben Slater\r\n"
L"Mike Nagy\r\n"
L"littlegreendude55\r\n"
L"Jay Loring\r\n"
L"Damion D\r\n"
L"heranbago\r\n"
L"baptiste.guilbert\r\n"
L"shadowpower69\r\n"
L"j.mcguirk72\r\n"
L"Peter Greenwood\r\n"
L"fla56\r\n"
L"Sergio\r\n"
L"theboy_181\r\n"
L"Jindo Fox\r\n"
L"s1n.pcc\r\n"
L"rafaelvasco\r\n"
L"copileo\r\n"
L"hugues.fabien\r\n"
L"seanmcm157\r\n"
L"David Morris\r\n"
L"Jason Lightner\r\n"
L"olivier_crepin77\r\n"
L"Paul Lamb\r\n"
L"thegump2.0\r\n"
L"Bates\r\n"
L"cdoublejj\r\n"
L"buddybenj\r\n"
L"don.carmical\r\n"
L"kyussgreen\r\n"
L"info1092\r\n"
L"YQ\r\n"
L"Allan Nordhøy\r\n"
L"christian010\r\n"
L"creuseur2patateradio\r\n"
L"chrisbevanlee\r\n"
L"theschklingen\r\n"
L"Thomas Lindstrøm\r\n"
L"Djipi\r\n"
L"Dartus\r\n"
L"Oscar Abraham\r\n"
L"nwstrathdee\r\n"
L"will7046\r\n"
L"Richard42\r\n"
L"V1del\r\n"
L"AnthonyBentley\r\n"
L"buddybenj\r\n"
L"nickshooter251\r\n"
L"sicurella12\r\n"
L"jcspringer\r\n"
L"Gru So\r\n"
L"Vinícius dos Santos Oliveira\r\n"
L"Jimmy Haugh\r\n"
L"Malcolm\r\n"
L"Alex Strange\r\n"
L"Espen Jensen\r\n"
L"m.johnsondelta\r\n"
L"alexzandar.toxic2\r\n"
L"Ben Slater\r\n"
L"WC-Predator\r\n"
L"Mush Man\r\n"
L"Ben Slater\r\n"
L"aznlucidx\r\n"
L"Nathan Dick\r\n"
L"paulanocom\r\n"
L"Ryan Rosser\r\n"
L"nekow42\r\n"
L"mgos1\r\n"
L"ian.macdonald996\r\n"
L"itasovski\r\n"
L"vikingpower1\r\n"
L"DukeX007X\r\n"
L"palaciosgabriel\r\n"
L"Franz-Josef Haider\r\n"
L"e-male\r\n"
L"aweath\r\n"
L"famicom4\r\n"
L"Keith_at_UMR\r\n"
L"sweatypickle\r\n"
L"jeremydmiller"
};
CWindow Funders = GetDlgItem(IDC_FUNDERS);
Funders.SetWindowText(Funders1);
m_SubtitleFont.Apply(m_hWnd, CWindowFont::typeBold | CWindowFont::typeSubheading, IDC_FUNDERS);
GetDlgItem(IDC_FUNDERS_LIST).SetWindowText(FundersList);
return true;
};
LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/)
{
if ((HWND)lParam == GetDlgItem(IDC_FUNDERS_LIST))
{
SetBkMode((HDC)wParam, TRANSPARENT);
return (LRESULT)GetSysColorBrush(COLOR_3DFACE);
}
return (LRESULT)GetStockObject(WHITE_BRUSH);
}
};
class CAboutCreditsTab :
public CAboutTab
{
public:
BEGIN_MSG_MAP(CAboutCreditsTab)
MSG_WM_INITDIALOG(OnInitDialog)
MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic)
MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic)
END_MSG_MAP()
CAboutCreditsTab() :
CAboutTab(IDD_TAB_CREDITS)
{
}
BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/)
{
const UINT Creditors[] =
{
IDC_ORKIN,
IDC_YONGZH,
IDC_HIROSHI,
IDC_ZIGGY
};
for (const UINT &Creditor : Creditors) {
m_SubtitleFont.Apply(m_hWnd, CWindowFont::typeBold | CWindowFont::typeSubheading, Creditor);
}
return true;
};
};
CAboutTab::CAboutTab(uint32_t _IDD) :
IDD(_IDD)
{
}
CAboutTab::~CAboutTab()
{
}
BOOL CAboutTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/)
{
const UINT Authors[] =
{
IDC_SERGEY,
IDC_OLIVIER,
IDC_RYAN
};
for (const UINT &Author : Authors) {
m_SubtitleFont.Apply(m_hWnd, CWindowFont::typeBold | CWindowFont::typeSubheading, Author);
}
return true;
}
LRESULT CAboutTab::OnColorStatic(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
return (LRESULT)GetStockObject(WHITE_BRUSH);
}
CAboutDlg::~CAboutDlg()
{
for (size_t i = 0, n = m_TabWindows.size(); i < n; i++)
{
delete m_TabWindows[i];
}
m_TabWindows.clear();
}
LRESULT CAboutDlg::OnInitDialog(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
HICON hIcon = AtlLoadIconImage(IDI_APPICON, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON));
SetIcon(hIcon, TRUE);
HICON hIconSmall = AtlLoadIconImage(IDI_APPICON, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON));
SetIcon(hIconSmall, FALSE);
m_TitleFont.Apply(m_hWnd, CWindowFont::typeBold | CWindowFont::typeHeading, IDC_ABOUT_TITLE);
m_AboutIcon.SubclassWindow(GetDlgItem(IDC_ABOUT_ICON));
m_AboutIcon.SetIcon(MAKEINTRESOURCE(IDI_APPICON), 48, 48);
m_Tabs.Attach(GetDlgItem(IDC_TABS));
AddTab(L"About", new CAboutTab(IDD_TAB_ABOUT));
AddTab(L"Contributors", new CAboutContributersTab);
AddTab(L"Funders", new CAboutFundersTab);
AddTab(L"Credits", new CAboutCreditsTab);
return 0;
}
CRect CAboutDlg::GetTabRect()
{
CRect TabRect;
m_Tabs.GetWindowRect(&TabRect);
ScreenToClient(&TabRect);
m_Tabs.AdjustRect(FALSE, &TabRect);
return TabRect;
}
void CAboutDlg::AddTab(const wchar_t * caption, CAboutTab * tab)
{
m_Tabs.AddItem(caption);
tab->Create(m_hWnd, 0);
tab->SetWindowPos(m_hWnd, 0, 0, 0, 0, SWP_HIDEWINDOW);
m_TabWindows.push_back(tab);
if (m_TabWindows.size() == 1)
{
ShowTab(0);
}
}
void CAboutDlg::ShowTab(int nPage)
{
for (size_t i = 0; i < m_TabWindows.size(); i++)
{
m_TabWindows[i]->ShowWindow(SW_HIDE);
}
CRect TabRect = GetTabRect();
m_TabWindows[nPage]->SetWindowPos(HWND_TOP, TabRect.left, TabRect.top, TabRect.Width(), TabRect.Height(), SWP_SHOWWINDOW);
CRect WinRect, ClientRect;
m_TabWindows[nPage]->GetWindowRect(WinRect);
m_TabWindows[nPage]->GetClientRect(ClientRect);
m_Tabs.RedrawWindow();
}
LRESULT CAboutDlg::OnTabChange(NMHDR* /*pNMHDR*/)
{
ShowTab(m_Tabs.GetCurSel());
return FALSE;
}
LRESULT CAboutDlg::OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
EndDialog(wID);
return 0;
}
LRESULT CAboutDlg::OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
EndDialog(wID);
return 0;
}

60
src/GLideNUI-wtl/About.h Normal file
View File

@ -0,0 +1,60 @@
#pragma once
#include "wtl.h"
#include "wtl-WindowFont.h"
#include "wtl-BitmapPicture.h"
#include "resource.h"
#include <vector>
class CAboutTab :
public CDialogImpl<CAboutTab>
{
public:
CAboutTab(uint32_t _IDD);
virtual ~CAboutTab();
BEGIN_MSG_MAP(CAboutTab)
MSG_WM_INITDIALOG(OnInitDialog)
MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic)
MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic)
END_MSG_MAP()
uint32_t IDD;
protected:
BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam);
LRESULT OnColorStatic(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
CWindowFont m_SubtitleFont;
};
class CAboutDlg :
public CDialogImpl<CAboutDlg>
{
public:
~CAboutDlg();
enum { IDD = IDD_ABOUT };
BEGIN_MSG_MAP_EX(CAboutDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDOK, OnOK)
COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
NOTIFY_HANDLER_EX(IDC_TABS, TCN_SELCHANGE, OnTabChange)
END_MSG_MAP()
protected:
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnTabChange(NMHDR* pNMHDR);
void AddTab(const wchar_t * caption, CAboutTab *);
void ShowTab(int nPage);
CRect GetTabRect();
CWindowFont m_TitleFont;
CBitmapPicture m_AboutIcon;
CTabCtrl m_Tabs;
std::vector<CAboutTab *> m_TabWindows;
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,193 @@
#pragma once
#include "wtl.h"
#include "ConfigDlg.h"
#include "../Config.h"
#include "Settings.h"
#include "config-video.h"
#include "config-emulation.h"
#include "config-framebuffer.h"
#include "config-texture.h"
#include "config-osd.h"
#include "config-debug.h"
CConfigDlg::CConfigDlg() :
m_blockReInit(false),
m_Saved(false)
{
}
CConfigDlg::~CConfigDlg()
{
for (size_t i = 0; i < m_TabWindows.size(); i++)
{
delete m_TabWindows[i];
}
m_TabWindows.clear();
}
void CConfigDlg::setIniPath(const std::string & IniPath)
{
m_strIniPath = IniPath;
}
void CConfigDlg::setRomName(const char * RomName)
{
m_romName = RomName == NULL || strlen(RomName) == 0 ? NULL : RomName;
}
LRESULT CConfigDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
HICON hIcon = AtlLoadIconImage(IDI_APPICON, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON));
SetIcon(hIcon, TRUE);
HICON hIconSmall = AtlLoadIconImage(IDI_APPICON, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON));
SetIcon(hIconSmall, FALSE);
m_Tabs.Attach(GetDlgItem(IDC_TABS));
AddTab(L"Video", new CVideoTab);
AddTab(L"Emulation", new CEmulationTab);
AddTab(L"Frame buffer", new CFrameBufferTab);
AddTab(L"Texture enhancement", new CTextureEnhancementTab);
AddTab(L"OSD", new COsdTab);
AddTab(L"Debug", new CDebugTab);
Init();
return 0;
}
void CConfigDlg::SaveSettings()
{
m_Saved = true;
for (size_t i = 0; i < m_TabWindows.size(); i++)
{
m_TabWindows[i]->SaveSettings();
}
writeSettings(m_strIniPath.c_str());
}
LRESULT CConfigDlg::OnRestoreDefaults(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
int Res = MessageBox(L"Are you sure you want to reset all settings to default?", L"Restore Defaults?", MB_YESNO | MB_ICONWARNING);
if (Res == IDYES)
{
const u32 enableCustomSettings = config.generalEmulation.enableCustomSettings;
config.resetToDefaults();
config.generalEmulation.enableCustomSettings = enableCustomSettings;
setRomName(m_romName);
Init();
}
return 0;
}
LRESULT CConfigDlg::OnSaveClose(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
SaveSettings();
EndDialog(wID);
return 0;
}
LRESULT CConfigDlg::OnSave(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
SaveSettings();
return 0;
}
LRESULT CConfigDlg::OnTabChange(NMHDR* /*pNMHDR*/)
{
ShowTab(m_Tabs.GetCurSel());
return FALSE;
}
LRESULT CConfigDlg::OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
EndDialog(wID);
return 0;
}
void CConfigDlg::Init(bool reInit, bool blockCustomSettings)
{
if (m_blockReInit)
{
return;
}
m_blockReInit = true;
if (reInit)
{
loadSettings(m_strIniPath.c_str());
}
for (size_t i = 0; i < m_TabWindows.size(); i++)
{
m_TabWindows[i]->LoadSettings(blockCustomSettings);
}
m_blockReInit = false;
}
CRect CConfigDlg::GetTabRect()
{
CRect TabRect;
m_Tabs.GetWindowRect(&TabRect);
ScreenToClient(&TabRect);
m_Tabs.AdjustRect(FALSE, &TabRect);
return TabRect;
}
void CConfigDlg::AddTab(const wchar_t * caption, CConfigTab * tab)
{
m_Tabs.AddItem(caption);
tab->Create(m_hWnd, 0);
tab->SetWindowPos(m_hWnd, 0, 0, 0, 0, SWP_HIDEWINDOW);
m_TabWindows.push_back(tab);
if (m_TabWindows.size() == 1)
{
ShowTab(0);
}
}
void CConfigDlg::ShowTab(int nPage)
{
for (size_t i = 0; i < m_TabWindows.size(); i++)
{
m_TabWindows[i]->ShowWindow(SW_HIDE);
}
CRect TabRect = GetTabRect();
m_TabWindows[nPage]->SetWindowPos(HWND_TOP, TabRect.left, TabRect.top, TabRect.Width(), TabRect.Height(), SWP_SHOWWINDOW);
CRect WinRect, ClientRect;
m_TabWindows[nPage]->GetWindowRect(WinRect);
m_TabWindows[nPage]->GetClientRect(ClientRect);
m_Tabs.RedrawWindow();
}
class GlideN64WtlModule :
public CAppModule
{
public:
GlideN64WtlModule(HINSTANCE hinst)
{
Init(NULL, hinst);
}
virtual ~GlideN64WtlModule(void)
{
Term();
}
};
GlideN64WtlModule * WtlModule = NULL;
void ConfigInit(void * hinst)
{
WtlModule = new GlideN64WtlModule((HINSTANCE)hinst);
}
void ConfigCleanup(void)
{
if (WtlModule)
{
delete WtlModule;
WtlModule = NULL;
}
}

View File

@ -0,0 +1,55 @@
#pragma once
#include <string>
#include "wtl.h"
#include "config-tab.h"
#include "resource.h"
#include <vector>
class CConfigDlg :
public CDialogImpl<CConfigDlg>
{
public:
CConfigDlg();
~CConfigDlg();
enum { IDD = IDD_CONFIG };
BEGIN_MSG_MAP_EX(CConfigDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
NOTIFY_HANDLER_EX(IDC_TABS, TCN_SELCHANGE, OnTabChange)
COMMAND_ID_HANDLER(ID_RESTORE_DEFAULTS, OnRestoreDefaults)
COMMAND_ID_HANDLER(ID_SAVECLOSE, OnSaveClose)
COMMAND_ID_HANDLER(ID_SAVE, OnSave)
COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
END_MSG_MAP()
void setIniPath(const std::string & IniPath);
void setRomName(const char * RomName);
bool Saved(void) const { return m_Saved; }
protected:
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnRestoreDefaults(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnSaveClose(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnSave(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnTabChange(NMHDR* pNMHDR);
void Init(bool reInit = false, bool blockCustomSettings = false);
void AddTab(const wchar_t * caption, CConfigTab * tab);
void ShowTab(int nPage);
CRect GetTabRect();
void SaveSettings();
CTabCtrl m_Tabs;
std::vector<CConfigTab *> m_TabWindows;
std::string m_strIniPath;
const char * m_romName;
bool m_blockReInit;
bool m_Saved;
};
#ifdef _WIN32
void ConfigInit(void * hinst);
void ConfigCleanup(void);
#endif

BIN
src/GLideNUI-wtl/Down.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,350 @@
#include "FileClass.h"
#ifdef _WIN32
#include <io.h>
#define USE_WINDOWS_API
#include <Windows.h>
#else
#include <unistd.h>
#endif
#if defined(_MSC_VER)
#include <crtdbg.h>
#else
#define _ASSERTE(expr) ((void)0)
#endif
CFile::CFile() :
#ifdef USE_WINDOWS_API
m_hFile(INVALID_HANDLE_VALUE),
#else
m_hFile(NULL),
#endif
m_bCloseOnDelete(false)
{
}
CFile::CFile(void * hFile) :
m_hFile(hFile),
m_bCloseOnDelete(true)
{
if (hFile == 0)
{
_ASSERTE(hFile != 0);
}
}
CFile::CFile(const char * lpszFileName, uint32_t nOpenFlags) :
#ifdef USE_WINDOWS_API
m_hFile(INVALID_HANDLE_VALUE),
#else
m_hFile(NULL),
#endif
m_bCloseOnDelete(true)
{
Open(lpszFileName, nOpenFlags);
}
CFile::~CFile()
{
#ifdef USE_WINDOWS_API
if (m_hFile != INVALID_HANDLE_VALUE && m_bCloseOnDelete)
#else
if (m_hFile != NULL && m_bCloseOnDelete)
#endif
{
Close();
}
}
bool CFile::Open(const char * lpszFileName, uint32_t nOpenFlags)
{
if (!Close())
{
return false;
}
if (lpszFileName == NULL || strlen(lpszFileName) == 0)
{
return false;
}
m_bCloseOnDelete = true;
#ifdef USE_WINDOWS_API
m_hFile = INVALID_HANDLE_VALUE;
ULONG dwAccess = 0;
switch (nOpenFlags & 3)
{
case modeRead:
dwAccess = GENERIC_READ;
break;
case modeWrite:
dwAccess = GENERIC_WRITE;
break;
case modeReadWrite:
dwAccess = GENERIC_READ | GENERIC_WRITE;
break;
default:
_ASSERTE(false);
}
// map share mode
ULONG dwShareMode = 0;
dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
if ((nOpenFlags & shareDenyWrite) == shareDenyWrite) { dwShareMode &= ~FILE_SHARE_WRITE; }
if ((nOpenFlags & shareDenyRead) == shareDenyRead) { dwShareMode &= ~FILE_SHARE_READ; }
if ((nOpenFlags & shareExclusive) == shareExclusive) { dwShareMode = 0; }
// map modeNoInherit flag
SECURITY_ATTRIBUTES sa;
sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = (nOpenFlags & modeNoInherit) == 0;
// map creation flags
ULONG dwCreateFlag = OPEN_EXISTING;
if (nOpenFlags & modeCreate)
{
dwCreateFlag = ((nOpenFlags & modeNoTruncate) != 0) ? OPEN_ALWAYS : CREATE_ALWAYS;
}
// attempt file creation
HANDLE hFile = ::CreateFileA(lpszFileName, dwAccess, dwShareMode, &sa, dwCreateFlag, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{ //#define ERROR_PATH_NOT_FOUND 3L
//ULONG err = GetLastError();
return false;
}
m_hFile = hFile;
#else
if ((nOpenFlags & modeNoTruncate) == 0 && (nOpenFlags & CFileBase::modeCreate) == CFileBase::modeCreate)
{
CPath(lpszFileName).Delete();
}
if ((nOpenFlags & CFileBase::modeCreate) != CFileBase::modeCreate)
{
if (!CPath(lpszFileName).Exists())
{
return false;
}
}
if ((nOpenFlags & CFileBase::modeCreate) == CFileBase::modeCreate)
{
CPath file(lpszFileName);
if (!file.Exists())
{
FILE * fp = fopen(lpszFileName,"wb");
if (fp)
{
fclose(fp);
}
if (!file.Exists())
{
return false;
}
}
}
if ((nOpenFlags & CFileBase::modeWrite) == CFileBase::modeWrite ||
(nOpenFlags & CFileBase::modeReadWrite) == CFileBase::modeReadWrite)
{
m_hFile = fopen(lpszFileName, "rb+");
if (m_hFile != NULL)
{
SeekToBegin();
}
}
else if ((nOpenFlags & CFileBase::modeRead) == CFileBase::modeRead)
{
m_hFile = fopen(lpszFileName, "rb");
if (m_hFile != NULL)
{
SeekToBegin();
}
}
else
{
return false;
}
#endif
m_bCloseOnDelete = true;
return true;
}
bool CFile::Close()
{
bool bError = true;
#ifdef USE_WINDOWS_API
if (m_hFile != INVALID_HANDLE_VALUE)
{
bError = !::CloseHandle(m_hFile);
}
m_hFile = INVALID_HANDLE_VALUE;
#else
if (m_hFile != NULL)
{
fclose((FILE *)m_hFile);
m_hFile = NULL;
}
#endif
m_bCloseOnDelete = false;
return bError;
}
uint32_t CFile::SeekToEnd(void)
{
return Seek(0, CFile::end);
}
void CFile::SeekToBegin(void)
{
Seek(0, CFile::begin);
}
bool CFile::IsOpen(void) const
{
#ifdef USE_WINDOWS_API
return m_hFile != INVALID_HANDLE_VALUE;
#else
return m_hFile != NULL;
#endif
}
bool CFile::Flush()
{
#ifdef USE_WINDOWS_API
if (m_hFile == INVALID_HANDLE_VALUE)
{
return true;
}
return ::FlushFileBuffers(m_hFile) != 0;
#else
fflush((FILE *)m_hFile);
fsync(fileno((FILE *)m_hFile));
return true;
#endif
}
bool CFile::Write(const void* lpBuf, uint32_t nCount)
{
if (nCount == 0)
{
return true; // avoid Win32 "null-write" option
}
#ifdef USE_WINDOWS_API
ULONG nWritten = 0;
if (!::WriteFile(m_hFile, lpBuf, nCount, &nWritten, NULL))
{
return false;
}
if (nWritten != nCount)
{
// Win32s will not return an error all the time (usually DISK_FULL)
return false;
}
#else
if (fwrite(lpBuf, 1, nCount, (FILE *)m_hFile) != nCount)
{
return false;
}
#endif
return true;
}
uint32_t CFile::Read(void* lpBuf, uint32_t nCount)
{
if (nCount == 0)
{
return 0; // avoid Win32 "null-read"
}
#ifdef USE_WINDOWS_API
DWORD dwRead = 0;
if (!::ReadFile(m_hFile, lpBuf, nCount, &dwRead, NULL))
{
return 0;
}
return (uint32_t)dwRead;
#else
uint32_t res = fread(lpBuf, sizeof(uint8_t), nCount, (FILE *)m_hFile);
return res;
#endif
}
int32_t CFile::Seek(int32_t lOff, SeekPosition nFrom)
{
#ifdef USE_WINDOWS_API
ULONG dwNew = ::SetFilePointer(m_hFile, lOff, NULL, (ULONG)nFrom);
if (dwNew == (ULONG)-1)
{
return -1;
}
return dwNew;
#else
if (m_hFile == NULL)
{
return -1;
}
int origin;
switch (nFrom)
{
case begin: origin = SEEK_SET; break;
case current: origin = SEEK_CUR; break;
case end: origin = SEEK_END; break;
default:
return -1;
}
Flush();
int res = fseek((FILE *)m_hFile, lOff, origin);
return res;
#endif
}
uint32_t CFile::GetPosition() const
{
#ifdef USE_WINDOWS_API
return ::SetFilePointer(m_hFile, 0, NULL, FILE_CURRENT);
#else
return (uint32_t)ftell((FILE *)m_hFile);
#endif
}
bool CFile::SetLength(uint32_t dwNewLen)
{
Seek((int32_t)dwNewLen, begin);
return SetEndOfFile();
}
uint32_t CFile::GetLength() const
{
#ifdef USE_WINDOWS_API
return GetFileSize(m_hFile, 0);
#else
uint32_t pos = GetPosition();
fseek((FILE *)m_hFile, 0, SEEK_END);
uint32_t FileSize = GetPosition();
fseek((FILE *)m_hFile, (int32_t)pos, SEEK_SET);
return FileSize;
#endif
}
bool CFile::SetEndOfFile()
{
#ifdef USE_WINDOWS_API
return ::SetEndOfFile(m_hFile) != 0;
#else
Flush();
#ifdef _WIN32
return _chsize(_fileno((FILE *)m_hFile),GetPosition()) == 0;
#else
return ftruncate(fileno((FILE *)m_hFile),GetPosition()) == 0;
#endif
#endif
}

View File

@ -0,0 +1,81 @@
#pragma once
#include <stdint.h>
class CFileBase
{
public:
enum OpenFlags
{
modeRead = 0x0000,
modeWrite = 0x0001,
modeReadWrite = 0x0002,
shareCompat = 0x0000,
shareExclusive = 0x0010,
shareDenyWrite = 0x0020,
shareDenyRead = 0x0030,
shareDenyNone = 0x0040,
modeNoInherit = 0x0080,
modeCreate = 0x1000,
modeNoTruncate = 0x2000,
};
enum SeekPosition { begin = 0x0, current = 0x1, end = 0x2 };
virtual bool Open(const char * lpszFileName, uint32_t nOpenFlags ) = 0;
virtual uint32_t GetPosition() const = 0;
virtual int32_t Seek(int32_t lOff, SeekPosition nFrom) = 0;
virtual bool SetLength(uint32_t dwNewLen) = 0;
virtual uint32_t GetLength() const = 0;
virtual uint32_t Read(void* lpBuf, uint32_t nCount) = 0;
virtual bool Write(const void* lpBuf, uint32_t nCount) = 0;
virtual bool Flush() = 0;
virtual bool Close() = 0;
virtual bool IsOpen() const = 0;
virtual bool SetEndOfFile() = 0;
};
class CFile : public CFileBase
{
// Attributes
void * m_hFile;
bool m_bCloseOnDelete;
public:
// Flag values
// Constructors
CFile();
CFile(void * hFile);
CFile(const char * lpszFileName, uint32_t nOpenFlags);
// Deconstructors
virtual ~CFile();
// Operations
virtual bool Open(const char * lpszFileName, uint32_t nOpenFlags );
uint32_t SeekToEnd ( void );
void SeekToBegin ( void );
// Overridables
virtual uint32_t GetPosition() const;
virtual int32_t Seek(int32_t lOff, SeekPosition nFrom);
virtual bool SetLength(uint32_t dwNewLen);
virtual uint32_t GetLength() const;
virtual uint32_t Read(void* lpBuf, uint32_t nCount);
virtual bool Write(const void* lpBuf, uint32_t nCount);
virtual bool Flush();
virtual bool Close();
virtual bool IsOpen() const;
virtual bool SetEndOfFile();
private:
CFile(const CFile&); // Disable copy constructor
CFile& operator=(const CFile&); // Disable assignment
};

View File

@ -0,0 +1,166 @@
#include "FontInfo.h"
#include "FileClass.h"
#include <stdint.h>
#include <memory>
#include <vector>
#include <Windows.h>
#include <Shlobj.h>
#pragma warning(disable:4996)
typedef struct _tagTT_OFFSET_TABLE
{
uint16_t uMajorVersion;
uint16_t uMinorVersion;
uint16_t uNumOfTables;
uint16_t uSearchRange;
uint16_t uEntrySelector;
uint16_t uRangeShift;
} TT_OFFSET_TABLE;
typedef struct _tagTT_TABLE_DIRECTORY
{
char szTag[4]; //table name
uint32_t uCheckSum; //Check sum
uint32_t uOffset; //Offset from beginning of file
uint32_t uLength; //length of the table in bytes
} TT_TABLE_DIRECTORY;
typedef struct _tagTT_NAME_TABLE_HEADER
{
uint16_t uFSelector; //format selector. Always 0
uint16_t uNRCount; //Name Records count
uint16_t uStorageOffset; //Offset for strings storage, from start of the table
} TT_NAME_TABLE_HEADER;
typedef struct _tagTT_NAME_RECORD
{
uint16_t uPlatformID;
uint16_t uEncodingID;
uint16_t uLanguageID;
uint16_t uNameID;
uint16_t uStringLength;
uint16_t uStringOffset; //from start of storage area
} TT_NAME_RECORD;
#define SWAPWORD(x) MAKEWORD(HIBYTE(x), LOBYTE(x))
#define SWAPLONG(x) MAKELONG(SWAPWORD(HIWORD(x)), SWAPWORD(LOWORD(x)))
std::string GetFontNameFromFile(const char * FontFilePath)
{
CFile f;
if (!f.Open(FontFilePath, CFile::modeRead | CFile::shareDenyWrite))
{
return std::string("");
}
TT_OFFSET_TABLE ttOffsetTable;
f.Read(&ttOffsetTable, sizeof(TT_OFFSET_TABLE));
ttOffsetTable.uNumOfTables = SWAPWORD(ttOffsetTable.uNumOfTables);
ttOffsetTable.uMajorVersion = SWAPWORD(ttOffsetTable.uMajorVersion);
ttOffsetTable.uMinorVersion = SWAPWORD(ttOffsetTable.uMinorVersion);
//check is this is a true type font and the version is 1.0
if (ttOffsetTable.uMajorVersion != 1 || ttOffsetTable.uMinorVersion != 0)
{
return std::string("");
}
TT_TABLE_DIRECTORY tblDir;
bool bFound = false;
for (int i = 0; i< ttOffsetTable.uNumOfTables; i++)
{
f.Read(&tblDir, sizeof(TT_TABLE_DIRECTORY));
if (_strnicmp(tblDir.szTag, "name", 4) == 0)
{
bFound = true;
tblDir.uLength = SWAPLONG(tblDir.uLength);
tblDir.uOffset = SWAPLONG(tblDir.uOffset);
break;
}
}
std::string res;
if (bFound)
{
f.Seek(tblDir.uOffset, CFile::begin);
TT_NAME_TABLE_HEADER ttNTHeader;
f.Read(&ttNTHeader, sizeof(TT_NAME_TABLE_HEADER));
ttNTHeader.uNRCount = SWAPWORD(ttNTHeader.uNRCount);
ttNTHeader.uStorageOffset = SWAPWORD(ttNTHeader.uStorageOffset);
TT_NAME_RECORD ttRecord;
bFound = false;
for (int i = 0; i<ttNTHeader.uNRCount; i++)
{
f.Read(&ttRecord, sizeof(TT_NAME_RECORD));
ttRecord.uNameID = SWAPWORD(ttRecord.uNameID);
if (ttRecord.uNameID == 1)
{
ttRecord.uStringLength = SWAPWORD(ttRecord.uStringLength);
ttRecord.uStringOffset = SWAPWORD(ttRecord.uStringOffset);
int nPos = f.GetPosition();
f.Seek(tblDir.uOffset + ttRecord.uStringOffset + ttNTHeader.uStorageOffset, CFile::begin);
std::vector<char> NameBuf;
NameBuf.resize(ttRecord.uStringLength + 1);
memset(NameBuf.data(), 0, ttRecord.uStringLength + 1);
f.Read(NameBuf.data(), ttRecord.uStringLength);
if (NameBuf[0] != '\0')
{
res = NameBuf.data();
break;
}
f.Seek(nPos, CFile::begin);
}
}
}
f.Close();
return res;
}
std::string GetFontFolder()
{
char szFontPath[MAX_PATH];
if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_FONTS, NULL, 0, szFontPath)))
{
return szFontPath;
}
return "";
}
FontList GetFontFiles()
{
std::string FontFolder = GetFontFolder();
FontList fonts;
if (FontFolder.length() > 0)
{
std::string SearchQuery = FontFolder;
SearchQuery += "\\*.ttf";
WIN32_FIND_DATAA FindData;
HANDLE hFind = FindFirstFileA(SearchQuery.c_str(), &FindData);
if (hFind != INVALID_HANDLE_VALUE)
{
do
{
std::string FontFile = FontFolder;
FontFile += "\\";
FontFile += FindData.cFileName;
std::string FontName = GetFontNameFromFile(FontFile.c_str());
if (FontName.length() > 0)
{
fonts.insert(FontList::value_type(FindData.cFileName, FontName));
}
} while (FindNextFileA(hFind, &FindData));
FindClose(hFind);
}
}
if (fonts.size() == 0)
{
fonts.insert(FontList::value_type("arial.ttf", "Arial"));
}
return fonts;
}

View File

@ -0,0 +1,10 @@
#pragma once
#include <string>
#include <map>
typedef std::map<std::string, std::string> FontList;
FontList GetFontFiles();
std::string GetFontFolder();
std::string GetFontNameFromFile(const char * FontFilePath);

View File

@ -0,0 +1,10 @@
#pragma once
#include <vector>
#include <string>
typedef std::vector<std::string> StringList;
void fillFullscreenResolutionsList(StringList & _listResolutions, int & _resolutionIdx, StringList & _listRefreshRates, int & _rateIdx);
void fillFullscreenRefreshRateList(int _resolutionIdx, StringList & _listRefreshRates, int & _rateIdx);
void getFullscreenResolutions(int _idx, unsigned int & _width, unsigned int & _height);
void getFullscreenRefreshRate(int _idx, unsigned int & _rate);

View File

@ -0,0 +1,83 @@
#include "About.h"
#include <thread>
#include "GLideNUI.h"
#include "Settings.h"
#include "../Config.h"
#include "ConfigDlg.h"
#ifdef QT_STATICPLUGIN
#include <QtPlugin>
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
Q_IMPORT_PLUGIN(QICOPlugin)
#endif
//#define RUN_DIALOG_IN_THREAD
static
int openConfigDialog(const wchar_t * _strFileName, const char * _romName, bool & _accepted)
{
std::string IniFolder;
uint32_t slength = WideCharToMultiByte(CP_ACP, 0, _strFileName, -1, NULL, 0, NULL, NULL);
IniFolder.resize(slength);
slength = WideCharToMultiByte(CP_ACP, 0, _strFileName, -1, (LPSTR)IniFolder.c_str(), slength, NULL, NULL);
IniFolder.resize(slength - 1); //Remove null end char
loadSettings(IniFolder.c_str());
if (config.generalEmulation.enableCustomSettings != 0 && _romName != nullptr && strlen(_romName) != 0)
loadCustomRomSettings(IniFolder.c_str(), _romName);
CConfigDlg Dlg;
Dlg.setIniPath(IniFolder.c_str());
Dlg.setRomName(_romName);
Dlg.DoModal();
_accepted = Dlg.Saved();
return 0;
}
bool runConfigThread(const wchar_t * _strFileName, const char * _romName) {
bool accepted = false;
#ifdef RUN_DIALOG_IN_THREAD
std::thread configThread(openConfigDialog, _strFileName, std::ref(accepted));
configThread.join();
#else
openConfigDialog(_strFileName, _romName, accepted);
#endif
return accepted;
}
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName)
{
return runConfigThread(_strFileName, _romName);
}
EXPORT int CALL RunAbout(const wchar_t * /*_strFileName*/)
{
CAboutDlg Dlg;
Dlg.DoModal();
return 0;
}
EXPORT void CALL LoadConfig(const wchar_t * _strFileName)
{
std::string IniFolder;
uint32_t slength = WideCharToMultiByte(CP_ACP, 0, _strFileName, -1, NULL, 0, NULL, NULL);
IniFolder.resize(slength);
slength = WideCharToMultiByte(CP_ACP, 0, _strFileName, -1, (LPSTR)IniFolder.c_str(), slength, NULL, NULL);
IniFolder.resize(slength - 1); //Remove null end char
loadSettings(IniFolder.c_str());
}
EXPORT void CALL LoadCustomRomSettings(const wchar_t * _strFileName, const char * _romName)
{
std::string IniFolder;
uint32_t slength = WideCharToMultiByte(CP_ACP, 0, _strFileName, -1, NULL, 0, NULL, NULL);
IniFolder.resize(slength);
slength = WideCharToMultiByte(CP_ACP, 0, _strFileName, -1, (LPSTR)IniFolder.c_str(), slength, NULL, NULL);
IniFolder.resize(slength - 1); //Remove null end char
loadCustomRomSettings(IniFolder.c_str(), _romName);
}

View File

@ -0,0 +1,26 @@
#ifndef GLIDENUII_H
#define GLIDENUII_H
#if defined(__cplusplus)
extern "C" {
#endif
#ifdef _WIN32
#define EXPORT __declspec(dllexport)
#define CALL __cdecl
#else
#define EXPORT __attribute__((visibility("default")))
#define CALL
#endif
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName);
EXPORT int CALL RunAbout(const wchar_t * _strFileName);
EXPORT void CALL LoadConfig(const wchar_t * _strFileName);
EXPORT void CALL LoadCustomRomSettings(const wchar_t * _strFileName, const char * _romName);
EXPORT void CALL SaveScreenshot(const wchar_t * _folder, const char * _name, int _width, int _height, const unsigned char * _data);
#if defined(__cplusplus)
}
#endif
#endif // GLIDENUII_H

Binary file not shown.

View File

@ -0,0 +1,260 @@
#include "GlSettings.h"
GlColor::GlColor(uint8_t Red, uint8_t Green, uint8_t Blue, uint8_t Alpha) :
m_Red(Red),
m_Green(Green),
m_Blue(Blue),
m_Alpha(Alpha)
{
}
GlSettings::GlSettings(const char * IniFile) :
m_IniFile(IniFile)
{
m_CurrentSection = "General";
}
GlSettingValue GlSettings::value(const char * Key)
{
std::string SectionKey = !m_SubSection.empty() ? m_SubSection+"\\"+ Key : Key;
std::string value = m_IniFile.GetString(m_CurrentSection.c_str(), SectionKey.c_str(), "");
GlSettingValue SettingsValue(value.c_str());
return SettingsValue;
}
GlSettingValue GlSettings::value(const char * Key, int32_t DefaultValue)
{
char szDefaultValue[400];
sprintf_s(szDefaultValue, sizeof(szDefaultValue), "%d", DefaultValue);
std::string SectionKey = !m_SubSection.empty() ? m_SubSection + "\\" + Key : Key;
std::string value = m_IniFile.GetString(m_CurrentSection.c_str(), SectionKey.c_str(), szDefaultValue);
GlSettingValue SettingsValue(value.c_str());
return SettingsValue;
}
GlSettingValue GlSettings::value(const char * Key, uint32_t DefaultValue)
{
char szDefaultValue[400];
sprintf_s(szDefaultValue, sizeof(szDefaultValue), "%d", DefaultValue);
std::string SectionKey = !m_SubSection.empty() ? m_SubSection + "\\" + Key : Key;
std::string value = m_IniFile.GetString(m_CurrentSection.c_str(), SectionKey.c_str(), szDefaultValue);
GlSettingValue SettingsValue(value.c_str());
return SettingsValue;
}
GlSettingValue GlSettings::value(const char * Key, float DefaultValue)
{
char szDefaultValue[400];
sprintf_s(szDefaultValue, sizeof(szDefaultValue), "%f", DefaultValue);
std::string SectionKey = !m_SubSection.empty() ? m_SubSection + "\\" + Key : Key;
std::string value = m_IniFile.GetString(m_CurrentSection.c_str(), SectionKey.c_str(), szDefaultValue);
GlSettingValue SettingsValue(value.c_str());
return SettingsValue;
}
GlSettingValue GlSettings::value(const char * Key, const char * DefaultValue)
{
std::string SectionKey = !m_SubSection.empty() ? m_SubSection + "\\" + Key : Key;
std::string value = m_IniFile.GetString(m_CurrentSection.c_str(), SectionKey.c_str(), DefaultValue);
GlSettingValue SettingsValue(value.c_str());
return SettingsValue;
}
GlSettingValue GlSettings::value(const char * Key, const GlColor & DefaultValue)
{
char szDefaultValue[400];
#pragma warning(disable: 4996)
sprintf(szDefaultValue, "@Variant(\\0\\0\\x43\\x1\\xff\\xff\\x%x\\x%x\\x%x\\x%x\\x%x\\x%x\\x%x\\x%x)", DefaultValue.Red(), DefaultValue.Red(), DefaultValue.Green(), DefaultValue.Green(), DefaultValue.Blue(), DefaultValue.Blue(), DefaultValue.Alpha(), DefaultValue.Alpha());
#pragma warning(default: 4996)
std::string SectionKey = !m_SubSection.empty() ? m_SubSection + "\\" + Key : Key;
std::string value = m_IniFile.GetString(m_CurrentSection.c_str(), SectionKey.c_str(), szDefaultValue);
GlSettingValue SettingsValue(value.c_str());
return SettingsValue;
}
void GlSettings::setValue(const char * Key, float value)
{
std::string SectionKey = !m_SubSection.empty() ? m_SubSection + "\\" + Key : Key;
char text[400];
#pragma warning(disable: 4996)
sprintf(text, "%f", value);
#pragma warning(default: 4996)
m_IniFile.SaveString(m_CurrentSection.c_str(), SectionKey.c_str(), text);
}
void GlSettings::setValue(const char * Key, int32_t value)
{
std::string SectionKey = !m_SubSection.empty() ? m_SubSection + "\\" + Key : Key;
m_IniFile.SaveNumber(m_CurrentSection.c_str(), SectionKey.c_str(), value);
}
void GlSettings::setValue(const char * Key, uint32_t value)
{
std::string SectionKey = !m_SubSection.empty() ? m_SubSection + "\\" + Key : Key;
m_IniFile.SaveNumber(m_CurrentSection.c_str(), SectionKey.c_str(), value);
}
void GlSettings::setValue(const char * Key, const char * value)
{
std::string SectionKey = !m_SubSection.empty() ? m_SubSection + "\\" + Key : Key;
m_IniFile.SaveString(m_CurrentSection.c_str(), SectionKey.c_str(), value);
}
void GlSettings::setValue(const char * Key, const GlColor & value)
{
char txValue[400];
#pragma warning(disable: 4996)
sprintf(txValue, "@Variant(\\0\\0\\x43\\x1\\xff\\xff\\x%x\\x%x\\x%x\\x%x\\x%x\\x%x\\x%x\\x%x)", value.Red(), value.Red(), value.Green(), value.Green(), value.Blue(), value.Blue(), value.Alpha(), value.Alpha());
#pragma warning(default: 4996)
std::string SectionKey = !m_SubSection.empty() ? m_SubSection + "\\" + Key : Key;
m_IniFile.SaveString(m_CurrentSection.c_str(), SectionKey.c_str(), txValue);
}
void GlSettings::clear(void)
{
CIniFile::SectionList sections;
m_IniFile.GetVectorOfSections(sections);
for (CIniFile::SectionList::const_iterator itr = sections.begin(); itr != sections.end(); itr++)
{
m_IniFile.DeleteSection(itr->c_str());
}
}
void GlSettings::remove(const char * section)
{
m_IniFile.DeleteSection(section);
}
void GlSettings::beginGroup(const char * section)
{
if (strcmp(m_CurrentSection.c_str(), "General") == 0)
{
m_CurrentSection = section;
}
else
{
m_SubSection = section;
}
}
void GlSettings::endGroup(void)
{
if (!m_SubSection.empty())
{
m_SubSection = "";
}
else
{
m_CurrentSection = "General";
m_IniFile.FlushChanges();
}
}
GlSettings::sections GlSettings::childGroups()
{
CIniFile::SectionList Children;
m_IniFile.GetVectorOfSections(Children);
sections Sections;
for (CIniFile::SectionList::iterator itr = Children.begin(); itr != Children.end(); itr++)
{
#pragma warning(disable: 4996)
if (stricmp("General", itr->c_str()) == 0)
{
continue;
}
#pragma warning(default: 4996)
Sections.insert(itr->c_str());
}
return Sections;
}
GlSettingValue::GlSettingValue(const char * value) :
m_Value(value != NULL ? value : "")
{
}
GlSettingValue::GlSettingValue(const GlSettingValue& rhs) :
m_Value(rhs.m_Value)
{
}
GlSettingValue& GlSettingValue::operator=(const GlSettingValue&rhs)
{
m_Value = rhs.m_Value;
return *this;
}
int32_t GlSettingValue::toInt() const
{
uint32_t Value = 0;
#pragma warning(disable: 4996)
sscanf(m_Value.c_str(), "%d", &Value);
#pragma warning(default: 4996)
return Value;
}
float GlSettingValue::toFloat() const
{
float Value = 0.0;
#pragma warning(disable: 4996)
sscanf(m_Value.c_str(), "%f", &Value);
#pragma warning(default: 4996)
return Value;
}
std::string GlSettingValue::toString() const
{
return m_Value;
}
GlColor GlSettingValue::toGlColor() const
{
uint8_t Red = 0, Green = 0, Blue = 0, Alpha = 0;
if (strncmp("@Variant(", m_Value.c_str(), 9) == 0)
{
std::vector<std::string> tokens;
std::string value = m_Value.substr(9);
char delimiter = '\\';
std::string::size_type lastPos = value.find_first_not_of(delimiter, 0);
std::string::size_type pos = value.find_first_of(delimiter, lastPos);
while (std::string::npos != pos)
{
tokens.push_back(value.substr(lastPos, pos - lastPos));
lastPos = pos + 1;
pos = value.find_first_of(delimiter, lastPos);
}
if (std::string::npos != lastPos)
{
tokens.push_back(value.substr(lastPos));
}
if (tokens.size() >= 14)
{
Red = ParseGlColor(tokens[7].c_str());
Green = ParseGlColor(tokens[9].c_str());
Blue = ParseGlColor(tokens[11].c_str());
Alpha = ParseGlColor(tokens[13].c_str());
}
}
return GlColor(Red, Green, Blue, Alpha);
}
uint8_t GlSettingValue::ParseGlColor(const char * color)
{
if (color == NULL) { return 0; }
if (color[0] == '0') { return 0; }
if (color[0] == 'x')
{
uint32_t Value = 0;
#pragma warning(disable: 4996)
sscanf(&color[1], "%X", &Value);
#pragma warning(default: 4996)
return (uint8_t)Value;
}
return 0;
}

View File

@ -0,0 +1,75 @@
#pragma once
#include "IniFileClass.h"
#include <set>
class GlColor
{
public:
GlColor(uint8_t Red, uint8_t Green, uint8_t Blue, uint8_t Alpha = 0);
inline uint8_t Red(void) const { return m_Red; }
inline uint8_t Green(void) const { return m_Green; }
inline uint8_t Blue(void) const { return m_Blue; }
inline uint8_t Alpha(void) const { return m_Alpha; }
private:
GlColor();
uint8_t m_Red, m_Green, m_Blue, m_Alpha;
};
class GlSettingValue
{
public:
GlSettingValue(const char *);
GlSettingValue(const GlSettingValue&);
GlSettingValue& operator=(const GlSettingValue&);
int32_t toInt() const;
float toFloat() const;
std::string toString() const;
GlColor toGlColor() const;
private:
GlSettingValue();
static uint8_t ParseGlColor(const char *);
std::string m_Value;
};
class GlSettings
{
public:
typedef std::set<std::string> sections;
GlSettings(const char * IniFile);
GlSettingValue value(const char * Key);
GlSettingValue value(const char * Key, int32_t DefaultValue);
GlSettingValue value(const char * Key, uint32_t DefaultValue);
GlSettingValue value(const char * Key, float DefaultValue);
GlSettingValue value(const char * Key, const char * DefaultValue);
GlSettingValue value(const char * Key, const GlColor & DefaultValue);
void setValue(const char * Key, int32_t value);
void setValue(const char * Key, uint32_t value);
void setValue(const char * Key, float value);
void setValue(const char * Key, const char * value);
void setValue(const char * Key, const GlColor & value);
sections childGroups();
void clear(void);
void remove(const char * section);
void beginGroup(const char * section);
void endGroup(void);
private:
GlSettings();
GlSettings(const GlSettings&);
GlSettings& operator=(const GlSettings&);
CIniFile m_IniFile;
std::string m_CurrentSection;
std::string m_SubSection;
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
src/GLideNUI-wtl/Icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
src/GLideNUI-wtl/Info.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,879 @@
#include "IniFileClass.h"
#include <stdlib.h>
#include <stdarg.h>
#pragma warning(disable:4996)
CIniFileBase::CIniFileBase(CFileBase & FileObject, const char * FileName) :
m_lastSectionSearch(0),
m_CurrentSectionFilePos(0),
m_LineFeed("\r\n"),
m_ReadOnly(true),
m_InstantFlush(true),
m_File(FileObject),
m_FileName(FileName),
m_CurrentSectionDirty(false),
m_SortFunction(NULL)
{
}
CIniFileBase::~CIniFileBase(void)
{
SaveCurrentSection();
}
void CIniFileBase::fInsertSpaces(int Pos, int NoOfSpaces)
{
enum { fIS_MvSize = 0x2000 };
unsigned char Data[fIS_MvSize + 1];
int SizeToRead, result;
long end, WritePos;
m_File.Seek(0, CFileBase::end);
end = m_File.GetPosition();
if (NoOfSpaces > 0)
{
std::string SpaceBuffer = FormatStr("%*c", NoOfSpaces, ' ');
do
{
SizeToRead = end - Pos;
if (SizeToRead > fIS_MvSize) { SizeToRead = fIS_MvSize; }
if (SizeToRead > 0)
{
m_File.Seek(SizeToRead * -1, CFileBase::current);
WritePos = m_File.GetPosition();
memset(Data, 0, sizeof(Data));
result = m_File.Read(Data, SizeToRead);
m_File.Seek(WritePos, CFileBase::begin);
end = WritePos;
m_File.Write(SpaceBuffer.c_str(), (uint32_t)SpaceBuffer.length());
m_File.Write(Data, result);
m_File.Seek(WritePos, CFileBase::begin);
}
} while (SizeToRead > 0);
}
if (NoOfSpaces < 0)
{
int ReadPos = Pos + (NoOfSpaces * -1);
WritePos = Pos;
do
{
SizeToRead = end - ReadPos;
if (SizeToRead > fIS_MvSize) { SizeToRead = fIS_MvSize; }
m_File.Seek(ReadPos, CFileBase::begin);
m_File.Read(Data, SizeToRead);
m_File.Seek(WritePos, CFileBase::begin);
m_File.Write(Data, SizeToRead);
ReadPos += SizeToRead;
WritePos += SizeToRead;
} while (SizeToRead > 0);
m_File.Seek(WritePos, CFileBase::begin);
std::string SpaceBuffer = FormatStr("%*c", (NoOfSpaces * -1), ' ');
m_File.Write(SpaceBuffer.c_str(), (uint32_t)SpaceBuffer.length());
m_File.Seek(WritePos, CFileBase::begin);
m_File.SetEndOfFile();
m_File.Seek(0, CFileBase::begin);
}
}
int CIniFileBase::GetStringFromFile(char * & String, std::unique_ptr<char> &Data, int & MaxDataSize, int & DataSize, int & ReadPos)
{
enum { BufferIncrease = 0x2000 };
if (MaxDataSize == 0)
{
ReadPos = 0;
MaxDataSize = BufferIncrease;
Data.reset(new char[MaxDataSize]);
DataSize = m_File.Read(&Data.get()[DataSize], MaxDataSize);
}
for (;;)
{
int count;
for (count = ReadPos; count < DataSize; count++)
{
if (Data.get()[count] == '\n')
{
int len = (count - ReadPos) + 1;
String = &Data.get()[ReadPos];
String[len - 1] = 0;
ReadPos = count + 1;
return len;
}
}
if (ReadPos != 0)
{
if ((DataSize - ReadPos) > 0)
{
memmove(Data.get(), &Data.get()[ReadPos], DataSize - ReadPos);
}
DataSize -= ReadPos;
ReadPos = 0;
}
else
{
//Increase buffer size
int NewMaxDataSize = MaxDataSize + BufferIncrease;
char * NewBuffer = new char[NewMaxDataSize];
if (NewBuffer == NULL)
{
return -1;
}
memcpy(NewBuffer, Data.get(), DataSize);
MaxDataSize = NewMaxDataSize;
Data.reset(NewBuffer);
}
int dwRead = m_File.Read(&Data.get()[DataSize], MaxDataSize - DataSize);
if (dwRead == 0)
{
if (DataSize > 0)
{
int len = DataSize + 1;
String = &Data.get()[ReadPos];
String[len - 1] = 0;
DataSize = 0;
ReadPos = 0;
return len;
}
return -1;
}
DataSize += dwRead;
}
}
void CIniFileBase::SaveCurrentSection(void)
{
if (!m_CurrentSectionDirty)
{
return;
}
m_CurrentSectionDirty = false;
if (m_CurrentSection.length() == 0)
{
m_CurrentSection = "default";
}
int lineFeedLen = (int)strlen(m_LineFeed);
if (m_CurrentSectionFilePos == -1)
{
//Section has not been added yet
m_File.Seek(0, CFileBase::end);
int len = (int)m_CurrentSection.length() + (lineFeedLen * 2) + 5;
std::unique_ptr<char> SectionName(new char[len]);
if (m_File.GetLength() < (int)strlen(m_LineFeed))
{
sprintf(SectionName.get(), "[%s]%s", m_CurrentSection.c_str(), m_LineFeed);
}
else
{
sprintf(SectionName.get(), "%s[%s]%s", m_LineFeed, m_CurrentSection.c_str(), m_LineFeed);
}
m_File.Write(SectionName.get(), (int)strlen(SectionName.get()));
m_CurrentSectionFilePos = m_File.GetPosition();
m_SectionsPos.insert(FILELOC::value_type(m_CurrentSection, m_CurrentSectionFilePos));
}
else
{
//increase/decrease space needed
int NeededBufferLen = 0;
{
std::unique_ptr<char> LineData;
int len = 0;
for (KeyValueList::iterator iter = m_CurrentSectionData.begin(); iter != m_CurrentSectionData.end(); iter++)
{
int newLen = (int)iter->first.length() + (int)iter->second.length() + lineFeedLen + 5;
if (newLen > len)
{
LineData.reset(new char[newLen]);
len = newLen;
}
sprintf(LineData.get(), "%s=%s%s", iter->first.c_str(), iter->second.c_str(), m_LineFeed);
NeededBufferLen += (int)strlen(LineData.get());
}
}
int currentLen = 0;
m_File.Seek(m_CurrentSectionFilePos, CFileBase::begin);
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
std::unique_ptr<char> Data;
char *Input = NULL;
//Skip first line as it is the section name
int StartPos = m_CurrentSectionFilePos;
int EndPos = StartPos;
do
{
result = GetStringFromFile(Input, Data, MaxDataSize, DataSize, ReadPos);
if (result <= 1) { continue; }
if (strlen(CleanLine(Input)) <= 1 || Input[0] != '[')
{
EndPos = ((m_File.GetPosition() - DataSize) + ReadPos);
continue;
}
if (Input[0] == '[')
{
NeededBufferLen += lineFeedLen;
}
break;
} while (result >= 0);
currentLen = EndPos - StartPos;
if (NeededBufferLen != currentLen)
{
fInsertSpaces(StartPos, NeededBufferLen - currentLen);
m_File.Flush();
ClearSectionPosList(StartPos);
}
//set pointer to beginning of the start pos
m_File.Seek(StartPos, CFileBase::begin);
}
{
std::unique_ptr<char> LineData;
int len = 0;
if (m_SortFunction != NULL)
{
KeyValueVector data;
for (KeyValueList::iterator iter = m_CurrentSectionData.begin(); iter != m_CurrentSectionData.end(); iter++)
{
data.push_back(KeyValueItem(&iter->first, &iter->second));
}
m_SortFunction(data);
for (size_t i = 0, n = data.size(); i < n; i++)
{
KeyValueItem & item = data[i];
int newLen = (int)(item.first->length()) + (int)item.second->length() + lineFeedLen + 5;
if (newLen > len)
{
LineData.reset(new char[newLen]);
len = newLen;
}
sprintf(LineData.get(), "%s=%s%s", item.first->c_str(), item.second->c_str(), m_LineFeed);
m_File.Write(LineData.get(), (int)strlen(LineData.get()));
}
}
else
{
for (KeyValueList::iterator iter = m_CurrentSectionData.begin(); iter != m_CurrentSectionData.end(); iter++)
{
int newLen = (int)iter->first.length() + (int)iter->second.length() + lineFeedLen + 5;
if (newLen > len)
{
LineData.reset(new char[newLen]);
len = newLen;
}
sprintf(LineData.get(), "%s=%s%s", iter->first.c_str(), iter->second.c_str(), m_LineFeed);
m_File.Write(LineData.get(), (int)strlen(LineData.get()));
}
}
}
m_File.Flush();
}
bool CIniFileBase::MoveToSectionNameData(const char * lpSectionName, bool ChangeCurrentSection)
{
if (strcmp(lpSectionName, m_CurrentSection.c_str()) == 0)
{
return true;
}
if (ChangeCurrentSection)
{
SaveCurrentSection();
m_CurrentSection = "";
}
std::unique_ptr<char> Data;
char *Input = NULL;
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
FILELOC_ITR iter = m_SectionsPos.find(std::string(lpSectionName));
bool bFoundSection = false;
if (iter != m_SectionsPos.end())
{
if (ChangeCurrentSection)
{
m_CurrentSection = iter->first;
m_CurrentSectionFilePos = iter->second;
}
m_File.Seek(iter->second, CFileBase::begin);
bFoundSection = true;
}
else
{
m_File.Seek(m_lastSectionSearch, CFileBase::begin);
//long Fpos;
uint8_t pUTF8[3];
pUTF8[0] = 0xef;
pUTF8[1] = 0xbb;
pUTF8[2] = 0xbf;
do
{
result = GetStringFromFile(Input, Data, MaxDataSize, DataSize, ReadPos);
if (result <= 1) { continue; }
if (strlen(CleanLine(Input)) <= 1) { continue; }
//We Only care about sections
char * CurrentSection = Input;
if (m_lastSectionSearch == 0 && !memcmp(CurrentSection, pUTF8, 3))
{
CurrentSection += 3;
}
if (CurrentSection[0] != '[') { continue; }
int lineEndPos = (int)strlen(CurrentSection) - 1;
if (CurrentSection[lineEndPos] != ']') { continue; }
//take off the ']' from the end of the string
CurrentSection[lineEndPos] = 0;
CurrentSection += 1;
m_lastSectionSearch = (m_File.GetPosition() - DataSize) + ReadPos;
m_SectionsPos.insert(FILELOC::value_type(CurrentSection, m_lastSectionSearch));
if (_stricmp(lpSectionName, CurrentSection) != 0)
{
continue;
}
if (ChangeCurrentSection)
{
m_CurrentSection = lpSectionName;
m_CurrentSectionFilePos = m_lastSectionSearch;
}
else
{
m_File.Seek(m_lastSectionSearch, CFileBase::begin);
}
bFoundSection = true;
break;
} while (result >= 0);
}
if (!bFoundSection && strcmp(lpSectionName, "default") == 0)
{
m_SectionsPos.insert(FILELOC::value_type(lpSectionName, 0));
if (ChangeCurrentSection)
{
m_CurrentSection = lpSectionName;
m_CurrentSectionFilePos = 0;
}
m_File.Seek(m_lastSectionSearch, CFileBase::begin);
bFoundSection = true;
}
if (bFoundSection && ChangeCurrentSection)
{
m_CurrentSectionData.clear();
do
{
result = GetStringFromFile(Input, Data, MaxDataSize, DataSize, ReadPos);
if (result <= 1) { continue; }
if (strlen(CleanLine(Input)) <= 1) { continue; }
if (Input[0] == '[') { break; }
char * Pos = strchr(Input, '=');
if (Pos == NULL) { continue; }
char * Value = &Pos[1];
char * Pos1 = Pos - 1;
while (((*Pos1 == ' ') || (*Pos1 == '\t')) && (Pos1 > Input))
{
Pos1--;
}
Pos1[1] = 0;
m_CurrentSectionData.insert(KeyValueList::value_type(Input, Value));
} while (result >= 0);
}
return bFoundSection;
}
const char * CIniFileBase::CleanLine(char * Line)
{
char * Pos = Line;
//Remove any comment from the line
while (Pos != NULL)
{
Pos = strchr(Pos, '/');
if (Pos != NULL)
{
if (Pos[1] == '/')
{
if (Pos > Line)
{
char * Pos_1 = Pos - 1;
if (Pos_1[0] != ':')
{
Pos[0] = 0;
}
else
Pos += 1;
}
else
{
Pos[0] = 0;
}
}
else
{
Pos += 1;
}
}
}
//strip any spaces or line feeds from the end of the line
for (int count = (int)strlen(&Line[0]) - 1; count >= 0; count--)
{
if (Line[count] != ' ' && Line[count] != '\r') { break; }
Line[count] = 0;
}
return Line;
}
void CIniFileBase::OpenIniFileReadOnly()
{
if (m_File.Open(m_FileName.c_str(), CFileBase::modeRead))
{
m_ReadOnly = true;
m_File.Seek(0, CFileBase::begin);
}
}
void CIniFileBase::OpenIniFile(bool bCreate)
{
//Open for reading/Writing
m_ReadOnly = false;
if (!m_File.Open(m_FileName.c_str(), CFileBase::modeReadWrite | CFileBase::shareDenyWrite))
{
if (!m_File.Open(m_FileName.c_str(), CFileBase::modeRead))
{
if (bCreate)
{
if (!m_File.Open(m_FileName.c_str(), CFileBase::modeReadWrite | CFileBase::modeCreate | CFileBase::shareDenyWrite))
{
return;
}
}
}
else
{
m_ReadOnly = true;
}
}
m_File.Seek(0, CFileBase::begin);
}
bool CIniFileBase::IsEmpty()
{
if (m_File.GetLength() == 0)
return true;
return false;
}
bool CIniFileBase::IsFileOpen(void)
{
return m_File.IsOpen();
}
bool CIniFileBase::DeleteSection(const char * lpSectionName)
{
if (!m_File.IsOpen()) { return false; }
SaveCurrentSection();
if (!MoveToSectionNameData(lpSectionName, true))
{
return false;
}
m_File.Seek(m_CurrentSectionFilePos, CFileBase::begin);
long DeleteSectionStart = m_CurrentSectionFilePos - (strlen(lpSectionName) + strlen(m_LineFeed) + 2);
long NextSectionStart = -1;
{
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, NextLine = 0, result;
std::unique_ptr <char> Data;
char *Input = NULL;
do
{
result = GetStringFromFile(Input, Data, MaxDataSize, DataSize, ReadPos);
if (result <= 1) { continue; }
if (strlen(CleanLine(Input)) <= 1) { continue; }
if (Input[0] != '[')
{
NextLine = (m_File.GetPosition() - DataSize) + ReadPos;
continue;
}
NextSectionStart = NextLine != 0 ? NextLine : (m_File.GetPosition() - DataSize) + ReadPos;
break;
} while (result >= 0);
}
if (NextSectionStart != -1)
{
m_File.Seek(0, CFileBase::end);
long end = m_File.GetPosition();
long ReadPos = NextSectionStart;
long WritePos = DeleteSectionStart;
enum { fIS_MvSize = 0x2000 };
unsigned char Data[fIS_MvSize + 1];
int SizeToRead;
do
{
SizeToRead = end - ReadPos;
if (SizeToRead > fIS_MvSize) { SizeToRead = fIS_MvSize; }
m_File.Seek(ReadPos, CFileBase::begin);
m_File.Read(Data, SizeToRead);
m_File.Seek(WritePos, CFileBase::begin);
m_File.Write(Data, SizeToRead);
ReadPos += SizeToRead;
WritePos += SizeToRead;
} while (SizeToRead > 0);
m_File.Seek(DeleteSectionStart + (end - NextSectionStart), CFileBase::begin);
m_File.Flush();
m_File.SetEndOfFile();
}
else
{
m_File.Seek(DeleteSectionStart, CFileBase::begin);
m_File.Flush();
m_File.SetEndOfFile();
}
m_File.Flush();
ClearSectionPosList(0);
m_CurrentSection = "";
m_CurrentSectionData.clear();
m_CurrentSectionFilePos = -1;
return true;
}
bool CIniFileBase::GetString(const char * lpSectionName, const char * lpKeyName, const char * lpDefault, std::string & Value)
{
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
{
lpSectionName = "default";
}
if (m_File.IsOpen() && MoveToSectionNameData(lpSectionName, true))
{
KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName);
if (iter != m_CurrentSectionData.end())
{
Value = iter->second.c_str();
return true;
}
}
Value = lpDefault;
return false;
}
std::string CIniFileBase::GetString(const char * lpSectionName, const char * lpKeyName, const char * lpDefault)
{
std::string Value;
GetString(lpSectionName, lpKeyName, lpDefault, Value);
return Value;
}
uint32_t CIniFileBase::GetString(const char * lpSectionName, const char * lpKeyName, const char * lpDefault, char * lpReturnedString, uint32_t nSize)
{
std::string strSection;
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
{
strSection = "default";
}
else
{
strSection = lpSectionName;
}
if (m_File.IsOpen() && MoveToSectionNameData(strSection.c_str(), true))
{
KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName);
if (iter != m_CurrentSectionData.end())
{
strncpy(lpReturnedString, iter->second.c_str(), nSize - 1);
lpReturnedString[nSize - 1] = 0;
return (uint32_t)strlen(lpReturnedString);
}
}
strncpy(lpReturnedString, lpDefault, nSize - 1);
lpReturnedString[nSize - 1] = 0;
return (uint32_t)strlen(lpReturnedString);
}
uint32_t CIniFileBase::GetNumber(const char * lpSectionName, const char * lpKeyName, uint32_t nDefault)
{
uint32_t Value;
GetNumber(lpSectionName, lpKeyName, nDefault, Value);
return Value;
}
bool CIniFileBase::GetNumber(const char * lpSectionName, const char * lpKeyName, uint32_t nDefault, uint32_t & Value)
{
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
{
lpSectionName = "default";
}
if (m_File.IsOpen() && MoveToSectionNameData(lpSectionName, true))
{
KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName);
if (iter != m_CurrentSectionData.end())
{
Value = 0;
sscanf(iter->second.c_str(), "%u", &Value);
return true;
}
}
Value = nDefault;
return false;
}
void CIniFileBase::SaveString(const char * lpSectionName, const char * lpKeyName, const char * lpString)
{
if (!m_File.IsOpen())
{
if (lpString)
{
OpenIniFile();
}
if (!m_File.IsOpen())
{
return;
}
}
std::string strSection;
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
{
strSection = "default";
}
else
{
strSection = lpSectionName;
}
if (!MoveToSectionNameData(strSection.c_str(), true))
{
m_CurrentSection = strSection;
m_CurrentSectionData.clear();
m_CurrentSectionFilePos = -1;
}
KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName);
if (iter != m_CurrentSectionData.end())
{
if (lpString)
{
if (iter->second != lpString)
{
iter->second = lpString;
m_CurrentSectionDirty = true;
}
}
else
{
m_CurrentSectionData.erase(iter);
m_CurrentSectionDirty = true;
}
}
else
{
if (lpString)
{
m_CurrentSectionData.insert(KeyValueList::value_type(lpKeyName, lpString));
m_CurrentSectionDirty = true;
}
}
if (m_InstantFlush)
{
SaveCurrentSection();
}
}
void CIniFileBase::SaveNumber(const char * lpSectionName, const char * lpKeyName, int32_t Value)
{
//translate the string to an ascii version and save as text
SaveString(lpSectionName, lpKeyName, FormatStr("%d", Value).c_str());
}
bool CIniFileBase::EntryExists(const char * lpSectionName, const char * lpKeyName)
{
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
{
lpSectionName = "default";
}
if (m_File.IsOpen() && MoveToSectionNameData(lpSectionName, true))
{
KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName);
if (iter != m_CurrentSectionData.end())
{
return true;
}
}
return false;
}
void CIniFileBase::FlushChanges(void)
{
SaveCurrentSection();
}
void CIniFileBase::SetAutoFlush(bool AutoFlush)
{
m_InstantFlush = AutoFlush;
if (AutoFlush)
{
FlushChanges();
}
}
void CIniFileBase::GetKeyList(const char * lpSectionName, strlist &List)
{
List.clear();
if (!m_File.IsOpen())
{
return;
}
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
{
lpSectionName = "default";
}
if (MoveToSectionNameData(lpSectionName, true))
{
for (KeyValueList::iterator iter = m_CurrentSectionData.begin(); iter != m_CurrentSectionData.end(); iter++)
{
List.push_back(iter->first);
}
}
}
void CIniFileBase::GetKeyValueData(const char * lpSectionName, KeyValueData & List)
{
if (!m_File.IsOpen())
{
return;
}
std::string strSection;
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
{
strSection = "default";
}
else
{
strSection = lpSectionName;
}
if (!MoveToSectionNameData(strSection.c_str(), false)) { return; }
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
std::unique_ptr <char> Data;
char *Input = NULL;
do
{
result = GetStringFromFile(Input, Data, MaxDataSize, DataSize, ReadPos);
if (result <= 1) { continue; }
if (strlen(CleanLine(Input)) <= 1) { continue; }
if (Input[0] == '[') { break; }
char * Pos = strchr(Input, '=');
if (Pos == NULL) { continue; }
Pos[0] = 0;
List.insert(KeyValueData::value_type(Input, &Pos[1]));
} while (result >= 0);
}
void CIniFileBase::SetCustomSort(SortData SortFunction)
{
m_SortFunction = SortFunction;
}
void CIniFileBase::ClearSectionPosList(long FilePos)
{
if (FilePos <= 0)
{
m_SectionsPos.clear();
m_lastSectionSearch = 0;
}
else
{
FILELOC::iterator iter = m_SectionsPos.begin();
while (iter != m_SectionsPos.end())
{
FILELOC::iterator CurrentIter = iter;
iter++;
long TestFilePos = CurrentIter->second;
if (TestFilePos > FilePos)
{
m_SectionsPos.erase(CurrentIter);
}
}
m_lastSectionSearch = FilePos;
}
}
void CIniFileBase::GetVectorOfSections(SectionList & sections)
{
sections.clear();
if (!m_File.IsOpen())
{
return;
}
{
std::string DoesNotExist = FormatStr("DoesNotExist%d%d%d", rand(), rand(), rand());
MoveToSectionNameData(DoesNotExist.c_str(), false);
}
for (FILELOC::const_iterator iter = m_SectionsPos.begin(); iter != m_SectionsPos.end(); iter++)
{
sections.push_back(iter->first);
}
}
std::string CIniFileBase::FormatStr(const char * strFormat, ...)
{
std::string FormatedStr;
va_list args;
va_start(args, strFormat);
size_t nlen = _vscprintf(strFormat, args) + 1;
char * buffer = (char *)alloca(nlen * sizeof(char));
buffer[nlen - 1] = 0;
if (buffer != NULL)
{
vsprintf(buffer, strFormat, args);
FormatedStr = buffer;
}
va_end(args);
return FormatedStr;
}

View File

@ -0,0 +1,127 @@
#pragma once
#ifndef _WIN32
#include <strings.h>
#endif
#include "FileClass.h"
#include <string>
#include <map>
#include <vector>
#include <list>
#include <memory>
class CIniFileBase
{
public:
typedef std::map<std::string, std::string> KeyValueData;
typedef std::vector<std::string> SectionList;
typedef std::list<std::string> strlist;
typedef std::pair<const std::string *, const std::string *> KeyValueItem;
typedef std::vector<KeyValueItem> KeyValueVector;
typedef void(*SortData)(KeyValueVector &);
CIniFileBase(CFileBase & FileObject, const char * FileName);
virtual ~CIniFileBase(void);
bool IsEmpty();
bool IsFileOpen(void);
bool DeleteSection(const char * lpSectionName);
bool GetString(const char * lpSectionName, const char * lpKeyName, const char * lpDefault, std::string & Value);
std::string GetString(const char * lpSectionName, const char * lpKeyName, const char * lpDefault);
uint32_t GetString(const char * lpSectionName, const char * lpKeyName, const char * lpDefault, char * lpReturnedString, uint32_t nSize);
uint32_t GetNumber(const char * lpSectionName, const char * lpKeyName, uint32_t nDefault);
bool GetNumber(const char * lpSectionName, const char * lpKeyName, uint32_t nDefault, uint32_t & Value);
virtual void SaveString(const char * lpSectionName, const char * lpKeyName, const char * lpString);
virtual void SaveNumber(const char * lpSectionName, const char * lpKeyName, int32_t Value);
void SetAutoFlush(bool AutoFlush);
void FlushChanges(void);
bool EntryExists(const char * lpSectionName, const char * lpKeyName);
void GetKeyList(const char * lpSectionName, strlist &List);
void GetKeyValueData(const char * lpSectionName, KeyValueData & List);
void SetCustomSort(SortData SortFunction);
void GetVectorOfSections(SectionList & sections);
const std::string &GetFileName() { return m_FileName; }
protected:
void OpenIniFileReadOnly();
void OpenIniFile(bool bCreate = true);
void SaveCurrentSection(void);
std::string FormatStr(const char * strFormat, ...);
CFileBase & m_File;
std::string m_FileName;
private:
struct insensitive_compare
{
bool operator() (const std::string & a, const std::string & b) const
{
return _stricmp(a.c_str(), b.c_str()) < 0;
}
};
typedef std::map<std::string, long> FILELOC;
typedef FILELOC::iterator FILELOC_ITR;
typedef std::map<std::string, std::string, insensitive_compare> KeyValueList;
std::string m_CurrentSection;
bool m_CurrentSectionDirty;
int m_CurrentSectionFilePos; // Where in the file is the current Section
KeyValueList m_CurrentSectionData;
long m_lastSectionSearch; // When Scanning for a section, what was the last scanned pos
bool m_ReadOnly;
bool m_InstantFlush;
const char * m_LineFeed;
FILELOC m_SectionsPos;
SortData m_SortFunction;
void fInsertSpaces(int Pos, int NoOfSpaces);
int GetStringFromFile(char * & String, std::unique_ptr<char> &Data, int & MaxDataSize, int & DataSize, int & ReadPos);
bool MoveToSectionNameData(const char * lpSectionName, bool ChangeCurrentSection);
const char * CleanLine(char * Line);
void ClearSectionPosList(long FilePos);
};
template <class CFileStorage>
class CIniFileT :
public CIniFileBase
{
public:
CIniFileT(const char * FileName) :
CIniFileBase(m_FileObject, FileName)
{
//Try to open file for reading
OpenIniFile();
}
CIniFileT(const char * FileName, bool bCreate, bool bReadOnly) :
CIniFileBase(m_FileObject, FileName)
{
if (bReadOnly)
{
OpenIniFileReadOnly();
}
else
{
//Try to open file for reading
OpenIniFile(bCreate);
}
}
virtual ~CIniFileT(void)
{
SaveCurrentSection();
}
protected:
CFileStorage m_FileObject;
};
typedef CIniFileT<CFile> CIniFile;

BIN
src/GLideNUI-wtl/Left.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
src/GLideNUI-wtl/Right.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,6 @@
#include "GLideNUI.h"
#include "../Config.h"
EXPORT void CALL SaveScreenshot(const wchar_t * _folder, const char * _name, int _width, int _height, const unsigned char * _data)
{
}

View File

@ -0,0 +1,555 @@
#ifdef _WIN32
#include <windows.h>
#else
#include "../winlnxdefs.h"
#endif
#include "../GBI.h"
#include "../Config.h"
#include "Settings.h"
#include "GlSettings.h"
#include "util.h"
#include <algorithm>
#include <memory>
static const char * strIniFileName = "GLideN64.ini";
static const char * strCustomSettingsFileName = "GLideN64.custom.ini";
static const char * strUserProfile = "User";
static
void _loadSettings(GlSettings & settings)
{
config.version = settings.value("version").toInt();
settings.beginGroup("video");
config.video.fullscreenWidth = settings.value("fullscreenWidth", config.video.fullscreenWidth).toInt();
config.video.fullscreenHeight = settings.value("fullscreenHeight", config.video.fullscreenHeight).toInt();
config.video.windowedWidth = settings.value("windowedWidth", config.video.windowedWidth).toInt();
config.video.windowedHeight = settings.value("windowedHeight", config.video.windowedHeight).toInt();
config.video.fullscreenRefresh = settings.value("fullscreenRefresh", config.video.fullscreenRefresh).toInt();
config.video.multisampling = settings.value("multisampling", config.video.multisampling).toInt();
config.video.fxaa= settings.value("fxaa", config.video.fxaa).toInt();
config.video.verticalSync = settings.value("verticalSync", config.video.verticalSync).toInt();
config.video.threadedVideo = settings.value("threadedVideo", config.video.threadedVideo).toInt();
settings.endGroup();
settings.beginGroup("texture");
config.texture.maxAnisotropy = settings.value("maxAnisotropy", config.texture.maxAnisotropy).toInt();
config.texture.bilinearMode = settings.value("bilinearMode", config.texture.bilinearMode).toInt();
config.texture.enableHalosRemoval = settings.value("enableHalosRemoval", config.texture.enableHalosRemoval).toInt();
config.texture.screenShotFormat = settings.value("screenShotFormat", config.texture.screenShotFormat).toInt();
settings.endGroup();
settings.beginGroup("generalEmulation");
config.generalEmulation.enableNoise = settings.value("enableNoise", config.generalEmulation.enableNoise).toInt();
config.generalEmulation.enableLOD = settings.value("enableLOD", config.generalEmulation.enableLOD).toInt();
config.generalEmulation.enableHWLighting = settings.value("enableHWLighting", config.generalEmulation.enableHWLighting).toInt();
config.generalEmulation.enableShadersStorage = settings.value("enableShadersStorage", config.generalEmulation.enableShadersStorage).toInt();
config.generalEmulation.enableCustomSettings = settings.value("enableCustomSettings", config.generalEmulation.enableCustomSettings).toInt();
settings.endGroup();
settings.beginGroup("graphics2D");
config.graphics2D.correctTexrectCoords = settings.value("correctTexrectCoords", config.graphics2D.correctTexrectCoords).toInt();
config.graphics2D.enableNativeResTexrects = settings.value("enableNativeResTexrects", config.graphics2D.enableNativeResTexrects).toInt();
config.graphics2D.bgMode = settings.value("bgMode", config.graphics2D.bgMode).toInt();
settings.endGroup();
settings.beginGroup("frameBufferEmulation");
config.frameBufferEmulation.enable = settings.value("enable", config.frameBufferEmulation.enable).toInt();
config.frameBufferEmulation.aspect = settings.value("aspect", config.frameBufferEmulation.aspect).toInt();
config.frameBufferEmulation.nativeResFactor = settings.value("nativeResFactor", config.frameBufferEmulation.nativeResFactor).toInt();
config.frameBufferEmulation.bufferSwapMode = settings.value("bufferSwapMode", config.frameBufferEmulation.bufferSwapMode).toInt();
config.frameBufferEmulation.N64DepthCompare = settings.value("N64DepthCompare", config.frameBufferEmulation.N64DepthCompare).toInt();
config.frameBufferEmulation.forceDepthBufferClear = settings.value("forceDepthBufferClear", config.frameBufferEmulation.forceDepthBufferClear).toInt();
config.frameBufferEmulation.copyAuxToRDRAM = settings.value("copyAuxToRDRAM", config.frameBufferEmulation.copyAuxToRDRAM).toInt();
config.frameBufferEmulation.copyToRDRAM = settings.value("copyToRDRAM", config.frameBufferEmulation.copyToRDRAM).toInt();
config.frameBufferEmulation.copyDepthToRDRAM = settings.value("copyDepthToRDRAM", config.frameBufferEmulation.copyDepthToRDRAM).toInt();
config.frameBufferEmulation.copyFromRDRAM = settings.value("copyFromRDRAM", config.frameBufferEmulation.copyFromRDRAM).toInt();
config.frameBufferEmulation.fbInfoDisabled = settings.value("fbInfoDisabled", config.frameBufferEmulation.fbInfoDisabled).toInt();
config.frameBufferEmulation.fbInfoReadColorChunk = settings.value("fbInfoReadColorChunk", config.frameBufferEmulation.fbInfoReadColorChunk).toInt();
config.frameBufferEmulation.fbInfoReadDepthChunk = settings.value("fbInfoReadDepthChunk", config.frameBufferEmulation.fbInfoReadDepthChunk).toInt();
config.frameBufferEmulation.copyDepthToMainDepthBuffer = settings.value("copyDepthToMainDepthBuffer", config.frameBufferEmulation.copyDepthToMainDepthBuffer).toInt();
config.frameBufferEmulation.enableOverscan = settings.value("enableOverscan", config.frameBufferEmulation.enableOverscan).toInt();
config.frameBufferEmulation.overscanPAL.left = settings.value("overscanPalLeft", config.frameBufferEmulation.overscanPAL.left).toInt();
config.frameBufferEmulation.overscanPAL.right = settings.value("overscanPalRight", config.frameBufferEmulation.overscanPAL.right).toInt();
config.frameBufferEmulation.overscanPAL.top = settings.value("overscanPalTop", config.frameBufferEmulation.overscanPAL.top).toInt();
config.frameBufferEmulation.overscanPAL.bottom= settings.value("overscanPalBottom", config.frameBufferEmulation.overscanPAL.bottom).toInt();
config.frameBufferEmulation.overscanNTSC.left = settings.value("overscanNtscLeft", config.frameBufferEmulation.overscanNTSC.left).toInt();
config.frameBufferEmulation.overscanNTSC.right = settings.value("overscanNtscRight", config.frameBufferEmulation.overscanNTSC.right).toInt();
config.frameBufferEmulation.overscanNTSC.top = settings.value("overscanNtscTop", config.frameBufferEmulation.overscanNTSC.top).toInt();
config.frameBufferEmulation.overscanNTSC.bottom = settings.value("overscanNtscBottom", config.frameBufferEmulation.overscanNTSC.bottom).toInt();
settings.endGroup();
settings.beginGroup("textureFilter");
config.textureFilter.txFilterMode = settings.value("txFilterMode", config.textureFilter.txFilterMode).toInt();
config.textureFilter.txEnhancementMode = settings.value("txEnhancementMode", config.textureFilter.txEnhancementMode).toInt();
config.textureFilter.txDeposterize = settings.value("txDeposterize", config.textureFilter.txDeposterize).toInt();
config.textureFilter.txFilterIgnoreBG = settings.value("txFilterIgnoreBG", config.textureFilter.txFilterIgnoreBG).toInt();
config.textureFilter.txCacheSize = settings.value("txCacheSize", config.textureFilter.txCacheSize).toInt();
config.textureFilter.txHiresEnable = settings.value("txHiresEnable", config.textureFilter.txHiresEnable).toInt();
config.textureFilter.txHiresFullAlphaChannel = settings.value("txHiresFullAlphaChannel", config.textureFilter.txHiresFullAlphaChannel).toInt();
config.textureFilter.txHresAltCRC = settings.value("txHresAltCRC", config.textureFilter.txHresAltCRC).toInt();
config.textureFilter.txDump = settings.value("txDump", config.textureFilter.txDump).toInt();
config.textureFilter.txForce16bpp = settings.value("txForce16bpp", config.textureFilter.txForce16bpp).toInt();
config.textureFilter.txCacheCompression = settings.value("txCacheCompression", config.textureFilter.txCacheCompression).toInt();
config.textureFilter.txSaveCache = settings.value("txSaveCache", config.textureFilter.txSaveCache).toInt();
config.textureFilter.txEnhancedTextureFileStorage = settings.value("txEnhancedTextureFileStorage", config.textureFilter.txEnhancedTextureFileStorage).toInt();
config.textureFilter.txHiresTextureFileStorage = settings.value("txHiresTextureFileStorage", config.textureFilter.txHiresTextureFileStorage).toInt();
wcscpy_s(config.textureFilter.txPath, ToUTF16(settings.value("txPath", FromUTF16(config.textureFilter.txPath).c_str()).toString().c_str()).c_str());
wcscpy_s(config.textureFilter.txCachePath, ToUTF16(settings.value("txCachePath", FromUTF16(config.textureFilter.txPath).c_str()).toString().c_str()).c_str());
wcscpy_s(config.textureFilter.txDumpPath, ToUTF16(settings.value("txDumpPath", FromUTF16(config.textureFilter.txPath).c_str()).toString().c_str()).c_str());
settings.endGroup();
settings.beginGroup("font");
config.font.name = settings.value("name", config.font.name.c_str()).toString();
config.font.size = settings.value("size", config.font.size).toInt();
GlColor fontColor = settings.value("color", GlColor(config.font.color[0], config.font.color[1], config.font.color[2])).toGlColor();
config.font.color[0] = fontColor.Red();
config.font.color[1] = fontColor.Green();
config.font.color[2] = fontColor.Blue();
config.font.color[3] = fontColor.Alpha();
config.font.colorf[0] = _FIXED2FLOAT(config.font.color[0], 8);
config.font.colorf[1] = _FIXED2FLOAT(config.font.color[1], 8);
config.font.colorf[2] = _FIXED2FLOAT(config.font.color[2], 8);
config.font.colorf[3] = config.font.color[3] == 0 ? 1.0f : _FIXED2FLOAT(config.font.color[3], 8);
settings.endGroup();
settings.beginGroup("gammaCorrection");
config.gammaCorrection.force = settings.value("force", config.gammaCorrection.force).toInt();
config.gammaCorrection.level = settings.value("level", config.gammaCorrection.level).toFloat();
settings.endGroup();
settings.beginGroup("onScreenDisplay");
config.onScreenDisplay.fps = settings.value("showFPS", config.onScreenDisplay.fps).toInt();
config.onScreenDisplay.vis = settings.value("showVIS", config.onScreenDisplay.vis).toInt();
config.onScreenDisplay.percent = settings.value("showPercent", config.onScreenDisplay.percent).toInt();
config.onScreenDisplay.internalResolution = settings.value("showInternalResolution", config.onScreenDisplay.internalResolution).toInt();
config.onScreenDisplay.renderingResolution = settings.value("showRenderingResolution", config.onScreenDisplay.renderingResolution).toInt();
config.onScreenDisplay.pos = settings.value("osdPos", config.onScreenDisplay.pos).toInt();
settings.endGroup();
settings.beginGroup("debug");
config.debug.dumpMode = settings.value("dumpMode", config.debug.dumpMode).toInt();
settings.endGroup();
}
void loadSettings(const char * _strIniFolder)
{
std::string IniFileName = _strIniFolder;
IniFileName += "/";
IniFileName += strIniFileName;
bool rewriteSettings = false;
{
const u32 hacks = config.generalEmulation.hacks;
GlSettings settings(IniFileName.c_str());
const u32 configVersion = settings.value("version", 0).toInt();
config.resetToDefaults();
config.generalEmulation.hacks = hacks;
config.translationFile = settings.value("translation", config.translationFile.c_str()).toString();
if (configVersion < CONFIG_WITH_PROFILES) {
_loadSettings(settings);
config.version = CONFIG_VERSION_CURRENT;
settings.clear();
settings.setValue("version", CONFIG_VERSION_CURRENT);
settings.setValue("profile", strUserProfile);
settings.setValue("translation", config.translationFile.c_str());
settings.beginGroup(strUserProfile);
writeSettings(_strIniFolder);
settings.endGroup();
} else {
std::string profile = settings.value("profile", strUserProfile).toString();
GlSettings::sections childGroups = settings.childGroups();
if (childGroups.find(profile.c_str()) != childGroups.end()) {
settings.beginGroup(profile.c_str());
_loadSettings(settings);
settings.endGroup();
} else
rewriteSettings = true;
if (config.version != CONFIG_VERSION_CURRENT)
rewriteSettings = true;
}
}
if (rewriteSettings) {
// Keep settings up-to-date
{
GlSettings settings(IniFileName.c_str());
std::string profile = settings.value("profile", strUserProfile).toString();
settings.remove(profile.c_str());
}
config.version = CONFIG_VERSION_CURRENT;
writeSettings(_strIniFolder);
}
}
void writeSettings(const char * _strIniFolder)
{
std::string IniFileName = _strIniFolder;
IniFileName += "/";
IniFileName += strIniFileName;
GlSettings settings(IniFileName.c_str());
settings.setValue("version", config.version);
settings.setValue("translation", config.translationFile.c_str());
std::string profile = settings.value("profile", strUserProfile).toString();
if (profile.length() > 0)
{
settings.beginGroup(profile.c_str());
settings.setValue("version", config.version);
settings.beginGroup("video");
settings.setValue("fullscreenWidth", config.video.fullscreenWidth);
settings.setValue("fullscreenHeight", config.video.fullscreenHeight);
settings.setValue("windowedWidth", config.video.windowedWidth);
settings.setValue("windowedHeight", config.video.windowedHeight);
settings.setValue("fullscreenRefresh", config.video.fullscreenRefresh);
settings.setValue("multisampling", config.video.multisampling);
settings.setValue("fxaa", config.video.fxaa);
settings.setValue("verticalSync", config.video.verticalSync);
settings.setValue("threadedVideo", config.video.threadedVideo);
settings.endGroup();
settings.beginGroup("texture");
settings.setValue("maxAnisotropy", config.texture.maxAnisotropy);
settings.setValue("bilinearMode", config.texture.bilinearMode);
settings.setValue("enableHalosRemoval", config.texture.enableHalosRemoval);
settings.setValue("screenShotFormat", config.texture.screenShotFormat);
settings.endGroup();
settings.beginGroup("generalEmulation");
settings.setValue("enableNoise", config.generalEmulation.enableNoise);
settings.setValue("enableLOD", config.generalEmulation.enableLOD);
settings.setValue("enableHWLighting", config.generalEmulation.enableHWLighting);
settings.setValue("enableShadersStorage", config.generalEmulation.enableShadersStorage);
settings.setValue("enableCustomSettings", config.generalEmulation.enableCustomSettings);
settings.endGroup();
settings.beginGroup("graphics2D");
settings.setValue("correctTexrectCoords", config.graphics2D.correctTexrectCoords);
settings.setValue("enableNativeResTexrects", config.graphics2D.enableNativeResTexrects);
settings.setValue("bgMode", config.graphics2D.bgMode);
settings.endGroup();
settings.beginGroup("frameBufferEmulation");
settings.setValue("enable", config.frameBufferEmulation.enable);
settings.setValue("aspect", config.frameBufferEmulation.aspect);
settings.setValue("nativeResFactor", config.frameBufferEmulation.nativeResFactor);
settings.setValue("bufferSwapMode", config.frameBufferEmulation.bufferSwapMode);
settings.setValue("N64DepthCompare", config.frameBufferEmulation.N64DepthCompare);
settings.setValue("forceDepthBufferClear", config.frameBufferEmulation.forceDepthBufferClear);
settings.setValue("copyAuxToRDRAM", config.frameBufferEmulation.copyAuxToRDRAM);
settings.setValue("copyFromRDRAM", config.frameBufferEmulation.copyFromRDRAM);
settings.setValue("copyToRDRAM", config.frameBufferEmulation.copyToRDRAM);
settings.setValue("copyDepthToRDRAM", config.frameBufferEmulation.copyDepthToRDRAM);
settings.setValue("fbInfoDisabled", config.frameBufferEmulation.fbInfoDisabled);
settings.setValue("fbInfoReadColorChunk", config.frameBufferEmulation.fbInfoReadColorChunk);
settings.setValue("fbInfoReadDepthChunk", config.frameBufferEmulation.fbInfoReadDepthChunk);
settings.setValue("copyDepthToMainDepthBuffer", config.frameBufferEmulation.copyDepthToMainDepthBuffer);
settings.setValue("enableOverscan", config.frameBufferEmulation.enableOverscan);
settings.setValue("overscanPalLeft", config.frameBufferEmulation.overscanPAL.left);
settings.setValue("overscanPalRight", config.frameBufferEmulation.overscanPAL.right);
settings.setValue("overscanPalTop", config.frameBufferEmulation.overscanPAL.top);
settings.setValue("overscanPalBottom", config.frameBufferEmulation.overscanPAL.bottom);
settings.setValue("overscanNtscLeft", config.frameBufferEmulation.overscanNTSC.left);
settings.setValue("overscanNtscRight", config.frameBufferEmulation.overscanNTSC.right);
settings.setValue("overscanNtscTop", config.frameBufferEmulation.overscanNTSC.top);
settings.setValue("overscanNtscBottom", config.frameBufferEmulation.overscanNTSC.bottom);
settings.endGroup();
settings.beginGroup("textureFilter");
settings.setValue("txFilterMode", config.textureFilter.txFilterMode);
settings.setValue("txEnhancementMode", config.textureFilter.txEnhancementMode);
settings.setValue("txDeposterize", config.textureFilter.txDeposterize);
settings.setValue("txFilterIgnoreBG", config.textureFilter.txFilterIgnoreBG);
settings.setValue("txCacheSize", config.textureFilter.txCacheSize);
settings.setValue("txHiresEnable", config.textureFilter.txHiresEnable);
settings.setValue("txHiresFullAlphaChannel", config.textureFilter.txHiresFullAlphaChannel);
settings.setValue("txHresAltCRC", config.textureFilter.txHresAltCRC);
settings.setValue("txDump", config.textureFilter.txDump);
settings.setValue("txForce16bpp", config.textureFilter.txForce16bpp);
settings.setValue("txCacheCompression", config.textureFilter.txCacheCompression);
settings.setValue("txSaveCache", config.textureFilter.txSaveCache);
settings.setValue("txEnhancedTextureFileStorage", config.textureFilter.txEnhancedTextureFileStorage);
settings.setValue("txHiresTextureFileStorage", config.textureFilter.txHiresTextureFileStorage);
settings.setValue("txPath", FromUTF16(config.textureFilter.txPath).c_str());
settings.setValue("txCachePath", FromUTF16(config.textureFilter.txCachePath).c_str());
settings.setValue("txDumpPath", FromUTF16(config.textureFilter.txDumpPath).c_str());
settings.endGroup();
settings.beginGroup("font");
settings.setValue("name", config.font.name.c_str());
settings.setValue("size", config.font.size);
settings.setValue("color", GlColor(config.font.color[0], config.font.color[1], config.font.color[2], config.font.color[3]));
settings.endGroup();
settings.beginGroup("gammaCorrection");
settings.setValue("force", config.gammaCorrection.force);
settings.setValue("level", config.gammaCorrection.level);
settings.endGroup();
settings.beginGroup("onScreenDisplay");
settings.setValue("showFPS", config.onScreenDisplay.fps);
settings.setValue("showVIS", config.onScreenDisplay.vis);
settings.setValue("showPercent", config.onScreenDisplay.percent);
settings.setValue("showInternalResolution", config.onScreenDisplay.internalResolution);
settings.setValue("showRenderingResolution", config.onScreenDisplay.renderingResolution);
settings.setValue("osdPos", config.onScreenDisplay.pos);
settings.endGroup();
settings.beginGroup("debug");
settings.setValue("dumpMode", config.debug.dumpMode);
settings.endGroup();
settings.endGroup();
}
}
static
std::string _getRomName(const char * _strRomName)
{
std::string RomName;
enum { CP_SHIFT_JIS = 932 };
int utf16size = MultiByteToWideChar(CP_SHIFT_JIS, MB_ERR_INVALID_CHARS, _strRomName, -1, 0, 0);
if (utf16size != 0)
{
std::unique_ptr<wchar_t> pUTF16(new WCHAR[utf16size]);
if (MultiByteToWideChar(CP_SHIFT_JIS, 0, (LPCCH)_strRomName, -1, pUTF16.get(), utf16size) != 0)
{
std::wstring wsRomName(pUTF16.get(), utf16size);
std::transform(wsRomName.begin(), wsRomName.end(), wsRomName.begin(), (int(*)(int)) toupper);
std::string::size_type pos = wsRomName.find(L" ");
std::wstring replace = L"%20";
while (pos != std::string::npos)
{
wsRomName.replace(pos, 1, replace);
pos = wsRomName.find(L" ", pos + replace.length());
}
int utf8size = ::WideCharToMultiByte(CP_UTF8, 0, wsRomName.c_str(), -1, 0, 0, 0, 0);
if (utf8size != 0)
{
std::unique_ptr<char> pUTF8(new char[utf8size]);
if (::WideCharToMultiByte(CP_UTF8, 0, wsRomName.c_str(), -1, pUTF8.get(), utf8size, 0, 0) != 0)
{
RomName = std::string(pUTF8.get());
}
}
}
}
return RomName;
}
void loadCustomRomSettings(const char * _strIniFolder, const char * _strRomName)
{
std::string CustomIniFileName = _strIniFolder;
CustomIniFileName += "/";
CustomIniFileName += strCustomSettingsFileName;
GlSettings settings(CustomIniFileName.c_str());
GlSettings::sections childGroups = settings.childGroups();
const std::string romName = _getRomName(_strRomName);
if (childGroups.find(romName.c_str()) == childGroups.end())
return;
settings.beginGroup(romName.c_str());
_loadSettings(settings);
settings.endGroup();
config.version = CONFIG_VERSION_CURRENT;
}
void saveCustomRomSettings(const char * _strIniFolder, const char * _strRomName)
{
Config origConfig;
origConfig.resetToDefaults();
std::swap(config, origConfig);
loadSettings(_strIniFolder);
std::swap(config, origConfig);
std::string CustomIniFileName = _strIniFolder;
CustomIniFileName += "/";
CustomIniFileName += strCustomSettingsFileName;
GlSettings settings(CustomIniFileName.c_str());
const std::string romName = _getRomName(_strRomName);
#define WriteCustomSetting(G, S) \
if (origConfig.G.S != config.G.S || \
origConfig.G.S != settings.value(#S, config.G.S).toInt()) \
settings.setValue(#S, config.G.S)
#define WriteCustomSetting2(G, N, S) \
if (origConfig.G.S != config.G.S || \
origConfig.G.S != settings.value(#N, config.G.S).toInt()) \
settings.setValue(#N, config.G.S)
#define WriteCustomSettingF(G, S) \
if (origConfig.G.S != config.G.S || \
origConfig.G.S != settings.value(#S, config.G.S).toFloat()) \
settings.setValue(#S, config.G.S)
#define WriteCustomSettingS(S) \
const std::string new##S = FromUTF16(config.textureFilter.txPath); \
const std::string orig##S = FromUTF16(origConfig.textureFilter.txPath); \
if (orig##S != new##S || \
orig##S != settings.value(#S, new##S.c_str()).toString()) \
settings.setValue(#S, new##S.c_str())
settings.beginGroup(romName.c_str());
settings.beginGroup("video");
WriteCustomSetting(video, fullscreenWidth);
WriteCustomSetting(video, fullscreenHeight);
WriteCustomSetting(video, windowedWidth);
WriteCustomSetting(video, windowedHeight);
WriteCustomSetting(video, fullscreenRefresh);
WriteCustomSetting(video, multisampling);
WriteCustomSetting(video, fxaa);
WriteCustomSetting(video, verticalSync);
settings.endGroup();
settings.beginGroup("texture");
WriteCustomSetting(texture, maxAnisotropy);
WriteCustomSetting(texture, bilinearMode);
WriteCustomSetting(texture, enableHalosRemoval);
WriteCustomSetting(texture, screenShotFormat);
settings.endGroup();
settings.beginGroup("generalEmulation");
WriteCustomSetting(generalEmulation, enableNoise);
WriteCustomSetting(generalEmulation, enableLOD);
WriteCustomSetting(generalEmulation, enableHWLighting);
WriteCustomSetting(generalEmulation, enableShadersStorage);
settings.endGroup();
settings.beginGroup("graphics2D");
WriteCustomSetting(graphics2D, correctTexrectCoords);
WriteCustomSetting(graphics2D, enableNativeResTexrects);
WriteCustomSetting(graphics2D, bgMode);
settings.endGroup();
settings.beginGroup("frameBufferEmulation");
WriteCustomSetting(frameBufferEmulation, enable);
WriteCustomSetting(frameBufferEmulation, aspect);
WriteCustomSetting(frameBufferEmulation, nativeResFactor);
WriteCustomSetting(frameBufferEmulation, bufferSwapMode);
WriteCustomSetting(frameBufferEmulation, N64DepthCompare);
WriteCustomSetting(frameBufferEmulation, forceDepthBufferClear);
WriteCustomSetting(frameBufferEmulation, copyAuxToRDRAM);
WriteCustomSetting(frameBufferEmulation, copyFromRDRAM);
WriteCustomSetting(frameBufferEmulation, copyToRDRAM);
WriteCustomSetting(frameBufferEmulation, copyDepthToRDRAM);
WriteCustomSetting(frameBufferEmulation, fbInfoDisabled);
WriteCustomSetting(frameBufferEmulation, fbInfoReadColorChunk);
WriteCustomSetting(frameBufferEmulation, fbInfoReadDepthChunk);
WriteCustomSetting(frameBufferEmulation, copyDepthToMainDepthBuffer);
WriteCustomSetting(frameBufferEmulation, enableOverscan);
WriteCustomSetting2(frameBufferEmulation, overscanPalLeft, overscanPAL.left);
WriteCustomSetting2(frameBufferEmulation, overscanPalRight, overscanPAL.right);
WriteCustomSetting2(frameBufferEmulation, overscanPalTop, overscanPAL.top);
WriteCustomSetting2(frameBufferEmulation, overscanPalBottom, overscanPAL.bottom);
WriteCustomSetting2(frameBufferEmulation, overscanNtscLeft, overscanNTSC.left);
WriteCustomSetting2(frameBufferEmulation, overscanNtscRight, overscanNTSC.right);
WriteCustomSetting2(frameBufferEmulation, overscanNtscTop, overscanNTSC.top);
WriteCustomSetting2(frameBufferEmulation, overscanNtscBottom, overscanNTSC.bottom);
settings.endGroup();
settings.beginGroup("textureFilter");
WriteCustomSetting(textureFilter, txFilterMode);
WriteCustomSetting(textureFilter, txEnhancementMode);
WriteCustomSetting(textureFilter, txDeposterize);
WriteCustomSetting(textureFilter, txFilterIgnoreBG);
WriteCustomSetting(textureFilter, txCacheSize);
WriteCustomSetting(textureFilter, txEnhancedTextureFileStorage);
WriteCustomSetting(textureFilter, txHiresTextureFileStorage);
WriteCustomSetting(textureFilter, txHiresEnable);
WriteCustomSetting(textureFilter, txHiresFullAlphaChannel);
WriteCustomSetting(textureFilter, txHresAltCRC);
WriteCustomSetting(textureFilter, txDump);
WriteCustomSetting(textureFilter, txForce16bpp);
WriteCustomSetting(textureFilter, txCacheCompression);
WriteCustomSetting(textureFilter, txSaveCache);
WriteCustomSettingS(txPath);
WriteCustomSettingS(txCachePath);
WriteCustomSettingS(txDumpPath);
settings.endGroup();
settings.beginGroup("gammaCorrection");
WriteCustomSetting(gammaCorrection, force);
WriteCustomSettingF(gammaCorrection, level);
settings.endGroup();
settings.beginGroup("onScreenDisplay");
WriteCustomSetting2(onScreenDisplay, showFPS, fps);
WriteCustomSetting2(onScreenDisplay, showVIS, vis);
WriteCustomSetting2(onScreenDisplay, showPercent, percent);
WriteCustomSetting2(onScreenDisplay, showInternalResolution, internalResolution);
WriteCustomSetting2(onScreenDisplay, showRenderingResolution, renderingResolution);
WriteCustomSetting2(onScreenDisplay, osdPos, pos);
settings.endGroup();
settings.endGroup();
}
std::string getTranslationFile()
{
return config.translationFile.c_str();
}
ProfileList getProfiles(const char * _strIniFolder)
{
std::string IniFileName = _strIniFolder;
IniFileName += "/";
IniFileName += strIniFileName;
GlSettings settings(IniFileName.c_str());
GlSettings::sections children = settings.childGroups();
ProfileList profiles;
for (GlSettings::sections::const_iterator itr = children.begin(); itr != children.end(); itr++)
{
profiles.insert(itr->c_str());
}
return profiles;
}
std::string getCurrentProfile(const char * _strIniFolder)
{
std::string IniFileName = _strIniFolder;
IniFileName += "/";
IniFileName += strIniFileName;
GlSettings settings(IniFileName.c_str());
return settings.value("profile", strUserProfile).toString();
}
void changeProfile(const char * _strIniFolder, const char * _strProfile)
{
{
std::string IniFileName = _strIniFolder;
IniFileName += "/";
IniFileName += strIniFileName;
GlSettings settings(IniFileName.c_str());
settings.setValue("profile", _strProfile);
}
loadSettings(_strIniFolder);
}
void addProfile(const char * _strIniFolder, const char * _strProfile)
{
{
std::string IniFileName = _strIniFolder;
IniFileName += "/";
IniFileName += strIniFileName;
GlSettings settings(IniFileName.c_str());
settings.setValue("profile", _strProfile);
}
writeSettings(_strIniFolder);
}
void removeProfile(const char * _strIniFolder, const char * _strProfile)
{
std::string IniFileName = _strIniFolder;
IniFileName += "/";
IniFileName += strIniFileName;
GlSettings settings(IniFileName.c_str());
settings.remove(_strProfile);
}

View File

@ -0,0 +1,15 @@
#pragma once
#include <string>
#include <set>
typedef std::set<std::string> ProfileList;
void loadSettings(const char * _strIniFolder);
void writeSettings(const char * _strIniFolder);
void loadCustomRomSettings(const char * _strIniFolder, const char * _strRomName);
void saveCustomRomSettings(const char * _strIniFolder, const char * _strRomName);
std::string getTranslationFile();
ProfileList getProfiles(const char * _strIniFolder);
std::string getCurrentProfile(const char * _strIniFolder);
void changeProfile(const char * _strIniFolder, const char * _strProfile);
void addProfile(const char * _strIniFolder, const char * _strProfile);
void removeProfile(const char * _strIniFolder, const char * _strProfile);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
src/GLideNUI-wtl/Up.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,685 @@
// Windows Template Library - WTL version 8.1
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// This file is a part of the Windows Template Library.
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
// which can be found in the file CPL.TXT at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by
// the terms of this license. You must not remove this notice, or
// any other, from this software.
#ifndef __ATLDDX_H__
#define __ATLDDX_H__
#pragma once
#ifndef __ATLAPP_H__
#error atlddx.h requires atlapp.h to be included first
#endif
#if defined(_ATL_USE_DDX_FLOAT) && defined(_ATL_MIN_CRT)
#error Cannot use floating point DDX with _ATL_MIN_CRT defined
#endif // defined(_ATL_USE_DDX_FLOAT) && defined(_ATL_MIN_CRT)
#ifdef _ATL_USE_DDX_FLOAT
#include <float.h>
#endif // _ATL_USE_DDX_FLOAT
///////////////////////////////////////////////////////////////////////////////
// Classes in this file:
//
// CWinDataExchange<T>
namespace WTL
{
// Constants
#define DDX_LOAD FALSE
#define DDX_SAVE TRUE
// DDX map macros
#define BEGIN_DDX_MAP(thisClass) \
BOOL DoDataExchange(BOOL bSaveAndValidate = FALSE, UINT nCtlID = (UINT)-1) \
{ \
bSaveAndValidate; \
nCtlID;
#define DDX_TEXT(nID, var) \
if(nCtlID == (UINT)-1 || nCtlID == nID) \
{ \
if(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate)) \
return FALSE; \
}
#define DDX_TEXT_LEN(nID, var, len) \
if(nCtlID == (UINT)-1 || nCtlID == nID) \
{ \
if(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate, TRUE, len)) \
return FALSE; \
}
#define DDX_INT(nID, var) \
if(nCtlID == (UINT)-1 || nCtlID == nID) \
{ \
if(!DDX_Int(nID, var, TRUE, bSaveAndValidate)) \
return FALSE; \
}
#define DDX_INT_RANGE(nID, var, min, max) \
if(nCtlID == (UINT)-1 || nCtlID == nID) \
{ \
if(!DDX_Int(nID, var, TRUE, bSaveAndValidate, TRUE, min, max)) \
return FALSE; \
}
#define DDX_UINT(nID, var) \
if(nCtlID == (UINT)-1 || nCtlID == nID) \
{ \
if(!DDX_Int(nID, var, FALSE, bSaveAndValidate)) \
return FALSE; \
}
#define DDX_UINT_RANGE(nID, var, min, max) \
if(nCtlID == (UINT)-1 || nCtlID == nID) \
{ \
if(!DDX_Int(nID, var, FALSE, bSaveAndValidate, TRUE, min, max)) \
return FALSE; \
}
#ifdef _ATL_USE_DDX_FLOAT
#define DDX_FLOAT(nID, var) \
if(nCtlID == (UINT)-1 || nCtlID == nID) \
{ \
if(!DDX_Float(nID, var, bSaveAndValidate)) \
return FALSE; \
}
#define DDX_FLOAT_RANGE(nID, var, min, max) \
if(nCtlID == (UINT)-1 || nCtlID == nID) \
{ \
if(!DDX_Float(nID, var, bSaveAndValidate, TRUE, min, max)) \
return FALSE; \
}
#define DDX_FLOAT_P(nID, var, precision) \
if(nCtlID == (UINT)-1 || nCtlID == nID) \
{ \
if(!DDX_Float(nID, var, bSaveAndValidate, FALSE, 0, 0, precision)) \
return FALSE; \
}
#define DDX_FLOAT_P_RANGE(nID, var, min, max, precision) \
if(nCtlID == (UINT)-1 || nCtlID == nID) \
{ \
if(!DDX_Float(nID, var, bSaveAndValidate, TRUE, min, max, precision)) \
return FALSE; \
}
#endif // _ATL_USE_DDX_FLOAT
#define DDX_CONTROL(nID, obj) \
if(nCtlID == (UINT)-1 || nCtlID == nID) \
DDX_Control(nID, obj, bSaveAndValidate);
#define DDX_CONTROL_HANDLE(nID, obj) \
if(nCtlID == (UINT)-1 || nCtlID == nID) \
DDX_Control_Handle(nID, obj, bSaveAndValidate);
#define DDX_CHECK(nID, var) \
if(nCtlID == (UINT)-1 || nCtlID == nID) \
DDX_Check(nID, var, bSaveAndValidate);
#define DDX_RADIO(nID, var) \
if(nCtlID == (UINT)-1 || nCtlID == nID) \
DDX_Radio(nID, var, bSaveAndValidate);
#define END_DDX_MAP() \
return TRUE; \
}
// DDX support for Tab, Combo, ListBox and ListView selection index
// Note: Specialized versions require atlctrls.h to be included first
#if (_MSC_VER >= 1300)
#define DDX_INDEX(CtrlClass, nID, var) \
if(nCtlID == (UINT)-1 || nCtlID == nID) \
DDX_Index<CtrlClass>(nID, var, bSaveAndValidate);
#ifdef __ATLCTRLS_H__
#define DDX_TAB_INDEX(nID, var) DDX_INDEX(WTL::CTabCtrl, nID, var)
#define DDX_COMBO_INDEX(nID, var) DDX_INDEX(WTL::CComboBox, nID, var)
#define DDX_LISTBOX_INDEX(nID, var) DDX_INDEX(WTL::CListBox, nID, var)
#define DDX_LISTVIEW_INDEX(nID, var) DDX_INDEX(WTL::CListViewCtrl, nID, var)
#endif // __ATLCTRLS_H__
#endif // (_MSC_VER >= 1300)
///////////////////////////////////////////////////////////////////////////////
// CWinDataExchange - provides support for DDX
template <class T>
class CWinDataExchange
{
public:
// Data exchange method - override in your derived class
BOOL DoDataExchange(BOOL /*bSaveAndValidate*/ = FALSE, UINT /*nCtlID*/ = (UINT)-1)
{
// this one should never be called, override it in
// your derived class by implementing DDX map
ATLASSERT(FALSE);
return FALSE;
}
// Helpers for validation error reporting
enum _XDataType
{
ddxDataNull = 0,
ddxDataText = 1,
ddxDataInt = 2,
ddxDataFloat = 3,
ddxDataDouble = 4
};
struct _XTextData
{
int nLength;
int nMaxLength;
};
struct _XIntData
{
long nVal;
long nMin;
long nMax;
};
struct _XFloatData
{
double nVal;
double nMin;
double nMax;
};
struct _XData
{
_XDataType nDataType;
union
{
_XTextData textData;
_XIntData intData;
_XFloatData floatData;
};
};
// Text exchange
BOOL DDX_Text(UINT nID, LPTSTR lpstrText, int cbSize, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0)
{
T* pT = static_cast<T*>(this);
BOOL bSuccess = TRUE;
if(bSave)
{
HWND hWndCtrl = pT->GetDlgItem(nID);
int nRetLen = ::GetWindowText(hWndCtrl, lpstrText, cbSize / sizeof(TCHAR));
if(nRetLen < ::GetWindowTextLength(hWndCtrl))
bSuccess = FALSE;
}
else
{
ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength);
bSuccess = pT->SetDlgItemText(nID, lpstrText);
}
if(!bSuccess)
{
pT->OnDataExchangeError(nID, bSave);
}
else if(bSave && bValidate) // validation
{
ATLASSERT(nLength > 0);
if(lstrlen(lpstrText) > nLength)
{
_XData data = { ddxDataText };
data.textData.nLength = lstrlen(lpstrText);
data.textData.nMaxLength = nLength;
pT->OnDataValidateError(nID, bSave, data);
bSuccess = FALSE;
}
}
return bSuccess;
}
BOOL DDX_Text(UINT nID, BSTR& bstrText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0)
{
T* pT = static_cast<T*>(this);
BOOL bSuccess = TRUE;
if(bSave)
{
bSuccess = pT->GetDlgItemText(nID, bstrText);
}
else
{
USES_CONVERSION;
LPTSTR lpstrText = OLE2T(bstrText);
ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength);
bSuccess = pT->SetDlgItemText(nID, lpstrText);
}
if(!bSuccess)
{
pT->OnDataExchangeError(nID, bSave);
}
else if(bSave && bValidate) // validation
{
ATLASSERT(nLength > 0);
if((int)::SysStringLen(bstrText) > nLength)
{
_XData data = { ddxDataText };
data.textData.nLength = (int)::SysStringLen(bstrText);
data.textData.nMaxLength = nLength;
pT->OnDataValidateError(nID, bSave, data);
bSuccess = FALSE;
}
}
return bSuccess;
}
BOOL DDX_Text(UINT nID, ATL::CComBSTR& bstrText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0)
{
T* pT = static_cast<T*>(this);
BOOL bSuccess = TRUE;
if(bSave)
{
bSuccess = pT->GetDlgItemText(nID, (BSTR&)bstrText);
}
else
{
USES_CONVERSION;
LPTSTR lpstrText = OLE2T(bstrText);
ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength);
bSuccess = pT->SetDlgItemText(nID, lpstrText);
}
if(!bSuccess)
{
pT->OnDataExchangeError(nID, bSave);
}
else if(bSave && bValidate) // validation
{
ATLASSERT(nLength > 0);
if((int)bstrText.Length() > nLength)
{
_XData data = { ddxDataText };
data.textData.nLength = (int)bstrText.Length();
data.textData.nMaxLength = nLength;
pT->OnDataValidateError(nID, bSave, data);
bSuccess = FALSE;
}
}
return bSuccess;
}
#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
BOOL DDX_Text(UINT nID, _CSTRING_NS::CString& strText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0)
{
T* pT = static_cast<T*>(this);
BOOL bSuccess = TRUE;
if(bSave)
{
HWND hWndCtrl = pT->GetDlgItem(nID);
int nLen = ::GetWindowTextLength(hWndCtrl);
int nRetLen = -1;
LPTSTR lpstr = strText.GetBufferSetLength(nLen);
if(lpstr != NULL)
{
nRetLen = ::GetWindowText(hWndCtrl, lpstr, nLen + 1);
strText.ReleaseBuffer();
}
if(nRetLen < nLen)
bSuccess = FALSE;
}
else
{
bSuccess = pT->SetDlgItemText(nID, strText);
}
if(!bSuccess)
{
pT->OnDataExchangeError(nID, bSave);
}
else if(bSave && bValidate) // validation
{
ATLASSERT(nLength > 0);
if(strText.GetLength() > nLength)
{
_XData data = { ddxDataText };
data.textData.nLength = strText.GetLength();
data.textData.nMaxLength = nLength;
pT->OnDataValidateError(nID, bSave, data);
bSuccess = FALSE;
}
}
return bSuccess;
}
#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
// Numeric exchange
template <class Type>
BOOL DDX_Int(UINT nID, Type& nVal, BOOL bSigned, BOOL bSave, BOOL bValidate = FALSE, Type nMin = 0, Type nMax = 0)
{
T* pT = static_cast<T*>(this);
BOOL bSuccess = TRUE;
if(bSave)
{
nVal = (Type)pT->GetDlgItemInt(nID, &bSuccess, bSigned);
}
else
{
ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax);
bSuccess = pT->SetDlgItemInt(nID, nVal, bSigned);
}
if(!bSuccess)
{
pT->OnDataExchangeError(nID, bSave);
}
else if(bSave && bValidate) // validation
{
ATLASSERT(nMin != nMax);
if(nVal < nMin || nVal > nMax)
{
_XData data = { ddxDataInt };
data.intData.nVal = (long)nVal;
data.intData.nMin = (long)nMin;
data.intData.nMax = (long)nMax;
pT->OnDataValidateError(nID, bSave, data);
bSuccess = FALSE;
}
}
return bSuccess;
}
// Float exchange
#ifdef _ATL_USE_DDX_FLOAT
static BOOL _AtlSimpleFloatParse(LPCTSTR lpszText, double& d)
{
ATLASSERT(lpszText != NULL);
while (*lpszText == _T(' ') || *lpszText == _T('\t'))
lpszText++;
TCHAR chFirst = lpszText[0];
d = _tcstod(lpszText, (LPTSTR*)&lpszText);
if (d == 0.0 && chFirst != _T('0'))
return FALSE; // could not convert
while (*lpszText == _T(' ') || *lpszText == _T('\t'))
lpszText++;
if (*lpszText != _T('\0'))
return FALSE; // not terminated properly
return TRUE;
}
BOOL DDX_Float(UINT nID, float& nVal, BOOL bSave, BOOL bValidate = FALSE, float nMin = 0.F, float nMax = 0.F, int nPrecision = FLT_DIG)
{
T* pT = static_cast<T*>(this);
BOOL bSuccess = TRUE;
const int cchBuff = 32;
TCHAR szBuff[cchBuff] = { 0 };
if(bSave)
{
pT->GetDlgItemText(nID, szBuff, cchBuff);
double d = 0;
if(_AtlSimpleFloatParse(szBuff, d))
nVal = (float)d;
else
bSuccess = FALSE;
}
else
{
ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax);
SecureHelper::sprintf_x(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal);
bSuccess = pT->SetDlgItemText(nID, szBuff);
}
if(!bSuccess)
{
pT->OnDataExchangeError(nID, bSave);
}
else if(bSave && bValidate) // validation
{
ATLASSERT(nMin != nMax);
if(nVal < nMin || nVal > nMax)
{
_XData data = { ddxDataFloat };
data.floatData.nVal = (double)nVal;
data.floatData.nMin = (double)nMin;
data.floatData.nMax = (double)nMax;
pT->OnDataValidateError(nID, bSave, data);
bSuccess = FALSE;
}
}
return bSuccess;
}
BOOL DDX_Float(UINT nID, double& nVal, BOOL bSave, BOOL bValidate = FALSE, double nMin = 0., double nMax = 0., int nPrecision = DBL_DIG)
{
T* pT = static_cast<T*>(this);
BOOL bSuccess = TRUE;
const int cchBuff = 32;
TCHAR szBuff[cchBuff] = { 0 };
if(bSave)
{
pT->GetDlgItemText(nID, szBuff, cchBuff);
double d = 0;
if(_AtlSimpleFloatParse(szBuff, d))
nVal = d;
else
bSuccess = FALSE;
}
else
{
ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax);
SecureHelper::sprintf_x(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal);
bSuccess = pT->SetDlgItemText(nID, szBuff);
}
if(!bSuccess)
{
pT->OnDataExchangeError(nID, bSave);
}
else if(bSave && bValidate) // validation
{
ATLASSERT(nMin != nMax);
if(nVal < nMin || nVal > nMax)
{
_XData data = { ddxDataFloat };
data.floatData.nVal = nVal;
data.floatData.nMin = nMin;
data.floatData.nMax = nMax;
pT->OnDataValidateError(nID, bSave, data);
bSuccess = FALSE;
}
}
return bSuccess;
}
#endif // _ATL_USE_DDX_FLOAT
// Full control subclassing (for CWindowImpl derived controls)
template <class TControl>
void DDX_Control(UINT nID, TControl& ctrl, BOOL bSave)
{
if(!bSave && ctrl.m_hWnd == NULL)
{
T* pT = static_cast<T*>(this);
ctrl.SubclassWindow(pT->GetDlgItem(nID));
}
}
// Simple control attaching (for HWND wrapper controls)
template <class TControl>
void DDX_Control_Handle(UINT nID, TControl& ctrl, BOOL bSave)
{
if(!bSave && ctrl.m_hWnd == NULL)
{
T* pT = static_cast<T*>(this);
ctrl = pT->GetDlgItem(nID);
}
}
// Control state
void DDX_Check(UINT nID, int& nValue, BOOL bSave)
{
T* pT = static_cast<T*>(this);
HWND hWndCtrl = pT->GetDlgItem(nID);
if(bSave)
{
nValue = (int)::SendMessage(hWndCtrl, BM_GETCHECK, 0, 0L);
ATLASSERT(nValue >= 0 && nValue <= 2);
}
else
{
if(nValue < 0 || nValue > 2)
{
ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - dialog data checkbox value (%d) out of range.\n"), nValue);
nValue = 0; // default to off
}
::SendMessage(hWndCtrl, BM_SETCHECK, nValue, 0L);
}
}
// variant that supports bool (checked/not-checked, no intermediate state)
void DDX_Check(UINT nID, bool& bCheck, BOOL bSave)
{
int nValue = bCheck ? 1 : 0;
DDX_Check(nID, nValue, bSave);
if(bSave)
{
if(nValue == 2)
ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - checkbox state (%d) out of supported range.\n"), nValue);
bCheck = (nValue == 1);
}
}
void DDX_Radio(UINT nID, int& nValue, BOOL bSave)
{
T* pT = static_cast<T*>(this);
HWND hWndCtrl = pT->GetDlgItem(nID);
ATLASSERT(hWndCtrl != NULL);
// must be first in a group of auto radio buttons
ATLASSERT(::GetWindowLong(hWndCtrl, GWL_STYLE) & WS_GROUP);
ATLASSERT(::SendMessage(hWndCtrl, WM_GETDLGCODE, 0, 0L) & DLGC_RADIOBUTTON);
if(bSave)
nValue = -1; // value if none found
// walk all children in group
int nButton = 0;
do
{
if(::SendMessage(hWndCtrl, WM_GETDLGCODE, 0, 0L) & DLGC_RADIOBUTTON)
{
// control in group is a radio button
if(bSave)
{
if(::SendMessage(hWndCtrl, BM_GETCHECK, 0, 0L) != 0)
{
ATLASSERT(nValue == -1); // only set once
nValue = nButton;
}
}
else
{
// select button
::SendMessage(hWndCtrl, BM_SETCHECK, (nButton == nValue), 0L);
}
nButton++;
}
else
{
ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - skipping non-radio button in group.\n"));
}
hWndCtrl = ::GetWindow(hWndCtrl, GW_HWNDNEXT);
}
while (hWndCtrl != NULL && !(GetWindowLong(hWndCtrl, GWL_STYLE) & WS_GROUP));
}
// DDX support for Tab, Combo, ListBox and ListView selection index
#if (_MSC_VER >= 1300)
template <class TCtrl>
INT _getSel(TCtrl& tCtrl)
{
return tCtrl.GetCurSel();
}
template <class TCtrl>
void _setSel(TCtrl& tCtrl, INT iSel)
{
if(iSel < 0)
tCtrl.SetCurSel(-1);
else
tCtrl.SetCurSel(iSel);
}
#ifdef __ATLCTRLS_H__
// ListViewCtrl specialization
template <>
INT _getSel(WTL::CListViewCtrl& tCtrl)
{
return tCtrl.GetSelectedIndex();
}
template <>
void _setSel(WTL::CListViewCtrl& tCtrl, INT iSel)
{
if(iSel < 0)
tCtrl.SelectItem(-1);
else
tCtrl.SelectItem(iSel);
}
#endif // __ATLCTRLS_H__
template <class TCtrl>
void DDX_Index(UINT nID, INT& nVal, BOOL bSave)
{
T* pT = static_cast<T*>(this);
TCtrl ctrl(pT->GetDlgItem(nID));
if(bSave)
nVal = _getSel(ctrl);
else
_setSel(ctrl, nVal);
}
#endif // (_MSC_VER >= 1300)
// Overrideables
void OnDataExchangeError(UINT nCtrlID, BOOL /*bSave*/)
{
// Override to display an error message
::MessageBeep((UINT)-1);
T* pT = static_cast<T*>(this);
::SetFocus(pT->GetDlgItem(nCtrlID));
}
void OnDataValidateError(UINT nCtrlID, BOOL /*bSave*/, _XData& /*data*/)
{
// Override to display an error message
::MessageBeep((UINT)-1);
T* pT = static_cast<T*>(this);
::SetFocus(pT->GetDlgItem(nCtrlID));
}
};
}; // namespace WTL
#endif // __ATLDDX_H__

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,461 @@
// Windows Template Library - WTL version 8.1
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// This file is a part of the Windows Template Library.
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
// which can be found in the file CPL.TXT at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by
// the terms of this license. You must not remove this notice, or
// any other, from this software.
#ifndef __ATLDWM_H__
#define __ATLDWM_H__
#pragma once
#ifdef _WIN32_WCE
#error atldwm.h is not supported on Windows CE
#endif
#ifndef __ATLAPP_H__
#error atldwm.h requires atlapp.h to be included first
#endif
#ifndef __ATLWIN_H__
#error atldwm.h requires atlwin.h to be included first
#endif
#if (_WIN32_WINNT < 0x0600)
#error atldwm.h requires _WIN32_WINNT >= 0x0600
#endif // (_WIN32_WINNT < 0x0600)
#ifndef _DWMAPI_H_
#include <dwmapi.h>
#endif // _DWMAPI_H_
#pragma comment(lib, "dwmapi.lib")
// Note: To create an application that also runs on older versions of Windows,
// use delay load of dwmapi.dll and ensure that no calls to the DWM API are
// Delay load is NOT AUTOMATIC for VC++ 7, you have to link to delayimp.lib,
// and add dwmapi.dll in the Linker.Input.Delay Loaded DLLs section of the
// project properties.
#if (_MSC_VER < 1300) && !defined(_WTL_NO_DWMAPI_DELAYLOAD)
#pragma comment(lib, "delayimp.lib")
#pragma comment(linker, "/delayload:dwmapi.dll")
#endif // (_MSC_VER < 1300) && !defined(_WTL_NO_DWMAPI_DELAYLOAD)
///////////////////////////////////////////////////////////////////////////////
// Classes in this file:
//
// CDwm
// CDwmImpl<T, TBase>
// CDwmWindowT<TBase> - CDwmWindow
// CDwmThumbnailT<t_bManaged, TBase>
// CDwmThumbnail
// CDwmThumbnailHandle
// CAeroControlImpl
namespace WTL
{
///////////////////////////////////////////////////////////////////////////////
// CDwm - wrapper for DWM handle
class CDwm
{
public:
// Data members
static int m_nIsDwmSupported;
// Constructor
CDwm()
{
IsDwmSupported();
}
// Dwm support helper
static bool IsDwmSupported()
{
if(m_nIsDwmSupported == -1)
{
CStaticDataInitCriticalSectionLock lock;
if(FAILED(lock.Lock()))
{
ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CDwm::IsDwmSupported.\n"));
ATLASSERT(FALSE);
return false;
}
if(m_nIsDwmSupported == -1)
{
HMODULE hDwmDLL = ::LoadLibrary(_T("dwmapi.dll"));
m_nIsDwmSupported = (hDwmDLL != NULL) ? 1 : 0;
if(hDwmDLL != NULL)
::FreeLibrary(hDwmDLL);
}
lock.Unlock();
}
ATLASSERT(m_nIsDwmSupported != -1);
return (m_nIsDwmSupported == 1);
}
// Operations
BOOL DwmIsCompositionEnabled() const
{
if(!IsDwmSupported()) return FALSE;
BOOL bRes = FALSE;
return SUCCEEDED(::DwmIsCompositionEnabled(&bRes)) && bRes;
}
BOOL DwmEnableComposition(UINT fEnable)
{
if(!IsDwmSupported()) return FALSE;
return SUCCEEDED(::DwmEnableComposition(fEnable));
}
BOOL DwmEnableMMCSS(BOOL fEnableMMCSS)
{
if(!IsDwmSupported()) return FALSE;
return SUCCEEDED(::DwmEnableMMCSS(fEnableMMCSS));
}
HRESULT DwmGetColorizationColor(DWORD* pcrColorization, BOOL* pfOpaqueBlend)
{
if(!IsDwmSupported()) return E_NOTIMPL;
return ::DwmGetColorizationColor(pcrColorization, pfOpaqueBlend);
}
HRESULT DwmFlush()
{
if(!IsDwmSupported()) return E_NOTIMPL;
return ::DwmFlush();
}
};
__declspec(selectany) int CDwm::m_nIsDwmSupported = -1;
///////////////////////////////////////////////////////////////////////////////
// CDwmImpl - DWM window support
template <class T, class TBase = CDwm>
class CDwmImpl : public TBase
{
public:
HRESULT DwmEnableBlurBehindWindow(const DWM_BLURBEHIND* pBB)
{
if(!IsDwmSupported()) return E_NOTIMPL;
T* pT = static_cast<T*>(this);
ATLASSERT(::IsWindow(pT->m_hWnd));
return ::DwmEnableBlurBehindWindow(pT->m_hWnd, pBB);
}
HRESULT DwmExtendFrameIntoClientArea(const MARGINS* pMargins)
{
if(!IsDwmSupported()) return E_NOTIMPL;
T* pT = static_cast<T*>(this);
ATLASSERT(::IsWindow(pT->m_hWnd));
return ::DwmExtendFrameIntoClientArea(pT->m_hWnd, pMargins);
}
HRESULT DwmExtendFrameIntoEntireClientArea()
{
MARGINS margins = { -1 };
return DwmExtendFrameIntoClientArea(&margins);
}
HRESULT DwmGetCompositionTimingInfo(DWM_TIMING_INFO* pTimingInfo)
{
if(!IsDwmSupported()) return E_NOTIMPL;
T* pT = static_cast<T*>(this);
ATLASSERT(::IsWindow(pT->m_hWnd));
return ::DwmGetCompositionTimingInfo(pT->m_hWnd, pTimingInfo);
}
HRESULT DwmGetWindowAttribute(DWORD dwAttribute, PVOID pvAttribute, DWORD cbAttribute)
{
if(!IsDwmSupported()) return E_NOTIMPL;
T* pT = static_cast<T*>(this);
ATLASSERT(::IsWindow(pT->m_hWnd));
return ::DwmGetWindowAttribute(pT->m_hWnd, dwAttribute, pvAttribute, cbAttribute);
}
HRESULT DwmModifyPreviousDxFrameDuration(INT cRefreshes, BOOL fRelative)
{
if(!IsDwmSupported()) return E_NOTIMPL;
T* pT = static_cast<T*>(this);
ATLASSERT(::IsWindow(pT->m_hWnd));
return ::DwmModifyPreviousDxFrameDuration(pT->m_hWnd, cRefreshes, fRelative);
}
HRESULT DwmSetDxFrameDuration(INT cRefreshes)
{
if(!IsDwmSupported()) return E_NOTIMPL;
T* pT = static_cast<T*>(this);
ATLASSERT(::IsWindow(pT->m_hWnd));
return ::DwmSetDxFrameDuration(pT->m_hWnd, cRefreshes);
}
HRESULT DwmSetPresentParameters(DWM_PRESENT_PARAMETERS* pPresentParams)
{
if(!IsDwmSupported()) return E_NOTIMPL;
T* pT = static_cast<T*>(this);
ATLASSERT(::IsWindow(pT->m_hWnd));
return ::DwmSetPresentParameters(pT->m_hWnd, pPresentParams);
}
HRESULT DwmSetWindowAttribute(DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute)
{
if(!IsDwmSupported()) return E_NOTIMPL;
T* pT = static_cast<T*>(this);
ATLASSERT(::IsWindow(pT->m_hWnd));
return ::DwmSetWindowAttribute(pT->m_hWnd, dwAttribute, pvAttribute, cbAttribute);
}
HRESULT DwmAttachMilContent()
{
if(!IsDwmSupported()) return E_NOTIMPL;
T* pT = static_cast<T*>(this);
ATLASSERT(::IsWindow(pT->m_hWnd));
return ::DwmAttachMilContent(pT->m_hWnd);
}
HRESULT DwmDetachMilContent()
{
if(!IsDwmSupported()) return E_NOTIMPL;
T* pT = static_cast<T*>(this);
ATLASSERT(::IsWindow(pT->m_hWnd));
return ::DwmDetachMilContent(pT->m_hWnd);
}
};
template <class TBase>
class CDwmWindowT : public TBase, public CDwmImpl<CDwmWindowT< TBase > >
{
public:
CDwmWindowT(HWND hWnd = NULL) : TBase(hWnd)
{ }
CDwmWindowT< TBase >& operator =(HWND hWnd)
{
m_hWnd = hWnd;
return *this;
}
};
typedef CDwmWindowT<ATL::CWindow> CDwmWindow;
///////////////////////////////////////////////////////////////////////////////
// CDwmThumbnail - provides DWM thumbnail support
template <bool t_bManaged, class TBase = CDwm>
class CDwmThumbnailT : public TBase
{
public:
// Data members
HTHUMBNAIL m_hThumbnail;
// Constructor
CDwmThumbnailT(HTHUMBNAIL hThumbnail = NULL) : m_hThumbnail(hThumbnail)
{
}
~CDwmThumbnailT()
{
if(t_bManaged && m_hThumbnail != NULL)
Unregister();
}
// Operations
CDwmThumbnailT<t_bManaged, TBase>& operator =(HTHUMBNAIL hThumbnail)
{
Attach(hThumbnail);
return *this;
}
void Attach(HTHUMBNAIL hThumbnailNew)
{
if(t_bManaged && m_hThumbnail != NULL && m_hThumbnail != hThumbnailNew)
Unregister();
m_hThumbnail = hThumbnailNew;
}
HTHUMBNAIL Detach()
{
HTHUMBNAIL hThumbnail = m_hThumbnail;
m_hThumbnail = NULL;
return hThumbnail;
}
HRESULT Register(HWND hwndDestination, HWND hwndSource)
{
ATLASSERT(::IsWindow(hwndDestination));
ATLASSERT(::IsWindow(hwndSource));
ATLASSERT(m_hThumbnail==NULL);
if(!IsDwmSupported()) return E_NOTIMPL;
return ::DwmRegisterThumbnail(hwndDestination, hwndSource, &m_hThumbnail);
}
HRESULT Unregister()
{
if(!IsDwmSupported()) return E_NOTIMPL;
if(m_hThumbnail == NULL) return S_FALSE;
HRESULT Hr = ::DwmUnregisterThumbnail(m_hThumbnail);
if(SUCCEEDED(Hr)) m_hThumbnail = NULL;
return Hr;
}
operator HTHUMBNAIL() const { return m_hThumbnail; }
bool IsNull() const { return (m_hThumbnail == NULL); }
HRESULT UpdateProperties(const DWM_THUMBNAIL_PROPERTIES* ptnProperties)
{
if(!IsDwmSupported()) return E_NOTIMPL;
ATLASSERT(m_hThumbnail != NULL);
return ::DwmUpdateThumbnailProperties(m_hThumbnail, ptnProperties);
}
// Attributes
HRESULT QuerySourceSize(PSIZE pSize)
{
if(!IsDwmSupported()) return E_NOTIMPL;
ATLASSERT(m_hThumbnail != NULL);
return ::DwmQueryThumbnailSourceSize(m_hThumbnail, pSize);
}
};
typedef CDwmThumbnailT<true, CDwm> CDwmThumbnail;
typedef CDwmThumbnailT<false, CDwm> CDwmThumbnailHandle;
#ifdef __ATLTHEME_H__
///////////////////////////////////////////////////////////////////////////////
// CAeroControlImpl - Base class for controls on Glass
template <class T, class TBase = ATL::CWindow, class TWinTraits = ATL::CControlWinTraits>
class CAeroControlImpl :
public CThemeImpl<T>,
public CBufferedPaintImpl<T>,
public ATL::CWindowImpl<T, TBase, TWinTraits>
{
public:
typedef CThemeImpl<T> _themeClass;
typedef CBufferedPaintImpl<T> _baseClass;
typedef ATL::CWindowImpl<T, TBase, TWinTraits> _windowClass;
CAeroControlImpl()
{
m_PaintParams.dwFlags = BPPF_ERASE;
}
static LPCWSTR GetThemeName()
{
#ifdef _UNICODE
return TBase::GetWndClassName();
#else
ATLASSERT(!_T("Return UNICODE string of window classname / theme class"));
return NULL;
#endif // _UNICODE
}
// Message map and handlers
BEGIN_MSG_MAP(CAeroControlImpl)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
CHAIN_MSG_MAP(_themeClass)
CHAIN_MSG_MAP(_baseClass)
END_MSG_MAP()
LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
T* pT = static_cast<T*>(this);
pT->Init();
bHandled = FALSE;
return 0;
}
LRESULT OnActivate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
if(IsThemingSupported()) Invalidate(FALSE);
bHandled = FALSE;
return 0;
}
// Operations
BOOL SubclassWindow(HWND hWnd)
{
ATLASSERT(m_hWnd == NULL);
ATLASSERT(::IsWindow(hWnd));
BOOL bRet = _windowClass::SubclassWindow(hWnd);
if(bRet) {
T* pT = static_cast<T*>(this);
pT->Init();
}
return bRet;
}
// Implementation
LRESULT DefWindowProc()
{
const _ATL_MSG* pMsg = m_pCurrentMsg;
LRESULT lRes = 0;
if(pMsg != NULL)
lRes = DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam);
return lRes;
}
LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
T* pT = static_cast<T*>(this);
LRESULT lRes = 0;
if( ::DwmDefWindowProc(pT->m_hWnd, uMsg, wParam, lParam, &lRes) ) return lRes;
return _windowClass::DefWindowProc(uMsg, wParam, lParam);
}
void DoBufferedPaint(HDC hDC, RECT& rcPaint)
{
T* pT = static_cast<T*>(this);
HDC hDCPaint = NULL;
RECT rcClient = { 0 };
GetClientRect(&rcClient);
m_BufferedPaint.Begin(hDC, &rcClient, m_dwFormat, &m_PaintParams, &hDCPaint);
ATLASSERT(hDCPaint != NULL);
pT->DoAeroPaint(hDCPaint, rcClient, rcPaint);
m_BufferedPaint.End();
}
void DoPaint(HDC /*hdc*/, RECT& /*rcClient*/)
{
DefWindowProc();
}
// Overridables
void Init()
{
T* pT = static_cast<T*>(this);
SetThemeClassList(pT->GetThemeName());
if(m_lpstrThemeClassList != NULL)
OpenThemeData();
}
void DoAeroPaint(HDC hDC, RECT& /*rcClient*/, RECT& rcPaint)
{
DefWindowProc(WM_PAINT, (WPARAM) hDC, 0L);
m_BufferedPaint.MakeOpaque(&rcPaint);
}
};
#endif // __ATLTHEME_H__
}; // namespace WTL
#endif // __ATLDWM_H__

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,263 @@
// Windows Template Library - WTL version 8.1
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// This file is a part of the Windows Template Library.
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
// which can be found in the file CPL.TXT at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by
// the terms of this license. You must not remove this notice, or
// any other, from this software.
#ifndef __ATLRES_H__
#define __ATLRES_H__
#pragma once
#if defined(_WIN32_WCE) && !defined(__ATLRESCE_H__)
#error Use atlresCE.h instead of atlres.h for Windows CE
#endif
#ifdef RC_INVOKED
#ifndef _INC_WINDOWS
#define _INC_WINDOWS
#ifndef _WIN32_WCE
#define VS_VERSION_INFO 1
#ifdef APSTUDIO_INVOKED
#define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols
#endif // APSTUDIO_INVOKED
#ifndef WINVER
#define WINVER 0x0400 // default to Windows Version 4.0
#endif // !WINVER
#include <winresrc.h>
// operation messages sent to DLGINIT
#define LB_ADDSTRING (WM_USER+1)
#define CB_ADDSTRING (WM_USER+3)
#endif // !_WIN32_WCE
#ifdef APSTUDIO_INVOKED
#undef APSTUDIO_HIDDEN_SYMBOLS
#endif // APSTUDIO_INVOKED
#ifdef IDC_STATIC
#undef IDC_STATIC
#endif // IDC_STATIC
#define IDC_STATIC (-1)
#endif // !_INC_WINDOWS
#endif // RC_INVOKED
#ifdef APSTUDIO_INVOKED
#define APSTUDIO_HIDDEN_SYMBOLS
#endif // APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////////
// ATL resource types
#ifndef RC_INVOKED
#define RT_DLGINIT MAKEINTRESOURCE(240)
#define RT_TOOLBAR MAKEINTRESOURCE(241)
#endif // RC_INVOKED
///////////////////////////////////////////////////////////////////////////////
#ifdef APSTUDIO_INVOKED
#undef APSTUDIO_HIDDEN_SYMBOLS
#endif // APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////////
// Standard window components
#define ID_SEPARATOR 0 // special separator value
#define ID_DEFAULT_PANE 0 // default status bar pane
#ifndef RC_INVOKED // code only
// standard control bars (IDW = window ID)
#define ATL_IDW_TOOLBAR 0xE800 // main Toolbar for window
#define ATL_IDW_STATUS_BAR 0xE801 // Status bar window
#define ATL_IDW_COMMAND_BAR 0xE802 // Command bar window
// parts of a frame window
#define ATL_IDW_CLIENT 0xE900
#define ATL_IDW_PANE_FIRST 0xE900 // first pane (256 max)
#define ATL_IDW_PANE_LAST 0xE9FF
#define ATL_IDW_HSCROLL_FIRST 0xEA00 // first Horz scrollbar (16 max)
#define ATL_IDW_VSCROLL_FIRST 0xEA10 // first Vert scrollbar (16 max)
#define ATL_IDW_SIZE_BOX 0xEA20 // size box for splitters
#define ATL_IDW_PANE_SAVE 0xEA21 // to shift ATL_IDW_PANE_FIRST
// bands for a rebar
#define ATL_IDW_BAND_FIRST 0xEB00
#define ATL_IDW_BAND_LAST 0xEBFF
#endif // !RC_INVOKED
///////////////////////////////////////////////////////////////////////////////
// Standard Commands
// File commands
#define ID_FILE_NEW 0xE100
#define ID_FILE_OPEN 0xE101
#define ID_FILE_CLOSE 0xE102
#define ID_FILE_SAVE 0xE103
#define ID_FILE_SAVE_AS 0xE104
#define ID_FILE_PAGE_SETUP 0xE105
#define ID_FILE_PRINT_SETUP 0xE106
#define ID_FILE_PRINT 0xE107
#define ID_FILE_PRINT_DIRECT 0xE108
#define ID_FILE_PRINT_PREVIEW 0xE109
#define ID_FILE_UPDATE 0xE10A
#define ID_FILE_SAVE_COPY_AS 0xE10B
#define ID_FILE_SEND_MAIL 0xE10C
#define ID_FILE_MRU_FIRST 0xE110
#define ID_FILE_MRU_FILE1 0xE110 // range - 16 max
#define ID_FILE_MRU_FILE2 0xE111
#define ID_FILE_MRU_FILE3 0xE112
#define ID_FILE_MRU_FILE4 0xE113
#define ID_FILE_MRU_FILE5 0xE114
#define ID_FILE_MRU_FILE6 0xE115
#define ID_FILE_MRU_FILE7 0xE116
#define ID_FILE_MRU_FILE8 0xE117
#define ID_FILE_MRU_FILE9 0xE118
#define ID_FILE_MRU_FILE10 0xE119
#define ID_FILE_MRU_FILE11 0xE11A
#define ID_FILE_MRU_FILE12 0xE11B
#define ID_FILE_MRU_FILE13 0xE11C
#define ID_FILE_MRU_FILE14 0xE11D
#define ID_FILE_MRU_FILE15 0xE11E
#define ID_FILE_MRU_FILE16 0xE11F
#define ID_FILE_MRU_LAST 0xE11F
// Edit commands
#define ID_EDIT_CLEAR 0xE120
#define ID_EDIT_CLEAR_ALL 0xE121
#define ID_EDIT_COPY 0xE122
#define ID_EDIT_CUT 0xE123
#define ID_EDIT_FIND 0xE124
#define ID_EDIT_PASTE 0xE125
#define ID_EDIT_PASTE_LINK 0xE126
#define ID_EDIT_PASTE_SPECIAL 0xE127
#define ID_EDIT_REPEAT 0xE128
#define ID_EDIT_REPLACE 0xE129
#define ID_EDIT_SELECT_ALL 0xE12A
#define ID_EDIT_UNDO 0xE12B
#define ID_EDIT_REDO 0xE12C
// Window commands
#define ID_WINDOW_NEW 0xE130
#define ID_WINDOW_ARRANGE 0xE131
#define ID_WINDOW_CASCADE 0xE132
#define ID_WINDOW_TILE_HORZ 0xE133
#define ID_WINDOW_TILE_VERT 0xE134
#define ID_WINDOW_SPLIT 0xE135
#ifndef RC_INVOKED // code only
#define ATL_IDM_WINDOW_FIRST 0xE130
#define ATL_IDM_WINDOW_LAST 0xE13F
#define ATL_IDM_FIRST_MDICHILD 0xFF00 // window list starts here
#define ATL_IDM_LAST_MDICHILD 0xFFFD
#endif // !RC_INVOKED
// TabView
#define ID_WINDOW_TABFIRST 0xFF00 // = ATL_IDM_FIRST_MDICHILD
#define ID_WINDOW_TABLAST 0xFFFD
#define ID_WINDOW_SHOWTABLIST 0xFFFE
// Help and App commands
#define ID_APP_ABOUT 0xE140
#define ID_APP_EXIT 0xE141
#define ID_HELP_INDEX 0xE142
#define ID_HELP_FINDER 0xE143
#define ID_HELP_USING 0xE144
#define ID_CONTEXT_HELP 0xE145 // shift-F1
// special commands for processing help
#define ID_HELP 0xE146 // first attempt for F1
#define ID_DEFAULT_HELP 0xE147 // last attempt
// Misc
#define ID_NEXT_PANE 0xE150
#define ID_PREV_PANE 0xE151
#define ID_PANE_CLOSE 0xE152
// Format
#define ID_FORMAT_FONT 0xE160
// Scroll
#define ID_SCROLL_UP 0xE170
#define ID_SCROLL_DOWN 0xE171
#define ID_SCROLL_PAGE_UP 0xE172
#define ID_SCROLL_PAGE_DOWN 0xE173
#define ID_SCROLL_TOP 0xE174
#define ID_SCROLL_BOTTOM 0xE175
#define ID_SCROLL_LEFT 0xE176
#define ID_SCROLL_RIGHT 0xE177
#define ID_SCROLL_PAGE_LEFT 0xE178
#define ID_SCROLL_PAGE_RIGHT 0xE179
#define ID_SCROLL_ALL_LEFT 0xE17A
#define ID_SCROLL_ALL_RIGHT 0xE17B
// OLE commands
#define ID_OLE_INSERT_NEW 0xE200
#define ID_OLE_EDIT_LINKS 0xE201
#define ID_OLE_EDIT_CONVERT 0xE202
#define ID_OLE_EDIT_CHANGE_ICON 0xE203
#define ID_OLE_EDIT_PROPERTIES 0xE204
#define ID_OLE_VERB_FIRST 0xE210 // range - 16 max
#ifndef RC_INVOKED // code only
#define ID_OLE_VERB_LAST 0xE21F
#endif // !RC_INVOKED
// View commands (same number used as IDW used for toolbar and status bar)
#define ID_VIEW_TOOLBAR 0xE800
#define ID_VIEW_STATUS_BAR 0xE801
#define ID_VIEW_REFRESH 0xE803
#define ID_VIEW_RIBBON 0xE804 // Ribbon
///////////////////////////////////////////////////////////////////////////////
// Standard control IDs
#ifdef IDC_STATIC
#undef IDC_STATIC
#endif // IDC_STATIC
#define IDC_STATIC (-1) // all static controls
///////////////////////////////////////////////////////////////////////////////
// Standard string error/warnings
// idle status bar message
#define ATL_IDS_IDLEMESSAGE 0xE001
#ifndef RC_INVOKED // code only
#define ATL_IDS_SCFIRST 0xEF00
#endif // !RC_INVOKED
#define ATL_IDS_SCSIZE 0xEF00
#define ATL_IDS_SCMOVE 0xEF01
#define ATL_IDS_SCMINIMIZE 0xEF02
#define ATL_IDS_SCMAXIMIZE 0xEF03
#define ATL_IDS_SCNEXTWINDOW 0xEF04
#define ATL_IDS_SCPREVWINDOW 0xEF05
#define ATL_IDS_SCCLOSE 0xEF06
#define ATL_IDS_SCRESTORE 0xEF12
#define ATL_IDS_SCTASKLIST 0xEF13
#define ATL_IDS_MDICHILD 0xEF1F
#define ATL_IDS_MRU_FILE 0xEFDA
///////////////////////////////////////////////////////////////////////////////
// Misc. control IDs
// Property Sheet control id's (determined with Spy++)
#define ID_APPLY_NOW 0x3021
#define ID_WIZBACK 0x3023
#define ID_WIZNEXT 0x3024
#define ID_WIZFINISH 0x3025
#define ATL_IDC_TAB_CONTROL 0x3020
#endif // __ATLRES_H__

View File

@ -0,0 +1,93 @@
// Windows Template Library - WTL version 8.1
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// This file is a part of the Windows Template Library.
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
// which can be found in the file CPL.TXT at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by
// the terms of this license. You must not remove this notice, or
// any other, from this software.
#ifndef __ATLRESCE_H__
#define __ATLRESCE_H__
#pragma once
#ifndef _WIN32_WCE
#error atlresCE.h is only for Windows CE
#endif
#ifdef RC_INVOKED
#ifndef _INC_WINDOWS
#define VS_VERSION_INFO 1
#ifdef APSTUDIO_INVOKED
#define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols
#endif // APSTUDIO_INVOKED
#ifndef WINVER
#define WINVER 0x0400 // default to Windows Version 4.0
#endif // !WINVER
#if !defined(WCEOLE_ENABLE_DIALOGEX)
#define DIALOGEX DIALOG DISCARDABLE
#endif
#include <commctrl.h>
#define SHMENUBAR RCDATA
#if defined(SHELLSDK_MODULES_AYGSHELL)
#include <aygshell.h>
#else
#define NOMENU 0xFFFF
#define IDS_SHNEW 1
#define IDM_SHAREDNEW 10
#define IDM_SHAREDNEWDEFAULT 11
#endif
#ifndef I_IMAGENONE
#define I_IMAGENONE (-2)
#endif
#include <windows.h>
#endif // !_INC_WINDOWS
#endif // RC_INVOKED
#include "atlres.h"
#ifdef APSTUDIO_INVOKED
#undef APSTUDIO_HIDDEN_SYMBOLS
#endif // APSTUDIO_INVOKED
// Visual Studio dialog editor bug fix
#ifndef DS_FIXEDSYS
#define DS_FIXEDSYS 0
#endif
#define IDC_INFOSTATIC 0xFFFE // == IDC_STATIC -1
///////////////////////////////////////////////////////////////////////////////
// Smartphone and PPC 2005 Resource IDs
// Command and associated string resource IDs
#define ID_MENU_OK 0xE790
#define ID_MENU_CANCEL 0xE791
#define ID_MENU 0xE792
#define ID_ACTION 0xE793
#define ID_VIEW_FULLSCREEN 0xE802
// MenuBar resource IDs
#define ATL_IDM_MENU_DONE 0xE701
#define ATL_IDM_MENU_CANCEL 0xE702
#define ATL_IDM_MENU_DONECANCEL 0xE703
// Default device MenuBar control ID and MenuBar resource ID
#define ATL_IDW_MENU_BAR 0xE802
// SmartPhone spinned controls ID offset for CSpinCtrl
#define ATL_IDW_SPIN_ID 9999
#endif // __ATLRESCE_H__

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,917 @@
// Windows Template Library - WTL version 8.1
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// This file is a part of the Windows Template Library.
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
// which can be found in the file CPL.TXT at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by
// the terms of this license. You must not remove this notice, or
// any other, from this software.
#ifndef __ATLSPLIT_H__
#define __ATLSPLIT_H__
#pragma once
#ifndef __ATLAPP_H__
#error atlsplit.h requires atlapp.h to be included first
#endif
#ifndef __ATLWIN_H__
#error atlsplit.h requires atlwin.h to be included first
#endif
///////////////////////////////////////////////////////////////////////////////
// Classes in this file:
//
// CSplitterImpl<T, t_bVertical>
// CSplitterWindowImpl<T, t_bVertical, TBase, TWinTraits>
// CSplitterWindowT<t_bVertical>
namespace WTL
{
///////////////////////////////////////////////////////////////////////////////
// CSplitterImpl - Provides splitter support to any window
// Splitter panes constants
#define SPLIT_PANE_LEFT 0
#define SPLIT_PANE_RIGHT 1
#define SPLIT_PANE_TOP SPLIT_PANE_LEFT
#define SPLIT_PANE_BOTTOM SPLIT_PANE_RIGHT
#define SPLIT_PANE_NONE -1
// Splitter extended styles
#define SPLIT_PROPORTIONAL 0x00000001
#define SPLIT_NONINTERACTIVE 0x00000002
#define SPLIT_RIGHTALIGNED 0x00000004
#define SPLIT_BOTTOMALIGNED SPLIT_RIGHTALIGNED
#define SPLIT_GRADIENTBAR 0x00000008
#define SPLIT_FIXEDBARSIZE 0x00000010
// Note: SPLIT_PROPORTIONAL and SPLIT_RIGHTALIGNED/SPLIT_BOTTOMALIGNED are
// mutually exclusive. If both are set, splitter defaults to SPLIT_PROPORTIONAL
template <class T, bool t_bVertical = true>
class CSplitterImpl
{
public:
enum { m_nPanesCount = 2, m_nPropMax = 10000 };
HWND m_hWndPane[m_nPanesCount];
RECT m_rcSplitter;
int m_xySplitterPos;
int m_nDefActivePane;
int m_cxySplitBar; // splitter bar width/height
static HCURSOR m_hCursor;
int m_cxyMin; // minimum pane size
int m_cxyBarEdge; // splitter bar edge
bool m_bFullDrag;
int m_cxyDragOffset;
int m_nProportionalPos;
bool m_bUpdateProportionalPos;
DWORD m_dwExtendedStyle; // splitter specific extended styles
int m_nSinglePane; // single pane mode
// Constructor
CSplitterImpl() :
m_xySplitterPos(-1), m_nDefActivePane(SPLIT_PANE_NONE),
m_cxySplitBar(4), m_cxyMin(0), m_cxyBarEdge(0), m_bFullDrag(true),
m_cxyDragOffset(0), m_nProportionalPos(0), m_bUpdateProportionalPos(true),
m_dwExtendedStyle(SPLIT_PROPORTIONAL),
m_nSinglePane(SPLIT_PANE_NONE)
{
m_hWndPane[SPLIT_PANE_LEFT] = NULL;
m_hWndPane[SPLIT_PANE_RIGHT] = NULL;
::SetRectEmpty(&m_rcSplitter);
if(m_hCursor == NULL)
{
CStaticDataInitCriticalSectionLock lock;
if(FAILED(lock.Lock()))
{
ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CSplitterImpl::CSplitterImpl.\n"));
ATLASSERT(FALSE);
return;
}
if(m_hCursor == NULL)
m_hCursor = ::LoadCursor(NULL, t_bVertical ? IDC_SIZEWE : IDC_SIZENS);
lock.Unlock();
}
}
// Attributes
void SetSplitterRect(LPRECT lpRect = NULL, bool bUpdate = true)
{
if(lpRect == NULL)
{
T* pT = static_cast<T*>(this);
pT->GetClientRect(&m_rcSplitter);
}
else
{
m_rcSplitter = *lpRect;
}
if(IsProportional())
UpdateProportionalPos();
else if(IsRightAligned())
UpdateRightAlignPos();
if(bUpdate)
UpdateSplitterLayout();
}
void GetSplitterRect(LPRECT lpRect) const
{
ATLASSERT(lpRect != NULL);
*lpRect = m_rcSplitter;
}
bool SetSplitterPos(int xyPos = -1, bool bUpdate = true)
{
if(xyPos == -1) // -1 == middle
{
if(t_bVertical)
xyPos = (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) / 2;
else
xyPos = (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge) / 2;
}
// Adjust if out of valid range
int cxyMax = 0;
if(t_bVertical)
cxyMax = m_rcSplitter.right - m_rcSplitter.left;
else
cxyMax = m_rcSplitter.bottom - m_rcSplitter.top;
if(xyPos < m_cxyMin + m_cxyBarEdge)
xyPos = m_cxyMin;
else if(xyPos > (cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin))
xyPos = cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin;
// Set new position and update if requested
bool bRet = (m_xySplitterPos != xyPos);
m_xySplitterPos = xyPos;
if(m_bUpdateProportionalPos)
{
if(IsProportional())
StoreProportionalPos();
else if(IsRightAligned())
StoreRightAlignPos();
}
else
{
m_bUpdateProportionalPos = true;
}
if(bUpdate && bRet)
UpdateSplitterLayout();
return bRet;
}
void SetSplitterPosPct(int nPct, bool bUpdate = true)
{
ATLASSERT(nPct >= 0 && nPct <= 100);
m_nProportionalPos = ::MulDiv(nPct, m_nPropMax, 100);
UpdateProportionalPos();
if(bUpdate)
UpdateSplitterLayout();
}
int GetSplitterPos() const
{
return m_xySplitterPos;
}
bool SetSinglePaneMode(int nPane = SPLIT_PANE_NONE)
{
ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT || nPane == SPLIT_PANE_NONE);
if(!(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT || nPane == SPLIT_PANE_NONE))
return false;
if(nPane != SPLIT_PANE_NONE)
{
if(!::IsWindowVisible(m_hWndPane[nPane]))
::ShowWindow(m_hWndPane[nPane], SW_SHOW);
int nOtherPane = (nPane == SPLIT_PANE_LEFT) ? SPLIT_PANE_RIGHT : SPLIT_PANE_LEFT;
::ShowWindow(m_hWndPane[nOtherPane], SW_HIDE);
if(m_nDefActivePane != nPane)
m_nDefActivePane = nPane;
}
else if(m_nSinglePane != SPLIT_PANE_NONE)
{
int nOtherPane = (m_nSinglePane == SPLIT_PANE_LEFT) ? SPLIT_PANE_RIGHT : SPLIT_PANE_LEFT;
::ShowWindow(m_hWndPane[nOtherPane], SW_SHOW);
}
m_nSinglePane = nPane;
UpdateSplitterLayout();
return true;
}
int GetSinglePaneMode() const
{
return m_nSinglePane;
}
DWORD GetSplitterExtendedStyle() const
{
return m_dwExtendedStyle;
}
DWORD SetSplitterExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0)
{
DWORD dwPrevStyle = m_dwExtendedStyle;
if(dwMask == 0)
m_dwExtendedStyle = dwExtendedStyle;
else
m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask);
#ifdef _DEBUG
if(IsProportional() && IsRightAligned())
ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::SetSplitterExtendedStyle - SPLIT_PROPORTIONAL and SPLIT_RIGHTALIGNED are mutually exclusive, defaulting to SPLIT_PROPORTIONAL.\n"));
#endif // _DEBUG
return dwPrevStyle;
}
// Splitter operations
void SetSplitterPanes(HWND hWndLeftTop, HWND hWndRightBottom, bool bUpdate = true)
{
m_hWndPane[SPLIT_PANE_LEFT] = hWndLeftTop;
m_hWndPane[SPLIT_PANE_RIGHT] = hWndRightBottom;
ATLASSERT(m_hWndPane[SPLIT_PANE_LEFT] == NULL || m_hWndPane[SPLIT_PANE_RIGHT] == NULL || m_hWndPane[SPLIT_PANE_LEFT] != m_hWndPane[SPLIT_PANE_RIGHT]);
if(bUpdate)
UpdateSplitterLayout();
}
bool SetSplitterPane(int nPane, HWND hWnd, bool bUpdate = true)
{
ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT);
if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT)
return false;
m_hWndPane[nPane] = hWnd;
ATLASSERT(m_hWndPane[SPLIT_PANE_LEFT] == NULL || m_hWndPane[SPLIT_PANE_RIGHT] == NULL || m_hWndPane[SPLIT_PANE_LEFT] != m_hWndPane[SPLIT_PANE_RIGHT]);
if(bUpdate)
UpdateSplitterLayout();
return true;
}
HWND GetSplitterPane(int nPane) const
{
ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT);
if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT)
return false;
return m_hWndPane[nPane];
}
bool SetActivePane(int nPane)
{
ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT);
if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT)
return false;
if(m_nSinglePane != SPLIT_PANE_NONE && nPane != m_nSinglePane)
return false;
::SetFocus(m_hWndPane[nPane]);
m_nDefActivePane = nPane;
return true;
}
int GetActivePane() const
{
int nRet = SPLIT_PANE_NONE;
HWND hWndFocus = ::GetFocus();
if(hWndFocus != NULL)
{
for(int nPane = 0; nPane < m_nPanesCount; nPane++)
{
if(hWndFocus == m_hWndPane[nPane] || ::IsChild(m_hWndPane[nPane], hWndFocus))
{
nRet = nPane;
break;
}
}
}
return nRet;
}
bool ActivateNextPane(bool bNext = true)
{
int nPane = m_nSinglePane;
if(nPane == SPLIT_PANE_NONE)
{
switch(GetActivePane())
{
case SPLIT_PANE_LEFT:
nPane = SPLIT_PANE_RIGHT;
break;
case SPLIT_PANE_RIGHT:
nPane = SPLIT_PANE_LEFT;
break;
default:
nPane = bNext ? SPLIT_PANE_LEFT : SPLIT_PANE_RIGHT;
break;
}
}
return SetActivePane(nPane);
}
bool SetDefaultActivePane(int nPane)
{
ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT);
if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT)
return false;
m_nDefActivePane = nPane;
return true;
}
bool SetDefaultActivePane(HWND hWnd)
{
for(int nPane = 0; nPane < m_nPanesCount; nPane++)
{
if(hWnd == m_hWndPane[nPane])
{
m_nDefActivePane = nPane;
return true;
}
}
return false; // not found
}
int GetDefaultActivePane() const
{
return m_nDefActivePane;
}
void DrawSplitter(CDCHandle dc)
{
ATLASSERT(dc.m_hDC != NULL);
if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1)
return;
T* pT = static_cast<T*>(this);
if(m_nSinglePane == SPLIT_PANE_NONE)
{
pT->DrawSplitterBar(dc);
for(int nPane = 0; nPane < m_nPanesCount; nPane++)
{
if(m_hWndPane[nPane] == NULL)
pT->DrawSplitterPane(dc, nPane);
}
}
else
{
if(m_hWndPane[m_nSinglePane] == NULL)
pT->DrawSplitterPane(dc, m_nSinglePane);
}
}
// Overrideables
void DrawSplitterBar(CDCHandle dc)
{
RECT rect = { 0 };
if(GetSplitterBarRect(&rect))
{
dc.FillRect(&rect, COLOR_3DFACE);
#if (!defined(_WIN32_WCE) || (_WIN32_WCE >= 420))
if((m_dwExtendedStyle & SPLIT_GRADIENTBAR) != 0)
{
RECT rect2 = rect;
if(t_bVertical)
rect2.left = (rect.left + rect.right) / 2 - 1;
else
rect2.top = (rect.top + rect.bottom) / 2 - 1;
dc.GradientFillRect(rect2, ::GetSysColor(COLOR_3DFACE), ::GetSysColor(COLOR_3DSHADOW), t_bVertical);
}
#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 420)
// draw 3D edge if needed
T* pT = static_cast<T*>(this);
if((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0)
dc.DrawEdge(&rect, EDGE_RAISED, t_bVertical ? (BF_LEFT | BF_RIGHT) : (BF_TOP | BF_BOTTOM));
}
}
// called only if pane is empty
void DrawSplitterPane(CDCHandle dc, int nPane)
{
RECT rect = { 0 };
if(GetSplitterPaneRect(nPane, &rect))
{
T* pT = static_cast<T*>(this);
if((pT->GetExStyle() & WS_EX_CLIENTEDGE) == 0)
dc.DrawEdge(&rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
dc.FillRect(&rect, COLOR_APPWORKSPACE);
}
}
// Message map and handlers
BEGIN_MSG_MAP(CSplitterImpl)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
MESSAGE_HANDLER(WM_PAINT, OnPaint)
#ifndef _WIN32_WCE
MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint)
#endif // !_WIN32_WCE
if(IsInteractive())
{
MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDoubleClick)
MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged)
}
MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
#ifndef _WIN32_WCE
MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate)
#endif // !_WIN32_WCE
MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange)
END_MSG_MAP()
LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
T* pT = static_cast<T*>(this);
pT->GetSystemSettings(false);
bHandled = FALSE;
return 1;
}
LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
T* pT = static_cast<T*>(this);
// try setting position if not set
if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1)
pT->SetSplitterPos();
// do painting
CPaintDC dc(pT->m_hWnd);
pT->DrawSplitter(dc.m_hDC);
return 0;
}
LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
T* pT = static_cast<T*>(this);
if((HWND)wParam == pT->m_hWnd && LOWORD(lParam) == HTCLIENT)
{
DWORD dwPos = ::GetMessagePos();
POINT ptPos = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) };
pT->ScreenToClient(&ptPos);
if(IsOverSplitterBar(ptPos.x, ptPos.y))
return 1;
}
bHandled = FALSE;
return 0;
}
LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
T* pT = static_cast<T*>(this);
int xPos = GET_X_LPARAM(lParam);
int yPos = GET_Y_LPARAM(lParam);
if((wParam & MK_LBUTTON) && ::GetCapture() == pT->m_hWnd)
{
int xyNewSplitPos = 0;
if(t_bVertical)
xyNewSplitPos = xPos - m_rcSplitter.left - m_cxyDragOffset;
else
xyNewSplitPos = yPos - m_rcSplitter.top - m_cxyDragOffset;
if(xyNewSplitPos == -1) // avoid -1, that means middle
xyNewSplitPos = -2;
if(m_xySplitterPos != xyNewSplitPos)
{
if(m_bFullDrag)
{
if(pT->SetSplitterPos(xyNewSplitPos, true))
pT->UpdateWindow();
}
else
{
DrawGhostBar();
pT->SetSplitterPos(xyNewSplitPos, false);
DrawGhostBar();
}
}
}
else // not dragging, just set cursor
{
if(IsOverSplitterBar(xPos, yPos))
::SetCursor(m_hCursor);
bHandled = FALSE;
}
return 0;
}
LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled)
{
int xPos = GET_X_LPARAM(lParam);
int yPos = GET_Y_LPARAM(lParam);
if(IsOverSplitterBar(xPos, yPos))
{
T* pT = static_cast<T*>(this);
pT->SetCapture();
::SetCursor(m_hCursor);
if(!m_bFullDrag)
DrawGhostBar();
if(t_bVertical)
m_cxyDragOffset = xPos - m_rcSplitter.left - m_xySplitterPos;
else
m_cxyDragOffset = yPos - m_rcSplitter.top - m_xySplitterPos;
}
bHandled = FALSE;
return 1;
}
LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
::ReleaseCapture();
bHandled = FALSE;
return 1;
}
LRESULT OnLButtonDoubleClick(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
T* pT = static_cast<T*>(this);
pT->SetSplitterPos(); // middle
return 0;
}
LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
if(!m_bFullDrag)
{
DrawGhostBar();
UpdateSplitterLayout();
T* pT = static_cast<T*>(this);
pT->UpdateWindow();
}
return 0;
}
LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM, BOOL& bHandled)
{
if(m_nSinglePane == SPLIT_PANE_NONE)
{
if(m_nDefActivePane == SPLIT_PANE_LEFT || m_nDefActivePane == SPLIT_PANE_RIGHT)
::SetFocus(m_hWndPane[m_nDefActivePane]);
}
else
{
::SetFocus(m_hWndPane[m_nSinglePane]);
}
bHandled = FALSE;
return 1;
}
#ifndef _WIN32_WCE
LRESULT OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/)
{
T* pT = static_cast<T*>(this);
LRESULT lRet = pT->DefWindowProc(uMsg, wParam, lParam);
if(lRet == MA_ACTIVATE || lRet == MA_ACTIVATEANDEAT)
{
DWORD dwPos = ::GetMessagePos();
POINT pt = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) };
pT->ScreenToClient(&pt);
RECT rcPane = { 0 };
for(int nPane = 0; nPane < m_nPanesCount; nPane++)
{
if(GetSplitterPaneRect(nPane, &rcPane) && ::PtInRect(&rcPane, pt))
{
m_nDefActivePane = nPane;
break;
}
}
}
return lRet;
}
#endif // !_WIN32_WCE
LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
T* pT = static_cast<T*>(this);
pT->GetSystemSettings(true);
return 0;
}
// Implementation - internal helpers
void UpdateSplitterLayout()
{
if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1)
return;
T* pT = static_cast<T*>(this);
RECT rect = { 0 };
if(m_nSinglePane == SPLIT_PANE_NONE)
{
if(GetSplitterBarRect(&rect))
pT->InvalidateRect(&rect);
for(int nPane = 0; nPane < m_nPanesCount; nPane++)
{
if(GetSplitterPaneRect(nPane, &rect))
{
if(m_hWndPane[nPane] != NULL)
::SetWindowPos(m_hWndPane[nPane], NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER);
else
pT->InvalidateRect(&rect);
}
}
}
else
{
if(GetSplitterPaneRect(m_nSinglePane, &rect))
{
if(m_hWndPane[m_nSinglePane] != NULL)
::SetWindowPos(m_hWndPane[m_nSinglePane], NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER);
else
pT->InvalidateRect(&rect);
}
}
}
bool GetSplitterBarRect(LPRECT lpRect) const
{
ATLASSERT(lpRect != NULL);
if(m_nSinglePane != SPLIT_PANE_NONE || m_xySplitterPos == -1)
return false;
if(t_bVertical)
{
lpRect->left = m_rcSplitter.left + m_xySplitterPos;
lpRect->top = m_rcSplitter.top;
lpRect->right = m_rcSplitter.left + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge;
lpRect->bottom = m_rcSplitter.bottom;
}
else
{
lpRect->left = m_rcSplitter.left;
lpRect->top = m_rcSplitter.top + m_xySplitterPos;
lpRect->right = m_rcSplitter.right;
lpRect->bottom = m_rcSplitter.top + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge;
}
return true;
}
bool GetSplitterPaneRect(int nPane, LPRECT lpRect) const
{
ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT);
ATLASSERT(lpRect != NULL);
bool bRet = true;
if(m_nSinglePane != SPLIT_PANE_NONE)
{
if(nPane == m_nSinglePane)
*lpRect = m_rcSplitter;
else
bRet = false;
}
else if(nPane == SPLIT_PANE_LEFT)
{
if(t_bVertical)
{
lpRect->left = m_rcSplitter.left;
lpRect->top = m_rcSplitter.top;
lpRect->right = m_rcSplitter.left + m_xySplitterPos;
lpRect->bottom = m_rcSplitter.bottom;
}
else
{
lpRect->left = m_rcSplitter.left;
lpRect->top = m_rcSplitter.top;
lpRect->right = m_rcSplitter.right;
lpRect->bottom = m_rcSplitter.top + m_xySplitterPos;
}
}
else if(nPane == SPLIT_PANE_RIGHT)
{
if(t_bVertical)
{
lpRect->left = m_rcSplitter.left + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge;
lpRect->top = m_rcSplitter.top;
lpRect->right = m_rcSplitter.right;
lpRect->bottom = m_rcSplitter.bottom;
}
else
{
lpRect->left = m_rcSplitter.left;
lpRect->top = m_rcSplitter.top + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge;
lpRect->right = m_rcSplitter.right;
lpRect->bottom = m_rcSplitter.bottom;
}
}
else
{
bRet = false;
}
return bRet;
}
bool IsOverSplitterRect(int x, int y) const
{
// -1 == don't check
return ((x == -1 || (x >= m_rcSplitter.left && x <= m_rcSplitter.right)) &&
(y == -1 || (y >= m_rcSplitter.top && y <= m_rcSplitter.bottom)));
}
bool IsOverSplitterBar(int x, int y) const
{
if(m_nSinglePane != SPLIT_PANE_NONE)
return false;
if(m_xySplitterPos == -1 || !IsOverSplitterRect(x, y))
return false;
int xy = t_bVertical ? x : y;
int xyOff = t_bVertical ? m_rcSplitter.left : m_rcSplitter.top;
return ((xy >= (xyOff + m_xySplitterPos)) && (xy < xyOff + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge));
}
void DrawGhostBar()
{
RECT rect = { 0 };
if(GetSplitterBarRect(&rect))
{
// convert client to window coordinates
T* pT = static_cast<T*>(this);
RECT rcWnd = { 0 };
pT->GetWindowRect(&rcWnd);
::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rcWnd, 2);
::OffsetRect(&rect, -rcWnd.left, -rcWnd.top);
// invert the brush pattern (looks just like frame window sizing)
CWindowDC dc(pT->m_hWnd);
CBrush brush = CDCHandle::GetHalftoneBrush();
if(brush.m_hBrush != NULL)
{
CBrushHandle brushOld = dc.SelectBrush(brush);
dc.PatBlt(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, PATINVERT);
dc.SelectBrush(brushOld);
}
}
}
void GetSystemSettings(bool bUpdate)
{
if((m_dwExtendedStyle & SPLIT_FIXEDBARSIZE) == 0)
{
#ifndef _WIN32_WCE
m_cxySplitBar = ::GetSystemMetrics(t_bVertical ? SM_CXSIZEFRAME : SM_CYSIZEFRAME);
#else // CE specific
m_cxySplitBar = 2 * ::GetSystemMetrics(t_bVertical ? SM_CXEDGE : SM_CYEDGE);
#endif // _WIN32_WCE
}
T* pT = static_cast<T*>(this);
if((pT->GetExStyle() & WS_EX_CLIENTEDGE))
{
m_cxyBarEdge = 2 * ::GetSystemMetrics(t_bVertical ? SM_CXEDGE : SM_CYEDGE);
m_cxyMin = 0;
}
else
{
m_cxyBarEdge = 0;
m_cxyMin = 2 * ::GetSystemMetrics(t_bVertical ? SM_CXEDGE : SM_CYEDGE);
}
#ifndef _WIN32_WCE
::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &m_bFullDrag, 0);
#endif // !_WIN32_WCE
if(bUpdate)
UpdateSplitterLayout();
}
bool IsProportional() const
{
return ((m_dwExtendedStyle & SPLIT_PROPORTIONAL) != 0);
}
void StoreProportionalPos()
{
int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge);
if(cxyTotal > 0)
m_nProportionalPos = ::MulDiv(m_xySplitterPos, m_nPropMax, cxyTotal);
else
m_nProportionalPos = 0;
ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::StoreProportionalPos - %i\n"), m_nProportionalPos);
}
void UpdateProportionalPos()
{
int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge);
if(cxyTotal > 0)
{
int xyNewPos = ::MulDiv(m_nProportionalPos, cxyTotal, m_nPropMax);
m_bUpdateProportionalPos = false;
T* pT = static_cast<T*>(this);
pT->SetSplitterPos(xyNewPos, false);
}
}
bool IsRightAligned() const
{
return ((m_dwExtendedStyle & SPLIT_RIGHTALIGNED) != 0);
}
void StoreRightAlignPos()
{
int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge);
if(cxyTotal > 0)
m_nProportionalPos = cxyTotal - m_xySplitterPos;
else
m_nProportionalPos = 0;
ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::StoreRightAlignPos - %i\n"), m_nProportionalPos);
}
void UpdateRightAlignPos()
{
int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge);
if(cxyTotal > 0)
{
m_bUpdateProportionalPos = false;
T* pT = static_cast<T*>(this);
pT->SetSplitterPos(cxyTotal - m_nProportionalPos, false);
}
}
bool IsInteractive() const
{
return ((m_dwExtendedStyle & SPLIT_NONINTERACTIVE) == 0);
}
};
template <class T, bool t_bVertical> HCURSOR CSplitterImpl< T, t_bVertical>::m_hCursor = NULL;
///////////////////////////////////////////////////////////////////////////////
// CSplitterWindowImpl - Implements a splitter window
template <class T, bool t_bVertical = true, class TBase = ATL::CWindow, class TWinTraits = ATL::CControlWinTraits>
class ATL_NO_VTABLE CSplitterWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CSplitterImpl< T , t_bVertical >
{
public:
DECLARE_WND_CLASS_EX(NULL, CS_DBLCLKS, COLOR_WINDOW)
typedef CSplitterImpl< T , t_bVertical > _baseClass;
BEGIN_MSG_MAP(CSplitterWindowImpl)
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground)
MESSAGE_HANDLER(WM_SIZE, OnSize)
CHAIN_MSG_MAP(_baseClass)
FORWARD_NOTIFICATIONS()
END_MSG_MAP()
LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
// handled, no background painting needed
return 1;
}
LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled)
{
if(wParam != SIZE_MINIMIZED)
SetSplitterRect();
bHandled = FALSE;
return 1;
}
};
///////////////////////////////////////////////////////////////////////////////
// CSplitterWindow - Implements a splitter window to be used as is
template <bool t_bVertical = true>
class CSplitterWindowT : public CSplitterWindowImpl<CSplitterWindowT<t_bVertical>, t_bVertical>
{
public:
DECLARE_WND_CLASS_EX(_T("WTL_SplitterWindow"), CS_DBLCLKS, COLOR_WINDOW)
};
typedef CSplitterWindowT<true> CSplitterWindow;
typedef CSplitterWindowT<false> CHorSplitterWindow;
}; // namespace WTL
#endif // __ATLSPLIT_H__

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,525 @@
// Windows Template Library - WTL version 8.1
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// This file is a part of the Windows Template Library.
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
// which can be found in the file CPL.TXT at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by
// the terms of this license. You must not remove this notice, or
// any other, from this software.
#ifndef __ATLWINX_H__
#define __ATLWINX_H__
#pragma once
#ifndef __ATLAPP_H__
#error atlwinx.h requires atlapp.h to be included first
#endif
#if (_ATL_VER >= 0x0700)
#include <atlwin.h>
#endif // (_ATL_VER >= 0x0700)
///////////////////////////////////////////////////////////////////////////////
// Classes in this file:
//
// _U_RECT
// _U_MENUorID
// _U_STRINGorID
///////////////////////////////////////////////////////////////////////////////
// Command Chaining Macros
#define CHAIN_COMMANDS(theChainClass) \
if(uMsg == WM_COMMAND) \
CHAIN_MSG_MAP(theChainClass)
#define CHAIN_COMMANDS_ALT(theChainClass, msgMapID) \
if(uMsg == WM_COMMAND) \
CHAIN_MSG_MAP_ALT(theChainClass, msgMapID)
#define CHAIN_COMMANDS_MEMBER(theChainMember) \
if(uMsg == WM_COMMAND) \
CHAIN_MSG_MAP_MEMBER(theChainMember)
#define CHAIN_COMMANDS_ALT_MEMBER(theChainMember, msgMapID) \
if(uMsg == WM_COMMAND) \
CHAIN_MSG_MAP_ALT_MEMBER(theChainMember, msgMapID)
///////////////////////////////////////////////////////////////////////////////
// Macros for parent message map to selectively reflect control messages
// NOTE: ReflectNotifications is a member of ATL's CWindowImplRoot
// (and overridden in 2 cases - CContainedWindowT and CAxHostWindow)
// Since we can't modify ATL, we'll provide the needed additions
// in a separate function (that is not a member of CWindowImplRoot)
namespace WTL
{
inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled,
UINT uMsgFilter = WM_NULL, UINT_PTR idFromFilter = 0, HWND hWndChildFilter = NULL)
{
if((uMsgFilter != WM_NULL) && (uMsgFilter != uMsg))
{
// The notification message doesn't match the filter.
bHandled = FALSE;
return 1;
}
HWND hWndChild = NULL;
UINT_PTR idFrom = 0;
switch(uMsg)
{
case WM_COMMAND:
if(lParam != NULL) // not from a menu
{
hWndChild = (HWND)lParam;
idFrom = (UINT_PTR)LOWORD(wParam);
}
break;
case WM_NOTIFY:
hWndChild = ((LPNMHDR)lParam)->hwndFrom;
idFrom = ((LPNMHDR)lParam)->idFrom;
break;
#ifndef _WIN32_WCE
case WM_PARENTNOTIFY:
switch(LOWORD(wParam))
{
case WM_CREATE:
case WM_DESTROY:
hWndChild = (HWND)lParam;
idFrom = (UINT_PTR)HIWORD(wParam);
break;
default:
hWndChild = ::GetDlgItem(hWndParent, HIWORD(wParam));
idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild);
break;
}
break;
#endif // !_WIN32_WCE
case WM_DRAWITEM:
if(wParam) // not from a menu
{
hWndChild = ((LPDRAWITEMSTRUCT)lParam)->hwndItem;
idFrom = (UINT_PTR)wParam;
}
break;
case WM_MEASUREITEM:
if(wParam) // not from a menu
{
hWndChild = ::GetDlgItem(hWndParent, ((LPMEASUREITEMSTRUCT)lParam)->CtlID);
idFrom = (UINT_PTR)wParam;
}
break;
case WM_COMPAREITEM:
if(wParam) // not from a menu
{
hWndChild = ((LPCOMPAREITEMSTRUCT)lParam)->hwndItem;
idFrom = (UINT_PTR)wParam;
}
break;
case WM_DELETEITEM:
if(wParam) // not from a menu
{
hWndChild = ((LPDELETEITEMSTRUCT)lParam)->hwndItem;
idFrom = (UINT_PTR)wParam;
}
break;
case WM_VKEYTOITEM:
case WM_CHARTOITEM:
case WM_HSCROLL:
case WM_VSCROLL:
hWndChild = (HWND)lParam;
idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild);
break;
case WM_CTLCOLORBTN:
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORMSGBOX:
case WM_CTLCOLORSCROLLBAR:
case WM_CTLCOLORSTATIC:
hWndChild = (HWND)lParam;
idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild);
break;
default:
break;
}
if((hWndChild == NULL) ||
((hWndChildFilter != NULL) && (hWndChildFilter != hWndChild)))
{
// Either hWndChild isn't valid, or
// hWndChild doesn't match the filter.
bHandled = FALSE;
return 1;
}
if((idFromFilter != 0) && (idFromFilter != idFrom))
{
// The dialog control id doesn't match the filter.
bHandled = FALSE;
return 1;
}
ATLASSERT(::IsWindow(hWndChild));
LRESULT lResult = ::SendMessage(hWndChild, OCM__BASE + uMsg, wParam, lParam);
if((lResult == 0) && (uMsg >= WM_CTLCOLORMSGBOX) && (uMsg <= WM_CTLCOLORSTATIC))
{
// Try to prevent problems with WM_CTLCOLOR* messages when
// the message wasn't really handled
bHandled = FALSE;
}
return lResult;
}
}; // namespace WTL
// Try to prevent problems with WM_CTLCOLOR* messages when
// the message wasn't really handled
#define REFLECT_NOTIFICATIONS_EX() \
{ \
bHandled = TRUE; \
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
if((lResult == 0) && (uMsg >= WM_CTLCOLORMSGBOX) && (uMsg <= WM_CTLCOLORSTATIC)) \
bHandled = FALSE; \
if(bHandled) \
return TRUE; \
}
#define REFLECT_NOTIFICATIONS_MSG_FILTERED(uMsgFilter) \
{ \
bHandled = TRUE; \
lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, 0, NULL); \
if(bHandled) \
return TRUE; \
}
#define REFLECT_NOTIFICATIONS_ID_FILTERED(idFromFilter) \
{ \
bHandled = TRUE; \
lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, WM_NULL, idFromFilter, NULL); \
if(bHandled) \
return TRUE; \
}
#define REFLECT_NOTIFICATIONS_HWND_FILTERED(hWndChildFilter) \
{ \
bHandled = TRUE; \
lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, WM_NULL, 0, hWndChildFilter); \
if(bHandled) \
return TRUE; \
}
#define REFLECT_NOTIFICATIONS_MSG_ID_FILTERED(uMsgFilter, idFromFilter) \
{ \
bHandled = TRUE; \
lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, idFromFilter, NULL); \
if(bHandled) \
return TRUE; \
}
#define REFLECT_NOTIFICATIONS_MSG_HWND_FILTERED(uMsgFilter, hWndChildFilter) \
{ \
bHandled = TRUE; \
lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, 0, hWndChildFilter); \
if(bHandled) \
return TRUE; \
}
#define REFLECT_COMMAND(id, code) \
if(uMsg == WM_COMMAND && id == LOWORD(wParam) && code == HIWORD(wParam)) \
{ \
bHandled = TRUE; \
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
#define REFLECT_COMMAND_ID(id) \
if(uMsg == WM_COMMAND && id == LOWORD(wParam)) \
{ \
bHandled = TRUE; \
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
#define REFLECT_COMMAND_CODE(code) \
if(uMsg == WM_COMMAND && code == HIWORD(wParam)) \
{ \
bHandled = TRUE; \
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
#define REFLECT_COMMAND_RANGE(idFirst, idLast) \
if(uMsg == WM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
{ \
bHandled = TRUE; \
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
#define REFLECT_COMMAND_RANGE_CODE(idFirst, idLast, code) \
if(uMsg == WM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
{ \
bHandled = TRUE; \
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
#define REFLECT_NOTIFY(id, cd) \
if(uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom && cd == ((LPNMHDR)lParam)->code) \
{ \
bHandled = TRUE; \
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
#define REFLECT_NOTIFY_ID(id) \
if(uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \
{ \
bHandled = TRUE; \
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
#define REFLECT_NOTIFY_CODE(cd) \
if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \
{ \
bHandled = TRUE; \
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
#define REFLECT_NOTIFY_RANGE(idFirst, idLast) \
if(uMsg == WM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
{ \
bHandled = TRUE; \
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
#define REFLECT_NOTIFY_RANGE_CODE(idFirst, idLast, cd) \
if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
{ \
bHandled = TRUE; \
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
///////////////////////////////////////////////////////////////////////////////
// Reflected message handler macros for message maps (for ATL 3.0)
#if (_ATL_VER < 0x0700)
#define REFLECTED_COMMAND_HANDLER(id, code, func) \
if(uMsg == OCM_COMMAND && id == LOWORD(wParam) && code == HIWORD(wParam)) \
{ \
bHandled = TRUE; \
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
#define REFLECTED_COMMAND_ID_HANDLER(id, func) \
if(uMsg == OCM_COMMAND && id == LOWORD(wParam)) \
{ \
bHandled = TRUE; \
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
#define REFLECTED_COMMAND_CODE_HANDLER(code, func) \
if(uMsg == OCM_COMMAND && code == HIWORD(wParam)) \
{ \
bHandled = TRUE; \
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
#define REFLECTED_COMMAND_RANGE_HANDLER(idFirst, idLast, func) \
if(uMsg == OCM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
{ \
bHandled = TRUE; \
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
#define REFLECTED_COMMAND_RANGE_CODE_HANDLER(idFirst, idLast, code, func) \
if(uMsg == OCM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
{ \
bHandled = TRUE; \
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
#define REFLECTED_NOTIFY_HANDLER(id, cd, func) \
if(uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom && cd == ((LPNMHDR)lParam)->code) \
{ \
bHandled = TRUE; \
lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
#define REFLECTED_NOTIFY_ID_HANDLER(id, func) \
if(uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \
{ \
bHandled = TRUE; \
lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
#define REFLECTED_NOTIFY_CODE_HANDLER(cd, func) \
if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \
{ \
bHandled = TRUE; \
lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
#define REFLECTED_NOTIFY_RANGE_HANDLER(idFirst, idLast, func) \
if(uMsg == OCM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
{ \
bHandled = TRUE; \
lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
#define REFLECTED_NOTIFY_RANGE_CODE_HANDLER(idFirst, idLast, cd, func) \
if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
{ \
bHandled = TRUE; \
lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
#endif // (_ATL_VER < 0x0700)
///////////////////////////////////////////////////////////////////////////////
// Dual argument helper classes (for ATL 3.0)
#if (_ATL_VER < 0x0700)
namespace ATL
{
class _U_RECT
{
public:
_U_RECT(LPRECT lpRect) : m_lpRect(lpRect)
{ }
_U_RECT(RECT& rc) : m_lpRect(&rc)
{ }
LPRECT m_lpRect;
};
class _U_MENUorID
{
public:
_U_MENUorID(HMENU hMenu) : m_hMenu(hMenu)
{ }
_U_MENUorID(UINT nID) : m_hMenu((HMENU)LongToHandle(nID))
{ }
HMENU m_hMenu;
};
class _U_STRINGorID
{
public:
_U_STRINGorID(LPCTSTR lpString) : m_lpstr(lpString)
{ }
_U_STRINGorID(UINT nID) : m_lpstr(MAKEINTRESOURCE(nID))
{ }
LPCTSTR m_lpstr;
};
}; // namespace ATL
#endif // (_ATL_VER < 0x0700)
namespace WTL
{
///////////////////////////////////////////////////////////////////////////////
// Forward notifications support for message maps (for ATL 3.0)
#if (_ATL_VER < 0x0700)
// forward notifications support
#define FORWARD_NOTIFICATIONS() \
{ \
bHandled = TRUE; \
lResult = WTL::Atl3ForwardNotifications(m_hWnd, uMsg, wParam, lParam, bHandled); \
if(bHandled) \
return TRUE; \
}
static LRESULT Atl3ForwardNotifications(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
LRESULT lResult = 0;
switch(uMsg)
{
case WM_COMMAND:
case WM_NOTIFY:
#ifndef _WIN32_WCE
case WM_PARENTNOTIFY:
#endif // !_WIN32_WCE
case WM_DRAWITEM:
case WM_MEASUREITEM:
case WM_COMPAREITEM:
case WM_DELETEITEM:
case WM_VKEYTOITEM:
case WM_CHARTOITEM:
case WM_HSCROLL:
case WM_VSCROLL:
case WM_CTLCOLORBTN:
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORMSGBOX:
case WM_CTLCOLORSCROLLBAR:
case WM_CTLCOLORSTATIC:
lResult = ::SendMessage(::GetParent(hWnd), uMsg, wParam, lParam);
break;
default:
bHandled = FALSE;
break;
}
return lResult;
}
#endif // (_ATL_VER < 0x0700)
}; // namespace WTL
#endif // __ATLWINX_H__

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,43 @@
#include "config-debug.h"
#include "../Config.h"
#include "../DebugDump.h"
#include "resource.h"
CDebugTab::CDebugTab() :
CConfigTab(IDD_TAB_DEBUG)
{
}
BOOL CDebugTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/)
{
return true;
}
LRESULT CDebugTab::OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
return (LRESULT)GetStockObject(WHITE_BRUSH);
}
void CDebugTab::LoadSettings(bool /*blockCustomSettings*/)
{
CButton(GetDlgItem(IDC_CHK_DUMP_LOW)).SetCheck((config.debug.dumpMode & DEBUG_LOW) != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_DUMP_NORMAL)).SetCheck((config.debug.dumpMode & DEBUG_NORMAL) != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_DUMP_DETAIL)).SetCheck((config.debug.dumpMode & DEBUG_DETAIL) != 0 ? BST_CHECKED : BST_UNCHECKED);
}
void CDebugTab::SaveSettings()
{
config.debug.dumpMode = 0;
if (CButton(GetDlgItem(IDC_CHK_DUMP_LOW)).GetCheck() == BST_CHECKED)
{
config.debug.dumpMode |= DEBUG_LOW;
}
if (CButton(GetDlgItem(IDC_CHK_DUMP_NORMAL)).GetCheck() == BST_CHECKED)
{
config.debug.dumpMode |= DEBUG_NORMAL;
}
if (CButton(GetDlgItem(IDC_CHK_DUMP_DETAIL)).GetCheck() == BST_CHECKED)
{
config.debug.dumpMode |= DEBUG_DETAIL;
}
}

View File

@ -0,0 +1,20 @@
#pragma once
#include "config-tab.h"
class CDebugTab :
public CConfigTab
{
public:
BEGIN_MSG_MAP(CEmulationTab)
MSG_WM_INITDIALOG(OnInitDialog)
MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic)
MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic)
END_MSG_MAP()
CDebugTab();
BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/);
LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
void LoadSettings(bool /*blockCustomSettings*/);
void SaveSettings();
};

View File

@ -0,0 +1,157 @@
#include "config-emulation.h"
#include "util.h"
#include "../Config.h"
#include "resource.h"
CEmulationTab::CEmulationTab() :
CConfigTab(IDD_TAB_EMULATION)
{
}
BOOL CEmulationTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/)
{
CComboBox nativeRes2DComboBox(GetDlgItem(IDC_CMB_NATIVE_RES_2D));
nativeRes2DComboBox.ResetContent();
nativeRes2DComboBox.AddString(L"Disable");
nativeRes2DComboBox.AddString(L"Enable optimized");
nativeRes2DComboBox.AddString(L"Enable unoptimized");
m_GamaTxt.Attach(GetDlgItem(IDC_GAMMA_VALUE));
m_GamaSpin.Attach(GetDlgItem(IDC_GAMMA_SPIN));
m_GamaSpin.SetBase(10);
m_GamaSpin.SetRange(10, 40);
m_GamaSpin.SetPos(20);
m_GamaSpin.SetBuddy(m_GamaTxt);
m_N64ResMultiplerTxt.Attach(GetDlgItem(IDC_N64_RES_MULTIPLER_TXT));
m_N64ResMultiplerSpin.Attach(GetDlgItem(IDC_N64_RES_MULTIPLER_SPIN));
m_N64ResMultiplerSpin.SetBase(10);
m_N64ResMultiplerSpin.SetRange(2, 16);
m_N64ResMultiplerSpin.SetPos(2);
m_N64ResMultiplerSpin.SetBuddy(m_N64ResMultiplerTxt);
m_GammaIcon.SubclassWindow(GetDlgItem(IDC_GAMMA_ICON));
m_GammaIcon.SetIcon(MAKEINTRESOURCE(IDI_ICON_INFO), 16, 16);
m_GammaIcon.SetBackroundBrush((HBRUSH)GetStockObject(WHITE_BRUSH));
return true;
}
LRESULT CEmulationTab::OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
return (LRESULT)GetStockObject(WHITE_BRUSH);
}
void CEmulationTab::OnGammaCorrection(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
CButton OverScan(GetDlgItem(IDC_CHK_GAMMA_CORRECTION));
if (OverScan.GetCheck() == BST_CHECKED)
{
GetDlgItem(IDC_GAMMA_ICON).ShowWindow(SW_SHOW);
GetDlgItem(IDC_GAMMA_INFO).ShowWindow(SW_SHOW);
}
else
{
GetDlgItem(IDC_GAMMA_ICON).ShowWindow(SW_HIDE);
GetDlgItem(IDC_GAMMA_INFO).ShowWindow(SW_HIDE);
}
}
void CEmulationTab::LoadSettings(bool blockCustomSettings)
{
if (!blockCustomSettings)
{
CButton(GetDlgItem(IDC_CHK_USE_PER_GAME)).SetCheck(config.generalEmulation.enableCustomSettings != 0 ? BST_CHECKED : BST_UNCHECKED);
}
CButton(GetDlgItem(IDC_CHK_N64_STYLE_MIP_MAPPING)).SetCheck(config.generalEmulation.enableLOD != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_NOISE)).SetCheck(config.generalEmulation.enableNoise != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_HWLIGHTING)).SetCheck(config.generalEmulation.enableHWLighting != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_SHADERS_STORAGE)).SetCheck(config.generalEmulation.enableShadersStorage != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_HALOS_REMOVAL)).SetCheck(config.texture.enableHalosRemoval != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_FIXTEXRECT_NEVER)).SetCheck(config.graphics2D.correctTexrectCoords == Config::tcDisable ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_FIXTEXRECT_SMART)).SetCheck(config.graphics2D.correctTexrectCoords == Config::tcSmart ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_FIXTEXRECT_FORCE)).SetCheck(config.graphics2D.correctTexrectCoords == Config::tcForce ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_BGMODE_ONEPIECE)).SetCheck(config.graphics2D.bgMode == Config::BGMode::bgOnePiece ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_BGMODE_STRIPPED)).SetCheck(config.graphics2D.bgMode == Config::BGMode::bgStripped ? BST_CHECKED : BST_UNCHECKED);
CComboBox nativeRes2DComboBox(GetDlgItem(IDC_CMB_NATIVE_RES_2D));
nativeRes2DComboBox.SetCurSel(config.graphics2D.enableNativeResTexrects);
CButton(GetDlgItem(IDC_CHK_GAMMA_CORRECTION)).SetCheck(config.gammaCorrection.force != 0 ? BST_CHECKED : BST_UNCHECKED);
int GammaPos = (int)(config.gammaCorrection.force != 0 ? config.gammaCorrection.level : 2.0) * 10;
m_GamaSpin.SetPos(GammaPos);
m_GamaTxt.SetWindowText(FormatStrW(L"%0.1f", (float)GammaPos / 10.0f).c_str());
GetDlgItem(IDC_GAMMA_ICON).ShowWindow(config.gammaCorrection.force != 0 ? SW_SHOW : SW_HIDE);
GetDlgItem(IDC_GAMMA_INFO).ShowWindow(config.gammaCorrection.force != 0 ? SW_SHOW : SW_HIDE);
CButton(GetDlgItem(IDC_FACTOR0X_RADIO)).SetCheck(config.frameBufferEmulation.nativeResFactor == 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_FACTOR1X_RADIO)).SetCheck(config.frameBufferEmulation.nativeResFactor == 1 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_FACTORXX_RADIO)).SetCheck(config.frameBufferEmulation.nativeResFactor > 1 ? BST_CHECKED : BST_UNCHECKED);
m_N64ResMultiplerSpin.SetPos(config.frameBufferEmulation.nativeResFactor > 1 ? config.frameBufferEmulation.nativeResFactor : 2);
m_N64ResMultiplerTxt.SetWindowText(FormatStrW(L"%dx", m_N64ResMultiplerSpin.GetPos()).c_str());
}
void CEmulationTab::SaveSettings()
{
config.generalEmulation.enableCustomSettings = CButton(GetDlgItem(IDC_CHK_USE_PER_GAME)).GetCheck() == BST_CHECKED ? 1 : 0;
config.generalEmulation.enableLOD = CButton(GetDlgItem(IDC_CHK_N64_STYLE_MIP_MAPPING)).GetCheck() == BST_CHECKED ? 1 : 0;
config.generalEmulation.enableNoise = CButton(GetDlgItem(IDC_CHK_NOISE)).GetCheck() == BST_CHECKED ? 1 : 0;
config.generalEmulation.enableHWLighting = CButton(GetDlgItem(IDC_CHK_HWLIGHTING)).GetCheck() == BST_CHECKED ? 1 : 0;
config.generalEmulation.enableShadersStorage = CButton(GetDlgItem(IDC_CHK_SHADERS_STORAGE)).GetCheck() == BST_CHECKED ? 1 : 0;
if (CButton(GetDlgItem(IDC_FACTOR0X_RADIO)).GetCheck() == BST_CHECKED)
{
config.frameBufferEmulation.nativeResFactor = 0;
}
else if (CButton(GetDlgItem(IDC_FACTOR1X_RADIO)).GetCheck() == BST_CHECKED)
{
config.frameBufferEmulation.nativeResFactor = 1;
}
else if (CButton(GetDlgItem(IDC_FACTORXX_RADIO)).GetCheck() == BST_CHECKED)
{
config.frameBufferEmulation.nativeResFactor = m_N64ResMultiplerSpin.GetPos();
}
config.gammaCorrection.force = CButton(GetDlgItem(IDC_CHK_GAMMA_CORRECTION)).GetCheck() == BST_CHECKED ? 1 : 0;
config.gammaCorrection.level = ((float)m_GamaSpin.GetPos()) / 10;
config.graphics2D.enableNativeResTexrects = CComboBox(GetDlgItem(IDC_CMB_NATIVE_RES_2D)).GetCurSel();
config.texture.enableHalosRemoval = CButton(GetDlgItem(IDC_CHK_HALOS_REMOVAL)).GetCheck() == BST_CHECKED ? 1 : 0;
if (CButton(GetDlgItem(IDC_FIXTEXRECT_NEVER)).GetCheck() == BST_CHECKED)
{
config.graphics2D.correctTexrectCoords = Config::tcDisable;
}
else if (CButton(GetDlgItem(IDC_FIXTEXRECT_SMART)).GetCheck() == BST_CHECKED)
{
config.graphics2D.correctTexrectCoords = Config::tcSmart;
}
else if (CButton(GetDlgItem(IDC_FIXTEXRECT_FORCE)).GetCheck() == BST_CHECKED)
{
config.graphics2D.correctTexrectCoords = Config::tcForce;
}
if (CButton(GetDlgItem(IDC_BGMODE_ONEPIECE)).GetCheck() == BST_CHECKED)
{
config.graphics2D.bgMode = Config::BGMode::bgOnePiece;
}
else if (CButton(GetDlgItem(IDC_BGMODE_STRIPPED)).GetCheck() == BST_CHECKED)
{
config.graphics2D.bgMode = Config::BGMode::bgStripped;
}
}
LRESULT CEmulationTab::OnScroll(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
{
LONG CtrlId = CWindow((HWND)lParam).GetWindowLong(GWL_ID);
if (CtrlId == IDC_GAMMA_SPIN)
{
int Pos = m_GamaSpin.GetPos();
m_GamaTxt.SetWindowText(FormatStrW(L"%0.1f", (float)Pos / 10.0f).c_str());
}
else if (CtrlId == IDC_N64_RES_MULTIPLER_SPIN)
{
int Pos = m_N64ResMultiplerSpin.GetPos();
m_N64ResMultiplerTxt.SetWindowText(FormatStrW(L"%dx", Pos).c_str());
}
return 0;
}

View File

@ -0,0 +1,32 @@
#pragma once
#include "config-tab.h"
#include "wtl-BitmapPicture.h"
#include "resource.h"
class CEmulationTab :
public CConfigTab
{
public:
BEGIN_MSG_MAP(CEmulationTab)
MSG_WM_INITDIALOG(OnInitDialog)
MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic)
MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic)
MESSAGE_HANDLER(WM_VSCROLL, OnScroll)
COMMAND_HANDLER_EX(IDC_CHK_GAMMA_CORRECTION, BN_CLICKED, OnGammaCorrection)
REFLECT_NOTIFICATIONS()
END_MSG_MAP()
CEmulationTab();
BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/);
LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
void OnGammaCorrection(UINT /*Code*/, int id, HWND /*ctl*/);
void LoadSettings(bool /*blockCustomSettings*/);
void SaveSettings();
private:
LRESULT OnScroll(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/);
CEdit m_GamaTxt, m_N64ResMultiplerTxt;
CUpDownCtrl m_GamaSpin, m_N64ResMultiplerSpin;
CBitmapPicture m_GammaIcon;
};

View File

@ -0,0 +1,104 @@
#include "config-framebuffer.h"
#include "resource.h"
#include "../Config.h"
CFrameBufferTab::CFrameBufferTab() :
CConfigTab(IDD_TAB_FRAME_BUFFER)
{
}
BOOL CFrameBufferTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/)
{
m_EmulateFBIcon.SubclassWindow(GetDlgItem(IDC_EMULATE_FB_ICON));
m_EmulateFBIcon.SetIcon(MAKEINTRESOURCE(IDI_ICON_WARNING), 16, 16);
m_EmulateFBIcon.SetBackroundBrush((HBRUSH)GetStockObject(WHITE_BRUSH));
CComboBox frameBufferSwapComboBox(GetDlgItem(IDC_CMB_FRAMEBUFFER_SWAP));
frameBufferSwapComboBox.AddString(L"Vertical interrupt (recommended, fewest game issues)");
frameBufferSwapComboBox.AddString(L"VI origin change (faster, few game issues)");
frameBufferSwapComboBox.AddString(L"Color buffer change (fastest, some game issues)");
CComboBox copyColorBufferComboBox(GetDlgItem(IDC_CMB_COPY_COLOR_BUFFER));
copyColorBufferComboBox.AddString(L"Never (fastest, many game issues)");
copyColorBufferComboBox.AddString(L"Synchronous (slowest, fewest game issues)");
copyColorBufferComboBox.AddString(L"Asynchronous (fast, few game issues)");
CComboBox copyDepthBufferComboBox(GetDlgItem(IDC_CMB_COPY_DEPTH_BUFFER));
copyDepthBufferComboBox.AddString(L"Never (fastest, most game issues)");
copyDepthBufferComboBox.AddString(L"From VRAM (slow, some game issues)");
copyDepthBufferComboBox.AddString(L"In software (fast, fewest game issues)");
CComboBox n64DepthCompareComboBox(GetDlgItem(IDC_CMB_N64_DEPTH_COMPARE));
n64DepthCompareComboBox.AddString(L"Disable");
n64DepthCompareComboBox.AddString(L"Fast");
n64DepthCompareComboBox.AddString(L"Compatible");
return true;
}
LRESULT CFrameBufferTab::OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
return (LRESULT)GetStockObject(WHITE_BRUSH);
}
LRESULT CFrameBufferTab::OnEnableFramebuffer(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
bool fbEmulationEnabled = CButton(GetDlgItem(IDC_CHK_ENABLE_FRAMEBUFFER)).GetCheck() == BST_CHECKED;
bool fbInfoEnabled = CButton(GetDlgItem(IDC_CHK_FB_INFO_ENABLE)).GetCheck() == BST_CHECKED;
CButton(GetDlgItem(IDC_CHK_COPY_AUX_BUFFERS)).EnableWindow(fbEmulationEnabled);
CButton(GetDlgItem(IDC_CMB_FRAMEBUFFER_SWAP)).EnableWindow(fbEmulationEnabled);
CButton(GetDlgItem(IDC_CHK_FB_INFO_ENABLE)).EnableWindow(fbEmulationEnabled);
CButton(GetDlgItem(IDC_CMB_COPY_COLOR_BUFFER)).EnableWindow(fbEmulationEnabled);
CButton(GetDlgItem(IDC_CMB_COPY_DEPTH_BUFFER)).EnableWindow(fbEmulationEnabled);
CButton(GetDlgItem(IDC_CMB_N64_DEPTH_COMPARE)).EnableWindow(fbEmulationEnabled);
CButton(GetDlgItem(IDC_CHK_FORCE_DEPTH_BUFFER_CLEAR)).EnableWindow(fbEmulationEnabled);
CButton(GetDlgItem(IDC_CHK_RENDER_FRAMEBUFFER)).EnableWindow(fbEmulationEnabled);
CButton(GetDlgItem(IDC_CHK_COPY_DEPTH_TO_MAIN_DEPTH_BUFFER)).EnableWindow(fbEmulationEnabled);
CButton(GetDlgItem(IDC_CHK_READ_COLOR_CHUNK)).EnableWindow(fbEmulationEnabled && fbInfoEnabled);
CButton(GetDlgItem(IDC_CHK_READ_DEPTH_CHUNK)).EnableWindow(fbEmulationEnabled && fbInfoEnabled);
return 0;
}
LRESULT CFrameBufferTab::OnFbInfoEnable(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
bool fbInfoEnabled = CButton(GetDlgItem(IDC_CHK_FB_INFO_ENABLE)).GetCheck() == BST_CHECKED;
CButton(GetDlgItem(IDC_CHK_READ_COLOR_CHUNK)).EnableWindow(fbInfoEnabled);
CButton(GetDlgItem(IDC_CHK_READ_DEPTH_CHUNK)).EnableWindow(fbInfoEnabled);
return 0;
}
void CFrameBufferTab::LoadSettings(bool /*blockCustomSettings*/)
{
const bool fbEmulationEnabled = config.frameBufferEmulation.enable != 0;
CButton(GetDlgItem(IDC_CHK_ENABLE_FRAMEBUFFER)).SetCheck(fbEmulationEnabled != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_COPY_AUX_BUFFERS)).SetCheck(config.frameBufferEmulation.copyAuxToRDRAM != 0 ? BST_CHECKED : BST_UNCHECKED);
CComboBox(GetDlgItem(IDC_CMB_FRAMEBUFFER_SWAP)).SetCurSel(config.frameBufferEmulation.bufferSwapMode);
CButton(GetDlgItem(IDC_CHK_FB_INFO_ENABLE)).SetCheck(config.frameBufferEmulation.fbInfoDisabled == 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_READ_COLOR_CHUNK)).SetCheck(config.frameBufferEmulation.fbInfoReadColorChunk != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_READ_DEPTH_CHUNK)).SetCheck(config.frameBufferEmulation.fbInfoReadDepthChunk != 0 ? BST_CHECKED : BST_UNCHECKED);
CComboBox(GetDlgItem(IDC_CMB_COPY_COLOR_BUFFER)).SetCurSel(config.frameBufferEmulation.copyToRDRAM);
CComboBox(GetDlgItem(IDC_CMB_COPY_DEPTH_BUFFER)).SetCurSel(config.frameBufferEmulation.copyDepthToRDRAM);
CComboBox(GetDlgItem(IDC_CMB_N64_DEPTH_COMPARE)).SetCurSel(config.frameBufferEmulation.N64DepthCompare);
CButton(GetDlgItem(IDC_CHK_FORCE_DEPTH_BUFFER_CLEAR)).SetCheck(config.frameBufferEmulation.forceDepthBufferClear != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_RENDER_FRAMEBUFFER)).SetCheck(config.frameBufferEmulation.copyFromRDRAM != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_COPY_DEPTH_TO_MAIN_DEPTH_BUFFER)).SetCheck(config.frameBufferEmulation.copyDepthToMainDepthBuffer != 0 ? BST_CHECKED : BST_UNCHECKED);
OnFbInfoEnable(0, 0, NULL);
OnEnableFramebuffer(0, 0, NULL);
}
void CFrameBufferTab::SaveSettings()
{
config.frameBufferEmulation.enable = CButton(GetDlgItem(IDC_CHK_ENABLE_FRAMEBUFFER)).GetCheck() == BST_CHECKED ? 1 : 0;
config.frameBufferEmulation.copyAuxToRDRAM = CButton(GetDlgItem(IDC_CHK_COPY_AUX_BUFFERS)).GetCheck() == BST_CHECKED ? 1 : 0;
config.frameBufferEmulation.bufferSwapMode = CComboBox(GetDlgItem(IDC_CMB_FRAMEBUFFER_SWAP)).GetCurSel();
config.frameBufferEmulation.fbInfoDisabled = CButton(GetDlgItem(IDC_CHK_FB_INFO_ENABLE)).GetCheck() == BST_CHECKED ? 1 : 0;
config.frameBufferEmulation.fbInfoReadColorChunk = CButton(GetDlgItem(IDC_CHK_READ_COLOR_CHUNK)).GetCheck() == BST_CHECKED ? 1 : 0;
config.frameBufferEmulation.fbInfoReadDepthChunk = CButton(GetDlgItem(IDC_CHK_READ_DEPTH_CHUNK)).GetCheck() == BST_CHECKED ? 1 : 0;
config.frameBufferEmulation.copyToRDRAM = CComboBox(GetDlgItem(IDC_CMB_COPY_COLOR_BUFFER)).GetCurSel();
config.frameBufferEmulation.copyDepthToRDRAM = CComboBox(GetDlgItem(IDC_CMB_COPY_DEPTH_BUFFER)).GetCurSel();
config.frameBufferEmulation.N64DepthCompare = CComboBox(GetDlgItem(IDC_CMB_N64_DEPTH_COMPARE)).GetCurSel();
config.frameBufferEmulation.forceDepthBufferClear = CButton(GetDlgItem(IDC_CHK_FORCE_DEPTH_BUFFER_CLEAR)).GetCheck() == BST_CHECKED ? 1 : 0;
config.frameBufferEmulation.copyFromRDRAM = CButton(GetDlgItem(IDC_CHK_RENDER_FRAMEBUFFER)).GetCheck() == BST_CHECKED ? 1 : 0;
config.frameBufferEmulation.copyDepthToMainDepthBuffer = CButton(GetDlgItem(IDC_CHK_COPY_DEPTH_TO_MAIN_DEPTH_BUFFER)).GetCheck() == BST_CHECKED ? 1 : 0;
}

View File

@ -0,0 +1,29 @@
#pragma once
#include "config-tab.h"
#include "wtl-BitmapPicture.h"
#include "resource.h"
class CFrameBufferTab :
public CConfigTab
{
public:
BEGIN_MSG_MAP(CFrameBufferTab)
MSG_WM_INITDIALOG(OnInitDialog)
MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic)
MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic)
COMMAND_HANDLER_EX(IDC_CHK_ENABLE_FRAMEBUFFER, BN_CLICKED, OnEnableFramebuffer)
COMMAND_HANDLER_EX(IDC_CHK_FB_INFO_ENABLE, BN_CLICKED, OnFbInfoEnable)
END_MSG_MAP()
CFrameBufferTab();
BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/);
LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnEnableFramebuffer(UINT /*Code*/, int id, HWND /*ctl*/);
LRESULT OnFbInfoEnable(UINT /*Code*/, int id, HWND /*ctl*/);
void LoadSettings(bool blockCustomSettings);
void SaveSettings();
private:
CBitmapPicture m_EmulateFBIcon;
};

View File

@ -0,0 +1,286 @@
#include "config-osd.h"
#include "resource.h"
#include "util.h"
#include "../Config.h"
#include "FontInfo.h"
COsdTab::COsdTab() :
CConfigTab(IDD_TAB_OSD),
m_PosTopLeft(IDI_OSD_TOP_LEFT),
m_PosTop(IDI_OSD_TOP),
m_PosTopRight(IDI_OSD_TOP_RIGHT),
m_PosCenterLeft(IDI_OSD_LEFT),
m_PosCenter(0),
m_PosCenterRight(IDI_OSD_RIGHT),
m_PosBottomLeft(IDI_OSD_BOTTOM_LEFT),
m_PosBottom(IDI_OSD_BOTTOM),
m_PosBottomRight(IDI_OSD_BOTTOM_RIGHT)
{
}
BOOL COsdTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/)
{
m_PosTopLeft.SubclassWindow(GetDlgItem(IDC_OSD_TOP_LEFT));
m_PosTop.SubclassWindow(GetDlgItem(IDC_OSD_TOP));
m_PosTopRight.SubclassWindow(GetDlgItem(IDC_OSD_TOP_RIGHT));
m_PosCenterLeft.SubclassWindow(GetDlgItem(IDC_OSD_CENTER_LEFT));
m_PosCenter.SubclassWindow(GetDlgItem(IDC_OSD_CENTER));
m_PosCenterRight.SubclassWindow(GetDlgItem(IDC_OSD_CENTER_RIGHT));
m_PosBottomLeft.SubclassWindow(GetDlgItem(IDC_OSD_BOTTOM_LEFT));
m_PosBottom.SubclassWindow(GetDlgItem(IDC_OSD_BOTTOM));
m_PosBottomRight.SubclassWindow(GetDlgItem(IDC_OSD_BOTTOM_RIGHT));
m_Fonts.Attach(GetDlgItem(IDC_FONTS));
m_OsdColor.SubclassWindow(GetDlgItem(IDC_OSD_COLOR));
m_OsdPreview.SubclassWindow(GetDlgItem(IDC_OSD_PREVIEW));
m_FontSizeTxt.Attach(GetDlgItem(IDC_FONT_SIZE_TXT));
m_FontSizeSpin.Attach(GetDlgItem(IDC_FONT_SIZE_SPIN));
m_FontSizeSpin.SetBase(10);
m_FontSizeSpin.SetRange(6, 99);
m_FontSizeSpin.SetBuddy(m_FontSizeTxt);
m_PosCenterLeft.EnableWindow(false);
m_PosCenter.EnableWindow(false);
m_PosCenterRight.EnableWindow(false);
FontList fonts = GetFontFiles();
HTREEITEM hCurrentItem = TVI_ROOT;
for (FontList::const_iterator itr = fonts.begin(); itr != fonts.end(); itr++)
{
std::wstring FontFile = ToUTF16(itr->first.c_str());
std::wstring FontName = ToUTF16(itr->second.c_str());
TVINSERTSTRUCT tv = { 0 };
wchar_t Item[500];
tv.item.mask = TVIF_TEXT;
tv.item.pszText = Item;
tv.item.cchTextMax = sizeof(Item) / sizeof(Item[0]);
tv.item.hItem = m_Fonts.GetChildItem(TVI_ROOT);
HTREEITEM hParent = TVI_ROOT;
while (tv.item.hItem)
{
m_Fonts.GetItem(&tv.item);
if (wcscmp(FontName.c_str(), Item) == 0)
{
hParent = tv.item.hItem;
break;
}
tv.item.hItem = m_Fonts.GetNextSiblingItem(tv.item.hItem);
}
if (hParent == TVI_ROOT)
{
tv.item.mask = TVIF_TEXT;
tv.item.pszText = (LPWSTR)FontName.c_str();
tv.item.cchTextMax = FontName.length();
tv.hInsertAfter = TVI_SORT;
tv.hParent = TVI_ROOT;
hParent = m_Fonts.InsertItem(&tv);
}
tv.item.mask = TVIF_TEXT;
tv.item.pszText = (LPWSTR)FontFile.c_str();
tv.item.cchTextMax = FontFile.length();
tv.hInsertAfter = TVI_SORT;
tv.hParent = hParent;
m_Fonts.InsertItem(&tv);
}
if (hCurrentItem != TVI_ROOT)
{
m_Fonts.SelectItem(hCurrentItem);
m_Fonts.SetItemState(hCurrentItem, TVIF_STATE | TVIS_SELECTED, TVIF_STATE | TVIS_SELECTED);
m_Fonts.SetFocus();
}
return true;
}
LRESULT COsdTab::OnScroll(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
{
LONG CtrlId = CWindow((HWND)lParam).GetWindowLong(GWL_ID);
if (CtrlId == IDC_FONT_SIZE_SPIN)
{
m_OsdPreview.SetFontSize(m_FontSizeSpin.GetPos());
}
return 0;
}
void COsdTab::ClearOsdChecked()
{
m_PosTopLeft.SetChecked(false);
m_PosTopLeft.Invalidate();
m_PosTop.SetChecked(false);
m_PosTop.Invalidate();
m_PosTopRight.SetChecked(false);
m_PosTopRight.Invalidate();
m_PosBottomLeft.SetChecked(false);
m_PosBottomLeft.Invalidate();
m_PosBottom.SetChecked(false);
m_PosBottom.Invalidate();
m_PosBottomRight.SetChecked(false);
m_PosBottomRight.Invalidate();
}
LRESULT COsdTab::OnOsdTopLeft(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
ClearOsdChecked();
m_PosTopLeft.SetChecked(true);
return 0;
}
LRESULT COsdTab::OnOsdTop(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
ClearOsdChecked();
m_PosTop.SetChecked(true);
return 0;
}
LRESULT COsdTab::OnOsdTopRight(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
ClearOsdChecked();
m_PosTopRight.SetChecked(true);
return 0;
}
LRESULT COsdTab::OnOsdBottomLeft(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
ClearOsdChecked();
m_PosBottomLeft.SetChecked(true);
return 0;
}
LRESULT COsdTab::OnOsdBottom(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
ClearOsdChecked();
m_PosBottom.SetChecked(true);
return 0;
}
LRESULT COsdTab::OnOsdBottomRight(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
ClearOsdChecked();
m_PosBottomRight.SetChecked(true);
return 0;
}
LRESULT COsdTab::OnFontItemChanged(NMHDR* /*phdr*/)
{
m_OsdPreview.SetFont(GetSelectedFont());
return 0;
}
LRESULT COsdTab::OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
return (LRESULT)GetStockObject(WHITE_BRUSH);
}
LRESULT COsdTab::OnNotifyOsdColor(LPNMHDR /*pnmh*/)
{
m_OsdPreview.SetColor(m_OsdColor.Red(), m_OsdColor.Green(), m_OsdColor.Blue());
m_OsdPreview.Invalidate();
return 0;
}
void COsdTab::LoadSettings(bool /*blockCustomSettings*/)
{
m_FontSizeTxt.SetWindowText(FormatStrW(L"%d", config.font.size).c_str());
m_FontSizeSpin.SetPos(config.font.size);
m_OsdColor.SetColor(config.font.color[0], config.font.color[1], config.font.color[2]);
m_OsdPreview.SetColor(config.font.color[0], config.font.color[1], config.font.color[2]);
m_OsdPreview.SetFontSize(config.font.size);
m_PosTopLeft.SetChecked(config.onScreenDisplay.pos == Config::posTopLeft);
m_PosTop.SetChecked(config.onScreenDisplay.pos == Config::posTopCenter);
m_PosTopRight.SetChecked(config.onScreenDisplay.pos == Config::posTopRight);
m_PosBottomLeft.SetChecked(config.onScreenDisplay.pos == Config::posBottomLeft);
m_PosBottom.SetChecked(config.onScreenDisplay.pos == Config::posBottomCenter);
m_PosBottomRight.SetChecked(config.onScreenDisplay.pos == Config::posBottomRight);
CButton(GetDlgItem(IDC_CHK_FPS)).SetCheck(config.onScreenDisplay.fps != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_VIS)).SetCheck(config.onScreenDisplay.vis != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_PERCENT)).SetCheck(config.onScreenDisplay.percent != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_INTERNAL_RESOLUTION)).SetCheck(config.onScreenDisplay.internalResolution != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_RENDERING_RESOLUTION)).SetCheck(config.onScreenDisplay.renderingResolution != 0 ? BST_CHECKED : BST_UNCHECKED);
std::wstring CurrentFile = ToUTF16(config.font.name.c_str());
TVINSERTSTRUCT tv = { 0 };
wchar_t Item[500];
tv.item.mask = TVIF_TEXT;
tv.item.pszText = Item;
tv.item.cchTextMax = sizeof(Item) / sizeof(Item[0]);
tv.item.hItem = m_Fonts.GetChildItem(TVI_ROOT);
HTREEITEM hParent = TVI_ROOT, hCurrentItem = NULL;
while (hCurrentItem == NULL && tv.item.hItem)
{
m_Fonts.GetItem(&tv.item);
HTREEITEM hChild = m_Fonts.GetChildItem(tv.item.hItem);
HTREEITEM NextItem = m_Fonts.GetNextSiblingItem(tv.item.hItem);
if (hCurrentItem == NULL && hChild != NULL)
{
tv.item.hItem = hChild;
while (hCurrentItem == NULL && tv.item.hItem)
{
m_Fonts.GetItem(&tv.item);
if (Item == CurrentFile)
{
hCurrentItem = tv.item.hItem;
}
tv.item.hItem = m_Fonts.GetNextSiblingItem(tv.item.hItem);
}
}
tv.item.hItem = NextItem;
}
if (hCurrentItem != TVI_ROOT)
{
m_Fonts.SelectItem(hCurrentItem);
m_Fonts.SetItemState(hCurrentItem, TVIF_STATE | TVIS_SELECTED, TVIF_STATE | TVIS_SELECTED);
m_Fonts.SetFocus();
}
}
void COsdTab::SaveSettings()
{
if (m_PosTopLeft.isChecked()) { config.onScreenDisplay.pos = Config::posTopLeft; }
else if (m_PosTop.isChecked()) { config.onScreenDisplay.pos = Config::posTopCenter; }
else if (m_PosTopRight.isChecked()) { config.onScreenDisplay.pos = Config::posTopRight; }
else if (m_PosBottomLeft.isChecked()) { config.onScreenDisplay.pos = Config::posBottomLeft; }
else if (m_PosBottom.isChecked()) { config.onScreenDisplay.pos = Config::posBottomCenter; }
else if (m_PosBottomRight.isChecked()) { config.onScreenDisplay.pos = Config::posBottomRight; }
config.onScreenDisplay.fps = CButton(GetDlgItem(IDC_CHK_FPS)).GetCheck() == BST_CHECKED ? 1 : 0;
config.onScreenDisplay.vis = CButton(GetDlgItem(IDC_CHK_VIS)).GetCheck() == BST_CHECKED ? 1 : 0;
config.onScreenDisplay.percent = CButton(GetDlgItem(IDC_CHK_PERCENT)).GetCheck() == BST_CHECKED ? 1 : 0;
config.onScreenDisplay.internalResolution = CButton(GetDlgItem(IDC_INTERNAL_RESOLUTION)).GetCheck() == BST_CHECKED ? 1 : 0;
config.onScreenDisplay.renderingResolution = CButton(GetDlgItem(IDC_RENDERING_RESOLUTION)).GetCheck() == BST_CHECKED ? 1 : 0;
config.font.name = FromUTF16(GetSelectedFont().c_str());
config.font.size = m_FontSizeSpin.GetPos();
config.font.color[0] = m_OsdColor.Red();
config.font.color[1] = m_OsdColor.Green();
config.font.color[2] = m_OsdColor.Blue();
config.font.color[3] = 0;
config.font.colorf[0] = (float)m_OsdColor.Red();
config.font.colorf[1] = (float)m_OsdColor.Green();
config.font.colorf[2] = (float)m_OsdColor.Blue();
config.font.colorf[3] = 0.0f;
}
std::wstring COsdTab::GetSelectedFont()
{
HTREEITEM hItem = m_Fonts.GetSelectedItem();
if (hItem == NULL)
{
return L"";
}
HTREEITEM hChild = m_Fonts.GetChildItem(hItem);
if (hChild != NULL)
{
hItem = hChild;
}
wchar_t ItemText[MAX_PATH];
if (!m_Fonts.GetItemText(hItem, ItemText, sizeof(ItemText) / sizeof(ItemText[0])))
{
return L"";
}
return std::wstring(ItemText);
}

View File

@ -0,0 +1,57 @@
#pragma once
#include "config-tab.h"
#include "wtl-OsdButton.h"
#include "wtl-ColorButton.h"
#include "wtl-OsdPreview.h"
#include "resource.h"
#include <string>
class COsdTab :
public CConfigTab
{
public:
BEGIN_MSG_MAP(COsdTab)
MSG_WM_INITDIALOG(OnInitDialog)
NOTIFY_HANDLER_EX(IDC_FONTS, TVN_SELCHANGED, OnFontItemChanged)
MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic)
MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic)
MESSAGE_HANDLER(WM_VSCROLL, OnScroll)
COMMAND_ID_HANDLER(IDC_OSD_TOP_LEFT, OnOsdTopLeft)
COMMAND_ID_HANDLER(IDC_OSD_TOP, OnOsdTop)
COMMAND_ID_HANDLER(IDC_OSD_TOP_RIGHT, OnOsdTopRight)
COMMAND_ID_HANDLER(IDC_OSD_BOTTOM_LEFT, OnOsdBottomLeft)
COMMAND_ID_HANDLER(IDC_OSD_BOTTOM, OnOsdBottom)
COMMAND_ID_HANDLER(IDC_OSD_BOTTOM_RIGHT, OnOsdBottomRight)
NOTIFY_HANDLER_EX(IDC_OSD_COLOR, CColorButton::CPN_SELCHANGE, OnNotifyOsdColor)
REFLECT_NOTIFICATIONS()
END_MSG_MAP()
COsdTab();
BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/);
LRESULT OnScroll(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/);
void ClearOsdChecked();
LRESULT OnOsdTopLeft(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnOsdTop(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnOsdTopRight(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnOsdBottomLeft(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnOsdBottom(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnOsdBottomRight(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnFontItemChanged(NMHDR* /*phdr*/);
LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnNotifyOsdColor(LPNMHDR pnmh);
void LoadSettings(bool blockCustomSettings);
void SaveSettings();
private:
std::wstring GetSelectedFont();
COSDButton m_PosTopLeft, m_PosTop, m_PosTopRight;
COSDButton m_PosCenterLeft, m_PosCenter, m_PosCenterRight;
COSDButton m_PosBottomLeft, m_PosBottom, m_PosBottomRight;
CTreeViewCtrl m_Fonts;
CEdit m_FontSizeTxt;
CUpDownCtrl m_FontSizeSpin;
CColorButton m_OsdColor;
COsdPreview m_OsdPreview;
};

View File

@ -0,0 +1,61 @@
#include "config-overscan.h"
#include "util.h"
#include "resource.h"
COverScanTab::COverScanTab()
{
IDD = IDD_TAB_OVERSCAN;
}
BOOL COverScanTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/)
{
m_LeftTxt.Attach(GetDlgItem(IDC_OVERSCAN_LEFT_TXT));
m_LeftSpin.Attach(GetDlgItem(IDC_OVERSCAN_LEFT_SPIN));
m_LeftSpin.SetBase(10);
m_LeftSpin.SetRange(-99, 99);
m_LeftSpin.SetBuddy(m_LeftTxt);
m_RightTxt.Attach(GetDlgItem(IDC_OVERSCAN_RIGHT_TXT));
m_RightSpin.Attach(GetDlgItem(IDC_OVERSCAN_RIGHT_SPIN));
m_RightSpin.SetBase(10);
m_RightSpin.SetRange(-99, 99);
m_RightSpin.SetBuddy(m_RightTxt);
m_TopTxt.Attach(GetDlgItem(IDC_OVERSCAN_TOP_TXT));
m_TopSpin.Attach(GetDlgItem(IDC_OVERSCAN_TOP_SPIN));
m_TopSpin.SetBase(10);
m_TopSpin.SetRange(-99, 99);
m_TopSpin.SetBuddy(m_TopTxt);
m_BottomTxt.Attach(GetDlgItem(IDC_OVERSCAN_BOTTOM_TXT));
m_BottomSpin.Attach(GetDlgItem(IDC_OVERSCAN_BOTTOM_SPIN));
m_BottomSpin.SetBase(10);
m_BottomSpin.SetRange(-99, 99);
m_BottomSpin.SetBuddy(m_BottomTxt);
return true;
}
void COverScanTab::SetValue(int32_t Left, int32_t Right, int32_t Top, int32_t Bottom)
{
m_LeftTxt.SetWindowText(FormatStrW(L"%d", Left).c_str());
m_LeftSpin.SetPos(Left);
m_RightTxt.SetWindowText(FormatStrW(L"%d", Right).c_str());
m_RightSpin.SetPos(Right);
m_TopTxt.SetWindowText(FormatStrW(L"%d", Top).c_str());
m_TopSpin.SetPos(Top);
m_BottomTxt.SetWindowText(FormatStrW(L"%d", Bottom).c_str());
m_BottomSpin.SetPos(Bottom);
}
void COverScanTab::GetValue(int32_t & Left, int32_t & Right, int32_t & Top, int32_t & Bottom)
{
Left = m_LeftSpin.GetPos();
Right = m_RightSpin.GetPos();
Top = m_TopSpin.GetPos();
Bottom = m_BottomSpin.GetPos();
}
LRESULT COverScanTab::OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
return (LRESULT)GetStockObject(WHITE_BRUSH);
}

View File

@ -0,0 +1,27 @@
#pragma once
#include <stdint.h>
#include "wtl.h"
class COverScanTab :
public CDialogImpl<COverScanTab>
{
public:
uint32_t IDD;
BEGIN_MSG_MAP(CAboutCreditsTab)
MSG_WM_INITDIALOG(OnInitDialog)
MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic)
MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic)
END_MSG_MAP()
COverScanTab();
BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam);
void SetValue(int32_t Left, int32_t Right, int32_t Top, int32_t Bottom);
void GetValue(int32_t & Left, int32_t & Right, int32_t & Top, int32_t & Bottom);
LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
private:
CEdit m_LeftTxt, m_RightTxt, m_TopTxt, m_BottomTxt;
CUpDownCtrl m_LeftSpin, m_RightSpin, m_TopSpin, m_BottomSpin;
};

View File

@ -0,0 +1,11 @@
#include "config-tab.h"
CConfigTab::CConfigTab(uint32_t _IDD) :
IDD(_IDD)
{
}
CConfigTab::~CConfigTab()
{
}

View File

@ -0,0 +1,19 @@
#pragma once
#include <stdint.h>
#include "wtl.h"
class CConfigTab :
public CDialogImpl<CConfigTab>
{
public:
CConfigTab(uint32_t _IDD);
virtual ~CConfigTab();
BEGIN_MSG_MAP(CConfigTab)
END_MSG_MAP()
virtual void LoadSettings(bool blockCustomSettings) = 0;
virtual void SaveSettings() = 0;
uint32_t IDD;
};

View File

@ -0,0 +1,229 @@
#include "config-texture.h"
#include "resource.h"
#include "util.h"
#include "../Config.h"
#include <Shlobj.h>
CTextureEnhancementTab::CTextureEnhancementTab() :
CConfigTab(IDD_TAB_TEXTURE_ENHANCEMENT)
{
}
BOOL CTextureEnhancementTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/)
{
CComboBox filterComboBox(GetDlgItem(IDC_CMB_FILTER));
filterComboBox.AddString(L"None");
filterComboBox.AddString(L"Smooth filtering 1");
filterComboBox.AddString(L"Smooth filtering 2");
filterComboBox.AddString(L"Smooth filtering 3");
filterComboBox.AddString(L"Smooth filtering 4");
filterComboBox.AddString(L"Sharp filtering 1");
filterComboBox.AddString(L"Sharp filtering 2");
CComboBox enhancementComboBox(GetDlgItem(IDC_CMB_ENHANCEMENT));
enhancementComboBox.AddString(L"None");
enhancementComboBox.AddString(L"Store");
enhancementComboBox.AddString(L"X2");
enhancementComboBox.AddString(L"X2SAI");
enhancementComboBox.AddString(L"HQ2X");
enhancementComboBox.AddString(L"HQ2XS");
enhancementComboBox.AddString(L"LQ2X");
enhancementComboBox.AddString(L"LQ2XS");
enhancementComboBox.AddString(L"HQ4X");
enhancementComboBox.AddString(L"2xBRZ");
enhancementComboBox.AddString(L"3xBRZ");
enhancementComboBox.AddString(L"4xBRZ");
enhancementComboBox.AddString(L"5xBRZ");
enhancementComboBox.AddString(L"6xBRZ");
m_TextureFilterCacheTxt.Attach(GetDlgItem(IDC_TEXTURE_FILTER_CACHE_EDIT));
m_TextureFilterCacheSpin.Attach(GetDlgItem(IDC_TEXTURE_FILTER_CACHE_SPIN));
m_TextureFilterCacheSpin.SetBase(10);
m_TextureFilterCacheSpin.SetRange(0, 20);
m_TextureFilterCacheSpin.SetPos(0);
m_TextureFilterCacheSpin.SetBuddy(m_TextureFilterCacheTxt);
return true;
}
LRESULT CTextureEnhancementTab::OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
return (LRESULT)GetStockObject(WHITE_BRUSH);
}
void CTextureEnhancementTab::OnFileStorage(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
bool UseFileStorage = !CButton(GetDlgItem(IDC_CHK_ENHANCED_TEX_FILE_STORAGE)).GetCheck() == BST_CHECKED;
CButton(GetDlgItem(IDC_TEXTURE_FILTER_CACHE_STATIC)).EnableWindow(UseFileStorage);
CButton(GetDlgItem(IDC_TEXTURE_FILTER_CACHE_EDIT)).EnableWindow(UseFileStorage);
CButton(GetDlgItem(IDC_TEXTURE_FILTER_CACHE_SPIN)).EnableWindow(UseFileStorage);
}
void CTextureEnhancementTab::OnTexturePack(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
bool UseTextPack = CButton(GetDlgItem(IDC_CHK_TEXTURE_PACK)).GetCheck() == BST_CHECKED;
CButton(GetDlgItem(IDC_TEX_PACK_PATH_STATIC)).EnableWindow(UseTextPack);
CButton(GetDlgItem(IDC_TEX_PACK_PATH_EDIT)).EnableWindow(UseTextPack);
CButton(GetDlgItem(IDC_TEX_PACK_PATH_BTN)).EnableWindow(UseTextPack);
CButton(GetDlgItem(IDC_TEX_CACHE_PATH_STATIC)).EnableWindow(UseTextPack);
CButton(GetDlgItem(IDC_TEX_CACHE_PATH_EDIT)).EnableWindow(UseTextPack);
CButton(GetDlgItem(IDC_TEX_CACHE_PATH_BTN)).EnableWindow(UseTextPack);
CButton(GetDlgItem(IDC_TEX_DUMP_PATH_STATIC)).EnableWindow(UseTextPack);
CButton(GetDlgItem(IDC_TEX_DUMP_PATH_EDIT)).EnableWindow(UseTextPack);
CButton(GetDlgItem(IDC_TEX_DUMP_PATH_BTN)).EnableWindow(UseTextPack);
CButton(GetDlgItem(IDC_CHK_ALPHA_CHANNEL)).EnableWindow(UseTextPack);
CButton(GetDlgItem(IDC_CHK_ALTERNATIVE_CRC)).EnableWindow(UseTextPack);
CButton(GetDlgItem(IDC_CHK_HIRES_TEX_FILESTORAGE)).EnableWindow(UseTextPack);
CButton(GetDlgItem(IDC_CHK_TEXTURE_DUMP)).EnableWindow(UseTextPack);
}
LRESULT CTextureEnhancementTab::OnScroll(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
{
LONG CtrlId = CWindow((HWND)lParam).GetWindowLong(GWL_ID);
if (CtrlId == IDC_TEXTURE_FILTER_CACHE_SPIN)
{
int Pos = m_TextureFilterCacheSpin.GetPos();
if (Pos == 20)
{
m_TextureFilterCacheTxt.SetWindowText(L"999 mb");
}
else
{
m_TextureFilterCacheTxt.SetWindowText(FormatStrW(L"%d mb", Pos * 50).c_str());
}
}
return 0;
}
void CTextureEnhancementTab::LoadSettings(bool /*blockCustomSettings*/)
{
CComboBox(GetDlgItem(IDC_CMB_FILTER)).SetCurSel(config.textureFilter.txFilterMode);
CComboBox(GetDlgItem(IDC_CMB_ENHANCEMENT)).SetCurSel(config.textureFilter.txEnhancementMode);
CButton(GetDlgItem(IDC_CHK_DEPOSTERIZE)).SetCheck(config.textureFilter.txDeposterize != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_IGNORE_BACKGROUNDS)).SetCheck(config.textureFilter.txFilterIgnoreBG != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_ENHANCED_TEX_FILE_STORAGE)).SetCheck(config.textureFilter.txEnhancedTextureFileStorage != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_TEXTURE_PACK)).SetCheck(config.textureFilter.txHiresEnable != 0 ? BST_CHECKED : BST_UNCHECKED);
GetDlgItem(IDC_TEX_PACK_PATH_EDIT).SetWindowText(config.textureFilter.txPath);
GetDlgItem(IDC_TEX_CACHE_PATH_EDIT).SetWindowText(config.textureFilter.txCachePath);
GetDlgItem(IDC_TEX_DUMP_PATH_EDIT).SetWindowText(config.textureFilter.txDumpPath);
CButton(GetDlgItem(IDC_CHK_ALPHA_CHANNEL)).SetCheck(config.textureFilter.txHiresFullAlphaChannel != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_ALTERNATIVE_CRC)).SetCheck(config.textureFilter.txHresAltCRC != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_HIRES_TEX_FILESTORAGE)).SetCheck(config.textureFilter.txHiresTextureFileStorage != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_TEXTURE_DUMP)).SetCheck(config.textureFilter.txDump != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_SAVE_TEXTURE_CACHE)).SetCheck(config.textureFilter.txSaveCache != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_COMPRESS_CACHE)).SetCheck(config.textureFilter.txCacheCompression != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_FORCE_16BPP)).SetCheck(config.textureFilter.txForce16bpp != 0 ? BST_CHECKED : BST_UNCHECKED);
m_TextureFilterCacheSpin.SetPos((config.textureFilter.txCacheSize / gc_uMegabyte) / 50);
OnFileStorage(0, 0, NULL);
OnTexturePack(0, 0, NULL);
BOOL bHandled;
OnScroll(0, 0, (LPARAM)(GetDlgItem(IDC_TEXTURE_FILTER_CACHE_SPIN).Detach()), bHandled);
}
void CTextureEnhancementTab::SaveDirectory(int EditCtrl, wchar_t * txPath)
{
CWindow EditWnd = GetDlgItem(EditCtrl);
int TxtLen = EditWnd.GetWindowTextLength();
std::wstring Path;
Path.resize(TxtLen + 1);
EditWnd.GetWindowText((wchar_t *)Path.data(), Path.size());
WIN32_FIND_DATA FindData;
HANDLE hFindFile = FindFirstFile(Path.c_str(), &FindData);
bool exists = (hFindFile != INVALID_HANDLE_VALUE);
if (hFindFile != NULL)
{
FindClose(hFindFile);
}
if (exists)
{
wcscpy(txPath, Path.c_str());
}
}
void CTextureEnhancementTab::SaveSettings()
{
config.textureFilter.txFilterMode = CComboBox(GetDlgItem(IDC_CMB_FILTER)).GetCurSel();
config.textureFilter.txEnhancementMode = CComboBox(GetDlgItem(IDC_CMB_ENHANCEMENT)).GetCurSel();
config.textureFilter.txDeposterize = CButton(GetDlgItem(IDC_CHK_DEPOSTERIZE)).GetCheck() == BST_CHECKED ? 1 : 0;
config.textureFilter.txFilterIgnoreBG = CButton(GetDlgItem(IDC_CHK_IGNORE_BACKGROUNDS)).GetCheck() == BST_CHECKED ? 1 : 0;
config.textureFilter.txEnhancedTextureFileStorage = CButton(GetDlgItem(IDC_CHK_ENHANCED_TEX_FILE_STORAGE)).GetCheck() == BST_CHECKED ? 1 : 0;
config.textureFilter.txHiresEnable = CButton(GetDlgItem(IDC_CHK_TEXTURE_PACK)).GetCheck() == BST_CHECKED ? 1 : 0;
SaveDirectory(IDC_TEX_PACK_PATH_EDIT, config.textureFilter.txPath);
SaveDirectory(IDC_TEX_CACHE_PATH_EDIT, config.textureFilter.txCachePath);
SaveDirectory(IDC_TEX_DUMP_PATH_EDIT, config.textureFilter.txDumpPath);
config.textureFilter.txHiresFullAlphaChannel = CButton(GetDlgItem(IDC_CHK_ALPHA_CHANNEL)).GetCheck() == BST_CHECKED ? 1 : 0;
config.textureFilter.txHresAltCRC = CButton(GetDlgItem(IDC_CHK_ALTERNATIVE_CRC)).GetCheck() == BST_CHECKED ? 1 : 0;
config.textureFilter.txHiresTextureFileStorage = CButton(GetDlgItem(IDC_CHK_HIRES_TEX_FILESTORAGE)).GetCheck() == BST_CHECKED ? 1 : 0;
config.textureFilter.txDump = CButton(GetDlgItem(IDC_CHK_TEXTURE_DUMP)).GetCheck() == BST_CHECKED ? 1 : 0;
config.textureFilter.txCacheSize = m_TextureFilterCacheSpin.GetPos() * gc_uMegabyte * 50;
config.textureFilter.txSaveCache = CButton(GetDlgItem(IDC_CHK_SAVE_TEXTURE_CACHE)).GetCheck() == BST_CHECKED ? 1 : 0;
config.textureFilter.txCacheCompression = CButton(GetDlgItem(IDC_CHK_COMPRESS_CACHE)).GetCheck() == BST_CHECKED ? 1 : 0;
config.textureFilter.txForce16bpp = CButton(GetDlgItem(IDC_CHK_FORCE_16BPP)).GetCheck() == BST_CHECKED ? 1 : 0;
}
void CTextureEnhancementTab::OnSelectTexPackPath(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
SelectDir(L"Select directory for texture pack path", IDC_TEX_PACK_PATH_EDIT);
}
void CTextureEnhancementTab::OnSelectTexCachePath(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
SelectDir(L"Select directory for texture cache path", IDC_TEX_CACHE_PATH_EDIT);
}
void CTextureEnhancementTab::OnSelectTexDumpPath(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
SelectDir(L"Select directory for texture dump path", IDC_TEX_DUMP_PATH_EDIT);
}
void CTextureEnhancementTab::SelectDir(wchar_t * Title, int EditCtrl)
{
wchar_t Buffer[MAX_PATH], Directory[MAX_PATH];
LPITEMIDLIST pidl;
BROWSEINFOW bi;
CWindow EditWnd = GetDlgItem(EditCtrl);
int TxtLen = EditWnd.GetWindowTextLength();
std::wstring EditText;
EditText.resize(TxtLen + 1);
EditWnd.GetWindowText((wchar_t *)EditText.data(), EditText.size());
bi.hwndOwner = m_hWnd;
bi.pidlRoot = NULL;
bi.pszDisplayName = Buffer;
bi.lpszTitle = Title;
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
bi.lpfn = (BFFCALLBACK)SelectDirCallBack;
bi.lParam = (DWORD)EditText.c_str();
if ((pidl = SHBrowseForFolderW(&bi)) != NULL)
{
if (SHGetPathFromIDListW(pidl, Directory))
{
EditWnd.SetWindowText(Directory);
}
}
}
int CALLBACK CTextureEnhancementTab::SelectDirCallBack(HWND hwnd, uint32_t uMsg, uint32_t /*lp*/, uint32_t lpData)
{
switch (uMsg)
{
case BFFM_INITIALIZED:
// WParam is TRUE since you are passing a path.
// It would be FALSE if you were passing a pidl.
if (lpData)
{
SendMessage(hwnd, BFFM_SETSELECTION, TRUE, lpData);
}
break;
}
return 0;
}

View File

@ -0,0 +1,42 @@
#pragma once
#include "config-tab.h"
#include "resource.h"
class CTextureEnhancementTab :
public CConfigTab
{
public:
BEGIN_MSG_MAP(CTextureEnhancementTab)
MSG_WM_INITDIALOG(OnInitDialog)
MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic)
MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic)
COMMAND_HANDLER_EX(IDC_CHK_ENHANCED_TEX_FILE_STORAGE, BN_CLICKED, OnFileStorage)
COMMAND_HANDLER_EX(IDC_CHK_TEXTURE_PACK, BN_CLICKED, OnTexturePack)
COMMAND_ID_HANDLER_EX(IDC_TEX_PACK_PATH_BTN, OnSelectTexPackPath)
COMMAND_ID_HANDLER_EX(IDC_TEX_CACHE_PATH_BTN, OnSelectTexCachePath)
COMMAND_ID_HANDLER_EX(IDC_TEX_DUMP_PATH_BTN, OnSelectTexDumpPath)
MESSAGE_HANDLER(WM_VSCROLL, OnScroll)
END_MSG_MAP()
CTextureEnhancementTab();
BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/);
LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnScroll(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/);
void OnFileStorage(UINT /*Code*/, int id, HWND /*ctl*/);
void OnTexturePack(UINT /*Code*/, int id, HWND /*ctl*/);
void LoadSettings(bool blockCustomSettings);
void SaveSettings();
private:
static int CALLBACK SelectDirCallBack(HWND hwnd, uint32_t uMsg, uint32_t lp, uint32_t lpData);
void SaveDirectory(int EditCtrl, wchar_t * txPath);
void SelectDir(wchar_t * Title, int EditCtrl);
void OnSelectTexPackPath(UINT Code, int id, HWND ctl);
void OnSelectTexCachePath(UINT Code, int id, HWND ctl);
void OnSelectTexDumpPath(UINT Code, int id, HWND ctl);
CEdit m_TextureFilterCacheTxt;
CUpDownCtrl m_TextureFilterCacheSpin;
};

View File

@ -0,0 +1,333 @@
#include "config-video.h"
#include "FullscreenResolutions.h"
#include "util.h"
#include "../Config.h"
static struct
{
unsigned short width, height;
LPCTSTR description;
}
WindowedModes[] =
{
{ 320, 240, _T("320 x 240") },
{ 400, 300, _T("400 x 300") },
{ 480, 360, _T("480 x 360") },
{ 640, 480, _T("640 x 480") },
{ 800, 600, _T("800 x 600") },
{ 960, 720, _T("960 x 720") },
{ 1024, 768, _T("1024 x 768") },
{ 1152, 864, _T("1152 x 864") },
{ 1280, 960, _T("1280 x 960") },
{ 1280, 1024, _T("1280 x 1024") },
{ 1440, 1080, _T("1440 x 1080") },
{ 1600, 1024, _T("1600 x 1024") },
{ 1600, 1200, _T("1600 x 1200") }
};
static const unsigned int numWindowedModes = sizeof(WindowedModes) / sizeof(WindowedModes[0]);
CVideoTab::CVideoTab() :
CConfigTab(IDD_TAB_VIDEO)
{
}
CVideoTab::~CVideoTab()
{
for (size_t i = 0; i < m_OverscanTabs.size(); i++)
{
delete m_OverscanTabs[i];
}
m_OverscanTabs.clear();
}
BOOL CVideoTab::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/)
{
m_OverScanTab.Attach(GetDlgItem(IDC_TAB_OVERSCAN));
AddOverScanTab(L"NTSC");
AddOverScanTab(L"PAL");
m_AliasingSlider.Attach(GetDlgItem(IDC_ALIASING_SLIDER));
m_AliasingSlider.SetTicFreq(1);
m_AliasingSlider.SetRangeMin(0);
m_AliasingSlider.SetRangeMax(3);
m_AnisotropicSlider.Attach(GetDlgItem(IDC_ANISOTROPIC_SLIDER));
m_AnisotropicSlider.SetTicFreq(1);
m_AnisotropicSlider.SetRangeMin(0);
m_AnisotropicSlider.SetRangeMax(16);
CComboBox aspectComboBox(GetDlgItem(IDC_CMB_ASPECT_RATIO));
aspectComboBox.AddString(L"4:3 (recommended)");
aspectComboBox.AddString(L"16:9");
aspectComboBox.AddString(L"Stretch");
aspectComboBox.AddString(L"Try to adjust game to fit");
m_AAInfoIcon.SubclassWindow(GetDlgItem(IDC_AA_INFO_ICON));
m_AAInfoIcon.SetIcon(MAKEINTRESOURCE(IDI_ICON_INFO), 16, 16);
m_AAInfoIcon.SetBackroundBrush((HBRUSH)GetStockObject(WHITE_BRUSH));
return true;
}
LRESULT CVideoTab::OnScroll(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
{
LONG SliderId = CWindow((HWND)lParam).GetWindowLong(GWL_ID);
if (SliderId == IDC_ALIASING_SLIDER)
{
int32_t value = m_AliasingSlider.GetPos();
std::wstring AliasingText = FormatStrW(L"%dx", value > 0 ? 1 << value : 0);
CWindow(GetDlgItem(IDC_ALIASING_LABEL)).SetWindowTextW(AliasingText.c_str());
CButton(GetDlgItem(value != 0 ? IDC_MSAA_RADIO : IDC_NOAA_RADIO)).SetCheck(BST_CHECKED);
CButton(GetDlgItem(value != 0 ? IDC_NOAA_RADIO : IDC_MSAA_RADIO)).SetCheck(BST_UNCHECKED);
CButton(GetDlgItem(IDC_FXAA_RADIO)).SetCheck(BST_UNCHECKED);
}
else if (SliderId == IDC_ANISOTROPIC_SLIDER)
{
CWindow(GetDlgItem(IDC_ANISOTROPIC_LABEL)).SetWindowTextW(FormatStrW(L"%dx", m_AnisotropicSlider.GetPos()).c_str());
}
return 0;
}
void CVideoTab::OnOverscan(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
CButton OverScan(GetDlgItem(IDC_CHK_OVERSCAN));
if (OverScan.GetCheck() == BST_CHECKED)
{
GetDlgItem(IDC_TAB_OVERSCAN).ShowWindow(SW_SHOW);
ShowOverScanTab(m_OverScanTab.GetCurSel());
}
else
{
GetDlgItem(IDC_TAB_OVERSCAN).ShowWindow(SW_HIDE);
m_OverscanTabs[m_OverScanTab.GetCurSel()]->ShowWindow(SW_HIDE);
}
}
LRESULT CVideoTab::OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
return (LRESULT)GetStockObject(WHITE_BRUSH);
}
LRESULT CVideoTab::OnOverscanTabChange(NMHDR* /*pNMHDR*/)
{
ShowOverScanTab(m_OverScanTab.GetCurSel());
return FALSE;
}
void CVideoTab::OnFullScreenChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
CComboBox fullScreenResolutionComboBox(GetDlgItem(IDC_CMB_FULL_SCREEN_RES));
int32_t index = fullScreenResolutionComboBox.GetCurSel();
StringList fullscreenRatesList;
int fullscreenRate;
fillFullscreenRefreshRateList(index, fullscreenRatesList, fullscreenRate);
CComboBox RefreshRateComboBox(GetDlgItem(IDC_CMB_REFRESH_RATE));
RefreshRateComboBox.ResetContent();
for (size_t i = 0, n = fullscreenRatesList.size(); i < n; i++)
{
std::wstring fullscreenRateStr(fullscreenRatesList[i].begin(), fullscreenRatesList[i].end());
int index = RefreshRateComboBox.AddString(fullscreenRateStr.c_str());
if (fullscreenRate == i)
{
RefreshRateComboBox.SetCurSel(index);
}
}
}
void CVideoTab::AddOverScanTab(const wchar_t * caption)
{
m_OverScanTab.AddItem(caption);
COverScanTab * tab = new COverScanTab;
tab->Create(m_hWnd, 0);
tab->SetWindowPos(m_hWnd, 0, 0, 0, 0, SWP_HIDEWINDOW);
m_OverscanTabs.push_back(tab);
if (m_OverscanTabs.size() == 1)
{
ShowOverScanTab(0);
}
}
void CVideoTab::ShowOverScanTab(int nTab)
{
for (size_t i = 0; i < m_OverscanTabs.size(); i++)
{
m_OverscanTabs[i]->ShowWindow(SW_HIDE);
}
CRect TabRect;
m_OverScanTab.GetWindowRect(&TabRect);
ScreenToClient(&TabRect);
m_OverScanTab.AdjustRect(FALSE, &TabRect);
m_OverscanTabs[nTab]->SetWindowPos(HWND_TOP, TabRect.left, TabRect.top, TabRect.Width(), TabRect.Height(), SWP_SHOWWINDOW);
CRect WinRect, ClientRect;
m_OverscanTabs[nTab]->GetWindowRect(WinRect);
m_OverscanTabs[nTab]->GetClientRect(ClientRect);
m_OverScanTab.RedrawWindow();
}
void CVideoTab::LoadSettings(bool /*blockCustomSettings*/)
{
CComboBox WindowedResolutionComboBox(GetDlgItem(IDC_CMB_WINDOWED_RESOLUTION));
for (unsigned int i = 0; i < numWindowedModes; ++i)
{
int index = WindowedResolutionComboBox.AddString(WindowedModes[i].description);
WindowedResolutionComboBox.SetItemData(index, i);
if (WindowedModes[i].width == config.video.windowedWidth &&
WindowedModes[i].height == config.video.windowedHeight)
{
WindowedResolutionComboBox.SetCurSel(index);
}
}
if (WindowedResolutionComboBox.GetCount() > 0 && WindowedResolutionComboBox.GetCurSel() < 0)
{
WindowedResolutionComboBox.SetCurSel(0);
}
CButton overscanCheckBox(GetDlgItem(IDC_CHK_OVERSCAN));
overscanCheckBox.SetCheck(config.frameBufferEmulation.enableOverscan != 0 ? BST_CHECKED : BST_UNCHECKED);
OnOverscan(0, 0, NULL);
m_OverscanTabs[0]->SetValue(
config.frameBufferEmulation.overscanNTSC.left,
config.frameBufferEmulation.overscanNTSC.right,
config.frameBufferEmulation.overscanNTSC.top,
config.frameBufferEmulation.overscanNTSC.bottom
);
m_OverscanTabs[1]->SetValue(
config.frameBufferEmulation.overscanPAL.left,
config.frameBufferEmulation.overscanPAL.right,
config.frameBufferEmulation.overscanPAL.top,
config.frameBufferEmulation.overscanPAL.bottom
);
StringList fullscreenModesList, fullscreenRatesList;
int fullscreenMode, fullscreenRate;
fillFullscreenResolutionsList(fullscreenModesList, fullscreenMode, fullscreenRatesList, fullscreenRate);
CComboBox fullScreenResolutionComboBox(GetDlgItem(IDC_CMB_FULL_SCREEN_RES));
fullScreenResolutionComboBox.ResetContent();
for (size_t i = 0, n = fullscreenModesList.size(); i < n; i++)
{
std::wstring fullscreenModeStr(fullscreenModesList[i].begin(), fullscreenModesList[i].end());
int index = fullScreenResolutionComboBox.AddString(fullscreenModeStr.c_str());
if (fullscreenMode == i)
{
fullScreenResolutionComboBox.SetCurSel(index);
}
}
OnFullScreenChanged(0, 0, NULL);
m_AliasingSlider.SetPos(config.video.multisampling >> 1);
std::wstring AliasingText = FormatStrW(L"%dx", config.video.multisampling > 0 ? 1 << config.video.multisampling : 0);
CWindow(GetDlgItem(IDC_ALIASING_LABEL)).SetWindowTextW(AliasingText.c_str());
CButton(GetDlgItem(IDC_NOAA_RADIO)).SetCheck(config.video.multisampling == 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_FXAA_RADIO)).SetCheck(config.video.fxaa != 0 && config.video.multisampling != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_MSAA_RADIO)).SetCheck(config.video.fxaa == 0 && config.video.multisampling != 0 ? BST_CHECKED : BST_UNCHECKED);
m_AnisotropicSlider.SetPos(config.texture.maxAnisotropy);
CWindow(GetDlgItem(IDC_ANISOTROPIC_LABEL)).SetWindowTextW(FormatStrW(L"%dx", m_AnisotropicSlider.GetPos()).c_str());
CButton(GetDlgItem(IDC_CHK_VERTICAL_SYNC)).SetCheck(config.video.verticalSync != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_CHK_THREADED_VIDEO)).SetCheck(config.video.threadedVideo != 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_BILINEAR_3POINT)).SetCheck(config.texture.bilinearMode == BILINEAR_3POINT ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_BILINEAR_STANDARD)).SetCheck(config.texture.bilinearMode == BILINEAR_STANDARD ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_SCREENSHOT_PNG)).SetCheck(config.texture.screenShotFormat == 0 ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_SCREENSHOT_JPEG)).SetCheck(config.texture.screenShotFormat == 1 ? BST_CHECKED : BST_UNCHECKED);
CComboBox aspectComboBox(GetDlgItem(IDC_CMB_ASPECT_RATIO));
switch (config.frameBufferEmulation.aspect)
{
case Config::aStretch:
aspectComboBox.SetCurSel(2);
break;
case Config::a43:
aspectComboBox.SetCurSel(0);
break;
case Config::a169:
aspectComboBox.SetCurSel(1);
break;
case Config::aAdjust:
aspectComboBox.SetCurSel(3);
break;
}
}
void CVideoTab::SaveSettings()
{
getFullscreenResolutions(CComboBox(GetDlgItem(IDC_CMB_FULL_SCREEN_RES)).GetCurSel(), config.video.fullscreenWidth, config.video.fullscreenHeight);
getFullscreenRefreshRate(CComboBox(GetDlgItem(IDC_CMB_REFRESH_RATE)).GetCurSel(), config.video.fullscreenRefresh);
CComboBox WindowResCB(GetDlgItem(IDC_CMB_WINDOWED_RESOLUTION));
int WindowResIndx = WindowResCB.GetItemData(WindowResCB.GetCurSel());
if (WindowResIndx >= 0 && WindowResIndx < numWindowedModes)
{
config.video.windowedWidth = WindowedModes[WindowResIndx].width;
config.video.windowedHeight = WindowedModes[WindowResIndx].height;
}
int AspectIndx = CComboBox(GetDlgItem(IDC_CMB_ASPECT_RATIO)).GetCurSel();
if (AspectIndx == 2)
{
config.frameBufferEmulation.aspect = Config::aStretch;
}
else if (AspectIndx == 0)
{
config.frameBufferEmulation.aspect = Config::a43;
}
else if (AspectIndx == 1)
{
config.frameBufferEmulation.aspect = Config::a169;
}
else if (AspectIndx == 3)
{
config.frameBufferEmulation.aspect = Config::aAdjust;
}
config.video.verticalSync = CButton(GetDlgItem(IDC_CHK_VERTICAL_SYNC)).GetCheck() == BST_CHECKED;
config.video.threadedVideo = CButton(GetDlgItem(IDC_CHK_THREADED_VIDEO)).GetCheck() == BST_CHECKED;
config.frameBufferEmulation.enableOverscan = CButton(GetDlgItem(IDC_CHK_OVERSCAN)).GetCheck() == BST_CHECKED;
m_OverscanTabs[0]->GetValue(
config.frameBufferEmulation.overscanNTSC.left,
config.frameBufferEmulation.overscanNTSC.right,
config.frameBufferEmulation.overscanNTSC.top,
config.frameBufferEmulation.overscanNTSC.bottom
);
m_OverscanTabs[1]->GetValue(
config.frameBufferEmulation.overscanPAL.left,
config.frameBufferEmulation.overscanPAL.right,
config.frameBufferEmulation.overscanPAL.top,
config.frameBufferEmulation.overscanPAL.bottom
);
config.video.fxaa = CButton(GetDlgItem(IDC_FXAA_RADIO)).GetCheck() == BST_CHECKED ? 1 : 0;
config.video.multisampling = m_AliasingSlider.GetPos() << 1;
config.texture.maxAnisotropy = m_AnisotropicSlider.GetPos();
if (CButton(GetDlgItem(IDC_BILINEAR_3POINT)).GetCheck() == BST_CHECKED)
{
config.texture.bilinearMode = BILINEAR_3POINT;
}
if (CButton(GetDlgItem(IDC_BILINEAR_STANDARD)).GetCheck() == BST_CHECKED)
{
config.texture.bilinearMode = BILINEAR_STANDARD;
}
if (CButton(GetDlgItem(IDC_SCREENSHOT_PNG)).GetCheck() == BST_CHECKED)
{
config.texture.screenShotFormat = 0;
}
else if (CButton(GetDlgItem(IDC_SCREENSHOT_JPEG)).GetCheck() == BST_CHECKED)
{
config.texture.screenShotFormat = 1;
}
}

View File

@ -0,0 +1,43 @@
#pragma once
#include "config-tab.h"
#include "config-overscan.h"
#include "wtl-BitmapPicture.h"
#include "resource.h"
#include <vector>
class CVideoTab :
public CConfigTab
{
public:
BEGIN_MSG_MAP(CVideoTab)
MSG_WM_INITDIALOG(OnInitDialog)
MESSAGE_HANDLER(WM_CTLCOLORDLG, OnColorStatic)
MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic)
NOTIFY_HANDLER_EX(IDC_TAB_OVERSCAN, TCN_SELCHANGE, OnOverscanTabChange)
COMMAND_HANDLER_EX(IDC_CMB_FULL_SCREEN_RES, CBN_SELCHANGE, OnFullScreenChanged)
COMMAND_HANDLER_EX(IDC_CHK_OVERSCAN, BN_CLICKED, OnOverscan)
MESSAGE_HANDLER(WM_HSCROLL, OnScroll)
MESSAGE_HANDLER(WM_VSCROLL, OnScroll)
REFLECT_NOTIFICATIONS()
END_MSG_MAP()
CVideoTab();
~CVideoTab();
BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/);
LRESULT OnScroll(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/);
void OnOverscan(UINT /*Code*/, int id, HWND /*ctl*/);
LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnOverscanTabChange(NMHDR* /*pNMHDR*/);
void OnFullScreenChanged(UINT /*Code*/, int id, HWND /*ctl*/);
void AddOverScanTab(const wchar_t * caption);
void ShowOverScanTab(int nTab);
void LoadSettings(bool blockCustomSettings);
void SaveSettings();
CTabCtrl m_OverScanTab;
std::vector<COverScanTab *> m_OverscanTabs;
CTrackBarCtrl m_AliasingSlider;
CTrackBarCtrl m_AnisotropicSlider;
CBitmapPicture m_AAInfoIcon;
};

View File

@ -0,0 +1,180 @@
#include <windows.h>
#include <stdio.h>
#include "FullscreenResolutions.h"
#include "../Config.h"
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf c99_snprintf
#define vsnprintf c99_vsnprintf
__inline int c99_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap)
{
int count = -1;
if (size != 0)
count = _vsnprintf_s(outBuf, size, _TRUNCATE, format, ap);
if (count == -1)
count = _vscprintf(format, ap);
return count;
}
__inline int c99_snprintf(char *outBuf, size_t size, const char *format, ...)
{
int count;
va_list ap;
va_start(ap, format);
count = c99_vsnprintf(outBuf, size, format, ap);
va_end(ap);
return count;
}
#endif
static
struct
{
struct
{
DWORD width, height, refreshRate;
} selected;
struct
{
DWORD width, height;
} resolution[32];
DWORD refreshRate[32];
DWORD numResolutions;
DWORD numRefreshRates;
} fullscreen;
static
void _fillFullscreenRefreshRateList(StringList & _listRefreshRates, int & _rateIdx)
{
memset(&fullscreen.refreshRate, 0, sizeof(fullscreen.refreshRate));
fullscreen.numRefreshRates = 0;
_rateIdx = 0;
int i = 0;
DEVMODE deviceMode;
char text[128];
while (EnumDisplaySettings(NULL, i++, &deviceMode) != 0)
{
if (deviceMode.dmBitsPerPel != 32)
continue;
DWORD j = 0;
for (; j < fullscreen.numRefreshRates; ++j) {
if ((deviceMode.dmDisplayFrequency == fullscreen.refreshRate[j]))
break;
}
if ((deviceMode.dmDisplayFrequency != fullscreen.refreshRate[j]) &&
(deviceMode.dmPelsWidth == fullscreen.selected.width) &&
(deviceMode.dmPelsHeight == fullscreen.selected.height)) {
fullscreen.refreshRate[j] = deviceMode.dmDisplayFrequency;
//: Abbreviation for Hertz; include a leading space if appropriate
snprintf(text, sizeof(text), "%d Hz", deviceMode.dmDisplayFrequency);
_listRefreshRates.push_back(text);
if (fullscreen.selected.refreshRate == deviceMode.dmDisplayFrequency)
_rateIdx = fullscreen.numRefreshRates;
++fullscreen.numRefreshRates;
}
}
}
void fillFullscreenResolutionsList(StringList & _listResolutions, int & _resolutionIdx, StringList & _listRefreshRates, int & _rateIdx)
{
fullscreen.selected.width = config.video.fullscreenWidth;
fullscreen.selected.height = config.video.fullscreenHeight;
fullscreen.selected.refreshRate = config.video.fullscreenRefresh;
memset(&fullscreen.resolution, 0, sizeof(fullscreen.resolution));
memset(&fullscreen.refreshRate, 0, sizeof(fullscreen.refreshRate));
fullscreen.numResolutions = 0;
fullscreen.numRefreshRates = 0;
_resolutionIdx = 0;
static
struct
{
unsigned short x, y;
const char *description;
} ratios[] = {
{ 3, 2, "3:2" },
{ 4, 3, "4:3" },
{ 5, 4, "5:4" },
{ 16, 9, "16:9" },
{ 8, 5, "16:10" },
{ 21, 9, "21:9" }
};
const int numRatios = sizeof(ratios);
int i = 0;
char text[128];
DEVMODE deviceMode;
while (EnumDisplaySettings(NULL, i++, &deviceMode) != 0)
{
if (deviceMode.dmBitsPerPel != 32)
continue;
DWORD j = 0;
for (; j < fullscreen.numResolutions; ++j) {
if ((deviceMode.dmPelsWidth == fullscreen.resolution[j].width) &&
(deviceMode.dmPelsHeight == fullscreen.resolution[j].height)) {
break;
}
}
if ((deviceMode.dmPelsWidth != fullscreen.resolution[j].width) ||
(deviceMode.dmPelsHeight != fullscreen.resolution[j].height)) {
fullscreen.resolution[fullscreen.numResolutions].width = deviceMode.dmPelsWidth;
fullscreen.resolution[fullscreen.numResolutions].height = deviceMode.dmPelsHeight;
snprintf(text, 128, "%i x %i", deviceMode.dmPelsWidth, deviceMode.dmPelsHeight);
for (int j = 0; j < numRatios; ++j)
if (fabs((float)deviceMode.dmPelsWidth / (float)deviceMode.dmPelsHeight
- (float)ratios[j].x / (float)ratios[j].y) < 0.005f) {
snprintf(text, 128, "%s (%s)", text, ratios[j].description);
break;
}
_listResolutions.push_back(text);
if ((fullscreen.selected.width == deviceMode.dmPelsWidth) &&
(fullscreen.selected.height == deviceMode.dmPelsHeight))
_resolutionIdx = fullscreen.numResolutions;
++fullscreen.numResolutions;
}
}
_fillFullscreenRefreshRateList(_listRefreshRates, _rateIdx);
}
void fillFullscreenRefreshRateList(int _resolutionIdx, StringList & _listRefreshRates, int & _rateIdx)
{
fullscreen.selected.width = fullscreen.resolution[_resolutionIdx].width;
fullscreen.selected.height = fullscreen.resolution[_resolutionIdx].height;
_fillFullscreenRefreshRateList(_listRefreshRates, _rateIdx);
_rateIdx = fullscreen.numRefreshRates - 1;
}
void getFullscreenResolutions(int _idx, unsigned int & _width, unsigned int & _height)
{
_width = fullscreen.resolution[_idx].width;
_height = fullscreen.resolution[_idx].height;
}
void getFullscreenRefreshRate(int _idx, unsigned int & _rate)
{
_rate = fullscreen.refreshRate[_idx];
}

15
src/GLideNUI-wtl/icon.qrc Normal file
View File

@ -0,0 +1,15 @@
<RCC>
<qresource prefix="/">
<file>Icon.ico</file>
<file>Warning.ico</file>
<file>Info.ico</file>
<file>Up.ico</file>
<file>Right.ico</file>
<file>Down.ico</file>
<file>Left.ico</file>
<file>TopLeft.ico</file>
<file>TopRight.ico</file>
<file>BottomRight.ico</file>
<file>BottomLeft.ico</file>
</qresource>
</RCC>

BIN
src/GLideNUI-wtl/resource.h Normal file

Binary file not shown.

57
src/GLideNUI-wtl/util.cpp Normal file
View File

@ -0,0 +1,57 @@
#include "util.h"
#include <windows.h>
#include <memory>
std::string FromUTF16(const wchar_t * UTF16Source)
{
std::string Result;
uint32_t utf8size = WideCharToMultiByte(CP_UTF8, 0, UTF16Source, -1, NULL, 0, NULL, NULL);
if (utf8size > 0)
{
std::unique_ptr<char> pUTF8(new char[utf8size]);
WideCharToMultiByte(CP_UTF8, 0, UTF16Source, -1, pUTF8.get(), utf8size, NULL, NULL);
Result = pUTF8.get();
}
return Result;
}
std::wstring ToUTF16(const char * Source)
{
std::wstring res;
DWORD nNeeded = MultiByteToWideChar(CP_UTF8, 0, Source, -1, NULL, 0);
if (nNeeded > 0)
{
std::unique_ptr<wchar_t> pUTF8(new wchar_t[nNeeded]);
if (pUTF8.get() != NULL)
{
nNeeded = MultiByteToWideChar(CP_UTF8, 0, Source, -1, pUTF8.get(), nNeeded);
if (nNeeded)
{
res = pUTF8.get();
}
}
}
return res;
}
std::wstring FormatStrW(const wchar_t * strFormat, ...)
{
va_list args;
va_start(args, strFormat);
size_t nlen = _vscwprintf(strFormat, args) + 1;
wchar_t * buffer = (wchar_t *)alloca(nlen * sizeof(wchar_t));
buffer[nlen - 1] = 0;
std::wstring res;
if (buffer != NULL)
{
_vsnwprintf(buffer, nlen - 1, strFormat, args);
res = buffer;
}
va_end(args);
return res;
}

6
src/GLideNUI-wtl/util.h Normal file
View File

@ -0,0 +1,6 @@
#pragma once
#include <string>
std::string FromUTF16(const wchar_t * UTF16Source);
std::wstring ToUTF16(const char * Source);
std::wstring FormatStrW(const wchar_t * Source, ...);

View File

@ -0,0 +1,68 @@
#include "wtl-BitmapPicture.h"
CBitmapPicture::CBitmapPicture() :
m_hBitmap(NULL),
m_nResourceID(-1),
m_ResourceIcon(false)
{
memset(&m_bmInfo, 0, sizeof(m_bmInfo));
m_BackgroundBrush.CreateSolidBrush(::GetSysColor(COLOR_3DFACE));
}
LRESULT CBitmapPicture::OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL &/*bHandled*/)
{
CPaintDC dc(m_hWnd);
CRect rect;
GetClientRect(&rect);
CBrush PaintBrush;
HBRUSH OldBrush = dc.SelectBrush(m_BackgroundBrush);
dc.PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATCOPY);
if (m_ResourceIcon)
{
CIcon hIcon = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), m_nResourceID > 0 ? MAKEINTRESOURCE(m_nResourceID) : m_strResourceName.c_str(), IMAGE_ICON, m_IconWidth, m_IconHeight, LR_DEFAULTCOLOR | LR_DEFAULTSIZE);
if (!hIcon.IsNull())
{
dc.DrawIconEx(0, 0, hIcon, rect.Width(), rect.Height(), 0, NULL, DI_NORMAL);
}
}
dc.SelectBrush(OldBrush);
return 0;
}
bool CBitmapPicture::SetIcon(LPCWSTR lpszResourceName, uint32_t nWidth, uint32_t nHeight)
{
CIcon hIcon = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), lpszResourceName > 0 ? MAKEINTRESOURCE(lpszResourceName) : lpszResourceName, IMAGE_ICON, nWidth, nHeight, LR_DEFAULTCOLOR | LR_DEFAULTSIZE);
if (hIcon.IsNull())
{
return false;
}
ICONINFO IconInfo;
if (!hIcon.GetIconInfo(&IconInfo))
{
return false;
}
if (IS_INTRESOURCE(lpszResourceName))
{
m_nResourceID = (int)lpszResourceName;
}
else
{
m_strResourceName = lpszResourceName;
}
m_ResourceIcon = true;
m_IconWidth = nWidth;
m_IconHeight = nHeight;
return true;
}
bool CBitmapPicture::SetBitmap(HBITMAP hBitmap)
{
m_hBitmap.Attach(hBitmap);
return ::GetObject(m_hBitmap, sizeof(BITMAP), &m_bmInfo) != 0;
}
void CBitmapPicture::SetBackroundBrush(HBRUSH brush)
{
m_BackgroundBrush.Attach(brush);
}

View File

@ -0,0 +1,33 @@
#pragma once
#include "wtl.h"
#include <string>
class CBitmapPicture :
public CWindowImpl <CBitmapPicture>
{
public:
BEGIN_MSG_MAP(CBitmapPicture)
MESSAGE_HANDLER(WM_PAINT, OnPaint);
END_MSG_MAP()
CBitmapPicture();
LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL &/*bHandled*/);
bool SetIcon(LPCWSTR lpszResourceName, uint32_t nWidth, uint32_t nHeight);
void SetBackroundBrush(HBRUSH brush);
private:
CBitmapPicture(const CBitmapPicture&);
CBitmapPicture& operator=(const CBitmapPicture&);
bool CBitmapPicture::SetBitmap(HBITMAP hBitmap);
int m_nResourceID;
std::wstring m_strResourceName;
uint32_t m_IconWidth, m_IconHeight;
bool m_ResourceIcon;
BITMAP m_bmInfo;
CBitmap m_hBitmap;
CBrush m_BackgroundBrush;
};

View File

@ -0,0 +1,67 @@
#include "wtl-ColorButton.h"
CColorButton::CColorButton() :
m_Red(0),
m_Green(0),
m_Blue(0)
{
memset(m_CustClr, 0, sizeof(m_CustClr));
}
LRESULT CColorButton::OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL &/*bHandled*/)
{
CPaintDC dc(m_hWnd);
CRect rect;
GetClientRect(&rect);
CPen pen;
pen.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_GRAYTEXT));
HPEN hpenOld = dc.SelectPen(pen);
CBrush PaintBrush;
PaintBrush.CreateSolidBrush(RGB(m_Red, m_Green, m_Blue));
dc.SelectBrush(PaintBrush);
dc.Rectangle(rect.left, rect.top, rect.Width(), rect.Height());
dc.SelectPen(hpenOld);
return 0;
}
void CColorButton::SetColor(uint8_t Red, uint8_t Green, uint8_t Blue)
{
m_Red = Red;
m_Green = Green;
m_Blue = Blue;
SendNotification(CPN_SELCHANGE);
Invalidate();
}
LRESULT CColorButton::OnClicked(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
CHOOSECOLOR cc = { 0 };
static DWORD rgbCurrent; // initial color selection
ZeroMemory(&cc, sizeof(cc));
cc.lStructSize = sizeof(cc);
cc.hwndOwner = GetParent();
cc.lpCustColors = (LPDWORD)m_CustClr;
cc.rgbResult = RGB(m_Red, m_Green, m_Blue);
cc.Flags = CC_FULLOPEN | CC_RGBINIT | CC_PREVENTFULLOPEN;
if (ChooseColor(&cc) == TRUE)
{
m_Red = GetRValue(cc.rgbResult);
m_Green = GetGValue(cc.rgbResult);
m_Blue = GetBValue(cc.rgbResult);
SendNotification(CPN_SELCHANGE);
}
return TRUE;
}
void CColorButton::SendNotification(UINT nCode)
{
NMCOLORBUTTON nmclr;
nmclr.hdr.code = nCode;
nmclr.hdr.hwndFrom = m_hWnd;
nmclr.hdr.idFrom = GetDlgCtrlID();
nmclr.clr = RGB(m_Red, m_Green, m_Blue);
::SendMessage(GetParent(), WM_NOTIFY, (WPARAM)GetDlgCtrlID(), (LPARAM)&nmclr);
}

View File

@ -0,0 +1,39 @@
#pragma once
#include "wtl.h"
#include <stdint.h>
class CColorButton :
public CWindowImpl <CColorButton>
{
public:
struct NMCOLORBUTTON
{
NMHDR hdr;
COLORREF clr;
};
enum
{
CPN_SELCHANGE = 0x8000, /* Colour Picker Selection change */
};
BEGIN_MSG_MAP(CColorButton)
REFLECTED_COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
MESSAGE_HANDLER(WM_PAINT, OnPaint);
END_MSG_MAP()
CColorButton();
LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL &/*bHandled*/);
void SetColor(uint8_t Red, uint8_t Green, uint8_t Blue);
LRESULT OnClicked(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
inline uint8_t Red() const { return m_Red; }
inline uint8_t Green() const { return m_Green; }
inline uint8_t Blue() const { return m_Blue; }
private:
void SendNotification(UINT nCode);
COLORREF m_CustClr[16];
uint8_t m_Red, m_Green, m_Blue;
};

View File

@ -0,0 +1,60 @@
#include "wtl-OsdButton.h"
COSDButton::COSDButton(uint32_t IconId, DWORD dwExtendedStyle, HIMAGELIST hImageList) :
CBitmapButtonImpl<COSDButton>(dwExtendedStyle, hImageList),
m_Checked(false)
{
if (IconId != 0)
{
m_Icon.LoadIcon(IconId);
}
}
void COSDButton::DoPaint(CDCHandle dc)
{
CRect rect = { 0 };
GetClientRect(&rect);
COLORREF BackgroundColor = RGB(225, 225, 225);
COLORREF BorderColor = RGB(173, 173, 173);
if (!IsWindowEnabled())
{
BackgroundColor = RGB(204, 204, 204);
BorderColor = RGB(191, 191, 191);
}
else if (m_fMouseOver)
{
BackgroundColor = RGB(229, 241, 251);
BorderColor = RGB(0, 120, 215);
}
if (m_Checked)
{
BackgroundColor = RGB(204, 228, 247);
BorderColor = RGB(0, 84, 153);
}
CBrush Background;
Background.CreateSolidBrush(BackgroundColor);
CPen pen;
pen.CreatePen(PS_SOLID, 1, BorderColor);
dc.SelectPen(pen);
dc.SelectBrush(Background);
dc.Rectangle(rect.left, rect.top, rect.right, rect.bottom);
if (!m_Icon.IsNull())
{
uint32_t IconBorder = (uint32_t)(rect.Width() * 0.3);
uint32_t IconSize = rect.Width() - (IconBorder * 2);
dc.DrawIconEx(IconBorder, IconBorder, m_Icon, IconSize, IconSize);
}
}
void COSDButton::SetChecked(bool checked)
{
if (m_Checked != checked)
{
m_Checked = checked;
Invalidate();
}
}

View File

@ -0,0 +1,19 @@
#include "wtl.h"
#include <stdint.h>
class COSDButton :
public CBitmapButtonImpl<COSDButton>
{
public:
DECLARE_WND_SUPERCLASS(_T("WTL_BitmapButton"), GetWndClassName())
COSDButton(uint32_t IconId, DWORD dwExtendedStyle = BMPBTN_AUTOSIZE | BMPBTN_HOVER, HIMAGELIST hImageList = NULL);
void DoPaint(CDCHandle dc);
void SetChecked(bool checked);
inline bool isChecked(void) const { return m_Checked; }
private:
CIcon m_Icon;
bool m_Checked;
};

View File

@ -0,0 +1,119 @@
#include "wtl-OsdPreview.h"
#include "FontInfo.h"
#include "util.h"
#include <DWrite.h>
#pragma comment(lib, "Dwrite.lib")
COsdPreview::COsdPreview() :
m_FontFile(L"arial.ttf"),
m_FontSize(16),
m_Red(0),
m_Green(0),
m_Blue(0)
{
}
void COsdPreview::SetFont(const std::wstring & FontFile)
{
m_FontFile = FontFile;
Invalidate();
}
void COsdPreview::SetFontSize(uint32_t FontSize)
{
m_FontSize = FontSize;
Invalidate();
}
void COsdPreview::SetColor(uint8_t Red, uint8_t Green, uint8_t Blue)
{
m_Red = Red;
m_Green = Green;
m_Blue = Blue;
Invalidate();
}
LRESULT COsdPreview::OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/)
{
CRect rect;
GetClientRect(&rect);
CPaintDC dc(m_hWnd);
CBrush PaintBrush;
PaintBrush.CreateSolidBrush(RGB(0, 0, 0));
dc.SelectBrush(PaintBrush);
dc.Rectangle(rect.left, rect.top, rect.Width(), rect.Height());
dc.SetTextColor(RGB(m_Red, m_Green, m_Blue));
dc.SetBkColor(RGB(0, 0, 0));
std::wstring fontFileName = ToUTF16(GetFontFolder().c_str());
fontFileName += L"\\" + m_FontFile;
AddFontResourceEx(fontFileName.c_str(), FR_PRIVATE, 0);
LOGFONT logFont;
if (SUCCEEDED(GetLogFontFromFileName(fontFileName.c_str(), &logFont)))
{
int desiredPpem = (int)m_FontSize;
logFont.lfHeight = -long(desiredPpem);
HFONT hf = CreateFontIndirect(&logFont);
HFONT hOldFont = (HFONT)dc.SelectFont(hf);
if (hOldFont)
{
dc.DrawText(L"Preview", -1, rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
dc.SelectFont(hOldFont);
}
}
return 0;
}
HRESULT COsdPreview::GetLogFontFromFileName(const wchar_t * fontFileName, LOGFONT* logFont)
{
CComPtr<IDWriteFactory> dwriteFactory;
if (FAILED(DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), reinterpret_cast<IUnknown**>(&dwriteFactory))))
{
return S_FALSE;
}
CComPtr<IDWriteGdiInterop> gdiInterop;
if (FAILED(dwriteFactory->GetGdiInterop(&gdiInterop)))
{
return S_FALSE;
}
CComPtr<IDWriteFontFile> fontFile;
if (FAILED(dwriteFactory->CreateFontFileReference(fontFileName, nullptr, &fontFile)))
{
return S_FALSE;
}
BOOL isSupportedFontType = false;
DWRITE_FONT_FILE_TYPE fontFileType;
DWRITE_FONT_FACE_TYPE fontFaceType;
UINT32 numberOfFaces = 0;
if (FAILED(fontFile->Analyze(&isSupportedFontType, &fontFileType, &fontFaceType, &numberOfFaces)))
{
return S_FALSE;
}
if (!isSupportedFontType)
{
return DWRITE_E_FILEFORMAT;
}
CComPtr<IDWriteFontFace> fontFace;
IDWriteFontFile * const fontFiles[] =
{
fontFile.p
};
if (FAILED(dwriteFactory->CreateFontFace(fontFaceType, ARRAYSIZE(fontFiles), &fontFiles[0], 0, DWRITE_FONT_SIMULATIONS_NONE, &fontFace)))
{
return S_FALSE;
}
if (FAILED(gdiInterop->ConvertFontFaceToLOGFONT(fontFace, OUT logFont)))
{
return S_FALSE;
}
return S_OK;
}

View File

@ -0,0 +1,25 @@
#pragma once
#include "wtl.h"
#include <string>
class COsdPreview :
public CWindowImpl <COsdPreview>
{
public:
BEGIN_MSG_MAP(CColorButton)
MESSAGE_HANDLER(WM_PAINT, OnPaint);
END_MSG_MAP()
COsdPreview();
void SetFont(const std::wstring & FontFile);
void SetFontSize(uint32_t FontSize);
void SetColor(uint8_t Red, uint8_t Green, uint8_t Blue);
LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/);
private:
static HRESULT GetLogFontFromFileName(const wchar_t * fontFileName, LOGFONT* logFont);
std::wstring m_FontFile;
uint8_t m_Red, m_Green, m_Blue;
uint32_t m_FontSize;
};

View File

@ -0,0 +1,97 @@
#pragma once
#include "wtl.h"
// Wrapper for the Win32 LOGFONT structure
class CLogFont : public LOGFONT
{
public:
CLogFont()
{
memset(static_cast<LOGFONT*>(this), 0, sizeof(LOGFONT));
}
};
// Class used to create a font based on the font used by a specific window
class CWindowFont : public CFont
{
public:
// Font styles
typedef enum tagEType
{
typeNormal = 0x00,
typeBold = 0x01,
typeItalic = 0x02,
typeUnderline = 0x04,
typeSubheading = 0x08,
typeHeading = 0x10,
} EType;
public:
CWindowFont() : CFont()
{
}
/// hWnd - The window to use for the base font
/// nType - Font style flags
CWindowFont(HWND hWnd, int nType)
{
// We need a HWND
ATLASSERT(hWnd != NULL);
// Create the font
Create(hWnd, nType);
}
virtual ~CWindowFont()
{
}
public:
// Create the font
// hWnd - The window to use for the base font
// nType - Font style flags
// return true on success
bool Create(HWND hWnd, int nType)
{
// Be defensive
ATLASSERT(hWnd != NULL);
ATLASSERT(::IsWindow(hWnd) != FALSE);
// Get the font the window is currently using
HFONT hFont = (HFONT)::SendMessage(hWnd, WM_GETFONT, 0, 0);
// Do we have a font?
if (hFont == NULL)
return false;
::CLogFont lf;
// Fill the LOGFONT
if (::GetObject(hFont, sizeof(lf), &lf) == 0)
return false;
// Amend the LOGFONT members
if (nType & typeBold)
lf.lfWeight = FW_BOLD;
if (nType & typeItalic)
lf.lfItalic = TRUE;
if (nType & typeUnderline)
lf.lfUnderline = TRUE;
if (nType & typeSubheading)
lf.lfHeight = static_cast<LONG>(lf.lfHeight * 1.25);
if (nType & typeHeading)
lf.lfHeight = static_cast<LONG>(lf.lfHeight * 2.5);
// Create the new font
return CreateFontIndirect(&lf) ? true : false;
}
// Create the font and apply to a nominate dialog control
bool Apply(HWND hWnd, int nType, UINT nControlID)
{
// First create the font
if (IsNull() && !Create(hWnd, nType))
{
return false;
}
// Apply to the nominated control
CWindow wndControl = ::GetDlgItem(hWnd, nControlID);
ATLASSERT(wndControl != NULL);
// Apply
wndControl.SetFont(m_hFont);
return true;
}
};

20
src/GLideNUI-wtl/wtl.h Normal file
View File

@ -0,0 +1,20 @@
#pragma once
#undef OS_WINDOWS
#pragma warning(push)
#pragma warning(disable : 4091) // warning C4091: 'typedef ': ignored on left of 'tagGPFIDL_FLAGS' when no variable is declared
#pragma warning(disable : 4201) // warning C4201: nonstandard extension used: nameless struct/union
#pragma warning(disable : 4302) // warning C4302: 'type cast': truncation from 'LPCTSTR' to 'WORD'
#pragma warning(disable : 4458) // warning C4458: declaration of 'dwCommonButtons' hides class member
#pragma warning(disable : 4838) // warning C4838: conversion from 'int' to 'UINT' requires a narrowing conversion
#pragma warning(disable : 4996) // warning C4996: 'GetVersionExA': was declared deprecated
#define _ATL_DISABLE_NOTHROW_NEW
#include <atlbase.h>
#include "wtl\atlapp.h"
#include "wtl\atlcrack.h"
#include "wtl\atlctrls.h"
#include "WTL\atlctrlx.h"
#include "WTL\atlgdi.h"
#include "WTL\atlmisc.h"
#include <atlwin.h>
#pragma warning(pop)

View File

@ -5,9 +5,25 @@ HWND hStatusBar;
HWND hToolBar;
HINSTANCE hInstance;
#ifdef WTL_UI
void ConfigInit(void * hinst);
void ConfigCleanup(void);
#endif
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID /*lpvReserved*/)
{
hInstance = hinstDLL;
#ifdef WTL_UI
if (dwReason == DLL_PROCESS_ATTACH)
{
hInstance = hinstDLL;
ConfigInit(hinstDLL);
}
else if (dwReason == DLL_PROCESS_DETACH)
{
ConfigCleanup();
}
#else
hInstance = hinstDLL;
#endif
return TRUE;
}