D3D9: Delete some long dead code. Also add one more statistic: number of compiled shaders that actually have unique code (not accurate unless you delete the shader cache before running). This stat clearly shows that in f-zero we create 5x as many pixel shaders as we should, so there's clearly a problem with the shader ID generation.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5754 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2010-06-20 22:23:34 +00:00
parent 783390539d
commit 6a88241e64
28 changed files with 27 additions and 1647 deletions

View File

@ -50,6 +50,7 @@ char *Statistics::ToString(char *ptr)
ptr+=sprintf(ptr,"textures alive: %i\n",stats.numTexturesAlive);
ptr+=sprintf(ptr,"pshaders created: %i\n",stats.numPixelShadersCreated);
ptr+=sprintf(ptr,"pshaders alive: %i\n",stats.numPixelShadersAlive);
ptr+=sprintf(ptr,"pshaders (unique, delete cache first): %i\n",stats.numUniquePixelShaders);
ptr+=sprintf(ptr,"vshaders created: %i\n",stats.numVertexShadersCreated);
ptr+=sprintf(ptr,"vshaders alive: %i\n",stats.numVertexShadersAlive);
ptr+=sprintf(ptr,"dlists called: %i\n",stats.numDListsCalled);

View File

@ -41,6 +41,8 @@ struct Statistics
int numVertexLoaders;
int numUniquePixelShaders;
float proj_0, proj_1, proj_2, proj_3, proj_4, proj_5, proj_6;
float gproj_0, gproj_1, gproj_2, gproj_3, gproj_4, gproj_5;
float gproj_6, gproj_7, gproj_8, gproj_9, gproj_10, gproj_11, gproj_12, gproj_13, gproj_14, gproj_15;

View File

@ -668,74 +668,6 @@
<Filter
Name="win32"
>
<File
RelativePath=".\Src\W32Util\DialogManager.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Src\W32Util\DialogManager.h"
>
</File>
<File
RelativePath=".\Src\EmuWindow.cpp"
>
@ -744,432 +676,6 @@
RelativePath=".\Src\EmuWindow.h"
>
</File>
<File
RelativePath=".\Src\W32Util\File.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Src\W32Util\File.h"
>
</File>
<File
RelativePath=".\Src\W32Util\Misc.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ObjectFile="$(IntDir)/$(InputName)1.obj"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ObjectFile="$(IntDir)/$(InputName)1.obj"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ObjectFile="$(IntDir)/$(InputName)1.obj"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ObjectFile="$(IntDir)/$(InputName)1.obj"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ObjectFile="$(IntDir)/$(InputName)1.obj"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ObjectFile="$(IntDir)/$(InputName)1.obj"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Src\W32Util\Misc.h"
>
</File>
<File
RelativePath=".\Src\W32Util\PropertySheet.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ObjectFile="$(IntDir)/$(InputName)1.obj"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ObjectFile="$(IntDir)/$(InputName)1.obj"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ObjectFile="$(IntDir)/$(InputName)1.obj"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ObjectFile="$(IntDir)/$(InputName)1.obj"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ObjectFile="$(IntDir)/$(InputName)1.obj"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ObjectFile="$(IntDir)/$(InputName)1.obj"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Src\W32Util\PropertySheet.h"
>
</File>
<File
RelativePath=".\Src\W32Util\ShellUtil.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ObjectFile="$(IntDir)/$(InputName)1.obj"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ObjectFile="$(IntDir)/$(InputName)1.obj"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ObjectFile="$(IntDir)/$(InputName)1.obj"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ObjectFile="$(IntDir)/$(InputName)1.obj"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ObjectFile="$(IntDir)/$(InputName)1.obj"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ObjectFile="$(IntDir)/$(InputName)1.obj"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Src\W32Util\ShellUtil.h"
>
</File>
<File
RelativePath=".\Src\W32Util\TabControl.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Src\W32Util\TabControl.h"
>
</File>
<File
RelativePath=".\Src\W32Util\Thread.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="2"
PrecompiledHeaderFile="$(IntDir)/Video_DirectX9.pch"
ForcedIncludeFiles="stdafx.h"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Src\W32Util\Thread.h"
>
</File>
<File
RelativePath=".\Src\W32Util\XPTheme.h"
>
@ -1393,14 +899,6 @@
RelativePath=".\Src\stdafx.h"
>
</File>
<File
RelativePath=".\Src\Utils.cpp"
>
</File>
<File
RelativePath=".\Src\Utils.h"
>
</File>
<File
RelativePath=".\Src\Vec3.h"
>

View File

@ -22,8 +22,7 @@
#include "TextureCache.h"
#include "VertexManager.h"
#include "VertexShaderManager.h"
#include "Utils.h"
#include "debugger/debugger.h"
#include "Debugger/Debugger.h"
#include "TextureConverter.h"

View File

@ -23,8 +23,6 @@
#include <wx/mimetype.h>
#include "DlgSettings.h"
#include "W32Util/PropertySheet.h"
#include "W32Util/ShellUtil.h"
#include "FileUtil.h"
#include "D3DBase.h"

View File

@ -15,7 +15,11 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include <map>
#include <set>
#include "Common.h"
#include "Hash.h"
#include "FileUtil.h"
#include "LinearDiskCache.h"
@ -23,7 +27,6 @@
#include "D3DBase.h"
#include "D3DShader.h"
#include "Statistics.h"
#include "Utils.h"
#include "VideoConfig.h"
#include "PixelShaderGen.h"
#include "PixelShaderManager.h"
@ -38,7 +41,8 @@
PixelShaderCache::PSCache PixelShaderCache::PixelShaders;
const PixelShaderCache::PSCacheEntry *PixelShaderCache::last_entry;
LinearDiskCache g_ps_disk_cache;
static LinearDiskCache g_ps_disk_cache;
static std::set<u32> unique_shaders;
static float lastPSconstants[C_COLORMATRIX+16][4];
@ -47,7 +51,6 @@ static LPDIRECT3DPIXELSHADER9 s_ColorCopyProgram[3];
static LPDIRECT3DPIXELSHADER9 s_DepthMatrixProgram[3];
static LPDIRECT3DPIXELSHADER9 s_ClearProgram = 0;
LPDIRECT3DPIXELSHADER9 PixelShaderCache::GetColorMatrixProgram(int SSAAMode)
{
return s_ColorMatrixProgram[SSAAMode % 3];
@ -297,6 +300,8 @@ void PixelShaderCache::Shutdown()
Clear();
g_ps_disk_cache.Sync();
g_ps_disk_cache.Close();
unique_shaders.clear();
}
bool PixelShaderCache::SetShader(bool dstAlpha)
@ -338,6 +343,11 @@ bool PixelShaderCache::SetShader(bool dstAlpha)
// OK, need to generate and compile it.
const char *code = GeneratePixelShaderCode(PixelShaderManager::GetTextureMask(), dstAlpha, API_D3D9);
u32 code_hash = HashAdler32((const u8 *)code, strlen(code));
unique_shaders.insert(code_hash);
SETSTAT(stats.numUniquePixelShaders, unique_shaders.size());
#if defined(_DEBUG) || defined(DEBUGFAST)
if (g_ActiveConfig.iLog & CONF_SAVESHADERS && code) {
static int counter = 0;

View File

@ -37,14 +37,15 @@ private:
struct PSCacheEntry
{
LPDIRECT3DPIXELSHADER9 shader;
bool owns_shader;
int frameCount;
#if defined(_DEBUG) || defined(DEBUGFAST)
std::string code;
#endif
PSCacheEntry() : shader(NULL), frameCount(0) {}
PSCacheEntry() : shader(NULL), owns_shader(true), frameCount(0) {}
void Destroy()
{
if (shader)
if (shader && owns_shader)
shader->Release();
shader = NULL;
}

View File

@ -41,7 +41,6 @@
#include "PixelShaderCache.h"
#include "VertexLoaderManager.h"
#include "TextureCache.h"
#include "Utils.h"
#include "EmuWindow.h"
#include "AVIDump.h"
#include "OnScreenDisplay.h"
@ -84,7 +83,10 @@ static u32 s_LastEFBScale;
static bool IS_AMD;
static bool XFBWrited;
char st[32768];
// used extern by other files. need to clean this up at some point.
int frameCount;
static char *st;
static bool s_bScreenshot = false;
static Common::CriticalSection s_criticalScreenshot;
@ -252,6 +254,7 @@ void TeardownDeviceObjects()
bool Renderer::Init()
{
st = new char[32768];
UpdateActiveConfig();
int fullScreenRes, x, y, w_temp, h_temp;
s_blendMode = 0;
@ -370,6 +373,7 @@ void Renderer::Shutdown()
{
AVIDump::Stop();
}
delete [] st;
}
int Renderer::GetTargetWidth() { return s_target_width; }
@ -1179,6 +1183,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
D3D::font.DrawTextScaled(0,30,20,20,0.0f,0xFF00FFFF,st,false);
}
OSD::DrawMessages();
D3D::EndFrame();

View File

@ -1,45 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifdef _WIN32
#include "W32Util/Misc.h"
#endif
#include "Common.h"
#include <assert.h>
int frameCount;
// Message handler for about box.
LRESULT CALLBACK AboutProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM /*lParam*/)
{
switch (message)
{
case WM_INITDIALOG:
W32Util::CenterWindow(hDlg);
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
}
return FALSE;
}

View File

@ -1,31 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UTILS_H
#define _UTILS_H
#include "Common.h"
#include "main.h"
#include "LookUpTables.h"
#include "VideoCommon.h"
extern int frameCount;
LRESULT CALLBACK AboutProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
#endif

View File

@ -29,7 +29,6 @@
#include "VertexShaderCache.h"
#include "PixelShaderManager.h"
#include "PixelShaderCache.h"
#include "Utils.h"
#include "NativeVertexFormat.h"
#include "NativeVertexWriter.h"
#include "TextureCache.h"

View File

@ -25,7 +25,6 @@
#include "D3DBase.h"
#include "D3DShader.h"
#include "Statistics.h"
#include "Utils.h"
#include "Profiler.h"
#include "VideoConfig.h"
#include "VertexShaderCache.h"

View File

@ -1,29 +0,0 @@
#include <windows.h>
#include <vector>
#include "DialogManager.h"
typedef std::vector <HWND> WindowList;
WindowList dialogs;
void DialogManager::AddDlg(HWND hDialog)
{
dialogs.push_back(hDialog);
}
bool DialogManager::IsDialogMessage(LPMSG message)
{
WindowList::iterator iter;
for (iter=dialogs.begin(); iter!=dialogs.end(); ++iter)
{
if (::IsDialogMessage(*iter,message))
return true;
}
return false;
}
void DialogManager::EnableAll(BOOL enable)
{
WindowList::iterator iter;
for (iter=dialogs.begin(); iter!=dialogs.end(); ++iter)
EnableWindow(*iter,enable);
}

View File

@ -1,12 +0,0 @@
#pragma once
#include <windows.h>
class DialogManager
{
public:
static void AddDlg(HWND hDialog);
static bool IsDialogMessage(LPMSG message);
static void EnableAll(BOOL enable);
};

View File

@ -1,148 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include "File.h"
namespace W32Util
{
File::File()
{
fileHandle = INVALID_HANDLE_VALUE;
isOpen=false;
}
File::~File()
{
}
bool File::Open(const TCHAR *filename, eFileMode _mode)
{
mode = _mode;
//it's time to open the file
fileHandle = CreateFile(filename,
mode==FILE_READ ? GENERIC_READ : GENERIC_WRITE, //open mode
mode == FILE_READ ? FILE_SHARE_READ : NULL, //sharemode
NULL, //security
mode==FILE_READ ? OPEN_EXISTING : CREATE_ALWAYS, //create mode
FILE_ATTRIBUTE_NORMAL, //atrributes
NULL); //template
if (fileHandle == INVALID_HANDLE_VALUE)
isOpen=false;
else
isOpen=true;
return isOpen;
}
void File::Close()
{
if (isOpen)
{
//close the file and reset variables
CloseHandle(fileHandle);
fileHandle=INVALID_HANDLE_VALUE;
isOpen=false;
}
}
int File::GetSize()
{
if (!isOpen) //of course
return 0;
else
return GetFileSize(fileHandle,0);
}
int File::Write(void *data, int size) //let's do some writing
{
if (isOpen)
{
DWORD written;
WriteFile(fileHandle, data, size, &written,0);
return written; //we return the number of bytes that actually got written
}
else
{
return 0;
}
}
int File::Read(void *data, int size)
{
if (isOpen)
{
DWORD wasRead;
ReadFile(fileHandle, data, size, &wasRead,0);
return wasRead; //we return the number of bytes that actually was read
}
else
{
return 0;
}
}
int File::WR(void *data, int size)
{
if (mode==FILE_READ)
return Read(data,size);
else
return Write(data,size);
}
bool File::MagicCookie(int cookie)
{
if (mode==FILE_READ)
{
if (ReadInt()!=cookie)
{
char mojs[5],temp[256];
mojs[4]=0;
*(int*)mojs=cookie;
sprintf(temp,"W32Util::File: Magic Cookie %s is bad!",mojs);
MessageBoxA(0,temp,"Error reading file",MB_ICONERROR);
return false;
}
else
return true;
}
else if (mode==FILE_WRITE)
{
WriteInt(cookie);
return true;
}
return false;
}
int File::ReadInt()
{
int temp;
if (Read(&temp, sizeof(int)))
return temp;
else
return 0;
}
void File::WriteInt(int i)
{
Write(&i,sizeof(int));
}
char File::ReadChar()
{
char temp;
if (Read(&temp, sizeof(char)))
return temp;
else
return 0;
}
void File::WriteChar(char i)
{
Write(&i,sizeof(char));
}
}

View File

@ -1,61 +0,0 @@
#ifndef __LAMEFILE_H__
#define __LAMEFILE_H__
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
namespace W32Util
{
enum eFileMode
{
FILE_READ=5,
FILE_WRITE=6,
FILE_ERROR=0xff
};
class File
{
HANDLE fileHandle;
eFileMode mode;
bool isOpen;
public:
File();
virtual ~File();
bool Open(const TCHAR *filename, eFileMode mode);
void Adopt(HANDLE h) { fileHandle = h;}
void Close();
void WriteInt(int i);
void WriteChar(char i);
int Write(void *data, int size);
int ReadInt();
char ReadChar();
int Read(void *data, int size);
int WR(void *data, int size); //write or read depending on open mode
bool MagicCookie(int cookie);
int GetSize();
eFileMode GetMode() {return mode;}
void SeekBeg(int pos)
{
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_BEGIN);
}
void SeekEnd(int pos)
{
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_END);
}
void SeekCurrent(int pos)
{
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_CURRENT);
}
};
}
#endif //__LAMEFILE_H__

View File

@ -1,102 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include "Misc.h"
namespace W32Util
{
//shamelessly taken from http://www.catch22.org.uk/tuts/tips.asp
void CenterWindow(HWND hwnd)
{
HWND hwndParent;
RECT rect, rectP;
int width, height;
int screenwidth, screenheight;
int x, y;
//make the window relative to its parent
hwndParent = GetParent(hwnd);
if (!hwndParent)
return;
GetWindowRect(hwnd, &rect);
GetWindowRect(hwndParent, &rectP);
width = rect.right - rect.left;
height = rect.bottom - rect.top;
x = ((rectP.right-rectP.left) - width) / 2 + rectP.left;
y = ((rectP.bottom-rectP.top) - height) / 2 + rectP.top;
screenwidth = GetSystemMetrics(SM_CXSCREEN);
screenheight = GetSystemMetrics(SM_CYSCREEN);
//make sure that the dialog box never moves outside of
//the screen
if(x < 0) x = 0;
if(y < 0) y = 0;
if(x + width > screenwidth) x = screenwidth - width;
if(y + height > screenheight) y = screenheight - height;
MoveWindow(hwnd, x, y, width, height, FALSE);
}
HBITMAP CreateBitmapFromARGB(HWND someHwnd, DWORD *image, int w, int h)
{
BITMAPINFO *bitmap_header;
static char bitmapbuffer[sizeof(BITMAPINFO)+16];
memset(bitmapbuffer,0,sizeof(BITMAPINFO)+16);
bitmap_header=(BITMAPINFO *)bitmapbuffer;
bitmap_header->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bitmap_header->bmiHeader.biPlanes = 1;
bitmap_header->bmiHeader.biBitCount = 32;
bitmap_header->bmiHeader.biCompression = BI_RGB;
bitmap_header->bmiHeader.biWidth = w;
bitmap_header->bmiHeader.biHeight = -h;
((unsigned long *)bitmap_header->bmiColors)[0] = 0x00FF0000;
((unsigned long *)bitmap_header->bmiColors)[1] = 0x0000FF00;
((unsigned long *)bitmap_header->bmiColors)[2] = 0x000000FF;
HDC dc = GetDC(someHwnd);
HBITMAP bitmap = CreateDIBitmap(dc,&bitmap_header->bmiHeader,CBM_INIT,image,bitmap_header,DIB_RGB_COLORS);
ReleaseDC(someHwnd,dc);
return bitmap;
}
void NiceSizeFormat(size_t size, char *out)
{
char *sizes[] = {"b","KB","MB","GB","TB","PB","EB"};
int s = 0;
int frac = 0;
while (size>1024)
{
s++;
frac = (int)size & 1023;
size /= 1024;
}
float f = (float)size + ((float)frac / 1024.0f);
sprintf(out,"%3.1f %s",f,sizes[s]);
}
BOOL CopyTextToClipboard(HWND hwnd, TCHAR *text)
{
OpenClipboard(hwnd);
EmptyClipboard();
HANDLE hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (wcslen(text) + 1) * sizeof(TCHAR));
if (hglbCopy == NULL)
{
CloseClipboard();
return FALSE;
}
// Lock the handle and copy the text to the buffer.
TCHAR *lptstrCopy = (TCHAR *)GlobalLock(hglbCopy);
wcscpy(lptstrCopy, text);
lptstrCopy[wcslen(text)] = (TCHAR) 0; // null character
GlobalUnlock(hglbCopy);
SetClipboardData(CF_TEXT,hglbCopy);
CloseClipboard();
return TRUE;
}
}

View File

@ -1,9 +0,0 @@
#pragma once
namespace W32Util
{
void CenterWindow(HWND hwnd);
HBITMAP CreateBitmapFromARGB(HWND someHwnd, DWORD *image, int w, int h);
void NiceSizeFormat(size_t size, char * out);
BOOL CopyTextToClipboard(HWND hwnd, char * text);
}

View File

@ -1,227 +0,0 @@
#include "Misc.h"
#include "PropertySheet.h"
namespace W32Util
{
bool centered;
PropSheet::PropSheet()
{
watermark = 0;
header = 0;
icon = 0;
}
int CALLBACK PropSheet::Callback(HWND hwndDlg, UINT uMsg, LPARAM lParam)
{
switch (uMsg) {
case PSCB_PRECREATE:
{
if (uMsg == PSCB_PRECREATE)
{
/*
if (lParam)
{
DLGTEMPLATE *pDlgTemplate;
DLGTEMPLATEEX *pDlgTemplateEx;
pDlgTemplateEx = (DLGTEMPLATEEX *)lParam;
if (pDlgTemplateEx->signature == 0xFFFF)
{
// pDlgTemplateEx points to an extended
// dialog template structure.
//pDlgTemplate->style |= DS_SETFONT;
u8 *tmp1 = (u8*)&pDlgTemplateEx + sizeof(DLGTEMPLATEEX);
u16 *tmp = (u16*)tmp1;
tmp++; //skip menu
tmp++; //skip dlg class
//Crash();
//Here we should bash in Segoe UI
//It turns out to be way complicated though
//Not worth it
}
else
{
// This is a standard dialog template
// structure.
pDlgTemplate = (DLGTEMPLATE *)lParam;
}
} */
}
}
break;
case PSCB_INITIALIZED:
{
}
return 0;
}
return 0;
}
void PropSheet::Show(HINSTANCE hInstance, HWND hParent, LPCTSTR title, int startpage, bool floating, bool wizard)
{
HPROPSHEETPAGE *pages = new HPROPSHEETPAGE[list.size()];
PROPSHEETPAGE page;
//common settings
memset((void*)&page,0,sizeof(PROPSHEETPAGE));
page.dwSize = sizeof(PROPSHEETPAGE);
page.hInstance = hInstance;
int i=0;
for (DlgList::iterator iter = list.begin(); iter != list.end(); ++iter, ++i)
{
if (wizard)
{
if (i == 0 || i == list.size()-1)
page.dwFlags = PSP_HIDEHEADER;
else
page.dwFlags = PSP_USEHEADERTITLE|PSP_USEHEADERSUBTITLE;
}
else
{
page.dwFlags = PSP_USETITLE;
}
page.pszTemplate = iter->resource;
page.pfnDlgProc = Tab::TabDlgProc;
page.pszTitle = iter->title;
page.pszHeaderTitle = wizard?iter->title:0;
page.pszHeaderSubTitle = wizard?iter->hdrSubTitle:0;
page.lParam = (LPARAM)iter->tab;
pages[i] = CreatePropertySheetPage(&page);
}
PROPSHEETHEADER sheet;
memset(&sheet,0,sizeof(sheet));
sheet.dwSize = sizeof(PROPSHEETHEADER);
sheet.hInstance = hInstance;
sheet.hwndParent = hParent;
sheet.pszbmWatermark = watermark;
sheet.pszbmHeader = header;
sheet.pszCaption = title;
sheet.nPages = (UINT)list.size();
sheet.phpage = pages;
sheet.nStartPage = startpage;
sheet.pfnCallback = (PFNPROPSHEETCALLBACK)Callback;
NONCLIENTMETRICS ncm = {0};
ncm.cbSize = sizeof(ncm);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
hDialogFont = CreateFontIndirect(&ncm.lfMessageFont);
if (wizard)
{
sheet.dwFlags = PSH_USECALLBACK | PSH_WIZARD97 | (watermark?PSH_WATERMARK:0) | (header?PSH_HEADER:0);
//Create the intro/end title font
LOGFONT TitleLogFont = ncm.lfMessageFont;
TitleLogFont.lfWeight = FW_BOLD;
lstrcpy(TitleLogFont.lfFaceName, TEXT("Verdana Bold"));
//StringCchCopy(TitleLogFont.lfFaceName, 32, TEXT("Verdana Bold"));
HDC hdc = GetDC(NULL); //gets the screen DC
int FontSize = 12;
TitleLogFont.lfHeight = 0 - GetDeviceCaps(hdc, LOGPIXELSY) * FontSize / 72;
hTitleFont = CreateFontIndirect(&TitleLogFont);
ReleaseDC(NULL, hdc);
} else {
sheet.dwFlags = PSH_USECALLBACK | PSH_PROPTITLE;
hTitleFont = 0;
}
if (icon) {
sheet.dwFlags |= PSH_USEHICON;
sheet.hIcon = icon;
}
sheet.dwFlags |= PSH_NOCONTEXTHELP;
if (floating)
sheet.dwFlags |= PSH_MODELESS;
//else
// sheet.dwFlags |= PSH_NOAPPLYNOW;
centered=false;
PropertySheet(&sheet);
if (!floating)
{
for (DlgList::iterator iter = list.begin(); iter != list.end(); ++iter)
{
delete iter->tab;
}
DeleteObject(hTitleFont);
}
DeleteObject(hDialogFont);
delete [] pages;
}
void PropSheet::Add(Tab *tab, LPCTSTR resource, LPCTSTR title, LPCTSTR subtitle)
{
tab->sheet = this;
list.push_back(Page(tab,resource,title,subtitle));
}
void WizExteriorPage::Init(HWND hDlg)
{
HWND hwndControl = GetDlgItem(hDlg, captionID);
//SetWindowFont(hwndControl, sheet->GetTitleFont(), TRUE);
SendMessage(hwndControl,WM_SETFONT,(WPARAM)sheet->GetTitleFont(),0);
}
INT_PTR Tab::TabDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
Tab *tab = (Tab *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
switch(message)
{
case WM_INITDIALOG:
{
if (!centered) //HACK
{
CenterWindow(GetParent(hDlg));
centered=true;
}
LPARAM l = ((LPPROPSHEETPAGE)lParam)->lParam;
tab = (Tab *)l;
SetWindowLongPtr(hDlg, GWLP_USERDATA, (DWORD_PTR)l);
tab->Init(hDlg);
}
break;
case WM_COMMAND:
tab->Command(hDlg,wParam);
PropSheet_Changed(GetParent(hDlg), hDlg);
break;
case WM_NOTIFY:
{
LPNMHDR lpnmh = (LPNMHDR) lParam;
HWND sheet = lpnmh->hwndFrom;
switch(lpnmh->code) {
case PSN_APPLY:
tab->Apply(hDlg);
SetWindowLongPtr(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
break;
case PSN_SETACTIVE:
PropSheet_SetWizButtons(GetParent(hDlg),
(tab->HasPrev()?PSWIZB_BACK:0) |
(tab->HasNext()?PSWIZB_NEXT:0) |
(tab->HasFinish()?PSWIZB_FINISH:0));
break;
case PSN_KILLACTIVE:
SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE);
break;
case PSN_WIZNEXT:
tab->Apply(hDlg); //maybe not always good
break;
case PSN_WIZBACK:
case PSN_RESET: //cancel
break;
default:
return tab->Notify(hDlg, lParam);
}
}
break;
}
return 0;
}
}

View File

@ -1,87 +0,0 @@
#pragma once
#include <vector>
namespace W32Util
{
class PropSheet;
class Tab
{
public:
PropSheet *sheet; //back pointer ..
virtual void Init(HWND hDlg) {}
virtual void Command(HWND hDlg, WPARAM wParam) {}
virtual int Notify(HWND, LPARAM) {return 0;}
virtual void Apply(HWND hDlg) {}
virtual bool HasPrev() {return true;}
virtual bool HasFinish() {return false;}
virtual bool HasNext() {return true;}
static INT_PTR __stdcall TabDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
};
class WizExteriorPage : public Tab
{
int captionID;
public:
WizExteriorPage(int caption) {captionID = caption;}
void Init(HWND hDlg);
};
class WizFirstPage : public WizExteriorPage
{
public:
WizFirstPage(int caption) : WizExteriorPage(caption) {}
bool HasPrev() {return false;}
};
class WizLastPage : public WizExteriorPage
{
public:
WizLastPage(int caption) : WizExteriorPage(caption) {}
bool HasNext() {return false;}
bool HasFinish() {return true;}
};
class WizInteriorPage : public Tab
{
public:
};
class PropSheet
{
LPCTSTR watermark;
LPCTSTR header;
HFONT hTitleFont;
HFONT hDialogFont;
HICON icon;
struct Page
{
Page(Tab *_tab, LPCTSTR _resource, LPCTSTR _title, LPCTSTR _subtitle = 0)
: tab(_tab), resource(_resource), title(_title), hdrSubTitle(_subtitle) {}
Tab *tab;
LPCTSTR resource;
LPCTSTR title;
LPCTSTR hdrSubTitle;
};
public:
PropSheet();
typedef std::vector<Page> DlgList;
DlgList list;
void SetWaterMark(LPCTSTR _watermark) {watermark=_watermark;}
void SetHeader(LPCTSTR _header) {header=_header;}
void SetIcon(HICON _icon) {icon = _icon;}
void Add(Tab *tab, LPCTSTR resource, LPCTSTR title, LPCTSTR subtitle = 0);
void Show(HINSTANCE hInstance, HWND hParent, LPCTSTR title, int startpage=0, bool floating = false, bool wizard = false);
HFONT GetTitleFont() {return hTitleFont;}
HFONT GetFont() {return hDialogFont;}
static int CALLBACK Callback(HWND hwndDlg, UINT uMsg, LPARAM lParam);
};
}

View File

@ -1,113 +0,0 @@
#include <shlobj.h>
#include <xstring>
#include <string>
#include "ShellUtil.h"
namespace W32Util
{
std::string BrowseForFolder(HWND parent, char *title)
{
BROWSEINFOA info;
memset(&info,0,sizeof(info));
info.hwndOwner = parent;
info.lpszTitle = title;
info.ulFlags = BIF_EDITBOX | BIF_RETURNONLYFSDIRS;
//info.pszDisplayName
LPCITEMIDLIST idList = SHBrowseForFolderA(&info);
char temp[MAX_PATH];
SHGetPathFromIDListA(idList, temp);
if (strlen(temp))
{
return temp;
}
else
return "";
}
//---------------------------------------------------------------------------------------------------
// function WinBrowseForFileName
//---------------------------------------------------------------------------------------------------
bool BrowseForFileName (bool _bLoad, HWND _hParent, const char *_pTitle,
const char *_pInitialFolder, const char *_pFilter, const char *_pExtension,
std::string& _strFileName)
{
char szFile [MAX_PATH+1] = {0};
char szFileTitle [MAX_PATH+1] = {0};
OPENFILENAMEA ofn;
ZeroMemory (&ofn,sizeof (ofn));
ofn.lStructSize = sizeof (OPENFILENAME);
ofn.lpstrInitialDir = _pInitialFolder;
ofn.lpstrFilter = _pFilter;
ofn.nMaxFile = sizeof (szFile);
ofn.lpstrFile = szFile;
ofn.lpstrFileTitle = szFileTitle;
ofn.nMaxFileTitle = sizeof (szFileTitle);
ofn.lpstrDefExt = _pExtension;
ofn.hwndOwner = _hParent;
ofn.Flags = OFN_NOCHANGEDIR | OFN_EXPLORER | OFN_HIDEREADONLY;
if (_strFileName.size () != 0)
ofn.lpstrFile = (char *)_strFileName.c_str();
if (((_bLoad) ? GetOpenFileNameA(&ofn) : GetSaveFileNameA(&ofn)))
{
_strFileName = ofn.lpstrFile;
return true;
}
return false;
}
std::vector<std::string> BrowseForFileNameMultiSelect(bool _bLoad, HWND _hParent, const char *_pTitle,
const char *_pInitialFolder,const char *_pFilter,const char *_pExtension)
{
char szFile [MAX_PATH+1+2048*2];
char szFileTitle [MAX_PATH+1];
strcpy (szFile,"");
strcpy (szFileTitle,"");
OPENFILENAMEA ofn;
ZeroMemory (&ofn,sizeof (ofn));
ofn.lStructSize = sizeof (OPENFILENAME);
ofn.lpstrInitialDir = _pInitialFolder;
ofn.lpstrFilter = _pFilter;
ofn.nMaxFile = sizeof (szFile);
ofn.lpstrFile = szFile;
ofn.lpstrFileTitle = szFileTitle;
ofn.nMaxFileTitle = sizeof (szFileTitle);
ofn.lpstrDefExt = _pExtension;
ofn.hwndOwner = _hParent;
ofn.Flags = OFN_NOCHANGEDIR | OFN_EXPLORER | OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT ;
std::vector<std::string> files;
if (((_bLoad)?GetOpenFileNameA (&ofn):GetSaveFileNameA (&ofn)))
{
std::string directory = ofn.lpstrFile;
char *temp = ofn.lpstrFile;
char *oldtemp = temp;
temp+=strlen(temp)+1;
if (*temp==0)
{
//we only got one file
files.push_back(std::string(oldtemp));
}
else
{
while (*temp)
{
files.push_back(directory+"\\"+std::string(temp));
temp+=strlen(temp)+1;
}
}
return files;
}
return std::vector<std::string>(); // empty vector;
}
} // namespace

View File

@ -1,15 +0,0 @@
#pragma once
#include <xstring>
#include <vector>
namespace W32Util
{
std::string BrowseForFolder(HWND parent, char *title);
bool BrowseForFileName (bool _bLoad, HWND _hParent, const char *_pTitle,
const char *_pInitialFolder,const char *_pFilter,const char *_pExtension,
std::string& _strFileName);
std::vector<std::string> BrowseForFileNameMultiSelect(bool _bLoad, HWND _hParent, const char *_pTitle,
const char *_pInitialFolder,const char *_pFilter,const char *_pExtension);
}

View File

@ -1,94 +0,0 @@
#include <commctrl.h>
#include "TabControl.h"
namespace W32Util
{
// __________________________________________________________________________________________________
// constructor
//
TabControl::TabControl(HINSTANCE _hInstance, HWND _hTabCtrl,DLGPROC _lpDialogFunc) :
m_hInstance(_hInstance),
m_hTabCtrl(_hTabCtrl),
m_numDialogs(0)
{
for (int i=0; i<MAX_WIN_DIALOGS; i++)
m_WinDialogs[i] = NULL;
}
// __________________________________________________________________________________________________
// destructor
//
TabControl::~TabControl(void)
{}
// __________________________________________________________________________________________________
// AddItem
//
HWND TabControl::AddItem (char* _szText,int _iResource,DLGPROC _lpDialogFunc)
{
TCITEMA tcItem;
ZeroMemory (&tcItem,sizeof (tcItem));
tcItem.mask = TCIF_TEXT | TCIF_IMAGE;
tcItem.dwState = 0;
tcItem.pszText = _szText;
tcItem.cchTextMax = sizeof (_szText);
tcItem.iImage = -1;
int nResult = TabCtrl_InsertItem (m_hTabCtrl,TabCtrl_GetItemCount (m_hTabCtrl),&tcItem);
HWND hDialog = CreateDialogA(m_hInstance,(LPCSTR)_iResource,m_hTabCtrl,_lpDialogFunc);
RECT rectInnerWindow = {0,0,0,0};
GetWindowRect (m_hTabCtrl,&rectInnerWindow);
TabCtrl_AdjustRect (m_hTabCtrl,FALSE,&rectInnerWindow);
POINT pntPosition = {rectInnerWindow.left,rectInnerWindow.top};
ScreenToClient(m_hTabCtrl, &pntPosition);
SetWindowPos(hDialog, 0,
pntPosition.x, pntPosition.y,
rectInnerWindow.right - rectInnerWindow.left,rectInnerWindow.bottom - rectInnerWindow.top,0);
ShowWindow(hDialog,SW_NORMAL);
m_WinDialogs[m_numDialogs] = hDialog;
m_numDialogs++;
SelectDialog (0);
return hDialog;
}
// __________________________________________________________________________________________________
// SelectDialog
//
void TabControl::SelectDialog (int _nDialogId)
{
for (int i = 0 ; i < m_numDialogs ; i ++)
if (m_WinDialogs[i] != NULL)
ShowWindow(m_WinDialogs[i],i == _nDialogId ? SW_NORMAL : SW_HIDE);
}
// __________________________________________________________________________________________________
// MessageHandler
//
void TabControl::MessageHandler(UINT message, WPARAM wParam, LPARAM lParam)
{
if (message == WM_NOTIFY)
{
NMHDR* pNotifyMessage = NULL;
pNotifyMessage = (LPNMHDR)lParam;
if (pNotifyMessage->hwndFrom == m_hTabCtrl)
{
int iPage = TabCtrl_GetCurSel (m_hTabCtrl);
SelectDialog (iPage);
}
}
}
}

View File

@ -1,36 +0,0 @@
#pragma once
namespace W32Util
{
#define MAX_WIN_DIALOGS 32
class TabControl
{
private:
HINSTANCE m_hInstance;
HWND m_hWndParent;
HWND m_hTabCtrl;
HWND m_WinDialogs[MAX_WIN_DIALOGS];
int m_numDialogs;
public:
TabControl(HINSTANCE _hInstance, HWND _hTabCtrl,DLGPROC _lpDialogFunc);
~TabControl(void);
//
// --- tools ---
//
HWND AddItem (char* _szText,int _iResource,DLGPROC _lpDialogFunc);
void SelectDialog (int _nDialogId);
void MessageHandler(UINT message, WPARAM wParam, LPARAM lParam);
};
}

View File

@ -1,82 +0,0 @@
#include "Thread.h"
namespace W32Util
{
// __________________________________________________________________________________________________
// Constructor
//
Thread::Thread ( DWORD (WINAPI * pFun) (void* arg), void* pArg)
{
_handle = CreateThread (
0, // Security attributes
0, // Stack size
pFun,
pArg,
CREATE_SUSPENDED,
&_tid);
}
// __________________________________________________________________________________________________
// Destructor
//
Thread::~Thread (void)
{
if (_handle != NULL)
{
if (CloseHandle (_handle) == FALSE)
{
Terminate();
}
}
}
// __________________________________________________________________________________________________
// Resume
//
void
Thread::Resume (void)
{
if (_handle != NULL)
ResumeThread (_handle);
}
// __________________________________________________________________________________________________
// WaitForDeath
//
void
Thread::WaitForDeath (void)
{
if (_handle != NULL)
WaitForSingleObject (_handle, 100);
}
// __________________________________________________________________________________________________
// Terminate
//
void
Thread::Terminate (void)
{
if (_handle != NULL)
TerminateThread (_handle, 0);
_handle = NULL;
}
// __________________________________________________________________________________________________
// SetPriority
//
void
Thread::SetPriority (int _nPriority)
{
if (_handle != NULL)
SetThreadPriority(_handle, _nPriority);
}
// __________________________________________________________________________________________________
// Suspend
//
void
Thread::Suspend (void)
{
if (_handle != NULL)
SuspendThread(_handle);
}
}

View File

@ -1,36 +0,0 @@
#pragma once
namespace W32Util
{
class Thread
{
private:
HANDLE _handle;
DWORD _tid; // thread id
public:
Thread ( DWORD (WINAPI * pFun) (void* arg), void* pArg);
~Thread () ;
//
// --- tools ---
//
void Resume(void);
void Suspend(void);
void WaitForDeath(void);
void Terminate(void);
void SetPriority(int _nPriority);
bool IsActive (void);
HANDLE GetHandle(void) {return _handle;}
};
}

View File

@ -52,15 +52,11 @@ GFXDebuggerDX9 *m_DebuggerFrame = NULL;
#include "DlgSettings.h"
#include "D3DTexture.h"
#include "D3DUtil.h"
#include "W32Util/Misc.h"
#include "EmuWindow.h"
#include "VideoState.h"
#include "XFBConvert.h"
#include "render.h"
#include "Utils.h"
HINSTANCE g_hInstance = NULL;
SVideoInitialize g_VideoInitialize;
PLUGIN_GLOBALS* globals = NULL;

View File

@ -134,7 +134,6 @@ VERTEXSHADER* VertexShaderCache::GetShader(u32 components)
}
memcpy(&last_vertex_shader_uid, &uid, sizeof(VERTEXSHADERUID));
VSCache::iterator iter = vshaders.find(uid);
if (iter != vshaders.end()) {