mirror of
https://github.com/GreemDev/Ryujinx
synced 2024-11-22 17:56:59 +01:00
550747eac6
* 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>
58 lines
No EOL
1.3 KiB
C#
58 lines
No EOL
1.3 KiB
C#
using Ryujinx.Horizon.LogManager;
|
|
using Ryujinx.Horizon.Prepo;
|
|
using System.Collections.Generic;
|
|
using System.Threading;
|
|
|
|
namespace Ryujinx.Horizon
|
|
{
|
|
public class ServiceTable
|
|
{
|
|
private int _readyServices;
|
|
private int _totalServices;
|
|
|
|
private readonly ManualResetEvent _servicesReadyEvent = new(false);
|
|
|
|
public IEnumerable<ServiceEntry> GetServices(HorizonOptions options)
|
|
{
|
|
List<ServiceEntry> entries = new();
|
|
|
|
void RegisterService<T>() where T : IService
|
|
{
|
|
entries.Add(new ServiceEntry(T.Main, this, options));
|
|
}
|
|
|
|
RegisterService<LmMain>();
|
|
RegisterService<PrepoMain>();
|
|
|
|
_totalServices = entries.Count;
|
|
|
|
return entries;
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
} |