Merge pull request #2844 from open-osrs/better-script-info
runelite-client: script update (thanks TomC) / outdated rework
This commit is contained in:
@@ -2118,4 +2118,8 @@ public interface Client extends GameShell
|
|||||||
String getSelectedItemName();
|
String getSelectedItemName();
|
||||||
|
|
||||||
Widget getMessageContinueWidget();
|
Widget getMessageContinueWidget();
|
||||||
|
|
||||||
|
void setOutdatedScript(String outdatedScript);
|
||||||
|
|
||||||
|
List<String> getOutdatedScripts();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ package net.runelite.api;
|
|||||||
|
|
||||||
import net.runelite.api.hooks.DrawCallbacks;
|
import net.runelite.api.hooks.DrawCallbacks;
|
||||||
import java.awt.Canvas;
|
import java.awt.Canvas;
|
||||||
import net.runelite.api.hooks.DrawCallbacks;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the client game engine.
|
* Represents the client game engine.
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ dependencies {
|
|||||||
implementation(group = "org.pushing-pixels", name = "radiance-substance", version = "2.5.1")
|
implementation(group = "org.pushing-pixels", name = "radiance-substance", version = "2.5.1")
|
||||||
implementation(group = "net.sf.jopt-simple", name = "jopt-simple", version = "5.0.4")
|
implementation(group = "net.sf.jopt-simple", name = "jopt-simple", version = "5.0.4")
|
||||||
implementation(group = "org.apache.commons", name = "commons-text", version = "1.9")
|
implementation(group = "org.apache.commons", name = "commons-text", version = "1.9")
|
||||||
|
implementation(group = "commons-io", name = "commons-io", version = "2.8.0")
|
||||||
implementation(group = "org.jetbrains", name = "annotations", version = "20.1.0")
|
implementation(group = "org.jetbrains", name = "annotations", version = "20.1.0")
|
||||||
implementation(group = "org.jooq", name = "jooq", version = "3.14.0")
|
implementation(group = "org.jooq", name = "jooq", version = "3.14.0")
|
||||||
implementation(group = "org.jooq", name = "jooq-codegen", version = "3.14.0")
|
implementation(group = "org.jooq", name = "jooq-codegen", version = "3.14.0")
|
||||||
|
|||||||
@@ -836,8 +836,6 @@ LABEL729:
|
|||||||
iload 10
|
iload 10
|
||||||
iload 11
|
iload 11
|
||||||
iload 28
|
iload 28
|
||||||
sconst "addLastRow"
|
|
||||||
runelite_callback
|
|
||||||
iload 29
|
iload 29
|
||||||
iload 12
|
iload 12
|
||||||
iload 13
|
iload 13
|
||||||
@@ -53,7 +53,7 @@ LABEL35:
|
|||||||
istore 4
|
istore 4
|
||||||
LABEL37:
|
LABEL37:
|
||||||
staffmodlevel
|
staffmodlevel
|
||||||
iconst -1
|
iconst 0
|
||||||
if_icmpgt LABEL41
|
if_icmpgt LABEL41
|
||||||
jump LABEL43
|
jump LABEL43
|
||||||
LABEL41:
|
LABEL41:
|
||||||
@@ -6,15 +6,15 @@
|
|||||||
iconst 1
|
iconst 1
|
||||||
iconst 0
|
iconst 0
|
||||||
sconst "scrollWheelZoom"
|
sconst "scrollWheelZoom"
|
||||||
runelite_callback
|
runelite_callback
|
||||||
if_icmpeq LABEL18
|
if_icmpeq LABEL18
|
||||||
iconst 0
|
iconst 0
|
||||||
iload 0
|
iload 0
|
||||||
iconst 25
|
iconst 25
|
||||||
sconst "scrollWheelZoomIncrement"
|
sconst "scrollWheelZoomIncrement"
|
||||||
runelite_callback
|
runelite_callback
|
||||||
multiply
|
multiply
|
||||||
sub
|
sub
|
||||||
istore 1
|
istore 1
|
||||||
iconst 512
|
iconst 512
|
||||||
istore 2
|
istore 2
|
||||||
@@ -30,21 +30,21 @@ LABEL14:
|
|||||||
if_icmpne LABEL18
|
if_icmpne LABEL18
|
||||||
jump LABEL19
|
jump LABEL19
|
||||||
LABEL18:
|
LABEL18:
|
||||||
return
|
return
|
||||||
LABEL19:
|
LABEL19:
|
||||||
viewport_getfov
|
viewport_getfov
|
||||||
istore 2
|
istore 2
|
||||||
istore 3
|
istore 3
|
||||||
iload 3
|
iload 3
|
||||||
iload 1
|
iload 1
|
||||||
add
|
add
|
||||||
istore 3
|
istore 3
|
||||||
iload 2
|
iload 2
|
||||||
iload 1
|
iload 1
|
||||||
add
|
add
|
||||||
istore 2
|
istore 2
|
||||||
iload 3
|
iload 3
|
||||||
iload 2
|
iload 2
|
||||||
invoke 42
|
invoke 42
|
||||||
LABEL33:
|
LABEL33:
|
||||||
return
|
return
|
||||||
@@ -29,6 +29,7 @@ dependencies {
|
|||||||
compileOnly(group = "com.google.guava", name = "guava", version = "30.0-jre")
|
compileOnly(group = "com.google.guava", name = "guava", version = "30.0-jre")
|
||||||
compileOnly(group = "javax.inject", name = "javax.inject", version = "1")
|
compileOnly(group = "javax.inject", name = "javax.inject", version = "1")
|
||||||
compileOnly(group = "org.slf4j", name = "slf4j-api", version = "1.7.30")
|
compileOnly(group = "org.slf4j", name = "slf4j-api", version = "1.7.30")
|
||||||
|
compileOnly(group = "commons-io", name = "commons-io", version = "2.8.0")
|
||||||
compileOnly(project(":injection-annotations"))
|
compileOnly(project(":injection-annotations"))
|
||||||
compileOnly(project(":runescape-api"))
|
compileOnly(project(":runescape-api"))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
package net.runelite.mixins;
|
package net.runelite.mixins;
|
||||||
|
|
||||||
|
import com.google.common.base.Charsets;
|
||||||
import com.google.common.hash.Hashing;
|
import com.google.common.hash.Hashing;
|
||||||
import com.google.common.io.ByteStreams;
|
import com.google.common.io.ByteStreams;
|
||||||
import com.google.common.io.CharStreams;
|
import com.google.common.io.CharStreams;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import net.runelite.api.mixins.Copy;
|
import net.runelite.api.mixins.Copy;
|
||||||
import net.runelite.api.mixins.Inject;
|
import net.runelite.api.mixins.Inject;
|
||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
@@ -15,6 +19,7 @@ import net.runelite.api.overlay.OverlayIndex;
|
|||||||
import net.runelite.rs.api.RSAbstractArchive;
|
import net.runelite.rs.api.RSAbstractArchive;
|
||||||
import net.runelite.rs.api.RSArchive;
|
import net.runelite.rs.api.RSArchive;
|
||||||
import net.runelite.rs.api.RSClient;
|
import net.runelite.rs.api.RSClient;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
@Mixin(RSAbstractArchive.class)
|
@Mixin(RSAbstractArchive.class)
|
||||||
@@ -26,6 +31,9 @@ public abstract class RSAbstractArchiveMixin implements RSAbstractArchive
|
|||||||
@Inject
|
@Inject
|
||||||
private boolean overlayOutdated;
|
private boolean overlayOutdated;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Map<String, String> scriptNames;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Override
|
@Override
|
||||||
public boolean isOverlayOutdated()
|
public boolean isOverlayOutdated()
|
||||||
@@ -46,6 +54,34 @@ public abstract class RSAbstractArchiveMixin implements RSAbstractArchive
|
|||||||
return rsData;
|
return rsData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (scriptNames == null)
|
||||||
|
try
|
||||||
|
{
|
||||||
|
scriptNames = new HashMap<>();
|
||||||
|
InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream("scripts/");
|
||||||
|
if (is != null)
|
||||||
|
{
|
||||||
|
List<String> files = IOUtils.readLines(is, Charsets.UTF_8);
|
||||||
|
for (String s : files)
|
||||||
|
{
|
||||||
|
if (s.endsWith(".rs2asm"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
String scriptName = s.replace(".hash", "");
|
||||||
|
InputStream hashStream = ClassLoader.getSystemClassLoader().getResourceAsStream("scripts/" + scriptName + ".hash");
|
||||||
|
if (hashStream != null)
|
||||||
|
{
|
||||||
|
String scriptHash = (String) IOUtils.readLines(hashStream, Charsets.UTF_8).toArray()[0];
|
||||||
|
scriptNames.put(scriptHash, scriptName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
final Logger log = client.getLogger();
|
final Logger log = client.getLogger();
|
||||||
final String path = String.format("/runelite/%s/%s", archiveId, groupId);
|
final String path = String.format("/runelite/%s/%s", archiveId, groupId);
|
||||||
|
|
||||||
@@ -68,8 +104,8 @@ public abstract class RSAbstractArchiveMixin implements RSAbstractArchive
|
|||||||
// Check if hash is correct first, so we don't have to load the overlay file if it doesn't match
|
// Check if hash is correct first, so we don't have to load the overlay file if it doesn't match
|
||||||
if (!overlayHash.equalsIgnoreCase(originalHash))
|
if (!overlayHash.equalsIgnoreCase(originalHash))
|
||||||
{
|
{
|
||||||
log.warn("Mismatch in overlaid cache archive hash for {}/{}: {} != {}",
|
log.error("Script " + scriptNames.get(overlayHash) + " is invalid, and will not be overlaid. This will break plugin(s)!");
|
||||||
archiveId, groupId, overlayHash, originalHash);
|
client.setOutdatedScript(scriptNames.get(overlayHash));
|
||||||
overlayOutdated = true;
|
overlayOutdated = true;
|
||||||
return rsData;
|
return rsData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -240,6 +240,9 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
@Inject
|
@Inject
|
||||||
private boolean comparingAppearance = false;
|
private boolean comparingAppearance = false;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private List<String> outdatedScripts = new ArrayList<>();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Override
|
@Override
|
||||||
public void setPrintMenuActions(boolean yes)
|
public void setPrintMenuActions(boolean yes)
|
||||||
@@ -1973,5 +1976,20 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
client.setMusicTrackBoolean(var5);
|
client.setMusicTrackBoolean(var5);
|
||||||
client.setPcmSampleLength(var0);
|
client.setPcmSampleLength(var0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public void setOutdatedScript(String outdatedScript)
|
||||||
|
{
|
||||||
|
if (!outdatedScripts.contains(outdatedScript))
|
||||||
|
outdatedScripts.add(outdatedScript);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public List<String> getOutdatedScripts()
|
||||||
|
{
|
||||||
|
return this.outdatedScripts;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ dependencies {
|
|||||||
tasks {
|
tasks {
|
||||||
register<JavaExec>("assembleMojo") {
|
register<JavaExec>("assembleMojo") {
|
||||||
outputs.cacheIf { true }
|
outputs.cacheIf { true }
|
||||||
val inp = "${project.extra["rootPath"]}/runelite-client/src/main/scripts"
|
val inp = "${project.extra["rootPath"]}/runelite-client/src/main/resources/scripts"
|
||||||
val out = "${project.extra["rootPath"]}/runelite-client/build/scripts/runelite"
|
val out = "${project.extra["rootPath"]}/runelite-client/build/scripts/runelite"
|
||||||
inputs.dir(inp)
|
inputs.dir(inp)
|
||||||
outputs.dir(out)
|
outputs.dir(out)
|
||||||
|
|||||||
Reference in New Issue
Block a user