1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-22 12:33:29 +00:00

For SDL at least, advances to failed linking.

... and with error reporting currently AWOL.
This commit is contained in:
Thomas Harte 2021-06-03 22:22:56 -04:00
parent a30eeaab6a
commit 0aa8c3c40d
4 changed files with 37 additions and 37 deletions

View File

@ -817,10 +817,10 @@ template <bool has_fdc> class ConcreteMachine:
}
if(has_amsdos) {
roms_[ROMType::AMSDOS] = *roms.find(ROM::Name::AMSDOS);
roms_[ROMType::AMSDOS] = roms.find(ROM::Name::AMSDOS)->second;
}
roms_[ROMType::OS] = *roms.find(firmware);
roms_[ROMType::BASIC] = *roms.find(basic);
roms_[ROMType::OS] = roms.find(firmware)->second;
roms_[ROMType::BASIC] = roms.find(basic)->second;
// Establish default memory map
upper_rom_is_paged_ = true;

View File

@ -418,8 +418,8 @@ template <Analyser::Static::AppleII::Target::Model model> class ConcreteMachine:
install_card(6, new Apple::II::DiskIICard(roms, is_sixteen_sector));
}
rom_ = std::move(*roms.find(system));
video_.set_character_rom(*roms.find(character));
rom_ = std::move(roms.find(system)->second);
video_.set_character_rom(roms.find(character)->second);
// Set up the default memory blocks. On a II or II+ these values will never change.
// On a IIe they'll be affected by selection of auxiliary RAM.

View File

@ -16,7 +16,7 @@
using namespace Commodore::C1540;
ROM::Request MachineBase::rom_request(Personality personality) {
ROM::Request Machine::rom_request(Personality personality) {
switch(personality) {
case Personality::C1540: return ROM::Request(ROM::Name::Commodore1540);
case Personality::C1541: return ROM::Request(ROM::Name::Commodore1541);

View File

@ -694,11 +694,11 @@ int main(int argc, char *argv[]) {
// /usr/local/share/CLK/[system];
// /usr/share/CLK/[system]; or
// [user-supplied path]/[system]
std::vector<ROMMachine::ROM> requested_roms;
ROM::Request requested_roms;
std::vector<std::string> checked_paths;
ROMMachine::ROMFetcher rom_fetcher = [&requested_roms, &arguments, &checked_paths]
(const std::vector<ROMMachine::ROM> &roms) -> std::vector<std::unique_ptr<std::vector<uint8_t>>> {
requested_roms.insert(requested_roms.end(), roms.begin(), roms.end());
(const ROM::Request &roms) -> ROM::Map {
requested_roms = roms;
std::vector<std::string> paths = {
"/usr/local/share/CLK/",
@ -714,36 +714,36 @@ int main(int argc, char *argv[]) {
}
}
std::vector<std::unique_ptr<std::vector<uint8_t>>> results;
for(const auto &rom: roms) {
FILE *file = nullptr;
std::vector<std::string> rom_checked_paths;
for(const auto &path: paths) {
std::string local_path = path + rom.machine_name + "/" + rom.file_name;
file = std::fopen(local_path.c_str(), "rb");
rom_checked_paths.push_back(local_path);
if(file) break;
}
ROM::Map results;
for(const auto &description: roms.all_descriptions()) {
for(const auto &file_name: description.file_names) {
FILE *file = nullptr;
std::vector<std::string> rom_checked_paths;
for(const auto &path: paths) {
std::string local_path = path + description.machine_name + "/" + file_name;
file = std::fopen(local_path.c_str(), "rb");
rom_checked_paths.push_back(local_path);
if(file) break;
}
if(!file) {
std::copy(rom_checked_paths.begin(), rom_checked_paths.end(), std::back_inserter(checked_paths));
results.emplace_back(nullptr);
continue;
}
if(!file) {
std::copy(rom_checked_paths.begin(), rom_checked_paths.end(), std::back_inserter(checked_paths));
continue;
}
auto data = std::make_unique<std::vector<uint8_t>>();
std::vector<uint8_t> data;
std::fseek(file, 0, SEEK_END);
data->resize(std::ftell(file));
std::fseek(file, 0, SEEK_SET);
std::size_t read = fread(data->data(), 1, data->size(), file);
std::fclose(file);
std::fseek(file, 0, SEEK_END);
data.resize(std::ftell(file));
std::fseek(file, 0, SEEK_SET);
std::size_t read = fread(data.data(), 1, data.size(), file);
std::fclose(file);
if(read == data->size())
results.emplace_back(std::move(data));
else {
std::copy(rom_checked_paths.begin(), rom_checked_paths.end(), std::back_inserter(checked_paths));
results.emplace_back(nullptr);
if(read == data.size()) {
results[description.name] = std::move(data);
} else {
std::copy(rom_checked_paths.begin(), rom_checked_paths.end(), std::back_inserter(checked_paths));
}
}
}
@ -765,7 +765,7 @@ int main(int argc, char *argv[]) {
switch(error) {
default: break;
case ::Machine::Error::MissingROM:
std::cerr << "Could not find system ROMs; please install to /usr/local/share/CLK/ or /usr/share/CLK/, or provide a --rompath." << std::endl;
/* std::cerr << "Could not find system ROMs; please install to /usr/local/share/CLK/ or /usr/share/CLK/, or provide a --rompath." << std::endl;
std::cerr << "One or more of the following was needed but not found:" << std::endl;
for(const auto &rom: requested_roms) {
std::cerr << rom.machine_name << '/' << rom.file_name << " (";
@ -788,7 +788,7 @@ int main(int argc, char *argv[]) {
std::cerr << path;
is_first = false;
}
std::cerr << std::endl;
std::cerr << std::endl;*/
break;
}