Skip to content

Add support for passing decimal refresh rates to gamescope thru the command line #1455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sharkautarch
Copy link

To avoid any floating-point weirdness, I decided to make the code get the whole part and the decimal part of the string arg, convert it to 64 bit unsigned ints, (and also get the length of the decimal part) and do the mathy stuff to calculate the converted-to-mHz value from those integers.

Little bonus is that the code accepts using either a (,) comma or (.) period as the decimal separator, lol :P

I did a little bit of testing to make sure int32_t ConvertHztomHz( const char* refreshHz ) was handling both decimal number-strings and whole-number-strings correctly, and everything just works!

@sharkautarch sharkautarch force-pushed the decimal_nested_refresh branch 8 times, most recently from 279f919 to a7be015 Compare August 7, 2024 03:06
@sharkautarch sharkautarch force-pushed the decimal_nested_refresh branch 3 times, most recently from e066e99 to 44def3d Compare August 12, 2024 19:03
@sharkautarch
Copy link
Author

I recently edited this PR to use Split() from convar.h instead of the c-style strcspn I was using before.
I also made sure it was still working correctly after the edits.

@sharkautarch sharkautarch force-pushed the decimal_nested_refresh branch from 44def3d to ab5b008 Compare August 14, 2024 12:22
@sharkautarch sharkautarch force-pushed the decimal_nested_refresh branch from ab5b008 to ab1ea66 Compare August 14, 2024 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant