Files
sharpemu/tests/SharpEmu.Libs.Tests/Cpu/DirectExecutionBackendLlePreferenceTests.cs
T
2026-08-25 22:32:57 +02:00

61 lines
1.7 KiB
C#

// 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);
}