mirror of
https://github.com/DxWnd/DxWnd.reloaded
synced 2024-12-30 09:25:35 +01:00
v2_03_37_src
Former-commit-id: 6f33c63743b2ec691fc3002c7ac628f8b7d52ce4
This commit is contained in:
parent
56f19f7c42
commit
899c2bdd08
@ -20,7 +20,7 @@
|
||||
#define HANDLEEXCEPTIONS 0x00000040 // Handles exceptions: Div by 0 ....
|
||||
#define SAVELOAD 0x00000080
|
||||
#define EMULATEBUFFER 0x00000100
|
||||
#define AUTOMATIC 0x00000200
|
||||
// #define AUTOMATIC 0x00000200
|
||||
#define BLITFROMBACKBUFFER 0x00000400
|
||||
#define SUPPRESSCLIPPING 0x00000800
|
||||
#define AUTOREFRESH 0x00001000
|
||||
@ -201,6 +201,8 @@
|
||||
#define SETZBUFFERBITDEPTHS 0x00020000 // when not set, set the legacy dwZBufferBitDepths field in the directdraw capability from GetCaps()
|
||||
#define SHAREDDC 0x00040000 // enable sharing window DC and primary surface DC
|
||||
#define WOW32REGISTRY 0x00080000 // Sets KEY_WOW32_64KEY registry flag
|
||||
#define STRETCHMOVIES 0x00100000 // Stretches ActiveMovie Windows to the whole window size
|
||||
#define BYPASSMCI 0x00200000 // bypass all MCI calls returning OK.
|
||||
|
||||
// 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:f2fe03b12248b3b75bf4e724f83017b2767ac7eaf5f5c25ac2021da81ba9dd23
|
||||
size 585728
|
||||
oid sha256:e0833b7f9d40095e84bf9c7fa9697bed48c0967e153970a8ba9c9aa146ecc554
|
||||
size 587776
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:482a21422742238d783015f22714a6001eac5a1dc38332c53db686dcd086c7c3
|
||||
size 544256
|
||||
oid sha256:99558d172cbd24a33a7c5be255b7dc89f52ff58addce4b330a463d47878a1b70
|
||||
size 544768
|
||||
|
5
build/exports/dxwnd.ini
Normal file
5
build/exports/dxwnd.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[window]
|
||||
posx=1280
|
||||
posy=341
|
||||
sizx=320
|
||||
sizy=200
|
5
build/exports/dxwnd.reg
Normal file
5
build/exports/dxwnd.reg
Normal file
@ -0,0 +1,5 @@
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\MicroProse\Star Trek Generations]
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\MicroProse\Star Trek Generations\1.0]
|
||||
"Path"="D:\\GAMES\\STGEN"
|
||||
"CDPath"="F:\\GENS"
|
||||
"InstallSet"="MED"
|
@ -900,3 +900,14 @@ fix: CreateCompatibleDC hooker printing wrong error messages in normal condition
|
||||
fix: fixed DrawText, DrawTextEx hookers returning wrong RECT structure. Fixes "Star Trek Armada" text placement problems
|
||||
add: completed log messages for DrawTextEx, CreateDialogParam, DialogBoxParam and CreateDialogIndirectParam
|
||||
|
||||
v2.03.37:
|
||||
add: handling of RegEnumValue advapi call in virtual registry. Useful for "Star trek Generations"
|
||||
add: virtual registry now integrated in dxwnd.ini configuration and activated automatically. No more handling of dxwnd.reg file
|
||||
fix: virtual registry optimization, code reorganization, bug fixing ....
|
||||
add: "Stretch ActiveMovie window" flag. Fixes "The Thing" intro movies.
|
||||
fix: apply "Blit from backbuffer" option to both surface emulated and non emulated cases. Should help fixing "Galapagos" screen locks.
|
||||
fix: apply "Limit screen resolution" to the list of detected video modes in VGA emulated case
|
||||
fix: eliminated "Automatic" surface emulation mode, no longer supported
|
||||
fix: fixed InvalidateRect rectangle: avoids flickering in "Microsoft Pandora's Box"
|
||||
add: added "Bypass MCI calls" flag.
|
||||
|
||||
|
47
build/registry/dxwnd.SimCity 2000.reg
Normal file
47
build/registry/dxwnd.SimCity 2000.reg
Normal file
@ -0,0 +1,47 @@
|
||||
[HKEY_CURRENT_USER\SOFTWARE]
|
||||
[HKEY_CURRENT_USER\SOFTWARE\Maxis]
|
||||
[HKEY_CURRENT_USER\SOFTWARE\Maxis\SimCity 2000]
|
||||
[HKEY_CURRENT_USER\SOFTWARE\Maxis\SimCity 2000\Localize]
|
||||
"Language"="USA"
|
||||
|
||||
[HKEY_CURRENT_USER\SOFTWARE\Maxis\SimCity 2000\Options]
|
||||
"AutoBudget"=dword:00000000
|
||||
"AutoGoto"=dword:00000001
|
||||
"AutoSave"=dword:00000000
|
||||
"Disasters"=dword:00000001
|
||||
"Music"=dword:00000001
|
||||
"Sound"=dword:00000001
|
||||
"Speed"=dword:00000001
|
||||
|
||||
[HKEY_CURRENT_USER\SOFTWARE\Maxis\SimCity 2000\Paths]
|
||||
"Cities"="D:\\Games\\Simcity 2000\\Cities"
|
||||
"Data"="D:\\Games\\Simcity 2000\\Data"
|
||||
"Goodies"="D:\\Games\\Simcity 2000\\Goodies"
|
||||
"Graphics"="D:\\Games\\Simcity 2000\\Bitmaps"
|
||||
"Home"="D:\\Games\\Simcity 2000"
|
||||
"Music"="D:\\Games\\Simcity 2000\\Sounds"
|
||||
"SaveGame"="D:\\Games\\Simcity 2000\\Cities"
|
||||
"Folder"="Maxis"
|
||||
"Scenarios"="D:\\Games\\Simcity 2000\\Scenario"
|
||||
"TileSets"="D:\\Games\\Simcity 2000\\ScurkArt"
|
||||
|
||||
[HKEY_CURRENT_USER\SOFTWARE\Maxis\SimCity 2000\Registration]
|
||||
"Company Name"="nameless mutual loan company"
|
||||
"Mayor Name"="Jane Doe"
|
||||
|
||||
[HKEY_CURRENT_USER\SOFTWARE\Maxis\SimCity 2000\SCURK]
|
||||
"CycleColors"=dword:00000001
|
||||
"GridHeight"=dword:00000008
|
||||
"GridWidth"=dword:00000008
|
||||
"ShowClipRegion"=dword:00000000
|
||||
"ShowDrawGrid"=dword:00000000
|
||||
"SnapToGrid"=dword:00000000
|
||||
"Sound"=dword:00000001
|
||||
|
||||
[HKEY_CURRENT_USER\SOFTWARE\Maxis\SimCity 2000\Version]
|
||||
"SimCity 2000"=dword:00000100
|
||||
"SCURK"=dword:00000100
|
||||
|
||||
[HKEY_CURRENT_USER\SOFTWARE\Maxis\SimCity 2000\Windows]
|
||||
"Color Check"=dword:00000000
|
||||
"Display"="8 1"
|
425
dll/advapi.cpp
425
dll/advapi.cpp
@ -65,7 +65,13 @@ static char *hKey2String(HKEY hKey)
|
||||
//OutTrace("building fake Key=\"%s\" hKey=%x\n", sKey, hKey);
|
||||
fclose(regf);
|
||||
strcpy(sKey, &RegBuf[1]);
|
||||
sKey[strlen(sKey)-2]=0; // get rid of "]"
|
||||
//sKey[strlen(sKey)-2]=0; // get rid of "]"
|
||||
for(int i=strlen(sKey)-1; i; i--){
|
||||
if(sKey[i]==']'){
|
||||
sKey[i]=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return sKey;
|
||||
}
|
||||
else {
|
||||
@ -89,20 +95,258 @@ static char *hKey2String(HKEY hKey)
|
||||
return skey;
|
||||
}
|
||||
|
||||
static char *Unescape(char *s, char **dest)
|
||||
{
|
||||
if(!*dest) *dest=(char *)malloc(strlen(s)+100);
|
||||
else *dest=(char *)realloc(*dest, strlen(s)+100);
|
||||
char *t = *dest;
|
||||
for(; *s; s++){
|
||||
if((*s=='\\') && (*(s+1)=='n')){
|
||||
*t++ = '\n';
|
||||
s++;
|
||||
}
|
||||
else{
|
||||
*t++ = *s;
|
||||
}
|
||||
}
|
||||
*t=0;
|
||||
return *dest;
|
||||
}
|
||||
|
||||
static FILE *OpenFakeRegistry()
|
||||
{
|
||||
DWORD dwAttrib;
|
||||
char sSourcePath[MAX_PATH+1];
|
||||
char *p;
|
||||
static BOOL LoadFromConfig = TRUE;
|
||||
dwAttrib = GetFileAttributes("dxwnd.dll");
|
||||
if (dwAttrib != INVALID_FILE_ATTRIBUTES && !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY)) return NULL;
|
||||
GetModuleFileName(GetModuleHandle("dxwnd"), sSourcePath, MAX_PATH);
|
||||
p=&sSourcePath[strlen(sSourcePath)-strlen("dxwnd.dll")];
|
||||
if(LoadFromConfig){
|
||||
int Index;
|
||||
char key[81];
|
||||
char name[MAX_PATH+1];
|
||||
char exepath[MAX_PATH+1];
|
||||
strcpy(p, "dxwnd.ini");
|
||||
GetModuleFileName(0, name, MAX_PATH);
|
||||
//for(int i = 0; name[i]; i ++) name[i] = tolower(name[i]);
|
||||
for(Index=0; Index<MAXTARGETS; Index++){
|
||||
DWORD flags3;
|
||||
sprintf_s(key, sizeof(key), "path%i", Index);
|
||||
GetPrivateProfileString("target", key, "", exepath, MAX_PATH, sSourcePath);
|
||||
sprintf_s(key, sizeof(key), "flagh%i", Index);
|
||||
flags3 = GetPrivateProfileInt("target", key, 0, sSourcePath);
|
||||
if(!_stricmp(exepath, name) && (flags3 & HOOKENABLED)) break; // got it!
|
||||
}
|
||||
if(Index < MAXTARGETS){
|
||||
FILE *freg;
|
||||
char *RegBuf;
|
||||
RegBuf = (char *)malloc(1000000+1); // 1MB!!
|
||||
OutTrace("Fake registry: build virtual registry from dxwnd.ini entry #%d\n", Index);
|
||||
sprintf_s(key, sizeof(key), "registry%i", Index);
|
||||
GetPrivateProfileString("target", key, "", RegBuf, 1000000, sSourcePath);
|
||||
if(strlen(RegBuf)>0){
|
||||
char *FileBuf = NULL;
|
||||
Unescape(RegBuf, &FileBuf);
|
||||
strcpy(p, "dxwnd.reg");
|
||||
freg = fopen(sSourcePath,"w");
|
||||
fwrite(FileBuf, 1, strlen(FileBuf), freg);
|
||||
fclose(freg);
|
||||
free(FileBuf);
|
||||
}
|
||||
free(RegBuf);
|
||||
}
|
||||
LoadFromConfig = FALSE;
|
||||
}
|
||||
strcpy(p, "dxwnd.reg");
|
||||
return fopen(sSourcePath,"r");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
static LONG SeekFakeKey(FILE *regf, HKEY hKey)
|
||||
{
|
||||
LONG res;
|
||||
res = ERROR_FILE_NOT_FOUND;
|
||||
char RegBuf[MAX_PATH+1];
|
||||
HKEY hCurKey=HKEY_FAKE+1;
|
||||
fgets(RegBuf, 256, regf);
|
||||
while (!feof(regf)){
|
||||
if(RegBuf[0]=='['){
|
||||
hCurKey--;
|
||||
}
|
||||
if(hCurKey==hKey) {
|
||||
//OutTraceB("DEBUG: SeekFakeKey fount key at line=%s\n", RegBuf);
|
||||
res = ERROR_SUCCESS;
|
||||
break;
|
||||
}
|
||||
fgets(RegBuf, 256, regf);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static LONG SeekValueName(FILE *regf, LPCTSTR lpValueName)
|
||||
{
|
||||
LONG res;
|
||||
char RegBuf[MAX_PATH+1];
|
||||
long KeySeekPtr;
|
||||
res = ERROR_FILE_NOT_FOUND;
|
||||
KeySeekPtr = ftell(regf);
|
||||
fgets(RegBuf, 256, regf);
|
||||
while (!feof(regf)){
|
||||
if((RegBuf[0]=='"') &&
|
||||
!_strnicmp(lpValueName, &RegBuf[1], strlen(lpValueName)) &&
|
||||
(RegBuf[strlen(lpValueName)+1]=='"') &&
|
||||
(RegBuf[strlen(lpValueName)+2]=='='))
|
||||
{
|
||||
fseek(regf, KeySeekPtr, SEEK_SET);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
if(RegBuf[0]=='[') return res;
|
||||
KeySeekPtr = ftell(regf);
|
||||
fgets(RegBuf, 256, regf);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static LONG SeekValueIndex(FILE *regf, DWORD dwIndex, LPCTSTR lpValueName, LPDWORD lpcchValueName)
|
||||
{
|
||||
LONG res;
|
||||
char RegBuf[MAX_PATH+1];
|
||||
long KeySeekPtr;
|
||||
res = ERROR_NO_MORE_ITEMS;
|
||||
KeySeekPtr = ftell(regf);
|
||||
fgets(RegBuf, 256, regf);
|
||||
dwIndex++;
|
||||
while (!feof(regf) && dwIndex){
|
||||
if(RegBuf[0]=='"') dwIndex--;
|
||||
if(dwIndex == 0){
|
||||
fseek(regf, KeySeekPtr, SEEK_SET);
|
||||
//sscanf(RegBuf, "\"%s\"=", lpValueName);
|
||||
strncpy((char *)lpValueName, strtok(&RegBuf[1], "\""), *lpcchValueName);
|
||||
*lpcchValueName = strlen(lpValueName);
|
||||
//OutTrace("DEBUG: lpValueName=%s len=%d\n", lpValueName, *lpcchValueName);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
if(RegBuf[0]=='[') return res;
|
||||
KeySeekPtr = ftell(regf);
|
||||
fgets(RegBuf, 256, regf);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static DWORD GetKeyValue(
|
||||
FILE *regf,
|
||||
char *ApiName,
|
||||
LPCTSTR lpValueName,
|
||||
LPDWORD lpType, // beware: could be NULL
|
||||
LPBYTE lpData, // beware: could be NULL
|
||||
LPDWORD lpcbData)
|
||||
{
|
||||
LONG res;
|
||||
LPBYTE lpb;
|
||||
char *pData;
|
||||
char RegBuf[MAX_PATH+1];
|
||||
DWORD cbData=0;
|
||||
|
||||
OutTrace("GetKeyValue: ValueName=%s", lpValueName);
|
||||
fgets(RegBuf, 256, regf);
|
||||
pData=&RegBuf[strlen(lpValueName)+3];
|
||||
lpb = lpData;
|
||||
if(lpcbData) {
|
||||
cbData = *lpcbData;
|
||||
*lpcbData=0;
|
||||
}
|
||||
do {
|
||||
if(*pData=='"'){ // string value
|
||||
if(lpType) *lpType=REG_SZ;
|
||||
pData++;
|
||||
while(*pData && (*pData != '"')){
|
||||
if(*pData=='\\') pData++;
|
||||
if(lpData && lpcbData) if(*lpcbData < cbData) *lpb++=*pData;
|
||||
pData++;
|
||||
if(lpcbData) (*lpcbData)++;
|
||||
}
|
||||
if(lpcbData) (*lpcbData)++; // extra space for string terminator ?
|
||||
if(lpData && lpcbData) if(*lpcbData < cbData) *lpb = 0; // string terminator
|
||||
OutTraceR("%s: type=REG_SZ cbData=%x Data=\"%s\"\n",
|
||||
ApiName, lpcbData ? *lpcbData : 0, lpData ? (char *)lpData : "(NULL)");
|
||||
res=(*lpcbData > cbData) ? ERROR_MORE_DATA : ERROR_SUCCESS;
|
||||
break;
|
||||
}
|
||||
if(!strncmp(pData,"dword:",strlen("dword:"))){ //dword value
|
||||
DWORD val;
|
||||
if(lpType) *lpType=REG_DWORD;
|
||||
pData+=strlen("dword:");
|
||||
sscanf(pData, "%x", &val);
|
||||
if(lpData) {
|
||||
if (cbData >= sizeof(DWORD)) {
|
||||
memcpy(lpData, &val, sizeof(DWORD));
|
||||
res=ERROR_SUCCESS;
|
||||
}
|
||||
else
|
||||
res=ERROR_MORE_DATA;
|
||||
}
|
||||
if (lpcbData) *lpcbData=sizeof(DWORD);
|
||||
OutTraceR("%s: type=REG_DWORD cbData=%x Data=0x%x\n",
|
||||
ApiName, lpcbData ? *lpcbData : 0, val);
|
||||
break;
|
||||
}
|
||||
if(!strncmp(pData,"hex:",strlen("hex:"))){ //hex value
|
||||
BYTE *p;
|
||||
if(lpType) *lpType=REG_BINARY;
|
||||
p = (BYTE *)pData;
|
||||
p+=strlen("hex:");
|
||||
while(TRUE){
|
||||
p[strlen((char *)p)-1]=0; // eliminates \n at the end of line
|
||||
while(strlen((char *)p)>1){
|
||||
if((*lpcbData < cbData) && lpData){
|
||||
sscanf((char *)p, "%x,", (char *)lpb);
|
||||
lpb++;
|
||||
}
|
||||
p+=3;
|
||||
if(lpcbData) (*lpcbData)++;
|
||||
}
|
||||
if(p[strlen((char *)p)-1]=='\\'){
|
||||
fgets(RegBuf, 256, regf);
|
||||
pData = RegBuf;
|
||||
p = (BYTE *)pData;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
OutTraceR("%s: type=REG_BINARY cbData=%d Data=%s\n",
|
||||
ApiName,
|
||||
lpcbData ? *lpcbData : 0,
|
||||
lpData ? "(NULL)" : hexdump(lpData, *lpcbData));
|
||||
res=(*lpcbData > cbData) ? ERROR_MORE_DATA : ERROR_SUCCESS;
|
||||
break;
|
||||
}
|
||||
} while(FALSE);
|
||||
return res;
|
||||
}
|
||||
|
||||
static void LogKeyValue(char *ApiName, LONG res, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData)
|
||||
{
|
||||
char sInfo[1024];
|
||||
if(res) {
|
||||
OutTrace("%s: ERROR res=%x\n", ApiName, res);
|
||||
return;
|
||||
}
|
||||
sprintf(sInfo, "%s: res=0 size=%d type=%x(%s)",
|
||||
ApiName, lpcbData?*lpcbData:0, lpType?*lpType:0, lpType?ExplainRegType(*lpType):"none");
|
||||
if(lpType && lpData && lpcbData) {
|
||||
DWORD cbData = *lpcbData;
|
||||
switch(*lpType){
|
||||
case REG_SZ: sprintf(sInfo, "%s Data=\"%*.*s\"\n", sInfo, cbData-1, cbData-1, lpData); break;
|
||||
case REG_DWORD: sprintf(sInfo, "%s Data=0x%x\n", sInfo, *(DWORD *)lpData); break;
|
||||
case REG_BINARY: sprintf(sInfo, "%s Data=%s\n", sInfo, hexdump((BYTE *)lpData, cbData)); break;
|
||||
case REG_NONE: sprintf(sInfo, "%s Data=\"%s\"\n", sInfo, lpData); break;
|
||||
default: sprintf(sInfo, "%s Data=???\n", sInfo); break;
|
||||
}
|
||||
}
|
||||
else
|
||||
sprintf(sInfo, "%s\n", sInfo);
|
||||
OutTrace(sInfo);
|
||||
}
|
||||
|
||||
static LONG myRegOpenKeyEx(
|
||||
HKEY hKey,
|
||||
@ -139,6 +383,7 @@ static LONG myRegOpenKeyEx(
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
LONG WINAPI extRegOpenKeyEx(
|
||||
HKEY hKey,
|
||||
@ -183,138 +428,26 @@ LONG WINAPI extRegQueryValueEx(
|
||||
LPDWORD lpcbData)
|
||||
{
|
||||
LONG res;
|
||||
FILE *regf;
|
||||
DWORD cbData=0;
|
||||
|
||||
OutTraceR("RegQueryValueEx: hKey=%x(\"%s\") ValueName=\"%s\" Reserved=%x lpType=%x lpData=%x lpcbData=%x\n",
|
||||
hKey, hKey2String(hKey), lpValueName, lpReserved, lpType, lpData, lpcbData);
|
||||
if (!IsFake(hKey)){
|
||||
res=(*pRegQueryValueEx)(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData);
|
||||
if(IsTraceR){
|
||||
if (res==ERROR_SUCCESS){
|
||||
OutTrace("RegQueryValueEx: size=%d type=%x(%s) ",
|
||||
lpcbData?*lpcbData:0, lpType?*lpType:0, lpType?ExplainRegType(*lpType):"none");
|
||||
if(lpType && lpData) switch(*lpType){
|
||||
case REG_SZ: OutTrace("Data=\"%s\"\n", lpData); break;
|
||||
case REG_DWORD: OutTrace("Data=0x%x\n", *(DWORD *)lpData); break;
|
||||
case REG_BINARY:
|
||||
{
|
||||
DWORD i;
|
||||
unsigned char *p;
|
||||
p = lpData;
|
||||
OutTrace("Data=%02.2X", p++);
|
||||
for(i=1; i<*lpcbData; i++) OutTrace(",%02.2X", *p++);
|
||||
OutTrace("\n");
|
||||
}
|
||||
break;
|
||||
default: OutTrace("Data=???\n"); break;
|
||||
}
|
||||
else
|
||||
OutTrace("\n");
|
||||
}
|
||||
else
|
||||
OutTrace("res=%x\n", res);
|
||||
}
|
||||
if(IsTraceR) LogKeyValue("RegQueryValueEx", res, lpType, lpData, lpcbData);
|
||||
return res;
|
||||
}
|
||||
|
||||
// try emulated registry
|
||||
res = ERROR_FILE_NOT_FOUND;
|
||||
FILE *regf;
|
||||
char RegBuf[MAX_PATH+1];
|
||||
char *pData;
|
||||
HKEY hCurKey=HKEY_FAKE+1;
|
||||
DWORD cbData=0;
|
||||
regf=OpenFakeRegistry();
|
||||
if(regf==NULL) return res;
|
||||
if(!lpValueName)lpValueName="";
|
||||
fgets(RegBuf, 256, regf);
|
||||
while (!feof(regf)){
|
||||
if(RegBuf[0]=='['){
|
||||
hCurKey--;
|
||||
}
|
||||
else {
|
||||
if(hCurKey==hKey){
|
||||
if((RegBuf[0]=='"') &&
|
||||
!_strnicmp(lpValueName, &RegBuf[1], strlen(lpValueName)) &&
|
||||
(RegBuf[strlen(lpValueName)+1]=='"') &&
|
||||
(RegBuf[strlen(lpValueName)+2]=='='))
|
||||
{
|
||||
LPBYTE lpb;
|
||||
res=ERROR_FILE_NOT_FOUND;
|
||||
pData=&RegBuf[strlen(lpValueName)+3];
|
||||
lpb = lpData;
|
||||
if(lpcbData) {
|
||||
cbData = *lpcbData;
|
||||
*lpcbData=0;
|
||||
}
|
||||
if(*pData=='"'){ // string value
|
||||
if(lpType) *lpType=REG_SZ;
|
||||
pData++;
|
||||
while(*pData && (*pData != '"')){
|
||||
if(*pData=='\\') pData++;
|
||||
if(lpData && lpcbData) if(*lpcbData < cbData) *lpb++=*pData;
|
||||
pData++;
|
||||
if(lpcbData) (*lpcbData)++;
|
||||
}
|
||||
if(lpcbData) (*lpcbData)++; // extra space for string terminator ?
|
||||
if(lpData && lpcbData) if(*lpcbData < cbData) *lpb = 0; // string terminator
|
||||
OutTraceR("RegQueryValueEx: type=REG_SZ cbData=%x Data=\"%s\"\n",
|
||||
lpcbData ? *lpcbData : 0, lpData ? (char *)lpData : "(NULL)");
|
||||
res=(*lpcbData > cbData) ? ERROR_MORE_DATA : ERROR_SUCCESS;
|
||||
break;
|
||||
}
|
||||
if(!strncmp(pData,"dword:",strlen("dword:"))){ //dword value
|
||||
DWORD val;
|
||||
if(lpType) *lpType=REG_DWORD;
|
||||
pData+=strlen("dword:");
|
||||
sscanf(pData, "%x", &val);
|
||||
if(lpData) {
|
||||
if (cbData >= sizeof(DWORD)) {
|
||||
memcpy(lpData, &val, sizeof(DWORD));
|
||||
res=ERROR_SUCCESS;
|
||||
}
|
||||
else
|
||||
res=ERROR_MORE_DATA;
|
||||
}
|
||||
if (lpcbData) *lpcbData=sizeof(DWORD);
|
||||
OutTraceR("RegQueryValueEx: type=REG_DWORD cbData=%x Data=0x%x\n",
|
||||
lpcbData ? *lpcbData : 0, val);
|
||||
break;
|
||||
}
|
||||
if(!strncmp(pData,"hex:",strlen("hex:"))){ //hex value
|
||||
BYTE *p;
|
||||
if(lpType) *lpType=REG_BINARY;
|
||||
p = (BYTE *)pData;
|
||||
p+=strlen("hex:");
|
||||
while(TRUE){
|
||||
p[strlen((char *)p)-1]=0; // eliminates \n at the end of line
|
||||
while(strlen((char *)p)>1){
|
||||
if((*lpcbData < cbData) && lpData){
|
||||
sscanf((char *)p, "%x,", (char *)lpb);
|
||||
lpb++;
|
||||
}
|
||||
p+=3;
|
||||
if(lpcbData) (*lpcbData)++;
|
||||
}
|
||||
if(p[strlen((char *)p)-1]=='\\'){
|
||||
fgets(RegBuf, 256, regf);
|
||||
pData = RegBuf;
|
||||
p = (BYTE *)pData;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
OutTraceR("RegQueryValueEx: type=REG_BINARY cbData=%d Data=%s\n",
|
||||
lpcbData ? *lpcbData : 0,
|
||||
lpData ? "(NULL)" : hexdump(lpData, *lpcbData));
|
||||
res=(*lpcbData > cbData) ? ERROR_MORE_DATA : ERROR_SUCCESS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fgets(RegBuf, 256, regf);
|
||||
}
|
||||
if(regf==NULL) return ERROR_FILE_NOT_FOUND;
|
||||
res = SeekFakeKey(regf, hKey);
|
||||
if(res != ERROR_SUCCESS) return res;
|
||||
res = SeekValueName(regf, lpValueName);
|
||||
if(res != ERROR_SUCCESS) return res;
|
||||
res = GetKeyValue(regf, "RegQueryValueEx", lpValueName, lpType, lpData, lpcbData);
|
||||
if(IsTraceR) LogKeyValue("RegQueryValueEx", res, lpType, lpData, lpcbData);
|
||||
fclose(regf);
|
||||
OutTraceR("RegQueryValueEx: res=%x\n", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -383,9 +516,43 @@ LONG WINAPI extRegCreateKey(HKEY hKey, LPCTSTR lpSubKey, PHKEY phkResult)
|
||||
|
||||
LONG WINAPI extRegEnumValueA(HKEY hKey, DWORD dwIndex, LPTSTR lpValueName, LPDWORD lpcchValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData)
|
||||
{
|
||||
LONG ret;
|
||||
OutTrace("RegEnumValue: hKey=%x(%s) Index=%x\n", hKey, hKey2String(hKey), dwIndex);
|
||||
ret=(*pRegEnumValueA)(hKey, dwIndex, lpValueName, lpcchValueName, lpReserved, lpType, lpData, lpcbData);
|
||||
OutTrace("RegEnumValue: hKey=%x(%s) Index=%x ValueName=\"%s\", Type=%x ret=%x\n", hKey, hKey2String(hKey), dwIndex, lpValueName, lpType ? *lpType : 0, ret);
|
||||
return ret;
|
||||
LONG res;
|
||||
|
||||
OutTraceR("RegEnumValue: hKey=%x(\"%s\") index=%d cchValueName=%d Reserved=%x lpType=%x lpData=%x lpcbData=%x\n",
|
||||
hKey, hKey2String(hKey), dwIndex, *lpcchValueName, lpReserved, lpType, lpData, lpcbData);
|
||||
if (!IsFake(hKey)){
|
||||
res=(*pRegEnumValueA)(hKey, dwIndex, lpValueName, lpcchValueName, lpReserved, lpType, lpData, lpcbData);
|
||||
if(IsTraceR) LogKeyValue("RegQueryValueEx", res, lpType, lpData, lpcbData);
|
||||
return res;
|
||||
}
|
||||
|
||||
// try emulated registry
|
||||
FILE *regf;
|
||||
regf=OpenFakeRegistry();
|
||||
if(regf==NULL) return ERROR_FILE_NOT_FOUND;
|
||||
res = SeekFakeKey(regf, hKey);
|
||||
if(res != ERROR_SUCCESS) return res;
|
||||
res = SeekValueIndex(regf, dwIndex, lpValueName, lpcchValueName);
|
||||
if(res != ERROR_SUCCESS) return res;
|
||||
res = GetKeyValue(regf, "RegEnumValue", lpValueName, lpType, lpData, lpcbData);
|
||||
if(IsTraceR) LogKeyValue("RegEnumValue", res, lpType, lpData, lpcbData);
|
||||
fclose(regf);
|
||||
return res;
|
||||
}
|
||||
|
||||
#ifdef TOBEDONE
|
||||
LONG WINAPI RegQueryInfoKey(
|
||||
_In_ HKEY hKey,
|
||||
_Out_opt_ LPTSTR lpClass,
|
||||
_Inout_opt_ LPDWORD lpcClass,
|
||||
_Reserved_ LPDWORD lpReserved,
|
||||
_Out_opt_ LPDWORD lpcSubKeys,
|
||||
_Out_opt_ LPDWORD lpcMaxSubKeyLen,
|
||||
_Out_opt_ LPDWORD lpcMaxClassLen,
|
||||
_Out_opt_ LPDWORD lpcValues,
|
||||
_Out_opt_ LPDWORD lpcMaxValueNameLen,
|
||||
_Out_opt_ LPDWORD lpcMaxValueLen,
|
||||
_Out_opt_ LPDWORD lpcbSecurityDescriptor,
|
||||
_Out_opt_ PFILETIME lpftLastWriteTime
|
||||
);
|
||||
#endif
|
@ -20,6 +20,7 @@ extern CreateSurface2_Type pCreateSurface4;
|
||||
extern CreateSurface2_Type pCreateSurface7;
|
||||
extern Unlock4_Type pUnlockMethod(LPDIRECTDRAWSURFACE);
|
||||
extern HDC hFlippedDC;
|
||||
extern BOOL bFlippedDC;
|
||||
extern ReleaseDC_Type pReleaseDC;
|
||||
|
||||
extern void BlitError(HRESULT, LPRECT, LPRECT, int);
|
||||
@ -36,7 +37,8 @@ static HRESULT sBltNoPrimary(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdest
|
||||
//extern PrimaryBlt_Type pPrimaryBlt;
|
||||
//CkArg arg;
|
||||
|
||||
FromScreen=dxwss.IsAPrimarySurface(lpddssrc) && !(dxw.dwFlags1 & EMULATESURFACE) && !(dxw.dwFlags1 & EMULATEBUFFER); // v2.02.77
|
||||
//FromScreen=dxwss.IsAPrimarySurface(lpddssrc) && !(dxw.dwFlags1 & EMULATESURFACE) && !(dxw.dwFlags1 & EMULATEBUFFER); // v2.02.77
|
||||
FromScreen=dxwss.IsAPrimarySurface(lpddssrc); // ghogho
|
||||
|
||||
// make a working copy of srcrect if not NULL
|
||||
if (lpsrcrect){
|
||||
@ -48,15 +50,24 @@ static HRESULT sBltNoPrimary(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdest
|
||||
// v2.1.83: BLITFROMBACKBUFFER mode, let you chose to blit from backbuffer, where the surface size
|
||||
// is fixed no matter how the window/primary surface is scaled.
|
||||
// In "The Sims" there is no quality loss, but some scrolling artifact.
|
||||
if(lpsrcrect && FromScreen){
|
||||
LPDIRECTDRAWSURFACE lpDDSBack;
|
||||
lpDDSBack = dxwss.GetBackBufferSurface();
|
||||
if(lpDDSBack && (dxw.dwFlags1 & BLITFROMBACKBUFFER)){
|
||||
lpddssrc=lpDDSBack;
|
||||
srcrect=dxw.GetScreenRect();
|
||||
//if(lpsrcrect && FromScreen){
|
||||
if(FromScreen){
|
||||
if ((dxw.dwFlags1 & EMULATESURFACE) || (dxw.dwFlags1 & EMULATEBUFFER)){
|
||||
if(dxw.dwFlags1 & BLITFROMBACKBUFFER){
|
||||
LPDIRECTDRAWSURFACE lpDDSBack;
|
||||
lpDDSBack = dxwss.GetBackBufferSurface();
|
||||
if(lpDDSBack) lpddssrc=lpDDSBack;
|
||||
}
|
||||
}
|
||||
else{
|
||||
srcrect=dxw.MapWindowRect(lpsrcrect);
|
||||
else {
|
||||
if(dxw.dwFlags1 & BLITFROMBACKBUFFER){
|
||||
LPDIRECTDRAWSURFACE lpDDSBack;
|
||||
lpDDSBack = dxwss.GetBackBufferSurface();
|
||||
if(lpDDSBack) lpddssrc=lpDDSBack;
|
||||
}
|
||||
else{
|
||||
srcrect=dxw.MapWindowRect(lpsrcrect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -274,7 +285,7 @@ static HRESULT sBltToPrimary(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdest
|
||||
|
||||
// Try to handle HDC lock concurrency....
|
||||
if(res==DDERR_SURFACEBUSY){
|
||||
(*pReleaseDC)(lpdds, hFlippedDC);
|
||||
if (bFlippedDC) (*pReleaseDC)(lpdds, hFlippedDC);
|
||||
#if 0
|
||||
res=(*pUnlockMethod(lpddssrc))(lpddssrc, NULL);
|
||||
if(res && (res!=DDERR_NOTLOCKED)) OutTraceE("Unlock ERROR: lpdds=%x err=%x(%s)\n", lpddssrc, res, ExplainDDError(res));
|
||||
|
@ -1868,7 +1868,11 @@ HRESULT WINAPI extQueryInterfaceS(void *lpdds, REFIID riid, LPVOID *obp)
|
||||
}
|
||||
|
||||
// fix the target for gamma ramp creation: if it is a primary surface, use the real one!!
|
||||
if(dxwss.IsAPrimarySurface((LPDIRECTDRAWSURFACE)lpdds) && IsGammaRamp) lpdds = lpDDSEmu_Prim;
|
||||
// v2.03.37: do this just when in esurface emulated mode!!
|
||||
if( IsGammaRamp &&
|
||||
(dxw.dwFlags1 & EMULATESURFACE) &&
|
||||
dxwss.IsAPrimarySurface((LPDIRECTDRAWSURFACE)lpdds))
|
||||
lpdds = lpDDSEmu_Prim;
|
||||
|
||||
res = (*pQueryInterfaceS)(lpdds, riid, obp);
|
||||
|
||||
@ -2444,6 +2448,7 @@ static HRESULT BuildPrimaryDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSPrim(2)", __LINE__);
|
||||
}
|
||||
|
||||
iBakBufferVersion=dxversion; // v2.03.37
|
||||
HookDDSurfacePrim(lplpdds, dxversion);
|
||||
if(dxw.dwFlags1 & CLIPCURSOR) dxw.SetClipCursor();
|
||||
|
||||
@ -4176,7 +4181,7 @@ HRESULT WINAPI EnumModesCallbackDumper(LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID l
|
||||
OutTrace("EnumModesCallback:\n");
|
||||
OutTrace("\tdwSize=%d\n", lpDDSurfaceDesc->dwSize);
|
||||
OutTrace("\tdwFlags=%x(%s)\n", lpDDSurfaceDesc->dwFlags, ExplainFlags(lpDDSurfaceDesc->dwFlags));
|
||||
OutTrace("\tdwHeight x dwWidth=(%d,%d)\n", lpDDSurfaceDesc->dwHeight, lpDDSurfaceDesc->dwWidth);
|
||||
OutTrace("\tdwWidth x dwHeight=(%d,%d)\n", lpDDSurfaceDesc->dwWidth, lpDDSurfaceDesc->dwHeight);
|
||||
OutTrace("\tlPitch=%d\n", lpDDSurfaceDesc->lPitch);
|
||||
OutTrace("\tdwBackBufferCount=%d\n", lpDDSurfaceDesc->dwBackBufferCount);
|
||||
OutTrace("\tdwRefreshRate=%d\n", lpDDSurfaceDesc->dwRefreshRate);
|
||||
@ -4347,6 +4352,8 @@ HRESULT WINAPI extEnumDisplayModes(EnumDisplayModes1_Type pEnumDisplayModes, LPD
|
||||
for (ResIdx=0; SupportedRes[ResIdx].h; ResIdx++){
|
||||
EmuDesc.dwHeight=SupportedRes[ResIdx].h;
|
||||
EmuDesc.dwWidth=SupportedRes[ResIdx].w;
|
||||
if((dxw.dwFlags4 & LIMITSCREENRES) &&
|
||||
CheckResolutionLimit((LPDDSURFACEDESC)&EmuDesc)) break;
|
||||
EmuDesc.ddpfPixelFormat.dwSize=sizeof(DDPIXELFORMAT);
|
||||
EmuDesc.ddpfPixelFormat.dwFlags=DDPF_RGB;
|
||||
for (DepthIdx=0; SupportedDepths[DepthIdx]; DepthIdx++) {
|
||||
@ -4593,6 +4600,7 @@ HRESULT WINAPI extAddAttachedSurface(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURF
|
||||
if (res) {
|
||||
HRESULT sdres;
|
||||
DDSURFACEDESC2 sd;
|
||||
if (res) OutTraceE("AddAttachedSurface: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
sd.dwSize=Set_dwSize_From_Surface(lpddsadd);
|
||||
sdres=lpddsadd->GetSurfaceDesc((DDSURFACEDESC *)&sd);
|
||||
if (sdres)
|
||||
|
@ -52,7 +52,7 @@ CRITICAL_SECTION TraceCS;
|
||||
static char *FlagNames[32]={
|
||||
"UNNOTIFY", "EMULATESURFACE", "CLIPCURSOR", "RESETPRIMARY",
|
||||
"HOOKDI", "MODIFYMOUSE", "HANDLEEXCEPTIONS", "SAVELOAD",
|
||||
"EMULATEBUFFER", "AUTOMATIC", "BLITFROMBACKBUFFER", "SUPPRESSCLIPPING",
|
||||
"EMULATEBUFFER", "--AUTOMATIC--", "BLITFROMBACKBUFFER", "SUPPRESSCLIPPING",
|
||||
"AUTOREFRESH", "FIXWINFRAME", "HIDEHWCURSOR", "SLOWDOWN",
|
||||
"ENABLECLIPPING", "LOCKWINSTYLE", "MAPGDITOPRIMARY", "FIXTEXTOUT",
|
||||
"KEEPCURSORWITHIN", "USERGB565", "SUPPRESSDXERRORS", "PREVENTMAXIMIZE",
|
||||
@ -110,7 +110,7 @@ static char *Flag6Names[32]={
|
||||
"FIXPITCH", "POWER2WIDTH", "HIDETASKBAR", "ACTIVATEAPP",
|
||||
"NOSYSMEMPRIMARY", "NOSYSMEMBACKBUF", "CONFIRMONCLOSE", "TERMINATEONCLOSE",
|
||||
"FLIPEMULATION", "SETZBUFFERBITDEPTHS", "SHAREDDC", "WOW32REGISTRY",
|
||||
"", "", "", "",
|
||||
"STRETCHMOVIES", "BYPASSMCI", "", "",
|
||||
"", "", "", "",
|
||||
"", "", "", "",
|
||||
};
|
||||
@ -1717,11 +1717,9 @@ void HookInit(TARGETMAP *target, HWND hwnd)
|
||||
sSourcePath[strlen(sSourcePath)-strlen("dxwnd.dll")] = 0; // terminate the string just before "dxwnd.dll"
|
||||
SetDllDirectory(sSourcePath);
|
||||
|
||||
if(dxw.dwFlags1 & AUTOMATIC) dxw.dwFlags1 |= EMULATESURFACE; // if AUTOMATIC, try this first!
|
||||
if(dxw.dwFlags5 & HYBRIDMODE) {
|
||||
// special mode settings ....
|
||||
dxw.dwFlags1 |= EMULATESURFACE;
|
||||
// dxw.dwFlags5 |= NOSYSTEMEMULATED;
|
||||
dxw.dwFlags2 |= SETCOMPATIBILITY;
|
||||
dxw.dwFlags5 &= ~(BILINEARFILTER | AEROBOOST);
|
||||
}
|
||||
|
BIN
dll/dxwnd.aps
BIN
dll/dxwnd.aps
Binary file not shown.
@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "TlHelp32.h"
|
||||
|
||||
#define VERSION "2.03.36"
|
||||
#define VERSION "2.03.37"
|
||||
|
||||
#define DDTHREADLOCK 1
|
||||
//#define LOCKTHREADS
|
||||
|
@ -1,20 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dxwnd", "dxwnd.vs2008.vcproj", "{579E7FE7-2745-4100-A802-23511711FCDE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{579E7FE7-2745-4100-A802-23511711FCDE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{579E7FE7-2745-4100-A802-23511711FCDE}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{579E7FE7-2745-4100-A802-23511711FCDE}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{579E7FE7-2745-4100-A802-23511711FCDE}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Binary file not shown.
@ -896,32 +896,12 @@ HRESULT WINAPI extCreateDevice2(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE
|
||||
|
||||
OutTraceD3D("CreateDevice(D3D2): d3d=%x GUID=%x(%s) lpdds=%x%s\n",
|
||||
lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds, dxwss.ExplainSurfaceRole((LPDIRECTDRAWSURFACE)lpdds));
|
||||
do { // fake loop
|
||||
// first attempt
|
||||
res=(*pCreateDevice2)(lpd3d, Guid, lpdds, lplpd3dd);
|
||||
if(res==DD_OK) break; // no error, break
|
||||
OutTraceE("CreateDevice(D3D2) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
if(!(dxw.dwFlags1 & EMULATESURFACE)) break; // no more tricks ....
|
||||
if(!(dxw.dwFlags1 & AUTOMATIC)) break;
|
||||
|
||||
//OutTraceD3D("CreateDevice(D3D2): SYSMEMORY OFF\n");
|
||||
//dxw.dwFlags6 |= NOSYSMEMPRIMARY;
|
||||
//res=(*pCreateDevice2)(lpd3d, Guid, lpdds, lplpd3dd);
|
||||
//if(res==DD_OK) break;
|
||||
//OutTraceE("CreateDevice(D3D2) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
//if(!(dxw.dwFlags1 & AUTOMATIC)) break;
|
||||
|
||||
OutTraceD3D("CreateDevice(D3D2): Emulation OFF\n");
|
||||
//dxw.dwFlags5 &= ~NOSYSTEMEMULATED;
|
||||
dxw.dwFlags1 &= ~EMULATESURFACE;
|
||||
dxw.dwFlags1 |= LOCKEDSURFACE;
|
||||
res=(*pCreateDevice2)(lpd3d, Guid, lpdds, lplpd3dd);
|
||||
if(res==DD_OK) break;
|
||||
res=(*pCreateDevice2)(lpd3d, Guid, lpdds, lplpd3dd);
|
||||
if(res!=DD_OK) {
|
||||
OutTraceE("CreateDevice(D3D2) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
} while (FALSE);
|
||||
|
||||
if(res == DD_OK){
|
||||
}
|
||||
else{
|
||||
OutTraceD3D("CreateDevice(D3D2): lpd3dd=%x\n", lpd3d, *lplpd3dd);
|
||||
HookDirect3DDevice((void **)lplpd3dd, 2);
|
||||
}
|
||||
@ -935,32 +915,12 @@ HRESULT WINAPI extCreateDevice3(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE4
|
||||
|
||||
OutTraceD3D("CreateDevice(D3D3): d3d=%x GUID=%x(%s) lpdds=%x%s\n",
|
||||
lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds, dxwss.ExplainSurfaceRole((LPDIRECTDRAWSURFACE)lpdds));
|
||||
do { // fake loop
|
||||
// first attempt
|
||||
res=(*pCreateDevice3)(lpd3d, Guid, lpdds, lplpd3dd, unk);
|
||||
if(res==DD_OK) break; // no error, break
|
||||
OutTraceE("CreateDevice(D3D3) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
if(!(dxw.dwFlags1 & EMULATESURFACE)) break; // no more tricks ....
|
||||
if(!(dxw.dwFlags1 & AUTOMATIC)) break;
|
||||
|
||||
//OutTraceD3D("CreateDevice(D3D3): SYSMEMORY OFF\n");
|
||||
//dxw.dwFlags5 |= NOSYSTEMEMULATED;
|
||||
//res=(*pCreateDevice3)(lpd3d, Guid, lpdds, lplpd3dd, unk);
|
||||
//if(res==DD_OK) break;
|
||||
//OutTraceE("CreateDevice(D3D3) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
//if(!(dxw.dwFlags1 & AUTOMATIC)) break;
|
||||
|
||||
OutTraceD3D("CreateDevice(D3D3): Emulation OFF\n");
|
||||
//dxw.dwFlags5 &= ~NOSYSTEMEMULATED;
|
||||
dxw.dwFlags1 &= ~EMULATESURFACE;
|
||||
dxw.dwFlags1 |= LOCKEDSURFACE;
|
||||
res=(*pCreateDevice3)(lpd3d, Guid, lpdds, lplpd3dd, unk);
|
||||
if(res==DD_OK) break;
|
||||
res=(*pCreateDevice3)(lpd3d, Guid, lpdds, lplpd3dd, unk);
|
||||
if(res!=DD_OK) {
|
||||
OutTraceE("CreateDevice(D3D3) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
} while (FALSE);
|
||||
|
||||
if(res == DD_OK){
|
||||
}
|
||||
else{
|
||||
OutTraceD3D("CreateDevice(D3D3): lpd3dd=%x\n", lpd3d, *lplpd3dd);
|
||||
HookDirect3DDevice((void **)lplpd3dd, 3);
|
||||
}
|
||||
@ -978,35 +938,14 @@ HRESULT WINAPI extCreateDevice7(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE7
|
||||
OutTraceD3D("CreateDevice(D3D7): d3d=%x GUID=%x(%s) lpdds=%x%s\n",
|
||||
lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds, dxwss.ExplainSurfaceRole((LPDIRECTDRAWSURFACE)lpdds));
|
||||
|
||||
do { // fake loop
|
||||
// first attempt
|
||||
res=(*pCreateDevice7)(lpd3d, Guid, lpdds, lplpd3dd);
|
||||
if(res==DD_OK) break; // no error, break
|
||||
OutTraceE("CreateDevice(D3D7) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
if(!(dxw.dwFlags1 & EMULATESURFACE)) break; // no more tricks ....
|
||||
if(!(dxw.dwFlags1 & AUTOMATIC)) break;
|
||||
res=(*pCreateDevice7)(lpd3d, Guid, lpdds, lplpd3dd);
|
||||
|
||||
//OutTraceD3D("CreateDevice(D3D7): SYSMEMORY OFF\n");
|
||||
//dxw.dwFlags5 |= NOSYSTEMEMULATED;
|
||||
//res=(*pCreateDevice7)(lpd3d, Guid, lpdds, lplpd3dd);
|
||||
//if(res==DD_OK) break;
|
||||
//OutTraceE("CreateDevice(D3D7) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
//if(!(dxw.dwFlags1 & AUTOMATIC)) break;
|
||||
|
||||
OutTraceD3D("CreateDevice(D3D7): Emulation OFF\n");
|
||||
//dxw.dwFlags5 &= ~NOSYSTEMEMULATED;
|
||||
dxw.dwFlags1 &= ~EMULATESURFACE;
|
||||
dxw.dwFlags1 |= LOCKEDSURFACE;
|
||||
res=(*pCreateDevice7)(lpd3d, Guid, lpdds, lplpd3dd);
|
||||
if(res==DD_OK) break;
|
||||
OutTraceE("CreateDevice(D3D7) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
} while (FALSE);
|
||||
|
||||
if(res == DD_OK){
|
||||
OutTraceD3D("CreateDevice(D3D7): lpd3dd=%x\n", lpd3d, *lplpd3dd);
|
||||
HookDirect3DDevice((void **)lplpd3dd, 7);
|
||||
}
|
||||
else
|
||||
OutTraceE("CreateDevice(D3D7) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -618,8 +618,8 @@ BOOL WINAPI extInvalidateRect(HWND hwnd, RECT *lpRect, BOOL bErase)
|
||||
return (*pInvalidateRect)(hwnd, lpRect, bErase);
|
||||
}
|
||||
else{
|
||||
// just exagerate ...
|
||||
return (*pInvalidateRect)(hwnd, NULL, bErase);
|
||||
// don't exagerate ...
|
||||
return (*pInvalidateRect)(hwnd, lpRect, bErase);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1597,6 +1597,13 @@ HWND WINAPI extCreateWindowExW(
|
||||
}
|
||||
if(IsDebug) OutTrace("CreateWindowExW: DEBUG screen=(%d,%d)\n", dxw.GetScreenWidth(), dxw.GetScreenHeight());
|
||||
|
||||
if((dxw.dwFlags6 & STRETCHMOVIES) && !wcscmp(lpWindowName, L"ActiveMovie Window")){
|
||||
RECT MainWin;
|
||||
(*pGetClientRect)(dxw.GethWnd(), &MainWin);
|
||||
nWidth = MainWin.right;
|
||||
nHeight = MainWin.bottom;
|
||||
}
|
||||
|
||||
return extCreateWindowCommon("CreateWindowExW", TRUE, dwExStyle, (void *)lpClassName, (void *)lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
|
||||
}
|
||||
|
||||
@ -1632,6 +1639,13 @@ HWND WINAPI extCreateWindowExA(
|
||||
}
|
||||
if(IsDebug) OutTrace("CreateWindowExA: DEBUG screen=(%d,%d)\n", dxw.GetScreenWidth(), dxw.GetScreenHeight());
|
||||
|
||||
if((dxw.dwFlags6 & STRETCHMOVIES) && !strcmp(lpWindowName, "ActiveMovie Window")){
|
||||
RECT MainWin;
|
||||
(*pGetClientRect)(dxw.GethWnd(), &MainWin);
|
||||
nWidth = MainWin.right;
|
||||
nHeight = MainWin.bottom;
|
||||
}
|
||||
|
||||
return extCreateWindowCommon("CreateWindowExA", FALSE, dwExStyle, (void *)lpClassName, (void *)lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
|
||||
}
|
||||
|
||||
@ -1730,6 +1744,7 @@ int WINAPI extFillRect(HDC hdc, const RECT *lprc, HBRUSH hbr)
|
||||
return (*pFillRect)(hdc, &rc, hbr);
|
||||
}
|
||||
|
||||
#if 0
|
||||
if(OBJ_DC == GetObjectType(hdc)){
|
||||
if(rc.left < 0) rc.left = 0;
|
||||
if(rc.top < 0) rc.top = 0;
|
||||
@ -1742,6 +1757,20 @@ int WINAPI extFillRect(HDC hdc, const RECT *lprc, HBRUSH hbr)
|
||||
|
||||
res=(*pFillRect)(hdc, &rc, hbr);
|
||||
return res;
|
||||
#else
|
||||
{
|
||||
HWND hwnd;
|
||||
hwnd = WindowFromDC(hdc);
|
||||
if(hwnd != dxw.GethWnd()){
|
||||
OutTraceDW("FillRect: unfixed rect\n");
|
||||
}
|
||||
else {
|
||||
dxw.MapClient(&rc);
|
||||
}
|
||||
}
|
||||
res=(*pFillRect)(hdc, &rc, hbr);
|
||||
return res;
|
||||
#endif
|
||||
}
|
||||
|
||||
int WINAPI extFrameRect(HDC hdc, const RECT *lprc, HBRUSH hbr)
|
||||
@ -2052,6 +2081,31 @@ int WINAPI extGDIReleaseDC(HWND hwnd, HDC hDC)
|
||||
if(!lpDDSPrim) return(TRUE);
|
||||
OutTraceDW("GDI.ReleaseDC: releasing flipped GDI hdc=%x\n", hDC);
|
||||
ret=(*pReleaseDC)(dxwss.GetPrimarySurface(), hDC);
|
||||
if (!(hwnd == dxw.GethWnd())) {
|
||||
POINT father, child, offset;
|
||||
RECT rect;
|
||||
HDC hdc;
|
||||
father.x = father.y = 0;
|
||||
child.x = child.y = 0;
|
||||
(*pClientToScreen)(dxw.GethWnd(),&father);
|
||||
(*pClientToScreen)(hwnd,&child);
|
||||
offset.x = child.x - father.x;
|
||||
offset.y = child.y - father.y;
|
||||
if(offset.x || offset.y){
|
||||
// if the graphis was blitted to primary but below a modal child window,
|
||||
// bring that up to the window surface to make it visible.
|
||||
BOOL ret2;
|
||||
(*pGetClientRect)(hwnd, &rect);
|
||||
hdc=(*pGDIGetDC)(hwnd);
|
||||
if(!hdc) OutTrace("GDI.ReleaseDC: GetDC ERROR=%d at %d\n", GetLastError(), __LINE__);
|
||||
ret2=(*pGDIBitBlt)(hdc, rect.left, rect.top, rect.right, rect.bottom, hDC, offset.x, offset.y, SRCCOPY);
|
||||
if(!ret2) OutTrace("GDI.ReleaseDC: BitBlt ERROR=%d at %d\n", GetLastError(), __LINE__);
|
||||
ret2=(*pGDIReleaseDC)(hwnd, hdc);
|
||||
if(!ret2)OutTrace("GDI.ReleaseDC: ReleaseDC ERROR=%d at %d\n", GetLastError(), __LINE__);
|
||||
// this may flicker ....
|
||||
(*pInvalidateRect)(hwnd, NULL, FALSE);
|
||||
}
|
||||
}
|
||||
if (ret) OutTraceE("GDI.ReleaseDC ERROR: err=%x(%s) at %d\n", ret, ExplainDDError(ret), __LINE__);
|
||||
else dxw.ScreenRefresh();
|
||||
return (ret == DD_OK);
|
||||
@ -2088,7 +2142,8 @@ HDC WINAPI extBeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint)
|
||||
if(!dxw.IsFullScreen()) return hdc;
|
||||
|
||||
// on CLIENTREMAPPING, resize the paint area to virtual screen size
|
||||
if(dxw.dwFlags1 & CLIENTREMAPPING) lpPaint->rcPaint=dxw.GetScreenRect();
|
||||
//if(dxw.dwFlags1 & CLIENTREMAPPING) lpPaint->rcPaint=dxw.GetScreenRect();
|
||||
if(dxw.dwFlags1 & CLIENTREMAPPING) dxw.UnmapClient(&(lpPaint->rcPaint));
|
||||
|
||||
switch(GDIEmulationMode){
|
||||
case GDIMODE_STRETCHED:
|
||||
@ -2149,6 +2204,7 @@ HWND WINAPI extCreateDialogIndirectParam(HINSTANCE hInstance, LPCDLGTEMPLATE lpT
|
||||
lpTemplate->style, lpTemplate->dwExtendedStyle, lpTemplate->cdit, lpTemplate->x, lpTemplate->y, lpTemplate->cx, lpTemplate->cy,
|
||||
hWndParent, lpDialogFunc, lParamInit);
|
||||
if(dxw.IsFullScreen() && hWndParent==NULL) hWndParent=dxw.GethWnd();
|
||||
dxw.SetFullScreen(FALSE);
|
||||
RetHWND=(*pCreateDialogIndirectParam)(hInstance, lpTemplate, hWndParent, lpDialogFunc, lParamInit);
|
||||
dxw.SetFullScreen(FullScreen);
|
||||
|
||||
@ -2171,6 +2227,7 @@ HWND WINAPI extCreateDialogParam(HINSTANCE hInstance, LPCTSTR lpTemplateName, HW
|
||||
OutTraceDW("CreateDialogParam: hInstance=%x lpTemplateName=%s hWndParent=%x lpDialogFunc=%x lParamInit=%x\n",
|
||||
hInstance, sTemplateName(lpTemplateName), hWndParent, lpDialogFunc, lParamInit);
|
||||
if(hWndParent==NULL) hWndParent=dxw.GethWnd();
|
||||
dxw.SetFullScreen(FALSE);
|
||||
RetHWND=(*pCreateDialogParam)(hInstance, lpTemplateName, hWndParent, lpDialogFunc, lParamInit);
|
||||
dxw.SetFullScreen(FullScreen);
|
||||
|
||||
@ -2390,9 +2447,9 @@ int WINAPI extDrawTextA(HDC hdc, LPCTSTR lpchText, int nCount, LPRECT lpRect, UI
|
||||
OutTraceDW("DrawText: fixed rect=(%d,%d)-(%d,%d)\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
|
||||
}
|
||||
|
||||
gFixed = TRUE;
|
||||
gFixed = TRUE;
|
||||
ret=(*pDrawText)(hdc, lpchText, nCount, lpRect, uFormat);
|
||||
gFixed=FALSE;
|
||||
gFixed = FALSE;
|
||||
|
||||
// if nCount is zero, DrawRect returns 0 as text heigth, but this is not an error! (ref. "Imperialism II")
|
||||
if(nCount && !ret) OutTraceE("DrawText: ERROR ret=%x err=%d\n", ret, GetLastError());
|
||||
@ -2430,7 +2487,7 @@ int WINAPI extDrawTextExA(HDC hdc, LPTSTR lpchText, int nCount, LPRECT lpRect, U
|
||||
|
||||
gFixed = TRUE;
|
||||
ret=(*pDrawTextEx)(hdc, lpchText, nCount, lpRect, dwDTFormat, lpDTParams);
|
||||
gFixed=FALSE;
|
||||
gFixed = FALSE;
|
||||
if(nCount && !ret) OutTraceE("DrawTextEx: ERROR ret=%x err=%d\n", ret, GetLastError());
|
||||
|
||||
if (MustScale){
|
||||
|
3099
dll/user32.old.cpp
Normal file
3099
dll/user32.old.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -115,6 +115,8 @@ MCIERROR WINAPI extmciSendCommand(mciSendCommand_Type pmciSendCommand, MCIDEVICE
|
||||
OutTraceDW("mciSendCommand: IDDevice=%x msg=%x(%s) Command=%x(%s)\n",
|
||||
IDDevice, uMsg, ExplainMCICommands(uMsg), fdwCommand, ExplainMCIFlags(uMsg, fdwCommand));
|
||||
|
||||
if(dxw.dwFlags6 && BYPASSMCI) return 0;
|
||||
|
||||
if(dxw.IsFullScreen()){
|
||||
switch(uMsg){
|
||||
case MCI_WINDOW:
|
||||
|
@ -42,7 +42,6 @@ void CTabDebug::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Check(pDX, IDC_NODDRAWBLT, cTarget->m_NoDDRAWBlt);
|
||||
DDX_Check(pDX, IDC_NODDRAWFLIP, cTarget->m_NoDDRAWFlip);
|
||||
DDX_Check(pDX, IDC_NOGDIBLT, cTarget->m_NoGDIBlt);
|
||||
DDX_Check(pDX, IDC_NOFILLRECT, cTarget->m_NoFillRect);
|
||||
DDX_Check(pDX, IDC_ZBUFFERALWAYS, cTarget->m_ZBufferAlways);
|
||||
DDX_Check(pDX, IDC_HOTPATCHALWAYS, cTarget->m_HotPatchAlways);
|
||||
DDX_Check(pDX, IDC_FREEZEINJECTEDSON, cTarget->m_FreezeInjectedSon);
|
||||
|
@ -27,7 +27,7 @@ void CTabDirectX::DoDataExchange(CDataExchange* pDX)
|
||||
CDialog::DoDataExchange(pDX);
|
||||
CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent()));
|
||||
DDX_Radio(pDX, IDC_AUTO, cTarget->m_DXVersion);
|
||||
DDX_Radio(pDX, IDC_AUTOMATIC, cTarget->m_DxEmulationMode);
|
||||
DDX_Radio(pDX, IDC_NOEMULATESURFACE, cTarget->m_DxEmulationMode);
|
||||
DDX_Radio(pDX, IDC_DDRAWFILTER, cTarget->m_DxFilterMode);
|
||||
DDX_Check(pDX, IDC_SUPPRESSCLIPPING, cTarget->m_SuppressClipping);
|
||||
DDX_Check(pDX, IDC_BLITFROMBACKBUFFER, cTarget->m_BlitFromBackBuffer);
|
||||
|
@ -32,6 +32,7 @@ void CTabSysLibs::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Radio(pDX, IDC_GDINONE, cTarget->m_DCEmulationMode);
|
||||
DDX_Check(pDX, IDC_FIXTEXTOUT, cTarget->m_FixTextOut);
|
||||
DDX_Check(pDX, IDC_SHAREDDC, cTarget->m_SharedDC);
|
||||
DDX_Check(pDX, IDC_NOFILLRECT, cTarget->m_NoFillRect);
|
||||
|
||||
// OpenGL
|
||||
DDX_Check(pDX, IDC_HOOKOPENGL, cTarget->m_HookOpenGL); // duplicated
|
||||
@ -44,7 +45,9 @@ void CTabSysLibs::DoDataExchange(CDataExchange* pDX)
|
||||
// MCI
|
||||
DDX_Check(pDX, IDC_REMAPMCI, cTarget->m_RemapMCI);
|
||||
DDX_Check(pDX, IDC_NOMOVIES, cTarget->m_NoMovies);
|
||||
DDX_Check(pDX, IDC_STRETCHMOVIES, cTarget->m_StretchMovies);
|
||||
DDX_Check(pDX, IDC_FIXMOVIESCOLOR, cTarget->m_FixMoviesColor);
|
||||
DDX_Check(pDX, IDC_BYPASSMCI, cTarget->m_BypassMCI);
|
||||
|
||||
// Kernel32
|
||||
DDX_Radio(pDX, IDC_SONDEFAULT, cTarget->m_SonProcessMode);
|
||||
|
@ -22,7 +22,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
|
||||
//{{AFX_DATA_INIT(CTargetDlg)
|
||||
m_DXVersion = 0;
|
||||
m_Coordinates = 0;
|
||||
m_DxEmulationMode = 4; // default: AUTOMATIC
|
||||
m_DxEmulationMode = 3; // default: emulated
|
||||
m_DxFilterMode = 0; // default: ddraw filtering
|
||||
m_DCEmulationMode = 0; // default: no emulation
|
||||
m_MouseVisibility = 0;
|
||||
@ -127,6 +127,8 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
|
||||
m_RemapMCI = TRUE;
|
||||
m_NoMovies = FALSE;
|
||||
m_FixMoviesColor = FALSE;
|
||||
m_StretchMovies = FALSE;
|
||||
m_BypassMCI = FALSE;
|
||||
m_SuppressRelease = FALSE;
|
||||
m_KeepCursorWithin = FALSE;
|
||||
m_KeepCursorFixed = FALSE;
|
||||
@ -225,6 +227,7 @@ BOOL CTargetDlg::OnInitDialog()
|
||||
m_tabdxTabCtrl.InsertItem(i++, _T("Log"));
|
||||
m_tabdxTabCtrl.InsertItem(i++, _T("Libs"));
|
||||
m_tabdxTabCtrl.InsertItem(i++, _T("Compat"));
|
||||
m_tabdxTabCtrl.InsertItem(i++, _T("Registry"));
|
||||
m_tabdxTabCtrl.InsertItem(i++, _T("Notes"));
|
||||
if (gbDebug) m_tabdxTabCtrl.InsertItem(i++, _T("Debug"));
|
||||
#else
|
||||
|
@ -50,7 +50,6 @@ public:
|
||||
BOOL m_ImportTable;
|
||||
BOOL m_RegistryOp;
|
||||
BOOL m_TraceHooks;
|
||||
//BOOL m_HandleDC;
|
||||
BOOL m_UnNotify;
|
||||
BOOL m_Windowize;
|
||||
BOOL m_HotPatch;
|
||||
@ -95,6 +94,8 @@ public:
|
||||
BOOL m_RemapMCI;
|
||||
BOOL m_NoMovies;
|
||||
BOOL m_FixMoviesColor;
|
||||
BOOL m_StretchMovies;
|
||||
BOOL m_BypassMCI;
|
||||
BOOL m_SuppressRelease;
|
||||
BOOL m_KeepCursorWithin;
|
||||
BOOL m_KeepCursorFixed;
|
||||
|
@ -16,7 +16,7 @@ class CDXTabCtrl : public CTabCtrl
|
||||
// Construction
|
||||
public:
|
||||
CDXTabCtrl();
|
||||
CDialog *m_tabPages[11];
|
||||
CDialog *m_tabPages[12]; // this must match the total number of tab elements!
|
||||
int m_tabCurrent;
|
||||
int m_nNumberOfPages;
|
||||
enum { IDD = IDC_TABPANEL };
|
||||
|
38
host/dxwnd.ini
Normal file
38
host/dxwnd.ini
Normal file
@ -0,0 +1,38 @@
|
||||
[window]
|
||||
exportpath=D:\DxWnd\exports.wip\
|
||||
posx=880
|
||||
posy=437
|
||||
sizx=320
|
||||
sizy=200
|
||||
[target]
|
||||
title0=Star Trek Armada
|
||||
path0=D:\Games\armada_demo\Armada.exe
|
||||
launchpath0=
|
||||
module0=
|
||||
opengllib0=
|
||||
notes0=
|
||||
registry0=ciao\n
|
||||
ver0=0
|
||||
coord0=0
|
||||
flag0=-2011168669
|
||||
flagg0=1543503872
|
||||
flagh0=98320
|
||||
flagi0=136314884
|
||||
flagj0=4224
|
||||
flagk0=327680
|
||||
tflag0=0
|
||||
initx0=0
|
||||
inity0=0
|
||||
minx0=0
|
||||
miny0=0
|
||||
maxx0=0
|
||||
maxy0=0
|
||||
posx0=100
|
||||
posy0=100
|
||||
sizx0=800
|
||||
sizy0=600
|
||||
maxfps0=0
|
||||
initts0=0
|
||||
winver0=0
|
||||
maxres0=-1
|
||||
swapeffect0=0
|
Binary file not shown.
@ -30,8 +30,8 @@ typedef struct PRIVATEMAP
|
||||
{
|
||||
char title[MAX_TITLE+1];
|
||||
char launchpath[MAX_PATH+1];
|
||||
char notes[MAX_NOTES+1];
|
||||
char registry[MAX_REGISTRY+1];
|
||||
char *notes;
|
||||
char *registry;
|
||||
}PRIVATEMAP;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
Binary file not shown.
@ -1,20 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dxwndhost", "dxwndhost.vs2008.vcproj", "{FD0B0234-8EC5-43C0-A384-1B881DD3D925}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Binary file not shown.
@ -43,31 +43,33 @@ char *strnncpy(char *dest, char *src, size_t count)
|
||||
return strncpy(dest, src, count);
|
||||
}
|
||||
|
||||
static char *Escape(char *s)
|
||||
static char *Escape(char *s, char **dest)
|
||||
{
|
||||
static char tmp[2048];
|
||||
char *t = tmp;
|
||||
if(!*dest) *dest=(char *)malloc(strlen(s)+100);
|
||||
else *dest=(char *)realloc(*dest, strlen(s)+100);
|
||||
char *t = *dest;
|
||||
for(; *s; s++){
|
||||
if(*s=='\n'){
|
||||
*t++ = '\\';
|
||||
*t++ = 'n';
|
||||
}
|
||||
else{
|
||||
if(*s == '\r'){
|
||||
}
|
||||
else{
|
||||
switch(*s){
|
||||
case '\n':
|
||||
*t++ = '\\';
|
||||
*t++ = 'n';
|
||||
break;
|
||||
case '\r':
|
||||
break;
|
||||
default:
|
||||
*t++ = *s;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
*t=0;
|
||||
return tmp;
|
||||
return *dest;
|
||||
}
|
||||
|
||||
static char *Unescape(char *s)
|
||||
static char *Unescape(char *s, char **dest)
|
||||
{
|
||||
static char tmp[2048];
|
||||
char *t = tmp;
|
||||
if(!*dest) *dest=(char *)malloc(strlen(s)+100);
|
||||
else *dest=(char *)realloc(*dest, strlen(s)+100);
|
||||
char *t = *dest;
|
||||
for(; *s; s++){
|
||||
if((*s=='\\') && (*(s+1)=='n')){
|
||||
*t++ = '\r';
|
||||
@ -79,9 +81,10 @@ static char *Unescape(char *s)
|
||||
}
|
||||
}
|
||||
*t=0;
|
||||
return tmp;
|
||||
return *dest;
|
||||
}
|
||||
|
||||
|
||||
void GetFolderFromPath(char *path)
|
||||
{
|
||||
for(char *c=&path[strlen(path)-1]; (c>path) && (*c!='\\'); c--) *c=0;
|
||||
@ -192,13 +195,13 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
|
||||
if(dlg->m_MessagePump) t->flags5 |= MESSAGEPUMP;
|
||||
|
||||
switch(dlg->m_DxEmulationMode){
|
||||
case 0: t->flags |= AUTOMATIC; break;
|
||||
case 1: break;
|
||||
case 2: t->flags |= EMULATEBUFFER; break;
|
||||
case 3: t->flags |= LOCKEDSURFACE; break;
|
||||
case 4: t->flags |= EMULATESURFACE; break;
|
||||
case 5: t->flags5 |= HYBRIDMODE; break;
|
||||
case 6: t->flags5 |= GDIMODE; break;
|
||||
//case 0: t->flags |= AUTOMATIC; break;
|
||||
case 0: break;
|
||||
case 1: t->flags |= EMULATEBUFFER; break;
|
||||
case 2: t->flags |= LOCKEDSURFACE; break;
|
||||
case 3: t->flags |= EMULATESURFACE; break;
|
||||
case 4: t->flags5 |= HYBRIDMODE; break;
|
||||
case 5: t->flags5 |= GDIMODE; break;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -324,6 +327,8 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
|
||||
if(dlg->m_RemapMCI) t->flags5 |= REMAPMCI;
|
||||
if(dlg->m_NoMovies) t->flags6 |= NOMOVIES;
|
||||
if(dlg->m_FixMoviesColor) t->flags6 |= FIXMOVIESCOLOR;
|
||||
if(dlg->m_StretchMovies) t->flags6 |= STRETCHMOVIES;
|
||||
if(dlg->m_BypassMCI) t->flags6 |= BYPASSMCI;
|
||||
if(dlg->m_SuppressRelease) t->flags6 |= SUPPRESSRELEASE;
|
||||
if(dlg->m_KeepCursorWithin) t->flags |= KEEPCURSORWITHIN;
|
||||
if(dlg->m_KeepCursorFixed) t->flags2 |= KEEPCURSORFIXED;
|
||||
@ -436,13 +441,13 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
|
||||
dlg->m_NoWinPosChanges = t->flags5 & NOWINPOSCHANGES ? 1 : 0;
|
||||
dlg->m_MessagePump = t->flags5 & MESSAGEPUMP ? 1 : 0;
|
||||
|
||||
dlg->m_DxEmulationMode = 1; // none
|
||||
if(t->flags & AUTOMATIC) dlg->m_DxEmulationMode = 0;
|
||||
if(t->flags & EMULATEBUFFER) dlg->m_DxEmulationMode = 2;
|
||||
if(t->flags & LOCKEDSURFACE) dlg->m_DxEmulationMode = 3;
|
||||
if(t->flags & EMULATESURFACE) dlg->m_DxEmulationMode = 4;
|
||||
if(t->flags5 & HYBRIDMODE) dlg->m_DxEmulationMode = 5;
|
||||
if(t->flags5 & GDIMODE) dlg->m_DxEmulationMode = 6;
|
||||
dlg->m_DxEmulationMode = 0; // none
|
||||
//if(t->flags & AUTOMATIC) dlg->m_DxEmulationMode = 0;
|
||||
if(t->flags & EMULATEBUFFER) dlg->m_DxEmulationMode = 1;
|
||||
if(t->flags & LOCKEDSURFACE) dlg->m_DxEmulationMode = 2;
|
||||
if(t->flags & EMULATESURFACE) dlg->m_DxEmulationMode = 3;
|
||||
if(t->flags5 & HYBRIDMODE) dlg->m_DxEmulationMode = 4;
|
||||
if(t->flags5 & GDIMODE) dlg->m_DxEmulationMode = 5;
|
||||
|
||||
dlg->m_DxFilterMode = 0;
|
||||
if(t->flags4 & BILINEAR2XFILTER) dlg->m_DxFilterMode = 1;
|
||||
@ -556,6 +561,8 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
|
||||
dlg->m_RemapMCI = t->flags5 & REMAPMCI ? 1 : 0;
|
||||
dlg->m_NoMovies = t->flags6 & NOMOVIES ? 1 : 0;
|
||||
dlg->m_FixMoviesColor = t->flags6 & FIXMOVIESCOLOR ? 1 : 0;
|
||||
dlg->m_StretchMovies = t->flags6 & STRETCHMOVIES ? 1 : 0;
|
||||
dlg->m_BypassMCI = t->flags6 & BYPASSMCI ? 1 : 0;
|
||||
dlg->m_SuppressRelease = t->flags6 & SUPPRESSRELEASE ? 1 : 0;
|
||||
dlg->m_KeepCursorWithin = t->flags & KEEPCURSORWITHIN ? 1 : 0;
|
||||
dlg->m_KeepCursorFixed = t->flags2 & KEEPCURSORFIXED ? 1 : 0;
|
||||
@ -642,6 +649,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
|
||||
static void SaveConfigItem(TARGETMAP *TargetMap, PRIVATEMAP *PrivateMap, int i, char *InitPath)
|
||||
{
|
||||
char key[32], val[32];
|
||||
char *EscBuf = NULL;
|
||||
sprintf_s(key, sizeof(key), "title%i", i);
|
||||
WritePrivateProfileString("target", key, PrivateMap->title, InitPath);
|
||||
sprintf_s(key, sizeof(key), "path%i", i);
|
||||
@ -653,9 +661,9 @@ static void SaveConfigItem(TARGETMAP *TargetMap, PRIVATEMAP *PrivateMap, int i,
|
||||
sprintf_s(key, sizeof(key), "opengllib%i", i);
|
||||
WritePrivateProfileString("target", key, TargetMap->OpenGLLib, InitPath);
|
||||
sprintf_s(key, sizeof(key), "notes%i", i);
|
||||
WritePrivateProfileString("target", key, Escape(PrivateMap->notes), InitPath);
|
||||
WritePrivateProfileString("target", key, Escape(PrivateMap->notes, &EscBuf), InitPath);
|
||||
sprintf_s(key, sizeof(key), "registry%i", i);
|
||||
WritePrivateProfileString("target", key, Escape(PrivateMap->registry), InitPath);
|
||||
WritePrivateProfileString("target", key, Escape(PrivateMap->registry, &EscBuf), InitPath);
|
||||
sprintf_s(key, sizeof(key), "ver%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->dxversion);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
@ -729,6 +737,9 @@ static void SaveConfigItem(TARGETMAP *TargetMap, PRIVATEMAP *PrivateMap, int i,
|
||||
sprintf_s(key, sizeof(key), "swapeffect%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->SwapEffect);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
|
||||
free(EscBuf);
|
||||
EscBuf = NULL;
|
||||
}
|
||||
|
||||
static void ClearTarget(int i, char *InitPath)
|
||||
@ -796,70 +807,108 @@ static void ClearTarget(int i, char *InitPath)
|
||||
static int LoadConfigItem(TARGETMAP *TargetMap, PRIVATEMAP *PrivateMap, int i, char *InitPath)
|
||||
{
|
||||
char key[32];
|
||||
char *EscBuf = NULL;
|
||||
char *sBuf;
|
||||
sBuf = (char *)malloc(1000000);
|
||||
extern BOOL gbDebug;
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "path%i", i);
|
||||
GetPrivateProfileString("target", key, "", TargetMap->path, MAX_PATH, InitPath);
|
||||
if(!TargetMap->path[0]) return FALSE;
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "launchpath%i", i);
|
||||
GetPrivateProfileString("target", key, "", PrivateMap->launchpath, MAX_PATH, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "title%i", i);
|
||||
GetPrivateProfileString("target", key, "", PrivateMap->title, sizeof(PRIVATEMAP)-1, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "module%i", i);
|
||||
GetPrivateProfileString("target", key, "", TargetMap->module, sizeof(TargetMap->module)-1, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "opengllib%i", i);
|
||||
GetPrivateProfileString("target", key, "", TargetMap->OpenGLLib, sizeof(TargetMap->OpenGLLib)-1, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "notes%i", i);
|
||||
GetPrivateProfileString("target", key, "", PrivateMap->notes, MAX_NOTES, InitPath);
|
||||
strcpy(PrivateMap->notes, Unescape(PrivateMap->notes));
|
||||
GetPrivateProfileString("target", key, "", sBuf, 1000000, InitPath);
|
||||
Unescape(sBuf, &EscBuf);
|
||||
PrivateMap->notes = (char *)malloc(strlen(EscBuf)+1);
|
||||
strcpy(PrivateMap->notes, EscBuf);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "registry%i", i);
|
||||
GetPrivateProfileString("target", key, "", PrivateMap->registry, MAX_NOTES, InitPath);
|
||||
strcpy(PrivateMap->registry, Unescape(PrivateMap->registry));
|
||||
GetPrivateProfileString("target", key, "", sBuf, 1000000, InitPath);
|
||||
Unescape(sBuf, &EscBuf);
|
||||
PrivateMap->registry = (char *)malloc(strlen(EscBuf)+1);
|
||||
strcpy(PrivateMap->registry, EscBuf);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "ver%i", i);
|
||||
TargetMap->dxversion = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "coord%i", i);
|
||||
TargetMap->coordinates = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "flag%i", i);
|
||||
TargetMap->flags = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "flagg%i", i);
|
||||
TargetMap->flags2 = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "flagh%i", i);
|
||||
TargetMap->flags3 = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "flagi%i", i);
|
||||
TargetMap->flags4 = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "flagj%i", i);
|
||||
TargetMap->flags5 = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "flagk%i", i);
|
||||
TargetMap->flags6 = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "tflag%i", i);
|
||||
TargetMap->tflags = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "initx%i", i);
|
||||
TargetMap->initx = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "inity%i", i);
|
||||
TargetMap->inity = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "minx%i", i);
|
||||
TargetMap->minx = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "miny%i", i);
|
||||
TargetMap->miny = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "maxx%i", i);
|
||||
TargetMap->maxx = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "maxy%i", i);
|
||||
TargetMap->maxy = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "posx%i", i);
|
||||
TargetMap->posx = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "posy%i", i);
|
||||
TargetMap->posy = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "sizx%i", i);
|
||||
TargetMap->sizx = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "sizy%i", i);
|
||||
TargetMap->sizy = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "maxfps%i", i);
|
||||
TargetMap->MaxFPS = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "initts%i", i);
|
||||
TargetMap->InitTS = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "swapeffect%i", i);
|
||||
TargetMap->SwapEffect = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "winver%i", i);
|
||||
TargetMap->FakeVersionId = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
// -------
|
||||
sprintf_s(key, sizeof(key), "maxres%i", i);
|
||||
TargetMap->MaxScreenRes = GetPrivateProfileInt("target", key, 0, InitPath);
|
||||
|
||||
@ -867,8 +916,10 @@ static int LoadConfigItem(TARGETMAP *TargetMap, PRIVATEMAP *PrivateMap, int i, c
|
||||
// clear debug flags
|
||||
TargetMap->flags &= ~(0);
|
||||
TargetMap->flags3 &= ~(YUV2RGB|RGB2YUV|SURFACEWARN|ANALYTICMODE|NODDRAWBLT|NODDRAWFLIP|NOGDIBLT);
|
||||
TargetMap->flags4 &= ~(NOFILLRECT);
|
||||
}
|
||||
free(EscBuf);
|
||||
EscBuf = NULL;
|
||||
free(sBuf);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1161,14 +1212,16 @@ void CDxwndhostView::OnModify()
|
||||
pos = listctrl.GetFirstSelectedItemPosition();
|
||||
i = listctrl.GetNextSelectedItem(pos);
|
||||
dlg.m_Title = PrivateMaps[i].title;
|
||||
dlg.m_Notes = PrivateMaps[i].notes;
|
||||
dlg.m_Registry = PrivateMaps[i].registry;
|
||||
dlg.m_Notes = CString(PrivateMaps[i].notes);
|
||||
dlg.m_Registry = CString(PrivateMaps[i].registry);
|
||||
dlg.m_LaunchPath = PrivateMaps[i].launchpath;
|
||||
SetDlgFromTarget(&TargetMaps[i], &dlg);
|
||||
if(dlg.DoModal() == IDOK && dlg.m_FilePath.GetLength()){
|
||||
strnncpy(PrivateMaps[i].title, (char *)dlg.m_Title.GetString(), MAX_TITLE);
|
||||
strnncpy(PrivateMaps[i].notes, (char *)dlg.m_Notes.GetString(), MAX_NOTES);
|
||||
strnncpy(PrivateMaps[i].registry, (char *)dlg.m_Registry.GetString(), MAX_REGISTRY);
|
||||
PrivateMaps[i].notes = (char *)realloc(PrivateMaps[i].notes, strlen(dlg.m_Notes.GetString())+1);
|
||||
strcpy(PrivateMaps[i].notes, (char *)dlg.m_Notes.GetString());
|
||||
PrivateMaps[i].registry = (char *)realloc(PrivateMaps[i].registry, strlen(dlg.m_Registry.GetString())+1);
|
||||
strcpy(PrivateMaps[i].registry, (char *)dlg.m_Registry.GetString());
|
||||
strnncpy(PrivateMaps[i].launchpath, (char *)dlg.m_LaunchPath.GetString(), MAX_PATH);
|
||||
SetTargetFromDlg(&TargetMaps[i], &dlg);
|
||||
CListCtrl& listctrl = GetListCtrl();
|
||||
@ -1285,7 +1338,7 @@ void CDxwndhostView::OnSetRegistry()
|
||||
int i;
|
||||
CTargetDlg dlg;
|
||||
POSITION pos;
|
||||
CString Registry;
|
||||
char *Registry;
|
||||
FILE *regfp;
|
||||
|
||||
CListCtrl& listctrl = GetListCtrl();
|
||||
@ -1301,7 +1354,7 @@ void CDxwndhostView::OnSetRegistry()
|
||||
return;
|
||||
}
|
||||
|
||||
fwrite(Registry.GetString(), Registry.GetLength(), 1, regfp);
|
||||
fwrite(Registry, strlen(Registry), 1, regfp);
|
||||
fclose(regfp);
|
||||
}
|
||||
|
||||
@ -1551,8 +1604,10 @@ void CDxwndhostView::OnAdd()
|
||||
memset(&TargetMaps[i],0,sizeof(TARGETMAP)); // clean up, just in case....
|
||||
if(dlg.DoModal() == IDOK && dlg.m_FilePath.GetLength()){
|
||||
strnncpy(PrivateMaps[i].title, (char *)dlg.m_Title.GetString(), MAX_TITLE);
|
||||
strnncpy(PrivateMaps[i].notes, (char *)dlg.m_Notes.GetString(), MAX_NOTES);
|
||||
strnncpy(PrivateMaps[i].registry, (char *)dlg.m_Registry.GetString(), MAX_REGISTRY);
|
||||
PrivateMaps[i].notes = (char *)malloc(strlen(dlg.m_Notes.GetString())+1);
|
||||
strcpy(PrivateMaps[i].notes, (char *)dlg.m_Notes.GetString());
|
||||
PrivateMaps[i].registry = (char *)malloc(strlen(dlg.m_Registry.GetString())+1);
|
||||
strcpy(PrivateMaps[i].registry, (char *)dlg.m_Registry.GetString());
|
||||
strnncpy(PrivateMaps[i].launchpath, (char *)dlg.m_LaunchPath.GetString(), MAX_PATH);
|
||||
SetTargetFromDlg(&TargetMaps[i], &dlg);
|
||||
CListCtrl& listctrl = GetListCtrl();
|
||||
|
BIN
host/resource
BIN
host/resource
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user