Previous 199869 Revisions Next

r34472 Sunday 18th January, 2015 at 19:13:11 UTC by Luca Bruno
save: factor-out presave/postload dispatchers

Signed-off-by: Luca Bruno <lucab@debian.org>
[src/emu]save.c save.h

trunk/src/emu/save.c
r242983r242984
213213   return validate_header(header, gamename, sig, errormsg, "");
214214}
215215
216//-------------------------------------------------
217//  dispatch_postload - invoke all registered
218//  postload callbacks for updates
219//-------------------------------------------------
216220
221
222void save_manager::dispatch_postload()
223{
224   for (state_callback *func = m_postload_list.first(); func != NULL; func = func->next())
225      func->m_func();
226}
227
217228//-------------------------------------------------
218229//  read_file - read the data from a file
219230//-------------------------------------------------
r242983r242984
253264   }
254265
255266   // call the post-load functions
256   for (state_callback *func = m_postload_list.first(); func != NULL; func = func->next())
257      func->m_func();
267   dispatch_postload();
258268
259269   return STATERR_NONE;
260270}
261271
272//-------------------------------------------------
273//  dispatch_presave - invoke all registered
274//  presave callbacks for updates
275//-------------------------------------------------
262276
277
278void save_manager::dispatch_presave()
279{
280   for (state_callback *func = m_presave_list.first(); func != NULL; func = func->next())
281      func->m_func();
282}
283
263284//-------------------------------------------------
264285//  write_file - writes the data to a file
265286//-------------------------------------------------
r242983r242984
287308   file.compress(FCOMPRESS_MEDIUM);
288309
289310   // call the pre-save functions
290   for (state_callback *func = m_presave_list.first(); func != NULL; func = func->next())
291      func->m_func();
311   dispatch_presave();
292312
293313   // then write all the data
294314   for (state_entry *entry = m_entry_list.first(); entry != NULL; entry = entry->next())
trunk/src/emu/save.h
r242983r242984
9999   void register_presave(save_prepost_delegate func);
100100   void register_postload(save_prepost_delegate func);
101101
102   // callback dispatching
103   void dispatch_presave();
104   void dispatch_postload();
105
102106   // generic memory registration
103107   void save_memory(const char *module, const char *tag, UINT32 index, const char *name, void *val, UINT32 valsize, UINT32 valcount = 1);
104108


Previous 199869 Revisions Next


© 1997-2024 The MAME Team