1
0
mirror of https://github.com/DxWnd/DxWnd.reloaded synced 2024-12-30 09:25:35 +01:00

v2_02_04_src

Former-commit-id: 1367b767e90df1e072467161f9db16af667aed54
This commit is contained in:
gho tik 2013-01-19 11:16:54 -05:00 committed by Refael ACkermann
parent 66876eb38f
commit 3ecf3a3a1f
37 changed files with 1468 additions and 5246 deletions

View File

@ -61,6 +61,10 @@
#define SHOWFPS 0x00004000 // shows FPS value to status win / log
#define HIDEMULTIMONITOR 0x00008000 // hide multimonitor configurations: GetAdapterCount returns 1.
#define TIMESTRETCH 0x00010000 // make system time stretchable
#define HOOKOPENGL 0x00020000 // Hook OpenGL calls
#define WALLPAPERMODE 0x00040000 // mouse events are discarded (good for screensaver-like)
#define SHOWHWCURSOR 0x00080000 // mouse events are discarded (good for screensaver-like)
#define HOOKGDI 0x00100000 // Hook GDI functions
// logging Tflags DWORD:
#define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general
@ -80,6 +84,7 @@ typedef struct TARGETMAP
{
char path[MAX_PATH];
char module[60+1];
char OpenGLLib[20+1];
int dxversion;
int flags;
int flags2;
@ -95,6 +100,7 @@ typedef struct TARGETMAP
short sizx;
short sizy;
short MaxFPS;
short InitTS;
}TARGETMAP;
typedef struct
@ -109,6 +115,7 @@ typedef struct
DWORD dwPid;
BOOL isLogging;
DWORD FPSCount;
int iTimeShift;
} DXWNDSTATUS;
extern DXWNDSTATUS DxWndStatus;
@ -119,12 +126,13 @@ int EndHook(void);
void GetDllVersion(char *);
int GetHookStatus(DXWNDSTATUS *);
void SetHookStatus(DXWNDSTATUS *);
int GetTimeShift();
int HookInit(TARGETMAP *, HWND);
void *SetHook(void *, void *);
void SetHook(void *, void *, void **, char *);
void OutTrace(const char *, ...);
void *HookAPI(const char *, void *, const char *, void *);
void *HookAPI(const char *, char *, void *, const char *, void *);
void AdjustWindowFrame(HWND, DWORD, DWORD);
LRESULT CALLBACK extWindowProc(HWND, UINT, WPARAM, LPARAM);

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f9c184ea18b592accf84a23876799143c8e5c16761512624d25c595298e34470
size 260608
oid sha256:df99818897624e2426ed40251d25c8c8f8a50e5174746aed2c5c1be3dbfcd4a4
size 262144

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f3ff1ef480c67937ed3848ce26c7612704b0017f3c49fd597915d2273bfff76f
size 484352
oid sha256:63d93b8775f8106a4ed846e49768c1ff2203c049656866b84a8f046d1c9864d9
size 488448

File diff suppressed because it is too large Load Diff

View File

@ -6,3 +6,10 @@ Hide Multi Monitor configuration flag - used for "Dream Acquarium" on multimonit
v2.2.02
preliminary time stretching: so far applies to GetTickCount() only, and is controlled by Alt-F5 / F6 keys.
Fixed bug in GDI BitBlt call: stretching must be made on screen DC only, or it's made twice.
v2.02.03/04:
code cleanup - see syslib calls hooking
new configuration flags: Hook GDI and Hook OpenGL
OpenGL custom library field
API hooking fix with module specification
Time stratching by keyboard control (Alt F5/F6) and/or Time Slider dialog

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
int HookDirectDraw(int);
int HookDDProxy(int);
int HookDirect3D(int);
int HookOle32(int);
int HookDirectInput(int);
int HookDirectDraw(char *, int);
int HookDDProxy(char *, int);
int HookDirect3D(char *, int);
int HookOle32(char *, int);
int HookDirectInput(char *, int);
void InitPosition(int, int, int, int, int, int);
void InitWindowPos(int, int, int, int);
//void InitWindowPos(int, int, int, int);
extern LPCSTR ProcToString(LPCSTR proc);

View File

@ -2,8 +2,9 @@
#include "dxwcore.hpp"
#include "syslibs.h"
extern GetCursorPos_Type pGetCursorPos;
extern ClientToScreen_Type pClientToScreen;
/* ------------------------------------------------------------------ */
// Constructor, destructor, initialization....
/* ------------------------------------------------------------------ */
dxwCore::dxwCore()
{
@ -17,6 +18,11 @@ dxwCore::dxwCore()
bActive = TRUE;
bDInputAbs = 0;
TimeShift = 0;
lpDDSPrimHDC = NULL;
//IsWithinDDraw = FALSE;
IsGDIPalette = FALSE;
memset(PrimSurfaces, 0, sizeof(PrimSurfaces));
// preserved syslibs pointers
pClientToScreen=ClientToScreen;
@ -38,10 +44,95 @@ void dxwCore::InitTarget(TARGETMAP *target)
dwTFlags = target->tflags;
gsModules = target->module;
MaxFPS = target->MaxFPS;
CustomOpenGLLib = target->OpenGLLib;
if(!strlen(CustomOpenGLLib)) CustomOpenGLLib=NULL;
// bounds control
dwTargetDDVersion = target->dxversion;
if(dwTargetDDVersion<0) dwTargetDDVersion=0;
if(dwTargetDDVersion>10) dwTargetDDVersion=10;
TimeShift = target->InitTS;
if(TimeShift < -4) TimeShift = -4;
if(TimeShift > 4) TimeShift = 4;
}
/* ------------------------------------------------------------------ */
// Primary surfaces auxiliary functions
/* ------------------------------------------------------------------ */
void dxwCore::MarkPrimarySurface(LPDIRECTDRAWSURFACE ps)
{
int i;
// OutTraceD("PRIMARYSURFACE add %x\n",ps);
for (i=0;i<DDSQLEN;i++) {
if (PrimSurfaces[i]==(DWORD)ps) return; // if already there ....
if (PrimSurfaces[i]==(DWORD)0) break; // got end of list
}
PrimSurfaces[i]=(DWORD)ps;
}
// Note: since MS itself declares that the object refcount is not reliable and should
// be used for debugging only, it's not safe to rely on refcount==0 when releasing a
// surface to terminate its classification as primary. As an alternate and more reliable
// way, we use UnmarkPrimarySurface each time you create a new not primary surface,
// eliminating the risk that a surface previously classified as primary and then closed
// had the same surface handle than this new one that is not primary at all.
void dxwCore::UnmarkPrimarySurface(LPDIRECTDRAWSURFACE ps)
{
int i;
// OutTraceD("PRIMARYSURFACE del %x\n",ps);
for (i=0;i<DDSQLEN;i++) {
if (PrimSurfaces[i]==(DWORD)ps) break;
if (PrimSurfaces[i]==0) break;
}
if (PrimSurfaces[i]==(DWORD)ps){
for (; i<DDSQLEN; i++){
PrimSurfaces[i]=PrimSurfaces[i+1];
if (PrimSurfaces[i]==0) break;
}
PrimSurfaces[DDSQLEN]=0;
}
}
BOOL dxwCore::IsAPrimarySurface(LPDIRECTDRAWSURFACE ps)
{
int i;
// treat NULL surface ptr as a non primary
if(!ps) return FALSE;
for (i=0;i<DDSQLEN;i++) {
if (PrimSurfaces[i]==(DWORD)ps) return TRUE;
if (PrimSurfaces[i]==0) return FALSE;
}
return FALSE;
}
LPDIRECTDRAWSURFACE dxwCore::GetPrimarySurface(void)
{
// return last opened one....
int i;
for (i=0;i<DDSQLEN;i++) {
if (PrimSurfaces[i]==0) break;
}
if (i) return((LPDIRECTDRAWSURFACE)PrimSurfaces[i-1]);
return NULL;
}
void dxwCore::SetPrimarySurface(void)
{
if (!lpDDSPrimHDC) lpDDSPrimHDC=GetPrimarySurface();
}
void dxwCore::ResetPrimarySurface(void)
{
lpDDSPrimHDC=NULL;
}
void dxwCore::InitWindowPos(int x, int y, int w, int h)
{
iPosX = x;
iPosX = y;
iSizX = w;
iSizY = h;
}
RECT dxwCore::GetScreenRect()
@ -135,9 +226,9 @@ void dxwCore::SetClipCursor()
RECT Rect;
POINT UpLeftCorner;
OutTraceD("Core::SetClipCursor:\n");
OutTraceD("SetClipCursor:\n");
if (hWnd==NULL) {
OutTraceD("Core::SetClipCursor: ASSERT hWnd==NULL\n");
OutTraceD("SetClipCursor: ASSERT hWnd==NULL\n");
return;
}
(*pGetClientRect)(hWnd, &Rect);
@ -151,13 +242,13 @@ void dxwCore::SetClipCursor()
if(!(*pClipCursor)(&Rect)){
OutTraceE("ClipCursor: ERROR err=%d at %d\n", GetLastError(), __LINE__);
}
OutTraceD("Core::SetClipCursor: rect=(%d,%d)-(%d,%d)\n",
OutTraceD("SetClipCursor: rect=(%d,%d)-(%d,%d)\n",
Rect.left, Rect.top, Rect.right, Rect.bottom);
}
void dxwCore::EraseClipCursor()
{
OutTraceD("Core::EraseClipCursor:\n");
OutTraceD("EraseClipCursor:\n");
(*pClipCursor)(NULL);
}
@ -212,7 +303,7 @@ void dxwCore::ScreenRefresh(void)
#define DXWREFRESHINTERVAL 20
LPDIRECTDRAWSURFACE lpDDSPrim;
extern LPDIRECTDRAWSURFACE GetPrimarySurface();
// extern LPDIRECTDRAWSURFACE GetPrimarySurface();
extern HRESULT WINAPI extBlt(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect, DWORD dwflags, LPDDBLTFX lpddbltfx);
static int t = -1;
@ -222,7 +313,7 @@ void dxwCore::ScreenRefresh(void)
if (tn-t < DXWREFRESHINTERVAL) return;
lpDDSPrim=GetPrimarySurface();
lpDDSPrim=dxw.GetPrimarySurface();
// if too early ....
if (lpDDSPrim)
extBlt(lpDDSPrim, NULL, lpDDSPrim, NULL, 0, NULL);
@ -293,12 +384,62 @@ DWORD dxwCore::GetTickCount(void)
static DWORD dwLastRealTick=0;
static DWORD dwLastFakeTick=0;
DWORD dwNextRealTick;
// extern DXWNDSTATUS *pStatus;
dwNextRealTick=(*pGetTickCount)();
dwTick=(dwNextRealTick-dwLastRealTick);
// TimeShift=pStatus->iTimeShift;
TimeShift=GetTimeShift();
if (TimeShift > 0) dwTick >>= TimeShift;
if (TimeShift < 0) dwTick <<= -TimeShift;
dwLastFakeTick += dwTick;
dwLastRealTick = dwNextRealTick;
return dwLastFakeTick;
}
DWORD dxwCore::StretchTime(DWORD dwTimer)
{
//extern DXWNDSTATUS *pStatus;
//TimeShift=pStatus->iTimeShift;
TimeShift=GetTimeShift();
if (TimeShift > 0) dwTimer <<= TimeShift;
if (TimeShift < 0) dwTimer >>= -TimeShift;
return dwTimer;
}
void dxwCore::GetSystemTime(LPSYSTEMTIME lpSystemTime)
{
DWORD dwTick;
DWORD dwCurrentTick;
FILETIME CurrFileTime;
static DWORD dwStartTick=0;
static DWORD dwUpdateTick=0;
static FILETIME StartFileTime;
extern DXWNDSTATUS *pStatus;
//TimeShift=pStatus->iTimeShift;
if(dwStartTick==0) {
SYSTEMTIME StartingTime;
// first time through, initialize & return true time
dwStartTick = (*pGetTickCount)();
(*pGetSystemTime)(&StartingTime);
SystemTimeToFileTime(&StartingTime, &StartFileTime);
*lpSystemTime = StartingTime;
}
else {
dwCurrentTick=(*pGetTickCount)();
dwTick=(dwCurrentTick-dwStartTick);
TimeShift=GetTimeShift();
if (TimeShift > 0) dwTick >>= TimeShift;
if (TimeShift < 0) dwTick <<= -TimeShift;
// From MSDN: Contains a 64-bit value representing the number of
// 100-nanosecond intervals since January 1, 1601 (UTC).
// So, since 1mSec = 10.000 * 100nSec, you still have to multiply by 10.000.
CurrFileTime.dwHighDateTime = StartFileTime.dwHighDateTime; // wrong !!!!
CurrFileTime.dwLowDateTime = StartFileTime.dwLowDateTime + (10000 * dwTick); // wrong !!!!
FileTimeToSystemTime(&CurrFileTime, lpSystemTime);
// reset to avoid time jumps on TimeShift changes...
StartFileTime = CurrFileTime;
dwStartTick = dwCurrentTick;
}
}

View File

@ -1,6 +1,8 @@
#include <windows.h>
#include "syslibs.h"
#define DDSQLEN 0x10
class dxwCore
{
// Construction/destruction
@ -12,6 +14,7 @@ public:
public: // methods
void InitTarget(TARGETMAP *);
void SethWnd(HWND hwnd) {hWnd=hwnd;}
void InitWindowPos(int, int, int, int);
HWND GethWnd(void) {return hWnd;}
void SetScreenSize(void) {dwScreenWidth=800; dwScreenHeight=600;}
void SetScreenSize(int x, int y) {if(x)dwScreenWidth=x; if(y)dwScreenHeight=y;}
@ -29,8 +32,17 @@ public: // methods
RECT MapWindowRect(LPRECT lpRect);
RECT MapWindowRect(void);
void ScreenRefresh(void);
BOOL HandleFPS();
BOOL HandleFPS(void);
DWORD GetTickCount(void);
void MarkPrimarySurface(LPDIRECTDRAWSURFACE);
void UnmarkPrimarySurface(LPDIRECTDRAWSURFACE);
BOOL IsAPrimarySurface(LPDIRECTDRAWSURFACE);
LPDIRECTDRAWSURFACE GetPrimarySurface(void);
void SetPrimarySurface(void);
void ResetPrimarySurface(void);
void GetSystemTime(LPSYSTEMTIME lpSystemTime);
DWORD StretchTime(DWORD);
public: // simple data variables
DDPIXELFORMAT ActualPixelFormat;
@ -50,6 +62,14 @@ public: // simple data variables
DWORD MaxFPS;
char *gsModules;
int TimeShift;
LPDIRECTDRAWSURFACE lpDDSPrimHDC;
short iPosX;
short iPosY;
short iSizX;
short iSizY;
//BOOL IsWithinDDraw; // flag to avoid double intervention at ddraw & GDI level
BOOL IsGDIPalette;
char *CustomOpenGLLib;
// Implementation
protected:
@ -57,6 +77,7 @@ protected:
DWORD dwScreenHeight;
BOOL FullScreen;
HWND hWnd;
DWORD PrimSurfaces[DDSQLEN+1];
ClientToScreen_Type pClientToScreen;
ClipCursor_Type pClipCursor;
GetClientRect_Type pGetClientRect;

View File

@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdio.h>
#include "dxwnd.h"
#define VERSION "2.02.02"
#define VERSION "2.02.04"
LRESULT CALLBACK HookProc(int ncode, WPARAM wparam, LPARAM lparam);
@ -125,6 +125,11 @@ void SetHookStatus(DXWNDSTATUS *s)
*pStatus=*s;
}
int GetTimeShift()
{
return pStatus->iTimeShift;
}
LRESULT CALLBACK HookProc(int ncode, WPARAM wparam, LPARAM lparam)
{
char name[MAX_PATH];
@ -166,6 +171,7 @@ LRESULT CALLBACK HookProc(int ncode, WPARAM wparam, LPARAM lparam)
pStatus->IsFullScreen=FALSE;
pStatus->hWnd=hwnd;
pStatus->dwPid=GetProcessId(GetCurrentProcess());
pStatus->iTimeShift=pMapping[i].InitTS;
DxWndStatus = *pStatus;
HookInit(&pMapping[i], hwnd);
}

View File

@ -5,3 +5,4 @@ EXPORTS
EndHook @3
GetDllVersion @4
GetHookStatus @5
SetHookStatus @6

BIN
dll/dxwnd.ncb Normal file

Binary file not shown.

View File

@ -1,389 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="dxwnd"
ProjectGUID="{579E7FE7-2745-4100-A802-23511711FCDE}"
RootNamespace="dxwnd"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/dxwnd.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/IInclude"
Optimization="0"
AdditionalIncludeDirectories="../Include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DXWND_EXPORTS"
MinimalRebuild="true"
ExceptionHandling="2"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
PrecompiledHeaderFile=".\Debug/dxwnd.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1041"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="shlwapi.lib odbc32.lib odbccp32.lib"
OutputFile="../Debug/dxwnd.dll"
LinkIncremental="2"
SuppressStartupBanner="true"
ModuleDefinitionFile=".\dxwnd.def"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/dxwnd.pdb"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary=".\Debug/dxwnd.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Debug/dxwnd.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/dxwnd.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../Include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DXWND_EXPORTS"
StringPooling="true"
ExceptionHandling="2"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile=".\Release/dxwnd.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1041"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="../Release/dxwnd.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
ModuleDefinitionFile=".\dxwnd.def"
ProgramDatabaseFile=".\Release/dxwnd.pdb"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary=".\Release/dxwnd.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Release/dxwnd.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath=".\dxemublt.cpp"
>
</File>
<File
RelativePath=".\dxhelper.cpp"
>
</File>
<File
RelativePath="dxhook.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="dxwnd.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="dxwnd.def"
>
</File>
<File
RelativePath=".\glhook.cpp"
>
</File>
<File
RelativePath="hd3d.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath=".\hddproxy.cpp"
>
</File>
<File
RelativePath="hddraw.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="hdinput.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath=".\syslibs.cpp"
>
</File>
<File
RelativePath=".\wndproc.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath=".\dxhelper.h"
>
</File>
<File
RelativePath="dxhook.h"
>
</File>
<File
RelativePath="..\Include\dxwnd.h"
>
</File>
<File
RelativePath=".\glhook.h"
>
</File>
<File
RelativePath=".\hddproxy.h"
>
</File>
<File
RelativePath=".\hddraw.h"
>
</File>
<File
RelativePath=".\syslibs.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

Binary file not shown.

View File

@ -8,10 +8,6 @@ glViewport_Type pglViewport;
glScissor_Type pglScissor;
glGetIntegerv_Type pglGetIntegerv;
//extern GLenum WINAPI glGetError();
extern short iPosX, iPosY, iSizX, iSizY;
void WINAPI extglViewport(GLint x, GLint y, GLsizei width, GLsizei height)
{
RECT client;
@ -44,21 +40,6 @@ void WINAPI extglGetIntegerv(GLenum pname, GLint *params)
{
(*pglGetIntegerv)(pname, params);
OutTraceD("glGetIntegerv: pname=%d\n", pname);
// if(glGetError()!=GL_NO_ERROR) OutTraceE("glGetIntegerv: ERROR %d at %d\n", glGetError(), __LINE__);
#if 0
if (pname==GL_VIEWPORT){
OutTraceD("glGetIntegerv: pname=GL_VIEWPORT real viewport=(%d,%d)-(%d,%d)\n",
params[0], params[1], params[2], params[3]);
//params[0]=(GLboolean)iPosX;
//params[1]=(GLboolean)iPosY;
params[0]=(GLint)0;
params[1]=(GLint)0;
params[2]=(GLint)iSizX;
params[3]=(GLint)iSizY;
OutTraceD("glGetIntegerv: pname=GL_VIEWPORT remapped viewport=(%d,%d)-(%d,%d)\n",
params[0], params[1], params[2], params[3]);
}
#endif
}
FARPROC Remap_gl_ProcAddress(LPCSTR proc, HMODULE hModule)
@ -82,19 +63,18 @@ FARPROC Remap_gl_ProcAddress(LPCSTR proc, HMODULE hModule)
return NULL;
}
void HookOpenGLLibs(int dxversion, char *module)
void HookOpenGLLibs(char *module, char *customlib)
{
void *tmp;
char *DefOpenGLModule="OpenGL32.dll";
if (dxversion!=10) return;
if (!module) module=DefOpenGLModule;
if (!customlib) customlib=DefOpenGLModule;
tmp = HookAPI(module, NULL, "glViewport", extglViewport);
tmp = HookAPI(module, customlib, NULL, "glViewport", extglViewport);
if(tmp) pglViewport = (glViewport_Type)tmp;
tmp = HookAPI(module, NULL, "glScissor", extglScissor);
tmp = HookAPI(module, customlib, NULL, "glScissor", extglScissor);
if(tmp) pglScissor = (glScissor_Type)tmp;
tmp = HookAPI(module, NULL, "glGetIntegerv", extglGetIntegerv);
tmp = HookAPI(module, customlib, NULL, "glGetIntegerv", extglGetIntegerv);
if(tmp) pglGetIntegerv = (glGetIntegerv_Type)tmp;
return;

View File

@ -1,7 +1,7 @@
#include "gl.h"
extern FARPROC Remap_gl_ProcAddress(LPCSTR, HMODULE);
extern void HookOpenGLLibs(int, char *);
extern void HookOpenGLLibs(char *, char *);
typedef void (WINAPI *glViewport_Type)(GLint, GLint, GLsizei, GLsizei);
typedef void (WINAPI *glScissor_Type)(GLint, GLint, GLsizei, GLsizei);

View File

@ -33,16 +33,16 @@ GetAdapterDisplayMode_Type pGetAdapterDisplayMode;
GetDisplayMode_Type pGetDisplayMode;
DWORD dwD3DVersion;
int HookDirect3D(int version){
int HookDirect3D(char *module, int version){
HINSTANCE hinst;
void *tmp;
LPDIRECT3D9 lpd3d;
switch(version){
case 0:
tmp = HookAPI("d3d8.dll", NULL, "Direct3DCreate8", extDirect3DCreate8);
tmp = HookAPI(module, "d3d8.dll", NULL, "Direct3DCreate8", extDirect3DCreate8);
if(tmp) pDirect3DCreate8 = (Direct3DCreate8_Type)tmp;
tmp = HookAPI("d3d9.dll", NULL, "Direct3DCreate9", extDirect3DCreate9);
tmp = HookAPI(module, "d3d9.dll", NULL, "Direct3DCreate9", extDirect3DCreate9);
if(tmp) pDirect3DCreate9 = (Direct3DCreate9_Type)tmp;
break;
case 8:
@ -126,13 +126,12 @@ HRESULT WINAPI extReset(void *pd3dd, D3DPRESENT_PARAMETERS* pPresentationParamet
HRESULT WINAPI extGetDisplayMode(void *lpd3d, D3DDISPLAYMODE *pMode)
{
HRESULT res;
extern short iSizX, iSizY;
res=(*pGetDisplayMode)(lpd3d, pMode);
OutTraceD("DEBUG: GetDisplayMode: size=(%dx%d) RefreshRate=%d Format=%d\n",
pMode->Width, pMode->Height, pMode->RefreshRate, pMode->Format);
if(dxw.dwFlags2 & KEEPASPECTRATIO){
pMode->Width=iSizX;
pMode->Height=iSizY;
pMode->Width=dxw.iSizX;
pMode->Height=dxw.iSizY;
OutTraceD("DEBUG: GetDisplayMode: fixed size=(%dx%d)\n", pMode->Width, pMode->Height);
}
return res;
@ -159,13 +158,12 @@ HRESULT WINAPI extEnumAdapterModes9(void *lpd3d, UINT Adapter, D3DFORMAT Format,
HRESULT WINAPI extGetAdapterDisplayMode(void *lpd3d, UINT Adapter, D3DDISPLAYMODE *pMode)
{
HRESULT res;
extern short iSizX, iSizY;
res=(*pGetAdapterDisplayMode)(lpd3d, Adapter, pMode);
OutTraceD("DEBUG: GetAdapterDisplayMode: size=(%dx%d) RefreshRate=%d Format=%d\n",
pMode->Width, pMode->Height, pMode->RefreshRate, pMode->Format);
if(dxw.dwFlags2 & KEEPASPECTRATIO){
pMode->Width=iSizX;
pMode->Height=iSizY;
pMode->Width=dxw.iSizX;
pMode->Height=dxw.iSizY;
OutTraceD("DEBUG: GetDisplayMode: fixed size=(%dx%d)\n", pMode->Width, pMode->Height);
}
return res;

View File

@ -169,11 +169,11 @@ extern GDIGetDC_Type pGDIGetDC;
extern GDIGetDC_Type pGDIGetWindowDC;
extern GDIReleaseDC_Type pGDIReleaseDC;
extern CreateDC_Type pGDICreateDC;
extern CreateCompatibleDC_Type pCreateCompatibleDC;
extern BitBlt_Type pBitBlt;
extern PatBlt_Type pPatBlt;
extern StretchBlt_Type pStretchBlt;
extern DeleteDC_Type pDeleteDC;
extern CreateCompatibleDC_Type pGDICreateCompatibleDC;
extern BitBlt_Type pGDIBitBlt;
extern PatBlt_Type pGDIPatBlt;
extern StretchBlt_Type pGDIStretchBlt;
extern DeleteDC_Type pGDIDeleteDC;
SaveDC_Type pSaveDC;
RestoreDC_Type pRestoreDC;
extern BeginPaint_Type pBeginPaint;
@ -273,7 +273,7 @@ FARPROC WINAPI extGetProcAddressProxy(HMODULE hModule, LPCSTR proc)
//
// ------------------------------------------------------------------------------------------ //
int HookDDProxy(int dxVersion)
int HookDDProxy(char *module, int dxVersion)
{
HINSTANCE hinst;
void *tmp;
@ -283,60 +283,60 @@ int HookDDProxy(int dxVersion)
dxw.dwFlags1 |= OUTDDRAWTRACE;
pCreateCompatibleDC=CreateCompatibleDC;
pGDICreateCompatibleDC=CreateCompatibleDC;
pGDIGetDC=GetDC;
pGDIGetWindowDC=GetWindowDC;
pGDIReleaseDC=ReleaseDC;
pCreateDC=CreateDC;
pBitBlt=BitBlt;
pPatBlt=PatBlt;
pStretchBlt=StretchBlt;
pDeleteDC=DeleteDC;
pGDICreateDC=CreateDC;
pGDIBitBlt=BitBlt;
pGDIPatBlt=PatBlt;
pGDIStretchBlt=StretchBlt;
pGDIDeleteDC=DeleteDC;
pSaveDC=SaveDC;
pRestoreDC=RestoreDC;
pSelectPalette=SelectPalette;
tmp = HookAPI("GDI32.dll", CreateCompatibleDC, "CreateCompatibleDC", extCreateCompatibleDCProxy);
if(tmp) pCreateCompatibleDC = (CreateCompatibleDC_Type)tmp;
tmp = HookAPI("user32.dll", GetDC, "GetDC", extGDIGetDCProxy);
pGDISelectPalette=SelectPalette;
tmp = HookAPI(module, "GDI32.dll", CreateCompatibleDC, "CreateCompatibleDC", extCreateCompatibleDCProxy);
if(tmp) pGDICreateCompatibleDC = (CreateCompatibleDC_Type)tmp;
tmp = HookAPI(module, "user32.dll", GetDC, "GetDC", extGDIGetDCProxy);
if(tmp) pGDIGetDC = (GDIGetDC_Type)tmp;
tmp = HookAPI("user32.dll", GetWindowDC, "GetWindowDC", extGetWindowDCProxy);
tmp = HookAPI(module, "user32.dll", GetWindowDC, "GetWindowDC", extGetWindowDCProxy);
if(tmp) pGDIGetWindowDC = (GDIGetDC_Type)tmp;
tmp = HookAPI("user32.dll", ReleaseDC, "ReleaseDC", extGDIReleaseDCProxy);
tmp = HookAPI(module, "user32.dll", ReleaseDC, "ReleaseDC", extGDIReleaseDCProxy);
if(tmp) pGDIReleaseDC = (GDIReleaseDC_Type)tmp;
tmp = HookAPI("GDI32.dll", CreateDCA, "CreateDCA", extCreateDCProxy);
if(tmp) pCreateDC = (CreateDC_Type)tmp;
tmp = HookAPI("GDI32.dll", BitBlt, "BitBlt", extBitBltProxy);
if(tmp) pBitBlt = (BitBlt_Type)tmp;
tmp = HookAPI("GDI32.dll", StretchBlt, "StretchBlt", extStretchBltProxy);
if(tmp) pStretchBlt = (StretchBlt_Type)tmp;
tmp = HookAPI("GDI32.dll", PatBlt, "PatBlt", extPatBltProxy);
if(tmp) pPatBlt = (PatBlt_Type)tmp;
tmp = HookAPI("GDI32.dll", DeleteDC, "DeleteDC", extDeleteDCProxy);
if(tmp) pDeleteDC = (DeleteDC_Type)tmp;
tmp = HookAPI("GDI32.dll", SaveDC, "SaveDC", extSaveDCProxy);
tmp = HookAPI(module, "GDI32.dll", CreateDCA, "CreateDCA", extCreateDCProxy);
if(tmp) pGDICreateDC = (CreateDC_Type)tmp;
tmp = HookAPI(module, "GDI32.dll", BitBlt, "BitBlt", extBitBltProxy);
if(tmp) pGDIBitBlt = (BitBlt_Type)tmp;
tmp = HookAPI(module, "GDI32.dll", StretchBlt, "StretchBlt", extStretchBltProxy);
if(tmp) pGDIStretchBlt = (StretchBlt_Type)tmp;
tmp = HookAPI(module, "GDI32.dll", PatBlt, "PatBlt", extPatBltProxy);
if(tmp) pGDIPatBlt = (PatBlt_Type)tmp;
tmp = HookAPI(module, "GDI32.dll", DeleteDC, "DeleteDC", extDeleteDCProxy);
if(tmp) pGDIDeleteDC = (DeleteDC_Type)tmp;
tmp = HookAPI(module, "GDI32.dll", SaveDC, "SaveDC", extSaveDCProxy);
if(tmp) pGDISaveDC = (SaveDC_Type)tmp;
tmp = HookAPI("GDI32.dll", RestoreDC, "RestoreDC", extRestoreDCProxy);
tmp = HookAPI(module, "GDI32.dll", RestoreDC, "RestoreDC", extRestoreDCProxy);
if(tmp) pGDIRestoreDC = (RestoreDC_Type)tmp;
tmp = HookAPI("GDI32.dll", SelectPalette, "SelectPalette", extSelectPaletteProxy);
if(tmp) pSelectPalette = (SelectPalette_Type)tmp;
tmp = HookAPI("GDI32.dll", RealizePalette, "RealizePalette", extRealizePaletteProxy);
if(tmp) pRealizePalette = (RealizePalette_Type)tmp;
tmp = HookAPI("GDI32.dll", GetSystemPaletteEntries, "GetSystemPaletteEntries", extGetSystemPaletteEntriesProxy);
if(tmp) pGetSystemPaletteEntries = (GetSystemPaletteEntries_Type)tmp;
tmp = HookAPI("user32.dll", BeginPaint, "BeginPaint", extBeginPaintProxy);
tmp = HookAPI(module, "GDI32.dll", SelectPalette, "SelectPalette", extSelectPaletteProxy);
if(tmp) pGDISelectPalette = (SelectPalette_Type)tmp;
tmp = HookAPI(module, "GDI32.dll", RealizePalette, "RealizePalette", extRealizePaletteProxy);
if(tmp) pGDIRealizePalette = (RealizePalette_Type)tmp;
tmp = HookAPI(module, "GDI32.dll", GetSystemPaletteEntries, "GetSystemPaletteEntries", extGetSystemPaletteEntriesProxy);
if(tmp) pGDIGetSystemPaletteEntries = (GetSystemPaletteEntries_Type)tmp;
tmp = HookAPI(module, "user32.dll", BeginPaint, "BeginPaint", extBeginPaintProxy);
if(tmp) pBeginPaint = (BeginPaint_Type)tmp;
pGetProcAddress = (GetProcAddress_Type)GetProcAddress;
tmp = HookAPI("KERNEL32.dll", GetProcAddress, "GetProcAddress", extGetProcAddressProxy);
tmp = HookAPI(module, "KERNEL32.dll", GetProcAddress, "GetProcAddress", extGetProcAddressProxy);
if(tmp) pGetProcAddress = (GetProcAddress_Type)tmp;
switch(dxVersion){
case 0: // automatic
tmp = HookAPI("ddraw.dll", NULL, "DirectDrawCreate", extDirectDrawCreateProxy);
tmp = HookAPI(module, "ddraw.dll", NULL, "DirectDrawCreate", extDirectDrawCreateProxy);
if(tmp) pDirectDrawCreate = (DirectDrawCreate_Type)tmp;
tmp = HookAPI("ddraw.dll", NULL, "DirectDrawCreateEx", extDirectDrawCreateExProxy);
tmp = HookAPI(module, "ddraw.dll", NULL, "DirectDrawCreateEx", extDirectDrawCreateExProxy);
if(tmp) pDirectDrawCreateEx = (DirectDrawCreateEx_Type)tmp;
tmp = HookAPI("ddraw.dll", NULL, "DirectDrawEnumerateA", extDirectDrawEnumerateProxy);
tmp = HookAPI(module, "ddraw.dll", NULL, "DirectDrawEnumerateA", extDirectDrawEnumerateProxy);
if(tmp) pDirectDrawEnumerate = (DirectDrawEnumerate_Type)tmp;
tmp = HookAPI("ddraw.dll", NULL, "DirectDrawEnumerateExA", extDirectDrawEnumerateExProxy);
tmp = HookAPI(module, "ddraw.dll", NULL, "DirectDrawEnumerateExA", extDirectDrawEnumerateExProxy);
if(tmp) pDirectDrawEnumerateEx = (DirectDrawEnumerateEx_Type)tmp;
break;
case 1:
@ -352,8 +352,8 @@ int HookDDProxy(int dxVersion)
if(pDirectDrawCreate){
LPDIRECTDRAW lpdd;
BOOL res;
HookAPI("ddraw.dll", pDirectDrawCreate, "DirectDrawCreate", extDirectDrawCreateProxy);
HookAPI("ddraw.dll", pDirectDrawEnumerate, "DirectDrawEnumerateA", extDirectDrawEnumerateProxy);
HookAPI(module, "ddraw.dll", pDirectDrawCreate, "DirectDrawCreate", extDirectDrawCreateProxy);
HookAPI(module, "ddraw.dll", pDirectDrawEnumerate, "DirectDrawEnumerateA", extDirectDrawEnumerateProxy);
res=extDirectDrawCreateProxy(0, &lpdd, 0);
if (res){
OutTraceP("DirectDrawCreate: ERROR res=%x(%s)\n", res, ExplainDDError(res));
@ -372,9 +372,9 @@ int HookDDProxy(int dxVersion)
if(pDirectDrawCreate){
LPDIRECTDRAW lpdd;
BOOL res;
HookAPI("ddraw.dll", pDirectDrawCreate, "DirectDrawCreate", extDirectDrawCreateProxy);
HookAPI("ddraw.dll", pDirectDrawEnumerate, "DirectDrawEnumerateA", extDirectDrawEnumerateProxy);
HookAPI("ddraw.dll", pDirectDrawEnumerateEx, "DirectDrawEnumerateExA", extDirectDrawEnumerateExProxy);
HookAPI(module, "ddraw.dll", pDirectDrawCreate, "DirectDrawCreate", extDirectDrawCreateProxy);
HookAPI(module, "ddraw.dll", pDirectDrawEnumerate, "DirectDrawEnumerateA", extDirectDrawEnumerateProxy);
HookAPI(module, "ddraw.dll", pDirectDrawEnumerateEx, "DirectDrawEnumerateExA", extDirectDrawEnumerateExProxy);
res=extDirectDrawCreateProxy(0, &lpdd, 0);
if (res){
OutTraceP("DirectDrawCreate: ERROR res=%x(%s)\n", res, ExplainDDError(res));
@ -386,7 +386,7 @@ int HookDDProxy(int dxVersion)
if(pDirectDrawCreateEx){
LPDIRECTDRAW lpdd;
BOOL res;
HookAPI("ddraw.dll", pDirectDrawCreateEx, "DirectDrawCreateEx", extDirectDrawCreateExProxy);
HookAPI(module, "ddraw.dll", pDirectDrawCreateEx, "DirectDrawCreateEx", extDirectDrawCreateExProxy);
res=extDirectDrawCreateExProxy(0, &lpdd, dd7, 0);
if (res) OutTraceP("DirectDrawCreateEx: ERROR res=%x(%s)\n", res, ExplainDDError(res));
lpdd->Release();
@ -1868,11 +1868,11 @@ extern GDIGetDC_Type pGDIGetDC;
//GDIGetDC_Type pGDIGetWinDC;
extern GDIReleaseDC_Type pGDIReleaseDC;
extern CreateDC_Type pGDICreateDC;
extern CreateCompatibleDC_Type pCreateCompatibleDC;
extern BitBlt_Type pBitBlt;
extern PatBlt_Type pPatBlt;
extern StretchBlt_Type pStretchBlt;
extern DeleteDC_Type pDeleteDC;
extern CreateCompatibleDC_Type pGDICreateCompatibleDC;
extern BitBlt_Type pGDIBitBlt;
extern PatBlt_Type pGDIPatBlt;
extern StretchBlt_Type pGDIStretchBlt;
extern DeleteDC_Type pGDIDeleteDC;
extern SaveDC_Type pSaveDC;
extern RestoreDC_Type pRestoreDC;
@ -1907,7 +1907,7 @@ HDC WINAPI extCreateDCProxy(LPSTR Driver, LPSTR Device, LPSTR Output, CONST DEVM
OutTraceP("GDI.CreateDC: PROXED Driver=%s Device=%s Output=%s InitData=%x\n",
Driver?Driver:"(NULL)", Device?Device:"(NULL)", Output?Output:"(NULL)", InitData);
RetHDC=(*pCreateDC)(Driver, Device, Output, InitData);
RetHDC=(*pGDICreateDC)(Driver, Device, Output, InitData);
if(RetHDC)
OutTraceP("GDI.CreateDC: returning HDC=%x\n", RetHDC);
else
@ -1919,7 +1919,7 @@ HDC WINAPI extCreateCompatibleDCProxy(HDC hdc)
{
HDC RetHdc;
OutTraceP("GDI.CreateCompatibleDC: PROXED hdc=%x\n", hdc);
RetHdc=(*pCreateCompatibleDC)(hdc);
RetHdc=(*pGDICreateCompatibleDC)(hdc);
if(RetHdc)
OutTraceP("GDI.CreateCompatibleDC: returning HDC=%x\n", RetHdc);
else
@ -1934,7 +1934,7 @@ BOOL WINAPI extBitBltProxy(HDC hdcDest, int nXDest, int nYDest, int nWidth, int
OutTraceP("GDI.BitBlt: PROXED HDC=%x nXDest=%d nYDest=%d nWidth=%d nHeight=%d hdcSrc=%x nXSrc=%d nYSrc=%d dwRop=%x(%s)\n",
hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop, ExplainROP(dwRop));
res=(*pBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
res=(*pGDIBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
if(!res) OutTraceP("GDI.BitBlt: ERROR err=%d\n", GetLastError());
return res;
}
@ -1946,7 +1946,7 @@ BOOL WINAPI extPatBltProxy(HDC hdcDest, int nXDest, int nYDest, int nWidth, int
OutTraceP("GDI.PatBlt: PROXED HDC=%x nXDest=%d nYDest=%d nWidth=%d nHeight=%d dwRop=%x(%s)\n",
hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop, ExplainROP(dwRop));
res=(*pPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop);
res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop);
if(!res) OutTraceP("GDI.PatBlt: ERROR err=%d\n", GetLastError());
return res;
}
@ -1959,7 +1959,7 @@ BOOL WINAPI extStretchBltProxy(HDC hdcDest, int nXDest, int nYDest, int nWidth,
OutTraceP("GDI.StretchBlt: PROXED HDC=%x nXDest=%d nYDest=%d nWidth=%d nHeight=%d hdcSrc=%x nXSrc=%d nYSrc=%d nWSrc=%d nHSrc=%d dwRop=%x(%s)\n",
hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, nWSrc, nHSrc, dwRop, ExplainROP(dwRop));
res=(*pStretchBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, nWSrc, nHSrc, dwRop);
res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, nWSrc, nHSrc, dwRop);
if(!res) OutTraceP("GDI.StretchBlt: ERROR err=%d\n", GetLastError());
return res;
}
@ -1969,7 +1969,7 @@ BOOL WINAPI extDeleteDCProxy(HDC hdc)
BOOL res;
OutTraceP("GDI.DeleteDC: PROXED hdc=%x\n", hdc);
res=(*pDeleteDC)(hdc);
res=(*pGDIDeleteDC)(hdc);
if(!res) OutTraceP("GDI.DeleteDC: ERROR err=%d\n", GetLastError());
return res;
}
@ -1996,7 +1996,7 @@ HPALETTE WINAPI extSelectPaletteProxy(HDC hdc, HPALETTE hpal, BOOL bForceBackgro
{
HPALETTE ret;
ret=(*pSelectPalette)(hdc, hpal, bForceBackground);
ret=(*pGDISelectPalette)(hdc, hpal, bForceBackground);
OutTraceP("GDI.SelectPalette: PROXED hdc=%x hpal=%x ForceBackground=%x ret=%x\n", hdc, hpal, bForceBackground, ret);
return ret;
}
@ -2005,7 +2005,7 @@ UINT WINAPI extRealizePaletteProxy(HDC hdc)
{
UINT ret;
ret=(*pRealizePalette)(hdc);
ret=(*pGDIRealizePalette)(hdc);
OutTraceP("GDI.RealizePalette: PROXED hdc=%x ret=%x\n", hdc, ret);
return ret;
}
@ -2014,7 +2014,7 @@ UINT WINAPI extGetSystemPaletteEntriesProxy(HDC hdc, UINT iStartIndex, UINT nEnt
{
UINT ret;
ret=(*pGetSystemPaletteEntries)(hdc, iStartIndex, nEntries, lppe);
ret=(*pGDIGetSystemPaletteEntries)(hdc, iStartIndex, nEntries, lppe);
OutTrace("GDI.GetSystemPaletteEntries: PROXED hdc=%x start=%d num=%d ret=%d\n", hdc, iStartIndex, nEntries, ret);
if(!ret) OutTrace("GDI.GetSystemPaletteEntries: ERROR err=%d\n", GetLastError());
return ret;

View File

@ -94,14 +94,6 @@ HDC WINAPI extGDIGetDC(HWND);
HDC WINAPI extGDIGetWindowDC(HWND);
int WINAPI extGDIReleaseDC(HWND, HDC);
extern short iPosX, iPosY, iSizX, iSizY;
/* ------ */
GDIGetDC_Type pGDIGetDC;
GDIGetDC_Type pGDIGetWindowDC;
GDIReleaseDC_Type pGDIReleaseDC;
/* ------ */
/* DirectDraw APIs */
DirectDrawCreate_Type pDirectDrawCreate;
DirectDrawCreateEx_Type pDirectDrawCreateEx;
@ -215,7 +207,6 @@ SetEntries_Type pSetEntries;
#define MAXBACKBUFFERS 4
//LPDIRECTDRAWSURFACE lpDDSHDC=NULL, lpDDSEmu_Prim=NULL, lpDDSEmu_Back=NULL;
LPDIRECTDRAWSURFACE lpDDSEmu_Prim=NULL, lpDDSEmu_Back=NULL;
LPDIRECTDRAWSURFACE lpDDSBack=NULL;
LPDIRECTDRAWCLIPPER lpDDC=NULL;
@ -479,7 +470,7 @@ void FixPixelFormat(int ColorDepth, DDPIXELFORMAT *pf)
// -------------------------------------------------------------------------------------
static void HookDDSession(LPDIRECTDRAW *, int);
CoCreateInstance_Type pCoCreateInstance=NULL;
//CoCreateInstance_Type pCoCreateInstance=NULL;
HRESULT STDAPICALLTYPE extCoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID FAR* ppv)
{
@ -526,18 +517,18 @@ HRESULT STDAPICALLTYPE extCoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter,
return res;
}
int HookOle32(int version)
int HookOle32(char *module, int version)
{
// used by Axis & Allies ....
void *tmp;
//return 0;
OutTraceD("HookOle32 version=%d\n", version); //GHO
tmp = HookAPI("ole32.dll", NULL, "CoCreateInstance", extCoCreateInstance);
tmp = HookAPI(module, "ole32.dll", NULL, "CoCreateInstance", extCoCreateInstance);
if(tmp) pCoCreateInstance = (CoCreateInstance_Type)tmp;
return 0;
}
int HookDirectDraw(int version)
int HookDirectDraw(char *module, int version)
{
HINSTANCE hinst;
void *tmp;
@ -546,13 +537,13 @@ int HookDirectDraw(int version)
OutTraceD("HookDirectDraw version=%d\n", version); //GHO
switch(version){
case 0: // automatic
tmp = HookAPI("ddraw.dll", NULL, "DirectDrawCreate", extDirectDrawCreate);
tmp = HookAPI(module, "ddraw.dll", NULL, "DirectDrawCreate", extDirectDrawCreate);
if(tmp) pDirectDrawCreate = (DirectDrawCreate_Type)tmp;
tmp = HookAPI("ddraw.dll", NULL, "DirectDrawCreateEx", extDirectDrawCreateEx);
tmp = HookAPI(module, "ddraw.dll", NULL, "DirectDrawCreateEx", extDirectDrawCreateEx);
if(tmp) pDirectDrawCreateEx = (DirectDrawCreateEx_Type)tmp;
tmp = HookAPI("ddraw.dll", NULL, "DirectDrawEnumerateA", extDirectDrawEnumerateProxy);
tmp = HookAPI(module, "ddraw.dll", NULL, "DirectDrawEnumerateA", extDirectDrawEnumerateProxy);
if(tmp) pDirectDrawEnumerate = (DirectDrawEnumerate_Type)tmp;
tmp = HookAPI("ddraw.dll", NULL, "DirectDrawEnumerateExA", extDirectDrawEnumerateExProxy);
tmp = HookAPI(module, "ddraw.dll", NULL, "DirectDrawEnumerateExA", extDirectDrawEnumerateExProxy);
if(tmp) pDirectDrawEnumerateEx = (DirectDrawEnumerateEx_Type)tmp;
break;
case 1:
@ -568,8 +559,8 @@ int HookDirectDraw(int version)
if(pDirectDrawCreate){
LPDIRECTDRAW lpdd;
BOOL res;
HookAPI("ddraw.dll", pDirectDrawCreate, "DirectDrawCreate", extDirectDrawCreate);
HookAPI("ddraw.dll", pDirectDrawEnumerate, "DirectDrawEnumerateA", extDirectDrawEnumerateProxy);
HookAPI(module, "ddraw.dll", pDirectDrawCreate, "DirectDrawCreate", extDirectDrawCreate);
HookAPI(module, "ddraw.dll", pDirectDrawEnumerate, "DirectDrawEnumerateA", extDirectDrawEnumerateProxy);
res=extDirectDrawCreate(0, &lpdd, 0);
if (res){
OutTraceE("DirectDrawCreate: ERROR res=%x(%s)\n", res, ExplainDDError(res));
@ -588,9 +579,9 @@ int HookDirectDraw(int version)
if(pDirectDrawCreate){
LPDIRECTDRAW lpdd;
BOOL res;
HookAPI("ddraw.dll", pDirectDrawCreate, "DirectDrawCreate", extDirectDrawCreateProxy);
HookAPI("ddraw.dll", pDirectDrawEnumerate, "DirectDrawEnumerateA", extDirectDrawEnumerateProxy);
HookAPI("ddraw.dll", pDirectDrawEnumerateEx, "DirectDrawEnumerateExA", extDirectDrawEnumerateExProxy);
HookAPI(module, "ddraw.dll", pDirectDrawCreate, "DirectDrawCreate", extDirectDrawCreateProxy);
HookAPI(module, "ddraw.dll", pDirectDrawEnumerate, "DirectDrawEnumerateA", extDirectDrawEnumerateProxy);
HookAPI(module, "ddraw.dll", pDirectDrawEnumerateEx, "DirectDrawEnumerateExA", extDirectDrawEnumerateExProxy);
res=extDirectDrawCreate(0, &lpdd, 0);
if (res) OutTraceE("DirectDrawCreate: ERROR res=%x(%s)\n", res, ExplainDDError(res));
lpdd->Release();
@ -600,7 +591,7 @@ int HookDirectDraw(int version)
if(pDirectDrawCreateEx){
LPDIRECTDRAW lpdd;
BOOL res;
HookAPI("ddraw.dll", pDirectDrawCreateEx, "DirectDrawCreateEx", extDirectDrawCreateEx);
HookAPI(module, "ddraw.dll", pDirectDrawCreateEx, "DirectDrawCreateEx", extDirectDrawCreateEx);
res=extDirectDrawCreateEx(0, &lpdd, dd7, 0);
if (res) OutTraceE("DirectDrawCreateEx: ERROR res=%x(%s)\n", res, ExplainDDError(res));
lpdd->Release();
@ -612,70 +603,6 @@ int HookDirectDraw(int version)
return 0;
}
/* ------------------------------------------------------------------ */
// Primary surfaces auxiliary functions
/* ------------------------------------------------------------------ */
#define DDSQLEN 0x10
static DWORD PrimSurfaces[DDSQLEN+1] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
void MarkPrimarySurface(LPDIRECTDRAWSURFACE ps)
{
int i;
// OutTraceD("PRIMARYSURFACE add %x\n",ps);
for (i=0;i<DDSQLEN;i++) {
if (PrimSurfaces[i]==(DWORD)ps) return; // if already there ....
if (PrimSurfaces[i]==(DWORD)0) break; // got end of list
}
PrimSurfaces[i]=(DWORD)ps;
}
// Note: since MS itself declares that the object refcount is not reliable and should
// be used for debugging only, it's not safe to rely on refcount==0 when releasing a
// surface to terminate its classification as primary. As an alternate and more reliable
// way, we use UnmarkPrimarySurface each time you create a new not primary surface,
// eliminating the risk that a surface previously classified as primary and then closed
// had the same surface handle than this new one that is not primary at all.
static void UnmarkPrimarySurface(LPDIRECTDRAWSURFACE ps)
{
int i;
// OutTraceD("PRIMARYSURFACE del %x\n",ps);
for (i=0;i<DDSQLEN;i++) {
if (PrimSurfaces[i]==(DWORD)ps) break;
if (PrimSurfaces[i]==0) break;
}
if (PrimSurfaces[i]==(DWORD)ps){
for (; i<DDSQLEN; i++){
PrimSurfaces[i]=PrimSurfaces[i+1];
if (PrimSurfaces[i]==0) break;
}
PrimSurfaces[DDSQLEN]=0;
}
}
BOOL IsAPrimarySurface(LPDIRECTDRAWSURFACE ps)
{
int i;
// treat NULL surface ptr as a non primary
if(!ps) return FALSE;
for (i=0;i<DDSQLEN;i++) {
if (PrimSurfaces[i]==(DWORD)ps) return TRUE;
if (PrimSurfaces[i]==0) return FALSE;
}
return FALSE;
}
LPDIRECTDRAWSURFACE GetPrimarySurface()
{
// return last opened one....
int i;
for (i=0;i<DDSQLEN;i++) {
if (PrimSurfaces[i]==0) break;
}
if (i) return((LPDIRECTDRAWSURFACE)PrimSurfaces[i-1]);
return NULL;
}
Unlock4_Type pUnlockMethod(LPDIRECTDRAWSURFACE lpdds)
{
char sMsg[81];
@ -1291,7 +1218,7 @@ HRESULT WINAPI extDirectDrawCreate(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplpdd, I
pDirectDrawCreate =
(DirectDrawCreate_Type)GetProcAddress(hinst, "DirectDrawCreate");
if(pDirectDrawCreate)
HookAPI("ddraw.dll", pDirectDrawCreate, "DirectDrawCreate", extDirectDrawCreate);
HookAPI(NULL, "ddraw.dll", pDirectDrawCreate, "DirectDrawCreate", extDirectDrawCreate);
else{
char sMsg[81];
sprintf_s(sMsg, 80, "DirectDrawCreate hook failed: error=%d\n", GetLastError());
@ -1374,7 +1301,7 @@ HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *lpguid,
pDirectDrawCreateEx =
(DirectDrawCreateEx_Type)GetProcAddress(hinst, "DirectDrawCreateEx");
if(pDirectDrawCreateEx)
HookAPI("ddraw.dll", pDirectDrawCreateEx, "DirectDrawCreateEx", extDirectDrawCreateEx);
HookAPI(NULL, "ddraw.dll", pDirectDrawCreateEx, "DirectDrawCreateEx", extDirectDrawCreateEx);
else{
char sMsg[81];
sprintf_s(sMsg, 80, "DirectDrawCreateEx hook failed: error=%d\n", GetLastError());
@ -1478,7 +1405,7 @@ HRESULT WINAPI extQueryInterfaceS(void *lpdds, REFIID riid, LPVOID *obp)
BOOL IsPrim;
unsigned int dwLocalDDVersion;
IsPrim=IsAPrimarySurface((LPDIRECTDRAWSURFACE)lpdds);
IsPrim=dxw.IsAPrimarySurface((LPDIRECTDRAWSURFACE)lpdds);
dwLocalDDVersion=0;
switch(riid.Data1){
@ -1535,11 +1462,11 @@ HRESULT WINAPI extQueryInterfaceS(void *lpdds, REFIID riid, LPVOID *obp)
if(IsPrim){
OutTraceD("QueryInterface(S): primary=%x new=%x\n", lpdds, *obp);
MarkPrimarySurface((LPDIRECTDRAWSURFACE)*obp);
dxw.MarkPrimarySurface((LPDIRECTDRAWSURFACE)*obp);
HookDDSurfacePrim((LPDIRECTDRAWSURFACE *)obp, dxw.dwDDVersion);
}
else{
UnmarkPrimarySurface((LPDIRECTDRAWSURFACE)*obp);
dxw.UnmarkPrimarySurface((LPDIRECTDRAWSURFACE)*obp);
HookDDSurfaceGeneric((LPDIRECTDRAWSURFACE *)obp, dxw.dwDDVersion);
}
@ -1809,7 +1736,7 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf
}
lpDDSPrim = *lplpdds;
OutTraceD("CreateSurface: created PRIMARY DDSPrim=%x\n", lpDDSPrim);
MarkPrimarySurface(*lplpdds);
dxw.MarkPrimarySurface(*lplpdds);
HookDDSurfacePrim(lplpdds, dxversion);
if (BBCount){
@ -1831,7 +1758,7 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf
}
//ddsd.ddsCaps.dwCaps &= ~DDSCAPS_BACKBUFFER;
OutTraceD("CreateSurface: created BACK DDSBack=%x\n", lpDDSBack);
UnmarkPrimarySurface(lpDDSBack);
dxw.UnmarkPrimarySurface(lpDDSBack);
HookDDSurfaceGeneric(&lpDDSBack, dxversion); // added !!!
}
FlipChainLength=BBCount;
@ -1867,7 +1794,7 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf
if (lpDDC==NULL) RenewClipper(lpdd, lpDDSEmu_Prim);
UnmarkPrimarySurface(lpDDSEmu_Prim);
dxw.UnmarkPrimarySurface(lpDDSEmu_Prim);
// can't hook lpDDSEmu_Prim as generic, since the Flip method is unimplemented for a PRIMARY surface!
// better avoid it or hook just useful methods.
//if (dxw.dwFlags1 & OUTPROXYTRACE) HookDDSurfaceGeneric(&lpDDSEmu_Prim, dxw.dwDDVersion);
@ -1893,7 +1820,7 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf
OutTraceD("CreateSurface: created new DDSEmu_Back=%x\n", lpDDSEmu_Back);
}
UnmarkPrimarySurface(lpDDSEmu_Back);
dxw.UnmarkPrimarySurface(lpDDSEmu_Back);
if (dxw.dwFlags1 & OUTPROXYTRACE) HookDDSurfaceGeneric(&lpDDSEmu_Back, dxversion);
OutTraceD("CreateSurface: created DDSEmu_Prim=%x DDSEmu_Back=%x DDSPrim=%x DDSBack=%x\n",
@ -1918,9 +1845,9 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf
else {
// adjust pixel format
pfmt="(none)";
ddsd.dwFlags |= DDSD_CAPS | DDSD_PIXELFORMAT; // DDSD_CAPS was needed?
ddsd.dwFlags |= DDSD_CAPS | DDSD_PIXELFORMAT;
ddsd.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY;
ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN;
ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN;
pfmt=SetPixFmt(&ddsd);
}
@ -1934,8 +1861,8 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf
OutTraceD("CreateSurface: CreateSurface ERROR err=%x(%s) at %d, retry in SYSTEMMEMORY\n",
res, ExplainDDError(res), __LINE__);
ddsd.dwFlags |= DDSD_CAPS;
ddsd.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY; // try ...
ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; // try ...
ddsd.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY;
ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Emu Generic2]" , __LINE__);
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, 0);
}
@ -1949,7 +1876,7 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf
// diagnostic hooks ....
HookDDSurfaceGeneric(lplpdds, dxversion);
// unmark this as possible primary
UnmarkPrimarySurface(*lplpdds);
dxw.UnmarkPrimarySurface(*lplpdds);
OutTraceD("CreateSurface: created EMU_GENERIC dds=%x type=%s\n", *lplpdds, pfmt);
return 0;
@ -2034,7 +1961,7 @@ HRESULT WINAPI extCreateSurfaceDir(int dxversion, CreateSurface_Type pCreateSurf
if(dxw.dwFlags1 & EMULATEBUFFER){
lpDDSEmu_Prim = lpDDSPrim;
UnmarkPrimarySurface(lpDDSEmu_Prim);
dxw.UnmarkPrimarySurface(lpDDSEmu_Prim);
OutTraceD("CreateSurface: created PRIMARY DDSPrim=%x flags=%x(%s) caps=%x(%s)\n",
lpDDSPrim, ddsd.dwFlags, ExplainFlags(ddsd.dwFlags), ddsd.ddsCaps.dwCaps, ExplainDDSCaps(ddsd.ddsCaps.dwCaps));
RenewClipper(lpdd, lpDDSEmu_Prim);
@ -2053,13 +1980,13 @@ HRESULT WINAPI extCreateSurfaceDir(int dxversion, CreateSurface_Type pCreateSurf
}
*lplpdds = lpDDSPrim;
MarkPrimarySurface(lpDDSPrim);
dxw.MarkPrimarySurface(lpDDSPrim);
OutTraceD("CreateSurface: created FIX DDSPrim=%x flags=%x(%s) caps=%x(%s)\n",
*lplpdds, ddsd.dwFlags, ExplainFlags(ddsd.dwFlags), ddsd.ddsCaps.dwCaps, ExplainDDSCaps(ddsd.ddsCaps.dwCaps));
}
else{
*lplpdds = lpDDSPrim;
MarkPrimarySurface(lpDDSPrim);
dxw.MarkPrimarySurface(lpDDSPrim);
OutTraceD("CreateSurface: created PRIMARY DDSPrim=%x flags=%x(%s) caps=%x(%s)\n",
*lplpdds, ddsd.dwFlags, ExplainFlags(ddsd.dwFlags), ddsd.ddsCaps.dwCaps, ExplainDDSCaps(ddsd.ddsCaps.dwCaps));
RenewClipper(lpdd, lpDDSPrim);
@ -2146,7 +2073,7 @@ HRESULT WINAPI extCreateSurfaceDir(int dxversion, CreateSurface_Type pCreateSurf
// hooks ....
HookDDSurfaceGeneric(lplpdds, dxversion);
UnmarkPrimarySurface(*lplpdds);
dxw.UnmarkPrimarySurface(*lplpdds);
OutTraceD("CreateSurface: created lpdds=%x type=GENUINE Return=%x\n", *lplpdds, res);
return res;
@ -2215,7 +2142,7 @@ HRESULT WINAPI extGetAttachedSurface(int dxversion, GetAttachedSurface_Type pGet
HRESULT res;
BOOL IsPrim;
IsPrim=IsAPrimarySurface(lpdds);
IsPrim=dxw.IsAPrimarySurface(lpdds);
OutTraceD("GetAttachedSurface(%d): lpdds=%x%s caps=%x(%s)\n",
dxversion, lpdds, (IsPrim?"(PRIM)":""), lpddsc->dwCaps, ExplainDDSCaps(lpddsc->dwCaps));
@ -2314,8 +2241,8 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect,
BOOL ToPrim, FromPrim, ToScreen, FromScreen;
//CkArg arg;
ToPrim=IsAPrimarySurface(lpdds);
FromPrim=IsAPrimarySurface(lpddssrc);
ToPrim=dxw.IsAPrimarySurface(lpdds);
FromPrim=dxw.IsAPrimarySurface(lpddssrc);
ToScreen=ToPrim && !(dxw.dwFlags1 & EMULATESURFACE);
FromScreen=FromPrim && !(dxw.dwFlags1 & EMULATESURFACE);
@ -2551,7 +2478,7 @@ HRESULT WINAPI extFlip(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURFACE lpddssrc,
BOOL IsPrim;
HRESULT res;
IsPrim=IsAPrimarySurface(lpdds);
IsPrim=dxw.IsAPrimarySurface(lpdds);
OutTraceD("Flip: lpdds=%x%s, src=%x, flags=%x(%s)\n",
lpdds, IsPrim?"(PRIM)":"", lpddssrc, dwflags, ExplainFlipFlags(dwflags));
@ -2635,8 +2562,8 @@ HRESULT WINAPI extBltFast(LPDIRECTDRAWSURFACE lpdds, DWORD dwx, DWORD dwy,
HRESULT ret;
BOOL ToPrim, FromPrim;
ToPrim=IsAPrimarySurface(lpdds);
FromPrim=IsAPrimarySurface(lpddssrc);
ToPrim=dxw.IsAPrimarySurface(lpdds);
FromPrim=dxw.IsAPrimarySurface(lpddssrc);
CleanRect(&lpsrcrect,__LINE__);
@ -2770,8 +2697,9 @@ HRESULT WINAPI extSetPalette(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWPALETTE lpdd
PALETTEENTRY *lpentries;
BOOL isPrim;
HRESULT res;
isPrim=IsAPrimarySurface(lpdds);
dxw.IsGDIPalette=FALSE;
isPrim=dxw.IsAPrimarySurface(lpdds);
OutTraceD("SetPalette: lpdds=%x%s lpddp=%x\n", lpdds, isPrim?"(PRIM)":"", lpddp);
if(!(dxw.dwFlags1 & EMULATESURFACE) || !isPrim) {
@ -2782,11 +2710,11 @@ HRESULT WINAPI extSetPalette(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWPALETTE lpdd
OutTraceD("SetPalette: DEBUG emulating palette\n");
lpDDP = lpddp;
if (lpDDSBack) {
res=(*pSetPalette)(lpDDSBack, lpddp);
if(res) OutTraceE("SetPalette: ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
}
// add a reference to simulate whot would happen in reality....
//if (lpDDSBack) { GHOGHO
// res=(*pSetPalette)(lpDDSBack, lpddp);
// if(res) OutTraceE("SetPalette: ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
//}
// add a reference to simulate what would happen in reality....
lpdds->AddRef();
if(lpddp){
@ -2803,14 +2731,16 @@ HRESULT WINAPI extSetEntries(LPDIRECTDRAWPALETTE lpddp, DWORD dwflags, DWORD dws
{
HRESULT res;
dxw.IsGDIPalette=FALSE;
OutTraceD("SetEntries: dwFlags=%x, start=%d, count=%d\n", //GHO: added trace infos
dwflags, dwstart, dwcount);
res = (*pSetEntries)(lpddp, dwflags, dwstart, dwcount, lpentries);
if(res) OutTraceE("SetEntries: ERROR res=%x(%s)\n", res, ExplainDDError(res));
if(!(dxw.dwFlags1 & EMULATESURFACE) || lpDDP != lpddp)
if(!(dxw.dwFlags1 & EMULATESURFACE) || lpDDP != lpddp){
return res;
}
if ((dwstart + dwcount > 256) || (dwstart<0)){
dwcount=256;
@ -2831,7 +2761,7 @@ HRESULT WINAPI extSetClipper(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWCLIPPER lpdd
{
HRESULT res;
BOOL isPrim;
isPrim=IsAPrimarySurface(lpdds);
isPrim=dxw.IsAPrimarySurface(lpdds);
OutTraceD("SetClipper: lpdds=%x%s lpddc=%x\n", lpdds, isPrim?"(PRIM)":"", lpddc);
// v2.1.84: SUPPRESSCLIPPING flag - improves "Monopoly Edition 3D" where continuous
@ -2861,7 +2791,7 @@ HRESULT WINAPI extLock(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDIRECTDRAWSUR
HRESULT res;
BOOL IsPrim;
IsPrim=IsAPrimarySurface(lpdds);
IsPrim=dxw.IsAPrimarySurface(lpdds);
if(IsTraceD){
OutTrace("Lock: lpdds=%x%s flags=%x(%s) lpdds2=%x",
@ -2893,7 +2823,7 @@ HRESULT WINAPI extUnlock(int dxversion, Unlock4_Type pUnlock, LPDIRECTDRAWSURFAC
RECT screen, rect;
BOOL IsPrim;
IsPrim=IsAPrimarySurface(lpdds);
IsPrim=dxw.IsAPrimarySurface(lpdds);
if ((dxversion == 4) && lprect) CleanRect(&lprect,__LINE__);
@ -2976,16 +2906,13 @@ ReleaseDC with Unlock, returning the surface memory ptr (???) as HDC
and avoiding the consistency check performed by surface::GetDC (why
should it bother if the screen is 32BPP and the surface is not??? */
HDC PrimSurfaceHDC = 0;
LPDIRECTDRAWSURFACE lpDDSPrimHDC=NULL;
HRESULT WINAPI extGetDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR *pHDC)
{
HRESULT res;
BOOL IsPrim;
RECT client;
IsPrim=IsAPrimarySurface(lpdds);
IsPrim=dxw.IsAPrimarySurface(lpdds);
OutTraceD("GetDC: lpdss=%x%s\n",lpdds, IsPrim?"(PRIM)":"");
res=(*pGetDC)(lpdds,pHDC);
if(res){
@ -3006,8 +2933,7 @@ HRESULT WINAPI extGetDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR *pHDC)
// when getting DC from primary surface, save hdc and lpdds
// for later possible use in GDI BitBlt wrapper function
if (IsPrim){
if (*pHDC) PrimSurfaceHDC=*pHDC;
lpDDSPrimHDC=lpdds;
dxw.lpDDSPrimHDC=lpdds;
}
// tricky part to allog GDI to operate on top of a directdraw surface's HDI.
@ -3126,7 +3052,7 @@ HRESULT WINAPI extReleaseDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR hdc)
OutTraceE("ReleaseDC: RevBlt ERROR res=%x(%s) at %d\n",res, ExplainDDError(res), __LINE__);
break;
}
if(IsAPrimarySurface(lpdds)){
if(dxw.IsAPrimarySurface(lpdds)){
res=sBlt("ReleaseDC", lpdds, NULL, lpdds, NULL, 0, NULL, FALSE);
if (res) OutTraceE("ReleaseDC: Blt ERROR res=%x(%s) at %d\n",res, ExplainDDError(res), __LINE__);
}
@ -3341,7 +3267,7 @@ HRESULT WINAPI extGetPixelFormat(LPDIRECTDRAWSURFACE lpdds, LPDDPIXELFORMAT p)
DWORD res;
BOOL IsPrim;
IsPrim=IsAPrimarySurface(lpdds);
IsPrim=dxw.IsAPrimarySurface(lpdds);
OutTraceD("GetPixelFormat: lpdds=%x%s\n", lpdds, IsPrim?"(PRIM)":"");
res=(*pGetPixelFormat)(lpdds, p);
if(res){
@ -3383,7 +3309,7 @@ HRESULT WINAPI extReleaseS(LPDIRECTDRAWSURFACE lpdds)
BOOL IsClosed;
OutTraceD("Release(S): DEBUG - lpdds=%x\n", lpdds);
IsPrim=IsAPrimarySurface(lpdds);
IsPrim=dxw.IsAPrimarySurface(lpdds);
// handling of service closed surfaces
IsClosed=0;
@ -3401,7 +3327,7 @@ HRESULT WINAPI extReleaseS(LPDIRECTDRAWSURFACE lpdds)
// when releasing primary surface, erase clipping region
if(IsPrim && (dxw.dwFlags1 & CLIPCURSOR)) dxw.EraseClipCursor();
// if primary, clean primay surface list
if(IsPrim) UnmarkPrimarySurface(lpdds);
if(IsPrim) dxw.UnmarkPrimarySurface(lpdds);
// service surfaces cleanup
if(lpdds==lpDDSBack) {
OutTraceD("Release(S): Clearing lpDDSBack pointer\n");
@ -3416,14 +3342,9 @@ HRESULT WINAPI extReleaseS(LPDIRECTDRAWSURFACE lpdds)
OutTraceD("Release(S): Clearing lpDDSEmu_Back pointer\n");
lpDDSEmu_Back=NULL;
}
//if(lpdds==lpDDSHDC) {
// OutTraceD("Release(S): Clearing lpDDSHDC pointer\n");
// lpDDSHDC=NULL;
//}
if(lpdds==lpDDSPrimHDC) {
if(lpdds==dxw.lpDDSPrimHDC) {
OutTraceD("Release(S): Clearing lpDDSPrimHDC pointer\n");
lpDDSPrimHDC=NULL;
PrimSurfaceHDC=0;
dxw.ResetPrimarySurface();
}
}
}
@ -3434,7 +3355,7 @@ HRESULT WINAPI extSetColorKey(LPDIRECTDRAWSURFACE lpdds, DWORD flags, LPDDCOLORK
{
HRESULT res;
BOOL IsPrim;
IsPrim=IsAPrimarySurface(lpdds);
IsPrim=dxw.IsAPrimarySurface(lpdds);
if(IsTraceD){
OutTrace("SetColorKey: lpdds=%x%s flags=%x(%s) ",
lpdds, (IsPrim ? "(PRIM)" : ""), flags, ExplainColorKeyFlag(flags));
@ -3454,7 +3375,7 @@ HRESULT WINAPI extGetColorKey(LPDIRECTDRAWSURFACE lpdds, DWORD flags, LPDDCOLORK
{
HRESULT res;
BOOL IsPrim;
IsPrim=IsAPrimarySurface(lpdds);
IsPrim=dxw.IsAPrimarySurface(lpdds);
OutTraceD("GetColorKey(S): lpdds=%x%s flags=%x(%s)\n",
lpdds, (IsPrim ? "(PRIM)" : ""), flags, ExplainColorKeyFlag(flags));
res=(*pGetColorKey)(lpdds, flags, lpDDColorKey);
@ -3471,7 +3392,7 @@ HRESULT WINAPI extEnumAttachedSurfaces(LPDIRECTDRAWSURFACE lpdds, LPVOID lpConte
HRESULT res;
BOOL IsPrim;
IsPrim=IsAPrimarySurface(lpdds);
IsPrim=dxw.IsAPrimarySurface(lpdds);
OutTraceD("EnumAttachedSurfaces: lpdds=%x%s Context=%x Callback=%x\n",
lpdds, (IsPrim ? "(PRIM)":""), lpContext, lpEnumSurfacesCallback);
@ -3517,7 +3438,7 @@ HRESULT WINAPI extAddAttachedSurface(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURF
// just remember this for further handling in the Flip operation.
// But beware: this holds to BACKBUFFER surfaces only, and NOT for attached ZBUFFERS or similar!
IsPrim=IsAPrimarySurface(lpdds);
IsPrim=dxw.IsAPrimarySurface(lpdds);
OutTraceD("AddAttachedSurface: lpdds=%x%s lpddsadd=%x\n", lpdds, IsPrim?"(PRIM)":"", lpddsadd);
res=(*pAddAttachedSurface)(lpdds, lpddsadd);
if (res) {
@ -3575,7 +3496,7 @@ HRESULT WINAPI extGetCapsS(int dxInterface, GetCapsS_Type pGetCapsS, LPDIRECTDRA
{
HRESULT res;
BOOL IsPrim;
IsPrim=IsAPrimarySurface(lpdds);
IsPrim=dxw.IsAPrimarySurface(lpdds);
OutTraceD("GetCaps(S%d): lpdds=%x%s, lpcaps=%x\n", dxInterface, lpdds, IsPrim?"(PRIM)":"", caps);
res=(*pGetCapsS)(lpdds, caps);
if(res)
@ -3734,7 +3655,7 @@ HRESULT WINAPI extGetSurfaceDesc(GetSurfaceDesc_Type pGetSurfaceDesc, LPDIRECTDR
{
HRESULT res;
BOOL IsPrim;
IsPrim=IsAPrimarySurface(lpdds);
IsPrim=dxw.IsAPrimarySurface(lpdds);
if (!pGetSurfaceDesc) {
OutTraceE("GetSurfaceDesc: ERROR no hooked function\n");

View File

@ -46,7 +46,7 @@ int iCurMinY;
int iCurMaxX;
int iCurMaxY;
int HookDirectInput(int version)
int HookDirectInput(char *module, int version)
{
HINSTANCE hinst;
void *tmp;
@ -54,13 +54,13 @@ int HookDirectInput(int version)
const GUID di7 = {0x9A4CB684,0x236D,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE};
const GUID di8 = {0xBF798030,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00};
tmp = HookAPI("dinput.dll", NULL, "DirectInputCreateA", extDirectInputCreate);
tmp = HookAPI(module, "dinput.dll", NULL, "DirectInputCreateA", extDirectInputCreate);
if(tmp) pDirectInputCreate = (DirectInputCreate_Type)tmp;
tmp = HookAPI("dinput.dll", NULL, "DirectInputCreateW", extDirectInputCreate);
tmp = HookAPI(module, "dinput.dll", NULL, "DirectInputCreateW", extDirectInputCreate);
if(tmp) pDirectInputCreate = (DirectInputCreate_Type)tmp;
tmp = HookAPI("dinput.dll", NULL, "DirectInputCreateEx", extDirectInputCreateEx);
tmp = HookAPI(module, "dinput.dll", NULL, "DirectInputCreateEx", extDirectInputCreateEx);
if(tmp) pDirectInputCreateEx = (DirectInputCreateEx_Type)tmp;
tmp = HookAPI("dinput8.dll", NULL, "DirectInput8Create", extDirectInput8Create);
tmp = HookAPI(module, "dinput8.dll", NULL, "DirectInput8Create", extDirectInput8Create);
if(tmp) pDirectInputCreateEx = (DirectInputCreateEx_Type)tmp;
if(!pDirectInputCreate && !pDirectInputCreateEx){
if(version < 8){

View File

@ -15,64 +15,27 @@
#define WINDOWDC 0xFFFFFFFF
extern GDIGetDC_Type pGDIGetDC;
extern GDIGetDC_Type pGDIGetWindowDC;
extern GDIReleaseDC_Type pGDIReleaseDC;
extern DWORD PaletteEntries[256];
extern HDC PrimSurfaceHDC;
extern LPDIRECTDRAWSURFACE lpDDSPrimHDC;
extern LPDIRECTDRAW lpDD;
extern Unlock4_Type pUnlockMethod(LPDIRECTDRAWSURFACE);
extern GetDC_Type pGetDC;
extern ReleaseDC_Type pReleaseDC;
extern SetCursor_Type pSetCursor;
DEVMODE SetDevMode;
DEVMODE *pSetDevMode=NULL;
extern short iPosX, iPosY, iSizX, iSizY;
extern void do_slow(int);
extern LPDIRECTDRAWSURFACE GetPrimarySurface(void);
//extern LPDIRECTDRAWSURFACE GetPrimarySurface(void);
extern HRESULT WINAPI extBlt(LPDIRECTDRAWSURFACE, LPRECT, LPDIRECTDRAWSURFACE, LPRECT, DWORD, LPDDBLTFX);
extern HRESULT WINAPI sBlt(char *, LPDIRECTDRAWSURFACE, LPRECT, LPDIRECTDRAWSURFACE, LPRECT, DWORD, LPDDBLTFX, BOOL);
static SetLayeredWindowAttributes_Type pSetLayeredWindowAttributes = NULL;
#ifndef WS_EX_LAYERED
#define WS_EX_LAYERED 0x00080000
#define LWA_COLORKEY 0x00000001
#define LWA_ALPHA 0x00000002
#endif
// Diablo: end
//extern char *ExplainShowCmd(int);
extern DirectDrawEnumerate_Type pDirectDrawEnumerate;
extern DirectDrawEnumerateEx_Type pDirectDrawEnumerateEx;
extern LRESULT CALLBACK extChildWindowProc(HWND, UINT, WPARAM, LPARAM);
extern INT_PTR CALLBACK extDialogWindowProc(HWND, UINT, WPARAM, LPARAM);
GDIChoosePixelFormat_Type pGDIChoosePixelFormat;
GDIGetPixelFormat_Type pGDIGetPixelFormat;
GDISetPixelFormat_Type pGDISetPixelFormat;
CreateDC_Type pCreateDC;
StretchBlt_Type pStretchBlt;
SaveDC_Type pGDISaveDC;
RestoreDC_Type pGDIRestoreDC;
CreateDialogParam_Type pCreateDialogParam;
CreateDialogIndirectParam_Type pCreateDialogIndirectParam;
BeginPaint_Type pBeginPaint;
EndPaint_Type pEndPaint;
InvalidateRect_Type pInvalidateRect;
InvalidateRgn_Type pInvalidateRgn;
GDICreatePalette_Type pGDICreatePalette;
SelectPalette_Type pSelectPalette;
RealizePalette_Type pRealizePalette;
GetSystemPaletteEntries_Type pGetSystemPaletteEntries;
MoveWindow_Type pMoveWindow;
SetUnhandledExceptionFilter_Type pSetUnhandledExceptionFilter;
GetDiskFreeSpaceA_Type pGetDiskFreeSpaceA;
/* ------------------------------------------------------------------ */
static POINT FixMessagePt(HWND hwnd, POINT point)
@ -254,10 +217,10 @@ HWND WINAPI extCreateWindowExA(
else {
// invalid parent coordinates: use initial placement, but leave the size.
// should also fix the window style and compensate for borders here?
x=iPosX;
y=iPosY;
nWidth=iSizX;
nHeight=iSizY;
x=dxw.iPosX;
y=dxw.iPosY;
nWidth=dxw.iSizX;
nHeight=dxw.iSizY;
OutTraceD("CreateWindowEx: renewed BIG win pos=(%d,%d) size=(%d,%d)\n", x, y, nWidth, nHeight);
}
dxw.SetFullScreen(TRUE);
@ -344,7 +307,7 @@ COLORREF WINAPI extSetTextColor(HDC hdc, COLORREF crColor)
if ((dxw.dwFlags1 & EMULATESURFACE) && (dxw.dwFlags1 & HANDLEDC) && (dxw.VirtualPixelFormat.dwRGBBitCount==8))
crColor=GetMatchingColor(crColor);
res=(*pSetTextColor)(hdc, crColor);
res=(*pGDISetTextColor)(hdc, crColor);
OutTraceD("SetTextColor: color=%x res=%x%s\n", crColor, res, (res==CLR_INVALID)?"(CLR_INVALID)":"");
return res;
}
@ -356,7 +319,7 @@ COLORREF WINAPI extSetBkColor(HDC hdc, COLORREF crColor)
if ((dxw.dwFlags1 & EMULATESURFACE) && (dxw.dwFlags1 & HANDLEDC) && (dxw.VirtualPixelFormat.dwRGBBitCount==8))
crColor=GetMatchingColor(crColor);
res=(*pSetBkColor)(hdc, crColor);
res=(*pGDISetBkColor)(hdc, crColor);
OutTraceD("SetBkColor: color=%x res=%x%s\n", crColor, res, (res==CLR_INVALID)?"(CLR_INVALID)":"");
return res;
}
@ -602,7 +565,7 @@ BOOL WINAPI extTextOutA(HDC hdc, int nXStart, int nYStart, LPCTSTR lpString, int
nXStart=anchor.x;
nYStart=anchor.y;
}
return (*pTextOutA)(hdc, nXStart, nYStart, lpString, cchString);
return (*pGDITextOutA)(hdc, nXStart, nYStart, lpString, cchString);
}
BOOL WINAPI extRectangle(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect)
@ -621,7 +584,7 @@ BOOL WINAPI extRectangle(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, i
nRightRect=anchor.x;
nBottomRect=anchor.y;
}
return (*pRectangle)(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect);
return (*pGDIRectangle)(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect);
}
int WINAPI extFillRect(HDC hdc, const RECT *lprc, HBRUSH hbr)
@ -645,34 +608,13 @@ int WINAPI extFillRect(HDC hdc, const RECT *lprc, HBRUSH hbr)
return (*pFillRect)(hdc, &rc, hbr);
}
int WINAPI extDrawFocusRect(HDC hdc, const RECT *lprc)
{
RECT rc;
OutTraceD("DrawFocusRect: hdc=%x xy=(%d,%d)-(%d,%d)\n", hdc, lprc->left, lprc->top, lprc->right, lprc->bottom);
memcpy(&rc, lprc, sizeof(rc));
if (dxw.dwFlags1 & FIXTEXTOUT) {
POINT anchor;
anchor.x=rc.left;
anchor.y=rc.top;
(*pClientToScreen)(dxw.GethWnd(), &anchor);
rc.left=anchor.x;
rc.top=anchor.y;
anchor.x=rc.right;
anchor.y=rc.bottom;
(*pClientToScreen)(dxw.GethWnd(), &anchor);
rc.right=anchor.x;
rc.bottom=anchor.y;
}
return (*pDrawFocusRect)(hdc, &rc);
}
HFONT WINAPI extCreateFont(int nHeight, int nWidth, int nEscapement, int nOrientation, int fnWeight,
DWORD fdwItalic, DWORD fdwUnderline, DWORD fdwStrikeOut, DWORD fdwCharSet,
DWORD fdwOutputPrecision, DWORD fdwClipPrecision, DWORD fdwQuality,
DWORD fdwPitchAndFamily, LPCTSTR lpszFace)
{
OutTraceD("CreateFont: h=%d w=%d face=\"%s\"\n", nHeight, nWidth, lpszFace);
return (*pCreateFont)(nHeight, nWidth, nEscapement, nOrientation, fnWeight,
return (*pGDICreateFont)(nHeight, nWidth, nEscapement, nOrientation, fnWeight,
fdwItalic, fdwUnderline, fdwStrikeOut, fdwCharSet,
fdwOutputPrecision, fdwClipPrecision, NONANTIALIASED_QUALITY,
fdwPitchAndFamily, lpszFace);
@ -687,7 +629,7 @@ HFONT WINAPI extCreateFontIndirect(const LOGFONT* lplf)
OutTraceD("CreateFontIndirect: h=%d w=%d face=\"%s\"\n", lplf->lfHeight, lplf->lfWidth, lplf->lfFaceName);
memcpy((char *)&lf, (char *)lplf, sizeof(LOGFONT));
lf.lfQuality=NONANTIALIASED_QUALITY;
retHFont=((*pCreateFontIndirect)(&lf));
retHFont=((*pGDICreateFontIndirect)(&lf));
if(retHFont)
OutTraceD("CreateFontIndirect: hfont=%x\n", retHFont);
else
@ -812,8 +754,8 @@ BOOL WINAPI extSetWindowPos(HWND hwnd, HWND hWndInsertAfter, int X, int Y, int c
if (dxw.dwFlags1 & PREVENTMAXIMIZE){
int UpdFlag =0;
int MaxX, MaxY;
MaxX = iSizX;
MaxY = iSizY;
MaxX = dxw.iSizX;
MaxY = dxw.iSizY;
if (!MaxX) MaxX = dxw.GetScreenWidth();
if (!MaxY) MaxY = dxw.GetScreenHeight();
if(cx>MaxX) { cx=MaxX; UpdFlag=1; }
@ -847,7 +789,7 @@ HDWP WINAPI extDeferWindowPos(HDWP hWinPosInfo, HWND hwnd, HWND hWndInsertAfter,
if ((hwnd != dxw.GethWnd()) || !dxw.IsFullScreen()){
// just proxy
res=(*pDeferWindowPos)(hWinPosInfo, hwnd, hWndInsertAfter, X, Y, cx, cy, uFlags);
res=(*pGDIDeferWindowPos)(hWinPosInfo, hwnd, hWndInsertAfter, X, Y, cx, cy, uFlags);
if(!res)OutTraceE("SetWindowPos: ERROR err=%d at %d\n", GetLastError(), __LINE__);
return res;
}
@ -859,8 +801,8 @@ HDWP WINAPI extDeferWindowPos(HDWP hWinPosInfo, HWND hwnd, HWND hWndInsertAfter,
if (dxw.dwFlags1 & PREVENTMAXIMIZE){
int UpdFlag =0;
int MaxX, MaxY;
MaxX = iSizX;
MaxY = iSizY;
MaxX = dxw.iSizX;
MaxY = dxw.iSizY;
if (!MaxX) MaxX = dxw.GetScreenWidth();
if (!MaxY) MaxY = dxw.GetScreenHeight();
if(cx>MaxX) { cx=MaxX; UpdFlag=1; }
@ -880,7 +822,7 @@ HDWP WINAPI extDeferWindowPos(HDWP hWinPosInfo, HWND hwnd, HWND hWndInsertAfter,
cx=rect.right; cy=rect.bottom;
OutTraceD("SetWindowPos: main form hwnd=%x fixed size=(%d,%d)\n", hwnd, cx, cy);
res=(*pDeferWindowPos)(hWinPosInfo, hwnd, hWndInsertAfter, X, Y, cx, cy, uFlags);
res=(*pGDIDeferWindowPos)(hWinPosInfo, hwnd, hWndInsertAfter, X, Y, cx, cy, uFlags);
if(!res)OutTraceE("DeferWindowPos: ERROR err=%d at %d\n", GetLastError(), __LINE__);
return res;
}
@ -890,8 +832,8 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam)
LPWINDOWPOS wp;
int MaxX, MaxY;
wp = (LPWINDOWPOS)lParam;
MaxX = iSizX;
MaxY = iSizY;
MaxX = dxw.iSizX;
MaxY = dxw.iSizY;
if (!MaxX) MaxX = dxw.GetScreenWidth();
if (!MaxY) MaxY = dxw.GetScreenHeight();
static int iLastCX, iLastCY;
@ -986,10 +928,10 @@ void dxwFixMinMaxInfo(char *ApiName, HWND hwnd, LPARAM lParam)
lpmmi=(LPMINMAXINFO)lParam;
OutTraceD("%s: GOT MaxPosition=(%d,%d) MaxSize=(%d,%d)\n", ApiName,
lpmmi->ptMaxPosition.x, lpmmi->ptMaxPosition.y, lpmmi->ptMaxSize.x, lpmmi->ptMaxSize.y);
lpmmi->ptMaxPosition.x=iPosX;
lpmmi->ptMaxPosition.y=iPosY;
lpmmi->ptMaxSize.x = iSizX ? iSizX : dxw.GetScreenWidth();
lpmmi->ptMaxSize.y = iSizY ? iSizY : dxw.GetScreenHeight();
lpmmi->ptMaxPosition.x=dxw.iPosX;
lpmmi->ptMaxPosition.y=dxw.iPosY;
lpmmi->ptMaxSize.x = dxw.iSizX ? dxw.iSizX : dxw.GetScreenWidth();
lpmmi->ptMaxSize.y = dxw.iSizY ? dxw.iSizY : dxw.GetScreenHeight();
OutTraceD("%s: SET LOCKWINPOS MaxPosition=(%d,%d) MaxSize=(%d,%d)\n", ApiName,
lpmmi->ptMaxPosition.x, lpmmi->ptMaxPosition.y, lpmmi->ptMaxSize.x, lpmmi->ptMaxSize.y);
}
@ -1129,7 +1071,7 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex)
{
DWORD res;
res = (*pGetDeviceCaps)(hdc, nindex);
res = (*pGDIGetDeviceCaps)(hdc, nindex);
OutTraceD("GetDeviceCaps: hdc=%x index=%x(%s) res=%x\n",
hdc, nindex, ExplainDeviceCaps(nindex), res);
@ -1255,65 +1197,9 @@ BOOL WINAPI extScaleWindowExtEx(HDC hdc, int Xnum, int Xdenom, int Ynum, int Yde
if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen()) return 1;
return (*pScaleWindowExtEx)(hdc, Xnum, Xdenom, Ynum, Ydenom, lpSize);
return (*pGDIScaleWindowExtEx)(hdc, Xnum, Xdenom, Ynum, Ydenom, lpSize);
}
/* ---- pixel color management ----*/
int WINAPI extGDIChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR *ppfd)
{
int ret;
OutTraceD("GDIChoosePixelFormat: hdc=%x, pfd=%x\n", hdc, ppfd);
OutTraceD("GDIChoosePixelFormat: Version=%x Flags-%x PixelType=%x ColorBits=%x RedBits=%x RedShift=%x "
"GreenBits=%x BlueBits=%x BlueShift=%x AlphaBits=%x AlphaShift=%x",
ppfd->nVersion, ppfd->dwFlags, ppfd->iPixelType, ppfd->cColorBits, ppfd->cRedBits, ppfd->cRedShift,
ppfd->cGreenBits, ppfd->cGreenShift, ppfd->cBlueBits, ppfd->cBlueShift, ppfd->cAlphaBits, ppfd->cAlphaShift);
/*
ppfd->cAccumBits, ppfd->cAccumRedBits, ppfd->cAccumGreenBits, ppfd->cAccumBlueBits, ppfd->cAccumAlphaBits,
ppfd->cDepthBits, ppfd->cStencilBits, ppfd->cAuxBuffers, ppfd->iLayerType, ppfd->bReserved,
ppfd->dwLayerMask, ppfd->dwVisibleMask, ppfd->dwDamageMask
*/
ret= (*pGDIChoosePixelFormat)(hdc, ppfd);
OutTraceD("GDIChoosePixelFormat: ret=%d\n",ret);
return ret;
}
int WINAPI extGDIGetPixelFormat(HDC hdc)
{
OutTraceD("GDIGetPixelFormat: hdc=%x\n", hdc);
return (*pGDIGetPixelFormat)(hdc);
}
BOOL WINAPI extGDISetPixelFormat(HDC hdc, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd)
{
OutTraceD("GDISetPixelFormat: hdc=%x\n", hdc);
#if 0
if(dxw.dwFlags1 & EMULATESURFACE){
// set VirtualScr view
VirtualScr.dwRGBBitCount=ppfd->cColorBits;
VirtualScr.dwFlags=ppfd->dwFlags;
VirtualScr.dwRBitMask=(2^ppfd->cRedBits - 1)<<ppfd->cRedShift;
VirtualScr.dwGBitMask=(2^ppfd->cGreenBits - 1)<<ppfd->cGreenShift;
VirtualScr.dwBBitMask=(2^ppfd->cBlueBits - 1)<<ppfd->cBlueShift;
VirtualScr.dwRGBAlphaBitMask=(2^ppfd->cAlphaBits - 1)<<ppfd->cAlphaShift;
OutTraceD("GDISetPixelFormat: RGBA colorbits=%d mask=(%x,%x,%x,%x)\n",
VirtualScr.dwRGBBitCount, VirtualScr.dwRBitMask, VirtualScr.dwGBitMask, VirtualScr.dwBBitMask, VirtualScr.dwRGBAlphaBitMask);
return 0;
}
#endif
return (*pGDISetPixelFormat)(hdc, iPixelFormat, ppfd);
}
//HRGN WINAPI extCreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect)
//{
// OutTraceD("CreateRectRgn: (%d,%d)-(%d,%d)\n", nLeftRect, nTopRect, nRightRect, nBottomRect);
// return (*pCreateRectRgn)(nLeftRect, nTopRect, nRightRect, nBottomRect);
//}
LONG WINAPI MyChangeDisplaySettings(char *fname, DEVMODE *lpDevMode, DWORD dwflags)
{
HRESULT res;
@ -1428,7 +1314,6 @@ BOOL WINAPI extClientToScreen(HWND whnd, LPPOINT lppoint)
return 1;
else
return (*pClientToScreen)(whnd, lppoint);
// return 1;
}
BOOL WINAPI extScreenToClient(HWND whnd, LPPOINT lppoint)
@ -1437,7 +1322,6 @@ BOOL WINAPI extScreenToClient(HWND whnd, LPPOINT lppoint)
return 1;
else
return (*pScreenToClient)(whnd, lppoint);
// return 1;
}
BOOL WINAPI extGetClientRect(HWND hwnd, LPRECT lpRect)
@ -1587,38 +1471,6 @@ BOOL WINAPI extGetMessage(LPMSG lpMsg, HWND hwnd, UINT wMsgFilterMin, UINT wMsgF
return res;
}
LRESULT WINAPI extDispatchMessage(LPMSG lpMsg)
{
BOOL res;
DWORD Message;
#if WORKONCOPY
static MSG MsgCopy;
MsgCopy=*lpMsg;
MsgCopy.pt=FixMessagePt(dxw.GethWnd(), MsgCopy.pt);
Message=MsgCopy.message & 0xFFFF;
if((Message <= WM_MOUSELAST) && (Message >= WM_MOUSEFIRST)){
MsgCopy.lParam = MAKELPARAM(MsgCopy.pt.x, MsgCopy.pt.y);
OutTraceC("PeekMessage: fixed lparam/pt=(%d,%d)\n", MsgCopy.pt.x, MsgCopy.pt.y);
}
res=(*pDispatchMessage)(&MsgCopy);
OutTraceW("DispatchMessage: lpmsg=%x msg=%x(%s) wparam=%x, lparam=%x pt=(%d,%d) res=%x\n",
lpMsg, MsgCopy.message, ExplainWinMessage(MsgCopy.message & 0xFFFF),
MsgCopy.wParam, MsgCopy.lParam, MsgCopy.pt.x, MsgCopy.pt.y, res);
#else
lpMsg->pt=FixMessagePt(dxw.GethWnd(), lpMsg->pt);
Message=lpMsg->message & 0xFFFF;
if((Message <= WM_MOUSELAST) && (Message >= WM_MOUSEFIRST)){
lpMsg->lParam = MAKELPARAM(lpMsg->pt.x, lpMsg->pt.y);
OutTraceC("PeekMessage: fixed lparam/pt=(%d,%d)\n", lpMsg->pt.x, lpMsg->pt.y);
}
res=(*pDispatchMessage)(lpMsg);
OutTraceW("DispatchMessage: lpmsg=%x msg=%x(%s) wparam=%x, lparam=%x pt=(%d,%d) res=%x\n",
lpMsg, lpMsg->message, ExplainWinMessage(lpMsg->message & 0xFFFF),
lpMsg->wParam, lpMsg->lParam, lpMsg->pt.x, lpMsg->pt.y, res);
#endif
return res;
}
// intercept GetProcAddress to initialize DirectDraw hook pointers.
// This is necessary in "The Sims" game, that loads DirectDraw dinamically
@ -1667,6 +1519,11 @@ HMODULE WINAPI extLoadLibraryA(LPCTSTR lpFileName)
break;
}
}
// handle custom OpenGL library
if(!lstrcmpi(lpName,dxw.CustomOpenGLLib)){
idx=SYSLIBIDX_OPENGL;
SysLibs[idx]=ret;
}
if(idx==SYSLIBIDX_MAX) {
OutTraceD("LoadLibraryA: hook %s\n", lpFileName);
HookModule((char *)lpFileName, 0);
@ -1702,7 +1559,7 @@ extern DirectDrawCreateEx_Type pDirectDrawCreateEx;
extern HRESULT WINAPI extDirectDrawCreate(GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR *);
extern HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *, LPDIRECTDRAW FAR *, REFIID, IUnknown FAR *);
extern GetProcAddress_Type pGetProcAddress;
extern HRESULT STDAPICALLTYPE extCoCreateInstance(REFCLSID, LPUNKNOWN, DWORD, REFIID, LPVOID FAR*);
//extern HRESULT STDAPICALLTYPE extCoCreateInstance(REFCLSID, LPUNKNOWN, DWORD, REFIID, LPVOID FAR*);
int WINAPI extIsDebuggerPresent(void)
{
@ -1775,6 +1632,7 @@ FARPROC WINAPI extGetProcAddress(HMODULE hModule, LPCSTR proc)
break;
case SYSLIBIDX_OPENGL:
//default:
if(!(dxw.dwFlags2 & HOOKOPENGL)) break;
if (remap=Remap_gl_ProcAddress(proc, hModule)) return remap;
}
}
@ -1837,6 +1695,7 @@ HDC WINAPI extGDIGetDC(HWND hwnd)
{
HDC ret;
HWND lochwnd;
OutTraceD("GDI.GetDC: hwnd=%x\n", hwnd);
lochwnd=hwnd;
if (dxw.IsFullScreen() && ((hwnd==0) || (hwnd==(*pGetDesktopWindow)()))) {
@ -1910,11 +1769,11 @@ HDC WINAPI extGDICreateDC(LPSTR Driver, LPSTR Device, LPSTR Output, CONST DEVMOD
if (!Driver || !strncmp(Driver,"DISPLAY",7)) {
OutTraceD("GDI.CreateDC: returning window surface DC\n");
WinHDC=(*pGDIGetDC)(dxw.GethWnd());
RetHDC=(*pCreateCompatibleDC)(WinHDC);
RetHDC=(*pGDICreateCompatibleDC)(WinHDC);
(*pGDIReleaseDC)(dxw.GethWnd(), WinHDC);
}
else{
RetHDC=(*pCreateDC)(Driver, Device, Output, InitData);
RetHDC=(*pGDICreateDC)(Driver, Device, Output, InitData);
}
if(RetHDC)
OutTraceD("GDI.CreateDC: returning HDC=%x\n", RetHDC);
@ -1926,20 +1785,24 @@ HDC WINAPI extGDICreateDC(LPSTR Driver, LPSTR Device, LPSTR Output, CONST DEVMOD
HDC WINAPI extGDICreateCompatibleDC(HDC hdc)
{
HDC RetHdc, SrcHdc;
extern HDC PrimSurfaceHDC;
extern LPDIRECTDRAWSURFACE lpDDSHDC, lpDDSPrimHDC;
extern LPDIRECTDRAWSURFACE lpDDSHDC;
extern GetDC_Type pGetDC;
DWORD LastError;
OutTraceD("GDI.CreateCompatibleDC: hdc=%x\n", hdc);
if(hdc==0){
SrcHdc=(*pGDIGetDC)(dxw.GethWnd());
OutTraceD("GDI.CreateCompatibleDC: duplicating win HDC hWnd=%x\n", dxw.GethWnd());
}
RetHdc=(*pCreateCompatibleDC)(hdc);
if(RetHdc)
// eliminated error message for errorcode 0.
SetLastError(0);
RetHdc=(*pGDICreateCompatibleDC)(hdc);
LastError=GetLastError();
if(!LastError)
OutTraceD("GDI.CreateCompatibleDC: returning HDC=%x\n", RetHdc);
else
OutTraceE("GDI.CreateCompatibleDC ERROR: err=%d at %d\n", GetLastError(), __LINE__);
OutTraceE("GDI.CreateCompatibleDC ERROR: err=%d at %d\n", LastError, __LINE__);
return RetHdc;
}
@ -1962,10 +1825,10 @@ BOOL WINAPI extGDIBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
nWDest= nWidth;
nHDest= nHeight;
dxw.MapRect(&nXDest, &nYDest, &nWDest, &nHDest);
res=(*pStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop);
res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop);
}
else {
res=(*pBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
res=(*pGDIBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
}
if(!res) OutTraceE("GDI.BitBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__);
@ -1984,10 +1847,10 @@ BOOL WINAPI extGDIPatBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdcDest))){
int nWDest, nHDest;
dxw.MapRect(&nXDest, &nYDest, &nWDest, &nHDest);
res=(*pPatBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, dwRop);
res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, dwRop);
}
else {
res=(*pPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop);
res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop);
}
if(!res) OutTraceE("GDI.PatBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__);
@ -2006,7 +1869,7 @@ BOOL WINAPI extGDIStretchBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, in
// to do: what happend if StretchBlt is applied on screen DC ?
res=(*pStretchBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, nWSrc, nHSrc, dwRop);
res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, nWSrc, nHSrc, dwRop);
if(!res) OutTraceE("GDI.StretchBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__);
return res;
}
@ -2015,7 +1878,7 @@ BOOL WINAPI extGDIDeleteDC(HDC hdc)
{
BOOL res;
OutTraceD("GDI.DeleteDC: hdc=%x\n", hdc);
res=(*pDeleteDC)(hdc);
res=(*pGDIDeleteDC)(hdc);
if(!res) OutTraceE("GDI.DeleteDC: ERROR err=%d at %d\n", GetLastError(), __LINE__);
return res;
}
@ -2062,20 +1925,19 @@ static HDC PrimHDC=NULL;
HDC WINAPI extDDCreateCompatibleDC(HDC hdc)
{
HDC RetHdc, SrcHdc;
extern LPDIRECTDRAWSURFACE lpDDSPrimHDC;
extern GetDC_Type pGetDC;
OutTraceD("GDI.CreateCompatibleDC: hdc=%x\n", hdc);
if(hdc==0 && pGetDC && dxw.IsFullScreen()){
if(!lpDDSPrimHDC) lpDDSPrimHDC=GetPrimarySurface();
(*pGetDC)(lpDDSPrimHDC,&SrcHdc);
OutTraceD("GDI.CreateCompatibleDC: duplicating screen HDC lpDDSPrimHDC=%x\n", lpDDSPrimHDC);
RetHdc=(*pCreateCompatibleDC)(SrcHdc);
(*pReleaseDC)(lpDDSPrimHDC,SrcHdc);
dxw.SetPrimarySurface();
(*pGetDC)(dxw.lpDDSPrimHDC,&SrcHdc);
OutTraceD("GDI.CreateCompatibleDC: duplicating screen HDC lpDDSPrimHDC=%x\n", dxw.lpDDSPrimHDC);
RetHdc=(*pGDICreateCompatibleDC)(SrcHdc);
(*pReleaseDC)(dxw.lpDDSPrimHDC,SrcHdc);
}
else
RetHdc=(*pCreateCompatibleDC)(hdc);
RetHdc=(*pGDICreateCompatibleDC)(hdc);
if(RetHdc)
OutTraceD("GDI.CreateCompatibleDC: returning HDC=%x\n", RetHdc);
@ -2091,7 +1953,7 @@ BOOL WINAPI extDDDeleteDC(HDC hdc)
OutTraceD("GDI.DeleteDC: hdc=%x\n", hdc);
res=(*pDeleteDC)(hdc);
res=(*pGDIDeleteDC)(hdc);
if(!res) OutTraceE("GDI.DeleteDC: ERROR err=%d at %d\n", GetLastError(), __LINE__);
return res;
}
@ -2104,26 +1966,24 @@ static HDC WINAPI winDDGetDC(HWND hwnd, char *api)
OutTraceD("%s: hwnd=%x\n", api, hwnd);
lpDDSPrimHDC=GetPrimarySurface();
dxw.ResetPrimarySurface();
dxw.SetPrimarySurface();
if(lpDDSPrimHDC){
if(dxw.lpDDSPrimHDC){
if (PrimHDC){
OutTraceD("%s: reusing primary hdc\n", api);
(*pUnlockMethod(lpDDSPrimHDC))(lpDDSPrimHDC, NULL);
(*pUnlockMethod(dxw.lpDDSPrimHDC))(dxw.lpDDSPrimHDC, NULL);
hdc=PrimHDC;
}
else{
OutTraceD("%s: get hdc from PRIMARY surface lpdds=%x\n", api, lpDDSPrimHDC);
//res=(*pGetDC)(lpDDSPrimHDC,&hdc);
//res=lpDDSPrimHDC->GetDC(&hdc);
res=extGetDC(lpDDSPrimHDC,&hdc);
OutTraceD("%s: get hdc from PRIMARY surface lpdds=%x\n", api, dxw.lpDDSPrimHDC);
res=extGetDC(dxw.lpDDSPrimHDC,&hdc);
if(res) {
OutTraceE("%s: GetDC(%x) ERROR %x(%s) at %d\n", api, lpDDSPrimHDC, res, ExplainDDError(res), __LINE__);
OutTraceE("%s: GetDC(%x) ERROR %x(%s) at %d\n", api, dxw.lpDDSPrimHDC, res, ExplainDDError(res), __LINE__);
if(res==DDERR_DCALREADYCREATED){
// try recovery....
(*pReleaseDC)(lpDDSPrimHDC,NULL);
//res=(*pGetDC)(lpDDSPrimHDC,&hdc);
res=extGetDC(lpDDSPrimHDC,&hdc);
(*pReleaseDC)(dxw.lpDDSPrimHDC,NULL);
res=extGetDC(dxw.lpDDSPrimHDC,&hdc);
}
if(res)return 0;
}
@ -2153,13 +2013,13 @@ HDC WINAPI extDDCreateDC(LPSTR Driver, LPSTR Device, LPSTR Output, CONST DEVMODE
//HDC PrimHDC;
LPDIRECTDRAWSURFACE lpdds;
OutTraceD("GDI.CreateDC: returning primary surface DC\n");
lpdds=GetPrimarySurface();
lpdds=dxw.GetPrimarySurface();
(*pGetDC)(lpdds, &PrimHDC);
RetHDC=(*pCreateCompatibleDC)(PrimHDC);
RetHDC=(*pGDICreateCompatibleDC)(PrimHDC);
(*pReleaseDC)(lpdds, PrimHDC);
}
else{
RetHDC=(*pCreateDC)(Driver, Device, Output, InitData);
RetHDC=(*pGDICreateDC)(Driver, Device, Output, InitData);
}
if(RetHDC)
OutTraceD("GDI.CreateDC: returning HDC=%x\n", RetHDC);
@ -2189,22 +2049,11 @@ int WINAPI extDDReleaseDC(HWND hwnd, HDC hDC)
OutTraceD("GDI.ReleaseDC: hwnd=%x hdc=%x\n", hwnd, hDC);
res=0;
// if (hDC == PrimHDC /* && IsAScreenHDC(hDC) */){
if ((hDC == PrimHDC) || (hwnd==0)){
if(!lpDDSPrimHDC) lpDDSPrimHDC=GetPrimarySurface();
OutTraceD("GDI.ReleaseDC: refreshing primary surface lpdds=%x\n",lpDDSPrimHDC);
if(!lpDDSPrimHDC) return 0;
#if 0
//extBlt(lpDDSPrimHDC, NULL, lpDDSPrimHDC, NULL, 0, NULL);
sBlt("GDI.ReleaseDC", lpDDSPrimHDC, NULL, lpDDSPrimHDC, NULL, 0, NULL, 0);
res=(*pUnlockMethod(lpDDSPrimHDC))(lpDDSPrimHDC, NULL);
//if(res) OutTraceE("Unlock ERROR: res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
res=(*pReleaseDC)(lpDDSPrimHDC,hDC);
if(res) OutTraceE("GDI.ReleaseDC: ReleaseDC ERROR=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
#else
//lpDDSPrimHDC->ReleaseDC(hDC);
extReleaseDC(lpDDSPrimHDC, hDC);
#endif
dxw.SetPrimarySurface();
OutTraceD("GDI.ReleaseDC: refreshing primary surface lpdds=%x\n",dxw.lpDDSPrimHDC);
if(!dxw.lpDDSPrimHDC) return 0;
extReleaseDC(dxw.lpDDSPrimHDC, hDC);
PrimHDC=NULL;
res=1; // 1 = OK
}
@ -2222,31 +2071,6 @@ BOOL WINAPI extDDBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHe
HRESULT res;
extern HRESULT WINAPI extGetDC(LPDIRECTDRAWSURFACE, HDC FAR *);
#if 0
OutTraceD("GDI.BitBlt: HDC=%x nXDest=%d nYDest=%d nWidth=%d nHeight=%d hdcSrc=%x nXSrc=%d nYSrc=%d dwRop=%x\n",
hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
ret=1; // OK
if(hdcDest==0) extGetDC(lpDDSPrimHDC, &hdcDest);
if(hdcDest != hdcSrc){
ret=(*pBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
if(!ret) {
OutTraceE("GDI.BitBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__);
return ret;
}
}
// if(hdcDest==PrimHDC){
{
if(!lpDDSPrimHDC) lpDDSPrimHDC=GetPrimarySurface();
OutTraceD("GDI.BitBlt: refreshing primary surface lpdds=%x\n",lpDDSPrimHDC);
//extBlt(lpDDSPrimHDC, NULL, lpDDSPrimHDC, NULL, 0, NULL);
sBlt("GDI.BitBlt", lpDDSPrimHDC, NULL, lpDDSPrimHDC, NULL, 0, NULL, 0);
res=(*pUnlockMethod(lpDDSPrimHDC))(lpDDSPrimHDC, NULL);
//if(res) OutTraceE("Unlock: ERROR err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
}
#else
OutTraceD("GDI.BitBlt: HDC=%x nXDest=%d nYDest=%d nWidth=%d nHeight=%d hdcSrc=%x nXSrc=%d nYSrc=%d dwRop=%x(%s)\n",
hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop, ExplainROP(dwRop));
@ -2254,26 +2078,18 @@ BOOL WINAPI extDDBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHe
if(hdcDest==0) hdcDest=PrimHDC;
if(hdcDest==0) {
lpDDSPrimHDC=GetPrimarySurface();
res=extGetDC(lpDDSPrimHDC, &PrimHDC);
dxw.ResetPrimarySurface();
dxw.SetPrimarySurface();
res=extGetDC(dxw.lpDDSPrimHDC, &PrimHDC);
hdcDest=PrimHDC;
}
res=(*pBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
res=(*pGDIBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
if(!res) OutTraceE("GDI.BitBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__);
res=(*pBitBlt)(NULL, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
res=(*pGDIBitBlt)(NULL, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
//if(hdcDest==PrimHDC){
// OutTraceD("GDI.BitBlt: refreshing primary surface lpdds=%x\n",lpDDSPrimHDC);
// //extBlt(lpDDSPrimHDC, NULL, lpDDSPrimHDC, NULL, 0, NULL);
// res=sBlt("GDI.BitBlt", lpDDSPrimHDC, NULL, lpDDSPrimHDC, NULL, 0, NULL, 0);
// if(res) OutTraceE("GDI.BitBlt: ERROR err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
// res=(*pUnlockMethod(lpDDSPrimHDC))(lpDDSPrimHDC, NULL);
// if(res) OutTraceE("Unlock: ERROR err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
//}
if(!res) ret=0;
#endif
return ret;
}
@ -2290,21 +2106,16 @@ BOOL WINAPI extDDStretchBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int
if(hdcDest != hdcSrc){
(*pGetClientRect)(dxw.GethWnd(),&ClientRect);
ret=(*pStretchBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop);
ret=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop);
if(!ret) {
OutTraceE("GDI.StretchBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__);
return ret;
}
}
// if(hdcDest==PrimHDC){
{
if(!lpDDSPrimHDC) lpDDSPrimHDC=GetPrimarySurface();
OutTraceD("GDI.StretchBlt: refreshing primary surface lpdds=%x\n",lpDDSPrimHDC);
//extBlt(lpDDSPrimHDC, NULL, lpDDSPrimHDC, NULL, 0, NULL);
sBlt("GDI.StretchBlt", lpDDSPrimHDC, NULL, lpDDSPrimHDC, NULL, 0, NULL, 0);
res=(*pUnlockMethod(lpDDSPrimHDC))(lpDDSPrimHDC, NULL);
//if(res) OutTraceE("Unlock: ERROR err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
}
dxw.SetPrimarySurface();
OutTraceD("GDI.StretchBlt: refreshing primary surface lpdds=%x\n",dxw.lpDDSPrimHDC);
sBlt("GDI.StretchBlt", dxw.lpDDSPrimHDC, NULL, dxw.lpDDSPrimHDC, NULL, 0, NULL, 0);
res=(*pUnlockMethod(dxw.lpDDSPrimHDC))(dxw.lpDDSPrimHDC, NULL);
return ret;
}
@ -2322,9 +2133,8 @@ HDC WINAPI extBeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint)
// on MAPGDITOPRIMARY, return the PrimHDC handle instead of the window DC
if(dxw.dwFlags1 & MAPGDITOPRIMARY) {
if(pGetDC && lpDDSPrimHDC){
//(*pGetDC)(lpDDSPrimHDC,&PrimHDC);
extGetDC(lpDDSPrimHDC,&PrimHDC);
if(pGetDC && dxw.lpDDSPrimHDC){
extGetDC(dxw.lpDDSPrimHDC,&PrimHDC);
OutTraceD("GDI.BeginPaint: redirect hdc=%x -> PrimHDC=%x\n", hdc, PrimHDC);
hdc=PrimHDC;
}
@ -2392,8 +2202,6 @@ HWND WINAPI extCreateDialogIndirectParam(HINSTANCE hInstance, LPCDLGTEMPLATE lpT
if(!(*pSetWindowLong)(RetHWND, DWL_DLGPROC, (LONG)extDialogWindowProc))
OutTraceE("SetWindowLong: ERROR err=%d at %d\n", GetLastError(), __LINE__);
//if(!(*pMoveWindow)(RetHWND, iPosX, iPosY, iSizX, iSizY, FALSE))
// OutTraceE("MoveWindow: ERROR err=%d at %d\n", GetLastError(), __LINE__);
OutTraceD("CreateDialogIndirectParam: hwnd=%x\n", RetHWND);
isWithinDialog=FALSE;
//if (IsDebug) EnumChildWindows(RetHWND, (WNDENUMPROC)TraceChildWin, (LPARAM)RetHWND);
@ -2413,26 +2221,12 @@ HWND WINAPI extCreateDialogParam(HINSTANCE hInstance, LPCTSTR lpTemplateName, HW
if(!(*pSetWindowLong)(RetHWND, DWL_DLGPROC, (LONG)extDialogWindowProc))
OutTraceE("SetWindowLong: ERROR err=%d at %d\n", GetLastError(), __LINE__);
//if(!(*pMoveWindow)(RetHWND, iPosX, iPosY, iSizX, iSizY, FALSE))
// OutTraceE("MoveWindow: ERROR err=%d at %d\n", GetLastError(), __LINE__);
OutTraceD("CreateDialogParam: hwnd=%x\n", RetHWND);
isWithinDialog=FALSE;
//if (IsDebug) EnumChildWindows(RetHWND, (WNDENUMPROC)TraceChildWin, (LPARAM)RetHWND);
return RetHWND;
}
HWND WINAPI extSetCapture(HWND hwnd)
{
OutTraceD("SetCapture: hwnd=%x\n", hwnd);
return NULL;
}
BOOL WINAPI extReleaseCapture(void)
{
OutTraceD("ReleaseCapture\n");
return 1;
}
BOOL WINAPI extDDInvalidateRect(HWND hwnd, RECT *lpRect, BOOL bErase)
{
if(lpRect)
@ -2457,13 +2251,6 @@ BOOL WINAPI extInvalidateRect(HWND hwnd, RECT *lpRect, BOOL bErase)
return (*pInvalidateRect)(hwnd, NULL, bErase);
}
BOOL WINAPI extInvalidateRgn(HWND hwnd, HRGN hRgn, BOOL bErase)
{
OutTraceD("InvalidateRgn: hwnd=%x hrgn=%x erase=%x\n",
hwnd, hRgn, bErase);
return (*pInvalidateRgn)(hwnd, hRgn, bErase);
}
/* --------------------------------------------------------------------------- */
// v2.1.75: Hooking for GDI32 CreatePalette, SelectPalette, RealizePalette:
@ -2485,6 +2272,7 @@ HPALETTE WINAPI extGDICreatePalette(CONST LOGPALETTE *plpal)
HPALETTE ret;
int idx;
dxw.IsGDIPalette=TRUE;
OutTraceD("GDI.CreatePalette: plpal=%x version=%x NumEntries=%x\n", plpal, plpal->palVersion, plpal->palNumEntries);
ret=(*pGDICreatePalette)(plpal);
if(IsDebug){
@ -2504,8 +2292,7 @@ HPALETTE WINAPI extSelectPalette(HDC hdc, HPALETTE hpal, BOOL bForceBackground)
{
HPALETTE ret;
ret=(*pSelectPalette)(hdc, hpal, bForceBackground);
//G_bForceBackground=bForceBackground;
ret=(*pGDISelectPalette)(hdc, hpal, bForceBackground);
OutTraceD("GDI.SelectPalette: hdc=%x hpal=%x ForceBackground=%x ret=%x\n", hdc, hpal, bForceBackground, ret);
return ret;
}
@ -2515,13 +2302,16 @@ UINT WINAPI extRealizePalette(HDC hdc)
UINT ret;
extern void mySetPalette(int, int, LPPALETTEENTRY);
ret=(*pRealizePalette)(hdc);
ret=(*pGDIRealizePalette)(hdc);
OutTraceD("GDI.RealizePalette: hdc=%x ret=%x\n", hdc, ret);
if(!dxw.IsGDIPalette) return ret;
// quick & dirty implementation through a nasty global:
// if the SelectPalette didn't force to the background (arg bForceBackground==FALSE)
// then don't override the current palette set by the DirectDrawPalette class.
// should be cleaned up a little....
// maybe not: now both Diable & Dementia colors are working...
// maybe not: now both Diablo & Dementia colors are working...
if(dxw.dwFlags1 & EMULATESURFACE)
mySetPalette(0, MyPal.palNumEntries, MyPal.palPalEntry);
// DEBUGGING
@ -2531,7 +2321,6 @@ UINT WINAPI extRealizePalette(HDC hdc)
for(idx=0; idx<MyPal.palNumEntries; idx++) OutTraceD("(%x)", PaletteEntries[idx]);
OutTraceD("\n");
}
// return 1;
return ret;
}
@ -2544,7 +2333,7 @@ UINT WINAPI extGetSystemPaletteEntries(HDC hdc, UINT iStartIndex, UINT nEntries,
{
int ret;
OutTraceD("GetSystemPaletteEntries: hdc=%x start=%d num=%d\n", hdc, iStartIndex, nEntries);
ret=(*pGetSystemPaletteEntries)(hdc, iStartIndex, nEntries, lppe);
ret=(*pGDIGetSystemPaletteEntries)(hdc, iStartIndex, nEntries, lppe);
OutTraceD("GetSystemPaletteEntries: ret=%d\n", ret);
if((ret == 0) && (dxw.dwFlags1 & EMULATESURFACE)) {
OutTraceD("GetSystemPaletteEntries: fixing ret=%d\n", nEntries);
@ -2662,7 +2451,7 @@ BOOL WINAPI extSetDeviceGammaRamp(HDC hDC, LPVOID lpRamp)
OutTraceD("SetDeviceGammaRamp: SUPPRESSED\n");
return TRUE;
}
ret=(*pSetDeviceGammaRamp)(hDC, lpRamp);
ret=(*pGDISetDeviceGammaRamp)(hDC, lpRamp);
if(!ret) OutTraceE("SetDeviceGammaRamp: ERROR err=%d\n", GetLastError());
return ret;
}
@ -2671,7 +2460,7 @@ BOOL WINAPI extGetDeviceGammaRamp(HDC hDC, LPVOID lpRamp)
{
BOOL ret;
OutTraceD("GetDeviceGammaRamp: hdc=%x\n", hDC);
ret=(*pGetDeviceGammaRamp)(hDC, lpRamp);
ret=(*pGDIGetDeviceGammaRamp)(hDC, lpRamp);
if(!ret) OutTraceE("GetDeviceGammaRamp: ERROR err=%d\n", GetLastError());
return ret;
}
@ -2717,4 +2506,87 @@ LRESULT WINAPI extSendMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
DWORD WINAPI extGetTickCount(void)
{
return dxw.GetTickCount();
}
void WINAPI extGetSystemTime(LPSYSTEMTIME lpSystemTime)
{
dxw.GetSystemTime(lpSystemTime);
OutTrace("GetSystemTime: %02d:%02d:%02d.%03d\n",
lpSystemTime->wHour, lpSystemTime->wMinute, lpSystemTime->wSecond, lpSystemTime->wMilliseconds);
}
void WINAPI extGetLocalTime(LPSYSTEMTIME lpLocalTime)
{
SYSTEMTIME SystemTime;
dxw.GetSystemTime(&SystemTime);
SystemTimeToTzSpecificLocalTime(NULL, &SystemTime, lpLocalTime);
OutTrace("GetLocalTime: %02d:%02d:%02d.%03d\n",
lpLocalTime->wHour, lpLocalTime->wMinute, lpLocalTime->wSecond, lpLocalTime->wMilliseconds);
}
UINT_PTR WINAPI extSetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc)
{
UINT uShiftedElapse;
// beware: the quicker the time flows, the more the time clicks are incremented,
// and the lesser the pauses must be lasting! Shift operations are reverted in
// GetSystemTime vs. Sleep or SetTimer
uShiftedElapse = dxw.StretchTime(uElapse);
OutTrace("SetTimer: elapse=%d->%d timeshift=%d\n", uElapse, uShiftedElapse, dxw.TimeShift);
return (*pSetTimer)(hWnd, nIDEvent, uShiftedElapse, lpTimerFunc);
}
VOID WINAPI extSleep(DWORD dwMilliseconds)
{
DWORD dwNewDelay;
dwNewDelay=dwMilliseconds;
if (dwMilliseconds!=INFINITE && dwMilliseconds!=0){
dwNewDelay = dxw.StretchTime(dwMilliseconds);
if (dwNewDelay==0){ // oh oh! troubles...
if (dxw.TimeShift > 0) dwNewDelay=1; // minimum allowed...
else dwNewDelay = INFINITE-1; // maximum allowed !!!
}
}
OutTrace("Sleep: msec=%d->%d timeshift=%d\n", dwMilliseconds, dwNewDelay, dxw.TimeShift);
(*pSleep)(dwNewDelay);
}
DWORD WINAPI extSleepEx(DWORD dwMilliseconds, BOOL bAlertable)
{
DWORD dwNewDelay;
dwNewDelay=dwMilliseconds;
if (dwMilliseconds!=INFINITE && dwMilliseconds!=0){
dwNewDelay = dxw.StretchTime(dwMilliseconds);
if (dwNewDelay==0){ // oh oh! troubles...
if (dxw.TimeShift > 0) dwNewDelay=1; // minimum allowed...
else dwNewDelay = INFINITE-1; // maximum allowed !!!
}
}
OutTrace("SleepEx: msec=%d->%d alertable=%x, timeshift=%d\n", dwMilliseconds, dwNewDelay, bAlertable, dxw.TimeShift);
return (*pSleepEx)(dwNewDelay, bAlertable);
}
int WINAPI extShowCursor(BOOL bShow)
{
static int iFakeCounter;
int ret;
OutTraceD("ShowCursor: bShow=%x\n", bShow);
if (bShow){
if (dxw.dwFlags1 & HIDEHWCURSOR){
iFakeCounter++;
OutTraceD("ShowCursor: HIDEHWCURSOR ret=%x\n", iFakeCounter);
return iFakeCounter;
}
}
else {
if (dxw.dwFlags2 & SHOWHWCURSOR){
iFakeCounter--;
OutTraceD("ShowCursor: SHOWHWCURSOR ret=%x\n", iFakeCounter);
return iFakeCounter;
}
}
ret=(*pShowCursor)(bShow);
OutTraceD("ShowCursor: ret=%x\n", ret);
return ret;
}

View File

@ -1,166 +1,285 @@
/* ===================================================================
u32lib.h: contains typedef definition and extern pointer declarations
for all GDI32.dll and user32.dll functions hooked by DxWnd
syslibs.h: contains typedef definition and extern pointer declarations
for all system calls hooked by DxWnd:
GDI32.dll
Kernel32.dll
ole32.dll
user32.dll.dll
====================================================================*/
typedef BOOL (WINAPI *GetCursorPos_Type)(LPPOINT);
typedef BOOL (WINAPI *SetCursorPos_Type)(int, int);
typedef HCURSOR (WINAPI *SetCursor_Type)(HCURSOR);
typedef BOOL (WINAPI *ClipCursor_Type)(const RECT *);
typedef BOOL (WINAPI *TextOut_Type)(HDC, int, int, LPCTSTR, int);
typedef BOOL (WINAPI *Rectangle_Type)(HDC, int, int, int, int);
typedef COLORREF (WINAPI *SetBkColor_Type)(HDC, COLORREF);
typedef COLORREF (WINAPI *SetTextColor_Type)(HDC, COLORREF);
typedef HFONT (WINAPI *CreateFont_Type)(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCTSTR);
typedef HFONT (WINAPI *CreateFontIndirect_Type)(const LOGFONT*);
typedef HDC (WINAPI *GDIGetDC_Type)(HWND);
typedef int (WINAPI *GDIReleaseDC_Type)(HWND, HDC);
typedef BOOL (WINAPI *ColorCorrectPalette_Type)(HDC, HPALETTE, DWORD, DWORD);
typedef HWND (WINAPI *CreateWindowExA_Type)(DWORD, LPCTSTR, LPCTSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID);
typedef HWND (WINAPI *GetDesktopWindow_Type)(void);
typedef BOOL (WINAPI *ShowWindow_Type)(HWND, int);
typedef int (WINAPI *FillRect_Type)(HDC, const RECT *, HBRUSH);
typedef int (WINAPI *DrawFocusRect_Type)(HDC, const RECT *);
typedef int (WINAPI *GetSystemMetrics_Type)(int);
typedef int (WINAPI *GetDeviceCaps_Type)(HDC, int);
typedef int (WINAPI *GDIGetDisplayMode_Type)(HDC, int);
typedef BOOL (WINAPI *ShowWindow_Type)(HWND, int);
typedef LONG (WINAPI *SetWindowLong_Type)(HWND, int, LONG);
typedef LONG (WINAPI *GetWindowLong_Type)(HWND, int);
typedef BOOL (WINAPI *SetWindowPos_Type)(HWND, HWND, int, int, int, int, UINT);
typedef HDWP (WINAPI *DeferWindowPos_Type)(HDWP, HWND, HWND, int, int, int, int, UINT);
typedef LRESULT (WINAPI *CallWindowProc_Type)(WNDPROC, HWND, UINT, WPARAM, LPARAM);
typedef BOOL (WINAPI *ScaleWindowExtEx_Type)(HDC, int, int, int, int, LPSIZE);
typedef int (WINAPI *GDIChoosePixelFormat_Type)(HDC, const PIXELFORMATDESCRIPTOR *);
typedef int (WINAPI *GDIGetPixelFormat_Type)(HDC hdc);
typedef BOOL (WINAPI *GDISetPixelFormat_Type)(HDC, int, const PIXELFORMATDESCRIPTOR *);
//typedef HRGN (WINAPI *CreateRectRgn_Type)(int, int, int, int);
typedef LRESULT (WINAPI *DefWindowProc_Type)(HWND, UINT, WPARAM, LPARAM);
typedef LONG (WINAPI *ChangeDisplaySettings_Type)(DEVMODE *, DWORD);
typedef LONG (WINAPI *ChangeDisplaySettingsEx_Type)(LPCTSTR, DEVMODE *, HWND, DWORD, LPVOID);
typedef LONG (WINAPI *EnumDisplaySettings_Type)(LPCTSTR, DWORD, LPDEVMODEA);
typedef BOOL (WINAPI *SetWindowPlacement_Type)(const WINDOWPLACEMENT*);
typedef DWORD (WINAPI *SetLayeredWindowAttributes_Type)(HWND, DWORD, BYTE, DWORD);
typedef HDC (WINAPI *CreateCompatibleDC_Type)(HDC);
typedef BOOL (WINAPI *DeleteDC_Type)(HDC);
typedef BOOL (WINAPI *BitBlt_Type)(HDC, int, int, int, int, HDC, int, int, DWORD);
typedef BOOL (WINAPI *PatBlt_Type)(HDC, int, int, int, int, DWORD);
typedef BOOL (WINAPI *StretchBlt_Type)(HDC, int, int, int, int, HDC, int, int, int, int, DWORD);
typedef HDC (WINAPI *CreateDC_Type)(LPCSTR, LPCSTR, LPCSTR, const DEVMODE *);
typedef int (WINAPI *SaveDC_Type)(HDC);
typedef BOOL (WINAPI *RestoreDC_Type)(HDC, int);
typedef HDC (WINAPI *BeginPaint_Type)(HWND, LPPAINTSTRUCT);
typedef BOOL (WINAPI *EndPaint_Type)(HWND, const PAINTSTRUCT *);
/* ===================================================================
type definitions
====================================================================*/
// GDI32.dll:
typedef BOOL (WINAPI *BitBlt_Type)(HDC, int, int, int, int, HDC, int, int, DWORD);
typedef HDC (WINAPI *CreateCompatibleDC_Type)(HDC);
typedef HDC (WINAPI *CreateDC_Type)(LPCSTR, LPCSTR, LPCSTR, const DEVMODE *);
typedef HFONT (WINAPI *CreateFont_Type)(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCTSTR);
typedef HFONT (WINAPI *CreateFontIndirect_Type)(const LOGFONT*);
typedef HPALETTE(WINAPI *GDICreatePalette_Type)(CONST LOGPALETTE *);
typedef HDWP (WINAPI *DeferWindowPos_Type)(HDWP, HWND, HWND, int, int, int, int, UINT);
typedef BOOL (WINAPI *DeleteDC_Type)(HDC);
typedef int (WINAPI *GetDeviceCaps_Type)(HDC, int);
typedef BOOL (WINAPI *GetDeviceGammaRamp_Type)(HDC, LPVOID);
typedef BOOL (WINAPI *GetSystemPaletteEntries_Type)(HDC, UINT, UINT, LPPALETTEENTRY);
typedef BOOL (WINAPI *PatBlt_Type)(HDC, int, int, int, int, DWORD);
typedef UINT (WINAPI *RealizePalette_Type)(HDC);
typedef BOOL (WINAPI *Rectangle_Type)(HDC, int, int, int, int);
typedef BOOL (WINAPI *RestoreDC_Type)(HDC, int);
typedef int (WINAPI *SaveDC_Type)(HDC);
typedef BOOL (WINAPI *ScaleWindowExtEx_Type)(HDC, int, int, int, int, LPSIZE);
typedef HPALETTE(WINAPI *SelectPalette_Type)(HDC, HPALETTE, BOOL);
typedef COLORREF (WINAPI *SetBkColor_Type)(HDC, COLORREF);
typedef BOOL (WINAPI *SetDeviceGammaRamp_Type)(HDC, LPVOID);
typedef COLORREF(WINAPI *SetTextColor_Type)(HDC, COLORREF);
typedef BOOL (WINAPI *StretchBlt_Type)(HDC, int, int, int, int, HDC, int, int, int, int, DWORD);
typedef BOOL (WINAPI *TextOut_Type)(HDC, int, int, LPCTSTR, int);
// Kernel32.dll:
typedef BOOL (WINAPI *GetDiskFreeSpaceA_Type)(LPCSTR, LPDWORD, LPDWORD, LPDWORD, LPDWORD);
typedef void (WINAPI *GetLocalTime_Type)(LPSYSTEMTIME);
typedef FARPROC (WINAPI *GetProcAddress_Type)(HMODULE, LPCSTR);
typedef void (WINAPI *GetSystemTime_Type)(LPSYSTEMTIME);
typedef DWORD (WINAPI *GetTickCount_Type)(void);
typedef HMODULE (WINAPI *LoadLibraryA_Type)(LPCTSTR);
typedef HMODULE (WINAPI *LoadLibraryExA_Type)(LPCTSTR, HANDLE, DWORD);
typedef BOOL (WINAPI *GetClipCursor_Type)(LPRECT);
typedef ATOM (WINAPI *RegisterClassExA_Type)(WNDCLASSEX *);
typedef BOOL (WINAPI *ScreenToClient_Type)(HWND, LPPOINT);
typedef BOOL (WINAPI *ClientToScreen_Type)(HWND, LPPOINT);
typedef BOOL (WINAPI *GetClientRect_Type)(HWND, LPRECT);
typedef BOOL (WINAPI *GetWindowRect_Type)(HWND, LPRECT);
typedef int (WINAPI *MapWindowPoints_Type)(HWND, HWND, LPPOINT, UINT);
typedef LPTOP_LEVEL_EXCEPTION_FILTER
(WINAPI *SetUnhandledExceptionFilter_Type)(LPTOP_LEVEL_EXCEPTION_FILTER);
typedef void (WINAPI *Sleep_Type)(DWORD);
typedef DWORD (WINAPI *SleepEx_Type)(DWORD, BOOL);
typedef BOOL (WINAPI *PeekMessage_Type)(LPMSG, HWND, UINT, UINT, UINT);
typedef BOOL (WINAPI *GetMessage_Type)(LPMSG, HWND, UINT, UINT);
typedef LRESULT (WINAPI *DispatchMessage_Type)(LPMSG);
typedef FARPROC (WINAPI *GetProcAddress_Type)(HMODULE, LPCSTR);
//typedef BOOL (WINAPI *GetUpdateRect_Type)(HWND, LPRECT, BOOL);
typedef HWND (WINAPI *CreateDialogIndirectParam_Type)(HINSTANCE, LPCDLGTEMPLATE, HWND, DLGPROC, LPARAM);
typedef HWND (WINAPI *CreateDialogParam_Type)(HINSTANCE, LPCTSTR, HWND, DLGPROC, LPARAM);
typedef BOOL (WINAPI *InvalidateRect_Type)(HWND, CONST RECT *, BOOL);
typedef BOOL (WINAPI *InvalidateRgn_Type)(HWND, HRGN, BOOL);
// ole32.dll:
typedef HRESULT (STDAPICALLTYPE *CoCreateInstance_Type)(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID FAR* ppv);
typedef HPALETTE (WINAPI *SelectPalette_Type)(HDC, HPALETTE, BOOL);
typedef UINT (WINAPI *RealizePalette_Type)(HDC);
typedef HDC (WINAPI *BeginPaint_Type)(HWND, LPPAINTSTRUCT);
typedef HPALETTE (WINAPI *GDICreatePalette_Type)(CONST LOGPALETTE *);
typedef BOOL (WINAPI *GetSystemPaletteEntries_Type)(HDC, UINT, UINT, LPPALETTEENTRY);
typedef BOOL (WINAPI *MoveWindow_Type)(HWND, int, int, int, int, BOOL);
typedef LPTOP_LEVEL_EXCEPTION_FILTER (WINAPI *SetUnhandledExceptionFilter_Type)(LPTOP_LEVEL_EXCEPTION_FILTER);
typedef BOOL (WINAPI *GetDiskFreeSpaceA_Type)(LPCSTR, LPDWORD, LPDWORD, LPDWORD, LPDWORD);
typedef BOOL (WINAPI *SetDeviceGammaRamp_Type)(HDC, LPVOID);
typedef BOOL (WINAPI *GetDeviceGammaRamp_Type)(HDC, LPVOID);
// user32.dll:
typedef HDC (WINAPI *BeginPaint_Type)(HWND, LPPAINTSTRUCT);
typedef LRESULT (WINAPI *CallWindowProc_Type)(WNDPROC, HWND, UINT, WPARAM, LPARAM);
typedef LONG (WINAPI *ChangeDisplaySettings_Type)(DEVMODE *, DWORD);
typedef LONG (WINAPI *ChangeDisplaySettingsEx_Type)(LPCTSTR, DEVMODE *, HWND, DWORD, LPVOID);
typedef BOOL (WINAPI *ClientToScreen_Type)(HWND, LPPOINT);
typedef BOOL (WINAPI *ClipCursor_Type)(const RECT *);
typedef HWND (WINAPI *CreateDialogIndirectParam_Type)(HINSTANCE, LPCDLGTEMPLATE, HWND, DLGPROC, LPARAM);
typedef HWND (WINAPI *CreateDialogParam_Type)(HINSTANCE, LPCTSTR, HWND, DLGPROC, LPARAM);
typedef HWND (WINAPI *CreateWindowExA_Type)(DWORD, LPCTSTR, LPCTSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID);
typedef LRESULT (WINAPI *DefWindowProc_Type)(HWND, UINT, WPARAM, LPARAM);
typedef BOOL (WINAPI *EndPaint_Type)(HWND, const PAINTSTRUCT *);
typedef LONG (WINAPI *EnumDisplaySettings_Type)(LPCTSTR, DWORD, LPDEVMODEA);
typedef int (WINAPI *FillRect_Type)(HDC, const RECT *, HBRUSH);
typedef BOOL (WINAPI *GetClientRect_Type)(HWND, LPRECT);
typedef BOOL (WINAPI *GetClipCursor_Type)(LPRECT);
typedef BOOL (WINAPI *GetCursorPos_Type)(LPPOINT);
typedef HDC (WINAPI *GDIGetDC_Type)(HWND);
typedef HWND (WINAPI *GetDesktopWindow_Type)(void);
typedef BOOL (WINAPI *GetMessage_Type)(LPMSG, HWND, UINT, UINT);
typedef int (WINAPI *GetSystemMetrics_Type)(int);
typedef LONG (WINAPI *GetWindowLong_Type)(HWND, int);
typedef BOOL (WINAPI *GetWindowRect_Type)(HWND, LPRECT);
typedef BOOL (WINAPI *InvalidateRect_Type)(HWND, CONST RECT *, BOOL);
typedef int (WINAPI *MapWindowPoints_Type)(HWND, HWND, LPPOINT, UINT);
typedef BOOL (WINAPI *MoveWindow_Type)(HWND, int, int, int, int, BOOL);
typedef BOOL (WINAPI *PeekMessage_Type)(LPMSG, HWND, UINT, UINT, UINT);
typedef ATOM (WINAPI *RegisterClassExA_Type)(WNDCLASSEX *);
typedef int (WINAPI *GDIReleaseDC_Type)(HWND, HDC);
typedef BOOL (WINAPI *ScreenToClient_Type)(HWND, LPPOINT);
typedef LRESULT (WINAPI *SendMessage_Type)(HWND, UINT, WPARAM, LPARAM);
typedef DWORD (WINAPI *GetTickCount_Type)(void);
typedef HCURSOR (WINAPI *SetCursor_Type)(HCURSOR);
typedef BOOL (WINAPI *SetCursorPos_Type)(int, int);
typedef UINT_PTR(WINAPI *SetTimer_Type)(HWND, UINT_PTR, UINT, TIMERPROC);
typedef LONG (WINAPI *SetWindowLong_Type)(HWND, int, LONG);
typedef BOOL (WINAPI *SetWindowPos_Type)(HWND, HWND, int, int, int, int, UINT);
typedef int (WINAPI *ShowCursor_Type)(BOOL);
typedef BOOL (WINAPI *ShowWindow_Type)(HWND, int);
extern GetCursorPos_Type pGetCursorPos;
extern SetCursorPos_Type pSetCursorPos;
extern ClipCursor_Type pClipCursor;
extern TextOut_Type pTextOutA;
extern FillRect_Type pFillRect;
extern DrawFocusRect_Type pDrawFocusRect;
extern Rectangle_Type pRectangle;
extern SetTextColor_Type pSetTextColor;
extern GetSystemMetrics_Type pGetSystemMetrics;
extern CreateFont_Type pCreateFont;
extern CreateFontIndirect_Type pCreateFontIndirect;
extern SetBkColor_Type pSetBkColor;
extern GetDeviceCaps_Type pGetDeviceCaps;
extern GDIGetDisplayMode_Type pGDIGetDisplayMode;
extern ColorCorrectPalette_Type pColorCorrectPalette;
extern CreateWindowExA_Type pCreateWindowExA;
extern GetDesktopWindow_Type pGetDesktopWindow;
extern ShowWindow_Type pShowWindow;
extern SetWindowLong_Type pSetWindowLong;
extern GetWindowLong_Type pGetWindowLong;
extern SetWindowPos_Type pSetWindowPos;
extern DeferWindowPos_Type pDeferWindowPos;
extern CallWindowProc_Type pCallWindowProc;
extern ScaleWindowExtEx_Type pScaleWindowExtEx;
extern GDIChoosePixelFormat_Type pGDIChoosePixelFormat;
extern GDIGetPixelFormat_Type pGDIGetPixelFormat;
extern GDISetPixelFormat_Type pGDISetPixelFormat;
//extern CreateRectRgn_Type pCreateRectRgn;
extern DefWindowProc_Type pDefWindowProc;
extern ChangeDisplaySettings_Type pChangeDisplaySettings;
extern ChangeDisplaySettingsEx_Type pChangeDisplaySettingsEx;
extern EnumDisplaySettings_Type pEnumDisplaySettings;
extern SetWindowPlacement_Type pSetWindowPlacement;
extern CreateCompatibleDC_Type pCreateCompatibleDC;
extern DeleteDC_Type pDeleteDC;
extern BitBlt_Type pBitBlt;
extern PatBlt_Type pPatBlt;
extern StretchBlt_Type pStretchBlt;
extern CreateDC_Type pCreateDC;
extern SaveDC_Type pGDISaveDC;
extern RestoreDC_Type pGDIRestoreDC;
extern MapWindowPoints_Type pMapWindowPoints;
/* ===================================================================
hooked APIs real pointers
====================================================================*/
extern LoadLibraryA_Type pLoadLibraryA;
extern LoadLibraryExA_Type pLoadLibraryExA;
extern GetClipCursor_Type pGetClipCursor;
extern RegisterClassExA_Type pRegisterClassExA;
extern ScreenToClient_Type pScreenToClient;
extern ClientToScreen_Type pClientToScreen;
extern GetClientRect_Type pGetClientRect;
extern GetWindowRect_Type pGetWindowRect;
extern PeekMessage_Type pPeekMessage;
extern GetMessage_Type pGetMessage;
extern DispatchMessage_Type pDispatchMessage;
extern GetProcAddress_Type pGetProcAddress;
//extern GetUpdateRect_Type pGetUpdateRect;
extern CreateDialogParam_Type pCreateDialogParam;
extern CreateDialogIndirectParam_Type pCreateDialogIndirectParam;
extern BeginPaint_Type pBeginPaint;
extern EndPaint_Type pEndPaint;
extern InvalidateRect_Type pInvalidateRect;
extern CoCreateInstance_Type pCoCreateInstance;
extern GDICreatePalette_Type pGDICreatePalette;
extern SelectPalette_Type pSelectPalette;
extern RealizePalette_Type pRealizePalette;
extern GetSystemPaletteEntries_Type pGetSystemPaletteEntries;
extern MoveWindow_Type pMoveWindow;
extern SetUnhandledExceptionFilter_Type pSetUnhandledExceptionFilter;
extern GetDiskFreeSpaceA_Type pGetDiskFreeSpaceA;
extern SetDeviceGammaRamp_Type pSetDeviceGammaRamp;
extern GetDeviceGammaRamp_Type pGetDeviceGammaRamp;
extern SendMessage_Type pSendMessage;
extern GetTickCount_Type pGetTickCount;
#ifdef DXWDECLARATIONS
#undef DXWEXTERN
#undef DXWINITIALIZED
#define DXWEXTERN
#define DXWINITIALIZED = NULL
#else
#undef DXWEXTERN
#undef DXWINITIALIZED
#define DXWEXTERN extern
#define DXWINITIALIZED
#endif
// GDI32.dll:
DXWEXTERN BitBlt_Type pGDIBitBlt DXWINITIALIZED;
DXWEXTERN CreateCompatibleDC_Type pGDICreateCompatibleDC DXWINITIALIZED;
DXWEXTERN CreateDC_Type pGDICreateDC DXWINITIALIZED;
DXWEXTERN CreateFont_Type pGDICreateFont DXWINITIALIZED;
DXWEXTERN CreateFontIndirect_Type pGDICreateFontIndirect DXWINITIALIZED;
DXWEXTERN GDICreatePalette_Type pGDICreatePalette DXWINITIALIZED;
DXWEXTERN DeferWindowPos_Type pGDIDeferWindowPos DXWINITIALIZED;
DXWEXTERN DeleteDC_Type pGDIDeleteDC DXWINITIALIZED;
DXWEXTERN GetDeviceCaps_Type pGDIGetDeviceCaps DXWINITIALIZED;
DXWEXTERN GetDeviceGammaRamp_Type pGDIGetDeviceGammaRamp DXWINITIALIZED;
DXWEXTERN GetSystemPaletteEntries_Type pGDIGetSystemPaletteEntries DXWINITIALIZED;
DXWEXTERN PatBlt_Type pGDIPatBlt DXWINITIALIZED;
DXWEXTERN RealizePalette_Type pGDIRealizePalette DXWINITIALIZED;
DXWEXTERN Rectangle_Type pGDIRectangle DXWINITIALIZED;
DXWEXTERN RestoreDC_Type pGDIRestoreDC DXWINITIALIZED;
DXWEXTERN SaveDC_Type pGDISaveDC DXWINITIALIZED;
DXWEXTERN ScaleWindowExtEx_Type pGDIScaleWindowExtEx DXWINITIALIZED;
DXWEXTERN SelectPalette_Type pGDISelectPalette DXWINITIALIZED;
DXWEXTERN SetBkColor_Type pGDISetBkColor DXWINITIALIZED;
DXWEXTERN SetDeviceGammaRamp_Type pGDISetDeviceGammaRamp DXWINITIALIZED;
DXWEXTERN SetTextColor_Type pGDISetTextColor DXWINITIALIZED;
DXWEXTERN StretchBlt_Type pGDIStretchBlt DXWINITIALIZED;
DXWEXTERN TextOut_Type pGDITextOutA DXWINITIALIZED;
// Kernel32.dll:
DXWEXTERN GetDiskFreeSpaceA_Type pGetDiskFreeSpaceA DXWINITIALIZED;
DXWEXTERN GetLocalTime_Type pGetLocalTime DXWINITIALIZED;
DXWEXTERN GetProcAddress_Type pGetProcAddress DXWINITIALIZED;
DXWEXTERN GetSystemTime_Type pGetSystemTime DXWINITIALIZED;
DXWEXTERN GetTickCount_Type pGetTickCount DXWINITIALIZED;
DXWEXTERN LoadLibraryA_Type pLoadLibraryA DXWINITIALIZED;
DXWEXTERN LoadLibraryExA_Type pLoadLibraryExA DXWINITIALIZED;
DXWEXTERN SetUnhandledExceptionFilter_Type pSetUnhandledExceptionFilter DXWINITIALIZED;
DXWEXTERN Sleep_Type pSleep DXWINITIALIZED;
DXWEXTERN SleepEx_Type pSleepEx DXWINITIALIZED;
// ole32.dll:
DXWEXTERN CoCreateInstance_Type pCoCreateInstance DXWINITIALIZED;
// user32.dll:
DXWEXTERN BeginPaint_Type pBeginPaint DXWINITIALIZED;
DXWEXTERN CallWindowProc_Type pCallWindowProc DXWINITIALIZED;
DXWEXTERN ChangeDisplaySettings_Type pChangeDisplaySettings DXWINITIALIZED;
DXWEXTERN ChangeDisplaySettingsEx_Type pChangeDisplaySettingsEx DXWINITIALIZED;
DXWEXTERN ClientToScreen_Type pClientToScreen DXWINITIALIZED;
DXWEXTERN ClipCursor_Type pClipCursor DXWINITIALIZED;
DXWEXTERN CreateDialogIndirectParam_Type pCreateDialogIndirectParam DXWINITIALIZED;
DXWEXTERN CreateDialogParam_Type pCreateDialogParam DXWINITIALIZED;
DXWEXTERN CreateWindowExA_Type pCreateWindowExA DXWINITIALIZED;
DXWEXTERN DefWindowProc_Type pDefWindowProc DXWINITIALIZED;
DXWEXTERN EndPaint_Type pEndPaint DXWINITIALIZED;
DXWEXTERN EnumDisplaySettings_Type pEnumDisplaySettings DXWINITIALIZED;
DXWEXTERN FillRect_Type pFillRect DXWINITIALIZED;
DXWEXTERN GetClientRect_Type pGetClientRect DXWINITIALIZED;
DXWEXTERN GetClipCursor_Type pGetClipCursor DXWINITIALIZED;
DXWEXTERN GetCursorPos_Type pGetCursorPos DXWINITIALIZED;
DXWEXTERN GDIGetDC_Type pGDIGetDC DXWINITIALIZED;
DXWEXTERN GetDesktopWindow_Type pGetDesktopWindow DXWINITIALIZED;
DXWEXTERN GetMessage_Type pGetMessage DXWINITIALIZED;
DXWEXTERN GetSystemMetrics_Type pGetSystemMetrics DXWINITIALIZED;
DXWEXTERN GDIGetDC_Type pGDIGetWindowDC DXWINITIALIZED;
DXWEXTERN GetWindowLong_Type pGetWindowLong DXWINITIALIZED;
DXWEXTERN GetWindowRect_Type pGetWindowRect DXWINITIALIZED;
DXWEXTERN InvalidateRect_Type pInvalidateRect DXWINITIALIZED;
DXWEXTERN MapWindowPoints_Type pMapWindowPoints DXWINITIALIZED;
DXWEXTERN MoveWindow_Type pMoveWindow DXWINITIALIZED;
DXWEXTERN PeekMessage_Type pPeekMessage DXWINITIALIZED;
DXWEXTERN RegisterClassExA_Type pRegisterClassExA DXWINITIALIZED;
DXWEXTERN GDIReleaseDC_Type pGDIReleaseDC DXWINITIALIZED;
DXWEXTERN ScreenToClient_Type pScreenToClient DXWINITIALIZED;
DXWEXTERN SendMessage_Type pSendMessage DXWINITIALIZED;
DXWEXTERN SetCursor_Type pSetCursor DXWINITIALIZED;
DXWEXTERN SetCursorPos_Type pSetCursorPos DXWINITIALIZED;
DXWEXTERN SetTimer_Type pSetTimer DXWINITIALIZED;
DXWEXTERN SetWindowLong_Type pSetWindowLong DXWINITIALIZED;
DXWEXTERN SetWindowPos_Type pSetWindowPos DXWINITIALIZED;
DXWEXTERN ShowCursor_Type pShowCursor DXWINITIALIZED;
DXWEXTERN ShowWindow_Type pShowWindow DXWINITIALIZED;
/* ===================================================================
hook procedures (possibly more tnan one per each API...)
====================================================================*/
// GDI32.dll:
extern BOOL WINAPI extGDIBitBlt(HDC, int, int, int, int, HDC, int, int, DWORD);
extern HDC WINAPI extGDICreateCompatibleDC(HDC);
extern HDC WINAPI extDDCreateCompatibleDC(HDC);
extern HDC WINAPI extGDICreateDC(LPSTR, LPSTR, LPSTR, CONST DEVMODE *);
extern HDC WINAPI extDDCreateDC(LPSTR, LPSTR, LPSTR, CONST DEVMODE *);
extern HFONT WINAPI extCreateFont(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCTSTR);
extern HFONT WINAPI extCreateFontIndirect(const LOGFONT*);
extern HPALETTE WINAPI extGDICreatePalette(CONST LOGPALETTE *);
extern HDWP WINAPI extDeferWindowPos(HDWP, HWND, HWND, int, int, int, int, UINT);
extern BOOL WINAPI extGDIDeleteDC(HDC);
extern BOOL WINAPI extDDDeleteDC(HDC);
extern int WINAPI extGetDeviceCaps(HDC, int);
extern BOOL WINAPI extGetDeviceGammaRamp(HDC, LPVOID);
extern UINT WINAPI extGetSystemPaletteEntries(HDC, UINT, UINT, LPPALETTEENTRY);
extern BOOL WINAPI extGDIPatBlt(HDC, int, int, int, int, DWORD);
extern BOOL WINAPI extDDBitBlt(HDC, int, int, int, int, HDC, int, int, DWORD);
extern UINT WINAPI extRealizePalette(HDC);
extern BOOL WINAPI extRectangle(HDC, int, int, int, int);
extern BOOL WINAPI extGDIRestoreDC(HDC, int);
extern int WINAPI extGDISaveDC(HDC);
extern BOOL WINAPI extScaleWindowExtEx(HDC, int, int, int, int, LPSIZE);
extern HPALETTE WINAPI extSelectPalette(HDC, HPALETTE, BOOL);
extern COLORREF WINAPI extSetBkColor(HDC, COLORREF);
extern BOOL WINAPI extSetDeviceGammaRamp(HDC, LPVOID);
extern COLORREF WINAPI extSetTextColor(HDC, COLORREF);
extern BOOL WINAPI extGDIStretchBlt(HDC, int, int, int, int, HDC, int, int, int, int, DWORD);
extern BOOL WINAPI extDDStretchBlt(HDC, int, int, int, int, HDC, int, int, int, int, DWORD);
extern BOOL WINAPI extTextOutA(HDC, int, int, LPCTSTR, int);
// Kernel32.dll:
extern BOOL WINAPI extGetDiskFreeSpaceA(LPCSTR, LPDWORD, LPDWORD, LPDWORD, LPDWORD);
extern void WINAPI extGetLocalTime(LPSYSTEMTIME);
extern FARPROC WINAPI extGetProcAddress(HMODULE, LPCSTR);
extern void WINAPI extGetSystemTime(LPSYSTEMTIME);
extern DWORD WINAPI extGetTickCount(void);
extern HMODULE WINAPI extLoadLibraryA(LPCTSTR);
extern HMODULE WINAPI extLoadLibraryExA(LPCTSTR, HANDLE, DWORD);
extern LPTOP_LEVEL_EXCEPTION_FILTER WINAPI extSetUnhandledExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER);
extern void WINAPI extSleep(DWORD);
extern DWORD WINAPI extSleepEx(DWORD, BOOL);
// ole32.dll:
extern HRESULT STDAPICALLTYPE extCoCreateInstance(REFCLSID, LPUNKNOWN, DWORD, REFIID, LPVOID FAR*);
// user32.dll:
extern HDC WINAPI extBeginPaint(HWND, LPPAINTSTRUCT);
extern LRESULT WINAPI extCallWindowProc(WNDPROC, HWND, UINT, WPARAM, LPARAM);
extern LONG WINAPI extChangeDisplaySettings(DEVMODE *, DWORD);
extern LONG WINAPI extChangeDisplaySettingsEx(LPCTSTR, DEVMODE *, HWND, DWORD, LPVOID);
extern BOOL WINAPI extClientToScreen(HWND, LPPOINT);
extern BOOL WINAPI extClipCursor(LPRECT);
extern HWND WINAPI extCreateDialogIndirectParam(HINSTANCE, LPCDLGTEMPLATE, HWND, DLGPROC, LPARAM);
extern HWND WINAPI extCreateDialogParam(HINSTANCE, LPCSTR, HWND, DLGPROC, LPARAM);
extern HWND WINAPI extCreateWindowExA(DWORD, LPCTSTR, LPCTSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID);
extern LRESULT WINAPI extDefWindowProc(HWND, UINT, WPARAM, LPARAM);
extern BOOL WINAPI extEndPaint(HWND, const PAINTSTRUCT *);
extern LONG WINAPI extEnumDisplaySettings(LPCTSTR, DWORD, DEVMODE *);
extern int WINAPI extFillRect(HDC, const RECT *, HBRUSH);
extern BOOL WINAPI extGetClientRect(HWND, LPRECT);
extern BOOL WINAPI extGetClipCursor(LPRECT);
extern BOOL WINAPI extGetCursorPos(LPPOINT);
extern HDC WINAPI extGDIGetDC(HWND);
extern HDC WINAPI extDDGetDC(HWND);
extern HWND WINAPI extGetDesktopWindow(void);
extern BOOL WINAPI extGetMessage(LPMSG, HWND, UINT, UINT);
extern int WINAPI extGetSystemMetrics(int);
extern HDC WINAPI extGDIGetWindowDC(HWND);
extern HDC WINAPI extDDGetWindowDC(HWND);
extern LONG WINAPI extGetWindowLong(HWND, int);
extern BOOL WINAPI extGetWindowRect(HWND, LPRECT);
extern BOOL WINAPI extInvalidateRect(HWND, RECT *, BOOL);
extern BOOL WINAPI extDDInvalidateRect(HWND, RECT *, BOOL);
extern int WINAPI extMapWindowPoints(HWND, HWND, LPPOINT, UINT);
extern BOOL WINAPI extMoveWindow(HWND, int, int, int, int, BOOL);
extern BOOL WINAPI extPeekMessage(LPMSG, HWND, UINT, UINT, UINT);
extern ATOM WINAPI extRegisterClassExA(WNDCLASSEXA *);
extern int WINAPI extDDReleaseDC(HWND, HDC);
extern int WINAPI extGDIReleaseDC(HWND, HDC);
extern BOOL WINAPI extScreenToClient(HWND, LPPOINT);
extern LRESULT WINAPI extSendMessage(HWND, UINT, WPARAM, LPARAM);
extern HCURSOR WINAPI extSetCursor(HCURSOR);
extern BOOL WINAPI extSetCursorPos(int, int);
extern UINT_PTR WINAPI extSetTimer(HWND, UINT_PTR, UINT, TIMERPROC);
extern LONG WINAPI extSetWindowLong(HWND, int, LONG);
extern BOOL WINAPI extSetWindowPos(HWND, HWND, int, int, int, int, UINT);
extern int WINAPI extShowCursor(BOOL);
extern BOOL WINAPI extShowWindow(HWND, int);
/* eof */

View File

@ -24,6 +24,7 @@
#define IDI_ICON3 148
#define IDI_RUN6 148
#define IDD_STATUS 149
#define IDD_TIMESLIDER 150
#define IDC_AUTO 300
#define IDC_DIRECTX1 301
#define IDC_DIRECTX7 302
@ -52,12 +53,14 @@
#define IDC_MODULE 1023
#define IDC_SNOOZE 1023
#define IDC_KILL 1024
#define IDC_OPENGLLIB 1024
#define IDC_AUTOREFRESH 1025
#define IDC_FIXWINFRAME 1026
#define IDC_HIDEHWCURSOR 1027
#define IDC_ENABLECLIPPING 1028
#define IDC_COUNTDOWN 1028
#define IDC_EDIT1 1029
#define IDC_SHOWHWCURSOR 1029
#define IDC_VIDEOTOSYSTEMMEM 1030
#define IDC_FIXTEXTOUT 1031
#define IDC_STATUSINFO 1031
@ -72,6 +75,7 @@
#define IDC_TITLE 1039
#define IDC_SLOW 1040
#define IDC_CLIPCURSOR 1041
#define IDC_INITTS 1042
#define IDC_CLIENTREMAPPING 1043
#define IDC_HANDLEALTF4 1044
#define IDC_LOCKWINPOS 1045
@ -109,7 +113,12 @@
#define IDC_SKIPFPS 1076
#define IDC_SHOWFPS 1077
#define IDC_HIDEMULTIMONITOR 1078
#define IDC_TIMESLIDER 1078
#define IDC_TIMESTRETCH 1079
#define IDC_TIMESPEED 1079
#define IDC_HOOKOPENGL 1080
#define IDC_WALLPAPERMODE 1081
#define IDC_HOOKGDI 1082
#define ID_MODIFY 32771
#define ID_DELETE 32772
#define ID_ADD 32773
@ -138,15 +147,16 @@
#define ID_VIEW_STATUS 32809
#define ID_DXAPP_EXIT 32810
#define ID_SAVEFILE 32810
#define ID_VIEW_TIMESLIDER 32811
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 150
#define _APS_NEXT_COMMAND_VALUE 32811
#define _APS_NEXT_CONTROL_VALUE 1078
#define _APS_NEXT_RESOURCE_VALUE 151
#define _APS_NEXT_COMMAND_VALUE 32812
#define _APS_NEXT_CONTROL_VALUE 1080
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -38,9 +38,12 @@ void CStatusDialog::OnTimer(UINT_PTR nIDEvent)
int IconId;
LPCSTR Status;
char sMsg[1024];
char sMsgBuf[80+1];
char DllVersion[21];
DXWNDSTATUS DxWndStatus;
extern PRIVATEMAP *pTitles;
extern TARGETMAP *pTargets;
TARGETMAP *Target;
CDialog::OnTimer(nIDEvent);
DxStatus=GetHookStatus(NULL);
@ -53,19 +56,32 @@ void CStatusDialog::OnTimer(UINT_PTR nIDEvent)
GetDllVersion(DllVersion);
DxWndStatus.Status=DxStatus;
if(DxStatus==DXW_RUNNING){
int idx;
char *sTSCaption[9]={"x16","x8","x4","x2","x1",":2",":4",":8",":16"};
GetHookStatus(&DxWndStatus);
Target=&pTargets[DxWndStatus.TaskIdx];
sprintf_s(sMsg, 1024,
"DxWnd %s\nHook status: %s\n"
"Running \"%s\"\nScreen = (%dx%d) %dBPP\n"
"FullScreen = %s\nDX version = %d\n"
"Logging = %s\n"
"FPS = %d",
DllVersion, Status,
pTitles[DxWndStatus.TaskIdx].title,
DxWndStatus.Width, DxWndStatus.Height, DxWndStatus.ColorDepth,
DxWndStatus.IsFullScreen ? "Yes":"No", DxWndStatus.DXVersion,
DxWndStatus.isLogging?"ON":"OFF",
DxWndStatus.FPSCount);
"Logging = %s",
DllVersion, Status,
pTitles[DxWndStatus.TaskIdx].title,
DxWndStatus.Width, DxWndStatus.Height, DxWndStatus.ColorDepth,
DxWndStatus.IsFullScreen ? "Yes":"No", DxWndStatus.DXVersion,
DxWndStatus.isLogging?"ON":"OFF");
if(Target->flags2 & SHOWFPS){
sprintf(sMsgBuf, "\nFPS = %d", DxWndStatus.FPSCount);
strcat(sMsg, sMsgBuf);
}
if(Target->flags2 & TIMESTRETCH){
idx=DxWndStatus.iTimeShift+4;
if(idx>=0 && idx<=8){
sprintf(sMsgBuf, "\nTime speed: %s", sTSCaption[DxWndStatus.iTimeShift+4]);
strcat(sMsg, sMsgBuf);
}
}
}
else
sprintf_s(sMsg, 1024, "DxWnd %s\nHook status: %s", DllVersion, Status);

View File

@ -13,6 +13,7 @@ public:
// Dialog Data
enum { IDD = IDD_STATUS };
int iTimeSlider;
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support

View File

@ -46,6 +46,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_AutoRefresh = FALSE;
m_FixWinFrame = FALSE;
m_HideHwCursor = FALSE;
m_ShowHwCursor = FALSE;
m_EnableClipping = FALSE;
m_CursorClipping = FALSE;
m_VideoToSystemMem = FALSE;
@ -63,7 +64,9 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_ModalStyle = FALSE;
m_KeepAspectRatio = FALSE;
m_ForceWinResize = FALSE;
m_HookGDI = FALSE;
m_HideMultiMonitor = FALSE;
m_WallpaperMode = FALSE;
m_HookChildWin = FALSE;
m_MessageProc = FALSE;
m_FixNCHITTEST = FALSE;
@ -77,6 +80,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_SkipFPS = FALSE;
m_ShowFPS = FALSE;
m_TimeStretch = FALSE;
m_HookOpenGL = FALSE;
m_InitX = 0;
m_InitY = 0;
m_MaxX = 0;
@ -88,6 +92,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_SizX = 800;
m_SizY = 600;
m_MaxFPS = 0;
m_InitTS = 0;
//}}AFX_DATA_INIT
}
@ -126,6 +131,7 @@ void CTargetDlg::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_AUTOREFRESH, m_AutoRefresh);
DDX_Check(pDX, IDC_FIXWINFRAME, m_FixWinFrame);
DDX_Check(pDX, IDC_HIDEHWCURSOR, m_HideHwCursor);
DDX_Check(pDX, IDC_SHOWHWCURSOR, m_ShowHwCursor);
DDX_Check(pDX, IDC_ENABLECLIPPING, m_EnableClipping);
DDX_Check(pDX, IDC_CLIPCURSOR, m_CursorClipping);
DDX_Check(pDX, IDC_VIDEOTOSYSTEMMEM, m_VideoToSystemMem);
@ -143,7 +149,9 @@ void CTargetDlg::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_MODALSTYLE, m_ModalStyle);
DDX_Check(pDX, IDC_KEEPASPECTRATIO, m_KeepAspectRatio);
DDX_Check(pDX, IDC_FORCEWINRESIZE, m_ForceWinResize);
DDX_Check(pDX, IDC_HOOKGDI, m_HookGDI);
DDX_Check(pDX, IDC_HIDEMULTIMONITOR, m_HideMultiMonitor);
DDX_Check(pDX, IDC_WALLPAPERMODE, m_WallpaperMode);
DDX_Check(pDX, IDC_HOOKCHILDWIN, m_HookChildWin);
DDX_Check(pDX, IDC_MESSAGEPROC, m_MessageProc);
DDX_Check(pDX, IDC_FIXNCHITTEST, m_FixNCHITTEST);
@ -157,6 +165,7 @@ void CTargetDlg::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_SKIPFPS, m_SkipFPS);
DDX_Check(pDX, IDC_SHOWFPS, m_ShowFPS);
DDX_Check(pDX, IDC_TIMESTRETCH, m_TimeStretch);
DDX_Check(pDX, IDC_HOOKOPENGL, m_HookOpenGL);
DDX_Text(pDX, IDC_INITX, m_InitX);
DDX_Text(pDX, IDC_INITY, m_InitY);
DDX_Text(pDX, IDC_MAXX, m_MaxX);
@ -168,6 +177,7 @@ void CTargetDlg::DoDataExchange(CDataExchange* pDX)
DDX_Text(pDX, IDC_SIZX, m_SizX);
DDX_Text(pDX, IDC_SIZY, m_SizY);
DDX_Text(pDX, IDC_MAXFPS, m_MaxFPS);
DDX_Text(pDX, IDC_INITTS, m_InitTS);
//}}AFX_DATA_MAP
}
@ -189,7 +199,7 @@ BEGIN_MESSAGE_MAP(CTargetDlg, CDialog)
//ON_BN_CLICKED(IDC_ABSOLUTECOORD, &CTargetDlg::OnBnClickedAbsolutecoord)
ON_BN_CLICKED(IDC_AUTOREFRESH, &CTargetDlg::OnBnClickedAutorefresh)
ON_BN_CLICKED(IDC_FIXWINFRAME, &CTargetDlg::OnBnClickedFixWinFrame)
ON_BN_CLICKED(IDC_HIDEHWCURSOR, &CTargetDlg::OnBnClickedHideHwCursor)
//ON_BN_CLICKED(IDC_HIDEHWCURSOR, &CTargetDlg::OnBnClickedHideHwCursor)
ON_BN_CLICKED(IDC_ENABLECLIPPING, &CTargetDlg::OnBnClickedEnableClipping)
ON_BN_CLICKED(IDC_VIDEOTOSYSTEMMEM, &CTargetDlg::OnBnClickedHandleCursorPos)
ON_BN_CLICKED(IDC_FIXTEXTOUT, &CTargetDlg::OnBnClickedFixTextOut)
@ -298,10 +308,10 @@ void CTargetDlg::OnBnClickedFixWinFrame()
// TODO: Add your control notification handler code here
}
void CTargetDlg::OnBnClickedHideHwCursor()
{
// TODO: Add your control notification handler code here
}
//void CTargetDlg::OnBnClickedHideHwCursor()
//{
// // TODO: Add your control notification handler code here
//}
void CTargetDlg::OnBnClickedEnableClipping()
{

View File

@ -41,6 +41,7 @@ public:
CString m_FilePath;
CString m_Module;
CString m_Title;
CString m_OpenGLLib;
BOOL m_SaveLoad;
BOOL m_SlowDown;
BOOL m_BlitFromBackBuffer;
@ -49,6 +50,7 @@ public:
BOOL m_AutoRefresh;
BOOL m_FixWinFrame;
BOOL m_HideHwCursor;
BOOL m_ShowHwCursor;
BOOL m_EnableClipping;
BOOL m_CursorClipping;
BOOL m_VideoToSystemMem;
@ -66,7 +68,9 @@ public:
BOOL m_ModalStyle;
BOOL m_KeepAspectRatio;
BOOL m_ForceWinResize;
BOOL m_HookGDI;
BOOL m_HideMultiMonitor;
BOOL m_WallpaperMode;
BOOL m_HookChildWin;
BOOL m_MessageProc;
BOOL m_FixNCHITTEST;
@ -81,6 +85,7 @@ public:
BOOL m_LimitFPS;
BOOL m_ShowFPS;
BOOL m_TimeStretch;
BOOL m_HookOpenGL;
int m_InitX;
int m_InitY;
int m_MaxX;
@ -92,6 +97,7 @@ public:
int m_SizX;
int m_SizY;
int m_MaxFPS;
int m_InitTS;
//}}AFX_DATA
@ -121,7 +127,7 @@ public:
afx_msg void OnEnChangeFile2();
afx_msg void OnBnClickedAutorefresh();
afx_msg void OnBnClickedFixWinFrame();
afx_msg void OnBnClickedHideHwCursor();
//afx_msg void OnBnClickedHideHwCursor();
afx_msg void OnBnClickedEnableClipping();
afx_msg void OnBnClickedHandleCursorPos();
afx_msg void OnBnClickedFixTextOut();

29
host/TimeSliderDialog.h Normal file
View File

@ -0,0 +1,29 @@
#pragma once
// CTimeSlider dialog
class CTimeSliderDialog : public CDialog
{
DECLARE_DYNAMIC(CTimeSliderDialog)
public:
CTimeSliderDialog(CWnd* pParent = NULL); // standard constructor
virtual ~CTimeSliderDialog();
// Dialog Data
enum { IDD = IDD_TIMESLIDER };
//CSliderCtrl m_TimeSlider;
int i_TimeSlider;
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnTimer(UINT_PTR nIDEvent);
public:
virtual BOOL OnInitDialog();
protected:
virtual void OnOK();
};

106
host/TimeSliderDlg.cpp Normal file
View File

@ -0,0 +1,106 @@
// TimeSliderDialog.cpp : implementation file
//
#include "stdafx.h"
#include "dxwndhost.h"
#include "TimeSliderDialog.h"
// CTimeSliderDialog dialog
IMPLEMENT_DYNAMIC(CTimeSliderDialog, CDialog)
CTimeSliderDialog::CTimeSliderDialog(CWnd* pParent /*=NULL*/)
: CDialog(CTimeSliderDialog::IDD, pParent)
{
//m_TimeSlider.SetRange(-4, +4, TRUE);
}
CTimeSliderDialog::~CTimeSliderDialog()
{
}
void CTimeSliderDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTargetDlg)
DDX_Slider(pDX, IDC_TIMESLIDER, i_TimeSlider);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTimeSliderDialog, CDialog)
ON_WM_TIMER()
END_MESSAGE_MAP()
#define IDTIMER 1
// CTimeSliderDialog message handlers
void CTimeSliderDialog::OnTimer(UINT_PTR nIDEvent)
{
DXWNDSTATUS Status;
CSliderCtrl *Slider;
CStatic *Text;
char *sTSCaption[9]={"x16","x8","x4","x2","x1",":2",":4",":8",":16"};
char sMsg[81];
static int iLastPos=-1;
Slider=(CSliderCtrl *)this->GetDlgItem(IDC_TIMESLIDER);
Text=(CStatic *)this->GetDlgItem(IDC_TIMESPEED);
CDialog::OnTimer(nIDEvent);
i_TimeSlider=Slider->GetPos();
if(GetHookStatus(&Status)!=DXW_RUNNING) {
Slider->SetPos(0);
Text->SetWindowTextA("idle");
return;
}
if(i_TimeSlider==iLastPos){
// no change, check for keyboard input changes
i_TimeSlider=Status.iTimeShift;
if(i_TimeSlider != iLastPos) Slider->SetPos(i_TimeSlider);
}
else {
// slider position changed, set the new value
if (i_TimeSlider < -4) i_TimeSlider=-4;
if (i_TimeSlider > 4) i_TimeSlider=4;
Status.iTimeShift=i_TimeSlider;
SetHookStatus(&Status);
}
iLastPos = i_TimeSlider;
sprintf(sMsg, "Time speed: %s", sTSCaption[i_TimeSlider+4]);
Text->SetWindowTextA(sMsg);
}
BOOL CTimeSliderDialog::OnInitDialog()
{
CSliderCtrl *Slider;
CDialog::OnInitDialog();
DXWNDSTATUS Status;
GetHookStatus(&Status);
Slider=(CSliderCtrl *)this->GetDlgItem(IDC_TIMESLIDER);
Slider->SetRange(-4, +4, 0);
Slider->SetTicFreq(1);
Slider->SetPos(Status.iTimeShift);
SetTimer(IDTIMER, 1000, NULL);
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
void CTimeSliderDialog::OnOK()
{
// TODO: Add your specialized code here and/or call the base class
KillTimer(IDTIMER);
// stop timer
DXWNDSTATUS Status;
GetHookStatus(&Status);
Status.iTimeShift=i_TimeSlider;
SetHookStatus(&Status);
CDialog::OnOK();
}

Binary file not shown.

View File

@ -112,6 +112,7 @@ BEGIN
POPUP "View"
BEGIN
MENUITEM "Status", ID_VIEW_STATUS
MENUITEM "Time Slider", ID_VIEW_TIMESLIDER
END
END
@ -189,7 +190,7 @@ BEGIN
DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
END
IDD_TARGET DIALOGEX 0, 0, 551, 225
IDD_TARGET DIALOGEX 0, 0, 675, 225
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Target"
FONT 9, "Arial", 400, 0, 0x0
@ -202,60 +203,60 @@ BEGIN
CONTROL "DirectX8",IDC_DIRECTX8,"Button",BS_AUTORADIOBUTTON,14,114,41,10
CONTROL "DirectX9",IDC_DIRECTX9,"Button",BS_AUTORADIOBUTTON,14,124,40,10
CONTROL "None/OpenGL",IDC_NODIRECTX,"Button",BS_AUTORADIOBUTTON,14,134,61,10
CONTROL "Do not notify on task switch",IDC_UNNOTIFY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,124,106,10
CONTROL "Do not notify on task switch",IDC_UNNOTIFY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,134,106,10
CONTROL "None",IDC_NOEMULATESURFACE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,14,158,66,10
CONTROL "Primary Surface",IDC_EMULATESURFACE,"Button",BS_AUTORADIOBUTTON,14,178,66,10
CONTROL "Primary Buffer",IDC_EMULATEBUFFER,"Button",BS_AUTORADIOBUTTON,14,168,67,10
CONTROL "DirectInput Hooking",IDC_HOOKDI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,114,83,10
CONTROL "Correct mouse position",IDC_MODIFYMOUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,24,97,10
CONTROL "DirectInput Hooking",IDC_HOOKDI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,124,83,10
CONTROL "Correct mouse position",IDC_MODIFYMOUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,34,97,10
CONTROL "DxWnd",IDC_OUTTRACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,97,114,62,10
CONTROL "Optimize CPU (DirectX1 - 7)",IDC_SAVELOAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,134,105,10
DEFPUSHBUTTON "OK",IDOK,505,194,40,14
PUSHBUTTON "Cancel",IDCANCEL,460,194,40,14
CONTROL "Optimize CPU (DirectX1 - 7)",IDC_SAVELOAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,144,105,10
DEFPUSHBUTTON "OK",IDOK,629,204,40,14
PUSHBUTTON "Cancel",IDCANCEL,568,204,40,14
GROUPBOX "DirectX Version Hook",IDC_STATIC,7,75,77,72,WS_GROUP
LTEXT "DirectInput initial coord. and X,Y range",IDC_STATIC,306,195,125,8
LTEXT "X",IDC_STATIC,301,208,8,8
LTEXT "Y",IDC_STATIC,324,208,8,8
LTEXT "(",IDC_STATIC,349,208,8,8
LTEXT ",",IDC_STATIC,369,208,8,8
LTEXT ")-(",IDC_STATIC,388,208,9,8
LTEXT ",",IDC_STATIC,413,208,8,8
LTEXT ")",IDC_STATIC,432,208,8,8
EDITTEXT IDC_INITX,307,206,14,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
EDITTEXT IDC_INITY,329,206,14,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
EDITTEXT IDC_MINX,352,206,14,12,ES_AUTOHSCROLL,WS_EX_RIGHT
EDITTEXT IDC_MINY,373,206,14,12,ES_AUTOHSCROLL,WS_EX_RIGHT
EDITTEXT IDC_MAXX,396,206,14,12,ES_AUTOHSCROLL,WS_EX_RIGHT
EDITTEXT IDC_MAXY,417,206,14,12,ES_AUTOHSCROLL,WS_EX_RIGHT
CONTROL "Handle DC",IDC_HANDLEDC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,34,67,10
LTEXT "DirectInput initial coord. and X,Y range",IDC_STATIC,430,195,125,8
LTEXT "X",IDC_STATIC,425,208,8,8
LTEXT "Y",IDC_STATIC,448,208,8,8
LTEXT "(",IDC_STATIC,473,208,8,8
LTEXT ",",IDC_STATIC,493,208,8,8
LTEXT ")-(",IDC_STATIC,512,208,9,8
LTEXT ",",IDC_STATIC,537,208,8,8
LTEXT ")",IDC_STATIC,556,208,8,8
EDITTEXT IDC_INITX,431,206,14,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
EDITTEXT IDC_INITY,453,206,14,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
EDITTEXT IDC_MINX,476,206,14,12,ES_AUTOHSCROLL,WS_EX_RIGHT
EDITTEXT IDC_MINY,497,206,14,12,ES_AUTOHSCROLL,WS_EX_RIGHT
EDITTEXT IDC_MAXX,520,206,14,12,ES_AUTOHSCROLL,WS_EX_RIGHT
EDITTEXT IDC_MAXY,541,206,14,12,ES_AUTOHSCROLL,WS_EX_RIGHT
CONTROL "Handle DC",IDC_HANDLEDC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,24,67,10
EDITTEXT IDC_MODULE,7,60,139,12,ES_AUTOHSCROLL
CONTROL "Auto Primary Surface Refresh",IDC_AUTOREFRESH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,44,108,8
CONTROL "Auto Primary Surface Refresh",IDC_AUTOREFRESH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,34,108,8
CONTROL "Fix Window Frame Style",IDC_FIXWINFRAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,433,14,103,9
CONTROL "Hide Cursor",IDC_HIDEHWCURSOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,14,100,9
CONTROL "Intercept GDI Cursor Clipping",IDC_ENABLECLIPPING,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,64,106,9
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,74,106,9
LTEXT "Hooked Module:",IDC_STATIC,7,51,66,8
GROUPBOX "Cursor handling",IDC_STATIC,298,3,120,95
GROUPBOX "Surface handling",IDC_STATIC,172,3,120,138
GROUPBOX "Cursor handling",IDC_STATIC,298,3,120,105
GROUPBOX "DirectDraw Surface handling",IDC_STATIC,172,3,120,138
CONTROL "VIDEO->SYSTEM surf. on fail",IDC_VIDEOTOSYSTEMMEM,
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,180,64,108,8
CONTROL "Fix TextOutA placement",IDC_FIXTEXTOUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,24,107,9
GROUPBOX "Generic",IDC_STATIC,299,101,120,88
CONTROL "Keep cursor within window",IDC_KEEPCURSORWITHIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,44,105,9
CONTROL "Set 16BPP RGB565 encoding",IDC_USERGB565,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,54,108,8
CONTROL "Suppress DX common errors",IDC_SUPPRESSDXERRORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,74,109,9
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,180,54,108,8
CONTROL "Fix TextOutA placement",IDC_FIXTEXTOUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,164,107,9
GROUPBOX "Generic",IDC_STATIC,299,111,120,89
CONTROL "Keep cursor within window",IDC_KEEPCURSORWITHIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,54,105,9
CONTROL "Set 16BPP RGB565 encoding",IDC_USERGB565,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,44,108,8
CONTROL "Suppress DX common errors",IDC_SUPPRESSDXERRORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,64,109,9
CONTROL "Prevent Win Maximize",IDC_PREVENTMAXIMIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,433,24,98,9
GROUPBOX "Trace",IDC_STATIC,90,75,74,115
CONTROL "Win Events",IDC_OUTWINMESSAGES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,97,124,62,10
CONTROL "DirectX ",IDC_OUTDXTRACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,97,134,62,10
EDITTEXT IDC_TITLE,7,12,139,12,ES_AUTOHSCROLL
LTEXT "Path:",IDC_STATIC,7,27,66,8
LTEXT "Name:",IDC_STATIC,7,1,66,8
CONTROL "Slow down",IDC_SLOW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,144,88,10
CONTROL "Force cursor clipping",IDC_CLIPCURSOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,34,107,9
CONTROL "Remap GDI Client Rect",IDC_CLIENTREMAPPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,84,102,9
CONTROL "Intercept Alt-F4 key",IDC_HANDLEALTF4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,154,93,10
GROUPBOX "Windows handling",IDC_STATIC,425,3,120,156
LTEXT "Name:",IDC_STATIC,7,3,66,8
CONTROL "Slow down",IDC_SLOW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,154,88,10
CONTROL "Force cursor clipping",IDC_CLIPCURSOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,44,107,9
CONTROL "Remap Client Rect",IDC_CLIENTREMAPPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,74,102,9
CONTROL "Intercept Alt-F4 key",IDC_HANDLEALTF4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,164,93,10
GROUPBOX "Windows handling",IDC_STATIC,424,3,120,167
CONTROL "Lock win coordinates",IDC_LOCKWINPOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,433,34,98,9
CONTROL "Hook CHILD windows",IDC_HOOKCHILDWIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,433,54,98,9
LTEXT "Window initial position && size",IDC_STATIC,12,195,98,8
@ -267,41 +268,77 @@ BEGIN
EDITTEXT IDC_POSY,40,206,16,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
EDITTEXT IDC_SIZX,65,206,16,12,ES_AUTOHSCROLL,WS_EX_RIGHT
EDITTEXT IDC_SIZY,90,206,16,12,ES_AUTOHSCROLL,WS_EX_RIGHT
CONTROL "Message processing",IDC_MESSAGEPROC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,74,98,9
CONTROL "Message processing",IDC_MESSAGEPROC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,84,98,9
CONTROL "Map GDI HDC to Primary DC",IDC_MAPGDITOPRIMARY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,14,102,9
CONTROL "Recover screen mode",IDC_RECOVERSCREENMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,433,64,98,9
CONTROL "Refresh on win resize",IDC_REFRESHONRESIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,433,74,98,9
CONTROL "Make Backbuf attachable",IDC_BACKBUFATTACH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,94,102,9
CONTROL "Make Backbuf attachable",IDC_BACKBUFATTACH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,84,102,9
CONTROL "ddraw Proxy",IDC_DXPROXED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,97,94,62,10
CONTROL "Assert Dialog",IDC_ASSERT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,97,104,62,10
CONTROL "Simulate 8BPP desktop",IDC_INIT8BPP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,433,84,98,9
CONTROL "Simulate 16BPP desktop",IDC_INIT16BPP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,433,94,98,9
CONTROL "Keep cursor fixed",IDC_KEEPCURSORFIXED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,54,105,9
CONTROL "Keep cursor fixed",IDC_KEEPCURSORFIXED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,64,105,9
CONTROL "Lock win style",IDC_LOCKWINSTYLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,433,44,98,9
CONTROL "Enable Trace",IDC_LOGENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,97,84,62,10
CONTROL "Cursor/Mouse",IDC_CURSORTRACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,97,144,62,10
CONTROL "Import Table",IDC_IMPORTTABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,97,154,62,10
CONTROL "Handle Exceptions",IDC_HANDLEEXCEPTIONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,164,93,10
CONTROL "Handle Exceptions",IDC_HANDLEEXCEPTIONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,174,93,10
CONTROL "Fix Parent Window",IDC_FIXPARENTWIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,433,104,98,9
CONTROL "Debug",IDC_OUTDEBUG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,97,164,62,10
CONTROL "Blit from BackBuffer",IDC_BLITFROMBACKBUFFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,104,102,9
CONTROL "Blit from BackBuffer",IDC_BLITFROMBACKBUFFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,94,102,9
GROUPBOX "Emulation",IDC_STATIC,7,149,78,42,WS_GROUP
CONTROL "Suppress clipping",IDC_SUPPRESSCLIPPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,114,102,9
CONTROL "Suppress clipping",IDC_SUPPRESSCLIPPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,104,102,9
CONTROL "Modal Style",IDC_MODALSTYLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,433,114,98,9
CONTROL "Keep aspect ratio",IDC_KEEPASPECTRATIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,433,124,98,9
CONTROL "Limit available resources",IDC_LIMITRESOURCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,174,93,10
CONTROL "Limit available resources",IDC_LIMITRESOURCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,184,93,10
CONTROL "Force win resize",IDC_FORCEWINRESIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,433,134,98,9
CONTROL "Disable setting gamma ramp",IDC_DISABLEGAMMARAMP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,124,102,9
CONTROL "fix WM_NCHITTEST",IDC_FIXNCHITTEST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,84,98,9
CONTROL "Limit",IDC_LIMITFPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,154,28,9
EDITTEXT IDC_MAXFPS,258,157,26,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
CONTROL "Skip",IDC_SKIPFPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,164,27,9
LTEXT "delay (msec)",IDC_STATIC,214,159,43,8
GROUPBOX "Frame per Second",IDC_STATIC,172,142,121,58
CONTROL "Show FPS",IDC_SHOWFPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,176,52,9
GROUPBOX "",IDC_STATIC,178,150,110,24
CONTROL "fix WM_NCHITTEST",IDC_FIXNCHITTEST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,94,98,9
CONTROL "Limit",IDC_LIMITFPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,557,123,28,9
EDITTEXT IDC_MAXFPS,635,126,26,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
CONTROL "Skip",IDC_SKIPFPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,557,133,27,9
LTEXT "delay (msec)",IDC_STATIC,591,128,43,8
GROUPBOX "Frame per Second",IDC_STATIC,549,111,120,58
CONTROL "Show FPS",IDC_SHOWFPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,557,145,52,9
GROUPBOX "",IDC_STATIC,555,119,110,24
CONTROL "Hide multi-monitor config.",IDC_HIDEMULTIMONITOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,433,144,98,9
CONTROL "Time Stretch",IDC_TIMESTRETCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,186,52,9
CONTROL "Time Stretch - init val:",IDC_TIMESTRETCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,557,155,75,9
GROUPBOX "OpenGL",IDC_STATIC,549,3,120,50
CONTROL "Hook OpenGL",IDC_HOOKOPENGL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,557,14,98,9
EDITTEXT IDC_OPENGLLIB,554,36,108,12,ES_AUTOHSCROLL
LTEXT "Custom OpenGL library",IDC_STATIC,566,26,94,8
CONTROL "Show Cursor",IDC_SHOWHWCURSOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,24,100,9
CONTROL "Wallpaper mode",IDC_WALLPAPERMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,433,154,98,9
GROUPBOX "GDI Handling",IDC_STATIC,172,144,120,62
CONTROL "Hook GDI",IDC_HOOKGDI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,154,102,9
CONTROL "Disable setting gamma ramp",IDC_DISABLEGAMMARAMP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,174,102,9
EDITTEXT IDC_INITTS,635,152,14,12,ES_AUTOHSCROLL,WS_EX_RIGHT
END
IDD_STATUS DIALOGEX 0, 0, 186, 95
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "DxWnd Status"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "Wait ...",IDC_STATUSINFO,2,2,182,91,SS_SUNKEN
END
IDD_TIMESLIDER DIALOGEX 0, 0, 168, 65
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Time Slider"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,111,44,50,14
CONTROL "",IDC_TIMESLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TRANSPARENTBKGND | WS_TABSTOP,7,7,154,18,WS_EX_TRANSPARENT
LTEXT "Time shift:",IDC_TIMESPEED,7,43,64,15
LTEXT "x16",IDC_STATIC,7,31,15,9
LTEXT "x8",IDC_STATIC,30,30,15,9
LTEXT "x4",IDC_STATIC,47,30,15,9
LTEXT "x2",IDC_STATIC,63,30,15,9
LTEXT "x1",IDC_STATIC,81,30,15,9
LTEXT ":2",IDC_STATIC,99,30,15,9
LTEXT ":4",IDC_STATIC,115,30,15,9
LTEXT ":8",IDC_STATIC,132,30,15,9
LTEXT ":16",IDC_STATIC,149,30,15,9
END
@ -362,11 +399,27 @@ BEGIN
IDD_TARGET, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 545
TOPMARGIN, 7
RIGHTMARGIN, 669
TOPMARGIN, 3
BOTTOMMARGIN, 218
HORZGUIDE, 91
END
IDD_STATUS, DIALOG
BEGIN
LEFTMARGIN, 2
RIGHTMARGIN, 184
TOPMARGIN, 2
BOTTOMMARGIN, 93
END
IDD_TIMESLIDER, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 161
TOPMARGIN, 7
BOTTOMMARGIN, 58
END
END
#endif // APSTUDIO_INVOKED
@ -494,39 +547,6 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_STATUS DIALOGEX 0, 0, 186, 95
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "DxWnd Status"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "Wait ...",IDC_STATUSINFO,2,2,182,91,SS_SUNKEN
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_STATUS, DIALOG
BEGIN
LEFTMARGIN, 2
RIGHTMARGIN, 184
TOPMARGIN, 2
BOTTOMMARGIN, 93
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon

View File

@ -1,20 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dxwndhost", "dxwndhost.vcproj", "{FD0B0234-8EC5-43C0-A384-1B881DD3D925}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Debug|Win32.ActiveCfg = Debug|Win32
{FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Debug|Win32.Build.0 = Debug|Win32
{FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Release|Win32.ActiveCfg = Release|Win32
{FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Binary file not shown.

Binary file not shown.

View File

@ -372,6 +372,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\TimeSliderDlg.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
@ -413,6 +417,10 @@
RelativePath="TargetDlg.h"
>
</File>
<File
RelativePath=".\TimeSliderDialog.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"

View File

@ -13,6 +13,7 @@
#include "TargetDlg.h"
#include "SystemTray.h"
#include "StatusDialog.h"
#include "TimeSliderDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
@ -26,6 +27,7 @@ extern UINT m_StartToTray;
extern UINT m_InitialState;
extern char m_ConfigFileName[20+1];
PRIVATEMAP *pTitles; // global ptr: get rid of it!!
TARGETMAP *pTargets; // idem.
/////////////////////////////////////////////////////////////////////////////
// CDxwndhostView
@ -54,6 +56,7 @@ BEGIN_MESSAGE_MAP(CDxwndhostView, CListView)
ON_COMMAND(ID_RUN, OnRun)
ON_COMMAND(ID_TRAY_RESTORE, OnTrayRestore)
ON_COMMAND(ID_VIEW_STATUS, OnViewStatus)
ON_COMMAND(ID_VIEW_TIMESLIDER, OnViewTimeSlider)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@ -106,6 +109,8 @@ void CDxwndhostView::SaveConfigFile()
WritePrivateProfileString("target", key, TargetMaps[i].path, InitPath);
sprintf_s(key, sizeof(key), "module%i", i);
WritePrivateProfileString("target", key, TargetMaps[i].module, InitPath);
sprintf_s(key, sizeof(key), "opengllib%i", i);
WritePrivateProfileString("target", key, TargetMaps[i].OpenGLLib, InitPath);
sprintf_s(key, sizeof(key), "ver%i", i);
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].dxversion);
WritePrivateProfileString("target", key, val, InitPath);
@ -147,9 +152,13 @@ void CDxwndhostView::SaveConfigFile()
WritePrivateProfileString("target", key, val, InitPath);
sprintf_s(key, sizeof(key), "sizy%i", i);
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].sizy);
WritePrivateProfileString("target", key, val, InitPath);
sprintf_s(key, sizeof(key), "maxfps%i", i);
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].MaxFPS);
WritePrivateProfileString("target", key, val, InitPath);
sprintf_s(key, sizeof(key), "initts%i", i);
sprintf_s(val, sizeof(val), "%i", TargetMaps[i].InitTS);
WritePrivateProfileString("target", key, val, InitPath);
}
for(; i < MAXTARGETS; i ++){
sprintf_s(key, sizeof(key), "path%i", i);
@ -184,6 +193,8 @@ void CDxwndhostView::SaveConfigFile()
WritePrivateProfileString("target", key, 0, InitPath);
sprintf_s(key, sizeof(key), "maxfps%i", i);
WritePrivateProfileString("target", key, 0, InitPath);
sprintf_s(key, sizeof(key), "initts%i", i);
WritePrivateProfileString("target", key, 0, InitPath);
}
this->isUpdated=FALSE;
@ -260,6 +271,8 @@ void CDxwndhostView::OnInitialUpdate()
GetPrivateProfileString("target", key, "", TitleMaps[i].title, sizeof(TitleMaps[i].title)-1, InitPath);
sprintf_s(key, sizeof(key), "module%i", i);
GetPrivateProfileString("target", key, "", TargetMaps[i].module, sizeof(TargetMaps[i].module)-1, InitPath);
sprintf_s(key, sizeof(key), "opengllib%i", i);
GetPrivateProfileString("target", key, "", TargetMaps[i].OpenGLLib, sizeof(TargetMaps[i].OpenGLLib)-1, InitPath);
sprintf_s(key, sizeof(key), "ver%i", i);
TargetMaps[i].dxversion = GetPrivateProfileInt("target", key, 0, InitPath);
sprintf_s(key, sizeof(key), "flag%i", i);
@ -290,6 +303,8 @@ void CDxwndhostView::OnInitialUpdate()
TargetMaps[i].sizy = GetPrivateProfileInt("target", key, 0, InitPath);
sprintf_s(key, sizeof(key), "maxfps%i", i);
TargetMaps[i].MaxFPS = GetPrivateProfileInt("target", key, 0, InitPath);
sprintf_s(key, sizeof(key), "initts%i", i);
TargetMaps[i].InitTS = GetPrivateProfileInt("target", key, 0, InitPath);
listitem.mask = LVIF_TEXT;
listitem.iItem = i;
listitem.iSubItem = 0;
@ -306,6 +321,7 @@ void CDxwndhostView::OnInitialUpdate()
if(m_StartToTray) this->OnGoToTrayIcon();
this->isUpdated=FALSE;
pTitles = &TitleMaps[0];
pTargets= &TargetMaps[0];
}
/////////////////////////////////////////////////////////////////////////////
@ -353,6 +369,7 @@ void CDxwndhostView::OnModify()
if(dlg.m_DXVersion > 6) dlg.m_DXVersion -= 5;
dlg.m_FilePath = TargetMaps[i].path;
dlg.m_Module = TargetMaps[i].module;
dlg.m_OpenGLLib = TargetMaps[i].OpenGLLib;
dlg.m_Title = TitleMaps[i].title;
dlg.m_UnNotify = TargetMaps[i].flags & UNNOTIFY ? 1 : 0;
dlg.m_EmulateSurface = TargetMaps[i].flags & EMULATESURFACE ? 1 : 0;
@ -379,6 +396,7 @@ void CDxwndhostView::OnModify()
dlg.m_AutoRefresh = TargetMaps[i].flags & AUTOREFRESH ? 1 : 0;
dlg.m_FixWinFrame = TargetMaps[i].flags & FIXWINFRAME ? 1 : 0;
dlg.m_HideHwCursor = TargetMaps[i].flags & HIDEHWCURSOR ? 1 : 0;
dlg.m_ShowHwCursor = TargetMaps[i].flags2 & SHOWHWCURSOR ? 1 : 0;
dlg.m_EnableClipping = TargetMaps[i].flags & ENABLECLIPPING ? 1 : 0;
dlg.m_CursorClipping = TargetMaps[i].flags & CLIPCURSOR ? 1 : 0;
dlg.m_VideoToSystemMem = TargetMaps[i].flags & SWITCHVIDEOMEMORY ? 1 : 0;
@ -396,7 +414,9 @@ void CDxwndhostView::OnModify()
dlg.m_ModalStyle = TargetMaps[i].flags2 & MODALSTYLE ? 1 : 0;
dlg.m_KeepAspectRatio = TargetMaps[i].flags2 & KEEPASPECTRATIO ? 1 : 0;
dlg.m_ForceWinResize = TargetMaps[i].flags2 & FORCEWINRESIZE ? 1 : 0;
dlg.m_HookGDI = TargetMaps[i].flags2 & HOOKGDI ? 1 : 0;
dlg.m_HideMultiMonitor = TargetMaps[i].flags2 & HIDEMULTIMONITOR ? 1 : 0;
dlg.m_WallpaperMode = TargetMaps[i].flags2 & WALLPAPERMODE ? 1 : 0;
dlg.m_HookChildWin = TargetMaps[i].flags & HOOKCHILDWIN ? 1 : 0;
dlg.m_MessageProc = TargetMaps[i].flags & MESSAGEPROC ? 1 : 0;
dlg.m_FixNCHITTEST = TargetMaps[i].flags2 & FIXNCHITTEST ? 1 : 0;
@ -410,6 +430,7 @@ void CDxwndhostView::OnModify()
dlg.m_SkipFPS = TargetMaps[i].flags2 & SKIPFPS ? 1 : 0;
dlg.m_ShowFPS = TargetMaps[i].flags2 & SHOWFPS ? 1 : 0;
dlg.m_TimeStretch = TargetMaps[i].flags2 & TIMESTRETCH ? 1 : 0;
dlg.m_HookOpenGL = TargetMaps[i].flags2 & HOOKOPENGL ? 1 : 0;
dlg.m_InitX = TargetMaps[i].initx;
dlg.m_InitY = TargetMaps[i].inity;
dlg.m_MinX = TargetMaps[i].minx;
@ -421,9 +442,11 @@ void CDxwndhostView::OnModify()
dlg.m_SizX = TargetMaps[i].sizx;
dlg.m_SizY = TargetMaps[i].sizy;
dlg.m_MaxFPS = TargetMaps[i].MaxFPS;
dlg.m_InitTS = TargetMaps[i].InitTS;
if(dlg.DoModal() == IDOK && dlg.m_FilePath.GetLength()){
strcpy_s(TargetMaps[i].path, sizeof(TargetMaps[i].path), dlg.m_FilePath);
strcpy_s(TargetMaps[i].module, sizeof(TargetMaps[i].module), dlg.m_Module);
strcpy_s(TargetMaps[i].OpenGLLib, sizeof(TargetMaps[i].OpenGLLib), dlg.m_OpenGLLib);
strcpy_s(TitleMaps[i].title, sizeof(TitleMaps[i].title), dlg.m_Title);
if(dlg.m_DXVersion > 1) dlg.m_DXVersion += 5;
TargetMaps[i].dxversion = dlg.m_DXVersion;
@ -469,6 +492,7 @@ void CDxwndhostView::OnModify()
if(dlg.m_AutoRefresh) TargetMaps[i].flags |= AUTOREFRESH;
if(dlg.m_FixWinFrame) TargetMaps[i].flags |= FIXWINFRAME;
if(dlg.m_HideHwCursor) TargetMaps[i].flags |= HIDEHWCURSOR;
if(dlg.m_ShowHwCursor) TargetMaps[i].flags2 |= SHOWHWCURSOR;
if(dlg.m_EnableClipping) TargetMaps[i].flags |= ENABLECLIPPING;
if(dlg.m_CursorClipping) TargetMaps[i].flags |= CLIPCURSOR;
if(dlg.m_VideoToSystemMem) TargetMaps[i].flags |= SWITCHVIDEOMEMORY;
@ -486,7 +510,9 @@ void CDxwndhostView::OnModify()
if(dlg.m_ModalStyle) TargetMaps[i].flags2 |= MODALSTYLE;
if(dlg.m_KeepAspectRatio) TargetMaps[i].flags2 |= KEEPASPECTRATIO;
if(dlg.m_ForceWinResize) TargetMaps[i].flags2 |= FORCEWINRESIZE;
if(dlg.m_HookGDI) TargetMaps[i].flags2 |= HOOKGDI;
if(dlg.m_HideMultiMonitor) TargetMaps[i].flags2 |= HIDEMULTIMONITOR;
if(dlg.m_WallpaperMode) TargetMaps[i].flags2 |= WALLPAPERMODE;
if(dlg.m_HookChildWin) TargetMaps[i].flags |= HOOKCHILDWIN;
if(dlg.m_MessageProc) TargetMaps[i].flags |= MESSAGEPROC;
if(dlg.m_FixNCHITTEST) TargetMaps[i].flags2 |= FIXNCHITTEST;
@ -500,6 +526,7 @@ void CDxwndhostView::OnModify()
if(dlg.m_SkipFPS) TargetMaps[i].flags2 |= SKIPFPS;
if(dlg.m_ShowFPS) TargetMaps[i].flags2 |= SHOWFPS;
if(dlg.m_TimeStretch) TargetMaps[i].flags2 |= TIMESTRETCH;
if(dlg.m_HookOpenGL) TargetMaps[i].flags2 |= HOOKOPENGL;
TargetMaps[i].initx = dlg.m_InitX;
TargetMaps[i].inity = dlg.m_InitY;
TargetMaps[i].minx = dlg.m_MinX;
@ -511,7 +538,9 @@ void CDxwndhostView::OnModify()
TargetMaps[i].sizx = dlg.m_SizX;
TargetMaps[i].sizy = dlg.m_SizY;
TargetMaps[i].MaxFPS = dlg.m_MaxFPS;
TargetMaps[i].InitTS = dlg.m_InitTS;
strcpy_s(TargetMaps[i].module, sizeof(TargetMaps[i].module), dlg.m_Module);
strcpy_s(TargetMaps[i].OpenGLLib, sizeof(TargetMaps[i].OpenGLLib), dlg.m_OpenGLLib);
strcpy_s(TitleMaps[i].title, sizeof(TitleMaps[i].title), dlg.m_Title);
CListCtrl& listctrl = GetListCtrl();
listitem.mask = LVIF_TEXT;
@ -706,6 +735,7 @@ void CDxwndhostView::OnAdd()
if(dlg.DoModal() == IDOK && dlg.m_FilePath.GetLength()){
strcpy_s(TargetMaps[i].path,sizeof(TargetMaps[i].path),dlg.m_FilePath);
strcpy_s(TargetMaps[i].module,sizeof(TargetMaps[i].module),dlg.m_Module);
strcpy_s(TargetMaps[i].OpenGLLib,sizeof(TargetMaps[i].OpenGLLib),dlg.m_OpenGLLib);
strcpy_s(TitleMaps[i].title, sizeof(TitleMaps[i].title), dlg.m_Title);
if(dlg.m_DXVersion > 1) dlg.m_DXVersion += 5;
TargetMaps[i].dxversion = dlg.m_DXVersion;
@ -751,6 +781,7 @@ void CDxwndhostView::OnAdd()
if(dlg.m_AutoRefresh) TargetMaps[i].flags |= AUTOREFRESH;
if(dlg.m_FixWinFrame) TargetMaps[i].flags |= FIXWINFRAME;
if(dlg.m_HideHwCursor) TargetMaps[i].flags |= HIDEHWCURSOR;
if(dlg.m_ShowHwCursor) TargetMaps[i].flags2 |= SHOWHWCURSOR;
if(dlg.m_EnableClipping) TargetMaps[i].flags |= ENABLECLIPPING;
if(dlg.m_CursorClipping) TargetMaps[i].flags |= CLIPCURSOR;
if(dlg.m_VideoToSystemMem) TargetMaps[i].flags |= SWITCHVIDEOMEMORY;
@ -768,7 +799,9 @@ void CDxwndhostView::OnAdd()
if(dlg.m_ModalStyle) TargetMaps[i].flags2 |= MODALSTYLE;
if(dlg.m_KeepAspectRatio) TargetMaps[i].flags2 |= KEEPASPECTRATIO;
if(dlg.m_ForceWinResize) TargetMaps[i].flags2 |= FORCEWINRESIZE;
if(dlg.m_HookGDI) TargetMaps[i].flags2 |= HOOKGDI;
if(dlg.m_HideMultiMonitor) TargetMaps[i].flags2 |= HIDEMULTIMONITOR;
if(dlg.m_WallpaperMode) TargetMaps[i].flags2 |= WALLPAPERMODE;
if(dlg.m_HookChildWin) TargetMaps[i].flags |= HOOKCHILDWIN;
if(dlg.m_MessageProc) TargetMaps[i].flags |= MESSAGEPROC;
if(dlg.m_FixNCHITTEST) TargetMaps[i].flags2 |= FIXNCHITTEST;
@ -782,6 +815,7 @@ void CDxwndhostView::OnAdd()
if(dlg.m_SkipFPS) TargetMaps[i].flags2 |= SKIPFPS;
if(dlg.m_ShowFPS) TargetMaps[i].flags2 |= SHOWFPS;
if(dlg.m_TimeStretch) TargetMaps[i].flags2 |= TIMESTRETCH;
if(dlg.m_HookOpenGL) TargetMaps[i].flags2 |= HOOKOPENGL;
TargetMaps[i].initx = dlg.m_InitX;
TargetMaps[i].inity = dlg.m_InitY;
TargetMaps[i].minx = dlg.m_MinX;
@ -793,6 +827,7 @@ void CDxwndhostView::OnAdd()
TargetMaps[i].sizx = dlg.m_SizX;
TargetMaps[i].sizy = dlg.m_SizY;
TargetMaps[i].MaxFPS = dlg.m_MaxFPS;
TargetMaps[i].InitTS = dlg.m_InitTS;
CListCtrl& listctrl = GetListCtrl();
listitem.mask = LVIF_TEXT;
listitem.iItem = i;
@ -1018,6 +1053,13 @@ void CDxwndhostView::OnViewStatus()
pDlg->ShowWindow(SW_SHOW);
}
void CDxwndhostView::OnViewTimeSlider()
{
CTimeSliderDialog *pDlg = new CTimeSliderDialog();
BOOL ret = pDlg->Create(CTimeSliderDialog::IDD, this);
pDlg->ShowWindow(SW_SHOW);
}
void CDxwndhostView::Resize()
{
CListCtrl& listctrl = GetListCtrl();

View File

@ -76,6 +76,7 @@ protected:
afx_msg void OnHookStop();
afx_msg void OnTrayRestore();
afx_msg void OnViewStatus();
afx_msg void OnViewTimeSlider();
afx_msg void OnExit();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()