diff options
author | Aaron Giles <aaron@aarongiles.com> | 2011-02-08 16:55:59 +0000 |
---|---|---|
committer | Aaron Giles <aaron@aarongiles.com> | 2011-02-08 16:55:59 +0000 |
commit | 44e80e9a063a4539cb6b48388acd295ff11f3036 (patch) | |
tree | f4c8f3703afd88fd6fd41c7d6613ab723eb63f21 /src/mame/drivers/backfire.c | |
parent | 08f236d927beb545449301cab7cc7f0f2b102bb4 (diff) |
Take advantage of the driver_device to clean up state saving for
many drivers. Also move some allocated memory into arrays in the
state structure where appropriate (this is still in progress).
Regex'es used (in src/mame only):
state_save_register_global( *)\(( *)([^,]+), *state->([^ )]+)( *)\)
state->save_item\1\(\2NAME\(state->\4\)\5\)
state_save_register_global_array( *)\(( *)([^,]+), *state->([^ )]+)( *)\)
state->save_item\1\(\2NAME\(state->\4\)\5\)
state_save_register_global_bitmap( *)\(( *)([^,]+), *state->([^ )]+)( *)\)
state->save_item\1\(\2NAME\(*state->\4\)\5\)
state_save_register_global_pointer( *)\(( *)([^,]+), *state->([^,]+),
state->save_pointer\1\(\2NAME\(state->\4\)\5,
Diffstat (limited to 'src/mame/drivers/backfire.c')
-rw-r--r-- | src/mame/drivers/backfire.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/mame/drivers/backfire.c b/src/mame/drivers/backfire.c index eb4fbfc6174..39f54891ece 100644 --- a/src/mame/drivers/backfire.c +++ b/src/mame/drivers/backfire.c @@ -27,10 +27,6 @@ public: : driver_device(machine, config) { } /* memory pointers */ - UINT16 * pf1_rowscroll; - UINT16 * pf2_rowscroll; - UINT16 * pf3_rowscroll; - UINT16 * pf4_rowscroll; UINT32 * spriteram_1; UINT32 * spriteram_2; UINT32 * mainram; @@ -47,6 +43,12 @@ public: device_t *lscreen; device_t *rscreen; device_t *eeprom; + + /* memory */ + UINT16 pf1_rowscroll[0x0800/2]; + UINT16 pf2_rowscroll[0x0800/2]; + UINT16 pf3_rowscroll[0x0800/2]; + UINT16 pf4_rowscroll[0x0800/2]; }; //UINT32 *backfire_180010, *backfire_188010; @@ -56,23 +58,17 @@ static VIDEO_START( backfire ) { backfire_state *state = machine->driver_data<backfire_state>(); - /* allocate the ram as 16-bit (we do it here because the CPU is 32-bit) */ - state->pf1_rowscroll = auto_alloc_array(machine, UINT16, 0x0800/2); - state->pf2_rowscroll = auto_alloc_array(machine, UINT16, 0x0800/2); - state->pf3_rowscroll = auto_alloc_array(machine, UINT16, 0x0800/2); - state->pf4_rowscroll = auto_alloc_array(machine, UINT16, 0x0800/2); - /* and register the allocated ram so that save states still work */ - state_save_register_global_pointer(machine, state->pf1_rowscroll, 0x800/2); - state_save_register_global_pointer(machine, state->pf2_rowscroll, 0x800/2); - state_save_register_global_pointer(machine, state->pf3_rowscroll, 0x800/2); - state_save_register_global_pointer(machine, state->pf4_rowscroll, 0x800/2); + state->save_item(NAME(state->pf1_rowscroll)); + state->save_item(NAME(state->pf2_rowscroll)); + state->save_item(NAME(state->pf3_rowscroll)); + state->save_item(NAME(state->pf4_rowscroll)); state->left = auto_bitmap_alloc(machine, 80*8, 32*8, BITMAP_FORMAT_INDEXED16); state->right = auto_bitmap_alloc(machine, 80*8, 32*8, BITMAP_FORMAT_INDEXED16); - state_save_register_global_bitmap(machine, state->left); - state_save_register_global_bitmap(machine, state->right); + state->save_item(NAME(*state->left)); + state->save_item(NAME(*state->right)); } static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT32 *spriteram, int region ) |