diff --git a/Include/dxwnd.h b/Include/dxwnd.h index a49db9e..94b800e 100644 --- a/Include/dxwnd.h +++ b/Include/dxwnd.h @@ -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 diff --git a/build/Resources_CN.dll b/build/Resources_CN.dll index 02139f6..7337cbb 100644 --- a/build/Resources_CN.dll +++ b/build/Resources_CN.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:84f85cf7b70b388793e41f61533229ee60eab599aa6a44407cde99c1ceaa5fdf -size 132096 +oid sha256:2b88d6c9d24ee068087275664ae0d9082c85e8424e47e7b177fbd026763a5631 +size 132608 diff --git a/build/Resources_EN.dll b/build/Resources_EN.dll index 5561296..f535033 100644 --- a/build/Resources_EN.dll +++ b/build/Resources_EN.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:642c9b8d73a7154b70bbb29ebfc13935cd6a26d178eef9989581b4ae8329457f -size 137728 +oid sha256:55f9e6985c7b7f0f5a538ad93199152d964f7d8dc4a552a7bed38fb93cc760e1 +size 116224 diff --git a/build/Resources_IT.dll b/build/Resources_IT.dll index 930e133..70f8408 100644 --- a/build/Resources_IT.dll +++ b/build/Resources_IT.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2a8bd736f7b90333f36f1de42e4d8804431732488e553d89391f5daae705a152 -size 138752 +oid sha256:02e79b180737b4f5e1989026e05e6c48065de39060d977c158ab286a87a5d940 +size 139264 diff --git a/build/dxwnd.dll b/build/dxwnd.dll index c612fee..f2ce6d0 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0f5388e87978467245275dcb12d802fcb1ce55d4f4a0ee2217711fcef520bd3a -size 506368 +oid sha256:f3a3c1ff5c9ff0497a5155abf197a32ac7481a31130d4c441ece3e50b022e6eb +size 525312 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index 20d0dc8..06dd726 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:46e406641683f8f3314bd14855187c086991f84bd234780f15e49f4de3f5c197 -size 557568 +oid sha256:f379180ba2b97d28926280bc4a1b02ed95f3f90cd191aa3fa94d4757bdd106b3 +size 558592 diff --git a/build/dxwnd.ini b/build/dxwnd.ini index cbf8478..6f8d080 100644 --- a/build/dxwnd.ini +++ b/build/dxwnd.ini @@ -1,6 +1,6 @@ [window] -posx=1207 -posy=326 +posx=1182 +posy=638 sizx=320 sizy=200 lang=automatic diff --git a/build/exports/Celtic Kings Rage of War.dxw b/build/exports/Celtic Kings Rage of War.dxw new file mode 100644 index 0000000..aebc866 --- /dev/null +++ b/build/exports/Celtic Kings Rage of War.dxw @@ -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 diff --git a/build/exports/Evil Dead Hail to the King.dxw b/build/exports/Evil Dead Hail to the King.dxw new file mode 100644 index 0000000..226a75f --- /dev/null +++ b/build/exports/Evil Dead Hail to the King.dxw @@ -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 diff --git a/build/exports/Fighting Force.dxw b/build/exports/Fighting Force.dxw new file mode 100644 index 0000000..cec77f1 --- /dev/null +++ b/build/exports/Fighting Force.dxw @@ -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 diff --git a/build/exports/Stronghold Crusader HD.dxw b/build/exports/Stronghold Crusader HD.dxw new file mode 100644 index 0000000..047ffd2 --- /dev/null +++ b/build/exports/Stronghold Crusader HD.dxw @@ -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 diff --git a/build/exports/Worms 2 (GOG).dxw b/build/exports/Worms 2 (GOG).dxw new file mode 100644 index 0000000..1c3161d --- /dev/null +++ b/build/exports/Worms 2 (GOG).dxw @@ -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 diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt index fab13f9..33697a9 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -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" diff --git a/dll/bilinear.cpp b/dll/bilinear.cpp new file mode 100644 index 0000000..6c8cdef --- /dev/null +++ b/dll/bilinear.cpp @@ -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 +#include +#include + +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> 8; + + // unsigned int *ddest = &((unsigned int *)dest)[y2*w2 + 0]; + unsigned int *ddest = &((unsigned int *)dest)[y2*p2 + 0]; + + for (int x2=0; x2> 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 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 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> 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); + } + } + } +} \ No newline at end of file diff --git a/dll/ddraw.cpp b/dll/ddraw.cpp index 020f419..155d13d 100644 --- a/dll/ddraw.cpp +++ b/dll/ddraw.cpp @@ -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; diff --git a/dll/dxemublt.cpp b/dll/dxemublt.cpp index 8173422..fd1edb6 100644 --- a/dll/dxemublt.cpp +++ b/dll/dxemublt.cpp @@ -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; diff --git a/dll/dxhelper.cpp b/dll/dxhelper.cpp index 665db9e..91c1d90 100644 --- a/dll/dxhelper.cpp +++ b/dll/dxhelper.cpp @@ -1,4 +1,6 @@ #define _CRT_SECURE_NO_DEPRECATE 1 +#define DIRECTINPUT_VERSION 0x0800 + #include #include #include diff --git a/dll/dxhook.cpp b/dll/dxhook.cpp index a2aee83..6368ea1 100644 --- a/dll/dxhook.cpp +++ b/dll/dxhook.cpp @@ -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); diff --git a/dll/dxhook.h b/dll/dxhook.h index 8987c34..4b2726e 100644 --- a/dll/dxhook.h +++ b/dll/dxhook.h @@ -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, diff --git a/dll/dxwcore.cpp b/dll/dxwcore.cpp index f196db6..2ba86cb 100644 --- a/dll/dxwcore.cpp +++ b/dll/dxwcore.cpp @@ -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); diff --git a/dll/dxwcore.hpp b/dll/dxwcore.hpp index 95bc51d..6800dff 100644 --- a/dll/dxwcore.hpp +++ b/dll/dxwcore.hpp @@ -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, diff --git a/dll/dxwnd.aps b/dll/dxwnd.aps index 0da9e5a..fbcc6dc 100644 Binary files a/dll/dxwnd.aps and b/dll/dxwnd.aps differ diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp index 8701f59..278516f 100644 --- a/dll/dxwnd.cpp +++ b/dll/dxwnd.cpp @@ -24,7 +24,7 @@ along with this program. If not, see . #include "dxwnd.h" #include "dxwcore.hpp" -#define VERSION "2.02.93.f1" +#define VERSION "2.02.94" #define DDTHREADLOCK 1 diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index 440c27a..683f2c7 100644 Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ diff --git a/dll/dxwnd.vs2008.vcproj b/dll/dxwnd.vs2008.vcproj index f68a5a8..3c911f9 100644 --- a/dll/dxwnd.vs2008.vcproj +++ b/dll/dxwnd.vs2008.vcproj @@ -220,6 +220,10 @@ RelativePath=".\advapi.cpp" > + + @@ -372,6 +376,10 @@ RelativePath=".\iatpatch.cpp" > + + diff --git a/dll/gdi32.cpp b/dll/gdi32.cpp index c389747..6af95e4 100644 --- a/dll/gdi32.cpp +++ b/dll/gdi32.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 diff --git a/dll/hd3d.cpp b/dll/hd3d.cpp index 62ac6d3..7c44e18 100644 --- a/dll/hd3d.cpp +++ b/dll/hd3d.cpp @@ -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){ diff --git a/dll/hddraw.h b/dll/hddraw.h index f2579da..1317006 100644 --- a/dll/hddraw.h +++ b/dll/hddraw.h @@ -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 *); diff --git a/dll/imagehlp.cpp b/dll/imagehlp.cpp new file mode 100644 index 0000000..af6417b --- /dev/null +++ b/dll/imagehlp.cpp @@ -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; +} diff --git a/dll/kernel32.cpp b/dll/kernel32.cpp index 06c995b..96909f3 100644 --- a/dll/kernel32.cpp +++ b/dll/kernel32.cpp @@ -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 { diff --git a/dll/syslibs.h b/dll/syslibs.h index 8522a6a..da952e5 100644 --- a/dll/syslibs.h +++ b/dll/syslibs.h @@ -654,5 +654,6 @@ extern MMRESULT WINAPI exttimeKillEvent(UINT); extern void HookKernel32Init(); extern void HookUser32Init(); extern void HookGDI32Init(); +extern void HookImagehlpInit(); /* eof */ \ No newline at end of file diff --git a/dll/user32.cpp b/dll/user32.cpp index 4038b85..e2c3982 100644 --- a/dll/user32.cpp +++ b/dll/user32.cpp @@ -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; diff --git a/host/Resource.h b/host/Resource.h index ff0c350..826c34c 100644 Binary files a/host/Resource.h and b/host/Resource.h differ diff --git a/host/TabCompat.cpp b/host/TabCompat.cpp index 465a948..485b3a1 100644 --- a/host/TabCompat.cpp +++ b/host/TabCompat.cpp @@ -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); diff --git a/host/TabDebug.cpp b/host/TabDebug.cpp index 998c4aa..5eee125 100644 --- a/host/TabDebug.cpp +++ b/host/TabDebug.cpp @@ -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); diff --git a/host/TabDirectX.cpp b/host/TabDirectX.cpp index 3f45d68..f40e48b 100644 --- a/host/TabDirectX.cpp +++ b/host/TabDirectX.cpp @@ -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) diff --git a/host/TabTiming.cpp b/host/TabTiming.cpp index 6275e2c..d5905d6 100644 --- a/host/TabTiming.cpp +++ b/host/TabTiming.cpp @@ -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); diff --git a/host/TargetDlg.cpp b/host/TargetDlg.cpp index 5b9a500..e225961 100644 --- a/host/TargetDlg.cpp +++ b/host/TargetDlg.cpp @@ -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; diff --git a/host/TargetDlg.h b/host/TargetDlg.h index 5f90eb2..117b482 100644 --- a/host/TargetDlg.h +++ b/host/TargetDlg.h @@ -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; diff --git a/host/dxwndhost.aps b/host/dxwndhost.aps index cf6055d..5cab8e8 100644 Binary files a/host/dxwndhost.aps and b/host/dxwndhost.aps differ diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc index 7772bd5..1a713bb 100644 Binary files a/host/dxwndhost.rc and b/host/dxwndhost.rc differ diff --git a/host/dxwndhost.vs2008.suo b/host/dxwndhost.vs2008.suo index db99b62..90117f8 100644 Binary files a/host/dxwndhost.vs2008.suo and b/host/dxwndhost.vs2008.suo differ diff --git a/host/dxwndhost.vs2008.vcproj b/host/dxwndhost.vs2008.vcproj index ec7733a..c5b14fd 100644 --- a/host/dxwndhost.vs2008.vcproj +++ b/host/dxwndhost.vs2008.vcproj @@ -319,6 +319,10 @@ RelativePath=".\getfname.cpp" > + + @@ -490,6 +494,10 @@ RelativePath="Resource.h" > + + diff --git a/host/dxwndhostView.cpp b/host/dxwndhostView.cpp index 41d4428..4ace506 100644 --- a/host/dxwndhostView.cpp +++ b/host/dxwndhostView.cpp @@ -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; diff --git a/host/host.aps b/host/host.aps new file mode 100644 index 0000000..130bec5 Binary files /dev/null and b/host/host.aps differ diff --git a/host/host.rc b/host/host.rc new file mode 100644 index 0000000..7aebb81 --- /dev/null +++ b/host/host.rc @@ -0,0 +1 @@ +#include "afxres.rc" diff --git a/host/resource1.h b/host/resource1.h new file mode 100644 index 0000000..bd7651e --- /dev/null +++ b/host/resource1.h @@ -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 diff --git a/locale/cn/RCa05260 b/locale/cn/RCa05260 new file mode 100644 index 0000000..7237482 Binary files /dev/null and b/locale/cn/RCa05260 differ diff --git a/locale/cn/Release/BuildLog.htm b/locale/cn/Release/BuildLog.htm new file mode 100644 index 0000000..9015c89 Binary files /dev/null and b/locale/cn/Release/BuildLog.htm differ diff --git a/locale/cn/Release/Resources_CN.dll.intermediate.manifest b/locale/cn/Release/Resources_CN.dll.intermediate.manifest new file mode 100644 index 0000000..ecea6f7 --- /dev/null +++ b/locale/cn/Release/Resources_CN.dll.intermediate.manifest @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/locale/cn/Release/Resources_CN.res b/locale/cn/Release/Resources_CN.res new file mode 100644 index 0000000..ee878cd Binary files /dev/null and b/locale/cn/Release/Resources_CN.res differ diff --git a/locale/cn/Release/mt.dep b/locale/cn/Release/mt.dep new file mode 100644 index 0000000..3626050 --- /dev/null +++ b/locale/cn/Release/mt.dep @@ -0,0 +1 @@ +Manifest resource last updated at 23:39:40.80 on 05/10/2014 diff --git a/locale/cn/Resources_CN.vcproj.User-PC.User.user b/locale/cn/Resources_CN.vcproj.User-PC.User.user new file mode 100644 index 0000000..facf31e --- /dev/null +++ b/locale/cn/Resources_CN.vcproj.User-PC.User.user @@ -0,0 +1,65 @@ + + + + + + + + + + + diff --git a/locale/cn/Resources_Cn.ncb b/locale/cn/Resources_Cn.ncb index 5c73336..a8d0402 100644 Binary files a/locale/cn/Resources_Cn.ncb and b/locale/cn/Resources_Cn.ncb differ diff --git a/locale/cn/Resources_Cn.rc b/locale/cn/Resources_Cn.rc index e490e5d..d1c1b76 100644 Binary files a/locale/cn/Resources_Cn.rc and b/locale/cn/Resources_Cn.rc differ diff --git a/locale/cn/Resources_Cn.suo b/locale/cn/Resources_Cn.suo index d8d7a03..d434b50 100644 Binary files a/locale/cn/Resources_Cn.suo and b/locale/cn/Resources_Cn.suo differ diff --git a/locale/cn/Resources_EN.rc b/locale/cn/Resources_EN.rc new file mode 100644 index 0000000..c10d79b Binary files /dev/null and b/locale/cn/Resources_EN.rc differ diff --git a/locale/en/Resources_EN.rc b/locale/en/Resources_EN.rc index 14b3772..1a713bb 100644 Binary files a/locale/en/Resources_EN.rc and b/locale/en/Resources_EN.rc differ diff --git a/locale/en/Resources_En.ncb b/locale/en/Resources_En.ncb index 450c365..08ac0fb 100644 Binary files a/locale/en/Resources_En.ncb and b/locale/en/Resources_En.ncb differ diff --git a/locale/en/Resources_En.suo b/locale/en/Resources_En.suo index ce478a3..4b60a88 100644 Binary files a/locale/en/Resources_En.suo and b/locale/en/Resources_En.suo differ diff --git a/locale/it/Resources_IT.rc b/locale/it/Resources_IT.rc index 8be771a..11d2c99 100644 Binary files a/locale/it/Resources_IT.rc and b/locale/it/Resources_IT.rc differ diff --git a/locale/it/Resources_It.ncb b/locale/it/Resources_It.ncb index 12bfe4d..72f85de 100644 Binary files a/locale/it/Resources_It.ncb and b/locale/it/Resources_It.ncb differ diff --git a/locale/it/Resources_It.suo b/locale/it/Resources_It.suo index 5b0d3bf..e7d7b34 100644 Binary files a/locale/it/Resources_It.suo and b/locale/it/Resources_It.suo differ