diff --git a/Mini vMac/EmulatorProtocol.h b/Mini vMac/EmulatorProtocol.h index 90d27c1..7429265 100644 --- a/Mini vMac/EmulatorProtocol.h +++ b/Mini vMac/EmulatorProtocol.h @@ -22,7 +22,9 @@ @property (nonatomic, readonly) NSString *insertDiskNotification, *ejectDiskNotification; @property (nonatomic, readonly) NSInteger initialSpeed; +@property (nonatomic, readonly) NSData *RAM; @property (nonatomic, readonly) BOOL anyDiskInserted; +@property (nonatomic, readonly) NSString *currentApplication; + (instancetype)sharedEmulator; diff --git a/Mini vMac/MYOSGLUE.m b/Mini vMac/MYOSGLUE.m index 5fae777..eeb24cd 100644 --- a/Mini vMac/MYOSGLUE.m +++ b/Mini vMac/MYOSGLUE.m @@ -31,8 +31,12 @@ #include "ENDIANAC.h" #include "MYOSGLUE.h" #include "STRCONST.h" +#include "EMCONFIG.h" #import "EmulatorProtocol.h" +#define kRAM_Size (kRAMa_Size + kRAMb_Size) +EXPORTVAR(ui3p, RAM) + @interface Emulator : NSObject - (void)updateScreen:(CGImageRef)screenImage; @@ -1752,6 +1756,20 @@ static dispatch_once_t onceToken; WantMacReset = trueblnr; } +- (NSData *)RAM { + return [NSData dataWithBytesNoCopy:RAM length:kRAM_Size freeWhenDone:NO]; +} + +- (NSString *)currentApplication { + NSData *curApName = [self.RAM subdataWithRange:NSMakeRange(0x910, 32)]; + uint8_t curApNameLength = *(uint8_t*)curApName.bytes; + if (curApNameLength == 0 || curApNameLength > 31) { + return nil; + } else { + return [[NSString alloc] initWithBytes:curApName.bytes+1 length:curApNameLength encoding:NSMacOSRomanStringEncoding]; + } +} + #pragma mark - Screen @synthesize screenLayer;