summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-12-30 20:20:48 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-12-30 20:20:48 +0000
commit618c6539e8755305dd7836cf95026c4611b819ce (patch)
tree7d4ffb573c2eebda210f46e178aa138c186c9d87
parentd4da70307ee50ee5d16715942f5cf218f76b3040 (diff)
downloadpcsxr-618c6539e8755305dd7836cf95026c4611b819ce.tar.gz
OS X:
Check to see if a BIOS file has been passed to us, and ask if the user wants to move or copy the BIOS over. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@88203 e17a0e51-4ae3-4d35-97c3-1a29b211df97
-rw-r--r--macosx/English.lproj/en.lproj/Localizable.strings10
-rw-r--r--macosx/English.lproj/fr.lproj/Localizable.strings11
-rw-r--r--macosx/English.lproj/hu.lproj/Localizable.strings8
-rwxr-xr-xmacosx/PcsxrController.m54
4 files changed, 80 insertions, 3 deletions
diff --git a/macosx/English.lproj/en.lproj/Localizable.strings b/macosx/English.lproj/en.lproj/Localizable.strings
index 55b8934e..1ce0f602 100644
--- a/macosx/English.lproj/en.lproj/Localizable.strings
+++ b/macosx/English.lproj/en.lproj/Localizable.strings
@@ -1,4 +1,4 @@
-/*
+/*
Localizable.strings
Pcsx
@@ -100,6 +100,14 @@
"No" = "No";
"Delete" = "Delete";
+//BIOS file opener
+"PlayStation BIOS File" = "PlayStation BIOS File";
+"The file \"%@\" seems to be a BIOS file. Do you want PCSX-R to copy it to the proper location?" = "The file “%1$@\” seems to be a BIOS file. Do you want PCSX-R to copy it to the proper location?";
+"BIOS_Copy" = "Copy";
+"BIOS_Move" = "Move";
+"BIOS Already Exists" = "BIOS Already Exists";
+"There already exists a BIOS file at \"%1$@\": not copying the file at \"%2$@\".\n\nIf you do want to use the BIOS file at \"%2$@\", delete the BIOS at \"%1$@\"." = "There already exists a BIOS file at “%1$@”: not copying the file at “%2$@”.\n\nIf you do want to use the BIOS file at “%2$@”, delete the BIOS at “%1$@”.";
+
//not-so-general buttons
"Show Folder" = "Show Folder";
diff --git a/macosx/English.lproj/fr.lproj/Localizable.strings b/macosx/English.lproj/fr.lproj/Localizable.strings
index b77de4cc..c44d817e 100644
--- a/macosx/English.lproj/fr.lproj/Localizable.strings
+++ b/macosx/English.lproj/fr.lproj/Localizable.strings
@@ -79,7 +79,7 @@
"Unable to open %@: %@" = "Unable to open %1$@: %2$@";
//Memory card management
-"Format Card" = "Formater cette carte mémoire ?";
+"Format Card" = "Formater cette carte mémoire ?"; //Trim this down
//"Free Size" = "Free Size";
//"Format" = "Format";
//"Formatting a memory card will remove all data on it.\n\nThis cannot be undone." = "Formatting a memory card will remove all data on it.\n\nThis cannot be undone.";
@@ -105,6 +105,15 @@
//not-so-general buttons
//"Show Folder" = "Show Folder";
+//BIOS file opener
+//"PlayStation BIOS File" = "PlayStation BIOS File";
+//"The file \"%@\" seems to be a BIOS file. Do you want PCSX-R to copy it to the proper location?" = "The file “%1$@\” seems to be a BIOS file. Do you want PCSX-R to copy it to the proper location?";
+//"BIOS_Copy" = "Copy";
+//"BIOS_Move" = "Move";
+//"BIOS Already Exists" = "BIOS Already Exists";
+//"There already exists a BIOS file at \"%1$@\": not copying the file at \"%2$@\".\n\nIf you do want to use the BIOS file at \"%2$@\", delete the BIOS at \"%1$@\"." = "There already exists a BIOS file at “%1$@”: not copying the file at “%2$@”.\n\nIf you do want to use the BIOS file at “%2$@”, delete the BIOS at “%1$@”.";
+
+
//Mem card flags
"MemCard_Deleted" = "Supprimé";
"MemCard_Free" = "Libre";
diff --git a/macosx/English.lproj/hu.lproj/Localizable.strings b/macosx/English.lproj/hu.lproj/Localizable.strings
index b5229483..827215c6 100644
--- a/macosx/English.lproj/hu.lproj/Localizable.strings
+++ b/macosx/English.lproj/hu.lproj/Localizable.strings
@@ -105,6 +105,14 @@
//not-so-general buttons
//"Show Folder" = "Show Folder";
+//BIOS file opener
+//"PlayStation BIOS File" = "PlayStation BIOS File";
+//"The file \"%@\" seems to be a BIOS file. Do you want PCSX-R to copy it to the proper location?" = "The file “%1$@\” seems to be a BIOS file. Do you want PCSX-R to copy it to the proper location?";
+//"BIOS_Copy" = "Copy";
+//"BIOS_Move" = "Move";
+//"BIOS Already Exists" = "BIOS Already Exists";
+//"There already exists a BIOS file at \"%1$@\": not copying the file at \"%2$@\".\n\nIf you do want to use the BIOS file at \"%2$@\", delete the BIOS at \"%1$@\"." = "There already exists a BIOS file at “%1$@”: not copying the file at “%2$@”.\n\nIf you do want to use the BIOS file at “%2$@”, delete the BIOS at “%1$@”.";
+
//Mem card flags
"MemCard_Deleted" = "Törölve";
"MemCard_Free" = "Üres";
diff --git a/macosx/PcsxrController.m b/macosx/PcsxrController.m
index ca920806..b798b8d1 100755
--- a/macosx/PcsxrController.m
+++ b/macosx/PcsxrController.m
@@ -872,6 +872,7 @@ otherblock();\
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{
+ NSFileManager *fm = [NSFileManager defaultManager];
if (skipFiles && [skipFiles count]) {
for (NSString *parsedFile in skipFiles) {
if ([filename isEqualToString:parsedFile]) {
@@ -880,11 +881,62 @@ otherblock();\
}
}
- if (![[NSFileManager defaultManager] fileExistsAtPath:filename]) {
+ if (![fm fileExistsAtPath:filename]) {
NSLog(@"Nonexistant file %@ was passed to open.", filename );
return NO;
}
+ if ([[filename pathExtension] compare:@"bin" options:(NSCaseInsensitiveSearch | NSWidthInsensitiveSearch)]) {
+ NSDictionary *attrib = [fm attributesOfItemAtPath:filename error:NULL];
+ if ([[attrib fileType] isEqualToString:NSFileTypeRegular] && ([attrib fileSize] % (256 * 1024)) == 0 && [attrib fileSize] > 0 ) {
+ NSAlert *biosInfo = [NSAlert alertWithMessageText:NSLocalizedString(@"PlayStation BIOS File", @"PSX BIOS File") defaultButton:NSLocalizedString(@"BIOS_Copy", @"copy the BIOS over") alternateButton:NSLocalizedString(@"Cancel", @"Cancel") otherButton:NSLocalizedString(@"BIOS_Move", @"Move the bios over") informativeTextWithFormat:NSLocalizedString(@"The file \"%@\" seems to be a BIOS file. Do you want PCSX-R to copy it to the proper location?", @"Can we copy the BIOS?")];
+ biosInfo.alertStyle = NSInformationalAlertStyle;
+ switch ([biosInfo runModal]) {
+ case NSAlertFirstButtonReturn:
+ case NSAlertDefaultReturn:
+ {
+ NSError *theErr = nil;
+ NSURL *biosDirPath = [NSURL fileURLWithPath:[fm stringWithFileSystemRepresentation:Config.BiosDir length:strlen(Config.BiosDir)] isDirectory:YES];
+ NSURL *biosPath = [biosDirPath URLByAppendingPathComponent:[filename lastPathComponent]];
+ if ([biosPath checkResourceIsReachableAndReturnError:NULL]) {
+ NSAlert *alreadyThere = [NSAlert alertWithMessageText:NSLocalizedString(@"BIOS Already Exists", @"BIOS file already there.") defaultButton:nil alternateButton:nil otherButton:nil informativeTextWithFormat:NSLocalizedString(@"There already exists a BIOS file at \"%1$@\": not copying the file at \"%2$@\".\n\nIf you do want to use the BIOS file at \"%2$@\", delete the BIOS at \"%1$@\".", @"What to do"), [biosPath path], filename];
+ alreadyThere.alertStyle = NSCriticalAlertStyle;
+ [alreadyThere runModal];
+ return NO;
+ }
+ if (![fm copyItemAtURL:[NSURL fileURLWithPath:filename isDirectory:NO] toURL:biosPath error:&theErr]) {
+ [[NSAlert alertWithError:theErr] runModal];
+ return NO;
+ }
+ }
+ break;
+
+ case NSAlertThirdButtonReturn:
+ case NSAlertOtherReturn:
+ {
+ NSError *theErr = nil;
+ NSURL *biosDirPath = [NSURL fileURLWithPath:[fm stringWithFileSystemRepresentation:Config.BiosDir length:strlen(Config.BiosDir)] isDirectory:YES];
+ NSURL *biosPath = [biosDirPath URLByAppendingPathComponent:[filename lastPathComponent]];
+ if ([biosPath checkResourceIsReachableAndReturnError:NULL]) {
+ NSAlert *alreadyThere = [NSAlert alertWithMessageText:NSLocalizedString(@"BIOS Already Exists", @"BIOS file already there.") defaultButton:nil alternateButton:nil otherButton:nil informativeTextWithFormat:NSLocalizedString(@"There already exists a BIOS file at \"%1$@\": not copying the file at \"%2$@\".\n\nIf you do want to use the BIOS file at \"%2$@\", delete the BIOS at \"%1$@\".", @"What to do"), [biosPath path], filename];
+ alreadyThere.alertStyle = NSCriticalAlertStyle;
+ [alreadyThere runModal];
+ return NO;
+ }
+ if (![fm moveItemAtURL:[NSURL fileURLWithPath:filename isDirectory:NO] toURL:biosPath error:&theErr]) {
+ [[NSAlert alertWithError:theErr] runModal];
+ return NO;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ return YES;
+ }
+ }
+
NSError *err = nil;
NSString *utiFile = [[NSWorkspace sharedWorkspace] typeOfFile:filename error:&err];
if (err) {