Skip to content

Add native mod menu, native config API - #49

Open
NikkelM wants to merge 103 commits into
masterfrom
nikkelm/mod-menu
Open

Add native mod menu, native config API#49
NikkelM wants to merge 103 commits into
masterfrom
nikkelm/mod-menu

Conversation

@NikkelM

@NikkelM NikkelM commented Aug 13, 2026

Copy link
Copy Markdown
Member

Two changes:

  • A native config API through rom.mod_settings, which acts as a drop-in replacement for Chalk. Authors should replace the existing config = chalk.auto "config.lua" with config = 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 of config in the mod's code work without any changes needed. The underlying .cfg file is unchanged by this.
  • An in-game mod config editor, as a new tab in the Options menu. Each mod gets a sub-menu, where H2M will construct native rows for different setting types, derived from the config value's type directly:
  1. Bool toggles
  2. Numsliders for bounded number values (min and max provided)
  3. Enum selectors (values and optionally labels provided)
  4. Freetext entry for strings and unbounded numbers
  5. Additionally: Buttons to run arbitrary lua callbacks on press
  6. Additionally: Further nesting through existing config nesting or a group parameter
  7. Additionally: Virtual rows that aren't backed by a config key, with all of the above row types (controlled through get and set), or read-only strings

Mod 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 onChanged callbacks 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 in configDesc won'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 #pragma regions.
I think the most interesting bits in mod_settings.cpp will 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.dll and 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

NikkelM added 30 commits July 8, 2026 21:19
…eaving-mod trigger, locale-aware text, capitalized names
…g via ucrtbase); tear down Mods-tab rows on category leave
@NikkelM
NikkelM requested a review from xiaoxiao921 August 13, 2026 21:21
@NikkelM NikkelM self-assigned this Aug 13, 2026
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