mirror of
https://github.com/blueskythlikesclouds/SonicAudioTools.git
synced 2024-11-23 22:50:58 +01:00
Improve sub-key support.
This commit is contained in:
parent
dcc89b47ba
commit
d8c911c62b
@ -92,6 +92,12 @@ namespace AcbEditor
|
||||
afs2Archive.Read(afs2Stream);
|
||||
}
|
||||
}
|
||||
|
||||
if (afs2Archive.SubKey != 0)
|
||||
{
|
||||
using (var stream = File.Create(Path.Combine(outputDirectoryPath, ".subkey")))
|
||||
DataStream.WriteUInt16(stream, afs2Archive.SubKey);
|
||||
}
|
||||
}
|
||||
|
||||
if (acbReader.GetLength("StreamAwbAfs2Header") > 0)
|
||||
@ -126,6 +132,12 @@ namespace AcbEditor
|
||||
{
|
||||
throw new FileNotFoundException("Cannot find the external .AWB file for this .ACB file. Please ensure that the external .AWB file is stored in the directory where the .ACB file is.");
|
||||
}
|
||||
|
||||
if (extAfs2Archive.SubKey != 0)
|
||||
{
|
||||
using (var stream = File.Create(Path.Combine(outputDirectoryPath, ".subkey_streaming")))
|
||||
DataStream.WriteUInt16(stream, extAfs2Archive.SubKey);
|
||||
}
|
||||
}
|
||||
|
||||
using (SubStream waveformTableStream = acbReader.GetSubStream("WaveformTable"))
|
||||
@ -312,6 +324,20 @@ namespace AcbEditor
|
||||
acbFile.Rows[0]["AwbFile"] = null;
|
||||
acbFile.Rows[0]["StreamAwbAfs2Header"] = null;
|
||||
|
||||
string subKeyFilePath = Path.Combine(args[0], ".subkey");
|
||||
if (File.Exists(subKeyFilePath))
|
||||
{
|
||||
using (var stream = File.OpenRead(subKeyFilePath))
|
||||
afs2Archive.SubKey = DataStream.ReadUInt16(stream);
|
||||
}
|
||||
|
||||
string subKeyStreamingFilePath = Path.Combine(args[0], ".subkey_streaming");
|
||||
if (File.Exists(subKeyStreamingFilePath))
|
||||
{
|
||||
using (var stream = File.OpenRead(subKeyStreamingFilePath))
|
||||
extAfs2Archive.SubKey = DataStream.ReadUInt16(stream);
|
||||
}
|
||||
|
||||
if (afs2Archive.Count > 0 || cpkArchive.Count > 0)
|
||||
{
|
||||
Console.WriteLine("Saving internal AWB...");
|
||||
|
@ -17,7 +17,8 @@ namespace SonicAudioLib.Archives
|
||||
|
||||
public class CriAfs2Archive : ArchiveBase<CriAfs2Entry>
|
||||
{
|
||||
public uint Align { get; set; }
|
||||
public ushort SubKey { get; set; }
|
||||
public ushort Align { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets header of the written AFS2 archive.
|
||||
@ -62,7 +63,8 @@ namespace SonicAudioLib.Archives
|
||||
uint positionFieldLength = (information >> 8) & 0xFF;
|
||||
|
||||
uint entryCount = DataStream.ReadUInt32(source);
|
||||
Align = DataStream.ReadUInt32(source) & 0xFFFF;
|
||||
Align = DataStream.ReadUInt16(source);
|
||||
SubKey = DataStream.ReadUInt16(source);
|
||||
|
||||
CriAfs2Entry previousEntry = null;
|
||||
for (uint i = 0; i < entryCount; i++)
|
||||
@ -157,9 +159,10 @@ namespace SonicAudioLib.Archives
|
||||
long headerLength = Calculate(out uint idFieldLength, out uint positionFieldLength);
|
||||
|
||||
DataStream.WriteCString(mDestination, "AFS2", 4);
|
||||
DataStream.WriteUInt32(mDestination, 1 | (idFieldLength << 16) | (positionFieldLength << 8));
|
||||
DataStream.WriteUInt32(mDestination, (SubKey != 0 ? 2 : 1u) | (idFieldLength << 16) | (positionFieldLength << 8));
|
||||
DataStream.WriteUInt32(mDestination, (uint)entries.Count);
|
||||
DataStream.WriteUInt32(mDestination, Align);
|
||||
DataStream.WriteUInt16(mDestination, Align);
|
||||
DataStream.WriteUInt16(mDestination, SubKey);
|
||||
|
||||
DataPool vldPool = new DataPool(Align, headerLength);
|
||||
vldPool.ProgressChanged += OnProgressChanged;
|
||||
|
Loading…
Reference in New Issue
Block a user