diff --git a/cachedump/src/org/moparscape/cacheutils/v508/Main.java b/cachedump/src/org/moparscape/cacheutils/v508/Main.java index 624d557..297a97a 100644 --- a/cachedump/src/org/moparscape/cacheutils/v508/Main.java +++ b/cachedump/src/org/moparscape/cacheutils/v508/Main.java @@ -18,7 +18,7 @@ public class Main { if (dump.exists()) if (!deleteDir(dump)) System.out.println("can't delete directory"); - if (!dump.mkdir()) { + if (!dump.mkdirs()) { System.out.println("can't create directory: " + dump.getPath()); return; } @@ -56,12 +56,8 @@ public class Main { println("data for: " + index + "," + id); - long hash = (long) ((index << 16) + id); - File file = new File(folderName + hash); - if (file.exists()) { - println("oh shit, collision!!!!!!"); - System.exit(1); - } + //long hash = (long) ((index << 16) + id); + File file = checkFile(index, id); DataOutputStream out = new DataOutputStream(new FileOutputStream(file)); out.writeByte(index); out.writeShort(id); @@ -86,43 +82,39 @@ public class Main { public void dumpUpdatekeys() throws Exception { int index = 255; short id = 255; - long hash = (long) ((index << 16) + id); - File file = new File(folderName + hash); - if (file.exists()) { - println("oh shit, collision (with update keys)!!!!!!"); - System.exit(1); - } + //long hash = (long) ((index << 16) + id); + File file = checkFile(index, id); DataOutputStream out = new DataOutputStream(new FileOutputStream(file)); int[] UPDATE_KEYS = { - 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xd8, - 0x84, 0xa1, 0xa1, 0x2b, 0x00, 0x00, 0x00, 0xba, - 0x58, 0x64, 0xe8, 0x14, 0x00, 0x00, 0x00, 0x7b, - 0xcc, 0xa0, 0x7e, 0x23, 0x00, 0x00, 0x00, 0x48, - 0x20, 0x0e, 0xe3, 0x6e, 0x00, 0x00, 0x01, 0x88, - 0xec, 0x0d, 0x58, 0xed, 0x00, 0x00, 0x00, 0x71, - 0xb9, 0x4c, 0xc0, 0x50, 0x00, 0x00, 0x01, 0x8b, - 0x5b, 0x61, 0x79, 0x20, 0x00, 0x00, 0x00, 0x0c, - 0x0c, 0x69, 0xb1, 0xc8, 0x00, 0x00, 0x02, 0x31, - 0xc8, 0x56, 0x67, 0x52, 0x00, 0x00, 0x00, 0x69, - 0x78, 0x17, 0x7b, 0xe2, 0x00, 0x00, 0x00, 0xc3, - 0x29, 0x76, 0x27, 0x6a, 0x00, 0x00, 0x00, 0x05, - 0x44, 0xe7, 0x75, 0xcb, 0x00, 0x00, 0x00, 0x08, - 0x7d, 0x21, 0x80, 0xd5, 0x00, 0x00, 0x01, 0x58, - 0xeb, 0x7d, 0x49, 0x8e, 0x00, 0x00, 0x00, 0x0c, - 0xf4, 0xdf, 0xd6, 0x4d, 0x00, 0x00, 0x00, 0x18, - 0xec, 0x33, 0x31, 0x7e, 0x00, 0x00, 0x00, 0x01, - 0xf7, 0x7a, 0x09, 0xe3, 0x00, 0x00, 0x00, 0xd7, - 0xe6, 0xa7, 0xa5, 0x18, 0x00, 0x00, 0x00, 0x45, - 0xb5, 0x0a, 0xe0, 0x64, 0x00, 0x00, 0x00, 0x75, - 0xba, 0xf2, 0xa2, 0xb9, 0x00, 0x00, 0x00, 0x5f, - 0x31, 0xff, 0xfd, 0x16, 0x00, 0x00, 0x01, 0x48, - 0x03, 0xf5, 0x55, 0xab, 0x00, 0x00, 0x00, 0x1e, - 0x85, 0x03, 0x5e, 0xa7, 0x00, 0x00, 0x00, 0x23, - 0x4e, 0x81, 0xae, 0x7d, 0x00, 0x00, 0x00, 0x18, - 0x67, 0x07, 0x33, 0xe3, 0x00, 0x00, 0x00, 0x14, - 0xab, 0x81, 0x05, 0xac, 0x00, 0x00, 0x00, 0x03, - 0x24, 0x75, 0x85, 0x14, 0x00, 0x00, 0x00, 0x36 + 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xd8, + 0x84, 0xa1, 0xa1, 0x2b, 0x00, 0x00, 0x00, 0xba, + 0x58, 0x64, 0xe8, 0x14, 0x00, 0x00, 0x00, 0x7b, + 0xcc, 0xa0, 0x7e, 0x23, 0x00, 0x00, 0x00, 0x48, + 0x20, 0x0e, 0xe3, 0x6e, 0x00, 0x00, 0x01, 0x88, + 0xec, 0x0d, 0x58, 0xed, 0x00, 0x00, 0x00, 0x71, + 0xb9, 0x4c, 0xc0, 0x50, 0x00, 0x00, 0x01, 0x8b, + 0x5b, 0x61, 0x79, 0x20, 0x00, 0x00, 0x00, 0x0c, + 0x0c, 0x69, 0xb1, 0xc8, 0x00, 0x00, 0x02, 0x31, + 0xc8, 0x56, 0x67, 0x52, 0x00, 0x00, 0x00, 0x69, + 0x78, 0x17, 0x7b, 0xe2, 0x00, 0x00, 0x00, 0xc3, + 0x29, 0x76, 0x27, 0x6a, 0x00, 0x00, 0x00, 0x05, + 0x44, 0xe7, 0x75, 0xcb, 0x00, 0x00, 0x00, 0x08, + 0x7d, 0x21, 0x80, 0xd5, 0x00, 0x00, 0x01, 0x58, + 0xeb, 0x7d, 0x49, 0x8e, 0x00, 0x00, 0x00, 0x0c, + 0xf4, 0xdf, 0xd6, 0x4d, 0x00, 0x00, 0x00, 0x18, + 0xec, 0x33, 0x31, 0x7e, 0x00, 0x00, 0x00, 0x01, + 0xf7, 0x7a, 0x09, 0xe3, 0x00, 0x00, 0x00, 0xd7, + 0xe6, 0xa7, 0xa5, 0x18, 0x00, 0x00, 0x00, 0x45, + 0xb5, 0x0a, 0xe0, 0x64, 0x00, 0x00, 0x00, 0x75, + 0xba, 0xf2, 0xa2, 0xb9, 0x00, 0x00, 0x00, 0x5f, + 0x31, 0xff, 0xfd, 0x16, 0x00, 0x00, 0x01, 0x48, + 0x03, 0xf5, 0x55, 0xab, 0x00, 0x00, 0x00, 0x1e, + 0x85, 0x03, 0x5e, 0xa7, 0x00, 0x00, 0x00, 0x23, + 0x4e, 0x81, 0xae, 0x7d, 0x00, 0x00, 0x00, 0x18, + 0x67, 0x07, 0x33, 0xe3, 0x00, 0x00, 0x00, 0x14, + 0xab, 0x81, 0x05, 0xac, 0x00, 0x00, 0x00, 0x03, + 0x24, 0x75, 0x85, 0x14, 0x00, 0x00, 0x00, 0x36 }; for (int i : UPDATE_KEYS) @@ -131,6 +123,22 @@ public class Main { out.close(); } + public static File checkFile(int index, short id) throws Exception { + File file = new File(folderName + index); + if (!file.exists()) + if (!file.mkdir()) { + println("can't create dir"); + System.exit(1); + } + + file = new File(folderName + index + "/" + id); + if (file.exists()) { + println("oh shit, collision!!!!!!"); + System.exit(1); + } + return file; + } + public static boolean deleteDir(File dir) { if (dir.isDirectory()) { String[] children = dir.list(); diff --git a/src/org/moparscape/userver/v508/OndemandServer.java b/src/org/moparscape/userver/v508/OndemandServer.java index 27255f9..01b0c55 100644 --- a/src/org/moparscape/userver/v508/OndemandServer.java +++ b/src/org/moparscape/userver/v508/OndemandServer.java @@ -17,7 +17,7 @@ import java.net.URLConnection; */ public class OndemandServer extends Server { // TODO: this must dump to folders, too many files in one folder - public static final String odsPath = "508/"; + public static final String odsPath = "508/%d/%d"; public static final int clientVersion = 508; public byte[] buffer = new byte[1024]; @@ -108,10 +108,11 @@ public class OndemandServer extends Server { // if(true) // continue; - long hash = (long) ((index << 16) + id); + //long hash = (long) ((index << 16) + id); //System.out.println("request " + hash); + System.out.println(String.format(odsPath, index, id)); - URLConnection url = getHttpURLConnection(odsPath + hash); + URLConnection url = getHttpURLConnection(String.format(odsPath, index, id)); // if url is null, custom and default cannot be reached, continue if (url == null) continue;