|
|
@@ -198,6 +198,7 @@ fn diagnostics(image: &victory_loader::LoadedImage, cfg: &victory_core::Config)
|
|
|
victory_loader::dump_stacks_on_schedule();
|
|
|
victory_hle::modules::audio::capture::start();
|
|
|
watch(image.base(), image.info().size_of_image as usize);
|
|
|
+ poke(image.base(), image.info().size_of_image as usize);
|
|
|
// Debugging aid: `VICTORY_CRASH_SAVE=<rva>:<len>,...` (hex) writes those
|
|
|
// title ranges to `crash-<rva>.bin` in the cache dir on a crash.
|
|
|
let size = image.info().size_of_image as usize;
|
|
|
@@ -245,6 +246,34 @@ fn watch(base: usize, size: usize) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+/// Debugging aid: `VICTORY_POKE=<rva>:<byte>,...` (hex) writes the byte at
|
|
|
+/// each title+rva twice a second. A title that ends itself when its main
|
|
|
+/// loop has not ticked for a while (Grand Theft Auto VI: 30 s) runs on
|
|
|
+/// through slower frames with its tick flag poked. The address must be
|
|
|
+/// writable title data.
|
|
|
+#[cfg(all(windows, feature = "diagnostics"))]
|
|
|
+fn poke(base: usize, size: usize) {
|
|
|
+ let Ok(list) = std::env::var("VICTORY_POKE") else {
|
|
|
+ return;
|
|
|
+ };
|
|
|
+ let hex = |s: &str| usize::from_str_radix(s.trim().trim_start_matches("0x"), 16).ok();
|
|
|
+ let pokes: Vec<(usize, u8)> = list
|
|
|
+ .split(',')
|
|
|
+ .filter_map(|p| p.split_once(':'))
|
|
|
+ .filter_map(|(rva, byte)| Some((hex(rva)?, u8::try_from(hex(byte)?).ok()?)))
|
|
|
+ .filter(|&(rva, _)| rva < size)
|
|
|
+ .collect();
|
|
|
+ std::thread::spawn(move || {
|
|
|
+ loop {
|
|
|
+ for &(rva, byte) in &pokes {
|
|
|
+ // SAFETY: a byte inside the mapped image, checked above.
|
|
|
+ unsafe { ((base + rva) as *mut u8).write_volatile(byte) };
|
|
|
+ }
|
|
|
+ std::thread::sleep(std::time::Duration::from_millis(500));
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
/// DLLs the host or our runtime provide are never taken from the title.
|
|
|
#[cfg(windows)]
|
|
|
fn title_dll(host: &victory_hle::HostPolicy, dll: &str) -> bool {
|