Skip to content
Open
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
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,19 @@ A **gamepad is recommended**: console games are made for one, and their menus an
E / Q Y / X, Shift / Ctrl the stick clicks, Tab View, P Menu. `keyboard_mouse` and `mouse_sensitivity` in
the game's `xcl.toml` turn it off or change the mouse speed. A gamepad and the keyboard / mouse can be
used together.
- **Window:** the game's image keeps its aspect ratio in a window of another shape (black bars; an
image that fits 1:1 is copied texel for texel). `scaling` in the game's `xcl.toml`: `"fit"`,
`"integer"` (whole multiples only), `"stretch"` (the old behaviour); `XCL_SCALING` overrides it.
- **Screen:** the window is DPI aware (sharp at 125 % / 150 % scaling; `window_width` /
`window_height` are at 100 %). In the game's `xcl.toml`: `fullscreen = true` (borderless, at the
monitor's resolution; Alt+Enter or F11 switches while it runs), `monitor` (`"primary"`, a number
from the `monitor N:` list in `xcl.log`, or `"\\.\DISPLAY2"`). `XCL_FULLSCREEN` and `XCL_MONITOR`
override them.
- **Ultrawide rendering (the newer retail game):** `render_resolution = "screen"` makes the game
render at the monitor's aspect ratio instead of 16:9, its UI anchored to the wider screen
(4224x1792 on a 21:9 monitor: no more memory than 3840x2160, the most the game's render-target
memory holds), or `"WxH"` for a size of your own within that limit; `"native"` (default) keeps
3840x2160. `XCL_RENDER_RES` overrides it.

## Building and usage

Expand Down
1 change: 1 addition & 0 deletions crates/xcl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ features = [
"Win32_System_Com",
"Win32_System_LibraryLoader",
"Win32_System_Threading",
"Win32_UI_HiDpi",
"Win32_UI_WindowsAndMessaging",
]

Expand Down
18 changes: 18 additions & 0 deletions crates/xcl/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,20 @@ pub struct Config {
/// "center" (the primary monitor's work area), or "x,y" (top-left of the window, screen
/// coordinates; clamped into the nearest monitor's work area). `XCL_WINDOW_POS` overrides.
pub window_pos: String,
/// Borderless fullscreen on `monitor` at its native resolution (Alt+Enter or F11 switches
/// while the game runs). `XCL_FULLSCREEN=1/0` overrides.
pub fullscreen: bool,
/// The monitor for fullscreen (and for a centred window): "primary", a number (1 = the
/// first in the list XCL logs at start) or a device name (`\\.\DISPLAY2`). `XCL_MONITOR` overrides.
pub monitor: String,
/// How the game's image fills the window: "fit" (aspect ratio kept, black bars – a 16:9
/// image in a 21:9 window), "integer" (whole multiples only, 1:1 pixels) or "stretch".
/// `XCL_SCALING` overrides.
pub scaling: String,
/// The size the game renders at, for a screen that is not 16:9: "native" (the title's own,
/// 3840x2160), "WxH" ("5120x2160", "3440x1440") or "screen" (the `monitor`'s aspect ratio at
/// 2160 lines). Known for RAGE titles (the newer retail game) only. `XCL_RENDER_RES` overrides.
pub render_resolution: String,
/// Answer `XUserGetTokenAndSignature*` with XCL's local placeholder token (for a backend of
/// your own that accepts it). Off: the request fails as on a console that cannot reach Xbox
/// Live (0x80072EFD), and titles go their offline way – Xbox Live's and the titles' own
Expand Down Expand Up @@ -184,6 +198,10 @@ impl Default for Config {
window_width: 1280,
window_height: 720,
window_pos: "auto".into(),
fullscreen: false,
monitor: "primary".into(),
scaling: "fit".into(),
render_resolution: "native".into(),
xbox_live_tokens: false,
keyboard_mouse: true,
mouse_sensitivity: 1.0,
Expand Down
417 changes: 380 additions & 37 deletions crates/xcl/src/hle/d3d12x/present.rs

Large diffs are not rendered by default.

693 changes: 693 additions & 0 deletions crates/xcl/src/hle/d3d12x/present/downscale.rs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions crates/xcl/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub fn host_main(boot_path: &Path) -> i32 {
std::env::set_var("XCL_UMA_MB", boot.config.uma_mb.to_string());
}
crate::state::set_boot(boot.clone());
crate::hle::d3d12x::present::dpi_aware();
// `XCL_ACTIVITY=1`: every 2 s what the title did since (a timeline of where it stops)
if std::env::var_os("XCL_ACTIVITY").is_some() {
let _ = std::thread::Builder::new().name("xcl-activity".into()).spawn(|| {
Expand Down
1 change: 1 addition & 0 deletions crates/xcl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ pub mod tls;
pub mod util;
pub mod vfs;
pub mod vfs_hooks;
pub mod widescreen;
6 changes: 6 additions & 0 deletions crates/xcl/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ fn map_image_ex(path: &Path, is_main: bool) -> Result<Arc<MappedModule>, String>
}
}

// the title's display modes, for another render size (`widescreen`)
if is_main {
let data: Vec<(u32, usize, bool)> = pe.sections.iter().map(|s| (s.va, (s.mapped_size() as usize).min(size.saturating_sub(s.va as usize)), s.characteristics & 0x2000_0000 != 0)).collect();
unsafe { crate::widescreen::patch_image(base, &data) };
}

// 6. page protections
unsafe {
let mut old = 0u32;
Expand Down
Loading
Loading