save: Give the device when available to the state save subsystem [O. Galibert]

This commit is contained in:
Olivier Galibert 2014-12-23 23:25:56 +01:00
parent a51ee3e00f
commit eeedd8a4ca
15 changed files with 119 additions and 109 deletions

View File

@ -44,7 +44,7 @@ ioport_constructor serial_keyboard_device::device_input_ports() const
void serial_keyboard_device::device_start() void serial_keyboard_device::device_start()
{ {
generic_keyboard_device::device_start(); generic_keyboard_device::device_start();
device_serial_interface::register_save_state(machine().save(), name(), tag()); device_serial_interface::register_save_state(machine().save(), this);
save_item(NAME(m_curr_key)); save_item(NAME(m_curr_key));
save_item(NAME(m_key_valid)); save_item(NAME(m_key_valid));
} }

View File

@ -66,11 +66,11 @@ void psxdma_device::device_start()
dma->timer = timer_alloc(index); dma->timer = timer_alloc(index);
machine().save().save_item( "psxdma", tag(), index, NAME( dma->n_base ) ); save_item( NAME( dma->n_base ), index );
machine().save().save_item( "psxdma", tag(), index, NAME( dma->n_blockcontrol ) ); save_item( NAME( dma->n_blockcontrol ), index );
machine().save().save_item( "psxdma", tag(), index, NAME( dma->n_channelcontrol ) ); save_item( NAME( dma->n_channelcontrol ), index );
machine().save().save_item( "psxdma", tag(), index, NAME( dma->n_ticks ) ); save_item( NAME( dma->n_ticks ), index );
machine().save().save_item( "psxdma", tag(), index, NAME( dma->b_running ) ); save_item( NAME( dma->b_running ), index );
} }
save_item( NAME(m_dpcp) ); save_item( NAME(m_dpcp) );

View File

@ -192,9 +192,9 @@ public:
// state saving interfaces // state saving interfaces
template<typename _ItemType> template<typename _ItemType>
void ATTR_COLD save_item(_ItemType &value, const char *valname, int index = 0) { assert(m_save != NULL); m_save->save_item(name(), tag(), index, value, valname); } void ATTR_COLD save_item(_ItemType &value, const char *valname, int index = 0) { assert(m_save != NULL); m_save->save_item(this, name(), tag(), index, value, valname); }
template<typename _ItemType> template<typename _ItemType>
void ATTR_COLD save_pointer(_ItemType *value, const char *valname, UINT32 count, int index = 0) { assert(m_save != NULL); m_save->save_pointer(name(), tag(), index, value, valname, count); } void ATTR_COLD save_pointer(_ItemType *value, const char *valname, UINT32 count, int index = 0) { assert(m_save != NULL); m_save->save_pointer(this, name(), tag(), index, value, valname, count); }
// debugging // debugging
device_debug *debug() const { return m_debug; } device_debug *debug() const { return m_debug; }

View File

@ -50,28 +50,30 @@ device_serial_interface::~device_serial_interface()
{ {
} }
void device_serial_interface::register_save_state(save_manager &save, const char *module, const char *tag) void device_serial_interface::register_save_state(save_manager &save, device_t *device)
{ {
save.save_item(module, tag, 0, NAME(m_df_start_bit_count)); const char *module = device->name();
save.save_item(module, tag, 0, NAME(m_df_word_length)); const char *tag = device->tag();
save.save_item(module, tag, 0, NAME(m_df_parity)); save.save_item(device, module, tag, 0, NAME(m_df_start_bit_count));
save.save_item(module, tag, 0, NAME(m_df_stop_bit_count)); save.save_item(device, module, tag, 0, NAME(m_df_word_length));
save.save_item(module, tag, 0, NAME(m_rcv_register_data)); save.save_item(device, module, tag, 0, NAME(m_df_parity));
save.save_item(module, tag, 0, NAME(m_rcv_flags)); save.save_item(device, module, tag, 0, NAME(m_df_stop_bit_count));
save.save_item(module, tag, 0, NAME(m_rcv_bit_count_received)); save.save_item(device, module, tag, 0, NAME(m_rcv_register_data));
save.save_item(module, tag, 0, NAME(m_rcv_bit_count)); save.save_item(device, module, tag, 0, NAME(m_rcv_flags));
save.save_item(module, tag, 0, NAME(m_rcv_byte_received)); save.save_item(device, module, tag, 0, NAME(m_rcv_bit_count_received));
save.save_item(module, tag, 0, NAME(m_rcv_framing_error)); save.save_item(device, module, tag, 0, NAME(m_rcv_bit_count));
save.save_item(module, tag, 0, NAME(m_rcv_parity_error)); save.save_item(device, module, tag, 0, NAME(m_rcv_byte_received));
save.save_item(module, tag, 0, NAME(m_tra_register_data)); save.save_item(device, module, tag, 0, NAME(m_rcv_framing_error));
save.save_item(module, tag, 0, NAME(m_tra_flags)); save.save_item(device, module, tag, 0, NAME(m_rcv_parity_error));
save.save_item(module, tag, 0, NAME(m_tra_bit_count_transmitted)); save.save_item(device, module, tag, 0, NAME(m_tra_register_data));
save.save_item(module, tag, 0, NAME(m_tra_bit_count)); save.save_item(device, module, tag, 0, NAME(m_tra_flags));
save.save_item(module, tag, 0, NAME(m_rcv_rate)); save.save_item(device, module, tag, 0, NAME(m_tra_bit_count_transmitted));
save.save_item(module, tag, 0, NAME(m_tra_rate)); save.save_item(device, module, tag, 0, NAME(m_tra_bit_count));
save.save_item(module, tag, 0, NAME(m_rcv_line)); save.save_item(device, module, tag, 0, NAME(m_rcv_rate));
save.save_item(module, tag, 0, NAME(m_tra_clock_state)); save.save_item(device, module, tag, 0, NAME(m_tra_rate));
save.save_item(module, tag, 0, NAME(m_rcv_clock_state)); save.save_item(device, module, tag, 0, NAME(m_rcv_line));
save.save_item(device, module, tag, 0, NAME(m_tra_clock_state));
save.save_item(device, module, tag, 0, NAME(m_rcv_clock_state));
} }
void device_serial_interface::interface_pre_start() void device_serial_interface::interface_pre_start()

View File

@ -130,7 +130,7 @@ protected:
const char *parity_tostring(parity_t stop_bits); const char *parity_tostring(parity_t stop_bits);
const char *stop_bits_tostring(stop_bits_t stop_bits); const char *stop_bits_tostring(stop_bits_t stop_bits);
void register_save_state(save_manager &save, const char *module, const char *tag); void register_save_state(save_manager &save, device_t *device);
private: private:
enum { TRA_TIMER_ID = 10000, RCV_TIMER_ID }; enum { TRA_TIMER_ID = 10000, RCV_TIMER_ID };

View File

@ -77,7 +77,7 @@ void i8251_device::device_start()
save_item(NAME(m_data)); save_item(NAME(m_data));
save_item(NAME(m_tx_busy)); save_item(NAME(m_tx_busy));
save_item(NAME(m_disable_tx_pending)); save_item(NAME(m_disable_tx_pending));
device_serial_interface::register_save_state(machine().save(), name(), tag()); device_serial_interface::register_save_state(machine().save(), this);
} }

View File

@ -544,7 +544,7 @@ void ins8250_uart_device::device_start()
set_tra_rate(0); set_tra_rate(0);
set_rcv_rate(0); set_rcv_rate(0);
device_serial_interface::register_save_state(machine().save(), name(), tag()); device_serial_interface::register_save_state(machine().save(), this);
save_item(NAME(m_regs.thr)); save_item(NAME(m_regs.thr));
save_item(NAME(m_regs.rbr)); save_item(NAME(m_regs.rbr));
save_item(NAME(m_regs.ier)); save_item(NAME(m_regs.ier));

View File

@ -563,7 +563,7 @@ void z80dart_channel::device_start()
save_item(NAME(m_dtr)); save_item(NAME(m_dtr));
save_item(NAME(m_rts)); save_item(NAME(m_rts));
save_item(NAME(m_sync)); save_item(NAME(m_sync));
device_serial_interface::register_save_state(machine().save(), name(), tag()); device_serial_interface::register_save_state(machine().save(), this);
} }

View File

@ -3874,7 +3874,7 @@ memory_block::memory_block(address_space &space, offs_t bytestart, offs_t byteen
int bytes_per_element = space.data_width() / 8; int bytes_per_element = space.data_width() / 8;
astring name; astring name;
name.printf("%08x-%08x", bytestart, byteend); name.printf("%08x-%08x", bytestart, byteend);
space.machine().save().save_memory("memory", space.device().tag(), space.spacenum(), name, m_data, bytes_per_element, (UINT32)(byteend + 1 - bytestart) / bytes_per_element); space.machine().save().save_memory(NULL, "memory", space.device().tag(), space.spacenum(), name, m_data, bytes_per_element, (UINT32)(byteend + 1 - bytestart) / bytes_per_element);
} }
} }
@ -3921,7 +3921,7 @@ memory_bank::memory_bank(address_space &space, int index, offs_t bytestart, offs
} }
if (!m_anonymous && space.machine().save().registration_allowed()) if (!m_anonymous && space.machine().save().registration_allowed())
space.machine().save().save_item("memory", m_tag, 0, NAME(m_curentry)); space.machine().save().save_item(NULL, "memory", m_tag, 0, NAME(m_curentry));
} }

View File

@ -147,7 +147,7 @@ void save_manager::register_postload(save_prepost_delegate func)
// memory // memory
//------------------------------------------------- //-------------------------------------------------
void save_manager::save_memory(const char *module, const char *tag, UINT32 index, const char *name, void *val, UINT32 valsize, UINT32 valcount) void save_manager::save_memory(device_t *device, const char *module, const char *tag, UINT32 index, const char *name, void *val, UINT32 valsize, UINT32 valcount)
{ {
assert(valsize == 1 || valsize == 2 || valsize == 4 || valsize == 8); assert(valsize == 1 || valsize == 2 || valsize == 4 || valsize == 8);
@ -183,7 +183,7 @@ void save_manager::save_memory(const char *module, const char *tag, UINT32 index
} }
// insert us into the list // insert us into the list
m_entry_list.insert_after(*global_alloc(state_entry(val, totalname, valsize, valcount)), insert_after); m_entry_list.insert_after(*global_alloc(state_entry(val, totalname, device, module, tag ? tag : "", index, valsize, valcount)), insert_after);
} }
@ -419,10 +419,14 @@ save_manager::state_callback::state_callback(save_prepost_delegate callback)
// state_entry - constructor // state_entry - constructor
//------------------------------------------------- //-------------------------------------------------
save_manager::state_entry::state_entry(void *data, const char *name, UINT8 size, UINT32 count) state_entry::state_entry(void *data, const char *name, device_t *device, const char *module, const char *tag, int index, UINT8 size, UINT32 count)
: m_next(NULL), : m_next(NULL),
m_data(data), m_data(data),
m_name(name), m_name(name),
m_device(device),
m_module(module),
m_tag(tag),
m_index(index),
m_typesize(size), m_typesize(size),
m_typecount(count), m_typecount(count),
m_offset(0) m_offset(0)
@ -435,7 +439,7 @@ save_manager::state_entry::state_entry(void *data, const char *name, UINT8 size,
// block of data // block of data
//------------------------------------------------- //-------------------------------------------------
void save_manager::state_entry::flip_data() void state_entry::flip_data()
{ {
UINT16 *data16; UINT16 *data16;
UINT32 *data32; UINT32 *data32;

View File

@ -51,24 +51,24 @@ typedef delegate<void ()> save_prepost_delegate;
// use this as above, but also to declare that dynamic_array<TYPE> is safe as well // use this as above, but also to declare that dynamic_array<TYPE> is safe as well
#define ALLOW_SAVE_TYPE_AND_ARRAY(TYPE) \ #define ALLOW_SAVE_TYPE_AND_ARRAY(TYPE) \
ALLOW_SAVE_TYPE(TYPE); \ ALLOW_SAVE_TYPE(TYPE); \
template<> inline void save_manager::save_item(const char *module, const char *tag, int index, dynamic_array<TYPE> &value, const char *name) { save_memory(module, tag, index, name, &value[0], sizeof(TYPE), value.count()); } template<> inline void save_manager::save_item(device_t *device, const char *module, const char *tag, int index, dynamic_array<TYPE> &value, const char *name) { save_memory(device, module, tag, index, name, &value[0], sizeof(TYPE), value.count()); }
// register items with explicit tags // register items with explicit tags
#define state_save_register_item(_mach, _mod, _tag, _index, _val) \ #define state_save_register_item(_mach, _mod, _tag, _index, _val) \
(_mach).save().save_item(_mod, _tag, _index, _val, #_val) (_mach).save().save_item(NULL, _mod, _tag, _index, _val, #_val)
#define state_save_register_item_pointer(_mach, _mod, _tag, _index, _val, _count) \ #define state_save_register_item_pointer(_mach, _mod, _tag, _index, _val, _count) \
(_mach).save().save_pointer(_mod, _tag, _index, _val, #_val, _count) (_mach).save().save_pointer(NULL, _mod, _tag, _index, _val, #_val, _count)
#define state_save_register_item_array(_mach, _mod, _tag, _index, _val) \ #define state_save_register_item_array(_mach, _mod, _tag, _index, _val) \
(_mach).save().save_item(_mod, _tag, _index, _val, #_val) (_mach).save().save_item(NULL, _mod, _tag, _index, _val, #_val)
#define state_save_register_item_2d_array(_mach, _mod, _tag, _index, _val) \ #define state_save_register_item_2d_array(_mach, _mod, _tag, _index, _val) \
(_mach).save().save_item(_mod, _tag, _index, _val, #_val) (_mach).save().save_item(NULL, _mod, _tag, _index, _val, #_val)
#define state_save_register_item_bitmap(_mach, _mod, _tag, _index, _val) \ #define state_save_register_item_bitmap(_mach, _mod, _tag, _index, _val) \
(_mach).save().save_item(_mod, _tag, _index, *(_val), #_val) (_mach).save().save_item(NULL, _mod, _tag, _index, *(_val), #_val)
@ -76,6 +76,31 @@ typedef delegate<void ()> save_prepost_delegate;
// TYPE DEFINITIONS // TYPE DEFINITIONS
//************************************************************************** //**************************************************************************
class state_entry
{
public:
// construction/destruction
state_entry(void *data, const char *name, device_t *device, const char *module, const char *tag, int index, UINT8 size, UINT32 count);
// getters
state_entry *next() const { return m_next; }
// helpers
void flip_data();
// state
state_entry * m_next; // pointer to next entry
void * m_data; // pointer to the memory to save/restore
astring m_name; // full name
device_t * m_device; // associated device, NULL if none
astring m_module; // module name
astring m_tag; // tag name
int m_index; // index
UINT8 m_typesize; // size of the raw data type
UINT32 m_typecount; // number of items
UINT32 m_offset; // offset within the final structure
};
class save_manager class save_manager
{ {
// type_checker is a set of templates to identify valid save types // type_checker is a set of templates to identify valid save types
@ -104,46 +129,46 @@ public:
void dispatch_postload(); void dispatch_postload();
// generic memory registration // generic memory registration
void save_memory(const char *module, const char *tag, UINT32 index, const char *name, void *val, UINT32 valsize, UINT32 valcount = 1); void save_memory(device_t *device, const char *module, const char *tag, UINT32 index, const char *name, void *val, UINT32 valsize, UINT32 valcount = 1);
// templatized wrapper for general objects // templatized wrapper for general objects
template<typename _ItemType> template<typename _ItemType>
void save_item(const char *module, const char *tag, int index, _ItemType &value, const char *valname) void save_item(device_t *device, const char *module, const char *tag, int index, _ItemType &value, const char *valname)
{ {
if (type_checker<_ItemType>::is_pointer) throw emu_fatalerror("Called save_item on a pointer with no count!"); if (type_checker<_ItemType>::is_pointer) throw emu_fatalerror("Called save_item on a pointer with no count!");
if (!type_checker<_ItemType>::is_atom) throw emu_fatalerror("Called save_item on a non-fundamental type!"); if (!type_checker<_ItemType>::is_atom) throw emu_fatalerror("Called save_item on a non-fundamental type!");
save_memory(module, tag, index, valname, &value, sizeof(value)); save_memory(device, module, tag, index, valname, &value, sizeof(value));
} }
// templatized wrapper for 1-dimensional arrays // templatized wrapper for 1-dimensional arrays
template<typename _ItemType, std::size_t N> template<typename _ItemType, std::size_t N>
void save_item(const char *module, const char *tag, int index, _ItemType (&value)[N], const char *valname) void save_item(device_t *device, const char *module, const char *tag, int index, _ItemType (&value)[N], const char *valname)
{ {
if (!type_checker<_ItemType>::is_atom) throw emu_fatalerror("Called save_item on a non-fundamental type!"); if (!type_checker<_ItemType>::is_atom) throw emu_fatalerror("Called save_item on a non-fundamental type!");
save_memory(module, tag, index, valname, &value[0], sizeof(value[0]), N); save_memory(device, module, tag, index, valname, &value[0], sizeof(value[0]), N);
} }
// templatized wrapper for 2-dimensional arrays // templatized wrapper for 2-dimensional arrays
template<typename _ItemType, std::size_t M, std::size_t N> template<typename _ItemType, std::size_t M, std::size_t N>
void save_item(const char *module, const char *tag, int index, _ItemType (&value)[M][N], const char *valname) void save_item(device_t *device, const char *module, const char *tag, int index, _ItemType (&value)[M][N], const char *valname)
{ {
if (!type_checker<_ItemType>::is_atom) throw emu_fatalerror("Called save_item on a non-fundamental type!"); if (!type_checker<_ItemType>::is_atom) throw emu_fatalerror("Called save_item on a non-fundamental type!");
save_memory(module, tag, index, valname, &value[0][0], sizeof(value[0][0]), M * N); save_memory(device, module, tag, index, valname, &value[0][0], sizeof(value[0][0]), M * N);
} }
// templatized wrapper for pointers // templatized wrapper for pointers
template<typename _ItemType> template<typename _ItemType>
void save_pointer(const char *module, const char *tag, int index, _ItemType *value, const char *valname, UINT32 count) void save_pointer(device_t *device, const char *module, const char *tag, int index, _ItemType *value, const char *valname, UINT32 count)
{ {
if (!type_checker<_ItemType>::is_atom) throw emu_fatalerror("Called save_item on a non-fundamental type!"); if (!type_checker<_ItemType>::is_atom) throw emu_fatalerror("Called save_item on a non-fundamental type!");
save_memory(module, tag, index, valname, value, sizeof(*value), count); save_memory(device, module, tag, index, valname, value, sizeof(*value), count);
} }
// global memory registration // global memory registration
template<typename _ItemType> template<typename _ItemType>
void save_item(_ItemType &value, const char *valname, int index = 0) { save_item("global", NULL, index, value, valname); } void save_item(_ItemType &value, const char *valname, int index = 0) { save_item(NULL, "global", NULL, index, value, valname); }
template<typename _ItemType> template<typename _ItemType>
void save_pointer(_ItemType *value, const char *valname, UINT32 count, int index = 0) { save_pointer("global", NULL, index, value, valname, count); } void save_pointer(_ItemType *value, const char *valname, UINT32 count, int index = 0) { save_pointer(NULL, "global", NULL, index, value, valname, count); }
// file processing // file processing
static save_error check_file(running_machine &machine, emu_file &file, const char *gamename, void (CLIB_DECL *errormsg)(const char *fmt, ...)); static save_error check_file(running_machine &machine, emu_file &file, const char *gamename, void (CLIB_DECL *errormsg)(const char *fmt, ...));
@ -171,27 +196,6 @@ private:
save_prepost_delegate m_func; // delegate save_prepost_delegate m_func; // delegate
}; };
class state_entry
{
public:
// construction/destruction
state_entry(void *data, const char *name, UINT8 size, UINT32 count);
// getters
state_entry *next() const { return m_next; }
// helpers
void flip_data();
// state
state_entry * m_next; // pointer to next entry
void * m_data; // pointer to the memory to save/restore
astring m_name; // full name
UINT8 m_typesize; // size of the raw data type
UINT32 m_typecount; // number of items
UINT32 m_offset; // offset within the final structure
};
// internal state // internal state
running_machine & m_machine; // reference to our machine running_machine & m_machine; // reference to our machine
bool m_reg_allowed; // are registrations allowed? bool m_reg_allowed; // are registrations allowed?
@ -232,27 +236,27 @@ ALLOW_SAVE_TYPE_AND_ARRAY(rgb_t);
//------------------------------------------------- //-------------------------------------------------
template<> template<>
inline void save_manager::save_item(const char *module, const char *tag, int index, bitmap_ind8 &value, const char *name) inline void save_manager::save_item(device_t *device, const char *module, const char *tag, int index, bitmap_ind8 &value, const char *name)
{ {
save_memory(module, tag, index, name, &value.pix(0), value.bpp() / 8, value.rowpixels() * value.height()); save_memory(device, module, tag, index, name, &value.pix(0), value.bpp() / 8, value.rowpixels() * value.height());
} }
template<> template<>
inline void save_manager::save_item(const char *module, const char *tag, int index, bitmap_ind16 &value, const char *name) inline void save_manager::save_item(device_t *device, const char *module, const char *tag, int index, bitmap_ind16 &value, const char *name)
{ {
save_memory(module, tag, index, name, &value.pix(0), value.bpp() / 8, value.rowpixels() * value.height()); save_memory(device, module, tag, index, name, &value.pix(0), value.bpp() / 8, value.rowpixels() * value.height());
} }
template<> template<>
inline void save_manager::save_item(const char *module, const char *tag, int index, bitmap_ind32 &value, const char *name) inline void save_manager::save_item(device_t *device, const char *module, const char *tag, int index, bitmap_ind32 &value, const char *name)
{ {
save_memory(module, tag, index, name, &value.pix(0), value.bpp() / 8, value.rowpixels() * value.height()); save_memory(device, module, tag, index, name, &value.pix(0), value.bpp() / 8, value.rowpixels() * value.height());
} }
template<> template<>
inline void save_manager::save_item(const char *module, const char *tag, int index, bitmap_rgb32 &value, const char *name) inline void save_manager::save_item(device_t *device, const char *module, const char *tag, int index, bitmap_rgb32 &value, const char *name)
{ {
save_memory(module, tag, index, name, &value.pix(0), value.bpp() / 8, value.rowpixels() * value.height()); save_memory(device, module, tag, index, name, &value.pix(0), value.bpp() / 8, value.rowpixels() * value.height());
} }
@ -261,12 +265,12 @@ inline void save_manager::save_item(const char *module, const char *tag, int ind
//------------------------------------------------- //-------------------------------------------------
template<> template<>
inline void save_manager::save_item(const char *module, const char *tag, int index, attotime &value, const char *name) inline void save_manager::save_item(device_t *device, const char *module, const char *tag, int index, attotime &value, const char *name)
{ {
astring tempstr(name, ".attoseconds"); astring tempstr(name, ".attoseconds");
save_memory(module, tag, index, tempstr, &value.attoseconds, sizeof(value.attoseconds)); save_memory(device, module, tag, index, tempstr, &value.attoseconds, sizeof(value.attoseconds));
tempstr.cpy(name).cat(".seconds"); tempstr.cpy(name).cat(".seconds");
save_memory(module, tag, index, tempstr, &value.seconds, sizeof(value.seconds)); save_memory(device, module, tag, index, tempstr, &value.seconds, sizeof(value.seconds));
} }

View File

@ -260,11 +260,11 @@ void emu_timer::register_save()
} }
// save the bits // save the bits
machine().save().save_item("timer", name, index, NAME(m_param)); machine().save().save_item(m_device, "timer", name, index, NAME(m_param));
machine().save().save_item("timer", name, index, NAME(m_enabled)); machine().save().save_item(m_device, "timer", name, index, NAME(m_enabled));
machine().save().save_item("timer", name, index, NAME(m_period)); machine().save().save_item(m_device, "timer", name, index, NAME(m_period));
machine().save().save_item("timer", name, index, NAME(m_start)); machine().save().save_item(m_device, "timer", name, index, NAME(m_start));
machine().save().save_item("timer", name, index, NAME(m_expire)); machine().save().save_item(m_device, "timer", name, index, NAME(m_expire));
} }

View File

@ -77,19 +77,19 @@ sound_stream::sound_stream(device_t &device, int inputs, int outputs, int sample
// create a unique tag for saving // create a unique tag for saving
astring state_tag; astring state_tag;
state_tag.printf("%d", m_device.machine().sound().m_stream_list.count()); state_tag.printf("%d", m_device.machine().sound().m_stream_list.count());
m_device.machine().save().save_item("stream", state_tag, 0, NAME(m_sample_rate)); m_device.machine().save().save_item(&m_device, "stream", state_tag, 0, NAME(m_sample_rate));
m_device.machine().save().register_postload(save_prepost_delegate(FUNC(sound_stream::postload), this)); m_device.machine().save().register_postload(save_prepost_delegate(FUNC(sound_stream::postload), this));
// save the gain of each input and output // save the gain of each input and output
for (int inputnum = 0; inputnum < m_input.count(); inputnum++) for (int inputnum = 0; inputnum < m_input.count(); inputnum++)
{ {
m_device.machine().save().save_item("stream", state_tag, inputnum, NAME(m_input[inputnum].m_gain)); m_device.machine().save().save_item(&m_device, "stream", state_tag, inputnum, NAME(m_input[inputnum].m_gain));
m_device.machine().save().save_item("stream", state_tag, inputnum, NAME(m_input[inputnum].m_user_gain)); m_device.machine().save().save_item(&m_device, "stream", state_tag, inputnum, NAME(m_input[inputnum].m_user_gain));
} }
for (int outputnum = 0; outputnum < m_output.count(); outputnum++) for (int outputnum = 0; outputnum < m_output.count(); outputnum++)
{ {
m_output[outputnum].m_stream = this; m_output[outputnum].m_stream = this;
m_device.machine().save().save_item("stream", state_tag, outputnum, NAME(m_output[outputnum].m_gain)); m_device.machine().save().save_item(&m_device, "stream", state_tag, outputnum, NAME(m_output[outputnum].m_gain));
} }
// Mark synchronous streams as such // Mark synchronous streams as such

View File

@ -407,17 +407,17 @@ tilemap_t &tilemap_t::init(tilemap_manager &manager, device_gfx_interface &decod
// save relevant state // save relevant state
int instance = manager.alloc_instance(); int instance = manager.alloc_instance();
machine().save().save_item("tilemap", NULL, instance, NAME(m_enable)); machine().save().save_item(m_device, "tilemap", NULL, instance, NAME(m_enable));
machine().save().save_item("tilemap", NULL, instance, NAME(m_attributes)); machine().save().save_item(m_device, "tilemap", NULL, instance, NAME(m_attributes));
machine().save().save_item("tilemap", NULL, instance, NAME(m_palette_offset)); machine().save().save_item(m_device, "tilemap", NULL, instance, NAME(m_palette_offset));
machine().save().save_item("tilemap", NULL, instance, NAME(m_scrollrows)); machine().save().save_item(m_device, "tilemap", NULL, instance, NAME(m_scrollrows));
machine().save().save_item("tilemap", NULL, instance, NAME(m_scrollcols)); machine().save().save_item(m_device, "tilemap", NULL, instance, NAME(m_scrollcols));
machine().save().save_item("tilemap", NULL, instance, NAME(m_rowscroll)); machine().save().save_item(m_device, "tilemap", NULL, instance, NAME(m_rowscroll));
machine().save().save_item("tilemap", NULL, instance, NAME(m_colscroll)); machine().save().save_item(m_device, "tilemap", NULL, instance, NAME(m_colscroll));
machine().save().save_item("tilemap", NULL, instance, NAME(m_dx)); machine().save().save_item(m_device, "tilemap", NULL, instance, NAME(m_dx));
machine().save().save_item("tilemap", NULL, instance, NAME(m_dx_flipped)); machine().save().save_item(m_device, "tilemap", NULL, instance, NAME(m_dx_flipped));
machine().save().save_item("tilemap", NULL, instance, NAME(m_dy)); machine().save().save_item(m_device, "tilemap", NULL, instance, NAME(m_dy));
machine().save().save_item("tilemap", NULL, instance, NAME(m_dy_flipped)); machine().save().save_item(m_device, "tilemap", NULL, instance, NAME(m_dy_flipped));
// reset everything after a load // reset everything after a load
machine().save().register_postload(save_prepost_delegate(FUNC(tilemap_t::postload), this)); machine().save().register_postload(save_prepost_delegate(FUNC(tilemap_t::postload), this));

View File

@ -568,7 +568,7 @@ void psxgpu_device::psx_gpu_init( int n_gputype )
} }
// icky!!! // icky!!!
machine().save().save_memory( "globals", NULL, 0, "m_packet", (UINT8 *)&m_packet, 1, sizeof( m_packet ) ); machine().save().save_memory( this, "globals", NULL, 0, "m_packet", (UINT8 *)&m_packet, 1, sizeof( m_packet ) );
save_pointer(NAME(p_vram), width * height ); save_pointer(NAME(p_vram), width * height );
save_item(NAME(n_gpu_buffer_offset)); save_item(NAME(n_gpu_buffer_offset));