mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-10 06:43:43 +00:00
fix(wire): PlaceModelResponse writes the model's rotation
The client's PlaceModelResponse::Deserialize (0x00dc0170) reads the rotation as an optional w, x, y, z quaternion, but DLU wrote the 4-byte response after the rotation flag. With any rotation other than identity the client ran out of data. A live capture of a model turned 90 degrees shows the server echoing the rotation the client placed it with. Bytes only change when the rotation is not identity; a golden test pins the new layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -315,15 +315,17 @@ TEST_F(PropertyMessagesTests, PlaceModelResponseMatchesLegacy) {
|
||||
msg.propertyPlaqueID = plaque;
|
||||
msg.response = response;
|
||||
msg.rotation = rotation;
|
||||
ExpectSameAsLegacy([&](const SystemAddress& a) { LegacyGameMessages::SendPlaceModelResponse(target, a, position, plaque, response, rotation); }, msg);
|
||||
// The kept wire bug (response written where rotation belongs) only round trips with the default rotation.
|
||||
// WIRE FIX: the legacy bytes wrote response where the rotation belongs; they only still match when
|
||||
// the rotation is the identity (its flag is 0 and nothing follows).
|
||||
if (rotation == QuatUtils::IDENTITY) {
|
||||
const auto copy = RoundTrip(msg);
|
||||
EXPECT_EQ(copy.position, position);
|
||||
EXPECT_EQ(copy.propertyPlaqueID, plaque);
|
||||
EXPECT_EQ(copy.response, response);
|
||||
ExpectTruncatedFails(msg);
|
||||
ExpectSameAsLegacy([&](const SystemAddress& a) { LegacyGameMessages::SendPlaceModelResponse(target, a, position, plaque, response, rotation); }, msg);
|
||||
}
|
||||
const auto copy = RoundTrip(msg);
|
||||
EXPECT_EQ(copy.position, position);
|
||||
EXPECT_EQ(copy.propertyPlaqueID, plaque);
|
||||
EXPECT_EQ(copy.response, response);
|
||||
EXPECT_EQ(copy.rotation, rotation);
|
||||
ExpectTruncatedFails(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -331,6 +333,16 @@ TEST_F(PropertyMessagesTests, PlaceModelResponseMatchesLegacy) {
|
||||
}
|
||||
}
|
||||
|
||||
// WIRE FIX golden bytes: a placed model turned 90 degrees, as a live server answered it. The rotation goes on the wire
|
||||
// as w, x, y, z after its flag (0x00dc0170), not the 4-byte response DLU used to repeat there.
|
||||
TEST_F(PropertyMessagesTests, PlaceModelResponseWritesRotation) {
|
||||
GameMessages::PlaceModelResponse msg;
|
||||
msg.response = 14;
|
||||
msg.rotation = NiQuaternion(0.5f, 0.5f, 0.5f, 0.5f); // glm: w, x, y, z
|
||||
// flags 0 (position), 0 (plaque), 1 + 0e 00 00 00, 1 + four 0.5f (00 00 00 3f)
|
||||
EXPECT_PACKET_EQ(FromHex("21 c0 00 00 10 00 00 03 f0 00 00 03 f0 00 00 03 f0 00 00 03 f0", 164), Payload(msg));
|
||||
}
|
||||
|
||||
TEST_F(PropertyMessagesTests, UgcEquipMessagesMatchLegacy) {
|
||||
for (const auto target : g_Targets) {
|
||||
for (const auto id : g_Targets) {
|
||||
|
||||
Reference in New Issue
Block a user