2022-03-22 20:46:16 +01:00
using LibHac.Ncm ;
using Ryujinx.Common.Logging ;
2020-12-17 05:19:28 +01:00
using Ryujinx.HLE.HOS.Services.Arp ;
2020-07-27 01:04:08 +02:00
using Ryujinx.HLE.HOS.Services.Nim.ShopServiceAccessServerInterface ;
namespace Ryujinx.HLE.HOS.Services.Nim
2019-09-19 02:45:11 +02:00
{
[Service("nim:eca")] // 5.0.0+
class IShopServiceAccessServerInterface : IpcService
{
public IShopServiceAccessServerInterface ( ServiceCtx context ) { }
2020-07-27 01:04:08 +02:00
2021-04-14 00:01:24 +02:00
[CommandHipc(0)]
2020-07-27 01:04:08 +02:00
// CreateServerInterface(pid, handle<unknown>, u64) -> object<nn::ec::IShopServiceAccessServer>
public ResultCode CreateServerInterface ( ServiceCtx context )
{
2023-03-24 11:56:54 +01:00
// Close transfer memory immediately as we don't use it.
context . Device . System . KernelContext . Syscall . CloseHandle ( context . Request . HandleDesc . ToCopy [ 0 ] ) ;
2020-07-27 01:04:08 +02:00
MakeObject ( context , new IShopServiceAccessServer ( ) ) ;
2020-08-04 01:32:53 +02:00
Logger . Stub ? . PrintStub ( LogClass . ServiceNim ) ;
2020-07-27 01:04:08 +02:00
return ResultCode . Success ;
}
2020-12-17 05:19:28 +01:00
2021-04-14 00:01:24 +02:00
[CommandHipc(4)] // 10.0.0+
2020-12-17 05:19:28 +01:00
// IsLargeResourceAvailable(pid) -> b8
public ResultCode IsLargeResourceAvailable ( ServiceCtx context )
{
// TODO: Service calls arp:r GetApplicationInstanceId (10.0.0+) then if it fails it calls arp:r GetMicroApplicationInstanceId (10.0.0+)
// then if it fails it returns the arp:r result code.
// NOTE: Firmare 10.0.0+ don't use the Pid here anymore, but the returned InstanceId. We don't support that for now so we can just use the Pid instead.
StorageId baseStorageId = ( StorageId ) ApplicationLaunchProperty . GetByPid ( context ) . BaseGameStorageId ;
// NOTE: Service returns ResultCode.InvalidArgument if baseStorageId is null, doesn't occur in our case.
context . ResponseData . Write ( baseStorageId = = StorageId . Host ) ;
return ResultCode . Success ;
}
2019-09-19 02:45:11 +02:00
}
}