Run Minecraft: runtime HLE, D3D12.X device on the host GPU, shader IR

Loader: map title-shipped DLLs, patch static TLS loads to slot 0, crash
reporter, title paths for GetModuleFileName*.

HLE: task queue and async, XUser (one offline user), system ids,
title id, features, invites, game events, persistent local storage,
GameInput with no devices, xmem, console audio hardware queues, life
cycle (close suspends, then terminates), and a file layer with virtual
drives rewritten in path-taking imports.

GPU: D3D12.X device, DXGI chain, heaps, resources, fences, queues and
command lists translated onto a host D3D12 device; clears, barriers,
copies, resolves and PresentX into the title's window.

Shaders: SGD5 reader and `victory translate`; SSA IR with node
splitting for irreducible flow; structurisation removing EXEC.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
MarvisandClaude Opus 5.5 committed 2026-11-23 14:42:21 +01:00
1 parent 12caefe804
commit 754619f30e
61 files changed
+12775 -88

No files matched your search

+83
View File
@@ -0,0 +1,83 @@
//! Command signatures: the record layout of indirect execution. Kept for
//! translating it later.
#![allow(clippy::not_unsafe_ptr_arg_deref)]
use crate::object::{
self, COMMAND_SIGNATURE, E_INVALIDARG, HRESULT, Iid, Object, Table, This, guid,
};
use crate::resource::PAGEABLE_IIDS;
const SIGNATURE_IIDS: [Iid; 4] = [
guid(
0xc36a797c,
0xec80,
0x4f0a,
[0x89, 0x85, 0xa7, 0xb2, 0x47, 0x50, 0x82, 0xd1],
),
PAGEABLE_IIDS[0],
PAGEABLE_IIDS[1],
PAGEABLE_IIDS[2],
];
#[repr(C)]
pub(crate) struct Desc {
stride: u32,
count: u32,
/// Each a type and up to three 32-bit fields.
arguments: *const [u32; 4],
nodes: u32,
}
#[repr(C)]
struct Signature {
object: Object,
stride: u32,
arguments: Vec<[u32; 4]>,
}
/// Device method.
pub(crate) extern "system" fn create(
_: This,
desc: *const Desc,
_root: This,
iid: *const Iid,
out: *mut This,
) -> HRESULT {
// SAFETY: the title passes a description (null is tolerated).
let Some(desc) = (unsafe { desc.as_ref() }) else {
return E_INVALIDARG;
};
if desc.arguments.is_null() && desc.count > 0 {
return E_INVALIDARG;
}
let arguments = if desc.count == 0 {
Vec::new()
} else {
// SAFETY: the title passes `count` argument descriptions.
unsafe { std::slice::from_raw_parts(desc.arguments, desc.count as usize) }.to_vec()
};
tracing::debug!(stride = desc.stride, ?arguments, "command signature");
let signature = Box::new(Signature {
object: Object::new(&FUNCTIONS),
stride: desc.stride,
arguments,
});
object::hand_out(COMMAND_SIGNATURE, signature, iid, &SIGNATURE_IIDS, out)
}
extern "system" fn query(this: This, iid: *const Iid, out: *mut This) -> HRESULT {
let found = object::is(iid, &SIGNATURE_IIDS).then_some(this);
object::answer(COMMAND_SIGNATURE, iid, found, out)
}
extern "system" fn release(this: This) -> u32 {
object::release_boxed::<Signature>(this)
}
/// IUnknown 3, object 4, device child 1.
static FUNCTIONS: Table<8> = {
let mut f = object::d3d12_object(object::missing_table::<COMMAND_SIGNATURE, 8>());
f[0] = query as *const ();
f[2] = release as *const ();
f[7] = object::parent_device as *const (); // 0x38
Table(f)
};