Switch to the new folder structure.
Nits.
This commit is contained in:
parent
0b955b880c
commit
76123878b0
2 changed files with 40 additions and 22 deletions
|
@ -13,7 +13,10 @@ namespace ARMeilleure.Translation.AOT
|
|||
{
|
||||
public static class Aot
|
||||
{
|
||||
private const string WorkDir = "RyuAot";
|
||||
private const string BaseDir = "Ryujinx";
|
||||
|
||||
private const string TitleIdTextDefault = "0000000000000000";
|
||||
private const string DisplayVersionDefault = "0";
|
||||
|
||||
private const int SaveInterval = 30; // Seconds.
|
||||
|
||||
|
@ -29,28 +32,28 @@ namespace ARMeilleure.Translation.AOT
|
|||
|
||||
private static readonly Timer _timer;
|
||||
|
||||
private static readonly string _basePath;
|
||||
|
||||
private static readonly object _locker;
|
||||
|
||||
private static bool _disposed;
|
||||
|
||||
public static string WorkPath { get; }
|
||||
public static string TitleId { get; private set; }
|
||||
public static string WorkPath { get; private set; }
|
||||
public static string TitleIdText { get; private set; }
|
||||
public static string DisplayVersion { get; private set; }
|
||||
|
||||
public static bool Enabled { get; private set; }
|
||||
public static bool ReadOnlyMode { get; private set; }
|
||||
|
||||
static Aot()
|
||||
{
|
||||
string basePath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||
string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||
|
||||
WorkPath = Path.Combine(basePath, WorkDir);
|
||||
_basePath = Path.Combine(appDataPath, BaseDir);
|
||||
|
||||
if (!Directory.Exists(WorkPath))
|
||||
{
|
||||
Directory.CreateDirectory(WorkPath);
|
||||
}
|
||||
|
||||
TitleId = String.Empty;
|
||||
WorkPath = String.Empty;
|
||||
TitleIdText = TitleIdTextDefault;
|
||||
DisplayVersion = DisplayVersionDefault;
|
||||
|
||||
Enabled = false;
|
||||
ReadOnlyMode = true;
|
||||
|
@ -69,11 +72,25 @@ namespace ARMeilleure.Translation.AOT
|
|||
_disposed = false;
|
||||
}
|
||||
|
||||
public static void Init(string titleId, bool enabled = true, bool readOnlyMode = false)
|
||||
public static void Init(string titleIdText, string displayVersion, bool enabled = true, bool readOnlyMode = false)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(titleId))
|
||||
if (String.IsNullOrEmpty(titleIdText) || titleIdText == TitleIdTextDefault)
|
||||
{
|
||||
TitleId = titleId.ToUpper();
|
||||
return;
|
||||
}
|
||||
|
||||
TitleIdText = titleIdText;
|
||||
|
||||
if (!String.IsNullOrEmpty(displayVersion))
|
||||
{
|
||||
DisplayVersion = displayVersion;
|
||||
}
|
||||
|
||||
WorkPath = Path.Combine(_basePath, "games", TitleIdText, "cpu", "cache");
|
||||
|
||||
if (!Directory.Exists(WorkPath))
|
||||
{
|
||||
Directory.CreateDirectory(WorkPath);
|
||||
}
|
||||
|
||||
Enabled = enabled;
|
||||
|
@ -92,7 +109,7 @@ namespace ARMeilleure.Translation.AOT
|
|||
|
||||
private static void LoadAndSplit()
|
||||
{
|
||||
string cachePath = Path.Combine(WorkPath, TitleId);
|
||||
string cachePath = Path.Combine(WorkPath, DisplayVersion);
|
||||
|
||||
FileInfo cacheInfo = new FileInfo(cachePath);
|
||||
|
||||
|
@ -254,7 +271,7 @@ namespace ARMeilleure.Translation.AOT
|
|||
cacheStream.Seek(0L, SeekOrigin.Begin);
|
||||
cacheStream.Write(hash, 0, hashSize);
|
||||
|
||||
string cachePath = Path.Combine(WorkPath, TitleId);
|
||||
string cachePath = Path.Combine(WorkPath, DisplayVersion);
|
||||
|
||||
using (FileStream compressedCacheStream = new FileStream(cachePath, FileMode.OpenOrCreate))
|
||||
{
|
||||
|
|
|
@ -113,6 +113,7 @@ namespace Ryujinx.HLE.HOS
|
|||
public BlitStruct<ApplicationControlProperty> ControlData { get; set; }
|
||||
|
||||
public string TitleName { get; private set; }
|
||||
public string DisplayVersion { get; private set; }
|
||||
|
||||
public ulong TitleId { get; private set; }
|
||||
public string TitleIdText => TitleId.ToString("x16");
|
||||
|
@ -298,7 +299,7 @@ namespace Ryujinx.HLE.HOS
|
|||
}
|
||||
}
|
||||
|
||||
private (Nca Main, Nca patch, Nca Control) GetXciGameData(Xci xci)
|
||||
private (Nca main, Nca patch, Nca control) GetXciGameData(Xci xci)
|
||||
{
|
||||
if (!xci.HasPartition(XciPartitionType.Secure))
|
||||
{
|
||||
|
@ -389,6 +390,8 @@ namespace Ryujinx.HLE.HOS
|
|||
TitleName = ControlData.Value.Titles.ToArray()
|
||||
.FirstOrDefault(x => x.Name[0] != 0).Name.ToString();
|
||||
}
|
||||
|
||||
DisplayVersion = ControlData.Value.DisplayVersion.ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -517,10 +520,6 @@ namespace Ryujinx.HLE.HOS
|
|||
Device.FileSystem.SetRomFs(dataStorage.AsStream(FileAccess.Read));
|
||||
}
|
||||
|
||||
LoadExeFs(codeFs, out Npdm metaData);
|
||||
|
||||
TitleId = metaData.Aci0.TitleId;
|
||||
|
||||
if (controlNca != null)
|
||||
{
|
||||
ReadControlData(controlNca);
|
||||
|
@ -530,6 +529,8 @@ namespace Ryujinx.HLE.HOS
|
|||
ControlData.ByteSpan.Clear();
|
||||
}
|
||||
|
||||
LoadExeFs(codeFs, out _);
|
||||
|
||||
if (TitleId != 0)
|
||||
{
|
||||
EnsureSaveData(new TitleId(TitleId));
|
||||
|
@ -583,7 +584,7 @@ namespace Ryujinx.HLE.HOS
|
|||
|
||||
Logger.PrintInfo(LogClass.Loader, "AOT Init...");
|
||||
|
||||
Aot.Init(TitleId);
|
||||
Aot.Init(TitleIdText, DisplayVersion);
|
||||
|
||||
ProgramLoader.LoadStaticObjects(this, metaData, staticObjects.ToArray());
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue