feat: add support for frame time budget to configs and mcm#4
feat: add support for frame time budget to configs and mcm#4KaninHop wants to merge 7 commits intoDaymareOn:mainfrom
Conversation
📝 WalkthroughWalkthroughReplaces percentage-based SMP frame-time budgeting with millisecond-based Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Source/Scripts/FSMPM.psc`:
- Line 91: The AddSliderOptionST call currently uses JMap.getStr(configMapId,
"budgetMs", 3.5) as float which drops legacy values; change it to prefer a
migrated legacy key by first checking JMap.getStr(configMapId,
"percentageOfFrameTime", null) (or equivalent "percentageOfFrameTime" getter)
and if present convert/parse that value into the new budgetMs, otherwise fall
back to the shipped default of 3 (not 3.5); apply the same migration/fallback
change wherever JMap.getStr(..., "budgetMs", 3.5) appears (e.g., the other
occurrences referenced at the other ranges) so existing configs/presets are
preserved on load.
- Around line 140-145: OnPageReset populates only up to min(presetsFiles.Length,
presetsInt.Length), but OnOptionSelect still scans the full presetsInt length
which can pick stale tails; update OnOptionSelect to iterate only to count =
min(presetsFiles.Length, presetsInt.Length) when mapping selected option to
presetFileIndex and ensure presetFileIndex is validated against that same bound,
and modify OnPageReset to explicitly clear any unused tail entries in presetsInt
beyond that count so stale entries cannot be selected.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 150e58ff-8951-47ec-8623-5af87ea722b7
📒 Files selected for processing (8)
SKSE/Plugins/hdtSkinnedMeshConfigs/configs.xmlSKSE/Plugins/hdtSkinnedMeshConfigs/configsPresets/Debug.xmlSKSE/Plugins/hdtSkinnedMeshConfigs/configsPresets/Performance.xmlSKSE/Plugins/hdtSkinnedMeshConfigs/configsPresets/Quality.xmlSKSE/Plugins/hdtSkinnedMeshConfigs/configsPresets/Reasonable.xmlScripts/FSMPM.pexScripts/FSMPMPlayerScript.pexSource/Scripts/FSMPM.psc
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
Source/Scripts/FSMPM.psc (1)
152-155:⚠️ Potential issue | 🟠 MajorPrefer
-1over0for empty preset slots.The bounded scan is the right fix, but SkyUI only documents
AddTextOption()as returning a unique option ID; it does not reserve0as invalid. Clearing the tail to0and then rejecting0at Line 165 makes selection depend on an undocumented API detail, so the first preset can become unselectable if its ID is0. Use-1for unused slots instead. (github.com)🛠️ Suggested hardening
While (index < presetsInt.Length) - presetsInt[index] = 0 + presetsInt[index] = -1 index += 1 EndWhile ... - if (presetsInt[index] != 0 && presetsInt[index] == a_option) ; found + if (presetsInt[index] != -1 && presetsInt[index] == a_option) ; found presetFileIndex = index endifAlso applies to: 164-165
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Source/Scripts/FSMPM.psc` around lines 152 - 155, The preset clearing loop resets unused slots to 0 which collides with AddTextOption() potentially returning 0; update the tail-clearing in the While that writes to presetsInt[index] to use -1 for unused slots instead of 0, and ensure any code that checks for invalid selection (the logic around rejecting 0 at selection time) treats -1 as the sentinel; modify the While block that assigns presetsInt[index] and any selection filter that currently checks for 0 so they consistently use -1 as the unused-slot marker.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Source/Scripts/FSMPM.psc`:
- Around line 145-146: sLastLoadedPresetName is being set before
loadConfigFile() can fall back via tagDefaultValue(), causing the UI to mark
presets as "Loaded!" even when the resulting config is a hybrid; change the
logic so you only set sLastLoadedPresetName (or mark the preset in presetsInt
via AddTextOption/OPTION_FLAG_DISABLED) after loadConfigFile() successfully
returns a fully-applied preset with no fallbacks — for example, call
loadConfigFile() first, verify that no defaults were substituted (or compare the
resulting config against tagDefaultValue() behavior), then set
sLastLoadedPresetName = presetFile and update presetsInt[index] with
AddTextOption; alternatively derive the "Loaded" badge from the actual resulting
config rather than preemptively from presetFile.
---
Duplicate comments:
In `@Source/Scripts/FSMPM.psc`:
- Around line 152-155: The preset clearing loop resets unused slots to 0 which
collides with AddTextOption() potentially returning 0; update the tail-clearing
in the While that writes to presetsInt[index] to use -1 for unused slots instead
of 0, and ensure any code that checks for invalid selection (the logic around
rejecting 0 at selection time) treats -1 as the sentinel; modify the While block
that assigns presetsInt[index] and any selection filter that currently checks
for 0 so they consistently use -1 as the unused-slot marker.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 02e45029-db0b-4948-b896-2161fa8b7401
📒 Files selected for processing (3)
Scripts/FSMPM.pexScripts/FSMPMPlayerScript.pexSource/Scripts/FSMPM.psc
…er an exact load.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 5e5bdd8e-ab23-4413-99a8-a3c5f4fdb1e3
📒 Files selected for processing (3)
Scripts/FSMPM.pexScripts/FSMPMPlayerScript.pexSource/Scripts/FSMPM.psc
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Source/Scripts/FSMPM.psc`:
- Around line 162-182: The loop in Event OnOptionSelect scans
presetsFiles/presetsInt to find a matching preset but continues iterating after
finding it; modify the While in OnOptionSelect to break out immediately when you
set presetFileIndex (i.e., after detecting presetsInt[index] == a_option) so you
avoid unnecessary iterations, then proceed with the existing
loadConfigFile/preset name logic and subsequent calls to
storeConfigAndSmpReset() and ForcePageReset().
- Line 95: The fallback default for the SMP frame-time slider is inconsistent
with shipped configs: change the hardcoded 3.5 to 3.0 in the slider creation
call AddSliderOptionST("SliderTimeFrameBudget", ...) and also update the
corresponding fallback entries at defaultValues[11] and the initial value in
setOpenedSlider to 3.0 so all three locations (AddSliderOptionST,
defaultValues[11], setOpenedSlider) consistently use 3.0.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4a1e3aae-b752-43a5-811e-850a583208fe
📒 Files selected for processing (3)
Scripts/FSMPM.pexScripts/FSMPMPlayerScript.pexSource/Scripts/FSMPM.psc
Swap to frame time budget from % of frame time.
Tested with a AVX2 ci build of DaymareOn/hdtSMP64#256
Summary by CodeRabbit
Chores
New Features
Bug Fixes