mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Diff GcSrv and SdmmcSrv with FS 16
This commit is contained in:
parent
7005676777
commit
e2cbb0898c
21 changed files with 32 additions and 32 deletions
|
@ -13,7 +13,7 @@ namespace LibHac.GcSrv;
|
|||
/// <summary>
|
||||
/// The game card manager used on consoles without a game card slot.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
public class DummyGameCardManager : IStorageDeviceManager, IStorageDeviceOperator, IGameCardKeyManager
|
||||
{
|
||||
private SharedRef<DummyEventNotifier> _eventNotifier;
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace LibHac.GcSrv;
|
|||
/// <summary>
|
||||
/// Manages registering events and signaling them when a game card is inserted or removed.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
internal class GameCardDetectionEventManager : CardDeviceDetectionEventManager
|
||||
{
|
||||
private IGcApi _gc;
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace LibHac.GcSrv;
|
|||
/// Performs various operations on the inserted game card.
|
||||
/// All available operations are listed in <see cref="GameCardOperationIdValue"/>.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
internal class GameCardDeviceOperator : IStorageDeviceOperator
|
||||
{
|
||||
private SharedRef<GameCardStorageDevice> _storageDevice;
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace LibHac.GcSrv;
|
|||
/// from the game card after the card has been swapped.</para>
|
||||
/// <para>This class implements the <see cref="IStorageDeviceOperator"/> interface, and all available operations are
|
||||
/// listed in <see cref="GameCardManagerOperationIdValue"/>.</para>
|
||||
/// <para>Based on nnSdk 15.3.0 (FS 15.0.0)</para></remarks>
|
||||
/// <para>Based on nnSdk 16.2.0 (FS 16.0.0)</para></remarks>
|
||||
public class GameCardManager : IStorageDeviceManager, IStorageDeviceOperator, IGameCardManager, IGameCardKeyManager
|
||||
{
|
||||
private enum CardState
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace LibHac.GcSrv;
|
|||
/// <summary>
|
||||
/// Provides an <see cref="IStorage"/> interface for reading from the game card.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
internal class ReadOnlyGameCardStorage : IStorage
|
||||
{
|
||||
private SharedRef<IGameCardManager> _deviceManager;
|
||||
|
@ -97,7 +97,7 @@ internal class ReadOnlyGameCardStorage : IStorage
|
|||
/// <summary>
|
||||
/// Provides an <see cref="IStorage"/> interface for writing to the game card.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
internal class WriteOnlyGameCardStorage : IStorage
|
||||
{
|
||||
private SharedRef<IGameCardManager> _deviceManager;
|
||||
|
@ -168,7 +168,7 @@ internal class WriteOnlyGameCardStorage : IStorage
|
|||
/// An adapter that directly translates <see cref="IStorageSf"/> sf calls to <see cref="IStorage"/> calls with no checks
|
||||
/// or validations.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
internal abstract class GameCardStorageInterfaceAdapter : IStorageSf
|
||||
{
|
||||
private SharedRef<IStorage> _baseStorage;
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace LibHac.GcSrv;
|
|||
/// <summary>
|
||||
/// An <see cref="IStorageDevice"/> that handles interacting with the currently inserted game card.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
internal class GameCardStorageDevice : GameCardStorageInterfaceAdapter, IStorageDevice
|
||||
{
|
||||
private SharedRef<IGameCardManager> _manager;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/// <summary>
|
||||
/// The operations that <see cref="GameCardManager"/> can perform on the game card ASIC and writable game cards.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
public enum GameCardManagerOperationIdValue
|
||||
{
|
||||
Finalize = 1,
|
||||
|
@ -25,7 +25,7 @@ public enum GameCardManagerOperationIdValue
|
|||
/// <summary>
|
||||
/// The operations that <see cref="GameCardDeviceOperator"/> can perform on the inserted game card.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
public enum GameCardOperationIdValue
|
||||
{
|
||||
EraseGameCard = 1,
|
||||
|
@ -40,7 +40,7 @@ public enum GameCardOperationIdValue
|
|||
/// <summary>
|
||||
/// Specifies which mode the game card storage should be opened as.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
public enum OpenGameCardAttribute : long
|
||||
{
|
||||
ReadOnly = 0,
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace LibHac.GcSrv;
|
|||
/// <summary>
|
||||
/// Sets the certificate and key used for communicating with the game card ASIC.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
public interface IGameCardKeyManager : IDisposable
|
||||
{
|
||||
void PresetInternalKeys(ReadOnlySpan<byte> gameCardKey, ReadOnlySpan<byte> gameCardCertificate);
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace LibHac.GcSrv;
|
|||
/// <summary>
|
||||
/// Handles granting access to the game card, and keeps track of the current game card handle.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
internal interface IGameCardManager : IDisposable
|
||||
{
|
||||
Result AcquireReadLock(ref SharedLock<ReaderWriterLock> outLock, GameCardHandle handle);
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace LibHac.SdmmcSrv;
|
|||
/// <summary>
|
||||
/// Manages locking and getting the storage from sdmmc devices.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
internal interface ISdmmcDeviceManager : IDisposable
|
||||
{
|
||||
Result Lock(ref UniqueLockRef<SdkMutexType> outLock, SdmmcHandle handle);
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace LibHac.SdmmcSrv;
|
|||
/// Performs various operations on the internal MMC storage.
|
||||
/// All available operations are listed in <see cref="MmcOperationIdValue"/>.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
internal class MmcDeviceOperator : IStorageDeviceOperator
|
||||
{
|
||||
private SharedRef<MmcPartitionStorageDevice> _storageDevice;
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace LibHac.SdmmcSrv;
|
|||
/// </summary>
|
||||
/// <remarks><para>This class implements the <see cref="IStorageDeviceOperator"/> interface, and all available
|
||||
/// operations are listed in <see cref="MmcManagerOperationIdValue"/>.</para>
|
||||
/// <para>Based on nnSdk 15.3.0 (FS 15.0.0)</para></remarks>
|
||||
/// <para>Based on nnSdk 16.2.0 (FS 16.0.0)</para></remarks>
|
||||
internal class MmcManager : IStorageDeviceManager, IStorageDeviceOperator, ISdmmcDeviceManager
|
||||
{
|
||||
private const SdmmcHandle MmcHandle = 1;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace LibHac.SdmmcSrv;
|
|||
/// Provides base functionality for MMC <see cref="IStorageDevice"/> classes. Derived classes will need to provide
|
||||
/// methods for reading/writing the MMC storage.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
internal abstract class MmcPartitionStorageDevice : IDisposable
|
||||
{
|
||||
private SharedRef<ISdmmcDeviceManager> _manager;
|
||||
|
@ -95,7 +95,7 @@ internal abstract class MmcPartitionStorageDevice : IDisposable
|
|||
/// and <see cref="MmcPartitionStorageDevice"/>. Because C# doesn't have multiple inheritance, we make a copy of the
|
||||
/// <see cref="SdmmcStorageInterfaceAdapter"/> class that inherits from <see cref="MmcPartitionStorageDevice"/>.
|
||||
/// This class must mirror any changes made to <see cref="SdmmcStorageInterfaceAdapter"/>.</para>
|
||||
/// <para>Based on nnSdk 15.3.0 (FS 15.0.0)</para></remarks>
|
||||
/// <para>Based on nnSdk 16.2.0 (FS 16.0.0)</para></remarks>
|
||||
internal abstract class MmcPartitionStorageDeviceInterfaceAdapter : MmcPartitionStorageDevice, IStorageDevice
|
||||
{
|
||||
private readonly IStorage _baseStorage;
|
||||
|
@ -145,7 +145,7 @@ internal abstract class MmcPartitionStorageDeviceInterfaceAdapter : MmcPartition
|
|||
/// An <see cref="IStorageDevice"/> that handles interacting with the <see cref="MmcPartition.UserData"/> partition
|
||||
/// on the internal MMC.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
internal class MmcUserDataPartitionStorageDevice : MmcPartitionStorageDeviceInterfaceAdapter
|
||||
{
|
||||
private MmcUserDataPartitionStorageDevice(ref SharedRef<ISdmmcDeviceManager> manager, SdmmcHandle handle,
|
||||
|
@ -209,7 +209,7 @@ internal class MmcUserDataPartitionStorageDevice : MmcPartitionStorageDeviceInte
|
|||
/// An <see cref="IStorageDevice"/> that handles interacting with the <see cref="MmcPartition.BootPartition1"/> and
|
||||
/// <see cref="MmcPartition.BootPartition2"/> partitions on the internal MMC.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
internal class MmcBootPartitionStorageDevice : MmcPartitionStorageDeviceInterfaceAdapter
|
||||
{
|
||||
private MmcBootPartitionStorageDevice(Fs.MmcPartition partition, ref SharedRef<ISdmmcDeviceManager> manager,
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace LibHac.SdmmcSrv;
|
|||
/// Every 2 hours it will save the current state of the patrol read to Boot Partition 1 on the MMC.
|
||||
/// This state contains the next sector index to be read and the number of times the MMC has been patrolled
|
||||
/// from start to finish.</para>
|
||||
/// <para>Based on nnSdk 15.3.0 (FS 15.0.0)</para></remarks>
|
||||
/// <para>Based on nnSdk 16.2.0 (FS 16.0.0)</para></remarks>
|
||||
internal class PatrolReader
|
||||
{
|
||||
// Note: This class won't work until events and timer events are properly implemented.
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace LibHac.SdmmcSrv;
|
|||
/// <summary>
|
||||
/// Registers an sdmmc detection callback when constructed, and unregisters the callback when disposed.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
internal class SdCardDetectionEventManager : CardDeviceDetectionEventManager
|
||||
{
|
||||
// LibHac addition
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace LibHac.SdmmcSrv;
|
|||
/// Performs various operations on the inserted SD card.
|
||||
/// All available operations are listed in <see cref="SdCardOperationIdValue"/>.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
internal class SdCardDeviceOperator : IStorageDeviceOperator
|
||||
{
|
||||
private SharedRef<SdCardStorageDevice> _storageDevice;
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace LibHac.SdmmcSrv;
|
|||
/// </summary>
|
||||
/// <remarks><para>This class implements the <see cref="IStorageDeviceOperator"/> interface, and all available
|
||||
/// operations are listed in <see cref="SdCardManagerOperationIdValue"/>.</para>
|
||||
/// <para>Based on nnSdk 15.3.0 (FS 15.0.0)</para></remarks>
|
||||
/// <para>Based on nnSdk 16.2.0 (FS 16.0.0)</para></remarks>
|
||||
public class SdCardManager : IStorageDeviceManager, IStorageDeviceOperator, ISdmmcDeviceManager
|
||||
{
|
||||
private const SdmmcHandle InvalidHandle = 0;
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace LibHac.SdmmcSrv;
|
|||
/// <summary>
|
||||
/// An <see cref="IStorageDevice"/> that handles interacting with the currently inserted game card.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
internal class SdCardStorageDevice : SdmmcStorageInterfaceAdapter, IStorageDevice
|
||||
{
|
||||
private SharedRef<ISdmmcDeviceManager> _manager;
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace LibHac.SdmmcSrv;
|
|||
/// <summary>
|
||||
/// Contains functions to convert <see cref="ResultSdmmc"/> <see cref="Result"/>s to their <see cref="ResultFs"/> equivalent.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
public static class SdmmcResultConverter
|
||||
{
|
||||
public static Result GetFsResult(Port port, Result result)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/// <summary>
|
||||
/// The operations that <see cref="SdCardManager"/> can perform on the SD card device.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
public enum SdCardManagerOperationIdValue
|
||||
{
|
||||
GetAndClearErrorInfo = 1,
|
||||
|
@ -15,7 +15,7 @@ public enum SdCardManagerOperationIdValue
|
|||
/// <summary>
|
||||
/// The operations that <see cref="SdCardDeviceOperator"/> can perform on the inserted SD card.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
public enum SdCardOperationIdValue
|
||||
{
|
||||
GetSpeedMode = 1,
|
||||
|
@ -29,7 +29,7 @@ public enum SdCardOperationIdValue
|
|||
/// <summary>
|
||||
/// The operations that <see cref="MmcManager"/> can perform on the internal MMC device.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
public enum MmcManagerOperationIdValue
|
||||
{
|
||||
GetAndClearErrorInfo = 1,
|
||||
|
@ -44,7 +44,7 @@ public enum MmcManagerOperationIdValue
|
|||
/// <summary>
|
||||
/// The operations that <see cref="MmcDeviceOperator"/> can perform on the internal MMC storage.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
public enum MmcOperationIdValue
|
||||
{
|
||||
GetSpeedMode = 1,
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace LibHac.SdmmcSrv;
|
|||
/// Provides an <see cref="IStorage"/> interface for calling the sdmmc Read and Write functions.
|
||||
/// The offset and size of reads and writes must be aligned to 0x200 bytes (<see cref="SdmmcApi.SectorSize"/>).
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
internal class SdmmcStorage : IStorage
|
||||
{
|
||||
private Port _port;
|
||||
|
@ -151,7 +151,7 @@ internal class SdmmcStorage : IStorage
|
|||
/// An adapter that directly translates <see cref="IStorageSf"/> sf calls to <see cref="IStorage"/> calls with no checks
|
||||
/// or validations.
|
||||
/// </summary>
|
||||
/// <remarks>Based on nnSdk 15.3.0 (FS 15.0.0)</remarks>
|
||||
/// <remarks>Based on nnSdk 16.2.0 (FS 16.0.0)</remarks>
|
||||
internal class SdmmcStorageInterfaceAdapter : IStorageSf
|
||||
{
|
||||
private IStorage _baseStorage;
|
||||
|
|
Loading…
Reference in a new issue