mirror of
https://github.com/holub/mame
synced 2025-10-07 17:27:06 +03:00
Separate custom save states. (nw)
This commit is contained in:
parent
d7f420ccf7
commit
f2c3b51553
@ -16,6 +16,7 @@ state_manager_t::state_manager_t()
|
|||||||
state_manager_t::~state_manager_t()
|
state_manager_t::~state_manager_t()
|
||||||
{
|
{
|
||||||
m_save.clear();
|
m_save.clear();
|
||||||
|
m_custom.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -35,19 +36,24 @@ void state_manager_t::remove_save_items(const void *owner)
|
|||||||
else
|
else
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
for (auto i = m_custom.begin(); i != m_custom.end(); )
|
||||||
|
{
|
||||||
|
if (i->get()->m_owner == owner)
|
||||||
|
i = m_save.erase(i);
|
||||||
|
else
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void state_manager_t::pre_save()
|
void state_manager_t::pre_save()
|
||||||
{
|
{
|
||||||
for (auto & s : m_save)
|
for (auto & s : m_custom)
|
||||||
if (s->m_dt.is_custom)
|
|
||||||
s->m_callback->on_pre_save();
|
s->m_callback->on_pre_save();
|
||||||
}
|
}
|
||||||
|
|
||||||
void state_manager_t::post_load()
|
void state_manager_t::post_load()
|
||||||
{
|
{
|
||||||
for (auto & s : m_save)
|
for (auto & s : m_custom)
|
||||||
if (s->m_dt.is_custom)
|
|
||||||
s->m_callback->on_post_load();
|
s->m_callback->on_post_load();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +62,7 @@ template<> void state_manager_t::save_item(const void *owner, callback_t &state,
|
|||||||
//save_state_ptr(stname, DT_CUSTOM, 0, 1, &state);
|
//save_state_ptr(stname, DT_CUSTOM, 0, 1, &state);
|
||||||
callback_t *state_p = &state;
|
callback_t *state_p = &state;
|
||||||
auto p = plib::make_unique<entry_t>(stname, owner, state_p);
|
auto p = plib::make_unique<entry_t>(stname, owner, state_p);
|
||||||
m_save.push_back(std::move(p));
|
m_custom.push_back(std::move(p));
|
||||||
state.register_state(*this, stname);
|
state.register_state(*this, stname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,6 +135,8 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
entry_t::list_t m_save;
|
entry_t::list_t m_save;
|
||||||
|
entry_t::list_t m_custom;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> void state_manager_t::save_item(const void *owner, callback_t &state, const pstring &stname);
|
template<> void state_manager_t::save_item(const void *owner, callback_t &state, const pstring &stname);
|
||||||
|
Loading…
Reference in New Issue
Block a user