mirror of
https://github.com/DxWnd/DxWnd.reloaded
synced 2024-12-30 09:25:35 +01:00
v2_04_00_src
Former-commit-id: 97c27fb1c865e6a42bebde9cfd6d7935937bea24
This commit is contained in:
parent
a5f4e868f5
commit
a077bb011a
@ -258,6 +258,9 @@
|
||||
#define NOHALDEVICE 0x00000040 // Simulates a situation of lack of 3D hardware support, like in presence of remote desktop
|
||||
#define CLIPLOCKED 0x00000080 // never destroy cursor clipper on window move events ....
|
||||
#define PRETENDVISIBLE 0x00000100 // Pretend the main window is visible (IsWindowVisible) and on Z-order top (GetTopWindow)
|
||||
#define RAWFORMAT 0x00000200 // texture dump / hack are performed in raw format, compression / decompression to be made offline
|
||||
#define WININSULATION 0x00000400 // EnumerateWin finds no windows!
|
||||
#define FIXMOUSEHOOK 0x00000800 // fixes mouse coordinates retrieved through MouseProc routine associated to SetWindowsHook(WH_MOUSE,..)
|
||||
|
||||
// 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:cf023536d20b33dd428096f18a29788e47eba0691547598d6de7ef7cc877956f
|
||||
size 710144
|
||||
oid sha256:b3e4a919d94a65a136733126cb2ab2ea7ec6ea20d20d06acc7fc826fb8dd7bce
|
||||
size 756736
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3840ce99c26e25e77df3d855fbd91c5533f0fcff4e4a876dc88b62a465d66b62
|
||||
oid sha256:f4781f62e3b9bbc3cb28f6ab03585167d87e0352520ba25ee7ad0102ad02a244
|
||||
size 668160
|
||||
|
@ -1,43 +0,0 @@
|
||||
[window]
|
||||
exportpath=D:\DxWnd.develop\v2_03_99fx2_src\build\exports\
|
||||
exepath=F:\Games\The Sting!\TheSting!\
|
||||
posx=1154
|
||||
posy=553
|
||||
sizx=320
|
||||
sizy=200
|
||||
[target]
|
||||
title0=The Sting!
|
||||
path0=F:\Games\The Sting!\TheSting!\Sting.exe
|
||||
startfolder0=
|
||||
launchpath0=
|
||||
module0=
|
||||
opengllib0=
|
||||
notes0=
|
||||
registry0=
|
||||
ver0=0
|
||||
monitorid0=0
|
||||
coord0=0
|
||||
flag0=136314914
|
||||
flagg0=1207959552
|
||||
flagh0=16
|
||||
flagi0=138412036
|
||||
flagj0=4224
|
||||
flagk0=65536
|
||||
flagl0=0
|
||||
flagm0=0
|
||||
tflag0=0
|
||||
dflag0=0
|
||||
posx0=50
|
||||
posy0=50
|
||||
sizx0=800
|
||||
sizy0=600
|
||||
maxfps0=0
|
||||
initts0=0
|
||||
winver0=0
|
||||
maxres0=-1
|
||||
swapeffect0=0
|
||||
maxddinterface0=7
|
||||
slowratio0=1
|
||||
scanline0=1
|
||||
initresw0=0
|
||||
initresh0=0
|
36
build/exports/Jagged Alliance 2 Gold.dxw
Normal file
36
build/exports/Jagged Alliance 2 Gold.dxw
Normal file
@ -0,0 +1,36 @@
|
||||
[target]
|
||||
title0=Jagged Alliance 2 Gold
|
||||
path0=F:\Games\Jagged Alliance 2 Gold\ja2.exe
|
||||
startfolder0=
|
||||
launchpath0=
|
||||
module0=
|
||||
opengllib0=
|
||||
notes0=
|
||||
registry0=
|
||||
ver0=0
|
||||
monitorid0=-1
|
||||
coord0=0
|
||||
flag0=-1474297694
|
||||
flagg0=1744832768
|
||||
flagh0=8212
|
||||
flagi0=138412036
|
||||
flagj0=5248
|
||||
flagk0=2162696
|
||||
flagl0=16
|
||||
flagm0=2305
|
||||
tflag0=0
|
||||
dflag0=0
|
||||
posx0=50
|
||||
posy0=50
|
||||
sizx0=800
|
||||
sizy0=600
|
||||
maxfps0=0
|
||||
initts0=0
|
||||
winver0=0
|
||||
maxres0=-1
|
||||
swapeffect0=0
|
||||
maxddinterface0=7
|
||||
slowratio0=2
|
||||
scanline0=0
|
||||
initresw0=800
|
||||
initresh0=600
|
@ -10,7 +10,7 @@ registry0=
|
||||
ver0=0
|
||||
monitorid0=-1
|
||||
coord0=0
|
||||
flag0=136314914
|
||||
flag0=136314922
|
||||
flagg0=1207959552
|
||||
flagh0=20
|
||||
flagi0=138412036
|
||||
@ -33,3 +33,4 @@ maxddinterface0=7
|
||||
slowratio0=2
|
||||
initresw0=800
|
||||
initresh0=600
|
||||
scanline0=1
|
||||
|
@ -5,7 +5,7 @@ module0=
|
||||
opengllib0=
|
||||
ver0=1
|
||||
coord0=0
|
||||
flag0=402653219
|
||||
flag0=402653235
|
||||
flagg0=1208025104
|
||||
flagh0=20
|
||||
flagi0=4194304
|
||||
@ -26,7 +26,17 @@ launchpath0=
|
||||
notes0=
|
||||
registry0=
|
||||
flagj0=128
|
||||
flagk0=65536
|
||||
flagk0=268500992
|
||||
winver0=0
|
||||
maxres0=0
|
||||
swapeffect0=0
|
||||
startfolder0=
|
||||
monitorid0=0
|
||||
flagl0=0
|
||||
flagm0=0
|
||||
dflag0=0
|
||||
maxddinterface0=7
|
||||
slowratio0=1
|
||||
scanline0=1
|
||||
initresw0=0
|
||||
initresh0=0
|
||||
|
36
build/exports/Titanic.dxw
Normal file
36
build/exports/Titanic.dxw
Normal file
@ -0,0 +1,36 @@
|
||||
[target]
|
||||
title0=Titanic
|
||||
path0=F:\Games\Titanic\TI.noshim.EXE
|
||||
startfolder0=
|
||||
launchpath0=
|
||||
module0=
|
||||
opengllib0=
|
||||
notes0=
|
||||
registry0=
|
||||
ver0=0
|
||||
monitorid0=-1
|
||||
coord0=0
|
||||
flag0=-1474293726
|
||||
flagg0=1745879072
|
||||
flagh0=540692
|
||||
flagi0=138412036
|
||||
flagj0=4224
|
||||
flagk0=67584
|
||||
flagl0=269484032
|
||||
flagm0=1024
|
||||
tflag0=0
|
||||
dflag0=0
|
||||
posx0=50
|
||||
posy0=50
|
||||
sizx0=800
|
||||
sizy0=600
|
||||
maxfps0=0
|
||||
initts0=0
|
||||
winver0=0
|
||||
maxres0=-1
|
||||
swapeffect0=0
|
||||
maxddinterface0=7
|
||||
slowratio0=2
|
||||
scanline0=0
|
||||
initresw0=800
|
||||
initresh0=600
|
@ -1372,15 +1372,22 @@ fix: recovered DEFAULTMESSAGES option
|
||||
fix: normalized output for ddraw GetScanLine() method
|
||||
fix: fixed the policy for redrecting the WindowProc routine. Fixes "Ultimate Spiderman" clipping problems, and possibly much more
|
||||
|
||||
v2.03.99/fx1-3
|
||||
v2.03.99
|
||||
fix: unwanted hook to directsound when passing by CoCreateInstance()
|
||||
fix: transient mode, now checks for both the target and the launcher to be dead before terminating
|
||||
add: Direct3D TRIMTEXTUREFORMAT flag, to mimic MS "DirectXTrimTextureFormat" shim. Fixes problems in "Heavy Gear 2" and "Star Wars: Rogue Squardon 3D".
|
||||
add: D3DDevice GetCaps hooking and full dump of D3DDevice capabilities
|
||||
add: "No HAL Device" flag, making it unavailable the IID_Direct3DHALDevice device. Fixes "Grand Prix World" when the 3D car models are invisible.
|
||||
add: reorganization of mouse clipper fields, with the addition of LOCK mode (useful for Tribal Rage)
|
||||
fix: handling of Lock/Unlock methods differentiated in ddraw 4 vs. 7. Fixes "Hoyle Casino Empire"
|
||||
fix: texture hack now search for hacked textures in the texture.in folder, as stated in the documentation
|
||||
fix: D3D7 EnumDevices hexdump fixed
|
||||
add: flag "Pretend Win visible on top" (PRETENDVISIBLE) to let the program believe that the main window is always visible and on z-order top as a fullscreen window should be
|
||||
fix: fixed some divide by 0 conditions when window is minimized
|
||||
|
||||
v2.04.00
|
||||
add: texture management for D3D textures: XCTn compressed textures, raw mode, texture highlight and hack
|
||||
add: Input / "fix MOUSEHOOK callback" option, fixes "Jagged Alliance 2" mouse problems
|
||||
add: GDI / "Pretend Win visible & on top" option: experimental, let the program believe that the main window is visible and on top of z-order as usually happens to full screen applications
|
||||
add: GDI / "Win insulation" flag: avoid enumerating windows so that the program can't interfere with them. Fixes "Tribal Rage" damages to desktop.
|
||||
add: hook to ddraw DuplicateSurface() method, so far for logging only.
|
||||
fix: eliminated possible divide by 0 exception when minimizing windows
|
||||
fix: mouse clipping now selected by radio buttons (default, off, on, locked)
|
||||
fix: bug in D3D device enumeration log
|
||||
fix: bug in Hybrid and GDI ddraw surface rendering
|
||||
fix: missing "No HAL Device" flag default to disabled
|
||||
|
@ -8,7 +8,23 @@
|
||||
#include "syslibs.h"
|
||||
#include "stdio.h"
|
||||
|
||||
#define STB_DXT_IMPLEMENTATION
|
||||
#include "stb_dxt.h"
|
||||
|
||||
extern unsigned int HashSurface(BYTE *, int, int, int);
|
||||
extern char *GetDxWndPath();
|
||||
|
||||
static unsigned int HashBuffer(BYTE *buf, int len)
|
||||
{
|
||||
unsigned int b = 378551;
|
||||
unsigned int a = 63689;
|
||||
DWORD hash = 0;
|
||||
for(int i = 0; i < len; i++){
|
||||
hash = (hash * a) + (*buf++);
|
||||
a = a * b;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
static WORD Melt_123(WORD c1, WORD c2)
|
||||
{
|
||||
@ -124,34 +140,191 @@ char *ExplainD3DSurfaceFormat(DWORD dwFormat)
|
||||
return s;
|
||||
}
|
||||
|
||||
#define GRIDSIZE 16
|
||||
|
||||
void D3DTextureHighlight(D3DSURFACE_DESC Desc, D3DLOCKED_RECT LockedRect)
|
||||
static int FormatColorDepth(D3DFORMAT Format)
|
||||
{
|
||||
switch (Desc.Format){
|
||||
int iColorDepth = 0;
|
||||
switch (Format){
|
||||
case D3DFMT_X8R8G8B8:
|
||||
case D3DFMT_A8R8G8B8:
|
||||
{
|
||||
DWORD *p;
|
||||
DWORD color;
|
||||
color=(DWORD)(rand() & 0x00FFFFFF);
|
||||
for(UINT y=0; y<Desc.Height; y++){
|
||||
p = (DWORD *)LockedRect.pBits + ((y * LockedRect.Pitch) >> 2);
|
||||
for(UINT x=0; x<Desc.Width; x++) *(p+x) = color;
|
||||
}
|
||||
for(UINT y=0; y<Desc.Height; y++){
|
||||
p = (DWORD *)LockedRect.pBits + ((y * LockedRect.Pitch) >> 2);
|
||||
for(UINT x=0; x<Desc.Width; x+=GRIDSIZE) *(p+x) = 0;
|
||||
if((y%GRIDSIZE)==0) for(UINT x=0; x<Desc.Width; x++) *(p++) = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case D3DFMT_A8R8G8B8:
|
||||
case D3DFMT_DXT2:
|
||||
case D3DFMT_DXT3:
|
||||
//if(Desc.Height) for(UINT y=0; y<(Desc.Height>>2); y+=2)
|
||||
// memset((BYTE *)LockedRect.pBits + (y * LockedRect.Pitch), 0x00, LockedRect.Pitch);
|
||||
default:
|
||||
case D3DFMT_DXT4:
|
||||
case D3DFMT_DXT5:
|
||||
case D3DFMT_A8:
|
||||
case D3DFMT_L8:
|
||||
iColorDepth = 32;
|
||||
break;
|
||||
case D3DFMT_DXT1:
|
||||
case D3DFMT_A4R4G4B4: // AoE III
|
||||
case D3DFMT_X4R4G4B4:
|
||||
case D3DFMT_A1R5G5B5: // AoE III
|
||||
case D3DFMT_X1R5G5B5:
|
||||
case D3DFMT_R5G6B5:
|
||||
iColorDepth = 16;
|
||||
break;
|
||||
}
|
||||
return iColorDepth;
|
||||
}
|
||||
|
||||
// FormatColorBytes macro gives color depth in bytes by dividing by 8 (=> lshift 3)
|
||||
#define FormatColorBytes(Format) (FormatColorDepth(Format) >> 3)
|
||||
|
||||
static DWORD TextureSize(D3DSURFACE_DESC Desc, D3DLOCKED_RECT LockedRect)
|
||||
{
|
||||
DWORD dwSize;
|
||||
|
||||
// calculate the texture size
|
||||
switch (Desc.Format){
|
||||
case D3DFMT_A4R4G4B4:
|
||||
case D3DFMT_X4R4G4B4:
|
||||
case D3DFMT_X1R5G5B5:
|
||||
case D3DFMT_A1R5G5B5:
|
||||
case D3DFMT_R5G6B5:
|
||||
case D3DFMT_X8R8G8B8:
|
||||
case D3DFMT_A8R8G8B8:
|
||||
//case D3DFMT_A8:
|
||||
//case D3DFMT_L8:
|
||||
dwSize = Desc.Width * Desc.Height * FormatColorBytes(Desc.Format);
|
||||
break;
|
||||
case D3DFMT_DXT1:
|
||||
case D3DFMT_DXT2:
|
||||
case D3DFMT_DXT3:
|
||||
case D3DFMT_DXT4:
|
||||
case D3DFMT_DXT5:
|
||||
dwSize = (Desc.Width * Desc.Height * FormatColorBytes(Desc.Format)) / 4;
|
||||
break;
|
||||
default:
|
||||
dwSize = 0; // 0 = unknown or not interesting
|
||||
break;
|
||||
}
|
||||
return dwSize;
|
||||
}
|
||||
|
||||
static DWORD D3DHash(D3DSURFACE_DESC Desc, D3DLOCKED_RECT LockedRect)
|
||||
{
|
||||
DWORD hash;
|
||||
static BOOL DoOnce = TRUE;
|
||||
|
||||
// calculate the bitmap hash
|
||||
hash = 0;
|
||||
switch (Desc.Format){
|
||||
// hash for uncompressed bmp-like formats with possible empty area at end of pitch size
|
||||
case D3DFMT_A4R4G4B4:
|
||||
case D3DFMT_X4R4G4B4:
|
||||
case D3DFMT_X8R8G8B8:
|
||||
case D3DFMT_A8R8G8B8:
|
||||
case D3DFMT_R5G6B5:
|
||||
case D3DFMT_X1R5G5B5:
|
||||
case D3DFMT_A1R5G5B5:
|
||||
case D3DFMT_A8:
|
||||
case D3DFMT_L8:
|
||||
hash = HashSurface((BYTE *)LockedRect.pBits, LockedRect.Pitch, Desc.Width, Desc.Height);
|
||||
break;
|
||||
// hash for fixed ratio compressed formats
|
||||
case D3DFMT_DXT1:
|
||||
case D3DFMT_DXT2:
|
||||
case D3DFMT_DXT3:
|
||||
case D3DFMT_DXT4:
|
||||
case D3DFMT_DXT5:
|
||||
hash = HashBuffer((BYTE *)LockedRect.pBits, TextureSize(Desc, LockedRect));
|
||||
break;
|
||||
case D3DFMT_V8U8:
|
||||
case D3DFMT_Q8W8V8U8: // Tiger Woods PGA Tour 08
|
||||
case D3DFMT_V16U16:
|
||||
case D3DFMT_Q16W16V16U16:
|
||||
case D3DFMT_CxV8U8:
|
||||
case D3DFMT_L6V5U5:
|
||||
case D3DFMT_X8L8V8U8:
|
||||
case D3DFMT_A2W10V10U10:
|
||||
// Bumpmap surfaces, dump is meaningless .....
|
||||
break;
|
||||
default:
|
||||
char sMsg[80+1];
|
||||
if(DoOnce){
|
||||
sprintf_s(sMsg, 80, "Unhandled texture type=%d(%s)", Desc.Format, ExplainD3DSurfaceFormat(Desc.Format));
|
||||
MessageBox(0, sMsg, "WARN", MB_OK | MB_ICONEXCLAMATION);
|
||||
DoOnce = FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
BOOL SetBMPStruct(LPBITMAPV4HEADER lpBV4Hdr, LPBITMAPFILEHEADER lpBFHdr, D3DSURFACE_DESC Desc)
|
||||
{
|
||||
// set bmp invariant parameters
|
||||
memset((void *)lpBV4Hdr, 0, sizeof(BITMAPV4HEADER));
|
||||
lpBV4Hdr->bV4Size = sizeof(BITMAPV4HEADER);
|
||||
lpBV4Hdr->bV4Width = Desc.Width;
|
||||
lpBV4Hdr->bV4Height = Desc.Height;
|
||||
lpBV4Hdr->bV4Planes = 1;
|
||||
lpBV4Hdr->bV4V4Compression = BI_BITFIELDS;
|
||||
lpBV4Hdr->bV4XPelsPerMeter = 1;
|
||||
lpBV4Hdr->bV4YPelsPerMeter = 1;
|
||||
lpBV4Hdr->bV4ClrUsed = 0;
|
||||
lpBV4Hdr->bV4ClrImportant = 0;
|
||||
lpBV4Hdr->bV4CSType = LCS_CALIBRATED_RGB;
|
||||
lpBFHdr->bfType = 0x4d42; // 0x42 = "B" 0x4d = "M"
|
||||
lpBFHdr->bfReserved1 = 0;
|
||||
lpBFHdr->bfReserved2 = 0;
|
||||
|
||||
switch (Desc.Format){
|
||||
case D3DFMT_X8R8G8B8:
|
||||
case D3DFMT_A8R8G8B8:
|
||||
case D3DFMT_DXT2:
|
||||
case D3DFMT_DXT3:
|
||||
case D3DFMT_DXT4:
|
||||
case D3DFMT_DXT5:
|
||||
case D3DFMT_A8:
|
||||
case D3DFMT_L8:
|
||||
lpBV4Hdr->bV4BitCount = 32;
|
||||
lpBV4Hdr->bV4RedMask = 0x00FF0000;
|
||||
lpBV4Hdr->bV4GreenMask = 0x0000FF00;
|
||||
lpBV4Hdr->bV4BlueMask = 0x000000FF;
|
||||
lpBV4Hdr->bV4AlphaMask = 0xFF000000;
|
||||
break;
|
||||
case D3DFMT_DXT1:
|
||||
lpBV4Hdr->bV4BitCount = 16;
|
||||
lpBV4Hdr->bV4RedMask = 0xF800;
|
||||
lpBV4Hdr->bV4GreenMask = 0x07E0;
|
||||
lpBV4Hdr->bV4BlueMask = 0x001F;
|
||||
lpBV4Hdr->bV4AlphaMask = 0x0000;
|
||||
break;
|
||||
case D3DFMT_A4R4G4B4: // AoE III
|
||||
case D3DFMT_X4R4G4B4:
|
||||
lpBV4Hdr->bV4BitCount = 16;
|
||||
lpBV4Hdr->bV4RedMask = 0x0F00;
|
||||
lpBV4Hdr->bV4GreenMask = 0x00F0;
|
||||
lpBV4Hdr->bV4BlueMask = 0x000F;
|
||||
lpBV4Hdr->bV4AlphaMask = 0xF000;
|
||||
break;
|
||||
case D3DFMT_A1R5G5B5: // AoE III
|
||||
case D3DFMT_X1R5G5B5:
|
||||
lpBV4Hdr->bV4BitCount = 16;
|
||||
lpBV4Hdr->bV4RedMask = 0x7C00;
|
||||
lpBV4Hdr->bV4GreenMask = 0x03E0;
|
||||
lpBV4Hdr->bV4BlueMask = 0x001F;
|
||||
lpBV4Hdr->bV4AlphaMask = 0x8000;
|
||||
break;
|
||||
case D3DFMT_R5G6B5:
|
||||
lpBV4Hdr->bV4BitCount = 16;
|
||||
lpBV4Hdr->bV4RedMask = 0x7C00;
|
||||
lpBV4Hdr->bV4GreenMask = 0x03E0;
|
||||
lpBV4Hdr->bV4BlueMask = 0x001F;
|
||||
lpBV4Hdr->bV4AlphaMask = 0x0000;
|
||||
break;
|
||||
}
|
||||
|
||||
lpBV4Hdr->bV4SizeImage = ((lpBV4Hdr->bV4Width * lpBV4Hdr->bV4BitCount + 0x1F) & ~0x1F)/8 * lpBV4Hdr->bV4Height;
|
||||
lpBV4Hdr->bV4Height = - lpBV4Hdr->bV4Height;
|
||||
|
||||
// Compute the size of the entire file.
|
||||
lpBFHdr->bfSize = (DWORD) (sizeof(BITMAPFILEHEADER) + lpBV4Hdr->bV4Size + lpBV4Hdr->bV4ClrUsed * sizeof(RGBQUAD) + lpBV4Hdr->bV4SizeImage);
|
||||
|
||||
// Compute the offset to the array of color indices.
|
||||
lpBFHdr->bfOffBits = (DWORD) sizeof(BITMAPFILEHEADER) + lpBV4Hdr->bV4Size + lpBV4Hdr->bV4ClrUsed * sizeof (RGBQUAD);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void D3DTextureDump(D3DSURFACE_DESC Desc, D3DLOCKED_RECT LockedRect)
|
||||
@ -165,10 +338,10 @@ void D3DTextureDump(D3DSURFACE_DESC Desc, D3DLOCKED_RECT LockedRect)
|
||||
int iSurfaceSize, iScanLineSize;
|
||||
char pszFile[MAX_PATH];
|
||||
DWORD hash;
|
||||
BOOL IsRaw = (dxw.dwFlags8 & RAWFORMAT);
|
||||
|
||||
if(DoOnce){
|
||||
char sProfilePath[MAX_PATH];
|
||||
extern char *GetDxWndPath();
|
||||
sprintf(sProfilePath, "%s\\dxwnd.ini", GetDxWndPath());
|
||||
MinTexX=GetPrivateProfileInt("Texture", "MinTexX", 0, sProfilePath);
|
||||
MaxTexX=GetPrivateProfileInt("Texture", "MaxTexX", 0, sProfilePath);
|
||||
@ -193,136 +366,35 @@ void D3DTextureDump(D3DSURFACE_DESC Desc, D3DLOCKED_RECT LockedRect)
|
||||
}
|
||||
iSurfaceSize = Desc.Height * LockedRect.Pitch;
|
||||
|
||||
// calculate the bitmap hash
|
||||
hash = 0;
|
||||
switch (Desc.Format){
|
||||
case D3DFMT_A4R4G4B4:
|
||||
case D3DFMT_X4R4G4B4:
|
||||
case D3DFMT_X8R8G8B8:
|
||||
case D3DFMT_A8R8G8B8:
|
||||
case D3DFMT_R5G6B5:
|
||||
case D3DFMT_X1R5G5B5:
|
||||
case D3DFMT_A1R5G5B5:
|
||||
case D3DFMT_A8:
|
||||
case D3DFMT_L8:
|
||||
hash = HashSurface((BYTE *)LockedRect.pBits, LockedRect.Pitch, Desc.Width, Desc.Height);
|
||||
break;
|
||||
case D3DFMT_DXT1:
|
||||
hash = HashSurface((BYTE *)LockedRect.pBits, LockedRect.Pitch / 6, Desc.Width / 6, Desc.Height);
|
||||
break;
|
||||
case D3DFMT_DXT2:
|
||||
case D3DFMT_DXT3:
|
||||
hash = HashSurface((BYTE *)LockedRect.pBits, LockedRect.Pitch / 4, Desc.Width / 4, Desc.Height);
|
||||
break;
|
||||
case D3DFMT_DXT4:
|
||||
case D3DFMT_DXT5:
|
||||
hash = HashSurface((BYTE *)LockedRect.pBits, LockedRect.Pitch / 4, Desc.Width / 4, Desc.Height);
|
||||
break;
|
||||
case D3DFMT_V8U8:
|
||||
case D3DFMT_Q8W8V8U8: // Tiger Woods PGA Tour 08
|
||||
case D3DFMT_V16U16:
|
||||
case D3DFMT_Q16W16V16U16:
|
||||
case D3DFMT_CxV8U8:
|
||||
case D3DFMT_L6V5U5:
|
||||
case D3DFMT_X8L8V8U8:
|
||||
case D3DFMT_A2W10V10U10:
|
||||
// Bumpmap surfaces, dump is meaningless .....
|
||||
break;
|
||||
default:
|
||||
char sMsg[80+1];
|
||||
static BOOL DoOnce = TRUE;
|
||||
if(DoOnce){
|
||||
sprintf_s(sMsg, 80, "Unhandled texture type=%d(%s)", Desc.Format, ExplainD3DSurfaceFormat(Desc.Format));
|
||||
MessageBox(0, sMsg, "WARN", MB_OK | MB_ICONEXCLAMATION);
|
||||
DoOnce = FALSE;
|
||||
}
|
||||
break;
|
||||
// skip unsupported raw compressions
|
||||
if(!TextureSize(Desc, LockedRect)){
|
||||
OutTrace("TextureDump: UNSUPPORTED\n");
|
||||
break;
|
||||
}
|
||||
|
||||
// calculate the bitmap hash
|
||||
hash = D3DHash(Desc, LockedRect);
|
||||
if(!hash) {
|
||||
OutTrace("TextureDump: hash=NULL\n");
|
||||
break; // almost certainly, an empty black surface!
|
||||
}
|
||||
|
||||
// Create the .BMP file.
|
||||
extern char *GetDxWndPath();
|
||||
sprintf_s(pszFile, MAX_PATH, "%s\\texture.out\\texture.%03d.%03d.%s.%08X.bmp",
|
||||
GetDxWndPath(), Desc.Width, Desc.Height, ExplainD3DSurfaceFormat(Desc.Format), hash);
|
||||
sprintf_s(pszFile, MAX_PATH, "%s\\texture.out\\texture.%03d.%03d.%s.%08X.%s",
|
||||
GetDxWndPath(), Desc.Width, Desc.Height, ExplainD3DSurfaceFormat(Desc.Format),
|
||||
hash, IsRaw ? "raw" : "bmp");
|
||||
hf = fopen(pszFile, "wb");
|
||||
if(!hf) break;
|
||||
|
||||
// set bmp invariant parameters
|
||||
memset((void *)&pbi, 0, sizeof(BITMAPV4HEADER));
|
||||
pbi.bV4Size = sizeof(BITMAPV4HEADER);
|
||||
pbi.bV4Width = Desc.Width;
|
||||
pbi.bV4Height = Desc.Height;
|
||||
pbi.bV4Planes = 1;
|
||||
pbi.bV4V4Compression = BI_BITFIELDS;
|
||||
pbi.bV4XPelsPerMeter = 1;
|
||||
pbi.bV4YPelsPerMeter = 1;
|
||||
pbi.bV4ClrUsed = 0;
|
||||
pbi.bV4ClrImportant = 0;
|
||||
pbi.bV4CSType = LCS_CALIBRATED_RGB;
|
||||
hdr.bfType = 0x4d42; // 0x42 = "B" 0x4d = "M"
|
||||
hdr.bfReserved1 = 0;
|
||||
hdr.bfReserved2 = 0;
|
||||
|
||||
switch (Desc.Format){
|
||||
case D3DFMT_X8R8G8B8:
|
||||
case D3DFMT_A8R8G8B8:
|
||||
case D3DFMT_DXT2:
|
||||
case D3DFMT_DXT3:
|
||||
case D3DFMT_DXT4:
|
||||
case D3DFMT_DXT5:
|
||||
case D3DFMT_A8:
|
||||
case D3DFMT_L8:
|
||||
pbi.bV4BitCount = 32;
|
||||
pbi.bV4RedMask = 0x00FF0000;
|
||||
pbi.bV4GreenMask = 0x0000FF00;
|
||||
pbi.bV4BlueMask = 0x000000FF;
|
||||
pbi.bV4AlphaMask = 0xFF000000;
|
||||
break;
|
||||
case D3DFMT_DXT1:
|
||||
pbi.bV4BitCount = 16;
|
||||
pbi.bV4RedMask = 0xF800;
|
||||
pbi.bV4GreenMask = 0x07E0;
|
||||
pbi.bV4BlueMask = 0x001F;
|
||||
pbi.bV4AlphaMask = 0x0000;
|
||||
break;
|
||||
case D3DFMT_A4R4G4B4: // AoE III
|
||||
case D3DFMT_X4R4G4B4:
|
||||
pbi.bV4BitCount = 16;
|
||||
pbi.bV4RedMask = 0x0F00;
|
||||
pbi.bV4GreenMask = 0x00F0;
|
||||
pbi.bV4BlueMask = 0x000F;
|
||||
pbi.bV4AlphaMask = 0xF000;
|
||||
break;
|
||||
case D3DFMT_A1R5G5B5: // AoE III
|
||||
case D3DFMT_X1R5G5B5:
|
||||
pbi.bV4BitCount = 16;
|
||||
pbi.bV4RedMask = 0x7C00;
|
||||
pbi.bV4GreenMask = 0x03E0;
|
||||
pbi.bV4BlueMask = 0x001F;
|
||||
pbi.bV4AlphaMask = 0x8000;
|
||||
break;
|
||||
case D3DFMT_R5G6B5:
|
||||
pbi.bV4BitCount = 16;
|
||||
pbi.bV4RedMask = 0x7C00;
|
||||
pbi.bV4GreenMask = 0x03E0;
|
||||
pbi.bV4BlueMask = 0x001F;
|
||||
pbi.bV4AlphaMask = 0x0000;
|
||||
break;
|
||||
if(IsRaw){
|
||||
fwrite((BYTE *)LockedRect.pBits, TextureSize(Desc, LockedRect), 1, hf);
|
||||
fclose(hf);
|
||||
return;
|
||||
}
|
||||
|
||||
pbi.bV4SizeImage = ((pbi.bV4Width * pbi.bV4BitCount + 0x1F) & ~0x1F)/8 * pbi.bV4Height;
|
||||
// set bmp invariant parameters
|
||||
if (SetBMPStruct(&pbi, &hdr, Desc)) break;
|
||||
iScanLineSize = ((pbi.bV4Width * pbi.bV4BitCount + 0x1F) & ~0x1F)/8;
|
||||
pbi.bV4Height = - pbi.bV4Height;
|
||||
|
||||
// Compute the size of the entire file.
|
||||
hdr.bfSize = (DWORD) (sizeof(BITMAPFILEHEADER) + pbi.bV4Size + pbi.bV4ClrUsed * sizeof(RGBQUAD) + pbi.bV4SizeImage);
|
||||
|
||||
// Compute the offset to the array of color indices.
|
||||
hdr.bfOffBits = (DWORD) sizeof(BITMAPFILEHEADER) + pbi.bV4Size + pbi.bV4ClrUsed * sizeof (RGBQUAD);
|
||||
|
||||
// Copy the BITMAPFILEHEADER into the .BMP file.
|
||||
fwrite((LPVOID)&hdr, sizeof(BITMAPFILEHEADER), 1, hf);
|
||||
@ -531,6 +603,260 @@ void D3DTextureDump(D3DSURFACE_DESC Desc, D3DLOCKED_RECT LockedRect)
|
||||
|
||||
void D3DTextureHack(D3DSURFACE_DESC Desc, D3DLOCKED_RECT LockedRect)
|
||||
{
|
||||
static BOOL DoOnce = TRUE;
|
||||
static int MinTexX, MinTexY, MaxTexX, MaxTexY;
|
||||
FILE *hf;
|
||||
BITMAPFILEHEADER hdr; // bitmap file-header
|
||||
BITMAPV4HEADER pbi; // bitmap info-header
|
||||
int iSurfaceSize, iScanLineSize;
|
||||
char pszFile[MAX_PATH];
|
||||
DWORD hash;
|
||||
int w, h;
|
||||
BOOL IsRaw = (dxw.dwFlags8 & RAWFORMAT);
|
||||
|
||||
OutTraceB("TextureHack(D3D)\n");
|
||||
|
||||
if(DoOnce){
|
||||
char sProfilePath[MAX_PATH];
|
||||
sprintf(sProfilePath, "%s\\dxwnd.ini", GetDxWndPath());
|
||||
MinTexX=GetPrivateProfileInt("Texture", "MinTexX", 0, sProfilePath);
|
||||
MaxTexX=GetPrivateProfileInt("Texture", "MaxTexX", 0, sProfilePath);
|
||||
MinTexY=GetPrivateProfileInt("Texture", "MinTexY", 0, sProfilePath);
|
||||
MaxTexY=GetPrivateProfileInt("Texture", "MaxTexY", 0, sProfilePath);
|
||||
OutTrace("TextureHack: size min=(%dx%d) max=(%dx%d)\n", MinTexX, MinTexY, MaxTexX, MaxTexY);
|
||||
sprintf_s(pszFile, MAX_PATH, "%s\\texture.in", GetDxWndPath());
|
||||
DoOnce = FALSE;
|
||||
}
|
||||
|
||||
while(TRUE){ // fake loop
|
||||
w = Desc.Width;
|
||||
h = Desc.Height;
|
||||
if((MinTexX && (w<MinTexX)) || (MinTexY && (h<MinTexY))) {
|
||||
OutTrace("TextureHack: SKIP small texture\n");
|
||||
break;
|
||||
}
|
||||
if((MaxTexX && (w>MaxTexX)) || (MaxTexY && (h>MaxTexY))) {
|
||||
OutTrace("TextureHack: SKIP big texture\n");
|
||||
break;
|
||||
}
|
||||
iSurfaceSize = Desc.Height * LockedRect.Pitch;
|
||||
|
||||
// calculate the bitmap hash
|
||||
hash = D3DHash(Desc, LockedRect);
|
||||
if(!hash) {
|
||||
OutTrace("TextureHack: hash=NULL\n");
|
||||
break; // almost certainly, an empty black surface!
|
||||
}
|
||||
|
||||
// Look for the .BMP file.
|
||||
sprintf_s(pszFile, MAX_PATH, "%s\\texture.in\\texture.%03d.%03d.%s.%08X.%s",
|
||||
GetDxWndPath(), Desc.Width, Desc.Height, ExplainD3DSurfaceFormat(Desc.Format),
|
||||
hash, IsRaw ? "raw" : "bmp");
|
||||
hf = fopen(pszFile, "rb");
|
||||
if(!hf) break; // no updated texture to load
|
||||
|
||||
OutTrace("TextureHack: IMPORT path=%s\n", pszFile);
|
||||
|
||||
if(IsRaw){
|
||||
fread((BYTE *)LockedRect.pBits, TextureSize(Desc, LockedRect), 1, hf);
|
||||
fclose(hf);
|
||||
return;
|
||||
}
|
||||
|
||||
int iBitCount = FormatColorDepth(Desc.Format);
|
||||
if(iBitCount == 0){
|
||||
OutTrace("TextureHack: unsupported format=%x\n", Desc.Format);
|
||||
break;
|
||||
}
|
||||
iScanLineSize = ((Desc.Width * iBitCount + 0x1F) & ~0x1F)/8;
|
||||
|
||||
while(TRUE) { // fake loop to ensure final fclose
|
||||
// Read the BITMAPFILEHEADER from the .BMP file (and throw away ...).
|
||||
if(fread((LPVOID)&hdr, sizeof(BITMAPFILEHEADER), 1, hf) != 1)break;
|
||||
|
||||
// Read the BITMAPINFOHEADER (and throw away ...).
|
||||
// If the file contains BITMAPV4HEADER or BITMAPV5HEADER, no problem: next fseek will settle things
|
||||
if(fread((LPVOID)&pbi, sizeof(BITMAPINFOHEADER), 1, hf) != 1) break;
|
||||
|
||||
// skip the RGBQUAD array if the editor inserted one
|
||||
fseek(hf, hdr.bfOffBits, SEEK_SET);
|
||||
|
||||
switch (Desc.Format){
|
||||
case D3DFMT_X8R8G8B8:
|
||||
case D3DFMT_A8R8G8B8:
|
||||
// Read the new texture from the .BMP file.
|
||||
if(pbi.bV4Height < 0){
|
||||
// biHeight < 0 -> scan lines from top to bottom, same as surface/texture convention
|
||||
for(int y=0; y<(int)Desc.Height; y++){
|
||||
BYTE *p = (BYTE *)LockedRect.pBits + (LockedRect.Pitch * y);
|
||||
fseek(hf, hdr.bfOffBits + (iScanLineSize * y), SEEK_SET);
|
||||
if(fread((LPVOID)p, LockedRect.Pitch, 1, hf) != 1) break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// biHeight > 0 -> scan lines from bottom to top, inverse order as surface/texture convention
|
||||
for(int y=0; y<(int)Desc.Height; y++){
|
||||
BYTE *p = (BYTE *)LockedRect.pBits + (LockedRect.Pitch * ((Desc.Height-1) - y));
|
||||
fseek(hf, hdr.bfOffBits + (iScanLineSize * y), SEEK_SET);
|
||||
if(fread((LPVOID)p, LockedRect.Pitch, 1, hf) != 1) break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case D3DFMT_DXT1:
|
||||
// Read the new texture from the .BMP file.
|
||||
if(pbi.bV4Height < 0){
|
||||
BYTE *p = (BYTE *)LockedRect.pBits;
|
||||
BYTE *fb;
|
||||
fb = (BYTE *)malloc(Desc.Width * Desc.Height * sizeof(WORD));
|
||||
if(!fb) {
|
||||
OutTrace("TextureHack: malloc error\n");
|
||||
break;
|
||||
}
|
||||
fseek(hf, hdr.bfOffBits, SEEK_SET);
|
||||
if(fread((LPVOID)fb, Desc.Height * Desc.Width * (iBitCount / 8), 1, hf) != 1) {
|
||||
OutTrace("TextureHack: fread error\n");
|
||||
free(fb);
|
||||
break;
|
||||
}
|
||||
// biHeight < 0 -> scan lines from top to bottom, same as surface/texture convention
|
||||
for(int y=0; y<(int)Desc.Height; y+=4){
|
||||
for(int x=0; x<(int)Desc.Width; x+=4){
|
||||
OutTrace("Compressing line=%d row=%d\n", y, x);
|
||||
stb_compress_dxt_block(p, fb, FALSE, STB_DXT_NORMAL);
|
||||
p += (16 * sizeof(DWORD) / 8);
|
||||
OutTrace("Compression done\n");
|
||||
fb += 4 * 2;
|
||||
}
|
||||
}
|
||||
free(fb);
|
||||
}
|
||||
break;
|
||||
case D3DFMT_DXT5:
|
||||
// Read the new texture from the .BMP file.
|
||||
if(pbi.bV4Height < 0){
|
||||
BYTE *p = (BYTE *)LockedRect.pBits;
|
||||
BYTE *fb;
|
||||
fb = (BYTE *)malloc(Desc.Width * Desc.Height * sizeof(DWORD));
|
||||
if(!fb) {
|
||||
OutTrace("TextureHack: malloc error\n");
|
||||
break;
|
||||
}
|
||||
fseek(hf, hdr.bfOffBits, SEEK_SET);
|
||||
if(fread((LPVOID)fb, Desc.Height * Desc.Width * (iBitCount / 8), 1, hf) != 1) {
|
||||
OutTrace("TextureHack: fread error\n");
|
||||
free(fb);
|
||||
break;
|
||||
}
|
||||
// biHeight < 0 -> scan lines from top to bottom, same as surface/texture convention
|
||||
for(int y=0; y<(int)Desc.Height; y+=4){
|
||||
for(int x=0; x<(int)Desc.Width; x+=4){
|
||||
OutTrace("Compressing line=%d row=%d\n", y, x);
|
||||
stb_compress_dxt_block(p, fb, FALSE, STB_DXT_NORMAL);
|
||||
p += (16 * sizeof(DWORD) / 4);
|
||||
OutTrace("Compression done\n");
|
||||
fb += 4 * 4;
|
||||
}
|
||||
}
|
||||
free(fb);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
OutTrace("TextureHack: TEXTURE LOAD DONE\n");
|
||||
break;
|
||||
}
|
||||
|
||||
fclose(hf);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#define GRIDSIZE 16
|
||||
|
||||
void D3DTextureHighlight(D3DSURFACE_DESC Desc, D3DLOCKED_RECT LockedRect)
|
||||
{
|
||||
switch (Desc.Format){
|
||||
case D3DFMT_X8R8G8B8:
|
||||
case D3DFMT_A8R8G8B8:
|
||||
{
|
||||
DWORD *p;
|
||||
DWORD color;
|
||||
color=(DWORD)(rand() & 0x00FFFFFF);
|
||||
for(UINT y=0; y<Desc.Height; y++){
|
||||
p = (DWORD *)LockedRect.pBits + ((y * LockedRect.Pitch) >> 2);
|
||||
for(UINT x=0; x<Desc.Width; x++) *(p+x) = color;
|
||||
}
|
||||
for(UINT y=0; y<Desc.Height; y++){
|
||||
p = (DWORD *)LockedRect.pBits + ((y * LockedRect.Pitch) >> 2);
|
||||
for(UINT x=0; x<Desc.Width; x+=GRIDSIZE) *(p+x) = 0;
|
||||
if((y%GRIDSIZE)==0) for(UINT x=0; x<Desc.Width; x++) *(p++) = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case D3DFMT_DXT1:
|
||||
{
|
||||
WORD color = (WORD)(rand() & 0x0000FFFF);
|
||||
WORD whiteline[4] = {0xFFFF, 0xFFFF, 0x0000, 0x0000};
|
||||
WORD coloredline[4] = {0xFFFF, 0xFFFF, 0x0000, 0x0000};
|
||||
BYTE *w = (BYTE *)LockedRect.pBits;
|
||||
coloredline[0] = coloredline[1] = color;
|
||||
#ifdef SOLIDCOLOR
|
||||
int max = (int)TextureSize(Desc, LockedRect) / 8;
|
||||
for(int i=0; i<max; i++, w+=8){
|
||||
memcpy((void *)w, (i%16)?(void *)coloredline:(void *)whiteline, 8);
|
||||
}
|
||||
#else
|
||||
for(UINT y=0; y<Desc.Height; y+=4){
|
||||
for(UINT x=0; x<Desc.Width; x+=4){
|
||||
if((y%GRIDSIZE)==0)
|
||||
memcpy((void *)w, (void *)whiteline, 8);
|
||||
else
|
||||
memcpy((void *)w, (x%GRIDSIZE)?(void *)coloredline:(void *)whiteline, 8);
|
||||
w+=8;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case D3DFMT_DXT2:
|
||||
case D3DFMT_DXT3:
|
||||
case D3DFMT_DXT4:
|
||||
case D3DFMT_DXT5:
|
||||
{
|
||||
DWORD color = (WORD)(rand() & 0x00FFFFFF);
|
||||
DWORD whiteline[8] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
|
||||
DWORD coloredline[8] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
|
||||
BYTE *w = (BYTE *)LockedRect.pBits;
|
||||
coloredline[2] = coloredline[3] = color;
|
||||
#ifdef SOLIDCOLOR
|
||||
int max = (int)TextureSize(Desc, LockedRect) / 8;
|
||||
for(int i=0; i<max; i++, w+=8){
|
||||
memcpy((void *)w, (i%16)?(void *)coloredline:(void *)whiteline, 8);
|
||||
}
|
||||
#else
|
||||
for(UINT y=0; y<Desc.Height; y+=4){
|
||||
for(UINT x=0; x<Desc.Width; x+=4){
|
||||
if((y%GRIDSIZE)==0)
|
||||
memcpy((void *)w, (void *)whiteline, 16);
|
||||
else
|
||||
memcpy((void *)w, (x%GRIDSIZE)?(void *)coloredline:(void *)whiteline, 16);
|
||||
w+=16;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
BYTE color;
|
||||
DWORD dwSize;
|
||||
color=(BYTE)(rand() & 0x000000FF);
|
||||
if(dwSize=TextureSize(Desc, LockedRect)){
|
||||
memset(LockedRect.pBits, color, dwSize);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void D3DTextureTransp(D3DSURFACE_DESC Desc, D3DLOCKED_RECT LockedRect)
|
||||
|
@ -289,8 +289,8 @@ static HRESULT sBltToPrimary(int dxversion, Blt_Type pBlt, char *api, LPDIRECTDR
|
||||
OutTraceE("WaitForVerticalBlank ERROR: res=%x\n", res2);
|
||||
}
|
||||
bVSyncDone = FALSE;
|
||||
BlitToWindow(dxw.GethWnd(), lpddssrc);
|
||||
}
|
||||
BlitToWindow(dxw.GethWnd(), lpddssrc);
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
|
@ -88,17 +88,17 @@ static void BuildRealSurfaces(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurfa
|
||||
HRESULT res;
|
||||
DDSURFACEDESC2 ddsd;
|
||||
|
||||
OutTraceDW("DEBUG: BuildRealSurfaces: lpdd=%x pCreateSurface=%x version=%d\n", lpdd, pCreateSurface, dxversion);
|
||||
OutTraceDW("BuildRealSurfaces: lpdd=%x pCreateSurface=%x version=%d\n", lpdd, pCreateSurface, dxversion);
|
||||
if(lpDDSEmu_Prim==NULL){
|
||||
ClearSurfaceDesc((void *)&ddsd, dxversion);
|
||||
ddsd.dwFlags = DDSD_CAPS;
|
||||
// try DDSCAPS_SYSTEMMEMORY first, then suppress it if not supported
|
||||
// no, DDSCAPS_SYSTEMMEMORY cause screen flickering while moving the window (and other troubles?)
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[EmuPrim]", __LINE__));
|
||||
OutTraceDW("BuildRealSurfaces: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[EmuPrim]", __LINE__));
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, &lpDDSEmu_Prim, 0);
|
||||
if(res==DDERR_PRIMARYSURFACEALREADYEXISTS){
|
||||
OutTraceDW("CreateSurface: ASSERT DDSEmu_Prim already exists\n");
|
||||
OutTraceDW("BuildRealSurfaces: ASSERT DDSEmu_Prim already exists\n");
|
||||
if(dxw.Windowize){
|
||||
// in Windowize mode, the desktop properties are untouched, then the current primary surface can be recycled
|
||||
res=(*pGetGDISurfaceMethod(dxversion))(lpdd, &lpDDSEmu_Prim);
|
||||
@ -111,23 +111,23 @@ static void BuildRealSurfaces(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurfa
|
||||
}
|
||||
}
|
||||
if(res){
|
||||
OutTraceE("CreateSurface: ERROR on DDSEmu_Prim res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
OutTraceE("BuildRealSurfaces: CreateSurface ERROR on DDSEmu_Prim res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
if(res==DDERR_INVALIDPIXELFORMAT) DumpPixFmt(&ddsd);
|
||||
return;
|
||||
}
|
||||
OutTraceDW("CreateSurface: created new DDSEmu_Prim=%x\n",lpDDSEmu_Prim);
|
||||
OutTraceDW("BuildRealSurfaces: created new DDSEmu_Prim=%x\n",lpDDSEmu_Prim);
|
||||
if(IsDebug) DescribeSurface(lpDDSEmu_Prim, dxversion, "DDSEmu_Prim", __LINE__);
|
||||
InitDSScreenParameters(dxversion, lpDDSEmu_Prim);
|
||||
dxwss.PopSurface(lpDDSEmu_Prim);
|
||||
|
||||
if (dxw.dwFlags3 & FORCECLIPPER){
|
||||
OutTraceDW("CreateSurface: FORCE SetClipper on primary hwnd=%x lpdds=%x\n", dxw.GethWnd(), lpDDSEmu_Prim);
|
||||
OutTraceDW("BuildRealSurfaces: FORCE SetClipper on primary hwnd=%x lpdds=%x\n", dxw.GethWnd(), lpDDSEmu_Prim);
|
||||
res=lpdd->CreateClipper(0, &lpddC, NULL);
|
||||
if (res) OutTraceE("CreateSurface: CreateClipper ERROR res=%x(%s)\n", res, ExplainDDError(res));
|
||||
if (res) OutTraceE("BuildRealSurfaces: CreateClipper ERROR res=%x(%s)\n", res, ExplainDDError(res));
|
||||
res=lpddC->SetHWnd(0, dxw.GethWnd());
|
||||
if (res) OutTraceE("CreateSurface: SetHWnd ERROR res=%x(%s)\n", res, ExplainDDError(res));
|
||||
if (res) OutTraceE("BuildRealSurfaces: SetHWnd ERROR res=%x(%s)\n", res, ExplainDDError(res));
|
||||
res=lpDDSEmu_Prim->SetClipper(lpddC);
|
||||
if (res) OutTraceE("CreateSurface: SetClipper ERROR res=%x(%s)\n", res, ExplainDDError(res));
|
||||
if (res) OutTraceE("BuildRealSurfaces: SetClipper ERROR res=%x(%s)\n", res, ExplainDDError(res));
|
||||
}
|
||||
// can't hook lpDDSEmu_Prim as generic, since the Flip method is unimplemented for a PRIMARY surface!
|
||||
// better avoid it or hook just useful methods.
|
||||
@ -146,19 +146,19 @@ static void BuildRealSurfaces(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurfa
|
||||
ddsd.dwHeight = dxw.GetScreenHeight() << 1;
|
||||
}
|
||||
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[EmuBack]", __LINE__));
|
||||
OutTraceDW("BuildRealSurfaces: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[EmuBack]", __LINE__));
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, &lpDDSEmu_Back, 0);
|
||||
if(res) {
|
||||
ddsd.ddsCaps.dwCaps &= ~DDSCAPS_SYSTEMMEMORY;
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[EmuBack]", __LINE__));
|
||||
OutTraceDW("BuildRealSurfaces: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[EmuBack]", __LINE__));
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, &lpDDSEmu_Back, 0);
|
||||
}
|
||||
if(res){
|
||||
OutTraceE("CreateSurface: CreateSurface ERROR on DDSEmuBack : res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
OutTraceE("BuildRealSurfaces: CreateSurface ERROR on DDSEmuBack : res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
if(res==DDERR_INVALIDPIXELFORMAT) DumpPixFmt(&ddsd);
|
||||
return;
|
||||
}
|
||||
OutTraceDW("CreateSurface: created new DDSEmu_Back=%x\n", lpDDSEmu_Back);
|
||||
OutTraceDW("BuildRealSurfaces: created new DDSEmu_Back=%x\n", lpDDSEmu_Back);
|
||||
if(IsDebug) DescribeSurface(lpDDSEmu_Back, dxversion, "DDSEmu_Back", __LINE__);
|
||||
dxwss.PopSurface(lpDDSEmu_Back);
|
||||
//if (dxw.dwTFlags & OUTPROXYTRACE) HookDDSurfaceGeneric(&lpDDSEmu_Back, dxversion);
|
||||
@ -190,7 +190,7 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
DDSURFACEDESC2 ddsd;
|
||||
HRESULT res;
|
||||
|
||||
OutTraceDW("DEBUG: BuildPrimaryEmu: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
OutTraceDW("BuildPrimaryEmu: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
// emulated primary surface
|
||||
memcpy((void *)&ddsd, lpddsd, lpddsd->dwSize);
|
||||
|
||||
@ -200,7 +200,7 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
// then save it
|
||||
dxw.VirtualPixelFormat = ddsd.ddpfPixelFormat;
|
||||
|
||||
OutTraceDW("DDSD_PIXELFORMAT: color=%d flags=%x\n", dxw.VirtualPixelFormat.dwRGBBitCount, dxw.VirtualPixelFormat.dwFlags);
|
||||
OutTraceDW("BuildPrimaryEmu: DDSD_PIXELFORMAT color=%d flags=%x\n", dxw.VirtualPixelFormat.dwRGBBitCount, dxw.VirtualPixelFormat.dwFlags);
|
||||
ddsd.dwFlags &= ~(DDSD_BACKBUFFERCOUNT|DDSD_REFRESHRATE);
|
||||
ddsd.dwFlags |= (DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT);
|
||||
ddsd.ddsCaps.dwCaps &= ~(DDSCAPS_PRIMARYSURFACE|DDSCAPS_FLIP|DDSCAPS_COMPLEX|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM);
|
||||
@ -213,16 +213,16 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
ddsd.dwHeight = dxw.GetScreenHeight();
|
||||
|
||||
// create Primary surface
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Primary]" , __LINE__));
|
||||
OutTraceDW("BuildPrimaryEmu: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Primary]" , __LINE__));
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, 0);
|
||||
if(res){
|
||||
OutTraceE("CreateSurface: ERROR on DDSPrim res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
OutTraceE("BuildPrimaryEmu: CreateSurface ERROR on DDSPrim res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
if(res==DDERR_INVALIDPIXELFORMAT) DumpPixFmt(&ddsd);
|
||||
return res;
|
||||
}
|
||||
iBakBufferVersion=dxversion; // v2.03.01
|
||||
|
||||
OutTraceDW("CreateSurface: created PRIMARY DDSPrim=%x\n", *lplpdds);
|
||||
OutTraceDW("BuildPrimaryEmu: created PRIMARY DDSPrim=%x\n", *lplpdds);
|
||||
if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSPrim", __LINE__);
|
||||
HookDDSurface(lplpdds, dxversion, TRUE);
|
||||
// "Hoyle Casino Empire" opens a primary surface and NOT a backbuffer ....
|
||||
@ -232,12 +232,12 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
(dxw.dwFlags6 & SYNCPALETTE)){
|
||||
if(lpDDP == NULL){
|
||||
res=(*pCreatePaletteMethod(dxversion))(lpdd, DDPCAPS_8BIT|DDPCAPS_ALLOW256, DefaultSystemPalette, &lpDDP, NULL);
|
||||
if(res) OutTrace("CreateSurface: CreatePalette ERROR err=%x at %d\n", res, __LINE__);
|
||||
if(res) OutTrace("BuildPrimaryEmu: CreatePalette ERROR err=%x at %d\n", res, __LINE__);
|
||||
}
|
||||
// this must be done after hooking - who knows why?
|
||||
res=(*pSetPaletteMethod(dxversion))(*lplpdds, lpDDP);
|
||||
if(res) {
|
||||
OutTraceE("CreateSurface: SetPalette ERROR err=%x at %d\n", res, __LINE__);
|
||||
OutTraceE("BuildPrimaryEmu: SetPalette ERROR err=%x at %d\n", res, __LINE__);
|
||||
}
|
||||
else iDDPExtraRefCounter++;
|
||||
}
|
||||
@ -263,7 +263,7 @@ static HRESULT BuildPrimaryFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type pCrea
|
||||
DDSURFACEDESC2 ddsd;
|
||||
HRESULT res;
|
||||
|
||||
OutTraceDW("DEBUG: BuildPrimaryFlippable: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
OutTraceDW("BuildPrimaryFlippable: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
// emulated primary surface
|
||||
memcpy((void *)&ddsd, lpddsd, lpddsd->dwSize);
|
||||
|
||||
@ -273,7 +273,7 @@ static HRESULT BuildPrimaryFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type pCrea
|
||||
// then save it
|
||||
dxw.VirtualPixelFormat = ddsd.ddpfPixelFormat;
|
||||
|
||||
OutTraceDW("DDSD_PIXELFORMAT: color=%d flags=%x\n", dxw.VirtualPixelFormat.dwRGBBitCount, dxw.VirtualPixelFormat.dwFlags);
|
||||
OutTraceDW("BuildPrimaryFlippable: DDSD_PIXELFORMAT color=%d flags=%x\n", dxw.VirtualPixelFormat.dwRGBBitCount, dxw.VirtualPixelFormat.dwFlags);
|
||||
|
||||
// dwFlags
|
||||
ddsd.dwFlags &= ~(DDSD_REFRESHRATE);
|
||||
@ -293,16 +293,16 @@ static HRESULT BuildPrimaryFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type pCrea
|
||||
ddsd.dwHeight = dxw.GetScreenHeight();
|
||||
|
||||
// create Primary surface
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Primary]" , __LINE__));
|
||||
OutTraceDW("BuildPrimaryFlippable: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Primary]" , __LINE__));
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, 0);
|
||||
if(res){
|
||||
OutTraceE("CreateSurface: ERROR on DDSPrim res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
OutTraceE("BuildPrimaryFlippable: CreateSurface ERROR on DDSPrim res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
if(res==DDERR_INVALIDPIXELFORMAT) DumpPixFmt(&ddsd);
|
||||
return res;
|
||||
}
|
||||
iBakBufferVersion=dxversion; // v2.03.01
|
||||
|
||||
OutTraceDW("CreateSurface: created PRIMARY DDSPrim=%x\n", *lplpdds);
|
||||
OutTraceDW("BuildPrimaryFlippable: created PRIMARY DDSPrim=%x\n", *lplpdds);
|
||||
if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSPrim", __LINE__);
|
||||
HookDDSurface(lplpdds, dxversion, TRUE);
|
||||
// "Hoyle Casino Empire" opens a primary surface and NOT a backbuffer ....
|
||||
@ -312,12 +312,12 @@ static HRESULT BuildPrimaryFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type pCrea
|
||||
(dxw.dwFlags6 & SYNCPALETTE)){
|
||||
if(lpDDP == NULL){
|
||||
res=(*pCreatePaletteMethod(dxversion))(lpdd, DDPCAPS_8BIT|DDPCAPS_ALLOW256, DefaultSystemPalette, &lpDDP, NULL);
|
||||
if(res) OutTrace("CreateSurface: CreatePalette ERROR err=%x at %d\n", res, __LINE__);
|
||||
if(res) OutTrace("BuildPrimaryFlippable: CreatePalette ERROR err=%x at %d\n", res, __LINE__);
|
||||
}
|
||||
// this must be done after hooking - who knows why?
|
||||
res=(*pSetPaletteMethod(dxversion))(*lplpdds, lpDDP);
|
||||
if(res) {
|
||||
OutTraceE("CreateSurface: SetPalette ERROR err=%x at %d\n", res, __LINE__);
|
||||
OutTraceE("BuildPrimaryFlippable: SetPalette ERROR err=%x at %d\n", res, __LINE__);
|
||||
}
|
||||
else iDDPExtraRefCounter++;
|
||||
}
|
||||
@ -341,12 +341,12 @@ static HRESULT BuildPrimaryFullscreen(LPDIRECTDRAW lpdd, CreateSurface_Type pCre
|
||||
DDSURFACEDESC2 ddsd;
|
||||
HRESULT res;
|
||||
|
||||
OutTraceDW("DEBUG: BuildPrimaryFullscreen: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
OutTraceDW("BuildPrimaryFullscreen: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
// genuine primary surface
|
||||
memcpy((void *)&ddsd, lpddsd, lpddsd->dwSize);
|
||||
|
||||
// create Primary surface
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Primary]", __LINE__));
|
||||
OutTraceDW("BuildPrimaryFullscreen: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Primary]", __LINE__));
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, 0);
|
||||
if(res){
|
||||
if (res==DDERR_PRIMARYSURFACEALREADYEXISTS){
|
||||
@ -360,20 +360,20 @@ static HRESULT BuildPrimaryFullscreen(LPDIRECTDRAW lpdd, CreateSurface_Type pCre
|
||||
case 4: pGetGDISurface = pGetGDISurface4; break;
|
||||
case 7: pGetGDISurface = pGetGDISurface7; break;
|
||||
}
|
||||
OutTraceE("CreateSurface: CreateSurface DDERR_PRIMARYSURFACEALREADYEXISTS workaround\n");
|
||||
OutTraceE("BuildPrimaryFullscreen: CreateSurface DDERR_PRIMARYSURFACEALREADYEXISTS workaround\n");
|
||||
(*pGetGDISurface)(lpPrimaryDD, &lpPrim);
|
||||
while ((*pReleaseSMethod(dxversion))(lpPrim));
|
||||
res = (*pCreateSurface)(lpdd, &ddsd, lplpdds, 0);
|
||||
}
|
||||
/* fall through */
|
||||
if(res){
|
||||
OutTraceE("CreateSurface: ERROR on DDSPrim res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
OutTraceE("BuildPrimaryFullscreen: CreateSurface ERROR on DDSPrim res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
if(res==DDERR_INVALIDPIXELFORMAT) DumpPixFmt(&ddsd);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
OutTraceDW("CreateSurface: created PRIMARY DDSPrim=%x\n", *lplpdds);
|
||||
OutTraceDW("BuildPrimaryFullscreen: created PRIMARY DDSPrim=%x\n", *lplpdds);
|
||||
if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSPrim", __LINE__);
|
||||
|
||||
iBakBufferVersion=dxversion;
|
||||
@ -388,7 +388,7 @@ static HRESULT BuildPrimaryDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
DDSURFACEDESC2 ddsd;
|
||||
HRESULT res;
|
||||
|
||||
OutTraceDW("DEBUG: BuildPrimaryDir: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
OutTraceDW("BuildPrimaryDir: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
// genuine primary surface
|
||||
memcpy((void *)&ddsd, lpddsd, lpddsd->dwSize);
|
||||
// v2.03.98 - when going to fullscreen mode and no emulation do not alter the capability masks, or in other words ...
|
||||
@ -400,7 +400,7 @@ static HRESULT BuildPrimaryDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
if ((lpddsd->dwFlags & DDSD_CAPS) && (lpddsd->ddsCaps.dwCaps & DDSCAPS_3DDEVICE)) ddsd.ddsCaps.dwCaps &= ~DDSCAPS_SYSTEMMEMORY;
|
||||
|
||||
// create Primary surface
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Primary]", __LINE__));
|
||||
OutTraceDW("BuildPrimaryDir: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Primary]", __LINE__));
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, 0);
|
||||
if(res){
|
||||
if (res==DDERR_PRIMARYSURFACEALREADYEXISTS){
|
||||
@ -414,20 +414,20 @@ static HRESULT BuildPrimaryDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
case 4: pGetGDISurface = pGetGDISurface4; break;
|
||||
case 7: pGetGDISurface = pGetGDISurface7; break;
|
||||
}
|
||||
OutTraceE("CreateSurface: CreateSurface DDERR_PRIMARYSURFACEALREADYEXISTS workaround\n");
|
||||
OutTraceE("BuildPrimaryDir: CreateSurface DDERR_PRIMARYSURFACEALREADYEXISTS workaround\n");
|
||||
(*pGetGDISurface)(lpPrimaryDD, &lpPrim);
|
||||
while ((*pReleaseSMethod(dxversion))(lpPrim));
|
||||
res = (*pCreateSurface)(lpdd, &ddsd, lplpdds, 0);
|
||||
}
|
||||
/* fall through */
|
||||
if(res){
|
||||
OutTraceE("CreateSurface: ERROR on DDSPrim res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
OutTraceE("BuildPrimaryDir: CreateSurface ERROR on DDSPrim res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
if(res==DDERR_INVALIDPIXELFORMAT) DumpPixFmt(&ddsd);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
OutTraceDW("CreateSurface: created PRIMARY DDSPrim=%x\n", *lplpdds);
|
||||
OutTraceDW("BuildPrimaryDir: created PRIMARY DDSPrim=%x\n", *lplpdds);
|
||||
if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSPrim", __LINE__);
|
||||
|
||||
if(dxw.dwFlags1 & EMULATEBUFFER){
|
||||
@ -440,13 +440,13 @@ static HRESULT BuildPrimaryDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
ddsd.dwHeight = dxw.GetScreenHeight();
|
||||
ddsd.ddsCaps.dwCaps = 0;
|
||||
if (dxversion >= 4) ddsd.ddsCaps.dwCaps |= DDSCAPS_OFFSCREENPLAIN;
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Dir FixBuf]", __LINE__));
|
||||
OutTraceDW("BuildPrimaryDir: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Dir FixBuf]", __LINE__));
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, 0);
|
||||
if(res){
|
||||
OutTraceE("CreateSurface: ERROR on DDSPrim res=%x(%s) at %d\n",res, ExplainDDError(res), __LINE__);
|
||||
OutTraceE("BuildPrimaryDir: CreateSurface ERROR on DDSPrim res=%x(%s) at %d\n",res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
OutTraceDW("CreateSurface: created FIX DDSPrim=%x\n", *lplpdds);
|
||||
OutTraceDW("BuildPrimaryDir: created FIX DDSPrim=%x\n", *lplpdds);
|
||||
if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSPrim(2)", __LINE__);
|
||||
}
|
||||
|
||||
@ -462,7 +462,7 @@ static HRESULT BuildBackBufferEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateS
|
||||
DDSURFACEDESC2 ddsd;
|
||||
HRESULT res;
|
||||
|
||||
OutTraceDW("DEBUG: BuildBackBufferEmu: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
OutTraceDW("BuildBackBufferEmu: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
// create BackBuffer surface
|
||||
memcpy(&ddsd, lpddsd, lpddsd->dwSize);
|
||||
ddsd.dwFlags &= ~(DDSD_BACKBUFFERCOUNT|DDSD_REFRESHRATE);
|
||||
@ -481,15 +481,15 @@ static HRESULT BuildBackBufferEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateS
|
||||
ddsd.dwHeight = dxw.GetScreenHeight();
|
||||
GetPixFmt(&ddsd);
|
||||
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Backbuf]", __LINE__));
|
||||
OutTraceDW("BuildBackBufferEmu: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Backbuf]", __LINE__));
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, 0);
|
||||
if(res) {
|
||||
OutTraceE("CreateSurface ERROR: res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
OutTraceE("BuildBackBufferEmu: CreateSurface ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
if(res==DDERR_INVALIDPIXELFORMAT) DumpPixFmt(&ddsd);
|
||||
return res;
|
||||
}
|
||||
|
||||
OutTraceDW("CreateSurface: created BACK DDSBack=%x\n", *lplpdds);
|
||||
OutTraceDW("BuildBackBufferEmu: created BACK DDSBack=%x\n", *lplpdds);
|
||||
if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSBack", __LINE__);
|
||||
HookDDSurface(lplpdds, dxversion, FALSE); // added !!!
|
||||
iBakBufferVersion=dxversion; // v2.02.31
|
||||
@ -498,12 +498,12 @@ static HRESULT BuildBackBufferEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateS
|
||||
(dxw.dwFlags6 & SYNCPALETTE)){
|
||||
if(lpDDP == NULL){
|
||||
res=(*pCreatePaletteMethod(dxversion))(lpdd, DDPCAPS_8BIT|DDPCAPS_ALLOW256, DefaultSystemPalette, &lpDDP, NULL);
|
||||
if(res) OutTrace("CreateSurface: CreatePalette ERROR err=%x at %d\n", res, __LINE__);
|
||||
if(res) OutTrace("BuildBackBufferEmu: CreatePalette ERROR err=%x at %d\n", res, __LINE__);
|
||||
}
|
||||
// this must be done after hooking - who knows why?
|
||||
res=(*pSetPaletteMethod(dxversion))(*lplpdds, lpDDP);
|
||||
if(res) {
|
||||
OutTraceE("CreateSurface: SetPalette ERROR err=%x at %d\n", res, __LINE__);
|
||||
OutTraceE("BuildBackBufferEmu: SetPalette ERROR err=%x at %d\n", res, __LINE__);
|
||||
}
|
||||
else iDDPExtraRefCounter++;
|
||||
}
|
||||
@ -524,7 +524,7 @@ static HRESULT BuildBackBufferFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type pC
|
||||
DDSURFACEDESC2 ddsd;
|
||||
HRESULT res;
|
||||
|
||||
OutTraceDW("DEBUG: BuildBackBufferFlippable: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
OutTraceDW("BuildBackBufferFlippable: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
//MessageBox(NULL, "BuildBackBufferFlippable", "DxWnd", MB_OK);
|
||||
|
||||
// create BackBuffer surface
|
||||
@ -540,15 +540,15 @@ static HRESULT BuildBackBufferFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type pC
|
||||
ddsd.dwHeight = dxw.GetScreenHeight();
|
||||
GetPixFmt(&ddsd);
|
||||
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Backbuf]", __LINE__));
|
||||
OutTraceDW("BuildBackBufferFlippable: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Backbuf]", __LINE__));
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, 0);
|
||||
if(res) {
|
||||
OutTraceE("CreateSurface ERROR: res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
OutTraceE("BuildBackBufferFlippable: CreateSurface ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
if(res==DDERR_INVALIDPIXELFORMAT) DumpPixFmt(&ddsd);
|
||||
return res;
|
||||
}
|
||||
|
||||
OutTraceDW("CreateSurface: created BACK DDSBack=%x\n", *lplpdds);
|
||||
OutTraceDW("BuildBackBufferFlippable: created BACK DDSBack=%x\n", *lplpdds);
|
||||
if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSBack", __LINE__);
|
||||
HookDDSurface(lplpdds, dxversion, FALSE); // added !!!
|
||||
iBakBufferVersion=dxversion; // v2.02.31
|
||||
@ -557,12 +557,12 @@ static HRESULT BuildBackBufferFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type pC
|
||||
(dxw.dwFlags6 & SYNCPALETTE)){
|
||||
if(lpDDP == NULL){
|
||||
res=(*pCreatePaletteMethod(dxversion))(lpdd, DDPCAPS_8BIT|DDPCAPS_ALLOW256, DefaultSystemPalette, &lpDDP, NULL);
|
||||
if(res) OutTrace("CreateSurface: CreatePalette ERROR err=%x at %d\n", res, __LINE__);
|
||||
if(res) OutTrace("BuildBackBufferFlippable: CreatePalette ERROR err=%x at %d\n", res, __LINE__);
|
||||
}
|
||||
// this must be done after hooking - who knows why?
|
||||
res=(*pSetPaletteMethod(dxversion))(*lplpdds, lpDDP);
|
||||
if(res) {
|
||||
OutTraceE("CreateSurface: SetPalette ERROR err=%x at %d\n", res, __LINE__);
|
||||
OutTraceE("BuildBackBufferFlippable: SetPalette ERROR err=%x at %d\n", res, __LINE__);
|
||||
}
|
||||
else iDDPExtraRefCounter++;
|
||||
}
|
||||
@ -574,7 +574,7 @@ static HRESULT AttachBackBufferFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type p
|
||||
{
|
||||
HRESULT res;
|
||||
LPDIRECTDRAWSURFACE lpDDSPrim;
|
||||
OutTraceDW("DEBUG: AttachBackBufferFlippable: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
OutTraceDW("AttachBackBufferFlippable: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
|
||||
// retrieve the attached backbuffer surface and hook it
|
||||
|
||||
@ -594,11 +594,11 @@ static HRESULT AttachBackBufferFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type p
|
||||
lpDDSPrim = dxwss.GetPrimarySurface();
|
||||
res = (*pGetAttachedSurface)(lpDDSPrim, (LPDDSCAPS)&caps, lplpdds);
|
||||
if(res){
|
||||
OutTraceE("CreateSurface: GetAttachedSurface ERROR on DDSPrim res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
OutTraceE("AttachBackBufferFlippable: GetAttachedSurface ERROR on DDSPrim res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
|
||||
OutTraceDW("CreateSurface: retrieved BACK DDSBack=%x\n", *lplpdds);
|
||||
OutTraceDW("AttachBackBufferFlippable: retrieved BACK DDSBack=%x\n", *lplpdds);
|
||||
if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSBack", __LINE__);
|
||||
HookDDSurface(lplpdds, dxversion, FALSE); // added !!!
|
||||
iBakBufferVersion=dxversion; // v2.02.31
|
||||
@ -608,13 +608,13 @@ static HRESULT AttachBackBufferFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type p
|
||||
|
||||
static HRESULT BuildBackBufferFullscreen(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurface, LPDDSURFACEDESC2 lpddsd, int dxversion, LPDIRECTDRAWSURFACE *lplpdds, void *pu)
|
||||
{
|
||||
OutTraceDW("DEBUG: BuildBackBufferFullscreen: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
OutTraceDW("BuildBackBufferFullscreen: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
static HRESULT AttachBackBufferFullscreen(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurface, LPDDSURFACEDESC2 lpddsd, int dxversion, LPDIRECTDRAWSURFACE *lplpdds, void *pu)
|
||||
{
|
||||
OutTraceDW("DEBUG: AttachBackBufferFullscreen: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
OutTraceDW("AttachBackBufferFullscreen: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
@ -623,7 +623,7 @@ static HRESULT BuildBackBufferDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateS
|
||||
DDSURFACEDESC2 ddsd;
|
||||
HRESULT res;
|
||||
|
||||
OutTraceDW("DEBUG: BuildBackBufferDir: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
OutTraceDW("BuildBackBufferDir: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
// create BackBuffer surface
|
||||
// ClearSurfaceDesc((void *)&ddsd, dxversion);
|
||||
memcpy(&ddsd, lpddsd, lpddsd->dwSize);
|
||||
@ -664,24 +664,24 @@ static HRESULT BuildBackBufferDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateS
|
||||
(*pReleaseSMethod(dxversion))(lpPrim);
|
||||
ddsd.dwWidth = prim.dwWidth;
|
||||
ddsd.dwHeight = prim.dwHeight;
|
||||
OutTraceDW("BMX FIX: res=%x(%s) wxh=(%dx%d)\n", res, ExplainDDError(res),ddsd.dwWidth, ddsd.dwHeight);
|
||||
OutTraceDW("BuildBackBufferDir: BMX FIX res=%x(%s) wxh=(%dx%d)\n", res, ExplainDDError(res),ddsd.dwWidth, ddsd.dwHeight);
|
||||
}
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Backbuf]", __LINE__));
|
||||
OutTraceDW("BuildBackBufferDir: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Backbuf]", __LINE__));
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, 0);
|
||||
if(res) {
|
||||
if ((dxw.dwFlags1 & SWITCHVIDEOMEMORY) && (res==DDERR_OUTOFVIDEOMEMORY)){
|
||||
OutTraceDW("CreateSurface: CreateSurface DDERR_OUTOFVIDEOMEMORY ERROR at %d, retry in SYSTEMMEMORY\n", __LINE__);
|
||||
OutTraceDW("BuildBackBufferDir: CreateSurface DDERR_OUTOFVIDEOMEMORY ERROR at %d, retry in SYSTEMMEMORY\n", __LINE__);
|
||||
ddsd.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY;
|
||||
ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, 0);
|
||||
}
|
||||
if(res){
|
||||
OutTraceE("CreateSurface ERROR: res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
OutTraceE("BuildBackBufferDir: CreateSurface ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
OutTraceDW("CreateSurface: created BACK DDSBack=%x\n", *lplpdds);
|
||||
OutTraceDW("BuildBackBufferDir: created BACK DDSBack=%x\n", *lplpdds);
|
||||
if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSBack", __LINE__);
|
||||
HookDDSurface(lplpdds, dxversion, FALSE); // added !!!
|
||||
iBakBufferVersion=dxversion; // v2.02.31
|
||||
@ -694,7 +694,7 @@ static HRESULT BuildGenericEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
DDSURFACEDESC2 ddsd;
|
||||
HRESULT res;
|
||||
|
||||
OutTraceDW("DEBUG: BuildGenericEmu: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
OutTraceDW("BuildGenericEmu: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
memcpy(&ddsd, lpddsd, lpddsd->dwSize); // Copy over ....
|
||||
FixSurfaceCaps(&ddsd, dxversion);
|
||||
// It looks that DDSCAPS_SYSTEMMEMORY surfaces can perfectly be DDSCAPS_3DDEVICE as well.
|
||||
@ -708,24 +708,24 @@ static HRESULT BuildGenericEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
){
|
||||
DWORD dwWidth;
|
||||
dwWidth = ((ddsd.dwWidth + 3) >> 2) << 2;
|
||||
if(dwWidth != ddsd.dwWidth) OutTraceDW("CreateSurface: fixed surface width %d->%d\n", ddsd.dwWidth, dwWidth);
|
||||
if(dwWidth != ddsd.dwWidth) OutTraceDW("BuildGenericEmu: POWER2WIDTH fix surface width %d->%d\n", ddsd.dwWidth, dwWidth);
|
||||
ddsd.dwWidth = dwWidth;
|
||||
}
|
||||
}
|
||||
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, pu);
|
||||
if ((dxw.dwFlags1 & SWITCHVIDEOMEMORY) && (res!=DD_OK)){
|
||||
OutTraceDW("CreateSurface ERROR: res=%x(%s) at %d, retry\n", res, ExplainDDError(res), __LINE__);
|
||||
OutTraceDW("BuildGenericEmu: CreateSurface ERROR res=%x(%s) at %d, retry\n", res, ExplainDDError(res), __LINE__);
|
||||
ddsd.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY;
|
||||
ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, pu);
|
||||
}
|
||||
if (res) {
|
||||
OutTraceE("CreateSurface: ERROR on Emu_Generic res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
OutTraceE("BuildGenericEmu: CreateSurface ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
|
||||
OutTraceDW("CreateSurface: CREATED lpddsd=%x version=%d %s\n",
|
||||
OutTraceDW("BuildGenericEmu: CREATED lpddsd=%x version=%d %s\n",
|
||||
*lplpdds, dxversion, LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Emu Generic]", __LINE__));
|
||||
|
||||
// v2.02.66: if 8BPP paletized surface and a primary palette exixts, apply.
|
||||
@ -733,9 +733,9 @@ static HRESULT BuildGenericEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
if(lpDDP && (ddsd.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8)){
|
||||
res=(*pSetPaletteMethod(dxversion))(*lplpdds, lpDDP);
|
||||
if(res)
|
||||
OutTraceE("SetPalette: ERROR on lpdds=%x(Emu_Generic) res=%x(%s) at %d\n", *lplpdds, res, ExplainDDError(res), __LINE__);
|
||||
OutTraceE("BuildGenericEmu: SetPalette ERROR lpdds=%x res=%x(%s) at %d\n", *lplpdds, res, ExplainDDError(res), __LINE__);
|
||||
else {
|
||||
OutTraceDW("CreateSurface: applied lpddp=%x to lpdds=%x\n", lpDDP, *lplpdds);
|
||||
OutTraceDW("BuildGenericEmu: applied palette lpddp=%x to lpdds=%x\n", lpDDP, *lplpdds);
|
||||
iDDPExtraRefCounter++;
|
||||
}
|
||||
}
|
||||
@ -751,7 +751,7 @@ static HRESULT BuildGenericFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type pCrea
|
||||
DDSURFACEDESC2 ddsd;
|
||||
HRESULT res;
|
||||
|
||||
OutTraceDW("DEBUG: BuildGenericFlippable: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
OutTraceDW("BuildGenericFlippable: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
memcpy(&ddsd, lpddsd, lpddsd->dwSize); // Copy over ....
|
||||
FixSurfaceCaps(&ddsd, dxversion);
|
||||
|
||||
@ -761,24 +761,24 @@ static HRESULT BuildGenericFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type pCrea
|
||||
){
|
||||
DWORD dwWidth;
|
||||
dwWidth = ((ddsd.dwWidth + 3) >> 2) << 2;
|
||||
if(dwWidth != ddsd.dwWidth) OutTraceDW("CreateSurface: fixed surface width %d->%d\n", ddsd.dwWidth, dwWidth);
|
||||
if(dwWidth != ddsd.dwWidth) OutTraceDW("BuildGenericFlippable: POWER2WIDTH fix surface width %d->%d\n", ddsd.dwWidth, dwWidth);
|
||||
ddsd.dwWidth = dwWidth;
|
||||
}
|
||||
}
|
||||
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, pu);
|
||||
if ((dxw.dwFlags1 & SWITCHVIDEOMEMORY) && (res!=DD_OK)){
|
||||
OutTraceDW("CreateSurface ERROR: res=%x(%s) at %d, retry\n", res, ExplainDDError(res), __LINE__);
|
||||
OutTraceDW("BuildGenericFlippable: CreateSurface ERROR res=%x(%s) at %d, retry\n", res, ExplainDDError(res), __LINE__);
|
||||
ddsd.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY;
|
||||
ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, pu);
|
||||
}
|
||||
if (res) {
|
||||
OutTraceE("CreateSurface: ERROR on Emu_Generic res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
OutTraceE("BuildGenericFlippable: CreateSurface ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
|
||||
OutTraceDW("CreateSurface: CREATED lpddsd=%x version=%d %s\n",
|
||||
OutTraceDW("BuildGenericFlippable: CREATED lpddsd=%x version=%d %s\n",
|
||||
*lplpdds, dxversion, LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Emu Generic]", __LINE__));
|
||||
|
||||
// v2.02.66: if 8BPP paletized surface and a primary palette exixts, apply.
|
||||
@ -786,9 +786,9 @@ static HRESULT BuildGenericFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type pCrea
|
||||
if(lpDDP && (ddsd.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8)){
|
||||
res=(*pSetPaletteMethod(dxversion))(*lplpdds, lpDDP);
|
||||
if(res)
|
||||
OutTraceE("SetPalette: ERROR on lpdds=%x(Emu_Generic) res=%x(%s) at %d\n", *lplpdds, res, ExplainDDError(res), __LINE__);
|
||||
OutTraceE("BuildGenericFlippable: SetPalette ERROR on lpdds=%x res=%x(%s) at %d\n", *lplpdds, res, ExplainDDError(res), __LINE__);
|
||||
else {
|
||||
OutTraceDW("CreateSurface: applied lpddp=%x to lpdds=%x\n", lpDDP, *lplpdds);
|
||||
OutTraceDW("BuildGenericFlippable: applied palette lpddp=%x to lpdds=%x\n", lpDDP, *lplpdds);
|
||||
iDDPExtraRefCounter++;
|
||||
}
|
||||
}
|
||||
@ -803,25 +803,25 @@ static HRESULT BuildGenericDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
{
|
||||
HRESULT res;
|
||||
|
||||
OutTraceDW("DEBUG: BuildGenericDir: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)lpddsd, "[Dir Generic]", __LINE__));
|
||||
OutTraceDW("BuildGenericDir: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
|
||||
OutTraceDW("BuildGenericDir: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)lpddsd, "[Dir Generic]", __LINE__));
|
||||
|
||||
res = (*pCreateSurface)(lpdd, lpddsd, lplpdds, 0);
|
||||
if(res){
|
||||
// v2.02.60: Ref. game Incoming GOG release, post by Marek, error DDERR_UNSUPPORTED while trying to create ZBUFFER surface
|
||||
if ((dxw.dwFlags1 & SWITCHVIDEOMEMORY) && ((res==DDERR_OUTOFVIDEOMEMORY)||(res==DDERR_UNSUPPORTED))){
|
||||
OutTraceDW("CreateSurface ERROR: res=%x(%s) at %d, retry\n", res, ExplainDDError(res), __LINE__);
|
||||
OutTraceDW("BuildGenericDir: CreateSurface ERROR res=%x(%s) at %d, retry\n", res, ExplainDDError(res), __LINE__);
|
||||
lpddsd->ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY;
|
||||
lpddsd->ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
|
||||
res = (*pCreateSurface)(lpdd, lpddsd, lplpdds, 0);
|
||||
}
|
||||
if(res){
|
||||
OutTraceE("CreateSurface: CreateSurface ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
OutTraceE("BuildGenericDir: CreateSurface ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
OutTraceDW("CreateSurface: CREATED lpddsd=%x version=%d %s\n",
|
||||
OutTraceDW("BuildGenericDir: CREATED lpddsd=%x version=%d %s\n",
|
||||
*lplpdds, dxversion, LogSurfaceAttributes((LPDDSURFACEDESC)lpddsd, "[Dir Generic]", __LINE__));
|
||||
|
||||
// hooks ....
|
||||
@ -1037,8 +1037,9 @@ HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreateSurface
|
||||
dxwss.PopSurface(*lplpdds);
|
||||
if(lpddsd->ddsCaps.dwCaps & DDSCAPS_ZBUFFER) {
|
||||
// v2.03.82: save ZBUFFER capabilities for later fix in D3D CreateDevice
|
||||
if(lpddsd->ddsCaps.dwCaps & DDSCAPS_ZBUFFER) dxwcdb.PushCaps(*lplpdds, lpddsd->ddsCaps.dwCaps);
|
||||
OutTraceDW("CreateSurface: lpDDZBuffer=%x save ZBUFFER caps=%x(%s)\n", *lplpdds, lpddsd->ddsCaps.dwCaps, ExplainDDSCaps(lpddsd->ddsCaps.dwCaps));
|
||||
lpDDZBuffer = *lplpdds;
|
||||
dxwcdb.PushCaps(*lplpdds, lpddsd->ddsCaps.dwCaps);
|
||||
}
|
||||
}
|
||||
|
||||
|
110
dll/ddraw.cpp
110
dll/ddraw.cpp
@ -76,6 +76,11 @@ HRESULT WINAPI extCreateSurface2(LPDIRECTDRAW, DDSURFACEDESC *, LPDIRECTDRAWSURF
|
||||
HRESULT WINAPI extCreateSurface3(LPDIRECTDRAW, DDSURFACEDESC *, LPDIRECTDRAWSURFACE *, void *);
|
||||
HRESULT WINAPI extCreateSurface4(LPDIRECTDRAW, DDSURFACEDESC2 *, LPDIRECTDRAWSURFACE *, void *);
|
||||
HRESULT WINAPI extCreateSurface7(LPDIRECTDRAW, DDSURFACEDESC2 *, LPDIRECTDRAWSURFACE *, void *);
|
||||
HRESULT WINAPI extDuplicateSurface1(LPDIRECTDRAW, LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE FAR *);
|
||||
HRESULT WINAPI extDuplicateSurface2(LPDIRECTDRAW, LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE FAR *);
|
||||
HRESULT WINAPI extDuplicateSurface3(LPDIRECTDRAW, LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE FAR *);
|
||||
HRESULT WINAPI extDuplicateSurface4(LPDIRECTDRAW, LPDIRECTDRAWSURFACE4, LPDIRECTDRAWSURFACE4 FAR *);
|
||||
HRESULT WINAPI extDuplicateSurface7(LPDIRECTDRAW, LPDIRECTDRAWSURFACE7, LPDIRECTDRAWSURFACE7 FAR *);
|
||||
HRESULT WINAPI extFlipToGDISurface1(LPDIRECTDRAW);
|
||||
HRESULT WINAPI extFlipToGDISurface2(LPDIRECTDRAW);
|
||||
HRESULT WINAPI extFlipToGDISurface3(LPDIRECTDRAW);
|
||||
@ -314,6 +319,9 @@ Compact_Type pCompact;
|
||||
CreateClipper_Type pCreateClipper1, pCreateClipper2, pCreateClipper3, pCreateClipper4, pCreateClipper7;
|
||||
CreatePalette_Type pCreatePalette1, pCreatePalette2, pCreatePalette3, pCreatePalette4, pCreatePalette7;
|
||||
CreateSurface1_Type pCreateSurface1, pCreateSurface2, pCreateSurface3, pCreateSurface4, pCreateSurface7;
|
||||
DuplicateSurface_Type pDuplicateSurface1, pDuplicateSurface2, pDuplicateSurface3;
|
||||
DuplicateSurface4_Type pDuplicateSurface4;
|
||||
DuplicateSurface7_Type pDuplicateSurface7;
|
||||
EnumDisplayModes1_Type pEnumDisplayModes1, pEnumDisplayModes2, pEnumDisplayModes3;
|
||||
EnumDisplayModes4_Type pEnumDisplayModes4, pEnumDisplayModes7;
|
||||
EnumSurfaces1_Type pEnumSurfaces1;
|
||||
@ -416,7 +424,7 @@ GammaRamp_Type pDDSetGammaRamp;
|
||||
extern PALETTEENTRY DefaultSystemPalette[256];
|
||||
LPDIRECTDRAWSURFACE lpDDSEmu_Prim=NULL;
|
||||
LPDIRECTDRAWSURFACE lpDDSEmu_Back=NULL;
|
||||
LPDIRECTDRAWSURFACE lpDDZBuffer=NULL;
|
||||
LPDIRECTDRAWSURFACE lpDDZBuffer=NULL; // BEWARE! Likely, this global is useless ....
|
||||
// v2.1.87: lpPrimaryDD is the DIRECTDRAW object to which the primary surface and all
|
||||
// the service objects (emulated backbuffer, emulater primary, ....) are attached.
|
||||
LPDIRECTDRAW lpPrimaryDD=NULL;
|
||||
@ -1156,10 +1164,11 @@ void HookDDSession(LPDIRECTDRAW *lplpdd, int dxversion)
|
||||
switch(dxversion) {
|
||||
case 1:
|
||||
SetHook((void *)(**(DWORD **)lplpdd), extQueryInterfaceD1, (void **)&pQueryInterfaceD1, "QueryInterface(D1)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 16), extCreateClipper1, (void **)&pCreateClipper1, "CreateClipper(D1)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 8), extReleaseD1, (void **)&pReleaseD1, "Release(D1)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 16), extCreateClipper1, (void **)&pCreateClipper1, "CreateClipper(D1)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 20), extCreatePalette1, (void **)&pCreatePalette1, "CreatePalette(D1)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 24), extCreateSurface1, (void **)&pCreateSurface1, "CreateSurface(D1)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 28), extDuplicateSurface1, (void **)&pDuplicateSurface1, "DuplicateSurface(D1)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 32), extEnumDisplayModes1, (void **)&pEnumDisplayModes1, "EnumDisplayModes(D1)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 40), extFlipToGDISurface1, (void **)&pFlipToGDISurface1, "FlipToGDISurface(D1)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 44), extGetCaps1D, (void **)&pGetCaps1D, "GetCaps(D1)");
|
||||
@ -1174,10 +1183,11 @@ void HookDDSession(LPDIRECTDRAW *lplpdd, int dxversion)
|
||||
break;
|
||||
case 2:
|
||||
SetHook((void *)(**(DWORD **)lplpdd), extQueryInterfaceD2, (void **)&pQueryInterfaceD2, "QueryInterface(D2)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 16), extCreateClipper2, (void **)&pCreateClipper2, "CreateClipper(D2)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 8), extReleaseD2, (void **)&pReleaseD2, "Release(D2)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 16), extCreateClipper2, (void **)&pCreateClipper2, "CreateClipper(D2)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 20), extCreatePalette2, (void **)&pCreatePalette2, "CreatePalette(D2)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 24), extCreateSurface2, (void **)&pCreateSurface2, "CreateSurface(D2)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 28), extDuplicateSurface2, (void **)&pDuplicateSurface2, "DuplicateSurface(D2)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 32), extEnumDisplayModes2, (void **)&pEnumDisplayModes2, "EnumDisplayModes(D2)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 40), extFlipToGDISurface2, (void **)&pFlipToGDISurface2, "FlipToGDISurface(D2)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 44), extGetCaps2D, (void **)&pGetCaps2D, "GetCaps(D2)");
|
||||
@ -1194,10 +1204,11 @@ void HookDDSession(LPDIRECTDRAW *lplpdd, int dxversion)
|
||||
break;
|
||||
case 3:
|
||||
SetHook((void *)(**(DWORD **)lplpdd), extQueryInterfaceD3, (void **)&pQueryInterfaceD3, "QueryInterface(D3)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 16), extCreateClipper3, (void **)&pCreateClipper3, "CreateClipper(D3)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 8), extReleaseD3, (void **)&pReleaseD3, "Release(D3)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 16), extCreateClipper3, (void **)&pCreateClipper3, "CreateClipper(D3)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 20), extCreatePalette3, (void **)&pCreatePalette3, "CreatePalette(D3)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 24), extCreateSurface3, (void **)&pCreateSurface3, "CreateSurface(D3)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 28), extDuplicateSurface3, (void **)&pDuplicateSurface3, "DuplicateSurface(D3)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 32), extEnumDisplayModes3, (void **)&pEnumDisplayModes3, "EnumDisplayModes(D3)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 40), extFlipToGDISurface3, (void **)&pFlipToGDISurface3, "FlipToGDISurface(D3)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 44), extGetCaps3D, (void **)&pGetCaps3D, "GetCaps(D3)");
|
||||
@ -1214,10 +1225,11 @@ void HookDDSession(LPDIRECTDRAW *lplpdd, int dxversion)
|
||||
break;
|
||||
case 4:
|
||||
SetHook((void *)(**(DWORD **)lplpdd), extQueryInterfaceD4, (void **)&pQueryInterfaceD4, "QueryInterface(D4)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 16), extCreateClipper4, (void **)&pCreateClipper4, "CreateClipper(D4)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 8), extReleaseD4, (void **)&pReleaseD4, "Release(D4)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 16), extCreateClipper4, (void **)&pCreateClipper4, "CreateClipper(D4)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 20), extCreatePalette4, (void **)&pCreatePalette4, "CreatePalette(D4)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 24), extCreateSurface4, (void **)&pCreateSurface4, "CreateSurface(D4)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 28), extDuplicateSurface4, (void **)&pDuplicateSurface4, "DuplicateSurface(D4)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 32), extEnumDisplayModes4, (void **)&pEnumDisplayModes4, "EnumDisplayModes(D4)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 40), extFlipToGDISurface4, (void **)&pFlipToGDISurface4, "FlipToGDISurface(D4)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 44), extGetCaps4D, (void **)&pGetCaps4D, "GetCaps(D4)");
|
||||
@ -1236,10 +1248,11 @@ void HookDDSession(LPDIRECTDRAW *lplpdd, int dxversion)
|
||||
break;
|
||||
case 7:
|
||||
SetHook((void *)(**(DWORD **)lplpdd), extQueryInterfaceD7, (void **)&pQueryInterfaceD7, "QueryInterface(D7)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 16), extCreateClipper7, (void **)&pCreateClipper7, "CreateClipper(D7)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 8), extReleaseD7, (void **)&pReleaseD7, "Release(D7)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 16), extCreateClipper7, (void **)&pCreateClipper7, "CreateClipper(D7)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 20), extCreatePalette7, (void **)&pCreatePalette7, "CreatePalette(D7)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 24), extCreateSurface7, (void **)&pCreateSurface7, "CreateSurface(D7)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 28), extDuplicateSurface7, (void **)&pDuplicateSurface7, "DuplicateSurface(D7)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 32), extEnumDisplayModes7, (void **)&pEnumDisplayModes7, "EnumDisplayModes(D4)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 40), extFlipToGDISurface7, (void **)&pFlipToGDISurface7, "FlipToGDISurface(D7)");
|
||||
SetHook((void *)(**(DWORD **)lplpdd + 44), extGetCaps7D, (void **)&pGetCaps7D, "GetCaps(D7)");
|
||||
@ -1835,18 +1848,21 @@ HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *lpguid,
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI extInitialize(Initialize_Type pInitialize, LPDIRECTDRAW lpdd, GUID FAR *lpguid)
|
||||
static HRESULT WINAPI extInitialize(int dxversion, Initialize_Type pInitialize, LPDIRECTDRAW lpdd, GUID FAR *lpguid)
|
||||
{
|
||||
HRESULT res;
|
||||
GUID FAR *lpPrivGuid = lpguid;
|
||||
|
||||
OutTraceDDRAW("Initialize: lpdd=%x guid=%x(%s)\n", lpdd, lpguid, ExplainGUID(lpguid));
|
||||
OutTraceDDRAW("Initialize(%d): lpdd=%x guid=%x(%s)\n", dxversion, lpdd, lpguid, ExplainGUID(lpguid));
|
||||
|
||||
if((dxw.dwFlags3 & FORCESHEL) && (lpguid==NULL)) lpPrivGuid=(GUID FAR *)DDCREATE_EMULATIONONLY;
|
||||
|
||||
res=(*pInitialize)(lpdd, lpPrivGuid);
|
||||
|
||||
if(res == DDERR_ALREADYINITIALIZED) res=DD_OK; // v2.03.18: this error could be caused by the CoCreateInstance implementation
|
||||
if(res == DDERR_ALREADYINITIALIZED) {
|
||||
OutTrace("Initialize: SKIP DDERR_ALREADYINITIALIZED error\n");
|
||||
res=DD_OK; // v2.03.18: this error could be caused by the CoCreateInstance implementation
|
||||
}
|
||||
if(dxw.dwFlags3 & COLORFIX) (((DDRAWI_DIRECTDRAW_INT *)lpdd))->lpLcl->dwAppHackFlags |= 0x800;
|
||||
if(res) OutTraceE("Initialize ERROR: res=%x(%s)\n", res, ExplainDDError(res));
|
||||
|
||||
@ -1854,15 +1870,15 @@ static HRESULT WINAPI extInitialize(Initialize_Type pInitialize, LPDIRECTDRAW lp
|
||||
}
|
||||
|
||||
HRESULT WINAPI extInitialize1(LPDIRECTDRAW lpdd, GUID FAR *lpguid)
|
||||
{ return extInitialize(pInitialize1, lpdd, lpguid); }
|
||||
{ return extInitialize(1, pInitialize1, lpdd, lpguid); }
|
||||
HRESULT WINAPI extInitialize2(LPDIRECTDRAW lpdd, GUID FAR *lpguid)
|
||||
{ return extInitialize(pInitialize2, lpdd, lpguid); }
|
||||
{ return extInitialize(2, pInitialize2, lpdd, lpguid); }
|
||||
HRESULT WINAPI extInitialize3(LPDIRECTDRAW lpdd, GUID FAR *lpguid)
|
||||
{ return extInitialize(pInitialize3, lpdd, lpguid); }
|
||||
{ return extInitialize(3, pInitialize3, lpdd, lpguid); }
|
||||
HRESULT WINAPI extInitialize4(LPDIRECTDRAW lpdd, GUID FAR *lpguid)
|
||||
{ return extInitialize(pInitialize4, lpdd, lpguid); }
|
||||
{ return extInitialize(4, pInitialize4, lpdd, lpguid); }
|
||||
HRESULT WINAPI extInitialize7(LPDIRECTDRAW lpdd, GUID FAR *lpguid)
|
||||
{ return extInitialize(pInitialize7, lpdd, lpguid); }
|
||||
{ return extInitialize(7, pInitialize7, lpdd, lpguid); }
|
||||
|
||||
static HRESULT WINAPI extRestoreDisplayMode(int dxversion, RestoreDisplayMode_Type pRestoreDisplayMode, LPDIRECTDRAW lpdd)
|
||||
{
|
||||
@ -2203,7 +2219,7 @@ HRESULT WINAPI extSetDisplayMode(int dxversion, LPDIRECTDRAW lpdd,
|
||||
char sInfo[81];
|
||||
strcpy(sInfo, "");
|
||||
if (dxversion>=4) sprintf(sInfo, " dwRefresh=%i dwFlags=%x", dwrefreshrate, dwflags);
|
||||
OutTrace("SetDisplayMode: version=%d dwWidth=%i dwHeight=%i dwBPP=%i%s\n",
|
||||
OutTrace("SetDisplayMode(%d): dwWidth=%i dwHeight=%i dwBPP=%i%s\n",
|
||||
dxversion, dwwidth, dwheight, dwbpp, sInfo);
|
||||
}
|
||||
|
||||
@ -2625,6 +2641,9 @@ HRESULT WINAPI extGetAttachedSurface(int dxversion, GetAttachedSurface_Type pGet
|
||||
OutTraceDW("GetAttachedSurface(%d): NOHALDEVICE no attached ZBUFFER\n", dxversion);
|
||||
return DDERR_NOTFOUND;
|
||||
}
|
||||
|
||||
// attempt to fix S.C.A.R.S. black screen bug ... failed
|
||||
//if(lpddsc->dwCaps == (DDSCAPS_TEXTURE|DDSCAPS_MIPMAP)) lpddsc->dwCaps = DDSCAPS_TEXTURE;
|
||||
}
|
||||
else {
|
||||
// Virtual primary surfaces are created with no DDSCAPS_3DDEVICE caps, so don't look for it ....
|
||||
@ -3138,7 +3157,7 @@ HRESULT WINAPI extFlip(int dxversion, Flip_Type pFlip, LPDIRECTDRAWSURFACE lpdds
|
||||
|
||||
bEmulatedFlip = dxw.Windowize || dxw.IsEmulated;
|
||||
IsPrim=dxwss.IsAPrimarySurface(lpdds);
|
||||
OutTraceDDRAW("Flip(%d): %s lpdds=%x%s, src=%x, flags=%x(%s) version=%d\n",
|
||||
OutTraceDDRAW("Flip(%d): %s lpdds=%x%s, src=%x, flags=%x(%s)\n",
|
||||
dxversion, bEmulatedFlip?"EMULATED":"GENUINE",
|
||||
lpdds, IsPrim?"(PRIM)":"", lpddssrc, dwflags, ExplainFlipFlags(dwflags));
|
||||
|
||||
@ -3985,20 +4004,18 @@ static HRESULT WINAPI extUnlock(int dxversion, Unlock4_Type pUnlock, LPDIRECTDRA
|
||||
}
|
||||
|
||||
res=(*pUnlock)(lpdds, lprect);
|
||||
if(res==DDERR_NOTLOCKED) res=DD_OK; // ignore not locked error
|
||||
if (IsPrim && res==DD_OK) {
|
||||
if(dxversion < 4) lprect=NULL; // v2.03.60
|
||||
res=sBlt(dxversion, pBlt, "Unlock", lpdds, lprect, lpdds, lprect, NULL, 0, FALSE);
|
||||
}
|
||||
if(res==DDERR_NOTLOCKED) res=DD_OK; // ignore not locked error
|
||||
if (res) OutTraceE("Unlock ERROR res=%x(%s) at %d\n",res, ExplainDDError(res), __LINE__);
|
||||
|
||||
if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=DD_OK;
|
||||
|
||||
if((dxw.dwFlags5 & TEXTUREMASK) && (!IsPrim)) {
|
||||
// Texture Handling on Unlock
|
||||
TextureHandling(lpdds, dxversion);
|
||||
}
|
||||
|
||||
OutTraceB("Unlock OK\n");
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -4091,8 +4108,16 @@ static HRESULT WINAPI extUnlockDir(int dxversion, Unlock4_Type pUnlock, LPDIRECT
|
||||
res=(*pUnlock)(lpdds, lprect);
|
||||
if(res==DDERR_NOTLOCKED) res=DD_OK; // ignore not locked error
|
||||
if (res) OutTraceE("Unlock ERROR res=%x(%s) at %d\n",res, ExplainDDError(res), __LINE__);
|
||||
if (IsPrim && res==DD_OK) sBlt(dxversion, pBlt, "Unlock", lpdds, NULL, lpdds, NULL, NULL, 0, FALSE);
|
||||
if (IsPrim && res==DD_OK) {
|
||||
if(dxversion < 4) lprect=NULL; // v2.03.60
|
||||
res=sBlt(dxversion, pBlt, "Unlock", lpdds, lprect, lpdds, lprect, NULL, 0, FALSE);
|
||||
}
|
||||
if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=DD_OK;
|
||||
if((dxw.dwFlags5 & TEXTUREMASK) && (!IsPrim)) {
|
||||
// Texture Handling on Unlock
|
||||
TextureHandling(lpdds, dxversion);
|
||||
}
|
||||
OutTraceB("Unlock OK\n");
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -4603,6 +4628,7 @@ static HRESULT WINAPI extSetColorKey(SetColorKey_Type pSetColorKey, LPDIRECTDRAW
|
||||
res=(*pSetColorKey)(lpdds, flags, lpDDColorKey);
|
||||
if(res) OutTraceE("SetColorKey: ERROR flags=%x lpdds=%x res=%x(%s)\n",
|
||||
flags, lpdds, res, ExplainDDError(res));
|
||||
if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=DD_OK;
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -4617,32 +4643,33 @@ HRESULT WINAPI extSetColorKey4(LPDIRECTDRAWSURFACE lpdds, DWORD flags, LPDDCOLOR
|
||||
HRESULT WINAPI extSetColorKey7(LPDIRECTDRAWSURFACE lpdds, DWORD flags, LPDDCOLORKEY lpDDColorKey)
|
||||
{ return extSetColorKey(pSetColorKey7, lpdds, flags, lpDDColorKey); }
|
||||
|
||||
static HRESULT WINAPI extGetColorKey(GetColorKey_Type pGetColorKey, LPDIRECTDRAWSURFACE lpdds, DWORD flags, LPDDCOLORKEY lpDDColorKey)
|
||||
static HRESULT WINAPI extGetColorKey(int dxversion, GetColorKey_Type pGetColorKey, LPDIRECTDRAWSURFACE lpdds, DWORD flags, LPDDCOLORKEY lpDDColorKey)
|
||||
{
|
||||
HRESULT res;
|
||||
BOOL IsPrim;
|
||||
IsPrim=dxwss.IsAPrimarySurface(lpdds);
|
||||
OutTraceDDRAW("GetColorKey(S): lpdds=%x%s flags=%x(%s)\n",
|
||||
lpdds, (IsPrim ? "(PRIM)" : ""), flags, ExplainColorKeyFlag(flags));
|
||||
OutTraceDDRAW("GetColorKey(S%d): lpdds=%x%s flags=%x(%s)\n",
|
||||
dxversion, lpdds, (IsPrim ? "(PRIM)" : ""), flags, ExplainColorKeyFlag(flags));
|
||||
res=(*pGetColorKey)(lpdds, flags, lpDDColorKey);
|
||||
if(res)
|
||||
OutTraceE("GetColorKey: ERROR lpdds=%x flags=%x res=%x(%s)\n", lpdds, flags, res, ExplainDDError(res));
|
||||
else
|
||||
OutTraceDDRAW("GetColorKey: colors=(L:%x,H:%x)\n",
|
||||
lpDDColorKey->dwColorSpaceLowValue, lpDDColorKey->dwColorSpaceHighValue);
|
||||
if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=DD_OK;
|
||||
return res;
|
||||
}
|
||||
|
||||
HRESULT WINAPI extGetColorKey1(LPDIRECTDRAWSURFACE lpdds, DWORD flags, LPDDCOLORKEY lpDDColorKey)
|
||||
{ return extGetColorKey(pGetColorKey1, lpdds, flags, lpDDColorKey); }
|
||||
{ return extGetColorKey(1, pGetColorKey1, lpdds, flags, lpDDColorKey); }
|
||||
HRESULT WINAPI extGetColorKey2(LPDIRECTDRAWSURFACE lpdds, DWORD flags, LPDDCOLORKEY lpDDColorKey)
|
||||
{ return extGetColorKey(pGetColorKey2, lpdds, flags, lpDDColorKey); }
|
||||
{ return extGetColorKey(2, pGetColorKey2, lpdds, flags, lpDDColorKey); }
|
||||
HRESULT WINAPI extGetColorKey3(LPDIRECTDRAWSURFACE lpdds, DWORD flags, LPDDCOLORKEY lpDDColorKey)
|
||||
{ return extGetColorKey(pGetColorKey3, lpdds, flags, lpDDColorKey); }
|
||||
{ return extGetColorKey(3, pGetColorKey3, lpdds, flags, lpDDColorKey); }
|
||||
HRESULT WINAPI extGetColorKey4(LPDIRECTDRAWSURFACE lpdds, DWORD flags, LPDDCOLORKEY lpDDColorKey)
|
||||
{ return extGetColorKey(pGetColorKey4, lpdds, flags, lpDDColorKey); }
|
||||
{ return extGetColorKey(4, pGetColorKey4, lpdds, flags, lpDDColorKey); }
|
||||
HRESULT WINAPI extGetColorKey7(LPDIRECTDRAWSURFACE lpdds, DWORD flags, LPDDCOLORKEY lpDDColorKey)
|
||||
{ return extGetColorKey(pGetColorKey7, lpdds, flags, lpDDColorKey); }
|
||||
{ return extGetColorKey(7, pGetColorKey7, lpdds, flags, lpDDColorKey); }
|
||||
|
||||
static HRESULT WINAPI extEnumAttachedSurfaces(EnumAttachedSurfaces_Type pEnumAttachedSurfaces, LPDIRECTDRAWSURFACE lpdds, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback)
|
||||
{
|
||||
@ -4858,6 +4885,7 @@ static HRESULT WINAPI extGetCapsS(int dxInterface, GetCapsS_Type pGetCapsS, LPDI
|
||||
}
|
||||
|
||||
if(IsFixed) OutTraceDW("GetCaps(S%d): lpdds=%x FIXED %s caps=%x(%s)\n", dxInterface, lpdds, sLabel, caps->dwCaps, ExplainDDSCaps(caps->dwCaps));
|
||||
//if(IsDebug) HexTrace((unsigned char *)caps, sizeof(DDSCAPS));
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -4947,6 +4975,7 @@ static HRESULT WINAPI extGetSurfaceDesc(int dxversion, GetSurfaceDesc_Type pGetS
|
||||
|
||||
if(IsFixed){
|
||||
OutTraceDW("GetSurfaceDesc: FIXED lpdds=%x %s\n", lpdds, LogSurfaceAttributes(lpddsd, sLabel, __LINE__));
|
||||
//if(IsDebug) HexTrace((unsigned char *)lpddsd, sizeof(DDSURFACEDESC));
|
||||
}
|
||||
|
||||
return DD_OK;
|
||||
@ -5478,3 +5507,26 @@ HRESULT WINAPI extCompact(LPDIRECTDRAW lpdd)
|
||||
OutTraceDW("Compact: lpdd=%x\n", lpdd);
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI extDuplicateSurface(int dxversion, DuplicateSurface_Type pDuplicateSurface, LPDIRECTDRAW lpdd, LPDIRECTDRAWSURFACE lpddssrc, LPDIRECTDRAWSURFACE FAR *lpddsdest)
|
||||
{
|
||||
HRESULT res;
|
||||
OutTrace("DuplicateSurface(%d): lpdd=%x lpddsrc=%x\n", dxversion, lpdd, lpddssrc);
|
||||
res = (*pDuplicateSurface)(lpdd, lpddssrc, lpddsdest);
|
||||
if(res)
|
||||
OutTrace("DuplicateSurface: ERROR res=%x(%s)\n", res, ExplainDDError(res));
|
||||
else
|
||||
OutTrace("DuplicateSurface: lpddsdest=%x\n", *lpddsdest);
|
||||
return res;
|
||||
}
|
||||
|
||||
HRESULT WINAPI extDuplicateSurface1(LPDIRECTDRAW lpdd, LPDIRECTDRAWSURFACE lpddssrc, LPDIRECTDRAWSURFACE FAR *lpddsdest)
|
||||
{ return extDuplicateSurface(1, pDuplicateSurface1, lpdd, lpddssrc, lpddsdest); }
|
||||
HRESULT WINAPI extDuplicateSurface2(LPDIRECTDRAW lpdd, LPDIRECTDRAWSURFACE lpddssrc, LPDIRECTDRAWSURFACE FAR *lpddsdest)
|
||||
{ return extDuplicateSurface(2, pDuplicateSurface2, lpdd, lpddssrc, lpddsdest); }
|
||||
HRESULT WINAPI extDuplicateSurface3(LPDIRECTDRAW lpdd, LPDIRECTDRAWSURFACE lpddssrc, LPDIRECTDRAWSURFACE FAR *lpddsdest)
|
||||
{ return extDuplicateSurface(3, pDuplicateSurface3, lpdd, lpddssrc, lpddsdest); }
|
||||
HRESULT WINAPI extDuplicateSurface4(LPDIRECTDRAW lpdd, LPDIRECTDRAWSURFACE4 lpddssrc, LPDIRECTDRAWSURFACE4 FAR *lpddsdest)
|
||||
{ return extDuplicateSurface(4, (DuplicateSurface_Type)pDuplicateSurface4, lpdd, (LPDIRECTDRAWSURFACE)lpddssrc, (LPDIRECTDRAWSURFACE *)lpddsdest); }
|
||||
HRESULT WINAPI extDuplicateSurface7(LPDIRECTDRAW lpdd, LPDIRECTDRAWSURFACE7 lpddssrc, LPDIRECTDRAWSURFACE7 FAR *lpddsdest)
|
||||
{ return extDuplicateSurface(7, (DuplicateSurface_Type)pDuplicateSurface7, lpdd, (LPDIRECTDRAWSURFACE)lpddssrc, (LPDIRECTDRAWSURFACE *)lpddsdest); }
|
||||
|
@ -187,6 +187,7 @@ static void TextureDump(LPDIRECTDRAWSURFACE s, int dxversion)
|
||||
static int MinTexX, MinTexY, MaxTexX, MaxTexY;
|
||||
static BOOL DoOnce = TRUE;
|
||||
char pszFile[MAX_PATH];
|
||||
BOOL IsRaw = (dxw.dwFlags8 & RAWFORMAT);
|
||||
|
||||
OutTraceB("TextureDump(%d): lpdds=%x\n", dxversion, s);
|
||||
|
||||
@ -228,6 +229,10 @@ static void TextureDump(LPDIRECTDRAWSURFACE s, int dxversion)
|
||||
OutTrace("TextureDump: SKIP 0BPP texture\n");
|
||||
break;
|
||||
}
|
||||
if((ddsd.lPitch == 0) || (ddsd.dwHeight == 0)) {
|
||||
OutTrace("TextureDump: SKIP void texture\n");
|
||||
break;
|
||||
}
|
||||
|
||||
iSurfaceSize = ddsd.dwHeight * ddsd.lPitch;
|
||||
|
||||
@ -266,11 +271,18 @@ static void TextureDump(LPDIRECTDRAWSURFACE s, int dxversion)
|
||||
}
|
||||
|
||||
// Create the .BMP file.
|
||||
sprintf_s(pszFile, MAX_PATH, "%s\\texture.out\\texture.%03d.%03d.%s.%08X.bmp",
|
||||
GetDxWndPath(), ddsd.dwWidth, ddsd.dwHeight, SurfaceType(ddsd.ddpfPixelFormat), hash);
|
||||
sprintf_s(pszFile, MAX_PATH, "%s\\texture.out\\texture.%03d.%03d.%s.%08X.%s",
|
||||
GetDxWndPath(), ddsd.dwWidth, ddsd.dwHeight, SurfaceType(ddsd.ddpfPixelFormat),
|
||||
hash, IsRaw ? "raw" : "bmp");
|
||||
hf = fopen(pszFile, "wb");
|
||||
if(!hf) break;
|
||||
|
||||
if(IsRaw){
|
||||
fwrite((BYTE *)ddsd.lpSurface, ddsd.lPitch * ddsd.dwHeight, 1, hf);
|
||||
fclose(hf);
|
||||
return;
|
||||
}
|
||||
|
||||
hdr.bfType = 0x4d42; // 0x42 = "B" 0x4d = "M"
|
||||
// Compute the size of the entire file.
|
||||
hdr.bfSize = (DWORD) (sizeof(BITMAPFILEHEADER) + pbi.bV4Size + pbi.bV4ClrUsed * sizeof(RGBQUAD) + pbi.bV4SizeImage);
|
||||
@ -309,6 +321,7 @@ static void TextureHack(LPDIRECTDRAWSURFACE s, int dxversion)
|
||||
DDSURFACEDESC2 ddsd;
|
||||
int w, h, iSurfaceSize, iScanLineSize;
|
||||
HRESULT res;
|
||||
BOOL IsRaw = (dxw.dwFlags8 & RAWFORMAT);
|
||||
|
||||
OutTraceB("TextureHack(%d): lpdds=%x\n", dxversion, s);
|
||||
|
||||
@ -332,6 +345,26 @@ static void TextureHack(LPDIRECTDRAWSURFACE s, int dxversion)
|
||||
char pszFile[81];
|
||||
int iSizeImage;
|
||||
|
||||
// calculate the bitmap hash
|
||||
DWORD hash;
|
||||
hash = HashSurface((BYTE *)ddsd.lpSurface, ddsd.lPitch, ddsd.dwWidth, ddsd.dwHeight);
|
||||
if(!hash) break; // almost certainly, an empty black surface!
|
||||
|
||||
// Look for the .BMP file.
|
||||
sprintf_s(pszFile, MAX_PATH, "%s\\texture.in\\texture.%03d.%03d.%s.%08X.%s",
|
||||
GetDxWndPath(), ddsd.dwWidth, ddsd.dwHeight, SurfaceType(ddsd.ddpfPixelFormat),
|
||||
hash, IsRaw ? "raw" : "bmp");
|
||||
hf = fopen(pszFile, "rb");
|
||||
if(!hf) break; // no updated texture to load
|
||||
|
||||
OutTrace("TextureHack: IMPORT path=%s\n", pszFile);
|
||||
|
||||
if(IsRaw){
|
||||
fread((BYTE *)ddsd.lpSurface, ddsd.lPitch * ddsd.dwHeight, 1, hf);
|
||||
fclose(hf);
|
||||
return;
|
||||
}
|
||||
|
||||
memset((void *)&pbi, 0, sizeof(BITMAPINFOHEADER));
|
||||
pbi.biSize = sizeof(BITMAPINFOHEADER);
|
||||
pbi.biWidth = ddsd.dwWidth;
|
||||
@ -341,19 +374,6 @@ static void TextureHack(LPDIRECTDRAWSURFACE s, int dxversion)
|
||||
iSizeImage = pbi.biSizeImage;
|
||||
iScanLineSize = ((pbi.biWidth * pbi.biBitCount + 0x1F) & ~0x1F)/8;
|
||||
|
||||
// calculate the bitmap hash
|
||||
DWORD hash;
|
||||
hash = HashSurface((BYTE *)ddsd.lpSurface, ddsd.lPitch, ddsd.dwWidth, ddsd.dwHeight);
|
||||
if(!hash) break; // almost certainly, an empty black surface!
|
||||
|
||||
// Look for the .BMP file.
|
||||
sprintf_s(pszFile, MAX_PATH, "%s\\texture.in\\texture.%03d.%03d.%s.%08X.bmp",
|
||||
GetDxWndPath(), ddsd.dwWidth, ddsd.dwHeight, SurfaceType(ddsd.ddpfPixelFormat), hash);
|
||||
hf = fopen(pszFile, "rb");
|
||||
if(!hf) break; // no updated texture to load
|
||||
|
||||
OutTrace("HASH bmp file %x\n", hf);
|
||||
|
||||
while(TRUE) { // fake loop to ensure final fclose
|
||||
// Read the BITMAPFILEHEADER from the .BMP file (and throw away ...).
|
||||
if(fread((LPVOID)&hdr, sizeof(BITMAPFILEHEADER), 1, hf) != 1)break;
|
||||
|
@ -222,7 +222,7 @@ HRESULT WINAPI extDirectInputCreateA(HINSTANCE hinst, DWORD dwversion, LPDIRECTI
|
||||
{
|
||||
HRESULT res;
|
||||
|
||||
OutTraceDW("DirectInputCreateA: version=%x\n", dwversion);
|
||||
OutTraceDW("DirectInputCreateA(%x)\n", dwversion);
|
||||
|
||||
res = (*pDirectInputCreateA)(hinst, dwversion, lplpdi, pu);
|
||||
if(res) {
|
||||
@ -251,7 +251,7 @@ HRESULT WINAPI extDirectInputCreateW(HINSTANCE hinst, DWORD dwversion, LPDIRECTI
|
||||
{
|
||||
HRESULT res;
|
||||
|
||||
OutTraceDW("DirectInputCreateW: version=%x\n", dwversion);
|
||||
OutTraceDW("DirectInputCreateW(%x)\n", dwversion);
|
||||
|
||||
res = (*pDirectInputCreateW)(hinst, dwversion, lplpdi, pu);
|
||||
if(res) {
|
||||
|
@ -142,7 +142,7 @@ static char *Flag7Names[32]={
|
||||
static char *Flag8Names[32]={
|
||||
"FORCEWAIT", "FORCENOWAIT", "FORCEVSYNC", "FORCENOVSYNC",
|
||||
"VSYNCSCANLINES", "TRIMTEXTUREFORMATS", "NOHALDEVICE", "CLIPLOCK",
|
||||
"", "", "", "",
|
||||
"PRETENDVISIBLE", "RAWFORMAT", "WININSULATION", "FIXMOUSEHOOK",
|
||||
"", "", "", "",
|
||||
"", "", "", "",
|
||||
"", "", "", "",
|
||||
@ -1380,14 +1380,6 @@ void HookInit(TARGETMAP *target, HWND hwnd)
|
||||
SetDllDirectory(sSourcePath);
|
||||
|
||||
if(dxw.bHintActive) ShowHint(HINT_HINT);
|
||||
if(dxw.dwFlags5 & HYBRIDMODE) {
|
||||
// special mode settings ....
|
||||
dxw.dwFlags1 |= EMULATESURFACE;
|
||||
dxw.dwFlags2 |= SETCOMPATIBILITY;
|
||||
dxw.dwFlags5 &= ~(BILINEARFILTER | AEROBOOST);
|
||||
}
|
||||
if(dxw.dwFlags5 & GDIMODE) dxw.dwFlags1 |= EMULATESURFACE;
|
||||
if(dxw.dwFlags5 & STRESSRESOURCES) dxw.dwFlags5 |= LIMITRESOURCES;
|
||||
|
||||
if(DoOnce){
|
||||
DoOnce = FALSE;
|
||||
|
@ -94,7 +94,6 @@ void dxwCore::InitTarget(TARGETMAP *target)
|
||||
dwFlags8 = target->flags8;
|
||||
dwTFlags = target->tflags;
|
||||
Windowize = (dwFlags2 & WINDOWIZE) ? TRUE : FALSE;
|
||||
IsEmulated = (dwFlags1 & (EMULATESURFACE|EMULATEBUFFER)) ? TRUE : FALSE;
|
||||
IsVisible = TRUE;
|
||||
if(dwFlags3 & FULLSCREENONLY) FullScreen=TRUE;
|
||||
gsModules = target->module;
|
||||
@ -151,6 +150,16 @@ void dxwCore::InitTarget(TARGETMAP *target)
|
||||
if (dwFlags3 & GDIEMULATEDC) GDIEmulationMode = GDIMODE_EMULATED;
|
||||
if (dwFlags6 & SHAREDDC) GDIEmulationMode = GDIMODE_SHAREDDC;
|
||||
|
||||
if(dwFlags5 & HYBRIDMODE) {
|
||||
// special mode settings ....
|
||||
dwFlags1 |= EMULATESURFACE;
|
||||
dwFlags2 |= SETCOMPATIBILITY;
|
||||
dwFlags5 &= ~(BILINEARFILTER | AEROBOOST);
|
||||
}
|
||||
if(dwFlags5 & GDIMODE) dwFlags1 |= EMULATESURFACE;
|
||||
if(dwFlags5 & STRESSRESOURCES) dwFlags5 |= LIMITRESOURCES;
|
||||
IsEmulated = (dwFlags1 & (EMULATESURFACE|EMULATEBUFFER)) ? TRUE : FALSE; // includes also the HYBRIDMODE and GDIMODE cases ....
|
||||
|
||||
extern GetWindowLong_Type pGetWindowLong;
|
||||
extern SetWindowLong_Type pSetWindowLong;
|
||||
// made before hooking !!!
|
||||
|
BIN
dll/dxwnd.aps
BIN
dll/dxwnd.aps
Binary file not shown.
@ -27,10 +27,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "TlHelp32.h"
|
||||
|
||||
#define VERSION "2.03.99.fx3"
|
||||
#define VERSION "2.03.40"
|
||||
|
||||
#define DDTHREADLOCK 1
|
||||
//#define LOCKTHREADS
|
||||
|
||||
LRESULT CALLBACK HookProc(int ncode, WPARAM wparam, LPARAM lparam);
|
||||
|
||||
|
BIN
dll/dxwnd.vs2008.suo
Normal file
BIN
dll/dxwnd.vs2008.suo
Normal file
Binary file not shown.
@ -598,6 +598,10 @@
|
||||
RelativePath=".\smack.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stb_dxt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\syslibs.h"
|
||||
>
|
||||
|
@ -698,7 +698,7 @@ HRESULT WINAPI extQueryInterfaceD3(int d3dversion, QueryInterfaceD3_Type pQueryI
|
||||
HRESULT res;
|
||||
|
||||
OutTraceD3D("QueryInterfaceD3(%d): d3d=%x REFIID=%x obj=%x\n", d3dversion, lpd3d, riid.Data1, ppvObj);
|
||||
d3dversion=0;
|
||||
//d3dversion=0;
|
||||
res=(*pQueryInterfaceD3)(lpd3d, riid, ppvObj);
|
||||
//switch(riid.Data1){
|
||||
// case 0x3BBA0080: d3dversion=1; break;
|
||||
|
@ -26,6 +26,9 @@ typedef HRESULT (WINAPI *CreatePalette_Type)(LPDIRECTDRAW, DWORD, LPPALETTEENTRY
|
||||
typedef HRESULT (WINAPI *CreateSurface1_Type)(LPDIRECTDRAW, DDSURFACEDESC *, LPDIRECTDRAWSURFACE *, void *);
|
||||
typedef HRESULT (WINAPI *CreateSurface2_Type)(LPDIRECTDRAW, DDSURFACEDESC2 *, LPDIRECTDRAWSURFACE *, void *);
|
||||
typedef HRESULT (WINAPI *CreateSurface_Type)(LPDIRECTDRAW, DDSURFACEDESC2 *, LPDIRECTDRAWSURFACE *, void *);
|
||||
typedef HRESULT (WINAPI *DuplicateSurface_Type)(LPDIRECTDRAW, LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE FAR *);
|
||||
typedef HRESULT (WINAPI *DuplicateSurface4_Type)(LPDIRECTDRAW, LPDIRECTDRAWSURFACE4, LPDIRECTDRAWSURFACE4 FAR *);
|
||||
typedef HRESULT (WINAPI *DuplicateSurface7_Type)(LPDIRECTDRAW, LPDIRECTDRAWSURFACE7, LPDIRECTDRAWSURFACE7 FAR *);
|
||||
typedef HRESULT (WINAPI *EnumDisplayModes1_Type)(LPDIRECTDRAW, DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK);
|
||||
typedef HRESULT (WINAPI *EnumDisplayModes4_Type)(LPDIRECTDRAW, DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMMODESCALLBACK2);
|
||||
typedef HRESULT (WINAPI *EnumSurfaces1_Type)(LPDIRECTDRAW, DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMSURFACESCALLBACK);
|
||||
|
1043
dll/stb_dxt.h
Normal file
1043
dll/stb_dxt.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -13,6 +13,7 @@
|
||||
#include "dxhelper.h"
|
||||
#include "shareddc.hpp"
|
||||
#include <Wingdi.h>
|
||||
#include <Winuser.h>
|
||||
|
||||
#define FIXCHILDSIZE FALSE
|
||||
|
||||
@ -139,6 +140,9 @@ HWND WINAPI extSetFocus(HWND);
|
||||
typedef HBITMAP (WINAPI *LoadBitmapA_Type)(HINSTANCE, LPCSTR);
|
||||
LoadBitmapA_Type pLoadBitmapA;
|
||||
HBITMAP WINAPI extLoadBitmapA(HINSTANCE, LPCSTR);
|
||||
typedef BOOL (WINAPI *EnumWindows_Type)(WNDENUMPROC, LPARAM);
|
||||
EnumWindows_Type pEnumWindows;
|
||||
BOOL WINAPI extEnumWindows(WNDENUMPROC, LPARAM);
|
||||
|
||||
|
||||
|
||||
@ -248,7 +252,9 @@ static HookEntryEx_Type Hooks[]={
|
||||
{HOOK_HOT_CANDIDATE, 0, "EnumDisplayDevicesW", (FARPROC)EnumDisplayDevicesW, (FARPROC *)&pEnumDisplayDevicesW, (FARPROC)extEnumDisplayDevicesW},
|
||||
|
||||
//{HOOK_IAT_CANDIDATE, 0, "LoadBitmapA", (FARPROC)NULL, (FARPROC *)&pLoadBitmapA, (FARPROC)extLoadBitmapA},
|
||||
|
||||
|
||||
{HOOK_IAT_CANDIDATE, 0, "EnumWindows", (FARPROC)NULL, (FARPROC *)&pEnumWindows, (FARPROC)extEnumWindows},
|
||||
|
||||
{HOOK_IAT_CANDIDATE, 0, 0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
@ -3633,6 +3639,7 @@ LRESULT CALLBACK extMouseHookProc(int code, WPARAM wParam, LPARAM lParam)
|
||||
*/
|
||||
|
||||
HOOKPROC glpMessageHookProcessFunction;
|
||||
HOOKPROC glpMouseHookProcessFunction;
|
||||
|
||||
LRESULT CALLBACK extMessageHookProc(int code, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
@ -3651,6 +3658,19 @@ LRESULT CALLBACK extMessageHookProc(int code, WPARAM wParam, LPARAM lParam)
|
||||
return ret;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK extMouseHookProc(int code, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LRESULT ret;
|
||||
OutTraceC("MouseHookProc: code=%x wParam=%x lParam=%x\n", code, wParam, lParam);
|
||||
MOUSEHOOKSTRUCT *pMouseStruct = (MOUSEHOOKSTRUCT *)lParam;
|
||||
if (pMouseStruct != NULL){
|
||||
OutTraceC("MouseHookProc: event=%s pos=(%d,%d)\n", ExplainWinMessage(wParam), pMouseStruct->pt.x, pMouseStruct->pt.y);
|
||||
extGetCursorPos(&(pMouseStruct->pt));
|
||||
}
|
||||
ret = (*glpMouseHookProcessFunction)(code, wParam, lParam);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static HHOOK WINAPI extSetWindowsHookEx(SetWindowsHookEx_Type pSetWindowsHookEx, int idHook, HOOKPROC lpfn, HINSTANCE hMod, DWORD dwThreadId)
|
||||
{
|
||||
HHOOK ret;
|
||||
@ -3677,6 +3697,12 @@ static HHOOK WINAPI extSetWindowsHookEx(SetWindowsHookEx_Type pSetWindowsHookEx,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if((dxw.dwFlags8 & FIXMOUSEHOOK) && (idHook == WH_MOUSE)){
|
||||
OutTraceDW("SetWindowsHookEx: FIXMOUSEHOOK filter active\n");
|
||||
glpMouseHookProcessFunction = lpfn;
|
||||
lpfn=extMouseHookProc;
|
||||
}
|
||||
|
||||
ret=(*pSetWindowsHookEx)(idHook, lpfn, hMod, dwThreadId);
|
||||
|
||||
return ret;
|
||||
@ -4083,6 +4109,16 @@ HBITMAP WINAPI extLoadBitmapA(HINSTANCE hInstance, LPCSTR lpBitmapName)
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI extEnumWindows(WNDENUMPROC lpEnumFunc, LPARAM lParam)
|
||||
{
|
||||
OutTrace("EnumerateWindows\n");
|
||||
if(dxw.dwFlags8 & WININSULATION){
|
||||
OutTrace("EnumerateWindows: BYPASS\n");
|
||||
return TRUE;
|
||||
}
|
||||
return (*pEnumWindows)(lpEnumFunc, lParam);
|
||||
}
|
||||
|
||||
// To do:
|
||||
// GrayStringA
|
||||
// GrayStringW
|
@ -42,6 +42,7 @@ void CTabDirect3D::DoDataExchange(CDataExchange* pDX)
|
||||
|
||||
// Texture management
|
||||
DDX_Radio(pDX, IDC_TEXTURENONE, cTarget->m_TextureHandling);
|
||||
DDX_Check(pDX, IDC_RAWFORMAT, cTarget->m_RawFormat);
|
||||
|
||||
// 3D Effects
|
||||
DDX_Check(pDX, IDC_NOTEXTURES, cTarget->m_NoTextures);
|
||||
|
@ -36,7 +36,7 @@ void CTabInput::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Check(pDX, IDC_KEEPCURSORWITHIN, cTarget->m_KeepCursorWithin);
|
||||
DDX_Check(pDX, IDC_KEEPCURSORFIXED, cTarget->m_KeepCursorFixed);
|
||||
DDX_Check(pDX, IDC_MESSAGEPROC, cTarget->m_MessageProc);
|
||||
//DDX_Check(pDX, IDC_NOMOUSEPROC, cTarget->m_NoMouseProc);
|
||||
DDX_Check(pDX, IDC_FIXMOUSEHOOK, cTarget->m_FixMouseHook);
|
||||
DDX_Check(pDX, IDC_FIXNCHITTEST, cTarget->m_FixNCHITTEST);
|
||||
DDX_Check(pDX, IDC_SLOW, cTarget->m_SlowDown);
|
||||
DDX_Check(pDX, IDC_RELEASEMOUSE, cTarget->m_ReleaseMouse);
|
||||
|
@ -36,6 +36,7 @@ void CTabSysLibs::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Check(pDX, IDC_SYNCPALETTE, cTarget->m_SyncPalette);
|
||||
DDX_Check(pDX, IDC_NOWINERRORS, cTarget->m_NoWinErrors);
|
||||
DDX_Check(pDX, IDC_PRETENDVISIBLE, cTarget->m_PretendVisible);
|
||||
DDX_Check(pDX, IDC_WININSULATION, cTarget->m_WinInsulation);
|
||||
|
||||
// OpenGL
|
||||
DDX_Check(pDX, IDC_HOOKOPENGL, cTarget->m_HookOpenGL); // duplicated
|
||||
|
@ -60,6 +60,8 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
|
||||
m_SuppressD3DExt = FALSE;
|
||||
m_Enum16bitModes = FALSE;
|
||||
m_TrimTextureFormats = FALSE;
|
||||
m_NoHALDevice = FALSE;
|
||||
m_RawFormat = FALSE;
|
||||
m_SetCompatibility = TRUE; // default true !!
|
||||
m_AEROBoost = TRUE; // default true !!
|
||||
m_DiabloTweak = FALSE;
|
||||
@ -185,10 +187,9 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
|
||||
m_HideMultiMonitor = FALSE;
|
||||
m_FixD3DFrame = FALSE;
|
||||
m_NoWindowMove = FALSE;
|
||||
//m_Force16BPP = FALSE;
|
||||
m_HookChildWin = FALSE;
|
||||
m_MessageProc = FALSE;
|
||||
//m_NoMouseProc = FALSE;
|
||||
m_FixMouseHook = FALSE;
|
||||
m_FixNCHITTEST = FALSE;
|
||||
m_RecoverScreenMode = FALSE;
|
||||
m_RefreshOnResize = FALSE;
|
||||
@ -197,10 +198,6 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
|
||||
m_BackBufAttach = FALSE;
|
||||
m_ClearTextureFourCC = FALSE;
|
||||
m_NoDDExclusiveMode = FALSE;
|
||||
//m_ForceVSync = FALSE;
|
||||
//m_ForceNoVSync = FALSE;
|
||||
//m_ForceWait = FALSE;
|
||||
//m_ForceNoWait = FALSE;
|
||||
m_VSyncMode = 0;
|
||||
m_VSyncImpl = 0;
|
||||
m_WaitMode = 0;
|
||||
@ -243,6 +240,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
|
||||
m_SyncPalette = FALSE;
|
||||
m_NoWinErrors = FALSE;
|
||||
m_PretendVisible = FALSE;
|
||||
m_WinInsulation = FALSE;
|
||||
m_AnalyticMode = FALSE;
|
||||
m_NoPaletteUpdate = FALSE;
|
||||
m_WireFrame = FALSE;
|
||||
|
@ -148,7 +148,7 @@ public:
|
||||
BOOL m_NoWindowMove;
|
||||
BOOL m_HookChildWin;
|
||||
BOOL m_MessageProc;
|
||||
//BOOL m_NoMouseProc;
|
||||
BOOL m_FixMouseHook;
|
||||
BOOL m_FixNCHITTEST;
|
||||
BOOL m_RecoverScreenMode;
|
||||
BOOL m_RefreshOnResize;
|
||||
@ -201,6 +201,7 @@ public:
|
||||
BOOL m_SyncPalette;
|
||||
BOOL m_NoWinErrors;
|
||||
BOOL m_PretendVisible;
|
||||
BOOL m_WinInsulation;
|
||||
BOOL m_AnalyticMode;
|
||||
BOOL m_NoPaletteUpdate;
|
||||
BOOL m_LimitResources;
|
||||
@ -263,6 +264,7 @@ public:
|
||||
BOOL m_SuppressD3DExt;
|
||||
BOOL m_Enum16bitModes;
|
||||
BOOL m_TrimTextureFormats;
|
||||
BOOL m_RawFormat;
|
||||
BOOL m_LimitScreenRes;
|
||||
BOOL m_InitialRes;
|
||||
BOOL m_MaximumRes;
|
||||
|
@ -31,9 +31,12 @@ BOOL DxSelfElevate(CDxwndhostView *view)
|
||||
{
|
||||
// Launch itself as administrator.
|
||||
SHELLEXECUTEINFO sei = { sizeof(sei) };
|
||||
char CurrentDir[MAX_PATH+1];
|
||||
CString args;
|
||||
sei.lpVerb = "runas";
|
||||
sei.lpFile = szPath;
|
||||
::GetCurrentDirectory(MAX_PATH, CurrentDir);
|
||||
sei.lpDirectory = CurrentDir;
|
||||
//sei.hwnd = (HWND)this->GetMainWnd();
|
||||
sei.hwnd = (HWND)NULL; // set to NULL to force the confirmation dialog on top of everything...
|
||||
sei.nShow = SW_NORMAL;
|
||||
|
BIN
host/dxwndhost.aps
Normal file
BIN
host/dxwndhost.aps
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -222,7 +222,6 @@ void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
|
||||
if(dlg->m_HotPatch) t->flags4 |= HOTPATCH;
|
||||
if(dlg->m_FullScreenOnly) t->flags3 |= FULLSCREENONLY;
|
||||
if(dlg->m_ShowHints) t->flags7 |= SHOWHINTS;
|
||||
//if(dlg->m_FilterMessages) t->flags3 |= FILTERMESSAGES;
|
||||
if(dlg->m_PeekAllMessages) t->flags3 |= PEEKALLMESSAGES;
|
||||
if(dlg->m_NoWinPosChanges) t->flags5 |= NOWINPOSCHANGES;
|
||||
if(dlg->m_MessagePump) t->flags5 |= MESSAGEPUMP;
|
||||
@ -234,7 +233,6 @@ void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
|
||||
}
|
||||
|
||||
switch(dlg->m_DxEmulationMode){
|
||||
//case 0: t->flags |= AUTOMATIC; break;
|
||||
case 0: break;
|
||||
case 1: t->flags |= EMULATEBUFFER; break;
|
||||
case 2: t->flags |= LOCKEDSURFACE; break;
|
||||
@ -262,7 +260,6 @@ void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
|
||||
case 1: t->flags2 |= GDISTRETCHED; break;
|
||||
case 2: t->flags3 |= GDIEMULATEDC; break;
|
||||
case 3: t->flags6 |= SHAREDDC; break;
|
||||
//case 3: t->flags |= MAPGDITOPRIMARY; break;
|
||||
}
|
||||
|
||||
switch(dlg->m_ResTypes){
|
||||
@ -353,7 +350,6 @@ void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
|
||||
if(dlg->m_OutDebug) t->tflags |= OUTDEBUG;
|
||||
if(dlg->m_CursorTrace) t->tflags |= OUTCURSORTRACE;
|
||||
if(dlg->m_OutDebugString) t->tflags |= OUTDEBUGSTRING;
|
||||
//if(dlg->m_EraseLogFile) t->tflags |= ERASELOGFILE;
|
||||
if(dlg->m_AddTimeStamp) t->tflags |= ADDTIMESTAMP;
|
||||
if(dlg->m_AddRelativeTime) t->tflags |= ADDRELATIVETIME;
|
||||
if(dlg->m_OutWinMessages) t->tflags |= OUTWINMESSAGES;
|
||||
@ -388,6 +384,7 @@ void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
|
||||
if(dlg->m_SuppressD3DExt) t->flags3 |= SUPPRESSD3DEXT;
|
||||
if(dlg->m_Enum16bitModes) t->flags7 |= ENUM16BITMODES;
|
||||
if(dlg->m_TrimTextureFormats) t->flags8 |= TRIMTEXTUREFORMATS;
|
||||
if(dlg->m_RawFormat) t->flags8 |= RAWFORMAT;
|
||||
if(dlg->m_SetCompatibility) t->flags2 |= SETCOMPATIBILITY;
|
||||
if(dlg->m_AEROBoost) t->flags5 |= AEROBOOST;
|
||||
if(dlg->m_DiabloTweak) t->flags5 |= DIABLOTWEAK;
|
||||
@ -423,20 +420,15 @@ void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
|
||||
if(dlg->m_LimitScreenRes) t->flags4 |= LIMITSCREENRES;
|
||||
if(dlg->m_SingleProcAffinity) t->flags3 |= SINGLEPROCAFFINITY;
|
||||
if(dlg->m_UseLastCore) t->flags5 |= USELASTCORE;
|
||||
//if(dlg->m_SaveLoad) t->flags |= SAVELOAD;
|
||||
if(dlg->m_SlowDown) t->flags |= SLOWDOWN;
|
||||
if(dlg->m_BlitFromBackBuffer) t->flags |= BLITFROMBACKBUFFER;
|
||||
if(dlg->m_NoFlipEmulation) t->flags4 |= NOFLIPEMULATION;
|
||||
if(dlg->m_LockColorDepth) t->flags7 |= LOCKCOLORDEPTH;
|
||||
//if(dlg->m_SuppressClipping) t->flags |= SUPPRESSCLIPPING;
|
||||
//if(dlg->m_ForceClipper) t->flags3 |= FORCECLIPPER;
|
||||
if(dlg->m_DisableGammaRamp) t->flags2 |= DISABLEGAMMARAMP;
|
||||
if(dlg->m_AutoRefresh) t->flags |= AUTOREFRESH;
|
||||
if(dlg->m_IndependentRefresh) t->flags2 |= INDEPENDENTREFRESH;
|
||||
if(dlg->m_TextureFormat) t->flags5 |= TEXTUREFORMAT;
|
||||
if(dlg->m_FixWinFrame) t->flags |= FIXWINFRAME;
|
||||
//if(dlg->m_EnableClipping) t->flags |= DISABLECLIPPING;
|
||||
//if(dlg->m_CursorClipping) t->flags |= CLIPCURSOR;
|
||||
if(dlg->m_VideoToSystemMem) t->flags |= SWITCHVIDEOMEMORY;
|
||||
if(dlg->m_FixTextOut) t->flags |= FIXTEXTOUT;
|
||||
if(dlg->m_HookGlide) t->flags4 |= HOOKGLIDE;
|
||||
@ -468,15 +460,12 @@ void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
|
||||
if(dlg->m_HideMultiMonitor) t->flags2 |= HIDEMULTIMONITOR;
|
||||
if(dlg->m_FixD3DFrame) t->flags3 |= FIXD3DFRAME;
|
||||
if(dlg->m_NoWindowMove) t->flags3 |= NOWINDOWMOVE;
|
||||
//if(dlg->m_Force16BPP) t->flags3 |= FORCE16BPP;
|
||||
if(dlg->m_HookChildWin) t->flags |= HOOKCHILDWIN;
|
||||
if(dlg->m_MessageProc) t->flags |= MESSAGEPROC;
|
||||
//if(dlg->m_NoMouseProc) t->flags6 |= NOMOUSEPROC;
|
||||
if(dlg->m_FixMouseHook) t->flags8 |= FIXMOUSEHOOK;
|
||||
if(dlg->m_FixNCHITTEST) t->flags2 |= FIXNCHITTEST;
|
||||
if(dlg->m_RecoverScreenMode) t->flags2 |= RECOVERSCREENMODE;
|
||||
if(dlg->m_RefreshOnResize) t->flags2 |= REFRESHONRESIZE;
|
||||
//if(dlg->m_Init8BPP) t->flags2 |= INIT8BPP;
|
||||
//if(dlg->m_Init16BPP) t->flags2 |= INIT16BPP;
|
||||
if(dlg->m_BackBufAttach) t->flags2 |= BACKBUFATTACH;
|
||||
if(dlg->m_ClearTextureFourCC) t->flags7 |= CLEARTEXTUREFOURCC;
|
||||
if(dlg->m_NoDDExclusiveMode) t->flags7 |= NODDEXCLUSIVEMODE;
|
||||
@ -523,14 +512,11 @@ void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
|
||||
if(dlg->m_SyncPalette) t->flags6 |= SYNCPALETTE;
|
||||
if(dlg->m_NoWinErrors) t->flags7 |= NOWINERRORS;
|
||||
if(dlg->m_PretendVisible) t->flags8 |= PRETENDVISIBLE;
|
||||
if(dlg->m_WinInsulation) t->flags8 |= WININSULATION;
|
||||
if(dlg->m_AnalyticMode) t->flags3 |= ANALYTICMODE;
|
||||
if(dlg->m_ReplacePrivOps) t->flags5 |= REPLACEPRIVOPS;
|
||||
if(dlg->m_InitialRes) t->flags7 |= INITIALRES;
|
||||
if(dlg->m_MaximumRes) t->flags7 |= MAXIMUMRES;
|
||||
//if(dlg->m_ForceVSync) t->flags8 |= FORCEVSYNC;
|
||||
//if(dlg->m_ForceNoVSync) t->flags8 |= FORCENOVSYNC;
|
||||
//if(dlg->m_ForceWait) t->flags8 |= FORCEWAIT;
|
||||
//if(dlg->m_ForceNoWait) t->flags8 |= FORCENOWAIT;
|
||||
t->posx = dlg->m_PosX;
|
||||
t->posy = dlg->m_PosY;
|
||||
t->sizx = dlg->m_SizX;
|
||||
@ -577,7 +563,6 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
|
||||
dlg->m_NoBanner = t->flags2 & NOBANNER ? 1 : 0;
|
||||
dlg->m_FullScreenOnly = t->flags3 & FULLSCREENONLY ? 1 : 0;
|
||||
dlg->m_ShowHints = t->flags7 & SHOWHINTS ? 1 : 0;
|
||||
//dlg->m_FilterMessages = t->flags3 & FILTERMESSAGES ? 1 : 0;
|
||||
dlg->m_PeekAllMessages = t->flags3 & PEEKALLMESSAGES ? 1 : 0;
|
||||
dlg->m_NoWinPosChanges = t->flags5 & NOWINPOSCHANGES ? 1 : 0;
|
||||
dlg->m_MessagePump = t->flags5 & MESSAGEPUMP ? 1 : 0;
|
||||
@ -601,7 +586,6 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
|
||||
if(t->flags2 & GDISTRETCHED) dlg->m_DCEmulationMode = 1;
|
||||
if(t->flags3 & GDIEMULATEDC) dlg->m_DCEmulationMode = 2;
|
||||
if(t->flags6 & SHAREDDC ) dlg->m_DCEmulationMode = 3;
|
||||
//if(t->flags & MAPGDITOPRIMARY) dlg->m_DCEmulationMode = 3;
|
||||
|
||||
dlg->m_ResTypes = 0;
|
||||
if(t->flags4 & SUPPORTSVGA) dlg->m_ResTypes = 0;
|
||||
@ -690,6 +674,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
|
||||
dlg->m_SuppressD3DExt = t->flags3 & SUPPRESSD3DEXT ? 1 : 0;
|
||||
dlg->m_Enum16bitModes = t->flags7 & ENUM16BITMODES ? 1 : 0;
|
||||
dlg->m_TrimTextureFormats = t->flags8 & TRIMTEXTUREFORMATS ? 1 : 0;
|
||||
dlg->m_RawFormat = t->flags8 & RAWFORMAT ? 1 : 0;
|
||||
dlg->m_SetCompatibility = t->flags2 & SETCOMPATIBILITY ? 1 : 0;
|
||||
dlg->m_AEROBoost = t->flags5 & AEROBOOST ? 1 : 0;
|
||||
dlg->m_DiabloTweak = t->flags5 & DIABLOTWEAK ? 1 : 0;
|
||||
@ -744,20 +729,15 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
|
||||
dlg->m_ClearTarget = t->flags5 & CLEARTARGET ? 1 : 0;
|
||||
dlg->m_FixPitch = t->flags6 & FIXPITCH ? 1 : 0;
|
||||
dlg->m_Power2Width = t->flags6 & POWER2WIDTH ? 1 : 0;
|
||||
//dlg->m_SaveLoad = t->flags & SAVELOAD ? 1 : 0;
|
||||
dlg->m_SlowDown = t->flags & SLOWDOWN ? 1 : 0;
|
||||
dlg->m_BlitFromBackBuffer = t->flags & BLITFROMBACKBUFFER ? 1 : 0;
|
||||
dlg->m_NoFlipEmulation = t->flags4 & NOFLIPEMULATION ? 1 : 0;
|
||||
dlg->m_LockColorDepth = t->flags7 & LOCKCOLORDEPTH ? 1 : 0;
|
||||
// dlg->m_SuppressClipping = t->flags & SUPPRESSCLIPPING ? 1 : 0;
|
||||
// dlg->m_ForceClipper = t->flags3 & FORCECLIPPER ? 1 : 0;
|
||||
dlg->m_DisableGammaRamp = t->flags2 & DISABLEGAMMARAMP ? 1 : 0;
|
||||
dlg->m_AutoRefresh = t->flags & AUTOREFRESH ? 1 : 0;
|
||||
dlg->m_IndependentRefresh = t->flags2 & INDEPENDENTREFRESH ? 1 : 0;
|
||||
dlg->m_TextureFormat = t->flags5 & TEXTUREFORMAT ? 1 : 0;
|
||||
dlg->m_FixWinFrame = t->flags & FIXWINFRAME ? 1 : 0;
|
||||
//dlg->m_EnableClipping = t->flags & DISABLECLIPPING ? 1 : 0;
|
||||
//dlg->m_CursorClipping = t->flags & CLIPCURSOR ? 1 : 0;
|
||||
dlg->m_VideoToSystemMem = t->flags & SWITCHVIDEOMEMORY ? 1 : 0;
|
||||
dlg->m_FixTextOut = t->flags & FIXTEXTOUT ? 1 : 0;
|
||||
dlg->m_SharedDC = t->flags6 & SHAREDDC ? 1 : 0;
|
||||
@ -790,9 +770,9 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
|
||||
dlg->m_HideMultiMonitor = t->flags2 & HIDEMULTIMONITOR ? 1 : 0;
|
||||
dlg->m_FixD3DFrame = t->flags3 & FIXD3DFRAME ? 1 : 0;
|
||||
dlg->m_NoWindowMove = t->flags3 & NOWINDOWMOVE ? 1 : 0;
|
||||
//dlg->m_Force16BPP = t->flags3 & FORCE16BPP ? 1 : 0;
|
||||
dlg->m_HookChildWin = t->flags & HOOKCHILDWIN ? 1 : 0;
|
||||
dlg->m_MessageProc = t->flags & MESSAGEPROC ? 1 : 0;
|
||||
dlg->m_FixMouseHook = t->flags8 & FIXMOUSEHOOK ? 1 : 0;
|
||||
dlg->m_FixNCHITTEST = t->flags2 & FIXNCHITTEST ? 1 : 0;
|
||||
dlg->m_RecoverScreenMode = t->flags2 & RECOVERSCREENMODE ? 1 : 0;
|
||||
dlg->m_RefreshOnResize = t->flags2 & REFRESHONRESIZE ? 1 : 0;
|
||||
@ -842,14 +822,11 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
|
||||
dlg->m_SyncPalette = t->flags6 & SYNCPALETTE ? 1 : 0;
|
||||
dlg->m_NoWinErrors = t->flags7 & NOWINERRORS ? 1 : 0;
|
||||
dlg->m_PretendVisible = t->flags8 & PRETENDVISIBLE ? 1 : 0;
|
||||
dlg->m_WinInsulation = t->flags8 & WININSULATION ? 1 : 0;
|
||||
dlg->m_AnalyticMode = t->flags3 & ANALYTICMODE ? 1 : 0;
|
||||
dlg->m_ReplacePrivOps = t->flags5 & REPLACEPRIVOPS ? 1 : 0;
|
||||
dlg->m_InitialRes = t->flags7 & INITIALRES ? 1 : 0;
|
||||
dlg->m_MaximumRes = t->flags7 & MAXIMUMRES ? 1 : 0;
|
||||
//dlg->m_ForceVSync = t->flags8 & FORCEVSYNC ? 1 : 0;
|
||||
//dlg->m_ForceNoVSync = t->flags8 & FORCENOVSYNC ? 1 : 0;
|
||||
//dlg->m_ForceWait = t->flags8 & FORCEWAIT ? 1 : 0;
|
||||
//dlg->m_ForceNoWait = t->flags8 & FORCENOWAIT ? 1 : 0;
|
||||
dlg->m_PosX = t->posx;
|
||||
dlg->m_PosY = t->posy;
|
||||
dlg->m_SizX = t->sizx;
|
||||
|
BIN
host/resource
BIN
host/resource
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user