2024-01-25 17:06:53 -05:00
|
|
|
using Ryujinx.Horizon.Arp;
|
2024-02-22 14:58:33 -05:00
|
|
|
using Ryujinx.Horizon.Audio;
|
2023-05-09 17:46:23 -04:00
|
|
|
using Ryujinx.Horizon.Bcat;
|
2024-01-29 16:45:40 -05:00
|
|
|
using Ryujinx.Horizon.Friends;
|
2023-10-13 22:13:15 -04:00
|
|
|
using Ryujinx.Horizon.Hshl;
|
|
|
|
using Ryujinx.Horizon.Ins;
|
2023-09-14 03:50:19 -04:00
|
|
|
using Ryujinx.Horizon.Lbl;
|
2023-01-04 17:15:45 -05:00
|
|
|
using Ryujinx.Horizon.LogManager;
|
2023-08-17 08:59:05 -04:00
|
|
|
using Ryujinx.Horizon.MmNv;
|
2023-09-27 13:21:26 -04:00
|
|
|
using Ryujinx.Horizon.Ngc;
|
2023-10-13 22:13:15 -04:00
|
|
|
using Ryujinx.Horizon.Ovln;
|
2023-01-08 07:13:39 -05:00
|
|
|
using Ryujinx.Horizon.Prepo;
|
2023-10-13 22:13:15 -04:00
|
|
|
using Ryujinx.Horizon.Psc;
|
2024-04-05 14:45:43 -04:00
|
|
|
using Ryujinx.Horizon.Ptm;
|
2024-01-25 17:06:53 -05:00
|
|
|
using Ryujinx.Horizon.Sdk.Arp;
|
2023-10-13 22:13:15 -04:00
|
|
|
using Ryujinx.Horizon.Srepo;
|
|
|
|
using Ryujinx.Horizon.Usb;
|
2023-09-20 16:55:27 -04:00
|
|
|
using Ryujinx.Horizon.Wlan;
|
2023-01-04 17:15:45 -05:00
|
|
|
using System.Collections.Generic;
|
2023-01-08 07:13:39 -05:00
|
|
|
using System.Threading;
|
2023-01-04 17:15:45 -05:00
|
|
|
|
|
|
|
namespace Ryujinx.Horizon
|
|
|
|
{
|
2023-01-08 07:13:39 -05:00
|
|
|
public class ServiceTable
|
2023-01-04 17:15:45 -05:00
|
|
|
{
|
2023-01-08 07:13:39 -05:00
|
|
|
private int _readyServices;
|
|
|
|
private int _totalServices;
|
|
|
|
|
|
|
|
private readonly ManualResetEvent _servicesReadyEvent = new(false);
|
|
|
|
|
2024-01-25 17:06:53 -05:00
|
|
|
public IReader ArpReader { get; internal set; }
|
|
|
|
public IWriter ArpWriter { get; internal set; }
|
|
|
|
|
2023-01-08 07:13:39 -05:00
|
|
|
public IEnumerable<ServiceEntry> GetServices(HorizonOptions options)
|
2023-01-04 17:15:45 -05:00
|
|
|
{
|
2023-01-08 07:13:39 -05:00
|
|
|
List<ServiceEntry> entries = new();
|
2023-01-04 17:15:45 -05:00
|
|
|
|
|
|
|
void RegisterService<T>() where T : IService
|
|
|
|
{
|
2023-01-08 07:13:39 -05:00
|
|
|
entries.Add(new ServiceEntry(T.Main, this, options));
|
2023-01-04 17:15:45 -05:00
|
|
|
}
|
|
|
|
|
2024-01-25 17:06:53 -05:00
|
|
|
RegisterService<ArpMain>();
|
2024-02-22 14:58:33 -05:00
|
|
|
RegisterService<AudioMain>();
|
2023-05-09 17:46:23 -04:00
|
|
|
RegisterService<BcatMain>();
|
2024-01-29 16:45:40 -05:00
|
|
|
RegisterService<FriendsMain>();
|
2023-10-13 22:13:15 -04:00
|
|
|
RegisterService<HshlMain>();
|
2024-02-22 14:58:33 -05:00
|
|
|
RegisterService<HwopusMain>(); // TODO: Merge with audio once we can start multiple threads.
|
2023-10-13 22:13:15 -04:00
|
|
|
RegisterService<InsMain>();
|
2023-09-14 03:50:19 -04:00
|
|
|
RegisterService<LblMain>();
|
|
|
|
RegisterService<LmMain>();
|
2023-08-17 08:59:05 -04:00
|
|
|
RegisterService<MmNvMain>();
|
2023-10-13 22:13:15 -04:00
|
|
|
RegisterService<NgcMain>();
|
|
|
|
RegisterService<OvlnMain>();
|
2023-09-14 03:50:19 -04:00
|
|
|
RegisterService<PrepoMain>();
|
2023-10-13 22:13:15 -04:00
|
|
|
RegisterService<PscMain>();
|
|
|
|
RegisterService<SrepoMain>();
|
2024-04-05 14:45:43 -04:00
|
|
|
RegisterService<TsMain>();
|
2023-10-13 22:13:15 -04:00
|
|
|
RegisterService<UsbMain>();
|
2023-09-20 16:55:27 -04:00
|
|
|
RegisterService<WlanMain>();
|
2023-01-08 07:13:39 -05:00
|
|
|
|
|
|
|
_totalServices = entries.Count;
|
2023-01-04 17:15:45 -05:00
|
|
|
|
|
|
|
return entries;
|
|
|
|
}
|
2023-01-08 07:13:39 -05:00
|
|
|
|
|
|
|
internal void SignalServiceReady()
|
|
|
|
{
|
|
|
|
if (Interlocked.Increment(ref _readyServices) == _totalServices)
|
|
|
|
{
|
|
|
|
_servicesReadyEvent.Set();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void WaitServicesReady()
|
|
|
|
{
|
|
|
|
_servicesReadyEvent.WaitOne();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected virtual void Dispose(bool disposing)
|
|
|
|
{
|
|
|
|
if (disposing)
|
|
|
|
{
|
|
|
|
_servicesReadyEvent.Dispose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
{
|
|
|
|
Dispose(true);
|
|
|
|
}
|
2023-01-04 17:15:45 -05:00
|
|
|
}
|
2023-07-01 06:42:10 -04:00
|
|
|
}
|