summaryrefslogtreecommitdiff
path: root/macosx/PcsxrMemoryObject.m
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-07-06 20:09:08 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-07-06 20:09:08 +0000
commite58027046dd248ad572903d8453668a990ae5c9d (patch)
tree17437802c04eb0d157d12bf0fdc2593e799051b4 /macosx/PcsxrMemoryObject.m
parent175bee7ad34b2350f642d3d084dd9c2a27be5804 (diff)
downloadpcsxr-e58027046dd248ad572903d8453668a990ae5c9d.tar.gz
Get multi-block save copying working correctly on OS X.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@85876 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/PcsxrMemoryObject.m')
-rwxr-xr-xmacosx/PcsxrMemoryObject.m74
1 files changed, 50 insertions, 24 deletions
diff --git a/macosx/PcsxrMemoryObject.m b/macosx/PcsxrMemoryObject.m
index 56974024..0893b238 100755
--- a/macosx/PcsxrMemoryObject.m
+++ b/macosx/PcsxrMemoryObject.m
@@ -26,7 +26,7 @@ NSString *const memoryAnimateTimerKey = @"PCSXR Memory Card Image Animate";
@property (readwrite, nonatomic) NSInteger memImageIndex;
@property (arcstrong) NSArray *memImages;
-@property PCSXRMemFlags flagNameIndex;
+@property (readwrite) PCSXRMemFlags flagNameIndex;
@end
@implementation PcsxrMemoryObject
@@ -143,31 +143,41 @@ static NSString *MemLabelEndLink;
} else
self.flagNameIndex = memFlagFree;
- self.englishName = @(infoBlock->Title);
- self.sjisName = [NSString stringWithCString:infoBlock->sTitle encoding:NSShiftJISStringEncoding];
- @autoreleasepool {
- self.memImages = [PcsxrMemoryObject imagesFromMcd:infoBlock];
- }
- if ([memImages count] == 0) {
- self.memImageIndex = -1;
- } else if ([memImages count] == 1) {
- self.memImageIndex = 0;
- } else {
- self.memImageIndex = 0;
- [[NSNotificationCenter defaultCenter] addObserverForName:memoryAnimateTimerKey object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
- NSInteger index = memImageIndex;
- if (++index >= [memImages count]) {
- index = 0;
- }
- self.memImageIndex = index;
- }];
- }
- self.memName = @(infoBlock->Name);
- self.memID = @(infoBlock->ID);
- //This prevents possible uglies in multi-save images
- if (self.flagName == MemLabelLink || self.flagName == MemLabelEndLink) {
+ if (self.flagNameIndex == memFlagLink || self.flagNameIndex == memFlagEndLink || self.flagNameIndex == memFlagFree) {
+ //This prevents possible uglies in multi-save images
self.memImages = @[];
self.memImageIndex = -1;
+
+ if (flagNameIndex != memFlagFree) {
+ self.englishName = self.sjisName = (flagNameIndex == memFlagLink ? @"Multi-save" : @"Multi-save (end)");
+ } else {
+ self.englishName = self.sjisName = @"Free block";
+ }
+
+ self.memID = self.memName = @"";
+ } else {
+ self.englishName = @(infoBlock->Title);
+ self.sjisName = [NSString stringWithCString:infoBlock->sTitle encoding:NSShiftJISStringEncoding];
+
+ @autoreleasepool {
+ self.memImages = [PcsxrMemoryObject imagesFromMcd:infoBlock];
+ }
+ if ([memImages count] == 0) {
+ self.memImageIndex = -1;
+ } else if ([memImages count] == 1) {
+ self.memImageIndex = 0;
+ } else {
+ self.memImageIndex = 0;
+ [[NSNotificationCenter defaultCenter] addObserverForName:memoryAnimateTimerKey object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
+ NSInteger index = memImageIndex;
+ if (++index >= [memImages count]) {
+ index = 0;
+ }
+ self.memImageIndex = index;
+ }];
+ }
+ self.memName = @(infoBlock->Name);
+ self.memID = @(infoBlock->ID);
}
}
return self;
@@ -232,6 +242,7 @@ NS_INLINE void SetupAttrStr(NSMutableAttributedString *mutStr, NSColor *txtclr)
attribMemLabelFree = [tmpStr copy];
RELEASEOBJ(tmpStr);
+#ifdef DEBUG
tmpStr = [[NSMutableAttributedString alloc] initWithString:MemLabelEndLink];
SetupAttrStr(tmpStr, [NSColor blueColor]);
attribMemLabelEndLink = [tmpStr copy];
@@ -246,6 +257,21 @@ NS_INLINE void SetupAttrStr(NSMutableAttributedString *mutStr, NSColor *txtclr)
SetupAttrStr(tmpStr, [NSColor controlTextColor]);
attribMemLabelUsed = [tmpStr copy];
RELEASEOBJ(tmpStr);
+#else
+ tmpStr = [[NSMutableAttributedString alloc] initWithString:@"Multi-save"];
+ SetupAttrStr(tmpStr, [NSColor blueColor]);
+ attribMemLabelEndLink = [tmpStr copy];
+ RELEASEOBJ(tmpStr);
+
+ //tmpStr = [[NSMutableAttributedString alloc] initWithString:@"Multi-save"];
+ //SetupAttrStr(tmpStr, [NSColor blueColor]);
+ //attribMemLabelLink = [tmpStr copy];
+ //RELEASEOBJ(tmpStr);
+ attribMemLabelLink = attribMemLabelEndLink;
+
+ //display nothing
+ attribMemLabelUsed = [[NSAttributedString alloc] initWithString:@""];
+#endif
tmpStr = [[NSMutableAttributedString alloc] initWithString:MemLabelDeleted];
SetupAttrStr(tmpStr, [NSColor redColor]);