From e13312dcc53d29b486a793030641c66b5ed8e95f Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 16 Jan 2018 21:46:31 -0500 Subject: [PATCH 1/4] Removed stray new line. --- OSBindings/Mac/Clock Signal/AppDelegate.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/OSBindings/Mac/Clock Signal/AppDelegate.swift b/OSBindings/Mac/Clock Signal/AppDelegate.swift index 29283b1c1..baa92fb6a 100644 --- a/OSBindings/Mac/Clock Signal/AppDelegate.swift +++ b/OSBindings/Mac/Clock Signal/AppDelegate.swift @@ -24,4 +24,3 @@ class AppDelegate: NSObject, NSApplicationDelegate { return false } } - From 583c3cfe7de7a85af889e72dd11a58d6bb08027d Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 16 Jan 2018 22:27:41 -0500 Subject: [PATCH 2/4] Allows the MSX to load ROMs that aren't quite multiples of 8kb. --- StaticAnalyser/Acorn/StaticAnalyser.cpp | 2 +- StaticAnalyser/MSX/StaticAnalyser.cpp | 19 +++++++++++++------ Storage/Cartridge/Cartridge.hpp | 22 +++++++++++++++++++--- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/StaticAnalyser/Acorn/StaticAnalyser.cpp b/StaticAnalyser/Acorn/StaticAnalyser.cpp index c1ba2dfd2..ddcc86be4 100644 --- a/StaticAnalyser/Acorn/StaticAnalyser.cpp +++ b/StaticAnalyser/Acorn/StaticAnalyser.cpp @@ -24,7 +24,7 @@ static std::list> if(segments.size() != 1) continue; // which must be 8 or 16 kb in size - Storage::Cartridge::Cartridge::Segment segment = segments.front(); + const Storage::Cartridge::Cartridge::Segment &segment = segments.front(); if(segment.data.size() != 0x4000 && segment.data.size() != 0x2000) continue; // is a copyright string present? diff --git a/StaticAnalyser/MSX/StaticAnalyser.cpp b/StaticAnalyser/MSX/StaticAnalyser.cpp index 6120d5f32..c9aa4f402 100644 --- a/StaticAnalyser/MSX/StaticAnalyser.cpp +++ b/StaticAnalyser/MSX/StaticAnalyser.cpp @@ -34,10 +34,10 @@ static std::list> // Only one mapped item is allowed. if(segments.size() != 1) continue; - // Which must be a multiple of 16 kb in size. + // Which must be no more than 63 bytes larger than a multiple of 8 kb in size. Storage::Cartridge::Cartridge::Segment segment = segments.front(); const size_t data_size = segment.data.size(); - if(data_size < 0x2000 || data_size & 0x3fff) continue; + if(data_size < 0x2000 || (data_size & 0x1fff) > 64) continue; // Check for a ROM header at address 0; if it's not found then try 0x4000 // and adjust the start address; @@ -184,10 +184,17 @@ static std::list> } } - // Apply the standard MSX start address. - msx_cartridges.emplace_back(new Storage::Cartridge::Cartridge({ - Storage::Cartridge::Cartridge::Segment(start_address, segment.data) - })); + // Size down to a multiple of 8kb in size and apply the start address. + std::vector output_segments; + if(segment.data.size() & 0x1fff) { + std::vector truncated_data; + std::vector::difference_type truncated_size = static_cast::difference_type>(segment.data.size() & ~0x1fff); + truncated_data.insert(truncated_data.begin(), segment.data.begin(), segment.data.begin() + truncated_size); + output_segments.emplace_back(start_address, truncated_data); + } else { + output_segments.emplace_back(start_address, segment.data); + } + msx_cartridges.emplace_back(new Storage::Cartridge::Cartridge(output_segments)); } return msx_cartridges; diff --git a/Storage/Cartridge/Cartridge.hpp b/Storage/Cartridge/Cartridge.hpp index e5dc14c31..3b92b755a 100644 --- a/Storage/Cartridge/Cartridge.hpp +++ b/Storage/Cartridge/Cartridge.hpp @@ -28,12 +28,28 @@ namespace Cartridge { class Cartridge { public: struct Segment { - Segment(size_t start_address, size_t end_address, std::vector data) : - start_address(start_address), end_address(end_address), data(std::move(data)) {} + Segment(size_t start_address, size_t end_address, std::vector &&data) : + start_address(start_address), end_address(end_address), data(data) {} - Segment(size_t start_address, std::vector data) : + Segment(size_t start_address, size_t end_address, const std::vector &data) : + start_address(start_address), end_address(end_address), data(data) {} + + Segment(size_t start_address, std::vector &&data) : Segment(start_address, start_address + data.size(), data) {} + Segment(size_t start_address, const std::vector &data) : + Segment(start_address, start_address + data.size(), data) {} + + Segment(Segment &&segment) : + start_address(segment.start_address), + end_address(segment.end_address), + data(std::move(segment.data)) {} + + Segment(const Segment &segment) : + start_address(segment.start_address), + end_address(segment.end_address), + data(segment.data) {} + /// Indicates that an address is unknown. static const size_t UnknownAddress; From 46c76b9c07d5a51a4e1e840d2a65ddec95002878 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 17 Jan 2018 22:01:38 -0500 Subject: [PATCH 3/4] Switches to using the boilerplate public.item for all macOS UTIs. --- OSBindings/Mac/Clock Signal/Info.plist | 74 +++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 8 deletions(-) diff --git a/OSBindings/Mac/Clock Signal/Info.plist b/OSBindings/Mac/Clock Signal/Info.plist index 459574a27..e81a98e39 100644 --- a/OSBindings/Mac/Clock Signal/Info.plist +++ b/OSBindings/Mac/Clock Signal/Info.plist @@ -16,12 +16,12 @@ cartridge CFBundleTypeName Atari 2600 Cartridge - CFBundleTypeOSTypes - - ???? - CFBundleTypeRole Viewer + LSItemContentTypes + + public.item + LSTypeIsPackage 0 NSDocumentClass @@ -40,8 +40,7 @@ Viewer LSItemContentTypes - org.akop.cocoamsx.filetype.cartridge - com.clocksignal.rom + public.item LSTypeIsPackage 0 @@ -60,6 +59,10 @@ Electron/BBC UEF Image CFBundleTypeRole Viewer + LSItemContentTypes + + public.item + LSTypeIsPackage 0 NSDocumentClass @@ -76,6 +79,10 @@ Commodore Program CFBundleTypeRole Viewer + LSItemContentTypes + + public.item + LSTypeIsPackage 0 NSDocumentClass @@ -92,6 +99,10 @@ Tape Image CFBundleTypeRole Viewer + LSItemContentTypes + + public.item + LSTypeIsPackage 0 NSDocumentClass @@ -108,6 +119,10 @@ Commodore Disk CFBundleTypeRole Editor + LSItemContentTypes + + public.item + LSTypeIsPackage 0 NSDocumentClass @@ -124,6 +139,10 @@ Commodore 1540/1 Disk CFBundleTypeRole Editor + LSItemContentTypes + + public.item + LSTypeIsPackage 0 NSDocumentClass @@ -144,6 +163,10 @@ Electron/BBC Disk Image CFBundleTypeRole Editor + LSItemContentTypes + + public.item + LSTypeIsPackage 0 NSDocumentClass @@ -160,6 +183,10 @@ Disk Image CFBundleTypeRole Editor + LSItemContentTypes + + public.item + LSTypeIsPackage 0 NSDocumentClass @@ -177,6 +204,10 @@ ZX80 Tape Image CFBundleTypeRole Viewer + LSItemContentTypes + + public.item + LSTypeIsPackage 0 NSDocumentClass @@ -195,6 +226,10 @@ ZX81 Tape Image CFBundleTypeRole Viewer + LSItemContentTypes + + public.item + LSTypeIsPackage 0 NSDocumentClass @@ -211,6 +246,10 @@ Tape Image CFBundleTypeRole Viewer + LSItemContentTypes + + public.item + LSTypeIsPackage 0 NSDocumentClass @@ -227,6 +266,10 @@ Tape Image CFBundleTypeRole Viewer + LSItemContentTypes + + public.item + LSTypeIsPackage 0 NSDocumentClass @@ -243,6 +286,10 @@ Amstrad CPC Tape Image CFBundleTypeRole Viewer + LSItemContentTypes + + public.item + LSTypeIsPackage 0 NSDocumentClass @@ -259,6 +306,10 @@ HxC Disk Image CFBundleTypeRole Viewer + LSItemContentTypes + + public.item + LSTypeIsPackage 0 NSDocumentClass @@ -277,8 +328,7 @@ Viewer LSItemContentTypes - org.akop.cocoamsx.filetype.cassette - com.clocksignal.cas + public.item LSTypeIsPackage 0 @@ -296,6 +346,10 @@ Disk Image CFBundleTypeRole Viewer + LSItemContentTypes + + public.item + LSTypeIsPackage 0 @@ -310,6 +364,10 @@ MSX Tape Image CFBundleTypeRole Viewer + LSItemContentTypes + + public.item + LSTypeIsPackage 0 NSDocumentClass From ce2d3c6e824b0e7b1344df58b255fc52acd89ad6 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 17 Jan 2018 22:02:16 -0500 Subject: [PATCH 4/4] Resolves implicit conversion warning. --- StaticAnalyser/MSX/StaticAnalyser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StaticAnalyser/MSX/StaticAnalyser.cpp b/StaticAnalyser/MSX/StaticAnalyser.cpp index c9aa4f402..3de0bcfc4 100644 --- a/StaticAnalyser/MSX/StaticAnalyser.cpp +++ b/StaticAnalyser/MSX/StaticAnalyser.cpp @@ -188,7 +188,7 @@ static std::list> std::vector output_segments; if(segment.data.size() & 0x1fff) { std::vector truncated_data; - std::vector::difference_type truncated_size = static_cast::difference_type>(segment.data.size() & ~0x1fff); + std::vector::difference_type truncated_size = static_cast::difference_type>(segment.data.size()) & ~0x1fff; truncated_data.insert(truncated_data.begin(), segment.data.begin(), segment.data.begin() + truncated_size); output_segments.emplace_back(start_address, truncated_data); } else {