From 8b933182afbc3384708865c5c14960404dcae952 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 6 Sep 2016 06:39:40 -0400 Subject: [PATCH] Added enough wiring (hopefully) that the Commodore tape's GetFiles should be called when appropriate. --- .../Clock Signal.xcodeproj/project.pbxproj | 6 ++++ .../Commodore/CommodoreAnalyser.cpp | 36 +++++++++++++++++++ .../Commodore/CommodoreAnalyser.hpp | 27 ++++++++++++++ StaticAnalyser/Commodore/Tape.cpp | 9 +++++ StaticAnalyser/Commodore/Tape.hpp | 2 ++ StaticAnalyser/StaticAnalyser.cpp | 7 ++-- 6 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 StaticAnalyser/Commodore/CommodoreAnalyser.cpp create mode 100644 StaticAnalyser/Commodore/CommodoreAnalyser.hpp diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index a96b60c01..ff9aee474 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -335,6 +335,7 @@ 4BBF99181C8FBA6F0075DAFB /* TextureTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF99121C8FBA6F0075DAFB /* TextureTarget.cpp */; }; 4BC3B74F1CD194CC00F86E85 /* Shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B74D1CD194CC00F86E85 /* Shader.cpp */; }; 4BC3B7521CD1956900F86E85 /* OutputShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B7501CD1956900F86E85 /* OutputShader.cpp */; }; + 4BC5E4921D7ED365008CF980 /* CommodoreAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC5E4901D7ED365008CF980 /* CommodoreAnalyser.cpp */; }; 4BC751B21D157E61006C31D9 /* 6522Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BC751B11D157E61006C31D9 /* 6522Tests.swift */; }; 4BC76E691C98E31700E6EF73 /* FIRFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC76E671C98E31700E6EF73 /* FIRFilter.cpp */; }; 4BC76E6B1C98F43700E6EF73 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BC76E6A1C98F43700E6EF73 /* Accelerate.framework */; }; @@ -761,6 +762,8 @@ 4BC3B74E1CD194CC00F86E85 /* Shader.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Shader.hpp; sourceTree = ""; }; 4BC3B7501CD1956900F86E85 /* OutputShader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OutputShader.cpp; sourceTree = ""; }; 4BC3B7511CD1956900F86E85 /* OutputShader.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = OutputShader.hpp; sourceTree = ""; }; + 4BC5E4901D7ED365008CF980 /* CommodoreAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommodoreAnalyser.cpp; path = ../../StaticAnalyser/Commodore/CommodoreAnalyser.cpp; sourceTree = ""; }; + 4BC5E4911D7ED365008CF980 /* CommodoreAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = CommodoreAnalyser.hpp; path = ../../StaticAnalyser/Commodore/CommodoreAnalyser.hpp; sourceTree = ""; }; 4BC751B11D157E61006C31D9 /* 6522Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = 6522Tests.swift; sourceTree = ""; }; 4BC76E671C98E31700E6EF73 /* FIRFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FIRFilter.cpp; sourceTree = ""; }; 4BC76E681C98E31700E6EF73 /* FIRFilter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = FIRFilter.hpp; sourceTree = ""; }; @@ -1515,6 +1518,8 @@ 4BC830D21D6E7C6D0000A26F /* Commodore */ = { isa = PBXGroup; children = ( + 4BC5E4901D7ED365008CF980 /* CommodoreAnalyser.cpp */, + 4BC5E4911D7ED365008CF980 /* CommodoreAnalyser.hpp */, 4BC830CF1D6E7C690000A26F /* Tape.cpp */, 4BC830D01D6E7C690000A26F /* Tape.hpp */, ); @@ -2038,6 +2043,7 @@ 4BC76E691C98E31700E6EF73 /* FIRFilter.cpp in Sources */, 4B55CE5F1C3B7D960093A61B /* MachineDocument.swift in Sources */, 4B2A53A11D117D36003C6002 /* CSAtari2600.mm in Sources */, + 4BC5E4921D7ED365008CF980 /* CommodoreAnalyser.cpp in Sources */, 4BC830D11D6E7C690000A26F /* Tape.cpp in Sources */, 4B69FB441C4D941400B5F0AA /* TapeUEF.cpp in Sources */, 4B4DC8211D2C2425003C5BF8 /* Vic20.cpp in Sources */, diff --git a/StaticAnalyser/Commodore/CommodoreAnalyser.cpp b/StaticAnalyser/Commodore/CommodoreAnalyser.cpp new file mode 100644 index 000000000..90d30574e --- /dev/null +++ b/StaticAnalyser/Commodore/CommodoreAnalyser.cpp @@ -0,0 +1,36 @@ +// +// CommodoreAnalyser.cpp +// Clock Signal +// +// Created by Thomas Harte on 06/09/2016. +// Copyright © 2016 Thomas Harte. All rights reserved. +// + +#include "CommodoreAnalyser.hpp" + +#include "Tape.hpp" + +using namespace StaticAnalyser::Commodore; + +void StaticAnalyser::Commodore::AddTargets( + const std::list> &disks, + const std::list> &tapes, + const std::list> &cartridges, + std::list &destination) +{ + Target target; + target.machine = Target::Vic20; // TODO: machine estimation + target.probability = 1.0; // TODO: a proper estimation + + // strip out inappropriate cartridges +// target.cartridges = AcornCartridgesFrom(cartridges); + + // if there are any tapes, attempt to get data from the first + if(tapes.size() > 0) + { + std::shared_ptr tape = tapes.front(); + tape->reset(); + std::list files = GetFiles(tape); + tape->reset(); + } +} \ No newline at end of file diff --git a/StaticAnalyser/Commodore/CommodoreAnalyser.hpp b/StaticAnalyser/Commodore/CommodoreAnalyser.hpp new file mode 100644 index 000000000..003f1cc83 --- /dev/null +++ b/StaticAnalyser/Commodore/CommodoreAnalyser.hpp @@ -0,0 +1,27 @@ +// +// CommodoreAnalyser.hpp +// Clock Signal +// +// Created by Thomas Harte on 06/09/2016. +// Copyright © 2016 Thomas Harte. All rights reserved. +// + +#ifndef CommodoreAnalyser_hpp +#define CommodoreAnalyser_hpp + +#include "../StaticAnalyser.hpp" + +namespace StaticAnalyser { +namespace Commodore { + +void AddTargets( + const std::list> &disks, + const std::list> &tapes, + const std::list> &cartridges, + std::list &destination +); + +} +} + +#endif /* CommodoreAnalyser_hpp */ diff --git a/StaticAnalyser/Commodore/Tape.cpp b/StaticAnalyser/Commodore/Tape.cpp index ea826fe3f..ce236084b 100644 --- a/StaticAnalyser/Commodore/Tape.cpp +++ b/StaticAnalyser/Commodore/Tape.cpp @@ -7,3 +7,12 @@ // #include "Tape.hpp" + +using namespace StaticAnalyser::Commodore; + +std::list StaticAnalyser::Commodore::GetFiles(const std::shared_ptr &tape) +{ + std::list file_list; + + return file_list; +} diff --git a/StaticAnalyser/Commodore/Tape.hpp b/StaticAnalyser/Commodore/Tape.hpp index 7734b683f..1d92db3d1 100644 --- a/StaticAnalyser/Commodore/Tape.hpp +++ b/StaticAnalyser/Commodore/Tape.hpp @@ -25,6 +25,8 @@ struct File { std::vector data; }; +std::list GetFiles(const std::shared_ptr &tape); + } } #endif /* Tape_hpp */ diff --git a/StaticAnalyser/StaticAnalyser.cpp b/StaticAnalyser/StaticAnalyser.cpp index 404da6e8c..9a56221a4 100644 --- a/StaticAnalyser/StaticAnalyser.cpp +++ b/StaticAnalyser/StaticAnalyser.cpp @@ -12,6 +12,7 @@ // Analysers #include "Acorn/AcornAnalyser.hpp" +#include "Commodore/CommodoreAnalyser.hpp" // Cartridges #include "../Storage/Cartridge/Formats/BinaryDump.hpp" @@ -106,10 +107,8 @@ std::list StaticAnalyser::GetTargets(const char *file_name) // Hand off to platform-specific determination of whether these things are actually compatible and, // if so, how to load them. (TODO) - if(potential_platforms & (TargetPlatformType)TargetPlatform::Acorn) - { - Acorn::AddTargets(disks, tapes, cartridges, targets); - } + if(potential_platforms & (TargetPlatformType)TargetPlatform::Acorn) Acorn::AddTargets(disks, tapes, cartridges, targets); + if(potential_platforms & (TargetPlatformType)TargetPlatform::Commodore) Commodore::AddTargets(disks, tapes, cartridges, targets); free(lowercase_extension); return targets;