path: root/src/osd/osdepend.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* unicode.h: Updates AJR2020-12-151-1/+0
| | | | | - Remove from emu.h (except for UTF8_xxx macros, which have been transplanted to emucore.h since a lot of drivers use them) and osdepend.h - Add std::string_view overrides for uchar_from_utf8 and normalize_unicode
* Got rid of global_alloc/global_free. Vas Crabb2020-10-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The global_alloc/global_free functions have outlived their usefulness. They don't allow consistently overriding the default memory allocation behaviour because they aren't used consistently, and we don't have standard library allocator wrappers for them that we'd need to use them consistently with all the standard library containers we're using. If you need to change the default allocator behaviour, you can override the new/delete operators, and there are ways to get more fine-grained control that way. We're already doing that to pre-fill memory in debug builds. Code was already starting to depend on global_alloc/global_free wrapping new/delete. For example some parts of the code (including the UI and Windows debugger) was putting the result of global_alloc in a std::unique_ptr wrappers without custom deleters, and the SPU sound device was assuming it could use global_free to release memory allocated with operator new. There was also code misunderstanding the behaviour of global_alloc, for example the GROM port cartridge code was checking for nullptr when a failure will actually throw std::bad_alloc. As well as substituting new/delete, I've made several things use smart pointers to reduce the chance of leaks, and fixed a couple of leaks, too.
* UI input menu: treat codes containing a postive and negative of the same ↵ Vas Crabb2019-11-211-1/+1
| | | | | | | | thing as invalid (e.g. A S not A) ioport.cpp: * better than 50% reduction in compile time, and better locality for static data * better encapsulation, const correctness and noexcept usage
* Remove up to one frame of input latency. (#5901) antonioginer2019-11-161-0/+1
| | | | | | | | | | * Remove up to one frame of input latency. Makes MAME virtually lagless on VRR monitors. * Use empty parentheses and clean interface member calls * Add new option -instant_blit to make this feature optional * Rename new option to -lowlatency, -ll
* (nw) Clean up the mess on master Vas Crabb2019-03-261-2/+3
| | | | | | | | | | | | | This effectively reverts b380514764cf857469bae61c11143a19f79a74c5 and c24473ddff715ecec2e258a6eb38960cf8c8e98e, restoring the state at 598cd5227223c3b04ca31f0dbc1981256d9ea3ff. Before pushing, please check that what you're about to push is sane. Check your local commit log and ensure there isn't anything out-of-place before pushing to mainline. When things like this happen, it wastes everyone's time. I really don't need this in a week when real work™ is busting my balls and I'm behind where I want to be with preparing for MAME release.
* Revert "conflict resolution (nw)" andreasnaive2019-03-251-3/+2
| | | | | This reverts commit c24473ddff715ecec2e258a6eb38960cf8c8e98e, reversing changes made to 009cba4fb8102102168ef32870892438327f3705.
* apply -verbose after processing command-line options and after first pass ↵ Vas Crabb2019-01-121-2/+3
| | | | over .ini files (nw)
* NOTICE (TYPE NAME CONSOLIDATION) Miodrag Milanovic2016-10-221-2/+2
| | | | | 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
* use standard types uintptr_t, char16_t and char32_t instead of FPTR, ↵ Miodrag Milanovic2016-10-221-1/+1
| | | | utf16_char, unicode_char (nw)
* ui refactoring [Vas Crabb] Vas Crabb2016-05-271-1/+1
| | | | | | | * move menu classes into ::ui namesapce * reduce scope of many symbols (first step in making UI code less rage-inducing so I can fix text input)
* Move slider_state and ui_menu_item into src/frontend/mame, nw therealmogminer@gmail.com2016-05-161-1/+1
* Split UI and frontend part from core [Miodrag Milanovic] Miodrag Milanovic2016-04-231-1/+1
* Isolate CLI part (nw) Miodrag Milanovic2016-04-201-1/+0
* Add AVI writing to bgfx, nw therealmogminer@gmail.com2016-04-171-0/+1
* Make OSDs return ui_menu_item lists, not slider_state lists therealmogminer@gmail.com2016-04-101-3/+2
* Make sliders use an std::vector instead of a linked list, nw therealmogminer@gmail.com2016-04-101-1/+1
* Move font enumeration to OSD, separate font name from display name as needed ↵ Vas Crabb2016-03-171-7/+23
| | | | for OSX
* More work on targets, nw therealmogminer@gmail.com2016-02-211-1/+1
* First take on render API reorg, nw therealmogminer@gmail.com2016-02-211-1/+3
* Fix warning with some clang configurations, don't automatically disable bgfx ↵ Vas Crabb2015-04-031-0/+2
| | | | for 10.5 Leopard
* Converted midi into a module. (nw) couriersud2015-01-311-0/+3
* Cleanups and version bumpmame0158 Miodrag Milanovic2015-01-281-4/+4
* Added a generic module abstraction layer and migrated font modules to couriersud2015-01-231-9/+2
| | | use this layer. (nw)
* Moved font code into osd/modules/font. Extended osd_font to a proper couriersud2015-01-191-7/+22
| | | interface. (nw)
* Changed osd_font to struct osd_font and removed unnecessary osdepend.h couriersud2015-01-171-4/+4
| | | includes.
* OSD Updates: couriersud2015-01-141-7/+2
| | | | | - OSD can now use OPTION_COMMAND; added execute_command handler to osd_interface. - moved list_network_devices and list_midi_devices to OSD
* Untangled options inheritance. Previously code locked in osd_options couriersud2015-01-131-101/+1
| | | | | | | | | | | | | locking any potential future OSD to these. Options inheritance now is core_options emu_options cli_options osd_options [sdl|win]_osd_options This required a number of minor changes to other code as well. Tested on linux-sdl, windows-sdl, windows-mainline, osx-sdl
* Converted back osd_interface into a pure interface. couriersud2015-01-121-177/+80
| | | | | | | The previous version just exhibited any member of osd_interface to the core. This one limits core access to osd to those functions originally specified. There is room for improvement going forward here in the design. Left FIXMEs where appropriate. (nw)
* Moved osd midi stuff to osd/modules/midi. Needed to touch a couple of couriersud2015-01-091-0/+7
| | | | other files so that mame compiles and links. Tested SDL build (linux/windows).
* Added window to osd_interface (nw) Miodrag Milanovic2014-09-011-0/+2
| | | | win_monitor_info to class win_window_info to class, partial
* More cleanups, there is issue with srcclean that needs to be taken care as ↵ Miodrag Milanovic2014-07-221-23/+23
| | | | well, just doing now what we can
* -Reorganized OSD, handling more sound output systems and debuggers, defaults ↵ Miodrag Milanovic2014-05-081-11/+178
| | | | | | left same as before [Miodrag Milanovic] -Created osd_options as base option class for non-system specific options
* -Made osd_interface base class for OSD and moved initialization for each ↵ Miodrag Milanovic2014-04-251-0/+21
| | | | | | | | subsystem in it as virtual calls. (nw) -Moved midi handling in base class -Cleaned running_machine of information of next machine -All is cleaned after exiting of running_machine so debugger window is removed as well till next machine is started -Made osdmini to compile
* reverting to classic ui due to lot of issues, as much as I hate reverting ↵ Miodrag Milanovic2014-04-171-2/+0
| | | | some else code (nw)
* Small core cleanup (nw) Miodrag Milanovic2014-04-151-1/+0
* Merge of new menubar code Nathan Woods2014-04-121-0/+2
* Bulk convert files that already had standard BSD license in my name Aaron Giles2013-10-161-31/+2
| | | | to new license tagged form.
* Cleanups and version bumpmame0148 Miodrag Milanovic2013-01-111-2/+2
* Major bitmap-related changes throughout the system. There are Aaron Giles2012-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | almost certainly some regressions lurking. Let me know if something seems busted. Bitmaps are now strongly typed based on format. bitmap_t still exists as an abstract base class, but it is almost never used. Instead, format-specific bitmap classes are provided: bitmap_ind8 == 8bpp indexed bitmap_ind16 == 16bpp indexed bitmap_ind32 == 32bpp indexed bitmap_ind64 == 64bpp indexed bitmap_rgb32 == 32bpp RGB bitmap_argb32 == 32bpp ARGB bitmap_yuy16 == 16bpp YUY For each format, a generic pix() method is provided which references pixels of the correct type. The old pix8/pix16/pix32/ pix64 methods still exist in the short term, but the only one available is the one that matches the bitmap's pixel size. Note also that the old RGB15 format bitmaps are no longer supported at all. Converted model1, megadriv, and stv drivers away from the RGB15 format bitmaps. New auto_bitmap_<type>_alloc() macros are provided for allocating the appropriate type of bitmap. Screen update functions now must specify the correct bitmap type as their input parameters. For static update functions the SCREEN_UPDATE macro is now replaced with SCREEN_UPDATE_RGB32 and SCREEN_UPDATE_IND16 macros. All existing drivers have been updated to use the correct macros. Screen update functions are now required for all screens; there is no longer any default behavior of copying a "default" bitmap to the screen (in fact the default bitmap has been deprecated). Use one of the following to specify your screen_update callback: MCFG_SCREEN_UPDATE_STATIC(name) - static functions MCFG_SCREEN_UPDATE_DRIVER(class, func) - driver members MCFG_SCREEN_UPDATE_DEVICE(tag, class, func) - device members Because the target bitmap format can now be deduced from the screen update function itself, the MCFG_SCREEN_FORMAT macro is no longer necessary, and has been removed. If you specify a screen update callback that takes a bitmap_ind16, then the screen will be configured to use a 16bpp indexed bitmap, and if you specify a callback that takes a bitmap_rgb32, then a 32bpp RGB bitmap will be provided. Extended the bitmap classes to support wrapping a subregion of another bitmap, and cleaner allocation/resetting. The preferred use of bitmaps now is to define them directly in drivers/devices and use allocate() or wrap() to set them up, rather than allocating them via auto_bitmap_*_alloc(). Several common devices needed overhauls or changes as a result of the above changes: * Reorganized the laserdisc base driver and all the laserdisc drivers as modern C++ devices, cleaning the code up considerably. Merged ldsound device into the laserdsc device since modern devices are flexible enough to handle it. * Reorganized the v9938 device as a modern C++ device. Removed v9938mod.c in favor of template functions in v9938.c directly. * Added independent ind16 and rgb32 callbacks for TMS340x0 devices. * All video devices are now hard-coded to either ind16 or rgb32 bitmaps. The most notable is the mc6845 which is rgb32, and required changes to a number of consumers. * Added screen_update methods to most video devices so they can be directly called via MCFG_SCREEN_UPDATE_DEVICE instead of creating tons of stub functions.
* (Finally found the time to finish this....) Aaron Giles2011-05-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Call off the dogs, the OSD routing for OSD-side sliders has been fixed. nwn Ryan Holtz2011-05-231-0/+3
* Cleanup & version bump.mame0140u1 Aaron Giles2010-11-081-3/+3
* Added support for OSD-generated fonts. The OSD is queried first to see Aaron Giles2010-10-241-0/+7
| | | | | | | | | | | | | | | | | if it owns a given font (based on the name), and if it does, it is responsible for generating bitmaps on the fly as characters are requested. Added new option -uifont to specify the UI font. It can be set to a filename, in which case a BDF font will be loaded. It can also be set to a font name (assuming the OSD support is present), in which case the OSD font by that name is used. The default value is 'default' which can be used by the OSD to substitute a default font or by the OSD, which will default to ui.bdf as before. In all cases, it falls back to the built-in font by default if none of the previous options works. On Windows, the OSD will default to Tahoma as the font name. Also on Windows, font names can be specified with [b] to indicate bold or [i] to indicate italic.
* Create new class osd_interface to house OSD callbacks. Added new Aaron Giles2010-10-211-128/+37
| | | | | | | | | module osdepend.c with default empty implementations. Changed mame_execute() and cli_execute() to accept a reference to an osd_interface which is provided by the caller. Updated SDL and Windows OSD to create an osd_interface-derived class and moved their OSD callbacks to be members.
* **FOR REVIEW** Andrew Gardner2010-09-201-0/+1
| | | | | | | | | | | | | | | | | Log: Added preliminary support for saving debugger window locations. [Andrew Gardner] (Notes) * I only save the values for the SDL debugger for now. * There is no loading of these values yet, but if this patch is confirmed good, loading should be relatively straightforward to add. * There is a slight chance this might not compile on OSes other than linux. I will be available via e-mail for the next 10 hours and will assist with any compilation problems if they occur. * The patch seems like the "right way" to do things, but if I am doing anything suspect, please feel free to make suggestions and corrections.
* Split mame.c into mame.c and machine.c, the latter containing the Aaron Giles2010-06-301-1/+1
| | | | | | | | | | | | | | | | | | | 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.
* WARNING: There are likely to be regressions in both functionality and Aaron Giles2010-06-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | performance as a result of this change. Do not panic; report issues to the list in the short term and I will look into them. There are probably also some details I forgot to mention. Please ask questions if anything is not clear. NOTE: This is a major internal change to the way devices are handled in MAME. There is a small impact on drivers, but the bulk of the changes are to the devices themselves. Full documentation on the new device handling is in progress at Defined two new casting helpers: [Aaron Giles] downcast<type>(value) should be used for safe and efficient downcasting from a base class to a derived class. It wraps static_cast<> by adding an assert that a matching dynamic_cast<> returns the same result in debug builds. crosscast<type>(value) should be used for safe casting from one type to another in multiple inheritance scenarios. It compiles to a dynamic_cast<> plus an assert on the result. Since it does not optimize down to static_cast<>, you should prefer downcast<> over crosscast<> when you can. Redefined running_device to be a proper C++ class (now called device_t). Same for device_config (still called device_config). All devices and device_configs must now be derived from these base classes. This means each device type now has a pair of its own unique classes that describe the device. Drivers are encouraged to use the specific device types instead of the generic running_device or device_t classes. Drivers that have a state class defined in their header file are encouraged to use initializers off the constructor to locate devices. [Aaron Giles] Removed the following fields from the device and device configuration classes as they never were necessary or provided any use: device class, device family, source file, version, credits. [Aaron Giles] Added templatized variant of machine->device() which performs a downcast as part of the device fetch. Thus machine->device<timer_device>("timer") will locate a device named "timer", downcast it to a timer_device, and assert if the downcast fails. [Aaron Giles] Removed most publically accessible members of running_device/device_t in favor of inline accessor functions. The only remaining public member is machine. Thus all references to device->type are now device->type(), etc. [Aaron Giles] Created a number of device interface classes which are designed to be mix- ins for the device classes, providing specific extended functionality and information. There are standard interface classes for sound, execution, state, nvram, memory, and disassembly. Devices can opt into 0 or more of these classes. [Aaron Giles] Converted the classic CPU device to a standard device that uses the execution, state, memory, and disassembly interfaces. Used this new class (cpu_device) to implement the existing CPU device interface. In the future it will be possible to convert each CPU core to its own device type, but for now they are still all CPU devices with a cpu_type() that specifies exactly which kind of CPU. [Aaron Giles] Created a new header devlegcy.h which wraps the old device interface using some special template classes. To use these with an existing device, simply remove from the device header the DEVICE_GET_INFO() declaration and the #define mapping the ALL_CAPS name to the DEVICE_GET_INFO. In their place #include "devlegcy.h" and use the DECLARE_LEGACY_DEVICE() macro. In addition, there is a DECLARE_LEGACY_SOUND_DEVICE() macro for wrapping existing sound devices into new-style devices, and a DECLARE_LEGACY_NVRAM_DEVICE() for wrapping NVRAM devices. Also moved the token and inline_config members to the legacy device class, as these are not used in modern devices. [Aaron Giles] Converted the standard base devices (VIDEO_SCREEN, SPEAKER, and TIMER) from legacy devices to the new C++ style. Also renamed VIDEO_SCREEN to simply SCREEN. The various global functions that were previously used to access information or modify the state of these devices are now replaced by methods on the device classes. Specifically: video_screen_configure() == screen->configure() video_screen_set_visarea() == screen->set_visible_area() video_screen_update_partial() == screen->update_partial() video_screen_update_now() == screen->update_now() video_screen_get_vpos() == screen->vpos() video_screen_get_hpos() == screen->hpos() video_screen_get_vblank() == screen->vblank() video_screen_get_hblank() == screen->hblank() video_screen_get_width() == screen->width() video_screen_get_height() == screen->height() video_screen_get_visible_area() == screen->visible_area() video_screen_get_time_until_pos() == screen->time_until_pos() video_screen_get_time_until_vblank_start() == screen->time_until_vblank_start() video_screen_get_time_until_vblank_end() == screen->time_until_vblank_end() video_screen_get_time_until_update() == screen->time_until_update() video_screen_get_scan_period() == screen->scan_period() video_screen_get_frame_period() == screen->frame_period() video_screen_get_frame_number() == screen->frame_number() timer_device_adjust_oneshot() == timer->adjust() timer_device_adjust_periodic() == timer->adjust() timer_device_reset() == timer->reset() timer_device_enable() == timer->enable() timer_device_enabled() == timer->enabled() timer_device_get_param() == timer->param() timer_device_set_param() == timer->set_param() timer_device_get_ptr() == timer->get_ptr() timer_device_set_ptr() == timer->set_ptr() timer_device_timeelapsed() == timer->time_elapsed() timer_device_timeleft() == timer->time_left() timer_device_starttime() == timer->start_time() timer_device_firetime() == timer->fire_time() Updated all drivers that use the above functions to fetch the specific device type (timer_device or screen_device) and call the appropriate method. [Aaron Giles] Changed machine->primary_screen and the 'screen' parameter to VIDEO_UPDATE to specifically pass in a screen_device object. [Aaron Giles] Defined a new custom interface for the Z80 daisy chain. This interface behaves like the standard interfaces, and can be added to any device that implements the Z80 daisy chain behavior. Converted all existing Z80 daisy chain devices to new-style devices that inherit this interface. [Aaron Giles] Changed the way CPU state tables are built up. Previously, these were data structures defined by a CPU core which described all the registers and how to output them. This functionality is now part of the state interface and is implemented via the device_state_entry class. Updated all CPU cores which were using the old data structure to use the new form. The syntax is currently awkward, but will be cleaner for CPUs that are native new devices. [Aaron Giles] Converted the okim6295 and eeprom devices to the new model. These were necessary because they both require multiple interfaces to operate and it didn't make sense to create legacy device templates for these single cases. (okim6295 needs the sound interface and the memory interface, while eeprom requires both the nvram and memory interfaces). [Aaron Giles] Changed parameters in a few callback functions from pointers to references in situations where they are guaranteed to never be NULL. [Aaron Giles] Removed MDRV_CPU_FLAGS() which was only used for disabling a CPU. Changed it to MDRV_DEVICE_DISABLE() instead. Updated drivers. [Aaron Giles] Reorganized the token parsing for machine configurations. The core parsing code knows how to create/replace/remove devices, but all device token parsing is now handled in the device_config class, which in turn will make use of any interface classes or device-specific token handling for custom token processing. [Aaron Giles] Moved many validity checks out of validity.c and into the device interface classes. For example, address space validation is now part of the memory interface class. [Aaron Giles] Consolidated address space parameters (bus width, endianness, etc.) into a single address_space_config class. Updated all code that queried for address space parameters to use the new mechanism. [Aaron Giles]
* Correct a long-standing design flaw: device configuration state Aaron Giles2010-01-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | is now separate from runtime device state. I have larger plans for devices, so there is some temporary scaffolding to hold everything together, but this first step does separate things out. There is a new class 'running_device' which represents the state of a live device. A list of these running_devices sits in machine->devicelist and is created when a running_machine is instantiated. To access the configuration state, use device->baseconfig() which returns a reference to the configuration. The list of running_devices in machine->devicelist has a 1:1 correspondance with the list of device configurations in machine->config->devicelist, and most navigation options work equally on either (scanning by class, type, etc.) For the most part, drivers will now deal with running_device objects instead of const device_config objects. In fact, in order to do this patch, I did the following global search & replace: const device_config -> running_device device->static_config -> device->baseconfig().static_config device->inline_config -> device->baseconfig().inline_config and then fixed up the compiler errors that fell out. Some specifics: Removed device_get_info_* functions and replaced them with methods called get_config_*. Added methods for get_runtime_* to access runtime state from the running_device. DEVICE_GET_INFO callbacks are only passed a device_config *. This means they have no access to the token or runtime state at all. For most cases this is fine. Added new DEVICE_GET_RUNTIME_INFO callback that is passed the running_device for accessing data that is live at runtime. In the future this will go away to make room for a cleaner mechanism. Cleaned up the handoff of memory regions from the memory subsystem to the devices.
* 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!)
* 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.