mirror of
https://github.com/DxWnd/DxWnd.reloaded
synced 2024-12-30 09:25:35 +01:00
v2_03_39_src
Former-commit-id: 2a15921bbbcf86a3440dde9b17d2a75812d6edfe
This commit is contained in:
parent
490a30050e
commit
da35a2c243
@ -203,6 +203,8 @@
|
||||
#define WOW32REGISTRY 0x00080000 // Sets KEY_WOW32_64KEY registry flag
|
||||
#define STRETCHMOVIES 0x00100000 // Stretches ActiveMovie Windows to the whole window size
|
||||
#define BYPASSMCI 0x00200000 // bypass all MCI calls returning OK.
|
||||
#define FIXPIXELZOOM 0x00400000
|
||||
#define REUSEEMULATEDDC 0x00800000
|
||||
|
||||
// logging Tflags DWORD:
|
||||
#define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:870503d6ed66355803bffaf4e2a6faeaae7aef2ddab2b21a5ebe07aeb276eceb
|
||||
size 587776
|
||||
oid sha256:4bc660ee000849fc12e93d97f058cd62e641538ffd39a9e145889a8f71d72091
|
||||
size 588800
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b3af6279bc2e830fe03fb38ba567676000fc17486c763e711fee3539605cf3c0
|
||||
size 544768
|
||||
oid sha256:1224f1ef28770a40f73036db53a6f6f0b810c026d2d3cf57a5b5006197f4e0b0
|
||||
size 545280
|
||||
|
32
build/exports/Battlezone (1998).dxw
Normal file
32
build/exports/Battlezone (1998).dxw
Normal file
@ -0,0 +1,32 @@
|
||||
[target]
|
||||
title0=Battlezone (1998)
|
||||
path0=D:\Games\Battlezone\bzone.exe
|
||||
launchpath0=
|
||||
module0=
|
||||
opengllib0=
|
||||
notes0=
|
||||
registry0=
|
||||
ver0=0
|
||||
coord0=0
|
||||
flag0=-1608515533
|
||||
flagg0=1241513984
|
||||
flagh0=98320
|
||||
flagi0=138412036
|
||||
flagj0=4224
|
||||
flagk0=0
|
||||
tflag0=0
|
||||
initx0=0
|
||||
inity0=0
|
||||
minx0=0
|
||||
miny0=0
|
||||
maxx0=0
|
||||
maxy0=0
|
||||
posx0=150
|
||||
posy0=150
|
||||
sizx0=880
|
||||
sizy0=660
|
||||
maxfps0=0
|
||||
initts0=0
|
||||
winver0=0
|
||||
maxres0=-1
|
||||
swapeffect0=0
|
@ -915,3 +915,8 @@ v2.03.38
|
||||
fix: handling of WM_ACTIVATE and WM_NCACTIVATE messages, should bring the window to HWND_NOTOPMOST z-order position only when activation is on, not off!
|
||||
fix: in "Share GDI and draw DC" mode, check if the primary surface really has a DC and switch to another one if the DC is missing.
|
||||
fix: eliminated some redundant code in GDI ReleaseDC in DC emulated mode
|
||||
|
||||
v2.03.39
|
||||
add: "Fix glPixelZoom args" flag to scale images rendered by OpenGL through GDI. It is needed for "Strength and Honor".
|
||||
add: "Reuse emulated DC" flag to optimize GDI emulation. experimental.
|
||||
|
||||
|
@ -110,7 +110,7 @@ static char *Flag6Names[32]={
|
||||
"FIXPITCH", "POWER2WIDTH", "HIDETASKBAR", "ACTIVATEAPP",
|
||||
"NOSYSMEMPRIMARY", "NOSYSMEMBACKBUF", "CONFIRMONCLOSE", "TERMINATEONCLOSE",
|
||||
"FLIPEMULATION", "SETZBUFFERBITDEPTHS", "SHAREDDC", "WOW32REGISTRY",
|
||||
"STRETCHMOVIES", "BYPASSMCI", "", "",
|
||||
"STRETCHMOVIES", "BYPASSMCI", "FIXPIXELZOOM", "REUSEEMULATEDDC",
|
||||
"", "", "", "",
|
||||
"", "", "", "",
|
||||
};
|
||||
|
177
dll/dxwcore.cpp
177
dll/dxwcore.cpp
@ -7,7 +7,10 @@
|
||||
#include "syslibs.h"
|
||||
#include "dxhelper.h"
|
||||
#include "resource.h"
|
||||
#include "hddraw.h"
|
||||
#include "d3d9.h"
|
||||
extern GetDC_Type pGetDC;
|
||||
extern ReleaseDC_Type pReleaseDC;
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
// Internal function pointers
|
||||
@ -796,6 +799,8 @@ POINT dxwCore::ClientOffset(HWND hwnd)
|
||||
desk0 = upleft;
|
||||
if (desktop.right) ret.x = (((win0.x - desk0.x) * (LONG)dwScreenWidth) + (desktop.right >> 1)) / desktop.right;
|
||||
if (desktop.bottom) ret.y = (((win0.y - desk0.y) * (LONG)dwScreenHeight) + (desktop.bottom >> 1)) / desktop.bottom;
|
||||
if(ret.x < 0) ret.x = 0;
|
||||
if(ret.y < 0) ret.y = 0;
|
||||
OutTraceB("ClientOffset: hwnd=%x offset=(%d,%d)\n", hwnd, ret.x, ret.y);
|
||||
return ret;
|
||||
}
|
||||
@ -1524,94 +1529,79 @@ void dxwCore::FixStyle(char *ApiName, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
HDC dxwCore::AcquireEmulatedDC(HWND hwnd)
|
||||
{
|
||||
HDC wdc;
|
||||
RECT WinRect;
|
||||
|
||||
if(!(wdc=(*pGDIGetDC)(hwnd))){
|
||||
OutTraceE("GetDC: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
|
||||
return NULL;
|
||||
}
|
||||
return AcquireEmulatedDC(wdc);
|
||||
}
|
||||
|
||||
HDC dxwCore::AcquireEmulatedDC(LPDIRECTDRAWSURFACE lpdds)
|
||||
{
|
||||
HDC ddc;
|
||||
typedef HRESULT (WINAPI *GetDC_Type) (LPDIRECTDRAWSURFACE, HDC FAR *);
|
||||
extern GetDC_Type pGetDC;
|
||||
if((*pGetDC)(lpdds, &ddc))
|
||||
OutTraceE("GetDC: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
|
||||
return AcquireEmulatedDC(ddc);
|
||||
}
|
||||
|
||||
HDC dxwCore::AcquireEmulatedDC(HDC wdc)
|
||||
{
|
||||
RealHDC=wdc;
|
||||
HWND hwnd;
|
||||
RECT WinRect;
|
||||
|
||||
RECT LastVRect;
|
||||
LastVRect = VirtualPicRect;
|
||||
|
||||
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();
|
||||
// when screen resolution changes, better renew service resources
|
||||
VirtualPicRect = dxw.GetScreenRect();
|
||||
if((LastVRect.right != VirtualPicRect.right) || (LastVRect.bottom != VirtualPicRect.bottom)) {
|
||||
DeleteObject(VirtualHDC);
|
||||
VirtualHDC = NULL;
|
||||
DeleteObject(VirtualPic);
|
||||
VirtualPic = NULL;
|
||||
}
|
||||
}
|
||||
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__);
|
||||
|
||||
OutTraceB("AcquireEmulatedDC: hwnd=%x Desktop=%x WinRect=(%d,%d)(%d,%d) VirtRect=(%d,%d)(%d,%d)\n",
|
||||
hwnd, dxw.IsDesktop(hwnd),
|
||||
WinRect.left, WinRect.top, WinRect.right, WinRect.bottom,
|
||||
VirtualPicRect.left, VirtualPicRect.top, VirtualPicRect.right, VirtualPicRect.bottom);
|
||||
|
||||
if (!VirtualHDC){
|
||||
OutTraceB("AcquireEmulatedDC: INITIALIZE\n");
|
||||
if(!(VirtualHDC=CreateCompatibleDC(wdc)))
|
||||
OutTraceE("CreateCompatibleDC: 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__);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
BOOL dxwCore::ReleaseEmulatedDC(HWND hwnd)
|
||||
{
|
||||
BOOL ret;
|
||||
HDC wdc;
|
||||
RECT client;
|
||||
(*pGetClientRect)(hwnd, &client);
|
||||
RECT WinRect;
|
||||
|
||||
(*pGetClientRect)(hwnd, &WinRect);
|
||||
|
||||
OutTraceB("ReleaseEmulatedDC: hwnd=%x Desktop=%x WinRect=(%d,%d)(%d,%d) VirtRect=(%d,%d)(%d,%d)\n",
|
||||
hwnd, dxw.IsDesktop(hwnd),
|
||||
WinRect.left, WinRect.top, WinRect.right, WinRect.bottom,
|
||||
VirtualPicRect.left, VirtualPicRect.top, VirtualPicRect.right, VirtualPicRect.bottom);
|
||||
|
||||
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, VirtualPicRect.right, VirtualPicRect.bottom);
|
||||
// v2.02.94: set HALFTONE stretching. But causes problems with Imperialism II
|
||||
// SetStretchBltMode(wdc,HALFTONE);
|
||||
#if 1
|
||||
if(!(*pGDIStretchBlt)(wdc, 0, 0, client.right, client.bottom, VirtualHDC, 0, 0, VirtualPicRect.right, VirtualPicRect.bottom, SRCCOPY))
|
||||
SetStretchBltMode(wdc, HALFTONE);
|
||||
if(!(*pGDIStretchBlt)(wdc, 0, 0, WinRect.right, WinRect.bottom, VirtualHDC, 0, 0, VirtualPicRect.right, VirtualPicRect.bottom, SRCCOPY))
|
||||
OutTraceE("StretchBlt: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
|
||||
#else
|
||||
int w, h, bx, by; // width, height and x,y borders
|
||||
RECT RetRect;
|
||||
bx = by = 0;
|
||||
RetRect=client;
|
||||
if (dwFlags2 & KEEPASPECTRATIO){
|
||||
w = RetRect.right - RetRect.left;
|
||||
h = RetRect.bottom - RetRect.top;
|
||||
if ((w * iRatioY) > (h * iRatioX)){
|
||||
bx = (w - (h * iRatioX / iRatioY))/2;
|
||||
}
|
||||
else {
|
||||
by = (h - (w * iRatioY / iRatioX))/2;
|
||||
}
|
||||
}
|
||||
if(!(*pGDIStretchBlt)(wdc, bx, by, client.right-bx, client.bottom-by, VirtualHDC, 0, 0, VirtualPicRect.right, VirtualPicRect.bottom, SRCCOPY))
|
||||
OutTraceE("StretchBlt: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
|
||||
#endif
|
||||
//(*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;
|
||||
|
||||
(*pGDIReleaseDC)(hwnd, VirtualHDC);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void dxwCore::ResetEmulatedDC()
|
||||
@ -1627,6 +1617,75 @@ BOOL dxwCore::IsVirtual(HDC hdc)
|
||||
return (hdc==VirtualHDC) && (dwFlags3 & GDIEMULATEDC);
|
||||
}
|
||||
|
||||
HDC dxwCore::AcquireSharedDC(HWND hwnd)
|
||||
{
|
||||
extern HDC hFlippedDC;
|
||||
LPDIRECTDRAWSURFACE lpDDSPrim;
|
||||
lpDDSPrim = dxwss.GetPrimarySurface();
|
||||
if (lpDDSPrim) (*pGetDC)(lpDDSPrim, &hFlippedDC);
|
||||
while((hFlippedDC == NULL) && lpDDSPrim) {
|
||||
OutTraceDW("AcquireSharedDC: found primary surface with no DC, unref lpdds=%x\n", lpDDSPrim);
|
||||
dxwss.UnrefSurface(lpDDSPrim);
|
||||
lpDDSPrim = dxwss.GetPrimarySurface();
|
||||
if (lpDDSPrim) (*pGetDC)(lpDDSPrim, &hFlippedDC);
|
||||
}
|
||||
if (!(hwnd == dxw.GethWnd())) {
|
||||
POINT father, child, offset;
|
||||
father.x = father.y = 0;
|
||||
child.x = child.y = 0;
|
||||
(*pClientToScreen)(dxw.GethWnd(),&father);
|
||||
(*pClientToScreen)(hwnd,&child);
|
||||
offset.x = child.x - father.x;
|
||||
offset.y = child.y - father.y;
|
||||
dxw.UnmapClient(&offset);
|
||||
OutTraceDW("AcquireSharedDC: child window hwnd=%x offset=(%d,%d)\n", hwnd, offset.x, offset.y);
|
||||
(*pSetViewportOrgEx)(hFlippedDC, offset.x, offset.y, NULL);
|
||||
}
|
||||
else
|
||||
(*pSetViewportOrgEx)(VirtualHDC, 0, 0, NULL);
|
||||
|
||||
OutTraceDW("AcquireSharedDC: remapping flipped GDI lpDDSPrim=%x hdc=%x\n", lpDDSPrim, hFlippedDC);
|
||||
return hFlippedDC;
|
||||
}
|
||||
|
||||
BOOL dxwCore::ReleaseSharedDC(HWND hwnd, HDC hDC)
|
||||
{
|
||||
HRESULT ret;
|
||||
LPDIRECTDRAWSURFACE lpDDSPrim;
|
||||
lpDDSPrim = dxwss.GetPrimarySurface();
|
||||
if(!lpDDSPrim) return(TRUE);
|
||||
OutTraceDW("GDI.ReleaseDC: releasing flipped GDI hdc=%x\n", hDC);
|
||||
ret=(*pReleaseDC)(dxwss.GetPrimarySurface(), hDC);
|
||||
if (!(hwnd == dxw.GethWnd())) {
|
||||
POINT father, child, offset;
|
||||
RECT rect;
|
||||
HDC hdc;
|
||||
father.x = father.y = 0;
|
||||
child.x = child.y = 0;
|
||||
(*pClientToScreen)(dxw.GethWnd(),&father);
|
||||
(*pClientToScreen)(hwnd,&child);
|
||||
offset.x = child.x - father.x;
|
||||
offset.y = child.y - father.y;
|
||||
if(offset.x || offset.y){
|
||||
// if the graphis was blitted to primary but below a modal child window,
|
||||
// bring that up to the window surface to make it visible.
|
||||
BOOL ret2;
|
||||
(*pGetClientRect)(hwnd, &rect);
|
||||
hdc=(*pGDIGetDC)(hwnd);
|
||||
if(!hdc) OutTrace("GDI.ReleaseDC: GetDC ERROR=%d at %d\n", GetLastError(), __LINE__);
|
||||
ret2=(*pGDIBitBlt)(hdc, rect.left, rect.top, rect.right, rect.bottom, hDC, offset.x, offset.y, SRCCOPY);
|
||||
if(!ret2) OutTrace("GDI.ReleaseDC: BitBlt ERROR=%d at %d\n", GetLastError(), __LINE__);
|
||||
ret2=(*pGDIReleaseDC)(hwnd, hdc);
|
||||
if(!ret2)OutTrace("GDI.ReleaseDC: ReleaseDC ERROR=%d at %d\n", GetLastError(), __LINE__);
|
||||
// this may flicker ....
|
||||
(*pInvalidateRect)(hwnd, NULL, FALSE);
|
||||
}
|
||||
}
|
||||
if (ret) OutTraceE("GDI.ReleaseDC ERROR: err=%x(%s) at %d\n", ret, ExplainDDError(ret), __LINE__);
|
||||
else dxw.ScreenRefresh();
|
||||
return (ret == DD_OK);
|
||||
}
|
||||
|
||||
void dxwCore::PushTimer(UINT uTimerId, UINT uDelay, UINT uResolution, LPTIMECALLBACK lpTimeProc, DWORD_PTR dwUser, UINT fuEvent)
|
||||
{
|
||||
// save current timer
|
||||
|
@ -110,9 +110,9 @@ public: // methods
|
||||
void FixStyle(char *, HWND, WPARAM, LPARAM);
|
||||
void FixWindowFrame(HWND);
|
||||
HDC AcquireEmulatedDC(HWND);
|
||||
HDC AcquireEmulatedDC(HDC);
|
||||
HDC AcquireEmulatedDC(LPDIRECTDRAWSURFACE);
|
||||
BOOL ReleaseEmulatedDC(HWND);
|
||||
HDC AcquireSharedDC(HWND);
|
||||
BOOL ReleaseSharedDC(HWND, HDC);
|
||||
BOOL IsVirtual(HDC);
|
||||
void ResetEmulatedDC();
|
||||
int VirtualOffsetX, VirtualOffsetY;
|
||||
|
@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "TlHelp32.h"
|
||||
|
||||
#define VERSION "2.03.38"
|
||||
#define VERSION "2.03.39"
|
||||
|
||||
#define DDTHREADLOCK 1
|
||||
//#define LOCKTHREADS
|
||||
|
20
dll/dxwnd.sln
Normal file
20
dll/dxwnd.sln
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dxwnd", "dxwnd.vcproj", "{579E7FE7-2745-4100-A802-23511711FCDE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{579E7FE7-2745-4100-A802-23511711FCDE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{579E7FE7-2745-4100-A802-23511711FCDE}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{579E7FE7-2745-4100-A802-23511711FCDE}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{579E7FE7-2745-4100-A802-23511711FCDE}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
20
dll/dxwnd.vs2008.sln
Normal file
20
dll/dxwnd.vs2008.sln
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dxwnd", "dxwnd.vs2008.vcproj", "{579E7FE7-2745-4100-A802-23511711FCDE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{579E7FE7-2745-4100-A802-23511711FCDE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{579E7FE7-2745-4100-A802-23511711FCDE}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{579E7FE7-2745-4100-A802-23511711FCDE}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{579E7FE7-2745-4100-A802-23511711FCDE}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Binary file not shown.
@ -77,7 +77,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="shlwapi.lib odbc32.lib odbccp32.lib libMinHook.x86.lib"
|
||||
AdditionalDependencies="shlwapi.lib odbc32.lib odbccp32.lib libMinHook.x86.lib OpenGl32.lib"
|
||||
OutputFile="../Debug/dxwnd.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
@ -178,7 +178,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies=" libMinHook.x86.lib"
|
||||
AdditionalDependencies=" libMinHook.x86.lib OpenGl32.lib"
|
||||
OutputFile="../Release/dxwnd.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
|
@ -15,6 +15,7 @@ typedef HGLRC (WINAPI *wglCreateContext_Type)(HDC);
|
||||
typedef PROC (WINAPI *wglGetProcAddress_Type)(LPCSTR);
|
||||
typedef BOOL (WINAPI *wglMakeCurrent_Type)(HDC, HGLRC);
|
||||
typedef void (WINAPI *glTexImage2D_Type)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
|
||||
typedef void (WINAPI *glPixelZoom_Type)(GLfloat, GLfloat);
|
||||
|
||||
extern void WINAPI extglViewport(GLint, GLint, GLsizei, GLsizei);
|
||||
extern void WINAPI extglScissor(GLint, GLint, GLsizei, GLsizei);
|
||||
@ -29,6 +30,7 @@ extern HGLRC WINAPI extwglCreateContext(HDC);
|
||||
extern PROC WINAPI extwglGetProcAddress(LPCSTR);
|
||||
extern BOOL WINAPI extwglMakeCurrent(HDC, HGLRC);
|
||||
extern void WINAPI extglTexImage2D(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
|
||||
extern void WINAPI extglPixelZoom(GLfloat, GLfloat);
|
||||
|
||||
#ifdef DXWDECLARATIONS
|
||||
#undef DXWEXTERN
|
||||
@ -55,4 +57,5 @@ DXWEXTERN glClear_Type pglClear;
|
||||
DXWEXTERN wglCreateContext_Type pwglCreateContext;
|
||||
DXWEXTERN wglGetProcAddress_Type pwglGetProcAddress;
|
||||
DXWEXTERN wglMakeCurrent_Type pwglMakeCurrent;
|
||||
DXWEXTERN glTexImage2D_Type pglTexImage2D;
|
||||
DXWEXTERN glTexImage2D_Type pglTexImage2D;
|
||||
DXWEXTERN glPixelZoom_Type pglPixelZoom;
|
||||
|
@ -20,6 +20,10 @@
|
||||
#define COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
|
||||
#endif
|
||||
|
||||
//void WINAPI extglDrawPixels(GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
|
||||
//typedef void (WINAPI *glDrawPixels_Type)(GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
|
||||
//glDrawPixels_Type pglDrawPixels = NULL;
|
||||
|
||||
static HookEntry_Type Hooks[]={
|
||||
{HOOK_IAT_CANDIDATE, "glViewport", NULL, (FARPROC *)&pglViewport, (FARPROC)extglViewport},
|
||||
{HOOK_IAT_CANDIDATE, "glScissor", NULL, (FARPROC *)&pglScissor, (FARPROC)extglScissor},
|
||||
@ -32,6 +36,8 @@ static HookEntry_Type Hooks[]={
|
||||
{HOOK_IAT_CANDIDATE, "wglMakeCurrent", NULL, (FARPROC *)&pwglMakeCurrent, (FARPROC)extwglMakeCurrent},
|
||||
{HOOK_IAT_CANDIDATE, "wglGetProcAddress", NULL, (FARPROC *)&pwglGetProcAddress, (FARPROC)extwglGetProcAddress},
|
||||
{HOOK_IAT_CANDIDATE, "glTexImage2D", NULL, (FARPROC *)&pglTexImage2D, (FARPROC)extglTexImage2D},
|
||||
//{HOOK_IAT_CANDIDATE, "glDrawPixels", NULL, (FARPROC *)&pglDrawPixels, (FARPROC)extglDrawPixels},
|
||||
{HOOK_IAT_CANDIDATE, "glPixelZoom", NULL, (FARPROC *)&pglPixelZoom, (FARPROC)extglPixelZoom},
|
||||
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
@ -419,7 +425,7 @@ void WINAPI extglTexImage2D(
|
||||
GLenum type,
|
||||
const GLvoid * data)
|
||||
{
|
||||
OutTrace("glTexImage2D: TEXTURE target=%x level=%x internalformat=%x format=%x type=%x size=(%dx%d)\n",
|
||||
OutTraceDW("glTexImage2D: TEXTURE target=%x level=%x internalformat=%x format=%x type=%x size=(%dx%d)\n",
|
||||
target, level, internalFormat, format, type, width, height);
|
||||
|
||||
switch(target){
|
||||
@ -447,3 +453,56 @@ void WINAPI extglTexImage2D(
|
||||
|
||||
return (*pglTexImage2D)(target, level, internalFormat, width, height, border, format, type, data);
|
||||
}
|
||||
|
||||
#if 0
|
||||
char *ExplainDrawPixelsFormat(DWORD c)
|
||||
{
|
||||
static char *eb;
|
||||
switch(c)
|
||||
{
|
||||
case GL_COLOR_INDEX: eb="GL_COLOR_INDEX"; break;
|
||||
case GL_STENCIL_INDEX: eb="GL_STENCIL_INDEX"; break;
|
||||
case GL_DEPTH_COMPONENT: eb="GL_DEPTH_COMPONENT"; break;
|
||||
case GL_RGB: eb="GL_RGB"; break;
|
||||
case GL_BGR: eb="GL_BGR"; break;
|
||||
case GL_RGBA: eb="GL_RGBA"; break;
|
||||
case GL_BGRA: eb="GL_BGRA"; break;
|
||||
case GL_RED: eb="GL_RED"; break;
|
||||
case GL_GREEN: eb="GL_GREEN"; break;
|
||||
case GL_BLUE: eb="GL_BLUE"; break;
|
||||
case GL_ALPHA: eb="GL_ALPHA"; break;
|
||||
case GL_LUMINANCE: eb="GL_LUMINANCE"; break;
|
||||
case GL_LUMINANCE_ALPHA: eb="GL_LUMINANCE_ALPHA"; break;
|
||||
default: eb="unknown"; break;
|
||||
}
|
||||
return eb;
|
||||
}
|
||||
|
||||
void WINAPI extglDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *data)
|
||||
{
|
||||
GLenum glerr;
|
||||
OutTrace("glDrawPixels: size=(%dx%d) format=%x(%s) type=%d data=%x\n",
|
||||
width, height, format, ExplainDrawPixelsFormat(format), type, data);
|
||||
|
||||
(*pglDrawPixels)(width, height, format, type, data);
|
||||
if ((glerr=glGetError())!= GL_NO_ERROR) OutTrace("GLERR %d ad %d\n", glerr, __LINE__);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
void WINAPI extglPixelZoom(GLfloat xfactor, GLfloat yfactor)
|
||||
{
|
||||
GLenum glerr;
|
||||
OutTraceDW("glPixelZoom: x,y factor=(%f,%f)\n", xfactor, yfactor);
|
||||
|
||||
if(dxw.dwFlags6 & FIXPIXELZOOM){
|
||||
RECT desktop;
|
||||
(*pGetClientRect)(dxw.GethWnd(), &desktop);
|
||||
xfactor = (xfactor * desktop.right) / dxw.GetScreenWidth();
|
||||
yfactor = (yfactor * desktop.bottom) / dxw.GetScreenHeight();
|
||||
OutTraceDW("glPixelZoom: FIXED x,y factor=(%f,%f)\n", xfactor, yfactor);
|
||||
}
|
||||
(*pglPixelZoom)(xfactor, yfactor);
|
||||
if ((glerr=glGetError())!= GL_NO_ERROR) OutTrace("GLERR %d ad %d\n", glerr, __LINE__);
|
||||
return;
|
||||
}
|
||||
|
@ -1988,30 +1988,8 @@ static HDC WINAPI sGetDC(HWND hwnd, char *ApiName)
|
||||
}
|
||||
|
||||
if(bFlippedDC) {
|
||||
extern HDC hFlippedDC;
|
||||
LPDIRECTDRAWSURFACE lpDDSPrim;
|
||||
lpDDSPrim = dxwss.GetPrimarySurface();
|
||||
if (lpDDSPrim) (*pGetDC)(lpDDSPrim, &hFlippedDC);
|
||||
while((hFlippedDC == NULL) && lpDDSPrim) {
|
||||
OutTraceDW("%s: found primary surface with no DC, unref lpdds=%x\n", ApiName, lpDDSPrim);
|
||||
dxwss.UnrefSurface(lpDDSPrim);
|
||||
lpDDSPrim = dxwss.GetPrimarySurface();
|
||||
if (lpDDSPrim) (*pGetDC)(lpDDSPrim, &hFlippedDC);
|
||||
}
|
||||
if (!(hwnd == dxw.GethWnd())) {
|
||||
POINT father, child, offset;
|
||||
father.x = father.y = 0;
|
||||
child.x = child.y = 0;
|
||||
(*pClientToScreen)(dxw.GethWnd(),&father);
|
||||
(*pClientToScreen)(hwnd,&child);
|
||||
offset.x = child.x - father.x;
|
||||
offset.y = child.y - father.y;
|
||||
dxw.UnmapClient(&offset);
|
||||
OutTraceDW("%s: child window hwnd=%x offset=(%d,%d)\n", ApiName, hwnd, offset.x, offset.y);
|
||||
(*pSetViewportOrgEx)(hFlippedDC, offset.x, offset.y, NULL);
|
||||
}
|
||||
OutTraceDW("%s: remapping flipped GDI lpDDSPrim=%x hdc=%x\n", ApiName, lpDDSPrim, hFlippedDC);
|
||||
if(hFlippedDC) return hFlippedDC;
|
||||
ret = dxw.AcquireSharedDC(hwnd);
|
||||
if(ret) return ret;
|
||||
}
|
||||
|
||||
switch(GDIEmulationMode){
|
||||
@ -2020,7 +1998,6 @@ static HDC WINAPI sGetDC(HWND hwnd, char *ApiName)
|
||||
break;
|
||||
case GDIMODE_EMULATED:
|
||||
ret=dxw.AcquireEmulatedDC(lochwnd);
|
||||
dxw.VirtualHDC=ret;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2080,42 +2057,7 @@ int WINAPI extGDIReleaseDC(HWND hwnd, HDC hDC)
|
||||
if (dxw.IsRealDesktop(hwnd)) hwnd=dxw.GethWnd();
|
||||
if(hwnd == 0) return(TRUE);
|
||||
|
||||
if(bFlippedDC && (hDC == hFlippedDC)) {
|
||||
HRESULT ret;
|
||||
LPDIRECTDRAWSURFACE lpDDSPrim;
|
||||
lpDDSPrim = dxwss.GetPrimarySurface();
|
||||
if(!lpDDSPrim) return(TRUE);
|
||||
OutTraceDW("GDI.ReleaseDC: releasing flipped GDI hdc=%x\n", hDC);
|
||||
ret=(*pReleaseDC)(dxwss.GetPrimarySurface(), hDC);
|
||||
if (!(hwnd == dxw.GethWnd())) {
|
||||
POINT father, child, offset;
|
||||
RECT rect;
|
||||
HDC hdc;
|
||||
father.x = father.y = 0;
|
||||
child.x = child.y = 0;
|
||||
(*pClientToScreen)(dxw.GethWnd(),&father);
|
||||
(*pClientToScreen)(hwnd,&child);
|
||||
offset.x = child.x - father.x;
|
||||
offset.y = child.y - father.y;
|
||||
if(offset.x || offset.y){
|
||||
// if the graphis was blitted to primary but below a modal child window,
|
||||
// bring that up to the window surface to make it visible.
|
||||
BOOL ret2;
|
||||
(*pGetClientRect)(hwnd, &rect);
|
||||
hdc=(*pGDIGetDC)(hwnd);
|
||||
if(!hdc) OutTrace("GDI.ReleaseDC: GetDC ERROR=%d at %d\n", GetLastError(), __LINE__);
|
||||
ret2=(*pGDIBitBlt)(hdc, rect.left, rect.top, rect.right, rect.bottom, hDC, offset.x, offset.y, SRCCOPY);
|
||||
if(!ret2) OutTrace("GDI.ReleaseDC: BitBlt ERROR=%d at %d\n", GetLastError(), __LINE__);
|
||||
ret2=(*pGDIReleaseDC)(hwnd, hdc);
|
||||
if(!ret2)OutTrace("GDI.ReleaseDC: ReleaseDC ERROR=%d at %d\n", GetLastError(), __LINE__);
|
||||
// this may flicker ....
|
||||
(*pInvalidateRect)(hwnd, NULL, FALSE);
|
||||
}
|
||||
}
|
||||
if (ret) OutTraceE("GDI.ReleaseDC ERROR: err=%x(%s) at %d\n", ret, ExplainDDError(ret), __LINE__);
|
||||
else dxw.ScreenRefresh();
|
||||
return (ret == DD_OK);
|
||||
}
|
||||
if(bFlippedDC && (hDC == hFlippedDC)) return dxw.ReleaseSharedDC(hwnd, hDC);
|
||||
|
||||
switch(GDIEmulationMode){
|
||||
case GDIMODE_STRETCHED:
|
||||
@ -2266,7 +2208,7 @@ BOOL WINAPI extMoveWindow(HWND hwnd, int X, int Y, int nWidth, int nHeight, BOOL
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (dxw.IsFullScreen()){
|
||||
if (dxw.IsFullScreen() && (dxw.dwFlags1 & CLIENTREMAPPING)){
|
||||
POINT upleft={0,0};
|
||||
RECT client;
|
||||
BOOL isChild;
|
||||
|
3099
dll/user32.old.cpp
3099
dll/user32.old.cpp
File diff suppressed because it is too large
Load Diff
@ -33,10 +33,12 @@ void CTabSysLibs::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Check(pDX, IDC_FIXTEXTOUT, cTarget->m_FixTextOut);
|
||||
DDX_Check(pDX, IDC_SHAREDDC, cTarget->m_SharedDC);
|
||||
DDX_Check(pDX, IDC_NOFILLRECT, cTarget->m_NoFillRect);
|
||||
DDX_Check(pDX, IDC_REUSEEMULATEDDC, cTarget->m_ReuseEmulatedDC);
|
||||
|
||||
// OpenGL
|
||||
DDX_Check(pDX, IDC_HOOKOPENGL, cTarget->m_HookOpenGL); // duplicated
|
||||
DDX_Check(pDX, IDC_FORCEHOOKOPENGL, cTarget->m_ForceHookOpenGL);
|
||||
DDX_Check(pDX, IDC_FIXPIXELZOOM, cTarget->m_FixPixelZoom);
|
||||
DDX_Text(pDX, IDC_OPENGLLIB, cTarget->m_OpenGLLib);
|
||||
|
||||
// Glide
|
||||
|
@ -26,6 +26,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
|
||||
m_DxFilterMode = 0; // default: ddraw filtering
|
||||
m_DCEmulationMode = 0; // default: no emulation
|
||||
m_MouseVisibility = 0;
|
||||
m_TextureHandling = 0;
|
||||
m_HookDI = FALSE;
|
||||
m_ModifyMouse = TRUE; // default true !!
|
||||
m_LogEnabled = FALSE;
|
||||
@ -134,7 +135,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
|
||||
m_KeepCursorFixed = FALSE;
|
||||
m_UseRGB565 = TRUE; // seems the default for 16bit video mode
|
||||
m_SuppressDXErrors = FALSE;
|
||||
m_FlipEmulation = FALSE;
|
||||
m_FlipEmulation = TRUE; // better set true default, since this mode is more compatible
|
||||
m_MarkBlit = FALSE;
|
||||
m_MarkLock = FALSE;
|
||||
m_NoSysMemPrimary = FALSE;
|
||||
@ -181,6 +182,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
|
||||
m_InterceptRDTSC = FALSE;
|
||||
m_HookOpenGL = FALSE;
|
||||
m_ForceHookOpenGL = FALSE;
|
||||
m_FixPixelZoom = FALSE;
|
||||
m_FakeVersion = FALSE;
|
||||
m_FullRectBlt = FALSE;
|
||||
m_CenterToWin = FALSE;
|
||||
@ -190,6 +192,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
|
||||
m_NoDDRAWFlip = FALSE;
|
||||
m_NoGDIBlt = FALSE;
|
||||
m_NoFillRect = FALSE;
|
||||
m_ReuseEmulatedDC = FALSE; // ??
|
||||
m_AnalyticMode = FALSE;
|
||||
m_NoPaletteUpdate = FALSE;
|
||||
m_WireFrame = FALSE;
|
||||
|
@ -148,6 +148,7 @@ public:
|
||||
BOOL m_InterceptRDTSC;
|
||||
BOOL m_HookOpenGL;
|
||||
BOOL m_ForceHookOpenGL;
|
||||
BOOL m_FixPixelZoom;
|
||||
BOOL m_FakeVersion;
|
||||
BOOL m_FullRectBlt;
|
||||
BOOL m_CenterToWin;
|
||||
@ -157,6 +158,7 @@ public:
|
||||
BOOL m_NoDDRAWFlip;
|
||||
BOOL m_NoGDIBlt;
|
||||
BOOL m_NoFillRect;
|
||||
BOOL m_ReuseEmulatedDC;
|
||||
BOOL m_AnalyticMode;
|
||||
BOOL m_NoPaletteUpdate;
|
||||
BOOL m_LimitResources;
|
||||
|
Binary file not shown.
Binary file not shown.
20
host/dxwndhost.vs2008.sln
Normal file
20
host/dxwndhost.vs2008.sln
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dxwndhost", "dxwndhost.vs2008.vcproj", "{FD0B0234-8EC5-43C0-A384-1B881DD3D925}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Binary file not shown.
@ -380,6 +380,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
|
||||
if(dlg->m_InterceptRDTSC) t->flags4 |= INTERCEPTRDTSC;
|
||||
if(dlg->m_HookOpenGL) t->flags2 |= HOOKOPENGL;
|
||||
if(dlg->m_ForceHookOpenGL) t->flags3 |= FORCEHOOKOPENGL;
|
||||
if(dlg->m_FixPixelZoom) t->flags6 |= FIXPIXELZOOM;
|
||||
if(dlg->m_WireFrame) t->flags2 |= WIREFRAME;
|
||||
if(dlg->m_NoTextures) t->flags4 |= NOTEXTURES;
|
||||
if(dlg->m_BlackWhite) t->flags3 |= BLACKWHITE;
|
||||
@ -393,6 +394,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
|
||||
if(dlg->m_NoDDRAWFlip) t->flags3 |= NODDRAWFLIP;
|
||||
if(dlg->m_NoGDIBlt) t->flags3 |= NOGDIBLT;
|
||||
if(dlg->m_NoFillRect) t->flags4 |= NOFILLRECT;
|
||||
if(dlg->m_ReuseEmulatedDC) t->flags6 |= REUSEEMULATEDDC;
|
||||
if(dlg->m_AnalyticMode) t->flags3 |= ANALYTICMODE;
|
||||
if(dlg->m_ReplacePrivOps) t->flags5 |= REPLACEPRIVOPS;
|
||||
t->initx = dlg->m_InitX;
|
||||
@ -614,6 +616,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
|
||||
dlg->m_InterceptRDTSC = t->flags4 & INTERCEPTRDTSC ? 1 : 0;
|
||||
dlg->m_HookOpenGL = t->flags2 & HOOKOPENGL ? 1 : 0;
|
||||
dlg->m_ForceHookOpenGL = t->flags3 & FORCEHOOKOPENGL ? 1 : 0;
|
||||
dlg->m_FixPixelZoom = t->flags6 & FIXPIXELZOOM ? 1 : 0;
|
||||
dlg->m_WireFrame = t->flags2 & WIREFRAME ? 1 : 0;
|
||||
dlg->m_NoTextures = t->flags4 & NOTEXTURES ? 1 : 0;
|
||||
dlg->m_BlackWhite = t->flags3 & BLACKWHITE ? 1 : 0;
|
||||
@ -627,6 +630,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
|
||||
dlg->m_NoDDRAWFlip = t->flags3 & NODDRAWFLIP ? 1 : 0;
|
||||
dlg->m_NoGDIBlt = t->flags3 & NOGDIBLT ? 1 : 0;
|
||||
dlg->m_NoFillRect = t->flags4 & NOFILLRECT ? 1 : 0;
|
||||
dlg->m_ReuseEmulatedDC = t->flags6 & REUSEEMULATEDDC ? 1 : 0;
|
||||
dlg->m_AnalyticMode = t->flags3 & ANALYTICMODE ? 1 : 0;
|
||||
dlg->m_ReplacePrivOps = t->flags5 & REPLACEPRIVOPS ? 1 : 0;
|
||||
dlg->m_InitX = t->initx;
|
||||
|
BIN
host/resource
BIN
host/resource
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user