Freelancer Community Network
Reminder: Internet Explorer 6 or below are NOT supported.
HomeHome
ForumForum
WikiWiki
DownloadsDownloads
ForgeForge
Multiplayer Connection Tutorial
Collapse/Expand Random Image
Collapse/Expand Login
Username:

Password:

Remember me



Lost Password?

Register now!
Collapse/Expand Chat
Collapse/Expand Who's Online
70 user(s) are online (29 user(s) are browsing Forum)

Members: 0
Guests: 70

more...
Collapse/Expand Donations
Monthly costs: -30€
Income (ads): +5€
Donations (last month): +5€

Current balance: 0€
(last updated 06/2020)

Please make a donation if you want to help keeping The-Starport online:

Bitcoin address:
Thanks!
Collapse/Expand Links
Collapse/Expand Advertisement
There are currently 33 users playing Freelancer on 44 servers.
July. 6, 2020

Browsing this Thread:   1 Anonymous Users



 Bottom   Previous Topic   Next Topic  Register To Post



DAMAGEOBJECT IClient method wrong?
Starport Admin
Joined:
2009/2/21 21:42
Group:
Webmasters
Registered Users
Posts: 3520
Offline
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?

Code:
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?

Posted on: 2014/6/18 6:07
"Cynicism is not realistic and tough. It's unrealistic and kind of cowardly because it means you don't have to try."
-Peggy Noonan
Top
Re: DAMAGEOBJECT IClient method wrong?
Starport Admin
Joined:
2008/2/26 20:36
From Germany
Group:
Webmasters
Registered Users
Posts: 1784
Offline
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:

Code:
      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;
      }

Posted on: 2014/6/18 10:31
aka chaosgrid
http://www.freelancerserver.de
https://www.moddb.com/mods/fwtow
Top
Re: DAMAGEOBJECT IClient method wrong?
Just can't stay away
Joined:
2010/8/2 0:04
Group:
Registered Users
FLServer Admins
Posts: 464
Offline
Noob question: Can it be also used for reading/sending own ship damage status and somehow show it in guns scanner as separate tab?

Attach file:



gif  own-ship-scanner.gif (10.46 KB)
6823_53a17a814f5d9.gif 249X242 px

Posted on: 2014/6/18 12:40
Of all things that are lost - brain I miss most
Top
Re: DAMAGEOBJECT IClient method wrong?
Starport Admin
Joined:
2009/2/21 21:42
Group:
Webmasters
Registered Users
Posts: 3520
Offline
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...

Posted on: 2014/6/18 14:48
"Cynicism is not realistic and tough. It's unrealistic and kind of cowardly because it means you don't have to try."
-Peggy Noonan
Top
Re: DAMAGEOBJECT IClient method wrong?
Home away from home
Joined:
2009/8/16 2:58
From Qld, Aus.
Group:
Registered Users
FLServer Admins
Trusted Speciality Developers
Senior Members
Posts: 1953
Offline
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):

Code:
virtual bool Send_FLPACKET_SERVER_DAMAGEOBJECT(uint iClientID, uint iObj, std::list<DamageEntry>& damagelist);

struct DamageEntry
{
  USHORT subobj;
  float health;
  SubObjFate fate;
};


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).

Attach file:


zip tables.zip Size: 3.96 KB; Hits: 298

Posted on: 2014/6/19 16:10
Top
Re: DAMAGEOBJECT IClient method wrong?
Starport Admin
Joined:
2009/2/21 21:42
Group:
Webmasters
Registered Users
Posts: 3520
Offline
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

Posted on: 2014/6/19 16:14
"Cynicism is not realistic and tough. It's unrealistic and kind of cowardly because it means you don't have to try."
-Peggy Noonan
Top
Re: DAMAGEOBJECT IClient method wrong?
Starport Admin
Joined:
2008/2/26 20:36
From Germany
Group:
Webmasters
Registered Users
Posts: 1784
Offline
Quote:

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?

Posted on: 2014/6/19 16:46
aka chaosgrid
http://www.freelancerserver.de
https://www.moddb.com/mods/fwtow
Top
Re: DAMAGEOBJECT IClient method wrong?
Home away from home
Joined:
2009/8/16 2:58
From Qld, Aus.
Group:
Registered Users
FLServer Admins
Trusted Speciality Developers
Senior Members
Posts: 1953
Offline
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.

Posted on: 2014/6/19 17:40
Top