mirror of
https://github.com/zydeco/minivmac4ios.git
synced 2024-11-22 03:30:59 +00:00
Emulator protocol: add currentApplication
This commit is contained in:
parent
ec5c1fb188
commit
8c3434740f
@ -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;
|
||||
|
||||
|
@ -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 <Emulator>
|
||||
|
||||
- (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;
|
||||
|
Loading…
Reference in New Issue
Block a user