From 9eef39549af65084fc6974e30fe57592721fb6b5 Mon Sep 17 00:00:00 2001 From: Cloudy <52116030+xdCloudy@users.noreply.github.com> Date: Wed, 15 Jul 2026 22:35:18 +0100 Subject: [PATCH] hle: implement offline NP reachability state (#238) --- src/SharpEmu.Libs/Np/NpManagerExports.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/SharpEmu.Libs/Np/NpManagerExports.cs b/src/SharpEmu.Libs/Np/NpManagerExports.cs index 184de019..f4e6c088 100644 --- a/src/SharpEmu.Libs/Np/NpManagerExports.cs +++ b/src/SharpEmu.Libs/Np/NpManagerExports.cs @@ -10,6 +10,7 @@ public static class NpManagerExports { private const int NpTitleIdSize = 16; private const int NpTitleSecretSize = 128; + private const int NpReachabilityStateUnavailable = 0; [SysAbiExport( Nid = "3Zl8BePTh9Y", @@ -75,8 +76,15 @@ public static class NpManagerExports LibraryName = "libSceNpManager")] public static int NpGetNpReachabilityState(CpuContext ctx) { - ctx[CpuRegister.Rax] = 0; - return (int)OrbisGen2Result.ORBIS_GEN2_OK; + var stateAddress = ctx[CpuRegister.Rsi]; + if (stateAddress == 0) + { + return ctx.SetReturn(OrbisGen2Result.ORBIS_GEN2_ERROR_INVALID_ARGUMENT); + } + + return ctx.TryWriteInt32(stateAddress, NpReachabilityStateUnavailable) + ? ctx.SetReturn(OrbisGen2Result.ORBIS_GEN2_OK) + : ctx.SetReturn(OrbisGen2Result.ORBIS_GEN2_ERROR_MEMORY_FAULT); } [SysAbiExport(