summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2009-11-29 13:31:23 +0000
committerSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2009-11-29 13:31:23 +0000
commitb11cc9582440fd162d058aefc942a6441eb80675 (patch)
treedfb8e0e1e8ddb21f98de96ff47530bb8f7818b6c
parentb8e853cbdd5bc80653cdac1e599e0d4d87d709ab (diff)
downloadpcsxr-b11cc9582440fd162d058aefc942a6441eb80675.tar.gz
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@38448 e17a0e51-4ae3-4d35-97c3-1a29b211df97
-rw-r--r--ChangeLog7
-rw-r--r--macosx/ConfigurationController.h35
-rw-r--r--macosx/ConfigurationController.m69
-rw-r--r--macosx/English.lproj/Configuration.nib/classes.nib10
-rw-r--r--macosx/English.lproj/Configuration.nib/info.nib10
-rw-r--r--macosx/Pcsx.xcodeproj/project.pbxproj2
-rw-r--r--macosx/PcsxController.m60
-rw-r--r--macosx/PluginController.m12
-rw-r--r--macosx/main.m14
9 files changed, 155 insertions, 64 deletions
diff --git a/ChangeLog b/ChangeLog
index b2d1cfd9..49bdcdd3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,13 @@ November 29, 2009 Wei Mingzhi <weimingzhi@gmail.com>
* po/pt_BR.po, po/zh_CN.po, po/zh_TW.po, po/pcsx.pot: Updated.
* po/update-pot.sh: Also run msgmerge automatically.
* doc/pcsx.1: Don't say "PCSX-df".
+ * macosx/main.m: Minor cleanup.
+ * macosx/PluginController.m: Likewise.
+ * macosx/PcsxController.m: Made the memory card files configurable.
+ * macosx/ConfigurationController.m: Likewise.
+ * macosx/ConfigurationController.h: Likewise.
+ * macosx/English.lproj/Configuration.nib/info.nib: Likewise.
+ * macosx/English.lproj/Configuration.nib/classes.nib: Likewise.
November 28, 2009 Wei Mingzhi <weimingzhi@gmail.com>
diff --git a/macosx/ConfigurationController.h b/macosx/ConfigurationController.h
index a85c2579..e3901976 100644
--- a/macosx/ConfigurationController.h
+++ b/macosx/ConfigurationController.h
@@ -10,26 +10,31 @@
IBOutlet PluginController *graphicsPlugin;
IBOutlet PluginController *padPlugin;
IBOutlet PluginController *soundPlugin;
-
- IBOutlet id noXaAudioCell;
- IBOutlet id sioIrqAlwaysCell;
- IBOutlet id bwMdecCell;
- IBOutlet id autoVTypeCell;
- IBOutlet id vTypePALCell;
- IBOutlet id noCDAudioCell;
- IBOutlet id usesHleCell;
- IBOutlet id usesDynarecCell;
- IBOutlet id consoleOutputCell;
- IBOutlet id spuIrqAlwaysCell;
- IBOutlet id rCountFixCell;
- IBOutlet id vSyncWAFixCell;
- IBOutlet id noFastBootCell;
- NSMutableDictionary *checkBoxDefaults;
+ IBOutlet id noXaAudioCell;
+ IBOutlet id sioIrqAlwaysCell;
+ IBOutlet id bwMdecCell;
+ IBOutlet id autoVTypeCell;
+ IBOutlet id vTypePALCell;
+ IBOutlet id noCDAudioCell;
+ IBOutlet id usesHleCell;
+ IBOutlet id usesDynarecCell;
+ IBOutlet id consoleOutputCell;
+ IBOutlet id spuIrqAlwaysCell;
+ IBOutlet id rCountFixCell;
+ IBOutlet id vSyncWAFixCell;
+ IBOutlet id noFastBootCell;
+
+ IBOutlet NSTextField *mcd1Label;
+ IBOutlet NSTextField *mcd2Label;
+
+ NSMutableDictionary *checkBoxDefaults;
}
- (IBAction)setCheckbox:(id)sender;
- (IBAction)setCheckboxInverse:(id)sender;
- (IBAction)setVideoType:(id)sender;
+- (IBAction)mcdChangeClicked:(id)sender;
+- (IBAction)mcdNewClicked:(id)sender;
- (NSString *)keyForSender:(id)sender;
diff --git a/macosx/ConfigurationController.m b/macosx/ConfigurationController.m
index e62465e2..be5bf69d 100644
--- a/macosx/ConfigurationController.m
+++ b/macosx/ConfigurationController.m
@@ -33,10 +33,69 @@
}
}
+- (IBAction)mcdChangeClicked:(id)sender
+{
+ int tag = [sender tag];
+ char *mcd;
+ NSTextField *label;
+ NSOpenPanel *openDlg = [NSOpenPanel openPanel];
+ NSString *path;
+
+ if (tag == 1) { mcd = Config.Mcd1; label = mcd1Label; }
+ else { mcd = Config.Mcd2; label = mcd2Label; }
+
+ [openDlg setCanChooseFiles:YES];
+ [openDlg setCanChooseDirectories:NO];
+
+ path = [NSString stringWithCString:mcd];
+
+ if ([openDlg runModalForDirectory:[path stringByDeletingLastPathComponent] file:[path lastPathComponent]] == NSOKButton) {
+ NSArray* files = [openDlg filenames];
+ strcpy(mcd, (const char *)[[files objectAtIndex:0] fileSystemRepresentation]);
+
+ [label setTitleWithMnemonic:[NSString stringWithCString:mcd]];
+
+ if (tag == 1)
+ [[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithCString:mcd] forKey:@"Mcd1"];
+ else
+ [[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithCString:mcd] forKey:@"Mcd2"];
+
+ LoadMcds(Config.Mcd1, Config.Mcd2);
+ }
+}
+
+- (IBAction)mcdNewClicked:(id)sender
+{
+ int tag = [sender tag];
+ char *mcd;
+ NSTextField *label;
+ NSSavePanel *openDlg = [NSSavePanel savePanel];
+ NSString *path;
+
+ if (tag == 1) { mcd = Config.Mcd1; label = mcd1Label; }
+ else { mcd = Config.Mcd2; label = mcd2Label; }
+
+ path = [NSString stringWithCString:mcd];
+
+ if ([openDlg runModalForDirectory:[path stringByDeletingLastPathComponent] file:@"New Memory Card File.mcr"] == NSOKButton) {
+ strcpy(mcd, (const char *)[[openDlg filename] fileSystemRepresentation]);
+
+ [label setTitleWithMnemonic:[NSString stringWithCString:mcd]];
+
+ if (tag == 1)
+ [[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithCString:mcd] forKey:@"Mcd1"];
+ else
+ [[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithCString:mcd] forKey:@"Mcd2"];
+
+ CreateMcd(mcd);
+ LoadMcds(Config.Mcd1, Config.Mcd2);
+ }
+}
+
- (IBAction)setVideoType:(id)sender
{
int tag = [[sender selectedItem] tag];
-
+
if (3 == tag) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"AutoDetectVideoType"];
} else if (1 == tag || 2 == tag) {
@@ -46,7 +105,7 @@
return;
}
[PcsxController setConfigFromDefaults];
-
+
if ([sender pullsDown]) {
NSArray *items = [sender itemArray];
int i;
@@ -98,6 +157,10 @@
[usesHleCell setEnabled:NO];
}
+ // setup labels
+ [mcd1Label setTitleWithMnemonic:[NSString stringWithCString:Config.Mcd1]];
+ [mcd2Label setTitleWithMnemonic:[NSString stringWithCString:Config.Mcd2]];
+
int tag = [defaults integerForKey:@"AutoDetectVideoType"];
if (tag)
tag = 3;
@@ -136,7 +199,7 @@
if ([object isEqual:sender])
return key;
}
-
+
return nil;
}
diff --git a/macosx/English.lproj/Configuration.nib/classes.nib b/macosx/English.lproj/Configuration.nib/classes.nib
index e7e543b4..1198eea5 100644
--- a/macosx/English.lproj/Configuration.nib/classes.nib
+++ b/macosx/English.lproj/Configuration.nib/classes.nib
@@ -1,7 +1,13 @@
{
IBClasses = (
{
- ACTIONS = {setCheckbox = id; setCheckboxInverse = id; setVideoType = id; };
+ ACTIONS = {
+ mcdChangeClicked = id;
+ mcdNewClicked = id;
+ setCheckbox = id;
+ setCheckboxInverse = id;
+ setVideoType = id;
+ };
CLASS = ConfigurationController;
LANGUAGE = ObjC;
OUTLETS = {
@@ -10,6 +16,8 @@
cdromPlugin = PluginController;
consoleOutputCell = id;
graphicsPlugin = PluginController;
+ mcd1Label = NSTextField;
+ mcd2Label = NSTextField;
noCDAudioCell = id;
noXaAudioCell = id;
padPlugin = PluginController;
diff --git a/macosx/English.lproj/Configuration.nib/info.nib b/macosx/English.lproj/Configuration.nib/info.nib
index 27b3f306..9247f619 100644
--- a/macosx/English.lproj/Configuration.nib/info.nib
+++ b/macosx/English.lproj/Configuration.nib/info.nib
@@ -3,16 +3,20 @@
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
- <string>79 74 486 240 0 0 1024 746 </string>
+ <string>169 48 486 240 0 0 1024 746 </string>
<key>IBFramework Version</key>
- <string>364.0</string>
+ <string>446.1</string>
<key>IBLockedObjects</key>
<array/>
+ <key>IBLockedTabItems</key>
+ <array>
+ <integer>240</integer>
+ </array>
<key>IBOpenObjects</key>
<array>
<integer>21</integer>
</array>
<key>IBSystem Version</key>
- <string>7S215</string>
+ <string>8P2137</string>
</dict>
</plist>
diff --git a/macosx/Pcsx.xcodeproj/project.pbxproj b/macosx/Pcsx.xcodeproj/project.pbxproj
index 5d282123..71dd2a2a 100644
--- a/macosx/Pcsx.xcodeproj/project.pbxproj
+++ b/macosx/Pcsx.xcodeproj/project.pbxproj
@@ -139,7 +139,7 @@
2BA44360052DB2EA00E21DDD /* PcsxPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PcsxPlugin.h; sourceTree = "<group>"; };
2BA44361052DB2EA00E21DDD /* PcsxPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = PcsxPlugin.m; sourceTree = "<group>"; tabWidth = 4; usesTabs = 0; };
2BB3D6CF05427FE200831ACB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
- 2BB3D6D105427FE200831ACB /* PCSX.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PCSX.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 2BB3D6D105427FE200831ACB /* PCSX.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = PCSX.app; sourceTree = BUILT_PRODUCTS_DIR; };
2BBB1126051DC00500B84448 /* PluginList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginList.h; sourceTree = "<group>"; };
2BBB1127051DC00500B84448 /* PluginList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PluginList.m; sourceTree = "<group>"; };
2BBB1787051E0D9700B84448 /* English */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = English; path = Credits.rtf; sourceTree = "<group>"; };
diff --git a/macosx/PcsxController.m b/macosx/PcsxController.m
index f6dbc124..db16729b 100644
--- a/macosx/PcsxController.m
+++ b/macosx/PcsxController.m
@@ -33,9 +33,9 @@ NSString *saveStatePath;
[openDlg setCanChooseFiles:YES];
[openDlg setCanChooseDirectories:NO];
- if ([openDlg runModalForDirectory:nil file:nil] == NSOKButton) {
+ if ([openDlg runModal] == NSOKButton) {
NSArray* files = [openDlg filenames];
- strcpy(cdrfilename, (const char *)[[files objectAtIndex:0] UTF8String]);
+ strcpy(cdrfilename, (const char *)[[files objectAtIndex:0] fileSystemRepresentation]);
}
cdOpenCase = time(NULL) + 2;
@@ -118,7 +118,7 @@ NSString *saveStatePath;
if ([openDlg runModalForDirectory:nil file:nil] == NSOKButton) {
NSArray* files = [openDlg filenames];
- strcpy(cdrfilename, (const char *)[[files objectAtIndex:0] UTF8String]);
+ strcpy(cdrfilename, (const char *)[[files objectAtIndex:0] fileSystemRepresentation]);
[EmuThread run];
}
}
@@ -228,7 +228,6 @@ NSString *saveStatePath;
- (void)dealloc
{
[pluginList release];
-
[super dealloc];
}
@@ -238,7 +237,7 @@ NSString *saveStatePath;
const char *str;
NSString *key;
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-
+
/*
enumerator = [prefStringKeys keyEnumerator];
while ((key = [enumerator nextObject])) {
@@ -246,7 +245,7 @@ NSString *saveStatePath;
char *dst = (char *)[[prefStringKeys objectForKey:key] pointerValue];
if (str != nil && dst != nil) strncpy(dst, str, 255);
}*/
-
+
enumerator = [prefLongKeys keyEnumerator];
while ((key = [enumerator nextObject])) {
long *dst = (long *)[[prefLongKeys objectForKey:key] pointerValue];
@@ -256,7 +255,7 @@ NSString *saveStatePath;
// special cases
//str = [[defaults stringForKey:@"PluginPAD"] fileSystemRepresentation];
//if (str != nil) strncpy(Config.Pad2, str, 255);
-
+
str = [[defaults stringForKey:@"Bios"] fileSystemRepresentation];
if (str) {
NSString *path = [defaults stringForKey:@"Bios"];
@@ -268,12 +267,18 @@ NSString *saveStatePath;
[biosList exchangeObjectAtIndex:index withObjectAtIndex:0];
}
}
-
+
+ str = [[defaults stringForKey:@"Mcd1"] fileSystemRepresentation];
+ if (str) strncpy(Config.Mcd1, str, MAXPATHLEN);
+
+ str = [[defaults stringForKey:@"Mcd2"] fileSystemRepresentation];
+ if (str) strncpy(Config.Mcd2, str, MAXPATHLEN);
+
if ([defaults boolForKey:@"UseHLE"] || 0 == [biosList count]) {
strcpy(Config.Bios, "HLE");
} else {
str = [(NSString *)[biosList objectAtIndex:0] fileSystemRepresentation];
- if (str != nil) strncpy(Config.Bios, str, 255);
+ if (str != nil) strncpy(Config.Bios, str, MAXPATHLEN);
else strcpy(Config.Bios, "HLE");
}
@@ -284,13 +289,13 @@ NSString *saveStatePath;
+ (void)setDefaultFromConfig:(NSString *)defaultKey
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-
+
char *str = (char *)[[prefStringKeys objectForKey:defaultKey] pointerValue];
if (str) {
[defaults setObject:[NSString stringWithCString:str] forKey:defaultKey];
return;
}
-
+
long *val = (long *)[[prefLongKeys objectForKey:defaultKey] pointerValue];
if (val) {
[defaults setInteger:*val forKey:defaultKey];
@@ -312,21 +317,21 @@ NSString *saveStatePath;
NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:
@"Disabled", @"PluginNET",
[NSNumber numberWithInt:0], @"NoDynarec",
- [NSNumber numberWithInt:1], @"AutoDetectVideoType",
-// @"HLE", @"Bios",
+ [NSNumber numberWithInt:1], @"AutoDetectVideoType",
[NSNumber numberWithInt:0], @"UseHLE",
[NSNumber numberWithInt:1], @"CpuBiasShift",
nil];
[defaults registerDefaults:appDefaults];
-
+
prefStringKeys = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSValue valueWithPointer:Config.Gpu], @"PluginGPU",
[NSValue valueWithPointer:Config.Spu], @"PluginSPU",
[NSValue valueWithPointer:Config.Pad1], @"PluginPAD",
[NSValue valueWithPointer:Config.Cdr], @"PluginCDR",
[NSValue valueWithPointer:Config.Net], @"PluginNET",
-// [NSValue valueWithPointer:Config.Bios], @"Bios",
+ [NSValue valueWithPointer:Config.Mcd1], @"Mcd1",
+ [NSValue valueWithPointer:Config.Mcd2], @"Mcd2",
nil];
prefLongKeys = [[NSDictionary alloc] initWithObjectsAndKeys:
@@ -342,40 +347,39 @@ NSString *saveStatePath;
[NSValue valueWithPointer:&Config.RCntFix], @"RootCounterFix",
[NSValue valueWithPointer:&Config.VSyncWA], @"VideoSyncWAFix",
nil];
-
+
// setup application support paths
NSArray *libPaths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
if ([libPaths count] > 0) {
NSString *path;
BOOL dir;
-
+
// create them if needed
NSFileManager *dfm = [NSFileManager defaultManager];
NSString *supportPath = [NSString stringWithFormat:@"%@/Application Support", [libPaths objectAtIndex:0]];
if (![dfm fileExistsAtPath:supportPath isDirectory:&dir])
[dfm createDirectoryAtPath:supportPath attributes:nil];
-
+
path = [NSString stringWithFormat:@"%@/Pcsx", supportPath];
if (![dfm fileExistsAtPath:path isDirectory:&dir])
[dfm createDirectoryAtPath:path attributes:nil];
-
+
path = [NSString stringWithFormat:@"%@/Pcsx/Bios", supportPath];
if (![dfm fileExistsAtPath:path isDirectory:&dir])
[dfm createDirectoryAtPath:path attributes:nil];
-
+
path = [NSString stringWithFormat:@"%@/Pcsx/Memory Cards", supportPath];
if (![dfm fileExistsAtPath:path isDirectory:&dir])
[dfm createDirectoryAtPath:path attributes:nil];
-
+
saveStatePath = [[NSString stringWithFormat:@"%@/Pcsx/Save States", supportPath] retain];
if (![dfm fileExistsAtPath:saveStatePath isDirectory:&dir])
[dfm createDirectoryAtPath:saveStatePath attributes:nil];
-
-
+
path = [NSString stringWithFormat:@"%@/Pcsx/Memory Cards/Mcd001.mcr", supportPath];
str = [path fileSystemRepresentation];
if (str != nil) strncpy(Config.Mcd1, str, 255);
-
+
path = [NSString stringWithFormat:@"%@/Pcsx/Memory Cards/Mcd002.mcr", supportPath];
str = [path fileSystemRepresentation];
if (str != nil) strncpy(Config.Mcd2, str, 255);
@@ -385,7 +389,7 @@ NSString *saveStatePath;
if (str != nil) strncpy(Config.BiosDir, str, 255);
} else {
strcpy(Config.BiosDir, "Bios/");
-
+
saveStatePath = @"sstates";
[saveStatePath retain];
}
@@ -401,19 +405,19 @@ NSString *saveStatePath;
NSArray *bioses = [manager directoryContentsAtPath:[NSString stringWithCString:Config.BiosDir]];
if (bioses) {
int i;
- for (i=0; i<[bioses count]; i++) {
+ for (i = 0; i < [bioses count]; i++) {
NSString *file = [bioses objectAtIndex:i];
NSDictionary *attrib = [manager fileAttributesAtPath:[NSString stringWithFormat:@"%s%@", Config.BiosDir, file] traverseLink:YES];
if ([[attrib fileType] isEqualToString:NSFileTypeRegular]) {
unsigned long long size = [attrib fileSize];
- if (([attrib fileSize] % (256*1024)) == 0 && size > 0) {
+ if (([attrib fileSize] % (256 * 1024)) == 0 && size > 0) {
[biosList addObject:file];
}
}
}
}
-
+
[PcsxController setConfigFromDefaults];
}
diff --git a/macosx/PluginController.m b/macosx/PluginController.m
index 1b4d1e79..007e6194 100644
--- a/macosx/PluginController.m
+++ b/macosx/PluginController.m
@@ -47,20 +47,20 @@
{
NSString *sel;
int i;
-
+
// remember the list
pluginType = type;
plugins = [list retain];
defaultKey = [[PcsxPlugin getDefaultKeyForType:pluginType] retain];
-
+
// clear the previous menu items
[pluginMenu removeAllItems];
-
+
// load the currently selected plugin
sel = [[NSUserDefaults standardUserDefaults] stringForKey:defaultKey];
-
+
// add the menu entries
- for (i=0; i<[plugins count]; i++) {
+ for (i = 0; i < [plugins count]; i++) {
[pluginMenu addItemWithTitle:[[plugins objectAtIndex:i] description]];
// make sure the currently selected is set as such
@@ -68,7 +68,7 @@
[pluginMenu selectItemAtIndex:i];
}
}
-
+
[self selectPlugin:pluginMenu];
}
diff --git a/macosx/main.m b/macosx/main.m
index d6d8267c..22efb1fc 100644
--- a/macosx/main.m
+++ b/macosx/main.m
@@ -105,13 +105,13 @@ void SysMessage(char *fmt, ...)
{
va_list list;
char msg[512];
-
+
NSString *locFmtString = NSLocalizedString([NSString stringWithCString:fmt], nil);
-
+
va_start(list, fmt);
vsprintf(msg, [locFmtString lossyCString], list);
va_end(list);
-
+
NSRunAlertPanel(NSLocalizedString(@"Error!", nil),
[NSString stringWithCString:msg],
nil, nil, nil);
@@ -119,10 +119,10 @@ void SysMessage(char *fmt, ...)
#if 1
void *SysLoadLibrary(char *lib) {
- NSBundle *bundle = [NSBundle bundleWithPath:[NSString stringWithCString:lib]];
- if (bundle != nil) {
- return dlopen([[bundle executablePath] fileSystemRepresentation], RTLD_LAZY /*RTLD_NOW*/);
- }
+ NSBundle *bundle = [NSBundle bundleWithPath:[NSString stringWithCString:lib]];
+ if (bundle != nil) {
+ return dlopen([[bundle executablePath] fileSystemRepresentation], RTLD_LAZY /*RTLD_NOW*/);
+ }
return dlopen(lib, RTLD_LAZY);
}