Skip to content

Commit

Permalink
change mapping structure to apply the deadzone change
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinir committed Jan 26, 2021
1 parent b22cdaa commit 8dd1d8d
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 49 deletions.
18 changes: 10 additions & 8 deletions additionalMappings.json
Expand Up @@ -3,9 +3,9 @@
"name": "Q4RAF (DInput - PS3.PC)",
"properties": ["joystick"],
"sticks": {
"deadzone": 0.5,
"left": {
"x": 0, "y": 1, "button": null
"x": 0, "y": 1, "button": null,
"deadzone": 0.5
},
"right": null
},
Expand All @@ -26,12 +26,13 @@
"name": "8BitDo SN30 Pro (DInput)",
"properties": ["axisdpad"],
"sticks": {
"deadzone": 0.02,
"left": {
"x": 0, "y": 1, "button": 13
"x": 0, "y": 1, "button": 13,
"deadzone": 0.02
},
"right": {
"x": 2, "y": 5, "button": 14
"x": 2, "y": 5, "button": 14,
"deadzone": 0.02
}
},
"buttons": {
Expand All @@ -52,12 +53,13 @@
"name": "DualSense",
"properties": ["axisdpad"],
"sticks": {
"deadzone": 0.1,
"left": {
"x": 0, "y": 1, "button": 10
"x": 0, "y": 1, "button": 10,
"deadzone": 0.1
},
"right": {
"x": 2, "y": 5, "button": 11
"x": 2, "y": 5, "button": 11,
"deadzone": 0.1
}
},
"buttons": {
Expand Down
39 changes: 22 additions & 17 deletions defaultMappings.json
Expand Up @@ -3,12 +3,13 @@
"name": "XInput Standard Controller",
"properties": [],
"sticks": {
"deadzone": 0.1,
"left": {
"x": 0, "y": 1, "button": 10
"x": 0, "y": 1, "button": 10,
"deadzone": 0.1
},
"right": {
"x": 2, "y": 3, "button": 11
"x": 2, "y": 3, "button": 11,
"deadzone": 0.1
}
},
"buttons": {
Expand All @@ -29,12 +30,13 @@
"name": "DInput Standard Controller",
"properties": [],
"sticks": {
"deadzone": 0.1,
"left": {
"x": 0, "y": 1, "button": 10
"x": 0, "y": 1, "button": 10,
"deadzone": 0.1
},
"right": {
"x": 2, "y": 3, "button": 11
"x": 2, "y": 3, "button": 11,
"deadzone": 0.1
}
},
"buttons": {
Expand All @@ -55,9 +57,9 @@
"name": "Qanba Joystick",
"properties": ["joystick"],
"sticks": {
"deadzone": 0.5,
"left": {
"x": 0, "y": 1, "button": 10
"x": 0, "y": 1, "button": 10,
"deadzone": 0.5
},
"right": null
},
Expand All @@ -79,12 +81,13 @@
"name": "Hori Joystick",
"properties": ["joystick"],
"sticks": {
"deadzone": 0.5,
"left": {
"x": 0, "y": 1, "button": 10
"x": 0, "y": 1, "button": 10,
"deadzone": 0.5
},
"right": {
"x": 2, "y": 3, "button": 11
"x": 2, "y": 3, "button": 11,
"deadzone": 0.5
}
},
"buttons": {
Expand All @@ -104,12 +107,13 @@
"name": "Mad Catz Joystick",
"properties": ["joystick"],
"sticks": {
"deadzone": 0.5,
"left": {
"x": 0, "y": 1, "button": 10
"x": 0, "y": 1, "button": 10,
"deadzone": 0.5
},
"right": {
"x": 2, "y": 5, "button": 11
"x": 2, "y": 5, "button": 11,
"deadzone": 0.5
}
},
"buttons": {
Expand All @@ -130,12 +134,13 @@
"name": "8BitDo Gamepad (DInput)",
"properties": ["axisdpad"],
"sticks": {
"deadzone": 0.02,
"left": {
"x": 0, "y": 1, "button": 13
"x": 0, "y": 1, "button": 13,
"deadzone": 0.02
},
"right": {
"x": 2, "y": 5, "button": 14
"x": 2, "y": 5, "button": 14,
"deadzone": 0.02
}
},
"buttons": {
Expand Down
2 changes: 1 addition & 1 deletion index.html
Expand Up @@ -532,7 +532,7 @@

<!-- updater -->
<script>
const version = '3.11.4'
const version = '4.0.0'
const MPUpdater = new MiniPadderUpdater(version, Cp.insertAlert.bind(Cp))
const versionDoms = document.getElementsByClassName('version')
Array.from(versionDoms).forEach(v => v.innerHTML = version)
Expand Down
46 changes: 26 additions & 20 deletions js/interface/Mapper.js
Expand Up @@ -13,12 +13,13 @@ class MappingInterface extends MappingManager {
"name": "XInput Standard Controller",
"properties": [],
"sticks": {
"deadzone": 0.08,
"left": {
"x": 0, "y": 1, "button": 10
"x": 0, "y": 1, "button": 10,
"deadzone": 0.1
},
"right": {
"x": 2, "y": 3, "button": 11
"x": 2, "y": 3, "button": 11,
"deadzone": 0.1
}
},
"buttons": {
Expand All @@ -39,12 +40,13 @@ class MappingInterface extends MappingManager {
"name": "DInput Standard Controller",
"properties": [],
"sticks": {
"deadzone": 0.08,
"left": {
"x": 0, "y": 1, "button": 10
"x": 0, "y": 1, "button": 10,
"deadzone": 0.1
},
"right": {
"x": 2, "y": 3, "button": 11
"x": 2, "y": 3, "button": 11,
"deadzone": 0.1
}
},
"buttons": {
Expand All @@ -65,9 +67,9 @@ class MappingInterface extends MappingManager {
"name": "Qanba Joystick",
"properties": ["joystick"],
"sticks": {
"deadzone": 0.5,
"left": {
"x": 0, "y": 1, "button": 10
"x": 0, "y": 1, "button": 10,
"deadzone": 0.5
},
"right": null
},
Expand All @@ -88,12 +90,13 @@ class MappingInterface extends MappingManager {
"name": "Hori Joystick",
"properties": ["joystick"],
"sticks": {
"deadzone": 0.5,
"left": {
"x": 0, "y": 1, "button": 10
"x": 0, "y": 1, "button": 10,
"deadzone": 0.5
},
"right": {
"x": 2, "y": 3, "button": 11
"x": 2, "y": 3, "button": 11,
"deadzone": 0.5
}
},
"buttons": {
Expand All @@ -113,12 +116,13 @@ class MappingInterface extends MappingManager {
"name": "Mad Catz Joystick",
"properties": ["joystick"],
"sticks": {
"deadzone": 0.5,
"left": {
"x": 0, "y": 1, "button": 10
"x": 0, "y": 1, "button": 10,
"deadzone": 0.5
},
"right": {
"x": 2, "y": 5, "button": 11
"x": 2, "y": 5, "button": 11,
"deadzone": 0.5
}
},
"buttons": {
Expand All @@ -138,12 +142,13 @@ class MappingInterface extends MappingManager {
"name": "8BitDo Gamepad (DInput)",
"properties": ["axisdpad"],
"sticks": {
"deadzone": 0.02,
"left": {
"x": 0, "y": 1, "button": 13
"x": 0, "y": 1, "button": 13,
"deadzone": 0.02
},
"right": {
"x": 2, "y": 5, "button": 14
"x": 2, "y": 5, "button": 14,
"deadzone": 0.02
}
},
"buttons": {
Expand All @@ -164,12 +169,13 @@ class MappingInterface extends MappingManager {
"name": "DualSense",
"properties": ["axisdpad"],
"sticks": {
"deadzone": 0.1,
"left": {
"x": 0, "y": 1, "button": 10
"x": 0, "y": 1, "button": 10,
"deadzone": 0.1
},
"right": {
"x": 2, "y": 5, "button": 11
"x": 2, "y": 5, "button": 11,
"deadzone": 0.1
}
},
"buttons": {
Expand Down
38 changes: 35 additions & 3 deletions js/interface/MiniPadderUpdater.js
Expand Up @@ -161,9 +161,41 @@ class MiniPadderUpdater extends Updater {
Mapper.store()

return true
} // 3.11.2
} // 3.11
} // 3
}
}
},
'4': {
'0': {
'0': () => {
if (typeof Mapper === 'undefined') {
return false
}
MiniPadderUpdater.announceUpdate(
'Changing mapping structure for deadzone.', '4.0.0'
)
for (const m in Mapper.mappings) {
const mapping = Mapper.mappings[m]
if (!mapping.sticks) { continue }
if (mapping.sticks.left) {
mapping.sticks.left.deadzone =
mapping.sticks.left.deadzone || mapping.sticks.deadzone
}
if (mapping.sticks.right) {
mapping.sticks.right.deadzone =
mapping.sticks.right.deadzone || mapping.sticks.deadzone
}
delete mapping.sticks.deadzone
}
Mapper.store()

setLastAlertMessage(
'Now deadzone is applied separately for each sticks.'
)

return true
} // 4.0.0
} // 4.0
} // 4
} // end of update tasks
}
}

0 comments on commit 8dd1d8d

Please sign in to comment.