1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-09-29 16:55:59 +00:00

Ensures 'new' overrides default selection; doesn't try to propagate multiple files if machines won't take them.

This commit is contained in:
Thomas Harte 2020-03-19 21:15:38 -04:00
parent 23aa7ea85f
commit eef7868199
2 changed files with 20 additions and 16 deletions

View File

@ -58,7 +58,7 @@
</CommandLineArgument>
<CommandLineArgument
argument = "--new=amstradcpc"
isEnabled = "YES">
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "&quot;/Users/thomasharte/Library/Mobile Documents/com~apple~CloudDocs/Desktop/Soft/ColecoVision/Galaxian (1983)(Atari).col&quot;"
@ -74,11 +74,11 @@
</CommandLineArgument>
<CommandLineArgument
argument = "&quot;/Users/thomasharte/Library/Mobile Documents/com~apple~CloudDocs/Desktop/Soft/Amstrad CPC/Amstrad CPC [TOSEC]/Amstrad CPC - Applications - [DSK] (TOSEC-v2011-08-31_CM)/Tasword (1984)(Tasman Software).dsk&quot;"
isEnabled = "NO">
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "&quot;/Users/thomasharte/Library/Mobile Documents/com~apple~CloudDocs/Desktop/Soft/Amstrad CPC/Robocop.dsk&quot;"
isEnabled = "NO">
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "--speed=5"

View File

@ -585,14 +585,6 @@ int main(int argc, char *argv[]) {
// Determine the machine for the supplied file, if any, or from --new.
Analyser::Static::TargetList targets;
if(!arguments.file_names.empty()) {
// Take the first file name that actually implies a machine.
auto file_name = arguments.file_names.begin();
while(file_name != arguments.file_names.end() && targets.empty()) {
targets = Analyser::Static::GetTargets(*file_name);
++file_name;
}
}
const auto new_argument = arguments.selections.find("new");
std::string long_machine_name;
@ -618,6 +610,13 @@ int main(int argc, char *argv[]) {
std::unique_ptr<Analyser::Static::Target> tgt = std::move(targets_by_machine[long_machine_name]);
targets.push_back(std::move(tgt));
}
} else if(!arguments.file_names.empty()) {
// Take the first file name that actually implies a machine.
auto file_name = arguments.file_names.begin();
while(file_name != arguments.file_names.end() && targets.empty()) {
targets = Analyser::Static::GetTargets(*file_name);
++file_name;
}
}
if(targets.empty()) {
@ -765,12 +764,17 @@ int main(int argc, char *argv[]) {
machine_runner.machine = machine.get();
machine_runner.machine_mutex = &machine_mutex;
// Ensure all media is inserted.
Analyser::Static::Media media;
for(const auto &file_name: arguments.file_names) {
media += Analyser::Static::GetMedia(file_name);
// Ensure all media is inserted, if this machine accepts it.
{
auto media_target = machine->media_target();
if(media_target) {
Analyser::Static::Media media;
for(const auto &file_name: arguments.file_names) {
media += Analyser::Static::GetMedia(file_name);
}
media_target->insert_media(media);
}
}
machine->media_target()->insert_media(media);
// Attempt to set up video and audio.
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {