Adding some required video export variables.

This commit is contained in:
Ben Vanik 2013-05-29 21:26:29 -07:00
parent 6950b21424
commit 37530d1438
2 changed files with 40 additions and 0 deletions

View File

@ -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() {

View File

@ -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);
}