07th-mod / higurashi-assembly

9 stars 8 forks source link

Changing graphics preset during 07th-mod logo screen (before reaching main menu) causes strange graphical bugs #104

Open drojf opened 1 year ago

drojf commented 1 year ago

I noticed if you change the graphics preset via the F10 menu during 07th-mod logo screen (before reaching main menu), it causes the background image to turn black shortly after being displayed, and some other odd glitches.

This happens even on older versions of the DLL I think.

Restarting the game seems to fix it, so it's probably not setting any state which is good.

Stopping the user pressing the F10 key before reaching the menu is probably the easiest way to fix this.

drojf commented 9 months ago

I investigated this issue today. I think it has to do with this part of the code (which only exists in our mod I think):

https://github.com/07th-mod/higurashi-assembly/blob/094444b37553b05e6d1c1bb662c53a217f60d64a/Assets.Scripts.Core.Scene/Layer.cs#L733-L740

On startup, there seems to exist a Layer which has PrimaryName set to String.Empty (normally PrimaryName is the texture name). However I think this layer disappears, or has its PrimaryName set, after the first time you call DrawSceneWithMask().

So if ReloadTexture() was called just after the game had started running, and DrawSceneWithMask() had not yet been called, it would cause the above HideLayer() call to run, which I assume causes this weird behavior where the background will turn black one frame after being displayed (although I'm not sure why).

I tested removing the HideLayer() call and it seems to fix the issue. I'm pretty confident it won't break anything, since ReloadAllImages() (which calls ReloadTexture()) is only ever called when you change our graphics related mod options. So if you never change any graphics mod options, ReloadAllImages() is never called.

Worst case the user can restart their game to fix an issue (if this removal of HideLayer() causes an issue)

I have put the fix on the https://github.com/07th-mod/higurashi-assembly/compare/f-fix-corrupt-graphics branch