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

v2_02_71_src

Former-commit-id: 756c3d65da958109a5a35683973512b469ed8b20
This commit is contained in:
gho tik 2014-04-22 12:39:07 -04:00 committed by Refael ACkermann
parent 95386140b5
commit 9efa398c81
34 changed files with 554 additions and 365 deletions

View File

@ -137,6 +137,7 @@
#define NATIVERES 0x00200000 // Supports hardware native resolutions (depending on your PC)
#define SUPPORTSVGA 0x00400000 // Supports SVGA standard resolutions
#define SUPPORTHDTV 0x00800000 // Supports HDTV standard resolutions
#define RELEASEMOUSE 0x01000000 // GetCursorPos returns centered coordinates when the mouse cursor is moved outside the window
// logging Tflags DWORD:
#define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:08566b33e7a85d73883a1dedcb52c0be7fdb04f0e8cb8d6a44acd5404c8b2721
size 471040
oid sha256:dd0cab2c1de012cafee122274a0f9f62529e667e5348f1d32f1a8a181339b3e7
size 473600

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bdc5c58a5fba8b5b8013c2a5fdecfe9ba5fd024b73be5855891c120573a35f5b
size 537600
oid sha256:82bfb64a3a58d26ffe21d8e615fb147cb29a86875c3260cdd3fcbed9875b770c
size 539136

View File

@ -0,0 +1,26 @@
[target]
title0=Close Combat 5 Invasion Normandy
path0=D:\Games\Close Combat 5\CC5.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134218272
flagg0=1744830464
flagh0=20
flagi0=4194308
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
winver0=0
maxres0=-1

View File

@ -0,0 +1,27 @@
[target]
title0=Dune 2000
path0=D:\Games\Dune 2000\DUNE2000.DAT
launchpath0=D:\Games\Dune 2000\DUNE2000.EXE
module0=
opengllib0=
ver0=0
coord0=0
flag0=671105312
flagg0=1207959568
flagh0=20
flagi0=4194308
tflag0=64
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -5,8 +5,8 @@ module0=
opengllib0=
ver0=0
coord0=0
flag0=134217760
flagg0=1207959552
flag0=134234144
flagg0=1207959808
flagh0=20
flagi0=4194308
tflag0=64

View File

@ -1,5 +1,5 @@
[window]
posx=1386
posy=352
posx=1260
posy=439
sizx=320
sizy=200

View File

@ -460,3 +460,10 @@ fix: corrected child window procedure handling - fixes "Imperialism" child windo
fixed FillRect coordinate handling - fixes "Imperialism" menus
fixed SetWindowPlacement handling
v2.02.71
fix: Set/GetWindowLongA/W are always hooked.
fix: added user32 GetDCEx hook for GDI Emulation & Directraw mode
fix: hooked "FrameRect", "TabbedTextOutA", "DrawTextA", "DrawTextExA", "FillRect" in scaled mode only
fix: FIXNCHITTEST mode
fix: when main win is closed, blit area is made null to avoid messing with a wrong screen area
added "Release mouse outside window" option. This option causes the get cursor position to detect a centered mouse position when the cursor is moved outside the window, allowing interaction with other windows without scrolling ot the windowed program. Mainly, this option is meant to help people with a physical disability to use other programs (e. g. the virtual keyboard) to play games.

View File

@ -3851,7 +3851,7 @@ HRESULT WINAPI extReleaseDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR hdc)
IsPrim=dxw.IsAPrimarySurface(lpdds);
OutTraceDDRAW("ReleaseDC: lpdss=%x%s hdc=%x\n",lpdds, IsPrim?"(PRIM)":"", hdc);
res=(*pReleaseDC)(lpdds,hdc);
res=(*pReleaseDC)(lpdds, hdc);
if((IsPrim) && (dxw.dwFlags1 & EMULATESURFACE)) sBlt("ReleaseDC", lpdds, NULL, lpdds, NULL, 0, NULL, FALSE);
if (res) OutTraceE("ReleaseDC: ERROR res=%x(%s)\n", res, ExplainDDError(res));
if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=DD_OK;

View File

@ -91,19 +91,19 @@ void dxwCore::HideDesktop(HWND hwnd)
HWND hParent = (*pGetDesktopWindow)();
if(!wleft) {
wleft=(*pCreateWindowExA)(0, "dxwnd:hider", "hider", 0, 0, 0, 0, 0, hParent, NULL, hinst, NULL);
(*pSetWindowLong)(wleft, GWL_STYLE, 0);
(*pSetWindowLongA)(wleft, GWL_STYLE, 0);
}
if(!wright) {
wright=(*pCreateWindowExA)(0, "dxwnd:hider", "hider", 0, 0, 0, 0, 0, hParent, NULL, hinst, NULL);
(*pSetWindowLong)(wright, GWL_STYLE, 0);
(*pSetWindowLongA)(wright, GWL_STYLE, 0);
}
if(!wtop) {
wtop=(*pCreateWindowExA)(0, "dxwnd:hider", "hider", 0, 0, 0, 0, 0, hParent, NULL, hinst, NULL);
(*pSetWindowLong)(wtop, GWL_STYLE, 0);
(*pSetWindowLongA)(wtop, GWL_STYLE, 0);
}
if(!wbottom) {
wbottom=(*pCreateWindowExA)(0, "dxwnd:hider", "hider", 0, 0, 0, 0, 0, hParent, NULL, hinst, NULL);
(*pSetWindowLong)(wbottom, GWL_STYLE, 0);
(*pSetWindowLongA)(wbottom, GWL_STYLE, 0);
}
(*pMoveWindow)(wleft, wDesktop.left, wDesktop.top, wRect.left, wDesktop.bottom, TRUE);
@ -111,10 +111,10 @@ void dxwCore::HideDesktop(HWND hwnd)
(*pMoveWindow)(wtop, wDesktop.left, wDesktop.top, wDesktop.right, wRect.top-wDesktop.top, TRUE);
(*pMoveWindow)(wbottom, wDesktop.left, wRect.bottom, wDesktop.right, wDesktop.bottom-wRect.bottom, TRUE);
(*pSetWindowLong)(wleft, GWL_EXSTYLE, WS_EX_TOPMOST);
(*pSetWindowLong)(wright, GWL_EXSTYLE, WS_EX_TOPMOST);
(*pSetWindowLong)(wtop, GWL_EXSTYLE, WS_EX_TOPMOST);
(*pSetWindowLong)(wbottom, GWL_EXSTYLE, WS_EX_TOPMOST);
(*pSetWindowLongA)(wleft, GWL_EXSTYLE, WS_EX_TOPMOST);
(*pSetWindowLongA)(wright, GWL_EXSTYLE, WS_EX_TOPMOST);
(*pSetWindowLongA)(wtop, GWL_EXSTYLE, WS_EX_TOPMOST);
(*pSetWindowLongA)(wbottom, GWL_EXSTYLE, WS_EX_TOPMOST);
(*pShowWindow)(wleft, SW_SHOW);
(*pShowWindow)(wright, SW_SHOW);

View File

@ -84,7 +84,7 @@ static char *Flag4Names[32]={
"LIMITSCREENRES", "NOFILLRECT", "HOOKGLIDE", "HIDEDESKTOP",
"STRETCHTIMERS", "NOFLIPEMULATION", "NOTEXTURES", "RETURNNULLREF",
"FINETIMING", "NATIVERES", "SUPPORTSVGA", "SUPPORTHDTV",
"", "", "", "",
"RELEASEMOUSE", "", "", "",
"", "", "", "",
};
@ -505,8 +505,8 @@ void CalculateWindowPos(HWND hwnd, DWORD width, DWORD height, LPWINDOWPOS wp)
RECT UnmappedRect;
UnmappedRect=rect;
dwStyle=(*pGetWindowLong)(hwnd, GWL_STYLE);
dwExStyle=(*pGetWindowLong)(hwnd, GWL_EXSTYLE);
dwStyle=(*pGetWindowLongA)(hwnd, GWL_STYLE);
dwExStyle=(*pGetWindowLongA)(hwnd, GWL_EXSTYLE);
// BEWARE: from MSDN - If the window is a child window, the return value is undefined.
hMenu = (dwStyle & WS_CHILD) ? NULL : GetMenu(hwnd);
AdjustWindowRectEx(&rect, dwStyle, (hMenu!=NULL), dwExStyle);
@ -562,7 +562,7 @@ void AdjustWindowPos(HWND hwnd, DWORD width, DWORD height)
void HookWindowProc(HWND hwnd)
{
WNDPROC pWindowProc;
pWindowProc = (WNDPROC)(*pGetWindowLong)(hwnd, GWL_WNDPROC);
pWindowProc = (WNDPROC)(*pGetWindowLongA)(hwnd, GWL_WNDPROC);
if ((pWindowProc == extWindowProc) ||
(pWindowProc == extChildWindowProc) ||
(pWindowProc == extDialogWindowProc)){
@ -572,7 +572,7 @@ void HookWindowProc(HWND hwnd)
else {// don't hook twice ....
long lres;
WhndStackPush(hwnd, pWindowProc);
lres=(*pSetWindowLong)(hwnd, GWL_WNDPROC, (LONG)extWindowProc);
lres=(*pSetWindowLongA)(hwnd, GWL_WNDPROC, (LONG)extWindowProc);
OutTraceDW("SetWindowLong: hwnd=%x HOOK WindowProc=%x->%x\n", hwnd, lres, (LONG)extWindowProc);
}
}
@ -599,8 +599,8 @@ void AdjustWindowFrame(HWND hwnd, DWORD width, DWORD height)
break;
}
(*pSetWindowLong)(hwnd, GWL_STYLE, style);
(*pSetWindowLong)(hwnd, GWL_EXSTYLE, 0);
(*pSetWindowLongA)(hwnd, GWL_STYLE, style);
(*pSetWindowLongA)(hwnd, GWL_EXSTYLE, 0);
(*pShowWindow)(hwnd, SW_SHOWNORMAL);
OutTraceDW("AdjustWindowFrame hwnd=%x, set style=%s extstyle=0\n", hwnd, (style == 0) ? "0" : "WS_OVERLAPPEDWINDOW");
AdjustWindowPos(hwnd, width, height);
@ -978,11 +978,12 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
if (dxw.dwFlags1 & CLIPCURSOR) dxw.EraseClipCursor();
if (dxw.dwFlags1 & ENABLECLIPPING) (*pClipCursor)(NULL);
break;
case WM_CLOSE:
OutTraceDW("WindowProc: WM_CLOSE - terminating process\n");
if(dxw.dwFlags3 & FORCE16BPP) RecoverScreenMode();
TerminateProcess(GetCurrentProcess(),0);
break;
// commented out: WM_CLOSE just issue a request to close the window, not the process! It should be WM_QUIT....
//case WM_CLOSE:
// OutTraceDW("WindowProc: WM_CLOSE - terminating process\n");
// if(dxw.dwFlags3 & FORCE16BPP) RecoverScreenMode();
// TerminateProcess(GetCurrentProcess(),0);
// break;
case WM_SYSKEYDOWN:
OutTraceW("event WM_SYSKEYDOWN wparam=%x lparam=%x\n", wparam, lparam);
switch (wparam){

View File

@ -362,10 +362,21 @@ POINT dxwCore::FixCursorPos(POINT prev)
}
}
if (curr.x < 0) curr.x = 0;
if (curr.y < 0) curr.y = 0;
if (curr.x > w) curr.x = w;
if (curr.y > h) curr.y = h;
if(dxw.dwFlags4 & RELEASEMOUSE){
if ((curr.x < 0) ||
(curr.y < 0) ||
(curr.x > w) ||
(curr.y > h)){
curr.x = w / 2;
curr.y = h / 2;
}
}
else {
if (curr.x < 0) curr.x = 0;
if (curr.y < 0) curr.y = 0;
if (curr.x > w) curr.x = w;
if (curr.y > h) curr.y = h;
}
if (w) curr.x = (curr.x * dxw.GetScreenWidth()) / w;
if (h) curr.y = (curr.y * dxw.GetScreenHeight()) / h;
@ -511,10 +522,9 @@ RECT dxwCore::MapWindowRect(LPRECT lpRect)
if (!(*pGetClientRect)(hWnd, &ClientRect)){
OutTraceE("GetClientRect ERROR: err=%d hwnd=%x at %d\n", GetLastError(), hWnd, __LINE__);
// v2.02.31: try....
ClientRect.top=ClientRect.left=0;
ClientRect.right=iRatioX;
ClientRect.bottom=iRatioY;
// v2.02.71: return a void area to prevent blitting to wrong area
ClientRect.top=ClientRect.left=ClientRect.right=ClientRect.bottom=0;
return ClientRect;
}
RetRect=ClientRect;
@ -770,6 +780,16 @@ POINT dxwCore::AddCoordinates(POINT p1, POINT p2)
return ps;
}
RECT dxwCore::AddCoordinates(RECT r1, POINT p2)
{
RECT rs;
rs.left = r1.left + p2.x;
rs.right = r1.right + p2.x;
rs.top = r1.top + p2.y;
rs.bottom = r1.bottom + p2.y;
return rs;
}
POINT dxwCore::SubCoordinates(POINT p1, POINT p2)
{
POINT ps;
@ -1328,7 +1348,7 @@ void dxwCore::FixWindowFrame(HWND hwnd)
OutTraceDW("FixWindowFrame: hwnd=%x\n", hwnd);
nOldStyle=(*pGetWindowLong)(hwnd, GWL_STYLE);
nOldStyle=(*pGetWindowLongA)(hwnd, GWL_STYLE);
if (!nOldStyle){
OutTraceE("FixWindowFrame: GetWindowLong ERROR %d at %d\n",GetLastError(),__LINE__);
return;
@ -1337,12 +1357,12 @@ void dxwCore::FixWindowFrame(HWND hwnd)
OutTraceDW("FixWindowFrame: style=%x(%s)\n",nOldStyle,ExplainStyle(nOldStyle));
// fix style
if (!(*pSetWindowLong)(hwnd, GWL_STYLE, WS_OVERLAPPEDWINDOW)){
if (!(*pSetWindowLongA)(hwnd, GWL_STYLE, WS_OVERLAPPEDWINDOW)){
OutTraceE("FixWindowFrame: SetWindowLong ERROR %d at %d\n",GetLastError(),__LINE__);
return;
}
// fix exstyle
if (!(*pSetWindowLong)(hwnd, GWL_EXSTYLE, 0)){
if (!(*pSetWindowLongA)(hwnd, GWL_EXSTYLE, 0)){
OutTraceE("FixWindowFrame: SetWindowLong ERROR %d at %d\n",GetLastError(),__LINE__);
return;
}
@ -1365,7 +1385,7 @@ void dxwCore::FixStyle(char *ApiName, HWND hwnd, WPARAM wParam, LPARAM lParam)
lpSS->styleNew= WS_OVERLAPPEDWINDOW;
}
if (dxw.dwFlags1 & LOCKWINSTYLE){ // set to current value
lpSS->styleNew= (*pGetWindowLong)(hwnd, GWL_STYLE);
lpSS->styleNew= (*pGetWindowLongA)(hwnd, GWL_STYLE);
}
if (dxw.dwFlags1 & PREVENTMAXIMIZE){ // disable maximize settings
if (lpSS->styleNew & WS_MAXIMIZE){
@ -1381,7 +1401,7 @@ void dxwCore::FixStyle(char *ApiName, HWND hwnd, WPARAM wParam, LPARAM lParam)
lpSS->styleNew= 0;
}
if (dxw.dwFlags1 & LOCKWINSTYLE){ // set to current value
lpSS->styleNew= (*pGetWindowLong)(hwnd, GWL_EXSTYLE);
lpSS->styleNew= (*pGetWindowLongA)(hwnd, GWL_EXSTYLE);
}
if ((dxw.dwFlags1 & PREVENTMAXIMIZE) && (hwnd==hWnd)){ // disable maximize settings
if (lpSS->styleNew & WS_EX_TOPMOST){
@ -1398,8 +1418,10 @@ void dxwCore::FixStyle(char *ApiName, HWND hwnd, WPARAM wParam, LPARAM lParam)
HDC dxwCore::AcquireEmulatedDC(HWND hwnd)
{
HDC wdc;
if(!(wdc=(*pGDIGetDC)(hwnd)))
if(!(wdc=(*pGDIGetDC)(hwnd))){
OutTraceE("GetDC: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
return NULL;
}
return AcquireEmulatedDC(wdc);
}
@ -1416,25 +1438,32 @@ HDC dxwCore::AcquireEmulatedDC(LPDIRECTDRAWSURFACE lpdds)
HDC dxwCore::AcquireEmulatedDC(HDC wdc)
{
RealHDC=wdc;
//HDC wdc;
//if(!(wdc=(*pGDIGetDC)(hwnd)))
//OutTraceE("GetDC: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
if(!VirtualHDC){ // or resolution changed and you must rebuild a new one .... !!!!!
if(!(VirtualHDC=CreateCompatibleDC(wdc)))
OutTraceE("CreateCompatibleDC: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
if(!VirtualPic){
if(!(VirtualPic=CreateCompatibleBitmap(wdc, dxw.GetScreenWidth(), dxw.GetScreenHeight())))
OutTraceE("CreateCompatibleBitmap: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
}
if(!SelectObject(VirtualHDC, VirtualPic)){
if(!DeleteObject(VirtualPic))
OutTraceE("DeleteObject: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
if(!(VirtualPic=CreateCompatibleBitmap(wdc, dxw.GetScreenWidth(), dxw.GetScreenHeight())))
OutTraceE("CreateCompatibleBitmap: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
if(!SelectObject(VirtualHDC, VirtualPic))
OutTraceE("SelectObject: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
}
HWND hwnd;
RECT WinRect;
if(!(hwnd=WindowFromDC(wdc)))
OutTraceE("WindowFromDC: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
(*pGetClientRect)(hwnd, &WinRect);
if(dxw.IsDesktop(hwnd)){
dxw.VirtualPicRect = dxw.GetScreenRect();
}
else {
VirtualPicRect = WinRect;
dxw.UnmapClient(&VirtualPicRect);
}
if(!(VirtualHDC=CreateCompatibleDC(wdc)))
OutTraceE("CreateCompatibleDC: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
if(!(VirtualPic=CreateCompatibleBitmap(wdc, VirtualPicRect.right, VirtualPicRect.bottom)))
OutTraceE("CreateCompatibleBitmap: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
if(!SelectObject(VirtualHDC, VirtualPic)){
if(!DeleteObject(VirtualPic))
OutTraceE("DeleteObject: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
if(!(VirtualPic=CreateCompatibleBitmap(wdc, dxw.GetScreenWidth(), dxw.GetScreenHeight())))
OutTraceE("CreateCompatibleBitmap: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
if(!SelectObject(VirtualHDC, VirtualPic))
OutTraceE("SelectObject: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
}
if(!(*pGDIStretchBlt)(VirtualHDC, 0, 0, VirtualPicRect.right, VirtualPicRect.bottom, wdc, 0, 0, WinRect.right, WinRect.bottom, SRCCOPY))
OutTraceE("StretchBlt: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
return VirtualHDC;
}
@ -1446,10 +1475,14 @@ BOOL dxwCore::ReleaseEmulatedDC(HWND hwnd)
(*pGetClientRect)(hwnd, &client);
if(!(wdc=(*pGDIGetDC)(hwnd)))
OutTraceE("GetDC: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
//OutTrace("StretchBlt: destdc=%x destrect=(0,0)-(%d,%d) srcdc=%x srcrect=(0,0)-(%d,%d)\n", wdc, client.right, client.bottom, VirtualHDC, dxw.GetScreenWidth(), dxw.GetScreenHeight());
if(!(*pGDIStretchBlt)(wdc, 0, 0, client.right, client.bottom, VirtualHDC, 0, 0, dxw.GetScreenWidth(), dxw.GetScreenHeight(), SRCCOPY))
//OutTrace("StretchBlt: destdc=%x destrect=(0,0)-(%d,%d) srcdc=%x srcrect=(0,0)-(%d,%d)\n", wdc, client.right, client.bottom, VirtualHDC, VirtualPicRect.right, VirtualPicRect.bottom);
if(!(*pGDIStretchBlt)(wdc, 0, 0, client.right, client.bottom, VirtualHDC, 0, 0, VirtualPicRect.right, VirtualPicRect.bottom, SRCCOPY))
OutTraceE("StretchBlt: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
//(*pInvalidateRect)(hwnd, NULL, 0);
if(!DeleteObject(VirtualPic))
OutTraceE("DeleteObject: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
if(!DeleteObject(VirtualHDC))
OutTraceE("DeleteObject: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
ret=TRUE;
return ret;
}

View File

@ -69,6 +69,7 @@ public: // methods
RECT GetWindowRect(RECT);
RECT GetClientRect(RECT);
POINT AddCoordinates(POINT, POINT);
RECT AddCoordinates(RECT, POINT);
POINT SubCoordinates(POINT, POINT);
POINT ClientOffset(HWND);
void ScreenRefresh(void);
@ -158,6 +159,7 @@ protected:
DWORD PrimSurfaces[DDSQLEN+1];
DWORD BackSurfaces[DDSQLEN+1];
HBITMAP VirtualPic;
RECT VirtualPicRect;
private:
void UnmarkPrimarySurface(LPDIRECTDRAWSURFACE);

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.70"
#define VERSION "2.02.71"
#define DDTHREADLOCK 1

Binary file not shown.

View File

@ -36,8 +36,6 @@ ExtTextOutW_Type pExtTextOutW = NULL;
ExtTextOutA_Type pExtTextOutA = NULL;
static HookEntry_Type Hooks[]={
{"ExtTextOutA", (FARPROC)ExtTextOutA, (FARPROC *)&pExtTextOutA, (FARPROC)extExtTextOutA},
{"ExtTextOutW", (FARPROC)ExtTextOutW, (FARPROC *)&pExtTextOutW, (FARPROC)extExtTextOutW},
{"GetDeviceCaps", (FARPROC)GetDeviceCaps, (FARPROC *)&pGDIGetDeviceCaps, (FARPROC)extGetDeviceCaps},
{"ScaleWindowExtEx", (FARPROC)ScaleWindowExtEx, (FARPROC *)&pGDIScaleWindowExtEx, (FARPROC)extScaleWindowExtEx},
@ -67,7 +65,6 @@ static HookEntry_Type RemapHooks[]={
{"GetWindowOrgEx", (FARPROC)NULL, (FARPROC *)&pGetWindowOrgEx, (FARPROC)extGetWindowOrgEx},
{"SetWindowOrgEx", (FARPROC)NULL, (FARPROC *)&pSetWindowOrgEx, (FARPROC)extSetWindowOrgEx},
{"GetCurrentPositionEx", (FARPROC)NULL, (FARPROC *)&pGetCurrentPositionEx, (FARPROC)extGetCurrentPositionEx},
{"StretchDIBits", (FARPROC)StretchDIBits, (FARPROC *)&pStretchDIBits, (FARPROC)extStretchDIBits}, // unuseful
{"SetDIBitsToDevice", (FARPROC)NULL, (FARPROC *)&pSetDIBitsToDevice, (FARPROC)extSetDIBitsToDevice}, // does the stretching
{0, NULL, 0, 0} // terminator
};
@ -103,21 +100,18 @@ static HookEntry_Type ScaledHooks[]={
{"StretchBlt", (FARPROC)StretchBlt, (FARPROC *)&pGDIStretchBlt, (FARPROC)extGDIStretchBlt},
{"PatBlt", (FARPROC)PatBlt, (FARPROC *)&pGDIPatBlt, (FARPROC)extGDIPatBlt},
{"MaskBlt", (FARPROC)NULL, (FARPROC *)&pMaskBlt, (FARPROC)extMaskBlt},
{"ExtTextOutA", (FARPROC)ExtTextOutA, (FARPROC *)&pExtTextOutA, (FARPROC)extExtTextOutA},
{"ExtTextOutW", (FARPROC)ExtTextOutW, (FARPROC *)&pExtTextOutW, (FARPROC)extExtTextOutW},
{0, NULL, 0, 0} // terminator
};
static HookEntry_Type EmulateHooks[]={
// useless CreateCompatibleDC: it maps VirtualHDC on top of VirtualHDC, then does nothing....
// useless CreateCompatibleDC: it maps VirtualHDC on top of VirtualHDC, then does nothing, unless when asked to operate on 0!....
//{"CreateCompatibleDC", (FARPROC)CreateCompatibleDC, (FARPROC *)&pGDICreateCompatibleDC, (FARPROC)extEMUCreateCompatibleDC},
// useless DeleteDC: it's just a proxy
//{"DeleteDC", (FARPROC)DeleteDC, (FARPROC *)&pGDIDeleteDC, (FARPROC)extGDIDeleteDC},
{"CreateDCA", (FARPROC)CreateDCA, (FARPROC *)&pGDICreateDC, (FARPROC)extGDICreateDC},
// CreateDCW .....
{"BitBlt", (FARPROC)BitBlt, (FARPROC *)&pGDIBitBlt, (FARPROC)extGDIBitBlt},
{"StretchBlt", (FARPROC)StretchBlt, (FARPROC *)&pGDIStretchBlt, (FARPROC)extGDIStretchBlt},
{"PatBlt", (FARPROC)PatBlt, (FARPROC *)&pGDIPatBlt, (FARPROC)extGDIPatBlt},
{"MaskBlt", (FARPROC)NULL, (FARPROC *)&pMaskBlt, (FARPROC)extMaskBlt},
{"GetObjectType", (FARPROC)GetObjectType, (FARPROC *)&pGetObjectType, (FARPROC)extGetObjectType},
{"GetClipBox", (FARPROC)NULL, (FARPROC *)&pGDIGetClipBox, (FARPROC)extGetClipBox},
@ -131,6 +125,7 @@ static HookEntry_Type DDHooks[]={
{"BitBlt", (FARPROC)BitBlt, (FARPROC *)&pGDIBitBlt, (FARPROC)extDDBitBlt},
{"StretchBlt", (FARPROC)StretchBlt, (FARPROC *)&pGDIStretchBlt, (FARPROC)extDDStretchBlt},
{"GetClipBox", (FARPROC)NULL, (FARPROC *)&pGDIGetClipBox, (FARPROC)extGetClipBox},
// {"PatBlt", (FARPROC)PatBlt, (FARPROC *)&pGDIPatBlt, (FARPROC)extDDPatBlt}, // missing one ...
// {"MaskBlt", (FARPROC)NULL, (FARPROC *)&pMaskBlt, (FARPROC)extDDMaskBlt}, // missing one ...
{0, NULL, 0, 0} // terminator
@ -402,9 +397,10 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex)
BOOL WINAPI extTextOutA(HDC hdc, int nXStart, int nYStart, LPCTSTR lpString, int cchString)
{
BOOL ret;
extern BOOL gFixed;
OutTraceDW("TextOut: hdc=%x xy=(%d,%d) str=(%d)\"%.*s\"\n", hdc, nXStart, nYStart, cchString, cchString, lpString);
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
if (!gFixed && dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
dxw.MapClient(&nXStart, &nYStart);
OutTraceDW("TextOut: fixed dest=(%d,%d)\n", nXStart, nYStart);
}
@ -738,6 +734,13 @@ HDC WINAPI extDDGetDC(HWND hwnd)
return ret;
}
HDC WINAPI extDDGetDCEx(HWND hwnd, HRGN hrgnClip, DWORD flags)
{
HDC ret;
ret=winDDGetDC(hwnd, "GDI.GetDCEx");
return ret;
}
HDC WINAPI extDDGetWindowDC(HWND hwnd)
{
HDC ret;
@ -750,11 +753,11 @@ int WINAPI extDDReleaseDC(HWND hwnd, HDC hDC)
int res;
extern HRESULT WINAPI extReleaseDC(LPDIRECTDRAWSURFACE, HDC);
OutTraceDW("GDI.ReleaseDC: hwnd=%x hdc=%x\n", hwnd, hDC);
OutTraceDW("GDI.ReleaseDC(DD): hwnd=%x hdc=%x\n", hwnd, hDC);
res=0;
if ((hDC == PrimHDC) || (hwnd==0)){
dxw.SetPrimarySurface();
OutTraceDW("GDI.ReleaseDC: refreshing primary surface lpdds=%x\n",dxw.lpDDSPrimHDC);
OutTraceDW("GDI.ReleaseDC(DD): refreshing primary surface lpdds=%x\n",dxw.lpDDSPrimHDC);
if(!dxw.lpDDSPrimHDC) return 0;
extReleaseDC(dxw.lpDDSPrimHDC, hDC);
PrimHDC=NULL;
@ -862,12 +865,12 @@ HDC WINAPI extGDICreateDC(LPSTR Driver, LPSTR Device, LPSTR Output, CONST DEVMOD
HDC WINAPI extGDICreateCompatibleDC(HDC hdc)
{
HDC RetHdc, SrcHdc;
HDC RetHdc;
DWORD LastError;
OutTraceDW("GDI.CreateCompatibleDC: hdc=%x\n", hdc);
if(hdc==0){
SrcHdc=(*pGDIGetDC)(dxw.GethWnd());
hdc=(*pGDIGetDC)(dxw.GethWnd());
OutTraceDW("GDI.CreateCompatibleDC: duplicating win HDC hWnd=%x\n", dxw.GethWnd());
}
@ -882,34 +885,6 @@ HDC WINAPI extGDICreateCompatibleDC(HDC hdc)
return RetHdc;
}
//HDC WINAPI extEMUCreateCompatibleDC(HDC hdc)
//{
// HDC RetHdc, SrcHdc;
// DWORD LastError;
//
// OutTraceDW("GDI.CreateCompatibleDC: hdc=%x\n", hdc);
// if((hdc==0) || (hdc==dxw.RealHDC)){
// SrcHdc=dxw.AcquireEmulatedDC(dxw.GethWnd());
// OutTraceDW("GDI.CreateCompatibleDC: using emulated HDC hWnd=%x hdc=%x\n", dxw.GethWnd(), SrcHdc);
// }
//
// // eliminated error message for errorcode 0.
// SetLastError(0);
// RetHdc=(*pGDICreateCompatibleDC)(hdc);
// LastError=GetLastError();
// if(!LastError)
// OutTraceDW("GDI.CreateCompatibleDC: returning HDC=%x\n", RetHdc);
// else
// OutTraceE("GDI.CreateCompatibleDC ERROR: err=%d at %d\n", LastError, __LINE__);
// return RetHdc;
//}
//BOOL WINAPI extEMUBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HDC hdcSrc, int nXSrc, int nYSrc, DWORD dwRop)
//{
// if (hdcDest==dxw.RealHDC) hdcDest=dxw.VirtualHDC;
// return (*pGDIBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
//}
BOOL WINAPI extGDIBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HDC hdcSrc, int nXSrc, int nYSrc, DWORD dwRop)
{
BOOL res;
@ -1837,51 +1812,29 @@ DWORD WINAPI extGetObjectType(HGDIOBJ h)
return res;
}
#if 0
HBITMAP WINAPI extCreateDIBitmap(HDC hdc, const BITMAPINFOHEADER *lpbmih, DWORD fdwInit, const VOID *lpbInit, const BITMAPINFO *lpbmi, UINT fuUsage)
{
OutTrace("CreateDIBitmap: hdc=x dwInit=%x bInit=%x Usage=%x\n", hdc, fdwInit, lpbInit, fuUsage);
return NULL;
}
int WINAPI extSetMapMode(HDC hdc, int fnMapMode)
{
OutTraceDW("SetMapMode: hdc=%x MapMode=%d\n", hdc, fnMapMode);
return TRUE;
}
// to map:
// GetCurrentPositionEx
// GetViewportExtEx
// DPtoLP
// GetWindowOrgEx
// LPtoDP
// OffsetViewportOrgEx
// OffsetWindowOrgEx
// TransparentBlt
// to do: eliminate FIXTEXTOUT handling
// GetDCEx
BOOL SetTextJustification(
_In_ HDC hdc,
_In_ int nBreakExtra, <----
_In_ int nBreakCount
);
#endif
extern BOOL gFixed;
BOOL WINAPI extExtTextOutA(HDC hdc, int X, int Y, UINT fuOptions, const RECT *lprc, LPCSTR lpString, UINT cbCount, const INT *lpDx)
{
OutTrace("ExtTextOutA: pos=(%d,%d) String=\"%s\"\n", X, Y, lpString);
//if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
// dxw.MapClient(&X, &Y);
// if(lprc) dxw.MapClient((LPRECT)lprc);
// OutTraceDW("ExtTextOutA: fixed pos=(%d,%d)\n", X, Y);
//}
return (*pExtTextOutA)(hdc, X, Y, fuOptions, lprc, lpString, cbCount, lpDx);
}
RECT rc;
if(IsTraceDW){
OutTrace("ExtTextOutA: hdc=%x pos=(%d,%d) String=\"%s\" rect=", hdc, X, Y, lpString);
if(lprc)
OutTrace("(%d,%d)-(%d,%d)\n", lprc->left, lprc->top, lprc->right, lprc->bottom);
else
OutTrace("NULL\n");
}
extern BOOL gFixed;
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc)) && !gFixed){
dxw.MapClient(&X, &Y);
if(lprc) dxw.MapClient(&rc);
OutTraceDW("ExtTextOutA: fixed pos=(%d,%d)\n", X, Y);
}
if(lprc)
return (*pExtTextOutA)(hdc, X, Y, fuOptions, &rc, lpString, cbCount, lpDx);
else
return (*pExtTextOutA)(hdc, X, Y, fuOptions, NULL, lpString, cbCount, lpDx);
}
BOOL WINAPI extExtTextOutW(HDC hdc, int X, int Y, UINT fuOptions, const RECT *lprc, LPCWSTR lpString, UINT cbCount, const INT *lpDx)
{
@ -1894,11 +1847,7 @@ BOOL WINAPI extExtTextOutW(HDC hdc, int X, int Y, UINT fuOptions, const RECT *lp
OutTrace("NULL\n");
}
//return (*pExtTextOutW)(hdc, X, Y, fuOptions, lprc, lpString, cbCount, lpDx);
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc)) && !gFixed){
//dxw.UnmapClient(&X, &Y);
//if(lprc) dxw.UnmapClient(&rc);
dxw.MapClient(&X, &Y);
if(lprc) dxw.MapClient(&rc);
OutTraceDW("ExtTextOutW: fixed pos=(%d,%d)\n", X, Y);

View File

@ -508,7 +508,8 @@ static void DumpD3DDevideDesc(LPD3DDEVICEDESC d3, char *label)
if(d3->dwFlags & D3DDD_DEVICEZBUFFERBITDEPTH) OutTrace("DeviceZBufferBitDepth=%d ", d3->dwDeviceZBufferBitDepth);
if(d3->dwFlags & D3DDD_MAXBUFFERSIZE) OutTrace("MaxBufferSize=%d ", d3->dwMaxBufferSize);
if(d3->dwFlags & D3DDD_MAXVERTEXCOUNT) OutTrace("MaxVertexCount=%d ", d3->dwMaxVertexCount);
OutTrace("\n");
OutTrace("Texture min=(%dx%d) max=(%dx%d)\n", d3->dwMinTextureWidth, d3->dwMinTextureHeight, d3->dwMaxTextureWidth, d3->dwMaxTextureHeight);
//OutTrace("\n");
}
else
OutTrace("EnumDevices: CALLBACK dev=%s ddesc=NULL\n", label);

View File

@ -360,7 +360,8 @@ DXWEXTERN GetDesktopWindow_Type pGetDesktopWindow DXWINITIALIZED;
DXWEXTERN GetSystemMetrics_Type pGetSystemMetrics DXWINITIALIZED;
DXWEXTERN GetTopWindow_Type pGetTopWindow DXWINITIALIZED;
DXWEXTERN GDIGetDC_Type pGDIGetWindowDC DXWINITIALIZED;
DXWEXTERN GetWindowLong_Type pGetWindowLong DXWINITIALIZED;
DXWEXTERN GetWindowLong_Type pGetWindowLongA DXWINITIALIZED;
DXWEXTERN GetWindowLong_Type pGetWindowLongW DXWINITIALIZED;
DXWEXTERN GetWindowRect_Type pGetWindowRect DXWINITIALIZED;
DXWEXTERN InvalidateRect_Type pInvalidateRect DXWINITIALIZED;
DXWEXTERN MapWindowPoints_Type pMapWindowPoints DXWINITIALIZED;
@ -375,7 +376,8 @@ DXWEXTERN SendMessage_Type pSendMessageW DXWINITIALIZED;
DXWEXTERN SetCursor_Type pSetCursor DXWINITIALIZED;
DXWEXTERN SetCursorPos_Type pSetCursorPos DXWINITIALIZED;
DXWEXTERN SetTimer_Type pSetTimer DXWINITIALIZED;
DXWEXTERN SetWindowLong_Type pSetWindowLong DXWINITIALIZED;
DXWEXTERN SetWindowLong_Type pSetWindowLongA DXWINITIALIZED;
DXWEXTERN SetWindowLong_Type pSetWindowLongW DXWINITIALIZED;
DXWEXTERN SetWindowPos_Type pSetWindowPos DXWINITIALIZED;
DXWEXTERN ShowCursor_Type pShowCursor DXWINITIALIZED;
DXWEXTERN ShowWindow_Type pShowWindow DXWINITIALIZED;
@ -528,6 +530,7 @@ extern HRESULT STDAPICALLTYPE extCoInitialize(LPVOID);
// user32.dll:
extern HDC WINAPI extBeginPaint(HWND, LPPAINTSTRUCT);
extern HDC WINAPI extEMUBeginPaint(HWND, LPPAINTSTRUCT);
extern HDC WINAPI extDDBeginPaint(HWND, LPPAINTSTRUCT);
extern LRESULT WINAPI extCallWindowProc(WNDPROC, HWND, UINT, WPARAM, LPARAM);
extern LONG WINAPI extChangeDisplaySettingsA(DEVMODEA *, DWORD);
@ -544,6 +547,7 @@ extern LRESULT WINAPI extDefWindowProc(HWND, UINT, WPARAM, LPARAM);
extern int WINAPI extDrawTextA(HDC, LPCTSTR, int, LPRECT, UINT);
extern int WINAPI extDrawTextExA(HDC, LPTSTR, int, LPRECT, UINT, LPDRAWTEXTPARAMS);
extern BOOL WINAPI extEndPaint(HWND, const PAINTSTRUCT *);
extern BOOL WINAPI extEMUEndPaint(HWND, const PAINTSTRUCT *);
extern BOOL WINAPI extDDEndPaint(HWND, const PAINTSTRUCT *);
extern LONG WINAPI extEnumDisplaySettings(LPCTSTR, DWORD, DEVMODE *);
extern int WINAPI extFillRect(HDC, const RECT *, HBRUSH);
@ -552,13 +556,16 @@ extern BOOL WINAPI extGetClientRect(HWND, LPRECT);
extern BOOL WINAPI extGetClipCursor(LPRECT);
extern BOOL WINAPI extGetCursorPos(LPPOINT);
extern HDC WINAPI extGDIGetDC(HWND);
extern HDC WINAPI extEMUGetDC(HWND);
extern HDC WINAPI extDDGetDC(HWND);
extern HWND WINAPI extGetDesktopWindow(void);
extern int WINAPI extGetSystemMetrics(int);
extern HWND WINAPI extGetTopWindow(HWND);
extern HDC WINAPI extGDIGetWindowDC(HWND);
extern HDC WINAPI extEMUGetWindowDC(HWND);
extern HDC WINAPI extDDGetWindowDC(HWND);
extern LONG WINAPI extGetWindowLong(HWND, int);
extern LONG WINAPI extGetWindowLongA(HWND, int);
extern LONG WINAPI extGetWindowLongW(HWND, int);
extern BOOL WINAPI extGetWindowRect(HWND, LPRECT);
extern BOOL WINAPI extInvalidateRect(HWND, RECT *, BOOL);
//extern BOOL WINAPI extDDInvalidateRect(HWND, RECT *, BOOL);
@ -567,15 +574,17 @@ 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 ATOM WINAPI extRegisterClassA(WNDCLASSA *);
extern int WINAPI extDDReleaseDC(HWND, HDC);
extern int WINAPI extGDIReleaseDC(HWND, HDC);
extern int WINAPI extEMUReleaseDC(HWND, HDC);
extern int WINAPI extDDReleaseDC(HWND, HDC);
extern BOOL WINAPI extScreenToClient(HWND, LPPOINT);
extern LRESULT WINAPI extSendMessageA(HWND, UINT, WPARAM, LPARAM);
extern LRESULT WINAPI extSendMessageW(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 LONG WINAPI extSetWindowLongA(HWND, int, LONG);
extern LONG WINAPI extSetWindowLongW(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);
@ -584,6 +593,8 @@ extern BOOL WINAPI extDestroyWindow(HWND);
extern BOOL WINAPI extCloseWindow(HWND);
extern BOOL WINAPI extSetSysColors(int, const INT *, const COLORREF *);
extern HDC WINAPI extGDIGetDCEx(HWND, HRGN, DWORD);
extern HDC WINAPI extEMUGetDCEx(HWND, HRGN, DWORD);
extern HDC WINAPI extDDGetDCEx(HWND, HRGN, DWORD);
extern BOOL WINAPI extUpdateWindow(HWND);
extern BOOL WINAPI extGetWindowPlacement(HWND, WINDOWPLACEMENT *);
extern BOOL WINAPI extSetWindowPlacement(HWND, WINDOWPLACEMENT *);

View File

@ -26,8 +26,6 @@ static HookEntry_Type Hooks[]={
{"EnumDisplaySettingsA", (FARPROC)EnumDisplaySettingsA, (FARPROC *)&pEnumDisplaySettings, (FARPROC)extEnumDisplaySettings},
{"GetClipCursor", (FARPROC)GetClipCursor, (FARPROC*)&pGetClipCursor, (FARPROC)extGetClipCursor},
{"ClipCursor", (FARPROC)ClipCursor, (FARPROC *)&pClipCursor, (FARPROC)extClipCursor},
{"FillRect", (FARPROC)NULL, (FARPROC *)&pFillRect, (FARPROC)extFillRect},
{"FrameRect", (FARPROC)NULL, (FARPROC *)&pFrameRect, (FARPROC)extFrameRect},
{"DefWindowProcA", (FARPROC)DefWindowProcA, (FARPROC *)&pDefWindowProc, (FARPROC)extDefWindowProc},
{"CreateWindowExA", (FARPROC)CreateWindowExA, (FARPROC *)&pCreateWindowExA, (FARPROC)extCreateWindowExA},
{"CreateWindowExW", (FARPROC)CreateWindowExW, (FARPROC *)&pCreateWindowExW, (FARPROC)extCreateWindowExW},
@ -35,13 +33,14 @@ static HookEntry_Type Hooks[]={
{"RegisterClassA", (FARPROC)RegisterClassA, (FARPROC *)&pRegisterClassA, (FARPROC)extRegisterClassA},
{"GetSystemMetrics", (FARPROC)GetSystemMetrics, (FARPROC *)&pGetSystemMetrics, (FARPROC)extGetSystemMetrics},
{"GetDesktopWindow", (FARPROC)GetDesktopWindow, (FARPROC *)&pGetDesktopWindow, (FARPROC)extGetDesktopWindow},
{"TabbedTextOutA", (FARPROC)TabbedTextOutA, (FARPROC *)&pTabbedTextOutA, (FARPROC)extTabbedTextOutA},
{"DrawTextA", (FARPROC)DrawTextA, (FARPROC *)&pDrawText, (FARPROC)extDrawTextA},
{"DrawTextExA", (FARPROC)DrawTextExA, (FARPROC *)&pDrawTextEx, (FARPROC)extDrawTextExA},
{"CloseWindow", (FARPROC)NULL, (FARPROC *)&pCloseWindow, (FARPROC)extCloseWindow},
{"DestroyWindow", (FARPROC)NULL, (FARPROC *)&pDestroyWindow, (FARPROC)extDestroyWindow},
{"SetSysColors", (FARPROC)NULL, (FARPROC *)&pSetSysColors, (FARPROC)extSetSysColors},
{"SetCapture", (FARPROC)NULL, (FARPROC *)&pSetCapture, (FARPROC)extSetCapture},
{"SetWindowLongA", (FARPROC)SetWindowLongA, (FARPROC *)&pSetWindowLongA, (FARPROC)extSetWindowLongA},
{"GetWindowLongA", (FARPROC)GetWindowLongA, (FARPROC *)&pGetWindowLongA, (FARPROC)extGetWindowLongA},
{"SetWindowLongW", (FARPROC)SetWindowLongW, (FARPROC *)&pSetWindowLongW, (FARPROC)extSetWindowLongW},
{"GetWindowLongW", (FARPROC)GetWindowLongW, (FARPROC *)&pGetWindowLongW, (FARPROC)extGetWindowLongW},
//{"GetActiveWindow", (FARPROC)NULL, (FARPROC *)&pGetActiveWindow, (FARPROC)extGetActiveWindow},
//{"GetForegroundWindow", (FARPROC)NULL, (FARPROC *)&pGetForegroundWindow, (FARPROC)extGetForegroundWindow},
@ -57,12 +56,13 @@ static HookEntry_Type NoGDIHooks[]={
};
static HookEntry_Type EmulateHooks[]={
{"BeginPaint", (FARPROC)BeginPaint, (FARPROC *)&pBeginPaint, (FARPROC)extBeginPaint},
{"EndPaint", (FARPROC)EndPaint, (FARPROC *)&pEndPaint, (FARPROC)extEndPaint},
{"GetDC", (FARPROC)GetDC, (FARPROC *)&pGDIGetDC, (FARPROC)extGDIGetDC},
{"GetWindowDC", (FARPROC)GetWindowDC, (FARPROC *)&pGDIGetWindowDC, (FARPROC)extGDIGetWindowDC},
{"ReleaseDC", (FARPROC)ReleaseDC, (FARPROC *)&pGDIReleaseDC, (FARPROC)extGDIReleaseDC},
{"InvalidateRect", (FARPROC)InvalidateRect, (FARPROC *)&pInvalidateRect, (FARPROC)extInvalidateRect},
{"BeginPaint", (FARPROC)BeginPaint, (FARPROC *)&pBeginPaint, (FARPROC)extEMUBeginPaint},
{"EndPaint", (FARPROC)EndPaint, (FARPROC *)&pEndPaint, (FARPROC)extEMUEndPaint},
{"GetDC", (FARPROC)GetDC, (FARPROC *)&pGDIGetDC, (FARPROC)extEMUGetDC},
{"GetDCEx", (FARPROC)GetDCEx, (FARPROC *)&pGDIGetDCEx, (FARPROC)extEMUGetDCEx},
{"GetWindowDC", (FARPROC)GetWindowDC, (FARPROC *)&pGDIGetWindowDC, (FARPROC)extEMUGetWindowDC},
{"ReleaseDC", (FARPROC)ReleaseDC, (FARPROC *)&pGDIReleaseDC, (FARPROC)extEMUReleaseDC},
//{"InvalidateRect", (FARPROC)InvalidateRect, (FARPROC *)&pInvalidateRect, (FARPROC)extInvalidateRect},
{0, NULL, 0, 0} // terminator
};
@ -70,6 +70,7 @@ static HookEntry_Type DDHooks[]={
{"BeginPaint", (FARPROC)BeginPaint, (FARPROC *)&pBeginPaint, (FARPROC)extDDBeginPaint},
{"EndPaint", (FARPROC)EndPaint, (FARPROC *)&pEndPaint, (FARPROC)extDDEndPaint},
{"GetDC", (FARPROC)GetDC, (FARPROC *)&pGDIGetDC, (FARPROC)extDDGetDC},
{"GetDCEx", (FARPROC)GetDCEx, (FARPROC *)&pGDIGetDCEx, (FARPROC)extDDGetDCEx},
{"GetWindowDC", (FARPROC)GetWindowDC, (FARPROC *)&pGDIGetWindowDC, (FARPROC)extDDGetDC},
{"ReleaseDC", (FARPROC)ReleaseDC, (FARPROC *)&pGDIReleaseDC, (FARPROC)extDDReleaseDC},
{"InvalidateRect", (FARPROC)InvalidateRect, (FARPROC *)&pInvalidateRect, (FARPROC)extInvalidateRect},
@ -77,6 +78,11 @@ static HookEntry_Type DDHooks[]={
};
static HookEntry_Type ScaledHooks[]={
{"FrameRect", (FARPROC)NULL, (FARPROC *)&pFrameRect, (FARPROC)extFrameRect},
{"TabbedTextOutA", (FARPROC)TabbedTextOutA, (FARPROC *)&pTabbedTextOutA, (FARPROC)extTabbedTextOutA},
{"DrawTextA", (FARPROC)DrawTextA, (FARPROC *)&pDrawText, (FARPROC)extDrawTextA},
{"DrawTextExA", (FARPROC)DrawTextExA, (FARPROC *)&pDrawTextEx, (FARPROC)extDrawTextExA},
{"FillRect", (FARPROC)NULL, (FARPROC *)&pFillRect, (FARPROC)extFillRect},
{"BeginPaint", (FARPROC)BeginPaint, (FARPROC *)&pBeginPaint, (FARPROC)extBeginPaint},
{"EndPaint", (FARPROC)EndPaint, (FARPROC *)&pEndPaint, (FARPROC)extEndPaint},
{"GetDC", (FARPROC)GetDC, (FARPROC *)&pGDIGetDC, (FARPROC)extGDIGetDC},
@ -114,8 +120,6 @@ static HookEntry_Type MouseHooks[]={
static HookEntry_Type WinHooks[]={
{"ShowWindow", (FARPROC)ShowWindow, (FARPROC *)&pShowWindow, (FARPROC)extShowWindow},
{"SetWindowLongA", (FARPROC)SetWindowLongA, (FARPROC *)&pSetWindowLong, (FARPROC)extSetWindowLong},
{"GetWindowLongA", (FARPROC)GetWindowLongA, (FARPROC *)&pGetWindowLong, (FARPROC)extGetWindowLong},
{"SetWindowPos", (FARPROC)SetWindowPos, (FARPROC *)&pSetWindowPos, (FARPROC)extSetWindowPos},
{"DeferWindowPos", (FARPROC)DeferWindowPos, (FARPROC *)&pGDIDeferWindowPos, (FARPROC)extDeferWindowPos},
{"CallWindowProcA", (FARPROC)CallWindowProcA, (FARPROC *)&pCallWindowProc, (FARPROC)extCallWindowProc},
@ -422,9 +426,18 @@ static LRESULT WINAPI FixWindowProc(char *ApiName, HWND hwnd, UINT Msg, WPARAM w
ApiName, hwnd, Msg, ExplainWinMessage(Msg), wParam, lParam);
switch(Msg){
case WM_NCHITTEST:
// v2.02.71 fix: when processing WM_NCHITTEST messages whith fixed coordinates avoid calling
// the *pDefWindowProc call
// fixes "Microsoft Motocross Madness" mouse handling
if((dxw.dwFlags2 & FIXNCHITTEST) && (dxw.dwFlags1 & MODIFYMOUSE)){ // mouse processing
OutTraceDW("%s: suppress WM_NCHITTEST\n", ApiName);
return TRUE;
}
break;
case WM_ERASEBKGND:
OutTraceDW("%s: prevent erase background\n", ApiName);
return 1; // 1=erased
return TRUE; // 1=erased
break; // useless
case WM_GETMINMAXINFO:
dxwFixMinMaxInfo(ApiName, hwnd, lParam);
@ -480,7 +493,6 @@ BOOL WINAPI extInvalidateRect(HWND hwnd, RECT *lpRect, BOOL bErase)
return (*pInvalidateRect)(hwnd, lpRect, bErase);
}
else{
//dxw.MapClient(lpRect);
// just exagerate ...
return (*pInvalidateRect)(hwnd, NULL, bErase);
}
@ -512,11 +524,11 @@ BOOL WINAPI extShowWindow(HWND hwnd, int nCmdShow)
return res;
}
LONG WINAPI extGetWindowLong(HWND hwnd, int nIndex)
LONG WINAPI extGetWindowLong(HWND hwnd, int nIndex, GetWindowLong_Type pGetWindowLong)
{
LONG res;
res=(*pGetWindowLong)(hwnd, nIndex);
res=(*pGetWindowLongA)(hwnd, nIndex);
OutTraceDW("GetWindowLong: hwnd=%x, Index=%x(%s) res=%x\n", hwnd, nIndex, ExplainSetWindowIndex(nIndex), res);
@ -530,7 +542,17 @@ LONG WINAPI extGetWindowLong(HWND hwnd, int nIndex)
return res;
}
LONG WINAPI extSetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong)
LONG WINAPI extGetWindowLongA(HWND hwnd, int nIndex)
{
return extGetWindowLong(hwnd, nIndex, pGetWindowLongA);
}
LONG WINAPI extGetWindowLongW(HWND hwnd, int nIndex)
{
return extGetWindowLong(hwnd, nIndex, pGetWindowLongW);
}
LONG WINAPI extSetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong, SetWindowLong_Type pSetWindowLong)
{
LONG res;
@ -543,12 +565,12 @@ LONG WINAPI extSetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong)
if(nIndex==GWL_STYLE){
OutTraceDW("SetWindowLong: Lock GWL_STYLE=%x\n", dwNewLong);
//return 1;
return (*pGetWindowLong)(hwnd, nIndex);
return (*pGetWindowLongA)(hwnd, nIndex);
}
if(nIndex==GWL_EXSTYLE){
OutTraceDW("SetWindowLong: Lock GWL_EXSTYLE=%x\n", dwNewLong);
//return 1;
return (*pGetWindowLong)(hwnd, nIndex);
return (*pGetWindowLongA)(hwnd, nIndex);
}
}
@ -587,7 +609,7 @@ LONG WINAPI extSetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong)
}
// end of GPL fix
OldProc = (WNDPROC)(*pGetWindowLong)(hwnd, GWL_WNDPROC);
OldProc = (WNDPROC)(*pGetWindowLongA)(hwnd, GWL_WNDPROC);
// v2.02.70 fix
if((OldProc==extWindowProc) ||
(OldProc==extChildWindowProc)||
@ -596,17 +618,27 @@ LONG WINAPI extSetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong)
WhndStackPush(hwnd, (WNDPROC)dwNewLong);
res=(LONG)OldProc;
SetLastError(0);
lres=(WNDPROC)(*pSetWindowLong)(hwnd, GWL_WNDPROC, (LONG)extWindowProc);
lres=(WNDPROC)(*pSetWindowLongA)(hwnd, GWL_WNDPROC, (LONG)extWindowProc);
if(!lres && GetLastError())OutTraceE("SetWindowLong: ERROR err=%d at %d\n", GetLastError(), __LINE__);
}
else {
res=(*pSetWindowLong)(hwnd, nIndex, dwNewLong);
res=(*pSetWindowLongA)(hwnd, nIndex, dwNewLong);
}
OutTraceDW("SetWindowLong: hwnd=%x, nIndex=%x, Val=%x, res=%x\n", hwnd, nIndex, dwNewLong, res);
return res;
}
LONG WINAPI extSetWindowLongA(HWND hwnd, int nIndex, LONG dwNewLong)
{
return extSetWindowLong(hwnd, nIndex, dwNewLong, pSetWindowLongA);
}
LONG WINAPI extSetWindowLongW(HWND hwnd, int nIndex, LONG dwNewLong)
{
return extSetWindowLong(hwnd, nIndex, dwNewLong, pSetWindowLongW);
}
BOOL WINAPI extSetWindowPos(HWND hwnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags)
{
BOOL res;
@ -650,8 +682,8 @@ BOOL WINAPI extSetWindowPos(HWND hwnd, HWND hWndInsertAfter, int X, int Y, int c
RECT rect;
rect.top=rect.left=0;
rect.right=cx; rect.bottom=cy;
dwCurStyle=(*pGetWindowLong)(hwnd, GWL_STYLE);
dwExStyle=(*pGetWindowLong)(hwnd, GWL_EXSTYLE);
dwCurStyle=(*pGetWindowLongA)(hwnd, GWL_STYLE);
dwExStyle=(*pGetWindowLongA)(hwnd, GWL_EXSTYLE);
// BEWARE: from MSDN - If the window is a child window, the return value is undefined.
hMenu = (dwCurStyle & WS_CHILD) ? NULL : GetMenu(hwnd);
AdjustWindowRectEx(&rect, dwCurStyle, (hMenu!=NULL), dwExStyle);
@ -1220,8 +1252,8 @@ static HWND WINAPI extCreateWindowCommon(
if ((!isValidHandle) && dxw.IsFullScreen()){
dxw.SethWnd(hwnd);
extern void AdjustWindowPos(HWND, DWORD, DWORD);
(*pSetWindowLong)(hwnd, GWL_STYLE, (dxw.dwFlags2 & MODALSTYLE) ? 0 : WS_OVERLAPPEDWINDOW);
(*pSetWindowLong)(hwnd, GWL_EXSTYLE, 0);
(*pSetWindowLongA)(hwnd, GWL_STYLE, (dxw.dwFlags2 & MODALSTYLE) ? 0 : WS_OVERLAPPEDWINDOW);
(*pSetWindowLongA)(hwnd, GWL_EXSTYLE, 0);
OutTraceDW("%s: hwnd=%x, set style=WS_OVERLAPPEDWINDOW extstyle=0\n", ApiName, hwnd);
AdjustWindowPos(hwnd, nWidth, nHeight);
(*pShowWindow)(hwnd, SW_SHOWNORMAL);
@ -1237,7 +1269,7 @@ static HWND WINAPI extCreateWindowCommon(
// a hooker (either extWindowProc or extChildWindowProc) you have to retrieve
// the correct value (WhndGetWindowProc) before saving it (WhndStackPush).
long res;
pWindowProc = (WNDPROC)(*pGetWindowLong)(hwnd, GWL_WNDPROC);
pWindowProc = (WNDPROC)(*pGetWindowLongA)(hwnd, GWL_WNDPROC);
if((pWindowProc == extWindowProc) ||
(pWindowProc == extChildWindowProc) ||
(pWindowProc == extDialogWindowProc)){ // avoid recursions
@ -1246,7 +1278,7 @@ static HWND WINAPI extCreateWindowCommon(
pWindowProc=WhndGetWindowProc(Father);
}
OutTraceDW("Hooking CHILD hwnd=%x father WindowProc %x->%x\n", hwnd, pWindowProc, extChildWindowProc);
res=(*pSetWindowLong)(hwnd, GWL_WNDPROC, (LONG)extChildWindowProc);
res=(*pSetWindowLongA)(hwnd, GWL_WNDPROC, (LONG)extChildWindowProc);
if(!res) OutTraceE("%s: SetWindowLong ERROR %x\n", ApiName, GetLastError());
WhndStackPush(hwnd, pWindowProc);
}
@ -1592,28 +1624,6 @@ LONG WINAPI extChangeDisplaySettingsExW(LPCTSTR lpszDeviceName, DEVMODEW *lpDevM
return MyChangeDisplaySettings("ChangeDisplaySettingsExW", TRUE, lpDevMode, dwflags);
}
//HDC WINAPI extEMUGetDC(HWND hwnd)
//{
// HDC ret;
//
// OutTraceDW("GDI.GetDC: hwnd=%x\n", hwnd);
//
// if (dxw.IsDesktop(hwnd)) {
// OutTraceDW("GDI.GetDC: desktop remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd());
// hwnd=dxw.GethWnd();
// ret=dxw.AcquireEmulatedDC(hwnd);
// }
// else{
// ret=(*pGDIGetDC)(hwnd);
// }
// if(ret)
// OutTraceDW("GDI.GetDC: hwnd=%x ret=%x\n", lochwnd, ret);
// else
// OutTraceE("GDI.GetDC ERROR: hwnd=%x err=%d at %d\n", lochwnd, err, __LINE__);
//
// return ret;
//}
HDC WINAPI extGDIGetDC(HWND hwnd)
{
HDC ret;
@ -1627,12 +1637,41 @@ HDC WINAPI extGDIGetDC(HWND hwnd)
}
ret=(*pGDIGetDC)(lochwnd);
if((dxw.dwFlags3 & GDIEMULATEDC) && (dxw.IsDesktop(hwnd)) && (dxw.VirtualHDC==NULL)){
ret=dxw.AcquireEmulatedDC(lochwnd);
OutTraceDW("GDI.GetDC(GDIEMULATEDC): remapping hdc=%x->%x\n", (*pGDIGetDC)(hwnd), ret);
dxw.VirtualHDC=ret;
if(ret){
OutTraceDW("GDI.GetDC: hwnd=%x ret=%x\n", lochwnd, ret);
}
else{
int err;
err=GetLastError();
OutTraceE("GDI.GetDC ERROR: hwnd=%x err=%d at %d\n", lochwnd, err, __LINE__);
if((err==ERROR_INVALID_WINDOW_HANDLE) && (lochwnd!=hwnd)){
ret=(*pGDIGetDC)(hwnd);
if(ret)
OutTraceDW("GDI.GetDC: hwnd=%x ret=%x\n", hwnd, ret);
else
OutTraceE("GDI.GetDC ERROR: hwnd=%x err=%d at %d\n", hwnd, GetLastError(), __LINE__);
}
}
return ret;
}
HDC WINAPI extEMUGetDC(HWND hwnd)
{
HDC ret;
HWND lochwnd;
OutTraceDW("GDI.GetDC: hwnd=%x\n", hwnd);
lochwnd=hwnd;
if (dxw.IsRealDesktop(hwnd)) {
OutTraceDW("GDI.GetDC: desktop remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd());
lochwnd=dxw.GethWnd();
}
ret=dxw.AcquireEmulatedDC(lochwnd);
OutTraceDW("GDI.GetDC: remapping hdc=%x->%x\n", (*pGDIGetDC)(hwnd), ret);
dxw.VirtualHDC=ret;
if(ret){
OutTraceDW("GDI.GetDC: hwnd=%x ret=%x\n", lochwnd, ret);
@ -1666,10 +1705,43 @@ HDC WINAPI extGDIGetDCEx(HWND hwnd, HRGN hrgnClip, DWORD flags)
lochwnd=dxw.GethWnd();
}
if(dxw.dwFlags3 & GDIEMULATEDC)
ret=dxw.AcquireEmulatedDC(lochwnd);
else
ret=(*pGDIGetDC)(lochwnd);
ret=(*pGDIGetDC)(lochwnd);
if(ret){
OutTraceDW("GDI.GetDCEx: hwnd=%x ret=%x\n", lochwnd, ret);
}
else{
int err;
err=GetLastError();
OutTraceE("GDI.GetDCEx ERROR: hwnd=%x err=%d at %d\n", lochwnd, err, __LINE__);
if((err==ERROR_INVALID_WINDOW_HANDLE) && (lochwnd!=hwnd)){
ret=(*pGDIGetDCEx)(hwnd, hrgnClip, flags);
if(ret)
OutTraceDW("GDI.GetDCEx: hwnd=%x ret=%x\n", hwnd, ret);
else
OutTraceE("GDI.GetDCEx ERROR: hwnd=%x err=%d at %d\n", hwnd, GetLastError(), __LINE__);
}
}
return ret;
}
HDC WINAPI extEMUGetDCEx(HWND hwnd, HRGN hrgnClip, DWORD flags)
{
// used by Star Wars Shadow of the Empire
HDC ret;
HWND lochwnd;
OutTraceDW("GDI.GetDCEx: hwnd=%x hrgnClip=%x flags=%x(%s)\n", hwnd, hrgnClip, flags, ExplainGetDCExFlags(flags));
lochwnd=hwnd;
if (dxw.IsRealDesktop(hwnd)) {
OutTraceDW("GDI.GetDCEx: desktop remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd());
lochwnd=dxw.GethWnd();
}
ret=dxw.AcquireEmulatedDC(lochwnd);
OutTraceDW("GDI.GetDCEx: remapping hdc=%x->%x\n", (*pGDIGetDC)(hwnd), ret);
dxw.VirtualHDC=ret;
if(ret){
OutTraceDW("GDI.GetDCEx: hwnd=%x ret=%x\n", lochwnd, ret);
@ -1701,6 +1773,43 @@ HDC WINAPI extGDIGetWindowDC(HWND hwnd)
lochwnd=dxw.GethWnd();
}
if(dxw.IsFullScreen()){
ret=dxw.AcquireEmulatedDC(lochwnd);
OutTraceDW("GDI.GetWindowDC: remapping hdc=%x->%x\n", (*pGDIGetDC)(hwnd), ret);
dxw.VirtualHDC=ret;
}
else
ret=(*pGDIGetWindowDC)(lochwnd);
if(ret){
OutTraceDW("GDI.GetWindowDC: hwnd=%x ret=%x\n", lochwnd, ret);
}
else{
int err;
err=GetLastError();
OutTraceE("GDI.GetWindowDC ERROR: hwnd=%x err=%d at %d\n", lochwnd, err, __LINE__);
if((err==ERROR_INVALID_WINDOW_HANDLE) && (lochwnd!=hwnd)){
ret=(*pGDIGetWindowDC)(hwnd);
if(ret)
OutTraceDW("GDI.GetWindowDC: hwnd=%x ret=%x\n", hwnd, ret);
else
OutTraceE("GDI.GetWindowDC ERROR: hwnd=%x err=%d at %d\n", hwnd, GetLastError(), __LINE__);
}
}
return ret;
}
HDC WINAPI extEMUGetWindowDC(HWND hwnd)
{
HDC ret;
HWND lochwnd;
OutTraceDW("GDI.GetWindowDC: hwnd=%x\n", hwnd);
lochwnd=hwnd;
if (dxw.IsRealDesktop(hwnd)) {
OutTraceDW("GDI.GetWindowDC: desktop remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd());
lochwnd=dxw.GethWnd();
}
if(dxw.IsDesktop(hwnd) && dxw.IsFullScreen())
ret=(*pGDIGetDC)(lochwnd);
else
@ -1729,13 +1838,24 @@ int WINAPI extGDIReleaseDC(HWND hwnd, HDC hDC)
int res;
OutTraceDW("GDI.ReleaseDC: hwnd=%x hdc=%x\n", hwnd, hDC);
if (dxw.IsRealDesktop(hwnd)) hwnd=dxw.GethWnd();
if((dxw.dwFlags3 & GDIEMULATEDC) && (hDC == dxw.VirtualHDC)) // v2.02.53 !!!!!
res=dxw.ReleaseEmulatedDC(hwnd);
else
res=(*pGDIReleaseDC)(hwnd, hDC);
if (dxw.IsRealDesktop(hwnd)) hwnd=dxw.GethWnd();
res=(*pGDIReleaseDC)(hwnd, hDC);
if (!res) OutTraceE("GDI.ReleaseDC ERROR: err=%d at %d\n", GetLastError(), __LINE__);
return(res);
}
int WINAPI extEMUReleaseDC(HWND hwnd, HDC hDC)
{
int res;
HDC windc;
OutTraceDW("GDI.ReleaseDC: hwnd=%x hdc=%x\n", hwnd, hDC);
if (dxw.IsRealDesktop(hwnd)) hwnd=dxw.GethWnd();
windc=(*pGDIGetDC)(hwnd);
res=dxw.ReleaseEmulatedDC(hwnd);
res=(*pGDIReleaseDC)(hwnd, windc);
if (!res) OutTraceE("GDI.ReleaseDC ERROR: err=%d at %d\n", GetLastError(), __LINE__);
return(res);
}
@ -1747,28 +1867,42 @@ HDC WINAPI extBeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint)
OutTraceDW("GDI.BeginPaint: hwnd=%x lpPaint=%x FullScreen=%x\n", hwnd, lpPaint, dxw.IsFullScreen());
hdc=(*pBeginPaint)(hwnd, lpPaint);
// avoid access to real desktop
if(dxw.IsRealDesktop(hwnd)) hwnd=dxw.GethWnd();
// if not in fullscreen mode, that's all!
if(!dxw.IsFullScreen()) return hdc;
// on CLIENTREMAPPING, resize the paint area to virtual screen size
if(dxw.dwFlags1 & CLIENTREMAPPING) lpPaint->rcPaint=dxw.GetScreenRect();
if(!dxw.IsDesktop(hwnd)) return hdc;
if(dxw.dwFlags3 & GDIEMULATEDC) {
HDC EmuHDC;
EmuHDC = dxw.AcquireEmulatedDC(hwnd);
lpPaint->hdc=EmuHDC;
//dxw.MapClient(&lpPaint->rcPaint);
OutTraceDW("GDI.BeginPaint(GDIEMULATEDC): hdc=%x -> %x\n", hdc, EmuHDC);
return EmuHDC;
}
OutTraceDW("GDI.BeginPaint: hdc=%x\n", hdc);
return hdc;
}
#ifndef EXPERIMENTAL
HDC WINAPI extEMUBeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint)
{
HDC hdc;
HDC EmuHDC;
OutTraceDW("GDI.BeginPaint: hwnd=%x lpPaint=%x FullScreen=%x\n", hwnd, lpPaint, dxw.IsFullScreen());
hdc=(*pBeginPaint)(hwnd, lpPaint);
// avoid access to real desktop
if(dxw.IsRealDesktop(hwnd)) hwnd=dxw.GethWnd();
// if not in fullscreen mode, that's all!
if(!dxw.IsFullScreen()) return hdc;
// on CLIENTREMAPPING, resize the paint area to virtual screen size
if(dxw.dwFlags1 & CLIENTREMAPPING) lpPaint->rcPaint=dxw.GetScreenRect();
EmuHDC = dxw.AcquireEmulatedDC(hwnd);
lpPaint->hdc=EmuHDC;
OutTraceDW("GDI.BeginPaint: hdc=%x -> %x\n", hdc, EmuHDC);
return EmuHDC;
}
HDC WINAPI extDDBeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint)
{
HDC hdc;
@ -1814,51 +1948,6 @@ HDC WINAPI extDDBeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint)
OutTraceDW("GDI.BeginPaint(MAPGDITOPRIMARY): hdc=%x -> %x\n", hdc, PrimHDC);
return PrimHDC;
}
#else
HDC WINAPI extDDBeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint)
{
HDC hdc;
extern HRESULT WINAPI extGetDC(LPDIRECTDRAWSURFACE, HDC FAR *);
OutTraceDW("GDI.BeginPaint: hwnd=%x%s lpPaint=%x FullScreen=%x\n",
hwnd, dxw.IsDesktop(hwnd)?"(DESKTOP)":"", lpPaint, dxw.IsFullScreen());
if(dxw.IsDesktop(hwnd)) hwnd=dxw.GethWnd();
hdc=(*pBeginPaint)(hwnd, lpPaint);
// if not in fullscreen mode, that's all!
if(!dxw.IsFullScreen()) return hdc;
// on MAPGDITOPRIMARY, return the PrimHDC handle instead of the window DC
// if a primary surface has not been created yet, do it
if(!pGetDC || !dxw.lpDDSPrimHDC){
extern HRESULT WINAPI extDirectDrawCreate(GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR *);
HRESULT res;
LPDIRECTDRAW lpDD;
LPDIRECTDRAWSURFACE lpDDS;
DDSURFACEDESC ddsd;
res=extDirectDrawCreate(0, &lpDD, NULL);
lpDD->SetCooperativeLevel(dxw.GethWnd(), DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE);
memset((void *)&ddsd, 0, sizeof(DDSURFACEDESC));
ddsd.dwSize = sizeof(DDSURFACEDESC);
ddsd.dwFlags = DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
ddsd.dwHeight = dxw.GetScreenHeight();
ddsd.dwWidth = dxw.GetScreenWidth();
res=lpDD->CreateSurface(&ddsd, &lpDDS, NULL);
dxw.lpDDSPrimHDC = lpDDS;
OutTraceDW("GDI.BeginPaint(MAPGDITOPRIMARY): dd=%x ddsPrim=%x\n", lpDD, lpDDS);
}
HDC EmuHDC;
EmuHDC = dxw.AcquireEmulatedDC(dxw.lpDDSPrimHDC);
lpPaint->hdc=EmuHDC;
lpPaint->rcPaint=dxw.GetScreenRect();
OutTraceDW("GDI.BeginPaint(MAPGDITOPRIMARY): hdc=%x -> %x\n", hdc, EmuHDC);
return EmuHDC;
}
#endif
BOOL WINAPI extEndPaint(HWND hwnd, const PAINTSTRUCT *lpPaint)
{
@ -1866,11 +1955,23 @@ BOOL WINAPI extEndPaint(HWND hwnd, const PAINTSTRUCT *lpPaint)
OutTraceDW("GDI.EndPaint: hwnd=%x lpPaint=%x lpPaint.hdc=%x\n", hwnd, lpPaint, lpPaint->hdc);
if((dxw.dwFlags3 & GDIEMULATEDC) && dxw.IsFullScreen() && dxw.IsDesktop(hwnd)){
ret=(*pEndPaint)(hwnd, lpPaint);
OutTraceDW("GDI.EndPaint: hwnd=%x ret=%x\n", hwnd, ret);
if(!ret) OutTraceE("GDI.EndPaint ERROR: err=%d at %d\n", GetLastError(), __LINE__);
return ret;
}
BOOL WINAPI extEMUEndPaint(HWND hwnd, const PAINTSTRUCT *lpPaint)
{
BOOL ret;
OutTraceDW("GDI.EndPaint: hwnd=%x lpPaint=%x lpPaint.hdc=%x\n", hwnd, lpPaint, lpPaint->hdc);
if(dxw.IsFullScreen()){
OutTraceDW("GDI.EndPaint(GDIEMULATEDC): hwnd=%x\n", hwnd);
ret=dxw.ReleaseEmulatedDC(hwnd);
}
else
// proxy part ...
ret=(*pEndPaint)(hwnd, lpPaint);
OutTraceDW("GDI.EndPaint: hwnd=%x ret=%x\n", hwnd, ret);
@ -1878,7 +1979,6 @@ BOOL WINAPI extEndPaint(HWND hwnd, const PAINTSTRUCT *lpPaint)
return ret;
}
#ifndef EXPERIMENTAL
BOOL WINAPI extDDEndPaint(HWND hwnd, const PAINTSTRUCT *lpPaint)
{
BOOL ret;
@ -1886,16 +1986,32 @@ BOOL WINAPI extDDEndPaint(HWND hwnd, const PAINTSTRUCT *lpPaint)
extern HRESULT WINAPI extGetDC(LPDIRECTDRAWSURFACE, HDC FAR *);
extern HRESULT WINAPI extBlt(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect, DWORD dwflags, LPDDBLTFX lpddbltfx);
OutTraceDW("GDI.EndPaint: hwnd=%x%s lpPaint=%x lpPaint.hdc=%x\n",
OutTraceDW("GDI.EndPaint(DD): hwnd=%x%s lpPaint=%x lpPaint.hdc=%x\n",
hwnd, dxw.IsDesktop(hwnd)?"(DESKTOP)":"", lpPaint, lpPaint->hdc);
// v2.02.53 ...
//if(dxw.IsFullScreen() && dxw.IsDesktop(hwnd)){
if(dxw.IsFullScreen()){
RECT Rect;
LPRECT lpRect;
ret=(*pEndPaint)(hwnd, lpPaint);
dxw.lpDDSPrimHDC->Unlock(NULL);
//dxw.ScreenRefresh();
extBlt(dxw.lpDDSPrimHDC, NULL, dxw.lpDDSPrimHDC, NULL, 0, NULL);
if(dxw.IsDesktop(hwnd))
lpRect=NULL;
else{
POINT p={0,0};
lpRect=&Rect;
(*pGetClientRect)(hwnd, lpRect);
p=dxw.ClientOffset(hwnd);
lpRect->left += p.x;
lpRect->right += p.x;
lpRect->top += p.y;
lpRect->bottom += p.y;
//dxw.AddCoordinates(lpRect, p);
dxw.UnmapClient(lpRect);
}
extBlt(dxw.lpDDSPrimHDC, lpRect, dxw.lpDDSPrimHDC, NULL, 0, NULL);
return TRUE;
}
@ -1905,40 +2021,6 @@ BOOL WINAPI extDDEndPaint(HWND hwnd, const PAINTSTRUCT *lpPaint)
if(!ret) OutTraceE("GDI.EndPaint ERROR: err=%d at %d\n", GetLastError(), __LINE__);
return ret;
}
#else
BOOL WINAPI extDDEndPaint(HWND hwnd, const PAINTSTRUCT *lpPaint)
{
BOOL ret;
extern HRESULT WINAPI extReleaseDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR hdc);
extern HRESULT WINAPI extGetDC(LPDIRECTDRAWSURFACE, HDC FAR *);
extern HRESULT WINAPI extBlt(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect, DWORD dwflags, LPDDBLTFX lpddbltfx);
OutTraceDW("GDI.EndPaint: hwnd=%x%s lpPaint=%x lpPaint.hdc=%x\n",
hwnd, dxw.IsDesktop(hwnd)?"(DESKTOP)":"", lpPaint, lpPaint->hdc);
// v2.02.53 ...
//if(dxw.IsFullScreen() && dxw.IsDesktop(hwnd)){
if(dxw.IsFullScreen()){
RECT client;
HDC hdc;
ret=(*pEndPaint)(hwnd, lpPaint);
(*pGetDC)(dxw.lpDDSPrimHDC, &hdc);
(*pGetClientRect)(hwnd, &client);
if(!(*pGDIBitBlt)(hdc, 0, 0, client.right, client.bottom, lpPaint->hdc, 0, 0, SRCCOPY))
OutTraceE("StretchBlt: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
extReleaseDC(dxw.lpDDSPrimHDC, hdc);
//dxw.ScreenRefresh();
extBlt(dxw.lpDDSPrimHDC, NULL, dxw.lpDDSPrimHDC, NULL, 0, NULL);
return TRUE;
}
// proxy part ...
ret=(*pEndPaint)(hwnd, lpPaint);
OutTraceDW("GDI.EndPaint: hwnd=%x ret=%x\n", hwnd, ret);
if(!ret) OutTraceE("GDI.EndPaint ERROR: err=%d at %d\n", GetLastError(), __LINE__);
return ret;
}
#endif
HWND WINAPI extCreateDialogIndirectParam(HINSTANCE hInstance, LPCDLGTEMPLATE lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParamInit)
{
@ -1950,7 +2032,7 @@ HWND WINAPI extCreateDialogIndirectParam(HINSTANCE hInstance, LPCDLGTEMPLATE lpT
RetHWND=(*pCreateDialogIndirectParam)(hInstance, lpTemplate, hWndParent, lpDialogFunc, lParamInit);
WhndStackPush(RetHWND, (WNDPROC)lpDialogFunc);
if(!(*pSetWindowLong)(RetHWND, DWL_DLGPROC, (LONG)extDialogWindowProc))
if(!(*pSetWindowLongA)(RetHWND, DWL_DLGPROC, (LONG)extDialogWindowProc))
OutTraceE("SetWindowLong: ERROR err=%d at %d\n", GetLastError(), __LINE__);
OutTraceDW("CreateDialogIndirectParam: hwnd=%x\n", RetHWND);
@ -1969,7 +2051,7 @@ HWND WINAPI extCreateDialogParam(HINSTANCE hInstance, LPCTSTR lpTemplateName, HW
RetHWND=(*pCreateDialogParam)(hInstance, lpTemplateName, hWndParent, lpDialogFunc, lParamInit);
WhndStackPush(RetHWND, (WNDPROC)lpDialogFunc);
if(!(*pSetWindowLong)(RetHWND, DWL_DLGPROC, (LONG)extDialogWindowProc))
if(!(*pSetWindowLongA)(RetHWND, DWL_DLGPROC, (LONG)extDialogWindowProc))
OutTraceE("SetWindowLong: ERROR err=%d at %d\n", GetLastError(), __LINE__);
OutTraceDW("CreateDialogParam: hwnd=%x\n", RetHWND);
@ -2002,7 +2084,7 @@ BOOL WINAPI extMoveWindow(HWND hwnd, int X, int Y, int nWidth, int nHeight, BOOL
BOOL isChild;
(*pClientToScreen)(dxw.GethWnd(),&upleft);
(*pGetClientRect)(dxw.GethWnd(),&client);
if ((*pGetWindowLong)(hwnd, GWL_STYLE) & WS_CHILD){
if ((*pGetWindowLongA)(hwnd, GWL_STYLE) & WS_CHILD){
isChild=TRUE;
// child coordinate adjustement
X = (X * client.right) / dxw.GetScreenWidth();

View File

@ -47,6 +47,8 @@
#define IDC_FILE 1000
#define IDC_OPEN 1001
#define IDC_MODULE 1002
#define IDC_LAUNCH 1003
#define IDC_OPENLAUNCH 1004
#define IDC_STATUSINFO 1005
#define IDC_VERSION 1006
#define IDC_UNNOTIFY 1007
@ -73,8 +75,6 @@
#define IDC_VIDEOTOSYSTEMMEM 1030
#define IDC_FIXTEXTOUT 1031
#define IDC_KEEPCURSORWITHIN 1032
#define IDC_FIXTEXTOUT2 1032
#define IDC_HOOKGLIDE 1032
#define IDC_USERGB565 1033
#define IDC_SUPPRESSDXERRORS 1034
#define IDC_PREVENTMAXIMIZE 1035
@ -89,7 +89,6 @@
#define IDC_POSY 1047
#define IDC_SIZX 1048
#define IDC_SIZY 1049
#define IDC_DISABLEFOGGING 1049
#define IDC_HOOKCHILDWIN 1050
#define IDC_MESSAGEPROC 1051
#define IDC_RECOVERSCREENMODE 1053
@ -132,13 +131,11 @@
#define IDC_WINDOWIZE 1091
#define IDC_NOBANNER 1092
#define IDC_STARTDEBUG 1093
#define IDC_PALETTECOLORS 1093
#define IDC_WIREFRAME 1094
#define IDC_DISABLEGAMMARAMP 1095
#define IDC_FORCEWINRESIZE 1096
#define IDC_FORCE16BPP 1097
#define IDC_FORCEHOOKOPENGL 1098
#define IDC_LISTRES 1098
#define IDC_DESKTOPCENTER 1099
#define IDC_COORDINATES 1100
#define IDC_SUPPRESSD3DEXT 1101
@ -211,6 +208,11 @@
#define IDC_SUPPORTSVGA 1170
#define IDC_SUPPORTHDMI 1171
#define IDC_NATIVERES 1172
#define IDC_LISTRES 1173
#define IDC_PALETTECOLORS 1174
#define IDC_DISABLEFOGGING 1175
#define IDC_RELEASEMOUSE 1176
#define IDC_HOOKGLIDE 1177
#define ID_MODIFY 32771
#define ID_DELETE 32772
#define ID_ADD 32773

View File

@ -1,9 +1,9 @@
// TabDirectX.cpp : implementation file
// TabInput.cpp : implementation file
//
#include "stdafx.h"
#include "TargetDlg.h"
#include "TabMouse.h"
#include "TabInput.h"
#ifdef _DEBUG
#define new DEBUG_NEW
@ -37,6 +37,7 @@ void CTabInput::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_MESSAGEPROC, cTarget->m_MessageProc);
DDX_Check(pDX, IDC_FIXNCHITTEST, cTarget->m_FixNCHITTEST);
DDX_Check(pDX, IDC_SLOW, cTarget->m_SlowDown);
DDX_Check(pDX, IDC_RELEASEMOUSE, cTarget->m_ReleaseMouse);
// DirectInput
DDX_Check(pDX, IDC_HOOKDI, cTarget->m_HookDI);
DDX_Text(pDX, IDC_INITX, cTarget->m_InitX);
@ -45,6 +46,9 @@ void CTabInput::DoDataExchange(CDataExchange* pDX)
DDX_Text(pDX, IDC_MAXY, cTarget->m_MaxY);
DDX_Text(pDX, IDC_MINX, cTarget->m_MinX);
DDX_Text(pDX, IDC_MINY, cTarget->m_MinY);
// Message processing
DDX_Check(pDX, IDC_FILTERMESSAGES, cTarget->m_FilterMessages);
DDX_Check(pDX, IDC_PEEKALLMESSAGES, cTarget->m_PeekAllMessages);
}
BEGIN_MESSAGE_MAP(CTabInput, CDialog)

View File

@ -28,18 +28,17 @@ void CTabProgram::DoDataExchange(CDataExchange* pDX)
CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent()));
DDX_Radio(pDX, IDC_COORDINATES, cTarget->m_Coordinates);
DDX_Control(pDX, IDC_FILE, cTarget->m_File);
DDX_Control(pDX, IDC_LAUNCH, cTarget->m_Launch);
DDX_Text(pDX, IDC_FILE, cTarget->m_FilePath);
DDX_Text(pDX, IDC_LAUNCH, cTarget->m_LaunchPath);
DDX_Text(pDX, IDC_TITLE, cTarget->m_Title);
DDX_Text(pDX, IDC_MODULE, cTarget->m_Module);
DDX_Check(pDX, IDC_UNNOTIFY, cTarget->m_UnNotify);
DDX_Check(pDX, IDC_WINDOWIZE, cTarget->m_Windowize);
DDX_Check(pDX, IDC_HOOKDLLS, cTarget->m_HookDLLs);
DDX_Check(pDX, IDC_FULLSCREENONLY, cTarget->m_FullScreenOnly);
DDX_Check(pDX, IDC_FILTERMESSAGES, cTarget->m_FilterMessages);
DDX_Check(pDX, IDC_PEEKALLMESSAGES, cTarget->m_PeekAllMessages);
DDX_Check(pDX, IDC_HOOKCHILDWIN, cTarget->m_HookChildWin);
DDX_Check(pDX, IDC_HOOKENABLED, cTarget->m_HookEnabled);
DDX_Check(pDX, IDC_NOBANNER, cTarget->m_NoBanner);
DDX_Check(pDX, IDC_STARTDEBUG, cTarget->m_StartDebug);
DDX_Check(pDX, IDC_CLIENTREMAPPING, cTarget->m_ClientRemapping);
DDX_Check(pDX, IDC_SAVELOAD, cTarget->m_SaveLoad);
@ -56,6 +55,7 @@ BEGIN_MESSAGE_MAP(CTabProgram, CDialog)
//{{AFX_MSG_MAP(CTabProgram)
// NOTE: the ClassWizard will add message map macros here
ON_BN_CLICKED(IDC_OPEN, OnOpen)
ON_BN_CLICKED(IDC_OPENLAUNCH, OnOpenLaunch)
//}}AFX_MSG_MAP
//ON_BN_CLICKED(IDC_COORDINATES, &CTabProgram::OnBnClickedCoordinates)
//ON_BN_CLICKED(IDC_DESKTOPWORKAREA, &CTabProgram::OnBnClickedDesktopworkarea)
@ -75,6 +75,18 @@ void CTabProgram::OnOpen()
"Program (*.exe)|*.exe|All Files (*.*)|*.*||", this);
if( dlg.DoModal() == IDOK) cTarget->m_File.SetWindowText(dlg.GetPathName());
}
void CTabProgram::OnOpenLaunch()
{
// TODO: Please add your control notification handler code here
char path[MAX_PATH];
CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent()));
cTarget->m_File.GetWindowText(path, MAX_PATH);
CFileDialog dlg( TRUE, "*.*", path, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
"Program (*.exe)|*.exe|All Files (*.*)|*.*||", this);
if( dlg.DoModal() == IDOK) cTarget->m_Launch.SetWindowText(dlg.GetPathName());
}
void CTabProgram::OnBnClickedCoordinates()
{
// TODO: Add your control notification handler code here

View File

@ -17,6 +17,7 @@ class CTabProgram : public CDialog
public:
CTabProgram(CWnd* pParent = NULL); // standard constructor
void OnOpen(void);
void OnOpenLaunch(void);
// Dialog Data
//{{AFX_DATA(CTabProgram)

View File

@ -45,6 +45,7 @@ void CTabWindow::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_NOWINDOWMOVE, cTarget->m_NoWindowMove);
DDX_Check(pDX, IDC_SUPPRESSCHILD, cTarget->m_SuppressChild);
DDX_Check(pDX, IDC_HIDEDESKTOP, cTarget->m_HideDesktop);
DDX_Check(pDX, IDC_NOBANNER, cTarget->m_NoBanner);
// color management
DDX_Check(pDX, IDC_INIT8BPP, cTarget->m_Init8BPP);

View File

@ -126,6 +126,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_TimeStretch = FALSE;
m_StretchTimers = FALSE;
m_FineTiming = FALSE;
m_ReleaseMouse = FALSE;
m_InterceptRDTSC = FALSE;
m_HookOpenGL = FALSE;
m_ForceHookOpenGL = FALSE;

View File

@ -23,6 +23,7 @@ public:
enum { IDD = IDD_TARGET };
CDXTabCtrl m_tabdxTabCtrl;
CEdit m_File;
CEdit m_Launch;
int m_DXVersion;
int m_Coordinates;
int m_DxEmulationMode;
@ -54,6 +55,7 @@ public:
BOOL m_StartDebug;
BOOL m_HookEnabled;
CString m_FilePath;
CString m_LaunchPath;
CString m_Module;
CString m_Title;
CString m_OpenGLLib;
@ -107,6 +109,7 @@ public:
BOOL m_TimeStretch;
BOOL m_StretchTimers;
BOOL m_FineTiming;
BOOL m_ReleaseMouse;
BOOL m_InterceptRDTSC;
BOOL m_HookOpenGL;
BOOL m_ForceHookOpenGL;

View File

@ -24,7 +24,7 @@
#include "TabProgram.h"
#include "TabLogs.h"
#include "TabDirectX.h"
#include "TabMouse.h"
#include "TabInput.h"
#include "TabTiming.h"
#include "TabWindow.h"
#include "TabOpenGL.h"

Binary file not shown.

View File

@ -22,6 +22,7 @@
typedef struct PRIVATEMAP
{
char title[40+1];
char launchpath[MAX_PATH+1];
}PRIVATEMAP;
/////////////////////////////////////////////////////////////////////////////

View File

@ -259,8 +259,8 @@ BEGIN
EDITTEXT IDC_FILE,39,31,162,14,ES_AUTOHSCROLL
LTEXT "Path:",IDC_STATIC,11,33,22,9
PUSHBUTTON "...",IDC_OPEN,207,31,12,14
EDITTEXT IDC_MODULE,39,49,161,14,ES_AUTOHSCROLL
LTEXT "Module:",IDC_STATIC,11,52,25,9
EDITTEXT IDC_MODULE,39,65,161,14,ES_AUTOHSCROLL
LTEXT "Module:",IDC_STATIC,11,68,25,9
LTEXT "Window initial position && size",IDC_STATIC,18,198,115,9
LTEXT "X",IDC_STATIC,18,214,9,9
LTEXT "Y",IDC_STATIC,49,214,9,9
@ -270,27 +270,27 @@ BEGIN
EDITTEXT IDC_POSY,55,210,19,14,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
EDITTEXT IDC_SIZX,85,210,19,14,ES_AUTOHSCROLL,WS_EX_RIGHT
EDITTEXT IDC_SIZY,113,210,19,14,ES_AUTOHSCROLL,WS_EX_RIGHT
CONTROL "Do not notify on task switch",IDC_UNNOTIFY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,93,124,10
CONTROL "Optimize CPU (DirectX1 - 7)",IDC_SAVELOAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,129,109,10
CONTROL "Intercept Alt-F4 key",IDC_HANDLEALTF4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,105,109,10
CONTROL "Run in Window",IDC_WINDOWIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,117,124,10
GROUPBOX "Generic",IDC_STATIC,7,65,286,106
CONTROL "No banner",IDC_NOBANNER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,93,108,10
CONTROL "use DLL Injection",IDC_STARTDEBUG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,105,100,10
CONTROL "Remap Client Rect",IDC_CLIENTREMAPPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,81,115,10
CONTROL "Hook all DLLs",IDC_HOOKDLLS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,129,124,10
CONTROL "Hook enabled",IDC_HOOKENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,81,124,10
CONTROL "Do not notify on task switch",IDC_UNNOTIFY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,105,124,10
CONTROL "Optimize CPU (DirectX1 - 7)",IDC_SAVELOAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,141,109,10
CONTROL "Intercept Alt-F4 key",IDC_HANDLEALTF4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,117,109,10
CONTROL "Run in Window",IDC_WINDOWIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,129,124,10
GROUPBOX "Generic",IDC_STATIC,7,82,286,89
CONTROL "use DLL Injection",IDC_STARTDEBUG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,117,100,10
CONTROL "Remap Client Rect",IDC_CLIENTREMAPPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,93,115,10
CONTROL "Hook all DLLs",IDC_HOOKDLLS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,141,124,10
CONTROL "Hook enabled",IDC_HOOKENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,93,124,10
CONTROL "X,Y coordinates",IDC_COORDINATES,"Button",BS_AUTORADIOBUTTON | WS_GROUP,170,184,95,10
CONTROL "Desktop center",IDC_DESKTOPCENTER,"Button",BS_AUTORADIOBUTTON,170,194,95,10
CONTROL "Desktop work area",IDC_DESKTOPWORKAREA,"Button",BS_AUTORADIOBUTTON,170,204,95,10
CONTROL "Desktop",IDC_DESKTOPFULL,"Button",BS_AUTORADIOBUTTON,170,214,95,10
CONTROL "Hook child WindowProc",IDC_HOOKCHILDWIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,117,104,10
CONTROL "Fullscreen only",IDC_FULLSCREENONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,141,114,10
CONTROL "Filter offending messages",IDC_FILTERMESSAGES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,153,114,10
CONTROL "Peek all messages in queue",IDC_PEEKALLMESSAGES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,153,114,10
CONTROL "Hook child WindowProc",IDC_HOOKCHILDWIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,129,104,10
CONTROL "Fullscreen only",IDC_FULLSCREENONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,153,114,10
GROUPBOX "Position",IDC_STATIC,7,172,286,56
CONTROL "Keep aspect ratio",IDC_KEEPASPECTRATIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,185,115,10
CONTROL "Hook OpenGL",IDC_HOOKOPENGL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,141,115,10
CONTROL "Hook OpenGL",IDC_HOOKOPENGL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,153,115,10
EDITTEXT IDC_LAUNCH,39,48,162,14,ES_AUTOHSCROLL
LTEXT "Launch:",IDC_STATIC,11,51,28,9
PUSHBUTTON "...",IDC_OPENLAUNCH,207,48,12,14
END
IDD_TAB_LOG DIALOGEX 0, 0, 300, 240
@ -360,7 +360,7 @@ BEGIN
CONTROL "Hide Cursor",IDC_HIDEHWCURSOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,15,100,10
CONTROL "Intercept GDI Cursor Clipping",IDC_ENABLECLIPPING,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,85,109,10
GROUPBOX "Cursor handling",IDC_STATIC,7,3,129,134
GROUPBOX "Cursor handling",IDC_STATIC,7,3,129,148
CONTROL "Keep cursor within window",IDC_KEEPCURSORWITHIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,61,108,10
CONTROL "Force cursor clipping",IDC_CLIPCURSOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,50,108,10
CONTROL "Message processing",IDC_MESSAGEPROC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,96,103,10
@ -385,6 +385,10 @@ BEGIN
CONTROL "DirectInput Hooking",IDC_HOOKDI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,15,97,12
GROUPBOX "DirectInput",IDC_STATIC,141,3,152,71
LTEXT " X,Y range",IDC_STATIC,147,54,42,9
CONTROL "Filter offending messages",IDC_FILTERMESSAGES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,96,114,10
CONTROL "Peek all messages in queue",IDC_PEEKALLMESSAGES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,108,114,10
GROUPBOX "Message handling",IDC_STATIC,142,79,151,72
CONTROL "Release mouse outside window",IDC_RELEASEMOUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,130,114,12
END
IDD_TAB_TIMING DIALOGEX 0, 0, 300, 240
@ -443,6 +447,7 @@ BEGIN
CONTROL "SVGA modes",IDC_SUPPORTSVGA,"Button",BS_AUTORADIOBUTTON | WS_GROUP,160,136,124,10
CONTROL "HDMI modes",IDC_SUPPORTHDMI,"Button",BS_AUTORADIOBUTTON,160,148,124,10
CONTROL "Monitor native modes",IDC_NATIVERES,"Button",BS_AUTORADIOBUTTON,160,160,124,10
CONTROL "No banner",IDC_NOBANNER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,196,108,10
END
IDD_TAB_EMPTY DIALOGEX 0, 0, 300, 240

Binary file not shown.

View File

@ -394,11 +394,11 @@
>
</File>
<File
RelativePath=".\TabLogs.cpp"
RelativePath=".\TabInput.cpp"
>
</File>
<File
RelativePath=".\TabMouse.cpp"
RelativePath=".\TabLogs.cpp"
>
</File>
<File
@ -503,11 +503,11 @@
>
</File>
<File
RelativePath=".\TabLogs.h"
RelativePath=".\TabInput.h"
>
</File>
<File
RelativePath=".\TabMouse.h"
RelativePath=".\TabLogs.h"
>
</File>
<File

View File

@ -240,6 +240,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
if(dlg->m_TimeStretch) t->flags2 |= TIMESTRETCH;
if(dlg->m_StretchTimers) t->flags4 |= STRETCHTIMERS;
if(dlg->m_FineTiming) t->flags4 |= FINETIMING;
if(dlg->m_ReleaseMouse) t->flags4 |= RELEASEMOUSE;
if(dlg->m_InterceptRDTSC) t->flags4 |= INTERCEPTRDTSC;
if(dlg->m_HookOpenGL) t->flags2 |= HOOKOPENGL;
if(dlg->m_ForceHookOpenGL) t->flags3 |= FORCEHOOKOPENGL;
@ -404,6 +405,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
dlg->m_TimeStretch = t->flags2 & TIMESTRETCH ? 1 : 0;
dlg->m_StretchTimers = t->flags4 & STRETCHTIMERS ? 1 : 0;
dlg->m_FineTiming = t->flags4 & FINETIMING ? 1 : 0;
dlg->m_ReleaseMouse = t->flags4 & RELEASEMOUSE ? 1 : 0;
dlg->m_InterceptRDTSC = t->flags4 & INTERCEPTRDTSC ? 1 : 0;
dlg->m_HookOpenGL = t->flags2 & HOOKOPENGL ? 1 : 0;
dlg->m_ForceHookOpenGL = t->flags3 & FORCEHOOKOPENGL ? 1 : 0;
@ -436,13 +438,15 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
dlg->m_MaxScreenRes = t->MaxScreenRes;
}
static void SaveConfigItem(TARGETMAP *TargetMap, char *Title, int i, char *InitPath)
static void SaveConfigItem(TARGETMAP *TargetMap, PRIVATEMAP *PrivateMap, int i, char *InitPath)
{
char key[32], val[32];
sprintf_s(key, sizeof(key), "title%i", i);
WritePrivateProfileString("target", key, Title, InitPath);
WritePrivateProfileString("target", key, PrivateMap->title, InitPath);
sprintf_s(key, sizeof(key), "path%i", i);
WritePrivateProfileString("target", key, TargetMap->path, InitPath);
sprintf_s(key, sizeof(key), "launchpath%i", i);
WritePrivateProfileString("target", key, PrivateMap->launchpath, InitPath);
sprintf_s(key, sizeof(key), "module%i", i);
WritePrivateProfileString("target", key, TargetMap->module, InitPath);
sprintf_s(key, sizeof(key), "opengllib%i", i);
@ -518,6 +522,8 @@ static void ClearTarget(int i, char *InitPath)
char key[32];
sprintf_s(key, sizeof(key), "path%i", i);
WritePrivateProfileString("target", key, 0, InitPath);
sprintf_s(key, sizeof(key), "launchpath%i", i);
WritePrivateProfileString("target", key, 0, InitPath);
sprintf_s(key, sizeof(key), "ver%i", i);
WritePrivateProfileString("target", key, 0, InitPath);
sprintf_s(key, sizeof(key), "coord%i", i);
@ -563,7 +569,7 @@ static void ClearTarget(int i, char *InitPath)
WritePrivateProfileString("target", key, 0, InitPath);
}
static int LoadConfigItem(TARGETMAP *TargetMap, char *Title, int i, char *InitPath)
static int LoadConfigItem(TARGETMAP *TargetMap, PRIVATEMAP *PrivateMap, int i, char *InitPath)
{
char key[32];
DWORD flags;
@ -571,8 +577,10 @@ static int LoadConfigItem(TARGETMAP *TargetMap, char *Title, int i, char *InitPa
sprintf_s(key, sizeof(key), "path%i", i);
GetPrivateProfileString("target", key, "", TargetMap->path, MAX_PATH, InitPath);
if(!TargetMap->path[0]) return FALSE;
sprintf_s(key, sizeof(key), "launchpath%i", i);
GetPrivateProfileString("target", key, "", PrivateMap->launchpath, MAX_PATH, InitPath);
sprintf_s(key, sizeof(key), "title%i", i);
GetPrivateProfileString("target", key, "", Title, sizeof(PRIVATEMAP)-1, InitPath);
GetPrivateProfileString("target", key, "", PrivateMap->title, sizeof(PRIVATEMAP)-1, InitPath);
sprintf_s(key, sizeof(key), "module%i", i);
GetPrivateProfileString("target", key, "", TargetMap->module, sizeof(TargetMap->module)-1, InitPath);
sprintf_s(key, sizeof(key), "opengllib%i", i);
@ -665,7 +673,7 @@ void CDxwndhostView::SaveConfigFile()
for(i = 0; i < MAXTARGETS; i ++){
if(!TargetMaps[i].path[0]) break;
SaveConfigItem(&TargetMaps[i], TitleMaps[i].title, i, InitPath);
SaveConfigItem(&TargetMaps[i], &TitleMaps[i], i, InitPath);
}
for(; i < MAXTARGETS; i ++) ClearTarget(i, InitPath);
this->isUpdated=FALSE;
@ -757,7 +765,7 @@ void CDxwndhostView::OnInitialUpdate()
listctrl.InsertColumn(0, &listcol);
for(i = 0; i < MAXTARGETS; i ++){
if (!LoadConfigItem(&TargetMaps[i], TitleMaps[i].title, i, InitPath)) break;
if (!LoadConfigItem(&TargetMaps[i], &TitleMaps[i], i, InitPath)) break;
listitem.mask = LVIF_TEXT | LVIF_IMAGE;
listitem.iItem = i;
listitem.iSubItem = 0;
@ -821,7 +829,7 @@ void CDxwndhostView::OnExport()
CFileDialog dlg( FALSE, "*.dxw", path, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
"dxwnd task config (*.dxw)|*.dxw|All Files (*.*)|*.*||", this);
if( dlg.DoModal() == IDOK)
SaveConfigItem(&TargetMaps[i], TitleMaps[i].title, 0, dlg.GetPathName().GetBuffer());
SaveConfigItem(&TargetMaps[i], &TitleMaps[i], 0, dlg.GetPathName().GetBuffer());
}
void CDxwndhostView::OnImport()
@ -849,7 +857,7 @@ void CDxwndhostView::OnImport()
if(buffer[ofn.nFileOffset - 1] != '\0'){
// Single-Select
// "buffer" - name of file
LoadConfigItem(&TargetMaps[i], TitleMaps[i].title, 0, buffer);
LoadConfigItem(&TargetMaps[i], &TitleMaps[i], 0, buffer);
listitem.mask = LVIF_TEXT | LVIF_IMAGE;
listitem.iItem = i;
listitem.iSubItem = 0;
@ -868,7 +876,7 @@ void CDxwndhostView::OnImport()
if(!*p)break;
strcpy(pathname, folder);
strcat(pathname, p);
LoadConfigItem(&TargetMaps[i], TitleMaps[i].title, 0, pathname);
LoadConfigItem(&TargetMaps[i], &TitleMaps[i], 0, pathname);
listitem.mask = LVIF_TEXT | LVIF_IMAGE;
listitem.iItem = i;
listitem.iSubItem = 0;
@ -897,9 +905,11 @@ void CDxwndhostView::OnModify()
pos = listctrl.GetFirstSelectedItemPosition();
i = listctrl.GetNextSelectedItem(pos);
dlg.m_Title = TitleMaps[i].title;
dlg.m_LaunchPath = TitleMaps[i].launchpath;
SetDlgFromTarget(&TargetMaps[i], &dlg);
if(dlg.DoModal() == IDOK && dlg.m_FilePath.GetLength()){
strncpy(TitleMaps[i].title, dlg.m_Title, 40);
strncpy(TitleMaps[i].launchpath, dlg.m_LaunchPath, MAX_PATH);
SetTargetFromDlg(&TargetMaps[i], &dlg);
CListCtrl& listctrl = GetListCtrl();
listitem.mask = LVIF_TEXT | LVIF_IMAGE;
@ -1203,6 +1213,7 @@ void CDxwndhostView::OnAdd()
memset(&TargetMaps[i],0,sizeof(TARGETMAP)); // clean up, just in case....
if(dlg.DoModal() == IDOK && dlg.m_FilePath.GetLength()){
strncpy(TitleMaps[i].title, dlg.m_Title, 40);
strncpy(TitleMaps[i].launchpath, dlg.m_LaunchPath, MAX_PATH);
SetTargetFromDlg(&TargetMaps[i], &dlg);
CListCtrl& listctrl = GetListCtrl();
listitem.mask = LVIF_TEXT | LVIF_IMAGE;
@ -1641,6 +1652,12 @@ void CDxwndhostView::OnRun()
if(!listctrl.GetSelectedCount()) return;
pos = listctrl.GetFirstSelectedItemPosition();
i = listctrl.GetNextSelectedItem(pos);
//if(strlen(TitleMaps[i].launchpath)>0){
// system(TitleMaps[i].launchpath);
// return;
//}
ZeroMemory(&sinfo, sizeof(sinfo));
sinfo.cb = sizeof(sinfo);
strcpy_s(path, sizeof(path), TargetMaps[i].path);
@ -1650,7 +1667,9 @@ void CDxwndhostView::OnRun()
CreateThread( NULL, 0, StartDebug, &TargetMaps[i], 0, NULL);
}
else{
CreateProcess(NULL, TargetMaps[i].path, 0, 0, false, CREATE_DEFAULT_ERROR_MODE, NULL, path, &sinfo, &pinfo);
CreateProcess(NULL,
(strlen(TitleMaps[i].launchpath)>0) ? TitleMaps[i].launchpath: TargetMaps[i].path,
0, 0, false, CREATE_DEFAULT_ERROR_MODE, NULL, path, &sinfo, &pinfo);
}
}