void save_manager::save_memory(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); // check for invalid timing if (!m_reg_allowed) { logerror("Attempt to register save state entry after state registration is closed!\nModule %s tag %s name %s\n", module, tag, name); if (machine().system().flags & GAME_SUPPORTS_SAVE) fatalerror("Attempt to register save state entry after state registration is closed!\nModule %s tag %s name %s\n", module, tag, name); m_illegal_regs++; return; } // create the full name astring totalname; if (tag != NULL) totalname.printf("%s/%s/%X/%s", module, tag, index, name); else totalname.printf("%s/%X/%s", module, index, name); // look for duplicates and an entry to insert in front of state_entry *insert_after = NULL; for (state_entry *entry = m_entry_list.first(); entry != NULL; entry = entry->next()) { // stop when we find an entry whose name is after ours if (entry->m_name > totalname) break; insert_after = entry; // error if we are equal if (entry->m_name == totalname) fatalerror("Duplicate save state registration entry (%s)\n", totalname.cstr()); } // insert us into the list m_entry_list.insert_after(*global_alloc(state_entry(val, totalname, valsize, valcount)), insert_after); if(netCommon) netCommon->createMemoryBlock(std::string(totalname.cstr()), (unsigned char*)val,valsize*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); // check for invalid timing if (!m_reg_allowed) { machine().logerror("Attempt to register save state entry after state registration is closed!\nModule %s tag %s name %s\n", module, tag, name); if (machine().system().flags & MACHINE_SUPPORTS_SAVE) fatalerror("Attempt to register save state entry after state registration is closed!\nModule %s tag %s name %s\n", module, tag, name); m_illegal_regs++; return; } // create the full name std::string totalname; if (tag != nullptr) strprintf(totalname, "%s/%s/%X/%s", module, tag, index, name); else strprintf(totalname, "%s/%X/%s", module, index, name); // look for duplicates and an entry to insert in front of state_entry *insert_after = nullptr; for (state_entry *entry = m_entry_list.first(); entry != nullptr; entry = entry->next()) { // stop when we find an entry whose name is after ours if (entry->m_name.compare(totalname)>0) break; insert_after = entry; // error if we are equal if (entry->m_name.compare(totalname)==0) fatalerror("Duplicate save state registration entry (%s)\n", totalname.c_str()); } // insert us into the list m_entry_list.insert_after(*global_alloc(state_entry(val, totalname.c_str(), device, module, tag ? tag : "", index, valsize, valcount)), insert_after); }