hypervelocity

How to Re-Compile a Mod for 1.2.2?

Recommended Posts

Hey guys! hope everyone is having a great day today!

I was wondering if there were any tutorials or guides related to re-compiling mods. I had been using a great mod in 1.1.3 that is no longer available for 1.2.2 (ksp version I'm using). The mod owner kindly offered the source code for me to re-compile it for 1.2.2, but I am clueless on how to do it - however I would love to learn!

Any tips or directions on how to start my way into doing the aforementioned?

Many thanks in advance! :D

Share this post


Link to post
Share on other sites

First you need to set up the tools for compiling a mod. The intro thread summarizes this well in its "IDE setup" section:

I recommend compiling for 1.1.3 first if this is your first rodeo, as a sort of "dry run". That way you know that it should compile without changes, and you can assume that any problems you encounter are due to how you have your compiler set up. The main gotcha in compiling a newly downloaded mod is how to handle its references to the KSP DLLs. Every mod needs such references, but every mod does it differently; some encode full absolute paths to the author's Steam library in the csproj file, some expect you to copy the DLLs into the mod's folder, etc. I haven't found a generalized method for solving this other than reading the csproj file to see where the HintPath of the UnityEngine reference points. It's also possible for a mod to have references to other mods, which complicates things somewhat but generally works the same way.

Then once you're confident that your tools are working, you can switch those references to 1.2.2, attempt a fresh compile, and be sure that all the new problems are due to changes in 1.2.2. Typically you will need to make changes to the mod's C# code at this point, so if you're not comfortable with that, you'll need to get comfortable. The changes are necessitated by changes that SQUAD made to KSP between those versions, for example they might delete or rename a function that the mod was using, in which case you need to find or create a replacement for that function. Some mods also include their own explicit version locking, which you would also need to update if this mod has that.

Finally you'll need to generate a package that you (or other players, if you're planning to publish your changes) can install in GameData. Typically the skeleton of the mod's GameData folder is included in the source package, and you just need to copy the DLL or DLLs to the right subfolder, then copy the mod folder to GameData.

You can see an example of the changes needed to update a mod from 1.2.2 to 1.3.0 here:

https://github.com/Starwaster/ProceduralParts/pull/9/files

Share this post


Link to post
Share on other sites

I recompile 1.3 mods for 1.2.2 regularly.

The first thing you should do is comment out any errors, 

If you are lucky, then it should compile and work under 1.2.2,  although any localised strings might not work at all,  So edit anything that doesn't work with some psuedo strings. 

For compiling 1.0.3 to 1.2.2 most will work if you reference the correct dlls in your project, there are some changes in the api, so you will have to make a best guess at the extra values that you need to provide. 

The big problem is parts, I don't have the correct stuff or the knowledge to convert a part in one format to another format. 

Hth

GEH

 

Edited by genericeventhandler

Share this post


Link to post
Share on other sites
This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.