public PartitionedFile( GenericCharMap map, FFTPatcher.TextEditor.FFTTextFactory.FileInfo layout, IList<byte> bytes ) : base( map, layout, false ) { PartitionSize = layout.Size / NumberOfSections; List<IList<string>> sections = new List<IList<string>>( NumberOfSections ); for ( int i = 0; i < NumberOfSections; i++ ) { sections.Add(TextUtilities.ProcessList(bytes.Sub(i * PartitionSize, (i + 1) * PartitionSize - 1), map)); if ( sections[i].Count < SectionLengths[i] ) { string[] newSection = new string[SectionLengths[i]]; sections[i].CopyTo( newSection, 0 ); new string[SectionLengths[i] - sections[i].Count].CopyTo( newSection, sections[i].Count ); sections[i] = newSection; } else if (sections[i].Count > SectionLengths[i]) { sections[i] = sections[i].Sub(0, SectionLengths[i] - 1); } System.Diagnostics.Debug.Assert(sections[i].Count == SectionLengths[i]); } Sections = sections.AsReadOnly(); PopulateDisallowedSections(); }
public PartiallyVisiblePalettedImage4bpp( string name, int width, int height, int numPalettes, Rectangle visiblePortion, FFTPatcher.SpriteEditor.Palette.ColorDepth depth, PatcherLib.Iso.KnownPosition imagePosition, PatcherLib.Iso.KnownPosition palettePosition ) : base(name, visiblePortion.Width, visiblePortion.Height) { VisiblePortion = visiblePortion; FullSize = new Size( width, height ); this.position = imagePosition; this.palettePosition = palettePosition; this.depth = depth; System.Diagnostics.Debug.Assert( palettePosition.Length == 8 * (int)depth * 2 ); if ( position is PatcherLib.Iso.PsxIso.KnownPosition ) { var pos = position as PatcherLib.Iso.PsxIso.KnownPosition; saveFileName = string.Format( "{0}_{1}.png", pos.Sector, pos.StartLocation ); } else if ( position is PatcherLib.Iso.PspIso.KnownPosition ) { var pos = position as PatcherLib.Iso.PspIso.KnownPosition; saveFileName = string.Format( "{0}_{1}.png", pos.SectorEnum, pos.StartLocation ); } }
public ATCHELP( GenericCharMap map, FFTPatcher.TextEditor.FFTTextFactory.FileInfo layout, IList<byte> bytes, string fileComments, IList<string> sectionComments ) : base(map, layout, bytes, fileComments, sectionComments) { }
protected AbstractFile( GenericCharMap charmap, FFTPatcher.TextEditor.FFTTextFactory.FileInfo layout, bool compressible ) { NumberOfSections = layout.SectionLengths.Count; Layout = layout; CharMap = charmap; EntryNames = layout.EntryNames.AsReadOnly(); SectionLengths = layout.SectionLengths.AsReadOnly(); SectionNames = layout.SectionNames.AsReadOnly(); DisplayName = layout.DisplayName; Compressible = compressible; CompressionAllowed = layout.CompressionAllowed.AsReadOnly(); DteAllowed = layout.DteAllowed.AsReadOnly(); }
public CompressibleOneShotFile( GenericCharMap map, FFTPatcher.TextEditor.FFTTextFactory.FileInfo layout, IList<byte> bytes, string fileComments, IList<string> sectionComments ) : base(map, layout, fileComments, sectionComments, true) { List<IList<string>> sections = new List<IList<string>>( NumberOfSections ); System.Diagnostics.Debug.Assert( NumberOfSections == 1 ); for ( int i = 0; i < NumberOfSections; i++ ) { sections.Add( TextUtilities.ProcessList( TextUtilities.Decompress( bytes, bytes, 0 ), layout.AllowedTerminators, map ) ); if ( sections[i].Count < SectionLengths[i] ) { string[] newSection = new string[SectionLengths[i]]; sections[i].CopyTo( newSection, 0 ); new string[SectionLengths[i] - sections[i].Count].CopyTo( newSection, sections[i].Count ); sections[i] = newSection; } } Sections = sections.AsReadOnly(); }
protected AbstractFile( GenericCharMap charmap, FFTPatcher.TextEditor.FFTTextFactory.FileInfo layout, string fileComments, IList<string> sectionComments, bool compressible ) { System.Diagnostics.Debug.Assert( sectionComments.Count == layout.SectionNames.Count ); FileComments = fileComments ?? string.Empty; SectionComments = new string[sectionComments.Count]; sectionComments.CopyTo( SectionComments, 0 ); NumberOfSections = layout.SectionLengths.Count; Layout = layout; CharMap = charmap; SelectedTerminator = layout.AllowedTerminators[0]; EntryNames = layout.EntryNames.AsReadOnly(); SectionLengths = layout.SectionLengths.AsReadOnly(); SectionNames = layout.SectionNames.AsReadOnly(); HiddenEntries = layout.Hidden.AsReadOnly(); DisplayName = layout.DisplayName; Compressible = compressible; CompressionAllowed = layout.CompressionAllowed.AsReadOnly(); DteAllowed = layout.DteAllowed.AsReadOnly(); }
public SectionedFile( GenericCharMap map, FFTPatcher.TextEditor.FFTTextFactory.FileInfo layout, IList<byte> bytes, string fileComments, IList<string> sectionComments, bool compressible ) : base(map, layout, fileComments, sectionComments, compressible) { List<IList<string>> sections = new List<IList<string>>( NumberOfSections ); for ( int i = 0; i < NumberOfSections; i++ ) { uint start = PatcherLib.Utilities.Utilities.BytesToUInt32( bytes.Sub( i * 4, ( i + 1 ) * 4 - 1 ) ); uint stop = PatcherLib.Utilities.Utilities.BytesToUInt32( bytes.Sub( ( i + 1 ) * 4, ( i + 2 ) * 4 - 1 ) ) - 1; if ( i == NumberOfSections - 1 ) { stop = (uint)bytes.Count - 1 - (uint)DataStart; } IList<byte> thisSection = bytes.Sub( (int)( start + DataStart ), (int)( stop + DataStart ) ); if ( compressible ) { thisSection = TextUtilities.Decompress( bytes, thisSection, (int)( start + DataStart ) ); } sections.Add( TextUtilities.ProcessList( thisSection, layout.AllowedTerminators[0], CharMap ) ); } Sections = sections.AsReadOnly(); PopulateDisallowedSections(); }
public PartitionedFile( GenericCharMap map, FFTPatcher.TextEditor.FFTTextFactory.FileInfo layout, IList<byte> bytes, string fileComments, IList<string> sectionComments ) : base(map, layout, fileComments, sectionComments, false) { PartitionSize = layout.Size / NumberOfSections; List<IList<string>> sections = new List<IList<string>>( NumberOfSections ); for ( int i = 0; i < NumberOfSections; i++ ) { sections.Add(TextUtilities.ProcessList(bytes.Sub(i * PartitionSize, (i + 1) * PartitionSize - 1), layout.AllowedTerminators, map)); if ( sections[i].Count < SectionLengths[i] ) { string[] newSection = new string[SectionLengths[i]]; sections[i].CopyTo( newSection, 0 ); new string[SectionLengths[i] - sections[i].Count].CopyTo( newSection, sections[i].Count ); sections[i] = newSection; } else if (sections[i].Count > SectionLengths[i]) { sections[i] = sections[i].Sub(0, SectionLengths[i] - 1); } if (layout.AllowedTerminators.Count > 1) { Dictionary<byte, int> counts = new Dictionary<byte, int>(); layout.AllowedTerminators.ForEach(b => counts[b] = 0); bytes.FindAll(b => layout.AllowedTerminators.Contains(b)).ForEach(b => counts[b]++); List<KeyValuePair<byte, int>> countList = new List<KeyValuePair<byte, int>>(counts); countList.Sort((a, b) => b.Value.CompareTo(a.Value)); this.SelectedTerminator = countList[0].Key; } System.Diagnostics.Debug.Assert(sections[i].Count == SectionLengths[i]); } Sections = sections.AsReadOnly(); PopulateDisallowedSections(); }
public PalettedImage4bpp( string name, int width, int height, int numPalettes, FFTPatcher.SpriteEditor.Palette.ColorDepth depth, PatcherLib.Iso.KnownPosition imagePosition, PatcherLib.Iso.KnownPosition palettePosition ) : base(name, width, height) { this.position = imagePosition; this.palettePosition = palettePosition; this.depth = depth; System.Diagnostics.Debug.Assert( palettePosition.Length == 8 * (int)depth * 2 ); if ( position is PatcherLib.Iso.PsxIso.KnownPosition ) { var pos = position as PatcherLib.Iso.PsxIso.KnownPosition; saveFileName = string.Format( "{0}_{1}_{2}.bmp", pos.Sector, pos.StartLocation, pos.Length ); } else if ( position is PatcherLib.Iso.PspIso.KnownPosition ) { var pos = position as PatcherLib.Iso.PspIso.KnownPosition; saveFileName = string.Format( "{0}_{1}_{2}.bmp", pos.SectorEnum, pos.StartLocation, pos.Length ); } }
public static AbstractFile ConstructFile( FileType type, GenericCharMap charmap, FFTPatcher.TextEditor.FFTTextFactory.FileInfo layout, IList<IList<string>> strings ) { switch ( type ) { case FileType.CompressedFile: return new SectionedFile( charmap, layout, strings, true ); break; case FileType.SectionedFile: return new SectionedFile( charmap, layout, strings, false ); break; case FileType.CompressibleOneShotFile: return new CompressibleOneShotFile( charmap, layout, strings ); break; case FileType.OneShotFile: case FileType.PartitionedFile: return new PartitionedFile( charmap, layout, strings ); break; } return null; }
public static AbstractFile ConstructFile( FileType type, GenericCharMap charmap, FFTPatcher.TextEditor.FFTTextFactory.FileInfo layout, IList<byte> bytes ) { switch (type) { case FileType.CompressedFile: return new SectionedFile( charmap, layout, bytes, string.Empty, new string[layout.SectionNames.Count], true ); case FileType.SectionedFile: return new SectionedFile( charmap, layout, bytes, string.Empty, new string[layout.SectionNames.Count], false ); case FileType.OneShotFile: case FileType.PartitionedFile: return new PartitionedFile( charmap, layout, bytes, string.Empty, new string[layout.SectionNames.Count] ); } return null; }
private void removeDualList_AfterAction( object sender, FFTPatcher.Controls.DualListActionEventArgs e ) { Item i = e.Item as Item; this.StoreInventory[i] = false; OnDataChanged( this, EventArgs.Empty ); }
private void dualList_AfterAction(object sender, FFTPatcher.Controls.DualListActionEventArgs e) { Item i = e.Item as Item; Type t = FFTPatch.Items.Items[i.Offset].GetType(); if (storeInventory[i] && !storeInventory.Default[i]) { // Added to right box toListBoxes[t].SortPub(); } else if (!storeInventory[i] && storeInventory.Default[i]) { // Added to left box fromListBoxes[t].SortPub(); } }
private void addDualList_BeforeAction( object sender, FFTPatcher.Controls.DualListCancelEventArgs e ) { Item i = e.Item as Item; this.StoreInventory[i] = true; OnDataChanged( this, EventArgs.Empty ); }
public SectionedFile( GenericCharMap map, FFTPatcher.TextEditor.FFTTextFactory.FileInfo layout, IList<byte> bytes, string fileComments, IList<string> sectionComments ) : this(map, layout, bytes, fileComments, sectionComments, false) { }
public SectionedFile( GenericCharMap map, FFTPatcher.TextEditor.FFTTextFactory.FileInfo layout, IList<byte> bytes ) : this( map, layout, bytes, false ) { }