Difference between revisions of "DPI"

From Sinden Lightgun
Jump to navigation Jump to search
imported>McShufts
(Added link to ChangeScreenResolution)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
For certain emulators/games in Windows having DPI set to anything over 100% and resolution above 1080p can affect bezels and tracking. This AHK can allow you to change resolution and DPI by editing the directory. Add it into your own AHK when launching certain games/emulators.  
+
For certain emulators/games in Windows, having DPI set to anything over 100% and a resolution above 1080p can affect bezels and tracking. This AHK can allow you to change resolution and DPI by editing the directory. Add it into your own AHK when launching certain games/emulators.  
  
 
==WARNING==
 
==WARNING==
 
<big>'''WARNING - This AHK edits your registry, use at your own risk!'''</big>
 
<big>'''WARNING - This AHK edits your registry, use at your own risk!'''</big>
 
<br>
 
<br>
<br>If you want a simpler method of changing resolution please check the [[ChangeScreenResolution]] page
+
<br>If you want a simpler method of changing resolution, please check the [[ChangeScreenResolution]] page
  
 
==Required User Steps==
 
==Required User Steps==
  
* First open the Registry (Win + R, enter 'regedit', press return)
+
* First, open the Registry (Win + R, enter 'regedit', and press return)
* Navigate to HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\ and take note of the entry. This will relate to your monitor(s), hopefully it will say something like 'ACR' for Acer or SAM for Samsung at the start to match your monitor's brand name).
+
* Navigate to HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\ and take note of the entry. This will relate to your monitor(s), hopefully, it will say something like 'ACR' for Acer or SAM for Samsung at the start to match your monitor's brand name).
 
* Copy the name of the folder and replace both '<monitor entry here>' sections on lines 3 and 23  
 
* Copy the name of the folder and replace both '<monitor entry here>' sections on lines 3 and 23  
 
[[File:Regedit.png|alt=Screenshot of Registry Editor expanded to show HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\ with PerMonitorSettings highlighted in red|none|thumb|515x515px]]
 
[[File:Regedit.png|alt=Screenshot of Registry Editor expanded to show HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\ with PerMonitorSettings highlighted in red|none|thumb|515x515px]]
<br>
 
<br>
 
  
 
==Script Explaination==
 
==Script Explaination==
Line 19: Line 17:
 
*The DpiValue section on line 3 sets the DPI to 100% from 150%
 
*The DpiValue section on line 3 sets the DPI to 100% from 150%
  
''also works for 300% so -2 '''should''' mean 100% but you may need to experiment''
+
''also works for 300% so -2 should'' mean 100% ''but you may need to experiment''
  
*Lines 5-17 changes the resolution to 1080p
+
*Lines 5-17 change the resolution to 1080p
  
*Line 23 changes the DPI to the recommended (default) DPI for the monitor. If using the non-recommended DPI you may need to adjust this value.  
+
*Line 23 changes the DPI to the monitor's recommended (default) DPI. If using the non-recommended DPI, you may need to adjust this value.  
  
 
*Linse 25-37 changes the resolution back to 4K
 
*Linse 25-37 changes the resolution back to 4K
<br>
 
  
 
<syntaxhighlight lang="ahk" line="1" start="1">
 
<syntaxhighlight lang="ahk" line="1" start="1">
Line 67: Line 64:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
<br>
 
<br>
 
  
 
==Time Crisis 5 Example==
 
==Time Crisis 5 Example==
You can use these AHK scripts for launching a game/emulator, an example for Time Crisis 5 is below.  
+
You can use these AHK scripts for launching a game/emulator; an example for Time Crisis 5 is below.  
  
 
*This includes disabling and restoring the second display as well (lines 9 & 85).  
 
*This includes disabling and restoring the second display as well (lines 9 & 85).  
  
Add the code for switching before launching the game/emulator and the switch back after you've closed the game/emulator.
+
Add the code for switching before launching the game/emulator and then switch back after you've closed the game/emulator.
 
<br>
 
<br>
  
Line 170: Line 165:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
<br>
 
<br>
 
 
__FORCETOC__
 
__FORCETOC__
 
[[Category:3rd Party Tools]]
 
[[Category:3rd Party Tools]]

Latest revision as of 16:11, 28 December 2022

For certain emulators/games in Windows, having DPI set to anything over 100% and a resolution above 1080p can affect bezels and tracking. This AHK can allow you to change resolution and DPI by editing the directory. Add it into your own AHK when launching certain games/emulators.

WARNING

WARNING - This AHK edits your registry, use at your own risk!

If you want a simpler method of changing resolution, please check the ChangeScreenResolution page

Required User Steps

  • First, open the Registry (Win + R, enter 'regedit', and press return)
  • Navigate to HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\ and take note of the entry. This will relate to your monitor(s), hopefully, it will say something like 'ACR' for Acer or SAM for Samsung at the start to match your monitor's brand name).
  • Copy the name of the folder and replace both '<monitor entry here>' sections on lines 3 and 23
Screenshot of Registry Editor expanded to show HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\ with PerMonitorSettings highlighted in red

Script Explaination

  • The DpiValue section on line 3 sets the DPI to 100% from 150%

also works for 300% so -2 should mean 100% but you may need to experiment

  • Lines 5-17 change the resolution to 1080p
  • Line 23 changes the DPI to the monitor's recommended (default) DPI. If using the non-recommended DPI, you may need to adjust this value.
  • Linse 25-37 changes the resolution back to 4K
 1;Set Resolution to 1920x1080 DPI 100%
 2
 3RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\<monitor entry here>, DpiValue, -2
 4
 5ChangeDisplaySettings( (ClrDep:=32) , (Wid:=1920) , (Hei:=1080) , (Hz:=60) )
 6
 7ChangeDisplaySettings( cD, sW, sH, rR ) {
 8
 9VarSetCapacity(dM,156,0), NumPut(156,dM,36)
10
11DllCall( "EnumDisplaySettingsA", UInt,0, UInt,-1, UInt,&dM ), NumPut(0x5c0000,dM,40)
12
13NumPut(cD,dM,104),  NumPut(sW,dM,108),  NumPut(sH,dM,112),  NumPut(rR,dM,120)
14
15Return DllCall( "ChangeDisplaySettingsA", UInt,&dM, UInt,0 )
16
17}
18
19Esc::
20
21;Restore resolution back to 3840x2160 DPI 150%
22
23RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\<monitor entry here>, DpiValue, 0
24
25ChangeDisplaySettings2( (ClrDep:=32) , (Wid:=3840) , (Hei:=2160) , (Hz:=60) )
26
27ChangeDisplaySettings2( cD, sW, sH, rR ) {
28
29VarSetCapacity(dM,156,0), NumPut(156,dM,36)
30
31DllCall( "EnumDisplaySettingsA", UInt,0, UInt,-1, UInt,&dM ), NumPut(0x5c0000,dM,40)
32
33NumPut(cD,dM,104),  NumPut(sW,dM,108),  NumPut(sH,dM,112),  NumPut(rR,dM,120)
34
35Return DllCall( "ChangeDisplaySettingsA", UInt,&dM, UInt,0 )
36
37}

Time Crisis 5 Example

You can use these AHK scripts for launching a game/emulator; an example for Time Crisis 5 is below.

  • This includes disabling and restoring the second display as well (lines 9 & 85).

Add the code for switching before launching the game/emulator and then switch back after you've closed the game/emulator.

 1#NoEnv
 2
 3SendMode Input
 4
 5#SingleInstance Force
 6
 7;Set screen to Primary Only
 8
 9RunWait C:\Windows\System32\DisplaySwitch.exe /internal
10
11sleep, 2000
12
13SetWorkingDir D:\Games\Emulation\Time Crisis 5\TC5\Binaries\Win64
14
15;Set Resolution to 1920x1080 DPI 100%
16
17RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\ACR0460#ASOiujyJugrd_00_07DD_8B^C9976F11F0A22F88CF4AFF8329D38111, DpiValue, -2
18
19ChangeDisplaySettings( (ClrDep:=32) , (Wid:=1920) , (Hei:=1080) , (Hz:=60) )
20
21ChangeDisplaySettings( cD, sW, sH, rR ) {
22
23VarSetCapacity(dM,156,0), NumPut(156,dM,36)
24
25DllCall( "EnumDisplaySettingsA", UInt,0, UInt,-1, UInt,&dM ), NumPut(0x5c0000,dM,40)
26
27NumPut(cD,dM,104),  NumPut(sW,dM,108),  NumPut(sH,dM,112),  NumPut(rR,dM,120)
28
29Return DllCall( "ChangeDisplaySettingsA", UInt,&dM, UInt,0 )
30
31}
32
33Run, D:\Games\Emulation\DemulShooter_v10.1.5\demulshooterX64.exe -target=es3 -rom=tc5
34
35sleep, 1000
36
37Run, D:\Games\Emulation\nomousy\nomousy.bat
38
39Run, "D:\Games\Emulation\Time Crisis 5\TC5\Binaries\Win64\start.bat"
40
41RButton::t
42
431::y
44
45v::<+t
46
475::<+h
48
49MButton::
50
51WheelUpDown:
52
53Send,{WheelDown 1}
54
55Return
56
57Esc::
58
59Process,Close,TimeCrisisGame-Win64-Shipping.exe
60
61Run,taskkill /im "TimeCrisisGame-Win64-Shipping.exe" /F
62
63run, D:\Games\Emulation\nomousy\nomousy.bat
64
65;Restore resolution back to 3840x2160 DPI 150%
66
67RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\ACR0460#ASOiujyJugrd_00_07DD_8B^C9976F11F0A22F88CF4AFF8329D38111, DpiValue, 0
68
69ChangeDisplaySettings2( (ClrDep:=32) , (Wid:=3840) , (Hei:=2160) , (Hz:=60) )
70
71ChangeDisplaySettings2( cD, sW, sH, rR ) {
72
73VarSetCapacity(dM,156,0), NumPut(156,dM,36)
74
75DllCall( "EnumDisplaySettingsA", UInt,0, UInt,-1, UInt,&dM ), NumPut(0x5c0000,dM,40)
76
77NumPut(cD,dM,104),  NumPut(sW,dM,108),  NumPut(sH,dM,112),  NumPut(rR,dM,120)
78
79Return DllCall( "ChangeDisplaySettingsA", UInt,&dM, UInt,0 )
80
81}
82
83;Restore extended display
84
85RunWait C:\Windows\System32\DisplaySwitch.exe /extend
86
87sleep, 2000
88
89ExitApp