Changing a lot of NSLogs to SysPrintf on OS X's PCSXR.

Enable the emulog on OS X debug, and have create and use a log in ~/Library/Logs/PCSXR.
Delete the hack that enabled PCSXR logs to go to the console in debug mode.
Use modern syntax to create static NSArrays (and retain them in non-ARC code).
Simplify the pauseSafeWithBlock to just create a new dispatch queue and run pauseSafe on the queue.

git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@85931 e17a0e51-4ae3-4d35-97c3-1a29b211df97
This commit is contained in:
SND\MaddTheSane_cp 2013-07-09 07:07:15 +00:00
parent e653d69b63
commit b797c32f08
20 changed files with 86 additions and 95 deletions

View File

@ -36,7 +36,7 @@
} else if ([ident isEqualToString:@"COL_ENABLE"]) {
return @(Cheats[idx].Enabled ? NSOnState : NSOffState);
}
NSLog(@"Unknown column identifier: %@", ident);
SysPrintf("Unknown column identifier: %s\n", [[ident description] UTF8String]);
return nil;
}

View File

@ -67,7 +67,7 @@ static pthread_mutex_t eventMutex;
int res = CheckCdrom();
if (res == -1) {
ClosePlugins();
SysMessage(_("Could not check CD-ROM!\n"));
SysMessage("%s", _("Could not check CD-ROM!\n"));
goto done;
}
@ -305,16 +305,7 @@ done:
+ (void)pauseSafeWithBlock:(void (^)(BOOL))theBlock
{
dispatch_async(dispatch_get_global_queue(0, 0), ^{
BOOL wasPaused = NO;
if ((paused == 2) || ![EmuThread active])
{
wasPaused = YES;
} else {
[EmuThread pause];
while ([EmuThread isPaused] != 2) [NSThread sleepUntilDate:[[NSDate date] addTimeInterval:0.05]];
wasPaused = NO;
}
BOOL wasPaused = [self pauseSafe];
dispatch_async(dispatch_get_main_queue(), ^{theBlock(wasPaused);});
});
}

View File

@ -13,9 +13,8 @@
char* PLUGLOC(char *toloc) \
{ \
NSBundle *mainBundle = [NSBundle bundleForClass:klass]; \
NSString *origString = nil, *transString = nil; \
origString = @(toloc); \
transString = [mainBundle localizedStringForKey:origString value:nil table:nil]; \
NSString *origString = @(toloc), *transString = nil; \
transString = [mainBundle localizedStringForKey:origString value:@"" table:nil]; \
return (char*)[transString UTF8String]; \
}

View File

@ -3401,6 +3401,7 @@
71F353F40FD98DFE00CBEC28 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEBUG_PREPROCESSOR_DEFINITIONS = "DEBUG=1 EMU_LOG=__Log";
GCC_ENABLE_ASM_KEYWORD = YES;
GCC_ENABLE_CPP_EXCEPTIONS = NO;
GCC_PREPROCESSOR_DEFINITIONS = (

View File

@ -160,7 +160,6 @@ void ShowHelpAndExit(FILE* output, int exitCode)
}
/* show the window */
//[cheatWindow makeKeyAndOrderFront:sender];
[cheatController showWindow:sender];
}
@ -175,7 +174,6 @@ void ShowHelpAndExit(FILE* output, int exitCode)
}
/* show the window */
//[preferenceWindow makeKeyAndOrderFront:sender];
[preferencesController showWindow:sender];
}
@ -339,20 +337,17 @@ void ShowHelpAndExit(FILE* output, int exitCode)
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
self.skipFiles = nil;
BOOL enableLogging = NO;
#ifdef DEBUG
enableLogging = YES;
//Just in case it didn't get set.
Config.PsxOut = TRUE;
#endif
[[NSUserDefaults standardUserDefaults] setBool:enableLogging forKey:@"ConsoleOutput"];
}
static void ParseErrorStr(NSString *errStr) __dead2;
static void ParseErrorStr(NSString *errStr)
{
#if 1
SysMessage("Parsing error: %s\n\nPlease check the command line options and try again.\n\nPCSXR will now quit.\n", [errStr UTF8String]);
#else
NSLog(@"%@", errStr);
NSRunCriticalAlertPanel(@"Parsing error", @"%@\n\nPlease check the command line options and try again", nil, nil, nil, errStr);
NSRunCriticalAlertPanel(@"Parsing error", @"%@\n\nPlease check the command line options and try again.\n\nPCSXR will now quit.", nil, nil, nil, errStr);
#endif
ShowHelpAndExit(stderr, EXIT_FAILURE);
}
@ -380,6 +375,8 @@ otherblock();\
#define kPCSXRArgumentBIOS @"--bios"
#define kPCSXRArgumentISO @"--iso"
#define kPCSXRArgumentMcd @"--mcd"
#define kPCSXRArgumentMcd1 kPCSXRArgumentMcd @"1"
#define kPCSXRArgumentMcd2 kPCSXRArgumentMcd @"2"
#define kPCSXRArgumentFreeze @"--freeze"
#define kPCSXRArgumentExitAtClose @"--exitAtClose"
@ -458,7 +455,7 @@ otherblock();\
void (^mcdBlock)(int mcdNumber) = ^(int mcdnumber){
hasParsedAnArgument = YES;
if (memcardHandled & (1 << mcdnumber)) {
NSLog(@"Memory card %i has already been defined. The latest one passed will be used.", mcdnumber);
SysPrintf("Memory card %i has already been defined. The latest one passed will be used.\n", mcdnumber);
} else {
memcardHandled |= (1 << mcdnumber);
}
@ -478,6 +475,7 @@ otherblock();\
NSString *path = FileTestBlock();
dispatch_block_t runtimeBlock = ^{
if (![EmuThread isRunBios]) {
//Make sure the emulator is running
sleep(2);
[EmuThread defrostAt:path];
}
@ -488,9 +486,6 @@ otherblock();\
};
BOOL hasFileTestBlock = NO;
NSString *mcd1NSStr = [kPCSXRArgumentMcd stringByAppendingFormat:@"%i", 1];
NSString *mcd2NSStr = [kPCSXRArgumentMcd stringByAppendingFormat:@"%i", 2];
for (__block int i = 1; i < [progArgs count]; i++) {
if (!hasFileTestBlock)
@ -516,8 +511,8 @@ otherblock();\
HandleArgElse(kPCSXRArgumentCDROM, YES, cdromBlock)
HandleArgElse(kPCSXRArgumentBIOS, YES, biosBlock)
HandleArgElse(kPCSXRArgumentExitAtClose, NO, emuCloseAtEnd)
HandleArgElse(mcd1NSStr, NO, ^{mcdBlock(1);})
HandleArgElse(mcd2NSStr, NO, ^{mcdBlock(2);})
HandleArgElse(kPCSXRArgumentMcd1, NO, ^{mcdBlock(1);})
HandleArgElse(kPCSXRArgumentMcd2, NO, ^{mcdBlock(2);})
HandleArgElse(kPCSXRArgumentFreeze, NO, freezeBlock)
else {
[unknownOptions addObject:[progArgs objectAtIndex:i]];
@ -528,14 +523,19 @@ otherblock();\
//As there doesn't seem to be a Cocoa/Objective-C method like this...
NSString *unknownString = CFBridgingRelease(CFStringCreateByCombiningStrings(kCFAllocatorDefault, BRIDGE(CFArrayRef, unknownOptions), CFSTR(" ")));
NSLog(@"The following options weren't recognized by PCSX-R: %@. This may be due to extra arguments passed by the OS or debugger.", unknownString);
SysPrintf("The following options weren't recognized by PCSX-R: %s. This may be due to extra arguments passed by the OS or debugger.", [unknownString UTF8String]);
}
#endif
if (!isLaunchable && hasParsedAnArgument) {
NSString *tmpStr = @"";
NSString *arg = CFBridgingRelease(CFStringCreateByCombiningStrings(kCFAllocatorDefault, BRIDGE(CFArrayRef, progArgs), CFSTR(" ")));
NSMutableArray *mutProgArgs = [NSMutableArray arrayWithArray:progArgs];
NSString *appRawPath = RETAINOBJ([mutProgArgs objectAtIndex:0]);
//Remove the app file path from the array
[mutProgArgs removeObjectAtIndex:0];
NSString *arg = CFBridgingRelease(CFStringCreateByCombiningStrings(kCFAllocatorDefault, BRIDGE(CFArrayRef, mutProgArgs), CFSTR(" ")));
NSString *recognizedArgs = CFBridgingRelease(CFStringCreateByCombiningStrings(kCFAllocatorDefault, BRIDGE(CFArrayRef, [argDict allKeys]), CFSTR(" ")));
tmpStr = [NSString stringWithFormat:@"A launch command wasn't found in the command line and an argument that PCSX-R recognizes was: %@\n\nThe valid launch commands are --iso, --cdrom, and --bios.", arg];
NSString *tmpStr = [NSString stringWithFormat:@"A launch command wasn't found in the command line and an argument that PCSX-R recognizes was: %@.\nThe following command line arguments were passed with the application launch file at %@: %@.\n\nThe valid launch commands are %@, %@, and %@.", recognizedArgs, appRawPath, arg, kPCSXRArgumentISO, kPCSXRArgumentCDROM, kPCSXRArgumentBIOS];
RELEASEOBJ(appRawPath);
ParseErrorStr(tmpStr);
} else if (hasParsedAnArgument){
NSArray *argArray = [[argDict allValues] sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
@ -561,6 +561,8 @@ otherblock();\
- (void)dealloc
{
[pluginList release];
self.skipFiles = nil;
[super dealloc];
}
#endif
@ -646,7 +648,7 @@ otherblock();\
if (str) {
NSString *tmpNSStr = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:str length:strlen(str)];
if (!tmpNSStr) {
tmpNSStr = [NSString stringWithCString:str encoding:NSUTF8StringEncoding];
tmpNSStr = @(str);
}
[defaults setURL:[NSURL fileURLWithPath:tmpNSStr isDirectory:NO] forKey:defaultKey];
return;
@ -766,6 +768,7 @@ otherblock();\
strcpy(Config.BiosDir, "Bios/");
strcpy(Config.PatchesDir, "Patches/");
//NSString constants don't need to be retained/released. In fact, retain/releasing them does nothing.
saveStatePath = @"sstates";
}
@ -815,7 +818,7 @@ otherblock();\
}
if (![[NSFileManager defaultManager] fileExistsAtPath:filename]) {
NSLog(@"Nonexistant file %@ was passed to open.", filename);
SysPrintf("Nonexistant file %s was passed to open.\n", [filename fileSystemRepresentation]);
return NO;
}
@ -827,7 +830,8 @@ otherblock();\
}
static NSArray *handlers = nil;
if (handlers == nil) {
handlers = [[NSArray alloc] initWithObjects:[PcsxrPluginHandler class], [PcsxrMemCardHandler class], [PcsxrFreezeStateHandler class], [PcsxrDiscHandler class], nil];
handlers = @[[PcsxrPluginHandler class], [PcsxrMemCardHandler class], [PcsxrFreezeStateHandler class], [PcsxrDiscHandler class]];
RETAINOBJNORETURN(handlers);
}
BOOL isHandled = NO;
for (Class fileHandler in handlers) {

View File

@ -21,10 +21,7 @@
@end
@implementation PcsxrDiscHandler
@synthesize discURL = _discURL;
@synthesize discPath;
- (NSURL*)discURL
{
if (!_discURL) {
@ -33,11 +30,14 @@
return _discURL;
}
@synthesize discPath;
+ (NSArray *)supportedUTIs
{
static NSArray *utisupport = nil;
if (utisupport == nil) {
utisupport = [[NSArray alloc] initWithObjects:@"com.alcohol-soft.mdfdisc", @"com.goldenhawk.cdrwin-cuesheet", @"com.apple.disk-image-ndif", @"public.iso-image", @"com.sony.psp.firmware", @"com.codeplex.pcsxr.compressed-bin-image", nil];
utisupport = @[@"com.alcohol-soft.mdfdisc", @"com.goldenhawk.cdrwin-cuesheet", @"com.apple.disk-image-ndif", @"public.iso-image", @"com.sony.psp.firmware", @"com.codeplex.pcsxr.compressed-bin-image"];
RETAINOBJNORETURN(utisupport);
}
return utisupport;
}

View File

@ -18,7 +18,8 @@
{
static NSArray *utisupport = nil;
if (utisupport == nil) {
utisupport = RETAINOBJ([NSArray arrayWithObject:@"com.codeplex.pcsxr.freeze"]);
utisupport = @[@"com.codeplex.pcsxr.freeze"];
RETAINOBJNORETURN(utisupport);
}
return utisupport;
}

View File

@ -22,8 +22,6 @@ static inline void CopyMemcardData(char *from, char *to, int srci, int dsti, cha
// data
memmove(to + (dsti + 1) * 1024 * 8, from + (srci+1) * 1024 * 8, 1024 * 8);
SaveMcd(str, to, (dsti + 1) * 1024 * 8, 1024 * 8);
//printf("data = %s\n", from + (srci+1) * 128);
}
static inline char* BlankHeader()
@ -58,7 +56,6 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
{
// header
char *header = BlankHeader();
memcpy(to + (dsti + 1) * 128, header, 128);
SaveMcd(str, to, (dsti + 1) * 128, 128);
@ -179,9 +176,7 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
- (BOOL)moveBlockAtIndex:(int)idx toMemoryCard:(PcsxrMemCardArray*)otherCard
{
if (idx == [rawArray count]) {
#ifdef DEBUG
NSLog(@"Trying to get an object one more than the length of the raw array. Perhaps you were trying to \"move\" the free blocks");
#endif
SysPrintf("Trying to get an object one more than the length of the raw array. Perhaps you were trying to \"move\" the free blocks. We don't want to do this.\n");
return NO;
}
PcsxrMemoryObject *tmpObj = [rawArray objectAtIndex:idx];
@ -189,13 +184,13 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
int memSize = tmpObj.blockSize;
if ([otherCard availableBlocks] < memSize) {
NSLog(@"Failing because the other card does not have enough space!");
SysPrintf("Failing because the other card does not have enough space!\n");
return NO;
}
int toCopy = [otherCard indexOfFreeBlocksWithSize:memSize];
if (toCopy == -1) {
NSLog(@"Not enough consecutive blocks. Compacting the other card.");
SysPrintf("Not enough consecutive blocks. Compacting the other card.\n");
[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];
@ -203,8 +198,7 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
}
int memIdx = tmpObj.startingIndex;
int i;
for (i = 0; i < memSize; i++) {
for (int i = 0; i < memSize; i++) {
CopyMemcardData([self memDataPtr], [otherCard memDataPtr], (memIdx+i), (toCopy+i), (char*)otherCard.memCardCPath);
}
@ -258,9 +252,7 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
- (int)memorySizeAtIndex:(int)idx
{
if (idx == [rawArray count]) {
#ifdef DEBUG
NSLog(@"Trying to get an object one more than the length of the raw array. Perhaps you were trying to \"count\" the free blocks");
#endif
SysPrintf("Trying to get an object one more than the length of the raw array. Perhaps you were trying to \"count\" the free blocks.\n");
return [self freeBlocks];
}
@ -315,9 +307,7 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
}
if (slotnum == [rawArray count]) {
#ifdef DEBUG
NSLog(@"Trying to get an object one more than the length of the raw array. Perhaps you were trying to \"delete\" the free blocks");
#endif
SysPrintf("Trying to get an object one more than the length of the raw array. Perhaps you were trying to \"delete\" the free blocks.\n");
return;
}

View File

@ -59,6 +59,7 @@
}
}
#if 0
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil;
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
@ -68,6 +69,7 @@
return self;
}
#endif
- (void)loadMemoryCardInfoForCard:(int)theCard
{
@ -216,7 +218,7 @@
NSInteger deleteOkay = NSRunAlertPanel(NSLocalizedString(@"Delete Block", nil), NSLocalizedString(@"Deleting a block will remove all saved data on that block.\n\nThis cannot be undone.", nil), NSLocalizedString(@"Cancel", nil), NSLocalizedString(@"Delete", nil), nil);
if (deleteOkay == NSAlertAlternateReturn) {
[self deleteMemoryBlocksAtIndex:selectedIndex card:(int)memCardSelect];
[self deleteMemoryBlocksAtIndex:(int)selectedIndex card:(int)memCardSelect];
if (memCardSelect == 1) {
LoadMcd(1, Config.Mcd1);
@ -243,7 +245,6 @@
[imageAnimateTimer invalidate];
#if !__has_feature(objc_arc)
[imageAnimateTimer release];
self.memCard1Array = nil;
self.memCard2Array = nil;

View File

@ -17,7 +17,8 @@
{
static NSArray *utisupport = nil;
if (utisupport == nil) {
utisupport = RETAINOBJ([NSArray arrayWithObject:@"com.codeplex.pcsxr.memcard"]);
utisupport = @[@"com.codeplex.pcsxr.memcard"];
RETAINOBJNORETURN(utisupport);
}
return utisupport;
}
@ -34,8 +35,7 @@
- (id)init
{
self = [self initWithWindowNibName:@"PcsxrMemCardDocument"];
return self;
return self = [self initWithWindowNibName:@"PcsxrMemCardDocument"];
}
- (void)windowDidLoad

View File

@ -25,7 +25,6 @@ NSString *const memoryAnimateTimerKey = @"PCSXR Memory Card Image Animate";
@property (readwrite) int startingIndex;
@property (readwrite) int blockSize;
@property (readwrite, nonatomic) NSInteger memImageIndex;
@property (arcstrong) NSArray *memImages;
@property (readwrite) PCSXRMemFlags flagNameIndex;
@ -148,9 +147,7 @@ static NSString *MemLabelEndLink;
return memFlagFree;
//Xcode complains unless we do this...
#ifdef DEBUG
NSLog(@"Unknown flag ");
#endif
SysPrintf("Unknown flag %x\n", blockFlags);
return memFlagFree;
}
@ -170,9 +167,7 @@ static NSString *MemLabelEndLink;
self.sjisName = [NSString stringWithCString:infoBlock->sTitle encoding:NSShiftJISStringEncoding];
if ([englishName isEqualToString:sjisName]) {
#ifdef DEBUG
NSLog(@"English name and SJIS name are the same: %@. Replacing the sjis string with the English string.", englishName);
#endif
SysPrintf("English name and sjis name are the same: %s. Replacing the sjis string with the English string.\n", [englishName UTF8String]);
self.sjisName = self.englishName;
}
@autoreleasepool {

View File

@ -16,7 +16,8 @@
{
static NSArray *utisupport = nil;
if (utisupport == nil) {
utisupport = RETAINOBJ([NSArray arrayWithObject:@"com.codeplex.pcsxr.plugin"]);
utisupport = @[@"com.codeplex.pcsxr.plugin"];
RETAINOBJNORETURN(utisupport);
}
return utisupport;
}

View File

@ -74,18 +74,18 @@ int _OpenPlugins() {
GPU_clearDynarec(clearDynarec);
ret = CDR_open();
if (ret < 0) { SysMessage(_("Error Opening CDR Plugin")); return -1; }
if (ret < 0) { SysMessage("%s", _("Error Opening CDR Plugin")); return -1; }
ret = SPU_open();
if (ret < 0) { SysMessage(_("Error Opening SPU Plugin")); return -1; }
if (ret < 0) { SysMessage("%s", _("Error Opening SPU Plugin")); return -1; }
SPU_registerCallback(SPUirq);
ret = GPU_open(&gpuDisp, "PCSXR", NULL);
if (ret < 0) { SysMessage(_("Error Opening GPU Plugin")); return -1; }
if (ret < 0) { SysMessage("%s", _("Error Opening GPU Plugin")); return -1; }
ret = PAD1_open(&gpuDisp);
if (ret < 0) { SysMessage(_("Error Opening PAD1 Plugin")); return -1; }
if (ret < 0) { SysMessage("%s", _("Error Opening PAD1 Plugin")); return -1; }
PAD1_registerVibration(GPU_visualVibration);
PAD1_registerCursor(GPU_cursor);
ret = PAD2_open(&gpuDisp);
if (ret < 0) { SysMessage(_("Error Opening PAD2 Plugin")); return -1; }
if (ret < 0) { SysMessage("%s", _("Error Opening PAD2 Plugin")); return -1; }
PAD2_registerVibration(GPU_visualVibration);
PAD2_registerCursor(GPU_cursor);
@ -165,15 +165,15 @@ void ClosePlugins() {
//signal(SIGINT, SIG_DFL);
//signal(SIGPIPE, SIG_DFL);
ret = CDR_close();
if (ret < 0) { SysMessage(_("Error Closing CDR Plugin")); return; }
if (ret < 0) { SysMessage("%s", _("Error Closing CDR Plugin")); return; }
ret = SPU_close();
if (ret < 0) { SysMessage(_("Error Closing SPU Plugin")); return; }
if (ret < 0) { SysMessage("%s", _("Error Closing SPU Plugin")); return; }
ret = PAD1_close();
if (ret < 0) { SysMessage(_("Error Closing PAD1 Plugin")); return; }
if (ret < 0) { SysMessage("%s", _("Error Closing PAD1 Plugin")); return; }
ret = PAD2_close();
if (ret < 0) { SysMessage(_("Error Closing PAD2 Plugin")); return; }
if (ret < 0) { SysMessage("%s", _("Error Closing PAD2 Plugin")); return; }
ret = GPU_close();
if (ret < 0) { SysMessage(_("Error Closing GPU Plugin")); return; }
if (ret < 0) { SysMessage("%s", _("Error Closing GPU Plugin")); return; }
if (Config.UseNet) {
NET_pause();

View File

@ -76,8 +76,8 @@
#if !__has_feature(objc_arc)
- (void)dealloc
{
if (plugins) [plugins release];
if (defaultKey) [defaultKey release];
[plugins release];
[defaultKey release];
[super dealloc];
}
#endif

View File

@ -130,7 +130,7 @@ const static int typeList[] = {PSE_LT_GPU, PSE_LT_SPU, PSE_LT_CDR, PSE_LT_PAD, P
// check the we have the needed plugins
missingPlugins = NO;
for (i=0; i < sizeof(*typeList); i++) {
for (i=0; i < 4 /*sizeof(*typeList)*/; i++) {
PcsxrPlugin *plugin = [self activePluginForType:typeList[i]];
if (nil == plugin) {
NSArray *list = [self pluginsForType:typeList[i]];

View File

@ -76,7 +76,7 @@ BOOL handleHotkey(NSString* keyCode) {
GPU_displayText((char*)[[NSString stringWithFormat:@"State Slot: %d", currentState] UTF8String]);
break;
default:
NSLog(@"Invalid hotkey identifier.");
SysPrintf("Invalid hotkey identifier %i.\n", [ident intValue]);
}
return YES;

View File

@ -64,7 +64,15 @@ int SysInit() {
if (!sysInited) {
#ifdef EMU_LOG
#ifndef LOG_STDOUT
emuLog = fopen("emuLog.txt","wb");
NSFileManager *manager = [NSFileManager defaultManager];
NSURL *supportURL = [manager URLForDirectory:NSLibraryDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:NULL];
NSURL *logFolderURL = [supportURL URLByAppendingPathComponent:@"Logs/PCSXR"];
if (![logFolderURL checkResourceIsReachableAndReturnError:NULL])
[manager createDirectoryAtPath:[logFolderURL path] withIntermediateDirectories:YES attributes:nil error:NULL];
//We use the log extension so that OS X's console app can open it by default.
NSURL *logFileURL = [logFolderURL URLByAppendingPathComponent:@"emuLog.log"];
emuLog = fopen([[logFileURL path] fileSystemRepresentation],"wb");
#else
emuLog = stdout;
#endif
@ -85,7 +93,7 @@ int SysInit() {
IOReturn success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, CFSTR("PSX Emu Running"), &powerAssertion);
if (success != kIOReturnSuccess) {
NSLog(@"Unable to stop sleep, error code %d", success);
SysPrintf("Unable to stop sleep, error code %d", success);
}
attachHotkeys();
@ -147,7 +155,7 @@ const char *SysLibError() {
#ifdef DEBUG
const char *theErr = dlerror();
if (theErr) {
NSLog(@"Error loading binary: %s", theErr);
SysPrintf("Error loading binary: %s\n", theErr);
}
return theErr;
#else
@ -206,6 +214,6 @@ char* Pcsxr_locale_text(char* toloc){
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *origString = nil, *transString = nil;
origString = @(toloc);
transString = [mainBundle localizedStringForKey:origString value:nil table:nil];
transString = [mainBundle localizedStringForKey:origString value:@"" table:nil];
return (char*)[transString UTF8String];
}

View File

@ -204,8 +204,8 @@ void ReadConfig(void)
[writeDic setObject:[NSNumber numberWithBool:[vSync intValue]] forKey:@"VSync"];
[writeDic setObject:[NSNumber numberWithBool:[hackEnable intValue]] forKey:@"Enable Hacks"];
[writeDic setObject:[NSNumber numberWithBool:[shaders intValue]] forKey:@"UseShader"];
[writeDic setObject:[NSNumber numberWithInt:[shaderQualitySelector indexOfSelectedItem] + 1] forKey:@"ShaderQuality"];
[writeDic setObject:[NSNumber numberWithInt:[ditherMode indexOfSelectedItem]] forKey:@"Dither Mode"];
[writeDic setObject:[NSNumber numberWithInteger:[shaderQualitySelector indexOfSelectedItem] + 1] forKey:@"ShaderQuality"];
[writeDic setObject:[NSNumber numberWithInteger:[ditherMode indexOfSelectedItem]] forKey:@"Dither Mode"];
unsigned int hackValues = 0;
NSArray *views = [hacksView subviews];

View File

@ -695,7 +695,7 @@ void BlitScreen16NS(unsigned char * surf,long x,long y)
}
else
{
int LineOffset,SurfOffset;
long LineOffset,SurfOffset;
GLuint * SRCPtr = (GLuint *)(psxVuw + (y << 10) + x);
GLuint * DSTPtr =
((GLuint *)surf) + (PreviousPSXDisplay.Range.x0 >> 1);

View File

@ -118,8 +118,8 @@ NSRect windowFrame;
//[window orderOut:self];
}
int width = CGDisplayPixelsWide(display);
int height = CGDisplayPixelsHigh(display);
size_t width = CGDisplayPixelsWide(display);
size_t height = CGDisplayPixelsHigh(display);
// assume square pixel ratio on the monitor
if ((width*3)/4 < height) {