// Start is called before the first frame update void Start() { conf = Memory.LoadConfig(); catCompo = CAT.GetComponent <ClassAffinityType>(); //ToolBox.FeedDatabases(new string[] { conf.VSPath + "MENU/SHIELD.SYD", conf.VSPath + "MENU/ARMOR.SYD", conf.VSPath + "MENU/BLADE.SYD", conf.VSPath + "MENU/ITEMNAME.BIN", conf.VSPath + "MENU/ITEMHELP.BIN" }); Grip.GripList(); Gem.GemList(); BladeDD.enabled = false; GripDD.enabled = false; Gem1DD.enabled = false; Gem2DD.enabled = false; Gem3DD.enabled = false; BladeDD.ClearOptions(); GripDD.ClearOptions(); Gem1DD.ClearOptions(); Gem2DD.ClearOptions(); Gem3DD.ClearOptions(); catCompo.RAZ(); MaterialDD.ClearOptions(); MaterialDD.AddOptions(new List <string>() { "Wood", "Leather", "Bronze", "Iron", "Hagane", "Silver", "Damascus" }); WeaponTypeDD.ClearOptions(); WeaponTypeDD.AddOptions(new List <string>() { "Weapon Type", "Dagger", "Sword", "Greatwsord", "Axe", "Mace", "Great Axe", "Staff", "Heavy Mace", "Polearm", "Crossbow", "Shield" }); }
void Start() { conf = Memory.LoadConfig(); ARMList = new string[30] { "SCEN001.ARM", "SCEN002.ARM", "SCEN003.ARM", "SCEN004.ARM", "SCEN005.ARM", "SCEN006.ARM", "SCEN007.ARM", "SCEN008.ARM", "SCEN009.ARM", "SCEN010.ARM", "SCEN011.ARM", "SCEN012.ARM", "SCEN013.ARM", "SCEN014.ARM", "SCEN015.ARM", "SCEN016.ARM", "SCEN017.ARM", "SCEN019.ARM", "SCEN020.ARM", "SCEN021.ARM", "SCEN022.ARM", "SCEN023.ARM", "SCEN024.ARM", "SCEN025.ARM", "SCEN026.ARM", "SCEN027.ARM", "SCEN028.ARM", "SCEN029.ARM", "SCEN030.ARM", "SCEN031.ARM" }; myDropdown.onValueChanged.AddListener(delegate { myDropdownValueChangedHandler(myDropdown); }); ARM aRM = new ARM(); aRM.Parse(conf.VSPath + "SMALL/SCEN001.ARM"); GameObject miniMapGO = aRM.BuildGameObject(); miniMapGO.transform.parent = container.transform; miniMapGO.transform.localPosition = Vector3.zero; miniMapGO.transform.localRotation = new Quaternion(); miniMapGO.transform.localScale = Vector3.one; }
// Start is called before the first frame update void Start() { if (conf == null) { conf = Memory.LoadConfig(); if (conf == null) { Memory.SaveConfig(new VSPConfig()); conf = Memory.LoadConfig(); } if (conf.VSPath != null && LBA.checkVSROM(conf.VSPath) != null) { Hide(pathCG); Show(menuCG); } } }
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"); } }
/// <param name="path">Target the EFFECT/E0*.P</param> public EFFECT(string path) { // it seems to be linked with EFFECT/PLG*.BIN where assembly script is (controls what the effect does) VSPConfig cf = Memory.LoadConfig(); baseFx = new P(path); lTexFx = new List <FBT>(); string[] hash = path.Split("/"[0]); name = hash[hash.Length - 1].Split("."[0])[0]; if (name == "E000") { // Special case, all other fx starts at 1 colFx = new FBC(string.Concat(cf.VSPath, "EFFECT/", "E000_0.FBC")); FBT texFx = new FBT(string.Concat(cf.VSPath, "EFFECT/", "E000_0.FBT"), colFx.GetPallets()); lTexFx.Add(texFx); } else { if (File.Exists(string.Concat(cf.VSPath, "EFFECT/", name, "_1.FBC"))) { // one effect can have up to 7 FBT and somtimes there is no FBC and FBT, maybe empty fx... colFx = new FBC(string.Concat(cf.VSPath, "EFFECT/", name, "_1.FBC")); string[] files = Directory.GetFiles(string.Concat(cf.VSPath, "EFFECT/"), string.Concat(name, "_", "*.FBT")); Texture2D[] textures = new Texture2D[files.Length]; int i = 0; for (i = 0; i < files.Length; i++) { string file = files[i]; FBT texFx = new FBT(file, colFx.GetPallets()); lTexFx.Add(texFx); textures[i] = texFx.texture; } Texture2D pack = new Texture2D(textures[0].width * i, textures[0].height, TextureFormat.ARGB32, false); pack.PackTextures(textures, 0); pack.filterMode = FilterMode.Trilinear; pack.anisoLevel = 4; pack.wrapMode = TextureWrapMode.Repeat; byte[] bytes = pack.EncodeToPNG(); ToolBox.DirExNorCreate(Application.dataPath + "/Resources/Textures/Effects/"); File.WriteAllBytes(Application.dataPath + "/Resources/Textures/Effects/" + name + ".png", bytes); GameObject fx = new GameObject("Effect_" + name); SpriteRenderer sr = fx.AddComponent <SpriteRenderer>(); SpriteAnimator animator = fx.AddComponent <SpriteAnimator>(); sr.drawMode = SpriteDrawMode.Sliced; sr.spriteSortPoint = SpriteSortPoint.Pivot; List <Sprite> sprites = new List <Sprite>(); List <Rect> spritesRect = new List <Rect>(); for (i = 0; i < baseFx.frames.Count; i++) { EffectFrame frame = baseFx.frames[i]; int xdec = (frame.texid - 1) * 128; Rect texRect = new Rect((int)frame.texRect.x + xdec, 256 - (int)frame.texRect.y - (int)frame.texRect.height, (int)frame.texRect.width, (int)frame.texRect.height); Sprite frameSprite; if (spritesRect.Contains(texRect)) { // we already get this sprite frameSprite = sprites[spritesRect.IndexOf(texRect)]; } else { frameSprite = Sprite.Create(pack, texRect, new Vector2(-frame.destRect.xMin, -frame.destRect.yMin) / 100); frameSprite.name = string.Concat(name, "Sp", sprites.Count); if (i == 0) { sr.sprite = frameSprite; } sprites.Add(frameSprite); spritesRect.Add(texRect); } baseFx.frames[i].sprite = frameSprite; } animator.frames = baseFx.frames; fx.transform.localScale = Vector3.one / 100; ToolBox.DirExNorCreate("Assets/Resources/Prefabs/Effects/"); GameObject prefab = PrefabUtility.SaveAsPrefabAsset(fx, "Assets/Resources/Prefabs/Effects/Effect_" + name + ".prefab"); AssetDatabase.AddObjectToAsset(pack, "Assets/Resources/Prefabs/Effects/Effect_" + name + ".prefab"); for (i = 0; i < sprites.Count; i++) { AssetDatabase.AddObjectToAsset(sprites[i], "Assets/Resources/Prefabs/Effects/Effect_" + name + ".prefab"); } foreach (Transform child in fx.transform) { GameObject.DestroyImmediate(child.gameObject); } prefab = PrefabUtility.SaveAsPrefabAsset(fx, "Assets/Resources/Prefabs/Effects/Effect_" + name + ".prefab"); GameObject.DestroyImmediate(fx); AssetDatabase.SaveAssets(); } else { // no FBC = no FBT } } }