From 531ad373b2c22e00a341a6635023cf8949571bd5 Mon Sep 17 00:00:00 2001 From: "SND\\MaddTheSane_cp" Date: Thu, 22 Aug 2013 23:53:37 +0000 Subject: Moving most of the OS X preferences to auto layout, and all to 10.7. Changing some lists of independent checkbox buttons to matrices. Fix a discrepancy between SDL versions 1.2 and 2.0 APIs in OS X's input preferences. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@86849 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- .../English.lproj/NetPcsxrHIDInputPluginMain.xib | 1077 +++++++++++++++++--- macosx/plugins/DFInput/macsrc/ControllerList.m | 4 +- macosx/plugins/DFInput/macsrc/PadController.m | 51 +- macosx/plugins/DFInput/macsrc/PadView.m | 9 +- macosx/plugins/DFInput/macsrc/cfg.c | 5 +- 5 files changed, 1014 insertions(+), 132 deletions(-) (limited to 'macosx/plugins/DFInput') diff --git a/macosx/plugins/DFInput/English.lproj/NetPcsxrHIDInputPluginMain.xib b/macosx/plugins/DFInput/English.lproj/NetPcsxrHIDInputPluginMain.xib index ccf49bd8..896c8978 100644 --- a/macosx/plugins/DFInput/English.lproj/NetPcsxrHIDInputPluginMain.xib +++ b/macosx/plugins/DFInput/English.lproj/NetPcsxrHIDInputPluginMain.xib @@ -1,16 +1,17 @@ - 1060 - 11G63 - 2844 - 1138.51 - 569.00 + 1070 + 12E55 + 3084 + 1187.39 + 626.00 com.apple.InterfaceBuilder.CocoaPlugin - 2844 + 3084 + IBNSLayoutConstraint NSButton NSButtonCell NSCustomObject @@ -69,6 +70,7 @@ 274 {{13, 40}, {437, 378}} + pad1 @@ -81,12 +83,14 @@ 274 {417, 332} + NSView NSResponder {{10, 33}, {417, 332}} + Controller 1 @@ -135,55 +139,60 @@ - + - 289 - {{328, 12}, {121, 32}} + 268 + {{390, 13}, {59, 32}} + + _NS:9 YES - - 67239424 + + 67108864 134217728 OK - - -2038284033 - 1 - + _NS:9 + + -2038284288 + 129 DQ 200 25 + NO - + - 289 - {{207, 12}, {121, 32}} + 268 + {{308, 13}, {82, 32}} + + _NS:9 YES - - 67239424 + + 67108864 134217728 Cancel - - -2038284033 - 1 - + _NS:9 + + -2038284288 + 129 - - - + Gw 200 25 + NO {463, 424} + - {{0, 0}, {1440, 878}} + {{0, 0}, {1920, 1058}} {310, 182} {10000000000000, 10000000000000} YES @@ -203,25 +212,27 @@ 256 - {366, 233} + {381, 244} + 1 YES + NO + YES 256 - {366, 17} + {381, 17} + - - + + 256 {{367, 0}, {16, 17}} - - @@ -230,7 +241,7 @@ 100 1000 - 75628096 + 75497536 2048 Key @@ -253,7 +264,7 @@ - 338820672 + 338690112 1024 @@ -272,11 +283,11 @@ button - 239.96499633789062 + 254.96499633789062 46.965000152587891 1000 - 75628096 + 75497536 134219776 Button @@ -284,7 +295,7 @@ - 69336577 + 69206017 134348800 Double-Click to Set @@ -328,7 +339,7 @@ 1 - {{1, 17}, {366, 233}} + {{1, 17}, {381, 244}} @@ -344,9 +355,11 @@ 256 - {{367, 17}, {15, 233}} + {{366, 17}, {16, 244}} + + NO _doScroller: 0.95625001192092896 @@ -357,6 +370,8 @@ {{-100, -100}, {375, 15}} + + NO 1 _doScroller: @@ -368,7 +383,7 @@ - {{1, 0}, {366, 17}} + {{1, 0}, {381, 17}} @@ -376,19 +391,20 @@ 4 - - {{20, 42}, {383, 251}} + {{20, 30}, {383, 262}} - + 133138 - QSAAAEEgAABBgAAAQYAAAA + 0.25 + 4 + 1 @@ -396,14 +412,15 @@ {{301, 297}, {105, 22}} + 2 YES - -2076049856 + -2076180416 132096 - 109199615 + 109199360 1 LucidaGrande @@ -459,6 +476,7 @@ YES 1 + NO @@ -466,9 +484,11 @@ {{265, 302}, {34, 14}} + + {250, 750} YES - 67239424 + 67108864 4325376 Type: @@ -476,16 +496,19 @@ + NO 303 - {{23, 20}, {383, 14}} + {{59, 8}, {304, 14}} + + {250, 750} YES - 67239424 + 67108864 4194304 To reset an entry: Select it and press the delete '←' key @@ -496,6 +519,7 @@ MC4yNQA + NO @@ -503,14 +527,15 @@ {{68, 297}, {195, 22}} + 1 YES - -2076049856 + -2076180416 132096 - 109199615 + 109199360 1 @@ -545,28 +570,33 @@ YES 1 + NO 303 - {{20, 299}, {48, 19}} + {{17, 302}, {49, 14}} + + {250, 750} YES - 67239424 + 67108864 4325376 - RGV2aWNlOgo + Device: + NO {423, 336} + NetPcsxrHIDInputPluginPadView NSView @@ -609,17 +639,17 @@ ok: - + - 74 + 260 cancel: - + - 187 + 265 @@ -717,9 +747,137 @@ 6 + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 5 + 0 + + 6 + 1 + + 12 + + 1000 + + 6 + 24 + 3 + + + + 4 + 0 + + 4 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 4 + 0 + + 4 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 4 + 0 + + 4 + 1 + + 50 + + 1000 + + 3 + 9 + 3 + + + + 5 + 0 + + 5 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 3 + 0 + + 3 + 1 + + 12 + + 1000 + + 8 + 29 + 3 + + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + - - + + @@ -745,6 +903,70 @@ + + + 5 + 0 + + 5 + 1 + + 0.0 + + 1000 + + 3 + 9 + 3 + + + + 4 + 0 + + 4 + 1 + + 0.0 + + 1000 + + 3 + 9 + 3 + + + + 3 + 0 + + 3 + 1 + + 0.0 + + 1000 + + 3 + 9 + 3 + + + + 9 + 0 + + 9 + 1 + + 0.0 + + 1000 + + 5 + 22 + 2 + @@ -766,6 +988,70 @@ + + + 3 + 0 + + 3 + 1 + + 0.0 + + 1000 + + 3 + 9 + 3 + + + + 5 + 0 + + 5 + 1 + + 0.0 + + 1000 + + 3 + 9 + 3 + + + + 9 + 0 + + 9 + 1 + + 0.0 + + 1000 + + 5 + 22 + 2 + + + + 4 + 0 + + 4 + 1 + + 0.0 + + 1000 + + 3 + 9 + 3 + @@ -774,42 +1060,256 @@ - - 27 - - - - - - - - 202 - - - - - 186 - - - - - - - - 203 - - - 16 - - + + + 3 + 0 + + 4 + 1 + + 8 + + 1000 + + 6 + 24 + 3 + + + + 4 + 0 + + 4 + 1 + + 8 + + 1000 + + 3 + 9 + 3 + + + + 9 + 0 + + 9 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 5 + 0 + + 6 + 1 + + 8 + + 1000 + + 6 + 24 + 3 + + + + 3 + 0 + + 3 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 5 + 0 + + 6 + 1 + + 8 + + 1000 + + 6 + 24 + 3 + + + + 11 + 0 + + 11 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 5 + 0 + + 6 + 1 + + 8 + + 1000 + + 6 + 24 + 3 + + + + 11 + 0 + + 11 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 3 + 0 + + 4 + 1 + + 8 + + 1000 + + 6 + 24 + 3 + + + + 5 + 0 + + 5 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 3 + 0 + + 3 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 5 + 0 + + 5 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + Controller View @@ -880,6 +1380,22 @@ + + + 7 + 0 + + 0 + 1 + + 99 + + 1000 + + 3 + 9 + 1 + @@ -915,6 +1431,22 @@ + + + 7 + 0 + + 0 + 1 + + 28 + + 1000 + + 3 + 9 + 1 + @@ -928,6 +1460,22 @@ + + + 7 + 0 + + 0 + 1 + + 298 + + 1000 + + 3 + 9 + 1 + @@ -970,6 +1518,22 @@ + + + 7 + 0 + + 0 + 1 + + 43 + + 1000 + + 3 + 9 + 1 + @@ -978,36 +1542,278 @@ + + 216 + + + + + 217 + + + + + 218 + + + + + 219 + + + + + 220 + + + + + 223 + + + + + 225 + + + + + 228 + + + + + 229 + + + + + 230 + + + + + 231 + + + + + 236 + + + + + 238 + + + + + 240 + + + + + 243 + + + + + 244 + + + + + 246 + + + + + 247 + + + + + 248 + + + + + 250 + + + + + 252 + + + + + 256 + + + + + + + + 257 + + + + + 259 + + + + + 261 + + + + + + + + 262 + + + + + 263 + + + + + 264 + + + + + 267 + + + + + 273 + + + + + 274 + + + + + 275 + + + + + 276 + + + + + 277 + + + + + 279 + + + + + 282 + + + + + 284 + + + + + 290 + + + + + 291 + + + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + + + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + + + + + + + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin NetPcsxrHIDInputPluginMappingCell com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + + + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1017,9 +1823,65 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + + + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1028,32 +1890,16 @@ - 213 + 291 - NetPcsxrHIDInputPluginMappingCell - NSTextFieldCell - - IBProjectSource - ./Classes/NetPcsxrHIDInputPluginMappingCell.h - - - - NetPcsxrHIDInputPluginPadController - NSWindowController - - IBProjectSource - ./Classes/NetPcsxrHIDInputPluginPadController.h - - - - NetPcsxrHIDInputPluginPadView - NSView + NSLayoutConstraint + NSObject IBProjectSource - ./Classes/NetPcsxrHIDInputPluginPadView.h + ./Classes/NSLayoutConstraint.h @@ -1062,7 +1908,7 @@ IBCocoaFramework com.apple.InterfaceBuilder.CocoaPlugin.macosx - + YES 3 @@ -1070,5 +1916,6 @@ {11, 11} {10, 3} + YES diff --git a/macosx/plugins/DFInput/macsrc/ControllerList.m b/macosx/plugins/DFInput/macsrc/ControllerList.m index a1d4deed..41b38e2f 100755 --- a/macosx/plugins/DFInput/macsrc/ControllerList.m +++ b/macosx/plugins/DFInput/macsrc/ControllerList.m @@ -29,7 +29,9 @@ static int currentController; - (id)initWithConfig { - if (!(self = [super init])) return nil; + if (self = [super init]) { + + } return self; } diff --git a/macosx/plugins/DFInput/macsrc/PadController.m b/macosx/plugins/DFInput/macsrc/PadController.m index e3942158..1a4997c6 100755 --- a/macosx/plugins/DFInput/macsrc/PadController.m +++ b/macosx/plugins/DFInput/macsrc/PadController.m @@ -24,12 +24,22 @@ #include "pad.h" #import "ARCBridge.h" +static inline void RunOnMainThreadSync(dispatch_block_t block) +{ + if ([NSThread isMainThread]) { + block(); + } else { + dispatch_sync(dispatch_get_main_queue(), block); + } +} + static NSWindow *padWindow = nil; static PadController *padController = nil; #define APP_ID @"net.pcsxr.DFInputPlugin" -void DoAbout() { +void DoAbout() +{ // Get parent application instance NSApplication *app = [NSApplication sharedApplication]; NSBundle *bundle = [NSBundle bundleWithIdentifier:APP_ID]; @@ -65,19 +75,26 @@ void DoAbout() { RELEASEOBJ(infoPaneDict); } -long DoConfiguration() { - SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_NOPARACHUTE); - LoadPADConfig(); - - if (padWindow == nil) { - if (padController == nil) { - padController = [[PadController alloc] initWithWindowNibName:@"NetPcsxrHIDInputPluginMain"]; +long DoConfiguration() +{ + RunOnMainThreadSync(^{ +#if SDL_VERSION_ATLEAST(2, 0, 0) + SDL_InitSubSystem(SDL_INIT_JOYSTICK); +#else + SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_NOPARACHUTE); +#endif + LoadPADConfig(); + + if (padWindow == nil) { + if (padController == nil) { + padController = [[PadController alloc] initWithWindowNibName:@"NetPcsxrHIDInputPluginMain"]; + } + padWindow = [padController window]; } - padWindow = [padController window]; - } - - [padWindow center]; - [padWindow makeKeyAndOrderFront:nil]; + + [padWindow center]; + [padWindow makeKeyAndOrderFront:nil]; + }); return 0; } @@ -86,14 +103,22 @@ long DoConfiguration() { - (IBAction)cancel:(id)sender { +#if SDL_VERSION_ATLEAST(2, 0, 0) + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); +#else SDL_Quit(); +#endif [self close]; } - (IBAction)ok:(id)sender { SavePADConfig(); +#if SDL_VERSION_ATLEAST(2, 0, 0) + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); +#else SDL_Quit(); +#endif [self close]; } diff --git a/macosx/plugins/DFInput/macsrc/PadView.m b/macosx/plugins/DFInput/macsrc/PadView.m index e883a84f..f0fb801e 100755 --- a/macosx/plugins/DFInput/macsrc/PadView.m +++ b/macosx/plugins/DFInput/macsrc/PadView.m @@ -70,7 +70,14 @@ [deviceMenu addItemWithTitle:@"(Keyboard only)"]; for (i = 0; i < SDL_NumJoysticks(); i++) { - NSMenuItem * joystickItem = [[NSMenuItem alloc] initWithTitle:@(SDL_JoystickName(i)) action:NULL keyEquivalent:@""]; + NSMenuItem *joystickItem = nil; +#if SDL_VERSION_ATLEAST(2, 0, 0) + SDL_Joystick *tmpJoy = SDL_JoystickOpen(i); + joystickItem = [[NSMenuItem alloc] initWithTitle:@(SDL_JoystickName(tmpJoy)) action:NULL keyEquivalent:@""]; + SDL_JoystickClose(tmpJoy); +#else + joystickItem = [[NSMenuItem alloc] initWithTitle:@(SDL_JoystickName(i)) action:NULL keyEquivalent:@""]; +#endif [joystickItem setTag:i + 1]; [[deviceMenu menu] addItem:joystickItem]; RELEASEOBJ(joystickItem); diff --git a/macosx/plugins/DFInput/macsrc/cfg.c b/macosx/plugins/DFInput/macsrc/cfg.c index 33013c44..b9d1e7c6 100755 --- a/macosx/plugins/DFInput/macsrc/cfg.c +++ b/macosx/plugins/DFInput/macsrc/cfg.c @@ -17,6 +17,7 @@ */ #include "pad.h" +#include GLOBALDATA g; @@ -114,7 +115,7 @@ static void SetDefaultConfig() { void LoadPADConfig() { FILE *fp; - char buf[256]; + char buf[PATH_MAX]; int current, a, b, c; SetDefaultConfig(); @@ -276,7 +277,7 @@ void LoadPADConfig() { void SavePADConfig() { FILE *fp; int i; - char buf[256]; + char buf[PATH_MAX]; sprintf(buf, "%s/Library/Preferences/net.pcsxr.DFInput.plist", getenv("HOME")); -- cgit v1.2.3