Skip to content

[StarMapImmediateLoad] cannot register on KSA 2026.11.10.5801, which removed Mod.PrepareSystems #113

Closed

Description

@Maximilian-Nesslauer

KSA 2026.11.10.5801 no longer has KSA.Mod.PrepareSystems. Mod.LoadSystems, LoadAssetBundles, PrepareSystems and the mod fields that went with them are gone from the decompiled KSA.Mod, and ModLibrary.LoadAll no longer calls mod.PrepareSystems().

StarMap 0.5.2 still looks the method up in RuntimeMod.InitializeMod, in the case StarMapImmediateLoadAttribute: typeof(KSA.Mod).GetMethod(nameof(Mod.PrepareSystems))!. On 5801 this returns null. The null goes to PatchManager.RegisterInstanceVoidPatch and into GetOrCreateMethodPatch, whose dictionary lookup does not accept a null key. ModsLoader.PrepareMods has no try/catch around InitializeMod, so this reads as an exception that leaves StarMapCore's constructor and stops the start of the game, not only the one mod. I read this from the source and have not run it on 5801 yet.

Mods that declare [StarMapImmediateLoad] in the repositories we know: KittenExtensions, gatOS, KSAGEffects, KSAMultiplayer and KSASM. StarMap 0.4.8 patches the same method through ModPatches with a Harmony attribute, so it may fail the same way.

Questions:

  1. Is there a replacement point in 5801 for "immediately before the systems of this mod are prepared" that [StarMapImmediateLoad] can use, or should the attribute become a no-op that logs a warning when its target is missing?
  2. Whatever the answer, a missing patch target should skip the one callback and log it. It should not stop the loader.

Activity

  1. Maximilian-Nesslauer commented on Nov 8, 2026

    @Maximilian-Nesslauer
    ContributorAuthor

    A second change in 5801 hits [StarMapAllModsLoaded]: ModLibrary.LoadAll now has one optional parameter, LoadAll(IContentLoadProgress? progress = null), where it had none in 2026.10.25.5707.

    RuntimeMod.InitializeMod (case StarMapAllModsLoadedAttribute) registers a postfix on ModLibrary.LoadAll and calls classMethod.Invoke(modObject, args) with the arguments of the patched method. With one argument, a callback that takes no parameters, which is the documented signature, would throw TargetParameterCountException, and StarMap logs that without stopping the other patches. Then no mod would get its all-mods-loaded callback.

    I read this from the source and have not run it on 5801 yet. One way to avoid it is to call the callback with no arguments in this case, because the documented signature has none.

  2. Maximilian-Nesslauer commented on Nov 8, 2026

    @Maximilian-Nesslauer
    ContributorAuthor

    I ran StarMap 0.5.2 on KSA 2026.11.10.5801 with four mods and can confirm the LoadAll part (and only that part).

    All four mods are found and their [StarMapAfterGui] callbacks run every frame, so the loader starts and the mods are created. But none of the [StarMapAllModsLoaded] methods ran: each of them writes a log line first, and none of those lines is in the session log. This matches the new optional parameter of ModLibrary.LoadAll, because classMethod.Invoke(modObject, args) gets one argument for a method that takes none. I did not capture the exception text itself, so the cause is still read from the source.

    None of the four mods declares [StarMapImmediateLoad], so the PrepareSystems part of this issue is not exercised by this run.

    In effect every mod that does its setup in [StarMapAllModsLoaded] is only half loaded on 5801 with StarMap 0.5.2, with nothing on screen to say so.

  3. Maximilian-Nesslauer commented on Nov 8, 2026

    @Maximilian-Nesslauer
    ContributorAuthor

    There is a pull request for this: #115. It calls the [StarMapAllModsLoaded] methods without arguments, hooks [StarMapImmediateLoad] to Mod.LoadSettings when Mod.PrepareSystems is gone (and only warns when there is neither), and adds the using that StarMap needs to build against 5801.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions