[Fuse-for-macosx-commits] SF.net SVN: fuse-for-macosx:[736] trunk/fuse
Brought to you by:
fredm
From: <fr...@us...> - 2013-03-31 06:10:12
|
Revision: 736 http://sourceforge.net/p/fuse-for-macosx/code/736 Author: fredm Date: 2013-03-31 06:10:09 +0000 (Sun, 31 Mar 2013) Log Message: ----------- Don't poll for joytick axes that do not exist to avoid going into a loop when exiting the pref pane with non-existent joystick axes selected. Modified Paths: -------------- trunk/fuse/fusepb/content_arrays/HIDJoysticks.h trunk/fuse/fusepb/content_arrays/HIDJoysticks.m trunk/fuse/fusepb/content_arrays/Joysticks.h trunk/fuse/fusepb/content_arrays/Joysticks.m trunk/fuse/ui/cocoa/cocoajoystick.c Modified: trunk/fuse/fusepb/content_arrays/HIDJoysticks.h =================================================================== --- trunk/fuse/fusepb/content_arrays/HIDJoysticks.h 2013-03-24 06:27:29 UTC (rev 735) +++ trunk/fuse/fusepb/content_arrays/HIDJoysticks.h 2013-03-31 06:10:09 UTC (rev 736) @@ -28,8 +28,8 @@ @interface HIDJoystick : NSObject <NSCoding> { - NSString *name; - int type; + NSString *name; + int type; } + (NSArray *)allJoysticks; Modified: trunk/fuse/fusepb/content_arrays/HIDJoysticks.m =================================================================== --- trunk/fuse/fusepb/content_arrays/HIDJoysticks.m 2013-03-24 06:27:29 UTC (rev 735) +++ trunk/fuse/fusepb/content_arrays/HIDJoysticks.m 2013-03-31 06:10:09 UTC (rev 736) @@ -36,23 +36,23 @@ // Predefined global list of joysticks + (NSArray *)allJoysticks { - static NSMutableArray *joysticks; - if (!joysticks) { - size_t i; + static NSMutableArray *joysticks; + if (!joysticks) { + size_t i; - joysticks = [NSMutableArray arrayWithCapacity:joysticks_supported+1]; + joysticks = [NSMutableArray arrayWithCapacity:joysticks_supported+1]; - [joysticks addObject:[HIDJoystick joystickWithName:@"None" andType:0]]; - if( joysticks_supported > 0 ){ - for( i=0; i<joysticks_supported; i++ ) { - [joysticks addObject: - [HIDJoystick joystickWithName:@(SDL_SYS_JoystickName(i)) - andType:i+1] - ]; - } + [joysticks addObject:[HIDJoystick joystickWithName:@"None" andType:0]]; + if( joysticks_supported > 0 ){ + for( i=0; i<joysticks_supported; i++ ) { + [joysticks addObject: + [HIDJoystick joystickWithName:@(SDL_SYS_JoystickName(i)) + andType:i+1] + ]; } } - return joysticks; + } + return joysticks; } // Retrieve joystick with given name from 'allHIDJoysticks' Modified: trunk/fuse/fusepb/content_arrays/Joysticks.h =================================================================== --- trunk/fuse/fusepb/content_arrays/Joysticks.h 2013-03-24 06:27:29 UTC (rev 735) +++ trunk/fuse/fusepb/content_arrays/Joysticks.h 2013-03-31 06:10:09 UTC (rev 736) @@ -28,8 +28,8 @@ @interface Joystick : NSObject <NSCoding> { - NSString *name; - int type; + NSString *name; + int type; } + (NSArray *)allJoysticks; Modified: trunk/fuse/fusepb/content_arrays/Joysticks.m =================================================================== --- trunk/fuse/fusepb/content_arrays/Joysticks.m 2013-03-24 06:27:29 UTC (rev 735) +++ trunk/fuse/fusepb/content_arrays/Joysticks.m 2013-03-31 06:10:09 UTC (rev 736) @@ -35,19 +35,19 @@ // Predefined global list of joysticks + (NSArray *)allJoysticks { - static NSMutableArray *joysticks; - if (!joysticks) { - size_t i; + static NSMutableArray *joysticks; + if (!joysticks) { + size_t i; - joysticks = [NSMutableArray arrayWithCapacity:JOYSTICK_TYPE_COUNT]; + joysticks = [NSMutableArray arrayWithCapacity:JOYSTICK_TYPE_COUNT]; - for( i=0; i<JOYSTICK_TYPE_COUNT; i++ ) { - [joysticks addObject: - [Joystick joystickWithName:@(joystick_name[i]) andType:i] - ]; - } + for( i=0; i<JOYSTICK_TYPE_COUNT; i++ ) { + [joysticks addObject: + [Joystick joystickWithName:@(joystick_name[i]) andType:i] + ]; } - return joysticks; + } + return joysticks; } // Retrieve joystick with given name from 'allJoysticks' Modified: trunk/fuse/ui/cocoa/cocoajoystick.c =================================================================== --- trunk/fuse/ui/cocoa/cocoajoystick.c 2013-03-24 06:27:29 UTC (rev 735) +++ trunk/fuse/ui/cocoa/cocoajoystick.c 2013-03-31 06:10:09 UTC (rev 736) @@ -130,6 +130,11 @@ int buttons, i; input_event_t event; + if( SDL_JoystickNumAxes( joystick_info->joystick ) <= xaxis || + SDL_JoystickNumAxes( joystick_info->joystick ) <= yaxis ) { + return; + } + status = SDL_JoystickGetAxis( joystick_info->joystick, xaxis ); do_axis( which, status, INPUT_JOYSTICK_LEFT, INPUT_JOYSTICK_RIGHT ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |