pvbemu/src/desktop/Main.java

81 lines
2.4 KiB
Java

// Java imports
import java.io.*;
// Project imports
import app.*;
import util.*;
import vue.*;
// Desktop application primary class
public class Main {
// Program entry point
public static void main(String[] args) {
// Configure Swing look-and-feel
Util.setSystemLAF();
// Load the native module, if available
for (String filename : Util.listFiles("native")) {
File file = null;
// Skip any file that isn't a shared object library
if (!filename.endsWith(".dll") && !filename.endsWith(".so"))
continue;
// Write the contents of the native object file
FileOutputStream stream = null;
try {
file = File.createTempFile("native", "." + filename);
stream = new FileOutputStream(file);
stream.write(Util.fileRead("native/" + filename));
} catch (Exception e) { file = null; }
try { stream.close(); } catch (Exception e) { }
// Load the native object file into the JVM
try {
System.load(file.getAbsolutePath());
Vue.setNativeID(filename.substring(0,
filename.lastIndexOf(".")));
break;
}
catch (Error e) { }
}
// Use the native module
boolean useNative = false;
for (String arg : args)
if (arg.trim().toLowerCase().equals("native"))
useNative = true;
// Begin application operations
new App(useNative);
var brk = new Breakpoint(null);
String exp =
"([sp - 8] & 3) << 6 != 12.0 + r6 * ecr && [0x0500008C + r8] == 0";
System.out.println("\n" + exp);
if (brk.setCondition(exp))
System.out.println(brk.debug());
else System.out.println(
brk.getErrorCode (Breakpoint.CONDITION) + "\t" +
brk.getErrorPosition(Breakpoint.CONDITION) + ":" +
brk.getErrorText (Breakpoint.CONDITION)
);
exp = "123, 456 - 987 , f0-fffffff2";
System.out.println("\n" + exp);
if (brk.setAddresses(exp))
System.out.println(brk.test());
else System.out.println(
brk.getErrorCode (Breakpoint.ADDRESS) + "\t" +
brk.getErrorPosition(Breakpoint.ADDRESS) + ":" +
brk.getErrorText (Breakpoint.ADDRESS)
);
}
}