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

v2_02_68_src

Former-commit-id: c8ffc4ffec494a3b2a136d9db7f1b2081caf11ad
This commit is contained in:
gho tik 2014-04-04 12:39:03 -04:00 committed by Refael ACkermann
parent 09630025a0
commit 54275fe767
26 changed files with 137 additions and 1230 deletions

View File

@ -134,6 +134,9 @@
#define NOTEXTURES 0x00040000 // Disabled (whitened) textures
#define RETURNNULLREF 0x00080000 // IDirectDraw::Release and IDDrawSurface::Release will always return 0 ref. counter
#define FINETIMING 0x00100000 // Fine timeslider coarse, by 10% steps ranging from about :2 to x2
#define NATIVERES 0x00200000 // Supports hardware native resolutions (depending on your PC)
#define SUPPORTSVGA 0x00400000 // Supports SVGA standard resolutions
#define SUPPORTHDTV 0x00800000 // Supports HDTV standard resolutions
// logging Tflags DWORD:
#define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2f553d6e224444a5db27c57f3c5fb947c1b89decb352a231d2a5f0dda299cd5f
size 468480
oid sha256:92c5b76a318057e79899b97495911e8dff4065bbdbabb3c1b6bf4cab149fd4aa
size 469504

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b1ab56aec078a3b4123d5d7fe8319b0c9baea51b7e987f61dfe5c61b47c1c56d
size 535552
oid sha256:d3ce05096cb9020cf4b2c5ade4ca3fa8bf2bf80773b8bd709d6c4c50e1fc653d
size 536064

View File

@ -1,26 +0,0 @@
[target]
title0=Final Odyssey
path0=D:\Games\Final odyssey\FinalOdy.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134267425
flagg0=134217728
flagh0=20
flagi0=4
tflag0=6146
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,26 +0,0 @@
[target]
title0=Flying Heroes
path0=D:\Games\Flying_Heroes\fh.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=151011364
flagg0=1207959552
flagh0=20
flagi0=4
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

@ -1,26 +0,0 @@
[target]
title0=Forsaken (HW)
path0=D:\Games\Forsaken\ForsakenHW.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=411058208
flagg0=1207959808
flagh0=20
flagi0=4
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

@ -1,26 +0,0 @@
[target]
title0=Genocide (REMIXED VERSION)
path0=D:\Games\genocide\remixed version (1999)\genocide\genocide.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134218272
flagg0=1207959552
flagh0=20
flagi0=4
tflag0=6402
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,26 +0,0 @@
[target]
title0=House of the Dead 2
path0=D:\Games\HOD2\Hod2.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=738197536
flagg0=1207959552
flagh0=20
flagi0=4
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

@ -1,26 +0,0 @@
[target]
title0=Hydro Thunder
path0=D:\Games\Hydro Thunder\hydro.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=704643104
flagg0=1207959552
flagh0=20
flagi0=4
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

@ -1,26 +0,0 @@
[target]
title0=Jazz Jackrabbit 2
path0=D:\Games\Jazz Jackrabbit 2\JAZZ2.EXE
module0=
opengllib0=
ver0=0
coord0=0
flag0=671097376
flagg0=1207959552
flagh0=20
flagi0=4
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

@ -3,13 +3,13 @@ title0=Vangers
path0=D:\Games\Vangers\road.exe
module0=
opengllib0=
ver0=1
ver0=0
coord0=0
flag0=136315424
flagg0=1207959552
flag0=402653219
flagg0=671088640
flagh0=20
flagi0=524288
tflag0=0
flagi0=0
tflag0=67
initx0=0
inity0=0
minx0=0
@ -22,5 +22,3 @@ sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

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

@ -0,0 +1,5 @@
[window]
posx=1423
posy=111
sizx=320
sizy=826

View File

@ -442,3 +442,6 @@ fixed log for D3D CreateDevice method, missing in some D3D interface versions
added wildcarded program path: now you needn't set the full pathname, but it is sufficient to specify the rightmost part, e.g. the executable filename.
added emulated mode color conversion from 32BPP to 16BPP. Despite the fact that the best way to run a 32BPP game is against a 32BPP desktop, now it is possible to downgrade 32BPP colors to 16BPP. This fixed the fact that 32BPP games run on a 16BPP desktop showed simply black screens (e.g. Baldur's Gate II)
fixed logic for EnumDisplayModes implementation: now screen resolutions and, for emulated mode only, also color depth, are generated by DxWnd and not derived directly from the real ones. This make it possible to fake support for very low screen resolutions (e.g. 320x200) on modern screens that support them no longer. This make "Genocide" running on both supported resolutions 320x200 and 320x240.
v2.02.68
added screen resolution choice: either a set of SVGA resolutions (mostly for 3:4 monitors), HDTV resolutions (mostly for 16:9 monitors) or the native set of resolutions offered by your monitor / video card.

View File

@ -3917,22 +3917,59 @@ typedef struct {
DWORD dwHeight;
} NewContext_Type;
static struct {
typedef struct {
int w;
int h;
}SupportedRes[7]= {
} SupportedRes_Type;
static SupportedRes_Type SupportedSVGARes[9]= {
{320,200},
{320,240},
{640,400},
{640,480},
{720,480},
{800,600},
{1024,768},
{1024,768}, // XGA
{1280,800}, // WXGA
{0,0}
};
static SupportedRes_Type SupportedHDTVRes[10]= {
{640,360}, // nHD
{720,480}, // DVD
{720,576}, // DV-PAL
{960,540}, // qHD
{1176,1000},
{1280,720}, // HD
{1440,960},
{1600,900}, // HD+
{1920,1080}, // FHD
{0,0}
};
static BOOL CheckResolutionLimit(LPDDSURFACEDESC lpDDSurfaceDesc)
{
#define HUGE 100000
DWORD maxw, maxh;
switch(dxw.MaxScreenRes){
case DXW_NO_LIMIT: maxw=HUGE; maxh=HUGE; break;
case DXW_LIMIT_320x200: maxw=320; maxh=200; break;
case DXW_LIMIT_640x480: maxw=640; maxh=480; break;
case DXW_LIMIT_800x600: maxw=800; maxh=600; break;
case DXW_LIMIT_1024x768: maxw=1024; maxh=768; break;
case DXW_LIMIT_1280x960: maxw=1280; maxh=960; break;
}
if((lpDDSurfaceDesc->dwWidth > maxw) || (lpDDSurfaceDesc->dwHeight > maxh)){
OutTraceDW("EnumDisplaySettings: hide device mode=(%d,%d)\n", maxw, maxh);
return TRUE;
}
return FALSE;
}
HRESULT WINAPI myEnumModesFilterDirect(LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext)
{
HRESULT res;
SupportedRes_Type *SupportedRes;
if ((((NewContext_Type *)lpContext)->dwHeight != lpDDSurfaceDesc->dwHeight) ||
(((NewContext_Type *)lpContext)->dwWidth != lpDDSurfaceDesc->dwWidth)) return DDENUMRET_OK;
@ -3951,25 +3988,12 @@ HRESULT WINAPI myEnumModesFilterDirect(LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID l
// tricky part: for each color depth related to current video resolution, fake each of the
// supported resolutions, unless is greater than maximum allowed
SupportedRes = (dxw.dwFlags4 & SUPPORTHDTV) ? &SupportedHDTVRes[0] : &SupportedSVGARes[0];
for (int ResIdx=0; SupportedRes[ResIdx].h; ResIdx++){
lpDDSurfaceDesc->dwHeight=SupportedRes[ResIdx].h;
lpDDSurfaceDesc->dwWidth=SupportedRes[ResIdx].w;
if(dxw.dwFlags4 & LIMITSCREENRES){
#define HUGE 100000
DWORD maxw, maxh;
switch(dxw.MaxScreenRes){
case DXW_NO_LIMIT: maxw=HUGE; maxh=HUGE; break;
case DXW_LIMIT_320x200: maxw=320; maxh=200; break;
case DXW_LIMIT_640x480: maxw=640; maxh=480; break;
case DXW_LIMIT_800x600: maxw=800; maxh=600; break;
case DXW_LIMIT_1024x768: maxw=1024; maxh=768; break;
case DXW_LIMIT_1280x960: maxw=1280; maxh=960; break;
}
if((lpDDSurfaceDesc->dwWidth > maxw) || (lpDDSurfaceDesc->dwHeight > maxh)){
OutTraceDW("EnumDisplaySettings: hide device mode=(%d,%d)\n", maxw, maxh);
return DDENUMRET_OK;
}
}
if((dxw.dwFlags4 & LIMITSCREENRES) && CheckResolutionLimit(lpDDSurfaceDesc)) return DDENUMRET_OK;
res=(*((NewContext_Type *)lpContext)->lpCallback)(lpDDSurfaceDesc, ((NewContext_Type *)lpContext)->lpContext);
OutTraceDW("EnumDisplayModes(D): proposed size[%d]=(%d,%d) res=%x\n", ResIdx, SupportedRes[ResIdx].w, SupportedRes[ResIdx].h, res);
if(res==DDENUMRET_CANCEL) break;
@ -3977,16 +4001,48 @@ HRESULT WINAPI myEnumModesFilterDirect(LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID l
return res;
}
HRESULT WINAPI myEnumModesFilterNative(LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext)
{
HRESULT res;
if (IsDebug) EnumModesCallbackDumper(lpDDSurfaceDesc, NULL);
if (dxw.dwFlags1 & PREVENTMAXIMIZE){
// if PREVENTMAXIMIZE is set, don't let the caller know about forbidden screen settings.
if((lpDDSurfaceDesc->dwHeight > dxw.GetScreenHeight()) ||
(lpDDSurfaceDesc->dwWidth > dxw.GetScreenWidth())){
OutTraceDW("EnumDisplayModes: skipping screen size=(%d,%d)\n", lpDDSurfaceDesc->dwHeight, lpDDSurfaceDesc->dwWidth);
return DDENUMRET_OK;
}
}
if((dxw.dwFlags4 & LIMITSCREENRES) && CheckResolutionLimit(lpDDSurfaceDesc)) return DDENUMRET_OK;
res=(*((NewContext_Type *)lpContext)->lpCallback)(lpDDSurfaceDesc, ((NewContext_Type *)lpContext)->lpContext);
OutTraceDW("EnumDisplayModes(D): proposed size=(%d,%d) res=%x\n", lpDDSurfaceDesc->dwWidth, lpDDSurfaceDesc->dwHeight, res);
return res;
}
HRESULT WINAPI extEnumDisplayModes(EnumDisplayModes1_Type pEnumDisplayModes, LPDIRECTDRAW lpdd, DWORD dwflags, LPDDSURFACEDESC lpddsd, LPVOID lpContext, LPDDENUMMODESCALLBACK cb)
{
HRESULT res;
SupportedRes_Type *SupportedRes;
NewContext_Type NewContext;
OutTraceDDRAW("EnumDisplayModes(D): lpdd=%x flags=%x lpddsd=%x callback=%x\n", lpdd, dwflags, lpddsd, cb);
if((dxw.dwFlags4 & NATIVERES)){
NewContext.dwWidth = 0;
NewContext.dwHeight = 0;
NewContext.lpContext=lpContext;
NewContext.lpCallback=cb;
res=(*pEnumDisplayModes)(lpdd, dwflags, lpddsd, &NewContext, myEnumModesFilterNative);
if(res) OutTraceE("EnumDisplayModes(D): ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
// note: extEnumDisplayModes serves both the EnumDisplayModes and EnumDisplayModes2 interfaces:
// they differ for the lpddsd argument that should point to either DDSURFACEDESC or DDSURFACEDESC2
// structures, but unification is possible if the lpddsd->dwSize is properly set and is left untouched.
if((dxw.dwFlags1 & EMULATESURFACE)){
int SupportedDepths[5]={8,16,24,32,0};
int ResIdx, DepthIdx;
@ -3997,6 +4053,7 @@ HRESULT WINAPI extEnumDisplayModes(EnumDisplayModes1_Type pEnumDisplayModes, LPD
if (lpddsd) EmuDesc.dwSize=lpddsd->dwSize; // sizeof either DDSURFACEDESC or DDSURFACEDESC2 !!!
else EmuDesc.dwSize = sizeof(DDSURFACEDESC2);
EmuDesc.dwFlags=DDSD_PIXELFORMAT|DDSD_REFRESHRATE|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PITCH;
SupportedRes = (dxw.dwFlags4 & SUPPORTHDTV) ? &SupportedHDTVRes[0] : &SupportedSVGARes[0];
for (ResIdx=0; SupportedRes[ResIdx].h; ResIdx++){
EmuDesc.dwHeight=SupportedRes[ResIdx].h;
EmuDesc.dwWidth=SupportedRes[ResIdx].w;

View File

@ -1,995 +0,0 @@
#include <windows.h>
#include <ddraw.h>
#include <stdio.h>
#include "dxwnd.h"
#include "dxwcore.hpp"
#include "hddraw.h"
typedef HRESULT (WINAPI *Lock_Type)(LPDIRECTDRAWSURFACE, LPRECT, LPDDSURFACEDESC, DWORD, HANDLE);
typedef HRESULT (WINAPI *Unlock4_Type)(LPDIRECTDRAWSURFACE, LPRECT);
typedef HRESULT (WINAPI *Unlock1_Type)(LPDIRECTDRAWSURFACE, LPVOID);
extern Lock_Type pLock;
extern Unlock4_Type pUnlockMethod(LPDIRECTDRAWSURFACE);
extern DWORD PaletteEntries[256];
extern DWORD *Palette16BPP;
extern char *ExplainDDError(DWORD);
extern int Set_dwSize_From_Surface(LPDIRECTDRAWSURFACE);
// just in case ....
#define SwitchdwSize(s) s.dwSize=(s.dwSize==sizeof(DDSURFACEDESC))?sizeof(DDSURFACEDESC2):sizeof(DDSURFACEDESC)
#define DXWNDDIRECTBLITTING 1
#define MARKBLITCOLOR32 0x00FFFF00
#define MARKBLITCOLOR16 0x0FF0
extern Blt_Type pBlt;
EmuBlt_Type pEmuBlt;
RevBlt_Type pRevBlt;
//--------------------------------------------------------------------------------------------//
// Emulated blitting procedures: fills a 32BPP surface from the content of 8BPP or 16BPP ones.
//--------------------------------------------------------------------------------------------//
static void MarkRect32(DWORD *dest, int w, int h, int destpitch)
{
int x, y;
for(x = 0; x < w; x ++) *(dest ++) = MARKBLITCOLOR32;
dest += destpitch;
for(y = 0; y < h-2; y ++){
*dest = MARKBLITCOLOR32;
dest += w-1;
*dest = MARKBLITCOLOR32;
dest += destpitch + 1;
}
for(x = 0; x < w; x ++) *(dest ++) = MARKBLITCOLOR32;
return;
}
static void MarkRect16(SHORT *dest, int w, int h, int destpitch)
{
int x, y;
for(x = 0; x < w; x ++) *(dest ++) = MARKBLITCOLOR16;
dest += destpitch;
for(y = 0; y < h-2; y ++){
*dest = MARKBLITCOLOR16;
dest += w-1;
*dest = MARKBLITCOLOR16;
dest += destpitch + 1;
}
for(x = 0; x < w; x ++) *(dest ++) = MARKBLITCOLOR16;
return;
}
static HRESULT WINAPI EmuBlt_8_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdestrect,
LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect, DWORD dwflags, LPVOID lpsurface)
{
HRESULT res;
BYTE *src8;
DWORD *dest, *dest0;
DDSURFACEDESC2 ddsd_src, ddsd_dst;
long srcpitch, destpitch;
DWORD x, y, w, h;
w = lpdestrect->right - lpdestrect->left;
h = lpdestrect->bottom - lpdestrect->top;
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
ddsd_dst.dwSize = Set_dwSize_From_Surface(lpddsdst);
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
if(res=(*pLock)(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
OutTraceE("EmuBlt8_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
memset(&ddsd_src,0,sizeof(DDSURFACEDESC2));
ddsd_src.dwSize = Set_dwSize_From_Surface(lpddssrc);
ddsd_src.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
if (lpsurface) { // already locked, just get info ....
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
OutTraceE("EmuBlt8_32: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
(*pUnlockMethod(lpddsdst))(lpddsdst, lpdestrect);
(*pUnlockMethod(lpddssrc))(lpddssrc, lpsrcrect);
return 0;
}
}
else {
if(res=(*pLock)(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
(*pUnlockMethod(lpddsdst))(lpddsdst,0);
OutTraceE("EmuBlt8_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return 0;
}
lpsurface=ddsd_src.lpSurface;
}
ddsd_dst.lPitch >>= 2;
dest = (DWORD *)ddsd_dst.lpSurface;
dest += lpdestrect->top*ddsd_dst.lPitch;
dest += lpdestrect->left;
destpitch = ddsd_dst.lPitch - w;
dest0 = dest;
src8 = (BYTE *)lpsurface;
src8 += lpsrcrect->top*ddsd_src.lPitch;
src8 += lpsrcrect->left;
srcpitch = ddsd_src.lPitch - w;
// OutTraceDW("DEBUG: h=%d w=%d src=%x dst=%x spitch=%d dpitch=%d\n",h,w,src8,dest,srcpitch,destpitch);
for(y = 0; y < h; y ++){
for(x = 0; x < w; x ++){
*(dest ++) = PaletteEntries[*(src8 ++)];
}
dest += destpitch;
src8 += srcpitch;
}
if(dxw.dwFlags3 & MARKBLIT) MarkRect32(dest0, w, h, destpitch);
#if 0
if(1 && IsTraceDDRAW) {
DWORD dwStats[256];
src8 = (BYTE *)lpsurface;
src8 += lpsrcrect->top*ddsd_src.lPitch;
src8 += lpsrcrect->left;
for(x = 0; x < 256; x ++) dwStats[x]=0;
for(y = 0; y < h; y ++){
for(x = 0; x < w; x ++){
dwStats[*(src8 ++)]++;
}
src8 += srcpitch;
}
OutTrace("Colors: ");
for(x = 0; x < 256; x ++) {
char sElement[8];
if (dwStats[x])
sprintf(sElement,"%x,", dwStats[x]);
else
strcpy(sElement, "_,");
OutTrace(sElement);
}
OutTrace("\n");
}
#endif
res=(*pUnlockMethod(lpddsdst))(lpddsdst, lpdestrect);
if (res) OutTraceE("EmuBlt8_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
res=(*pUnlockMethod(lpddssrc))(lpddssrc, lpsrcrect);
if (res) OutTraceE("EmuBlt8_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
return res;
}
static HRESULT WINAPI EmuBlt_16_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdestrect,
LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect, DWORD dwflags, LPVOID lpsurface)
{
HRESULT res;
WORD *src16;
DWORD *dest, *dest0;
DDSURFACEDESC2 ddsd_src, ddsd_dst;
long srcpitch, destpitch;
DWORD x, y, w, h;
w = lpdestrect->right - lpdestrect->left;
h = lpdestrect->bottom - lpdestrect->top;
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
ddsd_dst.dwSize = Set_dwSize_From_Surface(lpddsdst);
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
if(res=(*pLock)(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
OutTraceE("EmuBlt16_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
memset(&ddsd_src,0,sizeof(DDSURFACEDESC2));
ddsd_src.dwSize = Set_dwSize_From_Surface(lpddssrc);
ddsd_src.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
if (lpsurface) { // already locked, just get info ....
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
OutTraceE("EmuBlt16_32: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
(*pUnlockMethod(lpddsdst))(lpddsdst, lpdestrect);
(*pUnlockMethod(lpddssrc))(lpddssrc, lpsrcrect);
return 0;
}
}
else {
if(res=(*pLock)(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY|DDLOCK_WAIT, 0)) {
(*pUnlockMethod(lpddsdst))(lpddsdst,0);
OutTraceE("EmuBlt16_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
lpsurface=ddsd_src.lpSurface;
}
ddsd_dst.lPitch >>= 2;
dest = (DWORD *)ddsd_dst.lpSurface;
dest += lpdestrect->top*ddsd_dst.lPitch;
dest += lpdestrect->left;
destpitch = ddsd_dst.lPitch - w;
dest0 = dest;
ddsd_src.lPitch >>= 1;
src16 = (WORD *)(lpsurface ? lpsurface:ddsd_src.lpSurface);
src16 += lpsrcrect->top*ddsd_src.lPitch;
src16 += lpsrcrect->left;
srcpitch = ddsd_src.lPitch - w;
// OutTraceDW("DEBUG: h=%d w=%d src=%x dst=%x spitch=%d dpitch=%d\n",h,w,src16,dest,srcpitch,destpitch);
if (!Palette16BPP) { // first time through .....
unsigned int pi;
Palette16BPP = (DWORD *)malloc(0x10000 * sizeof(DWORD));
if (dxw.dwFlags3 & BLACKWHITE){
// actually, it should be like this: R/G/B = (red * 0.30) + (green * 0.59) + (blue * 0.11)
// (http://www.codeproject.com/Articles/66253/Converting-Colors-to-Gray-Shades)
DWORD grey;
if (dxw.dwFlags1 & USERGB565){
for (pi=0; pi<0x10000; pi++) {
//grey = ((((pi & 0x1F)<<3) + ((pi & 0x7E0)>>3) + ((pi & 0xF800)>>8)) / 3) & 0xFF;
grey = (((((pi & 0x1F)<<3) * 30) + (((pi & 0x7E0)>>3) * 59) + (((pi & 0xF800)>>8) * 11)) / 100) & 0xFF;
Palette16BPP[pi] = (grey) + (grey<<8) + (grey<<16);
}
}
else {
for (pi=0; pi<0x10000; pi++) {
//grey = ((((pi & 0x1F)<<3) + ((pi & 0x3E0)>>2) + ((pi & 0x7C00)>>7)) / 3) & 0xFF;
grey = (((((pi & 0x1F)<<3) * 30) + (((pi & 0x3E0)>>2) * 59) + (((pi & 0x7C00)>>7) * 11)) / 100) & 0xFF;
Palette16BPP[pi] = grey + (grey<<8) + (grey<<16);
}
}
}
else {
if (dxw.dwFlags1 & USERGB565){
for (pi=0; pi<0x10000; pi++) {
Palette16BPP[pi]=(pi & 0x1F)<<3 | (pi & 0x7E0)<<5 | (pi & 0xF800)<<8; // RGB565
}
}
else {
for (pi=0; pi<0x10000; pi++) {
Palette16BPP[pi]=(pi & 0x1F)<<3 | (pi & 0x3E0)<<6 | (pi & 0x7C00)<<9; // RGB555
}
}
}
}
for(y = 0; y < h; y ++){
for(x = 0; x < w; x ++){
//if (!(*src16 & 0x8000)) // try implement alpha bit
*(dest ++) = Palette16BPP[*(src16 ++)];
}
dest += destpitch;
src16 += srcpitch;
}
if(dxw.dwFlags3 & MARKBLIT) MarkRect32(dest0, w, h, destpitch);
res=(*pUnlockMethod(lpddsdst))(lpddsdst, lpdestrect);
if (res) OutTraceE("EmuBlt16_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
res=(*pUnlockMethod(lpddssrc))(lpddssrc, lpsrcrect);
if (res) OutTraceE("EmuBlt16_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
return res;
}
static HRESULT WINAPI EmuBlt_24_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdestrect,
LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect, DWORD dwflags, LPVOID lpsurface)
{
HRESULT res;
BYTE *src24;
DWORD *dest, *dest0;
DDSURFACEDESC2 ddsd_src, ddsd_dst;
long srcpitch, destpitch;
DWORD x, y, w, h;
w = lpdestrect->right - lpdestrect->left;
h = lpdestrect->bottom - lpdestrect->top;
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
ddsd_dst.dwSize = Set_dwSize_From_Surface(lpddsdst);
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
if(res=(*pLock)(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
OutTraceE("EmuBlt24_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
memset(&ddsd_src,0,sizeof(DDSURFACEDESC2));
ddsd_src.dwSize = Set_dwSize_From_Surface(lpddssrc);
ddsd_src.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
if (lpsurface) { // already locked, just get info ....
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
OutTraceE("EmuBlt24_32: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
(*pUnlockMethod(lpddsdst))(lpddsdst, lpdestrect);
(*pUnlockMethod(lpddssrc))(lpddssrc, lpsrcrect);
return 0;
}
}
else {
if(res=(*pLock)(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
(*pUnlockMethod(lpddsdst))(lpddsdst,0);
OutTraceE("EmuBlt24_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
lpsurface=ddsd_src.lpSurface;
}
ddsd_dst.lPitch >>= 2;
dest = (DWORD *)ddsd_dst.lpSurface;
dest += lpdestrect->top*ddsd_dst.lPitch;
dest += lpdestrect->left;
destpitch = ddsd_dst.lPitch - w;
dest0 = dest;
src24 = (BYTE *)lpsurface;
src24 += lpsrcrect->top*ddsd_src.lPitch;
src24 += lpsrcrect->left;
srcpitch = ddsd_src.lPitch - 3*w;
for(y = 0; y < h; y ++){
for(x = 0; x < w; x ++){
DWORD dwPixel;
dwPixel=0;
memcpy((void *)&dwPixel, (void *)src24, 3);
*(dest ++) = dwPixel;
src24 += 3; // 3 bytes = 24 bits
}
dest += destpitch;
src24 += srcpitch;
}
if(dxw.dwFlags3 & MARKBLIT) MarkRect32(dest0, w, h, destpitch);
res=(*pUnlockMethod(lpddsdst))(lpddsdst, lpdestrect);
if (res) OutTraceE("EmuBlt24_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
res=(*pUnlockMethod(lpddssrc))(lpddssrc, lpsrcrect);
if (res) OutTraceE("EmuBlt24_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
return res;
}
static HRESULT WINAPI EmuBlt_32_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdestrect,
LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect, DWORD dwflags, LPVOID lpsurface)
{
#ifdef DXWNDDIRECTBLITTING
return (*pBlt)(lpddsdst, lpdestrect, lpddssrc, lpsrcrect, dwflags, NULL);
#else
DWORD x, y, w, h;
long srcpitch, destpitch;
HRESULT res;
DWORD *src32;
DWORD *dest, *dest0;
DDSURFACEDESC2 ddsd_src, ddsd_dst;
w = lpdestrect->right - lpdestrect->left;
h = lpdestrect->bottom - lpdestrect->top;
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
ddsd_dst.dwSize = Set_dwSize_From_Surface(lpddsdst);
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
if(res=(*pLock)(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
OutTraceE("EmuBlt32_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
memset(&ddsd_src,0,sizeof(DDSURFACEDESC2));
ddsd_src.dwSize = Set_dwSize_From_Surface(lpddssrc);
ddsd_src.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
if (lpsurface) { // already locked, just get info ....
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
OutTraceE("EmuBlt32_32: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
(*pUnlockMethod(lpddsdst))(lpddsdst, lpdestrect);
(*pUnlockMethod(lpddssrc))(lpddssrc, lpsrcrect);
return res;
}
}
else {
if(res=(*pLock)(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
(*pUnlockMethod(lpddsdst))(lpddsdst,0);
OutTraceE("EmuBlt32_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
lpsurface=ddsd_src.lpSurface;
}
ddsd_dst.lPitch >>= 2;
dest = (DWORD *)ddsd_dst.lpSurface;
dest += lpdestrect->top*ddsd_dst.lPitch;
dest += lpdestrect->left;
destpitch = ddsd_dst.lPitch - w;
dest0 = dest;
ddsd_src.lPitch >>= 2;
src32 = (DWORD *)(lpsurface ? lpsurface:ddsd_src.lpSurface);
src32 += lpsrcrect->top*ddsd_src.lPitch;
src32 += lpsrcrect->left;
srcpitch = ddsd_src.lPitch - w;
// OutTraceDW("DEBUG: h=%d w=%d src=%x dst=%x spitch=%d dpitch=%d\n",h,w,src32,dest,srcpitch,destpitch);
for(y = 0; y < h; y ++){
for(x = 0; x < w; x ++)
*(dest ++) = *(src32 ++);
dest += destpitch;
src32 += srcpitch;
}
if(dxw.dwFlags3 & MARKBLIT) MarkRect32(dest0, w, h, destpitch);
res=(*pUnlockMethod(lpddsdst))(lpddsdst,lpdestrect);
if (res) OutTraceE("EmuBlt32_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
res=(*pUnlockMethod(lpddssrc))(lpddssrc, lpsrcrect);
if (res) OutTraceE("EmuBlt32_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
return res;
#endif
}
static HRESULT WINAPI EmuBlt_8_to_16(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdestrect,
LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect, DWORD dwflags, LPVOID lpsurface)
{
HRESULT res;
BYTE *src8;
SHORT *dest, *dest0;
DDSURFACEDESC2 ddsd_src, ddsd_dst;
long srcpitch, destpitch;
DWORD x, y, w, h;
w = lpdestrect->right - lpdestrect->left;
h = lpdestrect->bottom - lpdestrect->top;
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
ddsd_dst.dwSize = Set_dwSize_From_Surface(lpddsdst);
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
if(res=(*pLock)(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
OutTraceE("EmuBlt8_16: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
memset(&ddsd_src,0,sizeof(DDSURFACEDESC2));
ddsd_src.dwSize = Set_dwSize_From_Surface(lpddssrc);
ddsd_src.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
if (lpsurface) { // already locked, just get info ....
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
OutTraceE("EmuBlt8_16: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
(*pUnlockMethod(lpddsdst))(lpddsdst, lpdestrect);
(*pUnlockMethod(lpddssrc))(lpddssrc, lpsrcrect);
return 0;
}
}
else {
if(res=(*pLock)(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
(*pUnlockMethod(lpddsdst))(lpddsdst,0);
OutTraceE("EmuBlt8_16: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return 0;
}
lpsurface=ddsd_src.lpSurface;
}
ddsd_dst.lPitch >>= 1;
dest = (SHORT *)ddsd_dst.lpSurface;
dest += lpdestrect->top*ddsd_dst.lPitch;
dest += lpdestrect->left;
destpitch = ddsd_dst.lPitch - w;
dest0 = dest;
src8 = (BYTE *)lpsurface;
src8 += lpsrcrect->top*ddsd_src.lPitch;
src8 += lpsrcrect->left;
srcpitch = ddsd_src.lPitch - w;
// OutTraceDW("DEBUG: h=%d w=%d src=%x dst=%x spitch=%d dpitch=%d\n",h,w,src8,dest,srcpitch,destpitch);
for(y = 0; y < h; y ++){
for(x = 0; x < w; x ++){
*(dest ++) = (SHORT)PaletteEntries[*(src8 ++)];
}
dest += destpitch;
src8 += srcpitch;
}
if(dxw.dwFlags3 & MARKBLIT) MarkRect16(dest0, w, h, destpitch);
res=(*pUnlockMethod(lpddsdst))(lpddsdst, lpdestrect);
if (res) OutTraceE("EmuBlt8_16: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
res=(*pUnlockMethod(lpddssrc))(lpddssrc, lpsrcrect);
if (res) OutTraceE("EmuBlt8_16: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
return res;
}
static HRESULT WINAPI EmuBlt_16_to_16(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdestrect,
LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect, DWORD dwflags, LPVOID lpsurface)
{
#ifdef DXWNDDIRECTBLITTING
return (*pBlt)(lpddsdst, lpdestrect, lpddssrc, lpsrcrect, dwflags, NULL);
#else
OutTraceDW("EmuBlt_16_to_16: UNSUPPORTED\n");
return -1;
#endif
}
static HRESULT WINAPI EmuBlt_24_to_16(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdestrect,
LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect, DWORD dwflags, LPVOID lpsurface)
{
HRESULT res;
BYTE *src24;
SHORT *dest, *dest0;
DDSURFACEDESC2 ddsd_src, ddsd_dst;
long srcpitch, destpitch;
DWORD x, y, w, h;
w = lpdestrect->right - lpdestrect->left;
h = lpdestrect->bottom - lpdestrect->top;
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
ddsd_dst.dwSize = Set_dwSize_From_Surface(lpddsdst);
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
if(res=(*pLock)(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
OutTraceE("EmuBlt24_16: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
memset(&ddsd_src,0,sizeof(DDSURFACEDESC2));
ddsd_src.dwSize = Set_dwSize_From_Surface(lpddssrc);
ddsd_src.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
if (lpsurface) { // already locked, just get info ....
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
OutTraceE("EmuBlt24_16: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
(*pUnlockMethod(lpddsdst))(lpddsdst, lpdestrect);
(*pUnlockMethod(lpddssrc))(lpddssrc, lpsrcrect);
return 0;
}
}
else {
if(res=(*pLock)(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
(*pUnlockMethod(lpddsdst))(lpddsdst,0);
OutTraceE("EmuBlt24_16: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return 0;
}
lpsurface=ddsd_src.lpSurface;
}
ddsd_dst.lPitch >>= 1;
dest = (SHORT *)ddsd_dst.lpSurface;
dest += lpdestrect->top*ddsd_dst.lPitch;
dest += lpdestrect->left;
destpitch = ddsd_dst.lPitch - w;
dest0 = dest;
src24 = (BYTE *)lpsurface;
src24 += lpsrcrect->top*ddsd_src.lPitch;
src24 += lpsrcrect->left;
srcpitch = ddsd_src.lPitch - 3*w;
for(y = 0; y < h; y ++){
for(x = 0; x < w; x ++){
*(dest ++) = (*(src24+2) & 0xF8)<<8 | (*(src24+1) & 0xFC)<<3 | (*(src24+0) & 0xF8)>>3;
src24 += 3; // 3 bytes = 24 bits
}
dest += destpitch;
src24 += srcpitch;
}
if(dxw.dwFlags3 & MARKBLIT) MarkRect16(dest0, w, h, destpitch);
res=(*pUnlockMethod(lpddsdst))(lpddsdst, lpdestrect);
if (res) OutTraceE("EmuBlt24_16: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
res=(*pUnlockMethod(lpddssrc))(lpddssrc, lpsrcrect);
if (res) OutTraceE("EmuBlt24_16: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
return res;
}
static HRESULT WINAPI EmuBlt_32_to_16(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdestrect,
LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect, DWORD dwflags, LPVOID lpsurface)
{
char *sMsg="EmuBlt32_16: CURRENTLY UNSUPPORTED\n";
OutTraceE(sMsg);
if(IsAssertEnabled) MessageBox(0, sMsg, "EmuBlt", MB_OK | MB_ICONEXCLAMATION);
return -1;
}
static HRESULT WINAPI EmuBlt_Null(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdestrect,
LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect, DWORD dwflags, LPVOID lpsurface)
{
char *sMsg="EmuBlt: undefined color depth\n";
OutTraceE(sMsg);
if(IsAssertEnabled) MessageBox(0, sMsg, "EmuBlt", MB_OK | MB_ICONEXCLAMATION);
return -1;
}
//--------------------------------------------------------------------------------------------//
// Reverse blitting procedure: fills a 8BPP paletized surface from the content of a 32BPP one.
//--------------------------------------------------------------------------------------------//
#define REVPAL32SIZE 0x01000000
#define REVPAL32MASK 0x00FFFFFF
#define REVPAL16SIZE 0x00010000
#define REVPAL16MASK 0x0000FFFF
// GetMatchingPaletteEntry: retrieves the best matching palette entry close to the given
// input color crColor by using a minimum quadratic distance algorithm on each of the 3
// RGB color components.
static int GetMatchingPaletteEntry32(DWORD crColor)
{
int iDistance, iMinDistance;
int iColorIndex, iComponentIndex, iMinColorIndex;
DWORD PalColor, TargetColor;
iMinDistance=0xFFFFFF;
iMinColorIndex=0;
// for each palette entry
for(iColorIndex=0; iColorIndex<256; iColorIndex++){
int iDist;
iDistance=0;
PalColor=PaletteEntries[iColorIndex];
TargetColor=crColor;
// for each of the R,G,B color components
for (iComponentIndex=0; iComponentIndex<3; iComponentIndex++){
iDist = (TargetColor & 0xFF) - (PalColor & 0xFF);
iDist *= iDist;
iDistance += iDist;
PalColor >>= 8;
TargetColor >>= 8;
}
if (iDistance < iMinDistance) {
iMinDistance = iDistance;
iMinColorIndex = iColorIndex;
}
if (iMinDistance==0) break; // got the perfect match!
}
OutTraceDW("GetMatchingPaletteEntry32: color=%x matched with palette[%d]=%x dist=%d\n",
crColor, iMinColorIndex, PaletteEntries[iMinColorIndex], iDistance);
return iMinColorIndex;
}
static int GetMatchingPaletteEntry16(DWORD crColor)
{
int iDistance, iMinDistance;
int iColorIndex, iComponentIndex, iMinColorIndex;
DWORD PalColor, TargetColor;
iMinDistance=0xFFFFFF;
iMinColorIndex=0;
// for each palette entry
for(iColorIndex=0; iColorIndex<256; iColorIndex++){
int iDist;
iDistance=0;
PalColor=PaletteEntries[iColorIndex];
TargetColor=crColor;
// for each of the R,G,B color components
for (iComponentIndex=0; iComponentIndex<3; iComponentIndex++){
iDist = (TargetColor & 0x1F) - (PalColor & 0x1F);
iDist *= iDist;
iDistance += iDist;
PalColor >>= 5;
TargetColor >>= 5;
}
if (iDistance < iMinDistance) {
iMinDistance = iDistance;
iMinColorIndex = iColorIndex;
}
if (iMinDistance==0) break; // got the perfect match!
}
OutTraceDW("GetMatchingPaletteEntry: color=%x matched with palette[%d]=%x dist=%d\n",
crColor, iMinColorIndex, PaletteEntries[iMinColorIndex], iDistance);
return iMinColorIndex;
}
// this is a real trick: since all 256 possible values of each PaletteRev32BPP entry are valid,
// there is no way to tell whether the entry is valid or not. In theory, you should add a separate
// status field to track this thing, but that would at least double the used space (REVPAL32SIZE bytes).
// So an alternate solution is to pretend that a particular (random) value means the entry in unassigned:
// this implies thet even if the entry is properly set, the RevBlt procedure will search for a
// matching color anyway. So better avoid for this purpose any frequently used value: I would suggest to
// eliminate 0x00 and 0xFF. 0xF0 seems a god candidate, but any other randomly chosen value would
// probably be.
#define PALENTRY_FREE 0x1
#define PALENTRY_BUSY 0x0
//#define RANDOMENTRY 0xAA
static HRESULT WINAPI RevBlt_32_to_8(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdestrect, LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect)
{
HRESULT res;
BYTE *src8;
DWORD *dest;
DDSURFACEDESC2 ddsd_src, ddsd_dst;
long srcpitch, destpitch;
DWORD x, y, w, h;
static BYTE *PaletteRev32BPP = NULL;
static BYTE *PaletteFlags = NULL;
int pi;
OutTraceDW("RevBlt32_8: src=%x dst=%d\n", lpddssrc, lpddsdst);
w = lpdestrect->right - lpdestrect->left;
h = lpdestrect->bottom - lpdestrect->top;
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
ddsd_dst.dwSize = Set_dwSize_From_Surface(lpddsdst);
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
if(res=(*pLock)(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
OutTraceE("RevBlt32_8: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
memset(&ddsd_src,0,sizeof(DDSURFACEDESC2));
ddsd_src.dwSize = Set_dwSize_From_Surface(lpddssrc);
ddsd_src.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
if(res=(*pLock)(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
OutTraceE("RevBlt32_8: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
ddsd_dst.lPitch >>= 2;
dest = (DWORD *)ddsd_dst.lpSurface;
dest += lpdestrect->top*ddsd_dst.lPitch;
dest += lpdestrect->left;
destpitch = ddsd_dst.lPitch - w;
src8 = (BYTE *)ddsd_src.lpSurface;
src8 += lpsrcrect->top*ddsd_src.lPitch;
src8 += lpsrcrect->left;
srcpitch = ddsd_src.lPitch - w;
// OutTraceDW("DEBUG: h=%d w=%d src=%x dst=%x spitch=%d dpitch=%d\n",h,w,src8,dest,srcpitch,destpitch);
if (!PaletteRev32BPP) { // first time through .....
PaletteRev32BPP = (BYTE *)malloc(REVPAL32SIZE);
PaletteFlags = (BYTE *)malloc(REVPAL32SIZE);
}
extern BOOL isPaletteUpdated;
if (isPaletteUpdated){
isPaletteUpdated=FALSE; // do this just once per palette
memset(PaletteFlags, PALENTRY_FREE, REVPAL32SIZE); // necessary in build->release mode
for (pi=0; pi<256; pi++){
int RevIndex=PaletteEntries[pi] & REVPAL32MASK;
PaletteRev32BPP[RevIndex]=pi;
PaletteFlags[RevIndex]=PALENTRY_BUSY;
}
}
for(y = 0; y < h; y ++){
for(x = 0; x < w; x ++){
int RevIndex = *dest++ & REVPAL32MASK;
if(PaletteFlags[RevIndex]==PALENTRY_FREE){
PaletteRev32BPP[RevIndex]=GetMatchingPaletteEntry32(RevIndex);
PaletteFlags[RevIndex]=PALENTRY_BUSY;
}
*(src8 ++)= (BYTE)PaletteRev32BPP[RevIndex];
}
dest += destpitch;
src8 += srcpitch;
}
res=(*pUnlockMethod(lpddsdst))(lpddsdst,lpdestrect);
if (res) OutTraceE("RevBlt32_8: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
res=(*pUnlockMethod(lpddssrc))(lpddssrc, lpsrcrect);
if (res) OutTraceE("RevBlt32_8: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
return res;
}
static HRESULT WINAPI RevBlt_32_to_16(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdestrect, LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect)
{
HRESULT res;
WORD *src16;
DWORD *dest;
DDSURFACEDESC2 ddsd_src, ddsd_dst;
long srcpitch, destpitch;
DWORD x, y, w, h;
OutTraceDW("RevBlt32_16: src=%x dst=%d\n", lpddssrc, lpddsdst);
w = lpdestrect->right - lpdestrect->left;
h = lpdestrect->bottom - lpdestrect->top;
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
ddsd_dst.dwSize = Set_dwSize_From_Surface(lpddsdst);
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
if(res=(*pLock)(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
OutTraceE("RevBlt32_16: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
memset(&ddsd_src,0,sizeof(DDSURFACEDESC2));
ddsd_src.dwSize = Set_dwSize_From_Surface(lpddssrc);
ddsd_src.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
if(res=(*pLock)(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
OutTraceE("RevBlt32_16: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
ddsd_dst.lPitch >>= 2;
dest = (DWORD *)ddsd_dst.lpSurface;
dest += lpdestrect->top*ddsd_dst.lPitch;
dest += lpdestrect->left;
destpitch = ddsd_dst.lPitch - w;
ddsd_src.lPitch >>= 1;
src16 = (WORD *)ddsd_src.lpSurface;
src16 += lpsrcrect->top*ddsd_src.lPitch;
src16 += lpsrcrect->left;
srcpitch = ddsd_src.lPitch - w;
for(y = 0; y < h; y ++){
for(x = 0; x < w; x ++){
*(src16 ++)= (WORD)*(dest++) & 0xFFFF; // wrong, but visible.....
}
dest += destpitch;
src16 += srcpitch;
}
res=(*pUnlockMethod(lpddsdst))(lpddsdst, lpdestrect);
if (res) OutTraceE("RevBlt32_16: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
res=(*pUnlockMethod(lpddssrc))(lpddssrc, lpsrcrect);
if (res) OutTraceE("RevBlt32_16: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
return res;
}
static HRESULT WINAPI RevBlt_16_to_8(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdestrect, LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect)
{
HRESULT res;
BYTE *src8;
USHORT *dest16;
DDSURFACEDESC2 ddsd_src, ddsd_dst;
long srcpitch, destpitch;
DWORD x, y, w, h;
static BYTE *PaletteRev16BPP = NULL;
static BYTE *PaletteFlags = NULL;
int pi;
OutTraceDW("RevBlt16_8: src=%x dst=%d\n", lpddssrc, lpddsdst);
w = lpdestrect->right - lpdestrect->left;
h = lpdestrect->bottom - lpdestrect->top;
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
ddsd_dst.dwSize = Set_dwSize_From_Surface(lpddsdst);
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
if(res=(*pLock)(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
OutTraceE("RevBlt16_8: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
memset(&ddsd_src,0,sizeof(DDSURFACEDESC2));
ddsd_src.dwSize = Set_dwSize_From_Surface(lpddssrc);
ddsd_src.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
if(res=(*pLock)(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
OutTraceE("RevBlt16_8: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
ddsd_dst.lPitch >>= 1;
dest16 = (USHORT *)ddsd_dst.lpSurface;
dest16 += lpdestrect->top*ddsd_dst.lPitch;
dest16 += lpdestrect->left;
destpitch = ddsd_dst.lPitch - w;
src8 = (BYTE *)ddsd_src.lpSurface;
src8 += lpsrcrect->top*ddsd_src.lPitch;
src8 += lpsrcrect->left;
srcpitch = ddsd_src.lPitch - w;
// OutTraceDW("DEBUG: h=%d w=%d src=%x dst=%x spitch=%d dpitch=%d\n",h,w,src8,dest,srcpitch,destpitch);
if (!PaletteRev16BPP) { // first time through .....
PaletteRev16BPP = (BYTE *)malloc(REVPAL16SIZE);
PaletteFlags = (BYTE *)malloc(REVPAL16SIZE);
}
extern BOOL isPaletteUpdated;
if (isPaletteUpdated){
isPaletteUpdated=FALSE; // do this just once per palette
memset(PaletteRev16BPP, PALENTRY_FREE, REVPAL16SIZE); // necessary in build->release mode
for (pi=0; pi<256; pi++){
int RevIndex=PaletteEntries[pi] & REVPAL16MASK;
PaletteRev16BPP[RevIndex]=pi;
PaletteFlags[RevIndex]=PALENTRY_BUSY;
}
}
for(y = 0; y < h; y ++){
for(x = 0; x < w; x ++){
int RevIndex = *dest16++ & REVPAL16MASK;
if(PaletteFlags[RevIndex]==PALENTRY_FREE){
PaletteRev16BPP[RevIndex]=GetMatchingPaletteEntry16(RevIndex);
PaletteFlags[RevIndex]=PALENTRY_BUSY;
}
*(src8 ++)= (BYTE)PaletteRev16BPP[RevIndex];
}
dest16 += destpitch;
src8 += srcpitch;
}
res=(*pUnlockMethod(lpddsdst))(lpddsdst, lpdestrect);
if (res) OutTraceE("RevBlt16_8: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
res=(*pUnlockMethod(lpddssrc))(lpddssrc, lpsrcrect);
if (res) OutTraceE("RevBlt16_8: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
return res;
}
static HRESULT WINAPI RevBlt_16_to_16(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdestrect, LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect)
{
return (*pBlt)(lpddsdst, lpdestrect, lpddssrc, lpsrcrect, 0, NULL);
}
static HRESULT WINAPI RevBlt_Null(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdestrect, LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect)
{
OutTraceE("EmuBlt: undefined color depth\n");
return -1;
}
//--------------------------------------------------------------------------------------------//
// exported methods
//--------------------------------------------------------------------------------------------//
void SetBltTransformations()
{
OutTraceDW("SetBltTransformations: color transformation %d->%d\n",
dxw.VirtualPixelFormat.dwRGBBitCount, dxw.ActualPixelFormat.dwRGBBitCount);
/* default (bad) setting */
pRevBlt=RevBlt_Null;
pEmuBlt=EmuBlt_Null;
switch (dxw.ActualPixelFormat.dwRGBBitCount){
case 32:
switch(dxw.VirtualPixelFormat.dwRGBBitCount){
case 8:
pRevBlt=RevBlt_32_to_8;
pEmuBlt=EmuBlt_8_to_32;
OutTraceDW("set color transformation 8<->32\n");
break;
case 16:
pRevBlt=RevBlt_32_to_16;
pEmuBlt=EmuBlt_16_to_32;
OutTraceDW("set color transformation 16<->32\n");
break;
case 24:
//pRevBlt=RevBlt_24_to_32;
pEmuBlt=EmuBlt_24_to_32;
OutTraceDW("set color transformation 24->32\n");
break;
case 32:
pEmuBlt=EmuBlt_32_to_32;
OutTraceDW("set color transformation 32->32\n");
break;
default:
OutTraceDW("unsupported color transformation %d->32\n", dxw.VirtualPixelFormat.dwRGBBitCount);
break;
}
break;
case 16:
switch(dxw.VirtualPixelFormat.dwRGBBitCount){
case 8:
pRevBlt=RevBlt_16_to_8;
pEmuBlt=EmuBlt_8_to_16;
OutTraceDW("set color transformation 8<->16\n");
break;
case 16:
pRevBlt=RevBlt_16_to_16;
pEmuBlt=EmuBlt_16_to_16;
OutTraceDW("set color transformation 16<->16\n");
break;
case 24:
//pRevBlt=RevBlt_24_to_16;
pEmuBlt=EmuBlt_24_to_16;
OutTraceDW("set color transformation 24<->16\n");
break;
case 32:
pEmuBlt=EmuBlt_32_to_16;
break;
default:
OutTraceDW("unsupported color transformation %d->16\n", dxw.VirtualPixelFormat.dwRGBBitCount);
break;
}
break;
default:
OutTraceDW("unsupported color transformation %d->%d\n",
dxw.VirtualPixelFormat.dwRGBBitCount,
dxw.ActualPixelFormat.dwRGBBitCount);
break;
}
return;
}

View File

@ -73,7 +73,7 @@ static char *Flag4Names[32]={
"NOPOWER2FIX", "NOPERFCOUNTER", "ADDPROXYLIBS", "INTERCEPTRDTSC",
"LIMITSCREENRES", "NOFILLRECT", "HOOKGLIDE", "HIDEDESKTOP",
"STRETCHTIMERS", "NOFLIPEMULATION", "NOTEXTURES", "RETURNNULLREF",
"FINETIMING", "", "", "",
"FINETIMING", "NATIVERES", "SUPPORTSVGA", "SUPPORTHDTV",
"", "", "", "",
"", "", "", "",
};

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.67"
#define VERSION "2.02.68"
#define DDTHREADLOCK 1

Binary file not shown.

View File

@ -208,6 +208,9 @@
#define IDC_LIMITSCREENRES 1167
#define IDC_SHOWTIMESTRETCH 1168
#define IDC_FINETIMING 1169
#define IDC_SUPPORTSVGA 1170
#define IDC_SUPPORTHDMI 1171
#define IDC_NATIVERES 1172
#define ID_MODIFY 32771
#define ID_DELETE 32772
#define ID_ADD 32773
@ -261,7 +264,7 @@
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 159
#define _APS_NEXT_COMMAND_VALUE 32830
#define _APS_NEXT_CONTROL_VALUE 1099
#define _APS_NEXT_CONTROL_VALUE 1100
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -41,6 +41,11 @@ void CTabCompat::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_ZBUFFER0CLEAN, cTarget->m_ZBuffer0Clean);
DDX_Check(pDX, IDC_NOPOWER2FIX, cTarget->m_NoPower2Fix);
DDX_Check(pDX, IDC_NOPERFCOUNTER, cTarget->m_NoPerfCounter);
// 3D management
DDX_Check(pDX, IDC_NOTEXTURES, cTarget->m_NoTextures);
DDX_Check(pDX, IDC_WIREFRAME, cTarget->m_WireFrame);
DDX_Check(pDX, IDC_DISABLEFOGGING, cTarget->m_DisableFogging);
}
BEGIN_MESSAGE_MAP(CTabCompat, CDialog)

View File

@ -58,11 +58,7 @@ void CTabWindow::DoDataExchange(CDataExchange* pDX)
// screen resolution management
DDX_Check(pDX, IDC_LIMITSCREENRES, cTarget->m_LimitScreenRes);
DDX_LBIndex(pDX, IDC_LISTRES, cTarget->m_MaxScreenRes);
// 3D management
DDX_Check(pDX, IDC_NOTEXTURES, cTarget->m_NoTextures);
DDX_Check(pDX, IDC_WIREFRAME, cTarget->m_WireFrame);
DDX_Check(pDX, IDC_DISABLEFOGGING, cTarget->m_DisableFogging);
DDX_Radio(pDX, IDC_SUPPORTSVGA, cTarget->m_ResTypes);
}
static char *Resolutions[]={

View File

@ -166,6 +166,7 @@ public:
int m_InitTS;
int m_FakeVersionId;
int m_MaxScreenRes;
int m_ResTypes;
//}}AFX_DATA

Binary file not shown.

View File

@ -429,21 +429,20 @@ BEGIN
CONTROL "Suppress child process creation",IDC_SUPPRESSCHILD,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,172,125,10
GROUPBOX "Color management",IDC_STATIC,149,4,144,117
CONTROL "Simulate 8BPP desktop",IDC_INIT8BPP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,16,115,10
CONTROL "Simulate 16BPP desktop",IDC_INIT16BPP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,28,115,10
CONTROL "Disable setting gamma ramp",IDC_DISABLEGAMMARAMP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,88,119,10
CONTROL "Forces 16BPP desktop",IDC_FORCE16BPP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,40,119,10
CONTROL "3D Wireframe",IDC_WIREFRAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,206,96,10
CONTROL "Simulate BW monitor",IDC_BLACKWHITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,52,96,10
CONTROL "Set 16BPP RGB565 encoding",IDC_USERGB565,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,64,126,9
CONTROL "Lock Sys Colors",IDC_LOCKSYSCOLORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,76,126,9
GROUPBOX "3D effects",IDC_STATIC,149,175,144,59
CONTROL "Disable Fogging",IDC_DISABLEFOGGING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,218,96,10
GROUPBOX "Screen resolution",IDC_STATIC,149,123,144,46
CONTROL "Limit resolution:",IDC_LIMITSCREENRES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,136,63,10
LISTBOX IDC_LISTRES,226,133,57,26,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
CONTROL "Simulate 8BPP desktop",IDC_INIT8BPP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,16,115,10
CONTROL "Simulate 16BPP desktop",IDC_INIT16BPP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,28,115,10
CONTROL "Disable setting gamma ramp",IDC_DISABLEGAMMARAMP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,88,119,10
CONTROL "Forces 16BPP desktop",IDC_FORCE16BPP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,40,119,10
CONTROL "Simulate BW monitor",IDC_BLACKWHITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,52,96,10
CONTROL "Set 16BPP RGB565 encoding",IDC_USERGB565,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,64,126,9
CONTROL "Lock Sys Colors",IDC_LOCKSYSCOLORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,76,126,9
GROUPBOX "Screen resolution",IDC_STATIC,149,123,144,110
CONTROL "Limit resolution:",IDC_LIMITSCREENRES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,204,63,10
LISTBOX IDC_LISTRES,226,201,57,26,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
CONTROL "Hide desktop background",IDC_HIDEDESKTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,184,125,10
CONTROL "Disable Textures",IDC_NOTEXTURES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,194,96,10
CONTROL "SVGA modes",IDC_SUPPORTSVGA,"Button",BS_AUTORADIOBUTTON | WS_GROUP,160,136,124,10
CONTROL "HDMI modes",IDC_SUPPORTHDMI,"Button",BS_AUTORADIOBUTTON,160,148,124,10
CONTROL "Monitor native modes",IDC_NATIVERES,"Button",BS_AUTORADIOBUTTON,160,160,124,10
END
IDD_TAB_EMPTY DIALOGEX 0, 0, 300, 240
@ -472,6 +471,10 @@ BEGIN
CONTROL "Clean ZBUFFER @0.0 fix",IDC_ZBUFFER0CLEAN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,104,109,12
CONTROL "Textures not power of 2 fix",IDC_NOPOWER2FIX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,92,109,12
CONTROL "Disable performance counter",IDC_NOPERFCOUNTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,80,109,12
CONTROL "3D Wireframe",IDC_WIREFRAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,34,96,10
GROUPBOX "3D effects",IDC_STATIC,149,3,144,64
CONTROL "Disable Fogging",IDC_DISABLEFOGGING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,46,96,10
CONTROL "Disable Textures",IDC_NOTEXTURES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,22,96,10
END
IDD_TAB_SYSLIBS DIALOGEX 0, 0, 300, 240

Binary file not shown.

View File

@ -140,6 +140,11 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
case 2: t->flags3 |= GDIEMULATEDC; break;
case 3: t->flags |= MAPGDITOPRIMARY; break;
}
switch(dlg->m_ResTypes){
case 0: t->flags4 |= SUPPORTSVGA; break;
case 1: t->flags4 |= SUPPORTHDTV; break;
case 2: t->flags4 |= NATIVERES; break;
}
if(dlg->m_HookDI) t->flags |= HOOKDI;
if(dlg->m_ModifyMouse) t->flags |= MODIFYMOUSE;
if(dlg->m_OutProxyTrace) t->tflags |= OUTPROXYTRACE;
@ -299,6 +304,11 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
if(t->flags3 & GDIEMULATEDC) dlg->m_DCEmulationMode = 2;
if(t->flags & MAPGDITOPRIMARY) dlg->m_DCEmulationMode = 3;
dlg->m_ResTypes = 0;
if(t->flags4 & SUPPORTSVGA) dlg->m_ResTypes = 0;
if(t->flags4 & SUPPORTHDTV) dlg->m_ResTypes = 1;
if(t->flags4 & NATIVERES) dlg->m_ResTypes = 2;
dlg->m_HookDI = t->flags & HOOKDI ? 1 : 0;
dlg->m_ModifyMouse = t->flags & MODIFYMOUSE ? 1 : 0;
dlg->m_OutProxyTrace = t->tflags & OUTPROXYTRACE ? 1 : 0;