mirror of
https://github.com/DxWnd/DxWnd.reloaded
synced 2024-12-30 09:25:35 +01:00
v2_04_07_src_fx1
Former-commit-id: 82828630775664a91be4eb87cb7dfea0f73601b2
This commit is contained in:
parent
6097e08028
commit
4ebc06ad71
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a035cc2206b5dcd8fed40fafdef29abe8b54f47acfbceb0568cd7d09f17be7d8
|
||||
size 782848
|
||||
oid sha256:03d7a189e3b95c69545b045eeef01fffafe7178f6c0892f1fa1d61eb810faa5c
|
||||
size 780800
|
||||
|
@ -1,6 +1,6 @@
|
||||
[target]
|
||||
title0=Wizardry Chronicles
|
||||
path0=D:\Games\Wizardry Chronicle\Wiz.exe
|
||||
title0=Wizardry Chronicles.exe
|
||||
path0=F:\Games\Wizardry Chronicle\Wizardry Chronicles.exe
|
||||
startfolder0=
|
||||
launchpath0=
|
||||
module0=
|
||||
|
@ -1,4 +1,228 @@
|
||||
OnRun idx=6 prog="D:\Games\Tomb Raider III\tomb3.exe"
|
||||
OnRun idx=6 prog="F:\RhemE\RhemE\RHEM.noshim.exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=6 prog="D:\Games\Tomb Raider III\tomb3.exe"
|
||||
OnRun idx=6 prog="F:\RhemE\RhemE\RHEM.noshim.exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=6 prog="F:\RhemE\RhemE\RHEM.noshim.exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=6 prog="F:\RhemE\RhemE\RHEM.noshim.exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=6 prog="F:\RhemE\RhemE\RHEM.noshim.exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=6 prog="F:\RhemE\RhemE\RHEM.noshim.exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=7 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=7 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
injectsuspended mode
|
||||
InjectSuspended: exe="F:\RhemE\RhemE\RHEM1(scalable).exe.noshim" dir="F:\RhemE\RhemE"
|
||||
Target handle=67c
|
||||
NT Header offset=E8
|
||||
AddressOfEntryPoint=3D84 ImageBase=20000000
|
||||
Thread start address=20003d84
|
||||
wait cycle 0 eip=20003d84
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
injectsuspended mode
|
||||
InjectSuspended: exe="F:\RhemE\RhemE\RHEM1(scalable).exe.noshim" dir="F:\RhemE\RhemE"
|
||||
Target handle=908
|
||||
NT Header offset=E8
|
||||
AddressOfEntryPoint=3D84 ImageBase=20000000
|
||||
Thread start address=20003d84
|
||||
wait cycle 0 eip=20003d84
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
debugger mode
|
||||
create process: path="F:\RhemE\RhemE"
|
||||
create process: base=0x20000000 path="F:\RhemE\RhemE\RHEM1(scalable).exe"
|
||||
create thread: th=0xA18 base=0x2F1000 start=0x76C68500
|
||||
load dll: base=0x77BD0000 path="C:\Windows\SysWOW64\ntdll.dll"
|
||||
unload dll: base=0x540000
|
||||
load dll: base=0x76C40000 path="C:\Windows\SysWOW64\kernel32.dll"
|
||||
unload dll: base=0x76C40000
|
||||
unload dll: base=0x540000
|
||||
unload dll: base=0x6A0000
|
||||
load dll: base=0x76C40000 path="C:\Windows\SysWOW64\kernel32.dll"
|
||||
load dll: base=0x74830000 path="C:\Windows\SysWOW64\KernelBase.dll"
|
||||
load dll: base=0x6E490000 path="C:\Windows\SysWOW64\apphelp.dll"
|
||||
load dll: base=0x78E50000 path="C:\Windows\AppPatch\AcLayers.dll"
|
||||
load dll: base=0x773E0000 path="C:\Windows\SysWOW64\msvcrt.dll"
|
||||
load dll: base=0x74C00000 path="C:\Windows\SysWOW64\user32.dll"
|
||||
load dll: base=0x774A0000 path="C:\Windows\SysWOW64\win32u.dll"
|
||||
load dll: base=0x75600000 path="C:\Windows\SysWOW64\gdi32.dll"
|
||||
load dll: base=0x75450000 path="C:\Windows\SysWOW64\gdi32full.dll"
|
||||
load dll: base=0x75850000 path="C:\Windows\SysWOW64\shell32.dll"
|
||||
load dll: base=0x75800000 path="C:\Windows\SysWOW64\cfgmgr32.dll"
|
||||
load dll: base=0x76DD0000 path="C:\Windows\SysWOW64\windows.storage.dll"
|
||||
load dll: base=0x749E0000 path="C:\Windows\SysWOW64\combase.dll"
|
||||
load dll: base=0x75630000 path="C:\Windows\SysWOW64\ucrtbase.dll"
|
||||
load dll: base=0x75300000 path="C:\Windows\SysWOW64\rpcrt4.dll"
|
||||
load dll: base=0x74690000 path="C:\Windows\SysWOW64\sspicli.dll"
|
||||
load dll: base=0x74680000 path="C:\Windows\SysWOW64\cryptbase.dll"
|
||||
load dll: base=0x76D70000 path="C:\Windows\SysWOW64\bcryptprimitives.dll"
|
||||
load dll: base=0x77980000 path="C:\Windows\SysWOW64\sechost.dll"
|
||||
load dll: base=0x777F0000 path="C:\Windows\SysWOW64\powrprof.dll"
|
||||
load dll: base=0x779D0000 path="C:\Windows\SysWOW64\advapi32.dll"
|
||||
load dll: base=0x76D20000 path="C:\Windows\SysWOW64\shlwapi.dll"
|
||||
load dll: base=0x77BC0000 path="C:\Windows\SysWOW64\kernel.appcore.dll"
|
||||
load dll: base=0x776F0000 path="C:\Windows\SysWOW64\SHCore.dll"
|
||||
load dll: base=0x773A0000 path="C:\Windows\SysWOW64\profapi.dll"
|
||||
load dll: base=0x77650000 path="C:\Windows\SysWOW64\oleaut32.dll"
|
||||
load dll: base=0x74D60000 path="C:\Windows\SysWOW64\msvcp_win.dll"
|
||||
load dll: base=0x74E40000 path="C:\Windows\SysWOW64\setupapi.dll"
|
||||
load dll: base=0x74000000 path="C:\Windows\SysWOW64\mpr.dll"
|
||||
load dll: base=0x66680000 path="C:\Windows\SysWOW64\sfc.dll"
|
||||
load dll: base=0x73930000 path="C:\Windows\SysWOW64\winspool.drv"
|
||||
load dll: base=0x72FA0000 path="C:\Windows\SysWOW64\bcrypt.dll"
|
||||
load dll: base=0x640C0000 path="C:\Windows\SysWOW64\sfc_os.dll"
|
||||
output debug: len=115 unicode=0
|
||||
output debug: len=115 unicode=0
|
||||
load dll: base=0x67100000 path="C:\Windows\SysWOW64\SortServer2003Compat.dll"
|
||||
load dll: base=0x773B0000 path="C:\Windows\SysWOW64\imm32.dll"
|
||||
exception: code=0x80000003(Breakpoint) addr=0x77C7748C first=1
|
||||
exit thread: exitcode=0x0
|
||||
load dll: base=0x10000000 path="C:\Users\user\AppData\Local\Temp\TempFolder.aad\proj.dll"
|
||||
create thread: th=0x414 base=0x2F4000 start=0x77C067C0
|
||||
create thread: th=0x670 base=0x2F7000 start=0x77C067C0
|
||||
load dll: base=0x69000000 path="C:\Users\user\AppData\Local\Temp\TempFolder.aad\iml32.dll"
|
||||
load dll: base=0x774C0000 path="C:\Windows\SysWOW64\comdlg32.dll"
|
||||
create thread: th=0x670 base=0x2FA000 start=0x77C067C0
|
||||
load dll: base=0x72DE0000 path="C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.14393.447_none_5507ded2cb4f7f4c\comctl32.dll"
|
||||
load dll: base=0x75710000 path="C:\Windows\SysWOW64\ole32.dll"
|
||||
load dll: base=0x68000000 path="C:\Users\user\AppData\Local\Temp\TempFolder.aad\dirapi.dll"
|
||||
load dll: base=0x73050000 path="C:\Windows\SysWOW64\winmm.dll"
|
||||
load dll: base=0x740F0000 path="C:\Windows\SysWOW64\version.dll"
|
||||
load dll: base=0x72F70000 path="C:\Windows\SysWOW64\winmmbase.dll"
|
||||
load dll: base=0x720000 path="C:\Windows\SysWOW64\winmmbase.dll"
|
||||
load dll: base=0x2180000 path="C:\Windows\SysWOW64\winmmbase.dll"
|
||||
unload dll: base=0x72F70000
|
||||
unload dll: base=0x720000
|
||||
load dll: base=0x6C670000 path="C:\Windows\SysWOW64\uxtheme.dll"
|
||||
create thread: th=0x414 base=0x2FD000 start=0x78E7C3C0
|
||||
load dll: base=0x77840000 path="C:\Windows\SysWOW64\msctf.dll"
|
||||
load dll: base=0x92E0000 path="D:\DxWnd.develop\v2_04_07_beta\Release\dxwnd.dll"
|
||||
create thread: th=0xC88 base=0x300000 start=0x73953B70
|
||||
load dll: base=0x64080000 path="C:\Windows\SysWOW64\msvfw32.dll"
|
||||
load dll: base=0x755B0000 path="C:\Windows\SysWOW64\wintrust.dll"
|
||||
load dll: base=0x9400000 path="C:\Windows\SysWOW64\msasn1.dll"
|
||||
load dll: base=0x746B0000 path="C:\Windows\SysWOW64\crypt32.dll"
|
||||
load dll: base=0x64590000 path="C:\Windows\SysWOW64\avifil32.dll"
|
||||
load dll: base=0x72FD0000 path="C:\Windows\SysWOW64\msacm32.dll"
|
||||
exit thread: exitcode=0x1
|
||||
exit thread: exitcode=0x1
|
||||
exit thread: exitcode=0x1
|
||||
exit thread: exitcode=0x1
|
||||
exit thread: exitcode=0x1
|
||||
exit process
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=6 prog="F:\RhemE\RhemE\RHEM.noshim.exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=6 prog="F:\RhemE\RhemE\RHEM.noshim.exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
setwindowshook mode
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
injectsuspended mode
|
||||
InjectSuspended: exe="F:\RhemE\RhemE\RHEM1(scalable).exe" dir="F:\RhemE\RhemE"
|
||||
Target handle=888
|
||||
NT Header offset=E8
|
||||
AddressOfEntryPoint=3D84 ImageBase=20000000
|
||||
Thread start address=20003d84
|
||||
wait cycle 0 eip=20003d84
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
self elevation
|
||||
injectsuspended mode
|
||||
InjectSuspended: exe="F:\RhemE\RhemE\RHEM1(scalable).exe" dir="F:\RhemE\RhemE"
|
||||
Target handle=828
|
||||
NT Header offset=E8
|
||||
AddressOfEntryPoint=3D84 ImageBase=20000000
|
||||
Thread start address=20003d84
|
||||
wait cycle 0 eip=20003d84
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
self elevation
|
||||
injectsuspended mode
|
||||
InjectSuspended: exe="F:\RhemE\RhemE\RHEM1(scalable).exe" dir="F:\RhemE\RhemE"
|
||||
Target handle=a04
|
||||
NT Header offset=E8
|
||||
AddressOfEntryPoint=3D84 ImageBase=20000000
|
||||
Thread start address=20003d84
|
||||
wait cycle 0 eip=20003d84
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
self elevation
|
||||
injectsuspended mode
|
||||
InjectSuspended: exe="F:\RhemE\RhemE\RHEM1(scalable).exe" dir="F:\RhemE\RhemE"
|
||||
Target handle=6bc
|
||||
NT Header offset=E8
|
||||
AddressOfEntryPoint=3D84 ImageBase=20000000
|
||||
Thread start address=20003d84
|
||||
wait cycle 0 eip=20003d84
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
self elevation
|
||||
injectsuspended mode
|
||||
InjectSuspended: exe="F:\RhemE\RhemE\RHEM1(scalable).exe" dir="F:\RhemE\RhemE"
|
||||
Target handle=878
|
||||
NT Header offset=E8
|
||||
AddressOfEntryPoint=3D84 ImageBase=20000000
|
||||
Thread start address=20003d84
|
||||
wait cycle 0 eip=20003d84
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM1(scalable).exe" unhooked=0
|
||||
self elevation
|
||||
injectsuspended mode
|
||||
InjectSuspended: exe="F:\RhemE\RhemE\RHEM1(scalable).exe" dir="F:\RhemE\RhemE"
|
||||
Target handle=86c
|
||||
NT Header offset=E8
|
||||
AddressOfEntryPoint=3D84 ImageBase=20000000
|
||||
Thread start address=20003d84
|
||||
wait cycle 0 eip=20003d84
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM.noshim.exe" unhooked=0
|
||||
self elevation
|
||||
injectsuspended mode
|
||||
InjectSuspended: exe="F:\RhemE\RhemE\RHEM.noshim.exe" dir="F:\RhemE\RhemE"
|
||||
Target handle=8a0
|
||||
NT Header offset=E8
|
||||
AddressOfEntryPoint=3D84 ImageBase=20000000
|
||||
Thread start address=20003d84
|
||||
wait cycle 0 eip=20003d84
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM.noshim.exe" unhooked=0
|
||||
self elevation
|
||||
injectsuspended mode
|
||||
InjectSuspended: exe="F:\RhemE\RhemE\RHEM.noshim.exe" dir="F:\RhemE\RhemE"
|
||||
Target handle=cb0
|
||||
NT Header offset=E8
|
||||
AddressOfEntryPoint=3D84 ImageBase=20000000
|
||||
Thread start address=20003d84
|
||||
wait cycle 0 eip=20003d84
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM.noshim.exe" unhooked=0
|
||||
self elevation
|
||||
setwindowshook mode
|
||||
OnRun idx=8 prog="F:\RhemE\RhemE\RHEM.noshim.exe" unhooked=0
|
||||
self elevation
|
||||
setwindowshook mode
|
||||
|
@ -1469,3 +1469,8 @@ fix: log messages for CloseHandle wrapper
|
||||
fix: log messages for GetPixel wrapper
|
||||
fix: window position in MoveWindow for ANCHORED mode and big windows
|
||||
fix: DialogBoxParamA wrapper
|
||||
|
||||
v2.04.07
|
||||
fix: QueryInterface wrapper for ddraw classes unified in a single procedure.
|
||||
fix: D3D2 SwapTextureHandles hook fix - fixes "Wizardry Chronicle" texture problems
|
||||
fix: string overflow in TextureHack procedure for D3D1-7 textures
|
289
dll/ddraw.cpp
289
dll/ddraw.cpp
@ -32,6 +32,7 @@ extern BOOL IsChangeDisplaySettingsHotPatched;
|
||||
extern void TextureHandling(LPDIRECTDRAWSURFACE, int);
|
||||
extern void SetMinimalCaps(int, LPDDCAPS, LPDDCAPS);
|
||||
ColorConversion_Type pColorConversion = NULL;
|
||||
extern HRESULT WINAPI extQueryInterfaceDX(int, QueryInterface_Type, void *, REFIID, LPVOID *);
|
||||
|
||||
HDC hFlippedDC = NULL;
|
||||
BOOL bFlippedDC = FALSE;
|
||||
@ -1449,7 +1450,7 @@ void HookDDSurface(LPDIRECTDRAWSURFACE *lplpdds, int dxversion, BOOL isPrim)
|
||||
}
|
||||
|
||||
|
||||
static void HookGammaControl(LPVOID *obp)
|
||||
void HookGammaControl(LPVOID *obp)
|
||||
{
|
||||
// IDirectDrawGammaControl::GetGammaRamp
|
||||
SetHook((void *)(**(DWORD **)obp + 12), extDDGetGammaRamp, (void **)&pDDGetGammaRamp, "GetGammaRamp(G)");
|
||||
@ -1926,293 +1927,27 @@ HRESULT WINAPI extGetScanLine4(LPDIRECTDRAW lpdd, LPDWORD lpdwScanLine)
|
||||
HRESULT WINAPI extGetScanLine7(LPDIRECTDRAW lpdd, LPDWORD lpdwScanLine)
|
||||
{ return extGetScanLine(7, pGetScanLine7, lpdd, lpdwScanLine); }
|
||||
|
||||
static HRESULT WINAPI extQueryInterfaceD(int dxversion, QueryInterface_Type pQueryInterfaceD, void *lpdd, REFIID riid, LPVOID *obp)
|
||||
{
|
||||
HRESULT res;
|
||||
unsigned int dwLocalDDVersion;
|
||||
unsigned int dwLocalD3DVersion;
|
||||
|
||||
res = (*pQueryInterfaceD)(lpdd, riid, obp);
|
||||
OutTraceDDRAW("QueryInterface(D%d): lpdd=%x REFIID=%x(%s) obp=%x ret=%x at %d\n",
|
||||
dxversion, lpdd, riid.Data1, ExplainGUID((GUID *)&riid), *obp, res, __LINE__);
|
||||
|
||||
if(res) {
|
||||
OutTraceE("QueryInterface(D) ERROR: res=%x(%s)\n", res, ExplainDDError(res));
|
||||
return res;
|
||||
}
|
||||
|
||||
dwLocalDDVersion=0;
|
||||
dwLocalD3DVersion=0;
|
||||
switch(riid.Data1){
|
||||
case 0x6C14DB80: //DirectDraw1
|
||||
dwLocalDDVersion = 1;
|
||||
break;
|
||||
case 0xB3A6F3E0: //DirectDraw2
|
||||
dwLocalDDVersion = 2;
|
||||
break;
|
||||
case 0x618f8ad4: //DirectDraw3
|
||||
dwLocalDDVersion = 3;
|
||||
break;
|
||||
case 0x9c59509a: //DirectDraw4
|
||||
dwLocalDDVersion = 4;
|
||||
break;
|
||||
case 0x15e65ec0: //DirectDraw7
|
||||
dwLocalDDVersion = 7;
|
||||
break;
|
||||
case 0x3BBA0080: //Direct3D
|
||||
dwLocalD3DVersion = 1;
|
||||
break;
|
||||
case 0x6aae1ec1: //Direct3D2
|
||||
dwLocalD3DVersion = 2;
|
||||
break;
|
||||
case 0xbb223240: //Direct3D3
|
||||
dwLocalD3DVersion = 3;
|
||||
break;
|
||||
case 0xf5049e77: //Direct3D7
|
||||
dwLocalD3DVersion = 7;
|
||||
break;
|
||||
}
|
||||
if (! *obp){
|
||||
OutTraceDDRAW("QueryInterface(D): Interface for DX version %d not found\n", dwLocalDDVersion);
|
||||
return(0);
|
||||
}
|
||||
if(dwLocalDDVersion) OutTraceDW("QueryInterface(D): Got interface for DX version %d\n", dwLocalDDVersion);
|
||||
if(dwLocalD3DVersion) OutTraceDW("QueryInterface(D): Got interface for D3D version %d\n", dwLocalD3DVersion);
|
||||
|
||||
if (dwLocalDDVersion > dxw.dwMaxDDVersion) {
|
||||
*obp = NULL;
|
||||
OutTraceDW("QueryInterface(D): lpdd=%x REFIID=%x obp=(NULL) ret=%x at %d\n",
|
||||
lpdd, riid.Data1, res, __LINE__);
|
||||
return(0);
|
||||
}
|
||||
|
||||
switch (dwLocalDDVersion){
|
||||
case 1: // you never know ....
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
// it's not supposed to be written for DDVersion==7, but it works ....
|
||||
case 7:
|
||||
dxw.dwDDVersion=dwLocalDDVersion;
|
||||
HookDDSession((LPDIRECTDRAW *)obp, dxw.dwDDVersion);
|
||||
break;
|
||||
}
|
||||
|
||||
extern void HookDirect3DSession(LPDIRECTDRAW *, int);
|
||||
switch (dwLocalD3DVersion){
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 7:
|
||||
HookDirect3DSession((LPDIRECTDRAW *)obp, dwLocalD3DVersion);
|
||||
break;
|
||||
}
|
||||
|
||||
OutTraceDDRAW("QueryInterface(D): lpdd=%x REFIID=%x obp=%x DDVersion=%d ret=0\n",
|
||||
lpdd, riid.Data1, *obp, dxw.dwDDVersion);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
HRESULT WINAPI extQueryInterfaceD1(void *lpdd, REFIID riid, LPVOID *obp)
|
||||
{ return extQueryInterfaceD(1, pQueryInterfaceD1, lpdd, riid, obp); }
|
||||
{ return extQueryInterfaceDX(1, pQueryInterfaceD1, lpdd, riid, obp); }
|
||||
HRESULT WINAPI extQueryInterfaceD2(void *lpdd, REFIID riid, LPVOID *obp)
|
||||
{ return extQueryInterfaceD(2, pQueryInterfaceD2, lpdd, riid, obp); }
|
||||
{ return extQueryInterfaceDX(2, pQueryInterfaceD2, lpdd, riid, obp); }
|
||||
HRESULT WINAPI extQueryInterfaceD3(void *lpdd, REFIID riid, LPVOID *obp)
|
||||
{ return extQueryInterfaceD(3, pQueryInterfaceD3, lpdd, riid, obp); }
|
||||
{ return extQueryInterfaceDX(3, pQueryInterfaceD3, lpdd, riid, obp); }
|
||||
HRESULT WINAPI extQueryInterfaceD4(void *lpdd, REFIID riid, LPVOID *obp)
|
||||
{ return extQueryInterfaceD(4, pQueryInterfaceD4, lpdd, riid, obp); }
|
||||
{ return extQueryInterfaceDX(4, pQueryInterfaceD4, lpdd, riid, obp); }
|
||||
HRESULT WINAPI extQueryInterfaceD7(void *lpdd, REFIID riid, LPVOID *obp)
|
||||
{ return extQueryInterfaceD(7, pQueryInterfaceD7, lpdd, riid, obp); }
|
||||
|
||||
// some unhandled interfaces in emulation mode:
|
||||
// REFIID={84e63de0-46aa-11cf-816f-0000c020156e}: IID_IDirect3DHALDevice
|
||||
|
||||
static HRESULT WINAPI extQueryInterfaceS(int dxversion, QueryInterface_Type pQueryInterfaceS, void *lpdds, REFIID riid, LPVOID *obp)
|
||||
{
|
||||
HRESULT res;
|
||||
BOOL IsPrim;
|
||||
BOOL IsBack;
|
||||
BOOL IsGammaRamp;
|
||||
unsigned int dwLocalDDVersion;
|
||||
unsigned int dwLocalTexVersion;
|
||||
unsigned int dwLocalD3DDeviceVersion;
|
||||
|
||||
IsPrim=dxwss.IsAPrimarySurface((LPDIRECTDRAWSURFACE)lpdds);
|
||||
IsBack=dxwss.IsABackBufferSurface((LPDIRECTDRAWSURFACE)lpdds);
|
||||
OutTraceDDRAW("QueryInterface(S%d): lpdds=%x%s REFIID=%x(%s)\n",
|
||||
dxversion, lpdds, dxwss.ExplainSurfaceRole((LPDIRECTDRAWSURFACE)lpdds), riid.Data1, ExplainGUID((GUID *)&riid));
|
||||
|
||||
IsGammaRamp=FALSE;
|
||||
|
||||
dwLocalDDVersion=0;
|
||||
dwLocalTexVersion=0;
|
||||
dwLocalD3DDeviceVersion=0;
|
||||
switch(riid.Data1){
|
||||
case 0x6C14DB81:
|
||||
dwLocalDDVersion = 1;
|
||||
break;
|
||||
case 0x57805885: //DDSurface2 - WIP (Dark Reign)
|
||||
dwLocalDDVersion = 2;
|
||||
break;
|
||||
case 0xDA044E00: //DDSurface3
|
||||
dwLocalDDVersion = 3;
|
||||
break;
|
||||
case 0x0B2B8630:
|
||||
dwLocalDDVersion = 4;
|
||||
break;
|
||||
case 0x06675a80:
|
||||
dwLocalDDVersion = 7;
|
||||
break;
|
||||
// Direct3DDevice
|
||||
case 0x84e63de0:
|
||||
OutTraceDW("QueryInterface: IID_IDirect3DHALDevice\n");
|
||||
dwLocalD3DDeviceVersion = 1;
|
||||
break;
|
||||
case 0xA4665C60: // IID_IDirect3DRGBDevice
|
||||
OutTraceDW("QueryInterface: IID_IDirect3DRGBDevice\n");
|
||||
dwLocalD3DDeviceVersion = 1;
|
||||
break;
|
||||
case 0xF2086B20: // IID_IDirect3DRampDevice
|
||||
OutTraceDW("QueryInterface: IID_IDirect3DRampDevice\n");
|
||||
dwLocalD3DDeviceVersion = 1;
|
||||
break;
|
||||
case 0x881949a1: // IID_IDirect3DMMXDevice
|
||||
OutTraceDW("QueryInterface: IID_IDirect3DMMXDevice\n");
|
||||
dwLocalD3DDeviceVersion = 1;
|
||||
break;
|
||||
case 0x50936643: // IID_IDirect3DRefDevice
|
||||
OutTraceDW("QueryInterface: IID_IDirect3DRefDevice\n");
|
||||
dwLocalD3DDeviceVersion = 2;
|
||||
break;
|
||||
case 0x8767df22: // IID_IDirect3DNullDevice
|
||||
OutTraceDW("QueryInterface: IID_IDirect3DNullDevice\n");
|
||||
dwLocalD3DDeviceVersion = 2;
|
||||
break;
|
||||
case 0xf5049e78: // IID_IDirect3DTnLHalDevice,
|
||||
OutTraceDW("QueryInterface: IID_IDirect3DTnLHalDevice\n");
|
||||
dwLocalD3DDeviceVersion = 3;
|
||||
break;
|
||||
case 0x64108800: // IID_IDirect3DDevice
|
||||
OutTraceDW("QueryInterface: IID_IDirect3DDevice\n");
|
||||
dwLocalD3DDeviceVersion = 1;
|
||||
break;
|
||||
case 0x93281501: // IID_IDirect3DDevice2
|
||||
OutTraceDW("QueryInterface: IID_IDirect3DDevice2\n");
|
||||
dwLocalD3DDeviceVersion = 2;
|
||||
break;
|
||||
case 0xb0ab3b60: // IID_IDirect3DDevice3
|
||||
OutTraceDW("QueryInterface: IID_IDirect3DDevice3\n");
|
||||
dwLocalD3DDeviceVersion = 3;
|
||||
break;
|
||||
case 0xf5049e79: // IID_IDirect3DDevice7
|
||||
OutTraceDW("QueryInterface: IID_IDirect3DDevice7\n");
|
||||
dwLocalD3DDeviceVersion = 7;
|
||||
break;
|
||||
case 0x4B9F0EE0:
|
||||
OutTraceDW("QueryInterface: IID_IDirectDrawColorControl\n");
|
||||
break;
|
||||
case 0x69C11C3E:
|
||||
OutTraceDW("QueryInterface: IID_IDirectDrawGammaControl\n");
|
||||
IsGammaRamp=TRUE;
|
||||
break;
|
||||
// textures
|
||||
case 0x2CDCD9E0:
|
||||
OutTraceDW("QueryInterface: IID_IDirect3DTexture\n");
|
||||
dwLocalTexVersion = 1;
|
||||
break;
|
||||
case 0x93281502:
|
||||
OutTraceDW("QueryInterface: IID_IDirect3DTexture2\n");
|
||||
dwLocalTexVersion = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
if (dwLocalDDVersion > dxw.dwMaxDDVersion) {
|
||||
*obp = NULL;
|
||||
OutTraceDW("QueryInterface(S): DDVersion=%d SUPPRESS lpdds=%x(%s) REFIID=%x obp=(NULL) ret=0 at %d\n",
|
||||
dwLocalDDVersion, lpdds, IsPrim?"":"(PRIM)", riid.Data1, __LINE__);
|
||||
return(0);
|
||||
}
|
||||
|
||||
// fix the target for gamma ramp creation: if it is a primary surface, use the real one!!
|
||||
// v2.03.37: do this just when in esurface emulated mode!!
|
||||
if( IsGammaRamp &&
|
||||
(dxw.dwFlags1 & EMULATESURFACE) &&
|
||||
dxwss.IsAPrimarySurface((LPDIRECTDRAWSURFACE)lpdds))
|
||||
lpdds = lpDDSEmu_Prim;
|
||||
|
||||
res = (*pQueryInterfaceS)(lpdds, riid, obp);
|
||||
|
||||
if(res) // added trace
|
||||
{
|
||||
OutTraceDW("QueryInterface(S): ERROR lpdds=%x%s REFIID=%x obp=%x ret=%x(%s) at %d\n",
|
||||
lpdds, IsPrim?"(PRIM)":"", riid.Data1, *obp, res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
|
||||
if (! *obp) {
|
||||
OutTraceDW("QueryInterface(S): Interface for DX version %d not found\n", dwLocalDDVersion);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// added trace
|
||||
OutTraceDW("QueryInterface(S): lpdds=%x%s REFIID=%x obp=%x DDVersion=%d TexVersion=%d GammaRamp=%d D3DDevice=%d ret=0\n",
|
||||
lpdds, IsPrim?"(PRIM)":"", riid.Data1, *obp, dwLocalDDVersion, dwLocalTexVersion, IsGammaRamp, dwLocalD3DDeviceVersion);
|
||||
|
||||
if (dwLocalDDVersion) {
|
||||
switch (dwLocalDDVersion){
|
||||
case 1: // added for The Sims
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 7:
|
||||
dxw.dwDDVersion=dwLocalDDVersion;
|
||||
if(IsPrim){
|
||||
OutTraceDW("QueryInterface(S): primary=%x new=%x\n", lpdds, *obp);
|
||||
dxwss.PushPrimarySurface((LPDIRECTDRAWSURFACE)*obp, dwLocalDDVersion);
|
||||
HookDDSurface((LPDIRECTDRAWSURFACE *)obp, dxw.dwDDVersion, TRUE);
|
||||
}
|
||||
else{
|
||||
if(IsBack) dxwss.PushBackBufferSurface((LPDIRECTDRAWSURFACE)*obp, dwLocalDDVersion);
|
||||
else dxwss.PopSurface((LPDIRECTDRAWSURFACE)*obp);
|
||||
// v2.02.13: seems that hooking inconditionally gives troubles. What is the proper safe hook condition?
|
||||
HookDDSurface((LPDIRECTDRAWSURFACE *)obp, dxw.dwDDVersion, FALSE);
|
||||
}
|
||||
DWORD dwCaps;
|
||||
if (dwCaps = dxwcdb.GetCaps((LPDIRECTDRAWSURFACE)lpdds)) {
|
||||
OutTrace("QueryInterface(S): PASS caps=%x lpdds=%x->%x\n", dwCaps, lpdds, *obp);
|
||||
dxwcdb.PushCaps(*(LPDIRECTDRAWSURFACE *)obp,dwCaps);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(dwLocalTexVersion) {
|
||||
// Texture Handling on QueryInterface
|
||||
if(dxw.dwFlags5 & TEXTUREMASK) TextureHandling((LPDIRECTDRAWSURFACE)lpdds, dxversion);
|
||||
HookTexture(obp, dwLocalTexVersion);
|
||||
}
|
||||
|
||||
if(IsGammaRamp) HookGammaControl(obp);
|
||||
|
||||
if(dwLocalD3DDeviceVersion) {
|
||||
extern void HookDirect3DDevice(void **, int);
|
||||
HookDirect3DDevice(obp, dwLocalD3DDeviceVersion);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
{ return extQueryInterfaceDX(7, pQueryInterfaceD7, lpdd, riid, obp); }
|
||||
|
||||
HRESULT WINAPI extQueryInterfaceS1(void *lpdds, REFIID riid, LPVOID *obp)
|
||||
{ return extQueryInterfaceS(1, pQueryInterfaceS1, lpdds, riid, obp); }
|
||||
{ return extQueryInterfaceDX(1, pQueryInterfaceS1, lpdds, riid, obp); }
|
||||
HRESULT WINAPI extQueryInterfaceS2(void *lpdds, REFIID riid, LPVOID *obp)
|
||||
{ return extQueryInterfaceS(2, pQueryInterfaceS2, lpdds, riid, obp); }
|
||||
{ return extQueryInterfaceDX(2, pQueryInterfaceS2, lpdds, riid, obp); }
|
||||
HRESULT WINAPI extQueryInterfaceS3(void *lpdds, REFIID riid, LPVOID *obp)
|
||||
{ return extQueryInterfaceS(3, pQueryInterfaceS3, lpdds, riid, obp); }
|
||||
{ return extQueryInterfaceDX(3, pQueryInterfaceS3, lpdds, riid, obp); }
|
||||
HRESULT WINAPI extQueryInterfaceS4(void *lpdds, REFIID riid, LPVOID *obp)
|
||||
{ return extQueryInterfaceS(4, pQueryInterfaceS4, lpdds, riid, obp); }
|
||||
{ return extQueryInterfaceDX(4, pQueryInterfaceS4, lpdds, riid, obp); }
|
||||
HRESULT WINAPI extQueryInterfaceS7(void *lpdds, REFIID riid, LPVOID *obp)
|
||||
{ return extQueryInterfaceS(7, pQueryInterfaceS7, lpdds, riid, obp); }
|
||||
|
||||
{ return extQueryInterfaceDX(7, pQueryInterfaceS7, lpdds, riid, obp); }
|
||||
|
||||
HRESULT WINAPI extSetDisplayMode(int dxversion, LPDIRECTDRAW lpdd,
|
||||
DWORD dwwidth, DWORD dwheight, DWORD dwbpp, DWORD dwrefreshrate, DWORD dwflags)
|
||||
|
@ -397,8 +397,8 @@ static void TextureHack(LPDIRECTDRAWSURFACE s, int dxversion)
|
||||
return;
|
||||
}
|
||||
if((ddsd.ddsCaps.dwCaps & DDSCAPS_TEXTURE) && !dxwss.IsABackBufferSurface(s)) while (TRUE) { // fake loop to ensure final Unlock
|
||||
OutTrace("TextureHack(%d): lpdds=%x BitCount=%d size=(%dx%d)\n",
|
||||
dxversion, s, ddsd.ddpfPixelFormat.dwRGBBitCount, ddsd.dwWidth, ddsd.dwHeight);
|
||||
OutTrace("TextureHack(%d): lpdds=%x BitCount=%d size=(%dx%d) surface=%x\n",
|
||||
dxversion, s, ddsd.ddpfPixelFormat.dwRGBBitCount, ddsd.dwWidth, ddsd.dwHeight, ddsd.lpSurface);
|
||||
w = ddsd.dwWidth;
|
||||
h = ddsd.dwHeight;
|
||||
iSurfaceSize = ddsd.dwHeight * ddsd.lPitch;
|
||||
@ -406,7 +406,7 @@ static void TextureHack(LPDIRECTDRAWSURFACE s, int dxversion)
|
||||
FILE *hf;
|
||||
BITMAPFILEHEADER hdr; // bitmap file-header
|
||||
BITMAPINFOHEADER pbi; // bitmap info-header
|
||||
char pszFile[81];
|
||||
char pszFile[MAX_PATH];
|
||||
int iSizeImage;
|
||||
|
||||
// calculate the bitmap hash
|
||||
|
@ -1171,16 +1171,18 @@ void dxwCore::FixWindowFrame(HWND hwnd)
|
||||
OutTraceDW("FixWindowFrame: hwnd=%x foreground=%x\n", hwnd, GetForegroundWindow());
|
||||
|
||||
nStyle=(*pGetWindowLong)(hwnd, GWL_STYLE);
|
||||
if (!nStyle){
|
||||
OutTraceE("FixWindowFrame: GetWindowLong ERROR %d at %d\n",GetLastError(),__LINE__);
|
||||
return;
|
||||
}
|
||||
// beware: 0 is a valid return code!
|
||||
//if (!nStyle){
|
||||
// OutTraceE("FixWindowFrame: GetWindowLong ERROR %d at %d\n",GetLastError(),__LINE__);
|
||||
// return;
|
||||
//}
|
||||
|
||||
nExStyle=(*pGetWindowLong)(hwnd, GWL_EXSTYLE);
|
||||
if (!nExStyle){
|
||||
OutTraceE("FixWindowFrame: GetWindowLong ERROR %d at %d\n",GetLastError(),__LINE__);
|
||||
return;
|
||||
}
|
||||
// beware: 0 is a valid return code!
|
||||
//if (!nExStyle){
|
||||
// OutTraceE("FixWindowFrame: GetWindowLong ERROR %d at %d\n",GetLastError(),__LINE__);
|
||||
// return;
|
||||
//}
|
||||
|
||||
OutTraceDW("FixWindowFrame: style=%x(%s) exstyle=%x(%s)\n",
|
||||
nStyle, ExplainStyle(nStyle),
|
||||
|
@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "TlHelp32.h"
|
||||
|
||||
#define VERSION "2.04.06.fx4"
|
||||
#define VERSION "2.04.07.fx1"
|
||||
|
||||
#define DDTHREADLOCK 1
|
||||
|
||||
|
Binary file not shown.
@ -509,6 +509,10 @@
|
||||
RelativePath=".\opengl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\queryint.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\shareddc.cpp"
|
||||
>
|
||||
|
123
dll/hd3d7.cpp
123
dll/hd3d7.cpp
@ -13,6 +13,8 @@
|
||||
//#define OutTraceD3D OutTrace
|
||||
|
||||
extern LPDIRECTDRAW lpPrimaryDD;
|
||||
typedef HRESULT (WINAPI *QueryInterface_Type)(void *, REFIID, LPVOID *);
|
||||
extern HRESULT WINAPI extQueryInterfaceDX(int, QueryInterface_Type, void *, REFIID, LPVOID *);
|
||||
|
||||
// exported API
|
||||
|
||||
@ -310,7 +312,6 @@ HRESULT WINAPI extExecute(void *, LPDIRECT3DEXECUTEBUFFER, LPDIRECT3DVIEWPORT, D
|
||||
Execute_Type pExecute = NULL;
|
||||
|
||||
extern char *ExplainDDError(DWORD);
|
||||
int GD3DDeviceVersion;
|
||||
|
||||
static char *sFourCC(DWORD fcc)
|
||||
{
|
||||
@ -504,7 +505,6 @@ void HookDirect3DSession(LPDIRECTDRAW *lplpdd, int d3dversion)
|
||||
void HookDirect3DDevice(void **lpd3ddev, int d3dversion)
|
||||
{
|
||||
OutTraceD3D("HookDirect3DDevice: d3ddev=%x d3dversion=%d\n", lpd3ddev, d3dversion);
|
||||
GD3DDeviceVersion = d3dversion;
|
||||
|
||||
switch(d3dversion){
|
||||
case 1:
|
||||
@ -525,7 +525,7 @@ void HookDirect3DDevice(void **lpd3ddev, int d3dversion)
|
||||
SetHook((void *)(**(DWORD **)lpd3ddev + 0), extQueryInterfaceD3D2, (void **)&pQueryInterfaceD3D2, "QueryInterface(D3DD2)");
|
||||
SetHook((void *)(**(DWORD **)lpd3ddev + 8), extReleaseD3D2, (void **)&pReleaseD3D2, "ReleaseD3D(2)");
|
||||
SetHook((void *)(**(DWORD **)lpd3ddev + 12), extD3DGetCaps2, (void **)&pD3DGetCaps2, "GetCaps(2)");
|
||||
SetHook((void *)(**(DWORD **)lpd3ddev + 16), extSwapTextureHandles, (void **)&pSwapTextureHandles, "SwapTextureHandles(2)");
|
||||
SetHook((void *)(**(DWORD **)lpd3ddev + 16), extSwapTextureHandles2, (void **)&pSwapTextureHandles2, "SwapTextureHandles(2)");
|
||||
SetHook((void *)(**(DWORD **)lpd3ddev + 24), extAddViewport2, (void **)&pAddViewport2, "AddViewport(2)");
|
||||
SetHook((void *)(**(DWORD **)lpd3ddev + 28), extDeleteViewport2, (void **)&pDeleteViewport2, "DeleteViewport(2)");
|
||||
SetHook((void *)(**(DWORD **)lpd3ddev + 32), extNextViewport2, (void **)&pNextViewport2, "NextViewport(2)");
|
||||
@ -702,118 +702,23 @@ void HookTexture(LPVOID *lpTexture, int version)
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT WINAPI extQueryInterfaceD3(int d3dversion, QueryInterfaceD3_Type pQueryInterfaceD3, void *lpd3d, REFIID riid, LPVOID *obp)
|
||||
{
|
||||
HRESULT res;
|
||||
unsigned int dwLocalDDVersion;
|
||||
unsigned int dwLocalD3DVersion;
|
||||
|
||||
res = (*pQueryInterfaceD3)(lpd3d, riid, obp);
|
||||
OutTraceDDRAW("QueryInterface(D3D%d): lpdd=%x REFIID=%x(%s) obp=%x ret=%x at %d\n",
|
||||
d3dversion, lpd3d, riid.Data1, ExplainGUID((GUID *)&riid), *obp, res, __LINE__);
|
||||
|
||||
if(res) {
|
||||
OutTraceE("QueryInterface(D3D) ERROR: res=%x(%s)\n", res, ExplainDDError(res));
|
||||
return res;
|
||||
}
|
||||
|
||||
dwLocalDDVersion=0;
|
||||
dwLocalD3DVersion=0;
|
||||
switch(riid.Data1){
|
||||
case 0x6C14DB80: //DirectDraw1
|
||||
dwLocalDDVersion = 1;
|
||||
break;
|
||||
case 0xB3A6F3E0: //DirectDraw2
|
||||
dwLocalDDVersion = 2;
|
||||
break;
|
||||
case 0x618f8ad4: //DirectDraw3
|
||||
dwLocalDDVersion = 3;
|
||||
break;
|
||||
case 0x9c59509a: //DirectDraw4
|
||||
dwLocalDDVersion = 4;
|
||||
break;
|
||||
case 0x15e65ec0: //DirectDraw7
|
||||
dwLocalDDVersion = 7;
|
||||
break;
|
||||
case 0x3BBA0080: //Direct3D
|
||||
dwLocalD3DVersion = 1;
|
||||
break;
|
||||
case 0x6aae1ec1: //Direct3D2
|
||||
dwLocalD3DVersion = 2;
|
||||
break;
|
||||
case 0xbb223240: //Direct3D3
|
||||
dwLocalD3DVersion = 3;
|
||||
break;
|
||||
case 0xf5049e77: //Direct3D7
|
||||
dwLocalD3DVersion = 7;
|
||||
break;
|
||||
}
|
||||
if (! *obp){
|
||||
OutTraceDDRAW("QueryInterface(D): Interface for DX version %d not found\n", dwLocalDDVersion);
|
||||
return(0);
|
||||
}
|
||||
if(dwLocalDDVersion) OutTraceDW("QueryInterface(D): Got interface for DX version %d\n", dwLocalDDVersion);
|
||||
if(dwLocalD3DVersion) OutTraceDW("QueryInterface(D): Got interface for D3D version %d\n", dwLocalD3DVersion);
|
||||
|
||||
if (dwLocalDDVersion > dxw.dwMaxDDVersion) {
|
||||
*obp = NULL;
|
||||
OutTraceDW("QueryInterface(D): lpdd=%x REFIID=%x obp=(NULL) ret=%x at %d\n",
|
||||
lpd3d, riid.Data1, res, __LINE__);
|
||||
return(0);
|
||||
}
|
||||
|
||||
switch (dwLocalDDVersion){
|
||||
case 1: // you never know ....
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 7:
|
||||
dxw.dwDDVersion=dwLocalDDVersion;
|
||||
extern void HookDDSession(LPDIRECTDRAW *, int);
|
||||
HookDDSession((LPDIRECTDRAW *)obp, dxw.dwDDVersion);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (dwLocalD3DVersion){
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 7:
|
||||
HookDirect3DSession((LPDIRECTDRAW *)obp, dwLocalD3DVersion);
|
||||
break;
|
||||
}
|
||||
|
||||
OutTraceDDRAW("QueryInterface(D3D): lpdd=%x REFIID=%x obp=%x DDVersion=%d ret=0\n",
|
||||
lpd3d, riid.Data1, *obp, dxw.dwDDVersion);
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI extQueryInterfaceD31(void *lpd3d, REFIID riid, LPVOID *ppvObj)
|
||||
{ return extQueryInterfaceD3(1, pQueryInterfaceD31, lpd3d, riid, ppvObj); }
|
||||
{ return extQueryInterfaceDX(1, pQueryInterfaceD31, lpd3d, riid, ppvObj); }
|
||||
HRESULT WINAPI extQueryInterfaceD32(void *lpd3d, REFIID riid, LPVOID *ppvObj)
|
||||
{ return extQueryInterfaceD3(2, pQueryInterfaceD32, lpd3d, riid, ppvObj); }
|
||||
{ return extQueryInterfaceDX(2, pQueryInterfaceD32, lpd3d, riid, ppvObj); }
|
||||
HRESULT WINAPI extQueryInterfaceD33(void *lpd3d, REFIID riid, LPVOID *ppvObj)
|
||||
{ return extQueryInterfaceD3(3, pQueryInterfaceD33, lpd3d, riid, ppvObj); }
|
||||
{ return extQueryInterfaceDX(3, pQueryInterfaceD33, lpd3d, riid, ppvObj); }
|
||||
HRESULT WINAPI extQueryInterfaceD37(void *lpd3d, REFIID riid, LPVOID *ppvObj)
|
||||
{ return extQueryInterfaceD3(7, pQueryInterfaceD37, lpd3d, riid, ppvObj); }
|
||||
|
||||
HRESULT WINAPI extQueryInterfaceD3D(int d3dversion, QueryInterfaceD3D_Type pQueryInterface, void *lpd3ddev, REFIID riid, LPVOID *ppvObj)
|
||||
{
|
||||
HRESULT res;
|
||||
OutTraceD3D("QueryInterface(D3DD%d): d3ddev=%x REFIID=%x obj=%x\n", d3dversion, lpd3ddev, riid.Data1, ppvObj);
|
||||
res=(*pQueryInterface)(lpd3ddev, riid, ppvObj);
|
||||
return res;
|
||||
}
|
||||
{ return extQueryInterfaceDX(7, pQueryInterfaceD37, lpd3d, riid, ppvObj); }
|
||||
|
||||
HRESULT WINAPI extQueryInterfaceD3D1(void *lpd3ddev, REFIID riid, LPVOID *ppvObj)
|
||||
{ return extQueryInterfaceD3D(1, pQueryInterfaceD3D1, lpd3ddev, riid, ppvObj); }
|
||||
{ return extQueryInterfaceDX(1, pQueryInterfaceD3D1, lpd3ddev, riid, ppvObj); }
|
||||
HRESULT WINAPI extQueryInterfaceD3D2(void *lpd3ddev, REFIID riid, LPVOID *ppvObj)
|
||||
{ return extQueryInterfaceD3D(2, pQueryInterfaceD3D2, lpd3ddev, riid, ppvObj); }
|
||||
{ return extQueryInterfaceDX(2, pQueryInterfaceD3D2, lpd3ddev, riid, ppvObj); }
|
||||
HRESULT WINAPI extQueryInterfaceD3D3(void *lpd3ddev, REFIID riid, LPVOID *ppvObj)
|
||||
{ return extQueryInterfaceD3D(3, pQueryInterfaceD3D3, lpd3ddev, riid, ppvObj); }
|
||||
{ return extQueryInterfaceDX(3, pQueryInterfaceD3D3, lpd3ddev, riid, ppvObj); }
|
||||
HRESULT WINAPI extQueryInterfaceD3D7(void *lpd3ddev, REFIID riid, LPVOID *ppvObj)
|
||||
{ return extQueryInterfaceD3D(7, pQueryInterfaceD3D7, lpd3ddev, riid, ppvObj); }
|
||||
{ return extQueryInterfaceDX(7, pQueryInterfaceD3D7, lpd3ddev, riid, ppvObj); }
|
||||
|
||||
ULONG WINAPI extReleaseD3D(int d3dversion, ReleaseD3D_Type pReleaseD3D, LPDIRECT3DDEVICE lpd3dd)
|
||||
{
|
||||
@ -1021,7 +926,7 @@ HRESULT WINAPI extCreateMaterial1(void *lpd3d, LPDIRECT3DMATERIAL *lpMaterial, I
|
||||
res=(*pCreateMaterial1)(lpd3d, lpMaterial, p0);
|
||||
if(res) OutTraceE("CreateMaterial ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
else OutTraceD3D("CreateMaterial: OK\n");
|
||||
HookMaterial(lpMaterial, GD3DDeviceVersion);
|
||||
HookMaterial(lpMaterial, 0);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -1033,7 +938,7 @@ HRESULT WINAPI extCreateMaterial2(void *lpd3d, LPDIRECT3DMATERIAL2 *lpMaterial,
|
||||
res=(*pCreateMaterial2)(lpd3d, lpMaterial, p0);
|
||||
if(res) OutTraceE("CreateMaterial ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
else OutTraceD3D("CreateMaterial: OK\n");
|
||||
//HookMaterial(lpMaterial, GD3DDeviceVersion);
|
||||
//HookMaterial(lpMaterial, 0);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -1045,7 +950,7 @@ HRESULT WINAPI extCreateMaterial3(void *lpd3d, LPDIRECT3DMATERIAL3 *lpMaterial,
|
||||
res=(*pCreateMaterial3)(lpd3d, lpMaterial, p0);
|
||||
if(res) OutTraceE("CreateMaterial ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
else OutTraceD3D("CreateMaterial: OK\n");
|
||||
//HookMaterial(lpMaterial, GD3DDeviceVersion);
|
||||
//HookMaterial(lpMaterial, 0);
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
226
dll/queryint.cpp
Normal file
226
dll/queryint.cpp
Normal file
@ -0,0 +1,226 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#include <windows.h>
|
||||
#include <d3d.h>
|
||||
#include <stdio.h>
|
||||
#include "dxwnd.h"
|
||||
#include "dxwcore.hpp"
|
||||
#include "dxhook.h"
|
||||
#include "syslibs.h"
|
||||
#include "dxhelper.h"
|
||||
#include "hddraw.h"
|
||||
|
||||
extern void HookDDSurface(LPDIRECTDRAWSURFACE *, int, BOOL);
|
||||
extern void HookGammaControl(LPVOID *);
|
||||
extern void HookDDSession(LPDIRECTDRAW *, int);
|
||||
extern void HookDirect3DSession(LPDIRECTDRAW *, int);
|
||||
extern void HookDirect3DDevice(LPVOID *, int);
|
||||
extern void HookViewport(LPDIRECT3DVIEWPORT *, int);
|
||||
|
||||
// extQueryInterfaceDX: this is the single procedure that manages all QueryInterface methods within the DirectX classes
|
||||
// it is better to have it unique because of the transitive and reflexive properties of QueryInterface, that means
|
||||
// that every DirectX COM object can QueryInterface itself to become another object type belonging to this family.
|
||||
|
||||
// some unhandled interfaces in emulation mode:
|
||||
// REFIID={84e63de0-46aa-11cf-816f-0000c020156e}: IID_IDirect3DHALDevice
|
||||
|
||||
typedef enum {
|
||||
TYPE_OBJECT_UNKNOWN = 0,
|
||||
TYPE_OBJECT_DIRECTDRAW,
|
||||
TYPE_OBJECT_DDRAWSURFACE,
|
||||
TYPE_OBJECT_DIRECT3D,
|
||||
TYPE_OBJECT_D3DDEVICE,
|
||||
TYPE_OBJECT_GAMMARAMP,
|
||||
TYPE_OBJECT_TEXTURE,
|
||||
TYPE_OBJECT_VIEWPORT };
|
||||
|
||||
HRESULT WINAPI extQueryInterfaceDX(int dxversion, QueryInterface_Type pQueryInterface, void *lpdds, REFIID riid, LPVOID *obp)
|
||||
{
|
||||
HRESULT res;
|
||||
BOOL IsPrim;
|
||||
BOOL IsBack;
|
||||
int iObjectType;
|
||||
int iObjectVersion;
|
||||
extern LPDIRECTDRAWSURFACE lpDDSEmu_Prim;
|
||||
|
||||
IsPrim=dxwss.IsAPrimarySurface((LPDIRECTDRAWSURFACE)lpdds);
|
||||
IsBack=dxwss.IsABackBufferSurface((LPDIRECTDRAWSURFACE)lpdds);
|
||||
OutTraceDDRAW("QueryInterface(%d): lpdds=%x%s REFIID=%x(%s)\n",
|
||||
dxversion, lpdds, dxwss.ExplainSurfaceRole((LPDIRECTDRAWSURFACE)lpdds), riid.Data1, ExplainGUID((GUID *)&riid));
|
||||
|
||||
iObjectVersion = 0;
|
||||
switch(riid.Data1){
|
||||
// DirectDraw
|
||||
case 0x6C14DB80: // IID_IDirectDraw
|
||||
iObjectType=TYPE_OBJECT_DIRECTDRAW; iObjectVersion=1; break;
|
||||
case 0xB3A6F3E0: // IID_IDirectDraw2
|
||||
iObjectType=TYPE_OBJECT_DIRECTDRAW; iObjectVersion=2; break;
|
||||
case 0x618f8ad4: // IID_IDirectDraw3
|
||||
iObjectType=TYPE_OBJECT_DIRECTDRAW; iObjectVersion=3; break;
|
||||
case 0x9c59509a: // IID_IDirectDraw4
|
||||
iObjectType=TYPE_OBJECT_DIRECTDRAW; iObjectVersion=4; break;
|
||||
case 0x15e65ec0: // IID_IDirectDraw7
|
||||
iObjectType=TYPE_OBJECT_DIRECTDRAW; iObjectVersion=7; break;
|
||||
// DirectDrawSurface
|
||||
case 0x6C14DB81:
|
||||
iObjectType=TYPE_OBJECT_DDRAWSURFACE; iObjectVersion=1; break;
|
||||
case 0x57805885: //DDSurface2 - WIP (Dark Reign)
|
||||
iObjectType=TYPE_OBJECT_DDRAWSURFACE; iObjectVersion=2; break;
|
||||
case 0xDA044E00:
|
||||
iObjectType=TYPE_OBJECT_DDRAWSURFACE; iObjectVersion=3; break;
|
||||
case 0x0B2B8630:
|
||||
iObjectType=TYPE_OBJECT_DDRAWSURFACE; iObjectVersion=4; break;
|
||||
case 0x06675a80:
|
||||
iObjectType=TYPE_OBJECT_DDRAWSURFACE; iObjectVersion=7; break;
|
||||
// Direct3D
|
||||
case 0x3BBA0080: // IID_IDirect3D
|
||||
iObjectType=TYPE_OBJECT_DIRECT3D; iObjectVersion=1; break;
|
||||
case 0x6aae1ec1: // IID_IDirect3D2
|
||||
iObjectType=TYPE_OBJECT_DIRECT3D; iObjectVersion=2; break;
|
||||
case 0xbb223240: // IID_IDirect3D3
|
||||
iObjectType=TYPE_OBJECT_DIRECT3D; iObjectVersion=3; break;
|
||||
case 0xf5049e77: // IID_IDirect3D7
|
||||
iObjectType=TYPE_OBJECT_DIRECT3D; iObjectVersion=7; break;
|
||||
// Direct3DDevice
|
||||
case 0x84e63de0: // IID_IDirect3DHALDevice
|
||||
iObjectType=TYPE_OBJECT_D3DDEVICE; iObjectVersion=1; break;
|
||||
case 0xA4665C60: // IID_IDirect3DRGBDevice
|
||||
iObjectType=TYPE_OBJECT_D3DDEVICE; iObjectVersion=1; break;
|
||||
case 0xF2086B20: // IID_IDirect3DRampDevice
|
||||
iObjectType=TYPE_OBJECT_D3DDEVICE; iObjectVersion=1; break;
|
||||
case 0x881949a1: // IID_IDirect3DMMXDevice
|
||||
iObjectType=TYPE_OBJECT_D3DDEVICE; iObjectVersion=1; break;
|
||||
case 0x50936643: // IID_IDirect3DRefDevice
|
||||
iObjectType=TYPE_OBJECT_D3DDEVICE; iObjectVersion=2; break;
|
||||
case 0x8767df22: // IID_IDirect3DNullDevice
|
||||
iObjectType=TYPE_OBJECT_D3DDEVICE; iObjectVersion=2; break;
|
||||
case 0xf5049e78: // IID_IDirect3DTnLHalDevice,
|
||||
iObjectType=TYPE_OBJECT_D3DDEVICE; iObjectVersion=3; break;
|
||||
case 0x64108800: // IID_IDirect3DDevice
|
||||
iObjectType=TYPE_OBJECT_D3DDEVICE; iObjectVersion=1; break;
|
||||
case 0x93281501: // IID_IDirect3DDevice2
|
||||
iObjectType=TYPE_OBJECT_D3DDEVICE; iObjectVersion=2; break;
|
||||
case 0xb0ab3b60: // IID_IDirect3DDevice3
|
||||
iObjectType=TYPE_OBJECT_D3DDEVICE; iObjectVersion=3; break;
|
||||
case 0xf5049e79: // IID_IDirect3DDevice7
|
||||
iObjectType=TYPE_OBJECT_D3DDEVICE; iObjectVersion=7; break;
|
||||
case 0x4B9F0EE0:
|
||||
OutTraceDW("QueryInterface: IID_IDirectDrawColorControl\n");
|
||||
break;
|
||||
case 0x69C11C3E:
|
||||
iObjectType=TYPE_OBJECT_GAMMARAMP; iObjectVersion=1; break;
|
||||
// textures
|
||||
case 0x2CDCD9E0:
|
||||
iObjectType=TYPE_OBJECT_TEXTURE; iObjectVersion=1; break;
|
||||
case 0x93281502:
|
||||
iObjectType=TYPE_OBJECT_TEXTURE; iObjectVersion=2; break;
|
||||
case 0x4417C146: //IID_IDirect3DViewport
|
||||
iObjectType=TYPE_OBJECT_VIEWPORT; iObjectVersion=1; break;
|
||||
case 0x93281500: //IID_IDirect3DViewport2
|
||||
iObjectType=TYPE_OBJECT_VIEWPORT; iObjectVersion=2; break;
|
||||
case 0xb0ab3b61: //IID_IDirect3DViewport3
|
||||
iObjectType=TYPE_OBJECT_VIEWPORT; iObjectVersion=3; break;
|
||||
}
|
||||
|
||||
char *sLabel;
|
||||
switch(iObjectType){
|
||||
case TYPE_OBJECT_UNKNOWN: sLabel = "(unknown)"; break;
|
||||
case TYPE_OBJECT_DIRECTDRAW: sLabel = "IID_IDirectDraw"; break;
|
||||
case TYPE_OBJECT_DDRAWSURFACE: sLabel = "IID_IDirectDrawSurface"; break;
|
||||
case TYPE_OBJECT_DIRECT3D: sLabel = "IID_IDirect3D"; break;
|
||||
case TYPE_OBJECT_D3DDEVICE: sLabel = "IID_IDirect3DDevice"; break;
|
||||
case TYPE_OBJECT_GAMMARAMP: sLabel = "IID_IDirectDrawGammaRamp"; break;
|
||||
case TYPE_OBJECT_TEXTURE: sLabel = "IID_IDirect3DTexture"; break;
|
||||
case TYPE_OBJECT_VIEWPORT: sLabel = "IID_IDirect3DViewport"; break;
|
||||
}
|
||||
OutTraceDW("QueryInterface: Got interface for %s version %d\n", sLabel, iObjectVersion);
|
||||
|
||||
switch(iObjectType){
|
||||
// simulate unavailable interfaces (useful?)
|
||||
case TYPE_OBJECT_DIRECTDRAW:
|
||||
if (iObjectVersion > (int)dxw.dwMaxDDVersion) {
|
||||
*obp = NULL;
|
||||
OutTraceDW("QueryInterface: DDVersion=%d SUPPRESS lpdds=%x(%s) REFIID=%x obp=(NULL) ret=0 at %d\n",
|
||||
iObjectVersion, lpdds, IsPrim?"":"(PRIM)", riid.Data1, __LINE__);
|
||||
return(0);
|
||||
}
|
||||
break;
|
||||
case TYPE_OBJECT_DDRAWSURFACE:
|
||||
if (iObjectVersion > (int)dxw.dwMaxDDVersion) {
|
||||
*obp = NULL;
|
||||
OutTraceDW("QueryInterface: DDSVersion=%d SUPPRESS lpdds=%x(%s) REFIID=%x obp=(NULL) ret=0 at %d\n",
|
||||
iObjectVersion, lpdds, IsPrim?"":"(PRIM)", riid.Data1, __LINE__);
|
||||
return(0);
|
||||
}
|
||||
break;
|
||||
case TYPE_OBJECT_GAMMARAMP:
|
||||
// fix the target for gamma ramp creation: if it is a primary surface, use the real one!!
|
||||
// v2.03.37: do this just when in esurface emulated mode!!
|
||||
if((dxw.dwFlags1 & EMULATESURFACE) &&
|
||||
dxwss.IsAPrimarySurface((LPDIRECTDRAWSURFACE)lpdds))
|
||||
lpdds = lpDDSEmu_Prim;
|
||||
break;
|
||||
}
|
||||
|
||||
res = (*pQueryInterface)(lpdds, riid, obp);
|
||||
|
||||
if(res) {
|
||||
OutTraceDW("QueryInterface: ERROR lpdds=%x%s REFIID=%x obp=%x ret=%x(%s) at %d\n",
|
||||
lpdds, IsPrim?"(PRIM)":"", riid.Data1, *obp, res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
|
||||
if (! *obp) {
|
||||
OutTraceDW("QueryInterface: Interface for object %x not found\n", riid.Data1);
|
||||
return res;
|
||||
}
|
||||
|
||||
// added trace
|
||||
OutTraceDW("QueryInterface: lpdds=%x%s REFIID=%x obp=%x obj=%s version=%d ret=0\n",
|
||||
lpdds, IsPrim?"(PRIM)":"", riid.Data1, *obp, sLabel, iObjectVersion);
|
||||
|
||||
// --------- here .....
|
||||
switch(iObjectType){
|
||||
// simulate unavailable interfaces (useful?)
|
||||
case TYPE_OBJECT_DIRECTDRAW:
|
||||
HookDDSession((LPDIRECTDRAW *)obp, iObjectVersion);
|
||||
break;
|
||||
case TYPE_OBJECT_DDRAWSURFACE:
|
||||
dxw.dwDDVersion=iObjectVersion;
|
||||
if(IsPrim){
|
||||
OutTraceDW("QueryInterface(S): primary=%x new=%x\n", lpdds, *obp);
|
||||
dxwss.PushPrimarySurface((LPDIRECTDRAWSURFACE)*obp, iObjectVersion);
|
||||
HookDDSurface((LPDIRECTDRAWSURFACE *)obp, dxw.dwDDVersion, TRUE);
|
||||
}
|
||||
else{
|
||||
if(IsBack) dxwss.PushBackBufferSurface((LPDIRECTDRAWSURFACE)*obp, iObjectVersion);
|
||||
else dxwss.PopSurface((LPDIRECTDRAWSURFACE)*obp);
|
||||
// v2.02.13: seems that hooking inconditionally gives troubles. What is the proper safe hook condition?
|
||||
HookDDSurface((LPDIRECTDRAWSURFACE *)obp, dxw.dwDDVersion, FALSE);
|
||||
}
|
||||
DWORD dwCaps;
|
||||
if (dwCaps = dxwcdb.GetCaps((LPDIRECTDRAWSURFACE)lpdds)) {
|
||||
OutTrace("QueryInterface(S): PASS caps=%x lpdds=%x->%x\n", dwCaps, lpdds, *obp);
|
||||
dxwcdb.PushCaps(*(LPDIRECTDRAWSURFACE *)obp,dwCaps);
|
||||
}
|
||||
break;
|
||||
case TYPE_OBJECT_DIRECT3D:
|
||||
HookDirect3DSession((LPDIRECTDRAW *)obp, iObjectVersion);
|
||||
break;
|
||||
case TYPE_OBJECT_D3DDEVICE:
|
||||
HookDirect3DDevice(obp, iObjectVersion);
|
||||
break;
|
||||
case TYPE_OBJECT_GAMMARAMP:
|
||||
HookGammaControl(obp);
|
||||
break;
|
||||
case TYPE_OBJECT_TEXTURE:
|
||||
HookTexture(obp, iObjectVersion);
|
||||
break;
|
||||
case TYPE_OBJECT_VIEWPORT:
|
||||
HookViewport((LPDIRECT3DVIEWPORT *)obp, iObjectVersion);
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user