From c6c9d266fad98310bb6f0118362d8dc7e60ecfae Mon Sep 17 00:00:00 2001 From: "SND\\MaddTheSane_cp" Date: Tue, 9 Jul 2013 09:33:55 +0000 Subject: Make the bladesio1 driver work on OS X: Fix a bug where the wrong plug-in was being used in place of sio1, causing PCSXR to complain. Fix a bug where bladesio1's config window would cause PCSXR to crash. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@85936 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- macosx/Plugin.c | 26 ++- macosx/PluginList.m | 4 +- .../English.lproj/Bladesio1PluginConfig.xib | 176 ++++++++++----------- .../Bladesio1/macsrc/PluginConfigController.m | 17 +- 4 files changed, 126 insertions(+), 97 deletions(-) diff --git a/macosx/Plugin.c b/macosx/Plugin.c index bbfec3c8..e501a5f5 100755 --- a/macosx/Plugin.c +++ b/macosx/Plugin.c @@ -42,6 +42,13 @@ void gpuShowPic() { } void PADhandleKey(int key) { + //TODO: get these set up properly! + GPU_keypressed(key); +#ifdef ENABLE_SIO1API + SIO1_keypressed(key); +#endif + if (Config.UseNet) NET_keypressed(key); + } long PAD1__open(void) { @@ -52,8 +59,6 @@ long PAD2__open(void) { return PAD2_open(&gpuDisp); } -void OnFile_Exit(); - void SignalExit(int sig) { ClosePlugins(); OnFile_Exit(); @@ -88,6 +93,11 @@ int _OpenPlugins() { if (ret < 0) { SysMessage("%s", _("Error Opening PAD2 Plugin")); return -1; } PAD2_registerVibration(GPU_visualVibration); PAD2_registerCursor(GPU_cursor); +#ifdef ENABLE_SIO1API + ret = SIO1_open(&gpuDisp); + if (ret < 0) { SysMessage("%s", _("Error opening SIO1 plugin!")); return -1; } + SIO1_registerCallback(SIO1irq); +#endif if (Config.UseNet && !NetOpened) { netInfo info; @@ -174,6 +184,10 @@ void ClosePlugins() { if (ret < 0) { SysMessage("%s", _("Error Closing PAD2 Plugin")); return; } ret = GPU_close(); if (ret < 0) { SysMessage("%s", _("Error Closing GPU Plugin")); return; } +#ifdef ENABLE_SIO1API + ret = SIO1_close(); + if (ret < 0) { SysMessage(_("Error closing SIO1 plugin!")); return; } +#endif if (Config.UseNet) { NET_pause(); @@ -188,6 +202,9 @@ void ResetPlugins() { SPU_shutdown(); PAD1_shutdown(); PAD2_shutdown(); +#ifdef ENABLE_SIO1API + SIO1_shutdown(); +#endif if (Config.UseNet) NET_shutdown(); ret = CDR_init(); @@ -200,6 +217,11 @@ void ResetPlugins() { if (ret < 0) { SysMessage(_("PAD1init error: %d"), ret); return; } ret = PAD2_init(2); if (ret < 0) { SysMessage(_("PAD2init error: %d"), ret); return; } +#ifdef ENABLE_SIO1API + ret = SIO1_init(); + if (ret < 0) { SysMessage(_("SIO1init error: %d!"), ret); return; } +#endif + if (Config.UseNet) { ret = NET_init(); if (ret < 0) { SysMessage(_("NETinit error: %d"), ret); return; } diff --git a/macosx/PluginList.m b/macosx/PluginList.m index 621e7f3c..cd15da58 100755 --- a/macosx/PluginList.m +++ b/macosx/PluginList.m @@ -36,7 +36,7 @@ const static int typeList[] = {PSE_LT_GPU, PSE_LT_SPU, PSE_LT_CDR, PSE_LT_PAD, P NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; pluginList = [[NSMutableArray alloc] initWithCapacity:20]; - activeGpuPlugin = activeSpuPlugin = activeCdrPlugin = activePadPlugin = activeNetPlugin = nil; + activeGpuPlugin = activeSpuPlugin = activeCdrPlugin = activePadPlugin = activeNetPlugin = activeSIO1Plugin = nil; missingPlugins = NO; for (i = 0; i < sizeof(typeList) / sizeof(typeList[0]); i++) { @@ -200,7 +200,7 @@ const static int typeList[] = {PSE_LT_GPU, PSE_LT_SPU, PSE_LT_CDR, PSE_LT_PAD, P case PSE_LT_SPU: return activeSpuPlugin; break; case PSE_LT_PAD: return activePadPlugin; break; case PSE_LT_NET: return activeNetPlugin; break; - case PSE_LT_SIO1: return activeNetPlugin; break; + case PSE_LT_SIO1: return activeSIO1Plugin; break; } return nil; diff --git a/macosx/plugins/Bladesio1/English.lproj/Bladesio1PluginConfig.xib b/macosx/plugins/Bladesio1/English.lproj/Bladesio1PluginConfig.xib index 91239800..2ae3f8cf 100644 --- a/macosx/plugins/Bladesio1/English.lproj/Bladesio1PluginConfig.xib +++ b/macosx/plugins/Bladesio1/English.lproj/Bladesio1PluginConfig.xib @@ -1315,78 +1315,78 @@ - 224 - - + 253 + + - 225 - - + 246 + + - 226 - - + 245 + + - 227 - - + 244 + + - 228 - - + 252 + + - 229 - - + 248 + + - 230 - - + 247 + + - 232 - - + 251 + + - 233 - - + 249 + + - 234 - - + 243 + + - 235 - - + 250 + + - 236 - - + 242 + + - 237 - + 256 + - 238 - + 239 + - 239 - + 233 + @@ -1395,84 +1395,84 @@ - 241 - + 238 + - 242 - - + 236 + + - 243 - - + 234 + + - 244 - - + 228 + + - 245 - - + 227 + + - 247 - - + 235 + + - 250 - - + 230 + + - 251 - - + 229 + + - 252 - - + 237 + + - 253 - - + 232 + + - 254 - - + 226 + + - 255 - - + 241 + + - 256 - + 225 + - 246 - - + 255 + + - 249 - - + 254 + + - 248 - - + 224 + + diff --git a/macosx/plugins/Bladesio1/macsrc/PluginConfigController.m b/macosx/plugins/Bladesio1/macsrc/PluginConfigController.m index dbc85174..b1b4c08e 100755 --- a/macosx/plugins/Bladesio1/macsrc/PluginConfigController.m +++ b/macosx/plugins/Bladesio1/macsrc/PluginConfigController.m @@ -74,12 +74,19 @@ void AboutDlgProc() void ConfDlgProc() { - NSWindow *window; - - if (windowController == nil) { - windowController = [[PluginConfigController alloc] initWithWindowNibName:@"Bladesio1PluginConfig"]; + __block NSWindow *window; + __block PluginConfigController *tmpWindowController = nil; + + //We need this block due to the xib's use of auto layout + dispatch_sync(dispatch_get_main_queue(), ^{ + if (windowController == nil) { + tmpWindowController = [[PluginConfigController alloc] initWithWindowNibName:@"Bladesio1PluginConfig"]; + } + window = [(windowController ? windowController : tmpWindowController) window]; + }); + if (!windowController) { + windowController = tmpWindowController; } - window = [windowController window]; [windowController loadValues]; -- cgit v1.2.3