Merging mods (many images within)

Corrodias

Generally Awesome
Here i'm going to describe how to take two mods that are incompatible and merge them together so you can use both. This is going to depend a little on the mods in question. Not all incompatible mods can be merged. Most of them can be.

This guide also applies to SR3, to an extent, but you'll be using Gibbed's tools for SR3 instead of Minimaul's tools for SR4, and they work differently.

If you would like to know more about how this stuff works, you can read Idolninja's thread on modding basics.

What i mean by incompatible is that they use the same files. For example, let's take...
[ New Homies ]
and
[ Homies keep original outfits ]
Both of these mods include the files "homies.xtbl". You can't just drop both of them into your SR4 directory and expect it to work, because clearly, you can have only one copy of homies.xtbl.

There are a couple of ways to do this, i know, but i'm going to explain only one here.

Required tools:
[ Notepad++ ]
[ WinMerge ]
[ Minimaul's Saints Row IV tools ]
[ 7-zip ], WinRar, or some other archive utility, just to extract Minimaul's tools and the mods!

Install Notepad++ and WinMerge and extract Minimaul's tools somewhere.

Step 0: setup
Open Notepad++. Go to the plugins menu, select "Plugins Manager", and "Show Plugin Manager".
Choose "XML Tools" and click install. Allow Notepad++ to restart.
2013-09-14_00-50-26.png

Extract all of mod 1's files into your Saints Row 4 folder, and do the same for mod 2. It will overwrite the conflicting files. That's fine, we don't care. We're going to replace them anyway. Just make sure you know which files those are. Those are the files we have to merge!

Step 1: extract the mod files
Okay, pretty simple first step. Get the two files from your mods in one place and give them meaningful names that you'll recognize.
2013-09-14_00-37-12.png


Step 2: extract the original file
Wherever you extracted Minimaul's tools, run "ThomasJepp.SaintsRow.ExtractPackfileGUI.exe".
2013-09-14_00-38-27.png

Click the "Extract" button. A file open dialog will open.
Navigate to your SR4 game folder, then down to the folder packfiles\pc\cache.
Here you want to find the file "misc_tables.vpp_pc".
2013-09-14_00-41-26.png

Select an empty folder to extract them to.
2013-09-14_00-43-08.png

Once that's done, inside that folder is a folder called "misc_tables.vpp_pc", and in that you will find another "homies.xtbl" file. Copy that "homies.xtbl" to the folder with the other two. Now you have three files there.

Step 3: standardize the formatting
For EACH .xtbl file: Open the file in Notepad++. From the Plugins menu, choose "XML Tools", then "Pretty print (XML only - with line breaks)". Save the file.
xml.png


What this is going to do is get all 3 files formatted the same, so all the linebreaks are in the right places, all of the indents are the same depth, all the spacing is the same. This is so we can see the "real" differences between the files, because the game doesn't care about any of the formatting, only the real content.

Step 4: the first mod
Now it's time to start merging.

Right now we have our 3 files:
2013-09-14_00-58-37.png

"homies.xtbl" is the original from the game's pack file, of course.

We have two mods to merge in. Pick one (preferably whichever one you think makes more changes) and consider it the "first" mod. We're going to use "new homies" as the first mod, because i can see the file is significantly bigger.

Open WinMerge. Press ctrl+O to "open".
2013-09-14_01-02-35.png

For the "left" side, pick the original "homies.xtbl" file. For the "right" side, pick the first mod's file.
It says the paths are invalid because i had to cut out the middle of the path so you could see the filenames. Pay it no mind!

Click OK. WinMerge will compare the files and show you the differences, highlighted in orange.
2013-09-14_01-05-17.png

On the far left is a zoomed-out view of both files. On the (not-far) left you see the original file. On the right you see the mod's file. In this case, no lines were changed, they were just ADDED or REMOVED. When lines exist in one file but not the other, the file they exist in has them all higlighted in orange, and the file they don't exist in has a blank, dark, grey space.

That means, if you look closely at this image, that the mod (right) ADDED the first block of text -- it's orange on the right and grey on the left -- and REMOVED the second block -- it's grey on the right and orange on the left.

This shows us what lines were changed by mod 1. Now, we need to apply those changes to the original file. IF we were going to do that, we'd copy the orange lines on the right and erase the grey lines. But wait, we already have a copy with all the changes applied. It's the first mod's file, itself!

Set this WinMerge window aside. It is only going to be a reference. We'll look at it if we need help figuring out a conflict, later.

Step 5: the second mod
Now we need to merge in the changes made by the second mod. First we make the file that we're going to be making changes in. That's simple: Copy and paste the first mod's file, "new homies.xtbl". We'll call it "final homies.xtbl".
2013-09-14_01-13-37.png

Open "final homies.xtbl" in Notepad++. To have the program give you some colors and stuff to make the file easier to understand, you can choose the "Language" menu and then "XML". Set this window aside.

Now, open another copy of WinMerge. Do the same as before, but choose the second mod's file as the right side this time. For us, that's "original outfits homies.xtbl".
2013-09-14_01-16-31.png

I have scrolled down to the first difference. Observe, the second mod has changed the <Character> tag to read "npc_Gat" instead of "npc_Gat_sim". So what we're going to do is go to Notepad++ with our "final" file and make the same change. Since the first mod added some lines, the line numbers aren't going to match up, so instead of going to a line number, let's search for some unique text. "npc_Gat_sim" is probably unique, so we'll search for that.
2013-09-14_01-20-02.png

And the result...
2013-09-14_01-20-29.png

That looks like the right spot! Change that to "npc_Gat", and we're done with that difference.
2013-09-14_01-22-10.png


Okay, you know how to handle a difference. Go back to the WinMerge instance for the second mod. Scroll down and do the same process for EACH difference you come across.

What if it adds or removes a line? In this case, that doesn't happen, but let's pretend it did:
2013-09-14_01-24-59.png
Look at that, the file on the right REMOVES one line and ADDS another. We go back to Notepad++ and copy both differences to our "final" file:
2013-09-14_01-27-08.png


Conflicts
What did we need that original WinMerge window for? This is so we can resolve a conflict. A "conflict" is when both mods changed the same part of a file.

Here's an example. Here the vehicle for the "genki_backup" homie has been changed:
2013-09-14_01-33-46.png

So we go over to our "final" file and... we can't find "genki_backup" anywhere. Why not? Take a look at the first mod's WinMerge window:
2013-09-14_01-35-07.png

The first mod deletes that entire homie!

What do we do about it? Well, that depends on your priorities. You have to choose, based on your knowledge of the mods and the changes being made here, which change you want to incorporate into your mod. Sometimes the answer is "both" (if they change different parts of the SAME line), but clearly, in this case, the changes are incompatible.

You'll have to use your head in this case. I happen to know that the New Homies mod removes some homies for a good reason: it's running into the limit. The game can't handle having this many homies. So what we're going to do is keep the difference from the first mod. Since our "final" file was originally a copy of the first mod's file, that means the difference is already incorporated into the final, so we don't have to do anything. We ignore the difference in the second mod's file. That means genki_backup won't have a new vehicle because genki_backup won't exist at all.

If we REALLY wanted to have the SECOND mod's differences in, we'd have to copy the whole genki_backup block from the second mod file into the final file.

Step 6: installation
Once that's all done, make sure you save your "final" file, then you can close Notepad++ and both WinMerge windows.

Delete the other files and rename your final file ("final homies.xtbl", in our case) to the original filename ("homies.xtbl").

Now copy your final file and paste it over the top of the file in your Saints Row 4 folder. Now you don't have any conflicting files!
2013-09-14_01-45-41.png


Step 7: asm_pc files
But wait, there's more!

You're going to need one more step for some mods. They have str2_pc files and thus, necessarily, asm_pc files with them. You see, every str2 file has an associated asm file that tells the game extra information about it. But the asm files contain information about MANY different str2 files, not just one. For example, the cruise control mod with lowered HUD:
2013-09-14_01-57-33.png

Editing the .xtbl file shouldn't cause any problem, but what if you have another mod that changes the same asm_pc file? Here's Customize any vehicle plus wardrobe color changer:
2013-09-14_01-59-26.png

Uh oh. Different str2_pc files, but as you can see, there's a conflict with an asm_pc file.

What you do is extract the files and overwrite the asm_pc file. Next, go back to Minimaul's tools and run "ThomasJepp.SaintsRow.Stream2Update.exe". It will automatically detect your Saints Row 4 folder, analyze the str2_pc situation, and update the asm_pc files for you!
2013-09-14_02-01-12.png

You're done!
 
Last edited:
Funny thing is I have been working without the xml tools the entire time and had no problems.
 
Funny thing is I have been working without the xml tools the entire time and had no problems.
Most of the mods are going to have the xtbl files with the same formatting anyway, the formatting used by the original file. That step is just to make it potentially easier, to spread out every tag onto a separate line so you can see exactly which tags changed, and in case somebody DID change the formatting in their modded file, that gets them into the same style. In many cases it can be skipped without causing a problem.
Pretty print isn't working, any solution?
Since it's just a "safety step", you can try skipping it.
 
Most of the mods are going to have the xtbl files with the same formatting anyway, the formatting used by the original file. That step is just to make it potentially easier, to spread out every tag onto a separate line so you can see exactly which tags changed, and in case somebody DID change the formatting in their modded file, that gets them into the same style. In many cases it can be skipped without causing a problem.

Since it's just a "safety step", you can try skipping it.

I still like the compare tool for Notepad ++ as well.
 
Back
Top