bump, nobody got experience with MIDI?
|
So far I've decoded the "main" method to decode the songs in the cache:
Shouldn't this mean I have a regular MIDI file in the byte array now: https://www.rune-server.ee/runescape...i-encoder.htmlCode:@Override public void decode(byte[] data) { InputStream stream = new InputStream(data); stream.setOffset(stream.getBuffer().length - 3); int i = stream.readUByte(); int i_0_ = stream.readUShort(); int i_1_ = 14 + i * 10; stream.setOffset(0); int i_2_ = 0; int i_3_ = 0; int i_4_ = 0; int i_5_ = 0; int i_6_ = 0; int i_7_ = 0; int i_8_ = 0; int i_9_ = 0; while_7_: for (int i_10_ = 0; i_10_ < i; i_10_++) { int i_11_ = -1; for (;;) { int i_12_ = stream.readUByte(); if (i_12_ != i_11_) i_1_++; i_11_ = i_12_ & 0xf; if (i_12_ == 7) continue while_7_; if (i_12_ == 23) i_2_++; else if (i_11_ == 0) i_4_++; else if (i_11_ == 1) i_5_++; else if (i_11_ == 2) i_3_++; else if (i_11_ == 3) i_6_++; else if (i_11_ == 4) i_7_++; else if (i_11_ == 5) i_8_++; else { if (i_11_ != 6) break; i_9_++; } } throw new RuntimeException(); } i_1_ += 5 * i_2_; i_1_ += 2 * (i_4_ + i_5_ + i_3_ + i_6_ + i_8_); i_1_ += i_7_ + i_9_; int i_13_ = stream.getOffset(); int i_14_ = i + i_2_ + i_3_ + i_4_ + i_5_ + i_6_ + i_7_ + i_8_ + i_9_; for (int i_15_ = 0; i_15_ < i_14_; i_15_++) stream.method3770(); i_1_ += stream.getOffset() - i_13_; int i_16_ = stream.getOffset(); int i_17_ = 0; int i_18_ = 0; int i_19_ = 0; int i_20_ = 0; int i_21_ = 0; int i_22_ = 0; int i_23_ = 0; int i_24_ = 0; int i_25_ = 0; int i_26_ = 0; int i_27_ = 0; int i_28_ = 0; int i_29_ = 0; for (int i_30_ = 0; i_30_ < i_3_; i_30_++) { i_29_ = i_29_ + stream.readUByte() & 0x7f; if (i_29_ == 0 || i_29_ == 32) i_9_++; else if (i_29_ == 1) i_17_++; else if (i_29_ == 33) i_18_++; else if (i_29_ == 7) i_19_++; else if (i_29_ == 39) i_20_++; else if (i_29_ == 10) i_21_++; else if (i_29_ == 42) i_22_++; else if (i_29_ == 99) i_23_++; else if (i_29_ == 98) i_24_++; else if (i_29_ == 101) i_25_++; else if (i_29_ == 100) i_26_++; else if (i_29_ == 64 || i_29_ == 65 || i_29_ == 120 || i_29_ == 121 || i_29_ == 123) i_27_++; else i_28_++; } int i_31_ = 0; int i_32_ = stream.getOffset(); stream.skip(i_27_); int i_33_ = stream.getOffset(); stream.skip(i_8_); int i_34_ = stream.getOffset(); stream.skip(i_7_); int i_35_ = stream.getOffset(); stream.skip(i_6_); int i_36_ = stream.getOffset(); stream.skip(i_17_); int i_37_ = stream.getOffset(); stream.skip(i_19_); int i_38_ = stream.getOffset(); stream.skip(i_21_); int i_39_ = stream.getOffset(); stream.skip(i_8_ + i_4_ + i_5_); int i_40_ = stream.getOffset(); stream.skip(i_4_); int i_41_ = stream.getOffset(); stream.skip(i_28_); int i_42_ = stream.getOffset(); stream.skip(i_5_); int i_43_ = stream.getOffset(); stream.skip(i_18_); int i_44_ = stream.getOffset(); stream.skip(i_20_); int i_45_ = stream.getOffset(); stream.skip(i_22_); int i_46_ = stream.getOffset(); stream.skip(i_9_); int i_47_ = stream.getOffset(); stream.skip(i_6_); int i_48_ = stream.getOffset(); stream.skip(i_23_); int i_49_ = stream.getOffset(); stream.skip(i_24_); int i_50_ = stream.getOffset(); stream.skip(i_25_); int i_51_ = stream.getOffset(); stream.skip(i_26_); int i_52_ = stream.getOffset(); stream.skip(i_2_); aByteArray7543 = new byte[i_1_]; OutputStream class330_sub46_53_ = new OutputStream(aByteArray7543); class330_sub46_53_.writeInt(1297377380); class330_sub46_53_.writeInt(6); class330_sub46_53_.writeShort(i > 1 ? 1 : 0); class330_sub46_53_.writeShort(i); class330_sub46_53_.writeShort(i_0_); stream.setOffset(i_13_); int i_54_ = 0; int i_55_ = 0; int i_56_ = 0; int i_57_ = 0; int i_58_ = 0; int i_59_ = 0; int i_60_ = 0; int[] is = new int[128]; i_29_ = 0; for (int i_61_ = 0; i_61_ < i; i_61_++) { class330_sub46_53_.writeInt(1297379947); class330_sub46_53_.skip(4); int i_62_ = class330_sub46_53_.getOffset(); int i_63_ = -1; while_8_: do { for (;;) { int i_64_ = stream.method3770(); class330_sub46_53_.method3753(i_64_); int i_65_ = stream.getBuffer()[i_31_++] & 0xff; boolean bool = i_65_ != i_63_; i_63_ = i_65_ & 0xf; if (i_65_ == 7) { if (bool) class330_sub46_53_.writeByte(255); class330_sub46_53_.writeByte(47); class330_sub46_53_.writeByte(0); break while_8_; } if (i_65_ == 23) { if (bool) class330_sub46_53_.writeByte(255); class330_sub46_53_.writeByte(81); class330_sub46_53_.writeByte(3); class330_sub46_53_.writeByte((stream.getBuffer()[i_52_++])); class330_sub46_53_.writeByte((stream.getBuffer()[i_52_++])); class330_sub46_53_.writeByte((stream.getBuffer()[i_52_++])); } else { i_54_ ^= i_65_ >> 4; if (i_63_ == 0) { if (bool) class330_sub46_53_.writeByte(144 + i_54_); i_55_ += stream.getBuffer()[i_39_++]; i_56_ += stream.getBuffer()[i_40_++]; class330_sub46_53_.writeByte(i_55_ & 0x7f); class330_sub46_53_.writeByte(i_56_ & 0x7f); } else if (i_63_ == 1) { if (bool) class330_sub46_53_.writeByte(128 + i_54_); i_55_ += stream.getBuffer()[i_39_++]; i_57_ += stream.getBuffer()[i_42_++]; class330_sub46_53_.writeByte(i_55_ & 0x7f); class330_sub46_53_.writeByte(i_57_ & 0x7f); } else if (i_63_ == 2) { if (bool) class330_sub46_53_.writeByte(176 + i_54_); i_29_ = i_29_ + (stream.getBuffer()[i_16_++]) & 0x7f; class330_sub46_53_.writeByte(i_29_); int i_66_; if (i_29_ == 0 || i_29_ == 32) i_66_ = stream.getBuffer()[i_46_++]; else if (i_29_ == 1) i_66_ = stream.getBuffer()[i_36_++]; else if (i_29_ == 33) i_66_ = stream.getBuffer()[i_43_++]; else if (i_29_ == 7) i_66_ = stream.getBuffer()[i_37_++]; else if (i_29_ == 39) i_66_ = stream.getBuffer()[i_44_++]; else if (i_29_ == 10) i_66_ = stream.getBuffer()[i_38_++]; else if (i_29_ == 42) i_66_ = stream.getBuffer()[i_45_++]; else if (i_29_ == 99) i_66_ = stream.getBuffer()[i_48_++]; else if (i_29_ == 98) i_66_ = stream.getBuffer()[i_49_++]; else if (i_29_ == 101) i_66_ = stream.getBuffer()[i_50_++]; else if (i_29_ == 100) i_66_ = stream.getBuffer()[i_51_++]; else if (i_29_ == 64 || i_29_ == 65 || i_29_ == 120 || i_29_ == 121 || i_29_ == 123) i_66_ = stream.getBuffer()[i_32_++]; else i_66_ = stream.getBuffer()[i_41_++]; i_66_ += is[i_29_]; is[i_29_] = i_66_; class330_sub46_53_.writeByte(i_66_ & 0x7f); } else if (i_63_ == 3) { if (bool) class330_sub46_53_.writeByte(224 + i_54_); i_58_ += stream.getBuffer()[i_47_++]; i_58_ += stream.getBuffer()[i_35_++] << 7; class330_sub46_53_.writeByte(i_58_ & 0x7f); class330_sub46_53_.writeByte(i_58_ >> 7 & 0x7f); } else if (i_63_ == 4) { if (bool) class330_sub46_53_.writeByte(208 + i_54_); i_59_ += stream.getBuffer()[i_34_++]; class330_sub46_53_.writeByte(i_59_ & 0x7f); } else if (i_63_ == 5) { if (bool) class330_sub46_53_.writeByte(160 + i_54_); i_55_ += stream.getBuffer()[i_39_++]; i_60_ += stream.getBuffer()[i_33_++]; class330_sub46_53_.writeByte(i_55_ & 0x7f); class330_sub46_53_.writeByte(i_60_ & 0x7f); } else { if (i_63_ != 6) break; if (bool) class330_sub46_53_.writeByte(192 + i_54_); class330_sub46_53_.writeByte((stream.getBuffer()[i_46_++])); } } } throw new RuntimeException(); } while (false); class330_sub46_53_.method3750((class330_sub46_53_.getOffset()) - i_62_); } }
Because when I export the array (aByteArray7543) I get an error saying the file is corrupted. I've also tried exporting the array directly from the client during runtime but it doesn't play either. What am I missing?
----- EDIT -----
Here's the raw .mid file, you can see the header is kind of similar to the next one which is a regular working sample: http://pastebin.com/x7wprdQ0
Here's a regular sample that runs correctly on WMP: http://pastebin.com/N7feUzx1
Heres an encoder if thats any help: https://www.rune-server.ee/runescape...i-encoder.html
PS. feel free to hit me up if u figure it out.
Need this too.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |