Skip to content

Commit f91b896

Browse files
committed
input/input_sdl.cpp: Added an SDL lightgun provider.
This does essentially the same thing as the Win32 lightgun provider, mapping the absolute pointer position over the window to gun axes. Also added a bunch of const in the windows input handling code. docs: Bumped version, as features that are not in a releaesd version of MAME are now documented.
1 parent 3b618bd commit f91b896

14 files changed

+426
-126
lines changed

docs/source/commandline/commandline-all.rst

+31-40
Original file line numberDiff line numberDiff line change
@@ -775,24 +775,24 @@ OSD-related Options
775775
* - **Microsoft Windows**
776776
- win
777777
- dwrite
778-
- none
779778
- auto
780779
-
781-
- sdl [#UIFPSDLWindows]_.
780+
- sdl [#UIFPSDLWindows]_
781+
- none
782782
* - **macOS**
783783
-
784784
-
785-
- none
786785
- auto
787786
- osx
788787
- sdl
788+
- none
789789
* - **Linux**
790790
-
791791
-
792-
- none
793792
- auto
794793
-
795794
- sdl
795+
- none
796796
797797
.. rubric:: Footnotes
798798
@@ -816,26 +816,19 @@ Example:
816816
:stub-columns: 0
817817
818818
* - **Microsoft Windows**
819-
- auto [#KBIPAutoWindows]_.
819+
- auto [#KBIPAutoWindows]_
820820
- rawinput
821821
- dinput
822822
- win32
823+
- sdl [#KBIPSDLWindows]_
823824
- none
824-
- sdl [#KBIPSDLWindows]_.
825825
* - **SDL (macOS and Linux)**
826-
- auto [#KBIPAutoSDL]_.
826+
- auto [#KBIPAutoSDL]_
827827
-
828828
-
829829
-
830-
- none
831830
- sdl
832-
* - **Linux**
833-
- auto [#KBIPAutoSDL]_.
834-
-
835-
-
836-
-
837831
- none
838-
- sdl
839832
840833
.. rubric:: Footnotes
841834
@@ -868,26 +861,19 @@ Example:
868861
:stub-columns: 0
869862
870863
* - **Microsoft Windows**
871-
- auto [#MIPAutoWindows]_.
864+
- auto [#MIPAutoWindows]_
872865
- rawinput
873866
- dinput
874867
- win32
868+
- sdl [#MIPSDLWindows]_
875869
- none
876-
- sdl [#MIPSDLWindows]_.
877870
* - **SDL (macOS and Linux)**
878-
- auto [#MIPAutoSDL]_.
871+
- auto [#MIPAutoSDL]_
879872
-
880873
-
881874
-
882-
- none
883875
- sdl
884-
* - **Linux**
885-
- auto [#MIPAutoSDL]_.
886-
-
887-
-
888-
-
889876
- none
890-
- sdl
891877
892878
.. rubric:: Footnotes
893879
@@ -916,36 +902,37 @@ Example:
916902
:stub-columns: 0
917903
918904
* - **Microsoft Windows**
919-
- auto [#LGIPAutoWindows]_.
905+
- auto [#LGIPAutoWindows]_
920906
- rawinput
921907
- win32
922-
- none
923-
-
908+
- sdl [#LGIPSDLWindows]_
924909
-
910+
- none
925911
* - **macOS**
926-
- auto [#LGIPAutoSDL]_.
912+
- auto [#LGIPAutoSDL]_
927913
-
928914
-
929-
- none
930-
-
915+
- sdl
931916
-
917+
- none
932918
* - **Linux**
933-
- auto [#LGIPAutoLinux]_.
919+
- auto [#LGIPAutoSDL]_
934920
-
935921
-
936-
- none
937-
-
922+
- sdl
938923
- x11
924+
- none
939925
940926
.. rubric:: Footnotes
941927
942928
.. [#LGIPAutoWindows] On Windows, auto will try ``rawinput`` with fallback to
943929
``win32``, or ``none`` if it doesn't find any.
944930
945-
.. [#LGIPAutoSDL] On non-Linux SDL, ``auto`` will default to ``none``.
931+
.. [#LGIPSDLWindows] SDL support on Windows requires that you compile MAME with
932+
the support in. By default SDL is not included in Windows
933+
builds of MAME.
946934
947-
.. [#LGIPAutoLinux] On SDL/Linux, ``auto`` will default to ``x11``, or ``none``
948-
if it doesn't find any.
935+
.. [#LGIPAutoSDL] On SDL, ``auto`` will default to ``sdl``.
949936
950937
Example:
951938
.. code-block:: bash
@@ -964,15 +951,15 @@ Example:
964951
:stub-columns: 0
965952
966953
* - **Microsoft Windows**
967-
- auto [#JIPAutoWindows]_.
954+
- auto [#JIPAutoWindows]_
968955
- winhybrid
969956
- dinput
970957
- xinput
971-
- sdlgame
972-
- sdljoy
958+
- sdlgame [#JIPSDLWindows]_
959+
- sdljoy [#JIPSDLWindows]_
973960
- none
974961
* - **SDL**
975-
- auto [#JIPAutoSDL]_.
962+
- auto [#JIPAutoSDL]_
976963
-
977964
-
978965
-
@@ -984,6 +971,10 @@ Example:
984971
985972
.. [#JIPAutoWindows] On Windows native, auto will default to ``winhybrid``.
986973
974+
.. [#JIPSDLWindows] SDL support on Windows requires that you compile MAME with
975+
the support in. By default SDL is not included in Windows
976+
builds of MAME.
977+
987978
.. [#JIPAutoSDL] On SDL, auto will default to ``sdlgame``.
988979
989980
winhybrid

docs/source/commandline/commandline-index.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,12 @@ SDL Keyboard Mapping
423423
| :ref:`keymap_file <mame-scommandline-keymapfile>`
424424
425425

426-
SDL Joystick Mapping
426+
SDL Input Options
427427
~~~~~~~~~~~~~~~~~~~~
428428

429-
| :ref:`sixaxis <mame-scommandline-sixaxis>`
429+
| :ref:`[no]enable_touch <mame-scommandline-enabletouch>`
430+
| :ref:`[no]sixaxis <mame-scommandline-sixaxis>`
431+
| :ref:`[no]dual_lightgun <mame-scommandline-duallightgun>`
430432
431433

432434
SDL Lightgun Mapping

docs/source/commandline/sdlconfig.rst

+17
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,23 @@ SDL Input Options
8080
undesirable behaviour with other controllers. Only affects the ``sdljoy``
8181
joystick provider. Default is OFF (**-nosixaxis**)
8282

83+
.. _mame-scommandline-duallightgun:
84+
85+
**-[no]dual_lightgun** / **-[no]dual**
86+
87+
Controls whether or not MAME attempts to track two lightguns that appear as
88+
a single mouse. This option requires the :ref:`lightgun option
89+
<mame-commandline-nolightgun>` to be on and the :ref:`lightgunprovider
90+
option <mame-commandline-lightgunprovider>` to be set to *sdl*.
91+
92+
This option supports dual lightgun setups that work by setting the mouse
93+
pointer location at the moment a lightgun trigger is activated. The primary
94+
and secondary triggers on the first lightgun correspond to the first and
95+
second mouse buttons, and the primary and secondary triggers on the second
96+
lightgun correspond to the third and fourth mouse buttons.
97+
98+
The default is OFF (**-nodual_lightgun**).
99+
83100

84101
SDL Lightgun Mapping
85102
--------------------

docs/source/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@
6363
# built documents.
6464
#
6565
# The short X.Y version.
66-
version = '0.265'
66+
version = '0.266'
6767
# The full version, including alpha/beta/rc tags.
68-
release = '0.265'
68+
release = '0.266'
6969

7070
# The language for content autogenerated by Sphinx. Refer to documentation
7171
# for a list of supported languages.

src/osd/modules/input/input_rawinput.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -749,14 +749,14 @@ class rawinput_module : public wininput_module<rawinput_device>
749749
rawinputdevice.hDevice);
750750
}
751751

752-
virtual bool handle_input_event(input_event eventid, void *eventdata) override
752+
virtual bool handle_input_event(input_event eventid, void const *eventdata) override
753753
{
754754
switch (eventid)
755755
{
756756
// handle raw input data
757757
case INPUT_EVENT_RAWINPUT:
758758
{
759-
HRAWINPUT const rawinputdevice = *static_cast<HRAWINPUT *>(eventdata);
759+
HRAWINPUT const rawinputdevice = *reinterpret_cast<HRAWINPUT const *>(eventdata);
760760

761761
union { RAWINPUT r; BYTE b[4096]; } small_buffer;
762762
std::unique_ptr<BYTE []> larger_buffer;
@@ -786,7 +786,7 @@ class rawinput_module : public wininput_module<rawinput_device>
786786
{
787787
std::lock_guard<std::mutex> scope_lock(m_module_lock);
788788

789-
auto *input = reinterpret_cast<RAWINPUT *>(data);
789+
auto *const input = reinterpret_cast<RAWINPUT const *>(data);
790790
if (!input->header.hDevice)
791791
return false;
792792

@@ -809,7 +809,7 @@ class rawinput_module : public wininput_module<rawinput_device>
809809

810810
case INPUT_EVENT_ARRIVAL:
811811
{
812-
HRAWINPUT const rawinputdevice = *static_cast<HRAWINPUT *>(eventdata);
812+
HRAWINPUT const rawinputdevice = *reinterpret_cast<HRAWINPUT const *>(eventdata);
813813

814814
// determine the length of the device name, allocate it, and fetch it if not nameless
815815
UINT name_length = 0;
@@ -842,7 +842,7 @@ class rawinput_module : public wininput_module<rawinput_device>
842842

843843
case INPUT_EVENT_REMOVAL:
844844
{
845-
HRAWINPUT const rawinputdevice = *static_cast<HRAWINPUT *>(eventdata);
845+
HRAWINPUT const rawinputdevice = *reinterpret_cast<HRAWINPUT const *>(eventdata);
846846

847847
std::lock_guard<std::mutex> scope_lock(m_module_lock);
848848

0 commit comments

Comments
 (0)