Files
6gbvram---16gb-ram/crates/victory-gpu/src/console.rs
T
fxcelessandClaude Fable 5.2 29f9e89df6 The game is no longer named in the tree
Comments, documents and descriptions now say "the title". No code changes.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
2026-11-24 15:45:05 -05:00

51 lines
1.4 KiB
Rust

//! Which console the title runs on. Titles pick settings (resolution,
//! memory budgets) by it, so the user chooses; Series X unless told.
use std::sync::atomic::{AtomicBool, Ordering};
const GIB: usize = 1 << 30;
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
pub enum Console {
#[default]
SeriesX,
SeriesS,
}
impl Console {
/// Title memory in bytes: (GPU-optimal, standard). Series X in the
/// advanced configuration; Series S has one range, counted as standard
/// (7,776 MiB, the published console-mode figure).
// shortcut: later system updates gave Series S titles more (amount not
// published here); the title sizes nothing from this figure
// (it goes by the device type), so update it if a title does.
pub const fn title_memory(self) -> (usize, usize) {
match self {
Console::SeriesX => (10 * GIB, 7 * GIB / 2),
Console::SeriesS => (0, 7_776 << 20),
}
}
pub const fn name(self) -> &'static str {
match self {
Console::SeriesX => "Xbox Series X",
Console::SeriesS => "Xbox Series S",
}
}
}
static SERIES_S: AtomicBool = AtomicBool::new(false);
/// Set before the title starts.
pub fn set(console: Console) {
SERIES_S.store(console == Console::SeriesS, Ordering::Relaxed);
}
pub fn current() -> Console {
if SERIES_S.load(Ordering::Relaxed) {
Console::SeriesS
} else {
Console::SeriesX
}
}