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)
This commit is contained in:
Alex W. Jackson 2014-04-05 14:59:36 +00:00
parent 01d2320c95
commit c3a166e962
32 changed files with 766 additions and 654 deletions

2
.gitattributes vendored
View File

@ -2096,6 +2096,8 @@ src/emu/didisasm.c svneol=native#text/plain
src/emu/didisasm.h svneol=native#text/plain
src/emu/diexec.c svneol=native#text/plain
src/emu/diexec.h svneol=native#text/plain
src/emu/digfx.c svneol=native#text/plain
src/emu/digfx.h svneol=native#text/plain
src/emu/diimage.c svneol=native#text/plain
src/emu/diimage.h svneol=native#text/plain
src/emu/dimemory.c svneol=native#text/plain

View File

@ -40,7 +40,7 @@ static GFXDECODE_START( video32 )
GFXDECODE_END
static MACHINE_CONFIG_FRAGMENT( video32 )
MCFG_GFXDECODE_ADD("gfxdecode", "^^palette", video32)
MCFG_GFXDECODE_ADD("gfxdecode", ":palette", video32)
MACHINE_CONFIG_END
//**************************************************************************

View File

@ -40,7 +40,7 @@ static GFXDECODE_START( video64 )
GFXDECODE_END
static MACHINE_CONFIG_FRAGMENT( video64 )
MCFG_GFXDECODE_ADD("gfxdecode", "^^palette", video64)
MCFG_GFXDECODE_ADD("gfxdecode", ":palette", video64)
MACHINE_CONFIG_END
//**************************************************************************

380
src/emu/digfx.c Normal file
View File

@ -0,0 +1,380 @@
/***************************************************************************
digfx.c
Device graphics interfaces.
***************************************************************************/
#include "emu.h"
#include "validity.h"
//**************************************************************************
// DEVICE GFX INTERFACE
//**************************************************************************
//-------------------------------------------------
// device_gfx_interface - constructor
//-------------------------------------------------
device_gfx_interface::device_gfx_interface(const machine_config &mconfig, device_t &device,
const gfx_decode_entry *gfxinfo, const char *palette_tag)
: device_interface(device),
m_gfxdecodeinfo(gfxinfo),
m_palette_tag(palette_tag),
m_palette_is_sibling(palette_tag == NULL),
m_decoded(false)
{
}
//-------------------------------------------------
// ~device_gfx_interface - destructor
//-------------------------------------------------
device_gfx_interface::~device_gfx_interface()
{
}
//-------------------------------------------------
// static_set_info: configuration helper to set
// the gfxdecode info used by the device
//-------------------------------------------------
void device_gfx_interface::static_set_info(device_t &device, const gfx_decode_entry *gfxinfo)
{
device_gfx_interface *gfx;
if (!device.interface(gfx))
throw emu_fatalerror("MCFG_GFX_INFO called on device '%s' with no gfx interface\n", device.tag());
gfx->m_gfxdecodeinfo = gfxinfo;
}
//-------------------------------------------------
// static_set_palette: configuration helper to
// set the palette used by the device
//-------------------------------------------------
void device_gfx_interface::static_set_palette(device_t &device, const char *tag)
{
device_gfx_interface *gfx;
if (!device.interface(gfx))
throw emu_fatalerror("MCFG_GFX_PALETTE called on device '%s' with no gfx interface\n", device.tag());
gfx->m_palette_tag = tag;
gfx->m_palette_is_sibling = true;
}
//-------------------------------------------------
// interface_pre_start - make sure all our input
// devices are started
//-------------------------------------------------
void device_gfx_interface::interface_pre_start()
{
if (m_palette_tag == NULL)
fatalerror("No palette specified for device '%s'\n", device().tag());
// find our palette device, either as a sibling device or subdevice
if (m_palette_is_sibling)
m_palette = device().siblingdevice<palette_device>(m_palette_tag);
else
m_palette = device().subdevice<palette_device>(m_palette_tag);
if (m_palette == NULL)
fatalerror("Device '%s' specifies nonexistent %sdevice '%s' as palette\n",
device().tag(),
(m_palette_is_sibling ? "sibling " : "sub"),
m_palette_tag);
// if palette device isn't started, wait for it
if (!m_palette->started())
throw device_missing_dependencies();
}
//-------------------------------------------------
// interface_post_start - decode gfx, if we
// haven't done so already
//-------------------------------------------------
void device_gfx_interface::interface_post_start()
{
if (!m_decoded)
decode_gfx(m_gfxdecodeinfo);
}
//-------------------------------------------------
// decode_gfx - parse gfx decode info and
// create gfx elements
//-------------------------------------------------
void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo)
{
// skip if nothing to do
if (gfxdecodeinfo == NULL)
return;
// local variables to hold mutable copies of gfx layout data
gfx_layout glcopy;
dynamic_array<UINT32> extxoffs(0);
dynamic_array<UINT32> extyoffs(0);
// loop over all elements
for (int curgfx = 0; curgfx < MAX_GFX_ELEMENTS && gfxdecodeinfo[curgfx].gfxlayout != NULL; curgfx++)
{
const gfx_decode_entry &gfx = gfxdecodeinfo[curgfx];
// extract the scale factors and xormask
UINT32 xscale = GFXENTRY_GETXSCALE(gfx.flags);
UINT32 yscale = GFXENTRY_GETYSCALE(gfx.flags);
UINT32 xormask = GFXENTRY_ISREVERSE(gfx.flags) ? 7 : 0;
// resolve the region
UINT32 region_length;
const UINT8 *region_base;
UINT8 region_width;
endianness_t region_endianness;
if (gfx.memory_region != NULL)
{
device_t &basedevice = (GFXENTRY_ISDEVICE(gfx.flags)) ? device() : *device().owner();
if (GFXENTRY_ISRAM(gfx.flags))
{
memory_share *share = basedevice.memshare(gfx.memory_region);
assert(share != NULL);
region_length = 8 * share->bytes();
region_base = reinterpret_cast<UINT8 *>(share->ptr());
region_width = share->width() / 8;
region_endianness = share->endianness();
}
else
{
memory_region *region = basedevice.memregion(gfx.memory_region);
assert(region != NULL);
region_length = 8 * region->bytes();
region_base = region->base();
// FIXME
region_width = 1;
region_endianness = ENDIANNESS_NATIVE;
}
}
else
{
region_length = 0;
region_base = NULL;
region_width = 1;
region_endianness = ENDIANNESS_NATIVE;
}
if (region_endianness != ENDIANNESS_NATIVE)
{
switch (region_width)
{
case 2:
xormask |= 0x08;
break;
case 4:
xormask |= 0x18;
break;
case 8:
xormask |= 0x38;
break;
}
}
// copy the layout into our temporary variable
memcpy(&glcopy, gfx.gfxlayout, sizeof(gfx_layout));
// copy the X and Y offsets into our temporary arrays
extxoffs.resize(glcopy.width * xscale);
extyoffs.resize(glcopy.height * yscale);
memcpy(&extxoffs[0], glcopy.xoffset, glcopy.width * sizeof(UINT32));
memcpy(&extyoffs[0], glcopy.yoffset, glcopy.height * sizeof(UINT32));
// if there are extended offsets, copy them over top
if (glcopy.extxoffs != NULL)
memcpy(&extxoffs[0], glcopy.extxoffs, glcopy.width * sizeof(UINT32));
if (glcopy.extyoffs != NULL)
memcpy(&extyoffs[0], glcopy.extyoffs, glcopy.height * sizeof(UINT32));
// always use the extended offsets here
glcopy.extxoffs = extxoffs;
glcopy.extyoffs = extyoffs;
// expand X and Y by the scale factors
if (xscale > 1)
{
glcopy.width *= xscale;
for (int j = glcopy.width - 1; j >= 0; j--)
extxoffs[j] = extxoffs[j / xscale];
}
if (yscale > 1)
{
glcopy.height *= yscale;
for (int j = glcopy.height - 1; j >= 0; j--)
extyoffs[j] = extyoffs[j / yscale];
}
// if the character count is a region fraction, compute the effective total
if (IS_FRAC(glcopy.total))
{
assert(region_length != 0);
glcopy.total = region_length / glcopy.charincrement * FRAC_NUM(glcopy.total) / FRAC_DEN(glcopy.total);
}
// for non-raw graphics, decode the X and Y offsets
if (glcopy.planeoffset[0] != GFX_RAW)
{
// loop over all the planes, converting fractions
for (int j = 0; j < glcopy.planes; j++)
{
UINT32 value1 = glcopy.planeoffset[j];
if (IS_FRAC(value1))
{
assert(region_length != 0);
glcopy.planeoffset[j] = FRAC_OFFSET(value1) + region_length * FRAC_NUM(value1) / FRAC_DEN(value1);
}
}
// loop over all the X/Y offsets, converting fractions
for (int j = 0; j < glcopy.width; j++)
{
UINT32 value2 = extxoffs[j];
if (IS_FRAC(value2))
{
assert(region_length != 0);
extxoffs[j] = FRAC_OFFSET(value2) + region_length * FRAC_NUM(value2) / FRAC_DEN(value2);
}
}
for (int j = 0; j < glcopy.height; j++)
{
UINT32 value3 = extyoffs[j];
if (IS_FRAC(value3))
{
assert(region_length != 0);
extyoffs[j] = FRAC_OFFSET(value3) + region_length * FRAC_NUM(value3) / FRAC_DEN(value3);
}
}
}
// otherwise, just use the line modulo
else
{
int base = gfx.start;
int end = region_length/8;
int linemod = glcopy.yoffset[0];
while (glcopy.total > 0)
{
int elementbase = base + (glcopy.total - 1) * glcopy.charincrement / 8;
int lastpixelbase = elementbase + glcopy.height * linemod / 8 - 1;
if (lastpixelbase < end)
break;
glcopy.total--;
}
}
// allocate the graphics
m_gfx[curgfx].reset(global_alloc(gfx_element(m_palette, glcopy, (region_base != NULL) ? region_base + gfx.start : NULL, xormask, gfx.total_color_codes, gfx.color_codes_start)));
}
m_decoded = true;
}
//-------------------------------------------------
// interface_validity_check - validate graphics
// decoding configuration
//-------------------------------------------------
void device_gfx_interface::interface_validity_check(validity_checker &valid) const
{
// validate palette tag
if (m_palette_tag == NULL)
mame_printf_error("No palette specified for device '%s'\n", device().tag());
else
{
palette_device *palette;
if (m_palette_is_sibling)
palette = device().siblingdevice<palette_device>(m_palette_tag);
else
palette = device().subdevice<palette_device>(m_palette_tag);
if (palette == NULL)
mame_printf_error("Device '%s' specifies nonexistent %sdevice '%s' as palette\n",
device().tag(),
(m_palette_is_sibling ? "sibling " : "sub"),
m_palette_tag);
}
if (!m_gfxdecodeinfo)
return;
// validate graphics decoding entries
for (int gfxnum = 0; gfxnum < MAX_GFX_ELEMENTS && m_gfxdecodeinfo[gfxnum].gfxlayout != NULL; gfxnum++)
{
const gfx_decode_entry &gfx = m_gfxdecodeinfo[gfxnum];
const gfx_layout &layout = *gfx.gfxlayout;
// currently we are unable to validate RAM-based entries
const char *region = gfx.memory_region;
if (region != NULL && GFXENTRY_ISROM(gfx.flags))
{
// resolve the region
astring gfxregion;
if (GFXENTRY_ISDEVICE(gfx.flags))
device().subtag(gfxregion, region);
else
device().owner()->subtag(gfxregion, region);
UINT32 region_length = valid.region_length(gfxregion);
if (region_length == 0)
mame_printf_error("gfx[%d] references nonexistent region '%s'\n", gfxnum, gfxregion.cstr());
// if we have a valid region, and we're not using auto-sizing, check the decode against the region length
else if (!IS_FRAC(layout.total))
{
// determine which plane is at the largest offset
int start = 0;
for (int plane = 0; plane < layout.planes; plane++)
if (layout.planeoffset[plane] > start)
start = layout.planeoffset[plane];
start &= ~(layout.charincrement - 1);
// determine the total length based on this info
int len = layout.total * layout.charincrement;
// do we have enough space in the region to cover the whole decode?
int avail = region_length - (gfx.start & ~(layout.charincrement / 8 - 1));
// if not, this is an error
if ((start + len) / 8 > avail)
mame_printf_error("gfx[%d] extends past allocated memory of region '%s'\n", gfxnum, region);
}
}
int xscale = GFXENTRY_GETXSCALE(gfx.flags);
int yscale = GFXENTRY_GETYSCALE(gfx.flags);
// verify raw decode, which can only be full-region and have no scaling
if (layout.planeoffset[0] == GFX_RAW)
{
if (layout.total != RGN_FRAC(1,1))
mame_printf_error("gfx[%d] with unsupported layout total\n", gfxnum);
if (xscale != 1 || yscale != 1)
mame_printf_error("gfx[%d] with unsupported xscale/yscale\n", gfxnum);
}
// verify traditional decode doesn't have too many planes
else
{
if (layout.planes > MAX_GFX_PLANES)
mame_printf_error("gfx[%d] with invalid planes\n", gfxnum);
}
}
}

229
src/emu/digfx.h Normal file
View File

@ -0,0 +1,229 @@
/***************************************************************************
digfx.h
Device graphics interfaces.
***************************************************************************/
#pragma once
#ifndef __EMU_H__
#error Dont include this file directly; include emu.h instead.
#endif
#ifndef __DIGFX_H__
#define __DIGFX_H__
//**************************************************************************
// CONSTANTS
//**************************************************************************
const int MAX_GFX_ELEMENTS = 32;
const int MAX_GFX_PLANES = 8;
const int MAX_GFX_SIZE = 32;
//**************************************************************************
// GRAPHICS LAYOUT MACROS
//**************************************************************************
#define EXTENDED_XOFFS { 0 }
#define EXTENDED_YOFFS { 0 }
#define GFX_RAW 0x12345678
#define GFXLAYOUT_RAW( name, width, height, linemod, charmod ) \
const gfx_layout name = { width, height, RGN_FRAC(1,1), 8, { GFX_RAW }, { 0 }, { linemod }, charmod };
// When planeoffset[0] is set to GFX_RAW, the gfx data is left as-is, with no conversion.
// No buffer is allocated for the decoded data, and gfxdata is set to point to the source
// data.
// xoffset[0] is an optional displacement (*8) from the beginning of the source data, while
// yoffset[0] is the line modulo (*8) and charincrement the char modulo (*8). They are *8
// for consistency with the usual behaviour, but the bottom 3 bits are not used.
//
// This special mode can be used for graphics that are already in 8bpp linear format,
// or for unusual formats that don't fit our generic model and need to be decoded using
// custom code. See blend_gfx() in atarigen.c for an example of the latter usage.
// these macros describe gfx_layouts in terms of fractions of a region
// they can be used for total, planeoffset, xoffset, yoffset
#define RGN_FRAC(num,den) (0x80000000 | (((num) & 0x0f) << 27) | (((den) & 0x0f) << 23))
#define IS_FRAC(offset) ((offset) & 0x80000000)
#define FRAC_NUM(offset) (((offset) >> 27) & 0x0f)
#define FRAC_DEN(offset) (((offset) >> 23) & 0x0f)
#define FRAC_OFFSET(offset) ((offset) & 0x007fffff)
// these macros are useful in gfx_layouts
#define STEP2(START,STEP) (START),(START)+(STEP)
#define STEP4(START,STEP) STEP2(START,STEP),STEP2((START)+2*(STEP),STEP)
#define STEP8(START,STEP) STEP4(START,STEP),STEP4((START)+4*(STEP),STEP)
#define STEP16(START,STEP) STEP8(START,STEP),STEP8((START)+8*(STEP),STEP)
#define STEP32(START,STEP) STEP16(START,STEP),STEP16((START)+16*(STEP),STEP)
#define STEP64(START,STEP) STEP32(START,STEP),STEP32((START)+32*(STEP),STEP)
#define STEP128(START,STEP) STEP64(START,STEP),STEP64((START)+64*(STEP),STEP)
#define STEP256(START,STEP) STEP128(START,STEP),STEP128((START)+128*(STEP),STEP)
#define STEP512(START,STEP) STEP256(START,STEP),STEP256((START)+256*(STEP),STEP)
#define STEP1024(START,STEP) STEP512(START,STEP),STEP512((START)+512*(STEP),STEP)
#define STEP2048(START,STEP) STEP1024(START,STEP),STEP1024((START)+1024*(STEP),STEP)
//**************************************************************************
// GRAPHICS INFO MACROS
//**************************************************************************
// optional horizontal and vertical scaling factors
#define GFXENTRY_XSCALEMASK 0x000000ff
#define GFXENTRY_YSCALEMASK 0x0000ff00
#define GFXENTRY_XSCALE(x) ((((x)-1) << 0) & GFXENTRY_XSCALEMASK)
#define GFXENTRY_YSCALE(x) ((((x)-1) << 8) & GFXENTRY_YSCALEMASK)
#define GFXENTRY_GETXSCALE(x) ((((x) & GFXENTRY_XSCALEMASK) >> 0) + 1)
#define GFXENTRY_GETYSCALE(x) ((((x) & GFXENTRY_YSCALEMASK) >> 8) + 1)
// GFXENTRY_RAM means region tag refers to a RAM share instead of a ROM region
#define GFXENTRY_ROM 0x00000000
#define GFXENTRY_RAM 0x00010000
#define GFXENTRY_ISROM(x) (((x) & GFXENTRY_RAM) == 0)
#define GFXENTRY_ISRAM(x) (((x) & GFXENTRY_RAM) != 0)
// GFXENTRY_DEVICE means region tag is relative to this device instead of its owner
#define GFXENTRY_DEVICE 0x00020000
#define GFXENTRY_ISDEVICE(x) (((x) & GFXENTRY_DEVICE) != 0)
// GFXENTRY_REVERSE reverses the bit order in the layout (0-7 = LSB-MSB instead of MSB-LSB)
#define GFXENTRY_REVERSE 0x00040000
#define GFXENTRY_ISREVERSE(x) (((x) & GFXENTRY_REVERSE) != 0)
// these macros are used for declaring gfx_decode_entry info arrays
#define GFXDECODE_NAME( name ) gfxdecodeinfo_##name
#define GFXDECODE_EXTERN( name ) extern const gfx_decode_entry GFXDECODE_NAME(name)[]
#define GFXDECODE_START( name ) const gfx_decode_entry GFXDECODE_NAME(name)[] = {
#define GFXDECODE_END { 0 } };
// common gfx_decode_entry macros
#define GFXDECODE_ENTRYX(region,offset,layout,start,colors,flags) { region, offset, &layout, start, colors, flags },
#define GFXDECODE_ENTRY(region,offset,layout,start,colors) { region, offset, &layout, start, colors, 0 },
// specialized gfx_decode_entry macros
#define GFXDECODE_RAM(region,offset,layout,start,colors) { region, offset, &layout, start, colors, GFXENTRY_RAM },
#define GFXDECODE_DEVICE(region,offset,layout,start,colors) { region, offset, &layout, start, colors, GFXENTRY_DEVICE },
#define GFXDECODE_DEVICE_RAM(region,offset,layout,start,colors) { region, offset, &layout, start, colors, GFXENTRY_DEVICE | GFXENTRY_RAM },
#define GFXDECODE_SCALE(region,offset,layout,start,colors,x,y) { region, offset, &layout, start, colors, GFXENTRY_XSCALE(x) | GFXENTRY_YSCALE(y) },
#define GFXDECODE_REVERSEBITS(region,offset,layout,start,colors) { region, offset, &layout, start, colors, GFXENTRY_REVERSE },
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_GFX_PALETTE(_palette_tag) \
device_gfx_interface::static_set_palette(*device, _palette_tag);
#define MCFG_GFX_INFO(_info) \
device_gfx_interface::static_set_info(*device, GFXDECODE_NAME(_info));
//**************************************************************************
// DEVICE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_GFXDECODE_ADD(_tag, _palette_tag, _info) \
MCFG_DEVICE_ADD(_tag, GFXDECODE, 0) \
MCFG_GFX_PALETTE(_palette_tag) \
MCFG_GFX_INFO(_info)
#define MCFG_GFXDECODE_MODIFY(_tag, _info) \
MCFG_DEVICE_MODIFY(_tag) \
MCFG_GFX_INFO(_info)
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// forward declarations
class gfx_element;
class palette_device;
struct gfx_layout
{
UINT32 xoffs(int x) const { return (extxoffs != NULL) ? extxoffs[x] : xoffset[x]; }
UINT32 yoffs(int y) const { return (extyoffs != NULL) ? extyoffs[y] : yoffset[y]; }
UINT16 width; // pixel width of each element
UINT16 height; // pixel height of each element
UINT32 total; // total number of elements, or RGN_FRAC()
UINT16 planes; // number of bitplanes
UINT32 planeoffset[MAX_GFX_PLANES]; // bit offset of each bitplane
UINT32 xoffset[MAX_GFX_SIZE]; // bit offset of each horizontal pixel
UINT32 yoffset[MAX_GFX_SIZE]; // bit offset of each vertical pixel
UINT32 charincrement; // distance between two consecutive elements (in bits)
const UINT32 * extxoffs; // extended X offset array for really big layouts
const UINT32 * extyoffs; // extended Y offset array for really big layouts
};
struct gfx_decode_entry
{
const char * memory_region; // memory region where the data resides
UINT32 start; // offset of beginning of data to decode
const gfx_layout *gfxlayout; // pointer to gfx_layout describing the layout; NULL marks the end of the array
UINT16 color_codes_start; // offset in the color lookup table where color codes start
UINT16 total_color_codes; // total number of color codes
UINT32 flags; // flags and optional scaling factors
};
// ======================> device_gfx_interface
class device_gfx_interface : public device_interface
{
public:
// construction/destruction
device_gfx_interface(const machine_config &mconfig, device_t &device,
const gfx_decode_entry *gfxinfo = NULL, const char *palette_tag = NULL);
virtual ~device_gfx_interface();
// static configuration
static void static_set_info(device_t &device, const gfx_decode_entry *gfxinfo);
static void static_set_palette(device_t &device, const char *tag);
// getters
palette_device *palette() const { return m_palette; }
gfx_element *gfx(int index) const { assert(index < MAX_GFX_ELEMENTS); return m_gfx[index]; }
// decoding
void decode_gfx(const gfx_decode_entry *gfxdecodeinfo);
void decode_gfx() { decode_gfx(m_gfxdecodeinfo); }
void set_gfx(int index, gfx_element *element) { assert(index < MAX_GFX_ELEMENTS); m_gfx[index].reset(element); }
protected:
// interface-level overrides
virtual void interface_validity_check(validity_checker &valid) const;
virtual void interface_pre_start();
virtual void interface_post_start();
private:
// configuration
const gfx_decode_entry * m_gfxdecodeinfo; // pointer to array of gfx decode information
const char * m_palette_tag; // configured tag for palette device
bool m_palette_is_sibling; // is palette a sibling or a subdevice?
// internal state
bool m_decoded; // have we processed our decode info yet?
palette_device * m_palette; // pointer to the palette device
auto_pointer<gfx_element> m_gfx[MAX_GFX_ELEMENTS]; // array of pointers to graphic sets
};
// iterator
typedef device_interface_iterator<device_gfx_interface> gfx_interface_iterator;
#endif /* __DIGFX_H__ */

View File

@ -11,7 +11,6 @@
#include "emu.h"
#include "drawgfxm.h"
#include "validity.h"
/***************************************************************************
@ -71,264 +70,13 @@ static inline INT32 normalize_yscroll(bitmap_t &bitmap, INT32 yscroll)
const device_type GFXDECODE = &device_creator<gfxdecode_device>;
gfxdecode_device::gfxdecode_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, GFXDECODE, "gfxdecode", tag, owner, clock, "gfxdecode", __FILE__),
m_palette(*this),
m_gfxdecodeinfo(NULL)
gfxdecode_device::gfxdecode_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, GFXDECODE, "gfxdecode", tag, owner, clock, "gfxdecode", __FILE__),
device_gfx_interface(mconfig, *this)
{
}
//**************************************************************************
// INITIALIZATION AND CONFIGURATION
//**************************************************************************
void gfxdecode_device::static_set_gfxdecodeinfo(device_t &device, const gfx_decode_entry *info)
{
downcast<gfxdecode_device &>(device).m_gfxdecodeinfo = info;
}
void gfxdecode_device::static_set_palette(device_t &device, const char *tag)
{
downcast<gfxdecode_device &>(device).m_palette.set_tag(tag);
}
//-------------------------------------------------
// device_stop - final cleanup
//-------------------------------------------------
void gfxdecode_device::device_stop()
{
}
//-------------------------------------------------
// device_start - start up the device
//-------------------------------------------------
void gfxdecode_device::device_start()
{
const gfx_decode_entry *gfxdecodeinfo = m_gfxdecodeinfo;
int curgfx;
// skip if nothing to do
if (gfxdecodeinfo == NULL)
return;
// loop over all elements
for (curgfx = 0; curgfx < MAX_GFX_ELEMENTS && gfxdecodeinfo[curgfx].gfxlayout != NULL; curgfx++)
{
const gfx_decode_entry *gfxdecode = &gfxdecodeinfo[curgfx];
UINT32 region_length;
const UINT8 *region_base;
// resolve the region
if (gfxdecode->memory_region != NULL)
{
astring gfxregion;
owner()->subtag(gfxregion, gfxdecode->memory_region);
memory_region *region = owner()->memregion(gfxregion);
region_length = 8 * region->bytes();
region_base = region->base();
}
else
{
region_length = 0;
region_base = NULL;
}
UINT32 xscale = (gfxdecode->xscale == 0) ? 1 : gfxdecode->xscale;
UINT32 yscale = (gfxdecode->yscale == 0) ? 1 : gfxdecode->yscale;
UINT32 *extpoffs, extxoffs[MAX_ABS_GFX_SIZE], extyoffs[MAX_ABS_GFX_SIZE];
const gfx_layout *gl = gfxdecode->gfxlayout;
int israw = (gl->planeoffset[0] == GFX_RAW);
int planes = gl->planes;
UINT32 width = gl->width;
UINT32 height = gl->height;
UINT32 total = gl->total;
UINT32 xormask = 0;
UINT32 charincrement = gl->charincrement;
gfx_layout glcopy;
int j;
// make a copy of the layout
glcopy = *gfxdecode->gfxlayout;
// copy the X and Y offsets into temporary arrays
memcpy(extxoffs, glcopy.xoffset, sizeof(glcopy.xoffset));
memcpy(extyoffs, glcopy.yoffset, sizeof(glcopy.yoffset));
// if there are extended offsets, copy them over top
if (glcopy.extxoffs != NULL)
memcpy(extxoffs, glcopy.extxoffs, glcopy.width * sizeof(extxoffs[0]));
if (glcopy.extyoffs != NULL)
memcpy(extyoffs, glcopy.extyoffs, glcopy.height * sizeof(extyoffs[0]));
// always use the extended offsets here
glcopy.extxoffs = extxoffs;
glcopy.extyoffs = extyoffs;
extpoffs = glcopy.planeoffset;
// expand X and Y by the scale factors
if (xscale > 1)
{
width *= xscale;
for (j = width - 1; j >= 0; j--)
extxoffs[j] = extxoffs[j / xscale];
}
if (yscale > 1)
{
height *= yscale;
for (j = height - 1; j >= 0; j--)
extyoffs[j] = extyoffs[j / yscale];
}
// if the character count is a region fraction, compute the effective total
if (IS_FRAC(total))
{
assert(region_length != 0);
total = region_length / charincrement * FRAC_NUM(total) / FRAC_DEN(total);
}
// for non-raw graphics, decode the X and Y offsets
if (!israw)
{
// loop over all the planes, converting fractions
for (j = 0; j < planes; j++)
{
UINT32 value1 = extpoffs[j];
if (IS_FRAC(value1))
{
assert(region_length != 0);
extpoffs[j] = FRAC_OFFSET(value1) + region_length * FRAC_NUM(value1) / FRAC_DEN(value1);
}
}
// loop over all the X/Y offsets, converting fractions
for (j = 0; j < width; j++)
{
UINT32 value2 = extxoffs[j];
if (IS_FRAC(value2))
{
assert(region_length != 0);
extxoffs[j] = FRAC_OFFSET(value2) + region_length * FRAC_NUM(value2) / FRAC_DEN(value2);
}
}
for (j = 0; j < height; j++)
{
UINT32 value3 = extyoffs[j];
if (IS_FRAC(value3))
{
assert(region_length != 0);
extyoffs[j] = FRAC_OFFSET(value3) + region_length * FRAC_NUM(value3) / FRAC_DEN(value3);
}
}
}
// otherwise, just use the line modulo
else
{
int base = gfxdecode->start;
int end = region_length/8;
int linemod = gl->yoffset[0];
while (total > 0)
{
int elementbase = base + (total - 1) * charincrement / 8;
int lastpixelbase = elementbase + height * linemod / 8 - 1;
if (lastpixelbase < end)
break;
total--;
}
}
// update glcopy
glcopy.width = width;
glcopy.height = height;
glcopy.total = total;
// allocate the graphics
m_gfx[curgfx].reset(global_alloc(gfx_element(m_palette, glcopy, (region_base != NULL) ? region_base + gfxdecode->start : NULL, xormask, gfxdecode->total_color_codes, gfxdecode->color_codes_start)));
}
}
//-------------------------------------------------
// device_validity_check - validate graphics decoding
// configuration
//-------------------------------------------------/
void gfxdecode_device::device_validity_check(validity_checker &valid) const
{
// bail if no gfx
if (!m_gfxdecodeinfo)
return;
// iterate over graphics decoding entries
for (int gfxnum = 0; gfxnum < MAX_GFX_ELEMENTS && m_gfxdecodeinfo[gfxnum].gfxlayout != NULL; gfxnum++)
{
const gfx_decode_entry &gfx = m_gfxdecodeinfo[gfxnum];
const gfx_layout &layout = *gfx.gfxlayout;
// make sure the region exists
const char *region = gfx.memory_region;
if (region != NULL)
{
// resolve the region
astring gfxregion;
owner()->subtag(gfxregion, region);
// loop over gfx regions
UINT32 region_length = valid.region_length(gfxregion);
if (region_length == 0)
mame_printf_error("gfx[%d] references non-existent region '%s'\n", gfxnum, gfxregion.cstr());
// if we have a valid region, and we're not using auto-sizing, check the decode against the region length
else if (!IS_FRAC(layout.total))
{
// determine which plane is at the largest offset
int start = 0;
for (int plane = 0; plane < layout.planes; plane++)
if (layout.planeoffset[plane] > start)
start = layout.planeoffset[plane];
start &= ~(layout.charincrement - 1);
// determine the total length based on this info
int len = layout.total * layout.charincrement;
// do we have enough space in the region to cover the whole decode?
int avail = region_length - (gfx.start & ~(layout.charincrement / 8 - 1));
// if not, this is an error
if ((start + len) / 8 > avail)
mame_printf_error("gfx[%d] extends past allocated memory of region '%s'\n", gfxnum, region);
}
}
int xscale = (m_gfxdecodeinfo[gfxnum].xscale == 0) ? 1 : m_gfxdecodeinfo[gfxnum].xscale;
int yscale = (m_gfxdecodeinfo[gfxnum].yscale == 0) ? 1 : m_gfxdecodeinfo[gfxnum].yscale;
// verify raw decode, which can only be full-region and have no scaling
if (layout.planeoffset[0] == GFX_RAW)
{
if (layout.total != RGN_FRAC(1,1))
mame_printf_error("gfx[%d] with unsupported layout total\n", gfxnum);
if (xscale != 1 || yscale != 1)
mame_printf_error("gfx[%d] with unsupported xscale/yscale\n", gfxnum);
}
// verify traditional decode doesn't have too many planes or is not too large
else
{
if (layout.planes > MAX_GFX_PLANES)
mame_printf_error("gfx[%d] with invalid planes\n", gfxnum);
if (xscale * layout.width > MAX_ABS_GFX_SIZE || yscale * layout.height > MAX_ABS_GFX_SIZE)
mame_printf_error("gfx[%d] with invalid xscale/yscale\n", gfxnum);
}
}
}
/***************************************************************************
@ -443,7 +191,7 @@ void gfx_element::set_layout(const gfx_layout &gl, const UINT8 *srcdata)
if (m_layout_is_raw)
{
// modulos are determined for us by the layout
m_line_modulo = ((gl.extyoffs != NULL) ? gl.extyoffs[0] : gl.yoffset[0]) / 8;
m_line_modulo = gl.yoffs(0) / 8;
m_char_modulo = gl.charincrement / 8;
// RAW graphics must have a pointer up front

View File

@ -19,49 +19,10 @@
#define __DRAWGFX_H__
//**************************************************************************
// DEVICE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_GFXDECODE_ADD(_tag, _palette_tag, _info) \
MCFG_DEVICE_ADD(_tag, GFXDECODE, 0) \
MCFG_GFX_PALETTE(_palette_tag) \
MCFG_GFXDECODE_INFO(_info) \
#define MCFG_GFX_PALETTE(_palette_tag) \
gfxdecode_device::static_set_palette(*device, "^" _palette_tag);
#define MCFG_GFXDECODE_INFO(_info) \
gfxdecode_device::static_set_gfxdecodeinfo(*device, GFXDECODE_NAME(_info));
#define MCFG_GFXDECODE_MODIFY(_tag, _info) \
MCFG_DEVICE_MODIFY(_tag) \
MCFG_GFXDECODE_INFO(_info) \
/***************************************************************************
CONSTANTS
***************************************************************************/
#define MAX_GFX_PLANES 8
#define MAX_GFX_SIZE 32
#define MAX_ABS_GFX_SIZE 1024
#define EXTENDED_XOFFS { 0 }
#define EXTENDED_YOFFS { 0 }
#define GFX_RAW 0x12345678
// When planeoffset[0] is set to GFX_RAW, the gfx data is left as-is, with no conversion.
// No buffer is allocated for the decoded data, and gfxdata is set to point to the source
// data.
// xoffset[0] is an optional displacement (*8) from the beginning of the source data, while
// yoffset[0] is the line modulo (*8) and charincrement the char modulo (*8). They are *8
// for consistency with the usual behaviour, but the bottom 3 bits are not used.
// This special mode can be used to save memory in games that require several different
// handlings of the same ROM data (e.g. metro.c can use both 4bpp and 8bpp tiles, and both
// 8x8 and 16x16; cps.c has 8x8, 16x16 and 32x32 tiles all fetched from the same ROMs).
enum
{
DRAWMODE_NONE,
@ -71,68 +32,10 @@ enum
/***************************************************************************
MACROS
***************************************************************************/
// these macros describe gfx_layouts in terms of fractions of a region
// they can be used for total, planeoffset, xoffset, yoffset
#define RGN_FRAC(num,den) (0x80000000 | (((num) & 0x0f) << 27) | (((den) & 0x0f) << 23))
#define IS_FRAC(offset) ((offset) & 0x80000000)
#define FRAC_NUM(offset) (((offset) >> 27) & 0x0f)
#define FRAC_DEN(offset) (((offset) >> 23) & 0x0f)
#define FRAC_OFFSET(offset) ((offset) & 0x007fffff)
// these macros are useful in gfx_layouts
#define STEP2(START,STEP) (START),(START)+(STEP)
#define STEP4(START,STEP) STEP2(START,STEP),STEP2((START)+2*(STEP),STEP)
#define STEP8(START,STEP) STEP4(START,STEP),STEP4((START)+4*(STEP),STEP)
#define STEP16(START,STEP) STEP8(START,STEP),STEP8((START)+8*(STEP),STEP)
#define STEP32(START,STEP) STEP16(START,STEP),STEP16((START)+16*(STEP),STEP)
#define STEP64(START,STEP) STEP32(START,STEP),STEP32((START)+32*(STEP),STEP)
#define STEP128(START,STEP) STEP64(START,STEP),STEP64((START)+64*(STEP),STEP)
#define STEP256(START,STEP) STEP128(START,STEP),STEP128((START)+128*(STEP),STEP)
#define STEP512(START,STEP) STEP256(START,STEP),STEP256((START)+256*(STEP),STEP)
#define STEP1024(START,STEP) STEP512(START,STEP),STEP512((START)+512*(STEP),STEP)
#define STEP2048(START,STEP) STEP1024(START,STEP),STEP1024((START)+1024*(STEP),STEP)
// these macros are used for declaring gfx_decode_entry_entry info arrays.
#define GFXDECODE_NAME( name ) gfxdecodeinfo_##name
#define GFXDECODE_EXTERN( name ) extern const gfx_decode_entry GFXDECODE_NAME(name)[]
#define GFXDECODE_START( name ) const gfx_decode_entry GFXDECODE_NAME(name)[] = {
#define GFXDECODE_ENTRY(region,offset,layout,start,colors) { region, offset, &layout, start, colors, 0, 0 },
#define GFXDECODE_SCALE(region,offset,layout,start,colors,xscale,yscale) { region, offset, &layout, start, colors, xscale, yscale },
#define GFXDECODE_END { 0 } };
// these macros are used for declaring gfx_layout structures.
#define GFXLAYOUT_RAW( name, width, height, linemod, charmod ) \
const gfx_layout name = { width, height, RGN_FRAC(1,1), 8, { GFX_RAW }, { 0 }, { linemod }, charmod };
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
struct gfx_layout
{
UINT32 xoffs(int x) const { return (extxoffs != NULL) ? extxoffs[x] : xoffset[x]; }
UINT32 yoffs(int y) const { return (extyoffs != NULL) ? extyoffs[y] : yoffset[y]; }
UINT16 width; // pixel width of each element
UINT16 height; // pixel height of each element
UINT32 total; // total number of elements, or RGN_FRAC()
UINT16 planes; // number of bitplanes
UINT32 planeoffset[MAX_GFX_PLANES]; // bit offset of each bitplane
UINT32 xoffset[MAX_GFX_SIZE]; // bit offset of each horizontal pixel
UINT32 yoffset[MAX_GFX_SIZE]; // bit offset of each vertical pixel
UINT32 charincrement; // distance between two consecutive elements (in bits)
const UINT32 * extxoffs; // extended X offset array for really big layouts
const UINT32 * extyoffs; // extended Y offset array for really big layouts
};
class gfx_element
{
public:
@ -291,19 +194,6 @@ private:
};
struct gfx_decode_entry
{
const char * memory_region; // memory region where the data resides
UINT32 start; // offset of beginning of data to decode
const gfx_layout *gfxlayout; // pointer to gfx_layout describing the layout; NULL marks the end of the array
UINT16 color_codes_start; // offset in the color lookup table where color codes start
UINT16 total_color_codes; // total number of color codes
UINT8 xscale; // optional horizontal scaling factor; 0 means 1x
UINT8 yscale; // optional vertical scaling factor; 0 means 1x
};
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
@ -449,37 +339,16 @@ inline UINT32 alpha_blend_r32(UINT32 d, UINT32 s, UINT8 level)
// device type definition
extern const device_type GFXDECODE;
class gfxdecode_device : public device_t
class gfxdecode_device : public device_t, public device_gfx_interface
{
public:
// construction/destruction
gfxdecode_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// static configuration
static void static_set_gfxdecodeinfo(device_t &device, const gfx_decode_entry *info);
static void static_set_palette(device_t &device, const char *tag);
palette_device *palette() const { return m_palette; }
gfx_element * gfx(int index) { assert(index < MAX_GFX_ELEMENTS); return m_gfx[index]; }
void set_gfx(int index, gfx_element * val) { assert(index < MAX_GFX_ELEMENTS); m_gfx[index].reset(val); }
protected:
// device-level overrides
virtual void device_validity_check(validity_checker &valid) const;
virtual void device_start();
virtual void device_stop();
private:
// devices
required_device<palette_device> m_palette; // default palette assigned to gfx_elements
// configuration state
const gfx_decode_entry *m_gfxdecodeinfo; // pointer to array of graphics decoding information
auto_pointer<gfx_element> m_gfx[MAX_GFX_ELEMENTS]; // array of pointers to graphic sets (chars, sprites)
virtual void device_start() {};
};
// device type iterator
typedef device_type_iterator<&device_creator<gfxdecode_device>, gfxdecode_device> gfxdecode_device_iterator;
GFXDECODE_EXTERN(empty);
#endif // __DRAWGFX_H__

View File

@ -66,6 +66,7 @@ typedef device_t * (*machine_config_constructor)(machine_config &config, device_
#include "dimemory.h"
#include "diexec.h"
#include "opresolv.h"
#include "digfx.h"
#include "diimage.h"
#include "dioutput.h"
#include "diserial.h"

View File

@ -65,6 +65,7 @@ EMUOBJS = \
$(EMUOBJ)/device.o \
$(EMUOBJ)/didisasm.o \
$(EMUOBJ)/diexec.o \
$(EMUOBJ)/digfx.o \
$(EMUOBJ)/diimage.o \
$(EMUOBJ)/dimemory.o \
$(EMUOBJ)/dinetwork.o \

View File

@ -25,9 +25,6 @@
// CONSTANTS
//**************************************************************************
const int MAX_GFX_ELEMENTS = 32;
// machine phases
enum machine_phase
{

View File

@ -343,7 +343,7 @@ tilemap_t::tilemap_t()
// init - initialize the tilemap
//-------------------------------------------------
tilemap_t &tilemap_t::init(tilemap_manager &manager, gfxdecode_device &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows)
tilemap_t &tilemap_t::init(tilemap_manager &manager, device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows)
{
// populate managers and devices
m_manager = &manager;
@ -1515,14 +1515,14 @@ static const struct
{ FUNC(tilemap_t::scan_cols_flip_xy) }
};
tilemap_t &tilemap_manager::create(gfxdecode_device &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated)
tilemap_t &tilemap_manager::create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated)
{
if (allocated == NULL)
allocated = global_alloc(tilemap_t);
return m_tilemap_list.append(allocated->init(*this, decoder, tile_get_info, mapper, tilewidth, tileheight, cols, rows));
}
tilemap_t &tilemap_manager::create(gfxdecode_device &decoder, tilemap_get_info_delegate tile_get_info, tilemap_standard_mapper mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated)
tilemap_t &tilemap_manager::create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_standard_mapper mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated)
{
if (allocated == NULL)
allocated = global_alloc(tilemap_t);

View File

@ -429,7 +429,7 @@ typedef UINT32 tilemap_memory_index;
// tile_data is filled in by the get_tile_info callback
struct tile_data
{
gfxdecode_device *decoder; // set in tilemap_t::init()
device_gfx_interface *decoder; // set in tilemap_t::init()
const UINT8 * pen_data; // required
const UINT8 * mask_data; // required
pen_t palette_base; // defaults to 0
@ -485,7 +485,7 @@ protected:
tilemap_t();
virtual ~tilemap_t();
tilemap_t &init(tilemap_manager &manager, gfxdecode_device &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows);
tilemap_t &init(tilemap_manager &manager, device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows);
public:
// getters
@ -684,8 +684,8 @@ public:
running_machine &machine() const { return m_machine; }
// tilemap creation
tilemap_t &create(gfxdecode_device &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated = NULL);
tilemap_t &create(gfxdecode_device &decoder, tilemap_get_info_delegate tile_get_info, tilemap_standard_mapper mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated = NULL);
tilemap_t &create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated = NULL);
tilemap_t &create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_standard_mapper mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated = NULL);
// tilemap list information
tilemap_t *find(int index) { return m_tilemap_list.find(index); }

View File

@ -41,7 +41,7 @@ const int MAX_GFX_DECODERS = 8;
// information about a single gfx device
struct ui_gfx_info
{
gfxdecode_device *device; // pointer to device
device_gfx_interface *interface; // pointer to device's gfx interface
UINT8 setcount; // how many gfx sets device has
UINT8 rotate[MAX_GFX_ELEMENTS]; // current rotation (orientation) value
UINT8 columns[MAX_GFX_ELEMENTS]; // number of items per row
@ -169,36 +169,36 @@ void ui_gfx_init(running_machine &machine)
static void ui_gfx_count_devices(running_machine &machine, ui_gfx_state &state)
{
palette_device_iterator pal_deviter(machine.root_device());
gfxdecode_device_iterator gfx_deviter(machine.root_device());
palette_device_iterator pal_iter(machine.root_device());
gfx_interface_iterator gfx_iter(machine.root_device());
// count the palette devices
state.palette.devcount = pal_deviter.count();
state.palette.devcount = pal_iter.count();
// set the pointer to the first palette
if (state.palette.devcount > 0)
palette_set_device(machine, state);
// count the gfx decoders
// count the gfx devices
state.gfxset.devcount = 0;
int tempcount = gfx_deviter.count();
int tempcount = gfx_iter.count();
// count the gfx sets in each decoder
// count the gfx sets in each device, skipping devices with none
if (tempcount > 0)
{
gfxdecode_device *m_gfxdecode;
device_gfx_interface *interface;
int i, count;
for (i = 0, m_gfxdecode = gfx_deviter.first();
for (i = 0, interface = gfx_iter.first();
i < tempcount && state.gfxset.devcount < MAX_GFX_DECODERS;
i++, m_gfxdecode = gfx_deviter.next())
i++, interface = gfx_iter.next())
{
for (count = 0; count < MAX_GFX_ELEMENTS && m_gfxdecode->gfx(count) != NULL; count++);
for (count = 0; count < MAX_GFX_ELEMENTS && interface->gfx(count) != NULL; count++);
// count = index of first NULL
if (count > 0)
{
state.gfxdev[state.gfxset.devcount].device = m_gfxdecode;
state.gfxdev[state.gfxset.devcount].interface = interface;
state.gfxdev[state.gfxset.devcount].setcount = count;
state.gfxset.devcount++;
}
@ -341,8 +341,8 @@ cancel:
static void palette_set_device(running_machine &machine, ui_gfx_state &state)
{
palette_device_iterator pal_deviter(machine.root_device());
state.palette.device = pal_deviter.byindex(state.palette.devindex);
palette_device_iterator pal_iter(machine.root_device());
state.palette.device = pal_iter.byindex(state.palette.devindex);
}
@ -564,8 +564,8 @@ static void gfxset_handler(running_machine &machine, render_container *container
int dev = state.gfxset.devindex;
int set = state.gfxset.set;
ui_gfx_info &info = state.gfxdev[dev];
gfxdecode_device &m_gfxdecode = *info.device;
gfx_element &gfx = *m_gfxdecode.gfx(set);
device_gfx_interface &interface = *info.interface;
gfx_element &gfx = *interface.gfx(set);
float fullwidth, fullheight;
float cellwidth, cellheight;
float chwidth, chheight;
@ -649,7 +649,7 @@ static void gfxset_handler(running_machine &machine, render_container *container
// figure out the title and expand the outer box to fit
sprintf(title, "'%s' %d/%d %dx%d COLOR %X",
m_gfxdecode.tag(),
interface.device().tag(),
set, info.setcount - 1,
gfx.width(), gfx.height(),
info.color[set]);
@ -758,7 +758,7 @@ static void gfxset_handle_keys(running_machine &machine, ui_gfx_state &state, in
int dev = state.gfxset.devindex;
int set = state.gfxset.set;
ui_gfx_info &info = state.gfxdev[dev];
gfx_element &gfx = *info.device->gfx(set);
gfx_element &gfx = *info.interface->gfx(set);
// handle cells per line (minus,plus)
if (ui_input_pressed(machine, IPT_UI_ZOOM_OUT))

View File

@ -281,7 +281,6 @@ void validity_checker::validate_one(const game_driver &driver)
validate_driver();
validate_roms();
validate_inputs();
validate_display();
validate_devices();
}
catch (emu_fatalerror &err)
@ -692,25 +691,6 @@ void validity_checker::validate_roms()
}
//-------------------------------------------------
// validate_display - validate display
// configurations
//-------------------------------------------------
void validity_checker::validate_display()
{
// iterate over screen devices looking for paletted screens
screen_device_iterator iter(m_current_config->root_device());
for (const screen_device *scrconfig = iter.first(); scrconfig != NULL; scrconfig = iter.next())
if (scrconfig->format() == BITMAP_FORMAT_IND16)
{
// check for empty palette
//if (scrconfig->palette()->entries() == 0)
// mame_printf_error("Driver has zero palette entries but uses a palette-based bitmap format\n");
}
}
//-------------------------------------------------
// validate_analog_input_field - validate an
// analog input field

View File

@ -66,7 +66,6 @@ private:
void validate_inlines();
void validate_driver();
void validate_roms();
void validate_display();
void validate_analog_input_field(ioport_field &field);
void validate_dip_settings(ioport_field &field);
void validate_condition(ioport_condition &condition, device_t &device, int_map &port_map);

View File

@ -1318,150 +1318,109 @@ INPUT_PORTS_END
/******************************************************************************/
#define XOR(x) ((x)^NATIVE_ENDIAN_VALUE_LE_BE(8,0))
static const gfx_layout charlayout =
{
8,8, /* 8*8 characters */
2048, /* 2048 characters (+ blank one) */
RGN_FRAC(1,1),
4, /* 4 bits per pixel */
{ 0, 1, 2, 3 }, /* the two bitplanes are merged in the same nibble */
{ XOR(0*4), XOR(1*4), XOR(2*4), XOR(3*4), XOR(4*4), XOR(5*4), XOR(6*4), XOR(7*4) },
{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
32*8 /* every char takes 32 consecutive bytes */
{ STEP8(0, 4) },
{ STEP8(0, 4*8) },
4*8*8
};
static const gfx_layout spritelayout =
{
16,16, /* 16*16 sprites */
512, /* 512 sprites */
RGN_FRAC(1,1),
4, /* 4 bits per pixel */
{ 0, 1, 2, 3 }, /* the two bitplanes are merged in the same nibble */
{ XOR(0*4), XOR(1*4), XOR(2*4), XOR(3*4), XOR(4*4), XOR(5*4), XOR(6*4), XOR(7*4),
XOR(8*4), XOR(9*4), XOR(10*4), XOR(11*4), XOR(12*4), XOR(13*4), XOR(14*4), XOR(15*4) },
{ 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64,
8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
128*8 /* every sprite takes 128 consecutive bytes */
{ STEP16(0, 4) },
{ STEP16(0, 4*16) },
4*16*16
};
static const gfx_layout spritelayout3216 =
{
32,16, /* 32*16 sprites */
256, /* 256 sprites */
RGN_FRAC(1,1),
4, /* 4 bits per pixel */
{ 0, 1, 2, 3 }, /* the two bitplanes are merged in the same nibble */
{ XOR(0*4), XOR(1*4), XOR(2*4), XOR(3*4), XOR(4*4), XOR(5*4), XOR(6*4), XOR(7*4),
XOR(8*4), XOR(9*4), XOR(10*4), XOR(11*4), XOR(12*4), XOR(13*4), XOR(14*4), XOR(15*4),
XOR(16*4),XOR(17*4), XOR(18*4), XOR(19*4), XOR(20*4), XOR(21*4), XOR(22*4), XOR(23*4),
XOR(24*4),XOR(25*4), XOR(26*4), XOR(27*4), XOR(28*4), XOR(29*4), XOR(30*4), XOR(31*4)},
{ 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128,
8*128, 9*128, 10*128, 11*128, 12*128, 13*128, 14*128, 15*128 },
256*8 /* every sprite takes 128 consecutive bytes */
{ STEP32(0, 4) },
{ STEP16(0, 4*32) },
4*32*16
};
static const gfx_layout spritelayout1632 =
{
16,32, /* 16*32 sprites */
256, /* 256 sprites */
RGN_FRAC(1,1),
4, /* 4 bits per pixel */
{ 0, 1, 2, 3 }, /* the two bitplanes are merged in the same nibble */
{ XOR(0*4), XOR(1*4), XOR(2*4), XOR(3*4), XOR(4*4), XOR(5*4), XOR(6*4), XOR(7*4),
XOR(8*4), XOR(9*4), XOR(10*4), XOR(11*4), XOR(12*4), XOR(13*4), XOR(14*4), XOR(15*4)},
{ 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64,
8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64,
16*64, 17*64, 18*64, 19*64, 20*64, 21*64, 22*64, 23*64,
24*64, 25*64, 26*64, 27*64, 28*64, 29*64, 30*64, 31*64},
256*8 /* every sprite takes 128 consecutive bytes */
{ STEP16(0, 4) },
{ STEP32(0, 4*16) },
4*16*32
};
static const gfx_layout spritelayout3232 =
{
32,32, /* 32*32 sprites */
128, /* 128 sprites */
RGN_FRAC(1,1),
4, /* 4 bits per pixel */
{ 0, 1, 2, 3 }, /* the two bitplanes are merged in the same nibble */
{ XOR(0*4), XOR(1*4), XOR(2*4), XOR(3*4), XOR(4*4), XOR(5*4), XOR(6*4), XOR(7*4),
XOR(8*4), XOR(9*4), XOR(10*4), XOR(11*4), XOR(12*4), XOR(13*4), XOR(14*4), XOR(15*4),
XOR(16*4),XOR(17*4), XOR(18*4), XOR(19*4), XOR(20*4), XOR(21*4), XOR(22*4), XOR(23*4),
XOR(24*4),XOR(25*4), XOR(26*4), XOR(27*4), XOR(28*4), XOR(29*4), XOR(30*4), XOR(31*4)},
{ 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128,
8*128, 9*128, 10*128, 11*128, 12*128, 13*128, 14*128, 15*128,
16*128, 17*128, 18*128, 19*128, 20*128, 21*128, 22*128, 23*128,
24*128, 25*128, 26*128, 27*128, 28*128, 29*128, 30*128, 31*128},
512*8 /* every sprite takes 128 consecutive bytes */
{ STEP32(0, 4) },
{ STEP32(0, 4*32) },
4*32*32
};
static const gfx_layout spritelayout816 =
{
8,16, /* 16*16 sprites */
1024, /* 1024 sprites */
8,16, /* 8*16 sprites */
RGN_FRAC(1,1),
4, /* 4 bits per pixel */
{ 0, 1, 2, 3 }, /* the two bitplanes are merged in the same nibble */
{ XOR(0*4), XOR(1*4), XOR(2*4), XOR(3*4), XOR(4*4), XOR(5*4), XOR(6*4), XOR(7*4)},
{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32 },
64*8 /* every sprite takes 128 consecutive bytes */
{ STEP8(0, 4) },
{ STEP16(0, 4*8) },
4*8*16
};
static const gfx_layout spritelayout168 =
{
16,8, /* 16*8 sprites */
1024, /* 1024 sprites */
RGN_FRAC(1,1),
4, /* 4 bits per pixel */
{ 0, 1, 2, 3 }, /* the two bitplanes are merged in the same nibble */
{ XOR(0*4), XOR(1*4), XOR(2*4), XOR(3*4), XOR(4*4), XOR(5*4), XOR(6*4), XOR(7*4),
XOR(8*4), XOR(9*4), XOR(10*4), XOR(11*4), XOR(12*4), XOR(13*4), XOR(14*4), XOR(15*4)},
{ 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64},
64*8 /* every sprite takes 128 consecutive bytes */
{ STEP16(0, 4) },
{ STEP8(0, 4*16) },
4*16*8
};
static const UINT32 spritelayout6464_xoffset[64] =
{
XOR(0*4), XOR(1*4), XOR(2*4), XOR(3*4), XOR(4*4), XOR(5*4), XOR(6*4), XOR(7*4),
XOR(8*4), XOR(9*4), XOR(10*4), XOR(11*4), XOR(12*4), XOR(13*4), XOR(14*4), XOR(15*4),
XOR(16*4),XOR(17*4), XOR(18*4), XOR(19*4), XOR(20*4), XOR(21*4), XOR(22*4), XOR(23*4),
XOR(24*4),XOR(25*4), XOR(26*4), XOR(27*4), XOR(28*4), XOR(29*4), XOR(30*4), XOR(31*4),
XOR(32*4),XOR(33*4), XOR(34*4), XOR(35*4), XOR(36*4), XOR(37*4), XOR(38*4), XOR(39*4),
XOR(40*4),XOR(41*4), XOR(42*4), XOR(43*4), XOR(44*4), XOR(45*4), XOR(46*4), XOR(47*4),
XOR(48*4),XOR(49*4), XOR(50*4), XOR(51*4), XOR(52*4), XOR(53*4), XOR(54*4), XOR(55*4),
XOR(56*4),XOR(57*4), XOR(58*4), XOR(59*4), XOR(60*4), XOR(61*4), XOR(62*4), XOR(63*4)
};
static const UINT32 spritelayout6464_xoffset[64] = { STEP64(0, 4) };
static const UINT32 spritelayout6464_yoffset[64] =
{
0*256, 1*256, 2*256, 3*256, 4*256, 5*256, 6*256, 7*256,
8*256, 9*256, 10*256, 11*256, 12*256, 13*256, 14*256, 15*256,
16*256, 17*256, 18*256, 19*256, 20*256, 21*256, 22*256, 23*256,
24*256, 25*256, 26*256, 27*256, 28*256, 29*256, 30*256, 31*256,
32*256, 33*256, 34*256, 35*256, 36*256, 37*256, 38*256, 39*256,
40*256, 41*256, 42*256, 43*256, 44*256, 45*256, 46*256, 47*256,
48*256, 49*256, 50*256, 51*256, 52*256, 53*256, 54*256, 55*256,
56*256, 57*256, 58*256, 59*256, 60*256, 61*256, 62*256, 63*256
};
static const UINT32 spritelayout6464_yoffset[64] = { STEP64(0, 4*64) };
static const gfx_layout spritelayout6464 =
{
64,64, /* 32*32 sprites */
32, /* 128 sprites */
64,64, /* 64*64 sprites */
RGN_FRAC(1,1),
4, /* 4 bits per pixel */
{ 0, 1, 2, 3 },
EXTENDED_XOFFS,
EXTENDED_YOFFS,
2048*8, /* every sprite takes 128 consecutive bytes */
4*64*64,
spritelayout6464_xoffset,
spritelayout6464_yoffset
};
static GFXDECODE_START( nemesis )
GFXDECODE_ENTRY( NULL, 0x0, charlayout, 0, 0x80 ) /* the game dynamically modifies this */
GFXDECODE_ENTRY( NULL, 0x0, spritelayout, 0, 0x80 ) /* the game dynamically modifies this */
GFXDECODE_ENTRY( NULL, 0x0, spritelayout3216, 0, 0x80 ) /* the game dynamically modifies this */
GFXDECODE_ENTRY( NULL, 0x0, spritelayout816, 0, 0x80 ) /* the game dynamically modifies this */
GFXDECODE_ENTRY( NULL, 0x0, spritelayout3232, 0, 0x80 ) /* the game dynamically modifies this */
GFXDECODE_ENTRY( NULL, 0x0, spritelayout1632, 0, 0x80 ) /* the game dynamically modifies this */
GFXDECODE_ENTRY( NULL, 0x0, spritelayout168, 0, 0x80 ) /* the game dynamically modifies this */
GFXDECODE_ENTRY( NULL, 0x0, spritelayout6464, 0, 0x80 ) /* the game dynamically modifies this */
GFXDECODE_RAM( "charram", 0x0, charlayout, 0, 0x80 )
GFXDECODE_RAM( "charram", 0x0, spritelayout, 0, 0x80 )
GFXDECODE_RAM( "charram", 0x0, spritelayout3216, 0, 0x80 )
GFXDECODE_RAM( "charram", 0x0, spritelayout816, 0, 0x80 )
GFXDECODE_RAM( "charram", 0x0, spritelayout3232, 0, 0x80 )
GFXDECODE_RAM( "charram", 0x0, spritelayout1632, 0, 0x80 )
GFXDECODE_RAM( "charram", 0x0, spritelayout168, 0, 0x80 )
GFXDECODE_RAM( "charram", 0x0, spritelayout6464, 0, 0x80 )
GFXDECODE_END
/******************************************************************************/

View File

@ -431,8 +431,8 @@ INPUT_PORTS_END
/*** GFX Decodes *************************************************************/
/* We can't decode the sprite data like this because it isn't tile based.
Note that the bit indexes in these layouts are inverted compared to usual
MAME gfx layouts (0 = LSB, 7 = MSB) */
Note that the bit indexes are reversed compared to usual gfx layouts
(0-7 = LSB to MSB) */
static const gfx_layout pgm8_charlayout =
{
@ -463,8 +463,8 @@ static const gfx_layout pgm32_charlayout =
};
GFXDECODE_START( pgm )
GFXDECODE_ENTRY( "tiles", 0, pgm8_charlayout, 0x800, 32 ) /* 8x8x4 Tiles */
GFXDECODE_ENTRY( "tiles", 0, pgm32_charlayout, 0x400, 32 ) /* 32x32x5 Tiles */
GFXDECODE_REVERSEBITS( "tiles", 0, pgm8_charlayout, 0x800, 32 ) /* 8x8x4 Tiles */
GFXDECODE_REVERSEBITS( "tiles", 0, pgm32_charlayout, 0x400, 32 ) /* 32x32x5 Tiles */
GFXDECODE_END
/*** Machine Driver **********************************************************/

View File

@ -1771,18 +1771,6 @@ static const gfx_layout tilelayout =
16*8 /* every tile takes 16 consecutive bytes */
};
static const gfx_layout rallybik_spr_layout =
{
16,16, /* 16*16 sprites */
RGN_FRAC(1,4), /* 2048 sprites */
4, /* 4 bits per pixel */
{ RGN_FRAC(0,4), RGN_FRAC(1,4), RGN_FRAC(2,4), RGN_FRAC(3,4) },
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
32*8 /* every sprite takes 32 consecutive bytes */
};
static GFXDECODE_START( toaplan1 )
GFXDECODE_ENTRY( "gfx1", 0x00000, tilelayout, 0, 64 )
@ -1791,7 +1779,6 @@ GFXDECODE_END
static GFXDECODE_START( rallybik )
GFXDECODE_ENTRY( "gfx1", 0x00000, tilelayout, 0, 64 )
GFXDECODE_ENTRY( "gfx2", 0x00000, rallybik_spr_layout, 64*16, 64 )
GFXDECODE_END
@ -1825,8 +1812,7 @@ static MACHINE_CONFIG_START( rallybik, toaplan1_rallybik_state )
MCFG_SCREEN_VBLANK_DRIVER(toaplan1_rallybik_state, screen_eof_rallybik)
MCFG_SCREEN_PALETTE("palette")
MCFG_TOAPLAN_SCU_ADD("toaplan_scu")
MCFG_TOAPLAN_SCU_GFXDECODE("gfxdecode")
MCFG_TOAPLAN_SCU_ADD("scu", "palette", 31, 15)
MCFG_GFXDECODE_ADD("gfxdecode", "palette", rallybik)
MCFG_PALETTE_ADD("palette", (64*16)+(64*16))
@ -2133,7 +2119,7 @@ ROM_START( rallybik )
ROM_LOAD16_BYTE( "b45-07.bin", 0x40000, 0x20000, CRC(cd3748b4) SHA1(a20eb19a0f813112b4e5d9cd91db29de9b37af17) )
ROM_LOAD16_BYTE( "b45-06.bin", 0x40001, 0x20000, CRC(144b085c) SHA1(84b7412d58fe9c5e9915896db92e80a621571b74) )
ROM_REGION( 0x40000, "gfx2", 0 )
ROM_REGION( 0x40000, "scu", 0 )
ROM_LOAD( "b45-11.rom", 0x00000, 0x10000, CRC(0d56e8bb) SHA1(c29cb53f846c73b7cf9936051fb0f9dd3805f53f) )
ROM_LOAD( "b45-10.rom", 0x10000, 0x10000, CRC(dbb7c57e) SHA1(268132965cd65b5e972ca9d0258c30b8a86f3703) )
ROM_LOAD( "b45-12.rom", 0x20000, 0x10000, CRC(cf5aae4e) SHA1(5832c52d2e9b86414d8ee2926fa190abe9e41da4) )

View File

@ -639,23 +639,10 @@ static const gfx_layout tilelayout =
8*8 /* every tile takes 8 consecutive bytes */
};
static const gfx_layout spritelayout =
{
16,16, /* 16*16 sprites */
RGN_FRAC(1,4), /* 2048 sprites */
4, /* 4 bits per pixel */
{ RGN_FRAC(0,4), RGN_FRAC(1,4), RGN_FRAC(2,4), RGN_FRAC(3,4) },
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
32*8 /* every sprite takes 32 consecutive bytes */
};
static GFXDECODE_START( twincobr )
GFXDECODE_ENTRY( "gfx1", 0x00000, charlayout, 1536, 32 ) /* colors 1536-1791 */
GFXDECODE_ENTRY( "gfx2", 0x00000, tilelayout, 1280, 16 ) /* colors 1280-1535 */
GFXDECODE_ENTRY( "gfx3", 0x00000, tilelayout, 1024, 16 ) /* colors 1024-1079 */
GFXDECODE_ENTRY( "gfx4", 0x00000, spritelayout, 0, 64 ) /* colors 0-1023 */
GFXDECODE_END
@ -692,8 +679,7 @@ static MACHINE_CONFIG_START( twincobr, twincobr_state )
/* video hardware */
MCFG_MC6845_ADD("crtc", HD6845, "screen", XTAL_28MHz/8, twincobr_mc6845_intf) /* 3.5MHz measured on CLKin */
MCFG_TOAPLAN_SCU_ADD("toaplan_scu")
MCFG_TOAPLAN_SCU_GFXDECODE("gfxdecode")
MCFG_TOAPLAN_SCU_ADD("scu", "palette", 31, 15)
MCFG_BUFFERED_SPRITERAM16_ADD("spriteram16")
@ -719,7 +705,13 @@ static MACHINE_CONFIG_START( twincobr, twincobr_state )
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( fsharkbt, twincobr )
static MACHINE_CONFIG_DERIVED( fshark, twincobr )
MCFG_DEVICE_MODIFY("scu")
toaplan_scu_device::static_set_xoffsets(*device, 32, 14);
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( fsharkbt, fshark )
MCFG_CPU_ADD("mcu", I8741, XTAL_28MHz/16)
/* Program Map is internal to the CPU */
@ -772,7 +764,7 @@ ROM_START( twincobr )
ROM_LOAD( "b30_10.12c", 0x10000, 0x08000, CRC(170c01db) SHA1(f4c5a1600f6cbb48abbace66c6f7514f79138e8b) )
ROM_LOAD( "b30_09.10c", 0x18000, 0x08000, CRC(44f5accd) SHA1(2f9bdebe71c8be195332356df68992fd38d86994) )
ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */
ROM_REGION( 0x40000, "scu", 0 ) /* sprites */
ROM_LOAD( "b30_20.12d", 0x00000, 0x10000, CRC(cb4092b8) SHA1(35b1d1e04af760fa106124bd5a94174d63ff9705) )
ROM_LOAD( "b30_19.14d", 0x10000, 0x10000, CRC(9cb8675e) SHA1(559c21d505c60401f7368d4ab2b686b15075c5c5) )
ROM_LOAD( "b30_18.15d", 0x20000, 0x10000, CRC(806fb374) SHA1(3eebefadcbdf713bf2a65b438092746b07edd3f0) )
@ -817,7 +809,7 @@ ROM_START( twincobru )
ROM_LOAD( "b30_10.12c", 0x10000, 0x08000, CRC(170c01db) SHA1(f4c5a1600f6cbb48abbace66c6f7514f79138e8b) )
ROM_LOAD( "b30_09.10c", 0x18000, 0x08000, CRC(44f5accd) SHA1(2f9bdebe71c8be195332356df68992fd38d86994) )
ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */
ROM_REGION( 0x40000, "scu", 0 ) /* sprites */
ROM_LOAD( "b30_20.12d", 0x00000, 0x10000, CRC(cb4092b8) SHA1(35b1d1e04af760fa106124bd5a94174d63ff9705) )
ROM_LOAD( "b30_19.14d", 0x10000, 0x10000, CRC(9cb8675e) SHA1(559c21d505c60401f7368d4ab2b686b15075c5c5) )
ROM_LOAD( "b30_18.15d", 0x20000, 0x10000, CRC(806fb374) SHA1(3eebefadcbdf713bf2a65b438092746b07edd3f0) )
@ -862,7 +854,7 @@ ROM_START( ktiger )
ROM_LOAD( "b30_10.12c", 0x10000, 0x08000, CRC(170c01db) SHA1(f4c5a1600f6cbb48abbace66c6f7514f79138e8b) )
ROM_LOAD( "b30_09.10c", 0x18000, 0x08000, CRC(44f5accd) SHA1(2f9bdebe71c8be195332356df68992fd38d86994) )
ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */
ROM_REGION( 0x40000, "scu", 0 ) /* sprites */
ROM_LOAD( "b30_20.12d", 0x00000, 0x10000, CRC(cb4092b8) SHA1(35b1d1e04af760fa106124bd5a94174d63ff9705) )
ROM_LOAD( "b30_19.14d", 0x10000, 0x10000, CRC(9cb8675e) SHA1(559c21d505c60401f7368d4ab2b686b15075c5c5) )
ROM_LOAD( "b30_18.15d", 0x20000, 0x10000, CRC(806fb374) SHA1(3eebefadcbdf713bf2a65b438092746b07edd3f0) )
@ -911,7 +903,7 @@ ROM_START( fshark )
ROM_LOAD( "b02_10.h16", 0x10000, 0x08000, CRC(4bd099ff) SHA1(9326075f83549b0a9656f69bd4436fb1be2ac805) )
ROM_LOAD( "b02_09.h15", 0x18000, 0x08000, CRC(230f1582) SHA1(0fd4156a46ed64cb6e5c59b8836382dd86c229cf) )
ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */
ROM_REGION( 0x40000, "scu", 0 ) /* sprites */
ROM_LOAD( "b02_01.d15", 0x00000, 0x10000, CRC(2234b424) SHA1(bd6242b9dcdb0f582565df588106cd1ce2aad53b) )
ROM_LOAD( "b02_02.d16", 0x10000, 0x10000, CRC(30d4c9a8) SHA1(96ce4f41207c5487e801a8444030ec4dc7b58b23) )
ROM_LOAD( "b02_03.d17", 0x20000, 0x10000, CRC(64f3d88f) SHA1(d0155cfb0a8885d58e34141f9696b9aa208440ca) )
@ -960,7 +952,7 @@ ROM_START( skyshark )
ROM_LOAD( "b02_10.h16", 0x10000, 0x08000, CRC(4bd099ff) SHA1(9326075f83549b0a9656f69bd4436fb1be2ac805) )
ROM_LOAD( "b02_09.h15", 0x18000, 0x08000, CRC(230f1582) SHA1(0fd4156a46ed64cb6e5c59b8836382dd86c229cf) )
ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */
ROM_REGION( 0x40000, "scu", 0 ) /* sprites */
ROM_LOAD( "b02_01.d15", 0x00000, 0x10000, CRC(2234b424) SHA1(bd6242b9dcdb0f582565df588106cd1ce2aad53b) )
ROM_LOAD( "b02_02.d16", 0x10000, 0x10000, CRC(30d4c9a8) SHA1(96ce4f41207c5487e801a8444030ec4dc7b58b23) )
ROM_LOAD( "b02_03.d17", 0x20000, 0x10000, CRC(64f3d88f) SHA1(d0155cfb0a8885d58e34141f9696b9aa208440ca) )
@ -1009,7 +1001,7 @@ ROM_START( hishouza )
ROM_LOAD( "b02_10.h16", 0x10000, 0x08000, CRC(4bd099ff) SHA1(9326075f83549b0a9656f69bd4436fb1be2ac805) )
ROM_LOAD( "b02_09.h15", 0x18000, 0x08000, CRC(230f1582) SHA1(0fd4156a46ed64cb6e5c59b8836382dd86c229cf) )
ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */
ROM_REGION( 0x40000, "scu", 0 ) /* sprites */
ROM_LOAD( "b02_01.d15", 0x00000, 0x10000, CRC(2234b424) SHA1(bd6242b9dcdb0f582565df588106cd1ce2aad53b) )
ROM_LOAD( "b02_02.d16", 0x10000, 0x10000, CRC(30d4c9a8) SHA1(96ce4f41207c5487e801a8444030ec4dc7b58b23) )
ROM_LOAD( "b02_03.d17", 0x20000, 0x10000, CRC(64f3d88f) SHA1(d0155cfb0a8885d58e34141f9696b9aa208440ca) )
@ -1061,7 +1053,7 @@ ROM_START( fsharkbt )
ROM_LOAD( "b02_10.h16", 0x10000, 0x08000, CRC(4bd099ff) SHA1(9326075f83549b0a9656f69bd4436fb1be2ac805) )
ROM_LOAD( "b02_09.h15", 0x18000, 0x08000, CRC(230f1582) SHA1(0fd4156a46ed64cb6e5c59b8836382dd86c229cf) )
ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */
ROM_REGION( 0x40000, "scu", 0 ) /* sprites */
ROM_LOAD( "b02_01.d15", 0x00000, 0x10000, CRC(2234b424) SHA1(bd6242b9dcdb0f582565df588106cd1ce2aad53b) )
ROM_LOAD( "b02_02.d16", 0x10000, 0x10000, CRC(30d4c9a8) SHA1(96ce4f41207c5487e801a8444030ec4dc7b58b23) )
ROM_LOAD( "b02_03.d17", 0x20000, 0x10000, CRC(64f3d88f) SHA1(d0155cfb0a8885d58e34141f9696b9aa208440ca) )
@ -1123,7 +1115,7 @@ ROM_START( fnshark ) // based on a different version of the game code? (only a ~
ROM_LOAD( "10.ic116", 0x10000, 0x08000, CRC(4bd099ff) SHA1(9326075f83549b0a9656f69bd4436fb1be2ac805) )
ROM_LOAD( "9.ic117", 0x18000, 0x08000, CRC(230f1582) SHA1(0fd4156a46ed64cb6e5c59b8836382dd86c229cf) )
ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */
ROM_REGION( 0x40000, "scu", 0 ) /* sprites */
ROM_LOAD( "1.ic54", 0x00000, 0x10000, CRC(2234b424) SHA1(bd6242b9dcdb0f582565df588106cd1ce2aad53b) )
ROM_LOAD( "2.ic53", 0x10000, 0x10000, CRC(30d4c9a8) SHA1(96ce4f41207c5487e801a8444030ec4dc7b58b23) )
ROM_LOAD( "3.ic52", 0x20000, 0x10000, CRC(64f3d88f) SHA1(d0155cfb0a8885d58e34141f9696b9aa208440ca) )
@ -1177,7 +1169,7 @@ ROM_START( gulfwar2 )
ROM_LOAD( "11-u197.bin", 0x10000, 0x08000, CRC(7b721ed3) SHA1(afd10229414c65a56e184d56a69460ca3a502a27) )
ROM_LOAD( "10-u196.rom", 0x18000, 0x08000, CRC(160f38ab) SHA1(da310ec387d439b26c8b6b881e5dcc07c2b9bb00) )
ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */
ROM_REGION( 0x40000, "scu", 0 ) /* sprites */
ROM_LOAD( "20-u262.bin", 0x00000, 0x10000, CRC(10665ca0) SHA1(0c552c3807e00a7ef4f9fd28c7988a232628a1f5) )
ROM_LOAD( "19-u261.bin", 0x10000, 0x10000, CRC(cfa6d417) SHA1(f6c17d938b58dc5756ecf617f00fbfaf701602a7) )
ROM_LOAD( "18-u260.bin", 0x20000, 0x10000, CRC(2e6a0c49) SHA1(0b7ddad8775dcebe240a8246ef7816113f517f87) )
@ -1223,7 +1215,7 @@ ROM_START( gulfwar2a )
ROM_LOAD( "11-u197.bin", 0x10000, 0x08000, CRC(7b721ed3) SHA1(afd10229414c65a56e184d56a69460ca3a502a27) )
ROM_LOAD( "10-u196.rom", 0x18000, 0x08000, CRC(160f38ab) SHA1(da310ec387d439b26c8b6b881e5dcc07c2b9bb00) )
ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */
ROM_REGION( 0x40000, "scu", 0 ) /* sprites */
ROM_LOAD( "20-u262.bin", 0x00000, 0x10000, CRC(10665ca0) SHA1(0c552c3807e00a7ef4f9fd28c7988a232628a1f5) )
ROM_LOAD( "19-u261.bin", 0x10000, 0x10000, CRC(cfa6d417) SHA1(f6c17d938b58dc5756ecf617f00fbfaf701602a7) )
ROM_LOAD( "18-u260.bin", 0x20000, 0x10000, CRC(2e6a0c49) SHA1(0b7ddad8775dcebe240a8246ef7816113f517f87) )
@ -1243,11 +1235,11 @@ DRIVER_INIT_MEMBER(twincobr_state,twincobr)
}
GAME( 1987, fshark, 0, twincobr, fshark, twincobr_state, twincobr, ROT270, "Toaplan / Taito Corporation", "Flying Shark (World)", 0 )
GAME( 1987, skyshark, fshark, twincobr, skyshark, twincobr_state, twincobr, ROT270, "Toaplan / Taito America Corporation (Romstar license)", "Sky Shark (US)", 0 )
GAME( 1987, hishouza, fshark, twincobr, hishouza, twincobr_state, twincobr, ROT270, "Toaplan / Taito Corporation", "Hishou Zame (Japan)", 0 )
GAME( 1987, fshark, 0, fshark, fshark, twincobr_state, twincobr, ROT270, "Toaplan / Taito Corporation", "Flying Shark (World)", 0 )
GAME( 1987, skyshark, fshark, fshark, skyshark, twincobr_state, twincobr, ROT270, "Toaplan / Taito America Corporation (Romstar license)", "Sky Shark (US)", 0 )
GAME( 1987, hishouza, fshark, fshark, hishouza, twincobr_state, twincobr, ROT270, "Toaplan / Taito Corporation", "Hishou Zame (Japan)", 0 )
GAME( 1987, fsharkbt, fshark, fsharkbt, skyshark, twincobr_state, twincobr, ROT270, "bootleg", "Flying Shark (bootleg with 8741)", 0 )
GAME( 1987, fnshark, fshark, twincobr, hishouza, twincobr_state, twincobr, ROT270, "bootleg", "Flyin' Shark (bootleg of Hishou Zame)", 0 )
GAME( 1987, fnshark, fshark, fshark, hishouza, twincobr_state, twincobr, ROT270, "bootleg", "Flyin' Shark (bootleg of Hishou Zame)", 0 )
GAME( 1987, twincobr, 0, twincobr, twincobr, twincobr_state, twincobr, ROT270, "Toaplan / Taito Corporation", "Twin Cobra (World)", 0 )
GAME( 1987, twincobru, twincobr, twincobr, twincobru, twincobr_state, twincobr, ROT270, "Toaplan / Taito America Corporation (Romstar license)", "Twin Cobra (US)", 0 )
GAME( 1987, ktiger, twincobr, twincobr, ktiger, twincobr_state, twincobr, ROT270, "Toaplan / Taito Corporation", "Kyukyoku Tiger (Japan)", 0 )

View File

@ -336,18 +336,6 @@ static const gfx_layout tilelayout =
8*8 /* every tile takes 8 consecutive bytes */
};
static const gfx_layout spritelayout =
{
16,16, /* 16*16 sprites */
2048, /* 2048 sprites */
4, /* 4 bits per pixel */
{ 0*2048*32*8, 1*2048*32*8, 2*2048*32*8, 3*2048*32*8 }, /* the bitplanes are separated */
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
32*8 /* every sprite takes 32 consecutive bytes */
};
/* handler called by the 3812 emulator when the internal timers cause an IRQ */
WRITE_LINE_MEMBER(wardner_state::irqhandler)
@ -360,7 +348,6 @@ static GFXDECODE_START( wardner )
GFXDECODE_ENTRY( "gfx1", 0x00000, charlayout, 1536, 32 ) /* colors 1536-1791 */
GFXDECODE_ENTRY( "gfx2", 0x00000, tilelayout, 1280, 16 ) /* colors 1280-1535 */
GFXDECODE_ENTRY( "gfx3", 0x00000, tilelayout, 1024, 16 ) /* colors 1024-1079 */
GFXDECODE_ENTRY( "gfx4", 0x00000, spritelayout, 0, 64 ) /* colors 0-1023 */
GFXDECODE_END
@ -409,8 +396,7 @@ static MACHINE_CONFIG_START( wardner, wardner_state )
/* video hardware */
MCFG_MC6845_ADD("crtc", HD6845, "screen", XTAL_14MHz/4, twincobr_mc6845_intf) /* 3.5MHz measured on CLKin */
MCFG_TOAPLAN_SCU_ADD("toaplan_scu")
MCFG_TOAPLAN_SCU_GFXDECODE("gfxdecode")
MCFG_TOAPLAN_SCU_ADD("scu", "palette", 32, 14)
MCFG_BUFFERED_SPRITERAM8_ADD("spriteram8")
@ -480,7 +466,7 @@ ROM_START( wardner )
ROM_LOAD( "b25-10.rom", 0x10000, 0x08000, CRC(b9a61e81) SHA1(541e579664d583fbbf81111046115018fdaff073) )
ROM_LOAD( "b25-09.rom", 0x18000, 0x08000, CRC(585411b7) SHA1(67c0f4b7ab303341d5481c4024dc4199acb7c279) )
ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */
ROM_REGION( 0x40000, "scu", 0 ) /* sprites */
ROM_LOAD( "b25-01.rom", 0x00000, 0x10000, CRC(42ec01fb) SHA1(646192a2e89f795ed016860cdcdc0b5ef645fca2) )
ROM_LOAD( "b25-02.rom", 0x10000, 0x10000, CRC(6c0130b7) SHA1(8b6ad72848d03c3d4ee3acd35abbb3a0e678122c) )
ROM_LOAD( "b25-03.rom", 0x20000, 0x10000, CRC(b923db99) SHA1(2f4be81afdf200586bc44b1e94553d84d16d0b62) )
@ -531,7 +517,7 @@ ROM_START( pyros )
ROM_LOAD( "b25-10.rom", 0x10000, 0x08000, CRC(b9a61e81) SHA1(541e579664d583fbbf81111046115018fdaff073) )
ROM_LOAD( "b25-09.rom", 0x18000, 0x08000, CRC(585411b7) SHA1(67c0f4b7ab303341d5481c4024dc4199acb7c279) )
ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */
ROM_REGION( 0x40000, "scu", 0 ) /* sprites */
ROM_LOAD( "b25-01.rom", 0x00000, 0x10000, CRC(42ec01fb) SHA1(646192a2e89f795ed016860cdcdc0b5ef645fca2) )
ROM_LOAD( "b25-02.rom", 0x10000, 0x10000, CRC(6c0130b7) SHA1(8b6ad72848d03c3d4ee3acd35abbb3a0e678122c) )
ROM_LOAD( "b25-03.rom", 0x20000, 0x10000, CRC(b923db99) SHA1(2f4be81afdf200586bc44b1e94553d84d16d0b62) )
@ -582,7 +568,7 @@ ROM_START( wardnerj )
ROM_LOAD( "b25-10.rom", 0x10000, 0x08000, CRC(b9a61e81) SHA1(541e579664d583fbbf81111046115018fdaff073) )
ROM_LOAD( "b25-09.rom", 0x18000, 0x08000, CRC(585411b7) SHA1(67c0f4b7ab303341d5481c4024dc4199acb7c279) )
ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */
ROM_REGION( 0x40000, "scu", 0 ) /* sprites */
ROM_LOAD( "b25-01.rom", 0x00000, 0x10000, CRC(42ec01fb) SHA1(646192a2e89f795ed016860cdcdc0b5ef645fca2) )
ROM_LOAD( "b25-02.rom", 0x10000, 0x10000, CRC(6c0130b7) SHA1(8b6ad72848d03c3d4ee3acd35abbb3a0e678122c) )
ROM_LOAD( "b25-03.rom", 0x20000, 0x10000, CRC(b923db99) SHA1(2f4be81afdf200586bc44b1e94553d84d16d0b62) )

View File

@ -164,7 +164,7 @@ class toaplan1_rallybik_state : public toaplan1_state
public:
toaplan1_rallybik_state(const machine_config &mconfig, device_type type, const char *tag)
: toaplan1_state(mconfig, type, tag),
m_spritegen(*this, "toaplan_scu")
m_spritegen(*this, "scu")
{
}

View File

@ -18,7 +18,7 @@ public:
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_dsp(*this, "dsp"),
m_spritegen(*this, "toaplan_scu"),
m_spritegen(*this, "scu"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette")

View File

@ -214,7 +214,7 @@ void namco_c45_road_device::device_start()
}
MACHINE_CONFIG_FRAGMENT( namco_c45_road )
MCFG_GFXDECODE_ADD("gfxdecode", "^palette", empty) // FIXME
MCFG_GFXDECODE_ADD("gfxdecode", ":palette", empty) // FIXME
MACHINE_CONFIG_END
//-------------------------------------------------
// device_mconfig_additions - return a pointer to

View File

@ -4,16 +4,11 @@ const device_type K053250 = &device_creator<k053250_device>;
k053250_device::k053250_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, K053250, "K053250", tag, owner, clock, "k053250", __FILE__),
device_video_interface(mconfig, *this),
m_palette(*this)
device_gfx_interface(mconfig, *this),
device_video_interface(mconfig, *this)
{
}
void k053250_device::static_set_palette_tag(device_t &device, const char *tag)
{
downcast<k053250_device &>(device).m_palette.set_tag(tag);
}
void k053250_device::static_set_offsets(device_t &device, int offx, int offy)
{
k053250_device &dev = downcast<k053250_device &>(device);
@ -60,7 +55,7 @@ void k053250_device::device_reset()
}
// utility function to render a clipped scanline vertically or horizontally
inline void k053250_device::pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t *palette, UINT8 *source,
inline void k053250_device::pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t *pal_base, UINT8 *source,
const rectangle &cliprect, int linepos, int scroll, int zoom,
UINT32 clipmask, UINT32 wrapmask, UINT32 orientation, bitmap_ind8 &priority, UINT8 pri)
{
@ -74,7 +69,6 @@ inline void k053250_device::pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t *
UINT8 *src_base;
int src_fx, src_fdx;
int pix_data, dst_offset;
const pen_t *pal_base;
UINT8 *pri_base;
UINT32 *dst_base;
int dst_adv;
@ -183,7 +177,6 @@ inline void k053250_device::pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t *
// so we set all bits of the wrapmask to one
src_wrapmask = (clipmask) ? ~0 : wrapmask;
pal_base = palette;
dst_offset = -dst_offset; // negate target offset in order to terminated draw loop at 0 condition
if (pri)
@ -358,7 +351,7 @@ void k053250_device::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, int
linedata_offs += line_start * linedata_adv; // pre-advance line info offset for the clipped region
// load physical palette base
pal_base = m_palette->pens() + (colorbase << 4) % m_palette->entries();
pal_base = palette()->pens() + (colorbase << 4) % palette()->entries();
// walk the target bitmap within the visible area vertically or horizontally, one line at a time
for (line_pos=line_start; line_pos <= line_end; linedata_offs += linedata_adv, line_pos++)

View File

@ -9,17 +9,17 @@
#define MCFG_K053250_ADD(_tag, _palette_tag, _screen_tag, offx, offy) \
MCFG_DEVICE_ADD(_tag, K053250, 0) \
MCFG_GFX_PALETTE(_palette_tag) \
MCFG_VIDEO_SET_SCREEN(_screen_tag) \
k053250_device::static_set_palette_tag(*device, "^" _palette_tag); \
k053250_device::static_set_offsets(*device, offx, offy);
class k053250_device : public device_t,
public device_gfx_interface,
public device_video_interface
{
public:
k053250_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
static void static_set_palette_tag(device_t &device, const char *tag);
static void static_set_offsets(device_t &device, int offx, int offy);
DECLARE_READ16_MEMBER(reg_r);
@ -47,12 +47,10 @@ private:
UINT8 m_page;
INT32 m_frame;
required_device<palette_device> m_palette;
// internal helpers
void unpack_nibbles();
void dma(int limiter);
static void pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t *palette, UINT8 *source,
static void pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t *pal_base, UINT8 *source,
const rectangle &cliprect, int linepos, int scroll, int zoom,
UINT32 clipmask, UINT32 wrapmask, UINT32 orientation, bitmap_ind8 &priority, UINT8 pri);
};

View File

@ -297,15 +297,6 @@ void nemesis_state::video_start()
memset(m_charram, 0, m_charram.bytes());
memset(m_blank_tile, 0, ARRAY_LENGTH(m_blank_tile));
m_gfxdecode->gfx(0)->set_source((UINT8 *)m_charram.target());
m_gfxdecode->gfx(1)->set_source((UINT8 *)m_charram.target());
m_gfxdecode->gfx(2)->set_source((UINT8 *)m_charram.target());
m_gfxdecode->gfx(3)->set_source((UINT8 *)m_charram.target());
m_gfxdecode->gfx(4)->set_source((UINT8 *)m_charram.target());
m_gfxdecode->gfx(5)->set_source((UINT8 *)m_charram.target());
m_gfxdecode->gfx(6)->set_source((UINT8 *)m_charram.target());
m_gfxdecode->gfx(7)->set_source((UINT8 *)m_charram.target());
/* Set up save state */
machine().save().register_postload(save_prepost_delegate(FUNC(nemesis_state::nemesis_postload), this));
}

View File

@ -617,10 +617,6 @@ VIDEO_START_MEMBER(pgm_state,pgm)
m_aoffset = 0;
m_boffset = 0;
// temporary, this will be specified in gfxdecode info eventually
m_gfxdecode->gfx(0)->set_xormask(7);
m_gfxdecode->gfx(1)->set_xormask(7);
m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(pgm_state::get_pgm_tx_tilemap_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
m_tx_tilemap->set_transparent_pen(15);

View File

@ -287,7 +287,7 @@ void toaplan1_state::register_common()
VIDEO_START_MEMBER(toaplan1_rallybik_state,rallybik)
{
m_spritegen->alloc_sprite_bitmap(*m_screen);
m_spritegen->set_gfx_region(1);
m_spritegen->gfx(0)->set_colorbase(64*16);
toaplan1_create_tilemaps();
toaplan1_vram_alloc();

View File

@ -10,21 +10,33 @@
const device_type TOAPLAN_SCU = &device_creator<toaplan_scu_device>;
static const gfx_layout spritelayout =
{
16,16, /* 16*16 sprites */
RGN_FRAC(1,4),
4, /* 4 bits per pixel */
{ RGN_FRAC(0,4), RGN_FRAC(1,4), RGN_FRAC(2,4), RGN_FRAC(3,4) },
{ STEP16(0, 1) },
{ STEP16(0, 16) },
16*16
};
static GFXDECODE_START( toaplan_scu )
GFXDECODE_DEVICE( DEVICE_SELF, 0, spritelayout, 0, 64 )
GFXDECODE_END
toaplan_scu_device::toaplan_scu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, TOAPLAN_SCU, "toaplan_scu_device", tag, owner, clock, "toaplan_scu", __FILE__),
m_gfxregion(0),
m_gfxdecode(*this)
device_gfx_interface(mconfig, *this, GFXDECODE_NAME( toaplan_scu ))
{
}
//-------------------------------------------------
// static_set_gfxdecode_tag: Set the tag of the
// gfx decoder
//-------------------------------------------------
void toaplan_scu_device::static_set_gfxdecode_tag(device_t &device, const char *tag)
void toaplan_scu_device::static_set_xoffsets(device_t &device, int xoffs, int xoffs_flipped)
{
downcast<toaplan_scu_device &>(device).m_gfxdecode.set_tag(tag);
toaplan_scu_device &dev = downcast<toaplan_scu_device &>(device);
dev.m_xoffs = xoffs;
dev.m_xoffs_flipped = xoffs_flipped;
}
void toaplan_scu_device::device_start()
@ -40,11 +52,6 @@ void toaplan_scu_device::alloc_sprite_bitmap(screen_device &screen)
screen.register_screen_bitmap(m_temp_spritebitmap);
}
void toaplan_scu_device::set_gfx_region(int region)
{
m_gfxregion = region;
}
/***************************************************************************
Sprite Handlers
***************************************************************************/
@ -73,14 +80,14 @@ void toaplan_scu_device::draw_sprites_to_tempbitmap(const rectangle &cliprect, U
sx = spriteram[offs + 2] >> 7;
flipx = attribute & 0x100;
if (flipx) sx -= 14; /* should really be 15 */
if (flipx) sx -= m_xoffs_flipped;
flipy = attribute & 0x200;
m_gfxdecode->gfx(m_gfxregion)->transpen_raw(m_temp_spritebitmap,cliprect,
gfx(0)->transpen_raw(m_temp_spritebitmap,cliprect,
sprite,
color << 4 /* << 4 because using _raw */ ,
flipx,flipy,
sx-32,sy-16,0);
sx-m_xoffs,sy-16,0);
}
}
@ -94,7 +101,7 @@ void toaplan_scu_device::draw_sprites_to_tempbitmap(const rectangle &cliprect, U
void toaplan_scu_device::copy_sprites_from_tempbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority)
{
int y, x;
int colourbase = m_gfxdecode->gfx(m_gfxregion)->colorbase();
int colourbase = gfx(0)->colorbase();
for (y=cliprect.min_y;y<=cliprect.max_y;y++)
{

View File

@ -2,18 +2,17 @@
class toaplan_scu_device : public device_t
class toaplan_scu_device : public device_t, public device_gfx_interface
{
public:
toaplan_scu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// static configuration
static void static_set_gfxdecode_tag(device_t &device, const char *tag);
static void static_set_xoffsets(device_t &device, int xoffs, int xoffs_flipped);
void draw_sprites_to_tempbitmap(const rectangle &cliprect, UINT16* spriteram, UINT32 bytes );
void copy_sprites_from_tempbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority);
void alloc_sprite_bitmap(screen_device &screen);
void set_gfx_region(int region);
protected:
virtual void device_start();
@ -21,13 +20,13 @@ protected:
private:
bitmap_ind16 m_temp_spritebitmap;
int m_gfxregion;
required_device<gfxdecode_device> m_gfxdecode;
int m_xoffs;
int m_xoffs_flipped;
};
extern const device_type TOAPLAN_SCU;
#define MCFG_TOAPLAN_SCU_ADD(_tag ) \
MCFG_DEVICE_ADD(_tag, TOAPLAN_SCU, 0)
#define MCFG_TOAPLAN_SCU_GFXDECODE(_gfxtag) \
toaplan_scu_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
#define MCFG_TOAPLAN_SCU_ADD(_tag, _palette_tag, _xoffs, _xoffs_flipped ) \
MCFG_DEVICE_ADD(_tag, TOAPLAN_SCU, 0) \
MCFG_GFX_PALETTE(_palette_tag) \
toaplan_scu_device::static_set_xoffsets(*device, _xoffs, _xoffs_flipped);

View File

@ -102,7 +102,6 @@ void twincobr_state::twincobr_create_tilemaps()
VIDEO_START_MEMBER(twincobr_state,toaplan0)
{
m_spritegen->alloc_sprite_bitmap(*m_screen);
m_spritegen->set_gfx_region(3);
/* the video RAM is accessed via ports, it's not memory mapped */
m_txvideoram_size = 0x0800;

View File

@ -312,7 +312,7 @@ static MACHINE_CONFIG_FRAGMENT( segacd_fragment )
MCFG_TIMER_DRIVER_ADD("stamp_timer", sega_segacd_device, segacd_gfx_conversion_timer_callback)
MCFG_TIMER_DRIVER_ADD("scd_dma_timer", sega_segacd_device, scd_dma_timer_callback)
MCFG_GFXDECODE_ADD("gfxdecode", "^gen_vdp:palette", segacd) // FIXME
MCFG_GFXDECODE_ADD("gfxdecode", ":gen_vdp:palette", segacd) // FIXME
MCFG_DEFAULT_LAYOUT( layout_megacd )