Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,33 @@

All notable changes to Keyboard Splitter, explained in plain language.

## [0.3.8] - 2026-09-06

### Fixed
- Fixed a bug where you could not select the **Football (eFootball / PES)**
preset: choosing it looked like it snapped straight back to the FIFA one.
The Mapping editor identified a preset by the physical keys alone, and the
two football presets deliberately use the same keys - so any football
layout was reported as the FIFA preset and the picker jumped back. It now
compares what each key *does* (the full key → controller-button table),
so every preset is recognized on its own.
- Fixed a bug where the eFootball/PES preset pressed the wrong buttons for
the game: shoot, pass, cross and through ball were assigned to buttons
Konami does not use for them, so e.g. "shoot" crossed the ball instead.
The layout was researched against the games' control charts and corrected
to the Konami **Standard** scheme that PES 2017 through eFootball ship
with: A low pass, X shoot, B lofted pass/cross, Y through ball, dash on
RB, specials on RT. The EA FC / FIFA preset now also documents its own
in-game **Classic** scheme (A pass, B shoot, X cross/lob, Y through ball,
sprint on RT) instead of mixing the two games' conventions.

### Changed
- The two football presets' descriptions say which in-game scheme each
matches and what every key does, including how to get the *other* feel:
eFootball's in-game "Alternate" layout is the EA FC preset, and EA's
"Alternate" is the eFootball/PES one. PES 2017 players: the eFootball/PES
preset is the exact layout PES 2017 ships with.

## [0.3.7] - 2026-09-06

### Fixed
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Cutting a release is therefore just:
# bump "version" in src-tauri/tauri.conf.json (and keep package.json and
# src-tauri/Cargo.toml in sync), add a CHANGELOG.md entry in plain language,
# then:
git add -A && git commit -m "chore(release): bump to 0.3.7" && git push
git add -A && git commit -m "chore(release): bump to 0.3.8" && git push
```

The workflow skips runs whose version was already released, so unrelated
Expand Down Expand Up @@ -145,6 +145,17 @@ assign them → start engine) so you always know what's left.
(e.g. `W` → `Left Stick ↑`, `Space` → `A`). The preset picker highlights
which preset a player is currently using and flags custom layouts that
match none of the built-in ones.

**Football presets follow each game's real Xbox defaults** (checked against the games'
own control charts): the *EA FC / FIFA* preset matches EA's in-game **Classic** scheme
(A pass, B shoot, X cross/lob, Y through ball, RT sprint), and the *eFootball / PES*
preset matches Konami's **Standard** scheme that PES 2017 through eFootball ship with
(A low pass, X shoot, B lofted pass/cross, Y through ball, RB dash). Both deliberately
use the same keyboard keys - only the controller button each key presses differs. If you
switch a game to its *other* scheme in its own options, apply the matching preset:
eFootball's "Alternate" layout is the EA FC preset, and EA's "Alternate" is the
eFootball/PES one.

6. Open your game. Each player controls the game with their own keyboard.
7. Close the window to keep it running in the tray; **Quit** from the tray
unplugs the controllers cleanly.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "keyboardsplitternext",
"private": true,
"version": "0.3.7",
"version": "0.3.8",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "app"
version = "0.3.7"
version = "0.3.8"
description = "Modern Keyboard Splitter - multiple keyboards as independent virtual Xbox controllers"
authors = ["e4crypt3d"]
license = ""
Expand Down
6 changes: 3 additions & 3 deletions src-tauri/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ pub async fn list_presets(
}

#[tauri::command(rename_all = "camelCase")]
pub async fn list_preset_keys(
pub async fn list_preset_bindings(
engine: State<'_, EngineHandle>,
preset_id: String,
) -> Result<Vec<String>, String> {
ask(&engine, |reply| EngineMsg::ListPresetKeys { preset_id, reply }).await
) -> Result<Vec<Binding>, String> {
ask(&engine, |reply| EngineMsg::ListPresetBindings { preset_id, reply }).await
}

#[tauri::command(rename_all = "camelCase")]
Expand Down
12 changes: 7 additions & 5 deletions src-tauri/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ pub enum EngineMsg {
ApplyPreset { player: usize, preset_id: String, reply: Reply<Snapshot> },
/// List built-in presets (id/name/description).
ListPresets(Reply<Vec<PresetMeta>>),
/// Canonical key names bound by one built-in preset.
ListPresetKeys { preset_id: String, reply: Reply<Vec<String>> },
/// The full key -> target table of one built-in preset (the preset picker
/// compares these tables to tell presets apart, even when two layouts use
/// the same physical keys).
ListPresetBindings { preset_id: String, reply: Reply<Vec<Binding>> },
/// A key was pressed/released on one physical keyboard.
#[cfg_attr(not(target_os = "windows"), allow(dead_code))]
KeyEvent { device: String, key: String, down: bool },
Expand Down Expand Up @@ -695,10 +697,10 @@ fn handle_message(app: &AppHandle, core: &mut Core, msg: EngineMsg) -> bool {
EngineMsg::ListPresets(reply) => {
let _ = reply.send(Ok(presets::list()));
}
EngineMsg::ListPresetKeys { preset_id, reply } => {
let keys = presets::keys(&preset_id)
EngineMsg::ListPresetBindings { preset_id, reply } => {
let bindings = presets::bindings(&preset_id)
.ok_or_else(|| format!("Unknown preset '{preset_id}'"));
let _ = reply.send(keys);
let _ = reply.send(bindings);
}
EngineMsg::KeyEvent { device, key, down } => {
handle_key_event(app, core, &device, &key, down);
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ pub fn run() {
commands::list_profiles,
commands::apply_preset,
commands::list_presets,
commands::list_preset_keys,
commands::list_preset_bindings,
])
.build(tauri::generate_context!())
.expect("error while building tauri application");
Expand Down
24 changes: 24 additions & 0 deletions src-tauri/src/mapping/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,28 @@ mod tests {
let r = report_for(&map, &held(&["F9", "W"]));
assert_eq!(r.left_y, i16::MAX);
}

#[test]
fn two_players_with_the_same_preset_stay_independent() {
// The "each keyboard is its own controller" flow: every player keeps
// its own held-key set and its own report, so two players can run the
// very same preset on two keyboards. Pressing the same keys on both
// must drive two identical-but-separate reports, and a press on one
// player's keyboard must never leak into the other player's report.
let map = crate::presets::bindings("football-pes").unwrap();

// Both players hold the same keys on their own keyboards: move + pass.
let p1 = report_for(&map, &held(&["W", "Space"]));
let p2 = report_for(&map, &held(&["W", "Space"]));
assert_eq!(p1, p2, "identical inputs on two keyboards = identical reports");
assert_eq!(p1.buttons, crate::controller::BIT_A);

// Player 2 now also taps shoot (E). Only p2's report changes.
let p2_shot = report_for(&map, &held(&["W", "Space", "E"]));
let p1_unchanged = report_for(&map, &held(&["W", "Space"]));
assert_eq!(p1_unchanged, p1, "player 1's pad must not react to player 2's keys");
// On the eFootball/PES (Konami Standard) preset, shoot = Xbox X.
assert_eq!(p2_shot.buttons, crate::controller::BIT_A | crate::controller::BIT_X);
assert_ne!(p2_shot, p1_unchanged);
}
}
141 changes: 109 additions & 32 deletions src-tauri/src/presets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
//! one-keyboard splitters, where players had to use different zones).
//!
//! Controller-side layouts follow the games' documented Xbox defaults:
//! - EA Sports FC / FIFA: A pass · X through ball · B cross · Y shoot
//! - eFootball / PES: A low pass · X through ball · B shoot · Y lofted pass
//! - EA Sports FC / FIFA: A pass · B shoot · X cross/lob · Y through (in-game "Classic")
//! - eFootball / PES: A low pass · X shoot · B lofted/cross · Y through, dash on RB
//! (Konami "Standard" - also the out-of-the-box PES 2017 layout;
//! eFootball's "Alternate" scheme is the EA-style one above)
//! - Mortal Kombat 1/11: X/Y/A/B = FP/BP/FK/BK · LB throw · RT block
//! - Tekken 7/8: X/Y/A/B = LP/RP/LK/RK (combos are key chords)
//! - Street Fighter 6: X/Y/RB = LP/MP/HP · A/B/RT = LK/MK/HK
Expand Down Expand Up @@ -85,44 +87,51 @@ const GENERAL_KEYS: &[(&str, Target)] = &[
("L", dpad(DpadDirection::Right)),
];

/// Football: EA Sports FC / FIFA. Movement on the left stick, passing /
/// shooting cluster on the left hand. Classic layout A pass · X through ·
/// B cross · Y shoot; newer FC titles default shoot to Y - swap E/R if needed.
/// Football: EA Sports FC / FIFA, in-game "Classic" scheme (the default).
/// Movement on the left stick, passing/shooting cluster on the left hand:
/// A pass · B shoot · X cross/lob · Y through ball. Dash/sprint is the right
/// trigger (C). EA's in-game "Alternate" scheme (sprint on RB, shoot on X)
/// matches the eFootball/PES Standard preset instead.
const FOOTBALL_FC_KEYS: &[(&str, Target)] = &[
("W", stick(StickSide::Left, StickDirection::Up)),
("A", stick(StickSide::Left, StickDirection::Left)),
("S", stick(StickSide::Left, StickDirection::Down)),
("D", stick(StickSide::Left, StickDirection::Right)),
("Space", b(GamepadButton::A)), // pass
("Space", b(GamepadButton::A)), // pass / header
("E", b(GamepadButton::B)), // shoot
("Q", b(GamepadButton::X)), // through ball
("R", b(GamepadButton::Y)), // cross / lob
("Q", b(GamepadButton::X)), // cross / lob pass
("R", b(GamepadButton::Y)), // through ball
("Tab", b(GamepadButton::LB)), // change player
("F", b(GamepadButton::RB)), // sprint
("LCtrl", trig(TriggerSide::Left)), // precision dribble / special
("C", trig(TriggerSide::Right)), // alternate sprint / dash
("F", b(GamepadButton::RB)), // teammate press / call for support (hold)
("LCtrl", trig(TriggerSide::Left)), // shield / jockey (hold)
("C", trig(TriggerSide::Right)), // sprint / dash (hold)
("Up", dpad(DpadDirection::Up)),
("Left", dpad(DpadDirection::Left)),
("Down", dpad(DpadDirection::Down)),
("Right", dpad(DpadDirection::Right)),
("Enter", b(GamepadButton::Start)), // pause
];

/// Football: eFootball / PES. A low pass · X through ball · B shoot ·
/// Y lofted pass, RT dash. Same ergonomic cluster as the FC preset.
/// Football: eFootball / PES with the Konami "Standard" scheme that PES 2017,
/// PES 2021 and eFootball ship out of the box (verified against the games'
/// control charts/manuals): A low pass · X shoot · B lofted pass/cross ·
/// Y through ball, dash on RB, specials on RT. Note the Xbox labels are
/// positional - the PlayStation ▢/○/△ faces sit on Xbox X/B/Y. eFootball's
/// in-game "Alternate" scheme is the EA-style one (shoot B, dash RT); use
/// the EA FC preset for that feel.
const FOOTBALL_PES_KEYS: &[(&str, Target)] = &[
("W", stick(StickSide::Left, StickDirection::Up)),
("A", stick(StickSide::Left, StickDirection::Left)),
("S", stick(StickSide::Left, StickDirection::Down)),
("D", stick(StickSide::Left, StickDirection::Right)),
("Space", b(GamepadButton::A)), // low/short pass
("E", b(GamepadButton::B)), // shoot
("Q", b(GamepadButton::X)), // through ball
("R", b(GamepadButton::Y)), // lofted pass / cross
("Tab", b(GamepadButton::LB)), // change player / pressure
("F", b(GamepadButton::RB)), // match-up / second press
("C", trig(TriggerSide::Right)), // dash (sprint)
("LCtrl", trig(TriggerSide::Left)), // dribbling modifier / manual
("Space", b(GamepadButton::A)), // low/short pass (pressure when defending)
("E", b(GamepadButton::X)), // shoot (Xbox X = PlayStation ▢ position)
("Q", b(GamepadButton::B)), // lofted pass / cross
("R", b(GamepadButton::Y)), // through ball
("Tab", b(GamepadButton::LB)), // cursor change / change player
("F", b(GamepadButton::RB)), // dash / sprint (hold)
("C", trig(TriggerSide::Right)), // special controls / skill modifier (hold)
("LCtrl", trig(TriggerSide::Left)), // manual controls (hold)
("Up", dpad(DpadDirection::Up)),
("Left", dpad(DpadDirection::Left)),
("Down", dpad(DpadDirection::Down)),
Expand Down Expand Up @@ -273,13 +282,13 @@ static PRESETS: &[PresetDef] = &[
PresetDef {
id: "football-fc",
name: "Football (FIFA / EA FC)",
description: "Classic EA FC scheme: A pass, X through ball, B shoot, Y cross on Space/Q/E/R, sprint on F, player change on Tab. Newer FC titles default shoot to Y - swap E and R to taste.",
description: "EA FC defaults (in-game Classic scheme): pass Space, shoot E, cross Q, through R, sprint C (right trigger), teammate press F, change player Tab. Shooting feels wrong in PES? That game's default puts shoot on X - use the eFootball/PES preset instead.",
keys: FOOTBALL_FC_KEYS,
},
PresetDef {
id: "football-pes",
name: "Football (eFootball / PES)",
description: "eFootball scheme: A low pass, X through ball, B shoot, Y lofted pass; dash on C, pressure on F. Kick-off at full speed.",
description: "PES/eFootball out-of-the-box layout (Konami Standard, same scheme as PES 2017): pass Space, shoot E, cross Q, through R, dash F (RB), specials C (RT), change player Tab. If eFootball is set to its Alternate scheme the buttons are EA-style - apply the EA FC preset instead.",
keys: FOOTBALL_PES_KEYS,
},
PresetDef {
Expand Down Expand Up @@ -347,11 +356,6 @@ pub fn bindings(id: &str) -> Option<Vec<Binding>> {
.map(|p| p.keys.iter().map(|(k, t)| Binding { key: k.to_string(), target: *t }).collect())
}

/// The canonical key names of a built-in preset, in display order. The UI
/// sorts them itself; used to detect which preset a player's bindings match.
pub fn keys(id: &str) -> Option<Vec<String>> {
bindings(id).map(|b| b.into_iter().map(|x| x.key).collect())
}

/// Default layout for new players == the "general" preset.
pub fn default_bindings() -> Vec<Binding> {
Expand Down Expand Up @@ -390,12 +394,85 @@ mod tests {
}

#[test]
fn keys_mirror_the_preset_definitions() {
fn bindings_mirror_the_preset_definitions() {
for def in PRESETS {
let expected: Vec<String> = def.keys.iter().map(|(k, _)| k.to_string()).collect();
assert_eq!(super::keys(def.id).as_ref(), Some(&expected), "preset {}", def.id);
let expected: Vec<Binding> = def
.keys
.iter()
.map(|(k, t)| Binding { key: k.to_string(), target: *t })
.collect();
assert_eq!(
super::bindings(def.id).as_ref(),
Some(&expected),
"preset {}",
def.id
);
}
assert_eq!(super::keys("nope"), None);
assert_eq!(super::bindings("nope"), None);
}

#[test]
fn every_preset_has_a_distinct_key_target_table() {
// The preset picker identifies the preset a player is using by
// comparing (key → target) pairs, so two presets that bind the same
// keys to the same targets would be indistinguishable (this is what
// made the PES preset "snap back" to FIFA: they shared the same key
// list and the picker compared keys only). No two presets may share
// an identical table.
// Compare rows of "key|target" - Binding itself is not Hash (it is a
// serde DTO and stays that way), so fingerprint via Debug.
let mut seen: HashSet<Vec<String>> = HashSet::new();
for def in PRESETS {
let mut table: Vec<String> = def
.keys
.iter()
.map(|(k, t)| format!("{k}|{t:?}"))
.collect();
table.sort();
assert!(
seen.insert(table),
"preset '{}' has the exact same key->target table as another preset - the picker could not tell them apart",
def.id
);
}
}

#[test]
fn football_presets_follow_each_games_xbox_defaults() {
// Researched from the games' control charts / manuals:
// - EA FC "Classic" (its default): A pass, B shoot, X cross/lob,
// Y through ball, sprint on RT.
// - eFootball/PES "Standard" (the Konami default, unchanged since
// PES 2017): A low pass, X shoot, B lofted pass/cross, Y through
// ball, dash on RB, specials on RT. Xbox labels are positional -
// the PS ▢/○/△ faces map to Xbox X/B/Y.
let at = |bs: &[Binding], key: &str| {
bs.iter()
.find(|b| b.key == key)
.map(|b| b.target)
.unwrap_or_else(|| panic!("key {key} not bound"))
};

let fc = bindings("football-fc").unwrap();
assert_eq!(at(&fc, "E"), b(GamepadButton::B)); // shoot
assert_eq!(at(&fc, "Q"), b(GamepadButton::X)); // cross / lob
assert_eq!(at(&fc, "R"), b(GamepadButton::Y)); // through ball
assert_eq!(at(&fc, "C"), trig(TriggerSide::Right)); // sprint (RT)

let pes = bindings("football-pes").unwrap();
assert_eq!(at(&pes, "E"), b(GamepadButton::X)); // shoot (Konami Standard)
assert_eq!(at(&pes, "Q"), b(GamepadButton::B)); // lofted pass / cross
assert_eq!(at(&pes, "R"), b(GamepadButton::Y)); // through ball
assert_eq!(at(&pes, "F"), b(GamepadButton::RB)); // dash (RB)
assert_eq!(at(&pes, "C"), trig(TriggerSide::Right)); // specials (RT)

// Both keep the same ergonomic key cluster so switching games is
// seamless; only the Xbox targets follow each game's scheme.
let keys_of = |bs: &[Binding]| -> HashSet<String> {
bs.iter().map(|b| b.key.clone()).collect()
};
assert_eq!(keys_of(&fc), keys_of(&pes));
assert_ne!(bindings("football-fc").unwrap(), bindings("football-pes").unwrap());
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "../../../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "Keyboard Splitter",
"version": "0.3.7",
"version": "0.3.8",
"identifier": "com.e4crypt3d.keyboardsplitter",
"mainBinaryName": "Keyboard Splitter",
"build": {
Expand Down
8 changes: 5 additions & 3 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ export const resetDefault = (player: number) =>

/** Built-in game presets (FIFA, MK, Tekken, ...). */
export const listPresets = () => invoke<PresetMeta[]>('list_presets')
/** Canonical key names bound by one built-in preset (display order). */
export const listPresetKeys = (presetId: string) =>
invoke<string[]>('list_preset_keys', { presetId })
/** Full key -> target table of one built-in preset (the picker needs the
* targets, not just the keys, to tell presets with identical key layouts
* apart - e.g. the two football presets). */
export const listPresetBindings = (presetId: string) =>
invoke<Binding[]>('list_preset_bindings', { presetId })
/** Replace one player's bindings with a built-in preset. */
export const applyPreset = (player: number, presetId: string) =>
invoke<Snapshot>('apply_preset', { player, presetId })
Expand Down
Loading
Loading