Added some sanity checking so we don't try to use nil objects in the SoftGL Mac driver.

git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@80324 e17a0e51-4ae3-4d35-97c3-1a29b211df97
This commit is contained in:
SND\MaddTheSane_cp 2012-10-10 00:54:20 +00:00
parent 7a613cfccd
commit 18fe428c13
2 changed files with 23 additions and 2 deletions

View File

@ -284,6 +284,26 @@ void ReadConfig(void)
[keyValues release];
keyValues = [[defaults dictionaryForKey:PrefsKey] mutableCopy];
{
BOOL resetPrefs = NO;
vertexPath = [NSURL URLByResolvingBookmarkData:[keyValues objectForKey:@"VertexShader"] options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:NULL error:nil];
if (vertexPath) {
[vertexPath retain];
} else {
resetPrefs = YES;
}
fragmentPath = [NSURL URLByResolvingBookmarkData:[keyValues objectForKey:@"FragmentShader"] options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:NULL error:nil];
if (fragmentPath) {
[fragmentPath retain];
} else {
resetPrefs = YES;
}
if (resetPrefs) {
NSBundle *selfBundle = [NSBundle bundleWithIdentifier:APP_ID];
vertexPath = [[selfBundle URLForResource:@"gpuPeteOGL2" withExtension:@"slv"] retain];
fragmentPath = [[selfBundle URLForResource:@"gpuPeteOGL2" withExtension:@"slf"] retain];
}
}
[fpsCounter setIntValue:[[keyValues objectForKey:@"FPS Counter"] intValue]];
[autoFullScreen setIntValue:[[keyValues objectForKey:@"Auto Full Screen"] intValue]];
[frameSkipping setIntValue:[[keyValues objectForKey:@"Frame Skipping"] intValue]];
@ -294,8 +314,6 @@ void ReadConfig(void)
[ditherMode selectItemAtIndex:[[keyValues objectForKey:@"Dither Mode"] intValue]];
[shaderQualitySelector selectItemAtIndex:[[keyValues objectForKey:@"ShaderQuality"] intValue]];
vertexPath = [[NSURL URLByResolvingBookmarkData:[keyValues objectForKey:@"VertexShader"] options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:NULL error:nil] retain];
fragmentPath = [[NSURL URLByResolvingBookmarkData:[keyValues objectForKey:@"FragmentShader"] options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:NULL error:nil] retain];
[vertexShaderViewablePath setTitleWithMnemonic:[vertexPath path]];
[fragmentShaderViewablePath setTitleWithMnemonic:[fragmentPath path]];
unsigned int hackValues = [[keyValues objectForKey:@"Hacks"] unsignedIntValue];

View File

@ -881,6 +881,9 @@ void BlitScreen16NS(unsigned char * surf,long x,long y)
return src;*/
//NSURL *actualFile = [filename filePathURL];
//Since we're passing Cocoa NSURLs, let's use Cocoa's methods
if (filename == nil) {
return NULL;
}
NSNumber *filesizeAsNS = nil;
long long filesize = 0;
[filename getResourceValue:&filesizeAsNS forKey:NSURLFileSizeKey error:nil];