1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +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) { 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::OS] = roms.find(firmware)->second;
roms_[ROMType::BASIC] = *roms.find(basic); roms_[ROMType::BASIC] = roms.find(basic)->second;
// Establish default memory map // Establish default memory map
upper_rom_is_paged_ = true; 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)); install_card(6, new Apple::II::DiskIICard(roms, is_sixteen_sector));
} }
rom_ = std::move(*roms.find(system)); rom_ = std::move(roms.find(system)->second);
video_.set_character_rom(*roms.find(character)); video_.set_character_rom(roms.find(character)->second);
// Set up the default memory blocks. On a II or II+ these values will never change. // 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. // On a IIe they'll be affected by selection of auxiliary RAM.

View File

@ -16,7 +16,7 @@
using namespace Commodore::C1540; using namespace Commodore::C1540;
ROM::Request MachineBase::rom_request(Personality personality) { ROM::Request Machine::rom_request(Personality personality) {
switch(personality) { switch(personality) {
case Personality::C1540: return ROM::Request(ROM::Name::Commodore1540); case Personality::C1540: return ROM::Request(ROM::Name::Commodore1540);
case Personality::C1541: return ROM::Request(ROM::Name::Commodore1541); 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/local/share/CLK/[system];
// /usr/share/CLK/[system]; or // /usr/share/CLK/[system]; or
// [user-supplied path]/[system] // [user-supplied path]/[system]
std::vector<ROMMachine::ROM> requested_roms; ROM::Request requested_roms;
std::vector<std::string> checked_paths; std::vector<std::string> checked_paths;
ROMMachine::ROMFetcher rom_fetcher = [&requested_roms, &arguments, &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>>> { (const ROM::Request &roms) -> ROM::Map {
requested_roms.insert(requested_roms.end(), roms.begin(), roms.end()); requested_roms = roms;
std::vector<std::string> paths = { std::vector<std::string> paths = {
"/usr/local/share/CLK/", "/usr/local/share/CLK/",
@ -714,12 +714,13 @@ int main(int argc, char *argv[]) {
} }
} }
std::vector<std::unique_ptr<std::vector<uint8_t>>> results; ROM::Map results;
for(const auto &rom: roms) { for(const auto &description: roms.all_descriptions()) {
for(const auto &file_name: description.file_names) {
FILE *file = nullptr; FILE *file = nullptr;
std::vector<std::string> rom_checked_paths; std::vector<std::string> rom_checked_paths;
for(const auto &path: paths) { for(const auto &path: paths) {
std::string local_path = path + rom.machine_name + "/" + rom.file_name; std::string local_path = path + description.machine_name + "/" + file_name;
file = std::fopen(local_path.c_str(), "rb"); file = std::fopen(local_path.c_str(), "rb");
rom_checked_paths.push_back(local_path); rom_checked_paths.push_back(local_path);
if(file) break; if(file) break;
@ -727,23 +728,22 @@ int main(int argc, char *argv[]) {
if(!file) { if(!file) {
std::copy(rom_checked_paths.begin(), rom_checked_paths.end(), std::back_inserter(checked_paths)); std::copy(rom_checked_paths.begin(), rom_checked_paths.end(), std::back_inserter(checked_paths));
results.emplace_back(nullptr);
continue; continue;
} }
auto data = std::make_unique<std::vector<uint8_t>>(); std::vector<uint8_t> data;
std::fseek(file, 0, SEEK_END); std::fseek(file, 0, SEEK_END);
data->resize(std::ftell(file)); data.resize(std::ftell(file));
std::fseek(file, 0, SEEK_SET); std::fseek(file, 0, SEEK_SET);
std::size_t read = fread(data->data(), 1, data->size(), file); std::size_t read = fread(data.data(), 1, data.size(), file);
std::fclose(file); std::fclose(file);
if(read == data->size()) if(read == data.size()) {
results.emplace_back(std::move(data)); results[description.name] = std::move(data);
else { } else {
std::copy(rom_checked_paths.begin(), rom_checked_paths.end(), std::back_inserter(checked_paths)); std::copy(rom_checked_paths.begin(), rom_checked_paths.end(), std::back_inserter(checked_paths));
results.emplace_back(nullptr); }
} }
} }
@ -765,7 +765,7 @@ int main(int argc, char *argv[]) {
switch(error) { switch(error) {
default: break; default: break;
case ::Machine::Error::MissingROM: 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; std::cerr << "One or more of the following was needed but not found:" << std::endl;
for(const auto &rom: requested_roms) { for(const auto &rom: requested_roms) {
std::cerr << rom.machine_name << '/' << rom.file_name << " ("; std::cerr << rom.machine_name << '/' << rom.file_name << " (";
@ -788,7 +788,7 @@ int main(int argc, char *argv[]) {
std::cerr << path; std::cerr << path;
is_first = false; is_first = false;
} }
std::cerr << std::endl; std::cerr << std::endl;*/
break; break;
} }