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

v2_02_94_src

Former-commit-id: 1bb8aa8a0938f8cd4b435d66231ff9276002c95e
This commit is contained in:
gho tik 2014-08-10 12:39:50 -04:00 committed by Refael ACkermann
parent 654b8fa644
commit d722681922
63 changed files with 833 additions and 178 deletions

@ -123,7 +123,7 @@
#define DISABLEFOGGING 0x00000080 // Disable D3D fogging
#define NOPOWER2FIX 0x00000100 // Handle textures whose size is not a power of 2 (32, 64, 128 ...)
#define NOPERFCOUNTER 0x00000200 // Disables the GetPerfCounter performance metrics API,as if it was not supported....
#define BILINEARFILTER 0x00000400 // attempt to smooth low-res graphic by applying biulinear filtering in emulation mode
#define BILINEAR2XFILTER 0x00000400 // attempt to smooth low-res graphic by applying biulinear filtering in emulation mode
#define INTERCEPTRDTSC 0x00000800 // Intercapts RDTSC opcodes to hook at assembly level
#define LIMITSCREENRES 0x00001000 // Limit available screen resolution up to defined maximum
#define NOFILLRECT 0x00002000 // Suppress FillRect calls
@ -150,12 +150,14 @@
#define DIABLOTWEAK 0x00000001 // ... ??? ...
#define CLEARTARGET 0x00000002 // forces a D3D clean on target surface upon each BeginScene invocation
#define NOWINPOSCHANGES 0x00000004 // suppress WM_WINDOWPOSCHANGING/CHANGED messages (RollerCoaster Tycoon...)
#define SYSTEMMEMORY 0x00000008 // forces usage of DDSCAPS_SYSTEMMEMORY capability on front & backbuffer surfaces
#define NOSYSTEMMEMORY 0x00000008 // forces suppression of DDSCAPS_SYSTEMMEMORY capability on surfaces
#define NOBLT 0x00000010 // suppress blit to primary surface
#define UNUSEDFLAG1 0x00000020 // unused - mapped to AEROBOOST
#define NOSYSTEMEMULATED 0x00000020 // forces suppression of DDSCAPS_SYSTEMMEMORY capability on emulated front & backbuffer surfaces
#define DOFASTBLT 0x00000040 // use FastBlt to primary surface
#define AEROBOOST 0x00000080 // Optimize for AERO environment: does all stretching in sysmemory surfaces
#define LIMITFULLBLT 0x00000100 // Limit FPS only for blt operation of the whole primary surface
#define QUARTERBLT 0x00000100 // Consider a screen update (to count or limit FPS) only blt operations bigger than a quarter of the whole primary surface
#define NOIMAGEHLP 0x00000200 // Interceptd Imagehlp.dll unsupported calls (used by "the 5th element")
#define BILINEARFILTER 0x00000400 // experimental bilinear filtering
// logging Tflags DWORD:
#define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:84f85cf7b70b388793e41f61533229ee60eab599aa6a44407cde99c1ceaa5fdf
size 132096
oid sha256:2b88d6c9d24ee068087275664ae0d9082c85e8424e47e7b177fbd026763a5631
size 132608

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:642c9b8d73a7154b70bbb29ebfc13935cd6a26d178eef9989581b4ae8329457f
size 137728
oid sha256:55f9e6985c7b7f0f5a538ad93199152d964f7d8dc4a552a7bed38fb93cc760e1
size 116224

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2a8bd736f7b90333f36f1de42e4d8804431732488e553d89391f5daae705a152
size 138752
oid sha256:02e79b180737b4f5e1989026e05e6c48065de39060d977c158ab286a87a5d940
size 139264

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0f5388e87978467245275dcb12d802fcb1ce55d4f4a0ee2217711fcef520bd3a
size 506368
oid sha256:f3a3c1ff5c9ff0497a5155abf197a32ac7481a31130d4c441ece3e50b022e6eb
size 525312

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:46e406641683f8f3314bd14855187c086991f84bd234780f15e49f4de3f5c197
size 557568
oid sha256:f379180ba2b97d28926280bc4a1b02ed95f3f90cd191aa3fa94d4757bdd106b3
size 558592

@ -1,6 +1,6 @@
[window]
posx=1207
posy=326
posx=1182
posy=638
sizx=320
sizy=200
lang=automatic

@ -0,0 +1,28 @@
[target]
title0=Celtic Kings Rage of War
path0=D:\Games\Celtic Kings RoW\Celtic kings.exe
launchpath0=
module0=
opengllib0=
ver0=0
coord0=0
flag0=671088674
flagg0=1744830466
flagh0=65556
flagi0=138412036
flagj0=128
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

@ -0,0 +1,28 @@
[target]
title0=Evil Dead Hail to the King
path0=D:\Games\Evil Dead\EvilDead.exe
launchpath0=
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217762
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=168
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

@ -0,0 +1,28 @@
[target]
title0=Fighting Force
path0=D:\Games\Fighting Force\fforce.exe
launchpath0=
module0=
opengllib0=
ver0=0
coord0=0
flag0=134218272
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=128
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

@ -0,0 +1,28 @@
[target]
title0=Stronghold Crusader HD
path0=d:\Games\Stronghold Crusader.exe
launchpath0=d:\Games\Stronghold Crusader.exe
module0=
opengllib0=
ver0=0
coord0=3
flag0=134218400
flagg0=1275068432
flagh0=1048596
flagi0=136314884
flagj0=128
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=1280
sizy0=1024
maxfps0=0
initts0=0
winver0=1
maxres0=-1

@ -0,0 +1,28 @@
[target]
title0=Worms 2 (GOG)
path0=D:\Games\Worms 2\worms2.exe
launchpath0=
module0=
opengllib0=
ver0=0
coord0=0
flag0=134218272
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=128
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

@ -603,3 +603,16 @@ fix: Skip / Limit FPS now acting on full scren blits only. For instance, they no
v2.02.93
fix: handling of primary / backbuffer surfaces when DDSCAPS_3DDEVICE is set (es. Fifa 99 in Direct3D mode)
v2.02.94
fix: handling of "Keep aspect ratio" for aspect ratios different from 4:3
fix: missing resolution 400x300 in "Limit resolution" handling
fix: surface handling switch in automatic mode.
added two flags for DDSCAPS_SYSTEMMEMORY handling on different contexts. Added extra performances and compatibility with D3D in emulated mode.
added "Updated bigger than 1/4 screen size" flag, to perform FPS counting or limitations upon substantial screen updated (heuristic: bigger than 1/4 of the total size...)
added true bilinear filter. Previous one was renamed as fast 2x filter (BILINEAR2XFILTER).
fix: when the window was minimized & the "do not notify on task switch" flag was on, the game crashed. Now the blitting operations to invalid rect coordinates are suppressed.
fix: debug option "highlight blit to primary" was causing game crashes when the updated rect was too little.
fix: trapped sporadic CloseHandle(hMenu) crashes in a try/catch clause.
fix: attempt to fix FIXD3DFRAME option
fix: added SetStretchBltMode(hdc,HALFTONE) to SetDIBitsToDevice hooker to improve stretching: fixes "Celtic Kings Rage of War"

270
dll/bilinear.cpp Normal file

@ -0,0 +1,270 @@
/* =============================================================================
Source Code for Smooth Image Resampling (Resizing) in C/C++ (Visual Studio)
by Ryan Geiss - 3 July 2008
The code below performs a fairly-well-optimized high-quality resample
(smooth resize) of a 3-channel image that is padded to 4 bytes per
pixel. The pixel format is assumed to be ARGB. If you want to make
it handle an alpha channel, the changes should be very straightforward.
In general, if the image is being enlarged, bilinear interpolation
is used; if the image is being downsized, all input pixels are weighed
appropriately to produce the correct result.
In order to be efficient, it actually performs 1 of 4 routines. First,
if you are cutting the image size *exactly* in half (common when generating
mipmap levels), it will use a specialized routine to do just that. There
are actually two versions of this routine - an MMX one and a non-MMX one.
It detects if MMX is present and chooses the right one.
If you're not cutting the image perfectly in half, it executes one
of two general resize routines. If upsampling (increasing width and height)
on both X and Y, then it executes a faster resize algorithm that just performs
a 2x2 bilinear interpolation of the appropriate input pixels, for each output
pixel.
If downsampling on either X or Y (or both), though, the general-purpose
routine gets run. It iterates over every output pixel, and for each one, it
iterates over the input pixels that map to that output pixel [there will
usually be more than 1 in this case]. Each input pixel is properly weighted
to produce exactly the right image. There's a little bit of extra bookkeeping,
but in general, it's pretty efficient.
Note that on extreme downsizing (2,800 x 2,800 -> 1x1 or greater ratio),
the colors can overflow. If you want to fix this lazily, just break
your resize into two passes.
Also note that when your program exits, or when you are done using this
function, you should delete [] g_px1a and g_px1ab if they have been
allocated.
I posted this here because this is pretty common code that is a bit of
a pain to write; I've written it several times over the years, and I really
don't feel like writing it again. So - here it is - for my reference, and
for yours. Enjoy!
/* ========================================================================== */
#include <windows.h>
#include <xmmintrin.h>
#include <math.h>
static int* g_px1a = NULL;
static int g_px1a_w = 0;
static int* g_px1ab = NULL;
static int g_px1ab_w = 0;
static bool g_bMMX = false;
static bool g_bMMX_known = false;
void Resize_HQ_4ch( unsigned char* src, RECT *srcrect, int srcpitch,
unsigned char* dest, RECT *destrect, int destpitch)
{
// Both buffers must be in ARGB format, and a scanline should be w*4 bytes.
// NOTE: THIS WILL OVERFLOW for really major downsizing (2800x2800 to 1x1 or more)
// (2800 ~ sqrt(2^23)) - for a lazy fix, just call this in two passes.
int w1, w2, h1, h2;
w1 = srcrect->right - srcrect->left;
h1 = srcrect->bottom - srcrect->top;
w2 = destrect->right - destrect->left;
h2 = destrect->bottom - destrect->top;
if(!srcpitch) srcpitch=w1<<2;
if(!destpitch) destpitch=w1<<2;
// GHO addiction: new variables
// p1, p2: pitch offsets of source and dest surfaces in DWORD offset, that is pitch / sizeof(DWORD)
// beware: current version can operate on displaced source rect, but assumes the dest rect is always the full surface!!
unsigned int p1 = srcpitch >> 2;
unsigned int p2 = destpitch >> 2;
unsigned int *dsrc = (unsigned int *)src + (srcrect->top * p1) + srcrect->left;
unsigned int *ddest = (unsigned int *)dest;
// arbitrary resize.
bool bUpsampleX = (w1 < w2);
bool bUpsampleY = (h1 < h2);
// If too many input pixels map to one output pixel, our 32-bit accumulation values
// could overflow - so, if we have huge mappings like that, cut down the weights:
// 256 max color value
// *256 weight_x
// *256 weight_y
// *256 (16*16) maximum # of input pixels (x,y) - unless we cut the weights down...
int weight_shift = 0;
float source_texels_per_out_pixel = ( (w1/(float)w2 + 1)
* (h1/(float)h2 + 1)
);
float weight_per_pixel = source_texels_per_out_pixel * 256 * 256; //weight_x * weight_y
float accum_per_pixel = weight_per_pixel*256; //color value is 0-255
float weight_div = accum_per_pixel / 4294967000.0f;
if (weight_div > 1)
weight_shift = (int)ceilf( logf((float)weight_div)/logf(2.0f) );
weight_shift = min(15, weight_shift); // this could go to 15 and still be ok.
float fh = 256*h1/(float)h2;
float fw = 256*w1/(float)w2;
if (bUpsampleX && bUpsampleY)
{
// faster to just do 2x2 bilinear interp here
// cache x1a, x1b for all the columns:
// ...and your OS better have garbage collection on process exit :)
if (g_px1a_w < w2)
{
if (g_px1a) delete [] g_px1a;
g_px1a = new int[w2*2 * 1];
g_px1a_w = w2*2;
}
for (int x2=0; x2<w2; x2++)
{
// find the x-range of input pixels that will contribute:
int x1a = (int)(x2*fw);
x1a = min(x1a, 256*(w1-1) - 1);
g_px1a[x2] = x1a;
}
// FOR EVERY OUTPUT PIXEL
for (int y2=0; y2<h2; y2++)
{
// find the y-range of input pixels that will contribute:
int y1a = (int)(y2*fh);
y1a = min(y1a, 256*(h1-1) - 1);
int y1c = y1a >> 8;
// unsigned int *ddest = &((unsigned int *)dest)[y2*w2 + 0];
unsigned int *ddest = &((unsigned int *)dest)[y2*p2 + 0];
for (int x2=0; x2<w2; x2++)
{
// find the x-range of input pixels that will contribute:
int x1a = g_px1a[x2];//(int)(x2*fw);
int x1c = x1a >> 8;
//unsigned int *dsrc2 = &dsrc[y1c*w1 + x1c];
unsigned int *dsrc2 = &dsrc[y1c*p1 + x1c]; // GHO
// PERFORM BILINEAR INTERPOLATION on 2x2 pixels
unsigned int r=0, g=0, b=0, a=0;
unsigned int weight_x = 256 - (x1a & 0xFF);
unsigned int weight_y = 256 - (y1a & 0xFF);
for (int y=0; y<2; y++)
{
for (int x=0; x<2; x++)
{
//unsigned int c = dsrc2[x + y*w1];
unsigned int c = dsrc2[x + y*p1]; // GHO
unsigned int r_src = (c ) & 0xFF;
unsigned int g_src = (c>> 8) & 0xFF;
unsigned int b_src = (c>>16) & 0xFF;
unsigned int w = (weight_x * weight_y) >> weight_shift;
r += r_src * w;
g += g_src * w;
b += b_src * w;
weight_x = 256 - weight_x;
}
weight_y = 256 - weight_y;
}
unsigned int c = ((r>>16)) | ((g>>8) & 0xFF00) | (b & 0xFF0000);
//*ddest++ = c;//ddest[y2*w2 + x2] = c;
*ddest++ = c;
//ddest+=(w2-p2);
}
}
}
else // either downscale on vertical or horizontal direction ...
{
// cache x1a, x1b for all the columns:
// ...and your OS better have garbage collection on process exit :)
if (g_px1ab_w < w2)
{
if (g_px1ab) delete [] g_px1ab;
g_px1ab = new int[w2*2 * 2];
g_px1ab_w = w2*2;
}
for (int x2=0; x2<w2; x2++)
{
// find the x-range of input pixels that will contribute:
int x1a = (int)((x2 )*fw);
int x1b = (int)((x2+1)*fw);
if (bUpsampleX) // map to same pixel -> we want to interpolate between two pixels!
x1b = x1a + 256;
x1b = min(x1b, 256*w1 - 1);
g_px1ab[x2*2+0] = x1a;
g_px1ab[x2*2+1] = x1b;
}
// FOR EVERY OUTPUT PIXEL
for (int y2=0; y2<h2; y2++)
{
// find the y-range of input pixels that will contribute:
int y1a = (int)((y2 )*fh);
int y1b = (int)((y2+1)*fh);
if (bUpsampleY) // map to same pixel -> we want to interpolate between two pixels!
y1b = y1a + 256;
y1b = min(y1b, 256*h1 - 1);
int y1c = y1a >> 8;
int y1d = y1b >> 8;
ddest = &((unsigned int *)dest)[y2*p2 + 0];
for (int x2=0; x2<w2; x2++)
{
// find the x-range of input pixels that will contribute:
int x1a = g_px1ab[x2*2+0]; // (computed earlier)
int x1b = g_px1ab[x2*2+1]; // (computed earlier)
int x1c = x1a >> 8;
int x1d = x1b >> 8;
// ADD UP ALL INPUT PIXELS CONTRIBUTING TO THIS OUTPUT PIXEL:
unsigned int r=0, g=0, b=0, a=0;
for (int y=y1c; y<=y1d; y++)
{
unsigned int weight_y = 256;
if (y1c != y1d)
{
if (y==y1c)
weight_y = 256 - (y1a & 0xFF);
else if (y==y1d)
weight_y = (y1b & 0xFF);
}
//unsigned int *dsrc2 = &dsrc[y*w1 + x1c];
unsigned int *dsrc2 = &dsrc[y*p1 + x1c]; // GHO
for (int x=x1c; x<=x1d; x++)
{
unsigned int weight_x = 256;
if (x1c != x1d)
{
if (x==x1c)
weight_x = 256 - (x1a & 0xFF);
else if (x==x1d)
weight_x = (x1b & 0xFF);
}
//unsigned int c = *dsrc2++;//dsrc[y*w1 + x];
unsigned int c = dsrc[y*p1 + x];
unsigned int r_src = (c ) & 0xFF;
unsigned int g_src = (c>> 8) & 0xFF;
unsigned int b_src = (c>>16) & 0xFF;
unsigned int w = (weight_x * weight_y) >> weight_shift;
r += r_src * w;
g += g_src * w;
b += b_src * w;
a += w;
}
}
// write results
unsigned int c = ((r/a)) | ((g/a)<<8) | ((b/a)<<16);
//*ddest++ = c;//ddest[y2*w2 + x2] = c;
*ddest++ = c;
//ddest+=(w2-p2);
}
}
}
}

@ -1499,8 +1499,6 @@ HRESULT WINAPI extDirectDrawCreate(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplpdd, I
OutTraceDDRAW("DirectDrawCreate: guid=%x(%s)\n", lpguid, ExplainGUID(lpguid));
if (dxw.dwFlags1 & AUTOMATIC) dxw.dwFlags1 |= EMULATESURFACE;
if(!pDirectDrawCreate){ // not hooked yet....
HINSTANCE hinst;
hinst = LoadLibrary("ddraw.dll");
@ -1582,8 +1580,6 @@ HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *lpguid,
OutTraceDDRAW("DirectDrawCreateEx: guid=%x(%s) refiid=%x\n", lpguid, ExplainGUID(lpguid), iid);
if (dxw.dwFlags1 & AUTOMATIC) dxw.dwFlags1 |= EMULATESURFACE;
// v2.1.70: auto-hooking (just in case...)
if(!pDirectDrawCreateEx){ // not hooked yet....
HINSTANCE hinst;
@ -2408,25 +2404,6 @@ static void FixSurfaceCaps(LPDDSURFACEDESC2 lpddsd, int dxversion)
// v2.02.50: don't alter surfaces with different color depth
if((lpddsd->dwFlags & DDSD_PIXELFORMAT) && (lpddsd->ddpfPixelFormat.dwRGBBitCount != dxw.VirtualPixelFormat.dwRGBBitCount)) return;
#if 0
// v2.02.43: don't alter MIPMAP surfaces
if((lpddsd->dwFlags & DDSD_MIPMAPCOUNT) && (lpddsd->ddsCaps.dwCaps & DDSCAPS_MIPMAP)) {
//GetPixFmt(lpddsd);
return;
}
#endif
#if 0
// HoM&M3/4 fix....
if(((lpddsd->dwFlags & (DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT)) == (DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH)) &&
((lpddsd->ddsCaps.dwCaps & ~(DDSCAPS_SYSTEMMEMORY|DDSCAPS_VIDEOMEMORY) == DDSCAPS_OFFSCREENPLAIN)){
//lpddsd->ddsCaps.dwCaps = 0;
lpddsd->dwFlags = (DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT);
lpddsd->ddsCaps.dwCaps = (DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY);
GetPixFmt(lpddsd);
return;
}
#endif
// default case: adjust pixel format
OutTraceB("FixSurfaceCaps: suppress DDSCAPS_VIDEOMEMORY case\n");
lpddsd->dwFlags |= (DDSD_CAPS|DDSD_PIXELFORMAT);
@ -2463,7 +2440,9 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
ddsd.dwFlags |= (DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT);
ddsd.ddsCaps.dwCaps &= ~(DDSCAPS_PRIMARYSURFACE|DDSCAPS_FLIP|DDSCAPS_COMPLEX|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM);
// DDSCAPS_OFFSCREENPLAIN seems required to support the palette in memory surfaces
ddsd.ddsCaps.dwCaps |= (DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN);
ddsd.ddsCaps.dwCaps |= (DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY);
// on WinXP Fifa 99 doesn't like DDSCAPS_SYSTEMMEMORY cap, so better to leave a way to unset it....
if(dxw.dwFlags5 & NOSYSTEMEMULATED) ddsd.ddsCaps.dwCaps &= ~DDSCAPS_SYSTEMMEMORY;
ddsd.dwWidth = dxw.GetScreenWidth();
ddsd.dwHeight = dxw.GetScreenHeight();
@ -2528,10 +2507,13 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
if(lpDDSEmu_Back==NULL){
ClearSurfaceDesc((void *)&ddsd, dxversion);
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
// DDSCAPS_OFFSCREENPLAIN seems required to support the palette in memory surfaces
ddsd.ddsCaps.dwCaps = (DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY);
// on WinXP Fifa 99 doesn't like DDSCAPS_SYSTEMMEMORY cap, so better to leave a way to unset it....
if(dxw.dwFlags5 & NOSYSTEMEMULATED) ddsd.ddsCaps.dwCaps &= ~DDSCAPS_SYSTEMMEMORY;
ddsd.dwWidth = dxw.GetScreenWidth();
ddsd.dwHeight = dxw.GetScreenHeight();
if(dxw.dwFlags4 & BILINEARFILTER){
if(dxw.dwFlags4 & BILINEAR2XFILTER){
// double backbuffer size
ddsd.dwWidth = dxw.GetScreenWidth() << 1;
ddsd.dwHeight = dxw.GetScreenHeight() << 1;
@ -2630,6 +2612,8 @@ static HRESULT BuildBackBufferEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateS
ddsd.ddsCaps.dwCaps &= ~(DDSCAPS_BACKBUFFER|DDSCAPS_PRIMARYSURFACE|DDSCAPS_FLIP|DDSCAPS_COMPLEX|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM);
// DDSCAPS_OFFSCREENPLAIN seems required to support the palette in memory surfaces
ddsd.ddsCaps.dwCaps |= (DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN);
// on WinXP Fifa 99 doesn't like DDSCAPS_SYSTEMMEMORY cap, so better to leave a way to unset it....
if(dxw.dwFlags5 & NOSYSTEMMEMORY) ddsd.ddsCaps.dwCaps &= ~DDSCAPS_SYSTEMMEMORY;
ddsd.dwWidth = dxw.GetScreenWidth();
ddsd.dwHeight = dxw.GetScreenHeight();
GetPixFmt(&ddsd);
@ -2713,6 +2697,8 @@ static HRESULT BuildGenericEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
memcpy(&ddsd, lpddsd, lpddsd->dwSize); // Copy over ....
FixSurfaceCaps(&ddsd, dxversion);
// on WinXP Fifa 99 doesn't like DDSCAPS_SYSTEMMEMORY cap, so better to leave a way to unset it....
if(dxw.dwFlags5 & NOSYSTEMMEMORY) ddsd.ddsCaps.dwCaps &= ~DDSCAPS_SYSTEMMEMORY;
DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Emu Generic]" , __LINE__);
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, pu);
@ -2977,13 +2963,6 @@ HRESULT WINAPI extGetAttachedSurface(int dxversion, GetAttachedSurface_Type pGet
OutTraceDDRAW("GetAttachedSurface(%d): lpdds=%x%s caps=%x(%s)\n",
dxversion, lpdds, (IsPrim?"(PRIM)":(IsBack ? "(BACK)":"")), lpddsc->dwCaps, ExplainDDSCaps(lpddsc->dwCaps));
#if 0
if(lpddsc->dwCaps & DDSCAPS_MIPMAP){
OutTraceDW("GetAttachedSurface: emulate MIPMAP capability\n");
lpddsc->dwCaps &= ~DDSCAPS_MIPMAP;
}
#endif
// this is yet to be proven utility.....
// v2.02.45: No - it prevents "Praetorians" to work!!! -> commented out.
//
@ -3141,6 +3120,88 @@ HRESULT WINAPI PrimaryStretchBlt(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, L
return res;
}
HRESULT WINAPI PrimaryBilinearBlt(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect)
{
HRESULT res;
extern void Resize_HQ_4ch( unsigned char*, RECT *, int, unsigned char*, RECT *, int);
/* to be implemented .... */
DDSURFACEDESC ddsd;
RECT TmpRect, SrcRect;
LPDIRECTDRAWSURFACE lpddsTmp;
LPDIRECTDRAWSURFACE lpddsBak;
LPDIRECTDRAWSURFACE lpddsCopy=NULL;
DDSCAPS caps;
BYTE *bSourceBuf, *bDestBuf;
LONG dwWidth, dwHeight;
int SrcPitch, DestPitch;
caps.dwCaps = DDSCAPS_BACKBUFFER;
memset(&ddsd, 0, sizeof(DDSURFACEDESC));
ddsd.dwSize = sizeof(DDSURFACEDESC);
if(lpddssrc==NULL){
// blit from backbuffer
lpdds->GetAttachedSurface(&caps, &lpddsBak);
if(lpddsBak) lpddsBak->GetSurfaceDesc(&ddsd);
}
else{
// blit from surface
lpddssrc->GetSurfaceDesc(&ddsd);
}
// assign source RECT values anyway....
if(!lpsrcrect){
lpsrcrect = &SrcRect;
lpsrcrect->left = lpsrcrect->top = 0;
lpsrcrect->right = dxw.GetScreenWidth();
lpsrcrect->bottom = dxw.GetScreenHeight();
}
dwWidth = lpdestrect->right - lpdestrect->left;
dwHeight = lpdestrect->bottom - lpdestrect->top;
TmpRect.left = TmpRect.top = 0;
TmpRect.bottom = ddsd.dwHeight = dwHeight;
TmpRect.right = ddsd.dwWidth = dwWidth;
ddsd.dwFlags = (DDSD_HEIGHT | DDSD_WIDTH | DDSD_CAPS);
// work only on even width surfaces, or you'd have to take in account proper pitch!
// dwWidth = ddsd.dwWidth = ((dwWidth + 1) >> 1) << 1;
// capabilities must cope with primary / backbuffer surface capabilities to get speedy operations
ddsd.ddsCaps.dwCaps = bIs3DPrimarySurfaceDevice ? DDSCAPS_OFFSCREENPLAIN : (DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY);
res=(*pCreateSurface1)(lpPrimaryDD, (LPDDSURFACEDESC)&ddsd, &lpddsTmp, NULL);
if(res) OutTraceE("CreateSurface: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
// get informations
memset(&ddsd,0,sizeof(DDSURFACEDESC));
ddsd.dwSize = sizeof(DDSURFACEDESC);
ddsd.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
res=(*pLock)(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0);
if(res) OutTraceE("Lock: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
bSourceBuf = (BYTE *)ddsd.lpSurface;
SrcPitch = ddsd.lPitch;
memset(&ddsd,0,sizeof(DDSURFACEDESC));
ddsd.dwSize = sizeof(DDSURFACEDESC);
ddsd.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
res=(*pLock)(lpddsTmp, 0, (LPDDSURFACEDESC)&ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0);
if(res) OutTraceE("Lock: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
bDestBuf = (BYTE *)ddsd.lpSurface;
DestPitch = ddsd.lPitch;
// do the filtering
Resize_HQ_4ch(
bSourceBuf, lpsrcrect, SrcPitch,
bDestBuf, lpdestrect, DestPitch);
// fast-blit to primary
//(*pUnlockMethod(lpddssrc))(lpddssrc, NULL);
//(*pUnlockMethod(lpddsTmp))(lpddsTmp, NULL);
(*pUnlock1)(lpddssrc, NULL);
//(*pUnlock1)(lpddsTmp, NULL);
lpddsTmp->Unlock(NULL); // this surface is unhooked!!!
res= (*pBltFast)(lpdds, lpdestrect->left, lpdestrect->top, lpddsTmp, &TmpRect, DDBLTFAST_WAIT);
if(res) OutTraceE("BltFast: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
(*pReleaseS)(lpddsTmp);
if(lpddsCopy) (*pReleaseS)(lpddsCopy);
return res;
}
HRESULT WINAPI PrimaryNoBlt(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect)
{
return DD_OK;
@ -3300,8 +3361,15 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect,
// Blit to primary surface
// =========================
if(!lpdestrect ||
(lpdestrect && (lpdestrect->bottom == dxw.GetScreenHeight()) && (lpdestrect->right == dxw.GetScreenWidth())))
if(dxw.dwFlags5 & QUARTERBLT){
BOOL QuarterUpdate;
QuarterUpdate = lpdestrect ?
(((lpdestrect->bottom - lpdestrect->top) * (lpdestrect->right - lpdestrect->left)) > ((LONG)(dxw.GetScreenHeight() * dxw.GetScreenWidth()) >> 2))
:
TRUE;
if(QuarterUpdate) if(dxw.HandleFPS()) return DD_OK;
}
else
if(dxw.HandleFPS()) return DD_OK;
if(dxw.dwFlags5 & NOBLT) return DD_OK;
@ -3393,6 +3461,7 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect,
// blit only when source and dest surface are different. Should make ScreenRefresh faster.
if (lpdds != lpddssrc){
if (IsDebug) BlitTrace("SRC2EMU", &emurect, &destrect, __LINE__);
if(destrect.top == -32000) return DD_OK; // happens when window is minimized & do not notify on task switch ...
res=(*pBlt)(lpdds, &emurect, lpddssrc, lpsrcrect, dwflags, lpddbltfx);
}
@ -4385,33 +4454,14 @@ HRESULT WINAPI extGetPixelFormat(LPDIRECTDRAWSURFACE lpdds, LPDDPIXELFORMAT p)
return res;
}
#if 0
static HRESULT WINAPI RestoreAll(LPDIRECTDRAWSURFACE7 lpDDSurface, LPDDSURFACEDESC2 lpDDSurfaceDesc, LPVOID lpContext)
{
HRESULT res;
//res=lpDDSurface->Restore();
res=(*pRestore)((LPDIRECTDRAWSURFACE)lpDDSurface);
OutTraceB("TestCooperativeLevel: Restore lpdds=%x res=%x(%s)\n", lpDDSurface, res, ExplainDDError(res));
(*pReleaseS)((LPDIRECTDRAWSURFACE)lpDDSurface);
if(res) return DDENUMRET_CANCEL;
return DDENUMRET_OK;
}
#endif
HRESULT WINAPI extTestCooperativeLevel(LPDIRECTDRAW lpdd)
{
HRESULT res;
res=(*pTestCooperativeLevel)(lpdd);
OutTraceB("TestCooperativeLevel: lpdd=%x res=%x(%s)\n", lpdd, res, ExplainDDError(res));
if(res==DDERR_WRONGMODE) {
#if 0
(*pEnumSurfaces4)(lpdd, DDENUMSURFACES_DOESEXIST|DDENUMSURFACES_ALL, NULL, NULL, (LPDDENUMSURFACESCALLBACK2)RestoreAll);
//lpDDSEmu_Prim->Restore();
//res=(*pEnumSurfaces4)(lpdd, dwflags, lpddsd, lpContext, cb);
#else
res=((LPDIRECTDRAW7)lpdd)->RestoreAllSurfaces();
if(res) OutTraceE("TestCooperativeLevel: RestoreAllSurfaces ERROR res=%x(%s)\n", res, ExplainDDError(res));
#endif
}
if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=DD_OK;
return res;

@ -37,7 +37,8 @@ static void MarkRect32(DWORD *dest, int w, int h, int destpitch)
{
int x, y;
for(x = 0; x < w; x ++) *(dest ++) = MARKBLITCOLOR32;
for(x = 0; x < w; x ++) *(dest ++) = MARKBLITCOLOR32;
if (h<3) return;
dest += destpitch;
for(y = 0; y < h-2; y ++){
*dest = MARKBLITCOLOR32;
@ -54,6 +55,7 @@ static void MarkRect16(SHORT *dest, int w, int h, int destpitch)
int x, y;
for(x = 0; x < w; x ++) *(dest ++) = MARKBLITCOLOR16;
if (h<3) return;
dest += destpitch;
for(y = 0; y < h-2; y ++){
*dest = MARKBLITCOLOR16;
@ -1528,13 +1530,13 @@ void SetBltTransformations()
case 8:
pRevBlt=RevBlt_32_to_8;
pEmuBlt=EmuBlt_8_to_32;
if(dxw.dwFlags4 & BILINEARFILTER) pEmuBlt=BilinearBlt_8_to_32;
if(dxw.dwFlags4 & BILINEAR2XFILTER) pEmuBlt=BilinearBlt_8_to_32;
OutTraceDW("set color transformation 8<->32\n");
break;
case 16:
pRevBlt=RevBlt_32_to_16;
pEmuBlt=EmuBlt_16_to_32;
if(dxw.dwFlags4 & BILINEARFILTER) pEmuBlt=BilinearBlt_16_to_32;
if(dxw.dwFlags4 & BILINEAR2XFILTER) pEmuBlt=BilinearBlt_16_to_32;
OutTraceDW("set color transformation 16<->32\n");
break;
case 24:
@ -1544,7 +1546,7 @@ void SetBltTransformations()
break;
case 32:
pEmuBlt=EmuBlt_32_to_32;
if(dxw.dwFlags4 & BILINEARFILTER) pEmuBlt=BilinearBlt_32_to_32;
if(dxw.dwFlags4 & BILINEAR2XFILTER) pEmuBlt=BilinearBlt_32_to_32;
OutTraceDW("set color transformation 32->32\n");
break;
default:
@ -1557,13 +1559,13 @@ void SetBltTransformations()
case 8:
pRevBlt=RevBlt_16_to_8;
pEmuBlt=EmuBlt_8_to_16;
if(dxw.dwFlags4 & BILINEARFILTER) pEmuBlt=BilinearBlt_8_to_16;
if(dxw.dwFlags4 & BILINEAR2XFILTER) pEmuBlt=BilinearBlt_8_to_16;
OutTraceDW("set color transformation 8<->16\n");
break;
case 16:
pRevBlt=RevBlt_16_to_16;
pEmuBlt=EmuBlt_16_to_16;
if(dxw.dwFlags4 & BILINEARFILTER) pEmuBlt=BilinearBlt_16_to_16;
if(dxw.dwFlags4 & BILINEAR2XFILTER) pEmuBlt=BilinearBlt_16_to_16;
OutTraceDW("set color transformation 16<->16\n");
break;
case 24:
@ -1588,6 +1590,7 @@ void SetBltTransformations()
pPrimaryBlt = PrimaryBlt;
if(dxw.dwFlags5 & AEROBOOST) pPrimaryBlt = PrimaryStretchBlt;
if(dxw.dwFlags5 & BILINEARFILTER) pPrimaryBlt = PrimaryBilinearBlt;
if(dxw.dwFlags5 & DOFASTBLT) pPrimaryBlt = PrimaryFastBlt; // debug opt
if(dxw.dwFlags5 & NOBLT) pPrimaryBlt = PrimaryNoBlt; // debug opt
return;

@ -1,4 +1,6 @@
#define _CRT_SECURE_NO_DEPRECATE 1
#define DIRECTINPUT_VERSION 0x0800
#include <windows.h>
#include <stdio.h>
#include <ddraw.h>

@ -84,7 +84,7 @@ static char *Flag3Names[32]={
static char *Flag4Names[32]={
"NOALPHACHANNEL", "SUPPRESSCHILD", "FIXREFCOUNTER", "SHOWTIMESTRETCH",
"ZBUFFERCLEAN", "ZBUFFER0CLEAN", "ZBUFFERALWAYS", "DISABLEFOGGING",
"NOPOWER2FIX", "NOPERFCOUNTER", "BILINEARFILTER", "INTERCEPTRDTSC",
"NOPOWER2FIX", "NOPERFCOUNTER", "BILINEAR2XFILTER", "INTERCEPTRDTSC",
"LIMITSCREENRES", "NOFILLRECT", "HOOKGLIDE", "HIDEDESKTOP",
"STRETCHTIMERS", "NOFLIPEMULATION", "NOTEXTURES", "RETURNNULLREF",
"FINETIMING", "NATIVERES", "SUPPORTSVGA", "SUPPORTHDTV",
@ -93,9 +93,9 @@ static char *Flag4Names[32]={
};
static char *Flag5Names[32]={
"DIABLOTWEAK", "CLEARTARGET", "NOWINPOSCHANGES", "SYSTEMMEMORY",
"NOBLT", "--DOSTRETCHBLT---", "DOFASTBLT", "AEROBOOST",
"", "", "", "",
"DIABLOTWEAK", "CLEARTARGET", "NOWINPOSCHANGES", "NOSYSTEMMEMORY",
"NOBLT", "NOSYSTEMEMULATED", "DOFASTBLT", "AEROBOOST",
"QUARTERBLT", "NOIMAGEHLP", "BILINEARFILTER", "",
"", "", "", "",
"", "", "", "",
"", "", "", "",
@ -454,11 +454,11 @@ void CalculateWindowPos(HWND hwnd, DWORD width, DWORD height, LPWINDOWPOS wp)
MaxY = dxw.iSizY;
if (!MaxX) {
MaxX = width;
if(dxw.dwFlags4 & BILINEARFILTER) MaxX <<= 1; // double
if(dxw.dwFlags4 & BILINEAR2XFILTER) MaxX <<= 1; // double
}
if (!MaxY) {
MaxY = height;
if(dxw.dwFlags4 & BILINEARFILTER) MaxY <<= 1; // double
if(dxw.dwFlags4 & BILINEAR2XFILTER) MaxY <<= 1; // double
}
//GetClientRect(0, &desktop);
(*pGetClientRect)(GetDesktopWindow(), &desktop);
@ -495,7 +495,7 @@ void CalculateWindowPos(HWND hwnd, DWORD width, DWORD height, LPWINDOWPOS wp)
// BEWARE: from MSDN - If the window is a child window, the return value is undefined.
hMenu = (dwStyle & WS_CHILD) ? NULL : GetMenu(hwnd);
AdjustWindowRectEx(&rect, dwStyle, (hMenu!=NULL), dwExStyle);
if (hMenu) CloseHandle(hMenu);
if (hMenu) __try {CloseHandle(hMenu);} __except(EXCEPTION_EXECUTE_HANDLER){};
switch(dxw.Coordinates){
case DXW_DESKTOP_WORKAREA:
case DXW_DESKTOP_FULL:
@ -773,24 +773,6 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
OutTrace("\n");
}
#if 0
if(dxw.dwFlags2 & WALLPAPERMODE) {
static int t=0;
if ((*pGetTickCount)() - t > 100){
//if (GetTopWindow(NULL)==hwnd){
{
(*pSetWindowPos)(hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE);
t = (*pGetTickCount)();
}
}
//if ((message >= WM_MOUSEFIRST) && (message <= WM_MOUSELAST)) return 0;
//if (message == WM_WINDOWPOSCHANGED) {
// t=0;
// return 0;
//}
}
#endif
if(dxw.dwFlags3 & FILTERMESSAGES){
switch(message){
case WM_NCMOUSEMOVE:
@ -1122,6 +1104,7 @@ void HookSysLibsInit()
HookKernel32Init();
HookUser32Init();
HookGDI32Init();
HookImagehlpInit();
}
DEVMODE InitDevMode;
@ -1529,7 +1512,7 @@ void HookInit(TARGETMAP *target, HWND hwnd)
"DirectX7", "DirectX8", "DirectX9", "DirectX10", "DirectX11", "None", ""
};
static char *Resolutions[]={
"unlimited", "320x200", "640x480", "800x600", "1024x768", "1280x960", "" // terminator
"unlimited", "320x200", "400x300", "640x480", "800x600", "1024x768", "1280x960", "" // terminator
};
dxw.InitTarget(target);

@ -10,6 +10,7 @@ extern void HookKernel32(HMODULE);
extern void HookUser32(HMODULE);
extern void HookWinMM(HMODULE);
extern void HookAdvApi32(HMODULE);
extern void HookImagehlp(HMODULE);
extern void InitPosition(int, int, int, int, int, int);
//void InitWindowPos(int, int, int, int);
@ -35,6 +36,7 @@ extern FARPROC Remap_ImeLib_ProcAddress(LPCSTR, HMODULE);
extern FARPROC Remap_vfw_ProcAddress(LPCSTR, HMODULE);
extern FARPROC Remap_AdvApi32_ProcAddress(LPCSTR, HMODULE);
extern FARPROC Remap_Glide_ProcAddress(LPCSTR, HMODULE);
extern FARPROC Remap_Imagehlp_ProcAddress(LPCSTR, HMODULE);
typedef enum {
HOOK_IAT_CANDIDATE = 0,

@ -107,6 +107,13 @@ void dxwCore::InitTarget(TARGETMAP *target)
pTimeShifter = TimeShifterCoarse;
pTimeShifter64 = TimeShifter64Coarse;
}
iSizX = target->sizx;
iSizY = target->sizy;
iPosX = target->posx;
iPosY = target->posy;
// Aspect Ratio from window size, or traditional 4:3 by default
iRatioX = iSizX ? iSizX : 800;
iRatioY = iSizY ? iSizY : 600;
}
void dxwCore::SetScreenSize(void)
@ -132,6 +139,7 @@ void dxwCore::SetScreenSize(int x, int y)
maxw=HUGE; maxh=HUGE;
switch(dxw.MaxScreenRes){
case DXW_LIMIT_320x200: maxw=320; maxh=200; break;
case DXW_LIMIT_400x300: maxw=400; maxh=300; 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;
@ -412,11 +420,6 @@ POINT dxwCore::FixCursorPos(POINT prev)
// remember: rect from GetClientRect always start at 0,0!
if(dxw.dwFlags1 & MODIFYMOUSE){
int w, h, b; // width, height and border
int iRatioX, iRatioY;
// ratio is the configured one, unless the values are 0. Then, it's the standard 4:3 ratio.
iRatioX = iSizX ? iSizX : 4;
iRatioY = iSizY ? iSizY : 3;
if (!(*pGetClientRect)(hWnd, &rect)) { // v2.02.30: always use desktop win
OutTraceDW("GetClientRect ERROR %d at %d\n", GetLastError(),__LINE__);
@ -564,11 +567,6 @@ void dxwCore::SethWnd(HWND hwnd)
void dxwCore::FixWorkarea(LPRECT workarea)
{
int w, h, b; // width, height and border
int iRatioX, iRatioY;
// ratio is the configured one, unless the values are 0. Then, it's the standard 4:3 ratio.
iRatioX = iSizX ? iSizX : 4;
iRatioY = iSizY ? iSizY : 3;
w = workarea->right - workarea->left;
h = workarea->bottom - workarea->top;
@ -590,11 +588,6 @@ RECT dxwCore::MapWindowRect(LPRECT lpRect)
RECT RetRect;
RECT ClientRect;
int w, h, bx, by; // width, height and x,y borders
int iRatioX, iRatioY;
// ratio is the configured one, unless the values are 0. Then, it's the standard 4:3 ratio.
iRatioX = iSizX ? iSizX : 4;
iRatioY = iSizY ? iSizY : 3;
if (!(*pGetClientRect)(hWnd, &ClientRect)){
OutTraceE("GetClientRect ERROR: err=%d hwnd=%x at %d\n", GetLastError(), hWnd, __LINE__);
@ -1231,7 +1224,7 @@ void dxwCore::ShowOverlay(LPDIRECTDRAWSURFACE lpdds)
if (FAILED(lpdds->GetDC(&hdc))) return;
w = this->GetScreenWidth();
h = this->GetScreenHeight();
if(this->dwFlags4 & BILINEARFILTER) {
if(this->dwFlags4 & BILINEAR2XFILTER) {
w <<=1;
h <<=1;
}
@ -1443,6 +1436,7 @@ int dxwCore::GetDLLIndex(char *lpFileName)
"wintrust",
"d3dim",
"d3dim700",
"imagehlp",
// "+glide",
// "+glide2x",
// "+glide3x",
@ -1601,6 +1595,8 @@ BOOL dxwCore::ReleaseEmulatedDC(HWND hwnd)
if(!(wdc=(*pGDIGetDC)(hwnd)))
OutTraceE("GetDC: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
//OutTrace("StretchBlt: destdc=%x destrect=(0,0)-(%d,%d) srcdc=%x srcrect=(0,0)-(%d,%d)\n", wdc, client.right, client.bottom, VirtualHDC, VirtualPicRect.right, VirtualPicRect.bottom);
// v2.02.94: set HALFTONE stretching. But causes problems with Imperialism II
// SetStretchBltMode(wdc,HALFTONE);
if(!(*pGDIStretchBlt)(wdc, 0, 0, client.right, client.bottom, VirtualHDC, 0, 0, VirtualPicRect.right, VirtualPicRect.bottom, SRCCOPY))
OutTraceE("StretchBlt: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
//(*pInvalidateRect)(hwnd, NULL, 0);

@ -149,6 +149,8 @@ public: // simple data variables
short iPosY;
short iSizX;
short iSizY;
int iRatioX;
int iRatioY;
char *CustomOpenGLLib;
WORD palVersion;
WORD palNumEntries;
@ -217,6 +219,8 @@ typedef enum {
SYSLIBIDX_WINTRUST,
SYSLIBIDX_DIRECT3D,
SYSLIBIDX_DIRECT3D700,
// SYSLIBIDX_DBGHELP,
SYSLIBIDX_IMAGEHLP,
// SYSLIBIDX_GLIDE,
// SYSLIBIDX_GLIDE2X,
// SYSLIBIDX_GLIDE3X,

Binary file not shown.

@ -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.93.f1"
#define VERSION "2.02.94"
#define DDTHREADLOCK 1

Binary file not shown.

@ -220,6 +220,10 @@
RelativePath=".\advapi.cpp"
>
</File>
<File
RelativePath=".\bilinear.cpp"
>
</File>
<File
RelativePath=".\ddproxy.cpp"
>
@ -372,6 +376,10 @@
RelativePath=".\iatpatch.cpp"
>
</File>
<File
RelativePath=".\imagehlp.cpp"
>
</File>
<File
RelativePath=".\imelib.cpp"
>

@ -1334,6 +1334,8 @@ int WINAPI extSetDIBitsToDevice(HDC hdc, int XDest, int YDest, DWORD dwWidth, DW
OutTraceE("SelectObject: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
if(!(*pSetDIBitsToDevice)(hTempDc, 0, 0, OrigWidth, OrigHeight, XSrc, YSrc, uStartScan, cScanLines, lpvBits, lpbmi, fuColorUse))
OutTraceE("SetDIBitsToDevice: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
// v2.02.94: set HALFTONE stretching. Fixes "Celtic Kings Rage of War"
SetStretchBltMode(hdc,HALFTONE);
if(!(ret=(*pGDIStretchBlt)(hdc, XDest, YDest, dwWidth, dwHeight, hTempDc, 0, 0, OrigWidth, OrigHeight, SRCCOPY)))
OutTraceE("StretchBlt: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
if(!(DeleteObject(hbmPic))) // v2.02.32 - avoid resource leakage

@ -844,30 +844,39 @@ HRESULT WINAPI extGetAdapterDisplayMode9(void *lpd3d, UINT Adapter, D3DDISPLAYMO
return res;
}
void FixD3DWindowFrame(HWND hfocuswindow)
HWND FixD3DWindowFrame(HWND hFocusWin)
{
extern void HookWindowProc(HWND);
HWND hRetWnd = hFocusWin;
if(!(dxw.dwFlags3 & NOWINDOWMOVE))
AdjustWindowFrame(dxw.GethWnd(), dxw.GetScreenWidth(), dxw.GetScreenHeight());
if(dxw.dwFlags3 & FIXD3DFRAME){
char ClassName[81];
RECT workarea;
HWND hChildWin;
GetClassName(dxw.GethWnd(), ClassName, 80);
(*pGetClientRect)(dxw.GethWnd(), &workarea);
if (dxw.dwFlags2 & KEEPASPECTRATIO) dxw.FixWorkarea(&workarea);
hfocuswindow=(*pCreateWindowExA)(
hChildWin=(*pCreateWindowExA)(
0, ClassName, "child",
WS_CHILD|WS_VISIBLE,
//GetSystemMetrics(SM_CXSIZEFRAME), GetSystemMetrics(SM_CYSIZEFRAME)+GetSystemMetrics(SM_CYCAPTION),
workarea.left, workarea.top, workarea.right-workarea.left, workarea.bottom-workarea.top,
//workarea.left+20, workarea.top+20, workarea.right-workarea.left-40, workarea.bottom-workarea.top-40,
dxw.GethWnd(), NULL, NULL, NULL);
if (hfocuswindow)
OutTraceD3D("CreateDevice: updated hfocuswindow=%x pos=(%d,%d) size=(%d,%d)\n",
hfocuswindow, workarea.left, workarea.top, workarea.right-workarea.left, workarea.bottom-workarea.top);
if (hChildWin)
OutTraceD3D("CreateDevice: ChildWin=%x pos=(%d,%d) size=(%d,%d)\n",
hChildWin, workarea.left, workarea.top, workarea.right-workarea.left, workarea.bottom-workarea.top);
else
OutTraceE("CreateDevice: CreateWindowEx ERROR err=%d\n", GetLastError());
dxw.SethWnd(hfocuswindow, dxw.GethWnd());
dxw.SethWnd(hChildWin, dxw.GethWnd());
HookWindowProc(hChildWin);
hRetWnd = hChildWin;
}
return hRetWnd;
}
HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype,
@ -884,7 +893,7 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype,
dxw.SethWnd(hfocuswindow);
dxw.SetScreenSize(param[0], param[1]);
if(dxw.Windowize) FixD3DWindowFrame(hfocuswindow);
if(dxw.Windowize) hfocuswindow=FixD3DWindowFrame(hfocuswindow);
if(IsTraceD3D){
tmp = param;
@ -998,7 +1007,7 @@ HRESULT WINAPI extCreateDeviceEx(void *lpd3d, UINT adapter, D3DDEVTYPE devicetyp
dxw.SethWnd(hfocuswindow);
dxw.SetScreenSize(param[0], param[1]);
if(dxw.Windowize) FixD3DWindowFrame(hfocuswindow);
if(dxw.Windowize) hfocuswindow=FixD3DWindowFrame(hfocuswindow);
tmp = param;
if(IsTraceD3D){

@ -19,6 +19,7 @@ extern HRESULT WINAPI PrimaryBlt(LPDIRECTDRAWSURFACE, LPRECT, LPDIRECTDRAWSURFAC
extern HRESULT WINAPI PrimaryNoBlt(LPDIRECTDRAWSURFACE, LPRECT, LPDIRECTDRAWSURFACE, LPRECT);
extern HRESULT WINAPI PrimaryStretchBlt(LPDIRECTDRAWSURFACE, LPRECT, LPDIRECTDRAWSURFACE, LPRECT);
extern HRESULT WINAPI PrimaryFastBlt(LPDIRECTDRAWSURFACE, LPRECT, LPDIRECTDRAWSURFACE, LPRECT);
extern HRESULT WINAPI PrimaryBilinearBlt(LPDIRECTDRAWSURFACE, LPRECT, LPDIRECTDRAWSURFACE, LPRECT);
// COM generic types
typedef HRESULT (WINAPI *QueryInterface_Type)(void *, REFIID, LPVOID *);

61
dll/imagehlp.cpp Normal file

@ -0,0 +1,61 @@
#include "dxwnd.h"
#include "dxwcore.hpp"
#include "syslibs.h"
#include "dxhook.h"
#include "dxhelper.h"
#include "stdio.h"
#include "Dbghelp.h"
typedef PIMAGE_DEBUG_INFORMATION (WINAPI *MapDebugInformation_Type)(HANDLE, PCSTR, PCSTR, ULONG);
typedef BOOL (WINAPI *UnmapDebugInformation_Type)(PIMAGE_DEBUG_INFORMATION);
PIMAGE_DEBUG_INFORMATION WINAPI extMapDebugInformation(HANDLE, PCSTR, PCSTR, ULONG);
BOOL WINAPI extUnmapDebugInformation(PIMAGE_DEBUG_INFORMATION);
MapDebugInformation_Type pMapDebugInformation = NULL;
UnmapDebugInformation_Type pUnmapDebugInformation = NULL;
static HookEntry_Type Hooks[]={
{HOOK_IAT_CANDIDATE, "MapDebugInformation", (FARPROC)NULL, (FARPROC *)&pMapDebugInformation, (FARPROC)extMapDebugInformation},
{HOOK_IAT_CANDIDATE, "UnmapDebugInformation", (FARPROC)NULL, (FARPROC *)&pUnmapDebugInformation, (FARPROC)extUnmapDebugInformation},
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
};
static char *libname = "IMAGEHLP.DLL";
void HookImagehlpInit()
{
HookLibInit(Hooks);
}
void HookImagehlp(HMODULE module)
{
if(dxw.dwFlags5 & NOIMAGEHLP) HookLibrary(module, Hooks, libname);
}
FARPROC Remap_Imagehlp_ProcAddress(LPCSTR proc, HMODULE hModule)
{
FARPROC addr;
if(dxw.dwFlags5 & NOIMAGEHLP) {
if(addr=RemapLibrary(proc, hModule, Hooks)) return addr;
}
return NULL;
}
// =================== rerouted calls ==========================
IMAGE_DEBUG_INFORMATION DummyDebugInfo;
PIMAGE_DEBUG_INFORMATION WINAPI extMapDebugInformation(HANDLE FileHandle, PCSTR FileName, PCSTR SymbolPath, ULONG ImageBase)
{
OutTrace("MapDebugInformation: FileHandle=%x FileName=%s SymbolPath=%s ImageBase=%x\n", FileHandle, FileName, SymbolPath, ImageBase);
memset(&DummyDebugInfo, 0, sizeof(IMAGE_DEBUG_INFORMATION));
return &DummyDebugInfo;
}
BOOL WINAPI extUnmapDebugInformation(PIMAGE_DEBUG_INFORMATION DebugInfo)
{
OutTrace("UnmapDebugInformation: DebugInfo=%x\n", DebugInfo);
return TRUE;
}

@ -420,13 +420,6 @@ HMODULE WINAPI LoadLibraryExWrapper(LPCTSTR lpFileName, HANDLE hFile, DWORD dwFl
OutTraceDW("%s: hooking lib=\"%s\" handle=%x\n", api, lpFileName, libhandle);
HookModule(libhandle, 0);
}
#if 0
switch(idx){
case SYSLIBIDX_DIRECTDRAW: HookDirectDraw(libhandle, 0); break;
case SYSLIBIDX_DIRECT3D8: HookDirect3D(libhandle, 8); break;
case SYSLIBIDX_DIRECT3D9: HookDirect3D(libhandle, 9); break;
}
#endif
return libhandle;
}
@ -545,8 +538,11 @@ FARPROC WINAPI extGetProcAddress(HMODULE hModule, LPCSTR proc)
case SYSLIBIDX_DIRECT3D700:
if (remap=Remap_d3d7_ProcAddress(proc, hModule)) return remap;
break;
default:
case SYSLIBIDX_IMAGEHLP:
if (remap=Remap_Imagehlp_ProcAddress(proc, hModule)) return remap;
break;
default:
break;
}
}
else {

@ -654,5 +654,6 @@ extern MMRESULT WINAPI exttimeKillEvent(UINT);
extern void HookKernel32Init();
extern void HookUser32Init();
extern void HookGDI32Init();
extern void HookImagehlpInit();
/* eof */

@ -357,13 +357,6 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam)
// note: v2.1.93: compensation must refer to the client area, not the wp
// window dimensions that include the window borders.
if(BorderX==-1){
#if 0
RECT client, full;
(*pGetClientRect)(hwnd, &client);
(*pGetWindowRect)(hwnd, &full);
BorderX= full.right - full.left - client.right;
BorderY= full.bottom - full.top - client.bottom;
#else
// v2.02.92: Fixed for AERO mode, where GetWindowRect substantially LIES!
RECT client, full;
LONG dwStyle, dwExStyle;
@ -375,10 +368,9 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam)
dwExStyle=(*pGetWindowLongA)(hwnd, GWL_EXSTYLE);
hMenu = (dwStyle & WS_CHILD) ? NULL : GetMenu(hwnd);
AdjustWindowRectEx(&full, dwStyle, (hMenu!=NULL), dwExStyle);
if (hMenu) CloseHandle(hMenu);
if (hMenu) __try {CloseHandle(hMenu);} __except(EXCEPTION_EXECUTE_HANDLER){};
BorderX= full.right - full.left - client.right;
BorderY= full.bottom - full.top - client.bottom;
#endif
OutTraceDW("%s: KEEPASPECTRATIO window borders=(%d,%d)\n", ApiName, BorderX, BorderY);
}
extern LRESULT LastCursorPos;
@ -389,7 +381,7 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam)
case HTBOTTOMRIGHT:
case HTTOPLEFT:
case HTTOPRIGHT:
cx = BorderX + ((wp->cy - BorderY) * dxw.GetScreenWidth()) / dxw.GetScreenHeight();
cx = BorderX + ((wp->cy - BorderY) * dxw.iRatioX) / dxw.iRatioY;
if(cx!=wp->cx){
OutTraceDW("%s: KEEPASPECTRATIO adjusted cx=%d->%d\n", ApiName, wp->cx, cx);
wp->cx = cx;
@ -397,7 +389,7 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam)
break;
case HTLEFT:
case HTRIGHT:
cy = BorderY + ((wp->cx - BorderX) * dxw.GetScreenHeight()) / dxw.GetScreenWidth();
cy = BorderY + ((wp->cx - BorderX) * dxw.iRatioY) / dxw.iRatioX;
if(cy!=wp->cy){
OutTraceDW("%s: KEEPASPECTRATIO adjusted cy=%d->%d\n", ApiName, wp->cy, cy);
wp->cy = cy;

Binary file not shown.

@ -43,12 +43,14 @@ void CTabCompat::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_NOPERFCOUNTER, cTarget->m_NoPerfCounter);
DDX_Check(pDX, IDC_HIDECDROMEMPTY, cTarget->m_HideCDROMEmpty);
DDX_Check(pDX, IDC_DIABLOTWEAK, cTarget->m_DiabloTweak);
DDX_Check(pDX, IDC_NOIMAGEHLP, cTarget->m_NoImagehlp);
// 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_Check(pDX, IDC_CLEARTARGET, cTarget->m_ClearTarget);
DDX_Check(pDX, IDC_NOD3DRESET, cTarget->m_NoD3DReset);
// Registry management
DDX_Check(pDX, IDC_EMULATEREGISTRY, cTarget->m_EmulateRegistry);

@ -32,9 +32,8 @@ void CTabDebug::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_DXPROXED, cTarget->m_DXProxed);
DDX_Check(pDX, IDC_ASSERT, cTarget->m_AssertDialog);
DDX_Check(pDX, IDC_MARKBLIT, cTarget->m_MarkBlit);
DDX_Check(pDX, IDC_SYSTEMMEMORY, cTarget->m_SystemMemory);
DDX_Check(pDX, IDC_NOBLT, cTarget->m_NoBlt);
// DDX_Check(pDX, IDC_STRETCHBLT, cTarget->m_StretchBlt);
// DDX_Check(pDX, IDC_BILINEARBLT, cTarget->m_BilinearBlt);
DDX_Check(pDX, IDC_FASTBLT, cTarget->m_FastBlt);
DDX_Check(pDX, IDC_ANALYTICMODE, cTarget->m_AnalyticMode);
DDX_Check(pDX, IDC_SURFACEWARN, cTarget->m_SurfaceWarn);

@ -27,8 +27,10 @@ void CTabDirectX::DoDataExchange(CDataExchange* pDX)
CDialog::DoDataExchange(pDX);
CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent()));
DDX_Radio(pDX, IDC_AUTO, cTarget->m_DXVersion);
DDX_Radio(pDX, IDC_NOEMULATESURFACE, cTarget->m_DxEmulationMode);
//DDX_Radio(pDX, IDC_NOEMULATESURFACE, cTarget->m_DxEmulationMode);
DDX_Radio(pDX, IDC_AUTOMATIC, cTarget->m_DxEmulationMode);
//DDX_Check(pDX, IDC_HANDLEDC, cTarget->m_HandleDC);
DDX_Radio(pDX, IDC_DDRAWFILTER, cTarget->m_DxFilterMode);
DDX_Check(pDX, IDC_SUPPRESSCLIPPING, cTarget->m_SuppressClipping);
DDX_Check(pDX, IDC_BLITFROMBACKBUFFER, cTarget->m_BlitFromBackBuffer);
DDX_Check(pDX, IDC_AUTOREFRESH, cTarget->m_AutoRefresh);
@ -42,11 +44,12 @@ void CTabDirectX::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_NOALPHACHANNEL, cTarget->m_NoAlphaChannel);
DDX_Check(pDX, IDC_FIXREFCOUNTER, cTarget->m_FixRefCounter);
DDX_Check(pDX, IDC_RETURNNULLREF, cTarget->m_ReturnNullRef);
DDX_Check(pDX, IDC_NOD3DRESET, cTarget->m_NoD3DReset);
DDX_Check(pDX, IDC_NOFLIPEMULATION, cTarget->m_NoFlipEmulation);
DDX_Check(pDX, IDC_FULLRECTBLT, cTarget->m_FullRectBlt);
DDX_Check(pDX, IDC_SETCOMPATIBILITY, cTarget->m_SetCompatibility);
DDX_Check(pDX, IDC_AEROBOOST, cTarget->m_AEROBoost);
DDX_Check(pDX, IDC_NOSYSTEMMEMORY, cTarget->m_NoSystemMemory);
DDX_Check(pDX, IDC_NOSYSTEMEMULATED, cTarget->m_NoSystemEmulated);
}
BEGIN_MESSAGE_MAP(CTabDirectX, CDialog)

@ -36,6 +36,7 @@ void CTabTiming::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_TIMESTRETCH, cTarget->m_TimeStretch);
DDX_Check(pDX, IDC_INTERCEPTRDTSC, cTarget->m_InterceptRDTSC);
DDX_Check(pDX, IDC_STRETCHTIMERS, cTarget->m_StretchTimers);
DDX_Check(pDX, IDC_QUARTERBLT, cTarget->m_QuarterBlt);
DDX_Check(pDX, IDC_FINETIMING, cTarget->m_FineTiming);
DDX_Text(pDX, IDC_MAXFPS, cTarget->m_MaxFPS);
DDX_LBIndex(pDX, IDC_LISTTS, cTarget->m_InitTS);

@ -21,7 +21,6 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
{
//{{AFX_DATA_INIT(CTargetDlg)
m_DXVersion = 0;
m_BilinearFilter = 0;
m_Coordinates = 0;
m_DxEmulationMode = 4; // default: AUTOMATIC
m_DCEmulationMode = 0; // default: no emulation
@ -42,6 +41,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_SetCompatibility = TRUE; // default true !!
m_AEROBoost = TRUE; // default true !!
m_DiabloTweak = FALSE;
m_NoImagehlp = FALSE;
m_DisableHAL = FALSE;
m_ForcesHEL = FALSE;
m_ColorFix = FALSE;
@ -105,9 +105,10 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_UseRGB565 = FALSE;
m_SuppressDXErrors = FALSE;
m_MarkBlit = FALSE;
m_SystemMemory = FALSE;
m_NoSystemMemory = FALSE;
m_NoSystemEmulated = FALSE;
m_NoBlt = FALSE;
// m_StretchBlt = FALSE;
m_BilinearBlt = FALSE;
m_FastBlt = FALSE;
m_PreventMaximize = FALSE;
m_ClientRemapping = TRUE; // default true !!
@ -138,6 +139,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_ShowTimeStretch = FALSE;
m_TimeStretch = FALSE;
m_StretchTimers = FALSE;
m_QuarterBlt = FALSE;
m_FineTiming = FALSE;
m_ReleaseMouse = FALSE;
m_FrameCompensation = FALSE;

@ -27,8 +27,8 @@ public:
int m_DXVersion;
int m_Coordinates;
int m_DxEmulationMode;
int m_DxFilterMode;
int m_DCEmulationMode;
BOOL m_BilinearFilter;
BOOL m_HookDI;
BOOL m_ModifyMouse;
BOOL m_OutProxyTrace;
@ -83,9 +83,10 @@ public:
BOOL m_UseRGB565;
BOOL m_SuppressDXErrors;
BOOL m_MarkBlit;
BOOL m_SystemMemory;
BOOL m_NoSystemMemory;
BOOL m_NoSystemEmulated;
BOOL m_NoBlt;
// BOOL m_StretchBlt;
BOOL m_BilinearBlt;
BOOL m_FastBlt;
BOOL m_PreventMaximize;
BOOL m_ClientRemapping;
@ -116,6 +117,7 @@ public:
BOOL m_ShowTimeStretch;
BOOL m_TimeStretch;
BOOL m_StretchTimers;
BOOL m_QuarterBlt;
BOOL m_FineTiming;
BOOL m_ReleaseMouse;
BOOL m_FrameCompensation;
@ -150,6 +152,7 @@ public:
BOOL m_SetCompatibility;
BOOL m_AEROBoost;
BOOL m_DiabloTweak;
BOOL m_NoImagehlp;
BOOL m_DisableHAL;
BOOL m_ForcesHEL;
BOOL m_ColorFix;

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -319,6 +319,10 @@
RelativePath=".\getfname.cpp"
>
</File>
<File
RelativePath=".\host.rc"
>
</File>
<File
RelativePath=".\Inject.cpp"
>
@ -490,6 +494,10 @@
RelativePath="Resource.h"
>
</File>
<File
RelativePath=".\resource1.h"
>
</File>
<File
RelativePath=".\StatusDialog.h"
>

@ -127,16 +127,22 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
t->flags &= ~EMULATEFLAGS;
switch(dlg->m_DxEmulationMode){
case 0: break;
case 1: t->flags |= EMULATEBUFFER; break;
case 2: t->flags |= LOCKEDSURFACE; break;
case 3: t->flags |= EMULATESURFACE; break;
case 4: t->flags |= AUTOMATIC; break;
case 5:
t->flags |= EMULATESURFACE;
t->flags4 |= BILINEARFILTER;
case 0: t->flags |= AUTOMATIC; break;
case 1: break;
case 2: t->flags |= EMULATEBUFFER; break;
case 3: t->flags |= LOCKEDSURFACE; break;
case 4: t->flags |= EMULATESURFACE; break;
break;
}
t->flags4 &= ~BILINEAR2XFILTER;
t->flags5 &= ~BILINEARFILTER;
switch(dlg->m_DxFilterMode){
case 0: break;
case 1: t->flags4 |= BILINEAR2XFILTER; break;
case 2: t->flags5 |= BILINEARFILTER; break;
}
t->flags2 &= ~GDISTRETCHED;
t->flags &= ~MAPGDITOPRIMARY;
t->flags3 &= ~GDIEMULATEDC;
@ -186,6 +192,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
if(dlg->m_SetCompatibility) t->flags2 |= SETCOMPATIBILITY;
if(dlg->m_AEROBoost) t->flags5 |= AEROBOOST;
if(dlg->m_DiabloTweak) t->flags5 |= DIABLOTWEAK;
if(dlg->m_NoImagehlp) t->flags5 |= NOIMAGEHLP;
if(dlg->m_DisableHAL) t->flags3 |= DISABLEHAL;
if(dlg->m_ForcesHEL) t->flags3 |= FORCESHEL;
if(dlg->m_ColorFix) t->flags3 |= COLORFIX;
@ -222,9 +229,10 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
if(dlg->m_UseRGB565) t->flags |= USERGB565;
if(dlg->m_SuppressDXErrors) t->flags |= SUPPRESSDXERRORS;
if(dlg->m_MarkBlit) t->flags3 |= MARKBLIT;
if(dlg->m_SystemMemory) t->flags5 |= SYSTEMMEMORY;
if(dlg->m_NoSystemMemory) t->flags5 |= NOSYSTEMMEMORY;
if(dlg->m_NoSystemEmulated) t->flags5 |= NOSYSTEMEMULATED;
if(dlg->m_NoBlt) t->flags5 |= NOBLT;
//if(dlg->m_StretchBlt) t->flags5 |= DOSTRETCHBLT;
//if(dlg->m_BilinearBlt) t->flags5 |= BILINEARFILTER;
if(dlg->m_FastBlt) t->flags5 |= DOFASTBLT;
if(dlg->m_PreventMaximize) t->flags |= PREVENTMAXIMIZE;
if(dlg->m_ClientRemapping) t->flags |= CLIENTREMAPPING;
@ -255,6 +263,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
if(dlg->m_ShowTimeStretch) t->flags4 |= SHOWTIMESTRETCH;
if(dlg->m_TimeStretch) t->flags2 |= TIMESTRETCH;
if(dlg->m_StretchTimers) t->flags4 |= STRETCHTIMERS;
if(dlg->m_QuarterBlt) t->flags5 |= QUARTERBLT;
if(dlg->m_FineTiming) t->flags4 |= FINETIMING;
if(dlg->m_ReleaseMouse) t->flags4 |= RELEASEMOUSE;
if(dlg->m_FrameCompensation) t->flags4 |= FRAMECOMPENSATION;
@ -315,16 +324,15 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
dlg->m_PeekAllMessages = t->flags3 & PEEKALLMESSAGES ? 1 : 0;
dlg->m_NoWinPosChanges = t->flags5 & NOWINPOSCHANGES ? 1 : 0;
dlg->m_DxEmulationMode = 0;
dlg->m_BilinearFilter = FALSE;
if(t->flags & EMULATEBUFFER) dlg->m_DxEmulationMode = 1;
if(t->flags & LOCKEDSURFACE) dlg->m_DxEmulationMode = 2;
if(t->flags & EMULATESURFACE) dlg->m_DxEmulationMode = 3;
if(t->flags & AUTOMATIC) dlg->m_DxEmulationMode = 4;
if(t->flags4 & BILINEARFILTER) {
dlg->m_DxEmulationMode = 5;
dlg->m_BilinearFilter = TRUE;
}
dlg->m_DxEmulationMode = 1; // none
if(t->flags & AUTOMATIC) dlg->m_DxEmulationMode = 0;
if(t->flags & EMULATEBUFFER) dlg->m_DxEmulationMode = 2;
if(t->flags & LOCKEDSURFACE) dlg->m_DxEmulationMode = 3;
if(t->flags & EMULATESURFACE) dlg->m_DxEmulationMode = 4;
dlg->m_DxFilterMode = 0;
if(t->flags4 & BILINEAR2XFILTER) dlg->m_DxFilterMode = 1;
if(t->flags5 & BILINEARFILTER) dlg->m_DxFilterMode = 2;
dlg->m_DCEmulationMode = 0;
if(t->flags2 & GDISTRETCHED) dlg->m_DCEmulationMode = 1;
@ -358,6 +366,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
dlg->m_SetCompatibility = t->flags2 & SETCOMPATIBILITY ? 1 : 0;
dlg->m_AEROBoost = t->flags5 & AEROBOOST ? 1 : 0;
dlg->m_DiabloTweak = t->flags5 & DIABLOTWEAK ? 1 : 0;
dlg->m_NoImagehlp = t->flags5 & NOIMAGEHLP ? 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;
@ -407,9 +416,10 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
dlg->m_UseRGB565 = t->flags & USERGB565 ? 1 : 0;
dlg->m_SuppressDXErrors = t->flags & SUPPRESSDXERRORS ? 1 : 0;
dlg->m_MarkBlit = t->flags3 & MARKBLIT ? 1 : 0;
dlg->m_SystemMemory = t->flags5 & SYSTEMMEMORY ? 1 : 0;
dlg->m_NoSystemMemory = t->flags5 & NOSYSTEMMEMORY ? 1 : 0;
dlg->m_NoSystemEmulated = t->flags5 & NOSYSTEMEMULATED ? 1 : 0;
dlg->m_NoBlt = t->flags5 & NOBLT ? 1 : 0;
//dlg->m_StretchBlt = t->flags5 & DOSTRETCHBLT ? 1 : 0;
//dlg->m_BilinearBlt = t->flags5 & BILINEARFILTER ? 1 : 0;
dlg->m_FastBlt = t->flags5 & DOFASTBLT ? 1 : 0;
dlg->m_PreventMaximize = t->flags & PREVENTMAXIMIZE ? 1 : 0;
dlg->m_ClientRemapping = t->flags & CLIENTREMAPPING ? 1 : 0;
@ -440,6 +450,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
dlg->m_ShowTimeStretch = t->flags4 & SHOWTIMESTRETCH ? 1 : 0;
dlg->m_TimeStretch = t->flags2 & TIMESTRETCH ? 1 : 0;
dlg->m_StretchTimers = t->flags4 & STRETCHTIMERS ? 1 : 0;
dlg->m_QuarterBlt = t->flags5 & QUARTERBLT ? 1 : 0;
dlg->m_FineTiming = t->flags4 & FINETIMING ? 1 : 0;
dlg->m_ReleaseMouse = t->flags4 & RELEASEMOUSE ? 1 : 0;
dlg->m_FrameCompensation = t->flags4 & FRAMECOMPENSATION ? 1 : 0;

BIN
host/host.aps Normal file

Binary file not shown.

1
host/host.rc Normal file

@ -0,0 +1 @@
#include "afxres.rc"

14
host/resource1.h Normal file

@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by host.rc
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

BIN
locale/cn/RCa05260 Normal file

Binary file not shown.

Binary file not shown.

@ -0,0 +1,10 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

Binary file not shown.

1
locale/cn/Release/mt.dep Normal file

@ -0,0 +1 @@
Manifest resource last updated at 23:39:40.80 on 05/10/2014

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioUserFile
ProjectType="Visual C++"
Version="9.00"
ShowAllFiles="false"
>
<Configurations>
<Configuration
Name="Debug|Win32"
>
<DebugSettings
Command=""
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="USER-PC"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
<Configuration
Name="Release|Win32"
>
<DebugSettings
Command=""
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="USER-PC"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
</Configurations>
</VisualStudioUserFile>

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
locale/cn/Resources_EN.rc Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.