Make VirtualFileSystem only instanciable once (#901)

This fix a regression caused by #888 on temporary saves for SNES Online.
(and probably other games)
This commit is contained in:
Thog 2020-01-24 17:01:21 +01:00 committed by Ac_K
parent 4232a15187
commit 1d8da18334
4 changed files with 39 additions and 25 deletions

View file

@ -20,12 +20,14 @@ namespace Ryujinx.HLE.FileSystem
public static string SystemNandPath = Path.Combine(NandPath, "system");
public static string UserNandPath = Path.Combine(NandPath, "user");
private static bool _isInitialized = false;
public Keyset KeySet { get; private set; }
public FileSystemServer FsServer { get; private set; }
public FileSystemClient FsClient { get; private set; }
public EmulatedGameCard GameCard { get; private set; }
public VirtualFileSystem()
private VirtualFileSystem()
{
Reload();
}
@ -272,5 +274,17 @@ namespace Ryujinx.HLE.FileSystem
Unload();
}
}
public static VirtualFileSystem CreateInstance()
{
if (_isInitialized)
{
throw new InvalidOperationException($"VirtualFileSystem can only be instanciated once!");
}
_isInitialized = true;
return new VirtualFileSystem();
}
}
}