Skip to content

Conversation

@originalfoo
Copy link
Member

@originalfoo originalfoo commented Jul 1, 2019

Thanks to @kvakvs for spotting the issue
Thanks to @dymanoid for idea to use ManifestModule.ModuleVersionId

Mod performing the check gets its own Guid from:

 Assembly.GetExecutingAssembly().ManifestModule.ModuleVersionId

When checking local mods (which only happens when a build is using RELEASE or RELEASE LABS), the Guid of the mod being inspected is determined by:

        public Guid GetModVerId(PluginInfo plugin)
        {
            return plugin.userModInstance.GetType().Assembly.ManifestModule.ModuleVersionId;
        }

If the two Guid values match, the local (offline) build is skipped by the compatibility checker, this preventing local RELEASE or RELEASE LABS from flagging themselves as duplicate.

Not currently working.

Idea is to have some unique value on the TrafficManagerMod : IUserMod (currently a static int Build, but could be on the instance instead) and pass that in to the mod checker so it can filter out "self" when scanning for offline mods.

@originalfoo originalfoo changed the title Attempting to exclude self from offline TMPE mod check Exclude self from offline TMPE mod check Jul 1, 2019
@originalfoo originalfoo marked this pull request as ready for review July 1, 2019 21:30
originalfoo added a commit that referenced this pull request Jul 1, 2019
@originalfoo originalfoo added technical Tasks that need to be performed in order to improve quality and maintainability Usability Make mod easier to use labels Jul 1, 2019
@originalfoo originalfoo added this to the 10.21 milestone Jul 1, 2019
@originalfoo originalfoo self-assigned this Jul 1, 2019
@originalfoo originalfoo requested a review from krzychu124 July 1, 2019 21:53
@originalfoo
Copy link
Member Author

Example content of TMPE.log:

[Info] @ 185124035 incompatible_mods.txt contains 46 entries
[Info] @ 185181493 Scanning for incompatible mods; Self GUID = ebe5de81-6b78-482b-859b-8e2a0181ba90
[Info] @ 185204304 Skipping local TM:PE with GUID 'ebe5de81-6b78-482b-859b-8e2a0181ba90' in 'C:\Users\aubergine\AppData\Local\Colossal Order\Cities_Skylines\Addons\Mods\TrafficManager'
[Info] @ 185219441 Local TM:PE detected: 'TM:PE 10.20 LABS' in 'C:\Users\aubergine\AppData\Local\Colossal Order\Cities_Skylines\Addons\Mods\TrafficManagerOld'
[Info] @ 185249570 Scan complete: 1 incompatible mod(s) found

Copy link
Member

@krzychu124 krzychu124 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, LGTM 👍

@originalfoo
Copy link
Member Author

I might make a couple more tweaks to the logging, don't merge yet

@originalfoo originalfoo added the DO NOT MERGE YET Don't merge this PR, even if approved, until further notice label Jul 1, 2019
Updated logging, TM:PE detection, also output GUID when mod enables
@originalfoo originalfoo removed the DO NOT MERGE YET Don't merge this PR, even if approved, until further notice label Jul 1, 2019
@originalfoo
Copy link
Member Author

It can now detect any other version of TM:PE, whether online or offline, even versions it's never seen before (like my test build for PR #333).

image

Log file looks like:

[Info] @ 192217044 TrafficManager.Resources.incompatible_mods.txt contains 46 entries
[Info] @ 192249006 Scanning for incompatible mods; My GUID = 5d6986e0-0c74-4629-b602-ad9e5ffbb3da
[Info] @ 192272061 Found myself: 'TM:PE 10.20 LABS' (Workshop ID: LOCAL, GUID: 5d6986e0-0c74-4629-b602-ad9e5ffbb3da) in 'C:\Users\aubergine\AppData\Local\Colossal Order\Cities_Skylines\Addons\Mods\TrafficManager'
[Info] @ 192304510 Detected conflicting 'TM:PE 10.20 LABS' (Workshop ID: LOCAL, GUID: 45bba401-0fd5-4b66-9548-c720294182bc) in 'C:\Users\aubergine\AppData\Local\Colossal Order\Cities_Skylines\Addons\Mods\TrafficManagerOld'
[Info] @ 192321845 Detected conflicting 'TM:PE 10.20 LABS' (Workshop ID: 1781170897, GUID: 61cf1dac-7965-4ec2-b2e2-28f093ab742c) in 'C:\Program Files (x86)\Steam\steamapps\workshop\content\255710\1781170897'
[Info] @ 192335649 Detected conflicting 'TM:PE 10.20' (Workshop ID: 583429740, GUID: 2a3f5abb-c4b4-499a-bcf3-0c9b056df384) in 'C:\Program Files (x86)\Steam\steamapps\workshop\content\255710\583429740'
[Info] @ 192350925 Scan complete: 3 incompatible mod(s) found

@originalfoo originalfoo requested a review from krzychu124 July 1, 2019 23:32
@originalfoo
Copy link
Member Author

This approach should also be far more robust for users running the mod in offline mode (eg. via EA's Origin service) as it will now check for other offline TM:PE installs.

Copy link
Member

@krzychu124 krzychu124 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, LGTM 👍

@originalfoo originalfoo merged commit 9e48b06 into master Jul 2, 2019
@originalfoo originalfoo deleted the exclude-self-from-checker branch July 2, 2019 18:27
@originalfoo originalfoo added the COMPATIBILITY Mod (in)compatibility / checker label Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

COMPATIBILITY Mod (in)compatibility / checker technical Tasks that need to be performed in order to improve quality and maintainability Usability Make mod easier to use

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants