feat(hle): prefer loaded guest exports for selected registrations (#844)

Co-authored-by: Acelogic <miguelc4600@gmail.com>
This commit is contained in:
frangametv
2026-08-25 22:32:57 +02:00
committed by GitHub
parent 51e5480049
commit b226dca3df
9 changed files with 262 additions and 72 deletions
@@ -0,0 +1,60 @@
// Copyright (C) 2026 SharpEmu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
using SharpEmu.Core.Cpu.Native;
using SharpEmu.HLE;
using Xunit;
namespace SharpEmu.Libs.Tests.Cpu;
public sealed class DirectExecutionBackendLlePreferenceTests
{
[Fact]
public void ExplicitLlePreference_AllowsNonKernelRegisteredExport()
{
var export = Export("libSceNpCppWebApi", preferLle: true);
Assert.True(DirectExecutionBackend.ShouldResolveRegisteredExportViaLle(
export,
preferLleForLibc: false));
}
[Fact]
public void ExplicitLlePreference_CannotOverrideKernelHleBoundary()
{
var export = Export("libKernel", preferLle: true);
Assert.False(DirectExecutionBackend.ShouldResolveRegisteredExportViaLle(
export,
preferLleForLibc: true));
}
[Fact]
public void RegisteredExportWithoutLlePreference_RemainsHle()
{
var export = Export("libSceNpCppWebApi", preferLle: false);
Assert.False(DirectExecutionBackend.ShouldResolveRegisteredExportViaLle(
export,
preferLleForLibc: false));
}
[Fact]
public void ExistingLibcPolicy_CanStillSelectRegisteredFirmwareExport()
{
var export = Export("libSceLibcInternal", preferLle: false);
Assert.True(DirectExecutionBackend.ShouldResolveRegisteredExportViaLle(
export,
preferLleForLibc: true));
}
private static ExportedFunction Export(string libraryName, bool preferLle) =>
new(
libraryName,
"Zxa0VhQVTsk",
"sceKernelWaitSema",
Generation.Gen5,
static _ => 0,
preferLle);
}