diff --git a/VGAudio.exe b/Dependencies/VGAudio.exe
similarity index 100%
rename from VGAudio.exe
rename to Dependencies/VGAudio.exe
diff --git a/PersonaVCE.Designer.cs b/PersonaVCE.Designer.cs
index 536269d..a5df4d6 100644
--- a/PersonaVCE.Designer.cs
+++ b/PersonaVCE.Designer.cs
@@ -280,7 +280,7 @@ private void InitializeComponent()
this.metroSetTabControl_Main.Controls.Add(this.tabPage_Encoding);
this.metroSetTabControl_Main.Controls.Add(this.tabPage_Renaming);
this.metroSetTabControl_Main.Controls.Add(this.tabPage_Archives);
- this.metroSetTabControl_Main.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.metroSetTabControl_Main.Cursor = System.Windows.Forms.Cursors.Default;
this.metroSetTabControl_Main.Dock = System.Windows.Forms.DockStyle.Fill;
this.metroSetTabControl_Main.IsDerivedStyle = true;
this.metroSetTabControl_Main.ItemSize = new System.Drawing.Size(100, 38);
@@ -1254,7 +1254,7 @@ private void InitializeComponent()
this.ShowLeftRect = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
this.Style = MetroSet_UI.Enums.Style.Dark;
- this.Text = "PersonaVCE v2.3";
+ this.Text = "PersonaVCE v2.3.1";
this.TextColor = System.Drawing.Color.White;
this.ThemeName = "MetroDark";
this.menuStrip1.ResumeLayout(false);
diff --git a/PersonaVCE.cs b/PersonaVCE.cs
index c4a2c4b..b9af0b8 100644
--- a/PersonaVCE.cs
+++ b/PersonaVCE.cs
@@ -11,6 +11,7 @@
using System.Windows.Forms;
using static System.Windows.Forms.Design.AxImporter;
using System.Diagnostics.Eventing.Reader;
+using NAudio.Wave;
namespace PersonaVCE
{
@@ -119,11 +120,21 @@ private void Encode(string[] inputFiles, string outFormat = "")
// If loops are specified, use loops
if (chk_UseLoopPoints.Checked)
{
- args += $" -l {Convert.ToInt32(num_LoopStart.Value)}-{Convert.ToInt32(num_LoopEnd.Value)}";
+ if (chk_LoopAll.Checked)
+ args += $" -l 0-{GetSampleCount(file) - 1}";
+ else
+ args += $" -l {Convert.ToInt32(num_LoopStart.Value)}-{Convert.ToInt32(num_LoopEnd.Value)}";
}
Output.VerboseLog($"[INFO] Encoding \"{Path.GetFileName(file)}\" to \"{Path.GetFileName(outPath)}\"...");
- Exe.Run(".\\VGAudio.exe", args);
+ string vgAudioPath = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "Dependencies\\VGAudio.exe");
+ if (!File.Exists(vgAudioPath))
+ {
+ Output.VerboseLog($"[INFO] Failed to encode, could not find executable: \"{vgAudioPath}\"", ConsoleColor.DarkRed);
+ return;
+ }
+ Exe.Run(vgAudioPath, args);
+ using (FileSys.WaitForFile(outPath)) { };
if (File.Exists(outPath))
{
if (outFormat == ".adx" && args.Contains("--keycode"))
@@ -155,6 +166,33 @@ private void Encode(string[] inputFiles, string outFormat = "")
Output.Log($"[INFO] Done encoding files to \"{comboBox_SoundFormat.SelectedItem}\".", ConsoleColor.Green);
}
+ private long GetSampleCount(string file)
+ {
+ long sampleCount = -1;
+
+ if (File.Exists(file))
+ {
+ if (Path.GetExtension(file).ToLower() == ".adx")
+ using (FileStream fs = new FileStream(file, FileMode.Open))
+ {
+ using (EndianBinaryReader reader = new EndianBinaryReader(fs, Endianness.LittleEndian))
+ {
+ reader.BaseStream.Position = 12;
+ sampleCount = reader.ReadInt32();
+ }
+ }
+ else if (Path.GetExtension(file).ToLower() == ".wav")
+ {
+ using (var waveFile = new WaveFileReader(file))
+ {
+ sampleCount = waveFile.SampleCount;
+ }
+ }
+ }
+
+ return sampleCount;
+ }
+
private void AddTxtLinesToDGV()
{
if (!File.Exists(settings.InputTxtPath))
@@ -353,7 +391,7 @@ private void ExtractAFS(string afsPath)
string outputDir = FileSys.CreateUniqueDir(afsPath + "_extracted");
Directory.CreateDirectory(outputDir);
- new Thread(() =>
+ //new Thread(() =>
{
Thread.CurrentThread.IsBackground = true;
@@ -377,7 +415,8 @@ private void ExtractAFS(string afsPath)
}
}
SystemSounds.Exclamation.Play();
- }).Start();
+ }
+ //).Start();
Output.Log($"[INFO] Done extracting archive contents to: \"{outputDir}\"", ConsoleColor.Green);
}
else
@@ -390,7 +429,7 @@ private void RepackAFS(string afsDir)
if (Directory.Exists(afsDir))
{
- new Thread(() =>
+ //new Thread(() =>
{
Thread.CurrentThread.IsBackground = true;
// Get input files from AFS directory
@@ -409,7 +448,8 @@ private void RepackAFS(string afsDir)
}
SystemSounds.Exclamation.Play();
- }).Start();
+ }
+ //).Start();
Output.Log($"[INFO] Done creating AFS archive at: \"{outputFile}\"", ConsoleColor.Green);
}
else
@@ -420,7 +460,7 @@ private void ExtractACB(string acbPath)
{
if (File.Exists(acbPath))
{
- new Thread(() =>
+ //new Thread(() =>
{
Thread.CurrentThread.IsBackground = true;
@@ -429,7 +469,8 @@ private void ExtractACB(string acbPath)
Output.Log($"[INFO] Done extracting archive contents from: \"{acbPath}\"", ConsoleColor.Green);
SystemSounds.Exclamation.Play();
- }).Start();
+ }
+ //).Start();
}
else
Output.Log($"[ERROR] ACB extract failed, input archive doesn't exist: \"{acbPath}\"", ConsoleColor.Red);
@@ -454,7 +495,7 @@ private void RepackACB(string acbDir)
if (Directory.Exists(acbDir))
{
- new Thread(() =>
+ //new Thread(() =>
{
Thread.CurrentThread.IsBackground = true;
@@ -463,7 +504,8 @@ private void RepackACB(string acbDir)
AcbEditor.Program.Main(new string[] { acbDir });
Output.Log($"[INFO] Done repacking ACB archive: \"{acbFile}\"", ConsoleColor.Green);
SystemSounds.Exclamation.Play();
- }).Start();
+ }
+ //).Start();
}
else
Output.Log($"[ERROR] ACB repack failed, extracted archive directory doesn't exist: \"{acbDir}\"", ConsoleColor.Red);
diff --git a/PersonaVCE.csproj b/PersonaVCE.csproj
index 975fb73..3caaf4b 100644
--- a/PersonaVCE.csproj
+++ b/PersonaVCE.csproj
@@ -39,12 +39,42 @@
packages\MetroSet_UI.2.0.0\lib\net45\MetroSet UI.dll
+
+ packages\Microsoft.Win32.Registry.4.7.0\lib\net461\Microsoft.Win32.Registry.dll
+
+
+ packages\NAudio.2.2.1\lib\net472\NAudio.dll
+
+
+ packages\NAudio.Asio.2.2.1\lib\netstandard2.0\NAudio.Asio.dll
+
+
+ packages\NAudio.Core.2.2.1\lib\netstandard2.0\NAudio.Core.dll
+
+
+ packages\NAudio.Midi.2.2.1\lib\netstandard2.0\NAudio.Midi.dll
+
+
+ packages\NAudio.Wasapi.2.2.1\lib\netstandard2.0\NAudio.Wasapi.dll
+
+
+ packages\NAudio.WinForms.2.2.1\lib\net472\NAudio.WinForms.dll
+
+
+ packages\NAudio.WinMM.2.2.1\lib\netstandard2.0\NAudio.WinMM.dll
+
packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll
+
+ packages\System.Security.AccessControl.4.7.0\lib\net461\System.Security.AccessControl.dll
+
+
+ packages\System.Security.Principal.Windows.4.7.0\lib\net461\System.Security.Principal.Windows.dll
+
@@ -81,6 +111,7 @@
PersonaVCE.cs
+ Designer
ResXFileCodeGenerator
@@ -131,7 +162,7 @@
PreserveNewest
-
+
PreserveNewest
diff --git a/packages.config b/packages.config
index aea1ce7..5f1a4c7 100644
--- a/packages.config
+++ b/packages.config
@@ -1,5 +1,15 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file