BL Coding changes between 1.6.0 and 1.6.1 - No More TaleWorlds.MountAndBlade.View.dll?

Users who are viewing this thread

Khadgarion

Recruit
M&BWBWF&SNW
Hi folks,

I am attemping to update a mod that is no longer working. I am having trouble fixing an error;

GameStateScreen seem to no longer exist, which was in

TaleWorlds.MountAndBlade.View.Screen

in the file

TaleWorlds.MountAndBlade.View.dll​


The issue is... TaleWorlds.MountAndBlade.View.dll is no longer in the game directory after updating to 1.6.1. Was it merged with a different file, or was GameStateScreen moved under another method?

Thanks for any help. I am really new to VisualStudio and C++/C# so I may be completely wrong in what I am doing.
 

Khadgarion

Recruit
M&BWBWF&SNW
Apparently the errors I am dealing with in VisualStudio existed in 1.6.0 also, since I reverted to 1.6.0 on steam and the TaleWorlds.MountAndBlade.View.dll doesn't exist in that version either. Strange. I did fix quite a few other errors in the file, will try to force compile the dll and see if it works.
 
Upvote 0

Khadgarion

Recruit
M&BWBWF&SNW
It's in Mount & Blade II Bannerlord\Modules\Native\bin\Win64_Shipping_Client and the method is in TaleWorlds.MountAndBlade.View.Screen.
Thanks a bunch. I thought I had searched the Bannerlord folder for that particular DLL but evidently not.

The mod still crashes, but at least I have fixed all the errors listed in Visual Studio. Many thanks!
 
Upvote 0

Khadgarion

Recruit
M&BWBWF&SNW
Still crashing with this. From what I can tell, the correct stuff is being passed to the AddGameMenuOption... I don't know what else I can try at this point.

VS gives me this error when I debug the updated DLL against Bannerlord:


The thread 0x4224 has exited with code 0 (0x0).
An unhandled exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in TaleWorlds.CampaignSystem.dll
The given key was not present in the dictionary.

Crash portion of log file:

Code:
at TaleWorlds.DotNet.Managed.GetStackTraceStr(Int32 skipCount)
at TaleWorlds.CampaignSystem.CampaignGameStarter.AddGameMenuOption(String menuId, String optionId, String optionText, OnConditionDelegate condition, OnConsequenceDelegate consequence, Boolean isLeave, Int32 index, Boolean isRepeatable)
at AutoTrader.TradeBehavior.AddDialogAndGameMenus(CampaignGameStarter campaignGameStarter)
at AutoTrader.TradeBehavior.OnGameLoaded(CampaignGameStarter campaignGameStarter)
at TaleWorlds.CampaignSystem.MbEvent`1.InvokeList(EventHandlerRec`1 list, T t)
at TaleWorlds.CampaignSystem.CampaignEvents.OnGameLoaded(CampaignGameStarter campaignGameStarter)
at TaleWorlds.CampaignSystem.CampaignEventDispatcher.OnGameLoaded(CampaignGameStarter campaignGameStarter)
at TaleWorlds.CampaignSystem.Campaign.OnGameLoaded(CampaignGameStarter starter)
at TaleWorlds.CampaignSystem.Campaign.DoLoadingForGameType(GameTypeLoadingStates gameTypeLoadingState, GameTypeLoadingStates& nextState)
at StoryMode.CampaignStoryMode.DoLoadingForGameType(GameTypeLoadingStates gameTypeLoadingState, GameTypeLoadingStates& nextState)
at TaleWorlds.Core.GameType.DoLoadingForGameType()
at SandBox.SandBoxGameManager.DoLoadingForGameManager(GameManagerLoadingSteps gameManagerLoadingStep, GameManagerLoadingSteps& nextStep)
at TaleWorlds.Core.GameManagerBase.DoLoadingForGameManager()
at TaleWorlds.MountAndBlade.GameLoadingState.OnTick(Single dt)
at TaleWorlds.Core.GameStateManager.OnTick(Single dt)
at TaleWorlds.MountAndBlade.Module.OnApplicationTick(Single dt)
at TaleWorlds.DotNet.Managed.ApplicationTick(Single dt)
 
Upvote 0
Still crashing with this. From what I can tell, the correct stuff is being passed to the AddGameMenuOption... I don't know what else I can try at this point.

VS gives me this error when I debug the updated DLL against Bannerlord:


The thread 0x4224 has exited with code 0 (0x0).
An unhandled exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in TaleWorlds.CampaignSystem.dll
The given key was not present in the dictionary.

Crash portion of log file:

Code:
at TaleWorlds.DotNet.Managed.GetStackTraceStr(Int32 skipCount)
at TaleWorlds.CampaignSystem.CampaignGameStarter.AddGameMenuOption(String menuId, String optionId, String optionText, OnConditionDelegate condition, OnConsequenceDelegate consequence, Boolean isLeave, Int32 index, Boolean isRepeatable)
at AutoTrader.TradeBehavior.AddDialogAndGameMenus(CampaignGameStarter campaignGameStarter)
at AutoTrader.TradeBehavior.OnGameLoaded(CampaignGameStarter campaignGameStarter)
at TaleWorlds.CampaignSystem.MbEvent`1.InvokeList(EventHandlerRec`1 list, T t)
at TaleWorlds.CampaignSystem.CampaignEvents.OnGameLoaded(CampaignGameStarter campaignGameStarter)
at TaleWorlds.CampaignSystem.CampaignEventDispatcher.OnGameLoaded(CampaignGameStarter campaignGameStarter)
at TaleWorlds.CampaignSystem.Campaign.OnGameLoaded(CampaignGameStarter starter)
at TaleWorlds.CampaignSystem.Campaign.DoLoadingForGameType(GameTypeLoadingStates gameTypeLoadingState, GameTypeLoadingStates& nextState)
at StoryMode.CampaignStoryMode.DoLoadingForGameType(GameTypeLoadingStates gameTypeLoadingState, GameTypeLoadingStates& nextState)
at TaleWorlds.Core.GameType.DoLoadingForGameType()
at SandBox.SandBoxGameManager.DoLoadingForGameManager(GameManagerLoadingSteps gameManagerLoadingStep, GameManagerLoadingSteps& nextStep)
at TaleWorlds.Core.GameManagerBase.DoLoadingForGameManager()
at TaleWorlds.MountAndBlade.GameLoadingState.OnTick(Single dt)
at TaleWorlds.Core.GameStateManager.OnTick(Single dt)
at TaleWorlds.MountAndBlade.Module.OnApplicationTick(Single dt)
at TaleWorlds.DotNet.Managed.ApplicationTick(Single dt)
You are trying to update the mode "Autotrader" right?
I have checked on the nexus page and could see that localization files cause CTD. I guess you tried this already.

In the above log I can see that the mod is trying to add new menu options and dialogues using "OnGameLoaded".
Since 1.6.1, something changed with how are called some of the menus.
I was using "OnSessionLaunched" for some of the menu options of my mod but it stopped working with last update.
I reported it here and Dejan suggested me to use "OnGameLoaded" and "OnNewGameCreated" instead.
Unfortunately none of them worked for me and I had to "redesign" that part of my mod...

I can't really tell without checking how Autotrader is calling the menus, but if it is adding the menu options to only "town" and "village" then you may try to use "OnSessionLaunched" in your case.
 
Upvote 0
Still crashing with this. From what I can tell, the correct stuff is being passed to the AddGameMenuOption... I don't know what else I can try at this point.

VS gives me this error when I debug the updated DLL against Bannerlord:


The thread 0x4224 has exited with code 0 (0x0).
An unhandled exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in TaleWorlds.CampaignSystem.dll
The given key was not present in the dictionary.

Crash portion of log file:

Code:
at TaleWorlds.DotNet.Managed.GetStackTraceStr(Int32 skipCount)
at TaleWorlds.CampaignSystem.CampaignGameStarter.AddGameMenuOption(String menuId, String optionId, String optionText, OnConditionDelegate condition, OnConsequenceDelegate consequence, Boolean isLeave, Int32 index, Boolean isRepeatable)
at AutoTrader.TradeBehavior.AddDialogAndGameMenus(CampaignGameStarter campaignGameStarter)
at AutoTrader.TradeBehavior.OnGameLoaded(CampaignGameStarter campaignGameStarter)
at TaleWorlds.CampaignSystem.MbEvent`1.InvokeList(EventHandlerRec`1 list, T t)
at TaleWorlds.CampaignSystem.CampaignEvents.OnGameLoaded(CampaignGameStarter campaignGameStarter)
at TaleWorlds.CampaignSystem.CampaignEventDispatcher.OnGameLoaded(CampaignGameStarter campaignGameStarter)
at TaleWorlds.CampaignSystem.Campaign.OnGameLoaded(CampaignGameStarter starter)
at TaleWorlds.CampaignSystem.Campaign.DoLoadingForGameType(GameTypeLoadingStates gameTypeLoadingState, GameTypeLoadingStates& nextState)
at StoryMode.CampaignStoryMode.DoLoadingForGameType(GameTypeLoadingStates gameTypeLoadingState, GameTypeLoadingStates& nextState)
at TaleWorlds.Core.GameType.DoLoadingForGameType()
at SandBox.SandBoxGameManager.DoLoadingForGameManager(GameManagerLoadingSteps gameManagerLoadingStep, GameManagerLoadingSteps& nextStep)
at TaleWorlds.Core.GameManagerBase.DoLoadingForGameManager()
at TaleWorlds.MountAndBlade.GameLoadingState.OnTick(Single dt)
at TaleWorlds.Core.GameStateManager.OnTick(Single dt)
at TaleWorlds.MountAndBlade.Module.OnApplicationTick(Single dt)
at TaleWorlds.DotNet.Managed.ApplicationTick(Single dt)
You should always call AddGameMenuOption at OnSessionLaunched. I mod dialogs too I and use OnSessionLaunched, but never OnGameLoaded or OnNewGameCreated.
 
Upvote 0
You should always call AddGameMenuOption at OnSessionLaunched. I mod dialogs too I and use OnSessionLaunched, but never OnGameLoaded or OnNewGameCreated.
Except for the menus called in EncounterGameMenuBehavior ("town_outside" - "castle_outside").
I was using them until 1.6.0 and then with 1.6.1 it didn't work anymore.
And this is where Dejan suggested me to use OnGameLoadedand OnNewGameCreated (didn't work though).
Otherwise yes on SessionLaunched does the job.
 
Upvote 0

Khadgarion

Recruit
M&BWBWF&SNW
You are trying to update the mode "Autotrader" right?
I have checked on the nexus page and could see that localization files cause CTD. I guess you tried this already.

In the above log I can see that the mod is trying to add new menu options and dialogues using "OnGameLoaded".
Since 1.6.1, something changed with how are called some of the menus.
I was using "OnSessionLaunched" for some of the menu options of my mod but it stopped working with last update.
I reported it here and Dejan suggested me to use "OnGameLoaded" and "OnNewGameCreated" instead.
Unfortunately none of them worked for me and I had to "redesign" that part of my mod...

I can't really tell without checking how Autotrader is calling the menus, but if it is adding the menu options to only "town" and "village" then you may try to use "OnSessionLaunched" in your case.
Correct, autotrader.
It's calling OnNewGameCreated and OnGameLoaded. I will try changing to OnSessionLaunched and report back :smile:
 
Upvote 0

Khadgarion

Recruit
M&BWBWF&SNW
Looks like changing to OnSessionLaunched fixed the crashing problem! Thanks for you suggestions order_without_power and Spinozart1!

Still a couple of little bugs to work out... The "Automatically Trade Wares" menu option appears twice, and the "AutoTrader Options" opens and settings can be changed but the sliders are invisible (https://prnt.sc/1npj4vs).

Progress has been made, and I am really thrilled. Thanks again!

EDIT: I fixed the double menu entry. There were 2 separate classes, one for adding the menu when a new game is created and one for when a game is loaded. I got rid of the NewGame, since I figured both new games and loading saves launch a session. That worked, now to figure out the settings menu wierdness :smile:
 
Last edited:
Upvote 0

Khadgarion

Recruit
M&BWBWF&SNW
Adding in MCM didn't make a difference with the menu sliders.

I've looked through the files related to the config menu, and I am so far unable to figure out how exactly one of the settings is defined as a slider or checkbox, etc. I am sure I am overlooking it. Haven't been able to find much on Gauntlet UI, probably looking in the wrong places.
 
Upvote 0
Top Bottom