mirror of
https://github.com/holub/mame
synced 2025-05-08 23:31:54 +03:00
save: factor-out presave/postload dispatchers
Signed-off-by: Luca Bruno <lucab@debian.org>
This commit is contained in:
parent
c95ed9c31d
commit
39788873b0
@ -213,6 +213,17 @@ save_error save_manager::check_file(running_machine &machine, emu_file &file, co
|
|||||||
return validate_header(header, gamename, sig, errormsg, "");
|
return validate_header(header, gamename, sig, errormsg, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// dispatch_postload - invoke all registered
|
||||||
|
// postload callbacks for updates
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void save_manager::dispatch_postload()
|
||||||
|
{
|
||||||
|
for (state_callback *func = m_postload_list.first(); func != NULL; func = func->next())
|
||||||
|
func->m_func();
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// read_file - read the data from a file
|
// read_file - read the data from a file
|
||||||
@ -253,12 +264,22 @@ save_error save_manager::read_file(emu_file &file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// call the post-load functions
|
// call the post-load functions
|
||||||
for (state_callback *func = m_postload_list.first(); func != NULL; func = func->next())
|
dispatch_postload();
|
||||||
func->m_func();
|
|
||||||
|
|
||||||
return STATERR_NONE;
|
return STATERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// dispatch_presave - invoke all registered
|
||||||
|
// presave callbacks for updates
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void save_manager::dispatch_presave()
|
||||||
|
{
|
||||||
|
for (state_callback *func = m_presave_list.first(); func != NULL; func = func->next())
|
||||||
|
func->m_func();
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// write_file - writes the data to a file
|
// write_file - writes the data to a file
|
||||||
@ -287,8 +308,7 @@ save_error save_manager::write_file(emu_file &file)
|
|||||||
file.compress(FCOMPRESS_MEDIUM);
|
file.compress(FCOMPRESS_MEDIUM);
|
||||||
|
|
||||||
// call the pre-save functions
|
// call the pre-save functions
|
||||||
for (state_callback *func = m_presave_list.first(); func != NULL; func = func->next())
|
dispatch_presave();
|
||||||
func->m_func();
|
|
||||||
|
|
||||||
// then write all the data
|
// then write all the data
|
||||||
for (state_entry *entry = m_entry_list.first(); entry != NULL; entry = entry->next())
|
for (state_entry *entry = m_entry_list.first(); entry != NULL; entry = entry->next())
|
||||||
|
@ -99,6 +99,10 @@ public:
|
|||||||
void register_presave(save_prepost_delegate func);
|
void register_presave(save_prepost_delegate func);
|
||||||
void register_postload(save_prepost_delegate func);
|
void register_postload(save_prepost_delegate func);
|
||||||
|
|
||||||
|
// callback dispatching
|
||||||
|
void dispatch_presave();
|
||||||
|
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(const char *module, const char *tag, UINT32 index, const char *name, void *val, UINT32 valsize, UINT32 valcount = 1);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user