mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-25 20:34:13 +08:00
(AudioClip): moved to separate file.
This commit is contained in:
parent
c45d2efc3d
commit
d3e0a7da9e
@ -686,10 +686,12 @@
|
|||||||
<Compile Include="Unity\ArcUnityFS.cs" />
|
<Compile Include="Unity\ArcUnityFS.cs" />
|
||||||
<Compile Include="Unity\Asset.cs" />
|
<Compile Include="Unity\Asset.cs" />
|
||||||
<Compile Include="Unity\AssetReader.cs" />
|
<Compile Include="Unity\AssetReader.cs" />
|
||||||
|
<Compile Include="Unity\AudioClip.cs" />
|
||||||
<Compile Include="Unity\AudioFSB5.cs" />
|
<Compile Include="Unity\AudioFSB5.cs" />
|
||||||
<Compile Include="Unity\BundleStream.cs" />
|
<Compile Include="Unity\BundleStream.cs" />
|
||||||
<Compile Include="Unity\Gx4Lib\ArcDAT.cs" />
|
<Compile Include="Unity\Gx4Lib\ArcDAT.cs" />
|
||||||
<Compile Include="Unity\OggStream.cs" />
|
<Compile Include="Unity\OggStream.cs" />
|
||||||
|
<Compile Include="Unity\ResourcesAssets.cs" />
|
||||||
<Compile Include="Unity\Texture2D.cs" />
|
<Compile Include="Unity\Texture2D.cs" />
|
||||||
<Compile Include="Unity\Utage\ImageUTAGE.cs" />
|
<Compile Include="Unity\Utage\ImageUTAGE.cs" />
|
||||||
<Compile Include="Unity\Vorbis.cs" />
|
<Compile Include="Unity\Vorbis.cs" />
|
||||||
|
@ -31,8 +31,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using GameRes.Utility;
|
using GameRes.Utility;
|
||||||
|
|
||||||
@ -246,7 +244,20 @@ namespace GameRes.Formats.Unity
|
|||||||
|
|
||||||
void LoadRaw (AssetReader reader)
|
void LoadRaw (AssetReader reader)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
Type = reader.ReadCString();
|
||||||
|
Name = reader.ReadCString();
|
||||||
|
Size = reader.ReadInt32();
|
||||||
|
Index = reader.ReadUInt32();
|
||||||
|
IsArray = reader.ReadInt32() != 0;
|
||||||
|
Version = reader.ReadInt32();
|
||||||
|
Flags = reader.ReadInt32();
|
||||||
|
int count = reader.ReadInt32();
|
||||||
|
for (int i = 0; i < count; ++i)
|
||||||
|
{
|
||||||
|
var child = new TypeTree (m_format);
|
||||||
|
child.Load (reader);
|
||||||
|
Children.Add (child);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] m_data;
|
byte[] m_data;
|
||||||
@ -374,60 +385,4 @@ namespace GameRes.Formats.Unity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class AudioClip
|
|
||||||
{
|
|
||||||
public string m_Name;
|
|
||||||
public int m_LoadType;
|
|
||||||
public int m_Channels;
|
|
||||||
public int m_Frequency;
|
|
||||||
public int m_BitsPerSample;
|
|
||||||
public float m_Length;
|
|
||||||
public bool m_IsTrackerFormat;
|
|
||||||
public int m_SubsoundIndex;
|
|
||||||
public bool m_PreloadAudioData;
|
|
||||||
public bool m_LoadInBackground;
|
|
||||||
public bool m_Legacy3D;
|
|
||||||
public string m_Source;
|
|
||||||
public long m_Offset;
|
|
||||||
public long m_Size;
|
|
||||||
public int m_CompressionFormat;
|
|
||||||
|
|
||||||
public void Load (AssetReader reader)
|
|
||||||
{
|
|
||||||
m_Name = reader.ReadString();
|
|
||||||
reader.Align();
|
|
||||||
m_LoadType = reader.ReadInt32();
|
|
||||||
m_Channels = reader.ReadInt32();
|
|
||||||
m_Frequency = reader.ReadInt32();
|
|
||||||
m_BitsPerSample = reader.ReadInt32();
|
|
||||||
m_Length = reader.ReadFloat();
|
|
||||||
m_IsTrackerFormat = reader.ReadBool();
|
|
||||||
reader.Align();
|
|
||||||
m_SubsoundIndex = reader.ReadInt32();
|
|
||||||
m_PreloadAudioData = reader.ReadBool();
|
|
||||||
m_LoadInBackground = reader.ReadBool();
|
|
||||||
m_Legacy3D = reader.ReadBool();
|
|
||||||
reader.Align();
|
|
||||||
m_Source = reader.ReadString();
|
|
||||||
reader.Align();
|
|
||||||
m_Offset = reader.ReadInt64();
|
|
||||||
m_Size = reader.ReadInt64();
|
|
||||||
m_CompressionFormat = reader.ReadInt32();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal class StreamingInfo
|
|
||||||
{
|
|
||||||
public uint Offset;
|
|
||||||
public uint Size;
|
|
||||||
public string Path;
|
|
||||||
|
|
||||||
public void Load (AssetReader reader)
|
|
||||||
{
|
|
||||||
Offset = reader.ReadUInt32();
|
|
||||||
Size = reader.ReadUInt32();
|
|
||||||
Path = reader.ReadString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
111
ArcFormats/Unity/AudioClip.cs
Normal file
111
ArcFormats/Unity/AudioClip.cs
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
//! \file AudioClip.cs
|
||||||
|
//! \date 2018 Aug 31
|
||||||
|
//! \brief Unity engine audio clip deserializer
|
||||||
|
//
|
||||||
|
// Copyright (C) 2018 by morkt
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to
|
||||||
|
// deal in the Software without restriction, including without limitation the
|
||||||
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
// IN THE SOFTWARE.
|
||||||
|
//
|
||||||
|
|
||||||
|
namespace GameRes.Formats.Unity
|
||||||
|
{
|
||||||
|
enum AudioFormat : int
|
||||||
|
{
|
||||||
|
Unknown = 0,
|
||||||
|
Acc = 1,
|
||||||
|
Aiff = 2,
|
||||||
|
It = 10,
|
||||||
|
Mod = 12,
|
||||||
|
Mpeg = 13,
|
||||||
|
OggVorbis = 14,
|
||||||
|
S3M = 17,
|
||||||
|
Wav = 20,
|
||||||
|
Xm = 21,
|
||||||
|
Xma = 22,
|
||||||
|
Vag = 23,
|
||||||
|
AudioQueue = 24,
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class AudioClip
|
||||||
|
{
|
||||||
|
public string m_Name;
|
||||||
|
public int m_LoadType;
|
||||||
|
public int m_Channels;
|
||||||
|
public int m_Frequency;
|
||||||
|
public int m_BitsPerSample;
|
||||||
|
public float m_Length;
|
||||||
|
public bool m_IsTrackerFormat;
|
||||||
|
public int m_SubsoundIndex;
|
||||||
|
public bool m_PreloadAudioData;
|
||||||
|
public bool m_LoadInBackground;
|
||||||
|
public bool m_Legacy3D;
|
||||||
|
public string m_Source;
|
||||||
|
public long m_Offset;
|
||||||
|
public long m_Size;
|
||||||
|
public int m_CompressionFormat;
|
||||||
|
|
||||||
|
public void Load (AssetReader reader)
|
||||||
|
{
|
||||||
|
m_Name = reader.ReadString();
|
||||||
|
reader.Align();
|
||||||
|
if (reader.Format > 9)
|
||||||
|
{
|
||||||
|
m_LoadType = reader.ReadInt32();
|
||||||
|
m_Channels = reader.ReadInt32();
|
||||||
|
m_Frequency = reader.ReadInt32();
|
||||||
|
m_BitsPerSample = reader.ReadInt32();
|
||||||
|
m_Length = reader.ReadFloat();
|
||||||
|
m_IsTrackerFormat = reader.ReadBool();
|
||||||
|
reader.Align();
|
||||||
|
m_SubsoundIndex = reader.ReadInt32();
|
||||||
|
m_PreloadAudioData = reader.ReadBool();
|
||||||
|
m_LoadInBackground = reader.ReadBool();
|
||||||
|
m_Legacy3D = reader.ReadBool();
|
||||||
|
reader.Align();
|
||||||
|
m_Source = reader.ReadString();
|
||||||
|
reader.Align();
|
||||||
|
m_Offset = reader.ReadInt64();
|
||||||
|
m_Size = reader.ReadInt64();
|
||||||
|
m_CompressionFormat = reader.ReadInt32();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_LoadType = reader.ReadInt32();
|
||||||
|
m_CompressionFormat = reader.ReadInt32();
|
||||||
|
reader.ReadInt32();
|
||||||
|
reader.ReadInt32();
|
||||||
|
m_Size = reader.ReadUInt32();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class StreamingInfo
|
||||||
|
{
|
||||||
|
public uint Offset;
|
||||||
|
public uint Size;
|
||||||
|
public string Path;
|
||||||
|
|
||||||
|
public void Load (AssetReader reader)
|
||||||
|
{
|
||||||
|
Offset = reader.ReadUInt32();
|
||||||
|
Size = reader.ReadUInt32();
|
||||||
|
Path = reader.ReadString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user