mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-11-27 13:14:01 +08:00
access duplicated keys in VDF correctly
This commit is contained in:
parent
bec23b21c8
commit
0c52e130b6
@ -31,43 +31,41 @@ keymap_digital = {
|
|||||||
def add_input_bindings(group, bindings, force_binding=None, keymap=keymap_digital):
|
def add_input_bindings(group, bindings, force_binding=None, keymap=keymap_digital):
|
||||||
if "inputs" not in group:
|
if "inputs" not in group:
|
||||||
return bindings
|
return bindings
|
||||||
for i in group["inputs"]:
|
for i, i_val in group["inputs"].iteritems():
|
||||||
for act in group["inputs"][i]:
|
for act in i_val.itervalues():
|
||||||
for fp in group["inputs"][i][act]:
|
for fp in act.itervalues():
|
||||||
for bd in group["inputs"][i][act][fp]:
|
for bd in fp.itervalues():
|
||||||
for bbd in group["inputs"][i][act][fp][bd]:
|
for bbd, ss in bd.iteritems():
|
||||||
if bbd.lower() == 'binding':
|
if bbd.lower() == 'binding':
|
||||||
x = group["inputs"][i][act][fp][bd].get_all_for(bbd)
|
st = ss.split()
|
||||||
for ss in x:
|
supported_binding = False
|
||||||
st = ss.split()
|
if st[0].lower() == 'game_action':
|
||||||
supported_binding = False
|
supported_binding = True
|
||||||
if st[0].lower() == 'game_action':
|
if st[2][-1] == ",":
|
||||||
supported_binding = True
|
action_name = st[2][:-1]
|
||||||
if st[2][-1] == ",":
|
else:
|
||||||
action_name = st[2][:-1]
|
action_name = st[2][:]
|
||||||
else:
|
elif st[0].lower() == 'xinput_button':
|
||||||
action_name = st[2][:]
|
supported_binding = True
|
||||||
elif st[0].lower() == 'xinput_button':
|
if st[1][-1] == ",":
|
||||||
supported_binding = True
|
action_name = st[1][:-1]
|
||||||
if st[1][-1] == ",":
|
else:
|
||||||
action_name = st[1][:-1]
|
action_name = st[1][:]
|
||||||
else:
|
|
||||||
action_name = st[1][:]
|
if supported_binding:
|
||||||
|
if force_binding is None:
|
||||||
|
binding = keymap.get(i.lower(), None)
|
||||||
|
else:
|
||||||
|
binding = force_binding
|
||||||
|
|
||||||
if supported_binding:
|
if binding:
|
||||||
if force_binding is None:
|
if action_name in bindings:
|
||||||
binding = keymap.get(i.lower(), None)
|
if binding not in bindings[action_name]:
|
||||||
|
bindings[action_name].append(binding)
|
||||||
else:
|
else:
|
||||||
binding = force_binding
|
bindings[action_name] = [binding]
|
||||||
|
else:
|
||||||
if binding:
|
print(f"[X] missing keymap for {i}")
|
||||||
if action_name in bindings:
|
|
||||||
if binding not in bindings[action_name]:
|
|
||||||
bindings[action_name].append(binding)
|
|
||||||
else:
|
|
||||||
bindings[action_name] = [binding]
|
|
||||||
else:
|
|
||||||
print(f"[X] missing keymap for {i}")
|
|
||||||
return bindings
|
return bindings
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user