summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2008-12-14 08:45:12 +0000
committer Aaron Giles <aaron@aarongiles.com>2008-12-14 08:45:12 +0000
commita7db377c875150d7f179f037a6c653f27aa654a5 (patch)
treecd25bc240a22d45049104a598397050aae5c5dbf
parent9830575ad03eba48e438de7ec7b8ff1b99df59bc (diff)
From: Atari Ace [mailto:atari_ace@verizon.net]
Sent: Saturday, December 13, 2008 5:07 PM To: submit@mamedev.org Cc: atariace@hotmail.com Subject: [patch] Add machine to allocgfx Hi mamedev, This patch eliminates the #include "deprecat.h" from drawgfx.h. It does so in a fashion similar to my recent tilemap patch, adding the machine pointer to gfx_element, changing allocgfx to take a machine, and then adjusting the internals to use the machine field as needed. The changes outside of drawgfx.[ch] were done with the attached script. ~aa
-rw-r--r--src/emu/drawgfx.c67
-rw-r--r--src/emu/drawgfx.h3
-rw-r--r--src/emu/video.c2
-rw-r--r--src/mame/drivers/cps3.c4
-rw-r--r--src/mame/drivers/hornet.c2
-rw-r--r--src/mame/drivers/mpu4drvr.c8
-rw-r--r--src/mame/drivers/namcoic.c2
-rw-r--r--src/mame/drivers/nwk-tr.c4
-rw-r--r--src/mame/drivers/srmp6.c2
-rw-r--r--src/mame/video/atarisy1.c6
-rw-r--r--src/mame/video/konamiic.c2
-rw-r--r--src/mame/video/m10.c4
-rw-r--r--src/mame/video/namcona1.c6
-rw-r--r--src/mame/video/plygonet.c2
-rw-r--r--src/mame/video/ppu2c0x.c2
-rw-r--r--src/mame/video/rungun.c2
-rw-r--r--src/mame/video/segaic24.c2
-rw-r--r--src/mame/video/st0016.c2
-rw-r--r--src/mame/video/taitoic.c6
-rw-r--r--src/mame/video/taitojc.c2
-rw-r--r--src/mame/video/tceptor.c4
21 files changed, 65 insertions, 69 deletions
diff --git a/src/emu/drawgfx.c b/src/emu/drawgfx.c
index 712c6fb5e23..66b3bf0b94f 100644
--- a/src/emu/drawgfx.c
+++ b/src/emu/drawgfx.c
@@ -13,7 +13,6 @@
#include "driver.h"
#include "profiler.h"
-#include "deprecat.h"
/***************************************************************************
@@ -221,7 +220,7 @@ void decodechar(gfx_element *gfx, int num, const UINT8 *src)
based on a given layout
-------------------------------------------------*/
-gfx_element *allocgfx(const gfx_layout *gl)
+gfx_element *allocgfx(running_machine *machine, const gfx_layout *gl)
{
int israw = (gl->planeoffset[0] == GFX_RAW);
int planes = gl->planes;
@@ -234,6 +233,8 @@ gfx_element *allocgfx(const gfx_layout *gl)
gfx = malloc_or_die(sizeof(*gfx));
memset(gfx, 0, sizeof(*gfx));
+ gfx->machine = machine;
+
/* copy the layout */
gfx->layout = *gl;
if (gl->extxoffs != NULL)
@@ -487,6 +488,7 @@ int pdrawgfx_shadow_lowpri = 0;
#define HMODULO 1
#define VMODULO dstmodulo
#define COMMON_ARGS \
+ pen_t *palette_shadow_table, \
const UINT8 *srcdata,int srcwidth,int srcheight,int srcmodulo, \
int leftskip,int topskip,int flipx,int flipy, \
DATA_TYPE *dstdata,int dstwidth,int dstheight,int dstmodulo
@@ -597,6 +599,7 @@ INLINE UINT32 SHADOW32(pen_t *shadow_table, UINT32 c)
#define HMODULO 1
#define VMODULO dstmodulo
#define COMMON_ARGS \
+ pen_t *palette_shadow_table, \
const UINT8 *srcdata,int srcwidth,int srcheight,int srcmodulo, \
int leftskip,int topskip,int flipx,int flipy, \
DATA_TYPE *dstdata,int dstwidth,int dstheight,int dstmodulo
@@ -1183,7 +1186,7 @@ INLINE void common_drawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx,
if (dest_bmp->bpp == 16)
{
int colorbase = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors);
- const pen_t *pal = &Machine->pens[colorbase];
+ const pen_t *pal = &gfx->machine->pens[colorbase];
UINT8 *source_base = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo;
int sprite_screen_height = (scaley*gfx->height+0x8000)>>16;
@@ -1514,7 +1517,7 @@ INLINE void common_drawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx,
/* case 3: TRANSPARENCY_PEN_TABLE */
if (transparency == TRANSPARENCY_PEN_TABLE)
{
- pen_t *palette_shadow_table = Machine->shadow_table;
+ pen_t *palette_shadow_table = gfx->machine->shadow_table;
if (pri_buffer)
{
UINT8 al = (pdrawgfx_shadow_lowpri) ? 0 : 0x80;
@@ -1702,7 +1705,7 @@ INLINE void common_drawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx,
/* 32-bit destination bitmap */
else
{
- const pen_t *pal = &Machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
+ const pen_t *pal = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
UINT8 *source_base = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo;
int sprite_screen_height = (scaley*gfx->height+0x8000)>>16;
@@ -1944,7 +1947,7 @@ INLINE void common_drawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx,
/* case 3: TRANSPARENCY_PEN_TABLE */
if (transparency == TRANSPARENCY_PEN_TABLE)
{
- pen_t *palette_shadow_table = Machine->shadow_table;
+ pen_t *palette_shadow_table = gfx->machine->shadow_table;
UINT8 *source;
UINT8 *pri;
UINT32 *dest;
@@ -2205,7 +2208,6 @@ void mdrawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx,
#if (RAW == 0)
DECLARE_SWAP_RAW_PRI(blockmove_8toN_opaque,(COMMON_ARGS, COLOR_ARG),
{
- pen_t *palette_shadow_table = Machine->shadow_table;
ADJUST_8
(void)palette_shadow_table;
@@ -2280,7 +2282,6 @@ DECLARE_SWAP_RAW_PRI(blockmove_8toN_opaque,(COMMON_ARGS, COLOR_ARG),
#if (RAW == 0)
DECLARE_SWAP_RAW_PRI(blockmove_4toN_opaque,(COMMON_ARGS, COLOR_ARG),
{
- pen_t *palette_shadow_table = Machine->shadow_table;
ADJUST_4
(void)palette_shadow_table;
@@ -2376,7 +2377,6 @@ DECLARE_SWAP_RAW_PRI(blockmove_4toN_opaque,(COMMON_ARGS, COLOR_ARG),
DECLARE_SWAP_RAW_PRI(blockmove_8toN_transpen,(COMMON_ARGS, COLOR_ARG, int transpen),
{
- pen_t *palette_shadow_table = Machine->shadow_table;
ADJUST_8
(void)palette_shadow_table;
@@ -2487,7 +2487,6 @@ DECLARE_SWAP_RAW_PRI(blockmove_8toN_transpen,(COMMON_ARGS, COLOR_ARG, int transp
DECLARE_SWAP_RAW_PRI(blockmove_4toN_transpen,(COMMON_ARGS, COLOR_ARG, int transpen),
{
- pen_t *palette_shadow_table = Machine->shadow_table;
ADJUST_4
(void)palette_shadow_table;
@@ -2565,7 +2564,6 @@ DECLARE_SWAP_RAW_PRI(blockmove_4toN_transpen,(COMMON_ARGS, COLOR_ARG, int transp
DECLARE_SWAP_RAW_PRI(blockmove_8toN_transmask,(COMMON_ARGS, COLOR_ARG, int transmask),
{
- pen_t *palette_shadow_table = Machine->shadow_table;
ADJUST_8
(void)palette_shadow_table;
@@ -2673,7 +2671,6 @@ DECLARE_SWAP_RAW_PRI(blockmove_8toN_transmask,(COMMON_ARGS, COLOR_ARG, int trans
#if (DEPTH == 32)
DECLARE_SWAP_RAW_PRI(blockmove_8toN_pen_table,(COMMON_ARGS, COLOR_ARG, int transcolor),
{
- pen_t *palette_shadow_table = Machine->shadow_table;
ADJUST_8
(void)palette_shadow_table;
@@ -2750,7 +2747,6 @@ DECLARE_SWAP_RAW_PRI(blockmove_8toN_pen_table,(COMMON_ARGS, COLOR_ARG, int trans
#else
DECLARE_SWAP_RAW_PRI(blockmove_8toN_pen_table,(COMMON_ARGS, COLOR_ARG, int transcolor),
{
- pen_t *palette_shadow_table = Machine->shadow_table;
int eax = (pdrawgfx_shadow_lowpri) ? 0 : 0x80;
ADJUST_8
@@ -2832,7 +2828,6 @@ DECLARE_SWAP_RAW_PRI(blockmove_8toN_pen_table,(COMMON_ARGS, COLOR_ARG, int trans
#if (RAW == 0)
DECLARE_SWAP_RAW_PRI(blockmove_8toN_alpha,(COMMON_ARGS, COLOR_ARG, int transpen),
{
- pen_t *palette_shadow_table = Machine->shadow_table;
ADJUST_8
(void)palette_shadow_table;
@@ -2944,7 +2939,6 @@ DECLARE_SWAP_RAW_PRI(blockmove_8toN_alpha,(COMMON_ARGS, COLOR_ARG, int transpen)
/* pjp 02/06/02 */
DECLARE_SWAP_RAW_PRI(blockmove_8toN_alpharange,(COMMON_ARGS, COLOR_ARG, int transpen),
{
- pen_t *palette_shadow_table = Machine->shadow_table;
ADJUST_8
(void)palette_shadow_table;
@@ -3084,6 +3078,7 @@ DECLARE(drawgfx_core,(
if (sy > ey) return;
{
+ pen_t *st = gfx->machine->shadow_table;
UINT8 *sd = gfx->gfxdata + code * gfx->char_modulo; /* source data */
int sw = gfx->width; /* source width */
int sh = gfx->height; /* source height */
@@ -3095,7 +3090,7 @@ DECLARE(drawgfx_core,(
int dh = ey-sy+1; /* dest height */
int dm = dest->rowpixels; /* dest modulo */
int colorbase = gfx->color_base + gfx->color_granularity * color;
- const pen_t *paldata = &Machine->pens[colorbase];
+ const pen_t *paldata = &gfx->machine->pens[colorbase];
UINT8 *pribuf = (pri_buffer) ? BITMAP_ADDR8(pri_buffer, sy, sx) : NULL;
switch (transparency)
@@ -3104,16 +3099,16 @@ DECLARE(drawgfx_core,(
if (gfx->flags & GFX_ELEMENT_PACKED)
{
if (pribuf)
- BLOCKMOVEPRI(4toN_opaque,(sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask));
+ BLOCKMOVEPRI(4toN_opaque,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask));
else
- BLOCKMOVELU(4toN_opaque,(sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata));
+ BLOCKMOVELU(4toN_opaque,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata));
}
else
{
if (pribuf)
- BLOCKMOVEPRI(8toN_opaque,(sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask));
+ BLOCKMOVEPRI(8toN_opaque,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask));
else
- BLOCKMOVELU(8toN_opaque,(sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata));
+ BLOCKMOVELU(8toN_opaque,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata));
}
break;
@@ -3121,16 +3116,16 @@ DECLARE(drawgfx_core,(
if (gfx->flags & GFX_ELEMENT_PACKED)
{
if (pribuf)
- BLOCKMOVEPRI(4toN_transpen,(sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask,transparent_color));
+ BLOCKMOVEPRI(4toN_transpen,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask,transparent_color));
else
- BLOCKMOVELU(4toN_transpen,(sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,transparent_color));
+ BLOCKMOVELU(4toN_transpen,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,transparent_color));
}
else
{
if (pribuf)
- BLOCKMOVEPRI(8toN_transpen,(sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask,transparent_color));
+ BLOCKMOVEPRI(8toN_transpen,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask,transparent_color));
else
- BLOCKMOVELU(8toN_transpen,(sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,transparent_color));
+ BLOCKMOVELU(8toN_transpen,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,transparent_color));
}
break;
@@ -3138,45 +3133,45 @@ DECLARE(drawgfx_core,(
if (gfx->flags & GFX_ELEMENT_PACKED)
{
if (pribuf)
- BLOCKMOVERAWPRI(4toN_transpen,(sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,color,pribuf,pri_mask,transparent_color));
+ BLOCKMOVERAWPRI(4toN_transpen,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,color,pribuf,pri_mask,transparent_color));
else
- BLOCKMOVERAW(4toN_transpen,(sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,color,transparent_color));
+ BLOCKMOVERAW(4toN_transpen,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,color,transparent_color));
}
else
{
if (pribuf)
- BLOCKMOVERAWPRI(8toN_transpen,(sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,color,pribuf,pri_mask,transparent_color));
+ BLOCKMOVERAWPRI(8toN_transpen,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,color,pribuf,pri_mask,transparent_color));
else
- BLOCKMOVERAW(8toN_transpen,(sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,color,transparent_color));
+ BLOCKMOVERAW(8toN_transpen,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,color,transparent_color));
}
break;
case TRANSPARENCY_PENS:
if (pribuf)
- BLOCKMOVEPRI(8toN_transmask,(sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask,transparent_color));
+ BLOCKMOVEPRI(8toN_transmask,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask,transparent_color));
else
- BLOCKMOVELU(8toN_transmask,(sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,transparent_color));
+ BLOCKMOVELU(8toN_transmask,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,transparent_color));
break;
case TRANSPARENCY_PEN_TABLE:
if (pribuf)
- BLOCKMOVEPRI(8toN_pen_table,(sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask,transparent_color));
+ BLOCKMOVEPRI(8toN_pen_table,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask,transparent_color));
else
- BLOCKMOVELU(8toN_pen_table,(sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,transparent_color));
+ BLOCKMOVELU(8toN_pen_table,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,transparent_color));
break;
case TRANSPARENCY_ALPHA:
if (pribuf)
- BLOCKMOVEPRI(8toN_alpha,(sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask,transparent_color));
+ BLOCKMOVEPRI(8toN_alpha,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask,transparent_color));
else
- BLOCKMOVELU(8toN_alpha,(sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,transparent_color));
+ BLOCKMOVELU(8toN_alpha,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,transparent_color));
break;
case TRANSPARENCY_ALPHARANGE:
if (pribuf)
- BLOCKMOVEPRI(8toN_alpharange,(sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask,transparent_color));
+ BLOCKMOVEPRI(8toN_alpharange,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask,transparent_color));
else
- BLOCKMOVELU(8toN_alpharange,(sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,transparent_color));
+ BLOCKMOVELU(8toN_alpharange,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,transparent_color));
break;
default:
diff --git a/src/emu/drawgfx.h b/src/emu/drawgfx.h
index 89ae33ecbe8..96249a9d85d 100644
--- a/src/emu/drawgfx.h
+++ b/src/emu/drawgfx.h
@@ -137,6 +137,7 @@ struct _gfx_element
UINT8 * gfxdata; /* pixel data, 8bpp or 4bpp (if GFX_ELEMENT_PACKED) */
UINT32 line_modulo; /* bytes between each row of data */
UINT32 char_modulo; /* bytes between each element */
+ running_machine * machine; /* pointer to the owning machine */
gfx_layout layout; /* copy of the original layout */
};
@@ -187,7 +188,7 @@ void drawgfx_init(running_machine *machine);
void decodechar(gfx_element *gfx,int num,const unsigned char *src);
-gfx_element *allocgfx(const gfx_layout *gl);
+gfx_element *allocgfx(running_machine *machine, const gfx_layout *gl);
void decodegfx(gfx_element *gfx, const UINT8 *src, UINT32 first, UINT32 count);
void freegfx(gfx_element *gfx);
diff --git a/src/emu/video.c b/src/emu/video.c
index f47e9e10996..068147578e5 100644
--- a/src/emu/video.c
+++ b/src/emu/video.c
@@ -583,7 +583,7 @@ static void allocate_graphics(running_machine *machine, const gfx_decode_entry *
glcopy.total = total;
/* allocate the graphics */
- machine->gfx[i] = allocgfx(&glcopy);
+ machine->gfx[i] = allocgfx(machine, &glcopy);
/* if we have a remapped colortable, point our local colortable to it */
machine->gfx[i]->total_colors = gfxdecodeinfo[i].total_color_codes;
diff --git a/src/mame/drivers/cps3.c b/src/mame/drivers/cps3.c
index 898ab39ff05..959ccec3844 100644
--- a/src/mame/drivers/cps3.c
+++ b/src/mame/drivers/cps3.c
@@ -859,13 +859,13 @@ static VIDEO_START(cps3)
state_save_register_global_pointer(machine, cps3_char_ram, 0x800000 /4);
/* create the char set (gfx will then be updated dynamically from RAM) */
- machine->gfx[0] = allocgfx(&cps3_tiles8x8_layout);
+ machine->gfx[0] = allocgfx(machine, &cps3_tiles8x8_layout);
machine->gfx[0]->total_colors = machine->config->total_colors / 16;
//decode_ssram();
/* create the char set (gfx will then be updated dynamically from RAM) */
- machine->gfx[1] = allocgfx(&cps3_tiles16x16_layout);
+ machine->gfx[1] = allocgfx(machine, &cps3_tiles16x16_layout);
machine->gfx[1]->total_colors = machine->config->total_colors / 64;
machine->gfx[1]->color_granularity=64;
diff --git a/src/mame/drivers/hornet.c b/src/mame/drivers/hornet.c
index 1e48c4521c6..3a38f476272 100644
--- a/src/mame/drivers/hornet.c
+++ b/src/mame/drivers/hornet.c
@@ -452,7 +452,7 @@ static int K037122_vh_start(running_machine *machine, int chip)
memset(K037122_dirty_map[chip], 0, K037122_NUM_TILES);
memset(K037122_reg[chip], 0, 0x400);
- machine->gfx[K037122_gfx_index[chip]] = allocgfx(&K037122_char_layout);
+ machine->gfx[K037122_gfx_index[chip]] = allocgfx(machine, &K037122_char_layout);
decodegfx(machine->gfx[K037122_gfx_index[chip]], (UINT8*)K037122_char_ram[chip], 0, machine->gfx[K037122_gfx_index[chip]]->total_elements);
machine->gfx[K037122_gfx_index[chip]]->total_colors = machine->config->total_colors / 16;
diff --git a/src/mame/drivers/mpu4drvr.c b/src/mame/drivers/mpu4drvr.c
index fe3727020fb..993ba681b6c 100644
--- a/src/mame/drivers/mpu4drvr.c
+++ b/src/mame/drivers/mpu4drvr.c
@@ -996,10 +996,10 @@ static VIDEO_START( mpu4_vid )
assert(mpu4_gfx_index != MAX_GFX_ELEMENTS);
/* create the char set (gfx will then be updated dynamically from RAM) */
- machine->gfx[mpu4_gfx_index+0] = allocgfx(&mpu4_vid_char_8x8_layout);
- machine->gfx[mpu4_gfx_index+1] = allocgfx(&mpu4_vid_char_8x16_layout);
- machine->gfx[mpu4_gfx_index+2] = allocgfx(&mpu4_vid_char_16x8_layout);
- machine->gfx[mpu4_gfx_index+3] = allocgfx(&mpu4_vid_char_16x16_layout);
+ machine->gfx[mpu4_gfx_index+0] = allocgfx(machine, &mpu4_vid_char_8x8_layout);
+ machine->gfx[mpu4_gfx_index+1] = allocgfx(machine, &mpu4_vid_char_8x16_layout);
+ machine->gfx[mpu4_gfx_index+2] = allocgfx(machine, &mpu4_vid_char_16x8_layout);
+ machine->gfx[mpu4_gfx_index+3] = allocgfx(machine, &mpu4_vid_char_16x16_layout);
/* set the color information */
machine->gfx[mpu4_gfx_index+0]->total_colors = machine->config->total_colors / 16;
diff --git a/src/mame/drivers/namcoic.c b/src/mame/drivers/namcoic.c
index 91a8ccffde0..3550b4ca858 100644
--- a/src/mame/drivers/namcoic.c
+++ b/src/mame/drivers/namcoic.c
@@ -1618,7 +1618,7 @@ namco_road_init(running_machine *machine, int gfxbank )
mbRoadSomethingIsDirty = 0;
mpRoadRAM = auto_malloc(0x20000);
{
- gfx_element *pGfx = allocgfx( &RoadTileLayout );
+ gfx_element *pGfx = allocgfx( machine, &RoadTileLayout );
decodegfx(pGfx, 0x10000+(UINT8 *)mpRoadRAM, 0, pGfx->total_elements);
pGfx->color_base = 0xf00;
pGfx->total_colors = 0x3f;
diff --git a/src/mame/drivers/nwk-tr.c b/src/mame/drivers/nwk-tr.c
index 48c417d458b..197ad75d767 100644
--- a/src/mame/drivers/nwk-tr.c
+++ b/src/mame/drivers/nwk-tr.c
@@ -458,9 +458,9 @@ int K001604_vh_start(running_machine *machine, int chip)
memset(K001604_reg[chip], 0, 0x400);
- machine->gfx[K001604_gfx_index[chip][0]] = allocgfx(&K001604_char_layout_layer_8x8);
+ machine->gfx[K001604_gfx_index[chip][0]] = allocgfx(machine, &K001604_char_layout_layer_8x8);
decodegfx(machine->gfx[K001604_gfx_index[chip][0]], (UINT8*)&K001604_char_ram[chip][0], 0, machine->gfx[K001604_gfx_index[chip][0]]->total_elements);
- machine->gfx[K001604_gfx_index[chip][1]] = allocgfx(&K001604_char_layout_layer_16x16);
+ machine->gfx[K001604_gfx_index[chip][1]] = allocgfx(machine, &K001604_char_layout_layer_16x16);
decodegfx(machine->gfx[K001604_gfx_index[chip][1]], (UINT8*)&K001604_char_ram[chip][0], 0, machine->gfx[K001604_gfx_index[chip][1]]->total_elements);
machine->gfx[K001604_gfx_index[chip][0]]->total_colors = machine->config->total_colors / 16;
diff --git a/src/mame/drivers/srmp6.c b/src/mame/drivers/srmp6.c
index bbf3ac840cf..affe4809327 100644
--- a/src/mame/drivers/srmp6.c
+++ b/src/mame/drivers/srmp6.c
@@ -127,7 +127,7 @@ static void update_palette(running_machine *machine)
static VIDEO_START(srmp6)
{
/* create the char set (gfx will then be updated dynamically from RAM) */
- machine->gfx[0] = allocgfx(&tiles8x8_layout);
+ machine->gfx[0] = allocgfx(machine, &tiles8x8_layout);
machine->gfx[0]->total_colors = machine->config->total_colors / 256;
machine->gfx[0]->color_granularity=256;
diff --git a/src/mame/video/atarisy1.c b/src/mame/video/atarisy1.c
index 58660982765..f5683a2afbc 100644
--- a/src/mame/video/atarisy1.c
+++ b/src/mame/video/atarisy1.c
@@ -671,15 +671,15 @@ static int get_bank(running_machine *machine, UINT8 prom1, UINT8 prom2, int bpp)
switch (bpp)
{
case 4:
- machine->gfx[gfx_index] = allocgfx(&objlayout_4bpp);
+ machine->gfx[gfx_index] = allocgfx(machine, &objlayout_4bpp);
break;
case 5:
- machine->gfx[gfx_index] = allocgfx(&objlayout_5bpp);
+ machine->gfx[gfx_index] = allocgfx(machine, &objlayout_5bpp);
break;
case 6:
- machine->gfx[gfx_index] = allocgfx(&objlayout_6bpp);
+ machine->gfx[gfx_index] = allocgfx(machine, &objlayout_6bpp);
break;
default:
diff --git a/src/mame/video/konamiic.c b/src/mame/video/konamiic.c
index f72f3109ec4..0f20c09e03a 100644
--- a/src/mame/video/konamiic.c
+++ b/src/mame/video/konamiic.c
@@ -1212,7 +1212,7 @@ static void decode_gfx(running_machine *machine, int gfx_index, UINT8 *data, UIN
memcpy(&gl, layout, sizeof(gl));
gl.total = total;
- machine->gfx[gfx_index] = allocgfx(&gl);
+ machine->gfx[gfx_index] = allocgfx(machine, &gl);
decodegfx(machine->gfx[gfx_index], data, 0, machine->gfx[gfx_index]->total_elements);
/* set the color information */
diff --git a/src/mame/video/m10.c b/src/mame/video/m10.c
index ab48612428e..aeb9915c6e2 100644
--- a/src/mame/video/m10.c
+++ b/src/mame/video/m10.c
@@ -99,7 +99,7 @@ VIDEO_START( m10 )
tilemap_set_scrolldx(tx_tilemap, 0, 62);
tilemap_set_scrolldy(tx_tilemap, 0, 0);
- back_gfx = allocgfx(&backlayout);
+ back_gfx = allocgfx(machine, &backlayout);
back_gfx->total_colors = 8;
machine->gfx[1] = back_gfx;
@@ -110,7 +110,7 @@ VIDEO_START( m15 )
{
m10_state *state = machine->driver_data;
- machine->gfx[0] = allocgfx(&charlayout);
+ machine->gfx[0] = allocgfx(machine, &charlayout);
machine->gfx[0]->total_colors = 8;
decodegfx(machine->gfx[0], state->chargen,0,256);
diff --git a/src/mame/video/namcona1.c b/src/mame/video/namcona1.c
index 348c49486a7..94e7653b287 100644
--- a/src/mame/video/namcona1.c
+++ b/src/mame/video/namcona1.c
@@ -341,15 +341,15 @@ VIDEO_START( namcona1 )
cgram = auto_malloc( 0x1000*0x40 );
dirtychar = auto_malloc( 0x1000 );
- gfx0 = allocgfx( &cg_layout_8bpp );
+ gfx0 = allocgfx( machine, &cg_layout_8bpp );
gfx0->total_colors = machine->config->total_colors/256;
machine->gfx[0] = gfx0;
- gfx1 = allocgfx( &cg_layout_4bpp );
+ gfx1 = allocgfx( machine, &cg_layout_4bpp );
gfx1->total_colors = machine->config->total_colors/16;
machine->gfx[1] = gfx1;
- gfx2 = allocgfx( &shape_layout );
+ gfx2 = allocgfx( machine, &shape_layout );
gfx2->total_colors = machine->config->total_colors/2;
machine->gfx[2] = gfx2;
} /* namcona1_vh_start */
diff --git a/src/mame/video/plygonet.c b/src/mame/video/plygonet.c
index ad2fff51fb1..a77500be732 100644
--- a/src/mame/video/plygonet.c
+++ b/src/mame/video/plygonet.c
@@ -72,7 +72,7 @@ VIDEO_START( polygonet )
assert(ttl_gfx_index != MAX_GFX_ELEMENTS);
// decode the ttl layer's gfx
- machine->gfx[ttl_gfx_index] = allocgfx(&charlayout);
+ machine->gfx[ttl_gfx_index] = allocgfx(machine, &charlayout);
decodegfx(machine->gfx[ttl_gfx_index], memory_region(machine, "gfx1"), 0, machine->gfx[ttl_gfx_index]->total_elements);
machine->gfx[ttl_gfx_index]->total_colors = machine->config->total_colors / 16;
diff --git a/src/mame/video/ppu2c0x.c b/src/mame/video/ppu2c0x.c
index bae3f807fb6..06ea5e9c19f 100644
--- a/src/mame/video/ppu2c0x.c
+++ b/src/mame/video/ppu2c0x.c
@@ -363,7 +363,7 @@ void ppu2c0x_init(running_machine *machine, const ppu2c0x_interface *interface )
memcpy(&gl, &ppu_charlayout, sizeof(gl));
gl.total = total;
- machine->gfx[intf->gfx_layout_number[i]] = allocgfx( &gl );
+ machine->gfx[intf->gfx_layout_number[i]] = allocgfx( machine, &gl );
decodegfx( machine->gfx[intf->gfx_layout_number[i]], src, 0, machine->gfx[intf->gfx_layout_number[i]]->total_elements );
machine->gfx[intf->gfx_layout_number[i]]->total_colors = 8;
}
diff --git a/src/mame/video/rungun.c b/src/mame/video/rungun.c
index 4cd71a8fb72..8e701622ae9 100644
--- a/src/mame/video/rungun.c
+++ b/src/mame/video/rungun.c
@@ -97,7 +97,7 @@ VIDEO_START(rng)
assert(ttl_gfx_index != MAX_GFX_ELEMENTS);
// decode the ttl layer's gfx
- machine->gfx[ttl_gfx_index] = allocgfx(&charlayout);
+ machine->gfx[ttl_gfx_index] = allocgfx(machine, &charlayout);
decodegfx(machine->gfx[ttl_gfx_index], memory_region(machine, "gfx3"), 0, machine->gfx[ttl_gfx_index]->total_elements);
machine->gfx[ttl_gfx_index]->total_colors = machine->config->total_colors / 16;
diff --git a/src/mame/video/segaic24.c b/src/mame/video/segaic24.c
index 5b68971aea8..2d8df0852c7 100644
--- a/src/mame/video/segaic24.c
+++ b/src/mame/video/segaic24.c
@@ -171,7 +171,7 @@ void sys24_tile_vh_start(running_machine *machine, UINT16 tile_mask)
memset(sys24_char_dirtymap, 1, SYS24_TILES);
sys24_char_dirty = 1;
- machine->gfx[sys24_char_gfx_index] = allocgfx(&sys24_char_layout);
+ machine->gfx[sys24_char_gfx_index] = allocgfx(machine, &sys24_char_layout);
machine->gfx[sys24_char_gfx_index]->total_colors = machine->config->total_colors / 16;
diff --git a/src/mame/video/st0016.c b/src/mame/video/st0016.c
index 2ef020facfd..5e907aa6b47 100644
--- a/src/mame/video/st0016.c
+++ b/src/mame/video/st0016.c
@@ -463,7 +463,7 @@ VIDEO_START( st0016 )
assert(gfx_index != MAX_GFX_ELEMENTS);
/* create the char set (gfx will then be updated dynamically from RAM) */
- machine->gfx[gfx_index] = allocgfx(&charlayout);
+ machine->gfx[gfx_index] = allocgfx(machine, &charlayout);
chardirty = auto_malloc(ST0016_MAX_CHAR_BANK);
memset(chardirty, 1, ST0016_MAX_CHAR_BANK);
diff --git a/src/mame/video/taitoic.c b/src/mame/video/taitoic.c
index f894ed6e265..ded8001bbc4 100644
--- a/src/mame/video/taitoic.c
+++ b/src/mame/video/taitoic.c
@@ -1552,7 +1552,7 @@ void TC0080VCO_vh_start(running_machine *machine, int gfxnum,int has_fg0,int bg_
assert(gfx_index != MAX_GFX_ELEMENTS);
/* create the char set (gfx will then be updated dynamically from RAM) */
- machine->gfx[gfx_index] = allocgfx(&TC0080VCO_charlayout);
+ machine->gfx[gfx_index] = allocgfx(machine, &TC0080VCO_charlayout);
/* set the color information */
machine->gfx[gfx_index]->total_colors = 64; // is this correct ?
@@ -2326,7 +2326,7 @@ void TC0100SCN_vh_start(running_machine *machine, int chips,int gfxnum,int x_off
assert(gfx_index != MAX_GFX_ELEMENTS);
/* create the char set (gfx will then be updated dynamically from RAM) */
- machine->gfx[gfx_index] = allocgfx(&TC0100SCN_charlayout);
+ machine->gfx[gfx_index] = allocgfx(machine, &TC0100SCN_charlayout);
/* set the color information */
machine->gfx[gfx_index]->total_colors = 64;
@@ -3195,7 +3195,7 @@ void TC0480SCP_vh_start(running_machine *machine, int gfxnum,int pixels,int x_of
assert(gfx_index != MAX_GFX_ELEMENTS);
/* create the char set (gfx will then be updated dynamically from RAM) */
- machine->gfx[gfx_index] = allocgfx(&TC0480SCP_charlayout);
+ machine->gfx[gfx_index] = allocgfx(machine, &TC0480SCP_charlayout);
/* set the color information */
machine->gfx[gfx_index]->total_colors = 64;
diff --git a/src/mame/video/taitojc.c b/src/mame/video/taitojc.c
index 37d75e0ff52..bc83c89455e 100644
--- a/src/mame/video/taitojc.c
+++ b/src/mame/video/taitojc.c
@@ -220,7 +220,7 @@ VIDEO_START( taitojc )
memset(taitojc_tile_ram, 0, 0x4000);
/* create the char set (gfx will then be updated dynamically from RAM) */
- machine->gfx[taitojc_gfx_index] = allocgfx(&taitojc_char_layout);
+ machine->gfx[taitojc_gfx_index] = allocgfx(machine, &taitojc_char_layout);
/* set the color information */
machine->gfx[taitojc_gfx_index]->total_colors = machine->config->total_colors / 16;
diff --git a/src/mame/video/tceptor.c b/src/mame/video/tceptor.c
index a450104c102..e6b10db560e 100644
--- a/src/mame/video/tceptor.c
+++ b/src/mame/video/tceptor.c
@@ -276,7 +276,7 @@ static void decode_bg(running_machine *machine, const char * region)
free(buffer);
/* decode the graphics */
- machine->gfx[gfx_index] = allocgfx(&bg_layout);
+ machine->gfx[gfx_index] = allocgfx(machine, &bg_layout);
decodegfx(machine->gfx[gfx_index], memory_region(machine, region), 0, machine->gfx[gfx_index]->total_elements);
/* set the color information */
@@ -287,7 +287,7 @@ static void decode_bg(running_machine *machine, const char * region)
static void decode_sprite(running_machine *machine, int gfx_index, const gfx_layout *layout, const void *data)
{
/* decode the graphics */
- machine->gfx[gfx_index] = allocgfx(layout);
+ machine->gfx[gfx_index] = allocgfx(machine, layout);
decodegfx(machine->gfx[gfx_index], data, 0, machine->gfx[gfx_index]->total_elements);
/* set the color information */