writeini clears binds from currently loaded mods

Is there something that doesn't work right in the latest GZDoom? Post about it here.

Moderator: GZDoom Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia
Contact:

writeini clears binds from currently loaded mods

Post by Marisa the Magician »

Using the writeini command (and by extension "Save current settings" in the options menu) appears to clear the bindings of any loaded mod that uses addkeysection in KEYCONF.
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia
Contact:

Re: writeini clears binds from currently loaded mods

Post by Marisa the Magician »

Updating this, because "Browse Game Config" causes the same issue as well.
User avatar
phantombeta
Posts: 2090
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: writeini clears binds from currently loaded mods

Post by phantombeta »

One important detail to note is that the binds are only cleared in-game- They are indeed saved correctly to the INI, they just get wiped from the game in the process. (Then consequently get wiped from the INI too once you close the game)
The "Browse Game Config" option causes this because it also saves the game.
Some quick investigation points to ArchiveBindings as the likely culprit for this bug. The comment right before it also kinda points to that being the case:

Code: Select all

//=============================================================================
//
// This function is first called for functions in custom key sections.
// In this case, matchcmd is non-null, and only keys bound to that command
// are stored. If a match is found, its binding is set to "\1".
// After all custom key sections are saved, it is called one more for the
// normal Bindings and DoubleBindings sections for this game. In this case
// matchcmd is null and all keys will be stored. The config section was not
// previously cleared, so all old bindings are still in place. If the binding
// for a key is empty, the corresponding key in the config is removed as well.
// If a binding is "\1", then the binding itself is cleared, but nothing
// happens to the entry in the config.
//
//=============================================================================
The origin of this code is this commit from... 2009.
How has this bug never been reported and/or fixed during those 13+ years? O_o
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49073
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: writeini clears binds from currently loaded mods

Post by Graf Zahl »

My head hurts. I'm sorry but someone else needs to have a look here.
Casualfan
Posts: 86
Joined: Fri Jan 14, 2022 8:31 pm

[GZDoom 4.11.0] Saving settings via the main menu deletes mod bindings

Post by Casualfan »

Saw this while playing Aliens Eradication yesterday. GZDoom wasn't saving my resolution settings, but I noticed a Save Settings button in the main menu. I hit it and it saved all my GZDoom settings, but for some reason it cleared all my keybinds set for Aliens Eradication. Not a catastrophic event, but it got me real confused for a bit. Please let me know if I need to provide more info, I'm new to this whole bug reporting thing haha.
User avatar
Player701
 
 
Posts: 1640
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: [GZDoom 4.11.0] Saving settings via the main menu deletes mod bindings

Post by Player701 »

Looks like a duplicate of this report.
User avatar
Rachael
Posts: 13575
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: writeini clears binds from currently loaded mods

Post by Rachael »

I've gone ahead and merged it.
Post Reply

Return to “Bugs [GZDoom]”