1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-03 23:52:28 +00:00
CLK/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAppleII.mm
2021-06-07 21:21:45 -04:00

51 lines
1.2 KiB
Plaintext

//
// CSAppleII.m
// Clock Signal
//
// Created by Thomas Harte on 07/06/2021.
// Copyright © 2021 Thomas Harte. All rights reserved.
//
#import "CSAppleII.h"
#include "AppleII.hpp"
@implementation CSAppleII {
Apple::II::Machine *_appleII;
__weak CSMachine *_machine;
}
- (instancetype)initWithAppleII:(void *)appleII owner:(CSMachine *)machine {
self = [super init];
if(self) {
_appleII = (Apple::II::Machine *)appleII;
_machine = machine;
}
return self;
}
#pragma mark - Options
- (void)setUseSquarePixels:(BOOL)useSquarePixels {
Configurable::Device *const configurable = dynamic_cast<Configurable::Device *>(_appleII);
@synchronized(_machine) {
auto options = configurable->get_options();
auto appleii_configurable = dynamic_cast<Apple::II::Machine::Options *>(options.get());
appleii_configurable->use_square_pixels = useSquarePixels;
configurable->set_options(options);
}
}
- (BOOL)useSquarePixels {
Configurable::Device *const configurable = dynamic_cast<Configurable::Device *>(_appleII);
@synchronized(_machine) {
auto options = configurable->get_options();
auto appleii_configurable = dynamic_cast<Apple::II::Machine::Options *>(options.get());
return appleii_configurable->use_square_pixels ? YES : NO;
}
}
@end