mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-22 12:33:29 +00:00
Attempts to fix the macOS version, plus some implicit type conversions.
This commit is contained in:
parent
c6f35c9aac
commit
9995d776de
@ -586,9 +586,9 @@ struct ActivityObserver: public Activity::Observer {
|
||||
@synchronized(self) {
|
||||
_useFastLoadingHack = useFastLoadingHack;
|
||||
|
||||
Configurable::SelectionSet selection_set;
|
||||
append_quick_load_tape_selection(selection_set, useFastLoadingHack ? true : false);
|
||||
configurable_device->set_selections(selection_set);
|
||||
auto options = configurable_device->get_options();
|
||||
Reflection::set(*options, "quickload", useFastLoadingHack ? true : false);
|
||||
configurable_device->set_options(options);
|
||||
}
|
||||
}
|
||||
|
||||
@ -599,7 +599,6 @@ struct ActivityObserver: public Activity::Observer {
|
||||
@synchronized(self) {
|
||||
_videoSignal = videoSignal;
|
||||
|
||||
Configurable::SelectionSet selection_set;
|
||||
Configurable::Display display;
|
||||
switch(videoSignal) {
|
||||
case CSMachineVideoSignalRGB: display = Configurable::Display::RGB; break;
|
||||
@ -607,8 +606,10 @@ struct ActivityObserver: public Activity::Observer {
|
||||
case CSMachineVideoSignalComposite: display = Configurable::Display::CompositeColour; break;
|
||||
case CSMachineVideoSignalMonochromeComposite: display = Configurable::Display::CompositeMonochrome; break;
|
||||
}
|
||||
append_display_selection(selection_set, display);
|
||||
configurable_device->set_selections(selection_set);
|
||||
|
||||
auto options = configurable_device->get_options();
|
||||
Reflection::set(*options, "output", int(display));
|
||||
configurable_device->set_options(options);
|
||||
}
|
||||
}
|
||||
|
||||
@ -617,35 +618,23 @@ struct ActivityObserver: public Activity::Observer {
|
||||
if(!configurable_device) return NO;
|
||||
|
||||
// Get the options this machine provides.
|
||||
std::vector<std::unique_ptr<Configurable::Option>> options;
|
||||
@synchronized(self) {
|
||||
options = configurable_device->get_options();
|
||||
}
|
||||
auto options = configurable_device->get_options();
|
||||
|
||||
// Get the standard option for this video signal.
|
||||
Configurable::StandardOptions option;
|
||||
switch(videoSignal) {
|
||||
case CSMachineVideoSignalRGB: option = Configurable::DisplayRGB; break;
|
||||
case CSMachineVideoSignalSVideo: option = Configurable::DisplaySVideo; break;
|
||||
case CSMachineVideoSignalComposite: option = Configurable::DisplayCompositeColour; break;
|
||||
case CSMachineVideoSignalMonochromeComposite: option = Configurable::DisplayCompositeMonochrome; break;
|
||||
}
|
||||
std::unique_ptr<Configurable::Option> display_option = std::move(standard_options(option).front());
|
||||
Configurable::ListOption *display_list_option = dynamic_cast<Configurable::ListOption *>(display_option.get());
|
||||
NSAssert(display_list_option, @"Expected display option to be a list");
|
||||
// Get the standard option for this video signal.
|
||||
Configurable::Display option;
|
||||
switch(videoSignal) {
|
||||
case CSMachineVideoSignalRGB: option = Configurable::Display::RGB; break;
|
||||
case CSMachineVideoSignalSVideo: option = Configurable::Display::SVideo; break;
|
||||
case CSMachineVideoSignalComposite: option = Configurable::Display::CompositeColour; break;
|
||||
case CSMachineVideoSignalMonochromeComposite: option = Configurable::Display::CompositeMonochrome; break;
|
||||
}
|
||||
|
||||
// See whether the video signal is included in the machine options.
|
||||
for(auto &candidate: options) {
|
||||
Configurable::ListOption *list_option = dynamic_cast<Configurable::ListOption *>(candidate.get());
|
||||
// Map to a string and check against returned options for the 'output' field.
|
||||
const auto string_option = Reflection::Enum::to_string<Configurable::Display>(option);
|
||||
const auto all_values = options->values_for("output");
|
||||
|
||||
// Both should be list options
|
||||
if(!list_option) continue;
|
||||
|
||||
// Check for same name of option.
|
||||
if(candidate->short_name != display_option->short_name) continue;
|
||||
|
||||
// Check that the video signal option is included.
|
||||
return std::find(list_option->options.begin(), list_option->options.end(), display_list_option->options.front()) != list_option->options.end();
|
||||
return std::find(all_values.begin(), all_values.end(), string_option) != all_values.end();
|
||||
}
|
||||
|
||||
return NO;
|
||||
@ -658,9 +647,9 @@ struct ActivityObserver: public Activity::Observer {
|
||||
@synchronized(self) {
|
||||
_useAutomaticTapeMotorControl = useAutomaticTapeMotorControl;
|
||||
|
||||
Configurable::SelectionSet selection_set;
|
||||
append_automatic_tape_motor_control_selection(selection_set, useAutomaticTapeMotorControl ? true : false);
|
||||
configurable_device->set_selections(selection_set);
|
||||
auto options = configurable_device->get_options();
|
||||
Reflection::set(*options, "automatic_tape_motor_control", useAutomaticTapeMotorControl ? true : false);
|
||||
configurable_device->set_options(options);
|
||||
}
|
||||
}
|
||||
|
||||
@ -671,9 +660,9 @@ struct ActivityObserver: public Activity::Observer {
|
||||
@synchronized(self) {
|
||||
_useQuickBootingHack = useQuickBootingHack;
|
||||
|
||||
Configurable::SelectionSet selection_set;
|
||||
append_quick_boot_selection(selection_set, useQuickBootingHack ? true : false);
|
||||
configurable_device->set_selections(selection_set);
|
||||
auto options = configurable_device->get_options();
|
||||
Reflection::set(*options, "quickboot", useQuickBootingHack ? true : false);
|
||||
configurable_device->set_options(options);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ class Enum {
|
||||
static const std::string &to_string(std::type_index type, int e) {
|
||||
const auto entry = members_by_type_.find(type);
|
||||
if(entry == members_by_type_.end()) return empty_string_;
|
||||
return entry->second[e];
|
||||
return entry->second[size_t(e)];
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -219,10 +219,10 @@ template <typename Owner> class StructImpl: public Struct {
|
||||
const int next = va_arg(list, int);
|
||||
if(next < 0) break;
|
||||
|
||||
if(permitted_values.size() <= next) {
|
||||
if(permitted_values.size() <= size_t(next)) {
|
||||
permitted_values.resize(permitted_values.size() << 1);
|
||||
}
|
||||
permitted_values[next] = true;
|
||||
permitted_values[size_t(next)] = true;
|
||||
}
|
||||
va_end(list);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user