Solar Spawning
-
Since we are now capable of spawning ships I reversed the SolarInfo struct:
struct SolarInfo{ int iFlag; //0x290; ShipInfo has this too, no clue whether actually a flag int iArchID; int iSystemID; Vector vPos; Matrix mOrientation; int iLoadoutID; struct structCostume { UINT head; UINT body; UINT lefthand; UINT righthand; UINT accessory[8]; int accessories; }; structCostume Costume; int iRep; int iUnk7; //0 int iUnk8; //0 int iUnk9; //Boolean, only last byte is used int iHitPointsLeft; char cNickName[64]; //Has to be unique int iUnk11; //0 int iUnk12; //0 };
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.
-
sUnk1 is a costume, but you’ve missed one:
struct Costume { UINT head; UINT body; UINT lefthand; UINT righthand; UINT accessory[8]; int accessories; }; ```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.
-
Well the sub which initializes this struct:
mov eax, ecx xor ecx, ecx mov [eax], ecx mov [eax+4], ecx mov [eax+8], ecx mov [eax+0Ch], ecx mov [eax+30h], ecx retn
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.
-
I disagree. You can use Server.MineAsteroid anyway for this purpose.
-
I think all of FL’s structs are 4-byte aligned.
Nice stuff Schmack
Does it work properly with all the struct filled?
-
Does only use 5 values. That’s why I got only 5 and did not include iUnk6.
Count again. It initialises five values.
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.
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.
-
@FF: Thx. It depends on what you mean with “properly” I noticed none of the mission solars has any weapons visible. I don’t know if there is a way changing that on creation, since there are a few unknown values yet. Setting the iUnk9 to 1 had no effect. If I spawn regular weapon platforms, they don’t attack. Maybe the personality thing does not work like it does for npcs.
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.
Count again. It initialises five values.
That’s what I wrote after that sentence you quoted. You left the important part out.
iRep is set by pub::Reputation::SetAffiliation.
From what I have seen, it is used by both Alloc and SetAffiliation (which would corresponded with the way we set it in FLHook).
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.
-
@Schmackbolzen: Ah yes, my mistake. You should edit the first post.
-
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.
-
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
-
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).aspxWouldnt it be better to leave it for UINT iUnk9; if the alignment is 4 bytes by default?
-
Probably 11 years too late but iUnk8 is the BaseID of the base the Solar is linked to.