Skip to content

Commit

Permalink
Fix image patch to calc image size from TSA header
Browse files Browse the repository at this point in the history
  • Loading branch information
laqieer committed Oct 2, 2024
1 parent 6564708 commit d3f8587
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions FEBuilderGBA/ImageFormRef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ public ImageFormRef(Form self, string prefix, int width, int height, int palette
HEADERTSA.Increment = 4;
HEADERTSA.Maximum = 0xffffffff;
HEADERTSA.Value = Program.ROM.u32(U.toOffset(tsa_pointer));
Size size = ImageUtil.CalcSizeForHeaderTSAData(Program.ROM.Data, (int)U.toOffset(HEADERTSA.Value));
if (size.Width > 0 && size.Height > 0)
{
Width = size.Width * 8;
Height = size.Height * 8;
}
continue;
}
if (name.IndexOf("_ZHEADERTSA") >= 0 && info is NumericUpDown)
Expand All @@ -167,6 +173,13 @@ public ImageFormRef(Form self, string prefix, int width, int height, int palette
ZHEADERTSA.Increment = 4;
ZHEADERTSA.Maximum = 0xffffffff;
ZHEADERTSA.Value = Program.ROM.u32(U.toOffset(tsa_pointer));
byte[] tsa = LZ77.decompress(Program.ROM.Data, U.toOffset(ZHEADERTSA.Value));
Size size = ImageUtil.CalcSizeForHeaderTSAData(tsa, 0);
if (size.Width > 0 && size.Height > 0)
{
Width = size.Width * 8;
Height = size.Height * 8;
}
continue;
}
if (name.IndexOf("Picture") >= 0 && info is PictureBox)
Expand Down

0 comments on commit d3f8587

Please sign in to comment.