Custom In-Game Mod Menu API

Autor:BoltTheManLast updated:29/04/2023 01:39:14318.8K10KB

MONSTER HUNTER RISE Custom In-Game Mod Menu API-1-lagofast mod master
MONSTER HUNTER RISE Custom In-Game Mod Menu API-2-lagofast mod master
MONSTER HUNTER RISE Custom In-Game Mod Menu API-1-lagofast mod master
MONSTER HUNTER RISE Custom In-Game Mod Menu API-2-lagofast mod master

Pre-dependencies

Mod Introduction

A user-friendly IMGUI-inspired API for creating in-game settings menus in MHRise REF mods.
WAHOOO
This was a tricky project for sure
This bad boy is packed with dark magic. *Slaps the GitHub Repo*


Anyway:


~What Does It Do?~
Well, not much on its own.
But in the hands of mod authors, settings menus can be added directly to the in-game options menu through a simple API.
The API functions are very similar to imgui, with a few caveats.*




~What Do I Have To Do?~
Just install the mod like any other REFramework mod.
If you don’t know how to do that, this probably shouldn’t be your first time at the rodeo.
Once in the right place, it should automatically add a "Mods" category to the options menu.
Then simply by using other supported REF mods, settings will appear there.




**For Mod Authors:**
Download the example mod implementation from the files and that should get you started pretty easily.
For more API details, please refer to the GitHub page.
I promise it's almost as easy to use as the built-in ImGui functions, and it'll be really cool to see the community add menus!
Just require the package and use the API like imgui.
You can optionally check if the user has the package installed, and optionally support the menus so you don’t have to force installation. However, it would be nice if you could still mark this as a required file.

I ask that you do not redistribute this mod alongside your mods, convenient as that might be.
I worked hard on this, but I might need to update things here, and you wouldn’t want conflicting versions across different mods.
Please let me know if you release a mod using this menu, so I can add it to the list of supported mods!


Limitations*
Unfortunately, since this uses the game's own menus, we're limited to what the game can do natively.
Obviously, there's no advanced drawing feature.
It only Mimics an imgui, really the "draw" functions are callbacks that retrieve data from the game's UI. You can create dynamic menus, but try not to go overboard.
It won't be a good fit for every mod, but if all you need is some simple settings, please consider it!




~Credits~
Thanks to Stracker for (making cool mods but also [without permission]) letting me reference one of their mods for the coroutines and system message prompts. And also like, actually adding the coroutines to REF.
And of course, thanks to praydog for all the work they do on REFramework, and for providing some guidance on this.

**Contributions:**
raffRun - Auto wrapping tooltips
Stracker - Finding a way to read GUID data from pointers within Lua
HookedBehemoth - Implemented Stracker's findings



Discord: Bolt#6265
GitHub: https://github.com/BoltManGuy/MHR-InGame-ModMenu-API



Mods Using This Menu:




Ramblings and Fun-Facts:
I've got a lot of stupid things to say 'cause this project really drained me.
This was one of the most difficult challenges I've had in recent memory — aside from making a rhythm game for a 48-hour game jam.
The game really doesn't want you doing this and will crash every chance it gets if you're not doing things perfectly.
Forgot to add that array ref? Crash. Strings? Crash. Option data? Crash.
Call the update function from anywhere in the game's UI functions? Crash.
Crash when leaving empty fields for options that don't require them.
I digress, but I must've crashed the game nearly a hundred times.
But I think all this made it a particularly engaging challenge—I haven't been this glued to a project in a while. It always felt tantalizingly close to working, yet there was always some major issue to overcome.



Some interesting notes:
The mod tab in the category list is actually a duplicate of the save data tab, since there’s no way to add additional types. So I swap the data based on the scroll list index.
For a long time, I was hijacking the advanced graphics settings menu to try and get submenus working. It almost worked, until I found out they'd basically hardcoded that menu to only show five items in the list for some reason... and of course, if you set it to anything other than 5, the game crashes.
Plus for some godforsaken reason, the sliders don't accept mouse input in that menu. So eventually, I just found the right combination of calls to turn options into buttons, swap the data, repaint the whole thing, and switch submenus without ever actually changing the menu.
And the logic for all this was unavoidably complex..

Due to a limitation in REF, I actually wrote a small C++ plugin solely to take a GUID pointer and dereference it so I could extract the data. Without this, the whole thing wouldn't work—there'd be no way to properly override the game's localized strings.
It wasn't too bad, but setting up the C++ project with Lua and sol2 was a nightmare... The guides were barely any help.
Similarly, for some reason I couldn't set GUID values to objects in REF, but was able to get around this by directly writing the data using write_dword at the right offsets.

At the end of the day, I think the result is really cool.
I almost don’t care if anyone uses it — just seeing it work was reward enough. But I think people will like this.

I guess you can suggest features, but honestly, I’m gonna be lazy after all this.
That's probably about it for now, hope you enjoy!
This tool is provided by the third party [bufftool]Attention icon

Download Mods For Free

Install LagoFast, start MONSTER HUNTER RISE and play with the mods you love.