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

v2_02_42_src

Former-commit-id: 6e85ffdc68b2dc761ef5f119fddb62464aaaa74b
This commit is contained in:
gho tik 2013-11-17 11:38:28 -05:00 committed by Refael ACkermann
parent c4fdc9331d
commit 9af2065e0f
20 changed files with 427 additions and 2016 deletions

24
build/Rayman 2 (GOG).dxw Normal file
View File

@ -0,0 +1,24 @@
[target]
title0=Rayman 2 (GOG)
path0=D:\Games\GOG.com\Rayman 2\Rayman2.exe
module0=
opengllib0=
ver0=1
coord0=0
flag0=402653217
flagg0=1208025104
flagh0=20
flagi0=0
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

24
build/Rayman 2 Demo.dxw Normal file
View File

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

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d1a209c794208ebc34f31a6cd07230ea4410cb8ec6cdeedff15725bd32ae783a
size 425472
oid sha256:9937414e8ef05dd175c44b487760617042c0a74574f8cab9f1e7486302cee68a
size 424960

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3d50219a90b39093171656814a8cf5e4b1782366c91e18f16a8972cee2075727
oid sha256:e400384f655d2a3050893125cf7be2026964cb1800b9cebf94af7c1fb98c4d26
size 532480

File diff suppressed because it is too large Load Diff

View File

@ -280,5 +280,10 @@ Fixed a bug in GDI "Map DC to primary surface"mode.
Added palette display window to GUI
v2.02.41
Added "suppress child process creation" flag. This flag is introduced to manage games such as "Heart of Iron 2" and "Chariots of War" that start intro movie by means of a separate process. Both games are starting the binkplay.exe program in the game's avi subfolder. This way you don't get a windowed movie, but completely suppress it.
Added "fix ddraw ref counter" flag, to have primary directdraw object addref & release ref counters identical to those without dxwnd. Some games check for the value and show error messages, i.e. "Grand Prix World"!
Added "suppress child process creation"flag. This flag is introduced to manage games such as "Heart of Iron 2" that start intro movie by means of a separate process. HoI2 is starting the binkplay.exe program in the game's avi subfolder. This way you don't get a windowed movie, but completely suppress it.
v2.02.42
added hook to kernel32.dll QueryPerformanceCounter API to enable time stretching to Rayman 2
handled GetAttachedSurface emulation for FLIP capability on primary surface - that makes the intro movies of Empire Earth visible.
Some code cleaning
Cleared invisible debug flags ...

BIN
build/v2_02_42_build.rar Normal file

Binary file not shown.

View File

@ -2791,19 +2791,10 @@ HRESULT WINAPI extGetAttachedSurface(int dxversion, GetAttachedSurface_Type pGet
return 0;
}
if(!IsPrim){
res=(*pGetAttachedSurface)(lpdds, lpddsc, lplpddas);
if(res)
OutTraceE("GetAttachedSurface(%d): ERROR res=%x(%s) at %d\n", dxversion, res, ExplainDDError(res), __LINE__);
else
OutTraceD("GetAttachedSurface(%d): attached=%x\n", dxversion, *lplpddas);
return(res);
}
// on primary surface return the lpDDSBack surface coming from either an explicit
// AddAttachedSurface, or a primary complex surface creation otherwise....
if(lpddsc->dwCaps & DDSCAPS_BACKBUFFER){ // WIPWIP
if(IsPrim && (lpddsc->dwCaps & (DDSCAPS_BACKBUFFER|DDSCAPS_FLIP))) { // v2.02.42 added DDSCAPS_FLIP for Empire Earth
if (lpDDSBack) {
*lplpddas = lpDDSBack;
OutTraceD("GetAttachedSurface(%d): BACKBUFFER attached=%x\n", dxversion, *lplpddas);
@ -2815,14 +2806,16 @@ HRESULT WINAPI extGetAttachedSurface(int dxversion, GetAttachedSurface_Type pGet
return DDERR_NOTFOUND;
}
}
else{
res=(*pGetAttachedSurface)(lpdds, lpddsc, lplpddas);
if(res)
OutTraceE("GetAttachedSurface(%d): ERROR res=%x(%s) at %d\n", dxversion, res, ExplainDDError(res), __LINE__);
else
OutTraceD("GetAttachedSurface(%d): attached=%x\n", dxversion, *lplpddas);
return res;
}
// proxy the call...
res=(*pGetAttachedSurface)(lpdds, lpddsc, lplpddas);
if(res)
OutTraceE("GetAttachedSurface(%d): ERROR res=%x(%s) at %d\n", dxversion, res, ExplainDDError(res), __LINE__);
else
OutTraceD("GetAttachedSurface(%d): attached=%x\n", dxversion, *lplpddas);
return res;
}
HRESULT WINAPI extGetAttachedSurface1(LPDIRECTDRAWSURFACE lpdds, LPDDSCAPS lpddsc, LPDIRECTDRAWSURFACE *lplpddas)
@ -4191,19 +4184,6 @@ HRESULT WINAPI extGetCaps7S(LPDIRECTDRAWSURFACE lpdds, LPDDSCAPS2 caps)
return extGetCapsS(7, (GetCapsS_Type)pGetCaps7S, lpdds, (LPDDSCAPS)caps);
}
#define FIXREFCOUNTERS 1
#define ZEROREFCOUNTERS 0
HRESULT WINAPI DumpHandle(LPDIRECTDRAWSURFACE lpDDSurface, LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext)
{
OutTrace("lpdds=%x flags=%x(%s) caps=%x(%s); ",
lpDDSurface,
lpDDSurfaceDesc->dwFlags, ExplainFlags(lpDDSurfaceDesc->dwFlags),
lpDDSurfaceDesc->ddsCaps.dwCaps, ExplainDDSCaps(lpDDSurfaceDesc->ddsCaps.dwCaps));
lpDDSurface->Release();
return DDENUMRET_OK;
}
ULONG WINAPI extReleaseD(LPDIRECTDRAW lpdd)
{
ULONG ActualRef;
@ -4216,15 +4196,9 @@ ULONG WINAPI extReleaseD(LPDIRECTDRAW lpdd)
ActualRef=(*pReleaseD)(lpdd);
VirtualRef=(LONG)ActualRef;
OutTraceD("Release(D): lpdd=%x service_lpdd=%x ref=%d\n", lpdd, lpPrimaryDD, ActualRef);
if(IsDebug && ActualRef){
OutTrace("Release(D): surfaces ");
//(*pEnumSurfaces)(lpdd, DDENUMSURFACES_DOESEXIST|DDENUMSURFACES_ALL, NULL, NULL, DumpHandle);
lpdd->EnumSurfaces(DDENUMSURFACES_DOESEXIST|DDENUMSURFACES_ALL, NULL, NULL, DumpHandle);
OutTrace("\n");
}
if (lpdd == lpPrimaryDD) { // v2.1.87: fix for Dungeon Keeper II
if(FIXREFCOUNTERS){
if(dxw.dwFlags4 & FIXREFCOUNTER){
// v2.02.41: fix the ref counter to sumulate the unwindowed original situation
--VirtualRef; // why ????
if(lpDDSBack) --VirtualRef;
@ -4247,9 +4221,6 @@ ULONG WINAPI extReleaseD(LPDIRECTDRAW lpdd)
lpDDSBack=NULL; // beware: Silent Hunter II seems to require the backbuffer ....
}
}
if(ZEROREFCOUNTERS){
VirtualRef=0;
}
}
OutTraceD("Release(D): lpdd=%x ref=%x\n", lpdd, VirtualRef);

View File

@ -831,6 +831,13 @@ DWORD dxwCore::StretchTime(DWORD dwTimer)
return dwTimer;
}
DWORD dxwCore::StretchCounter(DWORD dwTimer)
{
TimeShift=GetHookInfo()->TimeShift;
dwTimer = TimeShifter(dwTimer, TimeShift);
return dwTimer;
}
void dxwCore::GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime)
{
DWORD dwTick;

View File

@ -64,6 +64,7 @@ public: // methods
void GetSystemTime(LPSYSTEMTIME lpSystemTime);
void GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime);
DWORD StretchTime(DWORD);
DWORD StretchCounter(DWORD);
void ShowFPS(LPDIRECTDRAWSURFACE);
void ShowFPS(void);
void ShowFPS(HDC);

Binary file not shown.

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.41"
#define VERSION "2.02.42"
#define DDTHREADLOCK 1

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -39,6 +39,7 @@ static HookEntry_Type TimeHooks[]={
{"Sleep", (FARPROC)Sleep, (FARPROC *)&pSleep, (FARPROC)extSleep},
{"SleepEx", (FARPROC)SleepEx, (FARPROC *)&pSleepEx, (FARPROC)extSleepEx},
{"SetTimer", (FARPROC)SetTimer, (FARPROC *)&pSetTimer, (FARPROC)extSetTimer},
{"QueryPerformanceCounter", (FARPROC)NULL, (FARPROC *)&pQueryPerformanceCounter, (FARPROC)extQueryPerformanceCounter},
{0, NULL, 0, 0} // terminator
};
@ -53,6 +54,11 @@ static HookEntry_Type SuppressChildHooks[]={
{0, NULL, 0, 0} // terminator
};
//static HookEntry_Type SuppressPerfCountersHooks[]={
// //{"QueryPerformanceFrequency", (FARPROC)NULL, (FARPROC *)NULL, (FARPROC)QueryPerformanceFrequency},
// {0, NULL, 0, 0} // terminator
//};
static char *libname = "kernel32.dll";
void HookKernel32(HMODULE module)
@ -63,6 +69,7 @@ void HookKernel32(HMODULE module)
if(dxw.dwFlags2 & TIMESTRETCH) HookLibrary(module, TimeHooks, libname);
if(dxw.dwFlags2 & FAKEVERSION) HookLibrary(module, VersionHooks, libname);
if(dxw.dwFlags4 & SUPPRESSCHILD) HookLibrary(module, SuppressChildHooks, libname);
//if (1) HookLibrary(module, SuppressPerfCountersHooks, libname);
}
void HookKernel32Init()
@ -94,6 +101,8 @@ FARPROC Remap_kernel32_ProcAddress(LPCSTR proc, HMODULE hModule)
if(dxw.dwFlags4 & SUPPRESSCHILD)
if (addr=RemapLibrary(proc, hModule, SuppressChildHooks)) return addr;
//if (addr=RemapLibrary(proc, hModule, SuppressPerfCountersHooks)) return addr;
return NULL;
}
@ -701,3 +710,22 @@ BOOL WINAPI extCreateProcessA(
OutTraceD("CreateProcess: SUPPRESS ApplicationName=%s CommandLine=\"%s\"\n", lpApplicationName, lpCommandLine);
return TRUE;
}
BOOL WINAPI extQueryPerformanceFrequency(LARGE_INTEGER *lpFrequency)
{
// just proxy, but currently unhooked.....
BOOL ret;
ret=(*pQueryPerformanceFrequency)(lpFrequency);
return ret;
}
BOOL WINAPI extQueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount)
{
BOOL ret;
LARGE_INTEGER myPerfCount;
ret=(*pQueryPerformanceCounter)(&myPerfCount);
myPerfCount.HighPart = dxw.StretchCounter(myPerfCount.HighPart);
myPerfCount.LowPart = dxw.StretchCounter(myPerfCount.LowPart);
*lpPerformanceCount = myPerfCount;
return ret;
}

View File

@ -118,6 +118,8 @@ typedef int (WINAPI *AddFontResourceW_Type)(LPCWSTR);
typedef HANDLE (WINAPI *CreateFile_Type)(LPCTSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE);
typedef DWORD (WINAPI *SetFilePointer_Type)(HANDLE, LONG, PLONG, DWORD);
typedef BOOL (WINAPI *CloseHandle_Type)(HANDLE);
typedef BOOL (WINAPI *QueryPerformanceFrequency_Type)(LARGE_INTEGER *);
typedef BOOL (WINAPI *QueryPerformanceCounter_Type)(LARGE_INTEGER *);
// ole32.dll:
typedef HRESULT (STDAPICALLTYPE *CoCreateInstance_Type)(REFCLSID, LPUNKNOWN, DWORD, REFIID, LPVOID FAR*);
@ -298,6 +300,8 @@ DXWEXTERN SleepEx_Type pSleepEx DXWINITIALIZED;
DXWEXTERN CreateFile_Type pCreateFile DXWINITIALIZED;
DXWEXTERN SetFilePointer_Type pSetFilePointer DXWINITIALIZED;
DXWEXTERN CloseHandle_Type pCloseHandle DXWINITIALIZED;
DXWEXTERN QueryPerformanceFrequency_Type pQueryPerformanceFrequency DXWINITIALIZED;
DXWEXTERN QueryPerformanceCounter_Type pQueryPerformanceCounter DXWINITIALIZED;
// ole32.dll:
DXWEXTERN CoCreateInstance_Type pCoCreateInstance DXWINITIALIZED;
@ -474,6 +478,8 @@ extern HANDLE WINAPI extCreateFile(LPCTSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES,
extern DWORD WINAPI extSetFilePointer(HANDLE, LONG, PLONG, DWORD);
extern BOOL WINAPI extCloseHandle(HANDLE);
extern BOOL WINAPI extCreateProcessA(LPCTSTR, LPTSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, LPCTSTR, LPSTARTUPINFO, LPPROCESS_INFORMATION);
extern BOOL WINAPI extQueryPerformanceFrequency(LARGE_INTEGER *);
extern BOOL WINAPI extQueryPerformanceCounter(LARGE_INTEGER *);
// ole32.dll:
extern HRESULT STDAPICALLTYPE extCoCreateInstance(REFCLSID, LPUNKNOWN, DWORD, REFIID, LPVOID FAR*);

View File

@ -49,7 +49,7 @@ DWORD WINAPI exttimeGetTime(void)
MMRESULT WINAPI exttimeSetEvent(UINT uDelay, UINT uResolution, LPTIMECALLBACK lpTimeProc, DWORD_PTR dwUser, UINT fuEvent)
{
MMRESULT res;
uDelay = uDelay * 8;
//uDelay = uDelay * 8;
OutTraceD("timeSetEvent: Delay=%d Resolution=%d Event=%x\n", uDelay, uResolution, fuEvent);
res=(*ptimeSetEvent)(uDelay, uResolution, lpTimeProc, dwUser, fuEvent);
OutTraceD("timeSetEvent: ret=%x\n", res);

Binary file not shown.

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Version="9.00"
Name="dxwndhost"
ProjectGUID="{FD0B0234-8EC5-43C0-A384-1B881DD3D925}"
RootNamespace="dxwndhost"

View File

@ -499,6 +499,7 @@ static int LoadConfigItem(TARGETMAP *TargetMap, char *Title, int i, char *InitPa
{
char key[32];
DWORD flags;
extern BOOL gbDebug;
sprintf_s(key, sizeof(key), "path%i", i);
GetPrivateProfileString("target", key, "", TargetMap->path, MAX_PATH, InitPath);
if(!TargetMap->path[0]) return FALSE;
@ -556,6 +557,14 @@ static int LoadConfigItem(TARGETMAP *TargetMap, char *Title, int i, char *InitPa
TargetMap->MaxFPS = GetPrivateProfileInt("target", key, 0, InitPath);
sprintf_s(key, sizeof(key), "initts%i", i);
TargetMap->InitTS = GetPrivateProfileInt("target", key, 0, InitPath);
if (!gbDebug){
// clear debug flags
TargetMap->flags &= ~(0);
TargetMap->flags2 &= ~(FULLRECTBLT);
TargetMap->flags3 &= ~(YUV2RGB|RGB2YUV|SURFACEWARN|ANALYTICMODE|NODDRAWBLT|NODDRAWFLIP|NOGDIBLT);
TargetMap->flags4 &= ~(0);
}
return TRUE;
}