Commit Graph

79 Commits

Author SHA1 Message Date
hap
128640144a emu: correct some file headers (nw) 2020-06-19 12:38:41 +02:00
Vas Crabb
1a600c1d1a (nw) more misc cleanup:
* mark drawgfx core templates inline to prevent linker trying to coalesce them across compilation units, and hopefully encourage the compiler to specialise them when drivers call them with fixed argument values
* make wraparound parameter for ROZ drawing functions bool - it's a simple true/false value
* clean up spacing in a few places
2019-09-17 22:12:04 +10:00
AJR
e4903df939 drawgfxm.h: Rename to drawgfxt.ipp and replace the mega-macros with template functions (nw) 2019-09-16 22:21:29 -04:00
AJR
0abac3ba45 Eliminate extract_scanline8/16/32, replacing the scant existing usage with std::copy_n (nw) 2019-09-16 22:21:29 -04:00
R. Belmont
9b55ced1d2 Revert "Allow 16bpp gfxdecode (#5167)"
This reverts commit a5e00faf88.
2019-07-19 16:35:20 -04:00
cam900
a5e00faf88 Allow 16bpp gfxdecode (#5167)
* 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
2019-07-18 10:17:11 -04:00
cam900
11eb5c1683 drawgfx.cpp : Updates
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
2019-06-04 11:23:08 +09:00
Vas Crabb
2332572800 More cleanup/streamlining of machine configuration and macros:
* 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.
2018-05-15 05:43:28 +10:00
Vas Crabb
4ea3cd0bc1 Streamline machine configuration macros - everyone's a device edition.
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
2018-05-06 00:51:27 +10:00
Vas Crabb
57fd28d36a Sarayan made me do it.
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.
2018-04-28 00:01:30 +10:00
AJR
5fba45b0bc v9938, v9958: Convert to use RGB32 bitmaps
- 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).
2017-11-05 21:55:34 -05:00
Olivier Galibert
38b56341b6 viewgfx: Fix the case when a gfx element has no palette [O. Galibert] 2017-05-30 15:51:15 +02:00
Olivier Galibert
53feb420a4 drawgfx: Make the palette optional [O. Galibert]
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.
2017-05-28 22:04:01 +02:00
AJR
8fe18e9ecc New device interface for palettes
- 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.
2017-04-06 11:30:40 +10:00
Scott Stone
30cda1d3e5 A round of spelling/typographical fixes to source comments (nw) 2016-11-24 09:24:01 -05:00
Vas Crabb
8179a84458 Introduce u8/u16/u32/u64/s8/s16/s32/s64
* 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
2016-11-19 05:38:48 +11:00
Miodrag Milanovic
ddb290d5f6 NOTICE (TYPE NAME CONSOLIDATION)
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
2016-10-22 13:13:17 +02:00
Miodrag Milanovic
d2e8f61149 dynamic_buffer is just std::vector<UINT8> (nw) 2016-10-21 12:35:05 +02:00
AJR
a237f50680 More consistent use of integer types in tilemap_t and other graphics-related classes (nw)
- Define indirect_pen_t, requiring a slight reordering of emu.h due to an unsurprising dependency
2016-09-03 10:01:39 -04:00
AJR
9b61eb0b6b Pass and return palette devices by reference, not as pointers
- 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
2016-01-23 22:57:16 -05:00
Miodrag Milanovic
4e8e3066f8 reverting:
SHA-1: 1f90ceab07

* tags are now strings (nw)
fix start project for custom builds in Visual Studio (nw)
2016-01-20 21:42:13 +01:00
Miodrag Milanovic
1f90ceab07 tags are now strings (nw)
fix start project for custom builds in Visual Studio (nw)
2016-01-16 14:54:42 +01:00
Vas Crabb
3ab910fe50 const-qualify source bitmaps in drawgfx 2015-12-14 04:41:13 +11:00
Miodrag Milanovic
91605d3f4d clang-modernize part 1 (nw) 2015-12-03 18:17:25 +01:00
Miodrag Milanovic
6b04fd7f05 Added some for Nathan and some more for Nicola (nw) 2015-05-11 14:42:31 +02:00
Miodrag Milanovic
6d902a08bd Added dummy license headers for EMU section (nw) 2015-05-07 10:45:57 +02:00
Olivier Galibert
278cf84e55 Replace dynamic_array with std::vector [O. Galibert] 2015-04-14 19:58:17 +02:00
Alex W. Jackson
d803e96ac8 drawgfx.h: Long-overdue documentation about how to use priority-masked
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)
2014-11-16 04:19:09 -05:00
Alex W. Jackson
ffd0b5f2ad drawgfx.c: make it possible to reset the total elements of a gfx_element [Alex Jackson] 2014-05-15 18:33:54 +00:00
Miodrag Milanovic
fec65e0b57 Cleanups and version bump 2014-04-07 06:04:18 +00:00
Alex W. Jackson
c3a166e962 device_gfx_interface [Alex Jackson]
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)
2014-04-05 14:59:36 +00:00
Alex W. Jackson
ab3a90ca29 gfx_elements now have a xor mask that is applied to each source bit offset 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)
2014-03-27 09:21:55 +00:00
Alex W. Jackson
f27a84da26 Removed palette_device parameter from gfx draw methods. All draw methods now use m_palette (nw) 2014-03-19 11:03:38 +00:00
Alex W. Jackson
b6db6a39a2 Made gfx_element::decode() private; fixed drivers that were calling it directly [Alex Jackson] 2014-03-18 06:42:10 +00:00
Alex W. Jackson
25db822531 Checkpoint 2:
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)
2014-03-15 07:34:54 +00:00
Aaron Giles
4ea9df02a1 Moved core template container classes up from emutempl.h to coretmpl.h:
[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)
2014-03-11 15:54:58 +00:00
Alex W. Jackson
04b9d9e0f9 Checkpoint: gfx_elements now have a pointer to a palette_device (which is 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) 2014-03-11 14:28:45 +00:00
Miodrag Milanovic
64ac8f6776 Huge update, palette is now device (nw)
note: Aaron please give more descriptive text for release log I have no more strength :)
2014-02-27 13:35:15 +00:00
Miodrag Milanovic
7cde79cd9c Created gfxdecode_device instead of using machine fixed gfxdecode [Miodrag 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.
2014-02-16 17:32:10 +00:00
Miodrag Milanovic
bc0672544f Moved drawgfx functions to gfx_element (nw) 2014-02-13 10:29:11 +00:00
Miodrag Milanovic
0e19f641d3 Cleanups and version bump 2013-01-11 07:32:46 +00:00
Miodrag Milanovic
e25c13f253 Clean-ups and version bump
note: hoarded dump removed too from coco_cart.xml, this will not be tolerated
2012-09-17 06:49:13 +00:00
Aaron Giles
7b9f849da1 Fix gfx_element behaviors for dynamically created single-
element raw objects used in offbeat drivers like metro.c.
2012-09-10 06:25:03 +00:00
Aaron Giles
a50849088e gfx_element is now a class. Accessors are provided for all
necessary elements. Updated some of the more, ah, creative
uses/abuses of the gfx_elements. [Aaron Giles]
2012-09-06 06:19:32 +00:00
Michaël Banaan Ananas
d652cbe576 small typofix (hello GuyveR800 :P) 2012-02-03 16:47:33 +00:00
Aaron Giles
81d3e50238 Remove support for 4bpp packed graphics. These only manifested
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.
2012-01-17 06:16:20 +00:00
Aaron Giles
e4238fb654 Major bitmap-related changes throughout the system. There are
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.
2012-01-12 21:19:49 +00:00
Aaron Giles
80cd316a2a Bulk conversion of bitmap_t * to bitmap_t & . With this change the
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]
2012-01-02 04:59:11 +00:00
Aaron Giles
fcc81b7c6d Bulk converted cliprect * to cliprect & across the system. This makes
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]
2011-12-31 21:48:36 +00:00
Aaron Giles
d971ce8f36 Privatized most of the m_machine pointers in the system to prevent
direct use.
2011-04-19 06:02:01 +00:00