[4fb6b7c] - Inconsistencies with DEFBINDS
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
- SanyaWaffles
- Posts: 891
- Joined: Thu Apr 25, 2013 12:21 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11 for the Motorola Powerstack II
- Graphics Processor: nVidia with Vulkan support
- Location: The Corn Fields
- Contact:
Re: [4fb6b7c] - Inconsistencies with DEFBINDS
For some reason it's not working for me, I've given as much info as I can on the matter. Mouse2 is not binding to the correct command for me.
- SanyaWaffles
- Posts: 891
- Joined: Thu Apr 25, 2013 12:21 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11 for the Motorola Powerstack II
- Graphics Processor: nVidia with Vulkan support
- Location: The Corn Fields
- Contact:
Re: [4fb6b7c] - Inconsistencies with DEFBINDS
https://github.com/coelckers/gzdoom/pull/1073
I made a pull request to fix the Ctrl/Alt/Shift keys not working. This part is confirmed to be working.
EDIT: I did a local debug while trying to fix this. It appears C_SetDefaultKeys is trying to read "engine/commonbinds.txt" which doesn't exist. Changing this to DEFBINDS.txt fixes it.
I want to be very clear I'm sure that's not the proper way to fix it, but it should give an idea what's going on with why mouse2 won't bind properly.
I have no idea why it's binding for drfrag in his setup, but not mine, but it might have to do with the fact I'm running it differently than I am? I'm running it straight as an IWAD and not loading it on top of anything else.
I'm not going to update my pull request with this until we can actually figure out a fix. I have no idea what Graf has planned.
I made a pull request to fix the Ctrl/Alt/Shift keys not working. This part is confirmed to be working.
EDIT: I did a local debug while trying to fix this. It appears C_SetDefaultKeys is trying to read "engine/commonbinds.txt" which doesn't exist. Changing this to DEFBINDS.txt fixes it.
I want to be very clear I'm sure that's not the proper way to fix it, but it should give an idea what's going on with why mouse2 won't bind properly.
I have no idea why it's binding for drfrag in his setup, but not mine, but it might have to do with the fact I'm running it differently than I am? I'm running it straight as an IWAD and not loading it on top of anything else.
I'm not going to update my pull request with this until we can actually figure out a fix. I have no idea what Graf has planned.
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [4fb6b7c] - Inconsistencies with DEFBINDS
The code should go through "engine/commonbinds.txt", then all occurences of 'baseconfig' and last through all lumps named "DEFBINDS". The idea is to do what Raze does and offer multiple preset configurations but it hasn't been defined yet in GZDoom.
But I think I know what the problem is. DEFBINDS is set not to override existing bindings, only add to it, can you test if it works if you change the 'false' in the third 'ReadBindings' call to 'true'?
In hindsight that setup makes little sense - it should only disable the override for PWADs because those should not be able to clobber the game's default setting in a shared config.
But I think I know what the problem is. DEFBINDS is set not to override existing bindings, only add to it, can you test if it works if you change the 'false' in the third 'ReadBindings' call to 'true'?
In hindsight that setup makes little sense - it should only disable the override for PWADs because those should not be able to clobber the game's default setting in a shared config.
- SanyaWaffles
- Posts: 891
- Joined: Thu Apr 25, 2013 12:21 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11 for the Motorola Powerstack II
- Graphics Processor: nVidia with Vulkan support
- Location: The Corn Fields
- Contact:
Re: [4fb6b7c] - Inconsistencies with DEFBINDS
I can confirm that fixes it!
- SanyaWaffles
- Posts: 891
- Joined: Thu Apr 25, 2013 12:21 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11 for the Motorola Powerstack II
- Graphics Processor: nVidia with Vulkan support
- Location: The Corn Fields
- Contact:
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [4fb6b7c] - Inconsistencies with DEFBINDS
Sorry, but that's not a proper fix - the protection for user-side bindings needs to be present, otherwise a malicious PWAD can nuke your entire setup.
- SanyaWaffles
- Posts: 891
- Joined: Thu Apr 25, 2013 12:21 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11 for the Motorola Powerstack II
- Graphics Processor: nVidia with Vulkan support
- Location: The Corn Fields
- Contact:
Re: [4fb6b7c] - Inconsistencies with DEFBINDS
Ah, my bad.
This might require someone smarter than me, but it seems the logical thing would be to check and see if the DEFBINDS is being loaded by an IWAD or an IPK3 or an IPK7.
This might require someone smarter than me, but it seems the logical thing would be to check and see if the DEFBINDS is being loaded by an IWAD or an IPK3 or an IPK7.
Last edited by SanyaWaffles on Fri Apr 24, 2020 1:22 am, edited 1 time in total.
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [4fb6b7c] - Inconsistencies with DEFBINDS
When reading the bindings file there needs to be an origin check, if it comes from the IWAD or an internal definition it should be allowed, otherwise not.
- SanyaWaffles
- Posts: 891
- Joined: Thu Apr 25, 2013 12:21 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11 for the Motorola Powerstack II
- Graphics Processor: nVidia with Vulkan support
- Location: The Corn Fields
- Contact:
Re: [4fb6b7c] - Inconsistencies with DEFBINDS
is there an internal filesystem function that allows me to sort DEFBINDS based on where they came from?
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [4fb6b7c] - Inconsistencies with DEFBINDS
Sure:
If that is true you are in a user mod.
Code: Select all
if (fileSystem.GetFileContainer(i) > fileSystem.GetMaxIwadNum()) ...
- SanyaWaffles
- Posts: 891
- Joined: Thu Apr 25, 2013 12:21 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11 for the Motorola Powerstack II
- Graphics Processor: nVidia with Vulkan support
- Location: The Corn Fields
- Contact:
Re: [4fb6b7c] - Inconsistencies with DEFBINDS
I think I have something that'll work better. I did a test with a dummy PK3 and it doesn't override the settings.
- SanyaWaffles
- Posts: 891
- Joined: Thu Apr 25, 2013 12:21 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11 for the Motorola Powerstack II
- Graphics Processor: nVidia with Vulkan support
- Location: The Corn Fields
- Contact:
Re: [4fb6b7c] - Inconsistencies with DEFBINDS
https://github.com/coelckers/gzdoom/pull/1075
I used the code you supplied and tested it. It doesn't overwrite the settings if it's loaded from a standard WAD or PK3. However, if it loads from an IWAD/IPK3/IPK7, it will.
Tested with the following files:
https://www.dropbox.com/s/0jehjgtq9cs8q ... t.pk3?dl=1 Is just a dummy PK3 with a DEFBINDS in it and nothing more.
https://www.dropbox.com/s/h3193g4rsspad ... .ipk3?dl=1 is an IPK3 with a typical IPK3 setup - DEFBINDS, CVARDEFS, palette, IWADINFO.
I used the code you supplied and tested it. It doesn't overwrite the settings if it's loaded from a standard WAD or PK3. However, if it loads from an IWAD/IPK3/IPK7, it will.
Tested with the following files:
https://www.dropbox.com/s/0jehjgtq9cs8q ... t.pk3?dl=1 Is just a dummy PK3 with a DEFBINDS in it and nothing more.
https://www.dropbox.com/s/h3193g4rsspad ... .ipk3?dl=1 is an IPK3 with a typical IPK3 setup - DEFBINDS, CVARDEFS, palette, IWADINFO.
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [4fb6b7c] - Inconsistencies with DEFBINDS
Yes, that's correct. Can you copy it to the other loop in there as well? That also needs to be protected. Right now I'm at work and cannot do it myself.
- SanyaWaffles
- Posts: 891
- Joined: Thu Apr 25, 2013 12:21 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11 for the Motorola Powerstack II
- Graphics Processor: nVidia with Vulkan support
- Location: The Corn Fields
- Contact:
Re: [4fb6b7c] - Inconsistencies with DEFBINDS
Done and done, boss.
Let me know if it needs to be revised.
Let me know if it needs to be revised.
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [4fb6b7c] - Inconsistencies with DEFBINDS
It could be shortened a bit, but who cares?
Yes, this is ok.