Comments (3)
Nevermind, I hadn't looked close enough at the PPtr class and borrowed code from there to resolve an object from file_id+path_id.
from unitypy.
I'm not sure if you already figured it out completely or not,
so I will simply explain some points.
The objects are stored inside of the SerializedFiles, which in turn are usually stored within BundleFiles.
The path_id is the unique identifier of an object within a SerializedFile. In BundleFiles with multiple SerializedFiles it can happen, that multiple of those SerializesFiles use the same path_id, but each for different objects.
So to find a specific object via the path_id you will also have to know the name of its SerializedFile.
Then you can simply search through env.files..files until you reach a SerializedFIle and then check its name and if it contains an object with the specific id.
The pointers themself usually only refer to objects within the same SerializedFile as the object that uses them.
If this isn't the case, then the reference uses the external list of the parent(SerializedFile) of the object and find the specified SerializedFile that way.
from unitypy.
Thanks for the additional info! What I ended up doing is something like this:
def get_obj_pptr(env, objref, file_id : int, path_id : int):
if path_id == 0:
return None
manager = None
if file_id == 0:
manager = objref.assets_file
elif file_id > 0 and file_id - 1 < len(objref.assets_file.externals):
external_name = objref.assets_file.externals[file_id - 1].name
parent = objref.assets_file.parent
if parent is not None:
if external_name not in parent.files:
external_name = external_name.upper()
if external_name in parent.files:
manager = parent.files[external_name]
else:
if external_name not in env.files:
typ, reader = ImportHelper.check_file_type(external_name)
if typ == FileType.AssetsFile:
env.files[external_name] = files.SerializedFile(reader)
if external_name in env.files:
manager = env.files[external_name]
if manager and path_id in manager.objects:
return manager.objects[path_id]
return None
So pretty much what the PPtr class does but from a setting outside of UnityPy.
from unitypy.
Related Issues (20)
- Reading typetree error: Can't read 4 bytes at position 32 of 32 HOT 1
- Unable to load APK files directly HOT 1
- Flip operation for packed sprite are reversed
- Load dependencies with sensitive paths HOT 2
- Crashes when reading RGB24 Texture2D HOT 2
- Segmentation fault when unpacking DXT5Crunched texture HOT 5
- wishlist: support "bundle"/"bank"? HOT 1
- AudioClip can not be exported. What does the FmodError : MEMORY mean?? HOT 2
- Is Windows SDK required for installing UnityPy? HOT 3
- Please add support for Texture2DArray
- Texture2D 2022.2 bug HOT 6
- error when exporting mesh_renderer
- Saving files bigger than 4GB HOT 2
- Edit Texture2D make file corrupted HOT 9
- .save_typetree() MonoBehaviour function not working.
- `env.objects == []` & `env.container.items() == dict_items([])` HOT 1
- Exception occurred when exporting Texture2D
- The container attribute of the file cannot be read correctly
- Can't load Unity 4.7.2f1 files while AssetStudio does.
- Bug withTexture2DConverter
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 unitypy.