Пример #1
0
        //FModの音声ファイルを選択
        private void Voice_Select_B_Click(object sender, RoutedEventArgs e)
        {
            if (IsClosing)
            {
                return;
            }
            OpenFileDialog ofd = new OpenFileDialog()
            {
                Title            = "Please select an FSB file.",
                Filter           = "FSB File(*.fsb)|*.fsb",
                InitialDirectory = Sub_Code.Get_OpenFile_Path(),
                Multiselect      = false
            };

            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Sub_Code.Set_OpenFile_Path(Path.GetDirectoryName(ofd.FileName));
                bool IsVoiceExist = false;
                FModChannel.setPaused(true);
                FModChannel = new FMOD_API.Channel();
                SubSound.release();
                MainSound.release();
                SubSound           = new FMOD_API.Sound();
                MainSound          = new FMOD_API.Sound();
                Location_T.Text    = "00:00";
                Location_S.Value   = 0;
                Location_S.Maximum = 0;
                FMod_List_Clear();
                List <string> Voices = Fmod_Class.FSB_GetNames(ofd.FileName);
                foreach (string File_Now in Voices)
                {
                    string File_Now_01 = File_Now.Replace(" ", "");
                    Voice_Add_List.Items.Add(File_Now_01);
                    if (File_Now_01.Contains("battle_01") || File_Now_01.Contains("battle_02") || File_Now_01.Contains("battle_03") || File_Now_01.Contains("start_battle_01"))
                    {
                        IsVoiceExist = true;
                    }
                }
                if (!IsVoiceExist)
                {
                    Message_Feed_Out("The specified file is not supported.");
                    Voice_Add_List.Items.Clear();
                    return;
                }
                Voice_FSB_File         = ofd.FileName;
                FSB_Details_L.Items[0] = "FSB File:" + Path.GetFileName(ofd.FileName);
                FSB_Details_L.Items[1] = "Number of voices:" + Voices.Count;
                Voice_Select_T.Text    = Path.GetFileName(ofd.FileName);
                Voices.Clear();
            }
        }
Пример #2
0
        public static List <List <string> > Voice_BGM_Name_Change_From_FSB_To_Index_FSBFile(string FSB_File_Path)
        {
            List <List <string> > Temp = new List <List <string> >();

            for (int Number_01 = 0; Number_01 < 34; Number_01++)
            {
                Temp.Add(new List <string>());
            }
            if (Voice_BGM_Change_List.Count == 0)
            {
                Voice_BGM_Change_List_Init();
            }
            List <string> To_File_Name = new List <string>(); To_File_Name.AddRange(new string[] { "mikata", "danyaku", "hikantuu", "kantuu", "tokusyu", "tyoudan", "syatyou", "souzyuusyu", "tekikasai", "gekiha", "enjinhason", "enjintaiha", "enjinhukkyuu"
                                                                                                   , "kasai", "syouka", "nenryou", "housinhason", "housintaiha", "housinhukkyuu", "housyu", "soutensyu", "musen", "musensyu", "battle", "kansokuhason", "kansokutaiha"
                                                                                                   , "kansokuhukkyuu", "ritaihason", "ritaitaiha", "ritaihukkyuu", "houtouhason", "houtoutaiha", "houtouhukkyuu", "taiha" });
            List <string> Files = Fmod_Class.FSB_GetNames(FSB_File_Path);

            foreach (string File_Now in Files)
            {
                string Name_Temp = Path.GetFileNameWithoutExtension(File_Now);
                if (!Sub_Code.IsIncludeInt_From_String_V2(Name_Temp, "_"))
                {
                    continue;
                }
                if (Name_Temp.Contains("_"))
                {
                    string Name = Name_Temp.Substring(0, Name_Temp.LastIndexOf('_'));
                    Name = Name.Trim();
                    for (int Number = 0; Number < 34; Number++)
                    {
                        if (To_File_Name[Number] == Name)
                        {
                            Temp[Number].Add(Name_Temp);
                            break;
                        }
                        foreach (string Voice_Name in Voice_BGM_Change_List[Number])
                        {
                            if (Name.Contains(Voice_Name))
                            {
                                Temp[Number].Add(Name_Temp);
                                break;
                            }
                        }
                    }
                }
            }
            return(Temp);
        }
        //FModのBGMファイルを選択
        private void BGM_Select_B_Click(object sender, RoutedEventArgs e)
        {
            if (IsClosing)
            {
                return;
            }
            OpenFileDialog ofd = new OpenFileDialog()
            {
                Title       = "BGMファイルを選択してください。",
                Filter      = "BGMファイル(Music.fsb)|Music.fsb",
                Multiselect = false
            };

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                if (Fmod_Class.FSB_GetLength(ofd.FileName) >= 20)
                {
                    Message_Feed_Out("指定したファイルはファイル数が20個以上あるため追加することができません。");
                    return;
                }
                BGM_Select_Only = Fmod_Class.FSB_GetNames(ofd.FileName);
                bool IsBGMExsist = false;
                foreach (string File_Now in BGM_Select_Only)
                {
                    if (File_Now == "Music_01")
                    {
                        IsBGMExsist = true;
                        break;
                    }
                }
                if (!IsBGMExsist)
                {
                    Message_Feed_Out("指定したファイルにBGMが含まれていませんでした。");
                    return;
                }
                BGM_FSB_File           = ofd.FileName;
                FSB_Details_L.Items[1] = "BGMファイル:" + Path.GetFileName(ofd.FileName);
                foreach (string BGM_Name_Now in BGM_Select_Only)
                {
                    BGM_Add_List.Items.Add(BGM_Name_Now);
                }
                FSB_Details_L.Items[3] = "BGM数:" + BGM_Add_List.Items.Count + "個";
            }
        }
        //FModの音声ファイルを選択
        private void Voice_Select_B_Click(object sender, RoutedEventArgs e)
        {
            if (IsClosing)
            {
                return;
            }
            OpenFileDialog ofd = new OpenFileDialog()
            {
                Title       = "音声ファイルを選択してください。",
                Filter      = "音声ファイル(*.fsb)|*.fsb",
                Multiselect = false
            };

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                bool          IsVoiceExist = false;
                List <string> Voices       = Fmod_Class.FSB_GetNames(ofd.FileName);
                foreach (string File_Now in Voices)
                {
                    string File_Now_01 = File_Now.Replace(" ", "");
                    if (File_Now_01.Contains("battle_01") || File_Now_01.Contains("battle_02") || File_Now_01.Contains("battle_03") || File_Now_01.Contains("start_battle_01") || File_Now_01.Contains("start_battle("))
                    {
                        IsVoiceExist = true;
                        break;
                    }
                }
                if (!IsVoiceExist)
                {
                    Message_Feed_Out("指定したファイルは対応していません。詳しくは注意事項を参照してください。");
                    return;
                }
                Voices.Clear();
                Voice_FSB_File         = ofd.FileName;
                FSB_Details_L.Items[0] = "音声ファイル:" + Path.GetFileName(ofd.FileName);
                FSB_Details_L.Items[2] = "音声数:" + Fmod_Class.FSB_GetLength(ofd.FileName) + "個";
            }
        }
Пример #5
0
        private async void Open_File_B_Click(object sender, RoutedEventArgs e)
        {
            if (IsClosing || IsBusy)
            {
                return;
            }
            OpenFileDialog ofd = new OpenFileDialog()
            {
                Title       = "WoTBの音声Modを選択してください。",
                Multiselect = false,
                Filter      = "WoTB音声(*.fsb;*.bnk)|*.fsb;*.bnk"
            };

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                IsBusy = true;
                try
                {
                    string To_Dir = Voice_Set.Special_Path + "/Wwise/BNK_WAV_WoT";
                    try
                    {
                        if (Directory.Exists(To_Dir))
                        {
                            Directory.Delete(To_Dir, true);
                        }
                    }
                    catch (Exception e1)
                    {
                        Sub_Code.Error_Log_Write(e1.Message);
                    }
                    for (int Number = 0; Number < 34; Number++)
                    {
                        BNK_FSB_Enable.Add(new List <bool>());
                    }
                    if (Path.GetExtension(ofd.FileName) == ".bnk")
                    {
                        Message_T.Text = ".bnkファイルを解析しています...";
                        await Task.Delay(50);

                        Wwise_Class.BNK_Parse p = new Wwise_Class.BNK_Parse(ofd.FileName);
                        if (!p.IsVoiceFile(true))
                        {
                            Message_Feed_Out("選択されたbnkファイルは音声データではありません。");
                            IsBusy = false;
                            return;
                        }
                        BNK_FSB_Voices = p.Get_Voices(true);
                        List <string> Need_Files = new List <string>();
                        foreach (List <string> Types in BNK_FSB_Voices)
                        {
                            foreach (string File_Now in Types)
                            {
                                Need_Files.Add(File_Now);
                            }
                        }
                        if (Need_Files.Count == 0)
                        {
                            Message_T.Text = "移植できるファイルが見つからなかったため、特殊な方法で解析しています...";
                            await Task.Delay(50);

                            p.SpecialBNKFileMode = 1;
                            BNK_FSB_Voices       = p.Get_Voices(true);
                            foreach (List <string> Types in BNK_FSB_Voices)
                            {
                                foreach (string File_Now in Types)
                                {
                                    Need_Files.Add(File_Now);
                                }
                            }
                            if (Need_Files.Count == 0)
                            {
                                p.Clear();
                                BNK_FSB_Voices.Clear();
                                Message_Feed_Out("移植できる音声が見つかりませんでした。");
                                IsBusy = false;
                                return;
                            }
                        }
                        p.Clear();
                        Voices_L.Items.Clear();
                        Content_L.Items.Clear();
                        Now_Stream_Count = 0;
                        Message_T.Text   = ".wavまたは.oggに変換しています...";
                        await Task.Delay(50);

                        Wwise_File_Extract_V2 Wwise_BNK = new Wwise_File_Extract_V2(ofd.FileName);
                        Max_Stream_Count = Wwise_BNK.Wwise_Get_Numbers();
                        Wwise_BNK.Wwise_Extract_To_WEM_Directory_V2(To_Dir);
                        Wwise_BNK.Bank_Clear();
                        Message_T.Text = "不要な音声ファイルを削除しています...";
                        await Task.Delay(50);

                        string[] All_Files = Directory.GetFiles(To_Dir, "*", SearchOption.TopDirectoryOnly);
                        foreach (string File_Now in All_Files)
                        {
                            if (!Need_Files.Contains(Path.GetFileNameWithoutExtension(File_Now)))
                            {
                                Sub_Code.File_Delete_V2(File_Now);
                            }
                        }
                        //効果音を削除(これ以外は取り除けない)
                        string[] Files = Directory.GetFiles(To_Dir, "*.wem", SearchOption.TopDirectoryOnly);
                        foreach (string File_Now in Files)
                        {
                            Sub_Code.File_Delete_V2(File_Now);
                        }
                        Message_T.Text = ".oggファイルを.wavファイルに変換しています...";
                        await Task.Delay(50);

                        await Multithread.Convert_To_Wav(Directory.GetFiles(To_Dir, "*.ogg", SearchOption.TopDirectoryOnly), To_Dir, true, true);

                        File_Name_T.Text = Path.GetFileName(ofd.FileName);
                        Message_Feed_Out(".bnkファイルをロードしました。SEが含まれている場合は無効化してください。");
                    }
                    else
                    {
                        Message_T.Text = ".fsbファイルを解析しています...";
                        await Task.Delay(50);

                        bool          IsVoiceExist = false;
                        List <string> Voices       = Fmod_Class.FSB_GetNames(ofd.FileName);
                        foreach (string File_Now in Voices)
                        {
                            string File_Now_01 = File_Now.Replace(" ", "");
                            if (File_Now_01.Contains("battle_01") || File_Now_01.Contains("battle_02") || File_Now_01.Contains("battle_03") || File_Now_01.Contains("start_battle_01"))
                            {
                                IsVoiceExist = true;
                                break;
                            }
                        }
                        if (!IsVoiceExist)
                        {
                            Message_Feed_Out("指定したFSBファイルは対応していません。");
                            IsBusy = false;
                            return;
                        }
                        Voices.Clear();
                        Message_T.Text = "FSBファイルからファイルを抽出しています...";
                        await Task.Delay(50);

                        Max_Stream_Count = Fmod_Class.FSB_GetLength(ofd.FileName);
                        Fmod_File_Extract_V2.FSB_Extract_To_Directory(ofd.FileName, To_Dir + "_TMP");
                        Message_T.Text = ".wavファイルを修正しています...";
                        await Task.Delay(50);

                        await Multithread.Convert_To_Wav(To_Dir + "_TMP", To_Dir, true, true, false, false);

                        Directory.Delete(To_Dir + "_TMP", true);
                        Message_T.Text = "ファイル名からリストに配置しています...";
                        await Task.Delay(50);

                        BNK_FSB_Voices = Voice_Set.Voice_BGM_Name_Change_From_FSB_To_Index(To_Dir);
                        Voices_L.Items.Clear();
                        Content_L.Items.Clear();
                        Now_Stream_Count = 0;
                        Message_T.Text   = "不要なファイルを削除しています...";
                        await Task.Delay(50);

                        foreach (string File_Name in Directory.GetFiles(To_Dir, "*", SearchOption.TopDirectoryOnly))
                        {
                            string Name_Only = Path.GetFileNameWithoutExtension(File_Name);
                            bool   IsExsist  = false;
                            for (int Number = 0; Number < BNK_FSB_Voices.Count; Number++)
                            {
                                foreach (string Name_Now in BNK_FSB_Voices[Number])
                                {
                                    if (Name_Only == Name_Now)
                                    {
                                        IsExsist = true;
                                        break;
                                    }
                                }
                                if (IsExsist)
                                {
                                    break;
                                }
                            }
                            if (!IsExsist)
                            {
                                Sub_Code.File_Delete_V2(File_Name);
                            }
                        }
                        File_Name_T.Text = Path.GetFileName(ofd.FileName);
                        Message_Feed_Out(".fsbファイルをロードしました。");
                    }
                    if (BNK_FSB_Voices[5].Count == 0 && BNK_FSB_Voices[2].Count > 0)
                    {
                        BNK_FSB_Voices[5] = new List <string>(BNK_FSB_Voices[2]);
                    }
                    if (BNK_FSB_Voices[4].Count == 0 && BNK_FSB_Voices[3].Count > 0)
                    {
                        BNK_FSB_Voices[4] = new List <string>(BNK_FSB_Voices[3]);
                    }
                    for (int Number = 0; Number < 34; Number++)
                    {
                        Now_Stream_Count += BNK_FSB_Voices[Number].Count;
                        Voices_L.Items.Add(Voice_Set.Get_Voice_Type_Japanese_Name_V2(Number) + " : " + BNK_FSB_Voices[Number].Count + "個");
                    }
                    for (int Number_01 = 0; Number_01 < BNK_FSB_Voices.Count; Number_01++)
                    {
                        for (int Number_02 = 0; Number_02 < BNK_FSB_Voices[Number_01].Count; Number_02++)
                        {
                            BNK_FSB_Enable[Number_01].Add(true);
                        }
                    }
                }
                catch (Exception e1)
                {
                    IsBusy = false;
                    Sub_Code.Error_Log_Write(e1.Message);
                    BNK_FSB_Clear(false);
                    Message_Feed_Out("エラーが発生しました。Error_Log.txtを参照してください。");
                }
            }
            IsBusy = false;
        }
        private async void Open_File_B_Click(object sender, RoutedEventArgs e)
        {
            if (IsClosing || IsBusy)
            {
                return;
            }
            System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog()
            {
                Title       = "音声Modを選択してください。",
                Filter      = "音声ファイル(*.fsb;*.bnk)|*.fsb;*.bnk",
                Multiselect = false
            };
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    IsBusy = true;
                    string Ex       = Path.GetExtension(ofd.FileName);
                    string PCK_Path = Path.GetDirectoryName(ofd.FileName) + "\\" + Path.GetFileNameWithoutExtension(ofd.FileName) + ".pck";
                    if (Ex == ".fsb")
                    {
                        Message_T.Text = ".fsbファイルを解析しています...";
                        await Task.Delay(50);

                        bool          IsVoiceExist = false;
                        List <string> Voices       = Fmod_Class.FSB_GetNames(ofd.FileName);
                        foreach (string File_Now in Voices)
                        {
                            string File_Now_01 = File_Now.Replace(" ", "");
                            if (File_Now_01.Contains("battle_01") || File_Now_01.Contains("battle_02") || File_Now_01.Contains("battle_03") || File_Now_01.Contains("start_battle_01"))
                            {
                                IsVoiceExist = true;
                                break;
                            }
                        }
                        if (!IsVoiceExist)
                        {
                            Message_Feed_Out("指定したファイルは対応していません。詳しくは注意事項を参照してください。");
                            IsBusy = false;
                            return;
                        }
                        Voices.Clear();
                        Max_Stream_Count = Fmod_Class.FSB_GetLength(ofd.FileName);
                        BNK_FSB_Voices   = Voice_Set.Voice_BGM_Name_Change_From_FSB_To_Index_FSBFile(ofd.FileName);
                        Now_Stream_Count = 0;
                        Voices_L.Items.Clear();
                        for (int Number = 0; Number < 34; Number++)
                        {
                            Now_Stream_Count += BNK_FSB_Voices[Number].Count;
                            Voices_L.Items.Add(Voice_Set.Get_Voice_Type_Japanese_Name_V2(Number) + " : " + BNK_FSB_Voices[Number].Count + "個");
                        }
                    }
                    else if (Ex == ".bnk")
                    {
                        Message_T.Text = ".bnkファイルを解析しています...";
                        await Task.Delay(50);

                        string To_Dir = Voice_Set.Special_Path + "/Wwise/BNK_WAV_WoT";
                        try
                        {
                            if (Directory.Exists(To_Dir))
                            {
                                Directory.Delete(To_Dir, true);
                            }
                        }
                        catch (Exception e1)
                        {
                            Sub_Code.Error_Log_Write(e1.Message);
                        }
                        if (PCK_Mode_C.IsChecked.Value)
                        {
                            if (!File.Exists(PCK_Path))
                            {
                                Message_Feed_Out("PCKファイルが見つかりませんでした。");
                                IsBusy = false;
                                return;
                            }
                            IsPCKMode = true;
                        }
                        else
                        {
                            IsPCKMode = false;
                        }
                        int BNK_Mode            = 0;
                        Wwise_Class.BNK_Parse p = new Wwise_Class.BNK_Parse(ofd.FileName);
                        if (p.IsVoiceFile(true))
                        {
                            BNK_Mode = 1;
                        }
                        else if (p.IsVoiceFile())
                        {
                            BNK_Mode = 2;
                        }
                        else
                        {
                            Message_Feed_Out("選択されたbnkファイルは音声データではありません。");
                            IsBusy = false;
                            return;
                        }
                        bool Mode;
                        if (BNK_Mode == 1)
                        {
                            Mode = true;
                        }
                        else if (BNK_Mode == 2)
                        {
                            Mode = false;
                        }
                        else
                        {
                            Message_Feed_Out("選択されたbnkファイルは音声データではありません。");
                            IsBusy = false;
                            return;
                        }
                        BNK_FSB_Voices = p.Get_Voices(Mode);
                        foreach (List <string> Types in BNK_FSB_Voices)
                        {
                            foreach (string File_Now in Types)
                            {
                                Need_Files.Add(File_Now);
                            }
                        }
                        if (Need_Files.Count == 0)
                        {
                            Message_T.Text = "移植できるファイルが見つからなかったため、特殊な方法で解析しています...";
                            await Task.Delay(50);

                            p.SpecialBNKFileMode = 1;
                            BNK_FSB_Voices       = p.Get_Voices(Mode);
                            foreach (List <string> Types in BNK_FSB_Voices)
                            {
                                foreach (string File_Now in Types)
                                {
                                    Need_Files.Add(File_Now);
                                }
                            }
                        }
                        if (Need_Files.Count == 0)
                        {
                            p.Clear();
                            BNK_FSB_Voices.Clear();
                            Message_Feed_Out("移植できる音声が見つかりませんでした。");
                            IsBusy = false;
                            return;
                        }
                        Max_Stream_Count = p.Get_File_Count();
                        p.Clear();
                        Voices_L.Items.Clear();
                        Now_Stream_Count = 0;
                        for (int Number = 0; Number < 34; Number++)
                        {
                            Now_Stream_Count += BNK_FSB_Voices[Number].Count;
                            Voices_L.Items.Add(Voice_Set.Get_Voice_Type_Japanese_Name_V2(Number) + " : " + BNK_FSB_Voices[Number].Count + "個");
                        }
                    }
                    Message_Feed_Out("解析が完了しました。");
                    if (IsPCKMode)
                    {
                        Selected_File = PCK_Path;
                    }
                    Selected_File    = ofd.FileName;
                    File_Name_T.Text = "ファイル名:" + Path.GetFileName(ofd.FileName);
                }
                catch (Exception e1)
                {
                    Selected_File = "";
                    BNK_FSB_Voices.Clear();
                    Voices_L.Items.Clear();
                    Voices_L.Items.Add("音声ファイルが選択されていません。");
                    Sub_Code.Error_Log_Write(e1.Message);
                    Message_Feed_Out("エラーが発生しました。ファイル形式が正しくない可能性があります。");
                }
            }
            ofd.Dispose();
            IsBusy = false;
        }