mirror of
https://github.com/par274/sharpemu.git
synced 2026-08-30 13:24:19 +08:00
b226dca3df
Co-authored-by: Acelogic <miguelc4600@gmail.com>
61 lines
1.7 KiB
C#
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);
|
|
}
|