summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/input
Commit message (Collapse)AuthorAgeFilesLines
* -input/input_rawinput.cpp: Properly align buffers for RAWINPUT header Vas Crabb2024-03-071-7/+7
| | | | -jaleco/megasys1.cpp: Clarified comment about MCU program used for chimerab.
* osd/modules/input: Various cleanup and minor enhancements. Vas Crabb2024-03-046-326/+243
| | | | | | | | | | | | | | | | | | | input_common.h: Got rid of the DirectInput key code macros. DirectInput headers are always available on Windows - it's just an opportunity for bygs. input_common.cpp: Added default names for keys mapped to MAME's "other switch" type. input_rawinput.cpp: Simulate Pause key being held for 30ms, similarly to what's done for Caps Lock on macOS with SDL. Also added a gross hack to give "correct" names for Pause and Num Lock. input_sdl.cpp: Get default key names from SDL. Not really that useful as it isn't aware of the current keyboard layout. Key map files are still needed for anything other than a US ANSI layout. Also added some comments.
* input_windows: remove doubled key hap2024-02-161-1/+1
|
* - osd sdl default keys: remove ctrl-blocks on f3 and f4, move opengl filter ↵ hap2024-02-161-7/+8
| | | | | | | from lctrl+f5 to lalt+f10, - osd windows default keys: move post processing key from lctrl+lalt+f5 to lalt+f10, - mame default keys: move rewind step from shit+tilde to shift+f4, move cheat from shift+f6 to shift+f8, move quick save/load from (none) to shift+f6/f7
* Fixed OSD interaction with updated default keys. [R. Belmont] arbee2024-02-131-0/+5
|
* osd/windows: Create single-threaded COM apartment on main thread. Vas Crabb2023-04-081-23/+0
|
* Bump version to 0.253mame0253 Vas Crabb2023-03-301-2/+2
|
* osd/modules/input/input_dinput.cpp: Adjusted heuristics to work better with ↵ Vas Crabb2023-03-292-25/+25
| | | | newer DualShock/DualSense controllers.
* input/input_dinput.h: Work around inability to have stdcall non-capturing ↵ Vas Crabb2023-03-261-4/+8
| | | | lambdas (fixes 32-bit MinGW build).
* osd/modules/input: Always use DirectInput with desktop window in background ↵ Vas Crabb2023-02-281-4/+11
| | | | | | | | | | | | | | | | | | | mode. There are multiple issues with what MAME was doing, but the most glaring is that it violates the DirectInput interface contract that requires the window associated with an open device must not be destroyed. See documentation for IDirectInputDevice8::SetCooperativeLevel: "This parameter must be a valid top-level window handle that belongs to the process. The window associated with the device must not be destroyed while it is still active in a DirectInput device." The previous code also prevented DirectInput controllers from working when using multiple windows if any window other than the first window had focus. Also fixed SDL builds not correctly recognising when all windows lose focus, and save state menu not appearing.
* osd/modules/input: Modernised interface for enumerating DirectInput devices. Vas Crabb2023-02-283-86/+73
| | | | | Gets rid of some state in the winhybrid joystick module that's only used during initialisation.
* osd: Fixed a corner case in XInput DJ Hero turntable handling. Vas Crabb2023-02-251-20/+14
|
* Update accumulating relative inputs exactly once per frame. Vas Crabb2023-02-2410-79/+103
| | | | | | | | | | | | | This fixes "amplification" effects that would happen if the frame rate rose above 100 Hz (whether by unthrottling or otherwise). Synchronise with wall clock any time inputs are read. Not doing this has weird effects on relative inputs with frame skipping and contributes to unresponsiveness of menus. Reduce visual latency for mouse movement on menus when paused or skipping frames. The rest of the code changes to menus won't provide benefits until draw can happen after event handling.
* osd: Cleaner way of dealing with input updates. Vas Crabb2023-02-231-1/+1
|
* osd: Don't pump events when reading inputs. Vas Crabb2023-02-235-28/+2
| | | | | | This was a drain on performance. If anything is trying to poll inputs in a loop, it needs to call input_update() to ensure it gets up-to-date state.
* Input refactoring: Vas Crabb2023-02-1810-345/+3360
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* -osd/windows/winutil.cpp: Better way to get module handle. Vas Crabb2023-02-121-1/+1
| | | | | | | * This was leftover support for Windows 2000 and earlier that hadn't been cleaned up. -atari: Don't forget your #include guards!
* Small batch of input refactoring: Vas Crabb2023-02-058-36/+104
| | | | | | | | | | | | | | | | | | | | | emu/input.cpp: Fixed regression in display of some joystick inputs. osd/interface: Split up interface classes into a few more files to reduce where the input device interface class needs to be included. Made OSD independent of concrete input_device class. osd/modules/input, emu/inputdev.cpp, emu/ioport.cpp: Allow input devices to provide tokens for controls without standard item types and additional default input assignments. Fixes issues assigning Yen and Backslash on Japanese keyboards. ui/textbox.cpp: Added a fixed-content text box menu class for future use. Got main.h out of emu.h as it’s only used in a very small number of places, mostly for getting the application name. Added eminline.h to attotime.h as it's used without emu.h. Cleaned up forward declarations in emufwd.h a little.
* osd: Don't swallow text input with -keyboardprovider win32 (addresses GitHub ↵ Vas Crabb2023-02-031-1/+1
| | | | #7911).
* Use EQUIVALENT_ARRAY to avoid issues with std::size on member arrays, enable ↵ Vas Crabb2023-02-011-6/+3
| | | | warnings for VLAs in C++.
* osd/tools: msvc fixes Patrick Mackinlay2023-02-011-0/+1
| | | | | * xinput.h depends on windows.h * avoid use of non-standard variable-length arrays
* osd: Turned video modules into actual modules, fixed various issues. Vas Crabb2023-02-013-12/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't ignore the return status of OSD module initialisation. Attempt to fall back to an alternate module if the selected module fails to initialise. Log more useful diagnostic information at verbose level. Fixed BGFX crash on exit after toggling fullscreen. Also persist more settings than just the selected chains across toggling fullscreen. Turned video modules into OSD modules in the same sense as all the other OSD modules. They now use the same selection/fallback mechanism as all the other modules without special extra code in the OSD implementations. Untangled some object ownership mess. Windows own renderers, OSD objects own windows. Fixed a refrence loop that caused the first window object to always leak. Don't create renderer object until after underlying window has been created. Fixed issues with order of creation/destruction when toggling fullscreen or changing prescale in fullscreen with -switchres in SDL builds. Use more smart pointers in BGFX and Direct3D render modules. Most of the code now reutrns a smart pointer when handing over ownership or a naked pointer when retaining ownership. Fixed a few leaks and simplified cleanup code. Encapsulated various OSD modules better.
* osd/modules/input: Fixed Linux build. Vas Crabb2023-01-292-3/+1
|
* Various input and OSD refactoring: Vas Crabb2023-01-2919-2761/+2415
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | osd: Supply OSD object to modules on initialisation. Encapsulated some event handling in the OSD objects rather than leaving it in free functions. Put various stuff in namespaces. osd/modules/input: Enabled dinput, xinput and winhybrid modules for Windows SDL builds, and enabled background input for dinput and xinput (and by extension winhybrid) modules. Also fixed some COM and X11 resource leaks. osd/modules/input/input_sdl.cpp: Flipped SDL mouse button order to match Windows, and exposed vertical and horizontal scroll as Z and rZ axes. Moved SDL UI event handling out of input devices into OSD object. osd/modules/input_rawinput.cpp: Changed lightgun Z axis token so it's correctly identified as a relative axis (it maps to the scroll wheel equivalent). osd: Added an option to choose the network provider module. Mostly useful if you build with both TUN/TAP and pcap support included, or if you want to disable emulated networking completely. emu/input.cpp: Use a better strategy for assembling input code names that uses fewer temporary strings and doesn't require use of the non-Unicode-aware space trimming function (fixes MT08552). osd/modules/input_dinput.cpp: Improved polling logic. osd: Made various parts of the input code less dependent on concrete emu objects, and reduced inappropriately passing around the machine object. Made input modules less dependent on OSD implementation. Encapsulated some stuff and got rid of some vestigial newui and SDL1 support code. Cleaned up some interfaces. Moved OSD options classes to their own files. Prepare to remove main.h from emu.h - it's mostly used to get the application name, which the vast majority of emulated devices don't need to do.
* Miscellaneous fixes and refactoring: Vas Crabb2023-01-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ui/analogipt.cpp: Fixed bar graph display for fields with ranges that wrap through zero. emu/inputdev.cpp: Separateed analog axis deadzone and switch threshold settings, reduced default deadzone, and fixed a potential division by zero if the deadzone and saturation settings are equal. emu/ioport.cpp: Fixed behaviour of absolute analog fields where range passes through zero - it previously only worked for specific combinations of mask, minimum and default. Removed a workaround from universal/getaway.cpp that is no longer necessary. emu/input.cpp: Fixed unintuitive behaviour when an absolute field is assigned an OR combination of a relative control folled by an absolute control (e.g. Mouse X or Joy 1 LSX). Also fixed reading axis input sequences where an axis code is followed by a switch code (these can only be produced by manually editing configuration files, not through MAME's UI), and fixed the returned type when multiple relative axes sum to zero. osd/modules/input_dinput.cpp: Fixed hat switches being stuck in up position when input is suspended in the background taito/taitoio_yoke.cpp: Give throttle control a distinct type, and don't auto-centre. osd: Added option to select MIDI provider module (currently only PortMidi and the dummy module are available). Also put various things in namespaces, and fixed builds including SDL sound module with native Windows OSD. emu/validity.cpp: Added check to catch I/O port fields using UI input types. emu/inpttype.ipp: Renamed inputs that were causing confusion. "Bill" and "Track" were causing confusion for translators and hence likely causing confusion for many users, especially those who are not native English speakers. "Track" as an abbreviation for "Trackball" was frequently being mistranslated, e.g. in the sense of a CD track selection button or even in the sense of a railway track. There's no reason to abbreviate it. "Bill" in the US English sense as a banknote is too ambiguous and was causing confusion for translators. It's better to use the less ambiguous "Banknote". Corrected Greek translations of "Trackball". Don't run GitHub Actions on issue template changes.
* osd: Better scaling factors for XInput DJ Hero turntable dials. [DarkMoS] Vas Crabb2023-01-191-2/+2
|
* osd: Still more XInput rhythm game controller support for Windows: Vas Crabb2023-01-183-64/+317
| | | | | | * Added support for DJ Hero turntable controller. * Added support for Rock Band keyboard controller pedal. * Fixed pickup selector switch on guitar controllers.
* osd: Better XInput rhythm game controller support on Windows: Vas Crabb2023-01-181-54/+335
| | | | | | * Better support for extended controller type information. * Support for velocity sensitive six-drum controller. * Don't ignore button capabilites for keyboard controller.
* osd: Improved XInput guitar support and added XInput Rock Band keyboard support. Vas Crabb2023-01-181-217/+780
|
* osd: Added support for guitar and drum kit controllers via XInput. Vas Crabb2023-01-172-28/+102
|
* osd: Work around another observed invalid XInput capabilities report. Vas Crabb2023-01-151-2/+14
|
* -debugger/win: Cascade positions of new debugger windows. Vas Crabb2023-01-151-1/+29
| | | | | -osd: Better button names for NVIDIA Shield and Xbox One controllers with SDL game controller module.
* osd: I am officially incapable of keeping track of which OSD I'm working ↵ Vas Crabb2023-01-141-2/+2
| | | | with on each change (fix SDL build).
* osd: Added option to accept SDL game controller/joystick input when losing ↵ Vas Crabb2023-01-142-6/+11
| | | | UI focus.
* Hopefully fix SDL version detection macros for controller types. Vas Crabb2023-01-141-1/+5
|
* osd: Fixed constant name (helps to build the right OSD). Vas Crabb2023-01-141-3/+3
|
* osd: Recognise Joy-Con pairs with sdlgame input module. Vas Crabb2023-01-141-11/+16
|
* osd: Work around bad XInput capabilities report from Retro-Bit Saturn pad. Vas Crabb2023-01-141-7/+34
|
* osd: Added support for mapping files to sdlgame joystick provider and made ↵ Vas Crabb2023-01-142-8/+58
| | | | | | | | | | | | | | | | | it default with SDL. This changes behaviour, however I think it's a net positive: * Most games using Steam Input or SDL2 to read game controllers have this behaviour, so users have come to expect it. * This module is better at giving meaningful names to buttons on common controller, and assigning axes consistently. * Button/axis mapping files using a widely-used format are supported. * The old behaviour is still available with `-joystickprovider sdljoy` if anyone wants it. The new option for controller mapping files is in the general OSD options rather than SDL options as it can be extended to DirectInput in the future.
* -osd: Improved SDL Game Controller joystick provider: Vas Crabb2023-01-131-177/+374
| | | | | | | | | * Allow fallback to joystick API for devices without game controller mappings. * Detect controller reconnection. * Force Switch Pro Controller ZL/ZR to act like buttons. * Added button names for Google Stadia controller. * Also fixed dumb copy/paste error on my part in Windows clipboard code.
* osd: Fixed names of DualSense controller buttons with SDL Game Controller ↵ Vas Crabb2023-01-131-3/+30
| | | | provider.
* osd: Fixed names of face buttons on Switch Pro Controller with SDL Game ↵ Vas Crabb2023-01-131-2/+2
| | | | Controller provider.
* osd: Include mapping string in verbose output when enumerating SDL game ↵ Vas Crabb2023-01-131-1/+11
| | | | controllers.
* -osd: Better XInput and SDL game controller input enhancements: Vas Crabb2023-01-125-428/+1369
| | | | | | | | | | | | | | | * Added initial support for XInput controller subtypes, starting with driving, arcade and flight controllers. * Check XInput capabilities to ignore buttons and hats that aren't present. * Added preliminary SDL Game Controller joystick provider. Reconnection and mixed Game Controller/Joystick devices are unsupported. * Show the input token for the highlighted control on input device menus. -ui: Allow menus to set required space above and below menu when metrics change. Fixes the initial bad layout on the system selecton menu, or bad layout after resizing windows.
* -Input code cleanup: Vas Crabb2023-01-102-27/+56
| | | | | | | | | | | | | * dinput, xinput: Use proper item IDs for hat switches rather than "other switch". * xinput: Map right thumb stick to Z/rZ for consistency with SDL and DirectInput. * xinput: Map triggers to additional absolute axes 1 and 2. * xinput: Map start and back buttons to start and select. * Added default assignments for player 5-10 start/select. * Added default assignments for 5P-8P start and coin 5-8. -namco/namcos2.cpp: Changed collective pitch control to AD Stick Z.
* Patched up some gaps in functionality and fixed some bugs. Vas Crabb2022-09-022-27/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ui: Added some missing functionality: * Added an option to copy input device IDs to the relevant menus. * Added an item for setting the software lists files path (-hashpath) to the folder setup menu. * Allow pasting text from clipboard in most places that allow typing (searching, entering filenames, entering barcodes). * Changed the software selection menu heading to be a bit less misleading. * Made barcode menu less eager to rebuild itself unnecessarily, and removed some confusing and apparently pointless code. Exposed more Lua bindings: * Added low-level palette objects. * Added indexed bitmap types. * Added a bitmap method for extracting pixels from a rectangular area as a packed binary string. * Changed screen device pixels method to return width and height in addition to the pixels. osd: Added some functionality and cleaned up a little: * Added a function for copying text to the clipboard. * Moved function for converting Windows error codes to standard error conditions to winutil.cpp so it can be used from more places. * Removed duplicate declaration of osd_get_clipboard_text and made the function noexcept (including fixing implementations). * Made macOS implementation of osd_get_clipboard_text skip the encoding conversion if it finds UTF-8 text first. * Changed the default -uimodekey setting so it doesn't lose the "not shift" that stops the default from interfering with UI paste. Various bug fixes: * util/unicode.cpp: Fixed the version of utf8_from_uchar that returns std::string blowing up on invalid codepoints. * util/bitmap.h: Fixed wrapping constructors for indexed bitmaps taking the wrong parameter type (nothing was using them before). * util/bitmap.cpp: Fixed potential use-after-free issues with bitmap palettes. * emu/input.cpp, emu/inputdev.cpp: Log 1-based device numbers, matching what's shown in the internal UI and used in tokens in CFG files. * emu/emumem.cpp: Added the bank tag to a fatal error message where it was missing. docs: Reworked and expanded documentation on configuring stable controller IDs. For translators, the changes are quite minor: * There's a menu item for copying a device ID to the clipboard, and associated success/failure messages. * There's the menu item for setting the software list file search path. * One of the lines in the software selection menu heading has changes as it could be interpreted as implying it showed a software list name.
* osd/modules/input: Include device serial number in ID when available for SDL ↵ Vas Crabb2022-08-191-7/+10
| | | | joysticks.
* osd/sdl: Removed keyboard/mouse/joystick device mapping options. Vas Crabb2022-07-151-75/+17
| | | | | | | | | The keyboard and mouse device mapping options did nothing at all, mostly because of lack of support for separating inputs from multiple devices. The joystick options were useless when you have two of the same kind of controller, and you can achieve the same thing with controller configuration files.
* input_sdlcommon.cpp: Move devmap_init down into class AJR2022-06-184-50/+56
|
* Optimisation, and baby steps towards untangling stuff: Vas Crabb2022-06-166-71/+78
| | | | | | | | | | Optimised the scheduler's handling of unscheduled timers - gives a 50% performance improvement in some timer-heavy drivers. Added better endianness swizzling helpers. Got rid of some of the OSD input modules' dependence on concrete input classes from emu.