summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-01-10 01:02:14 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-01-10 01:02:14 +0000
commitf9cb1c85ed195c205d7bb48b69c83a7838cb9aa2 (patch)
tree0bc1e43f33158709d33c43b061f96145a98ad685
parent564758db27f02a09c61a1ac068a2fa22c887a0dd (diff)
downloadpcsxr-f9cb1c85ed195c205d7bb48b69c83a7838cb9aa2.tar.gz
Messing with the OS X plug-in code:
Making it so that absolute paths are properly handled on plug-ins. Put the absolute path if we load a plug-in from somewhere else than the App's built-in location. Have path in PcsxrPlugin be an Objective C property. Also making the name a new Objective C property. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@82165 e17a0e51-4ae3-4d35-97c3-1a29b211df97
-rwxr-xr-xmacosx/ConfigurationController.m2
-rwxr-xr-xmacosx/PcsxrPlugin.h4
-rwxr-xr-xmacosx/PcsxrPlugin.m50
-rwxr-xr-xmacosx/PluginList.m114
-rw-r--r--macosx/plugins/DFCdrom/DFCdrom.xcodeproj/project.pbxproj2
-rw-r--r--macosx/plugins/DFInput/DFInput.xcodeproj/project.pbxproj2
-rw-r--r--macosx/plugins/DFSound/PeopsSPU.xcodeproj/project.pbxproj2
-rw-r--r--macosx/plugins/DFXVideo/PeopsSoftGPU.xcodeproj/project.pbxproj2
-rw-r--r--macosx/plugins/PeopsXgl/PeopsXGL.xcodeproj/project.pbxproj2
9 files changed, 65 insertions, 115 deletions
diff --git a/macosx/ConfigurationController.m b/macosx/ConfigurationController.m
index 80c23c38..35c812b5 100755
--- a/macosx/ConfigurationController.m
+++ b/macosx/ConfigurationController.m
@@ -230,7 +230,7 @@ NSString *memChangeNotifier = @"PcsxrMemoryCardDidChangeNotifier";
- (NSString *)keyForSender:(id)sender
{
- NSEnumerator *enumerator= [checkBoxDefaults keyEnumerator];
+ NSEnumerator *enumerator = [checkBoxDefaults keyEnumerator];
id key;
while ((key = [enumerator nextObject])) {
id object = [checkBoxDefaults objectForKey:key];
diff --git a/macosx/PcsxrPlugin.h b/macosx/PcsxrPlugin.h
index dd5347e6..bd70854a 100755
--- a/macosx/PcsxrPlugin.h
+++ b/macosx/PcsxrPlugin.h
@@ -21,6 +21,9 @@
int active;
}
+@property (readonly) NSString *path;
+@property (readonly) NSString *name;
+
+ (NSString *)prefixForType:(int)type;
+ (NSString *)defaultKeyForType:(int)type;
+ (char **)configEntriesForType:(int)type;
@@ -30,7 +33,6 @@
- (NSString *)displayVersion;
- (int)type;
-- (NSString *)path;
- (NSUInteger)hash;
- (NSString *)description;
- (BOOL)hasAboutAs:(int)type;
diff --git a/macosx/PcsxrPlugin.m b/macosx/PcsxrPlugin.m
index b7ecd5d6..97e3fbc6 100755
--- a/macosx/PcsxrPlugin.m
+++ b/macosx/PcsxrPlugin.m
@@ -93,6 +93,9 @@
return returnArray;
}
+@synthesize path;
+@synthesize name;
+
- (id)initWithPath:(NSString *)aPath
{
if (!(self = [super init])) {
@@ -103,28 +106,38 @@
PSEgetLibVersion PSE_getLibVersion = NULL;
PSEgetLibName PSE_getLibName = NULL;
+ NSFileManager *fm = [NSFileManager defaultManager];
+
pluginRef = nil;
name = nil;
path = [aPath copy];
- long tempVers = 0;
NSString *goodPath = nil;
- for (NSString *plugDir in [PcsxrPlugin pluginsPaths])
- {
- NSString *fullPath = [plugDir stringByAppendingPathComponent:path];
- if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]) {
- void *tempHandle = SysLoadLibrary([fullPath fileSystemRepresentation]);
- if (tempHandle != NULL)
- {
- PSEgetLibVersion tempLibVersion = SysLoadSym(tempHandle, "PSEgetLibVersion");
- if (SysLibError() == NULL)
+ if ([aPath isAbsolutePath]) {
+ goodPath = aPath;
+ } else {
+ long tempVers = 0;
+ for (NSString *plugDir in [PcsxrPlugin pluginsPaths])
+ {
+ NSString *fullPath = [plugDir stringByAppendingPathComponent:path];
+ if ([fm fileExistsAtPath:fullPath]) {
+ void *tempHandle = SysLoadLibrary([fullPath fileSystemRepresentation]);
+ if (tempHandle != NULL)
{
- long tempVers2 = tempLibVersion();
- if (tempVers <= tempVers2 ){
- goodPath = fullPath;
- tempVers = tempVers2;
+ PSEgetLibVersion tempLibVersion = SysLoadSym(tempHandle, "PSEgetLibVersion");
+ if (SysLibError() == NULL)
+ {
+ long tempVers2 = tempLibVersion();
+ if (tempVers <= tempVers2 ){
+ goodPath = fullPath;
+ tempVers = tempVers2;
+ if (![plugDir isEqualToString:[fm stringWithFileSystemRepresentation:Config.PluginsDir length:strlen(Config.PluginsDir)]]) {
+ RELEASEOBJ(path);
+ path = [goodPath copy];
+ }
+ }
}
+ SysCloseLibrary(tempHandle);
}
- SysCloseLibrary(tempHandle);
}
}
}
@@ -135,7 +148,7 @@
}
pluginRef = SysLoadLibrary([goodPath fileSystemRepresentation]);
- if (pluginRef == nil) {
+ if (pluginRef == NULL) {
RELEASEOBJ(self);
return nil;
}
@@ -336,11 +349,6 @@
return type;
}
-- (NSString *)path
-{
- return path;
-}
-
- (NSUInteger)hash
{
return [path hash];
diff --git a/macosx/PluginList.m b/macosx/PluginList.m
index 09469322..12c1054b 100755
--- a/macosx/PluginList.m
+++ b/macosx/PluginList.m
@@ -248,11 +248,11 @@ const static int typeList[5] = {PSE_LT_GPU, PSE_LT_SPU, PSE_LT_CDR, PSE_LT_PAD,
- (PcsxrPlugin *)activePluginForType:(int)type
{
switch (type) {
- case PSE_LT_GPU: return activeGpuPlugin;
- case PSE_LT_CDR: return activeCdrPlugin;
- case PSE_LT_SPU: return activeSpuPlugin;
- case PSE_LT_PAD: return activePadPlugin;
- case PSE_LT_NET: return activeNetPlugin;
+ case PSE_LT_GPU: return activeGpuPlugin; break;
+ case PSE_LT_CDR: return activeCdrPlugin; break;
+ case PSE_LT_SPU: return activeSpuPlugin; break;
+ case PSE_LT_PAD: return activePadPlugin; break;
+ case PSE_LT_NET: return activeNetPlugin; break;
}
return nil;
@@ -260,24 +260,20 @@ const static int typeList[5] = {PSE_LT_GPU, PSE_LT_SPU, PSE_LT_CDR, PSE_LT_PAD,
- (BOOL)setActivePlugin:(PcsxrPlugin *)plugin forType:(int)type
{
-#if 1
-
- PcsxrPlugin *toCopy = plugin;
PcsxrPlugin *pluginPtr = nil;
switch (type) {
- case PSE_LT_GPU: pluginPtr = activeGpuPlugin; break;
- case PSE_LT_CDR: pluginPtr = activeCdrPlugin; break;
- case PSE_LT_SPU: pluginPtr = activeSpuPlugin; break;
- case PSE_LT_PAD: pluginPtr = activePadPlugin; break;
- case PSE_LT_NET: pluginPtr = activeNetPlugin; break;
- default: return NO;
+ case PSE_LT_GPU:
+ case PSE_LT_CDR:
+ case PSE_LT_SPU:
+ case PSE_LT_PAD:
+ case PSE_LT_NET: pluginPtr = [self activePluginForType:type]; break;
+ default: return NO; break;
}
- if (toCopy == pluginPtr) {
+ if (plugin == pluginPtr) {
return YES;
}
-
BOOL active = pluginPtr && [EmuThread active];
BOOL wasPaused = NO;
if (active) {
@@ -293,31 +289,30 @@ const static int typeList[5] = {PSE_LT_GPU, PSE_LT_SPU, PSE_LT_CDR, PSE_LT_PAD,
RELEASEOBJ(pluginPtr);
}
- if ([toCopy runAs:type] != 0) {
- toCopy = nil;
+ if ([plugin runAs:type] != 0) {
+ plugin = nil;
}
switch (type) {
case PSE_LT_GPU:
- activeGpuPlugin = RETAINOBJ(toCopy);
+ activeGpuPlugin = RETAINOBJ(plugin);
break;
case PSE_LT_CDR:
- activeCdrPlugin = RETAINOBJ(toCopy);
+ activeCdrPlugin = RETAINOBJ(plugin);
break;
case PSE_LT_SPU:
- activeSpuPlugin = RETAINOBJ(toCopy);
+ activeSpuPlugin = RETAINOBJ(plugin);
break;
case PSE_LT_PAD:
- activePadPlugin = RETAINOBJ(toCopy);
+ activePadPlugin = RETAINOBJ(plugin);
break;
case PSE_LT_NET:
- activeNetPlugin = RETAINOBJ(toCopy);
+ activeNetPlugin = RETAINOBJ(plugin);
break;
}
-
// write path to the correct config entry
const char *str;
- if (toCopy != nil) {
+ if (plugin != nil) {
str = [[plugin path] fileSystemRepresentation];
if (str == nil) {
str = "Invalid Plugin";
@@ -328,7 +323,7 @@ const static int typeList[5] = {PSE_LT_GPU, PSE_LT_SPU, PSE_LT_CDR, PSE_LT_PAD,
char **dst = [PcsxrPlugin configEntriesForType:type];
while (*dst) {
- strncpy(*dst, str, MAXPATHLEN);
+ strlcpy(*dst, str, MAXPATHLEN);
dst++;
}
@@ -341,72 +336,7 @@ const static int typeList[5] = {PSE_LT_GPU, PSE_LT_SPU, PSE_LT_CDR, PSE_LT_PAD,
}
}
- return toCopy != nil;
-#else
- PcsxrPlugin *__strong*pluginPtr;
- switch (type) {
- case PSE_LT_GPU: pluginPtr = &activeGpuPlugin; break;
- case PSE_LT_CDR: pluginPtr = &activeCdrPlugin; break;
- case PSE_LT_SPU: pluginPtr = &activeSpuPlugin; break;
- case PSE_LT_PAD: pluginPtr = &activePadPlugin; break;
- case PSE_LT_NET: pluginPtr = &activeNetPlugin; break;
- default: return NO;
- }
-
- if (plugin == *pluginPtr)
- return YES;
-
- BOOL active = (*pluginPtr) && [EmuThread active];
- BOOL wasPaused = NO;
- if (active) {
- // TODO: temporary freeze?
- wasPaused = [EmuThread pauseSafe];
- ClosePlugins();
- ReleasePlugins();
- }
-
- // stop the old plugin and start the new one
- if (*pluginPtr) {
- [*pluginPtr shutdownAs:type];
- RELEASEOBJ(*pluginPtr);
- }
- *pluginPtr = RETAINOBJ(plugin);
- if (*pluginPtr) {
- if ([*pluginPtr runAs:type] != 0) {
- RELEASEOBJ(*pluginPtr);
- *pluginPtr = nil;
- }
- }
-
- // write path to the correct config entry
- const char *str;
- if (*pluginPtr != nil) {
- str = [[plugin path] fileSystemRepresentation];
- if (str == nil) {
- str = "Invalid Plugin";
- }
- } else {
- str = "Invalid Plugin";
- }
-
- char **dst = [PcsxrPlugin configEntriesForType:type];
- while (*dst) {
- strncpy(*dst, str, MAXPATHLEN);
- dst++;
- }
-
- if (active) {
- LoadPlugins();
- OpenPlugins();
-
- if (!wasPaused) {
- [EmuThread resume];
- }
- }
-
- return *pluginPtr != nil;
-
-#endif
+ return plugin != nil;
}
@end
diff --git a/macosx/plugins/DFCdrom/DFCdrom.xcodeproj/project.pbxproj b/macosx/plugins/DFCdrom/DFCdrom.xcodeproj/project.pbxproj
index 52bd3089..21052772 100644
--- a/macosx/plugins/DFCdrom/DFCdrom.xcodeproj/project.pbxproj
+++ b/macosx/plugins/DFCdrom/DFCdrom.xcodeproj/project.pbxproj
@@ -322,6 +322,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = "_MACOSX=1";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
@@ -343,6 +344,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PREPROCESSOR_DEFINITIONS = "_MACOSX=1";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
diff --git a/macosx/plugins/DFInput/DFInput.xcodeproj/project.pbxproj b/macosx/plugins/DFInput/DFInput.xcodeproj/project.pbxproj
index 1485ebc5..c37f341c 100644
--- a/macosx/plugins/DFInput/DFInput.xcodeproj/project.pbxproj
+++ b/macosx/plugins/DFInput/DFInput.xcodeproj/project.pbxproj
@@ -583,6 +583,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = "_MACOSX=1";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
@@ -608,6 +609,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PREPROCESSOR_DEFINITIONS = "_MACOSX=1";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
diff --git a/macosx/plugins/DFSound/PeopsSPU.xcodeproj/project.pbxproj b/macosx/plugins/DFSound/PeopsSPU.xcodeproj/project.pbxproj
index 42510b41..924448ef 100644
--- a/macosx/plugins/DFSound/PeopsSPU.xcodeproj/project.pbxproj
+++ b/macosx/plugins/DFSound/PeopsSPU.xcodeproj/project.pbxproj
@@ -728,6 +728,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_OPTIMIZATION_LEVEL = 0;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
MACOSX_DEPLOYMENT_TARGET = 10.6;
@@ -742,6 +743,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
MACOSX_DEPLOYMENT_TARGET = 10.6;
diff --git a/macosx/plugins/DFXVideo/PeopsSoftGPU.xcodeproj/project.pbxproj b/macosx/plugins/DFXVideo/PeopsSoftGPU.xcodeproj/project.pbxproj
index 3bf9a847..ef3974da 100644
--- a/macosx/plugins/DFXVideo/PeopsSoftGPU.xcodeproj/project.pbxproj
+++ b/macosx/plugins/DFXVideo/PeopsSoftGPU.xcodeproj/project.pbxproj
@@ -366,6 +366,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_OPTIMIZATION_LEVEL = 0;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
HEADER_SEARCH_PATHS = (
@@ -384,6 +385,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
HEADER_SEARCH_PATHS = (
diff --git a/macosx/plugins/PeopsXgl/PeopsXGL.xcodeproj/project.pbxproj b/macosx/plugins/PeopsXgl/PeopsXGL.xcodeproj/project.pbxproj
index f62dff18..308652eb 100644
--- a/macosx/plugins/PeopsXgl/PeopsXGL.xcodeproj/project.pbxproj
+++ b/macosx/plugins/PeopsXgl/PeopsXGL.xcodeproj/project.pbxproj
@@ -369,6 +369,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_OPTIMIZATION_LEVEL = 0;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_POINTER_SIGNEDNESS = NO;
@@ -389,6 +390,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_ENABLE_SSE3_EXTENSIONS = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_OPTIMIZATION_LEVEL = 3;