diff options
| author | Juan Linietsky | 2014-04-14 22:43:44 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2014-04-14 22:43:44 -0300 |
| commit | ec4ef2d2e794819548d731f93728266d31261d71 (patch) | |
| tree | 6c2940a9029d07a22288c93684dac19cc39de7ed /core | |
| parent | 162d2ebe4f1a6da2da62ad45c4cbfb161157d31d (diff) | |
| download | godot-ec4ef2d2e794819548d731f93728266d31261d71.tar.gz godot-ec4ef2d2e794819548d731f93728266d31261d71.tar.zst godot-ec4ef2d2e794819548d731f93728266d31261d71.zip | |
-Added google play services (needed for some stuff)
-Added new screen resizing options, stretch_2d is removed, new much more flexible ones.
-Fixed bug in viewport (can create more instances in 3d-in-2d demo now)
-Can set android permissions and screen sizes manually in the export settings
-Changed export templates extension to .tpz (too many people unzipped the manually..)
-File dialog now ensures that the proper extension is used (will not allow to save without it)
-Fixed bug that made collision exceptions not work in 2D
Diffstat (limited to 'core')
| -rw-r--r-- | core/bind/core_bind.cpp | 43 | ||||
| -rw-r--r-- | core/bind/core_bind.h | 4 |
2 files changed, 47 insertions, 0 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index e3360a23d..fd6a91d12 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -4,6 +4,7 @@ #include "io/marshalls.h" #include "io/base64.h" #include "core/globals.h" +#include "io/file_access_encrypted.h" _ResourceLoader *_ResourceLoader::singleton=NULL; @@ -812,6 +813,44 @@ _Geometry::_Geometry() { ///////////////////////// FILE + +Error _File::open_encrypted(const String& p_path, int p_mode_flags,const Vector<uint8_t>& p_key) { + + Error err = open(p_path,p_mode_flags); + if (err) + return err; + + FileAccessEncrypted *fae = memnew( FileAccessEncrypted ); + err = fae->open_and_parse(f,p_key,(p_mode_flags==WRITE)?FileAccessEncrypted::MODE_WRITE_AES256:FileAccessEncrypted::MODE_READ); + if (err) { + memdelete(fae); + close(); + return err; + } + f=fae; + return OK; +} + +Error _File::open_encrypted_pass(const String& p_path, int p_mode_flags,const String& p_pass) { + + Error err = open(p_path,p_mode_flags); + if (err) + return err; + + FileAccessEncrypted *fae = memnew( FileAccessEncrypted ); + err = fae->open_and_parse_password(f,p_pass,(p_mode_flags==WRITE)?FileAccessEncrypted::MODE_WRITE_AES256:FileAccessEncrypted::MODE_READ); + if (err) { + memdelete(fae); + close(); + return err; + } + + f=fae; + return OK; + +} + + Error _File::open(const String& p_path, int p_mode_flags) { close(); @@ -1113,6 +1152,10 @@ Variant _File::get_var() const { void _File::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("open_encrypted","path","mode_flags","key"),&_File::open_encrypted); + ObjectTypeDB::bind_method(_MD("open_encrypted_with_pass","path","mode_flags","pass"),&_File::open_encrypted_pass); + ObjectTypeDB::bind_method(_MD("open","path","flags"),&_File::open); ObjectTypeDB::bind_method(_MD("close"),&_File::close); ObjectTypeDB::bind_method(_MD("is_open"),&_File::is_open); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 008472654..f5c94dcf0 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -243,6 +243,10 @@ public: READ_WRITE=3, }; + Error open_encrypted(const String& p_path, int p_mode_flags,const Vector<uint8_t>& p_key); + Error open_encrypted_pass(const String& p_path, int p_mode_flags,const String& p_pass); + + Error open(const String& p_path, int p_mode_flags); ///< open a file void close(); ///< close a file bool is_open() const; ///< true when file is open |
