mirror of
https://github.com/GreemDev/Ryujinx
synced 2024-11-22 01:43:23 +01:00
IGeneralService Implement GetClientId and IsAnyInternetRequestAccepted (#749)
* IGeneralService Implement GetClientId and IsAnyInternetRequestAccepted - Add nifm:a and nifm:u with a max sessions as comment since sm don't take care of sessions for now. - Implement IGeneralService GetClientId based on RE (close #623). - Implement IGeneralService IsAnyInternetRequestAccepted based on RE (close #624). - Add some informations in IGeneralService CreateRequest. - Fix a comment in IAccountService. * Fix requested changes
This commit is contained in:
parent
cbbbf175fb
commit
c67f0a7c4b
7 changed files with 100 additions and 10 deletions
|
@ -110,7 +110,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc
|
||||||
MakeObject(context, new IProfile(userProfile));
|
MakeObject(context, new IProfile(userProfile));
|
||||||
|
|
||||||
// Doesn't occur in our case.
|
// Doesn't occur in our case.
|
||||||
// return MakeError(ErrorModule.Account, AccErr.NullObject);
|
// return ResultCode.NullObject;
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
8
Ryujinx.HLE/HOS/Services/Nifm/GeneralServiceDetail.cs
Normal file
8
Ryujinx.HLE/HOS/Services/Nifm/GeneralServiceDetail.cs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Nifm
|
||||||
|
{
|
||||||
|
class GeneralServiceDetail
|
||||||
|
{
|
||||||
|
public int ClientId;
|
||||||
|
public bool IsAnyInternetRequestAccepted;
|
||||||
|
}
|
||||||
|
}
|
30
Ryujinx.HLE/HOS/Services/Nifm/GeneralServiceManager.cs
Normal file
30
Ryujinx.HLE/HOS/Services/Nifm/GeneralServiceManager.cs
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Nifm
|
||||||
|
{
|
||||||
|
static class GeneralServiceManager
|
||||||
|
{
|
||||||
|
private static List<GeneralServiceDetail> _generalServices = new List<GeneralServiceDetail>();
|
||||||
|
|
||||||
|
public static int Count
|
||||||
|
{
|
||||||
|
get => _generalServices.Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Add(GeneralServiceDetail generalServiceDetail)
|
||||||
|
{
|
||||||
|
_generalServices.Add(generalServiceDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Remove(int index)
|
||||||
|
{
|
||||||
|
_generalServices.RemoveAt(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GeneralServiceDetail Get(int clientId)
|
||||||
|
{
|
||||||
|
return _generalServices.First(item => item.ClientId == clientId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,19 +7,45 @@ using System.Net.Sockets;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Nifm
|
namespace Ryujinx.HLE.HOS.Services.Nifm
|
||||||
{
|
{
|
||||||
class IGeneralService : IpcService
|
class IGeneralService : IpcService, IDisposable
|
||||||
{
|
{
|
||||||
public IGeneralService() { }
|
private GeneralServiceDetail _generalServiceDetail;
|
||||||
|
|
||||||
|
public IGeneralService()
|
||||||
|
{
|
||||||
|
_generalServiceDetail = new GeneralServiceDetail
|
||||||
|
{
|
||||||
|
ClientId = GeneralServiceManager.Count,
|
||||||
|
IsAnyInternetRequestAccepted = true // NOTE: Why not accept any internet request?
|
||||||
|
};
|
||||||
|
|
||||||
|
GeneralServiceManager.Add(_generalServiceDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command(1)]
|
||||||
|
// GetClientId() -> buffer<nn::nifm::ClientId, 0x1a, 4>
|
||||||
|
public ResultCode GetClientId(ServiceCtx context)
|
||||||
|
{
|
||||||
|
long position = context.Request.RecvListBuff[0].Position;
|
||||||
|
long size = context.Request.RecvListBuff[0].Size;
|
||||||
|
|
||||||
|
context.Memory.WriteInt32(position, _generalServiceDetail.ClientId);
|
||||||
|
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
|
|
||||||
[Command(4)]
|
[Command(4)]
|
||||||
// CreateRequest(u32) -> object<nn::nifm::detail::IRequest>
|
// CreateRequest(u32 version) -> object<nn::nifm::detail::IRequest>
|
||||||
public ResultCode CreateRequest(ServiceCtx context)
|
public ResultCode CreateRequest(ServiceCtx context)
|
||||||
{
|
{
|
||||||
int unknown = context.RequestData.ReadInt32();
|
uint version = context.RequestData.ReadUInt32();
|
||||||
|
|
||||||
MakeObject(context, new IRequest(context.Device.System));
|
MakeObject(context, new IRequest(context.Device.System, version));
|
||||||
|
|
||||||
Logger.PrintStub(LogClass.ServiceNifm);
|
// Doesn't occur in our case.
|
||||||
|
// return ResultCode.ObjectIsNull;
|
||||||
|
|
||||||
|
Logger.PrintStub(LogClass.ServiceNifm, new { version });
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
@ -43,5 +69,24 @@ namespace Ryujinx.HLE.HOS.Services.Nifm
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Command(21)]
|
||||||
|
// IsAnyInternetRequestAccepted(buffer<nn::nifm::ClientId, 0x19, 4>) -> bool
|
||||||
|
public ResultCode IsAnyInternetRequestAccepted(ServiceCtx context)
|
||||||
|
{
|
||||||
|
long position = context.Request.PtrBuff[0].Position;
|
||||||
|
long size = context.Request.PtrBuff[0].Size;
|
||||||
|
|
||||||
|
int clientId = context.Memory.ReadInt32(position);
|
||||||
|
|
||||||
|
context.ResponseData.Write(GeneralServiceManager.Get(clientId).IsAnyInternetRequestAccepted);
|
||||||
|
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
GeneralServiceManager.Remove(_generalServiceDetail.ClientId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,10 +11,14 @@ namespace Ryujinx.HLE.HOS.Services.Nifm
|
||||||
private KEvent _event0;
|
private KEvent _event0;
|
||||||
private KEvent _event1;
|
private KEvent _event1;
|
||||||
|
|
||||||
public IRequest(Horizon system)
|
private uint _version;
|
||||||
|
|
||||||
|
public IRequest(Horizon system, uint version)
|
||||||
{
|
{
|
||||||
_event0 = new KEvent(system);
|
_event0 = new KEvent(system);
|
||||||
_event1 = new KEvent(system);
|
_event1 = new KEvent(system);
|
||||||
|
|
||||||
|
_version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command(0)]
|
[Command(0)]
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Nifm
|
namespace Ryujinx.HLE.HOS.Services.Nifm
|
||||||
{
|
{
|
||||||
[Service("nifm:u")]
|
[Service("nifm:a")] // Max sessions: 2
|
||||||
|
[Service("nifm:s")] // Max sessions: 16
|
||||||
|
[Service("nifm:u")] // Max sessions: 5
|
||||||
class IStaticService : IpcService
|
class IStaticService : IpcService
|
||||||
{
|
{
|
||||||
public IStaticService(ServiceCtx context) { }
|
public IStaticService(ServiceCtx context) { }
|
||||||
|
|
|
@ -7,6 +7,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm
|
||||||
|
|
||||||
Success = 0,
|
Success = 0,
|
||||||
|
|
||||||
NoInternetConnection = (300 << ErrorCodeShift) | ModuleId
|
NoInternetConnection = (300 << ErrorCodeShift) | ModuleId,
|
||||||
|
ObjectIsNull = (350 << ErrorCodeShift) | ModuleId
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue