OS X: Re-work PcsxrMemoryObject to make the properties more readable.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@92297 e17a0e51-4ae3-4d35-97c3-1a29b211df97
This commit is contained in:
parent
eded81ac8a
commit
759e29705c
|
@ -102,11 +102,11 @@ static OSStatus GeneratePreviewForMemCard(void *thisInterface, QLPreviewRequestR
|
||||||
NSDictionary *gifPrep = @{(NSString *) kCGImagePropertyGIFDictionary: @{(NSString *) kCGImagePropertyGIFDelayTime: @0.30f}};
|
NSDictionary *gifPrep = @{(NSString *) kCGImagePropertyGIFDictionary: @{(NSString *) kCGImagePropertyGIFDelayTime: @0.30f}};
|
||||||
|
|
||||||
for (PcsxrMemoryObject *obj in memCards) {
|
for (PcsxrMemoryObject *obj in memCards) {
|
||||||
if (!obj.hasImages || obj.memIconCount == 1) {
|
if (!obj.hasImages || obj.iconCount == 1) {
|
||||||
NSMutableData *pngData = [[NSMutableData alloc] init];
|
NSMutableData *pngData = [[NSMutableData alloc] init];
|
||||||
{
|
{
|
||||||
CGImageDestinationRef dst = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)pngData, kUTTypePNG, 1, NULL);
|
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];
|
CGImageRef imageRef = [theImage CGImageForProposedRect:NULL context:nil hints:nil];
|
||||||
CGImageDestinationAddImage(dst, imageRef, NULL);
|
CGImageDestinationAddImage(dst, imageRef, NULL);
|
||||||
|
@ -124,8 +124,8 @@ static OSStatus GeneratePreviewForMemCard(void *thisInterface, QLPreviewRequestR
|
||||||
}
|
}
|
||||||
NSMutableData *gifData = [[NSMutableData alloc] init];
|
NSMutableData *gifData = [[NSMutableData alloc] init];
|
||||||
|
|
||||||
CGImageDestinationRef dst = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)gifData, kUTTypeGIF, obj.memIconCount, NULL);
|
CGImageDestinationRef dst = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)gifData, kUTTypeGIF, obj.iconCount, NULL);
|
||||||
for (NSImage *theImage in obj.memoryCardImages) {
|
for (NSImage *theImage in obj.imageArray) {
|
||||||
CGImageRef imageRef = [theImage CGImageForProposedRect:NULL context:nil hints:nil];
|
CGImageRef imageRef = [theImage CGImageForProposedRect:NULL context:nil hints:nil];
|
||||||
CGImageDestinationAddImage(dst, imageRef, (__bridge CFDictionaryRef)(gifPrep));
|
CGImageDestinationAddImage(dst, imageRef, (__bridge CFDictionaryRef)(gifPrep));
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ static NSImage *MemoryImageAtIndex(NSArray *memArray, NSInteger my)
|
||||||
for (PcsxrMemoryObject *obj in memArray) {
|
for (PcsxrMemoryObject *obj in memArray) {
|
||||||
NSIndexSet *idxSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(i, obj.blockSize)];
|
NSIndexSet *idxSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(i, obj.blockSize)];
|
||||||
if ([idxSet containsIndex:my]) {
|
if ([idxSet containsIndex:my]) {
|
||||||
return obj.firstMemImage;
|
return obj.firstImage;
|
||||||
}
|
}
|
||||||
i += obj.blockSize;
|
i += obj.blockSize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ static void GetSoloBlockInfo(unsigned char *data, int block, McdBlock *Info)
|
||||||
strlcpy(Info->Name, ptr, 16);
|
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 & 0xF0) == 0xA0) {
|
||||||
if ((blockFlags & 0xF) >= 1 && (blockFlags & 0xF) <= 3)
|
if ((blockFlags & 0xF) >= 1 && (blockFlags & 0xF) <= 3)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?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>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6249"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6250"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
<customObject id="-2" userLabel="File's Owner" customClass="ConfigurationController">
|
<customObject id="-2" userLabel="File's Owner" customClass="ConfigurationController">
|
||||||
|
@ -1155,7 +1155,7 @@
|
||||||
</constraints>
|
</constraints>
|
||||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" animates="YES" imageScaling="proportionallyDown" image="NSAdvanced" id="986"/>
|
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" animates="YES" imageScaling="proportionallyDown" image="NSAdvanced" id="986"/>
|
||||||
<connections>
|
<connections>
|
||||||
<binding destination="958" name="value" keyPath="representedObject.memImage" id="1057"/>
|
<binding destination="958" name="value" keyPath="representedObject.image" id="wKj-sJ-HxU"/>
|
||||||
</connections>
|
</connections>
|
||||||
</imageView>
|
</imageView>
|
||||||
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="979">
|
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="979">
|
||||||
|
@ -1169,7 +1169,7 @@
|
||||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
<connections>
|
<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>
|
</connections>
|
||||||
</textField>
|
</textField>
|
||||||
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="977">
|
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="977">
|
||||||
|
@ -1210,7 +1210,7 @@
|
||||||
<constraint firstAttribute="centerY" secondItem="1047" secondAttribute="centerY" id="nmd-M9-gSz"/>
|
<constraint firstAttribute="centerY" secondItem="1047" secondAttribute="centerY" id="nmd-M9-gSz"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<connections>
|
<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">
|
<dictionary key="options">
|
||||||
<string key="NSValueTransformerName">NSNegateBoolean</string>
|
<string key="NSValueTransformerName">NSNegateBoolean</string>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
|
@ -1256,9 +1256,11 @@
|
||||||
</collectionViewItem>
|
</collectionViewItem>
|
||||||
<arrayController objectClassName="PcsxrMemoryObject" id="959" userLabel="MemCard2">
|
<arrayController objectClassName="PcsxrMemoryObject" id="959" userLabel="MemCard2">
|
||||||
<declaredKeys>
|
<declaredKeys>
|
||||||
<string>englishName</string>
|
<string>title</string>
|
||||||
<string>sjisName</string>
|
<string>name</string>
|
||||||
<string>memImage</string>
|
<string>image</string>
|
||||||
|
<string>showCount</string>
|
||||||
|
<string>blockSize</string>
|
||||||
</declaredKeys>
|
</declaredKeys>
|
||||||
<connections>
|
<connections>
|
||||||
<binding destination="955" name="contentArray" keyPath="self.memCard2Array.memoryArray" id="1033"/>
|
<binding destination="955" name="contentArray" keyPath="self.memCard2Array.memoryArray" id="1033"/>
|
||||||
|
@ -1266,9 +1268,11 @@
|
||||||
</arrayController>
|
</arrayController>
|
||||||
<arrayController objectClassName="PcsxrMemoryObject" id="960" userLabel="MemCard1">
|
<arrayController objectClassName="PcsxrMemoryObject" id="960" userLabel="MemCard1">
|
||||||
<declaredKeys>
|
<declaredKeys>
|
||||||
<string>englishName</string>
|
<string>title</string>
|
||||||
<string>sjisName</string>
|
<string>name</string>
|
||||||
<string>memImage</string>
|
<string>image</string>
|
||||||
|
<string>blockSize</string>
|
||||||
|
<string>showCount</string>
|
||||||
</declaredKeys>
|
</declaredKeys>
|
||||||
<connections>
|
<connections>
|
||||||
<binding destination="955" name="contentArray" keyPath="self.memCard1Array.memoryArray" id="1034"/>
|
<binding destination="955" name="contentArray" keyPath="self.memCard1Array.memoryArray" id="1034"/>
|
||||||
|
|
|
@ -220,7 +220,7 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
|
||||||
{
|
{
|
||||||
int memSize = MAX_MEMCARD_BLOCKS;
|
int memSize = MAX_MEMCARD_BLOCKS;
|
||||||
for (PcsxrMemoryObject *memObj in rawArray) {
|
for (PcsxrMemoryObject *memObj in rawArray) {
|
||||||
if (memObj.flagNameIndex != memFlagDeleted) {
|
if (memObj.flag != memFlagDeleted) {
|
||||||
memSize -= memObj.blockSize;
|
memSize -= memObj.blockSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,10 +270,10 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
|
||||||
x = i;
|
x = i;
|
||||||
McdBlock baseBlock;
|
McdBlock baseBlock;
|
||||||
GetMcdBlockInfo(cardNumber, i+1, &baseBlock);
|
GetMcdBlockInfo(cardNumber, i+1, &baseBlock);
|
||||||
PCSXRMemFlags theFlags = [PcsxrMemoryObject memFlagsFromBlockFlags:baseBlock.Flags];
|
PCSXRMemFlag theFlags = [PcsxrMemoryObject memFlagsFromBlockFlags:baseBlock.Flags];
|
||||||
|
|
||||||
if (theFlags == memFlagDeleted || theFlags == memFlagFree) {
|
if (theFlags == memFlagDeleted || theFlags == memFlagFree) {
|
||||||
PCSXRMemFlags up1Flags = theFlags;
|
PCSXRMemFlag up1Flags = theFlags;
|
||||||
while ((up1Flags == memFlagDeleted || up1Flags == memFlagFree) && x < MAX_MEMCARD_BLOCKS) {
|
while ((up1Flags == memFlagDeleted || up1Flags == memFlagFree) && x < MAX_MEMCARD_BLOCKS) {
|
||||||
x++;
|
x++;
|
||||||
McdBlock up1Block;
|
McdBlock up1Block;
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
|
|
||||||
int cardSize, freeConsBlocks, availBlocks;
|
int cardSize, freeConsBlocks, availBlocks;
|
||||||
|
|
||||||
if ([[fromCard memoryArray][selectedIndex] flagNameIndex] == memFlagFree) {
|
if ([[fromCard memoryArray][selectedIndex] flag] == memFlagFree) {
|
||||||
NSBeep();
|
NSBeep();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@
|
||||||
|
|
||||||
PcsxrMemoryObject *tmpObj = [curCard memoryArray][selectedIndex];
|
PcsxrMemoryObject *tmpObj = [curCard memoryArray][selectedIndex];
|
||||||
|
|
||||||
if (tmpObj.flagNameIndex == memFlagFree) {
|
if (tmpObj.flag == memFlagFree) {
|
||||||
NSBeep();
|
NSBeep();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#include "sio.h"
|
#include "sio.h"
|
||||||
|
|
||||||
typedef NS_ENUM(char, PCSXRMemFlags) {
|
typedef NS_ENUM(char, PCSXRMemFlag) {
|
||||||
memFlagDeleted,
|
memFlagDeleted,
|
||||||
memFlagFree,
|
memFlagFree,
|
||||||
memFlagUsed,
|
memFlagUsed,
|
||||||
|
@ -20,28 +20,28 @@ typedef NS_ENUM(char, PCSXRMemFlags) {
|
||||||
@interface PcsxrMemoryObject : NSObject
|
@interface PcsxrMemoryObject : NSObject
|
||||||
|
|
||||||
+ (NSArray *)imagesFromMcd:(McdBlock *)block;
|
+ (NSArray *)imagesFromMcd:(McdBlock *)block;
|
||||||
+ (NSString*)memoryLabelFromFlag:(PCSXRMemFlags)flagNameIndex;
|
+ (NSString*)memoryLabelFromFlag:(PCSXRMemFlag)flagNameIndex;
|
||||||
+ (NSImage *)blankImage;
|
+ (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;
|
- (instancetype)initWithMcdBlock:(McdBlock *)infoBlockc startingIndex:(uint8_t)startIdx size:(uint8_t)memSize NS_DESIGNATED_INITIALIZER;
|
||||||
|
|
||||||
- (NSImage*)memoryImageAtIndex:(NSInteger)idx;
|
- (NSImage*)memoryImageAtIndex:(NSInteger)idx;
|
||||||
|
|
||||||
|
@property (readonly, copy) NSString *title;
|
||||||
@property (readonly, copy) NSString *name;
|
@property (readonly, copy) NSString *name;
|
||||||
@property (readonly, copy) NSString *memName;
|
@property (readonly, copy) NSString *identifier;
|
||||||
@property (readonly, copy) NSString *memID;
|
@property (readonly, strong) NSArray *imageArray;
|
||||||
@property (readonly, strong) NSArray *memoryCardImages;
|
@property (readonly, strong, nonatomic) NSImage *image;
|
||||||
@property (readonly, strong, nonatomic) NSImage *memImage;
|
@property (readonly) PCSXRMemFlag flag;
|
||||||
@property (readonly) PCSXRMemFlags flagNameIndex;
|
|
||||||
@property (readonly) uint8_t startingIndex;
|
@property (readonly) uint8_t startingIndex;
|
||||||
@property (readonly) uint8_t blockSize;
|
@property (readonly) uint8_t blockSize;
|
||||||
@property (readonly) BOOL hasImages;
|
@property (readonly) BOOL hasImages;
|
||||||
|
|
||||||
@property (readonly, copy) NSImage *firstMemImage;
|
@property (readonly, copy) NSImage *firstImage;
|
||||||
@property (readonly, nonatomic) NSUInteger memIconCount;
|
@property (readonly, nonatomic) NSUInteger iconCount;
|
||||||
@property (readonly, unsafe_unretained, nonatomic) NSString *flagName;
|
@property (readonly, unsafe_unretained, nonatomic) NSString *flagName;
|
||||||
@property (readonly, unsafe_unretained, nonatomic) NSAttributedString *attributedFlagName;
|
@property (readonly, unsafe_unretained, nonatomic) NSAttributedString *attributedFlagName;
|
||||||
@property (readonly, nonatomic) BOOL isBiggerThanOne;
|
@property (readonly, nonatomic) BOOL showCount;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -10,15 +10,15 @@
|
||||||
#import "PcsxrMemoryObject.h"
|
#import "PcsxrMemoryObject.h"
|
||||||
|
|
||||||
@interface PcsxrMemoryObject ()
|
@interface PcsxrMemoryObject ()
|
||||||
|
@property (readwrite, copy) NSString *title;
|
||||||
@property (readwrite, copy) NSString *name;
|
@property (readwrite, copy) NSString *name;
|
||||||
@property (readwrite, copy) NSString *memName;
|
@property (readwrite, copy) NSString *identifier;
|
||||||
@property (readwrite, copy) NSString *memID;
|
|
||||||
@property (readwrite) uint8_t startingIndex;
|
@property (readwrite) uint8_t startingIndex;
|
||||||
@property (readwrite) uint8_t blockSize;
|
@property (readwrite) uint8_t blockSize;
|
||||||
|
|
||||||
@property (readwrite, strong) NSArray *memoryCardImages;
|
@property (readwrite, strong) NSArray *imageArray;
|
||||||
@property (readwrite) PCSXRMemFlags flagNameIndex;
|
@property (readwrite) PCSXRMemFlag flag;
|
||||||
@property (readwrite, nonatomic, strong) NSImage *memImage;
|
@property (readwrite, nonatomic, strong) NSImage *image;
|
||||||
@property (readwrite) BOOL hasImages;
|
@property (readwrite) BOOL hasImages;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -74,13 +74,13 @@ static NSString *MemLabelEndLink;
|
||||||
|
|
||||||
- (NSImage*)memoryImageAtIndex:(NSInteger)idx
|
- (NSImage*)memoryImageAtIndex:(NSInteger)idx
|
||||||
{
|
{
|
||||||
if (!self.hasImages || idx > self.memIconCount) {
|
if (!self.hasImages || idx > self.iconCount) {
|
||||||
return [PcsxrMemoryObject blankImage];
|
return [PcsxrMemoryObject blankImage];
|
||||||
}
|
}
|
||||||
return memImages[idx];
|
return memImages[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSString*)memoryLabelFromFlag:(PCSXRMemFlags)flagNameIndex
|
+ (NSString*)memoryLabelFromFlag:(PCSXRMemFlag)flagNameIndex
|
||||||
{
|
{
|
||||||
switch (flagNameIndex) {
|
switch (flagNameIndex) {
|
||||||
default:
|
default:
|
||||||
|
@ -120,7 +120,7 @@ static NSString *MemLabelEndLink;
|
||||||
return [imageBlank copy];
|
return [imageBlank copy];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (PCSXRMemFlags)memFlagsFromBlockFlags:(unsigned char)blockFlags
|
+ (PCSXRMemFlag)memFlagsFromBlockFlags:(unsigned char)blockFlags
|
||||||
{
|
{
|
||||||
if ((blockFlags & 0xF0) == 0xA0) {
|
if ((blockFlags & 0xF0) == 0xA0) {
|
||||||
if ((blockFlags & 0xF) >= 1 && (blockFlags & 0xF) <= 3)
|
if ((blockFlags & 0xF) >= 1 && (blockFlags & 0xF) <= 3)
|
||||||
|
@ -147,45 +147,45 @@ static NSString *MemLabelEndLink;
|
||||||
if (self = [super init]) {
|
if (self = [super init]) {
|
||||||
self.startingIndex = startIdx;
|
self.startingIndex = startIdx;
|
||||||
self.blockSize = memSize;
|
self.blockSize = memSize;
|
||||||
self.flagNameIndex = [PcsxrMemoryObject memFlagsFromBlockFlags:infoBlock->Flags];
|
self.flag = [PcsxrMemoryObject memFlagsFromBlockFlags:infoBlock->Flags];
|
||||||
if (self.flagNameIndex == memFlagFree) {
|
if (self.flag == memFlagFree) {
|
||||||
self.memoryCardImages = @[];
|
self.imageArray = @[];
|
||||||
self.hasImages = NO;
|
self.hasImages = NO;
|
||||||
self.name = @"Free block";
|
self.title = @"Free block";
|
||||||
self.memID = self.memName = @"";
|
self.identifier = self.name = @"";
|
||||||
} else {
|
} else {
|
||||||
self.name = [NSString stringWithCString:infoBlock->sTitle encoding:NSShiftJISStringEncoding];
|
self.title = [NSString stringWithCString:infoBlock->sTitle encoding:NSShiftJISStringEncoding];
|
||||||
self.memoryCardImages = [PcsxrMemoryObject imagesFromMcd:infoBlock];
|
self.imageArray = [PcsxrMemoryObject imagesFromMcd:infoBlock];
|
||||||
|
|
||||||
if ([memImages count] == 0) {
|
if ([memImages count] == 0) {
|
||||||
self.hasImages = NO;
|
self.hasImages = NO;
|
||||||
} else {
|
} else {
|
||||||
self.hasImages = YES;
|
self.hasImages = YES;
|
||||||
}
|
}
|
||||||
self.memName = @(infoBlock->Name);
|
self.name = @(infoBlock->Name);
|
||||||
self.memID = @(infoBlock->ID);
|
self.identifier = @(infoBlock->ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Property Synthesizers
|
#pragma mark - Property Synthesizers
|
||||||
|
@synthesize title;
|
||||||
@synthesize name;
|
@synthesize name;
|
||||||
@synthesize memName;
|
@synthesize identifier;
|
||||||
@synthesize memID;
|
@synthesize imageArray = memImages;
|
||||||
@synthesize memoryCardImages = memImages;
|
@synthesize flag;
|
||||||
@synthesize flagNameIndex;
|
|
||||||
@synthesize blockSize;
|
@synthesize blockSize;
|
||||||
@synthesize startingIndex;
|
@synthesize startingIndex;
|
||||||
@synthesize memImage = _memImage;
|
@synthesize image = _memImage;
|
||||||
|
|
||||||
#pragma mark Non-synthesized Properties
|
#pragma mark Non-synthesized Properties
|
||||||
- (NSUInteger)memIconCount
|
- (NSUInteger)iconCount
|
||||||
{
|
{
|
||||||
return [memImages count];
|
return [memImages count];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSImage*)firstMemImage
|
- (NSImage*)firstImage
|
||||||
{
|
{
|
||||||
if (self.hasImages == NO) {
|
if (self.hasImages == NO) {
|
||||||
return [PcsxrMemoryObject blankImage];
|
return [PcsxrMemoryObject blankImage];
|
||||||
|
@ -193,7 +193,7 @@ static NSString *MemLabelEndLink;
|
||||||
return memImages[0];
|
return memImages[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSImage*)memImage
|
- (NSImage*)image
|
||||||
{
|
{
|
||||||
if (self.hasImages == NO) {
|
if (self.hasImages == NO) {
|
||||||
NSImage *tmpBlank = [PcsxrMemoryObject blankImage];
|
NSImage *tmpBlank = [PcsxrMemoryObject blankImage];
|
||||||
|
@ -204,7 +204,7 @@ static NSString *MemLabelEndLink;
|
||||||
if (!_memImage) {
|
if (!_memImage) {
|
||||||
NSMutableData *gifData = [NSMutableData new];
|
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}};
|
NSDictionary *gifPrep = @{(NSString *) kCGImagePropertyGIFDictionary: @{(NSString *) kCGImagePropertyGIFDelayTime: @0.30f}};
|
||||||
for (NSImage *theImage in memImages) {
|
for (NSImage *theImage in memImages) {
|
||||||
CGImageRef imageRef = [theImage CGImageForProposedRect:NULL context:nil hints:nil];
|
CGImageRef imageRef = [theImage CGImageForProposedRect:NULL context:nil hints:nil];
|
||||||
|
@ -221,7 +221,7 @@ static NSString *MemLabelEndLink;
|
||||||
|
|
||||||
- (NSString*)flagName
|
- (NSString*)flagName
|
||||||
{
|
{
|
||||||
return [PcsxrMemoryObject memoryLabelFromFlag:flagNameIndex];
|
return [PcsxrMemoryObject memoryLabelFromFlag:flag];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetupAttrStr(NSMutableAttributedString *mutStr, NSColor *txtclr)
|
static inline void SetupAttrStr(NSMutableAttributedString *mutStr, NSColor *txtclr)
|
||||||
|
@ -278,7 +278,7 @@ static inline void SetupAttrStr(NSMutableAttributedString *mutStr, NSColor *txtc
|
||||||
attribMemLabelDeleted = [tmpStr copy];
|
attribMemLabelDeleted = [tmpStr copy];
|
||||||
});
|
});
|
||||||
|
|
||||||
switch (flagNameIndex) {
|
switch (flag) {
|
||||||
default:
|
default:
|
||||||
case memFlagFree:
|
case memFlagFree:
|
||||||
return attribMemLabelFree;
|
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
|
//Always show the size of the free blocks
|
||||||
return YES;
|
return YES;
|
||||||
} else {
|
} else {
|
||||||
|
@ -321,7 +321,7 @@ static inline void SetupAttrStr(NSMutableAttributedString *mutStr, NSColor *txtc
|
||||||
|
|
||||||
- (NSString *)description
|
- (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
|
@end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user