Jump to content


Photo

ReLinker


  • Please log in to reply
135 replies to this topic

#1 Ganda

Ganda

    Thane

  • Mod Authors
  • PipPipPipPipPipPip
  • 375 posts

Posted 15 August 2016 - 10:09 PM

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, 20 February 2017 - 07:14 AM.

  • 2

#2 Nebulous112

Nebulous112

    Dragonborn

  • Super Moderators
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 1,291 posts

Posted 15 August 2016 - 10:14 PM

Nice. I assume this was the tool Hishy was mentioning in the SR:LE Extended LotD thread? So for example, you could merge multiple mods that LotD looks for with specific FormIDs, and it would substitute the old FormIDs required in LotD for the new ones based on the merge maps?

Am I understanding correctly? If so, this tool sounds amazing.

#3 Ganda

Ganda

    Thane

  • Mod Authors
  • PipPipPipPipPipPip
  • 375 posts

Posted 15 August 2016 - 10:19 PM

For scripts and LODGen files, yes I believe so. The idea was hishy's, I simply built this on his instructions :p Hiiisshyyyyyyyyy!


  • 0

#4 hishutup

hishutup

    Daedric Prince

  • Super Moderators
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 2,553 posts

Posted 15 August 2016 - 10:23 PM

Nice. I assume this was the tool Hishy was mentioning in the SR:LE Extended LotD thread? So for example, you could merge multiple mods that LotD looks for with specific FormIDs, and it would substitute the old FormIDs required in LotD for the new ones based on the merge maps?

Am I understanding correctly? If so, this tool sounds amazing.

Yes, it was in a sense, but this is MUCH better.

Try it out by merging the Treasures section in SRLE-LotD.

 

As for the process

It searches in every script for a function, if it matches, it'll replace the filename and formid to "relink" with the new merged plugin. If the formid is the same just the filename is changed.



#5 Nebulous112

Nebulous112

    Dragonborn

  • Super Moderators
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 1,291 posts

Posted 15 August 2016 - 10:54 PM

Simply awesome. You guys need to promote this on Reddit. It sounds phenomenal.

Edit: You should also mention folks will need DY's Papyrus Compiler patch for MO.

#6 Ganda

Ganda

    Thane

  • Mod Authors
  • PipPipPipPipPipPip
  • 375 posts

Posted 15 August 2016 - 10:59 PM

Why the papyrus compiler patch?
  • 0

#7 Nebulous112

Nebulous112

    Dragonborn

  • Super Moderators
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 1,291 posts

Posted 15 August 2016 - 11:02 PM

I'm just assuming, I haven't tried the tool yet. You mention the Papyrus Compiler is needed, and that it only works with MO. The only way the Papyrus Compiler works in MO on x64 systems is with the Papyrus Compiler patch, AFAIK. Due to the fact that MO is 32-bit. http://www.nexusmods...im/mods/65578/?

#8 Ganda

Ganda

    Thane

  • Mod Authors
  • PipPipPipPipPipPip
  • 375 posts

Posted 15 August 2016 - 11:04 PM

Oh, you don't need to run this from MO and even then I don't think that is needed. Feel free to test and tell me what happened :p
  • 0

#9 Nebulous112

Nebulous112

    Dragonborn

  • Super Moderators
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 1,291 posts

Posted 15 August 2016 - 11:07 PM

Ah, makes sense. I assumed it had to be run from MO. :-P

#10 dunc001

dunc001

    Thane

  • Members
  • PipPipPipPipPipPip
  • 434 posts

Posted 16 August 2016 - 03:24 AM

I can confirm it works perfectly :)  Tested with the treasure hunts merge and ReLinker found and edited the correct DBM scripts, displays all showing correctly. Excellent work Ganda and Hishutup.

 

Some basics just to confirm:

 

1. Best to run outside of ModOrganizer with MO closed.

2. ReLinker will run on the last profile open within MO before closing.

3. Once complete when you then relaunch MO ReLinker Scripts will appear in the left pane as a new mod - enable it and leave it at the bottom of the left pane to ensure it overwrites the original scripts.

4. Profit :D

 

Note - If you have several profiles you need to run ReLinker on each one - Open MO, rename ReLinker Scripts mod in first profile to something unique (for example 'Relinker Scripts <Profile Name>') switch profile, close MO, run ReLinker, repeat as required.


Edited by dunc001, 16 August 2016 - 03:31 AM.

  • 0

#11 TeflonBilly

TeflonBilly

    Prisoner

  • Members
  • 9 posts

Posted 16 August 2016 - 09:02 AM

How is this tool different than Mator's MergePlugins Standalone?


Edited by TeflonBilly, 16 August 2016 - 09:03 AM.

  • 0

#12 Ganda

Ganda

    Thane

  • Mod Authors
  • PipPipPipPipPipPip
  • 375 posts

Posted 16 August 2016 - 09:20 AM

How is this tool different than Mator's MergePlugins Standalone?

In a nutshell, this "finishes" the merge by merging what MergePlugins can't merge (the scripts and LODGen)

 

EDIT: As I said before, I made this on hishy's instructions. See this post.


Edited by Ganda, 16 August 2016 - 11:47 AM.

  • 0

#13 TechAngel85

TechAngel85

    Akatosh

  • Administrators
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 11,279 posts

Posted 16 August 2016 - 09:54 AM

Simply awesome. You guys need to promote this on Reddit. It sounds phenomenal.

Edit: You should also mention folks will need DY's Papyrus Compiler patch for MO.

Why the papyrus compiler patch?

The patch is only needed for compiling when running the CK through MO. Else the compiler in the CK will fail. It's not likely needed in any other situations such as this.

 

In a nutshell, this "finishes" the merge by merging what MergePlugins can't merge (the scripts and LODGen)

I kinda see this being absorbed into Mator's tool since that is just local. Would you be okay if he added this into Mator Smash? Though I don't think he's worked on that tool in a long time. Not since he started his website project.



#14 Ganda

Ganda

    Thane

  • Mod Authors
  • PipPipPipPipPipPip
  • 375 posts

Posted 16 August 2016 - 10:00 AM

I kinda see this being absorbed into Mator's tool since that is just local. Would you be okay if he added this into Mator Smash? Though I don't think he's worked on that tool in a long time. Not since he started his website project.


Why not? :p If he needs to I can make proper api/terminal options but that can be arranged later.
  • 0

#15 TeflonBilly

TeflonBilly

    Prisoner

  • Members
  • 9 posts

Posted 16 August 2016 - 11:34 AM

When you say "scripts" that MergePlugins doesn't handle, do you mean scripts that use the GetFromForm and/or GetFromFile functions (the functions that hardcode the ESP/ESM filename into the script)?

If so, that is awesome, because that is the last piece that Mator's MergePlugins standalone doesn't handle (since he added script fragment handling).


  • 0


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users