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

v2_02_39_src

Former-commit-id: bca94a8fa11609187704d32de5dca2ab99209934
This commit is contained in:
gho tik 2013-11-10 11:38:24 -05:00 committed by Refael ACkermann
parent 547623861d
commit 0b3d188631
86 changed files with 13161 additions and 1114 deletions

1070
Include/ddrawi.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -104,6 +104,12 @@
#define PEEKALLMESSAGES 0x00400000 // force Peek-ing all sort of messages to avoid Win7 message queue saturation that leads to program halt
#define SURFACEWARN 0x00800000 // warn when a unclassified surface capability is met (debug only!)
#define ANALYTICMODE 0x01000000 // activate analytic mode (debug only!)
#define FORCESHEL 0x02000000 // Forces HEL (DDCREATE_EMULATIONONLY)
#define CAPMASK 0x04000000 // Enable capability mask (according to ini file)
#define COLORFIX 0x08000000 // Win7 color fix for 8bpp paletized modes
#define NODDRAWBLT 0x10000000 // Suppress ddraw Blt to primary
#define NODDRAWFLIP 0x20000000 // Suppress ddraw Flip to primary
#define NOGDIBLT 0x40000000 // Suppress GDI Blt to video device
// logging Tflags DWORD:
#define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general
@ -156,6 +162,7 @@ typedef struct
short IsFullScreen;
short Width, Height;
short ColorDepth;
//DDPIXELFORMAT VirtualPixel;
short DXVersion;
HWND hWnd;
DWORD dwPid;
@ -163,6 +170,7 @@ typedef struct
DWORD FPSCount;
int TimeShift;
short CursorX, CursorY;
PALETTEENTRY Palette[256];
} DXWNDSTATUS;
extern DXWNDSTATUS DxWndStatus;

5848
build/dxwnd.1.ini Normal file

File diff suppressed because it is too large Load Diff

1133
build/dxwnd.2.ini Normal file

File diff suppressed because it is too large Load Diff

167
build/dxwnd.3.ini Normal file
View File

@ -0,0 +1,167 @@
[window]
posx=1452
posy=365
sizx=320
sizy=514
[target]
title0=Rayman 2 Demo
path0=D:\Games\Rayman2Demo\Rayman2Demo.exe
module0=
opengllib0=
ver0=1
coord0=0
flag0=402653217
flagg0=1210056704
flagh0=2097172
flagi0=0
tflag0=64
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
title1=Mirror's Edge
path1=D:\Games\Mirror's Edge\Binaries\MirrorsEdge.exe
module1=
opengllib1=
ver1=0
coord1=0
flag1=-2013265882
flagg1=1207959552
flagh1=2097172
flagi1=0
tflag1=5
initx1=0
inity1=0
minx1=0
miny1=0
maxx1=0
maxy1=0
posx1=50
posy1=50
sizx1=800
sizy1=600
maxfps1=0
initts1=6
title2=LastHalfWin.exe
path2=D:\Games\Last Half Of Darkness\LastHalfWin.exe
module2=
opengllib2=
ver2=1
coord2=0
flag2=134217760
flagg2=1207959552
flagh2=4
flagi2=0
tflag2=512
initx2=0
inity2=0
minx2=0
miny2=0
maxx2=0
maxy2=0
posx2=50
posy2=50
sizx2=800
sizy2=600
maxfps2=0
initts2=0
title3=DOOM95.EXE
path3=D:\Games\Doom95i\DOOM95.EXE
module3=
opengllib3=
ver3=0
coord3=0
flag3=134217762
flagg3=1207959552
flagh3=20
flagi3=0
tflag3=512
initx3=0
inity3=0
minx3=0
miny3=0
maxx3=0
maxy3=0
posx3=50
posy3=50
sizx3=800
sizy3=600
maxfps3=0
initts3=0
title4=CNC3.exe
path4=D:\Games\Command & Conquer 3\CNC3.exe
module4=
opengllib4=
ver4=9
coord4=0
flag4=134217762
flagg4=1207959552
flagh4=20
flagi4=0
tflag4=512
initx4=0
inity4=0
minx4=0
miny4=0
maxx4=0
maxy4=0
posx4=50
posy4=50
sizx4=800
sizy4=600
maxfps4=0
initts4=0
title5=Div.exe
path5=D:\Games\Beyond Divinity\Div.exe
module5=
opengllib5=
ver5=0
coord5=0
flag5=134217762
flagg5=1207959552
flagh5=20
flagi5=0
tflag5=512
initx5=0
inity5=0
minx5=0
miny5=0
maxx5=0
maxy5=0
posx5=50
posy5=50
sizx5=800
sizy5=600
maxfps5=0
initts5=0
title6=martian gothic.exe
path6=D:\Games\Martian Gothic\martian gothic.exe
module6=
opengllib6=
ver6=7
coord6=0
flag6=201326626
flagg6=1208090624
flagh6=276
flagi6=0
tflag6=263
initx6=0
inity6=0
minx6=0
miny6=0
maxx6=0
maxy6=0
posx6=50
posy6=50
sizx6=800
sizy6=600
maxfps6=0
initts6=0

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d388e96ad41d9c1eafc912aecd8968fbd61f7f293a1f1a1cd69df02309c64344
size 419328
oid sha256:af6a5009d304a3e8cd4b4303697b68a8a6e060a6815e60b70a75a622cf8e4870
size 421376

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:376135e3ce4f0be506edbfb44720a7c762f120258e1b24c11ccd6fe11cc6d375
size 526336
oid sha256:78e9db00462bdbd92c3b15f0f9e7aa7ae434573ccaa808af1226ba489104837f
size 532480

File diff suppressed because it is too large Load Diff

View File

@ -272,13 +272,3 @@ code reorganization
GUI:
removed useless flags and moved debug options in a hidden tab
v2.02.37
CORE:
fix: now saves ZBUFFER capabilities to restore them on queries. This eliminates one possible d3d error when attempting use surface emulated mode.
fixed surface caps for "Ancient Evil", "Star Wars Shadows of the Empire", "Star Force Deluxe".
fixed surface handling in "Star Force Deluxe" that rely on a implicit PRIMARY surface created with 0 flags & 0 capabilities.
fixed handling of Flip operations when BACKBUFFER surface no longer exists, but there's a QueryInterface clone.
attempt to fix GetSystemPaletteEntries in windowed mode by using CreateHalftonePalette
d3d8/9 GetDisplayMode method duplicated to take in account the different prototype!!
added tentative wrapper for GetDCEx() call
initial coding for timers wrapping for time stretching

View File

@ -1,2 +0,0 @@

View File

@ -8,6 +8,7 @@
#include <ddraw.h>
#include "dxwnd.h"
#include "dxhook.h"
#include "ddrawi.h"
#include "dxwcore.hpp"
#include "stdio.h"
#include "hddraw.h"
@ -38,7 +39,7 @@ HRESULT WINAPI extGetDisplayMode(LPDIRECTDRAW, LPDDSURFACEDESC);
HRESULT WINAPI extGetGDISurface(LPDIRECTDRAW, LPDIRECTDRAWSURFACE *);
HRESULT WINAPI extEnumDisplayModes1(LPDIRECTDRAW, DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK);
HRESULT WINAPI extEnumDisplayModes4(LPDIRECTDRAW, DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMMODESCALLBACK2);
// STDMETHOD(Initialize)(THIS_ GUID FAR *) PURE;
HRESULT WINAPI extInitialize(LPDIRECTDRAW, FAR GUID *);
HRESULT WINAPI extSetCooperativeLevel(void *, HWND, DWORD);
HRESULT WINAPI extSetDisplayMode1(LPDIRECTDRAW, DWORD, DWORD, DWORD);
HRESULT WINAPI extSetDisplayMode2(LPDIRECTDRAW, DWORD, DWORD, DWORD, DWORD, DWORD);
@ -138,7 +139,7 @@ GetGDISurface_Type pGetGDISurface;
GetMonitorFrequency_Type pGetMonitorFrequency;
GetScanLine_Type pGetScanLine;
GetVerticalBlankStatus_Type pGetVerticalBlankStatus;
//Initialize
Initialize_Type pInitialize;
RestoreDisplayMode_Type pRestoreDisplayMode;
SetCooperativeLevel_Type pSetCooperativeLevel;
SetDisplayMode1_Type pSetDisplayMode1;
@ -454,6 +455,8 @@ BOOL isPaletteUpdated;
void mySetPalette(int dwstart, int dwcount, LPPALETTEENTRY lpentries)
{
int i;
extern DXWNDSTATUS *pStatus;
OutTraceD("mySetPalette DEBUG: BPP=%d GBitMask=%x count=%d\n",
dxw.ActualPixelFormat.dwRGBBitCount, dxw.ActualPixelFormat.dwGBitMask, dwcount);
@ -467,6 +470,9 @@ void mySetPalette(int dwstart, int dwcount, LPPALETTEENTRY lpentries)
OutTraceD("\n");
}
for(int idx=0; idx<dwcount; idx++)
pStatus->Palette[dwstart+idx]= lpentries[idx];
if (dxw.dwFlags3 & RGB2YUV){
int idx;
for(idx=0; idx<dwcount; idx++){
@ -1000,6 +1006,8 @@ static void HookDDSession(LPDIRECTDRAW *lplpdd, int dxversion)
SetHook((void *)(**(DWORD **)lplpdd + 48), extGetDisplayMode, (void **)&pGetDisplayMode, "GetDisplayMode(D)");
// IDIrectDraw::GetGDISurface
SetHook((void *)(**(DWORD **)lplpdd + 56), extGetGDISurface, (void **)&pGetGDISurface, "GetGDISurface(D)");
// IDIrectDraw::Initialize
SetHook((void *)(**(DWORD **)lplpdd + 72), extInitialize, (void **)&pInitialize, "Initialize(D)");
// IDIrectDraw::SetCooperativeLevel
SetHook((void *)(**(DWORD **)lplpdd + 80), extSetCooperativeLevel, (void **)&pSetCooperativeLevel, "SetCooperativeLevel(D)");
// IDIrectDraw::SetDisplayMode
@ -1035,8 +1043,6 @@ static void HookDDSession(LPDIRECTDRAW *lplpdd, int dxversion)
SetHook((void *)(**(DWORD **)lplpdd + 64), extGetScanLineProxy, (void **)&pGetScanLine, "GetScanLine(D)");
// IDIrectDraw::GetVerticalBlankStatus
SetHook((void *)(**(DWORD **)lplpdd + 68), extGetVerticalBlankStatusProxy, (void **)&pGetVerticalBlankStatus, "GetVerticalBlankStatus(D)");
// IDIrectDraw::Initialize
// offset 72: Undocumented
// IDIrectDraw::RestoreDisplayMode
SetHook((void *)(**(DWORD **)lplpdd + 76), extRestoreDisplayModeProxy, (void **)&pRestoreDisplayMode, "RestoreDisplayMode(D)");
// IDIrectDraw::GetAvailableVidMem
@ -1364,6 +1370,57 @@ static void HookDDSurfaceGeneric(LPDIRECTDRAWSURFACE *lplpdds, int dxversion)
SetHook((void *)(**(DWORD **)lplpdds + 140), extUpdateOverlayZOrderProxy, (void **)&pUpdateOverlayZOrder, "UpdateOverlayZOrder(S)");
}
/* ------------------------------------------------------------------------------ */
// CleanRect:
// takes care of a corrupted RECT struct where some elements are not valid pointers.
// In this case, the whole RECT * variable is set to NULL, a value that is interpreted
// by directdraw functions as the whole surface area.
/* ------------------------------------------------------------------------------ */
static void CleanRect(RECT **lprect, int line)
{
__try {
// normally unharmful statements
if(*lprect){
int i;
i=(*lprect)->bottom;
i=(*lprect)->top;
i=(*lprect)->left;
i=(*lprect)->right;
}
}
__except(EXCEPTION_EXECUTE_HANDLER){
OutTraceE("Rectangle exception caught at %d: invalid RECT\n", __LINE__);
if(IsAssertEnabled) MessageBox(0, "Rectangle exception", "CleanRect", MB_OK | MB_ICONEXCLAMATION);
*lprect=NULL;
}
}
static void MaskCapsD(LPDDCAPS c1, LPDDCAPS c2)
{
FILE *capfile;
//char sBuf[80+1];
char token[20+1];
DWORD val;
OutTraceD("MaskCaps\n");
capfile=fopen("dxwnd.cap", "r");
if(!capfile) return;
while(TRUE){
if(fscanf(capfile, "%s=%x", token, &val)!=2) break;
if(!strcmp(token, "dwCaps")) c1->dwCaps &= val;
if(!strcmp(token, "dwCaps2")) c1->dwCaps2 &= val;
if(!strcmp(token, "dwCKeyCaps")) c1->dwCKeyCaps &= val;
if(!strcmp(token, "dwFXCaps")) c1->dwFXCaps &= val;
}
OutTraceD("MaskCaps(D-HW): caps=%x(%s) caps2=%x(%s) fxcaps=%x(%s) fxalphacaps=%x(%s) keycaps=%x(%s)\n",
c1->dwCaps, ExplainDDDCaps(c1->dwCaps),
c1->dwCaps2, ExplainDDDCaps2(c1->dwCaps2),
c1->dwFXCaps, ExplainDDFXCaps(c1->dwFXCaps),
c1->dwFXAlphaCaps, ExplainDDFXALPHACaps(c1->dwFXAlphaCaps),
c1->dwCKeyCaps, ExplainDDCKeyCaps(c1->dwCKeyCaps));
fclose(capfile);
}
/* ------------------------------------------------------------------------------ */
// directdraw method hooks
/* ------------------------------------------------------------------------------ */
@ -1376,13 +1433,13 @@ HRESULT WINAPI extGetCapsD(LPDIRECTDRAW lpdd, LPDDCAPS c1, LPDDCAPS c2)
if(res)
OutTraceE("GetCaps(D): ERROR res=%x(%s)\n", res, ExplainDDError(res));
else {
if (c1) OutTraceD("GetCaps(D-HW): caps=%x(%s) caps2=%x(%s)fxcaps=%x(%s) fxalphacaps=%x(%s) keycaps=%x(%s)\n",
if (c1) OutTraceD("GetCaps(D-HW): caps=%x(%s) caps2=%x(%s) fxcaps=%x(%s) fxalphacaps=%x(%s) keycaps=%x(%s)\n",
c1->dwCaps, ExplainDDDCaps(c1->dwCaps),
c1->dwCaps2, ExplainDDDCaps2(c1->dwCaps2),
c1->dwFXCaps, ExplainDDFXCaps(c1->dwFXCaps),
c1->dwFXAlphaCaps, ExplainDDFXALPHACaps(c1->dwFXAlphaCaps),
c1->dwCKeyCaps, ExplainDDCKeyCaps(c1->dwCKeyCaps));
if (c2) OutTraceD("GetCaps(D-SW): caps=%x(%s) caps2=%x(%s)fxcaps=%x(%s) fxalphacaps=%x(%s) keycaps=%x(%s)\n",
if (c2) OutTraceD("GetCaps(D-SW): caps=%x(%s) caps2=%x(%s) fxcaps=%x(%s) fxalphacaps=%x(%s) keycaps=%x(%s)\n",
c2->dwCaps, ExplainDDDCaps(c2->dwCaps),
c2->dwCaps2, ExplainDDDCaps2(c2->dwCaps2),
c2->dwFXCaps, ExplainDDFXCaps(c2->dwFXCaps),
@ -1390,12 +1447,28 @@ HRESULT WINAPI extGetCapsD(LPDIRECTDRAW lpdd, LPDDCAPS c1, LPDDCAPS c2)
c2->dwCKeyCaps, ExplainDDCKeyCaps(c2->dwCKeyCaps));
}
if((dxw.dwFlags3 & FORCESHEL) && c1) {
DDCAPS_DX7 swcaps; // DDCAPS_DX7 because it is the bigger in size
int size;
size=c1->dwSize;
if (!c2) {
memset(&swcaps, 0, sizeof(DDCAPS_DX7));
swcaps.dwSize=size;
c2=&swcaps;
res=(*pGetCapsD)(lpdd, NULL, c2);
}
memcpy((void *)c1, (void *)c2, size);
}
if((dxw.dwFlags3 & CAPMASK) && c1 && c2) MaskCapsD(c1, c2);
return res;
}
HRESULT WINAPI extDirectDrawCreate(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplpdd, IUnknown FAR *pu)
{
HRESULT res;
GUID FAR *lpPrivGuid = lpguid;
OutTraceD("DirectDrawCreate: guid=%x(%s)\n", lpguid, ExplainGUID(lpguid));
@ -1415,15 +1488,19 @@ HRESULT WINAPI extDirectDrawCreate(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplpdd, I
}
}
res = (*pDirectDrawCreate)(lpguid, lplpdd, pu);
if((dxw.dwFlags3 & FORCESHEL) && (lpguid==NULL)) lpPrivGuid=(GUID FAR *)DDCREATE_EMULATIONONLY;
res = (*pDirectDrawCreate)(lpPrivGuid, lplpdd, pu);
if(res) {
OutTraceE("DirectDrawCreate: ERROR res=%x(%s)\n", res, ExplainDDError(res));
return res;
}
if(dxw.dwFlags3 & COLORFIX) (*((DDRAWI_DIRECTDRAW_INT **)lplpdd))->lpLcl->dwAppHackFlags |= 0x800;
dxw.dwDDVersion=1;
char *mode;
switch ((DWORD)lpguid){
switch ((DWORD)lpPrivGuid){
case 0: mode="NULL"; break;
case DDCREATE_HARDWAREONLY: mode="DDCREATE_HARDWAREONLY"; break;
case DDCREATE_EMULATIONONLY: mode="DDCREATE_EMULATIONONLY"; break;
@ -1453,36 +1530,12 @@ HRESULT WINAPI extDirectDrawCreate(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplpdd, I
return 0;
}
/* ------------------------------------------------------------------------------ */
// CleanRect:
// takes care of a corrupted RECT struct where some elements are not valid pointers.
// In this case, the whole RECT * variable is set to NULL, a value that is interpreted
// by directdraw functions as the whole surface area.
/* ------------------------------------------------------------------------------ */
static void CleanRect(RECT **lprect, int line)
{
__try {
// normally unharmful statements
if(*lprect){
int i;
i=(*lprect)->bottom;
i=(*lprect)->top;
i=(*lprect)->left;
i=(*lprect)->right;
}
}
__except(EXCEPTION_EXECUTE_HANDLER){
OutTraceE("Rectangle exception caught at %d: invalid RECT\n", __LINE__);
if(IsAssertEnabled) MessageBox(0, "Rectangle exception", "CleanRect", MB_OK | MB_ICONEXCLAMATION);
*lprect=NULL;
}
}
HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *lpguid,
LPDIRECTDRAW FAR *lplpdd, REFIID iid, IUnknown FAR *pu)
{
HRESULT res;
GUID FAR *lpPrivGuid = lpguid;
OutTraceD("DirectDrawCreateEx: guid=%x(%s) refiid=%x\n", lpguid, ExplainGUID(lpguid), iid);
// v2.1.70: auto-hooking (just in case...)
@ -1505,15 +1558,19 @@ HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *lpguid,
}
}
res = (*pDirectDrawCreateEx)(lpguid, lplpdd, iid, pu);
if((dxw.dwFlags3 & FORCESHEL) && (lpguid==NULL)) lpPrivGuid=(GUID FAR *)DDCREATE_EMULATIONONLY;
res = (*pDirectDrawCreateEx)(lpPrivGuid, lplpdd, iid, pu);
if (res){
OutTraceD("DirectDrawCreateEx: res=%x(%s)\n",res, ExplainDDError(res));
return res;
}
if(dxw.dwFlags3 & COLORFIX) (*((DDRAWI_DIRECTDRAW_INT **)lplpdd))->lpLcl->dwAppHackFlags |= 0x800;
dxw.dwDDVersion=7;
char *mode;
switch ((DWORD)lpguid){
switch ((DWORD)lpPrivGuid){
case 0: mode="NULL"; break;
case DDCREATE_HARDWAREONLY: mode="DDCREATE_HARDWAREONLY"; break;
case DDCREATE_EMULATIONONLY: mode="DDCREATE_EMULATIONONLY"; break;
@ -1534,6 +1591,23 @@ HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *lpguid,
return 0;
}
HRESULT WINAPI extInitialize(LPDIRECTDRAW lpdd, GUID FAR *lpguid)
{
HRESULT res;
GUID FAR *lpPrivGuid = lpguid;
OutTraceD("Initialize: lpdd=%x guid=%x(%s)\n", lpdd, lpguid, ExplainGUID(lpguid));
if((dxw.dwFlags3 & FORCESHEL) && (lpguid==NULL)) lpPrivGuid=(GUID FAR *)DDCREATE_EMULATIONONLY;
res=(*pInitialize)(lpdd, lpPrivGuid);
if(dxw.dwFlags3 & COLORFIX) (((DDRAWI_DIRECTDRAW_INT *)lpdd))->lpLcl->dwAppHackFlags |= 0x800;
if(res) OutTraceE("Initialize ERROR: res=%x(%s)\n", res, ExplainDDError(res));
return res;
}
HRESULT WINAPI extQueryInterfaceD(void *lpdd, REFIID riid, LPVOID *obp)
{
HRESULT res;
@ -2081,6 +2155,7 @@ void FixSurfaceCapsAnalytic(LPDDSURFACEDESC2 lpddsd, int dxversion)
break;
case DDSCAPS_SYSTEMMEMORY|DDSCAPS_TEXTURE:
// Wargames Direct3D hw acceleration
// Star Wars Shadows of the Empire in RGB HEL mode
return;
break;
case DDSCAPS_TEXTURE:
@ -2117,7 +2192,8 @@ void FixSurfaceCapsAnalytic(LPDDSURFACEDESC2 lpddsd, int dxversion)
// Star Wars Shadows of the Empire
// seems to work both with/without SetPixFmt, but doesn't like DDSCAPS_SYSTEMMEMORY textures.
// Setting SetPixFmt makes bad alpha transparencies!
//lpddsd->ddsCaps.dwCaps = (DDSCAPS_TEXTURE|DDSCAPS_SYSTEMMEMORY|DDSCAPS_ALLOCONLOAD);
// DDSCAPS_VIDEOMEMORY doesn't work with HEL only! Better switch to DDSCAPS_SYSTEMMEMORY.
if (dxw.dwFlags3 & FORCESHEL) lpddsd->ddsCaps.dwCaps = (DDSCAPS_TEXTURE|DDSCAPS_SYSTEMMEMORY|DDSCAPS_ALLOCONLOAD);
//SetPixFmt(lpddsd);
return;
break;
@ -2188,6 +2264,21 @@ static void FixSurfaceCaps(LPDDSURFACEDESC2 lpddsd, int dxversion)
SetPixFmt(lpddsd);
return;
}
//// DDSCAPS_ALLOCONLOAD on VIDEOMEMORY can't be done when HAL is disabled - it returns DDERR_NODIRECTDRAWHW error
//if((lpddsd->dwFlags & DDSD_CAPS) &&
// ((lpddsd->ddsCaps.dwCaps & (DDSCAPS_TEXTURE|DDSCAPS_ALLOCONLOAD))==(DDSCAPS_TEXTURE|DDSCAPS_ALLOCONLOAD))) {
// if (dxw.dwFlags3 & FORCESHEL) lpddsd->ddsCaps.dwCaps = (DDSCAPS_TEXTURE|DDSCAPS_SYSTEMMEMORY|DDSCAPS_ALLOCONLOAD);
// return;
//}
// DDSCAPS_TEXTURE surfaces must be left untouched, unless you set FORCESHEL: in this case switch VIDEOMEMORY to SYSTEMMEMORY
if((lpddsd->dwFlags & DDSD_CAPS) && (lpddsd->ddsCaps.dwCaps & DDSCAPS_TEXTURE)){
if (dxw.dwFlags3 & FORCESHEL) {
lpddsd->ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY;
lpddsd->ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
}
// no further changes...
return;
}
if(lpddsd->dwFlags & DDSD_ZBUFFERBITDEPTH){
lpddsd->dwFlags &= ~DDSD_PIXELFORMAT;
}
@ -2202,6 +2293,10 @@ static void FixSurfaceCaps(LPDDSURFACEDESC2 lpddsd, int dxversion)
(lpddsd->ddsCaps.dwCaps == (DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY))){
return;
}
if(((lpddsd->dwFlags & (DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT)) == (DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT)) &&
(lpddsd->ddsCaps.dwCaps == (DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY))){
return;
}
// default case: adjust pixel format
OutTraceB("FixSurfaceCaps: suppress DDSCAPS_VIDEOMEMORY case\n");
@ -2830,7 +2925,6 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect,
BOOL ToPrim, FromPrim, ToScreen, FromScreen;
//CkArg arg;
ToPrim=dxw.IsAPrimarySurface(lpdds);
FromPrim=dxw.IsAPrimarySurface(lpddssrc);
ToScreen=ToPrim && !(dxw.dwFlags1 & EMULATESURFACE);
@ -2881,6 +2975,14 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect,
OutTrace(sLog);
}
// debug suppressions
if(ToPrim){
if(isFlipping)
if(dxw.dwFlags3 & NODDRAWFLIP) return DD_OK;
else
if(dxw.dwFlags3 & NODDRAWBLT) return DD_OK;
}
#ifdef ONEPIXELFIX
if (lpdestrect){
if ((lpdestrect->top == 0) && (lpdestrect->bottom == dxw.GetScreenHeight() -1)) lpdestrect->bottom = dxw.GetScreenHeight();
@ -3266,8 +3368,7 @@ HRESULT WINAPI extCreatePalette(LPDIRECTDRAW lpdd, DWORD dwflags, LPPALETTEENTRY
HookDDPalette(lplpddp);
//if(dwflags & DDPCAPS_PRIMARYSURFACE){
if(dwflags & DDPCAPS_8BIT){ // v2.02.38
if((dwflags & (DDPCAPS_8BIT|DDPCAPS_PRIMARYSURFACE)) == (DDPCAPS_8BIT|DDPCAPS_PRIMARYSURFACE)){ // v2.02.39
mySetPalette(0, 256, lpddpa);
lpDDP = *lplpddp;
}

View File

@ -153,6 +153,18 @@ static void dx_ToggleLogging()
GetHookInfo()->isLogging=(dxw.dwTFlags & OUTTRACE);
}
static void SuppressIMEWindow()
{
OutTraceD("WindowProc: SUPPRESS IME\n");
typedef BOOL (WINAPI *ImmDisableIME_Type)(DWORD);
ImmDisableIME_Type pImmDisableIME;
HMODULE ImmLib;
ImmLib=(*pLoadLibraryA)("Imm32");
pImmDisableIME=(ImmDisableIME_Type)(*pGetProcAddress)(ImmLib,"ImmDisableIME");
(*pImmDisableIME)(-1);
CloseHandle(ImmLib);
}
void HookDlls(HMODULE module)
{
PIMAGE_NT_HEADERS pnth;
@ -627,6 +639,7 @@ void AdjustWindowPos(HWND hwnd, DWORD width, DWORD height)
OutTraceE("AdjustWindowPos: ERROR err=%d at %d\n", GetLastError(), __LINE__);
}
if(dxw.dwFlags2 & SUPPRESSIME) SuppressIMEWindow();
dxw.ShowBanner(hwnd);
return;
}
@ -909,15 +922,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
}
break;
case WM_NCCREATE:
if(dxw.dwFlags2 & SUPPRESSIME){
OutTraceD("WindowProc: SUPPRESS IME\n");
typedef BOOL (WINAPI *ImmDisableIME_Type)(DWORD);
ImmDisableIME_Type pImmDisableIME;
HMODULE ImmLib;
ImmLib=(*pLoadLibraryA)("Imm32");
pImmDisableIME=(ImmDisableIME_Type)(*pGetProcAddress)(ImmLib,"ImmDisableIME");
(*pImmDisableIME)(-1);
}
if(dxw.dwFlags2 & SUPPRESSIME) SuppressIMEWindow();
break;
case WM_IME_SETCONTEXT:
case WM_IME_NOTIFY:

View File

@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "dxwnd.h"
#include "dxwcore.hpp"
#define VERSION "2.02.38"
#define VERSION "2.02.39"
#define DDTHREADLOCK 1

Binary file not shown.

View File

@ -220,10 +220,6 @@
RelativePath=".\advapi.cpp"
>
</File>
<File
RelativePath=".\analytic.cpp"
>
</File>
<File
RelativePath=".\ddraw.cpp"
>

View File

@ -816,6 +816,7 @@ BOOL WINAPI extGDIBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
res=0;
if (OBJ_DC == GetObjectType(hdcDest)){
if (dxw.HandleFPS()) return TRUE;
if (dxw.dwFlags3 & NOGDIBLT) return TRUE;
if(dxw.IsFullScreen()){
int nWDest, nHDest;
nWDest= nWidth;
@ -862,6 +863,7 @@ BOOL WINAPI extGDIPatBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
if (OBJ_DC == GetObjectType(hdcDest)){
IsToScreen=TRUE;
if (dxw.HandleFPS()) return TRUE;
if (dxw.dwFlags3 & NOGDIBLT) return TRUE;
if (dxw.IsFullScreen()){
dxw.MapClient(&nXDest, &nYDest, &nWidth, &nHeight);
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest);
@ -897,6 +899,7 @@ BOOL WINAPI extGDIStretchBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, in
IsToScreen=FALSE;
if (OBJ_DC == GetObjectType(hdcDest)){
if (dxw.HandleFPS()) return TRUE;
if (dxw.dwFlags3 & NOGDIBLT) return TRUE;
IsToScreen=TRUE;
if(dxw.IsFullScreen()){
dxw.MapClient(&nXDest, &nYDest, &nWidth, &nHeight);

View File

@ -60,7 +60,7 @@ extern GetGDISurface_Type pGetGDISurface;
extern GetMonitorFrequency_Type pGetMonitorFrequency;
extern GetScanLine_Type pGetScanLine;
extern GetVerticalBlankStatus_Type pGetVerticalBlankStatus;
// missing Initialize ...
extern Initialize_Type pInitialize;
extern RestoreDisplayMode_Type pRestoreDisplayMode;
extern SetCooperativeLevel_Type pSetCooperativeLevel;
extern SetDisplayMode1_Type pSetDisplayMode1;
@ -658,6 +658,19 @@ ULONG WINAPI extReleaseDProxy(LPDIRECTDRAW lpdd)
return ref;
}
HRESULT WINAPI extInitializeProxy(LPDIRECTDRAW lpdd, GUID FAR *lpguid)
{
HRESULT res;
GUID FAR *lpPrivGuid = lpguid;
OutTraceD("Initialize: lpdd=%x guid=%x(%s)\n", lpdd, lpguid, ExplainGUID(lpguid));
res=(*pInitialize)(lpdd, lpPrivGuid);
if(res) OutTraceE("Initialize ERROR: res=%x(%s)\n", res, ExplainDDError(res));
return res;
}
HRESULT WINAPI extCreateClipperProxy(LPDIRECTDRAW lpdd, DWORD dwflags, LPDIRECTDRAWCLIPPER FAR* lplpDDClipper, IUnknown FAR* pUnkOuter)
{
HRESULT res;
@ -1711,7 +1724,7 @@ static void HookDDSessionProxy(LPDIRECTDRAW *lplpdd, int dxVersion)
// IDIrectDraw::GetVerticalBlankStatus
SetHook((void *)(**(DWORD **)lplpdd + 68), extGetVerticalBlankStatusProxy, (void **)&pGetVerticalBlankStatus, "GetVerticalBlankStatus(D)");
// IDIrectDraw::Initialize
// offset 72: Undocumented
SetHook((void *)(**(DWORD **)lplpdd + 72), extInitializeProxy, (void **)&pInitialize, "Initialize(D)");
// IDIrectDraw::RestoreDisplayMode
SetHook((void *)(**(DWORD **)lplpdd + 76), extRestoreDisplayModeProxy, (void **)&pRestoreDisplayMode, "RestoreDisplayMode(D)");
if (dxVersion >= 2){

View File

@ -74,6 +74,7 @@ extern HRESULT WINAPI extGetFourCCCodesProxy(LPDIRECTDRAW, LPDWORD, LPDWORD);
extern HRESULT WINAPI extTestCooperativeLevelProxy(LPDIRECTDRAW);
extern HRESULT WINAPI extEnumSurfacesProxy1(LPDIRECTDRAW, DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMSURFACESCALLBACK);
extern HRESULT WINAPI extEnumSurfacesProxy4(LPDIRECTDRAW, DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMSURFACESCALLBACK2);
extern HRESULT WINAPI extInitializeProxy(LPDIRECTDRAW, GUID FAR *);
// DirectDraw Clipper Proxed methods

View File

@ -42,7 +42,7 @@ typedef HRESULT (WINAPI *GetGDISurface_Type)(LPDIRECTDRAW, LPDIRECTDRAWSURFACE *
typedef HRESULT (WINAPI *GetMonitorFrequency_Type)(LPDIRECTDRAW, LPDWORD);
typedef HRESULT (WINAPI *GetScanLine_Type)(LPDIRECTDRAW, LPDWORD);
typedef HRESULT (WINAPI *GetVerticalBlankStatus_Type)(LPDIRECTDRAW, LPBOOL);
// STDMETHOD(Initialize)(THIS_ GUID FAR *) PURE;
typedef HRESULT (WINAPI *Initialize_Type)(LPDIRECTDRAW, GUID FAR *);
typedef HRESULT (WINAPI *RestoreDisplayMode_Type)(LPDIRECTDRAW);
typedef HRESULT (WINAPI *SetCooperativeLevel_Type)(void *, HWND, DWORD);
typedef HRESULT (WINAPI *SetDisplayMode2_Type)(LPDIRECTDRAW, DWORD, DWORD, DWORD, DWORD, DWORD);

View File

@ -1304,19 +1304,18 @@ BOOL WINAPI extClipCursor(RECT *lpRectArg)
if(dxw.dwFlags1 & MODIFYMOUSE){
// save desired clip region
// v2.02.39: fix - do not attempt to write to NULL lpRect
if (lpRect) {
ClipRegion=*lpRectArg;
lpClipRegion=&ClipRegion;
*lpRect=dxw.MapWindowRect(lpRect);
}
else
lpClipRegion=NULL;
*lpRect=dxw.MapWindowRect(lpRect);
}
if (pClipCursor) res=(*pClipCursor)(lpRect);
OutTraceD("ClipCursor: rect=(%d,%d)-(%d,%d) res=%x\n",
lpRect->left,lpRect->top,lpRect->right,lpRect->bottom, res);
if (lpRect) OutTraceD("ClipCursor: REMAPPED rect=(%d,%d)-(%d,%d) res=%x\n", lpRect->left,lpRect->top,lpRect->right,lpRect->bottom, res);
return TRUE;
}

View File

@ -1,24 +0,0 @@
[target]
title0=007 NightFire
path0=D:\Games\007_NightFire\Bond.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134234146
flagg0=134217728
flagh0=65556
flagi0=0
tflag0=67
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=101 The Airborne Invasion of Normandy
path0=D:\Games\101air\101.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134234146
flagg0=134217728
flagh0=20
flagi0=0
tflag0=192
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Age of Empires III
path0=D:\Games\Age of Empires III\age3.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=-394125278
flagg0=134217728
flagh0=20
flagi0=0
tflag0=3
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Akuma Demon Spawn - Lamentation Sword
path0=D:\Games\Akuma Demon Spawn - Lamentation Sword (1999)\Akuma\Akuma.EXE
module0=
opengllib0=
ver0=0
coord0=0
flag0=134234146
flagg0=134217728
flagh0=20
flagi0=0
tflag0=64
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Ancient Evil demo
path0=D:\Games\AECSC\aecsc-demo.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=150994976
flagg0=1207959552
flagh0=25165844
flagi0=0
tflag0=259
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Army Men RTS
path0=D:\Games\Army Men RTS\amrts.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=671088676
flagg0=1207959552
flagh0=20
flagi0=0
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

View File

@ -1,24 +0,0 @@
[target]
title0=Attack of the Saucerman
path0=D:\Games\Attack of the Saucerman\attack of the saucerman.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217730
flagg0=134217728
flagh0=20
flagi0=0
tflag0=192
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Beyond Divinity
path0=D:\Games\Beyond Divinity\Div.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134234144
flagg0=134217728
flagh0=61
flagi0=0
tflag0=3
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Daikatana
path0=D:\Games\Daikatana\daikatana.exe
module0=
opengllib0=
ver0=12
coord0=0
flag0=269492738
flagg0=537002497
flagh0=20
flagi0=0
tflag0=2
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Devastation
path0=D:\Games\Devastation\System\Devastation.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217762
flagg0=1207959552
flagh0=16
flagi0=0
tflag0=67
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Diablo
path0=D:\Games\Diablo\Diablo.exe
module0=
opengllib0=
ver0=1
coord0=0
flag0=138428450
flagg0=1108344848
flagh0=20
flagi0=0
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=640
sizy0=480
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Doom Shareware for Windows 95
path0=D:\Games\Doom Shareware for Windows 95\Doom95.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217762
flagg0=134217728
flagh0=20
flagi0=0
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

View File

@ -1,24 +0,0 @@
[target]
title0=Dungeon Keeper II
path0=D:\Games\Dungeon Keeper 2\DKII.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=16418
flagg0=574619648
flagh0=20
flagi0=0
tflag0=263
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=150
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Dungeon Lords MMXII
path0=D:\Games\Dungeon Lords MMXII\dlords2012.exe
module0=
opengllib0=
ver0=0
coord0=2
flag0=-2013265886
flagg0=1207959552
flagh0=20
flagi0=0
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

View File

@ -1,24 +0,0 @@
[target]
title0=GTA 3
path0=D:\Games\GTA3\gta3.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134234150
flagg0=1207975952
flagh0=176
flagi0=0
tflag0=2
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

Binary file not shown.

View File

@ -1,24 +0,0 @@
[target]
title0=Grand Prix World
path0=D:\Games\Grand Prix World\gpwxp2.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134283428
flagg0=134217728
flagh0=29
flagi0=0
tflag0=3
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Hamsterball
path0=D:\Games\Hamsterball\Hamsterball.exe
module0=
opengllib0=
ver0=8
coord0=0
flag0=134217762
flagg0=1207959552
flagh0=20
flagi0=0
tflag0=323
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Heroes of Might and Magic IV
path0=D:\Games\Heroes of Might and Magic IV\heroes4i.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134283298
flagg0=1211121728
flagh0=65556
flagi0=0
tflag0=3
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Homeworld 2
path0=D:\Games\Homeworld2\Bin\Release\Homeworld2.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=671088642
flagg0=134217728
flagh0=477
flagi0=0
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

View File

@ -1,24 +0,0 @@
[target]
title0=JetMoto
path0=D:\Games\Jet_Moto\JETMOTO.EXE
module0=
opengllib0=
ver0=0
coord0=0
flag0=671088674
flagg0=1207959552
flagh0=20
flagi0=0
tflag0=64
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Kiss Psycho Circus
path0=D:\Games\Kiss\client.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217760
flagg0=1207959552
flagh0=20
flagi0=0
tflag0=67
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=L'Elefante a Strisce
path0=D:\Games\L'Elefante a Strisce\Pilots1I.EXE
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217762
flagg0=134217728
flagh0=20
flagi0=0
tflag0=64
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Land of the Dead
path0=D:\Games\Land of the Dead\System\LOTD.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217766
flagg0=1207959552
flagh0=20
flagi0=0
tflag0=64
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Mageslayer
path0=D:\Games\MAGE\MAGESLAY.EXE
module0=
opengllib0=
ver0=0
coord0=0
flag0=134234146
flagg0=134217760
flagh0=20
flagi0=0
tflag0=64
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Magic & Mayhem
path0=D:\Games\Magic_&_Mayhem\Chaos.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=138428450
flagg0=1275068416
flagh0=8388628
flagi0=0
tflag0=259
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Mirror's Edge
path0=D:\Games\Mirror's Edge\Binaries\MirrorsEdge.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=-2013265882
flagg0=1207959552
flagh0=2097172
flagi0=0
tflag0=15
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=6

View File

@ -1,24 +0,0 @@
[target]
title0=Praetorians
path0=D:\Games\Praetorians\Praetorians.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217760
flagg0=1207959552
flagh0=20
flagi0=0
tflag0=259
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Premier Manager 98
path0=D:\Games\Premier Manager 98\MANAGER.EXE
module0=
opengllib0=
ver0=0
coord0=0
flag0=671088674
flagg0=1207959552
flagh0=16
flagi0=0
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

View File

@ -1,24 +0,0 @@
[target]
title0=Primitive Wars
path0=D:\Games\Primitive Wars\Pw.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=402653218
flagg0=1207959552
flagh0=20
flagi0=0
tflag0=64
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Railroad Tycoon II
path0=D:\Games\Railroad.Tycoon.II\RT2.EXE
module0=
opengllib0=
ver0=0
coord0=0
flag0=2082
flagg0=143654912
flagh0=16
flagi0=0
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

View File

@ -1,24 +0,0 @@
[target]
title0=Rayman2Demo.exe
path0=D:\Games\Rayman2Demo\Rayman2Demo.exe
module0=
opengllib0=
ver0=1
coord0=0
flag0=939524129
flagg0=1207959552
flagh0=20
flagi0=0
tflag0=323
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Space Rangers
path0=D:\Games\Space Rangers\Rangers.exe
module0=
opengllib0=
ver0=1
coord0=0
flag0=134234146
flagg0=1207959552
flagh0=20
flagi0=0
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

View File

@ -1,24 +0,0 @@
[target]
title0=Star Wars Shadow of the Empire (DEMO)
path0=D:\Games\shadowsdemo\shadows.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217762
flagg0=1208483844
flagh0=25165844
flagi0=0
tflag0=275
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Star Wars Shadow of the Empire
path0=D:\Games\Star Wars Shadow of the Empire\game\SDATA\SHADOWS.EXE
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217762
flagg0=1476919296
flagh0=25166364
flagi0=0
tflag0=274
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=StarCraft
path0=D:\Games\Starcraft\StarCraft.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217762
flagg0=136314880
flagh0=20
flagi0=0
tflag0=64
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Talis Gear
path0=D:\Games\TailsGear078\DT_MAIN.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217760
flagg0=1207959552
flagh0=20
flagi0=0
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

View File

@ -1,24 +0,0 @@
[target]
title0=Theseus
path0=D:\Games\theseus\Theseus.exe
module0=
opengllib0=
ver0=8
coord0=0
flag0=134217730
flagg0=1207959552
flagh0=20
flagi0=0
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

View File

@ -1,24 +0,0 @@
[target]
title0=Total Annihilation Kingdoms
path0=D:\Games\Total Annihilation Kingdoms\Kingdoms.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134234146
flagg0=1073741840
flagh0=16
flagi0=0
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

View File

@ -1,24 +0,0 @@
[target]
title0=Vangers
path0=D:\Games\Vangers\road.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=402653219
flagg0=671088640
flagh0=20
flagi0=0
tflag0=67
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Wargames (demo)
path0=D:\Games\Wargames\wargames.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=268435618
flagg0=1207959552
flagh0=20
flagi0=0
tflag0=3
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=Warlords 3
path0=D:\Games\WARLORDS3\Darklord.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=-2147483102
flagg0=269484064
flagh0=532
flagi0=0
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=0
sizy0=0
maxfps0=0
initts0=0

View File

@ -1,24 +0,0 @@
[target]
title0=deadrising2otr.exe
path0=C:\Program Files (x86)\Capcom\Dead Rising 2 Off The Record\deadrising2otr.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=0
flagg0=134217728
flagh0=16
flagi0=0
tflag0=3
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0

View File

@ -0,0 +1,139 @@
// StatusDialog.cpp : implementation file
//
#include "stdafx.h"
#include "dxwndhost.h"
#include "PaletteDialog.h"
#include "bmpext.h"
// CPaletteDialog dialog
IMPLEMENT_DYNAMIC(CPaletteDialog, CDialog)
CPaletteDialog::CPaletteDialog(CWnd* pParent /*=NULL*/)
: CDialog(CPaletteDialog::IDD, pParent)
{
}
CPaletteDialog::~CPaletteDialog()
{
}
void CPaletteDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CPaletteDialog, CDialog)
ON_WM_TIMER()
END_MESSAGE_MAP()
#define IDPaletteTIMER 2
// CPaletteDialog message handlers
#if 0
void CPaletteDialog::OnTimer(UINT_PTR nIDEvent)
{
DXWNDSTATUS DxWndStatus;
int DxStatus;
TARGETMAP *Target;
CBitmap *cPal, *cMiniPal;
extern PRIVATEMAP *pTitles;
extern TARGETMAP *pTargets;
RECT Rect;
int h, w;
//CBitmap cMiniPal;
//cMiniPal.CreateCompatibleBitmap(this->GetDC(), 16, 16);
CWnd *Pix;
DxStatus=GetHookStatus(&DxWndStatus);
this->GetDC()->GetWindow()->GetWindowRect(&Rect);
h=Rect.bottom - Rect.top;
w=Rect.right - Rect.left;
cPal=(CBitmap *)this->GetDlgItem(IDC_PALETTECOLORS);
Pix=(CWnd *)this->GetDlgItem(IDC_PALETTEMAP);
if(DxStatus==DXW_RUNNING){
for(int row=0; row<16; row++)
for(int col=0; col<16; col++){
COLORREF color;
PALETTEENTRY *pe = &DxWndStatus.Palette[16*row+col];
//color=pe->peRed | (pe->peGreen << 8) | (pe->peBlue << 16);
color=RGB(pe->peRed, pe->peGreen, pe->peBlue);
//Pix->GetDC()->SetPixel(row, col, color);
//this->GetDC()->StretchBlt(0, 0, w, h, Pix->GetDC(), 0, 0, 16, 16, SRCCOPY);
this->GetDC()->SetPixel(row, col, color);
}
}
else
this->GetDC()->StretchBlt(0, 0, w, h, NULL, 0, 0, 0, 0, WHITENESS);
}
#else
void CPaletteDialog::OnTimer(UINT_PTR nIDEvent)
{
DXWNDSTATUS DxWndStatus;
int DxStatus;
extern PRIVATEMAP *pTitles;
extern TARGETMAP *pTargets;
RECT Rect;
int h, w;
CBitmap cBmp;
CBitmap* pBitmap;
CDC cMemDC;
cMemDC.CreateCompatibleDC(this->GetDC()); // Create the memory DC.
CBitmap* pOld = cMemDC.SelectObject(&cBmp);
pBitmap = cMemDC.SelectObject(pOld);
DxStatus=GetHookStatus(&DxWndStatus);
this->GetDC()->GetWindow()->GetWindowRect(&Rect);
h=Rect.bottom - Rect.top;
w=Rect.right - Rect.left;
CDib dib;
dib.ReadFromResource(IDB_PALETTE);
if(DxStatus==DXW_RUNNING){
for(int row=0; row<dib.Height(); row++){
for(int col=0; col<dib.Width(); col++){
PALETTEENTRY *pe = &DxWndStatus.Palette[16*row+col];
RGBQUAD rgbq;
rgbq.rgbBlue=pe->peBlue;
rgbq.rgbGreen=pe->peGreen;
rgbq.rgbRed=pe->peRed;
rgbq.rgbReserved=0;
dib.SetPixel(col, row, rgbq);
}
}
}
dib.Draw(this->GetDC(), CRect(0, 0, w, h), CRect(0, 0, 16, 16));
}
#endif
BOOL CPaletteDialog::OnInitDialog()
{
CDialog::OnInitDialog();
SetTimer(IDPaletteTIMER, 1000, NULL);
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CPaletteDialog::OnOK()
{
// TODO: Add your specialized code here and/or call the base class
KillTimer(IDPaletteTIMER);
// stop timer
CDialog::OnOK();
}

82
host/PaletteDialog.cpp Normal file
View File

@ -0,0 +1,82 @@
// StatusDialog.cpp : implementation file
//
#include "stdafx.h"
#include "dxwndhost.h"
#include "PaletteDialog.h"
#include "bmpext.h"
// CPaletteDialog dialog
IMPLEMENT_DYNAMIC(CPaletteDialog, CDialog)
CPaletteDialog::CPaletteDialog(CWnd* pParent /*=NULL*/)
: CDialog(CPaletteDialog::IDD, pParent)
{
}
CPaletteDialog::~CPaletteDialog()
{
}
void CPaletteDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CPaletteDialog, CDialog)
ON_WM_TIMER()
END_MESSAGE_MAP()
#define IDPaletteTIMER 2
// CPaletteDialog message handlers
void CPaletteDialog::OnTimer(UINT_PTR nIDEvent)
{
DXWNDSTATUS DxWndStatus;
int DxStatus;
//extern PRIVATEMAP *pTitles;
extern TARGETMAP *pTargets;
RECT Rect;
int h, w;
DxStatus=GetHookStatus(&DxWndStatus);
this->GetDC()->GetWindow()->GetClientRect(&Rect);
h=Rect.bottom - Rect.top;
w=Rect.right - Rect.left;
CDib dib;
dib.ReadFromResource(IDB_PALETTE);
if(DxStatus==DXW_RUNNING){
for(int row=0; row<16; row++){
for(int col=0; col<16; col++){
PALETTEENTRY *pe = &DxWndStatus.Palette[16*row+col];
RGBQUAD rgbq;
rgbq.rgbBlue=pe->peBlue;
rgbq.rgbGreen=pe->peGreen;
rgbq.rgbRed=pe->peRed;
rgbq.rgbReserved=0;
dib.SetPixel(col, row, rgbq);
}
}
}
dib.Draw(this->GetDC(), CRect(0, 0, w, h), CRect(0, 0, 16, 16));
}
BOOL CPaletteDialog::OnInitDialog()
{
CDialog::OnInitDialog();
SetTimer(IDPaletteTIMER, 200, NULL);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CPaletteDialog::OnOK()
{
// TODO: Add your specialized code here and/or call the base class
KillTimer(IDPaletteTIMER);
// stop timer
CDialog::OnOK();
}

27
host/PaletteDialog.h Normal file
View File

@ -0,0 +1,27 @@
#pragma once
// CPaletteDialog dialog
class CPaletteDialog : public CDialog
{
DECLARE_DYNAMIC(CPaletteDialog)
public:
CPaletteDialog(CWnd* pParent = NULL); // standard constructor
virtual ~CPaletteDialog();
// Dialog Data
enum { IDD = IDD_PALETTE };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnTimer(UINT_PTR nIDEvent);
public:
virtual BOOL OnInitDialog();
protected:
virtual void OnOK();
};

View File

@ -32,11 +32,13 @@
#define IDD_TAB_TIMING 156
#define IDD_TAB_WINDOW 157
#define IDD_TAB_EMPTY 158
#define IDB_PALETTE 158
#define IDD_TAB_OPENGL 159
#define IDD_TAB_COMPAT 160
#define IDD_TAB_GDI 161
#define IDD_TAB_COLOR 162
#define IDD_TAB_DEBUG 163
#define IDD_PALETTE 164
#define IDC_AUTO 300
#define IDC_DIRECTX1 301
#define IDC_DIRECTX7 302
@ -135,6 +137,7 @@
#define IDC_WINDOWIZE 1091
#define IDC_NOBANNER 1092
#define IDC_STARTDEBUG 1093
#define IDC_PALETTECOLORS 1093
#define IDC_WIREFRAME 1094
#define IDC_DISABLEGAMMARAMP 1095
#define IDC_FORCEWINRESIZE 1096
@ -145,11 +148,7 @@
#define IDC_SUPPRESSD3DEXT 1101
#define IDC_FULLRECTBLT 1102
#define IDC_TIMESPEED 1103
#define IDC_FULLRECTBLT2 1103
#define IDC_SURFACEWARN 1103
#define IDC_HOOKDLLS 1104
#define IDC_ANALITICALMODE 1104
#define IDC_ANALYTICMODE 1104
#define IDC_HOOKENABLED 1105
#define IDC_DESKTOPWORKAREA 1106
#define IDC_DESKTOPFULL 1107
@ -177,6 +176,17 @@
#define IDC_FILTERMESSAGES 1129
#define IDC_PEEKALLMESSAGES 1130
#define IDC_TRACEHOOKS 1131
#define IDC_FULLRECTBLT2 1132
#define IDC_SURFACEWARN 1133
#define IDC_ANALITICALMODE 1134
#define IDC_ANALYTICMODE 1135
#define IDC_CAPMASK 1136
#define IDC_FORCESHEL 1137
#define IDC_COLORFIX 1138
#define IDC_NODDRAWBLIT 1139
#define IDC_NODDRAWBLT 1139
#define IDC_NODDRAWFLIP 1140
#define IDC_NOGDIBLT 1141
#define ID_MODIFY 32771
#define ID_DELETE 32772
#define ID_ADD 32773
@ -218,15 +228,16 @@
#define ID_INDEX0_EXPORT 32821
#define ID_PEXPORT 32822
#define ID_PKILL 32823
#define ID_VIEW_PALETTE 32825
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 156
#define _APS_NEXT_COMMAND_VALUE 32825
#define _APS_NEXT_CONTROL_VALUE 1092
#define _APS_NEXT_RESOURCE_VALUE 159
#define _APS_NEXT_COMMAND_VALUE 32826
#define _APS_NEXT_CONTROL_VALUE 1095
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -38,6 +38,7 @@ void CStatusDialog::OnTimer(UINT_PTR nIDEvent)
int IconId;
LPCSTR Status;
char sMsg[1024];
char sMsg2[1024];
char sMsgBuf[80+1];
char DllVersion[21];
DXWNDSTATUS DxWndStatus;
@ -45,8 +46,11 @@ void CStatusDialog::OnTimer(UINT_PTR nIDEvent)
extern TARGETMAP *pTargets;
TARGETMAP *Target;
extern char *GetTSCaption(int);
int iPixelFormat;
PIXELFORMATDESCRIPTOR pfd;
CDialog::OnTimer(nIDEvent);
GetDllVersion(DllVersion);
DxStatus=GetHookStatus(&DxWndStatus);
switch (DxStatus){
case DXW_IDLE: IconId=IDI_DXIDLE; Status="DISABLED"; break;
@ -55,14 +59,29 @@ void CStatusDialog::OnTimer(UINT_PTR nIDEvent)
default: IconId=IDI_DXIDLE; Status="???"; break;
}
GetDllVersion(DllVersion);
// get the current pixel format index
//HDC myDC = this->GetDC()->m_hDC;
//iPixelFormat = GetPixelFormat(myDC);
iPixelFormat = 1;
HDC myDC = ::GetDC(::GetForegroundWindow());
//iPixelFormat = ::GetPixelFormat(myDC);
// obtain a detailed description of that pixel format
memset((void *)&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
DescribePixelFormat(myDC, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
sprintf_s(sMsg, 1024,
"DxWnd %s\n"
"PixelFormat=%d DEPTH=%d RGBA=(%d,%d,%d,%d)\n"
"Hook status: %s",
DllVersion, iPixelFormat, pfd.cColorBits, pfd.cRedBits, pfd.cGreenBits, pfd.cBlueBits, pfd.cAlphaBits, Status);
if(DxStatus==DXW_RUNNING){
Target=&pTargets[DxWndStatus.TaskIdx];
sprintf_s(sMsg, 1024,
"DxWnd %s\nHook status: %s\n"
"Running \"%s\"\nScreen = (%dx%d) %dBPP\n"
sprintf_s(sMsg2, 1024,
"FullScreen = %s\nDX version = %d\n"
"Logging = %s\n"
"Cursor = (%d,%d)",
@ -72,6 +91,7 @@ void CStatusDialog::OnTimer(UINT_PTR nIDEvent)
DxWndStatus.IsFullScreen ? "Yes":"No", DxWndStatus.DXVersion,
DxWndStatus.isLogging?"ON":"OFF",
DxWndStatus.CursorX, DxWndStatus.CursorY);
strcat(sMsg, sMsg2);
if(Target->flags2 & (SHOWFPS|SHOWFPSOVERLAY)){
sprintf(sMsgBuf, "\nFPS = %d", DxWndStatus.FPSCount);
strcat(sMsg, sMsgBuf);
@ -83,8 +103,6 @@ void CStatusDialog::OnTimer(UINT_PTR nIDEvent)
}
}
}
else
sprintf_s(sMsg, 1024, "DxWnd %s\nHook status: %s", DllVersion, Status);
this->SetDlgItemTextA(IDC_STATUSINFO, sMsg);
}

View File

@ -35,6 +35,10 @@ void CTabDebug::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_MARKBLIT, cTarget->m_MarkBlit);
DDX_Check(pDX, IDC_ANALYTICMODE, cTarget->m_AnalyticMode);
DDX_Check(pDX, IDC_SURFACEWARN, cTarget->m_SurfaceWarn);
DDX_Check(pDX, IDC_CAPMASK, cTarget->m_CapMask);
DDX_Check(pDX, IDC_NODDRAWBLT, cTarget->m_NoDDRAWBlt);
DDX_Check(pDX, IDC_NODDRAWFLIP, cTarget->m_NoDDRAWFlip);
DDX_Check(pDX, IDC_NOGDIBLT, cTarget->m_NoGDIBlt);
}
BEGIN_MESSAGE_MAP(CTabDebug, CDialog)

View File

@ -38,6 +38,8 @@ void CTabDirectX::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_NOPALETTEUPDATE, cTarget->m_NoPaletteUpdate);
DDX_Check(pDX, IDC_SETCOMPATIBILITY, cTarget->m_SetCompatibility);
DDX_Check(pDX, IDC_DISABLEHAL, cTarget->m_DisableHAL);
DDX_Check(pDX, IDC_FORCESHEL, cTarget->m_ForcesHEL);
DDX_Check(pDX, IDC_COLORFIX, cTarget->m_ColorFix);
//DDX_Check(pDX, IDC_SAVECAPS, cTarget->m_SaveCaps);
// DirectInput
DDX_Check(pDX, IDC_HOOKDI, cTarget->m_HookDI);

View File

@ -38,6 +38,8 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_SuppressD3DExt = FALSE;
m_SetCompatibility = TRUE;
m_DisableHAL = FALSE;
m_ForcesHEL = FALSE;
m_ColorFix = FALSE;
m_LockSysColors = FALSE;
m_ForceYUVtoRGB = FALSE;
m_ForceRGBtoYUV = FALSE;
@ -51,7 +53,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_Windowize = TRUE; // default true !!
m_HookDLLs = TRUE; // default true !!
m_HookEnabled = TRUE; // default true !!
m_EmulateRegistry = FALSE; // default true !!
m_EmulateRegistry = FALSE;
m_FullScreenOnly = FALSE;
m_FilterMessages = FALSE;
m_PeekAllMessages = FALSE;
@ -109,6 +111,10 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_FakeVersion = FALSE;
m_FullRectBlt = FALSE;
m_SurfaceWarn = FALSE;
m_CapMask = FALSE;
m_NoDDRAWBlt = FALSE;
m_NoDDRAWFlip = FALSE;
m_NoGDIBlt = FALSE;
m_AnalyticMode = FALSE;
m_NoPaletteUpdate = FALSE;
m_WireFrame = FALSE;

View File

@ -105,6 +105,10 @@ public:
BOOL m_FakeVersion;
BOOL m_FullRectBlt;
BOOL m_SurfaceWarn;
BOOL m_CapMask;
BOOL m_NoDDRAWBlt;
BOOL m_NoDDRAWFlip;
BOOL m_NoGDIBlt;
BOOL m_AnalyticMode;
BOOL m_NoPaletteUpdate;
BOOL m_LimitResources;
@ -114,6 +118,8 @@ public:
BOOL m_SuppressIME;
BOOL m_SetCompatibility;
BOOL m_DisableHAL;
BOOL m_ForcesHEL;
BOOL m_ColorFix;
BOOL m_LockSysColors;
BOOL m_SaveCaps;
BOOL m_SingleProcAffinity;

96
host/bmpext.h Normal file
View File

@ -0,0 +1,96 @@
#pragma once
#include "afxtempl.h"
//MakeRgn helper data definition
typedef CTypedPtrList< CPtrList, LPRECT > RECTLIST;
//////////////////////////////////////////////////////////////////////////
// DD Bitmap draw extensions class
class AFX_EXT_CLASS CDDBDrawEx
{
public:
CDDBDrawEx(CDC* pDC, CBitmap* pbmSrc, CBitmap* pbmBack = NULL);
virtual ~CDDBDrawEx();
void Fill(CRect& rDest);
void Draw(CRect& rDest, CPoint& pntSrc);
void DrawTransparent(CRect& rDest, CPoint& pntSrc, COLORREF crMask );
HRGN MakeRgn(COLORREF cTransparentColor = 0, COLORREF cTolerance = 0x101010);
private:
CDC* m_pDC;
CBitmap* m_pbmSrc;
CBitmap* m_pbmBack;
LPRGNDATA RectList2RGNDATA( RECTLIST& rl, RECT& rBound, int& iByteCount );
};
///////////////////////////////////////////////////////////////////////////
// DIB support classes
class CDibException
{
public:
//exception types: not enough memory, operation not supported, invalid pixel position
enum {E_NOMEM, E_NOTSUPP, E_INVPOS};
CDibException( int iReason ) : m_iReason(iReason) {}
static void Throw( int iReason ){ throw new CDibException(iReason); }
public:
int m_iReason;
};
class AFX_EXT_CLASS CDib
{
// Constructors
public:
CDib();
virtual ~CDib();
// Attributes
protected:
LPBYTE m_pBits;
LPBITMAPINFO m_pBMI;
public:
CPalette* m_pPalette;
public:
DWORD Width() const;
DWORD Height() const;
WORD NumColors( BITMAPINFOHEADER& bmiHeader ) const;
BOOL IsValid() const;
void SetPixel( int iX, int iY, RGBQUAD& rgbPixel );
RGBQUAD GetPixel(int iX, int iY);
private:
void AssertPosition( int iX, int iY );
DWORD PaletteSize() const;
// Operations
public:
BOOL Draw(CDC*, CRect& rectDC, CRect& rectDIB) const;
DWORD Save(CFile& file) const;
DWORD Read(CFile& file, BOOL bFromResource = FALSE );
DWORD ReadFromResource(UINT nResID);
void Invalidate();
// Implementation
protected:
BOOL CreatePalette();
void Free();
public:
HBITMAP CreateDDBitmap(CDC* pDC);
HBITMAP CreateDDBitmap( HDC hDC );
BOOL Compress(CDC* pDC, BOOL bCompress );
protected:
CDib& operator = (CDib& dib);
};

822
host/cdib.cpp Normal file
View File

@ -0,0 +1,822 @@
// cdib.cpp
// new version for WIN32
#include "stdafx.h"
#include "cdib.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_SERIAL(CDib, CObject, 0);
CDib::CDib()
{
m_hFile = NULL;
m_hBitmap = NULL;
m_hPalette = NULL;
m_nBmihAlloc = m_nImageAlloc = noAlloc;
Empty();
}
CDib::CDib(CSize size, int nBitCount)
{
m_hFile = NULL;
m_hBitmap = NULL;
m_hPalette = NULL;
m_nBmihAlloc = m_nImageAlloc = noAlloc;
Empty();
ComputePaletteSize(nBitCount);
m_lpBMIH = (LPBITMAPINFOHEADER) new
char[sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * m_nColorTableEntries];
m_nBmihAlloc = crtAlloc;
m_lpBMIH->biSize = sizeof(BITMAPINFOHEADER);
m_lpBMIH->biWidth = size.cx;
m_lpBMIH->biHeight = size.cy;
m_lpBMIH->biPlanes = 1;
m_lpBMIH->biBitCount = nBitCount;
m_lpBMIH->biCompression = BI_RGB;
m_lpBMIH->biSizeImage = 0;
m_lpBMIH->biXPelsPerMeter = 0;
m_lpBMIH->biYPelsPerMeter = 0;
m_lpBMIH->biClrUsed = m_nColorTableEntries;
m_lpBMIH->biClrImportant = m_nColorTableEntries;
ComputeMetrics();
memset(m_lpvColorTable, 0, sizeof(RGBQUAD) * m_nColorTableEntries);
m_lpImage = NULL; // no data yet
}
CDib::~CDib()
{
Empty();
}
CSize CDib::GetDimensions()
{
if(m_lpBMIH == NULL) return CSize(0, 0);
return CSize((int) m_lpBMIH->biWidth, (int) m_lpBMIH->biHeight);
}
BOOL CDib::AttachMapFile(const char* strPathname, BOOL bShare) // for reading
{
// if we open the same file twice, Windows treats it as 2 separate files
// doesn't work with rare BMP files where # palette entries > biClrUsed
HANDLE hFile = ::CreateFile(strPathname, GENERIC_WRITE | GENERIC_READ,
bShare ? FILE_SHARE_READ : 0,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
ASSERT(hFile != INVALID_HANDLE_VALUE);
DWORD dwFileSize = ::GetFileSize(hFile, NULL);
HANDLE hMap = ::CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, 0, NULL);
DWORD dwErr = ::GetLastError();
if(hMap == NULL) {
AfxMessageBox("Empty bitmap file");
return FALSE;
}
LPVOID lpvFile = ::MapViewOfFile(hMap, FILE_MAP_WRITE, 0, 0, 0); // map whole file
ASSERT(lpvFile != NULL);
if(((LPBITMAPFILEHEADER) lpvFile)->bfType != 0x4d42) {
AfxMessageBox("Invalid bitmap file");
DetachMapFile();
return FALSE;
}
AttachMemory((LPBYTE) lpvFile + sizeof(BITMAPFILEHEADER));
m_lpvFile = lpvFile;
m_hFile = hFile;
m_hMap = hMap;
return TRUE;
}
BOOL CDib::CopyToMapFile(const char* strPathname)
{
// copies DIB to a new file, releases prior pointers
// if you previously used CreateSection, the HBITMAP will be NULL (and unusable)
BITMAPFILEHEADER bmfh;
bmfh.bfType = 0x4d42; // 'BM'
bmfh.bfSize = m_dwSizeImage + sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * m_nColorTableEntries + sizeof(BITMAPFILEHEADER);
// meaning of bfSize open to interpretation
bmfh.bfReserved1 = bmfh.bfReserved2 = 0;
bmfh.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * m_nColorTableEntries;
HANDLE hFile = ::CreateFile(strPathname, GENERIC_WRITE | GENERIC_READ, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
ASSERT(hFile != INVALID_HANDLE_VALUE);
int nSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * m_nColorTableEntries + m_dwSizeImage;
HANDLE hMap = ::CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, nSize, NULL);
DWORD dwErr = ::GetLastError();
ASSERT(hMap != NULL);
LPVOID lpvFile = ::MapViewOfFile(hMap, FILE_MAP_WRITE, 0, 0, 0); // map whole file
ASSERT(lpvFile != NULL);
LPBYTE lpbCurrent = (LPBYTE) lpvFile;
memcpy(lpbCurrent, &bmfh, sizeof(BITMAPFILEHEADER)); // file header
lpbCurrent += sizeof(BITMAPFILEHEADER);
LPBITMAPINFOHEADER lpBMIH = (LPBITMAPINFOHEADER) lpbCurrent;
memcpy(lpbCurrent, m_lpBMIH, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * m_nColorTableEntries); // info
lpbCurrent += sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * m_nColorTableEntries;
memcpy(lpbCurrent, m_lpImage, m_dwSizeImage); // bit image
DWORD dwSizeImage = m_dwSizeImage;
Empty();
m_dwSizeImage = dwSizeImage;
m_nBmihAlloc = m_nImageAlloc = noAlloc;
m_lpBMIH = lpBMIH;
m_lpImage = lpbCurrent;
m_hFile = hFile;
m_hMap = hMap;
m_lpvFile = lpvFile;
ComputePaletteSize(m_lpBMIH->biBitCount);
ComputeMetrics();
MakePalette();
return TRUE;
}
BOOL CDib::AttachMemory(LPVOID lpvMem, BOOL bMustDelete, HGLOBAL hGlobal)
{
// assumes contiguous BITMAPINFOHEADER, color table, image color table could be zero length
Empty();
m_hGlobal = hGlobal;
if(bMustDelete == FALSE) {
m_nBmihAlloc = noAlloc;
}
else {
m_nBmihAlloc = ((hGlobal == NULL) ? crtAlloc : heapAlloc);
}
try {
m_lpBMIH = (LPBITMAPINFOHEADER) lpvMem;
ComputeMetrics();
ComputePaletteSize(m_lpBMIH->biBitCount);
m_lpImage = (LPBYTE) m_lpvColorTable + sizeof(RGBQUAD) * m_nColorTableEntries;
MakePalette();
}
catch(CException* pe) {
AfxMessageBox("AttachMemory error");
pe->Delete();
return FALSE;
}
return TRUE;
}
UINT CDib::UsePalette(CDC* pDC, BOOL bBackground /* = FALSE */)
{
if(m_hPalette == NULL) return 0;
HDC hdc = pDC->GetSafeHdc();
::SelectPalette(hdc, m_hPalette, bBackground);
return ::RealizePalette(hdc);
}
BOOL CDib::Draw(CDC* pDC, CPoint origin, CSize size)
{
if(m_lpBMIH == NULL) return FALSE;
if(m_hPalette != NULL) {
::SelectPalette(pDC->GetSafeHdc(), m_hPalette, TRUE);
}
pDC->SetStretchBltMode(COLORONCOLOR);
::StretchDIBits(pDC->GetSafeHdc(), origin.x, origin.y, size.cx, size.cy,
0, 0, m_lpBMIH->biWidth, m_lpBMIH->biHeight,
m_lpImage, (LPBITMAPINFO) m_lpBMIH, DIB_RGB_COLORS, SRCCOPY);
return TRUE;
}
HBITMAP CDib::CreateSection(CDC* pDC /* = NULL */)
{
if(m_lpBMIH == NULL) return NULL;
if(m_lpImage != NULL) return NULL; // can only do this if image doesn't exist
m_hBitmap = ::CreateDIBSection(pDC->GetSafeHdc(), (LPBITMAPINFO) m_lpBMIH,
DIB_RGB_COLORS, (LPVOID*) &m_lpImage, NULL, 0);
ASSERT(m_lpImage != NULL);
return m_hBitmap;
}
BOOL CDib::MakePalette()
{
// makes a logical palette (m_hPalette) from the DIB's color table
// this palette will be selected and realized prior to drawing the DIB
if(m_nColorTableEntries == 0) return FALSE;
if(m_hPalette != NULL) ::DeleteObject(m_hPalette);
TRACE("CDib::MakePalette -- m_nColorTableEntries = %d\n", m_nColorTableEntries);
LPLOGPALETTE pLogPal = (LPLOGPALETTE) new char[2 * sizeof(WORD) +
m_nColorTableEntries * sizeof(PALETTEENTRY)];
pLogPal->palVersion = 0x300;
pLogPal->palNumEntries = m_nColorTableEntries;
LPRGBQUAD pDibQuad = (LPRGBQUAD) m_lpvColorTable;
for(int i = 0; i < m_nColorTableEntries; i++) {
pLogPal->palPalEntry[i].peRed = pDibQuad->rgbRed;
pLogPal->palPalEntry[i].peGreen = pDibQuad->rgbGreen;
pLogPal->palPalEntry[i].peBlue = pDibQuad->rgbBlue;
pLogPal->palPalEntry[i].peFlags = 0;
pDibQuad++;
}
m_hPalette = ::CreatePalette(pLogPal);
delete pLogPal;
return TRUE;
}
BOOL CDib::SetSystemPalette(CDC* pDC)
{
// if the DIB doesn't have a color table, we can use the system's halftone palette
if(m_nColorTableEntries != 0) return FALSE;
m_hPalette = ::CreateHalftonePalette(pDC->GetSafeHdc());
return TRUE;
}
HBITMAP CDib::CreateBitmap(CDC* pDC)
{
if (m_dwSizeImage == 0) return NULL;
HBITMAP hBitmap = ::CreateDIBitmap(pDC->GetSafeHdc(), m_lpBMIH,
CBM_INIT, m_lpImage, (LPBITMAPINFO) m_lpBMIH, DIB_RGB_COLORS);
ASSERT(hBitmap != NULL);
return hBitmap;
}
BOOL CDib::Compress(CDC* pDC, BOOL bCompress /* = TRUE */)
{
// 1. makes GDI bitmap from existing DIB
// 2. makes a new DIB from GDI bitmap with compression
// 3. cleans up the original DIB
// 4. puts the new DIB in the object
if((m_lpBMIH->biBitCount != 4) && (m_lpBMIH->biBitCount != 8)) return FALSE;
// compression supported only for 4 bpp and 8 bpp DIBs
if(m_hBitmap) return FALSE; // can't compress a DIB Section!
TRACE("Compress: original palette size = %d\n", m_nColorTableEntries);
HDC hdc = pDC->GetSafeHdc();
HPALETTE hOldPalette = ::SelectPalette(hdc, m_hPalette, FALSE);
HBITMAP hBitmap; // temporary
if((hBitmap = CreateBitmap(pDC)) == NULL) return FALSE;
int nSize = sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * m_nColorTableEntries;
LPBITMAPINFOHEADER lpBMIH = (LPBITMAPINFOHEADER) new char[nSize];
memcpy(lpBMIH, m_lpBMIH, nSize); // new header
if(bCompress) {
switch (lpBMIH->biBitCount) {
case 4:
lpBMIH->biCompression = BI_RLE4;
break;
case 8:
lpBMIH->biCompression = BI_RLE8;
break;
default:
ASSERT(FALSE);
}
// calls GetDIBits with null data pointer to get size of compressed DIB
if(!::GetDIBits(pDC->GetSafeHdc(), hBitmap, 0, (UINT) lpBMIH->biHeight, NULL, (LPBITMAPINFO) lpBMIH, DIB_RGB_COLORS)) {
AfxMessageBox("Unable to compress this DIB");
// probably a problem with the color table
::DeleteObject(hBitmap);
delete [] lpBMIH;
::SelectPalette(hdc, hOldPalette, FALSE);
return FALSE;
}
if (lpBMIH->biSizeImage == 0) {
AfxMessageBox("Driver can't do compression");
::DeleteObject(hBitmap);
delete [] lpBMIH;
::SelectPalette(hdc, hOldPalette, FALSE);
return FALSE;
}
else {
m_dwSizeImage = lpBMIH->biSizeImage;
}
}
else {
lpBMIH->biCompression = BI_RGB; // decompress
// figure the image size from the bitmap width and height
DWORD dwBytes = ((DWORD) lpBMIH->biWidth * lpBMIH->biBitCount) / 32;
if(((DWORD) lpBMIH->biWidth * lpBMIH->biBitCount) % 32) {
dwBytes++;
}
dwBytes *= 4;
m_dwSizeImage = dwBytes * lpBMIH->biHeight; // no compression
lpBMIH->biSizeImage = m_dwSizeImage;
}
// second GetDIBits call to make DIB
LPBYTE lpImage = (LPBYTE) new char[m_dwSizeImage];
VERIFY(::GetDIBits(pDC->GetSafeHdc(), hBitmap, 0, (UINT) lpBMIH->biHeight, lpImage, (LPBITMAPINFO) lpBMIH, DIB_RGB_COLORS));
TRACE("dib successfully created - height = %d\n", lpBMIH->biHeight);
::DeleteObject(hBitmap);
Empty();
m_nBmihAlloc = m_nImageAlloc = crtAlloc;
m_lpBMIH = lpBMIH;
m_lpImage = lpImage;
ComputeMetrics();
ComputePaletteSize(m_lpBMIH->biBitCount);
MakePalette();
::SelectPalette(hdc, hOldPalette, FALSE);
TRACE("Compress: new palette size = %d\n", m_nColorTableEntries);
return TRUE;
}
BOOL CDib::Read(CFile* pFile)
{
// 1. read file header to get size of info hdr + color table
// 2. read info hdr (to get image size) and color table
// 3. read image
// can't use bfSize in file header
Empty();
int nCount, nSize;
BITMAPFILEHEADER bmfh;
try {
nCount = pFile->Read((LPVOID) &bmfh, sizeof(BITMAPFILEHEADER));
//if(nCount != sizeof(BITMAPFILEHEADER)) {
// throw new CException;
//}
//if(bmfh.bfType != 0x4d42) {
// throw new CException;
//}
nSize = bmfh.bfOffBits - sizeof(BITMAPFILEHEADER);
m_lpBMIH = (LPBITMAPINFOHEADER) new char[nSize];
m_nBmihAlloc = m_nImageAlloc = crtAlloc;
nCount = pFile->Read(m_lpBMIH, nSize); // info hdr & color table
ComputeMetrics();
ComputePaletteSize(m_lpBMIH->biBitCount);
MakePalette();
m_lpImage = (LPBYTE) new char[m_dwSizeImage];
nCount = pFile->Read(m_lpImage, m_dwSizeImage); // image only
}
catch(CException* pe) {
AfxMessageBox("Read error");
pe->Delete();
return FALSE;
}
return TRUE;
}
BOOL CDib::ReadSection(CFile* pFile, CDC* pDC /* = NULL */)
{
// new function reads BMP from disk and creates a DIB section
// allows modification of bitmaps from disk
// 1. read file header to get size of info hdr + color table
// 2. read info hdr (to get image size) and color table
// 3. create DIB section based on header parms
// 4. read image into memory that CreateDibSection allocates
Empty();
int nCount, nSize;
BITMAPFILEHEADER bmfh;
try {
nCount = pFile->Read((LPVOID) &bmfh, sizeof(BITMAPFILEHEADER));
//if(nCount != sizeof(BITMAPFILEHEADER)) {
// throw new CException;
//}
//if(bmfh.bfType != 0x4d42) {
// throw new CException;
//}
nSize = bmfh.bfOffBits - sizeof(BITMAPFILEHEADER);
m_lpBMIH = (LPBITMAPINFOHEADER) new char[nSize];
m_nBmihAlloc = crtAlloc;
m_nImageAlloc = noAlloc;
nCount = pFile->Read(m_lpBMIH, nSize); // info hdr & color table
//if(m_lpBMIH->biCompression != BI_RGB) {
// throw new CException;
//}
ComputeMetrics();
ComputePaletteSize(m_lpBMIH->biBitCount);
MakePalette();
UsePalette(pDC);
m_hBitmap = ::CreateDIBSection(pDC->GetSafeHdc(), (LPBITMAPINFO) m_lpBMIH, DIB_RGB_COLORS, (LPVOID*) &m_lpImage, NULL, 0);
ASSERT(m_lpImage != NULL);
nCount = pFile->Read(m_lpImage, m_dwSizeImage); // image only
}
catch(CException* pe) {
AfxMessageBox("ReadSection error");
pe->Delete();
return FALSE;
}
return TRUE;
}
BOOL CDib::Write(CFile* pFile)
{
BITMAPFILEHEADER bmfh;
bmfh.bfType = 0x4d42; // 'BM'
int nSizeHdr = sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * m_nColorTableEntries;
bmfh.bfSize = 0;
// bmfh.bfSize = sizeof(BITMAPFILEHEADER) + nSizeHdr + m_dwSizeImage;
// meaning of bfSize open to interpretation (bytes, words, dwords?) -- we won't use it
bmfh.bfReserved1 = bmfh.bfReserved2 = 0;
bmfh.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * m_nColorTableEntries;
try {
pFile->Write((LPVOID) &bmfh, sizeof(BITMAPFILEHEADER));
pFile->Write((LPVOID) m_lpBMIH, nSizeHdr);
pFile->Write((LPVOID) m_lpImage, m_dwSizeImage);
}
catch(CException* pe) {
pe->Delete();
AfxMessageBox("write error");
return FALSE;
}
return TRUE;
}
void CDib::Serialize(CArchive& ar)
{
DWORD dwPos;
dwPos = ar.GetFile()->GetPosition();
TRACE("CDib::Serialize -- pos = %d\n", dwPos);
ar.Flush();
dwPos = ar.GetFile()->GetPosition();
TRACE("CDib::Serialize -- pos = %d\n", dwPos);
if(ar.IsStoring()) {
Write(ar.GetFile());
}
else {
Read(ar.GetFile());
}
}
// helper functions
void CDib::ComputePaletteSize(int nBitCount)
{
if((m_lpBMIH == NULL) || (m_lpBMIH->biClrUsed == 0)) {
switch(nBitCount) {
case 1:
m_nColorTableEntries = 2;
break;
case 4:
m_nColorTableEntries = 16;
break;
case 8:
m_nColorTableEntries = 256;
break;
case 16:
case 24:
case 32:
m_nColorTableEntries = 0;
break;
default:
ASSERT(FALSE);
}
}
else {
m_nColorTableEntries = m_lpBMIH->biClrUsed;
}
ASSERT((m_nColorTableEntries >= 0) && (m_nColorTableEntries <= 256));
}
void CDib::ComputeMetrics()
{
//if(m_lpBMIH->biSize != sizeof(BITMAPINFOHEADER)) {
// TRACE("Not a valid Windows bitmap -- probably an OS/2 bitmap\n");
// throw new CException;
//}
m_dwSizeImage = m_lpBMIH->biSizeImage;
if(m_dwSizeImage == 0) {
DWORD dwBytes = ((DWORD) m_lpBMIH->biWidth * m_lpBMIH->biBitCount) / 32;
if(((DWORD) m_lpBMIH->biWidth * m_lpBMIH->biBitCount) % 32) {
dwBytes++;
}
dwBytes *= 4;
m_dwSizeImage = dwBytes * m_lpBMIH->biHeight; // no compression
}
m_lpvColorTable = (LPBYTE) m_lpBMIH + sizeof(BITMAPINFOHEADER);
}
void CDib::Empty()
{
// this is supposed to clean up whatever is in the DIB
DetachMapFile();
if(m_nBmihAlloc == crtAlloc) {
delete [ ] m_lpBMIH;
}
else if(m_nBmihAlloc == heapAlloc) {
::GlobalUnlock(m_hGlobal);
::GlobalFree(m_hGlobal);
}
if(m_nImageAlloc == crtAlloc) delete [] m_lpImage;
if(m_hPalette != NULL) ::DeleteObject(m_hPalette);
if(m_hBitmap != NULL) ::DeleteObject(m_hBitmap);
m_nBmihAlloc = m_nImageAlloc = noAlloc;
m_hGlobal = NULL;
m_lpBMIH = NULL;
m_lpImage = NULL;
m_lpvColorTable = NULL;
m_nColorTableEntries = 0;
m_dwSizeImage = 0;
m_lpvFile = NULL;
m_hMap = NULL;
m_hFile = NULL;
m_hBitmap = NULL;
m_hPalette = NULL;
}
void CDib::DetachMapFile()
{
if(m_hFile == NULL) return;
::UnmapViewOfFile(m_lpvFile);
::CloseHandle(m_hMap);
::CloseHandle(m_hFile);
m_hFile = NULL;
}

61
host/cdib.h Normal file
View File

@ -0,0 +1,61 @@
#ifndef _INSIDE_VISUAL_CPP_CDIB
#define _INSIDE_VISUAL_CPP_CDIB
class CDib : public CObject
{
enum Alloc {noAlloc, crtAlloc, heapAlloc}; // applies to BITMAPINFOHEADER
DECLARE_SERIAL(CDib)
public:
LPVOID m_lpvColorTable;
HBITMAP m_hBitmap;
LPBYTE m_lpImage; // starting address of DIB bits
LPBITMAPINFOHEADER m_lpBMIH; // buffer containing the BITMAPINFOHEADER
private:
HGLOBAL m_hGlobal; // for external windows we need to free; could be allocated by this class or allocated externally
Alloc m_nBmihAlloc;
Alloc m_nImageAlloc;
DWORD m_dwSizeImage; // of bits—not BITMAPINFOHEADER or BITMAPFILEHEADER
int m_nColorTableEntries;
HANDLE m_hFile;
HANDLE m_hMap;
LPVOID m_lpvFile;
HPALETTE m_hPalette;
public:
CDib();
CDib(CSize size, int nBitCount); // builds BITMAPINFOHEADER
~CDib();
int GetSizeImage() {return m_dwSizeImage;}
int GetSizeHeader()
{return sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * m_nColorTableEntries;}
CSize GetDimensions();
BOOL AttachMapFile(const char* strPathname, BOOL bShare = FALSE);
BOOL CopyToMapFile(const char* strPathname);
BOOL AttachMemory(LPVOID lpvMem, BOOL bMustDelete = FALSE, HGLOBAL hGlobal = NULL);
BOOL Draw(CDC* pDC, CPoint origin, CSize size); // until we implement CreateDibSection
HBITMAP CreateSection(CDC* pDC = NULL);
UINT UsePalette(CDC* pDC, BOOL bBackground = FALSE);
BOOL MakePalette();
BOOL SetSystemPalette(CDC* pDC);
BOOL Compress(CDC* pDC, BOOL bCompress = TRUE); // FALSE means decompress
HBITMAP CreateBitmap(CDC* pDC);
BOOL Read(CFile* pFile);
BOOL ReadSection(CFile* pFile, CDC* pDC = NULL);
BOOL Write(CFile* pFile);
void Serialize(CArchive& ar);
void Empty();
private:
void DetachMapFile();
void ComputePaletteSize(int nBitCount);
void ComputeMetrics();
};
#endif // _INSIDE_VISUAL_CPP_CDIB

552
host/dib.cpp Normal file
View File

@ -0,0 +1,552 @@
#include "stdafx.h"
#include "bmpext.h"
//////////////////////////////////////////////////////////////////////////
// DIB support defines
#define BMIH_SIZE sizeof BITMAPINFOHEADER
#define BMIF_SIZE sizeof BITMAPFILEHEADER
/* DIB constants */
#define PALVERSION 0x300
/* Dib Header Marker - used in writing DIBs to files */
#define DIB_HEADER_MARKER ((WORD) ('M' << 8) | 'B')
// WIDTHBYTES performs DWORD-aligning of DIB scanlines. The "bits"
// parameter is the bit count for the scanline (biWidth * biBitCount),
// and this macro returns the number of DWORD-aligned bytes needed
// to hold those bits.
#define WIDTHBYTES(bits) (((bits) + 31) / 32 * 4)
/////////////////////////////////////////////////////////////////////////////
//CDib implementation
CDib::CDib() : m_pBMI(0), m_pBits(0), m_pPalette(0)
{}
CDib::~CDib()
{
Free();
}
DWORD CDib::Width() const
{
if (!m_pBMI)
return 0;
/* return the DIB width */
return m_pBMI->bmiHeader.biWidth;
}
DWORD CDib::Height() const
{
if (!m_pBMI)
return 0;
/* return the DIB height */
return m_pBMI->bmiHeader.biHeight;
}
WORD CDib::NumColors( BITMAPINFOHEADER& bmiHeader ) const
{
if ( bmiHeader.biClrUsed != 0)
return (WORD)bmiHeader.biClrUsed;
switch ( bmiHeader.biBitCount )
{
case 1:
return 2;
case 4:
return 16;
case 8:
return 256;
default:
return 0;
}
}
BOOL CDib::IsValid() const
{
return (m_pBits != NULL);
}
DWORD CDib::PaletteSize() const
{
return NumColors( m_pBMI->bmiHeader ) * sizeof(RGBQUAD);
}
BOOL CDib::Draw(CDC* pDC, CRect& rectDC, CRect& rectDIB) const
{
if ( !IsValid() )
return FALSE;
CPalette* pOldPal = NULL; // Previous palette
// Get the DIB's palette, then select it into DC
if (m_pPalette != NULL)
{
// Select as background since we have
// already realized in forground if needed
pOldPal = pDC->SelectPalette( m_pPalette, TRUE);
}
/* Make sure to use the stretching mode best for color pictures */
pDC->SetStretchBltMode( COLORONCOLOR );
/* Determine whether to call StretchDIBits() or SetDIBitsToDevice() */
BOOL bSuccess;
if( ( rectDC.Width() == rectDIB.Width() ) &&
( rectDC.Height() == rectDIB.Height() ) )
bSuccess = ::SetDIBitsToDevice(pDC->m_hDC, // hDC
rectDC.left, // DestX
rectDC.top, // DestY
rectDC.Width(), // nDestWidth
rectDC.Height(), // nDestHeight
rectDIB.left, // SrcX
(int)Height() -
rectDIB.top -
rectDIB.Height(), // SrcY
0, // nStartScan
(WORD)Height(), // nNumScans
m_pBits, // lpBits
m_pBMI, // lpBitsInfo
DIB_RGB_COLORS); // wUsage
else
bSuccess = ::StretchDIBits(pDC->m_hDC, // hDC
rectDC.left, // DestX
rectDC.top, // DestY
rectDC.Width(), // nDestWidth
rectDC.Height(), // nDestHeight
rectDIB.left, // SrcX
rectDIB.top, // SrcY
rectDIB.Width(), // wSrcWidth
rectDIB.Height(), // wSrcHeight
m_pBits, // lpBits
m_pBMI, // lpBitsInfo
DIB_RGB_COLORS, // wUsage
SRCCOPY); // dwROP
/* Reselect old palette */
if (pOldPal != NULL)
{
pDC->SelectPalette( pOldPal, TRUE);
}
return bSuccess;
}
void CDib::AssertPosition(int iX, int iY)
{
if( (iX < 0) || (iX > m_pBMI->bmiHeader.biWidth - 1) ||
(iY < 0) || (iY > m_pBMI->bmiHeader.biHeight - 1) )
{
//invalid image pixel position
CDibException::Throw( CDibException::E_INVPOS );
}
}
RGBQUAD CDib::GetPixel(int iX, int iY)
{
RGBQUAD rgbResult;
WORD wDummy;
//takeinto account that DIBit raws are reversed vertically
iY = (m_pBMI->bmiHeader.biHeight - 1) - iY; // GHO fix
//iY = m_pBMI->bmiHeader.biHeight - iY;
//assert pixel position
AssertPosition( iX, iY );
//access the destination pixel
int nRowBytes = m_pBMI->bmiHeader.biWidth * m_pBMI->bmiHeader.biBitCount;
nRowBytes = ( (nRowBytes + 31) & (~31) ) / 8;
switch( m_pBMI->bmiHeader.biBitCount )
{
case 1: //Monochrome
rgbResult = m_pBMI->bmiColors[ *(m_pBits + nRowBytes*iY + iX/8) & (0x80 >> iX%8) ];
break;
case 4:
rgbResult = m_pBMI->bmiColors[ *(m_pBits + nRowBytes*iY + iX/2) & ((iX&1) ? 0x0f : 0xf0) ];
break;
case 8:
rgbResult = m_pBMI->bmiColors[ *(m_pBits + nRowBytes*iY + iX) ];
break;
case 16:
wDummy = *(LPWORD)(m_pBits + nRowBytes*iY + iX*2);
rgbResult.rgbBlue = (BYTE)(0x001F & wDummy);
rgbResult.rgbGreen = (BYTE)(0x001F & (wDummy >> 5));
rgbResult.rgbRed = (BYTE)(0x001F & wDummy >> 10 );
break;
case 24:
rgbResult = *(LPRGBQUAD)(m_pBits + nRowBytes*iY + iX*3);
break;
case 32:
rgbResult = *(LPRGBQUAD)(m_pBits + nRowBytes*iY + iX*4);
break;
}
return rgbResult;
}
void CDib::SetPixel(int iX, int iY, RGBQUAD &rgbPixel)
{
WORD wDummy;
//takeinto account that DIBit raws are reversed vertically
iY = (m_pBMI->bmiHeader.biHeight - 1) - iY; // GHO fix
//iY = m_pBMI->bmiHeader.biHeight - iY;
//assert pixel position
AssertPosition( iX, iY );
//access the destination pixel
int nRowBytes = m_pBMI->bmiHeader.biWidth * m_pBMI->bmiHeader.biBitCount;
nRowBytes = ( (nRowBytes + 31) & (~31) ) / 8;
switch( m_pBMI->bmiHeader.biBitCount )
{
case 1:
case 4:
case 8:
//do not support this operation;
CDibException::Throw( CDibException::E_NOTSUPP );
break;
case 16:
wDummy = rgbPixel.rgbRed;
wDummy = wDummy << 5;
wDummy |= rgbPixel.rgbGreen;
wDummy = wDummy << 5;
wDummy |= rgbPixel.rgbBlue;
*(LPWORD)(m_pBits + nRowBytes*iY + iX*2) = wDummy;
break;
case 24:
*(LPRGBQUAD)(m_pBits + nRowBytes*iY + iX*3) = rgbPixel;
break;
case 32:
*(LPRGBQUAD)(m_pBits + nRowBytes*iY + iX*4) = rgbPixel;
break;
}
}
DWORD CDib::Save(CFile& file) const
{
BITMAPFILEHEADER bmfHdr; // Header for Bitmap file
DWORD dwDIBSize;
if (m_pBMI == NULL)
return 0;
// Fill in the fields of the file header
// Fill in file type (first 2 bytes must be "BM" for a bitmap)
bmfHdr.bfType = DIB_HEADER_MARKER; // "BM"
// Calculating the size of the DIB is a bit tricky (if we want to
// do it right). The easiest way to do this is to call GlobalSize()
// on our global handle, but since the size of our global memory may have
// been padded a few bytes, we may end up writing out a few too
// many bytes to the file (which may cause problems with some apps).
//
// So, instead let's calculate the size manually (if we can)
//
// First, find size of header plus size of color table. Since the
// first DWORD in both BITMAPINFOHEADER and BITMAPCOREHEADER conains
// the size of the structure, let's use this.
dwDIBSize = m_pBMI->bmiHeader.biSize + PaletteSize(); // Partial Calculation
// Now calculate the size of the image
if ((m_pBMI->bmiHeader.biCompression == BI_RLE8) || (m_pBMI->bmiHeader.biCompression == BI_RLE4))
{
// It's an RLE bitmap, we can't calculate size, so trust the
// biSizeImage field
dwDIBSize += m_pBMI->bmiHeader.biSizeImage;
}
else
{
DWORD dwBmBitsSize; // Size of Bitmap Bits only
// It's not RLE, so size is Width (DWORD aligned) * Height
dwBmBitsSize = WIDTHBYTES((m_pBMI->bmiHeader.biWidth)*((DWORD)m_pBMI->bmiHeader.biBitCount)) * m_pBMI->bmiHeader.biHeight;
dwDIBSize += dwBmBitsSize;
// Now, since we have calculated the correct size, why don't we
// fill in the biSizeImage field (this will fix any .BMP files which
// have this field incorrect).
m_pBMI->bmiHeader.biSizeImage = dwBmBitsSize;
}
// Calculate the file size by adding the DIB size to sizeof(BITMAPFILEHEADER)
bmfHdr.bfSize = dwDIBSize + BMIF_SIZE;
bmfHdr.bfReserved1 = 0;
bmfHdr.bfReserved2 = 0;
/*
* Now, calculate the offset the actual bitmap bits will be in
* the file -- It's the Bitmap file header plus the DIB header,
* plus the size of the color table.
*/
bmfHdr.bfOffBits = BMIF_SIZE + m_pBMI->bmiHeader.biSize + PaletteSize();
// Write the file header
file.Write( (LPSTR)&bmfHdr, BMIF_SIZE );
DWORD dwBytesSaved = BMIF_SIZE;
// Write the DIB header
UINT nCount = sizeof(BITMAPINFO) + PaletteSize();
dwBytesSaved += nCount;
file.Write(m_pBMI, nCount);
// Write the DIB bits
DWORD dwBytes = m_pBMI->bmiHeader.biBitCount * Width();
// Calculate the number of bytes per line
if (dwBytes%32 == 0)
dwBytes /= 8;
else
dwBytes = dwBytes/8 + (32-dwBytes%32)/8 + (((32-dwBytes%32)%8 > 0) ? 1 : 0);
nCount = dwBytes * Height();
dwBytesSaved += nCount;
//file.WriteHuge(m_pBits, nCount);
file.Write(m_pBits, nCount);
return dwBytesSaved;
}
DWORD CDib::Read(CFile& file, BOOL bFromResource)
{
DWORD dwReadBytes = 0;
DWORD dwLength = file.GetLength();
// Ensures no memory leaks will occur
Free();
BITMAPFILEHEADER bmfHeader;
BITMAPINFOHEADER bmiHeader;
if( !bFromResource )
{
// Go read the DIB file header and check if it's valid.
if( (dwReadBytes = file.Read((LPSTR)&bmfHeader, BMIF_SIZE)) != BMIF_SIZE)
return 0;
if(bmfHeader.bfType != DIB_HEADER_MARKER)
return 0;
}
// Read DIB header.
if( file.Read( &bmiHeader, BMIH_SIZE ) != BMIH_SIZE )
return 0;
dwReadBytes += BMIH_SIZE;
DWORD dwPalSize = NumColors( bmiHeader ) * sizeof RGBQUAD;
m_pBMI = (LPBITMAPINFO) new BYTE[BMIH_SIZE + dwPalSize];
memcpy( m_pBMI, &bmiHeader, BMIH_SIZE );
// read palette data
if( file.Read( m_pBMI->bmiColors, dwPalSize ) != dwPalSize )
return 0;
dwReadBytes += dwPalSize;
CreatePalette();
// Go read the bits.
m_pBits = new BYTE[ dwLength - dwReadBytes + 0x200]; // GHO fix: you need some more space who knows why...?
if (m_pBits == 0)
return 0;
if (file.Read( m_pBits, dwLength - dwReadBytes ) != (dwLength - dwReadBytes))
{
delete m_pBMI;
m_pBMI = NULL;
delete m_pBits;
m_pBits = NULL;
return 0;
}
dwReadBytes = dwLength;
return dwReadBytes;
}
DWORD CDib::ReadFromResource(UINT nResID)
{
DWORD dwResult = 0;
// Load from resource
HRSRC hbmres = FindResource( NULL, MAKEINTRESOURCE(nResID), RT_BITMAP );
CMemFile file;
HGLOBAL hGlob;
if (hbmres)
{
DWORD dwResSize = SizeofResource( NULL, hbmres );
file.Attach( (LPBYTE)LockResource( hGlob = LoadResource(NULL, hbmres) ), dwResSize );
dwResult = Read(file, TRUE);
file.Detach();
DeleteObject( hGlob );
}
return dwResult;
}
void CDib::Invalidate()
{
Free();
}
BOOL CDib::CreatePalette()
{
if ( !IsValid() )
return FALSE;
//get the number of colors in the DIB
WORD wNumColors = NumColors( m_pBMI->bmiHeader );
BOOL bResult = TRUE;
if (wNumColors != 0)
{
// allocate memory block for logical palette
LPLOGPALETTE pLogPal = (LPLOGPALETTE) new BYTE[ sizeof(LOGPALETTE) +
sizeof(PALETTEENTRY)*wNumColors ];
// if not enough memory, clean up and return NULL
if( pLogPal == 0 )
return FALSE;
// set version and number of palette entries
pLogPal->palVersion = PALVERSION;
pLogPal->palNumEntries = wNumColors;
for (WORD i = 0; i < wNumColors; i++)
{
pLogPal->palPalEntry[i].peRed = m_pBMI->bmiColors[i].rgbRed;
pLogPal->palPalEntry[i].peGreen = m_pBMI->bmiColors[i].rgbGreen;
pLogPal->palPalEntry[i].peBlue = m_pBMI->bmiColors[i].rgbBlue;
pLogPal->palPalEntry[i].peFlags = 0;
}
// create the palette and get handle to it
if (m_pPalette)
{
m_pPalette->DeleteObject();
delete m_pPalette;
}
m_pPalette = new CPalette;
bResult = m_pPalette->CreatePalette( pLogPal );
delete pLogPal;
}
return bResult;
}
void CDib::Free()
{
// Make sure all member data that might have been allocated is freed.
if(m_pBMI)
{
delete m_pBMI;
m_pBMI = NULL;
}
if(m_pBits)
{
delete m_pBits;
m_pBits = NULL;
}
if(m_pPalette)
{
m_pPalette->DeleteObject();
delete m_pPalette;
m_pPalette = NULL;
}
}
HBITMAP CDib::CreateDDBitmap( HDC hDC )
{
HBITMAP hBitmap = ::CreateDIBitmap( hDC, &m_pBMI->bmiHeader,
CBM_INIT, m_pBits, (LPBITMAPINFO)m_pBMI, DIB_RGB_COLORS);
ASSERT(hBitmap);
return hBitmap;
}
HBITMAP CDib::CreateDDBitmap(CDC* pDC)
{
return CreateDDBitmap( pDC->GetSafeHdc() );
}
BOOL CDib::Compress(CDC* pDC, BOOL bCompress )
{
// 1. makes GDI bitmap from existing DIB
// 2. makes a new DIB from GDI bitmap with compression
// 3. cleans up the original DIB
// 4. puts the new DIB in the object
if((m_pBMI->bmiHeader.biBitCount != 4) && (m_pBMI->bmiHeader.biBitCount != 8)) return FALSE;
// compression supported only for 4 bpp and 8 bpp DIBs
TRACE(_T("Compress: original palette size = %d\n"), NumColors(m_pBMI->bmiHeader) );
HDC hdc = pDC->GetSafeHdc();
CPalette* pOldPalette = pDC->SelectPalette( m_pPalette, TRUE);
HBITMAP hBitmap; // temporary
if((hBitmap = CreateDDBitmap(pDC)) == NULL) return FALSE;
int nSize = BMIF_SIZE + PaletteSize();
LPBITMAPINFO pBMI = (LPBITMAPINFO) new char[nSize];
memcpy(pBMI, &m_pBMI->bmiHeader, nSize); // new header
if(bCompress) {
switch (pBMI->bmiHeader.biBitCount) {
case 4:
pBMI->bmiHeader.biCompression = BI_RLE4;
break;
case 8:
pBMI->bmiHeader.biCompression = BI_RLE8;
break;
default:
ASSERT(FALSE);
}
// calls GetDIBits with null data pointer to get size of compressed DIB
if(!::GetDIBits(pDC->m_hDC, hBitmap, 0, (UINT) pBMI->bmiHeader.biHeight,
NULL, pBMI, DIB_RGB_COLORS)) {
AfxMessageBox(_T("Unable to compress this DIB"));
// probably a problem with the color table
::DeleteObject(hBitmap);
delete[] pBMI;
pDC->SelectPalette( pOldPalette, TRUE);
return FALSE;
}
if (pBMI->bmiHeader.biSizeImage == 0) {
AfxMessageBox(_T("Driver can't do compression"));
::DeleteObject(hBitmap);
delete[] pBMI;
pDC->SelectPalette( pOldPalette, TRUE);
return FALSE;
}
else {
m_pBMI->bmiHeader.biSizeImage = pBMI->bmiHeader.biSizeImage;
}
}
else {
pBMI->bmiHeader.biCompression = BI_RGB; // decompress
// figure the image size from the bitmap width and height
DWORD dwBytes = ((DWORD) pBMI->bmiHeader.biWidth * pBMI->bmiHeader.biBitCount) / 32;
if(((DWORD) pBMI->bmiHeader.biWidth * pBMI->bmiHeader.biBitCount) % 32) {
dwBytes++;
}
dwBytes *= 4;
m_pBMI->bmiHeader.biSizeImage = dwBytes * pBMI->bmiHeader.biHeight; // no compression
pBMI->bmiHeader.biSizeImage = m_pBMI->bmiHeader.biSizeImage;
}
// second GetDIBits call to make DIB
LPBYTE lpImage = (LPBYTE) new char[m_pBMI->bmiHeader.biSizeImage];
VERIFY(::GetDIBits(pDC->m_hDC, hBitmap, 0, (UINT) pBMI->bmiHeader.biHeight,
lpImage, pBMI, DIB_RGB_COLORS));
TRACE(_T("dib successfully created - height = %d\n"), pBMI->bmiHeader.biHeight);
::DeleteObject(hBitmap);
Free();
m_pBMI = pBMI;
m_pBits = lpImage;
CreatePalette();
pDC->SelectPalette( pOldPalette, TRUE );
TRACE(_T("Compress: new palette size = %d\n"), NumColors(m_pBMI->bmiHeader) );
return TRUE;
}

View File

@ -1,6 +1,11 @@
[window]
posx=1283
posy=380
sizx=320
sizy=200
[target]
title0=Last Bronx
path0=D:\Games\Last_Bronx\LB.EXE
title0=a10
path0=D:\Games\A10\A10Cuba.exe
module0=
opengllib0=
ver0=0
@ -9,7 +14,7 @@ flag0=134217762
flagg0=1207959552
flagh0=20
flagi0=0
tflag0=0
tflag0=64
initx0=0
inity0=0
minx0=0

Binary file not shown.

View File

@ -119,6 +119,7 @@ BEGIN
BEGIN
MENUITEM "Status", ID_VIEW_STATUS
MENUITEM "Time Slider", ID_VIEW_TIMESLIDER
MENUITEM "Palette", ID_VIEW_PALETTE
END
END
@ -316,7 +317,7 @@ BEGIN
GROUPBOX "Emulation",IDC_STATIC,7,109,98,61,WS_GROUP
CONTROL "Auto Primary Surface Refresh",IDC_AUTOREFRESH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,16,126,9
GROUPBOX "DirectDraw Surface handling",IDC_STATIC,112,3,181,167
CONTROL "VIDEO->SYSTEM surf. on fail",IDC_VIDEOTOSYSTEMMEM,
CONTROL "switch VIDEO to SYSTEM on fail",IDC_VIDEOTOSYSTEMMEM,
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,118,28,126,9
CONTROL "Suppress DX common errors",IDC_SUPPRESSDXERRORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,40,127,10
CONTROL "Make Backbuf attachable",IDC_BACKBUFATTACH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,52,119,10
@ -341,6 +342,8 @@ BEGIN
GROUPBOX "DirectInput",IDC_STATIC,7,172,286,61
CONTROL "Set AERO compatible mode",IDC_SETCOMPATIBILITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,100,109,12
CONTROL "Disable HAL support",IDC_DISABLEHAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,112,109,12
CONTROL "Forces HEL ",IDC_FORCESHEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,124,109,12
CONTROL "Win7 color fix",IDC_COLORFIX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,136,109,12
END
IDD_TAB_MOUSE DIALOGEX 0, 0, 300, 240
@ -465,17 +468,30 @@ IDD_TAB_DEBUG DIALOGEX 0, 0, 300, 240
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
GROUPBOX "Debug flags",IDC_STATIC,7,3,140,144
CONTROL "Simulate YUV to RGB color conv.",IDC_YUV2RGB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,36,119,9
CONTROL "Simulate RGB to YUV color conv.",IDC_RGB2YUV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,48,119,9
CONTROL "Highlight blit to primary",IDC_MARKBLIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,24,99,10
CONTROL "Full RECT Blit",IDC_FULLRECTBLT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,60,119,10
GROUPBOX "Debug flags",IDC_STATIC,7,7,140,140
CONTROL "Simulate YUV to RGB color conv.",IDC_YUV2RGB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,24,119,9
CONTROL "Simulate RGB to YUV color conv.",IDC_RGB2YUV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,36,119,9
CONTROL "Highlight blit to primary",IDC_MARKBLIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,126,99,10
CONTROL "Full RECT Blit",IDC_FULLRECTBLT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,114,119,10
GROUPBOX "debug mode logs",IDC_STATIC,7,154,139,79
CONTROL "Assert Dialog",IDC_ASSERT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,166,73,11
CONTROL "ddraw Proxy",IDC_DXPROXED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,178,73,9
CONTROL "Warning for analytic surface mode",IDC_SURFACEWARN,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,84,127,10
CONTROL "Analytic surface mode",IDC_ANALYTICMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,72,127,10
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,60,127,10
CONTROL "Analytic surface mode",IDC_ANALYTICMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,48,127,10
CONTROL "Enable capability mask",IDC_CAPMASK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,72,127,10
CONTROL "Suppress ddraw Blt to primary",IDC_NODDRAWBLT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,24,127,10
CONTROL "Suppress ddraw Flip",IDC_NODDRAWFLIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,36,127,10
CONTROL "Suppress GDI Blt",IDC_NOGDIBLT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,48,127,10
GROUPBOX "Visual flags",IDC_STATIC,153,7,140,139
END
IDD_PALETTE DIALOGEX 0, 0, 169, 167
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "DxWnd Palette"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "",IDC_PALETTECOLORS,"Static",SS_WHITEFRAME | SS_CENTERIMAGE,2,2,163,163
END
@ -653,6 +669,14 @@ BEGIN
TOPMARGIN, 7
BOTTOMMARGIN, 233
END
IDD_PALETTE, DIALOG
BEGIN
LEFTMARGIN, 2
RIGHTMARGIN, 167
TOPMARGIN, 2
BOTTOMMARGIN, 165
END
END
#endif // APSTUDIO_INVOKED
@ -779,6 +803,25 @@ END
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Italian (Italy) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
#ifdef _WIN32
LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_PALETTE BITMAP "res\\palette24.bmp"
#endif // Italian (Italy) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources

Binary file not shown.

View File

@ -219,6 +219,10 @@
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath=".\dib.cpp"
>
</File>
<File
RelativePath=".\dxTabCtrl.cpp"
>
@ -335,6 +339,14 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\PaletteDialog.cpp"
>
</File>
<File
RelativePath=".\PaletteDialog.h"
>
</File>
<File
RelativePath=".\StatusDialog.cpp"
>
@ -438,6 +450,10 @@
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath=".\cdib.h"
>
</File>
<File
RelativePath=".\dxTabCtrl.h"
>
@ -563,6 +579,10 @@
RelativePath=".\res\idr_main.ico"
>
</File>
<File
RelativePath=".\res\palette24.bmp"
>
</File>
<File
RelativePath=".\res\run+33.ico"
>

View File

@ -12,6 +12,7 @@
#include "TargetDlg.h"
#include "SystemTray.h"
#include "StatusDialog.h"
#include "PaletteDialog.h"
#include "TimeSliderDialog.h"
#ifdef _DEBUG
@ -62,6 +63,7 @@ BEGIN_MESSAGE_MAP(CDxwndhostView, CListView)
ON_COMMAND(ID_RUN, OnRun)
ON_COMMAND(ID_TRAY_RESTORE, OnTrayRestore)
ON_COMMAND(ID_VIEW_STATUS, OnViewStatus)
ON_COMMAND(ID_VIEW_PALETTE, OnViewPalette)
ON_COMMAND(ID_VIEW_TIMESLIDER, OnViewTimeSlider)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@ -156,6 +158,8 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
if(dlg->m_SuppressD3DExt) t->flags3 |= SUPPRESSD3DEXT;
if(dlg->m_SetCompatibility) t->flags2 |= SETCOMPATIBILITY;
if(dlg->m_DisableHAL) t->flags3 |= DISABLEHAL;
if(dlg->m_ForcesHEL) t->flags3 |= FORCESHEL;
if(dlg->m_ColorFix) t->flags3 |= COLORFIX;
if(dlg->m_LockSysColors) t->flags3 |= LOCKSYSCOLORS;
if(dlg->m_ForceYUVtoRGB) t->flags3 |= YUV2RGB;
if(dlg->m_ForceRGBtoYUV) t->flags3 |= RGB2YUV;
@ -214,6 +218,10 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
if(dlg->m_FullRectBlt) t->flags2 |= FULLRECTBLT;
if(dlg->m_NoPaletteUpdate) t->flags2 |= NOPALETTEUPDATE;
if(dlg->m_SurfaceWarn) t->flags3 |= SURFACEWARN;
if(dlg->m_CapMask) t->flags3 |= CAPMASK;
if(dlg->m_NoDDRAWBlt) t->flags3 |= NODDRAWBLT;
if(dlg->m_NoDDRAWFlip) t->flags3 |= NODDRAWFLIP;
if(dlg->m_NoGDIBlt) t->flags3 |= NOGDIBLT;
if(dlg->m_AnalyticMode) t->flags3 |= ANALYTICMODE;
t->initx = dlg->m_InitX;
t->inity = dlg->m_InitY;
@ -280,6 +288,8 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
dlg->m_SuppressD3DExt = t->flags3 & SUPPRESSD3DEXT ? 1 : 0;
dlg->m_SetCompatibility = t->flags2 & SETCOMPATIBILITY ? 1 : 0;
dlg->m_DisableHAL = t->flags3 & DISABLEHAL ? 1 : 0;
dlg->m_ForcesHEL = t->flags3 & FORCESHEL ? 1 : 0;
dlg->m_ColorFix = t->flags3 & COLORFIX ? 1 : 0;
dlg->m_LockSysColors = t->flags3 & LOCKSYSCOLORS ? 1 : 0;
dlg->m_ForceRGBtoYUV = t->flags3 & RGB2YUV ? 1 : 0;
dlg->m_ForceYUVtoRGB = t->flags3 & YUV2RGB ? 1 : 0;
@ -342,6 +352,10 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
dlg->m_FullRectBlt = t->flags2 & FULLRECTBLT ? 1 : 0;
dlg->m_NoPaletteUpdate = t->flags2 & NOPALETTEUPDATE ? 1 : 0;
dlg->m_SurfaceWarn = t->flags3 & SURFACEWARN ? 1 : 0;
dlg->m_CapMask = t->flags3 & CAPMASK ? 1 : 0;
dlg->m_NoDDRAWBlt = t->flags3 & NODDRAWBLT ? 1 : 0;
dlg->m_NoDDRAWFlip = t->flags3 & NODDRAWFLIP ? 1 : 0;
dlg->m_NoGDIBlt = t->flags3 & NOGDIBLT ? 1 : 0;
dlg->m_AnalyticMode = t->flags3 & ANALYTICMODE ? 1 : 0;
dlg->m_InitX = t->initx;
dlg->m_InitY = t->inity;
@ -1302,6 +1316,13 @@ void CDxwndhostView::OnViewStatus()
pDlg->ShowWindow(SW_SHOW);
}
void CDxwndhostView::OnViewPalette()
{
CPaletteDialog *pDlg = new CPaletteDialog();
BOOL ret = pDlg->Create(CPaletteDialog::IDD, this);
pDlg->ShowWindow(SW_SHOW);
}
void CDxwndhostView::OnViewTimeSlider()
{
CTimeSliderDialog *pDlg = new CTimeSliderDialog();

View File

@ -83,6 +83,7 @@ protected:
afx_msg void OnHookStop();
afx_msg void OnTrayRestore();
afx_msg void OnViewStatus();
afx_msg void OnViewPalette();
afx_msg void OnViewTimeSlider();
afx_msg void OnExit();
//}}AFX_MSG

BIN
host/palette.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

BIN
host/res/palette24.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B