mirror of
https://github.com/holub/mame
synced 2025-07-01 08:18:59 +03:00
Renju fix, that one was a nightmare (nw)
This commit is contained in:
parent
e61aa05e9a
commit
2b13112e7a
@ -2237,12 +2237,12 @@ void address_space::populate_from_map(address_map *map)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// install the handlers, using the original, unadjusted memory map
|
// install the handlers, using the original, unadjusted memory map
|
||||||
for (const address_map_entry *entry = map->m_entrylist.first(); entry; entry = entry->next())
|
for (const address_map_entry &entry : map->m_entrylist)
|
||||||
{
|
{
|
||||||
// map both read and write halves
|
// map both read and write halves
|
||||||
populate_map_entry(*entry, read_or_write::READ);
|
populate_map_entry(entry, read_or_write::READ);
|
||||||
populate_map_entry(*entry, read_or_write::WRITE);
|
populate_map_entry(entry, read_or_write::WRITE);
|
||||||
populate_map_entry_setoffset(*entry);
|
populate_map_entry_setoffset(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2338,10 +2338,11 @@ void address_space::allocate_memory()
|
|||||||
|
|
||||||
// make a first pass over the memory map and track blocks with hardcoded pointers
|
// make a first pass over the memory map and track blocks with hardcoded pointers
|
||||||
// we do this to make sure they are found by space_find_backing_memory first
|
// we do this to make sure they are found by space_find_backing_memory first
|
||||||
|
// do it back-to-front so that overrides work correctly
|
||||||
int tail = blocklist.size();
|
int tail = blocklist.size();
|
||||||
for (address_map_entry &entry : m_map->m_entrylist)
|
for (address_map_entry &entry : m_map->m_entrylist)
|
||||||
if (entry.m_memory != nullptr)
|
if (entry.m_memory != nullptr)
|
||||||
blocklist.push_back(std::make_unique<memory_block>(*this, entry.m_addrstart, entry.m_addrend, entry.m_memory));
|
blocklist.insert(blocklist.begin(), std::make_unique<memory_block>(*this, entry.m_addrstart, entry.m_addrend, entry.m_memory));
|
||||||
|
|
||||||
// loop over all blocks just allocated and assign pointers from them
|
// loop over all blocks just allocated and assign pointers from them
|
||||||
address_map_entry *unassigned = nullptr;
|
address_map_entry *unassigned = nullptr;
|
||||||
@ -2909,15 +2910,18 @@ void *address_space::find_backing_memory(offs_t addrstart, offs_t addrend)
|
|||||||
if (m_map == nullptr)
|
if (m_map == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
// look in the address map first
|
// look in the address map first, last winning for overrides
|
||||||
|
void *result = nullptr;
|
||||||
for (address_map_entry &entry : m_map->m_entrylist)
|
for (address_map_entry &entry : m_map->m_entrylist)
|
||||||
{
|
{
|
||||||
if (entry.m_memory != nullptr && addrstart >= entry.m_addrstart && addrend <= entry.m_addrend)
|
if (entry.m_memory != nullptr && addrstart >= entry.m_addrstart && addrend <= entry.m_addrend)
|
||||||
{
|
{
|
||||||
VPRINTF(("found in entry %08X-%08X [%p]\n", entry.m_addrstart, entry.m_addrend, (u8 *)entry.m_memory + address_to_byte(addrstart - entry.m_addrstart)));
|
VPRINTF(("found in entry %08X-%08X [%p]\n", entry.m_addrstart, entry.m_addrend, (u8 *)entry.m_memory + address_to_byte(addrstart - entry.m_addrstart)));
|
||||||
return (u8 *)entry.m_memory + address_to_byte(addrstart - entry.m_addrstart);
|
result = (u8 *)entry.m_memory + address_to_byte(addrstart - entry.m_addrstart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (result)
|
||||||
|
return result;
|
||||||
|
|
||||||
// if not found there, look in the allocated blocks
|
// if not found there, look in the allocated blocks
|
||||||
for (auto &block : m_manager.m_blocklist)
|
for (auto &block : m_manager.m_blocklist)
|
||||||
|
Loading…
Reference in New Issue
Block a user