Disable zoom extender when a cache overlay fails to load
The zoom extender relies on multiple scripts to be up to date. If only one is changed, its functionality breaks badly.
This commit is contained in:
@@ -28,6 +28,7 @@ import java.awt.Graphics;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseWheelEvent;
|
||||
import net.runelite.api.IndexDataBase;
|
||||
import net.runelite.api.MainBufferProvider;
|
||||
|
||||
/**
|
||||
@@ -163,4 +164,12 @@ public interface Callbacks
|
||||
* @param keyEvent the key event
|
||||
*/
|
||||
void keyTyped(KeyEvent keyEvent);
|
||||
|
||||
/**
|
||||
* Called whenever a cache overlay fails to load due to a hash mismatch
|
||||
* @param indexDataBase
|
||||
* @param archiveId
|
||||
* @param fileId
|
||||
*/
|
||||
void overlayLoadFailed(IndexDataBase indexDataBase, int archiveId, int fileId);
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ import joptsimple.OptionParser;
|
||||
import joptsimple.OptionSet;
|
||||
import joptsimple.util.EnumConverter;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.account.SessionManager;
|
||||
@@ -145,6 +146,10 @@ public class RuneLite
|
||||
@Nullable
|
||||
private Client client;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean overlayOutdated;
|
||||
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
Locale.setDefault(Locale.ENGLISH);
|
||||
|
||||
@@ -42,6 +42,7 @@ import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.IndexDataBase;
|
||||
import net.runelite.api.MainBufferProvider;
|
||||
import net.runelite.api.RenderOverview;
|
||||
import net.runelite.api.WorldMapManager;
|
||||
@@ -274,6 +275,13 @@ public class Hooks implements Callbacks
|
||||
keyManager.processKeyTyped(keyEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void overlayLoadFailed(IndexDataBase indexDataBase, int archiveId, int fileId)
|
||||
{
|
||||
RuneLite runeLite = injector.getInstance(RuneLite.class);
|
||||
runeLite.setOverlayOutdated(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(MainBufferProvider mainBufferProvider, Graphics graphics, int x, int y)
|
||||
{
|
||||
|
||||
@@ -32,6 +32,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
@@ -45,6 +46,9 @@ import net.runelite.client.plugins.PluginDescriptor;
|
||||
@Slf4j
|
||||
public class ZoomPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private RuneLite runeLite;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@@ -60,6 +64,13 @@ public class ZoomPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onScriptEvent(ScriptCallbackEvent event)
|
||||
{
|
||||
if (runeLite.isOverlayOutdated())
|
||||
{
|
||||
// if any cache overlay fails to load then assume at least one of the zoom scripts is outdated
|
||||
// and prevent zoom extending entirely.
|
||||
return;
|
||||
}
|
||||
|
||||
int[] intStack = client.getIntStack();
|
||||
int intStackSize = client.getIntStackSize();
|
||||
if (zoomConfig.outerLimit())
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.google.common.io.CharStreams;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import net.runelite.api.hooks.Callbacks;
|
||||
import net.runelite.api.mixins.Copy;
|
||||
import net.runelite.api.mixins.Mixin;
|
||||
import net.runelite.api.mixins.Replace;
|
||||
@@ -116,6 +117,9 @@ public abstract class RSIndexDataBaseMixin implements RSIndexDataBase
|
||||
|
||||
log.warn("Mismatch in overlaid cache archive hash for {}/{}: {} != {}",
|
||||
indexData.getIndex(), archiveId, replaceHash, rsHash);
|
||||
|
||||
Callbacks callbacks = client.getCallbacks();
|
||||
callbacks.overlayLoadFailed(this, archiveId, fileId);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user