summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--docs/source/advanced/linux-lightguns.rst91
-rw-r--r--docs/source/commandline/commandline-all.rst18
-rw-r--r--docs/source/commandline/commandline-index.rst1
-rw-r--r--docs/source/plugins/inputmacro.rst38
-rw-r--r--plugins/inputmacro/init.lua12
-rw-r--r--plugins/inputmacro/inputmacro_menu.lua171
-rw-r--r--plugins/inputmacro/inputmacro_persist.lua6
-rw-r--r--plugins/inputmacro/plugin.json2
-rw-r--r--src/emu/emuopts.cpp1
-rw-r--r--src/emu/emuopts.h2
-rw-r--r--src/emu/inputdev.cpp28
-rw-r--r--src/emu/inputdev.h2
-rw-r--r--src/frontend/mame/ui/miscmenu.cpp21
-rw-r--r--src/frontend/mame/ui/pluginopt.cpp27
-rw-r--r--src/frontend/mame/ui/state.cpp15
-rw-r--r--src/frontend/mame/ui/submenu.cpp1
16 files changed, 274 insertions, 162 deletions
diff --git a/docs/source/advanced/linux-lightguns.rst b/docs/source/advanced/linux-lightguns.rst
index 630605c4ae9..9463b00edc8 100644
--- a/docs/source/advanced/linux-lightguns.rst
+++ b/docs/source/advanced/linux-lightguns.rst
@@ -1,63 +1,76 @@
Linux Lightguns
===============
-Many lightguns (especially the Ultimarc AimTrak) may work better in MAME under Linux when using a slightly more complicated configuration. The instructions here are for getting an AimTrak working on Ubuntu using udev and Xorg, but other Linux distributions and lightguns may work with some changes to the steps.
+Many lightguns (especially the Ultimarc AimTrak) may work better in MAME under
+Linux when using a slightly more complicated configuration. The instructions
+here are for getting an AimTrak working on Ubuntu using udev and Xorg, but other
+Linux distributions and lightguns may work with some changes to the steps.
Configure udev rules
--------------------
-For the AimTrak, each lightgun exposes several USB devices once connected: 2 mouse emulation devices, and 1 joystick emulation device. We need to instruct libinput via udev to ignore all but the correct emulated mouse device. This prevents each lightgun from producing multiple mouse devices, which would result in non-deterministic selection between the "good" and "bad" emulated mouse devices by Xorg.
+For the AimTrak, each lightgun exposes several USB devices once connected: 2
+mouse emulation devices, and 1 joystick emulation device. We need to instruct
+libinput via udev to ignore all but the correct emulated mouse device. This
+prevents each lightgun from producing multiple mouse devices, which would result
+in non-deterministic selection between the "good" and "bad" emulated mouse
+devices by Xorg.
-Create a new file named ``/etc/udev/rules.d/65-aimtrak.rules`` and place the following contents into it:
+Create a new file named ``/etc/udev/rules.d/65-aimtrak.rules`` and place the
+following contents into it::
-| # Set mode (0666) & disable libinput handling to avoid X11 picking up the wrong
-| # interfaces/devices.
-| SUBSYSTEMS=="usb", ATTRS{idVendor}=="d209", ATTRS{idProduct}=="160*",
-| MODE="0666", ENV{ID_INPUT}="", ENV{LIBINPUT_IGNORE_DEVICE}="1"
-|
-| # For ID_USB_INTERFACE_NUM==2, re-enable libinput handling.
-| SUBSYSTEMS=="usb", ATTRS{idVendor}=="d209", ATTRS{idProduct}=="160*",
-| ENV{ID_USB_INTERFACE_NUM}=="02", ENV{ID_INPUT}="1",
-| ENV{LIBINPUT_IGNORE_DEVICE}="0"
-|
+ # Set mode (0666) & disable libinput handling to avoid X11 picking up the wrong
+ # interfaces/devices.
+ SUBSYSTEMS=="usb", ATTRS{idVendor}=="d209", ATTRS{idProduct}=="160*",
+ MODE="0666", ENV{ID_INPUT}="", ENV{LIBINPUT_IGNORE_DEVICE}="1"
-This configuration will be correct for the AimTrak lightguns, however each brand of lightgun will require their own settings.
+ # For ID_USB_INTERFACE_NUM==2, re-enable libinput handling.
+ SUBSYSTEMS=="usb", ATTRS{idVendor}=="d209", ATTRS{idProduct}=="160*",
+ ENV{ID_USB_INTERFACE_NUM}=="02", ENV{ID_INPUT}="1",
+ ENV{LIBINPUT_IGNORE_DEVICE}="0"
+
+This configuration will be correct for the AimTrak lightguns, however each brand
+of lightgun will require their own settings.
Configure Xorg inputs
---------------------
-Next, we'll configure Xorg to treat the lightguns as a "Floating" device. This is important for multiple lightguns to work correctly and ensures each gun's emulated mouse pointer is NOT merged with the main system mouse pointer.
+Next, we'll configure Xorg to treat the lightguns as a "Floating" device. This
+is important for multiple lightguns to work correctly and ensures each gun's
+emulated mouse pointer is NOT merged with the main system mouse pointer.
-In ``/etc/X11/xorg.conf.d/60-aimtrak.conf`` we will need:
+In ``/etc/X11/xorg.conf.d/60-aimtrak.conf`` we will need::
-| Section "InputClass"
-| Identifier "AimTrak Guns"
-| MatchDevicePath "/dev/input/event*"
-| MatchUSBID "d209:160*"
-| Driver "libinput"
-| Option "Floating" "yes"
-| Option "AutoServerLayout" "no"
-| EndSection
-|
+ Section "InputClass"
+ Identifier "AimTrak Guns"
+ MatchDevicePath "/dev/input/event*"
+ MatchUSBID "d209:160*"
+ Driver "libinput"
+ Option "Floating" "yes"
+ Option "AutoServerLayout" "no"
+ EndSection
Configure MAME
--------------
-Next, we'll need to configure MAME via ``mame.ini`` to use the new lightgun device(s).
-
-* lightgun 1
-* lightgun_device lightgun
-* lightgunprovider x11
-
-These first three lines tell MAME to enable lightgun support, to tell MAME that we're using a lightgun instead of a mouse, and to use the x11 provider.
+Next, we'll need to configure MAME via ``mame.ini`` to use the new lightgun
+device(s)::
-* lightgun_index1 "Ultimarc ATRAK Device #1"
-* lightgun_index2 "Ultimarc ATRAK Device #2"
-* lightgun_index3 "Ultimarc ATRAK Device #3"
-* lightgun_index4 "Ultimarc ATRAK Device #4"
+ lightgun 1
+ lightgun_device lightgun
+ lightgunprovider x11
-These next lines then tell MAME to keep lightguns consistent across sessions.
+These first three lines tell MAME to enable lightgun support, to tell MAME that
+we're using a lightgun instead of a mouse, and to use the x11 provider::
-* offscreen_reload 1
+ lightgun_index1 "Ultimarc ATRAK Device #1"
+ lightgun_index2 "Ultimarc ATRAK Device #2"
+ lightgun_index3 "Ultimarc ATRAK Device #3"
+ lightgun_index4 "Ultimarc ATRAK Device #4"
-Lastly, as most lightgun games require offscreen reloading and we're using a device that actually can point away from the screen, we enable that functionality.
+Lastly, as many lightgun games require aiming away from the screen and firing to
+reload, you may reloading and we're using a device that represents that as a
+separate button, you will need to configure the :ref:`off-screen reload helper
+plugin <plugins-offscreenreload>` or :ref:`input macro plugin
+<plugins-inputmacro>` to translate this to the axis and button inputs that these
+games expect.
diff --git a/docs/source/commandline/commandline-all.rst b/docs/source/commandline/commandline-all.rst
index 208cc9810d0..d4a40bce549 100644
--- a/docs/source/commandline/commandline-all.rst
+++ b/docs/source/commandline/commandline-all.rst
@@ -3276,24 +3276,6 @@ Core Input Options
mame apple2e -ui_active
-.. _mame-commandline-nooffscreenreload:
-
-**-[no]offscreen_reload** / **-[no]reload**
-
- Controls whether or not MAME treats a second button input from a lightgun as
- a reload signal. In this case, MAME will report the gun's position as
- (0,MAX) with the trigger held, which is equivalent to an offscreen reload.
-
- This is only needed for games that required you to shoot offscreen to
- reload, and then only if your gun does not support off screen reloads.
-
- The default is OFF (**-nooffscreen_reload**).
-
- Example:
- .. code-block:: bash
-
- mame lethalen -offscreen_reload
-
.. _mame-commandline-joystickmap:
**-joystick_map** *<map>* / **-joymap** *<map>*
diff --git a/docs/source/commandline/commandline-index.rst b/docs/source/commandline/commandline-index.rst
index 07808ee4445..76f4e5cb5cc 100644
--- a/docs/source/commandline/commandline-index.rst
+++ b/docs/source/commandline/commandline-index.rst
@@ -264,7 +264,6 @@ Core Input Options
| :ref:`[no]multimouse <mame-commandline-nomultimouse>`
| :ref:`[no]steadykey <mame-commandline-nosteadykey>`
| :ref:`[no]ui_active <mame-commandline-uiactive>`
-| :ref:`[no]offscreen_reload <mame-commandline-nooffscreenreload>`
| :ref:`joystick_map <mame-commandline-joystickmap>`
| :ref:`joystick_deadzone <mame-commandline-joystickdeadzone>`
| :ref:`joystick_saturation <mame-commandline-joysticksaturation>`
diff --git a/docs/source/plugins/inputmacro.rst b/docs/source/plugins/inputmacro.rst
index 9ef67625fb3..0a537cd1134 100644
--- a/docs/source/plugins/inputmacro.rst
+++ b/docs/source/plugins/inputmacro.rst
@@ -90,12 +90,17 @@ Each step has delay, duration and input settings:
completing the macro in the case of the final step). You can reset the
setting to one frame by pressing the UI Clear key.
* Set the **Input** settings to the emulated inputs to activate for the step.
- Only non-toggle digital inputs are supported. Select **Add input** to set
- multiple inputs for a step (this option will only appear after you set the
- first input for the initially created step when creating a new macro). If
- the step has multiple inputs, you can highlight an input on the menu and press
- the UI Clear key to delete it (all steps must have at least one input, so you
- can’t delete the only input for a step).
+ Only non-toggle digital inputs and non-wrapping analog inputs are supported.
+ Select **Add input** to set multiple inputs for a step (this option will only
+ appear after you set the first input for the initially created step when
+ creating a new macro). If the step has multiple inputs, you can highlight an
+ input on the menu and press the UI Clear key to delete it (all steps must have
+ at least one input, so you can’t delete the only input for a step).
+* For analog inputs, you can set the desired **Value** that the input should
+ have at each step. You can adjust the value by pressing the UI Left and UI
+ Right keys, or type a numeric value and press the UI Select key to accept the
+ new value. The value will be limited to the valid range for the input.
+ Pressing the UI Clear key will set the default value for the input.
* If the macro has multiple steps, you can select **Delete step** to delete a
step (this options does not appear if the macro only has a single step).
Remember to check that the **On release** and **When held** settings are
@@ -236,3 +241,24 @@ This macro involves steps that activate multiple inputs. The macro will
complete if the activation sequence is released early, allowing you to tap the
key momentarily to perform the move. Holding the activation sequence holds down
the attack button.
+
+Virtua Cop Aim Off-Screen
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This macro allows you to hold a key to simulate pointing the lightgun away from
+the screen:
+
+* **Name**: 1P Aim Off-Screen
+* **Activation combination**: Kbd Alt
+* **On release**: Stop immediately
+* **When held**: Prolong step 1
+* **Step 1**:
+
+ * **Delay (frames)**: 0
+ * **Duration (frames)**: 1
+ * **Input 1**: Lightgun X
+ * **Value (131-630)**: 131
+ * **Input 2**: Lightgun Y
+ * **Value (36-425)**: 36
+
+This macro involves setting analog input values.
diff --git a/plugins/inputmacro/init.lua b/plugins/inputmacro/init.lua
index 9c520f3a503..f5e46df4d91 100644
--- a/plugins/inputmacro/init.lua
+++ b/plugins/inputmacro/init.lua
@@ -2,7 +2,7 @@
-- copyright-holders:Vas Crabb
local exports = {
name = 'inputmacro',
- version = '0.0.1',
+ version = '0.0.2',
description = 'Input macro plugin',
license = 'BSD-3-Clause',
author = { name = 'Vas Crabb' } }
@@ -41,7 +41,7 @@ function inputmacro.startplugin()
local function activate_inputs(inputs)
for index, input in ipairs(inputs) do
if input.field then
- active_inputs[string.format('%s.%d.%d', input.port, input.mask, input.type)] = input.field
+ active_inputs[string.format('%s.%d.%d', input.port, input.mask, input.type)] = { input.field, input.value or 1 }
end
end
end
@@ -94,12 +94,12 @@ function inputmacro.startplugin()
end
end
- for key, field in pairs(active_inputs) do
- field:set_value(1)
+ for key, input in pairs(active_inputs) do
+ input[1]:set_value(input[2])
end
- for key, field in pairs(previous_inputs) do
+ for key, input in pairs(previous_inputs) do
if not active_inputs[key] then
- field:clear_value()
+ input[1]:clear_value()
end
end
end
diff --git a/plugins/inputmacro/inputmacro_menu.lua b/plugins/inputmacro/inputmacro_menu.lua
index 80f1622a424..a76c4e94931 100644
--- a/plugins/inputmacro/inputmacro_menu.lua
+++ b/plugins/inputmacro/inputmacro_menu.lua
@@ -62,8 +62,10 @@ local input_start_field
local function start_input_menu(handler, start_field)
local function supported(f)
- if f.is_analog or f.is_toggle then
+ if f.is_toggle then
return false
+ elseif f.is_analog then
+ return not f.analog_wraps
elseif (f.type_class == 'config') or (f.type_class == 'dipswitch') then
return false
else
@@ -104,7 +106,8 @@ local edit_start_selection
local edit_start_step
local edit_menu_active
local edit_insert_position
-local edit_name_buffer
+local edit_text_item
+local edit_text_buffer
local edit_items
local edit_item_delete
local edit_item_exit
@@ -121,6 +124,25 @@ local function current_macro_complete()
return true
end
+local function set_input_field(input, field)
+ input.port = field.port.tag
+ input.mask = field.mask
+ input.type = field.type
+ input.field = field
+ if field.is_analog then
+ local value = input.value
+ if not value then
+ input.value = field.defvalue
+ elseif value < field.minvalue then
+ input.value = field.minvalue
+ elseif value > field.maxvalue then
+ input.value = field.maxvalue
+ end
+ else
+ input.value = nil
+ end
+end
+
local function handle_edit_items(index, event)
if edit_switch_poller then
if edit_switch_poller:poll() then
@@ -136,58 +158,63 @@ local function handle_edit_items(index, event)
local command = edit_items[index]
- local namecancel = false
- if edit_name_buffer and ((not command) or (command.action ~= 'name')) then
- edit_name_buffer = nil
- namecancel = true
+ local textcancel = false
+ if edit_text_buffer and ((not command) or (edit_text_item ~= index)) then
+ edit_text_buffer = nil
+ textcancel = true
end
if not command then
- return namecancel
+ return textcancel
elseif command.action == 'name' then
local function namechar()
- local ch = tonumber(event)
+ local ch = math.tointeger(event)
if not ch then
return nil
- elseif (ch >= 0x100) or ((ch & 0x7f) >= 0x20) or (ch == 0x08) then
+ elseif (ch >= 0x100) or ((ch & 0x7f) >= 0x20) or (ch == utf8.codepoint('\b')) then
return utf8.char(ch)
else
return nil
end
end
- if edit_name_buffer then
+ if edit_text_buffer then
if event == 'select' then
- if #edit_name_buffer > 0 then
- edit_current_macro.name = edit_name_buffer
+ if #edit_text_buffer > 0 then
+ edit_current_macro.name = edit_text_buffer
end
- edit_name_buffer = nil
+ edit_text_item = nil
+ edit_text_buffer = nil
return true
elseif event == 'back' then
return true -- swallow back while editing text
elseif event == 'cancel' then
- edit_name_buffer = nil
+ edit_text_item = nil
+ edit_text_buffer = nil
return true
else
local char = namechar()
if char == '\b' then
- edit_name_buffer = edit_name_buffer:gsub('[%z\1-\127\192-\255][\128-\191]*$', '')
+ edit_text_buffer = edit_text_buffer:gsub('[%z\1-\127\192-\255][\128-\191]*$', '')
return true
elseif char then
- edit_name_buffer = edit_name_buffer .. char
+ edit_text_buffer = edit_text_buffer .. char
return true
end
end
elseif event == 'select' then
- edit_name_buffer = edit_current_macro.name
+ edit_text_item = index
+ edit_text_buffer = edit_current_macro.name
return true
else
local char = namechar()
if char == '\b' then
- edit_name_buffer = ''
+ edit_text_item = index
+ edit_text_buffer = ''
return true
elseif char then
- edit_name_buffer = char
+ edit_text_item = index
+ edit_text_buffer = char
return true
end
end
@@ -243,10 +270,7 @@ local function handle_edit_items(index, event)
local inputs = edit_current_macro.steps[command.step].inputs
if event == 'select' then
local function hanlder(field)
- inputs[command.input].port = field.port.tag
- inputs[command.input].mask = field.mask
- inputs[command.input].type = field.type
- inputs[command.input].field = field
+ set_input_field(inputs[command.input], field)
end
start_input_menu(hanlder, inputs[command.input].field)
edit_start_selection = index
@@ -257,15 +281,76 @@ local function handle_edit_items(index, event)
return true
end
end
+ elseif command.action == 'inputval' then
+ local function valchar()
+ local ch = math.tointeger(event)
+ if not ch then
+ return nil
+ elseif ((ch >= utf8.codepoint('0')) and (ch <= utf8.codepoint('9'))) or (ch == utf8.codepoint('\b')) then
+ return utf8.char(ch)
+ else
+ return nil
+ end
+ end
+ local input = edit_current_macro.steps[command.step].inputs[command.input]
+
+ if edit_text_buffer then
+ if event == 'select' then
+ local newval = math.tointeger(edit_text_buffer)
+ if newval then
+ local field = input.field
+ input.value = ((newval < field.minvalue) and field.minvalue) or ((newval > field.maxvalue) and field.maxvalue) or newval
+ end
+ edit_text_item = nil
+ edit_text_buffer = nil
+ return true
+ elseif event == 'back' then
+ return true -- swallow back while editing text
+ elseif event == 'cancel' then
+ edit_text_item = nil
+ edit_text_buffer = nil
+ return true
+ else
+ local char = valchar()
+ if char == '\b' then
+ edit_text_buffer = edit_text_buffer:gsub('[%z\1-\127\192-\255][\128-\191]*$', '')
+ return true
+ elseif char then
+ edit_text_buffer = edit_text_buffer .. char
+ return true
+ end
+ end
+ elseif event == 'left' then
+ if input.value > input.field.minvalue then
+ input.value = input.value - 1
+ return true
+ end
+ elseif event == 'right' then
+ if input.value < input.field.maxvalue then
+ input.value = input.value + 1
+ return true
+ end
+ elseif event == 'clear' then
+ input.value = input.field.defvalue
+ return true
+ else
+ local char = valchar()
+ if char == '\b' then
+ edit_text_item = index
+ edit_text_buffer = ''
+ return true
+ elseif char then
+ edit_text_item = index
+ edit_text_buffer = char
+ return true
+ end
+ end
elseif command.action == 'addinput' then
if event == 'select' then
local inputs = edit_current_macro.steps[command.step].inputs
local function handler(field)
- local newinput = {
- port = field.port.tag,
- mask = field.mask,
- type = field.type,
- field = field }
+ local newinput = { }
+ set_input_field(newinput, field)
table.insert(inputs, newinput)
end
start_input_menu(handler)
@@ -344,15 +429,19 @@ local function handle_edit_items(index, event)
end
end
end
- return namecancel, selection
+ return textcancel, selection
end
local function add_edit_items(items)
+ local function edit_text_or(s)
+ return (edit_text_buffer and (edit_text_item == (#items + 1)) and (edit_text_buffer .. '_')) or s
+ end
+
edit_items = { }
local input = manager.machine.input
local arrows
- table.insert(items, { _p('plugin-inputmacro', 'Name'), edit_name_buffer and (edit_name_buffer .. '_') or edit_current_macro.name, '' })
+ table.insert(items, { _p('plugin-inputmacro', 'Name'), edit_text_or(edit_current_macro.name), '' })
edit_items[#items] = { action = 'name' }
if not (edit_start_selection or edit_start_step or edit_menu_active) then
edit_start_selection = #items
@@ -406,6 +495,24 @@ local function add_edit_items(items)
end
table.insert(items, { string.format(_p('plugin-inputmacro', 'Input %d'), j), inputname, '' })
edit_items[#items] = { action = 'input', step = i, input = j }
+
+ if input.field and input.field.is_analog then
+ local field = input.field
+ if not input.value then
+ input.value = field.minvalue
+ end
+ arrows = 'lr'
+ if edit_text_buffer then
+ arrows = ''
+ elseif input.value <= field.minvalue then
+ arrows = 'r'
+ elseif input.value >= field.maxvalue then
+ arrows = 'l'
+ end
+ local valtext = edit_text_or(string.format('%u', input.value))
+ table.insert(items, { string.format(_p('plugin-inputmacro', 'Value (%u-%u)'), field.minvalue, field.maxvalue), valtext, arrows })
+ edit_items[#items] = { action = 'inputval', step = i, input = j }
+ end
end
if step.inputs[#step.inputs].field then
@@ -505,7 +612,7 @@ local function populate_add()
if edit_switch_poller then
return edit_switch_poller:overlay(items, selection, 'lrrepeat')
else
- return items, selection, 'lrrepeat' .. (edit_name_buffer and ' ignorepause' or '')
+ return items, selection, 'lrrepeat' .. (edit_text_buffer and ' ignorepause' or '')
end
end
@@ -530,7 +637,7 @@ local function populate_edit()
if edit_switch_poller then
return edit_switch_poller:overlay(items, selection, 'lrrepeat')
else
- return items, selection, 'lrrepeat' .. (edit_name_buffer and ' ignorepause' or '')
+ return items, selection, 'lrrepeat' .. (edit_text_buffer and ' ignorepause' or '')
end
end
diff --git a/plugins/inputmacro/inputmacro_persist.lua b/plugins/inputmacro/inputmacro_persist.lua
index b8670800fa4..991a2e58a76 100644
--- a/plugins/inputmacro/inputmacro_persist.lua
+++ b/plugins/inputmacro/inputmacro_persist.lua
@@ -37,7 +37,8 @@ local function make_macro(setting)
local ipt = {
port = input.port,
mask = input.mask,
- type = ioport:token_to_input_type(input.type) }
+ type = ioport:token_to_input_type(input.type),
+ value = input.value }
local port = ioport.ports[input.port]
if port then
local field = port:field(input.mask)
@@ -87,7 +88,8 @@ local function make_settings(macros)
local b = {
port = input.port,
mask = input.mask,
- type = ioport:input_type_to_token(input.type) }
+ type = ioport:input_type_to_token(input.type),
+ value = input.value }
table.insert(s.inputs, b)
end
end
diff --git a/plugins/inputmacro/plugin.json b/plugins/inputmacro/plugin.json
index 2d209fca116..33e17be6286 100644
--- a/plugins/inputmacro/plugin.json
+++ b/plugins/inputmacro/plugin.json
@@ -2,7 +2,7 @@
"plugin": {
"name": "inputmacro",
"description": "Input macro plugin",
- "version": "0.0.1",
+ "version": "0.0.2",
"author": "Vas Crabb",
"type": "plugin",
"start": "false"
diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp
index 1e82325e266..fa75c885c6d 100644
--- a/src/emu/emuopts.cpp
+++ b/src/emu/emuopts.cpp
@@ -157,7 +157,6 @@ const options_entry emu_options::s_option_entries[] =
{ OPTION_MULTIMOUSE, "0", core_options::option_type::BOOLEAN, "enable separate input from each mouse device (if present)" },
{ OPTION_STEADYKEY ";steady", "0", core_options::option_type::BOOLEAN, "enable steadykey support" },
{ OPTION_UI_ACTIVE, "0", core_options::option_type::BOOLEAN, "enable user interface on top of emulated keyboard (if present)" },
- { OPTION_OFFSCREEN_RELOAD ";reload", "0", core_options::option_type::BOOLEAN, "convert lightgun button 2 into offscreen reload" },
{ OPTION_JOYSTICK_MAP ";joymap", "auto", core_options::option_type::STRING, "explicit joystick map, or auto to auto-select" },
{ OPTION_JOYSTICK_DEADZONE ";joy_deadzone;jdz(0.00-1)", "0.15", core_options::option_type::FLOAT, "center deadzone range for joystick where change is ignored (0.0 center, 1.0 end)" },
{ OPTION_JOYSTICK_SATURATION ";joy_saturation;jsat(0.00-1)", "0.85", core_options::option_type::FLOAT, "end of axis saturation range for joystick where change is ignored (0.0 center, 1.0 end)" },
diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h
index 8755678b0e5..2d72580a759 100644
--- a/src/emu/emuopts.h
+++ b/src/emu/emuopts.h
@@ -131,7 +131,6 @@
#define OPTION_MULTIMOUSE "multimouse"
#define OPTION_STEADYKEY "steadykey"
#define OPTION_UI_ACTIVE "ui_active"
-#define OPTION_OFFSCREEN_RELOAD "offscreen_reload"
#define OPTION_JOYSTICK_MAP "joystick_map"
#define OPTION_JOYSTICK_DEADZONE "joystick_deadzone"
#define OPTION_JOYSTICK_SATURATION "joystick_saturation"
@@ -429,7 +428,6 @@ public:
float joystick_threshold() const { return float_value(OPTION_JOYSTICK_THRESHOLD); }
bool steadykey() const { return bool_value(OPTION_STEADYKEY); }
bool ui_active() const { return bool_value(OPTION_UI_ACTIVE); }
- bool offscreen_reload() const { return bool_value(OPTION_OFFSCREEN_RELOAD); }
bool natural_keyboard() const { return bool_value(OPTION_NATURAL_KEYBOARD); }
bool joystick_contradictory() const { return m_joystick_contradictory; }
int coin_impulse() const { return m_coin_impulse; }
diff --git a/src/emu/inputdev.cpp b/src/emu/inputdev.cpp
index 0cbe0d58ceb..4ef7538d320 100644
--- a/src/emu/inputdev.cpp
+++ b/src/emu/inputdev.cpp
@@ -284,7 +284,6 @@ input_device::input_device(input_manager &manager, std::string_view name, std::s
, m_internal(internal)
, m_threshold(std::max<s32>(s32(manager.machine().options().joystick_threshold() * osd::input_device::ABSOLUTE_MAX), 1))
, m_steadykey_enabled(manager.machine().options().steadykey())
- , m_lightgun_reload_button(manager.machine().options().offscreen_reload())
{
}
@@ -764,24 +763,8 @@ input_device_switch_item::input_device_switch_item(
s32 input_device_switch_item::read_as_switch(input_item_modifier modifier)
{
- // if we're doing a lightgun reload hack, button 1 and 2 operate differently
- input_device_class devclass = m_device.devclass();
- if (devclass == DEVICE_CLASS_LIGHTGUN && m_device.lightgun_reload_button())
- {
- // button 1 is pressed if either button 1 or 2 are active
- if (m_itemid == ITEM_ID_BUTTON1)
- {
- input_device_item *button2_item = m_device.item(ITEM_ID_BUTTON2);
- if (button2_item != nullptr)
- return button2_item->update_value() | update_value();
- }
-
- // button 2 is never officially pressed
- if (m_itemid == ITEM_ID_BUTTON2)
- return 0;
- }
-
// steadykey for keyboards
+ input_device_class devclass = m_device.devclass();
if (devclass == DEVICE_CLASS_KEYBOARD && m_device.steadykey_enabled())
return m_steadykey;
@@ -1024,15 +1007,6 @@ s32 input_device_absolute_item::read_as_absolute(input_item_modifier modifier)
s32 result = m_device.adjust_absolute(update_value());
assert(result >= osd::input_device::ABSOLUTE_MIN && result <= osd::input_device::ABSOLUTE_MAX);
- // if we're doing a lightgun reload hack, override the value
- if (m_device.devclass() == DEVICE_CLASS_LIGHTGUN && m_device.lightgun_reload_button())
- {
- // if it is pressed, return (min,max)
- input_device_item *button2_item = m_device.item(ITEM_ID_BUTTON2);
- if (button2_item != nullptr && button2_item->update_value())
- result = (m_itemid == ITEM_ID_XAXIS) ? osd::input_device::ABSOLUTE_MIN : osd::input_device::ABSOLUTE_MAX;
- }
-
// positive/negative: scale to full axis
if (modifier == ITEM_MODIFIER_REVERSE)
result = -result;
diff --git a/src/emu/inputdev.h b/src/emu/inputdev.h
index f40320183b8..029de6f78f8 100644
--- a/src/emu/inputdev.h
+++ b/src/emu/inputdev.h
@@ -148,7 +148,6 @@ public:
void *internal() const { return m_internal; }
s32 threshold() const { return m_threshold; }
bool steadykey_enabled() const { return m_steadykey_enabled; }
- bool lightgun_reload_button() const { return m_lightgun_reload_button; }
// setters
void set_devindex(int devindex) { m_devindex = devindex; }
@@ -184,7 +183,6 @@ private:
s32 const m_threshold; // threshold for treating absolute axis as active
bool const m_steadykey_enabled; // steadykey enabled for keyboards
- bool const m_lightgun_reload_button; // lightgun reload hack
};
diff --git a/src/frontend/mame/ui/miscmenu.cpp b/src/frontend/mame/ui/miscmenu.cpp
index 377c34ed2d8..072b8fa3403 100644
--- a/src/frontend/mame/ui/miscmenu.cpp
+++ b/src/frontend/mame/ui/miscmenu.cpp
@@ -268,14 +268,14 @@ void menu_bookkeeping::populate_text(std::optional<text_layout> &layout, float &
// show total time first
prevtime = machine().time();
if (prevtime.seconds() >= (60 * 60))
- layout->add_text(util::string_format(_("Uptime: %1$d:%2$02d:%3$02d\n\n"), prevtime.seconds() / (60 * 60), (prevtime.seconds() / 60) % 60, prevtime.seconds() % 60), color);
+ layout->add_text(util::string_format(_("menu-bookkeeping", "Uptime: %1$d:%2$02d:%3$02d\n\n"), prevtime.seconds() / (60 * 60), (prevtime.seconds() / 60) % 60, prevtime.seconds() % 60), color);
else
- layout->add_text(util::string_format(_("Uptime: %1$d:%2$02d\n\n"), (prevtime.seconds() / 60) % 60, prevtime.seconds() % 60), color);
+ layout->add_text(util::string_format(_("menu-bookkeeping", "Uptime: %1$d:%2$02d\n\n"), (prevtime.seconds() / 60) % 60, prevtime.seconds() % 60), color);
// show tickets at the top
int const tickets = machine().bookkeeping().get_dispensed_tickets();
if (tickets > 0)
- layout->add_text(util::string_format(_("Tickets dispensed: %1$d\n\n"), tickets), color);
+ layout->add_text(util::string_format(_("menu-bookkeeping", "Tickets dispensed: %1$d\n\n"), tickets), color);
// loop over coin counters
for (int ctrnum = 0; ctrnum < bookkeeping_manager::COIN_COUNTERS; ctrnum++)
@@ -286,13 +286,10 @@ void menu_bookkeeping::populate_text(std::optional<text_layout> &layout, float &
// display the coin counter number
// display how many coins
// display whether or not we are locked out
- layout->add_text(
- util::string_format(
- (count == 0) ? _("Coin %1$c: NA%3$s\n") : _("Coin %1$c: %2$d%3$s\n"),
- ctrnum + 'A',
- count,
- locked ? _(" (locked)") : ""),
- color);
+ auto const format = !count
+ ? (locked ? _("menu-bookkeeping", "Coin %1$c: NA (locked)\n") : _("menu-bookkeeping", "Coin %1$c: NA\n"))
+ : (locked ? _("menu-bookkeeping", "Coin %1$c: %2$d (locked)\n") : _("menu-bookkeeping", "Coin %1$c: %2$d\n"));
+ layout->add_text(util::string_format(format, ctrnum + 'A', count), color);
}
lines = layout->lines();
@@ -930,7 +927,7 @@ void menu_machine_configure::setup_bios()
menu_plugins_configure::menu_plugins_configure(mame_ui_manager &mui, render_container &container)
: menu(mui, container)
{
- set_heading(_("Plugins"));
+ set_heading(_("menu-plugins", "Plugins"));
}
menu_plugins_configure::~menu_plugins_configure()
@@ -990,7 +987,7 @@ void menu_plugins_configure::populate()
}
}
if (first)
- item_append(_("No plugins found"), FLAG_DISABLE, nullptr);
+ item_append(_("menu-plugins", "No plugins found"), FLAG_DISABLE, nullptr);
item_append(menu_item_type::SEPARATOR);
}
diff --git a/src/frontend/mame/ui/pluginopt.cpp b/src/frontend/mame/ui/pluginopt.cpp
index 809047357fc..2300301b4fa 100644
--- a/src/frontend/mame/ui/pluginopt.cpp
+++ b/src/frontend/mame/ui/pluginopt.cpp
@@ -33,7 +33,7 @@ menu_plugin::menu_plugin(mame_ui_manager &mui, render_container &container) :
menu(mui, container),
m_plugins(mame_machine_manager::instance()->lua()->get_menu())
{
- set_heading(_("Plugin Options"));
+ set_heading(_("menu-pluginopts", "Plugin Options"));
}
void menu_plugin::populate()
@@ -61,12 +61,14 @@ menu_plugin_opt::menu_plugin_opt(mame_ui_manager &mui, render_container &contain
m_menu(menu),
m_need_idle(false)
{
+ set_needs_prev_menu_item(false);
set_one_shot(one_shot);
}
bool menu_plugin_opt::handle(event const *ev)
{
void *const itemref = ev ? ev->itemref : get_selection_ref();
+ auto const itemrefno = uintptr_t(itemref);
std::string key;
if (ev)
{
@@ -91,6 +93,11 @@ bool menu_plugin_opt::handle(event const *ev)
key = "nextgroup";
break;
case IPT_UI_SELECT:
+ if (!itemrefno)
+ {
+ stack_pop();
+ return false;
+ }
key = "select";
break;
case IPT_UI_DISPLAY_COMMENT:
@@ -116,9 +123,13 @@ bool menu_plugin_opt::handle(event const *ev)
if (key.empty() && !m_need_idle)
return false;
- auto const result = mame_machine_manager::instance()->lua()->menu_callback(m_menu, uintptr_t(itemref), key);
+ auto const result = mame_machine_manager::instance()->lua()->menu_callback(m_menu, itemrefno, key);
if (result.second)
- set_selection(reinterpret_cast<void *>(uintptr_t(*result.second)));
+ {
+ auto const selno(uintptr_t(*result.second));
+ if (selno >= 1)
+ set_selection(reinterpret_cast<void *>(selno));
+ }
if (result.first)
reset(reset_options::REMEMBER_REF);
else if (ev && (ev->iptkey == IPT_UI_BACK))
@@ -176,9 +187,17 @@ void menu_plugin_opt::populate()
++i;
}
item_append(menu_item_type::SEPARATOR);
+ item_append(
+ is_one_shot() ? _("menu-pluginopts", "Close Menu") : _("menu-pluginopts", "Return to Plugin Options Menu"),
+ 0,
+ reinterpret_cast<void *>(uintptr_t(0)));
if (sel)
- set_selection(reinterpret_cast<void *>(uintptr_t(*sel)));
+ {
+ auto const selno(uintptr_t(*sel));
+ if ((sel >= 1U) && (sel < i))
+ set_selection(reinterpret_cast<void *>(uintptr_t(*sel)));
+ }
uint32_t process_flags = 0U;
m_need_idle = false;
diff --git a/src/frontend/mame/ui/state.cpp b/src/frontend/mame/ui/state.cpp
index efbc9e67e98..7b3a01083d1 100644
--- a/src/frontend/mame/ui/state.cpp
+++ b/src/frontend/mame/ui/state.cpp
@@ -218,12 +218,12 @@ void menu_load_save_state_base::populate()
if (m_entries_vec.empty())
{
- item_append(_("[no saved states found]"), FLAG_DISABLE, nullptr);
+ item_append(_("menu-savestate", "[no saved states found]"), FLAG_DISABLE, nullptr);
set_selection(nullptr);
}
item_append(menu_item_type::SEPARATOR);
if (is_one_shot())
- item_append(_("Cancel"), 0, nullptr);
+ item_append(_("menu-savestate", "Cancel"), 0, nullptr);
// get ready to poll inputs
m_switch_poller.reset();
@@ -262,7 +262,7 @@ bool menu_load_save_state_base::handle(event const *ev)
// prompt to confirm delete
m_confirm_delete = &file_entry_from_itemref(ev->itemref);
m_confirm_prompt = util::string_format(
- _("Delete saved state %1$s?\nPress %2$s to delete\nPress %3$s to cancel"),
+ _("menu-savestate", "Delete saved state %1$s?\nPress %2$s to delete\nPress %3$s to cancel"),
m_confirm_delete->visible_name(),
ui().get_general_input_setting(IPT_UI_SELECT),
ui().get_general_input_setting(IPT_UI_BACK));
@@ -399,7 +399,7 @@ bool menu_load_save_state_base::handle_keys(uint32_t flags, int &iptkey)
err.category().name(),
err.value(),
err.message());
- machine().popmessage(_("Error removing saved state file %1$s"), filename);
+ machine().popmessage(_("menu-savestate", "Error removing saved state file %1$s"), filename);
}
// repopulate the menu
@@ -480,7 +480,7 @@ void menu_load_save_state_base::custom_render(uint32_t flags, void *selectedref,
if (selected_item().ref())
{
if (m_delete_prompt.empty())
- m_delete_prompt = util::string_format(_("Press %1$s to delete"), ui().get_general_input_setting(IPT_UI_CLEAR));
+ m_delete_prompt = util::string_format(_("menu-savestate", "Press %1$s to delete"), ui().get_general_input_setting(IPT_UI_CLEAR));
text[count++] = m_delete_prompt;
}
@@ -551,7 +551,7 @@ bool menu_load_save_state_base::is_present(const std::string &name) const
//-------------------------------------------------
menu_load_state::menu_load_state(mame_ui_manager &mui, render_container &container, bool one_shot)
- : menu_load_save_state_base(mui, container, _("Load State"), _("Select state to load"), true, one_shot)
+ : menu_load_save_state_base(mui, container, _("menu-savestate", "Load State"), _("menu-savestate", "Select state to load"), true, one_shot)
{
}
@@ -575,7 +575,7 @@ void menu_load_state::process_file(std::string &&file_name)
//-------------------------------------------------
menu_save_state::menu_save_state(mame_ui_manager &mui, render_container &container, bool one_shot)
- : menu_load_save_state_base(mui, container, _("Save State"), _("Press a key or joystick button, or select state to overwrite"), false, one_shot)
+ : menu_load_save_state_base(mui, container, _("menu-savestate", "Save State"), _("menu-savestate", "Press a key or joystick button, or select state to overwrite"), false, one_shot)
{
}
@@ -589,5 +589,4 @@ void menu_save_state::process_file(std::string &&file_name)
machine().schedule_save(std::move(file_name));
}
-
} // namespace ui
diff --git a/src/frontend/mame/ui/submenu.cpp b/src/frontend/mame/ui/submenu.cpp
index cce1f28eeb2..a753253e3a0 100644
--- a/src/frontend/mame/ui/submenu.cpp
+++ b/src/frontend/mame/ui/submenu.cpp
@@ -88,7 +88,6 @@ std::vector<submenu::option> submenu::advanced_options()
{ option_type::EMU, N_("Multi-mouse"), OPTION_MULTIMOUSE },
{ option_type::EMU, N_("Steadykey"), OPTION_STEADYKEY },
{ option_type::EMU, N_("UI active"), OPTION_UI_ACTIVE },
- { option_type::EMU, N_("Off-screen reload"), OPTION_OFFSCREEN_RELOAD },
{ option_type::EMU, N_("Joystick deadzone"), OPTION_JOYSTICK_DEADZONE },
{ option_type::EMU, N_("Joystick saturation"), OPTION_JOYSTICK_SATURATION },
{ option_type::EMU, N_("Joystick threshold"), OPTION_JOYSTICK_THRESHOLD },