ThibautSF / ParadoxosModManager

Software to manage mods for recent Paradox games
37 stars 6 forks source link

Conflicts warnings #18

Closed NicolasGrosjean closed 6 years ago

NicolasGrosjean commented 6 years ago

Someone asked again about a conflict determination feature.

I have seen that you have already talked about. Now with plenty of mods in the workshop it can be very interesting feature.

A warning when 2 mods modify the same file can be a first good iteration.

NicolasGrosjean commented 6 years ago

We have now for each Mod object a Set of modified Files.

So if 2 mods modify same files we can indicate that there is a potential conflict.

NicolasGrosjean commented 6 years ago

The conflict doesn't work on compressed mods, because the Java API doesn't support the compression method used by Steam ... https://stackoverflow.com/questions/24368236/how-to-determine-the-compression-method-of-a-zip-file

When using the code from Stackoverflow, I can see that the problematic file is descriptor.mod I will write again my code using this code to not try to unzip the .mod file

NicolasGrosjean commented 6 years ago

Now I have performance issues. Computing the list of the modified files of all the mods is relatively expensive.

The problem is that the application does it at each Windows focus ! image

I don't know what is the goal of this updateList.

There are also some useless Mod creation like when creating ListCreator. The mod objects need to be created once.

NicolasGrosjean commented 6 years ago

I have done the refactoring, now the Mod constructor is only called in ListManager#loadModFilesArray

NicolasGrosjean commented 6 years ago

Things to improve :

ThibautSF commented 6 years ago

Ok, i saw conflict loading is very heavy... (up to 1min for my 178 installed mod on Stellaris)

So i agree we need a ProgressBar. It can be shown in a loader window (usefull for the first loading). This should be interesting : http://blog.carl.pro/2016/05/modal-jaxafx-progress-indicator-running-in-background/ (and maybe also for the app updater)

Another solution (maybe) :

Bugs & improvements : image I've got 2 conflicts : "(-NSC2 Addon: Unlimited Supercapitals-)" and "(-NSC2 Season 1 - Episode 3 - v1.3-)". If i remove one mod, the other stay in orange. The new color also reveal a coloration bug after list scroll (orange become green again) Just need those little modifications of this old code : image

I don't think ExpandableContent is useful since user will always expand image Just put setContent(expContent) instead of setExpandableContent(expContent) (line 643)

ThibautSF commented 6 years ago

Seriously ! Even "fixed" close issue !

Ok... {close, closes, closed, fix, fixes, fixed, resolve, resolves, resolved} So now i will use "solve"/"solved"

ThibautSF commented 6 years ago
2018-03-28 13:55:41 : type ERROR MESSAGE
Unable to unzip /home/tsimonfine/.local/share/Paradox Interactive/Stellaris/workshop/content/281990/1219685453/hivefocus.zip

If a zip file is missing it make the app crash.

EDIT: image Error generated also if file is here, it's two mods i download from a website... java.util.zip.ZipException: invalid compression method again.

One of the test file : '.mod' goes in 'mod/' and '1219685453' goes in 'workshop/content/281990/' 1219685453_Collective_Focus_for_Hive_and_Machine_Empires.zip

ThibautSF commented 6 years ago

I work on the "loader window" from http://blog.carl.pro/2016/05/modal-jaxafx-progress-indicator-running-in-background/ Functional version (but i don't think it's stable/optimal for now).

Very low battery so i push my progression (add some 'TODO' tag) Need tests, if unstable comment/uncomment 'newloadModFilesArray()'/'loadModFilesArray()'

EDIT : image

NicolasGrosjean commented 6 years ago

Solution to performance issue

Yes by default we need to NOT compute the conflicts. I was thinking about a checkbox to enable it when selecting the game, but an action to compute conflicts seems better because you can update.

Bugs

Thanks for fixing my bug, I have bad insert my code in your for the coloration, and I have done a bad copy-paste for the Dialog

If a zip file is missing it make the app crash.

I will fix it, I have the stack trace java.lang.NullPointerException at mod.Mod.addModifiedFiles(Mod.java:189) at mod.Mod.setModifiedFiles(Mod.java:136) at mod.Mod.<init>(Mod.java:70) at mod.Mod.<init>(Mod.java:41) at tests.TestMod.modifiedFilestest(TestMod.java:47)

Error generated also if file is here, it's two mods i download from a website...

Is the ZIP incorrect ? I will catch the exception.

NicolasGrosjean commented 6 years ago

Functional version (but i don't think it's stable/optimal for now).

I have a NPE : java.lang.NullPointerException at mod.ModList.computeConflicts(ModList.java:203) at mod.ModList.(ModList.java:37) at settings.MyXML.getSavedList(MyXML.java:154) at application.ListManager.updateList(ListManager.java:481)

I can continue to develop despite it

ThibautSF commented 6 years ago

Still working on wait window :) image

Don't know where we can put WorkIndicatorDialog ... maybe a "dialog" package...

NicolasGrosjean commented 6 years ago

Don't know where we can put WorkIndicatorDialog ... maybe a "dialog" package...

In a dialog package with BasicDialog seems a good idea

java.util.zip.ZipException: invalid compression method

I have it on each zip file ... Java didn't support the compression of the .mod file which is in each zip directory. I will check if some files are missing or not

NicolasGrosjean commented 6 years ago

No modified files are missing because the directories are browse deeply and the mod file is in root.

ThibautSF commented 6 years ago

Forgot to put the # in the last commit...

NicolasGrosjean commented 6 years ago

I see that I have done a commit with message "Fix NPE #18" and the issue hasn't been closed.

ThibautSF commented 6 years ago

I'm a bit jealous...

NicolasGrosjean commented 6 years ago

In fact if you put some words between fix (and other synonymous) and the issue number, it don't close the issue

ThibautSF commented 6 years ago

I add some opacity (i have a problem with the size, the upper window is a bit bigger) image

ThibautSF commented 6 years ago

Due to window decoration i use scene width and height... Maybe i can remove a fixed margin... image

ThibautSF commented 6 years ago

The option image

This option is stored in the ModManager.APP_PARAMS Map<String,String>, with key DetectConflict.

if(ModManager.APP_PARAMS.containsKey("DetectConflict")){
    if(ModManager.APP_PARAMS.get("DetectConflict").equals("true"))
        //Do conflict stuff
}

The text in the loading window screen already implements the code. So you can put the test where you want.

NicolasGrosjean commented 6 years ago

I have enclosed it in a static method it is more readable.

I have noticed that when saving I remove some useless import. I advise you to use this Eclipse preference to remove useless imports and so reduce the Jar size. image

When you need to import one class, you can do Ctrl+Shift+O.

I have discovered these tricks recently

ThibautSF commented 6 years ago

It's good for me.

NicolasGrosjean commented 6 years ago

Ok, I will test this evening and like you have said in another issue, we can create a new version.

NicolasGrosjean commented 6 years ago

Bugs :

The bug source is this modification of ListCreator : image

ThibautSF commented 6 years ago

I remove other list.removeMod() and list.addMod(), so I need to replace them.

NicolasGrosjean commented 6 years ago

Thanks.

Bug in the conflict display between CK2 mods WtWSMS and BLG : image

ThibautSF commented 6 years ago

Yeah it's caused by the auto wrap, because the line contains one "word" : the path "\tPATH" so the textarea wrap :

\t
PATH
NicolasGrosjean commented 6 years ago

You agree the word is too long so textArea has wrapped it.

So I will set wrapping to false (another bad copy-paste)

ThibautSF commented 6 years ago

From : https://forum.paradoxplaza.com/forum/index.php?threads/tool-paradoxos-mod-manager.1001303/page-3#post-24039672

What I noticed is that many conflicts stem from the fact that many mods have a 'changelog.txt', 'description.txt', 'readme.txt' or some other generic file in them which are named the same but should not impact gameplay (afaik). Would it be able to add a whitelist for file names which are excluded from the conflict check?

Maybe files in the mod's root directory can be skiped ?

NicolasGrosjean commented 6 years ago

Thanks you for the copy paste, I have not access to the Stellaris forum.

I have also observed this phenomenon after the release on mods done by the same person but I have conclude it should be rare. Or I simply wait that somebody report this.

Like you, my idea to counter this was to filter files in the root directory. I will implement this.

NicolasGrosjean commented 6 years ago

I close this issue like the development is delivered in 0.6.0.