Accept all four broadcaster names, and alias memory reads to uintValue

broadcast.config.set rejected "game" and "stepping" as unsupported, though both
are documented and both are real broadcasters. The valid keys are whatever
already exists in the client's disallowed map, and that map starts empty and
only grows as a side effect of operator[] the first time each category
broadcasts - so which keys were accepted depended on what had happened to fire
yet. "logger" and "input" work because the broadcast loop touches them every
lap; "game" and "stepping" only appear once one actually occurs. Seed all four
at connection setup. Unknown keys are still refused, which is the useful half
of the old behaviour.

The numeric memory reads answered with "value" while cpu.getReg and
cpu.getAllRegs answer with "uintValue". Nothing marks which is which, so a
client that guesses gets a missing key - and one that defaults a missing key to
zero silently reports plausible nonsense, which cost real time during the
CrossCraft investigation (an empty vtable that wasn't). Write both names.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GZq8ZtJmFY7bkX5FVkr3P9
This commit is contained in:
Henrik Rydgård
2026-08-18 09:32:04 +02:00
co-authored by Claude Opus 5
parent 28b3dd9da1
commit 6bcc376c06
3 changed files with 22 additions and 1 deletions
@@ -103,6 +103,8 @@ AutoDisabledReplacements::~AutoDisabledReplacements() {
//
// Response (same event name):
// - value: unsigned integer
// - uintValue: the same number under the name cpu.getReg/cpu.getAllRegs use, so a client can
// read either without special-casing which event it came from
void WebSocketMemoryReadU8(DebuggerRequest &req) {
uint32_t addr;
if (!req.ParamU32("address", &addr, false)) {
@@ -122,6 +124,8 @@ void WebSocketMemoryReadU8(DebuggerRequest &req) {
AutoDisabledReplacements memLock = LockMemory(true);
JsonWriter &json = req.Respond();
json.writeUint("value", Memory::ReadUnchecked_U8(addr));
// Alias: cpu.getReg and cpu.getAllRegs call this uintValue. Same number, both names.
json.writeUint("uintValue", Memory::ReadUnchecked_U8(addr));
});
}
@@ -132,6 +136,8 @@ void WebSocketMemoryReadU8(DebuggerRequest &req) {
//
// Response (same event name):
// - value: unsigned integer
// - uintValue: the same number under the name cpu.getReg/cpu.getAllRegs use, so a client can
// read either without special-casing which event it came from
void WebSocketMemoryReadU16(DebuggerRequest &req) {
uint32_t addr;
if (!req.ParamU32("address", &addr, false)) {
@@ -151,6 +157,7 @@ void WebSocketMemoryReadU16(DebuggerRequest &req) {
AutoDisabledReplacements memLock = LockMemory(true);
JsonWriter &json = req.Respond();
json.writeUint("value", Memory::ReadUnchecked_U16(addr));
json.writeUint("uintValue", Memory::ReadUnchecked_U16(addr));
});
}
@@ -161,6 +168,8 @@ void WebSocketMemoryReadU16(DebuggerRequest &req) {
//
// Response (same event name):
// - value: unsigned integer
// - uintValue: the same number under the name cpu.getReg/cpu.getAllRegs use, so a client can
// read either without special-casing which event it came from
void WebSocketMemoryReadU32(DebuggerRequest &req) {
uint32_t addr;
if (!req.ParamU32("address", &addr, false)) {
@@ -180,6 +189,7 @@ void WebSocketMemoryReadU32(DebuggerRequest &req) {
AutoDisabledReplacements memLock = LockMemory(true);
JsonWriter &json = req.Respond();
json.writeUint("value", Memory::ReadUnchecked_U32(addr));
json.writeUint("uintValue", Memory::ReadUnchecked_U32(addr));
});
}
@@ -330,6 +340,8 @@ void WebSocketMemoryWriteU8(DebuggerRequest &req) {
JsonWriter &json = req.Respond();
json.writeUint("value", Memory::ReadUnchecked_U8(addr));
// Alias: cpu.getReg and cpu.getAllRegs call this uintValue. Same number, both names.
json.writeUint("uintValue", Memory::ReadUnchecked_U8(addr));
});
}
@@ -367,6 +379,7 @@ void WebSocketMemoryWriteU16(DebuggerRequest &req) {
JsonWriter &json = req.Respond();
json.writeUint("value", Memory::ReadUnchecked_U16(addr));
json.writeUint("uintValue", Memory::ReadUnchecked_U16(addr));
});
}
@@ -404,6 +417,7 @@ void WebSocketMemoryWriteU32(DebuggerRequest &req) {
JsonWriter &json = req.Respond();
json.writeUint("value", Memory::ReadUnchecked_U32(addr));
json.writeUint("uintValue", Memory::ReadUnchecked_U32(addr));
});
}