diff options
| author | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2013-07-08 23:46:22 +0000 |
|---|---|---|
| committer | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2013-07-08 23:46:22 +0000 |
| commit | 434c738fac452d5d75092aec3b3a2282e7a2bd24 (patch) | |
| tree | 976038e88196351abad8d76b4861733bd33ff42e /macosx/LaunchArg.m | |
| parent | e0fa342a42dbf21668bc923a0abd8261d203b95a (diff) | |
| download | pcsxr-434c738fac452d5d75092aec3b3a2282e7a2bd24.tar.gz | |
Have the arguments passed to the OS X app be done in a specific order, so i.e. you don't try to load a memory card after the emulator has started, or loading a freeze state before the emulator has started.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@85919 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/LaunchArg.m')
| -rw-r--r-- | macosx/LaunchArg.m | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/macosx/LaunchArg.m b/macosx/LaunchArg.m new file mode 100644 index 00000000..4923cc02 --- /dev/null +++ b/macosx/LaunchArg.m @@ -0,0 +1,66 @@ +// +// LaunchArg.m +// Pcsxr +// +// Created by C.W. Betts on 7/8/13. +// +// + +#import "LaunchArg.h" + +@interface LaunchArg () +@property (readwrite) LaunchArgOrder launchOrder; +@property (readwrite, copy, nonatomic) dispatch_block_t theBlock; +@property (readwrite, arcretain) NSString *argument; + +@end + +@implementation LaunchArg +@synthesize argument = _argument; +@synthesize launchOrder = _launchOrder; +@synthesize theBlock = _theBlock; +- (void)setTheBlock:(dispatch_block_t)theBlock +{ +#if __has_feature(objc_arc) + _theBlock = [theBlock copy]; +#else + if (_theBlock == theBlock) { + return; + } + dispatch_block_t tmpBlock = _theBlock + _theBlock = [theBlock copy]; + [tmpBlock release]; +#endif +} + +- (id)initWithLaunchOrder:(LaunchArgOrder)order block:(dispatch_block_t)block argument:(NSString*)arg +{ + if (self = [super init]) { + self.launchOrder = order; + self.theBlock = block; + self.argument = arg; + } + return self; +} + +- (void)addToDictionary:(NSMutableDictionary*)toAdd +{ + [toAdd setObject:self forKey:self.argument]; +} + +- (NSString*)description +{ + return [NSString stringWithFormat:@"Arg: %@, order: %u, block addr: %p", _argument, _launchOrder, _theBlock]; +} + +#if !__has_feature(objc_arc) +- (void)dealloc +{ + self.theBlock = nil; + self.argument = nil; + + [super dealloc]; +} +#endif + +@end |
