Jump to content

Question

Posted (edited)

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

Recommended Posts

  • 0
Posted

I am having a strange problem when I run Relinker, after pressing <Enter> for MO's mods folder path, this comes up:

 

Alright, let's get started.

 

First, search the Mods folder for merged plugins.

   File "<string>", line244, in <module>

 

<class 'OSError'>: [Errno 22] Invalid argument: 'D:\\The Elder Scrolls\\Skyrim\\Mod Organizer\\profiles\\"Skyrim SRLE; Legacy of the Dragonborn"\\modlist.txt'

Press Enter to exit...

 

The path for is correct.  When I launch TESEdit, LOOT, WryeBash, or Merge Plugins Standalone from Mod Organizer, they have my load order (which relies on modlist.txt) correct.  All those apps work fine too!  A google search of "class 'OSError'>: [Errno 22] Invalid argument:" turns up results relating to Python.  What could be the issue?

  • 0
Posted

I am having a strange problem when I run Relinker, after pressing for MO's mods folder path, this comes up:

 

Alright, let's get started.

 

First, search the Mods folder for merged plugins.

   File "", line244, in

 

: [Errno 22] Invalid argument: 'D:\\The Elder Scrolls\\Skyrim\\Mod Organizer\\profiles\\"Skyrim SRLE; Legacy of the Dragonborn"\\modlist.txt'

Press Enter to exit...

 

The path for is correct.  When I launch TESEdit, LOOT, WryeBash, or Merge Plugins Standalone from Mod Organizer, they have my load order (which relies on modlist.txt) correct.  All those apps work fine too!  A google search of "class 'OSError'>: [Errno 22] Invalid argument:" turns up results relating to Python.  What could be the issue?

which version you running cos version 44 has issue that why we now recommend version 40 for SRLE Extended LOTD

  • 0
Posted

Hello all!

 

Having a problem with Relinker, probably user error, but please help me! I deleted all of Skyrim, got rid of everything and did a full reinstall. Now, Relinker won't acknowledge the folder that I'm running Mod Organizer out of. https://imgur.com/9wSj8Xa, https://imgur.com/x6DMu2I.

 

I have run it as admin. And I have also moved the entire MO folder onto the desktop. Still the same response. I was able to delete the log folder and now all it says is "Settings file does not exist or is broken"

  • 0
Posted

I was having a problem with the last version of Relinker, something about "relinker unicodedecodeerror" and "0x81", after change to version 40, I can confirm the software ran completed and without issues, thank you DarkladyLexy, as usual you rock, :)

  • 0
Posted

Does Relinker support non english Skyrim?

 

I have "unicod decoder error" with non english install (game and mods with russian translate) of SRLE LOTD REQTIFIED with version 40 and version 30 of Relinker. Only version 44 goes fine through the whole process but game ctd on startup. Also i have exact same install on english version of Skyrim with all mods on english, and Relinker works fine (v40). 

I think i will just copy relinker output files from english game install to russian and see what will happen.

  • 0
Posted

Well, I took a break, lets see how long I hang around...
 
Ok first lets see what is going on with this stupid thing.

I am having a strange problem when I run Relinker, after pressing <Enter> for MO's mods folder path, this comes up:
 
Alright, let's get started.
 
First, search the Mods folder for merged plugins.
   File "<string>", line244, in <module>
 
<class 'OSError'>: [Errno 22] Invalid argument: 'D:\\The Elder Scrolls\\Skyrim\\Mod Organizer\\profiles\\"Skyrim SRLE; Legacy of the Dragonborn"\\modlist.txt'
Press Enter to exit...
 
The path for is correct.  When I launch TESEdit, LOOT, WryeBash, or Merge Plugins Standalone from Mod Organizer, they have my load order (which relies on modlist.txt) correct.  All those apps work fine too!  A google search of "class 'OSError'>: [Errno 22] Invalid argument:" turns up results relating to Python.  What could be the issue?

Yes, the python results are appropriate since this "application" is a wrapper for a python script. Taking a first look and I see a semicolon in the name, is that supposed to be there?
 
As for minty lightning mod, who ever wrote the script used some char codes that don't exist in the encoding that skyrim uses or UTF-8.
I don't even know what to do about it and I don't have the running knowledge on how to go about fixing it.
 

Does Relinker support non english Skyrim?
 
I have "unicod decoder error" with non english install (game and mods with russian translate) of SRLE LOTD REQTIFIED with version 40 and version 30 of Relinker. Only version 44 goes fine through the whole process but game ctd on startup. Also i have exact same install on english version of Skyrim with all mods on english, and Relinker works fine (v40). 
I think i will just copy relinker output files from english game install to russian and see what will happen.

File IO is a pain, I remember ganda spending too much time on this.
I don't know what russian languages change. 
 
EDIT: So, Ganda deleted the github way back when and now I dont have the history or what he changed from v40->v44. If my memory serves correctly, I believe he was just trying to mess with system encodings. I believe, I know what is wrong with the minty script but I need to develop a testing environment.
 
EDIT2: If someone knows a way to extend this to non-vfs systems, let me know, I may be interesting in extending it. 
Here is the current process:

    Looks for merge maps in MO's mod list (by priority),
    processes these maps into dictionaries,
    extracts all active bsa's into a temporary directory,
    copies all loose scripts into that directory, override files from the bsa's,
    decompiles any compiled scripts (.pex),
    uses the merge maps to replace original plugin references (both plugin name and formids) with new references from the merge,
    recompiles the scripts and
    copies them to a new mod folder in MO, "Relinker Scripts".

I will say, the current method does not account for every combination of the formid lookup. Some authors include their own function which breaks this "patching."
I believe chesko was one of them, if I remember correctly it was to account for SKSE/non-SKSE.
Example 1

Good thing, its in the list 

function_to_modify_list = ["GetModByName", "checkModPresence", "GetFormFromFile", "IsPluginLoaded"]
  • 0
Posted (edited)

Seem to have hit an odd snag running Relinker 40. When it reaches the point where it extracts BSA's and copies loose files it seems to hang at 50% seemingly forever.

Oop. Nevermind. Increasing the priority of the program sped up the process and it carried on.

Edited by hazelwolf
  • 0
Posted (edited)

Welp. Seems like I'm hitting the same snag as others. The ol' "Class 'ValueError'>: invalid literal for int<> with base 16: b''

I've done the process of removing the merges to determine if any are broken but it seems every one throws up that error.

Edited by hazelwolf
  • 0
Posted
I'm having an apparent divide by zero error right out the gate after pointing ReLinker to my Mod Organizer / Mods folders; this occurs with both version 40 and 44 and I'm clueless as to how I might rectify it.  

 

Alright, let's get started.

 

First, search the Mods folder for merged plugins.

              Mod list parsed: [##################################################] 100.0% Done

  File "<string>", line 237, in <module>

  File "<string>", line 104, in printProgress

 

<class 'ZeroDivisionError'>: float division by zero

  • 0
Posted (edited)

ANother first time user - error as follows:

I need to know Mod Organizer's root folder [c:\skyrim tools\modorganizer2]
---> c:\Skyrim Tools\ModOrganizer2
I need to know Mod Organizer's Mods folder [c:\users\shadr\appdata\local\modorganizer\skyrimse\mods]
--->

Alright, let's get started.

First, search the Mods folder for merged plugins.
  File "<string>", line 222, in <module>
  File "configparser.py", line 778, in get
  File "configparser.py", line 1138, in _unify_values

<class 'configparser.NoSectionError'>: No section: 'General'

Get a 'Press Enter to exit' at that point. Verified paths are correct for both my MO2 install and Mods. Request a bit o help. v40.

 

EDIT: Problem found - for those who keep thier profiles in a different place than the main MO2 install, direct it to where the profile can be found, and all is well.

Edited by Shadriss
  • 0
Posted (edited)

i have some trouble with relinker and Mo2, it works fine with mo1 but with mo2 i get this error message

gAEIDlL.jpg

 

but my mods folde look likes this:

gzdijat.jpg

So doesn't Mo2 work together with relinker? must i fall back to mo1 to use this program ?

Edited by nerd_light

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.