From 0dbb0f391dee1b83ad9ba834b864362f97499dc3 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 1 May 2026 20:30:00 -0400 Subject: [PATCH 1/8] Correct enum names. --- OSBindings/Mac/Clock SignalTests/CPCShakerTests.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OSBindings/Mac/Clock SignalTests/CPCShakerTests.mm b/OSBindings/Mac/Clock SignalTests/CPCShakerTests.mm index 28b900c3c..773123640 100644 --- a/OSBindings/Mac/Clock SignalTests/CPCShakerTests.mm +++ b/OSBindings/Mac/Clock SignalTests/CPCShakerTests.mm @@ -268,7 +268,7 @@ private: // If this was the release of a carriage return, wait some more after release. if( key_delay.carriage_return_delay && - (event.key == AmstradCPC::Key::KeyEnter || event.key == AmstradCPC::Key::KeyReturn) + (event.key == AmstradCPC::Key::Enter || event.key == AmstradCPC::Key::Return) ) { delay(*key_delay.carriage_return_delay); } From 3107296881434f20ba43822baa6439e36c1cfdd6 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 1 May 2026 20:30:15 -0400 Subject: [PATCH 2/8] Start making room for the CoCo. --- Analyser/Machines.hpp | 1 + Machines/Tandy/CoCo/CoCo.cpp | 9 +++++++ Machines/Tandy/CoCo/CoCo.hpp | 14 ++++++++++ .../Clock Signal.xcodeproj/project.pbxproj | 26 +++++++++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 Machines/Tandy/CoCo/CoCo.cpp create mode 100644 Machines/Tandy/CoCo/CoCo.hpp diff --git a/Analyser/Machines.hpp b/Analyser/Machines.hpp index 9628bfe75..7e66de852 100644 --- a/Analyser/Machines.hpp +++ b/Analyser/Machines.hpp @@ -28,6 +28,7 @@ enum class Machine { Oric, Plus4, PCCompatible, + TandyCoCo, ThomsonMO, Vic20, ZX8081, diff --git a/Machines/Tandy/CoCo/CoCo.cpp b/Machines/Tandy/CoCo/CoCo.cpp new file mode 100644 index 000000000..d93cc6fb5 --- /dev/null +++ b/Machines/Tandy/CoCo/CoCo.cpp @@ -0,0 +1,9 @@ +// +// CoCo.cpp +// Clock Signal +// +// Created by Thomas Harte on 01/05/2026. +// Copyright © 2026 Thomas Harte. All rights reserved. +// + +#include "CoCo.hpp" diff --git a/Machines/Tandy/CoCo/CoCo.hpp b/Machines/Tandy/CoCo/CoCo.hpp new file mode 100644 index 000000000..3f255abe5 --- /dev/null +++ b/Machines/Tandy/CoCo/CoCo.hpp @@ -0,0 +1,14 @@ +// +// CoCo.hpp +// Clock Signal +// +// Created by Thomas Harte on 01/05/2026. +// Copyright © 2026 Thomas Harte. All rights reserved. +// + +#ifndef CoCo_hpp +#define CoCo_hpp + +#include + +#endif /* CoCo_hpp */ diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 138300de8..e58790a2f 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -347,6 +347,9 @@ 4B3F76B925A1635300178AEC /* PowerPCDecoderTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3F76B825A1635300178AEC /* PowerPCDecoderTests.mm */; }; 4B3FCC40201EC24200960631 /* MultiMachine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3FCC3F201EC24200960631 /* MultiMachine.cpp */; }; 4B3FE75E1F3CF68B00448EE4 /* CPM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3FE75C1F3CF68B00448EE4 /* CPM.cpp */; }; + 4B41EF722FA55F980086D909 /* CoCo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B41EF6F2FA55F980086D909 /* CoCo.cpp */; }; + 4B41EF732FA55F980086D909 /* CoCo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B41EF6F2FA55F980086D909 /* CoCo.cpp */; }; + 4B41EF742FA55F980086D909 /* CoCo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B41EF6F2FA55F980086D909 /* CoCo.cpp */; }; 4B43983929620FC7006B0BFC /* 9918.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B43983829620FB1006B0BFC /* 9918.cpp */; }; 4B43983A29620FC8006B0BFC /* 9918.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B43983829620FB1006B0BFC /* 9918.cpp */; }; 4B43983B29620FC9006B0BFC /* 9918.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B43983829620FB1006B0BFC /* 9918.cpp */; }; @@ -1629,6 +1632,8 @@ 4B4195F42EB8F061001C966D /* ULA.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ULA.hpp; sourceTree = ""; }; 4B4195F52EB92630001C966D /* Tube6502.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Tube6502.hpp; sourceTree = ""; }; 4B4195F62EBAB06C001C966D /* TubeZ80.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = TubeZ80.hpp; sourceTree = ""; }; + 4B41EF6E2FA55F980086D909 /* CoCo.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CoCo.hpp; sourceTree = ""; }; + 4B41EF6F2FA55F980086D909 /* CoCo.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CoCo.cpp; sourceTree = ""; }; 4B43983829620FB1006B0BFC /* 9918.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = 9918.cpp; sourceTree = ""; }; 4B43983C29621024006B0BFC /* ClockConverter.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ClockConverter.hpp; sourceTree = ""; }; 4B43983E29628538006B0BFC /* Fetch.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Fetch.hpp; sourceTree = ""; }; @@ -3407,6 +3412,23 @@ name = Parsers; sourceTree = ""; }; + 4B41EF702FA55F980086D909 /* CoCo */ = { + isa = PBXGroup; + children = ( + 4B41EF6E2FA55F980086D909 /* CoCo.hpp */, + 4B41EF6F2FA55F980086D909 /* CoCo.cpp */, + ); + path = CoCo; + sourceTree = ""; + }; + 4B41EF712FA55F980086D909 /* Tandy */ = { + isa = PBXGroup; + children = ( + 4B41EF702FA55F980086D909 /* CoCo */, + ); + path = Tandy; + sourceTree = ""; + }; 4B4518701F75E91800926311 /* Track */ = { isa = PBXGroup; children = ( @@ -5125,6 +5147,7 @@ 4BCF1FA51DADC3E10039D2E7 /* Oric */, 425739352B051EA800B7D1E4 /* PCCompatible */, 4B0F1BC92602F17B00B85C66 /* Sinclair */, + 4B41EF712FA55F980086D909 /* Tandy */, 4BCA6FAB2F589C0C000B9537 /* Thomson */, 4B2B3A461F9B8FA70062DABF /* Utility */, ); @@ -6483,6 +6506,7 @@ 4B2BF19123DCC6A200C3AD60 /* BD500.cpp in Sources */, 4B051CA926781D6500CA44E8 /* StaticAnalyser.cpp in Sources */, 4B055ADA1FAE9B460060FFFF /* 1770.cpp in Sources */, + 4B41EF742FA55F980086D909 /* CoCo.cpp in Sources */, 4B80CD77256CA16600176FCC /* 2MG.cpp in Sources */, 4B0F1BE62602FF9D00B85C66 /* ZX8081.cpp in Sources */, 4B0F1BDE2602FF9900B85C66 /* Video.cpp in Sources */, @@ -6768,6 +6792,7 @@ 4BB8616E24E22DC500A00E03 /* BufferingScanTarget.cpp in Sources */, 4BB4BFB022A42F290069048D /* MacintoshIMG.cpp in Sources */, 4B05401E219D1618001BF69C /* ScanTarget.cpp in Sources */, + 4B41EF732FA55F980086D909 /* CoCo.cpp in Sources */, 4B4518861F75E91A00926311 /* MFMDiskController.cpp in Sources */, 4B0ACC2C23775819008902D0 /* IntelligentKeyboard.cpp in Sources */, 4BC080CA26A238CC00D03FD8 /* AmigaADF.cpp in Sources */, @@ -7234,6 +7259,7 @@ 4B778F2E23A5F09E0000D260 /* IRQDelegatePortHandler.cpp in Sources */, 4B778EF323A5DB230000D260 /* PCMSegment.cpp in Sources */, 4B06AB0D2C6461610034D014 /* MultiMachine.cpp in Sources */, + 4B41EF722FA55F980086D909 /* CoCo.cpp in Sources */, 4B06AAD52C645F290034D014 /* AppleII.cpp in Sources */, 4B06AAFC2C6460970034D014 /* Keyboard.cpp in Sources */, 4B778F0D23A5EC150000D260 /* ZX80O81P.cpp in Sources */, From 5d0b06ff0a0b9927a8f4e9e5f9a3135591214621 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 1 May 2026 21:52:05 -0400 Subject: [PATCH 3/8] Further reduce macros. --- Machines/Utility/MachineForTarget.cpp | 157 +++++++++++++------------- 1 file changed, 79 insertions(+), 78 deletions(-) diff --git a/Machines/Utility/MachineForTarget.cpp b/Machines/Utility/MachineForTarget.cpp index 0f9357035..dd9c65dff 100644 --- a/Machines/Utility/MachineForTarget.cpp +++ b/Machines/Utility/MachineForTarget.cpp @@ -246,99 +246,100 @@ std::vector Machine::AllMachines(const Type type, const bool long_n return result; } -std::map> Machine::AllOptionsByMachineName() { +namespace { +struct OptionsList { std::map> options; -#define Emplace(machine, class) \ - options.emplace( \ - LongNameForTargetMachine(Analyser::Machine::machine), \ - std::make_unique(Configurable::OptionsType::UserFriendly) \ - ) + template + void emplace(const Analyser::Machine machine) { + options.emplace( + Machine::LongNameForTargetMachine(machine), + std::make_unique(Configurable::OptionsType::UserFriendly) + ); + }; +}; +} - Emplace(AmstradCPC, AmstradCPC::Machine); - Emplace(AppleII, Apple::II::Machine); - Emplace(Archimedes, Archimedes::Machine); - Emplace(AtariST, Atari::ST::Machine); - Emplace(BBCMicro, BBCMicro::Machine); - Emplace(ColecoVision, Coleco::Vision::Machine); - Emplace(Electron, Electron::Machine); - Emplace(Enterprise, Enterprise::Machine); - Emplace(Macintosh, Apple::Macintosh::Machine); - Emplace(MasterSystem, Sega::MasterSystem::Machine); - Emplace(MSX, MSX::Machine); - Emplace(Oric, Oric::Machine); - Emplace(Plus4, Commodore::Plus4::Machine); - Emplace(PCCompatible, PCCompatible::Machine); - Emplace(ThomsonMO, Thomson::MO::Machine); - Emplace(Vic20, Commodore::Vic20::Machine); - Emplace(ZX8081, Sinclair::ZX8081::Machine); - Emplace(ZXSpectrum, Sinclair::ZXSpectrum::Machine); +std::map> Machine::AllOptionsByMachineName() { + OptionsList options; -#undef Emplace + using enum Analyser::Machine; + options.emplace(AmstradCPC); + options.emplace(AppleII); + options.emplace(Archimedes); + options.emplace(AtariST); + options.emplace(BBCMicro); + options.emplace(ColecoVision); + options.emplace(Electron); + options.emplace(Enterprise); + options.emplace(Macintosh); + options.emplace(MasterSystem); + options.emplace(MSX); + options.emplace(Oric); + options.emplace(Plus4); + options.emplace(PCCompatible); + options.emplace(ThomsonMO); + options.emplace(Vic20); + options.emplace(ZX8081); + options.emplace(ZXSpectrum); - return options; + return std::move(options.options); +} + +namespace { +struct TargetList { + std::map> targets; + + template + void emplace(const Analyser::Machine machine) { + targets.emplace( + Machine::LongNameForTargetMachine(machine), + std::make_unique() + ); + }; + + void emplace(const Analyser::Machine machine, std::unique_ptr &&target) { + targets.emplace( + Machine::LongNameForTargetMachine(machine), + std::move(target) + ); + } +}; } std::map> Machine::TargetsByMachineName( const bool meaningful_without_media_only ) { - std::map> options; + TargetList targets; -#define AddMapped(Name, TargetNamespace) \ - options.emplace( \ - LongNameForTargetMachine(Analyser::Machine::Name), \ - std::make_unique() \ - ); -#define Add(Name) AddMapped(Name, Name) - - Add(Amiga); - Add(AmstradCPC); - Add(AppleII); - Add(AppleIIgs); - options.emplace( - LongNameForTargetMachine(Analyser::Machine::Archimedes), - std::make_unique() - ); - Add(AtariST); - options.emplace( - LongNameForTargetMachine(Analyser::Machine::BBCMicro), - std::make_unique() - ); - options.emplace( - LongNameForTargetMachine(Analyser::Machine::Electron), - std::make_unique() - ); - Add(Enterprise); - Add(Macintosh); - Add(MSX); - Add(Oric); - options.emplace( - LongNameForTargetMachine(Analyser::Machine::Plus4), - std::make_unique() - ); - Add(PCCompatible); - options.emplace( - LongNameForTargetMachine(Analyser::Machine::ThomsonMO), - std::make_unique() - ); - options.emplace( - LongNameForTargetMachine(Analyser::Machine::Vic20), - std::make_unique() - ); - Add(ZX8081); - Add(ZXSpectrum); + using enum Analyser::Machine; + targets.emplace(Amiga); + targets.emplace(AmstradCPC); + targets.emplace(AppleII); + targets.emplace(AppleIIgs); + targets.emplace(Archimedes); + targets.emplace(AtariST); + targets.emplace(BBCMicro); + targets.emplace(Electron); + targets.emplace(Enterprise); + targets.emplace(Macintosh); + targets.emplace(MSX); + targets.emplace(Oric); + targets.emplace(Plus4); + targets.emplace(PCCompatible); + targets.emplace(ThomsonMO); + targets.emplace(Vic20); + targets.emplace(ThomsonMO); + targets.emplace(ZXSpectrum); if(!meaningful_without_media_only) { - Add(Atari2600); - options.emplace( - LongNameForTargetMachine(Analyser::Machine::ColecoVision), + targets.emplace(Atari2600); + targets.emplace( + ColecoVision, std::make_unique(Analyser::Machine::ColecoVision) ); - AddMapped(MasterSystem, Sega); + targets.emplace(MasterSystem); } -#undef Add -#undef AddMapped - - return options; + return std::move(targets.targets); } From 70bbba94a9fd1e257a32ae85c559fdad87889c1c Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 1 May 2026 22:04:17 -0400 Subject: [PATCH 4/8] Fix ZX80/81 options. --- Machines/Utility/MachineForTarget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Machines/Utility/MachineForTarget.cpp b/Machines/Utility/MachineForTarget.cpp index dd9c65dff..97de17f36 100644 --- a/Machines/Utility/MachineForTarget.cpp +++ b/Machines/Utility/MachineForTarget.cpp @@ -329,7 +329,7 @@ std::map> Machine::Target targets.emplace(PCCompatible); targets.emplace(ThomsonMO); targets.emplace(Vic20); - targets.emplace(ThomsonMO); + targets.emplace(ZX8081); targets.emplace(ZXSpectrum); if(!meaningful_without_media_only) { From f068a5d3e94abb315e3c9eb732e07a5520438a12 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 1 May 2026 22:07:23 -0400 Subject: [PATCH 5/8] Add new CoCo file to more builds. --- OSBindings/Qt/clksignal.pro | 2 ++ OSBindings/SDL/SConstruct | 1 + cmake/CLK_SOURCES.cmake | 1 + 3 files changed, 4 insertions(+) diff --git a/OSBindings/Qt/clksignal.pro b/OSBindings/Qt/clksignal.pro index 6648a7358..5321eab07 100644 --- a/OSBindings/Qt/clksignal.pro +++ b/OSBindings/Qt/clksignal.pro @@ -120,6 +120,7 @@ SOURCES += \ $$SRC/Machines/Sinclair/Keyboard/*.cpp \ $$SRC/Machines/Sinclair/ZX8081/*.cpp \ $$SRC/Machines/Sinclair/ZXSpectrum/*.cpp \ + $$SRC/Machines/Tandy/CoCo/*.cpp \ $$SRC/Machines/Thomson/MO/*.cpp \ \ $$SRC/Outputs/*.cpp \ @@ -267,6 +268,7 @@ HEADERS += \ $$SRC/Machines/Sinclair/Keyboard/*.hpp \ $$SRC/Machines/Sinclair/ZX8081/*.hpp \ $$SRC/Machines/Sinclair/ZXSpectrum/*.hpp \ + $$SRC/Machines/Tandy/CoCo/*.hpp \ $$SRC/Machines/Thomson/MO/*.hpp \ $$SRC/Machines/Thomson/MO/FastTapeSchemes/*.hpp \ \ diff --git a/OSBindings/SDL/SConstruct b/OSBindings/SDL/SConstruct index 14d06a6bb..939d738a6 100644 --- a/OSBindings/SDL/SConstruct +++ b/OSBindings/SDL/SConstruct @@ -102,6 +102,7 @@ SOURCES += glob.glob('../../Machines/Utility/*.cpp') SOURCES += glob.glob('../../Machines/Sinclair/Keyboard/*.cpp') SOURCES += glob.glob('../../Machines/Sinclair/ZX8081/*.cpp') SOURCES += glob.glob('../../Machines/Sinclair/ZXSpectrum/*.cpp') +SOURCES += glob.glob('../../Machines/Tandy/CoCo/*.cpp') SOURCES += glob.glob('../../Machines/Thomson/MO/*.cpp') SOURCES += glob.glob('../../Outputs/*.cpp') diff --git a/cmake/CLK_SOURCES.cmake b/cmake/CLK_SOURCES.cmake index 0a32638ce..d81a137cd 100644 --- a/cmake/CLK_SOURCES.cmake +++ b/cmake/CLK_SOURCES.cmake @@ -151,6 +151,7 @@ set(CLK_SOURCES Machines/Sinclair/ZX8081/Video.cpp Machines/Sinclair/ZX8081/ZX8081.cpp Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp + Machines/Tandy/CoCo/CoCo.cpp Machines/Thomson/MO/CD90-640.cpp Machines/Thomson/MO/MO.cpp Machines/Thomson/MO/Video.cpp From 85ddc42f9c1c5daa25a99370ef63843536a9ccf1 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 1 May 2026 22:41:25 -0400 Subject: [PATCH 6/8] Regularise factory method name. --- Machines/Acorn/Archimedes/Archimedes.cpp | 4 ++-- Machines/Acorn/Archimedes/Archimedes.hpp | 2 +- Machines/Acorn/BBCMicro/BBCMicro.cpp | 4 ++-- Machines/Acorn/BBCMicro/BBCMicro.hpp | 5 +---- Machines/Acorn/Electron/Electron.cpp | 5 ++++- Machines/Acorn/Electron/Electron.hpp | 5 +---- Machines/Amiga/Amiga.cpp | 5 ++++- Machines/Amiga/Amiga.hpp | 2 +- Machines/AmstradCPC/AmstradCPC.cpp | 4 ++-- Machines/AmstradCPC/AmstradCPC.hpp | 4 ++-- Machines/Apple/AppleII/AppleII.cpp | 5 ++++- Machines/Apple/AppleII/AppleII.hpp | 2 +- Machines/Apple/AppleIIgs/AppleIIgs.cpp | 5 ++++- Machines/Apple/AppleIIgs/AppleIIgs.hpp | 2 +- Machines/Apple/Macintosh/Macintosh.cpp | 5 ++++- Machines/Apple/Macintosh/Macintosh.hpp | 2 +- Machines/Atari/2600/Atari2600.cpp | 2 +- Machines/Atari/2600/Atari2600.hpp | 2 +- Machines/Atari/ST/AtariST.cpp | 5 ++++- Machines/Atari/ST/AtariST.hpp | 2 +- Machines/ColecoVision/ColecoVision.cpp | 5 ++++- Machines/ColecoVision/ColecoVision.hpp | 2 +- Machines/Commodore/Plus4/Plus4.cpp | 4 ++-- Machines/Commodore/Plus4/Plus4.hpp | 2 +- Machines/Commodore/Vic-20/Vic20.cpp | 2 +- Machines/Commodore/Vic-20/Vic20.hpp | 2 +- Machines/Enterprise/Enterprise.cpp | 2 +- Machines/Enterprise/Enterprise.hpp | 2 +- Machines/MSX/MSX.cpp | 5 ++++- Machines/MSX/MSX.hpp | 2 +- Machines/MasterSystem/MasterSystem.cpp | 4 ++-- Machines/MasterSystem/MasterSystem.hpp | 2 +- Machines/Oric/Oric.cpp | 5 ++++- Machines/Oric/Oric.hpp | 2 +- Machines/PCCompatible/PCCompatible.cpp | 4 ++-- Machines/PCCompatible/PCCompatible.hpp | 5 +---- Machines/Sinclair/ZX8081/ZX8081.cpp | 5 ++++- Machines/Sinclair/ZX8081/ZX8081.hpp | 2 +- Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp | 5 ++++- Machines/Sinclair/ZXSpectrum/ZXSpectrum.hpp | 2 +- Machines/Thomson/MO/MO.cpp | 4 ++-- Machines/Thomson/MO/MO.hpp | 5 +---- Machines/Utility/MachineForTarget.cpp | 2 +- 43 files changed, 84 insertions(+), 63 deletions(-) diff --git a/Machines/Acorn/Archimedes/Archimedes.cpp b/Machines/Acorn/Archimedes/Archimedes.cpp index 1e03df7ea..1b921f254 100644 --- a/Machines/Acorn/Archimedes/Archimedes.cpp +++ b/Machines/Acorn/Archimedes/Archimedes.cpp @@ -749,8 +749,8 @@ private: using namespace Archimedes; -std::unique_ptr Machine::Archimedes( - const Analyser::Static::Target *target, +std::unique_ptr Machine::create( + const Analyser::Static::Target *const target, const ROMMachine::ROMFetcher &rom_fetcher ) { const auto archimedes_target = dynamic_cast(target); diff --git a/Machines/Acorn/Archimedes/Archimedes.hpp b/Machines/Acorn/Archimedes/Archimedes.hpp index 8f04a1b7d..cbc7d08f8 100644 --- a/Machines/Acorn/Archimedes/Archimedes.hpp +++ b/Machines/Acorn/Archimedes/Archimedes.hpp @@ -19,7 +19,7 @@ namespace Archimedes { struct Machine { virtual ~Machine() = default; - static std::unique_ptr Archimedes( + static std::unique_ptr create( const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher ); diff --git a/Machines/Acorn/BBCMicro/BBCMicro.cpp b/Machines/Acorn/BBCMicro/BBCMicro.cpp index 80e624d73..9e976c6b3 100644 --- a/Machines/Acorn/BBCMicro/BBCMicro.cpp +++ b/Machines/Acorn/BBCMicro/BBCMicro.cpp @@ -1349,8 +1349,8 @@ std::unique_ptr machine(const Target &target, const ROMMachine::ROMFetc } } -std::unique_ptr Machine::BBCMicro( - const Analyser::Static::Target *target, +std::unique_ptr Machine::create( + const Analyser::Static::Target *const target, const ROMMachine::ROMFetcher &rom_fetcher ) { const Target *const acorn_target = dynamic_cast(target); diff --git a/Machines/Acorn/BBCMicro/BBCMicro.hpp b/Machines/Acorn/BBCMicro/BBCMicro.hpp index dfa90a207..96258f3d9 100644 --- a/Machines/Acorn/BBCMicro/BBCMicro.hpp +++ b/Machines/Acorn/BBCMicro/BBCMicro.hpp @@ -20,10 +20,7 @@ namespace BBCMicro { struct Machine { virtual ~Machine() = default; - static std::unique_ptr BBCMicro( - const Analyser::Static::Target *target, - const ROMMachine::ROMFetcher &rom_fetcher - ); + static std::unique_ptr create(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); class Options: public Reflection::StructImpl, diff --git a/Machines/Acorn/Electron/Electron.cpp b/Machines/Acorn/Electron/Electron.cpp index c7bad201c..8232e7a0a 100644 --- a/Machines/Acorn/Electron/Electron.cpp +++ b/Machines/Acorn/Electron/Electron.cpp @@ -792,7 +792,10 @@ private: using namespace Electron; -std::unique_ptr Machine::Electron(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher) { +std::unique_ptr Machine::create( + const Analyser::Static::Target *const target, + const ROMMachine::ROMFetcher &rom_fetcher +) { using Target = Analyser::Static::Acorn::ElectronTarget; const Target *const acorn_target = dynamic_cast(target); diff --git a/Machines/Acorn/Electron/Electron.hpp b/Machines/Acorn/Electron/Electron.hpp index cb37950fe..86f523870 100644 --- a/Machines/Acorn/Electron/Electron.hpp +++ b/Machines/Acorn/Electron/Electron.hpp @@ -27,10 +27,7 @@ struct Machine { virtual ~Machine() = default; /// Creates and returns an Electron. - static std::unique_ptr Electron( - const Analyser::Static::Target *target, - const ROMMachine::ROMFetcher &rom_fetcher - ); + static std::unique_ptr create(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); /// Defines the runtime options available for an Electron. class Options: diff --git a/Machines/Amiga/Amiga.cpp b/Machines/Amiga/Amiga.cpp index 00fa98c6f..907dfebfa 100644 --- a/Machines/Amiga/Amiga.cpp +++ b/Machines/Amiga/Amiga.cpp @@ -251,7 +251,10 @@ private: using namespace Amiga; -std::unique_ptr Machine::Amiga(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher) { +std::unique_ptr Machine::create( + const Analyser::Static::Target *const target, + const ROMMachine::ROMFetcher &rom_fetcher +) { using Target = Analyser::Static::Amiga::Target; const Target *const amiga_target = dynamic_cast(target); return std::make_unique(*amiga_target, rom_fetcher); diff --git a/Machines/Amiga/Amiga.hpp b/Machines/Amiga/Amiga.hpp index 892228883..1faadc449 100644 --- a/Machines/Amiga/Amiga.hpp +++ b/Machines/Amiga/Amiga.hpp @@ -19,7 +19,7 @@ struct Machine { virtual ~Machine() = default; /// Creates and returns an Amiga. - static std::unique_ptr Amiga(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); + static std::unique_ptr create(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); }; } diff --git a/Machines/AmstradCPC/AmstradCPC.cpp b/Machines/AmstradCPC/AmstradCPC.cpp index 9acbf32ad..bf82561e7 100644 --- a/Machines/AmstradCPC/AmstradCPC.cpp +++ b/Machines/AmstradCPC/AmstradCPC.cpp @@ -1390,8 +1390,8 @@ std::unique_ptr machine( } // See header; constructs and returns an instance of the Amstrad CPC. -std::unique_ptr Machine::AmstradCPC( - const Analyser::Static::Target *target, +std::unique_ptr Machine::create( + const Analyser::Static::Target *const target, const ROMMachine::ROMFetcher &rom_fetcher ) { using Target = Analyser::Static::AmstradCPC::Target; diff --git a/Machines/AmstradCPC/AmstradCPC.hpp b/Machines/AmstradCPC/AmstradCPC.hpp index 07b7ecbed..a7c5ec548 100644 --- a/Machines/AmstradCPC/AmstradCPC.hpp +++ b/Machines/AmstradCPC/AmstradCPC.hpp @@ -24,8 +24,8 @@ struct Machine { virtual ~Machine() = default; /// Creates and returns an Amstrad CPC. - static std::unique_ptr AmstradCPC( - const Analyser::Static::Target *const target, + static std::unique_ptr create( + const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher ); diff --git a/Machines/Apple/AppleII/AppleII.cpp b/Machines/Apple/AppleII/AppleII.cpp index 20a584087..3ad62b24c 100644 --- a/Machines/Apple/AppleII/AppleII.cpp +++ b/Machines/Apple/AppleII/AppleII.cpp @@ -1094,7 +1094,10 @@ public: using namespace Apple::II; -std::unique_ptr Machine::AppleII(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher) { +std::unique_ptr Machine::create( + const Analyser::Static::Target *const target, + const ROMMachine::ROMFetcher &rom_fetcher +) { using Target = Analyser::Static::AppleII::Target; const Target *const appleii_target = dynamic_cast(target); diff --git a/Machines/Apple/AppleII/AppleII.hpp b/Machines/Apple/AppleII/AppleII.hpp index b50469676..3264ae9f1 100644 --- a/Machines/Apple/AppleII/AppleII.hpp +++ b/Machines/Apple/AppleII/AppleII.hpp @@ -21,7 +21,7 @@ struct Machine { virtual ~Machine() = default; /// Creates and returns an AppleII. - static std::unique_ptr AppleII(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); + static std::unique_ptr create(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); /// Defines the runtime options available for an Apple II. class Options: public Reflection::StructImpl, public Configurable::Options::Display { diff --git a/Machines/Apple/AppleIIgs/AppleIIgs.cpp b/Machines/Apple/AppleIIgs/AppleIIgs.cpp index ce6c798de..5164c00b7 100644 --- a/Machines/Apple/AppleIIgs/AppleIIgs.cpp +++ b/Machines/Apple/AppleIIgs/AppleIIgs.cpp @@ -1010,6 +1010,9 @@ private: using namespace Apple::IIgs; -std::unique_ptr Machine::AppleIIgs(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher) { +std::unique_ptr Machine::create( + const Analyser::Static::Target *const target, + const ROMMachine::ROMFetcher &rom_fetcher +) { return std::make_unique(*dynamic_cast(target), rom_fetcher); } diff --git a/Machines/Apple/AppleIIgs/AppleIIgs.hpp b/Machines/Apple/AppleIIgs/AppleIIgs.hpp index 12224f629..d8996c18f 100644 --- a/Machines/Apple/AppleIIgs/AppleIIgs.hpp +++ b/Machines/Apple/AppleIIgs/AppleIIgs.hpp @@ -21,7 +21,7 @@ struct Machine { virtual ~Machine() = default; /// Creates and returns an AppleIIgs. - static std::unique_ptr AppleIIgs(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); + static std::unique_ptr create(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); }; } diff --git a/Machines/Apple/Macintosh/Macintosh.cpp b/Machines/Apple/Macintosh/Macintosh.cpp index 56fa24056..40f1ca6cc 100644 --- a/Machines/Apple/Macintosh/Macintosh.cpp +++ b/Machines/Apple/Macintosh/Macintosh.cpp @@ -842,7 +842,10 @@ private: using namespace Apple::Macintosh; -std::unique_ptr Machine::Macintosh(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher) { +std::unique_ptr Machine::create( + const Analyser::Static::Target *const target, + const ROMMachine::ROMFetcher &rom_fetcher +) { auto *const mac_target = dynamic_cast(target); using Model = Analyser::Static::Macintosh::Target::Model; diff --git a/Machines/Apple/Macintosh/Macintosh.hpp b/Machines/Apple/Macintosh/Macintosh.hpp index e9e29d309..340af4e30 100644 --- a/Machines/Apple/Macintosh/Macintosh.hpp +++ b/Machines/Apple/Macintosh/Macintosh.hpp @@ -19,7 +19,7 @@ struct Machine { virtual ~Machine() = default; /// Creates and returns a Macintosh. - static std::unique_ptr Macintosh(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); + static std::unique_ptr create(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); class Options: public Reflection::StructImpl, public Configurable::Options::QuickBoot { friend Configurable::Options::QuickBoot; diff --git a/Machines/Atari/2600/Atari2600.cpp b/Machines/Atari/2600/Atari2600.cpp index f4e1c9cca..09eff7da4 100644 --- a/Machines/Atari/2600/Atari2600.cpp +++ b/Machines/Atari/2600/Atari2600.cpp @@ -219,7 +219,7 @@ private: using namespace Atari2600; -std::unique_ptr Machine::Atari2600(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &) { +std::unique_ptr Machine::create(const Analyser::Static::Target *const target, const ROMMachine::ROMFetcher &) { const Target *const atari_target = dynamic_cast(target); return std::make_unique(*atari_target); } diff --git a/Machines/Atari/2600/Atari2600.hpp b/Machines/Atari/2600/Atari2600.hpp index 765ad455f..a7f66f224 100644 --- a/Machines/Atari/2600/Atari2600.hpp +++ b/Machines/Atari/2600/Atari2600.hpp @@ -25,7 +25,7 @@ struct Machine { virtual ~Machine() = default; /// Creates and returns an Atari 2600 on the heap. - static std::unique_ptr Atari2600(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); + static std::unique_ptr create(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); /// Sets the switch @c input to @c state. virtual void set_switch_is_enabled(Atari2600Switch, bool) = 0; diff --git a/Machines/Atari/ST/AtariST.cpp b/Machines/Atari/ST/AtariST.cpp index 7402fe5f0..c22ab8fc3 100644 --- a/Machines/Atari/ST/AtariST.cpp +++ b/Machines/Atari/ST/AtariST.cpp @@ -708,7 +708,10 @@ private: using namespace Atari::ST; -std::unique_ptr Machine::AtariST(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher) { +std::unique_ptr Machine::create( + const Analyser::Static::Target *const target, + const ROMMachine::ROMFetcher &rom_fetcher +) { auto *const atari_target = dynamic_cast(target); if(!atari_target) { return nullptr; diff --git a/Machines/Atari/ST/AtariST.hpp b/Machines/Atari/ST/AtariST.hpp index e05dd6777..0ce33f1ef 100644 --- a/Machines/Atari/ST/AtariST.hpp +++ b/Machines/Atari/ST/AtariST.hpp @@ -20,7 +20,7 @@ namespace Atari::ST { struct Machine { virtual ~Machine() = default; - static std::unique_ptr AtariST(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); + static std::unique_ptr create(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); class Options: public Reflection::StructImpl, public Configurable::Options::Display { friend Configurable::Options::Display; diff --git a/Machines/ColecoVision/ColecoVision.cpp b/Machines/ColecoVision/ColecoVision.cpp index 3170a413b..be57445b7 100644 --- a/Machines/ColecoVision/ColecoVision.cpp +++ b/Machines/ColecoVision/ColecoVision.cpp @@ -420,6 +420,9 @@ private: using namespace Coleco::Vision; -std::unique_ptr Machine::ColecoVision(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher) { +std::unique_ptr Machine::create( + const Analyser::Static::Target *target, + const ROMMachine::ROMFetcher &rom_fetcher +) { return std::make_unique(*target, rom_fetcher); } diff --git a/Machines/ColecoVision/ColecoVision.hpp b/Machines/ColecoVision/ColecoVision.hpp index 99727b14e..a2ef85a42 100644 --- a/Machines/ColecoVision/ColecoVision.hpp +++ b/Machines/ColecoVision/ColecoVision.hpp @@ -19,7 +19,7 @@ namespace Coleco::Vision { struct Machine { virtual ~Machine() = default; - static std::unique_ptr ColecoVision(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); + static std::unique_ptr create(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); class Options: public Reflection::StructImpl, public Configurable::Options::Display { friend Configurable::Options::Display; diff --git a/Machines/Commodore/Plus4/Plus4.cpp b/Machines/Commodore/Plus4/Plus4.cpp index 21a63e730..5d59cf4b1 100644 --- a/Machines/Commodore/Plus4/Plus4.cpp +++ b/Machines/Commodore/Plus4/Plus4.cpp @@ -751,8 +751,8 @@ private: }; } -std::unique_ptr Machine::Plus4( - const Analyser::Static::Target *target, +std::unique_ptr Machine::create( + const Analyser::Static::Target *const target, const ROMMachine::ROMFetcher &rom_fetcher ) { using Target = Analyser::Static::Commodore::Plus4Target; diff --git a/Machines/Commodore/Plus4/Plus4.hpp b/Machines/Commodore/Plus4/Plus4.hpp index d32ae0a1d..686f29ee0 100644 --- a/Machines/Commodore/Plus4/Plus4.hpp +++ b/Machines/Commodore/Plus4/Plus4.hpp @@ -22,7 +22,7 @@ std::unique_ptr get_options(); struct Machine { virtual ~Machine() = default; - static std::unique_ptr Plus4(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); + static std::unique_ptr create(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); class Options: public Reflection::StructImpl, diff --git a/Machines/Commodore/Vic-20/Vic20.cpp b/Machines/Commodore/Vic-20/Vic20.cpp index ea84a324a..05dc159f8 100644 --- a/Machines/Commodore/Vic-20/Vic20.cpp +++ b/Machines/Commodore/Vic-20/Vic20.cpp @@ -817,7 +817,7 @@ private: using namespace Commodore::Vic20; -std::unique_ptr Machine::Vic20( +std::unique_ptr Machine::create( const Analyser::Static::Target *const target, const ROMMachine::ROMFetcher &rom_fetcher ) { diff --git a/Machines/Commodore/Vic-20/Vic20.hpp b/Machines/Commodore/Vic-20/Vic20.hpp index 9dd4f27e4..813d058ad 100644 --- a/Machines/Commodore/Vic-20/Vic20.hpp +++ b/Machines/Commodore/Vic-20/Vic20.hpp @@ -24,7 +24,7 @@ struct Machine { virtual ~Machine() = default; /// Creates and returns a Vic-20. - static std::unique_ptr Vic20(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); + static std::unique_ptr create(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); class Options: public Reflection::StructImpl, diff --git a/Machines/Enterprise/Enterprise.cpp b/Machines/Enterprise/Enterprise.cpp index fff2e3e96..acb01a25a 100644 --- a/Machines/Enterprise/Enterprise.cpp +++ b/Machines/Enterprise/Enterprise.cpp @@ -990,7 +990,7 @@ std::unique_ptr machine( } -std::unique_ptr Machine::Enterprise( +std::unique_ptr Machine::create( const Analyser::Static::Target *const target, const ROMMachine::ROMFetcher &rom_fetcher ) { diff --git a/Machines/Enterprise/Enterprise.hpp b/Machines/Enterprise/Enterprise.hpp index 7421f7174..cfe487ca3 100644 --- a/Machines/Enterprise/Enterprise.hpp +++ b/Machines/Enterprise/Enterprise.hpp @@ -25,7 +25,7 @@ namespace Enterprise { */ struct Machine { virtual ~Machine() = default; - static std::unique_ptr Enterprise(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); + static std::unique_ptr create(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); /// Defines the runtime options available for an Enterprise. class Options: public Reflection::StructImpl, public Configurable::Options::Display { diff --git a/Machines/MSX/MSX.cpp b/Machines/MSX/MSX.cpp index 706077797..3901044ba 100644 --- a/Machines/MSX/MSX.cpp +++ b/Machines/MSX/MSX.cpp @@ -1039,7 +1039,10 @@ private: using namespace MSX; -std::unique_ptr Machine::MSX(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher) { +std::unique_ptr Machine::create( + const Analyser::Static::Target *const target, + const ROMMachine::ROMFetcher &rom_fetcher +) { const auto msx_target = dynamic_cast(target); if(msx_target->has_msx_music) { switch(msx_target->model) { diff --git a/Machines/MSX/MSX.hpp b/Machines/MSX/MSX.hpp index f89552560..fff6c4fee 100644 --- a/Machines/MSX/MSX.hpp +++ b/Machines/MSX/MSX.hpp @@ -19,7 +19,7 @@ namespace MSX { struct Machine { virtual ~Machine() = default; - static std::unique_ptr MSX(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); + static std::unique_ptr create(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); class Options: public Reflection::StructImpl, diff --git a/Machines/MasterSystem/MasterSystem.cpp b/Machines/MasterSystem/MasterSystem.cpp index b09e33260..315f4bde3 100644 --- a/Machines/MasterSystem/MasterSystem.cpp +++ b/Machines/MasterSystem/MasterSystem.cpp @@ -606,8 +606,8 @@ private: using namespace Sega::MasterSystem; -std::unique_ptr Machine::MasterSystem( - const Analyser::Static::Target *target, +std::unique_ptr Machine::create( + const Analyser::Static::Target *const target, const ROMMachine::ROMFetcher &rom_fetcher ) { using Target = Analyser::Static::Sega::Target; diff --git a/Machines/MasterSystem/MasterSystem.hpp b/Machines/MasterSystem/MasterSystem.hpp index 1103714f6..6d5c90e44 100644 --- a/Machines/MasterSystem/MasterSystem.hpp +++ b/Machines/MasterSystem/MasterSystem.hpp @@ -19,7 +19,7 @@ namespace Sega::MasterSystem { struct Machine { virtual ~Machine() = default; - static std::unique_ptr MasterSystem(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); + static std::unique_ptr create(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); class Options: public Reflection::StructImpl, public Configurable::Options::Display { friend Configurable::Options::Display; diff --git a/Machines/Oric/Oric.cpp b/Machines/Oric/Oric.cpp index daceed2c8..53b42fdce 100644 --- a/Machines/Oric/Oric.cpp +++ b/Machines/Oric/Oric.cpp @@ -835,7 +835,10 @@ std::unique_ptr machine(const Analyser::Static::Oric::Target &target, c } -std::unique_ptr Machine::Oric(const Analyser::Static::Target *target_hint, const ROMMachine::ROMFetcher &rom_fetcher) { +std::unique_ptr Machine::create( + const Analyser::Static::Target *const target_hint, + const ROMMachine::ROMFetcher &rom_fetcher +) { auto *const oric_target = dynamic_cast(target_hint); switch(oric_target->processor) { diff --git a/Machines/Oric/Oric.hpp b/Machines/Oric/Oric.hpp index 9e5b6b839..9c3e926a4 100644 --- a/Machines/Oric/Oric.hpp +++ b/Machines/Oric/Oric.hpp @@ -22,7 +22,7 @@ namespace Oric { */ struct Machine { virtual ~Machine() = default; - static std::unique_ptr Oric(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); + static std::unique_ptr create(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); class Options: public Reflection::StructImpl, diff --git a/Machines/PCCompatible/PCCompatible.cpp b/Machines/PCCompatible/PCCompatible.cpp index 792bbe6ff..fb11df1a2 100644 --- a/Machines/PCCompatible/PCCompatible.cpp +++ b/Machines/PCCompatible/PCCompatible.cpp @@ -1153,8 +1153,8 @@ std::unique_ptr machine(const Target &target, const ROMMachine::ROMFetc } } -std::unique_ptr Machine::PCCompatible( - const Analyser::Static::Target *target, +std::unique_ptr Machine::create( + const Analyser::Static::Target *const target, const ROMMachine::ROMFetcher &rom_fetcher ) { const Target *const pc_target = dynamic_cast(target); diff --git a/Machines/PCCompatible/PCCompatible.hpp b/Machines/PCCompatible/PCCompatible.hpp index 633b180c8..7ae2effed 100644 --- a/Machines/PCCompatible/PCCompatible.hpp +++ b/Machines/PCCompatible/PCCompatible.hpp @@ -22,10 +22,7 @@ struct Machine { virtual ~Machine() = default; /// Creates and returns a PC Compatible. - static std::unique_ptr PCCompatible( - const Analyser::Static::Target *target, - const ROMMachine::ROMFetcher &rom_fetcher - ); + static std::unique_ptr create(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); /// Defines the runtime options [sometimes] available for a PC. class Options: diff --git a/Machines/Sinclair/ZX8081/ZX8081.cpp b/Machines/Sinclair/ZX8081/ZX8081.cpp index 77e51fff3..639818185 100644 --- a/Machines/Sinclair/ZX8081/ZX8081.cpp +++ b/Machines/Sinclair/ZX8081/ZX8081.cpp @@ -498,7 +498,10 @@ private: using namespace Sinclair::ZX8081; // See header; constructs and returns an instance of the ZX80 or 81. -std::unique_ptr Machine::ZX8081(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher) { +std::unique_ptr Machine::create( + const Analyser::Static::Target *const target, + const ROMMachine::ROMFetcher &rom_fetcher +) { const auto zx_target = dynamic_cast(target); // Instantiate the correct type of machine. diff --git a/Machines/Sinclair/ZX8081/ZX8081.hpp b/Machines/Sinclair/ZX8081/ZX8081.hpp index 89863d93e..d02b5475e 100644 --- a/Machines/Sinclair/ZX8081/ZX8081.hpp +++ b/Machines/Sinclair/ZX8081/ZX8081.hpp @@ -20,7 +20,7 @@ namespace Sinclair::ZX8081 { /// The ZX80/81 machine. struct Machine { virtual ~Machine() = default; - static std::unique_ptr ZX8081(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher); + static std::unique_ptr create(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); virtual void set_tape_is_playing(bool is_playing) = 0; virtual bool get_tape_is_playing() = 0; diff --git a/Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp b/Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp index ec376bffe..8446d668d 100644 --- a/Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp +++ b/Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp @@ -1013,7 +1013,10 @@ private: using namespace Sinclair::ZXSpectrum; -std::unique_ptr Machine::ZXSpectrum(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher) { +std::unique_ptr Machine::create( + const Analyser::Static::Target *const target, + const ROMMachine::ROMFetcher &rom_fetcher +) { const auto zx_target = dynamic_cast(target); switch(zx_target->model) { diff --git a/Machines/Sinclair/ZXSpectrum/ZXSpectrum.hpp b/Machines/Sinclair/ZXSpectrum/ZXSpectrum.hpp index 1da817740..88b4928df 100644 --- a/Machines/Sinclair/ZXSpectrum/ZXSpectrum.hpp +++ b/Machines/Sinclair/ZXSpectrum/ZXSpectrum.hpp @@ -19,7 +19,7 @@ namespace Sinclair::ZXSpectrum { struct Machine { virtual ~Machine() = default; - static std::unique_ptr ZXSpectrum(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); + static std::unique_ptr create(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); virtual void set_tape_is_playing(bool is_playing) = 0; virtual bool get_tape_is_playing() = 0; diff --git a/Machines/Thomson/MO/MO.cpp b/Machines/Thomson/MO/MO.cpp index 8e4a7b623..851fae6e9 100644 --- a/Machines/Thomson/MO/MO.cpp +++ b/Machines/Thomson/MO/MO.cpp @@ -738,8 +738,8 @@ std::unique_ptr machine(const Target &target, const ROMMachine::ROMFetc } } -std::unique_ptr Machine::ThomsonMO( - const Analyser::Static::Target *target, +std::unique_ptr Machine::create( + const Analyser::Static::Target *const target, const ROMMachine::ROMFetcher &rom_fetcher ) { const Target *const thomson_target = dynamic_cast(target); diff --git a/Machines/Thomson/MO/MO.hpp b/Machines/Thomson/MO/MO.hpp index eb52217de..6e1baac96 100644 --- a/Machines/Thomson/MO/MO.hpp +++ b/Machines/Thomson/MO/MO.hpp @@ -20,10 +20,7 @@ namespace Thomson::MO { struct Machine { virtual ~Machine() = default; - static std::unique_ptr ThomsonMO( - const Analyser::Static::Target *, - const ROMMachine::ROMFetcher & - ); + static std::unique_ptr create(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); class Options: public Reflection::StructImpl, diff --git a/Machines/Utility/MachineForTarget.cpp b/Machines/Utility/MachineForTarget.cpp index 97de17f36..670fb9a14 100644 --- a/Machines/Utility/MachineForTarget.cpp +++ b/Machines/Utility/MachineForTarget.cpp @@ -68,7 +68,7 @@ std::unique_ptr Machine::MachineForTarget( #define BindD(name, m) \ case Analyser::Machine::m: \ machine = std::make_unique>( \ - name::Machine::m(target, rom_fetcher) \ + name::Machine::create(target, rom_fetcher) \ ); \ break; #define Bind(m) BindD(m, m) From 99443137d09733095889cbb0b4067e11f4eed323 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 1 May 2026 22:53:06 -0400 Subject: [PATCH 7/8] Replace macro. --- Machines/Utility/MachineForTarget.cpp | 85 +++++++++++++++------------ 1 file changed, 47 insertions(+), 38 deletions(-) diff --git a/Machines/Utility/MachineForTarget.cpp b/Machines/Utility/MachineForTarget.cpp index 670fb9a14..5b7c67cef 100644 --- a/Machines/Utility/MachineForTarget.cpp +++ b/Machines/Utility/MachineForTarget.cpp @@ -55,53 +55,62 @@ #include "Analyser/Dynamic/MultiMachine/MultiMachine.hpp" #include "TypedDynamicMachine.hpp" +namespace { +struct MachineGenerator { + MachineGenerator( + const Analyser::Static::Target *const target, + const ROMMachine::ROMFetcher &rom_fetcher + ) : target(target), rom_fetcher(rom_fetcher) {} + + const Analyser::Static::Target *const target; + const ROMMachine::ROMFetcher &rom_fetcher; + + std::unique_ptr machine; + + template + void posit(const Analyser::Machine name) { + if(target->machine == name) { + machine = std::make_unique>(MachineT::create(target, rom_fetcher)); + } + } +}; +} + std::unique_ptr Machine::MachineForTarget( const Analyser::Static::Target *const target, const ROMMachine::ROMFetcher &rom_fetcher, Machine::Error &error ) { error = Machine::Error::None; - std::unique_ptr machine; + MachineGenerator generator(target, rom_fetcher); try { + using enum Analyser::Machine; + generator.posit(Amiga); + generator.posit(AmstradCPC); + generator.posit(Archimedes); + generator.posit(AppleII); + generator.posit(AppleIIgs); + generator.posit(Macintosh); + generator.posit(Atari2600); + generator.posit(AtariST); + generator.posit(BBCMicro); + generator.posit(ColecoVision); + generator.posit(Plus4); + generator.posit(Vic20); + generator.posit(Electron); + generator.posit(Enterprise); + generator.posit(MSX); + generator.posit(Oric); + generator.posit(PCCompatible); + generator.posit(MasterSystem); + generator.posit(ZX8081); + generator.posit(ZXSpectrum); + generator.posit(ThomsonMO); -#define BindD(name, m) \ - case Analyser::Machine::m: \ - machine = std::make_unique>( \ - name::Machine::create(target, rom_fetcher) \ - ); \ - break; -#define Bind(m) BindD(m, m) - switch(target->machine) { - Bind(Amiga) - Bind(AmstradCPC) - Bind(Archimedes) - BindD(Apple::II, AppleII) - BindD(Apple::IIgs, AppleIIgs) - BindD(Apple::Macintosh, Macintosh) - Bind(Atari2600) - BindD(Atari::ST, AtariST) - Bind(BBCMicro) - BindD(Coleco::Vision, ColecoVision) - BindD(Commodore::Plus4, Plus4) - BindD(Commodore::Vic20, Vic20) - Bind(Electron) - Bind(Enterprise) - Bind(MSX) - Bind(Oric) - Bind(PCCompatible) - BindD(Sega::MasterSystem, MasterSystem) - BindD(Sinclair::ZX8081, ZX8081) - BindD(Sinclair::ZXSpectrum, ZXSpectrum) - BindD(Thomson::MO, ThomsonMO) - - default: - error = Machine::Error::UnknownMachine; - return nullptr; + if(!generator.machine) { + error = Machine::Error::UnknownMachine; } -#undef Bind -#undef BindD - } catch(ROMMachine::Error construction_error) { switch(construction_error) { case ROMMachine::Error::MissingROMs: @@ -113,7 +122,7 @@ std::unique_ptr Machine::MachineForTarget( } } - return machine; + return std::move(generator.machine); } std::unique_ptr Machine::MachineForTargets( From 7c939085c4594165dae68493dcd93bbee48728eb Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 1 May 2026 22:59:13 -0400 Subject: [PATCH 8/8] Support TandyCoCo `create`. --- Machines/Tandy/CoCo/CoCo.cpp | 9 +++++++++ Machines/Tandy/CoCo/CoCo.hpp | 15 +++++++++++---- Machines/Utility/MachineForTarget.cpp | 5 +++++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Machines/Tandy/CoCo/CoCo.cpp b/Machines/Tandy/CoCo/CoCo.cpp index d93cc6fb5..aa5fde351 100644 --- a/Machines/Tandy/CoCo/CoCo.cpp +++ b/Machines/Tandy/CoCo/CoCo.cpp @@ -7,3 +7,12 @@ // #include "CoCo.hpp" + +using namespace Tandy::CoCo; + +std::unique_ptr Machine::create( + const Analyser::Static::Target *const , + const ROMMachine::ROMFetcher & +) { + return nullptr; +} diff --git a/Machines/Tandy/CoCo/CoCo.hpp b/Machines/Tandy/CoCo/CoCo.hpp index 3f255abe5..84573d888 100644 --- a/Machines/Tandy/CoCo/CoCo.hpp +++ b/Machines/Tandy/CoCo/CoCo.hpp @@ -6,9 +6,16 @@ // Copyright © 2026 Thomas Harte. All rights reserved. // -#ifndef CoCo_hpp -#define CoCo_hpp +#pragma once -#include +#include "Analyser/Static/StaticAnalyser.hpp" +#include "Machines/ROMMachine.hpp" -#endif /* CoCo_hpp */ +namespace Tandy::CoCo { + +struct Machine { + virtual ~Machine() = default; + static std::unique_ptr create(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &); +}; + +} diff --git a/Machines/Utility/MachineForTarget.cpp b/Machines/Utility/MachineForTarget.cpp index 5b7c67cef..dbcc185b6 100644 --- a/Machines/Utility/MachineForTarget.cpp +++ b/Machines/Utility/MachineForTarget.cpp @@ -29,6 +29,7 @@ #include "Machines/MSX/MSX.hpp" #include "Machines/Oric/Oric.hpp" #include "Machines/PCCompatible/PCCompatible.hpp" +#include "Machines/Tandy/CoCo/CoCo.hpp" #include "Machines/Thomson/MO/MO.hpp" #include "Machines/Sinclair/ZX8081/ZX8081.hpp" #include "Machines/Sinclair/ZXSpectrum/ZXSpectrum.hpp" @@ -106,6 +107,7 @@ std::unique_ptr Machine::MachineForTarget( generator.posit(MasterSystem); generator.posit(ZX8081); generator.posit(ZXSpectrum); + generator.posit(TandyCoCo); generator.posit(ThomsonMO); if(!generator.machine) { @@ -180,6 +182,7 @@ std::string Machine::ShortNameForTargetMachine(const Analyser::Machine machine) case Analyser::Machine::Oric: return "Oric"; case Analyser::Machine::Plus4: return "Plus4"; case Analyser::Machine::PCCompatible: return "PCCompatible"; + case Analyser::Machine::TandyCoCo: return "TandyCoCo"; case Analyser::Machine::ThomsonMO: return "ThomsonMO"; case Analyser::Machine::Vic20: return "Vic20"; case Analyser::Machine::ZX8081: return "ZX8081"; @@ -208,6 +211,7 @@ std::string Machine::LongNameForTargetMachine(const Analyser::Machine machine) { case Analyser::Machine::Oric: return "Oric"; case Analyser::Machine::Plus4: return "Commodore C16+4"; case Analyser::Machine::PCCompatible: return "PC Compatible"; + case Analyser::Machine::TandyCoCo: return "Tandy CoCo"; case Analyser::Machine::ThomsonMO: return "Thomson MO"; case Analyser::Machine::Vic20: return "Vic 20"; case Analyser::Machine::ZX8081: return "ZX80/81"; @@ -246,6 +250,7 @@ std::vector Machine::AllMachines(const Type type, const bool long_n add_name(Analyser::Machine::Oric); add_name(Analyser::Machine::Plus4); add_name(Analyser::Machine::PCCompatible); + add_name(Analyser::Machine::TandyCoCo); add_name(Analyser::Machine::ThomsonMO); add_name(Analyser::Machine::Vic20); add_name(Analyser::Machine::ZX8081);