Hi
I am writing a little application to modify the controller configuration of ZSNES by manipulating the zinput.cfg
However I am struggling to understand how the values are stored. This is what I think I have figured out so far.
0 = Unassigned
1-255 = Keyboard keys (ASCII codes?)
256+ = DirectX Joystick buttons (256=DPADRight)
Can anyone give me a better explanation of how the values are calculated?
Thanks.
How are keys/buttons stored in zinput.cfg?
Moderator: ZSNES Mods
Re: How are keys/buttons stored in zinput.cfg?
OK so I think I understand the formula now...
256 + (joypad_id * 32) + button_value
I can get the joypad_id from Joystick.Properties.JoystickId() but where do I get the button value?
256 + (joypad_id * 32) + button_value
I can get the joypad_id from Joystick.Properties.JoystickId() but where do I get the button value?
Re: How are keys/buttons stored in zinput.cfg?
48 views... can no one help me with this?
Where do I get the button ID's?
Are they generated by DirectX or are they assigned internally?
Where do I get the button ID's?
Are they generated by DirectX or are they assigned internally?
-
- ZSNES Shake Shake Prinny
- Posts: 5632
- Joined: Wed Jul 28, 2004 4:15 pm
- Location: PAL50, dood !
Re: How are keys/buttons stored in zinput.cfg?
dood, we covered this in irc. read the sourcefile i told you about - all the 'button_value's are in there. you 'get' them by reading. with your eyes.
皆黙って俺について来い!!
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
Code: Select all
<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Re: How are keys/buttons stored in zinput.cfg?
I was listening, I promise 

I'm struggling to understand what's going on in the source. I understand how the 1-255 corresponds to the ASCII codes but I really can't see where the gamepad button IDs are coming from.<grinvader> read winlink.cpp:2730-2889
-
- ZSNES Shake Shake Prinny
- Posts: 5632
- Joined: Wed Jul 28, 2004 4:15 pm
- Location: PAL50, dood !
Re: How are keys/buttons stored in zinput.cfg?
They were chosen arbitrarily.
This means that 'button_value' 0 is tied to "X1". In the same manner, bv 1 is tied to X2, bv 2 is tied to Y1, bv 3 is tied to Y2, and so on. POVs are also tied to button values 0-3 since they both control direction (analog sticks or d-pad). Throttles and sliders look mapped to bv 10-13 and face buttons to bv 16 and up.
Code: Select all
if (!X1Disable[i])
{
if (js[i].lX > 0)
{
keys[0x100 + i * 32 + 0] = 1;
}
}
皆黙って俺について来い!!
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
Code: Select all
<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)