Ejemplo n.º 1
0
        private string DispPCMRegion(ClsChip c)
        {
            if (c == null)
            {
                return("");
            }

            if (c.chipType == enmChipType.YM2609)
            {
                YM2609 opna2 = (YM2609)c;
                if (opna2.pcmDataEasyA == null &&
                    opna2.pcmDataEasyB == null &&
                    opna2.pcmDataEasyC == null &&
                    opna2.pcmDataDirectA.Count == 0 &&
                    opna2.pcmDataDirectB.Count == 0 &&
                    opna2.pcmDataDirectC.Count == 0
                    )
                {
                    return("");
                }
            }
            else if (c.chipType == enmChipType.YM2610B)
            {
                YM2610B opnb = (YM2610B)c;
                if (opnb.pcmDataEasyA == null &&
                    opnb.pcmDataEasyB == null &&
                    opnb.pcmDataDirectA.Count == 0 &&
                    opnb.pcmDataDirectB.Count == 0
                    )
                {
                    return("");
                }
            }
            else
            {
                if (c.pcmDataEasy == null && c.pcmDataDirect.Count == 0)
                {
                    return("");
                }
            }

            string region = "";

            for (int i = 0; i < 256; i++)
            {
                if (!desVGM.instPCM.ContainsKey(i))
                {
                    continue;
                }
                if (desVGM.instPCM[i].chip != c.chipType)
                {
                    continue;
                }
                if (desVGM.instPCM[i].chipNumber != c.ChipNumber)
                {
                    continue;
                }

                region += c.DispRegion(desVGM.instPCM[i]);
            }

            long tl = 0;

            foreach (int i in desVGM.instPCM.Keys)
            {
                tl += desVGM.instPCM[i].size;
            }
            region += (string.Format(msg.get("I04018"), tl));
            region += "\r\n";

            return(region);
        }
Ejemplo n.º 2
0
        private Dictionary <enmChipType, Tuple <string, string, List <string>, int[]> > GetChipPartNames()
        {
            Dictionary <enmChipType, Tuple <string, string, List <string>, int[]> > cpn = new Dictionary <enmChipType, Tuple <string, string, List <string>, int[]> >();
            ClsChip cp;

            //default
            cp = new Conductor(null, 0, null, null, 0);
            cpn.Add(enmChipType.CONDUCTOR, new Tuple <string, string, List <string>, int[]>(cp.Name, cp.ShortName, new List <string>(new string[] { "Cn" }), new int[] { 1, 1, 1 }));

            cp = new YM2151(null, 0, null, null, 0);
            cpn.Add(enmChipType.YM2151, new Tuple <string, string, List <string>, int[]>(cp.Name, cp.ShortName, new List <string>(
                                                                                             info.format == enmFormat.VGM ? new string[] { "X", "Xs" } : (info.format == enmFormat.XGM ? new string[] { } : new string[] { "X", "Xs" })
                                                                                             ), new int[] { 2, 0, -1 }));

            cp = new YM2203(null, 0, null, null, 0);
            cpn.Add(enmChipType.YM2203, new Tuple <string, string, List <string>, int[]>(cp.Name, cp.ShortName, new List <string>(
                                                                                             info.format == enmFormat.VGM ? new string[] { "N", "Ns" } : (info.format == enmFormat.XGM ? new string[] { } : new string[] { "N", "Ns" })
                                                                                             ), new int[] { 2, 0, -1 }));

            cp = new YM2608(null, 0, null, null, 0);
            cpn.Add(enmChipType.YM2608, new Tuple <string, string, List <string>, int[]>(cp.Name, cp.ShortName, new List <string>(
                                                                                             info.format == enmFormat.VGM ? new string[] { "P", "Ps" } : (info.format == enmFormat.XGM ? new string[] { } : new string[] { "P", "Ps" })
                                                                                             ), new int[] { 2, 0, -1 }));

            cp = new YM2609(null, 0, null, null, 0);
            cpn.Add(enmChipType.YM2609, new Tuple <string, string, List <string>, int[]>(cp.Name, cp.ShortName, new List <string>(
                                                                                             info.format == enmFormat.VGM ? new string[] { } : (info.format == enmFormat.XGM ? new string[] { } : new string[] { "U", "Us" })
                                                                                             ), new int[] { 0, 0, -1 }));

            cp = new YM2610B(null, 0, null, null, 0);
            cpn.Add(enmChipType.YM2610B, new Tuple <string, string, List <string>, int[]>(cp.Name, cp.ShortName, new List <string>(
                                                                                              info.format == enmFormat.VGM ? new string[] { "T", "Ts" } : (info.format == enmFormat.XGM ? new string[] { } : new string[] { "T", "Ts" })
                                                                                              ), new int[] { 2, 0, -1 }));

            cp = new YM2612(null, 0, null, null, 0);
            cpn.Add(enmChipType.YM2612, new Tuple <string, string, List <string>, int[]>(cp.Name, cp.ShortName, new List <string>(
                                                                                             info.format == enmFormat.VGM ? new string[] { "F", "Fs" } : (info.format == enmFormat.XGM ? new string[] { } : new string[] { "F", "Fs" })
                                                                                             ), new int[] { 2, 0, -1 }));

            cp = new SN76489(null, 0, null, null, 0);
            cpn.Add(enmChipType.SN76489, new Tuple <string, string, List <string>, int[]>(cp.Name, cp.ShortName, new List <string>(
                                                                                              info.format == enmFormat.VGM ? new string[] { "S", "Ss" } : (info.format == enmFormat.XGM ? new string[] { "S" } : new string[] { "S", "Ss" })
                                                                                              ), new int[] { 2, 1, -1 }));

            cp = new RF5C164(null, 0, null, null, 0);
            cpn.Add(enmChipType.RF5C164, new Tuple <string, string, List <string>, int[]>(cp.Name, cp.ShortName, new List <string>(
                                                                                              info.format == enmFormat.VGM ? new string[] { "R", "Rs" } : (info.format == enmFormat.XGM ? new string[] { } : new string[] { "R", "Rs" })
                                                                                              ), new int[] { 2, 0, -1 }));

            cp = new segaPcm(null, 0, null, null, 0);
            cpn.Add(enmChipType.SEGAPCM, new Tuple <string, string, List <string>, int[]>(cp.Name, cp.ShortName, new List <string>(
                                                                                              info.format == enmFormat.VGM ? new string[] { "Z", "Zs" } : (info.format == enmFormat.XGM ? new string[] { } : new string[] { "Z", "Zs" })
                                                                                              ), new int[] { 2, 0, -1 }));

            cp = new HuC6280(null, 0, null, null, 0);
            cpn.Add(enmChipType.HuC6280, new Tuple <string, string, List <string>, int[]>(cp.Name, cp.ShortName, new List <string>(
                                                                                              info.format == enmFormat.VGM ? new string[] { "H", "Hs" } : (info.format == enmFormat.XGM ? new string[] { } : new string[] { "H", "Hs" })
                                                                                              ), new int[] { 2, 0, -1 }));

            cp = new YM2612X(null, 0, null, null, 0);
            cpn.Add(enmChipType.YM2612X, new Tuple <string, string, List <string>, int[]>(cp.Name, cp.ShortName, new List <string>(
                                                                                              info.format == enmFormat.VGM ? new string[] { } : (info.format == enmFormat.XGM ? new string[] { "E" } : new string[] { })
                                                                                              ), new int[] { 0, 1, 0 }));

            cp = new YM2413(null, 0, null, null, 0);
            cpn.Add(enmChipType.YM2413, new Tuple <string, string, List <string>, int[]>(cp.Name, cp.ShortName, new List <string>(
                                                                                             info.format == enmFormat.VGM ? new string[] { "L", "Ls" } : (info.format == enmFormat.XGM ? new string[] { } : new string[] { "L", "Ls" })
                                                                                             ), new int[] { 2, 0, -1 }));

            cp = new C140(null, 0, null, null, 0);
            cpn.Add(enmChipType.C140, new Tuple <string, string, List <string>, int[]>(cp.Name, cp.ShortName, new List <string>(
                                                                                           info.format == enmFormat.VGM ? new string[] { "Y", "Ys" } : (info.format == enmFormat.XGM ? new string[] { } : new string[] { "Y", "Ys" })
                                                                                           ), new int[] { 2, 0, -1 }));

            cp = new AY8910(null, 0, null, null, 0);
            cpn.Add(enmChipType.AY8910, new Tuple <string, string, List <string>, int[]>(cp.Name, cp.ShortName, new List <string>(
                                                                                             info.format == enmFormat.VGM ? new string[] { "A", "As" } : (info.format == enmFormat.XGM ? new string[] { } : new string[] { "A", "As" })
                                                                                             ), new int[] { 2, 0, -1 }));

            cp = new K051649(null, 0, null, null, 0);
            cpn.Add(enmChipType.K051649, new Tuple <string, string, List <string>, int[]>(cp.Name, cp.ShortName, new List <string>(
                                                                                              info.format == enmFormat.VGM ? new string[] { "K", "Ks" } : (info.format == enmFormat.XGM ? new string[] { } : new string[] { "K", "Ks" })
                                                                                              ), new int[] { 2, 0, -1 }));

            cp = new QSound(null, 0, null, null, 0);
            cpn.Add(enmChipType.QSound, new Tuple <string, string, List <string>, int[]>(cp.Name, cp.ShortName, new List <string>(
                                                                                             info.format == enmFormat.VGM ? new string[] { "Q", "Qs" } : (info.format == enmFormat.XGM ? new string[] { } : new string[] { "Q", "Qs" })
                                                                                             ), new int[] { 2, 0, -1 }));

            cp = new K053260(null, 0, null, null, 0);
            cpn.Add(enmChipType.K053260, new Tuple <string, string, List <string>, int[]>(cp.Name, cp.ShortName, new List <string>(
                                                                                              info.format == enmFormat.VGM ? new string[] { "O", "Os" } : (info.format == enmFormat.XGM ? new string[] { } : new string[] { "O", "Os" })
                                                                                              ), new int[] { 2, 0, -1 }));

            cp = new MidiGM(null, 0, null, null, 0);
            cpn.Add(enmChipType.MIDI_GM, new Tuple <string, string, List <string>, int[]>(cp.Name, cp.ShortName, new List <string>(
                                                                                              info.format == enmFormat.VGM ? new string[] { } : (info.format == enmFormat.XGM ? new string[] { } : new string[] { "B", "Bs" })
                                                                                              ), new int[] { 0, 0, -1 }));

            //パート名定義文を解析し、デフォルト設定を書き換える
            foreach (Line ln in lnInformation)
            {
                string[] nn = ln.Txt.Split('=');
                if (nn.Length != 2)
                {
                    continue;
                }

                string wrd = nn[0].Trim().ToUpper();
                foreach (enmChipType val in Enum.GetValues(typeof(enmChipType)))
                {
                    if (!cpn.ContainsKey(val))
                    {
                        continue;
                    }

                    int n = -1;
                    if (wrd.IndexOf(Information.PARTNAME + cpn[val].Item1) == 0)
                    {
                        n = 0;
                    }
                    if (wrd.IndexOf(Information.PARTNAME + cpn[val].Item2) == 0)
                    {
                        n = 1;
                    }
                    if (n == -1)
                    {
                        continue;
                    }

                    n = -1;
                    if (wrd == Information.PARTNAME + cpn[val].Item1)
                    {
                        n = 0;
                    }
                    if (wrd == Information.PARTNAME + cpn[val].Item2)
                    {
                        n = 0;
                    }
                    if (wrd == Information.PARTNAME + cpn[val].Item1 + "SECONDARY")
                    {
                        n = 1;
                    }
                    if (wrd == Information.PARTNAME + cpn[val].Item2 + "SECONDARY")
                    {
                        n = 1;
                    }
                    if (n == -1)
                    {
                        continue;
                    }

                    List <string> npn = nn[1].Trim().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList <string>();
                    if (npn.Count < 1)
                    {
                        continue;
                    }
                    if (n == 1 && npn.Count > 1)
                    {
                        continue;                         //Secondaryの場合は複数一括定義を認めない
                    }
                    for (int i = 0; i < npn.Count; i++)
                    {
                        npn[i] = npn[i].Trim();
                        //書式のチェック
                        if (
                            (npn[i][0] < 'A' || npn[i][0] > 'Z') ||//1文字目は大文字である故t
                            (npn[i].Length == 2 && (npn[i][1] < 'a' || npn[i][1] > 'z'))   //2文字目は小文字であること
                            )
                        {
                            npn.RemoveAt(i);
                            i--;
                            continue;
                        }
                    }
                    if (npn.Count < 1)
                    {
                        continue;
                    }

                    //既に他の音源で定義済みか調べ、定義済みならそれを削除(空文字に)する
                    foreach (enmChipType e in cpn.Keys)
                    {
                        for (int i = 0; i < cpn[e].Item3.Count; i++)
                        {
                            if (string.IsNullOrEmpty(cpn[e].Item3[i]))
                            {
                                continue;
                            }
                            for (int j = 0; j < npn.Count; j++)
                            {
                                if (npn[j] == cpn[e].Item3[i])
                                {
                                    cpn[e].Item3.RemoveAt(i);
                                    i--;
                                    break;
                                }
                            }
                        }
                    }

                    if (n == 1)
                    {
                        while (cpn[val].Item3.Count < 2)
                        {
                            cpn[val].Item3.Add("");
                        }
                        cpn[val].Item3[1] = npn[0];
                    }
                    else
                    {
                        if (npn.Count < 2)
                        {
                            if (cpn[val].Item3.Count < 1)
                            {
                                cpn[val].Item3.Add("");
                            }
                            cpn[val].Item3[0] = npn[0];
                        }
                        else
                        {
                            cpn[val].Item3.Clear();
                            foreach (string np in npn)
                            {
                                cpn[val].Item3.Add(np);
                            }
                        }
                    }
                }
            }

            foreach (enmChipType e in cpn.Keys)
            {
                //定義数のチェック
                int c = 0;
                foreach (string p in cpn[e].Item3)
                {
                    if (string.IsNullOrEmpty(p))
                    {
                        continue;
                    }
                    c++;
                }

                int f = 0;
                switch (info.format)
                {
                case enmFormat.VGM:
                    f = 0;
                    break;

                case enmFormat.XGM:
                    f = 1;
                    break;

                case enmFormat.ZGM:
                    f = 2;
                    break;
                }

                if (cpn[e].Item4[f] != -1 && cpn[e].Item4[f] < c)
                {
                    if (cpn[e].Item4[f] != 0)
                    {
                        msgBox.setErrMsg(string.Format(
                                             msg.get("E24000")
                                             , info.format.ToString()
                                             , cpn[e].Item4[f]
                                             , c
                                             ), null);
                    }
                    else
                    {
                        msgBox.setErrMsg(string.Format(
                                             msg.get("E24001")
                                             , info.format
                                             , cpn[e].Item1
                                             , c
                                             ), null);
                    }
                }
            }

            return(cpn);
        }