[SharePlay] Report inactive share-play state

Co-authored-by: Sekai <140012992+SekaixX@users.noreply.github.com>
This commit is contained in:
ParantezTech 2026-10-08 17:26:53 +03:00
parent 619ac2b367
commit 1b66707daf
1 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,34 @@
// Copyright (C) 2026 SharpEmu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
using SharpEmu.HLE;
namespace SharpEmu.Libs.Share;
public static class SharePlayExports
{
private static int _controllerProhibited;
[SysAbiExport(
Nid = "FzQS6DREDfk",
ExportName = "sceSharePlayProhibitController",
Target = Generation.Gen5,
LibraryName = "libSceSharePlay")]
public static int SharePlayProhibitController(CpuContext ctx)
{
var prohibited = ctx[CpuRegister.Rdi];
if (prohibited > 1)
{
return ctx.SetReturn(OrbisGen2Result.ORBIS_GEN2_ERROR_INVALID_ARGUMENT);
}
Volatile.Write(ref _controllerProhibited, unchecked((int)prohibited));
return ctx.SetReturn(OrbisGen2Result.ORBIS_GEN2_OK);
}
public static void ResetRuntimeState() => Volatile.Write(ref _controllerProhibited, 0);
internal static bool IsControllerProhibited => Volatile.Read(ref _controllerProhibited) != 0;
internal static void ResetForTests() => ResetRuntimeState();
}