**Tutorial** Low-tech ALE cloning
So, let's take a look at gf_br_smallengine01_fire.ale with a hex editor (I'm using xvi32 here). Look through it and find the name of the effect:
To be safe, let's change the name to something with the same length as before:
Now for the first trick. Open up data/fx/engines/engines_ale.ini. Go find the previous engine effect and copy it (gf_br_smallengine01_fire in this case). This is mostly to make sure you get the right textures; you'll be changing everything else anyway. Change the nickname to what you want, change the alchemy line to your new file, and most importantly change the effect_crc to the CRC of your new effect's name (alternate_engine001_fire in this example). If you don't know what the heck I'm talking about, this is a utility for calculating the CRC32 used by models and ALE effects: CRCCalc. However, the problem here is that effect_crc expects a signed integer, and CRCCalc will give you an unsigned integer. If you don't know what that means... when you've got 32 bits to store an integer value, you can hold exactly 2^32 distinct values (about four billion). The question is, do you want your range of values to cover only positive values or some split of positive and negative values? In this fashion, the same sequence of bits can mean two different integer values, depending on if you interpret it as a signed or unsigned integer.
Ok, now that the basics are covered, how does one go about converting an unsigned integer into a signed integer? Well, if you'll notice, CRCCalc will give you the hexadecimal representation of the number as well. Simply hijack that and drop it into xvi32 and then ask it to interpret what you gave it as a signed integer. Just be sure to put the bytes in backwards order. Easier shown than explained (this is just an example to illustrate the process):
Get the CRC:
Insert the CRC in xvi32 and get its signed value:
Ok, so now you've got the signed CRC value. Let's get back to engines_ale.ini and put it in. The CRC for alternate_engine001_fire happens to be 0x13625306, which equals 325210886 as a signed integer.
[VisEffect
nickname = alternate_engine001_fire
alchemy = fx\engines\alternate_engine001_fire.ale
effect_crc = 325210886
textures = fx\planetflare.txm
But that's not enough. Recall that Freelancer internally keeps track of everything by name (or rather, by CRC of name), so if two things of the same type also have the same name, it will get confused and believe that only one of those things exists; all instances of the second will end up looking like the first. ALE effects are no exception. Fortunately, getting around this is pretty easy.
First off, find the .app part of the .ale. There may be several, though for gf_br_smallengine01_fire there's just one. Take the CRC of this; you will be using it later.
In this case, the CRC equals 0x1CE7F0D9. This CRC will exist somewhere else in the .ale file, so let's go find it. Do a search for it (be sure to put the bytes in reverse order) starting from the beginning. Odds are very, very low that you will encounter more than one instance of that particular value, so you can just assume that you've found it.
In this case, the value is sitting at address 0x17C. Now, let's change the .app name so that Freelancer can tell this effect apart from gf_br_smallengine01.app. Again, to be safe I made the length of the name equal the length of the original name.
Finally, take the CRC of this new .app name (it's 0x1EBBA843). If you haven't guessed already, we need to change the value at 0x17C to this new CRC. Do so now.
And whoosh, now you can toy with this new .ale as much as you want without affecting gf_br_smallengine01_fire. It's kind of an ugly process but honestly doesn't take that long once you get used to it.
Edited by - Dev on 6/22/2007 3:45:45 PM