summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/uiinput.c
Commit message (Collapse)AuthorAgeFilesLines
* (Finally found the time to finish this....) Aaron Giles2011-05-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* BIG update. Aaron Giles2011-03-291-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 *)
* 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
* Split mame.c into mame.c and machine.c, the latter containing the Aaron Giles2010-06-301-4/+4
| | | | | | | | | | | | | | | | | | | 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.
* Minor changes for internal render debugger Couriersud2010-02-051-2/+2
| | | | | | | - ui_input_frame_update is now global - moved element_component from rendlay.c to rendlay.h - added ability to rendlay.c to define "container" components. These simply provide a render_container. I plan to remove the above again and simply use one container covering the whole render_target. This container will be rendered after the artwork and before the ui. For this to work, DViews need move and resize support. Render_targets will than be equivalent to virtual desktops.
* 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!)
* > From: Atari Ace [mailto:atari_ace@verizon.net] Aaron Giles2009-09-061-1/+1
| | | | | | | | | | | | | | | | | | | > 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-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Many casts added to the core files, and various other tweaks Aaron Giles2009-03-121-1/+1
| | | | to make them compile as either C or C++.
* This patch replaces the Machine parameter where an running_machine * Aaron Giles2008-11-131-1/+0
| | | | | | is available and removes the deprecat.h where unnecessary. [Oliver Stoeneberg]
* OSD notice: you now need to report separate mouse up/mouse down events Aaron Giles2008-09-091-1/+12
| | | | | | | | | | | | | | | | | | for this new support to work. Clickable input support. Mostly by Nathan. A few changes from the proposal: * as far as the layout is concerned, states are 0 (off) or 1 (on) and aren't impacted by the port's ACTIVE_HIGH or ACTIVE_LOW * instead of checking each individual field for a hit, we look to see what is hit once per frame and then just check against that; this is faster, but does limit us to a single hit item * added function input_field_by_tag_and_mask() to look up a particular input_field_config by tag and mask; this makes it possible to easily get the port default value or other information as necessary
* Cleanups. Aaron Giles2008-07-171-5/+5
|
* Note: I have done some testing, but there are probably more bugs Aaron Giles2008-07-121-0/+281
lurking. If you run into anything odd, please let me know. Added new module uiinput.c which manages input for the user interface. The OSD is responsible for pushing mouse events and character events to this interface in order to support mouse movement and text-based input (currently only used for the select game menu). Added support for navigating through the menus using the mouse. [Nathan Woods, Aaron Giles] Redesigned the UI menus so that they can maintain a richer state. Now the menus can be generated once and reused, rather than requiring them to be regenerated on each frame. All menus also share a comment eventing system and navigation through them is managed centrally. Rewrote all the menus to use the new system, apart from the cheat menus, which are now disabled. Reorganized the video menu to make it easier to understand. [Aaron Giles]