@@ -155,6 +155,7 @@ def AddListItem(caller: unrealsdk.UObject, function: unrealsdk.UFunction, params
155155 Using it cause it simplifies the code to replace the caption.
156156 """
157157 if params .Caption == "$WillowMenu.WillowScrollingListDataProviderFrontEnd.DLC" :
158+ unrealsdk .DoInjectedCallNext ()
158159 caller .AddListItem (_MODS_EVENT_ID , _MODS_MENU_NAME , False , False )
159160 return False
160161
@@ -169,6 +170,30 @@ def AddListItem(caller: unrealsdk.UObject, function: unrealsdk.UFunction, params
169170 return False
170171
171172
173+ def _RefreshDLC (caller : unrealsdk .UObject , function : unrealsdk .UFunction , params : unrealsdk .FStruct ) -> bool :
174+ """
175+ This function is called to refresh the DLC menu. We're mostly interested in it because Gearbox
176+ has amazing code, and calls `OnDownloadableContentListRead` twice if you're offline.
177+
178+ This happens right at the end of the function, so it's easiest to just recreate it.
179+
180+ We can ignore the filter stuff, `OnDownloadableContentListRead` overwrites it right after, and
181+ we can also remove the small meaningless loading message that some people get hung up on.
182+ """
183+ if caller .bDelegateFired :
184+ caller .ShowMarketplaceElements (False )
185+ caller .SetShoppingTooltips (False , False , False , False , True )
186+ caller .SetContentData ()
187+ caller .bDelegateFired = False
188+
189+ # Here's the issue: earlier they setup a delegate for this call, but when it fails they
190+ # also manually call the delgate again - we just don't
191+ caller .WPCOwner .OnlineSub .ContentInterface .ObjectPointer .ReadDownloadableContentList (
192+ caller .WPCOwner .GetMyControllerId ()
193+ )
194+ return False
195+
196+
172197def _OnDownloadableContentListRead (caller : unrealsdk .UObject , function : unrealsdk .UFunction , params : unrealsdk .FStruct ) -> bool :
173198 """ This function is called to fill in the dlc menu, we overwrite it with our mods instead. """
174199 global _current_mod_list
@@ -189,7 +214,7 @@ def _OnDownloadableContentListRead(caller: unrealsdk.UObject, function: unrealsd
189214
190215 for idx , mod in enumerate (_current_mod_list ):
191216 # This is weird and crashes if you don't have the second arg, but also crashes most the time
192- # when you try to access something on it
217+ # when you try to access something on it - seems like a garbage pointer
193218 item , _ = caller .CreateMarketplaceItem ()
194219
195220 item .SetString (caller .Prop_offeringId , str (idx ), translation_context )
@@ -248,7 +273,7 @@ def update_item() -> None:
248273 # were, but we have to call this to actually update the visuals
249274 # This also resets filters, and for some reason none of the filter functions want to work
250275 # right now either :/
251- caller . RefreshDLC ( )
276+ _RefreshDLC ( caller , None , None )
252277
253278 if key == "Q" :
254279 if event == KeybindManager .InputEvent .Released :
@@ -386,6 +411,7 @@ def _FrontEndUpdateTooltips(caller: unrealsdk.UObject, function: unrealsdk.UFunc
386411
387412
388413unrealsdk .RunHook ("WillowGame.WillowScrollingListDataProviderFrontEnd.Populate" , "ModMenu.MenuManager" , _FrontEndPopulate )
414+ unrealsdk .RunHook ("WillowGame.MarketplaceGFxMovie.RefreshDLC" , "ModMenu.MenuManager" , _RefreshDLC )
389415unrealsdk .RunHook ("WillowGame.MarketplaceGFxMovie.OnDownloadableContentListRead" , "ModMenu.MenuManager" , _OnDownloadableContentListRead )
390416unrealsdk .RunHook ("WillowGame.MarketplaceGFxMovie.ShopInputKey" , "ModMenu.MenuManager" , _ShopInputKey )
391417unrealsdk .RunHook ("WillowGame.MarketplaceGFxMovie.extOnOfferingChanged" , "ModMenu.MenuManager" , _extOnOfferingChanged )
0 commit comments