Resize width/height to fit proper 3ds texture limits

This commit is contained in:
KillzXGaming 2020-02-08 14:48:04 -05:00
parent e3c1525cfe
commit e39eec97cb
3 changed files with 16 additions and 3 deletions

View file

@ -389,6 +389,7 @@ namespace FirstPlugin
else
{
settings.LoadBitMap(FileName);
settings.Format = CTR_3DS.ConvertToPICAFormat(Format);
importer.LoadSettings(new List<CTR_3DSImporterSettings>() { settings, });
if (importer.ShowDialog() == DialogResult.OK)

View file

@ -34,14 +34,27 @@ namespace Toolbox.Library.Forms
public uint TexWidth
{
get { return _width; }
set { _width = Pow2RoundDown(value); }
set {
//3DS Limitations
_width = Pow2RoundDown(value);
if (_width > 1024)
_width = 1024;
if (_width < 8)
_width = 8;
}
}
private uint _height;
public uint TexHeight
{
get { return _height; }
set { _height = Pow2RoundDown(value); }
set {
_height = Pow2RoundDown(value);
if (_height > 1024)
_height = 1024;
if (_height < 8)
_height = 8;
}
}
public TEX_FORMAT GenericFormat

View file

@ -325,7 +325,6 @@ namespace Toolbox.Library
}
else if (PicaFormat == PICASurfaceFormat.A4)
{
//Todo this has issues
byte A1 = (byte)(Input[IOffs + 3] >> 4);
byte A2 = (byte)(Input[IOffs + 7] & 0xF0);
writer.Write((byte)(A1 | A2));