Revert LibHac update

Users are facing save destruction on failing extra data update apparently
This commit is contained in:
Mary 2021-07-13 16:48:54 +02:00
parent 997380d48c
commit 208ba1dde2
32 changed files with 575 additions and 1805 deletions

View file

@ -1,6 +1,6 @@
using LibHac.Common.Keys;
using LibHac;
using LibHac.Bcat;
using LibHac.Fs;
using LibHac.Fs.Shim;
using LibHac.FsSystem;
using Ryujinx.Audio;
using Ryujinx.Audio.Input;
@ -18,6 +18,7 @@ using Ryujinx.HLE.HOS.Services;
using Ryujinx.HLE.HOS.Services.Account.Acc;
using Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy;
using Ryujinx.HLE.HOS.Services.Apm;
using Ryujinx.HLE.HOS.Services.Arp;
using Ryujinx.HLE.HOS.Services.Audio.AudioRenderer;
using Ryujinx.HLE.HOS.Services.Caps;
using Ryujinx.HLE.HOS.Services.Mii;
@ -37,7 +38,6 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using TimeSpanType = Ryujinx.HLE.HOS.Services.Time.Clock.TimeSpanType;
namespace Ryujinx.HLE.HOS
{
@ -97,7 +97,7 @@ namespace Ryujinx.HLE.HOS
internal KEvent DisplayResolutionChangeEvent { get; private set; }
public KeySet KeySet => Device.FileSystem.KeySet;
public Keyset KeySet => Device.FileSystem.KeySet;
private bool _isDisposed;
@ -111,7 +111,8 @@ namespace Ryujinx.HLE.HOS
internal NvHostSyncpt HostSyncpoint { get; private set; }
internal LibHacHorizonManager LibHacHorizonManager { get; private set; }
internal LibHac.Horizon LibHacHorizonServer { get; private set; }
internal HorizonClient LibHacHorizonClient { get; private set; }
public Horizon(Switch device)
{
@ -183,8 +184,6 @@ namespace Ryujinx.HLE.HOS
ContentManager = device.Configuration.ContentManager;
CaptureManager = new CaptureManager(device);
LibHacHorizonManager = device.Configuration.LibHacHorizonManager;
// TODO: use set:sys (and get external clock source id from settings)
// TODO: use "time!standard_steady_clock_rtc_update_interval_minutes" and implement a worker thread to be accurate.
UInt128 clockSourceId = new UInt128(Guid.NewGuid().ToByteArray());
@ -224,16 +223,17 @@ namespace Ryujinx.HLE.HOS
TimeServiceManager.Instance.SetupStandardUserSystemClock(null, false, SteadyClockTimePoint.GetRandom());
// FIXME: TimeZone should be init here but it's actually done in ContentManager
// FIXME: TimeZone shoud be init here but it's actually done in ContentManager
TimeServiceManager.Instance.SetupEphemeralNetworkSystemClock();
DatabaseImpl.Instance.InitializeDatabase(LibHacHorizonManager.SdbClient);
DatabaseImpl.Instance.InitializeDatabase(device);
HostSyncpoint = new NvHostSyncpt(device);
SurfaceFlinger = new SurfaceFlinger(device);
InitLibHacHorizon();
InitializeAudioRenderer();
}
@ -309,6 +309,20 @@ namespace Ryujinx.HLE.HOS
ProgramLoader.LoadKip(KernelContext, new KipExecutable(kipFile));
}
private void InitLibHacHorizon()
{
LibHac.Horizon horizon = new LibHac.Horizon(null, Device.FileSystem.FsServer);
horizon.CreateHorizonClient(out HorizonClient ryujinxClient).ThrowIfFailure();
horizon.CreateHorizonClient(out HorizonClient bcatClient).ThrowIfFailure();
ryujinxClient.Sm.RegisterService(new LibHacIReader(this), "arp:r").ThrowIfFailure();
new BcatServer(bcatClient);
LibHacHorizonServer = horizon;
LibHacHorizonClient = ryujinxClient;
}
public void ChangeDockedModeState(bool newState)
{
if (newState != State.DockedMode)
@ -341,8 +355,8 @@ namespace Ryujinx.HLE.HOS
{
if (NfpDevices[nfpDeviceId].State == NfpDeviceState.SearchingForTag)
{
NfpDevices[nfpDeviceId].State = NfpDeviceState.TagFound;
NfpDevices[nfpDeviceId].AmiiboId = amiiboId;
NfpDevices[nfpDeviceId].State = NfpDeviceState.TagFound;
NfpDevices[nfpDeviceId].AmiiboId = amiiboId;
NfpDevices[nfpDeviceId].UseRandomUuid = useRandomUuid;
}
}
@ -439,8 +453,6 @@ namespace Ryujinx.HLE.HOS
AudioRendererManager.Dispose();
LibHacHorizonManager.AmClient.Fs.UnregisterProgram(LibHacHorizonManager.ApplicationClient.Os.GetCurrentProcessId().Value);
KernelContext.Dispose();
}
}