Example #1
0
        protected override AbstractSprite GetAbstractSpriteFromPsxIso(System.IO.Stream iso, bool ignoreCache)
        {
            if (CachedSprite == null || ignoreCache)
            {
                IList<byte> bytes = Position.ReadIso(iso);
                switch (SHP)
                {
                    case SpriteType.TYPE1:
                        CachedSprite = new TYPE1Sprite(bytes);
                        break;
                    case SpriteType.TYPE2:
                        CachedSprite = new TYPE2Sprite(bytes);
                        break;
                    case SpriteType.RUKA:
                        CachedSprite = new MonsterSprite(bytes);
                        break;
                    case SpriteType.MON:
                        byte[][] sp2Bytes = new byte[location.SubSpriteLocations.Count][];
                        if (location.SubSpriteLocations.Count > 0)
                        {
                            for (int i = 0; i < location.SubSpriteLocations.Count; i++)
                            {
                                sp2Bytes[i] = PatcherLib.Iso.PsxIso.ReadFile(
                                    iso,
                                    (PatcherLib.Iso.PsxIso.Sectors)location.SubSpriteLocations[i].Sector,
                                    0,
                                    (int)location.SubSpriteLocations[i].Size);
                            }
                        }
                        CachedSprite = new MonsterSprite(bytes, sp2Bytes);
                        break;
                    case SpriteType.KANZEN:
                        CachedSprite = new KANZEN(bytes);
                        break;
                    case SpriteType.CYOKO:
                        CachedSprite = new CYOKO(bytes);
                        break;
                    case SpriteType.ARUTE:
                        CachedSprite = new ARUTE(bytes);
                        break;
                    case SpriteType.WEP1:
                    case SpriteType.WEP2:
                        CachedSprite = new WEPSprite(bytes);
                        break;
                    case SpriteType.EFF1:
                        CachedSprite = new WEP3Sprite(bytes);
                        break;
                    default:
                        CachedSprite = null;
                        break;
                }
            }

            return CachedSprite;
        }
Example #2
0
        protected override AbstractSprite GetAbstractSpriteFromPspIso(System.IO.Stream iso, PatcherLib.Iso.PspIso.PspIsoInfo info, bool ignoreCache)
        {
            if (CachedSprite == null || ignoreCache)
            {
                IList<byte> bytes = Position.ReadIso(iso);

                System.Diagnostics.Debug.Assert(bytes.Count == this.Size);
                switch (SHP)
                {
                    case SpriteType.TYPE1:
                        CachedSprite = new TYPE1Sprite(bytes);
                        break;
                    case SpriteType.TYPE2:
                        CachedSprite = new TYPE2Sprite(bytes);
                        break;
                    case SpriteType.RUKA:
                        CachedSprite = new MonsterSprite(bytes);
                        break;
                    case SpriteType.MON:
                        byte[][] sp2Bytes = new byte[location.SubSpriteLocations.Count][];
                        if (location.SubSpriteLocations.Count > 0)
                        {
                            for (int i = 0; i < location.SubSpriteLocations.Count; i++)
                            {
                                sp2Bytes[i] = PatcherLib.Iso.PspIso.GetFile(
                                    iso,
                                    info,
                                    (PatcherLib.Iso.FFTPack.Files)location.SubSpriteLocations[i].Sector,
                                    0,
                                    (int)location.SubSpriteLocations[i].Size).ToArray();
                            }
                        }
                        CachedSprite = new MonsterSprite(bytes, sp2Bytes);
                        break;
                    case SpriteType.KANZEN:
                        CachedSprite = new KANZEN(bytes);
                        break;
                    case SpriteType.CYOKO:
                        CachedSprite = new CYOKO(bytes);
                        break;
                    case SpriteType.ARUTE:
                        CachedSprite = new ARUTE(bytes);
                        break;
                    case SpriteType.WEP1:
                    case SpriteType.WEP2:
                        CachedSprite = new WEPSprite(bytes);
                        break;
                    //case SpriteType.WEP3:
                    //    cachedSprite = new WEP3Sprite(bytes);
                    //    break;
                    default:
                        CachedSprite = null;
                        break;
                }
            }

            return CachedSprite;
        }