mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-28 21:49:27 +00:00
Add title fallbacks, ensure 'read' costs even 0.0-weight options.
This commit is contained in:
parent
6d769c9e89
commit
b6b70bb7ff
@ -202,13 +202,19 @@ std::unique_ptr<Catalogue> Analyser::Static::Acorn::GetADFSCatalogue(const std::
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Include the directory title.
|
// Include the directory title.
|
||||||
const uint8_t *title;
|
const char *title, *name;
|
||||||
if(catalogue->has_large_sectors) {
|
if(catalogue->has_large_sectors) {
|
||||||
title = &root_directory[0x7dd];
|
title = reinterpret_cast<const char *>(&root_directory[0x7dd]);
|
||||||
|
name = reinterpret_cast<const char *>(&root_directory[0x7f0]);
|
||||||
} else {
|
} else {
|
||||||
title = &root_directory[0x4d9];
|
title = reinterpret_cast<const char *>(&root_directory[0x4d9]);
|
||||||
|
name = reinterpret_cast<const char *>(&root_directory[0x4cc]);
|
||||||
|
}
|
||||||
|
|
||||||
|
catalogue->name = std::string(title, strnlen(title, 19));
|
||||||
|
if(catalogue->name.empty() || catalogue->name == "$") {
|
||||||
|
catalogue->name = std::string(name, strnlen(name, 10));
|
||||||
}
|
}
|
||||||
catalogue->name = std::string(reinterpret_cast<const char *>(title), 19);
|
|
||||||
|
|
||||||
return catalogue;
|
return catalogue;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ static std::vector<std::shared_ptr<Storage::Cartridge::Cartridge>>
|
|||||||
return acorn_cartridges;
|
return acorn_cartridges;
|
||||||
}
|
}
|
||||||
|
|
||||||
Analyser::Static::TargetList Analyser::Static::Acorn::GetTargets(const Media &media, const std::string &, TargetPlatform::IntType) {
|
Analyser::Static::TargetList Analyser::Static::Acorn::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType) {
|
||||||
auto target8bit = std::make_unique<ElectronTarget>();
|
auto target8bit = std::make_unique<ElectronTarget>();
|
||||||
auto targetArchimedes = std::make_unique<ArchimedesTarget>();
|
auto targetArchimedes = std::make_unique<ArchimedesTarget>();
|
||||||
|
|
||||||
@ -152,6 +152,8 @@ Analyser::Static::TargetList Analyser::Static::Acorn::GetTargets(const Media &me
|
|||||||
|
|
||||||
// Also look for the best possible startup program name, if it can be discerned.
|
// Also look for the best possible startup program name, if it can be discerned.
|
||||||
std::map<double, std::string, std::greater<double>> options;
|
std::map<double, std::string, std::greater<double>> options;
|
||||||
|
const std::string &disk_title =
|
||||||
|
(adfs_catalogue->name.empty() || adfs_catalogue->name == "$") ? file_name : adfs_catalogue->name;
|
||||||
for(const auto &file: adfs_catalogue->files) {
|
for(const auto &file: adfs_catalogue->files) {
|
||||||
// Skip non-Pling files.
|
// Skip non-Pling files.
|
||||||
if(file.name[0] != '!') continue;
|
if(file.name[0] != '!') continue;
|
||||||
@ -168,7 +170,7 @@ Analyser::Static::TargetList Analyser::Static::Acorn::GetTargets(const Media &me
|
|||||||
}
|
}
|
||||||
) != file.name.end();
|
) != file.name.end();
|
||||||
|
|
||||||
const auto probability = Numeric::similarity(file.name, adfs_catalogue->name) * (has_read ? 0.5 : 1.0);
|
const auto probability = Numeric::similarity(file.name, disk_title) - (has_read ? 0.2 : 0.0);
|
||||||
options.emplace(probability, file.name);
|
options.emplace(probability, file.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user