Altering game content by patching str2 files

[V] Knobby

Volition Staff
We want to fix the DLC issue found with the earrings and fishnets in the second DLC pack and while I was working on a quick fix to hand out to the modding community I thought it would be a great time to write a tutorial on how I did it. Since I used the modding tools to do it and it is simply replacing content in the game it seemed very applicable.

Step 1: Determine what to actually do
My first step was to find the files I wanted to replace in the existing packfiles so I could see what would be needed to replace them. I need to replace the female cf_ap3_msfem02_ear.* files and the male cm_ap3_msfem02_ear.* files. I found the morph and the sim file live loose in the dlc2.vpp_pc file and the other files are in the str2 file for the customization item.

Step 2: Extract files that live in the str2/vpp files
This will require updating the str2 file and then patching the asm file with the new file sizes. This is fairly easy now with the vPkg tool. First we use the packfile viewer to figure out the name of the str2 files we want to alter. These turn out to be custmesh_156248976.str2_pc for the male version and custmesh_156248976f.str2_pc for the female version. We save those from the dlc2.vpp_pc file somewhere on our drive along with the dlc2_customize_item.asm_pc file.
save_from_packfile.jpg


Next we extract the files from the str2 files somewhere. In my case, I am extracting them into a folder called male and one called female with the following vPkg commands. You can use vPkg, the packfile viewer or any other packfile tool.

Code:
vPkg_wd -output_dir male -extract_packfile custmesh_156248976.str2_pc
vPkg_wd -output_dir female -extract_packfile custmesh_156248976f.str2_pc

Step 3: Do the actual file changes desired
For me this step is easy, since my buddy MeatPlowz did this step for me. :) I simply replace the files I want to replace in the str2 file by copying/modifying them in the male and female folders.
Step 4: Update the str2 files
Now to package the content up back into an str2 file I simply run this vPkg command:
Code:
vPkg_wd -output_dir male -build_customizable_item custmesh_156248976.str2 male\*
vPkg_wd -output_dir female -build_customizable_item custmesh_156248976f.str2 female\*
This generates the str2 files and the asm file for each str2 file. I'll need to replace the container information defined in the original asm file for these two containers with the information from the asm files that were just generated.

Step 5: Update the asm file
If I'm replacing str2 files that are part of a larger system, like in this case there will be a large asm file that describes all the str2 files in the packfile for that system. In my case, that asm file is names dlc2_customize_item.asm_pc. I need to update that file with the new file sizes of the contents of my str2 file. Luckily, vPkg makes this easy since it spits out new asm files for the str2 files I create and allows me to generate a new large asm file from those and the original. I'm going to toss this asm into a new folder, which vPkg will create for me, called final_content. Order is important here, the things that appear first will take precedence over things later. I use this to make sure that my new container information replaces the container information in the original asm file

Code:
vPkg_wd -output_dir final_content -combine_asms dlc2_customize_item.asm_pc male\custmesh_156248976.asm_pc female\custmesh_156248976f.asm_pc dlc2_customize_item.asm_pc
Step 6: Installing the mod
Now I just take the files and drop them into the base folder of the game. This includes the files that exist inside just a vpp file, and the new str2 and asm file I generated.
copy_files.jpg
 
Last edited:
You have to elaborate on Step 3, but I'm sure its one of those "not now, wait for the tool to come out" answers.
This tutorial was more for the unpacking and packing of data using the tools in the repo more than it was how to do the data changes. Meatplowz might be able to help with the how in this specific case.
 
Step 4: Update the str2 files
Now to package the content up back into an str2 file I simply run this vPkg command:
Code:
vPkg_wd -output_dir male -build_customizable_item custmesh_156248976.str2 male\*
vPkg_wd -output_dir female -build_customizable_item custmesh_156248976f.str2 female\*
This generates the str2 files and the asm file for each str2 file. I'll need to replace the container information defined in the original asm file for these two containers with the information from the asm files that were just generated.

Hi, I am trying this vPkg tool to get the hang of it, and I have got problems!

I test this by trying to pack a customize_item streaming file, pretty much like in your example.

Regarding this line: vPkg_wd -output_dir female -build_customizable_item custmesh_156248976f.str2 female\*

in Saints Row 3, with the Saints Row 3 version of vPkg
- the command does not seem to recognize the option -build_customizable_item
- I tried instead -build_customize_item, and still nothing
- I finally tried -build_str2 and this works ... partly. It does create the .str2_pc file, but there is no associated .asm_pc file anywhere

in Saints Row 4, with the Saints Row 4 version of vPkg
- the command does not seem to recognize the option -build_customizable_item
- I tried instead -build_customize_item, and still nothing
- I finally tried -build_str2 and it tells me: "unable to find asm file parameter!"
- I tried inserting the string customize_item.asm_pc at various places in the command, and at some point it seems to generate a generic customize_item.asm_pc file and no str2_pc file

I am kind of stuck right now and would really like to be able to duplicate what you have done in your post, but vPkg does not seem to behave like you describe in your example.
 
Back
Top