Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
074190e03c | |||
256514c7c9 | |||
556be08c4e |
11
.github/workflows/build.yml
vendored
11
.github/workflows/build.yml
vendored
@ -46,6 +46,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
POWERSHELL_TELEMETRY_OPTOUT: 1
|
POWERSHELL_TELEMETRY_OPTOUT: 1
|
||||||
DOTNET_CLI_TELEMETRY_OPTOUT: 1
|
DOTNET_CLI_TELEMETRY_OPTOUT: 1
|
||||||
|
RYUJINX_BASE_VERSION: "1.1.0"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-dotnet@v1
|
- uses: actions/setup-dotnet@v1
|
||||||
@ -59,24 +60,24 @@ jobs:
|
|||||||
- name: Clear
|
- name: Clear
|
||||||
run: dotnet clean && dotnet nuget locals all --clear
|
run: dotnet clean && dotnet nuget locals all --clear
|
||||||
- name: Build
|
- name: Build
|
||||||
run: dotnet build -c "${{ matrix.configuration }}" /p:Version="1.1.0" /p:SourceRevisionId="${{ steps.git_short_hash.outputs.result }}" /p:ExtraDefineConstants=DISABLE_UPDATER
|
run: dotnet build -c "${{ matrix.configuration }}" /p:Version="${{ env.RYUJINX_BASE_VERSION }}" /p:SourceRevisionId="${{ steps.git_short_hash.outputs.result }}" /p:ExtraDefineConstants=DISABLE_UPDATER
|
||||||
- name: Test
|
- name: Test
|
||||||
run: dotnet test -c "${{ matrix.configuration }}"
|
run: dotnet test -c "${{ matrix.configuration }}"
|
||||||
- name: Publish Ryujinx
|
- name: Publish Ryujinx
|
||||||
run: dotnet publish -c "${{ matrix.configuration }}" -r "${{ matrix.DOTNET_RUNTIME_IDENTIFIER }}" -o ./publish /p:Version="1.1.0" /p:DebugType=embedded /p:SourceRevisionId="${{ steps.git_short_hash.outputs.result }}" /p:ExtraDefineConstants=DISABLE_UPDATER Ryujinx --self-contained
|
run: dotnet publish -c "${{ matrix.configuration }}" -r "${{ matrix.DOTNET_RUNTIME_IDENTIFIER }}" -o ./publish /p:Version="${{ env.RYUJINX_BASE_VERSION }}" /p:DebugType=embedded /p:SourceRevisionId="${{ steps.git_short_hash.outputs.result }}" /p:ExtraDefineConstants=DISABLE_UPDATER Ryujinx --self-contained
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
- name: Publish Ryujinx.Headless.SDL2
|
- name: Publish Ryujinx.Headless.SDL2
|
||||||
run: dotnet publish -c "${{ matrix.configuration }}" -r "${{ matrix.DOTNET_RUNTIME_IDENTIFIER }}" -o ./publish_sdl2_headless /p:Version="1.1.0" /p:DebugType=embedded /p:SourceRevisionId="${{ steps.git_short_hash.outputs.result }}" /p:ExtraDefineConstants=DISABLE_UPDATER Ryujinx.Headless.SDL2 --self-contained
|
run: dotnet publish -c "${{ matrix.configuration }}" -r "${{ matrix.DOTNET_RUNTIME_IDENTIFIER }}" -o ./publish_sdl2_headless /p:Version="${{ env.RYUJINX_BASE_VERSION }}" /p:DebugType=embedded /p:SourceRevisionId="${{ steps.git_short_hash.outputs.result }}" /p:ExtraDefineConstants=DISABLE_UPDATER Ryujinx.Headless.SDL2 --self-contained
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
- name: Upload Ryujinx artifact
|
- name: Upload Ryujinx artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: ryujinx-${{ matrix.configuration }}-1.0.0+${{ steps.git_short_hash.outputs.result }}-${{ matrix.RELEASE_ZIP_OS_NAME }}
|
name: ryujinx-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-${{ matrix.RELEASE_ZIP_OS_NAME }}
|
||||||
path: publish
|
path: publish
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
- name: Upload Ryujinx.Headless.SDL2 artifact
|
- name: Upload Ryujinx.Headless.SDL2 artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: ryujinx-headless-sdl2-${{ matrix.configuration }}-1.0.0+${{ steps.git_short_hash.outputs.result }}-${{ matrix.RELEASE_ZIP_OS_NAME }}
|
name: ryujinx-headless-sdl2-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-${{ matrix.RELEASE_ZIP_OS_NAME }}
|
||||||
path: publish_sdl2_headless
|
path: publish_sdl2_headless
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
|
@ -86,8 +86,8 @@ namespace Ryujinx.HLE.HOS
|
|||||||
MetaLoader metaData = ReadNpdm(codeFs);
|
MetaLoader metaData = ReadNpdm(codeFs);
|
||||||
|
|
||||||
_device.Configuration.VirtualFileSystem.ModLoader.CollectMods(
|
_device.Configuration.VirtualFileSystem.ModLoader.CollectMods(
|
||||||
new[] { TitleId },
|
new[] { TitleId },
|
||||||
_device.Configuration.VirtualFileSystem.ModLoader.GetModsBasePath(),
|
_device.Configuration.VirtualFileSystem.ModLoader.GetModsBasePath(),
|
||||||
_device.Configuration.VirtualFileSystem.ModLoader.GetSdModsBasePath());
|
_device.Configuration.VirtualFileSystem.ModLoader.GetSdModsBasePath());
|
||||||
|
|
||||||
if (TitleId != 0)
|
if (TitleId != 0)
|
||||||
@ -393,8 +393,8 @@ namespace Ryujinx.HLE.HOS
|
|||||||
MetaLoader metaData = ReadNpdm(codeFs);
|
MetaLoader metaData = ReadNpdm(codeFs);
|
||||||
|
|
||||||
_device.Configuration.VirtualFileSystem.ModLoader.CollectMods(
|
_device.Configuration.VirtualFileSystem.ModLoader.CollectMods(
|
||||||
_device.Configuration.ContentManager.GetAocTitleIds().Prepend(TitleId),
|
_device.Configuration.ContentManager.GetAocTitleIds().Prepend(TitleId),
|
||||||
_device.Configuration.VirtualFileSystem.ModLoader.GetModsBasePath(),
|
_device.Configuration.VirtualFileSystem.ModLoader.GetModsBasePath(),
|
||||||
_device.Configuration.VirtualFileSystem.ModLoader.GetSdModsBasePath());
|
_device.Configuration.VirtualFileSystem.ModLoader.GetSdModsBasePath());
|
||||||
|
|
||||||
if (controlNca != null)
|
if (controlNca != null)
|
||||||
@ -571,8 +571,12 @@ namespace Ryujinx.HLE.HOS
|
|||||||
|
|
||||||
Ptc.Initialize(TitleIdText, DisplayVersion, usePtc, memoryManagerMode);
|
Ptc.Initialize(TitleIdText, DisplayVersion, usePtc, memoryManagerMode);
|
||||||
|
|
||||||
|
// We allow it for nx-hbloader because it can be used to launch homebrew.
|
||||||
|
bool allowCodeMemoryForJit = TitleId == 0x010000000000100DUL;
|
||||||
|
|
||||||
metaData.GetNpdm(out Npdm npdm).ThrowIfFailure();
|
metaData.GetNpdm(out Npdm npdm).ThrowIfFailure();
|
||||||
ProgramLoader.LoadNsos(_device.System.KernelContext, out ProcessTamperInfo tamperInfo, metaData, new ProgramInfo(in npdm), executables: programs);
|
ProgramInfo programInfo = new ProgramInfo(in npdm, allowCodeMemoryForJit);
|
||||||
|
ProgramLoader.LoadNsos(_device.System.KernelContext, out ProcessTamperInfo tamperInfo, metaData, programInfo, executables: programs);
|
||||||
|
|
||||||
_device.Configuration.VirtualFileSystem.ModLoader.LoadCheats(TitleId, tamperInfo, _device.TamperMachine);
|
_device.Configuration.VirtualFileSystem.ModLoader.LoadCheats(TitleId, tamperInfo, _device.TamperMachine);
|
||||||
}
|
}
|
||||||
@ -581,7 +585,7 @@ namespace Ryujinx.HLE.HOS
|
|||||||
{
|
{
|
||||||
MetaLoader metaData = GetDefaultNpdm();
|
MetaLoader metaData = GetDefaultNpdm();
|
||||||
metaData.GetNpdm(out Npdm npdm).ThrowIfFailure();
|
metaData.GetNpdm(out Npdm npdm).ThrowIfFailure();
|
||||||
ProgramInfo programInfo = new ProgramInfo(in npdm);
|
ProgramInfo programInfo = new ProgramInfo(in npdm, allowCodeMemoryForJit: true);
|
||||||
|
|
||||||
bool isNro = Path.GetExtension(filePath).ToLower() == ".nro";
|
bool isNro = Path.GetExtension(filePath).ToLower() == ".nro";
|
||||||
|
|
||||||
|
@ -59,5 +59,15 @@ namespace Ryujinx.HLE.HOS.Kernel
|
|||||||
{
|
{
|
||||||
return GetCurrentThread().Owner;
|
return GetCurrentThread().Owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static KProcess GetProcessByPid(ulong pid)
|
||||||
|
{
|
||||||
|
if (Context.Processes.TryGetValue(pid, out KProcess process))
|
||||||
|
{
|
||||||
|
return process;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||||||
|
|
||||||
public KProcessCapabilities Capabilities { get; private set; }
|
public KProcessCapabilities Capabilities { get; private set; }
|
||||||
|
|
||||||
|
public bool AllowCodeMemoryForJit { get; private set; }
|
||||||
|
|
||||||
public ulong TitleId { get; private set; }
|
public ulong TitleId { get; private set; }
|
||||||
public bool IsApplication { get; private set; }
|
public bool IsApplication { get; private set; }
|
||||||
public ulong Pid { get; private set; }
|
public ulong Pid { get; private set; }
|
||||||
@ -90,7 +92,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||||||
|
|
||||||
public HleProcessDebugger Debugger { get; private set; }
|
public HleProcessDebugger Debugger { get; private set; }
|
||||||
|
|
||||||
public KProcess(KernelContext context) : base(context)
|
public KProcess(KernelContext context, bool allowCodeMemoryForJit = false) : base(context)
|
||||||
{
|
{
|
||||||
_processLock = new object();
|
_processLock = new object();
|
||||||
_threadingLock = new object();
|
_threadingLock = new object();
|
||||||
@ -102,6 +104,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||||||
|
|
||||||
Capabilities = new KProcessCapabilities();
|
Capabilities = new KProcessCapabilities();
|
||||||
|
|
||||||
|
AllowCodeMemoryForJit = allowCodeMemoryForJit;
|
||||||
|
|
||||||
RandomEntropy = new ulong[KScheduler.CpuCoresCount];
|
RandomEntropy = new ulong[KScheduler.CpuCoresCount];
|
||||||
PinnedThreads = new KThread[KScheduler.CpuCoresCount];
|
PinnedThreads = new KThread[KScheduler.CpuCoresCount];
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ using Ryujinx.HLE.HOS.Kernel.Ipc;
|
|||||||
using Ryujinx.HLE.HOS.Kernel.Memory;
|
using Ryujinx.HLE.HOS.Kernel.Memory;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Process;
|
using Ryujinx.HLE.HOS.Kernel.Process;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||||
using Ryujinx.Memory;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
@ -1363,10 +1362,10 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
|||||||
|
|
||||||
KCodeMemory codeMemory = currentProcess.HandleTable.GetObject<KCodeMemory>(handle);
|
KCodeMemory codeMemory = currentProcess.HandleTable.GetObject<KCodeMemory>(handle);
|
||||||
|
|
||||||
// Newer versions of the return also returns an error here if the owner and process
|
// Newer versions of the kernel also returns an error here if the owner and process
|
||||||
// where the operation will happen are the same. We do not return an error here
|
// where the operation will happen are the same. We do not return an error here
|
||||||
// because some homebrew requires this to be patched out to work (for JIT).
|
// for homebrew because some of them requires this to be patched out to work (for JIT).
|
||||||
if (codeMemory == null /* || codeMemory.Owner == currentProcess */)
|
if (codeMemory == null || (!currentProcess.AllowCodeMemoryForJit && codeMemory.Owner == currentProcess))
|
||||||
{
|
{
|
||||||
return KernelResult.InvalidHandle;
|
return KernelResult.InvalidHandle;
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,13 @@ namespace Ryujinx.HLE.HOS
|
|||||||
{
|
{
|
||||||
public string Name;
|
public string Name;
|
||||||
public ulong ProgramId;
|
public ulong ProgramId;
|
||||||
|
public bool AllowCodeMemoryForJit;
|
||||||
|
|
||||||
public ProgramInfo(in Npdm npdm)
|
public ProgramInfo(in Npdm npdm, bool allowCodeMemoryForJit)
|
||||||
{
|
{
|
||||||
Name = StringUtils.Utf8ZToString(npdm.Meta.Value.ProgramName);
|
Name = StringUtils.Utf8ZToString(npdm.Meta.Value.ProgramName);
|
||||||
ProgramId = npdm.Aci.Value.ProgramId.Value;
|
ProgramId = npdm.Aci.Value.ProgramId.Value;
|
||||||
|
AllowCodeMemoryForJit = allowCodeMemoryForJit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +143,13 @@ namespace Ryujinx.HLE.HOS
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool LoadNsos(KernelContext context, out ProcessTamperInfo tamperInfo, MetaLoader metaData, ProgramInfo programInfo, byte[] arguments = null, params IExecutable[] executables)
|
public static bool LoadNsos(
|
||||||
|
KernelContext context,
|
||||||
|
out ProcessTamperInfo tamperInfo,
|
||||||
|
MetaLoader metaData,
|
||||||
|
ProgramInfo programInfo,
|
||||||
|
byte[] arguments = null,
|
||||||
|
params IExecutable[] executables)
|
||||||
{
|
{
|
||||||
LibHac.Result rc = metaData.GetNpdm(out var npdm);
|
LibHac.Result rc = metaData.GetNpdm(out var npdm);
|
||||||
|
|
||||||
@ -243,7 +251,7 @@ namespace Ryujinx.HLE.HOS
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
KProcess process = new KProcess(context);
|
KProcess process = new KProcess(context, programInfo.AllowCodeMemoryForJit);
|
||||||
|
|
||||||
MemoryRegion memoryRegion = (MemoryRegion)((npdm.Acid.Value.Flags >> 2) & 0xf);
|
MemoryRegion memoryRegion = (MemoryRegion)((npdm.Acid.Value.Flags >> 2) & 0xf);
|
||||||
|
|
||||||
|
@ -1,8 +1,31 @@
|
|||||||
namespace Ryujinx.HLE.HOS.Services.Pm
|
using Ryujinx.HLE.HOS.Ipc;
|
||||||
|
using Ryujinx.HLE.HOS.Kernel;
|
||||||
|
using Ryujinx.HLE.HOS.Kernel.Common;
|
||||||
|
using Ryujinx.HLE.HOS.Kernel.Process;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Pm
|
||||||
{
|
{
|
||||||
[Service("pm:dmnt")]
|
[Service("pm:dmnt")]
|
||||||
class IDebugMonitorInterface : IpcService
|
class IDebugMonitorInterface : IpcService
|
||||||
{
|
{
|
||||||
public IDebugMonitorInterface(ServiceCtx context) { }
|
public IDebugMonitorInterface(ServiceCtx context) { }
|
||||||
|
|
||||||
|
[CommandHipc(65000)]
|
||||||
|
// AtmosphereGetProcessInfo(os::ProcessId process_id) -> sf::OutCopyHandle out_process_handle, sf::Out<ncm::ProgramLocation> out_loc, sf::Out<cfg::OverrideStatus> out_status
|
||||||
|
public ResultCode GetProcessInfo(ServiceCtx context)
|
||||||
|
{
|
||||||
|
ulong pid = context.RequestData.ReadUInt64();
|
||||||
|
|
||||||
|
KProcess process = KernelStatic.GetProcessByPid(pid);
|
||||||
|
|
||||||
|
if (context.Process.HandleTable.GenerateHandle(process, out int processHandle) != KernelResult.Success)
|
||||||
|
{
|
||||||
|
throw new System.Exception("Out of handles!");
|
||||||
|
}
|
||||||
|
|
||||||
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(processHandle);
|
||||||
|
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -469,14 +469,12 @@ namespace Ryujinx.Memory.WindowsShared
|
|||||||
{
|
{
|
||||||
ulong endAddress = address + size;
|
ulong endAddress = address + size;
|
||||||
var overlaps = Array.Empty<IntervalTreeNode<ulong, MemoryPermission>>();
|
var overlaps = Array.Empty<IntervalTreeNode<ulong, MemoryPermission>>();
|
||||||
int count = 0;
|
int count;
|
||||||
|
|
||||||
lock (_protections)
|
lock (_protections)
|
||||||
{
|
{
|
||||||
count = _protections.Get(address, endAddress, ref overlaps);
|
count = _protections.Get(address, endAddress, ref overlaps);
|
||||||
|
|
||||||
Debug.Assert(count > 0);
|
|
||||||
|
|
||||||
if (count == 1 &&
|
if (count == 1 &&
|
||||||
overlaps[0].Start <= address &&
|
overlaps[0].Start <= address &&
|
||||||
overlaps[0].End >= endAddress &&
|
overlaps[0].End >= endAddress &&
|
||||||
@ -574,7 +572,7 @@ namespace Ryujinx.Memory.WindowsShared
|
|||||||
{
|
{
|
||||||
ulong endAddress = address + size;
|
ulong endAddress = address + size;
|
||||||
var overlaps = Array.Empty<IntervalTreeNode<ulong, MemoryPermission>>();
|
var overlaps = Array.Empty<IntervalTreeNode<ulong, MemoryPermission>>();
|
||||||
int count = 0;
|
int count;
|
||||||
|
|
||||||
lock (_protections)
|
lock (_protections)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user