Add F17-F24 keys for bindings

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

User avatar
theleo_ua
Posts: 136
Joined: Sun Feb 07, 2016 11:38 am
Discord: discord.gg/xWhQcP7
Twitch ID: theleo_ua
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support
Location: Ukraine

Add F17-F24 keys for bindings

Post by theleo_ua »

Steps:
1) type in colsole:
bind F17
bind F24

Actual result:
unknown key F17
unknown key F24

Expected result:
"F17" = ""
"F24" = ""
or
"F17" = "some command"
"F24" = "some command"

Tested in GZDoom 4.7.1 x64 / Windows 10 / Amd with vulkan support
User avatar
Rachael
Admin
Posts: 12885
Joined: Tue Jan 13, 2004 1:31 pm
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle

Re: Add F17-F24 keys for bindings

Post by Rachael »

Keyboards with a second or third function key row are exceptionally rare.

Secondly, in order to support these keyboards, it will be necessary to update the keyboard code to use a newer scan code set. The existing one will not work, and likely it will only be possible to use the new keys with the keyboard in raw mode. (Which should be doable, but I am not sure of who has experience with this and can do it)

This document has the existing key codes:
https://download.microsoft.com/download ... ancode.doc

This is among the things I could find regarding the newer scan code set:
https://google.github.io/fplbase/group_ ... codes.html

If it does work with the existing (mode 1) set, then we'd need to know the input values for the entire row. Making an educated guess with the first key (F13) is not sufficient for this.
User avatar
theleo_ua
Posts: 136
Joined: Sun Feb 07, 2016 11:38 am
Discord: discord.gg/xWhQcP7
Twitch ID: theleo_ua
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support
Location: Ukraine

Re: Add F17-F24 keys for bindings

Post by theleo_ua »

Rachael wrote:Keyboards with a second or third function key row are exceptionally rare.
The reason I want this is because I need free virtual keys for Interactive streams. The logic is next:

Step 1: I create next bindings:
bind F1 "summon monster 1'
bind F2 "summon monster 2'
...
bind F24 "summon monster 24'

Step 2: I create next rules in my stream chat software (rutony chat in my case):
Rule 1: if user write "!summon_tier1" in stream chat, then click F1 virtual key in GZDoom
Rule 2: if user write "!summon_tier2" in stream chat, then click F2 virtual key in GZDoom
...
Rule 24: if user write "!summon_tier24" in stream chat, then click F24 virtual key in GZDoom


This way stream viewers can control my GZDoom via chat messages (even with general F1-F12 keyboard in my PC).


BUT: I understand, that if it's not an easy to implement, then we can postpone this until better times

P.S. Examples of how to handle F17-F24 can be found there: https://github.com/JNechaevsky/inter-doom (but I'm not sure, can it be reused in GZDoom, but at least I tested it and it works with stream chat software, so I can bind and use virtual keys for stream events)
Rachael wrote:Making an educated guess with the first key (F13) is not sufficient for this.
P.S.2. In my current GZDoom setup, I use F1...F16 keys and they are working correctly (the only exception is if GZDoom window is minimized, and stream software tries to transfer virtual F4 key to GZDoom, then GZDoom window will be closed, so I use all F keys except F4 key). So F13...F16 keys are working for now (but I'm not sure about real keyboards with 16 keys, because used only virtual ones)
User avatar
theleo_ua
Posts: 136
Joined: Sun Feb 07, 2016 11:38 am
Discord: discord.gg/xWhQcP7
Twitch ID: theleo_ua
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support
Location: Ukraine

Re: Add F17-F24 keys for bindings

Post by theleo_ua »

Rachael wrote:If it does work with the existing (mode 1) set, then we'd need to know the input values for the entire row. Making an educated guess with the first key (F13) is not sufficient for this.
forgot to say: I think there is a way I can obtain these codes with next steps:

1) go to customize controls in gzdoom
2) click enter on any function
3) send virtual F13 key by streamchat software to gzdoom
4) see what scancode gzdoom will recognize
5) repeat steps 3-4 for all keys from F13 to F24

Will it work? If not, is it possible to create gzdoom test build where it somehow will write my received virtual scancodes in text file or somewhere else?
User avatar
Rachael
Admin
Posts: 12885
Joined: Tue Jan 13, 2004 1:31 pm
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle

Re: Add F17-F24 keys for bindings

Post by Rachael »

https://github.com/coelckers/gzdoom/tree/f17to24

I have no idea if this will work. I have no way to test it.

If you have Windows you can download a build artifact: https://github.com/coelckers/gzdoom/sui ... /252092004
User avatar
Xeotroid
Posts: 385
Joined: Sat Jun 23, 2012 7:44 am
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support
Location: Czech Rep.

Re: Add F17-F24 keys for bindings

Post by Xeotroid »

theleo_ua wrote:The reason I want this is because I need free virtual keys for Interactive streams.
Have you looked into TwitchyDoom? It should be what you need for Twitch (or whatever else StreamLabs Chatbot works with) viewers to send commands/interacting with your game. It has commands to spawn an actor either somewhere in the map or at player's position. If you want it to randomly select from a tier list, just have it spawn a RandomSpawner-derived actor.
User avatar
theleo_ua
Posts: 136
Joined: Sun Feb 07, 2016 11:38 am
Discord: discord.gg/xWhQcP7
Twitch ID: theleo_ua
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support
Location: Ukraine

Re: Add F17-F24 keys for bindings

Post by theleo_ua »

Rachael wrote:https://github.com/coelckers/gzdoom/tree/f17to24

I have no idea if this will work. I have no way to test it.

If you have Windows you can download a build artifact: https://github.com/coelckers/gzdoom/sui ... /252092004
There are no words for how amazing this is. Applause!

Test results:

F17 F18 F20 F22 F23 - works as expected
F19 F21 - not tested (please tell me that I need to test them also, so I will)
F24 - does not work

For F24 I also tried lifehack I explained above (just to click enter in customize controls and then send F24 from rutony chat), and GZDoom recognize it as "Key_" (as I understand it means unknown key)

So, as I understand, F17-F23 should work (still need to retest 19 and 21, but 99% that they will work), but F24 will not work

But even with this, it is really very good boost to keybindings, so big thanks!

Please tell me if some additional tests are required from my side
Xeotroid wrote:
theleo_ua wrote:The reason I want this is because I need free virtual keys for Interactive streams.
Have you looked into TwitchyDoom? It should be what you need for Twitch (or whatever else StreamLabs Chatbot works with) viewers to send commands/interacting with your game. It has commands to spawn an actor either somewhere in the map or at player's position. If you want it to randomly select from a tier list, just have it spawn a RandomSpawner-derived actor.
Thank for the suggestion, but this does not match my requirements because of:

1) Twitch is not enough for me. I also use youtube, trovo, goodgame etc
2) Streamlabs has a lof of problems, I prefer OBS Studio
3) Streamlabs chatbot also has a lof of problems, I prefer Rutony Chat
4) I need not only spawning of actors, but more complicated things. Spawning of actors is just a simple example

The only option I see (except keybindings) is this pull request: https://github.com/coelckers/gzdoom/pull/1541 . If GZDoom dev team will commit this, then a lof of such problems should be solved

But again, thanks for the link, I will contact author for some info
User avatar
Rachael
Admin
Posts: 12885
Joined: Tue Jan 13, 2004 1:31 pm
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle

Re: Add F17-F24 keys for bindings

Post by Rachael »

Alright - in order to commit that branch then - either F24 will have to be discarded entirely (not desirable) or we need to find the actual scan code for F24.
User avatar
theleo_ua
Posts: 136
Joined: Sun Feb 07, 2016 11:38 am
Discord: discord.gg/xWhQcP7
Twitch ID: theleo_ua
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support
Location: Ukraine

Re: Add F17-F24 keys for bindings

Post by theleo_ua »

Rachael wrote:Alright - in order to commit that branch then - either F24 will have to be discarded entirely (not desirable) or we need to find the actual scan code for F24.
I'm ok with both ways, but about second way, I see the next ways I can help with this:

1) I can ask RD devs (already asked - waiting for the answer) about scan codes they used for F17...F24 (and if their scan codes for 17-23 match with yours, then probably we can try with F24 code from RD)
2) You can patch GZDoom branch so it will display received scancode instead of "Key_" in my "lifehack" example above, so I will tell you code GZDoom displayed for me for F24
3) I can ask Rutony Chat devs about scan codes they used
User avatar
theleo_ua
Posts: 136
Joined: Sun Feb 07, 2016 11:38 am
Discord: discord.gg/xWhQcP7
Twitch ID: theleo_ua
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support
Location: Ukraine

Re: Add F17-F24 keys for bindings

Post by theleo_ua »

Rachael wrote:or we need to find the actual scan code for F24.
asked Rutony chat dev - could you please try this: https://i.ibb.co/rmT0Nrk/photo-2022-05-26-23-57-31.jpg

UPDATE: and also, I will retest again F24 key (screenshot above says that it's scancode is obvious, so I wonder, why it failed in my tests, maybe I did something wrong, so I will retest more carefully. I will post the results when done)
User avatar
Rachael
Admin
Posts: 12885
Joined: Tue Jan 13, 2004 1:31 pm
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle

Re: Add F17-F24 keys for bindings

Post by Rachael »

My F24 placement is in the same place, relatively, as everyone else's.
Gez
 
 
Posts: 17633
Joined: Fri Jul 06, 2007 3:22 pm

Re: Add F17-F24 keys for bindings

Post by Gez »

Yeah, I don't see why Rachael's code would fail if that other code is working. The F24 code is just one more than the F23 code, there's no surprise gap or weird offset, so it should just work.

(Seems like there's room to go up to F32... Wonder when such keyboards will appear.)
User avatar
theleo_ua
Posts: 136
Joined: Sun Feb 07, 2016 11:38 am
Discord: discord.gg/xWhQcP7
Twitch ID: theleo_ua
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support
Location: Ukraine

Re: Add F17-F24 keys for bindings

Post by theleo_ua »

Rachael wrote:My F24 placement is in the same place, relatively, as everyone else's.
Gez wrote:Yeah, I don't see why Rachael's code would fail if that other code is working. The F24 code is just one more than the F23 code, there's no surprise gap or weird offset, so it should just work.

(Seems like there's room to go up to F32... Wonder when such keyboards will appear.)
So I tested again, and F24 still does not work and I have no idea why

In Inter doom it works, but Inter Doom has another scancode set (115 for F24):

https://github.com/libsdl-org/SDL/blob/ ... #L219-L226

https://github.com/JNechaevsky/inter-do ... nds.c#L180

But logic in Inter Doom is the same: F24 scancode = F23 scancode + 1


Can we make commit with "temporary experimental F24" and if some users with real keyboards will complain that it does not work, then exclude F24 totally or make deeper research? I bet there is small chance, that my current approach of testing and usage can provide some errors, so with real keyboards it will work (but again, chance is too small)
Gez
 
 
Posts: 17633
Joined: Fri Jul 06, 2007 3:22 pm

Re: Add F17-F24 keys for bindings

Post by Gez »

theleo_ua wrote:In Inter doom it works, but Inter Doom has another scancode set (115 for F24)
That's indeed different from:
theleo_ua wrote: asked Rutony chat dev - could you please try this:
Spoiler:
There we see the F keys are given a continuous block from F1 at 0x70 (that's 112 in decimal) to F24 at 0x87 (that's, as expected, 135).

The SDL/InterDoom scan codes have the F keys split in two blocks, with F1 to F12 in the 58-to-69 range and F13 to F24 in the 104-to-115 range.

On GZDoom's side: https://github.com/coelckers/gzdoom/com ... ec63ed1224
On Posix systems it uses SDL codes; but on Windows is use DirectInput codes. Those have F1-to-F10 at 59-to-68, F11 and F12 at 87 and 88, and F13-to-F24 at 100-to-111.

I'll admit that after seeing those values, I now understand less about keyboard scancodes than I thought I knew.
User avatar
wildweasel
Moderator Team Lead
Posts: 21368
Joined: Tue Jul 15, 2003 7:33 pm

Re: Add F17-F24 keys for bindings

Post by wildweasel »

Potentially compounding this problem: are these scan codes sensitive to international keyboard layouts? i.e. will they work if the keyboard is not set to English in the OS?

Return to “Feature Suggestions”