Widescreenfixespack: [NFSU] Menu hitboxes not centered

Created on 15 Dec 2017  路  16Comments  路  Source: ThirteenAG/WidescreenFixesPack

I never noticed this before because I always use my gamepad or keyboard when navigating the menus, but the clickable parts are still stretched making it difficult to use the mouse sometimes.

The other NFS games do not have this problem, so it should be fixable. I'll take a look this weekend.

Most helpful comment

It only took me a few months but I fixed it lol. So the hitboxes weren't stretched, they were already corrected but weren't being centered.

4:3 = -320
16:9 = -426 (-320 梅 0.75)

00415354 FFFFFEC0
004D1DF5 FFFFFEC0
004F7EDB FFFFFEC0
004F7D61 FFFFFEC0
004DC434 FFFFFEC0
004C1A35 FFFFFEC0
00415CA9 FFFFFEC0
004F7F32 FFFFFEC0
004EAA56 FFFFFEC0
00563CF6 FFFFFEC0
004E39A4 FFFFFEC0
0054F096 FFFFFEC0
0054F35F FFFFFEC0
005518D4 FFFFFEC0
00557ED8 FFFFFEC0
004D5166 FFFFFEC0
004B8CEC FFFFFEC0
004D66CD FFFFFEC0
004D674C FFFFFEC0
004B7E10 FFFFFEC0
004B8C6D FFFFFEC0
0055BAE6 FFFFFEC0
00559BA6 FFFFFEC0
0055CD8C FFFFFEC0
0055D7F4 FFFFFEC0
0055F0D6 FFFFFEC0
00561C94 FFFFFEC0
00562124 FFFFFEC0
00563916 FFFFFEC0

4:3 = 0
16:9 = -106 (-426 - -320)

004F6085 jmp XXXXXXXX
XXXXXXXX add eax,00000000 // integer goes here
XXXXXXXX lea ecx,[eax-00000140]
XXXXXXXX jmp 004F608B


Then the mouse boundaries need to be fixed because the game incorrectly scales it with resolution instead of aspect ratio, allowing the mouse to go way beyond the screen area.

004131B5 jmp XXXXXXXX
XXXXXXXX mov eax,[esi]
XXXXXXXX mov ecx,[XXXXXXXX] // 4:3 = 640, 16:9 = 853; integer
XXXXXXXX jmp 004131BB

004131CF jmp XXXXXXXX
XXXXXXXX mov eax,[edi]
XXXXXXXX mov ecx,[XXXXXXXX] // 480 static integer
XXXXXXXX jmp 004131D5

All 16 comments

Usually the older the game, the higher chance of something like that to occur :)

It only took me a few months but I fixed it lol. So the hitboxes weren't stretched, they were already corrected but weren't being centered.

4:3 = -320
16:9 = -426 (-320 梅 0.75)

00415354 FFFFFEC0
004D1DF5 FFFFFEC0
004F7EDB FFFFFEC0
004F7D61 FFFFFEC0
004DC434 FFFFFEC0
004C1A35 FFFFFEC0
00415CA9 FFFFFEC0
004F7F32 FFFFFEC0
004EAA56 FFFFFEC0
00563CF6 FFFFFEC0
004E39A4 FFFFFEC0
0054F096 FFFFFEC0
0054F35F FFFFFEC0
005518D4 FFFFFEC0
00557ED8 FFFFFEC0
004D5166 FFFFFEC0
004B8CEC FFFFFEC0
004D66CD FFFFFEC0
004D674C FFFFFEC0
004B7E10 FFFFFEC0
004B8C6D FFFFFEC0
0055BAE6 FFFFFEC0
00559BA6 FFFFFEC0
0055CD8C FFFFFEC0
0055D7F4 FFFFFEC0
0055F0D6 FFFFFEC0
00561C94 FFFFFEC0
00562124 FFFFFEC0
00563916 FFFFFEC0

4:3 = 0
16:9 = -106 (-426 - -320)

004F6085 jmp XXXXXXXX
XXXXXXXX add eax,00000000 // integer goes here
XXXXXXXX lea ecx,[eax-00000140]
XXXXXXXX jmp 004F608B


Then the mouse boundaries need to be fixed because the game incorrectly scales it with resolution instead of aspect ratio, allowing the mouse to go way beyond the screen area.

004131B5 jmp XXXXXXXX
XXXXXXXX mov eax,[esi]
XXXXXXXX mov ecx,[XXXXXXXX] // 4:3 = 640, 16:9 = 853; integer
XXXXXXXX jmp 004131BB

004131CF jmp XXXXXXXX
XXXXXXXX mov eax,[edi]
XXXXXXXX mov ecx,[XXXXXXXX] // 480 static integer
XXXXXXXX jmp 004131D5

Uff.. Sounds like a pain discovering that it was the centering.^^

Uff.. Sounds like a pain discovering that it was the centering.^^

It was. I got no where after several hours of research, so I decided to start from scratch and correct the HUD manually in case something in the widescreen fix was causing the issue, and that's when I noticed the hitboxes matched up as long as the HUD wasn't centered.

004F6085

When I patch this function, seems like other stuff breaks, for example I can no longer select menu entries with mouse cursor, unless it's all the way to the right.

https://transfer.sh/MvjUl/NFSUnderground.WidescreenFix.asi

When I patch this function, seems like other stuff breaks, for example I can no longer select menu entries with mouse cursor, unless it's all the way to the right.

I think something in the FixHUD code is causing that. If I turn that off and fix the HUD manually:

Width:
006CC914

X Pos:
004F1E2D
004F20A3
004F232F
004F26E5
004F28AF
004F3147
0054646B

Then change all the values / code for the mouse, everything works as intended
https://i.imgur.com/SrQ176b.gif

It's this https://github.com/ThirteenAG/WidescreenFixesPack/blob/master/source/NFSUnderground.WidescreenFix/dllmain.cpp#L199-L201

The code used to remove the off-screen text. Well that sucks. 馃檨

Edit: It appears to cause other problems as well, like making the +/- buttons disappear. I think it's best to disable this code unless @nlgzrgn could pull off another miracle.

Disabled, not sure how to deal with it atm. Dev build available.

Working good. nlgzrgn told me he might be able to find a better solution for removing the off-screen text, but we'll see what happens.

@AeroWidescreen Another possible solution is to pillarbox the menu, since I think we have a way to check when the game is in menu or not.

@ThirteenAG Yeah, sure. Personally the off-screen garbage doesn't bother me that much, so as long as the pillarboxing can be turned off then I have no issue with that.

@AeroWidescreen Added a new option.

@ThirteenAG Doesn't work for me, although I do see it's disabling the widescreen hud when in the menus.

@AeroWidescreen, use the latest dinput8.dll (ASI Loader). It didn't work for me as well, then I replaced the ASI loader with the newest one and voila! I think it's because of that "InitializeASI" thing.

@ThirteenAG
@nlgzrgn That makes sense, but it still isn't working for me. I'm simply taking the scripts folder and ASI loader and dropping it in the install folder. No changes to the ini, and I don't have any other mods installed.

[MAIN]
ResX = 0
ResY = 0
FixHUD = 1
FixFOV = 1
Xbox360Scaling = 1
HudWidescreenMode = 1
FMVWidescreenMode = 1

[MISC]
CustomUserFilesDirectoryInGameDir = 0
ImproveGamepadSupport = 0
LeftStickDeadzone = 10.0
D3DHookBorders = 1

ASI Loader

Disabling D3DHookBorders doesn't appear to have any effect either, since the widescreen HUD remains disabled in the frontend regardless.

Maybe this feature doesn't work with AMD cards? That's all I can think of unless I'm overlooking something really obvious, which I tend to do from time to time.

I'm not sure why it may not work, I use similar hook in just cause, so you might check it out and see if it's working there. I'll send you some other builds to test when I have more time.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Scar557 picture Scar557  路  6Comments

D3xxtr picture D3xxtr  路  10Comments

Storm3000 picture Storm3000  路  7Comments

nikitastepan0v picture nikitastepan0v  路  13Comments

vrubayka picture vrubayka  路  8Comments