narzoul / DDrawCompat

DirectDraw and Direct3D 1-7 compatibility, performance and visual enhancements for Windows Vista, 7, 8, 10 and 11
BSD Zero Clause License
893 stars 67 forks source link

Jane's Longbow starting video crash #174

Closed BEENNath58 closed 7 months ago

BEENNath58 commented 1 year ago

Jane's longbow Gold crashes with the starting video. The way I bypassed it is by using another ISO with a removed MOVIES.TRE from the first CD. This is a hindrance, as you miss out on a lot of action. Can you look into it?

There is a Glide and a DirectDraw version, of course we are looking into the latter. There's a 1.04 patch as well that didn't help much.

The game likes to need the EmulateHeap, EmulateFileMapping shim, single core usage as well as a 60FPS cap. Good luck!

narzoul commented 1 year ago

I can't reproduce the crash. I used only EmulateFileMapping and IgnoreException with DDrawCompat. Granted, the intro videos either don't play at all (skips both of them and goes to main menu), or they play, but then the first one is corrupted and skips to the second one after a few seconds. Looking at it with a debugger, there are some invalid memory access exceptions, but they don't seem to be related to DirectDraw, It's more likely to be audio based, since there was always either MSS32.DLL or WAIL32.DLL on the stack, depending on patch version.

I'll save this for a rainy day since it's unlikely to be ddraw related. It's most likely some obscure memory corruption in the game itself that will be hard to track down and patch.

BEENNath58 commented 1 year ago

There is a difference in results, because the "skipping video" thing, in my case, only applies to the Glide versions. And the videos when using Glide look grainy.

When I use the DDraw version (or patched with 1.4 patch using Dosbox), the video starts in a black screen and then crashes, no skipping videos or anything.

narzoul commented 1 year ago

Maybe the IgnoreException shim ignores access violations too, even though its documentation states that it should only ignore privileged mode instructions by default. Have you tried it? Actually, the game does use some privileged mode instructions too, so this shim is necessary anyway. I also get crashes without it. Maybe it doesn't use those instruction in glide mode. Have you checked with a debugger what kind of exceptions you're getting?

BEENNath58 commented 1 year ago

Maybe the IgnoreException shim ignores access violations too, even though its documentation states that it should only ignore privileged mode instructions by default.

It does handle access violations (the official leaked stuff has it there)

Have you tried it?

I tried. I had three cases:

Without any exception handling: game launches and crashes Ignore Exceptions: Video sound plays, no sound, and crash Handle Exceptions (DxWnd): Video sound plays, no sound, stuck in a loop.

I also get crashes without it. Maybe it doesn't use those instruction in glide mode.

In Glide mode, only Ignore Exceptions work, it starts a very grainy and corrupted video and skips after a while. And then the game launches.

Have you checked with a debugger what kind of exceptions you're getting?

I would like to, but I need to be guided (I never got to understand what to check and how to and whatever they mean)

Extra note: I noticed a weird behaviour. I basically used Glide + DxWnd, enabled Vsync in DxWnd and enabled the FPS overlay. If I go to Tutorial/Training > View Films > News Scrapbook and wait around 60 seconds, the videos start working. In fact, all videos from that point work. Like Look below: janeslbvideo

narzoul commented 1 year ago

Video sound plays, no sound

What does that mean?

I would like to, but I need to be guided (I never got to understand what to check and how to and whatever they mean)

For now just try to get a core dump with this guide (I really should put it in the wiki or something): https://github.com/narzoul/DDrawCompat/issues/50#issuecomment-520162844

You can open the core dump with Visual Studio, choose "Debug with Native Only" on the right side panel, then after it finishes loading the symbols, you should see a popup with the exception details. You can check the stack trace and such. The rest would probably involve digging through disassembled code, unless the crash happens to be in DDrawCompat or some other project for which source code is available.

BEENNath58 commented 1 year ago

What does that mean?

Typo, I meant to say "Sound of the video plays, but there's no video visible, its just black"

You can open the core dump with Visual Studio, choose "Debug with Native Only" on the right side panel, then after it finishes loading the symbols, you should see a popup with the exception details. You can check the stack trace and such.

It says "Unhandled exception at 0x03E494C3 (WRAPDLL.DLE) in LBWIN.EXE.3544.dmp: 0xC0000005: Access violation reading location 0x0F030000."

Doesn't sound nice to me. Probably you are aware of the problems with EmulateHeap on Win11 22H2 too, the shim was not enabled in the tests so it only points everything at WRAPDLL.DLE