mirror of
https://github.com/par274/sharpemu.git
synced 2026-08-30 21:31:57 +08:00
feat(hle): prefer loaded guest exports for selected registrations (#844)
Co-authored-by: Acelogic <miguelc4600@gmail.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user