public static AllSprites FromPspIso(Stream iso, bool expand) { PatcherLib.Iso.PspIso.PspIsoInfo info = PatcherLib.Iso.PspIso.PspIsoInfo.GetPspIsoInfo(iso); return(new AllSprites(Context.US_PSP, AllSpriteAttributes.FromPspIso(iso, info), SpriteFileLocations.FromPspIso(iso, info), new Sprite[] { new WepSprite(Context.US_PSP, WepSprite.Wep.WEP1, "WEP1", new PatcherLib.Iso.PspIso.KnownPosition(PatcherLib.Iso.FFTPack.Files.BATTLE_WEP_SPR, 0, 256 * 256 / 2 + 0x200)), new WepSprite(Context.US_PSP, WepSprite.Wep.WEP2, "WEP2", new PatcherLib.Iso.PspIso.KnownPosition(PatcherLib.Iso.FFTPack.Files.BATTLE_WEP_SPR, 0, 256 * 256 / 2 + 0x200)), new WepSprite(Context.US_PSP, WepSprite.Wep.EFF1, "EFF1", new PatcherLib.Iso.PspIso.KnownPosition(PatcherLib.Iso.FFTPack.Files.BATTLE_WEP_SPR, 256 * 256 / 2 + 0x200, 256 * 256 / 2 + 0x200)), new WepSprite(Context.US_PSP, WepSprite.Wep.EFF2, "EFF2", new PatcherLib.Iso.PspIso.KnownPosition(PatcherLib.Iso.FFTPack.Files.BATTLE_WEP_SPR, 256 * 256 / 2 + 0x200, 256 * 256 / 2 + 0x200)), new WepSprite(Context.US_PSP, WepSprite.Wep.EFF2, "TRAP1", new PatcherLib.Iso.PspIso.KnownPosition(PatcherLib.Iso.FFTPack.Files.BATTLE_WEP_SPR, (256 * 256 / 2 + 0x200) * 2, 144 * 256 / 2 + 0x200)), } )); }
public static AllSpriteAttributes FromPsxIso(Stream iso) { byte[] bytes = PatcherLib.Iso.PsxIso.ReadFile(iso, psxPos); AllSpriteAttributes result = new AllSpriteAttributes(); IList<SpriteAttributes> sprites = new SpriteAttributes[numPsxSprites]; for (int i = 0; i < numPsxSprites; i++) { sprites[i] = SpriteAttributes.BuildPsx( new PatcherLib.Iso.PsxIso.KnownPosition(psxPos.Sector, psxPos.StartLocation + i * 4, 4), bytes.Sub(i * 4, (i + 1) * 4 - 1)); } result.sprites = sprites; result.Count = numPsxSprites; return result; }
public static AllSpriteAttributes FromPsxIso(Stream iso) { byte[] bytes = PatcherLib.Iso.PsxIso.ReadFile(iso, psxPos); AllSpriteAttributes result = new AllSpriteAttributes(); IList <SpriteAttributes> sprites = new SpriteAttributes[numPsxSprites]; for (int i = 0; i < numPsxSprites; i++) { sprites[i] = SpriteAttributes.BuildPsx( new PatcherLib.Iso.PsxIso.KnownPosition(psxPos.Sector, psxPos.StartLocation + i * 4, 4), bytes.Sub(i * 4, (i + 1) * 4 - 1)); } result.sprites = sprites; result.Count = numPsxSprites; return(result); }
public static AllSprites FromPsxIso(Stream iso, bool expand) { if (expand && !DetectExpansionOfPsxIso(iso)) { ExpandPsxIso(iso); } return(new AllSprites(Context.US_PSX, AllSpriteAttributes.FromPsxIso(iso), SpriteFileLocations.FromPsxIso(iso), new Sprite[] { new WepSprite(Context.US_PSX, WepSprite.Wep.WEP1, "WEP1", new PatcherLib.Iso.PsxIso.KnownPosition(PatcherLib.Iso.PsxIso.Sectors.BATTLE_WEP_SPR, 0, 256 * 256 / 2 + 0x200)), new WepSprite(Context.US_PSX, WepSprite.Wep.WEP2, "WEP2", new PatcherLib.Iso.PsxIso.KnownPosition(PatcherLib.Iso.PsxIso.Sectors.BATTLE_WEP_SPR, 0, 256 * 256 / 2 + 0x200)), new WepSprite(Context.US_PSX, WepSprite.Wep.EFF1, "EFF1", new PatcherLib.Iso.PsxIso.KnownPosition(PatcherLib.Iso.PsxIso.Sectors.BATTLE_WEP_SPR, 256 * 256 / 2 + 0x200, 256 * 256 / 2 + 0x200)), new WepSprite(Context.US_PSX, WepSprite.Wep.EFF2, "EFF2", new PatcherLib.Iso.PsxIso.KnownPosition(PatcherLib.Iso.PsxIso.Sectors.BATTLE_WEP_SPR, 256 * 256 / 2 + 0x200, 256 * 256 / 2 + 0x200)), new WepSprite(Context.US_PSX, WepSprite.Wep.EFF1, "TRAP1", new PatcherLib.Iso.PsxIso.KnownPosition(PatcherLib.Iso.PsxIso.Sectors.BATTLE_WEP_SPR, (256 * 256 / 2 + 0x200) * 2, 144 * 256 / 2 + 0x200)), } )); }
private AllSprites(Context context, AllSpriteAttributes attrs, SpriteFileLocations locs, IList <Sprite> otherSprites) { Count = attrs.Count + otherSprites.Count; sprites = new Sprite[Count]; IList <string> spriteNames = context == Context.US_PSP ? PSPResources.Lists.SpriteFiles : PSXResources.Lists.SpriteFiles; for (int i = 0; i < attrs.Count; i++) { sprites[i] = new CharacterSprite( context, string.Format("{0:X2} - {1}", i + 1, spriteNames[i]), attrs[i], locs[i]); } otherSprites.CopyTo(sprites, attrs.Count); this.attrs = attrs; this.locs = locs; Dictionary <Sprite, IList <int> > sharedSPRs = new Dictionary <Sprite, IList <int> >(); for (int i = 0; i < sprites.Count; i++) { sharedSPRs.Add(sprites[i], new List <int>()); } for (int i = 0; i < attrs.Count; i++) { for (int j = i + 1; j < attrs.Count; j++) { if (locs[i].Sector == locs[j].Sector) { sharedSPRs[sprites[i]].Add(j); sharedSPRs[sprites[j]].Add(i); } } } for (int i = 0; i < sprites.Count; i++) { sharedSPRs[sprites[i]].Sort(); sharedSPRs[sprites[i]] = sharedSPRs[sprites[i]].AsReadOnly(); } SharedSPRs = new ReadOnlyDictionary <Sprite, IList <int> >(sharedSPRs); }
private AllSprites( Context context, AllSpriteAttributes attrs, SpriteFileLocations locs, IList<Sprite> otherSprites ) { Count = attrs.Count + otherSprites.Count; sprites = new Sprite[Count]; IList<string> spriteNames = context == Context.US_PSP ? PSPResources.Lists.SpriteFiles : PSXResources.Lists.SpriteFiles; for (int i = 0; i < attrs.Count; i++) { sprites[i] = new CharacterSprite( context, string.Format( "{0:X2} - {1}", i+1, spriteNames[i] ), attrs[i], locs[i] ); } otherSprites.CopyTo( sprites, attrs.Count ); this.attrs = attrs; this.locs = locs; Dictionary<Sprite, IList<int>> sharedSPRs = new Dictionary<Sprite, IList<int>>(); for (int i = 0; i < sprites.Count; i++) { sharedSPRs.Add( sprites[i], new List<int>() ); } for (int i = 0; i < attrs.Count; i++) { for (int j = i + 1; j < attrs.Count; j++) { if (locs[i].Sector == locs[j].Sector) { sharedSPRs[sprites[i]].Add( j ); sharedSPRs[sprites[j]].Add( i ); } } } for (int i = 0; i < sprites.Count; i++) { sharedSPRs[sprites[i]].Sort(); sharedSPRs[sprites[i]] = sharedSPRs[sprites[i]].AsReadOnly(); } SharedSPRs = new ReadOnlyDictionary<Sprite, IList<int>>( sharedSPRs ); }
public static AllSpriteAttributes FromPspIso(Stream iso, PatcherLib.Iso.PspIso.PspIsoInfo info) { IList <byte> bytes = PatcherLib.Iso.PspIso.GetBlock(iso, info, pspPos); //List<byte> realBytes = new List<byte>(bytes.Sub(0, numPsxSprites * 4 - 1)); //realBytes.AddRange(bytes.Sub(numPsxSprites * 4 + (4 * 4))); //bytes = realBytes.AsReadOnly(); AllSpriteAttributes result = new AllSpriteAttributes(); IList <SpriteAttributes> sprites = new SpriteAttributes[numPspSprites]; for (int i = 0; i < numPspSprites; i++) { sprites[i] = SpriteAttributes.BuildPsp( new PatcherLib.Iso.PspIso.KnownPosition(pspPos.Sector.Value, pspPos.StartLocation + i * 4, 4), info, bytes.Sub(i * 4, (i + 1) * 4 - 1)); } result.sprites = sprites; result.Count = numPspSprites; return(result); }
public static AllSpriteAttributes FromPspIso(Stream iso, PatcherLib.Iso.PspIso.PspIsoInfo info) { IList<byte> bytes = PatcherLib.Iso.PspIso.GetBlock(iso, info, pspPos); List<byte> realBytes = new List<byte>(bytes.Sub(0, numPsxSprites * 4 - 1)); realBytes.AddRange(bytes.Sub(numPsxSprites * 4 + (4 * 4))); bytes = realBytes.AsReadOnly(); AllSpriteAttributes result = new AllSpriteAttributes(); IList<SpriteAttributes> sprites = new SpriteAttributes[numPspSprites]; for (int i = 0; i < numPspSprites; i++) { sprites[i] = SpriteAttributes.BuildPsp( new PatcherLib.Iso.PspIso.KnownPosition(pspPos.Sector.Value, pspPos.StartLocation + i * 4, 4), info, bytes.Sub(i * 4, (i + 1) * 4 - 1)); } result.sprites = sprites; result.Count = numPspSprites; return result; }