Skip to content

Commit

Permalink
Merge pull request #2 from marnovo/development
Browse files Browse the repository at this point in the history
v1.2.1
  • Loading branch information
marnovo authored Oct 28, 2017
2 parents 0de9335 + dbd0234 commit 37f84bf
Show file tree
Hide file tree
Showing 12 changed files with 709 additions and 4,050 deletions.
2 changes: 1 addition & 1 deletion Categories/NSRunningApplication+NJPossibleNames.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@implementation NSRunningApplication (NJPossibleNames)

- (NSArray *)windowTitles {
static CGWindowListOption s_OPTIONS = (kCGWindowListOptionOnScreenOnly
static CGWindowListOption s_OPTIONS = (CGWindowListOption)(kCGWindowListOptionOnScreenOnly
| kCGWindowListExcludeDesktopElements);
NSMutableArray *titles = [[NSMutableArray alloc] initWithCapacity:4];
NSArray *windows = CFBridgingRelease(CGWindowListCopyWindowInfo(s_OPTIONS, kCGNullWindowID));
Expand Down
7 changes: 5 additions & 2 deletions Classes/EnjoyableApplicationDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification {
[self transformIntoElement:nil];
else
[self.window makeKeyAndOrderFront:nil];
// Auto activate mapping? YES / NO
// self.ic.simulatingEvents = YES;
}

- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication
Expand Down Expand Up @@ -252,12 +254,13 @@ - (void)mappingConflictDidResolve:(NSAlert *)alert
NJMapping *newMapping = userInfo[@"new mapping"];
NSInteger idx = [userInfo[@"index"] intValue];
[alert.window orderOut:nil];

switch (returnCode) {
case NSAlertFirstButtonReturn: // Merge
case 1000: // case NSAlertFirstButtonReturn -> Merge
[self.ic mergeMapping:newMapping intoMapping:oldMapping];
[self.ic activateMapping:oldMapping];
break;
case NSAlertThirdButtonReturn: // New Mapping
case 1002: // case NSAlertFirstButtonReturn -> New Mapping
[self.mvc beginUpdates];
[self.ic addMapping:newMapping];
[self.mvc addedMappingAtIndex:idx startEditing:YES];
Expand Down
7 changes: 5 additions & 2 deletions Classes/NJInputAnalog.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ - (id)findSubInputForValue:(IOHIDValueRef)value {

- (void)notifyEvent:(IOHIDValueRef)value {
float magnitude = self.magnitude = normalize(IOHIDValueGetIntegerValue(value), _rawMin, _rawMax);
if (magnitude > -DEAD_ZONE && magnitude < DEAD_ZONE) {
magnitude = 0;
}
[self.children[0] setMagnitude:fabsf(MIN(magnitude, 0))];
[self.children[1] setMagnitude:fabsf(MAX(magnitude, 0))];
[self.children[0] setActive:magnitude < -DEAD_ZONE];
[self.children[1] setActive:magnitude > DEAD_ZONE];
[self.children[0] setActive:YES];
[self.children[1] setActive:YES];
}

@end
2 changes: 1 addition & 1 deletion Classes/NJInputController.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ - (void)runOutputForValue:(IOHIDValueRef)value {
NJOutput *output = self.currentMapping[subInput];
output.magnitude = subInput.magnitude;
output.running = subInput.active;
if ((output.running || output.magnitude) && output.isContinuous)
if ((output.running || output.magnitude != 0) && output.isContinuous)
[self addRunningOutput:output];
}
}
Expand Down
5 changes: 3 additions & 2 deletions Classes/NJKeyInputField.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
#import "NJKeyInputField.h"

#include <Carbon/Carbon.h>
// Only used for kVK_... codes.
// Only used for kVK_... codes.

enum {
kVK_RightCommand = kVK_Command - 1,
// No need to redefine this:
// kVK_RightCommand = kVK_Command - 1,
kVK_Insert = 0x72,
kVK_Power = 0x7f,
kVK_ApplicationMenu = 0x6e,
Expand Down
2 changes: 1 addition & 1 deletion Classes/NJOutputMouseButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ @implementation NJOutputMouseButton {

+ (NSTimeInterval)doubleClickInterval {
static NSTimeInterval s_doubleClickThreshold;
if (!s_doubleClickThreshold) {
if (s_doubleClickThreshold == 0) {
s_doubleClickThreshold = [[NSUserDefaults.standardUserDefaults
objectForKey:@"com.apple.mouse.doubleClickThreshold"] floatValue];
if (s_doubleClickThreshold <= 0)
Expand Down
2 changes: 1 addition & 1 deletion Classes/NJOutputMouseMove.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ + (NJOutput *)outputWithSerialization:(NSDictionary *)serialization {
NJOutputMouseMove *output = [[NJOutputMouseMove alloc] init];
output.axis = [serialization[@"axis"] intValue];
output.speed = [serialization[@"speed"] floatValue];
if (!output.speed)
if (output.speed == 0)
output.speed = 10;
return output;
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/NJOutputViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ - (void)cleanUpInterface {
} else {
if (self.mouseDirSelect.selectedSegment == -1)
self.mouseDirSelect.selectedSegment = 0;
if (!self.mouseSpeedSlider.floatValue)
if (self.mouseSpeedSlider.floatValue == 0)
self.mouseSpeedSlider.floatValue = 10;
}

Expand Down
6 changes: 4 additions & 2 deletions Enjoyable.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/* Begin PBXBuildFile section */
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
93C857021FA515BF000F87D8 /* Help in Resources */ = {isa = PBXBuildFile; fileRef = EEF17D2116E8E24400D7DC4D /* Help */; };
D594BF000FAE7397007A85F2 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D594BEFF0FAE7397007A85F2 /* IOKit.framework */; };
EE1F3CEA16EF4182008C6426 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = EE1F3CE816EF4182008C6426 /* Localizable.strings */; };
EE35A6E417BBCC9500413995 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE35A6E317BBCC9500413995 /* CoreVideo.framework */; };
Expand All @@ -28,7 +29,6 @@
EEF17D1916E8E21A00D7DC4D /* com.yukkurigames.Enjoyable.mapping.icns in Resources */ = {isa = PBXBuildFile; fileRef = EEF17D1716E8E21A00D7DC4D /* com.yukkurigames.Enjoyable.mapping.icns */; };
EEF17D1F16E8E23A00D7DC4D /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = EEF17D1B16E8E23A00D7DC4D /* InfoPlist.strings */; };
EEF17D2016E8E23A00D7DC4D /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = EEF17D1D16E8E23A00D7DC4D /* MainMenu.xib */; };
EEF17D2216E8E24400D7DC4D /* Help in Resources */ = {isa = PBXBuildFile; fileRef = EEF17D2116E8E24400D7DC4D /* Help */; };
EEF17D2616E8E2D800D7DC4D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = EEF17D2416E8E2D800D7DC4D /* main.m */; };
EEF17D3316E8E2E100D7DC4D /* NSError+Description.m in Sources */ = {isa = PBXBuildFile; fileRef = EEF17D2816E8E2E100D7DC4D /* NSError+Description.m */; };
EEF17D3416E8E2E100D7DC4D /* NSFileManager+UniqueNames.m in Sources */ = {isa = PBXBuildFile; fileRef = EEF17D2A16E8E2E100D7DC4D /* NSFileManager+UniqueNames.m */; };
Expand Down Expand Up @@ -410,9 +410,9 @@
EEF17D1916E8E21A00D7DC4D /* com.yukkurigames.Enjoyable.mapping.icns in Resources */,
EEF17D1F16E8E23A00D7DC4D /* InfoPlist.strings in Resources */,
EEF17D2016E8E23A00D7DC4D /* MainMenu.xib in Resources */,
EEF17D2216E8E24400D7DC4D /* Help in Resources */,
EE6A122E16E8F46300EDBD32 /* Icon.icns in Resources */,
EE3D897A16EA7EFC00596D1F /* Status Menu [email protected] in Resources */,
93C857021FA515BF000F87D8 /* Help in Resources */,
EE3D897C16EA806E00596D1F /* Status Menu Icon [email protected] in Resources */,
EE3D897F16EA817E00596D1F /* Status Menu Icon Disabled.png in Resources */,
EE3D898016EA817E00596D1F /* Status Menu Icon.png in Resources */,
Expand Down Expand Up @@ -644,6 +644,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
FOLDINGINTEGERCONSTANT = YES;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
Expand All @@ -664,6 +665,7 @@
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
NEW_SETTING = "";
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = macosx;
VALID_ARCHS = x86_64;
Expand Down
6 changes: 3 additions & 3 deletions Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<string>1.2.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>649</string>
<string>663</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright Joe Wreschnig, Sam McCall, Yifeng Huang</string>
<string>Copyright Joe Wreschnig, Sam McCall, Yifeng Huang, Marcelo Novaes</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
Expand Down
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
Enjoyable is an application for Mac OS X which allows you to use
controller inputs like a mouse or keyboard.
# Enjoyable - macOS controller mapping tool

Enjoyable is an application for macOS (formerly Mac OS X) which
allows you to use controller inputs like a mouse or keyboard.

If you've ever played a video game which only supports mouse and
keyboard input but you want to use a joystick or gamepad, then
Enjoyable will help you do that.

Enjoyable supports
Enjoyable supports:

* Mapping gamepad and joystick buttons to keyboard and mouse actions
* Fine control over mouse movement and scrolling using analog axis
Expand All @@ -16,7 +18,9 @@ Enjoyable supports

Enjoyable is free software written by Joe Wreschnig and is based on
the Enjoy codebase written by [Yifeng Huang](http://nongraphical.com)
and [Sam McCall](http://abstractable.net/enjoy/).
and [Sam McCall](http://abstractable.net/enjoy/). Further changes and
improvements made by Joe Wreschnig and now
[Marcelo Novaes](http://mnovaes.com).

## How to Use

Expand All @@ -32,9 +36,12 @@ manual available in Help Viewer via `⌘?`.

## License

Copyright 2013 Joe Wreschnig
2012 Yifeng Huang
2009 Sam McCall, University of Otago
Copyright

- 2017 Marcelo Novaes
- 2013 Joe Wreschnig
- 2012 Yifeng Huang
- 2009 Sam McCall, University of Otago

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
Loading

0 comments on commit 37f84bf

Please sign in to comment.