Various updates and improvements to OS X code.

git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@85894 e17a0e51-4ae3-4d35-97c3-1a29b211df97
This commit is contained in:
SND\MaddTheSane_cp 2013-07-08 07:26:30 +00:00
parent 673809f1f1
commit 7feee6f616
10 changed files with 19 additions and 32 deletions

View File

@ -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

View File

@ -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

View File

@ -31,6 +31,7 @@
tmpDraw = [[NSImage alloc] initWithSize:drawToRect.size];
[tmpDraw lockFocus];
}
[[NSColor whiteColor] set];
[[NSBezierPath bezierPathWithOvalInRect:drawToRect] fill];
[[NSColor redColor] set];

View File

@ -48,7 +48,6 @@
SetIsoFile([theFile fileSystemRepresentation]);
SetCdOpenCaseTime(time(NULL) + 2);
LidInterrupt();
//[EmuThread reset];
} else {
return NO;
}

View File

@ -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;

View File

@ -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

View File

@ -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)
SUPERDEALLOC;
[imageAnimateTimer release];
self.memCard1Array = nil;
self.memCard2Array = nil;
[super dealloc];
#endif
}
@end

View File

@ -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;

View File

@ -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];

View File

@ -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]];
}