diff --git a/Include/dxwnd.h b/Include/dxwnd.h index 311f6fc..29dd190 100644 --- a/Include/dxwnd.h +++ b/Include/dxwnd.h @@ -152,7 +152,7 @@ #define NOWINPOSCHANGES 0x00000004 // suppress WM_WINDOWPOSCHANGING/CHANGED messages (RollerCoaster Tycoon...) #define ANSIWIDE 0x00000008 // by default uses Widechar version of API intead od ANSI #define NOBLT 0x00000010 // suppress blit to primary surface -//#define NOSYSTEMEMULATED 0x00000020 // forces suppression of DDSCAPS_SYSTEMMEMORY capability on emulated front & backbuffer surfaces +#define USELASTCORE 0x00000020 // Same as single core process affinity, but using the last availabe core instead of first one #define DOFASTBLT 0x00000040 // use FastBlt to primary surface #define AEROBOOST 0x00000080 // Optimize for AERO environment: does all stretching in sysmemory surfaces #define QUARTERBLT 0x00000100 // Consider a screen update (to count or limit FPS) only blt operations bigger than a quarter of the whole primary surface @@ -221,6 +221,8 @@ #define HOOKDIRECTSOUND 0x00000008 #define HOOKSMACKW32 0x00000010 #define BLOCKPRIORITYCLASS 0x00000020 // blocks attempts to change the process priority class +#define CPUSLOWDOWN 0x00000040 // reduces CPU time dedicated to non time critical threads +#define CPUMAXUSAGE 0x00000080 // reduces CPU time to non time critical threads that consume more than the given ratio // eighth flags DWORD dxw.dwFlags8: @@ -277,6 +279,7 @@ typedef struct TARGETMAP short MaxScreenRes; short SwapEffect; short MaxDdrawInterface; + short SlowRatio; }TARGETMAP; typedef struct diff --git a/Release/-dxwnd.dll b/Release/-dxwnd.dll deleted file mode 100644 index bba0326..0000000 --- a/Release/-dxwnd.dll +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f65c1e7993261840d66b4fed49ccf914a83f3a90b8e269f0cb9bff6464713c25 -size 648704 diff --git a/Release/.gitattributes b/Release/.gitattributes deleted file mode 100644 index b110a24..0000000 --- a/Release/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -*.{dll,exe} filter=lfs diff=lfs merge=lfs -text \ No newline at end of file diff --git a/Release/dxwnd.ini b/Release/dxwnd.ini deleted file mode 100644 index 9217f22..0000000 --- a/Release/dxwnd.ini +++ /dev/null @@ -1,66 +0,0 @@ -[window] -posx=1089 -posy=686 -sizx=554 -sizy=320 -exepath=D:\Games\Moto Racer 2 (GOG)\ -exportpath=D:\DxWnd\exports\ -[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 -flagl0=0 -flagm0=0 -tflag0=0 -dflag0=0 -posx0=150 -posy0=150 -sizx0=880 -sizy0=660 -maxfps0=0 -initts0=0 -winver0=0 -maxres0=-1 -swapeffect0=0 -maxddinterface0=7 -title1=Moto Racer 2 (GOG) -path1=D:\Games\Moto Racer 2 (GOG)\moto.exe -launchpath1=D:\Games\Moto Racer 2 (GOG)\moto.exe -noD3D -module1= -opengllib1= -notes1= -registry1= -ver1=0 -coord1=0 -flag1=681574450 -flagg1=1207959680 -flagh1=20 -flagi1=138412036 -flagj1=4224 -flagk1=327680 -flagl1=0 -flagm1=0 -tflag1=0 -dflag1=0 -posx1=50 -posy1=50 -sizx1=800 -sizy1=600 -maxfps1=0 -initts1=0 -winver1=0 -maxres1=-1 -swapeffect1=0 -maxddinterface1=7 diff --git a/Release/dxwnd.rar b/Release/dxwnd.rar deleted file mode 100644 index 7ceb8cf..0000000 Binary files a/Release/dxwnd.rar and /dev/null differ diff --git a/build/dxwnd.dll b/build/dxwnd.dll index 8d6ef32..fa81315 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5851f8d55e160f90a240f655882cde9566c5edc132a20dff793d05746806f377 -size 649216 +oid sha256:3c7dbfc11581e871c2b2611baad8c24e7e904c1264771fbddf1ae438805b6817 +size 651776 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index d382450..553085f 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0c4c24c7a4b18dbcbc807d2c4d9bdf0a8dab01a0462815c337b62a2ee56aec86 -size 567296 +oid sha256:a0ffb89088ea50da7077abb29aa298d730841a13f2a8b0e9882b088e0a8290c6 +size 568320 diff --git a/build/exports/Microsoft Golf '98 trial.dxw b/build/exports/Microsoft Golf '98 trial.dxw new file mode 100644 index 0000000..01114d2 --- /dev/null +++ b/build/exports/Microsoft Golf '98 trial.dxw @@ -0,0 +1,29 @@ +[target] +title0=Microsoft Golf '98 trial (win) +path0=D:\Games\MSGolf98\MSGOLF98\GAME.EXE +launchpath0= +module0= +opengllib0= +notes0= +registry0=[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft]\n[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games]\n[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Golf '98]\n[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Golf '98\Version 1.0 Demo]\n"AppPath"="D:\\Games\\MSGolf98\\MSGOLF98"\n"InstallType"="1"\n"InstallPath"="D:\\Games\\MSGolf98\\MSGOLF98\\"\n"CDPath"="D:\\Games\\MSGolf98\\MSGOLF98"\n"Launched"="1"\n"PID"=""\n"Path"="D:\\Games\\MSGolf98\\MSGOLF98"\n"VersionType"="TrialVersion"\n"InstalledGroup"="1"\n"LangID"=dword:00000009\n +ver0=0 +coord0=0 +flag0=136314914 +flagg0=-671088640 +flagh0=1302 +flagi0=1212547076 +flagj0=4224 +flagk0=67436544 +flagl0=4 +flagm0=0 +tflag0=0 +posx0=50 +posy0=50 +sizx0=0 +sizy0=0 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 +maxddinterface0=7 diff --git a/build/exports/NHL 2002.dxw b/build/exports/NHL 2002.dxw new file mode 100644 index 0000000..c23311b --- /dev/null +++ b/build/exports/NHL 2002.dxw @@ -0,0 +1,30 @@ +[target] +title0=NHL 2002 +path0=D:\Games\NHL 2002\nhl2002.exe +launchpath0= +module0= +opengllib0= +notes0= +registry0= +ver0=7 +coord0=0 +flag0=681574499 +flagg0=1476395008 +flagh0=528 +flagi0=136314884 +flagj0=1073746048 +flagk0=327680 +flagl0=0 +flagm0=0 +tflag0=0 +dflag0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 +maxddinterface0=7 diff --git a/build/proxy/d3d8.dll b/build/proxy/d3d8.dll index c251817..21de276 100644 --- a/build/proxy/d3d8.dll +++ b/build/proxy/d3d8.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fa29fd8235aa5d5495b9c746b2136881651c5b6b20eff49fd3b8066af4b02d32 +oid sha256:37885dbe85ab16b1b2cf2c3b076fabcab8e7b4449805b687e6bf407f3d16fcf2 size 54784 diff --git a/build/proxy/d3d9.dll b/build/proxy/d3d9.dll index b2d5c1e..8bd250e 100644 --- a/build/proxy/d3d9.dll +++ b/build/proxy/d3d9.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:56c095298d34bb02e98bacc0a6003ad912dc590311f9b83e0e855e5da5109ec2 +oid sha256:1cdc266999665fbf022cd1853a03180d854014a4be9436b0b9faeaa6b8244aea size 55808 diff --git a/build/proxy/ddraw.dll b/build/proxy/ddraw.dll index 2c8099d..5d31b6e 100644 --- a/build/proxy/ddraw.dll +++ b/build/proxy/ddraw.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cdec1b4fb66b410c4d83bad4c9d12d9195bb1b1dc4dba15a11123d320bd09fc4 +oid sha256:aa3872f2e46abbb3f7eba695aeee5e2b93a454be8d56f8beaf63c06921910730 size 56320 diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt index ab36c6a..415bbe9 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -1106,4 +1106,8 @@ fix: force clipper now builds a clipper for the real primary surface (useful whe v2.03.67 fix: D3D7 hooks to make NBA2002 working fix: better virtual color depth settings to allow "Moto Racer 2" believe it is running on a fake 16bpp desktop -fix: GUI placement coordinates are not saved when terminating in minimized or maximized state \ No newline at end of file +fix: GUI placement coordinates are not saved when terminating in minimized or maximized state + +v2.03.68 +add: options to limit the cpu usage of program threads, either inconditionally ("CPU slow down") or only for CPU consuming threads ("CPU max usage"). +fix: some logging details \ No newline at end of file diff --git a/dll/cpulimit.cpp b/dll/cpulimit.cpp new file mode 100644 index 0000000..38d2474 --- /dev/null +++ b/dll/cpulimit.cpp @@ -0,0 +1,240 @@ +#include +#include +#include +#include "dxwnd.h" +#include "dxwcore.hpp" + +#define MAX_THREAD_ARRAY 40 + +// forward declarations +BOOL SlowCpuSpeed(DWORD, DWORD, int); +BOOL LimitCpuUsage(DWORD, DWORD, int); + +DWORD WINAPI CpuSlow(LPVOID lpThreadParameter) +{ + int iSlowDownRatio = dxw.SlowRatio; + DWORD dwOwnerPID = GetCurrentProcessId(); + DWORD dwOwnerThread = GetCurrentThreadId(); + OutTrace("starting CPUSlow dwOwnerPID=%x Ratio=1:%d\n", dwOwnerPID, iSlowDownRatio); + if(!dwOwnerPID) return FALSE; + if(iSlowDownRatio < 1) return FALSE; + Sleep(100); + while(TRUE) SlowCpuSpeed(dwOwnerPID, dwOwnerThread, iSlowDownRatio); + return TRUE; +} + +DWORD WINAPI CpuLimit(LPVOID lpThreadParameter) +{ + int iSlowDownRatio = dxw.SlowRatio; + DWORD dwOwnerPID = GetCurrentProcessId(); + DWORD dwOwnerThread = GetCurrentThreadId(); + OutTrace("starting CPULimit dwOwnerPID=%x Ratio=1:%d\n", dwOwnerPID, iSlowDownRatio); + if(!dwOwnerPID) return FALSE; + if(iSlowDownRatio < 1) return FALSE; + //while(TRUE) + return LimitCpuUsage(dwOwnerPID, dwOwnerThread, iSlowDownRatio); +} + +BOOL SlowCpuSpeed(DWORD dwOwnerPID, DWORD dwOwnerThread, int iSlowDownRatio) +{ + HANDLE hThreadSnap = INVALID_HANDLE_VALUE; + THREADENTRY32 te32; + HANDLE SuspThreads[MAX_THREAD_ARRAY]; + int iThreadIndex, iNumThreads; + + // Take a snapshot of all running threads + hThreadSnap = CreateToolhelp32Snapshot( TH32CS_SNAPTHREAD, 0 ); + if(hThreadSnap == INVALID_HANDLE_VALUE) { + OutTrace("LimitCpuUsage: CreateToolhelp32Snapshot ERROR err=%d\n", GetLastError()); + return FALSE; + } + + // Fill in the size of the structure before using it. + te32.dwSize = sizeof(THREADENTRY32); + + // Retrieve information about the first thread, and exit if unsuccessful + if(!Thread32First(hThreadSnap, &te32)){ + OutTrace("Thread32First ERROR: err=%d\n", GetLastError()); // Show cause of failure + CloseHandle(hThreadSnap); // Must clean up the snapshot object! + return FALSE; + } + + // Now walk the thread list of the system, + // and stop each low-priority thread + iThreadIndex = 0; + do { + if((te32.th32OwnerProcessID == dwOwnerPID) && (te32.th32ThreadID != dwOwnerThread)){ + if (te32.tpBasePri < THREAD_PRIORITY_TIME_CRITICAL) { + HANDLE hThread = OpenThread(THREAD_SUSPEND_RESUME, FALSE, te32.th32ThreadID); + SuspendThread(hThread); + SuspThreads[iThreadIndex++] = hThread; + } + } + } while(Thread32Next(hThreadSnap, &te32) && (iThreadIndex 100) cycle=0; // every 100 cyces forces a thread list refresh + + Sleep(DELTA_TIME); + + for(iThreadIndex=0; iThreadIndexhThread == NULL) continue; // skip terminated ones + if(!GetThreadTimes(t->hThread, &CreationTime, &ExitTime, &KernelTime, &UserTime)) { + //OutTrace("Tid[%d]=%x died at %d\n", iThreadIndex, t->hThread, __LINE__); + //CloseHandle(t->hThread); + t->hThread = NULL; + continue; + } + if (t->Suspended) { + t->DeltaUsed -= iTimeSlot; + //OutTrace("Tid[%d]=%x suspended delta=%ld\n", iThreadIndex, t->hThread, t->DeltaUsed); + if(t->DeltaUsed < 0) { + if (ResumeThread(t->hThread)== -1){ + //OutTrace("Tid[%d]=%x died at %d\n", iThreadIndex, t->hThread, __LINE__); + //CloseHandle(t->hThread); + t->hThread = NULL; + continue; + } + t->Suspended = FALSE; + } + } + else { + iUserTime = UserTime.dwLowDateTime; + iKernelTime = KernelTime.dwLowDateTime; + t->DeltaUsed = t->DeltaUsed + (iUserTime + iKernelTime) - t->LastUsed; + t->LastUsed = iUserTime + iKernelTime; + //OutTrace("Tid[%d]=%x active delta=%ld\n", iThreadIndex, t->hThread, t->DeltaUsed); + if (t->DeltaUsed > (signed long)iTimeLimit) { + //OutTrace("Tid[%d]=%x stopped last=%ld\n", iThreadIndex, t->hThread, t->DeltaUsed); + if (SuspendThread(t->hThread)== -1) { + //OutTrace("Tid[%d]=%x died at %d\n", iThreadIndex, t->hThread, __LINE__); + //CloseHandle(t->hThread); + t->hThread = NULL; + continue; + } + t->Suspended = TRUE; + t->DeltaUsed -= iTimeSlot; + } + } + } + } + + // should never go here .... + OutTrace("end of cycle\n"); + for(int i=0; i>=1) if(dword & 0x1) fprintf(fp, "%s ", Flag4Names[i]); for(i=0, dword=dxw.dwFlags5; i<32; i++, dword>>=1) if(dword & 0x1) fprintf(fp, "%s ", Flag5Names[i]); for(i=0, dword=dxw.dwFlags6; i<32; i++, dword>>=1) if(dword & 0x1) fprintf(fp, "%s ", Flag6Names[i]); - for(i=0, dword=dxw.dwFlags7; i<32; i++, dword>>=1) if(dword & 0x1) fprintf(fp, "%s ", Flag6Names[i]); - for(i=0, dword=dxw.dwFlags8; i<32; i++, dword>>=1) if(dword & 0x1) fprintf(fp, "%s ", Flag6Names[i]); + for(i=0, dword=dxw.dwFlags7; i<32; i++, dword>>=1) if(dword & 0x1) fprintf(fp, "%s ", Flag7Names[i]); + for(i=0, dword=dxw.dwFlags8; i<32; i++, dword>>=1) if(dword & 0x1) fprintf(fp, "%s ", Flag8Names[i]); for(i=0, dword=dxw.dwTFlags; i<32; i++, dword>>=1) if(dword & 0x1) fprintf(fp, "%s ", TFlagNames[i]); fprintf(fp, "***\n"); } @@ -964,21 +966,34 @@ void DisableIME() #endif } -void SetSingleProcessAffinity(void) +void SetSingleProcessAffinity(BOOL first) { int i; DWORD ProcessAffinityMask, SystemAffinityMask; if(!GetProcessAffinityMask(GetCurrentProcess(), &ProcessAffinityMask, &SystemAffinityMask)) OutTraceE("GetProcessAffinityMask: ERROR err=%d\n", GetLastError()); OutTraceDW("Process affinity=%x\n", ProcessAffinityMask); - for (i=0; i<(8 * sizeof(DWORD)); i++){ - if (ProcessAffinityMask & 0x1) break; - ProcessAffinityMask >>= 1; + if(first){ + for (i=0; i<(8 * sizeof(DWORD)); i++){ + if (ProcessAffinityMask & 0x1) break; + ProcessAffinityMask >>= 1; + } + OutTraceDW("First process affinity bit=%d\n", i); + ProcessAffinityMask = 0x1; + for (; i; i--) ProcessAffinityMask <<= 1; + OutTraceDW("Process affinity=%x\n", ProcessAffinityMask); + } + else { + for (i=0; i<(8 * sizeof(DWORD)); i++){ + if (ProcessAffinityMask & 0x80000000) break; + ProcessAffinityMask <<= 1; + } + i = 31 - i; + OutTraceDW("Last process affinity bit=%d\n", i); + ProcessAffinityMask = 0x1; + for (; i; i--) ProcessAffinityMask <<= 1; + OutTraceDW("Process affinity=%x\n", ProcessAffinityMask); } - OutTraceDW("First process affinity bit=%d\n", i); - ProcessAffinityMask &= 0x1; - for (; i; i--) ProcessAffinityMask <<= 1; - OutTraceDW("Process affinity=%x\n", ProcessAffinityMask); if (!SetProcessAffinityMask(GetCurrentProcess(), ProcessAffinityMask)) OutTraceE("SetProcessAffinityMask: ERROR err=%d\n", GetLastError()); } @@ -1293,6 +1308,8 @@ void HookInit(TARGETMAP *target, HWND hwnd) } if (dxw.dwFlags4 & LIMITSCREENRES) OutTrace("HookInit: max resolution=%s\n", (dxw.MaxScreenRes<6)?Resolutions[dxw.MaxScreenRes]:"unknown"); if (dxw.dwFlags7 & LIMITDDRAW) OutTrace("HookInit: max supported IDidrectDrawInterface=%d\n", dxw.MaxDdrawInterface); + if (dxw.dwFlags7 & CPUSLOWDOWN) OutTrace("HookInit: CPU slowdown ratio 1:%d\n", dxw.SlowRatio); + if (dxw.dwFlags7 & CPUMAXUSAGE) OutTrace("HookInit: CPU maxusage ratio 1:%d\n", dxw.SlowRatio); } { @@ -1368,7 +1385,8 @@ void HookInit(TARGETMAP *target, HWND hwnd) HookSysLibsInit(); // this just once... base=GetModuleHandle(NULL); - if (dxw.dwFlags3 & SINGLEPROCAFFINITY) SetSingleProcessAffinity(); + if (dxw.dwFlags3 & SINGLEPROCAFFINITY) SetSingleProcessAffinity(TRUE); + if (dxw.dwFlags5 & USELASTCORE) SetSingleProcessAffinity(FALSE); if (dxw.dwFlags4 & INTERCEPTRDTSC) AddVectoredExceptionHandler(1, Int3Handler); // 1 = first call, 0 = call last if (dxw.dwFlags1 & HANDLEEXCEPTIONS) HookExceptionHandler(); if (dxw.dwTFlags & OUTIMPORTTABLE) DumpImportTable(base); @@ -1438,6 +1456,13 @@ void HookInit(TARGETMAP *target, HWND hwnd) if (dxw.dwFlags4 & ENABLETIMEFREEZE) CreateThread(NULL, 0, TimeFreezePoller, NULL, 0, NULL); + + if(dxw.dwFlags7 & CPUSLOWDOWN) + CreateThread(NULL, 0, CpuSlow, NULL, 0, NULL); + else + if(dxw.dwFlags7 & CPUMAXUSAGE) + CreateThread(NULL, 0, CpuLimit, NULL, 0, NULL); + } LPCSTR ProcToString(LPCSTR proc) diff --git a/dll/dxwcore.cpp b/dll/dxwcore.cpp index 0bbaebb..6b0281c 100644 --- a/dll/dxwcore.cpp +++ b/dll/dxwcore.cpp @@ -133,6 +133,8 @@ void dxwCore::InitTarget(TARGETMAP *target) iRatioX = iSizX ? iSizX : 800; iRatioY = iSizY ? iSizY : 600; + SlowRatio = target->SlowRatio; + GDIEmulationMode = GDIMODE_NONE; // default if (dwFlags2 & GDISTRETCHED) GDIEmulationMode = GDIMODE_STRETCHED; if (dwFlags3 & GDIEMULATEDC) GDIEmulationMode = GDIMODE_EMULATED; diff --git a/dll/dxwcore.hpp b/dll/dxwcore.hpp index 8a67627..c40269c 100644 --- a/dll/dxwcore.hpp +++ b/dll/dxwcore.hpp @@ -173,6 +173,7 @@ public: // simple data variables short FakeVersionId; short Coordinates; short MaxScreenRes; + short SlowRatio; HDC RealHDC; HDC VirtualHDC; int GDIEmulationMode; diff --git a/dll/dxwnd.aps b/dll/dxwnd.aps index 7123e81..fe3472b 100644 Binary files a/dll/dxwnd.aps and b/dll/dxwnd.aps differ diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp index b03d957..a80ee03 100644 --- a/dll/dxwnd.cpp +++ b/dll/dxwnd.cpp @@ -27,7 +27,7 @@ along with this program. If not, see . #include "TlHelp32.h" -#define VERSION "2.03.67" +#define VERSION "2.03.68" #define DDTHREADLOCK 1 //#define LOCKTHREADS diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index 11bb5cd..128c266 100644 Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ diff --git a/dll/dxwnd.vs2008.vcproj b/dll/dxwnd.vs2008.vcproj index ecd20c2..0ba64fe 100644 --- a/dll/dxwnd.vs2008.vcproj +++ b/dll/dxwnd.vs2008.vcproj @@ -241,6 +241,10 @@ RelativePath=".\comdlg32.cpp" > + + diff --git a/exports.new/Betrayal in Antara.dxw b/exports.new/Betrayal in Antara.dxw new file mode 100644 index 0000000..3e69289 --- /dev/null +++ b/exports.new/Betrayal in Antara.dxw @@ -0,0 +1,29 @@ +[target] +title0=Betrayal in Antara +path0=D:\Games\Betrayal in Antara\ANTARAR.EXE +launchpath0= +module0= +opengllib0= +notes0= +registry0= +ver0=0 +coord0=0 +flag0=681574434 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=65536 +flagl0=0 +flagm0=0 +tflag0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 +maxddinterface0=7 diff --git a/exports.new/Blood 2 the Chosen.dxw b/exports.new/Blood 2 the Chosen.dxw new file mode 100644 index 0000000..a50f7bb --- /dev/null +++ b/exports.new/Blood 2 the Chosen.dxw @@ -0,0 +1,29 @@ +[target] +title0=Blood 2 the Chosen +path0=D:\Games\Blood2\CLIENT.EXE +launchpath0=D:\Games\Blood2\BLOOD2.EXE +module0= +opengllib0= +notes0= +registry0= +ver0=0 +coord0=0 +flag0=136315042 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=65536 +flagl0=0 +flagm0=0 +tflag0=0 +posx0=50 +posy0=50 +sizx0=1200 +sizy0=900 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 +maxddinterface0=7 diff --git a/exports.new/Bugs Bunny Lost In Time.dxw b/exports.new/Bugs Bunny Lost In Time.dxw new file mode 100644 index 0000000..ed93a8e --- /dev/null +++ b/exports.new/Bugs Bunny Lost In Time.dxw @@ -0,0 +1,29 @@ +[target] +title0=Bugs Bunny Lost In Time +path0=D:\Games\Bugs.Bunny.Lost.In.Time\bin\bugs.exe +launchpath0= +module0= +opengllib0= +notes0= +registry0= +ver0=7 +coord0=0 +flag0=681574434 +flagg0=1209139200 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=98304 +flagl0=0 +flagm0=0 +tflag0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 +maxddinterface0=7 diff --git a/exports.new/Gooka The Mystery of Janatris.dxw b/exports.new/Gooka The Mystery of Janatris.dxw new file mode 100644 index 0000000..793502e --- /dev/null +++ b/exports.new/Gooka The Mystery of Janatris.dxw @@ -0,0 +1,29 @@ +[target] +title0=Gooka The Mystery of Janatris +path0=D:\Games\Gooka The Mystery of Janatris\Gooka\gooka2.exe +launchpath0= +module0= +opengllib0= +notes0= +registry0= +ver0=0 +coord0=0 +flag0=136315394 +flagg0=1207959552 +flagh0=20 +flagi0=138412038 +flagj0=4224 +flagk0=268500992 +flagl0=8 +flagm0=0 +tflag0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 +maxddinterface0=7 diff --git a/exports.new/Microsoft Golf '98 trial.dxw b/exports.new/Microsoft Golf '98 trial.dxw new file mode 100644 index 0000000..01114d2 --- /dev/null +++ b/exports.new/Microsoft Golf '98 trial.dxw @@ -0,0 +1,29 @@ +[target] +title0=Microsoft Golf '98 trial (win) +path0=D:\Games\MSGolf98\MSGOLF98\GAME.EXE +launchpath0= +module0= +opengllib0= +notes0= +registry0=[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft]\n[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games]\n[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Golf '98]\n[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Golf '98\Version 1.0 Demo]\n"AppPath"="D:\\Games\\MSGolf98\\MSGOLF98"\n"InstallType"="1"\n"InstallPath"="D:\\Games\\MSGolf98\\MSGOLF98\\"\n"CDPath"="D:\\Games\\MSGolf98\\MSGOLF98"\n"Launched"="1"\n"PID"=""\n"Path"="D:\\Games\\MSGolf98\\MSGOLF98"\n"VersionType"="TrialVersion"\n"InstalledGroup"="1"\n"LangID"=dword:00000009\n +ver0=0 +coord0=0 +flag0=136314914 +flagg0=-671088640 +flagh0=1302 +flagi0=1212547076 +flagj0=4224 +flagk0=67436544 +flagl0=4 +flagm0=0 +tflag0=0 +posx0=50 +posy0=50 +sizx0=0 +sizy0=0 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 +maxddinterface0=7 diff --git a/exports.new/NHL 2002.dxw b/exports.new/NHL 2002.dxw new file mode 100644 index 0000000..c23311b --- /dev/null +++ b/exports.new/NHL 2002.dxw @@ -0,0 +1,30 @@ +[target] +title0=NHL 2002 +path0=D:\Games\NHL 2002\nhl2002.exe +launchpath0= +module0= +opengllib0= +notes0= +registry0= +ver0=7 +coord0=0 +flag0=681574499 +flagg0=1476395008 +flagh0=528 +flagi0=136314884 +flagj0=1073746048 +flagk0=327680 +flagl0=0 +flagm0=0 +tflag0=0 +dflag0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 +maxddinterface0=7 diff --git a/exports.new/No Respect (1.1).dxw b/exports.new/No Respect (1.1).dxw new file mode 100644 index 0000000..0872656 --- /dev/null +++ b/exports.new/No Respect (1.1).dxw @@ -0,0 +1,35 @@ +[target] +title0=No Respect (1.1) +path0=D:\Games\No Respect\nr11.exe +launchpath0= +module0= +opengllib0= +notes0= +registry0= +ver0=0 +coord0=0 +flag0=681574434 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=327680 +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 +swapeffect0=0 +flagl0=0 +flagm0=0 +maxddinterface0=7 diff --git a/exports.new/No Respect.dxw b/exports.new/No Respect.dxw new file mode 100644 index 0000000..8e276d2 --- /dev/null +++ b/exports.new/No Respect.dxw @@ -0,0 +1,32 @@ +[target] +title0=No Respect +path0=D:\Games\No Respect\NR.EXE +launchpath0= +module0= +opengllib0= +notes0= +registry0= +ver0=0 +coord0=0 +flag0=136314914 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=327680 +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 +swapeffect0=0 diff --git a/exports.new/Phantasmagoria 2.dxw b/exports.new/Phantasmagoria 2.dxw new file mode 100644 index 0000000..d0a3ab1 --- /dev/null +++ b/exports.new/Phantasmagoria 2.dxw @@ -0,0 +1,29 @@ +[target] +title0=Phantasmagoria 2 +path0=D:\Games\Phantasmagoria 2\SIERRAW.EXE +launchpath0= +module0= +opengllib0= +notes0= +registry0= +ver0=0 +coord0=0 +flag0=681574434 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=65536 +flagl0=0 +flagm0=0 +tflag0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 +maxddinterface0=7 diff --git a/exports.new/Silver.dxw b/exports.new/Silver.dxw new file mode 100644 index 0000000..62d92d5 --- /dev/null +++ b/exports.new/Silver.dxw @@ -0,0 +1,29 @@ +[target] +title0=Silver +path0=D:\Games\Silver\silver.exe +launchpath0= +module0= +opengllib0= +notes0= +registry0= +ver0=0 +coord0=0 +flag0=136314998 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=268500992 +flagl0=0 +flagm0=0 +tflag0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 +maxddinterface0=7 diff --git a/exports.new/The Hobbit(TM) Demo.dxw b/exports.new/The Hobbit(TM) Demo.dxw new file mode 100644 index 0000000..a624750 --- /dev/null +++ b/exports.new/The Hobbit(TM) Demo.dxw @@ -0,0 +1,30 @@ +[target] +title0=The Hobbit(TM) Demo +path0=D:\Games\The Hobbit(TM) Demo\MeridianDemo.exe +launchpath0= +module0= +opengllib0= +notes0= +registry0= +ver0=8 +coord0=0 +flag0=136315426 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=65536 +flagl0=0 +flagm0=0 +tflag0=0 +dflag0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 +maxddinterface0=7 diff --git a/exports.new/Urban Chaos.dxw b/exports.new/Urban Chaos.dxw new file mode 100644 index 0000000..e66ff26 --- /dev/null +++ b/exports.new/Urban Chaos.dxw @@ -0,0 +1,30 @@ +[target] +title0=Urban Chaos +path0=D:\Games\Urban Chaos\fallen.exe +launchpath0= +module0= +opengllib0= +notes0= +registry0= +ver0=0 +coord0=0 +flag0=136314914 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=65536 +flagl0=0 +flagm0=0 +tflag0=0 +dflag0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 +maxddinterface0=7 diff --git a/exports.new/Weird War.dxw b/exports.new/Weird War.dxw new file mode 100644 index 0000000..42b70b6 --- /dev/null +++ b/exports.new/Weird War.dxw @@ -0,0 +1,30 @@ +[target] +title0=Weird War +path0=D:\Games\Weird War\WeirdWar.exe +launchpath0= +module0= +opengllib0= +notes0= +registry0= +ver0=0 +coord0=0 +flag0=681574434 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=65536 +flagl0=0 +flagm0=0 +tflag0=0 +dflag0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 +maxddinterface0=7 diff --git a/host/TabCompat.cpp b/host/TabCompat.cpp index fc48d5a..8b82b27 100644 --- a/host/TabCompat.cpp +++ b/host/TabCompat.cpp @@ -30,6 +30,7 @@ void CTabCompat::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_FAKEVERSION, cTarget->m_FakeVersion); DDX_LBIndex(pDX, IDC_LISTFAKE, cTarget->m_FakeVersionId); DDX_Check(pDX, IDC_SINGLEPROCAFFINITY, cTarget->m_SingleProcAffinity); + DDX_Check(pDX, IDC_USELASTCORE, cTarget->m_UseLastCore); DDX_Check(pDX, IDC_HANDLEEXCEPTIONS, cTarget->m_HandleExceptions); DDX_Check(pDX, IDC_LIMITRESOURCES, cTarget->m_LimitResources); DDX_Check(pDX, IDC_SUPPRESSIME, cTarget->m_SuppressIME); diff --git a/host/TabTiming.cpp b/host/TabTiming.cpp index 1cac65b..ae6457d 100644 --- a/host/TabTiming.cpp +++ b/host/TabTiming.cpp @@ -37,10 +37,13 @@ void CTabTiming::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_INTERCEPTRDTSC, cTarget->m_InterceptRDTSC); DDX_Check(pDX, IDC_STRETCHTIMERS, cTarget->m_StretchTimers); DDX_Check(pDX, IDC_NORMALIZEPERFCOUNT, cTarget->m_NormalizePerfCount); + DDX_Check(pDX, IDC_CPUSLOWDOWN, cTarget->m_CPUSlowDown); + DDX_Check(pDX, IDC_CPUMAXUSAGE, cTarget->m_CPUMaxUsage); DDX_Check(pDX, IDC_QUARTERBLT, cTarget->m_QuarterBlt); DDX_Check(pDX, IDC_FINETIMING, cTarget->m_FineTiming); DDX_Check(pDX, IDC_TIMEFREEZE, cTarget->m_EnableTimeFreeze); DDX_Text(pDX, IDC_MAXFPS, cTarget->m_MaxFPS); + DDX_Text(pDX, IDC_SLOWRATIO, cTarget->m_SlowRatio); DDX_LBIndex(pDX, IDC_LISTTS, cTarget->m_InitTS); //{{AFX_DATA_MAP(CTabTiming) // NOTE: the ClassWizard will add DDX and DDV calls here diff --git a/host/TargetDlg.cpp b/host/TargetDlg.cpp index 5298550..341ca1e 100644 --- a/host/TargetDlg.cpp +++ b/host/TargetDlg.cpp @@ -23,6 +23,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/) //{{AFX_DATA_INIT(CTargetDlg) m_DXVersion = 0; m_MaxDdrawInterface = 6; + m_SlowRatio = 2; m_Coordinates = 0; m_DxEmulationMode = 3; // default: emulated m_DxFilterMode = 0; // default: ddraw filtering @@ -88,6 +89,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/) //m_ForceRGBtoYUV = FALSE; m_LimitScreenRes = FALSE; m_SingleProcAffinity = FALSE; + m_UseLastCore = FALSE; m_LimitResources = FALSE; m_CDROMDriveType = FALSE; m_HideCDROMEmpty = FALSE; @@ -195,6 +197,8 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/) m_TimeStretch = FALSE; m_StretchTimers = FALSE; m_NormalizePerfCount = FALSE; + m_CPUSlowDown = FALSE; + m_CPUMaxUsage = FALSE; m_QuarterBlt = FALSE; m_FineTiming = FALSE; m_EnableTimeFreeze = FALSE; diff --git a/host/TargetDlg.h b/host/TargetDlg.h index c4dc7ed..a1d532d 100644 --- a/host/TargetDlg.h +++ b/host/TargetDlg.h @@ -35,6 +35,7 @@ public: int m_TextureHandling; int m_SonProcessMode; int m_MaxDdrawInterface; + int m_SlowRatio; BOOL m_HookDI; BOOL m_HookDI8; BOOL m_EmulateRelMouse; @@ -151,6 +152,8 @@ public: BOOL m_TimeStretch; BOOL m_StretchTimers; BOOL m_NormalizePerfCount; + BOOL m_CPUSlowDown; + BOOL m_CPUMaxUsage; BOOL m_QuarterBlt; BOOL m_FineTiming; BOOL m_EnableTimeFreeze; @@ -227,6 +230,7 @@ public: BOOL m_LockSysColors; BOOL m_LockReservedPalette; BOOL m_SingleProcAffinity; + BOOL m_UseLastCore; BOOL m_WireFrame; BOOL m_NoTextures; BOOL m_BlackWhite; diff --git a/host/dxwndhost.aps b/host/dxwndhost.aps index 9b234c3..acbfb05 100644 Binary files a/host/dxwndhost.aps and b/host/dxwndhost.aps differ diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc index 3298d7b..e3ef612 100644 Binary files a/host/dxwndhost.rc and b/host/dxwndhost.rc differ diff --git a/host/dxwndhost.vs2008.suo b/host/dxwndhost.vs2008.suo index 85bafc1..4c80950 100644 Binary files a/host/dxwndhost.vs2008.suo and b/host/dxwndhost.vs2008.suo differ diff --git a/host/dxwndhostView.cpp b/host/dxwndhostView.cpp index e24ba47..d740058 100644 --- a/host/dxwndhostView.cpp +++ b/host/dxwndhostView.cpp @@ -184,6 +184,7 @@ void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) if(dlg->m_DXVersion > 1) dlg->m_DXVersion += 5; t->dxversion = dlg->m_DXVersion; t->MaxDdrawInterface = dlg->m_MaxDdrawInterface+1; + t->SlowRatio = dlg->m_SlowRatio; t->coordinates = dlg->m_Coordinates; t->flags = 0; t->flags2 = 0; @@ -348,6 +349,7 @@ void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) //if(dlg->m_ForceRGBtoYUV) t->flags3 |= RGB2YUV; if(dlg->m_LimitScreenRes) t->flags4 |= LIMITSCREENRES; if(dlg->m_SingleProcAffinity) t->flags3 |= SINGLEPROCAFFINITY; + if(dlg->m_UseLastCore) t->flags5 |= USELASTCORE; if(dlg->m_SaveLoad) t->flags |= SAVELOAD; if(dlg->m_SlowDown) t->flags |= SLOWDOWN; if(dlg->m_BlitFromBackBuffer) t->flags |= BLITFROMBACKBUFFER; @@ -413,6 +415,8 @@ void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) if(dlg->m_TimeStretch) t->flags2 |= TIMESTRETCH; if(dlg->m_StretchTimers) t->flags4 |= STRETCHTIMERS; if(dlg->m_NormalizePerfCount) t->flags5 |= NORMALIZEPERFCOUNT; + if(dlg->m_CPUSlowDown) t->flags7 |= CPUSLOWDOWN; + if(dlg->m_CPUMaxUsage) t->flags7 |= CPUMAXUSAGE; if(dlg->m_QuarterBlt) t->flags5 |= QUARTERBLT; if(dlg->m_FineTiming) t->flags4 |= FINETIMING; if(dlg->m_ReleaseMouse) t->flags4 |= RELEASEMOUSE; @@ -461,6 +465,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) { dlg->m_DXVersion = t->dxversion; dlg->m_MaxDdrawInterface = t->MaxDdrawInterface-1; + dlg->m_SlowRatio = t->SlowRatio; if(dlg->m_DXVersion > 6) dlg->m_DXVersion -= 5; dlg->m_Coordinates = t->coordinates; dlg->m_FilePath = t->path; @@ -584,6 +589,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) //dlg->m_ForceYUVtoRGB = t->flags3 & YUV2RGB ? 1 : 0; dlg->m_LimitScreenRes = t->flags4 & LIMITSCREENRES ? 1 : 0; dlg->m_SingleProcAffinity = t->flags3 & SINGLEPROCAFFINITY ? 1 : 0; + dlg->m_UseLastCore = t->flags5 & USELASTCORE ? 1 : 0; dlg->m_LimitResources = t->flags2 & LIMITRESOURCES ? 1 : 0; dlg->m_CDROMDriveType = t->flags3 & CDROMDRIVETYPE ? 1 : 0; dlg->m_HideCDROMEmpty = t->flags4 & HIDECDROMEMPTY ? 1 : 0; @@ -669,6 +675,8 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) dlg->m_TimeStretch = t->flags2 & TIMESTRETCH ? 1 : 0; dlg->m_StretchTimers = t->flags4 & STRETCHTIMERS ? 1 : 0; dlg->m_NormalizePerfCount = t->flags5 & NORMALIZEPERFCOUNT ? 1 : 0; + dlg->m_CPUSlowDown = t->flags7 & CPUSLOWDOWN ? 1 : 0; + dlg->m_CPUMaxUsage = t->flags7 & CPUMAXUSAGE ? 1 : 0; dlg->m_QuarterBlt = t->flags5 & QUARTERBLT ? 1 : 0; dlg->m_FineTiming = t->flags4 & FINETIMING ? 1 : 0; dlg->m_ReleaseMouse = t->flags4 & RELEASEMOUSE ? 1 : 0; @@ -802,6 +810,9 @@ static void SaveConfigItem(TARGETMAP *TargetMap, PRIVATEMAP *PrivateMap, int i, sprintf_s(key, sizeof(key), "maxddinterface%i", i); sprintf_s(val, sizeof(val), "%i", TargetMap->MaxDdrawInterface); WritePrivateProfileString("target", key, val, InitPath); + sprintf_s(key, sizeof(key), "slowratio%i", i); + sprintf_s(val, sizeof(val), "%i", TargetMap->SlowRatio); + WritePrivateProfileString("target", key, val, InitPath); free(EscBuf); EscBuf = NULL; @@ -873,6 +884,8 @@ static void ClearTarget(int i, char *InitPath) WritePrivateProfileString("target", key, 0, InitPath); sprintf_s(key, sizeof(key), "maxddinterface%i", i); WritePrivateProfileString("target", key, 0, InitPath); + sprintf_s(key, sizeof(key), "slowratio%i", i); + WritePrivateProfileString("target", key, 0, InitPath); } static int LoadConfigItem(TARGETMAP *TargetMap, PRIVATEMAP *PrivateMap, int i, char *InitPath) @@ -977,6 +990,9 @@ static int LoadConfigItem(TARGETMAP *TargetMap, PRIVATEMAP *PrivateMap, int i, c // ------- sprintf_s(key, sizeof(key), "maxddinterface%i", i); TargetMap->MaxDdrawInterface = GetPrivateProfileInt("target", key, 7, InitPath); + // ------- + sprintf_s(key, sizeof(key), "slowratio%i", i); + TargetMap->SlowRatio = GetPrivateProfileInt("target", key, 1, InitPath); if (!gbDebug){ // clear debug flags diff --git a/host/host.aps b/host/host.aps index 9093099..7892e20 100644 Binary files a/host/host.aps and b/host/host.aps differ diff --git a/host/resource b/host/resource index 5fdf578..2fc5707 100644 Binary files a/host/resource and b/host/resource differ diff --git a/proxy/d3d8.suo b/proxy/d3d8.suo index 38585e0..167a666 100644 Binary files a/proxy/d3d8.suo and b/proxy/d3d8.suo differ diff --git a/proxy/d3d9.suo b/proxy/d3d9.suo index 8acc9aa..1e5b66a 100644 Binary files a/proxy/d3d9.suo and b/proxy/d3d9.suo differ diff --git a/proxy/ddraw.suo b/proxy/ddraw.suo index 3c73a47..87b4925 100644 Binary files a/proxy/ddraw.suo and b/proxy/ddraw.suo differ