Mod Manager 4 introduced support for MixIns. Internally these are known as patches, and they'll be interchanged in this document. MixIns are a quick way to add changes to pcc files through the use of binary patches, and are meant to be easy to use.
MixIns, to the end user, are a way to make a quick modification of a file and add it to the mod with no work. For example, I often use the mod crash test mod for testing. Say I want to add the automatic reactor mixin. I open the MixIn Library in Mod Manager, select the MixIn and the mod, and apply it. The mod now will have an automatic reactor on Reactor Hazard. The convenience of this is key, because it makes modding easy.
ModMaker also supports MixIns. You can select them for mods in the MixIn page from the main editing window. These will be applied during compilation, and can be declined by the user if they don't want them.
MixIns can be stacked on top of each other, as long as a finalizer has not yet been applied. MixIns can stack because they don't change the filesize of a pcc, which means bits are changing, not being added or removed. If the file size changes, a patch for a different size file will trim or expand it, which means data won't be placed in the correct location, and the game will crash. As such, MixIns can only apply to a file with a specified filesize. Finalizers change the size of a pcc, which will cause the pcc to no longer be editable by other MixIns.
Currently MixIns can only be applied to existing mods. There is no way to simply create a modified file or mod directly from a MixIn.
For developers, creating a MixIn is fairly easy. To do so you'll need to understand how to do pcc editing and script editing. MixIns are located locally in the data/mixinlibrary/patches/ folder as well on on ME3Tweaks. After opening the MixIn library, new or updated MixIns will download into the local directory.
MixIns consist of two parts: A patchdesc.ini file, which is very similar to a moddesc.ini file, and a file named patch.jsf. A MixIn can only apply to one file, so if you have to modify multiple files to acheive the desired modification, you'll need to describe them as part of a series.
patchdesc.ini file is located in a patch package folder. For this example we'll use 1 Kick Vote, an existing MixIn. It's patch package is located at data/mixinlibrary/patches/1 Vote Kick/. Inside of this folder is the patchdesc.ini file.
[ModManager] cmmver = 4.0 [PatchInfo] patchname = 1 Vote Kick patchdesc = This patch makes any kickvote instantly boot the voted player - even if a client places the vote. This only works on host. patchdev = FemShep patchver = 1.0 targetmodule = TESTPATCH targetfile = /BIOGame/DLC/DLC_TESTPATCH/CookedPCConsole/Patch_SFXGameInfoMP_Lobby.pcc targetsize = 89722 finalizer = false me3tweaksid = 67
It contains two headers, ModManager, which is the exact same as the ones in moddesc.ini files, and PatchInfo, which describes how to apply the patch file.
|patchname||String/MixIn name in library/ModMaker compiler
1 Vote Kick
|patchdesc||String/Patch Description in MixIn Library/ModMaker
This patch does X...
|patchdev||String/Author in MixIn Library
|patchver||Floating Point/Patch Version (used for updates)
RECKONING, LEVIATHAN, etc
See Mod Manager FAQ for headers
|targetfile||String/Path to file in module
|targetsize||Integer/Size of decompressed file in bytes
|finalizer||Boolean/Indicates if this patch changes the files size
true or false
Used to prioritize non-finalizer patches for batch jobs
|me3tweaksid||ID of the MixIn on ME3Tweaks. You should not assign an existing ID or you may
compile with the wrong MixIn and ruin the file.
The targetsize is important to note. This is the source file size, not the final version size. If the MixIn specifies a different file size than the source one it acquires, it won't be able to be applied. Basegame pcc files (not unpacked or in an SFAR) are compressed by default. Use PCC Repacker in ME3Explorer to decompress the PCC file before you modify it.
A consequence of this is that you must do manual hex editing of a pcc in order to keep the same filesize. Saving a pcc's changes in ME3Explorer will change the filesize and will not work, unless you are okay with it being a finalizer.
I've made a video of hex editing which is fairly easy to do for this, since ME3Explorer provides all the offsets for you.
Patch.jsf is a binary patch files created by the program Jdiff and applied by the program Jptch. These tools are located in the data/tools directory of Mod Manager.
Typically, what I do is move my uncompressed PCC file to this tools folder, and make a copy of it there. One is source, one is the modded file.
Once I've made my modifications (in this example, the - Copy file is the modified one), I'll open a command prompt in this folder. You can do this on Windows 8 and above by going to File > Command Prompt > Open Command Prompt, or shift + right click when no file is selected in the folder and choosing Open Command Window here.
To generate a diff file, you will need to issue the following command:
jdiff -b sourcefile moddedfile > patch.jsf
These two files, patch.jsf and patchdesc.ini, are then put into a folder which is then placed into data/mixinlibrary/patches/. Reloading Mod Manager will load the MixIn which you should now see in your library.
If you have a MixIn you'd like to widely distribute you can contact me and I'll add your MixIn if it meets my criteria. Some MixIns I have created are withheld to prevent abuse in multiplayer, but most MixIns are acceptable.