mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-09-20 17:51:13 +02:00
Heap adjustments/fixes
* Restore 6 GiB heap for 4 GiB DRAM selection * Limit heap to 8 GiB for games that crash or won't load with extended heaps
This commit is contained in:
@@ -8,6 +8,7 @@ using System;
|
|||||||
using System.Buffers;
|
using System.Buffers;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using static Ryujinx.Graphics.Gpu.GraphicsConfig;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Kernel.Memory
|
namespace Ryujinx.HLE.HOS.Kernel.Memory
|
||||||
{
|
{
|
||||||
@@ -183,6 +184,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
|
|||||||
|
|
||||||
AliasRegionExtraSize = 0;
|
AliasRegionExtraSize = 0;
|
||||||
|
|
||||||
|
// Limit heap for games that crash or won't load with extended heaps
|
||||||
|
bool isHeapLimited = TitleId is "0100965017338000" or "010038b015560000";
|
||||||
|
|
||||||
switch (flags & ProcessCreationFlags.AddressSpaceMask)
|
switch (flags & ProcessCreationFlags.AddressSpaceMask)
|
||||||
{
|
{
|
||||||
case ProcessCreationFlags.AddressSpace32Bit:
|
case ProcessCreationFlags.AddressSpace32Bit:
|
||||||
@@ -201,11 +205,10 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
|
|||||||
case ProcessCreationFlags.AddressSpace64BitDeprecated:
|
case ProcessCreationFlags.AddressSpace64BitDeprecated:
|
||||||
aliasRegion.Size = 0x180000000;
|
aliasRegion.Size = 0x180000000;
|
||||||
heapRegion.Size = memConfig switch {
|
heapRegion.Size = memConfig switch {
|
||||||
MemoryConfiguration.MemoryConfiguration6GiB => 0x180000000u,
|
|
||||||
MemoryConfiguration.MemoryConfiguration8GiB => 0x200000000u,
|
MemoryConfiguration.MemoryConfiguration8GiB => 0x200000000u,
|
||||||
MemoryConfiguration.MemoryConfiguration10GiB => 0x280000000u,
|
MemoryConfiguration.MemoryConfiguration10GiB when !isHeapLimited => 0x280000000u,
|
||||||
MemoryConfiguration.MemoryConfiguration12GiB => 0x300000000u,
|
MemoryConfiguration.MemoryConfiguration12GiB when !isHeapLimited => 0x300000000u,
|
||||||
_ => 0x100000000u
|
_ => 0x180000000u
|
||||||
};
|
};
|
||||||
stackRegion.Size = 0;
|
stackRegion.Size = 0;
|
||||||
tlsIoRegion.Size = 0;
|
tlsIoRegion.Size = 0;
|
||||||
@@ -238,11 +241,10 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
|
|||||||
|
|
||||||
aliasRegion.Size = reservedAddressSpaceSize >= 0x1800000000 ? 0x1000000000 : 1UL << (addressSpaceWidth - 3);
|
aliasRegion.Size = reservedAddressSpaceSize >= 0x1800000000 ? 0x1000000000 : 1UL << (addressSpaceWidth - 3);
|
||||||
heapRegion.Size = memConfig switch {
|
heapRegion.Size = memConfig switch {
|
||||||
MemoryConfiguration.MemoryConfiguration6GiB => 0x180000000u,
|
|
||||||
MemoryConfiguration.MemoryConfiguration8GiB => 0x200000000u,
|
MemoryConfiguration.MemoryConfiguration8GiB => 0x200000000u,
|
||||||
MemoryConfiguration.MemoryConfiguration10GiB => 0x280000000u,
|
MemoryConfiguration.MemoryConfiguration10GiB when !isHeapLimited => 0x280000000u,
|
||||||
MemoryConfiguration.MemoryConfiguration12GiB => 0x300000000u,
|
MemoryConfiguration.MemoryConfiguration12GiB when !isHeapLimited => 0x300000000u,
|
||||||
_ => 0x100000000u
|
_ => 0x180000000u
|
||||||
};
|
};
|
||||||
stackRegion.Size = 1UL << (addressSpaceWidth - 8);
|
stackRegion.Size = 1UL << (addressSpaceWidth - 8);
|
||||||
tlsIoRegion.Size = 1UL << (addressSpaceWidth - 3);
|
tlsIoRegion.Size = 1UL << (addressSpaceWidth - 3);
|
||||||
@@ -258,11 +260,10 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
|
|||||||
{
|
{
|
||||||
aliasRegion.Size = 0x1000000000;
|
aliasRegion.Size = 0x1000000000;
|
||||||
heapRegion.Size = memConfig switch {
|
heapRegion.Size = memConfig switch {
|
||||||
MemoryConfiguration.MemoryConfiguration6GiB => 0x180000000u,
|
|
||||||
MemoryConfiguration.MemoryConfiguration8GiB => 0x200000000u,
|
MemoryConfiguration.MemoryConfiguration8GiB => 0x200000000u,
|
||||||
MemoryConfiguration.MemoryConfiguration10GiB => 0x280000000u,
|
MemoryConfiguration.MemoryConfiguration10GiB when !isHeapLimited => 0x280000000u,
|
||||||
MemoryConfiguration.MemoryConfiguration12GiB => 0x300000000u,
|
MemoryConfiguration.MemoryConfiguration12GiB when !isHeapLimited => 0x300000000u,
|
||||||
_ => 0x100000000u
|
_ => 0x180000000u
|
||||||
};
|
};
|
||||||
stackRegion.Size = 0x80000000;
|
stackRegion.Size = 0x80000000;
|
||||||
tlsIoRegion.Size = 0x1000000000;
|
tlsIoRegion.Size = 0x1000000000;
|
||||||
|
|||||||
Reference in New Issue
Block a user