From d25d7d7d408e7d32d7c603fc0b059981435fa881 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 29 Jul 2017 21:56:33 -0400 Subject: [PATCH] Added the Amstrad CPC as a named target and declared support for its CDT file format. --- OSBindings/Mac/Clock Signal/Info.plist | 18 ++++++++++++++ StaticAnalyser/StaticAnalyser.cpp | 34 +++++++++++--------------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/OSBindings/Mac/Clock Signal/Info.plist b/OSBindings/Mac/Clock Signal/Info.plist index eb8a76d93..cd9bb6f73 100644 --- a/OSBindings/Mac/Clock Signal/Info.plist +++ b/OSBindings/Mac/Clock Signal/Info.plist @@ -224,6 +224,24 @@ Tape Image CFBundleTypeRole Viewer + LSTypeIsPackage + 0 + NSDocumentClass + $(PRODUCT_MODULE_NAME).MachineDocument + + + CFBundleTypeExtensions + + cdt + + CFBundleTypeIconFile + cassette + CFBundleTypeName + Amstrad CPC Tape Image + CFBundleTypeRole + Viewer + LSTypeIsPackage + 0 NSDocumentClass $(PRODUCT_MODULE_NAME).MachineDocument diff --git a/StaticAnalyser/StaticAnalyser.cpp b/StaticAnalyser/StaticAnalyser.cpp index 0d437a692..c8ef57b3a 100644 --- a/StaticAnalyser/StaticAnalyser.cpp +++ b/StaticAnalyser/StaticAnalyser.cpp @@ -40,30 +40,28 @@ typedef int TargetPlatformType; enum class TargetPlatform: TargetPlatformType { Acorn = 1 << 0, - Atari2600 = 1 << 1, - Commodore = 1 << 2, - Oric = 1 << 3, - ZX8081 = 1 << 4, + AmstradCPC = 1 << 1, + Atari2600 = 1 << 2, + Commodore = 1 << 3, + Oric = 1 << 4, + ZX8081 = 1 << 5, - AllTape = Acorn | Commodore | Oric | ZX8081, + AllTape = Acorn | Commodore | Oric | ZX8081 | AmstradCPC, }; using namespace StaticAnalyser; -std::list StaticAnalyser::GetTargets(const char *file_name) -{ +std::list StaticAnalyser::GetTargets(const char *file_name) { std::list targets; // Get the extension, if any; it will be assumed that extensions are reliable, so an extension is a broad-phase // test as to file format. const char *mixed_case_extension = strrchr(file_name, '.'); char *lowercase_extension = nullptr; - if(mixed_case_extension) - { + if(mixed_case_extension) { lowercase_extension = strdup(mixed_case_extension+1); char *parser = lowercase_extension; - while(*parser) - { + while(*parser) { *parser = (char)tolower(*parser); parser++; } @@ -86,18 +84,17 @@ std::list StaticAnalyser::GetTargets(const char *file_name) } catch(...) {} #define Format(extension, list, class, platforms) \ - if(!strcmp(lowercase_extension, extension)) \ - { \ + if(!strcmp(lowercase_extension, extension)) { \ TryInsert(list, class, platforms) \ } - if(lowercase_extension) - { + if(lowercase_extension) { Format("80", tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // 80 Format("81", tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // 81 Format("a26", cartridges, Cartridge::BinaryDump, TargetPlatform::Atari2600) // A26 Format("adf", disks, Disk::AcornADF, TargetPlatform::Acorn) // ADF Format("bin", cartridges, Cartridge::BinaryDump, TargetPlatform::Atari2600) // BIN + Format("cdt", tapes, Tape::TZX, TargetPlatform::AmstradCPC) // CDT Format("csw", tapes, Tape::CSW, TargetPlatform::AllTape) // CSW Format("d64", disks, Disk::D64, TargetPlatform::Commodore) // D64 Format("dsd", disks, Disk::SSD, TargetPlatform::Acorn) // DSD @@ -108,14 +105,11 @@ std::list StaticAnalyser::GetTargets(const char *file_name) Format("p81", tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // P81 // PRG - if(!strcmp(lowercase_extension, "prg")) - { + if(!strcmp(lowercase_extension, "prg")) { // try instantiating as a ROM; failing that accept as a tape try { Insert(cartridges, Cartridge::PRG, TargetPlatform::Commodore) - } - catch(...) - { + } catch(...) { try { Insert(tapes, Tape::PRG, TargetPlatform::Commodore) } catch(...) {}