mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
(ODN): recognize audio entries.
This commit is contained in:
12
ArcFormats/Properties/Settings.Designer.cs
generated
12
ArcFormats/Properties/Settings.Designer.cs
generated
@@ -753,5 +753,17 @@ namespace GameRes.Formats.Properties {
|
|||||||
this["PFSEncodingCP"] = value;
|
this["PFSEncodingCP"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("44100")]
|
||||||
|
public uint ODNAudioSampleRate {
|
||||||
|
get {
|
||||||
|
return ((uint)(this["ODNAudioSampleRate"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["ODNAudioSampleRate"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,5 +185,8 @@
|
|||||||
<Setting Name="PFSEncodingCP" Type="System.Int32" Scope="User">
|
<Setting Name="PFSEncodingCP" Type="System.Int32" Scope="User">
|
||||||
<Value Profile="(Default)">65001</Value>
|
<Value Profile="(Default)">65001</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="ODNAudioSampleRate" Type="System.UInt32" Scope="User">
|
||||||
|
<Value Profile="(Default)">44100</Value>
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
||||||
9
ArcFormats/Strings/arcStrings.Designer.cs
generated
9
ArcFormats/Strings/arcStrings.Designer.cs
generated
@@ -606,6 +606,15 @@ namespace GameRes.Formats.Strings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Default audio sampling rate.
|
||||||
|
/// </summary>
|
||||||
|
public static string ODNAudioSampleRate {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ODNAudioSampleRate", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Fix Ogg files checksums.
|
/// Looks up a localized string similar to Fix Ogg files checksums.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -501,4 +501,7 @@ Choose encryption scheme or enter a passphrase.</comment>
|
|||||||
<data name="PFSEncodingCP" xml:space="preserve">
|
<data name="PFSEncodingCP" xml:space="preserve">
|
||||||
<value>Default file names encoding</value>
|
<value>Default file names encoding</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ODNAudioSampleRate" xml:space="preserve">
|
||||||
|
<value>Default audio sampling rate</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -403,4 +403,8 @@
|
|||||||
<value>Default file names encoding</value>
|
<value>Default file names encoding</value>
|
||||||
<comment>translation pending</comment>
|
<comment>translation pending</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ODNAudioSampleRate" xml:space="preserve">
|
||||||
|
<value>Default audio sampling rate</value>
|
||||||
|
<comment>translation pending</comment>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -401,4 +401,7 @@ Choose encryption scheme or enter a passphrase.</value>
|
|||||||
<data name="PFSEncodingCP" xml:space="preserve">
|
<data name="PFSEncodingCP" xml:space="preserve">
|
||||||
<value>Default file names encoding</value>
|
<value>Default file names encoding</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ODNAudioSampleRate" xml:space="preserve">
|
||||||
|
<value>Default audio sampling rate</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -276,6 +276,9 @@
|
|||||||
<value>Ключи шифрования
|
<value>Ключи шифрования
|
||||||
(требуются даже если содержимое не шифруется)</value>
|
(требуются даже если содержимое не шифруется)</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ODNAudioSampleRate" xml:space="preserve">
|
||||||
|
<value>Частота дискретизации аудио</value>
|
||||||
|
</data>
|
||||||
<data name="OGGFixCrc" xml:space="preserve">
|
<data name="OGGFixCrc" xml:space="preserve">
|
||||||
<value>Исправлять контрольные суммы в Ogg аудио файлах</value>
|
<value>Исправлять контрольные суммы в Ogg аудио файлах</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -404,4 +404,8 @@
|
|||||||
<value>Default file names encoding</value>
|
<value>Default file names encoding</value>
|
||||||
<comment>translation pending</comment>
|
<comment>translation pending</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ODNAudioSampleRate" xml:space="preserve">
|
||||||
|
<value>Default audio sampling rate</value>
|
||||||
|
<comment>translation pending</comment>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -32,6 +32,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using GameRes.Formats.Strings;
|
||||||
using GameRes.Utility;
|
using GameRes.Utility;
|
||||||
|
|
||||||
namespace GameRes.Formats.Valkyria
|
namespace GameRes.Formats.Valkyria
|
||||||
@@ -55,7 +56,7 @@ namespace GameRes.Formats.Valkyria
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Export(typeof(ArchiveFormat))]
|
[Export(typeof(ArchiveFormat))]
|
||||||
public class OdnOpener : ArchiveFormat
|
sealed public class OdnOpener : ArchiveFormat
|
||||||
{
|
{
|
||||||
public override string Tag { get { return "ODN"; } }
|
public override string Tag { get { return "ODN"; } }
|
||||||
public override string Description { get { return "Valkyria resource archive"; } }
|
public override string Description { get { return "Valkyria resource archive"; } }
|
||||||
@@ -63,6 +64,17 @@ namespace GameRes.Formats.Valkyria
|
|||||||
public override bool IsHierarchic { get { return false; } }
|
public override bool IsHierarchic { get { return false; } }
|
||||||
public override bool CanWrite { get { return false; } }
|
public override bool CanWrite { get { return false; } }
|
||||||
|
|
||||||
|
public OdnOpener ()
|
||||||
|
{
|
||||||
|
Settings = new[] { AudioSampleRate };
|
||||||
|
}
|
||||||
|
|
||||||
|
FixedSetSetting AudioSampleRate = new FixedSetSetting (Properties.Settings.Default) {
|
||||||
|
Name = "ODNAudioSampleRate",
|
||||||
|
Text = arcStrings.ODNAudioSampleRate,
|
||||||
|
ValuesSet = new[] { 22050u, 44100u },
|
||||||
|
};
|
||||||
|
|
||||||
public override ArcFile TryOpen (ArcView file)
|
public override ArcFile TryOpen (ArcView file)
|
||||||
{
|
{
|
||||||
if (!file.Name.HasExtension (".odn"))
|
if (!file.Name.HasExtension (".odn"))
|
||||||
@@ -92,6 +104,7 @@ namespace GameRes.Formats.Valkyria
|
|||||||
internal static readonly Regex Image24NameRe = new Regex ("^(?:back|phii)");
|
internal static readonly Regex Image24NameRe = new Regex ("^(?:back|phii)");
|
||||||
internal static readonly Regex Image32NameRe = new Regex ("^(?:data|codn|cccc)");
|
internal static readonly Regex Image32NameRe = new Regex ("^(?:data|codn|cccc)");
|
||||||
internal static readonly Regex ScriptNameRe = new Regex ("^(?:scrp|menu|sysm)");
|
internal static readonly Regex ScriptNameRe = new Regex ("^(?:scrp|menu|sysm)");
|
||||||
|
internal static readonly Regex AudioNameRe = new Regex ("^hime");
|
||||||
|
|
||||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||||
{
|
{
|
||||||
@@ -102,6 +115,24 @@ namespace GameRes.Formats.Valkyria
|
|||||||
Decrypt (data, data.Length, key);
|
Decrypt (data, data.Length, key);
|
||||||
return new BinMemoryStream (data);
|
return new BinMemoryStream (data);
|
||||||
}
|
}
|
||||||
|
if (AudioNameRe.IsMatch (entry.Name))
|
||||||
|
{
|
||||||
|
using (var wav = new MemoryStream (0x2C))
|
||||||
|
{
|
||||||
|
var format = new WaveFormat {
|
||||||
|
FormatTag = 1,
|
||||||
|
Channels = 1,
|
||||||
|
SamplesPerSecond = AudioSampleRate.Get<uint>(),
|
||||||
|
BlockAlign = 2,
|
||||||
|
BitsPerSample = 16,
|
||||||
|
};
|
||||||
|
format.SetBPS();
|
||||||
|
WaveAudio.WriteRiffHeader (wav, format, entry.Size);
|
||||||
|
var header = wav.ToArray();
|
||||||
|
var data = arc.File.CreateStream (entry.Offset, entry.Size);
|
||||||
|
return new PrefixStream (header, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
var input = arc.File.CreateStream (entry.Offset, entry.Size);
|
var input = arc.File.CreateStream (entry.Offset, entry.Size);
|
||||||
if (0x5E6A6A42 == input.Signature)
|
if (0x5E6A6A42 == input.Signature)
|
||||||
{
|
{
|
||||||
@@ -247,6 +278,11 @@ namespace GameRes.Formats.Valkyria
|
|||||||
index_offset += 0x10;
|
index_offset += 0x10;
|
||||||
if (m_entry_buf.AsciiEqual (0, "END_ffffffffffff"))
|
if (m_entry_buf.AsciiEqual (0, "END_ffffffffffff"))
|
||||||
break;
|
break;
|
||||||
|
else if (m_entry_buf.AsciiEqual (0, "HIME_END"))
|
||||||
|
{
|
||||||
|
index_offset += 8;
|
||||||
|
break;
|
||||||
|
}
|
||||||
var name = m_enc.GetString (m_entry_buf, 0, 8);
|
var name = m_enc.GetString (m_entry_buf, 0, 8);
|
||||||
var offset = m_enc.GetString (m_entry_buf, 8, 8);
|
var offset = m_enc.GetString (m_entry_buf, 8, 8);
|
||||||
var entry = new Entry { Name = name, Offset = Convert.ToUInt32 (offset, 16) };
|
var entry = new Entry { Name = name, Offset = Convert.ToUInt32 (offset, 16) };
|
||||||
@@ -254,6 +290,8 @@ namespace GameRes.Formats.Valkyria
|
|||||||
}
|
}
|
||||||
foreach (var entry in m_dir)
|
foreach (var entry in m_dir)
|
||||||
entry.Offset += index_offset;
|
entry.Offset += index_offset;
|
||||||
|
if (m_dir.Any() && m_dir[m_dir.Count-1].Offset == m_file.MaxOffset)
|
||||||
|
m_dir.RemoveAt (m_dir.Count-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReadV2 (uint record_size)
|
void ReadV2 (uint record_size)
|
||||||
@@ -321,6 +359,10 @@ namespace GameRes.Formats.Valkyria
|
|||||||
{
|
{
|
||||||
entry.Type = "script";
|
entry.Type = "script";
|
||||||
}
|
}
|
||||||
|
else if (OdnOpener.AudioNameRe.IsMatch (entry.Name))
|
||||||
|
{
|
||||||
|
entry.Type = "audio";
|
||||||
|
}
|
||||||
else if (entry.Size > 4)
|
else if (entry.Size > 4)
|
||||||
{
|
{
|
||||||
var signature = m_file.View.ReadUInt32 (entry.Offset);
|
var signature = m_file.View.ReadUInt32 (entry.Offset);
|
||||||
|
|||||||
@@ -187,6 +187,9 @@
|
|||||||
<setting name="PFSEncodingCP" serializeAs="String">
|
<setting name="PFSEncodingCP" serializeAs="String">
|
||||||
<value>65001</value>
|
<value>65001</value>
|
||||||
</setting>
|
</setting>
|
||||||
|
<setting name="ODNAudioSampleRate" serializeAs="String">
|
||||||
|
<value>44100</value>
|
||||||
|
</setting>
|
||||||
</GameRes.Formats.Properties.Settings>
|
</GameRes.Formats.Properties.Settings>
|
||||||
</userSettings>
|
</userSettings>
|
||||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /></startup>
|
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /></startup>
|
||||||
|
|||||||
Reference in New Issue
Block a user