summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/input.c
Commit message (Collapse)AuthorAgeFilesLines
* Rename *.c -> *.cpp in our source (nw) Miodrag Milanovic2015-11-081-2378/+0
|
* Let's be more strict (nw) Vas Crabb2015-11-021-3/+3
|
* compile fixes for GCC5.1.1 win64 and CPP11 mode.. requested by mingw team to ↵ Cowering2015-05-281-6/+6
| | | | test LTO fixes. please add #ifdefs if 64 bit printf does not work for you
* moved all to std::string (nw) Miodrag Milanovic2015-04-221-60/+65
|
* removed bool conversion and implicit empty check (nw) Miodrag Milanovic2015-04-191-2/+2
|
* string -> str rename due to future conflicts (nw) Miodrag Milanovic2015-04-121-47/+47
|
* There is no implicit conversion to char* in std::string (nw) Miodrag Milanovic2015-04-121-8/+8
|
* cstr() - > c_str() as preparation for move to std::string (nw) Miodrag Milanovic2015-04-111-6/+6
|
* Improve responsiveness of 8-way joysticks default behaviour on 4-way games ↵ Quench02015-02-211-2/+1
| | | | when moves unintentionally become diagonal by favouring the new direction change.
* Moved eminline and related files into /src/osd since it's system related (nw) Miodrag Milanovic2014-04-161-4/+4
| | | | | | | | Moved delegates into /src/lib/util to enable usage of delegates in other project parts Moved mame_printf_* calls into /src/osd/osdcore.c and renamed them to osd_printf_* Changed mess.mak to display compilation of ymmu100.ppm nicely
* Move destructor definitions out of header files included by emu.h; clean ↵ Alex W. Jackson2014-03-271-0/+9
| | | | 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-59/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [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)
* added a few more missing \n in logging / cleanups (nw) Oliver Stöneberg2014-03-101-2/+2
|
* 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-0/+16
| | | | you exceed the limit [Nick3092]
* Cleanups and version bumpmame0148 Miodrag Milanovic2013-01-111-66/+66
|
* removed unnecessary strlen() usage (no whatsnew) Oliver Stöneberg2012-07-271-1/+1
|
* Some cleanup of some observed #include redundancy from source files which ↵ Scott Stone2012-02-061-1/+0
| | | | use emu.h (nw)
* Removed old C-based interface to astrings. astring exists only as Aaron Giles2012-01-031-1/+1
| | | | | | a class now. Updated all stragglers (mostly tools) to use the class form. [Aaron Giles]
* Death by static initialization order. Fixed declaration order at the Aaron Giles2011-06-201-4/+3
| | | | | | | 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-38/+38
|
* Fix for Apple GCC (no whatsnew) R. Belmont2011-05-311-1/+1
|
* (Finally found the time to finish this....) Aaron Giles2011-05-301-1110/+1663
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Switch to using delegates for some callbacks: Aaron Giles2011-04-271-1/+1
| | | | | | | | | | | | - non-device timer callbacks - machine state changing callbacks - configuration callbacks - per-screen VBLANK callbacks - DRC backend callbacks For the timer case only, I added wrappers for the old-style functions. Over time, drivers should switch to device timers instead, reducing the number of timers that are directly allocated through the scheduler.
* Privatized most of the m_machine pointers in the system to prevent Aaron Giles2011-04-191-5/+10
| | | | direct use.
* BIG update. Aaron Giles2011-03-291-73/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 *)
* Converted core_options to a class. Removed a bunch of marginal Aaron Giles2011-03-031-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | functionality in favor of alternate mechanisms. Errors are now reported via an astring rather than via callbacks. Every option must now specify a type (command, integer, float, string, boolean, etc). Command behavior has changed so that only one command is permitted. [Aaron Giles] Changed fileio system to accept just a raw searchpath instead of an options/option name combination. [Aaron Giles] Created emu_options class dervied from core_options which wraps core emulator options. Added mechanisms to cleanly change the system name and add/remove system-specific options, versus the old way using callbacks. Also added read accessors for all the options, to ensure consistency in how parameters are handled. Changed most core systems to access emu_options instead of core_options. Also changed machine->options() to return emu_options. [Aaron Giles] Created cli_options class derived from emu_options which adds the command-line specific options. Updated clifront code to leverage the new class and the new core behaviors. cli_execute() now accepts a cli_options object when called. [Aaron Giles] Updated both SDL and Windows to have their own options classes, derived from cli_options, which add the OSD-specific options on top of everything else. Added accessors for all the options so that queries are strongly typed and simplified. [Aaron Giles] Out of whatsnew: I've surely screwed up some stuff, though I have smoke tested a bunch of things. Let me know if you hit anything odd. Also I know this change will impact the WINUI stuff, please let me know if there are issues. All the functionality necessary should still be present. If it's not obvious, please talk to me before adding stuff to the core_options class.
* mame_file is now emu_file and is a class. It is required Aaron Giles2011-02-121-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | to pass a core_options object to the constructor, along with a search path. This required pushing either a running_machine or a core_options through some code that wasn't previously ready to handle it. emu_files can be reused over multiple open/close sessions, and a lot of core code cleaned up nicely as things were converted to them. Also created a file_enumerator class for iterating over files in a searchpath. This replaces the old mame_openpath functions. Changed machine->options() to return a reference. Removed public nvram_open() and fixed jchan/kaneko16 to stop directly saving NVRAM. Removed most of the mame_options() calls; this will soon go away entirely, so don't add any more. Added core_options to device_validity_check() so they can be used to validate things.
* I had originally wanted to convert the profiler to use scopes (e.g., Aaron Giles2010-08-211-2/+2
| | | | | | | | | | | | | | | | | create a stack class that started the profiler in the constructor and stopped it in the destructor). Sadly, doing that causes gcc to call out to hook up the unwind chain, and this tanks performance quite badly, even when the profiler is off. Since I had already class-ified profiler.c, I decided to keep the old way of doing things but wrap it in the newer classes. So at least it wasn't a complete waste of my time. Search & replace: profiler_mark_start -> g_profiler.start profiler_mark_end -> g_profiler.end
* Swap: (astring.len() != 0) -> astring Aaron Giles2010-08-211-1/+1
| | | | Swap: (astring.len() == 0) -> !astring
* Split mame.c into mame.c and machine.c, the latter containing the Aaron Giles2010-06-301-17/+17
| | | | | | | | | | | | | | | | | | | running_machine definition and implementation. Moved global machine-level operations and accessors into methods on the running_machine class. For the most part, this doesn't affect drivers except for a few occasional bits: mame_get_phase() == machine->phase() add_reset_callback() == machine->add_notifier(MACHINE_NOTIFY_RESET, ...) add_exit_callback() == machine->add_notifier(MACHINE_NOTIFY_EXIT, ...) mame_get_base_datetime() == machine->base_datetime() mame_get_current_datetime() == machine->current_datetime() Cleaned up the region_info class, removing most global region accessors except for memory_region() and memory_region_length(). Again, this doesn't generally affect drivers.
* Added debug_global_input_code_pressed_once() function to input.c [Angelo Salese] Angelo Salese2010-05-241-1/+6
|
* Made input_device pointers non-volatile. Since we return pointers to them Aaron Giles2010-03-301-17/+17
| | | | | in response to input_device_add(), ensure that the pointers don't change after subsequent adds.
* Fix bug introduced with astring changes that caused malformed tokens Aaron Giles2010-01-181-2/+2
| | | | when writing out cfg files.
* First round of an attempted cleanup of header files in the system. Aaron Giles2010-01-101-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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-38/+31
| | | | | | | | | | | | | | | | | | 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/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2/+2
|
* From: David Haywood [neohaze@nildram.co.uk] Aaron Giles2009-10-011-1/+4
| | | | | | | | | | | | | | | Sent: Friday, September 25, 2009 12:15 PM To: Aaron Giles Subject: 360 pad crash This 'fixes' the bug where MAME crashes and corrupts your config files if you connect a pad at runtime. Previously there was an assert, now it simply doesn't execute that block of code if devcode is null. I don't know if this is the best fix (it would probably be quite nice if it could detect pads being added removed at runtime and adapt to that) but at least it stops it crashing and corrupting files.
* Cleanups and version bump. Aaron Giles2009-09-101-3/+3
|
* Added debug_global_input_code_pressed() for use in debugging. Aaron Giles2009-09-081-8/+30
| | | | Also some other small tweaks/cleanups.
* MAMEUI uses input_seq_from_tokens() outside the context of a running emulation, Nathan Woods2009-09-071-2/+2
| | | | | | so this code will crash if machine == NULL and the keycode was not a built in keycode. Changing this so that it will gracefully fail if machine == NULL
* > From: Atari Ace [mailto:atari_ace@verizon.net] Aaron Giles2009-09-061-97/+134
| | | | | | | | | | | | | | | | | | | > 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
* Changed profiler to separate start/stop cases. [Christophe Jaillet] Aaron Giles2009-08-191-2/+2
|
* Bulk change alert. Aaron Giles2009-04-261-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This update changes the way we handle memory allocation. Rather than allocating in terms of bytes, allocations are now done in terms of objects. This is done via new set of macros that replace the malloc_or_die() macro: alloc_or_die(t) - allocate memory for an object of type 't' alloc_array_or_die(t,c) - allocate memory for an array of 'c' objects of type 't' alloc_clear_or_die(t) - same as alloc_or_die but memset's the memory to 0 alloc_array_clear_or_die(t,c) - same as alloc_array_or_die but memset's the memory to 0 All original callers of malloc_or_die have been updated to call these new macros. If you just need an array of bytes, you can use alloc_array_or_die(UINT8, numbytes). Made a similar change to the auto_* allocation macros. In addition, added 'machine' as a required parameter to the auto-allocation macros, as the resource pools will eventually be owned by the machine object. The new macros are: auto_alloc(m,t) - allocate memory for an object of type 't' auto_alloc_array(m,t,c) - allocate memory for an array of 'c' objects of type 't' auto_alloc_clear(m,t) - allocate and memset auto_alloc_array_clear(m,t,c) - allocate and memset All original calls or auto_malloc have been updated to use the new macros. In addition, auto_realloc(), auto_strdup(), auto_astring_alloc(), and auto_bitmap_alloc() have been updated to take a machine parameter. Changed validity check allocations to not rely on auto_alloc* anymore because they are not done in the context of a machine. One final change that is included is the removal of SMH_BANKn macros. Just use SMH_BANK(n) instead, which is what the previous macros mapped to anyhow.
* Changed UI to ignore selection from lightguns when off screen. This stops ↵ Derrick Renaud2009-04-241-55/+52
| | | | selection of Gun X Gun Y if you move the gun out of range.
* Fixed bug where repeating axis values were being selected for button input ↵ Derrick Renaud2009-04-231-37/+114
| | | | in UI.
* Many casts added to the core files, and various other tweaks Aaron Giles2009-03-121-14/+14
| | | | to make them compile as either C or C++.
* 02747: Compile error on openSUSE 11.1 / gcc 4.3.2 with OPTIMIZE=3 Aaron Giles2008-12-251-1/+1
| | | | | Appease the compiler. There is no actual bug here, but it is tricky for the compiler to understand that.
* From: Oliver Stoeneberg [mailto:oliverst@online.de] Aaron Giles2008-09-111-4/+5
| | | | | | | | Subject: Machine -> machine This is a big patch adding running_machine* parameters and using "machine" where available.