CrazyPanda
Ex Rune-Scaper
- Jun 2, 2008
- 3,532
- 273
- 0
This tutorial is on how to use this program with your client.
https://www.rune-server.ee/runescape-development/rs2-client/tools/626093-better-sprite-packer.html
If you don't already have bsp version 1.48 download it
http://www.mediafire.com/file/dl7r1ff5b6i7b6n/bsp_1.48.jar
Step 1: Converting your .idx and .dat files into the updated format
If you are currently using Galkon's format (sprites are in a .idx and .dat) then download my previous version of bsp found here.
http://www.mediafire.com/file/2loev5asxpsamhf/bsp_1.44.jar
Use bsp_1.44 to load your .idx and .dat
once you have that loaded dump them into a folder.
You should now have all of your sprites into a folder like this
if you do then open up bsp_1.48 and load all of those images
then pack them.
Now your sprites are in the updated format, now we have to make your client read them properly.
Next download these dependencies to add to your client, we have to use dependencies because java doesn't have support for LZMA2 compression yet. (hopefully in the future they will add it)
https://www.mediafire.com/?gcn1cwinel5ipeu
Next replace your SpriteLoader with this
Next in your sprite class add this
you'll have to rename your variables example offsetX is drawOffsetX and pixels is raster or myPixels, width is myWidth, everything else i just renaming
If you are totally lost, I took the Battle-OS project and updated to use my sprite format so you can reference that.
https://www.mediafire.com/?h3zv272p5ce3vv7
https://www.rune-server.ee/runescape-development/rs2-client/tools/626093-better-sprite-packer.html

If you don't already have bsp version 1.48 download it
http://www.mediafire.com/file/dl7r1ff5b6i7b6n/bsp_1.48.jar
Step 1: Converting your .idx and .dat files into the updated format
If you are currently using Galkon's format (sprites are in a .idx and .dat) then download my previous version of bsp found here.
http://www.mediafire.com/file/2loev5asxpsamhf/bsp_1.44.jar
Use bsp_1.44 to load your .idx and .dat

once you have that loaded dump them into a folder.

You should now have all of your sprites into a folder like this

if you do then open up bsp_1.48 and load all of those images

then pack them.

Now your sprites are in the updated format, now we have to make your client read them properly.
Next download these dependencies to add to your client, we have to use dependencies because java doesn't have support for LZMA2 compression yet. (hopefully in the future they will add it)
https://www.mediafire.com/?gcn1cwinel5ipeu
Next replace your SpriteLoader with this
Code:
package com.battleos;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import org.apache.commons.compress.compressors.xz.XZCompressorInputStream;
public final class SpriteLoader {
public static Sprite[] sprites;
public static int totalSprites;
public static void load() {
Buffer data = new Buffer(FileUtils.readFile(SignLink.findcachedir() + "main_file_sprites.dat"));
try (DataInputStream dataFile = new DataInputStream(new XZCompressorInputStream(new ByteArrayInputStream(data.buffer)))) {
int totalSprites = dataFile.readInt();
sprites = new Sprite[totalSprites];
for (int index = 0; index < totalSprites; index++) {
sprites[index] = SpriteLoader.decode(dataFile);
sprites[index].setTransparency(255, 0, 255);
}
System.out.println("Sprites Loaded: " + totalSprites);
} catch (IOException ex) {
ex.printStackTrace();
}
}
private static Sprite decode(DataInputStream dat) throws IOException {
Sprite sprite = new Sprite();
while (true) {
byte opcode = dat.readByte();
if (opcode == 0) {
return sprite;
} else if (opcode == 1) {
sprite.setId(dat.readShort());
} else if (opcode == 2) {
sprite.setName(dat.readUTF());
} else if (opcode == 3) {
sprite.setWidth(dat.readShort());
} else if (opcode == 4) {
sprite.setHeight(dat.readShort());
} else if (opcode == 5) {
sprite.setOffsetX(dat.readShort());
} else if (opcode == 6) {
sprite.setOffsetY(dat.readShort());
} else if (opcode == 7) {
int indexLength = dat.readInt();
int[] pixels = new int[indexLength];
for (int i = 0; i < pixels.length; i++) {
pixels[i] = dat.readInt();
}
sprite.pixels = pixels;
}
}
}
}
Next in your sprite class add this
Code:
private int idenfier;
private String name;
public Sprite() {
}
public int getId() {
return idenfier;
}
public void setId(int id) {
this.idenfier = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int[] getPixels() {
return pixels;
}
public void setPixels(int[] pixels) {
this.pixels = pixels;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public int getOffsetX() {
return offsetX;
}
public void setOffsetX(int offsetX) {
this.offsetX = offsetX;
}
public int getOffsetY() {
return offsetY;
}
public void setOffsetY(int offsetY) {
this.offsetY = offsetY;
}
you'll have to rename your variables example offsetX is drawOffsetX and pixels is raster or myPixels, width is myWidth, everything else i just renaming
If you are totally lost, I took the Battle-OS project and updated to use my sprite format so you can reference that.
https://www.mediafire.com/?h3zv272p5ce3vv7