mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-03-30 18:41:08 +00:00
Compare commits
2 Commits
Canary-1.3
...
Canary-1.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13b69aedfe | ||
|
|
234f7ca298 |
@@ -1,8 +1,10 @@
|
||||
using LibHac;
|
||||
using LibHac.Common;
|
||||
using LibHac.Fs;
|
||||
using LibHac.Sf;
|
||||
using Ryujinx.Common;
|
||||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Memory;
|
||||
using System.Threading;
|
||||
|
||||
@@ -40,7 +42,19 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
|
||||
}
|
||||
|
||||
using WritableRegion region = context.Memory.GetWritableRegion(bufferAddress, (int)bufferLen, true);
|
||||
Result result = _baseStorage.Get.Read((long)offset, new OutBuffer(region.Memory.Span), (long)size);
|
||||
Result result;
|
||||
|
||||
try
|
||||
{
|
||||
result = _baseStorage.Get.Read((long)offset, new OutBuffer(region.Memory.Span), (long)size);
|
||||
}
|
||||
catch (HorizonResultException hre) when (hre.IsOfResultType(ResultFs.NonRealDataVerificationFailed))
|
||||
{
|
||||
Logger.Error?.Print(LogClass.ServiceFs,
|
||||
$"Encountered corrupted data in filesystem storage @ offset 0x{offset:X8}, size 0x{size:X8}. " +
|
||||
"Please redump the current game and/or update from your console.");
|
||||
result = ResultFs.NonRealDataVerificationFailed;
|
||||
}
|
||||
|
||||
if (context.Device.DirtyHacks.IsEnabled(DirtyHack.Xc2MenuSoftlockFix) && IsXc2)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Threading;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
||||
{
|
||||
class BsdContext
|
||||
class BsdContext : IDisposable
|
||||
{
|
||||
private static readonly ConcurrentDictionary<ulong, BsdContext> _registry = new();
|
||||
|
||||
@@ -158,6 +158,20 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
||||
return LinuxError.SUCCESS;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
int count;
|
||||
|
||||
lock (_lock)
|
||||
{
|
||||
count = _fds.Count;
|
||||
}
|
||||
|
||||
for (int fd = 0; fd < count; fd++) {
|
||||
CloseFileDescriptor(fd);
|
||||
}
|
||||
}
|
||||
|
||||
public static BsdContext GetOrRegister(ulong processId)
|
||||
{
|
||||
BsdContext context = GetContext(processId);
|
||||
@@ -174,12 +188,15 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
||||
|
||||
public static BsdContext GetContext(ulong processId)
|
||||
{
|
||||
if (!_registry.TryGetValue(processId, out BsdContext processContext))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return _registry.GetValueOrDefault(processId);
|
||||
}
|
||||
|
||||
return processContext;
|
||||
public static void DeleteContext(ulong processId)
|
||||
{
|
||||
if (_registry.Remove(processId, out BsdContext context))
|
||||
{
|
||||
context.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1165,5 +1165,13 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
||||
|
||||
return WriteBsdResult(context, newSockFd, errno);
|
||||
}
|
||||
|
||||
|
||||
public override void DestroyAtExit()
|
||||
{
|
||||
if (_context != null) {
|
||||
_context.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user