ThirteenAG / d3d9-wrapper

The Unlicense
102 stars 24 forks source link

Add refresh rate option #13

Closed Kappa971 closed 2 years ago

Kappa971 commented 2 years ago

Hi, an option to specify the monitor refresh rate would be useful, especially when using Nvidia DSR. Some games such as Splinter Cell Chaos Theory or Far Cry, but generally all older games that don't allow you to specify the monitor refresh rate, when used with DSR, will always use the lowest supported refresh rate for that DSR resolution. For example with my 144hz monitor, DSR supports 75hz, 100hz and 144hz. 75hz will always be chosen as the game doesn't allow you to select 144hz.

DSR has had this bug for many years but it seems Nvidia doesn't really care.

ThirteenAG commented 2 years ago

Tom Clancy's Splinter Cell Chaos Theory 15 09 2022 12_58_47 I'm unable to reproduce this, tried windowed and fullscreen mode.

Kappa971 commented 2 years ago

Reproducing the problem is very simple:

  1. you need a 144hz monitor, maybe a 120hz one is fine too (Freesync or Gsync I think is irrelevant) and an Nvidia video card
  2. Set, for example, DSR 4x (in my case the DSR resolution is 3840x2160)
  3. Run Splinter Cell Chaos Thery, check the monitor's OSD, and you will see that the monitor has been set to the minimum supported refresh rate for that DSR resolution (in my case 75hz): scr1

Some monitors are set to 60hz.

FPS are not affected by this, unless vsync is enabled. In your screenshot, the game is running at 305fps, but I bet the monitor is running at 60/75hz. This driver problem has been around for years and has never been fixed, you will find many people on the web who have this problem. I generally use DSR only in games where other antialiasing methods fail, and they are usually DirectX9 games like Splinter Cell Chaos Theory, Far Cry or GTA 4. However, GTA 4 doesn't suffer from this because in the game menu it allows you to select the desired refresh rate.

EDIT My monitor is connected with DisplayPort.

ThirteenAG commented 2 years ago

Hm, I think it doesn't happen to me in windowed, but in fullscreen it shows 60hz/60fps(in menu)/400+fps(in game).

ThirteenAG commented 2 years ago

@Kappa971 can you try this version? d3d9.zip

Kappa971 commented 2 years ago

@Kappa971 can you try this version? d3d9.zip

Unfortunately the game still runs at 75hz

ThirteenAG commented 2 years ago

@Kappa971 can you try this version? d3d9.zip

Unfortunately the game still runs at 75hz

Have you set the desired refresh rate in the ini?

Kappa971 commented 2 years ago

Have you set the desired refresh rate in the ini?

Yes.

This is d3d9.ini:

[MAIN]
FPSLimit = 0                                   // max fps (0: unlimited/off)
FPSLimitMode = 1                               // 1: realtime (thread-lock)  -  2: accurate (sleep-yield)
FullScreenRefreshRateInHz = 144                  // overrides refresh rate selected by directx
DisplayFPSCounter = 0                          // displays fps and frametime on screen
ForceWindowedMode = 0                          // activates forced windowed mode

[FORCEWINDOWED]
UsePrimaryMonitor = 0                          // move window to primary monitor
CenterWindow = 1                               // center window on screen
BorderlessFullscreen = 0                       // borderless fullscreen windowed mode
AlwaysOnTop = 0                                // window stays always on top
DoNotNotifyOnTaskSwitch = 0                    // window ignores focus loss

This is SplinterCellChaosTheory.WidescreenFix.ini:

[MAIN]
ResX = 3840
ResY = 2160
HudWidescreenMode = 1 // Makes certain hud elements offset to screen edges.
WidescreenHudOffset = 100.0 // This is the default offset for 16:9. For lower aspect ratios adjusted automatically, for higher you may change it manually.
DisableAltTabFix = 0 // Set 1 to disable Alt+Tab fix
;Game Language
; English = 0
; French = 1
; German = 2
; Hungarian = 3
; Italian = 4
; Polish = 5
; Russian = 6
; Spanish = 7
GameLanguage = 4

[GRAPHICS]
;Shadow map size, can be: 0 , 2048, 3072, 4096, 5120, 6144, 7168, 8192
; 0 = 2048 = disable shadow map size changing, use game default (2048)
ShadowMapResolution = 8192
EnableShadowFiltering = 1 // If 1, shadows will be smoother, but will be broken on multi-monitor screen resolution

[MISC]
FPSLimit = 0

[BONUS]
GogglesLightColor = 0
;Default: 0
;Topaz: 0x907818 https://i.imgur.com/NkvtEuj.jpg
;Voron Red: 0xF00000 https://i.imgur.com/KgYBIIA.jpg
;Navy: 0x1848D8 https://i.imgur.com/blOfXlc.jpg
;Pink: 0x601848 https://i.imgur.com/hYTneNu.jpg
;Violet: 0x481878 https://i.imgur.com/ktxASgH.jpg
;White: 0xFFFFFF https://i.imgur.com/BJnRZKl.jpg
;Gold: 0x606018 https://i.imgur.com/FB9QlkV.jpg
;Amber: 0x784800 https://i.imgur.com/vil4zn4.jpg
;Ghost Blue: 0x1878A8 https://i.imgur.com/vdCM2FQ.jpg
ThirteenAG commented 2 years ago

Ah, sorry, my bad, this is the proper version: d3d9.zip

Kappa971 commented 2 years ago

Ah, sorry, my bad, this is the proper version: d3d9.zip

Now it seems to work, thanks @ThirteenAG

ThirteenAG commented 2 years ago

Alright, I'll push those changes to a pull request #14 for now.