Port the runtime and translator fixes from upstream's KartPad batch

From patchzyy/Wiicompiled 6f14bde (#244), runtime and translator parts only:
- Keep KD and NCD devices available while networking is off; only IP and
  SSL need the network.
- Run RFLiIsWorking's alarm pump in a private interrupt context so callback
  register writes don't clobber the caller, and release the alarm recursion
  guard before rescheduling.
- Share one LR continuation dispatch per translated function when it has
  several continuation calls.

The renderer half of that commit is left out: it conflicts with the stereo
renderer, and upstream reverted part of it (e409d9f) for stutters.

(cherry picked from part of commit 6f14bde26a4ed6390d4f18e1b3a9c1be6819d589)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011tcyLz63pXjoYEwsFjfg8F
This commit is contained in:
Claude committed 2026-10-05 12:58:10 +00:00
1 parent 504ea792da
commit 35e045f9f7
5 files changed
+102 -25

No files matched your search

+6 -5
View File
@@ -648,9 +648,10 @@ extern "C" int32_t Network_HLE_OpenDevice(const char* path, uint32_t mode) {
if (!path) {
return -101;
}
if (!RuntimeConfigFile::NetworkEnabled(true)) {
// The guest opens several /dev/net nodes at boot and retries; report the
// reason online will not work exactly once.
const bool isIpTop = std::strcmp(path, "/dev/net/ip/top") == 0;
const bool isSsl = std::strcmp(path, "/dev/net/ssl") == 0;
// KD and NCD provide local identity/configuration services even offline.
if ((isIpTop || isSsl) && !RuntimeConfigFile::NetworkEnabled(true)) {
static bool reported = false;
if (!reported) {
reported = true;
@@ -665,10 +666,10 @@ extern "C" int32_t Network_HLE_OpenDevice(const char* path, uint32_t mode) {
kind = DeviceKind::KdTime;
} else if (std::strcmp(path, "/dev/net/ncd/manage") == 0) {
kind = DeviceKind::NcdManage;
} else if (std::strcmp(path, "/dev/net/ip/top") == 0) {
} else if (isIpTop) {
kind = DeviceKind::IpTop;
EnsureSocketRuntime();
} else if (std::strcmp(path, "/dev/net/ssl") == 0) {
} else if (isSsl) {
kind = DeviceKind::Ssl;
EnsureSocketRuntime();
} else {
+12 -10
View File
@@ -222,7 +222,6 @@ bool ProcessAlarmQueue(CpuContext* cpu, int maxToProcess)
throw;
}
DecrementSchedulerDisableCount();
RunDeferredReschedule(cpu);
}
}
} catch (const ::Memory::AccessViolation& e) {
@@ -233,7 +232,7 @@ bool ProcessAlarmQueue(CpuContext* cpu, int maxToProcess)
// Host DNS workers never touch guest memory. Commit their output here on
// the scheduler thread, waking synchronous IOS waiters or queuing async IOS
// callbacks before the callback drain below.
bool completionNeedsReschedule = false;
bool completionNeedsReschedule = handledAny;
if (Network_HLE_ProcessCompletions(cpu)) {
handledAny = true;
completionNeedsReschedule = true;
@@ -446,15 +445,18 @@ PPC_NATIVE_OVERRIDE_VOID(801A08E0, OS__SetPeriodicAlarm_801a08e0, (CpuContext* c
// returning 0 when the manager pointer (0x80386298) is null.
extern "C" uint32_t RFLiIsWorking_HLE_800bd860()
{
// Pump alarms/callbacks on the current guest thread when available. Using a
// detached persistent context here can leave the busy loop waiting on work
// that completed on the wrong scheduling context.
CpuContext* cpu = TryGetCpuContext();
if (!cpu) {
cpu = &GetPersistentCpuContext();
}
// Alarm callbacks interrupt the caller; keep their register writes private.
GuestInterruptCallbackContext interrupt;
CpuContext* cpu = interrupt.get();
EnsureSda1Base(cpu);
ProcessAlarmQueue(cpu, 32);
IncrementSchedulerDisableCount();
try {
ProcessAlarmQueue(cpu, 32);
} catch (...) {
DecrementSchedulerDisableCount();
throw;
}
DecrementSchedulerDisableCount();
// Now return the actual "working" status
constexpr uint32_t kRflManagerPtrAddr = 0x80386298u;