[4fb6b7c] - Inconsistencies with DEFBINDS

Bugs that have been investigated and resolved somehow.

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.
User avatar
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

Post by SanyaWaffles »

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.
User avatar
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

Post by SanyaWaffles »

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [4fb6b7c] - Inconsistencies with DEFBINDS

Post by Graf Zahl »

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.
User avatar
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

Post by SanyaWaffles »

I can confirm that fixes it!
User avatar
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

Post by SanyaWaffles »

User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [4fb6b7c] - Inconsistencies with DEFBINDS

Post by Graf Zahl »

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.
User avatar
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

Post by SanyaWaffles »

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.
Last edited by SanyaWaffles on Fri Apr 24, 2020 1:22 am, edited 1 time in total.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [4fb6b7c] - Inconsistencies with DEFBINDS

Post by Graf Zahl »

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.
User avatar
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

Post by SanyaWaffles »

is there an internal filesystem function that allows me to sort DEFBINDS based on where they came from?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [4fb6b7c] - Inconsistencies with DEFBINDS

Post by Graf Zahl »

Sure:

Code: Select all

		if (fileSystem.GetFileContainer(i) > fileSystem.GetMaxIwadNum()) ...
If that is true you are in a user mod.
User avatar
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

Post by SanyaWaffles »

I think I have something that'll work better. I did a test with a dummy PK3 and it doesn't override the settings.
User avatar
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

Post by SanyaWaffles »

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [4fb6b7c] - Inconsistencies with DEFBINDS

Post by Graf Zahl »

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.
User avatar
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

Post by SanyaWaffles »

Done and done, boss.

Let me know if it needs to be revised.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [4fb6b7c] - Inconsistencies with DEFBINDS

Post by Graf Zahl »

It could be shortened a bit, but who cares? ;) Yes, this is ok.
Post Reply

Return to “Closed Bugs [GZDoom]”