Jump to content
  • 0

ReLinker


Ganda

Question

ReLinker

Hishy had the idea of making a little tool to allow us to merge mods with scripts - it takes the merge maps that are produced when you merge something, grabs all the scripts and LODGen files from you active mod list (BSAs included) and replaces the old plugin name and formIDs with the new plugin name and formIDs.

We all know what a fantastic tool Merge Plugins is. However there are certain mods which cannot be merged due to the use of certain scripting functions which are called on the original plugin name. Functions including GetFormFromFile, GetModByName, checkModPresence, and IsPluginLoaded look for specific .esp names. When you create a merge the original .esp name(s) no longer exists (unless you rename the merged plugin back to one of the original plugin names but this in itself can cause problems including broken MCM menus and is therefore not ideal) and therefore any function call looking for them will no longer trigger. These functions can be called by one of the scripts included in the mod being merged, or by scripts from other mods outside the merge.

A prime example of this is how the 'self-patching' in Legacy of the Dragonborn works by looking for the existence of a whole host of plugin names and activating the various additional displays if the mods are loaded. ReLinker actually came about out of a conversation regarding merging the four BadGremlins treasure hunt mods and patching the LotD activator script to make sure all four displays were still activated.

ReLinker is run outside ModOrganizer and runs on whichever profile you last had open before closing out of MO. It scans your load order looking for merges, and for every merge it finds it reads the contents of plugins and map .txt files and creates a reference list of the original plugin names and the new merged plugin name, along with the original and renumbered FormIDs. It then scans every script in your load order looking for any of those functions mentioned above and editing the scripts to reflect the new plugin names and formIDs. So in the example above once we've merged all four treasure hunts into Treasure Hunts.esp and run ReLinker, the DBM script will now look for Treasure Hunts.esp four times and activate all four displays. Likewise if you were to merge a mod like Sneak Tools whose scripts contain numerous Sneak Tools.esp lookups, ReLinker would then edit all of the Sneak Tools scripts in the merge itself to ensure they now look for the new merged plugin name and renumbered formIDs instead.

ReLinker works on both loose files (if you unpack your BSAs) and on scripts within BSAs. It directly edits the .pex files, doing away with the need to decompile and recompile the scripts which has greatly sped up the process over in the release version.

Instructions:

  1. Make sure you have the profile you want to ReLink active in Mod Organizer and that you have completed and activated all of your merges.
  2. Exit Mod Organizer
  3. Run ReLinker and follow the on screen instructions to specify the required paths.
  4. Check on screen output to ensure ReLinker has completed successfully.
  5. Close the ReLinker window and open Mod Organizer.
  6. Scroll to the bottom of the left pane and locate the new ReLinker Output mod.
  7. Activate ReLinker Output and leave it at the bottom of the left pane to ensure the new ReLinked scripts have priority over the originals.
  8. That's it, there is no 8

If you add/remove/update any mods or create any new merges and want to ReLink again then simply remove the existing ReLinker Output mod completely, exit MO and repeat the process again.

Prerequisites:

  • Mod Organizer - does not work with other managers;
  • Do not remove the merge folder after completing a merge.

Download it here. The tool will ask you for some things and will try to guess them properly. If the values between square brackets are correct, simply press ENTER without inputting any value. The output scripts and LODGen files will be stored in a new mod folder named "ReLinker Output". To revert the changes from this tool simply disable or delete the folder.
 
Good Practices:

  • ReLinker will run with the latest profile used in MO;
  • Close MO before running it.

By default, the following BSA's are ignored to speed up the process and because they don't contain any scripts with the functions that are affected:

  • Skyrim - Misc.bsa
  • Skyrim - Shaders.bsa
  • Skyrim - Textures.bsa
  • Skyrim - Interface.bsa
  • Skyrim - Animations.bsa
  • Skyrim - Meshes.bsa
  • Skyrim - Sounds.bsa
  • Skyrim - Voices.bsa
  • Skyrim - VoicesExtra.bsa
  • Update.bsa
  • Dawnguard.bsa
  • HearthFires.bsa
  • Dragonborn.bsa
  • HighResTexturePack01.bsa
  • HighResTexturePack02.bsa
  • HighResTexturePack03.bsa
  • Unofficial Skyrim Legendary Edition Patch.bsa
  • Falskaar.bsa
  • Wyrmstooth.bsa

If you have specific issues or suggestions post it directly to the this topic. I'm always happy to receive questions and feedback. Happy merging!

 

EDIT: Thanks dunc for the much better description!

Edited by hishutup
  • +1 2
Link to comment
Share on other sites

Recommended Posts

  • 0

So, I'm getting an error running either current release of the relinker (i.e., 32/64-bit). It appears to be unhappy with unicode characters somewhere (looking at the code, it's in a script that it's parsing to add to the string table for remapping).

 

Relinker_Error.png

 

The tool had worked great before. Did a fresh install of Skyrim, and of course added way too many mods (1500 in MO, ~1000 plugins). Only providing this info for context, because I've got no idea which one in my pile is causing the problem, and not being super familiar with python, I don't know what's safe to touch so I can get some more meaningful error output.

Edited by nb097
Link to comment
Share on other sites

  • 0

Mhmm... could you get champollion and decompile all the scripts? Just to check if it's able to, since the encoding I'm using (cp1252) is the one skyrim uses.

 

PS: Do you have Skyrim in a different language by any chance?

Edited by Ganda
Link to comment
Share on other sites

  • 0

Mhmm... could you get champollion and decompile all the scripts? Just to check if it's able to, since the encoding I'm using (cp1252) is the one skyrim uses.

 

PS: Do you have Skyrim in a different language by any chance?

Ran champollion successfully. Hmm... let me try doing a search through powershell on the output directory for the offending character...

 

And yep, my Skyrim is in English, but I have added at least a few armors that were from Chinese sites (I merged all of my armors, about 160), so it wouldn't surprise me at all if those were the issue.

 

Does Relinker ignore disabled mods from Mod Organizer? I assume it does based on its reliance on using the last profile. If so, I'm thinking there's not many (if any) armors that had dependencies on other mods I merged. If relinker does in fact ignore disabled merged mods, I might just be able to deactivate my main armors merge and see if it works.

Link to comment
Share on other sites

  • 0

Yes, relinker ignores disabled mods. If it did work without the armours then it's a chinese characters problem :/ Don't think I can do anything about it though, cp1252 is unfortunately enforced by a lot of scripts.

Link to comment
Share on other sites

  • 0

Yes, relinker ignores disabled mods. If it did work without the armours then it's a chinese characters problem :/ Don't think I can do anything about it though, cp1252 is unfortunately enforced by a lot of scripts.

Well, as it turned out, it wasn't that at all. A mod I'd installed replaced scripts of several other mods to allow better interaction between them, and unfortunately whatever he did to modify said scripts had introduced the error relinker was encountering.

 

Once I removed that, it worked like a charm. Yay! Took about 8 hours to find it, but oh well. I've spent the past three weeks just adding mods and merging after I managed to royally **** my hard drive (I somehow forgot that was why I had to do a fresh install in the first place :/); what's a few more hours enabling and disabling mods trying to find a bad script? :P

Link to comment
Share on other sites

  • 0

Well, as it turned out, it wasn't that at all. A mod I'd installed replaced scripts of several other mods to allow better interaction between them, and unfortunately whatever he did to modify said scripts had introduced the error relinker was encountering.

 

Once I removed that, it worked like a charm. Yay! Took about 8 hours to find it, but oh well. I've spent the past three weeks just adding mods and merging after I managed to royally **** my hard drive (I somehow forgot that was why I had to do a fresh install in the first place :/); what's a few more hours enabling and disabling mods trying to find a bad script? :P

If you were able to pinpoint the script, could you send it to me? I'd love to see what character is breaking relinker

Link to comment
Share on other sites

  • 0

If you were able to pinpoint the script, could you send it to me? I'd love to see what character is breaking relinker

Just so you know that I didn't ignore your request, I did go through his mod and (by changing the extension on each file to pex0 and running relinker for each one I changed) was able to rule out all the scripts he overwrote. And then just moving all of his mod's scripts (not the overwritten ones from other people) out of MO's folder tree allowed relinker to run just fine.

 

So, it's (at least) one of his scripts. Got part of the way through, but I'm not going to be able to finish tonight. I'll continue tomorrow and send you the offender when I find it.

Link to comment
Share on other sites

  • 0

Well, no, this was always meant to be a throwaway script so no debugging :/ At least until someone puts it in :p

 

Can you show me the error? Have you changed something recently?

I've been changing a lot - hence why I need to know the file name it died on. Error is similar to nb097 except it mentioned character 0x81.

 

With no other output I can't tell if I need to reinstall something, remove something, re-merge something or provide you with any more details.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Guidelines, Privacy Policy, and Terms of Use.