Parcourir la source

quickndirty file format unwiggler

masterX244 il y a 2 ans
Parent
commit
a131ed952c
1 fichiers modifiés avec 44 ajouts et 0 suppressions
  1. 44 0
      QuickStuff/src/main/java/QuickVerifyCrap/MickeyBinSplitter.java

+ 44 - 0
QuickStuff/src/main/java/QuickVerifyCrap/MickeyBinSplitter.java

@@ -0,0 +1,44 @@
+package QuickVerifyCrap;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.ByteBuffer;
+
+public class MickeyBinSplitter {
+    public static void main(String[] args) {
+        try (RandomAccessFile file = new RandomAccessFile(args[0],"r")) {
+            File out = new File(args[0]+"out");
+            out.mkdirs();
+            file.seek(0x6b);
+                            //guessed from file reading
+            for(int i=0; i < 0x29;i++)
+            {
+                byte[] swapMe = new byte[4];
+                file.read(swapMe);
+                ByteBuffer wrapped = ByteBuffer.wrap(new byte[]{swapMe[3],swapMe[2],swapMe[1],swapMe[0]}); // big-endian by default
+                int offsetFile = wrapped.getInt();
+                System.out.println(offsetFile);
+                long retval = file.getFilePointer();
+
+                file.seek(offsetFile);
+
+                file.read(swapMe);
+                wrapped = ByteBuffer.wrap(new byte[]{swapMe[3],swapMe[2],swapMe[1],swapMe[0]}); // big-endian by default
+                int lenFile = wrapped.getInt();
+                System.out.println(lenFile);
+                byte[] innerFile = new byte[lenFile];
+                file.read(innerFile);
+                file.seek(retval);
+                try (RandomAccessFile outRandom = new RandomAccessFile(new File(out, i + ".bin"), "rw")) {
+                    outRandom.write(innerFile);
+                }
+            }
+        } catch (FileNotFoundException e) {
+            throw new RuntimeException(e);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}