Add native mod menu, native config API - #49
Open
NikkelM wants to merge 103 commits into
Open
Conversation
…restart-required popup
…e alignment to the Mods settings tab
…plays in the Mods tab
…ntry, B back-nav, smooth slider adjust
…od, and locale-aware message text
…eaving-mod trigger, locale-aware text, capitalized names
…ith an explanatory note
…cking out of a mod's settings
… listing the dependents
…g via ucrtbase); tear down Mods-tab rows on category leave
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Two changes:
rom.mod_settings, which acts as a drop-in replacement for Chalk. Authors should replace the existingconfig = chalk.auto "config.lua"withconfig = rom.mod_settings.load "config.lua", and drop their Chalk dependency. The returned config table has the same functionality as the one Chalk returns, so any existing usecases ofconfigin the mod's code work without any changes needed. The underlying.cfgfile is unchanged by this.minandmaxprovided)valuesand optionallylabelsprovided)groupparametergetandset), or read-only stringsMod authors can mark specific settings to only be editable in certain contexts (main menu, in a save, in the crossroads only), and mark settings as requiring a game restart as well, which will force the game to close (with an info-popup first) when the options menu is closed and one was changed.
Many properties can be driven through lua callbacks (such as when they are enabled, what the bounds of a slider are, etc.), and all can have
onChangedcallbacks that run after the value is changed through the menu.Config reset is done through the existing "Reset" options menu keybind, and applied for the visible mod/group and nested groups within the currently viewed group.
All mods will automatically show in the mod menu unless specifically opted out, even those still using Chalk. Some features like the numsliders or enum selectors aren't available for them as the required properties can only be provided when using
mod_settings. config keys not inconfigDescwon't show up in the mod menu either.The mod menu will not be built if the pdb GUID doesn't match the expected one (so after a game update), to not crash the game when the options menu is opened by the player. Since the mod menu is not required functionality for H2M I thought this would be a nicer way to handle things.
A full description of all available properties is in docs/mod_settings/README.md, which I'll also add to the wiki after we merge this. Authors can get type hints and validation by adding the path to docs/mod_settings/config_schema.lua to their LuaCATS library path.
I'll also update the mod template to use this new format once deployed.
It's a large diff (sorry), but a lot of it is boilerplate/symbols/reimplementation of native engine functionality to work outside the existing Options screens and for our purposes. I've structured everything in
#pragmaregions.I think the most interesting bits in
mod_settings.cppwill be lines ~2408 - ~3273 for the actual building of the mod menu, and ~4278 - ~4966 for the engine hooks. Reading the docs before the code should help.Below is the modified
d3d12.dlland an example Dream Dive Tweaks PR to migrate to the new menu, that brings all of the functionality from its existing imgui menu into the native menu using the functionalities described above.adi1998/DreamDiveTweaks#13
d3d12.zip