ata4 / disunity

An experimental toolset for Unity asset and asset bundle files.
The Unlicense
2.69k stars 662 forks source link

Unity 5 load audio from external binary file #151

Open ivanpopelyshev opened 8 years ago

ivanpopelyshev commented 8 years ago

In "creativerse" game audio files from "resources.assets" are linked to "resources.resources" binary file through "m_Resource" field. Need to add it as a child binary file.

ivanpopelyshev commented 8 years ago

According to quickbms script for unity, $NAME$.assets file can reference $NAME$.resources file.

DerPopo commented 8 years ago

Here's an example from a U5 sharedassets1.assets file (standalone game) :

0 AudioClip Base
 1 string m_Name = "ui_menu_click"
 0 int m_LoadType = 1
 0 int m_Channels = 1
 0 int m_Frequency = 44100
 0 int m_BitsPerSample = 16
 0 float m_Length = 1.500000
 1 bool m_IsTrackerFormat = false
 0 int m_SubsoundIndex = 0
 0 bool m_PreloadAudioData = true
 0 bool m_LoadInBackground = false
 1 bool m_Legacy3D = true
 0 StreamedResource m_Resource
  1 string m_Source = "sharedassets1.resource"
  0 UInt64 m_Offset = 0
  0 UInt64 m_Size = 132416
 1 int m_CompressionFormat = 0

1 stands for 4-byte alignment after a field. m_Offset and m_Size both are in bytes. In case of a U5 web player game, it usually looks like this : "archive:/resources.assets". There are some bundle files for standalone games that have path names that treat the bundle's name like a folder name like this:

archive:/CAB-cd49bb0197cf41d663ae791708cd5b95/CAB-cd49bb0197cf41d663ae791708cd5b95.resource

I use the FMOD lowlevel API to play the sound bank in NRT (non-realtime) and play it to a PCM-16 .wav file. I don't know if there are any Java wrappers. As far as I know, all of these sound banks only contain one sound.

jack980517 commented 8 years ago

The .resource file used to be called .resS and disunity works fine with it. For now you can just try renaming it.