Fix: Alt backgrounds and some models not always loading after toggling alt mode#3420
Closed
Archez wants to merge 2 commits intoHarbourMasters:develop-macreadyfrom
Closed
Fix: Alt backgrounds and some models not always loading after toggling alt mode#3420Archez wants to merge 2 commits intoHarbourMasters:develop-macreadyfrom
Archez wants to merge 2 commits intoHarbourMasters:develop-macreadyfrom
Conversation
Contributor
Author
Contributor
Author
|
I've included the same "unload" pattern to apply for DLs loaded in code which address most (if not all) of the known alt toggle issues pertaining to links equipment and various models. I don't know of other instances where cached values are bypassing alt look ups, so I'd like to limit this unload pattern until we can improve the asset loading process. |
briaguya0
approved these changes
Nov 23, 2023
Contributor
|
merged in via #3434 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There was an issue where if you ever loaded the non-alt version of a pre-rendered background, you wouldn't be able to load the non-alt version for the rest of the session.
This stems from the way that we handle caching and looking up resources. The way the resource manager works when requesting a resource is that we first check to see if we have a cached alt version, if we don't we then check to see if we have a cached non-alt version, if we do that gets returned, otherwise the normal resource load flow is performed.
The way alt textures are actually loaded is via Fast3D by direct calls to
LoadResourceProcesswhich bypasses the cache lookup. However, rooms with pre-rendered backgrounds first attempt to load the resource to check if its a "background" type to see if we need to decrypt the original jpeg. This check for the background type will end up returning the cached non-alt version since alt resources are cleared from cache on scene change.As a mitigation for now, I have added a few helper methods to force "unload" the non-alt background resource so that no cache is returned on the lookup, allowing the alt version to successfully be returned.
In the long run, we may need to reconsider the caching lookup as it may be affecting other areas in the code.
I have applied the above unloading pattern to
ResourceMgr_LoadGfxByNameto address some alt models not loading after the non-alt version has loaded once. Closes #3076 and #3078.Build Artifacts