commit
748970fa0e
27 changed files with 2709 additions and 0 deletions
@ -0,0 +1,7 @@
|
||||
node_modules |
||||
src |
||||
npm-debug.log |
||||
lib/index.js |
||||
lib/index.coffee |
||||
test |
||||
Cakefile |
@ -0,0 +1,46 @@
|
||||
fs = require 'fs' |
||||
{exec,spawn} = require 'child_process' |
||||
util = require 'util' |
||||
glob = require 'glob' |
||||
|
||||
sources = [ |
||||
'gamepad.coffee' |
||||
'init.coffee' |
||||
] |
||||
sourcestring = "" |
||||
for source in sources |
||||
sourcestring += 'src/'+source+' ' |
||||
|
||||
task 'watch', 'Watch source files and build changes', -> |
||||
watch = spawn "node_modules/coffeescript/bin/coffee", ['-c', '-w', '-m', '--no-header', '-j', 'lib/index.js', sourcestring] |
||||
watch.stdout.on 'data', (data) -> console.log data.toString().trim() |
||||
|
||||
task 'compile', 'Compile all CoffeeScript files', -> |
||||
# prepare lib directory |
||||
if not fs.existsSync 'lib' |
||||
fs.mkdirSync 'lib' |
||||
|
||||
files = glob.sync('src/mappings/*.json') |
||||
mappings = [] |
||||
for file in files |
||||
data = JSON.parse(fs.readFileSync(file)) |
||||
mappings.push data |
||||
fs.writeFileSync('lib/mappings.json', JSON.stringify(mappings)) |
||||
|
||||
# run coffee-script compile |
||||
exec "cat #{sourcestring} > lib/index.coffee" |
||||
exec "node_modules/coffeescript/bin/coffee --compile --map --no-header lib/index.coffee", (err, stdout, stderr) -> |
||||
if err |
||||
util.log err |
||||
process.exit 1 # abort npm packaging |
||||
fs.unlink("lib/index.coffee", () -> ) |
||||
util.log "Compiled CoffeeScript." |
||||
|
||||
task 'build', 'Compile and minify all CoffeeScript files', -> |
||||
invoke 'compile' |
||||
exec 'closure-compiler --compilation_level ECMASCRIPT5 --compilation_level SIMPLE --create_source_map=lib/index.min.js.map --js_output_file lib/index.min.js lib/index.js', (err) -> |
||||
if err |
||||
util.log err |
||||
process.exit 1 # abort npm packaging |
||||
fs.appendFileSync('lib/index.min.js', "\n//# sourceMappingURL=index.min.js.map") |
||||
util.log "Minified JavaScript." |
@ -0,0 +1,20 @@
|
||||
Copyright (c) 2017 Alexander Yakovlev, https://oreolek.ru/ |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining |
||||
a copy of this software and associated documentation files (the |
||||
"Software"), to deal in the Software without restriction, including |
||||
without limitation the rights to use, copy, modify, merge, publish, |
||||
distribute, sublicense, and/or sell copies of the Software, and to |
||||
permit persons to whom the Software is furnished to do so, subject to |
||||
the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be |
||||
included in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
@ -0,0 +1,9 @@
|
||||
# Gamepad support for Salet 2 |
||||
|
||||
Requires [Salet](https://gitlab.com/Oreolek/salet-module) 2+ |
||||
|
||||
Uses code from the [`html-gamepad`](https://github.com/ericlathrop/html5-gamepad/blob/master/LICENSE) library in accordance to MIT License. |
||||
|
||||
Copyright 2017 Alexander Yakovlev. |
||||
|
||||
`html-gamepad` code copyright 2016 Eric Lathrop, with contributions from Rex Soriano. |
@ -0,0 +1,34 @@
|
||||
{ |
||||
"name": "salet-gamepad", |
||||
"version": "1.0.0", |
||||
"description": "A gamepad module for Salet 2.", |
||||
"keywords": [ |
||||
"ifiction", |
||||
"interactive fiction", |
||||
"games", |
||||
"coffeescript", |
||||
"gamepad" |
||||
], |
||||
"homepage": "https://salet.su", |
||||
"bugs": { |
||||
"url": "https://gitlab.com/oreolek/salet-gamepad-module/issues" |
||||
}, |
||||
"license": "MIT", |
||||
"dependencies": { |
||||
"glob": "^7.1.2" |
||||
}, |
||||
"private": false, |
||||
"author": { |
||||
"name": "Alexander Yakovlev", |
||||
"email": "keloero@oreolek.ru", |
||||
"url": "https://oreolek.ru" |
||||
}, |
||||
"devDependencies": { |
||||
"coffeescript": "^2.0.0" |
||||
}, |
||||
"main": "lib/index.min.js", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "https://gitlab.com/oreolek/salet-gamepad-module" |
||||
} |
||||
} |
@ -0,0 +1,40 @@
|
||||
# Gamepad HTML5 API |
||||
class Gamepad |
||||
constructor: (pad) -> |
||||
@gamepad = pad |
||||
@map = @detectMapping(pad.id, navigator.userAgent) |
||||
detectMapping: (id, browser) -> |
||||
for map in salet.view.gamepadmappings |
||||
for device in map.supported |
||||
if id.indexOf(device.id) != -1 and browser.indexOf(device.browser) != -1 |
||||
return map |
||||
# mapping not found, return the first map for this browser |
||||
for device in map.supported |
||||
if browser.indexOf(device.browser) != -1 |
||||
return map |
||||
# browser and device are not supported, just return the first map |
||||
console.warn "Browser and device are not found, gamepad support not guaranteed." |
||||
return salet.view.gamepadmappings[0] |
||||
axis: (name) -> |
||||
map = @map.axes[name] |
||||
unless map? |
||||
return 0 |
||||
if map.index? |
||||
return @gamepad.axes[map.index] |
||||
if map.buttonPositive? and @gamepad.buttons[map.buttonPositive].pressed |
||||
return 1 |
||||
if map.buttonNegative? and @gamepad.buttons[map.buttonNegative].pressed |
||||
return -1 |
||||
return 0 |
||||
button: (name) -> |
||||
map = @map.buttons[name] |
||||
unless map? |
||||
return 0 |
||||
if map.index? |
||||
return @gamepad.buttons[map.index].pressed |
||||
if map.axis? |
||||
if map.direction < 0 |
||||
return @gamepad.axes[map.axis] < -0.75 |
||||
else |
||||
return @gamepad.axes[map.axis] > 0.75 |
||||
return false |
@ -0,0 +1,19 @@
|
||||
$(document).on("viewinit", () -> |
||||
# An array containing the connected gamepads (see Gamepad class) |
||||
salet.view.gamepads = [] |
||||
jQuery.ajax({ |
||||
dataType: 'json', |
||||
url: 'mappings.json', |
||||
success: (data) -> |
||||
salet.view.gamepadmappings = data |
||||
window.addEventListener("gamepadconnected", (e) -> |
||||
salet.view.gamepads[e.gamepad.index] = new Gamepad(e.gamepad) |
||||
) |
||||
window.addEventListener("gamepaddisconnected", (e) -> |
||||
salet.view.gamepads[e.gamepad.index] = undefined |
||||
) |
||||
if (typeof navigator.getGamepads == "function") |
||||
for pad in navigator.getGamepads() |
||||
salet.view.gamepads[pad.index] = new Gamepad(pad) |
||||
}) |
||||
) |
@ -0,0 +1,121 @@
|
||||
{ |
||||
"axes": { |
||||
"dpad x": { |
||||
"index": 4 |
||||
}, |
||||
"dpad y": { |
||||
"index": 5 |
||||
}, |
||||
"left stick x": { |
||||
"index": 0 |
||||
}, |
||||
"left stick y": { |
||||
"index": 1 |
||||
}, |
||||
"right stick x": { |
||||
"index": 2 |
||||
}, |
||||
"right stick y": { |
||||
"index": 3 |
||||
} |
||||
}, |
||||
"buttons": { |
||||
"a": { |
||||
"index": 1 |
||||
}, |
||||
"b": { |
||||
"index": 2 |
||||
}, |
||||
"back": { |
||||
"index": 8 |
||||
}, |
||||
"dpad down": { |
||||
"axis": 5, |
||||
"direction": 1 |
||||
}, |
||||
"dpad left": { |
||||
"axis": 4, |
||||
"direction": -1 |
||||
}, |
||||
"dpad right": { |
||||
"axis": 4, |
||||
"direction": 1 |
||||
}, |
||||
"dpad up": { |
||||
"axis": 5, |
||||
"direction": -1 |
||||
}, |
||||
"left shoulder": { |
||||
"index": 4 |
||||
}, |
||||
"left stick": { |
||||
"index": 10 |
||||
}, |
||||
"left stick down": { |
||||
"axis": 1, |
||||
"direction": 1 |
||||
}, |
||||
"left stick left": { |
||||
"axis": 0, |
||||
"direction": -1 |
||||
}, |
||||
"left stick right": { |
||||
"axis": 0, |
||||
"direction": 1 |
||||
}, |
||||
"left stick up": { |
||||
"axis": 1, |
||||
"direction": -1 |
||||
}, |
||||
"left trigger": { |
||||
"index": 6 |
||||
}, |
||||
"right shoulder": { |
||||
"index": 5 |
||||
}, |
||||
"right stick": { |
||||
"index": 11 |
||||
}, |
||||
"right stick down": { |
||||
"axis": 3, |
||||
"direction": 1 |
||||
}, |
||||
"right stick left": { |
||||
"axis": 2, |
||||
"direction": -1 |
||||
}, |
||||
"right stick right": { |
||||
"axis": 2, |
||||
"direction": 1 |
||||
}, |
||||
"right stick up": { |
||||
"axis": 3, |
||||
"direction": -1 |
||||
}, |
||||
"right trigger": { |
||||
"index": 7 |
||||
}, |
||||
"start": { |
||||
"index": 9 |
||||
}, |
||||
"x": { |
||||
"index": 0 |
||||
}, |
||||
"y": { |
||||
"index": 3 |
||||
} |
||||
}, |
||||
"name": "Logitech F310 (DirectInput) Chrome/Firefox Linux", |
||||
"supported": [ |
||||
{ |
||||
"browser": "Chrome", |
||||
"id": "Logitech Logitech Dual Action (Vendor: 046d Product: c216)", |
||||
"os": "Linux" |
||||
}, |
||||
{ |
||||
"browser": "Firefox", |
||||
"id": "046d-c216-Logitech Logitech Dual Action", |
||||
"os": "Linux" |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,120 @@
|
||||
{ |
||||
"axes": { |
||||
"dpad x": { |
||||
"index": 6 |
||||
}, |
||||
"dpad y": { |
||||
"index": 7 |
||||
}, |
||||
"left stick x": { |
||||
"index": 0 |
||||
}, |
||||
"left stick y": { |
||||
"index": 1 |
||||
}, |
||||
"right stick x": { |
||||
"index": 2 |
||||
}, |
||||
"right stick y": { |
||||
"index": 3 |
||||
}, |
||||
"right trigger": { |
||||
"index": 5 |
||||
} |
||||
}, |
||||
"buttons": { |
||||
"a": { |
||||
"index": 0 |
||||
}, |
||||
"b": { |
||||
"index": 1 |
||||
}, |
||||
"back": { |
||||
"index": 8 |
||||
}, |
||||
"dpad down": { |
||||
"index": 13 |
||||
}, |
||||
"dpad left": { |
||||
"index": 14 |
||||
}, |
||||
"dpad right": { |
||||
"index": 15 |
||||
}, |
||||
"dpad up": { |
||||
"index": 12 |
||||
}, |
||||
"left shoulder": { |
||||
"index": 4 |
||||
}, |
||||
"left stick": { |
||||
"index": 10 |
||||
}, |
||||
"left stick down": { |
||||
"axis": 1, |
||||
"direction": 1 |
||||
}, |
||||
"left stick left": { |
||||
"axis": 0, |
||||
"direction": -1 |
||||
}, |
||||
"left stick right": { |
||||
"axis": 0, |
||||
"direction": 1 |
||||
}, |
||||
"left stick up": { |
||||
"axis": 1, |
||||
"direction": -1 |
||||
}, |
||||
"left trigger": { |
||||
"index": 6 |
||||
}, |
||||
"right shoulder": { |
||||
"index": 5 |
||||
}, |
||||
"right stick": { |
||||
"index": 11 |
||||
}, |
||||
"right stick down": { |
||||
"axis": 3, |
||||
"direction": 1 |
||||
}, |
||||
"right stick left": { |
||||
"axis": 2, |
||||
"direction": -1 |
||||
}, |
||||
"right stick right": { |
||||
"axis": 2, |
||||
"direction": 1 |
||||
}, |
||||
"right stick up": { |
||||
"axis": 3, |
||||
"direction": -1 |
||||
}, |
||||
"right trigger": { |
||||
"index": 7 |
||||
}, |
||||
"start": { |
||||
"index": 9 |
||||
}, |
||||
"x": { |
||||
"index": 2 |
||||
}, |
||||
"y": { |
||||
"index": 3 |
||||
} |
||||
}, |
||||
"name": "Logitech F310 (DirectInput) Chrome Windows/OSX", |
||||
"supported": [ |
||||
{ |
||||
"browser": "Chrome", |
||||
"id": "Logitech Dual Action (STANDARD GAMEPAD Vendor: 046d Product: c216)", |
||||
"os": "Mac OS X" |
||||
}, |
||||
{ |
||||
"browser": "Chrome", |
||||
"id": "Logitech Dual Action (STANDARD GAMEPAD Vendor: 046d Product: c216)", |
||||
"os": "Windows NT" |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,114 @@
|
||||
{ |
||||
"axes": { |
||||
"dpad x": { |
||||
"index": 6 |
||||
}, |
||||
"dpad y": { |
||||
"index": 7 |
||||
}, |
||||
"left stick x": { |
||||
"index": 0 |
||||
}, |
||||
"left stick y": { |
||||
"index": 1 |
||||
}, |
||||
"left trigger": { |
||||
"index": 2 |
||||
}, |
||||
"right stick x": { |
||||
"index": 3 |
||||
}, |
||||
"right stick y": { |
||||
"index": 4 |
||||
}, |
||||
"right trigger": { |
||||
"index": 5 |
||||
} |
||||
}, |
||||
"buttons": { |
||||
"a": { |
||||
"index": 1 |
||||
}, |
||||
"b": { |
||||
"index": 2 |
||||
}, |
||||
"back": { |
||||
"index": 8 |
||||
}, |
||||
"dpad down": { |
||||
"index": 13 |
||||
}, |
||||
"dpad left": { |
||||
"index": 14 |
||||
}, |
||||
"dpad right": { |
||||
"index": 15 |
||||
}, |
||||
"dpad up": { |
||||
"index": 12 |
||||
}, |
||||
"left shoulder": { |
||||
"index": 4 |
||||
}, |
||||
"left stick": { |
||||
"index": 10 |
||||
}, |
||||
"left stick down": { |
||||
"axis": 2, |
||||
"direction": 1 |
||||
}, |
||||
"left stick left": { |
||||
"axis": 1, |
||||
"direction": -1 |
||||
}, |
||||
"left stick right": { |
||||
"axis": 1, |
||||
"direction": 1 |
||||
}, |
||||
"left stick up": { |
||||
"axis": 2, |
||||
"direction": -1 |
||||
}, |
||||
"left trigger": { |
||||
"index": 6 |
||||
}, |
||||
"right shoulder": { |
||||
"index": 5 |
||||
}, |
||||
"right stick": { |
||||
"index": 11 |
||||
}, |
||||
"right stick down": { |
||||
"axis": 4, |
||||
"direction": 1 |
||||
}, |
||||
"right stick left": { |
||||
"axis": 3, |
||||
"direction": -1 |
||||
}, |
||||
"right stick up": { |
||||
"axis": 4, |
||||
"direction": -1 |
||||
}, |
||||
"right trigger": { |
||||
"index": 7 |
||||
}, |
||||
"start": { |
||||
"index": 9 |
||||
}, |
||||
"x": { |
||||
"index": 0 |
||||
}, |
||||
"y": { |
||||
"index": 3 |
||||
} |
||||
}, |
||||
"name": "Logitech F310 (DirectInput) Firefox OSX", |
||||
"supported": [ |
||||
{ |
||||
"browser": "Firefox", |
||||
"id": "46d-c216-Logitech Dual Action", |
||||
"os": "Mac OS X" |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,115 @@
|
||||
{ |
||||
"axes": { |
||||
"dpad x": { |
||||
"index": 6 |
||||
}, |
||||
"dpad y": { |
||||
"index": 7 |
||||
}, |
||||
"left stick x": { |
||||
"index": 0 |
||||
}, |
||||
"left stick y": { |
||||
"index": 1 |
||||
}, |
||||
"right stick x": { |
||||
"index": 2 |
||||
}, |
||||
"right stick y": { |
||||
"index": 3 |
||||
}, |
||||
"right trigger": { |
||||
"index": 5 |
||||
} |
||||
}, |
||||
"buttons": { |
||||
"a": { |
||||
"index": 1 |
||||
}, |
||||
"b": { |
||||
"index": 2 |
||||
}, |
||||
"back": { |
||||
"index": 8 |
||||
}, |
||||
"dpad down": { |
||||
"index": 14 |
||||
}, |
||||
"dpad left": { |
||||
"index": 15 |
||||
}, |
||||
"dpad right": { |
||||
"index": 16 |
||||
}, |
||||
"dpad up": { |
||||
"index": 13 |
||||
}, |
||||
"left shoulder": { |
||||
"index": 4 |
||||
}, |
||||
"left stick": { |
||||
"index": 10 |
||||
}, |
||||
"left stick down": { |
||||
"axis": 1, |
||||
"direction": 1 |
||||
}, |
||||
"left stick left": { |
||||
"axis": 0, |
||||
"direction": -1 |
||||
}, |
||||
"left stick right": { |
||||
"axis": 0, |
||||
"direction": 1 |
||||
}, |
||||
"left stick up": { |
||||
"axis": 1, |
||||
"direction": -1 |
||||
}, |
||||
"left trigger": { |
||||
"index": 6 |
||||
}, |
||||
"right shoulder": { |
||||
"index": 5 |
||||
}, |
||||
"right stick": { |
||||
"index": 11 |
||||
}, |
||||
"right stick down": { |
||||
"axis": 3, |
||||
"direction": 1 |
||||
}, |
||||
"right stick left": { |
||||
"axis": 2, |
||||
"direction": -1 |
||||
}, |
||||
"right stick right": { |
||||
"axis": 2, |
||||
"direction": 1 |
||||
}, |
||||
"right stick up": { |
||||
"axis": 3, |
||||
"direction": -1 |
||||
}, |
||||
"right trigger": { |
||||
"index": 7 |
||||
}, |
||||
"start": { |
||||
"index": 9 |
||||
}, |
||||
"x": { |
||||
"index": 0 |
||||
}, |
||||
"y": { |
||||
"index": 3 |
||||
} |
||||
}, |
||||
"name": "Logitech F310 (DirectInput) Firefox Windows", |
||||
"supported": [ |
||||
{ |
||||
"browser": "Firefox", |
||||
"id": "046d-c216-Logitech Dual Action", |
||||
"os": "Windows NT" |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,118 @@
|
||||
{ |
||||
"axes": { |
||||
"dpad x": { |
||||
"index": 6 |
||||
}, |
||||
"dpad y": { |
||||
"index": 7 |
||||
}, |
||||
"left stick x": { |
||||
"index": 0 |
||||
}, |
||||
"left stick y": { |
||||
"index": 1 |
||||
}, |
||||
"right stick x": { |
||||
"index": 2 |
||||
}, |
||||
"right stick y": { |
||||
"index": 3 |
||||
}, |
||||
"right trigger": { |
||||
"index": 5 |
||||
} |
||||
}, |
||||
"buttons": { |
||||
"a": { |
||||
"index": 0 |
||||
}, |
||||
"b": { |
||||
"index": 1 |
||||
}, |
||||
"back": { |
||||
"index": 8 |
||||
}, |
||||
"dpad down": { |
||||
"index": 13 |
||||
}, |
||||
"dpad left": { |
||||
"index": 14 |
||||
}, |
||||
"dpad right": { |
||||
"index": 15 |
||||
}, |
||||
"dpad up": { |
||||
"index": 12 |
||||
}, |
||||
"home": { |
||||
"index": 16 |
||||
}, |
||||
"left shoulder": { |
||||
"index": 4 |
||||
}, |
||||
"left stick": { |
||||
"index": 10 |
||||
}, |
||||
"left stick down": { |
||||
"axis": 1, |
||||
"direction": 1 |
||||
}, |
||||
"left stick left": { |
||||
"axis": 0, |
||||
"direction": -1 |
||||
}, |
||||
"left stick right": { |
||||
"axis": 0, |
||||
"direction": 1 |
||||
}, |
||||
"left stick up": { |
||||
"axis": 1, |
||||
"direction": -1 |
||||
}, |
||||
"left trigger": { |
||||
"index": 6 |
||||
}, |
||||
"right shoulder": { |
||||
"index": 5 |
||||
}, |
||||
"right stick": { |
||||
"index": 11 |
||||
}, |
||||
"right stick down": { |
||||
"axis": 3, |
||||
"direction": 1 |
||||
}, |
||||
"right stick left": { |
||||
"axis": 2, |
||||
"direction": -1 |
||||
}, |
||||
"right stick right": { |
||||
"axis": 2, |
||||
"direction": 1 |
||||
}, |
||||
"right stick up": { |
||||
"axis": 3, |
||||
"direction": -1 |
||||
}, |
||||
"right trigger": { |
||||
"index": 7 |
||||
}, |
||||
"start": { |
||||
"index": 9 |
||||
}, |
||||
"x": { |
||||
"index": 2 |
||||
}, |
||||
"y": { |
||||
"index": 3 |
||||
} |
||||
}, |
||||
"name": "Logitech F310 (XInput) Chrome Linux", |
||||
"supported": [ |
||||
{ |
||||
"browser": "Chrome", |
||||
"id": "Logitech Gamepad F310 (STANDARD GAMEPAD Vendor: 046d Product: c21d)", |
||||
"os": "Linux" |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,127 @@
|
||||
{ |
||||
"axes": { |
||||
"dpad x": { |
||||
"index": 6 |
||||
}, |
||||
"dpad y": { |
||||
"index": 7 |
||||
}, |
||||
"left stick x": { |
||||
"index": 0 |
||||
}, |
||||
"left stick y": { |
||||
"index": 1 |
||||
}, |
||||
"left trigger": { |
||||
"index": 2 |
||||
}, |
||||
"right stick x": { |
||||
"index": 3 |
||||
}, |
||||
"right stick y": { |
||||
"index": 4 |
||||
}, |
||||
"right trigger": { |
||||
"index": 5 |
||||
} |
||||
}, |
||||
"buttons": { |
||||
"a": { |
||||
"index": 0 |
||||
}, |
||||
"b": { |
||||
"index": 1 |
||||
}, |
||||
"back": { |
||||
"index": 6 |
||||
}, |
||||
"dpad down": { |
||||
"axis": 7, |
||||
"direction": 1 |
||||
}, |
||||
"dpad left": { |
||||
"axis": 6, |
||||
"direction": -1 |
||||
}, |
||||
"dpad right": { |
||||
"axis": 6, |
||||
"direction": 1 |
||||
}, |
||||
"dpad up": { |
||||
"axis": 7, |
||||
"direction": -1 |
||||
}, |
||||
"home": { |
||||
"index": 8 |
||||
}, |
||||
"left shoulder": { |
||||
"index": 4 |
||||
}, |
||||
"left stick": { |
||||
"index": 9 |
||||
}, |
||||
"left stick down": { |
||||
"axis": 1, |
||||
"direction": 1 |
||||
}, |
||||
"left stick left": { |
||||
"axis": 0, |
||||
"direction": -1 |
||||
}, |
||||
"left stick right": { |
||||
"axis": 0, |
||||
"direction": 1 |
||||
}, |
||||
"left stick up": { |
||||
"axis": 1, |
||||
"direction": -1 |
||||
}, |
||||
"left trigger": { |
||||
"axis": 2, |
||||
"direction": 1 |
||||
}, |
||||
"right shoulder": { |
||||
"index": 5 |
||||
}, |
||||
"right stick": { |
||||
"index": 10 |
||||
}, |
||||
"right stick down": { |
||||
"axis": 4, |
||||
"direction": 1 |
||||
}, |
||||
"right stick left": { |
||||
"axis": 3, |
||||
"direction": -1 |
||||
}, |
||||
"right stick right": { |
||||
"axis": 3, |
||||
"direction": 1 |
||||
}, |
||||
"right stick up": { |
||||
"axis": 4, |
||||
"direction": -1 |
||||
}, |
||||
"right trigger": { |
||||
"axis": 5, |
||||
"direction": 1 |
||||
}, |
||||
"start": { |
||||
"index": 7 |
||||
}, |
||||
"x": { |
||||
"index": 2 |
||||
}, |
||||
"y": { |
||||
"index": 3 |
||||
} |
||||
}, |
||||
"name": "Logitech F310 (XInput) Firefox Linux", |
||||
"supported": [ |
||||
{ |
||||
"browser": "Firefox", |
||||
"id": "046d-c21d-Logitech Gamepad F310", |
||||
"os": "Linux" |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,123 @@
|
||||
{ |
||||
"axes": { |
||||
"dpad x": { |
||||
"index": 6 |
||||
}, |
||||
"dpad y": { |
||||
"index": 7 |
||||
}, |
||||
"left stick x": { |
||||
"index": 0 |
||||
}, |
||||
"left stick y": { |
||||
"index": 1 |
||||
}, |
||||
"right stick x": { |
||||
"index": 2 |
||||
}, |
||||
"right stick y": { |
||||
"index": 3 |
||||
}, |
||||
"right trigger": { |
||||
"index": 5 |
||||
} |
||||
}, |
||||
"buttons": { |
||||
"a": { |
||||
"index": 0 |
||||
}, |
||||
"b": { |
||||
"index": 1 |
||||
}, |
||||
"back": { |
||||
"index": 8 |
||||
}, |
||||
"dpad down": { |
||||
"index": 13 |
||||
}, |
||||
"dpad left": { |
||||
"index": 14 |
||||
}, |
||||
"dpad right": { |
||||
"index": 15 |
||||
}, |
||||
"dpad up": { |
||||
"index": 12 |
||||
}, |
||||
"home": { |
||||
"index": 16 |
||||
}, |
||||
"left shoulder": { |
||||
"index": 4 |
||||
}, |
||||
"left stick": { |
||||
"index": 10 |
||||
}, |
||||
"left stick down": { |
||||
"axis": 1, |
||||
"direction": 1 |
||||
}, |
||||
"left stick left": { |
||||
"axis": 0, |
||||
"direction": -1 |
||||
}, |
||||
"left stick right": { |
||||
"axis": 0, |
||||
"direction": 1 |
||||
}, |
||||
"left stick up": { |
||||
"axis": 1, |
||||
"direction": -1 |
||||
}, |
||||
"left trigger": { |
||||
"index": 6 |
||||
}, |
||||
"right shoulder": { |
||||
"index": 5 |
||||
}, |
||||
"right stick": { |
||||
"index": 11 |
||||
}, |
||||
"right stick down": { |
||||
"axis": 3, |
||||
"direction": 1 |
||||
}, |
||||
"right stick left": { |
||||
"axis": 2, |
||||
"direction": -1 |
||||
}, |
||||
"right stick right": { |
||||
"axis": 2, |
||||
"direction": 1 |
||||
}, |
||||
"right stick up": { |
||||
"axis": 3, |
||||
"direction": -1 |
||||
}, |
||||
"right trigger": { |
||||
"index": 7 |
||||
}, |
||||
"start": { |
||||
"index": 9 |
||||
}, |
||||
"x": { |
||||
"index": 2 |
||||
}, |
||||
"y": { |
||||
"index": 3 |
||||
} |
||||
}, |
||||
"name": "PLAYSTATION(R)3 Controller (STANDARD GAMEPAD Vendor: 054c Product: 0268) Chrome OSX Linux", |
||||
"supported": [ |
||||
{ |
||||
"browser": "Chrome", |
||||
"id": "PLAYSTATION(R)3 Controller (STANDARD GAMEPAD Vendor: 054c Product: 0268)", |
||||
"os": "Mac OS X" |
||||
}, |
||||
{ |
||||
"browser": "Chrome", |
||||
"id": "Sony PLAYSTATION(R)3 Controller (STANDARD GAMEPAD Vendor: 054c Product: 0268)", |
||||
"os": "Linux" |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,121 @@
|
||||
{ |
||||
"axes": { |
||||
"dpad x": { |
||||
"index": 6 |
||||
}, |
||||
"dpad y": { |
||||
"index": 7 |
||||
}, |
||||
"left stick x": { |
||||
"index": 0 |
||||
}, |
||||
"left stick y": { |
||||
"index": 1 |
||||
}, |
||||
"left trigger": { |
||||
"index": 12 |
||||
}, |
||||
"right stick x": { |
||||
"index": 2 |
||||
}, |
||||
"right stick y": { |
||||
"index": 3 |
||||
}, |
||||
"right trigger": { |
||||
"index": 13 |
||||
} |
||||
}, |
||||
"buttons": { |
||||
"a": { |
||||
"index": 14 |
||||
}, |
||||
"b": { |
||||
"index": 13 |
||||
}, |
||||
"back": { |
||||
"index": 0 |
||||
}, |
||||
"dpad down": { |
||||
"index": 6 |
||||
}, |
||||
"dpad left": { |
||||
"index": 7 |
||||
}, |
||||
"dpad right": { |
||||
"index": 5 |
||||
}, |
||||
"dpad up": { |
||||
"index": 4 |
||||
}, |
||||
"home": { |
||||
"index": 16 |
||||
}, |
||||
"left stick": { |
||||
"index": 1 |
||||
}, |
||||
"left shoulder": { |
||||
"index": 10 |
||||
}, |
||||
"left stick down": { |
||||
"axis": 1, |
||||
"direction": 1 |
||||
}, |
||||
"left stick left": { |
||||
"axis": 0, |
||||
"direction": -1 |
||||
}, |
||||
"left stick right": { |
||||
"axis": 0, |
||||
"direction": 1 |
||||
}, |
||||
"left stick up": { |
||||
"axis": 1, |
||||
"direction": -1 |
||||
}, |
||||
"left trigger": { |
||||
"index": 8 |
||||
}, |
||||
"right stick": { |
||||
"index": 2 |
||||
}, |
||||
"right stick down": { |
||||
"axis": 3, |
||||
"direction": 1 |
||||
}, |
||||
"right stick left": { |
||||
"axis": 2, |
||||
"direction": -1 |
||||
}, |
||||
"right stick right": { |
||||
"axis": 2, |
||||
"direction": 1 |
||||
}, |
||||
"right stick up": { |
||||
"axis": 3, |
||||
"direction": -1 |
||||
}, |
||||
"right trigger": { |
||||
"index": 9 |
||||
}, |
||||
"right shoulder": { |
||||
"index": 11 |
||||
}, |
||||
"start": { |
||||
"index": 3 |
||||
}, |
||||
"x": { |
||||
"index": 15 |
||||
}, |
||||
"y": { |
||||
"index": 12 |
||||
} |
||||
}, |
||||
"name": "054c-0268-Sony PLAYSTATION(R)3 Controller Firefox Linux", |
||||
"supported": [ |
||||
{ |
||||
"browser": "Firefox", |
||||
"id": "054c-0268-Sony PLAYSTATION(R)3 Controller", |
||||
"os": "Linux" |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,123 @@
|
||||
{ |
||||
"axes": { |
||||
"dpad x": { |
||||
"buttonPositive": 15, |
||||
"buttonNegative": 14 |
||||
}, |
||||
"dpad y": { |
||||
"buttonPositive": 13, |
||||
"buttonNegative": 12 |
||||
}, |
||||
"left stick x": { |
||||
"index": 0 |
||||
}, |
||||
"left stick y": { |
||||
"index": 1 |
||||
}, |
||||
"left trigger": { |
||||
"buttonPositive": 6 |
||||
}, |
||||
"right stick x": { |
||||
"index": 2 |
||||
}, |
||||
"right stick y": { |
||||
"index": 3 |
||||
}, |
||||
"right trigger": { |
||||
"buttonPositive": 7 |
||||
} |
||||
}, |
||||
"buttons": { |
||||
"a": { |
||||
"index": 0 |
||||
}, |
||||
"b": { |
||||
"index": 1 |
||||
}, |
||||
"back": { |
||||
"index": 8 |
||||
}, |
||||
"dpad down": { |
||||
"index": 13 |
||||
}, |
||||
"dpad left": { |
||||
"index": 14 |
||||
}, |
||||
"dpad right": { |
||||
"index": 15 |
||||
}, |
||||
"dpad up": { |
||||
"index": 12 |
||||
}, |
||||
"home": { |
||||
"index": 16 |
||||
}, |
||||
"left shoulder": { |
||||
"index": 4 |
||||
}, |
||||
"left stick": { |
||||
"index": 10 |
||||
}, |
||||
"left stick down": { |
||||
"axis": 1, |
||||
"direction": 1 |
||||
}, |
||||
"left stick left": { |
||||
"axis": 0, |
||||
"direction": -1 |
||||
}, |
||||
"left stick right": { |
||||
"axis": 0, |
||||
"direction": 1 |
||||
}, |
||||
"left stick up": { |
||||
"axis": 1, |
||||
"direction": -1 |
||||
}, |
||||
"left trigger": { |
||||
"index": 6 |
||||
}, |
||||
"right shoulder": { |
||||
"index": 5 |
||||
}, |
||||
"right stick": { |
||||
"index": 11 |
||||
}, |
||||
"right stick down": { |
||||
"axis": 3, |
||||
"direction": 1 |
||||
}, |
||||
"right stick left": { |
||||
"axis": 2, |
||||
"direction": -1 |
||||
}, |
||||
"right stick right": { |
||||
"axis": 2, |
||||
"direction": 1 |
||||
}, |
||||
"right stick up": { |
||||
"axis": 3, |
||||
"direction": -1 |
||||
}, |
||||
"right trigger": { |
||||
"index": 7 |
||||
}, |
||||
"start": { |
||||
"index": 9 |
||||
}, |
||||
"x": { |
||||
"index": 2 |
||||
}, |
||||
"y": { |
||||
"index": 3 |
||||
} |
||||
}, |
||||
"name": "PS4 Chrome Linux", |
||||
"supported": [ |
||||
{ |
||||
"browser": "Chrome", |
||||
"id": "Sony Computer Entertainment Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 05c4)", |
||||
"os": "Linux" |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,123 @@
|
||||
{ |
||||
"axes": { |
||||
"dpad x": { |
||||
"index": 6 |
||||
}, |
||||
"dpad y": { |
||||
"index": 7 |
||||
}, |
||||
"left stick x": { |
||||
"index": 0 |
||||
}, |
||||
"left stick y": { |
||||
"index": 1 |
||||
}, |
||||
"right stick x": { |
||||
"index": 2 |
||||
}, |
||||
"right stick y": { |
||||
"index": 3 |
||||
}, |
||||
"right trigger": { |
||||
"index": 5 |
||||
} |
||||
}, |
||||
"buttons": { |
||||
"a": { |
||||
"index": 0 |
||||
}, |
||||
"b": { |
||||
"index": 1 |
||||
}, |
||||
"back": { |
||||
"index": 8 |
||||
}, |
||||
"dpad down": { |
||||
"index": 13 |
||||
}, |
||||
"dpad left": { |
||||
"index": 14 |
||||
}, |
||||
"dpad right": { |
||||
"index": 15 |
||||
}, |
||||
"dpad up": { |
||||
"index": 12 |
||||
}, |
||||
"home": { |
||||
"index": 16 |
||||
}, |
||||
"left shoulder": { |
||||
"index": 4 |
||||
}, |
||||
"left stick": { |
||||
"index": 10 |
||||
}, |
||||
"left stick down": { |
||||
"axis": 1, |
||||
"direction": 1 |
||||
}, |
||||
"left stick left": { |
||||
"axis": 0, |
||||
"direction": -1 |
||||
}, |
||||
"left stick right": { |
||||
"axis": 0, |
||||
"direction": 1 |
||||
}, |
||||
"left stick up": { |
||||
"axis": 1, |
||||
"direction": -1 |
||||
}, |
||||
"left trigger": { |
||||
"index": 6 |
||||
}, |
||||
"right shoulder": { |
||||
"index": 5 |
||||
}, |
||||
"right stick": { |
||||
"index": 11 |
||||
}, |
||||
"right stick down": { |
||||
"axis": 3, |
||||
"direction": 1 |
||||
}, |
||||
"right stick left": { |
||||
"axis": 2, |
||||
"direction": -1 |
||||
}, |
||||
"right stick right": { |
||||
"axis": 2, |
||||
"direction": 1 |
||||
}, |
||||
"right stick up": { |
||||
"axis": 3, |
||||
"direction": -1 |
||||
}, |
||||
"right trigger": { |
||||
"index": 7 |
||||
}, |
||||
"start": { |
||||
"index": 9 |
||||
}, |
||||
"x": { |
||||
"index": 2 |
||||
}, |
||||
"y": { |
||||
"index": 3 |
||||
} |
||||
}, |
||||
"name": "PS4 Chrome Windows/OSX", |
||||
"supported": [ |
||||
{ |
||||
"browser": "Chrome", |
||||
"id": "Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 05c4)", |
||||
"os": "Windows NT" |
||||
}, |
||||
{ |
||||
"browser": "Chrome", |
||||
"id": "Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 05c4)", |
||||
"os": "Mac OS X" |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,125 @@
|
||||
{ |
||||
"axes": { |
||||
"dpad x": { |
||||
"index": 6 |
||||
}, |
||||
"dpad y": { |
||||
"index": 7 |
||||
}, |
||||
"left stick x": { |
||||
"index": 0 |
||||
}, |
||||
"left stick y": { |
||||
"index": 1 |
||||
}, |
||||
"left trigger": { |
||||
"index": 3 |
||||
}, |
||||
"right stick x": { |
||||
"index": 2 |
||||
}, |
||||
"right stick y": { |
||||
"index": 5 |
||||
}, |
||||
"right trigger": { |
||||
"index": 4 |
||||
} |
||||
}, |
||||
"buttons": { |
||||
"a": { |
||||
"index": 1 |
||||
}, |
||||
"b": { |
||||
"index": 2 |
||||
}, |
||||
"back": { |
||||
"index": 8 |
||||
}, |
||||
"dpad down": { |
||||
"axis": 7, |
||||
"direction": 1 |
||||
}, |
||||
"dpad left": { |
||||
"axis": 6, |
||||
"direction": -1 |
||||
}, |
||||
"dpad right": { |
||||
"axis": 6, |
||||
"direction": 1 |
||||
}, |
||||
"dpad up": { |
||||
"axis": 7, |
||||
"direction": -1 |
||||
}, |
||||
"home": { |
||||
"index": 12 |
||||
}, |
||||
"left shoulder": { |
||||
"index": 4 |
||||
}, |
||||
"left stick": { |
||||
"index": 10 |
||||
}, |
||||
"left stick down": { |
||||
"axis": 1, |
||||
"direction": 1 |
||||
}, |
||||
"left stick left": { |
||||
"axis": 0, |
||||
"direction": -1 |
||||
}, |
||||
"left stick right": { |
||||
"axis": 0, |
||||
"direction": 1 |
||||
}, |
||||
"left stick up": { |
||||
"axis": 1, |
||||
"direction": -1 |
||||
}, |
||||
"left trigger": { |
||||
"index": 6 |
||||
}, |
||||
"right shoulder": { |
||||
"index": 5 |
||||
}, |
||||
"right stick": { |
||||
"index": 11 |
||||
}, |
||||
"right stick down": { |
||||
"axis": 5, |
||||
"direction": 1 |
||||
}, |
||||
"right stick left": { |
||||
"axis": 2, |
||||
"direction": -1 |
||||
}, |
||||
"right stick right": { |
||||
"axis": 2, |
||||
"direction": 1 |
||||
}, |
||||
"right stick up": { |
||||
"axis": 5, |
||||
"direction": -1 |
||||
}, |
||||
"right trigger": { |
||||