2016-09-01 00:43:29 +00:00
|
|
|
//
|
|
|
|
// CSStaticAnalyser.m
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 31/08/2016.
|
|
|
|
// Copyright © 2016 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "CSStaticAnalyser.h"
|
|
|
|
|
|
|
|
#import "CSMachine.h"
|
|
|
|
#import "CSMachine+Target.h"
|
2016-09-01 02:03:42 +00:00
|
|
|
#import "CSMachine+Subclassing.h"
|
2016-09-01 00:43:29 +00:00
|
|
|
|
2016-10-12 02:20:13 +00:00
|
|
|
#include "StaticAnalyser.hpp"
|
|
|
|
|
|
|
|
#import "CSAtari2600.h"
|
|
|
|
#import "CSElectron.h"
|
|
|
|
#import "CSOric.h"
|
|
|
|
#import "CSVic20.h"
|
|
|
|
|
|
|
|
#import "Clock_Signal-Swift.h"
|
|
|
|
|
2016-09-01 00:43:29 +00:00
|
|
|
@implementation CSStaticAnalyser
|
|
|
|
{
|
|
|
|
StaticAnalyser::Target _target;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (instancetype)initWithFileAtURL:(NSURL *)url
|
|
|
|
{
|
|
|
|
self = [super init];
|
|
|
|
if(self)
|
|
|
|
{
|
|
|
|
std::list<StaticAnalyser::Target> targets = StaticAnalyser::GetTargets([url fileSystemRepresentation]);
|
|
|
|
if(!targets.size()) return nil;
|
|
|
|
_target = targets.front();
|
2016-09-13 02:15:38 +00:00
|
|
|
|
|
|
|
// TODO: can this better be supplied by the analyser?
|
|
|
|
_displayName = [[url pathComponents] lastObject];
|
2016-09-01 00:43:29 +00:00
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2016-10-02 20:31:50 +00:00
|
|
|
- (NSString *)optionsPanelNibName
|
|
|
|
{
|
|
|
|
switch(_target.machine)
|
|
|
|
{
|
2016-10-20 02:56:14 +00:00
|
|
|
case StaticAnalyser::Target::Atari2600: return @"Atari2600Options";
|
2016-10-03 01:56:50 +00:00
|
|
|
case StaticAnalyser::Target::Electron: return @"ElectronOptions";
|
2016-10-20 02:56:14 +00:00
|
|
|
case StaticAnalyser::Target::Oric: return @"OricOptions";
|
2016-10-03 11:42:05 +00:00
|
|
|
case StaticAnalyser::Target::Vic20: return @"Vic20Options";
|
2016-10-11 11:39:48 +00:00
|
|
|
default: return nil;
|
2016-10-02 20:31:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-02 20:57:57 +00:00
|
|
|
- (CSMachine *)newMachine
|
|
|
|
{
|
|
|
|
switch(_target.machine)
|
|
|
|
{
|
|
|
|
case StaticAnalyser::Target::Atari2600: return [[CSAtari2600 alloc] init];
|
2016-10-20 02:56:14 +00:00
|
|
|
case StaticAnalyser::Target::Electron: return [[CSElectron alloc] init];
|
2016-10-12 02:20:13 +00:00
|
|
|
case StaticAnalyser::Target::Oric: return [[CSOric alloc] init];
|
2016-10-20 02:56:14 +00:00
|
|
|
case StaticAnalyser::Target::Vic20: return [[CSVic20 alloc] init];
|
2016-10-11 11:39:48 +00:00
|
|
|
default: return nil;
|
2016-10-02 20:57:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-01 00:43:29 +00:00
|
|
|
- (void)applyToMachine:(CSMachine *)machine
|
|
|
|
{
|
|
|
|
[machine applyTarget:_target];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|