Skip to content

Commit a84d0a9

Browse files
committed
Merge pull request #39 from conchurnavid/semi-auto
save input-sdl device name to allow correct auto-configuration
2 parents 63147f2 + 7b58bfa commit a84d0a9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/m64py/frontend/input.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def __init__(self, parent):
4444
self.controller = 1
4545
self.mode = 0
4646
self.device = -1
47+
self.device_map = {}
4748
self.opts = {}
4849
self.keys = {}
4950
self.section = None
@@ -122,8 +123,10 @@ def add_items(self):
122123
self.comboMode.addItem(mode, mtype)
123124

124125
devices = [(self.tr("Keyboard/Mouse"), -1)]
126+
self.device_map[-1] = "Keyboard"
125127
for num, joy in enumerate(self.joystick.joystick_names):
126128
devices.append((self.tr("Joystick %s (%s)" % (num, joy)), num))
129+
self.device_map[num] = joy
127130

128131
for device, dtype in devices:
129132
self.comboDevice.addItem(device, dtype)
@@ -235,6 +238,10 @@ def set_opts(self):
235238
widget.setToolTip(tooltip)
236239

237240
def save_opts(self):
241+
devicename = self.device_map.get(self.device)
242+
if devicename:
243+
self.config.set_parameter("name", devicename)
244+
238245
for key, val in self.opts.items():
239246
param, tooltip, widget, ptype = val
240247
if ptype == M64TYPE_BOOL:

0 commit comments

Comments
 (0)