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

v2_03_14_src

Former-commit-id: 3ee9e46b11381b392c850b6fcec7070a7d8f86ff
This commit is contained in:
gho tik 2015-03-17 12:40:30 -04:00 committed by Refael ACkermann
parent 9018a2a20b
commit 41a3507207
33 changed files with 5266 additions and 67 deletions

View File

@ -175,6 +175,7 @@
#define MESSAGEPUMP 0x04000000 // inserts a "message pump" loop between repeated operation that may stop the task on Win7 and greater #define MESSAGEPUMP 0x04000000 // inserts a "message pump" loop between repeated operation that may stop the task on Win7 and greater
#define TEXTUREFORMAT 0x08000000 // Apply virtual pixel format to texture surfaces without DDSD_PIXELFORMAT attribute #define TEXTUREFORMAT 0x08000000 // Apply virtual pixel format to texture surfaces without DDSD_PIXELFORMAT attribute
#define GSKYHACK 0x10000000 // use VIDEOMEMORY+LOCALVIDMEM capability to turn hw acceleration on ... #define GSKYHACK 0x10000000 // use VIDEOMEMORY+LOCALVIDMEM capability to turn hw acceleration on ...
#define LOCKRESERVEDPALETTE 0x20000000 // lock the reserved palette entries (usually 20: 0-9 and 246-255)
// logging Tflags DWORD: // logging Tflags DWORD:
#define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general #define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general

View File

@ -3,7 +3,9 @@ posx=50
posy=50 posy=50
sizx=320 sizx=320
sizy=200 sizy=200
lang=automatic lang=default
;lang=automatic
;updatepaths=1
;debug=1 ;debug=1
;multiprocesshook=0 ;multiprocesshook=0
;checkadmin=0 ;checkadmin=0

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:a309ebf6376c46e11161cf10c80cfaec09dc6bb88fa7ac4d8bbd0cf92e243eb8 oid sha256:864a3a7f784d58281c340c7d1ac1302d110b6d98167c3c4f8a42624e9341b65a
size 571904 size 571904

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:e7bef752b0ed1dd25215248cadaae676418c24c88518b878d1328e2e34abb6ef oid sha256:07f3136aad64bf4ff6b095c147274f42b9b14063a3760ebb2ab99550717af873
size 538112 size 538624

2
build/dxwnd.ini Normal file
View File

@ -0,0 +1,2 @@
[window]
exportpath=D:\DxWnd\exports\

4947
build/dxwnd.log Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,13 +3,13 @@ title0=Beyond Divinity
path0=D:\Games\Beyond Divinity\Div.exe path0=D:\Games\Beyond Divinity\Div.exe
module0= module0=
opengllib0= opengllib0=
ver0=0 ver0=1
coord0=0 coord0=0
flag0=134234144 flag0=134234146
flagg0=134217728 flagg0=1207959552
flagh0=61 flagh0=61
flagi0=0 flagi0=4194304
tflag0=3 tflag0=0
initx0=0 initx0=0
inity0=0 inity0=0
minx0=0 minx0=0
@ -22,3 +22,8 @@ sizx0=800
sizy0=600 sizy0=600
maxfps0=0 maxfps0=0
initts0=0 initts0=0
launchpath0=
notes0=
flagj0=128
winver0=0
maxres0=0

View File

@ -0,0 +1,29 @@
[target]
title0=Blaze and Blade
path0=D:\Games\Blaze and Blade\Blaze.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

@ -4,7 +4,7 @@ path0=D:\Games\divide\DIVIDE.EXE
launchpath0= launchpath0=
module0= module0=
opengllib0= opengllib0=
notes0= notes0=RIP game needs "dxwnd.the Divide" registry definition
ver0=0 ver0=0
coord0=0 coord0=0
flag0=134217762 flag0=134217762

View File

@ -11,7 +11,7 @@ flag0=134217762
flagg0=1476395008 flagg0=1476395008
flagh0=20 flagh0=20
flagi0=138412036 flagi0=138412036
flagj0=4224 flagj0=536875136
tflag0=512 tflag0=512
initx0=0 initx0=0
inity0=0 inity0=0

View File

@ -1,14 +1,14 @@
[target] [target]
title0=Mageslayer title0=MageSlayer
path0=D:\Games\MAGE\MAGESLAY.EXE path0=D:\Games\MAGE\MAGESLAY.EXE
module0= module0=
opengllib0= opengllib0=
ver0=0 ver0=0
coord0=0 coord0=0
flag0=134234146 flag0=134234146
flagg0=134217760 flagg0=1476395040
flagh0=20 flagh0=20
flagi0=0 flagi0=4194305
tflag0=64 tflag0=64
initx0=0 initx0=0
inity0=0 inity0=0
@ -22,3 +22,8 @@ sizx0=800
sizy0=600 sizy0=600
maxfps0=0 maxfps0=0
initts0=0 initts0=0
launchpath0=
notes0=May require "by default set no ALPHACHENNAL" if monitor doesn't support mode
flagj0=128
winver0=0
maxres0=0

View File

@ -5,10 +5,10 @@ module0=
opengllib0= opengllib0=
ver0=0 ver0=0
coord0=0 coord0=0
flag0=134217762 flag0=134234146
flagg0=1207959684 flagg0=1476395140
flagh0=20 flagh0=20
flagi0=4194816 flagi0=4194304
tflag0=0 tflag0=0
initx0=0 initx0=0
inity0=0 inity0=0

View File

@ -0,0 +1,29 @@
[target]
title0=Virtua Cop 2
path0=D:\Games\VCop2\VCop2.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

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

View File

@ -1,5 +0,0 @@
[window]
posx=541
posy=525
sizx=320
sizy=406

View File

@ -759,3 +759,8 @@ fix: recovery for lost surfaces (i.e. after a Ctrl+Alt+Del command)
fix: palette display form showing active entries fix: palette display form showing active entries
fix: EnumDisplayModes hook in emulate surface mode fix: EnumDisplayModes hook in emulate surface mode
fix: several log improvements fix: several log improvements
v2.03.14
add: window commands Minimize, Restore & Close
add: made palette behaviour configurable (until better understood...)
add: "updatepaths" tag in dxwnd.ini

View File

@ -496,13 +496,13 @@ void DescribeSurface(LPDIRECTDRAWSURFACE lpdds, int dxversion, char *label, int
BOOL isPaletteUpdated; BOOL isPaletteUpdated;
void mySetPalette(int dwstart, int dwcount, LPPALETTEENTRY lpentries, BOOL Has256ColorsPalette) void mySetPalette(int dwstart, int dwcount, LPPALETTEENTRY lpentries)
{ {
int i; int i;
extern DXWNDSTATUS *pStatus; extern DXWNDSTATUS *pStatus;
// if has reserved palette entries, recover them // if has reserved palette entries, recover them
if(!Has256ColorsPalette){ if(dxw.dwFlags5 & LOCKRESERVEDPALETTE){
int nStatCols, nPalEntries; int nStatCols, nPalEntries;
PALETTEENTRY SysPalEntry[256]; PALETTEENTRY SysPalEntry[256];
LPPALETTEENTRY lpEntry; LPPALETTEENTRY lpEntry;
@ -3435,8 +3435,6 @@ HRESULT WINAPI extWaitForVerticalBlank(LPDIRECTDRAW lpdd, DWORD dwflags, HANDLE
#define DDPCAPS_INITIALIZE_LEGACY 0x00000008l #define DDPCAPS_INITIALIZE_LEGACY 0x00000008l
BOOL Has256ColorsPalette = FALSE;
HRESULT WINAPI extCreatePalette(LPDIRECTDRAW lpdd, DWORD dwflags, LPPALETTEENTRY lpddpa, HRESULT WINAPI extCreatePalette(LPDIRECTDRAW lpdd, DWORD dwflags, LPPALETTEENTRY lpddpa,
LPDIRECTDRAWPALETTE *lplpddp, IUnknown *pu) LPDIRECTDRAWPALETTE *lplpddp, IUnknown *pu)
{ {
@ -3445,10 +3443,6 @@ HRESULT WINAPI extCreatePalette(LPDIRECTDRAW lpdd, DWORD dwflags, LPPALETTEENTRY
OutTraceDDRAW("CreatePalette: dwFlags=%x(%s)\n", dwflags, ExplainCreatePaletteFlags(dwflags)); OutTraceDDRAW("CreatePalette: dwFlags=%x(%s)\n", dwflags, ExplainCreatePaletteFlags(dwflags));
if(IsDebug && (dwflags & DDPCAPS_8BIT)) dxw.DumpPalette(256, lpddpa); 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(!(dwflags & DDPCAPS_PRIMARYSURFACE)) Has256ColorsPalette = TRUE;
if(dxw.dwFlags1 & EMULATESURFACE) dwflags &= ~DDPCAPS_PRIMARYSURFACE; if(dxw.dwFlags1 & EMULATESURFACE) dwflags &= ~DDPCAPS_PRIMARYSURFACE;
res = (*pCreatePalette)(lpdd, dwflags, lpddpa, lplpddp, pu); res = (*pCreatePalette)(lpdd, dwflags, lpddpa, lplpddp, pu);
if (res) { if (res) {
@ -3508,7 +3502,7 @@ HRESULT WINAPI extSetPalette(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWPALETTE lpdd
lpentries = (LPPALETTEENTRY)PaletteEntries; lpentries = (LPPALETTEENTRY)PaletteEntries;
res2=lpddp->GetEntries(0, 0, 256, lpentries); res2=lpddp->GetEntries(0, 0, 256, lpentries);
if(res2) OutTraceE("SetPalette: GetEntries ERROR res=%x(%s)\n", res2, ExplainDDError(res2)); if(res2) OutTraceE("SetPalette: GetEntries ERROR res=%x(%s)\n", res2, ExplainDDError(res2));
mySetPalette(0, 256, lpentries, Has256ColorsPalette); // v2.02.76: necessary for "Requiem Avenging Angel" in SURFACEEMULATION mode mySetPalette(0, 256, lpentries); // 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", ... // Apply palette to backbuffer surface. This is necessary on some games: "Duckman private dick", "Total Soccer 2000", ...
if (lpDDSBack){ if (lpDDSBack){
@ -3544,8 +3538,7 @@ HRESULT WINAPI extSetEntries(LPDIRECTDRAWPALETTE lpddp, DWORD dwflags, DWORD dws
OutTraceDW("SetEntries: ASSERT start+count > 256\n"); OutTraceDW("SetEntries: ASSERT start+count > 256\n");
} }
if(dwflags & DDPCAPS_ALLOW256) Has256ColorsPalette=TRUE; mySetPalette(dwstart, dwcount, lpentries);
mySetPalette(dwstart, dwcount, lpentries, Has256ColorsPalette);
// GHO: needed for fixed rect and variable palette animations, // GHO: needed for fixed rect and variable palette animations,
// e.g. dungeon keeper loading screen, Warcraft II splash, ... // e.g. dungeon keeper loading screen, Warcraft II splash, ...

View File

@ -98,15 +98,15 @@ static char *Flag5Names[32]={
"REMAPMCI", "TEXTUREHIGHLIGHT", "TEXTUREDUMP", "TEXTUREHACK", "REMAPMCI", "TEXTUREHIGHLIGHT", "TEXTUREDUMP", "TEXTUREHACK",
"TEXTURETRANSP", "NORMALIZEPERFCOUNT", "HYBRIDMODE", "GDICOLORCONV", "TEXTURETRANSP", "NORMALIZEPERFCOUNT", "HYBRIDMODE", "GDICOLORCONV",
"INJECTSON", "ENABLESONHOOK", "FREEZEINJECTEDSON", "GDIMODE", "INJECTSON", "ENABLESONHOOK", "FREEZEINJECTEDSON", "GDIMODE",
"CENTERTOWIN", "MESSAGEPUMP", "", "", "CENTERTOWIN", "MESSAGEPUMP", "TEXTUREFORMAT", "GSKYHACK",
"", "", "", "", "LOCKRESERVEDPALETTE", "", "", "",
}; };
static char *TFlagNames[32]={ static char *TFlagNames[32]={
"OUTTRACE", "OUTDDRAWTRACE", "OUTWINMESSAGES", "OUTCURSORTRACE", "OUTTRACE", "OUTDDRAWTRACE", "OUTWINMESSAGES", "OUTCURSORTRACE",
"OUTPROXYTRACE", "DXPROXED", "ASSERTDIALOG", "OUTIMPORTTABLE", "OUTPROXYTRACE", "DXPROXED", "ASSERTDIALOG", "OUTIMPORTTABLE",
"OUTDEBUG", "OUTREGISTRY", "TRACEHOOKS", "OUTD3DTRACE", "OUTDEBUG", "OUTREGISTRY", "TRACEHOOKS", "OUTD3DTRACE",
"OUTDXWINTRACE", "", "", "", "OUTDXWINTRACE", "ADDTIMESTAMP", "OUTDEBUGSTRING", "ERASELOGFILE",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",

View File

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

Binary file not shown.

View File

@ -37,6 +37,12 @@ BOOL WINAPI extExtTextOutA(HDC, int, int, UINT, const RECT *, LPCSTR, UINT, cons
ExtTextOutW_Type pExtTextOutW = NULL; ExtTextOutW_Type pExtTextOutW = NULL;
ExtTextOutA_Type pExtTextOutA = NULL; ExtTextOutA_Type pExtTextOutA = NULL;
#ifdef TRACEPALETTE
typedef BOOL (WINAPI *ResizePalette_Type)(HPALETTE, UINT);
ResizePalette_Type pResizePalette = NULL;
BOOL WINAPI extResizePalette(HPALETTE, UINT);
#endif
/* /*
typedef COLORREF (WINAPI *SetBkColor_Type)(HDC, COLORREF); typedef COLORREF (WINAPI *SetBkColor_Type)(HDC, COLORREF);
typedef COLORREF (WINAPI *SetTextColor_Type)(HDC hdc, COLORREF crColor); typedef COLORREF (WINAPI *SetTextColor_Type)(HDC hdc, COLORREF crColor);
@ -81,8 +87,9 @@ static HookEntry_Type Hooks[]={
{HOOK_HOT_CANDIDATE, "GetPaletteEntries", (FARPROC)GetPaletteEntries, (FARPROC *)&pGetPaletteEntries, (FARPROC)extGetPaletteEntries}, {HOOK_HOT_CANDIDATE, "GetPaletteEntries", (FARPROC)GetPaletteEntries, (FARPROC *)&pGetPaletteEntries, (FARPROC)extGetPaletteEntries},
{HOOK_HOT_CANDIDATE, "GetSystemPaletteUse", (FARPROC)GetSystemPaletteUse, (FARPROC *)&pGetSystemPaletteUse, (FARPROC)extGetSystemPaletteUse}, {HOOK_HOT_CANDIDATE, "GetSystemPaletteUse", (FARPROC)GetSystemPaletteUse, (FARPROC *)&pGetSystemPaletteUse, (FARPROC)extGetSystemPaletteUse},
#ifdef TRACEPALETTE
{HOOK_IAT_CANDIDATE, "ResizePalette", (FARPROC)ResizePalette, (FARPROC *)&pResizePalette, (FARPROC)extResizePalette},
#endif
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator {HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
}; };
@ -526,14 +533,14 @@ BOOL WINAPI extAnimatePalette(HPALETTE hpal, UINT iStartIndex, UINT cEntries, co
UINT WINAPI extRealizePalette(HDC hdc) UINT WINAPI extRealizePalette(HDC hdc)
{ {
UINT ret; UINT ret;
extern void mySetPalette(int, int, LPPALETTEENTRY, BOOL); extern void mySetPalette(int, int, LPPALETTEENTRY);
OutTraceDW("GDI.RealizePalette: hdc=%x\n", hdc); OutTraceDW("GDI.RealizePalette: hdc=%x\n", hdc);
if((OBJ_DC == GetObjectType(hdc)) && (dxw.dwFlags1 & EMULATESURFACE)){ if((OBJ_DC == GetObjectType(hdc)) && (dxw.dwFlags1 & EMULATESURFACE)){
PALETTEENTRY PalEntries[256]; PALETTEENTRY PalEntries[256];
UINT nEntries; UINT nEntries;
nEntries=(*pGetPaletteEntries)(hDesktopPalette, 0, 256, PalEntries); nEntries=(*pGetPaletteEntries)(hDesktopPalette, 0, 256, PalEntries);
mySetPalette(0, nEntries, PalEntries, TRUE); // ?? mySetPalette(0, nEntries, PalEntries);
if(IsDebug) dxw.DumpPalette(nEntries, PalEntries); if(IsDebug) dxw.DumpPalette(nEntries, PalEntries);
ret=DD_OK; ret=DD_OK;
} }
@ -1917,6 +1924,14 @@ BOOL WINAPI extExtTextOutW(HDC hdc, int X, int Y, UINT fuOptions, const RECT *lp
} }
#ifdef TRACEPALETTE
BOOL WINAPI extResizePalette(HPALETTE hpal, UINT nEntries)
{
OutTrace("ResizePalette: hpal=%x nEntries=%d\n", hpal, nEntries);
return (*pResizePalette)(hpal, nEntries);
}
#endif
#if 0 #if 0
COLORREF WINAPI extSetBkColor(HDC hdc, COLORREF crColor) COLORREF WINAPI extSetBkColor(HDC hdc, COLORREF crColor)
{ {

View File

@ -24,6 +24,14 @@ BOOL IsChangeDisplaySettingsHotPatched = FALSE;
//EnumDisplayMonitors_Type pEnumDisplayMonitors = NULL; //EnumDisplayMonitors_Type pEnumDisplayMonitors = NULL;
//BOOL WINAPI extEnumDisplayMonitors(HDC, LPCRECT, MONITORENUMPROC, LPARAM); //BOOL WINAPI extEnumDisplayMonitors(HDC, LPCRECT, MONITORENUMPROC, LPARAM);
#ifdef TRACEPALETTE
typedef UINT (WINAPI *GetDIBColorTable_Type)(HDC, UINT, UINT, RGBQUAD *);
GetDIBColorTable_Type pGetDIBColorTable = NULL;
UINT WINAPI extGetDIBColorTable(HDC, UINT, UINT, RGBQUAD *);
typedef UINT (WINAPI *SetDIBColorTable_Type)(HDC, UINT, UINT, const RGBQUAD *);
SetDIBColorTable_Type pSetDIBColorTable = NULL;
UINT WINAPI extSetDIBColorTable(HDC, UINT, UINT, const RGBQUAD *);
#endif
static HookEntry_Type Hooks[]={ static HookEntry_Type Hooks[]={
{HOOK_IAT_CANDIDATE, "UpdateWindow", (FARPROC)NULL, (FARPROC *)&pUpdateWindow, (FARPROC)extUpdateWindow}, {HOOK_IAT_CANDIDATE, "UpdateWindow", (FARPROC)NULL, (FARPROC *)&pUpdateWindow, (FARPROC)extUpdateWindow},
@ -66,7 +74,10 @@ static HookEntry_Type Hooks[]={
//{HOOK_HOT_CANDIDATE, "GetForegroundWindow", (FARPROC)GetForegroundWindow, (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, "GetWindowTextA", (FARPROC)GetWindowTextA, (FARPROC *)&pGetWindowTextA, (FARPROC)extGetWindowTextA},
//{HOOK_HOT_CANDIDATE, "EnumDisplayMonitors", (FARPROC)EnumDisplayMonitors, (FARPROC *)&pEnumDisplayMonitors, (FARPROC)extEnumDisplayMonitors}, //{HOOK_HOT_CANDIDATE, "EnumDisplayMonitors", (FARPROC)EnumDisplayMonitors, (FARPROC *)&pEnumDisplayMonitors, (FARPROC)extEnumDisplayMonitors},
#ifdef TRACEPALETTE
{HOOK_HOT_CANDIDATE, "GetDIBColorTable", (FARPROC)GetDIBColorTable, (FARPROC *)&pGetDIBColorTable, (FARPROC)extGetDIBColorTable},
{HOOK_HOT_CANDIDATE, "SetDIBColorTable", (FARPROC)SetDIBColorTable, (FARPROC *)&pSetDIBColorTable, (FARPROC)extSetDIBColorTable},
#endif
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator {HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
}; };
@ -2833,6 +2844,64 @@ int WINAPI extGetUpdateRgn(HWND hWnd, HRGN hRgn, BOOL bErase)
return regionType; return regionType;
} }
#ifdef TRACEPALETTE
UINT WINAPI extGetDIBColorTable(HDC hdc, UINT uStartIndex, UINT cEntries, RGBQUAD *pColors)
{
UINT ret;
OutTraceDW("GetDIBColorTable: hdc=%x start=%d entries=%d\n", hdc, uStartIndex, cEntries);
//if((OBJ_DC == GetObjectType(hdc)) && (dxw.dwFlags1 & EMULATESURFACE)){
// //extern PALETTEENTRY PalEntries[256];
// extern DWORD *PaletteEntries;
// if((uStartIndex+cEntries) > 256) cEntries = 256 - uStartIndex;
// for(UINT i=0; i<cEntries; i++) {
// PALETTEENTRY p;
// memcpy(&p, &PaletteEntries[i+uStartIndex], sizeof(DWORD));
// pColors[i].rgbBlue = p.peBlue;
// pColors[i].rgbGreen = p.peGreen;
// pColors[i].rgbRed = p.peRed;
// pColors[i].rgbReserved = p.peFlags;
// }
// ret=cEntries;
//}
//else
// ret = (*pGetDIBColorTable)(hdc, uStartIndex, cEntries, pColors);
ret = (*pGetDIBColorTable)(hdc, uStartIndex, cEntries, pColors);
OutTraceDW("GetDIBColorTable: ret=%x\n", ret);
if(IsDebug) dxw.DumpPalette(cEntries, (PALETTEENTRY *)pColors);
return ret;
}
UINT WINAPI extSetDIBColorTable(HDC hdc, UINT uStartIndex, UINT cEntries, const RGBQUAD *pColors)
{
UINT ret;
OutTraceDW("SetDIBColorTable: hdc=%x start=%d entries=%d\n", hdc, uStartIndex, cEntries);
if(IsDebug) dxw.DumpPalette(cEntries, (PALETTEENTRY *)pColors);
//if((OBJ_DC == GetObjectType(hdc)) && (dxw.dwFlags1 & EMULATESURFACE)){
// //extern PALETTEENTRY PalEntries[256];
// extern DWORD *PaletteEntries;
// if((uStartIndex+cEntries) > 256) cEntries = 256 - uStartIndex;
// for(UINT i=0; i<cEntries; i++) {
// PALETTEENTRY p;
// memcpy(&p, &PaletteEntries[i+uStartIndex], sizeof(DWORD));
// pColors[i].rgbBlue = p.peBlue;
// pColors[i].rgbGreen = p.peGreen;
// pColors[i].rgbRed = p.peRed;
// pColors[i].rgbReserved = p.peFlags;
// }
// ret=cEntries;
//}
//else
// ret = (*pSetDIBColorTable)(hdc, uStartIndex, cEntries, pColors);
ret = (*pSetDIBColorTable)(hdc, uStartIndex, cEntries, pColors);
OutTraceDW("SetDIBColorTable: ret=%x\n", ret);
return ret;
}
#endif
#ifdef NOUNHOOKED #ifdef NOUNHOOKED
BOOL WINAPI extValidateRect(HWND hWnd, const RECT *lpRect) BOOL WINAPI extValidateRect(HWND hWnd, const RECT *lpRect)
{ {

View File

@ -77,9 +77,11 @@ void CTabProgram::OnOpen()
"Program (*.exe)|*.exe|All Files (*.*)|*.*||", this); "Program (*.exe)|*.exe|All Files (*.*)|*.*||", this);
if( dlg.DoModal() == IDOK) { if( dlg.DoModal() == IDOK) {
cTarget->m_File.SetWindowText(dlg.GetPathName()); cTarget->m_File.SetWindowText(dlg.GetPathName());
strcpy(path, dlg.GetPathName()); if(GetPrivateProfileInt("window", "updatepaths", 1, gInitFilePath)){
GetFolderFromPath(path); strcpy(path, dlg.GetPathName());
WritePrivateProfileString("window", "exepath", path, gInitFilePath); GetFolderFromPath(path);
WritePrivateProfileString("window", "exepath", path, gInitFilePath);
}
} }
} }
@ -95,9 +97,11 @@ void CTabProgram::OnOpenLaunch()
"Program (*.exe)|*.exe|All Files (*.*)|*.*||", this); "Program (*.exe)|*.exe|All Files (*.*)|*.*||", this);
if( dlg.DoModal() == IDOK) { if( dlg.DoModal() == IDOK) {
cTarget->m_Launch.SetWindowText(dlg.GetPathName()); cTarget->m_Launch.SetWindowText(dlg.GetPathName());
strcpy(path, dlg.GetPathName()); if(GetPrivateProfileInt("window", "updatepaths", 1, gInitFilePath)){
GetFolderFromPath(path); strcpy(path, dlg.GetPathName());
WritePrivateProfileString("window", "exepath", path, gInitFilePath); GetFolderFromPath(path);
WritePrivateProfileString("window", "exepath", path, gInitFilePath);
}
} }
} }

View File

@ -54,6 +54,7 @@ void CTabWindow::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_BLACKWHITE, cTarget->m_BlackWhite); DDX_Check(pDX, IDC_BLACKWHITE, cTarget->m_BlackWhite);
DDX_Check(pDX, IDC_USERGB565, cTarget->m_UseRGB565); DDX_Check(pDX, IDC_USERGB565, cTarget->m_UseRGB565);
DDX_Check(pDX, IDC_LOCKSYSCOLORS, cTarget->m_LockSysColors); DDX_Check(pDX, IDC_LOCKSYSCOLORS, cTarget->m_LockSysColors);
DDX_Check(pDX, IDC_LOCKRESERVEDPALETTE, cTarget->m_LockReservedPalette);
DDX_Check(pDX, IDC_COLORFIX, cTarget->m_ColorFix); DDX_Check(pDX, IDC_COLORFIX, cTarget->m_ColorFix);
// screen resolution management // screen resolution management

View File

@ -30,6 +30,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_ModifyMouse = TRUE; // default true !! m_ModifyMouse = TRUE; // default true !!
m_OutProxyTrace = FALSE; m_OutProxyTrace = FALSE;
m_OutDebug = FALSE; m_OutDebug = FALSE;
m_RegistryOp = FALSE;
m_CursorTrace = FALSE; m_CursorTrace = FALSE;
m_OutWinMessages = FALSE; m_OutWinMessages = FALSE;
m_OutDWTrace = FALSE; m_OutDWTrace = FALSE;
@ -55,6 +56,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
//m_SuppressChild = FALSE; //m_SuppressChild = FALSE;
m_HideDesktop = FALSE; m_HideDesktop = FALSE;
m_LockSysColors = FALSE; m_LockSysColors = FALSE;
m_LockReservedPalette = FALSE;
m_ForceYUVtoRGB = FALSE; m_ForceYUVtoRGB = FALSE;
m_ForceRGBtoYUV = FALSE; m_ForceRGBtoYUV = FALSE;
m_LimitScreenRes = FALSE; m_LimitScreenRes = FALSE;

View File

@ -178,6 +178,7 @@ public:
//BOOL m_SuppressChild; //BOOL m_SuppressChild;
BOOL m_HideDesktop; BOOL m_HideDesktop;
BOOL m_LockSysColors; BOOL m_LockSysColors;
BOOL m_LockReservedPalette;
BOOL m_SingleProcAffinity; BOOL m_SingleProcAffinity;
BOOL m_WireFrame; BOOL m_WireFrame;
BOOL m_NoTextures; BOOL m_NoTextures;

Binary file not shown.

Binary file not shown.

View File

@ -315,6 +315,10 @@
/> />
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath=".\findwindow.cpp"
>
</File>
<File <File
RelativePath=".\getfname.cpp" RelativePath=".\getfname.cpp"
> >

View File

@ -100,6 +100,9 @@ BEGIN_MESSAGE_MAP(CDxwndhostView, CListView)
ON_COMMAND(ID_TASK_KILL, OnKill) ON_COMMAND(ID_TASK_KILL, OnKill)
ON_COMMAND(ID_TASK_PAUSE, OnPause) ON_COMMAND(ID_TASK_PAUSE, OnPause)
ON_COMMAND(ID_TASK_RESUME, OnResume) ON_COMMAND(ID_TASK_RESUME, OnResume)
ON_COMMAND(ID_WINDOW_MINIMIZE, OnWindowMinimize)
ON_COMMAND(ID_WINDOW_RESTORE, OnWindowRestore)
ON_COMMAND(ID_WINDOW_CLOSE, OnWindowClose)
ON_COMMAND(ID_ADD, OnAdd) ON_COMMAND(ID_ADD, OnAdd)
ON_COMMAND(ID_MODIFY, OnModify) ON_COMMAND(ID_MODIFY, OnModify)
ON_COMMAND(ID_PEXPORT, OnExport) ON_COMMAND(ID_PEXPORT, OnExport)
@ -279,6 +282,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
//if(dlg->m_SuppressChild) t->flags4 |= SUPPRESSCHILD; //if(dlg->m_SuppressChild) t->flags4 |= SUPPRESSCHILD;
if(dlg->m_HideDesktop) t->flags4 |= HIDEDESKTOP; if(dlg->m_HideDesktop) t->flags4 |= HIDEDESKTOP;
if(dlg->m_LockSysColors) t->flags3 |= LOCKSYSCOLORS; if(dlg->m_LockSysColors) t->flags3 |= LOCKSYSCOLORS;
if(dlg->m_LockReservedPalette) t->flags5 |= LOCKRESERVEDPALETTE;
if(dlg->m_ForceYUVtoRGB) t->flags3 |= YUV2RGB; if(dlg->m_ForceYUVtoRGB) t->flags3 |= YUV2RGB;
if(dlg->m_ForceRGBtoYUV) t->flags3 |= RGB2YUV; if(dlg->m_ForceRGBtoYUV) t->flags3 |= RGB2YUV;
if(dlg->m_LimitScreenRes) t->flags4 |= LIMITSCREENRES; if(dlg->m_LimitScreenRes) t->flags4 |= LIMITSCREENRES;
@ -475,6 +479,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
//dlg->m_SuppressChild = t->flags4 & SUPPRESSCHILD ? 1 : 0; //dlg->m_SuppressChild = t->flags4 & SUPPRESSCHILD ? 1 : 0;
dlg->m_HideDesktop = t->flags4 & HIDEDESKTOP ? 1 : 0; dlg->m_HideDesktop = t->flags4 & HIDEDESKTOP ? 1 : 0;
dlg->m_LockSysColors = t->flags3 & LOCKSYSCOLORS ? 1 : 0; dlg->m_LockSysColors = t->flags3 & LOCKSYSCOLORS ? 1 : 0;
dlg->m_LockReservedPalette = t->flags5 & LOCKRESERVEDPALETTE ? 1 : 0;
dlg->m_ForceRGBtoYUV = t->flags3 & RGB2YUV ? 1 : 0; dlg->m_ForceRGBtoYUV = t->flags3 & RGB2YUV ? 1 : 0;
dlg->m_ForceYUVtoRGB = t->flags3 & YUV2RGB ? 1 : 0; dlg->m_ForceYUVtoRGB = t->flags3 & YUV2RGB ? 1 : 0;
dlg->m_LimitScreenRes = t->flags4 & LIMITSCREENRES ? 1 : 0; dlg->m_LimitScreenRes = t->flags4 & LIMITSCREENRES ? 1 : 0;
@ -977,7 +982,7 @@ void CDxwndhostView::OnExport()
if(!listctrl.GetSelectedCount()) return; if(!listctrl.GetSelectedCount()) return;
pos = listctrl.GetFirstSelectedItemPosition(); pos = listctrl.GetFirstSelectedItemPosition();
i = listctrl.GetNextSelectedItem(pos); i = listctrl.GetNextSelectedItem(pos);
GetPrivateProfileString("window", "exportpath", ".\\", path, MAX_PATH, InitPath); GetPrivateProfileString("window", "exportpath", NULL, path, MAX_PATH, InitPath);
//strcat_s(path, MAX_PATH, "\\"); //strcat_s(path, MAX_PATH, "\\");
strcat_s(path, MAX_PATH, TitleMaps[i].title); strcat_s(path, MAX_PATH, TitleMaps[i].title);
CFileDialog dlg( FALSE, "*.dxw", path, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, CFileDialog dlg( FALSE, "*.dxw", path, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
@ -986,9 +991,10 @@ void CDxwndhostView::OnExport()
strcpy(path, dlg.GetPathName().GetBuffer()); strcpy(path, dlg.GetPathName().GetBuffer());
//MessageBox(path, "PathName", MB_OK); //MessageBox(path, "PathName", MB_OK);
SaveConfigItem(&TargetMaps[i], &TitleMaps[i], 0, path); SaveConfigItem(&TargetMaps[i], &TitleMaps[i], 0, path);
GetFolderFromPath(path); if(GetPrivateProfileInt("window", "updatepaths", 1, InitPath)) {
//MessageBox(path, "FolderPath", MB_OK); GetFolderFromPath(path);
WritePrivateProfileString("window", "exportpath", path, InitPath); WritePrivateProfileString("window", "exportpath", path, InitPath);
}
} }
} }
@ -1010,7 +1016,7 @@ void CDxwndhostView::OnImport()
char folder[MAX_PATH+1]; char folder[MAX_PATH+1];
char pathname[MAX_PATH+1]; char pathname[MAX_PATH+1];
OPENFILENAME ofn = {0}; OPENFILENAME ofn = {0};
GetPrivateProfileString("window", "exportpath", ".", pathname, MAX_PATH, InitPath); GetPrivateProfileString("window", "exportpath", NULL, pathname, MAX_PATH, InitPath);
ofn.lpstrInitialDir = pathname; ofn.lpstrInitialDir = pathname;
ofn.lStructSize = sizeof(ofn); ofn.lStructSize = sizeof(ofn);
ofn.lpstrFilter = "DxWnd export file\0*.dxw\0\0"; ofn.lpstrFilter = "DxWnd export file\0*.dxw\0\0";
@ -1030,8 +1036,10 @@ void CDxwndhostView::OnImport()
listitem.iImage = SetTargetIcon(TargetMaps[i]); listitem.iImage = SetTargetIcon(TargetMaps[i]);
listitem.pszText = TitleMaps[i].title; listitem.pszText = TitleMaps[i].title;
listctrl.InsertItem(&listitem); listctrl.InsertItem(&listitem);
GetFolderFromPath(ImportExportPath); if(GetPrivateProfileInt("window", "updatepaths", 1, InitPath)) {
WritePrivateProfileString("window", "exportpath", ImportExportPath, InitPath); GetFolderFromPath(ImportExportPath);
WritePrivateProfileString("window", "exportpath", ImportExportPath, InitPath);
}
} }
} }
else{ else{
@ -1039,7 +1047,8 @@ void CDxwndhostView::OnImport()
char* p = ImportExportPath; char* p = ImportExportPath;
strcpy(folder, p); strcpy(folder, p);
strcat(folder, "\\"); strcat(folder, "\\");
WritePrivateProfileString("window", "exportpath", folder, InitPath); if(GetPrivateProfileInt("window", "updatepaths", 1, InitPath))
WritePrivateProfileString("window", "exportpath", folder, InitPath);
p += lstrlen((LPSTR)p) + 1; p += lstrlen((LPSTR)p) + 1;
while(*p && (i<MAXTARGETS)){ while(*p && (i<MAXTARGETS)){
// "p" - name of each file, NULL to terminate // "p" - name of each file, NULL to terminate
@ -1325,6 +1334,32 @@ void CDxwndhostView::OnResume()
} }
} }
extern HWND find_main_window(unsigned long);
void CDxwndhostView::OnWindowMinimize()
{
DXWNDSTATUS DxWndStatus;
if ((GetHookStatus(&DxWndStatus) == DXW_RUNNING) && (DxWndStatus.hWnd!=NULL))
//::PostMessage(DxWndStatus.hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
::PostMessage(find_main_window(DxWndStatus.dwPid), WM_SYSCOMMAND, SC_MINIMIZE, 0);
}
void CDxwndhostView::OnWindowRestore()
{
DXWNDSTATUS DxWndStatus;
if ((GetHookStatus(&DxWndStatus) == DXW_RUNNING) && (DxWndStatus.hWnd!=NULL))
//::PostMessage(DxWndStatus.hWnd, WM_SYSCOMMAND, SC_RESTORE, 0);
::PostMessage(find_main_window(DxWndStatus.dwPid), WM_SYSCOMMAND, SC_RESTORE, 0);
}
void CDxwndhostView::OnWindowClose()
{
DXWNDSTATUS DxWndStatus;
if ((GetHookStatus(&DxWndStatus) == DXW_RUNNING) && (DxWndStatus.hWnd!=NULL))
//::PostMessage(DxWndStatus.hWnd, WM_SYSCOMMAND, SC_CLOSE, 0);
::PostMessage(find_main_window(DxWndStatus.dwPid), WM_SYSCOMMAND, SC_CLOSE, 0);
}
void CDxwndhostView::OnKill() void CDxwndhostView::OnKill()
{ {
CTargetDlg dlg; CTargetDlg dlg;
@ -1388,17 +1423,6 @@ void CDxwndhostView::OnProcessKill()
ClipCursor(NULL); ClipCursor(NULL);
RevertScreenChanges(&this->InitDevMode); 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() void CDxwndhostView::OnAdd()
{ {

View File

@ -70,6 +70,9 @@ protected:
afx_msg void OnProcessKill(); afx_msg void OnProcessKill();
afx_msg void OnPause(); afx_msg void OnPause();
afx_msg void OnResume(); afx_msg void OnResume();
afx_msg void OnWindowRestore();
afx_msg void OnWindowMinimize();
afx_msg void OnWindowClose();
afx_msg void OnSort(); afx_msg void OnSort();
afx_msg void OnViewLog(); afx_msg void OnViewLog();
afx_msg void OnDeleteLog(); afx_msg void OnDeleteLog();

34
host/findwindow.cpp Normal file
View File

@ -0,0 +1,34 @@
#include <windows.h>
#include "stdafx.h"
struct handle_data {
unsigned long process_id;
HWND best_handle;
};
static BOOL is_main_window(HWND handle)
{
return GetWindow(handle, GW_OWNER) == (HWND)0 && IsWindowVisible(handle);
}
static BOOL CALLBACK enum_windows_callback(HWND handle, LPARAM lParam)
{
handle_data& data = *(handle_data*)lParam;
unsigned long process_id = 0;
GetWindowThreadProcessId(handle, &process_id);
if (data.process_id != process_id || !is_main_window(handle)) {
return TRUE;
}
data.best_handle = handle;
return FALSE;
}
HWND find_main_window(unsigned long process_id)
{
handle_data data;
data.process_id = process_id;
data.best_handle = 0;
EnumWindows(enum_windows_callback, (LPARAM)&data);
return data.best_handle;
}

Binary file not shown.