-
-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DLC Detection #2326
DLC Detection #2326
Conversation
I think this should be good for merge if no one wants any changes. |
Oh, damn. Just realised a small issue - Detected DLC is not appearing in the GUI or consoleui. I think the difference is that while Action/List uses Registry.Installed(), Consoleui/ModListScreen and GUI.MainModList use registry.InstalledModules. Any chance we can normalise the three UIs? |
Well from just testing it, that also means those UIs never supported listing autodetected DLLs (which is what these changes are modeled on). Looking at the code, both the GUI and the CUI expect their mod lists to have"real"
Since those UIs never supported unmanaged assemblies before, I don't think there's any expectation that DLC will appear in them. I'd consider it low priority to add support to those UIs, and only really consider doing it if there was already an big refactor underway to unify the three UIs. The important thing is that other mods should be able to specify relationships with DLC. |
I concur. |
Then something must have changed because no autodetected mods show up in the GUI for me after testing and while I can see in the code where it checks for it a mod is autodetected or not among a list of mods, I don't see where autodetected mods would be populated in that list. |
I'm glad we have this working, but I think we would do better if we could get the DLC/expansion/version/compatibility details into metadata, like our KSP version info. We've now got two releases of Making History, tied to specific KSP versions. It would be nice if we flagged any incompatibility for our users. |
For what it's worth, I don't think we've had a mod submission yet with a DLC dependency. I haven't seen a mission pack mod, or anything modding the mission builder itself, or anything building directly on the DLC's parts. I'm sure it will happen, but folks don't seem to be in a hurry for some reason. |
I suspect the first thing we'll see is some missions being included in existing mods, which we hopefully will be handling perfectly {fingers crossed} |
I'm not sure what you mean? That's the whole purpose of this. If a mod requires Making History it should just be added to its dependency list like any other mod: {
"depends": [
{
"name": "MakingHistory-DLC"
}
]
} If it depends on a particular version, just add that as well, per usual: {
"depends": [
{
"name": "MakingHistory-DLC",
"version": "1.1.0"
}
]
} For reference, the version of MH that shipped with KSP 1.4.1 was 1.0.0, and the version that shipped with KSP 1.4.2 was 1.1.0. Versions are extracted from the README associated with the DLC. |
There are being missions released on the forums, but I think people dont know or bother to put them on ckan. |
If we made an "Adding a mission pack to the CKAN" wiki page, I bet we could get a forum thread about it stickied. |
I mean, instead of the detailed detection being in Core/DLC/MakingHistoryDlcDetector.cs, we should have the specifics in a file in CKAN-Meta repo, like we have for the KSP versions (and we can include a default copy in the code like we do with Core/builds.json) Obviously it's going to be a bit more complicated than builds.json. but not hugely different to ckanmodules. |
I considered this, but decided against it. The advantage of keeping The disadvantage though, is that you introduce more potential sources of failure and bugs, need to persist and refresh the data, and have to have a fallback baked into the assembly that has to be kept in sync with the live data. There's also no guarantee that you won't have to write new code anyway to support a new way of detecting the DLC and extracting the version information. Now that the code is written though, supporting new DLC should literally be a 10-minute job to add a new implementation of Maybe in the distant future with a CKAN 2.0 that's KSP-agnostic and supports a variety of games, having some declarative way to detect DLC/expansions through metadata would be better, but for now I think simplicity wins out. |
Reasonably argued. Thanks for the response! |
what about recommending or suggesting a DLC ? |
That should be fine. It would be purely informational though. |
Basic implementation of a DLC detection scheme. As I was doing this I fixed various annoyances but the meat of the changes are in:
Core/Registry/Registry.cs
Core/Registry/RegistryManager.cs
Core/Relationships/RelationshipResolver.cs
Core/Relationships/SanityChecker.cs
The basic idea:
UnmanagedModuleVersion
which extendsModuleVersion
.depends
,conflicts
, evenprovides
with them and everything should work as expected. Versions are also supported!dlc
within your installation'sCKAN
directory. Then inside that directory create a file namedIdentifier.dlc
.Identifier-DLC
will become the module's identifier (following the soft convention that DLC should have the postfix-DLC
) and the contents of the file will be the module's version.Other notes:
Now for miscellaneous list of changes due to various annoyances:
CKAN.Version
having the same name asSystem.Version
means we can't useusing System;
in a lot of files without explicit aliasing. I renamedCKAN.Version
toModuleVersion
and moved it and its subclasses into theCKAN.Versioning
namespace. I also cleaned up a lot of the versioning code and added documentation.GetHashCode()
inModuleVersion
neeCKAN.Version
. Previously it was only using the hash code from the version string but its equality and comparison methods were using both the epoch and version string for comparisons. This would cause all sorts of wonderful Heisenbugs if we ever usedModuleVersion
neeCKAN.Version
as the key to a dictionary.IEquatable<ModuleVersion>
interface onModuleVersion
neeCKAN.Version
.ModuleVersion
objects. I don't like the idea of this comparison cache, but presumably it was added to imporve performance at some point, and I'm hesitant to remove it without testing that. So if anything this will make it faster.ProvidesModuleVersion
will now include the version of the module that's providing theprovides
in its string output.UnmanagedModuleVersion
neeDllVersion
can now take an explicit version string. It continues to use"0"
for auto-detected DLLs. ItsToString()
implementation has changed to<version> (unmanaged)
.GameData/Squad/Plugins/KSPSteamCtrlr.dll
Fixes #2035