mirror of
https://github.com/DxWnd/DxWnd.reloaded
synced 2024-12-30 09:25:35 +01:00
v2_02_02_src
Former-commit-id: 870c58a082162690754ee945f62d8b9872a172a7
This commit is contained in:
parent
19c4ab0ca5
commit
66876eb38f
@ -60,6 +60,7 @@
|
||||
#define SKIPFPS 0x00002000 // skips primary blit operations up to limit
|
||||
#define SHOWFPS 0x00004000 // shows FPS value to status win / log
|
||||
#define HIDEMULTIMONITOR 0x00008000 // hide multimonitor configurations: GetAdapterCount returns 1.
|
||||
#define TIMESTRETCH 0x00010000 // make system time stretchable
|
||||
|
||||
// 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:6afe9d2675ebd5d2e3c225a90c5c3e39bf5e18dfc718c5eef0776034a156b196
|
||||
size 274432
|
||||
oid sha256:f9c184ea18b592accf84a23876799143c8e5c16761512624d25c595298e34470
|
||||
size 260608
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:aa501d87ec71204d9b0f4da59283e201ea6e36f4545ab72fb5ad869b1815e27c
|
||||
size 483328
|
||||
oid sha256:f3ff1ef480c67937ed3848ce26c7612704b0017f3c49fd597915d2273bfff76f
|
||||
size 484352
|
||||
|
3011
build/dxwnd.ini
3011
build/dxwnd.ini
File diff suppressed because it is too large
Load Diff
@ -2,3 +2,7 @@ v2.2.00/01
|
||||
major code rewriting - introduced dxwCore class
|
||||
preliminary FPS handling: Limit, Skip & Count with configurable delay
|
||||
Hide Multi Monitor configuration flag - used for "Dream Acquarium" on multimonitor PC.
|
||||
|
||||
v2.2.02
|
||||
preliminary time stretching: so far applies to GetTickCount() only, and is controlled by Alt-F5 / F6 keys.
|
||||
Fixed bug in GDI BitBlt call: stretching must be made on screen DC only, or it's made twice.
|
||||
|
@ -108,6 +108,7 @@ extern BOOL WINAPI extGetDiskFreeSpaceA(LPCSTR, LPDWORD, LPDWORD, LPDWORD, LPDWO
|
||||
extern BOOL WINAPI extSetDeviceGammaRamp(HDC, LPVOID);
|
||||
extern BOOL WINAPI extGetDeviceGammaRamp(HDC, LPVOID);
|
||||
extern LRESULT WINAPI extSendMessage(HWND, UINT, WPARAM, LPARAM);
|
||||
extern DWORD WINAPI extGetTickCount(void);
|
||||
|
||||
extern HANDLE hTraceMutex;
|
||||
|
||||
@ -154,6 +155,7 @@ BitBlt_Type pBitBlt;
|
||||
PatBlt_Type pPatBlt;
|
||||
StretchBlt_Type pStretchtBlt;
|
||||
extern InvalidateRgn_Type pInvalidateRgn;
|
||||
GetTickCount_Type pGetTickCount;
|
||||
|
||||
LoadLibraryA_Type pLoadLibraryA;
|
||||
LoadLibraryExA_Type pLoadLibraryExA;
|
||||
@ -913,6 +915,26 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
|
||||
TerminateProcess(GetCurrentProcess(),0);
|
||||
}
|
||||
break;
|
||||
case VK_F5:
|
||||
//case '+':
|
||||
if ((dxw.dwFlags2 & TIMESTRETCH) && (dxw.TimeShift < 4)) {
|
||||
dxw.TimeShift++;
|
||||
if(dxw.TimeShift > 0)
|
||||
OutTrace("Time Stretch: speed %dx slow\n", 1 << dxw.TimeShift);
|
||||
else
|
||||
OutTrace("Time Stretch: speed %dx quick\n", 1 << (-dxw.TimeShift));
|
||||
}
|
||||
break;
|
||||
case VK_F6:
|
||||
//case '-':
|
||||
if ((dxw.dwFlags2 & TIMESTRETCH) && (dxw.TimeShift > -4)) {
|
||||
dxw.TimeShift--;
|
||||
if(dxw.TimeShift > 0)
|
||||
OutTrace("Time Stretch: speed %dx slow\n", 1 << dxw.TimeShift);
|
||||
else
|
||||
OutTrace("Time Stretch: speed %dx quick\n", 1 << (-dxw.TimeShift));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1028,6 +1050,7 @@ void HookSysLibsInit()
|
||||
pCreateDialogParam=CreateDialogParamA;
|
||||
pMoveWindow=MoveWindow;
|
||||
pGetDesktopWindow=GetDesktopWindow;
|
||||
pGetTickCount=GetTickCount;
|
||||
}
|
||||
|
||||
void HookSysLibs(char *module)
|
||||
@ -1240,6 +1263,10 @@ void HookSysLibs(char *module)
|
||||
if(tmp) pGetDiskFreeSpaceA = (GetDiskFreeSpaceA_Type)tmp;
|
||||
}
|
||||
|
||||
if(dxw.dwFlags2 & TIMESTRETCH){
|
||||
tmp = HookAPI("kernel32.dll", GetTickCount, "GetTickCount", extGetTickCount);
|
||||
if(tmp) pGetTickCount = (GetTickCount_Type)tmp;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,15 @@ dxwCore::dxwCore()
|
||||
hChildWnd = 0;
|
||||
bActive = TRUE;
|
||||
bDInputAbs = 0;
|
||||
TimeShift = 0;
|
||||
|
||||
// preserved syslibs pointers
|
||||
pClientToScreen=ClientToScreen;
|
||||
pClipCursor=ClipCursor;
|
||||
pGetClientRect=GetClientRect;
|
||||
pGetCursorPos=GetCursorPos;
|
||||
pInvalidateRect=InvalidateRect;
|
||||
pScreenToClient=ScreenToClient;
|
||||
}
|
||||
|
||||
dxwCore::~dxwCore()
|
||||
@ -276,4 +285,20 @@ BOOL dxwCore::HandleFPS()
|
||||
if(dwFlags2 & LIMITFPS) LimitFrameCount(dxw.MaxFPS);
|
||||
if(dwFlags2 & SKIPFPS) if(SkipFrameCount(dxw.MaxFPS)) return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DWORD dxwCore::GetTickCount(void)
|
||||
{
|
||||
DWORD dwTick;
|
||||
static DWORD dwLastRealTick=0;
|
||||
static DWORD dwLastFakeTick=0;
|
||||
DWORD dwNextRealTick;
|
||||
|
||||
dwNextRealTick=(*pGetTickCount)();
|
||||
dwTick=(dwNextRealTick-dwLastRealTick);
|
||||
if (TimeShift > 0) dwTick >>= TimeShift;
|
||||
if (TimeShift < 0) dwTick <<= -TimeShift;
|
||||
dwLastFakeTick += dwTick;
|
||||
dwLastRealTick = dwNextRealTick;
|
||||
return dwLastFakeTick;
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
#include <windows.h>
|
||||
#include "syslibs.h"
|
||||
|
||||
class dxwCore
|
||||
{
|
||||
@ -29,6 +30,7 @@ public: // methods
|
||||
RECT MapWindowRect(void);
|
||||
void ScreenRefresh(void);
|
||||
BOOL HandleFPS();
|
||||
DWORD GetTickCount(void);
|
||||
|
||||
public: // simple data variables
|
||||
DDPIXELFORMAT ActualPixelFormat;
|
||||
@ -47,6 +49,7 @@ public: // simple data variables
|
||||
BOOL bDInputAbs;
|
||||
DWORD MaxFPS;
|
||||
char *gsModules;
|
||||
int TimeShift;
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
@ -54,6 +57,12 @@ protected:
|
||||
DWORD dwScreenHeight;
|
||||
BOOL FullScreen;
|
||||
HWND hWnd;
|
||||
ClientToScreen_Type pClientToScreen;
|
||||
ClipCursor_Type pClipCursor;
|
||||
GetClientRect_Type pGetClientRect;
|
||||
GetCursorPos_Type pGetCursorPos;
|
||||
InvalidateRect_Type pInvalidateRect;
|
||||
ScreenToClient_Type pScreenToClient;
|
||||
};
|
||||
|
||||
extern dxwCore dxw;
|
||||
|
@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include <stdio.h>
|
||||
#include "dxwnd.h"
|
||||
|
||||
#define VERSION "2.02.01"
|
||||
#define VERSION "2.02.02"
|
||||
|
||||
LRESULT CALLBACK HookProc(int ncode, WPARAM wparam, LPARAM lparam);
|
||||
|
||||
|
Binary file not shown.
@ -1953,7 +1953,11 @@ BOOL WINAPI extGDIBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
|
||||
|
||||
if (dxw.HandleFPS()) return TRUE;
|
||||
|
||||
if (dxw.IsFullScreen()){
|
||||
// beware: HDC could refer to screen DC that are written directly on screen, or memory DC that will be scaled to
|
||||
// the screen surface later on, on ReleaseDC or ddraw Blit / Flip operation. Scaling of rect coordinates is
|
||||
// needed only in the first case, and must be avoided on the second, otherwise the image would be scaled twice!
|
||||
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdcDest))){
|
||||
int nWDest, nHDest;
|
||||
nWDest= nWidth;
|
||||
nHDest= nHeight;
|
||||
@ -1977,7 +1981,7 @@ BOOL WINAPI extGDIPatBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
|
||||
|
||||
if (dxw.HandleFPS()) return TRUE;
|
||||
|
||||
if (dxw.IsFullScreen()){
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdcDest))){
|
||||
int nWDest, nHDest;
|
||||
dxw.MapRect(&nXDest, &nYDest, &nWDest, &nHDest);
|
||||
res=(*pPatBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, dwRop);
|
||||
@ -2000,6 +2004,8 @@ BOOL WINAPI extGDIStretchBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, in
|
||||
|
||||
if (dxw.HandleFPS()) return TRUE;
|
||||
|
||||
// to do: what happend if StretchBlt is applied on screen DC ?
|
||||
|
||||
res=(*pStretchBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, nWSrc, nHSrc, dwRop);
|
||||
if(!res) OutTraceE("GDI.StretchBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__);
|
||||
return res;
|
||||
@ -2707,3 +2713,8 @@ LRESULT WINAPI extSendMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
OutTraceW("SendMessage: lresult=%x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
DWORD WINAPI extGetTickCount(void)
|
||||
{
|
||||
return dxw.GetTickCount();
|
||||
}
|
@ -88,6 +88,7 @@ typedef BOOL (WINAPI *GetDiskFreeSpaceA_Type)(LPCSTR, LPDWORD, LPDWORD, LPDWORD,
|
||||
typedef BOOL (WINAPI *SetDeviceGammaRamp_Type)(HDC, LPVOID);
|
||||
typedef BOOL (WINAPI *GetDeviceGammaRamp_Type)(HDC, LPVOID);
|
||||
typedef LRESULT (WINAPI *SendMessage_Type)(HWND, UINT, WPARAM, LPARAM);
|
||||
typedef DWORD (WINAPI *GetTickCount_Type)(void);
|
||||
|
||||
extern GetCursorPos_Type pGetCursorPos;
|
||||
extern SetCursorPos_Type pSetCursorPos;
|
||||
@ -161,4 +162,5 @@ extern GetDiskFreeSpaceA_Type pGetDiskFreeSpaceA;
|
||||
extern SetDeviceGammaRamp_Type pSetDeviceGammaRamp;
|
||||
extern GetDeviceGammaRamp_Type pGetDeviceGammaRamp;
|
||||
extern SendMessage_Type pSendMessage;
|
||||
extern GetTickCount_Type pGetTickCount;
|
||||
|
||||
|
@ -109,6 +109,7 @@
|
||||
#define IDC_SKIPFPS 1076
|
||||
#define IDC_SHOWFPS 1077
|
||||
#define IDC_HIDEMULTIMONITOR 1078
|
||||
#define IDC_TIMESTRETCH 1079
|
||||
#define ID_MODIFY 32771
|
||||
#define ID_DELETE 32772
|
||||
#define ID_ADD 32773
|
||||
|
@ -76,6 +76,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
|
||||
m_LimitFPS = FALSE;
|
||||
m_SkipFPS = FALSE;
|
||||
m_ShowFPS = FALSE;
|
||||
m_TimeStretch = FALSE;
|
||||
m_InitX = 0;
|
||||
m_InitY = 0;
|
||||
m_MaxX = 0;
|
||||
@ -155,6 +156,7 @@ void CTargetDlg::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Check(pDX, IDC_LIMITFPS, m_LimitFPS);
|
||||
DDX_Check(pDX, IDC_SKIPFPS, m_SkipFPS);
|
||||
DDX_Check(pDX, IDC_SHOWFPS, m_ShowFPS);
|
||||
DDX_Check(pDX, IDC_TIMESTRETCH, m_TimeStretch);
|
||||
DDX_Text(pDX, IDC_INITX, m_InitX);
|
||||
DDX_Text(pDX, IDC_INITY, m_InitY);
|
||||
DDX_Text(pDX, IDC_MAXX, m_MaxX);
|
||||
|
@ -80,6 +80,7 @@ public:
|
||||
BOOL m_SkipFPS;
|
||||
BOOL m_LimitFPS;
|
||||
BOOL m_ShowFPS;
|
||||
BOOL m_TimeStretch;
|
||||
int m_InitX;
|
||||
int m_InitY;
|
||||
int m_MaxX;
|
||||
|
Binary file not shown.
@ -213,20 +213,20 @@ BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,505,194,40,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,460,194,40,14
|
||||
GROUPBOX "DirectX Version Hook",IDC_STATIC,7,75,77,72,WS_GROUP
|
||||
LTEXT "DirectInput initial coord. and X,Y range",IDC_STATIC,179,195,125,8
|
||||
LTEXT "X",IDC_STATIC,174,208,8,8
|
||||
LTEXT "Y",IDC_STATIC,197,208,8,8
|
||||
LTEXT "(",IDC_STATIC,222,208,8,8
|
||||
LTEXT ",",IDC_STATIC,242,208,8,8
|
||||
LTEXT ")-(",IDC_STATIC,261,208,9,8
|
||||
LTEXT ",",IDC_STATIC,286,208,8,8
|
||||
LTEXT ")",IDC_STATIC,305,208,8,8
|
||||
EDITTEXT IDC_INITX,180,206,14,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
|
||||
EDITTEXT IDC_INITY,202,206,14,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
|
||||
EDITTEXT IDC_MINX,225,206,14,12,ES_AUTOHSCROLL,WS_EX_RIGHT
|
||||
EDITTEXT IDC_MINY,246,206,14,12,ES_AUTOHSCROLL,WS_EX_RIGHT
|
||||
EDITTEXT IDC_MAXX,269,206,14,12,ES_AUTOHSCROLL,WS_EX_RIGHT
|
||||
EDITTEXT IDC_MAXY,290,206,14,12,ES_AUTOHSCROLL,WS_EX_RIGHT
|
||||
LTEXT "DirectInput initial coord. and X,Y range",IDC_STATIC,306,195,125,8
|
||||
LTEXT "X",IDC_STATIC,301,208,8,8
|
||||
LTEXT "Y",IDC_STATIC,324,208,8,8
|
||||
LTEXT "(",IDC_STATIC,349,208,8,8
|
||||
LTEXT ",",IDC_STATIC,369,208,8,8
|
||||
LTEXT ")-(",IDC_STATIC,388,208,9,8
|
||||
LTEXT ",",IDC_STATIC,413,208,8,8
|
||||
LTEXT ")",IDC_STATIC,432,208,8,8
|
||||
EDITTEXT IDC_INITX,307,206,14,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
|
||||
EDITTEXT IDC_INITY,329,206,14,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
|
||||
EDITTEXT IDC_MINX,352,206,14,12,ES_AUTOHSCROLL,WS_EX_RIGHT
|
||||
EDITTEXT IDC_MINY,373,206,14,12,ES_AUTOHSCROLL,WS_EX_RIGHT
|
||||
EDITTEXT IDC_MAXX,396,206,14,12,ES_AUTOHSCROLL,WS_EX_RIGHT
|
||||
EDITTEXT IDC_MAXY,417,206,14,12,ES_AUTOHSCROLL,WS_EX_RIGHT
|
||||
CONTROL "Handle DC",IDC_HANDLEDC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,34,67,10
|
||||
EDITTEXT IDC_MODULE,7,60,139,12,ES_AUTOHSCROLL
|
||||
CONTROL "Auto Primary Surface Refresh",IDC_AUTOREFRESH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,44,108,8
|
||||
@ -297,10 +297,11 @@ BEGIN
|
||||
EDITTEXT IDC_MAXFPS,258,157,26,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
|
||||
CONTROL "Skip",IDC_SKIPFPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,164,27,9
|
||||
LTEXT "delay (msec)",IDC_STATIC,214,159,43,8
|
||||
GROUPBOX "Frame per Second",IDC_STATIC,172,142,121,48
|
||||
GROUPBOX "Frame per Second",IDC_STATIC,172,142,121,58
|
||||
CONTROL "Show FPS",IDC_SHOWFPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,176,52,9
|
||||
GROUPBOX "",IDC_STATIC,178,150,110,24
|
||||
CONTROL "Hide multi-monitor config.",IDC_HIDEMULTIMONITOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,433,144,98,9
|
||||
CONTROL "Time Stretch",IDC_TIMESTRETCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,186,52,9
|
||||
END
|
||||
|
||||
|
||||
|
Binary file not shown.
@ -409,6 +409,7 @@ void CDxwndhostView::OnModify()
|
||||
dlg.m_LimitFPS = TargetMaps[i].flags2 & LIMITFPS ? 1 : 0;
|
||||
dlg.m_SkipFPS = TargetMaps[i].flags2 & SKIPFPS ? 1 : 0;
|
||||
dlg.m_ShowFPS = TargetMaps[i].flags2 & SHOWFPS ? 1 : 0;
|
||||
dlg.m_TimeStretch = TargetMaps[i].flags2 & TIMESTRETCH ? 1 : 0;
|
||||
dlg.m_InitX = TargetMaps[i].initx;
|
||||
dlg.m_InitY = TargetMaps[i].inity;
|
||||
dlg.m_MinX = TargetMaps[i].minx;
|
||||
@ -498,6 +499,7 @@ void CDxwndhostView::OnModify()
|
||||
if(dlg.m_LimitFPS) TargetMaps[i].flags2 |= LIMITFPS;
|
||||
if(dlg.m_SkipFPS) TargetMaps[i].flags2 |= SKIPFPS;
|
||||
if(dlg.m_ShowFPS) TargetMaps[i].flags2 |= SHOWFPS;
|
||||
if(dlg.m_TimeStretch) TargetMaps[i].flags2 |= TIMESTRETCH;
|
||||
TargetMaps[i].initx = dlg.m_InitX;
|
||||
TargetMaps[i].inity = dlg.m_InitY;
|
||||
TargetMaps[i].minx = dlg.m_MinX;
|
||||
@ -779,6 +781,7 @@ void CDxwndhostView::OnAdd()
|
||||
if(dlg.m_LimitFPS) TargetMaps[i].flags2 |= LIMITFPS;
|
||||
if(dlg.m_SkipFPS) TargetMaps[i].flags2 |= SKIPFPS;
|
||||
if(dlg.m_ShowFPS) TargetMaps[i].flags2 |= SHOWFPS;
|
||||
if(dlg.m_TimeStretch) TargetMaps[i].flags2 |= TIMESTRETCH;
|
||||
TargetMaps[i].initx = dlg.m_InitX;
|
||||
TargetMaps[i].inity = dlg.m_InitY;
|
||||
TargetMaps[i].minx = dlg.m_MinX;
|
||||
|
Loading…
x
Reference in New Issue
Block a user