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

v2_02_46_src

Former-commit-id: f755724f890c4d45c7430632af9ba91aeb2268ca
This commit is contained in:
gho tik 2013-03-12 12:38:32 -04:00 committed by Refael ACkermann
parent 573a89d129
commit 904be61ef6
39 changed files with 1584 additions and 4841 deletions

View File

@ -64,7 +64,7 @@
#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 SHOWHWCURSOR 0x00080000 // enable hardware cursor
#define HOOKGDI 0x00100000 // Hook GDI functions
#define SHOWFPSOVERLAY 0x00200000 // shows FPS value to status win / log / screen overlay
#define FAKEVERSION 0x00400000 // pretends the platvorm is a given window version / subversion

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cf9c7d5fd45f8f880656efab5c5db5ef3a0a8e74942d2b2418bf5a49f8fab39b
oid sha256:c96cb2622942095b2b952937cc60ce9ba524aaf8921ddfc68088c370d79d2ff1
size 426496

File diff suppressed because it is too large Load Diff

View File

@ -5,11 +5,11 @@ module0=
opengllib0=
ver0=0
coord0=0
flag0=134234146
flagg0=134217728
flagh0=65556
flagi0=0
tflag0=67
flag0=134234150
flagg0=1207959552
flagh0=20
flagi0=4
tflag0=0
initx0=0
inity0=0
minx0=0

View File

@ -0,0 +1,24 @@
[target]
title0=A10 Cuba
path0=D:\Games\A10\A10Cuba.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=671096866
flagg0=1207959568
flagh0=20
flagi0=4
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -0,0 +1,24 @@
[target]
title0=Actua Soccer 3
path0=D:\Games\ActuaSoccer3\SOCCER3D.EXE
module0=
opengllib0=
ver0=0
coord0=0
flag0=671088674
flagg0=1207959552
flagh0=20
flagi0=4
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -5,7 +5,7 @@ module0=
opengllib0=
ver0=0
coord0=0
flag0=-394125278
flag0=1753358370
flagg0=134217728
flagh0=20
flagi0=0

View File

@ -0,0 +1,24 @@
[target]
title0=Beavis & Butthead Do U.
path0=D:\Games\B_b\BEAVIS.EXE
module0=
opengllib0=
ver0=0
coord0=0
flag0=671090722
flagg0=1207959552
flagh0=32788
flagi0=0
tflag0=3
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -0,0 +1,24 @@
[target]
title0=Black & White
path0=D:\Games\Black & White\runblack.exe
module0=
opengllib0=
ver0=0
coord0=1
flag0=679477280
flagg0=1207959568
flagh0=20
flagi0=4
tflag0=259
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -0,0 +1,24 @@
[target]
title0=Carmageddon 2 (GLIDE)
path0=D:\Games\Carmageddon_2\carma2_HW.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217730
flagg0=1208025088
flagh0=20
flagi0=12
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -0,0 +1,24 @@
[target]
title0=Carmageddon 2 (SW)
path0=D:\Games\Carmageddon_2\carma2_SW.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=671088674
flagg0=1208025088
flagh0=33562644
flagi0=12
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -0,0 +1,24 @@
[target]
title0=Cave Story
path0=D:\Games\Cave Story\Doukutsu.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217762
flagg0=1207959552
flagh0=20
flagi0=4
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -0,0 +1,24 @@
[target]
title0=Crimson Skies
path0=D:\Games\Crimson_Skies\crimson.exe
module0=
opengllib0=
ver0=7
coord0=0
flag0=134234148
flagg0=1207959552
flagh0=20
flagi0=4
tflag0=259
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -5,9 +5,9 @@ module0=
opengllib0=
ver0=0
coord0=0
flag0=134217762
flag0=134217766
flagg0=1207959552
flagh0=16
flagh0=65556
flagi0=0
tflag0=67
initx0=0

View File

@ -6,7 +6,7 @@ opengllib0=
ver0=0
coord0=0
flag0=134217762
flagg0=134217728
flagg0=1207959552
flagh0=20
flagi0=0
tflag0=0

View File

@ -0,0 +1,24 @@
[target]
title0=F-16 Fighting Falcon
path0=D:\Games\F16\f1695.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217826
flagg0=1209008128
flagh0=20
flagi0=4
tflag0=259
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

24
build/exports/Fate.dxw Normal file
View File

@ -0,0 +1,24 @@
[target]
title0=Fate
path0=D:\Games\Fate\Fate.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217762
flagg0=1207959552
flagh0=20
flagi0=4
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -0,0 +1,24 @@
[target]
title0=Hitman - Codename 47
path0=D:\Games\Hitman - Codename 47\Hitman.Exe
module0=
opengllib0=
ver0=1
coord0=0
flag0=134234144
flagg0=1207959808
flagh0=20
flagi0=4
tflag0=3
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -0,0 +1,24 @@
[target]
title0=Hitman 2 Silent Assassin
path0=D:\Games\Hitman 2 Silent Assassin\hitman2.exe
module0=
opengllib0=
ver0=0
coord0=2
flag0=134234150
flagg0=1207959568
flagh0=20
flagi0=4
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -5,9 +5,9 @@ module0=
opengllib0=
ver0=0
coord0=0
flag0=671088642
flag0=671154178
flagg0=134217728
flagh0=477
flagh0=285
flagi0=0
tflag0=0
initx0=0

View File

@ -0,0 +1,24 @@
[target]
title0=Imperialism II
path0=D:\Games\Imperialism 2\imperialism II.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=679485474
flagg0=1209008128
flagh0=20
flagi0=4
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -0,0 +1,24 @@
[target]
title0=International Football 2000
path0=D:\Games\International Football 2000\MSIF2000.ICD
module0=
opengllib0=
ver0=0
coord0=0
flag0=150994976
flagg0=1207959552
flagh0=20
flagi0=4
tflag0=259
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -5,11 +5,11 @@ module0=
opengllib0=
ver0=0
coord0=0
flag0=134217760
flagg0=1207959552
flag0=134234148
flagg0=1207959808
flagh0=20
flagi0=0
tflag0=67
tflag0=3
initx0=0
inity0=0
minx0=0

View File

@ -0,0 +1,24 @@
[target]
title0=Pandemonium 2 (GLIDE)
path0=D:\Games\Pandemonium 2\pandy.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217762
flagg0=1207959552
flagh0=20
flagi0=4
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,3 +1,3 @@
Ancient Evil: working both in emulated / direct mode, but in emulated mode the cursor is not visible.
Whiteout: handling of IMultiMediaStream COM interface for intro movie
window handling for ddraw8 games - see WildFire with keep aspect ratio & client area
"devastation" intro movie - bad cooordinates

View File

@ -295,7 +295,7 @@ fix: recovered window destruction
fix: proper handling of MIPMAP and LOCALVIDMEM surfaces
fix: color depth handling - now when the program terminates the desktop is brought to the original color depth
v2.02.45
v2.02.44
Improved debug logging for all palette operations
fixed a bugged log causing the crash of Empire Earth in debug mode
added show time stretching flag - preliminary version. Some code cleaning as well.
@ -307,4 +307,8 @@ added interception for CoCreateInstance following cases:
case 0x49c47ce5: Module="amstream"; Class="CLSID_AMMultiMediaStream";
preliminary (proxed) interception for "GetActiveWindow" and "GetForegroundWindow"
v2.02.45
A small fix for ddraw 7 games that makes Praetorians playable, though with some problems!
v2.02.46
Fixed handling of user32 CreateDialogIndirectParam call to avoid processing in non fullscreen mode - fix necessary to start "Crimson Skies".

File diff suppressed because it is too large Load Diff

View File

@ -2746,7 +2746,14 @@ HRESULT WINAPI extGetAttachedSurface(int dxversion, GetAttachedSurface_Type pGet
}
#endif
// if not primary, just proxy the method
// this is yet to be proven utility.....
// v2.02.45: No - it prevents "Praetorians" to work!!! -> commented out.
//
//if (IsBack && (lpddsc->dwCaps & DDSCAPS_ZBUFFER) && lpDDZBuffer){
// *lplpddas = lpDDZBuffer;
// OutTraceD("GetAttachedSurface(%d): emulating ZBUFFER attach on BACKBUFFER lpddsadd=%x\n", dxversion, *lplpddas);
// return 0;
//}
// v2.1.81: fix to make "Silver" working: if the primary surface was created with
// backbuffercount == 2, the game expects some more surface to be attached to
@ -2755,13 +2762,6 @@ HRESULT WINAPI extGetAttachedSurface(int dxversion, GetAttachedSurface_Type pGet
// beware: "Snowboard Racer" fails if you return an attached surface anyhow! There,
// the primary surface was created with back buffer count == 1.
// this is yet to be proven utility.....
if (IsBack && (lpddsc->dwCaps & DDSCAPS_ZBUFFER) && lpDDZBuffer){
*lplpddas = lpDDZBuffer;
OutTraceD("GetAttachedSurface(%d): emulating ZBUFFER attach on BACKBUFFER lpddsadd=%x\n", dxversion, *lplpddas);
return 0;
}
if (IsBack && (DDSD_Prim.dwBackBufferCount > 1)){
*lplpddas = lpDDSBack;
OutTraceD("GetAttachedSurface(%d): DOUBLEBUFFER attached=%x\n", dxversion, *lplpddas);
@ -3010,8 +3010,7 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect,
res=0;
// blit only when source and dest surface are different. Should make ScreenRefresh faster.
if (lpdds != lpddssrc) {
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(lpddssrc);
if (dxw.dwFlags4 & SHOWTIMESTRETCH) dxw.ShowTimeStretching(lpddssrc);
dxw.ShowOverlay(lpddssrc);
if (IsDebug) BlitTrace("PRIM-NOEMU", lpsrcrect, &destrect, __LINE__);
res= (*pBlt)(lpdds, &destrect, lpddssrc, lpsrcrect, dwflags, lpddbltfx);
}
@ -3071,8 +3070,7 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect,
work on my PC.
*/
if(res==DDERR_UNSUPPORTED){
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(lpddssrc);
if (dxw.dwFlags4 & SHOWTIMESTRETCH) dxw.ShowTimeStretching(lpddssrc);
dxw.ShowOverlay(lpddssrc);
if (IsDebug) BlitTrace("UNSUPP", &emurect, &destrect, __LINE__);
res=(*pBlt)(lpDDSEmu_Prim, &destrect, lpddssrc, lpsrcrect, dwflags, lpddbltfx);
if (res) BlitError(res, lpsrcrect, &destrect, __LINE__);
@ -3110,8 +3108,7 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect,
lpDDSSource = lpdds;
}
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(lpDDSSource);
if (dxw.dwFlags4 & SHOWTIMESTRETCH) dxw.ShowTimeStretching(lpDDSSource);
dxw.ShowOverlay(lpDDSSource);
if (IsDebug) BlitTrace("BACK2PRIM", &emurect, &destrect, __LINE__);
res=(*pBlt)(lpDDSEmu_Prim, &destrect, lpDDSSource, &emurect, DDBLT_WAIT, 0);
@ -3301,7 +3298,7 @@ HRESULT WINAPI extCreatePalette(LPDIRECTDRAW lpdd, DWORD dwflags, LPPALETTEENTRY
OutTraceD("CreatePalette: dwFlags=%x(%s)\n", dwflags, ExplainCreatePaletteFlags(dwflags));
if(IsDebug && (dwflags & DDPCAPS_8BIT)) dxw.DumpPalette(256, lpddpa);
if (dwflags & ~(DDPCAPS_PRIMARYSURFACE|DDPCAPS_8BIT|DDPCAPS_ALLOW256|DDPCAPS_INITIALIZE_LEGACY)) STOPPER("Palette flags");
//if (dwflags & ~(DDPCAPS_PRIMARYSURFACE|DDPCAPS_8BIT|DDPCAPS_ALLOW256|DDPCAPS_INITIALIZE_LEGACY)) STOPPER("Palette flags");
if(dxw.dwFlags1 & EMULATESURFACE) dwflags &= ~DDPCAPS_PRIMARYSURFACE;
res = (*pCreatePalette)(lpdd, dwflags, lpddpa, lplpddp, pu);

View File

@ -917,6 +917,25 @@ void dxwCore::GetSystemTime(LPSYSTEMTIME lpSystemTime)
}
}
void dxwCore::ShowOverlay()
{
this->ShowOverlay(GetDC(hWnd));
}
void dxwCore::ShowOverlay(LPDIRECTDRAWSURFACE lpdds)
{
HDC hdc; // the working dc
if (FAILED(lpdds->GetDC(&hdc))) return;
this->ShowOverlay(hdc);
lpdds->ReleaseDC(hdc);
}
void dxwCore::ShowOverlay(HDC hdc)
{
if (dwFlags2 & SHOWFPSOVERLAY) ShowFPS(hdc);
if (dwFlags4 & SHOWTIMESTRETCH) ShowTimeStretching(hdc);
}
void dxwCore::ShowFPS()
{
this->ShowFPS(GetDC(hWnd));

View File

@ -71,8 +71,11 @@ public: // methods
void ShowTimeStretching(void);
void ShowFPS(HDC);
void ShowTimeStretching(HDC);
char *GetTSCaption(int);
void ShowOverlay();
void ShowOverlay(HDC);
void ShowOverlay(LPDIRECTDRAWSURFACE);
char *GetTSCaption(void);
char *GetTSCaption(int);
void DoSlow(int);
void ShowBanner(HWND);
POINT ScreenToClient(POINT);

View File

@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "dxwnd.h"
#include "dxwcore.hpp"
#define VERSION "2.02.44"
#define VERSION "2.02.46"
#define DDTHREADLOCK 1

Binary file not shown.

View File

@ -42,6 +42,7 @@ static HookEntry_Type Hooks[]={
{"StretchDIBits", (FARPROC)StretchDIBits, (FARPROC *)&pStretchDIBits, (FARPROC)extStretchDIBits},
//{"SetDIBitsToDevice", (FARPROC)NULL, (FARPROC *)&pSetDIBitsToDevice, (FARPROC)extSetDIBitsToDevice},
//{"CreateCompatibleBitmap", (FARPROC)NULL, (FARPROC *)&pCreateCompatibleBitmap, (FARPROC)extCreateCompatibleBitmap},
//{"SetMapMode", (FARPROC)NULL, (FARPROC *)NULL, (FARPROC)extSetMapMode},
{0, NULL, 0, 0} // terminator
};
@ -955,8 +956,7 @@ BOOL WINAPI extGDIBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
nHDest= nHeight;
dxw.MapClient(&nXDest, &nYDest, &nWDest, &nHDest);
res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop);
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest);
if (dxw.dwFlags4 & SHOWTIMESTRETCH) dxw.ShowTimeStretching(hdcDest);
dxw.ShowOverlay(hdcDest);
OutTrace("Debug: DC dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWDest, nHDest);
}
else if(WindowFromDC(hdcDest)==NULL){
@ -966,8 +966,7 @@ BOOL WINAPI extGDIBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
nHDest= nHeight;
dxw.MapWindow(&nXDest, &nYDest, &nWDest, &nHDest);
res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop);
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest);
if (dxw.dwFlags4 & SHOWTIMESTRETCH) dxw.ShowTimeStretching(hdcDest);
dxw.ShowOverlay(hdcDest);
OutTrace("Debug: NULL dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWDest, nHDest);
}
else{
@ -1004,8 +1003,7 @@ BOOL WINAPI extGDIPatBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
if (dxw.dwFlags3 & NOGDIBLT) return TRUE;
if (dxw.IsFullScreen()){
dxw.MapClient(&nXDest, &nYDest, &nWidth, &nHeight);
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest);
if (dxw.dwFlags4 & SHOWTIMESTRETCH) dxw.ShowTimeStretching(hdcDest);
dxw.ShowOverlay(hdcDest);
res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop);
}
else if(WindowFromDC(hdcDest)==NULL){
@ -1017,8 +1015,7 @@ BOOL WINAPI extGDIPatBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
else {
res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop);
}
if (IsToScreen && (dxw.dwFlags2 & SHOWFPSOVERLAY)) dxw.ShowFPS(hdcDest);
if (IsToScreen && (dxw.dwFlags4 & SHOWTIMESTRETCH)) dxw.ShowTimeStretching(hdcDest);
if (IsToScreen) dxw.ShowOverlay(hdcDest);
if(!res) OutTraceE("GDI.PatBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__);
return res;
@ -1053,8 +1050,7 @@ BOOL WINAPI extGDIStretchBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, in
}
res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, nWSrc, nHSrc, dwRop);
if (IsToScreen && (dxw.dwFlags2 & SHOWFPSOVERLAY)) dxw.ShowFPS(hdcDest);
if (IsToScreen && (dxw.dwFlags4 & SHOWTIMESTRETCH)) dxw.ShowTimeStretching(hdcDest);
if (IsToScreen) dxw.ShowOverlay(hdcDest);
if(!res) OutTraceE("GDI.StretchBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__);
return res;
}
@ -1801,6 +1797,14 @@ UINT WINAPI extSetSystemPaletteUse(HDC hdc, UINT uUsage)
return SYSPAL_NOSTATIC256;
}
#if 0
int WINAPI extSetMapMode(HDC hdc, int fnMapMode)
{
OutTraceD("SetMapMode: hdc=%x MapMode=%d\n", hdc, fnMapMode);
return TRUE;
}
#endif
#if 0
// to map:
// GetCurrentPositionEx

View File

@ -523,8 +523,7 @@ HRESULT WINAPI extPresent(void *pd3dd, CONST RECT *pSourceRect, CONST RECT *pDes
if (dxw.HandleFPS()) return D3D_OK;
// proxy ....
res=(*pPresent)(pd3dd, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS();
if (dxw.dwFlags4 & SHOWTIMESTRETCH) dxw.ShowTimeStretching();
dxw.ShowOverlay();
return res;
}

View File

@ -10,6 +10,7 @@ extern void HookModule(HMODULE, int);
static HookEntry_Type Hooks[]={
{"CoCreateInstance", NULL, (FARPROC *)&pCoCreateInstance, (FARPROC)extCoCreateInstance},
{"CoCreateInstanceEx", NULL, (FARPROC *)&pCoCreateInstanceEx, (FARPROC)extCoCreateInstanceEx},
{"CoInitialize", NULL, (FARPROC *)&pCoInitialize, (FARPROC)extCoInitialize},
{0, NULL, 0, 0} // terminator
};
@ -28,12 +29,91 @@ FARPROC Remap_ole32_ProcAddress(LPCSTR proc, HMODULE hModule)
return NULL;
}
// so far, there are 4 additional libraries that could be loaded by meand of a CoCreateInstance call....
#define ADDITIONAL_MODULE_COUNT 4
struct {
BOOL Hooked;
char *ModuleName;
} AddedModules[ADDITIONAL_MODULE_COUNT]=
{
{FALSE, "quartz"},
{FALSE, "ddrawex"},
{FALSE, "amstream"},
{FALSE, "dplayx"}
};
static void HookAdditionalModules()
{
for(int i=0; i<ADDITIONAL_MODULE_COUNT; i++){
if(!AddedModules[i].Hooked){
HMODULE hModule;
hModule=GetModuleHandle(AddedModules[i].ModuleName);
if(hModule){ // if not hooked yet...
HookModule(hModule, 0); // hook it and ..
AddedModules[i].Hooked=TRUE; // .. mark it as already hooked
OutTraceD("CoCreateInstance: hooked module=%s hmodule=%x\n", AddedModules[i].ModuleName, hModule);
CloseHandle(hModule);
}
}
}
}
// -------------------------------------------------------------------------------------
// Ole32 CoCreateInstance handling: you can create DirectDraw objects through it!
// utilized so far in a single game: Axiz & Allies
// -------------------------------------------------------------------------------------
static void HookDDSession(LPDIRECTDRAW *, int);
static HRESULT STDAPICALLTYPE myCoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID FAR* ppv)
{
HRESULT res;
res=(*pCoCreateInstance)(rclsid, pUnkOuter, dwClsContext, riid, ppv);
if(res)
OutTraceE("CoCreateInstance: ERROR res=%x\n", res);
else
OutTraceD("CoCreateInstance: ppv=%x->%x\n", *ppv, *(DWORD *)*ppv);
if (*(DWORD *)&rclsid==*(DWORD *)&CLSID_DirectDraw){
LPDIRECTDRAW lpOldDDraw;
OutTraceD("CoCreateInstance: CLSID_DirectDraw object\n");
switch (*(DWORD *)&riid){
case 0x6C14DB80:
OutTraceD("DirectDrawCreate: IID_DirectDraw RIID\n");
res=extDirectDrawCreate(NULL, (LPDIRECTDRAW *)&ppv, 0);
if(res)OutTraceD("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res));
break;
case 0xB3A6F3E0:
OutTraceD("DirectDrawCreate: IID_DirectDraw2 RIID\n");
res=extDirectDrawCreate(NULL, &lpOldDDraw, 0);
if(res)OutTraceD("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res));
res=lpOldDDraw->QueryInterface(IID_IDirectDraw2, (LPVOID *)&ppv);
if(res)OutTraceD("QueryInterface: res=%x(%s)\n", res, ExplainDDError(res));
lpOldDDraw->Release();
break;
case 0x9c59509a:
OutTraceD("DirectDrawCreate: IID_DirectDraw4 RIID\n");
res=extDirectDrawCreate(NULL, &lpOldDDraw, 0);
if(res)OutTraceD("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res));
res=lpOldDDraw->QueryInterface(IID_IDirectDraw4, (LPVOID *)&ppv);
if(res)OutTraceD("QueryInterface: res=%x(%s)\n", res, ExplainDDError(res));
lpOldDDraw->Release();
case 0x15e65ec0:
OutTraceD("CoCreateInstance: IID_DirectDraw7 RIID\n");
res=extDirectDrawCreateEx(NULL, (LPDIRECTDRAW *)&ppv, IID_IDirectDraw7, 0);
if(res)OutTraceD("DirectDrawCreateEx: res=%x(%s)\n", res, ExplainDDError(res));
break;
case 0xe436ebb3:
break;
}
}
else
if (*(DWORD *)&rclsid==*(DWORD *)&CLSID_DxDiagProvider) res=HookDxDiag(riid, ppv);
HookAdditionalModules();
return res;
}
HRESULT STDAPICALLTYPE extCoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID FAR* ppv)
{
@ -83,26 +163,7 @@ HRESULT STDAPICALLTYPE extCoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter,
else
if (*(DWORD *)&rclsid==*(DWORD *)&CLSID_DxDiagProvider) res=HookDxDiag(riid, ppv);
// hook of library modules loaded by CoCreateInstance without going through LoadLibrary call....
char *Module=NULL;
char *Class=NULL;
HMODULE hModule=NULL;
switch (*(DWORD *)&rclsid){
case 0xe436ebb3: Module="quartz"; Class="CLSID_FilterGraph"; break;
case 0x4fd2a832: Module="ddrawex"; Class="CLSID_DirectDrawEx"; break;
case 0x49c47ce5: Module="amstream"; Class="CLSID_AMMultiMediaStream"; break;
}
if(Module){
hModule=GetModuleHandle(Module);
if(hModule){
OutTraceD("CoCreateInstance: Class=%s RIID=%x lib=%s handle=%x\n", Class, *(DWORD *)&riid, Module, hModule);
HookModule(hModule, 0);
}
else {
OutTraceE("CoCreateInstance: GetModuleHandle(%s) ERROR err=%d at %d\n", Module, GetLastError(), __LINE__);
}
}
HookAdditionalModules();
return res;
}
@ -176,5 +237,14 @@ HRESULT STDAPICALLTYPE extCoCreateInstanceEx(REFCLSID rclsid, IUnknown *punkOute
if (*(DWORD *)&rclsid==*(DWORD *)&CLSID_DxDiagProvider) res=HookDxDiag(riid, ppv);
}
HookAdditionalModules();
return res;
}
HRESULT WINAPI extCoInitialize(LPVOID pvReserved)
{
HRESULT res;
OutTraceD("CoInitialize: Reserved=%x\n", pvReserved);
res=(*pCoInitialize)(pvReserved);
return res;
}

View File

@ -219,8 +219,7 @@ void WINAPI extglDrawBuffer(GLenum mode)
}
}
(*pglDrawBuffer)(mode);
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS();
if (dxw.dwFlags4 & SHOWTIMESTRETCH) dxw.ShowTimeStretching();
dxw.ShowOverlay();
}
void WINAPI extglPolygonMode(GLenum face, GLenum mode)

View File

@ -124,6 +124,7 @@ typedef BOOL (WINAPI *QueryPerformanceCounter_Type)(LARGE_INTEGER *);
// ole32.dll:
typedef HRESULT (STDAPICALLTYPE *CoCreateInstance_Type)(REFCLSID, LPUNKNOWN, DWORD, REFIID, LPVOID FAR*);
typedef HRESULT (STDAPICALLTYPE *CoCreateInstanceEx_Type)(REFCLSID, IUnknown *, DWORD, COSERVERINFO *, DWORD, MULTI_QI *);
typedef HRESULT (STDAPICALLTYPE *CoInitialize_Type)(LPVOID);
// user32.dll:
typedef HDC (WINAPI *BeginPaint_Type)(HWND, LPPAINTSTRUCT);
@ -308,6 +309,7 @@ DXWEXTERN QueryPerformanceCounter_Type pQueryPerformanceCounter DXWINITIALIZED;
// ole32.dll:
DXWEXTERN CoCreateInstance_Type pCoCreateInstance DXWINITIALIZED;
DXWEXTERN CoCreateInstanceEx_Type pCoCreateInstanceEx DXWINITIALIZED;
DXWEXTERN CoInitialize_Type pCoInitialize DXWINITIALIZED;
// user32.dll:
DXWEXTERN BeginPaint_Type pBeginPaint DXWINITIALIZED;
@ -488,6 +490,7 @@ extern BOOL WINAPI extQueryPerformanceCounter(LARGE_INTEGER *);
// ole32.dll:
extern HRESULT STDAPICALLTYPE extCoCreateInstance(REFCLSID, LPUNKNOWN, DWORD, REFIID, LPVOID FAR*);
extern HRESULT STDAPICALLTYPE extCoCreateInstanceEx(REFCLSID, IUnknown *, DWORD, COSERVERINFO *, DWORD, MULTI_QI *);
extern HRESULT STDAPICALLTYPE extCoInitialize(LPVOID);
// user32.dll:
extern HDC WINAPI extBeginPaint(HWND, LPPAINTSTRUCT);

View File

@ -40,8 +40,8 @@ static HookEntry_Type Hooks[]={
{"SetSysColors", (FARPROC)NULL, (FARPROC *)&pSetSysColors, (FARPROC)extSetSysColors},
{"SetCapture", (FARPROC)NULL, (FARPROC *)&pSetCapture, (FARPROC)extSetCapture},
{"GetActiveWindow", (FARPROC)NULL, (FARPROC *)&pGetActiveWindow, (FARPROC)extGetActiveWindow},
{"GetForegroundWindow", (FARPROC)NULL, (FARPROC *)&pGetForegroundWindow, (FARPROC)extGetForegroundWindow},
//{"GetActiveWindow", (FARPROC)NULL, (FARPROC *)&pGetActiveWindow, (FARPROC)extGetActiveWindow},
//{"GetForegroundWindow", (FARPROC)NULL, (FARPROC *)&pGetForegroundWindow, (FARPROC)extGetForegroundWindow},
{0, NULL, 0, 0} // terminator
};
@ -919,6 +919,7 @@ int WINAPI extMapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT
// should scale the retcode ???
ret=(*pMapWindowPoints)(hWndFrom, hWndTo, lpPoints, cPoints);
OutTraceD("MapWindowPoints: ret=%x (%d,%d)\n", ret, (ret&0xFFFF0000)>>16, ret&0x0000FFFF);
return ret;
}
@ -1042,7 +1043,8 @@ static HWND WINAPI extCreateWindowCommon(
!(dwExStyle & WS_EX_CONTROLPARENT) // Diablo fix
&&
!(dwStyle & WS_CHILD) // Diablo fix
){
)
{
RECT screen;
POINT upleft = {0,0};
@ -1142,7 +1144,7 @@ static HWND WINAPI extCreateWindowCommon(
return wndh;
}
if ((!isValidHandle) && dxw.IsFullScreen()) {
if ((!isValidHandle) && dxw.IsFullScreen()){
dxw.SethWnd(wndh);
extern void AdjustWindowPos(HWND, DWORD, DWORD);
(*pSetWindowLong)(wndh, GWL_STYLE, (dxw.dwFlags2 & MODALSTYLE) ? 0 : WS_OVERLAPPEDWINDOW);
@ -1195,9 +1197,16 @@ HWND WINAPI extCreateWindowExW(
HINSTANCE hInstance,
LPVOID lpParam)
{
OutTraceD("CreateWindowExW: class=\"%ls\" wname=\"%ls\" pos=(%d,%d) size=(%d,%d) Style=%x(%s) ExStyle=%x(%s)\n",
lpClassName, lpWindowName, x, y, nWidth, nHeight,
dwStyle, ExplainStyle(dwStyle), dwExStyle, ExplainExStyle(dwExStyle));
if(IsTraceD){
char xString[20], yString[20];
if (x==CW_USEDEFAULT) strcpy(xString,"CW_USEDEFAULT");
else sprintf(xString,"%d", x);
if (y==CW_USEDEFAULT) strcpy(yString,"CW_USEDEFAULT");
else sprintf(yString,"%d", y);
OutTraceD("CreateWindowExW: class=\"%ls\" wname=\"%ls\" pos=(%s,%s) size=(%d,%d) Style=%x(%s) ExStyle=%x(%s)\n",
lpClassName, lpWindowName, xString, yString, nWidth, nHeight,
dwStyle, ExplainStyle(dwStyle), dwExStyle, ExplainExStyle(dwExStyle));
}
if(IsDebug) OutTrace("CreateWindowExW: DEBUG screen=(%d,%d)\n", dxw.GetScreenWidth(), dxw.GetScreenHeight());
return extCreateWindowCommon("CreateWindowExW", TRUE, dwExStyle, (void *)lpClassName, (void *)lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
@ -1218,9 +1227,16 @@ HWND WINAPI extCreateWindowExA(
HINSTANCE hInstance,
LPVOID lpParam)
{
OutTraceD("CreateWindowExA: class=\"%s\" wname=\"%s\" pos=(%d,%d) size=(%d,%d) Style=%x(%s) ExStyle=%x(%s)\n",
ClassToStr(lpClassName), lpWindowName, x, y, nWidth, nHeight,
dwStyle, ExplainStyle(dwStyle), dwExStyle, ExplainExStyle(dwExStyle));
if(IsTraceD){
char xString[20], yString[20];
if (x==CW_USEDEFAULT) strcpy(xString,"CW_USEDEFAULT");
else sprintf(xString,"%d", x);
if (y==CW_USEDEFAULT) strcpy(yString,"CW_USEDEFAULT");
else sprintf(yString,"%d", y);
OutTraceD("CreateWindowExA: class=\"%s\" wname=\"%s\" pos=(%s,%s) size=(%d,%d) Style=%x(%s) ExStyle=%x(%s)\n",
ClassToStr(lpClassName), lpWindowName, xString, yString, nWidth, nHeight,
dwStyle, ExplainStyle(dwStyle), dwExStyle, ExplainExStyle(dwExStyle));
}
if(IsDebug) OutTrace("CreateWindowExA: DEBUG screen=(%d,%d)\n", dxw.GetScreenWidth(), dxw.GetScreenHeight());
return extCreateWindowCommon("CreateWindowExA", false, dwExStyle, (void *)lpClassName, (void *)lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
@ -1614,7 +1630,7 @@ HWND WINAPI extCreateDialogIndirectParam(HINSTANCE hInstance, LPCDLGTEMPLATE lpT
isWithinDialog=TRUE;
OutTraceD("CreateDialogIndirectParam: hInstance=%x lpTemplate=%s hWndParent=%x lpDialogFunc=%x lParamInit=%x\n",
hInstance, "tbd", hWndParent, lpDialogFunc, lParamInit);
if(hWndParent==NULL) hWndParent=dxw.GethWnd();
if(dxw.IsFullScreen() && hWndParent==NULL) hWndParent=dxw.GethWnd();
RetHWND=(*pCreateDialogIndirectParam)(hInstance, lpTemplate, hWndParent, lpDialogFunc, lParamInit);
WhndStackPush(RetHWND, (WNDPROC)lpDialogFunc);

Binary file not shown.