Jump to content

[TOOL]Mods Patch Generate & Apply


MMaster

Recommended Posts

Hi,

 

I want to share with you 2 windows batch scripts I've made to make mod management a bit easier.

 

First one is used to generate diff files for Avorion mods that can be later used to easily patch the game after game update without overwriting whole files.

 

Second one is used to patch the game from the generated diff files.

 

NOTE: This currently works only for scripts mods that modify only files in data\scripts directory (afaik the only mods currently available).

 

This can theoretically be also used when multiple mods modify the same file, but I did not try it and it may require some tweaking and conflicts need to be resolved by user.

 

It is not at all sanitized and you can mess things up if you don't know what you are doing so take care! Always backup everything, I'm not responsible for damage this may cause. I just share what I've made for myself.

 

Package uses GNU diff and patch utilities from:

http://gnuwin32.sourceforge.net/packages/diffutils.htm

http://gnuwin32.sourceforge.net/packages/patch.htm

 

These utilities are already packaged inside. If you don't want to use them you don't need to. Just delete the _diffAndPatch directory and recreate it yourself by downloading the packages from the URLs above.

 

HOW TO USE:

1. extract the package to directory of your choice (not the game dir!)

2. go to AvorionMods directory you extracted

3. create one directory for each mod you want to use

for example I create:

shipyard-sethome

MiningSystem

4. in each mod directory create following directory: data/scripts/

example directory tree:

AvorionMods/

- shipyard-sethome/

  - data/

    - scripts/

- MiningSystem/

  - data/

    - scripts/

- _diffAndPatch/

- generatediffs.bat

- patchgame.bat

 

5. As you can see you are recreating game directory structure for each mod. Now that you have prepared basic structure you need to copy files from mods to their respective directories to the same place where you would normally put them in game directory.

for example:

copy shipyard.lua from shipyard mod to

shipyard-sethome/data/scripts/entity/merchants/shipyard.lua

copy miningsystem.lua from miningsystem mod to

MiningSystem/data/scripts/systems/miningsystem.lua

 

6. Make sure that your game is not modded before generating diff files

You can clean your game by deleting data\scripts directory from your game directory and in steam you:

right click your game - properties - local files - verify integrity of game files

This will automatically download fresh copies of your deleted files.

 

7. Edit generatediffs.bat and patchgame.bat with your favorite text editor

Change MODS_DIR to your AvorionMods directory

Change AVORION_PATH to your game directory

 

Make sure that you modified both generatediffs.bat and patchgame.bat

 

8. Run generatediffs.bat

This will generate patch.diff in each mod directory if it was not generated yet

 

9. Run patchgame.bat

This will patch the game using patch.diff files from mod directories

 

10. If the game was updated:

run patchgame.bat again and unless some conflicting changes were made it should work

(if you already had some files patched which were not changed by game update this may result in confusing results for non-technical user and I suggest you clean your game dir as described in step 6 before patching it)

 

11. If the mod was updated:

update the files in mod directory

delete the patch.diff file of the mod

make sure your game is not modded (make it fresh using step 6)

run generatediffs.bat

run patchgame.bat

 

12. Enjoy

 

DOWNLOAD:

http://www.mediafire.com/file/fneoull0roo89xm/AvorionMods.zip

 

Please feel free to use this in any projects you have, improve it, do whatever you want to do with it. I will be happy if you credit me but it's not required.

 

While this batch script is for Windows if you are Linux person I'm sure you can easily make similar shell script and on Linux you already have diff and patch utilities available for it.

 

-MMaster

 

Link to comment
Share on other sites

I'm sorry it doesn't work for you. I'm not sure where you could have made a mistake / what doesn't work.

It definitely worked for me. All mods survived game update and were successfully applied even tho shipyard.lua was changed in game. I would have helped you get it working, but I'm not even sure what went wrong since 'this doesn't work' doesn't give me any hints what went wrong.

 

What is your directory structure? Did it generate patch.diffs in directories? What was the output of generatediffs.bat and what was the output of patchgame.bat? Also how technically skilled are you? Do you know what 'diff' and 'patch' is?

Link to comment
Share on other sites

This looks terrific!!  :o

 

I've been collecting a bunch of resources on setting up & managing your own personal dedicated server.  Was just starting to get into Mod management :)  Thanks for all the hard work on this!!

 

I'm working in a linux environment so I'll post back with any updates.

 

 

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
×
×
  • Create New...