Reminder: Internet Explorer 6 or below are NOT supported.





There are currently 76 users playing Freelancer on
45 servers. | May. 31, 2023 |
Browsing this Thread:
1 Anonymous Users
Solar Spawning |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2008/7/8 21:15 From Germany
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
605
![]() |
Since we are now capable of spawning ships I reversed the SolarInfo struct:
Code: struct SolarInfo{ Something with the loadouts seems to be wrong as the weapons/guns don't appear. This seems to be in general the case, if you e.g. accept a mission which contains solars to be destroyed you don't see any of them either. You can spawn any solarobject of solararch.ini. Even planets work.
Posted on: 2010/8/26 18:37
|
|||
|
Re: Solar Spawning |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2009/8/16 2:58 From Qld, Aus.
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
2035
![]() |
sUnk1 is a costume, but you've missed one:
Code: struct Costume That makes iUnk6 disappear into the Costume. iUnk8 is set by pub::Reputation::Alloc. iUnk9 is bool, initialised to true, but later copied from something.
Posted on: 2010/8/27 7:23
|
|||
|
Re: Solar Spawning |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2008/7/8 21:15 From Germany
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
605
![]() |
Well the sub which initializes this struct:
Code: mov eax, ecx Does only use 5 values. That's why I got only 5 and did not include iUnk6. But I now calculated the end and noticed it just does not initialize the array. Concerning iUnk8: I can not confirm that (at least in the sub I analyzed). There only iRep is used by ...::Alloc. Concerning iUnk9: I checked and yes it is initialized with 1, but still uses 4 bytes instead of 1. In CreateSolar only one byte is read. So one can assume it is indeed boolean, but 4 byte aligned.
Posted on: 2010/8/27 12:28
|
|||
|
Re: Solar Spawning |
||||
---|---|---|---|---|
Just can't stay away
![]() ![]() Joined:
2008/6/20 0:27 From Russia, GMT+4
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
278
![]() |
Care to reverse the loot struct? IMO it can have more applications...
![]()
Posted on: 2010/8/27 15:05
|
|||
|
Re: Solar Spawning |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2008/7/8 21:15 From Germany
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
605
![]() |
I disagree. You can use Server.MineAsteroid anyway for this purpose.
Posted on: 2010/8/27 15:19
|
|||
|
Re: Solar Spawning |
||||
---|---|---|---|---|
Starport Admin
![]() ![]() Joined:
2009/2/21 21:42 Group:
Webmasters Registered Users
Posts:
3520
![]() |
I think all of FL's structs are 4-byte aligned.
Nice stuff Schmack ![]() Does it work properly with all the struct filled?
Posted on: 2010/8/27 15:34
|
|||
"Cynicism is not realistic and tough. It's unrealistic and kind of cowardly because it means you don't have to try." -Peggy Noonan |
||||
|
Re: Solar Spawning |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2009/8/16 2:58 From Qld, Aus.
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
2035
![]() |
Quote: Does only use 5 values. That's why I got only 5 and did not include iUnk6. Count again. It initialises five values. Quote: Concerning iUnk8: I can not confirm that (at least in the sub I analyzed). There only iRep is used by ...::Alloc. iRep is set by pub::Reputation::SetAffiliation. Quote: So one can assume it is indeed boolean, but 4 byte aligned. Not quite - the alignment is for the following int. bool = 1 byte, int = 4 bytes, so to keep the int DWORD aligned, 3 padding bytes are added after the bool. I should point out I'm doing all this from the disassembly of content.dll, not from debugging.
Posted on: 2010/8/27 15:43
|
|||
|
Re: Solar Spawning |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2008/7/8 21:15 From Germany
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
605
![]() |
@FF: Thx. It depends on what you mean with "properly"
![]() The rest works ok, The types in the radar and on the screen match. You can see them from very far, too. The only thing I did not test is giving them names and I don't know how to do that either, yet ![]() @adoxa: You are misunderstanding me. Quote: Count again. It initialises five values. That's what I wrote after that sentence you quoted. You left the important part out. Quote: iRep is set by pub::Reputation: From what I have seen, it is used by both Alloc and SetAffiliation (which would corresponded with the way we set it in FLHook). Quote: Not quite - the alignment is for the following int. bool = 1 byte, int = 4 bytes, so to keep the int DWORD aligned, 3 padding bytes are added after the bool. DWORD is 4 byte, so we are talking about the same. I used debugging only for getting a memory dump of the whole struct.
Posted on: 2010/8/27 16:12
|
|||
|
Re: Solar Spawning |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2009/8/16 2:58 From Qld, Aus.
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
2035
![]() |
@Schmackbolzen: Ah yes, my mistake. You should edit the first post.
Posted on: 2010/8/28 5:57
|
|||
|
Anonymous
|
Re: Solar Spawning |
|||
---|---|---|---|---|
Anonymous-Anonymous
|
So now when a base is destroyed, it will be respawned after some time?
Where do I get this plugin?
Posted on: 2010/8/28 10:45
|
|||
|
Re: Solar Spawning |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2008/7/8 21:15 From Germany
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
605
![]() |
This is still in development. I suppose for full potential also clienthooking will be needed (I will test some time later how much you can change after a base is spawned). For now it is for developers only, so that we can reverse everything which is needed to make a practical use of it.
@Adoxa: Done.
Posted on: 2010/8/28 11:09
|
|||
|
Re: Solar Spawning |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2009/8/16 2:58 From Qld, Aus.
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
2035
![]() |
Why didn't you just use bool iUnk9;? Padding is taken care of automatically. And let's not get started on last byte/first byte.
![]()
Posted on: 2010/8/28 15:04
|
|||
|
Re: Solar Spawning |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2008/7/8 21:15 From Germany
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
605
![]() |
I don't trust the compiler (since it is from MS) and we are dealing with multiple versions here (no clue whether vc7-vc10 behave the same). Last and first byte depends whether it is big or little endian and to my knowledge the last byte should be used, also the asm code I saw suggests this (also for the programmer it is only important to know, that 1 is true). If anyone wants to try whether setting it to boolean will not change the structs size/composition, be my guest
![]()
Posted on: 2010/8/28 15:47
|
|||
|
Re: Solar Spawning |
||||
---|---|---|---|---|
Just can't stay away
![]() ![]() Joined:
2008/6/16 20:41 Group:
Registered Users FLServer Admins Trusted Speciality Developers
Posts:
312
![]() |
struct member allignment can be setup in source code with #pragma pack keyword. As far as i remember is #pragma pack push 1 before the struct definition and #pragma pack pop (or similar).
see http://msdn.microsoft.com/en-us/library/2e70t5y1(VS.80).aspx Wouldnt it be better to leave it for UINT iUnk9; if the alignment is 4 bytes by default?
Posted on: 2010/8/28 16:19
|
|||
![]() |
||||
|
Re: Solar Spawning |
||||
---|---|---|---|---|
![]() Joined:
2015/9/13 18:49 Group:
Registered Users FLServer Admins $$$ Supporters $$$ Senior Members
Posts:
21
![]() |
Probably 11 years too late but iUnk8 is the BaseID of the base the Solar is linked to.
Posted on: 2021/3/25 23:03
|
|||
|