summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/driver.c
Commit message (Collapse)AuthorAgeFilesLines
* Sega 16-bit cleanup, part 1 (still more coming): Aaron Giles2012-08-041-20/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Converted FD1089/FD1094 into proper devices, derived from m68000. They now handle their own decryption and memory management, so we can remove all the calls for initialization/reset/etc. The key now lives as a 'key' subdevice under the CPU, and the FD1089/1094 are now specified just like any other CPU. * Removed the horrible s16fd and s24fd files. Good riddance. * Created a helper class for managing fd1094 decryption caches. * Converted the memory mapper into a new modern device and updated the segas16b, segaorun, and segas18 drivers to use it. Fixed ROM memory mapping so that the source ROMs can be loaded contiguously, removing a bunch of hacks. * Untangled the joined segas1x_state and split the states for each system into their own classes. Cleaned up some implementations. * Added support for member functions to be called as DRIVER_INIT functions. To do this, #define MODERN_DRIVER_INIT prior to #including "emu.h" and you will be required to specify a class and member function for your driver init. * Fully modernized the segas16b and segas18 drivers. New working games added ----------------------- GP Rider (Japan) [ShouTime, Charles MacDonald, Aaron Giles] Last Survivor [ShouTime, Charles MacDonald, Aaron Giles, 9ofzeven, TrevEB, Dr. Spankenstein, ghoolster, Surgeville, Tormod, Tjaberg, Waremonger] (Note: A couple games are still busted, but most are working. Will follow up with more updates.)
* fix soundlatch warning Michaël Banaan Ananas2012-07-231-15/+15
|
* Implemented new paletteram_xGGGGGRRRRRBBBBB_byte_le_w() function, used by ↵ Angelo Salese2012-05-011-0/+2
| | | | Chance 32 [Angelo Salese]
* Clean-ups and version bumpmame0145u7 Angelo Salese2012-04-221-5/+5
|
* Remove color_prom parameter from PALETTE_INIT. Added code where Aaron Giles2012-04-121-15/+14
| | | | | | | | necessary to fetch the color_prom directly. Made PALETTE_INIT into just another basic callback with an overridable palette_init() in the driver_device, and support for arbitrary member functions via MCFG_PALETTE_INIT_OVERRIDE.
* Merged watchdog back into running_machine. Aaron Giles2012-04-121-6/+6
| | | | | | | Renamed driver overrides to MCFG_MACHINE/SOUND/VIDEO_START_OVERRIDE to explicitly indicate they are overriding the default behavior. Put liberatr back the way it used to be.
* Renamed device_irq_callback to device_irq_acknowledge_callback to Aaron Giles2012-04-101-0/+128
| | | | | | | | make its purpose clearer. Added delegate support for interrupt callbacks, and made driver_device variants of the generic interrupt helper callbacks. Did not convert existing callers yet due to logistical issues.
* Added the ability to specify member function driver callbacks for Aaron Giles2012-04-101-18/+30
| | | | | | | | | | machine/sound/video_start/reset. Changed liberatr as an example. If a callback is specified, it is called in place of the corresponding virtual method. Not entirely sure I like this, so consider the example open for discussion.
* Moved soundlatch helpers into driver.c and removed emu/audio/generic.c. Aaron Giles2012-04-091-18/+96
| | | | | | | Normalized soundlatch helper function names. Created delegates for machine/sound/video_start/reset callbacks and added necessary infrastructure to use them going forward.
* Templatized the palette generators and made naming consistent. Aaron Giles2012-04-091-1/+235
| | | | | Moved video/generic flip screen management into the base driver_device class and updated all callers.
* Extracted driver_device base class from machine.* and into its Aaron Giles2012-04-061-0/+284
| | | | own file driver.*
* Move driver list/enumerator to new file drivenum.c/.h. Aaron Giles2012-04-061-430/+0
| | | | Move game_driver definition and constants to new header gamedrv.h.
* Fixed issue with get_merge_name when using slot devices (no whatsnew) Miodrag Milanovic2011-11-281-2/+2
|
* Cleanups and version bumpmame0142u3 Angelo Salese2011-05-081-2/+2
|
* Collapsed device_config and device_t into one class. Updated all Aaron Giles2011-04-271-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | existing modern devices and the legacy wrappers to work in this environment. This in general greatly simplifies writing a modern device. [Aaron Giles] General notes: * some more cleanup probably needs to happen behind this change, but I needed to get it in before the next device modernization or import from MESS :) * new template function device_creator which automatically defines the static function that creates the device; use this instead of creating a static_alloc_device_config function * added device_stop() method which is called at around the time the previous device_t's destructor was called; if you auto_free anything, do it here because the machine is gone when the destructor is called * changed the static_set_* calls to pass a device_t & instead of a device_config * * for many devices, the static config structure member names over- lapped the device's names for devcb_* functions; in these cases the members in the interface were renamed to have a _cb suffix * changed the driver_enumerator to only cache 100 machine_configs because caching them all took a ton of memory; fortunately this implementation detail is completely hidden behind the driver_enumerator interface * got rid of the macros for creating derived classes; doing it manually is now clean enough that it isn't worth hiding the details in a macro
* Cleanups again Angelo Salese2011-04-181-5/+5
|
* Improve driver enumerator to by default exclude internal drivers, Aaron Giles2011-04-171-0/+29
| | | | unless explicitly searched for.
* (Big tangle of changes that all happened as I was looking into the ROM Aaron Giles2011-04-131-193/+289
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | loader rewrite, which is still in progress....) Replaced mamedriv.c with a new driver list mechanism that is generated by the build tools. The emulator core now expects the presence of a file called src/$(TARGET)/$(SUBTARGET).lst which is just a raw list of driver names, one per line. C and C++ comments are still permitted. This file is parsed by a new build tool makelist which extracts the driver names, sorts them, and generates a file called drivlist.c, which is consumed by the core. [Aaron Giles] Added new osdcore function osd_malloc_array() which is identical to osd_malloc() but obviously hints that the underlying allocation is for an array. Updated all callers to use the appropriate form. Modified the Windows allocator to only use guard pages for array-style allocations, allowing us to enable them once again in debug builds. [Aaron Giles] Created new static class driver_list to wrap accesses to the list of available drivers. Improved speed of driver lookups by relying on the presorting done by makelist. [Aaron Giles] Created helper class driver_enumerator as a helper for iterating through the list of drivers. This class supports basic filtering and iteration, and also serves as a temporary cache of machine_configs. [Aaron Giles] Created cli_frontend object to wrap all the CLI handling code in clifront.c. Updated/simplified all the code to take advantage of the driver_enumerator. [Aaron Giles] Created media_auditor object to wrap all the auditing functions in audit.c. Updated all users to the new interface. Note that the new auditing mechanism is slightly out of sync with the romload code in terms of finding ROMs owned by devices, so it may mis-report some issues until the new ROM loading code is in. [Aaron Giles] Added concept of a per-device searchpath. For most devices, their searchpath is just the short name of the device. For driver_devices, the searchpath is driver[;parent[;bios]]. This searchpath will eventually be used by the rom loader to find ROMs. For now it is used by the media auditor only. [Aaron Giles] Created info_xml_creator object to wrap all the info generation functions in info.c. Converted the file to C++ and cleaned up the input processing code. [Aaron Giles] (not for whatsnew ... Known issues: auditing of CHDs appears busted, and debug builds report unfreed memory if you use the built-in game picker)
* Converted core_options to a class. Removed a bunch of marginal Aaron Giles2011-03-031-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* - Moved compatibility validation into MAME core from MESS. Miodrag Milanovic2010-02-091-0/+16
| | | | - Made GAME_COMPUTER type visible for all, and removed ifdefs for it. - Made GAME_NO_SOUND check done on MESS too.
* First round of an attempted cleanup of header files in the system. Aaron Giles2010-01-101-1/+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!)
* NOTE: This change requires two new osd functions: osd_malloc() and Aaron Giles2010-01-081-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Added casts to ensure proper values are passed to the ctype.h functions. Aaron Giles2009-06-251-1/+1
| | | | [Juergen Buchmueller]
* Bulk change alert. Aaron Giles2009-04-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2/+2
| | | | to make them compile as either C or C++.
* New module: devintrf.c/.h. Implements a generic device interface similar Aaron Giles2008-02-191-293/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to the sound and CPU interfaces. This is still a bit WIP, but works at a fundamental level. Currently the only example of usage is in qix.c for the MC6845 CRTC. New module: mconfig.c/.h. Moved all machine_config and MDRV_* macros here, out of driver.c/.h. Added MDRV macros for adding/removing/configuring devices. qix.c: Moved video part of machine driver to video/qix.c. Added MC6845 as a device in the machine driver. Removed explicit MC6845 initialization from VIDEO_START in favor of simply retrieving the token from the device interface code. mc6845.c: Updated all callbacks to pass the mc6845_t * object. Updated all drivers accordingly. Added a minimal device interface. Deprecated the following constants because global constants that pretend to document things but which are only guesses are dumb: - DEFAULT_60HZ_VBLANK_DURATION - DEFAULT_30HZ_VBLANK_DURATION - DEFAULT_REAL_60HZ_VBLANK_DURATION - DEFAULT_REAL_30HZ_VBLANK_DURATION - DEFAULT_60HZ_3S_VBLANK_WATCHDOG - DEFAULT_30HZ_3S_VBLANK_WATCHDOG Updated all drivers to explicitly specify the equivalent bogus times. Added comments for the "REAL" VBLANK durations to indicate that they are not accurate.
* Removed expand_machine_driver(). Aaron Giles2008-02-181-13/+31
| | | | | | Replaced with machine_config_alloc() and machine_config_free(). Updated all call sites. Normalized info.c style and simplified some of the code.
* Copyright cleanup: Aaron Giles2008-01-061-1/+1
| | | | | | - removed years from copyright notices - removed redundant (c) from copyright notices - updated "the MAME Team" to be "Nicola Salmoria and the MAME Team"
* Initial checkin of MAME 0.121.mame0121 Aaron Giles2007-12-171-0/+520