summaryrefslogtreecommitdiff
path: root/macosx
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-07-08 07:26:30 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-07-08 07:26:30 +0000
commit7feee6f616e56e96cccdee173abb994a6d0bf91c (patch)
treec7c4e0c243b93eae9ecd0a23e011aac412ab1fec /macosx
parent673809f1f115c90558b87df1529f9e3c9acc1270 (diff)
downloadpcsxr-7feee6f616e56e96cccdee173abb994a6d0bf91c.tar.gz
Various updates and improvements to OS X code.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@85894 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx')
-rw-r--r--macosx/CheatController.h4
-rw-r--r--macosx/CheatController.m11
-rw-r--r--macosx/MemBadgeView.m1
-rwxr-xr-xmacosx/PcsxrDiscHandler.m1
-rw-r--r--macosx/PcsxrMemCardArray.h1
-rw-r--r--macosx/PcsxrMemCardArray.m11
-rwxr-xr-xmacosx/PcsxrMemCardController.m13
-rwxr-xr-xmacosx/PcsxrMemoryObject.h1
-rwxr-xr-xmacosx/PcsxrMemoryObject.m7
-rwxr-xr-xmacosx/main.m1
10 files changed, 19 insertions, 32 deletions
diff --git a/macosx/CheatController.h b/macosx/CheatController.h
index 671f028d..ab61c6d0 100644
--- a/macosx/CheatController.h
+++ b/macosx/CheatController.h
@@ -14,8 +14,4 @@
-(IBAction)LoadCheats:(id)sender;
-(IBAction)clear:(id)sender;
-(IBAction)close:(id)sender;
-
--(NSInteger)numberOfRowsInTableView:(NSTableView *)view;
--(id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)col row:(NSInteger)idx;
--(void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row;
@end
diff --git a/macosx/CheatController.m b/macosx/CheatController.m
index ebb0d4b9..70f8688b 100644
--- a/macosx/CheatController.m
+++ b/macosx/CheatController.m
@@ -13,8 +13,7 @@
- (id)init
{
- self = [self initWithWindowNibName:@"CheatWindow"];
- return self;
+ return self = [self initWithWindowNibName:@"CheatWindow"];
}
- (void)refresh
@@ -34,8 +33,7 @@
NSString *ident = [col identifier];
if ([ident isEqualToString:@"COL_NAME"]) {
return @(Cheats[idx].Descr);
- }
- if ([ident isEqualToString:@"COL_ENABLE"]) {
+ } else if ([ident isEqualToString:@"COL_ENABLE"]) {
return @(Cheats[idx].Enabled ? NSOnState : NSOffState);
}
NSLog(@"Unknown column identifier: %@", ident);
@@ -49,7 +47,10 @@
NSString *ident = [col identifier];
if ([ident isEqualToString:@"COL_ENABLE"]) {
Cheats[row].Enabled = [object integerValue] == NSOnState;
- }
+ } else if ([ident isEqualToString:@"COL_NAME"]) {
+ free(Cheats[row].Descr);
+ Cheats[row].Descr = strdup([object UTF8String]);
+ }
}
- (IBAction)LoadCheats:(id)sender
diff --git a/macosx/MemBadgeView.m b/macosx/MemBadgeView.m
index 3a7b8277..090b88fc 100644
--- a/macosx/MemBadgeView.m
+++ b/macosx/MemBadgeView.m
@@ -31,6 +31,7 @@
tmpDraw = [[NSImage alloc] initWithSize:drawToRect.size];
[tmpDraw lockFocus];
}
+
[[NSColor whiteColor] set];
[[NSBezierPath bezierPathWithOvalInRect:drawToRect] fill];
[[NSColor redColor] set];
diff --git a/macosx/PcsxrDiscHandler.m b/macosx/PcsxrDiscHandler.m
index 0420940c..6a424ef3 100755
--- a/macosx/PcsxrDiscHandler.m
+++ b/macosx/PcsxrDiscHandler.m
@@ -48,7 +48,6 @@
SetIsoFile([theFile fileSystemRepresentation]);
SetCdOpenCaseTime(time(NULL) + 2);
LidInterrupt();
- //[EmuThread reset];
} else {
return NO;
}
diff --git a/macosx/PcsxrMemCardArray.h b/macosx/PcsxrMemCardArray.h
index a1d209fb..87dcbec7 100644
--- a/macosx/PcsxrMemCardArray.h
+++ b/macosx/PcsxrMemCardArray.h
@@ -29,7 +29,6 @@
- (BOOL)moveBlockAtIndex:(int)idx toMemoryCard:(PcsxrMemCardArray*)otherCard;
- (int)indexOfFreeBlocksWithSize:(int)asize;
-
@property (nonatomic, readonly, unsafe_unretained) NSArray *memoryArray;
@property (nonatomic, readonly, unsafe_unretained) NSURL *memCardURL;
@property (nonatomic, readonly) const char *memCardCPath;
diff --git a/macosx/PcsxrMemCardArray.m b/macosx/PcsxrMemCardArray.m
index b3b8ce41..3ceb8566 100644
--- a/macosx/PcsxrMemCardArray.m
+++ b/macosx/PcsxrMemCardArray.m
@@ -37,8 +37,10 @@ static inline char* CreateBlankHeader()
unsigned char checksum;
};
struct PSXMemHeader *toReturn = calloc(sizeof(struct PSXMemHeader), 1);
-
+
+ //FIXME: Which value is right?
toReturn->allocState = 0x000000a0;
+ //toReturn->allocState = 0xa0000000;
toReturn->nextBlock = 0xFFFF;
unsigned char *bytePtr = (unsigned char*)toReturn;
for (int i = 0; i < sizeof(struct PSXMemHeader) - sizeof(unsigned char); i++) {
@@ -60,10 +62,8 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
// data
memset(to + (dsti + 1) * 1024 * 8, 0, 1024 * 8);
SaveMcd(str, to, (dsti + 1) * 1024 * 8, 1024 * 8);
-
}
-
@interface PcsxrMemCardArray ()
@property (arcretain) NSArray *rawArray;
@property (readonly) char* memDataPtr;
@@ -72,7 +72,6 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
@implementation PcsxrMemCardArray
@synthesize rawArray;
-//@synthesize memDataPtr;
- (char*)memDataPtr
{
@@ -195,6 +194,7 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
if (toCopy == -1) {
NSLog(@"Not enough consecutive blocks. Compacting the other card.");
[otherCard compactMemory];
+ //Since we're accessing the mem card data directly (instead of via PcsxrMemoryObject objects) using the following calls, we don't need to reload the data.
toCopy = [otherCard indexOfFreeBlocksWithSize:memSize];
NSAssert(toCopy != -1, @"Compacting the card should have made space!");
}
@@ -297,9 +297,6 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
}
LoadMcd(cardNumber, (char*)self.memCardCPath);
-#if 0
- [[NSNotificationCenter defaultCenter] postNotificationName:memChangeNotifier object:nil userInfo:[NSDictionary dictionaryWithObject:@(cardNumber) forKey:memCardChangeNumberKey]];
-#endif
}
- (void)deleteMemoryBlocksAtIndex:(int)slotnum
diff --git a/macosx/PcsxrMemCardController.m b/macosx/PcsxrMemCardController.m
index 00d77ca7..24cba060 100755
--- a/macosx/PcsxrMemCardController.m
+++ b/macosx/PcsxrMemCardController.m
@@ -25,8 +25,6 @@
@synthesize memCard1Array, memCard2Array;
-//memCard1Array KVO functions
-
- (void)setupValues:(int)theCards
{
NSParameterAssert(theCards < 4 && theCards > 0);
@@ -244,11 +242,14 @@
[[NSNotificationCenter defaultCenter] removeObserver:self];
[imageAnimateTimer invalidate];
- RELEASEOBJ(imageAnimateTimer);
- RELEASEOBJ(memCard1Array);
- RELEASEOBJ(memCard2Array);
+#if !__has_feature(objc_arc)
+
+ [imageAnimateTimer release];
+ self.memCard1Array = nil;
+ self.memCard2Array = nil;
- SUPERDEALLOC;
+ [super dealloc];
+#endif
}
@end
diff --git a/macosx/PcsxrMemoryObject.h b/macosx/PcsxrMemoryObject.h
index 8efbe28a..c113a100 100755
--- a/macosx/PcsxrMemoryObject.h
+++ b/macosx/PcsxrMemoryObject.h
@@ -43,7 +43,6 @@ typedef enum _PCSXRMemFlags {
+ (NSImage *)blankImage;
+ (PCSXRMemFlags)memFlagsFromBlockFlags:(unsigned char)blockFlags;
-- (id)initWithMcdBlock:(McdBlock *)infoBlockc NS_UNAVAILABLE;
- (id)initWithMcdBlock:(McdBlock *)infoBlockc startingIndex:(int)startIdx;
- (id)initWithMcdBlock:(McdBlock *)infoBlockc startingIndex:(int)startIdx size:(int)memSize;
diff --git a/macosx/PcsxrMemoryObject.m b/macosx/PcsxrMemoryObject.m
index 1a7013e9..df6a243b 100755
--- a/macosx/PcsxrMemoryObject.m
+++ b/macosx/PcsxrMemoryObject.m
@@ -66,7 +66,6 @@ NSString *const memoryAnimateTimerKey = @"PCSXR Memory Card Image Animate";
return retArray;
}
-
static NSString *MemLabelDeleted;
static NSString *MemLabelFree;
static NSString *MemLabelUsed;
@@ -126,12 +125,6 @@ static NSString *MemLabelEndLink;
return imageBlank;
}
-- (id)initWithMcdBlock:(McdBlock *)infoBlock
-{
- [self doesNotRecognizeSelector:_cmd];
- return nil;
-}
-
- (id)initWithMcdBlock:(McdBlock *)infoBlock startingIndex:(int)startIdx
{
return [self initWithMcdBlock:infoBlock startingIndex:startIdx size:1];
diff --git a/macosx/main.m b/macosx/main.m
index 700bfdda..8539101d 100755
--- a/macosx/main.m
+++ b/macosx/main.m
@@ -193,6 +193,7 @@ void SysClose() {
[NSApp stop:nil];
}
//Tell the memory card manager that the memory cards changed.
+ //The number three tells the mem card manager to update both cards 1 and 2.
[[NSNotificationCenter defaultCenter] postNotificationName:memChangeNotifier object:nil userInfo:[NSDictionary dictionaryWithObject:@3 forKey:memCardChangeNumberKey]];
}