1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-08 15:29:09 +00:00

Ensures that machine name reaches Swift.

This commit is contained in:
Thomas Harte 2019-07-22 21:18:30 -04:00
parent 2432151bf8
commit ed0c4c117b
2 changed files with 13 additions and 1 deletions

View File

@ -34,6 +34,7 @@ typedef NS_ENUM(NSInteger, CSMachineKeyboardInputMode) {
};
@interface CSMissingROM: NSObject
@property (nonatomic, readonly, nonnull) NSString *machineName;
@property (nonatomic, readonly, nonnull) NSString *fileName;
@property (nonatomic, readonly, nullable) NSString *descriptiveName;
@property (nonatomic, readonly) NSUInteger size;

View File

@ -75,6 +75,7 @@ struct ActivityObserver: public Activity::Observer {
};
@interface CSMissingROM (Mutability)
@property (nonatomic, nonnull, copy) NSString *machineName;
@property (nonatomic, nonnull, copy) NSString *fileName;
@property (nonatomic, nullable, copy) NSString *descriptiveName;
@property (nonatomic, readwrite) NSUInteger size;
@ -82,12 +83,21 @@ struct ActivityObserver: public Activity::Observer {
@end
@implementation CSMissingROM {
NSString *_machineName;
NSString *_fileName;
NSString *_descriptiveName;
NSUInteger _size;
NSArray<NSNumber *> *_crc32s;
}
- (NSString *)machineName {
return _machineName;
}
- (void)setMachineName:(NSString *)machineName {
_machineName = [machineName copy];
}
- (NSString *)fileName {
return _fileName;
}
@ -155,8 +165,9 @@ struct ActivityObserver: public Activity::Observer {
CSMissingROM *rom = [[CSMissingROM alloc] init];
// Copy/convert the primitive fields.
rom.machineName = [NSString stringWithUTF8String:missing_rom.machine_name.c_str()];
rom.fileName = [NSString stringWithUTF8String:missing_rom.file_name.c_str()];
rom.descriptiveName = [NSString stringWithUTF8String:missing_rom.descriptive_name.c_str()];
rom.descriptiveName = missing_rom.descriptive_name.empty() ? nil : [NSString stringWithUTF8String:missing_rom.descriptive_name.c_str()];
rom.size = missing_rom.size;
// Convert the CRC list.