Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Alt backgrounds and some models not always loading after toggling alt mode #3420

Closed

Conversation

Archez
Copy link
Contributor

@Archez Archez commented Nov 20, 2023

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 LoadResourceProcess which 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_LoadGfxByName to address some alt models not loading after the non-alt version has loaded once. Closes #3076 and #3078.

Build Artifacts

@Archez
Copy link
Contributor Author

Archez commented Nov 20, 2023

The cache quirk described above may be the cause of #3078 and #3076, so a similar fix may address those, or improving/changing the cache behavior may be necessary overall to handle all the edge cases.

@Archez
Copy link
Contributor Author

Archez commented Nov 20, 2023

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.

@Archez Archez changed the title Fix: Alt backgrounds not always loading after toggling alt mode Fix: Alt backgrounds and some models not always loading after toggling alt mode Nov 20, 2023
@briaguya-ai
Copy link
Contributor

merged in via #3434

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