1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-12 04:42:02 +00:00

Mod loading from atmosphere SD directories (#3176)

* initial sd support

* GUI option

* alignment

* review changes
This commit is contained in:
MutantAura 2022-03-06 21:12:01 +00:00 committed by GitHub
parent 0bcbe32367
commit ee174be57c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 4 deletions

View file

@ -34,6 +34,7 @@ namespace Ryujinx.Common.Configuration
private const string DefaultModsDir = "mods"; private const string DefaultModsDir = "mods";
public static string CustomModsPath { get; set; } public static string CustomModsPath { get; set; }
public static string CustomSdModsPath {get; set; }
public static string CustomNandPath { get; set; } // TODO: Actually implement this into VFS public static string CustomNandPath { get; set; } // TODO: Actually implement this into VFS
public static string CustomSdCardPath { get; set; } // TODO: Actually implement this into VFS public static string CustomSdCardPath { get; set; } // TODO: Actually implement this into VFS
@ -85,5 +86,6 @@ namespace Ryujinx.Common.Configuration
} }
public static string GetModsPath() => CustomModsPath ?? Directory.CreateDirectory(Path.Combine(BaseDirPath, DefaultModsDir)).FullName; public static string GetModsPath() => CustomModsPath ?? Directory.CreateDirectory(Path.Combine(BaseDirPath, DefaultModsDir)).FullName;
public static string GetSdModsPath() => CustomSdModsPath ?? Directory.CreateDirectory(Path.Combine(BaseDirPath, DefaultSdcardDir, "atmosphere")).FullName;
} }
} }

View file

@ -84,7 +84,10 @@ namespace Ryujinx.HLE.HOS
MetaLoader metaData = ReadNpdm(codeFs); MetaLoader metaData = ReadNpdm(codeFs);
_device.Configuration.VirtualFileSystem.ModLoader.CollectMods(new[] { TitleId }, _device.Configuration.VirtualFileSystem.ModLoader.GetModsBasePath()); _device.Configuration.VirtualFileSystem.ModLoader.CollectMods(
new[] { TitleId },
_device.Configuration.VirtualFileSystem.ModLoader.GetModsBasePath(),
_device.Configuration.VirtualFileSystem.ModLoader.GetSdModsBasePath());
if (TitleId != 0) if (TitleId != 0)
{ {
@ -388,7 +391,10 @@ namespace Ryujinx.HLE.HOS
MetaLoader metaData = ReadNpdm(codeFs); MetaLoader metaData = ReadNpdm(codeFs);
_device.Configuration.VirtualFileSystem.ModLoader.CollectMods(_device.Configuration.ContentManager.GetAocTitleIds().Prepend(TitleId), _device.Configuration.VirtualFileSystem.ModLoader.GetModsBasePath()); _device.Configuration.VirtualFileSystem.ModLoader.CollectMods(
_device.Configuration.ContentManager.GetAocTitleIds().Prepend(TitleId),
_device.Configuration.VirtualFileSystem.ModLoader.GetModsBasePath(),
_device.Configuration.VirtualFileSystem.ModLoader.GetSdModsBasePath());
if (controlNca != null) if (controlNca != null)
{ {

View file

@ -137,6 +137,7 @@ namespace Ryujinx.HLE.HOS
private static bool StrEquals(string s1, string s2) => string.Equals(s1, s2, StringComparison.OrdinalIgnoreCase); private static bool StrEquals(string s1, string s2) => string.Equals(s1, s2, StringComparison.OrdinalIgnoreCase);
public string GetModsBasePath() => EnsureBaseDirStructure(AppDataManager.GetModsPath()); public string GetModsBasePath() => EnsureBaseDirStructure(AppDataManager.GetModsPath());
public string GetSdModsBasePath() => EnsureBaseDirStructure(AppDataManager.GetSdModsPath());
private string EnsureBaseDirStructure(string modsBasePath) private string EnsureBaseDirStructure(string modsBasePath)
{ {

View file

@ -11,6 +11,7 @@ namespace Ryujinx.Ui.Widgets
private MenuItem _manageDlcMenuItem; private MenuItem _manageDlcMenuItem;
private MenuItem _manageCheatMenuItem; private MenuItem _manageCheatMenuItem;
private MenuItem _openTitleModDirMenuItem; private MenuItem _openTitleModDirMenuItem;
private MenuItem _openTitleSdModDirMenuItem;
private Menu _extractSubMenu; private Menu _extractSubMenu;
private MenuItem _extractMenuItem; private MenuItem _extractMenuItem;
private MenuItem _extractRomFsMenuItem; private MenuItem _extractRomFsMenuItem;
@ -88,6 +89,15 @@ namespace Ryujinx.Ui.Widgets
}; };
_openTitleModDirMenuItem.Activated += OpenTitleModDir_Clicked; _openTitleModDirMenuItem.Activated += OpenTitleModDir_Clicked;
//
// _openTitleSdModDirMenuItem
//
_openTitleSdModDirMenuItem = new MenuItem("Open Atmosphere Mods Directory")
{
TooltipText = "Open the alternative SD card atmosphere directory which contains the Application's Mods."
};
_openTitleSdModDirMenuItem.Activated += OpenTitleSdModDir_Clicked;
// //
// _extractSubMenu // _extractSubMenu
// //
@ -199,6 +209,7 @@ namespace Ryujinx.Ui.Widgets
Add(_manageDlcMenuItem); Add(_manageDlcMenuItem);
Add(_manageCheatMenuItem); Add(_manageCheatMenuItem);
Add(_openTitleModDirMenuItem); Add(_openTitleModDirMenuItem);
Add(_openTitleSdModDirMenuItem);
Add(new SeparatorMenuItem()); Add(new SeparatorMenuItem());
Add(_manageCacheMenuItem); Add(_manageCacheMenuItem);
Add(_extractMenuItem); Add(_extractMenuItem);

View file

@ -477,6 +477,14 @@ namespace Ryujinx.Ui.Widgets
OpenHelper.OpenFolder(titleModsPath); OpenHelper.OpenFolder(titleModsPath);
} }
private void OpenTitleSdModDir_Clicked(object sender, EventArgs args)
{
string sdModsBasePath = _virtualFileSystem.ModLoader.GetSdModsBasePath();
string titleModsPath = _virtualFileSystem.ModLoader.GetTitleDir(sdModsBasePath, _titleIdText);
OpenHelper.OpenFolder(titleModsPath);
}
private void ExtractRomFs_Clicked(object sender, EventArgs args) private void ExtractRomFs_Clicked(object sender, EventArgs args)
{ {
ExtractSection(NcaSectionType.Data); ExtractSection(NcaSectionType.Data);