Reduced the number of save state callback types from 3 to 1. The

only remaining form is the one that takes a pointer parameter.

Added macros for STATE_PRESAVE and STATE_POSTLOAD to define common
functions. Added machine parameter to these functions.

Updated all drivers and CPU/sound cores  to use the new macros 
and consolidate on the single function type. As a result pushed
the machine parameter through a few initialization stacks.

Removed unnecessary postload callbacks which only marked all tiles
dirty, since this is done automatically by the tilemap engine.
This commit is contained in:
Aaron Giles 2008-04-11 05:41:46 +00:00
parent 6331c8d699
commit dbb98c5473
132 changed files with 598 additions and 565 deletions

View File

@ -316,7 +316,7 @@ static void h8_setreg32(UINT8 reg, UINT32 data)
h8.regs[reg] = data; h8.regs[reg] = data;
} }
static void h8_onstateload(void) static STATE_POSTLOAD( h8_onstateload )
{ {
h8_set_ccr(h8.ccr); 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.h8TCNT3);
state_save_register_item("H8/3002", index, h8.h8TCNT4); 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(); h8_itu_init();
} }

View File

@ -387,7 +387,7 @@ INLINE void WM32( UINT32 mAddr, PAIR *p )
WM( (mAddr+3)&0xffff, p->b.l ); WM( (mAddr+3)&0xffff, p->b.l );
} }
static void UpdateState( void ) static void UpdateState(void)
{ {
if ( hd6309.md & MD_EM ) if ( hd6309.md & MD_EM )
{ {
@ -511,6 +511,10 @@ static void hd6309_set_context(void *src)
UpdateState(); UpdateState();
} }
static STATE_POSTLOAD( hd6309_postload )
{
UpdateState();
}
static void hd6309_init(int index, int clock, const void *config, int (*irqcallback)(int)) 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, DP);
state_save_register_item("hd6309", index, CC); state_save_register_item("hd6309", index, CC);
state_save_register_item("hd6309", index, MD); 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.int_state);
state_save_register_item("hd6309", index, hd6309.nmi_state); state_save_register_item("hd6309", index, hd6309.nmi_state);
state_save_register_item("hd6309", index, hd6309.irq_state[0]); state_save_register_item("hd6309", index, hd6309.irq_state[0]);

View File

@ -489,7 +489,7 @@ static void i386_debug_setup(void)
/*************************************************************************/ /*************************************************************************/
static void i386_postload(void) static STATE_POSTLOAD( i386_postload )
{ {
int i; int i;
for (i = 0; i < 6; 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.ldtr.flags);
state_save_register_item(state_type, index, I.irq_state); state_save_register_item(state_type, index, I.irq_state);
state_save_register_item(state_type, index, I.performed_intersegment_jump); 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) static void build_opcode_table(UINT32 features)

View File

@ -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) 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.r);
state_save_register_item_array(type, index, jaguar.a); state_save_register_item_array(type, index, jaguar.a);
state_save_register_item_array(type, index, jaguar.ctrl); state_save_register_item_array(type, index, jaguar.ctrl);
state_save_register_item(type, index, jaguar.ppc); state_save_register_item(type, index, jaguar.ppc);
state_save_register_func_postload(update_register_banks); state_save_register_postload(Machine, jaguar_postload, NULL);
state_save_register_func_postload(check_irqs);
} }
static void jaguargpu_init(int index, int clock, const void *_config, int (*irqcallback)(int)) static void jaguargpu_init(int index, int clock, const void *_config, int (*irqcallback)(int))

View File

@ -1041,7 +1041,7 @@ static offs_t m37710_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UIN
} }
#endif /* ENABLE_DEBUGGER */ #endif /* ENABLE_DEBUGGER */
static void m37710_restore_state(void) static STATE_POSTLOAD( m37710_restore_state )
{ {
// restore proper function pointers // restore proper function pointers
m37710i_set_execution_mode((FLAG_M>>4) | (FLAG_X>>4)); 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].seconds);
state_save_register_item("M377xx", index, m37710i_cpu.reload[7].attoseconds); 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);
} }
/************************************************************************** /**************************************************************************

View File

@ -978,14 +978,14 @@ static struct {
UINT8 halted; UINT8 halted;
} m68k_substate; } 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.sr = m68ki_get_sr();
m68k_substate.stopped = (CPU_STOPPED & STOP_LEVEL_STOP) != 0; m68k_substate.stopped = (CPU_STOPPED & STOP_LEVEL_STOP) != 0;
m68k_substate.halted = (CPU_STOPPED & STOP_LEVEL_HALT) != 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); m68ki_set_sr_noint_nosp(m68k_substate.sr);
CPU_STOPPED = m68k_substate.stopped ? STOP_LEVEL_STOP : 0 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, m68k_substate.halted);
state_save_register_item(type, index, CPU_PREF_ADDR); state_save_register_item(type, index, CPU_PREF_ADDR);
state_save_register_item(type, index, CPU_PREF_DATA); state_save_register_item(type, index, CPU_PREF_DATA);
state_save_register_func_presave(m68k_prepare_substate); state_save_register_presave(Machine, m68k_prepare_substate, NULL);
state_save_register_func_postload(m68k_post_load); state_save_register_postload(Machine, m68k_post_load, NULL);
} }
#endif /* M68K_COMPILE_FOR_MAME */ #endif /* M68K_COMPILE_FOR_MAME */

View File

@ -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 ); 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 ) static void mips_state_register( const char *type, int index )
{ {
state_save_register_item( type, index, mipscpu.op ); 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_operation );
state_save_register_item( type, index, mipscpu.multiplier_operand1 ); state_save_register_item( type, index, mipscpu.multiplier_operand1 );
state_save_register_item( type, index, mipscpu.multiplier_operand2 ); state_save_register_item( type, index, mipscpu.multiplier_operand2 );
state_save_register_func_postload( mips_update_memory_handlers ); state_save_register_postload( Machine, mips_postload, NULL );
state_save_register_func_postload( mips_update_address_masks );
state_save_register_func_postload( mips_update_scratchpad );
} }
static void mips_init( int index, int clock, const void *config, int (*irqcallback)(int) ) static void mips_init( int index, int clock, const void *config, int (*irqcallback)(int) )

View File

@ -102,7 +102,7 @@ static const tms34010_config default_config =
static void check_interrupt(void); static void check_interrupt(void);
static TIMER_CALLBACK( scanline_callback ); 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.pixelshift);
state_save_register_item("tms34010", index, state.gfxcycles); 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_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) static void tms34010_reset(void)
@ -1622,7 +1622,7 @@ int tms34020_get_DPYSTRT(int cpu)
SAVE STATE SAVE STATE
***************************************************************************/ ***************************************************************************/
static void tms34010_state_postload(void) static STATE_POSTLOAD( tms34010_state_postload )
{ {
change_pc(TOBYTE(PC)); change_pc(TOBYTE(PC));
set_raster_op(); set_raster_op();

View File

@ -75,8 +75,8 @@ struct _colortable_t
FUNCTION PROTOTYPES FUNCTION PROTOTYPES
***************************************************************************/ ***************************************************************************/
static void palette_presave(void); static void palette_presave(running_machine *machine, void *param);
static void palette_postload(void); static void palette_postload(running_machine *machine, void *param);
static void palette_exit(running_machine *machine); static void palette_exit(running_machine *machine);
static void allocate_palette(running_machine *machine, palette_private *palette); static void allocate_palette(running_machine *machine, palette_private *palette);
static void allocate_color_tables(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); 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_pen, numcolors);
state_save_register_global_pointer(palette->save_bright, numcolors); state_save_register_global_pointer(palette->save_bright, numcolors);
state_save_register_func_presave(palette_presave); state_save_register_presave(machine, palette_presave, palette);
state_save_register_func_postload(palette_postload); state_save_register_postload(machine, palette_postload, palette);
} }
} }
@ -534,17 +534,17 @@ pen_t get_white_pen(running_machine *machine)
for saving for saving
-------------------------------------------------*/ -------------------------------------------------*/
static void palette_presave(void) static void palette_presave(running_machine *machine, void *param)
{ {
int numcolors = palette_get_num_colors(Machine->palette); int numcolors = palette_get_num_colors(machine->palette);
palette_private *palette = Machine->palette_data; palette_private *palette = param;
int index; int index;
/* fill the save arrays with updated pen and brightness information */ /* fill the save arrays with updated pen and brightness information */
for (index = 0; index < numcolors; index++) for (index = 0; index < numcolors; index++)
{ {
palette->save_pen[index] = palette_entry_get_color(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); palette->save_bright[index] = palette_entry_get_contrast(machine->palette, index);
} }
} }
@ -554,17 +554,17 @@ static void palette_presave(void)
actually update the palette 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); int numcolors = palette_get_num_colors(machine->palette);
palette_private *palette = Machine->palette_data; palette_private *palette = param;
int index; int index;
/* reset the pen and brightness for each entry */ /* reset the pen and brightness for each entry */
for (index = 0; index < numcolors; index++) for (index = 0; index < numcolors; index++)
{ {
palette_entry_set_color(Machine->palette, index, palette->save_pen[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_contrast(machine->palette, index, palette->save_bright[index]);
} }
} }

View File

@ -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 *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 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 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 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 genf *get_static_handler(int databits, int readorwrite, int spacenum, int which);
static void memory_exit(running_machine *machine); static void memory_exit(running_machine *machine);
@ -513,7 +513,7 @@ void memory_init(running_machine *machine)
memory_init_allocate(machine->config); memory_init_allocate(machine->config);
/* find all the allocated pointers */ /* find all the allocated pointers */
memory_init_locate(); memory_init_locate(machine);
/* dump the final memory configuration */ /* dump the final memory configuration */
mem_dump(); mem_dump();
@ -2384,7 +2384,7 @@ static address_map_entry *assign_intersecting_blocks(addrspace_data *space, offs
reattach_banks - reconnect banks after a load reattach_banks - reconnect banks after a load
-------------------------------------------------*/ -------------------------------------------------*/
static void reattach_banks(void) static STATE_POSTLOAD( reattach_banks )
{ {
int banknum; int banknum;
@ -2404,7 +2404,7 @@ static void reattach_banks(void)
into the final allocated memory into the final allocated memory
-------------------------------------------------*/ -------------------------------------------------*/
static void memory_init_locate(void) static void memory_init_locate(running_machine *machine)
{ {
int cpunum, spacenum, banknum; int cpunum, spacenum, banknum;
@ -2452,7 +2452,7 @@ static void memory_init_locate(void)
} }
/* request a callback to fix up the banks when done */ /* 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);
} }

View File

@ -8,6 +8,7 @@
#include "sndintrf.h" #include "sndintrf.h"
#include "streams.h" #include "streams.h"
#include "deprecat.h"
#include "fm.h" #include "fm.h"
#include "2151intf.h" #include "2151intf.h"
#include "ym2151.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; 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); 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) if (info->chip != 0)
{ {

View File

@ -1,5 +1,6 @@
#include <math.h> #include <math.h>
#include "sndintrf.h" #include "sndintrf.h"
#include "deprecat.h"
#include "streams.h" #include "streams.h"
#include "2203intf.h" #include "2203intf.h"
#include "fm.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; struct ym2203_info *info = param;
YM2203Postload(info->chip); YM2203Postload(info->chip);
@ -128,7 +129,7 @@ static void *ym2203_start(int sndindex, int clock, const void *config)
/* Initialize FM emurator */ /* Initialize FM emurator */
info->chip = YM2203Init(info,sndindex,clock,rate,timer_handler,IRQHandler,&psgintf); 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) if (info->chip)
return info; return info;

View File

@ -12,6 +12,7 @@
***************************************************************************/ ***************************************************************************/
#include "sndintrf.h" #include "sndintrf.h"
#include "deprecat.h"
#include "streams.h" #include "streams.h"
#include "ay8910.h" #include "ay8910.h"
#include "2608intf.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; struct ym2608_info *info = param;
YM2608Postload(info->chip); YM2608Postload(info->chip);
@ -149,7 +150,7 @@ static void *ym2608_start(int sndindex, int clock, const void *config)
pcmbufa,pcmsizea, pcmbufa,pcmsizea,
timer_handler,IRQHandler,&psgintf); timer_handler,IRQHandler,&psgintf);
state_save_register_func_postload_ptr(ym2608_postload, info); state_save_register_postload(Machine, ym2608_postload, info);
if (info->chip) if (info->chip)
return info; return info;

View File

@ -12,6 +12,7 @@
***************************************************************************/ ***************************************************************************/
#include "sndintrf.h" #include "sndintrf.h"
#include "deprecat.h"
#include "streams.h" #include "streams.h"
#include "ay8910.h" #include "ay8910.h"
#include "2610intf.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; struct ym2610_info *info = param;
YM2610Postload(info->chip); YM2610Postload(info->chip);
@ -154,7 +155,7 @@ static void *ym2610_start(int sndindex, int clock, const void *config)
pcmbufa,pcmsizea,pcmbufb,pcmsizeb, pcmbufa,pcmsizea,pcmbufb,pcmsizeb,
timer_handler,IRQHandler,&psgintf); timer_handler,IRQHandler,&psgintf);
state_save_register_func_postload_ptr(ym2610_postload, info); state_save_register_postload(Machine, ym2610_postload, info);
if (info->chip) if (info->chip)
return info; return info;

View File

@ -12,6 +12,7 @@
***************************************************************************/ ***************************************************************************/
#include "sndintrf.h" #include "sndintrf.h"
#include "deprecat.h"
#include "streams.h" #include "streams.h"
#include "sound/fm.h" #include "sound/fm.h"
#include "sound/2612intf.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; struct ym2612_info *info = param;
YM2612Postload(info->chip); YM2612Postload(info->chip);
@ -108,7 +109,7 @@ static void *ym2612_start(int sndindex, int clock, const void *config)
/**** initialize YM2612 ****/ /**** initialize YM2612 ****/
info->chip = YM2612Init(info,sndindex,clock,rate,timer_handler,IRQHandler); 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) if (info->chip)
return info; return info;

View File

@ -70,6 +70,7 @@ Revision History:
#include <math.h> #include <math.h>
#include "sndintrf.h" /* use M.A.M.E. */ #include "sndintrf.h" /* use M.A.M.E. */
#include "deprecat.h" /* use M.A.M.E. */
#include "ymdeltat.h" #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; FM_OPL *OPL = (FM_OPL *)param;
int slot, ch; 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->statusmask);
state_save_register_item(statename, index, OPL->mode); 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);
} }

View File

@ -18,6 +18,7 @@ CHANNEL_DEBUG enables the following keys:
*********************************************************/ *********************************************************/
#include "sndintrf.h" #include "sndintrf.h"
#include "deprecat.h"
#include "streams.h" #include "streams.h"
#include "k054539.h" #include "k054539.h"
#include <math.h> #include <math.h>
@ -592,7 +593,7 @@ static void K054539_w(int chip, offs_t offset, UINT8 data) //*
regbase[offset] = data; regbase[offset] = data;
} }
static void reset_zones(void *param) static STATE_POSTLOAD( reset_zones )
{ {
struct k054539_info *info = param; struct k054539_info *info = param;
int data = info->regs[0x22e]; 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); 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; return info;
} }

View File

@ -29,6 +29,7 @@
#include <math.h> #include <math.h>
#include "sndintrf.h" #include "sndintrf.h"
#include "deprecat.h"
#include "streams.h" #include "streams.h"
#include "multipcm.h" #include "multipcm.h"
@ -101,7 +102,7 @@ typedef struct MultiPCM_t
} MultiPCMT; } MultiPCMT;
static void MultiPCM_postload(void *param) static STATE_POSTLOAD( MultiPCM_postload )
{ {
MultiPCMT *mpcm = param; MultiPCMT *mpcm = param;
int j; 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_item(mname, sndindex, mpcm->curvoice);
} }
state_save_register_func_postload_ptr(MultiPCM_postload, mpcm); state_save_register_postload(Machine, MultiPCM_postload, mpcm);
return mpcm; return mpcm;
} }

View File

@ -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; struct samples_info *info = param;
int i; 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].loop);
state_save_register_item("samples", sndindex * MAX_CHANNELS + i, info->channel[i].paused); 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 */ /* initialize any custom handlers */
if (intf->start) if (intf->start)

View File

@ -100,6 +100,7 @@
#include <math.h> #include <math.h>
#include "sndintrf.h" #include "sndintrf.h"
#include "deprecat.h"
#include "streams.h" #include "streams.h"
#include "upd7759.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; struct upd7759_chip *chip = (struct upd7759_chip *)param;
chip->rom = chip->rombase + chip->romoffset; 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->sample);
state_save_register_item("upd7759", index, chip->romoffset); 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);
} }

View File

@ -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; struct vlm5030_info *chip = param;
int i; 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(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->target_k);
state_save_register_item_array(VLM_NAME,sndindex,chip->x); 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; return chip;
} }

View File

@ -1386,9 +1386,9 @@ int YM2151ReadStatus( void *_chip )
/* /*
* state save support for MAME * state save support for MAME
*/ */
void YM2151Postload(void *chip) STATE_POSTLOAD( YM2151Postload )
{ {
YM2151 *YM2151_chip = (YM2151 *)chip; YM2151 *YM2151_chip = (YM2151 *)param;
int j; int j;
for (j=0; j<8; 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_item_array(buf1, sndindex, chip->connect);
state_save_register_func_postload_ptr(YM2151Postload, chip); state_save_register_postload(Machine, YM2151Postload, chip);
} }
#else #else
void YM2151Postload(void *chip) STATE_POSTLOAD( YM2151Postload )
{ {
} }

View File

@ -82,5 +82,5 @@ void YM2151SetIrqHandler(void *chip, void (*handler)(int irq));
void YM2151SetPortWriteHandler(void *chip, write8_machine_func handler); void YM2151SetPortWriteHandler(void *chip, write8_machine_func handler);
/* refresh chip when load state */ /* refresh chip when load state */
void YM2151Postload(void *chip); STATE_POSTLOAD( YM2151Postload );
#endif /*_H_YM2151_*/ #endif /*_H_YM2151_*/

View File

@ -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; struct YMZ280BChip *chip = param;
int j; 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 #if MAKE_WAVS
chip->wavresample = wav_open("resamp.wav", INTERNAL_SAMPLE_RATE, 2); chip->wavresample = wav_open("resamp.wav", INTERNAL_SAMPLE_RATE, 2);

View File

@ -51,13 +51,6 @@ enum
SS_MSB_FIRST = 0x02 SS_MSB_FIRST = 0x02
}; };
enum
{
FUNC_NOPARAM,
FUNC_INTPARAM,
FUNC_PTRPARAM
};
/*************************************************************************** /***************************************************************************
@ -81,18 +74,12 @@ typedef struct _ss_func ss_func;
struct _ss_func struct _ss_func
{ {
ss_func * next; /* pointer to next entry */ ss_func * next; /* pointer to next entry */
int type; /* type of callback */
union union
{ {
void (*voidf)(void); state_presave_func presave; /* presave callback */
void (*intf)(int param); state_postload_func postload; /* postload callback */
void (*ptrf)(void *param);
} func; /* function pointers */ } func; /* function pointers */
union void * param; /* function parameter */
{
int intp;
void *ptrp;
} param; /* parameters */
int tag; /* saving tag */ 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 state_save_register_presave -
callback that takes no parameters register a pre-save function callback
-------------------------------------------------*/ -------------------------------------------------*/
static void register_func_void(ss_func **root, void (*func)(void)) void state_save_register_presave(running_machine *machine, state_presave_func func, void *param)
{
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)
{ {
ss_func **cur; ss_func **cur;
@ -364,71 +305,49 @@ static void register_func_int(ss_func **root, void (*func)(int), int param)
fatalerror("Attempt to register callback function after state registration is closed!"); fatalerror("Attempt to register callback function after state registration is closed!");
/* scan for duplicates and push through to the end */ /* scan for duplicates and push through to the end */
for (cur = root; *cur; cur = &(*cur)->next) for (cur = &ss_prefunc_reg; *cur; cur = &(*cur)->next)
if ((*cur)->func.intf == func && (*cur)->param.intp == param && (*cur)->tag == ss_current_tag) if ((*cur)->func.presave == func && (*cur)->param == param && (*cur)->tag == ss_current_tag)
fatalerror("Duplicate save state function (%d, %d, %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);
}
/*-------------------------------------------------
register_func_ptr - register a function
callback that takes a void * parameter
-------------------------------------------------*/
static void register_func_ptr(ss_func **root, void (*func)(void *), void *param)
{
ss_func **cur;
/* check for invalid timing */
if (!ss_registration_allowed)
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)
fatalerror("Duplicate save state function (%d, %p, %p)", ss_current_tag, param, func); fatalerror("Duplicate save state function (%d, %p, %p)", ss_current_tag, param, func);
/* allocate a new entry */ /* allocate a new entry */
*cur = malloc_or_die(sizeof(ss_func)); *cur = malloc_or_die(sizeof(ss_func));
/* fill it in */ /* fill it in */
(*cur)->next = NULL; (*cur)->next = NULL;
(*cur)->type = FUNC_PTRPARAM; (*cur)->func.presave = func;
(*cur)->func.ptrf = func; (*cur)->param = param;
(*cur)->param.ptrp = param; (*cur)->tag = ss_current_tag;
(*cur)->tag = ss_current_tag; restrack_register_object(OBJTYPE_STATEREG, *cur, 1, __FILE__, __LINE__);
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) /*-------------------------------------------------
state_save_register_postload -
register a post-load function callback
-------------------------------------------------*/
void state_save_register_postload(running_machine *machine, state_postload_func func, void *param)
{ {
register_func_ptr(&ss_postfunc_reg, func, param); ss_func **cur;
/* check for invalid timing */
if (!ss_registration_allowed)
fatalerror("Attempt to register callback function after state registration is closed!");
/* scan for duplicates and push through to the end */
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)->func.postload = func;
(*cur)->param = param;
(*cur)->tag = ss_current_tag;
restrack_register_object(OBJTYPE_STATEREG, *cur, 2, __FILE__, __LINE__);
} }
@ -593,35 +512,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 get_signature - compute the signature, which
is a CRC over the structure of the data 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) void state_save_save_continue(void)
{ {
ss_entry *entry; ss_entry *entry;
int count; ss_func *func;
int count = 0;
LOG(("Saving tag %d\n", ss_current_tag)); LOG(("Saving tag %d\n", ss_current_tag));
/* call the pre-save functions */ /* call the pre-save functions */
LOG((" calling pre-save functions\n")); 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)); LOG((" %d functions called\n", count));
/* then copy in all the data */ /* then copy in all the data */
@ -873,8 +771,9 @@ int state_save_load_begin(mame_file *file)
void state_save_load_continue(void) void state_save_load_continue(void)
{ {
ss_entry *entry; ss_entry *entry;
ss_func *func;
int need_convert; int need_convert;
int count; int count = 0;
/* first determine whether or not we need to convert the endianness of the data */ /* first determine whether or not we need to convert the endianness of the data */
#ifdef LSB_FIRST #ifdef LSB_FIRST
@ -898,7 +797,12 @@ void state_save_load_continue(void)
/* call the post-load functions */ /* call the post-load functions */
LOG((" calling post-load functions\n")); 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)); LOG((" %d functions called\n", count));
} }

View File

@ -18,10 +18,23 @@
/***************************************************************************
TYPE DEFINTIONS
***************************************************************************/
typedef void (*state_presave_func)(running_machine *machine, void *param);
typedef void (*state_postload_func)(running_machine *machine, void *param);
/*************************************************************************** /***************************************************************************
MACROS 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) \ #define IS_COMPATIBLE_TYPE(_valtype, _checktype) \
(sizeof(_valtype) == sizeof(_checktype) && TYPES_COMPATIBLE(typeof(_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_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_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_presave(running_machine *machine, state_presave_func func, void *param);
void state_save_register_func_postload(void (*func)(void)); void state_save_register_postload(running_machine *machine, state_postload_func func, void *param);
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);
/* Save and load functions */ /* Save and load functions */
/* The tags are a hack around the current cpu structures */ /* The tags are a hack around the current cpu structures */

View File

@ -166,7 +166,7 @@ struct _streams_private
FUNCTION PROTOTYPES 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_resample_buffers(streams_private *strdata, sound_stream *stream);
static void allocate_output_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); 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 */ /* create a unique tag for saving */
sprintf(statetag, "stream.%d", stream->index); sprintf(statetag, "stream.%d", stream->index);
state_save_register_item(statetag, 0, stream->sample_rate); 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 */ /* allocate space for the inputs */
if (inputs > 0) if (inputs > 0)
@ -633,9 +633,9 @@ void stream_set_output_gain(sound_stream *stream, int output, float gain)
stream_postload - save/restore callback 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; sound_stream *stream = param;
int outputnum; int outputnum;

View File

@ -138,7 +138,7 @@ static UINT32 screen_width, screen_height;
/* system management helpers */ /* system management helpers */
static void tilemap_exit(running_machine *machine); static void tilemap_exit(running_machine *machine);
static void tilemap_postload(void *param); static STATE_POSTLOAD( tilemap_postload );
static void tilemap_dispose(tilemap *tmap); static void tilemap_dispose(tilemap *tmap);
/* logical <-> memory index mapping */ /* logical <-> memory index mapping */
@ -355,7 +355,7 @@ tilemap *tilemap_create(tile_get_info_func tile_get_info, tilemap_mapper_func ma
tilemap_instance++; tilemap_instance++;
/* reset everything after a load */ /* reset everything after a load */
state_save_register_func_postload_ptr(tilemap_postload, tmap); state_save_register_postload(Machine, tilemap_postload, tmap);
return tmap; return tmap;
} }
@ -1050,7 +1050,7 @@ static void tilemap_exit(running_machine *machine)
invalidate everything invalidate everything
-------------------------------------------------*/ -------------------------------------------------*/
static void tilemap_postload(void *param) static STATE_POSTLOAD( tilemap_postload )
{ {
/* recompute the mappings for this tilemap */ /* recompute the mappings for this tilemap */
tilemap *tmap = param; tilemap *tmap = param;

View File

@ -104,7 +104,7 @@ static attotime callback_timer_expire_time;
FUNCTION PROTOTYPES FUNCTION PROTOTYPES
***************************************************************************/ ***************************************************************************/
static void timer_postload(void); static STATE_POSTLOAD( timer_postload );
static void timer_logtimers(void); static void timer_logtimers(void);
static void timer_remove(emu_timer *which); static void timer_remove(emu_timer *which);
@ -280,7 +280,7 @@ void timer_init(running_machine *machine)
state_save_push_tag(0); state_save_push_tag(0);
state_save_register_item("timer", 0, global_basetime.seconds); state_save_register_item("timer", 0, global_basetime.seconds);
state_save_register_item("timer", 0, global_basetime.attoseconds); 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(); state_save_pop_tag();
/* reset the timers */ /* reset the timers */
@ -427,7 +427,7 @@ static void timer_register_save(emu_timer *timer)
timer_postload - after loading a save state timer_postload - after loading a save state
-------------------------------------------------*/ -------------------------------------------------*/
static void timer_postload(void) static STATE_POSTLOAD( timer_postload )
{ {
emu_timer *privlist = NULL; emu_timer *privlist = NULL;
emu_timer *t; emu_timer *t;

View File

@ -144,7 +144,7 @@ static TIMER_CALLBACK( prd_changed_tick )
/* State Save Postload */ /* State Save Postload */
static void cdp1869_state_save_postload(void *param) static STATE_POSTLOAD( cdp1869_state_save_postload )
{ {
update_prd_changed_timer(param); update_prd_changed_timer(param);
} }
@ -804,7 +804,7 @@ static DEVICE_START( cdp1869 )
// register for state saving // register for state saving
state_save_combine_module_and_tag(unique_tag, "CDP1869", device->tag); 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->dispoff);
state_save_register_item(unique_tag, 0, cdp1869->fresvert); state_save_register_item(unique_tag, 0, cdp1869->fresvert);

View File

@ -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 recompute_parameters(mc6845_t *mc6845, int postload);
static void update_de_changed_timer(mc6845_t *mc6845); static void update_de_changed_timer(mc6845_t *mc6845);
static void update_hsync_changed_timers(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); recompute_parameters(param, TRUE);
} }
@ -723,7 +723,7 @@ static void common_start(const device_config *device, int device_type)
/* register for state saving */ /* register for state saving */
state_save_combine_module_and_tag(unique_tag, device_tags[device_type], device->tag); 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->clock);
state_save_register_item(unique_tag, 0, mc6845->hpixels_per_column); state_save_register_item(unique_tag, 0, mc6845->hpixels_per_column);

View File

@ -7,6 +7,7 @@
***************************************************************************/ ***************************************************************************/
#include "poly.h" #include "poly.h"
#include "deprecat.h"
#include "eminline.h" #include "eminline.h"
#include "mame.h" #include "mame.h"
#include "state.h" #include "state.h"
@ -206,7 +207,7 @@ struct _poly_manager
static void **allocate_array(size_t *itemsize, UINT32 itemcount); static void **allocate_array(size_t *itemsize, UINT32 itemcount);
static void free_array(void **array); static void free_array(void **array);
static void *poly_item_callback(void *param, int threadid); 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); poly->queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_MULTI | WORK_QUEUE_FLAG_HIGH_FREQ);
/* request a pre-save callback for synchronization */ /* 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; return poly;
} }
@ -1420,7 +1421,7 @@ static void *poly_item_callback(void *param, int threadid)
ensure everything is synced before saving ensure everything is synced before saving
-------------------------------------------------*/ -------------------------------------------------*/
static void poly_state_presave(void *param) static STATE_PRESAVE( poly_state_presave )
{ {
poly_manager *poly = param; poly_manager *poly = param;
poly_wait(poly, "pre-save"); poly_wait(poly, "pre-save");

View File

@ -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); profpac_banksw_w(Machine, 0, profpac_bank);
} }
@ -1727,7 +1727,7 @@ static DRIVER_INIT( profpac )
/* reset banking */ /* reset banking */
profpac_banksw_w(machine, 0, 0); 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 */ /* reset banking */
profpac_banksw_w(machine, 0, 0); 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 */ /* reset banking */
profpac_banksw_w(machine, 0, 0); profpac_banksw_w(machine, 0, 0);
state_save_register_func_postload(profbank_banksw_restore); state_save_register_postload(machine, profbank_banksw_restore, NULL);
} }

View File

@ -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; int bank = bslapstic_bank;
bslapstic_bank = -1; 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(); pitfighb_cheap_slapstic_init();
state_save_register_global(bslapstic_bank); state_save_register_global(bslapstic_bank);
state_save_register_global(bslapstic_primed); 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) else if (slapstic != 0)
atarigen_slapstic_init(0, slapstic_base, 0, slapstic); atarigen_slapstic_init(0, slapstic_base, 0, slapstic);

View File

@ -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(which_adc);
state_save_register_global(p2portwr_state); state_save_register_global(p2portwr_state);
state_save_register_global(p2portrd_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); 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, 0, bankselect[0], 0);
bankselect_w(Machine, 1, bankselect[1], 0); bankselect_w(Machine, 1, bankselect[1], 0);

View File

@ -110,6 +110,12 @@ static void reset_bank(void)
} }
static STATE_POSTLOAD( atetris_postload )
{
reset_bank();
}
static MACHINE_START( atetris ) static MACHINE_START( atetris )
{ {
/* Allocate interrupt timer */ /* Allocate interrupt timer */
@ -118,7 +124,7 @@ static MACHINE_START( atetris )
/* Set up save state */ /* Set up save state */
state_save_register_global(current_bank); state_save_register_global(current_bank);
state_save_register_global(nvram_write_enable); state_save_register_global(nvram_write_enable);
state_save_register_func_postload(reset_bank); state_save_register_postload(machine, atetris_postload, NULL);
} }

View File

@ -63,7 +63,7 @@ static MACHINE_RESET( batman )
atarivc_reset(machine->primary_screen, atarivc_eof_data, 2); atarivc_reset(machine->primary_screen, atarivc_eof_data, 2);
atarigen_scanline_timer_reset(machine->primary_screen, batman_scanline_update, 8); atarigen_scanline_timer_reset(machine->primary_screen, batman_scanline_update, 8);
atarijsa_reset(); atarijsa_reset();
atarigen_init_save_state(); atarigen_init_save_state(machine);
state_save_register_global(latch_data); state_save_register_global(latch_data);
} }

View File

@ -1192,16 +1192,21 @@ static DRIVER_INIT( darius )
} }
static STATE_POSTLOAD( darius_postload )
{
parse_control();
reset_sound_region();
}
static MACHINE_START( darius ) static MACHINE_START( darius )
{ {
state_save_register_global(cpua_ctrl); state_save_register_global(cpua_ctrl);
state_save_register_func_postload(parse_control);
// (there are other sound vars that may need saving too) // // (there are other sound vars that may need saving too) //
state_save_register_global(banknum); state_save_register_global(banknum);
state_save_register_global(adpcm_command); state_save_register_global(adpcm_command);
state_save_register_global(nmi_enable); state_save_register_global(nmi_enable);
state_save_register_func_postload(reset_sound_region); state_save_register_postload(machine, darius_postload, NULL);
} }

View File

@ -1118,7 +1118,7 @@ static DRIVER_INIT( decocass )
decrypted[A] = swap_bits_5_6(rom[A]); decrypted[A] = swap_bits_5_6(rom[A]);
/* Call the state save setup code in machine/decocass.c */ /* 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 */ /* and in video/decocass.c, too */
decocass_video_state_save_init(); decocass_video_state_save_init();
} }

View File

@ -1183,6 +1183,11 @@ static const struct K054539interface k054539_interface =
* *
*************************************/ *************************************/
static STATE_POSTLOAD( djmain_postload )
{
sndram_set_bank();
}
static MACHINE_START( djmain ) static MACHINE_START( djmain )
{ {
UINT8 *region = memory_region(REGION_SOUND1); UINT8 *region = memory_region(REGION_SOUND1);
@ -1193,7 +1198,7 @@ static MACHINE_START( djmain )
state_save_register_global(v_ctrl); state_save_register_global(v_ctrl);
state_save_register_global_array(obj_regs); state_save_register_global_array(obj_regs);
state_save_register_func_postload(sndram_set_bank); state_save_register_postload(machine, djmain_postload, NULL);
} }

View File

@ -70,7 +70,7 @@ static MACHINE_RESET( klaxp )
atarigen_interrupt_reset(update_interrupts); atarigen_interrupt_reset(update_interrupts);
atarigen_scanline_timer_reset(machine->primary_screen, eprom_scanline_update, 8); atarigen_scanline_timer_reset(machine->primary_screen, eprom_scanline_update, 8);
atarijsa_reset(); atarijsa_reset();
atarigen_init_save_state(); atarigen_init_save_state(machine);
} }

View File

@ -342,7 +342,7 @@ static const struct AM53CF96interface scsi_intf =
static DRIVER_INIT( konamigq ) static DRIVER_INIT( konamigq )
{ {
psx_driver_init(); psx_driver_init(machine);
m_p_n_pcmram = memory_region( REGION_SOUND1 ) + 0x80000; m_p_n_pcmram = memory_region( REGION_SOUND1 ) + 0x80000;
} }

View File

@ -313,7 +313,7 @@ static void konamigv_exit(running_machine *machine)
static DRIVER_INIT( konamigv ) static DRIVER_INIT( konamigv )
{ {
psx_driver_init(); psx_driver_init(machine);
/* init the scsi controller and hook up it's DMA */ /* init the scsi controller and hook up it's DMA */
am53cf96_init(&scsi_intf); am53cf96_init(&scsi_intf);

View File

@ -1491,7 +1491,7 @@ static DRIVER_INIT( konami573 )
{ {
int i; int i;
psx_driver_init(); psx_driver_init(machine);
atapi_init(machine); atapi_init(machine);
psx_dma_install_read_handler(5, cdrom_dma_read); psx_dma_install_read_handler(5, cdrom_dma_read);
psx_dma_install_write_handler(5, cdrom_dma_write); psx_dma_install_write_handler(5, cdrom_dma_write);

View File

@ -1155,6 +1155,10 @@ ROM_END
static STATE_POSTLOAD( quizf1_postload )
{
set_m90_bank();
}
static DRIVER_INIT( quizf1 ) static DRIVER_INIT( quizf1 )
{ {
@ -1162,7 +1166,7 @@ static DRIVER_INIT( quizf1 )
set_m90_bank(); set_m90_bank();
state_save_register_global(bankaddress); state_save_register_global(bankaddress);
state_save_register_func_postload(set_m90_bank); state_save_register_postload(machine, quizf1_postload, NULL);
} }

View File

@ -220,12 +220,17 @@ static void set_m92_bank(void)
memory_set_bankptr(1,&RAM[bankaddress]); memory_set_bankptr(1,&RAM[bankaddress]);
} }
static STATE_POSTLOAD( m92_postload )
{
set_m92_bank();
}
static MACHINE_START( m92 ) static MACHINE_START( m92 )
{ {
state_save_register_global(irqvector); state_save_register_global(irqvector);
state_save_register_global(sound_status); state_save_register_global(sound_status);
state_save_register_global(bankaddress); 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); scanline_timer = timer_alloc(m92_scanline_interrupt, NULL);
} }

View File

@ -857,9 +857,9 @@ MACHINE_DRIVER_END
static UINT8 maze_tone_timing_state; 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 */ /* setup for save states */
state_save_register_global(maze_tone_timing_state); 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); MACHINE_START_CALL(mw8080bw);
} }

View File

@ -850,6 +850,11 @@ static GFXDECODE_START( dadandrn )
GFXDECODE_ENTRY( REGION_GFX3, 0, bglayout_8bpp, 0x0000, 8 ) GFXDECODE_ENTRY( REGION_GFX3, 0, bglayout_8bpp, 0x0000, 8 )
GFXDECODE_END GFXDECODE_END
static STATE_POSTLOAD( mystwarr_postload )
{
reset_sound_region();
}
static MACHINE_START( mystwarr ) static MACHINE_START( mystwarr )
{ {
/* set default bankswitch */ /* set default bankswitch */
@ -860,7 +865,7 @@ static MACHINE_START( mystwarr )
state_save_register_global(mw_irq_control); state_save_register_global(mw_irq_control);
state_save_register_global(cur_sound_region); 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) static MACHINE_RESET(mystwarr)

View File

@ -1601,8 +1601,7 @@ UpdateRoad(running_machine *machine)
} }
} }
static void static STATE_POSTLOAD( RoadMarkAllDirty )
RoadMarkAllDirty(void)
{ {
memset( mpRoadDirty,0x01,ROAD_TILE_COUNT_MAX ); memset( mpRoadDirty,0x01,ROAD_TILE_COUNT_MAX );
mbRoadSomethingIsDirty = 1; 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(mpRoadDirty, ROAD_TILE_COUNT_MAX);
state_save_register_global_pointer(mpRoadRAM, 0x20000 / 2); state_save_register_global_pointer(mpRoadRAM, 0x20000 / 2);
state_save_register_func_postload(RoadMarkAllDirty); state_save_register_postload(machine, RoadMarkAllDirty, NULL);
} }
} }

View File

@ -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 *BIOS = (UINT8 *)memory_region( REGION_USER1 );
UINT8 *ROM = (UINT8 *)memory_region( REGION_USER2 ); 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 + 0x0000000 ), ROM + 0x08000, 0x001c000 );
memcpy32le( (UINT32 *)( BIOS + 0x0020000 ), ROM + 0x24000, 0x03dffff ); 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, 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 ) 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 ); decrypt_bios( 0xc, 0xd, 0xf, 0xe, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x4, 0x1, 0x2, 0x5, 0x0, 0x3 );
} }
static DRIVER_INIT( gjspace ) 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 ); decrypt_bios( 0x0, 0x2, 0xe, 0xd, 0xf, 0x6, 0xc, 0x7, 0x5, 0x1, 0x9, 0x8, 0xa, 0x3, 0x4, 0xb );
} }
static DRIVER_INIT( mrdrilrg ) 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 ); decrypt_bios( 0x6, 0x4, 0x7, 0x5, 0x2, 0x1, 0x0, 0x3, 0xc, 0xd, 0xe, 0xf, 0x8, 0x9, 0xb, 0xa );
} }
static DRIVER_INIT( knpuzzle ) 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 ); decrypt_bios( 0x6, 0x7, 0x4, 0x5, 0x2, 0x0, 0x3, 0x1, 0xc, 0xd, 0xe, 0xf, 0x9, 0xb, 0x8, 0xa );
} }
static DRIVER_INIT( startrgn ) 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 ); decrypt_bios( 0x6, 0x5, 0x4, 0x7, 0x1, 0x3, 0x0, 0x2, 0xc, 0xd, 0xe, 0xf, 0x8, 0xb, 0xa, 0x9 );
} }
static DRIVER_INIT( gamshara ) 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 ); decrypt_bios( 0x5, 0x4, 0x7, 0x6, 0x0, 0x1, 0x3, 0x2, 0xd, 0xf, 0xc, 0xe, 0x8, 0x9, 0xa, 0xb );
} }

View File

@ -800,7 +800,7 @@ static DRIVER_INIT( namcos11 )
timer = timer_alloc( mcu_timer , NULL); timer = timer_alloc( mcu_timer , NULL);
timer_adjust_periodic( timer, ATTOTIME_IN_HZ( 600 ), 0, ATTOTIME_IN_HZ( 600 ) ); 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_on_driver_init();
namcoc7x_set_host_ram(namcos11_sharedram); namcoc7x_set_host_ram(namcos11_sharedram);

View File

@ -1439,7 +1439,7 @@ static const struct C352interface c352_interface =
static DRIVER_INIT( namcos12 ) static DRIVER_INIT( namcos12 )
{ {
psx_driver_init(); psx_driver_init(machine);
psx_dma_install_read_handler( 5, namcos12_rom_read ); psx_dma_install_read_handler( 5, namcos12_rom_read );

View File

@ -817,13 +817,13 @@ static WRITE16_HANDLER( system_control_w )
switch (offset & 0x07) switch (offset & 0x07)
{ {
default: 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); case 0x01: set_main_cpu_vector_table_source(bit);
set_audio_cpu_rom_source(bit); /* this is a guess */ set_audio_cpu_rom_source(bit); /* this is a guess */
break; break;
case 0x05: neogeo_set_fixed_layer_source(bit); break; case 0x05: neogeo_set_fixed_layer_source(bit); break;
case 0x06: set_save_ram_unlock(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 0x02: /* unknown - HC32 middle pin 1 */
case 0x03: /* unknown - uPD4990 pin ? */ 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 ) static MACHINE_START( neogeo )
{ {
/* set the BIOS bank */ /* set the BIOS bank */
@ -987,11 +996,7 @@ static MACHINE_START( neogeo )
state_save_register_global(led1_value); state_save_register_global(led1_value);
state_save_register_global(led2_value); state_save_register_global(led2_value);
state_save_register_func_postload(_set_main_cpu_bank_address); state_save_register_postload(machine, neogeo_postload, NULL);
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);
} }

View File

@ -927,15 +927,18 @@ ROM_START( darius2 )
ROM_LOAD( "c07-12.107", 0x00000, 0x80000, CRC(e0b71258) SHA1(0258e308b643d723475824752ebffc4ea29d1ac4) ) ROM_LOAD( "c07-12.107", 0x00000, 0x80000, CRC(e0b71258) SHA1(0258e308b643d723475824752ebffc4ea29d1ac4) )
ROM_END ROM_END
static STATE_POSTLOAD( ninjaw_postload )
{
parse_control();
reset_sound_region();
}
static MACHINE_START( ninjaw ) static MACHINE_START( ninjaw )
{ {
cpua_ctrl = 0xff; cpua_ctrl = 0xff;
state_save_register_global(cpua_ctrl); state_save_register_global(cpua_ctrl);
state_save_register_func_postload(parse_control);
state_save_register_global(banknum); 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 ) static MACHINE_RESET( ninjaw )

View File

@ -441,10 +441,15 @@ static void reset_sound_region(void)
memory_set_bankptr( 10, memory_region(REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); memory_set_bankptr( 10, memory_region(REGION_CPU2) + (banknum * 0x4000) + 0x10000 );
} }
static STATE_POSTLOAD( othunder_postload )
{
reset_sound_region();
}
static MACHINE_START( othunder ) static MACHINE_START( othunder )
{ {
state_save_register_global(banknum); state_save_register_global(banknum);
state_save_register_func_postload(reset_sound_region); state_save_register_postload(machine, othunder_postload, NULL);
} }

View File

@ -1068,7 +1068,12 @@ PC :000029F8: BT $000029EC
return ps4_ram[0x00001c/4]; 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 *ymf_pcm = memory_region(REGION_SOUND1);
UINT8 *pcm_rom = memory_region(REGION_SOUND2); UINT8 *pcm_rom = memory_region(REGION_SOUND2);
@ -1080,8 +1085,8 @@ static void install_hotgmck_pcm_bank(void)
set_hotgmck_pcm_bank(1); set_hotgmck_pcm_bank(1);
memory_install_write32_handler(0, ADDRESS_SPACE_PROGRAM, 0x5800008, 0x580000b, 0, 0, hotgmck_pcm_bank_w ); 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_postload(machine, hotgmck_pcm_bank_postload, (void *)0);
state_save_register_func_postload_int(set_hotgmck_pcm_bank, 1); state_save_register_postload(machine, hotgmck_pcm_bank_postload, (void *)1);
} }
static DRIVER_INIT( hotgmck ) static DRIVER_INIT( hotgmck )
@ -1089,7 +1094,7 @@ static DRIVER_INIT( hotgmck )
UINT8 *RAM = memory_region(REGION_CPU1); UINT8 *RAM = memory_region(REGION_CPU1);
memory_set_bankptr(1,&RAM[0x100000]); memory_set_bankptr(1,&RAM[0x100000]);
memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0x5800000, 0x5800007, 0, 0, hotgmck_io32_r ); // Different Inputs 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 ) static DRIVER_INIT( loderndf )

View File

@ -243,6 +243,11 @@ static void setbank(void)
memory_set_bankptr(1, &RAM[bank ? 0x10000 : 0x4000]); memory_set_bankptr(1, &RAM[bank ? 0x10000 : 0x4000]);
} }
static STATE_POSTLOAD( renegade_postload )
{
setbank();
}
static MACHINE_START( renegade ) static MACHINE_START( renegade )
{ {
state_save_register_global_array(mcu_buffer); 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(mcu_key);
state_save_register_global(bank); state_save_register_global(bank);
state_save_register_func_postload(setbank); state_save_register_postload(machine, renegade_postload, NULL);
} }
static DRIVER_INIT( kuniokun ) static DRIVER_INIT( kuniokun )

View File

@ -232,10 +232,15 @@ static void reset_sound_region(void)
memory_set_bankptr( 10, memory_region(REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); memory_set_bankptr( 10, memory_region(REGION_CPU2) + (banknum * 0x4000) + 0x10000 );
} }
static STATE_POSTLOAD( slapshot_postload )
{
reset_sound_region();
}
static MACHINE_START( slapshot ) static MACHINE_START( slapshot )
{ {
state_save_register_global(banknum); state_save_register_global(banknum);
state_save_register_func_postload(reset_sound_region); state_save_register_postload(machine, slapshot_postload, NULL);
} }

View File

@ -3851,10 +3851,15 @@ static const struct YM2203interface ym2203_interface =
MACHINE DRIVERS MACHINE DRIVERS
***********************************************************/ ***********************************************************/
static STATE_POSTLOAD( f2_postload )
{
reset_sound_region();
}
static MACHINE_START( f2 ) static MACHINE_START( f2 )
{ {
state_save_register_global(banknum); 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 ) static MACHINE_RESET( qcrayon )
@ -5901,11 +5906,16 @@ static DRIVER_INIT( yesnoj )
state_save_register_global(yesnoj_dsw); state_save_register_global(yesnoj_dsw);
} }
static STATE_POSTLOAD( driveout_postload )
{
reset_driveout_sound_region();
}
static DRIVER_INIT( driveout ) static DRIVER_INIT( driveout )
{ {
state_save_register_global(driveout_sound_latch); state_save_register_global(driveout_sound_latch);
state_save_register_global(oki_bank); state_save_register_global(oki_bank);
state_save_register_func_postload(reset_driveout_sound_region); state_save_register_postload(machine, driveout_postload, NULL);
} }

View File

@ -566,10 +566,15 @@ static GFXDECODE_START( dleague )
GFXDECODE_END GFXDECODE_END
static STATE_POSTLOAD( taitoh_postload )
{
reset_sound_region();
}
static MACHINE_START( taitoh ) static MACHINE_START( taitoh )
{ {
state_save_register_global(banknum); state_save_register_global(banknum);
state_save_register_func_postload(reset_sound_region); state_save_register_postload(machine, taitoh_postload, NULL);
} }

View File

@ -995,11 +995,15 @@ static const struct YM2151interface ym2151_interface =
irqhandler irqhandler
}; };
static STATE_POSTLOAD( taitox_postload )
{
reset_sound_region();
}
static MACHINE_START( taitox ) static MACHINE_START( taitox )
{ {
state_save_register_global(banknum); state_save_register_global(banknum);
state_save_register_func_postload(reset_sound_region); state_save_register_postload(machine, taitox_postload, NULL);
} }
/**************************************************************************/ /**************************************************************************/

View File

@ -1424,10 +1424,15 @@ static WRITE16_HANDLER( spacegun_pancontrol )
SAVE STATES SAVE STATES
***********************************************************/ ***********************************************************/
static STATE_POSTLOAD( taitoz_postload )
{
parse_control();
reset_sound_region();
}
static MACHINE_START( taitoz ) static MACHINE_START( taitoz )
{ {
state_save_register_global(cpua_ctrl); 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 */ /* these are specific to various games: we ought to split the inits */
state_save_register_global(sci_int6); state_save_register_global(sci_int6);
@ -1435,7 +1440,7 @@ static MACHINE_START( taitoz )
state_save_register_global(ioc220_port); state_save_register_global(ioc220_port);
state_save_register_global(banknum); 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; cpua_ctrl = 0xff;
} }
static STATE_POSTLOAD( bshark_postload )
{
parse_control_noz80();
}
static DRIVER_INIT( bshark ) static DRIVER_INIT( bshark )
{ {
cpua_ctrl = 0xff; 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); state_save_register_global(eep_latch);
} }

View File

@ -355,13 +355,17 @@ static WRITE8_HANDLER( sound_bankswitch_w )
reset_sound_region(); reset_sound_region();
} }
static STATE_POSTLOAD( taitoair_postload )
{
reset_sound_region();
}
static MACHINE_START( taitoair ) static MACHINE_START( taitoair )
{ {
dsp_HOLD_signal = ASSERT_LINE; dsp_HOLD_signal = ASSERT_LINE;
state_save_register_global(banknum); state_save_register_global(banknum);
state_save_register_func_postload(reset_sound_region); state_save_register_postload(machine, taitoair_postload, NULL);
} }

View File

@ -2089,19 +2089,19 @@ ROM_END
static DRIVER_INIT( toaplan1 ) static DRIVER_INIT( toaplan1 )
{ {
toaplan1_driver_savestate(); toaplan1_driver_savestate(machine);
} }
static DRIVER_INIT( demonwld ) static DRIVER_INIT( demonwld )
{ {
toaplan1_driver_savestate(); toaplan1_driver_savestate(machine);
demonwld_driver_savestate(); demonwld_driver_savestate(machine);
} }
static DRIVER_INIT( vimana ) static DRIVER_INIT( vimana )
{ {
toaplan1_driver_savestate(); toaplan1_driver_savestate(machine);
vimana_driver_savestate(); vimana_driver_savestate(machine);
} }

View File

@ -679,15 +679,18 @@ static const struct MSM5205interface msm5205_interface =
MACHINE DRIVERS MACHINE DRIVERS
***********************************************************/ ***********************************************************/
static STATE_POSTLOAD( topspeed_postload )
{
parse_control();
reset_sound_region();
}
static MACHINE_START( topspeed ) static MACHINE_START( topspeed )
{ {
state_save_register_global(cpua_ctrl); state_save_register_global(cpua_ctrl);
state_save_register_func_postload(parse_control);
state_save_register_global(ioc220_port); state_save_register_global(ioc220_port);
state_save_register_global(banknum); 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 ) static MACHINE_DRIVER_START( topspeed )

View File

@ -1080,7 +1080,7 @@ ROM_END
static DRIVER_INIT( twincobr ) static DRIVER_INIT( twincobr )
{ {
twincobr_driver_savestate(); twincobr_driver_savestate(machine);
} }

View File

@ -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,1); /* Dummy value to ensure restoration */
wardner_ramrom_bank_sw(Machine,0,wardner_membank); wardner_ramrom_bank_sw(Machine,0,wardner_membank);
@ -674,7 +674,7 @@ ROM_END
static DRIVER_INIT( wardner ) 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 */
} }

View File

@ -735,11 +735,15 @@ ROM_START( warriorb )
// ROM_LOAD( "d24-16.79", 0x00000, 0xa??, NO_DUMP ) // ROM_LOAD( "d24-16.79", 0x00000, 0xa??, NO_DUMP )
ROM_END ROM_END
static STATE_POSTLOAD( warriorb_postload )
{
reset_sound_region();
}
static MACHINE_START( warriorb ) static MACHINE_START( warriorb )
{ {
state_save_register_global(banknum); 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 ) static MACHINE_RESET( taito_dualscreen )

View File

@ -935,13 +935,17 @@ However sync to vblank is lacking, which is causing the
graphics glitches. graphics glitches.
***********************************************************/ ***********************************************************/
static STATE_POSTLOAD( wgp_postload )
{
parse_control();
reset_sound_region();
}
static MACHINE_START( wgp ) static MACHINE_START( wgp )
{ {
state_save_register_global(cpua_ctrl); state_save_register_global(cpua_ctrl);
state_save_register_func_postload(parse_control);
state_save_register_global(banknum); 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 ) static MACHINE_DRIVER_START( wgp )

View File

@ -608,12 +608,17 @@ static MACHINE_RESET( xexex )
K054539_init_flags(0, K054539_REVERSE_STEREO); K054539_init_flags(0, K054539_REVERSE_STEREO);
} }
static STATE_POSTLOAD( xexex_postload )
{
parse_control2();
reset_sound_region();
}
static MACHINE_START( xexex ) static MACHINE_START( xexex )
{ {
state_save_register_global(cur_control2); state_save_register_global(cur_control2);
state_save_register_func_postload(parse_control2);
state_save_register_global(cur_sound_region); 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; resume_trigger = 1000;

View File

@ -460,10 +460,15 @@ static INTERRUPT_GEN( xmen_interrupt )
else irq3_line_hold(machine, cpunum); else irq3_line_hold(machine, cpunum);
} }
static STATE_POSTLOAD( xmen_postload )
{
sound_reset_bank();
}
static MACHINE_START( xmen ) static MACHINE_START( xmen )
{ {
state_save_register_global(sound_curbank); 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 ) static MACHINE_DRIVER_START( xmen )

View File

@ -382,11 +382,11 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( link_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( link_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END ADDRESS_MAP_END
static void zn_driver_init( void ) static void zn_driver_init( running_machine *machine )
{ {
int n_game; int n_game;
psx_driver_init(); psx_driver_init(machine);
n_game = 0; n_game = 0;
while( zn_config_table[ n_game ].s_name != NULL ) 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_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 ); 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 || if( strcmp( machine->gamedrv->name, "glpracr" ) == 0 ||
strcmp( machine->gamedrv->name, "glprac2l" ) == 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_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 ); 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 ) 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_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 ); 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(); 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_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 ); 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(); 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_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 ); 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 ) static MACHINE_RESET( coh3002t )
@ -1711,7 +1711,7 @@ static DRIVER_INIT( coh1000w )
// init hard disk // init hard disk
ide_controller_init(0, &atpsx_intf); ide_controller_init(0, &atpsx_intf);
zn_driver_init(); zn_driver_init(machine);
} }
static MACHINE_RESET( coh1000w ) 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, 0x1fa10300, 0x1fa10303, 0, 0, coh1002e_bank_w );
memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00007, 0, 0, coh1002e_latch_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 ) static MACHINE_RESET( coh1002e )
@ -2243,7 +2243,7 @@ static DRIVER_INIT( coh1000a )
ide_controller_init( 0, &jdredd_ide_intf ); ide_controller_init( 0, &jdredd_ide_intf );
} }
zn_driver_init(); zn_driver_init(machine);
} }
static MACHINE_RESET( coh1000a ) 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_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 ); 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 ) 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_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 ); 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 ) 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, 0x1fb00000, 0x1fb00003, 0, 0, cbaj_z80_w );
memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fb00004, 0x1fb00007, 0, 0, coh1002m_bank_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 ) static MACHINE_RESET( coh1002m )

View File

@ -141,8 +141,8 @@ VIDEO_UPDATE( neogeo );
READ16_HANDLER( neogeo_video_register_r ); READ16_HANDLER( neogeo_video_register_r );
WRITE16_HANDLER( neogeo_video_register_w ); WRITE16_HANDLER( neogeo_video_register_w );
void neogeo_set_palette_bank(UINT8 data); void neogeo_set_palette_bank(running_machine *machine, UINT8 data);
void neogeo_set_screen_dark(UINT8 data); void neogeo_set_screen_dark(running_machine *machine, UINT8 data);
READ16_HANDLER( neogeo_paletteram_r ); READ16_HANDLER( neogeo_paletteram_r );
WRITE16_HANDLER( neogeo_paletteram_w ); WRITE16_HANDLER( neogeo_paletteram_w );

View File

@ -54,7 +54,7 @@ extern void psx_sio_input( int, int, int );
WRITE32_HANDLER( psx_mdec_w ); WRITE32_HANDLER( psx_mdec_w );
READ32_HANDLER( psx_mdec_r ); READ32_HANDLER( psx_mdec_r );
extern void psx_machine_init( void ); extern void psx_machine_init( void );
extern void psx_driver_init( void ); extern void psx_driver_init( running_machine *machine );
#define PSX_H ( 1 ) #define PSX_H ( 1 )
#endif #endif

View File

@ -50,6 +50,6 @@ VIDEO_UPDATE(st0016);
extern UINT32 st0016_game; extern UINT32 st0016_game;
void st0016_save_init(void); void st0016_save_init(running_machine *machine);

View File

@ -31,9 +31,9 @@ MACHINE_RESET( demonwld );
MACHINE_RESET( vimana ); MACHINE_RESET( vimana );
MACHINE_RESET( zerozone ); /* hack for ZeroWing/OutZone. See video */ MACHINE_RESET( zerozone ); /* hack for ZeroWing/OutZone. See video */
extern void toaplan1_driver_savestate(void); extern void toaplan1_driver_savestate(running_machine *machine);
extern void demonwld_driver_savestate(void); extern void demonwld_driver_savestate(running_machine *machine);
extern void vimana_driver_savestate(void); extern void vimana_driver_savestate(running_machine *machine);
extern int toaplan1_unk_reset_port; extern int toaplan1_unk_reset_port;

View File

@ -7,7 +7,7 @@
/*----------- defined in drivers/wardner.c -----------*/ /*----------- defined in drivers/wardner.c -----------*/
extern void wardner_restore_bank(void); extern STATE_POSTLOAD( wardner_restore_bank );
/*----------- defined in machine/twincobr.c -----------*/ /*----------- defined in machine/twincobr.c -----------*/
@ -35,8 +35,8 @@ WRITE8_HANDLER( wardner_coin_dsp_w );
MACHINE_RESET( twincobr ); MACHINE_RESET( twincobr );
MACHINE_RESET( wardner ); MACHINE_RESET( wardner );
extern void twincobr_driver_savestate(void); extern void twincobr_driver_savestate(running_machine *machine);
extern void wardner_driver_savestate(void); extern void wardner_driver_savestate(running_machine *machine);
extern int toaplan_main_cpu; /* Main CPU type. 0 = 68000, 1 = Z80 */ extern int toaplan_main_cpu; /* Main CPU type. 0 = 68000, 1 = Z80 */
extern int twincobr_intenable; extern int twincobr_intenable;

View File

@ -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; 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; gtia_intf.console_read = console_read;
if (sndti_exists(SOUND_DAC, 0)) if (sndti_exists(SOUND_DAC, 0))
gtia_intf.console_write = console_write; gtia_intf.console_write = console_write;
gtia_init(&gtia_intf); gtia_init(machine, &gtia_intf);
/* pokey */ /* pokey */
add_reset_callback(Machine, pokey_reset); 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 ) 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 ) 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 ) 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 ) 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 ) MACHINE_START( a5200 )
{ {
atari_machine_start(ATARI_800XL, NULL, FALSE); atari_machine_start(machine, ATARI_800XL, NULL, FALSE);
} }

View File

@ -502,7 +502,7 @@ INLINE void update_bank(int bank)
} }
static void slapstic_postload(void) static STATE_POSTLOAD( slapstic_postload )
{ {
update_bank(slapstic_bank()); update_bank(slapstic_bank());
} }
@ -1639,7 +1639,7 @@ void atarigen_blend_gfx(running_machine *machine, int gfx0, int gfx1, int mask0,
SAVE STATE 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_scanline_int_state);
state_save_register_global(atarigen_sound_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); state_save_register_global(playfield2_latch);
/* need a postload to reset the state */ /* need a postload to reset the state */
state_save_register_func_postload(slapstic_postload); state_save_register_postload(machine, slapstic_postload, NULL);
} }

View File

@ -238,7 +238,7 @@ void atarigen_blend_gfx(running_machine *machine, int gfx0, int gfx1, int mask0,
STATE SAVE STATE SAVE
---------------------------------------------------------------*/ ---------------------------------------------------------------*/
void atarigen_init_save_state(void); void atarigen_init_save_state(running_machine *machine);
/*************************************************************************** /***************************************************************************
GENERAL ATARI NOTES GENERAL ATARI NOTES

View File

@ -1589,7 +1589,7 @@ WRITE8_HANDLER( decocass_de0091_w )
* state save setup * state save setup
* *
***************************************************************************/ ***************************************************************************/
static void decocass_state_save_postload(void) static STATE_POSTLOAD( decocass_state_save_postload )
{ {
#if 0 #if 0
/* fix me - this won't work anymore */ /* 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 */ /* 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_dir);
state_save_register_global(tape_speed); state_save_register_global(tape_speed);
state_save_register_global(tape_time0.seconds); state_save_register_global(tape_time0.seconds);

View File

@ -71,7 +71,7 @@ extern READ8_HANDLER( i8041_p1_r );
extern WRITE8_HANDLER( i8041_p2_w ); extern WRITE8_HANDLER( i8041_p2_w );
extern READ8_HANDLER( i8041_p2_r ); 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 -----------*/ /*----------- defined in video/decocass.c -----------*/
extern WRITE8_HANDLER( decocass_paletteram_w ); extern WRITE8_HANDLER( decocass_paletteram_w );

View File

@ -1535,7 +1535,7 @@ void psx_machine_init( void )
psx_gpu_reset(); psx_gpu_reset();
} }
static void psx_postload( void ) static STATE_POSTLOAD( psx_postload )
{ {
int n; int n;
@ -1559,7 +1559,7 @@ static void psx_postload( void )
mdec_cos_precalc(); mdec_cos_precalc();
} }
void psx_driver_init( void ) void psx_driver_init( running_machine *machine )
{ {
int n; 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_quantize_uv );
state_save_register_global_array( m_p_n_mdec_cos ); 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 );
} }

View File

@ -129,7 +129,7 @@ static void demonwld_dsp(int enable)
cpunum_set_input_line(Machine, 2, INPUT_LINE_HALT, ASSERT_LINE); 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); demonwld_dsp(demonwld_dsp_on);
} }
@ -299,7 +299,7 @@ MACHINE_RESET( toaplan1 )
toaplan1_unk_reset_port = 0; toaplan1_unk_reset_port = 0;
coin_lockout_global_w(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_intenable);
state_save_register_global(toaplan1_coin_count); state_save_register_global(toaplan1_coin_count);
@ -319,14 +319,14 @@ MACHINE_RESET( demonwld )
main_ram_seg = 0; main_ram_seg = 0;
dsp_execute = 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(demonwld_dsp_on);
state_save_register_global(dsp_addr_w); state_save_register_global(dsp_addr_w);
state_save_register_global(main_ram_seg); state_save_register_global(main_ram_seg);
state_save_register_global(demonwld_dsp_BIO); state_save_register_global(demonwld_dsp_BIO);
state_save_register_global(dsp_execute); 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 ) MACHINE_RESET( vimana )
@ -335,7 +335,7 @@ MACHINE_RESET( vimana )
vimana_credits = 0; vimana_credits = 0;
vimana_latch = 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_credits);
state_save_register_global(vimana_latch); state_save_register_global(vimana_latch);

View File

@ -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); twincobr_dsp(twincobr_dsp_on);
} }
@ -325,7 +325,7 @@ MACHINE_RESET( twincobr )
fsharkbt_8741 = -1; /* Reset the Flying Shark Bootleg MCU */ fsharkbt_8741 = -1; /* Reset the Flying Shark Bootleg MCU */
twincobr_dsp_BIO = CLEAR_LINE; 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(toaplan_main_cpu);
state_save_register_global(twincobr_intenable); 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(twincobr_dsp_BIO);
state_save_register_global(dsp_execute); state_save_register_global(dsp_execute);
state_save_register_global(fsharkbt_8741); 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 ) MACHINE_RESET( wardner )
@ -349,7 +349,7 @@ MACHINE_RESET( wardner )
twincobr_dsp_BIO = CLEAR_LINE; twincobr_dsp_BIO = CLEAR_LINE;
wardner_membank = 0; 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(toaplan_main_cpu);
state_save_register_global(twincobr_intenable); 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(twincobr_dsp_BIO);
state_save_register_global(dsp_execute); state_save_register_global(dsp_execute);
state_save_register_global(wardner_membank); state_save_register_global(wardner_membank);
state_save_register_func_postload(wardner_restore_bank); /* Restore the Main CPU bank */ state_save_register_postload(machine, wardner_restore_bank, NULL); /* Restore the Main CPU bank */
state_save_register_func_postload(twincobr_restore_dsp); state_save_register_postload(machine, twincobr_restore_dsp, NULL);
} }

View File

@ -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); 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_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); memory_configure_bank(1, 0, 9, &memory_region(REGION_CPU1)[0x10000], 0x1000);
defender_bank_select_w(machine, 0, 0); defender_bank_select_w(machine, 0, 0);
state_save_register_func_postload(defender_postload); state_save_register_postload(machine, defender_postload, NULL);
} }

View File

@ -44,7 +44,7 @@ static void asterix_tile_callback(int layer, int *code, int *color, int *flags)
VIDEO_START( asterix ) 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); 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); K053245_vh_start(machine,0, REGION_GFX2,NORMAL_PLANE_ORDER, asterix_sprite_callback);

View File

@ -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 */ 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); 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 ) VIDEO_START( asuka )

View File

@ -171,6 +171,13 @@ static TILE_GET_INFO( chaknpop_get_tx_tile_info )
Initialize video hardware emulation Initialize video hardware emulation
***************************************************************************/ ***************************************************************************/
static STATE_POSTLOAD( chaknpop_postload )
{
set_vram_bank();
tx_tilemap_mark_all_dirty();
}
VIDEO_START( chaknpop ) VIDEO_START( chaknpop )
{ {
UINT8 *RAM = memory_region(REGION_CPU1); UINT8 *RAM = memory_region(REGION_CPU1);
@ -194,8 +201,7 @@ VIDEO_START( chaknpop )
state_save_register_global(flip_x); state_save_register_global(flip_x);
state_save_register_global(flip_y); state_save_register_global(flip_y);
state_save_register_func_postload(set_vram_bank); state_save_register_postload(machine, chaknpop_postload, NULL);
state_save_register_func_postload(tx_tilemap_mark_all_dirty);
} }

View File

@ -165,6 +165,11 @@ static TILE_GET_INFO( get_bg_tile_info )
SET_TILE_INFO(0, code, 0, 0); SET_TILE_INFO(0, code, 0, 0);
} }
static STATE_POSTLOAD( cloak_postload )
{
set_current_bitmap_videoram_pointer();
}
VIDEO_START( cloak ) VIDEO_START( cloak )
{ {
bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); 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_videoram1, 256*256);
state_save_register_global_pointer(bitmap_videoram2, 256*256); state_save_register_global_pointer(bitmap_videoram2, 256*256);
state_save_register_global_pointer(palette_ram, NUM_PENS); 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) static void draw_bitmap(bitmap_t *bitmap, const rectangle *cliprect)

View File

@ -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); 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 ) VIDEO_START( darius )
@ -50,12 +45,9 @@ VIDEO_START( darius )
spritelist = auto_malloc(0x800 * sizeof(*spritelist)); spritelist = auto_malloc(0x800 * sizeof(*spritelist));
/* (chips, gfxnum, x_offs, y_offs, y_invert, opaque, dblwidth) */ /* (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); 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);
} }
/***************************************************************************/ /***************************************************************************/

View File

@ -93,7 +93,7 @@ static void sortlayers(int *layer, int *pri)
VIDEO_START( dbz ) 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); 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); K053247_vh_start(machine, REGION_GFX2, -52, 16, NORMAL_PLANE_ORDER, dbz_sprite_callback);

View File

@ -41,7 +41,7 @@ VIDEO_START( gijoe )
{ {
int i; 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_vh_start(machine, REGION_GFX1, K056832_BPP_4, 1, NULL, gijoe_tile_callback, 0);
K056832_linemap_enable(1); K056832_linemap_enable(1);

View File

@ -29,8 +29,8 @@ gtia_struct gtia;
#define VERBOSE 0 #define VERBOSE 0
static void gtia_reset(running_machine *machine); static void gtia_reset(running_machine *machine);
static void gtia_state(void); static void gtia_state(running_machine *machine);
static void gtia_state_postload(void); static STATE_POSTLOAD( gtia_state_postload );
/********************************************** /**********************************************
* split a color into hue and luminance values * 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)); memset(&gtia, 0, sizeof(gtia));
gtia.intf = *intf; gtia.intf = *intf;
@ -72,12 +72,12 @@ void gtia_init(const gtia_interface *intf)
add_reset_callback(Machine, gtia_reset); add_reset_callback(Machine, gtia_reset);
/* state saves */ /* 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.m0pf);
state_save_register_global(gtia.r.m1pf); 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.gractl);
state_save_register_global(gtia.w.hitclr); state_save_register_global(gtia.w.hitclr);
state_save_register_global(gtia.w.cons); 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_p0();
recalc_p1(); recalc_p1();

View File

@ -138,7 +138,7 @@ struct _gtia_struct
extern gtia_struct gtia; 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 ); READ8_HANDLER( atari_gtia_r );
WRITE8_HANDLER( atari_gtia_w ); WRITE8_HANDLER( atari_gtia_w );

View File

@ -802,6 +802,10 @@ static TIMER_CALLBACK( cojag_scanline_update )
} while (!adjust_object_timer(machine, vc)); } while (!adjust_object_timer(machine, vc));
} }
static STATE_POSTLOAD( cojag_postload )
{
update_cpu_irq();
}
VIDEO_START( cojag ) VIDEO_START( cojag )
{ {
@ -818,7 +822,7 @@ VIDEO_START( cojag )
state_save_register_global_array(blitter_regs); state_save_register_global_array(blitter_regs);
state_save_register_global_array(gpu_regs); state_save_register_global_array(gpu_regs);
state_save_register_global(cpu_irq_state); state_save_register_global(cpu_irq_state);
state_save_register_func_postload(update_cpu_irq); state_save_register_postload(machine, cojag_postload, NULL);
} }

View File

@ -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 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]; int data = K052109_ram[0x1e80];
tilemap_set_flip(K052109_tilemap[0],(data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); 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_array(K052109_dy);
state_save_register_global(has_extra_video_ram); 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 ) READ8_HANDLER( K052109_r )
@ -5077,7 +5077,7 @@ static int K053251_palette_index[5];
static tilemap *K053251_tilemaps[5]; static tilemap *K053251_tilemaps[5];
static int K053251_tilemaps_set; 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[0] = 32 * ((K053251_ram[9] >> 0) & 0x03);
K053251_palette_index[1] = 32 * ((K053251_ram[9] >> 2) & 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); 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); K053251_set_tilemaps(NULL,NULL,NULL,NULL,NULL);
state_save_register_global_array(K053251_ram); 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) 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(); 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, void K056832_vh_start(running_machine *machine, int gfx_memory_region, int bpp, int big,
int (*scrolld)[4][2], int (*scrolld)[4][2],
void (*callback)(int layer, int *code, int *color, int *flags), 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_dy);
state_save_register_global_array(K056832_LayerTileMode); state_save_register_global_array(K056832_LayerTileMode);
state_save_register_func_postload(K056832_UpdatePageLayout); state_save_register_postload(machine, K056832_postload, NULL);
state_save_register_func_postload(K056832_change_rambank);
state_save_register_func_postload(K056832_change_rombank);
} }
/* call if a game uses external linescroll */ /* call if a game uses external linescroll */

View File

@ -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_priority(int ci);
int K053251_get_palette_index(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_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 ); WRITE8_HANDLER( K054000_w );

View File

@ -49,7 +49,7 @@ VIDEO_START(lethalen)
{ {
int i; int i;
K053251_vh_start(); K053251_vh_start(machine);
K056832_vh_start(machine, REGION_GFX1, K056832_BPP_8LE, 1, NULL, lethalen_tile_callback, 0); K056832_vh_start(machine, REGION_GFX1, K056832_BPP_8LE, 1, NULL, lethalen_tile_callback, 0);

View File

@ -47,7 +47,7 @@ VIDEO_START(moo)
alpha_enabled = 0; alpha_enabled = 0;
K053251_vh_start(); K053251_vh_start(machine);
K054338_vh_start(); K054338_vh_start();
K056832_vh_start(machine, REGION_GFX1, K056832_BPP_4, 1, NULL, moo_tile_callback, 0); K056832_vh_start(machine, REGION_GFX1, K056832_BPP_4, 1, NULL, moo_tile_callback, 0);

Some files were not shown because too many files have changed in this diff Show More