This commit is contained in:
sirjonasxx 2020-11-10 05:28:22 +01:00
parent 573e5af2e2
commit dc8a93518f
2 changed files with 28 additions and 8 deletions

View File

@ -13,7 +13,7 @@ public class Main {
public static void main(String[] args) throws IOException, InvalidOpCodeException {
File unityWasmCode = new File("C:\\Users\\jonas\\Desktop\\Projects\\Jznnp\\S\\habbo2020\\rawfiles\\habbo2020-global-prod.wasm.code.unityweb");
File unityWasmCode = new File("C:\\Users\\jonas\\Desktop\\Projects\\Jznnp\\S\\habbo2020\\rawfiles\\0.5.2_(1)\\habbo2020-global-prod.wasm.code.unityweb");
InputStream targetStream = new FileInputStream(unityWasmCode);
BufferedInputStream in = new BufferedInputStream(targetStream);
@ -21,8 +21,15 @@ public class Main {
Module module = new Module(in);
long time_after = System.currentTimeMillis();
System.out.println(String.format("%d", time_after - time_before));
System.out.println("test");
System.out.println(String.format("disassemble time: %d", time_after - time_before));
FileOutputStream habAssembled = new FileOutputStream("C:\\Users\\jonas\\Desktop\\Projects\\Jznnp\\S\\habbo2020\\rawfiles\\0.5.2_(1)\\out\\GWASM-global-prod.wasm.code.unityweb");
time_before = System.currentTimeMillis();
module.assemble(habAssembled);
time_after = System.currentTimeMillis();
System.out.println(String.format("assemble time: %d", time_after - time_before));
}
}

View File

@ -124,15 +124,28 @@ public class Module extends WASMOpCode {
@Override
public void assemble(OutputStream out) throws IOException, InvalidOpCodeException {
Section[] sections = new Section[]{typeSection, importSection, functionSection, tableSection,
memorySection, globalSection, exportSection, startSection, elementSection, codeSection,
dataSection};
// Section[] sections = new Section[]{typeSection, importSection, functionSection, tableSection,
// memorySection, globalSection, exportSection, startSection, elementSection, codeSection,
// dataSection};
//
// for (int i = 0; i < 11; i++) {
// assembleCustomSections(out, i);
// sections[i].assemble(out);
// }
// assembleCustomSections(out, 11);
for (int i = 0; i < 12; i++) {
magic.assemble(out);
version.assemble(out);
Section[] sections = new Section[]{typeSection, importSection, functionSection, globalSection, exportSection,
elementSection, codeSection,
dataSection};
for (int i = 0; i < 8; i++) {
assembleCustomSections(out, i);
sections[i].assemble(out);
}
assembleCustomSections(out, 11);
assembleCustomSections(out, 8);
}
private void assembleCustomSections(OutputStream out, int location) throws IOException, InvalidOpCodeException {