async void OnCompile() { character = ob_char.GetItemText(ob_char.GetSelectedId()) + ob_format.GetItemText(ob_format.GetSelectedId()); string ss = string.Format(_in, character); GD.Print("Printing the input file: ", ss); ExecuteProcess.Main(this, ExecuteProcess.PROGRAM.CUSTOM_MODEL, ss); await ToSignal(this, "output"); if (outMsg != "OK") { GD.Print("ERROR EXECUTING CUSTOM MODEL"); return; } //TODO: throw the file from user to the custom model reader //Get the generated file and throw in model reader try { string input = "{0}{1}"; string output = "{0}"; input = string.Format(input, Software.pathWorkbench, string.Format(_in, character)); GD.Print("INPUT: ", input); output = Software.pathWorkbench + string.Format(_out, ob_char.GetItemText(ob_char.GetSelectedId())) + ".ctr"; GD.Print("OUTPUT: ", output); System.IO.File.Copy(@input, @output, overwrite: true); } catch (Exception e) { GD.Print("Error copying character to bigfile dir: ", e.Message); return; } //TODO: Show the generated model inside godot //TODO: if user agree continue //TODO: call rebuild script if (le_fileName.Text.Length < 3 || le_fileName.Text.Contains(" ") || le_fileName.Text.Contains(".")) { GD.Print("Invalid filename"); return; } Rebuild.Build(this, le_fileName.Text); }
async void Start() { await ToSignal(GetTree().CreateTimer(.5f, false), "timeout"); GD.Print("Started BigFile Extractor Scene"); Connect("output", this, "OnOutput"); string path = Software.pathWorkbench + "/bigfile"; if (System.IO.Directory.Exists(@path)) { Transition.instance.ChangeScene(Transition.SCENE.emulator_settings); return; } path = Software.pathWorkbench + "/ctr_source/BIGFILE.BIG"; ExecuteProcess.Main(this, ExecuteProcess.PROGRAM.BIGFILE); }
public async static void Build(Node target, string filename, bool copy = true, bool run = true) { GD.Print("Stating build the bin file"); //Create the custom build string path = Software.pathWorkbench + "/BUILD.BAT"; string customPath = Software.pathWorkbench + "/CUSTOM_BUILD.BAT"; System.IO.File.Copy(@path, @customPath, overwrite: true); //Set custom output name string text = System.IO.File.ReadAllText(customPath); text = text.Replace("_out_name_", filename); System.IO.File.WriteAllText(customPath, text); // int exit_code = OS.Execute(@customPath, new string[] {}); ExecuteProcess.Main(target, ExecuteProcess.PROGRAM.BUILD, @customPath); await target.ToSignal(target, "output"); int exit_code; if (copy) { exit_code = Copy(filename); if (exit_code != 0) { GD.Print("ERROR WHEN COPYING INSIDE BUILD()"); return; } if (run) { exit_code = StartEmulator(); return; } } }