forked from Mirror/Ryujinx
Stubs implementations (#45)
Services Bsd, Nifm & SSL stubs implementations Objects IGeneralService, IRequest stubs implementations. Fake-Fix GetAvailableLanguageCodes stub too ^^!
This commit is contained in:
parent
f876bd2a80
commit
7f0bee2ff8
7 changed files with 203 additions and 6 deletions
60
Ryujinx.Core/OsHle/Services/Bsd/ServiceBsd.cs
Normal file
60
Ryujinx.Core/OsHle/Services/Bsd/ServiceBsd.cs
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
using Ryujinx.Core.OsHle.Ipc;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Ryujinx.Core.OsHle.IpcServices.Bsd
|
||||||
|
{
|
||||||
|
class ServiceBsd : IIpcService
|
||||||
|
{
|
||||||
|
private Dictionary<int, ServiceProcessRequest> m_Commands;
|
||||||
|
|
||||||
|
public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
|
||||||
|
|
||||||
|
public ServiceBsd()
|
||||||
|
{
|
||||||
|
m_Commands = new Dictionary<int, ServiceProcessRequest>()
|
||||||
|
{
|
||||||
|
{ 0, Initialize },
|
||||||
|
{ 1, StartMonitoring }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//Initialize(u32, u32, u32, u32, u32, u32, u32, u32, u64 pid, u64 transferMemorySize, pid, KObject) -> u32 bsd_errno
|
||||||
|
public long Initialize(ServiceCtx Context)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
typedef struct {
|
||||||
|
u32 version; // Observed 1 on 2.0 LibAppletWeb, 2 on 3.0.
|
||||||
|
|
||||||
|
u32 tcp_tx_buf_size; // Size of the TCP transfer (send) buffer (initial or fixed).
|
||||||
|
u32 tcp_rx_buf_size; // Size of the TCP recieve buffer (initial or fixed).
|
||||||
|
u32 tcp_tx_buf_max_size; // Maximum size of the TCP transfer (send) buffer. If it is 0, the size of the buffer is fixed to its initial value.
|
||||||
|
u32 tcp_rx_buf_max_size; // Maximum size of the TCP receive buffer. If it is 0, the size of the buffer is fixed to its initial value.
|
||||||
|
|
||||||
|
u32 udp_tx_buf_size; // Size of the UDP transfer (send) buffer (typically 0x2400 bytes).
|
||||||
|
u32 udp_rx_buf_size; // Size of the UDP receive buffer (typically 0xA500 bytes).
|
||||||
|
|
||||||
|
u32 sb_efficiency; // Number of buffers for each socket (standard values range from 1 to 8).
|
||||||
|
} BsdBufferConfig;
|
||||||
|
*/
|
||||||
|
|
||||||
|
long Pid = Context.RequestData.ReadInt64();
|
||||||
|
long TransferMemorySize = Context.RequestData.ReadInt64();
|
||||||
|
|
||||||
|
// Two other args are unknown!
|
||||||
|
|
||||||
|
Context.ResponseData.Write(0);
|
||||||
|
|
||||||
|
//Todo: Stub
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//StartMonitoring(u64, pid)
|
||||||
|
public long StartMonitoring(ServiceCtx Context)
|
||||||
|
{
|
||||||
|
//Todo: Stub
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
34
Ryujinx.Core/OsHle/Services/Nifm/IGeneralService.cs
Normal file
34
Ryujinx.Core/OsHle/Services/Nifm/IGeneralService.cs
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
using Ryujinx.Core.OsHle.Ipc;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
|
||||||
|
|
||||||
|
namespace Ryujinx.Core.OsHle.IpcServices.Nifm
|
||||||
|
{
|
||||||
|
class IGeneralService : IIpcService
|
||||||
|
{
|
||||||
|
private Dictionary<int, ServiceProcessRequest> m_Commands;
|
||||||
|
|
||||||
|
public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
|
||||||
|
|
||||||
|
public IGeneralService()
|
||||||
|
{
|
||||||
|
m_Commands = new Dictionary<int, ServiceProcessRequest>()
|
||||||
|
{
|
||||||
|
{ 4, CreateRequest }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//CreateRequest(i32)
|
||||||
|
public long CreateRequest(ServiceCtx Context)
|
||||||
|
{
|
||||||
|
int Unknown = Context.RequestData.ReadInt32();
|
||||||
|
|
||||||
|
MakeObject(Context, new IRequest());
|
||||||
|
|
||||||
|
//Todo: Stub
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
49
Ryujinx.Core/OsHle/Services/Nifm/IRequest.cs
Normal file
49
Ryujinx.Core/OsHle/Services/Nifm/IRequest.cs
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
using Ryujinx.Core.OsHle.Ipc;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Ryujinx.Core.OsHle.IpcServices.Nifm
|
||||||
|
{
|
||||||
|
class IRequest : IIpcService
|
||||||
|
{
|
||||||
|
private Dictionary<int, ServiceProcessRequest> m_Commands;
|
||||||
|
|
||||||
|
public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
|
||||||
|
|
||||||
|
public IRequest()
|
||||||
|
{
|
||||||
|
m_Commands = new Dictionary<int, ServiceProcessRequest>()
|
||||||
|
{
|
||||||
|
{ 0, GetRequestState },
|
||||||
|
{ 1, GetResult },
|
||||||
|
{ 2, GetSystemEventReadableHandles }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// -> i32
|
||||||
|
public long GetRequestState(ServiceCtx Context)
|
||||||
|
{
|
||||||
|
Context.ResponseData.Write(0);
|
||||||
|
|
||||||
|
//Todo: Stub
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long GetResult(ServiceCtx Context)
|
||||||
|
{
|
||||||
|
//Todo: Stub
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//GetSystemEventReadableHandles() -> (KObject, KObject)
|
||||||
|
public long GetSystemEventReadableHandles(ServiceCtx Context)
|
||||||
|
{
|
||||||
|
Context.Response.HandleDesc = IpcHandleDesc.MakeMove(0xbadcafe);
|
||||||
|
|
||||||
|
//Todo: Stub
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
29
Ryujinx.Core/OsHle/Services/Nifm/ServiceNifm.cs
Normal file
29
Ryujinx.Core/OsHle/Services/Nifm/ServiceNifm.cs
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
using Ryujinx.Core.OsHle.Ipc;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
|
||||||
|
|
||||||
|
namespace Ryujinx.Core.OsHle.IpcServices.Nifm
|
||||||
|
{
|
||||||
|
class ServiceNifm : IIpcService
|
||||||
|
{
|
||||||
|
private Dictionary<int, ServiceProcessRequest> m_Commands;
|
||||||
|
|
||||||
|
public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
|
||||||
|
|
||||||
|
public ServiceNifm()
|
||||||
|
{
|
||||||
|
m_Commands = new Dictionary<int, ServiceProcessRequest>()
|
||||||
|
{
|
||||||
|
{ 4, CreateGeneralServiceOld }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public long CreateGeneralServiceOld(ServiceCtx Context)
|
||||||
|
{
|
||||||
|
MakeObject(Context, new IGeneralService());
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,16 +2,19 @@ using Ryujinx.Core.OsHle.IpcServices.Acc;
|
||||||
using Ryujinx.Core.OsHle.IpcServices.Am;
|
using Ryujinx.Core.OsHle.IpcServices.Am;
|
||||||
using Ryujinx.Core.OsHle.IpcServices.Apm;
|
using Ryujinx.Core.OsHle.IpcServices.Apm;
|
||||||
using Ryujinx.Core.OsHle.IpcServices.Aud;
|
using Ryujinx.Core.OsHle.IpcServices.Aud;
|
||||||
|
using Ryujinx.Core.OsHle.IpcServices.Bsd;
|
||||||
using Ryujinx.Core.OsHle.IpcServices.Friend;
|
using Ryujinx.Core.OsHle.IpcServices.Friend;
|
||||||
using Ryujinx.Core.OsHle.IpcServices.FspSrv;
|
using Ryujinx.Core.OsHle.IpcServices.FspSrv;
|
||||||
using Ryujinx.Core.OsHle.IpcServices.Hid;
|
using Ryujinx.Core.OsHle.IpcServices.Hid;
|
||||||
using Ryujinx.Core.OsHle.IpcServices.Lm;
|
using Ryujinx.Core.OsHle.IpcServices.Lm;
|
||||||
|
using Ryujinx.Core.OsHle.IpcServices.Nifm;
|
||||||
using Ryujinx.Core.OsHle.IpcServices.Ns;
|
using Ryujinx.Core.OsHle.IpcServices.Ns;
|
||||||
using Ryujinx.Core.OsHle.IpcServices.NvServices;
|
using Ryujinx.Core.OsHle.IpcServices.NvServices;
|
||||||
using Ryujinx.Core.OsHle.IpcServices.Pctl;
|
using Ryujinx.Core.OsHle.IpcServices.Pctl;
|
||||||
using Ryujinx.Core.OsHle.IpcServices.Pl;
|
using Ryujinx.Core.OsHle.IpcServices.Pl;
|
||||||
using Ryujinx.Core.OsHle.IpcServices.Set;
|
using Ryujinx.Core.OsHle.IpcServices.Set;
|
||||||
using Ryujinx.Core.OsHle.IpcServices.Sm;
|
using Ryujinx.Core.OsHle.IpcServices.Sm;
|
||||||
|
using Ryujinx.Core.OsHle.IpcServices.Ssl;
|
||||||
using Ryujinx.Core.OsHle.IpcServices.Time;
|
using Ryujinx.Core.OsHle.IpcServices.Time;
|
||||||
using Ryujinx.Core.OsHle.IpcServices.Vi;
|
using Ryujinx.Core.OsHle.IpcServices.Vi;
|
||||||
using System;
|
using System;
|
||||||
|
@ -31,16 +34,19 @@ namespace Ryujinx.Core.OsHle.IpcServices
|
||||||
case "appletOE": return new ServiceAppletOE();
|
case "appletOE": return new ServiceAppletOE();
|
||||||
case "audout:u": return new ServiceAudOut();
|
case "audout:u": return new ServiceAudOut();
|
||||||
case "audren:u": return new ServiceAudRen();
|
case "audren:u": return new ServiceAudRen();
|
||||||
|
case "bsd:u": return new ServiceBsd();
|
||||||
case "friend:a": return new ServiceFriend();
|
case "friend:a": return new ServiceFriend();
|
||||||
case "fsp-srv": return new ServiceFspSrv();
|
case "fsp-srv": return new ServiceFspSrv();
|
||||||
case "hid": return new ServiceHid();
|
case "hid": return new ServiceHid();
|
||||||
case "lm": return new ServiceLm();
|
case "lm": return new ServiceLm();
|
||||||
|
case "nifm:u": return new ServiceNifm();
|
||||||
case "nvdrv": return new ServiceNvDrv();
|
case "nvdrv": return new ServiceNvDrv();
|
||||||
case "nvdrv:a": return new ServiceNvDrv();
|
case "nvdrv:a": return new ServiceNvDrv();
|
||||||
case "pctl:a": return new ServicePctl();
|
case "pctl:a": return new ServicePctl();
|
||||||
case "pl:u": return new ServicePl();
|
case "pl:u": return new ServicePl();
|
||||||
case "set": return new ServiceSet();
|
case "set": return new ServiceSet();
|
||||||
case "sm:": return new ServiceSm();
|
case "sm:": return new ServiceSm();
|
||||||
|
case "ssl": return new ServiceSsl();
|
||||||
case "time:s": return new ServiceTime();
|
case "time:s": return new ServiceTime();
|
||||||
case "time:u": return new ServiceTime();
|
case "time:u": return new ServiceTime();
|
||||||
case "vi:m": return new ServiceVi();
|
case "vi:m": return new ServiceVi();
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using ChocolArm64.Memory;
|
using ChocolArm64.Memory;
|
||||||
using Ryujinx.Core.OsHle.Ipc;
|
using Ryujinx.Core.OsHle.Ipc;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Ryujinx.Core.OsHle.IpcServices.Set
|
namespace Ryujinx.Core.OsHle.IpcServices.Set
|
||||||
|
@ -30,12 +31,10 @@ namespace Ryujinx.Core.OsHle.IpcServices.Set
|
||||||
short Size = Context.Request.RecvListBuff[0].Size;
|
short Size = Context.Request.RecvListBuff[0].Size;
|
||||||
|
|
||||||
//This should return an array of ints with values matching the LanguageCode enum.
|
//This should return an array of ints with values matching the LanguageCode enum.
|
||||||
byte[] Data = new byte[Size];
|
foreach (long value in new long[] { 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L })
|
||||||
|
{
|
||||||
Data[0] = 0;
|
AMemoryHelper.WriteBytes(Context.Memory, Position += 8, BitConverter.GetBytes(value));
|
||||||
Data[1] = 1;
|
}
|
||||||
|
|
||||||
AMemoryHelper.WriteBytes(Context.Memory, Position, Data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Context.ResponseData.Write(LangCodesCount);
|
Context.ResponseData.Write(LangCodesCount);
|
||||||
|
|
20
Ryujinx.Core/OsHle/Services/Ssl/ServiceSsl.cs
Normal file
20
Ryujinx.Core/OsHle/Services/Ssl/ServiceSsl.cs
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
using Ryujinx.Core.OsHle.Ipc;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Ryujinx.Core.OsHle.IpcServices.Ssl
|
||||||
|
{
|
||||||
|
class ServiceSsl : IIpcService
|
||||||
|
{
|
||||||
|
private Dictionary<int, ServiceProcessRequest> m_Commands;
|
||||||
|
|
||||||
|
public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
|
||||||
|
|
||||||
|
public ServiceSsl()
|
||||||
|
{
|
||||||
|
m_Commands = new Dictionary<int, ServiceProcessRequest>()
|
||||||
|
{
|
||||||
|
//{ 0, Function }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in a new issue