Export textures (nsbmd), moved DSPADPCM to libefe

This commit is contained in:
Gericom 2014-12-29 13:18:21 +01:00
parent 6a21540a4a
commit e089c0dd5f
7 changed files with 100 additions and 7 deletions

View File

@ -84,7 +84,6 @@
<Compile Include="NintendoWare\SND\CSAR.cs" />
<Compile Include="NintendoWare\SND\CSTM.cs" />
<Compile Include="NintendoWare\LYT1\DARC.cs" />
<Compile Include="DSP\ADPCM.cs" />
<Compile Include="DVLB.cs" />
<Compile Include="Extensions.cs" />
<Compile Include="GPU\Textures.cs" />

View File

@ -5,7 +5,6 @@ using System.Text;
using LibEveryFileExplorer.Files;
using System.Drawing;
using System.IO;
using _3DS.DSP;
using LibEveryFileExplorer.SND;
using CommonFiles;
using LibEveryFileExplorer.IO;
@ -685,7 +684,7 @@ namespace _3DS.NintendoWare.SND
if (Channel >= Info.StreamInfo.NrChannels) return null;
if (Info.StreamInfo.Format == 2)
{
ADPCM worker = new ADPCM(Info.CodecInfos[Channel].Table);
DSPADPCM worker = new DSPADPCM(Info.CodecInfos[Channel].Table);
List<short> Data = new List<short>();
for (int i = 0; i < this.Data.Data.Length; i += (int)Info.StreamInfo.BlockSize * Info.StreamInfo.NrChannels)
{

View File

@ -89,6 +89,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resource.resx</DependentUpon>
</Compile>
<Compile Include="SND\DSPADPCM.cs" />
<Compile Include="SND\SNDUtil.cs" />
<Compile Include="StaticDynamic.cs" />
<Compile Include="UI\FileBrowser.cs">

View File

@ -4,14 +4,14 @@ using System.Linq;
using System.Text;
using LibEveryFileExplorer.Math;
namespace _3DS.DSP
namespace LibEveryFileExplorer.SND
{
public class ADPCM
public class DSPADPCM
{
Int16[] Table;
double Last1 = 0;
double Last2 = 0;
public ADPCM(Int16[] CoefTable)
public DSPADPCM(Int16[] CoefTable)
{
Table = CoefTable;
}

View File

@ -35,6 +35,10 @@
this.listBox2 = new System.Windows.Forms.ListBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton2 = new System.Windows.Forms.ToolStripButton();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@ -44,6 +48,7 @@
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.toolStrip1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
@ -116,12 +121,45 @@
//
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripButton2,
this.toolStripButton1});
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(350, 25);
this.toolStrip1.TabIndex = 1;
this.toolStrip1.Text = "toolStrip1";
//
// toolStripButton1
//
this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton1.Enabled = false;
this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image")));
this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton1.Name = "toolStripButton1";
this.toolStripButton1.Size = new System.Drawing.Size(23, 22);
this.toolStripButton1.Text = "Export Texture";
this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click);
//
// toolStripButton2
//
this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton2.Enabled = false;
this.toolStripButton2.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton2.Image")));
this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton2.Name = "toolStripButton2";
this.toolStripButton2.Size = new System.Drawing.Size(23, 22);
this.toolStripButton2.Text = "Import Texture";
//
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// saveFileDialog1
//
this.saveFileDialog1.DefaultExt = "png";
this.saveFileDialog1.Filter = "PNG Images (*.png)|*.png";
//
// TEX0Viewer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -140,6 +178,8 @@
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.ResumeLayout(false);
}
@ -152,5 +192,9 @@
private System.Windows.Forms.ListBox listBox2;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton toolStripButton2;
private System.Windows.Forms.ToolStripButton toolStripButton1;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
}
}

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Windows.Forms;
using NDS.NitroSystem.G3D;
using System.Drawing.Imaging;
namespace NDS.UI
{
@ -50,9 +51,23 @@ namespace NDS.UI
try
{
b = tex.ToBitmap(Textures.dictPltt[listBox2.SelectedIndex].Value);
toolStripButton1.Enabled = true;//export
}
catch
{
toolStripButton1.Enabled = false;//export
}
catch { }
finally { pictureBox1.Image = b; }
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
saveFileDialog1.FileName = Textures.dictTex[listBox1.SelectedIndex].Key + ".png";
if (saveFileDialog1.ShowDialog() == DialogResult.OK
&& saveFileDialog1.FileName.Length > 0)
{
pictureBox1.Image.Save(saveFileDialog1.FileName, ImageFormat.Png);
}
}
}
}

View File

@ -128,4 +128,39 @@
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="toolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAINSURBVDhPYxh4EFZb6xtSV5dODgbpZQiorc34TyYA6WUI
KCvL/Pvv3/9za4RJwiA9IL0MniUl2b/+/v1/ZZMkFiz1/+pmqf/XtkrDMYgPEgfpAellcMvNzf3+58//
ZW2G/w8v0v5/d7cSHN/bo/z/wX7V/0+Oa/1/dlYPTIP4IHGQHpBeBqfMzPzPv379j7S0/B9rZ/d/SYvJ
/yeHNMG4KFHsv6+z4P/th1L/7zqdB6bXrQv8v3qF7/+AoKD/IvLyOxhsUlML3//8+d9aUvK/l4bG/0hz
0/9Ti43+r+s1/u9gJvi/paXl/z9ggIH8DMMgPkicS0DgEoNlfHzxm+/f/+f7coJxUQDP/7oYif8NcVL/
NeU5/9fU1PwHufDd169wDOKDxDn5+a8ymERGlr749u3/oQUCGNhcj/V/eXn5/zPXrv1/CVQDwyA+SBxo
wA0GvdDQimdfvvzvymDDwKqyzP/DwsL+Gxsbo2ATE5P/4eHh/zl4eO4wyDk51b0EhsHjz58xsIWNzf/g
4OD/x44d/3/o0GEwBrEtLCz+R0RE/Gfh4nrAwKmiksGrq9uGDTOzsT0JDAz8v3373v9KSkrAGNgCZtva
2v6Pior6z8TCcg+UHdiAWAyIpdAxIyPjOiC+snbtbrDTV67c9h/EdnJy+h8bG/sfKHcBqA4v4AbirczM
zF3IGCj2GIIZVgIAnv30daMwYj8AAAAASUVORK5CYII=
</value>
</data>
<data name="toolStripButton2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHFSURBVDhPzZBfKOthHMa/t26mbOqsmHKjxcXq7FAuWLkS
F/6cG8s57YoT0lIzdjEhfxpaHc5KJ7JThrFdkC0Zyp9FkuICpSUUWfw4HdqMPed95+fUuTM3PPWp9316
P8/FS+8nn83m6tcg6kQlJtO3aDSKFwOAO6JOVGww1Nw/PMDh9WJ8dhLeMQ0W7NJ/+Owy+EakmOfYP+CR
DXBH1IkK9fra23AYQ243IqFLOF2tWJxUY82ZCv+UAn53GvwuBVbYfXkiHRE2wB3KKCoyPfPD4QDnPiRA
OJuHx6XFxowKuytqHB2VYX+nAJuzSqxPZyLMBgrq6upJodG0sPN/uREEnB4u4Xi3DXurpQgEtDi5qImx
s6TGlkeFO/Yuv6pKT9Ls7PZnOmw2cG6EK+xtL6LdpEW3/hM8U5U4DQ7g4PA7fvaUYu5XDv6wgVydrkH8
ASJ1RYUhEAzCbLUidHcJS181Ri0SOHolcPYnwueWYXo4CePWxFj/mw1wR9SJssrLjQfn52i2WNDc1YrG
L7IYxq/J6GyQY3QwDSP9iljXpJPjmg1wR9SJUvLyWgRWxgN3RJ0oQansihemSZ7sp8gZH+Mgi/HmIfoL
mcCdW7XvzrgAAAAASUVORK5CYII=
</value>
</data>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>122, 17</value>
</metadata>
<metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>262, 17</value>
</metadata>
</root>