private static int Copy(string fileName) { try { string input = Software.pathWorkbench + string.Format("/{0}.bin", fileName); data = DataManager.LoadEmulator(); string baseOutput = StringExtensions.GetBaseDir(data.pathCue[data.selectedID]); //Get the cue directory from the selected emulator string output = baseOutput + "/" + fileName + ".bin"; System.IO.File.Copy(input, output, overwrite: true); if (GenerateCueFile(baseOutput, fileName) != 0) { GD.Print("GENERATING CUE FROM COPY() error"); return(-2); } } catch (Exception e) { GD.Print("ERROR COPYING FILE: ", e.Message); return(-1); } return(0); }
public override void _Ready() { cb_skip = GetNode <CheckBox>("Panel/VBoxContainer/hb_cue3/CheckBox"); GD.Print("Started Emulator settings Scene"); selected_emulator = EMULATOR.None; fileDialog = GetNode <FileDialog>("FileDialog"); le_bios = GetNode <LineEdit>("Panel/VBoxContainer/hb_bios/le_bios"); le_exe = GetNode <LineEdit>("Panel/VBoxContainer/hb_exe/le_exe"); le_cue = GetNode <LineEdit>("Panel/VBoxContainer/hb_cue/le_cue"); bt_open_bios = GetNode <Button>("Panel/VBoxContainer/hb_bios/bt_open_bios"); bt_open_cue = GetNode <Button>("Panel/VBoxContainer/hb_cue/bt_open_cue"); bt_open_exe = GetNode <Button>("Panel/VBoxContainer/hb_exe/bt_open_exe"); bt_cancel = GetNode <Button>("Panel/VBoxContainer/hb_buttons/bt_cancel"); bt_test = GetNode <Button>("Panel/VBoxContainer/hb_buttons/bt_test"); bt_done = GetNode <Button>("Panel/VBoxContainer/hb_buttons/bt_done"); ob_option = GetNode <OptionButton>("Panel/VBoxContainer/hb_emulator/ob_emulator"); bt_cancel.Visible = false; dataEmulator = DataManager.LoadEmulator(); if (dataEmulator != null) { int id = dataEmulator.selectedID; ob_option.Select(id + 1); ob_option.EmitSignal("item_selected", id + 1); cb_skip.Pressed = dataEmulator.skipWindow; GD.Print("loaded data from emulator"); } else { dataEmulator = new DataEmulator(); GD.Print("create a new data for emulator"); } Connect("output", this, "OnOutput"); }
public async static void Main(Node target, PROGRAM pr = PROGRAM.BIGFILE, object data = null) { target.GetTree().Paused = true; string path = ""; string arg = ""; switch (pr) { case PROGRAM.BIGFILE: path = Software.pathWorkbench + "/tools_r10/bigtool.exe"; arg = Software.pathWorkbench + "/ctr_source/BIGFILE.BIG"; GD.Print("Program path: ", path); break; case PROGRAM.EMULATOR: DataEmulator d = (DataEmulator)data; int id = d.selectedID; path = d.pathExe[id]; arg = d.pathCue[id]; GD.Print("Executing emulator: ", path); break; case PROGRAM.EMULATOR_BIOS: DataEmulator de = (DataEmulator)data; int _id = de.selectedID; path = de.pathExe[_id]; arg = "-load_bios " + de.pathBios[_id] + " " + "-loadbin " + de.pathCue[_id]; break; case PROGRAM.CUSTOM_MODEL: path = Software.pathWorkbench + "/custom_model/model_reader.exe"; string _d = (data as string); arg = Software.pathWorkbench + _d; break; case PROGRAM.BUILD: path = data as string; arg = ""; break; default: target.EmitSignal("output", ERROR.INVALID_PARAM.ToString()); break; } var proc = new Process { StartInfo = new ProcessStartInfo { FileName = @path, Arguments = @arg, UseShellExecute = true, RedirectStandardOutput = false, CreateNoWindow = false, WorkingDirectory = Software.pathWorkbench } }; proc.Start(); while (!proc.WaitForExit(500)) { await target.ToSignal(target.GetTree(), "idle_frame"); } if (proc.ExitCode != 0) { target.EmitSignal("output", "Error #" + proc.ExitCode.ToString()); } else { target.EmitSignal("output", "OK"); } target.GetTree().Paused = false; }