mirror of
https://github.com/par274/sharpemu.git
synced 2026-07-23 03:16:22 +08:00
b4b95014f1
* Boot compatibility fixes for UE titles, GUI toggles, and DeS render/boot work Checkpoint of the Monster Truck Championship and Demon's Souls boot work. Each piece is independently useful and verified against the titles. - playgo: scePlayGoGetLocus now returns BAD_CHUNK_ID for chunk ids outside the known set, matching real firmware. Titles enumerate chunk ids until that error; answering OK for every id made the scan wrap the ushort range and spin forever. Missing-sidecar and no-app0 fallbacks report a fully-installed single chunk 0 so scePlayGoOpen keeps succeeding. - kernel: restore the SHARPEMU_WRITABLE_APP0 opt-in. Unpackaged UE dumps write their Saved tree under /app0 during PS5 component init and treat the denial as a fatal boot error. - pad: accept handle 0 as the primary pad across all pad calls. Real firmware hands out small non-negative handles and some titles read state with handle 0. - bthid: env-gated experiment hooks for the Thrustmaster wheel middleware investigation (fail-only-RegisterCallback modes and a synthetic enumeration callback with a zeroed event struct). All default off. - gui: add SHARPEMU_LOG_IO and SHARPEMU_WRITABLE_APP0 toggles to the Environment tab. - videoout: per-swapchain-image render-finished semaphores (the shared semaphore raced the swapchain); whole-mip-chain layout init for offscreen guest images (sampled binds read mips stuck in Undefined); GPU-resident texture availability now canonicalizes through the texture format table and accepts compatibility-class aliases, cutting per-frame CPU texture re-reads (143 GB -> 55 GB per 300 s in Demon's Souls, 0.2 -> 0.5 fps). - hle: add sceSystemServiceGetNoticeScreenSkipFlag, sceSystemServiceGetMainAppTitleId (title id published from the runtime), and sceNpWebApi2CreateUserContext (refuses so the online layer backs off). - rtc: SHARPEMU_RTC_PROBE_RANGE diagnostic dumps the code around a busy-wait caller of sceRtcGetCurrentTick once; costs nothing when unset. * [ShaderCompiler] Fix VReadlaneB32 scalar destination field The scalar destination lives in the low vdst byte (bits 0-7); it was read from bits 8-14, the VOP3B carry-out field readlane does not have, sending every readlane result to s0. Verified against raw gfx10 encodings and LLVM's assembler tests (v_readlane_b32 s5, v1, s2 -> low byte 0x05). * [VideoOut] Survive device loss and flip-order asserts without dying Two ways a frame could take down the whole presenter: - Device loss between any two Vulkan calls in a frame unwound the window thread, and the Dispose-time fence check then threw again, masking the original error. Catch the loss at the frame boundary, retire presentations and guest submissions whose fences can never signal, and keep the window loop pumping so the game (audio, logic) carries on. - The ordered-flip capture invariant is violated ~100 times per run by Demon's Souls (PPSA01342); on debug builds the Debug.Assert fail-fasts the process with nothing in the log. Downgrade it to a once-per-version warning until the capture/wait ordering is understood. * Fix Dead Cells shader cache regression --------- Co-authored-by: StealUrKill <35749471+StealUrKill@users.noreply.github.com>
56 lines
1.9 KiB
C#
56 lines
1.9 KiB
C#
// Copyright (C) 2026 SharpEmu Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
using SharpEmu.HLE;
|
|
using SharpEmu.Libs.Kernel;
|
|
using System.Text;
|
|
using Xunit;
|
|
|
|
namespace SharpEmu.Libs.Tests.Kernel;
|
|
|
|
public sealed class KernelMemoryCompatExportsTests
|
|
{
|
|
[Fact]
|
|
public void PosixStat_MissingFileReturnsMinusOne()
|
|
{
|
|
const ulong memoryBase = 0x1_0000_0000;
|
|
const ulong pathAddress = memoryBase + 0x100;
|
|
const ulong statAddress = memoryBase + 0x400;
|
|
var memory = new FakeCpuMemory(memoryBase, 0x1000);
|
|
var context = new CpuContext(memory, Generation.Gen5);
|
|
memory.WriteCString(pathAddress, "/__sharpemu_test_missing__/shader.cache");
|
|
context[CpuRegister.Rdi] = pathAddress;
|
|
context[CpuRegister.Rsi] = statAddress;
|
|
|
|
var result = KernelMemoryCompatExports.PosixStat(context);
|
|
|
|
Assert.Equal(-1, result);
|
|
Assert.Equal(ulong.MaxValue, context[CpuRegister.Rax]);
|
|
}
|
|
|
|
[Fact]
|
|
public void Sprintf_ReadsVariadicDoubleFromXmmRegister()
|
|
{
|
|
const ulong memoryBase = 0x1_0000_0000;
|
|
const ulong destinationAddress = memoryBase + 0x100;
|
|
const ulong formatAddress = memoryBase + 0x200;
|
|
var memory = new FakeCpuMemory(memoryBase, 0x1000);
|
|
var context = new CpuContext(memory, Generation.Gen5);
|
|
memory.WriteCString(formatAddress, "%.4f");
|
|
context[CpuRegister.Rdi] = destinationAddress;
|
|
context[CpuRegister.Rsi] = formatAddress;
|
|
context.SetXmmRegister(
|
|
0,
|
|
unchecked((ulong)BitConverter.DoubleToInt64Bits(0.5576)),
|
|
0);
|
|
|
|
var result = KernelMemoryCompatExports.Sprintf(context);
|
|
|
|
Assert.Equal(0, result);
|
|
Assert.Equal(6UL, context[CpuRegister.Rax]);
|
|
Span<byte> output = stackalloc byte[7];
|
|
Assert.True(memory.TryRead(destinationAddress, output));
|
|
Assert.Equal("0.5576\0", Encoding.UTF8.GetString(output));
|
|
}
|
|
}
|