ThirteenAG / WidescreenFixesPack

Plugins to make or improve widescreen resolutions support in games, add more features and fix bugs.
https://thirteenag.github.io/wfp
MIT License
2.26k stars 215 forks source link

Need for Speed Underground crash immediately if screen orientation is changed #1421

Open slyh opened 1 year ago

slyh commented 1 year ago

Steam Deck has a screen with 800x1280 native resolution. Normally, users will change the orientation from portrait to landscape. The game will crash under that setting, but it seems to be willing to run under the bizarre 10:16 aspect ratio.

The same issue occurs with or without the widescreen fix installed. So it's very unlikely to be a bug in the fix. I'm not sure if it's an artefact introduced by the no-CD patch or a bug in the original game, but I think it will be beneficial to fix the issue here.

Steps to reproduce

  1. Install US 1.4 patch.

  2. Replace speed.exe with a no-CD patch.

    (I tried two different patches. Their SHA256 checksums: 4967FD7751843622B4AFBE8283F8E371CF1D99FF3C2D6E5AB4D23E25B0A8A5C9 35654F401383BE9AF0DBFF0D11A92220A17579A01030005DE6943E63E03F460F)

  3. Install widescreen fix.

  4. Change display orientation in Windows settings. If the original orientation is landscape, change it to portrait or vice versa.

  5. Launch speed.exe

Expected result

The game runs normally.

Actual result

The game crashed before playing the EA logo.

I'm able to reproduce this issue on a Steam Deck running Windows 11 and a Windows 10 PC with Intel iGPU.

258933989-2f98d9ec-a860-46d8-86e9-c3efaeeed7ba

Interestingly, if I patched the instruction with NOP, the game seems to run fine. I set a breakpoint on that memory location, it doesn't seem to trigger if the screen is in its original orientation.

258934077-2e6c2439-ea71-451c-9aba-78762727d2cc

xan1242 commented 1 year ago

Did you try running the game in borderless windowed mode as well?

The thing that crashes is something related to the internal resolution setting in the registry, so in essence it is kinda useless. I think we can safely nuke it.

xan1242 commented 1 year ago

There are more locations where it could crash. Try nopping that out and going into the video options menu. It should crash there too.

If that's the case, we'll have to freeze the resolution variable at 0x00700E70. I'm planning to do the same thing as in MW eventually anyways. (print out current resolution in video options menu and eventually get to injecting a custom resolution list)

slyh commented 1 year ago

I tried WindowedMode from 0 to 5, ResX * ResY as 0 * 0, 800 * 600 and 1280 * 720. As long as the screen isn't in its native orientation, the game crashed.

The game didn't crashed in video options (no exception threw), but it stuck in infinite loops at speed.exe:$151A3 and speed.exe:$15153 when I tried to change resolution in-game. Nopping those two locations allowed the game to exit from the loops. Other options didn't caused any issues.

mostafahussein commented 5 months ago

Any fix for this other than changing the orientation before starting the game?

Marsi4eg commented 3 months ago

Tried this game on my deck too (Windows 10 onboard) and faced the same problem - it only works in portrait mode