summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--macosx/Pcsxr-QL/GeneratePreviewForURL.m8
-rw-r--r--macosx/Pcsxr-QL/GenerateThumbnailForURL.m2
-rw-r--r--macosx/Pcsxr-QL/PSXMemEnumerator.m2
-rw-r--r--macosx/Resources/Base.lproj/Configuration.xib26
-rw-r--r--macosx/Source/PcsxrMemCardArray.m6
-rw-r--r--macosx/Source/PcsxrMemCardController.m4
-rw-r--r--macosx/Source/PcsxrMemoryObject.h22
-rw-r--r--macosx/Source/PcsxrMemoryObject.m62
8 files changed, 68 insertions, 64 deletions
diff --git a/macosx/Pcsxr-QL/GeneratePreviewForURL.m b/macosx/Pcsxr-QL/GeneratePreviewForURL.m
index e5fe49a0..7076b380 100644
--- a/macosx/Pcsxr-QL/GeneratePreviewForURL.m
+++ b/macosx/Pcsxr-QL/GeneratePreviewForURL.m
@@ -102,11 +102,11 @@ static OSStatus GeneratePreviewForMemCard(void *thisInterface, QLPreviewRequestR
NSDictionary *gifPrep = @{(NSString *) kCGImagePropertyGIFDictionary: @{(NSString *) kCGImagePropertyGIFDelayTime: @0.30f}};
for (PcsxrMemoryObject *obj in memCards) {
- if (!obj.hasImages || obj.memIconCount == 1) {
+ if (!obj.hasImages || obj.iconCount == 1) {
NSMutableData *pngData = [[NSMutableData alloc] init];
{
CGImageDestinationRef dst = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)pngData, kUTTypePNG, 1, NULL);
- NSImage *theImage = [obj firstMemImage];
+ NSImage *theImage = [obj firstImage];
CGImageRef imageRef = [theImage CGImageForProposedRect:NULL context:nil hints:nil];
CGImageDestinationAddImage(dst, imageRef, NULL);
@@ -124,8 +124,8 @@ static OSStatus GeneratePreviewForMemCard(void *thisInterface, QLPreviewRequestR
}
NSMutableData *gifData = [[NSMutableData alloc] init];
- CGImageDestinationRef dst = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)gifData, kUTTypeGIF, obj.memIconCount, NULL);
- for (NSImage *theImage in obj.memoryCardImages) {
+ CGImageDestinationRef dst = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)gifData, kUTTypeGIF, obj.iconCount, NULL);
+ for (NSImage *theImage in obj.imageArray) {
CGImageRef imageRef = [theImage CGImageForProposedRect:NULL context:nil hints:nil];
CGImageDestinationAddImage(dst, imageRef, (__bridge CFDictionaryRef)(gifPrep));
}
diff --git a/macosx/Pcsxr-QL/GenerateThumbnailForURL.m b/macosx/Pcsxr-QL/GenerateThumbnailForURL.m
index 077980a6..2925ddf3 100644
--- a/macosx/Pcsxr-QL/GenerateThumbnailForURL.m
+++ b/macosx/Pcsxr-QL/GenerateThumbnailForURL.m
@@ -100,7 +100,7 @@ static NSImage *MemoryImageAtIndex(NSArray *memArray, NSInteger my)
for (PcsxrMemoryObject *obj in memArray) {
NSIndexSet *idxSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(i, obj.blockSize)];
if ([idxSet containsIndex:my]) {
- return obj.firstMemImage;
+ return obj.firstImage;
}
i += obj.blockSize;
}
diff --git a/macosx/Pcsxr-QL/PSXMemEnumerator.m b/macosx/Pcsxr-QL/PSXMemEnumerator.m
index 4aa78c33..b5545da2 100644
--- a/macosx/Pcsxr-QL/PSXMemEnumerator.m
+++ b/macosx/Pcsxr-QL/PSXMemEnumerator.m
@@ -103,7 +103,7 @@ static void GetSoloBlockInfo(unsigned char *data, int block, McdBlock *Info)
strlcpy(Info->Name, ptr, 16);
}
-static inline PCSXRMemFlags MemBlockFlag(unsigned char blockFlags)
+static inline PCSXRMemFlag MemBlockFlag(unsigned char blockFlags)
{
if ((blockFlags & 0xF0) == 0xA0) {
if ((blockFlags & 0xF) >= 1 && (blockFlags & 0xF) <= 3)
diff --git a/macosx/Resources/Base.lproj/Configuration.xib b/macosx/Resources/Base.lproj/Configuration.xib
index 27e43c62..5c9fdac0 100644
--- a/macosx/Resources/Base.lproj/Configuration.xib
+++ b/macosx/Resources/Base.lproj/Configuration.xib
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6249" systemVersion="14A386b" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6249"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6250"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="ConfigurationController">
@@ -1155,7 +1155,7 @@
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" animates="YES" imageScaling="proportionallyDown" image="NSAdvanced" id="986"/>
<connections>
- <binding destination="958" name="value" keyPath="representedObject.memImage" id="1057"/>
+ <binding destination="958" name="value" keyPath="representedObject.image" id="wKj-sJ-HxU"/>
</connections>
</imageView>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="979">
@@ -1169,7 +1169,7 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
- <binding destination="958" name="value" keyPath="representedObject.name" id="Zcl-K6-pvX"/>
+ <binding destination="958" name="value" keyPath="representedObject.title" id="ax9-dU-Vnf"/>
</connections>
</textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="977">
@@ -1210,7 +1210,7 @@
<constraint firstAttribute="centerY" secondItem="1047" secondAttribute="centerY" id="nmd-M9-gSz"/>
</constraints>
<connections>
- <binding destination="958" name="hidden" keyPath="representedObject.isBiggerThanOne" id="1044">
+ <binding destination="958" name="hidden" keyPath="representedObject.showCount" id="cGM-hT-0ur">
<dictionary key="options">
<string key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
@@ -1256,9 +1256,11 @@
</collectionViewItem>
<arrayController objectClassName="PcsxrMemoryObject" id="959" userLabel="MemCard2">
<declaredKeys>
- <string>englishName</string>
- <string>sjisName</string>
- <string>memImage</string>
+ <string>title</string>
+ <string>name</string>
+ <string>image</string>
+ <string>showCount</string>
+ <string>blockSize</string>
</declaredKeys>
<connections>
<binding destination="955" name="contentArray" keyPath="self.memCard2Array.memoryArray" id="1033"/>
@@ -1266,9 +1268,11 @@
</arrayController>
<arrayController objectClassName="PcsxrMemoryObject" id="960" userLabel="MemCard1">
<declaredKeys>
- <string>englishName</string>
- <string>sjisName</string>
- <string>memImage</string>
+ <string>title</string>
+ <string>name</string>
+ <string>image</string>
+ <string>blockSize</string>
+ <string>showCount</string>
</declaredKeys>
<connections>
<binding destination="955" name="contentArray" keyPath="self.memCard1Array.memoryArray" id="1034"/>
diff --git a/macosx/Source/PcsxrMemCardArray.m b/macosx/Source/PcsxrMemCardArray.m
index dbea6bc7..ea739ffb 100644
--- a/macosx/Source/PcsxrMemCardArray.m
+++ b/macosx/Source/PcsxrMemCardArray.m
@@ -220,7 +220,7 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
{
int memSize = MAX_MEMCARD_BLOCKS;
for (PcsxrMemoryObject *memObj in rawArray) {
- if (memObj.flagNameIndex != memFlagDeleted) {
+ if (memObj.flag != memFlagDeleted) {
memSize -= memObj.blockSize;
}
}
@@ -270,10 +270,10 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
x = i;
McdBlock baseBlock;
GetMcdBlockInfo(cardNumber, i+1, &baseBlock);
- PCSXRMemFlags theFlags = [PcsxrMemoryObject memFlagsFromBlockFlags:baseBlock.Flags];
+ PCSXRMemFlag theFlags = [PcsxrMemoryObject memFlagsFromBlockFlags:baseBlock.Flags];
if (theFlags == memFlagDeleted || theFlags == memFlagFree) {
- PCSXRMemFlags up1Flags = theFlags;
+ PCSXRMemFlag up1Flags = theFlags;
while ((up1Flags == memFlagDeleted || up1Flags == memFlagFree) && x < MAX_MEMCARD_BLOCKS) {
x++;
McdBlock up1Block;
diff --git a/macosx/Source/PcsxrMemCardController.m b/macosx/Source/PcsxrMemCardController.m
index a656dccb..8f7bccd6 100644
--- a/macosx/Source/PcsxrMemCardController.m
+++ b/macosx/Source/PcsxrMemCardController.m
@@ -115,7 +115,7 @@
int cardSize, freeConsBlocks, availBlocks;
- if ([[fromCard memoryArray][selectedIndex] flagNameIndex] == memFlagFree) {
+ if ([[fromCard memoryArray][selectedIndex] flag] == memFlagFree) {
NSBeep();
return;
}
@@ -193,7 +193,7 @@
PcsxrMemoryObject *tmpObj = [curCard memoryArray][selectedIndex];
- if (tmpObj.flagNameIndex == memFlagFree) {
+ if (tmpObj.flag == memFlagFree) {
NSBeep();
return;
}
diff --git a/macosx/Source/PcsxrMemoryObject.h b/macosx/Source/PcsxrMemoryObject.h
index 6076fb68..1223cd24 100644
--- a/macosx/Source/PcsxrMemoryObject.h
+++ b/macosx/Source/PcsxrMemoryObject.h
@@ -9,7 +9,7 @@
#import <Cocoa/Cocoa.h>
#include "sio.h"
-typedef NS_ENUM(char, PCSXRMemFlags) {
+typedef NS_ENUM(char, PCSXRMemFlag) {
memFlagDeleted,
memFlagFree,
memFlagUsed,
@@ -20,28 +20,28 @@ typedef NS_ENUM(char, PCSXRMemFlags) {
@interface PcsxrMemoryObject : NSObject
+ (NSArray *)imagesFromMcd:(McdBlock *)block;
-+ (NSString*)memoryLabelFromFlag:(PCSXRMemFlags)flagNameIndex;
++ (NSString*)memoryLabelFromFlag:(PCSXRMemFlag)flagNameIndex;
+ (NSImage *)blankImage;
-+ (PCSXRMemFlags)memFlagsFromBlockFlags:(unsigned char)blockFlags;
++ (PCSXRMemFlag)memFlagsFromBlockFlags:(unsigned char)blockFlags;
- (instancetype)initWithMcdBlock:(McdBlock *)infoBlockc startingIndex:(uint8_t)startIdx size:(uint8_t)memSize NS_DESIGNATED_INITIALIZER;
- (NSImage*)memoryImageAtIndex:(NSInteger)idx;
+@property (readonly, copy) NSString *title;
@property (readonly, copy) NSString *name;
-@property (readonly, copy) NSString *memName;
-@property (readonly, copy) NSString *memID;
-@property (readonly, strong) NSArray *memoryCardImages;
-@property (readonly, strong, nonatomic) NSImage *memImage;
-@property (readonly) PCSXRMemFlags flagNameIndex;
+@property (readonly, copy) NSString *identifier;
+@property (readonly, strong) NSArray *imageArray;
+@property (readonly, strong, nonatomic) NSImage *image;
+@property (readonly) PCSXRMemFlag flag;
@property (readonly) uint8_t startingIndex;
@property (readonly) uint8_t blockSize;
@property (readonly) BOOL hasImages;
-@property (readonly, copy) NSImage *firstMemImage;
-@property (readonly, nonatomic) NSUInteger memIconCount;
+@property (readonly, copy) NSImage *firstImage;
+@property (readonly, nonatomic) NSUInteger iconCount;
@property (readonly, unsafe_unretained, nonatomic) NSString *flagName;
@property (readonly, unsafe_unretained, nonatomic) NSAttributedString *attributedFlagName;
-@property (readonly, nonatomic) BOOL isBiggerThanOne;
+@property (readonly, nonatomic) BOOL showCount;
@end
diff --git a/macosx/Source/PcsxrMemoryObject.m b/macosx/Source/PcsxrMemoryObject.m
index 811aa37f..b0b1816a 100644
--- a/macosx/Source/PcsxrMemoryObject.m
+++ b/macosx/Source/PcsxrMemoryObject.m
@@ -10,15 +10,15 @@
#import "PcsxrMemoryObject.h"
@interface PcsxrMemoryObject ()
+@property (readwrite, copy) NSString *title;
@property (readwrite, copy) NSString *name;
-@property (readwrite, copy) NSString *memName;
-@property (readwrite, copy) NSString *memID;
+@property (readwrite, copy) NSString *identifier;
@property (readwrite) uint8_t startingIndex;
@property (readwrite) uint8_t blockSize;
-@property (readwrite, strong) NSArray *memoryCardImages;
-@property (readwrite) PCSXRMemFlags flagNameIndex;
-@property (readwrite, nonatomic, strong) NSImage *memImage;
+@property (readwrite, strong) NSArray *imageArray;
+@property (readwrite) PCSXRMemFlag flag;
+@property (readwrite, nonatomic, strong) NSImage *image;
@property (readwrite) BOOL hasImages;
@end
@@ -74,13 +74,13 @@ static NSString *MemLabelEndLink;
- (NSImage*)memoryImageAtIndex:(NSInteger)idx
{
- if (!self.hasImages || idx > self.memIconCount) {
+ if (!self.hasImages || idx > self.iconCount) {
return [PcsxrMemoryObject blankImage];
}
return memImages[idx];
}
-+ (NSString*)memoryLabelFromFlag:(PCSXRMemFlags)flagNameIndex
++ (NSString*)memoryLabelFromFlag:(PCSXRMemFlag)flagNameIndex
{
switch (flagNameIndex) {
default:
@@ -120,7 +120,7 @@ static NSString *MemLabelEndLink;
return [imageBlank copy];
}
-+ (PCSXRMemFlags)memFlagsFromBlockFlags:(unsigned char)blockFlags
++ (PCSXRMemFlag)memFlagsFromBlockFlags:(unsigned char)blockFlags
{
if ((blockFlags & 0xF0) == 0xA0) {
if ((blockFlags & 0xF) >= 1 && (blockFlags & 0xF) <= 3)
@@ -147,45 +147,45 @@ static NSString *MemLabelEndLink;
if (self = [super init]) {
self.startingIndex = startIdx;
self.blockSize = memSize;
- self.flagNameIndex = [PcsxrMemoryObject memFlagsFromBlockFlags:infoBlock->Flags];
- if (self.flagNameIndex == memFlagFree) {
- self.memoryCardImages = @[];
+ self.flag = [PcsxrMemoryObject memFlagsFromBlockFlags:infoBlock->Flags];
+ if (self.flag == memFlagFree) {
+ self.imageArray = @[];
self.hasImages = NO;
- self.name = @"Free block";
- self.memID = self.memName = @"";
+ self.title = @"Free block";
+ self.identifier = self.name = @"";
} else {
- self.name = [NSString stringWithCString:infoBlock->sTitle encoding:NSShiftJISStringEncoding];
- self.memoryCardImages = [PcsxrMemoryObject imagesFromMcd:infoBlock];
+ self.title = [NSString stringWithCString:infoBlock->sTitle encoding:NSShiftJISStringEncoding];
+ self.imageArray = [PcsxrMemoryObject imagesFromMcd:infoBlock];
if ([memImages count] == 0) {
self.hasImages = NO;
} else {
self.hasImages = YES;
}
- self.memName = @(infoBlock->Name);
- self.memID = @(infoBlock->ID);
+ self.name = @(infoBlock->Name);
+ self.identifier = @(infoBlock->ID);
}
}
return self;
}
#pragma mark - Property Synthesizers
+@synthesize title;
@synthesize name;
-@synthesize memName;
-@synthesize memID;
-@synthesize memoryCardImages = memImages;
-@synthesize flagNameIndex;
+@synthesize identifier;
+@synthesize imageArray = memImages;
+@synthesize flag;
@synthesize blockSize;
@synthesize startingIndex;
-@synthesize memImage = _memImage;
+@synthesize image = _memImage;
#pragma mark Non-synthesized Properties
-- (NSUInteger)memIconCount
+- (NSUInteger)iconCount
{
return [memImages count];
}
-- (NSImage*)firstMemImage
+- (NSImage*)firstImage
{
if (self.hasImages == NO) {
return [PcsxrMemoryObject blankImage];
@@ -193,7 +193,7 @@ static NSString *MemLabelEndLink;
return memImages[0];
}
-- (NSImage*)memImage
+- (NSImage*)image
{
if (self.hasImages == NO) {
NSImage *tmpBlank = [PcsxrMemoryObject blankImage];
@@ -204,7 +204,7 @@ static NSString *MemLabelEndLink;
if (!_memImage) {
NSMutableData *gifData = [NSMutableData new];
- CGImageDestinationRef dst = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)gifData, kUTTypeGIF, self.memIconCount, NULL);
+ CGImageDestinationRef dst = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)gifData, kUTTypeGIF, self.iconCount, NULL);
NSDictionary *gifPrep = @{(NSString *) kCGImagePropertyGIFDictionary: @{(NSString *) kCGImagePropertyGIFDelayTime: @0.30f}};
for (NSImage *theImage in memImages) {
CGImageRef imageRef = [theImage CGImageForProposedRect:NULL context:nil hints:nil];
@@ -221,7 +221,7 @@ static NSString *MemLabelEndLink;
- (NSString*)flagName
{
- return [PcsxrMemoryObject memoryLabelFromFlag:flagNameIndex];
+ return [PcsxrMemoryObject memoryLabelFromFlag:flag];
}
static inline void SetupAttrStr(NSMutableAttributedString *mutStr, NSColor *txtclr)
@@ -278,7 +278,7 @@ static inline void SetupAttrStr(NSMutableAttributedString *mutStr, NSColor *txtc
attribMemLabelDeleted = [tmpStr copy];
});
- switch (flagNameIndex) {
+ switch (flag) {
default:
case memFlagFree:
return attribMemLabelFree;
@@ -302,9 +302,9 @@ static inline void SetupAttrStr(NSMutableAttributedString *mutStr, NSColor *txtc
}
}
-- (BOOL)isBiggerThanOne
+- (BOOL)showCount
{
- if (flagNameIndex == memFlagFree) {
+ if (flag == memFlagFree) {
//Always show the size of the free blocks
return YES;
} else {
@@ -321,7 +321,7 @@ static inline void SetupAttrStr(NSMutableAttributedString *mutStr, NSColor *txtc
- (NSString *)description
{
- return [NSString stringWithFormat:@"%@: Name: %@ ID: %@, type: %@ start: %i size: %i", name, memName, memID, self.flagName, startingIndex, blockSize];
+ return [NSString stringWithFormat:@"%@: Name: %@ ID: %@, type: %@ start: %i size: %i", title, name, identifier, self.flagName, startingIndex, blockSize];
}
@end