mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-07-31 09:49:53 -04:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user