1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-13 07:30:21 +00:00

Cleaned up pre-analysis code.

This commit is contained in:
Thomas Harte 2016-09-17 18:19:32 -04:00
parent b7e353cad5
commit a98374995e
3 changed files with 5 additions and 58 deletions

View File

@ -1487,13 +1487,13 @@
4BB73EDC1B587CA500552FC2 /* Machines */ = {
isa = PBXGroup;
children = (
4B4DC81D1D2C2425003C5BF8 /* Commodore */,
4B046DC31CFE651500E9E45E /* CRTMachine.hpp */,
4B2E2D961C3A06EC00138695 /* Atari2600 */,
4B2E2D9E1C3A070900138695 /* Electron */,
4B1E85731D170228001EF87D /* Typer.cpp */,
4B1E85741D170228001EF87D /* Typer.hpp */,
4BA9C3CF1D8164A9002DDB61 /* ConfigurationTarget.hpp */,
4B046DC31CFE651500E9E45E /* CRTMachine.hpp */,
4B1E85741D170228001EF87D /* Typer.hpp */,
4B2E2D961C3A06EC00138695 /* Atari2600 */,
4B4DC81D1D2C2425003C5BF8 /* Commodore */,
4B2E2D9E1C3A070900138695 /* Electron */,
);
name = Machines;
path = ../../Machines;

View File

@ -30,11 +30,6 @@ typedef NS_ENUM(NSInteger, CSVic20MemorySize)
- (void)setCharactersROM:(nonnull NSData *)rom;
- (void)setDriveROM:(nonnull NSData *)rom;
- (BOOL)openPRGAtURL:(nonnull NSURL *)URL;
- (BOOL)openTAPAtURL:(nonnull NSURL *)URL;
- (BOOL)openG64AtURL:(nonnull NSURL *)URL;
- (BOOL)openD64AtURL:(nonnull NSURL *)URL;
@property (nonatomic, assign) BOOL useFastLoadingHack;
@property (nonatomic, assign) BOOL shouldLoadAutomatically;
@property (nonatomic, assign) CSVic20Region region;

View File

@ -46,54 +46,6 @@ using namespace Commodore::Vic20;
[self setROM:rom slot:Drive];
}
- (BOOL)openTAPAtURL:(NSURL *)URL {
@synchronized(self) {
try {
std::shared_ptr<Storage::Tape::CommodoreTAP> tape(new Storage::Tape::CommodoreTAP([URL fileSystemRepresentation]));
_vic20.set_tape(tape);
return YES;
} catch(...) {
return NO;
}
}
}
- (BOOL)openG64AtURL:(NSURL *)URL {
return [self openDisk:^std::shared_ptr<Storage::Disk::Disk>{
return std::shared_ptr<Storage::Disk::Disk>(new Storage::Disk::G64([URL fileSystemRepresentation]));
}];
}
- (BOOL)openD64AtURL:(NSURL *)URL {
return [self openDisk:^std::shared_ptr<Storage::Disk::Disk>{
return std::shared_ptr<Storage::Disk::Disk>(new Storage::Disk::D64([URL fileSystemRepresentation]));
}];
}
- (BOOL)openDisk:(std::shared_ptr<Storage::Disk::Disk> (^)())opener {
@synchronized(self) {
try {
std::shared_ptr<Storage::Disk::Disk> disk = opener();
_vic20.set_disk(disk);
return YES;
} catch(...) {
return NO;
}
}
}
- (BOOL)openPRGAtURL:(NSURL *)URL {
NSData *prg = [NSData dataWithContentsOfURL:URL];
@synchronized(self) {
try {
_vic20.set_prg(URL.fileSystemRepresentation, prg.length, (const uint8_t *)prg.bytes);
return YES;
} catch(...) {
return NO;
}
}
}
- (void)setKey:(uint16_t)key isPressed:(BOOL)isPressed {
static NSDictionary<NSNumber *, NSNumber *> *vicKeysByKeys = @{
@(VK_ANSI_1): @(Key::Key1), @(VK_ANSI_2): @(Key::Key2),