pub mod core; pub mod formats; pub mod loader; pub mod offline_pipeline; pub mod pe; pub mod shader; #[cfg(windows)] mod ahead; mod hot_local; #[cfg(windows)] mod alias_rt; #[cfg(windows)] mod barstat; mod ambient; #[cfg(windows)] mod mirror; #[cfg(all(windows, feature = "diagnostics"))] mod capture; mod spin; #[cfg(windows)] mod cardmeter; #[cfg(windows)] pub mod cardpool; pub mod memory_model; mod memory_policy; #[cfg(windows)] mod arena; #[cfg(windows)] pub mod copycount; #[cfg(windows)] mod gpureads; #[cfg(windows)] mod chain; #[cfg(windows)] pub mod screenshot; #[cfg(windows)] mod compose; pub mod console; #[cfg(all(windows, feature = "diagnostics"))] mod copystat; #[cfg(not(all(windows, feature = "diagnostics")))] #[global_allocator] static HEAP: mimalloc::MiMalloc = mimalloc::MiMalloc; #[cfg(all(windows, feature = "diagnostics"))] mod memprobe; #[cfg(all(windows, feature = "diagnostics"))] mod faultbook; #[cfg(windows)] mod cores; pub mod descriptor; pub mod device; #[cfg(windows)] mod draw; #[cfg(windows)] pub mod dxr; pub mod dxgi; #[cfg(windows)] mod external; #[cfg(windows)] mod fileback; #[cfg(windows)] pub fn cpu_mirror_files(folder: std::path::PathBuf) -> std::io::Result<()> { shadow::cpu_mirror_files(folder) } pub mod fence; pub mod frame; #[cfg(all(windows, feature = "diagnostics"))] mod book; #[cfg(windows)] mod gpudetile; #[cfg(windows)] mod heap_marks; #[cfg(windows)] pub mod heap_hooks; #[cfg(windows)] mod host; #[cfg(windows)] pub use host::{settings_pad_capture, settings_pad_key}; #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum SettingsPadMode { Off, MenuOnly, StickShortcut, } #[cfg(windows)] pub fn settings_pad_mode() -> SettingsPadMode { static MODE: std::sync::OnceLock = std::sync::OnceLock::new(); *MODE.get_or_init(|| match std::env::var("EONACAT_XS_MENU_PAD").as_deref() { Ok("menu") => SettingsPadMode::MenuOnly, Ok("1") => SettingsPadMode::StickShortcut, _ => SettingsPadMode::Off, }) } pub static SETTINGS_MENU_OPEN: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false); pub static MNK_BINDINGS_CHANGED: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(0); pub static SETTINGS_MENU_WHEEL: std::sync::atomic::AtomicI32 = std::sync::atomic::AtomicI32::new(0); pub fn push_settings_menu_wheel(delta: i16) { if SETTINGS_MENU_OPEN.load(std::sync::atomic::Ordering::Relaxed) { SETTINGS_MENU_WHEEL.fetch_add(i32::from(delta), std::sync::atomic::Ordering::Relaxed); } } pub fn take_settings_menu_wheel_notches() -> i32 { const WHEEL_DELTA: i32 = 120; let mut cur = SETTINGS_MENU_WHEEL.load(std::sync::atomic::Ordering::Relaxed); loop { let notches = cur / WHEEL_DELTA; if notches == 0 { return 0; } let rem = cur % WHEEL_DELTA; match SETTINGS_MENU_WHEEL.compare_exchange_weak( cur, rem, std::sync::atomic::Ordering::Relaxed, std::sync::atomic::Ordering::Relaxed, ) { Ok(_) => return notches, Err(actual) => cur = actual, } } } #[cfg(windows)] pub mod hwrt; #[cfg(windows)] mod indirect; #[cfg(windows)] mod hlsl; mod mesh_rest; #[cfg(windows)] mod inplace; #[cfg(windows)] mod port; #[cfg(windows)] pub fn port_constants_on() -> bool { port::on() } #[cfg(windows)] mod port_cbv; #[cfg(windows)] mod land; pub mod list; pub mod object; pub mod pipeline; #[cfg(windows)] mod picked; #[cfg(windows)] mod pool; #[cfg(all(windows, feature = "diagnostics"))] mod popwatch; #[cfg(windows)] pub mod procmem; #[cfg(windows)] mod primitive; pub mod query; pub mod queue; #[cfg(all(windows, feature = "diagnostics"))] pub mod replay; #[cfg(windows)] mod residency; mod fetchmem; mod memguard; mod compilemem; pub mod resource; pub mod save_share; pub mod root; #[cfg(windows)] mod safecopy; #[cfg(windows)] mod sampler; #[cfg(windows)] mod sampled; #[cfg(windows)] pub mod shader_cache; #[cfg(windows)] pub mod memcalls; #[cfg(windows)] mod memory; #[cfg(windows)] mod pairmiss; #[cfg(windows)] mod rtcard; #[cfg(windows)] mod shadow; #[cfg(windows)] mod tiles; pub mod signature; #[cfg(windows)] pub mod start_notice; #[cfg(windows)] pub mod streamline; #[cfg(windows)] pub mod upscale_fallback; mod switch; mod hot; #[cfg(all(windows, any(feature = "diagnostics", feature = "ab")))] mod ab; #[cfg(all(windows, any(feature = "diagnostics", feature = "ab")))] pub fn ab_pick(switch: &str) -> Option { ab::pick(switch) } #[cfg(all(windows, any(feature = "diagnostics", feature = "ab")))] pub fn ab_on_change(hook: fn(&str, bool)) { ab::on_change(hook); } #[cfg(windows)] mod tdr; #[cfg(windows)] mod texture; pub mod timeline; #[cfg(windows)] pub mod titlewrite; #[cfg(windows)] mod upload; #[cfg(windows)] pub mod window; #[cfg(all(windows, feature = "diagnostics"))] mod facewatch; #[cfg(windows)] mod watch; #[cfg(windows)] mod texback; #[cfg(windows)] pub use spin::spin_stick; pub use host::on_failure; pub use host::log_defrag_counters; #[cfg(windows)] pub use host::trim_spare_chunks; #[cfg(windows)] pub use upload::reserve_space as reserve_upload_space; #[cfg(all(windows, any(feature = "diagnostics", feature = "ab")))] pub fn switched(switch: &str) -> Option { ab::pick(switch) } #[cfg(all(windows, feature = "diagnostics"))] pub fn frame_phase() -> u32 { copystat::phase() } #[cfg(windows)] pub fn place_process() { cores::place_process(); } #[cfg(windows)] pub fn keep_off_the_frames_cores(what: &str) { cores::keep_off_the_frames_cores(what); } pub fn off_the_frames_cores() -> usize { #[cfg(windows)] { cores::off_the_frames_cores() } #[cfg(not(windows))] { std::thread::available_parallelism().map_or(4, |n| n.get()) } } pub fn frames_begun() -> u64 { frame::current() } pub fn world_since() -> Option { WORLD_SINCE.get().copied() } static WORLD_SINCE: std::sync::OnceLock = std::sync::OnceLock::new(); #[cfg(windows)] pub(crate) fn world_frame(drawn: u64) { use std::sync::atomic::{AtomicU64, Ordering::Relaxed}; static LAST: AtomicU64 = AtomicU64::new(0); let before = LAST.swap(drawn, Relaxed); crate::frame::frame_drew(drawn.saturating_sub(before)); if WORLD_SINCE.get().is_none() && world_reached(before, drawn) && WORLD_SINCE.set(std::time::Instant::now()).is_ok() { tracing::info!(frames = frames_begun(), "the world: the first frame of 500 draws or more"); } } fn world_reached(before: u64, drawn: u64) -> bool { drawn.saturating_sub(before) >= 500 } #[cfg(windows)] pub use inplace::{title_memory_freeing, title_memory_section, title_memory_section_gone, title_memory_view}; #[cfg(windows)] pub use shadow::{ title_memory_gpu_readonly, title_memory_gpu_writable, title_memory_protection, title_memory_write_combined, }; #[cfg(windows)] pub use arena::arena_reserved; #[cfg(windows)] pub use watch::{ SoftViews, kernel_writing, soft_view_guards, title_memory_allocated, title_memory_freed, title_memory_made_real, title_memory_by_range, title_memory_notes_gathered, title_memory_reading, title_memory_reading_of, title_memory_reading_of_now, title_memory_remapped, title_memory_remapping, title_memory_remapping_of, title_memory_splitting, title_memory_unmapping, title_memory_written, bink_frame_written, title_placeholder_reserved, use_lazy_views, use_soft_views, stream_written as stream_memory_written, writing as kernel_will_write, Remapping, }; #[doc(hidden)] pub use watch::set_range_lock;