[Memory] Added option to ignore offset for ranged physical allocations

Certain titles check if input address matches output and if it doesn't then just crash
This commit is contained in:
Gliniak 2023-01-05 08:56:22 +01:00
parent 39c509b57f
commit 81aaf98e04
1 changed files with 8 additions and 1 deletions

View File

@ -17,6 +17,12 @@
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
#include "xenia/xbox.h"
DEFINE_bool(
ignore_offset_for_ranged_allocations, false,
"Allows to ignore 4k offset for physical allocations with provided range. "
"Certain titles check if result matches provided lower range.",
"Memory");
namespace xe {
namespace kernel {
namespace xboxkrnl {
@ -386,7 +392,8 @@ dword_result_t MmAllocatePhysicalMemoryEx_entry(
// TODO(Gliniak): Games like 545108B4 compares min_addr_range with value
// returned. 0x1000 offset causes it to go below that minimal range and goes
// haywire
if (min_addr_range && max_addr_range) {
if (min_addr_range && max_addr_range &&
cvars::ignore_offset_for_ranged_allocations) {
heap_physical_address_offset = 0;
}