mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Add DefaultFsServerObjects for creating a default server instance
This commit is contained in:
parent
51a13068df
commit
b517085e92
3 changed files with 43 additions and 24 deletions
|
@ -1,6 +1,4 @@
|
|||
using LibHac.Fs;
|
||||
|
||||
namespace LibHac.FsService.Creators
|
||||
namespace LibHac.FsService.Creators
|
||||
{
|
||||
public class FileSystemCreators
|
||||
{
|
||||
|
@ -20,25 +18,5 @@ namespace LibHac.FsService.Creators
|
|||
public IMemoryStorageCreator MemoryStorageCreator { get; set; }
|
||||
public IBuiltInStorageFileSystemCreator BuiltInStorageFileSystemCreator { get; set; }
|
||||
public ISdFileSystemCreator SdFileSystemCreator { get; set; }
|
||||
|
||||
public IDeviceOperator DeviceOperator { get; set; }
|
||||
|
||||
public static (FileSystemCreators fsCreators, EmulatedGameCard gameCard) GetDefaultEmulatedCreators(
|
||||
IFileSystem rootFileSystem, Keyset keyset)
|
||||
{
|
||||
var creators = new FileSystemCreators();
|
||||
var gameCard = new EmulatedGameCard();
|
||||
|
||||
creators.SubDirectoryFileSystemCreator = new SubDirectoryFileSystemCreator();
|
||||
creators.SaveDataFileSystemCreator = new SaveDataFileSystemCreator(keyset);
|
||||
creators.GameCardStorageCreator = new EmulatedGameCardStorageCreator(gameCard);
|
||||
creators.EncryptedFileSystemCreator = new EncryptedFileSystemCreator(keyset);
|
||||
creators.BuiltInStorageFileSystemCreator = new EmulatedBisFileSystemCreator(rootFileSystem);
|
||||
creators.SdFileSystemCreator = new EmulatedSdFileSystemCreator(rootFileSystem);
|
||||
|
||||
creators.DeviceOperator = new EmulatedDeviceOperator(gameCard);
|
||||
|
||||
return (creators, gameCard);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
34
src/LibHac/FsService/DefaultFsServerObjects.cs
Normal file
34
src/LibHac/FsService/DefaultFsServerObjects.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using LibHac.Fs;
|
||||
using LibHac.FsService.Creators;
|
||||
|
||||
namespace LibHac.FsService
|
||||
{
|
||||
public class DefaultFsServerObjects
|
||||
{
|
||||
public FileSystemCreators FsCreators { get; set; }
|
||||
public IDeviceOperator DeviceOperator { get; set; }
|
||||
public EmulatedGameCard GameCard { get; set; }
|
||||
|
||||
public static DefaultFsServerObjects GetDefaultEmulatedCreators(IFileSystem rootFileSystem, Keyset keyset)
|
||||
{
|
||||
var creators = new FileSystemCreators();
|
||||
var gameCard = new EmulatedGameCard(keyset);
|
||||
|
||||
creators.SubDirectoryFileSystemCreator = new SubDirectoryFileSystemCreator();
|
||||
creators.SaveDataFileSystemCreator = new SaveDataFileSystemCreator(keyset);
|
||||
creators.GameCardStorageCreator = new EmulatedGameCardStorageCreator(gameCard);
|
||||
creators.EncryptedFileSystemCreator = new EncryptedFileSystemCreator(keyset);
|
||||
creators.BuiltInStorageFileSystemCreator = new EmulatedBisFileSystemCreator(rootFileSystem);
|
||||
creators.SdFileSystemCreator = new EmulatedSdFileSystemCreator(rootFileSystem);
|
||||
|
||||
var deviceOperator = new EmulatedDeviceOperator(gameCard);
|
||||
|
||||
return new DefaultFsServerObjects
|
||||
{
|
||||
FsCreators = creators,
|
||||
DeviceOperator = deviceOperator,
|
||||
GameCard = gameCard
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,14 @@ namespace LibHac.FsService
|
|||
private IStorage CardImageStorage { get; set; }
|
||||
private int Handle { get; set; }
|
||||
private XciHeader CardHeader { get; set; }
|
||||
private Keyset Keyset { get; set; }
|
||||
|
||||
public EmulatedGameCard() { }
|
||||
|
||||
public EmulatedGameCard(Keyset keyset)
|
||||
{
|
||||
Keyset = keyset;
|
||||
}
|
||||
public GameCardHandle GetGameCardHandle()
|
||||
{
|
||||
return new GameCardHandle(Handle);
|
||||
|
@ -31,7 +38,7 @@ namespace LibHac.FsService
|
|||
|
||||
CardImageStorage = cardImageStorage;
|
||||
|
||||
CardHeader = new XciHeader(null, cardImageStorage.AsStream());
|
||||
CardHeader = new XciHeader(Keyset, cardImageStorage.AsStream());
|
||||
}
|
||||
|
||||
public void RemoveGameCard()
|
||||
|
|
Loading…
Reference in a new issue