summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/memory.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2011-02-08 06:48:39 +0000
committer Aaron Giles <aaron@aarongiles.com>2011-02-08 06:48:39 +0000
commit4f7efb1ca4bcf00edd9e519167367f44d797186c (patch)
treec9ee8aae0bc80942f118df4df24d9054504b9ad9 /src/emu/memory.c
parentf4f3adf2506ce7808363593436de5b13bb304d47 (diff)
Moved the state saving system to C++. For now the registration macros
are still intact. The new state_manager class has templatized methods for saving the various types, and through template specialization can save more complex system types cleanly (like bitmaps and attotimes). Added new mechanism to detect proper state save types. This is much more strict and there will likely be some games/devices that fatalerror at startup until they are remedied. Spot checking has caught the more common situations. The new state_manager is embedded directly in the running_machine, allowing objects to register state saving in their constructors now. Added NAME() macro which is a generalization of FUNC() and can be used to wrap variables that are registered when directly using the new methods as opposed to the previous macros. For example: machine->state().save_item(NAME(global_item)) Added methods in the device_t class that implicitly register state against the current device, making for a cleaner interface. Just a couple of required regexes for now: state_save_register_postload( *)\(( *)([^,;]+), * \3->state().register_postload\1\(\2 state_save_register_presave( *)\(( *)([^,;]+), * \3->state().register_presave\1\(\2
Diffstat (limited to 'src/emu/memory.c')
-rw-r--r--src/emu/memory.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/emu/memory.c b/src/emu/memory.c
index abf6a424965..8556edd2078 100644
--- a/src/emu/memory.c
+++ b/src/emu/memory.c
@@ -1590,7 +1590,7 @@ void memory_init(running_machine *machine)
space->locate_memory();
// register a callback to reset banks when reloading state
- state_save_register_postload(machine, bank_reattach, NULL);
+ machine->state().register_postload(bank_reattach, NULL);
// dump the final memory configuration
generate_memdump(machine);
@@ -4092,7 +4092,7 @@ memory_block::memory_block(address_space &space, offs_t bytestart, offs_t byteen
int bytes_per_element = space.data_width() / 8;
astring name;
name.printf("%08x-%08x", bytestart, byteend);
- state_save_register_memory(&space.m_machine, "memory", space.device().tag(), space.spacenum(), name, m_data, bytes_per_element, (UINT32)(byteend + 1 - bytestart) / bytes_per_element, __FILE__, __LINE__);
+ space.m_machine.state().save_memory("memory", space.device().tag(), space.spacenum(), name, m_data, bytes_per_element, (UINT32)(byteend + 1 - bytestart) / bytes_per_element);
}
}
@@ -4142,7 +4142,7 @@ memory_bank::memory_bank(address_space &space, int index, offs_t bytestart, offs
m_name.printf("Bank '%s'", tag);
}
- if (!m_anonymous && state_save_registration_allowed(&space.m_machine))
+ if (!m_anonymous && space.m_machine.state().registration_allowed())
state_save_register_item(&space.m_machine, "memory", m_tag, 0, m_curentry);
}