1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-25 18:30:21 +00:00

Merge pull request #310 from TomHarte/ROMSafety

Simplifies CPC ROM input mechanism.
This commit is contained in:
Thomas Harte 2017-11-25 05:19:00 -08:00 committed by GitHub
commit f067fa9923
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -929,12 +929,6 @@ class ConcreteMachine:
return !media.tapes.empty() || (!media.disks.empty() && has_fdc_);
}
// See header; provides the system ROMs.
void set_rom(ROMType type, const std::vector<uint8_t> &data) {
roms_[static_cast<int>(type)] = std::move(data);
roms_[static_cast<int>(type)].resize(16384);
}
// Obtains the system ROMs.
bool set_rom_fetcher(const std::function<std::vector<std::unique_ptr<std::vector<uint8_t>>>(const std::string &machine, const std::vector<std::string> &names)> &roms_with_names) override {
auto roms = roms_with_names(
@ -949,7 +943,8 @@ class ConcreteMachine:
for(std::size_t index = 0; index < roms.size(); ++index) {
auto &data = roms[index];
if(!data) return false;
set_rom(static_cast<ROMType>(index), *data);
roms_[static_cast<int>(index)] = std::move(*data);
roms_[static_cast<int>(index)].resize(16384);
}
return true;