1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-26 03:29:40 +00:00

Starts a switch to reflectable-style runtime options.

The Amstrad CPC and ZX80/81 have made the jump so far, subject to caveats. The macOS build is unlikely currently to work properly.
This commit is contained in:
Thomas Harte
2020-03-16 23:25:05 -04:00
parent 1d40aa687e
commit 394ee61c78
24 changed files with 163 additions and 141 deletions
+15 -14
View File
@@ -17,27 +17,28 @@ namespace Configurable {
/*!
A Configurable::Device provides a reflective struct listing the available runtime options for this machine.
It can provide it populated with 'accurate' options, 'user-friendly' options or just whatever the user
currently has selected.
You can ordinarily either get or set a machine's current options, or else construct a new instance of
its options with one of the OptionsTypes defined below.
*/
struct Device {
/// Sets the current options. The caller must ensure that the object passed in is either an instance of the machine's
/// Options struct, or else was previously returned by get_options.
virtual void set_options(const std::unique_ptr<Reflection::Struct> &options) = 0;
/// @returns An options object
virtual std::unique_ptr<Reflection::Struct> get_options() = 0;
};
/*!
'Accurate' options should correspond to the way that this device was usually used during its lifespan.
E.g. a ColecoVision might accurately be given composite output.
'User-friendly' options should be more like those that a user today might most expect from an emulator.
E.g. the ColecoVision might bump itself up to S-Video output.
*/
struct Device {
/// Sets the current options.
virtual void set_options(const std::unique_ptr<Reflection::Struct> &options) = 0;
enum class OptionsType {
Current,
Accurate,
UserFriendly
};
/// @returns Options of type @c type.
virtual std::unique_ptr<Reflection::Struct> get_options(OptionsType type) = 0;
enum class OptionsType {
Accurate,
UserFriendly
};
}