0
0
Fork 0
This repository has been archived on 2024-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
ryujinx-final/Ryujinx.Horizon/Sm/SmMain.cs
Ac_K 550747eac6
Horizon: Impl Prepo, Fixes bugs, Clean things (#4220)
* Horizon: Impl Prepo, Fixes bugs, Clean things

* remove ToArray()

* resultCode > status

* Remove old services

* Addresses gdkchan's comments and more cleanup

* Addresses Gdkchan's feedback 2

* Reorganize services, make sure service are loaded before guest

Co-Authored-By: gdkchan <5624669+gdkchan@users.noreply.github.com>

* Create interfaces for lm and sm

Co-authored-by: gdkchan <5624669+gdkchan@users.noreply.github.com>
2023-01-08 12:13:39 +00:00

34 lines
No EOL
1.2 KiB
C#

using Ryujinx.Horizon.Prepo.Types;
using Ryujinx.Horizon.Prepo;
using Ryujinx.Horizon.Sdk.Sf.Hipc;
using Ryujinx.Horizon.Sdk.Sm;
using Ryujinx.Horizon.Sm.Impl;
using Ryujinx.Horizon.Sm.Types;
namespace Ryujinx.Horizon.Sm
{
public class SmMain
{
private const int SmMaxSessionsCount = 64;
private const int SmmMaxSessionsCount = 1;
private const int SmTotalMaxSessionsCount = SmMaxSessionsCount + SmmMaxSessionsCount;
private const int MaxPortsCount = 2;
private SmServerManager _serverManager;
private readonly ServiceManager _serviceManager = new();
public void Main()
{
HorizonStatic.Syscall.ManageNamedPort(out int smHandle, "sm:", SmMaxSessionsCount).AbortOnFailure();
_serverManager = new SmServerManager(_serviceManager, null, null, MaxPortsCount, ManagerOptions.Default, SmTotalMaxSessionsCount);
_serverManager.RegisterServer((int)SmPortIndex.User, smHandle);
_serviceManager.RegisterServiceForSelf(out int smmHandle, ServiceName.Encode("sm:m"), SmmMaxSessionsCount).AbortOnFailure();
_serverManager.RegisterServer((int)SmPortIndex.Manager, smmHandle);
_serverManager.ServiceRequests();
}
}
}