From a9e6f19320a9f0c8489c6001b23a72ab232b23a0 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Thu, 20 Dec 2018 20:25:33 +0100 Subject: emumem: remove m_baseptr, may fix the save state issues [O. Galibert] --- src/emu/emumem.cpp | 10 +--------- src/emu/emumem.h | 3 +-- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/emu/emumem.cpp b/src/emu/emumem.cpp index 3fde5702fd1..80aaaf32c42 100644 --- a/src/emu/emumem.cpp +++ b/src/emu/emumem.cpp @@ -2739,7 +2739,6 @@ memory_block::~memory_block() memory_bank::memory_bank(address_space &space, int index, offs_t addrstart, offs_t addrend, const char *tag) : m_machine(space.m_manager.machine()), - m_baseptr(nullptr), m_anonymous(tag == nullptr), m_addrstart(addrstart), m_addrend(addrend), @@ -2815,7 +2814,7 @@ void memory_bank::set_base(void *base) m_entries.resize(1); m_curentry = 0; } - m_baseptr = m_entries[m_curentry] = reinterpret_cast(base); + m_entries[m_curentry] = reinterpret_cast(base); for(auto cb : m_alloc_notifier) cb(base); m_alloc_notifier.clear(); @@ -2846,7 +2845,6 @@ void memory_bank::set_entry(int entrynum) throw emu_fatalerror("memory_bank::set_entry called for bank '%s' with invalid bank entry %d", m_tag.c_str(), entrynum); m_curentry = entrynum; - m_baseptr = m_entries[entrynum]; } @@ -2866,10 +2864,6 @@ void memory_bank::configure_entry(int entrynum, void *base) // set the entry m_entries[entrynum] = reinterpret_cast(base); - - // if the bank base is not configured, and we're the first entry, set us up - if (!m_baseptr && !entrynum) - m_baseptr = m_entries[0]; } @@ -2885,8 +2879,6 @@ void memory_bank::configure_entries(int startentry, int numentries, void *base, // fill in the requested bank entries for (int entrynum = 0; entrynum < numentries; entrynum ++) m_entries[entrynum + startentry] = reinterpret_cast(base) + entrynum * stride ; - if(!m_baseptr && !startentry) - m_baseptr = reinterpret_cast(base); } diff --git a/src/emu/emumem.h b/src/emu/emumem.h index 21c603e2225..74c0ae2a426 100644 --- a/src/emu/emumem.h +++ b/src/emu/emumem.h @@ -1657,7 +1657,7 @@ public: int entry() const { return m_curentry; } bool anonymous() const { return m_anonymous; } offs_t addrstart() const { return m_addrstart; } - void *base() const { return m_baseptr; } + void *base() const { return m_entries.empty() ? nullptr : m_entries[m_curentry]; } const char *tag() const { return m_tag.c_str(); } const char *name() const { return m_name.c_str(); } @@ -1683,7 +1683,6 @@ public: private: // internal state running_machine & m_machine; // need the machine to free our memory - u8 * m_baseptr; // pointer to our current base pointer std::vector m_entries; // the entries bool m_anonymous; // are we anonymous or explicit? offs_t m_addrstart; // start offset -- cgit v1.2.3