summaryrefslogtreecommitdiff
path: root/macosx/CheatController.m
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-08-24 19:44:48 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-08-24 19:44:48 +0000
commit2a2790470d2ab7e0e22021e9b1774536546b1b4e (patch)
tree02de3f051dca12a63637f56ec0c60a83819b5ad6 /macosx/CheatController.m
parent8b64ca8414e1dcf56b1d3d3a481090e551499445 (diff)
downloadpcsxr-2a2790470d2ab7e0e22021e9b1774536546b1b4e.tar.gz
OS X:
Replace CFStringCreateByCombiningStrings with NSArray's componentsJoinedByString:. Moving some class interfaces out of CheatController.h to CheatController.m git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@86897 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/CheatController.m')
-rw-r--r--macosx/CheatController.m56
1 files changed, 39 insertions, 17 deletions
diff --git a/macosx/CheatController.m b/macosx/CheatController.m
index 09f1e5a5..4650459a 100644
--- a/macosx/CheatController.m
+++ b/macosx/CheatController.m
@@ -13,6 +13,34 @@
#define kTempCheatCodesName @"tempCheatCodes"
#define kCheatsName @"cheats"
+
+@interface PcsxrCheatTempObject : NSObject <NSCopying>
+{
+ uint32_t address;
+ uint16_t value;
+}
+@property (readwrite) uint32_t address;
+@property (readwrite, arcweak) NSNumber* addressNS;
+@property (readwrite) uint16_t value;
+@property (readwrite, arcweak) NSNumber* valueNS;
+
+- (id)initWithAddress:(uint32_t)add value:(uint16_t)val;
+- (id)initWithCheatCode:(CheatCode *)theCheat;
+@end
+
+@interface PcsxrCheatTemp : NSObject
+{
+ NSMutableArray *cheatValues;
+ NSString *cheatName;
+ BOOL enabled;
+}
+@property (readwrite, arcretain) NSMutableArray *cheatValues;
+@property (readwrite, arcretain) NSString *cheatName;
+@property (readwrite, getter = isEnabled) BOOL enabled;
+
+- (id)initWithCheat:(Cheat *)theCheat;
+@end
+
@implementation PcsxrCheatTempObject
@synthesize address, value;
@@ -36,7 +64,7 @@
- (id)init
{
- return self = [self initWithAddress:0x10000000 value:0];
+ return [self initWithAddress:0x10000000 value:0];
}
- (id)initWithAddress:(uint32_t)add value:(uint16_t)val
@@ -71,6 +99,11 @@
return NO;
}
+- (NSUInteger)hash
+{
+ return address ^ value;
+}
+
- (id)copyWithZone:(NSZone *)zone
{
return [[[self class] allocWithZone:zone] initWithAddress:address value:value];
@@ -83,22 +116,6 @@
@synthesize cheatValues;
@synthesize enabled;
-- (void)setCheatName:(NSString *)_cheatName
-{
- if ([cheatName isEqualToString:_cheatName]) {
- return;
- }
- [self willChangeValueForKey:@"cheatName"];
-#if __has_feature(objc_arc)
- cheatName = _cheatName;
-#else
- NSString *temp = cheatName;
- cheatName = [_cheatName copy];
- [temp release];
-#endif
- [self didChangeValueForKey:@"cheatName"];
-}
-
- (id)initWithCheat:(Cheat *)theCheat
{
if (self = [super init]) {
@@ -112,6 +129,11 @@
return self;
}
+- (NSUInteger)hash
+{
+ return [cheatName hash] ^ [cheatValues hash];
+}
+
- (NSString *)description
{
return [NSString stringWithFormat:@"[%@%@]\n%@", enabled ? @"*" : @"", cheatName, [cheatValues componentsJoinedByString:@"\n"]];