mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-22 16:46:10 -08:00
feat(controller): add hold + press combos to main bindings (#328)
* feat(controller): add hold + press combos to main bindings Main Alt+C actions can now be learned as combos such as L1 + D-pad right. A combo fires on each press while its hold button is down, and claims its press input so token move and popup scroll ignore it until it is released. A plain action on a hold button fires on release, unless another bound button was pressed during the hold. The save path needed two changes for combos to persist. The IPC validator rebuilt bindings field by field and dropped `hold`, so Alt+C showed a combo from its local copy until the next reload turned it back into a plain button. Validator and config resolver now share one parser. Saves also replace the controller section, since the deep merge in patchRawConfig kept the old `hold` when a combo was rebound to one button. Also fixes Learn on the (D-pad) rows, which threw after cancel() cleared the capture target. * test(launcher): wait for content in background child test The test polled for the fake app's output files to exist, but the shell creates a redirect target before writing to it. A poll landing in that gap read an empty env file and failed with '' !== '1', as seen once in CI. Wait until both files have content instead. * fix(controller): keep a diagonal push from learning as a combo Learn took the first axis of a diagonal stick push as the hold and the second as the press, saving a combo that one axis could never trigger. This reached main Alt+C rows when they moved to combo capture. Axes crossing the threshold in the same poll as the first input now count as one movement. A second axis moved in a later poll still records a combo. * fix(controller): only treat simultaneous axes as one movement The diagonal push guard also blocked an axis activated in the same poll as a button, so L1 plus a stick direction could not record the stick until it was released and moved again. Apply the guard only when the first input is an axis, so that input pair records as a combo again.
This commit is contained in:
1 parent
79e5535823
commit
b31ddce627
30 files changed
+1078
-295
No files matched your search
@@ -39,6 +39,44 @@ test('a button on the D-pad clashes with a D-pad row that is still on', () => {
|
||||
);
|
||||
});
|
||||
|
||||
const L1_DPAD_RIGHT = {
|
||||
kind: 'button',
|
||||
buttonIndex: 15,
|
||||
hold: { kind: 'button', buttonIndex: 4 },
|
||||
} as const;
|
||||
|
||||
test('a combo does not clash with its hold or press used elsewhere on their own', () => {
|
||||
// L1 is Play Current Audio by default; the D-pad is still on Token Move.
|
||||
assert.deepEqual(issuesWith({ nextAudio: L1_DPAD_RIGHT }), {});
|
||||
});
|
||||
|
||||
test('two actions on the same combo both warn', () => {
|
||||
assert.deepEqual(issuesWith({ nextAudio: L1_DPAD_RIGHT, nextEntry: L1_DPAD_RIGHT }), {
|
||||
nextAudio: 'Same as Next Entry',
|
||||
nextEntry: 'Same as Next Audio',
|
||||
});
|
||||
});
|
||||
|
||||
test('a combo holding and pressing the same button warns', () => {
|
||||
assert.deepEqual(
|
||||
issuesWith({
|
||||
nextEntry: { kind: 'button', buttonIndex: 7, hold: { kind: 'button', buttonIndex: 7 } },
|
||||
}),
|
||||
{ nextEntry: 'Hold and press are the same button' },
|
||||
);
|
||||
});
|
||||
|
||||
test('the secondary subtitle hold warns on a hold button, since it cannot wait for release', () => {
|
||||
assert.deepEqual(
|
||||
issuesWith({
|
||||
playCurrentAudio: { kind: 'none' },
|
||||
nextAudio: L1_DPAD_RIGHT,
|
||||
holdSecondarySub: { kind: 'button', buttonIndex: 4 },
|
||||
}),
|
||||
{ holdSecondarySub: 'Also the hold button of Next Audio' },
|
||||
);
|
||||
});
|
||||
|
||||
test('a D-pad reported as a hat axis also counts as the D-pad', () => {
|
||||
assert.deepEqual(
|
||||
issuesWith({ previousEntry: { kind: 'axis', axisIndex: 7, direction: 'negative' } }),
|
||||
|
||||
Reference in new issue
Block a user