Jump to content

UABE - Asset Bundle Extractor


DerPopo

Recommended Posts

Why does the class database file(U5.3.1p3) which export from classdata.tpk include 5.3.* and 5.3.1p3 versions.

I mean that the 5.3.* version does not include 5.3.1p3?

 

All of the class database files have include two versions.

 

 

What does the AssetsFile::typeTree.version mean?

Edited by sam ata (see edit history)
Link to comment
Share on other sites

Hello DerPopo, First grats is a great work this, very helpful. I wonder if you have any documentation about how to use the API to read/write assets?.

 

Another Question, in which lenguage are you development this tool is C++? I'm working on something similar but I want display the info directly in the Unity Editor and only I'm trying to get the Size of each component in the assetBundle.

 

For your program I guess the first step is decompress the bundle if this is not, after look into the serialized file, get all the components and finally process each one into right Type of Component to get all the properties, Am I right? At least this is how I'm thinking to aboard this.

 

Again an impressive work, cheers, and any comment if I'm going in the right way will be appreciated.

 

P.S If you can indicate me how to use your API thanks

 

So far, I haven't written a doumentation. I have some explanations though : here, here and https://7daystodie.com/forums/showthread.php?p=459961#post459961.

UABE is developed in C++, Visual Studio 2010 (compiled in Release mode) to be more precise.

To process every asset type except MonoBehaviours, you need to create an AssetTypeInstance as mentioned in the third example.

 

Why does the class database file(U5.3.1p3) which export from classdata.tpk include 5.3.* and 5.3.1p3 versions.

I mean that the 5.3.* version does not include 5.3.1p3?

 

All of the class database files has include two versions.

 

 

What does the AssetsFile::typeTree.version mean?

 

The single type database files (one per Unity version) contain their full version and a version mask. The full version just simplifies identifying the versions when it's required. It could be removed but it's only 8 bytes anyway.

 

TypeTree::version is a field stored in the .assets files. I don't use it since there haven't been multiple versions in any of the .assets file versions but always max. 1 unique version per AssetsFileHeader::format.

Link to comment
Share on other sites

The single type database files (one per Unity version) contain their full version and a version mask. The full version just simplifies identifying the versions when it's required. It could be removed but it's only 8 bytes anyway.

 

TypeTree::version is a field stored in the .assets files. I don't use it since there haven't been multiple versions in any of the .assets file versions but always max. 1 unique version per AssetsFileHeader::format.

I see now. Thank you very much!

 

 

That's a memory leak.

 

FILE *fpAssetsFile = NULL;

AssetsFile *pAssetsFile = NULL;

while(1)

{

fpAssetsFile = fopen("assets file", "rb");

if(NULL == fpAssetsFile) return;

pAssetsFile =new AssetsFile(AssetsReaderFromFile, (LPARAM)fpAssetsFile);

 

delete pAssetsFile;

pAssetsFile = NULL;

fclose(fpAssetsFile);

fpAssetsFile = NULL;

}

Edited by sam ata (see edit history)
Link to comment
Share on other sites

Strange behavior or user error?

 

Fantastic work on UABE!

 

I've just started with it and I want to pull items out of a .assets file.

 

I fire up UABE, file -> open, select 'sharedassets0.assets' and then the 'Assets Bundle Info' display comes up.

 

I can export individual items to .dat or .txt from this window, but when I click 'ok' the window disappears and UABE thinks I don't have a file open.

 

I've been able to export an OBJ file from a mesh but the resulting file is all messed up once opened in unity. The vertices are strewn all over the place.

 

Am I doing something wrong or have I stumbled across a use case that UABE wasn't built for?

 

Thanks!

Link to comment
Share on other sites

That's a memory leak.

Fixed it. It was because of a Unity5-only buffer that often has a zero-length that was still allocated but not freed because of the zero-length.

 

Fantastic work on UABE!

 

I've just started with it and I want to pull items out of a .assets file.

 

I fire up UABE, file -> open, select 'sharedassets0.assets' and then the 'Assets Bundle Info' display comes up.

 

I can export individual items to .dat or .txt from this window, but when I click 'ok' the window disappears and UABE thinks I don't have a file open.

 

I've been able to export an OBJ file from a mesh but the resulting file is all messed up once opened in unity. The vertices are strewn all over the place.

 

Am I doing something wrong or have I stumbled across a use case that UABE wasn't built for?

 

Thanks!

 

The assets info window is opened when you open an .assets file or if you open a bundle and press Info. If you haven't opened a bundle, the initial window won't show an opened file.

 

The Mesh converter doesn't support all Unity versions yet. Could you tell me which one it is in your case? You can find it in an output_log.txt (given that you opened the game before) or in any of the .assets files with a hex editor. An example version is "5.0.1f1".

Link to comment
Share on other sites

Is there a way to change what audio frequency FMOD outputs the sounds in? It seems to be extracting everything in 48kHz regardless of the sounds' original audio frequency...

 

The next version will use another method that doesn't play the sound to a .wav, so the frequency won't be changed and there won't be a 4096 samples granularity (making the files longer).

Link to comment
Share on other sites

The next version will use another method that doesn't play the sound to a .wav, so the frequency won't be changed and there won't be a 4096 samples granularity (making the files longer).

Are You planning to release a new version with releases A15 or earlier ?

Link to comment
Share on other sites

  • 2 weeks later...

Here's a sample code to determine whether a bundle file is compressed :

bool is6_compressed = false;
if (bundleFile.bundleHeader3.fileVersion == 6)
{
	is6_compressed = (bundleFile.bundleHeader6.flags & 0x3F) != 0;
	for (DWORD i = 0; i < bundleFile.listCount; i++)
	{
		for (DWORD k = 0; k < bundleFile.bundleInf6[i].blockCount; k++)
		{
			if ((bundleFile.bundleInf6[i].blockInf[k].flags & 0x3F) != 0)
			{
				is6_compressed = true;
				break;
			}
		}
	}
}
if (((bundleFile.bundleHeader3.fileVersion == 3) && !strcmp(bundleFile.bundleHeader3.signature, "UnityWeb"))
	|| is6_compressed))
{
	//compressed, needs decompression first
}

 

The next release (2.0) isn't completely finished yet. The mod installer stuff is almost finished except importing other installer files and also opening a previous session. There also are some bugs to fix.

Link to comment
Share on other sites

You'll have to wait for the next release, which will be able to export the height map from terrain data.

 

Oh okay, and when will this version be released and is their any program that currently has this feature that I can export the terrain, because I need to do this asap thanks. =)

Link to comment
Share on other sites

Thanks for the tool, it's really great!

 

There's one feature I think we would all like though: reading the public variables from induvidual components on prefabs.

Right now, all I'm getting is the m_PropertiesHash. Is there anything we can do with that hash?

 

Since the prefabs are not stored in a scene, the data keeping track of the values assigned to the component could be stored somewhere in the resources.asset bundle, along with everything else, right? And since we have the .dll files containing the code of the components, it seems to me (with my small understanding of how this tool actually works), that there should be a way for us to find out what the properties are.

 

Just in case I'm stupid, is there something I can do with the m_PropertiesHash right now that I'm not seeing?

Link to comment
Share on other sites

Oh okay, and when will this version be released and is their any program that currently has this feature that I can export the terrain, because I need to do this asap thanks. =)

 

I'm trying to get it released next week. I have finished the TerrainData plugin and done some other important changes.

Now the remaining things to do (except bugfixes) are the option to merge installer files (done) and to add custom icons (done), the option to use installer files like "savegames" for UABE (done), mprovements to the search as stated here (done), support for split .resource files (done), opening multiple .assets at the same time (done), exporting multiple dumps/raw files (done) and maybe an indicator for changed assets in the list (done).

 

Thanks for the tool, it's really great!

 

There's one feature I think we would all like though: reading the public variables from induvidual components on prefabs.

Right now, all I'm getting is the m_PropertiesHash. Is there anything we can do with that hash?

 

Since the prefabs are not stored in a scene, the data keeping track of the values assigned to the component could be stored somewhere in the resources.asset bundle, along with everything else, right? And since we have the .dll files containing the code of the components, it seems to me (with my small understanding of how this tool actually works), that there should be a way for us to find out what the properties are.

 

Just in case I'm stupid, is there something I can do with the m_PropertiesHash right now that I'm not seeing?

 

m_PropertiesHash is inside MonoScript, which only basically a reference to a script (e.g. in Assembly-CSharp.dll). The data you are looking for is inside MonoBehaviours, which are different for each script.

If you open the assembly in a decompiler (such as Telerik JustDecompile), you can find out what data specific to the script is stored after the data you can already see.

If you want to view the data in UABE, see https://github.com/DerPopo/UABE/issues/63 .

Edited by DerPopo
Status update (see edit history)
Link to comment
Share on other sites

Is there any way to export MovieTexture via API?

 

Read the ClassDatabaseFile (I think there aren't many changes for MovieTextures, so it's only about Unity4/5), search the MovieTexture type in it using the type id (0x98), create an AssetTypeTemplateField (AssetTypeClass.h) and call FromClassDatabase with fieldIndex 0.

To heavily reduce the memory and computing overhead, I recommend to change the m_MovieData array type to TypelessData :

for (DWORD i = 0; i < templateBase.childrenCount; i++)
{
if (!strcmp(templateBase.children[i].name, "m_MovieData") && templateBase.children[i].childrenCount > 0)
{
	templateBase.children[i].children[0].type = "TypelessData";
	break;
}
}

You'll need to store a pointer to the template field in a variable and create an AssetTypeInstance with baseFieldCount = 1, ppBaseFields = &<template field pointer>, reader/readerPar = <your asset reader/readerPar>, filePos = <in .assets file the absolute position of the asset>.

Then, call GetBaseField() and if it doesn't return NULL, continue. In this code sample, the returned value is stored in pBase :

AssetTypeValueField *pNameField = pBase->Get("m_Name");
AssetTypeValueField *pAudioClipFileIDField = pBase->Get("m_AudioClip")->Get("m_FileID");
AssetTypeValueField *pAudioClipPathIDField = pBase->Get("m_AudioClip")->Get("m_PathID");
AssetTypeValueField *pMovieDataField = pBase->Get("m_MovieData")->Get(0UL);
if (!pNameField->IsDummy() && !pAudioClipFileIDField->IsDummy() && !pAudioClipPathIDField->IsDummy() && !pMovieDataField->IsDummy())
{ /*do what you want with the data*/

If you changed the type to TypelessData, pMovieDataField->GetValue()->AsByteArray() will return a struct pointer with size and data variables, otherwise you'd have to get the array size via pMovieDataField->GetValue()->AsArray()->size and call (BYTE)pMovieDataField->Get(i)->GetValue()->AsInt() for each byte to generate a buffer.

This data is a .ogv file which many players support. Usually, you don't have to care for the audio data. In all cases I've seen, the audio data is inside the .ogv file.

 

wait, what are you talking about? it is about 7dtd ? what is it MovieTexture ?

7dtd doesn't make use of MovieTextures (afaik) but it should be usable inside a mod, also with SDX.

MovieTextures contain video and audio data and are sometimes used for cutscenes in other Unity games, I'm not sure whether they also are used ingame.

Link to comment
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...