mirror of
https://github.com/holub/mame
synced 2025-10-06 09:00:04 +03:00
Start adding save state support to nltool.
Save states are needed for regression tests going forward. (nw)
This commit is contained in:
parent
3e42594830
commit
3c60882f93
@ -15,6 +15,8 @@
|
|||||||
#include "netlist/tools/nl_convert.h"
|
#include "netlist/tools/nl_convert.h"
|
||||||
#include "netlist/solver/nld_solver.h"
|
#include "netlist/solver/nld_solver.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
class tool_app_t : public plib::app
|
class tool_app_t : public plib::app
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -177,6 +179,27 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save_state()
|
||||||
|
{
|
||||||
|
state().pre_save();
|
||||||
|
std::size_t size = 0;
|
||||||
|
for (auto const & s : state().save_list())
|
||||||
|
size += ((s->m_dt.size * s->m_count + sizeof(unsigned) - 1) / sizeof(unsigned));
|
||||||
|
|
||||||
|
auto buf = plib::palloc_array<unsigned>(size);
|
||||||
|
auto p = buf;
|
||||||
|
|
||||||
|
for (auto const & s : state().save_list())
|
||||||
|
{
|
||||||
|
std::size_t sz = s->m_dt.size * s->m_count;
|
||||||
|
if (s->m_dt.is_float || s->m_dt.is_integral)
|
||||||
|
std::memcpy(p, s->m_ptr, sz );
|
||||||
|
else
|
||||||
|
log().fatal("found unsupported save element {1}\n", s->m_name);
|
||||||
|
p += ((sz + sizeof(unsigned) - 1) / sizeof(unsigned));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void vlog(const plib::plog_level &l, const pstring &ls) const override;
|
void vlog(const plib::plog_level &l, const pstring &ls) const override;
|
||||||
@ -292,6 +315,7 @@ void tool_app_t::run()
|
|||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
nt.process_queue(netlist::netlist_time::from_double(ttr) - nlt);
|
nt.process_queue(netlist::netlist_time::from_double(ttr) - nlt);
|
||||||
|
nt.save_state();
|
||||||
nt.stop();
|
nt.stop();
|
||||||
|
|
||||||
t.stop();
|
t.stop();
|
||||||
|
Loading…
Reference in New Issue
Block a user