mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-31 01:59:59 -06:00
misc: chore: Fix object creation in HLE project
This commit is contained in:
@ -144,7 +144,7 @@ namespace Ryujinx.HLE.HOS
|
||||
|
||||
private static string EnsureBaseDirStructure(string modsBasePath)
|
||||
{
|
||||
DirectoryInfo modsDir = new DirectoryInfo(modsBasePath);
|
||||
DirectoryInfo modsDir = new(modsBasePath);
|
||||
|
||||
modsDir.CreateSubdirectory(AmsContentsDir);
|
||||
modsDir.CreateSubdirectory(AmsNsoPatchDir);
|
||||
@ -201,7 +201,7 @@ namespace Ryujinx.HLE.HOS
|
||||
|
||||
public static string GetApplicationDir(string modsBasePath, string applicationId)
|
||||
{
|
||||
DirectoryInfo contentsDir = new DirectoryInfo(Path.Combine(modsBasePath, AmsContentsDir));
|
||||
DirectoryInfo contentsDir = new(Path.Combine(modsBasePath, AmsContentsDir));
|
||||
DirectoryInfo applicationModsPath = FindApplicationDir(contentsDir, applicationId);
|
||||
|
||||
if (applicationModsPath == null)
|
||||
@ -273,7 +273,7 @@ namespace Ryujinx.HLE.HOS
|
||||
}
|
||||
}
|
||||
|
||||
FileInfo fsFile = new FileInfo(Path.Combine(applicationDir.FullName, RomfsContainer));
|
||||
FileInfo fsFile = new(Path.Combine(applicationDir.FullName, RomfsContainer));
|
||||
if (fsFile.Exists)
|
||||
{
|
||||
Mod modData = modMetadata.Mods.FirstOrDefault(x => fsFile.FullName.Contains(x.Path));
|
||||
@ -432,7 +432,7 @@ namespace Ryujinx.HLE.HOS
|
||||
|
||||
foreach (string path in searchDirPaths)
|
||||
{
|
||||
DirectoryInfo searchDir = new DirectoryInfo(path);
|
||||
DirectoryInfo searchDir = new(path);
|
||||
if (!searchDir.Exists)
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.ModLoader, $"Mod Search Dir '{searchDir.FullName}' doesn't exist");
|
||||
@ -470,8 +470,8 @@ namespace Ryujinx.HLE.HOS
|
||||
return baseStorage;
|
||||
}
|
||||
|
||||
HashSet<string> fileSet = new HashSet<string>();
|
||||
RomFsBuilder builder = new RomFsBuilder();
|
||||
HashSet<string> fileSet = new();
|
||||
RomFsBuilder builder = new();
|
||||
int count = 0;
|
||||
|
||||
Logger.Info?.Print(LogClass.ModLoader, $"Applying RomFS mods for Application {applicationId:X16}");
|
||||
@ -517,12 +517,12 @@ namespace Ryujinx.HLE.HOS
|
||||
Logger.Info?.Print(LogClass.ModLoader, $"Replaced {fileSet.Count} file(s) over {count} mod(s). Processing base storage...");
|
||||
|
||||
// And finally, the base romfs
|
||||
RomFsFileSystem baseRom = new RomFsFileSystem(baseStorage);
|
||||
RomFsFileSystem baseRom = new(baseStorage);
|
||||
foreach (DirectoryEntryEx entry in baseRom.EnumerateEntries()
|
||||
.Where(f => f.Type == DirectoryEntryType.File && !fileSet.Contains(f.FullPath))
|
||||
.OrderBy(f => f.FullPath, StringComparer.Ordinal))
|
||||
{
|
||||
using UniqueRef<IFile> file = new UniqueRef<IFile>();
|
||||
using UniqueRef<IFile> file = new();
|
||||
|
||||
baseRom.OpenFile(ref file.Ref, entry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
builder.AddFile(entry.FullPath, file.Release());
|
||||
@ -542,7 +542,7 @@ namespace Ryujinx.HLE.HOS
|
||||
.Where(f => f.Type == DirectoryEntryType.File)
|
||||
.OrderBy(f => f.FullPath, StringComparer.Ordinal))
|
||||
{
|
||||
LazyFile file = new LazyFile(entry.FullPath, rootPath, fs);
|
||||
LazyFile file = new(entry.FullPath, rootPath, fs);
|
||||
|
||||
if (fileSet.Add(entry.FullPath))
|
||||
{
|
||||
@ -569,7 +569,7 @@ namespace Ryujinx.HLE.HOS
|
||||
|
||||
Logger.Info?.Print(LogClass.ModLoader, "Using replacement ExeFS partition");
|
||||
|
||||
PartitionFileSystem pfs = new PartitionFileSystem();
|
||||
PartitionFileSystem pfs = new();
|
||||
pfs.Initialize(mods.ExefsContainers[0].Path.OpenRead().AsStorage()).ThrowIfFailure();
|
||||
exefs = pfs;
|
||||
|
||||
@ -753,7 +753,7 @@ namespace Ryujinx.HLE.HOS
|
||||
patches[i] = new MemPatch();
|
||||
}
|
||||
|
||||
List<string> buildIds = new List<string>(programs.Length);
|
||||
List<string> buildIds = new(programs.Length);
|
||||
|
||||
foreach (IExecutable p in programs)
|
||||
{
|
||||
@ -793,17 +793,17 @@ namespace Ryujinx.HLE.HOS
|
||||
Logger.Info?.Print(LogClass.ModLoader, $"Matching IPS patch '{patchFile.Name}' in '{mod.Name}' bid={buildId}");
|
||||
|
||||
using FileStream fs = patchFile.OpenRead();
|
||||
using BinaryReader reader = new BinaryReader(fs);
|
||||
using BinaryReader reader = new(fs);
|
||||
|
||||
IpsPatcher patcher = new IpsPatcher(reader);
|
||||
IpsPatcher patcher = new(reader);
|
||||
patcher.AddPatches(patches[index]);
|
||||
}
|
||||
else if (StrEquals(".pchtxt", patchFile.Extension)) // IPSwitch
|
||||
{
|
||||
using FileStream fs = patchFile.OpenRead();
|
||||
using StreamReader reader = new StreamReader(fs);
|
||||
using StreamReader reader = new(fs);
|
||||
|
||||
IPSwitchPatcher patcher = new IPSwitchPatcher(reader);
|
||||
IPSwitchPatcher patcher = new(reader);
|
||||
|
||||
int index = GetIndex(patcher.BuildId);
|
||||
if (index == -1)
|
||||
|
Reference in New Issue
Block a user