TweakScale

TweakScale

1M Downloads

Extract the Sanity Checks in their own DLL.

Lisias opened this issue ยท 9 comments

commented

I getting some reports with 3rd parties problematic add'ons triggering problems on TweakScale.

Unfortunately not all authors are acknowledging the problems, not to mention fixing them.

So I have no choice but to start to being harsh and programatically removing TweakScale support on them.

In the mean time, there're some other add'ons that are waiting support on the TweakScale Companion Program - and in the mean time, these ones also need to avoid being touched.

So I need to be extra cautious about this stunt, as I can't let the users think that the later cases are equal to the former ones.

Given the potential headache this is going to be, I decided to extract the Sanity Checks from the TweakScale main DLL and shove it on a secondary DLL where eventual mishaps can be easily coped. Additionally, this will allow the Companions to implement their own Sanity Checks, so this is a win-win situation (most of the time).

commented

So, in a nutshell, this issue aims to prevent another drama on the mentioned distribution channel, as happened on

KSP-CKAN/NetKAN#9076

commented

For the sake of completude, people are reaching me on CurseForge to complain about things on CKAN.

https://www.curseforge.com/kerbal/ksp-mods/tweakscale?comment=236

Screen Shot 2022-06-19 at 23 05 34

Frankly, this is far from admissible - CurseForge has no business with CKAN. :(

commented

That's the deal:

  • Creates a new DLL, Scale_Sanitizer
  • All the current checks were extracted into discrete classes on it
  • The absence of the DLL will trigger a nasty message on LOG and Screen, but will allow the game to run.

The message is always logged on KSP.log, "tainting" it:

[LOG 02:43:06.897] [TweakScale]
**********************************************************************
***          THIS TWEAKSCALE INSTALLATION IS UNSUPPORTED           ***
**                                                                  **
**  Scale_Sanitizer, a DLL  TweakScale needs  in  order  to  check  **
**  for   known  problems  and  prevent  disastrous   consequences  **
**  in your rig, was not found.                                     **
**                                                                  **
**  This means that TweakScale can't check if it's safe to run!     **
**                                                                  **
**  Proceed at your own risk. TweakScale's maintainer **WILL NOT**  **
**  accept  bug  reports, neither  will help  diagnosing  problems  **
**  without Scale_Sanitiser present.                                **
***                                                                ***
**********************************************************************

And it's displayed for the user on Main Menu (but only when Module Manager rebuilds the cache - it's probably the only showstopper that will ever do that):

Screen Shot 2022-06-20 at 03 13 17

On the bright side, 3rd parties (as the TweakScale Companion ones!) can now write their own sanity checks and have it used by TweakScale itself, instead of reinventing the wheel (as I did with the TSC for FireSpitter) and risking race conditions with TS!

commented

This darned thing appears to be working fine, but I will release a TweakScake BETA with it first. Just in case.

commented

AW KRAP

I created a hard dependency on Scale.dll when a better solution could be easily applied.

I need to move the new Sanitizer interface into Scale_Redist, but this will break instalments where the 999_Scale_Redist.dll is not updated, so I need to cook a way to TweakScale be able to update itself at user's machine.

commented

this task is blocked by #255

commented

Task was unblocked.

commented

Task implemented on commint 2b6face

Fully tested. The damned stunt works!

commented

I moved the Sanitizer's Interface to Scale_Redist, to 3rd parties (as the Companions!) can implement them without a hard dependency on TweakScale's Assembly.

Since I had to bump up the Scale_Redist's version (and provided features), this stunt will rely heavily on the MMWD's KSP-ModularManagement/ModuleManagerWatchDog#5