1
0
mirror of synced 2024-11-12 02:00:50 +01:00

Load mip maps for bcres properly

This commit is contained in:
KillzXGaming 2019-05-09 15:41:41 -04:00
parent c98dc3380f
commit 2eab9c2532
10 changed files with 40 additions and 22 deletions

Binary file not shown.

View File

@ -96,6 +96,24 @@ namespace FirstPlugin
{
PlatformSwizzle = PlatformSwizzle.Platform_3DS;
uint Offset = 0;
uint MipWidth = Width, MipHeight = Height;
for (int mipLevel = 0; mipLevel < MipCount; mipLevel++)
{
uint Increment = Texture.Images[ArrayLevel].BitsPerPixel / 8;
if (Increment == 0) Increment = 1;
uint size = (MipWidth * MipHeight) * Increment;
if (mipLevel == MipLevel)
return Utils.SubArray(Texture.Images[ArrayLevel].ImageData, Offset, size);
Offset += size;
MipWidth /= 2;
MipHeight /= 2;
}
return Texture.Images[ArrayLevel].ImageData;
}
}

View File

@ -1 +1 @@
506f479f7255b9cb28c7dfb7da911e9790903cbc
7019283c1c03cb65fbd4a085da2cf5126b8f90da

View File

@ -105,8 +105,8 @@
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.splitContainer1.Size = new System.Drawing.Size(715, 502);
this.splitContainer1.SplitterDistance = 520;
this.splitContainer1.Size = new System.Drawing.Size(535, 502);
this.splitContainer1.SplitterDistance = 389;
this.splitContainer1.TabIndex = 5;
//
// stPanel2
@ -115,7 +115,7 @@
this.stPanel2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.stPanel2.Location = new System.Drawing.Point(0, 501);
this.stPanel2.Name = "stPanel2";
this.stPanel2.Size = new System.Drawing.Size(520, 1);
this.stPanel2.Size = new System.Drawing.Size(389, 1);
this.stPanel2.TabIndex = 1;
//
// stPanel1
@ -127,7 +127,7 @@
this.stPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.stPanel1.Location = new System.Drawing.Point(0, 0);
this.stPanel1.Name = "stPanel1";
this.stPanel1.Size = new System.Drawing.Size(520, 502);
this.stPanel1.Size = new System.Drawing.Size(389, 502);
this.stPanel1.TabIndex = 2;
//
// stPanel4
@ -139,7 +139,7 @@
this.stPanel4.Controls.Add(this.pictureBoxCustom1);
this.stPanel4.Location = new System.Drawing.Point(3, 74);
this.stPanel4.Name = "stPanel4";
this.stPanel4.Size = new System.Drawing.Size(514, 425);
this.stPanel4.Size = new System.Drawing.Size(383, 425);
this.stPanel4.TabIndex = 8;
//
// stPanel5
@ -148,7 +148,7 @@
this.stPanel5.Dock = System.Windows.Forms.DockStyle.Bottom;
this.stPanel5.Location = new System.Drawing.Point(0, 405);
this.stPanel5.Name = "stPanel5";
this.stPanel5.Size = new System.Drawing.Size(514, 20);
this.stPanel5.Size = new System.Drawing.Size(383, 20);
this.stPanel5.TabIndex = 1;
//
// bottomLabel
@ -167,7 +167,7 @@
this.pictureBoxCustom1.ContextMenuStrip = this.stContextMenuStrip2;
this.pictureBoxCustom1.Location = new System.Drawing.Point(0, 0);
this.pictureBoxCustom1.Name = "pictureBoxCustom1";
this.pictureBoxCustom1.Size = new System.Drawing.Size(514, 406);
this.pictureBoxCustom1.Size = new System.Drawing.Size(383, 406);
this.pictureBoxCustom1.TabIndex = 0;
this.pictureBoxCustom1.ZoomChanged += new System.EventHandler(this.pictureBoxCustom1_ZoomChanged);
//
@ -334,7 +334,7 @@
this.adjustmentsToolStripMenuItem});
this.stContextMenuStrip1.Location = new System.Drawing.Point(0, 0);
this.stContextMenuStrip1.Name = "stContextMenuStrip1";
this.stContextMenuStrip1.Size = new System.Drawing.Size(520, 24);
this.stContextMenuStrip1.Size = new System.Drawing.Size(389, 24);
this.stContextMenuStrip1.TabIndex = 0;
this.stContextMenuStrip1.Text = "stContextMenuStrip1";
//
@ -545,7 +545,7 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "ImageEditorBase";
this.Size = new System.Drawing.Size(715, 502);
this.Size = new System.Drawing.Size(535, 502);
this.splitContainer1.Panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);

View File

@ -120,6 +120,9 @@
<metadata name="stContextMenuStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>184, 17</value>
</metadata>
<metadata name="stContextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="alphaBtn.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
@ -736,9 +739,6 @@
cL+T0fIXUvho1xJo195FiqmQ0PIqcY9VOy9ppv/4j/8PQJ1wavHnTdQAAAAASUVORK5CYII=
</value>
</data>
<metadata name="stContextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>108</value>
</metadata>

View File

@ -212,7 +212,6 @@ namespace Switch_Toolbox.Library
{ TEX_FORMAT.R16_SNORM, new FormatInfo(2, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.R16_UINT, new FormatInfo(2, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.R16_UNORM, new FormatInfo(2, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.A8_UNORM, new FormatInfo(1, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.R8_SINT, new FormatInfo(1, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.R8_SNORM, new FormatInfo(1, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.R4G4_UNORM, new FormatInfo(1, 1, 1, 1, TargetBuffer.Color) },
@ -261,14 +260,15 @@ namespace Switch_Toolbox.Library
{ TEX_FORMAT.ASTC_10x5_SRGB, new FormatInfo(16, 10, 5, 1, TargetBuffer.Color) },
{ TEX_FORMAT.ASTC_10x6_UNORM, new FormatInfo(16, 10, 6, 1, TargetBuffer.Color) },
{ TEX_FORMAT.ASTC_10x6_SRGB, new FormatInfo(16, 10, 6, 1, TargetBuffer.Color) },
{ TEX_FORMAT.ETC1, new FormatInfo(1, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.ETC1_A4, new FormatInfo(1, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.HIL08, new FormatInfo(8, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.L4, new FormatInfo(1, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.LA4, new FormatInfo(1, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.L8, new FormatInfo(2, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.LA8, new FormatInfo(1, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.A4, new FormatInfo(1, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.ETC1, new FormatInfo(4, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.ETC1_A4, new FormatInfo(8, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.HIL08, new FormatInfo(16, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.L4, new FormatInfo(4, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.LA4, new FormatInfo(4, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.L8, new FormatInfo(8, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.LA8, new FormatInfo(16, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.A4, new FormatInfo(4, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.A8_UNORM, new FormatInfo(8, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.D16_UNORM, new FormatInfo(2, 1, 1, 1, TargetBuffer.Depth) },
{ TEX_FORMAT.D24_UNORM_S8_UINT, new FormatInfo(4, 1, 1, 1, TargetBuffer.Depth) },