Comments (3)
I do want to write an explanation of how the PCK and resources are created at some point. The script “compilation” is pretty simple; all the tokens (excepting comments, but including white space) are just converted into binary numbers and just concatenated together, which is why it’s fairly trivial to recover the original scripts. The hard part is just knowing which version of the byte code it’s using.
ther’s a description of the contents of the PCK here as well: https://github.com/Bioruebe/godotdec
from gdsdecomp.
@nikitalita Looking foward to that explanation!
How exactly gdscript tokens converted into binary numbers? I've looked at /modules/gdscript/gdscript_tokenizer.cpp and saw array of token_names, did they just saved by their index number in array? And what about numbers and characters?
I also wonder why tscn scene files are packed as plain text in pck, I know there is an option to convert_text_resources_to_binary_on_export but it's off by default in 3.x, is there is any problem with that? Is tscn tokenized the same way as gdscripts? I know that Unity uses YAML for scene files and then somehow converts that to binary as well, but I'm wondering how Godot is doing that.
There is also no info about any internal Godot formats from .import folder such as stex, scn. And why all fbx/obj/glb mesh is converted to scn in .import? I thought scn was a binary scene format converted from tscn only.
In 4.x it's .ctex and .mesh, if there is any info about any of that please share!
from gdsdecomp.
How exactly gdscript tokens converted into binary numbers? I've looked at /modules/gdscript/gdscript_tokenizer.cpp and saw array of token_names, did they just saved by their index number in array? And what about numbers and characters?
Yup, they're stored as just index numbers. For values and strings, they're just stored inline; Variant type number, and then value/string. For details, check out https://github.com/bruvzg/gdsdecomp/blob/master/compat/variant_decoder_compat.cpp .
GDScript is entirely interpreted, there's no real "compiliation" going on, just a conversion to bytecode that is interpreted the same way as text.
I also wonder why tscn scene files are packed as plain text in pck, I know there is an option to convert_text_resources_to_binary_on_export but it's off by default in 3.x, is there is any problem with that? Is tscn tokenized the same way as gdscripts? I know that Unity uses YAML for scene files and then somehow converts that to binary as well, but I'm wondering how Godot is doing that.
Conversion of text scenes to binary was broken a while back and they couldn't be bothered to fix it. I submitted a PR to fix it a few months ago.
There is also no info about any internal Godot formats from .import folder such as stex, scn. And why all fbx/obj/glb mesh is converted to scn in .import? I thought scn was a binary scene format converted from tscn only.
All imported formats are converted to Godot resources upon import; FBX/OBJ/GLB formats describe 3d scenes, so they are converted into Godot scenes upon import. It doesn't really matter if they are stored in binary or text, but binary takes up far less space, and it's likely that imported models/scenes will be rather hefty, is my guess.
In 4.x it's .ctex and .mesh, if there is any info about any of that please share!
They just changed the way the format is stored. I didn't pay attention much to the changes for textures, I just backported the texture loading from v3, but you can compare the way that we load images for v3 textures vs. v4 here: https://github.com/bruvzg/gdsdecomp/blob/master/compat/texture_loader_compat.cpp#L83
from gdsdecomp.
Related Issues (20)
- Recursively decompile .GDC files
- Failed to recover pck in 0.5.3 and failed to decompile .gde file HOT 1
- Conversion of Resource of type AudioStreamOggVorbis not implemented HOT 10
- Can't restore ctex png files? HOT 1
- Conversion for Resource of type FontFile and format ttf not implemented
- Decompiled game cannot be compiled again HOT 2
- Extremely small UI for Mac HOT 1
- Decompression not implemented yet for texture format BPTC_RGBA (png) HOT 1
- Godot says "Load failed due to missing dependencies: <Path to code.gd>", but code can be opened in any text editor HOT 1
- @export annotations to nodes/arrays in Godot 4.1.1 game (Buckshot Roulette) export do not work correctly HOT 1
- Arrays are all empty HOT 1
- If I write with c++ in Godot engine, can that be reversed too? HOT 4
- Error: Couldn't load project data at path ".". Is the .pck file missing? HOT 1
- Deleted HOT 3
- How to compile decompiled project HOT 1
- ObjectDB instances leaked at exit HOT 2
- Error when decompiling gde files HOT 2
- godot 2.1.7 looks like not support HOT 5
- Add support for 4.x compiled scripts
- Exporting Buckshot Roulette v1.2.2, getting weird issue when exporting. HOT 2
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 gdsdecomp.