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

v2_02_65_src

Former-commit-id: 80a015af2f1fbc6441330b08ad896bf4b3981927
This commit is contained in:
gho tik 2014-03-23 12:38:58 -04:00 committed by Refael ACkermann
parent d47c4cfab1
commit 60c8028a1d
29 changed files with 281 additions and 48 deletions

View File

@ -133,6 +133,7 @@
#define NOFLIPEMULATION 0x00020000 // Compensate the effect of Flip-ping through Blt operations #define NOFLIPEMULATION 0x00020000 // Compensate the effect of Flip-ping through Blt operations
#define NOTEXTURES 0x00040000 // Disabled (whitened) textures #define NOTEXTURES 0x00040000 // Disabled (whitened) textures
#define RETURNNULLREF 0x00080000 // IDirectDraw::Release and IDDrawSurface::Release will always return 0 ref. counter #define RETURNNULLREF 0x00080000 // IDirectDraw::Release and IDDrawSurface::Release will always return 0 ref. counter
#define FINETIMING 0x00100000 // Fine timeslider coarse, by 10% steps ranging from about :2 to x2
// logging Tflags DWORD: // logging Tflags DWORD:
#define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general #define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:f848ba14637f8a11e413b5263df2c0eb3de7c1bba21f2db3602e9971c0f85804 oid sha256:33ac0e7db3ed4efc6da6c4cc7f0988314aa96698631c5937ccb988ed50a82be3
size 464896 size 466432

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:ad2a6e8e0b8119551bfb5352ba7c18e3c892b6dbae0a1e6d1be32b2d5bc9c094 oid sha256:b1ab56aec078a3b4123d5d7fe8319b0c9baea51b7e987f61dfe5c61b47c1c56d
size 535552 size 535552

View File

@ -0,0 +1,26 @@
[target]
title0=DeathSpank: The Baconing
path0=D:\Games\The Baconing\TheBaconing.exe
module0=
opengllib0=
ver0=9
coord0=0
flag0=134218272
flagg0=1207959552
flagh0=20
flagi0=4
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -1,15 +1,15 @@
[target] [target]
title0=deadrising2otr.exe title0=Fallout
path0=C:\Program Files (x86)\Capcom\Dead Rising 2 Off The Record\deadrising2otr.exe path0=D:\Games\Fallout\FALLOUTW.EXE
module0= module0=
opengllib0= opengllib0=
ver0=0 ver0=1
coord0=0 coord0=0
flag0=0 flag0=134218272
flagg0=134217728 flagg0=134217728
flagh0=16 flagh0=20
flagi0=0 flagi0=4
tflag0=3 tflag0=0
initx0=0 initx0=0
inity0=0 inity0=0
minx0=0 minx0=0
@ -22,3 +22,5 @@ sizx0=800
sizy0=600 sizy0=600
maxfps0=0 maxfps0=0
initts0=0 initts0=0
winver0=0
maxres0=-1

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

@ -0,0 +1,24 @@
[target]
title0=JetMoto
path0=D:\Games\Jet_Moto\JETMOTO.EXE
module0=
opengllib0=
ver0=0
coord0=0
flag0=671088674
flagg0=1207959552
flagh0=20
flagi0=0
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

View File

@ -5,11 +5,11 @@ module0=
opengllib0= opengllib0=
ver0=1 ver0=1
coord0=0 coord0=0
flag0=134234656 flag0=134234784
flagg0=1208025344 flagg0=1208025344
flagh0=20 flagh0=20
flagi0=12 flagi0=12
tflag0=5249 tflag0=0
initx0=0 initx0=0
inity0=0 inity0=0
minx0=0 minx0=0

26
build/exports/WarWind.dxw Normal file
View File

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

View File

@ -5,7 +5,7 @@ module0=
opengllib0= opengllib0=
ver0=0 ver0=0
coord0=0 coord0=0
flag0=134217762 flag0=134218400
flagg0=1207959552 flagg0=1207959552
flagh0=20 flagh0=20
flagi0=4 flagi0=4
@ -22,3 +22,5 @@ sizx0=800
sizy0=600 sizy0=600
maxfps0=0 maxfps0=0
initts0=0 initts0=0
winver0=0
maxres0=0

View File

@ -0,0 +1,26 @@
[target]
title0=Warwind 2
path0=D:\Games\Warwind 2\WARWIND2.EXE
module0=
opengllib0=
ver0=0
coord0=0
flag0=134234656
flagg0=1207959552
flagh0=20
flagi0=4
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -1,5 +1,5 @@
[window] [window]
posx=1007 posx=1316
posy=65 posy=462
sizx=769 sizx=320
sizy=832 sizy=200

View File

@ -429,7 +429,7 @@ added DirectX "Return 0 ref counter" option as quick & dirty solution to many re
fixed DirectDrawCreateEx failing to register the main ddraw session handle fixed DirectDrawCreateEx failing to register the main ddraw session handle
fixed palette problem in emulated mode: palette must be applied to backbuffer surface as well. Now "Duckman" and "Total Soccer 2000" show perfect colors. fixed palette problem in emulated mode: palette must be applied to backbuffer surface as well. Now "Duckman" and "Total Soccer 2000" show perfect colors.
v2.02.65
added "Fine time adjust" flag to finely set timeslider by 10% steps ranging from about :2 to x2
fixed a bug in DWORD timers introduced in v2.02.60: now "Warcraft 2" timing works again
revised logit to calculate delays to emulate VSync timing - now should be more accurate and depending on actual screen refresh rate

View File

@ -283,6 +283,32 @@ FARPROC Remap_ddraw_ProcAddress(LPCSTR proc, HMODULE hModule)
// auxiliary (static) functions // auxiliary (static) functions
/* ------------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------------ */
DWORD gdwRefreshRate;
#define MAXREFRESHDELAYCOUNT 20
int iRefreshDelays[MAXREFRESHDELAYCOUNT]={16, 17};
int iRefreshDelayCount=2;
void SetVSyncDelays(LPDIRECTDRAW lpdd)
{
DDSURFACEDESC ddsdRefreshRate;
int Reminder;
memset(&ddsdRefreshRate, 0, sizeof(ddsdRefreshRate));
ddsdRefreshRate.dwSize = sizeof(ddsdRefreshRate);
(*pGetDisplayMode)(lpdd, &ddsdRefreshRate);
gdwRefreshRate = ddsdRefreshRate.dwRefreshRate;
if(!gdwRefreshRate) return;
iRefreshDelayCount=0;
Reminder=0;
do{
iRefreshDelays[iRefreshDelayCount]=(1000+Reminder)/gdwRefreshRate;
Reminder=(1000+Reminder)-(iRefreshDelays[iRefreshDelayCount]*gdwRefreshRate);
iRefreshDelayCount++;
} while(Reminder && (iRefreshDelayCount<MAXREFRESHDELAYCOUNT));
OutTraceDW("Refresh rate=%d: delay=", gdwRefreshRate);
for(int i=0; i<iRefreshDelayCount; i++) OutTraceDW("%d ", iRefreshDelays[i]);
OutTraceDW("\n");
}
static void Stopper(char *s, int line) static void Stopper(char *s, int line)
{ {
char sMsg[81]; char sMsg[81];
@ -1848,6 +1874,7 @@ HRESULT WINAPI extSetDisplayMode(int version, LPDIRECTDRAW lpdd,
OutTraceDW("SetDisplayMode: fixing colordepth current=%d required=%d size=(%dx%d)\n", OutTraceDW("SetDisplayMode: fixing colordepth current=%d required=%d size=(%dx%d)\n",
ddsd.ddpfPixelFormat.dwRGBBitCount, dwbpp, ddsd.dwWidth, ddsd.dwHeight); ddsd.ddpfPixelFormat.dwRGBBitCount, dwbpp, ddsd.dwWidth, ddsd.dwHeight);
SetVSyncDelays(lpdd);
return 0; return 0;
} }
@ -2671,6 +2698,7 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate
// creation of the primary surface.... // creation of the primary surface....
if(ddsd.dwFlags & DDSD_CAPS && ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE){ if(ddsd.dwFlags & DDSD_CAPS && ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE){
SetVSyncDelays(lpdd);
GetHookInfo()->Height=(short)dxw.GetScreenHeight(); GetHookInfo()->Height=(short)dxw.GetScreenHeight();
GetHookInfo()->Width=(short)dxw.GetScreenWidth(); GetHookInfo()->Width=(short)dxw.GetScreenWidth();
GetHookInfo()->ColorDepth=(short)dxw.VirtualPixelFormat.dwRGBBitCount; GetHookInfo()->ColorDepth=(short)dxw.VirtualPixelFormat.dwRGBBitCount;
@ -3265,17 +3293,15 @@ HRESULT WINAPI extFlip(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURFACE lpddssrc,
if((dwflags & DDFLIP_WAIT) || (dxw.dwFlags1 & SAVELOAD)) lpPrimaryDD->WaitForVerticalBlank(DDWAITVB_BLOCKEND , 0); if((dwflags & DDFLIP_WAIT) || (dxw.dwFlags1 & SAVELOAD)) lpPrimaryDD->WaitForVerticalBlank(DDWAITVB_BLOCKEND , 0);
if(dxw.dwFlags4 & NOFLIPEMULATION){ if(dxw.dwFlags4 & NOFLIPEMULATION){
// create a temporary working surface
memset(&ddsd, 0, sizeof(ddsd)); memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = SurfaceDescrSize(lpdds); ddsd.dwSize = SurfaceDescrSize(lpdds);
//if(pGetSurfaceDesc1) (*pGetSurfaceDesc1)(lpDDSBack, (LPDDSURFACEDESC)&ddsd);
(*pGetSurfaceDescMethod(lpdds))((LPDIRECTDRAWSURFACE2)lpDDSBack, &ddsd); (*pGetSurfaceDescMethod(lpdds))((LPDIRECTDRAWSURFACE2)lpDDSBack, &ddsd);
ddsd.dwFlags &= ~DDSD_PITCH; ddsd.dwFlags &= ~DDSD_PITCH;
//DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[temp]" , __LINE__);
res=(*pCreateSurfaceMethod(lpdds))(lpPrimaryDD, &ddsd, &lpddsTmp, NULL); res=(*pCreateSurfaceMethod(lpdds))(lpPrimaryDD, &ddsd, &lpddsTmp, NULL);
if(res) OutTraceE("CreateSurface: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__); if(res) OutTraceE("CreateSurface: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
OutTrace("DEBUG: copied surface size=(%dx%d)\n", ddsd.dwWidth, ddsd.dwHeight); //OutTrace("DEBUG: copied surface size=(%dx%d)\n", ddsd.dwWidth, ddsd.dwHeight);
// copy front buffer // copy front buffer
if(dxw.dwFlags1 & EMULATESURFACE){ if(dxw.dwFlags1 & EMULATESURFACE){
// in emulated mode, the primary surface is virtual and you can pick it all // in emulated mode, the primary surface is virtual and you can pick it all
// needed for "Gruntz" // needed for "Gruntz"
@ -3316,7 +3342,7 @@ HRESULT WINAPI extFlip(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURFACE lpddssrc,
} }
if(dxw.dwFlags4 & NOFLIPEMULATION){ if(dxw.dwFlags4 & NOFLIPEMULATION){
// restore flipped backbuffer // restore flipped backbuffer and delete temporary surface
res= (*pBlt)(lpddssrc, NULL, lpddsTmp, NULL, DDBLT_WAIT, NULL); res= (*pBlt)(lpddssrc, NULL, lpddsTmp, NULL, DDBLT_WAIT, NULL);
if(res) OutTraceE("Blt: ERROR %x(%s) at %d", res, ExplainDDError(res), __LINE__); if(res) OutTraceE("Blt: ERROR %x(%s) at %d", res, ExplainDDError(res), __LINE__);
(*pReleaseS)(lpddsTmp); (*pReleaseS)(lpddsTmp);
@ -3417,9 +3443,8 @@ HRESULT WINAPI extWaitForVerticalBlank(LPDIRECTDRAW lpdd, DWORD dwflags, HANDLE
tmp = (*pGetTickCount)(); tmp = (*pGetTickCount)();
if((time - tmp) > 32) time = tmp; if((time - tmp) > 32) time = tmp;
(*pSleep)(time - tmp); (*pSleep)(time - tmp);
if(step) time += 16; time += iRefreshDelays[step++];
else time += 17; if(step >= iRefreshDelayCount) step=0;
step ^= 1;
return 0; return 0;
} }
@ -3469,9 +3494,9 @@ HRESULT WINAPI extSetPalette(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWPALETTE lpdd
OutTraceDDRAW("SetPalette: lpdds=%x%s lpddp=%x\n", lpdds, isPrim?"(PRIM)":"", lpddp); OutTraceDDRAW("SetPalette: lpdds=%x%s lpddp=%x\n", lpdds, isPrim?"(PRIM)":"", lpddp);
res=(*pSetPalette)(lpdds, lpddp); res=(*pSetPalette)(lpdds, lpddp);
res=DD_OK;
if(res)OutTraceE("SetPalette: ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); if(res)OutTraceE("SetPalette: ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
else OutTraceDDRAW("SetPalette: OK\n"); else OutTraceDDRAW("SetPalette: OK\n");
res=DD_OK;
if((dxw.dwFlags1 & EMULATESURFACE) && isPrim){ if((dxw.dwFlags1 & EMULATESURFACE) && isPrim){
OutTraceDW("SetPalette: register PRIMARY palette lpDDP=%x\n", lpddp); OutTraceDW("SetPalette: register PRIMARY palette lpDDP=%x\n", lpddp);
@ -3485,12 +3510,13 @@ HRESULT WINAPI extSetPalette(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWPALETTE lpdd
} }
// Apply palette to backbuffer surface. This is necessary on some games: "Duckman private dick", "Total Soccer 2000", ... // Apply palette to backbuffer surface. This is necessary on some games: "Duckman private dick", "Total Soccer 2000", ...
if (lpDDSBack) { if (lpDDSBack) {
OutTraceDW("SetPalette: apply PRIMARY palette lpDDP=%x to DDSBack=%x\n", lpddp, lpDDSBack);
res=(*pSetPalette)(lpDDSBack, lpddp); res=(*pSetPalette)(lpDDSBack, lpddp);
if(res) OutTraceE("SetPalette: ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); if(res) OutTraceE("SetPalette: ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
} }
// add a reference to simulate what would happen in reality.... // add a reference to simulate what would happen in reality....
lpdds->AddRef(); lpdds->AddRef();
res=0; res=DD_OK;
} }
return res; return res;

View File

@ -72,8 +72,8 @@ static char *Flag4Names[32]={
"ZBUFFERCLEAN", "ZBUFFER0CLEAN", "ZBUFFERALWAYS", "DISABLEFOGGING", "ZBUFFERCLEAN", "ZBUFFER0CLEAN", "ZBUFFERALWAYS", "DISABLEFOGGING",
"NOPOWER2FIX", "NOPERFCOUNTER", "ADDPROXYLIBS", "INTERCEPTRDTSC", "NOPOWER2FIX", "NOPERFCOUNTER", "ADDPROXYLIBS", "INTERCEPTRDTSC",
"LIMITSCREENRES", "NOFILLRECT", "HOOKGLIDE", "HIDEDESKTOP", "LIMITSCREENRES", "NOFILLRECT", "HOOKGLIDE", "HIDEDESKTOP",
"STRETCHTIMERS", "NOFLIPEMULATION", "NOTEXTURES", "", "STRETCHTIMERS", "NOFLIPEMULATION", "NOTEXTURES", "RETURNNULLREF",
"", "", "", "", "FINETIMING", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
}; };

View File

@ -7,6 +7,21 @@
#include "dxhelper.h" #include "dxhelper.h"
#include "resource.h" #include "resource.h"
/* ------------------------------------------------------------------ */
// Internal function pointers
/* ------------------------------------------------------------------ */
typedef DWORD (*TimeShifter_Type)(DWORD, int);
typedef LARGE_INTEGER (*TimeShifter64_Type)(LARGE_INTEGER, int);
TimeShifter_Type pTimeShifter;
TimeShifter64_Type pTimeShifter64;
static DWORD TimeShifterFine(DWORD, int);
static LARGE_INTEGER TimeShifter64Fine(LARGE_INTEGER, int);
static DWORD TimeShifterCoarse(DWORD, int);
static LARGE_INTEGER TimeShifter64Coarse(LARGE_INTEGER, int);
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
// Constructor, destructor, initialization.... // Constructor, destructor, initialization....
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
@ -75,6 +90,14 @@ void dxwCore::InitTarget(TARGETMAP *target)
MaxScreenRes = target->MaxScreenRes; MaxScreenRes = target->MaxScreenRes;
Coordinates = target->coordinates; Coordinates = target->coordinates;
MustShowOverlay=((dwFlags2 & SHOWFPSOVERLAY) || (dwFlags4 & SHOWTIMESTRETCH)); MustShowOverlay=((dwFlags2 & SHOWFPSOVERLAY) || (dwFlags4 & SHOWTIMESTRETCH));
if(dwFlags4 & FINETIMING){
pTimeShifter = TimeShifterFine;
pTimeShifter64 = TimeShifter64Fine;
}
else{
pTimeShifter = TimeShifterCoarse;
pTimeShifter64 = TimeShifter64Coarse;
}
} }
void dxwCore::SetScreenSize(void) void dxwCore::SetScreenSize(void)
@ -616,6 +639,23 @@ void dxwCore::UnmapClient(int *nXDest, int *nYDest)
if(h) *nYDest= *nYDest * (int)dwScreenHeight / h; if(h) *nYDest= *nYDest * (int)dwScreenHeight / h;
} }
void dxwCore::UnmapClient(LPRECT lpRect)
{
RECT client;
int w, h;
(*pGetClientRect)(hWnd, &client);
w = client.right ? client.right : iSizX;
h = client.bottom ? client.bottom : iSizY;
if(w) {
lpRect->left = (lpRect->left * (int)dwScreenWidth) / w;
lpRect->right = (lpRect->right * (int)dwScreenWidth) / w;
}
if(h) {
lpRect->top = (lpRect->top * (int)dwScreenHeight) / h;
lpRect->bottom = (lpRect->bottom * (int)dwScreenHeight) / h;
}
}
void dxwCore::MapWindow(LPRECT rect) void dxwCore::MapWindow(LPRECT rect)
{ {
RECT client; RECT client;
@ -746,7 +786,7 @@ void dxwCore::ScreenRefresh(void)
if (tn-t < DXWREFRESHINTERVAL) return; if (tn-t < DXWREFRESHINTERVAL) return;
t = tn; t = tn;
// if not too early, refresh colors on primary surface .... // if not too early, refresh primary surface ....
lpDDSPrim=dxw.GetPrimarySurface(); lpDDSPrim=dxw.GetPrimarySurface();
if (lpDDSPrim) extBlt(lpDDSPrim, NULL, lpDDSPrim, NULL, 0, NULL); if (lpDDSPrim) extBlt(lpDDSPrim, NULL, lpDDSPrim, NULL, 0, NULL);
@ -841,8 +881,18 @@ BOOL dxwCore::HandleFPS()
if(dwFlags2 & SKIPFPS) if(SkipFrameCount(dxw.MaxFPS)) return TRUE; if(dwFlags2 & SKIPFPS) if(SkipFrameCount(dxw.MaxFPS)) return TRUE;
return FALSE; return FALSE;
} }
static float fMul[17]={2.14F, 1.95F, 1.77F, 1.61F, 1.46F, 1.33F, 1.21F, 1.10F, 1.00F, 0.91F, 0.83F, 0.75F, 0.68F, 0.62F, 0.56F, 0.51F, 0.46F};
//static float fMul[17]={0.46F, 0.51F, 0.56F, 0.62F, 0.68F, 0.75F, 0.83F, 0.91F, 1.00F, 1.10F, 1.21F, 1.33F, 1.46F, 1.61F, 1.77F, 1.95F, 2.14F};
static DWORD TimeShifter(DWORD val, int shift) static DWORD TimeShifterFine(DWORD val, int shift)
{
float fVal;
fVal = (float)val * fMul[shift+8];
return (DWORD)fVal;
}
static DWORD TimeShifterCoarse(DWORD val, int shift)
{ {
int exp, reminder; int exp, reminder;
if (shift > 0) { if (shift > 0) {
@ -860,7 +910,16 @@ static DWORD TimeShifter(DWORD val, int shift)
return val; return val;
} }
static LARGE_INTEGER TimeShifter64(LARGE_INTEGER val, int shift) static LARGE_INTEGER TimeShifter64Fine(LARGE_INTEGER val, int shift)
{
float fVal;
fVal = (float)val.LowPart * fMul[shift+8];
val.HighPart = 0;
val.LowPart = (DWORD)fVal;
return val;
}
static LARGE_INTEGER TimeShifter64Coarse(LARGE_INTEGER val, int shift)
{ {
int exp, reminder; int exp, reminder;
if (shift > 0) { if (shift > 0) {
@ -884,7 +943,7 @@ DWORD dxwCore::GetTickCount(void)
static DWORD dwLastRealTick=0; static DWORD dwLastRealTick=0;
static DWORD dwLastFakeTick=0; static DWORD dwLastFakeTick=0;
DWORD dwNextRealTick; DWORD dwNextRealTick;
BOOL FirstTime = TRUE; static BOOL FirstTime = TRUE;
if(FirstTime){ if(FirstTime){
dwLastRealTick=(*pGetTickCount)(); dwLastRealTick=(*pGetTickCount)();
@ -894,7 +953,7 @@ DWORD dxwCore::GetTickCount(void)
dwNextRealTick=(*pGetTickCount)(); dwNextRealTick=(*pGetTickCount)();
dwTick=(dwNextRealTick-dwLastRealTick); dwTick=(dwNextRealTick-dwLastRealTick);
TimeShift=GetHookInfo()->TimeShift; TimeShift=GetHookInfo()->TimeShift;
dwTick = TimeShifter(dwTick, TimeShift); dwTick = (*pTimeShifter)(dwTick, TimeShift);
dwLastFakeTick += dwTick; dwLastFakeTick += dwTick;
dwLastRealTick = dwNextRealTick; dwLastRealTick = dwNextRealTick;
return dwLastFakeTick; return dwLastFakeTick;
@ -903,14 +962,14 @@ DWORD dxwCore::GetTickCount(void)
DWORD dxwCore::StretchTime(DWORD dwTimer) DWORD dxwCore::StretchTime(DWORD dwTimer)
{ {
TimeShift=GetHookInfo()->TimeShift; TimeShift=GetHookInfo()->TimeShift;
dwTimer = TimeShifter(dwTimer, -TimeShift); dwTimer = (*pTimeShifter)(dwTimer, -TimeShift);
return dwTimer; return dwTimer;
} }
DWORD dxwCore::StretchCounter(DWORD dwTimer) DWORD dxwCore::StretchCounter(DWORD dwTimer)
{ {
TimeShift=GetHookInfo()->TimeShift; TimeShift=GetHookInfo()->TimeShift;
dwTimer = TimeShifter(dwTimer, TimeShift); dwTimer = (*pTimeShifter)(dwTimer, TimeShift);
return dwTimer; return dwTimer;
} }
@ -920,7 +979,7 @@ LARGE_INTEGER dxwCore::StretchCounter(LARGE_INTEGER dwTimer)
LARGE_INTEGER ret; LARGE_INTEGER ret;
TimeShift=GetHookInfo()->TimeShift; TimeShift=GetHookInfo()->TimeShift;
dwTimer.QuadPart += Reminder; dwTimer.QuadPart += Reminder;
ret = TimeShifter64(dwTimer, TimeShift); ret = (*pTimeShifter64)(dwTimer, TimeShift);
Reminder = (ret.QuadPart==0) ? dwTimer.LowPart : 0; Reminder = (ret.QuadPart==0) ? dwTimer.LowPart : 0;
return ret; return ret;
} }
@ -947,7 +1006,7 @@ void dxwCore::GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime)
dwCurrentTick=(*pGetTickCount)(); dwCurrentTick=(*pGetTickCount)();
dwTick=(dwCurrentTick-dwStartTick); dwTick=(dwCurrentTick-dwStartTick);
TimeShift=GetHookInfo()->TimeShift; TimeShift=GetHookInfo()->TimeShift;
dwTick = TimeShifter(dwTick, TimeShift); dwTick = (*pTimeShifter)(dwTick, TimeShift);
// From MSDN: Contains a 64-bit value representing the number of // From MSDN: Contains a 64-bit value representing the number of
// 100-nanosecond intervals since January 1, 1601 (UTC). // 100-nanosecond intervals since January 1, 1601 (UTC).
// So, since 1mSec = 10.000 * 100nSec, you still have to multiply by 10.000. // So, since 1mSec = 10.000 * 100nSec, you still have to multiply by 10.000.
@ -982,7 +1041,7 @@ void dxwCore::GetSystemTime(LPSYSTEMTIME lpSystemTime)
dwCurrentTick=(*pGetTickCount)(); dwCurrentTick=(*pGetTickCount)();
dwTick=(dwCurrentTick-dwStartTick); dwTick=(dwCurrentTick-dwStartTick);
TimeShift=GetHookInfo()->TimeShift; TimeShift=GetHookInfo()->TimeShift;
dwTick = TimeShifter(dwTick, TimeShift); dwTick = (*pTimeShifter)(dwTick, TimeShift);
// From MSDN: Contains a 64-bit value representing the number of // From MSDN: Contains a 64-bit value representing the number of
// 100-nanosecond intervals since January 1, 1601 (UTC). // 100-nanosecond intervals since January 1, 1601 (UTC).
// So, since 1mSec = 10.000 * 100nSec, you still have to multiply by 10.000. // So, since 1mSec = 10.000 * 100nSec, you still have to multiply by 10.000.
@ -1108,20 +1167,27 @@ void dxwCore::ShowTimeStretching(HDC xdc)
SetTextColor(xdc,color); SetTextColor(xdc,color);
//SetBkMode(xdc, TRANSPARENT); //SetBkMode(xdc, TRANSPARENT);
SetBkMode(xdc, OPAQUE); SetBkMode(xdc, OPAQUE);
sprintf_s(sBuf, 80, "Time %s", dxw.GetTSCaption()); sprintf_s(sBuf, 80, "t%s", dxw.GetTSCaption());
TextOut(xdc, x, y, sBuf, strlen(sBuf)); TextOut(xdc, x, y, sBuf, strlen(sBuf));
} }
char *dxwCore::GetTSCaption(int shift) char *dxwCore::GetTSCaption(int shift)
{ {
static char *sTSCaption[17]={ static char *sTSCaptionCoarse[17]={
"x16","x12","x8","x6", "x16","x12","x8","x6",
"x4","x3","x2","x1.5", "x4","x3","x2","x1.5",
"x1", "x1",
":1.5",":2",":3",":4", ":1.5",":2",":3",":4",
":6",":8",":12",":16"}; ":6",":8",":12",":16"};
static char *sTSCaptionFine[17]={
"x2.14","x1.95","x1.77","x1.61",
"x1.46","x1.33","x1.21","x1.10",
"x1.00",
":1.10",":1.21",":1.33",":1.46",
":1.61",":1.77",":1.95",":2.14"};
if (shift<(-8) || shift>(+8)) return "???"; if (shift<(-8) || shift>(+8)) return "???";
return sTSCaption[shift+8]; shift += 8;
return (dxw.dwFlags4 & FINETIMING) ? sTSCaptionFine[shift] : sTSCaptionCoarse[shift];
} }
char *dxwCore::GetTSCaption(void) char *dxwCore::GetTSCaption(void)

View File

@ -58,6 +58,7 @@ public: // methods
void MapClient(int *, int *); void MapClient(int *, int *);
void UnmapClient(LPPOINT); void UnmapClient(LPPOINT);
void UnmapClient(int *, int *); void UnmapClient(int *, int *);
void UnmapClient(LPRECT);
void MapWindow(LPPOINT); void MapWindow(LPPOINT);
void MapWindow(LPRECT); void MapWindow(LPRECT);
void MapWindow(int *, int *, int *, int *); void MapWindow(int *, int *, int *, int *);

View File

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

Binary file not shown.

View File

@ -924,6 +924,8 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype,
(*pGetAdapterDisplayMode8)(lpd3d, 0, &mode); (*pGetAdapterDisplayMode8)(lpd3d, 0, &mode);
param[2] = mode.Format; param[2] = mode.Format;
OutTraceDW(" Current Format = 0x%x\n", mode.Format); OutTraceDW(" Current Format = 0x%x\n", mode.Format);
OutTraceDW(" Current ScreenSize = (%dx%d)\n", mode.Width, mode.Height);
OutTraceDW(" Current Refresh Rate = %d\n", mode.RefreshRate);
//param[0]=param[1]=0; //param[0]=param[1]=0;
@ -1011,6 +1013,8 @@ HRESULT WINAPI extCreateDeviceEx(void *lpd3d, UINT adapter, D3DDEVTYPE devicetyp
(*pGetAdapterDisplayMode9)(lpd3d, 0, &mode); (*pGetAdapterDisplayMode9)(lpd3d, 0, &mode);
param[2] = mode.Format; param[2] = mode.Format;
OutTraceDW(" Current Format = 0x%x\n", mode.Format); OutTraceDW(" Current Format = 0x%x\n", mode.Format);
OutTraceDW(" Current ScreenSize = (%dx%d)\n", mode.Width, mode.Height);
OutTraceDW(" Current Refresh Rate = %d\n", mode.RefreshRate);
//param[7] = 0; //hDeviceWindow //param[7] = 0; //hDeviceWindow
param[7] = (DWORD)dxw.GethWnd(); //hDeviceWindow param[7] = (DWORD)dxw.GethWnd(); //hDeviceWindow
@ -1128,6 +1132,8 @@ HRESULT WINAPI extCreateAdditionalSwapChain(void *lpd3d, D3DPRESENT_PARAMETERS *
(*pGetAdapterDisplayMode8)(lpd3d, 0, &mode); (*pGetAdapterDisplayMode8)(lpd3d, 0, &mode);
param[2] = mode.Format; param[2] = mode.Format;
OutTraceDW(" Current Format = 0x%x\n", mode.Format); OutTraceDW(" Current Format = 0x%x\n", mode.Format);
OutTraceDW(" Current ScreenSize = (%dx%d)\n", mode.Width, mode.Height);
OutTraceDW(" Current Refresh Rate = %d\n", mode.RefreshRate);
if(dwD3DVersion == 9){ if(dwD3DVersion == 9){
param[7] = 0; //hDeviceWindow param[7] = 0; //hDeviceWindow

View File

@ -193,6 +193,7 @@ typedef HWND (WINAPI *GetActiveWindow_Type)(void);
typedef BOOL (WINAPI *IsWindowVisible_Type)(HWND); typedef BOOL (WINAPI *IsWindowVisible_Type)(HWND);
typedef BOOL (WINAPI *SystemParametersInfo_Type)(UINT, UINT, PVOID, UINT); typedef BOOL (WINAPI *SystemParametersInfo_Type)(UINT, UINT, PVOID, UINT);
typedef BOOL (WINAPI *KillTimer_Type)(HWND, UINT_PTR); typedef BOOL (WINAPI *KillTimer_Type)(HWND, UINT_PTR);
typedef BOOL (WINAPI *GetUpdateRect_Type)(HWND, LPRECT, BOOL);
// Winmm.dll: // Winmm.dll:
typedef MCIERROR(WINAPI *mciSendCommand_Type)(MCIDEVICEID, UINT, DWORD_PTR, DWORD_PTR); typedef MCIERROR(WINAPI *mciSendCommand_Type)(MCIDEVICEID, UINT, DWORD_PTR, DWORD_PTR);
@ -392,6 +393,7 @@ DXWEXTERN GetActiveWindow_Type pGetActiveWindow DXWINITIALIZED;
DXWEXTERN IsWindowVisible_Type pIsWindowVisible DXWINITIALIZED; DXWEXTERN IsWindowVisible_Type pIsWindowVisible DXWINITIALIZED;
DXWEXTERN SystemParametersInfo_Type pSystemParametersInfoA DXWINITIALIZED; DXWEXTERN SystemParametersInfo_Type pSystemParametersInfoA DXWINITIALIZED;
DXWEXTERN KillTimer_Type pKillTimer DXWINITIALIZED; DXWEXTERN KillTimer_Type pKillTimer DXWINITIALIZED;
DXWEXTERN GetUpdateRect_Type pGetUpdateRect DXWINITIALIZED;
// Winmm.dll: // Winmm.dll:
DXWEXTERN mciSendCommand_Type pmciSendCommand DXWINITIALIZED; DXWEXTERN mciSendCommand_Type pmciSendCommand DXWINITIALIZED;
@ -591,6 +593,7 @@ extern HWND WINAPI extGetActiveWindow(void);
extern BOOL WINAPI extIsWindowVisible(HWND); extern BOOL WINAPI extIsWindowVisible(HWND);
extern BOOL WINAPI extSystemParametersInfoA(UINT, UINT, PVOID, UINT); extern BOOL WINAPI extSystemParametersInfoA(UINT, UINT, PVOID, UINT);
extern BOOL WINAPI extKillTimer(HWND, UINT_PTR); extern BOOL WINAPI extKillTimer(HWND, UINT_PTR);
extern BOOL WINAPI extGetUpdateRect(HWND, LPRECT, BOOL);
// Winmm.dll: // Winmm.dll:
extern MCIERROR WINAPI extmciSendCommand(MCIDEVICEID, UINT, DWORD_PTR, DWORD_PTR); extern MCIERROR WINAPI extmciSendCommand(MCIDEVICEID, UINT, DWORD_PTR, DWORD_PTR);

View File

@ -91,6 +91,7 @@ static HookEntry_Type RemapHooks[]={
{"GetClientRect", (FARPROC)GetClientRect, (FARPROC *)&pGetClientRect, (FARPROC)extGetClientRect}, {"GetClientRect", (FARPROC)GetClientRect, (FARPROC *)&pGetClientRect, (FARPROC)extGetClientRect},
{"GetWindowRect", (FARPROC)GetWindowRect, (FARPROC *)&pGetWindowRect, (FARPROC)extGetWindowRect}, {"GetWindowRect", (FARPROC)GetWindowRect, (FARPROC *)&pGetWindowRect, (FARPROC)extGetWindowRect},
{"MapWindowPoints", (FARPROC)MapWindowPoints, (FARPROC *)&pMapWindowPoints, (FARPROC)extMapWindowPoints}, {"MapWindowPoints", (FARPROC)MapWindowPoints, (FARPROC *)&pMapWindowPoints, (FARPROC)extMapWindowPoints},
//{"GetUpdateRect", (FARPROC)GetUpdateRect, (FARPROC *)&pGetUpdateRect, (FARPROC)extGetUpdateRect},
{0, NULL, 0, 0} // terminator {0, NULL, 0, 0} // terminator
}; };
@ -2272,3 +2273,20 @@ BOOL WINAPI extKillTimer(HWND hWnd, UINT_PTR uIDEvent)
if(ret) dxw.PopTimer(hWnd, uIDEvent); if(ret) dxw.PopTimer(hWnd, uIDEvent);
return ret; return ret;
} }
BOOL WINAPI extGetUpdateRect(HWND hWnd, LPRECT lpRect, BOOL bErase)
{
BOOL ret;
OutTraceDW("GetUpdateRect: hwnd=%x Erase=%x\n", hWnd, bErase);
ret = (*pGetUpdateRect)(hWnd, lpRect, bErase);
if(ret){
OutTraceDW("GetUpdateRect: rect=(%d,%d)-(%d,%d)\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
if(dxw.IsFullScreen()){
dxw.UnmapClient(lpRect);
OutTraceDW("GetUpdateRect: FIXED rect=(%d,%d)-(%d,%d)\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
}
}
else
OutTraceE("GetUpdateRect ERROR: err=%d\n", GetLastError());
return ret;
}

View File

@ -207,7 +207,7 @@
#define IDC_NOTEXTURES 1166 #define IDC_NOTEXTURES 1166
#define IDC_LIMITSCREENRES 1167 #define IDC_LIMITSCREENRES 1167
#define IDC_SHOWTIMESTRETCH 1168 #define IDC_SHOWTIMESTRETCH 1168
#define IDC_FINETIMING 1169
#define ID_MODIFY 32771 #define ID_MODIFY 32771
#define ID_DELETE 32772 #define ID_DELETE 32772
#define ID_ADD 32773 #define ID_ADD 32773

View File

@ -36,6 +36,7 @@ void CTabTiming::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_TIMESTRETCH, cTarget->m_TimeStretch); DDX_Check(pDX, IDC_TIMESTRETCH, cTarget->m_TimeStretch);
DDX_Check(pDX, IDC_INTERCEPTRDTSC, cTarget->m_InterceptRDTSC); DDX_Check(pDX, IDC_INTERCEPTRDTSC, cTarget->m_InterceptRDTSC);
DDX_Check(pDX, IDC_STRETCHTIMERS, cTarget->m_StretchTimers); DDX_Check(pDX, IDC_STRETCHTIMERS, cTarget->m_StretchTimers);
DDX_Check(pDX, IDC_FINETIMING, cTarget->m_FineTiming);
DDX_Text(pDX, IDC_MAXFPS, cTarget->m_MaxFPS); DDX_Text(pDX, IDC_MAXFPS, cTarget->m_MaxFPS);
DDX_LBIndex(pDX, IDC_LISTTS, cTarget->m_InitTS); DDX_LBIndex(pDX, IDC_LISTTS, cTarget->m_InitTS);
//{{AFX_DATA_MAP(CTabTiming) //{{AFX_DATA_MAP(CTabTiming)

View File

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

View File

@ -106,6 +106,7 @@ public:
BOOL m_ShowTimeStretch; BOOL m_ShowTimeStretch;
BOOL m_TimeStretch; BOOL m_TimeStretch;
BOOL m_StretchTimers; BOOL m_StretchTimers;
BOOL m_FineTiming;
BOOL m_InterceptRDTSC; BOOL m_InterceptRDTSC;
BOOL m_HookOpenGL; BOOL m_HookOpenGL;
BOOL m_ForceHookOpenGL; BOOL m_ForceHookOpenGL;

Binary file not shown.

View File

@ -404,6 +404,7 @@ BEGIN
CONTROL "Show time stretch",IDC_SHOWTIMESTRETCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,134,84,10 CONTROL "Show time stretch",IDC_SHOWTIMESTRETCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,134,84,10
CONTROL "Intercept RDTSC opcode",IDC_INTERCEPTRDTSC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,164,127,10 CONTROL "Intercept RDTSC opcode",IDC_INTERCEPTRDTSC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,164,127,10
CONTROL "Stretch timers",IDC_STRETCHTIMERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,176,127,10 CONTROL "Stretch timers",IDC_STRETCHTIMERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,176,127,10
CONTROL "Fine time adjust",IDC_FINETIMING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,146,88,10
END END
IDD_TAB_OUTPUT DIALOGEX 0, 0, 300, 240 IDD_TAB_OUTPUT DIALOGEX 0, 0, 300, 240

Binary file not shown.

View File

@ -234,6 +234,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
if(dlg->m_ShowTimeStretch) t->flags4 |= SHOWTIMESTRETCH; if(dlg->m_ShowTimeStretch) t->flags4 |= SHOWTIMESTRETCH;
if(dlg->m_TimeStretch) t->flags2 |= TIMESTRETCH; if(dlg->m_TimeStretch) t->flags2 |= TIMESTRETCH;
if(dlg->m_StretchTimers) t->flags4 |= STRETCHTIMERS; if(dlg->m_StretchTimers) t->flags4 |= STRETCHTIMERS;
if(dlg->m_FineTiming) t->flags4 |= FINETIMING;
if(dlg->m_InterceptRDTSC) t->flags4 |= INTERCEPTRDTSC; if(dlg->m_InterceptRDTSC) t->flags4 |= INTERCEPTRDTSC;
if(dlg->m_HookOpenGL) t->flags2 |= HOOKOPENGL; if(dlg->m_HookOpenGL) t->flags2 |= HOOKOPENGL;
if(dlg->m_ForceHookOpenGL) t->flags3 |= FORCEHOOKOPENGL; if(dlg->m_ForceHookOpenGL) t->flags3 |= FORCEHOOKOPENGL;
@ -392,6 +393,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
dlg->m_ShowTimeStretch = t->flags4 & SHOWTIMESTRETCH ? 1 : 0; dlg->m_ShowTimeStretch = t->flags4 & SHOWTIMESTRETCH ? 1 : 0;
dlg->m_TimeStretch = t->flags2 & TIMESTRETCH ? 1 : 0; dlg->m_TimeStretch = t->flags2 & TIMESTRETCH ? 1 : 0;
dlg->m_StretchTimers = t->flags4 & STRETCHTIMERS ? 1 : 0; dlg->m_StretchTimers = t->flags4 & STRETCHTIMERS ? 1 : 0;
dlg->m_FineTiming = t->flags4 & FINETIMING ? 1 : 0;
dlg->m_InterceptRDTSC = t->flags4 & INTERCEPTRDTSC ? 1 : 0; dlg->m_InterceptRDTSC = t->flags4 & INTERCEPTRDTSC ? 1 : 0;
dlg->m_HookOpenGL = t->flags2 & HOOKOPENGL ? 1 : 0; dlg->m_HookOpenGL = t->flags2 & HOOKOPENGL ? 1 : 0;
dlg->m_ForceHookOpenGL = t->flags3 & FORCEHOOKOPENGL ? 1 : 0; dlg->m_ForceHookOpenGL = t->flags3 & FORCEHOOKOPENGL ? 1 : 0;