Asset porting

Introduction
In this tutorial, we're going to use HipHopTool to port an object such as a tiki or an enemy from a level's HIP or HOP file to another's, so you can use them in your mods. You'll also need a hex editor for faster editing of the SNDI asset. This tutorial assumes you already know the basics of unpacking and packing archives with HipHopTool and editing assets with Industrial Park.

Note: you don't need to do this to port simple stuff such as single MODL and RWTX. This tutorial is intended for porting of models which use MINF and ATBL, which are more complex and are actually made up of many different assets.

Steps
As an example, we will port a Sleepytime from Rock Bottom (RB01) to Jellyfish Fields (JF01).

1. Using HipHopTool, unpack the HIP and HOP archives of RB01.

2. Also unpack the HIP and HOP of JF01.

3. Copy all of the folders from the unpacked RB01.HOP and paste them into the unpacked folder of JF01.HOP. This will merge the assets of the two files. Do not overwrite any files; only copy files which are not already in JF01.HOP. Do not copy the Settings.ini either.

4. Do the same for the two HIPs: copy the contents from unpacked RB01.HIP and paste over unpacked JF01.HIP but do not overwrite anything when prompted.

5. Open the two Settings.ini files of RB01.HOP and JF01.HOP in two separate text editor instances.

6. At this point, you must find every asset in RB01.HOP/Settings.ini which corresponds to the enemy we want to port (in this case, Sleepytime) and paste them in the JF01.HOP/Settings.ini file in the appropriate layer.

7. You can use Ctrl+F and search for the word "sleepy" in the text editor to find all the assets which contain this word in the Settings.ini to find them faster. The assets in the HOP will be mostly RWTX, MODL, ANIM and SND. When you copy the reference from one INI, you must paste it in the same layer type in the other one. It's okay to create new layers for this, you don't need to use the same ones the file already has. For example, a new texture layer can be created for the RWTX assets, and might look like this:

LayerType=1 TEXTURE LHDR.LDBG=-1 Asset=A51B9342;RWTX;6;0;fx_sleepy_nightlight;;8FD58099 Asset=D20C98F7;RWTX;6;0;robot_5a_sleepy-time_backup.RW3;;375D0947 Asset=4C621128;RWTX;6;0;fx_sleepy_zeez;;82B4E2CE Asset=975388C4;RWTX;6;0;fx_sleepy_beamodeath;;415644A4 Asset=220EA7DE;RWTX;6;0;fx_sleepy_electrodots;;3CEF7EAD Asset=0A9A7A0A;RWTX;6;0;robot_5a_sleepy-time.RW3;;F4CA0425 EndLayer

8. You can't forget to also add the assets which don't have sleepy in their names. Sounds for the sleepytime, for example, usually start with ST_. Look in the SRAM layer for this.

9. When you're done copying the assets, you still have to copy the SND/SNDS headers from the origin SNDI asset to the destination one, in the HOP. You can do this either using a hex editor or using Industrial Park.

Using a Hex Editor
Using a hex editor is faster than using Industrial Park, but you're more likely to make a mistake, specially if you're not experienced with hex editing. The Industrial Park method is slighly different, you can check the steps below.

9.1. Open both the origin and the destination SNDI assets in a hex editor.

9.2. Find the header entries with the asset IDs of the SND/SNDS in the origin SNDI and copy them to the destination SNDI.

9.3. There's no need to replace any existing entries; just add them to the start of the table (at offset 0x10) and increase the amount at the header (offset 0x00). Remember each entry is 0x64 bytes long, with the last 4 bytes being the asset ID.

10. Once you've finished copying the assets from the original HOP's Settings.INI to the destination one, do the same thing for the HIP. However, in the HIP you can't create new layers for your new assets.

11. The assets in the HIP will usually be MINF, ATBL and SHRP. Other assets might be needed as well. Those are the HIP assets for the Sleepytime:

Asset=568849BE;ATBL;6;0;robot_sleepy-time_bind.ATBL;;9074F667 Asset=B0E87D8C;ATBL;6;0;LassoGuide_sleepy-time.ATBL;;D6AEE1E1 Asset=02D642FC;ATBL;6;0;sleepy_light_bind.ATBL;;04DFA705 Asset=305DF049;SHRP;2;0;robot_sleepy-time_shrapnel;;4C3B8E84 Asset=582111BD;MINF;2;0;robot_sleepy-time_bind.MINF;;3709E8B5 Asset=B281458B;MINF;2;0;LassoGuide_sleepy-time.MINF;;119732EE Asset=046F0AFB;MINF;2;0;sleepy_light_bind.MINF;;7B46D8D5

12. There's obivously no need to copy VILs, MVPTs and such, as we're going to place the individual instances of enemies ourselves. The assets we need to port are only the general ones, which are used by all instances of the enemy.

13. Once you've done copying all needed files from both the HOP and HIP, rebuild the archives using HipHopTool.

Using Industrial Park
If you choose to copy the sounds with Industrial Park, do not copy the SND or SNDS assets in the previous steps, just skip them. You need Industrial Park Preview 7 or newer to do this.

9.1. First, perform steps 10, 11, 12 and 13 and finish building your HIP and HOP, skipping the SND and SNDS assets.

9.2. Open the original level's HOP in Industrial Park. Find the SRAM layer and your object's SND/SNDS assets. In the example case, they are ST_attack, ST_hit and ST_hit2_loop.

9.3. Open them in the internal asset editor (using the Edit Data button) and export the sound data of all of them to files. Don't use the "Export Raw" function as this will not export all we need.

9.4. Once you've exported all of them, close the original level's HOP and open the destination one. Find the SRAM layer.

9.5. Create copies of the existing SND assets. Name them with the names of the assets we're going to import using Edit Header. They must have the exact same names and asset IDs; don't import any raw data yet.

9.6. Open each of them in an internal editor using Edit Data, check the "Trim header and send to SNDI" box, and use Import Sound Data to import the files we exported earlier. Do this for each asset.

14. At this point, you should test your files ingame, even if you haven't placed a VIL of the enemy yet. If you did something wrong, the game will crash.

15. If the game doesn't crash, try placing a VIL of your enemy now and it should work (you can copy a VIL from the original level and change the position and MVPT).

16. If you've done everything sucessfully, you should delete the folders of the unpacked HIPs and HOPs you created in the previous steps, as they contain a lot of junk (unreferenced assets).

17. It's possible to do all of this using only Industrial Park if you just extract the assets from one archive to the other one by one. However, it's a lot more time consuming than simply copying and pasting lines in the Settings.ini files.