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

v2_03_12_src

Former-commit-id: 98030671cbaf07264e09d169f6ac315d17e1678e
This commit is contained in:
gho tik 2015-01-03 11:40:25 -05:00 committed by Refael ACkermann
parent 6966a0370e
commit 8050fe4ddb
41 changed files with 819 additions and 117 deletions

View File

@ -37,7 +37,7 @@
#define LOCKEDSURFACE 0x01000000 // emulates the buffer of the primary surface when locked and written directly
#define FIXPARENTWIN 0x02000000 // fixes parent window size & position
#define SWITCHVIDEOMEMORY 0x04000000 // when VIDEO memory is over, switches to SYSTEM memory
#define CLIENTREMAPPING 0x08000000 // hooks CLientToRect, RectToClient, GetClientRect, GetWinRect
#define CLIENTREMAPPING 0x08000000 // hooks ClientToRect, RectToClient, GetClientRect, GetWinRect
#define HANDLEALTF4 0x10000000 // forces quitting the program when receiving Alt-F4 key
#define LOCKWINPOS 0x20000000 // prevent the program to change its own windows properties
#define HOOKCHILDWIN 0x40000000 // hook CHILD windows to alter placement coordinates (UNUSED)
@ -264,6 +264,8 @@ void OutTrace(const char *, ...);
void OutTraceHex(BYTE *, int);
void *HookAPI(HMODULE, char *, void *, const char *, void *);
void AdjustWindowFrame(HWND, DWORD, DWORD);
char *hexdump(unsigned char *, int);
LRESULT CALLBACK extWindowProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK extChildWindowProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK extDialogWindowProc(HWND, UINT, WPARAM, LPARAM);

BIN
build/ICCVID.DLL Normal file

Binary file not shown.

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d53bda86269a959549e061c5b2c23e70b492dcb1b1e2b944063b193b49179d87
size 567296
oid sha256:5005c1da2c65a47e47378d41ed67cb908a2fd475ced015bddebe715c7f1d71d7
size 570368

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:be381f4fba85d8c7dcb13682c470713728dd133b38e6d4d1ed65fc6ceb74e771
size 536064
oid sha256:2e73542e5cc2b9a1fa1d6429230b756694eb361b63fe55b812cb1c31c118e938
size 538112

View File

@ -8,7 +8,7 @@ coord0=0
flag0=671096866
flagg0=1207959568
flagh0=20
flagi0=4
flagi0=4194308
tflag0=0
initx0=0
inity0=0
@ -22,3 +22,8 @@ sizx0=800
sizy0=600
maxfps0=0
initts0=0
launchpath0=
notes0=
flagj0=128
winver0=0
maxres0=0

View File

@ -0,0 +1,29 @@
[target]
title0=Actua Ice Hockey
path0=D:\Games\ahockey\HOCKEY.EXE
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=671088674
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=4224
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

@ -0,0 +1,29 @@
[target]
title0=Adrenix 3D
path0=D:\Games\Adrenix\AdrenixD.exe
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=134234150
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=4224
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

@ -0,0 +1,29 @@
[target]
title0=Daemonstar
path0=D:\Games\dmnstar\DS.EXE
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=134217762
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=4224
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

@ -18,10 +18,12 @@ maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=640
sizy0=480
sizx0=800
sizy0=600
maxfps0=0
initts0=0
launchpath0=
winver0=0
maxres0=0
notes0=
flagj0=129

View File

@ -0,0 +1,29 @@
[target]
title0=Divide, the
path0=D:\Games\divide\DIVIDE.EXE
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=134217762
flagg0=1212153856
flagh0=1044
flagi0=1212153860
flagj0=4224
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

@ -0,0 +1,29 @@
[target]
title0=Esoteria
path0=D:\Games\esoter3\ESOTERIA.EXE
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=134217762
flagg0=1207959552
flagh0=20
flagi0=134217732
flagj0=4224
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,10 +5,10 @@ module0=
opengllib0=
ver0=0
coord0=0
flag0=134234656
flag0=134234146
flagg0=1207959552
flagh0=67108884
flagi0=131076
flagi0=4325380
tflag0=0
initx0=0
inity0=0
@ -24,3 +24,6 @@ maxfps0=0
initts0=0
winver0=0
maxres0=-1
launchpath0=
notes0=
flagj0=128

View File

@ -0,0 +1,29 @@
[target]
title0=H.E.D.Z.
path0=D:\Games\HEDZ\HEDZ.EXE
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=681574434
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=134221952
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

@ -0,0 +1,29 @@
[target]
title0=Powerslide
path0=D:\Games\Powerslide\powerslide.exe
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=134217762
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=4224
tflag0=512
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

@ -6,9 +6,9 @@ opengllib0=
ver0=0
coord0=0
flag0=134217762
flagg0=136314880
flagg0=1207959552
flagh0=20
flagi0=0
flagi0=4194304
tflag0=64
initx0=0
inity0=0
@ -22,3 +22,8 @@ sizx0=800
sizy0=600
maxfps0=0
initts0=0
launchpath0=
notes0=
flagj0=128
winver0=0
maxres0=0

29
build/exports/Tenka.dxw Normal file
View File

@ -0,0 +1,29 @@
[target]
title0=Tenka
path0=D:\Games\tenka\tenka.exe
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=134217762
flagg0=1207959552
flagh0=20
flagi0=134217732
flagj0=4224
tflag0=512
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

@ -0,0 +1,29 @@
[target]
title0=Virtua Cop
path0=D:\Games\Virtua Cop\VCOP.EXE
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=134234150
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=4224
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

@ -8,7 +8,7 @@ coord0=0
flag0=134218400
flagg0=1207959552
flagh0=20
flagi0=4
flagi0=4194308
tflag0=0
initx0=0
inity0=0
@ -24,3 +24,6 @@ maxfps0=0
initts0=0
winver0=0
maxres0=0
launchpath0=
notes0=
flagj0=128

29
build/exports/Worms 2.dxw Normal file
View File

@ -0,0 +1,29 @@
[target]
title0=Worms 2
path0=D:\Games\worms2\worms2.exe
launchpath0=
module0=
opengllib0=
notes0=Working pretty well on TWILIGHT game rip.\nUntested on CD version.\nIt shows problems with the background: \nin emulated mode the colors are limited, in GDI mode it's all black.\n
ver0=0
coord0=0
flag0=134234146
flagg0=1207959552
flagh0=20
flagi0=138412038
flagj0=5248
tflag0=536870912
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

5
build/exports/dxwnd.ini Normal file
View File

@ -0,0 +1,5 @@
[window]
posx=1292
posy=131
sizx=320
sizy=787

View File

@ -740,4 +740,15 @@ fix: GDI mode bug, crashing when blitting from NULL surface (to do a color fill
v2.03.11
fix: added DDSCAPS_FLIP capability to emulated backbuffer surface. Fixes "Injection" missing flips
fix: added high order bit set to kernel32.dll GetVersion() wrapper in case of Win95/98 emulation. Fixes "Warhead" frontend program
fix: coordinates returned by user32.dll GetClipCursor() must be scaled accordingly with virtual desktop size. Fixes "SubCulture" mouse control problems
fix: coordinates returned by user32.dll GetClipCursor() must be scaled accordingly with virtual desktop size. Fixes "SubCulture" mouse control problems
v2.03.12
fix: several issues in fake registry hooks
add: continue char '\' in fake registry configuration for hex values
add: GetClipList ddraw hooker: fixes "Full Pipe" blitting coordinates
fix: proper handling of palette reserved entries
fix: dinput GetDeviceData
add: implemented "Release mouse outside window" functionality in dinput calls
fix: now "Release mouse outside window" leaves the mouse close to where it left the window
fix: in GUI, keeps memory of last used paths
fix: several log messages

3
build/redist/dplay.dll Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8194ca60e6eda8f5c3fe67990bb38f7d3e68e9beba9d6adf5c68fab9478b94f5
size 57344

View File

@ -0,0 +1,20 @@
[HKEY_LOCAL_MACHINE\SOFTWARE]
[HKEY_LOCAL_MACHINE\SOFTWARE\Viacom New Media]
[HKEY_LOCAL_MACHINE\SOFTWARE\Viacom New Media\The Divide]
[HKEY_LOCAL_MACHINE\SOFTWARE\Viacom New Media\The Divide\1.0]
"Display Name"="\"The Divide\""
"InstallDir"="."
"InstallSrc"="."
"CDROM"=".:"
"ProgramDir"="."
"LevelsDir"=".\\Levels\\"
"MoviesDir"=".\\Movies\\"
"SoundsDir"=".\\pc\\"
[HKEY_CURRENT_USER\SOFTWARE\Viacom New Media\The Divide\Config]
"Game Settings"=hex:20,03,00,00,58,02,00,00,20,03,00,00,58,02,00,00\
00,00,00,00,00,00,00,00,01,00,00,00,00,00,00,00,01,00,00,00,00\
00,00,00,00,00,00,00,00,00,00,00,01,00,00,00,00,00,00,00,00,00\
00,00,01,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

View File

@ -0,0 +1,9 @@
[HKEY_LOCAL_MACHINE\SOFTWARE]
; the Industry Giant
[HKEY_LOCAL_MACHINE\SOFTWARE\JoWooD]
[HKEY_LOCAL_MACHINE\SOFTWARE\JoWooD\The IndustryGiant]
"InstallPath"="."

View File

@ -197,12 +197,13 @@ LONG WINAPI extRegQueryValueEx(
}
// try emulated registry
res = ERROR_FILE_NOT_FOUND;
FILE *regf;
char RegBuf[MAX_PATH+1];
char *pData;
HKEY hCurKey=HKEY_FAKE+1;
regf=OpenFakeRegistry();
if(regf==NULL) return ERROR_FILE_NOT_FOUND;
if(regf==NULL) return res;
if(!lpValueName)lpValueName="";
fgets(RegBuf, 256, regf);
while (!feof(regf)){
@ -211,70 +212,79 @@ LONG WINAPI extRegQueryValueEx(
}
else {
if(hCurKey==hKey){
//OutTrace("loop: \"%s\"\n", RegBuf);
if((RegBuf[0]=='"') &&
!_strnicmp(lpValueName, &RegBuf[1], strlen(lpValueName)) &&
(RegBuf[strlen(lpValueName)+1]=='"') &&
(RegBuf[strlen(lpValueName)+2]=='='))
{
LPBYTE lpb;
res=ERROR_FILE_NOT_FOUND;
pData=&RegBuf[strlen(lpValueName)+3];
lpb = lpData;
if(*pData=='"'){ // string value
if(lpType) *lpType=REG_SZ;
if(lpData){
LPBYTE lpb;
lpb = lpData;
*lpcbData=0;
pData++;
while(*pData && (*pData != '"')){
if(*pData=='\\') pData++;
*lpb++=*pData++;
*lpcbData++;
if(lpcbData) *lpcbData++;
}
*lpb = 0; // string terminator
}
if(lpType) *lpType=REG_SZ;
//
OutTraceR("RegQueryValueEx: Data=\"%s\" type=REG_SZ\n", lpData);
OutTraceR("RegQueryValueEx: type=REG_SZ Data=\"%s\"\n", lpData ? (char *)lpData : "(NULL)");
res=ERROR_SUCCESS;
break;
}
if(!strncmp(pData,"dword:",strlen("dword:"))){ //dword value
DWORD val;
if(lpType) *lpType=REG_DWORD;
pData+=strlen("dword:");
sscanf(pData, "%x", &val);
if(lpData) memcpy(lpData, &val, sizeof(DWORD));
if(lpType) *lpType=REG_DWORD;
*lpcbData=sizeof(DWORD);
OutTraceR("RegQueryValueEx: Data=0x%x type=REG_DWORD\n", val);
if(lpcbData) *lpcbData=sizeof(DWORD);
OutTraceR("RegQueryValueEx: type=REG_DWORD Data=0x%x\n", val);
res=ERROR_SUCCESS;
break;
}
if(!strncmp(pData,"hex:",strlen("hex:"))){ //dword value
pData+=strlen("hex:");
pData[strlen(pData)-1]=0; // eliminates \n
if(!strncmp(pData,"hex:",strlen("hex:"))){ //hex value
BYTE *p;
if(lpType) *lpType=REG_BINARY;
OutTraceDW("RegQueryValueEx: Data=");
if(lpData){
*lpcbData=0;
while(strlen(pData)>1){
sscanf(pData, "%x,", (char *)lpData);
OutTraceDW("%02.2x,", *(unsigned char *)lpData);
pData+=3;
lpData++;
(*lpcbData)++;
p = (BYTE *)pData;
p+=strlen("hex:");
if(lpcbData) *lpcbData=0;
while(TRUE){
p[strlen((char *)p)-1]=0; // eliminates \n
if(lpData){
while(strlen((char *)p)>1){
sscanf((char *)p, "%x,", (char *)lpb);
p+=3;
lpb++;
if(lpcbData) (*lpcbData)++;
}
if(p[strlen((char *)p)-1]=='\\'){
fgets(RegBuf, 256, regf);
pData = RegBuf;
p = (BYTE *)pData;
}
else break;
}
}
OutTraceR(" type=REG_BINARY cbData=%d\n", *lpcbData);
OutTraceR("RegQueryValueEx: type=REG_BINARY cbData=%d Data=%s\n",
lpcbData ? *lpcbData : 0,
lpData ? "(NULL)" : hexdump(lpData, *lpcbData));
res=ERROR_SUCCESS;
break;
}
fclose(regf);
return res;
}
}
}
fgets(RegBuf, 256, regf);
}
fclose(regf);
return ERROR_FILE_NOT_FOUND;
OutTraceR("RegQueryValueEx: res=%x\n", res);
return res;
}
LONG WINAPI extRegCloseKey(HKEY hKey)
@ -287,18 +297,13 @@ LONG WINAPI extRegCloseKey(HKEY hKey)
LONG WINAPI extRegSetValueEx(HKEY hKey, LPCTSTR lpValueName, DWORD Reserved, DWORD dwType, const BYTE *lpData, DWORD cbData)
{
if (IsTraceR){
OutTrace("RegSetValueEx: hKey=%x ValueName=\"%s\" Type=%x(%s) cbData=%d ", hKey, lpValueName, dwType, ExplainRegType(dwType), cbData);
char sInfo[1024];
sprintf(sInfo, "RegSetValueEx: hKey=%x ValueName=\"%s\" Type=%x(%s) cbData=%d", hKey, lpValueName, dwType, ExplainRegType(dwType), cbData);
switch(dwType){
case REG_DWORD: OutTrace("Data=%x\n", *(DWORD *)lpData); break;
case REG_NONE: OutTrace("Data=\"%s\"\n", lpData); break;
case REG_BINARY: {
DWORD i;
OutTrace("Data=%02.2X,", *lpData);
for(i=1; i<cbData; i++) OutTrace("%02.2X", lpData[i]);
OutTrace("\n");
};
break;
default: OutTrace("\n");
case REG_DWORD: OutTrace("%s Data=%x\n", sInfo, *(DWORD *)lpData); break;
case REG_NONE: OutTrace("%s Data=\"%s\"\n", sInfo, lpData); break;
case REG_BINARY: OutTrace("%s Data=%s\n", sInfo, hexdump((BYTE *)lpData, cbData)); break;
default: OutTrace("%s\n", sInfo);
}
}
if(IsFake(hKey) && (dxw.dwFlags3 & EMULATEREGISTRY)) {
@ -314,6 +319,8 @@ LONG WINAPI extRegCreateKeyEx(HKEY hKey, LPCTSTR lpSubKey, DWORD Reserved, LPTST
OutTraceR("RegCreateKeyEx: hKey=%x(%s) SubKey=\"%s\" Class=%x\n", hKey, hKey2String(hKey), lpSubKey, lpClass);
if (dxw.dwFlags3 & EMULATEREGISTRY){
*phkResult = HKEY_FAKE;
// V2.3.12: return existing fake key if any ....
if(dxw.dwFlags4 & OVERRIDEREGISTRY) myRegOpenKeyEx(hKey, lpSubKey, phkResult);
if(lpdwDisposition) *lpdwDisposition=REG_OPENED_EXISTING_KEY;
return ERROR_SUCCESS;
}
@ -327,6 +334,8 @@ LONG WINAPI extRegCreateKey(HKEY hKey, LPCTSTR lpSubKey, PHKEY phkResult)
OutTraceR("RegCreateKey: hKey=%x(%s) SubKey=\"%s\"\n", hKey, hKey2String(hKey), lpSubKey);
if (dxw.dwFlags3 & EMULATEREGISTRY){
*phkResult = HKEY_FAKE;
// V2.3.12: return existing fake key if any ....
if(dxw.dwFlags4 & OVERRIDEREGISTRY) myRegOpenKeyEx(hKey, lpSubKey, phkResult);
return ERROR_SUCCESS;
}
else

View File

@ -1035,12 +1035,35 @@ HRESULT WINAPI extAddRefCProxy(LPDIRECTDRAWCLIPPER lpddClip)
HRESULT WINAPI extGetClipListProxy(LPDIRECTDRAWCLIPPER lpddClip, LPRECT lpRect, LPRGNDATA lpRgnData, LPDWORD lpw)
{
HRESULT res;
OutTraceP("GetClipList(C): PROXED lpddClip=%x ", lpddClip);
if (lpRect) OutTraceP("rect=(%d,%d)-(%d,%d) ", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
else OutTraceP("rect=(NULL) ");
if(IsTraceP){
char sInfo[81];
if (lpRect) sprintf(sInfo, "rect=(%d,%d)-(%d,%d) ", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
else sprintf(sInfo, "rect=(NULL) ");
OutTrace("GetClipList(C): PROXED lpddClip=%x %s\n", lpddClip, sInfo);
}
res=(*pGetClipList)(lpddClip, lpRect, lpRgnData, lpw);
if(res) OutTraceP("GeGetClipListtHWnd(C): ERROR err=%x(%s)\n", res, ExplainDDError(res));
else OutTraceP("GetClipList(C): w=%x\n", *lpw);
if(IsTraceP){
//char *sInfo[1024];
if(res) OutTrace("GetClipList(C): ERROR err=%x(%s)\n", res, ExplainDDError(res));
else{
if(lpRgnData){
OutTrace("GetClipList(C): w=%x rgndataheader{size=%d type=%x count=%d RgnSize=%d bound=(%d,%d)-(%d,%d)}\n",
*lpw, lpRgnData->rdh.dwSize, lpRgnData->rdh.iType, lpRgnData->rdh.nCount, lpRgnData->rdh.nRgnSize,
lpRgnData->rdh.rcBound.left, lpRgnData->rdh.rcBound.top, lpRgnData->rdh.rcBound.right, lpRgnData->rdh.rcBound.bottom);
if(IsDebug){
RECT *rgns;
rgns = (RECT *)lpRgnData->Buffer;
for(DWORD i=0; i<lpRgnData->rdh.nCount; i++){
OutTrace("GetClipList(C): rect[%d]=(%d,%d)-(%d,%d)\n",
i, rgns[i].left, rgns[i].top, rgns[i].right, rgns[i].bottom);
}
}
}
else{
OutTrace("GetClipList(C): w=%x\n", *lpw);
}
}
}
return res;
}

View File

@ -104,6 +104,7 @@ HRESULT WINAPI extSetSurfaceDesc(LPDIRECTDRAWSURFACE, LPDDSURFACEDESC, DWORD);
// DirectDrawClipper
HRESULT WINAPI extReleaseC(LPDIRECTDRAWCLIPPER);
HRESULT WINAPI extGetClipList(LPDIRECTDRAWCLIPPER, LPRECT, LPRGNDATA, LPDWORD);
// DirectDrawPalette
HRESULT WINAPI extReleaseP(LPDIRECTDRAWPALETTE);
@ -495,14 +496,41 @@ void DescribeSurface(LPDIRECTDRAWSURFACE lpdds, int dxversion, char *label, int
BOOL isPaletteUpdated;
void mySetPalette(int dwstart, int dwcount, LPPALETTEENTRY lpentries)
void mySetPalette(int dwstart, int dwcount, LPPALETTEENTRY lpentries, BOOL Has256ColorsPalette)
{
int i;
extern DXWNDSTATUS *pStatus;
// copy the palette entries on the current system palette
for(int idx=0; idx<dwcount; idx++)
pStatus->Palette[dwstart+idx]= lpentries[idx];
// if has reserved palette entries, recover them
if(!Has256ColorsPalette){
int nStatCols, nPalEntries;
PALETTEENTRY SysPalEntry[256];
LPPALETTEENTRY lpEntry;
extern GetSystemPaletteEntries_Type pGDIGetSystemPaletteEntries;
extern GetDeviceCaps_Type pGDIGetDeviceCaps;
// The number of static colours should be 20, but inquire it anyway
nStatCols = (*pGDIGetDeviceCaps)(GetDC(0), NUMRESERVED);
// fix the first nStatCols/2 and the last nStatCols/2 entries
nPalEntries=(*pGDIGetSystemPaletteEntries)(GetDC(0), 0, 256, SysPalEntry);
for (i = 0; i < 256; i++){
// skip intermediate un-reserved palette entries
if(i==(nStatCols / 2)) i=256 - (nStatCols / 2);
lpEntry = &lpentries[i];
if(lpEntry->peFlags==0){
lpEntry->peRed = SysPalEntry[i].peRed;
lpEntry->peGreen = SysPalEntry[i].peGreen;
lpEntry->peBlue = SysPalEntry[i].peBlue;
}
}
}
for(i = 0; i < dwcount; i ++){
PALETTEENTRY PalColor;
PalColor = lpentries[i];
@ -1087,6 +1115,8 @@ static void HookDDClipper(LPDIRECTDRAWCLIPPER FAR* lplpDDClipper)
// IDirectDrawClipper::Release
SetHook((void *)(**(DWORD **)lplpDDClipper + 8), extReleaseC, (void **)&pReleaseC, "Release(C)");
// IDirectDrawClipper::GetClipList
SetHook((void *)(**(DWORD **)lplpDDClipper + 12), extGetClipList, (void **)&pGetClipList, "GetClipList(C)");
if (!(dxw.dwTFlags & OUTPROXYTRACE)) return;
// Just proxed ...
@ -1095,8 +1125,6 @@ static void HookDDClipper(LPDIRECTDRAWCLIPPER FAR* lplpDDClipper)
SetHook((void *)(**(DWORD **)lplpDDClipper), extQueryInterfaceCProxy, (void **)&pQueryInterfaceC, "QueryInterface(C)");
// IDirectDrawClipper::AddRef
SetHook((void *)(**(DWORD **)lplpDDClipper + 4), extAddRefCProxy, (void **)&pAddRefC, "AddRef(C)");
// IDirectDrawClipper::GetClipList
SetHook((void *)(**(DWORD **)lplpDDClipper + 12), extGetClipListProxy, (void **)&pGetClipList, "GetClipList(C)");
// IDirectDrawClipper::GetHWnd
SetHook((void *)(**(DWORD **)lplpDDClipper + 16), extGetHWndProxy, (void **)&pGetHWnd, "GetHWnd(C)");
// IDirectDrawClipper::Initialize
@ -3385,6 +3413,8 @@ HRESULT WINAPI extWaitForVerticalBlank(LPDIRECTDRAW lpdd, DWORD dwflags, HANDLE
#define DDPCAPS_INITIALIZE_LEGACY 0x00000008l
BOOL Has256ColorsPalette = FALSE;
HRESULT WINAPI extCreatePalette(LPDIRECTDRAW lpdd, DWORD dwflags, LPPALETTEENTRY lpddpa,
LPDIRECTDRAWPALETTE *lplpddp, IUnknown *pu)
{
@ -3394,6 +3424,7 @@ HRESULT WINAPI extCreatePalette(LPDIRECTDRAW lpdd, DWORD dwflags, LPPALETTEENTRY
if(IsDebug && (dwflags & DDPCAPS_8BIT)) dxw.DumpPalette(256, lpddpa);
//if (dwflags & ~(DDPCAPS_PRIMARYSURFACE|DDPCAPS_8BIT|DDPCAPS_ALLOW256|DDPCAPS_INITIALIZE_LEGACY)) STOPPER("Palette flags");
if(dwflags & DDPCAPS_ALLOW256) Has256ColorsPalette = TRUE;
if(dxw.dwFlags1 & EMULATESURFACE) dwflags &= ~DDPCAPS_PRIMARYSURFACE;
res = (*pCreatePalette)(lpdd, dwflags, lpddpa, lplpddp, pu);
@ -3454,7 +3485,7 @@ HRESULT WINAPI extSetPalette(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWPALETTE lpdd
lpentries = (LPPALETTEENTRY)PaletteEntries;
res2=lpddp->GetEntries(0, 0, 256, lpentries);
if(res2) OutTraceE("SetPalette: GetEntries ERROR res=%x(%s)\n", res2, ExplainDDError(res2));
mySetPalette(0, 256, lpentries); // v2.02.76: necessary for "Requiem Avenging Angel" in SURFACEEMULATION mode
mySetPalette(0, 256, lpentries, Has256ColorsPalette); // v2.02.76: necessary for "Requiem Avenging Angel" in SURFACEEMULATION mode
}
// Apply palette to backbuffer surface. This is necessary on some games: "Duckman private dick", "Total Soccer 2000", ...
if (lpDDSBack){
@ -3490,7 +3521,8 @@ HRESULT WINAPI extSetEntries(LPDIRECTDRAWPALETTE lpddp, DWORD dwflags, DWORD dws
OutTraceDW("SetEntries: ASSERT start+count > 256\n");
}
mySetPalette(dwstart, dwcount, lpentries);
if(dwflags & DDPCAPS_ALLOW256) Has256ColorsPalette=TRUE;
mySetPalette(dwstart, dwcount, lpentries, Has256ColorsPalette);
// GHO: needed for fixed rect and variable palette animations,
// e.g. dungeon keeper loading screen, Warcraft II splash, ...
@ -4024,7 +4056,7 @@ HRESULT WINAPI extEnumDisplayModes(EnumDisplayModes1_Type pEnumDisplayModes, LPD
EmuDesc.ddpfPixelFormat.dwRGBBitCount=SupportedDepths[DepthIdx];
EmuDesc.lPitch=SupportedRes[ResIdx].w * SupportedDepths[DepthIdx] / 8;
FixPixelFormat(EmuDesc.ddpfPixelFormat.dwRGBBitCount, &(EmuDesc.ddpfPixelFormat));
EnumModesCallbackDumper((LPDDSURFACEDESC)&EmuDesc, lpContext);
if(IsDebug) EnumModesCallbackDumper((LPDDSURFACEDESC)&EmuDesc, lpContext);
res=(*cb)((LPDDSURFACEDESC)&EmuDesc, lpContext);
if(res==DDENUMRET_CANCEL) break;
}
@ -4464,6 +4496,59 @@ HRESULT WINAPI extReleaseC(LPDIRECTDRAWCLIPPER lpddClip)
return ref;
}
HRESULT WINAPI extGetClipList(LPDIRECTDRAWCLIPPER lpddClip, LPRECT lpRect, LPRGNDATA lpRgnData, LPDWORD lpw)
{
HRESULT res;
// returned clip region (both RgnData and single RECT array) should be relocated in window mode
// an easy way to do that, though not accurate, is to consider the clip region as the whole virtual screen
// a better way is to use the dxw.UnmapWindow(RECT *) method
// this makes "Full Pipe" working without clipping problems.
if(IsTraceDDRAW){
char sInfo[81];
if (lpRect) sprintf(sInfo, "rect=(%d,%d)-(%d,%d) ", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
else sprintf(sInfo, "rect=(NULL) ");
OutTrace("GetClipList(C): lpddClip=%x %s\n", lpddClip, sInfo);
}
res=(*pGetClipList)(lpddClip, lpRect, lpRgnData, lpw);
if(IsTraceDDRAW){
if(res) OutTrace("GetClipList(C): ERROR err=%x(%s)\n", res, ExplainDDError(res));
else{
if(lpRgnData){
OutTrace("GetClipList(C): w=%x rgndataheader{size=%d type=%x count=%d RgnSize=%d bound=(%d,%d)-(%d,%d)}\n",
*lpw, lpRgnData->rdh.dwSize, lpRgnData->rdh.iType, lpRgnData->rdh.nCount, lpRgnData->rdh.nRgnSize,
lpRgnData->rdh.rcBound.left, lpRgnData->rdh.rcBound.top, lpRgnData->rdh.rcBound.right, lpRgnData->rdh.rcBound.bottom);
if(dxw.Windowize && (dxw.dwFlags1 & CLIENTREMAPPING)){
dxw.UnmapWindow(&lpRgnData->rdh.rcBound);
//lpRgnData->rdh.rcBound = dxw.GetScreenRect();
OutTraceDW("GetClipList(C): w=%x rgndataheader{size=%d type=%x count=%d RgnSize=%d REMAPPED bound=(%d,%d)-(%d,%d)}\n",
*lpw, lpRgnData->rdh.dwSize, lpRgnData->rdh.iType, lpRgnData->rdh.nCount, lpRgnData->rdh.nRgnSize,
lpRgnData->rdh.rcBound.left, lpRgnData->rdh.rcBound.top, lpRgnData->rdh.rcBound.right, lpRgnData->rdh.rcBound.bottom);
}
if(IsDebug){
RECT *rgns;
rgns = (RECT *)lpRgnData->Buffer;
for(DWORD i=0; i<lpRgnData->rdh.nCount; i++){
OutTrace("GetClipList(C): rect[%d]=(%d,%d)-(%d,%d)\n",
i, rgns[i].left, rgns[i].top, rgns[i].right, rgns[i].bottom);
if(dxw.Windowize && (dxw.dwFlags1 & CLIENTREMAPPING)){
dxw.UnmapWindow(&rgns[i]);
//rgns[i] = dxw.GetScreenRect();
OutTrace("GetClipList(C): REMAPPED rect[%d]=(%d,%d)-(%d,%d)\n",
i, rgns[i].left, rgns[i].top, rgns[i].right, rgns[i].bottom);
}
}
}
}
else{
OutTrace("GetClipList(C): w=%x\n", *lpw);
}
}
}
return res;
}
HRESULT WINAPI extGetSurfaceDesc(GetSurfaceDesc_Type pGetSurfaceDesc, LPDIRECTDRAWSURFACE lpdds, LPDDSURFACEDESC lpddsd)
{
HRESULT res;

View File

@ -235,6 +235,25 @@ HRESULT WINAPI extDICreateDeviceEx(LPDIRECTINPUT lpdi, REFGUID rguid,
return 0;
}
/* from MSDN:
cbObjectData
Size of the DIDEVICEOBJECTDATA structure, in bytes.
rgdod
Array of DIDEVICEOBJECTDATA structures to receive the buffered data.
The number of elements in this array must be equal to the value of the pdwInOut parameter.
If this parameter is NULL, the buffered data is not stored anywhere, but all other side effects take place.
pdwInOut
On entry, the number of elements in the array pointed to by the rgdod parameter.
On exit, the number of elements actually obtained.
dwFlags
Flags that control the manner in which data is obtained.
This value can be 0 or the following flag.
DIGDD_PEEK
Do not remove the items from the buffer. A subsequent IDirectInputDevice8::GetDeviceData call will read the same data.
Normally, data is removed from the buffer after it is read.
*/
HRESULT WINAPI extGetDeviceData(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPVOID rgdod, LPDWORD pdwinout, DWORD dwflags)
{
HRESULT res;
@ -242,39 +261,56 @@ HRESULT WINAPI extGetDeviceData(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPVOID
unsigned int i;
POINT p;
OutTraceDW("GetDeviceData(I): cbdata=%i\n", cbdata);
OutTraceDW("GetDeviceData(I): did=%x cbdata=%i rgdod=%x, inout=%d flags=%x\n",
lpdid, cbdata, rgdod, *pdwinout, dwflags);
res = (*pGetDeviceData)(lpdid, cbdata, rgdod, pdwinout, dwflags);
if(res) return res;
if(res) {
OutTraceE("GetDeviceData(I) ERROR: err=%x(%s)\n", res, ExplainDDError(res));
return res;
}
if(!dxw.bActive) {
*pdwinout = 0;
return DI_OK;
}
if(dxw.dwFlags4 & RELEASEMOUSE){
POINT curr;
RECT client;
extern GetCursorPos_Type pGetCursorPos;
extern GetClientRect_Type pGetClientRect;
extern ScreenToClient_Type pScreenToClient;
(*pGetCursorPos)(&curr);
(*pScreenToClient)(dxw.GethWnd(), &curr);
(*pGetClientRect)(dxw.GethWnd(), &client);
if ((curr.x < client.left) || (curr.y < client.top) || (curr.x > client.right) || (curr.y > client.bottom)){
*pdwinout = 0;
return DI_OK;
}
}
if(!dxw.bActive) *pdwinout = 0;
GetMousePosition((int *)&p.x, (int *)&p.y);
if(cbdata == 20 || cbdata == 24 || cbdata == 16){
tmp = (BYTE *)rgdod;
for(i = 0; i < *pdwinout; i ++){
if(((LPDIDEVICEOBJECTDATA)tmp)->dwOfs == DIMOFS_X){
((LPDIDEVICEOBJECTDATA)tmp)->dwData = p.x;
if(!dxw.bDInputAbs){
if(p.x < iCurMinX) p.x = iCurMinX;
if(p.x > iCurMaxX) p.x = iCurMaxX;
((LPDIDEVICEOBJECTDATA)tmp)->dwData = p.x - iCursorXBuf;
iCursorXBuf = p.x;
}
if(dxw.bDInputAbs){
GetMousePosition((int *)&p.x, (int *)&p.y);
for(i = 0; i < *pdwinout; i ++){
if(((LPDIDEVICEOBJECTDATA)tmp)->dwOfs == DIMOFS_X)((LPDIDEVICEOBJECTDATA)tmp)->dwData = p.x;
if(((LPDIDEVICEOBJECTDATA)tmp)->dwOfs == DIMOFS_Y)((LPDIDEVICEOBJECTDATA)tmp)->dwData = p.y;
tmp += cbdata;
}
OutTraceB("GetDeviceData(I): ABS mousedata=(%d,%d)\n", p.x, p.y);
}
else{
for(i = 0; i < *pdwinout; i ++){
if(((LPDIDEVICEOBJECTDATA)tmp)->dwOfs == DIMOFS_X) OutTraceB("GetDeviceData(I): REL mousedata X=%d\n", ((LPDIDEVICEOBJECTDATA)tmp)->dwData);
if(((LPDIDEVICEOBJECTDATA)tmp)->dwOfs == DIMOFS_Y) OutTraceB("GetDeviceData(I): REL mousedata Y=%d\n", ((LPDIDEVICEOBJECTDATA)tmp)->dwData);
tmp += cbdata;
}
if(((LPDIDEVICEOBJECTDATA)tmp)->dwOfs == DIMOFS_Y){
((LPDIDEVICEOBJECTDATA)tmp)->dwData = p.y;
if(!dxw.bDInputAbs){
if(p.y < iCurMinY) p.y = iCurMinY;
if(p.y > iCurMaxY) p.y = iCurMaxY;
((LPDIDEVICEOBJECTDATA)tmp)->dwData = p.y - iCursorYBuf;
iCursorYBuf = p.y;
}
}
tmp += cbdata;
}
OutTraceDW("DEBUG: directinput mousedata=(%d,%d)\n", p.x, p.y);
}
return 0;
return DI_OK;
}
HRESULT WINAPI extGetDeviceState(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPDIMOUSESTATE lpvdata)
@ -314,7 +350,7 @@ HRESULT WINAPI extGetDeviceState(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPDIMO
}
if(cbdata == 256 && !dxw.bActive) ZeroMemory(lpvdata, 256);
return 0;
return DI_OK;
}
//static char *dftype(LPCDIDATAFORMAT lpdf)
@ -356,11 +392,21 @@ static char *didftype(DWORD c)
else eb[0]=0;
return(eb);
}
static char *ExplainDataFormatFlags(DWORD f)
{
char *s;
s="unknown";
switch(f){
case DIDF_ABSAXIS: s="DIDF_ABSAXIS";
case DIDF_RELAXIS: s="DIDF_RELAXIS";
}
return s;
}
HRESULT WINAPI extSetDataFormat(LPDIRECTINPUTDEVICE lpdid, LPCDIDATAFORMAT lpdf)
{
OutTraceDW("SetDataFormat(I): did=%x lpdf=%x size=%d objsize=%d flags=0x%x datasize=%d numobjects=%d\n",
lpdid, lpdf, lpdf->dwSize, lpdf->dwObjSize, lpdf->dwFlags, lpdf->dwDataSize, lpdf->dwNumObjs);
OutTraceDW("SetDataFormat(I): did=%x lpdf=%x size=%d objsize=%d flags=0x%x(%s) datasize=%d numobjects=%d\n",
lpdid, lpdf, lpdf->dwSize, lpdf->dwObjSize, lpdf->dwFlags, ExplainDataFormatFlags(lpdf->dwFlags), lpdf->dwDataSize, lpdf->dwNumObjs);
if(IsDebug){
DIOBJECTDATAFORMAT *df;
df = lpdf->rgodf;
@ -396,7 +442,7 @@ HRESULT WINAPI extDISetCooperativeLevel(LPDIRECTINPUTDEVICE lpdid, HWND hwnd, DW
void GetMousePosition(int *x, int *y)
{
POINT p;
//GetCursorPos(&p);
extern BOOL WINAPI extGetCursorPos(LPPOINT);
extGetCursorPos(&p);
*x = p.x;

View File

@ -951,8 +951,10 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
}
break;
case WM_ACTIVATE:
// turn DirectInput bActive flag on & off .....
dxw.bActive = (LOWORD(wparam) == WA_ACTIVE || LOWORD(wparam) == WA_CLICKACTIVE) ? 1 : 0;
case WM_NCACTIVATE:
// turn DirectInput bActive flag on & off .....
if(message == WM_NCACTIVATE) dxw.bActive = wparam;
(*pSetWindowPos)(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
if(dxw.dwFlags1 & UNNOTIFY){

View File

@ -420,6 +420,8 @@ POINT dxwCore::FixCursorPos(POINT prev)
POINT curr;
RECT rect;
extern LPRECT lpClipRegion;
static BOOL IsWithin = TRUE;
static POINT LastPos;
curr=prev;
@ -449,6 +451,7 @@ POINT dxwCore::FixCursorPos(POINT prev)
}
if(dxw.dwFlags4 & RELEASEMOUSE){
#if 0
if ((curr.x < 0) ||
(curr.y < 0) ||
(curr.x > w) ||
@ -456,6 +459,28 @@ POINT dxwCore::FixCursorPos(POINT prev)
curr.x = w / 2;
curr.y = h / 2;
}
#else
if ((curr.x < 0) || (curr.y < 0) || (curr.x > w) || (curr.y > h)){
if(IsWithin){
int RestX, RestY;
RestX = w ? ((CLIP_TOLERANCE * w) / dxw.GetScreenWidth()) + 2 : CLIP_TOLERANCE + 2;
RestY = h ? ((CLIP_TOLERANCE * h) / dxw.GetScreenHeight()) + 2 : CLIP_TOLERANCE + 2;
if (curr.x < 0) curr.x = RestX;
if (curr.y < 0) curr.y = RestY;
if (curr.x > w) curr.x = w - RestX;
if (curr.y > h) curr.y = h - RestY;
LastPos = curr;
IsWithin = FALSE;
}
else{
curr = LastPos;
}
}
else{
IsWithin = TRUE;
LastPos = curr;
}
#endif
}
else {
if (curr.x < 0) curr.x = 0;
@ -833,6 +858,19 @@ void dxwCore::MapWindow(LPPOINT lppoint)
lppoint->y = upleft.y + (((lppoint->y * client.bottom) + (dwScreenHeight >> 1)) / dwScreenHeight);
}
void dxwCore::UnmapWindow(LPRECT rect)
{
RECT client;
POINT upleft = {0,0};
if(!(*pGetClientRect)(hWnd, &client)) return;
(*pClientToScreen)(hWnd, &upleft);
if((client.right == 0) || (client.bottom == 0)) return;
rect->left= ((rect->left - upleft.x) * (int)dwScreenWidth) / client.right;
rect->top= ((rect->top - upleft.y) * (int)dwScreenHeight) / client.bottom;
rect->right= ((rect->right - upleft.x) * (int)dwScreenWidth) / client.right;
rect->bottom= ((rect->bottom - upleft.y) * (int)dwScreenHeight) / client.bottom;
}
POINT dxwCore::ClientOffset(HWND hwnd)
{
RECT desktop;

View File

@ -63,6 +63,7 @@ public: // methods
void MapWindow(LPPOINT);
void MapWindow(LPRECT);
void MapWindow(int *, int *, int *, int *);
void UnmapWindow(LPRECT);
void FixWorkarea(LPRECT);
RECT GetScreenRect(void);
RECT GetUnmappedScreenRect();

View File

@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "TlHelp32.h"
#define VERSION "2.03.11"
#define VERSION "2.03.12"
#define DDTHREADLOCK 1
//#define LOCKTHREADS

Binary file not shown.

View File

@ -401,6 +401,10 @@
RelativePath=".\hd3d9.cpp"
>
</File>
<File
RelativePath=".\hexdump.cpp"
>
</File>
<File
RelativePath=".\hotpatch.cpp"
>

View File

@ -37,6 +37,20 @@ BOOL WINAPI extExtTextOutA(HDC, int, int, UINT, const RECT *, LPCSTR, UINT, cons
ExtTextOutW_Type pExtTextOutW = NULL;
ExtTextOutA_Type pExtTextOutA = NULL;
/*
typedef COLORREF (WINAPI *SetBkColor_Type)(HDC, COLORREF);
typedef COLORREF (WINAPI *SetTextColor_Type)(HDC hdc, COLORREF crColor);
typedef int (WINAPI *SetBkMode_Type)(HDC, int);
SetBkColor_Type pSetBkColor = NULL;
SetTextColor_Type pSetTextColor = NULL;
SetBkMode_Type pSetBkMode = NULL;
COLORREF WINAPI extSetBkColor(HDC, COLORREF);
COLORREF WINAPI extSetTextColor(HDC hdc, COLORREF crColor);
int WINAPI extSetBkMode(HDC, int);
*/
static HookEntry_Type Hooks[]={
{HOOK_IAT_CANDIDATE, "GetDeviceCaps", (FARPROC)GetDeviceCaps, (FARPROC *)&pGDIGetDeviceCaps, (FARPROC)extGetDeviceCaps},
@ -155,6 +169,15 @@ static HookEntry_Type FontHooks[]={
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
};
/*
static HookEntry_Type LockWHooks[]={
{HOOK_HOT_CANDIDATE, "SetBkColor", (FARPROC)SetBkColor, (FARPROC *)&pSetBkColor, (FARPROC)extSetBkColor},
{HOOK_HOT_CANDIDATE, "SetBkMode", (FARPROC)SetBkMode, (FARPROC *)&pSetBkMode, (FARPROC)extSetBkMode},
{HOOK_HOT_CANDIDATE, "SetTextColor", (FARPROC)SetTextColor, (FARPROC *)&pSetTextColor, (FARPROC)extSetTextColor},
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
};
*/
extern HRESULT WINAPI extDirectDrawCreate(GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR *);
extern HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *, LPDIRECTDRAW FAR *, REFIID, IUnknown FAR *);
@ -168,6 +191,7 @@ void HookGDI32Init()
HookLibInit(EmulateHooks);
HookLibInit(TextHooks);
HookLibInit(GammaHooks);
//HookLibInit(LockWHooks);
}
void HookGDI32(HMODULE module)
@ -182,6 +206,7 @@ void HookGDI32(HMODULE module)
if (dxw.dwFlags2 & DISABLEGAMMARAMP) HookLibrary(module, GammaHooks, libname);
// v2.02.33 - for "Stratego" compatibility option
if(dxw.dwFlags3 & FONTBYPASS) HookLibrary(module, FontHooks, libname);
//if(1) HookLibrary(module, LockWHooks, libname);
}
FARPROC Remap_GDI32_ProcAddress(LPCSTR proc, HMODULE hModule)
@ -198,6 +223,7 @@ FARPROC Remap_GDI32_ProcAddress(LPCSTR proc, HMODULE hModule)
if (dxw.dwFlags2 & DISABLEGAMMARAMP) if(addr=RemapLibrary(proc, hModule, GammaHooks)) return addr;
// v2.02.33 - for "Stratego" compatibility option
if (dxw.dwFlags3 & FONTBYPASS) if(addr=RemapLibrary(proc, hModule, FontHooks)) return addr;
//if (1) if(addr=RemapLibrary(proc, hModule, LockWHooks)) return addr;
return NULL;
}
@ -338,7 +364,7 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex)
case RASTERCAPS:
if(dxw.dwFlags2 & INIT8BPP) {
res |= RC_PALETTE; // v2.02.12
OutTraceDW("GetDeviceCaps: fix(2) RASTERCAPS setting RC_PALETTE cap=%x\n",res);
OutTraceDW("GetDeviceCaps: fix(2) RASTERCAPS setting RC_PALETTE cap=%x\n", res);
}
break;
case BITSPIXEL:
@ -346,7 +372,7 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex)
if(dxw.dwFlags2 & (INIT8BPP|INIT16BPP)){ // v2.02.32 fix
if(dxw.dwFlags2 & INIT8BPP) res = 8;
if(dxw.dwFlags2 & INIT16BPP) res = 16;
OutTraceDW("GetDeviceCaps: fix(2) BITSPIXEL/COLORRES cap=%d\n",res);
OutTraceDW("GetDeviceCaps: fix(2) BITSPIXEL/COLORRES cap=%d\n", res);
}
break;
//case NUMCOLORS: // numcolors windows bug fix....
@ -369,15 +395,15 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex)
if(dxw.VirtualPixelFormat.dwRGBBitCount!=0) res = dxw.VirtualPixelFormat.dwRGBBitCount;
if(dxw.dwFlags2 & INIT8BPP) res = 8;
if(dxw.dwFlags2 & INIT16BPP) res = 16;
if(PrevRes != res) OutTraceDW("GetDeviceCaps: fix(3) BITSPIXEL/COLORRES cap=%d\n",res);
if(PrevRes != res) OutTraceDW("GetDeviceCaps: fix(3) BITSPIXEL/COLORRES cap=%d\n", res);
break;
case SIZEPALETTE:
res = 256;
OutTraceDW("GetDeviceCaps: fix(3) SIZEPALETTE cap=%x\n",res);
OutTraceDW("GetDeviceCaps: fix(3) SIZEPALETTE cap=%x\n", res);
break;
case NUMRESERVED:
res = 0;
OutTraceDW("GetDeviceCaps: fix(3) NUMRESERVED cap=%x\n",res);
OutTraceDW("GetDeviceCaps: fix(3) NUMRESERVED cap=%x\n", res);
break;
}
}
@ -493,14 +519,14 @@ BOOL WINAPI extAnimatePalette(HPALETTE hpal, UINT iStartIndex, UINT cEntries, co
UINT WINAPI extRealizePalette(HDC hdc)
{
UINT ret;
extern void mySetPalette(int, int, LPPALETTEENTRY);
extern void mySetPalette(int, int, LPPALETTEENTRY, BOOL);
OutTraceDW("GDI.RealizePalette: hdc=%x\n", hdc);
if((OBJ_DC == GetObjectType(hdc)) && (dxw.dwFlags1 & EMULATESURFACE)){
PALETTEENTRY PalEntries[256];
UINT nEntries;
nEntries=GetPaletteEntries(hDesktopPalette, 0, 256, PalEntries);
mySetPalette(0, nEntries, PalEntries);
mySetPalette(0, nEntries, PalEntries, TRUE); // ??
if(IsDebug) dxw.DumpPalette(nEntries, PalEntries);
ret=DD_OK;
}
@ -1868,6 +1894,36 @@ BOOL WINAPI extExtTextOutW(HDC hdc, int X, int Y, UINT fuOptions, const RECT *lp
}
#if 0
COLORREF WINAPI extSetBkColor(HDC hdc, COLORREF crColor)
{
OutTrace("SetBkColor: hdc=%x color=%x\n", hdc, crColor);
if(dxw.Windowize && dxw.IsRealDesktop(WindowFromDC(hdc))) {
OutTrace("Remap desktop hdc=%x->%x\n", hdc, GetDC(dxw.GethWnd()));
hdc=GetDC(dxw.GethWnd());
}
return (*pSetBkColor)(hdc, crColor);
}
int WINAPI extSetBkMode(HDC hdc, int iBkMode)
{
OutTrace("SetBkMode: hdc=%x bkmode=%x\n", hdc, iBkMode);
if(dxw.Windowize && dxw.IsRealDesktop(WindowFromDC(hdc))) {
OutTrace("Remap desktop hdc=%x->%x\n", hdc, GetDC(dxw.GethWnd()));
hdc=GetDC(dxw.GethWnd());
}
return (*pSetBkMode)(hdc, iBkMode);
}
COLORREF WINAPI extSetTextColor(HDC hdc, COLORREF crColor)
{
OutTrace("SetTextColor: hdc=%x color=%x\n", hdc, crColor);
if(dxw.Windowize && dxw.IsRealDesktop(WindowFromDC(hdc))) {
OutTrace("Remap desktop hdc=%x->%x\n", hdc, GetDC(dxw.GethWnd()));
hdc=GetDC(dxw.GethWnd());
}
return (*pSetTextColor)(hdc, crColor);
}
// unhooked, since quite surprisingly all rectangles showed properly scaled already in RollerCoaster Tycoon !!
DWORD WINAPI extGetRegionData(HRGN hRgn, DWORD dwCount, LPRGNDATA lpRgnData)
{

22
dll/hexdump.cpp Normal file
View File

@ -0,0 +1,22 @@
#define _CRT_SECURE_NO_WARNINGS
#include "stdio.h"
#include "string.h"
#define MAX_HEXDUMP 512
char *hexdump(unsigned char *Buffer, int len)
{
static char sHexBuffer[3*MAX_HEXDUMP+12];
char *s;
int iMaxI;
s=sHexBuffer;
iMaxI = len;
if(iMaxI > MAX_HEXDUMP) iMaxI = MAX_HEXDUMP;
for (int i=0; i<iMaxI; i++){
sprintf(s, "%02.2X,", Buffer[i]);
s += 3;
}
*(--s)=0; // eliminate last comma
if(len > iMaxI) strcpy(s, ",...");
return sHexBuffer;
}

View File

@ -58,7 +58,7 @@ static HookEntry_Type Hooks[]={
{HOOK_HOT_CANDIDATE, "SystemParametersInfoA", (FARPROC)SystemParametersInfoA, (FARPROC *)&pSystemParametersInfoA, (FARPROC)extSystemParametersInfoA},
{HOOK_HOT_CANDIDATE, "SystemParametersInfoW", (FARPROC)SystemParametersInfoW, (FARPROC *)&pSystemParametersInfoW, (FARPROC)extSystemParametersInfoW},
//{HOOK_HOT_CANDIDATE, "GetActiveWindow", (FARPROC)NULL, (FARPROC *)&pGetActiveWindow, (FARPROC)extGetActiveWindow},
//{HOOK_HOT_CANDIDATE, "GetForegroundWindow", (FARPROC)NULL, (FARPROC *)&pGetForegroundWindow, (FARPROC)extGetForegroundWindow},
//{HOOK_HOT_CANDIDATE, "GetForegroundWindow", (FARPROC)GetForegroundWindow, (FARPROC *)&pGetForegroundWindow, (FARPROC)extGetForegroundWindow},
//{HOOK_IAT_CANDIDATE, "GetWindowTextA", (FARPROC)GetWindowTextA, (FARPROC *)&pGetWindowTextA, (FARPROC)extGetWindowTextA},
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
};
@ -1054,6 +1054,7 @@ int WINAPI extMapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT
UINT pi;
int ret;
// a rarely used API, but responsible for a painful headache: needs hooking for "Commandos 2", "Alien Nations".
// used also in "Full Pipe" activemovie
OutTraceDW("MapWindowPoints: hWndFrom=%x%s hWndTo=%x%s cPoints=%d FullScreen=%x\n",
hWndFrom, dxw.IsDesktop(hWndFrom)?"(DESKTOP)":"",
@ -1070,9 +1071,14 @@ int WINAPI extMapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT
if(dxw.IsRealDesktop(hWndFrom)) hWndFrom=dxw.GethWnd();
}
// should scale the retcode ???
// should scale the retcode and every point ???
ret=(*pMapWindowPoints)(hWndFrom, hWndTo, lpPoints, cPoints);
if(IsDebug){
OutTrace("Mapped points: ");
for(pi=0; pi<cPoints; pi++) OutTrace("(%d,%d)", lpPoints[pi].x, lpPoints[pi].y);
OutTrace("\n");
}
OutTraceDW("MapWindowPoints: ret=%x (%d,%d)\n", ret, (ret&0xFFFF0000)>>16, ret&0x0000FFFF);
return ret;
}
@ -2574,18 +2580,22 @@ HWND WINAPI extGetActiveWindow(void)
{
HWND ret;
ret=(*pGetActiveWindow)();
OutTraceDW("GetActiveWindow: ret=%x->%x\n", ret, dxw.GethWnd());
//STOPPER("GetActiveWindow");
return dxw.GethWnd();
if(dxw.Windowize && dxw.IsFullScreen()) {
OutTraceDW("GetActiveWindow: ret=%x->%x\n", ret, dxw.GethWnd());
return dxw.GethWnd();
}
return ret;
}
HWND WINAPI extGetForegroundWindow(void)
{
HWND ret;
ret=(*pGetForegroundWindow)();
OutTraceDW("GetForegroundWindow: ret=%x->%x\n", ret, dxw.GethWnd());
//STOPPER("GetForegroundWindow");
return dxw.GethWnd();
if(dxw.Windowize && dxw.IsFullScreen()) {
OutTraceDW("GetForegroundWindow: ret=%x->%x\n", ret, dxw.GethWnd());
return dxw.GethWnd();
}
return ret;
}
BOOL WINAPI extIsWindowVisible(HWND hwnd)

View File

@ -63,26 +63,42 @@ END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTabProgram message handlers
extern void GetFolderFromPath(char *);
void CTabProgram::OnOpen()
{
// TODO: Please add your control notification handler code here
char path[MAX_PATH];
extern char *gInitFilePath;
CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent()));
cTarget->m_File.GetWindowText(path, MAX_PATH);
GetPrivateProfileString("window", "exepath", ".", path, MAX_PATH, gInitFilePath);
CFileDialog dlg( TRUE, "*.*", path, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
"Program (*.exe)|*.exe|All Files (*.*)|*.*||", this);
if( dlg.DoModal() == IDOK) cTarget->m_File.SetWindowText(dlg.GetPathName());
if( dlg.DoModal() == IDOK) {
cTarget->m_File.SetWindowText(dlg.GetPathName());
strcpy(path, dlg.GetPathName());
GetFolderFromPath(path);
WritePrivateProfileString("window", "exepath", path, gInitFilePath);
}
}
void CTabProgram::OnOpenLaunch()
{
// TODO: Please add your control notification handler code here
char path[MAX_PATH];
extern char *gInitFilePath;
CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent()));
cTarget->m_File.GetWindowText(path, MAX_PATH);
GetPrivateProfileString("window", "exepath", NULL, path, MAX_PATH, gInitFilePath);
CFileDialog dlg( TRUE, "*.*", path, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
"Program (*.exe)|*.exe|All Files (*.*)|*.*||", this);
if( dlg.DoModal() == IDOK) cTarget->m_Launch.SetWindowText(dlg.GetPathName());
if( dlg.DoModal() == IDOK) {
cTarget->m_Launch.SetWindowText(dlg.GetPathName());
strcpy(path, dlg.GetPathName());
GetFolderFromPath(path);
WritePrivateProfileString("window", "exepath", path, gInitFilePath);
}
}
BOOL CTabProgram::OnInitDialog()

Binary file not shown.

Binary file not shown.

View File

@ -81,6 +81,11 @@ static char *Unescape(char *s)
return tmp;
}
void GetFolderFromPath(char *path)
{
for(char *c=&path[strlen(path)-1]; (c>path) && (*c!='\\'); c--) *c=0;
}
/////////////////////////////////////////////////////////////////////////////
// CDxwndhostView
@ -869,6 +874,8 @@ void CDxwndhostView::OnDraw(CDC* pDC)
ASSERT_VALID(pDoc);
}
char *gInitFilePath;
void CDxwndhostView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
@ -905,6 +912,7 @@ void CDxwndhostView::OnInitialUpdate()
GetCurrentDirectory(MAX_PATH, InitPath);
strcat_s(InitPath, sizeof(InitPath), "\\");
strcat_s(InitPath, sizeof(InitPath), m_ConfigFileName);
gInitFilePath = InitPath;
listctrl.InsertColumn(0, &listcol);
for(i = 0; i < MAXTARGETS; i ++){
@ -958,7 +966,7 @@ void CDxwndhostView::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult)
*pResult = 0;
}
static char ImportExportPath[4096] = {0};
//static char ImportExportPath[4096] = {0};
void CDxwndhostView::OnExport()
{
@ -969,12 +977,19 @@ void CDxwndhostView::OnExport()
if(!listctrl.GetSelectedCount()) return;
pos = listctrl.GetFirstSelectedItemPosition();
i = listctrl.GetNextSelectedItem(pos);
//path[0]=0;
strcpy_s(path, MAX_PATH, TitleMaps[i].title);
GetPrivateProfileString("window", "exportpath", ".\\", path, MAX_PATH, InitPath);
//strcat_s(path, MAX_PATH, "\\");
strcat_s(path, MAX_PATH, TitleMaps[i].title);
CFileDialog dlg( FALSE, "*.dxw", path, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
"dxwnd task config (*.dxw)|*.dxw|All Files (*.*)|*.*||", this);
if( dlg.DoModal() == IDOK)
SaveConfigItem(&TargetMaps[i], &TitleMaps[i], 0, dlg.GetPathName().GetBuffer());
if( dlg.DoModal() == IDOK) {
strcpy(path, dlg.GetPathName().GetBuffer());
//MessageBox(path, "PathName", MB_OK);
SaveConfigItem(&TargetMaps[i], &TitleMaps[i], 0, path);
GetFolderFromPath(path);
//MessageBox(path, "FolderPath", MB_OK);
WritePrivateProfileString("window", "exportpath", path, InitPath);
}
}
void CDxwndhostView::OnImport()
@ -982,6 +997,7 @@ void CDxwndhostView::OnImport()
LV_ITEM listitem;
int i;
char path[MAX_PATH];
char ImportExportPath[4096] = {0};
for (i=0; strlen(TargetMaps[i].path) && i<MAXTARGETS; i++)
;
if (i==MAXTARGETS) {
@ -994,6 +1010,8 @@ void CDxwndhostView::OnImport()
char folder[MAX_PATH+1];
char pathname[MAX_PATH+1];
OPENFILENAME ofn = {0};
GetPrivateProfileString("window", "exportpath", ".", pathname, MAX_PATH, InitPath);
ofn.lpstrInitialDir = pathname;
ofn.lStructSize = sizeof(ofn);
ofn.lpstrFilter = "DxWnd export file\0*.dxw\0\0";
ofn.lpstrFile = (LPSTR)ImportExportPath;
@ -1012,6 +1030,8 @@ void CDxwndhostView::OnImport()
listitem.iImage = SetTargetIcon(TargetMaps[i]);
listitem.pszText = TitleMaps[i].title;
listctrl.InsertItem(&listitem);
GetFolderFromPath(ImportExportPath);
WritePrivateProfileString("window", "exportpath", ImportExportPath, InitPath);
}
}
else{
@ -1019,9 +1039,10 @@ void CDxwndhostView::OnImport()
char* p = ImportExportPath;
strcpy(folder, p);
strcat(folder, "\\");
WritePrivateProfileString("window", "exportpath", folder, InitPath);
p += lstrlen((LPSTR)p) + 1;
while(*p && (i<MAXTARGETS)){
// "p" - name of each files, NULL to terminate
// "p" - name of each file, NULL to terminate
if(!*p) break;
if(i==MAXTARGETS) break;
strcpy(pathname, folder);
@ -1367,6 +1388,17 @@ void CDxwndhostView::OnProcessKill()
ClipCursor(NULL);
RevertScreenChanges(&this->InitDevMode);
}
//GetPrivateProfileString("window", "exportpath", ".", path, MAX_PATH, InitPath);
//strcat_s(path, MAX_PATH, "\\");
//strcat_s(path, MAX_PATH, TitleMaps[i].title);
//CFileDialog dlg( FALSE, "*.dxw", path, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
// "dxwnd task config (*.dxw)|*.dxw|All Files (*.*)|*.*||", this);
//if( dlg.DoModal() == IDOK) {
// SaveConfigItem(&TargetMaps[i], &TitleMaps[i], 0, dlg.GetPathName().GetBuffer());
// WritePrivateProfileString("window", "exportpath", dlg.GetFolderPath(), InitPath);
//}
void CDxwndhostView::OnAdd()
{