Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
JoewAlabel opened this issue May 6, 2023 · 8 comments

Comments

@JoewAlabel
Copy link

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
Copy link
Member

ManlyMarco commented May 6, 2023

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
Copy link
Author

JoewAlabel commented May 6, 2023

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:
#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
Copy link
Member

ManlyMarco commented May 6, 2023

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
Copy link

Graydok commented May 9, 2023

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
Copy link
Member

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
Copy link
Author

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
Copy link
Member

ManlyMarco commented May 13, 2023

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
Copy link
Author

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

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

No branches or pull requests

3 participants