elishacloud / dxwrapper

Fixes compatibility issues with older games running on Windows 10/11 by wrapping DirectX dlls. Also allows loading custom libraries with the file extension .asi into game processes.
zlib License
1.23k stars 90 forks source link

[Exception in memory or whatever] State of Emergency #254

Closed SilentMRG closed 1 day ago

SilentMRG commented 8 months ago

Hello...

Using your wrapper will cause a memory error or something like that every time I exit the game. In general, everything works fine, without problems or crashes, but when I exit the game this always happens:

Exception C0000005 caught at 70D0AB39!

 Registers:
 EAX = 00000000 EBX = 01B0E930 ECX = 2822B0E0
  EDX = 01AC790C ESI = 00730075 EDI = 01B0E930
  EIP = 70D0AB39 ESP = 0018FDC4 EBP = 0018FDD8
  EFL = 00210297

 Stackframe:
  0018fdc4: 75 00 73 00 E8 E6 B1 01 00 00 20 00 75 00 73 00 u.s....... .u.s.
  0018fdd4: 38 4D 3A 28 18 FE 18 00 4C 25 D0 70 30 E9 B0 01 8M:(....L%.p0...
  0018fde4: 75 00 73 00 F8 4E 3A 28 31 33 12 00 00 00 40 00 u.s..N:(13....@.
  0018fdf4: 00 00 00 00 00 70 2E 00 10 FE 18 00 97 2A 45 6A .....p.......*Ej
  0018fe04: 19 00 00 00 31 33 12 00 50 FE 18 00 90 74 D1 70 ....13..P....t.p
  0018fe14: FF FF FF FF 60 FE 18 00 C0 95 48 00 30 E9 B0 01 ....`.....H.0...
  0018fe24: B0 CF 48 00 45 12 F1 74 00 00 00 00 00 E0 FD 7E ..H.E..t.......~
  0018fe34: 00 00 00 00 06 00 00 00 01 00 00 00 0E 00 00 00 ................
  0018fe44: 44 01 00 00 28 FE 18 00 98 F9 18 00 78 FF 18 00 D...(.......x...
  0018fe54: 08 C7 49 00 38 92 4B 00 00 00 00 00 88 FF 18 00 ..I.8.K.........
  0018fe64: D2 BD 49 00 00 00 40 00 00 00 00 00 CB 2C AC 01 ..I...@......,..
  0018fe74: 01 00 00 00 94 00 00 00 06 00 00 00 01 00 00 00 ................
  0018fe84: B1 1D 00 00 02 00 00 00 53 65 72 76 69 63 65 20 ........Service 
  0018fe94: 50 61 63 6B 20 31 00 75 7E 5A 00 00 68 FF 18 00 Pack 1.u~Z..h...
  0018fea4: 00 00 00 00 00 00 00 00 B0 34 AC 01 BC FE 18 00 .........4......
  0018feb4: D8 94 0A 75 00 00 00 00 00 00 77 73 70 72 69 6E ...u......wsprin
  0018fec4: 74 66 41 00 00 00 00 00 31 00 7E 00 3A 00 00 00 tfA.....1.~.:...
  0018fed4: 5E B4 74 75 20 18 78 75 01 00 00 00 F8 BC B0 01 ^.tu .xu........
  0018fee4: 01 00 00 00 C8 C4 B0 01 04 FF 18 00 C3 E0 50 77 ..............Pw
  0018fef4: 00 00 08 75 8B 3D CA 77 87 3D CA 77 88 FE 18 00 ...u.=.w.=.w....
  0018ff04: C4 FF 18 00 69 BC 49 00 00 00 00 00 00 00 00 00 ....i.I.........
  0018ff14: 00 E0 FD 7E 08 04 51 77 92 02 51 77 CB 2C AC 01 ...~..Qw..Qw.,..
  0018ff24: 44 00 00 00 F0 4E B0 01 18 3B B0 01 20 3F B0 01 D....N...;.. ?..
  0018ff34: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  0018ff44: 00 00 00 00 00 00 00 00 00 00 00 00 01 0C 00 00 ................
  0018ff54: 01 00 00 00 00 00 00 00 00 00 00 00 01 00 01 00 ................
  0018ff64: 00 00 00 00 00 00 00 00 00 00 00 00 78 FE 18 00 ............x...
  0018ff74: 94 FF 18 00 C4 FF 18 00 08 C7 49 00 00 AC 4B 00 ..........I...K.
  0018ff84: 00 00 00 00 94 FF 18 00 3D 34 F1 74 00 E0 FD 7E ........=4.t...~
  0018ff94: D4 FF 18 00 02 98 51 77 00 E0 FD 7E 4B 3D CA 77 ......Qw...~K=.w
  0018ffa4: 00 00 00 00 00 00 00 00 00 E0 FD 7E 00 00 00 00 ...........~....
  0018ffb4: 7F 7C 35 77 00 00 00 00 A0 FF 18 00 00 00 00 00 .|5w............
  0018ffc4: FF FF FF FF CD 4D 55 77 DF 04 82 00 00 00 00 00 .....MUw........
  0018ffd4: EC FF 18 00 D5 97 51 77 D4 00 55 01 00 E0 FD 7E ......Qw..U....~
  0018ffe4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  0018fff4: D4 00 55 01 00 E0 FD 7E 00 00 00 00 41 63 74 78 ..U....~....Actx
  00190004: 20 00 00 00 01 00 00 00 0C 33 00 00 DC 00 00 00  ........3......
  00190014: 00 00 00 00 20 00 00 00 00 00 00 00 14 00 00 00 .... ...........
  00190024: 01 00 00 00 07 00 00 00 34 00 00 00 7C 01 00 00 ........4...|...
  00190034: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  00190044: 00 00 00 00 00 00 00 00 02 00 00 00 4E EF 26 1A ............N.&.
  00190054: 98 02 00 00 44 00 00 00 E0 02 00 00 60 02 00 00 ....D.......`...
  00190064: 00 00 00 00 BA 71 32 F3 40 05 00 00 4A 00 00 00 .....q2.@...J...
  00190074: 8C 05 00 00 1E 03 00 00 00 00 00 00 5B 49 59 2D ............[IY-
  00190084: AC 08 00 00 32 00 00 00 E0 08 00 00 00 03 00 00 ....2...........
  00190094: 00 00 00 00 CD EA CE 32 E0 0B 00 00 42 00 00 00 .......2....B...
  001900a4: 24 0C 00 00 36 03 00 00 00 00 00 00 C8 5F 50 38 $...6........_P8
  001900b4: 5C 0F 00 00 5E 00 00 00 BC 0F 00 00 68 03 00 00 \...^.......h...
  001900c4: 00 00 00 00 44 05 28 B1 24 13 00 00 56 00 00 00 ....D.(.$...V...
  001900d4: 7C 13 00 00 98 03 00 00 10 00 00 00 09 00 00 00 |...............
  001900e4: EC 00 00 00 02 00 00 00 01 00 00 00 7C 01 00 00 ............|...
  001900f4: D0 15 00 00 01 00 00 00 02 00 00 00 4C 17 00 00 ............L...
  00190104: A0 07 00 00 01 00 00 00 03 00 00 00 EC 1E 00 00 ................
  00190114: 8C 0E 00 00 01 00 00 00 04 00 00 00 78 2D 00 00 ............x-..
  00190124: 14 03 00 00 02 00 00 00 05 00 00 00 8C 30 00 00 .............0..
  00190134: 98 00 00 00 02 00 00 00 06 00 00 00 24 31 00 00 ............$1..
  00190144: CC 00 00 00 02 00 00 00 07 00 00 00 F0 31 00 00 .............1..
  00190154: F0 00 00 00 01 00 00 00 09 00 00 00 E0 32 00 00 .............2..
  00190164: 28 00 00 00 02 00 00 00 0B 00 00 00 08 33 00 00 (............3..
  00190174: 04 00 00 00 01 00 00 00 53 73 48 64 2C 00 00 00 ........SsHd,...
  00190184: 01 00 00 00 01 00 00 00 01 00 00 00 06 00 00 00 ................
  00190194: 8C 00 00 00 01 00 00 00 98 15 00 00 2C 00 00 00 ............,...
  001901a4: 5E 00 00 00 5E 00 00 00 00 00 00 00 00 00 00 00 ^...^...........
  001901b4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  001901c4: 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 ................
  001901d4: 24 00 00 00 38 00 00 00 00 00 00 00 43 00 3A 00 $...8.......C.:.
  001901e4: 5C 00 57 00 69 00 6E 00 64 00 6F 00 77 00 73 00 \.W.i.n.d.o.w.s.
  001901f4: 5C 00 57 00 69 00 6E 00 53 00 78 00 73 00 5C 00 \.W.i.n.S.x.s.\.
  00190204: 00 00 00 00 4E EF 26 1A 1C 01 00 00 44 00 00 00 ....N.&.....D...
  00190214: 64 01 00 00 60 02 00 00 01 00 00 00 BA 71 32 F3 d...`........q2.
  00190224: C4 03 00 00 4A 00 00 00 10 04 00 00 1E 03 00 00 ....J...........
  00190234: 02 00 00 00 5B 49 59 2D 30 07 00 00 32 00 00 00 ....[IY-0...2...
  00190244: 64 07 00 00 00 03 00 00 03 00 00 00 CD EA CE 32 d..............2
  00190254: 64 0A 00 00 42 00 00 00 A8 0A 00 00 36 03 00 00 d...B.......6...
  00190264: 04 00 00 00 C8 5F 50 38 E0 0D 00 00 5E 00 00 00 ....._P8....^...
  00190274: 40 0E 00 00 68 03 00 00 05 00 00 00 44 05 28 B1 @...h.......D.(.
  00190284: A8 11 00 00 56 00 00 00 00 12 00 00 98 03 00 00 ....V...........
  00190294: 06 00 00 00 4D 00 69 00 63 00 72 00 6F 00 73 00 ....M.i.c.r.o.s.
  001902a4: 6F 00 66 00 74 00 2E 00 57 00 69 00 6E 00 64 00 o.f.t...W.i.n.d.
  001902b4: 6F 00 77 00 73 00 2E 00 53 00 79 00 73 00 74 00 o.w.s...S.y.s.t.
  001902c4: 65 00 6D 00 43 00 6F 00 6D 00 70 00 61 00 74 00 e.m.C.o.m.p.a.t.
  001902d4: 69 00 62 00 6C 00 65 00 00 00 00 00 6C 00 00 00 i.b.l.e.....l...
  001902e4: 01 00 00 00 0C 01 00 00 D0 01 00 00 02 00 00 00 ................
  001902f4: 2C 00 00 00 DC 02 00 00 A7 FB 4C A1 24 04 CA 01 ,.........L.$...
  00190304: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  00190314: 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 ................
  00190324: 00 00 00 00 00 00 00 00 00 00 00 00 B8 00 00 00 ................
  00190334: 0A 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  00190344: 00 00 00 00 00 00 00 00 4D 00 69 00 63 00 72 00 ........M.i.c.r.
  00190354: 6F 00 73 00 6F 00 66 00 74 00 2E 00 57 00 69 00 o.s.o.f.t...W.i.
  00190364: 6E 00 64 00 6F 00 77 00 73 00 2E 00 53 00 79 00 n.d.o.w.s...S.y.
  00190374: 73 00 74 00 65 00 6D 00 43 00 6F 00 6D 00 70 00 s.t.e.m.C.o.m.p.
  00190384: 61 00 74 00 69 00 62 00 6C 00 65 00 2C 00 70 00 a.t.i.b.l.e.,.p.
  00190394: 72 00 6F 00 63 00 65 00 73 00 73 00 6F 00 72 00 r.o.c.e.s.s.o.r.
  001903a4: 41 00 72 00 63 00 68 00 69 00 74 00 65 00 63 00 A.r.c.h.i.t.e.c.
  001903b4: 74 00 75 00 72 00 65 00 3D 00 22 00 78 00 38 00 t.u.r.e.=.".x.8.
  001903c4: 36 00 22 00 2C 00 70 00 75 00 62 00 6C 00 69 00 6.".,.p.u.b.l.i.
  001903d4: 63 00 4B 00 65 00 79 00 54 00 6F 00 6B 00 65 00 c.K.e.y.T.o.k.e.
  001903e4: 6E 00 3D 00 22 00 36 00 35 00 39 00 35 00 62 00 n.=.".6.5.9.5.b.
  001903f4: 36 00 34 00 31 00 34 00 34 00 63 00 63 00 66 00 6.4.1.4.4.c.c.f.
  00190404: 31 00 64 00 66 00 22 00 2C 00 74 00 79 00 70 00 1.d.f.".,.t.y.p.
  00190414: 65 00 3D 00 22 00 77 00 69 00 6E 00 33 00 32 00 e.=.".w.i.n.3.2.
  00190424: 22 00 2C 00 76 00 65 00 72 00 73 00 69 00 6F 00 ".,.v.e.r.s.i.o.
  00190434: 6E 00 3D 00 22 00 36 00 2E 00 30 00 2E 00 37 00 n.=.".6...0...7.
  00190444: 36 00 30 00 30 00 2E 00 31 00 36 00 33 00 38 00 6.0.0...1.6.3.8.
  00190454: 35 00 22 00 53 00 79 00 73 00 74 00 65 00 6D 00 5.".S.y.s.t.e.m.
  00190464: 20 00 44 00 65 00 66 00 61 00 75 00 6C 00 74 00  .D.e.f.a.u.l.t.
  00190474: 20 00 43 00 6F 00 6E 00 74 00 65 00 78 00 74 00  .C.o.n.t.e.x.t.
  00190484: 00 00 78 00 38 00 36 00 5F 00 6D 00 69 00 63 00 ..x.8.6._.m.i.c.
  00190494: 72 00 6F 00 73 00 6F 00 66 00 74 00 2E 00 77 00 r.o.s.o.f.t...w.
  001904a4: 69 00 6E 00 64 00 6F 00 77 00 73 00 2E 00 73 00 i.n.d.o.w.s...s.
  001904b4: 79 00 73 00 74 00 65 00 6D 00 63 00 6F 00 6D 00 y.s.t.e.m.c.o.m.
  001904c4: 70 00 61 00 74 00 69 00 62 00 6C 00 65 00 5F 00 p.a.t.i.b.l.e._.
  001904d4: 36 00 35 00 39 00 35 00 62 00 36 00 34 00 31 00 6.5.9.5.b.6.4.1.
  001904e4: 34 00 34 00 63 00 63 00 66 00 31 00 64 00 66 00 4.4.c.c.f.1.d.f.
  001904f4: 5F 00 36 00 2E 00 30 00 2E 00 37 00 36 00 30 00 _.6...0...7.6.0.
  00190504: 30 00 2E 00 31 00 36 00 33 00 38 00 35 00 5F 00 0...1.6.3.8.5._.
  00190514: 6E 00 6F 00 6E 00 65 00 5F 00 34 00 39 00 61 00 n.o.n.e._.4.9.a.
  00190524: 64 00 63 00 63 00 62 00 64 00 65 00 38 00 31 00 d.c.c.b.d.e.8.1.
  00190534: 36 00 39 00 61 00 30 00 33 00 00 00 4D 00 69 00 6.9.a.0.3...M.i.
  00190544: 63 00 72 00 6F 00 73 00 6F 00 66 00 74 00 2E 00 c.r.o.s.o.f.t...
  00190554: 57 00 69 00 6E 00 64 00 6F 00 77 00 73 00 2E 00 W.i.n.d.o.w.s...
  00190564: 49 00 73 00 6F 00 6C 00 61 00 74 00 69 00 6F 00 I.s.o.l.a.t.i.o.
  00190574: 6E 00 41 00 75 00 74 00 6F 00 6D 00 61 00 74 00 n.A.u.t.o.m.a.t.
  00190584: 69 00 6F 00 6E 00 00 00 6C 00 00 00 00 00 00 00 i.o.n...l.......
  00190594: 04 01 00 00 7C 04 00 00 02 00 00 00 FA 00 00 00 ....|...........
  001905a4: 80 05 00 00 EB DB 8F 49 26 04 CA 01 01 00 00 00 .......I&.......
  001905b4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

Activate Shutdown via exit Music already stopped opened file SAVEGAMES\GLOBAL STATUS\DEFAULT.OPT

Note: Not using your wrapper will not cause this issue, however, I will be stuck with extremely fast animations among other appcrashes that are inherent to an older game. Using d3d8to9 only also causes the same problem.

Cheers! And thanks for your attention!

elishacloud commented 8 months ago

What game are you running with this issue? It looks like it may be a nullptr exception.

SilentMRG commented 8 months ago

The one in the title: State of Emergency =)

elishacloud commented 8 months ago

LOL. I thought you were saying that the crash was a state of emergency.

SilentMRG commented 8 months ago

I agree it's a pretty "peculiar" name for a game, hehehe. XD The real name of the error is "Memory Exception", and after this error the infamous "Appcrash" error occurs.

elishacloud commented 4 days ago

Can you try with the latest build? I fixed a number of errors that could have lead to a crash on exit.

SilentMRG commented 4 days ago

Elisha, I no longer had the game installed, so I installed it, played for 30 minutes and when I exited the same problem... SOE I am attaching my dxwrapper configuration with the log, so you can kindly take a look and tell me whether my configuration is ok or not, perhaps, I am the culprit in making an invalid configuration which is resulting in the error aforementioned. I should mention that no AppCrash errors occurred this time.

dxwrapper.zip

Thanks for pointing me to the new version!

SilentMRG commented 4 days ago

I was almost forgetting... I marked this: "HandleExceptions = 1" In the "ini" file. I think this line is used to deal with these "exceptions" errors; anyway, the game or I are out of luck. XD

elishacloud commented 4 days ago

I suspect that some interface is not getting released by the game until exiting causing this issue. I will need to look at this later.

SilentMRG commented 4 days ago

At the end of the log it says this:

"opened file SAVEGAMES\GLOBAL STATUS\DEFAULT.OPT"

Wouldn't it be the dxwrapper trying to access something it's not supposed to access or the game getting in the way of the dxwrapper and doing this? Accessing something that is not meant for him to access. I don't understand the subject, but this specific line caught my attention.

SilentMRG commented 3 days ago

Just for the record (maybe it helps), the folder is not called "SAVEGAMES", it is called "SaveGames", and the "GLOBAL STATUS" folder is called "Global status". You know, some programs differ in upper and lower case letters, I don't know if this is the case with dxwrapper. In the image below, you can see that there is another folder along with "Global status":

soe2

Inside the "0-mrg(Revolution)" folder there is a file "SAVEDGAME.DAT", and inside the "Global status" folder, two files: "DEFAULT.OPT" (mentioned in the log), and "GAMESAVE.DAT".

SilentMRG commented 3 days ago

I apologize for the consecutive posts, I took a look at the dxwrapper report and found these lines:

"844 22:48:15.960 d8_Direct3DCreate8 844 22:48:15.960 GetD3d9UnnamedOrdinal cannot find unnamed ordinal '18' in System32 d3d9.dll! 844 22:48:15.960 Direct3D9SetSwapEffectUpgradeShim Error: Failed to get address!"

Well, my system has DirectX 9 installed, it seems the report is saying otherwise?

elishacloud commented 3 days ago

The crash dump file you send does not show which module crashed. What OS are you using? Can you upload the full dxwrapper log file?

844 22:48:15.960 GetD3d9UnnamedOrdinal cannot find unnamed ordinal '18' in System32 d3d9.dll!
844 22:48:15.960 Direct3D9SetSwapEffectUpgradeShim Error: Failed to get address!

This error means dxwrapper could not find the Direct3D9SetSwapEffectUpgradeShim function. Either you are using an OS that does not have that function or the fingerprint of that function is different on your OS or the d3d9.dll file is corrupt.

844 22:48:15.960 d8_Direct3DCreate8

Since you are using d3d8to9, can you try the released version of d3d8to9 from here and see if you have the same issue? I want to see if it is an issue with dxwrapper or d3d8to9.

SilentMRG commented 3 days ago

I'm using Windows 7 64-bit, the same Windows and the same laptop that I've been using to test several old games with dxwrapper. And I don't remember this DX9 error in the other versions. Well, I'm going to reinstall DX9 here to see if that solves it.

Here is the log with the stub of your launch, notice that it is a dxwrapper log plus the error log mentioned above: log.zip

And here is just the error log: log (2).zip

Because with the dll "d3d8to9" no dxwrapper report was created.

Edit: I don't remember these lines...

"5924 16:32:45.785 Loaded library: winmm.dll 5924 16:32:45.815 Installing memory management hooks 5924 16:32:45.815 Installing messaging hooks 5924 16:32:45.815 Installing display mode hooks 5924 16:32:45.879 Installing registry hooks 5924 16:32:45.879 Installing Win32 hooks"

In previous versions of dxwrapper. In my ignorance winmm.dll does not communicate correctly with Windows 7, it seems to be a Windows 10 dll. Despite that, I was having an "Exception" error with cnc-ddraw here: https://github.com/FunkyFr3sh/cnc-ddraw/issues/152

Funky was able to fix it, the problem was that the dll was accessing the incorrect ".exe". Wouldn't that be the case here? I know it's about "ddraw", but you know... Sometimes incorrect paths are accessed.

elishacloud commented 3 days ago

I'm using Windows 7 64-bit, the same Windows and the same laptop that I've been using to test several old games with dxwrapper. And I don't remember this DX9 error in the other versions.

Ok, don't worry about the error message. That d3d9 function is not available on Windows 7, only Windows 10 and 11.

Here is the log with the stub of your launch, notice that it is a dxwrapper log plus the error log mentioned above:

That is a game log. I wanted to see the dxwrapper log. It should be called something like dxwrapper-game.log

In previous versions of dxwrapper. In my ignorance winmm.dll does not communicate correctly with Windows 7, it seems to be a Windows 10 dll.

That is weird. Maybe I am missing some functions in the dll. Are you still seeing that issue with this latest release? This could be the issue because the game could be calling a winmm function on exit that is missing from my stub. Can you try with a different stub? Maybe dsound.dll or dinput8.dll?

Funky was able to fix it, the problem was that the dll was accessing the incorrect ".exe". Wouldn't that be the case here?

I would need to know more details about this to say. Not sure why the dll is accessing an exe file in the fist place.

SilentMRG commented 3 days ago

That is a game log. I wanted to see the dxwrapper log. It should be called something like dxwrapper-game.log

Where is this log created? No such log is created here, only the two logs I sent. In fact, in all versions of dxwrapper I never saw this log. On my side, it is always the sent log (of the game) that is created. And no, I did not disable log in the "ini" file settings.

That is weird. Maybe I am missing some functions in the dll. Are you still seeing that issue with this latest release? This could be the issue because the game could be calling a winmm function on exit that is missing from my stub. Can you try with a different stub? Maybe dsound.dll or dinput8.dll?

For the record, I installed the latest version of DX9 downloaded here: https://www.microsoft.com/en-us/download/details.aspx?id=8109

He updated some things and the error remains the same. Using any of these dlls results in the same error.

elishacloud commented 3 days ago

Where is this log created? No such log is created here, only the two logs I sent.

The log will be located in the same folder as the dxwrapper.dll file. The log file has been there since day 1. All releases of dxwrapper has the same log file. If there is no log file then it means that dxwrapper is not being loaded. What dxwrapper stub are you using? Maybe try a different dxwrapper stub?

image

SilentMRG commented 3 days ago

The log will be located in the same folder as the dxwrapper.dll file. The log file has been there since day 1. All releases of dxwrapper has the same log file. If there is no log file then it means that dxwrapper is not being loaded. What dxwrapper stub are you using? Maybe try a different dxwrapper stub?

Elisha, the first zip I uploaded just above has this file, it's called "dxwrapper-kaospc.log". I assume you didn't open it. I even eplaned "Here is the log with the stub of your launch, notice that it is a dxwrapper log plus the error mentioned log above:" Lol... now I don't understand anything. XD

SilentMRG commented 3 days ago

English is not my native language, so maybe I didn't express myself correctly. The "log (2).zip" file is just the same as what was posted in the main post. In this second test, I used "d3d8to9" from the link you provided, but the log "dxwrapper-kaospc.log" was not created.

And in "log.zip" there is the file "dxwrapper-kaospc.log", because in this first test I used the d3d8 dll of your version. The other dlls you mentioned worked, but presented the same error, so nothing worth mentioning.

elishacloud commented 2 days ago

The "log (2).zip" file is just the same as what was posted in the main post. In this second test, I used "d3d8to9" from the link you provided, but the log "dxwrapper-kaospc.log" was not created.

Sorry I missed that.

I see this line in the log file:

5924 16:32:46.058 CreateProcessWHandler C:\Windows\system32\rundll32.exe C:\Windows\system32\gameux.dll,GameUXShim {6a62c0b8-5137-4a10-a174-124952a9c068};D:\Mateus\State Of Emergency\KaosPC.exe;5920

This is caused by the DisableGameUX. You could try adding this option to the ini file and disabling it.

Edit: I don't remember these lines...

These are new things I added into the latest release for the dd7to9 and d3d8to9 features. It helps with compatibility issues in these older games. Since the crash happens even in older version before I added that I don't think it is related to that.

elishacloud commented 2 days ago

BTW: Did you try the released version of d3d8to9 from here instead of dxwrapper? I just want to see if the issue is in d3d8to9 or in dxwrapper.

SilentMRG commented 2 days ago

This is caused by the DisableGameUX. You could try adding this option to the ini file and disabling it.

I disabled DisableGameUX and the same error occurred, here is the log: dxwrapper-kaospc.zip However, I took a quick look and didn't see that line.

BTW: Did you try the released version of d3d8to9 from here instead of dxwrapper? I just want to see if the issue is in d3d8to9 or in dxwrapper.

I just did it with just d3d8to9 and nothing else, a log was created: log.zip

SilentMRG commented 2 days ago

The cause of the error is version 1.12.0 of d3d8to9. I just tested version v1.11.1 and the error did not occur! I would venture to say that many random games must be suffering from this version 1.12.0 exception error.

SilentMRG commented 2 days ago

Just to be sure, would it be possible for you to provide a d3d8 stub of version 1.11.1 so that I can test with dxwrapper?

Unfortunately, d3d8to9 does not work directly with dxwrapper, of course, because you made changes to the d3d8 stub that comes with dxwrapper to work with dxwrapper.

I thank!

elishacloud commented 2 days ago

Just to be sure, would it be possible for you to provide a d3d8 stub of version 1.11.1 so that I can test with dxwrapper?

Ok, good catch. If it is caused by 1.12.0 then this one should fix it. I just removed the check-in that likely has the issue: dxwrapper.zip

SilentMRG commented 2 days ago

All very well! Using this configuration: dxwrapper.zip

Elisha, thank you for all your help and patience! =)

elishacloud commented 2 days ago

@SilentMRG, can you try with this build? I put a proper fix in for this rather than just reverting the bad PR.

~dxwrapper.zip~

Edit: Please try this one instead: dxwrapper.zip

SilentMRG commented 2 days ago

Edit: Please try this one instead: dxwrapper.zip

Here is the log: dxwrapper-kaospc.log The latter presented the same error.

SilentMRG commented 2 days ago

I just want to take advantage of the topic and say that Freedom Fighters, the vanilla version and not the 2020 re-release, suffers from the same problem when exiting the game. I have the retail version and I just tested it, with the other version that didn't lock the State of Emergency, and with this last one.

Here are the logs: dxwrapper-freedom.log error.log

elishacloud commented 2 days ago

I was able to find and download State of Emergency, using a no-cd patch. I am not seeing the crash after starting a game and then exiting. Is there some special steps to do to get the crash?

Here is the build I am testing: dxwrapper.zip

SilentMRG commented 2 days ago

No steps, just the basics, get to the main menu and exit the game using the "Quit" option. Or load a game, enter the gameplay and then exit through the gameplay menu and then through the main menu.

What size No-CD are you using? Mine here is 1.97 MB (2,067,923 bytes), I don't know if that changes anything.

elishacloud commented 2 days ago

I am using the one from here.

SilentMRG commented 2 days ago

Try this: KaosPC.zip

SilentMRG commented 2 days ago

I was forgetting, I tested this last build and the same error occurred.

Maybe the problem is Windows 7? I mean, if you're optimizing things for Windows 10 and 11, eventually things will stop working on versions of Windows before 10.

elishacloud commented 2 days ago

Yes, I am testing with Windows 10. Could be something on Windows 7.

Edit: But since the one change worked then I need to figure out what is going on because it is a code change that fixed it.

SilentMRG commented 2 days ago

Just to be clear, the game never crashed when starting, it always crashes when exiting, with an exception error and sometimes an AppCrash.

SilentMRG commented 2 days ago

In fact, the same error occurs with Freedom Fighters when exiting, but in this case it is an AppCrash. With that other version it didn't crash. Look, I'm not programmer, but I'm thinking it might be a memory leak or something.

elishacloud commented 2 days ago

Ok, let me run some tests later when I have some time.

SilentMRG commented 2 days ago

Sometimes one of the dlls tries ferociously to eat memory while the game is running, and when it exits there is some kind of memory clogging or whatever, which ends up causing the game to freeze. Maybe there is a technical explanation for the nonsense I just said. XD

elishacloud commented 1 day ago

I tried Freedom Fighters also and I don't see any crashes on exit either. I used Windows 10 for both of the, I am installing Windows 7 to see if that makes a difference.

Here is what I am using to test: dxwrapper.zip

elishacloud commented 1 day ago

Ok, I can reproduce the crash on Windows 7. It does not seem to happen on Windows 10. Looking into it.

elishacloud commented 1 day ago

Ok, I believe this is the fix for the issue: dxwrapper.zip

Edit: I created a pull request for the fix here.

SilentMRG commented 1 day ago

Ok, I believe this is the fix for the issue: dxwrapper.zip

Edit: I created a pull request for the fix here.

It worked like a charm! Tested in State of Emergency and Freedom Fighters. =)

SilentMRG commented 1 day ago

I'm sure that all D3D8 games converted to D3D9 were facing this error in Windows 7. Strange that no one else reported this, maybe I'm the only crazy person in the world when using Windows 7 for games.

Edit: Just a side note... I remember using dxwrapper with Project Eden: https://www.gog.com/en/game/project_eden

It was a while ago, so maybe it's a false memory, but I remember it crashing when exiting with an exception error, and sometimes it would show a (rare) appcrash error when playing, anyway, I need to test the fix on it these days. Maybe this error was haunting me since that time, and due to lack of time I didn't report it here.

elishacloud commented 1 day ago

I don't know if it is certain patch levels in Windows 7 or what, but this issue should happen to most d3d8 games, if you have the right setup.

SilentMRG commented 1 day ago

Exactly... Well so far so good, I think I can close this, from what I understand it has been fixed. =D

Thanks man!

elishacloud commented 1 day ago

BTW: we did get another report of this issue here. Windows 7 64bit, crash on exit, everything is the same.

SilentMRG commented 1 day ago

Cowboy, you've discovered the mother of all fixes! This old leather has never seen anything like this before.