diff --git a/EveryFileExplorer.sln b/EveryFileExplorer.sln
index 9acf359..19887fc 100644
--- a/EveryFileExplorer.sln
+++ b/EveryFileExplorer.sln
@@ -21,6 +21,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MarioKart", "MarioKart\MarioKart.csproj", "{8117CF39-0FD6-453D-AA7F-4B4AD85EBB3A}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LegoPirates", "LegoPirates\LegoPirates.csproj", "{E786AAC6-2D88-40E0-BFB6-45164A6183F9}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -101,6 +103,16 @@ Global
{8117CF39-0FD6-453D-AA7F-4B4AD85EBB3A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{8117CF39-0FD6-453D-AA7F-4B4AD85EBB3A}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{8117CF39-0FD6-453D-AA7F-4B4AD85EBB3A}.Release|x86.ActiveCfg = Release|Any CPU
+ {E786AAC6-2D88-40E0-BFB6-45164A6183F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E786AAC6-2D88-40E0-BFB6-45164A6183F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E786AAC6-2D88-40E0-BFB6-45164A6183F9}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {E786AAC6-2D88-40E0-BFB6-45164A6183F9}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {E786AAC6-2D88-40E0-BFB6-45164A6183F9}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {E786AAC6-2D88-40E0-BFB6-45164A6183F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E786AAC6-2D88-40E0-BFB6-45164A6183F9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E786AAC6-2D88-40E0-BFB6-45164A6183F9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {E786AAC6-2D88-40E0-BFB6-45164A6183F9}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {E786AAC6-2D88-40E0-BFB6-45164A6183F9}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/EveryFileExplorer/EveryFileExplorer.csproj b/EveryFileExplorer/EveryFileExplorer.csproj
index 5e7116a..c732812 100644
--- a/EveryFileExplorer/EveryFileExplorer.csproj
+++ b/EveryFileExplorer/EveryFileExplorer.csproj
@@ -96,6 +96,10 @@
+
+ md "$(TargetDir)\Plugins"
+copy "$(SolutionDir)\Libraries\*" "$(TargetDir)\Plugins"
+
+
\ No newline at end of file
diff --git a/LegoPirates/Properties/AssemblyInfo.cs b/LegoPirates/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..4b59e9f
--- /dev/null
+++ b/LegoPirates/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Lego Pirates of the Carribean Plugin")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Every File Explorer")]
+[assembly: AssemblyCopyright("Copyright © Florian Nouwt 2014")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("58dd297a-249a-47c8-8e66-266a1615799f")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/LegoPirates/UI/FMVViewer.cs b/LegoPirates/UI/FMVViewer.cs
new file mode 100644
index 0000000..fc4631b
--- /dev/null
+++ b/LegoPirates/UI/FMVViewer.cs
@@ -0,0 +1,145 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using System.Runtime.InteropServices;
+
+namespace LegoPirates.UI
+{
+ public partial class FMVViewer : Form
+ {
+ NAudio.Wave.BufferedWaveProvider AudioBuffer;
+ NAudio.Wave.WaveOut Player;
+ FMV Video;
+ public FMVViewer(FMV Video)
+ {
+ this.Video = Video;
+ InitializeComponent();
+ }
+
+ private void FMV_Load(object sender, EventArgs e)
+ {
+ /*double ticks = 10000000.0 / (Video.Header.FrameRate / 256.0);
+ float exp = (float)(ticks - Math.Floor(ticks));
+ if (exp != 0)
+ {
+ int i = 0;
+ float result;
+ do
+ {
+ i++;
+ result = exp * i;
+ }
+ while((float)(result - Math.Floor(result)) != 0);
+ }*/
+ //TODO: Calculate timing based on fps
+ if ((Video.Header.Flags & 4) == 4)
+ {
+ AudioBuffer = new NAudio.Wave.BufferedWaveProvider(new NAudio.Wave.WaveFormat((int)Video.Header.AudioRate, 16, 1));
+ AudioBuffer.DiscardOnBufferOverflow = true;
+ AudioBuffer.BufferLength = 8192 * 16;
+ Player = new NAudio.Wave.WaveOut();
+ Player.DesiredLatency = 150;
+ Player.Init(AudioBuffer);
+ Player.Play();
+ }
+ new System.Threading.Thread(new System.Threading.ThreadStart(delegate
+ {
+ int state = 0;
+ while (!stop)
+ {
+ if (Frames.Count != 0)
+ {
+ pictureBox1.Image = Frames.Dequeue();
+ switch (state)
+ {
+ case 0: System.Threading.Thread.Sleep(TimeSpan.FromTicks(666666)); break;
+ case 1: System.Threading.Thread.Sleep(TimeSpan.FromTicks(666667)); break;
+ case 2: System.Threading.Thread.Sleep(TimeSpan.FromTicks(666667)); break;
+ }
+ state = (state + 1) % 3;
+ }
+ }
+ System.Threading.Thread.CurrentThread.Abort();
+ })).Start();
+ backgroundWorker1.RunWorkerAsync();
+ }
+
+ int aa = 0;
+ int bb = 0;
+ bool first = true;
+
+ Queue Frames = new Queue();
+
+ private void FMV_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ if (!stop)
+ {
+ stop = true;
+ if ((Video.Header.Flags & 4) == 4)
+ {
+ Player.Stop();
+ Player.Dispose();
+ Player = null;
+ AudioBuffer = null;
+ }
+ }
+ Video.Close();
+ }
+ bool stop = false;
+ bool stopped = false;
+ private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
+ {
+ while (!stop)
+ {
+ if (Frames.Count < 8 || AudioBuffer.BufferedBytes < 8192 * 4)
+ {
+ retry:
+ byte[] audio;
+ Bitmap b = Video.GetNextFrame(out audio);
+ if (audio != null)
+ {
+ byte[] Return;
+ if (first) Return = new byte[(int)(audio.Length - 4) * 4];
+ else Return = new byte[audio.Length * 4];
+ unsafe
+ {
+ byte* buf = (byte*)Marshal.UnsafeAddrOfPinnedArrayElement(audio, 0);
+ byte* outbuffer = (byte*)Marshal.UnsafeAddrOfPinnedArrayElement(Return, 0);
+ int length = audio.Length;
+ if (first)
+ {
+ aa = ((short*)buf)[0];
+ bb = ((short*)buf)[1] & 0x7F;
+ ((short*)outbuffer)[0] = (short)aa;
+ first = false;
+ buf += 4;
+ length -= 4;
+ outbuffer += 2;
+ }
+ NDS.SND.ADPCM.ConvertImaAdpcm(buf, length, outbuffer, ref aa, ref bb);
+ }
+ AudioBuffer.AddSamples(Return, 0, Return.Length);
+ goto retry;
+ }
+ if (b == null)
+ {
+ stop = true;
+ if ((Video.Header.Flags & 4) == 4)
+ {
+ Player.Stop();
+ Player.Dispose();
+ Player = null;
+ AudioBuffer = null;
+ }
+ }
+ else Frames.Enqueue(b);
+ }
+ }
+ }
+ }
+}
diff --git a/LegoPirates/UI/FMVViewer.designer.cs b/LegoPirates/UI/FMVViewer.designer.cs
new file mode 100644
index 0000000..0478f13
--- /dev/null
+++ b/LegoPirates/UI/FMVViewer.designer.cs
@@ -0,0 +1,70 @@
+namespace LegoPirates.UI
+{
+ partial class FMVViewer
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.pictureBox1 = new System.Windows.Forms.PictureBox();
+ this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+ this.SuspendLayout();
+ //
+ // pictureBox1
+ //
+ this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pictureBox1.Location = new System.Drawing.Point(0, 0);
+ this.pictureBox1.Name = "pictureBox1";
+ this.pictureBox1.Size = new System.Drawing.Size(422, 326);
+ this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
+ this.pictureBox1.TabIndex = 0;
+ this.pictureBox1.TabStop = false;
+ //
+ // backgroundWorker1
+ //
+ this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork);
+ //
+ // FMV
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(422, 326);
+ this.Controls.Add(this.pictureBox1);
+ this.Name = "FMV";
+ this.Text = "FMV";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FMV_FormClosing);
+ this.Load += new System.EventHandler(this.FMV_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.PictureBox pictureBox1;
+ private System.ComponentModel.BackgroundWorker backgroundWorker1;
+ }
+}
\ No newline at end of file
diff --git a/LegoPirates/UI/FMVViewer.resx b/LegoPirates/UI/FMVViewer.resx
new file mode 100644
index 0000000..ba077aa
--- /dev/null
+++ b/LegoPirates/UI/FMVViewer.resx
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 268, 17
+
+
\ No newline at end of file
diff --git a/LibEveryFileExplorer/Files/FileFormat.cs b/LibEveryFileExplorer/Files/FileFormat.cs
index d50c7df..fa07c62 100644
--- a/LibEveryFileExplorer/Files/FileFormat.cs
+++ b/LibEveryFileExplorer/Files/FileFormat.cs
@@ -30,6 +30,7 @@ namespace LibEveryFileExplorer.Files
protected const String Category_Shaders = "Shaders";
protected const String Category_Strings = "Strings";
protected const String Category_Textures = "Textures";
+ protected const String Category_Videos = "Videos";
public abstract String GetCategory();
public abstract String GetFileDescription();
diff --git a/Libraries/NAudio.dll b/Libraries/NAudio.dll
new file mode 100644
index 0000000..f1f70c7
Binary files /dev/null and b/Libraries/NAudio.dll differ
diff --git a/Libraries/Readme.txt b/Libraries/Readme.txt
deleted file mode 100644
index 2fdf58e..0000000
--- a/Libraries/Readme.txt
+++ /dev/null
@@ -1 +0,0 @@
-Put these 2 dll files in the plugins directory of efe!
\ No newline at end of file
diff --git a/NDS/NDS.csproj b/NDS/NDS.csproj
index 96c5755..6af8cb1 100644
--- a/NDS/NDS.csproj
+++ b/NDS/NDS.csproj
@@ -21,7 +21,7 @@
DEBUG;TRACE
prompt
4
- false
+ true
pdbonly
@@ -70,6 +70,7 @@
True
Resource.resx
+
UserControl
diff --git a/NDS/SND/ADPCM.cs b/NDS/SND/ADPCM.cs
new file mode 100644
index 0000000..fa2899d
--- /dev/null
+++ b/NDS/SND/ADPCM.cs
@@ -0,0 +1,82 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace NDS.SND
+{
+ //Tempoarly from mkdscm
+ //I need to rewrite this all
+ public class ADPCM
+ {
+ private static int[] indexTable =
+ { -1, -1, -1, -1, 2, 4, 6, 8,
+ -1, -1, -1, -1, 2, 4, 6, 8 };
+
+ private static int[] stepsizeTable =
+ { 7, 8, 9, 10, 11, 12, 13, 14,
+ 16, 17, 19, 21, 23, 25, 28,
+ 31, 34, 37, 41, 45, 50, 55,
+ 60, 66, 73, 80, 88, 97, 107,
+ 118, 130, 143, 157, 173, 190, 209,
+ 230, 253, 279, 307, 337, 371, 408,
+ 449, 494, 544, 598, 658, 724, 796,
+ 876, 963, 1060, 1166, 1282, 1411, 1552,
+ 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327, 3660, 4026,
+ 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630,
+ 9493, 10442, 11487, 12635, 13899, 15289, 16818,
+ 18500, 20350, 22385, 24623, 27086, 29794, 32767 };
+
+ public unsafe static void ConvertImaAdpcm(byte* buf, int length, byte* outbuffer)
+ {
+ int a = ((short*)buf)[0];
+ int b = ((short*)buf)[1] & 0x7F;
+ ((short*)outbuffer)[0] = (short)a;
+ ConvertImaAdpcm(buf + 4, length - 4, outbuffer + 2, ref a, ref b);
+ }
+
+ public unsafe static void ConvertImaAdpcm(byte* buf, int length, byte* outbuffer, ref int decompSample, ref int stepIndex)
+ {
+ uint destOff = 0;
+ uint curOffset = 0;
+
+ byte compByte;
+ while (curOffset < length)
+ {
+ compByte = buf[curOffset++];
+ process_nibble(compByte, ref stepIndex, ref decompSample);
+ ((short*)outbuffer)[destOff++] = (short)decompSample;
+ process_nibble((byte)((compByte & 0xF0) >> 4), ref stepIndex, ref decompSample);
+ ((short*)outbuffer)[destOff++] = (short)decompSample;
+ }
+ }
+
+ private static int IMAMax(int samp) { return (samp > 0x7FFF) ? ((short)0x7FFF) : samp; }
+ private static int IMAMin(int samp) { return (samp < -0x7FFF) ? ((short)-0x7FFF) : samp; }
+ private static int IMAIndexMinMax(int index, int min, int max) { return (index > max) ? max : ((index < min) ? min : index); }
+
+ private static void process_nibble(byte data4bit, ref int Index, ref int Pcm16bit)
+ {
+ int Diff = stepsizeTable[Index] / 8;
+ if ((data4bit & 1) != 0) Diff = Diff + stepsizeTable[Index] / 4;
+ if ((data4bit & 2) != 0) Diff = Diff + stepsizeTable[Index] / 2;
+ if ((data4bit & 4) != 0) Diff = Diff + stepsizeTable[Index] / 1;
+
+ if ((data4bit & 8) == 0) Pcm16bit = IMAMax(Pcm16bit + Diff);
+ if ((data4bit & 8) == 8) Pcm16bit = IMAMin(Pcm16bit - Diff);
+ Index = IMAIndexMinMax(Index + indexTable[data4bit & 7], 0, 88);
+ }
+
+ private static void clamp_step_index(ref int stepIndex)
+ {
+ if (stepIndex < 0) stepIndex = 0;
+ if (stepIndex > 88) stepIndex = 88;
+ }
+
+ private static void clamp_sample(ref int decompSample)
+ {
+ if (decompSample < -32768) decompSample = -32768;
+ if (decompSample > 32767) decompSample = 32767;
+ }
+ }
+}