Expose EventFlag/Mutex/Semaphore/MsgPipe/Callback in their headers

These KernelObject subclasses (and their Native* status structs) were
private implementation details of their respective .cpp files. Move them
into the matching .h instead, so external code - specifically the upcoming
WebSocket kernel-object introspection endpoints - can read a live object's
state directly via kernelObjects.Get<T>()/Iterate<T>(), the same way
PSPModule/PSPThread already can. Read-only by convention: nothing outside
each file should call DoState() or otherwise mutate these; the fields are
public here for that file's own pre-existing use, not an invitation to
write from elsewhere.

To avoid pulling each type's full dependency set (Memory::, BlockAllocator,
CoreTiming, HLEKernel::...) into headers many other files include, non-trivial
method bodies (DoState, and MsgPipe's buffer/wait-list management) are
declared in the header but still defined out-of-line in the .cpp, same as
before - only genuinely trivial one-liners went inline.

KernelObjectPool also gains IterateAll(), a type-agnostic sibling of the
existing Iterate<T>() - walks every live kernel object regardless of type,
for a coarse "what's alive right now" overview.

No behavior change - this is a pure visibility/declaration-vs-definition
move, not new functionality. That lands in a follow-up commit.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GZq8ZtJmFY7bkX5FVkr3P9
This commit is contained in:
Henrik RydgårdandClaude Sonnet 5 committed 2026-08-17 16:01:23 +02:00
1 parent ce33c964f7
commit 21b7ce7392
11 files changed
+513 -408

No files matched your search

+15 -48
View File
@@ -107,56 +107,23 @@ enum ThreadEventType {
bool __KernelThreadTriggerEvent(bool isKernel, SceUID threadID, ThreadEventType type);
struct NativeCallback
// NativeCallback/PSPCallback itself now live in sceKernelThread.h - see the comment on the class
// there for why.
void PSPCallback::DoState(PointerWrap &p)
{
SceUInt_le size;
char name[32];
SceUID_le threadId;
u32_le entrypoint;
u32_le commonArgument;
auto s = p.Section("Callback", 1);
if (!s)
return;
s32_le notifyCount;
s32_le notifyArg;
};
class PSPCallback : public KernelObject {
public:
const char *GetName() override { return nc.name; }
const char *GetTypeName() override { return GetStaticTypeName(); }
static const char *GetStaticTypeName() { return "CallBack"; }
void GetQuickInfo(char *ptr, int size) override {
snprintf(ptr, size, "thread=%i, argument= %08x",
//hackAddress,
nc.threadId,
nc.commonArgument);
}
~PSPCallback() {
}
static u32 GetMissingErrorCode() { return SCE_KERNEL_ERROR_UNKNOWN_CBID; }
static int GetStaticIDType() { return SCE_KERNEL_TMID_Callback; }
int GetIDType() const override { return SCE_KERNEL_TMID_Callback; }
void DoState(PointerWrap &p) override
{
auto s = p.Section("Callback", 1);
if (!s)
return;
Do(p, nc);
// Saved values were moved to mips call, ignoring here.
u32 legacySaved = 0;
Do(p, legacySaved);
Do(p, legacySaved);
Do(p, legacySaved);
Do(p, legacySaved);
Do(p, legacySaved);
}
NativeCallback nc;
};
Do(p, nc);
// Saved values were moved to mips call, ignoring here.
u32 legacySaved = 0;
Do(p, legacySaved);
Do(p, legacySaved);
Do(p, legacySaved);
Do(p, legacySaved);
Do(p, legacySaved);
}
// Owns outstanding MIPS calls and provides a way to get them by ID.
class MipsCallManager {