Initial support for the new 12.x IPC system (#2182)

* Rename CommandAttribute as CommandHIpcAttribute to prepare for 12.x changes

* Implement inital support for TIPC and adds SM command ids

* *Ipc to *ipc

* Missed a ref in last commit...

* CommandAttributeTIpc to CommandAttributeTipc

* Addresses comment and fixes some bugs around

TIPC doesn't have any padding requirements as buffer C isn't a thing
Fix for RegisterService inverting two argument only on TIPC
This commit is contained in:
Mary 2021-04-14 00:01:24 +02:00 committed by GitHub
parent faa654dbaf
commit 0746b83edf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
132 changed files with 1077 additions and 951 deletions

View file

@ -14,7 +14,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
_baseDirectory = directory;
}
[Command(0)]
[CommandHipc(0)]
// Read() -> (u64 count, buffer<nn::fssrv::sf::IDirectoryEntry, 6, 0> entries)
public ResultCode Read(ServiceCtx context)
{
@ -32,7 +32,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
return (ResultCode)result.Value;
}
[Command(1)]
[CommandHipc(1)]
// GetEntryCount() -> u64
public ResultCode GetEntryCount(ServiceCtx context)
{

View file

@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
_baseFile = baseFile;
}
[Command(0)]
[CommandHipc(0)]
// Read(u32 readOption, u64 offset, u64 size) -> (u64 out_size, buffer<u8, 0x46, 0> out_buf)
public ResultCode Read(ServiceCtx context)
{
@ -36,7 +36,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
return (ResultCode)result.Value;
}
[Command(1)]
[CommandHipc(1)]
// Write(u32 writeOption, u64 offset, u64 size, buffer<u8, 0x45, 0>)
public ResultCode Write(ServiceCtx context)
{
@ -55,14 +55,14 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
return (ResultCode)_baseFile.Write(offset, data, writeOption).Value;
}
[Command(2)]
[CommandHipc(2)]
// Flush()
public ResultCode Flush(ServiceCtx context)
{
return (ResultCode)_baseFile.Flush().Value;
}
[Command(3)]
[CommandHipc(3)]
// SetSize(u64 size)
public ResultCode SetSize(ServiceCtx context)
{
@ -71,7 +71,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
return (ResultCode)_baseFile.SetSize(size).Value;
}
[Command(4)]
[CommandHipc(4)]
// GetSize() -> u64 fileSize
public ResultCode GetSize(ServiceCtx context)
{

View file

@ -20,7 +20,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
return _fileSystem;
}
[Command(0)]
[CommandHipc(0)]
// CreateFile(u32 createOption, u64 size, buffer<bytes<0x301>, 0x19, 0x301> path)
public ResultCode CreateFile(ServiceCtx context)
{
@ -34,7 +34,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
return (ResultCode)_fileSystem.CreateFile(name, size, createOption).Value;
}
[Command(1)]
[CommandHipc(1)]
// DeleteFile(buffer<bytes<0x301>, 0x19, 0x301> path)
public ResultCode DeleteFile(ServiceCtx context)
{
@ -43,7 +43,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
return (ResultCode)_fileSystem.DeleteFile(name).Value;
}
[Command(2)]
[CommandHipc(2)]
// CreateDirectory(buffer<bytes<0x301>, 0x19, 0x301> path)
public ResultCode CreateDirectory(ServiceCtx context)
{
@ -52,7 +52,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
return (ResultCode)_fileSystem.CreateDirectory(name).Value;
}
[Command(3)]
[CommandHipc(3)]
// DeleteDirectory(buffer<bytes<0x301>, 0x19, 0x301> path)
public ResultCode DeleteDirectory(ServiceCtx context)
{
@ -61,7 +61,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
return (ResultCode)_fileSystem.DeleteDirectory(name).Value;
}
[Command(4)]
[CommandHipc(4)]
// DeleteDirectoryRecursively(buffer<bytes<0x301>, 0x19, 0x301> path)
public ResultCode DeleteDirectoryRecursively(ServiceCtx context)
{
@ -70,7 +70,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
return (ResultCode)_fileSystem.DeleteDirectoryRecursively(name).Value;
}
[Command(5)]
[CommandHipc(5)]
// RenameFile(buffer<bytes<0x301>, 0x19, 0x301> oldPath, buffer<bytes<0x301>, 0x19, 0x301> newPath)
public ResultCode RenameFile(ServiceCtx context)
{
@ -80,7 +80,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
return (ResultCode)_fileSystem.RenameFile(oldName, newName).Value;
}
[Command(6)]
[CommandHipc(6)]
// RenameDirectory(buffer<bytes<0x301>, 0x19, 0x301> oldPath, buffer<bytes<0x301>, 0x19, 0x301> newPath)
public ResultCode RenameDirectory(ServiceCtx context)
{
@ -90,7 +90,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
return (ResultCode)_fileSystem.RenameDirectory(oldName, newName).Value;
}
[Command(7)]
[CommandHipc(7)]
// GetEntryType(buffer<bytes<0x301>, 0x19, 0x301> path) -> nn::fssrv::sf::DirectoryEntryType
public ResultCode GetEntryType(ServiceCtx context)
{
@ -103,7 +103,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
return (ResultCode)result.Value;
}
[Command(8)]
[CommandHipc(8)]
// OpenFile(u32 mode, buffer<bytes<0x301>, 0x19, 0x301> path) -> object<nn::fssrv::sf::IFile> file
public ResultCode OpenFile(ServiceCtx context)
{
@ -123,7 +123,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
return (ResultCode)result.Value;
}
[Command(9)]
[CommandHipc(9)]
// OpenDirectory(u32 filter_flags, buffer<bytes<0x301>, 0x19, 0x301> path) -> object<nn::fssrv::sf::IDirectory> directory
public ResultCode OpenDirectory(ServiceCtx context)
{
@ -143,14 +143,14 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
return (ResultCode)result.Value;
}
[Command(10)]
[CommandHipc(10)]
// Commit()
public ResultCode Commit(ServiceCtx context)
{
return (ResultCode)_fileSystem.Commit().Value;
}
[Command(11)]
[CommandHipc(11)]
// GetFreeSpaceSize(buffer<bytes<0x301>, 0x19, 0x301> path) -> u64 totalFreeSpace
public ResultCode GetFreeSpaceSize(ServiceCtx context)
{
@ -163,7 +163,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
return (ResultCode)result.Value;
}
[Command(12)]
[CommandHipc(12)]
// GetTotalSpaceSize(buffer<bytes<0x301>, 0x19, 0x301> path) -> u64 totalSize
public ResultCode GetTotalSpaceSize(ServiceCtx context)
{
@ -176,7 +176,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
return (ResultCode)result.Value;
}
[Command(13)]
[CommandHipc(13)]
// CleanDirectoryRecursively(buffer<bytes<0x301>, 0x19, 0x301> path)
public ResultCode CleanDirectoryRecursively(ServiceCtx context)
{
@ -185,7 +185,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
return (ResultCode)_fileSystem.CleanDirectoryRecursively(name).Value;
}
[Command(14)]
[CommandHipc(14)]
// GetFileTimeStampRaw(buffer<bytes<0x301>, 0x19, 0x301> path) -> bytes<0x20> timestamp
public ResultCode GetFileTimeStampRaw(ServiceCtx context)
{

View file

@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
_baseStorage = baseStorage;
}
[Command(0)]
[CommandHipc(0)]
// Read(u64 offset, u64 length) -> buffer<u8, 0x46, 0> buffer
public ResultCode Read(ServiceCtx context)
{
@ -42,7 +42,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
return ResultCode.Success;
}
[Command(4)]
[CommandHipc(4)]
// GetSize() -> u64 size
public ResultCode GetSize(ServiceCtx context)
{

View file

@ -12,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
_baseOperator = baseOperator;
}
[Command(0)]
[CommandHipc(0)]
// IsSdCardInserted() -> b8 is_inserted
public ResultCode IsSdCardInserted(ServiceCtx context)
{
@ -23,7 +23,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)result.Value;
}
[Command(200)]
[CommandHipc(200)]
// IsGameCardInserted() -> b8 is_inserted
public ResultCode IsGameCardInserted(ServiceCtx context)
{
@ -34,7 +34,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)result.Value;
}
[Command(202)]
[CommandHipc(202)]
// GetGameCardHandle() -> u32 gamecard_handle
public ResultCode GetGameCardHandle(ServiceCtx context)
{

View file

@ -25,14 +25,14 @@ namespace Ryujinx.HLE.HOS.Services.Fs
_baseFileSystemProxy = context.Device.FileSystem.FsServer.CreateFileSystemProxyService();
}
[Command(1)]
[CommandHipc(1)]
// Initialize(u64, pid)
public ResultCode Initialize(ServiceCtx context)
{
return ResultCode.Success;
}
[Command(8)]
[CommandHipc(8)]
// OpenFileSystemWithId(nn::fssrv::sf::FileSystemType filesystem_type, nn::ApplicationId tid, buffer<bytes<0x301>, 0x19, 0x301> path)
// -> object<nn::fssrv::sf::IFileSystem> contentFs
public ResultCode OpenFileSystemWithId(ServiceCtx context)
@ -88,7 +88,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return ResultCode.InvalidInput;
}
[Command(11)]
[CommandHipc(11)]
// OpenBisFileSystem(nn::fssrv::sf::Partition partitionID, buffer<bytes<0x301>, 0x19, 0x301>) -> object<nn::fssrv::sf::IFileSystem> Bis
public ResultCode OpenBisFileSystem(ServiceCtx context)
{
@ -105,7 +105,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return ResultCode.Success;
}
[Command(18)]
[CommandHipc(18)]
// OpenSdCardFileSystem() -> object<nn::fssrv::sf::IFileSystem>
public ResultCode OpenSdCardFileSystem(ServiceCtx context)
{
@ -117,7 +117,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return ResultCode.Success;
}
[Command(21)]
[CommandHipc(21)]
public ResultCode DeleteSaveDataFileSystem(ServiceCtx context)
{
ulong saveDataId = context.RequestData.ReadUInt64();
@ -127,7 +127,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)result.Value;
}
[Command(22)]
[CommandHipc(22)]
public ResultCode CreateSaveDataFileSystem(ServiceCtx context)
{
SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
@ -148,7 +148,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)result.Value;
}
[Command(23)]
[CommandHipc(23)]
public ResultCode CreateSaveDataFileSystemBySystemSaveDataId(ServiceCtx context)
{
SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
@ -159,7 +159,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)result.Value;
}
[Command(25)]
[CommandHipc(25)]
public ResultCode DeleteSaveDataFileSystemBySaveDataSpaceId(ServiceCtx context)
{
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
@ -170,7 +170,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)result.Value;
}
[Command(28)]
[CommandHipc(28)]
public ResultCode DeleteSaveDataFileSystemBySaveDataAttribute(ServiceCtx context)
{
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
@ -181,7 +181,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)result.Value;
}
[Command(30)]
[CommandHipc(30)]
// OpenGameCardStorage(u32, u32) -> object<nn::fssrv::sf::IStorage>
public ResultCode OpenGameCardStorage(ServiceCtx context)
{
@ -198,7 +198,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)result.Value;
}
[Command(35)]
[CommandHipc(35)]
public ResultCode CreateSaveDataFileSystemWithHashSalt(ServiceCtx context)
{
SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
@ -218,7 +218,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)result.Value;
}
[Command(51)]
[CommandHipc(51)]
// OpenSaveDataFileSystem(u8 save_data_space_id, nn::fssrv::sf::SaveStruct saveStruct) -> object<nn::fssrv::sf::IFileSystem> saveDataFs
public ResultCode OpenSaveDataFileSystem(ServiceCtx context)
{
@ -242,7 +242,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)result.Value;
}
[Command(52)]
[CommandHipc(52)]
// OpenSaveDataFileSystemBySystemSaveDataId(u8 save_data_space_id, nn::fssrv::sf::SaveStruct saveStruct) -> object<nn::fssrv::sf::IFileSystem> systemSaveDataFs
public ResultCode OpenSaveDataFileSystemBySystemSaveDataId(ServiceCtx context)
{
@ -259,7 +259,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)result.Value;
}
[Command(53)]
[CommandHipc(53)]
// OpenReadOnlySaveDataFileSystem(u8 save_data_space_id, nn::fssrv::sf::SaveStruct save_struct) -> object<nn::fssrv::sf::IFileSystem>
public ResultCode OpenReadOnlySaveDataFileSystem(ServiceCtx context)
{
@ -283,7 +283,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)result.Value;
}
[Command(60)]
[CommandHipc(60)]
public ResultCode OpenSaveDataInfoReader(ServiceCtx context)
{
Result result = _baseFileSystemProxy.OpenSaveDataInfoReader(out ReferenceCountedDisposable<LibHac.FsSrv.ISaveDataInfoReader> infoReader);
@ -296,7 +296,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)result.Value;
}
[Command(61)]
[CommandHipc(61)]
public ResultCode OpenSaveDataInfoReaderBySaveDataSpaceId(ServiceCtx context)
{
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadByte();
@ -311,7 +311,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)result.Value;
}
[Command(62)]
[CommandHipc(62)]
public ResultCode OpenSaveDataInfoReaderOnlyCacheStorage(ServiceCtx context)
{
SaveDataFilter filter = new SaveDataFilter();
@ -331,7 +331,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)result.Value;
}
[Command(67)]
[CommandHipc(67)]
public ResultCode FindSaveDataWithFilter(ServiceCtx context)
{
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
@ -350,7 +350,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)result.Value;
}
[Command(68)]
[CommandHipc(68)]
public ResultCode OpenSaveDataInfoReaderWithFilter(ServiceCtx context)
{
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
@ -367,7 +367,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)result.Value;
}
[Command(71)]
[CommandHipc(71)]
public ResultCode ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(ServiceCtx context)
{
Logger.Stub?.PrintStub(LogClass.ServiceFs);
@ -377,7 +377,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return ResultCode.Success;
}
[Command(200)]
[CommandHipc(200)]
// OpenDataStorageByCurrentProcess() -> object<nn::fssrv::sf::IStorage> dataStorage
public ResultCode OpenDataStorageByCurrentProcess(ServiceCtx context)
{
@ -386,7 +386,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return 0;
}
[Command(202)]
[CommandHipc(202)]
// OpenDataStorageByDataId(u8 storageId, nn::ApplicationId tid) -> object<nn::fssrv::sf::IStorage> dataStorage
public ResultCode OpenDataStorageByDataId(ServiceCtx context)
{
@ -456,7 +456,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
throw new FileNotFoundException($"System archive with titleid {titleId:x16} was not found on Storage {storageId}. Found in {installedStorage}.");
}
[Command(203)]
[CommandHipc(203)]
// OpenPatchDataStorageByCurrentProcess() -> object<nn::fssrv::sf::IStorage>
public ResultCode OpenPatchDataStorageByCurrentProcess(ServiceCtx context)
{
@ -465,7 +465,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return ResultCode.Success;
}
[Command(400)]
[CommandHipc(400)]
// OpenDataStorageByCurrentProcess() -> object<nn::fssrv::sf::IStorage> dataStorage
public ResultCode OpenDeviceOperator(ServiceCtx context)
{
@ -479,7 +479,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)result.Value;
}
[Command(630)]
[CommandHipc(630)]
// SetSdCardAccessibility(u8)
public ResultCode SetSdCardAccessibility(ServiceCtx context)
{
@ -488,7 +488,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)_baseFileSystemProxy.SetSdCardAccessibility(isAccessible).Value;
}
[Command(631)]
[CommandHipc(631)]
// IsSdCardAccessible() -> u8
public ResultCode IsSdCardAccessible(ServiceCtx context)
{
@ -499,7 +499,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)result.Value;
}
[Command(1004)]
[CommandHipc(1004)]
// SetGlobalAccessLogMode(u32 mode)
public ResultCode SetGlobalAccessLogMode(ServiceCtx context)
{
@ -510,7 +510,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return ResultCode.Success;
}
[Command(1005)]
[CommandHipc(1005)]
// GetGlobalAccessLogMode() -> u32 logMode
public ResultCode GetGlobalAccessLogMode(ServiceCtx context)
{
@ -521,7 +521,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return ResultCode.Success;
}
[Command(1006)]
[CommandHipc(1006)]
// OutputAccessLogToSdCard(buffer<bytes, 5> log_text)
public ResultCode OutputAccessLogToSdCard(ServiceCtx context)
{
@ -533,7 +533,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return ResultCode.Success;
}
[Command(1011)]
[CommandHipc(1011)]
public ResultCode GetProgramIndexForAccessLog(ServiceCtx context)
{
int programIndex = 0;
@ -545,7 +545,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return ResultCode.Success;
}
[Command(1200)] // 6.0.0+
[CommandHipc(1200)] // 6.0.0+
// OpenMultiCommitManager() -> object<nn::fssrv::sf::IMultiCommitManager>
public ResultCode OpenMultiCommitManager(ServiceCtx context)
{

View file

@ -12,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
_baseCommitManager = baseCommitManager;
}
[Command(1)] // 6.0.0+
[CommandHipc(1)] // 6.0.0+
// Add(object<nn::fssrv::sf::IFileSystem>)
public ResultCode Add(ServiceCtx context)
{
@ -23,7 +23,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
return (ResultCode)result.Value;
}
[Command(2)] // 6.0.0+
[CommandHipc(2)] // 6.0.0+
// Commit()
public ResultCode Commit(ServiceCtx context)
{

View file

@ -12,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
_baseReader = baseReader;
}
[Command(0)]
[CommandHipc(0)]
// ReadSaveDataInfo() -> (u64, buffer<unknown, 6>)
public ResultCode ReadSaveDataInfo(ServiceCtx context)
{