Beispiel #1
0
 private Directories()
 {
     _directories = new [] {
         Extended.GetUnixFullPath(Path.Combine(Memory.FF8DirData, "movies")),    //this folder has most movies
         Extended.GetUnixFullPath(Path.Combine(Memory.FF8DirDataLang, "movies")) //this folder has rest of movies
     }.Distinct().ToList().AsReadOnly();
     foreach (var s in _directories)
     {
         Memory.Log.WriteLine($"{nameof(Movie)} :: {nameof(Directories)} :: {s} ");
     }
 }
Beispiel #2
0
 private Directories()
 {
     if (_directories == null /*|| _directories.Count == 0*/)
     {
         _directories = new List <string> {
             Extended.GetUnixFullPath(Path.Combine(Memory.FF8DIRdata, "movies")),     //this folder has most movies
             Extended.GetUnixFullPath(Path.Combine(Memory.FF8DIRdata_lang, "movies")) //this folder has rest of movies
         };
         foreach (string s in _directories)
         {
             Memory.Log.WriteLine($"{nameof(Movie)} :: {nameof(Directories)} :: {s} ");
         }
     }
 }
Beispiel #3
0
        public static void Init()
        {
            Memory.Log.WriteLine($"{nameof(Music)} :: {nameof(Init)}");
            // PC 2000 version has an CD audio track for eyes on me. I don't think we can play that.
            const MusicId unkPrefix         = (MusicId)999;
            const MusicId altLoserPrefix    = (MusicId)512;
            const MusicId loserPrefix       = (MusicId)0;
            const MusicId eyesOnMePrefix    = (MusicId)513;
            const MusicId altEyesOnMePrefix = (MusicId)22;

            string[] ext = { ".ogg", ".sgt", ".wav", ".mp3" };
            //Roses and Wine V07 moves most of the sgt files to dmusic_backup
            //it leaves a few files behind. I think because RaW doesn't replace everything.
            //ogg files stored in:
            string RaW_ogg_pt = Extended.GetUnixFullPath(Path.Combine(Memory.FF8DIR, "RaW", "GLOBAL", "Music"));
            // From what I gather the OGG files and the sgt files have the same numerical prefix. I
            // might try to add the functionality to the debug screen monday.

            string dmusic_pt    = Extended.GetUnixFullPath(Path.Combine(Memory.FF8DIRdata, "Music", "dmusic_backup"));
            string music_pt     = Extended.GetUnixFullPath(Path.Combine(Memory.FF8DIRdata, "Music", "dmusic"));
            string music_wav_pt = Extended.GetUnixFullPath(Path.Combine(Memory.FF8DIRdata, "Music"));

            // goal of dicmusic is to be able to select a track by prefix. it adds an list of files
            // with the same prefix. so you can later on switch out which one you want.
            AddMusicPath(RaW_ogg_pt);
            AddMusicPath(music_wav_pt);
            AddMusicPath(dmusic_pt);
            AddMusicPath(music_pt);
            if (!Memory.dicMusic.ContainsKey(eyesOnMePrefix) && Memory.dicMusic.ContainsKey(altEyesOnMePrefix))
            {
                Memory.dicMusic.Add(eyesOnMePrefix, Memory.dicMusic[altEyesOnMePrefix]);
            }
            ArchiveBase a = ArchiveZzz.Load(Memory.Archives.ZZZ_OTHER);

            string[] list = a?.GetListOfFiles();
            if (list != null && list.Length > 0)
            {
                ZZZ = true;
                foreach (string m in list.Where(x => ext.Any(y => x.EndsWith(y, StringComparison.OrdinalIgnoreCase))))
                {
                    AddMusic(m);
                }
            }
            void AddMusicPath(string p)
            {
                if (!string.IsNullOrWhiteSpace(p) && Directory.Exists(p))
                {
                    foreach (string m in Directory.GetFiles(p).Where(x => ext.Any(y => x.EndsWith(y, StringComparison.OrdinalIgnoreCase))))
                    {
                        AddMusic(m);
                    }
                }
            }

            void AddMusic(string m)
            {
                if (ushort.TryParse(Path.GetFileName(m).Substring(0, 3), out ushort key))
                {
                    //mismatched prefix's go here
                    if ((MusicId)key == altLoserPrefix)
                    {
                        key = (ushort)loserPrefix; //loser.ogg and sgt don't match.
                    }
                }
                else if (m.IndexOf("eyes_on_me", StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    key = (ushort)eyesOnMePrefix;
                }
                else
                {
                    key = (ushort)unkPrefix;
                }

                if (!Memory.dicMusic.ContainsKey((MusicId)key))
                {
                    Memory.dicMusic.Add((MusicId)key, new List <string> {
                        m
                    });
                }
                else
                {
                    Memory.dicMusic[(MusicId)key].Add(m);
                }
            }
        }