MCPcopy Create free account
hub / github.com/Hiro420/NikkeTools / main

Method main

UnLuac/src/unluac/Main.java:29–117  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

27 public static String version = "1.2.3.490";
28
29 public static void main(String[] args) {
30 String fn = null;
31 Configuration config = new Configuration();
32 for(int i = 0; i < args.length; i++) {
33 String arg = args[i];
34 if(arg.startsWith("-")) {
35 // option
36 if(arg.equals("--rawstring")) {
37 config.rawstring = true;
38 } else if(arg.equals("--nodebug")) {
39 config.variable = Configuration.VariableMode.NODEBUG;
40 } else if(arg.equals("--disassemble")) {
41 config.mode = Mode.DISASSEMBLE;
42 } else if(arg.equals("--assemble")) {
43 config.mode = Mode.ASSEMBLE;
44 } else if(arg.equals("--output") || arg.equals("-o")) {
45 if(i + 1 < args.length) {
46 config.output = args[i + 1];
47 i++;
48 } else {
49 error("option \"" + arg + "\" doesn't have an argument", true);
50 }
51 } else if(arg.equals("--opmap")) {
52 if(i + 1 < args.length) {
53 config.opmap = args[i + 1];
54 i++;
55 } else {
56 error("option \"" + arg + "\" doesn't have an argument", true);
57 }
58 } else {
59 error("unrecognized option: " + arg, true);
60 }
61 } else if(fn == null) {
62 fn = arg;
63 } else {
64 error("too many arguments: " + arg, true);
65 }
66 }
67 if(fn == null) {
68 error("no input file provided", true);
69 } else {
70 switch(config.mode) {
71 case DECOMPILE: {
72 LFunction lmain = null;
73 try {
74 lmain = file_to_function(fn, config);
75 } catch(IOException e) {
76 error(e.getMessage(), false);
77 }
78 Decompiler d = new Decompiler(lmain);
79 Decompiler.State result = d.decompile();
80 d.print(result, config.getOutput());
81 break;
82 }
83 case DISASSEMBLE: {
84 LFunction lmain = null;
85 try {
86 lmain = file_to_function(fn, config);

Callers

nothing calls this directly

Calls 9

errorMethod · 0.95
file_to_functionMethod · 0.95
getOutputMethod · 0.95
disassembleMethod · 0.95
assembleMethod · 0.95
printMethod · 0.65
equalsMethod · 0.45
decompileMethod · 0.45

Tested by

no test coverage detected