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

v2_02_69_src

Former-commit-id: c1edbb88ce2c054b9b2f6ad21d88c7a728bb6ba6
This commit is contained in:
gho tik 2014-06-04 12:39:04 -04:00 committed by Refael ACkermann
parent 54275fe767
commit 44e77fc107
21 changed files with 1040 additions and 95 deletions

View File

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

View File

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

View File

@ -0,0 +1,26 @@
[target]
title0=Final Odyssey
path0=D:\Games\Final odyssey\FinalOdy.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134267425
flagg0=134217728
flagh0=20
flagi0=4
tflag0=6146
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,26 @@
[target]
title0=Flying Heroes
path0=D:\Games\Flying_Heroes\fh.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=151011364
flagg0=1207959552
flagh0=20
flagi0=4
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,26 @@
[target]
title0=Forsaken (HW)
path0=D:\Games\Forsaken\ForsakenHW.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=411058208
flagg0=1207959808
flagh0=20
flagi0=4
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,26 @@
[target]
title0=Genocide (ORIGINAL)
path0=D:\Games\genocide\original vanilla (1998)\Genocide\genocide.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134218272
flagg0=1207959552
flagh0=20
flagi0=4
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,26 @@
[target]
title0=Genocide (REMIXED VERSION)
path0=D:\Games\genocide\remixed version (1999)\genocide\genocide.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=134218272
flagg0=1207959552
flagh0=20
flagi0=4
tflag0=6402
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,26 @@
[target]
title0=House of the Dead 2
path0=D:\Games\HOD2\Hod2.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=738197536
flagg0=1207959552
flagh0=20
flagi0=4
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,26 @@
[target]
title0=Hydro Thunder
path0=D:\Games\Hydro Thunder\hydro.exe
module0=
opengllib0=
ver0=0
coord0=0
flag0=704643104
flagg0=1207959552
flagh0=20
flagi0=4
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,26 @@
[target]
title0=Jazz Jackrabbit 2
path0=D:\Games\Jazz Jackrabbit 2\JAZZ2.EXE
module0=
opengllib0=
ver0=0
coord0=0
flag0=671097376
flagg0=1207959552
flagh0=20
flagi0=4
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,26 @@
[target]
title0=Star Wars Tie Fighter
path0=D:\Games\TIE95\TIE95.EXE
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217843
flagg0=1207959568
flagh0=20
flagi0=4261892
tflag0=6466
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=6
winver0=0
maxres0=-1

View File

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

View File

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

View File

@ -445,3 +445,7 @@ fixed logic for EnumDisplayModes implementation: now screen resolutions and, for
v2.02.68
added screen resolution choice: either a set of SVGA resolutions (mostly for 3:4 monitors), HDTV resolutions (mostly for 16:9 monitors) or the native set of resolutions offered by your monitor / video card.
v2.02.69
improved exception catching to intercept memory violation exceptions and to neutralize offending code. Thank again to olly didasm lib, now the assembly instruction length is automatically determined so that the opcode can be replaced by the correct number of NOP instructions. If this doesn't mean much for you, just consider that this makes playable the Win95 (patched) release of "Star Wars Tie Fighter".
fixed FillRect user32 call - brings some improvements to Imperialism (still far from being acceptable).

706
debug/dxwnd.ini Normal file
View File

@ -0,0 +1,706 @@
[target]
title0=Genocide
path0=D:\Games\genocide\genocide.exe
module0=
opengllib0=
ver0=0
coord0=1
flag0=268435490
flagg0=1207959552
flagh0=65556
flagi0=2097157
tflag0=6403
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1
title1=WarWind
path1=D:\Games\WarWind\WW.EXE
module1=
opengllib1=
ver1=0
coord1=0
flag1=134234656
flagg1=1207959552
flagh1=20
flagi1=4
tflag1=6403
initx1=0
inity1=0
minx1=0
miny1=0
maxx1=0
maxy1=0
posx1=50
posy1=50
sizx1=800
sizy1=600
maxfps1=0
initts1=0
winver1=0
maxres1=-1
title2=Galapagos
path2=D:\Games\Galapagos\GALA.EXE
module2=
opengllib2=
ver2=0
coord2=0
flag2=671090720
flagg2=1207959552
flagh2=20
flagi2=4
tflag2=0
initx2=0
inity2=0
minx2=0
miny2=0
maxx2=0
maxy2=0
posx2=50
posy2=50
sizx2=800
sizy2=600
maxfps2=0
initts2=0
winver2=0
maxres2=-1
title3=Vangers
path3=D:\Games\Vangers\road.exe
module3=
opengllib3=
ver3=1
coord3=0
flag3=136315424
flagg3=1207959552
flagh3=20
flagi3=524288
tflag3=0
initx3=0
inity3=0
minx3=0
miny3=0
maxx3=0
maxy3=0
posx3=50
posy3=50
sizx3=800
sizy3=600
maxfps3=0
initts3=0
winver3=0
maxres3=-1
title4=House of the Dead 2
path4=*Hod2.exe
module4=
opengllib4=
ver4=0
coord4=0
flag4=754974752
flagg4=1207959552
flagh4=20
flagi4=4
tflag4=0
initx4=0
inity4=0
minx4=0
miny4=0
maxx4=0
maxy4=0
posx4=50
posy4=50
sizx4=800
sizy4=600
maxfps4=0
initts4=0
winver4=0
maxres4=-1
title5=House of the Dead
path5=D:\Games\house of the dead\thotd.exe
module5=
opengllib5=
ver5=0
coord5=0
flag5=671089184
flagg5=1207959680
flagh5=4
flagi5=4
tflag5=6147
initx5=0
inity5=0
minx5=0
miny5=0
maxx5=0
maxy5=0
posx5=50
posy5=50
sizx5=800
sizy5=600
maxfps5=0
initts5=0
winver5=0
maxres5=-1
title6=5th Element
path6=D:\Games\5th Element\PC.EXE
module6=
opengllib6=
ver6=0
coord6=0
flag6=134217760
flagg6=1207959552
flagh6=4
flagi6=4
tflag6=6147
initx6=0
inity6=0
minx6=0
miny6=0
maxx6=0
maxy6=0
posx6=50
posy6=50
sizx6=800
sizy6=600
maxfps6=0
initts6=0
winver6=0
maxres6=-1
title7=Hydro Thunder
path7=D:\Games\Hydro Thunder\hydro.exe
module7=
opengllib7=
ver7=0
coord7=0
flag7=671088672
flagg7=1207959552
flagh7=20
flagi7=4
tflag7=0
initx7=0
inity7=0
minx7=0
miny7=0
maxx7=0
maxy7=0
posx7=50
posy7=50
sizx7=800
sizy7=600
maxfps7=0
initts7=0
winver7=0
maxres7=-1
title8=Warcraft II BNE
path8=*Warcraft II BNE.exe
module8=
opengllib8=
ver8=0
coord8=0
flag8=134218272
flagg8=1207959552
flagh8=20
flagi8=4
tflag8=0
initx8=0
inity8=0
minx8=0
miny8=0
maxx8=0
maxy8=0
posx8=50
posy8=50
sizx8=800
sizy8=600
maxfps8=0
initts8=0
winver8=0
maxres8=-1
title9=Virtua Fighter PC
path9=D:\Games\Virtua Fighter\VFPC.EXE
module9=
opengllib9=
ver9=0
coord9=0
flag9=134218272
flagg9=134217744
flagh9=20
flagi9=4
tflag9=0
initx9=0
inity9=0
minx9=0
miny9=0
maxx9=0
maxy9=0
posx9=50
posy9=50
sizx9=800
sizy9=600
maxfps9=0
initts9=0
winver9=0
maxres9=-1
title10=Total Soccer 2000 (DirectX)
path10=D:\Games\Total Soccer 2000\SOCCERDX.EXE
module10=
opengllib10=
ver10=1
coord10=0
flag10=134234784
flagg10=1208025344
flagh10=20
flagi10=12
tflag10=0
initx10=0
inity10=0
minx10=0
miny10=0
maxx10=0
maxy10=0
posx10=50
posy10=50
sizx10=800
sizy10=600
maxfps10=0
initts10=2
winver10=0
maxres10=-1
title11=Genocide (ORIGINAL FIXED)
path11=D:\Games\genocide\original vanilla (1998)\Genocide\genocide.exe
module11=
opengllib11=
ver11=0
coord11=0
flag11=134218272
flagg11=1207959552
flagh11=20
flagi11=4
tflag11=6403
initx11=0
inity11=0
minx11=0
miny11=0
maxx11=0
maxy11=0
posx11=50
posy11=50
sizx11=800
sizy11=600
maxfps11=0
initts11=0
winver11=0
maxres11=-1
title12=Genocide (ORIGINAL BUGGED)
path12=D:\Games\genocide\original vanilla (1998)\Genocide\genocide.orig.exe
module12=
opengllib12=
ver12=0
coord12=0
flag12=134218272
flagg12=1207959552
flagh12=20
flagi12=4
tflag12=0
initx12=0
inity12=0
minx12=0
miny12=0
maxx12=0
maxy12=0
posx12=50
posy12=50
sizx12=800
sizy12=600
maxfps12=0
initts12=0
winver12=0
maxres12=-1
title13=Genocide (REMIXED VERSION)
path13=D:\Games\genocide\remixed version (1999)\genocide\genocide.exe
module13=
opengllib13=
ver13=0
coord13=0
flag13=134218272
flagg13=1207959552
flagh13=20
flagi13=4194308
tflag13=6403
initx13=0
inity13=0
minx13=0
miny13=0
maxx13=0
maxy13=0
posx13=50
posy13=50
sizx13=800
sizy13=600
maxfps13=0
initts13=0
winver13=0
maxres13=-1
title14=Final Fantasy VII
path14=D:\Games\Final Fantasy 7\ff7.exe
module14=
opengllib14=
ver14=0
coord14=0
flag14=713032224
flagg14=1208090880
flagh14=65541
flagi14=4194308
tflag14=6147
initx14=0
inity14=0
minx14=0
miny14=0
maxx14=0
maxy14=0
posx14=50
posy14=50
sizx14=800
sizy14=600
maxfps14=0
initts14=0
winver14=0
maxres14=-1
title15=Final Fighter
path15=D:\Games\FinalFighter\FinalFighter.exe
module15=
opengllib15=
ver15=1
coord15=0
flag15=-1476394464
flagg15=1209008128
flagh15=20
flagi15=4
tflag15=0
initx15=0
inity15=0
minx15=0
miny15=0
maxx15=0
maxy15=0
posx15=50
posy15=50
sizx15=800
sizy15=600
maxfps15=0
initts15=0
winver15=0
maxres15=-1
title16=Flight Simulator 98
path16=D:\Games\Flight Simulator 98\FLTSIM98.EXE
module16=
opengllib16=
ver16=0
coord16=0
flag16=679477282
flagg16=1207959552
flagh16=20
flagi16=4
tflag16=0
initx16=0
inity16=0
minx16=0
miny16=0
maxx16=0
maxy16=0
posx16=50
posy16=50
sizx16=800
sizy16=600
maxfps16=0
initts16=0
winver16=0
maxres16=-1
title17=Flying Heroes
path17=D:\Games\Flying_Heroes\fh.exe
module17=
opengllib17=
ver17=0
coord17=0
flag17=419446820
flagg17=1207959552
flagh17=20
flagi17=4
tflag17=0
initx17=0
inity17=0
minx17=0
miny17=0
maxx17=0
maxy17=0
posx17=50
posy17=50
sizx17=800
sizy17=600
maxfps17=0
initts17=0
winver17=0
maxres17=-1
title18=Final Fantasy VIII
path18=D:\Games\Final Fantasy VIII\FF8.exe
module18=
opengllib18=
ver18=0
coord18=0
flag18=134218272
flagg18=1207959552
flagh18=20
flagi18=4
tflag18=0
initx18=0
inity18=0
minx18=0
miny18=0
maxx18=0
maxy18=0
posx18=50
posy18=50
sizx18=800
sizy18=600
maxfps18=0
initts18=0
winver18=0
maxres18=-1
title19=Jazz Jackrabbit 2
path19=D:\Games\Jazz Jackrabbit 2\JAZZ2.EXE
module19=
opengllib19=
ver19=0
coord19=0
flag19=671097376
flagg19=1207959552
flagh19=20
flagi19=4
tflag19=0
initx19=0
inity19=0
minx19=0
miny19=0
maxx19=0
maxy19=0
posx19=50
posy19=50
sizx19=800
sizy19=600
maxfps19=0
initts19=0
winver19=0
maxres19=-1
title20=Jazz Jackrabbit 3D
path20=D:\Games\Jazz Jackrabbit 3D\System\Jazz3d.exe
module20=
opengllib20=
ver20=9
coord20=0
flag20=134217728
flagg20=134217728
flagh20=20
flagi20=4
tflag20=0
initx20=0
inity20=0
minx20=0
miny20=0
maxx20=0
maxy20=0
posx20=50
posy20=50
sizx20=800
sizy20=600
maxfps20=0
initts20=0
winver20=0
maxres20=-1
title21=Moon Child
path21=D:\Games\Moonchld\MC.EXE
module21=
opengllib21=
ver21=0
coord21=0
flag21=134218272
flagg21=1207959552
flagh21=20
flagi21=4718592
tflag21=6211
initx21=0
inity21=0
minx21=0
miny21=0
maxx21=0
maxy21=0
posx21=50
posy21=50
sizx21=800
sizy21=600
maxfps21=0
initts21=0
winver21=0
maxres21=-1
title22=Motocross Madness
path22=D:\Games\Motocross Madness\GAME\MCM.EXE
module22=
opengllib22=
ver22=0
coord22=0
flag22=134218272
flagg22=1207959552
flagh22=20
flagi22=4194308
tflag22=64
initx22=0
inity22=0
minx22=0
miny22=0
maxx22=0
maxy22=0
posx22=50
posy22=50
sizx22=800
sizy22=600
maxfps22=0
initts22=0
winver22=0
maxres22=-1
title23=Diablo
path23=D:\Games\Diablo\Diablo.exe
module23=
opengllib23=
ver23=1
coord23=0
flag23=138428450
flagg23=1108344848
flagh23=20
flagi23=0
tflag23=0
initx23=0
inity23=0
minx23=0
miny23=0
maxx23=0
maxy23=0
posx23=50
posy23=50
sizx23=640
sizy23=480
maxfps23=0
initts23=0
winver23=0
maxres23=0
title24=Star Wars Tie Fighter
path24=D:\Games\TIE95\TIE95.EXE
module24=
opengllib24=
ver24=0
coord24=0
flag24=134217843
flagg24=1207959568
flagh24=20
flagi24=4261892
tflag24=6466
initx24=0
inity24=0
minx24=0
miny24=0
maxx24=0
maxy24=0
posx24=50
posy24=50
sizx24=800
sizy24=600
maxfps24=0
initts24=6
winver24=0
maxres24=-1
title25=Imperialism
path25=D:\Games\Imperialism\Imperialism.exe
module25=
opengllib25=
ver25=0
coord25=0
flag25=1610744353
flagg25=134217728
flagh25=32788
flagi25=4194308
tflag25=6211
initx25=0
inity25=0
minx25=0
miny25=0
maxx25=0
maxy25=0
posx25=50
posy25=50
sizx25=800
sizy25=600
maxfps25=0
initts25=0
winver25=0
maxres25=-1
title26=Imperialism II
path26=D:\Games\Imperialism 2\imperialism II.exe
module26=
opengllib26=
ver26=0
coord26=0
flag26=679485474
flagg26=1207959552
flagh26=32788
flagi26=4
tflag26=0
initx26=0
inity26=0
minx26=0
miny26=0
maxx26=0
maxy26=0
posx26=50
posy26=50
sizx26=800
sizy26=600
maxfps26=0
initts26=0
winver26=0
maxres26=0
title27=Premier Manager 98
path27=D:\Games\Premier Manager 98\MANAGER.EXE
module27=
opengllib27=
ver27=0
coord27=0
flag27=671088674
flagg27=1207959552
flagh27=32784
flagi27=4194304
tflag27=6403
initx27=0
inity27=0
minx27=0
miny27=0
maxx27=0
maxy27=0
posx27=50
posy27=50
sizx27=800
sizy27=600
maxfps27=0
initts27=0
winver27=0
maxres27=0
[window]
posx=986
posy=424
sizx=320
sizy=200

View File

@ -23,6 +23,16 @@
dxwCore dxw;
typedef char *(*Geterrwarnmessage_Type)(unsigned long, unsigned long);
typedef int (*Preparedisasm_Type)(void);
typedef void (*Finishdisasm_Type)(void);
typedef unsigned long (*Disasm_Type)(const unsigned char *, unsigned long, unsigned long, t_disasm *, int, t_config *, int (*)(tchar *, unsigned long));
Geterrwarnmessage_Type pGeterrwarnmessage;
Preparedisasm_Type pPreparedisasm;
Finishdisasm_Type pFinishdisasm;
Disasm_Type pDisasm;
extern void InitScreenParameters();
void HookModule(HMODULE, int);
static void RecoverScreenMode();
@ -1120,9 +1130,32 @@ static void LockScreenMode(DWORD dmPelsWidth, DWORD dmPelsHeight, DWORD dmBitsPe
}
}
// to do: find a logic in the exception codes (0xc0000095 impies a bitmask ?)
// idem for ExceptionFlags
// generalize, find OPCODE length and set number of NOPs accordingly!
static HMODULE LoadDisasm()
{
HMODULE disasmlib;
#define MAX_FILE_PATH 512
char sSourcePath[MAX_FILE_PATH+1];
char *p;
DWORD dwAttrib;
dwAttrib = GetFileAttributes("dxwnd.dll");
if (dwAttrib != INVALID_FILE_ATTRIBUTES && !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY)) return NULL;
GetModuleFileName(GetModuleHandle("dxwnd"), sSourcePath, MAX_FILE_PATH);
p=&sSourcePath[strlen(sSourcePath)-strlen("dxwnd.dll")];
strcpy(p, "disasm.dll");
disasmlib=(*pLoadLibraryA)(sSourcePath);
if(!disasmlib) {
OutTraceDW("DXWND: Load lib=\"%s\" failed err=%d\n", sSourcePath, GetLastError());
return NULL;
}
pGeterrwarnmessage=(Geterrwarnmessage_Type)(*pGetProcAddress)(disasmlib, "Geterrwarnmessage");
pPreparedisasm=(Preparedisasm_Type)(*pGetProcAddress)(disasmlib, "Preparedisasm");
pFinishdisasm=(Finishdisasm_Type)(*pGetProcAddress)(disasmlib, "Finishdisasm");
pDisasm=(Disasm_Type)(*pGetProcAddress)(disasmlib, "Disasm");
//OutTraceDW("DXWND: Load disasm.dll ptrs=%x,%x,%x,%x\n", pGeterrwarnmessage, pPreparedisasm, pFinishdisasm, pDisasm);
return disasmlib;
}
LONG WINAPI myUnhandledExceptionFilter(LPEXCEPTION_POINTERS ExceptionInfo)
{
@ -1130,33 +1163,25 @@ LONG WINAPI myUnhandledExceptionFilter(LPEXCEPTION_POINTERS ExceptionInfo)
ExceptionInfo->ExceptionRecord->ExceptionCode,
ExceptionInfo->ExceptionRecord->ExceptionAddress);
DWORD oldprot;
static HMODULE disasmlib = NULL;
PVOID target = ExceptionInfo->ExceptionRecord->ExceptionAddress;
switch(ExceptionInfo->ExceptionRecord->ExceptionCode){
case 0xc0000094: // ???
if(!VirtualProtect(target, 4, PAGE_READWRITE, &oldprot)) return EXCEPTION_CONTINUE_SEARCH; // error condition
//if (*(char *)target==0xF7) // ????
*(USHORT *)target = (USHORT)0x9090; // IDIV reg -> NOP, NOP (Ultim@te Race Pro)
VirtualProtect(target, 4, oldprot, &oldprot);
return EXCEPTION_CONTINUE_EXECUTION;
break;
case 0xc0000095: // DIV by 0 (divide overflow) exception
if(!VirtualProtect(target, 4, PAGE_READWRITE, &oldprot)) return EXCEPTION_CONTINUE_SEARCH; // error condition
//if (*(char *)target==0xF7) // ????
*(USHORT *)target = (USHORT)0x9090; // IDIV reg -> NOP, NOP (SonicR)
VirtualProtect(target, 4, oldprot, &oldprot);
return EXCEPTION_CONTINUE_EXECUTION;
break;
case 0xc0000096: // Priviliged instruction exception
if(!VirtualProtect(target, 4, PAGE_READWRITE, &oldprot)) return EXCEPTION_CONTINUE_SEARCH; // error condition
//if (*(char *)target==0xFA) // ????
*(char *)target = (char)0x90; // CLI -> NOP (Resident Evil)
VirtualProtect(target, 4, oldprot, &oldprot);
return EXCEPTION_CONTINUE_EXECUTION;
break;
case 0xc000001d: // eXpendable (instruction FEMMS)
if(!VirtualProtect(target, 4, PAGE_READWRITE, &oldprot)) return EXCEPTION_CONTINUE_SEARCH; // error condition
*(USHORT *)target = (USHORT)0x9090; // FEMMS -> NOP, NOP (eXpendable)
VirtualProtect(target, 4, oldprot, &oldprot);
case 0xc0000094: // IDIV reg (Ultim@te Race Pro)
case 0xc0000095: // DIV by 0 (divide overflow) exception (SonicR)
case 0xc0000096: // CLI Priviliged instruction exception (Resident Evil)
case 0xc000001d: // FEMMS (eXpendable)
case 0xc0000005: // Memory exception (Tie Fighter)
int cmdlen;
t_disasm da;
if(!disasmlib){
if (!(disasmlib=LoadDisasm())) return EXCEPTION_CONTINUE_SEARCH;
(*pPreparedisasm)();
}
if(!VirtualProtect(target, 10, PAGE_READWRITE, &oldprot)) return EXCEPTION_CONTINUE_SEARCH; // error condition
cmdlen=(*pDisasm)((BYTE *)target, 10, 0, &da, 0, NULL, NULL);
OutTrace("UnhandledExceptionFilter: NOP opcode=%x len=%d\n", *(BYTE *)target, cmdlen);
memset((BYTE *)target, 0x90, cmdlen);
VirtualProtect(target, 10, oldprot, &oldprot);
return EXCEPTION_CONTINUE_EXECUTION;
break;
default:
@ -1354,21 +1379,8 @@ LRESULT CALLBACK MessageHook(int code, WPARAM wParam, LPARAM lParam)
static void ReplaceRDTSC()
{
typedef char *(*Geterrwarnmessage_Type)(unsigned long, unsigned long);
typedef int (*Preparedisasm_Type)(void);
typedef void (*Finishdisasm_Type)(void);
typedef unsigned long (*Disasm_Type)(const unsigned char *, unsigned long, unsigned long, t_disasm *, int, t_config *, int (*)(tchar *, unsigned long));
typedef BOOL (WINAPI *GetModuleInformation_Type)(HANDLE, HMODULE, LPMODULEINFO, DWORD);
HMODULE disasmlib;
#define MAX_FILE_PATH 512
char sSourcePath[MAX_FILE_PATH+1];
char *p;
Geterrwarnmessage_Type pGeterrwarnmessage;
Preparedisasm_Type pPreparedisasm;
Finishdisasm_Type pFinishdisasm;
Disasm_Type pDisasm;
DWORD dwAttrib;
unsigned char *opcodes;
t_disasm da;
MODULEINFO mi;
@ -1377,21 +1389,7 @@ static void ReplaceRDTSC()
DWORD dwSegSize;
DWORD oldprot;
dwAttrib = GetFileAttributes("dxwnd.dll");
if (dwAttrib != INVALID_FILE_ATTRIBUTES && !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY)) return;
GetModuleFileName(GetModuleHandle("dxwnd"), sSourcePath, MAX_FILE_PATH);
p=&sSourcePath[strlen(sSourcePath)-strlen("dxwnd.dll")];
strcpy(p, "disasm.dll");
disasmlib=(*pLoadLibraryA)(sSourcePath);
if(!disasmlib) {
OutTraceDW("DXWND: Load lib=\"%s\" failed err=%d\n", sSourcePath, GetLastError());
return;
}
pGeterrwarnmessage=(Geterrwarnmessage_Type)(*pGetProcAddress)(disasmlib, "Geterrwarnmessage");
pPreparedisasm=(Preparedisasm_Type)(*pGetProcAddress)(disasmlib, "Preparedisasm");
pFinishdisasm=(Finishdisasm_Type)(*pGetProcAddress)(disasmlib, "Finishdisasm");
pDisasm=(Disasm_Type)(*pGetProcAddress)(disasmlib, "Disasm");
//OutTraceDW("DXWND: Load disasm.dll ptrs=%x,%x,%x,%x\n", pGeterrwarnmessage, pPreparedisasm, pFinishdisasm, pDisasm);
if (!(disasmlib=LoadDisasm())) return;
// getting segment size
psapilib=(*pLoadLibraryA)("psapi.dll");

View File

@ -573,7 +573,7 @@ void dxwCore::MapClient(LPRECT rect)
{
RECT client;
int w, h;
(*pGetClientRect)(hWnd, &client);
if(!(*pGetClientRect)(hWnd, &client)) return;
w = client.right ? client.right : iSizX;
h = client.bottom ? client.bottom : iSizY;
rect->left= rect->left * w / (int)dwScreenWidth;
@ -586,7 +586,7 @@ void dxwCore::MapClient(int *nXDest, int *nYDest, int *nWDest, int *nHDest)
{
RECT client;
int w, h;
(*pGetClientRect)(hWnd, &client);
if(!(*pGetClientRect)(hWnd, &client)) return;
w = client.right ? client.right : iSizX;
h = client.bottom ? client.bottom : iSizY;
*nXDest= *nXDest * w / (int)dwScreenWidth;
@ -599,7 +599,7 @@ void dxwCore::MapClient(LPPOINT lppoint)
{
RECT client;
int w, h;
(*pGetClientRect)(hWnd, &client);
if(!(*pGetClientRect)(hWnd, &client)) return;
w = client.right ? client.right : iSizX;
h = client.bottom ? client.bottom : iSizY;
lppoint->x = (lppoint->x * w) / (int)dwScreenWidth;
@ -610,7 +610,7 @@ void dxwCore::MapClient(int *nXDest, int *nYDest)
{
RECT client;
int w, h;
(*pGetClientRect)(hWnd, &client);
if(!(*pGetClientRect)(hWnd, &client)) return;
w = client.right ? client.right : iSizX;
h = client.bottom ? client.bottom : iSizY;
*nXDest= *nXDest * w / (int)dwScreenWidth;
@ -621,7 +621,7 @@ void dxwCore::UnmapClient(LPPOINT lppoint)
{
RECT client;
int w, h;
(*pGetClientRect)(hWnd, &client);
if(!(*pGetClientRect)(hWnd, &client)) return;
w = client.right ? client.right : iSizX;
h = client.bottom ? client.bottom : iSizY;
if(w) lppoint->x = (lppoint->x * (int)dwScreenWidth) / w;
@ -632,7 +632,7 @@ void dxwCore::UnmapClient(int *nXDest, int *nYDest)
{
RECT client;
int w, h;
(*pGetClientRect)(hWnd, &client);
if(!(*pGetClientRect)(hWnd, &client)) return;
w = client.right ? client.right : iSizX;
h = client.bottom ? client.bottom : iSizY;
if(w) *nXDest= *nXDest * (int)dwScreenWidth / w;
@ -643,7 +643,7 @@ void dxwCore::UnmapClient(LPRECT lpRect)
{
RECT client;
int w, h;
(*pGetClientRect)(hWnd, &client);
if(!(*pGetClientRect)(hWnd, &client)) return;
w = client.right ? client.right : iSizX;
h = client.bottom ? client.bottom : iSizY;
if(w) {
@ -660,7 +660,7 @@ void dxwCore::MapWindow(LPRECT rect)
{
RECT client;
POINT upleft = {0,0};
(*pGetClientRect)(hWnd, &client);
if(!(*pGetClientRect)(hWnd, &client)) return;
(*pClientToScreen)(hWnd, &upleft);
rect->left= upleft.x + ((rect->left * client.right) / (int)dwScreenWidth);
rect->top= upleft.y + ((rect->top * client.bottom) / (int)dwScreenHeight);
@ -672,7 +672,7 @@ void dxwCore::MapWindow(int *nXDest, int *nYDest, int *nWDest, int *nHDest)
{
RECT client;
POINT upleft = {0,0};
(*pGetClientRect)(hWnd, &client);
if(!(*pGetClientRect)(hWnd, &client)) return;
(*pClientToScreen)(hWnd, &upleft);
*nXDest= upleft.x + ((*nXDest * client.right) / (int)dwScreenWidth);
*nYDest= upleft.y + ((*nYDest * client.bottom) / (int)dwScreenHeight);
@ -684,7 +684,7 @@ void dxwCore::MapWindow(LPPOINT lppoint)
{
RECT client;
POINT upleft = {0,0};
(*pGetClientRect)(hWnd, &client);
if(!(*pGetClientRect)(hWnd, &client)) return;
(*pClientToScreen)(hWnd, &upleft);
lppoint->x = upleft.x + ((lppoint->x * client.right) / dwScreenWidth);
lppoint->y = upleft.y + ((lppoint->y * client.bottom) / dwScreenHeight);

View File

@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "dxwnd.h"
#include "dxwcore.hpp"
#define VERSION "2.02.68"
#define VERSION "2.02.69"
#define DDTHREADLOCK 1

Binary file not shown.

View File

@ -1091,10 +1091,16 @@ static HWND WINAPI extCreateWindowCommon(
// v2.02.30: fix (Fable - lost chapters) Fable creates a bigger win with negative x,y coordinates.
if (
(
((x<=0)&&(y<=0)) || ((x==CW_USEDEFAULT)&&(y==CW_USEDEFAULT))
((x<=0)&&(y<=0))
||
((x==CW_USEDEFAULT)&&(y==CW_USEDEFAULT))
)
&&
((nWidth>=(int)dxw.GetScreenWidth())&&(nHeight>=(int)dxw.GetScreenHeight()))
(
((nWidth>=(int)dxw.GetScreenWidth())&&(nHeight>=(int)dxw.GetScreenHeight()))
||
((nWidth==CW_USEDEFAULT)&&(nHeight==CW_USEDEFAULT)) // good for Imperialism, but is it general?
)
&&
!(dwExStyle & WS_EX_CONTROLPARENT) // Diablo fix
&&
@ -1350,21 +1356,21 @@ int WINAPI extFillRect(HDC hdc, const RECT *lprc, HBRUSH hbr)
// when not in fullscreen mode, just proxy the call
// better not: some games may use excessive coordinates: see "Premier Manager 98"
// if(!dxw.IsFullScreen()) return (*pFillRect)(hdc, lprc, hbr);
// if(!dxw.IsFullScreen() && !dxw.IsDesktop(WindowFromDC(hdc))) return (*pFillRect)(hdc, lprc, hbr);
memcpy(&rc, lprc, sizeof(rc));
if(rc.left < 0) rc.left = 0;
if(rc.top < 0) rc.top = 0;
if((DWORD)rc.right > dxw.GetScreenWidth()) rc.right = dxw.GetScreenWidth();
if((DWORD)rc.bottom > dxw.GetScreenHeight()) rc.bottom = dxw.GetScreenHeight();
if(dxw.IsFullScreen()){
// ???? how to handle FillRect for primary window ???
//if(hdc==(*pGDIGetDC)(dxw.GethWnd())) {
// dxw.MapClient(&rc);
//}
//else
if(OBJ_DC == GetObjectType(hdc)) dxw.MapWindow(&rc);
//else dxw.MapClient(&rc);
if(dxw.IsRealDesktop(WindowFromDC(hdc))) {
OutTraceDW("FillRect: remapped hdc to virtual desktop\n");
hdc=(*pGDIGetDC)(dxw.GethWnd());
}
if(OBJ_DC == GetObjectType(hdc)){
if(rc.left < 0) rc.left = 0;
if(rc.top < 0) rc.top = 0;
if((DWORD)rc.right > dxw.GetScreenWidth()) rc.right = dxw.GetScreenWidth();
if((DWORD)rc.bottom > dxw.GetScreenHeight()) rc.bottom = dxw.GetScreenHeight();
dxw.MapClient(&rc);
OutTraceDW("FillRect: fixed rect=(%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom);
}

Binary file not shown.