コード例 #1
0
        public EmulatorProperties GetEmulatorSetup()
        {
            var emulatorProperties = new EmulatorProperties();

            emulatorProperties.descriptiveName = descriptiveName;
            emulatorProperties.id    = id;
            emulatorProperties.about = about;
            emulatorProperties.gameLauncherMethod = gameLauncherMethod.ToString();
            emulatorProperties.executable         = executable;
            emulatorProperties.extension          = extension;
            emulatorProperties.libretroCore       = libretroCore;
            emulatorProperties.arguments          = arguments;
            emulatorProperties.options            = options;
            emulatorProperties.emulatorPath       = emulatorPath;
            emulatorProperties.gamePath           = gamePath;
            emulatorProperties.workingDir         = workingDir;
            emulatorProperties.outputCommandLine  = outputCommandLine;
            emulatorProperties.marqueePath        = marqueePath;
            emulatorProperties.screenPath         = screenPath;
            emulatorProperties.screenVideoPath    = screenVideoPath;
            emulatorProperties.genericPath        = genericPath;
            emulatorProperties.titlePath          = titlePath;
            emulatorProperties.infoPath           = infoPath;
            return(emulatorProperties);
        }
コード例 #2
0
        // This saves Emulators Configuration from the loaded gameobjects, not from ArcadeManager's static property. Only useful if we support making changes in the editor!
        public void SaveEmulators()
        {
            List <EmulatorProperties> emulatorsList = GetListOfEmulatorProperties();

            if (emulatorsList == null)
            {
                return;
            }
            List <EmulatorConfiguration> tempEmulatorsConfigurationList = new List <EmulatorConfiguration>();

            foreach (EmulatorProperties emulatorProperties in emulatorsList)
            {
                EmulatorConfiguration cfg = GetEmulatorConfiguration(emulatorProperties.id);
                if (cfg == null)
                {
                    cfg = new EmulatorConfiguration();
                }
                cfg.emulator = emulatorProperties;
                tempEmulatorsConfigurationList.Add(cfg);
            }
            ArcadeManager.emulatorsConfigurationList = tempEmulatorsConfigurationList;
            SaveEmulatorsConfigurationList();

            List <EmulatorProperties> GetListOfEmulatorProperties()
            {
                GameObject objParent           = GameObject.Find("Emulators"); // TODO: Ugly fix this!
                List <EmulatorProperties> list = new List <EmulatorProperties>();

                if (objParent == null)
                {
                    Debug.Log("no items found");
                    return(null);
                }
                var obj = objParent.GetComponents <EmulatorSetup>();

                foreach (EmulatorSetup item in obj)
                {
                    EmulatorProperties emulator = item.GetEmulatorSetup();
                    list.Add(emulator);
                }
                return(list);
            }
        }
コード例 #3
0
 public void SetEmulatorSetup(EmulatorProperties emulatorProperties)
 {
     descriptiveName = emulatorProperties.descriptiveName;
     id    = emulatorProperties.id;
     about = emulatorProperties.about;
     System.Enum.TryParse(emulatorProperties.gameLauncherMethod, true, out gameLauncherMethod);
     executable        = emulatorProperties.executable;
     extension         = emulatorProperties.extension;
     libretroCore      = emulatorProperties.libretroCore;
     arguments         = emulatorProperties.arguments;
     options           = emulatorProperties.options;
     emulatorPath      = emulatorProperties.emulatorPath;
     gamePath          = emulatorProperties.gamePath;
     workingDir        = emulatorProperties.workingDir;
     marqueePath       = emulatorProperties.marqueePath;
     screenPath        = emulatorProperties.screenPath;
     screenVideoPath   = emulatorProperties.screenVideoPath;
     genericPath       = emulatorProperties.genericPath;
     titlePath         = emulatorProperties.titlePath;
     infoPath          = emulatorProperties.infoPath;
     outputCommandLine = emulatorProperties.outputCommandLine;
 }
コード例 #4
0
ファイル: ModelSetup.cs プロジェクト: 3DArcade/3DArcade
        public void Setup(ModelProperties modelProperties, ModelSharedProperties modelSharedProperties)
        {
            this.modelSharedProperties = modelSharedProperties;
            SetModelProperties(modelProperties);

            List <GameObject> thisChildren = new List <GameObject>();

            if (!Application.isPlaying)
            {
                foreach (Transform child in transform)
                {
                    if (child.gameObject != null)
                    {
                        thisChildren.Add(child.gameObject);
                    }
                }
            }
            else
            {
                thisChildren = new List <GameObject>();
                transform.GetChild(0).transform.tag = transform.tag;
                foreach (Transform child in transform.GetChild(0).transform)
                {
                    if (child.gameObject != null)
                    {
                        thisChildren.Add(child.gameObject);
                    }
                }
            }

            List <EmulatorConfiguration> emulatorList = new List <EmulatorConfiguration>();

            emulatorList = ArcadeManager.emulatorsConfigurationList.Where(x => x.emulator.id == emulator).ToList();
            if (emulatorList.Count < 1)
            {
                return;
            }

            EmulatorProperties emulatorSelected = emulatorList[0].emulator;

            if (emulatorSelected == null)
            {
                return;
            }

            // TODO: setup some default paths for marquees, screenshots and generics.

            // Marquee setup
            if (thisChildren.Count > 0)
            {
                Texture2D        tex         = null;
                List <Texture2D> textureList = new List <Texture2D>();
                string           url         = null;
                // image and image cylcing (cycling with id_*.ext)
                textureList = FileManager.LoadImagesFromFolder(ArcadeManager.applicationPath + FileManager.CorrectFilePath(emulatorSelected.marqueePath), id);
                if (textureList.Count < 1)
                {
                    textureList = FileManager.LoadImagesFromFolder(ArcadeManager.applicationPath + FileManager.CorrectFilePath(emulatorSelected.marqueePath), idParent);
                }
                // video
                url = FileManager.GetVideoPathFromFolder(ArcadeManager.applicationPath + FileManager.CorrectFilePath(emulatorSelected.marqueePath), id);
                if (url == null)
                {
                    url = FileManager.GetVideoPathFromFolder(ArcadeManager.applicationPath + FileManager.CorrectFilePath(emulatorSelected.marqueePath), idParent);
                }
                // if we only have one or zero images we dont have to setup videoplayer/image cycling
                if (url == null && textureList.Count <= 1)
                {
                    var marquee = thisChildren[0].GetComponent <ModelImageSetup>();
                    if (marquee == null)
                    {
                        marquee = thisChildren[0].AddComponent <ModelImageSetup>();
                    }
                    if (textureList.Count > 0)
                    {
                        tex = textureList[0];
                    }
                    marquee.Setup(tex, modelSharedProperties.renderSettings, modelProperties, (gameObject.CompareTag("gamemodel") || gameObject.CompareTag("propmodel") ? ModelComponentType.Marquee : ModelComponentType.Generic));
                }
                else
                {
                    SetupVideo(thisChildren[0], textureList, url, (gameObject.CompareTag("gamemodel") || gameObject.CompareTag("propmodel") ? ModelComponentType.Marquee : ModelComponentType.Generic), modelSharedProperties);
                }
            }

            // Screen setup
            if (thisChildren.Count > 1)
            {
                List <Texture2D> textureList = new List <Texture2D>();
                string           url         = null;
                // image and image cycling (cycling with id_*.ext)
                textureList = FileManager.LoadImagesFromFolder(ArcadeManager.applicationPath + FileManager.CorrectFilePath(emulatorSelected.screenPath), id);
                if (textureList.Count < 1)
                {
                    textureList = FileManager.LoadImagesFromFolder(ArcadeManager.applicationPath + FileManager.CorrectFilePath(emulatorSelected.screenPath), idParent);
                }
                if (textureList.Count <= 1)
                {
                    var tList = FileManager.LoadImagesFromFolder(ArcadeManager.applicationPath + FileManager.CorrectFilePath(emulatorSelected.titlePath), id);
                    if (tList.Count < 1)
                    {
                        tList = FileManager.LoadImagesFromFolder(ArcadeManager.applicationPath + FileManager.CorrectFilePath(emulatorSelected.titlePath), idParent);
                    }
                    if (tList.Count > 0)
                    {
                        textureList.AddRange(tList);
                    }
                }
                // video
                url = FileManager.GetVideoPathFromFolder(ArcadeManager.applicationPath + FileManager.CorrectFilePath(emulatorSelected.screenPath), id);
                if (url == null)
                {
                    url = FileManager.GetVideoPathFromFolder(ArcadeManager.applicationPath + FileManager.CorrectFilePath(emulatorSelected.screenPath), idParent);
                }
                if (url == null)
                {
                    url = FileManager.GetVideoPathFromFolder(ArcadeManager.applicationPath + FileManager.CorrectFilePath(emulatorSelected.screenVideoPath), id);
                }
                if (url == null)
                {
                    url = FileManager.GetVideoPathFromFolder(ArcadeManager.applicationPath + FileManager.CorrectFilePath(emulatorSelected.screenVideoPath), idParent);
                }
                SetupVideo(thisChildren[1], textureList, url, ModelComponentType.Screen, modelSharedProperties);
            }

            // Generic Texture setup
            if (thisChildren.Count > 2)
            {
                List <Texture2D> textureList = new List <Texture2D>();
                string           url         = null;
                // image and image cycling (cycling with id_*.ext)
                textureList = FileManager.LoadImagesFromFolder(ArcadeManager.applicationPath + FileManager.CorrectFilePath(emulatorSelected.genericPath), id);
                if (textureList.Count < 1)
                {
                    textureList = FileManager.LoadImagesFromFolder(ArcadeManager.applicationPath + FileManager.CorrectFilePath(emulatorSelected.genericPath), idParent);
                }
                // video
                url = FileManager.GetVideoPathFromFolder(ArcadeManager.applicationPath + FileManager.CorrectFilePath(emulatorSelected.genericPath), id);
                if (url == null)
                {
                    url = FileManager.GetVideoPathFromFolder(ArcadeManager.applicationPath + FileManager.CorrectFilePath(emulatorSelected.genericPath), idParent);
                }
                // if we only have one or zero images we dont have to setup videoplayer/image cycling
                if (url == null && textureList.Count == 1)
                {
                    var generic = thisChildren[2].GetComponent <ModelImageSetup>();
                    if (generic == null)
                    {
                        generic = thisChildren[2].AddComponent <ModelImageSetup>();
                    }
                    var tex = textureList[0];
                    generic.Setup(tex, modelSharedProperties.renderSettings, modelProperties, ModelComponentType.Generic);
                }
                else if (url != null || textureList.Count > 1)
                {
                    SetupVideo(thisChildren[2], textureList, url, ModelComponentType.Generic, modelSharedProperties);
                }
            }
        }
コード例 #5
0
 private static List<ModelProperties> GetGamelistFromGamePath(string filePath, EmulatorProperties emulatorProperties, UnityEngine.UI.Slider slider = null)
 {
     string emulatorExtension = emulatorProperties.extension;
     string emulatorID = emulatorProperties.id;
    
     if (!emulatorExtension.Contains(".") && emulatorExtension != "") { emulatorExtension = "." + emulatorExtension; }
     if (emulatorExtension == "") { emulatorExtension = "*.*"; }
     var files = FileManager.FilesFromDirectory(filePath, emulatorExtension);
     if (files != null)
     {
         List<ModelProperties> gamelist = new List<ModelProperties>();
         foreach (FileInfo file in files)
         {
             string fileName = Path.GetFileNameWithoutExtension(file.FullName);
             ModelProperties model = new ModelProperties();
             model.descriptiveName = fileName;
             model.id = fileName;
             model.idParent = "";
             model.emulator = emulatorID.Replace(" ", String.Empty).ToLower();
             //model.animationType = "Never";
             model.animatedTextureSpeed = 2.0f;
             gamelist.Add(model);
         }
         if (gamelist.Count > 0)
         {
             return gamelist;
         }
     }
     return null;
 }
コード例 #6
0
        private static List<ModelProperties> GetGamelistFrom3DArcadeATF(string filePath, string fileName, EmulatorProperties emulatorProperties, UnityEngine.UI.Slider slider = null)
        {
            string emulatorExtension = emulatorProperties.extension;
            string emulatorID = emulatorProperties.id;
            string emulatorGamePath = ArcadeManager.applicationPath + emulatorProperties.gamePath;

            var text = FileManager.LoadTextFromFile(filePath, fileName);
            if (text == null) { return null; }
            var lines = text.Split(Environment.NewLine.ToCharArray());
            //   | Description | Name | Year | Manufacturer | Clone | Romof | Category | VersionAdded | Available | Emulator | Type | Model | Favorites | Video | Orientation | Resolution | Aspect | Frequency | Depth | Stereo | Controltype | Buttons | Players | Coins | Driver | DriverStatus | SoundStatus | ColorStatus | HtmlLinks | TimesPlayed | DurationPlayed | Rating |||||
            List<ModelProperties> gamelist = new List<ModelProperties>();
            foreach (string line in lines)
            {
                var items = line.Split("|".ToCharArray());
                if (items.Count() < 35) { continue; }
                ModelProperties model = new ModelProperties();
                model.descriptiveName = items[1];
                model.id = items[2];
                model.idParent = items[5] != "none" && items[5] != "" ? items[5] : "";
                model.emulator = emulatorID.Replace(" ", String.Empty).ToLower();
                model.model = items[12] != "none" && items[12] != "" ? items[12] : "";
                //model.animationType = "Never";
                model.animatedTextureSpeed = 2.0f;
                model.screen = (items[14] != "none" && items[14] != "" ? items[14] + " " : "") + items[15] != "none" && items[15] != "" ? items[15] : "";
                model.manufacturer = items[4] != "none" && items[4] != "" ? items[4] : "";
                model.year = items[3] != "none" && items[3] != "" ? items[3] : "";
                model.genre = items[7] != "none" && items[7] != "" ? items[7].Replace("*Mature*", "") : "";
                model.available = items[9].ToLower() != "no" ? true : false;
                int number;
                model.playCount = int.TryParse(items[30], out number) ? number : 0;
                model.mature = items[7].ToLower().Contains("mature") ? true : false;
                model.available = IsGameAvailable(emulatorGamePath, model.id, emulatorExtension);
                gamelist.Add(model);
            }
            if (gamelist.Count > 0)
            {
                return gamelist;
            }
            return null;
        }
コード例 #7
0
        private static List<ModelProperties> GetGamelistFromHyperspinXML(string filePath, string fileName, EmulatorProperties emulatorProperties, UnityEngine.UI.Slider slider = null)
        {
            string emulatorExtension = emulatorProperties.extension;
            string emulatorID = emulatorProperties.id;
            string emulatorGamePath = ArcadeManager.applicationPath + emulatorProperties.gamePath;

            var gamesCollection = HyperspinXML.Menu.Load(Path.Combine(filePath, fileName));
            //Debug.Log("invaders is " + gamesCollection.Game.Where(x => x.Name.ToLower() == "invaders").ToList<HyperspinXML.Game>()[0].Genre);
            List<ModelProperties> gamelist = new List<ModelProperties>();
            foreach (HyperspinXML.Game game in gamesCollection.Game)
            {
                ModelProperties model = new ModelProperties();
                model.descriptiveName = game.Description;
                model.id = game.Name;
                model.idParent = game.Cloneof;
                model.emulator = emulatorID.Replace(" ", String.Empty).ToLower();
                //model.animationType = "Never";
                model.animatedTextureSpeed = 2.0f;
                model.manufacturer = game.Manufacturer;
                model.year = game.Year;
                model.genre = game.Genre;
                model.available = IsGameAvailable(emulatorGamePath, model.id, emulatorExtension);
                // model.mature = game.Rating;
                gamelist.Add(model);
            }
            if (gamelist.Count > 0)
            {
                return gamelist;
            }
            return null;
        }
コード例 #8
0
        private static List<ModelProperties> GetGamelistFromMameXML(string filePath, string fileName, EmulatorProperties emulatorProperties, UnityEngine.UI.Slider slider = null)
        {
            if (filePath == null)
            {
                filePath = ArcadeManager.applicationPath + "/3darcade~/Configuration/MasterGamelists/mame/";
            }
            if (fileName == null)
            {
                fileName = "mame.xml";
            }

            string emulatorExtension = emulatorProperties.extension;
            string emulatorID = emulatorProperties.id;
            string emulatorGamePath = ArcadeManager.applicationPath + emulatorProperties.gamePath;
            var gamesCollection = Mame2003XML.Mame.Load(Path.Combine(filePath, fileName));
            INIFile ini = new INIFile(Path.Combine(ArcadeManager.applicationPath + "/3darcade~/Configuration/MasterGamelists/mame/", emulatorID + ".ini"));
            //Debug.Log("mame " + gamesCollection.Game.Count);
            // Debug.Log("invaders is " + gamesCollection.Game.Where(x => x.Name.ToLower() == "invaders").ToList<mame2003XML.Game>()[0].Genre);
            List<ModelProperties> gamelist = new List<ModelProperties>();
            foreach (Mame2003XML.Game game in gamesCollection.Game)
            {
                ModelProperties model = new ModelProperties();
                model.descriptiveName = game.Description;
                model.id = game.Name;
                model.idParent = game.Cloneof;
                model.emulator = emulatorID.Replace(" ", String.Empty).ToLower();
                //model.animationType = "Never";
                model.animatedTextureSpeed = 2.0f;
                model.screen = (game.Video != null ? game.Video.Screen + " " : "") + (game.Video != null ? game.Video.Orientation : "");
                model.manufacturer = game.Manufacturer;
                model.year = game.Year;
                model.genre = ini.GetValue("Category", model.id, "").Replace("* Mature *", "");
                model.mature = ini.GetValue("Category", model.id, "").Contains("Mature") ? true : false;
                model.runnable = game.Driver != null ? game.Driver.Status == "good" : false;
                model.available = IsGameAvailable(emulatorGamePath, model.id, emulatorExtension);
                gamelist.Add(model);
            }
            if (gamelist.Count > 0)
            {
                return gamelist;
            }
            return null;
        }