Browse Source

Full process flow added for changing prompts

LH 3 năm trước cách đây
mục cha
commit
a6976f9f04

+ 1 - 0
SenaBitWiggler/build.gradle

@@ -25,4 +25,5 @@ repositories{
 dependencies{
     compile "org.yaml:snakeyaml:1.14"
     compile("com.google.guava:guava:31.0.1-jre")
+	compile( 'info.picocli:picocli:4.6.2')
 }

+ 22 - 0
SenaBitWiggler/src/main/java/de/nplusc/izc/senabitwiggler/Configuration.java

@@ -0,0 +1,22 @@
+package de.nplusc.izc.senabitwiggler;
+
+public class Configuration {
+    private String BlueLabPath;
+    private String SoxPath;
+
+    public String getBlueLabPath() {
+        return BlueLabPath;
+    }
+
+    public void setBlueLabPath(String blueLabPath) {
+        BlueLabPath = blueLabPath;
+    }
+
+    public String getSoxPath() {
+        return SoxPath;
+    }
+
+    public void setSoxPath(String soxPath) {
+        SoxPath = soxPath;
+    }
+}

+ 93 - 453
SenaBitWiggler/src/main/java/de/nplusc/izc/senabitwiggler/EntryPoint.java

@@ -1,437 +1,68 @@
 package de.nplusc.izc.senabitwiggler;
 
-import com.google.common.base.Charsets;
-import com.google.common.base.Strings;
-import com.google.common.primitives.Ints;
-import com.google.common.primitives.Longs;
-import com.google.common.primitives.Shorts;
-import org.yaml.snakeyaml.Yaml;
-
 import java.io.*;
-import java.lang.reflect.Field;
-import java.nio.ByteBuffer;
-import java.nio.charset.Charset;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.Arrays;
-import java.util.Locale;
-
-public class EntryPoint
-{
-    public static void main(String[] args)
-    {
-        if(args.length!=4)
-        {
-            printUsage();
-            return;
-        }
-        boolean extract = args[0].equalsIgnoreCase("extract");
-        boolean immport = args[0].equalsIgnoreCase("import");
-
-        boolean regularfuckery = extract||immport;
-
-        boolean vmexport = args[0].equalsIgnoreCase("extractvm");
-        boolean importvm = args[0].equalsIgnoreCase("importvm");
 
-        boolean vmfuckery = vmexport||importvm;
-
-        boolean disasm = args[0].equalsIgnoreCase("disasm");
-
-
-
-
-        boolean incoming = immport|importvm;
+import org.yaml.snakeyaml.Yaml;
+import picocli.CommandLine;
+import picocli.CommandLine.Command;
+import picocli.CommandLine.Option;
+import picocli.CommandLine.Parameters;
 
-        boolean outgoing = extract||vmexport||disasm;
+public class EntryPoint implements Runnable
+{
+    @Parameters(index = "0", description = "The file whose checksum to calculate.")
+    private Modes mode;
 
-        if(!(extract||immport||vmexport||importvm||disasm))
-        {
-            printUsage();
-            return;
-        }
 
-        boolean shorty = args[1].equalsIgnoreCase("short");
-        boolean longy = args[1].equalsIgnoreCase("long");
+    @Parameters(index = "1", description = "Firmware File to dissect/reassemble")
+    private File input;
 
-        if(!(shorty||longy)&&regularfuckery)
-        {
-            printUsage();
-            return;
-        }
-        else if(vmfuckery||disasm)
-        {
-            shorty = false;
-            longy = false;
-        }
+    @Parameters(index = "2", description = "Disassembled Data Folder")
+    private File output;
 
-        if(shorty)
-        {
-            System.out.println("Need to debug the format more first. Aborting now");
-            return;
-        }
+    @Parameters(index = "3", description = "Head")
+    private String headset;
 
-        File input = new File(args[2]);
-        if(incoming&&input.exists())
-        {
-            System.out.println("Refusing to overwrite a existing firmware archive. Use a fresh name instead");
-            return;
-        }
-        if(outgoing&&!input.exists())
-        {
-            System.out.println("Can't extract thin air. Give a file please");
-        }
+    public static String SoxPath = "";
+    public static String BlueLabPath = "";
 
-        if(outgoing&&!disasm)
-        {
-            makeSureThatOutFolderIsCreated(args[3]);
-        }
+    public static final String APPDIR = new File(EntryPoint.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParentFile().getParent();
 
-        if(extract)
+    public static void main(String[] args)
+    {
+        Yaml y = new Yaml();
+        File cfg = new File(APPDIR+File.separator+"config.yml");
+        if(cfg.exists())
         {
-            if(longy)
-            {
-                try {
-                    extractFirmwareLong(input,args[3]);
-                } catch (InputInvalidException e) {
-                    System.out.println("Zarf! File was bad");
-                    e.printStackTrace();
-                }
+            try {
+                Configuration config = y.loadAs(new FileReader(cfg),Configuration.class);
+                SoxPath=config.getSoxPath();
+                BlueLabPath=config.getBlueLabPath();
+            } catch (FileNotFoundException e) {
+                System.err.println("Hurz");
+                e.printStackTrace();
             }
         }
-        else if(immport)
+        else
         {
-            if(longy)
-            {
-                assembleFirmware(input,args[3]);
+            Configuration config = new Configuration();
+            config.setBlueLabPath("C:\\ADK_CSR867x.WIN4.3.1.5\\tools\\bin\\");
+            config.setSoxPath("sox.exe");
+            try {
+                y.dump(config, new FileWriter(cfg));
+                System.err.println("Configuration needed. Check the generated config.yml");
+            } catch (IOException e) {
+                System.err.println("Failed to initialize config");
+                e.printStackTrace();
             }
+            System.exit(0);
         }
-        else if(vmexport)
-        {
-            extractVmImage(input,args[3]);
-        }
-        else if(disasm)
-        {
-            XAPDisAsm.Disassemble(args[2],args[3]);
-        }
-    }
-
-    private static void assembleFirmware(File output, String inputfolder)
-    {
-        Yaml y = new Yaml();
-        try {
-            LongHeader h = y.loadAs(new FileReader(new File(inputfolder+File.separator+"header.yml")),LongHeader.class);
-            RandomAccessFile f = new RandomAccessFile(output,"rw");
-            f.write(h.getVersion_raw());
-            f.write(LongToRawBytes(h.getMagicShit()));
-            f.write(LongToRawBytes(h.getRandom_id()));
-            HeaderRecord[] records = h.getHeaderRecords();
-            int count = records.length;
-            f.write(LongToRawBytes(count));
-            long offset = records[0].getOffset();
-            for(int i=0;i<count;i++)
-            {
-                HeaderRecord r = records[i];
-                File handle = new File(inputfolder+File.separator+r.getFilename());
-                r.setLength(handle.length());
-                r.setOffset(offset+0);
-                offset+=handle.length();
-
-                RandomAccessFile file = new RandomAccessFile(handle,"r");
-                byte[] bfr = new byte[(int)handle.length()];
-                file.read(bfr);
-                byte[] newmd5 = MessageDigest.getInstance("MD5").digest(bfr);
-                r.setMd5sum(newmd5);
-            }
-
-            for(int i=0;i<count;i++)
-            {
-                HeaderRecord r = records[i];
-                f.write(LongToRawBytes(r.getShortflag_1()));
-                f.write(LongToRawBytes(r.getShortflag_2()));
-                f.write(LongToRawBytes(r.getOffset()));
-                f.write(LongToRawBytes(r.getLength()));
-                f.write(r.getMd5sum());
-            }
-
-            for(int i=0;i<count;i++)
-            {
-                HeaderRecord r = records[i];
-                f.write(LongToRawBytes(r.getShortflag_1()));
-                f.write(LongToRawBytes(r.getShortflag_2()));
-                f.write(LongToRawBytes(r.getOffset()));
-                f.write(LongToRawBytes(r.getLength()));
-                f.write(LongToRawBytes(r.getFlag_1()));
-                f.write(LongToRawBytes(r.getFlag_2()));
-                f.write(LongToRawBytes(r.getFlag_3()));
-                f.write(LongToRawBytes(r.getFlag_4()));
-                f.write(LongToRawBytes(r.getFlag_5()));
-                f.write(LongToRawBytes(r.getUnknown_id()));
-                f.write(r.getPadding());
-
-                byte[] filenamebytes = r.getFilename().getBytes(Charsets.US_ASCII);
-                byte[] filename = new byte[128];
-                for(int j=0;j<128;j++)
-                {
-                    if(j<filenamebytes.length)
-                    {
-                        filename[j]=filenamebytes[j];
-                    }
-                    else
-                    {
-                        filename[j]=0;
-                    }
-                }
-                f.write(filename);
-                f.write(r.getMd5sum());
-            }
 
-            for(int i=0;i<count;i++)
-            {
-                HeaderRecord r = records[i];
-                File handle = new File(inputfolder+File.separator+r.getFilename());
-                RandomAccessFile file = new RandomAccessFile(handle,"r");
-                byte[] bfr = new byte[(int)handle.length()];
-                file.read(bfr);
-                f.write(bfr);
-            }
-            f.close();
-
-        } catch (FileNotFoundException e) {
-            e.printStackTrace();
-        } catch (IOException e) {
-            e.printStackTrace();
-        } catch (NoSuchAlgorithmException e) {
-            e.printStackTrace();
-        }
+        CommandLine cl = new CommandLine(new EntryPoint());
+        cl.setCaseInsensitiveEnumValuesAllowed(true);
+        cl.execute(args);
     }
 
-    private static void extractFirmwareLong(File input, String output) throws InputInvalidException {
-        byte filler = 0x00;
-
-
-
-        try (RandomAccessFile f = new RandomAccessFile(input,"r")) {
-            LongHeader hdr = new LongHeader();
-            byte[] headermagic = new byte[24];
-            f.read(headermagic);
-            String versionName = new String(headermagic, Charsets.US_ASCII).split("\0")[0]; //hack, can be done since strings are shorty. https://stackoverflow.com/a/8843313/1405227
-            hdr.setVersion_raw(headermagic);
-            hdr.setVersion(versionName);
-            //12 more bytes
-            byte[] magic = new byte[4];
-            f.read(magic);
-
-            hdr.setMagicShit(Longs.fromBytes(filler,filler,filler,filler,magic[3],magic[2],magic[1],magic[0]));
-
-            byte[] unknown_id = new byte[4];
-
-            f.read(unknown_id);
-
-            hdr.setRandom_id(Longs.fromBytes(filler,filler,filler,filler,unknown_id[3],unknown_id[2],unknown_id[1],unknown_id[0]));
-
-            byte[] count_raw = new byte[4];
-            f.read(count_raw);
-
-            long count_l = (Longs.fromBytes(filler,filler,filler,filler,count_raw[3],count_raw[2],count_raw[1],count_raw[0]));
-
-            if(count_l>Integer.MAX_VALUE)
-            {
-                throw new InputInvalidException();
-            }
-            int count = (int)count_l;
-            HeaderRecord[] records = new HeaderRecord[count];
-            byte[] skip = new byte[count*32]; /*skipping over shorty header, repeats content with long one*/
-            f.read(skip);
-            for(int i=0;i<count;i++)
-            {
-                HeaderRecord record = new HeaderRecord();
-
-
-                byte[] flags1 = new byte[4];
-                f.read(flags1);
-
-                record.setShortflag_1(Longs.fromBytes(filler,filler,filler,filler,flags1[3],flags1[2],flags1[1],flags1[0]));
-
-                byte[] flags2 = new byte[4];
-                f.read(flags2);
-
-                record.setShortflag_2(Longs.fromBytes(filler,filler,filler,filler,flags2[3],flags2[2],flags2[1],flags2[0]));
-
-                byte[] offset = new byte[4];
-                f.read(offset);
-
-                record.setOffset(Longs.fromBytes(filler,filler,filler,filler,offset[3],offset[2],offset[1],offset[0]));
-
-                byte[] length = new byte[4];
-                f.read(length);
-
-                record.setLength(Longs.fromBytes(filler,filler,filler,filler,length[3],length[2],length[1],length[0]));
-
-
-
-                long[] flags = new long[5];
-                for(int j=0;j<5;j++)
-                {
-                    byte[] flags_raw = new byte[4];
-                    f.read(flags_raw);
-
-                    flags[j] = (Longs.fromBytes(filler,filler,filler,filler,flags_raw[3],flags_raw[2],flags_raw[1],flags_raw[0]));
-                }
-
-                record.setFlag_1(flags[0]);
-                record.setFlag_2(flags[1]);
-                record.setFlag_3(flags[2]);
-                record.setFlag_4(flags[3]);
-                record.setFlag_5(flags[4]);
-
-                byte[] unknown = new byte[4];
-                f.read(unknown);
-
-                record.setUnknown_id(Longs.fromBytes(filler,filler,filler,filler,unknown[3],unknown[2],unknown[1],unknown[0]));
-
-                byte[] padding = new byte[128];
-
-                f.read(padding);
-
-                record.setPadding(padding);
-
-                byte[] filename_raw = new byte[128];
-
-                f.read(filename_raw);
-
-                String filename = new String(filename_raw, Charsets.US_ASCII).split("\0")[0]; //hack, can be done since strings are shorty. https://stackoverflow.com/a/8843313/1405227
-                record.setFilename(filename);
-
-                byte[] md5 = new byte[16];
-
-                f.read(md5);
-
-                record.setMd5sum(md5);
-
-                records[i]=record;
-
-            }
-            hdr.setHeaderRecords(records);
-            Yaml y = new Yaml();
-
-            y.dump(hdr, new FileWriter(new File(output+File.separator+"header.yml")));
-
-            for(int i=0;i<records.length;i++)
-            {
-                HeaderRecord r = records[i];
-                String target = output+File.separator+r.getFilename();
-                long offset = r.getOffset();
-                int len = (int)r.getLength();
-                byte[] file = new byte[len];
-                f.seek(offset);
-                f.read(file);
-                RandomAccessFile out = new RandomAccessFile(target,"rw");
-                out.write(file);
-                out.close();
-
-            }
-
-        } catch (FileNotFoundException e) {
-            e.printStackTrace();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-    }
-
-    private static void extractVmImage(File input, String output)
-    {
-        byte filler = 0x00;
-        try (RandomAccessFile f = new RandomAccessFile(input,"r")) {
-            VMImageHeader h = new VMImageHeader();
-
-            long len = f.length()/2;
-            if(len>Integer.MAX_VALUE)
-            {
-                System.out.println("Ugggh, File too big");
-                return;
-            }
-
-            short[] checksumarray = new short[(int)len];
-
-            for(int i=0;i<len;i++)
-            {
-                checksumarray[i]=f.readShort();
-            }
-            if(xorsum(checksumarray)!=0)
-            {
-                System.out.println("Smells like Dead Beef, the data seems to be corrupt");
-            }
-            f.seek(0);
-
-
-
-            byte[] magic = new byte[8];
-            f.read(magic);
-
-            h.setHeader(magic);
-
-            byte[] shortPants = new byte[2];
-            byte[] integer = new byte[4];
-            f.read(shortPants);
-            h.setUnknownMagic(Ints.fromBytes(filler,filler,shortPants[0],shortPants[1]));
-
-            f.read(integer);
-            h.setSizeCodeInWords(Longs.fromBytes(filler,filler,filler,filler,integer[0],integer[1],integer[2],integer[3]));
-            f.read(shortPants);
-            h.setSzConstantsInWords(Ints.fromBytes(filler,filler,shortPants[0],shortPants[1]));
-            f.read(shortPants);
-            h.setSzGlobalsInWords(Ints.fromBytes(filler,filler,shortPants[0],shortPants[1]));
-            f.read(shortPants);
-            h.setSzStack(Ints.fromBytes(filler,filler,shortPants[0],shortPants[1]));
-            f.read(shortPants);
-            h.setAddressMain(Ints.fromBytes(filler,filler,shortPants[0],shortPants[1]));
-            f.read(shortPants);
-            h.setUnknownFlag(Shorts.fromBytes(shortPants[0],shortPants[1]));
-            f.read(shortPants);
-            h.setSyscallCompatId(Ints.fromBytes(filler,filler,shortPants[0],shortPants[1]));
-            byte[] trapsets = new byte[8];
-            f.read(trapsets);
-            h.setTrapSet(trapsets);
-            h.setTrapSetStringlied(bytesToHex(trapsets));
-            f.read(integer);
-            h.setSizeFileInWords(Longs.fromBytes(filler,filler,filler,filler,integer[0],integer[1],integer[2],integer[3]));
-            f.read(shortPants);
-            h.setChksum(Shorts.fromBytes(shortPants[0],shortPants[1]));
-            f.read(shortPants);
-            h.setUnknown_parameter_b(Shorts.fromBytes(shortPants[0],shortPants[1]));
-            f.read(integer);
-            h.setEtcetcaddress(Longs.fromBytes(filler,filler,filler,filler,integer[0],integer[1],integer[2],integer[3]));
-
-            f.read(shortPants);
-            h.setUnknown_twiddled_bits(Shorts.fromBytes(shortPants[0],shortPants[1]));
-
-            Yaml y = new Yaml();
-
-            y.dump(h, new FileWriter(new File(output+File.separator+"header.yml")));
-
-            f.seek(0);
-
-            RandomAccessFile hdrRaw = new RandomAccessFile(output+File.separator+"header.bin","rw");
-            byte[] header = new byte[0x30];
-            f.read(header);
-            hdrRaw.write(header);
-            byte[] code = new byte[(int)h.getSizeCodeInWords()*2];
-            f.read(code);
-            RandomAccessFile codeRaw = new RandomAccessFile(output+File.separator+"code.bin","rw");
-            codeRaw.write(code);
-
-            byte[] constants = new byte[h.getSzConstantsInWords()*2];
-            f.read(constants);
-            RandomAccessFile dataRaw = new RandomAccessFile(output+File.separator+"data.bin","rw");
-            dataRaw.write(constants);
-
-
-        } catch (FileNotFoundException e) {
-            e.printStackTrace();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-    }
 
 
 
@@ -451,51 +82,60 @@ public class EntryPoint
     }
 
 
-    private static byte[] LongToRawBytes(long l)
-    {
-        byte[] tmp = Longs.toByteArray(l);
-        return new byte[]{tmp[7],tmp[6],tmp[5],tmp[4]};
-    }
-
-    private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
-    public static String bytesToHex(byte[] bytes) {
-        char[] hexChars = new char[bytes.length * 2];
-        for (int j = 0; j < bytes.length; j++) {
-            int v = bytes[j] & 0xFF;
-            hexChars[j * 2] = HEX_ARRAY[v >>> 4];
-            hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F];
-        }
-
-        String hexxit = new String(hexChars).toLowerCase(Locale.ROOT);
-        //hexxit = hexxit.replaceAll("^0+", "");
-        return hexxit;
-    }
-
-    private static void makeSureThatOutFolderIsCreated(String output)
-    {
-        File od = (new File(output));
-        if(!(od.exists()&&od.isDirectory()))
+    @Override
+    public void run() {
+        //TODO check and init config file
+        switch(mode)
         {
-            if(!od.mkdirs())
-            {
-                System.err.println("WTF! somethint ate shit");
-                return;
-            }
-        }
-    }
-
-    public static short xorsum(short[] filewords)
-    {
-        short xorsum = 0;
-        for(int i=0;i<filewords.length;i++)
-        {
-            xorsum ^= filewords[i];
+            case ExtractSenaBin:
+                try {
+                    Utils.makeSureThatOutFolderIsCreated(output.getPath());
+                    FirmwareWrapperExtraction.extractFirmwareLong(input,output.getPath());
+                } catch (InputInvalidException e) {
+                    System.out.println("Zarf! File was bad");
+                    e.printStackTrace();
+                }
+                break;
+            case ImportSenaBin:
+                FirmwareWrapperExtraction.assembleFirmware(input,output.getPath());
+                break;
+            case ExtractVMImage:
+                VmAppFIleExtraction.extractVmImage(input,output.getPath());
+                break;
+            case ImportVMImage:
+                throw new UnsupportedOperationException("Not Implemented yet");
+                //break;
+            case DisassembleXAP:
+                XAPDisAsm.Disassemble(input.getPath(),output.getPath());
+                break;
+            case ExtractForPrompts:
+                try {
+                    PromptHandlerSuite.handlePrompts(input,output,headset);
+                } catch (InputInvalidException e) {
+                    e.printStackTrace();
+                }
+                break;
+            case ReassembleForPrompts:
+                try {
+                    PromptHandlerSuite.assembleWithNewPrompts(input,output,headset);
+                } catch (InputInvalidException e) {
+                    e.printStackTrace();
+                }
+                break;
         }
-        return xorsum;
     }
-
 }
 
+enum Modes
+{
+    ExtractSenaBin,
+    ImportSenaBin,
+    ExtractVMImage,
+    ImportVMImage,
+    DisassembleXAP,
+    ExtractForPrompts,
+    ReassembleForPrompts
+}
 
 // http://www.tinyosshop.com/download/ADK_CSR867x.WIN4.3.1.5.zip für die tools
 

+ 235 - 0
SenaBitWiggler/src/main/java/de/nplusc/izc/senabitwiggler/FirmwareWrapperExtraction.java

@@ -0,0 +1,235 @@
+package de.nplusc.izc.senabitwiggler;
+
+import com.google.common.base.Charsets;
+import com.google.common.primitives.Longs;
+import org.yaml.snakeyaml.Yaml;
+
+import java.io.*;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class FirmwareWrapperExtraction {
+    public static void assembleFirmware(File output, String inputfolder)
+    {
+        Yaml y = new Yaml();
+        try {
+            LongHeader h = y.loadAs(new FileReader(new File(inputfolder+File.separator+"header.yml")),LongHeader.class);
+            RandomAccessFile f = new RandomAccessFile(output,"rw");
+            f.write(h.getVersion_raw());
+            f.write(Utils.LongToRawBytes(h.getMagicShit()));
+            f.write(Utils.LongToRawBytes(h.getRandom_id()));
+            HeaderRecord[] records = h.getHeaderRecords();
+            int count = records.length;
+            f.write(Utils.LongToRawBytes(count));
+            long offset = records[0].getOffset();
+            for(int i=0;i<count;i++)
+            {
+                HeaderRecord r = records[i];
+                File handle = new File(inputfolder+File.separator+r.getFilename());
+                r.setLength(handle.length());
+                r.setOffset(offset+0);
+                offset+=handle.length();
+
+                RandomAccessFile file = new RandomAccessFile(handle,"r");
+                byte[] bfr = new byte[(int)handle.length()];
+                file.read(bfr);
+                byte[] newmd5 = MessageDigest.getInstance("MD5").digest(bfr);
+                r.setMd5sum(newmd5);
+            }
+
+            for(int i=0;i<count;i++)
+            {
+                HeaderRecord r = records[i];
+                f.write(Utils.LongToRawBytes(r.getShortflag_1()));
+                f.write(Utils.LongToRawBytes(r.getShortflag_2()));
+                f.write(Utils.LongToRawBytes(r.getOffset()));
+                f.write(Utils.LongToRawBytes(r.getLength()));
+                f.write(r.getMd5sum());
+            }
+
+            for(int i=0;i<count;i++)
+            {
+                HeaderRecord r = records[i];
+                f.write(Utils.LongToRawBytes(r.getShortflag_1()));
+                f.write(Utils.LongToRawBytes(r.getShortflag_2()));
+                f.write(Utils.LongToRawBytes(r.getOffset()));
+                f.write(Utils.LongToRawBytes(r.getLength()));
+                f.write(Utils.LongToRawBytes(r.getFlag_1()));
+                f.write(Utils.LongToRawBytes(r.getFlag_2()));
+                f.write(Utils.LongToRawBytes(r.getFlag_3()));
+                f.write(Utils.LongToRawBytes(r.getFlag_4()));
+                f.write(Utils.LongToRawBytes(r.getFlag_5()));
+                f.write(Utils.LongToRawBytes(r.getUnknown_id()));
+                f.write(r.getPadding());
+
+                byte[] filenamebytes = r.getFilename().getBytes(Charsets.US_ASCII);
+                byte[] filename = new byte[128];
+                for(int j=0;j<128;j++)
+                {
+                    if(j<filenamebytes.length)
+                    {
+                        filename[j]=filenamebytes[j];
+                    }
+                    else
+                    {
+                        filename[j]=0;
+                    }
+                }
+                f.write(filename);
+                f.write(r.getMd5sum());
+            }
+
+            for(int i=0;i<count;i++)
+            {
+                HeaderRecord r = records[i];
+                File handle = new File(inputfolder+File.separator+r.getFilename());
+                RandomAccessFile file = new RandomAccessFile(handle,"r");
+                byte[] bfr = new byte[(int)handle.length()];
+                file.read(bfr);
+                f.write(bfr);
+            }
+            f.close();
+
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } catch (NoSuchAlgorithmException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void extractFirmwareLong(File input, String output) throws InputInvalidException {
+        byte filler = 0x00;
+
+
+
+        try (RandomAccessFile f = new RandomAccessFile(input,"r")) {
+            LongHeader hdr = new LongHeader();
+            byte[] headermagic = new byte[24];
+            f.read(headermagic);
+            String versionName = new String(headermagic, Charsets.US_ASCII).split("\0")[0]; //hack, can be done since strings are shorty. https://stackoverflow.com/a/8843313/1405227
+            hdr.setVersion_raw(headermagic);
+            hdr.setVersion(versionName);
+            //12 more bytes
+            byte[] magic = new byte[4];
+            f.read(magic);
+
+            hdr.setMagicShit(Longs.fromBytes(filler,filler,filler,filler,magic[3],magic[2],magic[1],magic[0]));
+
+            byte[] unknown_id = new byte[4];
+
+            f.read(unknown_id);
+
+            hdr.setRandom_id(Longs.fromBytes(filler,filler,filler,filler,unknown_id[3],unknown_id[2],unknown_id[1],unknown_id[0]));
+
+            byte[] count_raw = new byte[4];
+            f.read(count_raw);
+
+            long count_l = (Longs.fromBytes(filler,filler,filler,filler,count_raw[3],count_raw[2],count_raw[1],count_raw[0]));
+
+            if(count_l>Integer.MAX_VALUE)
+            {
+                throw new InputInvalidException();
+            }
+            int count = (int)count_l;
+            HeaderRecord[] records = new HeaderRecord[count];
+            byte[] skip = new byte[count*32]; /*skipping over shorty header, repeats content with long one*/
+            f.read(skip);
+            for(int i=0;i<count;i++)
+            {
+                HeaderRecord record = new HeaderRecord();
+
+
+                byte[] flags1 = new byte[4];
+                f.read(flags1);
+
+                record.setShortflag_1(Longs.fromBytes(filler,filler,filler,filler,flags1[3],flags1[2],flags1[1],flags1[0]));
+
+                byte[] flags2 = new byte[4];
+                f.read(flags2);
+
+                record.setShortflag_2(Longs.fromBytes(filler,filler,filler,filler,flags2[3],flags2[2],flags2[1],flags2[0]));
+
+                byte[] offset = new byte[4];
+                f.read(offset);
+
+                record.setOffset(Longs.fromBytes(filler,filler,filler,filler,offset[3],offset[2],offset[1],offset[0]));
+
+                byte[] length = new byte[4];
+                f.read(length);
+
+                record.setLength(Longs.fromBytes(filler,filler,filler,filler,length[3],length[2],length[1],length[0]));
+
+
+
+                long[] flags = new long[5];
+                for(int j=0;j<5;j++)
+                {
+                    byte[] flags_raw = new byte[4];
+                    f.read(flags_raw);
+
+                    flags[j] = (Longs.fromBytes(filler,filler,filler,filler,flags_raw[3],flags_raw[2],flags_raw[1],flags_raw[0]));
+                }
+
+                record.setFlag_1(flags[0]);
+                record.setFlag_2(flags[1]);
+                record.setFlag_3(flags[2]);
+                record.setFlag_4(flags[3]);
+                record.setFlag_5(flags[4]);
+
+                byte[] unknown = new byte[4];
+                f.read(unknown);
+
+                record.setUnknown_id(Longs.fromBytes(filler,filler,filler,filler,unknown[3],unknown[2],unknown[1],unknown[0]));
+
+                byte[] padding = new byte[128];
+
+                f.read(padding);
+
+                record.setPadding(padding);
+
+                byte[] filename_raw = new byte[128];
+
+                f.read(filename_raw);
+
+                String filename = new String(filename_raw, Charsets.US_ASCII).split("\0")[0]; //hack, can be done since strings are shorty. https://stackoverflow.com/a/8843313/1405227
+                record.setFilename(filename);
+
+                byte[] md5 = new byte[16];
+
+                f.read(md5);
+
+                record.setMd5sum(md5);
+
+                records[i]=record;
+
+            }
+            hdr.setHeaderRecords(records);
+            Yaml y = new Yaml();
+
+            y.dump(hdr, new FileWriter(new File(output+File.separator+"header.yml")));
+
+            for(int i=0;i<records.length;i++)
+            {
+                HeaderRecord r = records[i];
+                String target = output+File.separator+r.getFilename();
+                long offset = r.getOffset();
+                int len = (int)r.getLength();
+                byte[] file = new byte[len];
+                f.seek(offset);
+                f.read(file);
+                RandomAccessFile out = new RandomAccessFile(target,"rw");
+                out.write(file);
+                out.close();
+
+            }
+
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+}

+ 1 - 1
SenaBitWiggler/src/main/java/de/nplusc/izc/senabitwiggler/HeaderRecord.java

@@ -147,6 +147,6 @@ public class HeaderRecord {
     }
     public String getMd5String()
     {
-        return EntryPoint.bytesToHex(md5sum);
+        return Utils.bytesToHex(md5sum);
     }
 }

+ 229 - 0
SenaBitWiggler/src/main/java/de/nplusc/izc/senabitwiggler/PromptHandlerSuite.java

@@ -0,0 +1,229 @@
+package de.nplusc.izc.senabitwiggler;
+
+import org.yaml.snakeyaml.Yaml;
+
+import javax.sound.midi.Patch;
+import java.io.*;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.*;
+
+public class PromptHandlerSuite {
+    public static void handlePrompts(File firmware, File outfolder, String headsetid) throws InputInvalidException {
+        URL rsrc = EntryPoint.class.getResource("/PromptConfigs/"+headsetid+".prompts.yml");
+        if(rsrc==null)
+        {
+            URL url = EntryPoint.class.getResource("/PromptConfigs/");
+            // HAXX
+            EntryPoint.class.getResourceAsStream("/PromptConfigs/");
+            Path path = null;
+            try {
+                path = Paths.get(url.toURI());
+            } catch (URISyntaxException e) {
+                e.printStackTrace();
+            }
+            System.out.println("Invalid Headset reference: Valid values are");
+            try {
+                Files.walk(path, 1).forEach(p ->
+                {
+                    String fn = p.getFileName().toString();
+                    if(fn.endsWith(".prompts.yml"))
+                    {
+                        System.out.println(fn.replace(".prompts.yml",""));
+                    }
+                });
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+
+            throw new InputInvalidException();
+        }
+        File scratch = new File(outfolder,"internal");
+        File prompts = new File(outfolder,"prompts");
+        scratch.mkdirs();
+        prompts.mkdirs();
+        File SenaUnwrap = new File(scratch,"senatransport");
+        File DFUUnwrap = new File(scratch,"dfuunwrap"); //Needed for some not yet supported variants
+        File PromptsInPrm = new File(scratch,"prm"); //Needed for some not yet supported variants
+        SenaUnwrap.mkdirs();
+        DFUUnwrap.mkdirs();
+        PromptsInPrm.mkdirs();
+        FirmwareWrapperExtraction.extractFirmwareLong(firmware,SenaUnwrap.getPath());
+
+
+
+
+        try (InputStream in = EntryPoint.class.getResourceAsStream("/PromptConfigs/"+headsetid+".prompts.yml");
+            BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
+            HashMap<String,String> config = (HashMap<String, String>) new Yaml().load(reader);
+            String file = config.get("file");
+            File xuvin = new File(SenaUnwrap,file);
+            File xuvout = new File(scratch,file+".xuv");
+            String xuv2bin = EntryPoint.BlueLabPath+"xuv2bin";
+            String unpacker = EntryPoint.BlueLabPath+"unpackfile";
+            runTool(xuv2bin,"-e", xuvin.getPath(), xuvout.getPath());
+            runTool(unpacker, xuvout.getPath(), PromptsInPrm.getPath());
+            File[] fileprompts = PromptsInPrm.listFiles();
+            for(File f : fileprompts)
+            {
+                String fn = f.getName().replace(".prm","");
+                String mode = config.get("ALL");
+                if(config.containsKey(fn))
+                {
+                    mode = config.get(fn);
+                }
+                List<String> soxIn = new ArrayList<>();
+                switch(mode.toLowerCase(Locale.ROOT))
+                {
+                    case "pcm":
+
+                        soxIn = Arrays.asList(new String[]{"-t","raw", "-r","8000","-c","1","-e","signed-integer","-b", "16"});
+                        break;
+                    case "ima":
+                        soxIn = Arrays.asList(new String[]{"-t","ima", "-r","8000","-c","1","-e","ima-adpcm","-b","4"});
+                        break;
+                    default:
+                        throw new InputInvalidException();
+                }
+                List<String> cmd = new ArrayList<>();
+                cmd.add("sox");
+                cmd.addAll(soxIn);
+                cmd.add(f.getPath());
+                cmd.add("-e");
+                cmd.add("signed-integer");
+                cmd.add("-b 16");
+                cmd.add(new File(prompts,fn+".wav").getPath());
+
+                runTool(cmd.toArray(new String[0]));
+
+
+                // für raw pcm: for f in *.prm; do sox -t raw -r 8000 -c 1 -e signed-integer -b 16 $f -e signed-integer -b 16 out2.$f.wav; done
+                // für ima adpcm: for f in *.prm; do sox -t ima -r 8000 -c 1 -e ima-adpcm -b 4 $f -e signed-integer -b 16 out.$f.wav; done
+            }
+
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+
+    public static void assembleWithNewPrompts(File firmware, File outfolder, String headsetid) throws InputInvalidException {
+        {
+            URL rsrc = EntryPoint.class.getResource("/PromptConfigs/" + headsetid + ".prompts.yml");
+            if (rsrc == null) {
+                URL url = EntryPoint.class.getResource("/PromptConfigs/");
+                // HAXX
+                EntryPoint.class.getResourceAsStream("/PromptConfigs/");
+                Path path = null;
+                try {
+                    path = Paths.get(url.toURI());
+                } catch (URISyntaxException e) {
+                    e.printStackTrace();
+                }
+                System.out.println("Invalid Headset reference: Valid values are");
+                try {
+                    Files.walk(path, 1).forEach(p ->
+                    {
+                        String fn = p.getFileName().toString();
+                        if (fn.endsWith(".prompts.yml")) {
+                            System.out.println(fn.replace(".prompts.yml", ""));
+                        }
+                    });
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+
+                throw new InputInvalidException();
+            }
+
+            File scratch = new File(outfolder,"internal");
+            File prompts = new File(outfolder,"prompts");
+            scratch.mkdirs();
+            prompts.mkdirs();
+            File SenaUnwrap = new File(scratch,"senatransport");
+            File DFUUnwrap = new File(scratch,"dfuunwrap"); //Needed for some not yet supported variants
+            File PromptsInPrm = new File(scratch,"prm"); //Needed for some not yet supported variants
+            SenaUnwrap.mkdirs();
+            DFUUnwrap.mkdirs();
+            PromptsInPrm.mkdirs();
+
+
+
+
+
+            try (InputStream in = EntryPoint.class.getResourceAsStream("/PromptConfigs/"+headsetid+".prompts.yml");
+                BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
+                HashMap<String,String> config = (HashMap<String, String>) new Yaml().load(reader);
+                String file = config.get("file");
+                File xuvin = new File(SenaUnwrap,file);
+                File xuvout = new File(scratch,file+".xuv");
+                String xuv2bin = EntryPoint.BlueLabPath+"xuv2bin";
+                String unpacker = EntryPoint.BlueLabPath+"packfile";
+                File[] fileprompts = PromptsInPrm.listFiles();
+                for(File f : fileprompts)
+                {
+                    String fn = f.getName().replace(".prm","");
+                    String mode = config.get("ALL");
+                    if(config.containsKey(fn))
+                    {
+                        mode = config.get(fn);
+                    }
+                    List<String> soxIn = new ArrayList<>();
+                    switch(mode.toLowerCase(Locale.ROOT))
+                    {
+                        case "pcm":
+
+                            soxIn = Arrays.asList(new String[]{"-t","raw", "-r","8000","-c","1","-e","signed-integer","-b", "16"});
+                            break;
+                        case "ima":
+                            soxIn = Arrays.asList(new String[]{"-t","ima", "-r","8000","-c","1","-e","ima-adpcm","-b","4"});
+                            break;
+                        default:
+                            throw new InputInvalidException();
+                    }
+                    List<String> cmd = new ArrayList<>();
+                    cmd.add("sox");
+                    cmd.add(new File(prompts,fn+".wav").getPath());
+                    cmd.addAll(soxIn);
+                    cmd.add(f.getPath());
+
+                    runTool(cmd.toArray(new String[0]));
+
+
+                    // für raw pcm: for f in *.prm; do sox -t raw -r 8000 -c 1 -e signed-integer -b 16 $f -e signed-integer -b 16 out2.$f.wav; done
+                    // für ima adpcm: for f in *.prm; do sox -t ima -r 8000 -c 1 -e ima-adpcm -b 4 $f -e signed-integer -b 16 out.$f.wav; done
+                }
+
+
+                runTool(unpacker, PromptsInPrm.getPath(),xuvout.getPath());
+                runTool(xuv2bin,"-d", xuvout.getPath(),xuvin.getPath());
+
+                FirmwareWrapperExtraction.assembleFirmware(firmware,SenaUnwrap.getPath());
+
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+
+
+        }
+    }
+
+
+
+
+
+    private static void runTool(String... args) throws IOException {
+        ProcessBuilder pb = new ProcessBuilder();
+        pb.command(args);
+        pb.inheritIO();
+        Process runme = pb.start();
+        try {
+            runme.waitFor();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 58 - 0
SenaBitWiggler/src/main/java/de/nplusc/izc/senabitwiggler/Utils.java

@@ -0,0 +1,58 @@
+package de.nplusc.izc.senabitwiggler;
+
+import com.google.common.primitives.Longs;
+
+import javax.swing.*;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.Arrays;
+import java.util.Locale;
+
+public class Utils {
+    public static byte[] LongToRawBytes(long l)
+    {
+        byte[] tmp = Longs.toByteArray(l);
+        return new byte[]{tmp[7],tmp[6],tmp[5],tmp[4]};
+    }
+
+    public static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
+    public static String bytesToHex(byte[] bytes) {
+        char[] hexChars = new char[bytes.length * 2];
+        for (int j = 0; j < bytes.length; j++) {
+            int v = bytes[j] & 0xFF;
+            hexChars[j * 2] = HEX_ARRAY[v >>> 4];
+            hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F];
+        }
+
+        String hexxit = new String(hexChars).toLowerCase(Locale.ROOT);
+        //hexxit = hexxit.replaceAll("^0+", "");
+        return hexxit;
+    }
+
+    public static void makeSureThatOutFolderIsCreated(String output)
+    {
+        File od = (new File(output));
+        if(!(od.exists()&&od.isDirectory()))
+        {
+            if(!od.mkdirs())
+            {
+                System.err.println("WTF! somethint ate shit");
+                return;
+            }
+        }
+    }
+
+    public static short xorsum(short[] filewords)
+    {
+        short xorsum = 0;
+        for(int i=0;i<filewords.length;i++)
+        {
+            xorsum ^= filewords[i];
+        }
+        return xorsum;
+    }
+
+
+
+}

+ 107 - 0
SenaBitWiggler/src/main/java/de/nplusc/izc/senabitwiggler/VmAppFIleExtraction.java

@@ -0,0 +1,107 @@
+package de.nplusc.izc.senabitwiggler;
+
+import com.google.common.primitives.Ints;
+import com.google.common.primitives.Longs;
+import com.google.common.primitives.Shorts;
+import org.yaml.snakeyaml.Yaml;
+
+import java.io.*;
+
+public class VmAppFIleExtraction {
+    public static void extractVmImage(File input, String output)
+    {
+        byte filler = 0x00;
+        try (RandomAccessFile f = new RandomAccessFile(input,"r")) {
+            VMImageHeader h = new VMImageHeader();
+
+            long len = f.length()/2;
+            if(len>Integer.MAX_VALUE)
+            {
+                System.out.println("Ugggh, File too big");
+                return;
+            }
+
+            short[] checksumarray = new short[(int)len];
+
+            for(int i=0;i<len;i++)
+            {
+                checksumarray[i]=f.readShort();
+            }
+            if(Utils.xorsum(checksumarray)!=0)
+            {
+                System.out.println("Smells like Dead Beef, the data seems to be corrupt");
+            }
+            f.seek(0);
+
+
+
+            byte[] magic = new byte[8];
+            f.read(magic);
+
+            h.setHeader(magic);
+
+            byte[] shortPants = new byte[2];
+            byte[] integer = new byte[4];
+            f.read(shortPants);
+            h.setUnknownMagic(Ints.fromBytes(filler,filler,shortPants[0],shortPants[1]));
+
+            f.read(integer);
+            h.setSizeCodeInWords(Longs.fromBytes(filler,filler,filler,filler,integer[0],integer[1],integer[2],integer[3]));
+            f.read(shortPants);
+            h.setSzConstantsInWords(Ints.fromBytes(filler,filler,shortPants[0],shortPants[1]));
+            f.read(shortPants);
+            h.setSzGlobalsInWords(Ints.fromBytes(filler,filler,shortPants[0],shortPants[1]));
+            f.read(shortPants);
+            h.setSzStack(Ints.fromBytes(filler,filler,shortPants[0],shortPants[1]));
+            f.read(shortPants);
+            h.setAddressMain(Ints.fromBytes(filler,filler,shortPants[0],shortPants[1]));
+            f.read(shortPants);
+            h.setUnknownFlag(Shorts.fromBytes(shortPants[0],shortPants[1]));
+            f.read(shortPants);
+            h.setSyscallCompatId(Ints.fromBytes(filler,filler,shortPants[0],shortPants[1]));
+            byte[] trapsets = new byte[8];
+            f.read(trapsets);
+            h.setTrapSet(trapsets);
+            h.setTrapSetStringlied(Utils.bytesToHex(trapsets));
+            f.read(integer);
+            h.setSizeFileInWords(Longs.fromBytes(filler,filler,filler,filler,integer[0],integer[1],integer[2],integer[3]));
+            f.read(shortPants);
+            h.setChksum(Shorts.fromBytes(shortPants[0],shortPants[1]));
+            f.read(shortPants);
+            h.setUnknown_parameter_b(Shorts.fromBytes(shortPants[0],shortPants[1]));
+            f.read(integer);
+            h.setEtcetcaddress(Longs.fromBytes(filler,filler,filler,filler,integer[0],integer[1],integer[2],integer[3]));
+
+            f.read(shortPants);
+            h.setUnknown_twiddled_bits(Shorts.fromBytes(shortPants[0],shortPants[1]));
+
+            Yaml y = new Yaml();
+
+            y.dump(h, new FileWriter(new File(output+File.separator+"header.yml")));
+
+            f.seek(0);
+
+            RandomAccessFile hdrRaw = new RandomAccessFile(output+File.separator+"header.bin","rw");
+            byte[] header = new byte[0x30];
+            f.read(header);
+            hdrRaw.write(header);
+            byte[] code = new byte[(int)h.getSizeCodeInWords()*2];
+            f.read(code);
+            RandomAccessFile codeRaw = new RandomAccessFile(output+File.separator+"code.bin","rw");
+            codeRaw.write(code);
+
+            byte[] constants = new byte[h.getSzConstantsInWords()*2];
+            f.read(constants);
+            RandomAccessFile dataRaw = new RandomAccessFile(output+File.separator+"data.bin","rw");
+            dataRaw.write(constants);
+
+
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+
+}

+ 15 - 15
SenaBitWiggler/src/main/java/de/nplusc/izc/senabitwiggler/XAPDisAsm.java

@@ -26,11 +26,11 @@ public class XAPDisAsm {
         if(modifier!=0x00)
         {
             modified=true;
-            badOpCode += (EntryPoint.bytesToHex(Shorts.toByteArray(modifier)));
+            badOpCode += (Utils.bytesToHex(Shorts.toByteArray(modifier)));
         };
         for(int i=0;i<opcode.length;i++)
         {
-            badOpCode += (EntryPoint.bytesToHex(Shorts.toByteArray(opcode[i])));
+            badOpCode += (Utils.bytesToHex(Shorts.toByteArray(opcode[i])));
         }
         return OpcodeAddressRangeToString(address,opcode.length+(modified?1:0))+":Invalid OpCode: "+badOpCode;
     };
@@ -53,7 +53,7 @@ public class XAPDisAsm {
                     opcodeValues[i]=opcodeWord[0];
                     opcodeReal=(opcodeWord[1]); //stompy stomp, only keeps the last
                 }
-                String rawValue = EntryPoint.bytesToHex(opcodeValues);
+                String rawValue = Utils.bytesToHex(opcodeValues);
                 System.out.println(rawValue);
 
                 int valueUnsigned = XAPDisAsmGeneratedCode.unsignedCounts.get(rawValue);
@@ -155,10 +155,10 @@ public class XAPDisAsm {
                     opcodeValues[i]=opcodeWord[0];
                     opcodeReal=(opcodeWord[1]); //stompy stomp, only keeps the last
                 }
-                String rawVal = EntryPoint.bytesToHex(opcodeValues);
+                String rawVal = Utils.bytesToHex(opcodeValues);
                 System.out.println(rawVal);
                 int valueUnsigned = XAPDisAsmGeneratedCode.unsignedCounts.get(rawVal);
-                int valueSigned =XAPDisAsmGeneratedCode.signedCounts.get(EntryPoint.bytesToHex(opcodeValues));
+                int valueSigned =XAPDisAsmGeneratedCode.signedCounts.get(Utils.bytesToHex(opcodeValues));
                 String register = "";
 
                 String value = "";
@@ -262,7 +262,7 @@ public class XAPDisAsm {
                     opcodeReal=(short)((opcode[i]-0x00)&0xFF); //stompy stomp, only keeps the last
                 }
 
-                int valueStack = XAPDisAsmGeneratedCode.unsignedCounts.get(EntryPoint.bytesToHex(opcodeValues));
+                int valueStack = XAPDisAsmGeneratedCode.unsignedCounts.get(Utils.bytesToHex(opcodeValues));
                 String label = "";
 
                 String value = "";
@@ -293,8 +293,8 @@ public class XAPDisAsm {
                     opcodeReal=(short)((opcode[i]-0x00)&0xFF); //stompy stomp, only keeps the last
                 }
 
-                int valueUnsigned = XAPDisAsmGeneratedCode.unsignedCounts.get(EntryPoint.bytesToHex(opcodeValues));
-                int valueSigned =XAPDisAsmGeneratedCode.signedCounts.get(EntryPoint.bytesToHex(opcodeValues));
+                int valueUnsigned = XAPDisAsmGeneratedCode.unsignedCounts.get(Utils.bytesToHex(opcodeValues));
+                int valueSigned =XAPDisAsmGeneratedCode.signedCounts.get(Utils.bytesToHex(opcodeValues));
                 String label = "";
 
                 String value = "";
@@ -624,8 +624,8 @@ public class XAPDisAsm {
                 opcodeReal=(short)((opcode[i]-opcodeBase)&0xFF); //stompy stomp, only keeps the last
             }
 
-            int valueUnsigned = XAPDisAsmGeneratedCode.unsignedCounts.get(EntryPoint.bytesToHex(opcodeValues));
-            int valueSigned =XAPDisAsmGeneratedCode.signedCounts.get(EntryPoint.bytesToHex(opcodeValues));
+            int valueUnsigned = XAPDisAsmGeneratedCode.unsignedCounts.get(Utils.bytesToHex(opcodeValues));
+            int valueSigned =XAPDisAsmGeneratedCode.signedCounts.get(Utils.bytesToHex(opcodeValues));
             String register = "";
 
             String value = "";
@@ -673,8 +673,8 @@ public class XAPDisAsm {
             int valueSigned=0;
             if(opcodeReal !=0x0)
             {
-                valueUnsigned = XAPDisAsmGeneratedCode.unsignedCounts.get(EntryPoint.bytesToHex(opcodeValues));
-                valueSigned =XAPDisAsmGeneratedCode.signedCounts.get(EntryPoint.bytesToHex(opcodeValues));
+                valueUnsigned = XAPDisAsmGeneratedCode.unsignedCounts.get(Utils.bytesToHex(opcodeValues));
+                valueSigned =XAPDisAsmGeneratedCode.signedCounts.get(Utils.bytesToHex(opcodeValues));
             }
             String register = "";
 
@@ -730,8 +730,8 @@ public class XAPDisAsm {
             }
             short opcodeDispatch = (short)(opcodeReal-opcodeBase);
 
-            int valueUnsigned = XAPDisAsmGeneratedCode.unsignedCounts.get(EntryPoint.bytesToHex(opcodeValues));
-            int valueSigned =XAPDisAsmGeneratedCode.signedCounts.get(EntryPoint.bytesToHex(opcodeValues));
+            int valueUnsigned = XAPDisAsmGeneratedCode.unsignedCounts.get(Utils.bytesToHex(opcodeValues));
+            int valueSigned =XAPDisAsmGeneratedCode.signedCounts.get(Utils.bytesToHex(opcodeValues));
             String register = "";
 
             String value = "";
@@ -831,7 +831,7 @@ public class XAPDisAsm {
 
     private static String addressToString(int address)
     {
-        //return "0x"+(EntryPoint.bytesToHex(Ints.toByteArray(address)));
+        //return "0x"+(Utils.bytesToHex(Ints.toByteArray(address)));
         return String.format("0x%08X", address);
     }
 

+ 20 - 0
SenaBitWiggler/src/main/resources/PromptConfigs/10S.prompts.yml

@@ -0,0 +1,20 @@
+file: "vp_en.bin"
+ALL: "PCM"
+"2": "IMA"
+"3": "IMA"
+"4": "IMA"
+"6": "IMA"
+"19": "IMA"
+"20": "IMA"
+"22": "IMA"
+"23": "IMA"
+"24": "IMA"
+"25": "IMA"
+"28": "IMA"
+"29": "IMA"
+"30": "IMA"
+"31": "IMA"
+"32": "IMA"
+"52": "IMA"
+"53": "IMA"
+"58": "IMA"

+ 2 - 0
SenaBitWiggler/src/main/resources/PromptConfigs/SRL2.prompts.yml

@@ -0,0 +1,2 @@
+ALL: "PCM"
+file: "vp.bin"