fix: harden world login pipeline and build-aware integrity hash

Login-critical opcodes (AUTH_CHALLENGE, AUTH_RESPONSE, CHAR_ENUM, etc.)
now fall back to hardcoded wire values when the opcode table fails to
load, preventing the "Unhandled world opcode: 0x1ec" symptom that
blocked character list retrieval.

OpcodeTable::loadFromJson() no longer wipes the working table on
failure — it loads into temporaries and only swaps on success.

Integrity hash now takes clientBuild: Classic-era DLLs (fmod.dll,
ijl15.dll, dbghelp.dll, unicows.dll) are only required for builds
<=6005 or Turtle; TBC/WotLK clients hash only the .exe.
This commit is contained in:
Kelsi
2026-07-09 22:06:05 -07:00
parent 6f444c1f17
commit 568b03ea76
7 changed files with 73 additions and 21 deletions

View File

@@ -83,6 +83,25 @@ TEST_CASE("OpcodeTable loadFromJson nonexistent file", "[opcode_table]") {
REQUIRE(table.size() == 0);
}
TEST_CASE("OpcodeTable failed reload preserves existing data", "[opcode_table]") {
std::string json = R"({ "CMSG_PING": "0x1DC" })";
auto path = writeTempJson(json);
OpcodeTable table;
REQUIRE(table.loadFromJson(path));
REQUIRE(table.size() == 1);
REQUIRE(table.toWire(LogicalOpcode::CMSG_PING) == 0x1DC);
REQUIRE_FALSE(table.loadFromJson("/nonexistent/path/opcodes.json"));
REQUIRE(table.size() == 1);
REQUIRE(table.toWire(LogicalOpcode::CMSG_PING) == 0x1DC);
auto result = table.fromWire(0x1DC);
REQUIRE(result.has_value());
REQUIRE(*result == LogicalOpcode::CMSG_PING);
std::remove(path.c_str());
}
TEST_CASE("OpcodeTable logicalToName returns enum name", "[opcode_table]") {
const char* name = OpcodeTable::logicalToName(LogicalOpcode::CMSG_PING);
REQUIRE(name != nullptr);