summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/emu/cpu/h83002/h83002.c4
-rw-r--r--src/emu/cpu/hd6309/hd6309.c8
-rw-r--r--src/emu/cpu/i386/i386.c4
-rw-r--r--src/emu/cpu/jaguar/jaguar.c9
-rw-r--r--src/emu/cpu/m37710/m37710.c4
-rw-r--r--src/emu/cpu/m68000/m68kcpu.c8
-rw-r--r--src/emu/cpu/mips/psx.c11
-rw-r--r--src/emu/cpu/tms34010/tms34010.c6
-rw-r--r--src/emu/emupal.c28
-rw-r--r--src/emu/memory.c10
-rw-r--r--src/emu/sound/2151intf.c7
-rw-r--r--src/emu/sound/2203intf.c5
-rw-r--r--src/emu/sound/2608intf.c5
-rw-r--r--src/emu/sound/2610intf.c5
-rw-r--r--src/emu/sound/2612intf.c5
-rw-r--r--src/emu/sound/fmopl.c5
-rw-r--r--src/emu/sound/k054539.c5
-rw-r--r--src/emu/sound/multipcm.c5
-rw-r--r--src/emu/sound/samples.c4
-rw-r--r--src/emu/sound/upd7759.c5
-rw-r--r--src/emu/sound/vlm5030.c4
-rw-r--r--src/emu/sound/ym2151.c8
-rw-r--r--src/emu/sound/ym2151.h2
-rw-r--r--src/emu/sound/ymz280b.c4
-rw-r--r--src/emu/state.c180
-rw-r--r--src/emu/state.h23
-rw-r--r--src/emu/streams.c8
-rw-r--r--src/emu/tilemap.c6
-rw-r--r--src/emu/timer.c6
-rw-r--r--src/emu/video/cdp1869.c4
-rw-r--r--src/emu/video/mc6845.c6
-rw-r--r--src/emu/video/poly.c7
-rw-r--r--src/mame/drivers/astrocde.c8
-rw-r--r--src/mame/drivers/atarig1.c4
-rw-r--r--src/mame/drivers/atarisy2.c6
-rw-r--r--src/mame/drivers/atetris.c8
-rw-r--r--src/mame/drivers/batman.c2
-rw-r--r--src/mame/drivers/darius.c9
-rw-r--r--src/mame/drivers/decocass.c2
-rw-r--r--src/mame/drivers/djmain.c7
-rw-r--r--src/mame/drivers/eprom.c2
-rw-r--r--src/mame/drivers/konamigq.c2
-rw-r--r--src/mame/drivers/konamigv.c2
-rw-r--r--src/mame/drivers/ksys573.c2
-rw-r--r--src/mame/drivers/m90.c6
-rw-r--r--src/mame/drivers/m92.c7
-rw-r--r--src/mame/drivers/mw8080bw.c6
-rw-r--r--src/mame/drivers/mystwarr.c7
-rw-r--r--src/mame/drivers/namcoic.c5
-rw-r--r--src/mame/drivers/namcos10.c20
-rw-r--r--src/mame/drivers/namcos11.c2
-rw-r--r--src/mame/drivers/namcos12.c2
-rw-r--r--src/mame/drivers/neogeo.c19
-rw-r--r--src/mame/drivers/ninjaw.c9
-rw-r--r--src/mame/drivers/othunder.c7
-rw-r--r--src/mame/drivers/psikyo4.c13
-rw-r--r--src/mame/drivers/renegade.c7
-rw-r--r--src/mame/drivers/slapshot.c7
-rw-r--r--src/mame/drivers/taito_f2.c14
-rw-r--r--src/mame/drivers/taito_h.c7
-rw-r--r--src/mame/drivers/taito_x.c6
-rw-r--r--src/mame/drivers/taito_z.c16
-rw-r--r--src/mame/drivers/taitoair.c6
-rw-r--r--src/mame/drivers/toaplan1.c10
-rw-r--r--src/mame/drivers/topspeed.c11
-rw-r--r--src/mame/drivers/twincobr.c2
-rw-r--r--src/mame/drivers/wardner.c4
-rw-r--r--src/mame/drivers/warriorb.c6
-rw-r--r--src/mame/drivers/wgp.c10
-rw-r--r--src/mame/drivers/xexex.c9
-rw-r--r--src/mame/drivers/xmen.c7
-rw-r--r--src/mame/drivers/zn.c26
-rw-r--r--src/mame/includes/neogeo.h4
-rw-r--r--src/mame/includes/psx.h2
-rw-r--r--src/mame/includes/st0016.h2
-rw-r--r--src/mame/includes/toaplan1.h6
-rw-r--r--src/mame/includes/twincobr.h6
-rw-r--r--src/mame/machine/atari.c14
-rw-r--r--src/mame/machine/atarigen.c6
-rw-r--r--src/mame/machine/atarigen.h2
-rw-r--r--src/mame/machine/decocass.c6
-rw-r--r--src/mame/machine/decocass.h2
-rw-r--r--src/mame/machine/psx.c6
-rw-r--r--src/mame/machine/toaplan1.c10
-rw-r--r--src/mame/machine/twincobr.c12
-rw-r--r--src/mame/machine/williams.c12
-rw-r--r--src/mame/video/asterix.c2
-rw-r--r--src/mame/video/asuka.c2
-rw-r--r--src/mame/video/chaknpop.c10
-rw-r--r--src/mame/video/cloak.c7
-rw-r--r--src/mame/video/darius.c10
-rw-r--r--src/mame/video/dbz.c2
-rw-r--r--src/mame/video/gijoe.c2
-rw-r--r--src/mame/video/gtia.c14
-rw-r--r--src/mame/video/gtia.h2
-rw-r--r--src/mame/video/jaguar.c6
-rw-r--r--src/mame/video/konamiic.c21
-rw-r--r--src/mame/video/konamiic.h2
-rw-r--r--src/mame/video/lethal.c2
-rw-r--r--src/mame/video/moo.c2
-rw-r--r--src/mame/video/neogeo.c12
-rw-r--r--src/mame/video/ninjaw.c6
-rw-r--r--src/mame/video/othunder.c2
-rw-r--r--src/mame/video/overdriv.c2
-rw-r--r--src/mame/video/parodius.c2
-rw-r--r--src/mame/video/psx.c14
-rw-r--r--src/mame/video/rastan.c8
-rw-r--r--src/mame/video/renegade.c7
-rw-r--r--src/mame/video/segaic24.c4
-rw-r--r--src/mame/video/simpsons.c2
-rw-r--r--src/mame/video/st0016.c8
-rw-r--r--src/mame/video/stvvdp1.c6
-rw-r--r--src/mame/video/stvvdp2.c8
-rw-r--r--src/mame/video/superqix.c6
-rw-r--r--src/mame/video/surpratk.c2
-rw-r--r--src/mame/video/system1.c6
-rw-r--r--src/mame/video/taito_f2.c2
-rw-r--r--src/mame/video/taito_z.c2
-rw-r--r--src/mame/video/taitoic.c69
-rw-r--r--src/mame/video/taitoic.h8
-rw-r--r--src/mame/video/taitosj.c4
-rw-r--r--src/mame/video/tceptor.c9
-rw-r--r--src/mame/video/tmnt.c14
-rw-r--r--src/mame/video/toaplan1.c8
-rw-r--r--src/mame/video/topspeed.c2
-rw-r--r--src/mame/video/twincobr.c6
-rw-r--r--src/mame/video/vendetta.c4
-rw-r--r--src/mame/video/warriorb.c4
-rw-r--r--src/mame/video/wgp.c12
-rw-r--r--src/mame/video/xexex.c2
-rw-r--r--src/mame/video/xmen.c4
-rw-r--r--src/mame/video/ygv608.c8
132 files changed, 583 insertions, 550 deletions
diff --git a/src/emu/cpu/h83002/h83002.c b/src/emu/cpu/h83002/h83002.c
index ece79971147..681e1f2b63e 100644
--- a/src/emu/cpu/h83002/h83002.c
+++ b/src/emu/cpu/h83002/h83002.c
@@ -316,7 +316,7 @@ static void h8_setreg32(UINT8 reg, UINT32 data)
h8.regs[reg] = data;
}
-static void h8_onstateload(void)
+static STATE_POSTLOAD( h8_onstateload )
{
h8_set_ccr(h8.ccr);
}
@@ -344,7 +344,7 @@ static void h8_init(int index, int clock, const void *config, int (*irqcallback)
state_save_register_item("H8/3002", index, h8.h8TCNT3);
state_save_register_item("H8/3002", index, h8.h8TCNT4);
- state_save_register_func_postload(h8_onstateload);
+ state_save_register_postload(Machine, h8_onstateload, NULL);
h8_itu_init();
}
diff --git a/src/emu/cpu/hd6309/hd6309.c b/src/emu/cpu/hd6309/hd6309.c
index 73b73f5038f..9183d6a1151 100644
--- a/src/emu/cpu/hd6309/hd6309.c
+++ b/src/emu/cpu/hd6309/hd6309.c
@@ -387,7 +387,7 @@ INLINE void WM32( UINT32 mAddr, PAIR *p )
WM( (mAddr+3)&0xffff, p->b.l );
}
-static void UpdateState( void )
+static void UpdateState(void)
{
if ( hd6309.md & MD_EM )
{
@@ -511,6 +511,10 @@ static void hd6309_set_context(void *src)
UpdateState();
}
+static STATE_POSTLOAD( hd6309_postload )
+{
+ UpdateState();
+}
static void hd6309_init(int index, int clock, const void *config, int (*irqcallback)(int))
{
@@ -525,7 +529,7 @@ static void hd6309_init(int index, int clock, const void *config, int (*irqcallb
state_save_register_item("hd6309", index, DP);
state_save_register_item("hd6309", index, CC);
state_save_register_item("hd6309", index, MD);
- state_save_register_func_postload( UpdateState );
+ state_save_register_postload(Machine, hd6309_postload, NULL);
state_save_register_item("hd6309", index, hd6309.int_state);
state_save_register_item("hd6309", index, hd6309.nmi_state);
state_save_register_item("hd6309", index, hd6309.irq_state[0]);
diff --git a/src/emu/cpu/i386/i386.c b/src/emu/cpu/i386/i386.c
index fa78c1fbd44..01fab039571 100644
--- a/src/emu/cpu/i386/i386.c
+++ b/src/emu/cpu/i386/i386.c
@@ -489,7 +489,7 @@ static void i386_debug_setup(void)
/*************************************************************************/
-static void i386_postload(void)
+static STATE_POSTLOAD( i386_postload )
{
int i;
for (i = 0; i < 6; i++)
@@ -581,7 +581,7 @@ static void i386_init(int index, int clock, const void *config, int (*irqcallbac
state_save_register_item(state_type, index, I.ldtr.flags);
state_save_register_item(state_type, index, I.irq_state);
state_save_register_item(state_type, index, I.performed_intersegment_jump);
- state_save_register_func_postload(i386_postload);
+ state_save_register_postload(Machine, i386_postload, NULL);
}
static void build_opcode_table(UINT32 features)
diff --git a/src/emu/cpu/jaguar/jaguar.c b/src/emu/cpu/jaguar/jaguar.c
index badf0ff9f71..e525a996aaf 100644
--- a/src/emu/cpu/jaguar/jaguar.c
+++ b/src/emu/cpu/jaguar/jaguar.c
@@ -415,14 +415,19 @@ static void init_tables(void)
}
}
+static STATE_POSTLOAD( jaguar_postload )
+{
+ update_register_banks();
+ check_irqs();
+}
+
static void jaguar_state_register(int index, const char *type)
{
state_save_register_item_array(type, index, jaguar.r);
state_save_register_item_array(type, index, jaguar.a);
state_save_register_item_array(type, index, jaguar.ctrl);
state_save_register_item(type, index, jaguar.ppc);
- state_save_register_func_postload(update_register_banks);
- state_save_register_func_postload(check_irqs);
+ state_save_register_postload(Machine, jaguar_postload, NULL);
}
static void jaguargpu_init(int index, int clock, const void *_config, int (*irqcallback)(int))
diff --git a/src/emu/cpu/m37710/m37710.c b/src/emu/cpu/m37710/m37710.c
index 8777aafdeef..c6632c2ea93 100644
--- a/src/emu/cpu/m37710/m37710.c
+++ b/src/emu/cpu/m37710/m37710.c
@@ -1041,7 +1041,7 @@ static offs_t m37710_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UIN
}
#endif /* ENABLE_DEBUGGER */
-static void m37710_restore_state(void)
+static STATE_POSTLOAD( m37710_restore_state )
{
// restore proper function pointers
m37710i_set_execution_mode((FLAG_M>>4) | (FLAG_X>>4));
@@ -1112,7 +1112,7 @@ static void m37710_init(int index, int clock, const void *config, int (*irqcallb
state_save_register_item("M377xx", index, m37710i_cpu.reload[7].seconds);
state_save_register_item("M377xx", index, m37710i_cpu.reload[7].attoseconds);
- state_save_register_func_postload(m37710_restore_state);
+ state_save_register_postload(Machine, m37710_restore_state, NULL);
}
/**************************************************************************
diff --git a/src/emu/cpu/m68000/m68kcpu.c b/src/emu/cpu/m68000/m68kcpu.c
index 8e6e76e6934..6e1f08c10d1 100644
--- a/src/emu/cpu/m68000/m68kcpu.c
+++ b/src/emu/cpu/m68000/m68kcpu.c
@@ -978,14 +978,14 @@ static struct {
UINT8 halted;
} m68k_substate;
-static void m68k_prepare_substate(void)
+static void m68k_prepare_substate(running_machine *machine, void *param)
{
m68k_substate.sr = m68ki_get_sr();
m68k_substate.stopped = (CPU_STOPPED & STOP_LEVEL_STOP) != 0;
m68k_substate.halted = (CPU_STOPPED & STOP_LEVEL_HALT) != 0;
}
-static void m68k_post_load(void)
+static void m68k_post_load(running_machine *machine, void *param)
{
m68ki_set_sr_noint_nosp(m68k_substate.sr);
CPU_STOPPED = m68k_substate.stopped ? STOP_LEVEL_STOP : 0
@@ -1014,8 +1014,8 @@ void m68k_state_register(const char *type, int index)
state_save_register_item(type, index, m68k_substate.halted);
state_save_register_item(type, index, CPU_PREF_ADDR);
state_save_register_item(type, index, CPU_PREF_DATA);
- state_save_register_func_presave(m68k_prepare_substate);
- state_save_register_func_postload(m68k_post_load);
+ state_save_register_presave(Machine, m68k_prepare_substate, NULL);
+ state_save_register_postload(Machine, m68k_post_load, NULL);
}
#endif /* M68K_COMPILE_FOR_MAME */
diff --git a/src/emu/cpu/mips/psx.c b/src/emu/cpu/mips/psx.c
index f8c884d471f..711375d4ca1 100644
--- a/src/emu/cpu/mips/psx.c
+++ b/src/emu/cpu/mips/psx.c
@@ -1560,6 +1560,13 @@ INLINE int mips_store_data_address_breakpoint( UINT32 address )
return mips_data_address_breakpoint( DCIC_DW | DCIC_DAE, DCIC_DB | DCIC_DA | DCIC_W, address );
}
+static STATE_POSTLOAD( mips_postload )
+{
+ mips_update_memory_handlers();
+ mips_update_address_masks();
+ mips_update_scratchpad();
+}
+
static void mips_state_register( const char *type, int index )
{
state_save_register_item( type, index, mipscpu.op );
@@ -1579,9 +1586,7 @@ static void mips_state_register( const char *type, int index )
state_save_register_item( type, index, mipscpu.multiplier_operation );
state_save_register_item( type, index, mipscpu.multiplier_operand1 );
state_save_register_item( type, index, mipscpu.multiplier_operand2 );
- state_save_register_func_postload( mips_update_memory_handlers );
- state_save_register_func_postload( mips_update_address_masks );
- state_save_register_func_postload( mips_update_scratchpad );
+ state_save_register_postload( Machine, mips_postload, NULL );
}
static void mips_init( int index, int clock, const void *config, int (*irqcallback)(int) )
diff --git a/src/emu/cpu/tms34010/tms34010.c b/src/emu/cpu/tms34010/tms34010.c
index f772fdd955d..a48472395ee 100644
--- a/src/emu/cpu/tms34010/tms34010.c
+++ b/src/emu/cpu/tms34010/tms34010.c
@@ -102,7 +102,7 @@ static const tms34010_config default_config =
static void check_interrupt(void);
static TIMER_CALLBACK( scanline_callback );
-static void tms34010_state_postload(void);
+static STATE_POSTLOAD( tms34010_state_postload );
/***************************************************************************
@@ -672,7 +672,7 @@ static void tms34010_init(int index, int clock, const void *_config, int (*irqca
state_save_register_item("tms34010", index, state.pixelshift);
state_save_register_item("tms34010", index, state.gfxcycles);
state_save_register_item_pointer("tms34010", index, (&state.regs[0].reg), ARRAY_LENGTH(state.regs));
- state_save_register_func_postload(tms34010_state_postload);
+ state_save_register_postload(Machine, tms34010_state_postload, NULL);
}
static void tms34010_reset(void)
@@ -1622,7 +1622,7 @@ int tms34020_get_DPYSTRT(int cpu)
SAVE STATE
***************************************************************************/
-static void tms34010_state_postload(void)
+static STATE_POSTLOAD( tms34010_state_postload )
{
change_pc(TOBYTE(PC));
set_raster_op();
diff --git a/src/emu/emupal.c b/src/emu/emupal.c
index 64e1a28a3d2..7311e2d8c75 100644
--- a/src/emu/emupal.c
+++ b/src/emu/emupal.c
@@ -75,8 +75,8 @@ struct _colortable_t
FUNCTION PROTOTYPES
***************************************************************************/
-static void palette_presave(void);
-static void palette_postload(void);
+static void palette_presave(running_machine *machine, void *param);
+static void palette_postload(running_machine *machine, void *param);
static void palette_exit(running_machine *machine);
static void allocate_palette(running_machine *machine, palette_private *palette);
static void allocate_color_tables(running_machine *machine, palette_private *palette);
@@ -151,8 +151,8 @@ void palette_init(running_machine *machine)
palette->save_bright = auto_malloc(sizeof(*palette->save_bright) * numcolors);
state_save_register_global_pointer(palette->save_pen, numcolors);
state_save_register_global_pointer(palette->save_bright, numcolors);
- state_save_register_func_presave(palette_presave);
- state_save_register_func_postload(palette_postload);
+ state_save_register_presave(machine, palette_presave, palette);
+ state_save_register_postload(machine, palette_postload, palette);
}
}
@@ -534,17 +534,17 @@ pen_t get_white_pen(running_machine *machine)
for saving
-------------------------------------------------*/
-static void palette_presave(void)
+static void palette_presave(running_machine *machine, void *param)
{
- int numcolors = palette_get_num_colors(Machine->palette);
- palette_private *palette = Machine->palette_data;
+ int numcolors = palette_get_num_colors(machine->palette);
+ palette_private *palette = param;
int index;
/* fill the save arrays with updated pen and brightness information */
for (index = 0; index < numcolors; index++)
{
- palette->save_pen[index] = palette_entry_get_color(Machine->palette, index);
- palette->save_bright[index] = palette_entry_get_contrast(Machine->palette, index);
+ palette->save_pen[index] = palette_entry_get_color(machine->palette, index);
+ palette->save_bright[index] = palette_entry_get_contrast(machine->palette, index);
}
}
@@ -554,17 +554,17 @@ static void palette_presave(void)
actually update the palette
-------------------------------------------------*/
-static void palette_postload(void)
+static void palette_postload(running_machine *machine, void *param)
{
- int numcolors = palette_get_num_colors(Machine->palette);
- palette_private *palette = Machine->palette_data;
+ int numcolors = palette_get_num_colors(machine->palette);
+ palette_private *palette = param;
int index;
/* reset the pen and brightness for each entry */
for (index = 0; index < numcolors; index++)
{
- palette_entry_set_color(Machine->palette, index, palette->save_pen[index]);
- palette_entry_set_contrast(Machine->palette, index, palette->save_bright[index]);
+ palette_entry_set_color(machine->palette, index, palette->save_pen[index]);
+ palette_entry_set_contrast(machine->palette, index, palette->save_bright[index]);
}
}
diff --git a/src/emu/memory.c b/src/emu/memory.c
index 87f9712f917..d5eb111c618 100644
--- a/src/emu/memory.c
+++ b/src/emu/memory.c
@@ -428,7 +428,7 @@ static void memory_init_allocate(const machine_config *config);
static void *allocate_memory_block(int cpunum, int spacenum, offs_t bytestart, offs_t byteend, void *memory);
static void register_for_save(int cpunum, int spacenum, offs_t bytestart, void *base, size_t numbytes);
static address_map_entry *assign_intersecting_blocks(addrspace_data *space, offs_t bytestart, offs_t byteend, UINT8 *base);
-static void memory_init_locate(void);
+static void memory_init_locate(running_machine *machine);
static void *memory_find_base(int cpunum, int spacenum, offs_t byteaddress);
static genf *get_static_handler(int databits, int readorwrite, int spacenum, int which);
static void memory_exit(running_machine *machine);
@@ -513,7 +513,7 @@ void memory_init(running_machine *machine)
memory_init_allocate(machine->config);
/* find all the allocated pointers */
- memory_init_locate();
+ memory_init_locate(machine);
/* dump the final memory configuration */
mem_dump();
@@ -2384,7 +2384,7 @@ static address_map_entry *assign_intersecting_blocks(addrspace_data *space, offs
reattach_banks - reconnect banks after a load
-------------------------------------------------*/
-static void reattach_banks(void)
+static STATE_POSTLOAD( reattach_banks )
{
int banknum;
@@ -2404,7 +2404,7 @@ static void reattach_banks(void)
into the final allocated memory
-------------------------------------------------*/
-static void memory_init_locate(void)
+static void memory_init_locate(running_machine *machine)
{
int cpunum, spacenum, banknum;
@@ -2452,7 +2452,7 @@ static void memory_init_locate(void)
}
/* request a callback to fix up the banks when done */
- state_save_register_func_postload(reattach_banks);
+ state_save_register_postload(machine, reattach_banks, NULL);
}
diff --git a/src/emu/sound/2151intf.c b/src/emu/sound/2151intf.c
index 7594167924f..5c0ea2414ee 100644
--- a/src/emu/sound/2151intf.c
+++ b/src/emu/sound/2151intf.c
@@ -8,6 +8,7 @@
#include "sndintrf.h"
#include "streams.h"
+#include "deprecat.h"
#include "fm.h"
#include "2151intf.h"
#include "ym2151.h"
@@ -29,10 +30,10 @@ static void ym2151_update(void *param, stream_sample_t **inputs, stream_sample_t
}
-static void ym2151_postload(void *param)
+static STATE_POSTLOAD( ym2151_postload )
{
struct ym2151_info *info = param;
- YM2151Postload(info->chip);
+ YM2151Postload(machine, info->chip);
}
@@ -54,7 +55,7 @@ static void *ym2151_start(int sndindex, int clock, const void *config)
info->chip = YM2151Init(sndindex,clock,rate);
- state_save_register_func_postload_ptr(ym2151_postload, info);
+ state_save_register_postload(Machine, ym2151_postload, info);
if (info->chip != 0)
{
diff --git a/src/emu/sound/2203intf.c b/src/emu/sound/2203intf.c
index 89cab585db8..09a5c4461e8 100644
--- a/src/emu/sound/2203intf.c
+++ b/src/emu/sound/2203intf.c
@@ -1,5 +1,6 @@
#include <math.h>
#include "sndintrf.h"
+#include "deprecat.h"
#include "streams.h"
#include "2203intf.h"
#include "fm.h"
@@ -97,7 +98,7 @@ static void ym2203_stream_update(void *param, stream_sample_t **inputs, stream_s
}
-static void ym2203_postload(void *param)
+static STATE_POSTLOAD( ym2203_postload )
{
struct ym2203_info *info = param;
YM2203Postload(info->chip);
@@ -128,7 +129,7 @@ static void *ym2203_start(int sndindex, int clock, const void *config)
/* Initialize FM emurator */
info->chip = YM2203Init(info,sndindex,clock,rate,timer_handler,IRQHandler,&psgintf);
- state_save_register_func_postload_ptr(ym2203_postload, info);
+ state_save_register_postload(Machine, ym2203_postload, info);
if (info->chip)
return info;
diff --git a/src/emu/sound/2608intf.c b/src/emu/sound/2608intf.c
index 23d0cb87539..6d47451b937 100644
--- a/src/emu/sound/2608intf.c
+++ b/src/emu/sound/2608intf.c
@@ -12,6 +12,7 @@
***************************************************************************/
#include "sndintrf.h"
+#include "deprecat.h"
#include "streams.h"
#include "ay8910.h"
#include "2608intf.h"
@@ -110,7 +111,7 @@ static void ym2608_stream_update(void *param, stream_sample_t **inputs, stream_s
}
-static void ym2608_postload(void *param)
+static STATE_POSTLOAD( ym2608_postload )
{
struct ym2608_info *info = param;
YM2608Postload(info->chip);
@@ -149,7 +150,7 @@ static void *ym2608_start(int sndindex, int clock, const void *config)
pcmbufa,pcmsizea,
timer_handler,IRQHandler,&psgintf);
- state_save_register_func_postload_ptr(ym2608_postload, info);
+ state_save_register_postload(Machine, ym2608_postload, info);
if (info->chip)
return info;
diff --git a/src/emu/sound/2610intf.c b/src/emu/sound/2610intf.c
index f5f01e26862..b25aeb0b01e 100644
--- a/src/emu/sound/2610intf.c
+++ b/src/emu/sound/2610intf.c
@@ -12,6 +12,7 @@
***************************************************************************/
#include "sndintrf.h"
+#include "deprecat.h"
#include "streams.h"
#include "ay8910.h"
#include "2610intf.h"
@@ -112,7 +113,7 @@ static void ym2610_stream_update(void *param, stream_sample_t **inputs, stream_s
}
-static void ym2610_postload(void *param)
+static STATE_POSTLOAD( ym2610_postload )
{
struct ym2610_info *info = param;
YM2610Postload(info->chip);
@@ -154,7 +155,7 @@ static void *ym2610_start(int sndindex, int clock, const void *config)
pcmbufa,pcmsizea,pcmbufb,pcmsizeb,
timer_handler,IRQHandler,&psgintf);
- state_save_register_func_postload_ptr(ym2610_postload, info);
+ state_save_register_postload(Machine, ym2610_postload, info);
if (info->chip)
return info;
diff --git a/src/emu/sound/2612intf.c b/src/emu/sound/2612intf.c
index b43007cf111..69328f2f3ef 100644
--- a/src/emu/sound/2612intf.c
+++ b/src/emu/sound/2612intf.c
@@ -12,6 +12,7 @@
***************************************************************************/
#include "sndintrf.h"
+#include "deprecat.h"
#include "streams.h"
#include "sound/fm.h"
#include "sound/2612intf.h"
@@ -79,7 +80,7 @@ static void ym2612_stream_update(void *param, stream_sample_t **inputs, stream_s
}
-static void ym2612_postload(void *param)
+static STATE_POSTLOAD( ym2612_postload )
{
struct ym2612_info *info = param;
YM2612Postload(info->chip);
@@ -108,7 +109,7 @@ static void *ym2612_start(int sndindex, int clock, const void *config)
/**** initialize YM2612 ****/
info->chip = YM2612Init(info,sndindex,clock,rate,timer_handler,IRQHandler);
- state_save_register_func_postload_ptr(ym2612_postload, info);
+ state_save_register_postload(Machine, ym2612_postload, info);
if (info->chip)
return info;
diff --git a/src/emu/sound/fmopl.c b/src/emu/sound/fmopl.c
index 026e2ad8ad5..820c3ed51a4 100644
--- a/src/emu/sound/fmopl.c
+++ b/src/emu/sound/fmopl.c
@@ -70,6 +70,7 @@ Revision History:
#include <math.h>
#include "sndintrf.h" /* use M.A.M.E. */
+#include "deprecat.h" /* use M.A.M.E. */
#include "ymdeltat.h"
@@ -1820,7 +1821,7 @@ static void OPLResetChip(FM_OPL *OPL)
}
-static void OPL_postload(void *param)
+static STATE_POSTLOAD( OPL_postload )
{
FM_OPL *OPL = (FM_OPL *)param;
int slot, ch;
@@ -1970,7 +1971,7 @@ static void OPL_save_state(FM_OPL *OPL, const char *statename, int index)
state_save_register_item(statename, index, OPL->statusmask);
state_save_register_item(statename, index, OPL->mode);
- state_save_register_func_postload_ptr(OPL_postload, OPL);
+ state_save_register_postload(Machine, OPL_postload, OPL);
}
diff --git a/src/emu/sound/k054539.c b/src/emu/sound/k054539.c
index 8bfe8524704..a2abaec9148 100644
--- a/src/emu/sound/k054539.c
+++ b/src/emu/sound/k054539.c
@@ -18,6 +18,7 @@ CHANNEL_DEBUG enables the following keys:
*********************************************************/
#include "sndintrf.h"
+#include "deprecat.h"
#include "streams.h"
#include "k054539.h"
#include <math.h>
@@ -592,7 +593,7 @@ static void K054539_w(int chip, offs_t offset, UINT8 data) //*
regbase[offset] = data;
}
-static void reset_zones(void *param)
+static STATE_POSTLOAD( reset_zones )
{
struct k054539_info *info = param;
int data = info->regs[0x22e];
@@ -662,7 +663,7 @@ static void *k054539_start(int sndindex, int clock, const void *config)
K054539_init_chip(info, clock, sndindex);
- state_save_register_func_postload_ptr(reset_zones, info);
+ state_save_register_postload(Machine, reset_zones, info);
return info;
}
diff --git a/src/emu/sound/multipcm.c b/src/emu/sound/multipcm.c
index 456d9c156f7..d6ee7e9adb3 100644
--- a/src/emu/sound/multipcm.c
+++ b/src/emu/sound/multipcm.c
@@ -29,6 +29,7 @@
#include <math.h>
#include "sndintrf.h"
+#include "deprecat.h"
#include "streams.h"
#include "multipcm.h"
@@ -101,7 +102,7 @@ typedef struct MultiPCM_t
} MultiPCMT;
-static void MultiPCM_postload(void *param)
+static STATE_POSTLOAD( MultiPCM_postload )
{
MultiPCMT *mpcm = param;
int j;
@@ -329,7 +330,7 @@ static void *multipcm_start(int sndindex, int clock, const void *config)
state_save_register_item(mname, sndindex, mpcm->curvoice);
}
- state_save_register_func_postload_ptr(MultiPCM_postload, mpcm);
+ state_save_register_postload(Machine, MultiPCM_postload, mpcm);
return mpcm;
}
diff --git a/src/emu/sound/samples.c b/src/emu/sound/samples.c
index 5063113d1c0..df67c6df0f4 100644
--- a/src/emu/sound/samples.c
+++ b/src/emu/sound/samples.c
@@ -494,7 +494,7 @@ static void sample_update_sound(void *param, stream_sample_t **inputs, stream_sa
}
-static void samples_postload(void *param)
+static STATE_POSTLOAD( samples_postload )
{
struct samples_info *info = param;
int i;
@@ -566,7 +566,7 @@ static void *samples_start(int sndindex, int clock, const void *config)
state_save_register_item("samples", sndindex * MAX_CHANNELS + i, info->channel[i].loop);
state_save_register_item("samples", sndindex * MAX_CHANNELS + i, info->channel[i].paused);
}
- state_save_register_func_postload_ptr(samples_postload, info);
+ state_save_register_postload(Machine, samples_postload, info);
/* initialize any custom handlers */
if (intf->start)
diff --git a/src/emu/sound/upd7759.c b/src/emu/sound/upd7759.c
index d1d00c42f21..1a181fa829c 100644
--- a/src/emu/sound/upd7759.c
+++ b/src/emu/sound/upd7759.c
@@ -100,6 +100,7 @@
#include <math.h>
#include "sndintrf.h"
+#include "deprecat.h"
#include "streams.h"
#include "upd7759.h"
@@ -579,7 +580,7 @@ static void upd7759_reset(struct upd7759_chip *chip)
}
-static void upd7759_postload(void *param)
+static STATE_POSTLOAD( upd7759_postload )
{
struct upd7759_chip *chip = (struct upd7759_chip *)param;
chip->rom = chip->rombase + chip->romoffset;
@@ -615,7 +616,7 @@ static void register_for_save(struct upd7759_chip *chip, int index)
state_save_register_item("upd7759", index, chip->sample);
state_save_register_item("upd7759", index, chip->romoffset);
- state_save_register_func_postload_ptr(upd7759_postload, chip);
+ state_save_register_postload(Machine, upd7759_postload, chip);
}
diff --git a/src/emu/sound/vlm5030.c b/src/emu/sound/vlm5030.c
index be50345067d..37f20816d6e 100644
--- a/src/emu/sound/vlm5030.c
+++ b/src/emu/sound/vlm5030.c
@@ -476,7 +476,7 @@ static void VLM5030_setup_parameter(struct vlm5030_info *chip, UINT8 param)
}
-static void VLM5030_restore_state(void *param)
+static STATE_POSTLOAD( VLM5030_restore_state )
{
struct vlm5030_info *chip = param;
int i;
@@ -680,7 +680,7 @@ static void *vlm5030_start(int sndindex, int clock, const void *config)
state_save_register_item(VLM_NAME,sndindex,chip->target_pitch);
state_save_register_item_array(VLM_NAME,sndindex,chip->target_k);
state_save_register_item_array(VLM_NAME,sndindex,chip->x);
- state_save_register_func_postload_ptr(VLM5030_restore_state, chip);
+ state_save_register_postload(Machine, VLM5030_restore_state, chip);
return chip;
}
diff --git a/src/emu/sound/ym2151.c b/src/emu/sound/ym2151.c
index 19418a9d28a..efcaa6d07cd 100644
--- a/src/emu/sound/ym2151.c
+++ b/src/emu/sound/ym2151.c
@@ -1386,9 +1386,9 @@ int YM2151ReadStatus( void *_chip )
/*
* state save support for MAME
*/
-void YM2151Postload(void *chip)
+STATE_POSTLOAD( YM2151Postload )
{
- YM2151 *YM2151_chip = (YM2151 *)chip;
+ YM2151 *YM2151_chip = (YM2151 *)param;
int j;
for (j=0; j<8; j++)
@@ -1494,10 +1494,10 @@ static void ym2151_state_save_register( YM2151 *chip, int sndindex )
state_save_register_item_array(buf1, sndindex, chip->connect);
- state_save_register_func_postload_ptr(YM2151Postload, chip);
+ state_save_register_postload(Machine, YM2151Postload, chip);
}
#else
-void YM2151Postload(void *chip)
+STATE_POSTLOAD( YM2151Postload )
{
}
diff --git a/src/emu/sound/ym2151.h b/src/emu/sound/ym2151.h
index c74149a9968..2fb0b799734 100644
--- a/src/emu/sound/ym2151.h
+++ b/src/emu/sound/ym2151.h
@@ -82,5 +82,5 @@ void YM2151SetIrqHandler(void *chip, void (*handler)(int irq));
void YM2151SetPortWriteHandler(void *chip, write8_machine_func handler);
/* refresh chip when load state */
-void YM2151Postload(void *chip);
+STATE_POSTLOAD( YM2151Postload );
#endif /*_H_YM2151_*/
diff --git a/src/emu/sound/ymz280b.c b/src/emu/sound/ymz280b.c
index a598f2d59b0..09597713ca2 100644
--- a/src/emu/sound/ymz280b.c
+++ b/src/emu/sound/ymz280b.c
@@ -191,7 +191,7 @@ INLINE void update_volumes(struct YMZ280BVoice *voice)
}
-static void YMZ280B_state_save_update_step(void *param)
+static STATE_POSTLOAD( YMZ280B_state_save_update_step )
{
struct YMZ280BChip *chip = param;
int j;
@@ -690,7 +690,7 @@ static void *ymz280b_start(int sndindex, int clock, const void *config)
}
}
- state_save_register_func_postload_ptr(YMZ280B_state_save_update_step, chip);
+ state_save_register_postload(Machine, YMZ280B_state_save_update_step, chip);
#if MAKE_WAVS
chip->wavresample = wav_open("resamp.wav", INTERNAL_SAMPLE_RATE, 2);
diff --git a/src/emu/state.c b/src/emu/state.c
index 3602f9027e5..dea893d72f9 100644
--- a/src/emu/state.c
+++ b/src/emu/state.c
@@ -51,13 +51,6 @@ enum
SS_MSB_FIRST = 0x02
};
-enum
-{
- FUNC_NOPARAM,
- FUNC_INTPARAM,
- FUNC_PTRPARAM
-};
-
/***************************************************************************
@@ -81,18 +74,12 @@ typedef struct _ss_func ss_func;
struct _ss_func
{
ss_func * next; /* pointer to next entry */
- int type; /* type of callback */
union
{
- void (*voidf)(void);
- void (*intf)(int param);
- void (*ptrf)(void *param);
+ state_presave_func presave; /* presave callback */
+ state_postload_func postload; /* postload callback */
} func; /* function pointers */
- union
- {
- int intp;
- void *ptrp;
- } param; /* parameters */
+ void * param; /* function parameter */
int tag; /* saving tag */
};
@@ -305,57 +292,11 @@ void state_save_register_bitmap(const char *module, UINT32 instance, const char
***************************************************************************/
/*-------------------------------------------------
- register_func_void - register a function
- callback that takes no parameters
+ state_save_register_presave -
+ register a pre-save function callback
-------------------------------------------------*/
-static void register_func_void(ss_func **root, void (*func)(void))
-{
- ss_func **cur;
-
- /* check for invalid timing */
- if (!ss_registration_allowed)
- {
- logerror("Attempt to register callback function after state registration is closed!");
- if (Machine->gamedrv->flags & GAME_SUPPORTS_SAVE)
- fatalerror("Attempt to register callback function after state registration is closed!");
- ss_illegal_regs++;
- return;
- }
-
- /* scan for duplicates and push through to the end */
- for (cur = root; *cur; cur = &(*cur)->next)
- if ((*cur)->func.voidf == func && (*cur)->tag == ss_current_tag)
- fatalerror("Duplicate save state function (%d, 0x%p)", ss_current_tag, func);
-
- /* allocate a new entry */
- *cur = malloc_or_die(sizeof(ss_func));
-
- /* fill it in */
- (*cur)->next = NULL;
- (*cur)->type = FUNC_NOPARAM;
- (*cur)->func.voidf = func;
- (*cur)->tag = ss_current_tag;
- restrack_register_object(OBJTYPE_STATEREG, *cur, (root == &ss_prefunc_reg) ? 1 : 2, __FILE__, __LINE__);
-}
-
-void state_save_register_func_presave(void (*func)(void))
-{
- register_func_void(&ss_prefunc_reg, func);
-}
-
-void state_save_register_func_postload(void (*func)(void))
-{
- register_func_void(&ss_postfunc_reg, func);
-}
-
-
-/*-------------------------------------------------
- register_func_int - register a function
- callback that takes an integer parameter
--------------------------------------------------*/
-
-static void register_func_int(ss_func **root, void (*func)(int), int param)
+void state_save_register_presave(running_machine *machine, state_presave_func func, void *param)
{
ss_func **cur;
@@ -364,39 +305,28 @@ static void register_func_int(ss_func **root, void (*func)(int), int param)
fatalerror("Attempt to register callback function after state registration is closed!");
/* scan for duplicates and push through to the end */
- for (cur = root; *cur; cur = &(*cur)->next)
- if ((*cur)->func.intf == func && (*cur)->param.intp == param && (*cur)->tag == ss_current_tag)
- fatalerror("Duplicate save state function (%d, %d, %p)", ss_current_tag, param, func);
+ for (cur = &ss_prefunc_reg; *cur; cur = &(*cur)->next)
+ if ((*cur)->func.presave == func && (*cur)->param == param && (*cur)->tag == ss_current_tag)
+ fatalerror("Duplicate save state function (%d, %p, %p)", ss_current_tag, param, func);
/* allocate a new entry */
*cur = malloc_or_die(sizeof(ss_func));
/* fill it in */
- (*cur)->next = NULL;
- (*cur)->type = FUNC_INTPARAM;
- (*cur)->func.intf = func;
- (*cur)->param.intp = param;
- (*cur)->tag = ss_current_tag;
- restrack_register_object(OBJTYPE_STATEREG, *cur, (root == &ss_prefunc_reg) ? 1 : 2, __FILE__, __LINE__);
-}
-
-void state_save_register_func_presave_int(void (*func)(int), int param)
-{
- register_func_int(&ss_prefunc_reg, func, param);
-}
-
-void state_save_register_func_postload_int(void (*func)(int), int param)
-{
- register_func_int(&ss_postfunc_reg, func, param);
+ (*cur)->next = NULL;
+ (*cur)->func.presave = func;
+ (*cur)->param = param;
+ (*cur)->tag = ss_current_tag;
+ restrack_register_object(OBJTYPE_STATEREG, *cur, 1, __FILE__, __LINE__);
}
/*-------------------------------------------------
- register_func_ptr - register a function
- callback that takes a void * parameter
+ state_save_register_postload -
+ register a post-load function callback
-------------------------------------------------*/
-static void register_func_ptr(ss_func **root, void (*func)(void *), void *param)
+void state_save_register_postload(running_machine *machine, state_postload_func func, void *param)
{
ss_func **cur;
@@ -405,30 +335,19 @@ static void register_func_ptr(ss_func **root, void (*func)(void *), void *param)
fatalerror("Attempt to register callback function after state registration is closed!");
/* scan for duplicates and push through to the end */
- for (cur = root; *cur; cur = &(*cur)->next)
- if ((*cur)->func.ptrf == func && (*cur)->param.ptrp == param && (*cur)->tag == ss_current_tag)
+ for (cur = &ss_postfunc_reg; *cur; cur = &(*cur)->next)
+ if ((*cur)->func.postload == func && (*cur)->param == param && (*cur)->tag == ss_current_tag)
fatalerror("Duplicate save state function (%d, %p, %p)", ss_current_tag, param, func);
/* allocate a new entry */
*cur = malloc_or_die(sizeof(ss_func));
/* fill it in */
- (*cur)->next = NULL;
- (*cur)->type = FUNC_PTRPARAM;
- (*cur)->func.ptrf = func;
- (*cur)->param.ptrp = param;
- (*cur)->tag = ss_current_tag;
- restrack_register_object(OBJTYPE_STATEREG, *cur, (root == &ss_prefunc_reg) ? 1 : 2, __FILE__, __LINE__);
-}
-
-void state_save_register_func_presave_ptr(void (*func)(void *), void * param)
-{
- register_func_ptr(&ss_prefunc_reg, func, param);
-}
-
-void state_save_register_func_postload_ptr(void (*func)(void *), void * param)
-{
- register_func_ptr(&ss_postfunc_reg, func, param);
+ (*cur)->next = NULL;
+ (*cur)->func.postload = func;
+ (*cur)->param = param;
+ (*cur)->tag = ss_current_tag;
+ restrack_register_object(OBJTYPE_STATEREG, *cur, 2, __FILE__, __LINE__);
}
@@ -594,35 +513,6 @@ static int compute_size_and_offsets(void)
/*-------------------------------------------------
- call_hook_functions - loop through all the
- hook functions and call them
--------------------------------------------------*/
-
-static int call_hook_functions(ss_func *funclist)
-{
- ss_func *func;
- int count = 0;
-
- /* iterate over the list of functions */
- for (func = funclist; func; func = func->next)
- if (func->tag == ss_current_tag)
- {
- count++;
-
- /* call with the appropriate parameters */
- switch (func->type)
- {
- case FUNC_NOPARAM: (func->func.voidf)(); break;
- case FUNC_INTPARAM: (func->func.intf)(func->param.intp); break;
- case FUNC_PTRPARAM: (func->func.ptrf)(func->param.ptrp); break;
- }
- }
-
- return count;
-}
-
-
-/*-------------------------------------------------
get_signature - compute the signature, which
is a CRC over the structure of the data
-------------------------------------------------*/
@@ -768,13 +658,21 @@ int state_save_save_begin(mame_file *file)
void state_save_save_continue(void)
{
ss_entry *entry;
- int count;
+ ss_func *func;
+ int count = 0;
LOG(("Saving tag %d\n", ss_current_tag));
/* call the pre-save functions */
LOG((" calling pre-save functions\n"));
- count = call_hook_functions(ss_prefunc_reg);
+
+ /* iterate over the list of functions */
+ for (func = ss_prefunc_reg; func; func = func->next)
+ if (func->tag == ss_current_tag)
+ {
+ count++;
+ (*func->func.presave)(Machine, func->param);
+ }
LOG((" %d functions called\n", count));
/* then copy in all the data */
@@ -873,8 +771,9 @@ int state_save_load_begin(mame_file *file)
void state_save_load_continue(void)
{
ss_entry *entry;
+ ss_func *func;
int need_convert;
- int count;
+ int count = 0;
/* first determine whether or not we need to convert the endianness of the data */
#ifdef LSB_FIRST
@@ -898,7 +797,12 @@ void state_save_load_continue(void)
/* call the post-load functions */
LOG((" calling post-load functions\n"));
- count = call_hook_functions(ss_postfunc_reg);
+ for (func = ss_postfunc_reg; func; func = func->next)
+ if (func->tag == ss_current_tag)
+ {
+ count++;
+ (*func->func.postload)(Machine, func->param);
+ }
LOG((" %d functions called\n", count));
}
diff --git a/src/emu/state.h b/src/emu/state.h
index b68d46a6fe5..fbe95becdb9 100644
--- a/src/emu/state.h
+++ b/src/emu/state.h
@@ -19,9 +19,22 @@
/***************************************************************************
+ TYPE DEFINTIONS
+***************************************************************************/
+
+typedef void (*state_presave_func)(running_machine *machine, void *param);
+typedef void (*state_postload_func)(running_machine *machine, void *param);
+
+
+
+/***************************************************************************
MACROS
***************************************************************************/
+#define STATE_PRESAVE(name) void name(running_machine *machine, void *param)
+#define STATE_POSTLOAD(name) void name(running_machine *machine, void *param)
+
+
#define IS_COMPATIBLE_TYPE(_valtype, _checktype) \
(sizeof(_valtype) == sizeof(_checktype) && TYPES_COMPATIBLE(typeof(_valtype), _checktype))
@@ -88,14 +101,8 @@ int state_save_get_reg_count(void);
void state_save_register_memory(const char *module, UINT32 instance, const char *name, void *val, UINT32 valsize, UINT32 valcount);
void state_save_register_bitmap(const char *module, UINT32 instance, const char *name, bitmap_t *val);
-void state_save_register_func_presave(void (*func)(void));
-void state_save_register_func_postload(void (*func)(void));
-
-void state_save_register_func_presave_int(void (*func)(int), int param);
-void state_save_register_func_postload_int(void (*func)(int), int param);
-
-void state_save_register_func_presave_ptr(void (*func)(void *), void *param);
-void state_save_register_func_postload_ptr(void (*func)(void *), void *param);
+void state_save_register_presave(running_machine *machine, state_presave_func func, void *param);
+void state_save_register_postload(running_machine *machine, state_postload_func func, void *param);
/* Save and load functions */
/* The tags are a hack around the current cpu structures */
diff --git a/src/emu/streams.c b/src/emu/streams.c
index d33278ccc12..b830e1c18ae 100644
--- a/src/emu/streams.c
+++ b/src/emu/streams.c
@@ -166,7 +166,7 @@ struct _streams_private
FUNCTION PROTOTYPES
***************************************************************************/
-static void stream_postload(void *param);
+static STATE_POSTLOAD( stream_postload );
static void allocate_resample_buffers(streams_private *strdata, sound_stream *stream);
static void allocate_output_buffers(streams_private *strdata, sound_stream *stream);
static void recompute_sample_rate_data(streams_private *strdata, sound_stream *stream);
@@ -374,7 +374,7 @@ sound_stream *stream_create(int inputs, int outputs, int sample_rate, void *para
/* create a unique tag for saving */
sprintf(statetag, "stream.%d", stream->index);
state_save_register_item(statetag, 0, stream->sample_rate);
- state_save_register_func_postload_ptr(stream_postload, stream);
+ state_save_register_postload(Machine, stream_postload, stream);
/* allocate space for the inputs */
if (inputs > 0)
@@ -633,9 +633,9 @@ void stream_set_output_gain(sound_stream *stream, int output, float gain)
stream_postload - save/restore callback
-------------------------------------------------*/
-static void stream_postload(void *param)
+static STATE_POSTLOAD( stream_postload )
{
- streams_private *strdata = Machine->streams_data;
+ streams_private *strdata = machine->streams_data;
sound_stream *stream = param;
int outputnum;
diff --git a/src/emu/tilemap.c b/src/emu/tilemap.c
index c72ae932649..bd9af3942f3 100644
--- a/src/emu/tilemap.c
+++ b/src/emu/tilemap.c
@@ -138,7 +138,7 @@ static UINT32 screen_width, screen_height;
/* system management helpers */
static void tilemap_exit(running_machine *machine);
-static void tilemap_postload(void *param);
+static STATE_POSTLOAD( tilemap_postload );
static void tilemap_dispose(tilemap *tmap);
/* logical <-> memory index mapping */
@@ -355,7 +355,7 @@ tilemap *tilemap_create(tile_get_info_func tile_get_info, tilemap_mapper_func ma
tilemap_instance++;
/* reset everything after a load */
- state_save_register_func_postload_ptr(tilemap_postload, tmap);
+ state_save_register_postload(Machine, tilemap_postload, tmap);
return tmap;
}
@@ -1050,7 +1050,7 @@ static void tilemap_exit(running_machine *machine)
invalidate everything
-------------------------------------------------*/
-static void tilemap_postload(void *param)
+static STATE_POSTLOAD( tilemap_postload )
{
/* recompute the mappings for this tilemap */
tilemap *tmap = param;
diff --git a/src/emu/timer.c b/src/emu/timer.c
index d81d1f04bca..029a35dd91d 100644
--- a/src/emu/timer.c
+++ b/src/emu/timer.c
@@ -104,7 +104,7 @@ static attotime callback_timer_expire_time;
FUNCTION PROTOTYPES
***************************************************************************/
-static void timer_postload(void);
+static STATE_POSTLOAD( timer_postload );
static void timer_logtimers(void);
static void timer_remove(emu_timer *which);
@@ -280,7 +280,7 @@ void timer_init(running_machine *machine)
state_save_push_tag(0);
state_save_register_item("timer", 0, global_basetime.seconds);
state_save_register_item("timer", 0, global_basetime.attoseconds);
- state_save_register_func_postload(timer_postload);
+ state_save_register_postload(machine, timer_postload, NULL);
state_save_pop_tag();
/* reset the timers */
@@ -427,7 +427,7 @@ static void timer_register_save(emu_timer *timer)
timer_postload - after loading a save state
-------------------------------------------------*/
-static void timer_postload(void)
+static STATE_POSTLOAD( timer_postload )
{
emu_timer *privlist = NULL;
emu_timer *t;
diff --git a/src/emu/video/cdp1869.c b/src/emu/video/cdp1869.c
index 2c648b6eda9..9666fc99419 100644
--- a/src/emu/video/cdp1869.c
+++ b/src/emu/video/cdp1869.c
@@ -144,7 +144,7 @@ static TIMER_CALLBACK( prd_changed_tick )
/* State Save Postload */
-static void cdp1869_state_save_postload(void *param)
+static STATE_POSTLOAD( cdp1869_state_save_postload )
{
update_prd_changed_timer(param);
}
@@ -804,7 +804,7 @@ static DEVICE_START( cdp1869 )
// register for state saving
state_save_combine_module_and_tag(unique_tag, "CDP1869", device->tag);
- state_save_register_func_postload_ptr(cdp1869_state_save_postload, cdp1869);
+ state_save_register_postload(device->machine, cdp1869_state_save_postload, cdp1869);
state_save_register_item(unique_tag, 0, cdp1869->dispoff);
state_save_register_item(unique_tag, 0, cdp1869->fresvert);
diff --git a/src/emu/video/mc6845.c b/src/emu/video/mc6845.c
index a7f6f86d9e6..435b898976e 100644
--- a/src/emu/video/mc6845.c
+++ b/src/emu/video/mc6845.c
@@ -108,7 +108,7 @@ struct _mc6845_t
};
-static void mc6845_state_save_postload(void *param);
+static STATE_POSTLOAD( mc6845_state_save_postload );
static void recompute_parameters(mc6845_t *mc6845, int postload);
static void update_de_changed_timer(mc6845_t *mc6845);
static void update_hsync_changed_timers(mc6845_t *mc6845);
@@ -132,7 +132,7 @@ INLINE mc6845_t *get_safe_token(const device_config *device)
}
-static void mc6845_state_save_postload(void *param)
+static STATE_POSTLOAD( mc6845_state_save_postload )
{
recompute_parameters(param, TRUE);
}
@@ -723,7 +723,7 @@ static void common_start(const device_config *device, int device_type)
/* register for state saving */
state_save_combine_module_and_tag(unique_tag, device_tags[device_type], device->tag);
- state_save_register_func_postload_ptr(mc6845_state_save_postload, mc6845);
+ state_save_register_postload(device->machine, mc6845_state_save_postload, mc6845);
state_save_register_item(unique_tag, 0, mc6845->clock);
state_save_register_item(unique_tag, 0, mc6845->hpixels_per_column);
diff --git a/src/emu/video/poly.c b/src/emu/video/poly.c
index ce642d6350e..b0239b14a39 100644
--- a/src/emu/video/poly.c
+++ b/src/emu/video/poly.c
@@ -7,6 +7,7 @@
***************************************************************************/
#include "poly.h"
+#include "deprecat.h"
#include "eminline.h"
#include "mame.h"
#include "state.h"
@@ -206,7 +207,7 @@ struct _poly_manager
static void **allocate_array(size_t *itemsize, UINT32 itemcount);
static void free_array(void **array);
static void *poly_item_callback(void *param, int threadid);
-static void poly_state_presave(void *param);
+static STATE_PRESAVE( poly_state_presave );
@@ -360,7 +361,7 @@ poly_manager *poly_alloc(int max_polys, size_t extra_data_size, UINT8 flags)
poly->queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_MULTI | WORK_QUEUE_FLAG_HIGH_FREQ);
/* request a pre-save callback for synchronization */
- state_save_register_func_presave_ptr(poly_state_presave, poly);
+ state_save_register_presave(Machine, poly_state_presave, poly);
return poly;
}
@@ -1420,7 +1421,7 @@ static void *poly_item_callback(void *param, int threadid)
ensure everything is synced before saving
-------------------------------------------------*/
-static void poly_state_presave(void *param)
+static STATE_PRESAVE( poly_state_presave )
{
poly_manager *poly = param;
poly_wait(poly, "pre-save");
diff --git a/src/mame/drivers/astrocde.c b/src/mame/drivers/astrocde.c
index b4fd0b6fe77..8fcadf6328f 100644
--- a/src/mame/drivers/astrocde.c
+++ b/src/mame/drivers/astrocde.c
@@ -447,7 +447,7 @@ static WRITE8_HANDLER( profpac_banksw_w )
}
-static void profbank_banksw_restore(void)
+static STATE_POSTLOAD( profbank_banksw_restore )
{
profpac_banksw_w(Machine, 0, profpac_bank);
}
@@ -1727,7 +1727,7 @@ static DRIVER_INIT( profpac )
/* reset banking */
profpac_banksw_w(machine, 0, 0);
- state_save_register_func_postload(profbank_banksw_restore);
+ state_save_register_postload(machine, profbank_banksw_restore, NULL);
}
@@ -1741,7 +1741,7 @@ static DRIVER_INIT( demndrgn )
/* reset banking */
profpac_banksw_w(machine, 0, 0);
- state_save_register_func_postload(profbank_banksw_restore);
+ state_save_register_postload(machine, profbank_banksw_restore, NULL);
}
@@ -1760,7 +1760,7 @@ static DRIVER_INIT( tenpindx )
/* reset banking */
profpac_banksw_w(machine, 0, 0);
- state_save_register_func_postload(profbank_banksw_restore);
+ state_save_register_postload(machine, profbank_banksw_restore, NULL);
}
diff --git a/src/mame/drivers/atarig1.c b/src/mame/drivers/atarig1.c
index d6ee10ca59d..f50138a555c 100644
--- a/src/mame/drivers/atarig1.c
+++ b/src/mame/drivers/atarig1.c
@@ -161,7 +161,7 @@ INLINE void update_bank(int bank)
}
-static void pitfighb_state_postload(void)
+static STATE_POSTLOAD( pitfighb_state_postload )
{
int bank = bslapstic_bank;
bslapstic_bank = -1;
@@ -964,7 +964,7 @@ static void init_g1_common(running_machine *machine, offs_t slapstic_base, int s
pitfighb_cheap_slapstic_init();
state_save_register_global(bslapstic_bank);
state_save_register_global(bslapstic_primed);
- state_save_register_func_postload(pitfighb_state_postload);
+ state_save_register_postload(machine, pitfighb_state_postload, NULL);
}
else if (slapstic != 0)
atarigen_slapstic_init(0, slapstic_base, 0, slapstic);
diff --git a/src/mame/drivers/atarisy2.c b/src/mame/drivers/atarisy2.c
index 071e4333341..ad38fab47a3 100644
--- a/src/mame/drivers/atarisy2.c
+++ b/src/mame/drivers/atarisy2.c
@@ -172,7 +172,7 @@ static UINT8 sound_reset_state;
*
*************************************/
-static void bankselect_postload(void);
+static STATE_POSTLOAD( bankselect_postload );
@@ -252,7 +252,7 @@ static MACHINE_START( atarisy2 )
state_save_register_global(which_adc);
state_save_register_global(p2portwr_state);
state_save_register_global(p2portrd_state);
- state_save_register_func_postload(bankselect_postload);
+ state_save_register_postload(machine, bankselect_postload, NULL);
state_save_register_global(sound_reset_state);
}
@@ -359,7 +359,7 @@ static WRITE16_HANDLER( bankselect_w )
}
-static void bankselect_postload(void)
+static STATE_POSTLOAD( bankselect_postload )
{
bankselect_w(Machine, 0, bankselect[0], 0);
bankselect_w(Machine, 1, bankselect[1], 0);
diff --git a/src/mame/drivers/atetris.c b/src/mame/drivers/atetris.c
index eb46ea9b5c3..5f5d0314ba8 100644
--- a/src/mame/drivers/atetris.c
+++ b/src/mame/drivers/atetris.c
@@ -110,6 +110,12 @@ static void reset_bank(void)
}
+static STATE_POSTLOAD( atetris_postload )
+{
+ reset_bank();
+}
+
+
static MACHINE_START( atetris )
{
/* Allocate interrupt timer */
@@ -118,7 +124,7 @@ static MACHINE_START( atetris )
/* Set up save state */
state_save_register_global(current_bank);
state_save_register_global(nvram_write_enable);
- state_save_register_func_postload(reset_bank);
+ state_save_register_postload(machine, atetris_postload, NULL);
}
diff --git a/src/mame/drivers/batman.c b/src/mame/drivers/batman.c
index 85cb958ea32..fd573d832ab 100644
--- a/src/mame/drivers/batman.c
+++ b/src/mame/drivers/batman.c
@@ -63,7 +63,7 @@ static MACHINE_RESET( batman )
atarivc_reset(machine->primary_screen, atarivc_eof_data, 2);
atarigen_scanline_timer_reset(machine->primary_screen, batman_scanline_update, 8);
atarijsa_reset();
- atarigen_init_save_state();
+ atarigen_init_save_state(machine);
state_save_register_global(latch_data);
}
diff --git a/src/mame/drivers/darius.c b/src/mame/drivers/darius.c
index 89771b3f3d9..9123fe79159 100644
--- a/src/mame/drivers/darius.c
+++ b/src/mame/drivers/darius.c
@@ -1192,16 +1192,21 @@ static DRIVER_INIT( darius )
}
+static STATE_POSTLOAD( darius_postload )
+{
+ parse_control();
+ reset_sound_region();
+}
+
static MACHINE_START( darius )
{
state_save_register_global(cpua_ctrl);
- state_save_register_func_postload(parse_control);
// (there are other sound vars that may need saving too) //
state_save_register_global(banknum);
state_save_register_global(adpcm_command);
state_save_register_global(nmi_enable);
- state_save_register_func_postload(reset_sound_region);
+ state_save_register_postload(machine, darius_postload, NULL);
}
diff --git a/src/mame/drivers/decocass.c b/src/mame/drivers/decocass.c
index e39d4f336ef..f84e277d50c 100644
--- a/src/mame/drivers/decocass.c
+++ b/src/mame/drivers/decocass.c
@@ -1118,7 +1118,7 @@ static DRIVER_INIT( decocass )
decrypted[A] = swap_bits_5_6(rom[A]);
/* Call the state save setup code in machine/decocass.c */
- decocass_machine_state_save_init();
+ decocass_machine_state_save_init(machine);
/* and in video/decocass.c, too */
decocass_video_state_save_init();
}
diff --git a/src/mame/drivers/djmain.c b/src/mame/drivers/djmain.c
index e7a63e634b6..8926ec56930 100644
--- a/src/mame/drivers/djmain.c
+++ b/src/mame/drivers/djmain.c
@@ -1183,6 +1183,11 @@ static const struct K054539interface k054539_interface =
*
*************************************/
+static STATE_POSTLOAD( djmain_postload )
+{
+ sndram_set_bank();
+}
+
static MACHINE_START( djmain )
{
UINT8 *region = memory_region(REGION_SOUND1);
@@ -1193,7 +1198,7 @@ static MACHINE_START( djmain )
state_save_register_global(v_ctrl);
state_save_register_global_array(obj_regs);
- state_save_register_func_postload(sndram_set_bank);
+ state_save_register_postload(machine, djmain_postload, NULL);
}
diff --git a/src/mame/drivers/eprom.c b/src/mame/drivers/eprom.c
index eb6d7b6619d..265028f1b05 100644
--- a/src/mame/drivers/eprom.c
+++ b/src/mame/drivers/eprom.c
@@ -70,7 +70,7 @@ static MACHINE_RESET( klaxp )
atarigen_interrupt_reset(update_interrupts);
atarigen_scanline_timer_reset(machine->primary_screen, eprom_scanline_update, 8);
atarijsa_reset();
- atarigen_init_save_state();
+ atarigen_init_save_state(machine);
}
diff --git a/src/mame/drivers/konamigq.c b/src/mame/drivers/konamigq.c
index 12b0d7a92b8..34c4496c439 100644
--- a/src/mame/drivers/konamigq.c
+++ b/src/mame/drivers/konamigq.c
@@ -342,7 +342,7 @@ static const struct AM53CF96interface scsi_intf =
static DRIVER_INIT( konamigq )
{
- psx_driver_init();
+ psx_driver_init(machine);
m_p_n_pcmram = memory_region( REGION_SOUND1 ) + 0x80000;
}
diff --git a/src/mame/drivers/konamigv.c b/src/mame/drivers/konamigv.c
index d6d3215e68e..5e5b25b824b 100644
--- a/src/mame/drivers/konamigv.c
+++ b/src/mame/drivers/konamigv.c
@@ -313,7 +313,7 @@ static void konamigv_exit(running_machine *machine)
static DRIVER_INIT( konamigv )
{
- psx_driver_init();
+ psx_driver_init(machine);
/* init the scsi controller and hook up it's DMA */
am53cf96_init(&scsi_intf);
diff --git a/src/mame/drivers/ksys573.c b/src/mame/drivers/ksys573.c
index 1a79c3666e4..c3219e3a510 100644
--- a/src/mame/drivers/ksys573.c
+++ b/src/mame/drivers/ksys573.c
@@ -1491,7 +1491,7 @@ static DRIVER_INIT( konami573 )
{
int i;
- psx_driver_init();
+ psx_driver_init(machine);
atapi_init(machine);
psx_dma_install_read_handler(5, cdrom_dma_read);
psx_dma_install_write_handler(5, cdrom_dma_write);
diff --git a/src/mame/drivers/m90.c b/src/mame/drivers/m90.c
index f3360923664..b5b237a1c61 100644
--- a/src/mame/drivers/m90.c
+++ b/src/mame/drivers/m90.c
@@ -1155,6 +1155,10 @@ ROM_END
+static STATE_POSTLOAD( quizf1_postload )
+{
+ set_m90_bank();
+}
static DRIVER_INIT( quizf1 )
{
@@ -1162,7 +1166,7 @@ static DRIVER_INIT( quizf1 )
set_m90_bank();
state_save_register_global(bankaddress);
- state_save_register_func_postload(set_m90_bank);
+ state_save_register_postload(machine, quizf1_postload, NULL);
}
diff --git a/src/mame/drivers/m92.c b/src/mame/drivers/m92.c
index 25cdbbf5e0c..eef3d97c839 100644
--- a/src/mame/drivers/m92.c
+++ b/src/mame/drivers/m92.c
@@ -220,12 +220,17 @@ static void set_m92_bank(void)
memory_set_bankptr(1,&RAM[bankaddress]);
}
+static STATE_POSTLOAD( m92_postload )
+{
+ set_m92_bank();
+}
+
static MACHINE_START( m92 )
{
state_save_register_global(irqvector);
state_save_register_global(sound_status);
state_save_register_global(bankaddress);
- state_save_register_func_postload(set_m92_bank);
+ state_save_register_postload(machine, m92_postload, NULL);
scanline_timer = timer_alloc(m92_scanline_interrupt, NULL);
}
diff --git a/src/mame/drivers/mw8080bw.c b/src/mame/drivers/mw8080bw.c
index 4ed95a8cbcd..7a6a7cf2248 100644
--- a/src/mame/drivers/mw8080bw.c
+++ b/src/mame/drivers/mw8080bw.c
@@ -857,9 +857,9 @@ MACHINE_DRIVER_END
static UINT8 maze_tone_timing_state;
-static void maze_update_discrete(void)
+static STATE_POSTLOAD( maze_update_discrete )
{
- maze_write_discrete(Machine, maze_tone_timing_state);
+ maze_write_discrete(machine, maze_tone_timing_state);
}
@@ -880,7 +880,7 @@ static MACHINE_START( maze )
/* setup for save states */
state_save_register_global(maze_tone_timing_state);
- state_save_register_func_postload(maze_update_discrete);
+ state_save_register_postload(machine, maze_update_discrete, NULL);
MACHINE_START_CALL(mw8080bw);
}
diff --git a/src/mame/drivers/mystwarr.c b/src/mame/drivers/mystwarr.c
index 2cd5acf1f08..bd18c9227ad 100644
--- a/src/mame/drivers/mystwarr.c
+++ b/src/mame/drivers/mystwarr.c
@@ -850,6 +850,11 @@ static GFXDECODE_START( dadandrn )
GFXDECODE_ENTRY( REGION_GFX3, 0, bglayout_8bpp, 0x0000, 8 )
GFXDECODE_END
+static STATE_POSTLOAD( mystwarr_postload )
+{
+ reset_sound_region();
+}
+
static MACHINE_START( mystwarr )
{
/* set default bankswitch */
@@ -860,7 +865,7 @@ static MACHINE_START( mystwarr )
state_save_register_global(mw_irq_control);
state_save_register_global(cur_sound_region);
- state_save_register_func_postload(reset_sound_region);
+ state_save_register_postload(machine, mystwarr_postload, NULL);
}
static MACHINE_RESET(mystwarr)
diff --git a/src/mame/drivers/namcoic.c b/src/mame/drivers/namcoic.c
index 970863f87d9..a802b75d7b6 100644
--- a/src/mame/drivers/namcoic.c
+++ b/src/mame/drivers/namcoic.c
@@ -1601,8 +1601,7 @@ UpdateRoad(running_machine *machine)
}
}
-static void
-RoadMarkAllDirty(void)
+static STATE_POSTLOAD( RoadMarkAllDirty )
{
memset( mpRoadDirty,0x01,ROAD_TILE_COUNT_MAX );
mbRoadSomethingIsDirty = 1;
@@ -1632,7 +1631,7 @@ namco_road_init(running_machine *machine, int gfxbank )
state_save_register_global_pointer(mpRoadDirty, ROAD_TILE_COUNT_MAX);
state_save_register_global_pointer(mpRoadRAM, 0x20000 / 2);
- state_save_register_func_postload(RoadMarkAllDirty);
+ state_save_register_postload(machine, RoadMarkAllDirty, NULL);
}
}
diff --git a/src/mame/drivers/namcos10.c b/src/mame/drivers/namcos10.c
index b5a9ef3c58d..a2090c50897 100644
--- a/src/mame/drivers/namcos10.c
+++ b/src/mame/drivers/namcos10.c
@@ -304,12 +304,12 @@ static void memcpy32le( UINT32 *dst, UINT8 *src, int len )
}
}
-static void memm_driver_init( void )
+static void memm_driver_init( running_machine *machine )
{
- psx_driver_init();
+ psx_driver_init(machine);
}
-static void memn_driver_init( void )
+static void memn_driver_init( running_machine *machine )
{
UINT8 *BIOS = (UINT8 *)memory_region( REGION_USER1 );
UINT8 *ROM = (UINT8 *)memory_region( REGION_USER2 );
@@ -317,7 +317,7 @@ static void memn_driver_init( void )
memcpy32le( (UINT32 *)( BIOS + 0x0000000 ), ROM + 0x08000, 0x001c000 );
memcpy32le( (UINT32 *)( BIOS + 0x0020000 ), ROM + 0x24000, 0x03dffff );
- psx_driver_init();
+ psx_driver_init(machine);
}
static void decrypt_bios( int b15, int b14, int b13, int b12, int b11, int b10, int b9, int b8,
@@ -336,37 +336,37 @@ static void decrypt_bios( int b15, int b14, int b13, int b12, int b11, int b10,
static DRIVER_INIT( mrdrilr2 )
{
- memm_driver_init();
+ memm_driver_init(machine);
decrypt_bios( 0xc, 0xd, 0xf, 0xe, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x4, 0x1, 0x2, 0x5, 0x0, 0x3 );
}
static DRIVER_INIT( gjspace )
{
- memn_driver_init();
+ memn_driver_init(machine);
decrypt_bios( 0x0, 0x2, 0xe, 0xd, 0xf, 0x6, 0xc, 0x7, 0x5, 0x1, 0x9, 0x8, 0xa, 0x3, 0x4, 0xb );
}
static DRIVER_INIT( mrdrilrg )
{
- memn_driver_init();
+ memn_driver_init(machine);
decrypt_bios( 0x6, 0x4, 0x7, 0x5, 0x2, 0x1, 0x0, 0x3, 0xc, 0xd, 0xe, 0xf, 0x8, 0x9, 0xb, 0xa );
}
static DRIVER_INIT( knpuzzle )
{
- memn_driver_init();
+ memn_driver_init(machine);
decrypt_bios( 0x6, 0x7, 0x4, 0x5, 0x2, 0x0, 0x3, 0x1, 0xc, 0xd, 0xe, 0xf, 0x9, 0xb, 0x8, 0xa );
}
static DRIVER_INIT( startrgn )
{
- memn_driver_init();
+ memn_driver_init(machine);
decrypt_bios( 0x6, 0x5, 0x4, 0x7, 0x1, 0x3, 0x0, 0x2, 0xc, 0xd, 0xe, 0xf, 0x8, 0xb, 0xa, 0x9 );
}
static DRIVER_INIT( gamshara )
{
- memn_driver_init();
+ memn_driver_init(machine);
decrypt_bios( 0x5, 0x4, 0x7, 0x6, 0x0, 0x1, 0x3, 0x2, 0xd, 0xf, 0xc, 0xe, 0x8, 0x9, 0xa, 0xb );
}
diff --git a/src/mame/drivers/namcos11.c b/src/mame/drivers/namcos11.c
index 3f914c5cef1..2e2b90be4c4 100644
--- a/src/mame/drivers/namcos11.c
+++ b/src/mame/drivers/namcos11.c
@@ -800,7 +800,7 @@ static DRIVER_INIT( namcos11 )
timer = timer_alloc( mcu_timer , NULL);
timer_adjust_periodic( timer, ATTOTIME_IN_HZ( 600 ), 0, ATTOTIME_IN_HZ( 600 ) );
- psx_driver_init();
+ psx_driver_init(machine);
namcoc7x_on_driver_init();
namcoc7x_set_host_ram(namcos11_sharedram);
diff --git a/src/mame/drivers/namcos12.c b/src/mame/drivers/namcos12.c
index 95d8b611702..634f3b5671f 100644
--- a/src/mame/drivers/namcos12.c
+++ b/src/mame/drivers/namcos12.c
@@ -1439,7 +1439,7 @@ static const struct C352interface c352_interface =
static DRIVER_INIT( namcos12 )
{
- psx_driver_init();
+ psx_driver_init(machine);
psx_dma_install_read_handler( 5, namcos12_rom_read );
diff --git a/src/mame/drivers/neogeo.c b/src/mame/drivers/neogeo.c
index 09c3efd724d..007b63bdef5 100644
--- a/src/mame/drivers/neogeo.c
+++ b/src/mame/drivers/neogeo.c
@@ -817,13 +817,13 @@ static WRITE16_HANDLER( system_control_w )
switch (offset & 0x07)
{
default:
- case 0x00: neogeo_set_screen_dark(bit); break;
+ case 0x00: neogeo_set_screen_dark(machine, bit); break;
case 0x01: set_main_cpu_vector_table_source(bit);
set_audio_cpu_rom_source(bit); /* this is a guess */
break;
case 0x05: neogeo_set_fixed_layer_source(bit); break;
case 0x06: set_save_ram_unlock(bit); break;
- case 0x07: neogeo_set_palette_bank(bit); break;
+ case 0x07: neogeo_set_palette_bank(machine, bit); break;
case 0x02: /* unknown - HC32 middle pin 1 */
case 0x03: /* unknown - uPD4990 pin ? */
@@ -944,6 +944,15 @@ static void set_output_data(UINT8 data)
*
*************************************/
+static STATE_POSTLOAD( neogeo_postload )
+{
+ _set_main_cpu_bank_address();
+ _set_main_cpu_vector_table_source();
+ set_audio_cpu_banking();
+ _set_audio_cpu_rom_source();
+ set_outputs();
+}
+
static MACHINE_START( neogeo )
{
/* set the BIOS bank */
@@ -987,11 +996,7 @@ static MACHINE_START( neogeo )
state_save_register_global(led1_value);
state_save_register_global(led2_value);
- state_save_register_func_postload(_set_main_cpu_bank_address);
- state_save_register_func_postload(_set_main_cpu_vector_table_source);
- state_save_register_func_postload(set_audio_cpu_banking);
- state_save_register_func_postload(_set_audio_cpu_rom_source);
- state_save_register_func_postload(set_outputs);
+ state_save_register_postload(machine, neogeo_postload, NULL);
}
diff --git a/src/mame/drivers/ninjaw.c b/src/mame/drivers/ninjaw.c
index 7fd9e1cdfd0..03ed0df5b00 100644
--- a/src/mame/drivers/ninjaw.c
+++ b/src/mame/drivers/ninjaw.c
@@ -927,15 +927,18 @@ ROM_START( darius2 )
ROM_LOAD( "c07-12.107", 0x00000, 0x80000, CRC(e0b71258) SHA1(0258e308b643d723475824752ebffc4ea29d1ac4) )
ROM_END
+static STATE_POSTLOAD( ninjaw_postload )
+{
+ parse_control();
+ reset_sound_region();
+}
static MACHINE_START( ninjaw )
{
cpua_ctrl = 0xff;
state_save_register_global(cpua_ctrl);
- state_save_register_func_postload(parse_control);
-
state_save_register_global(banknum);
- state_save_register_func_postload(reset_sound_region);
+ state_save_register_postload(machine, ninjaw_postload, NULL);
}
static MACHINE_RESET( ninjaw )
diff --git a/src/mame/drivers/othunder.c b/src/mame/drivers/othunder.c
index 7e0cd4f14be..83ab01e5116 100644
--- a/src/mame/drivers/othunder.c
+++ b/src/mame/drivers/othunder.c
@@ -441,10 +441,15 @@ static void reset_sound_region(void)
memory_set_bankptr( 10, memory_region(REGION_CPU2) + (banknum * 0x4000) + 0x10000 );
}
+static STATE_POSTLOAD( othunder_postload )
+{
+ reset_sound_region();
+}
+
static MACHINE_START( othunder )
{
state_save_register_global(banknum);
- state_save_register_func_postload(reset_sound_region);
+ state_save_register_postload(machine, othunder_postload, NULL);
}
diff --git a/src/mame/drivers/psikyo4.c b/src/mame/drivers/psikyo4.c
index 48178e79996..e349c601531 100644
--- a/src/mame/drivers/psikyo4.c
+++ b/src/mame/drivers/psikyo4.c
@@ -1068,7 +1068,12 @@ PC :000029F8: BT $000029EC
return ps4_ram[0x00001c/4];
}
-static void install_hotgmck_pcm_bank(void)
+static STATE_POSTLOAD( hotgmck_pcm_bank_postload )
+{
+ set_hotgmck_pcm_bank((FPTR)param);
+}
+
+static void install_hotgmck_pcm_bank(running_machine *machine)
{
UINT8 *ymf_pcm = memory_region(REGION_SOUND1);
UINT8 *pcm_rom = memory_region(REGION_SOUND2);
@@ -1080,8 +1085,8 @@ static void install_hotgmck_pcm_bank(void)
set_hotgmck_pcm_bank(1);
memory_install_write32_handler(0, ADDRESS_SPACE_PROGRAM, 0x5800008, 0x580000b, 0, 0, hotgmck_pcm_bank_w );
- state_save_register_func_postload_int(set_hotgmck_pcm_bank, 0);
- state_save_register_func_postload_int(set_hotgmck_pcm_bank, 1);
+ state_save_register_postload(machine, hotgmck_pcm_bank_postload, (void *)0);
+ state_save_register_postload(machine, hotgmck_pcm_bank_postload, (void *)1);
}
static DRIVER_INIT( hotgmck )
@@ -1089,7 +1094,7 @@ static DRIVER_INIT( hotgmck )
UINT8 *RAM = memory_region(REGION_CPU1);
memory_set_bankptr(1,&RAM[0x100000]);
memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0x5800000, 0x5800007, 0, 0, hotgmck_io32_r ); // Different Inputs
- install_hotgmck_pcm_bank(); // Banked PCM ROM
+ install_hotgmck_pcm_bank(machine); // Banked PCM ROM
}
static DRIVER_INIT( loderndf )
diff --git a/src/mame/drivers/renegade.c b/src/mame/drivers/renegade.c
index c62e6c5253a..1edaa94e664 100644
--- a/src/mame/drivers/renegade.c
+++ b/src/mame/drivers/renegade.c
@@ -243,6 +243,11 @@ static void setbank(void)
memory_set_bankptr(1, &RAM[bank ? 0x10000 : 0x4000]);
}
+static STATE_POSTLOAD( renegade_postload )
+{
+ setbank();
+}
+
static MACHINE_START( renegade )
{
state_save_register_global_array(mcu_buffer);
@@ -251,7 +256,7 @@ static MACHINE_START( renegade )
state_save_register_global(mcu_key);
state_save_register_global(bank);
- state_save_register_func_postload(setbank);
+ state_save_register_postload(machine, renegade_postload, NULL);
}
static DRIVER_INIT( kuniokun )
diff --git a/src/mame/drivers/slapshot.c b/src/mame/drivers/slapshot.c
index 4a318c4d954..757924f9589 100644
--- a/src/mame/drivers/slapshot.c
+++ b/src/mame/drivers/slapshot.c
@@ -232,10 +232,15 @@ static void reset_sound_region(void)
memory_set_bankptr( 10, memory_region(REGION_CPU2) + (banknum * 0x4000) + 0x10000 );
}
+static STATE_POSTLOAD( slapshot_postload )
+{
+ reset_sound_region();
+}
+
static MACHINE_START( slapshot )
{
state_save_register_global(banknum);
- state_save_register_func_postload(reset_sound_region);
+ state_save_register_postload(machine, slapshot_postload, NULL);
}
diff --git a/src/mame/drivers/taito_f2.c b/src/mame/drivers/taito_f2.c
index d8a9becc450..dd77e243a94 100644
--- a/src/mame/drivers/taito_f2.c
+++ b/src/mame/drivers/taito_f2.c
@@ -3851,10 +3851,15 @@ static const struct YM2203interface ym2203_interface =
MACHINE DRIVERS
***********************************************************/
+static STATE_POSTLOAD( f2_postload )
+{
+ reset_sound_region();
+}
+
static MACHINE_START( f2 )
{
state_save_register_global(banknum);
- state_save_register_func_postload(reset_sound_region);
+ state_save_register_postload(machine, f2_postload, NULL);
}
static MACHINE_RESET( qcrayon )
@@ -5901,11 +5906,16 @@ static DRIVER_INIT( yesnoj )
state_save_register_global(yesnoj_dsw);
}
+static STATE_POSTLOAD( driveout_postload )
+{
+ reset_driveout_sound_region();
+}
+
static DRIVER_INIT( driveout )
{
state_save_register_global(driveout_sound_latch);
state_save_register_global(oki_bank);
- state_save_register_func_postload(reset_driveout_sound_region);
+ state_save_register_postload(machine, driveout_postload, NULL);
}
diff --git a/src/mame/drivers/taito_h.c b/src/mame/drivers/taito_h.c
index af19b78520d..cae6c07597e 100644
--- a/src/mame/drivers/taito_h.c
+++ b/src/mame/drivers/taito_h.c
@@ -566,10 +566,15 @@ static GFXDECODE_START( dleague )
GFXDECODE_END
+static STATE_POSTLOAD( taitoh_postload )
+{
+ reset_sound_region();
+}
+
static MACHINE_START( taitoh )
{
state_save_register_global(banknum);
- state_save_register_func_postload(reset_sound_region);
+ state_save_register_postload(machine, taitoh_postload, NULL);
}
diff --git a/src/mame/drivers/taito_x.c b/src/mame/drivers/taito_x.c
index 0bae4bf737a..2407285fada 100644
--- a/src/mame/drivers/taito_x.c
+++ b/src/mame/drivers/taito_x.c
@@ -995,11 +995,15 @@ static const struct YM2151interface ym2151_interface =
irqhandler
};
+static STATE_POSTLOAD( taitox_postload )
+{
+ reset_sound_region();
+}
static MACHINE_START( taitox )
{
state_save_register_global(banknum);
- state_save_register_func_postload(reset_sound_region);
+ state_save_register_postload(machine, taitox_postload, NULL);
}
/**************************************************************************/
diff --git a/src/mame/drivers/taito_z.c b/src/mame/drivers/taito_z.c
index 6c83628c122..3e27e613727 100644
--- a/src/mame/drivers/taito_z.c
+++ b/src/mame/drivers/taito_z.c
@@ -1424,10 +1424,15 @@ static WRITE16_HANDLER( spacegun_pancontrol )
SAVE STATES
***********************************************************/
+static STATE_POSTLOAD( taitoz_postload )
+{
+ parse_control();
+ reset_sound_region();
+}
+
static MACHINE_START( taitoz )
{
state_save_register_global(cpua_ctrl);
- state_save_register_func_postload(parse_control);
/* these are specific to various games: we ought to split the inits */
state_save_register_global(sci_int6);
@@ -1435,7 +1440,7 @@ static MACHINE_START( taitoz )
state_save_register_global(ioc220_port);
state_save_register_global(banknum);
- state_save_register_func_postload(reset_sound_region);
+ state_save_register_postload(machine, taitoz_postload, NULL);
}
@@ -4333,10 +4338,15 @@ static DRIVER_INIT( taitoz )
cpua_ctrl = 0xff;
}
+static STATE_POSTLOAD( bshark_postload )
+{
+ parse_control_noz80();
+}
+
static DRIVER_INIT( bshark )
{
cpua_ctrl = 0xff;
- state_save_register_func_postload(parse_control_noz80);
+ state_save_register_postload(machine, bshark_postload, NULL);
state_save_register_global(eep_latch);
}
diff --git a/src/mame/drivers/taitoair.c b/src/mame/drivers/taitoair.c
index 2c65055c136..7a535a9b5c2 100644
--- a/src/mame/drivers/taitoair.c
+++ b/src/mame/drivers/taitoair.c
@@ -355,13 +355,17 @@ static WRITE8_HANDLER( sound_bankswitch_w )
reset_sound_region();
}
+static STATE_POSTLOAD( taitoair_postload )
+{
+ reset_sound_region();
+}
static MACHINE_START( taitoair )
{
dsp_HOLD_signal = ASSERT_LINE;
state_save_register_global(banknum);
- state_save_register_func_postload(reset_sound_region);
+ state_save_register_postload(machine, taitoair_postload, NULL);
}
diff --git a/src/mame/drivers/toaplan1.c b/src/mame/drivers/toaplan1.c
index 8ece9cc4135..262a79c7c42 100644
--- a/src/mame/drivers/toaplan1.c
+++ b/src/mame/drivers/toaplan1.c
@@ -2089,19 +2089,19 @@ ROM_END
static DRIVER_INIT( toaplan1 )
{
- toaplan1_driver_savestate();
+ toaplan1_driver_savestate(machine);
}
static DRIVER_INIT( demonwld )
{
- toaplan1_driver_savestate();
- demonwld_driver_savestate();
+ toaplan1_driver_savestate(machine);
+ demonwld_driver_savestate(machine);
}
static DRIVER_INIT( vimana )
{
- toaplan1_driver_savestate();
- vimana_driver_savestate();
+ toaplan1_driver_savestate(machine);
+ vimana_driver_savestate(machine);
}
diff --git a/src/mame/drivers/topspeed.c b/src/mame/drivers/topspeed.c
index 54628757639..0f4d977017c 100644
--- a/src/mame/drivers/topspeed.c
+++ b/src/mame/drivers/topspeed.c
@@ -679,15 +679,18 @@ static const struct MSM5205interface msm5205_interface =
MACHINE DRIVERS
***********************************************************/
+static STATE_POSTLOAD( topspeed_postload )
+{
+ parse_control();
+ reset_sound_region();
+}
+
static MACHINE_START( topspeed )
{
state_save_register_global(cpua_ctrl);
- state_save_register_func_postload(parse_control);
-
state_save_register_global(ioc220_port);
-
state_save_register_global(banknum);
- state_save_register_func_postload(reset_sound_region);
+ state_save_register_postload(machine, topspeed_postload, NULL);
}
static MACHINE_DRIVER_START( topspeed )
diff --git a/src/mame/drivers/twincobr.c b/src/mame/drivers/twincobr.c
index 77426253cee..8bc02700c23 100644
--- a/src/mame/drivers/twincobr.c
+++ b/src/mame/drivers/twincobr.c
@@ -1080,7 +1080,7 @@ ROM_END
static DRIVER_INIT( twincobr )
{
- twincobr_driver_savestate();
+ twincobr_driver_savestate(machine);
}
diff --git a/src/mame/drivers/wardner.c b/src/mame/drivers/wardner.c
index 0cdc5879856..123c0169c54 100644
--- a/src/mame/drivers/wardner.c
+++ b/src/mame/drivers/wardner.c
@@ -172,7 +172,7 @@ static WRITE8_HANDLER( wardner_ramrom_bank_sw )
}
}
-void wardner_restore_bank(void)
+STATE_POSTLOAD( wardner_restore_bank )
{
wardner_ramrom_bank_sw(Machine,0,1); /* Dummy value to ensure restoration */
wardner_ramrom_bank_sw(Machine,0,wardner_membank);
@@ -674,7 +674,7 @@ ROM_END
static DRIVER_INIT( wardner )
{
- wardner_driver_savestate(); /* Save-State stuff in src/machine/twincobr.c */
+ wardner_driver_savestate(machine); /* Save-State stuff in src/machine/twincobr.c */
}
diff --git a/src/mame/drivers/warriorb.c b/src/mame/drivers/warriorb.c
index 0f33662d2ee..a752d24a5fa 100644
--- a/src/mame/drivers/warriorb.c
+++ b/src/mame/drivers/warriorb.c
@@ -735,11 +735,15 @@ ROM_START( warriorb )
// ROM_LOAD( "d24-16.79", 0x00000, 0xa??, NO_DUMP )
ROM_END
+static STATE_POSTLOAD( warriorb_postload )
+{
+ reset_sound_region();
+}
static MACHINE_START( warriorb )
{
state_save_register_global(banknum);
- state_save_register_func_postload(reset_sound_region);
+ state_save_register_postload(machine, warriorb_postload, NULL);
}
static MACHINE_RESET( taito_dualscreen )
diff --git a/src/mame/drivers/wgp.c b/src/mame/drivers/wgp.c
index 18b15fddc2d..98569063e9c 100644
--- a/src/mame/drivers/wgp.c
+++ b/src/mame/drivers/wgp.c
@@ -935,13 +935,17 @@ However sync to vblank is lacking, which is causing the
graphics glitches.
***********************************************************/
+static STATE_POSTLOAD( wgp_postload )
+{
+ parse_control();
+ reset_sound_region();
+}
+
static MACHINE_START( wgp )
{
state_save_register_global(cpua_ctrl);
- state_save_register_func_postload(parse_control);
-
state_save_register_global(banknum);
- state_save_register_func_postload(reset_sound_region);
+ state_save_register_postload(machine, wgp_postload, NULL);
}
static MACHINE_DRIVER_START( wgp )
diff --git a/src/mame/drivers/xexex.c b/src/mame/drivers/xexex.c
index 18ec2c84318..9d7280c2bda 100644
--- a/src/mame/drivers/xexex.c
+++ b/src/mame/drivers/xexex.c
@@ -608,12 +608,17 @@ static MACHINE_RESET( xexex )
K054539_init_flags(0, K054539_REVERSE_STEREO);
}
+static STATE_POSTLOAD( xexex_postload )
+{
+ parse_control2();
+ reset_sound_region();
+}
+
static MACHINE_START( xexex )
{
state_save_register_global(cur_control2);
- state_save_register_func_postload(parse_control2);
state_save_register_global(cur_sound_region);
- state_save_register_func_postload(reset_sound_region);
+ state_save_register_postload(machine, xexex_postload, NULL);
resume_trigger = 1000;
diff --git a/src/mame/drivers/xmen.c b/src/mame/drivers/xmen.c
index a7a6f6a086d..5c719c6e2d9 100644
--- a/src/mame/drivers/xmen.c
+++ b/src/mame/drivers/xmen.c
@@ -460,10 +460,15 @@ static INTERRUPT_GEN( xmen_interrupt )
else irq3_line_hold(machine, cpunum);
}
+static STATE_POSTLOAD( xmen_postload )
+{
+ sound_reset_bank();
+}
+
static MACHINE_START( xmen )
{
state_save_register_global(sound_curbank);
- state_save_register_func_postload(sound_reset_bank);
+ state_save_register_postload(machine, xmen_postload, NULL);
}
static MACHINE_DRIVER_START( xmen )
diff --git a/src/mame/drivers/zn.c b/src/mame/drivers/zn.c
index 02f951a399a..2d8e366371e 100644
--- a/src/mame/drivers/zn.c
+++ b/src/mame/drivers/zn.c
@@ -382,11 +382,11 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( link_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END
-static void zn_driver_init( void )
+static void zn_driver_init( running_machine *machine )
{
int n_game;
- psx_driver_init();
+ psx_driver_init(machine);
n_game = 0;
while( zn_config_table[ n_game ].s_name != NULL )
@@ -635,7 +635,7 @@ static DRIVER_INIT( coh1000c )
memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1fb80000, 0x1fbfffff, 0, 0, SMH_BANK3 ); /* country rom */
memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fb60000, 0x1fb60003, 0, 0, zn_qsound_w );
- zn_driver_init();
+ zn_driver_init(machine);
if( strcmp( machine->gamedrv->name, "glpracr" ) == 0 ||
strcmp( machine->gamedrv->name, "glprac2l" ) == 0 )
@@ -867,7 +867,7 @@ static DRIVER_INIT( coh3002c )
memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1fb80000, 0x1fbfffff, 0, 0, SMH_BANK3 ); /* country rom */
memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fb60000, 0x1fb60003, 0, 0, zn_qsound_w );
- zn_driver_init();
+ zn_driver_init(machine);
}
static MACHINE_RESET( coh3002c )
@@ -1215,7 +1215,7 @@ static DRIVER_INIT( coh1000ta )
memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1fbe0000, 0x1fbe0000 + ( taitofx1_eeprom_size1 - 1 ), 0, 0, SMH_BANK2 );
memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fbe0000, 0x1fbe0000 + ( taitofx1_eeprom_size1 - 1 ), 0, 0, SMH_BANK2 );
- zn_driver_init();
+ zn_driver_init(machine);
mb3773_init();
}
@@ -1335,7 +1335,7 @@ static DRIVER_INIT( coh1000tb )
memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1fbe0000, 0x1fbe0000 + ( taitofx1_eeprom_size2 - 1 ), 0, 0, SMH_BANK3 );
memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fbe0000, 0x1fbe0000 + ( taitofx1_eeprom_size2 - 1 ), 0, 0, SMH_BANK3 );
- zn_driver_init();
+ zn_driver_init(machine);
mb3773_init();
}
@@ -1526,7 +1526,7 @@ static DRIVER_INIT( coh3002t )
memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fb40000, 0x1fb40003, 0, 0, coh3002t_unknown_w );
memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1fb40000, 0x1fb40003, 0, 0, coh3002t_unknown_r );
- zn_driver_init();
+ zn_driver_init(machine);
}
static MACHINE_RESET( coh3002t )
@@ -1711,7 +1711,7 @@ static DRIVER_INIT( coh1000w )
// init hard disk
ide_controller_init(0, &atpsx_intf);
- zn_driver_init();
+ zn_driver_init(machine);
}
static MACHINE_RESET( coh1000w )
@@ -1899,7 +1899,7 @@ static DRIVER_INIT( coh1002e )
memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fa10300, 0x1fa10303, 0, 0, coh1002e_bank_w );
memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00007, 0, 0, coh1002e_latch_w );
- zn_driver_init();
+ zn_driver_init(machine);
}
static MACHINE_RESET( coh1002e )
@@ -2243,7 +2243,7 @@ static DRIVER_INIT( coh1000a )
ide_controller_init( 0, &jdredd_ide_intf );
}
- zn_driver_init();
+ zn_driver_init(machine);
}
static MACHINE_RESET( coh1000a )
@@ -2390,7 +2390,7 @@ static DRIVER_INIT( coh1001l )
memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f7fffff, 0, 0, SMH_BANK1 ); /* banked rom */
memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00003, 0, 0, coh1001l_bnk_w );
- zn_driver_init();
+ zn_driver_init(machine);
}
static MACHINE_RESET( coh1001l )
@@ -2436,7 +2436,7 @@ static DRIVER_INIT( coh1002v )
memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fbfffff, 0, 0, SMH_BANK2 );
memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00003, 0, 0, coh1002v_bnk_w );
- zn_driver_init();
+ zn_driver_init(machine);
}
static MACHINE_RESET( coh1002v )
@@ -2661,7 +2661,7 @@ static DRIVER_INIT( coh1002m )
memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00003, 0, 0, cbaj_z80_w );
memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fb00004, 0x1fb00007, 0, 0, coh1002m_bank_w );
- zn_driver_init();
+ zn_driver_init(machine);
}
static MACHINE_RESET( coh1002m )
diff --git a/src/mame/includes/neogeo.h b/src/mame/includes/neogeo.h
index f8cf66125a9..2dd3e4b66c4 100644
--- a/src/mame/includes/neogeo.h
+++ b/src/mame/includes/neogeo.h
@@ -141,8 +141,8 @@ VIDEO_UPDATE( neogeo );
READ16_HANDLER( neogeo_video_register_r );
WRITE16_HANDLER( neogeo_video_register_w );
-void neogeo_set_palette_bank(UINT8 data);
-void neogeo_set_screen_dark(UINT8 data);
+void neogeo_set_palette_bank(running_machine *machine, UINT8 data);
+void neogeo_set_screen_dark(running_machine *machine, UINT8 data);
READ16_HANDLER( neogeo_paletteram_r );
WRITE16_HANDLER( neogeo_paletteram_w );
diff --git a/src/mame/includes/psx.h b/src/mame/includes/psx.h
index 3200b331245..71d32e11d84 100644
--- a/src/mame/includes/psx.h
+++ b/src/mame/includes/psx.h
@@ -54,7 +54,7 @@ extern void psx_sio_input( int, int, int );
WRITE32_HANDLER( psx_mdec_w );
READ32_HANDLER( psx_mdec_r );
extern void psx_machine_init( void );
-extern void psx_driver_init( void );
+extern void psx_driver_init( running_machine *machine );
#define PSX_H ( 1 )
#endif
diff --git a/src/mame/includes/st0016.h b/src/mame/includes/st0016.h
index 3b46f235d81..2eb9feab582 100644
--- a/src/mame/includes/st0016.h
+++ b/src/mame/includes/st0016.h
@@ -50,6 +50,6 @@ VIDEO_UPDATE(st0016);
extern UINT32 st0016_game;
-void st0016_save_init(void);
+void st0016_save_init(running_machine *machine);
diff --git a/src/mame/includes/toaplan1.h b/src/mame/includes/toaplan1.h
index ade41b05d38..0fc1c0caafa 100644
--- a/src/mame/includes/toaplan1.h
+++ b/src/mame/includes/toaplan1.h
@@ -31,9 +31,9 @@ MACHINE_RESET( demonwld );
MACHINE_RESET( vimana );
MACHINE_RESET( zerozone ); /* hack for ZeroWing/OutZone. See video */
-extern void toaplan1_driver_savestate(void);
-extern void demonwld_driver_savestate(void);
-extern void vimana_driver_savestate(void);
+extern void toaplan1_driver_savestate(running_machine *machine);
+extern void demonwld_driver_savestate(running_machine *machine);
+extern void vimana_driver_savestate(running_machine *machine);
extern int toaplan1_unk_reset_port;
diff --git a/src/mame/includes/twincobr.h b/src/mame/includes/twincobr.h
index 4aac31ded15..545b7d53261 100644
--- a/src/mame/includes/twincobr.h
+++ b/src/mame/includes/twincobr.h
@@ -7,7 +7,7 @@
/*----------- defined in drivers/wardner.c -----------*/
-extern void wardner_restore_bank(void);
+extern STATE_POSTLOAD( wardner_restore_bank );
/*----------- defined in machine/twincobr.c -----------*/
@@ -35,8 +35,8 @@ WRITE8_HANDLER( wardner_coin_dsp_w );
MACHINE_RESET( twincobr );
MACHINE_RESET( wardner );
-extern void twincobr_driver_savestate(void);
-extern void wardner_driver_savestate(void);
+extern void twincobr_driver_savestate(running_machine *machine);
+extern void wardner_driver_savestate(running_machine *machine);
extern int toaplan_main_cpu; /* Main CPU type. 0 = 68000, 1 = Z80 */
extern int twincobr_intenable;
diff --git a/src/mame/machine/atari.c b/src/mame/machine/atari.c
index 019fb977058..b007d07d1c5 100644
--- a/src/mame/machine/atari.c
+++ b/src/mame/machine/atari.c
@@ -739,7 +739,7 @@ static void _antic_reset(running_machine *machine)
}
-static void atari_machine_start(int type, const pia6821_interface *pia_intf, int has_cart)
+static void atari_machine_start(running_machine *machine, int type, const pia6821_interface *pia_intf, int has_cart)
{
gtia_interface gtia_intf;
@@ -751,7 +751,7 @@ static void atari_machine_start(int type, const pia6821_interface *pia_intf, int
gtia_intf.console_read = console_read;
if (sndti_exists(SOUND_DAC, 0))
gtia_intf.console_write = console_write;
- gtia_init(&gtia_intf);
+ gtia_init(machine, &gtia_intf);
/* pokey */
add_reset_callback(Machine, pokey_reset);
@@ -814,12 +814,12 @@ static void atari_machine_start(int type, const pia6821_interface *pia_intf, int
MACHINE_START( a400 )
{
- atari_machine_start(ATARI_400, &atari_pia_interface, TRUE);
+ atari_machine_start(machine, ATARI_400, &atari_pia_interface, TRUE);
}
MACHINE_START( a600xl )
{
- atari_machine_start(ATARI_600XL, &a600xl_pia_interface, TRUE);
+ atari_machine_start(machine, ATARI_600XL, &a600xl_pia_interface, TRUE);
}
@@ -832,7 +832,7 @@ MACHINE_START( a600xl )
MACHINE_START( a800 )
{
- atari_machine_start(ATARI_800, &atari_pia_interface, TRUE);
+ atari_machine_start(machine, ATARI_800, &atari_pia_interface, TRUE);
}
@@ -886,7 +886,7 @@ DEVICE_IMAGE_UNLOAD( a800_cart )
MACHINE_START( a800xl )
{
- atari_machine_start(ATARI_800XL, &a800xl_pia_interface, TRUE);
+ atari_machine_start(machine, ATARI_800XL, &a800xl_pia_interface, TRUE);
}
@@ -943,7 +943,7 @@ DEVICE_IMAGE_LOAD( a800xl_cart )
MACHINE_START( a5200 )
{
- atari_machine_start(ATARI_800XL, NULL, FALSE);
+ atari_machine_start(machine, ATARI_800XL, NULL, FALSE);
}
diff --git a/src/mame/machine/atarigen.c b/src/mame/machine/atarigen.c
index e2d9c8de68b..f3efd36c282 100644
--- a/src/mame/machine/atarigen.c
+++ b/src/mame/machine/atarigen.c
@@ -502,7 +502,7 @@ INLINE void update_bank(int bank)
}
-static void slapstic_postload(void)
+static STATE_POSTLOAD( slapstic_postload )
{
update_bank(slapstic_bank());
}
@@ -1639,7 +1639,7 @@ void atarigen_blend_gfx(running_machine *machine, int gfx0, int gfx1, int mask0,
SAVE STATE
***************************************************************************/
-void atarigen_init_save_state(void)
+void atarigen_init_save_state(running_machine *machine)
{
state_save_register_global(atarigen_scanline_int_state);
state_save_register_global(atarigen_sound_int_state);
@@ -1683,5 +1683,5 @@ void atarigen_init_save_state(void)
state_save_register_global(playfield2_latch);
/* need a postload to reset the state */
- state_save_register_func_postload(slapstic_postload);
+ state_save_register_postload(machine, slapstic_postload, NULL);
}
diff --git a/src/mame/machine/atarigen.h b/src/mame/machine/atarigen.h
index 870fae6ca15..12d8d0cb25a 100644
--- a/src/mame/machine/atarigen.h
+++ b/src/mame/machine/atarigen.h
@@ -238,7 +238,7 @@ void atarigen_blend_gfx(running_machine *machine, int gfx0, int gfx1, int mask0,
STATE SAVE
---------------------------------------------------------------*/
-void atarigen_init_save_state(void);
+void atarigen_init_save_state(running_machine *machine);
/***************************************************************************
GENERAL ATARI NOTES
diff --git a/src/mame/machine/decocass.c b/src/mame/machine/decocass.c
index cae44c35c44..99d66f0c496 100644
--- a/src/mame/machine/decocass.c
+++ b/src/mame/machine/decocass.c
@@ -1589,7 +1589,7 @@ WRITE8_HANDLER( decocass_de0091_w )
* state save setup
*
***************************************************************************/
-static void decocass_state_save_postload(void)
+static STATE_POSTLOAD( decocass_state_save_postload )
{
#if 0
/* fix me - this won't work anymore */
@@ -1608,9 +1608,9 @@ static void decocass_state_save_postload(void)
}
/* To be called once from driver_init, i.e. decocass_init */
-void decocass_machine_state_save_init(void)
+void decocass_machine_state_save_init(running_machine *machine)
{
- state_save_register_func_postload(decocass_state_save_postload);
+ state_save_register_postload(machine, decocass_state_save_postload, NULL);
state_save_register_global(tape_dir);
state_save_register_global(tape_speed);
state_save_register_global(tape_time0.seconds);
diff --git a/src/mame/machine/decocass.h b/src/mame/machine/decocass.h
index fad121318d2..407a9a677b0 100644
--- a/src/mame/machine/decocass.h
+++ b/src/mame/machine/decocass.h
@@ -71,7 +71,7 @@ extern READ8_HANDLER( i8041_p1_r );
extern WRITE8_HANDLER( i8041_p2_w );
extern READ8_HANDLER( i8041_p2_r );
-void decocass_machine_state_save_init(void);
+void decocass_machine_state_save_init(running_machine *machine);
/*----------- defined in video/decocass.c -----------*/
extern WRITE8_HANDLER( decocass_paletteram_w );
diff --git a/src/mame/machine/psx.c b/src/mame/machine/psx.c
index fc0e9867603..c520f22b35e 100644
--- a/src/mame/machine/psx.c
+++ b/src/mame/machine/psx.c
@@ -1535,7 +1535,7 @@ void psx_machine_init( void )
psx_gpu_reset();
}
-static void psx_postload( void )
+static STATE_POSTLOAD( psx_postload )
{
int n;
@@ -1559,7 +1559,7 @@ static void psx_postload( void )
mdec_cos_precalc();
}
-void psx_driver_init( void )
+void psx_driver_init( running_machine *machine )
{
int n;
@@ -1648,5 +1648,5 @@ void psx_driver_init( void )
state_save_register_global_array( m_p_n_mdec_quantize_uv );
state_save_register_global_array( m_p_n_mdec_cos );
- state_save_register_func_postload( psx_postload );
+ state_save_register_postload( machine, psx_postload, NULL );
}
diff --git a/src/mame/machine/toaplan1.c b/src/mame/machine/toaplan1.c
index b49677ff7cf..cf1c1315632 100644
--- a/src/mame/machine/toaplan1.c
+++ b/src/mame/machine/toaplan1.c
@@ -129,7 +129,7 @@ static void demonwld_dsp(int enable)
cpunum_set_input_line(Machine, 2, INPUT_LINE_HALT, ASSERT_LINE);
}
}
-static void demonwld_restore_dsp(void)
+static STATE_POSTLOAD( demonwld_restore_dsp )
{
demonwld_dsp(demonwld_dsp_on);
}
@@ -299,7 +299,7 @@ MACHINE_RESET( toaplan1 )
toaplan1_unk_reset_port = 0;
coin_lockout_global_w(0);
}
-void toaplan1_driver_savestate(void)
+void toaplan1_driver_savestate(running_machine *machine)
{
state_save_register_global(toaplan1_intenable);
state_save_register_global(toaplan1_coin_count);
@@ -319,14 +319,14 @@ MACHINE_RESET( demonwld )
main_ram_seg = 0;
dsp_execute = 0;
}
-void demonwld_driver_savestate(void)
+void demonwld_driver_savestate(running_machine *machine)
{
state_save_register_global(demonwld_dsp_on);
state_save_register_global(dsp_addr_w);
state_save_register_global(main_ram_seg);
state_save_register_global(demonwld_dsp_BIO);
state_save_register_global(dsp_execute);
- state_save_register_func_postload(demonwld_restore_dsp);
+ state_save_register_postload(machine, demonwld_restore_dsp, NULL);
}
MACHINE_RESET( vimana )
@@ -335,7 +335,7 @@ MACHINE_RESET( vimana )
vimana_credits = 0;
vimana_latch = 0;
}
-void vimana_driver_savestate(void)
+void vimana_driver_savestate(running_machine *machine)
{
state_save_register_global(vimana_credits);
state_save_register_global(vimana_latch);
diff --git a/src/mame/machine/twincobr.c b/src/mame/machine/twincobr.c
index ce31f0d0f98..7b9418cb1f4 100644
--- a/src/mame/machine/twincobr.c
+++ b/src/mame/machine/twincobr.c
@@ -207,7 +207,7 @@ static void twincobr_dsp(int enable)
}
}
-static void twincobr_restore_dsp(void)
+static STATE_POSTLOAD( twincobr_restore_dsp )
{
twincobr_dsp(twincobr_dsp_on);
}
@@ -325,7 +325,7 @@ MACHINE_RESET( twincobr )
fsharkbt_8741 = -1; /* Reset the Flying Shark Bootleg MCU */
twincobr_dsp_BIO = CLEAR_LINE;
}
-void twincobr_driver_savestate(void)
+void twincobr_driver_savestate(running_machine *machine)
{
state_save_register_global(toaplan_main_cpu);
state_save_register_global(twincobr_intenable);
@@ -335,7 +335,7 @@ void twincobr_driver_savestate(void)
state_save_register_global(twincobr_dsp_BIO);
state_save_register_global(dsp_execute);
state_save_register_global(fsharkbt_8741);
- state_save_register_func_postload(twincobr_restore_dsp);
+ state_save_register_postload(machine, twincobr_restore_dsp, NULL);
}
MACHINE_RESET( wardner )
@@ -349,7 +349,7 @@ MACHINE_RESET( wardner )
twincobr_dsp_BIO = CLEAR_LINE;
wardner_membank = 0;
}
-void wardner_driver_savestate(void)
+void wardner_driver_savestate(running_machine *machine)
{
state_save_register_global(toaplan_main_cpu);
state_save_register_global(twincobr_intenable);
@@ -359,6 +359,6 @@ void wardner_driver_savestate(void)
state_save_register_global(twincobr_dsp_BIO);
state_save_register_global(dsp_execute);
state_save_register_global(wardner_membank);
- state_save_register_func_postload(wardner_restore_bank); /* Restore the Main CPU bank */
- state_save_register_func_postload(twincobr_restore_dsp);
+ state_save_register_postload(machine, wardner_restore_bank, NULL); /* Restore the Main CPU bank */
+ state_save_register_postload(machine, twincobr_restore_dsp, NULL);
}
diff --git a/src/mame/machine/williams.c b/src/mame/machine/williams.c
index f46dd10460c..88946236fae 100644
--- a/src/mame/machine/williams.c
+++ b/src/mame/machine/williams.c
@@ -433,9 +433,9 @@ static TIMER_CALLBACK( williams2_endscreen_callback )
*
*************************************/
-static void williams2_postload(void)
+static STATE_POSTLOAD( williams2_postload )
{
- williams2_bank_select_w(Machine, 0, vram_bank);
+ williams2_bank_select_w(machine, 0, vram_bank);
}
@@ -460,7 +460,7 @@ MACHINE_RESET( williams2 )
timer_adjust_oneshot(scan254_timer, video_screen_get_time_until_pos(machine->primary_screen, 254, 0), 0);
state_save_register_global(vram_bank);
- state_save_register_func_postload(williams2_postload);
+ state_save_register_postload(machine, williams2_postload, NULL);
}
@@ -711,9 +711,9 @@ WRITE8_HANDLER( williams2_7segment_w )
*
*************************************/
-static void defender_postload(void)
+static STATE_POSTLOAD( defender_postload )
{
- defender_bank_select_w(Machine, 0, vram_bank);
+ defender_bank_select_w(machine, 0, vram_bank);
}
@@ -725,7 +725,7 @@ MACHINE_RESET( defender )
memory_configure_bank(1, 0, 9, &memory_region(REGION_CPU1)[0x10000], 0x1000);
defender_bank_select_w(machine, 0, 0);
- state_save_register_func_postload(defender_postload);
+ state_save_register_postload(machine, defender_postload, NULL);
}
diff --git a/src/mame/video/asterix.c b/src/mame/video/asterix.c
index d7af9614e0d..3a2b5dc6283 100644
--- a/src/mame/video/asterix.c
+++ b/src/mame/video/asterix.c
@@ -44,7 +44,7 @@ static void asterix_tile_callback(int layer, int *code, int *color, int *flags)
VIDEO_START( asterix )
{
- K053251_vh_start();
+ K053251_vh_start(machine);
K056832_vh_start(machine, REGION_GFX1, K056832_BPP_4, 1, NULL, asterix_tile_callback, 1);
K053245_vh_start(machine,0, REGION_GFX2,NORMAL_PLANE_ORDER, asterix_sprite_callback);
diff --git a/src/mame/video/asuka.c b/src/mame/video/asuka.c
index 27e01dcde7e..debb56b65eb 100644
--- a/src/mame/video/asuka.c
+++ b/src/mame/video/asuka.c
@@ -10,7 +10,7 @@ static void asuka_core_video_start(running_machine *machine, int x_offs,int buff
{
PC090OJ_vh_start(0,0,8,buffering); /* gfxset, x offset, y offset, buffering */
TC0100SCN_vh_start(machine,1,TC0100SCN_GFX_NUM,x_offs,0,0,0,0,0,0);
- TC0110PCR_vh_start();
+ TC0110PCR_vh_start(machine);
}
VIDEO_START( asuka )
diff --git a/src/mame/video/chaknpop.c b/src/mame/video/chaknpop.c
index 61481e8f1ce..e26bb23ac68 100644
--- a/src/mame/video/chaknpop.c
+++ b/src/mame/video/chaknpop.c
@@ -171,6 +171,13 @@ static TILE_GET_INFO( chaknpop_get_tx_tile_info )
Initialize video hardware emulation
***************************************************************************/
+static STATE_POSTLOAD( chaknpop_postload )
+{
+ set_vram_bank();
+ tx_tilemap_mark_all_dirty();
+}
+
+
VIDEO_START( chaknpop )
{
UINT8 *RAM = memory_region(REGION_CPU1);
@@ -194,8 +201,7 @@ VIDEO_START( chaknpop )
state_save_register_global(flip_x);
state_save_register_global(flip_y);
- state_save_register_func_postload(set_vram_bank);
- state_save_register_func_postload(tx_tilemap_mark_all_dirty);
+ state_save_register_postload(machine, chaknpop_postload, NULL);
}
diff --git a/src/mame/video/cloak.c b/src/mame/video/cloak.c
index df31a30381e..8f793af999c 100644
--- a/src/mame/video/cloak.c
+++ b/src/mame/video/cloak.c
@@ -165,6 +165,11 @@ static TILE_GET_INFO( get_bg_tile_info )
SET_TILE_INFO(0, code, 0, 0);
}
+static STATE_POSTLOAD( cloak_postload )
+{
+ set_current_bitmap_videoram_pointer();
+}
+
VIDEO_START( cloak )
{
bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
@@ -181,7 +186,7 @@ VIDEO_START( cloak )
state_save_register_global_pointer(bitmap_videoram1, 256*256);
state_save_register_global_pointer(bitmap_videoram2, 256*256);
state_save_register_global_pointer(palette_ram, NUM_PENS);
- state_save_register_func_postload(set_current_bitmap_videoram_pointer);
+ state_save_register_postload(machine, cloak_postload, NULL);
}
static void draw_bitmap(bitmap_t *bitmap, const rectangle *cliprect)
diff --git a/src/mame/video/darius.c b/src/mame/video/darius.c
index 7c8f4389ef6..1188a5e0507 100644
--- a/src/mame/video/darius.c
+++ b/src/mame/video/darius.c
@@ -36,11 +36,6 @@ static TILE_GET_INFO( get_fg_tile_info )
actual_get_fg_tile_info(machine, tileinfo, tile_index, darius_fg_ram, 2);
}
-static void dirty_fg_tilemap(void)
-{
- tilemap_mark_all_tiles_dirty(fg_tilemap);
-}
-
/***************************************************************************/
VIDEO_START( darius )
@@ -50,12 +45,9 @@ VIDEO_START( darius )
spritelist = auto_malloc(0x800 * sizeof(*spritelist));
/* (chips, gfxnum, x_offs, y_offs, y_invert, opaque, dblwidth) */
- PC080SN_vh_start(1,1,-16,8,0,1,1);
+ PC080SN_vh_start(machine,1,1,-16,8,0,1,1);
tilemap_set_transparent_pen(fg_tilemap,0);
-
- /* colors from saved states are often screwy (and this doesn't help...) */
- state_save_register_func_postload(dirty_fg_tilemap);
}
/***************************************************************************/
diff --git a/src/mame/video/dbz.c b/src/mame/video/dbz.c
index c3280386ec7..cbf09fe5ca6 100644
--- a/src/mame/video/dbz.c
+++ b/src/mame/video/dbz.c
@@ -93,7 +93,7 @@ static void sortlayers(int *layer, int *pri)
VIDEO_START( dbz )
{
- K053251_vh_start();
+ K053251_vh_start(machine);
K056832_vh_start(machine, REGION_GFX1, K056832_BPP_4, 1, NULL, dbz_tile_callback, 1);
K053247_vh_start(machine, REGION_GFX2, -52, 16, NORMAL_PLANE_ORDER, dbz_sprite_callback);
diff --git a/src/mame/video/gijoe.c b/src/mame/video/gijoe.c
index 9f23f6a0894..7e521cd4a4c 100644
--- a/src/mame/video/gijoe.c
+++ b/src/mame/video/gijoe.c
@@ -41,7 +41,7 @@ VIDEO_START( gijoe )
{
int i;
- K053251_vh_start();
+ K053251_vh_start(machine);
K056832_vh_start(machine, REGION_GFX1, K056832_BPP_4, 1, NULL, gijoe_tile_callback, 0);
K056832_linemap_enable(1);
diff --git a/src/mame/video/gtia.c b/src/mame/video/gtia.c
index ae3409f62b4..162e0662b37 100644
--- a/src/mame/video/gtia.c
+++ b/src/mame/video/gtia.c
@@ -29,8 +29,8 @@ gtia_struct gtia;
#define VERBOSE 0
static void gtia_reset(running_machine *machine);
-static void gtia_state(void);
-static void gtia_state_postload(void);
+static void gtia_state(running_machine *machine);
+static STATE_POSTLOAD( gtia_state_postload );
/**********************************************
* split a color into hue and luminance values
@@ -64,7 +64,7 @@ static void gtia_state_postload(void);
*
*************************************/
-void gtia_init(const gtia_interface *intf)
+void gtia_init(running_machine *machine, const gtia_interface *intf)
{
memset(&gtia, 0, sizeof(gtia));
gtia.intf = *intf;
@@ -72,12 +72,12 @@ void gtia_init(const gtia_interface *intf)
add_reset_callback(Machine, gtia_reset);
/* state saves */
- gtia_state();
+ gtia_state(machine);
}
-static void gtia_state(void)
+static void gtia_state(running_machine *machine)
{
state_save_register_global(gtia.r.m0pf);
state_save_register_global(gtia.r.m1pf);
@@ -140,7 +140,7 @@ static void gtia_state(void)
state_save_register_global(gtia.w.gractl);
state_save_register_global(gtia.w.hitclr);
state_save_register_global(gtia.w.cons);
- state_save_register_func_postload(gtia_state_postload);
+ state_save_register_postload(machine, gtia_state_postload, NULL);
}
@@ -758,7 +758,7 @@ WRITE8_HANDLER( atari_gtia_w )
-static void gtia_state_postload(void)
+static STATE_POSTLOAD( gtia_state_postload )
{
recalc_p0();
recalc_p1();
diff --git a/src/mame/video/gtia.h b/src/mame/video/gtia.h
index 8b4b58611b5..cfc80be7e7e 100644
--- a/src/mame/video/gtia.h
+++ b/src/mame/video/gtia.h
@@ -138,7 +138,7 @@ struct _gtia_struct
extern gtia_struct gtia;
-void gtia_init(const gtia_interface *intf);
+void gtia_init(running_machine *machine, const gtia_interface *intf);
READ8_HANDLER( atari_gtia_r );
WRITE8_HANDLER( atari_gtia_w );
diff --git a/src/mame/video/jaguar.c b/src/mame/video/jaguar.c
index e8927e84ce6..7ab9166d1ee 100644
--- a/src/mame/video/jaguar.c
+++ b/src/mame/video/jaguar.c
@@ -802,6 +802,10 @@ static TIMER_CALLBACK( cojag_scanline_update )
} while (!adjust_object_timer(machine, vc));
}
+static STATE_POSTLOAD( cojag_postload )
+{
+ update_cpu_irq();
+}
VIDEO_START( cojag )
{
@@ -818,7 +822,7 @@ VIDEO_START( cojag )
state_save_register_global_array(blitter_regs);
state_save_register_global_array(gpu_regs);
state_save_register_global(cpu_irq_state);
- state_save_register_func_postload(update_cpu_irq);
+ state_save_register_postload(machine, cojag_postload, NULL);
}
diff --git a/src/mame/video/konamiic.c b/src/mame/video/konamiic.c
index 8adf641f09f..85999d0dbc8 100644
--- a/src/mame/video/konamiic.c
+++ b/src/mame/video/konamiic.c
@@ -1969,7 +1969,7 @@ static TILE_GET_INFO( K052109_get_tile_info1 ) { K052109_get_tile_info(machine,t
static TILE_GET_INFO( K052109_get_tile_info2 ) { K052109_get_tile_info(machine,tileinfo,tile_index,2,K052109_colorram_B,K052109_videoram_B,K052109_videoram2_B); }
-static void K052109_tileflip_reset(void)
+static STATE_POSTLOAD( K052109_tileflip_reset )
{
int data = K052109_ram[0x1e80];
tilemap_set_flip(K052109_tilemap[0],(data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
@@ -2079,7 +2079,7 @@ void K052109_vh_start(running_machine *machine,int gfx_memory_region,int plane_o
state_save_register_global_array(K052109_dy);
state_save_register_global(has_extra_video_ram);
- state_save_register_func_postload(K052109_tileflip_reset);
+ state_save_register_postload(machine, K052109_tileflip_reset, NULL);
}
READ8_HANDLER( K052109_r )
@@ -5077,7 +5077,7 @@ static int K053251_palette_index[5];
static tilemap *K053251_tilemaps[5];
static int K053251_tilemaps_set;
-static void K053251_reset_indexes(void)
+static STATE_POSTLOAD( K053251_reset_indexes )
{
K053251_palette_index[0] = 32 * ((K053251_ram[9] >> 0) & 0x03);
K053251_palette_index[1] = 32 * ((K053251_ram[9] >> 2) & 0x03);
@@ -5086,12 +5086,12 @@ static void K053251_reset_indexes(void)
K053251_palette_index[4] = 16 * ((K053251_ram[10] >> 3) & 0x07);
}
-void K053251_vh_start(void)
+void K053251_vh_start(running_machine *machine)
{
K053251_set_tilemaps(NULL,NULL,NULL,NULL,NULL);
state_save_register_global_array(K053251_ram);
- state_save_register_func_postload(K053251_reset_indexes);
+ state_save_register_postload(machine, K053251_reset_indexes, NULL);
}
void K053251_set_tilemaps(tilemap *ci0,tilemap *ci1,tilemap *ci2,tilemap *ci3,tilemap *ci4)
@@ -5615,6 +5615,13 @@ void K056832_set_tile_bank(int bank)
K056832_change_rombank();
}
+static STATE_POSTLOAD( K056832_postload )
+{
+ K056832_UpdatePageLayout();
+ K056832_change_rambank();
+ K056832_change_rombank();
+}
+
void K056832_vh_start(running_machine *machine, int gfx_memory_region, int bpp, int big,
int (*scrolld)[4][2],
void (*callback)(int layer, int *code, int *color, int *flags),
@@ -5825,9 +5832,7 @@ void K056832_vh_start(running_machine *machine, int gfx_memory_region, int bpp,
state_save_register_global_array(K056832_dy);
state_save_register_global_array(K056832_LayerTileMode);
- state_save_register_func_postload(K056832_UpdatePageLayout);
- state_save_register_func_postload(K056832_change_rambank);
- state_save_register_func_postload(K056832_change_rombank);
+ state_save_register_postload(machine, K056832_postload, NULL);
}
/* call if a game uses external linescroll */
diff --git a/src/mame/video/konamiic.h b/src/mame/video/konamiic.h
index f0b24ebd0ad..19b9fa76539 100644
--- a/src/mame/video/konamiic.h
+++ b/src/mame/video/konamiic.h
@@ -241,7 +241,7 @@ enum { K053251_CI0=0,K053251_CI1,K053251_CI2,K053251_CI3,K053251_CI4 };
int K053251_get_priority(int ci);
int K053251_get_palette_index(int ci);
void K053251_set_tilemaps(tilemap *ci0,tilemap *ci1,tilemap *ci2,tilemap *ci3,tilemap *ci4);
-void K053251_vh_start(void);
+void K053251_vh_start(running_machine *machine);
WRITE8_HANDLER( K054000_w );
diff --git a/src/mame/video/lethal.c b/src/mame/video/lethal.c
index 6f72a0c6d9e..d06627f8d71 100644
--- a/src/mame/video/lethal.c
+++ b/src/mame/video/lethal.c
@@ -49,7 +49,7 @@ VIDEO_START(lethalen)
{
int i;
- K053251_vh_start();
+ K053251_vh_start(machine);
K056832_vh_start(machine, REGION_GFX1, K056832_BPP_8LE, 1, NULL, lethalen_tile_callback, 0);
diff --git a/src/mame/video/moo.c b/src/mame/video/moo.c
index 0120ffef146..70027c15080 100644
--- a/src/mame/video/moo.c
+++ b/src/mame/video/moo.c
@@ -47,7 +47,7 @@ VIDEO_START(moo)
alpha_enabled = 0;
- K053251_vh_start();
+ K053251_vh_start(machine);
K054338_vh_start();
K056832_vh_start(machine, REGION_GFX1, K056832_BPP_4, 1, NULL, moo_tile_callback, 0);
diff --git a/src/mame/video/neogeo.c b/src/mame/video/neogeo.c
index 6415dc26126..b99267313a9 100644
--- a/src/mame/video/neogeo.c
+++ b/src/mame/video/neogeo.c
@@ -168,7 +168,7 @@ static pen_t get_pen(UINT16 data)
}
-static void regenerate_pens(void)
+static STATE_POSTLOAD( regenerate_pens )
{
int i;
@@ -177,24 +177,24 @@ static void regenerate_pens(void)
}
-void neogeo_set_palette_bank(UINT8 data)
+void neogeo_set_palette_bank(running_machine *machine, UINT8 data)
{
if (data != palette_bank)
{
palette_bank = data;
- regenerate_pens();
+ regenerate_pens(machine, NULL);
}
}
-void neogeo_set_screen_dark(UINT8 data)
+void neogeo_set_screen_dark(running_machine *machine, UINT8 data)
{
if (data != screen_dark)
{
screen_dark = data;
- regenerate_pens();
+ regenerate_pens(machine, NULL);
}
}
@@ -899,7 +899,7 @@ VIDEO_START( neogeo )
state_save_register_global(auto_animation_counter);
state_save_register_global(auto_animation_frame_counter);
- state_save_register_func_postload(regenerate_pens);
+ state_save_register_postload(machine, regenerate_pens, NULL);
}
diff --git a/src/mame/video/ninjaw.c b/src/mame/video/ninjaw.c
index 79acf57beaa..b1303c87233 100644
--- a/src/mame/video/ninjaw.c
+++ b/src/mame/video/ninjaw.c
@@ -33,13 +33,13 @@ static VIDEO_START( ninjaw_core )
TC0100SCN_vh_start(machine,chips,TC0100SCN_GFX_NUM,taito_hide_pixels,0,0,0,0,0,2);
if (has_TC0110PCR())
- TC0110PCR_vh_start();
+ TC0110PCR_vh_start(machine);
if (has_second_TC0110PCR())
- TC0110PCR_1_vh_start();
+ TC0110PCR_1_vh_start(machine);
if (has_third_TC0110PCR())
- TC0110PCR_2_vh_start();
+ TC0110PCR_2_vh_start(machine);
/* Ensure palette from correct TC0110PCR used for each screen */
TC0100SCN_set_chip_colbanks(0x0,0x100,0x200);
diff --git a/src/mame/video/othunder.c b/src/mame/video/othunder.c
index 8b495660815..85f8c1f6b3a 100644
--- a/src/mame/video/othunder.c
+++ b/src/mame/video/othunder.c
@@ -29,7 +29,7 @@ VIDEO_START( othunder )
TC0100SCN_vh_start(machine,1,TC0100SCN_GFX_NUM,4,0,0,0,0,0,0);
if (has_TC0110PCR())
- TC0110PCR_vh_start();
+ TC0110PCR_vh_start(machine);
}
diff --git a/src/mame/video/overdriv.c b/src/mame/video/overdriv.c
index 635656909bc..dd43bf31734 100644
--- a/src/mame/video/overdriv.c
+++ b/src/mame/video/overdriv.c
@@ -51,7 +51,7 @@ static void zoom_callback_1(int *code,int *color,int *flags)
VIDEO_START( overdriv )
{
- K053251_vh_start();
+ K053251_vh_start(machine);
K051316_vh_start_0(machine,REGION_GFX2,4,TRUE,0,zoom_callback_0);
K051316_vh_start_1(machine,REGION_GFX3,4,FALSE,0,zoom_callback_1);
K053247_vh_start(machine, REGION_GFX1,77,22,NORMAL_PLANE_ORDER,overdriv_sprite_callback);
diff --git a/src/mame/video/parodius.c b/src/mame/video/parodius.c
index 13534e5d3fb..f19024b72b6 100644
--- a/src/mame/video/parodius.c
+++ b/src/mame/video/parodius.c
@@ -44,7 +44,7 @@ static void sprite_callback(int *code,int *color,int *priority_mask)
VIDEO_START( parodius )
{
- K053251_vh_start();
+ K053251_vh_start(machine);
K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,tile_callback);
K053245_vh_start(machine,0,REGION_GFX2,NORMAL_PLANE_ORDER,sprite_callback);
}
diff --git a/src/mame/video/psx.c b/src/mame/video/psx.c
index d2705de0209..ffda8cc2dc1 100644
--- a/src/mame/video/psx.c
+++ b/src/mame/video/psx.c
@@ -547,7 +547,7 @@ static int DebugTextureDisplay( bitmap_t *bitmap )
#endif
-static void updatevisiblearea( void )
+static STATE_POSTLOAD( updatevisiblearea )
{
rectangle visarea;
float refresh;
@@ -617,7 +617,7 @@ static void updatevisiblearea( void )
video_screen_configure(Machine->primary_screen, m_n_screenwidth, m_n_screenheight, &visarea, HZ_TO_ATTOSECONDS(refresh));
}
-static void psx_gpu_init( void )
+static void psx_gpu_init( running_machine *machine )
{
int n_line;
int n_level;
@@ -772,19 +772,19 @@ static void psx_gpu_init( void )
state_save_register_global( psxgpu.n_iy );
state_save_register_global( psxgpu.n_ti );
- state_save_register_func_postload( updatevisiblearea );
+ state_save_register_postload( machine, updatevisiblearea, NULL );
}
VIDEO_START( psx_type1 )
{
m_n_gputype = 1;
- psx_gpu_init();
+ psx_gpu_init(machine);
}
VIDEO_START( psx_type2 )
{
m_n_gputype = 2;
- psx_gpu_init();
+ psx_gpu_init(machine);
}
VIDEO_UPDATE( psx )
@@ -3694,7 +3694,7 @@ WRITE32_HANDLER( psx_gpu_w )
m_n_twy = 0;
m_n_twh = 255;
m_n_tww = 255;
- updatevisiblearea();
+ updatevisiblearea(machine, NULL);
break;
case 0x01:
verboselog( 1, "not handled: reset command buffer\n" );
@@ -3748,7 +3748,7 @@ WRITE32_HANDLER( psx_gpu_w )
{
m_b_reverseflag = ( data >> 7 ) & 1;
}
- updatevisiblearea();
+ updatevisiblearea(machine, NULL);
break;
case 0x09:
verboselog( 1, "not handled: GPU Control 0x09: %08x\n", data );
diff --git a/src/mame/video/rastan.c b/src/mame/video/rastan.c
index 00ae6eb39b6..f4fa1cd9953 100644
--- a/src/mame/video/rastan.c
+++ b/src/mame/video/rastan.c
@@ -20,26 +20,26 @@ static UINT16 sprites_flipscreen = 0;
VIDEO_START( rastan )
{
/* (chips, gfxnum, x_offs, y_offs, y_invert, opaque, dblwidth) */
- PC080SN_vh_start(1,0,0,0,0,0,0);
+ PC080SN_vh_start(machine,1,0,0,0,0,0,0);
PC090OJ_vh_start(1,0,0,0);
}
VIDEO_START( opwolf )
{
- PC080SN_vh_start(1,1,0,0,0,0,0);
+ PC080SN_vh_start(machine,1,1,0,0,0,0,0);
PC090OJ_vh_start(0,0,0,0);
}
VIDEO_START( rainbow )
{
/* (chips, gfxnum, x_offs, y_offs, y_invert, opaque, dblwidth) */
- PC080SN_vh_start(1,1,0,0,0,0,0);
+ PC080SN_vh_start(machine,1,1,0,0,0,0,0);
PC090OJ_vh_start(0,0,0,0);
}
VIDEO_START( jumping )
{
- PC080SN_vh_start(1,1,0,0,1,0,0);
+ PC080SN_vh_start(machine,1,1,0,0,1,0,0);
PC080SN_set_trans_pen(0,1,15);
diff --git a/src/mame/video/renegade.c b/src/mame/video/renegade.c
index be8a9166bc0..7ad7c98363d 100644
--- a/src/mame/video/renegade.c
+++ b/src/mame/video/renegade.c
@@ -62,12 +62,6 @@ static TILE_GET_INFO( get_fg_tilemap_info )
0);
}
-static void all_tiles_dirty(void)
-{
- tilemap_mark_all_tiles_dirty(bg_tilemap);
- tilemap_mark_all_tiles_dirty(fg_tilemap);
-}
-
VIDEO_START( renegade )
{
bg_tilemap = tilemap_create(get_bg_tilemap_info, tilemap_scan_rows, 16, 16, 64, 16);
@@ -77,7 +71,6 @@ VIDEO_START( renegade )
tilemap_set_scrolldx(bg_tilemap, 256, 0);
state_save_register_global(renegade_scrollx);
- state_save_register_func_postload(all_tiles_dirty);
}
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
diff --git a/src/mame/video/segaic24.c b/src/mame/video/segaic24.c
index bcd6bd44aa9..79a1d4e68f0 100644
--- a/src/mame/video/segaic24.c
+++ b/src/mame/video/segaic24.c
@@ -128,7 +128,7 @@ static TILE_GET_INFO( sys24_tile_info_1w )
SET_TILE_INFO(sys24_char_gfx_index, val & sys24_tile_mask, (val >> 7) & 0xff, 0);
}
-static void sys24_tile_dirtyall(void)
+static STATE_POSTLOAD( sys24_tile_dirtyall )
{
memset(sys24_char_dirtymap, 1, SYS24_TILES);
sys24_char_dirty = 1;
@@ -170,7 +170,7 @@ void sys24_tile_vh_start(running_machine *machine, UINT16 tile_mask)
state_save_register_global_pointer(sys24_tile_ram, 0x10000/2);
state_save_register_global_pointer(sys24_char_ram, 0x80000/2);
- state_save_register_func_postload(sys24_tile_dirtyall);
+ state_save_register_postload(machine, sys24_tile_dirtyall, NULL);
}
void sys24_tile_update(running_machine *machine)
diff --git a/src/mame/video/simpsons.c b/src/mame/video/simpsons.c
index 85f3eaa91a2..31dfa77c9bc 100644
--- a/src/mame/video/simpsons.c
+++ b/src/mame/video/simpsons.c
@@ -45,7 +45,7 @@ static void sprite_callback(int *code,int *color,int *priority_mask)
VIDEO_START( simpsons )
{
- K053251_vh_start();
+ K053251_vh_start(machine);
K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,tile_callback);
K053247_vh_start(machine,REGION_GFX2,53,23,NORMAL_PLANE_ORDER,sprite_callback);
diff --git a/src/mame/video/st0016.c b/src/mame/video/st0016.c
index cad78782eaa..50c57e2a6f2 100644
--- a/src/mame/video/st0016.c
+++ b/src/mame/video/st0016.c
@@ -418,7 +418,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
}
}
-static void st0016_postload(void)
+static STATE_POSTLOAD( st0016_postload )
{
int i;
st0016_rom_bank_w(Machine,0,st0016_rom_bank);
@@ -427,7 +427,7 @@ static void st0016_postload(void)
}
-void st0016_save_init(void)
+void st0016_save_init(running_machine *machine)
{
state_save_register_global(st0016_spr_bank);
state_save_register_global(st0016_spr2_bank);
@@ -438,7 +438,7 @@ void st0016_save_init(void)
state_save_register_global_pointer(st0016_charram, ST0016_MAX_CHAR_BANK*ST0016_CHAR_BANK_SIZE);
state_save_register_global_pointer(st0016_paletteram, ST0016_MAX_PAL_BANK*ST0016_PAL_BANK_SIZE);
state_save_register_global_pointer(st0016_spriteram, ST0016_MAX_SPR_BANK*ST0016_SPR_BANK_SIZE);
- state_save_register_func_postload(st0016_postload);
+ state_save_register_postload(machine, st0016_postload, NULL);
}
@@ -499,7 +499,7 @@ VIDEO_START( st0016 )
}
- st0016_save_init();
+ st0016_save_init(machine);
}
diff --git a/src/mame/video/stvvdp1.c b/src/mame/video/stvvdp1.c
index 9b2f6b05f64..cc9954897ac 100644
--- a/src/mame/video/stvvdp1.c
+++ b/src/mame/video/stvvdp1.c
@@ -2081,7 +2081,7 @@ void video_update_vdp1(running_machine *machine)
//popmessage("%04x %04x",STV_VDP1_EWRR_X3,STV_VDP1_EWRR_Y3);
}
-static void stv_vdp1_state_save_postload(void)
+static STATE_POSTLOAD( stv_vdp1_state_save_postload )
{
UINT8 *vdp1 = stv_vdp1_gfx_decode;
int offset;
@@ -2103,7 +2103,7 @@ static void stv_vdp1_state_save_postload(void)
}
}
-int stv_vdp1_start ( void )
+int stv_vdp1_start ( running_machine *machine )
{
stv_vdp1_regs = auto_malloc ( 0x040000 );
stv_vdp1_vram = auto_malloc ( 0x100000 );
@@ -2143,6 +2143,6 @@ int stv_vdp1_start ( void )
state_save_register_global(stv_vdp1_clear_framebuffer_on_next_frame);
state_save_register_global(stvvdp1_local_x);
state_save_register_global(stvvdp1_local_y);
- state_save_register_func_postload(stv_vdp1_state_save_postload);
+ state_save_register_postload(machine, stv_vdp1_state_save_postload, NULL);
return 0;
}
diff --git a/src/mame/video/stvvdp2.c b/src/mame/video/stvvdp2.c
index 54535ff202b..f4f9b1cbe5e 100644
--- a/src/mame/video/stvvdp2.c
+++ b/src/mame/video/stvvdp2.c
@@ -97,7 +97,7 @@ static int stv_vdp2_render_rbg0;
UINT32* stv_vdp2_cram;
void video_update_vdp1(running_machine *machine);
-int stv_vdp1_start ( void );
+int stv_vdp1_start (running_machine *machine);
static void stv_vdp2_dynamic_res_change(void);
static void refresh_palette_data(void);
static int stv_vdp2_window_process(int x,int y);
@@ -5238,7 +5238,7 @@ READ32_HANDLER ( stv_vdp2_regs_r )
return stv_vdp2_regs[offset];
}
-static void stv_vdp2_state_save_postload(void)
+static STATE_POSTLOAD( stv_vdp2_state_save_postload )
{
UINT8 *stv_vdp2_vram_decode = stv_vdp2_gfx_decode;
int offset;
@@ -5288,7 +5288,7 @@ static int stv_vdp2_start (running_machine *machine)
state_save_register_global_pointer(stv_vdp2_regs, 0x040000/4);
state_save_register_global_pointer(stv_vdp2_vram, 0x100000/4);
state_save_register_global_pointer(stv_vdp2_cram, 0x080000/4);
- state_save_register_func_postload(stv_vdp2_state_save_postload);
+ state_save_register_postload(machine, stv_vdp2_state_save_postload, NULL);
return 0;
}
@@ -5298,7 +5298,7 @@ VIDEO_START( stv_vdp2 )
{
stv_vdp2_roz_bitmap[0] = stv_vdp2_roz_bitmap[1] = NULL;
stv_vdp2_start(machine);
- stv_vdp1_start();
+ stv_vdp1_start(machine);
debug.l_en = 0xff;
debug.error = 0xffffffff;
debug.roz = 0;
diff --git a/src/mame/video/superqix.c b/src/mame/video/superqix.c
index 6bcef565a72..9613da3442c 100644
--- a/src/mame/video/superqix.c
+++ b/src/mame/video/superqix.c
@@ -64,11 +64,6 @@ VIDEO_START( pbillian )
state_save_register_global(pbillian_show_power);
}
-static void superqix_postload(void)
-{
- tilemap_mark_all_tiles_dirty(bg_tilemap);
-}
-
VIDEO_START( superqix )
{
fg_bitmap[0] = auto_bitmap_alloc(256, 256, video_screen_get_format(machine->primary_screen));
@@ -82,7 +77,6 @@ VIDEO_START( superqix )
state_save_register_global(show_bitmap);
state_save_register_global_bitmap(fg_bitmap[0]);
state_save_register_global_bitmap(fg_bitmap[1]);
- state_save_register_func_postload(superqix_postload);
}
diff --git a/src/mame/video/surpratk.c b/src/mame/video/surpratk.c
index 89c713dc72b..7f6c917d620 100644
--- a/src/mame/video/surpratk.c
+++ b/src/mame/video/surpratk.c
@@ -44,7 +44,7 @@ static void sprite_callback(int *code,int *color,int *priority_mask)
VIDEO_START( surpratk )
{
- K053251_vh_start();
+ K053251_vh_start(machine);
K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,tile_callback);
K053245_vh_start(machine,0,REGION_GFX2,NORMAL_PLANE_ORDER,sprite_callback);
diff --git a/src/mame/video/system1.c b/src/mame/video/system1.c
index d08d36088f9..932af66f409 100644
--- a/src/mame/video/system1.c
+++ b/src/mame/video/system1.c
@@ -108,7 +108,7 @@ WRITE8_HANDLER( system1_paletteram_w )
palette_set_color(Machine,offset,MAKE_RGB(r,g,b));
}
-static void system1_postload(void)
+static STATE_POSTLOAD( system1_postload )
{
memset(sprite_onscreen_map, 255, 256*256);
memset(bg_dirtybuffer, 1, 1024);
@@ -124,7 +124,7 @@ VIDEO_START( system1 )
tmp_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
- state_save_register_func_postload(system1_postload);
+ state_save_register_postload(machine, system1_postload, NULL);
state_save_register_global(system1_background_memory);
state_save_register_global(system1_video_mode);
@@ -145,7 +145,7 @@ VIDEO_START( wbml )
system1_sprite_xoffset = 1+7*2;
- state_save_register_func_postload(system1_postload);
+ state_save_register_postload(machine, system1_postload, NULL);
state_save_register_global(system1_background_memory);
state_save_register_global(system1_video_mode);
diff --git a/src/mame/video/taito_f2.c b/src/mame/video/taito_f2.c
index 1a9901c9339..1ac3bda226d 100644
--- a/src/mame/video/taito_f2.c
+++ b/src/mame/video/taito_f2.c
@@ -111,7 +111,7 @@ static void taitof2_core_vh_start (running_machine *machine, int sprite_type,int
}
if (has_TC0110PCR())
- TC0110PCR_vh_start();
+ TC0110PCR_vh_start(machine);
if (has_TC0280GRD())
TC0280GRD_vh_start(TC0280GRD_GFX_NUM);
diff --git a/src/mame/video/taito_z.c b/src/mame/video/taito_z.c
index 049207d5f8e..bec0fa8de8c 100644
--- a/src/mame/video/taito_z.c
+++ b/src/mame/video/taito_z.c
@@ -24,7 +24,7 @@ static void taitoz_core_vh_start(running_machine *machine, int x_offs)
TC0150ROD_vh_start();
if (has_TC0110PCR())
- TC0110PCR_vh_start();
+ TC0110PCR_vh_start(machine);
}
VIDEO_START( taitoz )
diff --git a/src/mame/video/taitoic.c b/src/mame/video/taitoic.c
index 803c9853478..4ee56cf6fb1 100644
--- a/src/mame/video/taitoic.c
+++ b/src/mame/video/taitoic.c
@@ -762,8 +762,9 @@ static const tile_get_info_func PC080SN_get_tile_info[PC080SN_MAX_CHIPS][2] =
{ PC080SN_get_bg_tile_info_1, PC080SN_get_fg_tile_info_1 }
};
-static void PC080SN_restore_scroll(int chip)
+static STATE_POSTLOAD( PC080SN_restore_scroll )
{
+ int chip = (FPTR)param;
int flip;
PC080SN_bgscrollx[chip][0] = -PC080SN_ctrl[chip][0];
@@ -779,7 +780,7 @@ static void PC080SN_restore_scroll(int chip)
/* opaque parameter is no longer supported and will be removed */
-void PC080SN_vh_start(int chips,int gfxnum,int x_offset,int y_offset,int y_invert,
+void PC080SN_vh_start(running_machine *machine,int chips,int gfxnum,int x_offset,int y_offset,int y_invert,
int opaque,int dblwidth)
{
int i;
@@ -817,7 +818,7 @@ void PC080SN_vh_start(int chips,int gfxnum,int x_offset,int y_offset,int y_inver
state_save_register_item_pointer("PC080SN", i, PC080SN_ram[i], PC080SN_RAM_SIZE/2);
state_save_register_item_array("PC080SN", i, PC080SN_ctrl[i]);
- state_save_register_func_postload_int(PC080SN_restore_scroll, i);
+ state_save_register_postload(machine, PC080SN_restore_scroll, (void *)i);
/* use the given gfx set for bg tiles */
PC080SN_bg_gfx[i] = gfxnum;
@@ -1233,8 +1234,6 @@ void PC090OJ_vh_start(int gfxnum,int x_offset,int y_offset,int use_buffer)
state_save_register_global_pointer(PC090OJ_ram, PC090OJ_RAM_SIZE/2);
state_save_register_global_pointer(PC090OJ_ram_buffered, PC090OJ_RAM_SIZE/2);
state_save_register_global(PC090OJ_ctrl);
-
-// state_save_register_func_postload(PC090OJ_restore);
}
READ16_HANDLER( PC090OJ_word_0_r ) // in case we find a game using 2...
@@ -1504,13 +1503,6 @@ static void TC0080VCO_dirty_chars(void)
TC0080VCO_chars_dirty = 1;
}
-static void TC0080VCO_dirty_tilemaps(void)
-{
- tilemap_mark_all_tiles_dirty(TC0080VCO_tilemap[0]);
- tilemap_mark_all_tiles_dirty(TC0080VCO_tilemap[1]);
- tilemap_mark_all_tiles_dirty(TC0080VCO_tilemap[2]);
-}
-
static void TC0080VCO_restore_scroll(void)
{
TC0080VCO_flipscreen = TC0080VCO_scroll_ram[0] & 0x0c00;
@@ -1526,6 +1518,13 @@ static void TC0080VCO_restore_scroll(void)
}
+static STATE_POSTLOAD( TC0080VCO_postload )
+{
+ TC0080VCO_set_layer_ptrs();
+ TC0080VCO_dirty_chars();
+ TC0080VCO_restore_scroll();
+}
+
void TC0080VCO_vh_start(running_machine *machine, int gfxnum,int has_fg0,int bg_xoffs,int bg_yoffs,int bg_flip_yoffs)
{
int gfx_index=0;
@@ -1555,7 +1554,6 @@ void TC0080VCO_vh_start(running_machine *machine, int gfxnum,int has_fg0,int bg_
state_save_register_global_pointer(TC0080VCO_ram, TC0080VCO_RAM_SIZE/2);
state_save_register_global(TC0080VCO_has_tx);
- state_save_register_func_postload(TC0080VCO_set_layer_ptrs);
/* Perform extra initialisations for text layer */
{
@@ -1563,7 +1561,6 @@ void TC0080VCO_vh_start(running_machine *machine, int gfxnum,int has_fg0,int bg_
TC0080VCO_char_dirty = auto_malloc(TC0080VCO_TOTAL_CHARS);
TC0080VCO_dirty_chars();
- state_save_register_func_postload(TC0080VCO_dirty_chars);
/* find first empty slot to decode gfx */
for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++)
@@ -1584,8 +1581,7 @@ void TC0080VCO_vh_start(running_machine *machine, int gfxnum,int has_fg0,int bg_
tilemap_set_transparent_pen( TC0080VCO_tilemap[2],0 );
}
- state_save_register_func_postload(TC0080VCO_dirty_tilemaps); // unnecessary ?
- state_save_register_func_postload(TC0080VCO_restore_scroll);
+ state_save_register_postload(machine, TC0080VCO_postload, NULL);
/* bg0 tilemap scrollable per pixel row */
tilemap_set_scroll_rows(TC0080VCO_tilemap[0],512);
@@ -2278,6 +2274,15 @@ static void TC0100SCN_restore_scroll(int chip)
}
+static STATE_POSTLOAD( TC0100SCN_postload )
+{
+ int chip = (FPTR)param;
+
+ TC0100SCN_set_layer_ptrs(chip);
+ TC0100SCN_dirty_chars(chip);
+ TC0100SCN_restore_scroll(chip);
+}
+
void TC0100SCN_vh_start(running_machine *machine, int chips,int gfxnum,int x_offset,int y_offset,int flip_xoffs,
int flip_yoffs,int flip_text_xoffs,int flip_text_yoffs,int multiscrn_xoffs)
{
@@ -2329,10 +2334,7 @@ void TC0100SCN_vh_start(running_machine *machine, int chips,int gfxnum,int x_off
state_save_register_item("TC0100SCN", i, TC0100SCN_dblwidth[i]);
}
- state_save_register_func_postload_int(TC0100SCN_set_layer_ptrs, i);
- state_save_register_func_postload_int(TC0100SCN_dirty_chars, i);
- state_save_register_func_postload_int(TC0100SCN_dirty_tilemaps, i); // unnecessary ?
- state_save_register_func_postload_int(TC0100SCN_restore_scroll, i);
+ state_save_register_postload(machine, TC0100SCN_postload, (void *)i);
/* find first empty slot to decode gfx */
for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++)
@@ -3157,6 +3159,13 @@ static void TC0480SCP_restore_scroll(void)
}
+static STATE_POSTLOAD( TC0480SCP_postload )
+{
+ TC0480SCP_set_layer_ptrs();
+ TC0480SCP_dirty_chars();
+ TC0480SCP_restore_scroll();
+}
+
void TC0480SCP_vh_start(running_machine *machine, int gfxnum,int pixels,int x_offset,int y_offset,int text_xoffs,
int text_yoffs,int flip_xoffs,int flip_yoffs,int col_base)
{
@@ -3194,10 +3203,7 @@ void TC0480SCP_vh_start(running_machine *machine, int gfxnum,int pixels,int x_of
state_save_register_global_pointer(TC0480SCP_ram, TC0480SCP_RAM_SIZE/2);
state_save_register_global_array(TC0480SCP_ctrl);
state_save_register_global(TC0480SCP_dblwidth);
- state_save_register_func_postload(TC0480SCP_set_layer_ptrs);
- state_save_register_func_postload(TC0480SCP_dirty_chars);
- state_save_register_func_postload(TC0480SCP_dirty_tilemaps); // unnecessary ?
- state_save_register_func_postload(TC0480SCP_restore_scroll);
+ state_save_register_postload(machine, TC0480SCP_postload, NULL);
/* find first empty slot to decode gfx */
for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++)
@@ -4689,8 +4695,9 @@ static UINT16 *TC0110PCR_ram[3];
#define TC0110PCR_RAM_SIZE 0x2000
-static void TC0110PCR_restore_colors(int chip)
+static STATE_POSTLOAD( TC0110PCR_restore_colors )
{
+ int chip = (FPTR)param;
int i,color,r=0,g=0,b=0;
for (i=0; i<(256*16); i++)
@@ -4730,30 +4737,30 @@ static void TC0110PCR_restore_colors(int chip)
}
-void TC0110PCR_vh_start(void)
+void TC0110PCR_vh_start(running_machine *machine)
{
TC0110PCR_ram[0] = auto_malloc(TC0110PCR_RAM_SIZE * sizeof(*TC0110PCR_ram[0]));
state_save_register_global_pointer(TC0110PCR_ram[0], TC0110PCR_RAM_SIZE);
- state_save_register_func_postload_int(TC0110PCR_restore_colors, 0);
+ state_save_register_postload(machine, TC0110PCR_restore_colors, (void *)0);
TC0110PCR_type = 0; /* default, xBBBBBGGGGGRRRRR */
}
-void TC0110PCR_1_vh_start(void)
+void TC0110PCR_1_vh_start(running_machine *machine)
{
TC0110PCR_ram[1] = auto_malloc(TC0110PCR_RAM_SIZE * sizeof(*TC0110PCR_ram[1]));
state_save_register_global_pointer(TC0110PCR_ram[1], TC0110PCR_RAM_SIZE);
- state_save_register_func_postload_int(TC0110PCR_restore_colors, 1);
+ state_save_register_postload(machine, TC0110PCR_restore_colors, (void *)1);
}
-void TC0110PCR_2_vh_start(void)
+void TC0110PCR_2_vh_start(running_machine *machine)
{
TC0110PCR_ram[2] = auto_malloc(TC0110PCR_RAM_SIZE * sizeof(*TC0110PCR_ram[2]));
state_save_register_global_pointer(TC0110PCR_ram[2], TC0110PCR_RAM_SIZE);
- state_save_register_func_postload_int(TC0110PCR_restore_colors, 2);
+ state_save_register_postload(machine, TC0110PCR_restore_colors, (void *)2);
}
READ16_HANDLER( TC0110PCR_word_r )
diff --git a/src/mame/video/taitoic.h b/src/mame/video/taitoic.h
index a14f271c6a8..e148264f521 100644
--- a/src/mame/video/taitoic.h
+++ b/src/mame/video/taitoic.h
@@ -17,7 +17,7 @@ int has_TC0480SCP(void);
/***************************************************************************/
-void PC080SN_vh_start(int chips,int gfxnum,int x_offset,int y_offset,int y_invert,int opaque,int dblwidth);
+void PC080SN_vh_start(running_machine *machine,int chips,int gfxnum,int x_offset,int y_offset,int y_invert,int opaque,int dblwidth);
READ16_HANDLER ( PC080SN_word_0_r );
WRITE16_HANDLER( PC080SN_word_0_w );
WRITE16_HANDLER( PC080SN_xscroll_word_0_w );
@@ -172,9 +172,9 @@ void TC0150ROD_draw(bitmap_t *bitmap,const rectangle *cliprect,int y_offs,int pa
/***************************************************************************/
-void TC0110PCR_vh_start(void);
-void TC0110PCR_1_vh_start(void); /* 2nd chip */
-void TC0110PCR_2_vh_start(void); /* 3rd chip */
+void TC0110PCR_vh_start(running_machine *machine);
+void TC0110PCR_1_vh_start(running_machine *machine); /* 2nd chip */
+void TC0110PCR_2_vh_start(running_machine *machine); /* 3rd chip */
READ16_HANDLER ( TC0110PCR_word_r );
READ16_HANDLER ( TC0110PCR_word_1_r ); /* 2nd chip */
READ16_HANDLER ( TC0110PCR_word_2_r ); /* 3rd chip */
diff --git a/src/mame/video/taitosj.c b/src/mame/video/taitosj.c
index b0d338fd94c..619bb8c5fe1 100644
--- a/src/mame/video/taitosj.c
+++ b/src/mame/video/taitosj.c
@@ -154,7 +154,7 @@ static void set_pens(running_machine *machine)
}
-static void taitosj_postload(void)
+static STATE_POSTLOAD( taitosj_postload )
{
memset(dirtycharacter1, 1, sizeof(dirtycharacter1));
memset(dirtycharacter2, 1, sizeof(dirtycharacter2));
@@ -221,7 +221,7 @@ VIDEO_START( taitosj )
compute_draw_order();
- state_save_register_func_postload(taitosj_postload);
+ state_save_register_postload(machine, taitosj_postload, NULL);
}
diff --git a/src/mame/video/tceptor.c b/src/mame/video/tceptor.c
index 953dce73278..191a6ee12e5 100644
--- a/src/mame/video/tceptor.c
+++ b/src/mame/video/tceptor.c
@@ -395,13 +395,6 @@ static void decode_sprite32(running_machine *machine, int region)
free(dst);
}
-static void mark_all_tiles_dirty(void)
-{
- tilemap_mark_all_tiles_dirty(tx_tilemap);
- tilemap_mark_all_tiles_dirty(bg1_tilemap);
- tilemap_mark_all_tiles_dirty(bg2_tilemap);
-}
-
VIDEO_START( tceptor )
{
int gfx_index;
@@ -445,8 +438,6 @@ VIDEO_START( tceptor )
state_save_register_global(bg1_scroll_y);
state_save_register_global(bg2_scroll_x);
state_save_register_global(bg2_scroll_y);
-
- state_save_register_func_postload(mark_all_tiles_dirty);
}
diff --git a/src/mame/video/tmnt.c b/src/mame/video/tmnt.c
index 3a0cd338648..892ae79daa5 100644
--- a/src/mame/video/tmnt.c
+++ b/src/mame/video/tmnt.c
@@ -239,14 +239,14 @@ VIDEO_START( tmnt )
VIDEO_START( punkshot )
{
- K053251_vh_start();
+ K053251_vh_start(machine);
K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,tmnt_tile_callback);
K051960_vh_start(machine,REGION_GFX2,NORMAL_PLANE_ORDER,punkshot_sprite_callback);
}
VIDEO_START( lgtnfght ) /* also tmnt2, ssriders */
{
- K053251_vh_start();
+ K053251_vh_start(machine);
K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,tmnt_tile_callback);
K053245_vh_start(machine,0, REGION_GFX2,NORMAL_PLANE_ORDER,lgtnfght_sprite_callback);
@@ -262,21 +262,21 @@ VIDEO_START( lgtnfght ) /* also tmnt2, ssriders */
VIDEO_START( sunsetbl )
{
- K053251_vh_start();
+ K053251_vh_start(machine);
K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,ssbl_tile_callback);
K053245_vh_start(machine,0, REGION_GFX2,NORMAL_PLANE_ORDER,lgtnfght_sprite_callback);
}
VIDEO_START( blswhstl )
{
- K053251_vh_start();
+ K053251_vh_start(machine);
K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,blswhstl_tile_callback);
K053245_vh_start(machine,0, REGION_GFX2,NORMAL_PLANE_ORDER,blswhstl_sprite_callback);
}
VIDEO_START( glfgreat )
{
- K053251_vh_start();
+ K053251_vh_start(machine);
K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,tmnt_tile_callback);
K053245_vh_start(machine,0, REGION_GFX2,NORMAL_PLANE_ORDER,lgtnfght_sprite_callback);
@@ -290,14 +290,14 @@ VIDEO_START( glfgreat )
VIDEO_START( thndrx2 )
{
- K053251_vh_start();
+ K053251_vh_start(machine);
K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,tmnt_tile_callback);
K051960_vh_start(machine,REGION_GFX2,NORMAL_PLANE_ORDER,thndrx2_sprite_callback);
}
VIDEO_START( prmrsocr )
{
- K053251_vh_start();
+ K053251_vh_start(machine);
K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,tmnt_tile_callback);
K053245_vh_start(machine,0, REGION_GFX2,NORMAL_PLANE_ORDER,prmrsocr_sprite_callback);
diff --git a/src/mame/video/toaplan1.c b/src/mame/video/toaplan1.c
index 26bba39debb..edd95ea39e2 100644
--- a/src/mame/video/toaplan1.c
+++ b/src/mame/video/toaplan1.c
@@ -317,12 +317,12 @@ static void toaplan1_set_scrolls(void)
tilemap_set_scrolly(pf4_tilemap,0,(pf4_scrolly >> 7) - (tiles_offsety - scrolly_offs));
}
-static void rallybik_flipscreen(void)
+static STATE_POSTLOAD( rallybik_flipscreen )
{
rallybik_bcu_flipscreen_w(Machine, 0, bcu_flipscreen, 0);
}
-static void toaplan1_flipscreen(void)
+static STATE_POSTLOAD( toaplan1_flipscreen )
{
toaplan1_bcu_flipscreen_w(Machine, 0, bcu_flipscreen, 0);
}
@@ -368,7 +368,7 @@ VIDEO_START( rallybik )
state_save_register_global(pf_voffs);
state_save_register_global(spriteram_offs);
- state_save_register_func_postload(rallybik_flipscreen);
+ state_save_register_postload(machine, rallybik_flipscreen, NULL);
}
VIDEO_START( toaplan1 )
@@ -418,7 +418,7 @@ VIDEO_START( toaplan1 )
state_save_register_global(pf_voffs);
state_save_register_global(spriteram_offs);
- state_save_register_func_postload(toaplan1_flipscreen);
+ state_save_register_postload(machine, toaplan1_flipscreen, NULL);
}
diff --git a/src/mame/video/topspeed.c b/src/mame/video/topspeed.c
index b50aaa6bc69..035bd78a6b5 100644
--- a/src/mame/video/topspeed.c
+++ b/src/mame/video/topspeed.c
@@ -9,7 +9,7 @@ UINT16 *topspeed_raster_ctrl;
VIDEO_START( topspeed )
{
/* (chips, gfxnum, x_offs, y_offs, y_invert, opaque, dblwidth) */
- PC080SN_vh_start(2,1,0,8,0,0,0);
+ PC080SN_vh_start(machine,2,1,0,8,0,0,0);
}
diff --git a/src/mame/video/twincobr.c b/src/mame/video/twincobr.c
index 7d5d0cc276f..f231d172ac8 100644
--- a/src/mame/video/twincobr.c
+++ b/src/mame/video/twincobr.c
@@ -19,7 +19,7 @@
void twincobr_flipscreen(int flip);
void twincobr_display(int enable);
-static void twincobr_restore_screen(void);
+static STATE_POSTLOAD( twincobr_restore_screen );
INT32 twincobr_fg_rom_bank;
INT32 twincobr_bg_ram_bank;
@@ -151,10 +151,10 @@ VIDEO_START( toaplan0 )
state_save_register_global(twincobr_bg_ram_bank);
state_save_register_global(twincobr_flip_screen);
state_save_register_global(wardner_sprite_hack);
- state_save_register_func_postload(twincobr_restore_screen);
+ state_save_register_postload(machine, twincobr_restore_screen, NULL);
}
-static void twincobr_restore_screen(void)
+static STATE_POSTLOAD( twincobr_restore_screen )
{
twincobr_display(twincobr_display_on);
twincobr_flipscreen(twincobr_flip_screen);
diff --git a/src/mame/video/vendetta.c b/src/mame/video/vendetta.c
index 1bd7bbe3fab..650179106de 100644
--- a/src/mame/video/vendetta.c
+++ b/src/mame/video/vendetta.c
@@ -54,7 +54,7 @@ static void sprite_callback(int *code,int *color,int *priority_mask)
VIDEO_START( vendetta )
{
- K053251_vh_start();
+ K053251_vh_start(machine);
K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,vendetta_tile_callback);
K053247_vh_start(machine,REGION_GFX2,53,6,NORMAL_PLANE_ORDER,sprite_callback);
@@ -62,7 +62,7 @@ VIDEO_START( vendetta )
VIDEO_START( esckids )
{
- K053251_vh_start();
+ K053251_vh_start(machine);
K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,esckids_tile_callback);
K053247_vh_start(machine,REGION_GFX2,101,6,NORMAL_PLANE_ORDER,sprite_callback);
diff --git a/src/mame/video/warriorb.c b/src/mame/video/warriorb.c
index ae3573fc429..2de6d413f8c 100644
--- a/src/mame/video/warriorb.c
+++ b/src/mame/video/warriorb.c
@@ -16,10 +16,10 @@ static void warriorb_core_vh_start(running_machine *machine, int x_offs,int mult
TC0100SCN_vh_start(machine,chips,TC0100SCN_GFX_NUM,x_offs,0,0,0,0,0,multiscrn_xoffs);
if (has_TC0110PCR())
- TC0110PCR_vh_start();
+ TC0110PCR_vh_start(machine);
if (has_second_TC0110PCR())
- TC0110PCR_1_vh_start();
+ TC0110PCR_1_vh_start(machine);
/* Ensure palette from correct TC0110PCR used for each screen */
TC0100SCN_set_chip_colbanks(0,0x100,0x0);
diff --git a/src/mame/video/wgp.c b/src/mame/video/wgp.c
index 05a91818840..efec69a5054 100644
--- a/src/mame/video/wgp.c
+++ b/src/mame/video/wgp.c
@@ -46,13 +46,6 @@ static TILE_GET_INFO( get_piv2_tile_info )
common_get_piv_tile_info(machine,tileinfo,tile_index,2);
}
-static void dirty_piv_tilemaps(void)
-{
- tilemap_mark_all_tiles_dirty(wgp_piv_tilemap[0]);
- tilemap_mark_all_tiles_dirty(wgp_piv_tilemap[1]);
- tilemap_mark_all_tiles_dirty(wgp_piv_tilemap[2]);
-}
-
static void wgp_core_vh_start(running_machine *machine, int x_offs,int y_offs,int piv_xoffs,int piv_yoffs)
{
@@ -63,7 +56,7 @@ static void wgp_core_vh_start(running_machine *machine, int x_offs,int y_offs,in
TC0100SCN_vh_start(machine,1,TC0100SCN_GFX_NUM,x_offs,y_offs,0,0,0,0,0);
if (has_TC0110PCR())
- TC0110PCR_vh_start();
+ TC0110PCR_vh_start(machine);
wgp_piv_xoffs = piv_xoffs;
wgp_piv_yoffs = piv_yoffs;
@@ -84,9 +77,6 @@ static void wgp_core_vh_start(running_machine *machine, int x_offs,int y_offs,in
applies rowscroll manually */
TC0100SCN_set_colbanks(0x80,0xc0,0x40);
-
- /* colors from saved states are often screwy (and this doesn't help...) */
- state_save_register_func_postload(dirty_piv_tilemaps);
}
VIDEO_START( wgp )
diff --git a/src/mame/video/xexex.c b/src/mame/video/xexex.c
index b6ad569560e..15458c227ed 100644
--- a/src/mame/video/xexex.c
+++ b/src/mame/video/xexex.c
@@ -40,7 +40,7 @@ VIDEO_START( xexex )
cur_alpha = 0;
- K053251_vh_start();
+ K053251_vh_start(machine);
K054338_vh_start();
K053250_vh_start(1, &region);
diff --git a/src/mame/video/xmen.c b/src/mame/video/xmen.c
index eb1a1646424..ebdb931872a 100644
--- a/src/mame/video/xmen.c
+++ b/src/mame/video/xmen.c
@@ -48,7 +48,7 @@ static void xmen_sprite_callback(int *code,int *color,int *priority_mask)
VIDEO_START( xmen )
{
- K053251_vh_start();
+ K053251_vh_start(machine);
K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,xmen_tile_callback);
K053247_vh_start(machine,REGION_GFX2,53,-2,NORMAL_PLANE_ORDER,xmen_sprite_callback);
@@ -60,7 +60,7 @@ static UINT16 *K053247_ram;
VIDEO_START( xmen6p )
{
- K053251_vh_start();
+ K053251_vh_start(machine);
K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,xmen_tile_callback);
K053247_vh_start(machine,REGION_GFX2,53,-2,NORMAL_PLANE_ORDER,xmen_sprite_callback);
diff --git a/src/mame/video/ygv608.c b/src/mame/video/ygv608.c
index d2d9bc3de11..e7fcfdd7a58 100644
--- a/src/mame/video/ygv608.c
+++ b/src/mame/video/ygv608.c
@@ -474,7 +474,7 @@ static TILE_GET_INFO( get_tile_info_B_16 )
}
}
-static void ygv608_postload(void)
+static STATE_POSTLOAD( ygv608_postload )
{
int i;
@@ -485,7 +485,7 @@ static void ygv608_postload(void)
SetPostShortcuts(i);
}
-static void ygv608_register_state_save(void)
+static void ygv608_register_state_save(running_machine *machine)
{
state_save_register_item_array("ygv608", 0, ygv608.ports.b);
state_save_register_item_array("ygv608", 0, ygv608.regs.b);
@@ -494,7 +494,7 @@ static void ygv608_register_state_save(void)
state_save_register_item_2d_array("ygv608", 0, ygv608.scroll_data_table);
state_save_register_item_2d_array("ygv608", 0, ygv608.colour_palette);
- state_save_register_func_postload(ygv608_postload);
+ state_save_register_postload(machine, ygv608_postload, NULL);
}
static void ygv608_exit(running_machine *machine)
@@ -534,7 +534,7 @@ VIDEO_START( ygv608 )
tilemap_A = NULL;
tilemap_B = NULL;
- ygv608_register_state_save();
+ ygv608_register_state_save(machine);
add_exit_callback(machine, ygv608_exit);
}