Fixed HD flyover when logging out with resizable SD enabled

This commit is contained in:
ipkpjersi 2024-06-17 22:27:56 -04:00
parent 824f85c7b3
commit 7aab2d1735
2 changed files with 11 additions and 5 deletions

View file

@ -162,7 +162,8 @@ public class PluginRepository {
} }
public static void OnLogout() { public static void OnLogout() {
loadedPlugins.values().forEach(Plugin::OnLogout); List<Plugin> pluginsSnapshot = new ArrayList<>(loadedPlugins.values());
pluginsSnapshot.forEach(Plugin::OnLogout);
} }
public static void DrawMiniMenu(MiniMenuEntry entry) { public static void DrawMiniMenu(MiniMenuEntry entry) {

View file

@ -3,10 +3,7 @@ package ToggleResizableSD
import plugin.Plugin import plugin.Plugin
import plugin.annotations.PluginMeta import plugin.annotations.PluginMeta
import plugin.api.API import plugin.api.API
import rt4.DisplayMode import rt4.*
import rt4.GameShell
import rt4.InterfaceList
import rt4.client
import java.awt.event.KeyAdapter import java.awt.event.KeyAdapter
import java.awt.event.KeyEvent import java.awt.event.KeyEvent
@ -60,4 +57,12 @@ class plugin : Plugin() {
toggleResizableSd() toggleResizableSd()
} }
} }
override fun OnLogout() {
if (DisplayMode.resizableSD) {
DisplayMode.resizableSD = false
//Because resizable SD always uses the "HD" size canvas/window mode (check the in-game Graphics Options with resizeable SD enabled if you don't believe me!), useHD becomes true when logging out, so logging out with resizeSD enabled means "HD" will always be enabled on the login screen after logging out, so we might as well fix the HD flyover by replacing the canvas and setting newMode to 2.
DisplayMode.setWindowMode(true, 2, GameShell.frameWidth, GameShell.frameHeight)
}
}
} }