Comments (4)
The test code works in release mode. It seems like the debug and release versions of msvc redist don't like each other.
Note that TextAssets aren't .txt files. Export the raw data from a patched .assets file with the imported .txt (it needs to be reopened in UABE after saving to see the change) and use the .dat in the patcher instead of a .txt file.
The AssetsReplacer has the same effect as using Import raw in UABE.
from uabe.
Here's a short summary of all steps. I hope I didn't forget anything important.
First, create an AssetsFile using AssetsReaderFromFile as reader and (LPARAM)pFile (opened through fopen with "rb") as readerPar.
Then create an AssetsFileTable with the AssetsFile. It allows you to search by the name (not completely reliable, uses the m_Name field of specific asset types) or by the path id. Alternatively, you can also find the asset through the pAssetFileInfo array (which has assetFileInfoCount elements).
Use the index value (= pathID), curFileType and inheritedUnityClass (all from the AssetFileInfo) and 0 for the fileID to create an AssetsReplacer through one of the MakeAssetModifier* functions.
Put that AssetsReplacer into a std::vector through push_back and pass it to AssetsFile::Write with AssetsWriterToFile, the output .assets file opened through fopen with "wb", 0 as filePos, the replacers vector and 0 as fileID.
Note that the API only works with VC++ 2010, simply because FILE or std::vector are different between different versions.
from uabe.
Thanks for the fast response and sorry to bother you again.
I tried to follow what you described and came up with the test code below.
The problem right now is, that I get an 'Access violation writing location 0x00000014' while creating the AssetsFile (second line). I get the same exception with both, the 2010 compiler (I set up a VM with VS C++ 2010 Express) and the 2015 compiler (but since you hint that, I didn't expect it to work) .
The FILE seems to be fine (fgetc works and leads to correct results).
I don't know if this information is of any use, but I messed around a bit and found out, that replacing 'AssetReaderFromFile' with 'AssetReaderFromSplitFile' doesn't lead to that error but eating up the CPU and running forever.
The test-code I used:
FILE *pFile = fopen("D:\\tmp\\resources.assets", "rb");
AssetsFile assetsFile(AssetsReaderFromFile, (LPARAM)pFile); // I tried &AssetsReaderFromFile too since I'm not sure what's right here but it makes no difference
AssetsFileTable assetsFileTable(&assetsFile);
AssetFileInfoEx* assetsFileInfo = assetsFileTable.getAssetInfo(673); // I know the ID - no need to search
FILE *pReplaceFile = fopen("D:\\tmp\\go2.txt", "rb");
AssetsReplacer* assetReplacer = MakeAssetModifierFromFile(0, (*assetsFileInfo).index, (*assetsFileInfo).curFileType, (*assetsFileInfo).inheritedUnityClass,
pReplaceFile, 0, (QWORD)filesize("D:\\tmp\\go2.txt")); // I expect that the size parameter refers to the file size but I couldn't check this until now
std::vector<AssetsReplacer*> replacors;
replacors.push_back(assetReplacer);
FILE *pOutputFile = fopen("D:\\tmp\\resources_tmp.assets", "wb"); // Output in a temp-file and replace the original one afterwards since the original file should be locked right now
assetsFile.Write(AssetsWriterToFile, (LPARAM)pOutputFile, 0, replacors, 0);
fclose(pFile);
fclose(pReplaceFile);
fclose(pOutputFile);
from uabe.
I feel somehow bad that I didn't consider that ...
Everything is working now. Thank you very much!
from uabe.
Related Issues (20)
- Editing Textures not Working
- Pokémon HOME .unity3d not opening in UABE
- [Question]: Can't convert some texture2d to png because it's in containers, but containers do not exist?
- Unable to read the bundle file! (Invalid file or unknown version) HOT 2
- Failed to open file HOT 1
- does not save the .png pls help me HOT 3
- Hello im new to uabe but can someone help me where to find the bundle extractor in uabe 3.0?
- Exporting meshes as .obj breaks UV
- Asset Bundle Extractor cannot change audio .npk files?
- Importing Images and Sprite Packing Issue
- .assetbunble files not open
- cant export dump (unable to extract type information) HOT 1
- assets
- Crash when importing Texture2D Sprite Atlas
- Exports not saving
- Failed :XXX.bundle (Compressed Bundle)
- DLL error
- File is "corrupted"
- Crashed when open .unity3d files
- BATCH IMPORT
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uabe.