Renamed Audio PCK members to in game names

This commit is contained in:
MayNL
2026-06-30 11:47:30 -04:00
parent 50ee8486db
commit ccd4b3cd02
7 changed files with 466 additions and 517 deletions
@@ -21,7 +21,7 @@ namespace PckStudio.Core.IO.PckAudio
private PckAudioFile _file;
private ByteOrder _endianness;
private List<string> LUT = new List<string>();
private List<PckAudioFile.AudioCategory.EAudioType> _OriginalAudioTypeOrder = new List<PckAudioFile.AudioCategory.EAudioType>();
private List<PckAudioFile.AudioTrackList.EAudioType> _OriginalAudioTypeOrder = new List<PckAudioFile.AudioTrackList.EAudioType>();
public PckAudioFileReader(ByteOrder endianness)
{
@@ -80,13 +80,13 @@ namespace PckStudio.Core.IO.PckAudio
int categoryEntryCount = reader.ReadInt32();
for (; 0 < categoryEntryCount; categoryEntryCount--)
{
var parameterType = (PckAudioFile.AudioCategory.EAudioParameterType)reader.ReadInt32();
var audioType = (PckAudioFile.AudioCategory.EAudioType)reader.ReadInt32();
var parameterType = (PckAudioFile.AudioTrackList.EAudioParameterType)reader.ReadInt32();
var audioType = (PckAudioFile.AudioTrackList.EAudioType)reader.ReadInt32();
string name = ReadString(reader);
// AddCategory puts the file's categories out of order and causes some songs to be put in the wrong categories
// This is my simple fix for the issue.
_OriginalAudioTypeOrder.Add(audioType);
_file.AddCategory(parameterType, audioType, name);
_file.AddTrackList(parameterType, audioType, name);
}
}
@@ -94,7 +94,7 @@ namespace PckStudio.Core.IO.PckAudio
{
List<string> credits = new List<string>();
List<string> creditIds = new List<string>();
foreach (PckAudioFile.AudioCategory.EAudioType c in _OriginalAudioTypeOrder)
foreach (PckAudioFile.AudioTrackList.EAudioType c in _OriginalAudioTypeOrder)
{
int audioCount = reader.ReadInt32();
for (; 0 < audioCount; audioCount--)
@@ -104,7 +104,7 @@ namespace PckStudio.Core.IO.PckAudio
switch (key)
{
case "CUENAME":
_file.GetCategory(c).SongNames.Add(value);
_file.GetTrackList(c).TrackNames.Add(value);
break;
case "CREDIT":
credits.Add(value);
@@ -67,8 +67,8 @@ namespace PckStudio.Core.IO.PckAudio
private void WriteCategories(EndiannessAwareBinaryWriter writer)
{
writer.Write(_file.Categories.Length);
foreach (PckAudioFile.AudioCategory category in _file.Categories)
writer.Write(_file.TrackLists.Length);
foreach (PckAudioFile.AudioTrackList category in _file.TrackLists)
{
writer.Write((int)category.parameterType);
writer.Write((int)category.AudioType);
@@ -79,10 +79,10 @@ namespace PckStudio.Core.IO.PckAudio
private void WriteCategorySongs(EndiannessAwareBinaryWriter writer)
{
bool addCredit = true;
foreach (PckAudioFile.AudioCategory category in _file.Categories)
foreach (PckAudioFile.AudioTrackList category in _file.TrackLists)
{
writer.Write(category.SongNames.Count + (addCredit ? _file.Credits.Count * 2 : 0));
foreach (var name in category.SongNames)
writer.Write(category.TrackNames.Count + (addCredit ? _file.Credits.Count * 2 : 0));
foreach (var name in category.TrackNames)
{
writer.Write(LUT.IndexOf("CUENAME"));
WriteString(writer, name);