summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/drawgfx.h
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Allow 16bpp gfxdecode (#5167)" R. Belmont2019-07-191-37/+35
| | | | This reverts commit a5e00faf88ec05d1705b9bc4796cc6f21f2cc7a9.
* Allow 16bpp gfxdecode (#5167) cam9002019-07-181-35/+37
| | | | | | | | | | | | | | | | | | * digfx.cpp : Add 16bpp case of RAW gfx layout drawgfx.cpp, tilemap.cpp : Make changeable total elements of gfx_elements constructor at RAW case, Allow 16bpp gfxdecode, Fix spacing tilemap.cpp : Allow 16bpp tilemap pen data gstream.cpp : Use gfxdecode for 16bpp gfx of X2222, Fix spacing igs017_igs031.cpp : Cleanup single sprite drawing routine jedi.cpp : Improve debug gfxdecode viewer(text gfx) * cps1.cpp : Minor fixes * gstream.cpp : Fix regression in x2222 drawgfx.cpp : Fix 16bpp transparent pen * gstream.cpp : Fix regression, Reduce unnecessary lines * Sync to master
* drawgfx.cpp : Updates cam9002019-06-041-3/+87
| | | | | | | | Move additive blending function into drawgfx.h, Add priority related copybitmap functions, Fix spacings Add priority related copybitmap and draw_scanline function is sprite like priority handling(prio_*) and tilemap like priority handling(primask_*), These are helpful for priority related bitmap / scanline drawing routines. drawgfxm.cpp : Add variations of priority related pixel draw functions, Fix spacings realbrk.cpp : Updates, Example usage for prio_copybitmap Simplify handlers, Use priority bitmap for sprite priority, Fix spacings, Use shorter / correct type values
* More cleanup/streamlining of machine configuration and macros: Vas Crabb2018-05-151-2/+7
| | | | | | | | | | | | | * Get rid of implicit prefix for GFX decode names and prefix them all * Get rid of special macro for adding GFXDECODE in favour of constructor * Make empty GFX decode a static member of interface * Allow palette to be specified to GFXDECODE as a device finder * Removed diserial.h from emu.h as it's used relatively infrequently Also fix darkseal and vaportra propely. The palette device automatically attaches itself to a share with matching tag. The correct solution here is to rename one or the other out of the way, since it was never attached to a share before.
* Streamline machine configuration macros - everyone's a device edition. Vas Crabb2018-05-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Start replacing special device macros with additional constructors, starting with ISA, INTELLEC 4 and RS-232 buses. Allow an object finder to take on the target of another object finder. (For a combination of the previous two things in action, see either the INTELLEC 4 driver, or the Apple 2 PC Exporter card. Also check out looping over a device finder array to instantiate devices in some places. Lots of things no longer need to pass tags around.) Start supplying default clocks for things that have a standard clock or have all clocks internal. Eliminate the separate DEV versions of the DEVCB_ macros. Previously, the plain versions were a shortcut for DEVICE_SELF as the target. You can now supply a string tag (relative to current device being configured), an object finder (takes on the base and relative tag), or a reference to a device/interface (only do this if you know the device won't be replaced out from under it, but that's a safe assumption for your subdevices). In almost all cases, you can get the effect you want by supplying *this as the target. Eliminate sound and CPU versions of macros. They serve no useful purpose, provide no extra checks, make error messages longer, add indirection, and mislead newbies into thinking there's a difference. Remove a lot of now-unnecessary ":" prefixes binding things relative to machine root. Clean up some miscellaneous rot. Examples of new functionality in use in (some more subtle than others): * src/mame/drivers/intellec4.cpp * src/mame/drivers/tranz330.cpp * src/mame/drivers/osboren1.cpp * src/mame/drivers/zorba.cpp * src/mame/devices/smioc.cpp * src/devices/bus/a2bus/pc_xporter.cpp * src/devices/bus/isa/isa.h * src/devices/bus/isa/isa.h * src/devices/bus/intellec4/intellec4.h
* Sarayan made me do it. Vas Crabb2018-04-281-1/+1
| | | | | | | | | | Concrete device types now have a call operator that instantiates a device. This change means you *must* use DECLARE_DEVICE_TYPE to declare the public interface of your device, even if it's device_t. If you want to use private implementation classes, use DEFINE_DEVICE_TYPE_PRIVATE and instantiate the object finders.
* v9938, v9958: Convert to use RGB32 bitmaps AJR2017-11-051-1/+3
| | | | | - Palette has been retained mostly for the sake of the palette viewer, and now reflects the actual programmed values, rather than being a fixed RRRGGGBBB encoding plus a hacky mess for the V9958's YJK colors. - V9938-on-V9938 transparent overlay is fixed for meritm.cpp (was broken a few releases ago).
* viewgfx: Fix the case when a gfx element has no palette [O. Galibert] Olivier Galibert2017-05-301-0/+1
|
* drawgfx: Make the palette optional [O. Galibert] Olivier Galibert2017-05-281-3/+3
| | | | | | | | | | | | | | | | | | | | device_gfx_interface does two things: - go from a possibly weird rom layout to a one-byte-per-pixel tiled layout - draw the tiles so created The second part requires a palette, but the first doesn't. And low-level emulations of individual graphic chips (konami tilemap or sprite generators for instance) are not supposed to care about the palette. They just output bits which are partly indexes into palettes, and partly not, and in any case become pen ids only much further in the rendering chain. But they need access to the decoding step, because one-byte-per-pixel is real nice.. So now such a device, which inherits from device_gfx_interface, can call set_palette_disable(true) and no palette tag will be required. Calling the draw functions will segfault though. As a side effect, the gfx_element constructor now takes a palette pointer instead of a reference, since it's now optional.
* New device interface for palettes AJR2017-04-061-5/+5
| | | | | | - Create device_palette_interface, which takes over most functionality from palette_device except for the initialization/decoding routines and RAM interface. - Update screen_device and device_gfx_interface to use a device_palette_interface object rather than a palette_device. This necessitates slight alterations to a few drivers and devices. - Modify v9938 and v9958 to use the new device_palette_interface rather than a subdevice. This entails breaking a cyclic dependency between device_video_interface and screen_device for this case.
* A round of spelling/typographical fixes to source comments (nw) Scott Stone2016-11-241-1/+1
|
* Introduce u8/u16/u32/u64/s8/s16/s32/s64 Vas Crabb2016-11-191-137/+135
| | | | | | | | | | | | * 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
* NOTICE (TYPE NAME CONSOLIDATION) Miodrag Milanovic2016-10-221-126/+126
| | | | | 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
* dynamic_buffer is just std::vector<UINT8> (nw) Miodrag Milanovic2016-10-211-2/+2
|
* More consistent use of integer types in tilemap_t and other graphics-related ↵ AJR2016-09-031-1/+1
| | | | | | classes (nw) - Define indirect_pen_t, requiring a slight reordering of emu.h due to an unsurprising dependency
* Pass and return palette devices by reference, not as pointers AJR2016-01-231-4/+6
| | | | | | - Add screen_device::has_palette() - Require device_gfx_interface::gfx() and palette() to access members - Getters for atari_vad_device return devices as references, not pointers
* reverting: Miodrag Milanovic2016-01-201-1/+1
| | | | | | | SHA-1: 1f90ceab075c4869298e963bf0a14a0aac2f1caa * tags are now strings (nw) fix start project for custom builds in Visual Studio (nw)
* tags are now strings (nw) Miodrag Milanovic2016-01-161-1/+1
| | | | fix start project for custom builds in Visual Studio (nw)
* const-qualify source bitmaps in drawgfx Vas Crabb2015-12-141-18/+18
|
* clang-modernize part 1 (nw) Miodrag Milanovic2015-12-031-1/+1
|
* Added some for Nathan and some more for Nicola (nw) Miodrag Milanovic2015-05-111-6/+2
|
* Added dummy license headers for EMU section (nw) Miodrag Milanovic2015-05-071-0/+2
|
* Replace dynamic_array with std::vector [O. Galibert] Olivier Galibert2015-04-141-7/+7
|
* drawgfx.h: Long-overdue documentation about how to use priority-masked Alex W. Jackson2014-11-161-0/+110
| | | | | | | | | | | | drawing (aka pdrawgfx); add some useful constants. [Alex Jackson] (nw) prehisle.c: Fix issues introduced by pdrawgfx conversion; use required_region_ptr instead of runtime tag lookup; give gfx regions more meaningful names; remove superfluous "prehisle"'s and "16"'s from member names (it's been many years since you could accidentally plug a handler of the wrong width into an address map and not have the core catch you at compile time)
* drawgfx.c: make it possible to reset the total elements of a gfx_element ↵ Alex W. Jackson2014-05-151-1/+2
| | | | [Alex Jackson]
* Cleanups and version bumpmame0153 Miodrag Milanovic2014-04-071-1/+1
|
* device_gfx_interface [Alex Jackson] Alex W. Jackson2014-04-051-133/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Moved graphics decoding to a new device interface class: device_gfx_interface. The gfxdecode device is now a device that simply inherits this interface and does nothing else. Devices that draw tilemaps or sprites using gfx_elements should in time be updated to use this interface rather than connect to a machine-global gfxdecode device. Updated toaplan_scu.c as an example (also fixed off-by-one sprite alignment in twincobr and rallybik while I was at it). gfx_elements are normally created in interface_post_start(), making it possible to dynamically create or modify the graphics decoding info during device_start() if you need to. On the other hand, if you need the gfx_elements during device_start(), you can directly call decode_gfx() to create them early. This interface also provides a standard and init-order-safe way to connect to a palette device (similarly to how device_video_interface helps devices connect to a screen), so it's handy for any device that does palettized drawing even if it doesn't use gfx_elements. Updated k053250.c as an example of this usage. gfxdecode info entries can now reference shared RAM regions by tag as well as ROM regions, automatically handle endianness, and have some other new capabilities. Updated nemesis.c and pgm.c to showcase the new features. Removed validate_display() (it was just a commented out stub already) since its only function, checking that drivers don't have an ind16 screen without a palette, is now done by screen_device::device_validity_check(). Updated obsolete comments about GFXLAYOUT_RAW (cps1.c hasn't used raw gfx for years, and "to save memory" is no longer a good reason to use it)
* gfx_elements now have a xor mask that is applied to each source bit offset ↵ Alex W. Jackson2014-03-271-1/+3
| | | | | | when decoding. This can be used to deal with endianness when decoding gfx from RAM or from program ROMs, or to reverse the bit order sense when this is useful (e.g. pgm.c) [Alex Jackson] (nw) This is test/checkpoint right now, final goal is to automatically determine the appropriate xor at startup when the gfxdecode info is processed (e.g. based on the width and endianness of the ROM region)
* Removed palette_device parameter from gfx draw methods. All draw methods now ↵ Alex W. Jackson2014-03-191-40/+40
| | | | use m_palette (nw)
* Made gfx_element::decode() private; fixed drivers that were calling it ↵ Alex W. Jackson2014-03-181-1/+3
| | | | directly [Alex Jackson]
* Checkpoint 2: Alex W. Jackson2014-03-151-7/+13
| | | | | | gfxdecode devices must now be assigned a palette in MCFG. Added palette devices to several MESS drivers and devices to comply with this requirement. This palette is assigned as a default to the gfx_elements created by the device (but still not used for drawing yet, except in the UI graphics viewer) Tilemaps now have a pointer to a palette device and use that palette for rgb32 drawing, rather than the palette of the screen or bitmap they are drawing to (since rgb32 screens don't have palettes now). When a tilemap is created, it takes its palette from the gfxdecode device it was created with, but you can change a tilemap's palette device with set_palette() at any time (doing this does not mark the tilemap dirty, since all tilemaps use indexed bitmaps internally)
* Moved core template container classes up from emutempl.h to coretmpl.h: Aaron Giles2014-03-111-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [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)
* Checkpoint: gfx_elements now have a pointer to a palette_device (which is ↵ Alex W. Jackson2014-03-111-12/+10
| | | | not actually initialized or used yet), and no longer have an unneeded pointer to the running_machine. Removed some gfx_element getter methods described in comments (by Aaron?) as 'a bit gross', and fixed the tiny handful of drivers that were using them (nw)
* Huge update, palette is now device (nw) Miodrag Milanovic2014-02-271-44/+44
| | | note: Aaron please give more descriptive text for release log I have no more strength :)
* Created gfxdecode_device instead of using machine fixed gfxdecode [Miodrag ↵ Miodrag Milanovic2014-02-161-6/+54
| | | | | | | | | | Milanovic] Updated all devices and drivers for using it. out of whatsnew: Note that it is made to work same as before, in some cases it can be more logic to move gfxdevice into subdevice itself then to keep it in main driver.
* Moved drawgfx functions to gfx_element (nw) Miodrag Milanovic2014-02-131-70/+67
|
* Cleanups and version bumpmame0148 Miodrag Milanovic2013-01-111-74/+74
|
* Clean-ups and version bumpmame0147 Miodrag Milanovic2012-09-171-5/+5
| | | note: hoarded dump removed too from coco_cart.xml, this will not be tolerated
* Fix gfx_element behaviors for dynamically created single- Aaron Giles2012-09-101-1/+1
| | | | element raw objects used in offbeat drivers like metro.c.
* gfx_element is now a class. Accessors are provided for all Aaron Giles2012-09-061-220/+197
| | | | | necessary elements. Updated some of the more, ah, creative uses/abuses of the gfx_elements. [Aaron Giles]
* small typofix (hello GuyveR800 :P) Michaël Banaan Ananas2012-02-031-2/+2
|
* Remove support for 4bpp packed graphics. These only manifested Aaron Giles2012-01-171-6/+4
| | | | | | | for drivers that used GFX_RAW support for 4bpp systems, and yet we had a bunch of extra code to support it. Updated these drivers to do without it and removed all the extra code for supporting it.
* Major bitmap-related changes throughout the system. There are Aaron Giles2012-01-121-36/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Bulk conversion of bitmap_t * to bitmap_t & . With this change the Aaron Giles2012-01-021-36/+36
| | | | | | | | parameters for the global SCREEN_UPDATE callback match the parameters for the driver_device version. Added allocate() and deallocate() methods to bitmap_t to permit cleaner handling of bitmaps in drivers and modern devices. [Aaron Giles]
* Bulk converted cliprect * to cliprect & across the system. This makes Aaron Giles2011-12-311-30/+30
| | | | | | | | | | cliprects mandatory everywhere. In general, cliprects were being correctly passed through the video side of most drivers already, so it is mostly a semantic change. Note that with my previous change, bitmaps have cliprects, so if you just want to clip to the bitmap's boundaries, pass bitmap->cliprect() instead of NULL (which is no longer permitted). [Aaron Giles]
* Privatized most of the m_machine pointers in the system to prevent Aaron Giles2011-04-191-2/+7
| | | | direct use.
* BIG update. Aaron Giles2011-03-291-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 *)
* First round of an attempted cleanup of header files in the system. Aaron Giles2010-01-101-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-5/+5
|