Files
sharpemu/tests/SharpEmu.Libs.Tests/SystemService/SystemServiceExportsTests.cs
T
Peter Bonanni 3c500d2cf0 [SystemService] Write notice skip flag as byte (#346)
The Gen5 caller supplies a one-byte flag. Preserve pointer and memory-fault behavior while writing only that byte, and cover a seeded guest-memory boundary that rejects the former four-byte write.
2026-07-18 02:41:38 +03:00

30 lines
925 B
C#

// Copyright (C) 2026 SharpEmu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
using SharpEmu.HLE;
using SharpEmu.Libs.SystemService;
using Xunit;
namespace SharpEmu.Libs.Tests.SystemService;
public sealed class SystemServiceExportsTests
{
private const ulong MemoryBase = 0x1_0000_0000;
[Fact]
public void GetNoticeScreenSkipFlagWritesOneByteAtMemoryBoundary()
{
var memory = new FakeCpuMemory(MemoryBase, 1);
var context = new CpuContext(memory, Generation.Gen5);
Assert.True(memory.TryWrite(MemoryBase, new byte[] { 0xA5 }));
context[CpuRegister.Rdi] = MemoryBase;
Assert.Equal(0, SystemServiceExports.SystemServiceGetNoticeScreenSkipFlag(context));
Assert.Equal(0UL, context[CpuRegister.Rax]);
Span<byte> flag = stackalloc byte[1];
Assert.True(memory.TryRead(MemoryBase, flag));
Assert.Equal(0, flag[0]);
}
}