Skip to content

Progress panel addition#1

Merged
janxious merged 12 commits intojanxious:masterfrom
brianries:progress_panel_addition
Aug 8, 2018
Merged

Progress panel addition#1
janxious merged 12 commits intojanxious:masterfrom
brianries:progress_panel_addition

Conversation

@brianries
Copy link
Collaborator

Significant refactor of ModTek to have it disable the normal BattleTech loading, load all the modtek enabled mods using a progress bar and then resume the normal initialization sequence.

Includes an outside asset bundle from Unity to create the progress bar panel

@janxious
Copy link
Owner

Is this normal?
screen shot 2018-07-29 at 8 45 14 pm

Seems like double injection might be happening?
screen shot 2018-07-29 at 8 45 46 pm

I noticed my btml log no longer had any of the modtek mods in it, just the btml ones. They were still in the harmony log in the .modtek folder. Modtek.log seemed to be fairly empty as well.

{
ModTek.LoadMods();
Traverse trav = Traverse.Create(__instance);
if (ActivateAfterInit.ActivateAfter.Start.Equals(trav.Field("activateAfter").GetValue<ActivateAfterInit.ActivateAfter>()))
Copy link
Owner

Choose a reason for hiding this comment

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

If this code gets called more than once per time the game is started (via save game loads or whatever), should cached the field infos potentially.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this is OK -- the Main object activates BattleTechGame once during the initial startup, this is here just to 'pause' the loading so we can animate. I don't believe that BattleTechGame gets activated another time through this mechanism (it can be activated in other ways though)

ProgressBarAssetBundle = LoadAssets(assetDirectory, ASSET_BUNDLE_NAME);
if (ProgressBarAssetBundle == null)
{
Logger.LogWithDate("Error loading assets");
Copy link
Owner

Choose a reason for hiding this comment

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

have you tested this failure state?

should this throw an exception?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just updated the branch to handle this more gracefully -- and tested it. It now throws an exception, which will propagate up to the Initialize method -- which, if false -- will stop ModTek from loading completely. (it used to hang kinda ugly instead)

@brianries
Copy link
Collaborator Author

The panel appearing twice is not normal. Were there two ModTek.dlls in the folder? Or was the new BTML injector run against an already injected file? Haven't seen that one on my end (and neither did LadyAlekto when she runs it)

…mode handling. If the asset bundle doesn't load, the mods will not be loaded.
}
else
{
Log("Failed to load progress bar. Skipping mod loading completely.");
Copy link
Owner

Choose a reason for hiding this comment

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

Given we will control the filename, I would be more explicit about like "you need modtekassetbundle in your Mods directory"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the result after the change I made:

Attempting to load asset bundle: C:\Program Files (x86)\Steam\steamapps\common\BATTLETECH\Mods\modtekassetbundle
8:09:55 PM - Error loading asset bundle modtekassetbundle
Exception caught: System.IO.IOException: Error loading asset bundle modtekassetbundle
at ModTek.ProgressPanel.InitializeAssets (System.String assetDirectory) [0x00000] in :0
at ModTek.ProgressPanel.Initialize (System.String directory, System.String panelTitle) [0x00000] in :0
Failed to load progress bar. Skipping mod loading completely.

@janxious
Copy link
Owner

As stated on janxious/BattleTechModLoader#1, the weirdness I reported was all PEBKAC.

@janxious janxious merged commit 79f19ff into janxious:master Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments