Cleanup mednafen runner

This commit is contained in:
Mathieu Comandon 2018-04-30 16:33:07 -07:00
parent cae937cc85
commit 22b1af04b6

View file

@ -5,6 +5,7 @@ from lutris.util.display import get_current_resolution
from lutris.util.log import logger
from lutris.util.joypad import get_controller_mappings
class mednafen(Runner):
human_name = "Mednafen"
description = ("Multi-system emulator including NES, GB(A), PC Engine "
@ -153,14 +154,19 @@ class mednafen(Runner):
# Get the controller mappings
mapping = get_controller_mappings()[0][1]
# Consrtuct a dictionary of button codes to parse to mendafen
map_code = {'a':'','b':'','c':'','x':'','y':'','z':'','back':'',
'start':'','leftshoulder':'','rightshoulder':'',
'lefttrigger':'','righttrigger':'','leftstick':'',
'rightstick':'','select':'','shoulder_l':'','shoulder_r':'',
# Construct a dictionnary of button codes to parse to mendafen
map_code = {
'a': '', 'b': '', 'c': '',
'x': '', 'y': '', 'z': '',
'back': '', 'start': '',
'leftshoulder': '', 'rightshoulder': '',
'lefttrigger': '', 'righttrigger': '',
'leftstick': '', 'rightstick': '',
'select': '',
'shoulder_l': '', 'shoulder_r': '',
'i': '', 'ii': '', 'iii': '', 'iv': '', 'v': '', 'vi': '', 'run': '',
'ls':'','rs':'','fire1':'','fire2':'','option_1':'',
'option_2':'','cross':'','circle':'','square':'','triangle':'',
'ls': '', 'rs': '', 'fire1': '', 'fire2': '', 'option_1': '', 'option_2': '',
'cross': '', 'circle': '', 'square': '', 'triangle': '',
'r1': '', 'r2': '', 'l1': '', 'l2': '', 'option': '', 'l': '', 'r': '',
'right-x': '', 'right-y': '', 'left-x': '', 'left-y': '',
'up-x': '', 'up-y': '', 'down-x': '', 'down-y': '', 'up-l': '',
@ -177,7 +183,8 @@ class mednafen(Runner):
'dpup': '0000c005',
'dpdown': '00008005',
'dpleft': '0000c004',
'dpright':'00008004'}
'dpright': '00008004'
}
# Insert the button mapping number into the map_codes
for button in mapping.keys:
@ -189,16 +196,16 @@ class mednafen(Runner):
map_code['up'] = map_code['dpup'] #
map_code['down'] = map_code['dpdown'] #
map_code['left'] = map_code['dpleft'] # Multiple systems
map_code['right'] = map_code['dpright'] #
map_code['right'] = map_code['dpright']
map_code['select'] = map_code['back'] #
map_code['shoulder_r'] = map_code['rightshoulder'] # GBA
map_code['shoulder_l'] = map_code['leftshoulder'] #
map_code['i'] = map_code['b'] #
map_code['ii'] = map_code['a'] #
map_code['iii'] = map_code['leftshoulder'] #
map_code['iii'] = map_code['leftshoulder']
map_code['iv'] = map_code['y'] # PCEngine and PCFX
map_code['v'] = map_code['x'] #
map_code['vi'] = map_code['rightshoulder'] #
map_code['vi'] = map_code['rightshoulder']
map_code['run'] = map_code['start'] #
map_code['ls'] = map_code['leftshoulder'] #
map_code['rs'] = map_code['rightshoulder'] # Saturn
@ -223,7 +230,7 @@ class mednafen(Runner):
map_code['left-x'] = map_code['dpleft'] #
map_code['up-x'] = map_code['dpup'] #
map_code['down-x'] = map_code['dpdown'] # Wonder Swan
map_code['right-y'] = map_code['lstick_right'] #
map_code['right-y'] = map_code['lstick_right']
map_code['left-y'] = map_code['lstick_left'] #
map_code['up-y'] = map_code['lstick_up'] #
map_code['down-y'] = map_code['lstick_down'] #