forum

Script to change gamma with keyboard, and why you want to

posted
Total Posts
10
Topic Starter
Mio Winter
Jolene has a great video where she explains the benefits of reducing or increasing gamma during gameplay. I'll summarise the main points but each point is demonstrated visually in the video.

Summary of the effects of gamma on gameplay

• Increasing gamma will make circles visible sooner, because normally they fade in instead of being at full brightness immediately. This is very usefwl for playing high AR, for example with HR.

• Lowering gamma will make circles visible later, which is usefwl for playing maps with high object density*. The effect of this is actually quite significant, and helps me a lot when I'm playing EZ.

* "Object density" is how many objects are visible on the screen at once. The higher the object density, the harder it is to read the patterns, which is why the EZ mod is actually very hard. The object density of a map depends on its AR, but also on how fast it is mapped. For example, a 250 bpm alternating map on AR 9 may be just as hard to read due to object density as a different 170 bpm map at AR8, simply because the first map has more circles per unit of time. Lowering gamma on maps like that may prove usefwl.

• The HD mod makes circles fade out before you have to click them. Increasing gamma will therefore make the circles stay visible for longer, which can be usefwl in some situations. But if you're playing a low-AR map on HD, increasing gamma will increase object density, so whether you want to increase or decrease gamma when using HD is usually a trade-off between these two things. Whether you want to increase or reduce gamma when playing EZHD depends on your individual skills, and whether you have most problems with the object density or the early fade-out.

Script for changing gamma with keyboard shortcuts

If you have to spend several seconds every time you want to change gamma while playing osu, then that may just be too annoying to bother with. Which is why I prefer using keyboard shortcuts that I can use with a single hand, to quickly change gamma between each map, or even between individual parts of a single map. osu!dev smoogipooo says that it is not considered cheating, by the way. You need to install AutoHotkey to make it work.

Source code
#Persistent
OnExit, EOF

; ====================================================================================================
; Forum post about this script: t/739912
; DisplaySetBrightness (x) sets the gamma of monitor to x (min 0 and max 255). DisplayAdjustBrightness(x) increases (or decreases) gamma by x.
; Got the original script from here, and edited it slightly based on my needs: https://autohotkey.com/boards/viewtopic ... 760#p45760
; I use NumpadEnter because then I can adjust gamma without letting go of my mablet with my right hand. You can use whatever key you want.
; Here's a list of possible hotkeys: https://www.autohotkey.com/docs/Hotkeys.htm

NumpadEnter & Numpad1:: DisplaySetBrightness(0) ; sets the gamma to the min value (0).

NumpadEnter & Numpad4:: DisplaySetBrightness(50)

NumpadEnter & Numpad5:: DisplaySetBrightness(128) ; sets the gamma to the default value (128).

NumpadEnter & Numpad6:: DisplaySetBrightness(200)

NumpadEnter & Numpad9:: DisplaySetBrightness(255) ; sets the gamma to the max value (255).

NumpadEnter & Numpad8:: DisplayAdjustBrightness(10) ; increases gamma by 10.

NumpadEnter & Numpad2:: DisplayAdjustBrightness(-10) ; decreases gamma by 10.

; ====================================================================================================

DisplayAdjustBrightness(V = 0)
{
SB := (SB := DisplayGetBrightness() + V) > 255 ? 255 : SB < 0 ? 0 : SB
DisplaySetBrightness(SB)
}

DisplaySetBrightness(SB := 128)
{
loop % VarSetCapacity(GB, 1536) / 6
NumPut((N := (SB + 128) * (A_Index - 1)) > 65535 ? 65535 : N, GB, 2 * (A_Index - 1), "UShort")
DllCall("RtlMoveMemory", "Ptr", &GB + 512, "Ptr", &GB, "UPtr", 512, "Ptr")
, DllCall("RtlMoveMemory", "Ptr", &GB + 1024, "Ptr", &GB, "UPtr", 512, "Ptr")
return DllCall("gdi32.dll\SetDeviceGammaRamp", "Ptr", hDC := DllCall("user32.dll\GetDC", "Ptr", 0, "Ptr"), "Ptr", &GB), DllCall("user32.dll\ReleaseDC", "Ptr", 0, "Ptr", hDC)
}

DisplayGetBrightness(ByRef GB := "")
{
VarSetCapacity(GB, 1536, 0)
, DllCall("gdi32.dll\GetDeviceGammaRamp", "Ptr", hDC := DllCall("user32.dll\GetDC", "Ptr", 0, "Ptr"), "Ptr", &GB)
return NumGet(GB, 2, "UShort") - 128, DllCall("user32.dll\ReleaseDC", "Ptr", 0, "Ptr", hDC)
}

; ====================================================================================================

EOF:
DisplaySetBrightness(128) ; Sets gamma back to normal (128) when you exit the program
ExitApp
Download


You can make the ahk script run on startup, so you don't have to start it every time you play osu. Open Run (Windows-key + R), and type "shell:startup", and copy a shortcut of the script, into that folder.

The default keyboard shortcuts work like this, but you can edit them in the script:

• numpadEnter + numpad8 (increase by 10)
• numpadEnter + numpad2 (decrease by 10)
• numpadEnter + numpad1 (set gamma to 0) (min)
• numpadEnter + numpad4 (set gamma to 50)
• numpadEnter + numpad5 (set gamma to 128) (this is default)
• numpadEnter + numpad6 (set gamma to 200)
• numpadEnter + numpad9 (set gamma 255) (max)
Wishes
Woah this is pretty neat, works great! Had to change the hotkeys though since I already remap the numpad with autohotkey. Feels a little bit like cheating though; turned gamma all the way up and AR10 felt a bit slower lol. Anyways interesting program, thanks for sharing! :D
Topic Starter
Mio Winter

Wishes wrote:

Woah this is pretty neat, works great! Had to change the hotkeys though since I already remap the numpad with autohotkey. Feels a little bit like cheating though; turned gamma all the way up and AR10 felt a bit slower lol. Anyways interesting program, thanks for sharing! :D
I like your name.
Wishes

Mio Winter wrote:

I like your name.


Thanks hehe :)
D_Loomz
This is pretty nice!^^
Polygraph Eyes
Thanks you man! It really helps :D
lazyRETRO
Hey, its works but its goes off after sec . wont stay. How i fix this ?
Boku No Rainbow
Wow i feel stupid now, just rasing my screens brightness actually made HR feel alot easier. Maybe placebo?

I normally dim my monitor alot when playing osu cause i play it with the lights off right before bed. Maybe i'll just dim the background more and play like this. Or not i'm an ar8.8 kinda guy anyways ¯\_(ツ)_/¯
mikatsu
Hey I got a question, when I run this authotkey thing, my numpad enter stops working. Well it works, I can change the gamma, but thats where the numpadEnter key only works. It doesn't function as enter. Do you know how to fix this?
darkhim98

Mikatsu wrote:

Hey I got a question, when I run this authotkey thing, my numpad enter stops working. Well it works, I can change the gamma, but thats where the numpadEnter key only works. It doesn't function as enter. Do you know how to fix this?
because your script is running... turn it off to return to the old num enter function.
Please sign in to reply.

New reply