コード例 #1
0
ファイル: GameList.cs プロジェクト: soywiz/cspspemu
        public static GameEntry HandleIso(string IsoFile)
        {
            var IsoFileInfo = new FileInfo(IsoFile);
            Psf ParamSfo;
            var Entry = new GameEntry();
            byte[] Icon0Png;
            string UmdData = string.Empty;

            if (DefaultIcon == null)
            {
                var TempMemoryStream = new MemoryStream();
                Properties.Resources.icon0.Save(TempMemoryStream, ImageFormat.Png);
                DefaultIcon = TempMemoryStream.ToArray();
            }

            using (var IsoStream = File.OpenRead(IsoFile))
            {
                switch (new FormatDetector().DetectSubType(IsoStream))
                {
                    case FormatDetector.SubType.Pbp:
                        var PBP = new Pbp().Load(File.OpenRead(IsoFile));
                        ParamSfo = new Psf(PBP[Pbp.Types.ParamSfo]);

                        Icon0Png = PBP.ContainsKey(Pbp.Types.Icon0Png) ? PBP[Pbp.Types.Icon0Png].ReadAll() : DefaultIcon;
                        UmdData = "---";

                        break;
                    case FormatDetector.SubType.Iso:
                    case FormatDetector.SubType.Cso:
                    case FormatDetector.SubType.Dax:
                        using (var Iso = IsoLoader.GetIso(IsoFile))
                        {
                            var FileSystem = new HleIoDriverIso(Iso);

                            if (!FileSystem.FileExists("/PSP_GAME/PARAM.SFO"))
                            {
                                throw (new Exception(String.Format("Not a PSP ISO '{0}'", IsoFile)));
                            }

                            ParamSfo = new Psf(new MemoryStream(FileSystem.OpenRead("/PSP_GAME/PARAM.SFO").ReadAll()));

                            if (FileSystem.FileExists("/UMD_DATA.BIN")) UmdData = FileSystem.OpenRead("/UMD_DATA.BIN").ReadAllContentsAsString();
                            Icon0Png = FileSystem.FileExists("/PSP_GAME/ICON0.PNG") ? FileSystem.OpenRead("/PSP_GAME/ICON0.PNG").ReadAll() : DefaultIcon;
                            Entry.PatchedWithPrometheus = FileSystem.FileExists("/PSP_GAME/SYSDIR/prometheus.prx") || FileSystem.FileExists("/PSP_GAME/SYSDIR/EBOOT.OLD");
                        }
                        break;
                    default: return null;
                }
            }

            FillGameEntryFromSfo(Entry, ParamSfo);
            Entry.IsoSize = IsoFileInfo.Length;
            Entry.Hash = GetHash(IsoFile);
            Entry.IsoFile = IsoFile;
            Entry.DiscId0 = UmdData.Split('|')[0];
            Entry.Icon0Png = Icon0Png;
            return Entry;
        }
コード例 #2
0
ファイル: GameList.cs プロジェクト: e-COS/cspspemu
        public GameEntry HandleIso(string IsoFile)
        {
            var IsoFileInfo = new FileInfo(IsoFile);

            var Iso = IsoLoader.GetIso(IsoFile);
            var FileSystem = new HleIoDriverIso(Iso);
            var UmdData = FileSystem.OpenRead("/UMD_DATA.BIN").ReadAllContentsAsString();
            var ParamSfo = new Psf(new MemoryStream(FileSystem.OpenRead("/PSP_GAME/PARAM.SFO").ReadAll()));
            var Icon0Png = FileSystem.OpenRead("/PSP_GAME/ICON0.PNG").ReadAll();

            var Entries = ParamSfo.EntryDictionary;

            var Entry = new GameEntry();

            Entry.IsoSize = IsoFileInfo.Length;
            Entry.Hash = GetHash(IsoFile);
            Entry.IsoFile = IsoFile;
            Entry.DiscId0 = UmdData.Split('|')[0];
            try { Entry.APP_VER = (string)Entries["APP_VER"]; } catch { }
            try { Entry.BOOTABLE = ((int)Entries["BOOTABLE"]) != 0; } catch { }
            try { Entry.CATEGORY = (string)Entries["CATEGORY"]; } catch { }
            try { Entry.DISC_ID = (string)Entries["DISC_ID"]; } catch { }
            try { Entry.DISC_NUMBER = (int)Entries["DISC_NUMBER"]; } catch { }
            try { Entry.DISC_TOTAL = (int)Entries["DISC_TOTAL"]; } catch { }
            try { Entry.DISC_VERSION = (string)Entries["DISC_VERSION"]; } catch { }
            try { Entry.DRIVER_PATH = (string)Entries["DRIVER_PATH"]; } catch { }
            try { Entry.GAMEDATA_ID = (string)Entries["GAMEDATA_ID"]; } catch { }
            try { Entry.HRKGMP_VER = (int)Entries["HRKGMP_VER"]; } catch { }
            try { Entry.PARENTAL_LEVEL = (int)Entries["PARENTAL_LEVEL"]; } catch { }
            try { Entry.PSP_SYSTEM_VER = (string)Entries["PSP_SYSTEM_VER"]; } catch { }
            try { Entry.REGION = (int)Entries["REGION"]; } catch { }
            try { Entry.TITLE = (string)Entries["TITLE"]; } catch { }
            try { Entry.USE_USB = ((int)Entries["USE_USB"]) != 0; } catch { }
            try { Entry.Icon0Png = Icon0Png; } catch { }

            /**
            GameId: ULJM-05753
            APP_VER : 01.00
            BOOTABLE : 1
            CATEGORY : UG
            DISC_ID : ULJM05753
            DISC_NUMBER : 1
            DISC_TOTAL : 1
            DISC_VERSION : 1.02
            DRIVER_PATH :
            GAMEDATA_ID : ULJM05753
            HRKGMP_VER : 19
            PARENTAL_LEVEL : 5
            PSP_SYSTEM_VER : 6.31
            REGION : 32768
            TITLE : タクティクスオウガ 運命の輪
            USE_USB : 0
            */

            return Entry;
        }
コード例 #3
0
        public BackupProgramHandler(GameEntry this_game, List<DetectedFile> only_these, string archive_name, ALocationsHandler loc)
            : this(loc)
        {
            back_these_up = new List<GameEntry>();
            back_these_up.Add(this_game);

            if (only_these != null) {
                only_these_files = only_these;
            }
            archive_name_override = archive_name;
        }
コード例 #4
0
ファイル: MonitorPath.cs プロジェクト: raven-ie/MASGAU
        public MonitorPath(GameEntry game, DetectedLocationPathHolder path)
            : base(path.FullDirPath, "*")
        {
            this.Path = path;
            this.Game = game;

            this.IncludeSubdirectories = true;
            this.Created += new FileSystemEventHandler(changed);
            this.Changed += new FileSystemEventHandler(changed);
            this.Deleted += new FileSystemEventHandler(changed);
            this.Renamed += new RenamedEventHandler(changed);
        }
コード例 #5
0
        public ManualArchiveWindow(GameEntry new_game, IWindow owner)
            : base(owner)
        {
            InitializeComponent();
            TranslationHelpers.translateWindow(this);
            game = new_game;

            rootCombo.Items.Clear();

            foreach (DetectedLocationPathHolder file in game.DetectedLocations) {
                //if(file.Value.owner!=null)
                //    rootCombo.Items.Add(file.Value.owner);
                //else
                //    rootCombo.Items.Add("Global");
                rootCombo.Items.Add(file.FullDirPath);
            }
            if (rootCombo.Items.Contains(Environment.UserName))
                rootCombo.SelectedIndex = rootCombo.Items.IndexOf(Environment.UserName);
            else
                rootCombo.SelectedIndex = 0;
        }
コード例 #6
0
ファイル: GamesController.cs プロジェクト: Grigann/PopWeb
        /// <summary>
        /// Saves a new gaming session and creates a new game if necessary
        /// </summary>
        /// <param name="gameEntry">A game entry</param>
        /// <returns>A JSON representation of a timeline entry</returns>
        public JsonResult QuickSave(GameEntry gameEntry)
        {
            // Used to emulate a failure
            if (gameEntry.Developper == "FAIL") {
                throw new Exception("Une erreur");
            }

            GamingSession gamingSession;
            using (var uow = new UnitOfWork(true)) {
                var game = uow.Games.FindByTitle(gameEntry.Title) ??
                           new Game() { Title = gameEntry.Title, Developper = gameEntry.Developper };

                gamingSession = new GamingSession() {
                    Date = DateTime.ParseExact(gameEntry.EntryDate, "dd/MM/yyyy", null),
                    Note = gameEntry.Note };
                game.AddGamingSession(gamingSession);

                uow.Games.SaveOrUpdate(game);
                uow.Commit();
            }

            var timelineEntry = new TimelineEntry(gamingSession, this);
            return Json(timelineEntry);
        }
コード例 #7
0
ファイル: MainWindowBackup.cs プロジェクト: raven-ie/MASGAU
 protected void beginBackup(GameEntry game, List<DetectedFile> files, string archive_name, RunWorkerCompletedEventHandler when_done)
 {
     backup = new BackupProgramHandler(game, files, archive_name, Core.locations);
     startBackup(when_done);
 }
コード例 #8
0
ファイル: Program.cs プロジェクト: gmich/Snake
 static void Main()
 {
     using (var game = new GameEntry())
         game.Run();
 }
コード例 #9
0
ファイル: GameList.cs プロジェクト: shin527/cspspemu
		public static GameEntry HandleIso(string IsoFile)
		{
			var IsoFileInfo = new FileInfo(IsoFile);

			var Iso = IsoLoader.GetIso(IsoFile);
			var FileSystem = new HleIoDriverIso(Iso);
		    string UmdData = string.Empty;
            if (FileSystem.FileExists("/UMD_DATA.BIN"))
                UmdData = FileSystem.OpenRead("/UMD_DATA.BIN").ReadAllContentsAsString();
		    var ParamSfo = new Psf(new MemoryStream(FileSystem.OpenRead("/PSP_GAME/PARAM.SFO").ReadAll()));
		    byte[] Icon0Png ;
            if (FileSystem.FileExists("/PSP_GAME/ICON0.PNG"))
                Icon0Png = FileSystem.OpenRead("/PSP_GAME/ICON0.PNG").ReadAll();
            else
                Icon0Png = (byte[])System.ComponentModel.TypeDescriptor.GetConverter(Properties.Resources.icon0).ConvertTo(Properties.Resources.icon0, typeof(byte[]));
			var Entries = ParamSfo.EntryDictionary;

			var Entry = new GameEntry();

			if (
				FileSystem.FileExists("/PSP_GAME/SYSDIR/prometheus.prx")
				|| FileSystem.FileExists("/PSP_GAME/SYSDIR/EBOOT.OLD")
			)
			{
				Entry.PatchedWithPrometheus = true;
			}
			else
			{
				Entry.PatchedWithPrometheus = false;
			}

			Entry.IsoSize = IsoFileInfo.Length;
			Entry.Hash = GetHash(IsoFile);
			Entry.IsoFile = IsoFile;
			Entry.DiscId0 = UmdData.Split('|')[0];
			try { Entry.APP_VER = (string)Entries["APP_VER"]; } catch { }
			try { Entry.BOOTABLE = ((int)Entries["BOOTABLE"]) != 0; } catch { }
			try { Entry.CATEGORY = (string)Entries["CATEGORY"]; } catch { }
			try { 
                Entry.DISC_ID = (string)Entries["DISC_ID"];
                if (string.IsNullOrWhiteSpace(Entry.DiscId0))
			        Entry.DiscId0 = Entry.DISC_ID.Substring(0, 4) +"-"+ Entry.DISC_ID.Substring(4);
			}
            catch { }
			try { Entry.DISC_NUMBER = (int)Entries["DISC_NUMBER"]; } catch { }
			try { Entry.DISC_TOTAL = (int)Entries["DISC_TOTAL"]; } catch { }
			try { Entry.DISC_VERSION = (string)Entries["DISC_VERSION"]; } catch { }
			try { Entry.DRIVER_PATH = (string)Entries["DRIVER_PATH"]; } catch { }
			try { Entry.GAMEDATA_ID = (string)Entries["GAMEDATA_ID"]; } catch { }
			try { Entry.HRKGMP_VER = (int)Entries["HRKGMP_VER"]; } catch { }
			try { Entry.PARENTAL_LEVEL = (int)Entries["PARENTAL_LEVEL"]; } catch { }
			try { Entry.PSP_SYSTEM_VER = (string)Entries["PSP_SYSTEM_VER"]; } catch { }
			try { Entry.REGION = (int)Entries["REGION"]; } catch { }
			try { Entry.TITLE = (string)Entries["TITLE"]; } catch { }
			try { Entry.USE_USB = ((int)Entries["USE_USB"]) != 0; } catch { }
			try { Entry.Icon0Png = Icon0Png; } catch { }

			/**
			GameId: ULJM-05753
			APP_VER : 01.00
			BOOTABLE : 1
			CATEGORY : UG
			DISC_ID : ULJM05753
			DISC_NUMBER : 1
			DISC_TOTAL : 1
			DISC_VERSION : 1.02
			DRIVER_PATH : 
			GAMEDATA_ID : ULJM05753
			HRKGMP_VER : 19
			PARENTAL_LEVEL : 5
			PSP_SYSTEM_VER : 6.31
			REGION : 32768
			TITLE : タクティクスオウガ 運命の輪
			USE_USB : 0
			*/

			return Entry;
		}
コード例 #10
0
        /// <summary>
        /// 异步获取AB包
        /// </summary>
        /// <param name="path"></param>
        private IProgress GetAssetBundleAsync(string path, System.Action <AssetBundle> callBack)
        {
            path = Path2Key(path);
            path = path.Replace('\\', '/');
            if (!m_ABDic.TryGetValue(path, out AssetBundle ab))
            {
                string abName = path;
                //string abName = string.IsNullOrEmpty(path) ? "" : "/" + path;

                AssetBundleCreateRequest mainRequest = AssetBundle.LoadFromFileAsync(m_ABPath + "/" + abName + m_Variant);
                m_LoadingAB.Add(abName, mainRequest);

                // 添加任务列表
                List <AssetBundleCreateRequest> requests = new List <AssetBundleCreateRequest>
                {
                    mainRequest
                };

                //string[] dependencies = m_Mainfest.GetAllDependencies(path + ".ab");
                string[] dependencies = m_DependenceInfo.GetAllDependencies(path + m_Variant);
                foreach (var name in dependencies)
                {
                    if (m_ABDic.ContainsKey(Name2Key(name)))
                    {
                        continue;
                    }
                    var request = AssetBundle.LoadFromFileAsync(m_ABPath + "/" + name);
                    requests.Add(request);
                    m_LoadingAB.Add(Name2Key(name), request);
                }

                ITask[] tasks = new ITask[requests.Count];

                for (int i = 0; i < tasks.Length; i++)
                {
                    int index = i;
                    tasks[index] = new SingleTask(() =>
                    {
                        return(requests[index].isDone);
                    });
                    tasks[index].Then(new SingleTask(() =>
                    {
                        string key = Name2Key(requests[index].assetBundle.name);
                        m_ABDic.Add(key, requests[index].assetBundle);
                        m_LoadingAB.Remove(key);
                        return(true);
                    }));
                }

                AllTask abTask = new AllTask(tasks);
                abTask.Then(new SingleTask(() =>
                {
                    callBack.Invoke(mainRequest.assetBundle);
                    return(true);
                }));
                GameEntry.GetModule <TaskManager>().StartTask(abTask);

                return(new ResProgress(requests.ToArray()));
            }
            else
            {
                callBack(ab);
                return(new DefaultProgress());
            }
        }
コード例 #11
0
        void AddSingleGame(string filename)
        {
            GameEntry entry = AddGame(filename);

            EditGameInfo.EditInfo(Library.GetEntrySlug(entry));
        }
コード例 #12
0
ファイル: GameEntry.cs プロジェクト: Roy0131/IlrtUnity
 public GameEntry()
 {
     _instance = this;
 }
コード例 #13
0
ファイル: Game.cs プロジェクト: Liuyonggang0731/XFramework
 void Update()
 {
     GameEntry.ModuleUpdate(Time.deltaTime, Time.unscaledDeltaTime);
 }
コード例 #14
0
        static void Main(string[] args)
        {
            string    fileName  = "GameEntryData.xml";
            GameEntry gameEntry = null;

            if (File.Exists(fileName))
            {
                using (XmlReader xmlReader = XmlReader.Create(fileName))
                {
                    try
                    {
                        gameEntry = IntermediateSerializer.Deserialize <GameEntry>(xmlReader, null);
                    }
                    catch { }
                }
            }

            if (gameEntry == null)
            {
                gameEntry                 = new GameEntry();
                gameEntry.FirstLevel      = "Level001";
                gameEntry.DefaultFontName = "Comic_Sans_MS";

                var level002 = new EditorLevel();
                level002.TextureName  = "Level002";
                level002.BackdropName = "Level002_Back";
                level002.GravityWind  = new Vector2(0f, .5f);
                gameEntry.Levels.Add("Level002", level002);

                var level001 = new EditorLevel();
                level001.TextureName  = "Level001";
                level001.BackdropName = "Level001_Back";
                level001.GravityWind  = new Vector2(0f, .5f);
                gameEntry.Levels.Add("Level001", level001);

                var tinyDude = new Character();
                tinyDude.TextureName = "TinyDude";
                tinyDude.jumpSpeed   = 20;
                tinyDude.runFactor   = 5;
                gameEntry.AvailableCharacters.Add("TinyDude", tinyDude);

                var badDude = new Enemy();
                badDude.TextureName = "BadDude";
                badDude.jumpSpeed   = 20;
                badDude.runFactor   = 5;
                gameEntry.AvailableEnemies.Add("BadDude", badDude);
            }

            gameEntry.Levels = gameEntry.Levels
                               .ToDictionary(
                k => k.Key,
                v => EditorLevel.Upgrade(v.Value) as Level
                );

            using (Game1 game = new Game1(gameEntry))
            {
                game.Run();
            }

            gameEntry.Levels = gameEntry.Levels.ToDictionary(
                k => k.Key,
                v => v.Value.GetClone());

            using (XmlWriter xmlWriter = XmlWriter.Create("GameEntryData.xml", new XmlWriterSettings()
            {
                Indent = true
            }))
            {
                IntermediateSerializer.Serialize(xmlWriter, gameEntry, null);
            }
        }
コード例 #15
0
ファイル: CsvGamesList.cs プロジェクト: cosmo0/arcade-manager
 /// <summary>
 /// Initializes a new instance of the <see cref="GameEntry"/> class.
 /// </summary>
 /// <param name="list">The reference list.</param>
 /// <param name="copyFrom">The entry to copy from.</param>
 public GameEntry(CsvGamesList list, GameEntry copyFrom)
 {
     this.listRef = list;
     this.Name    = copyFrom.Name;
     this.Values  = copyFrom.Values;
 }
コード例 #16
0
ファイル: GameList.cs プロジェクト: soywiz/cspspemu
 private static void FillGameEntryFromSfo(GameEntry Entry, Psf ParamSfo)
 {
     var Entries = ParamSfo.EntryDictionary;
     Entry.APP_VER = (string)Entries.GetOrDefault("APP_VER", "01.00");
     Entry.BOOTABLE = (int)Entries.GetOrDefault("BOOTABLE", 1) != 0;
     Entry.CATEGORY = (string)Entries.GetOrDefault("CATEGORY", "UG");
     Entry.DISC_ID = (string)Entries.GetOrDefault("DISC_ID", "XXXX99999");
     if (string.IsNullOrWhiteSpace(Entry.DiscId0)) Entry.DiscId0 = Entry.DISC_ID.Substring(0, 4) + "-" + Entry.DISC_ID.Substring(4);
     Entry.DISC_NUMBER = (int)Entries.GetOrDefault("DISC_NUMBER", 1);
     Entry.DISC_TOTAL = (int)Entries.GetOrDefault("DISC_TOTAL", 1);
     Entry.DISC_VERSION = (string)Entries.GetOrDefault("DISC_VERSION", "1.00");
     Entry.DRIVER_PATH = (string)Entries.GetOrDefault("DRIVER_PATH", "");
     Entry.GAMEDATA_ID = (string)Entries.GetOrDefault("GAMEDATA_ID", "XXXX99999");
     Entry.HRKGMP_VER = (int)Entries.GetOrDefault("HRKGMP_VER", 19);
     Entry.PARENTAL_LEVEL = (int)Entries.GetOrDefault("PARENTAL_LEVEL", 5);
     Entry.PSP_SYSTEM_VER = (string)Entries.GetOrDefault("PSP_SYSTEM_VER", "1.00");
     Entry.REGION = (int)Entries.GetOrDefault("REGION", 32768);
     Entry.TITLE = (string)Entries.GetOrDefault("TITLE", "Unknown Title");
     Entry.USE_USB = ((int)Entries.GetOrDefault("USE_USB", 0)) != 0;
 }