Jump to content
DerPopo

Unity Assets Bundle Extractor

Recommended Posts

So, I've been wanting to mod some of the in-game audio for a while, but I've hit a bit of a snag when it comes to extracting audio clips and such.

 

Using this tool and Grim's UAE, I've been doing some poking around inside the .assets files to see how they're structured, along with a bit of my own research on how Unity 5 streams media during runtime. From what I can gather, it seems that most of, if not all the sounds 7DTD uses are not stored directly within resources.assets. Instead, this file contains what appear to be scripts of some sort which, presumably, point to individual files located within resources.resource.

 

To back this up, if you use the "View Info" function of UABE, and/or export a dump of audio-related files that are within resources.assets (e.x.: 44magnum_reload; path ID 5754), you'll see the following:

0 AudioClip Base
1 string m_Name = "44magnum_reload"
0 int m_LoadType = 1
0 int m_Channels = 1
0 int m_Frequency = 44100
0 int m_BitsPerSample = 16
0 float m_Length = 3.970000
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 = "resources.resource"
 0 UInt64 m_Offset = 39005472
 0 UInt64 m_Size = 350272
1 int m_CompressionFormat = 0

Of particular note is the line "string m_Source = "resources.resource;" Assuming I'm interpreting it correctly, that line leads me to believe that the above code is telling the game where to pull sounds from. Furthermore, that same line appears consistently throughout all other sound-related files I've been able to pull from resources.assets.

 

My ramblings withstanding, this brings me to my question: Is it possible to pull out files if they're stored in 'resources.resource?'

Share this post


Link to post
Share on other sites

V1.6 has been released with some bug fixes, a TextAsset plugin and an asset viewer update.

 

I am also looking into adding an AudioClip plugin but I can't find much about the FMOD sound bank format which is used to store the audio data.

There are tools that can view that file format but they seem to have problems with the sounds inside the file not having a name.

Share this post


Link to post
Share on other sites

Very good work. I tested it with files from A11.6. Thanks Hintern ;)

Edited by Pille (see edit history)

Share this post


Link to post
Share on other sites

If you want to add new sounds, you can create FMOD sound banks with the fsbank tool in the bin folder of the FMOD API

( http://www.fmod.org/download/ ). Only use one sound file at once. Press the build button and copy the .fsb file to the 7DaysToDie_Data folder.

 

You can export a dump of the AudioClip asset and change m_Source to the new file's name, set m_Offset to 0 and m_Size to the size of the new file in bytes you can lookup using the explorer. Then you can import the modified dump and save the .assets file.

 

I'm working on an AudioClip extractor but it probably won't work for vorbis files.

Share this post


Link to post
Share on other sites

I have released a small hotfix (v1.6b) that fixes the raw export file corruption bug and that has an updated Unity 5 class database.

Share this post


Link to post
Share on other sites

Tried to edit the opaque file with this tool and UAE, but if I save the edited file with the Asset Bundle Extractor, I get a 4,6 gb file!!!??

could you help me?

Share this post


Link to post
Share on other sites
Tried to edit the opaque file with this tool and UAE, but if I save the edited file with the Asset Bundle Extractor, I get a 4,6 gb file!!!??

could you help me?

 

Get it managed :smug:, NICE TOOL!!!!

Share this post


Link to post
Share on other sites
Get it managed :smug:, NICE TOOL!!!!

 

[ATTACH=CONFIG]10358[/ATTACH][ATTACH=CONFIG]10359[/ATTACH][ATTACH=CONFIG]10360[/ATTACH]

funny possibilities, Thanks derPopo :applouse:

Share this post


Link to post
Share on other sites

V1.7 has been released with a TextAsset plugin fix and a new AudioClip plugin.

The AudioClip plugin can export Unity 5 AudioClips to uncompressed .wav files using FMOD. Basically it plays the sound to the .wav file in "non-realtime" mode.

See this post if you want to import sounds.

Share this post


Link to post
Share on other sites

It doesn't work for me:

 

- I'm using UABE (by derPopo) on "BlockTextureAtlasesD" part of "Data\Bundles"

 

I am able to get a "raw" or "dump" file of the various "assets" under "Info"

 

Then, what I am supposed to do with those raw/dump files ? Is it possible to modify them (how) and reload them into the original "BlockTextureAtlasesD"?

Share this post


Link to post
Share on other sites

There are plugins for some of the file formats (currently Texture2D, TextAsset and AudioClip). If you want to modify the bundle, export the CAB-<random number> from the BlockTextureAtlases and then you can edit that exported file (and save it). Once you're finished, you can import it back to the BlockTextureAtlases and save it.

Share this post


Link to post
Share on other sites
There are plugins for some of the file formats (currently Texture2D, TextAsset and AudioClip). If you want to modify the bundle, export the CAB-<random number> from the BlockTextureAtlases and then you can edit that exported file (and save it). Once you're finished, you can import it back to the BlockTextureAtlases and save it.

 

With what tool can I edit the exported "CAB-" ?

Share this post


Link to post
Share on other sites

UABE can modify bundle files (and read the .assets in it but not write) and can modify raw .assets files (like the CAB file).

Share this post


Link to post
Share on other sites

DerPopo I love your program.

 

But the "Assets Bundle info" window is a bit difficult to dig throw in its currant setup. Is there a chance you can set it up so we can search by word, type of asset or something like that in your next release. And/or have a split window for easier drag and drop from Assets Bundle to Dir and back.:)

Share this post


Link to post
Share on other sites

Thankyou for the work you have done on this program... it is very useful!

 

I used it to figure out which scripts are attached to the tree objects ingame (which makes them able to be chopped down). You can see the research thread here:

https://7daystodie.com/forums/showthread.php?32970-Apple-Tree-Mod-Problem

 

The working apple tree model mod (with the correct script attached making it able to be chopped down) is here:

https://7daystodie.com/forums/showthread.php?33047-Apple-Tree-and-Apple-Models

 

The work I did on that apple tree raised an issue regarding "MonoBehaviour Base" files (type 0xFFFFFFE2):

When I try to "Export Dump" these files (for example "resources.assets" Path ID 65883 in A12.5) your program says "The file format is empty" which is not correct. I used the "Export Raw" button to dump the bytes and figured out what they mean.

 

UABE-Pic-Error-1.png

 

Basically those files contain swapped bytes with the parent Path ID in "resources.assets" and a Path ID to the script file name stored in the "mainData." file. Would be nice if you could "Export Dump" this data in a readable format just like other files.

 

7DtD-30951-Prefab-Breakdown-Extended.png

 

------------------------------------------------------------------------------------

 

It would also be very handy if we could export the meshes to OBJ or FBX format. This would make modding the existing models possible (e.g. export the holding seeds in your hand model and edit it). Perhaps you could add a plugin?

 

------------------------------------------------------------------------------------

 

Finally, it would make things a LOT easier if we could search the list for a certain text string and search for an entry by Path ID.

 

------------------------------------------------------------------------------------

 

Once again, thanks for your work on this program and I look forward to any updates.

 

:)

Share this post


Link to post
Share on other sites
DerPopo I love your program.

 

But the "Assets Bundle info" window is a bit difficult to dig throw in its currant setup. Is there a chance you can set it up so we can search by word, type of asset or something like that in your next release. And/or have a split window for easier drag and drop from Assets Bundle to Dir and back.:)

 

Thanks! I added that to the issue list.

 

Thankyou for the work you have done on this program... it is very useful!

 

I used it to figure out which scripts are attached to the tree objects ingame (which makes them able to be chopped down). You can see the research thread here:

https://7daystodie.com/forums/showthread.php?32970-Apple-Tree-Mod-Problem

 

The working apple tree model mod (with the correct script attached making it able to be chopped down) is here:

https://7daystodie.com/forums/showthread.php?33047-Apple-Tree-and-Apple-Models

 

The work I did on that apple tree raised an issue regarding "MonoBehaviour Base" files (type 0xFFFFFFE2):

When I try to "Export Dump" these files (for example "resources.assets" Path ID 65883 in A12.5) your program says "The file format is empty" which is not correct. I used the "Export Raw" button to dump the bytes and figured out what they mean.

 

Basically those files contain swapped bytes with the parent Path ID in "resources.assets" and a Path ID to the script file name stored in the "mainData." file. Would be nice if you could "Export Dump" this data in a readable format just like other files.

 

------------------------------------------------------------------------------------

 

It would also be very handy if we could export the meshes to OBJ or FBX format. This would make modding the existing models possible (e.g. export the holding seeds in your hand model and edit it). Perhaps you could add a plugin?

 

------------------------------------------------------------------------------------

 

Finally, it would make things a LOT easier if we could search the list for a certain text string and search for an entry by Path ID.

 

------------------------------------------------------------------------------------

 

Once again, thanks for your work on this program and I look forward to any updates.

 

:)

 

MonoBehaviour assets are game-specific. Only the base which includes the game object PPtr, an m_Enabled bool, the script PPtr and a name field is the same for all (that the file format is shown as empty is a bug in the current release, it will be fixed for the next release).

To find the complete type information, these have to be extracted from the MonoBehaviour classes in Assembly-CSharp (or other assemblies). I made a tool that does this (which doesn't yet work properly with some classes that use generic fields) and I have to do further testing.

 

The mesh extractor also is on the issue list.

 

 

The next release will be able to unpack packed bundles (mostly web player .unity3d files), maybe pack these (the web player doesn't seem to want to use these repacked files, I'm not yet sure why) and there will be some bugfixes (to allow opening bundles with sound banks and with dlls without a crash).

Edited by DerPopo (see edit history)

Share this post


Link to post
Share on other sites

V1.8 has been released! It features a Mesh to .obj and a MovieTexture plugin, compressed bundle support (WebPlayer .unity3d), search and sort functionality, batch asset export, much faster tree views and many smaller additions and fixes.

 

Also, I now use the CC BY-NC-SA 3.0 license. I explicitly don't forbid using the tool for commercial mods but most games don't allow that anyway (including 7dtd).

Edited by DerPopo (see edit history)

Share this post


Link to post
Share on other sites

DerPopo,

 

Thankyou very much for the new update!

 

I was very happy when I saw the cool new features such as sortable columns, searching and OBJ export (looks good so far with the mesh being correct and UVs in place etc).

 

Sadly I have found an issue with v1.8 and v1.8b 64 bit: the program crashes when I try to export any texture to TGA or PNG.

 

UAE-Export-Texture-Crash.png

 

Is there something I am doing wrong or is there some way I can help you diagnose the problem?

 

Exporting the same texture works fine in v1.7 64 bit (but sometimes the texture is flipped vertically and the RGBA channels are swapped... ie I need to copy Red to Alpha, Green to Red, Blue to Green and Alpha to Blue).

Share this post


Link to post
Share on other sites

There is a new type database (classdata_0E) which was created from Unity 5.2.0f3 mainly because the texture formats aren't compatible. For 7dtd, the old type database (classdata_0E.5.0.1f) is required. Just replace classdata_0E with the old one and it should work.

Share this post


Link to post
Share on other sites
There is a new type database (classdata_0E) which was created from Unity 5.2.0f3 mainly because the texture formats aren't compatible. For 7dtd, the old type database (classdata_0E.5.0.1f) is required. Just replace classdata_0E with the old one and it should work.

 

Yeah, that works great... when I use the old type database file with the new program version the texture is flipped the correct way and the RGBA channels are correct too.

 

Thanks!

Share this post


Link to post
Share on other sites

I had a chance today to try out the new OBJ mesh export feature and there seems to be an issue with the UVs. I know I said in a previous post they looked fine but at that point in time I did not check them thoroughly.

 

Some examples of what I am talking about are below.

 

This is the exported OBJ mesh for the Fat Zombie Cop imported into 3ds Max. You can see the UV texture mapping is not correct. There is only one UV channel so this is not a light map UV channel. It is like a plane projection of the mesh instead of the actual texture map. Some of the UV islands look correct but overall it is wrong:

 

7DtD-Fat-Zombie-Cop-1-Small.png

(click for full size picture)

 

 

 

Another example is the Bear mesh. Its UVs are also incorrect. In this model there are two UV channels but both of them seem wrong. Neither of the channels is the actual texture UV set or a light map. Below is the first UV channel:

 

7DtD-Bear-1-Small.png

(click for full size picture)

 

Here is the second UV channel:

 

7DtD-Bear-2-Small.png

(click for full size picture)

 

 

 

I also tried importing the OBJ file into Substance Painter just in case 3ds Max was messing up the UVs somehow but they are also incorrect:

 

7DtD-Fat-Zombie-Cop-2-Small.png

(click for full size picture)

 

 

 

Finally, I tried importing some other meshes like the empty jar ("mason_jarPrefab") but the UVs are not right either.

 

:S

Share this post


Link to post
Share on other sites

First of all sorry for posting again but I have some new information and I cannot edit my existing post.

 

After exporting and checking many OBJ files I have noticed a few things:

 

* In some OBJ files the UVs are correct while others are not... they appear as a plane projection of the model from the side or top

* The UVs are not correct for most of the rigged characters and rigged models

* The models that do have correct looking UVs (e.g. laid out nicely in the 0 to 1 UV space) need to have their UVs mirrored vertically

 

Before UV Flip

7DtD-Auger-Before-UV-Vertical-Mirror-Small.png

(click for full size picture)

 

After UV Flip

7DtD-Auger-After-UV-Vertical-Mirror-Small.png

(click for full size picture)

 

* Some models have multiple meshes (not LOD levels but different versions) like they went through a couple of iterations before settling on the final version e.g. the bear has two models "BEAR" and "new_BEAR". The UVs in "BEAR" do not seem to import correctly while the UVs in "new_BEAR" do import correctly but need to be mirrored vertically

 

7DtD-Bear-Fixed-Small.png

(click for full size picture)

 

 

I hope this helps you to find and fix the problems.

 

:)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...