mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
switchfs: Allow missing save directory in all cases
This commit is contained in:
parent
72915c0425
commit
87e9829892
1 changed files with 8 additions and 3 deletions
|
@ -36,10 +36,15 @@ namespace LibHac
|
||||||
public static SwitchFs OpenSdCard(Keyset keyset, IAttributeFileSystem fileSystem)
|
public static SwitchFs OpenSdCard(Keyset keyset, IAttributeFileSystem fileSystem)
|
||||||
{
|
{
|
||||||
var concatFs = new ConcatenationFileSystem(fileSystem);
|
var concatFs = new ConcatenationFileSystem(fileSystem);
|
||||||
var saveDirFs = new SubdirectoryFileSystem(concatFs, "/Nintendo/save");
|
|
||||||
var contentDirFs = new SubdirectoryFileSystem(concatFs, "/Nintendo/Contents");
|
var contentDirFs = new SubdirectoryFileSystem(concatFs, "/Nintendo/Contents");
|
||||||
|
|
||||||
var encSaveFs = new AesXtsFileSystem(saveDirFs, keyset.SdCardKeys[0], 0x4000);
|
AesXtsFileSystem encSaveFs = null;
|
||||||
|
if (fileSystem.DirectoryExists("/Nintendo/save"))
|
||||||
|
{
|
||||||
|
var saveDirFs = new SubdirectoryFileSystem(concatFs, "/Nintendo/save");
|
||||||
|
encSaveFs = new AesXtsFileSystem(saveDirFs, keyset.SdCardKeys[0], 0x4000);
|
||||||
|
}
|
||||||
|
|
||||||
var encContentFs = new AesXtsFileSystem(contentDirFs, keyset.SdCardKeys[1], 0x4000);
|
var encContentFs = new AesXtsFileSystem(contentDirFs, keyset.SdCardKeys[1], 0x4000);
|
||||||
|
|
||||||
return new SwitchFs(keyset, encContentFs, encSaveFs);
|
return new SwitchFs(keyset, encContentFs, encSaveFs);
|
||||||
|
@ -48,7 +53,7 @@ namespace LibHac
|
||||||
public static SwitchFs OpenNandPartition(Keyset keyset, IAttributeFileSystem fileSystem)
|
public static SwitchFs OpenNandPartition(Keyset keyset, IAttributeFileSystem fileSystem)
|
||||||
{
|
{
|
||||||
var concatFs = new ConcatenationFileSystem(fileSystem);
|
var concatFs = new ConcatenationFileSystem(fileSystem);
|
||||||
var saveDirFs = new SubdirectoryFileSystem(concatFs, "/save");
|
IFileSystem saveDirFs = concatFs.DirectoryExists("/save") ? new SubdirectoryFileSystem(concatFs, "/save") : null;
|
||||||
var contentDirFs = new SubdirectoryFileSystem(concatFs, "/Contents");
|
var contentDirFs = new SubdirectoryFileSystem(concatFs, "/Contents");
|
||||||
|
|
||||||
return new SwitchFs(keyset, contentDirFs, saveDirFs);
|
return new SwitchFs(keyset, contentDirFs, saveDirFs);
|
||||||
|
|
Loading…
Reference in a new issue