diff --git a/src/SharpEmu.Libs/Kernel/KernelExports.cs b/src/SharpEmu.Libs/Kernel/KernelExports.cs index 3e4297f5..a62242f3 100644 --- a/src/SharpEmu.Libs/Kernel/KernelExports.cs +++ b/src/SharpEmu.Libs/Kernel/KernelExports.cs @@ -466,4 +466,45 @@ public static class KernelExports ctx[CpuRegister.Rax] = unchecked((ulong)(-1L)); return (int)OrbisGen2Result.ORBIS_GEN2_OK; } + + [SysAbiExport( + Nid = "tU5e3f9gSiU", + ExportName = "sceKernelIsTrinityMode", + Target = Generation.Gen4 | Generation.Gen5, + LibraryName = "libKernel")] + public static int KernelIsTrinityMode(CpuContext ctx) + { + ctx[CpuRegister.Rax] = 0; + + return (int)OrbisGen2Result.ORBIS_GEN2_OK; + } + + [SysAbiExport( + Nid = "DLORcroUqbc", + ExportName = "sceKernelGetOpenPsId", + Target = Generation.Gen4 | Generation.Gen5, + LibraryName = "libKernel")] + public static int KernelGetOpenPsId(CpuContext ctx) + { + ulong bufferPtr = ctx[CpuRegister.Rdi]; + + if (bufferPtr == 0) + { + ctx[CpuRegister.Rax] = unchecked((ulong)(int)OrbisGen2Result.ORBIS_GEN2_ERROR_INVALID_ARGUMENT); + + return (int)OrbisGen2Result.ORBIS_GEN2_ERROR_INVALID_ARGUMENT; + } + + Span openPsId = stackalloc byte[16]; + + if (!ctx.Memory.TryWrite(bufferPtr, openPsId)) + { + ctx[CpuRegister.Rax] = unchecked((ulong)(int)OrbisGen2Result.ORBIS_GEN2_ERROR_MEMORY_FAULT); + return (int)OrbisGen2Result.ORBIS_GEN2_ERROR_MEMORY_FAULT; + } + + ctx[CpuRegister.Rax] = 0; + + return (int)OrbisGen2Result.ORBIS_GEN2_OK; + } } diff --git a/src/SharpEmu.Libs/Np/NpTrophy2Exports.cs b/src/SharpEmu.Libs/Np/NpTrophy2Exports.cs index c636d62d..4fe0f43e 100644 --- a/src/SharpEmu.Libs/Np/NpTrophy2Exports.cs +++ b/src/SharpEmu.Libs/Np/NpTrophy2Exports.cs @@ -99,6 +99,15 @@ public static class NpTrophy2Exports public static int NpTrophy2GetTrophyInfo(CpuContext ctx) => SetReturn(ctx, OrbisGen2Result.ORBIS_GEN2_ERROR_NOT_FOUND); + [SysAbiExport( + Nid = "y3zHpdZO6ME", + ExportName = "sceNpTrophy2GetTrophyInfoArray", + Target = Generation.Gen5, + LibraryName = "libSceNpTrophy2")] + public static int NpTrophy2GetTrophyInfoArray(CpuContext ctx) => + SetReturn(ctx, OrbisGen2Result.ORBIS_GEN2_ERROR_NOT_FOUND); + + private static int WriteIdAndReturn(CpuContext ctx, ulong outAddress, ref int nextId) { if (outAddress == 0)