mirror of
https://github.com/sirjonasxx/G-Wasm.git
synced 2024-11-26 18:30:52 +01:00
gzip support
This commit is contained in:
parent
ebf899e271
commit
3a76c4ba9d
@ -10,5 +10,18 @@ public class GWasm {
|
||||
|
||||
public static void main(String[] args) throws IOException, InvalidOpCodeException {
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
Module module = new Module("C:\\Users\\jonas\\Desktop\\Projects\\Jznnp\\S\\habbo2020\\rawfiles\\0.23.0_(534)\\habbo2020-global-prod.wasm.gz", true, new ArrayList<>());
|
||||
long end = System.currentTimeMillis();
|
||||
|
||||
System.out.println("Disassemble time: " + (end - start));
|
||||
|
||||
start = System.currentTimeMillis();
|
||||
module.assembleToFile("C:\\Users\\jonas\\Desktop\\Projects\\Jznnp\\S\\habbo2020\\rawfiles\\0.23.0_(534)\\out\\habbo2020-global-prod.wasm.gz", true);
|
||||
end = System.currentTimeMillis();
|
||||
|
||||
System.out.println("Assemble time: " + (end - start));
|
||||
|
||||
System.out.println("hi");
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ import wasm.misc.StreamReplacement;
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
public class Module extends WASMOpCode {
|
||||
|
||||
@ -80,8 +82,12 @@ public class Module extends WASMOpCode {
|
||||
in.close();
|
||||
}
|
||||
|
||||
public Module(String fileName, List<StreamReplacement> streamReplacements) throws IOException, InvalidOpCodeException {
|
||||
this(new BufferedInputStream(new FileInputStream(new File(fileName))), streamReplacements);
|
||||
public Module(String fileName, boolean gzip, List<StreamReplacement> streamReplacements) throws IOException, InvalidOpCodeException {
|
||||
this(new BufferedInputStream(gzip ?
|
||||
new GZIPInputStream(new FileInputStream(new File(fileName))) :
|
||||
new FileInputStream(new File(fileName)))
|
||||
, streamReplacements
|
||||
);
|
||||
}
|
||||
|
||||
private void disassembleCustomSections(BufferedInputStream in) throws IOException, InvalidOpCodeException {
|
||||
@ -129,8 +135,8 @@ public class Module extends WASMOpCode {
|
||||
}
|
||||
}
|
||||
|
||||
public void assembleToFile(String fileName) throws IOException, InvalidOpCodeException {
|
||||
assemble(new FileOutputStream(fileName));
|
||||
public void assembleToFile(String fileName, boolean gzip) throws IOException, InvalidOpCodeException {
|
||||
assemble(gzip ? new GZIPOutputStream(new FileOutputStream(fileName)) : new FileOutputStream(fileName));
|
||||
}
|
||||
|
||||
public Magic getMagic() {
|
||||
|
Loading…
Reference in New Issue
Block a user