Skip to content
Closed
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
2 changes: 2 additions & 0 deletions Cargo.lock

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

36 changes: 24 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ What each part does today and what it still needs:
| Runtime services | One signed-in offline user, licences, packages, saves that survive a kill at any step, text entry dialog | Speech is silent; the dialog and relaunch are untested live |
| Network | Offline by design: the title cannot reach the network | – |
| Files and streaming | Archives and streamed data read, zlib and BCPack decoded in parallel | Loading is limited by writes into title memory |
| Input | XInput pads, keyboard, keyboard stand-in pad | Trigger rumble |
| Input | XInput pads, keyboard and mouse as a pad (rebindable) | Trigger rumble; keyboard prompts |
| Audio | Menu, video and loading sound; XMA voices and Opus streams decode | Reverb is silent; Opus results unverified against the title |
| GPU: menus | Draws, compute and presentation on host D3D12; only changed title memory is copied | Frame pacing drifts on one screen in release builds |
| GPU: world | Mesh pipelines, shader-written buffers, descriptor lifetimes, indirect execution (arguments clamped), pipelines made by worker threads and kept on disk | Most of the scene is still missing (untranslated shaders drop draws); frames take seconds; real queries, depth bounds, HDR and scaling are missing |
Expand Down Expand Up @@ -153,17 +153,29 @@ The window caption shows the framerate. Saves, settings and `crashes.log`
are kept under the data folder (default `%LOCALAPPDATA%\victory\data`), derived
data under the cache folder.

Input: XInput pads. With none connected the keyboard is a pad while the
title's window has focus:

| Keys | Pad |
|------|-----|
| W A S D / I J K L | left / right stick |
| arrows | D-pad |
| Enter, Backspace, X, Y | A, B, X, Y |
| Q / E, Z / C | shoulders, triggers |
| F / H | stick clicks |
| Esc, Tab | Menu, View |
Input: XInput pads, and keyboard and mouse played like a PC game. The title
reads pads only, so the keyboard and mouse act on the first connected pad (or
a stand-in pad when none is): both work at once, each stick follows whichever
moved it last. The mouse turns the camera through the right stick, its motion
turned into a rate at each read of the title so the same movement turns the
same angle at any frame rate. While the window has focus the cursor is hidden
and held in it; Alt-Tab or Esc frees it, a click or Esc captures it again.

| Keys (on foot) | Pad | Keys (in a vehicle) | Pad |
|------|-----|------|-----|
| W A S D, Left Alt | left stick, walk | W / S, A D | RT / LT, steer |
| mouse, left / right button | right stick, RT / LT | Space, E | RB, LS |
| Left Shift, Space, F, R | A, X, Y, B | F, G | Y + vehicle layout off, layout only |
| Q, E, Left Ctrl, C | RB, D-pad right, LS, RS | | |
| Tab, V or M, wheel | LB, View, D-pad left / right | | |
| arrows, Enter, Backspace, Esc or P | D-pad, A, B, Menu | | |

The letters are the keys at those places on a US keyboard, so the left stick
is Z Q S D on an AZERTY keyboard (`keys_by_position = false`: by letter).
F (enter a vehicle) also switches to the vehicle layout and back; G switches
it alone when it is out of step. Rebind everything in `[controls]` of
`victory.toml` (see `victory.example.toml`); `enabled = false` brings back the
old fixed stand-in pad (W A S D / I J K L sticks, Enter, Backspace, X, Y).

## Commands

Expand Down
2 changes: 2 additions & 0 deletions apps/victory/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ pub fn run(
// A title that relaunched itself: the old process must be gone first.
victory_hle::modules::lifecycle::wait_for_previous();
let cfg = victory_core::Config::load()?;
victory_hle::modules::controls::configure(cfg.controls.as_ref())
.map_err(anyhow::Error::msg)?;
let original = std::fs::read(exe).with_context(|| format!("reading {}", exe.display()))?;
let prepared = victory_loader::prepare(&original)?;
let hash = prepared.original_hash.to_hex();
Expand Down
8 changes: 7 additions & 1 deletion crates/victory-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ pub struct Config {
pub test_titles: Vec<PathBuf>,
/// The config file that was read, if any.
pub source: Option<PathBuf>,
/// `[controls]`: keyboard and mouse bindings, read by `victory-hle`.
pub controls: Option<toml::Table>,
}

#[derive(Debug, Default, Deserialize)]
#[serde(deny_unknown_fields)]
struct FileConfig {
#[serde(default)]
paths: FilePaths,
controls: Option<toml::Table>,
}

#[derive(Debug, Default, Deserialize)]
Expand Down Expand Up @@ -70,7 +73,9 @@ impl Config {
}
None => (None, FileConfig::default()),
};
Self::resolve(parsed.paths, source, |k| std::env::var_os(k))
let mut cfg = Self::resolve(parsed.paths, source, |k| std::env::var_os(k))?;
cfg.controls = parsed.controls;
Ok(cfg)
}

fn resolve(
Expand All @@ -97,6 +102,7 @@ impl Config {
data_dir,
test_titles,
source,
controls: None,
})
}

Expand Down
4 changes: 4 additions & 0 deletions crates/victory-hle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ victory-formats.workspace = true
opus-pure.workspace = true
zlib-rs.workspace = true
tracing.workspace = true
serde.workspace = true
toml.workspace = true

[target.'cfg(windows)'.dependencies]
windows-sys = { workspace = true, features = [
"Win32_Foundation",
"Win32_Globalization",
"Win32_Graphics_Gdi",
"Win32_Media",
"Win32_Security",
"Win32_Storage_FileSystem",
Expand All @@ -29,6 +32,7 @@ windows-sys = { workspace = true, features = [
"Win32_System_Power",
"Win32_System_ProcessStatus",
"Win32_System_Threading",
"Win32_UI_Input",
"Win32_UI_Input_KeyboardAndMouse",
"Win32_UI_Input_XboxController",
"Win32_UI_WindowsAndMessaging",
Expand Down
Loading