Skip to content
Merged

2.0.36 #1589

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<parent>
<groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId>
<version>1.11.23-SNAPSHOT</version>
<version>1.12.0-SNAPSHOT</version>
</parent>

<artifactId>cache</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,7 @@ public class NpcDefinition
public int height = -1;
public int[] stats = {1, 1, 1, 1, 1, 1};
public int footprintSize = -1;
public boolean canHideForOverlap;
public int overlapTintHSL = 39188;
public boolean unknown1 = false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public class ObjectDefinition
private int soundFadeOutDuration = 300;
private int soundFadeInCurve;
private int soundFadeOutCurve;
private int soundVisibility = 2;
private int ambientSoundChangeTicksMin = 0;
private int ambientSoundChangeTicksMax = 0;
private boolean blocksProjectile = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,14 @@ else if (opcode == 129)
{
def.unknown1 = true;
}
else if (opcode == 145)
{
def.canHideForOverlap = true;
}
else if (opcode == 146)
{
def.overlapTintHSL = stream.readUnsignedShort();
}
else if (opcode == 249)
{
length = stream.readUnsignedByte();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ else if (opcode == 94)
{
def.setUnknown1(true);
}
else if (opcode == 95)
{
def.setSoundVisibility(is.readUnsignedByte());
}
else if (opcode == 249)
{
int length = is.readUnsignedByte();
Expand Down
18 changes: 5 additions & 13 deletions cache/src/main/java/net/runelite/cache/fs/Archive.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,7 @@ public byte[] decompress(byte[] data, int[] keys) throws IOException
return null;
}

byte[] encryptedData = data;

Container container = Container.decompress(encryptedData, keys);
if (container == null)
{
logger.warn("Unable to decrypt archive {}", this);
return null;
}

Container container = Container.decompress(data, keys);
byte[] decompressedData = container.data;

if (this.crc != container.crc)
Expand All @@ -99,20 +91,20 @@ public byte[] decompress(byte[] data, int[] keys) throws IOException
throw new IOException("CRC mismatch for " + index.getId() + "/" + this.getArchiveId());
}

if (container.revision != -1 && this.getRevision() != container.revision)
if (container.revision != -1 && this.revision != container.revision)
{
// compressed data doesn't always include a revision, but check it if it does
logger.warn("revision mismatch for archive {}/{}, expected {} was {}",
index.getId(), this.getArchiveId(),
this.getRevision(), container.revision);
this.revision, container.revision);
// I've seen this happen with vanilla caches where the
// revision in the index data differs from the revision
// stored for the archive data on disk... I assume this
// is more correct
this.setRevision(container.revision);
this.revision = container.revision;
}

setCompression(container.compression);
this.compression = container.compression;
return decompressedData;
}

Expand Down
43 changes: 17 additions & 26 deletions cache/src/main/java/net/runelite/cache/fs/Container.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ public static Container decompress(byte[] b, int[] keys) throws IOException
crc32.update(b, 0, 5); // compression + length

byte[] data;
int revision = -1;
switch (compression)
{
case CompressionType.NONE:
Expand All @@ -116,12 +115,6 @@ public static Container decompress(byte[] b, int[] keys) throws IOException
crc32.update(encryptedData, 0, compressedLength);
byte[] decryptedData = decrypt(encryptedData, encryptedData.length, keys);

if (stream.remaining() >= 2)
{
revision = stream.readUnsignedShort();
assert revision != -1;
}

data = decryptedData;

break;
Expand All @@ -134,16 +127,10 @@ public static Container decompress(byte[] b, int[] keys) throws IOException
crc32.update(encryptedData, 0, encryptedData.length);
byte[] decryptedData = decrypt(encryptedData, encryptedData.length, keys);

if (stream.remaining() >= 2)
{
revision = stream.readUnsignedShort();
assert revision != -1;
}

stream = new InputStream(decryptedData);
InputStream decryptedStream = new InputStream(decryptedData);

int decompressedLength = stream.readInt();
data = BZip2.decompress(stream.getRemaining(), compressedLength);
int decompressedLength = decryptedStream.readInt();
data = BZip2.decompress(decryptedStream.getRemaining(), compressedLength);
assert data.length == decompressedLength;

break;
Expand All @@ -156,22 +143,26 @@ public static Container decompress(byte[] b, int[] keys) throws IOException
crc32.update(encryptedData, 0, encryptedData.length);
byte[] decryptedData = decrypt(encryptedData, encryptedData.length, keys);

if (stream.remaining() >= 2)
{
revision = stream.readUnsignedShort();
assert revision != -1;
}
InputStream decryptedStream = new InputStream(decryptedData);

stream = new InputStream(decryptedData);

int decompressedLength = stream.readInt();
data = GZip.decompress(stream.getRemaining(), compressedLength);
int decompressedLength = decryptedStream.readInt();
data = GZip.decompress(decryptedStream.getRemaining(), compressedLength);
assert data.length == decompressedLength;

break;
}
default:
throw new RuntimeException("Unknown decompression type");
throw new RuntimeException("Unknown compression type");
}

int revision = -1;
if (stream.remaining() >= 4)
{
revision = stream.readInt();
}
else if (stream.remaining() >= 2)
{
revision = stream.readUnsignedShort();
}

Container container = new Container(compression, revision);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId>
<version>1.11.23-SNAPSHOT</version>
<version>1.12.0-SNAPSHOT</version>
<packaging>pom</packaging>

<name>RuneLite</name>
Expand Down
2 changes: 1 addition & 1 deletion runelite-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<parent>
<groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId>
<version>1.11.23-SNAPSHOT</version>
<version>1.12.0-SNAPSHOT</version>
</parent>

<artifactId>runelite-api</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions runelite-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<parent>
<groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId>
<version>1.11.23-SNAPSHOT</version>
<version>1.12.0-SNAPSHOT</version>
</parent>

<artifactId>client</artifactId>
Expand All @@ -41,7 +41,7 @@
<git.commit.id.abbrev>nogit</git.commit.id.abbrev>
<git.dirty>false</git.dirty>
<shade.skip>false</shade.skip>
<microbot.version>2.0.35</microbot.version>
<microbot.version>2.0.36</microbot.version>
<microbot.commit.sha>nogit</microbot.commit.sha>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import java.awt.image.VolatileImage;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -115,6 +114,7 @@ public class Hooks implements Callbacks
@Nullable
private final RuntimeConfig runtimeConfig;
private final boolean developerMode;
private final RenderCallbackManager renderCallbackManager;

private Dimension lastStretchedDimensions;
private VolatileImage stretchedImage;
Expand All @@ -130,13 +130,21 @@ public class Hooks implements Callbacks
private boolean rateLimitedError;
private int errorBackoff = 1;

/**
* use {@link RenderCallbackManager} instead
*/
@FunctionalInterface
public interface RenderableDrawListener
@Deprecated
public interface RenderableDrawListener extends RenderCallback
{
boolean draw(Renderable renderable, boolean ui);
}

private final List<RenderableDrawListener> renderableDrawListeners = new ArrayList<>();
@Override
default boolean drawEntity(Renderable renderable, boolean ui)
{
return draw(renderable, ui);
}
}

/**
* Get the Graphics2D for the MainBufferProvider image
Expand Down Expand Up @@ -177,7 +185,8 @@ private Hooks(
ClientUI clientUi,
@Nullable TelemetryClient telemetryClient,
@Nullable RuntimeConfig runtimeConfig,
@Named("developerMode") final boolean developerMode
@Named("developerMode") final boolean developerMode,
RenderCallbackManager renderCallbackManager
)
{
this.client = client;
Expand All @@ -196,6 +205,7 @@ private Hooks(
this.telemetryClient = telemetryClient;
this.runtimeConfig = runtimeConfig;
this.developerMode = developerMode;
this.renderCallbackManager = renderCallbackManager;
eventBus.register(this);
}

Expand Down Expand Up @@ -577,32 +587,34 @@ public void onScriptCallbackEvent(ScriptCallbackEvent scriptCallbackEvent)
eventBus.post(fakeXpDrop);
}

/**
* use {@link RenderCallbackManager#register(RenderCallback)} instead
*/
@Deprecated
public void registerRenderableDrawListener(RenderableDrawListener listener)
{
renderableDrawListeners.add(listener);
renderCallbackManager.register(listener);
}

/**
* use {@link RenderCallbackManager#unregister(RenderCallback)} instead
*/
@Deprecated
public void unregisterRenderableDrawListener(RenderableDrawListener listener)
{
renderableDrawListeners.remove(listener);
renderCallbackManager.unregister(listener);
}

@Override
public boolean draw(Renderable renderable, boolean drawingUi)
{
try
{
for (RenderableDrawListener renderableDrawListener : renderableDrawListeners)
{
if (!renderableDrawListener.draw(renderable, drawingUi))
{
return false;
}
}
return renderCallbackManager.drawEntity(renderable, drawingUi);
}
catch (Exception ex)
{
log.error("exception from renderable draw listener", ex);
log.error("exception from render callback", ex);
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* Copyright (c) 2025, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -22,26 +22,50 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.callback;

/*
* Convert a vertex to screen space
*/
vec3 toScreen(vec3 vertex, float cameraYaw, float cameraPitch, int centerX, int centerY, int zoom) {
float yawSin = sin(cameraYaw);
float yawCos = cos(cameraYaw);

float pitchSin = sin(cameraPitch);
float pitchCos = cos(cameraPitch);

float rotatedX = (vertex.z * yawSin) + (vertex.x * yawCos);
float rotatedZ = (vertex.z * yawCos) - (vertex.x * yawSin);
import net.runelite.api.Renderable;
import net.runelite.api.Scene;
import net.runelite.api.Tile;
import net.runelite.api.TileObject;

float var13 = (vertex.y * pitchCos) - (rotatedZ * pitchSin);
float var12 = (vertex.y * pitchSin) + (rotatedZ * pitchCos);
public interface RenderCallback
{
/**
* Tests if an entity should be rendered.
* This is called multiple times per frame from the client thread.
* Entities are temporary entities (players, npcs, projectiles, spotanims, etc).
* @param renderable the entity
* @param ui true if this test is for drawing the ui (hitbars etc)
* @return
*/
default boolean drawEntity(Renderable renderable, boolean ui)
{
return true;
}

float x = rotatedX * zoom / var12 + centerX;
float y = var13 * zoom / var12 + centerY;
float z = -var12; // in OpenGL depth is negative
/**
* Test if a tile should be drawn.
* This is called on scene upload, by the maploader thread.
* @param scene
* @param tile
* @return
*/
default boolean drawTile(Scene scene, Tile tile)
{
return true;
}

return vec3(x, y, z);
/**
* Test if a tileobject should be drawn.
* This is called on scene upload, by the maploader thread, as well as
* each frame by the client thread for dynamic objects (animated objects)
* @param scene
* @param object
* @return
*/
default boolean drawObject(Scene scene, TileObject object)
{
return true;
}
}
Loading
Loading