1
0
mirror of synced 2024-12-02 19:17:24 +01:00

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 else
{ {
settings.LoadBitMap(FileName); settings.LoadBitMap(FileName);
settings.Format = CTR_3DS.ConvertToPICAFormat(Format);
importer.LoadSettings(new List<CTR_3DSImporterSettings>() { settings, }); importer.LoadSettings(new List<CTR_3DSImporterSettings>() { settings, });
if (importer.ShowDialog() == DialogResult.OK) if (importer.ShowDialog() == DialogResult.OK)

View File

@ -34,14 +34,27 @@ namespace Toolbox.Library.Forms
public uint TexWidth public uint TexWidth
{ {
get { return _width; } 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; private uint _height;
public uint TexHeight public uint TexHeight
{ {
get { return _height; } 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 public TEX_FORMAT GenericFormat

View File

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