Skip to content
This repository was archived by the owner on Sep 23, 2020. It is now read-only.

Commit d66b982

Browse files
committed
When a device is not recognized, just fail with a trace() message rather than crash
1 parent a5b5764 commit d66b982

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

README.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ If you'd rather use events (especially useful for user interfaces), KeyActionBin
165165

166166
## Changelog
167167

168+
* 2014-02-16 - 1.5.5 - When a device is not recognized, just fail with a trace() message rather than crash
168169
* 2014-02-14 - 1.5.4 - Controllers data now use an array of strings for filters
169170
* 2014-02-13 - 1.5.3 - Added support for SELECT meta control
170171
* 2014-02-09 - 1.5.2 - Added support for "split" controls, where the same GameInput control fires two distinct buttons (e.g. XBox 360 dpads on OUYA)
@@ -210,13 +211,15 @@ Controllers that emulate other controllers (e.g. XBox 360 alternatives) should w
210211

211212
To add:
212213

213-
* All other platforms (Mac, Android, Windows 8, Windows XP, ...)
214+
* All other platforms (Windows 8, Windows XP, ...)
214215
* Android: GameStick, NVIDIA Shield, MadCatz MOJO, GamePop, Green Throttle, ...
215216

216217
More platforms and devices will be added as their controls are tested and figured out. If you wish, you can test it yourself:
217218

218-
* [Web-based GameInput tester](http://hosted.zehfernando.com/key-action-binder/game-input-tester/) (requires Flash Player)
219-
* [Android/OUYA APK GameInput tester app](hosted.zehfernando.com/key-action-binder/game-input-tester/GameInputTester.apk)
219+
* [Web-based KeyActionBinder tester](http://hosted.zehfernando.com/key-action-binder/tester/): use this to see if your device/OS/browser is recognized by KeyActionBinder (requires Flash Player)
220+
* [Android/OUYA APK GameInput tester app](http://hosted.zehfernando.com/key-action-binder/tester/KeyActionBinderTester.apk)
221+
* [Web-based GameInput tester](http://hosted.zehfernando.com/key-action-binder/game-input-tester/): use this to see if OS is supported by Flash at all, and which controls are reported (requires Flash Player)
222+
* [Android/OUYA APK GameInput tester app](http://hosted.zehfernando.com/key-action-binder/game-input-tester/GameInputTester.apk)
220223

221224
A pure AS3 source of the tester app can be found on /tests/GameInputTester/src.
222225

@@ -240,7 +243,7 @@ KeyActionBinder uses the [MIT License](http://choosealicense.com/licenses/mit/).
240243
* Use caching samples? Change sampling rate?
241244
* Properly detect buttons that immediately send down+up events that cannot be detected by normal frames (e.g. HOME on OUYA)
242245
* Allow detecting "any" gamepad key (for "press any key")
243-
* Finish auto Gamepad control ids
246+
* More automatic gamepad mappings
244247
* Still allow platform-specific control ids?
245248
* Profile and test performance/bottlenecks/memory allocations
246249
* A better looking KeyActionBinderTester demo
@@ -253,14 +256,19 @@ KeyActionBinder uses the [MIT License](http://choosealicense.com/licenses/mit/).
253256

254257
There are everal ways to contribute to this project.
255258

259+
### Testing devices
260+
256261
To contribute with new key mappings (so more devices are supported by KeyActionBinder):
257262

258-
1. Run the [Web-based GameInput tester](http://hosted.zehfernando.com/key-action-binder/game-input-tester/) with your desired device connected to the machine.
259-
2. Push all buttons.
260-
3. Take a screenshot.
261-
4. Take notes of all buttons, indicating which buttons and axis relate to what (e.g. "BUTTON_4" means "directional pad up"). Be sure to include which of the values (-1 or 1) mean "UP" on the gamepad's sticks.
262-
5. Send the screenshot and the list of controls to zeh at zehfernando dot com.
263-
6. If possible, test in additional browsers to see if you get different results. In some systems, the regular Flash Player (plugin on FireFox, Safari, etc) behaves differently from the built-in Flash Player (Pepper Flash on Chrome). In this case, we need screenshots and lists of mappings for both kinds of player.
263+
1. Run the [Web-based KeyActionBinder tester](http://hosted.zehfernando.com/key-action-binder/tester/) with your desired device connected to the machine. Be sure to press all buttons to see if it comes to life. If it works perfectly, there's nothing else needed!
264+
2. If not, run the [Web-based GameInput tester](http://hosted.zehfernando.com/key-action-binder/game-input-tester/) with your desired device connected to the machine.
265+
3. Push all buttons.
266+
4. Take a screenshot.
267+
5. Take notes of all buttons, indicating which buttons and axis relate to what (e.g. "BUTTON_4" means "directional pad up"). Be sure to include which of the values (-1 or 1) mean "UP" on the gamepad's analog sticks, if needed.
268+
6. [Create a new issue](http://github.com/zeh/key-action-binder/issues) with the screenshot and the list of controls, stating which exact device was tested, in which OS, and with which browser.
269+
7. If possible, test in additional browsers to see if you get different results. In some systems, the regular Flash Player (plugin on FireFox, Safari, etc) behaves differently from the built-in Flash Player (Pepper Flash on Chrome). In this case, we need screenshots and lists of mappings for both kinds of player, so the device is more widely supported.
270+
271+
### Changing code or mappings yourself
264272

265273
To contribute with code, fixes, additions, or even new key mappings added directly to the [controllers list file](https://github.com/zeh/key-action-binder/blob/master/src/com/zehfernando/input/binding/controllers.json), you can just edit the related file inside GitHub (by editing it directly on the website, or creating a fork) and doing a pull request. This is an easy way to contribute, and it guarantees you will be credited for your work (accepted pull requests have their authors automatically show as contributors to the project).
266274

src/com/zehfernando/input/binding/KeyActionBinder.as

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ package com.zehfernando.input.binding {
2222
// More info: https://github.com/zeh/key-action-binder
2323

2424
// Constants
25-
public static const VERSION:String = "1.5.4";
25+
public static const VERSION:String = "1.5.5";
2626

2727
[Embed(source = "controllers.json", mimeType='application/octet-stream')]
2828
private static const JSON_CONTROLLERS:Class;
@@ -453,7 +453,7 @@ package com.zehfernando.input.binding {
453453
// Find the re-mapped control id
454454
var deviceIndex:int = gameInputDevices.indexOf(control.device);
455455

456-
if (deviceIndex > -1) {
456+
if (deviceIndex > -1 && gameInputDeviceDefinitions[deviceIndex] != null) {
457457
// Find single controls, where one control has one binding
458458
if (gameInputDeviceDefinitions[deviceIndex].controls.hasOwnProperty(control.id)) {
459459
var deviceControlInfo:AutoGamepadControlInfo = gameInputDeviceDefinitions[deviceIndex].controls[control.id];

0 commit comments

Comments
 (0)