-
-
Notifications
You must be signed in to change notification settings - Fork 204
feat: in-game quick menu fps cap #1081
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
xXJSONDeruloXx
wants to merge
14
commits into
utkarshdalal:master
Choose a base branch
from
xXJSONDeruloXx:feat/quick-menu-fps-clamp
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
80c362e
feat: add in-game quick menu fps limiter
xXJSONDeruloXx 42c860c
Merge remote-tracking branch 'upstream/master' into feat/quick-menu-f…
xXJSONDeruloXx fa246de
fix: localize fps limiter strings
xXJSONDeruloXx 924f2d5
fix: fps limiter now throttles game render loop via Present extension…
xXJSONDeruloXx 5a31c3c
feat: fps limiter redesign — toggle + remembered target, steps 5–maxHz
xXJSONDeruloXx c745597
feat: remove fps limiter toggle subtitle/description
xXJSONDeruloXx 01d5d6c
fix: fps limiter steps floor to multiples of 5, preserve display max …
xXJSONDeruloXx abbf87a
fix: fps limiter review bugs and unit tests
xXJSONDeruloXx c7f6f22
fix: remove close() from onRelease, msc monotonicity, display min floor
xXJSONDeruloXx bdc649b
fix: sendEvent stream lock, capturedGen ordering
xXJSONDeruloXx ae0733f
refactor(fps-limiter): preserve legacy DXVK defaults in new limiter
xXJSONDeruloXx a9438b8
fix(perf-hud): restore frame rating updates for tracked window
xXJSONDeruloXx c56229b
chore: merge upstream/master into feat/quick-menu-fps-clamp
xXJSONDeruloXx 44db81d
Merge remote-tracking branch 'upstream/master' into feat/quick-menu-f…
xXJSONDeruloXx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
app/src/main/java/app/gamenative/ui/component/FpsLimiterUtils.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package app.gamenative.ui.component | ||
|
|
||
| internal fun fpsLimiterSteps(maxFps: Int): List<Int> { | ||
| val sanitizedMax = maxFps.coerceAtLeast(5) | ||
| val flooredMax = (sanitizedMax / 5) * 5 | ||
| return buildList { | ||
| var value = 5 | ||
| while (value <= flooredMax) { | ||
| add(value) | ||
| value += 5 | ||
| } | ||
| if (sanitizedMax != flooredMax) add(sanitizedMax) | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Returns the index of the step that is the floor of [currentValue] — i.e. the highest | ||
| * step that is still ≤ currentValue. Falls back to 0 if currentValue is below the | ||
| * first step, so navigation never goes in the wrong direction on a restored value that | ||
| * isn't an exact multiple of 5. | ||
| */ | ||
| internal fun fpsLimiterCurrentIndex(steps: List<Int>, currentValue: Int): Int = | ||
| steps.indexOfLast { it <= currentValue }.coerceAtLeast(0) | ||
|
|
||
| internal fun fpsLimiterProgress(currentValue: Int, maxFps: Int): Float { | ||
| val steps = fpsLimiterSteps(maxFps) | ||
| val currentIndex = fpsLimiterCurrentIndex(steps, currentValue) | ||
| return if (steps.lastIndex <= 0) 1f else currentIndex.toFloat() / steps.lastIndex.toFloat() | ||
| } | ||
|
|
||
| internal fun nextFpsLimiterValue(currentValue: Int, maxFps: Int): Int { | ||
| val steps = fpsLimiterSteps(maxFps) | ||
| val currentIndex = fpsLimiterCurrentIndex(steps, currentValue) | ||
| return steps[(currentIndex + 1).coerceAtMost(steps.lastIndex)] | ||
| } | ||
|
|
||
| internal fun previousFpsLimiterValue(currentValue: Int, maxFps: Int): Int { | ||
| val steps = fpsLimiterSteps(maxFps) | ||
| val currentIndex = fpsLimiterCurrentIndex(steps, currentValue) | ||
| return steps[(currentIndex - 1).coerceAtLeast(0)] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.