low memory plugin: set low memory mode after startup

Setting low memory mode too early prevents high detail textures from
loading, which breaks the gpu plugin
This commit is contained in:
Adam
2019-08-20 17:33:31 -04:00
parent 65758d54f3
commit de89277e76

View File

@@ -26,7 +26,10 @@ package net.runelite.client.plugins.lowmemory;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.events.GameStateChanged;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@@ -47,7 +50,10 @@ public class LowMemoryPlugin extends Plugin
@Override
protected void startUp()
{
clientThread.invoke(() -> client.changeMemoryMode(true));
if (client.getGameState() == GameState.LOGGED_IN)
{
clientThread.invoke(() -> client.changeMemoryMode(true));
}
}
@Override
@@ -55,4 +61,16 @@ public class LowMemoryPlugin extends Plugin
{
clientThread.invoke(() -> client.changeMemoryMode(false));
}
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
// When the client starts it initializes the texture size based on the memory mode setting.
// Don't set low memory before the login screen is ready to prevent loading the low detail textures,
// which breaks the gpu plugin due to it requiring the 128x128px textures
if (event.getGameState() == GameState.LOGIN_SCREEN)
{
client.changeMemoryMode(true);
}
}
}