DAMAGEOBJECT IClient method wrong?
-
I was looking at a way of updating the shield value of a ship on the server and transmitting that information to the player. As far as I can tell, just setting the value in the ship’s CEShield isn’t enough, so I thought to use the DAMAGEOBJECT packet to update it.
Looking at it, though, it seems like the method declaration is incorrect?
virtual bool Send_FLPACKET_SERVER_DAMAGEOBJECT(uint iClientID, uint iObj, float iDamage)
The first two parameters match up, but the third most definitely isn’t a float. It’s more plausible that it’s a struct, since adoxa’s packet log indicates that the full packet also provides the sender ship (not client) as well as a variable length array of subobjects with their respective health values.
I tried looking at a memory dump of the area around the third parameter’s location, but I’m puzzled by the numerous apparently meaningless values sprinkled throughout, and I couldn’t find anything resembling a float either.
Has anyone found the proper declaration for this?
-
Did you check out the source of PacketDump.cpp by adoxa?
It’s a goldmine for packets that he already reversed, should update the FLHook SDK structs with it at some point:
case 0x05: // FLPACKET_SERVER_DAMAGEOBJECT { Object_Name( file, "object", 8, *data.d++ ); fprintf( file, "\tu_byte = %u\n", *data.b++ ); fprintf( file, "\tu_dword = %u\n", *data.d++ ); Object_Name( file, "sender", 8, *data.d++ ); for (cnt = *data.w++; cnt != 0; --cnt) { fprintf( file, "\tsubobjid = 0x%.4X\n", *data.w++ ); fprintf( file, "\tu_byte = %u\n", *data.b++ ); fprintf( file, "\thit_pts = %g\n", *data.f++ ); } break; }
-
I did check, but the packet’s structure seems very different from the data being passed through the function. I’m not sure why either…
-
I log/dump the marshalled data, not the structured data, so it’s not the same as the parameters, unfortunately. Looks like what you want is (server.dll @ 0x6cf6208, 0x0x6cf6aa2 & 0x6d07fc9):
virtual bool Send_FLPACKET_SERVER_DAMAGEOBJECT(uint iClientID, uint iObj, std::list<damageentry>& damagelist); struct DamageEntry { USHORT subobj; float health; SubObjFate fate; };</damageentry>
I’ve attached a list of tables I just added to my disassembly, may be useful to fill the holes in IClientImpl and searching for things like this (it’s how I found the above addresses).
-
Aha, I knew it! I figured there’d be a data structure to hold the damage entries, I just wasn’t sure what kind and unfortunately looking up stl structures in memory is quite awful.
Thanks adoxa
-
adoxa wrote:
I’ve attached a list of tables I just added to my disassembly, may be useful to fill the holes in IClientImpl and searching for things like this (it’s how I found the above addresses).
Awesome!! Do you have a trick to derive those vtables or did you debug all of those method calls?
-
Trick. For the Server I used the imports, sorting them by name, combining with an existing list I had made ages ago (when I first did the disassembly), then sorting back by address. For the Client I searched for where it created the packet definition, combined them into a single line, added the strings from PacketDump.cpp, then resorted.