Jump to content

AVC Updater


linuxgurugamer

Recommended Posts

@sarbian

Due to some issues in MiniAVC.dll as a result of the Unity upgrade, I've written a mod which will go through and replace all MiniAVC.dll files with a new one with a different name (MiniAVC-v2.dll).

It's working, but now I'm getting a MM error:

Uploading Crash Report
[ModuleManager] The patching thread threw an exception: System.IO.FileNotFoundException: R:\KSP_1.8.0_dev\GameData\KWRocketry\MiniAVC.dll
  at System.Diagnostics.FileVersionInfo.GetVersionInfo (System.String fileName) [0x0000d] in <376e8c39bbab4f1193a569c8dbe4305c>:0 
  at ModuleManager.ModListGenerator.GenerateModList (System.Collections.Generic.IEnumerable`1[T] modsAddedByAssemblies, ModuleManager.Progress.IPatchProgress progress, ModuleManager.Logging.IBasicLogger logger) [0x000a2] in <6cc6df54448a4c2b97e086234872a67b>:0 
  at ModuleManager.MMPatchLoader.Run () [0x000f3] in <6cc6df54448a4c2b97e086234872a67b>:0 
  at ModuleManager.MMPatchRunner+<>c__DisplayClass11_0.<Run>b__1 () [0x00001] in <6cc6df54448a4c2b97e086234872a67b>:0 
  at ModuleManager.Threading.BackgroundTask+<>c__DisplayClass0_0.<Start>g__RunAction|0 () [0x00002] in <6cc6df54448a4c2b97e086234872a67b>:0 

 

I don't know why MM is looking for files like this, but what I'm going to have to do is to put a do-nothing assembly there.  Is there a better thing to do?

Edit:  Apparently just creating a file there works, so at least I can test it

Edited by linuxgurugamer
Link to comment
Share on other sites

2 hours ago, linuxgurugamer said:

I don't know why MM is looking for files like this, but what I'm going to have to do is to put a do-nothing assembly there.  Is there a better thing to do?

Edit:  Apparently just creating a file there works, so at least I can test it

The only reason it actually tries to open the file is to get the file version, which only matters for the assembly debug info that MM puts in the log.  Personally I'd be fine with wrapping this in a conditional for whether the file actually exists.  It'll still show the assembly version and KSPAssembly version even if the file is missing.

Link to comment
Share on other sites

8 hours ago, linuxgurugamer said:

Due to some issues in MiniAVC.dll as a result of the Unity upgrade, I've written a mod which will go through and replace all MiniAVC.dll files with a new one with a different name (MiniAVC-v2.dll).

Would not that cause issues with CKAN installs ? If you rename files, CKAN will not be able to delete those on next mod update or on uninstall of unwanted mod. Might be better idea to check file version and overwrite same file name with newer version. For manual installs should not be issue if user knows what he is doing.

Link to comment
Share on other sites

1 hour ago, kcs123 said:

Would not that cause issues with CKAN installs ? If you rename files, CKAN will not be able to delete those on next mod update or on uninstall of unwanted mod. Might be better idea to check file version and overwrite same file name with newer version. For manual installs should not be issue if user knows what he is doing.

It's a good point. But you have it slightly wrong.

CKAN will happily delete a file that isn't  there the problem is with the new file.  CKAN won't overwrite a file if its already there.  The solution is to have different file names, and have the file distributed in mod file be able to remove the one put there by the updater mod.

Different file names so that it is visually obvious what the  files are

Link to comment
Share on other sites

2 hours ago, linuxgurugamer said:

CKAN will happily delete a file that isn't  there the problem is with the new file.  CKAN won't overwrite a file if its already there.

Nope. Almost all of cases of faulty installs comes becasue CKAN don't delete new files that are made after install with CKAN. For example, if some mod write custom xml or config file with user presets for mod on the first run in game. Such mod is not properly uninstalled, folder with mentioned xml file will remain, leaving (almost) empty folder and only xml file. That messes up further MM patches if user does not manualy delete whole folder. FAR is example that comes from top of my head, but there is quite a lot of other mods with similar behaviour.

Same file overwritting policy is for any other file, including DLL plugin or any other user created file made without CKAN knowladge. You might want to check with @politas or @HebaruSan to confirm or deny this, but AFAIK this was not changed in a long time and CKAN will not delete either, new file or same but renamed file outside of CKAN install process. And there is also possibility that I have missinterprated quoted sentance, since I'm not native english speaker.

If I understand your new mod behaviour, CKAN would know only about " MiniAVC.dll" file trough install. Your mod would delete that file and copy new " MiniAVC-v2.dll" in same folder. CKAN would not be aware of new " MiniAVC-v2.dll" file as it is not caught in CKAN cache file trough install. Better option would be that you delete obsolete " MiniAVC.dll" file and overwrite it with new version, but with same name "MiniAVC.dll".

Sorry for being slightly offtopic, but that new WIP mod might affect a lot of users who rally only on CKAN to do things for them, without knowladge what is going on behind scene. I also understand your desire for such mod, to quickly fix KSP installs by removing obsolete plugin that may do more harm than any good. Just have to consider all options before going public with this new mod.

Link to comment
Share on other sites

I fail to see what you are saying that is different than what I said.

Specifically, if a file was installed by CKAN, and removed, and then CKAN updates or deletes the mod, it won't be bothered by a missing file.

If CKAN tries to install a file which is already there, it will generate an error and revert the changes.

 

So, this is what I'm going to do.  For now, I'll call this new mod the AVCUpdater:

The AVCUpdater will do the following steps:

  1. Find any and all files called MiniAVC.dll.old and delete them (from any previous run)
  2. Find all MiniAVC.dll files
  3. Rename each MiniAVC.dll files to MiniAVC.dll.old (necessary because it can't be deleted in this run on Windows)
  4. Copy a new file:  MiniAVC-v2-Updated.dll to the same directory where the MiniAVC.dll file is

The next release of MiniAVC will be named:  MiniAVC-v2.dll

MiniAVC-v2.dll will be updated to do the following:

  1. Delete any MiniAVC.v2-Updated.dll.old
  2. Rename any MiniAVC-v2-Updated.dll to  MiniAVC.v2-Updated.dll.old

With these two set of changes, there won't be any issue with CKAN because no file will be overwritten, and for anybody who runs the AVCUpdater, any changes it makes to old mods will not impact CKAN

Additionally, ZeroMiniAVC.dll will be updated to delete MiniAVC-v2.dll files as well.

3 hours ago, kcs123 said:

Sorry for being slightly offtopic, but that new WIP mod might affect a lot of users who rally only on CKAN to do things for them, without knowladge what is going on behind scene. I also understand your desire for such mod, to quickly fix KSP installs by removing obsolete plugin that may do more harm than any good. Just have to consider all options before going public with this new mod.

The problem is that the old MiniAVC.dll will cause KSP to crash, either immediately or sometimes in the future.  It's very important to get this fix out, so important that I'm delaying other work to finish this.

And if I don't change the name, there will be no obvious visual that the mod has been updated or not.

Link to comment
Share on other sites

18 hours ago, linuxgurugamer said:

The problem is that the old MiniAVC.dll will cause KSP to crash, either immediately or sometimes in the future.  It's very important to get this fix out, so important that I'm delaying other work to finish this.

I'm aware of this issue and I understand why you are creating this mod in the first place. But, let say that your mod is done with all delete/copy of new files. After that, user might need to update some mod trough CKAN that also have MiniAVC as dependency (old version and name). Let say that in mod folder exist new file version " MiniAVC-v2.dll" becasue CKAN was unable to remove it trough uninstall. After update, you will get again broken "MiniAVC.dll" along with new "MiniAVC-v2.dll".

On the next run old MiniAVC.dll still can create havoc on loading and break things.

So, each mod developer or CKAN staff need to update metadata files to use new version of MiniAVC with new filename to avoid this. There is also issue with mods that don't need update and it will install old MiniAVC version due to old metadata files. In case of manual install there is also possible that older mod will have bundled MiniAVC within archive. Users might also copy older file again without realising it.

In case of just removal of mod trough CKAN, after uninstall there will be leftover of mod with empty folder and only "MiniAVC-v2.dll" in it. That can mess up MM patches on the next run if some other mod use uninstalled mod as dependency. Users need to be warned about this.

19 hours ago, linuxgurugamer said:

Specifically, if a file was installed by CKAN, and removed, and then CKAN updates or deletes the mod, it won't be bothered by a missing file.

It was several verions of CKAN, but IIRC I was having exceptions in CKAN because of missing files. It was long time ago and I may be wrong about it and also that might be fixed in latest CKAN. Therefore was my concerns and warning about it. Just wanted to point out of possible issues, there is no easy way to make all this foolproof for each possible issue that migt arise. Anyhow, I appreciate all your work, not only for this new mod, but also for all other mods that you maintain.

Link to comment
Share on other sites

20 hours ago, linuxgurugamer said:

The problem is that the old MiniAVC.dll will cause KSP to crash, either immediately or sometimes in the future.  It's very important to get this fix out, so important that I'm delaying other work to finish this.

And if I don't change the name, there will be no obvious visual that the mod has been updated or not.

 

1 hour ago, kcs123 said:

 

In case of just removal of mod trough CKAN, after uninstall there will be leftover of mod with empty folder and only "MiniAVC-v2.dll" in it. That can mess up MM patches on the next run if some other mod use uninstalled mod as dependency. Users need to be warned about this.

There's a way out if this, but it will need close cooperation from CKAN guys: hot patches on the CKAN data files to "teach" CKAN about the MiniAVC V2.

CKAN allows Plugins to be added - I don't know the details of this thing, but with a bit of luck, a Plugin can be written allowing you to hot patch the installed Add'Ons metadata that contains MiniAVC V1 to be replaced by MiniAVC V2. You probably would be able to replace V1 by V2 on the Add'On installing too.

Assuming that CKAN Plugin is possible, the AVCUpdater is unneeded for CKAN users.

And non CKAN users has no problem with CKAN, and could use AVC Updater without hassle.

Link to comment
Share on other sites

4 hours ago, kcs123 said:

I'm aware of this issue and I understand why you are creating this mod in the first place. But, let say that your mod is done with all delete/copy of new files. After that, user might need to update some mod trough CKAN that also have MiniAVC as dependency (old version and name). Let say that in mod folder exist new file version " MiniAVC-v2.dll" becasue CKAN was unable to remove it trough uninstall. After update, you will get again broken "MiniAVC.dll" along with new "MiniAVC-v2.dll".

On the next run old MiniAVC.dll still can create havoc on loading and break things.

MiniAVC is not a dependency of anything.  Period.  It is a dll included in mods to check the version file.

And if you follow my logic properly, you will see that there will never be a name collision.  Once the MiniAVC.dll files are gone, this won't do anything, but if somehow an older mod is installed  with the old MiniAVC.dll (quite possible), then this will catch it before it causes a problem.

2 hours ago, Lisias said:

There's a way out if this, but it will need close cooperation from CKAN guys: hot patches on the CKAN data files to "teach" CKAN about the MiniAVC V2.

CKAN allows Plugins to be added - I don't know the details of this thing, but with a bit of luck, a Plugin can be written allowing you to hot patch the installed Add'Ons metadata that contains MiniAVC V1 to be replaced by MiniAVC V2. You probably would be able to replace V1 by V2 on the Add'On installing too.

Assuming that CKAN Plugin is possible, the AVCUpdater is unneeded for CKAN users.

And non CKAN users has no problem with CKAN, and could use AVC Updater without hassle.

It's not needed.   And would just make CKAN that much more problematic to use, because it would then be changing mod files

Link to comment
Share on other sites

Simple solution would be to create a mod that just deletes any avc or mini avc plugins

I seem to remember there was one such mod but the latest versions have dependencies 

Oh well, guess everyone is stuck .... I'll see what I can come up with to nuke the problem from orbit

Exterminatus :wink:

Link to comment
Share on other sites

1 minute ago, DoctorDavinci said:

Simple solution would be to create a mod that just deletes any avc or mini avc plugins

I seem to remember there was one such mod but the latest versions have dependencies 

Oh well, guess everyone is stuck .... I'll see what I can come up with to nuke the problem from orbit

Exterminatus :wink:

Don't bother.  ZeroMiniAVC still works, and doesn't have any dependencies

Link to comment
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.

×
×
  • Create New...