diff --git a/src/xenia/kernel/modules/xboxkrnl/module.cc b/src/xenia/kernel/modules/xboxkrnl/module.cc index 479f6b2cc..a8b2bec59 100644 --- a/src/xenia/kernel/modules/xboxkrnl/module.cc +++ b/src/xenia/kernel/modules/xboxkrnl/module.cc @@ -113,6 +113,18 @@ XboxkrnlModule::XboxkrnlModule(Runtime* runtime) : char command_line[] = "\"default.xex\""; xe_copy_memory(mem + pExLoadedCommandLine, 1024, command_line, XECOUNT(command_line) + 1); + + // XboxKrnlVersion (8b) + // Kernel version, looks like 2b.2b.2b.2b. + // I've only seen games check >=, so we just fake something here. + uint32_t pXboxKrnlVersion = xe_memory_heap_alloc(memory_, 0, 8, 0); + resolver->SetVariableMapping( + "xboxkrnl.exe", ordinals::XboxKrnlVersion, + pXboxKrnlVersion); + XESETUINT16BE(mem + pXboxKrnlVersion + 0, 2); + XESETUINT16BE(mem + pXboxKrnlVersion + 2, 0xFFFF); + XESETUINT16BE(mem + pXboxKrnlVersion + 4, 0xFFFF); + XESETUINT16BE(mem + pXboxKrnlVersion + 6, 0xFFFF); } XboxkrnlModule::~XboxkrnlModule() { diff --git a/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_video.cc b/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_video.cc index 93530a1ea..80fe290ac 100644 --- a/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_video.cc +++ b/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_video.cc @@ -175,4 +175,32 @@ void xe::kernel::xboxkrnl::RegisterVideoExports( SHIM_SET_MAPPING("xboxkrnl.exe", VdQueryVideoMode, state); SHIM_SET_MAPPING("xboxkrnl.exe", VdInitializeEngines, state); SHIM_SET_MAPPING("xboxkrnl.exe", VdSetGraphicsInterruptCallback, state); + + xe_memory_ref memory = state->memory(); + uint8_t* mem = xe_memory_addr(memory); + + // VdGlobalDevice (4b) + // Pointer to a global D3D device. Games only seem to set this, so we don't + // have to do anything. We may want to read it back later, though. + uint32_t pVdGlobalDevice = xe_memory_heap_alloc(memory, 0, 4, 0); + export_resolver->SetVariableMapping( + "xboxkrnl.exe", ordinals::VdGlobalDevice, + pVdGlobalDevice); + XESETUINT32BE(mem + pVdGlobalDevice, 0); + + // VdGlobalXamDevice (4b) + // Pointer to the XAM D3D device, which we don't have. + uint32_t pVdGlobalXamDevice = xe_memory_heap_alloc(memory, 0, 4, 0); + export_resolver->SetVariableMapping( + "xboxkrnl.exe", ordinals::VdGlobalXamDevice, + pVdGlobalXamDevice); + XESETUINT32BE(mem + pVdGlobalXamDevice, 0); + + // VdGpuClockInMHz (4b) + // GPU clock. Xenos is 500MHz. Hope nothing is relying on this timing... + uint32_t pVdGpuClockInMHz = xe_memory_heap_alloc(memory, 0, 4, 0); + export_resolver->SetVariableMapping( + "xboxkrnl.exe", ordinals::VdGpuClockInMHz, + pVdGpuClockInMHz); + XESETUINT32BE(mem + pVdGpuClockInMHz, 500); }