Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 71bcf0ff49 | |||
| 834531483f | |||
| 09b225e928 | |||
| 9886d49204 | |||
| 4e9c4587e5 | |||
| f441d3e01d | |||
| cf1ad265f9 | |||
| 6773343d46 | |||
| 45af4d2517 | |||
| c279c7d5de | |||
| 753ca01c0d | |||
| 5aedeebfe9 | |||
| 5c67efd291 | |||
| b2354768c4 | |||
| 745bd91250 | |||
| 07ab817557 | |||
| 0e8a41b198 | |||
| 969e94f913 | |||
| 2e2d26d49d |
@@ -7,6 +7,7 @@ namespace ARMeilleure.Memory
|
|||||||
public const int DefaultGranularity = 65536; // Mapping granularity in Windows.
|
public const int DefaultGranularity = 65536; // Mapping granularity in Windows.
|
||||||
|
|
||||||
public IJitMemoryBlock Block { get; }
|
public IJitMemoryBlock Block { get; }
|
||||||
|
public IJitMemoryAllocator Allocator { get; }
|
||||||
|
|
||||||
public nint Pointer => Block.Pointer;
|
public nint Pointer => Block.Pointer;
|
||||||
|
|
||||||
@@ -21,6 +22,7 @@ namespace ARMeilleure.Memory
|
|||||||
granularity = DefaultGranularity;
|
granularity = DefaultGranularity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Allocator = allocator;
|
||||||
Block = allocator.Reserve(maxSize);
|
Block = allocator.Reserve(maxSize);
|
||||||
_maxSize = maxSize;
|
_maxSize = maxSize;
|
||||||
_sizeGranularity = granularity;
|
_sizeGranularity = granularity;
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ using ARMeilleure.CodeGen;
|
|||||||
using ARMeilleure.CodeGen.Unwinding;
|
using ARMeilleure.CodeGen.Unwinding;
|
||||||
using ARMeilleure.Memory;
|
using ARMeilleure.Memory;
|
||||||
using ARMeilleure.Native;
|
using ARMeilleure.Native;
|
||||||
|
using Humanizer;
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -18,9 +20,8 @@ namespace ARMeilleure.Translation.Cache
|
|||||||
private static readonly int _pageMask = _pageSize - 1;
|
private static readonly int _pageMask = _pageSize - 1;
|
||||||
|
|
||||||
private const int CodeAlignment = 4; // Bytes.
|
private const int CodeAlignment = 4; // Bytes.
|
||||||
private const int CacheSize = 2047 * 1024 * 1024;
|
private const int CacheSize = 256 * 1024 * 1024;
|
||||||
|
|
||||||
private static ReservedRegion _jitRegion;
|
|
||||||
private static JitCacheInvalidation _jitCacheInvalidator;
|
private static JitCacheInvalidation _jitCacheInvalidator;
|
||||||
|
|
||||||
private static CacheMemoryAllocator _cacheAllocator;
|
private static CacheMemoryAllocator _cacheAllocator;
|
||||||
@@ -30,6 +31,9 @@ namespace ARMeilleure.Translation.Cache
|
|||||||
private static readonly Lock _lock = new();
|
private static readonly Lock _lock = new();
|
||||||
private static bool _initialized;
|
private static bool _initialized;
|
||||||
|
|
||||||
|
private static readonly List<ReservedRegion> _jitRegions = new();
|
||||||
|
private static int _activeRegionIndex = 0;
|
||||||
|
|
||||||
[SupportedOSPlatform("windows")]
|
[SupportedOSPlatform("windows")]
|
||||||
[LibraryImport("kernel32.dll", SetLastError = true)]
|
[LibraryImport("kernel32.dll", SetLastError = true)]
|
||||||
public static partial nint FlushInstructionCache(nint hProcess, nint lpAddress, nuint dwSize);
|
public static partial nint FlushInstructionCache(nint hProcess, nint lpAddress, nuint dwSize);
|
||||||
@@ -48,7 +52,9 @@ namespace ARMeilleure.Translation.Cache
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_jitRegion = new ReservedRegion(allocator, CacheSize);
|
var firstRegion = new ReservedRegion(allocator, CacheSize);
|
||||||
|
_jitRegions.Add(firstRegion);
|
||||||
|
_activeRegionIndex = 0;
|
||||||
|
|
||||||
if (!OperatingSystem.IsWindows() && !OperatingSystem.IsMacOS())
|
if (!OperatingSystem.IsWindows() && !OperatingSystem.IsMacOS())
|
||||||
{
|
{
|
||||||
@@ -59,7 +65,9 @@ namespace ARMeilleure.Translation.Cache
|
|||||||
|
|
||||||
if (OperatingSystem.IsWindows())
|
if (OperatingSystem.IsWindows())
|
||||||
{
|
{
|
||||||
JitUnwindWindows.InstallFunctionTableHandler(_jitRegion.Pointer, CacheSize, _jitRegion.Pointer + Allocate(_pageSize));
|
JitUnwindWindows.InstallFunctionTableHandler(
|
||||||
|
firstRegion.Pointer, CacheSize, firstRegion.Pointer + Allocate(_pageSize)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
@@ -75,8 +83,8 @@ namespace ARMeilleure.Translation.Cache
|
|||||||
Debug.Assert(_initialized);
|
Debug.Assert(_initialized);
|
||||||
|
|
||||||
int funcOffset = Allocate(code.Length);
|
int funcOffset = Allocate(code.Length);
|
||||||
|
ReservedRegion targetRegion = _jitRegions[_activeRegionIndex];
|
||||||
nint funcPtr = _jitRegion.Pointer + funcOffset;
|
nint funcPtr = targetRegion.Pointer + funcOffset;
|
||||||
|
|
||||||
if (OperatingSystem.IsMacOS() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
|
if (OperatingSystem.IsMacOS() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
|
||||||
{
|
{
|
||||||
@@ -90,9 +98,9 @@ namespace ARMeilleure.Translation.Cache
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ReprotectAsWritable(funcOffset, code.Length);
|
ReprotectAsWritable(targetRegion, funcOffset, code.Length);
|
||||||
Marshal.Copy(code, 0, funcPtr, code.Length);
|
Marshal.Copy(code, 0, funcPtr, code.Length);
|
||||||
ReprotectAsExecutable(funcOffset, code.Length);
|
ReprotectAsExecutable(targetRegion, funcOffset, code.Length);
|
||||||
|
|
||||||
if (OperatingSystem.IsWindows() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
|
if (OperatingSystem.IsWindows() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
|
||||||
{
|
{
|
||||||
@@ -116,52 +124,83 @@ namespace ARMeilleure.Translation.Cache
|
|||||||
{
|
{
|
||||||
Debug.Assert(_initialized);
|
Debug.Assert(_initialized);
|
||||||
|
|
||||||
int funcOffset = (int)(pointer.ToInt64() - _jitRegion.Pointer.ToInt64());
|
foreach (var region in _jitRegions)
|
||||||
|
|
||||||
if (TryFind(funcOffset, out CacheEntry entry, out int entryIndex) && entry.Offset == funcOffset)
|
|
||||||
{
|
{
|
||||||
_cacheAllocator.Free(funcOffset, AlignCodeSize(entry.Size));
|
if (pointer.ToInt64() < region.Pointer.ToInt64() ||
|
||||||
_cacheEntries.RemoveAt(entryIndex);
|
pointer.ToInt64() >= (region.Pointer + CacheSize).ToInt64())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int funcOffset = (int)(pointer.ToInt64() - region.Pointer.ToInt64());
|
||||||
|
|
||||||
|
if (TryFind(funcOffset, out CacheEntry entry, out int entryIndex) && entry.Offset == funcOffset)
|
||||||
|
{
|
||||||
|
_cacheAllocator.Free(funcOffset, AlignCodeSize(entry.Size));
|
||||||
|
_cacheEntries.RemoveAt(entryIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ReprotectAsWritable(int offset, int size)
|
private static void ReprotectAsWritable(ReservedRegion region, int offset, int size)
|
||||||
{
|
{
|
||||||
int endOffs = offset + size;
|
int endOffs = offset + size;
|
||||||
|
|
||||||
int regionStart = offset & ~_pageMask;
|
int regionStart = offset & ~_pageMask;
|
||||||
int regionEnd = (endOffs + _pageMask) & ~_pageMask;
|
int regionEnd = (endOffs + _pageMask) & ~_pageMask;
|
||||||
|
|
||||||
_jitRegion.Block.MapAsRwx((ulong)regionStart, (ulong)(regionEnd - regionStart));
|
region.Block.MapAsRwx((ulong)regionStart, (ulong)(regionEnd - regionStart));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ReprotectAsExecutable(int offset, int size)
|
private static void ReprotectAsExecutable(ReservedRegion region, int offset, int size)
|
||||||
{
|
{
|
||||||
int endOffs = offset + size;
|
int endOffs = offset + size;
|
||||||
|
|
||||||
int regionStart = offset & ~_pageMask;
|
int regionStart = offset & ~_pageMask;
|
||||||
int regionEnd = (endOffs + _pageMask) & ~_pageMask;
|
int regionEnd = (endOffs + _pageMask) & ~_pageMask;
|
||||||
|
|
||||||
_jitRegion.Block.MapAsRx((ulong)regionStart, (ulong)(regionEnd - regionStart));
|
region.Block.MapAsRx((ulong)regionStart, (ulong)(regionEnd - regionStart));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int Allocate(int codeSize)
|
private static int Allocate(int codeSize)
|
||||||
{
|
{
|
||||||
codeSize = AlignCodeSize(codeSize);
|
codeSize = AlignCodeSize(codeSize);
|
||||||
|
|
||||||
int allocOffset = _cacheAllocator.Allocate(codeSize);
|
for (int i = _activeRegionIndex; i < _jitRegions.Count; i++)
|
||||||
|
|
||||||
if (allocOffset < 0)
|
|
||||||
{
|
{
|
||||||
throw new OutOfMemoryException("JIT Cache exhausted.");
|
int allocOffset = _cacheAllocator.Allocate(codeSize);
|
||||||
|
|
||||||
|
if (allocOffset >= 0)
|
||||||
|
{
|
||||||
|
_jitRegions[i].ExpandIfNeeded((ulong)allocOffset + (ulong)codeSize);
|
||||||
|
_activeRegionIndex = i;
|
||||||
|
return allocOffset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_jitRegion.ExpandIfNeeded((ulong)allocOffset + (ulong)codeSize);
|
int exhaustedRegion = _activeRegionIndex;
|
||||||
|
var newRegion = new ReservedRegion(_jitRegions[0].Allocator, CacheSize);
|
||||||
|
_jitRegions.Add(newRegion);
|
||||||
|
_activeRegionIndex = _jitRegions.Count - 1;
|
||||||
|
|
||||||
|
int newRegionNumber = _activeRegionIndex;
|
||||||
|
|
||||||
return allocOffset;
|
Logger.Warning?.Print(LogClass.Cpu, $"JIT Cache Region {exhaustedRegion} exhausted, creating new Cache Region {newRegionNumber} ({((newRegionNumber + 1) * CacheSize).Bytes()} Total Allocation).");
|
||||||
|
|
||||||
|
_cacheAllocator = new CacheMemoryAllocator(CacheSize);
|
||||||
|
|
||||||
|
int allocOffsetNew = _cacheAllocator.Allocate(codeSize);
|
||||||
|
if (allocOffsetNew < 0)
|
||||||
|
{
|
||||||
|
throw new OutOfMemoryException("Failed to allocate in new Cache Region!");
|
||||||
|
}
|
||||||
|
|
||||||
|
newRegion.ExpandIfNeeded((ulong)allocOffsetNew + (ulong)codeSize);
|
||||||
|
return allocOffsetNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static int AlignCodeSize(int codeSize)
|
private static int AlignCodeSize(int codeSize)
|
||||||
{
|
{
|
||||||
return checked(codeSize + (CodeAlignment - 1)) & ~(CodeAlignment - 1);
|
return checked(codeSize + (CodeAlignment - 1)) & ~(CodeAlignment - 1);
|
||||||
@@ -185,18 +224,21 @@ namespace ARMeilleure.Translation.Cache
|
|||||||
{
|
{
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
int index = _cacheEntries.BinarySearch(new CacheEntry(offset, 0, default));
|
foreach (var region in _jitRegions)
|
||||||
|
|
||||||
if (index < 0)
|
|
||||||
{
|
{
|
||||||
index = ~index - 1;
|
int index = _cacheEntries.BinarySearch(new CacheEntry(offset, 0, default));
|
||||||
}
|
|
||||||
|
|
||||||
if (index >= 0)
|
if (index < 0)
|
||||||
{
|
{
|
||||||
entry = _cacheEntries[index];
|
index = ~index - 1;
|
||||||
entryIndex = index;
|
}
|
||||||
return true;
|
|
||||||
|
if (index >= 0)
|
||||||
|
{
|
||||||
|
entry = _cacheEntries[index];
|
||||||
|
entryIndex = index;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using ARMeilleure.Memory;
|
using ARMeilleure.Memory;
|
||||||
|
using Humanizer;
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -15,9 +17,8 @@ namespace Ryujinx.Cpu.LightningJit.Cache
|
|||||||
private static readonly int _pageMask = _pageSize - 1;
|
private static readonly int _pageMask = _pageSize - 1;
|
||||||
|
|
||||||
private const int CodeAlignment = 4; // Bytes.
|
private const int CodeAlignment = 4; // Bytes.
|
||||||
private const int CacheSize = 2047 * 1024 * 1024;
|
private const int CacheSize = 256 * 1024 * 1024;
|
||||||
|
|
||||||
private static ReservedRegion _jitRegion;
|
|
||||||
private static JitCacheInvalidation _jitCacheInvalidator;
|
private static JitCacheInvalidation _jitCacheInvalidator;
|
||||||
|
|
||||||
private static CacheMemoryAllocator _cacheAllocator;
|
private static CacheMemoryAllocator _cacheAllocator;
|
||||||
@@ -26,6 +27,8 @@ namespace Ryujinx.Cpu.LightningJit.Cache
|
|||||||
|
|
||||||
private static readonly Lock _lock = new();
|
private static readonly Lock _lock = new();
|
||||||
private static bool _initialized;
|
private static bool _initialized;
|
||||||
|
private static readonly List<ReservedRegion> _jitRegions = new();
|
||||||
|
private static int _activeRegionIndex = 0;
|
||||||
|
|
||||||
[SupportedOSPlatform("windows")]
|
[SupportedOSPlatform("windows")]
|
||||||
[LibraryImport("kernel32.dll", SetLastError = true)]
|
[LibraryImport("kernel32.dll", SetLastError = true)]
|
||||||
@@ -45,7 +48,9 @@ namespace Ryujinx.Cpu.LightningJit.Cache
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_jitRegion = new ReservedRegion(allocator, CacheSize);
|
var firstRegion = new ReservedRegion(allocator, CacheSize);
|
||||||
|
_jitRegions.Add(firstRegion);
|
||||||
|
_activeRegionIndex = 0;
|
||||||
|
|
||||||
if (!OperatingSystem.IsWindows() && !OperatingSystem.IsMacOS())
|
if (!OperatingSystem.IsWindows() && !OperatingSystem.IsMacOS())
|
||||||
{
|
{
|
||||||
@@ -65,8 +70,8 @@ namespace Ryujinx.Cpu.LightningJit.Cache
|
|||||||
Debug.Assert(_initialized);
|
Debug.Assert(_initialized);
|
||||||
|
|
||||||
int funcOffset = Allocate(code.Length);
|
int funcOffset = Allocate(code.Length);
|
||||||
|
ReservedRegion targetRegion = _jitRegions[_activeRegionIndex];
|
||||||
nint funcPtr = _jitRegion.Pointer + funcOffset;
|
nint funcPtr = targetRegion.Pointer + funcOffset;
|
||||||
|
|
||||||
if (OperatingSystem.IsMacOS() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
|
if (OperatingSystem.IsMacOS() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
|
||||||
{
|
{
|
||||||
@@ -80,18 +85,11 @@ namespace Ryujinx.Cpu.LightningJit.Cache
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ReprotectAsWritable(funcOffset, code.Length);
|
ReprotectAsWritable(targetRegion, funcOffset, code.Length);
|
||||||
code.CopyTo(new Span<byte>((void*)funcPtr, code.Length));
|
Marshal.Copy(code.ToArray(), 0, funcPtr, code.Length);
|
||||||
ReprotectAsExecutable(funcOffset, code.Length);
|
ReprotectAsExecutable(targetRegion, funcOffset, code.Length);
|
||||||
|
|
||||||
if (OperatingSystem.IsWindows() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
|
_jitCacheInvalidator?.Invalidate(funcPtr, (ulong)code.Length);
|
||||||
{
|
|
||||||
FlushInstructionCache(Process.GetCurrentProcess().Handle, funcPtr, (nuint)code.Length);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_jitCacheInvalidator?.Invalidate(funcPtr, (ulong)code.Length);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Add(funcOffset, code.Length);
|
Add(funcOffset, code.Length);
|
||||||
@@ -106,50 +104,80 @@ namespace Ryujinx.Cpu.LightningJit.Cache
|
|||||||
{
|
{
|
||||||
Debug.Assert(_initialized);
|
Debug.Assert(_initialized);
|
||||||
|
|
||||||
int funcOffset = (int)(pointer.ToInt64() - _jitRegion.Pointer.ToInt64());
|
foreach (var region in _jitRegions)
|
||||||
|
|
||||||
if (TryFind(funcOffset, out CacheEntry entry, out int entryIndex) && entry.Offset == funcOffset)
|
|
||||||
{
|
{
|
||||||
_cacheAllocator.Free(funcOffset, AlignCodeSize(entry.Size));
|
if (pointer.ToInt64() < region.Pointer.ToInt64() ||
|
||||||
_cacheEntries.RemoveAt(entryIndex);
|
pointer.ToInt64() >= (region.Pointer + CacheSize).ToInt64())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int funcOffset = (int)(pointer.ToInt64() - region.Pointer.ToInt64());
|
||||||
|
|
||||||
|
if (TryFind(funcOffset, out CacheEntry entry, out int entryIndex) && entry.Offset == funcOffset)
|
||||||
|
{
|
||||||
|
_cacheAllocator.Free(funcOffset, AlignCodeSize(entry.Size));
|
||||||
|
_cacheEntries.RemoveAt(entryIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ReprotectAsWritable(int offset, int size)
|
private static void ReprotectAsWritable(ReservedRegion region, int offset, int size)
|
||||||
{
|
{
|
||||||
int endOffs = offset + size;
|
int endOffs = offset + size;
|
||||||
|
|
||||||
int regionStart = offset & ~_pageMask;
|
int regionStart = offset & ~_pageMask;
|
||||||
int regionEnd = (endOffs + _pageMask) & ~_pageMask;
|
int regionEnd = (endOffs + _pageMask) & ~_pageMask;
|
||||||
|
|
||||||
_jitRegion.Block.MapAsRwx((ulong)regionStart, (ulong)(regionEnd - regionStart));
|
region.Block.MapAsRwx((ulong)regionStart, (ulong)(regionEnd - regionStart));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ReprotectAsExecutable(int offset, int size)
|
private static void ReprotectAsExecutable(ReservedRegion region, int offset, int size)
|
||||||
{
|
{
|
||||||
int endOffs = offset + size;
|
int endOffs = offset + size;
|
||||||
|
|
||||||
int regionStart = offset & ~_pageMask;
|
int regionStart = offset & ~_pageMask;
|
||||||
int regionEnd = (endOffs + _pageMask) & ~_pageMask;
|
int regionEnd = (endOffs + _pageMask) & ~_pageMask;
|
||||||
|
|
||||||
_jitRegion.Block.MapAsRx((ulong)regionStart, (ulong)(regionEnd - regionStart));
|
region.Block.MapAsRx((ulong)regionStart, (ulong)(regionEnd - regionStart));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int Allocate(int codeSize)
|
private static int Allocate(int codeSize)
|
||||||
{
|
{
|
||||||
codeSize = AlignCodeSize(codeSize);
|
codeSize = AlignCodeSize(codeSize);
|
||||||
|
|
||||||
int allocOffset = _cacheAllocator.Allocate(codeSize);
|
for (int i = _activeRegionIndex; i < _jitRegions.Count; i++)
|
||||||
|
|
||||||
if (allocOffset < 0)
|
|
||||||
{
|
{
|
||||||
throw new OutOfMemoryException("JIT Cache exhausted.");
|
int allocOffset = _cacheAllocator.Allocate(codeSize);
|
||||||
|
|
||||||
|
if (allocOffset >= 0)
|
||||||
|
{
|
||||||
|
_jitRegions[i].ExpandIfNeeded((ulong)allocOffset + (ulong)codeSize);
|
||||||
|
_activeRegionIndex = i;
|
||||||
|
return allocOffset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_jitRegion.ExpandIfNeeded((ulong)allocOffset + (ulong)codeSize);
|
int exhaustedRegion = _activeRegionIndex;
|
||||||
|
var newRegion = new ReservedRegion(_jitRegions[0].Allocator, CacheSize);
|
||||||
|
_jitRegions.Add(newRegion);
|
||||||
|
_activeRegionIndex = _jitRegions.Count - 1;
|
||||||
|
|
||||||
|
int newRegionNumber = _activeRegionIndex;
|
||||||
|
|
||||||
return allocOffset;
|
Logger.Warning?.Print(LogClass.Cpu, $"JIT Cache Region {exhaustedRegion} exhausted, creating new Cache Region {newRegionNumber} ({((newRegionNumber + 1) * CacheSize).Bytes()} Total Allocation).");
|
||||||
|
|
||||||
|
_cacheAllocator = new CacheMemoryAllocator(CacheSize);
|
||||||
|
|
||||||
|
int allocOffsetNew = _cacheAllocator.Allocate(codeSize);
|
||||||
|
if (allocOffsetNew < 0)
|
||||||
|
{
|
||||||
|
throw new OutOfMemoryException("Failed to allocate in new Cache Region!");
|
||||||
|
}
|
||||||
|
|
||||||
|
newRegion.ExpandIfNeeded((ulong)allocOffsetNew + (ulong)codeSize);
|
||||||
|
return allocOffsetNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int AlignCodeSize(int codeSize)
|
private static int AlignCodeSize(int codeSize)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
|
|||||||
{
|
{
|
||||||
private const int CodeAlignment = 4; // Bytes.
|
private const int CodeAlignment = 4; // Bytes.
|
||||||
private const int SharedCacheSize = 2047 * 1024 * 1024;
|
private const int SharedCacheSize = 2047 * 1024 * 1024;
|
||||||
private const int LocalCacheSize = 128 * 1024 * 1024;
|
private const int LocalCacheSize = 256 * 1024 * 1024;
|
||||||
|
|
||||||
// How many calls to the same function we allow until we pad the shared cache to force the function to become available there
|
// How many calls to the same function we allow until we pad the shared cache to force the function to become available there
|
||||||
// and allow the guest to take the fast path.
|
// and allow the guest to take the fast path.
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
|||||||
{ BsdSocketOption.SoLinger, SocketOptionName.Linger },
|
{ BsdSocketOption.SoLinger, SocketOptionName.Linger },
|
||||||
{ BsdSocketOption.SoOobInline, SocketOptionName.OutOfBandInline },
|
{ BsdSocketOption.SoOobInline, SocketOptionName.OutOfBandInline },
|
||||||
{ BsdSocketOption.SoReusePort, SocketOptionName.ReuseAddress },
|
{ BsdSocketOption.SoReusePort, SocketOptionName.ReuseAddress },
|
||||||
|
{ BsdSocketOption.SoNoSigpipe, SocketOptionName.DontLinger },
|
||||||
{ BsdSocketOption.SoSndBuf, SocketOptionName.SendBuffer },
|
{ BsdSocketOption.SoSndBuf, SocketOptionName.SendBuffer },
|
||||||
{ BsdSocketOption.SoRcvBuf, SocketOptionName.ReceiveBuffer },
|
{ BsdSocketOption.SoRcvBuf, SocketOptionName.ReceiveBuffer },
|
||||||
{ BsdSocketOption.SoSndLoWat, SocketOptionName.SendLowWater },
|
{ BsdSocketOption.SoSndLoWat, SocketOptionName.SendLowWater },
|
||||||
|
|||||||
@@ -1,296 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Buffers.Binary;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Utilities.PlayReport
|
|
||||||
{
|
|
||||||
public partial class PlayReports
|
|
||||||
{
|
|
||||||
private static FormattedValue BreathOfTheWild_MasterMode(SingleValue value)
|
|
||||||
=> value.Matched.BoxedValue is 1 ? "Playing Master Mode" : FormattedValue.ForceReset;
|
|
||||||
|
|
||||||
private static FormattedValue TearsOfTheKingdom_CurrentField(SingleValue value) =>
|
|
||||||
value.Matched.DoubleValue switch
|
|
||||||
{
|
|
||||||
> 800d => "Exploring the Sky Islands",
|
|
||||||
< -201d => "Exploring the Depths",
|
|
||||||
_ => "Roaming Hyrule"
|
|
||||||
};
|
|
||||||
|
|
||||||
private static FormattedValue SuperMarioOdyssey_AssistMode(SingleValue value)
|
|
||||||
=> value.Matched.BoxedValue is 1 ? "Playing in Assist Mode" : "Playing in Regular Mode";
|
|
||||||
|
|
||||||
private static FormattedValue SuperMarioOdysseyChina_AssistMode(SingleValue value)
|
|
||||||
=> value.Matched.BoxedValue is 1 ? "Playing in 帮助模式" : "Playing in 普通模式";
|
|
||||||
|
|
||||||
private static FormattedValue SuperMario3DWorldOrBowsersFury(SingleValue value)
|
|
||||||
=> value.Matched.BoxedValue is 0 ? "Playing Super Mario 3D World" : "Playing Bowser's Fury";
|
|
||||||
|
|
||||||
private static FormattedValue MarioKart8Deluxe_Mode(SingleValue value)
|
|
||||||
=> value.Matched.StringValue switch
|
|
||||||
{
|
|
||||||
// Single Player
|
|
||||||
"Single" => "Single Player",
|
|
||||||
// Multiplayer
|
|
||||||
"Multi-2players" => "Multiplayer 2 Players",
|
|
||||||
"Multi-3players" => "Multiplayer 3 Players",
|
|
||||||
"Multi-4players" => "Multiplayer 4 Players",
|
|
||||||
// Wireless/LAN Play
|
|
||||||
"Local-Single" => "Wireless/LAN Play",
|
|
||||||
"Local-2players" => "Wireless/LAN Play 2 Players",
|
|
||||||
// CC Classes
|
|
||||||
"50cc" => "50cc",
|
|
||||||
"100cc" => "100cc",
|
|
||||||
"150cc" => "150cc",
|
|
||||||
"Mirror" => "Mirror (150cc)",
|
|
||||||
"200cc" => "200cc",
|
|
||||||
// Modes
|
|
||||||
"GrandPrix" => "Grand Prix",
|
|
||||||
"TimeAttack" => "Time Trials",
|
|
||||||
"VS" => "VS Races",
|
|
||||||
"Battle" => "Battle Mode",
|
|
||||||
"RaceStart" => "Selecting a Course",
|
|
||||||
"Race" => "Racing",
|
|
||||||
_ => FormattedValue.ForceReset
|
|
||||||
};
|
|
||||||
|
|
||||||
private static FormattedValue PokemonSVUnionCircle(SingleValue value)
|
|
||||||
=> value.Matched.BoxedValue is 0 ? "Playing Alone" : "Playing in a group";
|
|
||||||
|
|
||||||
private static FormattedValue PokemonSVArea(SingleValue value)
|
|
||||||
=> value.Matched.StringValue switch
|
|
||||||
{
|
|
||||||
// Base Game Locations
|
|
||||||
"a_w01" => "South Area One",
|
|
||||||
"a_w02" => "Mesagoza",
|
|
||||||
"a_w03" => "The Pokemon League",
|
|
||||||
"a_w04" => "South Area Two",
|
|
||||||
"a_w05" => "South Area Four",
|
|
||||||
"a_w06" => "South Area Six",
|
|
||||||
"a_w07" => "South Area Five",
|
|
||||||
"a_w08" => "South Area Three",
|
|
||||||
"a_w09" => "West Area One",
|
|
||||||
"a_w10" => "Asado Desert",
|
|
||||||
"a_w11" => "West Area Two",
|
|
||||||
"a_w12" => "Medali",
|
|
||||||
"a_w13" => "Tagtree Thicket",
|
|
||||||
"a_w14" => "East Area Three",
|
|
||||||
"a_w15" => "Artazon",
|
|
||||||
"a_w16" => "East Area Two",
|
|
||||||
"a_w18" => "Casseroya Lake",
|
|
||||||
"a_w19" => "Glaseado Mountain",
|
|
||||||
"a_w20" => "North Area Three",
|
|
||||||
"a_w21" => "North Area One",
|
|
||||||
"a_w22" => "North Area Two",
|
|
||||||
"a_w23" => "The Great Crater of Paldea",
|
|
||||||
"a_w24" => "South Paldean Sea",
|
|
||||||
"a_w25" => "West Paldean Sea",
|
|
||||||
"a_w26" => "East Paldean Sea",
|
|
||||||
"a_w27" => "Nouth Paldean Sea",
|
|
||||||
//TODO DLC Locations
|
|
||||||
_ => FormattedValue.ForceReset
|
|
||||||
};
|
|
||||||
|
|
||||||
private static FormattedValue SuperSmashBrosUltimate_Mode(SparseMultiValue values)
|
|
||||||
{
|
|
||||||
// Check if the PlayReport is for a challenger approach or an achievement.
|
|
||||||
if (values.Matched.TryGetValue("fighter", out Value fighter) && values.Matched.ContainsKey("reason"))
|
|
||||||
{
|
|
||||||
return $"Challenger Approaches - {SuperSmashBrosUltimate_Character(fighter)}";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (values.Matched.TryGetValue("fighter", out fighter) && values.Matched.ContainsKey("challenge_count"))
|
|
||||||
{
|
|
||||||
return $"Fighter Unlocked - {SuperSmashBrosUltimate_Character(fighter)}";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (values.Matched.TryGetValue("anniversary", out Value anniversary))
|
|
||||||
{
|
|
||||||
return $"Achievement Unlocked - ID: {anniversary}";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (values.Matched.ContainsKey("adv_slot"))
|
|
||||||
{
|
|
||||||
return "Playing Adventure Mode"; // Doing this as it can be a placeholder until we can grab the character.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if we have a match_mode at this point, if not, go to default.
|
|
||||||
if (!values.Matched.TryGetValue("match_mode", out Value matchMode))
|
|
||||||
{
|
|
||||||
return "Smashing";
|
|
||||||
}
|
|
||||||
|
|
||||||
return matchMode.BoxedValue switch
|
|
||||||
{
|
|
||||||
0 when values.Matched.TryGetValue("player_1_fighter", out Value player) &&
|
|
||||||
values.Matched.TryGetValue("player_2_fighter", out Value challenger)
|
|
||||||
=> $"Last Smashed: {SuperSmashBrosUltimate_Character(challenger)}'s Fighter Challenge - {SuperSmashBrosUltimate_Character(player)}",
|
|
||||||
1 => $"Last Smashed: Normal Battle - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
|
||||||
2 when values.Matched.TryGetValue("player_1_rank", out Value team)
|
|
||||||
=> team.BoxedValue is 0
|
|
||||||
? "Last Smashed: Squad Strike - Red Team Wins"
|
|
||||||
: "Last Smashed: Squad Strike - Blue Team Wins",
|
|
||||||
3 => $"Last Smashed: Custom Smash - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
|
||||||
4 => $"Last Smashed: Super Sudden Death - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
|
||||||
5 => $"Last Smashed: Smashdown - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
|
||||||
6 => $"Last Smashed: Tourney Battle - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
|
||||||
7 when values.Matched.TryGetValue("player_1_fighter", out Value player)
|
|
||||||
=> $"Last Smashed: Spirit Board Battle as {SuperSmashBrosUltimate_Character(player)}",
|
|
||||||
8 when values.Matched.TryGetValue("player_1_fighter", out Value player)
|
|
||||||
=> $"Playing Adventure Mode as {SuperSmashBrosUltimate_Character(player)}",
|
|
||||||
10 when values.Matched.TryGetValue("match_submode", out Value battle) &&
|
|
||||||
values.Matched.TryGetValue("player_1_fighter", out Value player)
|
|
||||||
=> $"Last Smashed: Classic Mode, Battle {(int)battle.BoxedValue + 1}/8 as {SuperSmashBrosUltimate_Character(player)}",
|
|
||||||
12 => $"Last Smashed: Century Smash - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
|
||||||
13 => $"Last Smashed: All-Star Smash - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
|
||||||
14 => $"Last Smashed: Cruel Smash - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
|
||||||
15 when values.Matched.TryGetValue("player_1_fighter", out Value player)
|
|
||||||
=> $"Last Smashed: Home-Run Contest - {SuperSmashBrosUltimate_Character(player)}",
|
|
||||||
16 when values.Matched.TryGetValue("player_1_fighter", out Value player1) &&
|
|
||||||
values.Matched.TryGetValue("player_2_fighter", out Value player2)
|
|
||||||
=> $"Last Smashed: Home-Run Content (Co-op) - {SuperSmashBrosUltimate_Character(player1)} and {SuperSmashBrosUltimate_Character(player2)}",
|
|
||||||
17 => $"Last Smashed: Home-Run Contest (Versus) - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
|
||||||
18 when values.Matched.TryGetValue("player_1_fighter", out Value player1) &&
|
|
||||||
values.Matched.TryGetValue("player_2_fighter", out Value player2)
|
|
||||||
=> $"Fresh out of Training mode - {SuperSmashBrosUltimate_Character(player1)} with {SuperSmashBrosUltimate_Character(player2)}",
|
|
||||||
58 => $"Last Smashed: LDN Battle - {SuperSmashBrosUltimate_PlayerListing(values)}",
|
|
||||||
63 when values.Matched.TryGetValue("player_1_fighter", out Value player)
|
|
||||||
=> $"Last Smashed: DLC Spirit Board Battle as {SuperSmashBrosUltimate_Character(player)}",
|
|
||||||
_ => "Smashing"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string SuperSmashBrosUltimate_Character(Value value) =>
|
|
||||||
BinaryPrimitives.ReverseEndianness(
|
|
||||||
BitConverter.ToInt64(((MsgPack.MessagePackExtendedTypeObject)value.BoxedValue).GetBody(), 0)) switch
|
|
||||||
{
|
|
||||||
0x0 => "Mario",
|
|
||||||
0x1 => "Donkey Kong",
|
|
||||||
0x2 => "Link",
|
|
||||||
0x3 => "Samus",
|
|
||||||
0x4 => "Dark Samus",
|
|
||||||
0x5 => "Yoshi",
|
|
||||||
0x6 => "Kirby",
|
|
||||||
0x7 => "Fox",
|
|
||||||
0x8 => "Pikachu",
|
|
||||||
0x9 => "Luigi",
|
|
||||||
0xA => "Ness",
|
|
||||||
0xB => "Captain Falcon",
|
|
||||||
0xC => "Jigglypuff",
|
|
||||||
0xD => "Peach",
|
|
||||||
0xE => "Daisy",
|
|
||||||
0xF => "Bowser",
|
|
||||||
0x10 => "Ice Climbers",
|
|
||||||
0x11 => "Sheik",
|
|
||||||
0x12 => "Zelda",
|
|
||||||
0x13 => "Dr. Mario",
|
|
||||||
0x14 => "Pichu",
|
|
||||||
0x15 => "Falco",
|
|
||||||
0x16 => "Marth",
|
|
||||||
0x17 => "Lucina",
|
|
||||||
0x18 => "Young Link",
|
|
||||||
0x19 => "Ganondorf",
|
|
||||||
0x1A => "Mewtwo",
|
|
||||||
0x1B => "Roy",
|
|
||||||
0x1C => "Chrom",
|
|
||||||
0x1D => "Mr Game & Watch",
|
|
||||||
0x1E => "Meta Knight",
|
|
||||||
0x1F => "Pit",
|
|
||||||
0x20 => "Dark Pit",
|
|
||||||
0x21 => "Zero Suit Samus",
|
|
||||||
0x22 => "Wario",
|
|
||||||
0x23 => "Snake",
|
|
||||||
0x24 => "Ike",
|
|
||||||
0x25 => "Pokémon Trainer",
|
|
||||||
0x26 => "Diddy Kong",
|
|
||||||
0x27 => "Lucas",
|
|
||||||
0x28 => "Sonic",
|
|
||||||
0x29 => "King Dedede",
|
|
||||||
0x2A => "Olimar",
|
|
||||||
0x2B => "Lucario",
|
|
||||||
0x2C => "R.O.B.",
|
|
||||||
0x2D => "Toon Link",
|
|
||||||
0x2E => "Wolf",
|
|
||||||
0x2F => "Villager",
|
|
||||||
0x30 => "Mega Man",
|
|
||||||
0x31 => "Wii Fit Trainer",
|
|
||||||
0x32 => "Rosalina & Luma",
|
|
||||||
0x33 => "Little Mac",
|
|
||||||
0x34 => "Greninja",
|
|
||||||
0x35 => "Palutena",
|
|
||||||
0x36 => "Pac-Man",
|
|
||||||
0x37 => "Robin",
|
|
||||||
0x38 => "Shulk",
|
|
||||||
0x39 => "Bowser Jr.",
|
|
||||||
0x3A => "Duck Hunt",
|
|
||||||
0x3B => "Ryu",
|
|
||||||
0x3C => "Ken",
|
|
||||||
0x3D => "Cloud",
|
|
||||||
0x3E => "Corrin",
|
|
||||||
0x3F => "Bayonetta",
|
|
||||||
0x40 => "Richter",
|
|
||||||
0x41 => "Inkling",
|
|
||||||
0x42 => "Ridley",
|
|
||||||
0x43 => "King K. Rool",
|
|
||||||
0x44 => "Simon",
|
|
||||||
0x45 => "Isabelle",
|
|
||||||
0x46 => "Incineroar",
|
|
||||||
0x47 => "Mii Brawler",
|
|
||||||
0x48 => "Mii Swordfighter",
|
|
||||||
0x49 => "Mii Gunner",
|
|
||||||
0x4A => "Piranha Plant",
|
|
||||||
0x4B => "Joker",
|
|
||||||
0x4C => "Hero",
|
|
||||||
0x4D => "Banjo",
|
|
||||||
0x4E => "Terry",
|
|
||||||
0x4F => "Byleth",
|
|
||||||
0x50 => "Min Min",
|
|
||||||
0x51 => "Steve",
|
|
||||||
0x52 => "Sephiroth",
|
|
||||||
0x53 => "Pyra/Mythra",
|
|
||||||
0x54 => "Kazuya",
|
|
||||||
0x55 => "Sora",
|
|
||||||
0xFE => "Random",
|
|
||||||
0xFF => "Scripted Entity",
|
|
||||||
_ => "Unknown"
|
|
||||||
};
|
|
||||||
|
|
||||||
private static string SuperSmashBrosUltimate_PlayerListing(SparseMultiValue values)
|
|
||||||
{
|
|
||||||
List<(string Character, int PlayerNumber, int? Rank)> players = [];
|
|
||||||
|
|
||||||
foreach (KeyValuePair<string, Value> player in values.Matched)
|
|
||||||
{
|
|
||||||
if (player.Key.StartsWith("player_") && player.Key.EndsWith("_fighter") &&
|
|
||||||
player.Value.BoxedValue is not null)
|
|
||||||
{
|
|
||||||
if (!int.TryParse(player.Key.Split('_')[1], out int playerNumber))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
string character = SuperSmashBrosUltimate_Character(player.Value);
|
|
||||||
int? rank = values.Matched.TryGetValue($"player_{playerNumber}_rank", out Value rankValue)
|
|
||||||
? rankValue.IntValue
|
|
||||||
: null;
|
|
||||||
|
|
||||||
players.Add((character, playerNumber, rank));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
players = players.OrderBy(p => p.Rank ?? int.MaxValue).ToList();
|
|
||||||
|
|
||||||
return players.Count > 4
|
|
||||||
? $"{players.Count} Players - " + string.Join(", ",
|
|
||||||
players.Take(3).Select(p => $"{p.Character}({p.PlayerNumber}){RankMedal(p.Rank)}"))
|
|
||||||
: string.Join(", ", players.Select(p => $"{p.Character}({p.PlayerNumber}){RankMedal(p.Rank)}"));
|
|
||||||
|
|
||||||
string RankMedal(int? rank) => rank switch
|
|
||||||
{
|
|
||||||
0 => "🥇",
|
|
||||||
1 => "🥈",
|
|
||||||
2 => "🥉",
|
|
||||||
_ => ""
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +1,6 @@
|
|||||||
using System;
|
namespace Ryujinx.Ava.Utilities.PlayReport
|
||||||
using System.Buffers.Binary;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Utilities.PlayReport
|
|
||||||
{
|
{
|
||||||
public static partial class PlayReports
|
public static class PlayReports
|
||||||
{
|
{
|
||||||
public static Analyzer Analyzer { get; } = new Analyzer()
|
public static Analyzer Analyzer { get; } = new Analyzer()
|
||||||
.AddSpec(
|
.AddSpec(
|
||||||
@@ -42,23 +37,91 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
spec => spec
|
spec => spec
|
||||||
.AddValueFormatter("area_no", PokemonSVArea)
|
.AddValueFormatter("area_no", PokemonSVArea)
|
||||||
.AddValueFormatter("team_circle", PokemonSVUnionCircle)
|
.AddValueFormatter("team_circle", PokemonSVUnionCircle)
|
||||||
).AddSpec(
|
|
||||||
"01006a800016e000",
|
|
||||||
spec => spec
|
|
||||||
.AddSparseMultiValueFormatter(
|
|
||||||
[
|
|
||||||
// Metadata to figure out what PlayReport we have.
|
|
||||||
"match_mode", "match_submode", "anniversary", "fighter", "reason", "challenge_count",
|
|
||||||
"adv_slot",
|
|
||||||
// List of Fighters
|
|
||||||
"player_1_fighter", "player_2_fighter", "player_3_fighter", "player_4_fighter",
|
|
||||||
"player_5_fighter", "player_6_fighter", "player_7_fighter", "player_8_fighter",
|
|
||||||
// List of rankings/placements
|
|
||||||
"player_1_rank", "player_2_rank", "player_3_rank", "player_4_rank", "player_5_rank",
|
|
||||||
"player_6_rank", "player_7_rank", "player_8_rank"
|
|
||||||
],
|
|
||||||
SuperSmashBrosUltimate_Mode
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
private static FormattedValue BreathOfTheWild_MasterMode(SingleValue value)
|
||||||
|
=> value.Matched.BoxedValue is 1 ? "Playing Master Mode" : FormattedValue.ForceReset;
|
||||||
|
|
||||||
|
private static FormattedValue TearsOfTheKingdom_CurrentField(SingleValue value) =>
|
||||||
|
value.Matched.DoubleValue switch
|
||||||
|
{
|
||||||
|
> 800d => "Exploring the Sky Islands",
|
||||||
|
< -201d => "Exploring the Depths",
|
||||||
|
_ => "Roaming Hyrule"
|
||||||
|
};
|
||||||
|
|
||||||
|
private static FormattedValue SuperMarioOdyssey_AssistMode(SingleValue value)
|
||||||
|
=> value.Matched.BoxedValue is 1 ? "Playing in Assist Mode" : "Playing in Regular Mode";
|
||||||
|
|
||||||
|
private static FormattedValue SuperMarioOdysseyChina_AssistMode(SingleValue value)
|
||||||
|
=> value.Matched.BoxedValue is 1 ? "Playing in 帮助模式" : "Playing in 普通模式";
|
||||||
|
|
||||||
|
private static FormattedValue SuperMario3DWorldOrBowsersFury(SingleValue value)
|
||||||
|
=> value.Matched.BoxedValue is 0 ? "Playing Super Mario 3D World" : "Playing Bowser's Fury";
|
||||||
|
|
||||||
|
private static FormattedValue MarioKart8Deluxe_Mode(SingleValue value)
|
||||||
|
=> value.Matched.StringValue switch
|
||||||
|
{
|
||||||
|
// Single Player
|
||||||
|
"Single" => "Single Player",
|
||||||
|
// Multiplayer
|
||||||
|
"Multi-2players" => "Multiplayer 2 Players",
|
||||||
|
"Multi-3players" => "Multiplayer 3 Players",
|
||||||
|
"Multi-4players" => "Multiplayer 4 Players",
|
||||||
|
// Wireless/LAN Play
|
||||||
|
"Local-Single" => "Wireless/LAN Play",
|
||||||
|
"Local-2players" => "Wireless/LAN Play 2 Players",
|
||||||
|
// CC Classes
|
||||||
|
"50cc" => "50cc",
|
||||||
|
"100cc" => "100cc",
|
||||||
|
"150cc" => "150cc",
|
||||||
|
"Mirror" => "Mirror (150cc)",
|
||||||
|
"200cc" => "200cc",
|
||||||
|
// Modes
|
||||||
|
"GrandPrix" => "Grand Prix",
|
||||||
|
"TimeAttack" => "Time Trials",
|
||||||
|
"VS" => "VS Races",
|
||||||
|
"Battle" => "Battle Mode",
|
||||||
|
"RaceStart" => "Selecting a Course",
|
||||||
|
"Race" => "Racing",
|
||||||
|
_ => FormattedValue.ForceReset
|
||||||
|
};
|
||||||
|
|
||||||
|
private static FormattedValue PokemonSVUnionCircle(SingleValue value)
|
||||||
|
=> value.Matched.BoxedValue is 0 ? "Playing Alone" : "Playing in a group";
|
||||||
|
|
||||||
|
private static FormattedValue PokemonSVArea(SingleValue value)
|
||||||
|
=> value.Matched.StringValue switch
|
||||||
|
{
|
||||||
|
// Base Game Locations
|
||||||
|
"a_w01" => "South Area One",
|
||||||
|
"a_w02" => "Mesagoza",
|
||||||
|
"a_w03" => "The Pokemon League",
|
||||||
|
"a_w04" => "South Area Two",
|
||||||
|
"a_w05" => "South Area Four",
|
||||||
|
"a_w06" => "South Area Six",
|
||||||
|
"a_w07" => "South Area Five",
|
||||||
|
"a_w08" => "South Area Three",
|
||||||
|
"a_w09" => "West Area One",
|
||||||
|
"a_w10" => "Asado Desert",
|
||||||
|
"a_w11" => "West Area Two",
|
||||||
|
"a_w12" => "Medali",
|
||||||
|
"a_w13" => "Tagtree Thicket",
|
||||||
|
"a_w14" => "East Area Three",
|
||||||
|
"a_w15" => "Artazon",
|
||||||
|
"a_w16" => "East Area Two",
|
||||||
|
"a_w18" => "Casseroya Lake",
|
||||||
|
"a_w19" => "Glaseado Mountain",
|
||||||
|
"a_w20" => "North Area Three",
|
||||||
|
"a_w21" => "North Area One",
|
||||||
|
"a_w22" => "North Area Two",
|
||||||
|
"a_w23" => "The Great Crater of Paldea",
|
||||||
|
"a_w24" => "South Paldean Sea",
|
||||||
|
"a_w25" => "West Paldean Sea",
|
||||||
|
"a_w26" => "East Paldean Sea",
|
||||||
|
"a_w27" => "Nouth Paldean Sea",
|
||||||
|
//TODO DLC Locations
|
||||||
|
_ => FormattedValue.ForceReset
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user