I get so many errors for no reason…
(Reason: i did not initilaze a custom class )
Code
Main:
byte[] bExe;
String[] midpatch;
Patch finpatch;
void setup() {
selectOutput("Save the output file:", "fileOut");
selectInput("Select the file:", "fileSel");
selectInput("Select the patch:", "patchSel");
}
void patchSel(File inpatch) {
midpatch = loadStrings(inpatch);
finpatch.convert(midpatch);
}
void fileSel(File exe) {
bExe = loadBytes(exe);
}
void fileOut(File out) {
println(out.getName());
//finpatch.apply(bExe, /*out.isDirectory()+*/out.getName());
}
Patch:
class Patch {
int[] adr;
byte[] num;
int len;
void convert(String[] midpatch) {
//String[] temp = new String[2];
//println("Length of patch: " + midpatch.length);
//adr = new int[midpatch.length];
//num = new byte[midpatch.length];
//len = midpatch.length;
//for (int i=0;i<len;i++) {
// temp = split(midpatch[i],":");
// adr[i] = int(temp[0]);
// num[i] = byte(int(temp[1]));
//}
}
void apply(byte[] byt, String name) {
byte[] bt = byt;
for (int i=0;i<len;i++) {
bt[adr[i]]=num[i];
} saveBytes(name, bt);
printArray(bt);
}
}