Fix texture names on import having improper names in some special cases.

This commit is contained in:
KillzXGaming 2019-05-12 16:53:55 -04:00
parent 459bd5d247
commit c11ebce612
22 changed files with 411 additions and 48 deletions

Binary file not shown.

View file

@ -186,7 +186,7 @@ namespace Bfres.Structs
}
public void ReplaceTexture(string FileName, uint MipMapCount = 0, TEX_FORMAT[] SupportedFormats = null,
bool IsSwizzleReadOnly = false, bool IsTileModeReadOnly = false, bool IsFormatReadOnly = false, TEX_FORMAT DefaultFormat = TEX_FORMAT.UNKNOWN)
bool IsSwizzleReadOnly = false, bool IsTileModeReadOnly = false, bool IsFormatReadOnly = false, TEX_FORMAT DefaultFormat = TEX_FORMAT.UNKNOWN, uint SwizzlePattern = 0)
{
string ext = System.IO.Path.GetExtension(FileName);
ext = ext.ToLower();
@ -205,6 +205,7 @@ namespace Bfres.Structs
GTXImporterSettings setting = SetImporterSettings(FileName, DefaultFormat);
setting.MipSwizzle = Tex2Swizzle;
setting.SwizzlePattern = SwizzlePattern;
GTXTextureImporter importer = new GTXTextureImporter();

View file

@ -258,7 +258,7 @@ namespace FirstPlugin
if (ofd.ShowDialog() == DialogResult.OK)
{
Bfres.Structs.FTEX ftex = new Bfres.Structs.FTEX();
ftex.ReplaceTexture(ofd.FileName, 1, SupportedFormats, true, true, false, Format);
ftex.ReplaceTexture(ofd.FileName, 1, SupportedFormats, true, true, false, Format, (uint)(SheetIndex * 2));
if (ftex.texture != null)
{
TextureTGLP.Format = (ushort)ConvertToGx2(Format);
@ -368,7 +368,7 @@ namespace FirstPlugin
(uint)Height,
(uint)1,
(uint)Gx2Format,
(uint)0,
(uint)Swizzle,
(uint)1,
(uint)MipCount
);
@ -387,7 +387,7 @@ namespace FirstPlugin
}
}
private const uint SwizzleBase = 0x000D0000;
private const uint SwizzleBase = 0x00000000;
private uint swizzle;
private uint Swizzle
@ -400,6 +400,14 @@ namespace FirstPlugin
}
}
private uint SwizzlePattern
{
get
{
return (uint)(SheetIndex * 2);
}
}
public override byte[] GetImageData(int ArrayLevel = 0, int MipLevel = 0)
{
uint bpp = GetBytesPerPixel(Format);

View file

@ -34,7 +34,7 @@ namespace FirstPlugin
public void LoadDDS(string FileName, byte[] FileData = null)
{
TexName = Path.GetFileNameWithoutExtension(FileName);
TexName = STGenericTexture.SetNameFromPath(FileName);
DDS dds = new DDS();
@ -59,7 +59,7 @@ namespace FirstPlugin
{
DecompressedData.Clear();
TexName = Path.GetFileNameWithoutExtension(FileName);
TexName = STGenericTexture.SetNameFromPath(FileName);
Format = CTR_3DS.ConvertToPICAFormat(Runtime.PreferredTexFormat);
@ -71,7 +71,7 @@ namespace FirstPlugin
{
DecompressedData.Clear();
TexName = Path.GetFileNameWithoutExtension(FileName);
TexName = STGenericTexture.SetNameFromPath(FileName);
Format = CTR_3DS.ConvertToPICAFormat(Runtime.PreferredTexFormat);
GenerateMipmaps = true;

View file

@ -57,9 +57,7 @@ namespace FirstPlugin
public void LoadDDS(string FileName, byte[] FileData = null, TextureData tree = null)
{
TexName = Path.GetFileNameWithoutExtension(FileName);
Console.WriteLine(TexName);
TexName = STGenericTexture.SetNameFromPath(FileName);
DDS dds = new DDS();
@ -87,7 +85,7 @@ namespace FirstPlugin
public void LoadASTC(string FileName)
{
DecompressedData.Clear();
TexName = Path.GetFileNameWithoutExtension(FileName);
TexName = STGenericTexture.SetNameFromPath(FileName);
ASTC astc = new ASTC();
astc.Load(new FileStream(FileName, FileMode.Open));
@ -106,7 +104,7 @@ namespace FirstPlugin
{
DecompressedData.Clear();
TexName = Path.GetFileNameWithoutExtension(Name);
TexName = STGenericTexture.SetNameFromPath(Name);
Format = TextureData.GenericToBntxSurfaceFormat(Runtime.PreferredTexFormat);
GenerateMipmaps = true;

View file

@ -37,7 +37,7 @@ namespace FirstPlugin
public void LoadDDS(string FileName, byte[] FileData = null)
{
TexName = Path.GetFileNameWithoutExtension(FileName);
TexName = STGenericTexture.SetNameFromPath(FileName);
DDS dds = new DDS();
@ -62,7 +62,7 @@ namespace FirstPlugin
{
DecompressedData.Clear();
TexName = Path.GetFileNameWithoutExtension(FileName);
TexName = STGenericTexture.SetNameFromPath(FileName);
GenerateMipmaps = true;
LoadImage(new Bitmap(Image));
@ -72,7 +72,7 @@ namespace FirstPlugin
{
DecompressedData.Clear();
TexName = Path.GetFileNameWithoutExtension(FileName);
TexName = STGenericTexture.SetNameFromPath(FileName);
GenerateMipmaps = true;

View file

@ -31,6 +31,7 @@
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ImageEditorBase));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.stPanel2 = new Switch_Toolbox.Library.Forms.STPanel();
this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel();
this.stPanel4 = new Switch_Toolbox.Library.Forms.STPanel();
@ -76,7 +77,6 @@
this.adjustmentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.hueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.brightnessContrastToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.SuspendLayout();
@ -320,7 +320,7 @@
this.imageBGComboBox.Location = new System.Drawing.Point(262, 2);
this.imageBGComboBox.Name = "imageBGComboBox";
this.imageBGComboBox.ReadOnly = true;
this.imageBGComboBox.Size = new System.Drawing.Size(115, 21);
this.imageBGComboBox.Size = new System.Drawing.Size(95, 21);
this.imageBGComboBox.TabIndex = 2;
this.imageBGComboBox.SelectedIndexChanged += new System.EventHandler(this.imageBGComboBox_SelectedIndexChanged);
//

View file

@ -120,9 +120,6 @@
<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>
@ -739,6 +736,9 @@
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

@ -33,22 +33,25 @@
this.textureFileFormatCB = new Switch_Toolbox.Library.Forms.STComboBox();
this.stLabel2 = new Switch_Toolbox.Library.Forms.STLabel();
this.stButton1 = new Switch_Toolbox.Library.Forms.STButton();
this.stButton2 = new Switch_Toolbox.Library.Forms.STButton();
this.contentContainer.SuspendLayout();
this.SuspendLayout();
//
// contentContainer
//
this.contentContainer.Controls.Add(this.stButton2);
this.contentContainer.Controls.Add(this.stButton1);
this.contentContainer.Controls.Add(this.textureFileFormatCB);
this.contentContainer.Controls.Add(this.stLabel2);
this.contentContainer.Controls.Add(this.textureImageFormatCB);
this.contentContainer.Controls.Add(this.stLabel1);
this.contentContainer.Size = new System.Drawing.Size(393, 133);
this.contentContainer.Size = new System.Drawing.Size(393, 123);
this.contentContainer.Controls.SetChildIndex(this.stLabel1, 0);
this.contentContainer.Controls.SetChildIndex(this.textureImageFormatCB, 0);
this.contentContainer.Controls.SetChildIndex(this.stLabel2, 0);
this.contentContainer.Controls.SetChildIndex(this.textureFileFormatCB, 0);
this.contentContainer.Controls.SetChildIndex(this.stButton1, 0);
this.contentContainer.Controls.SetChildIndex(this.stButton2, 0);
//
// stLabel1
//
@ -96,18 +99,29 @@
//
this.stButton1.DialogResult = System.Windows.Forms.DialogResult.OK;
this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.stButton1.Location = new System.Drawing.Point(308, 107);
this.stButton1.Location = new System.Drawing.Point(308, 91);
this.stButton1.Name = "stButton1";
this.stButton1.Size = new System.Drawing.Size(75, 23);
this.stButton1.TabIndex = 15;
this.stButton1.Text = "Ok";
this.stButton1.UseVisualStyleBackColor = false;
//
// stButton2
//
this.stButton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.stButton2.Location = new System.Drawing.Point(147, 91);
this.stButton2.Name = "stButton2";
this.stButton2.Size = new System.Drawing.Size(125, 23);
this.stButton2.TabIndex = 16;
this.stButton2.Text = "Edit Default Program";
this.stButton2.UseVisualStyleBackColor = false;
this.stButton2.Click += new System.EventHandler(this.stButton2_Click);
//
// ImageProgramSettings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(399, 138);
this.ClientSize = new System.Drawing.Size(399, 128);
this.Name = "ImageProgramSettings";
this.Text = "ImageProgramSettings";
this.contentContainer.ResumeLayout(false);
@ -123,5 +137,6 @@
private STComboBox textureFileFormatCB;
private STLabel stLabel2;
private STButton stButton1;
private STButton stButton2;
}
}

View file

@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.IO;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
@ -61,5 +62,22 @@ namespace Switch_Toolbox.Library.Forms
{
return c.Substring((c.IndexOf(a) + a.Length), (c.IndexOf(b) - c.IndexOf(a) - a.Length));
}
private void stButton2_Click(object sender, EventArgs e)
{
string UseExtension = GetSelectedExtension();
string TemporaryName = Path.GetTempFileName();
TemporaryName = Path.ChangeExtension(TemporaryName, UseExtension);
ShowOpenWithDialog(TemporaryName);
}
public static Process ShowOpenWithDialog(string path)
{
var args = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "shell32.dll");
args += ",OpenAs_RunDLL " + path;
return Process.Start("rundll32.exe", args);
}
}
}

View file

@ -0,0 +1,153 @@
namespace Switch_Toolbox.Library.Forms
{
partial class HintHelpDialog
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.BtmMipsLeft = new Switch_Toolbox.Library.Forms.STButton();
this.BtnMipsRight = new Switch_Toolbox.Library.Forms.STButton();
this.stButton1 = new Switch_Toolbox.Library.Forms.STButton();
this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel();
this.stLabel1 = new Switch_Toolbox.Library.Forms.STLabel();
this.stLabel2 = new Switch_Toolbox.Library.Forms.STLabel();
this.treeViewCustom1 = new Switch_Toolbox.Library.TreeViewCustom();
this.contentContainer.SuspendLayout();
this.SuspendLayout();
//
// contentContainer
//
this.contentContainer.Controls.Add(this.treeViewCustom1);
this.contentContainer.Controls.Add(this.stLabel2);
this.contentContainer.Controls.Add(this.stLabel1);
this.contentContainer.Controls.Add(this.stPanel1);
this.contentContainer.Controls.Add(this.stButton1);
this.contentContainer.Controls.Add(this.BtmMipsLeft);
this.contentContainer.Controls.Add(this.BtnMipsRight);
this.contentContainer.Controls.SetChildIndex(this.BtnMipsRight, 0);
this.contentContainer.Controls.SetChildIndex(this.BtmMipsLeft, 0);
this.contentContainer.Controls.SetChildIndex(this.stButton1, 0);
this.contentContainer.Controls.SetChildIndex(this.stPanel1, 0);
this.contentContainer.Controls.SetChildIndex(this.stLabel1, 0);
this.contentContainer.Controls.SetChildIndex(this.stLabel2, 0);
this.contentContainer.Controls.SetChildIndex(this.treeViewCustom1, 0);
//
// BtmMipsLeft
//
this.BtmMipsLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.BtmMipsLeft.Enabled = false;
this.BtmMipsLeft.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.BtmMipsLeft.Location = new System.Drawing.Point(142, 362);
this.BtmMipsLeft.Name = "BtmMipsLeft";
this.BtmMipsLeft.Size = new System.Drawing.Size(28, 22);
this.BtmMipsLeft.TabIndex = 11;
this.BtmMipsLeft.Text = "<";
this.BtmMipsLeft.UseVisualStyleBackColor = true;
//
// BtnMipsRight
//
this.BtnMipsRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.BtnMipsRight.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.BtnMipsRight.Location = new System.Drawing.Point(179, 362);
this.BtnMipsRight.Name = "BtnMipsRight";
this.BtnMipsRight.Size = new System.Drawing.Size(30, 22);
this.BtnMipsRight.TabIndex = 12;
this.BtnMipsRight.Text = ">";
this.BtnMipsRight.UseVisualStyleBackColor = true;
//
// stButton1
//
this.stButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.stButton1.Location = new System.Drawing.Point(459, 361);
this.stButton1.Name = "stButton1";
this.stButton1.Size = new System.Drawing.Size(75, 23);
this.stButton1.TabIndex = 14;
this.stButton1.Text = "Ok";
this.stButton1.UseVisualStyleBackColor = false;
//
// stPanel1
//
this.stPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.stPanel1.Location = new System.Drawing.Point(136, 48);
this.stPanel1.Name = "stPanel1";
this.stPanel1.Size = new System.Drawing.Size(400, 308);
this.stPanel1.TabIndex = 15;
//
// stLabel1
//
this.stLabel1.AutoSize = true;
this.stLabel1.Location = new System.Drawing.Point(3, 28);
this.stLabel1.Name = "stLabel1";
this.stLabel1.Size = new System.Drawing.Size(91, 13);
this.stLabel1.TabIndex = 16;
this.stLabel1.Text = "Table of Contents";
//
// stLabel2
//
this.stLabel2.AutoSize = true;
this.stLabel2.Location = new System.Drawing.Point(139, 28);
this.stLabel2.Name = "stLabel2";
this.stLabel2.Size = new System.Drawing.Size(68, 13);
this.stLabel2.TabIndex = 17;
this.stLabel2.Text = "Help Section";
//
// treeViewCustom1
//
this.treeViewCustom1.ImageIndex = 0;
this.treeViewCustom1.Location = new System.Drawing.Point(3, 48);
this.treeViewCustom1.Name = "treeViewCustom1";
this.treeViewCustom1.SelectedImageIndex = 0;
this.treeViewCustom1.Size = new System.Drawing.Size(127, 342);
this.treeViewCustom1.TabIndex = 18;
//
// HintHelpDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(549, 398);
this.Name = "HintHelpDialog";
this.Text = "Help Dialog";
this.contentContainer.ResumeLayout(false);
this.contentContainer.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private STButton BtmMipsLeft;
private STButton BtnMipsRight;
private STLabel stLabel2;
private STLabel stLabel1;
private STPanel stPanel1;
private STButton stButton1;
private TreeViewCustom treeViewCustom1;
}
}

View file

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Switch_Toolbox.Library.Forms
{
public partial class HintHelpDialog : STForm
{
public HintHelpDialog()
{
InitializeComponent();
FillTableContents();
}
public class HelpSection : TreeNodeCustom { }
public HelpSection[] Sections = new HelpSection[]
{
new HImageEditor(),
};
private void FillTableContents()
{
treeViewCustom1.Nodes.AddRange(Sections);
}
public class HImageEditor : HelpSection
{
public HImageEditor()
{
Text = "Image Editor";
}
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -29,7 +29,9 @@
private void InitializeComponent()
{
this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel();
this.stButton1 = new Switch_Toolbox.Library.Forms.STButton();
this.contentContainer.SuspendLayout();
this.stPanel1.SuspendLayout();
this.SuspendLayout();
//
// contentContainer
@ -39,12 +41,24 @@
//
// stPanel1
//
this.stPanel1.Controls.Add(this.stButton1);
this.stPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.stPanel1.Location = new System.Drawing.Point(0, 25);
this.stPanel1.Name = "stPanel1";
this.stPanel1.Size = new System.Drawing.Size(543, 368);
this.stPanel1.TabIndex = 11;
//
// stButton1
//
this.stButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.stButton1.Location = new System.Drawing.Point(459, 336);
this.stButton1.Name = "stButton1";
this.stButton1.Size = new System.Drawing.Size(75, 23);
this.stButton1.TabIndex = 0;
this.stButton1.Text = "Ok";
this.stButton1.UseVisualStyleBackColor = false;
//
// STConsoleForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -53,6 +67,7 @@
this.Name = "STConsoleForm";
this.Text = "STConsoleForm";
this.contentContainer.ResumeLayout(false);
this.stPanel1.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -60,5 +75,6 @@
#endregion
private STPanel stPanel1;
private STButton stButton1;
}
}

View file

@ -538,7 +538,7 @@ namespace Switch_Toolbox.Library
}
public void LoadDDS(string path)
{
SetNameFromPath(path);
Text = SetNameFromPath(path);
DDS dds = new DDS();
LoadDDS(path);
@ -551,12 +551,12 @@ namespace Switch_Toolbox.Library
}
public void LoadTGA(string path)
{
SetNameFromPath(path);
Text = SetNameFromPath(path);
Bitmap tga = Paloma.TargaImage.LoadTargaImage(path);
}
public void LoadBitmap(string path)
{
SetNameFromPath(path);
Text = SetNameFromPath(path);
}
public void LoadASTC(string path)
@ -729,27 +729,11 @@ namespace Switch_Toolbox.Library
}
private void SetNameFromPath(string path)
public static string SetNameFromPath(string path)
{
//Replace extensions manually. This is because using the
//GetFileNameWithoutExtension function can remove .0, .1, texture names.
var name = Path.GetFileName(path);
name.Replace(".tga", string.Empty);
name.Replace(".png", string.Empty);
name.Replace(".jpg", string.Empty);
name.Replace(".dds", string.Empty);
name.Replace(".jpeg", string.Empty);
name.Replace(".tiff", string.Empty);
name.Replace(".gif", string.Empty);
name.Replace(".dds2", string.Empty);
name.Replace(".jpe", string.Empty);
name.Replace(".jfif", string.Empty);
name.Replace(".bmp", string.Empty);
name.Replace(".pdn", string.Empty);
name.Replace(".psd", string.Empty);
name.Replace(".hdr", string.Empty);
Text = name;
string FileName = Path.GetFileName(path);
string extension = System.IO.Path.GetExtension(FileName);
return FileName.Substring(0, FileName.Length - extension.Length);
}
private static byte[] ConvertBgraToRgba(byte[] bytes)
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

View file

@ -452,6 +452,12 @@
<DependentUpon>UVEditor.cs</DependentUpon>
</Compile>
<Compile Include="Forms\GL\GLControl2D.cs" />
<Compile Include="Forms\HintHelpDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\HintHelpDialog.Designer.cs">
<DependentUpon>HintHelpDialog.cs</DependentUpon>
</Compile>
<Compile Include="Forms\PropertyBinding.cs" />
<Compile Include="Forms\STConsole.cs">
<SubType>Component</SubType>
@ -767,6 +773,9 @@
<EmbeddedResource Include="Forms\GL\GLControl2D.resx">
<DependentUpon>GLControl2D.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\HintHelpDialog.resx">
<DependentUpon>HintHelpDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\STConsoleForm.resx">
<DependentUpon>STConsoleForm.cs</DependentUpon>
</EmbeddedResource>

View file

@ -1234,7 +1234,6 @@ namespace Switch_Toolbox.Library.NEW
if (isThickMacroTiled(tileMode) != 0)
sliceIn >>= 2;
bankPipe ^= 2 * sampleSlice * 3 ^ (swizzle_ + sliceIn * rotation);
bankPipe ^= 2 * sampleSlice * 3 ^ (swizzle_ + sliceIn * rotation);
bankPipe %= 8;