From 300206e308c2c5f9ad8898fb62f1873be682df5a Mon Sep 17 00:00:00 2001 From: feos Date: Sun, 27 Feb 2022 18:12:25 +0300 Subject: Lua engine: Make setting analog I/O port field values user-friendly. (#9322) Exposed minimum/maximum values for analog fields. together with defvalue, they can be used to check range of values and neutral position. Previously you had to send a normalised value between -65535 and 65535 which would be scaled depending on machine specifics. You could read the scaled value from the port, but you couldn't send scaled values in. This allows scripts to set scaled values as seen by the machine. --- docs/source/techspecs/luareference.rst | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'docs/source/techspecs') diff --git a/docs/source/techspecs/luareference.rst b/docs/source/techspecs/luareference.rst index 68704b95951..bc896c34ebc 100644 --- a/docs/source/techspecs/luareference.rst +++ b/docs/source/techspecs/luareference.rst @@ -1962,7 +1962,7 @@ Wraps MAME’s ``ioport_field`` class, representing a field within an I/O port. Instantiation ^^^^^^^^^^^^^ -manager.machine.ioport.ports[tag]:field[mask] +manager.machine.ioport.ports[tag]:field(mask) Gets a field for the given port by bit mask. manager.machine.ioport.ports[tag].fields[name] Gets a field for the given port by display name. @@ -1974,6 +1974,9 @@ field:set_value(value) Set the value of the I/O port field. For digital fields, the value is compared to zero to determine whether the field should be active; for analog fields, the value must be right-aligned and in the correct range. +field:clear_value() + Clear programmatically overridden value and restore the field’s regular + behaviour. field:set_input_seq(seqtype, seq) Set the :ref:`input sequence ` for the specified sequence type. This is used to configure per-machine input @@ -2018,9 +2021,13 @@ field.player (read-only) field.mask (read-only) Bits in the I/O port corresponding to this field. field.defvalue (read-only) - The field’s default value + The field’s default value. +field.minvalue (read-only) + The minimum allowed value for analog fields, or nil for digital fields. +field.maxvalue (read-only) + The maximum allowed value for analog fields, or nil for digital fields. field.sensitivity (read-only) - The sensitivity or gain for analog fields + The sensitivity or gain for analog fields. field.way (read-only) The number of directions allowed by the restrictor plate/gate for a digital joystick, or zero (0) for other inputs. -- cgit v1.2.3-70-g09d2