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

[NFS] Windowed mode issues #1291

Open dobriyprop opened 1 year ago

dobriyprop commented 1 year ago

Hi! I have a setup with mishmash of 3 different resolution displays and I encountered weird behavior when i tried to move game window in borderless mode (WindowedMode = 1) to from one display to another with Shift+Win+Arrow Buttons - game window shrinking in size losing aspect ratio until restart.

Steps to replicate: 1) Set WindowedMode = 1 in config 2) Start the game 3) Move game window to another display with different (smaller?) resolution using Shift+Win+Arrow Buttons

https://user-images.githubusercontent.com/18686703/228334821-d0428d2e-f0ca-4a50-8d36-6a798b0eba94.mp4

UPD: updated video in attachment.

xan1242 commented 1 year ago

This is unfortunately not exclusive to NFSU2, but other games as well.

Second issue:

IMG_20230402_110945

Window opening like this even if the resolution is correctly set.

This seems like a Windows scaling problem. Will try to gather more information from the user who posted the image.

xan1242 commented 1 year ago

OK, can confirm, user had 125% scale and that caused the issue of window positioning to NOT be at the center.

Seems like some Win32 shenanigans going on.

dobriyprop commented 1 year ago

I use 100% scale. It's just my monitors have different resolution. I suspect that in my case when you move the window between display with hotkeys windows proportionally shrinks the window to make it fit if resolution of destination display is lower than original display. Like 2560х1080->1920x1080->1280x1024.

xan1242 commented 1 year ago

Try using the latest dev build once it compiles (get it from the main website). Monitor swapping works for me (in ProStreet), but the same code is used in Underground 2, so give it a shot.

dobriyprop commented 1 year ago

Dumb question, but how can i know when a new dev build was compiled? On the main site for NFSU2 it says "Updated 161 days ago" and i suppose it speaks about stable release. I downloaded currently available dev build from there and i still have this behavior.

SpeedLiteXMW commented 1 year ago

I'm having the problem, when I minimized the game crashes. Have video (sorry for quality) https://streamable.com/o1d8lj

dobriyprop commented 1 year ago

Unfortunately it didn't fix the issue - window still being resized upon moving to smaller display. I've checked files change date time in dev build archive i downloaded - last time they were changed 02.04.2023 17:04, so i'm pretty sure i downloaded the latest dev build.

xan1242 commented 1 year ago

I'm having the problem, when I minimized the game crashes.

Yep, true, dynamic resizing mode crashes because I assume the game window goes to 1x1 and crashes the game.

To fix that we need to limit the window size to 32x32 because the game cannot go below 32x32 without crashing.

xan1242 commented 1 year ago

Unfortunately it didn't fix the issue - window still being resized upon moving to smaller display. I've checked files change date time in dev build archive i downloaded - last time they were changed 02.04.2023 17:04, so i'm pretty sure i downloaded the latest dev build.

Ah, well then, try again with the new dev build with the 2 new modes (borderless scaled and stretch).

The way you can find out is by going to the "Actions" tab in the Github page. Every time an action is performed and green, there's a new dev build available.

dobriyprop commented 1 year ago

Borderless Scale gives me the same behavior, Borderless Stretch makes it stretch to my 2560x1080 with 1920x1080 resolution specified and when i move it to second display it stretches to the taskbar leaving it exposed. Can you make borderless scale detect if window size was changed and if it is - restore it 1:1 to specified resolution in config or current display resolution and put the window in the middle of current screen?

jaigitrep159 commented 2 months ago

in Most Wanted (2005), i relate to this issue. i enabled WindowedMode set to 2, which is bordered. Set it to 720p, using Dev Build of Widescreen Fix of MW. Config:

[MAIN]
ResX = 1280                                 ; Use this option to control the horizontal resolution.
ResY = 720                                 ; Use this option to control the vertical resolution.
FixHUD = 1                               ; Corrects HUD aspect ratio.
FixFOV = 1                               ; Corrects FOV aspect ratio.
Scaling = 1                              ; Adjusts FOV aspect ratio. Requires FixFOV to be enabled. (0 = Original | 1 = Xbox 360 | 2 = Mathematically Correct)
HUDWidescreenMode = 1                    ; Moves HUD to the edge of the screen for 16:9. Install NFSMW HUD Adapter for other aspect ratios.
FMVWidescreenMode = 1                    ; FMVs will appear in fullscreen for 16:9. (1 = Cropped | 2 = Stretched)
FEScale = 1.00                           ; Set the size of UI elements here. (Default = 1.00, Xbox 360 = 0.92)
FMVScale = 1.00                          ; Set the size of FMVs here. (Default = 1.00)
AutoFitFE = 1                            ; Automatically scales the UI contents to fully fit the width of the screen. Useful for aspect ratios such as 16:10.
AutoFitFMV = 1                           ; Automatically scales the FMVs to fully fit the width of the screen. This introduces black bars on aspect ratios smaller than 16:9.

[MISC]
SkipIntro = 0                            ; Skips FMVs that play when you launch the game.
WindowedMode = 2                         ; Enables windowed mode. (1 = Borderless | 2 = Border | 3 = Resizable Border | 4 = Borderless Fullscreen | 5 = Borderless Fullscreen Stretched)
CustomUserFilesDirectoryInGameDir = 0    ; User files will be stored in a specified directory (for example: "save"). Use '0' to disable.
WriteSettingsToFile = 0                  ; All registry settings will be saved to "settings.ini" in your profile folder. You must input your CD key and langauge in "settings.ini" when this option is enabled.
ImproveGamepadSupport = 0                ; Replaces keyboard icons with gamepad icons and assigns front-end actions. Requires an XInput gamepad. (1 = Xbox Icons | 2 = PlayStation Icons | 3 = None)
LeftStickDeadzone = 10.0                 ; Controls the deadzone of the left analog stick.
ForceHighSpecAudio = 1                   ; Enables 44100Hz sample rate audio regardless of registry settings.
FixResolutionText = 1                    ; Shows the current resolution in the Video Options menu.
SimRate = 0                             ; Controls the refresh rate of the gameplay engine. Match your monitor's refresh rate or your target frame rate. (0 = Disabled | -1 = Monitor Refresh Rate | -2 = Double Monitor Refresh Rate)

[GRAPHICS]
ShadowsRes = 1024                        ; Controls the resolution of dynamic shadows and enables them for Intel GPUs. (1024 = Original | 2048 = Xbox 360 | 16384 = Max)
ShadowsFix = 1                           ; Dynamic shadows will no longer disappear when going into tunnels, under bridges, etc.
ImproveShadowLOD = 0                     ; Increases the level of detail of dynamic shadows. This may negatively affect performance.
AutoScaleShadowsRes = 1                  ; Adjusts the specified ShadowsRes based on the user's aspect ratio to maintain quality. This may negatively affect performance.
ShadowMapTextureFormat = 0               ; Set the texture format for the shadow map texture here. (-1 = Disable patches | 0 = D24S8 (Default, Sharp Shadows) | 1 = INTZ (Soft Shadows) | 2 = DF16 (Radeon Only, Soft Shadows) | 3 = DF24 (Radeon Only, Soft Shadows))
ForceSharpShadows = 0                    ; Forces the shadows to be sharp in texture formats that force soft shadows (INTZ, DF16 and DF24). This will cause more visible shadow pop-in, but result in much sharper stencil shadows.
RainDropletsScale = 0.5                  ; Adjusts the size of the on-screen rain droplets.
DisableMotionBlur = 1                    ; Allows users to disable motion blur without changing registry settings.
LightStreaksEnable = 0                   ; Leftover from NFS Underground 2. Enables the light trail effect. Not very visible at higher FPS than 60, but it does make the flares more saturated in color.
BleachByPassEnable = 0                   ; (EXPERIMENTAL) Leftover from NFS Underground 2. Enables the "Enhanced Contrast" effect. Requires the IDI_SCREENFILTER_FX shader from Underground 2 to work. If you do not have it, the screen will be blurry!
ForcedGPUVendor = 0x1002                 ; Force the GPU PCI VendorID here. This will affect the renderer and video options behavior. (0 = Disabled | 0x10DE = NVIDIA (Default) | 0x1002 = ATI/AMD | 0x8086 = Intel)

[NOSTrail]
FixNOSTrailLength = 1                    ; Fixes the NOS trail length for higher FPS.
CustomNOSTrailLength = 1.0               ; Adjusts the total distance of the NOS trail. You may need to adjust this if you're playing at very high FPS (240+). The higher the SimRate & FPS difference, the longer the trail.
FixNOSTrailPosition = 0                  ; Requires FixNOSTrailLength to be enabled. This will attempt to fix the trail from clipping the car by scaling its position away from the car.
NOSTrailPositionScalar = 0.3             ; Requires FixNOSTrailPosition to be enabled. This controls the trail position relative to the tail lights.

When i launch the game, it leads me to full screen. I want windowed mode already and not that! Fix this. In the latest build (on github), windowed mode works, but leads to full screen bordered mode which is sort of annoying. Screenshot (DEV Build): Screenshot (4) Screenshot: (Latest Build): Screenshot (5)

jaigitrep159 commented 2 months ago

Screenshot (6) I also tried ThirteenAG's d3d9-wrapper and just the same thing. When i apply changes to the video settings, the border size was shrinking and then just leads me to full-screen border.