Jump to content
  • 0
Sign in to follow this  
manpaint55

Need help (unable to load com.rs.tools.MidiDumper)

Question

I have tried to dump 667 midis with this code but is dont work...


the code

[CODE]import java.io.*;
import java.util.zip.GZIPInputStream;

public class MidiDumper {

private static final String folder = "C:\\Users\\admin\\Desktop\\Autres Dosiers (1 2 3)\\autre 2\\runescape private server\\runeremake\\Pure 667 Feather Server\\data\\cache";
private static final String savefolder = "C:\\save\\";
private static DataInputStream cache;
public static void main(String args[]) throws Exception {
File f = new File(folder + "main_file_cache.dat2");
byte bytes[] = new byte[(int) f.length()];
new FileInputStream(f).read(bytes);
BufferedInputStream cache2 = new BufferedInputStream(new ByteArrayInputStream(bytes));
cache = new DataInputStream(cache2);
cache.mark(bytes.length);
DataInputStream midi = new DataInputStream(new FileInputStream(folder + "main_file_cache.idx11"));
int count = 0;
while (midi.available() > 0) {
int length = (midi.readUnsignedByte() << 16) + (midi.readUnsignedByte() << 8) + midi.readUnsignedByte();
int offset = (midi.readUnsignedByte() << 16) + (midi.readUnsignedByte() << 8) + midi.readUnsignedByte();
byte[] b = readFile(length, offset);
if(b == null) continue;
File file = new File(savefolder + "midi" + (++count) + ".mid");
if(!file.exists()) if(!file.createNewFile()) continue;
RandomAccessFile raf = new RandomAccessFile(file, "rw");
raf.write(b);
raf.close();
}
}
public static byte[] getParody(int index) throws Exception {
cache.reset();
byte buffer[] = new byte[520];
int jump = index * 520;
cache.skipBytes(jump);
cache.readFully(buffer);
return buffer;
}
public static byte[] readFile(int size, int offset) throws Exception {
byte b[] = getFile(size, offset);
int length = ((b[5] & 0xff) << 24) + ((b[6] & 0xff) << 16) + ((b[7] & 0xff) << 8) + b[8];
if(length > 0) {
if(b[0] == 2) {
GZIPInputStream d = new GZIPInputStream(new ByteArrayInputStream(b, 9, length));
byte z[] = new byte[b.length];
int i = d.read(z);
byte x[] = new byte[i];
System.arraycopy(z, 0, x, 0, i);
return x;
} else if(b[0] == 1) {
System.out.println("Fu**in' sh**, it's not a midi!!!");
return null;
}
return b;
}
return null;
}
public static byte[] getFile(int size, int offset) throws Exception {
if(offset <= 0) return null;
byte outfile[] = new byte[size];
int bits = offset;
int length = 0;
while(true) {
byte buffer[] = getParody(bits);
if(buffer == null) return null;
bits = ((buffer[4] & 0xff) << 16) + ((buffer[5] & 0xff) << 8) + (buffer[6] & 0xff);
if(size - length - 8 > 512) {
System.arraycopy(buffer, 8, outfile, length, 512);
} else {
System.arraycopy(buffer, 8, outfile, length, size - length - 8);
return outfile;
}
length += 512;
}
}
}[/CODE]


Any idea to fix/get this class?

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0
Post your erorr:confused:

Share this post


Link to post
Share on other sites
  • 0
[quote name='So Clear']Post your erorr:confused:[/QUOTE]

unable to load com.rs.tools.MidiDumper

Share this post


Link to post
Share on other sites
  • 0
[quote name='manpaint55']I have tried to dump 667 midis with this code but is dont work...


the code

[CODE]import java.io.*;
import java.util.zip.GZIPInputStream;

public class MidiDumper {

private static final String folder = "C:\\Users\\admin\\Desktop\\Autres Dosiers (1 2 3)\\autre 2\\runescape private server\\runeremake\\Pure 667 Feather Server\\data\\cache";
private static final String savefolder = "C:\\save\\";
private static DataInputStream cache;
public static void main(String args[]) throws Exception {
File f = new File(folder + "main_file_cache.dat2");
byte bytes[] = new byte[(int) f.length()];
new FileInputStream(f).read(bytes);
BufferedInputStream cache2 = new BufferedInputStream(new ByteArrayInputStream(bytes));
cache = new DataInputStream(cache2);
cache.mark(bytes.length);
DataInputStream midi = new DataInputStream(new FileInputStream(folder + "main_file_cache.idx11"));
int count = 0;
while (midi.available() > 0) {
int length = (midi.readUnsignedByte() << 16) + (midi.readUnsignedByte() << 8) + midi.readUnsignedByte();
int offset = (midi.readUnsignedByte() << 16) + (midi.readUnsignedByte() << 8) + midi.readUnsignedByte();
byte[] b = readFile(length, offset);
if(b == null) continue;
File file = new File(savefolder + "midi" + (++count) + ".mid");
if(!file.exists()) if(!file.createNewFile()) continue;
RandomAccessFile raf = new RandomAccessFile(file, "rw");
raf.write(b);
raf.close();
}
}
public static byte[] getParody(int index) throws Exception {
cache.reset();
byte buffer[] = new byte[520];
int jump = index * 520;
cache.skipBytes(jump);
cache.readFully(buffer);
return buffer;
}
public static byte[] readFile(int size, int offset) throws Exception {
byte b[] = getFile(size, offset);
int length = ((b[5] & 0xff) << 24) + ((b[6] & 0xff) << 16) + ((b[7] & 0xff) << 8) + b[8];
if(length > 0) {
if(b[0] == 2) {
GZIPInputStream d = new GZIPInputStream(new ByteArrayInputStream(b, 9, length));
byte z[] = new byte[b.length];
int i = d.read(z);
byte x[] = new byte[i];
System.arraycopy(z, 0, x, 0, i);
return x;
} else if(b[0] == 1) {
System.out.println("Fu**in' sh**, it's not a midi!!!");
return null;
}
return b;
}
return null;
}
public static byte[] getFile(int size, int offset) throws Exception {
if(offset <= 0) return null;
byte outfile[] = new byte[size];
int bits = offset;
int length = 0;
while(true) {
byte buffer[] = getParody(bits);
if(buffer == null) return null;
bits = ((buffer[4] & 0xff) << 16) + ((buffer[5] & 0xff) << 8) + (buffer[6] & 0xff);
if(size - length - 8 > 512) {
System.arraycopy(buffer, 8, outfile, length, 512);
} else {
System.arraycopy(buffer, 8, outfile, length, size - length - 8);
return outfile;
}
length += 512;
}
}
}[/CODE]


Any idea to fix/get this class?[/QUOTE]

All I see is imports... Wheres the package?

Share this post


Link to post
Share on other sites
  • 0
[quote name='Chronicscape']All I see is imports... Wheres the package?[/QUOTE]

Same here.

Share this post


Link to post
Share on other sites
  • 0
in the original post i found this but i think is only for repack login music

you should be able to pack it like this using openrs

[CODE]public static void main(String[] args) throws IOException {
Cache cache = new Cache(FileStore.open("cachedir"));
File f = new File("time");
ByteBuffer buffer = ByteBuffer.allocate((int) f.length());
new FileInputStream(f).getChannel().read(buffer);
cache.write(6, 0, new Container(0, buffer, 1)); //replaces login music
cache.close();
}[/CODE] Edited by manpaint55

Share this post


Link to post
Share on other sites
Sign in to follow this  

×