The ability to map joypad buttons to generic actions that behave differently according to the current MegaZeux context (e.g. gameplay, dialog, menu) should be added. Additionally, these generic actions should be mappable to KEY_PRESSED values on a game-specific basis.
Example configuration and generic actions:
/* # Action Title screen Window Game key (default) # ------------- -------------- -------------- ---------------------- # up Cursor up Up (move) # down Cursor down Down (move) # left Cursor left Left (move) # right Cursor right Right (move) # a Play game Select Space (shoot) # b Main menu Cancel Delete (lay bomb) # x Load world Select char S (Caverns: spells) # y Reload save Backspace P (Caverns: altar) # select Exit Cancel Escape (exit[1]) # start Play game Select Enter (game menu) # lshoulder Settings Next element Insert (switch bombs) # rshoulder[2] Settings Settings[3] F2 (settings) # ltrigger[2] Load world Page up F3 (save game) # rtrigger[2] Reload save Page down F4 (load save) # lstick[2] Home # rstick[2] End # Actions "up"/"down"/"left"/"right" are intended for a digital pad. Actions # "l_up"/"l_down"/"l_left"/"l_right" and "r_up"/"r_down"/"r_left"/"r_right" # also exist, which are similar and intended for analog stick mapping on # controllers that possess both a digital pad and analog sticks. # [1] This behavior will always override other bindings unless the # exit dialog has been disabled. # [2] The rshoulder action is highly likely to be unmapped on console ports # that use an onscreen keyboard by default. Availability of several other # actions also varies. # [3] Works on the main menu and game menu. May not work on other windows # currently. */
The Nintendo DS pad.config file might have:
joy1button1 = act_a joy1button2 = act_b joy1button3 = act_x joy1button4 = act_y joy1button5 = act_lshoulder joy1button7 = act_select joy1button8 = act_start
Demon Earth's game.cnf file might look like:
# A (sword) joy[1,16].a = key_a # S (spirit shot) joy[1,16].b = key_s # Space (hold direction) joy[1,16].lshoulder = key_space
Benefits:
- Generic actions would mean different console pad.config files could be defined more readably.
- Context-sensitivity would drastically improve console button mapping by allowing e.g. Start to both start the game from the title (like P) and open the menu in-game (like Enter).
- Having a standard for assigning these generic actions will help unify console pad.config setups (which currently vary drastically in some cases).
- The JOY_SELECT generic action can not be disabled or overriden by game configs, meaning there will always be a standard (and remappable) way to exit games on consoles.
- Having specific buttons/axes/hats mapped to generic actions and allowing users to map the abstracted actions to KEY_PRESSED values creates a simple and universal standard for defining game-specific joypad configurations.
- Separating specific button/axis/hat values from game-specific configuration would allows users to map their personal joypads based on their own needs without necessarily changing game-specific mappings.
- Likewise, game mappings could be redefined by games without affecting the behavior of the MegaZeux UI for a particular user.
- Separating specific button/axis/hat values from game-specific configuration would allows users to map their personal joypads based on their own needs without necessarily changing game-specific mappings.
Requirements (crossed-off items are finished in the branch joy-action):
Store actual joypad axis/button/hat information instead of faking key presses by default.Add support for the enum values to the config file.Add context-sensitive handlers to each context and non-context UIs.Documentation in config.txt(and possibly add a guide in the docs folder for creating new pad.config files).Move consoles to new platform-independent joystick functions.Replace existing console pad.config mappings with generic mappings.
edit: updated to reflect changes introduced in this pull request.
This post has been edited by Lachesis: 08 July 2019 - 05:18 PM