Skip to content

Commit

Permalink
Input refactoring:
Browse files Browse the repository at this point in the history
osd/modules/input, emu/inpttype.cpp: Made most default joystick
assignments supplied by input modules.  Input modules take available
controls into consideration when generating default assignments.

emu/inpttype.ipp: Added a separate "Back" UI input separate from Cancel.
You may want an easier to hit combination for moving to the previous
menu than for exiting or cancelling input.  They both default to Escape.

emu/inpttype.ipp: Added a UI Help control.  Currently only used by
analog inputs menu

emu/inpttype.h: Moved I/O port field type enum to its own header and
sorted UI controls so they appear in a more logical order.

ui: Don't use UI Select to restore defaults - people should be getting
used to the UI Clear input by now.  UI Select cycles multi-value items
instead.

ui/inputmap.cpp: Don't use immediate cancel to cycle between clearing
and restoring default assignment (use UI Clear instead).

osd: Reduced the number of files needing to include the dreaded emu.h.
Got some implementation out of headers.
  • Loading branch information
cuavas committed Feb 17, 2023
1 parent 20d7135 commit d4589e0
Show file tree
Hide file tree
Showing 109 changed files with 35,053 additions and 29,837 deletions.
11 changes: 10 additions & 1 deletion ctrlr/hotrod.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,21 @@
<newseq type="standard">KEYCODE_ENTER OR KEYCODE_LCONTROL</newseq>
</port>

<port type="UI_CONFIGURE">
<port type="UI_MENU">
<newseq type="standard">KEYCODE_TAB OR KEYCODE_1 KEYCODE_3</newseq>
</port>
<port type="UI_BACK">
<newseq type="standard">KEYCODE_ESC OR KEYCODE_LALT OR JOYCODE_1_BUTTON2</newseq>
</port>
<port type="UI_CANCEL">
<newseq type="standard">KEYCODE_ESC OR KEYCODE_2 KEYCODE_4</newseq>
</port>
<port type="UI_CLEAR">
<newseq type="standard">KEYCODE_DEL OR KEYCODE_SPACE OR JOYCODE_1_BUTTON3</newseq>
</port>
<port type="UI_HELP">
<newseq type="standard">KEYCODE_F1 OR KEYCODE_LSHIFT OR JOYCODE_1_BUTTON4</newseq>
</port>

<port type="START1">
<newseq type="standard">KEYCODE_1</newseq>
Expand Down
11 changes: 10 additions & 1 deletion ctrlr/hotrodse.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,21 @@
<newseq type="standard">KEYCODE_ENTER OR KEYCODE_LCONTROL</newseq>
</port>

<port type="UI_CONFIGURE">
<port type="UI_MENU">
<newseq type="standard">KEYCODE_TAB OR KEYCODE_1 KEYCODE_3</newseq>
</port>
<port type="UI_BACK">
<newseq type="standard">KEYCODE_ESC OR KEYCODE_LALT OR JOYCODE_1_BUTTON2</newseq>
</port>
<port type="UI_CANCEL">
<newseq type="standard">KEYCODE_ESC OR KEYCODE_2 KEYCODE_4</newseq>
</port>
<port type="UI_CLEAR">
<newseq type="standard">KEYCODE_DEL OR KEYCODE_SPACE OR JOYCODE_1_BUTTON3</newseq>
</port>
<port type="UI_HELP">
<newseq type="standard">KEYCODE_F1 OR KEYCODE_LSHIFT OR JOYCODE_1_BUTTON4</newseq>
</port>

<port type="START1">
<newseq type="standard">KEYCODE_1</newseq>
Expand Down
11 changes: 10 additions & 1 deletion ctrlr/scorpionxg.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,21 @@
<newseq type="standard">KEYCODE_ENTER OR KEYCODE_LCONTROL</newseq>
</port>

<port type="UI_CONFIGURE">
<port type="UI_MENU">
<newseq type="standard">KEYCODE_TAB</newseq>
</port>
<port type="UI_BACK">
<newseq type="standard">KEYCODE_ESC OR KEYCODE_LALT OR JOYCODE_1_BUTTON2</newseq>
</port>
<port type="UI_CANCEL">
<newseq type="standard">KEYCODE_ESC</newseq>
</port>
<port type="UI_CLEAR">
<newseq type="standard">KEYCODE_DEL OR KEYCODE_SPACE OR JOYCODE_1_BUTTON3</newseq>
</port>
<port type="UI_HELP">
<newseq type="standard">KEYCODE_F1 OR KEYCODE_C OR JOYCODE_1_BUTTON4</newseq>
</port>

<port type="START1">
<newseq type="standard">KEYCODE_1</newseq>
Expand Down
11 changes: 10 additions & 1 deletion ctrlr/slikstik.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,21 @@
<newseq type="standard">KEYCODE_7 OR KEYCODE_ENTER OR JOYCODE_1_BUTTON1</newseq>
</port>

<port type="UI_CONFIGURE">
<port type="UI_MENU">
<newseq type="standard">KEYCODE_TAB OR KEYCODE_1 KEYCODE_5</newseq>
</port>
<port type="UI_BACK">
<newseq type="standard">KEYCODE_ESC OR KEYCODE_H OR JOYCODE_1_BUTTON2 OR KEYCODE_L</newseq>
</port>
<port type="UI_CANCEL">
<newseq type="standard">KEYCODE_ESC OR KEYCODE_2 KEYCODE_6</newseq>
</port>
<port type="UI_CLEAR">
<newseq type="standard">KEYCODE_DEL OR KEYCODE_9 OR JOYCODE_1_BUTTON3</newseq>
</port>
<port type="UI_HELP">
<newseq type="standard">KEYCODE_F1 OR KEYCODE_0 OR JOYCODE_1_BUTTON4</newseq>
</port>

<port type="START1">
<newseq type="standard">KEYCODE_1 OR JOYCODE_1_START</newseq>
Expand Down
11 changes: 10 additions & 1 deletion ctrlr/xarcade.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,21 @@
<newseq type="standard">KEYCODE_ENTER OR KEYCODE_LCONTROL</newseq>
</port>

<port type="UI_CONFIGURE">
<port type="UI_MENU">
<newseq type="standard">KEYCODE_TAB OR KEYCODE_1 KEYCODE_3</newseq>
</port>
<port type="UI_BACK">
<newseq type="standard">KEYCODE_ESC OR KEYCODE_LALT OR JOYCODE_1_BUTTON2</newseq>
</port>
<port type="UI_CANCEL">
<newseq type="standard">KEYCODE_ESC OR KEYCODE_2 KEYCODE_4</newseq>
</port>
<port type="UI_CLEAR">
<newseq type="standard">KEYCODE_DEL OR KEYCODE_SPACE OR JOYCODE_1_BUTTON3</newseq>
</port>
<port type="UI_HELP">
<newseq type="standard">KEYCODE_F1 OR KEYCODE_LSHIFT OR JOYCODE_1_BUTTON4</newseq>
</port>

<port type="START1">
<newseq type="standard">KEYCODE_1</newseq>
Expand Down
14 changes: 8 additions & 6 deletions docs/source/advanced/bgfx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ bgfx_screen_chains
we want to give each player their own full screen display (two physical
monitors) along with the LCD, we’ll go with::

-numscreens 2 -view0 "Player 1" -view1 "Player 2" -video bgfx -bgfx_screen_chains hlsl,unfiltered,unfiltered:hlsl,unfiltered,unfiltered
-numscreens 2 -view0 "Player 1" -view1 "Player 2" -video bgfx -bgfx_screen_chains hlsl,unfiltered:hlsl,unfiltered

This sets up the view for each display respectively, keeping HLSL effect on
the CRT for each window (physical display) while going unfiltered for the
Expand All @@ -164,8 +164,7 @@ bgfx_screen_chains
If using only one window (one display), keep in mind the game still has
three screens, so we would use::

bgfx_screen_chains hlsl,unfiltered,unfiltered``

bgfx_screen_chains hlsl,unfiltered,unfiltered

Note that the commas are on the outside edges, and any colons are in the
middle.
Expand All @@ -177,9 +176,6 @@ bgfx_shadow_mask
Tweaking BGFX HLSL Settings inside MAME
---------------------------------------

*Warning: Currently BGFX HLSL settings are not saved or loaded from any
configuration files. This is expected to change in the future.*

Start by loading MAME with the game of your choice (e.g. **mame pacman**).

The tilde key (**~**) brings up the on-screen display options. Use up and down
Expand All @@ -189,6 +185,12 @@ these settings.

Note that settings are individually changeable on a per-screen basis.

BGFX slider settings are saved per-system in CFG files. If the
``bgfx_screen_chains`` setting has been set (either in an INI file or on the
command line), it will set the initial effects. If the ``bgfx_screen_chains``
setting has not been set, MAME will use the effects you chose the last time you
ran the system.


Using the included pillarbox filters
------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions docs/source/advanced/ctrlr_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ override the default control assignments for emulated inputs by type:
.. code-block:: XML
<input>
<port type="UI_CONFIGURE">
<port type="UI_MENU">
<newseq type="standard">KEYCODE_TAB OR KEYCODE_1 KEYCODE_5</newseq>
</port>
<port type="UI_CANCEL">
Expand All @@ -170,7 +170,7 @@ override the default control assignments for emulated inputs by type:
This sets the following default input assignments:

Config Menu (User Interface)
Show/Hide Menu (User Interface)
Tab key, or 1 and 2 keys pressed simultaneously
UI Cancel (User Interface)
Escape key, or 2 and 6 keys pressed simultaneously
Expand Down
8 changes: 4 additions & 4 deletions docs/source/plugins/autofire.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ Experiment with different values to get the best effect.
When adding a new autofire button, there is a **Cancel** option that changes to
**Create** after you set the input and hotkey. Select **Create** to finish
creating the autofire button and return to the list of autofire buttons. The
new autofire button will be added at the end of the list. Press the UI Cancel
key (Escape/Esc on the keyboard by default), or select **Cancel** before setting
the input/hotkey, to return to the previous menu without creating the new
autofire button.
new autofire button will be added at the end of the list. Press the UI Back key
(Escape/Esc on the keyboard by default), or select **Cancel** before setting the
input/hotkey, to return to the previous menu without creating the new autofire
button.

When modifying an existing autofire button, select **Done** or press the UI
Cancel key to return to the list of autofire buttons. Changes take effect
Expand Down
6 changes: 3 additions & 3 deletions docs/source/plugins/inputmacro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ whole:
descriptive. Press the UI Select key (Return/Enter on the keyboard or the
first button on the first joystick by default) to edit the current name, or
press the UI Clear key to type a new name. Press the UI Select key before
moving to another menu item to save the new name; press the UI Cancel key
moving to another menu item to save the new name; press the UI Back key
(Escape/Esc on the keyboard by default) to change discard the new name.
* Select **Activation combination** to set the control (or combination of
controls) you want to use to activate the macro. Keep in mind that regular
Expand Down Expand Up @@ -112,11 +112,11 @@ When creating a new macro, there is a **Cancel** option that changes to
**Create** after you set the activating sequence and the first input for the
initially created step. Select **Create** to finish creating the macro and
return to the list of input macros. The new macro will be added at the end of
the list. Press the UI Cancel key, or select **Cancel** before setting the
the list. Press the UI Back key, or select **Cancel** before setting the
activation sequence/input, to return to the previous menu without creating the
new macro.

When editing an existing macro, select **Done** or press the UI Cancel key to
When editing an existing macro, select **Done** or press the UI Back key to
return to the list of input macros. Changes take effect immediately.


Expand Down
4 changes: 4 additions & 0 deletions docs/source/techspecs/luareference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2549,6 +2549,10 @@ manager.machine.uiinput
Methods
^^^^^^^

uiinput:reset()
Clears pending events and UI input states. Should be called when leaving a
modal state where input is handled directly (e.g. configuring an input
combination).
uiinput:find_mouse()
Returns host system mouse pointer X position, Y position, button state, and
the :ref:`render target <luareference-render-target>` it falls in. The
Expand Down
49 changes: 25 additions & 24 deletions docs/source/usingmame/mamemenus.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ Introduction
------------

To show the :ref:`main menu <menus-main>` while running an emulated system in
MAME, press the **Config Menu** key or button (**Tab** by default). If the
emulated system has keyboard inputs, you may need to press the **UI Toggle** key
or button (**Scroll Lock**, or **Forward Delete** on macOS, by default) to
enable user interface controls first. You can dismiss a menu by pressing the
**UI Cancel** key or button (**Escape** by default). Dismissing a menu will
return to its parent menu, or to the running system in the case of the main
menu.

You can hide a menu and return to the running system by pressing the **Config
Menu** key or button. Pressing the **Config Menu** key or button again will
jump back to the same menu. This is useful when testing changes to settings.
MAME, press the **Show/Hide Menu** key or button (**Tab** by default). If the
emulated system has keyboard inputs, you may need to press the
**Toggle UI Controls** key or button (**Scroll Lock**, or **Forward Delete** on
macOS, by default) to enable user interface controls first. You can dismiss a
menu by pressing the **UI Back** key or button (**Escape** by default).
Dismissing a menu will return to its parent menu, or to the running system in
the case of the main menu.

You can hide a menu and return to the running system by pressing the
**Show/Hide Menu** key or button. Pressing the **Show/Hide Menu** key or button
again will jump back to the same menu. This is useful when testing changes to
settings.

Emulated system inputs are ignored while menus are displayed. You can still
pause or resume the running system while most menus are displayed by pressing
Expand All @@ -43,17 +44,17 @@ For more information on navigating menus, :ref:`see the relevant section
Main menu
---------

The main menu is shown when you press the **Config Menu** key or button while
The main menu is shown when you press the **Show/Hide Menu** key or button while
running an emulated system or while the system information screen is displayed.
It provides access to menus used to change settings, control various features,
and show information about the running system and MAME itself.

If you press the **Config Menu** key or button to show the main menu while the
system information screen is displayed, the emulated system will not start until
the main menu is dismissed (either by selecting **Start System**, pressing the
**UI Cancel** key or button, or pressing the **Config Menu** key or button).
This can be useful for mounting media images or changing DIP switches and
machine configuration settings before the emulated system starts.
If you press the **Show/Hide Menu** key or button to show the main menu while
the system information screen is displayed, the emulated system will not start
until the main menu is dismissed (either by selecting **Start System**, pressing
the **UI Back** key or button, or pressing the **Show/Hide Menu** key or
button). This can be useful for mounting media images or changing DIP switches
and machine configuration settings before the emulated system starts.

Input Settings
Shows the :ref:`Input Settings <menus-inputopts>` menu, where you can assign
Expand Down Expand Up @@ -127,13 +128,13 @@ Cheat
Plugin Options
Shows the Plugin Options menu, where you can access settings for enabled
plugins. This item is not shown if no plugins are enabled, or if the main
menu is shown before the emulated system starts (by pressing the Config Menu
key/button while the system information screen is displayed).
menu is shown before the emulated system starts (by pressing the Show/Hide
Menu key/button while the system information screen is displayed).
External DAT View
Shows the info viewer, which displays information loaded from various
external support files. This item is not shown if the :ref:`data plugin
<plugins-data>` is not enabled, or if the main menu is shown before the
emulated system starts (by pressing the Config Menu key/button while the
emulated system starts (by pressing the Show/Hide Menu key/button while the
system information screen is displayed).
Add To Favorites/Remove From Favorites
Adds the running system to the favourites list, or removes it if it’s
Expand All @@ -144,13 +145,13 @@ About MAME
Select New System
Shows the system selection menu, where you can select a system to start a
new emulation session. This item is not shown if the main menu is shown
before the emulated system starts (by pressing the Config Menu key/button
before the emulated system starts (by pressing the Show/Hide Menu key/button
while the system information screen is displayed).
Close Menu/Start System
Closes the main menu, returning control of the running system. Shows
**Start System** if the main menu is shown before the emulated system
starts (by pressing the Config Menu key/button while the system information
screen is displayed).
starts (by pressing the Show/Hide Menu key/button while the system
information screen is displayed).


.. _menus-inputopts:
Expand Down
Loading

0 comments on commit d4589e0

Please sign in to comment.