summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/input.h
Commit message (Collapse)AuthorAgeFilesLines
* Small batch of input refactoring: Vas Crabb2023-02-051-0/+1
| | | | | | | | | | | | | | | | | | | | | 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.
* Optimisation, and baby steps towards untangling stuff: Vas Crabb2022-06-161-915/+9
| | | | | | | | | | 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.
* -Enabled complex combinations for analog axes: Vas Crabb2021-11-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | * Made it possible to add digital controls to axis settings as enables. * Mix multiple analog controls assigned to an axis setting. * Added a "reverse" modifier for analog controls (useful with mixing). * Fixed an issue assigning mouse axes using multiple mouse-like devices with -nomultimouse. -frontend: More cleanup: * Got rid of some abuse of "special main menus". * Added a helper class for auto-pause menus that don't spawn submenus. * Got rid of the fake menu that schedules an exit on the first frame. * Turned the confirm quit prompt into a menu, eliminated one more special-cased event loop. * Fixed the confirm quit prompt resuming if you return to emulation if you weren't paused to begin with. -bus/centronics: Fixed conflicting DIP locations, reversed order and inverted polarity for Epson printers. * Also added the LX-810 (without L suffix) DIP switches for reference - we don't have a device for this printer yet.
* Slightly cleaned up OSD input modules. Vas Crabb2021-07-291-4/+4
| | | | | | | | | | Removed support for DirectInput 7 and earlier. It hasn't been tested in years, and it's not relevant on any supported OS. DirectInput is effectively finalised at version 8, and is unlikely to get an API update in the future. Use more string[_view] and fewer C strings, and tightened up scope of a few things.
* API cleanups and miscellaneous fixes. Vas Crabb2021-07-151-1/+1
| | | | | | | | | | | | | | | | emu/ioport.cpp: Allow controller files to override input sequences for inputs that don't use defaults, and to override the toggle setting for digital inputs. emu/config.cpp: Expose configuration level (mostly matters for controller files), improved verbose diagnostic messages, and moved a few things out of the global and preprocessor namespaces. docs: Added documentation for some controller configuration file features. The device mapping feature documentation will be merged in at some point. util/unicode.cpp, emu/input.cpp: API cleanups.
* input.cpp, inputdev.cpp: Convert a few more functions to use std::string_view AJR2021-02-031-2/+2
|
* -Lua cleanup and documentation migration checkpoint. Vas Crabb2020-12-161-6/+1
| | | | | | | | | | | | | | | | | | | | * Cleaned up some more of the Lua inteface. Mostly replacing methods with properties, some consistency fixes, a few renames, some more exposed functionality, and a couple of properties that have no business being set from scripts made read-only. * Moved a lot more Lua documentation out of source comments into the documentation, and expanded on it in the process. * Got more UI code out of the input manager. * Changed input sequence poller to a polymorphic class where you specify your intention upfront. * Changed the cheat plugin to use UI Clear to clear hotkey assignments and leave them unchanged if the user starts assignment but doesn't press any switches. * Ported AJR's fix for over-eager double-click recognition from SDL to Windows OSD. -goldnpkr.cpp: Cleaned up inputs, using standard keyout and payout types and key assignments.
* Move axis movement checking code down into input devices AJR2020-08-301-8/+0
|
* I give up, can't keep all the compilers happy (nw) Vas Crabb2019-11-211-3/+4
|
* constexpr, constructor delegation, integer_sequence, oh my! (hopefully fix ↵ Vas Crabb2019-11-211-8/+7
| | | | MSVC build) (nw)
* add <cassert,map,memory,string> for completeness, even though it will arrive ↵ Vas Crabb2019-11-211-0/+4
| | | | some other way (nw)
* fix clang build (nw) Vas Crabb2019-11-211-1/+5
|
* UI input mapping menu updates: Vas Crabb2019-11-211-48/+83
| | | | | | | | | | | | | | | | | | | | | | * When a switch-type input is selected, show feedback when it's pressed * If an invalid code is entered (e.g. only negatives) abandon the change rather than cycling default/none * If an invalid code is entered display a message until the user takes some other action input.cpp updates: * constexpr crusade on input_code and input_seq and some very slight optimisation to input_seq * seq_poll* is a frontend function and had no business being in the core, so it's a utility class now * seq_poll* now exposes a bit more detail, enabling improved interaction on the UI inputs menu * global state is reduced a little, but the poll_* functions are still members of the input manager with global state (nw) The Lua engine has been updated in a way that maintains source compatibility with existing Lua scripts. This is less than ideal, but it minimises impact. Ideally someone (possibly me) will be able to expose the input sequence poller helper properly. I tested the changes with the cheat and autofire plugins and I was able to assign sequences. However I found two issues: it's seems impossible to assign a more complex sequence than a single key/button in the autofire plugin (i.e. no AND or NOT conditions, I confirmed this is pre-existing, not a regression), and in both the cheat and autofire plugins I found it a bit unwieldy trying to enter a complex sequence without live feedback of the sequence as it's built (this was also applicable to MAME's own input mapping menu until I added the live display yesterday).
* Extracting input sequence cleaning logic into an seq_clean() function npwoods2019-08-211-0/+1
| | | | and exposing to LUA
* Make "Keypad ," and "Keypad =" standard keys AJR2018-05-111-0/+6
|
* input: make xinput analog triggers half-axes and default IPT_PEDAL2 to RZ- ↵ hap2017-10-171-0/+10
| | | | instead of Z+, placing IPT_PEDAL and IPT_PEDAL2 on separate axes. (nw)
* convenience macro for enum bitwise operators (nw) Vas Crabb2017-07-221-2/+2
|
* general cleanup: Vas Crabb2017-05-231-7/+1
| | | | | | | | | | | * move rarely-used output and pty interfaces out of emu.h * consolidate and de-duplicate forward declarations, also remove some obsolete ones * clean up more #include guard macros * scope down a few more things (nw) Everyone, please keep forward declarations for src/emu in src/emu/emufwd.h - this will make it far easier to keep them in sync with declarations than having them scattered through all the other files.
* Introduce u8/u16/u32/u64/s8/s16/s32/s64 Vas Crabb2016-11-191-15/+15
| | | | | | | | | | | | * New abbreviated types are in osd and util namespaces, and also in global namespace for things that #include "emu.h" * Get rid of import of cstdint types to global namespace (C99 does this anyway) * Remove the cstdint types from everything in emu * Get rid of U64/S64 macros * Fix a bug in dps16 caused by incorrect use of macro * Fix debugcon not checking for "do " prefix case-insensitively * Fix a lot of messed up tabulation * More constexpr * Fix up many __names
* Polymorphize input_device and input_class; move to separate source file (nw) AJR2016-10-241-235/+4
|
* NOTICE (TYPE NAME CONSOLIDATION) Miodrag Milanovic2016-10-221-29/+29
| | | | | Use standard uint64_t, uint32_t, uint16_t or uint8_t instead of UINT64, UINT32, UINT16 or UINT8 also use standard int64_t, int32_t, int16_t or int8_t instead of INT64, INT32, INT16 or INT8
* Misc. keyboard input improvements AJR2016-10-081-0/+12
| | | | | | | | - Add BS, Tab, 00, 000 keys common on add-on keypads as input items; SDL may recognize these, but DirectInput does not - Assign Keypad 00 and Keypad 000 in several drivers' input lists - Add SDL keycode for "cancel" key - Add keypad keys as alternates to natural keyboard - Move has_keyboard() out of the core; enabled() test is unnecessary now that all optional keyboards are slot devices (nw)
* Adding id() property to input_device Tomer Verona2016-09-201-4/+6
| | | | | | | | | | | | This change adds id() property to input_device, which represents the unique device id. This allows the osd layer when creating a device to pass a friendly display name along with a unique identifier. Currently the device id is only used to map a physical controller device to controller id, but can be used more generally in the future. For raw input devices, we use the full raw input name as the device id. For all other devices, we fall back to device name as the device id. The "uniqueness" of the device id is not currently enforced in code.
* Support for configuring device to conrtoller id Tomer Verona2016-09-121-0/+8
| | | | | | | | This change adds support for configuring device to conrtoller id. This allows for stable controller ids even if USB devices are plugged / unplugged, system is rebooted, etc. See documentation for additional context.
* keyboard: add F16..F20 keys (present on DEC LK201 keyboard and its clones) Sergey Svishchev2016-07-301-0/+15
|
* Return std::string objects by value rather than pass by reference AJR2016-01-101-5/+5
| | | | | | - strprintf is unaltered, but strformat now takes one fewer argument - state_string_export still fills a buffer, but has been made const - get_default_card_software now takes no arguments but returns a string
* clang-modernize part 1 (nw) Miodrag Milanovic2015-12-031-6/+6
|
* Initial conversion of core to C++14. Note that compilers are now limited to ↵ Miodrag Milanovic2015-12-031-5/+4
| | | | GCC 4.9.0 and up, Clang 3.4.0 and up, and VS2013 and up [Miodrag Milanovic]
* moved all to std::string (nw) Miodrag Milanovic2015-04-221-9/+9
|
* string -> str rename due to future conflicts (nw) Miodrag Milanovic2015-04-121-5/+5
|
* There is no implicit conversion to char* in std::string (nw) Miodrag Milanovic2015-04-121-3/+3
|
* Improve responsiveness of 8-way joysticks default behaviour on 4-way games ↵ Quench02015-02-211-1/+0
| | | | when moves unintentionally become diagonal by favouring the new direction change.
* Move destructor definitions out of header files included by emu.h; clean ↵ Alex W. Jackson2014-03-271-1/+1
| | | | some obsolete junk out of machine.h [Alex Jackson]
* Moved core template container classes up from emutempl.h to coretmpl.h: Aaron Giles2014-03-111-3/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [Aaron Giles] * these classes now no longer take a resource_pool; everything is managed globally -- this means that objects added to lists must be allocated with global_alloc * added new auto_pointer<> template which wraps a pointer and auto-frees it upon destruction; it also defaults to NULL so it doesn't need to be explicitly initialized * moved tagged_list template to tagmap.h Redo of the low-level memory tracking system: [Aaron Giles] * moved low-level tracking out of emu\emualloc into lib\util\corealloc so it can be shared among all components and used by core libraries * global_alloc and friends no longer use a resource pool to track allocations; turns out this was a wholly redundant system that wasted a lot of memory * removed global_resource_pool entirely * added global_free_array to delete arrays allocated with global_alloc_array * added tracking of object versus array allocation; we will now error if you use global_free on an array, or global_free_array on an object Added new utility helper const_string_pool which can be used to efficiently accumulate strings that are not intended to be modified. Used by updated makelist and software list code. [Aaron Giles] Updated png2bdc and makelist tools to not leak memory and use more modern techniques (no more MAX_DRIVERS in makelist, for example). [Aaron Giles] Deprecated auto_strdup and removed all uses by way of caller-managed astrings and the software list rewrite. [Aaron Giles] Rewrote software list management: [Aaron Giles] * removed the notion of a software_list that is separate from a software_list_device; they are one and the same now * moved several functions into device_image_interface since they really didn't belong in the core software list class * lots of simplification as a result of the above changes Additional notes (no whatsnew): Moved definition of FPTR to osdcomm.h. Some changes happened in the OSD code to fix issues, especially regarding freeing arrays. SDL folks may need to fix up some of these. The following devices still are using tokens and should be modernized (I found them because they kept their token as void * and tried to delete it, which you can't): namco_52xx_device (mame/audio/namco52.c) namco_54xx_device (mame/audio/namco54.c) namco_06xx_device (mame/machine/namco06.c) namco_50xx_device (mame/machine/namco50.c) namco_51xx_device (mame/machine/namco51.c) namco_53xx_device (mame/machine/namco53.c) voodoo_device (emu/video/voodoo.c) mos6581_device (emu/sound/mos6581.c) aica_device (emu/sound/aica.c) scsp_device (emu/sound/scsp.c) dmadac_sound_device (emu/sound/dmadac.c) s3c2440_device (emu/machine/s3c2440.c) wd1770_device (emu/machine/wd17xx.c) latch8_device (emu/machine/latch8.c) duart68681_device (emu/machine/68681.c) s3c2400_device (emu/machine/s3c2400.c) s3c2410_device (emu/machine/s3c2410.c) strataflash_device (mess/machine/strata.c) hd63450_device (mess/machine/hd63450.c) tap_990_device (mess/machine/ti99/990_tap.c) omti8621_device (mess/machine/omti8621.c) vdt911_device (mess/video/911_vdt.c) apollo_graphics_15i (mess/video/apollo.c) asr733_device (mess/video/733_asr.c)
* Bulk convert files that already had standard BSD license in my name Aaron Giles2013-10-161-31/+2
| | | | to new license tagged form.
* input: Support up to 32 buttons and harmonize Windows and SDL behavior if ↵ R. Belmont2013-02-181-1/+49
| | | | you exceed the limit [Nick3092]
* Cleanups and version bumpmame0148 Miodrag Milanovic2013-01-111-39/+39
|
* Fixed debug asserts (no whatsnew) Miodrag Milanovic2012-02-231-1/+1
|
* Death by static initialization order. Fixed declaration order at the Aaron Giles2011-06-201-1/+0
| | | | | | | top of input.c. Removed default_seq since all uses of it are covered by is_default() and set_default().
* Cleanups and version bumpmame0142u5 Angelo Salese2011-06-051-21/+21
|
* (Finally found the time to finish this....) Aaron Giles2011-05-301-346/+782
| | | | | | | | | | | | | | | | | | | | | | | | Low-level input upgrade. Classes now exist for input_codes, input_items, input_devices, and input_seqs. Also created an input_manager class to hold machine-global state and made it accessible via machine.input(). Expanded the device index range (0-255, up from 0-16), and the OSD can now specify the device index explicitly if they can better keep the indexes from varying run-to-run. [Aaron Giles] Note that I've built and run SDL on Windows, but not all the code paths were exercised. If you use mice/joysticks extensively double-check them to be sure it all still works as expected. This is mainly an OSD and core change. The only thing impacting drivers is if they query for specific keys for debugging. The following S&Rs took care of most of that: S: input_code_pressed( *)\(( *)([^, ]+) *, * R: \3\.input\(\)\.code_pressed\1\(\2 S: input_code_pressed_once( *)\(( *)([^, ]+) *, * R: \3\.input\(\)\.code_pressed_once\1\(\2
* Privatized most of the m_machine pointers in the system to prevent Aaron Giles2011-04-191-1/+1
| | | | direct use.
* BIG update. Aaron Giles2011-03-291-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove redundant machine items from address_space and device_t. Neither machine nor m_machine are directly accessible anymore. Instead a new getter machine() is available which returns a machine reference. So: space->machine->xxx ==> space->machine().xxx device->machine->yyy ==> device->machine().yyy Globally changed all running_machine pointers to running_machine references. Any function/method that takes a running_machine takes it as a required parameter (1 or 2 exceptions). Being consistent here gets rid of a lot of odd &machine or *machine, but it does mean a very large bulk change across the project. Structs which have a running_machine * now have that variable renamed to m_machine, and now have a shiny new machine() method that works like the space and device methods above. Since most of these are things that should eventually be devices anyway, consider this a step in that direction. 98% of the update was done with regex searches. The changes are architected such that the compiler will catch the remaining errors: // find things that use an embedded machine directly and replace // with a machine() getter call S: ->machine-> R: ->machine\(\)\. // do the same if via a reference S: \.machine-> R: \.machine\(\)\. // convert function parameters to running_machine & S: running_machine \*machine([^;]) R: running_machine \&machine\1 // replace machine-> with machine. S: machine-> R: machine\. // replace &machine() with machine() S: \&([()->a-z0-9_]+machine\(\)) R: \1 // sanity check: look for this used as a cast (running_machine &) // and change to this: *(running_machine *)
* Added debug_global_input_code_pressed_once() function to input.c [Angelo Salese] Angelo Salese2010-05-241-0/+1
|
* First round of an attempted cleanup of header files in the system. Aaron Giles2010-01-101-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Created new central header "emu.h"; this should be included by pretty much any driver or device as the first include. This file in turn includes pretty much everything a driver or device will need, minus any other devices it references. Note that emu.h should *never* be included by another header file. - Updated all files in the core (src/emu) to use emu.h. - Removed a ton of redundant and poorly-tracked header includes from within other header files. - Temporarily changed driver.h to map to emu.h until we update files outside of the core. Added class wrapper around tagmap so it can be directly included and accessed within objects that need it. Updated all users to embed tagmap objects and changed them to call through the class. Added nicer functions for finding devices, ports, and regions in a machine: machine->device("tag") -- return the named device, or NULL machine->port("tag") -- return the named port, or NULL machine->region("tag"[, &length[, &flags]]) -- return the named region and optionally its length and flags Made the device tag an astring. This required touching a lot of code that printed the device to explicitly fetch the C-string from it. (Thank you gcc for flagging that issue!)
* Extended the astring class wrapper into something useful, and Aaron Giles2010-01-081-2/+2
| | | | | | | | | | | | | | | | | | useable as a stack object. Also designed the interfaces to allow for chaining operations. And added a casting operator to const char * for seamless use in most functions that take plain old C strings. Changed all uses of astring to use the object directly on the stack or embedded in objects instead of explicitly allocating and deallocating it. Removed a lot of annoying memory management code as a result. Changed interfaces that accepted/returned an astring * to use an astring & instead. Removed auto_alloc_astring(machine). Use auto_alloc(machine, astring) instead.
* NOTE: This change requires two new osd functions: osd_malloc() and Aaron Giles2010-01-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | osd_free(). They take the same parameters as malloc() and free(). Renamed mamecore.h -> emucore.h. New C++-aware memory manager, implemented in emualloc.*. This is a simple manager that allows you to add any type of object to a resource pool. Most commonly, allocated objects are added, and so a set of allocation macros is provided to allow you to manage objects in a particular pool: pool_alloc(p, t) = allocate object of type 't' and add to pool 'p' pool_alloc_clear(p, t) = same as above, but clear the memory first pool_alloc_array(p, t, c) = allocate an array of 'c' objects of type 't' and add to pool 'p' pool_alloc_array_clear(p, t, c) = same, but with clearing pool_free(p, v) = free object 'v' and remove it from the pool Note that pool_alloc[_clear] is roughly equivalent to "new t" and pool_alloc_array[_clear] is roughly equivalent to "new t[c]". Also note that pool_free works for single objects and arrays. There is a single global_resource_pool defined which should be used for any global allocations. It has equivalent macros to the pool_* macros above that automatically target the global pool. In addition, the memory module defines global new/delete overrides that access file and line number parameters so that allocations can be tracked. Currently this tracking is only done if MAME_DEBUG is enabled. In debug builds, any unfreed memory will be printed at the end of the session. emualloc.h also has #defines to disable malloc/free/realloc/calloc. Since emualloc.h is included by emucore.h, this means pretty much all code within the emulator is forced to use the new allocators. Although straight new/delete do work, their use is discouraged, as any allocations made with them will not be tracked. Changed the familar auto_alloc_* macros to map to the resource pool model described above. The running_machine is now a class and contains a resource pool which is automatically destructed upon deletion. If you are a driver writer, all your allocations should be done with auto_alloc_*. Changed all drivers and files in the core using malloc/realloc or the old alloc_*_or_die macros to use (preferably) the auto_alloc_* macros instead, or the global_alloc_* macros if necessary. Added simple C++ wrappers for astring and bitmap_t, as these need proper constructors/destructors to be used for auto_alloc_astring and auto_alloc_bitmap. Removed references to the winalloc prefix file. Most of its functionality has moved into the core, save for the guard page allocations, which are now implemented in osd_alloc and osd_free.
* Results of running the latest srcclean. Aaron Giles2009-12-281-4/+4
|
* Added debug_global_input_code_pressed() for use in debugging. Aaron Giles2009-09-081-0/+7
| | | | Also some other small tweaks/cleanups.
* > From: Atari Ace [mailto:atari_ace@verizon.net] Aaron Giles2009-09-061-13/+13
| | | | | | | | | | | | | | | | | | | > Sent: Sunday, September 06, 2009 7:25 AM > To: submit@mamedev.org > Cc: atariace@hotmail.com > Subject: [patch] Deglobalize input.c > > Hi mamedev, > > These patches deglobalize input.c. The first adds running_machine to > some driver apis. The (large) second patch adds the machine parameter > to the most input_code_pressed apis (generated by script, not > compilable). The last patch then actually changes those apis and > others to take running_machine, and adds struct _input_private to hold > the input state variables. > > ~aa