Skip to content

Instantly share code, notes, and snippets.

@cake-pie
Last active May 5, 2019 07:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cake-pie/9852876e3955e896dc080efda8fa2620 to your computer and use it in GitHub Desktop.
Save cake-pie/9852876e3955e896dc080efda8fa2620 to your computer and use it in GitHub Desktop.
Module Manager loading mechanism
2.3.2
As far as I can tell, this is the first version with actually working LoadingSytem-based implementation
Commit: https://github.com/sarbian/ModuleManager/commit/e5fb42b96a85d50eaea2b22560a31fe3041539d8
MMPatchLoader : LoadingSystem // hardcode queued after GameDatabase
Awake
https://github.com/sarbian/ModuleManager/blob/5a55cc507039a875273de2b44c793b4ba611898a/moduleManager.cs#L90-L95
- MMPatchLoader loader = aGameObject.AddComponent<MMPatchLoader>();
- list.Insert(1, loader); // GameDatabase was 0
DataBaseReloadWithMM
https://github.com/sarbian/ModuleManager/blob/5a55cc507039a875273de2b44c793b4ba611898a/moduleManager.cs#L191-L198
- GameDatabase.StartLoad();
- while (!GameDatabase.Instance.IsReady()) yield return null;
- MMPatchLoader.Instance.StartLoad();
2.4.0
MMPatchLoader : LoadingSystem // hardcode queued after GameDatabase
Awake
https://github.com/sarbian/ModuleManager/blob/5752ef3f52ebc5b0e94f5b04c5bb8baf9aca6d2f/moduleManager.cs#L91-L95
- MMPatchLoader loader = aGameObject.AddComponent<MMPatchLoader>();
- list.Insert(1, loader); // GameDatabase was 0
DataBaseReloadWithMM
https://github.com/sarbian/ModuleManager/blob/5752ef3f52ebc5b0e94f5b04c5bb8baf9aca6d2f/moduleManager.cs#L193-L200
- GameDatabase.StartLoad();
- while (!GameDatabase.Instance.IsReady()) yield return null;
- MMPatchLoader.Instance.StartLoad();
2.5.0
MMPatchLoader : LoadingSystem // hardcode queued after GameDatabase
Awake
https://github.com/sarbian/ModuleManager/blob/ac1132486a2b5424a343a165db36d3959c00cbe2/moduleManager.cs#L92-L96
- MMPatchLoader loader = aGameObject.AddComponent<MMPatchLoader>();
- list.Insert(1, loader); // GameDatabase was 0
DataBaseReloadWithMM
https://github.com/sarbian/ModuleManager/blob/ac1132486a2b5424a343a165db36d3959c00cbe2/moduleManager.cs#L258-L265
- GameDatabase.StartLoad();
- while (!GameDatabase.Instance.IsReady()) yield return null;
- MMPatchLoader.Instance.StartLoad();
2.6.0
MMPatchLoader : LoadingSystem // hardcode queued after GameDatabase
Awake
https://github.com/sarbian/ModuleManager/blob/536d541e9abe2817e0b6ab9f378628511791aa56/moduleManager.cs#L103-L107
- MMPatchLoader loader = aGameObject.AddComponent<MMPatchLoader>();
- list.Insert(1, loader); // GameDatabase was 0
DataBaseReloadWithMM
https://github.com/sarbian/ModuleManager/blob/536d541e9abe2817e0b6ab9f378628511791aa56/moduleManager.cs#L285-L292
- GameDatabase.StartLoad();
- while (!GameDatabase.Instance.IsReady()) yield return null;
- MMPatchLoader.Instance.StartLoad();
2.6.7
This is the first version that supports ModuleManagerPostLoad()
MJ calls ModuleManagerPostLoad methods in other mods on patching end
https://github.com/sarbian/ModuleManager/commit/94407c728cae0d645c182eb391243aff8dd59cdd
2.6.7
https://github.com/sarbian/ModuleManager/commit/cf0717c4d87f7a1cb493834a3fc626dbf2ca9f3b
https://github.com/sarbian/ModuleManager/blob/cf0717c4d87f7a1cb493834a3fc626dbf2ca9f3b/moduleManager.cs#L790-L840
2.6.6
https://github.com/sarbian/ModuleManager/commit/af68966b3404d77fe48d9e7f9f8ce225a10cf1a6
https://github.com/sarbian/ModuleManager/blob/af68966b3404d77fe48d9e7f9f8ce225a10cf1a6/moduleManager.cs
2.7.0
MMPatchLoader : LoadingSystem // hardcode queued after GameDatabase
Awake
https://github.com/sarbian/ModuleManager/blob/ff943850e51f0ed65dfb25664da9f2bb61ac98ce/moduleManager.cs#L107-L111
- MMPatchLoader loader = aGameObject.AddComponent<MMPatchLoader>();
- list.Insert(1, loader); // GameDatabase was 0
DataBaseReloadWithMM
https://github.com/sarbian/ModuleManager/blob/ff943850e51f0ed65dfb25664da9f2bb61ac98ce/moduleManager.cs#L342-L349
- GameDatabase.StartLoad();
- while (!GameDatabase.Instance.IsReady()) yield return null;
- MMPatchLoader.Instance.StartLoad();
2.8.0
KSP 1.3 changes #66
https://github.com/sarbian/ModuleManager/pull/66/commits/31053848f6d4ce73413e215347ccdafca881d021
Adjust MMPatchLoaderIndex: A new LoadingSystem was added at the beginning (FontLoader). This change ensures that MM will always be after the GameDatabase regardless.
MMPatchLoader : LoadingSystem // queued after GameDatabase
Awake
https://github.com/sarbian/ModuleManager/blob/851df260f9a80a41d3256f73167240af4b0c5e03/moduleManager.cs#L106-L112
- MMPatchLoader loader = aGameObject.AddComponent<MMPatchLoader>();
- int gameDatabaseIndex = list.FindIndex(s => s is GameDatabase);
- list.Insert(gameDatabaseIndex + 1, loader);
DataBaseReloadWithMM
https://github.com/sarbian/ModuleManager/blob/851df260f9a80a41d3256f73167240af4b0c5e03/moduleManager.cs#L353-L360
- GameDatabase.StartLoad();
- while (!GameDatabase.Instance.IsReady()) yield return null;
- MMPatchLoader.Instance.StartLoad();
3.0.0
MMPatchLoader : LoadingSystem // queued after GameDatabase
Awake
https://github.com/sarbian/ModuleManager/blob/2caefbd81811147d23444796b5caffdb38ce07ba/ModuleManager/ModuleManager.cs#L100-L106
- MMPatchLoader loader = aGameObject.AddComponent<MMPatchLoader>();
- int gameDatabaseIndex = list.FindIndex(s => s is GameDatabase);
- list.Insert(gameDatabaseIndex + 1, loader);
DataBaseReloadWithMM
https://github.com/sarbian/ModuleManager/blob/2caefbd81811147d23444796b5caffdb38ce07ba/ModuleManager/ModuleManager.cs#L288-L295
- GameDatabase.StartLoad();
- while (!GameDatabase.Instance.IsReady()) yield return null;
- MMPatchLoader.Instance.StartLoad();
3.1.0
MMPatchLoader : LoadingSystem // queued after GameDatabase
Awake
https://github.com/sarbian/ModuleManager/blob/e6746b440f39c04a0c320ca502aeb7bdaabd81a1/ModuleManager/ModuleManager.cs#L119-L125
- MMPatchLoader loader = aGameObject.AddComponent<MMPatchLoader>();
- int gameDatabaseIndex = list.FindIndex(s => s is GameDatabase);
- list.Insert(gameDatabaseIndex + 1, loader);
DataBaseReloadWithMM
https://github.com/sarbian/ModuleManager/blob/e6746b440f39c04a0c320ca502aeb7bdaabd81a1/ModuleManager/ModuleManager.cs#L313-L320
- GameDatabase.StartLoad();
- while (!GameDatabase.Instance.IsReady()) yield return null;
- MMPatchLoader.Instance.StartLoad();
4.0.0
Patch in background #134
https://github.com/sarbian/ModuleManager/pull/134/files#diff-5f5c09f13942dec960112559a8208c42R126
MMPatchRunner // run at Awake
+-> MMPatchLoader // +-> run in background
PostPatchLoader : LoadingSystem // queued after GameDatabase
Awake
https://github.com/sarbian/ModuleManager/blob/166b72c9a2a087c3b58e4e3e4ea949171c48c9c7/ModuleManager/ModuleManager.cs#L126-L135
- int gameDatabaseIndex = list.FindIndex(s => s is GameDatabase);
- list.Insert(gameDatabaseIndex + 1, aGameObject.AddComponent<PostPatchLoader>());
- patchRunner = new MMPatchRunner(new ModLogger("ModuleManager", new UnityLogger(Debug.unityLogger)));
- StartCoroutine(patchRunner.Run());
+-> MMPatchLoader patchLoader = new MMPatchLoader(new QueueLogger(mmLogQueue));
+-> ITaskStatus patchingThreadStatus = BackgroundTask.Start(delegate{ databaseConfigs = patchLoader.Run(); });
DataBaseReloadWithMM
https://github.com/sarbian/ModuleManager/blob/166b72c9a2a087c3b58e4e3e4ea949171c48c9c7/ModuleManager/ModuleManager.cs#L382-L394
- GameDatabase.StartLoad();
- StartCoroutine(patchRunner.Run());
- while (!GameDatabase.Instance.IsReady()) yield return null;
- PostPatchLoader.Instance.StartLoad();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment