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

v2_02_06_src

Former-commit-id: d4efddb04484dd2edfc4dfcea2129763baf1ca88
This commit is contained in:
gho tik 2013-01-22 11:17:01 -05:00 committed by Refael ACkermann
parent e418999410
commit 8f3bc994d0
24 changed files with 4028 additions and 52 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:d748f1b239ec33cab73c3a6b40b6900a093f28c33c42e1b430f2e08f499e36fd oid sha256:19d29414d50135080a863b7865dfe2c8685150e1df359c9a5e528a65d5f9a46d
size 262144 size 263168

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:b9e5a9b8b7cadb640fa36491af117b34e6979ac7eb3cee8fa4b55b06e1a3ab9f oid sha256:fcaebaa1f5eaffeb624d13fdb6f6058db5383fcaeadf22df4a641a766127c8d5
size 488448 size 488448

View File

@ -17,4 +17,9 @@ Time stretching by keyboard control (Alt F5/F6) and/or Time Slider dialog
v2.02.05: v2.02.05:
hooked winmm timeGetTime() API: makes time stretching work for Age of Empires series hooked winmm timeGetTime() API: makes time stretching work for Age of Empires series
changed time stretching grain: now it's not the coarse grained 2x, 4x,... series in 9 possible values but the fine grained series 1.5x, 2x, 3x,.... in 17 possible values changed time stretching grain: now it's not the coarse grained 2x, 4x,... series in 9 possible values but the fine grained series 1.5x, 2x, 3x,.... in 17 possible values
added status and time stretching view panels to tray icon menu added status and time stretching view panels to tray icon menu
v2.02.06:
preliminary FPS counter overlapped on game screen, Alt-F7 to toggle display on/off.
fixed buf on time stretch logging (and possible game crash).
revised GetDC handling with 8BPP paletized surfaces: avoided need to emulate reverse-blitting and got an impressive speed improvement for games such as Age of Empires I & II and Hyperblade.

3881
debug/dxwnd.ini Normal file

File diff suppressed because it is too large Load Diff

View File

@ -504,7 +504,7 @@ static void dx_TogglePositionLock(HWND hwnd)
} }
} }
void dx_ToggleDC() static void dx_ToggleDC()
{ {
if(dxw.dwFlags1 & HANDLEDC){ if(dxw.dwFlags1 & HANDLEDC){
dxw.dwFlags1 &= ~HANDLEDC; dxw.dwFlags1 &= ~HANDLEDC;
@ -516,6 +516,18 @@ void dx_ToggleDC()
} }
} }
static void dx_ToggleFPS()
{
if(dxw.dwFlags2 & SHOWFPS){
dxw.dwFlags2 &= ~SHOWFPS;
OutTrace("ToggleFPS: SHOWFPS mode OFF\n");
}
else {
dxw.dwFlags2 |= SHOWFPS;
OutTrace("ToggleFPS: SHOWFPS mode ON\n");
}
}
LRESULT LastCursorPos; LRESULT LastCursorPos;
LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
@ -684,23 +696,26 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
case VK_F8: case VK_F8:
dx_ToggleDC(); dx_ToggleDC();
break; break;
case VK_F7:
dx_ToggleFPS();
break;
case VK_F6:
case VK_F5:
if (dxw.dwFlags2 & TIMESTRETCH) {
char *sTSCaption[17]={"x16","x8","x4","x2","x1",":2",":4",":8",":16"};
if (wparam == VK_F5 && (dxw.TimeShift < 8)) dxw.TimeShift++;
if (wparam == VK_F6 && (dxw.TimeShift > -8)) dxw.TimeShift--;
OutTrace("Time Stretch: shift=%d speed=%s\n", dxw.TimeShift, dxw.GetTSCaption());
DxWndStatus.iTimeShift=dxw.TimeShift;
SetHookStatus(&DxWndStatus);
}
break;
case VK_F4: case VK_F4:
if (dxw.dwFlags1 & HANDLEALTF4) { if (dxw.dwFlags1 & HANDLEALTF4) {
OutTraceD("WindowProc: WM_SYSKEYDOWN(ALT-F4) - terminating process\n"); OutTraceD("WindowProc: WM_SYSKEYDOWN(ALT-F4) - terminating process\n");
TerminateProcess(GetCurrentProcess(),0); TerminateProcess(GetCurrentProcess(),0);
} }
break; break;
case VK_F5:
case VK_F6:
if (dxw.dwFlags2 & TIMESTRETCH) {
char *sTSCaption[9]={"x16","x8","x4","x2","x1",":2",":4",":8",":16"};
if (wparam == VK_F5 && (dxw.TimeShift < 8)) dxw.TimeShift++;
if (wparam == VK_F6 && (dxw.TimeShift > -8)) dxw.TimeShift--;
OutTrace("Time Stretch: shift=%d speed=%s\n", dxw.TimeShift, sTSCaption[dxw.TimeShift+4]);
DxWndStatus.iTimeShift=dxw.TimeShift;
SetHookStatus(&DxWndStatus);
}
break;
default: default:
break; break;
} }

View File

@ -1,3 +1,4 @@
#include <stdio.h>
#include "dxwnd.h" #include "dxwnd.h"
#include "dxwcore.hpp" #include "dxwcore.hpp"
#include "syslibs.h" #include "syslibs.h"
@ -323,7 +324,7 @@ void dxwCore::ScreenRefresh(void)
} }
static void ShowFPS() static void CountFPS()
{ {
static DWORD time = 0xFFFFFFFF; static DWORD time = 0xFFFFFFFF;
static DWORD FPSCount = 0; static DWORD FPSCount = 0;
@ -333,6 +334,7 @@ static void ShowFPS()
// log fps count // log fps count
OutTrace("FPSCount=%d\n", FPSCount); OutTrace("FPSCount=%d\n", FPSCount);
// show fps count on status win // show fps count on status win
GetHookStatus(&DxWndStatus);
DxWndStatus.FPSCount = FPSCount; DxWndStatus.FPSCount = FPSCount;
SetHookStatus(&DxWndStatus); SetHookStatus(&DxWndStatus);
// reset // reset
@ -372,7 +374,7 @@ static BOOL SkipFrameCount(int delay)
BOOL dxwCore::HandleFPS() BOOL dxwCore::HandleFPS()
{ {
if(dwFlags2 & SHOWFPS) ShowFPS(); if(dwFlags2 & SHOWFPS) CountFPS();
if(dwFlags2 & LIMITFPS) LimitFrameCount(dxw.MaxFPS); if(dwFlags2 & LIMITFPS) LimitFrameCount(dxw.MaxFPS);
if(dwFlags2 & SKIPFPS) if(SkipFrameCount(dxw.MaxFPS)) return TRUE; if(dwFlags2 & SKIPFPS) if(SkipFrameCount(dxw.MaxFPS)) return TRUE;
return FALSE; return FALSE;
@ -452,4 +454,58 @@ void dxwCore::GetSystemTime(LPSYSTEMTIME lpSystemTime)
StartFileTime = CurrFileTime; StartFileTime = CurrFileTime;
dwStartTick = dwCurrentTick; dwStartTick = dwCurrentTick;
} }
}
void dxwCore::ShowFPS(LPDIRECTDRAWSURFACE lpdds)
{
HDC xdc; // the working dc
char sBuf[81];
static DWORD dwTimer = 0;
static int corner = 0;
static int x, y;
static DWORD color;
if((*pGetTickCount)()-dwTimer > 4000){
if(!dwTimer) srand ((*pGetTickCount)());
dwTimer = (*pGetTickCount)();
//corner = rand() % 4;
corner = dwTimer % 4;
//color = ((0x80 + (rand() % 0x80))) +
// ((0x80 + (rand() % 0x80))<<8) +
// ((0x80 + (rand() % 0x80))<<16);
// color = rand() % 0x1000000;
//color = RGB(rand()%0x100, rand()%0x100, rand()%0x100);
//color = RGB(dwTimer%0x100, dwTimer%0x100, dwTimer%0x100);
color=0xFF0000; // blue
switch (corner) {
case 0: x=10; y=10; break;
case 1: x=dwScreenWidth-60; y=10; break;
case 2: x=dwScreenWidth-60; y=dwScreenHeight-20; break;
case 3: x=10; y=dwScreenHeight-20; break;
}
}
if (FAILED(lpdds->GetDC(&xdc))) return;
SetTextColor(xdc,color);
//SetBkMode(xdc, TRANSPARENT);
SetBkMode(xdc, OPAQUE);
sprintf(sBuf, "FPS: %d", DxWndStatus.FPSCount);
TextOut(xdc, x, y, sBuf, strlen(sBuf));
lpdds->ReleaseDC(xdc);
}
char *dxwCore::GetTSCaption(int shift)
{
static char *sTSCaption[17]={
"x16","x12","x8","x6",
"x4","x3","x2","x1.5",
"x1",
":1.5",":2",":3",":4",
":6",":8",":12",":16"};
if (shift<0 || shift>16) return "???";
return sTSCaption[shift+8];
}
char *dxwCore::GetTSCaption(void)
{
return GetTSCaption(TimeShift);
} }

View File

@ -42,7 +42,9 @@ public: // methods
void ResetPrimarySurface(void); void ResetPrimarySurface(void);
void GetSystemTime(LPSYSTEMTIME lpSystemTime); void GetSystemTime(LPSYSTEMTIME lpSystemTime);
DWORD StretchTime(DWORD); DWORD StretchTime(DWORD);
void ShowFPS(LPDIRECTDRAWSURFACE);
char *GetTSCaption(int);
char *GetTSCaption(void);
public: // simple data variables public: // simple data variables
DDPIXELFORMAT ActualPixelFormat; DDPIXELFORMAT ActualPixelFormat;

View File

@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdio.h> #include <stdio.h>
#include "dxwnd.h" #include "dxwnd.h"
#define VERSION "2.02.05" #define VERSION "2.02.06"
LRESULT CALLBACK HookProc(int ncode, WPARAM wparam, LPARAM lparam); LRESULT CALLBACK HookProc(int ncode, WPARAM wparam, LPARAM lparam);

View File

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 10.00 Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008 # Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dxwnd", "dxwnd.ws2008.vcproj", "{579E7FE7-2745-4100-A802-23511711FCDE}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dxwnd", "dxwnd.vs2008.vcproj", "{579E7FE7-2745-4100-A802-23511711FCDE}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

BIN
dll/dxwnd.vs2008.suo Normal file

Binary file not shown.

View File

@ -1,20 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dxwnd", "dxwnd.ws2005.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.

Binary file not shown.

View File

@ -210,7 +210,7 @@ SetEntries_Type pSetEntries;
LPDIRECTDRAWSURFACE lpDDSEmu_Prim=NULL, lpDDSEmu_Back=NULL; LPDIRECTDRAWSURFACE lpDDSEmu_Prim=NULL, lpDDSEmu_Back=NULL;
LPDIRECTDRAWSURFACE lpDDSBack=NULL; LPDIRECTDRAWSURFACE lpDDSBack=NULL;
LPDIRECTDRAWCLIPPER lpDDC=NULL; LPDIRECTDRAWCLIPPER lpDDC=NULL;
LPDIRECTDRAWPALETTE lpDDP = 0; LPDIRECTDRAWPALETTE lpDDP=NULL;
LPDIRECTDRAW lpDD=NULL; LPDIRECTDRAW lpDD=NULL;
// v2.1.87: lpServiceDD is the DIRECTDRAW object to which the primary surface and all // v2.1.87: lpServiceDD is the DIRECTDRAW object to which the primary surface and all
// the service objects (emulated backbuffer, emulater primary, ....) are attached. // the service objects (emulated backbuffer, emulater primary, ....) are attached.
@ -1688,14 +1688,12 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf
// beware of the different behaviour between older and newer directdraw releases... // beware of the different behaviour between older and newer directdraw releases...
if(dxversion >= 4){ if(dxversion >= 4){
//if (lpDDSHDC) while(lpDDSHDC->Release());
if (lpDDC) while(lpDDC->Release()); if (lpDDC) while(lpDDC->Release());
if (lpDDSEmu_Back) while(lpDDSEmu_Back->Release()); if (lpDDSEmu_Back) while(lpDDSEmu_Back->Release());
if (lpDDSEmu_Prim) while(lpDDSEmu_Prim->Release()); if (lpDDSEmu_Prim) while(lpDDSEmu_Prim->Release());
if (ddsd.dwFlags & DDSD_BACKBUFFERCOUNT) if (ddsd.dwFlags & DDSD_BACKBUFFERCOUNT)
if (lpDDSBack) while(lpDDSBack->Release()); if (lpDDSBack) while(lpDDSBack->Release());
} }
//lpDDSHDC=NULL;
lpDDC=NULL; lpDDC=NULL;
lpDDSEmu_Back=NULL; lpDDSEmu_Back=NULL;
lpDDSEmu_Prim=NULL; lpDDSEmu_Prim=NULL;
@ -1873,6 +1871,26 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf
return res; return res;
} }
// for 8BPP palettized surfaces, connect them to either the ddraw emulated palette or the GDI emulated palette
if(ddsd.ddpfPixelFormat.dwRGBBitCount==8){ // use a better condition here....
if(lpDDP==NULL){
// should link here to the GDI palette? See Hyperblade....
//static PALETTEENTRY Palette[256];
extern PALETTEENTRY *GDIPalette;
//res=(*pCreatePalette)(lpdd, DDPCAPS_ALLOW256|DDPCAPS_8BIT|DDPCAPS_INITIALIZE, Palette, &lpDDP, NULL);
res=(*pCreatePalette)(lpdd, DDPCAPS_ALLOW256|DDPCAPS_8BIT|DDPCAPS_INITIALIZE, GDIPalette, &lpDDP, NULL);
if (res) {
OutTraceE("CreateSurface: CreatePalette ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
}
res=(*pSetPalette)(*lplpdds, lpDDP);
if (res) {
OutTraceE("CreateSurface: SetPalette ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
}
// diagnostic hooks .... // diagnostic hooks ....
HookDDSurfaceGeneric(lplpdds, dxversion); HookDDSurfaceGeneric(lplpdds, dxversion);
// unmark this as possible primary // unmark this as possible primary
@ -2428,6 +2446,7 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect,
work on my PC. work on my PC.
*/ */
if(res==DDERR_UNSUPPORTED){ if(res==DDERR_UNSUPPORTED){
if (dxw.dwFlags2 & SHOWFPS) dxw.ShowFPS(lpddssrc);
res=(*pBlt)(lpDDSEmu_Prim, &destrect, lpddssrc, lpsrcrect, dwflags, lpddbltfx); res=(*pBlt)(lpDDSEmu_Prim, &destrect, lpddssrc, lpsrcrect, dwflags, lpddbltfx);
if (res) BlitError(res, lpsrcrect, &destrect, __LINE__); if (res) BlitError(res, lpsrcrect, &destrect, __LINE__);
} }
@ -2462,6 +2481,7 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect,
lpDDSSource = lpdds; lpDDSSource = lpdds;
} }
if (dxw.dwFlags2 & SHOWFPS) dxw.ShowFPS(lpDDSSource);
res=(*pBlt)(lpDDSEmu_Prim, &destrect, lpDDSSource, &emurect, DDBLT_WAIT, 0); res=(*pBlt)(lpDDSEmu_Prim, &destrect, lpDDSSource, &emurect, DDBLT_WAIT, 0);
if (res==DDERR_NOCLIPLIST){ if (res==DDERR_NOCLIPLIST){
RenewClipper(lpDD, lpDDSEmu_Prim); RenewClipper(lpDD, lpDDSEmu_Prim);
@ -2880,6 +2900,7 @@ HRESULT WINAPI extUnlock(int dxversion, Unlock4_Type pUnlock, LPDIRECTDRAWSURFAC
lpDDSSource=lpdds; lpDDSSource=lpdds;
} }
if (dxw.dwFlags2 & SHOWFPS) dxw.ShowFPS(lpDDSSource);
res=(*pBlt)(lpDDSEmu_Prim, &screen, lpDDSSource, &rect, DDBLT_WAIT, 0); res=(*pBlt)(lpDDSEmu_Prim, &screen, lpDDSSource, &rect, DDBLT_WAIT, 0);
if (res==DDERR_NOCLIPLIST) { if (res==DDERR_NOCLIPLIST) {
RenewClipper(lpDD, lpDDSEmu_Prim); RenewClipper(lpDD, lpDDSEmu_Prim);
@ -2921,7 +2942,7 @@ HRESULT WINAPI extGetDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR *pHDC)
// Should the surface have a RGB color setting to allow for DC creation? // Should the surface have a RGB color setting to allow for DC creation?
// log an error just when not intercepted by EMULATESURFACE|HANDLEDC handling below // log an error just when not intercepted by EMULATESURFACE|HANDLEDC handling below
if ((dxw.dwFlags1 & (EMULATESURFACE|HANDLEDC))!=(EMULATESURFACE|HANDLEDC)) if ((dxw.dwFlags1 & (EMULATESURFACE|HANDLEDC))!=(EMULATESURFACE|HANDLEDC))
OutTraceE("GetDC ERROR: lpdss=%x%s, hdc=%x, res=%x(%s) at %d\n", OutTraceE("GetDC ERROR: lpdss=%x%s, hdc=%x, res=%x(%s) at %d\n",
lpdds, IsPrim?"(PRIM)":"", *pHDC, res, ExplainDDError(res), __LINE__); lpdds, IsPrim?"(PRIM)":"", *pHDC, res, ExplainDDError(res), __LINE__);

View File

@ -2265,6 +2265,7 @@ typedef struct tagDxWndLOGPALETTE
} DxWndLOGPALETTE; } DxWndLOGPALETTE;
DxWndLOGPALETTE MyPal; DxWndLOGPALETTE MyPal;
PALETTEENTRY *GDIPalette = MyPal.palPalEntry;
//BOOL G_bForceBackground; //BOOL G_bForceBackground;
HPALETTE WINAPI extGDICreatePalette(CONST LOGPALETTE *plpal) HPALETTE WINAPI extGDICreatePalette(CONST LOGPALETTE *plpal)

View File

@ -44,6 +44,7 @@ void CStatusDialog::OnTimer(UINT_PTR nIDEvent)
extern PRIVATEMAP *pTitles; extern PRIVATEMAP *pTitles;
extern TARGETMAP *pTargets; extern TARGETMAP *pTargets;
TARGETMAP *Target; TARGETMAP *Target;
extern char *GetTSCaption(int);
CDialog::OnTimer(nIDEvent); CDialog::OnTimer(nIDEvent);
DxStatus=GetHookStatus(NULL); DxStatus=GetHookStatus(NULL);
@ -56,7 +57,6 @@ void CStatusDialog::OnTimer(UINT_PTR nIDEvent)
GetDllVersion(DllVersion); GetDllVersion(DllVersion);
DxWndStatus.Status=DxStatus; DxWndStatus.Status=DxStatus;
if(DxStatus==DXW_RUNNING){ if(DxStatus==DXW_RUNNING){
char *sTSCaption[17]={"x16","x12","x8","x6","x4","x3","x2","x1.5","x1",":1.5",":2",":3",":4",":6",":8",":12",":16"};
GetHookStatus(&DxWndStatus); GetHookStatus(&DxWndStatus);
Target=&pTargets[DxWndStatus.TaskIdx]; Target=&pTargets[DxWndStatus.TaskIdx];
@ -76,7 +76,7 @@ void CStatusDialog::OnTimer(UINT_PTR nIDEvent)
} }
if(Target->flags2 & TIMESTRETCH){ if(Target->flags2 & TIMESTRETCH){
if(DxWndStatus.iTimeShift>=-8 && DxWndStatus.iTimeShift<=8){ if(DxWndStatus.iTimeShift>=-8 && DxWndStatus.iTimeShift<=8){
sprintf(sMsgBuf, "\nTime speed: %s", sTSCaption[DxWndStatus.iTimeShift+8]); sprintf(sMsgBuf, "\nTime speed: %s", GetTSCaption(DxWndStatus.iTimeShift));
strcat(sMsg, sMsgBuf); strcat(sMsg, sMsgBuf);
} }
} }

View File

@ -10,6 +10,7 @@ class CTimeSliderDialog : public CDialog
public: public:
CTimeSliderDialog(CWnd* pParent = NULL); // standard constructor CTimeSliderDialog(CWnd* pParent = NULL); // standard constructor
virtual ~CTimeSliderDialog(); virtual ~CTimeSliderDialog();
//~CTimeSliderDialog();
// Dialog Data // Dialog Data
enum { IDD = IDD_TIMESLIDER }; enum { IDD = IDD_TIMESLIDER };

View File

@ -16,6 +16,8 @@ CTimeSliderDialog::CTimeSliderDialog(CWnd* pParent /*=NULL*/)
CTimeSliderDialog::~CTimeSliderDialog() CTimeSliderDialog::~CTimeSliderDialog()
{ {
MessageBoxEx(0, "Time Slider destructor", "Warning", MB_OK | MB_ICONEXCLAMATION, NULL);
//CTimeSliderDialog::OnOK(); // kill timer....
} }
void CTimeSliderDialog::DoDataExchange(CDataExchange* pDX) void CTimeSliderDialog::DoDataExchange(CDataExchange* pDX)
@ -40,9 +42,9 @@ void CTimeSliderDialog::OnTimer(UINT_PTR nIDEvent)
DXWNDSTATUS Status; DXWNDSTATUS Status;
CSliderCtrl *Slider; CSliderCtrl *Slider;
CStatic *Text; CStatic *Text;
char *sTSCaption[17]={"x16","x12","x8","x6","x4","x3","x2","x1.5","x1",":1.5",":2",":3",":4",":6",":8",":12",":16"};
char sMsg[81]; char sMsg[81];
static int iLastPos=-1; static int iLastPos=-1;
extern char *GetTSCaption(int);
Slider=(CSliderCtrl *)this->GetDlgItem(IDC_TIMESLIDER); Slider=(CSliderCtrl *)this->GetDlgItem(IDC_TIMESLIDER);
Text=(CStatic *)this->GetDlgItem(IDC_TIMESPEED); Text=(CStatic *)this->GetDlgItem(IDC_TIMESPEED);
@ -67,7 +69,7 @@ void CTimeSliderDialog::OnTimer(UINT_PTR nIDEvent)
SetHookStatus(&Status); SetHookStatus(&Status);
} }
iLastPos = i_TimeSlider; iLastPos = i_TimeSlider;
sprintf(sMsg, "Time speed: %s", sTSCaption[i_TimeSlider+8]); sprintf(sMsg, "Time speed %s", GetTSCaption(i_TimeSlider));
Text->SetWindowTextA(sMsg); Text->SetWindowTextA(sMsg);
} }
@ -93,8 +95,9 @@ void CTimeSliderDialog::OnOK()
{ {
// TODO: Add your specialized code here and/or call the base class // TODO: Add your specialized code here and/or call the base class
KillTimer(IDTIMER);
// stop timer // stop timer
// MessageBoxEx(0, "Stopping Time Slider dialog", "Warning", MB_OK | MB_ICONEXCLAMATION, NULL);
KillTimer(IDTIMER);
DXWNDSTATUS Status; DXWNDSTATUS Status;
GetHookStatus(&Status); GetHookStatus(&Status);

Binary file not shown.

View File

@ -200,3 +200,14 @@ void CDxwndhostApp::OnAppAbout()
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CDxwndhostApp Message Handler // CDxwndhostApp Message Handler
char *GetTSCaption(int shift)
{
static char *sTSCaption[17]={
"x16","x12","x8","x6",
"x4","x3","x2","x1.5",
"x1",
":1.5",":2",":3",":4",
":6",":8",":12",":16"};
if (shift<-8 || shift>8) return "???";
return sTSCaption[shift+8];
}

View File

@ -328,13 +328,13 @@ BEGIN
END END
IDD_TIMESLIDER DIALOGEX 0, 0, 168, 65 IDD_TIMESLIDER DIALOGEX 0, 0, 168, 65
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION
CAPTION "Time Slider" CAPTION "Time Slider"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "OK",IDOK,111,44,50,14 DEFPUSHBUTTON "OK",IDOK,111,44,50,14
CONTROL "",IDC_TIMESLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TRANSPARENTBKGND | WS_TABSTOP,7,7,154,18,WS_EX_TRANSPARENT CONTROL "",IDC_TIMESLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TRANSPARENTBKGND | WS_TABSTOP,7,7,154,18,WS_EX_TRANSPARENT
LTEXT "Time shift:",IDC_TIMESPEED,7,43,64,15 LTEXT "Time speed",IDC_TIMESPEED,7,43,86,15
LTEXT "x16",IDC_STATIC,7,31,15,9 LTEXT "x16",IDC_STATIC,7,31,15,9
LTEXT "x8",IDC_STATIC,30,30,15,9 LTEXT "x8",IDC_STATIC,30,30,15,9
LTEXT "x4",IDC_STATIC,47,30,15,9 LTEXT "x4",IDC_STATIC,47,30,15,9

Binary file not shown.