summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2007-12-26 16:55:35 +0000
committer Aaron Giles <aaron@aarongiles.com>2007-12-26 16:55:35 +0000
commit28d23853ae0f6d69080f4d3cb960257502d4be90 (patch)
treed1cac859cbab17796198424cc9cd625a2b8c3911 /src/emu
parent6e449526786d9c6c42f6f668d69efcb4ac8fe761 (diff)
(From AtariAce)
This patch should complete the addition of static qualifiers to all MAME symbols that aren't explicitly exported. It primarily handles generated code (e.g. amspdwy.c), plus a handful of cases I'd previously missed and some new cases introduced in the last update. One interesting bit was the discovery that the 32-bit scanline routines in drawgfx.c are unused. I debated eliminating them but decided instead to just export them. Various internal drawgfx functions were conditionally removed by examining a new RAW define, although one routine (blockmove_8toN_alphaone) was determined to be dead code. While investigating constifying MESS, I came across a few core APIs that were missing const qualifiers which this patch fixes. I also consted up tx1.c while I was at it.
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/cpu/f8/f3853.c2
-rw-r--r--src/emu/cpu/f8/f3853.h2
-rw-r--r--src/emu/cpu/z80gb/z80gb.h2
-rw-r--r--src/emu/drawgfx.c66
-rw-r--r--src/emu/drawgfx.h3
-rw-r--r--src/emu/sound/sidenvel.c2
-rw-r--r--src/emu/sound/sidenvel.h2
-rw-r--r--src/emu/sound/speaker.h2
8 files changed, 60 insertions, 21 deletions
diff --git a/src/emu/cpu/f8/f3853.c b/src/emu/cpu/f8/f3853.c
index a51040446cf..949ffdf8f76 100644
--- a/src/emu/cpu/f8/f3853.c
+++ b/src/emu/cpu/f8/f3853.c
@@ -72,7 +72,7 @@ static TIMER_CALLBACK( f3853_timer_callback )
}
-void f3853_init(F3853_CONFIG *config)
+void f3853_init(const F3853_CONFIG *config)
{
UINT8 reg=0xfe;
int i;
diff --git a/src/emu/cpu/f8/f3853.h b/src/emu/cpu/f8/f3853.h
index ba1b6e4273f..35e5f78a7a1 100644
--- a/src/emu/cpu/f8/f3853.h
+++ b/src/emu/cpu/f8/f3853.h
@@ -12,7 +12,7 @@ typedef struct {
void (*interrupt_request)(UINT16 addr, int level);
} F3853_CONFIG;
-void f3853_init(F3853_CONFIG *config);
+void f3853_init(const F3853_CONFIG *config);
void f3853_reset(void);
// ports 0x0c - 0x0f
diff --git a/src/emu/cpu/z80gb/z80gb.h b/src/emu/cpu/z80gb/z80gb.h
index 5721c4cf8aa..abbbe41df0b 100644
--- a/src/emu/cpu/z80gb/z80gb.h
+++ b/src/emu/cpu/z80gb/z80gb.h
@@ -4,7 +4,7 @@
#include "cpuintrf.h"
typedef struct {
- UINT16 *regs;
+ const UINT16 *regs;
UINT8 features;
void (*timer_callback)(int cycles);
} Z80GB_CONFIG;
diff --git a/src/emu/drawgfx.c b/src/emu/drawgfx.c
index 43f7b184354..51aa6dee463 100644
--- a/src/emu/drawgfx.c
+++ b/src/emu/drawgfx.c
@@ -617,43 +617,50 @@ int pdrawgfx_shadow_lowpri = 0;
int leftskip,int topskip,int flipx,int flipy, \
DATA_TYPE *dstdata,int dstwidth,int dstheight,int dstmodulo
+#define RAW 1
#define COLOR_ARG unsigned int colorbase,UINT8 *pridata,UINT32 pmask
#define INCREMENT_DST(n) {dstdata+=(n);pridata += (n);}
#define LOOKUP(n) (colorbase + (n))
#define SETPIXELCOLOR(dest,n) { if (((1 << (pridata[dest] & 0x1f)) & pmask) == 0) { if (pridata[dest] & 0x80) { dstdata[dest] = palette_shadow_table[n];} else { dstdata[dest] = (n);} } pridata[dest] = (pridata[dest] & 0x7f) | afterdrawmask; }
-#define DECLARE_SWAP_RAW_PRI(function,args,body) void function##_raw_pri8 args body
+#define DECLARE_SWAP_RAW_PRI(function,args,body) static void function##_raw_pri8 args body
#include "drawgfx.c"
#undef DECLARE_SWAP_RAW_PRI
#undef COLOR_ARG
#undef LOOKUP
#undef SETPIXELCOLOR
+#undef RAW
+#define RAW 0
#define COLOR_ARG const pen_t *paldata,UINT8 *pridata,UINT32 pmask
#define LOOKUP(n) (paldata[n])
#define SETPIXELCOLOR(dest,n) { if (((1 << (pridata[dest] & 0x1f)) & pmask) == 0) { if (pridata[dest] & 0x80) { dstdata[dest] = palette_shadow_table[n];} else { dstdata[dest] = (n);} } pridata[dest] = (pridata[dest] & 0x7f) | afterdrawmask; }
-#define DECLARE_SWAP_RAW_PRI(function,args,body) void function##_pri8 args body
+#define DECLARE_SWAP_RAW_PRI(function,args,body) static void function##_pri8 args body
#include "drawgfx.c"
#undef DECLARE_SWAP_RAW_PRI
#undef COLOR_ARG
#undef LOOKUP
#undef INCREMENT_DST
#undef SETPIXELCOLOR
+#undef RAW
+#define RAW 1
#define COLOR_ARG unsigned int colorbase
#define INCREMENT_DST(n) {dstdata+=(n);}
#define LOOKUP(n) (colorbase + (n))
#define SETPIXELCOLOR(dest,n) {dstdata[dest] = (n);}
-#define DECLARE_SWAP_RAW_PRI(function,args,body) void function##_raw8 args body
+#define DECLARE_SWAP_RAW_PRI(function,args,body) static void function##_raw8 args body
#include "drawgfx.c"
#undef DECLARE_SWAP_RAW_PRI
#undef COLOR_ARG
#undef LOOKUP
#undef SETPIXELCOLOR
+#undef RAW
+#define RAW 0
#define COLOR_ARG const pen_t *paldata
#define LOOKUP(n) (paldata[n])
#define SETPIXELCOLOR(dest,n) {dstdata[dest] = (n);}
-#define DECLARE_SWAP_RAW_PRI(function,args,body) void function##8 args body
+#define DECLARE_SWAP_RAW_PRI(function,args,body) static void function##8 args body
#include "drawgfx.c"
#undef DECLARE_SWAP_RAW_PRI
#undef COLOR_ARG
@@ -667,7 +674,7 @@ int pdrawgfx_shadow_lowpri = 0;
#undef DECLARE
#undef DECLAREG
-#define DECLARE(function,args,body) void function##8 args body
+#define DECLARE(function,args,body) static void function##8 args body
#define DECLAREG(function,args,body) void function##8 args body
#define DECLARE_SWAP_RAW_PRI(function,args,body)
#define BLOCKMOVE(function,flipx,args) \
@@ -691,6 +698,7 @@ int pdrawgfx_shadow_lowpri = 0;
#undef BLOCKMOVEPRI
#undef BLOCKMOVERAWPRI
+#undef RAW
#undef DEPTH
#undef DATA_TYPE
@@ -710,43 +718,50 @@ int pdrawgfx_shadow_lowpri = 0;
int leftskip,int topskip,int flipx,int flipy, \
DATA_TYPE *dstdata,int dstwidth,int dstheight,int dstmodulo
+#define RAW 1
#define COLOR_ARG unsigned int colorbase,UINT8 *pridata,UINT32 pmask
#define INCREMENT_DST(n) {dstdata+=(n);pridata += (n);}
#define LOOKUP(n) (colorbase + (n))
#define SETPIXELCOLOR(dest,n) { if (((1 << (pridata[dest] & 0x1f)) & pmask) == 0) { if (pridata[dest] & 0x80) { dstdata[dest] = palette_shadow_table[n];} else { dstdata[dest] = (n);} } pridata[dest] = (pridata[dest] & 0x7f) | afterdrawmask; }
-#define DECLARE_SWAP_RAW_PRI(function,args,body) void function##_raw_pri16 args body
+#define DECLARE_SWAP_RAW_PRI(function,args,body) static void function##_raw_pri16 args body
#include "drawgfx.c"
#undef DECLARE_SWAP_RAW_PRI
#undef COLOR_ARG
#undef LOOKUP
#undef SETPIXELCOLOR
+#undef RAW
+#define RAW 0
#define COLOR_ARG const pen_t *paldata,UINT8 *pridata,UINT32 pmask
#define LOOKUP(n) (paldata[n])
#define SETPIXELCOLOR(dest,n) { if (((1 << (pridata[dest] & 0x1f)) & pmask) == 0) { if (pridata[dest] & 0x80) { dstdata[dest] = palette_shadow_table[n];} else { dstdata[dest] = (n);} } pridata[dest] = (pridata[dest] & 0x7f) | afterdrawmask; }
-#define DECLARE_SWAP_RAW_PRI(function,args,body) void function##_pri16 args body
+#define DECLARE_SWAP_RAW_PRI(function,args,body) static void function##_pri16 args body
#include "drawgfx.c"
#undef DECLARE_SWAP_RAW_PRI
#undef COLOR_ARG
#undef LOOKUP
#undef INCREMENT_DST
#undef SETPIXELCOLOR
+#undef RAW
+#define RAW 1
#define COLOR_ARG unsigned int colorbase
#define INCREMENT_DST(n) {dstdata+=(n);}
#define LOOKUP(n) (colorbase + (n))
#define SETPIXELCOLOR(dest,n) {dstdata[dest] = (n);}
-#define DECLARE_SWAP_RAW_PRI(function,args,body) void function##_raw16 args body
+#define DECLARE_SWAP_RAW_PRI(function,args,body) static void function##_raw16 args body
#include "drawgfx.c"
#undef DECLARE_SWAP_RAW_PRI
#undef COLOR_ARG
#undef LOOKUP
#undef SETPIXELCOLOR
+#undef RAW
+#define RAW 0
#define COLOR_ARG const pen_t *paldata
#define LOOKUP(n) (paldata[n])
#define SETPIXELCOLOR(dest,n) {dstdata[dest] = (n);}
-#define DECLARE_SWAP_RAW_PRI(function,args,body) void function##16 args body
+#define DECLARE_SWAP_RAW_PRI(function,args,body) static void function##16 args body
#include "drawgfx.c"
#undef DECLARE_SWAP_RAW_PRI
#undef COLOR_ARG
@@ -760,7 +775,7 @@ int pdrawgfx_shadow_lowpri = 0;
#undef DECLARE
#undef DECLAREG
-#define DECLARE(function,args,body) void function##16 args body
+#define DECLARE(function,args,body) static void function##16 args body
#define DECLAREG(function,args,body) void function##16 args body
#define DECLARE_SWAP_RAW_PRI(function,args,body)
#define BLOCKMOVE(function,flipx,args) \
@@ -784,6 +799,7 @@ int pdrawgfx_shadow_lowpri = 0;
#undef BLOCKMOVEPRI
#undef BLOCKMOVERAWPRI
+#undef RAW
#undef DEPTH
#undef DATA_TYPE
#undef alpha_blend_r
@@ -810,43 +826,50 @@ INLINE UINT32 SHADOW32(pen_t *shadow_table, UINT32 c) {
int leftskip,int topskip,int flipx,int flipy, \
DATA_TYPE *dstdata,int dstwidth,int dstheight,int dstmodulo
+#define RAW 1
#define COLOR_ARG unsigned int colorbase,UINT8 *pridata,UINT32 pmask
#define INCREMENT_DST(n) {dstdata+=(n);pridata += (n);}
#define LOOKUP(n) (colorbase + (n))
#define SETPIXELCOLOR(dest,n) { UINT8 r8=pridata[dest]; if(!(1<<(r8&0x1f)&pmask)){ if(afterdrawmask){ r8&=0x7f; r8|=0x1f; dstdata[dest]=(n); pridata[dest]=r8; } else if(!(r8&0x80)){ dstdata[dest]=SHADOW32(palette_shadow_table,n); pridata[dest]|=0x80; } } }
-#define DECLARE_SWAP_RAW_PRI(function,args,body) void function##_raw_pri32 args body
+#define DECLARE_SWAP_RAW_PRI(function,args,body) static void function##_raw_pri32 args body
#include "drawgfx.c"
#undef DECLARE_SWAP_RAW_PRI
#undef COLOR_ARG
#undef LOOKUP
#undef SETPIXELCOLOR
+#undef RAW
+#define RAW 0
#define COLOR_ARG const pen_t *paldata,UINT8 *pridata,UINT32 pmask
#define LOOKUP(n) (paldata[n])
#define SETPIXELCOLOR(dest,n) { UINT8 r8=pridata[dest]; if(!(1<<(r8&0x1f)&pmask)){ if(afterdrawmask){ r8&=0x7f; r8|=0x1f; dstdata[dest]=(n); pridata[dest]=r8; } else if(!(r8&0x80)){ dstdata[dest]=SHADOW32(palette_shadow_table,n); pridata[dest]|=0x80; } } }
-#define DECLARE_SWAP_RAW_PRI(function,args,body) void function##_pri32 args body
+#define DECLARE_SWAP_RAW_PRI(function,args,body) static void function##_pri32 args body
#include "drawgfx.c"
#undef DECLARE_SWAP_RAW_PRI
#undef COLOR_ARG
#undef LOOKUP
#undef INCREMENT_DST
#undef SETPIXELCOLOR
+#undef RAW
+#define RAW 1
#define COLOR_ARG unsigned int colorbase
#define INCREMENT_DST(n) {dstdata+=(n);}
#define LOOKUP(n) (colorbase + (n))
#define SETPIXELCOLOR(dest,n) {dstdata[dest] = (n);}
-#define DECLARE_SWAP_RAW_PRI(function,args,body) void function##_raw32 args body
+#define DECLARE_SWAP_RAW_PRI(function,args,body) static void function##_raw32 args body
#include "drawgfx.c"
#undef DECLARE_SWAP_RAW_PRI
#undef COLOR_ARG
#undef LOOKUP
#undef SETPIXELCOLOR
+#undef RAW
+#define RAW 0
#define COLOR_ARG const pen_t *paldata
#define LOOKUP(n) (paldata[n])
#define SETPIXELCOLOR(dest,n) {dstdata[dest] = (n);}
-#define DECLARE_SWAP_RAW_PRI(function,args,body) void function##32 args body
+#define DECLARE_SWAP_RAW_PRI(function,args,body) static void function##32 args body
#include "drawgfx.c"
#undef DECLARE_SWAP_RAW_PRI
#undef COLOR_ARG
@@ -860,7 +883,7 @@ INLINE UINT32 SHADOW32(pen_t *shadow_table, UINT32 c) {
#undef DECLARE
#undef DECLAREG
-#define DECLARE(function,args,body) void function##32 args body
+#define DECLARE(function,args,body) static void function##32 args body
#define DECLAREG(function,args,body) void function##32 args body
#define DECLARE_SWAP_RAW_PRI(function,args,body)
#define BLOCKMOVE(function,flipx,args) \
@@ -884,6 +907,7 @@ INLINE UINT32 SHADOW32(pen_t *shadow_table, UINT32 c) {
#undef BLOCKMOVEPRI
#undef BLOCKMOVERAWPRI
+#undef RAW
#undef DEPTH
#undef DATA_TYPE
#undef alpha_blend_r
@@ -3755,6 +3779,7 @@ DECLARE_SWAP_RAW_PRI(blockmove_4toN_transpen,(COMMON_ARGS,
}
})
+#if (RAW == 1)
DECLARE_SWAP_RAW_PRI(blockmove_8toN_transblend,(COMMON_ARGS,
COLOR_ARG,int transpen),
{
@@ -3866,6 +3891,7 @@ DECLARE_SWAP_RAW_PRI(blockmove_8toN_transblend,(COMMON_ARGS,
}
}
})
+#endif
#define PEN_IS_OPAQUE ((1<<col)&transmask) == 0
@@ -3976,6 +4002,7 @@ DECLARE_SWAP_RAW_PRI(blockmove_8toN_transmask,(COMMON_ARGS,
}
})
+#if (RAW == 0)
DECLARE_SWAP_RAW_PRI(blockmove_8toN_transcolor,(COMMON_ARGS,
COLOR_ARG,const UINT16 *colortable,int transcolor),
{
@@ -4099,6 +4126,7 @@ DECLARE_SWAP_RAW_PRI(blockmove_4toN_transcolor,(COMMON_ARGS,
}
}
})
+#endif
#if DEPTH == 32
DECLARE_SWAP_RAW_PRI(blockmove_8toN_pen_table,(COMMON_ARGS,
@@ -4261,6 +4289,7 @@ DECLARE_SWAP_RAW_PRI(blockmove_8toN_pen_table,(COMMON_ARGS,
#endif
#if DEPTH >= 16
+#if (1 == 0)
DECLARE_SWAP_RAW_PRI(blockmove_8toN_alphaone,(COMMON_ARGS,
COLOR_ARG,int transpen, int alphapen),
{
@@ -4446,7 +4475,9 @@ DECLARE_SWAP_RAW_PRI(blockmove_8toN_alphaone,(COMMON_ARGS,
}
}
})
+#endif
+#if (RAW == 0)
DECLARE_SWAP_RAW_PRI(blockmove_8toN_alpha,(COMMON_ARGS,
COLOR_ARG,int transpen),
{
@@ -4623,17 +4654,22 @@ DECLARE_SWAP_RAW_PRI(blockmove_8toN_alpharange,(COMMON_ARGS,
}
}
})
+#endif
#else
+#if (1 == 0)
DECLARE_SWAP_RAW_PRI(blockmove_8toN_alphaone,(COMMON_ARGS,
COLOR_ARG,int transpen, int alphapen),{})
+#endif
+#if (RAW == 0)
DECLARE_SWAP_RAW_PRI(blockmove_8toN_alpha,(COMMON_ARGS,
COLOR_ARG,int transpen),{})
DECLARE_SWAP_RAW_PRI(blockmove_8toN_alpharange,(COMMON_ARGS,
COLOR_ARG,int transpen),{})
+#endif
#endif
diff --git a/src/emu/drawgfx.h b/src/emu/drawgfx.h
index 513b7b289df..9f99b6ca1b8 100644
--- a/src/emu/drawgfx.h
+++ b/src/emu/drawgfx.h
@@ -227,10 +227,13 @@ void mdrawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
void draw_scanline8(mame_bitmap *bitmap,int x,int y,int length,const UINT8 *src,const pen_t *pens,int transparent_pen);
void draw_scanline16(mame_bitmap *bitmap,int x,int y,int length,const UINT16 *src,const pen_t *pens,int transparent_pen);
+void draw_scanline32(mame_bitmap *bitmap,int x,int y,int length,const UINT32 *src,const pen_t *pens,int transparent_pen);
void pdraw_scanline8(mame_bitmap *bitmap,int x,int y,int length,const UINT8 *src,const pen_t *pens,int transparent_pen,int pri);
void pdraw_scanline16(mame_bitmap *bitmap,int x,int y,int length,const UINT16 *src,const pen_t *pens,int transparent_pen,int pri);
+void pdraw_scanline32(mame_bitmap *bitmap,int x,int y,int length,const UINT32 *src,const pen_t *pens,int transparent_pen,int pri);
void extract_scanline8(mame_bitmap *bitmap,int x,int y,int length,UINT8 *dst);
void extract_scanline16(mame_bitmap *bitmap,int x,int y,int length,UINT16 *dst);
+void extract_scanline32(mame_bitmap *bitmap,int x,int y,int length,UINT32 *dst);
void copybitmap(mame_bitmap *dest,mame_bitmap *src,int flipx,int flipy,int sx,int sy,
diff --git a/src/emu/sound/sidenvel.c b/src/emu/sound/sidenvel.c
index bb90d31829e..83a9f774d0b 100644
--- a/src/emu/sound/sidenvel.c
+++ b/src/emu/sound/sidenvel.c
@@ -214,7 +214,7 @@ INLINE UINT16 enveEmuAlterShortAttack(sidOperator*);
INLINE UINT16 enveEmuShortAttack(sidOperator*);
-ptr2sidUwordFunc enveModeTable[] =
+const ptr2sidUwordFunc enveModeTable[] =
{
/* 0 */
&enveEmuStartAttack, &enveEmuStartRelease,
diff --git a/src/emu/sound/sidenvel.h b/src/emu/sound/sidenvel.h
index 8f0c83a1465..a609770cb79 100644
--- a/src/emu/sound/sidenvel.h
+++ b/src/emu/sound/sidenvel.h
@@ -10,7 +10,7 @@ extern void enveEmuInit(UINT32 updateFreq, int measuredValues);
void enveEmuResetOperator(sidOperator* pVoice);
-extern ptr2sidUwordFunc enveModeTable[]; // -> envelope.cpp
+extern const ptr2sidUwordFunc enveModeTable[]; // -> envelope.cpp
extern const UINT8 masterVolumeLevels[16]; // -> envelope.cpp
static const UINT8 ENVE_STARTATTACK = 0;
diff --git a/src/emu/sound/speaker.h b/src/emu/sound/speaker.h
index ae89881bb80..7a2e5fef8f8 100644
--- a/src/emu/sound/speaker.h
+++ b/src/emu/sound/speaker.h
@@ -15,7 +15,7 @@ extern "C" {
struct Speaker_interface
{
int num_level; /* optional: number of levels (if not two) */
- INT16 *levels; /* optional: pointer to level lookup table */
+ const INT16 *levels; /* optional: pointer to level lookup table */
};
void speaker_level_w (int which, int new_level);