Saints Row IV SRIV SDK Release A: Weapon Tools

I've also seen the problem with Gat's shotgun. Looks and works fine in my possession, but if any npc or cop has it, or drops it after I kill him/her/it with my awesomeness, it's simply white, like it's missing the textures.

2014-09-06_00001_zps26df350a.jpg

Yes, so this is an issue with the textures for the average weapon. We load special high res textures for the player and those are included and work well. Currently they are missing for the low res version. I'm working on this and should have something "soon".

More technical version:
When we build preload packfiles we combine all textures into a single peg. This generated amazing wins on xbox due to the 4k alignment and mip interleaving that was possible. We just did it on all platforms to be consistent. The problem is that the low res version of this weapon just has a mesh in the streaming container as the texture is loaded via the large preload peg. This presents a problem as we need to inject/replace a texture inside this global peg or include a texture in the streaming container for the weapon. The question is if the slot is large enough for the texture.
 
Ok, so I have fixed this, but instead of just handing you a file(I'm doing that as well) I thought you guys might like some insight on how I fixed it and what tools I used to do it. These are all available for you outside of the debug version of the game to see where things went wrong.

So I knew that the high res textures were there but the low res were white. White being misc_static.cvbm leads me to believe the renderer was asking for a texture that we didn't have registered. This quickly lead me to seeing no texture in the str2. The export process spit one out, but since there wasn't a texture in the original shotgun container it didn't get included in the new one. This was due to the stuff above about the preload peg being built. Technically we might be able to remove the original shotgun texture from the preload peg for this mod, but I'm not going to mess with that. :) Also note that I might have gotten lucky that the textures fit. With this being a preloaded item, I have a large pool with hopefully a lot of slop. It didn't break so I was happy.

Ok, so how do I get some new files into this str2 and make the game happy? vpkg is the answer. First I extracted the original asm file into xml via vpkg with
Code:
vpkg_wd -extract_asm items_preload_containers.asm_pc
This generated a file called items_preload_containers.xml. I searched that file for the shotgun and sure enough, no textures. So I needed to add textures to the xml. I didn't remember the syntax for this xml file, so I extracted the items_containers.asm_pc file for an example. There I found
Code:
	<primitive>burst_ar_high.cpeg_pc
		<type>Peg</type>
		<flags>
			<split_file>Yes</split_file>
			<patchable>No</patchable>
			</flags>
		<allocation_group>0</allocation_group>
		<cpu_size>294</cpu_size>
		<gpu_size>1572880</gpu_size>
		</primitive>
So I copied that over and changed the name of the primitive to match my file(pump_shotgun.cpeg_pc). I then updated the file sizes to match those on the peg I was adding.

Now vpkg has a way to generate a new str2 from an asm file, but it will try to build ALL the str2's from an asm. To cut down on stupid errors that might blow things up, I copied the xml into a new file I called shotgun_only.xml. It looked like this:
Code:
<asm>
<container>Shotgun-Gang
	<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>304684</compressed_data_size>
	<base_offset>274</base_offset>
	<primitive>pump_shotgun.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>1264</cpu_size>
		<gpu_size>315140</gpu_size>
		</primitive>
	<primitive>pump_shotgun.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>586</cpu_size>
		<gpu_size>0</gpu_size>
		</primitive>
	<primitive>pump_shotgun.cpeg_pc
		<type>Peg</type>
		<flags>
			<split_file>Yes</split_file>
			<patchable>No</patchable>
			</flags>
		<allocation_group>0</allocation_group>
		<cpu_size>409</cpu_size>
		<gpu_size>240320</gpu_size>
		</primitive>
	</container>
</asm>

Then I build the str2 with vpkg via
Code:
vpkg_wd -build_asm shotgun_only.xml
vpkg_wd -build_str2 shotgun_only.asm_pc
and then I opened up the str2 with the packfile viewer. I need some info from that in order to build a functioning game asm. I hope to make this easier, but for now you have to just suck it up and do the math. I highlighted all the files and looked at the two numbers for size:

packfile_viewer.png


You see the numbers don't add up exactly and the reason is the packfile header. Good thing I need this information. First off, I edit the xml value compressed_data_size to be 304684 to match the total size of the files in the packfile. Then I subtract 304684 from 304958 to get the header size of 274. I then plug that into the xml for base_offset. Then I build the items_preload_containers.asm_pc file with
Code:
vpkg_wd -build_asm items_preload_containers.xml
And now I have an updated str2 file with the textures that I needed along with an updated asm file that lists the textures and has the correct sizes in it. I copy them over and load the game and sure enough, things are happy.

Hopefully this helps you guys a bit with your hacking and playing around.
 

Attachments

  • SRG_DamnedImpaler_MOD.zip
    590.6 KB · Views: 607
Last edited:
This might be a stupid question but... What am I doing wrong?
I drop the files into my game,it doesn't override anything,I ran String2 update (just to be safe),and yet all this does is crash my game into a looping startup.
 
This might be a stupid question but... What am I doing wrong?
I drop the files into my game,it doesn't override anything,I ran String2 update (just to be safe),and yet all this does is crash my game into a looping startup.
You shouldn't have to do anything but drop all the files from the archive into either the main game folder or the mod folder. You don't need the readme, but it doesn't hurt anything. What steps did you take? Where did you put the files? Do you have any other mods?
 
I have other mods but it didn't overwrite anything. I dropped them in the same place as the exe,with all the other stuff I have. Steam/SteamApps/common/Saints Row IV. Like I said it doesn't overwrite anything so I'm a bit confused...
 
I have other mods but it didn't overwrite anything. I dropped them in the same place as the exe,with all the other stuff I have. Steam/SteamApps/common/Saints Row IV. Like I said it doesn't overwrite anything so I'm a bit confused...
It could seem like a pain, but you might want to try backing up your steam directory folder, then re-install SR4 with a fresh copy, then try this mod as a test without mods installed. I have several mods installed, including the high res texture pack designed for SR3, and it now works perfectly for me after the fix.
 
Hmm....is it possible to hit some kind of limit for customization options on weapons without overwriting any files?That could be it (just trying to think of things it could be).I do have Shitface and Fan of Saints expanded arsenal (and other mods)...If that's the case then I guess I'd have to pass on this (as much as I hate to)because that mod adds things I need as opposed to this adding something I just want...lol.
 
Hmm....is it possible to hit some kind of limit for customization options on weapons without overwriting any files?That could be it (just trying to think of things it could be).I do have Shitface and Fan of Saints expanded arsenal (and other mods)...If that's the case then I guess I'd have to pass on this (as much as I hate to)because that mod adds things I need as opposed to this adding something I just want...lol.

Shouldn't be the case, I have expanded arsenal mod installed too, as well as Extended Wardrobe and Extra Wardrobe colors installed, possibly one or two more.
 
I have gpz extended wardrobe,CJK nude texture,Disable super glow,Opaque eyes,expanded arsenal,additional cheats,Customize any vehicle wardrobe /color changer, Extra clothing and makeup colors,Dark Rain,and ZST red visor. That's it. I had less the first time I tried to install this and it still didn't work. Oh and the Black and Red Iron Saint.
Edit: going to remove some unneeded mods,do fresh install and see what happens....
 
Last edited:
Back
Top