BepInEx / BepInEx.ConfigurationManager

Plugin configuration manager for BepInEx
https://www.patreon.com/ManlyMarco
GNU Lesser General Public License v3.0
227 stars 54 forks source link

[Question] ConfigurationManager DO NOT display all settings from my plugin's Config #66

Closed JoewAlabel closed 1 year ago

JoewAlabel commented 1 year ago

I am thinking it is because my config file is inside my plugins folder, inside BepInEx\plugins , instead BepInEx\Config

I used the code to create my config file: ConfigFile configFile = new ConfigFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), MyPluginInfo.PLUGIN_NAME, "Config.cfg"), true);

So, how could I make it compatible, please?

And just another bug i noticed. I play the game with 4K resolution. The ConfigurationManager GUI is too height, but all text are very small, they are very hard to read. Any way to make the font bigger, please?

I pressed F1, but the game still running at the background. My character in game is moving as i move the mouse. Is possible "pause" the game while I have the GUI oppened?

Thank you!!!!

ManlyMarco commented 1 year ago

Only the config file provided in your plugin instance is detected and shown by ConfigurationManager (same with most other config tools). Use this.Config to make your plugin compatible.

The GUI problem should be in a separate issue. Make sure to include a screenshot.

ConfigurationManager doesn't make any attempts at stopping the game, all it does is eat input events when mouse is over its window (which isn't guaranteed to work if the game uses a non-standard input system). It's recommended to do it with a game-specific companion plugin (e.g. https://github.com/IllusionMods/BepisPlugins/blob/master/src/KK_ConfigurationManager/KK.ConfigurationManager.cs).

JoewAlabel commented 1 year ago

Only the config file provided in your plugin instance is detected and shown by ConfigurationManager (same with most other config tools). Use this.Config to make your plugin compatible.

The GUI problem should be in a separate issue. Make sure to include a screenshot.

ConfigurationManager doesn't make any attempts at stopping the game, all it does is eat input events when mouse is over its window (which isn't guaranteed to work if the game uses a non-standard input system). It's recommended to do it with a game-specific companion plugin (e.g. https://github.com/IllusionMods/BepisPlugins/blob/master/src/KK_ConfigurationManager/KK.ConfigurationManager.cs).

Thank you for your reply!

I created a new post for GUI problem, as you recommended: https://github.com/BepInEx/BepInEx.ConfigurationManager/issues/67

I tried use this.Config , but i can not get how it works and how i would use it.

To make my plugin, i set and use the config file on 3 places: Just above class definition, to create a new ConfigFile:

public static ConfigFile configFile = new ConfigFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), MyPluginInfo.PLUGIN_NAME, "Config.cfg"), true);

public static ConfigEntry<float> MaxWeightMultiplier;
public static float maxWeightMultiplier;

After, inside Awake(). i created all Binds:

MaxWeightMultiplier = configFile.Bind("Multipliers",
                                "MaxWeightMultiplier",
                                (float)3.0f,
                                "Set the multiplier");

maxWeightMultiplier = MaxWeightMultiplier.Value;

And the last ones I used at HarmonyPath's class inside Postfix():

[HarmonyPostfix]
        static void Postfix(ref float __result)
        {            
            float r = __result * Plugin.maxWeightMultiplier;
            __result = r;
        }

Can you show me, how could i should use the this.Config to work with my plugin, please? Sorry for ask again, I am new with plugins modding, so I can not figured out how use by my own, yet.

Btw, thank you very much!!!!

ManlyMarco commented 1 year ago

It's strongly discouraged to put config files inside the plugins directory, they should go into the bepinex\config directory or bepinex\cache if it's something temporary. Both of these are available from the BepInEx.Paths class.

I tried use this.Config , but i can not get how it works and how i would use it.

MaxWeightMultiplier = this.Config.Bind("Multipliers",
"MaxWeightMultiplier",
(float)3.0f,
"Set the multiplier");

Just call Bind on it, you don't have to do anything else.

You can see plenty of examples by just searching for member names on GitHub. Random example https://github.com/ManlyMarco/QuickAccessBox/blob/master/Shared_QuickAccessBox/QuickAccessBox.cs#L74

Also https://docs.bepinex.dev/v5.4.21/

Graydok commented 1 year ago

I'm far from coding theme - but i can learning. Config manager stop working - how i can fix this issue by my self? or how long wait for fix those problem for all?

ManlyMarco commented 1 year ago

Open a new issue if you are having issues and can't fix them. If the game you're trying to mod already has a modding community then ask there instead.

JoewAlabel commented 1 year ago

It's strongly discouraged to put config files inside the plugins directory, they should go into the bepinex\config directory or bepinex\cache if it's something temporary. Both of these are available from the BepInEx.Paths class.

I tried use this.Config , but i can not get how it works and how i would use it.

MaxWeightMultiplier = this.Config.Bind("Multipliers",
                                "MaxWeightMultiplier",
                                (float)3.0f,
                                "Set the multiplier");

Just call Bind on it, you don't have to do anything else.

You can see plenty of examples by just searching for member names on GitHub. Random example https://github.com/ManlyMarco/QuickAccessBox/blob/master/Shared_QuickAccessBox/QuickAccessBox.cs#L74

Also https://docs.bepinex.dev/v5.4.21/

This is my problem. If I use this , i can not use my custom config file. So the big question is, can you make it compatible with custom config file, please? I really do not want use the default's.

Thank you so much ;)

ManlyMarco commented 1 year ago

Currently there are no plans on making ConfigurationManager work with custom config files. The assumption is that if you make a custom config file you will also want to make a custom UI for it.

JoewAlabel commented 1 year ago

Currently there are no plans on making ConfigurationManager work with custom config files. The assumption is that if you make a custom config file you will also want to make a custom UI for it.

Thank you, i changed to use default's config file :D