From 81cd2506e835a61e687306a23f669ae999350070 Mon Sep 17 00:00:00 2001 From: Triang3l Date: Tue, 9 Apr 2019 13:55:37 +0300 Subject: [PATCH] [Kernel] VdSwap: Front buffer in 0xE0000000 range --- src/xenia/kernel/xboxkrnl/xboxkrnl_video.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_video.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_video.cc index 3074bd1ea..4c1085c7c 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_video.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_video.cc @@ -380,7 +380,12 @@ void VdSwap(lpvoid_t buffer_ptr, // ptr into primary ringbuffer buffer_ptr.Zero(64 * 4); // virtual -> physical - fetch.base_address &= 0x1FFFF; + // Doom 3: BFG Edition uses front buffers from the 0xE0000000 range with 4 KB + // offset, so & 0x1FFFF is not enough for this. + fetch.base_address = kernel_memory() + ->LookupHeap(fetch.base_address << 12) + ->GetPhysicalAddress(fetch.base_address << 12) >> + 12; uint32_t offset = 0; auto dwords = buffer_ptr.as_array(); @@ -397,7 +402,9 @@ void VdSwap(lpvoid_t buffer_ptr, // ptr into primary ringbuffer dwords[offset++] = xenos::MakePacketType3(xenos::PM4_XE_SWAP, 4); dwords[offset++] = 'SWAP'; - dwords[offset++] = (*frontbuffer_ptr) & 0x1FFFFFFF; + dwords[offset++] = kernel_memory() + ->LookupHeap(*frontbuffer_ptr) + ->GetPhysicalAddress(*frontbuffer_ptr); dwords[offset++] = *width; dwords[offset++] = *height;