private void SaveAsPrg(object sender, EventArgs e) { try { if (!IsOpened) { statusLabel.Text = Resources.FileIsNotOpen; return; } var dialog = new SaveFileDialog(); dialog.Filter = $"{Resources.PrgFiles}|*.prg;*.prog|{Resources.AllFiles} (*.*)|*.*"; dialog.Title = Resources.SavePrgFile; if (dialog.ShowDialog() != DialogResult.OK) { return; } var path = dialog.FileName; PRG.Save(path); statusLabel.Text = string.Format(Resources.Saved, path); } catch (Exception ex) { ExceptionHandler.Show(ex, "Saving As .PRG, exception found"); } }
static void TestPrg(JObject config) { var seed = config["Seed"].Value <ulong>(); var iterations = config["Iterations"].Value <int>(); var uniformInterval = JsonConvert.DeserializeObject <Tuple <uint, uint> >(config["UniformInterval"].ToString()); var outputFile = config["OutputFile"].Value <string>(); var outputLines = new List <string>(); var prg = new PRG(seed); for (int i = 0; i < iterations; i++) { if (uniformInterval != null) { uint random = prg.UniformInt(uniformInterval.Item1, uniformInterval.Item2); outputLines.Add(random.ToString()); } else { float random = prg.UniformUnitInterval(); outputLines.Add(random.ToString()); } } File.AppendAllLines(outputFile, outputLines); }
private void SaveAsPrg(object sender, EventArgs e) { if (!IsOpened) { statusLabel.Text = Resources.FileIsNotOpen; return; } var dialog = new SaveFileDialog(); dialog.Filter = $"{Resources.PrgFiles}|*.prg;*.prog|{Resources.AllFiles} (*.*)|*.*"; dialog.Title = Resources.SavePrgFile; if (dialog.ShowDialog() != DialogResult.OK) { return; } var path = dialog.FileName; try { PRG.Save(path); statusLabel.Text = string.Format(Resources.Saved, path); } catch (Exception exception) { MessageBoxUtilities.ShowException(exception); } }
internal static uint[] SampleWithoutReplacement(List<float> probabilities, uint size, PRG randomGenerator, ref float topActionProbability) { for (int i = 0; i < size; i++) { if (probabilities[i] == 1f) { throw new ArgumentException("The resulting probability distribution is deterministic and thus cannot generate a list of unique actions."); } } uint[] actions = Enumerable.Repeat<uint>(0, (int)size).ToArray(); bool[] exists = new bool[actions.Length + 1]; // plus 1 since action index is 1-based // sample without replacement uint runningIndex = 0; uint runningAction = 0; float draw, sum; while (runningIndex < size) { draw = randomGenerator.UniformUnitInterval(); sum = 0; for (int i = 0; i < size; i++) { sum += probabilities[i]; if (sum > draw) { runningAction = (uint)(i + 1); // check for duplicate if (exists[runningAction]) { continue; } // store newly sampled action if (runningIndex == 0) { topActionProbability = probabilities[i]; } actions[runningIndex++] = runningAction; exists[runningAction] = true; break; } } } return actions; }
private void SavePrg(object sender, EventArgs e) { if (!IsOpened) { statusLabel.Text = Resources.FileIsNotOpen; return; } try { var path = PrgPath; PRG.Save(path); statusLabel.Text = string.Format(Resources.Saved, path); } catch (Exception exception) { MessageBoxUtilities.ShowException(exception); } }
private void Upgrade(object sender, EventArgs e) { if (!IsOpened) { statusLabel.Text = Resources.FileIsNotOpen; return; } try { var path = PrgPath; PRG.Upgrade(FileVersion.Current); statusLabel.Text = string.Format(Resources.Upgraded, path); upgradeMenuItem.Visible = false; } catch (Exception exception) { MessageBoxUtilities.ShowException(exception); } }
private void SavePrg(object sender, EventArgs e) { if (!IsOpened) { statusLabel.Text = Resources.FileIsNotOpen; return; } try { var path = PrgPath; PRG.Save(path); statusLabel.Text = string.Format(Resources.Saved, path); } catch (Exception ex) { ExceptionHandler.Show(ex, "Saving PRG File Exception Found"); } }
private void Upgrade(object sender, EventArgs e) { try { if (!IsOpened) { statusLabel.Text = Resources.FileIsNotOpen; return; } var path = PrgPath; PRG.Upgrade(FileVersion.Current); statusLabel.Text = string.Format(Resources.Upgraded, path); upgradeMenuItem.Visible = false; } catch (Exception ex) { ExceptionHandler.Show(ex, "Upgrading File, Exception Found!"); } }
void OnGUI() { if (conf == null) { conf = Memory.LoadConfig(); if (conf == null) { Memory.SaveConfig(new VSPConfig()); conf = Memory.LoadConfig(); } if (conf.VSPath != null) { VSPath = conf.VSPath; if (conf.VS_Version == "") { conf.VS_Version = LBA.checkVSROM(VSPath); Memory.SaveConfig(conf); } } } GUILayout.Label("Vagrant Story Path", EditorStyles.boldLabel); GUILayoutOption[] options = { GUILayout.Width(300), GUILayout.MaxWidth(400) }; VSPath = EditorGUILayout.TextField("Vagrant Story CD path :", VSPath, options); GUILayoutOption[] options2 = { GUILayout.MaxWidth(30) }; bool VSPathTrigger = GUILayout.Button(new GUIContent("..."), options2); if (VSPathTrigger) { string path = EditorUtility.OpenFolderPanel("Path to Vagrant Story CD", "", ""); VSPath = path + "/"; } GUILayoutOption[] options3 = { GUILayout.Width(200), GUILayout.MaxWidth(400) }; bool VSSaveTrigger = GUILayout.Button(new GUIContent("Save Path"), options3); if (VSSaveTrigger) { conf.VSPath = VSPath; conf.VS_Version = LBA.checkVSROM(VSPath); Memory.SaveConfig(conf); } GUILayout.Label("Vagrant Story Version : " + conf.VS_Version); GUILayout.Space(10f); GUILayout.Label("| One File import", EditorStyles.boldLabel); FilePath = EditorGUILayout.TextField("File path (VS Path relativ) :", FilePath, options); bool filePathTrigger = GUILayout.Button(new GUIContent("..."), options2); if (filePathTrigger) { string path = EditorUtility.OpenFilePanel("Path to File", VSPath, ""); FilePath = path.Replace(VSPath, ""); } bool fileLoadTrigger = GUILayout.Button(new GUIContent("Load"), options3); if (fileLoadTrigger && VSPath != "" && FilePath != "") { string[] hash = FilePath.Split("/"[0]); string[] h2 = hash[hash.Length - 1].Split("."[0]); string folder = hash[0]; string fileName = h2[0]; string ext = h2[1]; switch (folder) { case "BATTLE": // BATTLE.PRG // BOG.DAT // INITBTL.PRG // SYSTEM.DAT switch (ext) { case "PRG": PRG parser = new PRG(); parser.Parse(VSPath + FilePath); break; } break; case "BG": // 001OP01A.FAR & TIM // 002OP01A.FAR & TIM // 007OP01A.FAR & TIM // 008OP01A.FAR & TIM break; case "EFFECT": // EFFPURGE.BIN maybe the PLG for E000.P // E*.P // E*.FBC // E*.FBT // PLG*.BIN lot of empty switch (ext) { case "P": EFFECT effect = new EFFECT(VSPath + FilePath); break; } break; case "ENDING": // ENDING.PRG // ENDING.XA // ILLUST06.BIN -> ILLUST16.BIN // NULL.DAT switch (ext) { case "BIN": TIM parser = new TIM(); parser.ParseIllust(VSPath + FilePath); break; } break; case "EVENT": // ****.EVT ParseEVT(VSPath + FilePath, true); break; case "MAP": // MAP***.MPD // Z***U**.ZUD // ZONE***.ZND switch (ext) { case "MPD": ParseMPD(VSPath + FilePath, true); break; case "ZUD": ParseZUD(VSPath + FilePath, fileName, true); break; case "ZND": ParseZND(VSPath + FilePath, true); break; } break; case "MENU": break; case "MOV": break; case "MUSIC": ParseAKAO(VSPath + FilePath, AKAO.MUSIC, true); break; case "OBJ": // **.SHP // **.SEQ // **.WEP switch (ext) { case "SHP": ParseSHP(VSPath + FilePath, fileName, true, true); break; case "WEP": ParseWEP(VSPath + FilePath, true); break; } break; case "SOUND": ParseAKAO(VSPath + FilePath, AKAO.SOUND, true); break; } } GUILayout.Label("| Batch imports", EditorStyles.boldLabel); GUILayout.BeginVertical(); GUILayout.Label("3D Model Formats : "); bool LoadARMTrigger = GUILayout.Button(new GUIContent("Load MiniMaps.ARM")); if (LoadARMTrigger && VSPath != "") { string[] files = Directory.GetFiles(VSPath + "SMALL/", "*.ARM"); float fileToParse = files.Length; float fileParsed = 0; foreach (string file in files) { string[] h = file.Split("/"[0]); string filename = h[h.Length - 1]; EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse)); ARM parser = new ARM(); //parser.UseDebug = true; parser.Parse(file); parser.BuildPrefab(true); fileParsed++; } EditorUtility.ClearProgressBar(); } bool LoadWEPTrigger = GUILayout.Button(new GUIContent("Load Weapons.WEP")); if (LoadWEPTrigger && VSPath != "") { BuildDatabase(); string[] files = Directory.GetFiles(VSPath + "OBJ/", "*.WEP"); float fileToParse = files.Length; float fileParsed = 0f; foreach (string file in files) { string[] h = file.Split("/"[0]); string filename = h[h.Length - 1]; EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse)); ParseWEP(file, true); fileParsed++; } EditorUtility.ClearProgressBar(); } bool LoadSHPTrigger = GUILayout.Button(new GUIContent("Load 3D Models.SHP")); if (LoadSHPTrigger && VSPath != "") { string[] files = Directory.GetFiles(VSPath + "OBJ/", "*.SHP"); float fileToParse = files.Length; float fileParsed = 0f; foreach (string file in files) { string[] h = file.Split("/"[0]); string filename = h[h.Length - 1]; EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse)); ParseSHP(file, filename, false); fileParsed++; } EditorUtility.ClearProgressBar(); } bool LoadZUDTrigger = GUILayout.Button(new GUIContent("Load Zones Units Datas.ZUD")); if (LoadZUDTrigger && VSPath != "") { string[] files = Directory.GetFiles(VSPath + "MAP/", "*.ZUD"); float fileToParse = files.Length; float fileParsed = 0f; foreach (string file in files) { string[] h = file.Split("/"[0]); string filename = h[h.Length - 1]; EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse)); ParseZUD(file, filename, false); fileParsed++; } EditorUtility.ClearProgressBar(); } bool LoadMPDTrigger = GUILayout.Button(new GUIContent("Load Map Datas.MPD")); if (LoadMPDTrigger && VSPath != "") { string[] files = Directory.GetFiles(VSPath + "MAP/", "*.MPD"); float fileToParse = files.Length; float fileParsed = 0f; foreach (string file in files) { string[] h = file.Split("/"[0]); string filename = h[h.Length - 1]; EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse)); ParseMPD(file, false); fileParsed++; } EditorUtility.ClearProgressBar(); } bool LoadEFFECTTrigger = GUILayout.Button(new GUIContent("Load EFFECT/E0*.P, E0*.FBC, E0*.FBT (Only Texture right now)")); if (LoadEFFECTTrigger && VSPath != "") { string[] files = Directory.GetFiles(VSPath + "EFFECT/", "*.P"); float fileToParse = files.Length; float fileParsed = 0; foreach (string file in files) { string[] h = file.Split("/"[0]); string filename = h[h.Length - 1]; EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse)); EFFECT effect = new EFFECT(file); fileParsed++; } //EFFECT effect = new EFFECT(VSPath + "EFFECT/E008.P"); EditorUtility.ClearProgressBar(); } GUILayout.EndVertical(); GUILayout.BeginVertical(); GUILayout.Label("Texture Formats : "); bool LoadGIMTrigger = GUILayout.Button(new GUIContent("Load GIM/*.GIM")); if (LoadGIMTrigger && VSPath != "") { string[] files = Directory.GetFiles(VSPath + "GIM/", "*.GIM"); float fileToParse = files.Length; float fileParsed = 0; foreach (string file in files) { string[] h = file.Split("/"[0]); string filename = h[h.Length - 1]; EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse)); GIM gim = new GIM(file); fileParsed++; } EditorUtility.ClearProgressBar(); } bool LoadMENUBGTrigger = GUILayout.Button(new GUIContent("Load MENU/*BG.BIN")); if (LoadMENUBGTrigger && VSPath != "") { string[] files = new string[] { VSPath + "MENU/MAPBG.BIN", VSPath + "MENU/MENUBG.BIN" }; float fileToParse = files.Length; float fileParsed = 0; foreach (string file in files) { string[] h = file.Split("/"[0]); string filename = h[h.Length - 1]; EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse)); TIM bg = new TIM(); bg.ParseBG(file); fileParsed++; } EditorUtility.ClearProgressBar(); } bool LoadDISTrigger = GUILayout.Button(new GUIContent("Load SMALL/*.DIS")); if (LoadDISTrigger && VSPath != "") { string[] files = Directory.GetFiles(VSPath + "SMALL/", "*.DIS"); float fileToParse = files.Length; float fileParsed = 0; foreach (string file in files) { string[] h = file.Split("/"[0]); string filename = h[h.Length - 1]; EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse)); DIS dis = new DIS(); dis.Parse(file); fileParsed++; } EditorUtility.ClearProgressBar(); } bool LoadTIMTrigger = GUILayout.Button(new GUIContent("BG/*.TIM")); if (LoadTIMTrigger && VSPath != "") { string[] files = Directory.GetFiles(VSPath + "BG/", "*.TIM"); float fileToParse = files.Length; float fileParsed = 0; foreach (string file in files) { string[] h = file.Split("/"[0]); string filename = h[h.Length - 1]; EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse)); TIM parser = new TIM(); parser.Parse(file); fileParsed++; } EditorUtility.ClearProgressBar(); } bool LoadILLUSTTrigger = GUILayout.Button(new GUIContent("ENDING/ILLUST*.BIN (Not Working Yet)")); if (LoadILLUSTTrigger && VSPath != "") { // not working yet string[] files = Directory.GetFiles(VSPath + "ENDING/", "*.BIN"); float fileToParse = files.Length; float fileParsed = 0; foreach (string file in files) { string[] h = file.Split("/"[0]); string filename = h[h.Length - 1]; EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse)); TIM parser = new TIM(); parser.ParseIllust(file); fileParsed++; } EditorUtility.ClearProgressBar(); } GUILayout.EndVertical(); GUILayout.BeginVertical(); GUILayout.Label("Audio Formats : "); /* * bool LoadAKAOTrigger = GUILayout.Button(new GUIContent("Load Akao SOUND/WAVE*.DAT")); * if (LoadAKAOTrigger && VSPath != "") * { * string[] files = Directory.GetFiles(VSPath + "SOUND/", "*.DAT"); * float fileToParse = files.Length; * float fileParsed = 0; * foreach (string file in files) * { * string[] h = file.Split("/"[0]); * string filename = h[h.Length - 1]; * EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse)); * AKAO parser = new AKAO(); * parser.UseDebug = true; * parser.Parse(file, AKAO.SOUND); * fileParsed++; * } * * EditorUtility.ClearProgressBar(); * } */ midTrigger = GUILayout.Toggle(midTrigger, new GUIContent("output a MIDI file ?")); sf2Trigger = GUILayout.Toggle(sf2Trigger, new GUIContent("output a SF2 (soundfont) file ?")); dlsTrigger = GUILayout.Toggle(dlsTrigger, new GUIContent("output a DLS (soundfont) file ? (Not working well yet)")); wavTrigger = GUILayout.Toggle(wavTrigger, new GUIContent("output a WAV file ? ( /_!_\\ heavy files)")); bool LoadAKAO2Trigger = GUILayout.Button(new GUIContent("Load Akao MUSIC/MUSIC*.DAT")); if (LoadAKAO2Trigger && VSPath != "") { string[] files = Directory.GetFiles(VSPath + "MUSIC/", "*.DAT"); float fileToParse = files.Length; float fileParsed = 0; foreach (string file in files) { string[] h = file.Split("/"[0]); string filename = h[h.Length - 1]; EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse)); ParseAKAO(file, AKAO.MUSIC, false); fileParsed++; } EditorUtility.ClearProgressBar(); } GUILayout.EndVertical(); GUILayout.BeginVertical(); GUILayout.Label("Data Formats : "); bool LoadSYDTrigger = GUILayout.Button(new GUIContent("Load MENU DataBase.SYD")); if (LoadSYDTrigger && VSPath != "") { BuildDatabase(); } bool LoadITEMTrigger = GUILayout.Button(new GUIContent("Load MENU ITEM*.BIN")); if (LoadITEMTrigger && VSPath != "") { BIN itemDB = new BIN(); itemDB.BuildItems(VSPath + "MENU/ITEMNAME.BIN", VSPath + "MENU/ITEMHELP.BIN"); } bool LoadEVENTTrigger = GUILayout.Button(new GUIContent("Load EVENT/*.EVT")); if (LoadEVENTTrigger && VSPath != "") { string[] files = Directory.GetFiles(VSPath + "EVENT/", "*.EVT"); float fileToParse = files.Length; float fileParsed = 0; foreach (string file in files) { string[] h = file.Split("/"[0]); string filename = h[h.Length - 1]; EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse)); ParseEVT(file, false); fileParsed++; } EditorUtility.ClearProgressBar(); } bool LoadHFTrigger = GUILayout.Button(new GUIContent("Load InGame Help SMALL/*.HF")); if (LoadHFTrigger && VSPath != "") { string[] files = Directory.GetFiles(VSPath + "SMALL/", "*.HF0"); float fileToParse = files.Length; float fileParsed = 0; foreach (string file in files) { string[] h = file.Split("/"[0]); string filename = h[h.Length - 1]; EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse)); HF0 parser = new HF0(); parser.Parse(file); fileParsed++; } EditorUtility.ClearProgressBar(); } GUILayout.EndVertical(); bool LoadEXPLOTrigger = GUILayout.Button(new GUIContent("Explore...")); if (LoadEXPLOTrigger && VSPath != "") { //BIN parser = new BIN(); //parser.Explore(VSPath + "SLES_027.55"); // spell and skills // "BATTLE/INITBTL.PRG" // Fandango //parser.Explore(VSPath + "BATTLE/BOG.DAT"); /* * string[] files = Directory.GetFiles(VSPath + "MENU/", "*.PRG"); * ToolBox.FeedDatabases(files); */ BIN parser = new BIN(); parser.Explore(VSPath + "SLES_027.55"); // spell and skills //PRG parser = new PRG(); //parser.Parse(VSPath + "TITLE/TITLE.PRG"); // spell and skills //parser.Parse(VSPath + "ENDING/ENDING.PRG"); //parser.Parse(VSPath + "BATTLE/BATTLE.PRG"); //parser.Parse(VSPath + "BATTLE/INITBTL.PRG"); } }
public prgvis(PRG context) { InitializeComponent(); DataContext = context; }
/// <summary> /// Maps a context to a decision. /// </summary> public abstract ExplorerDecision <TAction> MapContext(PRG prg, TPolicyValue policyAction, int numActions);
public void Read_Temco() { var prg = PRG.Load(GetFullPath("temco.prg")); Console.WriteLine(prg.ToString()); }
public void Read_Panel2() { var prg = PRG.Load(GetFullPath("panel2.prg")); Console.WriteLine(prg.ToString()); }
public void Read_Asy1() { var prg = PRG.Load(GetFullPath("asy1.prg")); Console.WriteLine(prg.ToString()); }