mirror of
https://github.com/par274/sharpemu.git
synced 2026-07-25 20:28:48 +08:00
d43edc865a
* Fix Gen5 thread and AGC compatibility * Trim compatibility comments * Report selected Vulkan GPU * Clean up CPU title label * Improve emulator frame pacing and performance * Regenerate package locks with pinned SDK --------- Co-authored-by: Spooks4576 <Spooks4576@users.noreply.github.com>
38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
// Copyright (C) 2026 SharpEmu Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
using SharpEmu.HLE;
|
|
|
|
namespace SharpEmu.Libs.Ajm;
|
|
|
|
public static class AjmExports
|
|
{
|
|
private const int OrbisAjmErrorInvalidParameter = unchecked((int)0x80930005);
|
|
private static int _nextContextId;
|
|
|
|
[SysAbiExport(
|
|
Nid = "dl+4eHSzUu4",
|
|
ExportName = "sceAjmInitialize",
|
|
Target = Generation.Gen4 | Generation.Gen5,
|
|
LibraryName = "libSceAjm")]
|
|
public static int Initialize(CpuContext ctx)
|
|
{
|
|
var reserved = ctx[CpuRegister.Rdi];
|
|
var outContextAddress = ctx[CpuRegister.Rsi];
|
|
|
|
// AJM requires a zero reserved argument.
|
|
if (reserved != 0 || outContextAddress == 0)
|
|
{
|
|
return ctx.SetReturn(OrbisAjmErrorInvalidParameter);
|
|
}
|
|
|
|
var contextId = unchecked((uint)Interlocked.Increment(ref _nextContextId));
|
|
if (!ctx.TryWriteUInt32(outContextAddress, contextId))
|
|
{
|
|
return ctx.SetReturn(OrbisAjmErrorInvalidParameter);
|
|
}
|
|
|
|
return ctx.SetReturn(0);
|
|
}
|
|
}
|