def add_atari_5200_software_info(software: 'Software', metadata: 'Metadata'):
    software.add_standard_metadata(metadata)
    uses_trackball = software.get_part_feature('peripheral') == 'trackball'

    metadata.save_type = SaveType.Nothing  #Probably

    #This doesn't really matter anyway, because MAME doesn't let you select controller type by slot device yet; and none of the other 5200 emulators are cool
    metadata.specific_info['Uses Trackball?'] = uses_trackball

    if uses_trackball:
        metadata.input_info.add_option(input_metadata.Trackball())
    else:
        normal_controller = input_metadata.NormalController()
        normal_controller.face_buttons = 2  #1, 2, (Pause, Reset, Start) I think? I think it works the same way for trackballs
        normal_controller.analog_sticks = 1
        metadata.input_info.add_option(normal_controller)
示例#2
0
def add_colecovision_software_info(software: 'Software', metadata: 'Metadata'):
    #Can get year, publisher unreliably from the title screen info in the ROM; please do not do that

    peripheral: ColecoController = ColecoController.Normal
    peripheral_required = False

    software.add_standard_metadata(metadata)

    usage = software.get_info('usage')
    if usage == 'Supports Super Action Controllers':
        peripheral = ColecoController.SuperActionController
    elif usage == 'Requires Super Action Controllers':
        peripheral = ColecoController.SuperActionController
        peripheral_required = True
    elif usage == 'Supports roller controller':
        peripheral = ColecoController.RollerController
    elif usage == 'Requires roller controller':
        peripheral = ColecoController.RollerController
        peripheral_required = True
    elif usage == 'Supports driving controller':
        peripheral = ColecoController.DrivingController
    elif usage == 'Requires driving controller':
        peripheral = ColecoController.DrivingController
        peripheral_required = True
    else:
        metadata.add_notes(usage)

    normal_controller_part = input_metadata.NormalController()
    normal_controller_part.face_buttons = 2
    normal_controller_part.dpads = 1
    normal_controller_keypad = input_metadata.Keypad()
    normal_controller_keypad.keys = 12
    normal_controller = input_metadata.CombinedController(
        [normal_controller_part, normal_controller_keypad])

    super_action_controller_buttons = input_metadata.NormalController()
    super_action_controller_buttons.face_buttons = 4  #Not really on the face, they're on the hand grip part, but still
    super_action_controller_buttons.dpads = 1
    super_action_controller_speed_roller = input_metadata.Dial(
    )  #Kind of, it's like a one-dimensional trackball from what I can tell
    super_action_controller_keypad = input_metadata.Keypad()
    super_action_controller_keypad.keys = 12
    super_action_controller = input_metadata.CombinedController([
        super_action_controller_buttons, super_action_controller_speed_roller,
        super_action_controller_keypad
    ])

    roller_controller = input_metadata.Trackball()
    #Not sure how many buttons?
    driving_controller = input_metadata.SteeringWheel()
    #Gas pedal is on + off so I guess it counts as one button

    metadata.specific_info['Peripheral'] = peripheral
    if peripheral == ColecoController.Normal:
        metadata.input_info.add_option(normal_controller)
    else:
        if peripheral == ColecoController.DrivingController:
            metadata.input_info.add_option(driving_controller)
        elif peripheral == ColecoController.RollerController:
            metadata.input_info.add_option(roller_controller)
        elif peripheral == ColecoController.SuperActionController:
            metadata.input_info.add_option(super_action_controller)
        if not peripheral_required:
            metadata.input_info.add_option(normal_controller)
示例#3
0
def add_sms_gg_software_list_info(software: 'Software', metadata: 'Metadata'):
	software.add_standard_metadata(metadata)

	usage = software.infos.get('usage')
	if usage == 'Only runs with PAL/50Hz drivers, e.g. smspal':
		metadata.specific_info['TV Type'] = TVSystem.PAL
	elif usage in {'Input works only with drivers of Japanese region, e.g. sms1kr,smsj', 'Only runs with certain drivers, e.g. smsj - others show SOFTWARE ERROR'}:
		metadata.specific_info['Japanese Only?'] = True
	elif usage == 'Video mode is correct only on SMS 2 drivers, e.g. smspal':
		metadata.specific_info['SMS2 Only?'] = True
	elif usage == 'Video only works correctly on drivers with SMS1 VDP, e.g. smsj':
		metadata.specific_info['SMS1 Only?'] = True
	else:
		metadata.add_notes(usage)
	#Other usage strings:
	#To play in 3-D on SMS1, hold buttons 1 and 2 while powering up the system.

	metadata.save_type = SaveType.Cart if software.get_part_feature('battery') == 'yes' else SaveType.Nothing

	slot = software.get_part_feature('slot')
	if slot == 'codemasters':
		metadata.specific_info['Mapper'] = 'Codemasters'
	elif slot == 'eeprom':
		metadata.specific_info['Mapper'] = 'EEPROM' #Is this really describable as a "mapper"?
		metadata.save_type = SaveType.Cart
	elif slot == '4pak':
		metadata.specific_info['Mapper'] = '4 Pak'
	elif slot == 'hicom':
		metadata.specific_info['Mapper'] = 'Hi-Com'
	elif slot == 'korean':
		metadata.specific_info['Mapper'] = 'Korean'
	elif slot == 'korean_nb':
		metadata.specific_info['Mapper'] = 'Korean Unbanked'
	elif slot == 'zemina':
		metadata.specific_info['Mapper'] = 'Zemina'
	elif slot == 'janggun':
		metadata.specific_info['Mapper'] = 'Janggun'
	elif slot == 'nemesis':
		metadata.specific_info['Mapper'] = 'Nemesis'
	elif slot == 'seojin':
		metadata.specific_info['Mapper'] = 'Seo Jin'


	if metadata.platform == 'Master System':
		builtin_gamepad = input_metadata.NormalController()
		builtin_gamepad.dpads = 1
		builtin_gamepad.face_buttons = 2

		controller_1 = software.get_shared_feature('ctrl1_default')
		#ctrl2_default is only ever equal to ctrl1_default when it is present, so ignore it for our purposes
		#Note that this doesn't actually tell us about games that _support_ given peripherals, just what games need them
		peripheral = SMSPeripheral.StandardController
		#All of these peripherals have 2 buttons as well?
		if controller_1 == 'graphic':
			peripheral = SMSPeripheral.Tablet
			metadata.input_info.add_option(input_metadata.Touchscreen())
		elif controller_1 == 'lphaser':
			peripheral = SMSPeripheral.Lightgun
			light_phaser = input_metadata.LightGun()
			light_phaser.buttons = 1
			metadata.input_info.add_option(light_phaser)
		elif controller_1 == 'paddle':
			peripheral = SMSPeripheral.Paddle
			paddle = input_metadata.Paddle()
			paddle.buttons = 2
			metadata.input_info.add_option(paddle)
		elif controller_1 == 'sportspad':
			peripheral = SMSPeripheral.SportsPad
			sports_pad = input_metadata.Trackball()
			sports_pad.buttons = 2
			metadata.input_info.add_option(sports_pad)
		else:
			#Not sure if this is an option for games that use lightgun/paddle/etc? I'll assume it's not
			metadata.input_info.add_option(builtin_gamepad)

		metadata.specific_info['Peripheral'] = peripheral
boostergrip.dpads = 1
boostergrip.face_buttons = 3

paddle = input_metadata.Paddle()
#Note that this is 2 paddles per port
paddle.buttons = 2

keypad = input_metadata.Keypad()
keypad.keys = 12

compumate = input_metadata.Keyboard()
compumate.keys = 42

mindlink = input_metadata.Biological()

driving_controller = input_metadata.SteeringWheel()

atari_st_mouse = input_metadata.Mouse()
atari_st_mouse.buttons = 2

xegs_gun = input_metadata.LightGun()
xegs_gun.buttons = 1

cx22_trackball = input_metadata.Trackball()
cx22_trackball.buttons = 1  #Physically 2, but functionally 1 (they are there to be ambidextrous)

#No, but also yes
megadrive_pad = input_metadata.NormalController()
megadrive_pad.face_buttons = 3
megadrive_pad.dpads = 1
示例#5
0
def add_input_info(game: 'MAMEGame') -> None:
	game.metadata.input_info.set_inited()
	if game.machine.input_element is None:
		#Seems like this doesn't actually happen
		if main_config.debug:
			print('Oi m8', game.machine.basename, '/', game.machine.name, 'has no input')
		return

	controller = input_metadata.CombinedController()

	has_normal_input = False
	has_added_vii_motion_controls = False
	normal_input = input_metadata.NormalController()

	has_control_elements = False

	for control in game.machine.input_element.iterfind('control'):
		has_control_elements = True
		buttons = int(control.attrib.get('buttons', 0))

		if control.attrib.get('player', '1') != '1':
			#I care not for these "other people" and "social interaction" concepts
			#Anyway, this would only matter for stuff where player 2 has a different control scheme like Lucky & Wild, and... not sure what I'm gonna do about that, because we wanna avoid doubling up on input types where number of players > 1, and then that seems to be correct anyway
			continue

		#Still kinda feel like this is messy but ehhh
		#Input metadata will probably never be perfect, MAME -listxml outputs things for a different purpose really, it just be like that sometimes
		#I wonder if I'd be better off making some kind of controls.ini file myself
		input_type = control.attrib['type']
		if input_type == 'only_buttons':
			has_normal_input = True
			normal_input.face_buttons += buttons
		elif input_type == 'joy':
			has_normal_input = True
			normal_input.face_buttons += buttons
			normal_input.dpads += 1
		elif input_type == 'doublejoy':
			has_normal_input = True
			normal_input.face_buttons += buttons
			normal_input.dpads += 2
		elif input_type == 'triplejoy':
			has_normal_input = True
			normal_input.face_buttons += buttons
			normal_input.dpads += 3
		elif input_type == 'paddle':
			if game.metadata.genre == 'Driving':
				#Yeah this looks weird and hardcody and dodgy but am I wrong
				if buttons > 0:
					has_normal_input = True
					normal_input.face_buttons += buttons
				controller.components.append(input_metadata.SteeringWheel())
			elif game.machine.basename == 'vii':
				#Uses 3 "paddle" inputs to represent 3-axis motion and I guess I'll have to deal with that
				if not has_added_vii_motion_controls:
					controller.components.append(input_metadata.MotionControls())
					has_added_vii_motion_controls = True
			else:
				paddle = input_metadata.Paddle()
				paddle.buttons = buttons
				controller.components.append(paddle)
		elif input_type == 'stick':
			has_normal_input = True
			normal_input.analog_sticks += 1
			normal_input.face_buttons += buttons
		elif input_type == 'pedal':
			if buttons > 0:
				has_normal_input = True
				normal_input.face_buttons += buttons
			pedal = input_metadata.Pedal()
			controller.components.append(pedal)
		elif input_type == 'lightgun':
			#TODO: See if we can be clever and detect if this is actually a touchscreen, like platform = handheld or something
			light_gun = input_metadata.LightGun()
			light_gun.buttons = buttons
			controller.components.append(light_gun)
		elif input_type == 'positional':
			#What _is_ a positional exactly
			positional = input_metadata.Positional()
			controller.components.append(positional)
		elif input_type == 'dial':
			dial = input_metadata.Dial()
			dial.buttons = buttons
			controller.components.append(dial)
		elif input_type == 'trackball':
			trackball = input_metadata.Trackball()
			trackball.buttons = buttons
			controller.components.append(trackball)
		elif input_type == 'mouse':
			mouse = input_metadata.Mouse()
			mouse.buttons = buttons
			controller.components.append(mouse)
		elif input_type == 'keypad':
			keypad = input_metadata.Keypad()
			keypad.keys = buttons
			controller.components.append(keypad)
		elif input_type == 'keyboard':
			keyboard = input_metadata.Keyboard()
			keyboard.keys = buttons
			controller.components.append(keyboard)
		elif input_type == 'mahjong':
			mahjong = input_metadata.Mahjong()
			mahjong.buttons = buttons
			controller.components.append(mahjong)
		elif input_type == 'hanafuda':
			hanafuda = input_metadata.Hanafuda()
			hanafuda.buttons = buttons
			controller.components.append(hanafuda)
		elif input_type == 'gambling':
			gambling = input_metadata.Gambling()
			gambling.buttons = buttons
			controller.components.append(gambling)
		else:
			if buttons:
				description = 'Custom input device with {0}'.format(pluralize(buttons, 'button'))
			else:
				description = 'Custom input device'
			controller.components.append(input_metadata.Custom(description))

	if has_normal_input:
		controller.components.append(normal_input)

	if not has_control_elements:
		#Sometimes you get some games with 1 or more players, but no control type defined.  This usually happens with
		#pinball games and weird stuff like a clock, but also some genuine games like Crazy Fight that are more or less
		#playable just fine, so we'll leave them in
		if game.machine.number_of_players > 0:
			game.metadata.input_info.add_option(input_metadata.Custom('Unknown input device'))
		return

	game.metadata.input_info.add_option(controller)