How to setup an ASM for a mod ?

Well, first of all you need to have some XTBLs in your packfile that cause scanning for ASMs (e.g. weapon_costumes.xtbl, weapon_skins.xtbl, customization_items.xtbl, items_3d.xtbl etc.). Since you want to preload 3d models, I'm going to assume you have both an items_3d.xtbl file and the therefore required ASMs (items_containers.asm_pc and items_preload_containers.asm_pc) included in your mod. Needless to say, you also have to have a STR2 file containing your model files in your packfile.
In case you don't know, the tool vpkg_wd.exe let's you convert files back and forth between the ASM and XML format. So, first you want to create a file called items_preload_containers.xml that basically looks like this inside:
Code:
<asm>
<container>your_container
    <type>Items Preload</type>
    <flags>
        <passive>No</passive>
        <packfile_attached>Yes</packfile_attached>
        </flags>
    <compression_type>9</compression_type>
    <stub_parent_name></stub_parent_name>
    <aux_data_size>0</aux_data_size>
    <compressed_data_size>249637</compressed_data_size>
    <base_offset>218</base_offset>
    <primitive>your_model.ccmesh_pc
        <type>Character mesh</type>
        <allocator>item preload</allocator>
        <flags>
            <split_file>Yes</split_file>
            <patchable>No</patchable>
            </flags>
        <allocation_group>255</allocation_group>
        <cpu_size>1828</cpu_size>
        <gpu_size>547236</gpu_size>
        </primitive>
    <primitive>your_model.rig_pc
        <type>Rig</type>
        <allocator>item preload</allocator>
        <flags>
            <split_file>No</split_file>
            <patchable>No</patchable>
            </flags>
        <allocation_group>255</allocation_group>
        <cpu_size>522</cpu_size>
        <gpu_size>0</gpu_size>
        </primitive>
    </container>
</asm>
(You might want to have a different number and/or different types of primitives, depending on the files your STR2 contains. It helps to look at other ASMs using vpkg_wd and the "-extract_asm" command for reference.)

Then you need to drag that XML into the same folder as vpkg_wd.exe and run this command in cmd:
Code:
vpkg_wd -build_asm items_preload_containers.xml
After you've created your new ASM, I recommend you to update it using Thomas Jepp's tools, since some of the variables in the XML will likely be incorrect.
Remember, if you've got an items_3d.xtbl in you mod packfile, you will need both an items_preload_containers.asm_pc and an items_containers.asm_pc, so you might still be missing the second ASM. However, it is a viable procedure to list all your containers and primitives in one ASM and make the other ones empty. You can generate empty ASMs from simple XMLs containing nothing but:
Code:
<asm></asm>
Hope this helps!
 
Flow is 100% correct, but as usual there are multiple ways. I would also be sure to check out Thomas Jepp's tools as well as they accomplish the same thing, but his stuff is very nicely done and might be easier to understand. Another thing to check out is that the modding patch allows for this sort of thing without hijacking something else that is loading. From this other thread:

Any preload.xtbl will be parsed and names of the included containers will be preloaded.

So you can just add a preload.xtbl file to your mod to preload existing resources. This was originally designed to just load existing things, but if desired I can make the game read a preload.asm file as well to add things. Then your mod would have a preload.xtbl, preload.asm, and the str2 files. Are you trying to add new resources?
 
So you can just add a preload.xtbl file to your mod to preload existing resources. This was originally designed to just load existing things, but if desired I can make the game read a preload.asm file as well to add things. Then your mod would have a preload.xtbl, preload.asm, and the str2 files. Are you trying to add new resources?
Adding stuff through a preload.xtbl would be really perfect actually . That would be easier to add new resources into the game . You would just list your packages in it and you'd be done . So if you can, that would be neat .
 
As an example for using my tools instead of vpkg_wd, your items_preload_containers.xml would look like this:
XML:
<?xml version="1.0" encoding="utf-8"?>
<AssetAssembler Version="12">
    <AllocatorTypes>
        <AllocatorType ID="1" Name="Vehicle slots" />
        <AllocatorType ID="2" Name="Vehicle Fully Cust slots" />
        <AllocatorType ID="3" Name="Character slots" />
        <AllocatorType ID="4" Name="Character high res slots" />
        <AllocatorType ID="5" Name="CS High Res slots" />
        <AllocatorType ID="6" Name="Player slots" />
        <AllocatorType ID="7" Name="taunt animation slots" />
        <AllocatorType ID="8" Name="item preload" />
        <AllocatorType ID="9" Name="cutscene" />
        <AllocatorType ID="10" Name="zscene" />
        <AllocatorType ID="11" Name="customization streaming" />
        <AllocatorType ID="12" Name="customization logo" />
        <AllocatorType ID="13" Name="Customization compositing" />
        <AllocatorType ID="14" Name="cust shaderball slots" />
        <AllocatorType ID="15" Name="Compositing render target" />
        <AllocatorType ID="16" Name="Small smesh slots" />
        <AllocatorType ID="17" Name="Large smesh slots" />
        <AllocatorType ID="18" Name="weapon high res gpu" />
        <AllocatorType ID="19" Name="time of day" />
        <AllocatorType ID="20" Name="interface streaming" />
        <AllocatorType ID="21" Name="Interface slots" />
        <AllocatorType ID="22" Name="interface image gpu compacting" />
        <AllocatorType ID="23" Name="effect preload" />
        <AllocatorType ID="24" Name="decal mempool" />
        <AllocatorType ID="25" Name="debug_superzone" />
        <AllocatorType ID="26" Name="test_level_mip_streaming" />
        <AllocatorType ID="27" Name="zone always loaded" />
        <AllocatorType ID="29" Name="medium lod level allocator" />
        <AllocatorType ID="30" Name="high lod level allocator" />
        <AllocatorType ID="31" Name="mip_streaming" />
        <AllocatorType ID="32" Name="modal gameplay" />
        <AllocatorType ID="35" Name="Texture compression scratch" />
        <AllocatorType ID="36" Name="morph preload mempool" />
        <AllocatorType ID="37" Name="level container cache" />
        <AllocatorType ID="38" Name="vehicle_customization_cameras" />
        <AllocatorType ID="39" Name="zone header cache" />
        <AllocatorType ID="40" Name="TOD_luts" />
        <AllocatorType ID="41" Name="cutscene container cache" />
        <AllocatorType ID="42" Name="Streamable Player Weapons" />
        <AllocatorType ID="43" Name="superpower buff" />
        <AllocatorType ID="44" Name="superpower blast" />
        <AllocatorType ID="45" Name="superpower stomp" />
        <AllocatorType ID="46" Name="superpower tk" />
        <AllocatorType ID="254" Name="GSA_DESTUB_ALLOCATOR" />
    </AllocatorTypes>
    <ContainerTypes>
        <ContainerType ID="1" Name="Vehicle" />
        <ContainerType ID="2" Name="Vehicle Fully Customizable" />
        <ContainerType ID="3" Name="Items Preload Mempool" />
        <ContainerType ID="4" Name="Items" />
        <ContainerType ID="5" Name="Items Preload" />
        <ContainerType ID="6" Name="Weapon High Res" />
        <ContainerType ID="7" Name="Character" />
        <ContainerType ID="8" Name="Character High Res" />
        <ContainerType ID="9" Name="Player" />
        <ContainerType ID="10" Name="Cust Component" />
        <ContainerType ID="11" Name="Cust Logo" />
        <ContainerType ID="12" Name="Cust Composite" />
        <ContainerType ID="13" Name="Cust Shaderball" />
        <ContainerType ID="14" Name="Small static mesh" />
        <ContainerType ID="15" Name="Large static mesh" />
        <ContainerType ID="16" Name="Environmental item" />
        <ContainerType ID="17" Name="Skybox" />
        <ContainerType ID="18" Name="Cutscene" />
        <ContainerType ID="19" Name="Zscene" />
        <ContainerType ID="21" Name="UI" />
        <ContainerType ID="22" Name="UI peg" />
        <ContainerType ID="23" Name="Effects Preload" />
        <ContainerType ID="24" Name="Effects (Vehicle)" />
        <ContainerType ID="25" Name="Environment Effects" />
        <ContainerType ID="26" Name="Effects (Superpower)" />
        <ContainerType ID="27" Name="Decal" />
        <ContainerType ID="28" Name="Level Always Loaded" />
        <ContainerType ID="29" Name="Level Always Loaded Peg" />
        <ContainerType ID="30" Name="Zone" />
        <ContainerType ID="31" Name="Zone (High LOD)" />
        <ContainerType ID="32" Name="Interior zone" />
        <ContainerType ID="33" Name="mission" />
        <ContainerType ID="34" Name="activity_type" />
        <ContainerType ID="35" Name="taunt animation" />
        <ContainerType ID="37" Name="level mesh for precache" />
        <ContainerType ID="38" Name="Mission_Skybox" />
        <ContainerType ID="39" Name="mission model data" />
        <ContainerType ID="40" Name="Vehicle customization camera" />
        <ContainerType ID="41" Name="LUT" />
        <ContainerType ID="42" Name="Streamable Weapon" />
        <ContainerType ID="254" Name="GSC_DESTUB_CONTAINER" />
    </ContainerTypes>
    <PrimitiveTypes>
        <PrimitiveType ID="1" Name="Vehicles" />
        <PrimitiveType ID="2" Name="Vehicle cvtf" />
        <PrimitiveType ID="3" Name="Vehicle PEG" />
        <PrimitiveType ID="4" Name="Vehicle VFX" />
        <PrimitiveType ID="5" Name="Character mesh" />
        <PrimitiveType ID="6" Name="Cloth Sim" />
        <PrimitiveType ID="7" Name="Character morph" />
        <PrimitiveType ID="8" Name="Character cvtf" />
        <PrimitiveType ID="9" Name="Pcust mesh" />
        <PrimitiveType ID="10" Name="Pcust peg" />
        <PrimitiveType ID="11" Name="Pcust morph" />
        <PrimitiveType ID="12" Name="Pcust creation morph" />
        <PrimitiveType ID="13" Name="Customization Rig" />
        <PrimitiveType ID="14" Name="Pcust matlib" />
        <PrimitiveType ID="15" Name="Pcust logo peg" />
        <PrimitiveType ID="16" Name="VFX" />
        <PrimitiveType ID="17" Name="Peg" />
        <PrimitiveType ID="18" Name="Low Mips" />
        <PrimitiveType ID="19" Name="AL peg" />
        <PrimitiveType ID="20" Name="Static Mesh" />
        <PrimitiveType ID="21" Name="Rig" />
        <PrimitiveType ID="22" Name="Anim File" />
        <PrimitiveType ID="23" Name="Material" />
        <PrimitiveType ID="24" Name="Cutscene File" />
        <PrimitiveType ID="25" Name="Cutscene Camera Script" />
        <PrimitiveType ID="26" Name="Lightset" />
        <PrimitiveType ID="27" Name="VINT doc" />
        <PrimitiveType ID="28" Name="Vint LUA script" />
        <PrimitiveType ID="30" Name="Zone (fast)" />
        <PrimitiveType ID="31" Name="Zone (slow)" />
        <PrimitiveType ID="32" Name="Level Mesh" />
        <PrimitiveType ID="33" Name="Mission LUA script" />
        <PrimitiveType ID="34" Name="Mission override table" />
        <PrimitiveType ID="35" Name="Activity table file" />
        <PrimitiveType ID="36" Name="Material Library" />
        <PrimitiveType ID="37" Name="Tree" />
        <PrimitiveType ID="38" Name="Foliage Mesh" />
        <PrimitiveType ID="39" Name="Light Curve" />
        <PrimitiveType ID="40" Name="Buffer" />
        <PrimitiveType ID="41" Name="Level Mesh Collision" />
        <PrimitiveType ID="42" Name="Animation file" />
        <PrimitiveType ID="43" Name="Mission Conversation" />
        <PrimitiveType ID="44" Name="Vehicle customization camera" />
        <PrimitiveType ID="45" Name="Zone header (fast)" />
        <PrimitiveType ID="46" Name="Zone header (slow)" />
        <PrimitiveType ID="47" Name="Pcust cloth sim" />
        <PrimitiveType ID="253" Name="GSP_DESTUB_PRIM_BUF" />
        <PrimitiveType ID="254" Name="GSP_DESTUB_PRIM" />
    </PrimitiveTypes>
    <Containers>
        <Container Name="Shotgun-Police" Type="Items Preload" Flags="128" PackfileBaseOffset="186" CompressionType="9" StubContainerParentName="" TotalCompressedPackfileReadSize="101911">
            <Primitive Name="autoshotgun_a.ccmesh_pc" Type="Character mesh" Allocator="item preload" Flags="4" ExtensionIndex="0" CPUSize="2008" GPUSize="239828" AllocationGroup="255" />
            <Primitive Name="autoshotgun_a.rig_pc" Type="Rig" Allocator="item preload" Flags="0" ExtensionIndex="0" CPUSize="576" GPUSize="0" AllocationGroup="255" />
        </Container>
    </Containers>
</AssetAssembler>

And you'd build it into an ASM using:
Code:
ThomasJepp.SaintsRow.Stream2.exe items_preload_containers.xml toasm

You don't need to worry about the GPU and CPU sizes, because when you build your package using ThomasJepp.SaintsRow.BuildPackfile or ThomasJepp.SaintsRow.BuildPackfileGUI you should tell it to update the ASM you've created - it'll automatically fix the file sizes for you then.

To convert existing ASMs into XML files to look at them, use:
Code:
ThomasJepp.SaintsRow.Stream2.exe items_preload_containers.asm_pc toxml
 
Back
Top