mirror of
https://github.com/holub/mame
synced 2025-04-22 00:11:58 +03:00
placed cache back in new form, fixes listxml and similar (nw)
This commit is contained in:
parent
30bde502a6
commit
21d8194c7c
@ -189,7 +189,15 @@ machine_config &driver_enumerator::config(int index, emu_options &options) const
|
||||
// if we don't have it cached, add it
|
||||
if (m_config[index] == nullptr)
|
||||
{
|
||||
// if our cache is full, release the head entry
|
||||
if (m_config_cache.size() == CONFIG_CACHE_COUNT)
|
||||
{
|
||||
int first = m_config_cache.front();
|
||||
m_config[first] = nullptr;
|
||||
m_config_cache.erase(m_config_cache.begin());
|
||||
}
|
||||
m_config[index] = std::make_unique<machine_config>(*s_drivers_sorted[index], options);
|
||||
m_config_cache.push_back(index);
|
||||
}
|
||||
return *m_config[index];
|
||||
}
|
||||
|
@ -119,12 +119,15 @@ private:
|
||||
// internal helpers
|
||||
void release_current() const;
|
||||
|
||||
static const int CONFIG_CACHE_COUNT = 100;
|
||||
|
||||
// internal state
|
||||
int m_current;
|
||||
int m_filtered_count;
|
||||
emu_options & m_options;
|
||||
std::vector<UINT8> m_included;
|
||||
mutable std::vector<std::unique_ptr<machine_config>> m_config;
|
||||
mutable std::vector<int> m_config_cache;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user