diff options
author | 2020-09-14 00:55:00 +1000 | |
---|---|---|
committer | 2020-09-14 00:55:00 +1000 | |
commit | 9b582574922cb7af1a9a31c1182c300b90a20c43 (patch) | |
tree | d05e9095649fd864c2d83612e62f69d4760c6b26 /src/emu/devfind.h | |
parent | cba1bff5b0c099d172bcc2cacefd68c50c5f1358 (diff) |
emu/save.h: Added support for saving arrays of attotimes and renamed macros to make purpose more obvious.
Diffstat (limited to 'src/emu/devfind.h')
-rw-r--r-- | src/emu/devfind.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/emu/devfind.h b/src/emu/devfind.h index 668defe4523..958ae16c3bc 100644 --- a/src/emu/devfind.h +++ b/src/emu/devfind.h @@ -15,6 +15,7 @@ #include <functional> #include <iterator> +#include <memory> #include <stdexcept> #include <string> #include <type_traits> @@ -1063,11 +1064,11 @@ public: // dynamic allocation of a shared pointer void allocate(u32 entries) { - assert(m_allocated.empty()); - m_allocated.resize(entries); - this->m_target = &m_allocated[0]; + assert(!m_allocated); + m_allocated = std::make_unique<PointerType []>(entries); + this->m_target = m_allocated.get(); m_bytes = entries * sizeof(PointerType); - this->m_base.get().save_item(m_allocated, this->m_tag); + this->m_base.get().save_pointer(m_allocated, this->m_tag, entries); } private: @@ -1086,7 +1087,7 @@ private: // internal state u8 const m_width; size_t m_bytes; - std::vector<PointerType> m_allocated; + std::unique_ptr<PointerType []> m_allocated; }; template <typename PointerType> using optional_shared_ptr = shared_ptr_finder<PointerType, false>; |