xan1242 / hp2wsfix

Need for Speed: Hot Pursuit 2 PC - Widescreen fix
MIT License
43 stars 2 forks source link

Wine not tested #8

Closed coozoo closed 4 years ago

coozoo commented 4 years ago

Windows 7 or newer (Wine not tested)

Actually I've tried it doesn't work.... Nothing changed in game.

Maybe I did something wrong?

xan1242 commented 4 years ago

Very likely you did nothing wrong, it's the ASI loader crashing I think.

Try disabling the EnableConsole flag in the hp2wsfix.ini, maybe that will help, but if it doesn't I'll have to check more later.

coozoo commented 4 years ago

I've tried enalbe/disable (it is disabled by default) and still nothing. Don't know maybe problem somehow related to this In wine it looks like this:

  1. I'm starting nfshp2.exe
  2. getting crash window with crash wine: Unhandled page fault on read access to 00000190 at address 005380E6 (thread 0009), starting debugger...
  3. click Ok
  4. and game loaded

And BTW it's playonlinux Wine Staging 5.5.

Both vc2015 and 2019 are installed.

xan1242 commented 4 years ago

Hmm OK!

Will test in Wine ASAP (my Arch install is a bit out of date now, wish me luck updating it!).

xan1242 commented 4 years ago

Small update - currently in Linux and testing.

Problem stems from the Ultimate ASI Loader, just as I suspected before... Without it the game launches just fine. I am currently looking for a workaround (maybe I'll compile a custom ASI loader, I don't know as of yet...)

xan1242 commented 4 years ago

OK so some progress - I might be able to make an alternative version of this patch without the ASI loader.

I have managed to decompile Win2kHook.dll entirely and recompile it back fully! Compiling it is hacky but it works! Through that "hook" file we should be able to inject code in the executable relatively seamlessly.

The only downside is that it's later in the executing chain than Direct3DCreate8.

I'll look into fixing up the ASI loader still, this is just one of options that has managed to surface.

EDIT: I spoke too soon, this hook file is a literal Win32 hook... And it doesn't even work. It's supposed to be a keyboard input hook which uses GetAsyncKeyState but as it turns out it doesn't even get used. Win2kHook is out of the window, only thing remains is to find a way to inject code in some other way...

xan1242 commented 4 years ago

Even after fixing the ASI Loader to function in WinXP, the ASI still pagefaults at some address and crashes, but the game still runs. I'm still investigating the issue when I got the time.

xan1242 commented 4 years ago

I found a workaround for Wine users, please follow the steps to get this patch working:

WORKAROUND FOR WINE USERS:

Wine WILL throw exceptions for a pagefault at 0x5380e6, however, you can close Wine's exception handler and continue playing the game. This is due to the game having its own exception handler and Wine doesn't like that at all...

This is not a 100% solution but unfortunately, the exception handler can be killed for Linux so the error message doesn't pop up so it'll run smoother. I will add the necessary code for doing just that in a new release.