summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/SCsub4
-rw-r--r--core/bind/core_bind.cpp2
-rw-r--r--core/global_config.cpp (renamed from core/globals.cpp)137
-rw-r--r--core/global_config.h (renamed from core/globals.h)4
-rw-r--r--core/input_map.cpp2
-rw-r--r--core/io/file_access_memory.cpp2
-rw-r--r--core/io/file_access_network.cpp2
-rw-r--r--core/io/file_access_pack.cpp6
-rw-r--r--core/io/packet_peer.cpp2
-rw-r--r--core/io/resource_format_binary.cpp2
-rw-r--r--core/io/resource_loader.cpp2
-rw-r--r--core/io/resource_saver.cpp2
-rw-r--r--core/message_queue.cpp2
-rw-r--r--core/os/dir_access.cpp2
-rw-r--r--core/os/file_access.cpp2
-rw-r--r--core/os/input.cpp2
-rw-r--r--core/os/os.cpp2
-rw-r--r--core/register_core_types.cpp2
-rw-r--r--core/script_debugger_remote.cpp2
-rw-r--r--core/translation.cpp2
-rw-r--r--core/ustring.cpp32
-rw-r--r--core/ustring.h2
-rw-r--r--drivers/alsa/audio_driver_alsa.cpp2
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp2
-rw-r--r--drivers/gles3/rasterizer_gles3.cpp2
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp2
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp2
-rw-r--r--drivers/png/resource_saver_png.cpp2
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp2
-rw-r--r--drivers/rtaudio/audio_driver_rtaudio.cpp2
-rw-r--r--drivers/unix/os_unix.cpp2
-rw-r--r--drivers/xaudio2/audio_driver_xaudio2.cpp2
-rw-r--r--main/main.cpp2
-rw-r--r--main/tests/test_io.cpp2
-rw-r--r--modules/gdscript/gd_editor.cpp2
-rw-r--r--modules/gdscript/gd_script.cpp2
-rw-r--r--modules/openssl/stream_peer_openssl.h2
-rw-r--r--modules/theora/video_stream_theora.cpp2
-rw-r--r--modules/visual_script/visual_script.cpp2
-rw-r--r--modules/visual_script/visual_script_flow_control.cpp2
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp2
-rw-r--r--modules/visual_script/visual_script_nodes.cpp2
-rw-r--r--modules/webm/video_stream_webm.cpp2
-rw-r--r--platform/android/audio_driver_jandroid.cpp2
-rw-r--r--platform/android/export/export.cpp2
-rw-r--r--platform/android/globals/global_defaults.cpp2
-rw-r--r--platform/android/java_glue.cpp2
-rw-r--r--platform/android/os_android.cpp2
-rw-r--r--platform/bb10/export/export.cpp2
-rw-r--r--platform/bb10/os_bb10.cpp2
-rw-r--r--platform/iphone/app_delegate.mm2
-rwxr-xr-xplatform/iphone/gl_view.mm2
-rwxr-xr-xplatform/iphone/globals/global_defaults.cpp2
-rw-r--r--platform/javascript/export/export.cpp2
-rw-r--r--platform/javascript/javascript_main.cpp5
-rw-r--r--platform/javascript/os_javascript.cpp2
-rw-r--r--platform/osx/export/export.cpp2
-rw-r--r--platform/uwp/os_uwp.cpp2
-rw-r--r--platform/windows/os_windows.cpp2
-rw-r--r--scene/3d/light.cpp2
-rw-r--r--scene/3d/portal.cpp2
-rw-r--r--scene/3d/room_instance.cpp2
-rw-r--r--scene/3d/skeleton.cpp2
-rw-r--r--scene/gui/control.cpp2
-rw-r--r--scene/gui/item_list.cpp2
-rw-r--r--scene/gui/label.cpp2
-rw-r--r--scene/gui/text_edit.cpp2
-rw-r--r--scene/gui/tree.cpp2
-rw-r--r--scene/main/node.h2
-rw-r--r--scene/main/scene_main_loop.cpp2
-rw-r--r--scene/main/viewport.cpp2
-rw-r--r--scene/register_scene_types.cpp2
-rw-r--r--scene/resources/audio_stream_resampled.cpp2
-rw-r--r--scene/resources/environment.cpp2
-rw-r--r--scene/resources/packed_scene.cpp2
-rw-r--r--scene/resources/scene_format_text.cpp2
-rw-r--r--scene/resources/world_2d.cpp4
-rw-r--r--scene/resources/world_2d.h2
-rw-r--r--servers/audio/audio_driver_dummy.cpp2
-rw-r--r--servers/audio_server.cpp2
-rw-r--r--servers/physics/space_sw.cpp2
-rw-r--r--servers/physics/space_sw.h2
-rw-r--r--servers/physics_2d/broad_phase_2d_hash_grid.cpp2
-rw-r--r--servers/physics_2d/physics_2d_server_sw.cpp2
-rw-r--r--servers/physics_2d/physics_2d_server_wrap_mt.h2
-rw-r--r--servers/physics_2d/space_2d_sw.h2
-rw-r--r--servers/register_server_types.cpp2
-rw-r--r--servers/visual/visual_server_raster.cpp2
-rw-r--r--servers/visual/visual_server_viewport.cpp2
-rw-r--r--servers/visual_server.cpp2
-rw-r--r--tools/editor/collada/collada.h2
-rw-r--r--tools/editor/doc/doc_data.cpp2
-rw-r--r--tools/editor/editor_autoload_settings.cpp2
-rw-r--r--tools/editor/editor_data.cpp2
-rw-r--r--tools/editor/editor_export.cpp284
-rw-r--r--tools/editor/editor_export.h18
-rw-r--r--tools/editor/editor_file_system.cpp2
-rw-r--r--tools/editor/editor_node.cpp2
-rw-r--r--tools/editor/editor_plugin_settings.cpp2
-rw-r--r--tools/editor/editor_resource_preview.cpp2
-rw-r--r--tools/editor/editor_run.cpp2
-rw-r--r--tools/editor/editor_settings.cpp2
-rw-r--r--tools/editor/file_type_cache.cpp2
-rw-r--r--tools/editor/filesystem_dock.cpp2
-rw-r--r--tools/editor/plugins/animation_player_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/animation_tree_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/resource_preloader_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/sprite_frames_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/texture_editor_plugin.cpp2
-rw-r--r--tools/editor/project_export.cpp46
-rw-r--r--tools/editor/project_export.h6
-rw-r--r--tools/editor/project_settings.cpp2
-rw-r--r--tools/editor/property_editor.cpp4
-rw-r--r--tools/editor/resources_dock.cpp2
-rw-r--r--tools/editor/scene_tree_dock.cpp2
-rw-r--r--tools/editor/script_create_dialog.cpp2
-rw-r--r--tools/editor/script_editor_debugger.cpp2
-rw-r--r--tools/editor/settings_config_dialog.cpp2
121 files changed, 542 insertions, 226 deletions
diff --git a/core/SCsub b/core/SCsub
index 8d89f6427b..a9721a1052 100644
--- a/core/SCsub
+++ b/core/SCsub
@@ -13,7 +13,7 @@ for x in env.global_defaults:
gd_inc += '#include "platform/' + x + '/globals/global_defaults.h"\n'
gd_call += "\tregister_" + x + "_global_defaults();\n"
-gd_cpp = '#include "globals.h"\n'
+gd_cpp = '#include "global_config.h"\n'
gd_cpp += gd_inc
gd_cpp += "void GlobalConfig::register_global_defaults() {\n" + gd_call + "\n}\n"
@@ -45,7 +45,7 @@ if ("SCRIPT_AES256_ENCRYPTION_KEY" in os.environ):
print("Invalid AES256 encryption key, not 64 bits hex: " + e)
f = open("script_encryption_key.cpp", "wb")
-f.write("#include \"globals.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n")
+f.write("#include \"global_config.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n")
f.close()
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 7bd652349d..54ab51657b 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -31,7 +31,7 @@
#include "geometry.h"
#include "io/marshalls.h"
#include "io/base64.h"
-#include "core/globals.h"
+#include "core/global_config.h"
#include "io/file_access_encrypted.h"
#include "os/keyboard.h"
diff --git a/core/globals.cpp b/core/global_config.cpp
index 0c35a9f89a..b76991c04e 100644
--- a/core/globals.cpp
+++ b/core/global_config.cpp
@@ -26,7 +26,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "globals.h"
+#include "global_config.h"
#include "os/dir_access.h"
#include "os/file_access.h"
@@ -247,9 +247,22 @@ bool GlobalConfig::_load_resource_pack(const String& p_pack) {
Error GlobalConfig::setup(const String& p_path,const String & p_main_pack) {
- //an absolute mess of a function, must be cleaned up and reorganized somehow at some point
+ //If looking for files in network, just use network!
- //_load_settings(p_path+"/override.cfg");
+ if (FileAccessNetworkClient::get_singleton()) {
+
+ if (_load_settings("res://godot.cfg")==OK || _load_settings_binary("res://godot.cfb")==OK) {
+
+ _load_settings("res://override.cfg");
+
+ }
+
+ return OK;
+ }
+
+ String exec_path = OS::get_singleton()->get_executable_path();
+
+ //Attempt with a passed main pack first
if (p_main_pack!="") {
@@ -257,8 +270,8 @@ Error GlobalConfig::setup(const String& p_path,const String & p_main_pack) {
ERR_FAIL_COND_V(!ok,ERR_CANT_OPEN);
if (_load_settings("res://godot.cfg")==OK || _load_settings_binary("res://godot.cfb")==OK) {
-
- _load_settings("res://override.cfg");
+ //load override from location of the main pack
+ _load_settings(p_main_pack.get_base_dir().plus_file("override.cfg"));
}
@@ -266,21 +279,15 @@ Error GlobalConfig::setup(const String& p_path,const String & p_main_pack) {
}
- if (OS::get_singleton()->get_executable_path()!="") {
+ //Attempt with execname.pck
+ if (exec_path!="") {
- if (_load_resource_pack(OS::get_singleton()->get_executable_path())) {
- if (p_path!="") {
- resource_path=p_path;
- } else {
- DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
- resource_path=d->get_current_dir();
- memdelete(d);
+ if (_load_resource_pack(exec_path.get_basename()+".pck")) {
- }
if (_load_settings("res://godot.cfg")==OK || _load_settings_binary("res://godot.cfb")==OK) {
-
- _load_settings("res://override.cfg");
+ //load override from location of executable
+ _load_settings(exec_path.get_base_dir().plus_file("override.cfg"));
}
@@ -292,31 +299,19 @@ Error GlobalConfig::setup(const String& p_path,const String & p_main_pack) {
}
- if (FileAccessNetworkClient::get_singleton()) {
-
- if (_load_settings("res://godot.cfg")==OK || _load_settings_binary("res://godot.cfb")==OK) {
-
- _load_settings("res://override.cfg");
-
- }
-
- return OK;
- }
-
+ //Try to use the filesystem for files, according to OS. (only Android -when reading from pck- and iOS use this)
if (OS::get_singleton()->get_resource_dir()!="") {
- //OS will call Globals->get_resource_path which will be empty if not overriden!
+ //OS will call Globals->get_resource_path which will be empty if not overriden!
//if the OS would rather use somewhere else, then it will not be empty.
+
resource_path=OS::get_singleton()->get_resource_dir().replace("\\","/");
if (resource_path.length() && resource_path[ resource_path.length()-1]=='/')
resource_path=resource_path.substr(0,resource_path.length()-1); // chop end
- print_line("has res dir: "+resource_path);
- if (!_load_resource_pack("res://data.pck"))
- _load_resource_pack("res://data.zip");
- // make sure this is load from the resource path
- print_line("exists engine cfg? "+itos(FileAccess::exists("/godot.cfg")));
+ // data.pck and data.zip are deprecated and no longer supported, apologies.
+ // make sure this is loaded from the resource path
+
if (_load_settings("res://godot.cfg")==OK || _load_settings_binary("res://godot.cfb")==OK) {
- print_line("loaded godot.cfg");
_load_settings("res://override.cfg");
}
@@ -324,67 +319,41 @@ Error GlobalConfig::setup(const String& p_path,const String & p_main_pack) {
return OK;
}
- DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
- if (!d) {
-
- resource_path = p_path;
-
- } else {
-
- d->change_dir(p_path);
-
- String candidate = d->get_current_dir();
- String current_dir = d->get_current_dir();
- String exec_name = OS::get_singleton()->get_executable_path().get_file().get_basename();
- bool found = false;
- bool first_time=true;
-
- while(true) {
- //try to load settings in ascending through dirs shape!
-
- //tries to open pack, but only first time
- if (first_time && (_load_resource_pack(current_dir+"/"+exec_name+".pck") || _load_resource_pack(current_dir+"/"+exec_name+".zip") )) {
- if (_load_settings("res://godot.cfg")==OK || _load_settings_binary("res://godot.cfb")==OK) {
+ //Nothing was found, try to find a godot.cfg somewhere!
- _load_settings("res://override.cfg");
- found=true;
-
-
- }
- break;
- } else if (first_time && (_load_resource_pack(current_dir+"/data.pck") || _load_resource_pack(current_dir+"/data.zip") )) {
- if (_load_settings("res://godot.cfg")==OK || _load_settings_binary("res://godot.cfb")==OK) {
+ DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ ERR_FAIL_COND_V(!d,ERR_CANT_CREATE);
- _load_settings("res://override.cfg");
- found=true;
+ d->change_dir(p_path);
+ String candidate = d->get_current_dir();
+ String current_dir = d->get_current_dir();
+ bool found = false;
- }
- break;
- } else if (_load_settings(current_dir+"/godot.cfg")==OK || _load_settings_binary(current_dir+"/godot.cfb")==OK) {
+ while(true) {
+ //try to load settings in ascending through dirs shape!
- _load_settings(current_dir+"/override.cfg");
- candidate=current_dir;
- found=true;
- break;
- }
+ if (_load_settings(current_dir+"/godot.cfg")==OK || _load_settings_binary(current_dir+"/godot.cfb")==OK) {
- d->change_dir("..");
- if (d->get_current_dir()==current_dir)
- break; //not doing anything useful
- current_dir=d->get_current_dir();
- first_time=false;
+ _load_settings(current_dir+"/override.cfg");
+ candidate=current_dir;
+ found=true;
+ break;
}
+ d->change_dir("..");
+ if (d->get_current_dir()==current_dir)
+ break; //not doing anything useful
+ current_dir=d->get_current_dir();
+ }
- resource_path=candidate;
- resource_path = resource_path.replace("\\","/"); // windows path to unix path just in case
- memdelete(d);
- if (!found)
- return ERR_FILE_NOT_FOUND;
- };
+ resource_path=candidate;
+ resource_path = resource_path.replace("\\","/"); // windows path to unix path just in case
+ memdelete(d);
+ if (!found)
+ return ERR_FILE_NOT_FOUND;
if (resource_path.length() && resource_path[ resource_path.length()-1]=='/')
resource_path=resource_path.substr(0,resource_path.length()-1); // chop end
diff --git a/core/globals.h b/core/global_config.h
index faf077f2a5..471f1ff885 100644
--- a/core/globals.h
+++ b/core/global_config.h
@@ -26,8 +26,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef GLOBALS_H
-#define GLOBALS_H
+#ifndef GLOBAL_CONFIG_H
+#define GLOBAL_CONFIG_H
#include "object.h"
#include "set.h"
diff --git a/core/input_map.cpp b/core/input_map.cpp
index 249c75cea0..444c55cac6 100644
--- a/core/input_map.cpp
+++ b/core/input_map.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "input_map.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/keyboard.h"
InputMap *InputMap::singleton=NULL;
diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp
index 32eb003228..b4ba14ddc9 100644
--- a/core/io/file_access_memory.cpp
+++ b/core/io/file_access_memory.cpp
@@ -30,7 +30,7 @@
#include "os/dir_access.h"
#include "os/copymem.h"
-#include "globals.h"
+#include "global_config.h"
#include "map.h"
static Map<String, Vector<uint8_t> >* files = NULL;
diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp
index 7bf750f6e1..d9fdc9cedc 100644
--- a/core/io/file_access_network.cpp
+++ b/core/io/file_access_network.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "file_access_network.h"
#include "marshalls.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/os.h"
#include "io/ip.h"
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index d63539a7a5..fa1bebde16 100644
--- a/core/io/file_access_pack.cpp
+++ b/core/io/file_access_pack.cpp
@@ -31,7 +31,7 @@
#include <stdio.h>
-#define PACK_VERSION 0
+#define PACK_VERSION 1
Error PackedData::add_pack(const String& p_path) {
@@ -167,8 +167,8 @@ bool PackedSourcePCK::try_open_pack(const String& p_path) {
uint32_t ver_minor = f->get_32();
uint32_t ver_rev = f->get_32();
- ERR_EXPLAIN("Pack version newer than supported by engine: "+itos(version));
- ERR_FAIL_COND_V( version > PACK_VERSION, ERR_INVALID_DATA);
+ ERR_EXPLAIN("Pack version unsupported: "+itos(version));
+ ERR_FAIL_COND_V( version != PACK_VERSION, ERR_INVALID_DATA);
ERR_EXPLAIN("Pack created with a newer version of the engine: "+itos(ver_major)+"."+itos(ver_minor)+"."+itos(ver_rev));
ERR_FAIL_COND_V( ver_major > VERSION_MAJOR || (ver_major == VERSION_MAJOR && ver_minor > VERSION_MINOR), ERR_INVALID_DATA);
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index aca095b6a5..cf5883121f 100644
--- a/core/io/packet_peer.cpp
+++ b/core/io/packet_peer.cpp
@@ -29,7 +29,7 @@
#include "packet_peer.h"
#include "io/marshalls.h"
-#include "globals.h"
+#include "global_config.h"
/* helpers / binders */
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 2c02dbcc9b..2d733842fa 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "version.h"
#include "resource_format_binary.h"
-#include "globals.h"
+#include "global_config.h"
#include "io/file_access_compressed.h"
#include "io/marshalls.h"
#include "os/dir_access.h"
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index b6d28bccfa..c14389eefa 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "resource_loader.h"
#include "print_string.h"
-#include "globals.h"
+#include "global_config.h"
#include "path_remap.h"
#include "os/file_access.h"
#include "os/os.h"
diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp
index 222d3e6bc0..f0bea30051 100644
--- a/core/io/resource_saver.cpp
+++ b/core/io/resource_saver.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "resource_saver.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/file_access.h"
#include "script_language.h"
#include "resource_loader.h"
diff --git a/core/message_queue.cpp b/core/message_queue.cpp
index 668d321e05..50b52e4970 100644
--- a/core/message_queue.cpp
+++ b/core/message_queue.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "message_queue.h"
-#include "globals.h"
+#include "global_config.h"
#include "script_language.h"
MessageQueue *MessageQueue::singleton=NULL;
diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp
index 804fe15c39..974225a3e8 100644
--- a/core/os/dir_access.cpp
+++ b/core/os/dir_access.cpp
@@ -30,7 +30,7 @@
#include "os/file_access.h"
#include "os/memory.h"
#include "os/os.h"
-#include "globals.h"
+#include "global_config.h"
String DirAccess::_get_root_path() const {
diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp
index 06723c5131..ae592720e8 100644
--- a/core/os/file_access.cpp
+++ b/core/os/file_access.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "file_access.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/os.h"
#include "core/io/marshalls.h"
#include "io/md5.h"
diff --git a/core/os/input.cpp b/core/os/input.cpp
index e20c966ff2..34883e63ba 100644
--- a/core/os/input.cpp
+++ b/core/os/input.cpp
@@ -29,7 +29,7 @@
#include "input.h"
#include "input_map.h"
#include "os/os.h"
-#include "globals.h"
+#include "global_config.h"
Input *Input::singleton=NULL;
Input *Input::get_singleton() {
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 3a8e15a692..912f7f0b0f 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -29,7 +29,7 @@
#include "os.h"
#include "dir_access.h"
-#include "globals.h"
+#include "global_config.h"
#include "input.h"
#include "os/file_access.h"
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index ab94b56cdc..00f6f8662f 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -35,7 +35,7 @@
#include "io/packet_peer.h"
#include "math/a_star.h"
#include "math/triangle_mesh.h"
-#include "globals.h"
+#include "global_config.h"
#include "class_db.h"
#include "geometry.h"
#include "bind/core_bind.h"
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp
index 62d14c4e5a..b14eb51b6c 100644
--- a/core/script_debugger_remote.cpp
+++ b/core/script_debugger_remote.cpp
@@ -30,7 +30,7 @@
#include "os/os.h"
#include "io/ip.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/input.h"
void ScriptDebuggerRemote::_send_video_memory() {
diff --git a/core/translation.cpp b/core/translation.cpp
index 655bfd36b8..d9d4fe7784 100644
--- a/core/translation.cpp
+++ b/core/translation.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "translation.h"
-#include "globals.h"
+#include "global_config.h"
#include "io/resource_loader.h"
#include "os/os.h"
diff --git a/core/ustring.cpp b/core/ustring.cpp
index a0d26ea0af..c13c13ec11 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -52,8 +52,40 @@
#define UPPERCASE(m_c) (((m_c)>='a' && (m_c)<='z')?((m_c)-('a'-'A')):(m_c))
#define LOWERCASE(m_c) (((m_c)>='A' && (m_c)<='Z')?((m_c)+('a'-'A')):(m_c))
+
+
+
/** STRING **/
+bool CharString::operator<(const CharString& p_right) const {
+
+ if (length()==0) {
+ return p_right.length()!=0;
+ }
+
+
+ const char *this_str=get_data();
+ const char *that_str=get_data();
+ while (true) {
+
+ if (*that_str==0 && *this_str==0)
+ return false; //this can't be equal, sadly
+ else if (*this_str==0)
+ return true; //if this is empty, and the other one is not, then we're less.. I think?
+ else if (*that_str==0)
+ return false; //otherwise the other one is smaller..
+ else if (*this_str < *that_str ) //more than
+ return true;
+ else if (*this_str > *that_str ) //less than
+ return false;
+
+ this_str++;
+ that_str++;
+ }
+
+ return false; //should never reach here anyway
+}
+
const char *CharString::get_data() const {
if (size())
diff --git a/core/ustring.h b/core/ustring.h
index 5665a23112..87289f9e16 100644
--- a/core/ustring.h
+++ b/core/ustring.h
@@ -41,6 +41,8 @@
class CharString : public Vector<char> {
public:
+
+ bool operator<(const CharString& p_right) const;
int length() const { return size() ? size()-1 : 0; }
const char *get_data() const;
operator const char*() {return get_data();};
diff --git a/drivers/alsa/audio_driver_alsa.cpp b/drivers/alsa/audio_driver_alsa.cpp
index 8984d412a3..f2616b11b8 100644
--- a/drivers/alsa/audio_driver_alsa.cpp
+++ b/drivers/alsa/audio_driver_alsa.cpp
@@ -30,7 +30,7 @@
#ifdef ALSA_ENABLED
-#include "globals.h"
+#include "global_config.h"
#include <errno.h>
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index 1486e85a04..94c5ecdec1 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -30,7 +30,7 @@
#include "rasterizer_gles2.h"
#include "os/os.h"
-#include "globals.h"
+#include "global_config.h"
#include <stdio.h>
#include "servers/visual/shader_language.h"
#include "servers/visual/particle_system_sw.h"
diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp
index eb58759c47..aea4642d88 100644
--- a/drivers/gles3/rasterizer_gles3.cpp
+++ b/drivers/gles3/rasterizer_gles3.cpp
@@ -1,6 +1,6 @@
#include "rasterizer_gles3.h"
#include "os/os.h"
-#include "globals.h"
+#include "global_config.h"
#include "gl_context/context_gl.h"
#include <string.h>
RasterizerStorage *RasterizerGLES3::get_storage() {
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index bbbe9351ec..ceb6bc336d 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -1,5 +1,5 @@
#include "rasterizer_scene_gles3.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/os.h"
#include "rasterizer_canvas_gles3.h"
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 6ae7ef86c4..ac8bf8c262 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -1,7 +1,7 @@
#include "rasterizer_storage_gles3.h"
#include "rasterizer_canvas_gles3.h"
#include "rasterizer_scene_gles3.h"
-#include "globals.h"
+#include "global_config.h"
/* TEXTURE API */
diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp
index a9a199bb59..f55b089ded 100644
--- a/drivers/png/resource_saver_png.cpp
+++ b/drivers/png/resource_saver_png.cpp
@@ -29,7 +29,7 @@
#include "resource_saver_png.h"
#include "core/image.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/file_access.h"
#include "scene/resources/texture.h"
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index 5f0e647545..f5268f3ebd 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -32,7 +32,7 @@
#include <pulse/error.h>
-#include "globals.h"
+#include "global_config.h"
Error AudioDriverPulseAudio::init() {
diff --git a/drivers/rtaudio/audio_driver_rtaudio.cpp b/drivers/rtaudio/audio_driver_rtaudio.cpp
index 6ada0aaa68..cc715545bd 100644
--- a/drivers/rtaudio/audio_driver_rtaudio.cpp
+++ b/drivers/rtaudio/audio_driver_rtaudio.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "audio_driver_rtaudio.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/os.h"
#ifdef RTAUDIO_ENABLED
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index edf5f22714..fe49501328 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -61,7 +61,7 @@
#include <poll.h>
#include <errno.h>
#include <assert.h>
-#include "globals.h"
+#include "global_config.h"
extern bool _print_error_enabled;
diff --git a/drivers/xaudio2/audio_driver_xaudio2.cpp b/drivers/xaudio2/audio_driver_xaudio2.cpp
index fa55c97325..cd61fefd91 100644
--- a/drivers/xaudio2/audio_driver_xaudio2.cpp
+++ b/drivers/xaudio2/audio_driver_xaudio2.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "audio_driver_xaudio2.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/os.h"
const char * AudioDriverXAudio2::get_name() const
diff --git a/main/main.cpp b/main/main.cpp
index 21a839a25f..9be77c31b6 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "main.h"
#include "os/os.h"
-#include "globals.h"
+#include "global_config.h"
#include "splash.h"
#include "core/register_core_types.h"
#include "scene/register_scene_types.h"
diff --git a/main/tests/test_io.cpp b/main/tests/test_io.cpp
index 42664e73cd..23459c68d1 100644
--- a/main/tests/test_io.cpp
+++ b/main/tests/test_io.cpp
@@ -39,7 +39,7 @@
#include "io/resource_loader.h"
#include "io/resource_saver.h"
#include "os/dir_access.h"
-#include "core/globals.h"
+#include "core/global_config.h"
#include "io/file_access_memory.h"
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp
index 114a25feeb..f325aec072 100644
--- a/modules/gdscript/gd_editor.cpp
+++ b/modules/gdscript/gd_editor.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "gd_script.h"
#include "gd_compiler.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/file_access.h"
void GDScriptLanguage::get_comment_delimiters(List<String> *p_delimiters) const {
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index 167ede4853..d4646aa36d 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "gd_script.h"
-#include "globals.h"
+#include "global_config.h"
#include "global_constants.h"
#include "gd_compiler.h"
#include "os/file_access.h"
diff --git a/modules/openssl/stream_peer_openssl.h b/modules/openssl/stream_peer_openssl.h
index 3d6875698c..84ae03fe07 100644
--- a/modules/openssl/stream_peer_openssl.h
+++ b/modules/openssl/stream_peer_openssl.h
@@ -31,7 +31,7 @@
#include <stdio.h> // If you don't know what this is for stop reading now.
#include "io/stream_peer_ssl.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/file_access.h"
#include "curl_hostcheck.h"
diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp
index 9d2dfc7f56..2a7b2707bf 100644
--- a/modules/theora/video_stream_theora.cpp
+++ b/modules/theora/video_stream_theora.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "video_stream_theora.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/os.h"
#include "yuv2rgb.h"
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index ec09335b7d..6941ed5486 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -2,7 +2,7 @@
#include "visual_script_nodes.h"
#include "scene/main/node.h"
#include "os/os.h"
-#include "globals.h"
+#include "global_config.h"
diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp
index d2781c6dcc..93e395f0f2 100644
--- a/modules/visual_script/visual_script_flow_control.cpp
+++ b/modules/visual_script/visual_script_flow_control.cpp
@@ -1,6 +1,6 @@
#include "visual_script_flow_control.h"
#include "os/keyboard.h"
-#include "globals.h"
+#include "global_config.h"
//////////////////////////////////////////
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index 5c8f52ebb1..fd91385f9c 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -4,7 +4,7 @@
#include "scene/main/node.h"
#include "visual_script_nodes.h"
#include "io/resource_loader.h"
-#include "globals.h"
+#include "global_config.h"
//////////////////////////////////////////
////////////////CALL//////////////////////
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index 2b5a180bbe..d1ee5be378 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -1,6 +1,6 @@
#include "visual_script_nodes.h"
#include "global_constants.h"
-#include "globals.h"
+#include "global_config.h"
#include "scene/main/scene_main_loop.h"
#include "os/os.h"
#include "scene/main/node.h"
diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp
index bdd97f1df7..d4995ad798 100644
--- a/modules/webm/video_stream_webm.cpp
+++ b/modules/webm/video_stream_webm.cpp
@@ -35,7 +35,7 @@
#include "../theora/yuv2rgb.h"
#include "os/file_access.h"
-#include "globals.h"
+#include "global_config.h"
#include <string.h>
diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp
index e0e89e6344..415223c1da 100644
--- a/platform/android/audio_driver_jandroid.cpp
+++ b/platform/android/audio_driver_jandroid.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "audio_driver_jandroid.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/os.h"
#include "thread_jandroid.h"
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 4fc318d4ae..1d1ee25622 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -33,7 +33,7 @@
#include "tools/editor/editor_node.h"
#include "io/zip_io.h"
#include "io/marshalls.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/file_access.h"
#include "os/os.h"
#include "platform/android/logo.h"
diff --git a/platform/android/globals/global_defaults.cpp b/platform/android/globals/global_defaults.cpp
index bbf9bd5b0b..01daac9260 100644
--- a/platform/android/globals/global_defaults.cpp
+++ b/platform/android/globals/global_defaults.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "global_defaults.h"
-#include "globals.h"
+#include "global_config.h"
void register_android_global_defaults() {
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp
index dfbb437344..41558cf86a 100644
--- a/platform/android/java_glue.cpp
+++ b/platform/android/java_glue.cpp
@@ -36,7 +36,7 @@
#include "file_access_android.h"
#include "dir_access_jandroid.h"
#include "audio_driver_jandroid.h"
-#include "globals.h"
+#include "global_config.h"
#include "thread_jandroid.h"
#include "core/os/keyboard.h"
#include "java_class_wrapper.h"
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 1095689a5b..2290571735 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -36,7 +36,7 @@
#include "servers/visual/visual_server_wrap_mt.h"
#include "main/main.h"
#include "file_access_android.h"
-#include "core/globals.h"
+#include "core/global_config.h"
#ifdef ANDROID_NATIVE_ACTIVITY
#include "file_access_android.h"
diff --git a/platform/bb10/export/export.cpp b/platform/bb10/export/export.cpp
index 0a401d3cd8..2643c96576 100644
--- a/platform/bb10/export/export.cpp
+++ b/platform/bb10/export/export.cpp
@@ -33,7 +33,7 @@
#include "tools/editor/editor_node.h"
#include "io/zip_io.h"
#include "io/marshalls.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/file_access.h"
#include "os/os.h"
#include "platform/bb10/logo.h"
diff --git a/platform/bb10/os_bb10.cpp b/platform/bb10/os_bb10.cpp
index c51f1c6092..728707628b 100644
--- a/platform/bb10/os_bb10.cpp
+++ b/platform/bb10/os_bb10.cpp
@@ -31,7 +31,7 @@
#include "drivers/gles2/rasterizer_gles2.h"
#include "servers/visual/visual_server_raster.h"
#include "core/os/dir_access.h"
-#include "core/globals.h"
+#include "core/global_config.h"
#include "main/main.h"
#include "bbutil.h"
#include "core/os/keyboard.h"
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm
index 740f1d7edc..1c47801b8e 100644
--- a/platform/iphone/app_delegate.mm
+++ b/platform/iphone/app_delegate.mm
@@ -30,7 +30,7 @@
#import "gl_view.h"
#include "os_iphone.h"
-#include "core/globals.h"
+#include "core/global_config.h"
#include "main/main.h"
#ifdef MODULE_FACEBOOKSCORER_IOS_ENABLED
diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm
index a3af8f4aa8..adc76a622e 100755
--- a/platform/iphone/gl_view.mm
+++ b/platform/iphone/gl_view.mm
@@ -31,7 +31,7 @@
#import <OpenGLES/EAGLDrawable.h>
#include "os_iphone.h"
#include "core/os/keyboard.h"
-#include "core/globals.h"
+#include "core/global_config.h"
#include "servers/audio_server.h"
#import "gl_view.h"
diff --git a/platform/iphone/globals/global_defaults.cpp b/platform/iphone/globals/global_defaults.cpp
index 76b5c9aa01..bf716c36f0 100755
--- a/platform/iphone/globals/global_defaults.cpp
+++ b/platform/iphone/globals/global_defaults.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "global_defaults.h"
-#include "globals.h"
+#include "global_config.h"
void register_iphone_global_defaults() {
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index 73ec7bbc54..2657eaddb5 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -33,7 +33,7 @@
#include "tools/editor/editor_node.h"
#include "io/zip_io.h"
#include "io/marshalls.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/file_access.h"
#include "os/os.h"
#include "platform/javascript/logo.h"
diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp
index 94320d53c1..e096e96a36 100644
--- a/platform/javascript/javascript_main.cpp
+++ b/platform/javascript/javascript_main.cpp
@@ -158,9 +158,8 @@ int main(int argc, char *argv[]) {
char *args[]={"-test","gui","-v",NULL};
Error err = Main::setup("apk",3,args);
#else
- //char *args[]={"-v",NULL};//
- //Error err = Main::setup("",1,args);
- Error err = Main::setup("",0,NULL);
+ char *args[]={"-main_pack","data.pck",NULL}; //pass location of main pack manually, because it wont get an executable name
+ Error err = Main::setup("",2,args);
#endif
ResourceLoader::set_abort_on_missing_resources(false); //ease up compatibility
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index b8c3dea3b4..931f60ea82 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -34,7 +34,7 @@
#include "drivers/unix/dir_access_unix.h"
#include "servers/visual/visual_server_raster.h"
#include "main/main.h"
-#include "core/globals.h"
+#include "core/global_config.h"
#include "dom_keys.h"
#include <stdlib.h>
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 79103a9b3e..69973dc95d 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -34,7 +34,7 @@
#include "io/zip_io.h"
#include "io/marshalls.h"
#include "io/resource_saver.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/file_access.h"
#include "os/os.h"
#include "platform/osx/logo.h"
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index 90c21e11a1..61b8a1c240 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -40,7 +40,7 @@
#include "servers/audio_server.h"
//#include "servers/visual/visual_server_wrap_mt.h"
#include "os/memory_pool_dynamic_prealloc.h"
-#include "globals.h"
+#include "global_config.h"
#include "io/marshalls.h"
#include "platform/windows/packet_peer_udp_winsock.h"
#include "platform/windows/stream_peer_winsock.h"
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 1e51c18b63..1afbfd5230 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -44,7 +44,7 @@
#include "packet_peer_udp_winsock.h"
#include "stream_peer_winsock.h"
#include "lang_table.h"
-#include "globals.h"
+#include "global_config.h"
#include "io/marshalls.h"
#include "joypad.h"
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index 11eaa2ed33..473bca8d3b 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "light.h"
-#include "globals.h"
+#include "global_config.h"
#include "scene/resources/surface_tool.h"
#include "baked_light_instance.h"
diff --git a/scene/3d/portal.cpp b/scene/3d/portal.cpp
index 44e4fb54da..19f1261238 100644
--- a/scene/3d/portal.cpp
+++ b/scene/3d/portal.cpp
@@ -29,7 +29,7 @@
#include "portal.h"
#include "servers/visual_server.h"
#include "scene/resources/surface_tool.h"
-#include "globals.h"
+#include "global_config.h"
bool Portal::_set(const StringName& p_name, const Variant& p_value) {
diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp
index fbfc44ce90..b363c05ef7 100644
--- a/scene/3d/room_instance.cpp
+++ b/scene/3d/room_instance.cpp
@@ -31,7 +31,7 @@
#include "servers/visual_server.h"
#include "geometry.h"
-#include "globals.h"
+#include "global_config.h"
#include "scene/resources/surface_tool.h"
diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp
index 1bb6d83393..04e82ba914 100644
--- a/scene/3d/skeleton.cpp
+++ b/scene/3d/skeleton.cpp
@@ -31,7 +31,7 @@
#include "message_queue.h"
#include "scene/resources/surface_tool.h"
-#include "core/globals.h"
+#include "core/global_config.h"
bool Skeleton::_set(const StringName& p_path, const Variant& p_value) {
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index e52afdffdf..cffe2ce218 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -30,7 +30,7 @@
#include "servers/visual_server.h"
#include "scene/main/viewport.h"
#include "scene/main/canvas_layer.h"
-#include "globals.h"
+#include "global_config.h"
#include "print_string.h"
#include "os/keyboard.h"
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index d16688407c..a35df53e52 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "item_list.h"
#include "os/os.h"
-#include "globals.h"
+#include "global_config.h"
void ItemList::add_item(const String& p_item,const Ref<Texture>& p_texture,bool p_selectable) {
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index dfcea30056..915eaa2f45 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "label.h"
#include "print_string.h"
-#include "globals.h"
+#include "global_config.h"
#include "translation.h"
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index cacb79268c..3f2eab8bef 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -32,7 +32,7 @@
#include "os/input.h"
#include "os/os.h"
-#include "globals.h"
+#include "global_config.h"
#include "message_queue.h"
#include "scene/main/viewport.h"
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 524ef2aae4..7bfc24079b 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -30,7 +30,7 @@
#include "print_string.h"
#include "os/os.h"
#include "os/keyboard.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/input.h"
#include "scene/main/viewport.h"
diff --git a/scene/main/node.h b/scene/main/node.h
index d88db8ecb0..93b250ab0f 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -29,7 +29,7 @@
#ifndef NODE_H
#define NODE_H
-#include "globals.h"
+#include "global_config.h"
#include "object.h"
#include "path_db.h"
#include "map.h"
diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp
index f64a563e23..418eb92ee2 100644
--- a/scene/main/scene_main_loop.cpp
+++ b/scene/main/scene_main_loop.cpp
@@ -32,7 +32,7 @@
#include "os/os.h"
#include "message_queue.h"
#include "node.h"
-#include "globals.h"
+#include "global_config.h"
#include <stdio.h>
#include "os/keyboard.h"
//#include "servers/spatial_sound_2d_server.h"
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index f7bd98a002..ef39dcde4b 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -48,7 +48,7 @@
#include "scene/main/timer.h"
#include "scene/scene_string_names.h"
-#include "globals.h"
+#include "global_config.h"
void ViewportTexture::setup_local_to_scene() {
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index c0bd86382b..ffdc85301a 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "register_scene_types.h"
#include "os/os.h"
-#include "globals.h"
+#include "global_config.h"
#include "scene/io/resource_format_image.h"
#include "scene/io/resource_format_wav.h"
diff --git a/scene/resources/audio_stream_resampled.cpp b/scene/resources/audio_stream_resampled.cpp
index 7b49ec0849..b2f314a55e 100644
--- a/scene/resources/audio_stream_resampled.cpp
+++ b/scene/resources/audio_stream_resampled.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "audio_stream_resampled.h"
-#include "globals.h"
+#include "global_config.h"
#if 0
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index eb1a3b550a..f44b37f6f5 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "environment.h"
#include "texture.h"
-#include "globals.h"
+#include "global_config.h"
#include "servers/visual_server.h"
RID Environment::get_rid() const {
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 99734fd656..5e3347687a 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "packed_scene.h"
-#include "globals.h"
+#include "global_config.h"
#include "io/resource_loader.h"
#include "scene/3d/spatial.h"
#include "scene/gui/control.h"
diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp
index 9719f321d6..3a254836a2 100644
--- a/scene/resources/scene_format_text.cpp
+++ b/scene/resources/scene_format_text.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "scene_format_text.h"
-#include "globals.h"
+#include "global_config.h"
#include "version.h"
#include "os/dir_access.h"
diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp
index b2713da569..6b745d5d35 100644
--- a/scene/resources/world_2d.cpp
+++ b/scene/resources/world_2d.cpp
@@ -30,11 +30,11 @@
#include "servers/visual_server.h"
#include "servers/physics_2d_server.h"
//#include "servers/spatial_sound_2d_server.h"
-#include "globals.h"
+#include "global_config.h"
#include "scene/2d/visibility_notifier_2d.h"
#include "scene/main/viewport.h"
#include "scene/2d/camera_2d.h"
-#include "globals.h"
+#include "global_config.h"
struct SpatialIndexer2D {
diff --git a/scene/resources/world_2d.h b/scene/resources/world_2d.h
index a9110b3bd9..c02880e9ed 100644
--- a/scene/resources/world_2d.h
+++ b/scene/resources/world_2d.h
@@ -31,7 +31,7 @@
#include "resource.h"
#include "servers/physics_2d_server.h"
-#include "globals.h"
+#include "global_config.h"
class SpatialIndexer2D;
class VisibilityNotifier2D;
diff --git a/servers/audio/audio_driver_dummy.cpp b/servers/audio/audio_driver_dummy.cpp
index 6e0c0089ca..6c12957851 100644
--- a/servers/audio/audio_driver_dummy.cpp
+++ b/servers/audio/audio_driver_dummy.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "audio_driver_dummy.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/os.h"
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index edc7f36ff2..192d958a64 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "audio_server.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/os.h"
#include "servers/audio/effects/audio_effect_compressor.h"
#include "io/resource_loader.h"
diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp
index eaa3d3194c..04b8f5b68d 100644
--- a/servers/physics/space_sw.cpp
+++ b/servers/physics/space_sw.cpp
@@ -26,7 +26,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "globals.h"
+#include "global_config.h"
#include "space_sw.h"
#include "collision_solver_sw.h"
#include "physics_server_sw.h"
diff --git a/servers/physics/space_sw.h b/servers/physics/space_sw.h
index 0abc4726ea..3ec01c9205 100644
--- a/servers/physics/space_sw.h
+++ b/servers/physics/space_sw.h
@@ -37,7 +37,7 @@
#include "area_pair_sw.h"
#include "broad_phase_sw.h"
#include "collision_object_sw.h"
-#include "globals.h"
+#include "global_config.h"
class PhysicsDirectSpaceStateSW : public PhysicsDirectSpaceState {
diff --git a/servers/physics_2d/broad_phase_2d_hash_grid.cpp b/servers/physics_2d/broad_phase_2d_hash_grid.cpp
index 8b7a410b3d..06eead64cd 100644
--- a/servers/physics_2d/broad_phase_2d_hash_grid.cpp
+++ b/servers/physics_2d/broad_phase_2d_hash_grid.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "broad_phase_2d_hash_grid.h"
-#include "globals.h"
+#include "global_config.h"
#define LARGE_ELEMENT_FI 1.01239812
diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp
index d134ce7ea8..15cf82c122 100644
--- a/servers/physics_2d/physics_2d_server_sw.cpp
+++ b/servers/physics_2d/physics_2d_server_sw.cpp
@@ -30,7 +30,7 @@
#include "broad_phase_2d_basic.h"
#include "broad_phase_2d_hash_grid.h"
#include "collision_solver_2d_sw.h"
-#include "globals.h"
+#include "global_config.h"
#include "script_language.h"
#include "os/os.h"
diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.h b/servers/physics_2d/physics_2d_server_wrap_mt.h
index 851ba901ec..7360c0637b 100644
--- a/servers/physics_2d/physics_2d_server_wrap_mt.h
+++ b/servers/physics_2d/physics_2d_server_wrap_mt.h
@@ -33,7 +33,7 @@
#include "servers/physics_2d_server.h"
#include "command_queue_mt.h"
#include "os/thread.h"
-#include "globals.h"
+#include "global_config.h"
#ifdef DEBUG_SYNC
#define SYNC_DEBUG print_line("sync on: "+String(__FUNCTION__));
diff --git a/servers/physics_2d/space_2d_sw.h b/servers/physics_2d/space_2d_sw.h
index 5dee3dea5a..72b34e8c4f 100644
--- a/servers/physics_2d/space_2d_sw.h
+++ b/servers/physics_2d/space_2d_sw.h
@@ -37,7 +37,7 @@
#include "area_pair_2d_sw.h"
#include "broad_phase_2d_sw.h"
#include "collision_object_2d_sw.h"
-#include "globals.h"
+#include "global_config.h"
class Physics2DDirectSpaceStateSW : public Physics2DDirectSpaceState {
diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp
index 01f8ffa504..0d0619e880 100644
--- a/servers/register_server_types.cpp
+++ b/servers/register_server_types.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "register_server_types.h"
-#include "globals.h"
+#include "global_config.h"
#include "visual_server.h"
#include "audio_server.h"
diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp
index 8f87425212..3a5ffda8f5 100644
--- a/servers/visual/visual_server_raster.cpp
+++ b/servers/visual/visual_server_raster.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "visual_server_raster.h"
#include "os/os.h"
-#include "globals.h"
+#include "global_config.h"
#include "default_mouse_cursor.xpm"
#include "sort.h"
#include "io/marshalls.h"
diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp
index d2ee32f9cc..d32c4dd6bf 100644
--- a/servers/visual/visual_server_viewport.cpp
+++ b/servers/visual/visual_server_viewport.cpp
@@ -2,7 +2,7 @@
#include "visual_server_global.h"
#include "visual_server_canvas.h"
#include "visual_server_scene.h"
-#include "globals.h"
+#include "global_config.h"
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index dbf8fb442b..5d231d208e 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "visual_server.h"
-#include "globals.h"
+#include "global_config.h"
#include "method_bind_ext.inc"
VisualServer *VisualServer::singleton=NULL;
diff --git a/tools/editor/collada/collada.h b/tools/editor/collada/collada.h
index fd7ad4920d..2de2d22935 100644
--- a/tools/editor/collada/collada.h
+++ b/tools/editor/collada/collada.h
@@ -33,7 +33,7 @@
#include "scene/resources/material.h"
-#include "globals.h"
+#include "global_config.h"
#include "io/xml_parser.h"
#include "map.h"
diff --git a/tools/editor/doc/doc_data.cpp b/tools/editor/doc/doc_data.cpp
index d51dc886b2..e0a4750862 100644
--- a/tools/editor/doc/doc_data.cpp
+++ b/tools/editor/doc/doc_data.cpp
@@ -30,7 +30,7 @@
#include "version.h"
#include "global_constants.h"
-#include "globals.h"
+#include "global_config.h"
#include "script_language.h"
#include "io/marshalls.h"
#include "io/compression.h"
diff --git a/tools/editor/editor_autoload_settings.cpp b/tools/editor/editor_autoload_settings.cpp
index 0038ab48d5..3e3362f515 100644
--- a/tools/editor/editor_autoload_settings.cpp
+++ b/tools/editor/editor_autoload_settings.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "editor_autoload_settings.h"
-#include "globals.h"
+#include "global_config.h"
#include "global_constants.h"
#include "editor_node.h"
diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp
index 2a3c55229a..d2fa40e08c 100644
--- a/tools/editor/editor_data.cpp
+++ b/tools/editor/editor_data.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "editor_data.h"
-#include "globals.h"
+#include "global_config.h"
#include "editor_settings.h"
#include "os/dir_access.h"
#include "io/resource_loader.h"
diff --git a/tools/editor/editor_export.cpp b/tools/editor/editor_export.cpp
index 599ca6bf6a..9483fa84ac 100644
--- a/tools/editor/editor_export.cpp
+++ b/tools/editor/editor_export.cpp
@@ -29,7 +29,7 @@
#include "editor_export.h"
#include "version.h"
#include "script_language.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/file_access.h"
#include "os/dir_access.h"
#include "tools/editor/editor_file_system.h"
@@ -42,8 +42,18 @@
#include "tools/editor/plugins/script_editor_plugin.h"
#include "io/zip_io.h"
+static int _get_pad(int p_alignment, int p_n) {
+ int rest = p_n % p_alignment;
+ int pad = 0;
+ if (rest > 0) {
+ pad = p_alignment - rest;
+ };
+
+ return pad;
+};
+#define PCK_PADDING 16
bool EditorExportPreset::_set(const StringName& p_name, const Variant& p_value) {
@@ -73,7 +83,7 @@ void EditorExportPreset::_get_property_list( List<PropertyInfo> *p_list) const{
}
}
-Ref<EditorExportPlatform> EditorExportPreset::get_platform() {
+Ref<EditorExportPlatform> EditorExportPreset::get_platform() const {
return platform;
}
@@ -254,6 +264,34 @@ void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags)
Error EditorExportPlatform::_save_pack_file(void *p_userdata,const String& p_path, const Vector<uint8_t>& p_data,int p_file,int p_total) {
+ PackData *pd = (PackData*)p_userdata;
+
+ SavedData sd;
+ sd.path_utf8=p_path.utf8();
+ sd.ofs = pd->f->get_pos();
+ sd.size = p_data.size();
+
+ pd->f->store_buffer(p_data.ptr(),p_data.size());
+ int pad = _get_pad(PCK_PADDING,sd.size);
+ for(int i=0;i<pad;i++) {
+ pd->f->store_8(0);
+ }
+
+ {
+ MD5_CTX ctx;
+ MD5Init(&ctx);
+ MD5Update(&ctx,(unsigned char*)p_data.ptr(),p_data.size());
+ MD5Final(&ctx);
+ sd.md5.resize(16);
+ for(int i=0;i<16;i++) {
+ sd.md5[i]=ctx.digest[i];
+ }
+ }
+
+ pd->file_ofs.push_back(sd);
+
+ pd->ep->step(TTR("Storing File:")+" "+p_path,2+p_file*100/p_total,false);
+
return OK;
}
@@ -281,7 +319,7 @@ Error EditorExportPlatform::_save_zip_file(void *p_userdata,const String& p_path
zipCloseFileInZip(zip);
zd->ep->step(TTR("Storing File:")+" "+p_path,2+p_file*100/p_total,false);
- zd->count++;
+
return OK;
}
@@ -335,18 +373,250 @@ Ref<EditorExportPreset> EditorExportPlatform::create_preset() {
}
+void EditorExportPlatform::_export_find_resources(EditorFileSystemDirectory *p_dir,Set<String>& p_paths) {
+
+ for(int i=0;i<p_dir->get_subdir_count();i++) {
+ _export_find_resources(p_dir->get_subdir(i),p_paths);
+ }
+
+ for(int i=0;i<p_dir->get_file_count();i++) {
+ p_paths.insert(p_dir->get_file_path(i));
+ }
+}
+
+
+void EditorExportPlatform::_export_find_dependencies(const String& p_path,Set<String>& p_paths) {
+
+ if (p_paths.has(p_path))
+ return;
+
+ p_paths.insert(p_path);
+
+ EditorFileSystemDirectory *dir;
+ int file_idx;
+ dir = EditorFileSystem::get_singleton()->find_file(p_path,&file_idx);
+ if (!dir)
+ return;
+
+ Vector<String> deps = dir->get_file_deps(file_idx);
+
+ for(int i=0;i<deps.size();i++) {
+
+ _export_find_dependencies(deps[i],p_paths);
+ }
+}
+
+
Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset>& p_preset,EditorExportSaveFunction p_func, void* p_udata) {
+ Ref<EditorExportPlatform> platform = p_preset->get_platform();
+ List<String> feature_list;
+ platform->get_preset_features(p_preset,&feature_list);
+ //figure out features
+ Set<String> features;
+ for (List<String>::Element *E=feature_list.front();E;E=E->next()) {
+ features.insert(E->get());
+ }
+
+ //figure out paths of files that will be exported
+ Set<String> paths;
+
+ if (p_preset->get_export_filter()==EditorExportPreset::EXPORT_ALL_RESOURCES) {
+ //find stuff
+ _export_find_resources(EditorFileSystem::get_singleton()->get_filesystem(),paths);
+ } else {
+ bool scenes_only = p_preset->get_export_filter()==EditorExportPreset::EXPORT_SELECTED_SCENES;
+
+ Vector<String> files = p_preset->get_files_to_export();
+ for(int i=0;i<files.size();i++) {
+ if (scenes_only && ResourceLoader::get_resource_type(files[i])!="PackedScene")
+ continue;
+
+ _export_find_dependencies(files[i],paths);
+ }
+ }
+
+ //store everything in the export medium
+ int idx = 0;
+ int total=paths.size();
+
+ for(Set<String>::Element *E=paths.front();E;E=E->next()) {
+
+ String path = E->get();
+
+ if (FileAccess::exists(path+".import")) {
+ //file is imported, replace by what it imports
+ Ref<ConfigFile> config;
+ config.instance();
+ Error err = config->load(path+".import");
+ if (err!=OK) {
+ ERR_PRINTS("Could not parse: '"+path+"', not exported.");
+ continue;
+ }
+
+ List<String> remaps;
+ config->get_section_keys("remap",&remaps);
+
+ for(List<String>::Element *F=remaps.front();F;F=F->next()) {
+
+ String remap=F->get();
+ if (remap=="path") {
+ String remapped_path=config->get_value("remap",remap);
+ Vector<uint8_t> array = FileAccess::get_file_as_array(remapped_path);
+ p_func(p_udata,remapped_path,array,idx,total);
+ } else if (remap.begins_with("path.")) {
+ String feature = remap.get_slice(".",1);
+ if (features.has(feature)) {
+ String remapped_path=config->get_value("remap",remap);
+ Vector<uint8_t> array = FileAccess::get_file_as_array(remapped_path);
+ p_func(p_udata,remapped_path,array,idx,total);
+ }
+ }
+ }
+
+ //also save the .import file
+ Vector<uint8_t> array = FileAccess::get_file_as_array(path+".import");
+ p_func(p_udata,path+".import",array,idx,total);
+
+ } else {
+ //just store it as it comes
+ Vector<uint8_t> array = FileAccess::get_file_as_array(path);
+ p_func(p_udata,path,array,idx,total);
+ }
+
+ idx++;
+ }
+
+ //save config!
+
+ String config_file="godot.cfb";
+ String engine_cfb =EditorSettings::get_singleton()->get_settings_path()+"/tmp/tmp"+config_file;
+ GlobalConfig::get_singleton()->save_custom(engine_cfb);
+ Vector<uint8_t> data = FileAccess::get_file_as_array(engine_cfb);
+
+ p_func(p_udata,"res://"+config_file,data,idx,total);
+
return OK;
}
-Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset>& p_preset,FileAccess *p_where) {
+Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset>& p_preset,const String& p_path) {
+
+ EditorProgress ep("savepack",TTR("Packing"),102);
+
+ String tmppath = EditorSettings::get_singleton()->get_settings_path()+"/tmp/packtmp";
+ FileAccess *ftmp = FileAccess::open(tmppath,FileAccess::WRITE);
+ ERR_FAIL_COND_V(!ftmp,ERR_CANT_CREATE)
+
+ PackData pd;
+ pd.ep=&ep;
+ pd.f=ftmp;
+
+ Error err = export_project_files(p_preset,_save_pack_file,&pd);
+
+ memdelete(ftmp); //close tmp file
+
+ if (err)
+ return err;
+
+ pd.file_ofs.sort(); //do sort, so we can do binary search later
+
+
+ FileAccess *f = FileAccess::open(p_path,FileAccess::WRITE);
+ ERR_FAIL_COND_V(!f,ERR_CANT_CREATE)
+ f->store_32(0x43504447); //GDPK
+ f->store_32(1); //pack version
+ f->store_32(VERSION_MAJOR);
+ f->store_32(VERSION_MINOR);
+ f->store_32(0); //hmph
+ for(int i=0;i<16;i++) {
+ //reserved
+ f->store_32(0);
+ }
+
+ f->store_32(pd.file_ofs.size()); //amount of files
+
+ size_t header_size = f->get_pos();
+
+ //precalculate header size
+
+ for(int i=0;i<pd.file_ofs.size();i++) {
+ header_size += 4; // size of path string (32 bits is enough)
+ uint32_t string_len = pd.file_ofs[i].path_utf8.length();
+ header_size += string_len + _get_pad(4,string_len); ///size of path string
+ header_size += 8; // offset to file _with_ header size included
+ header_size += 8; // size of file
+ header_size +=16; // md5
+
+ }
+
+ size_t header_padding = _get_pad(PCK_PADDING,header_size);
+
+
+ for(int i=0;i<pd.file_ofs.size();i++) {
+
+ uint32_t string_len = pd.file_ofs[i].path_utf8.length();
+ uint32_t pad = _get_pad(4,string_len);;
+ f->store_32(string_len+pad);
+ f->store_buffer((const uint8_t*)pd.file_ofs[i].path_utf8.get_data(),string_len);
+ for(uint32_t j=0;j<pad;j++) {
+ f->store_8(0);
+ }
+
+ f->store_64(pd.file_ofs[i].ofs + header_padding + header_size);
+ f->store_64(pd.file_ofs[i].size); // pay attention here, this is where file is
+ f->store_buffer(pd.file_ofs[i].md5.ptr(),16); //also save md5 for file
+ }
+
+ for(uint32_t j=0;j<header_padding;j++) {
+ f->store_8(0);
+ }
+
+ //save the rest of the data
+
+ ftmp = FileAccess::open(tmppath,FileAccess::READ);
+ if (!ftmp) {
+ memdelete(f);
+ ERR_FAIL_COND_V(!ftmp,ERR_CANT_CREATE)
+ }
+
+ const int bufsize=16384;
+ uint8_t buf[bufsize];
+
+ while(true) {
+
+ int got = ftmp->get_buffer(buf,bufsize);
+ if (got<=0)
+ break;
+ f->store_buffer(buf,got);
+ }
+
+ memdelete(ftmp);
+
+ f->store_32(0x43504447); //GDPK
+ memdelete(f);
return OK;
}
Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset>& p_preset,const String& p_path) {
+ EditorProgress ep("savezip",TTR("Packing"),102);
+
+ //FileAccess *tmp = FileAccess::open(tmppath,FileAccess::WRITE);
+
+ FileAccess *src_f;
+ zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
+ zipFile zip=zipOpen2(p_path.utf8().get_data(),APPEND_STATUS_CREATE,NULL,&io);
+
+ ZipData zd;
+ zd.ep=&ep;
+ zd.zip=zip;
+
+
+ Error err = export_project_files(p_preset,_save_zip_file,&zd);
+
+ zipClose(zip,NULL);
+
return OK;
}
@@ -387,9 +657,7 @@ void EditorExport::_save() {
config->set_value(section,"export_filter","resources");
save_files=true;
} break;
- case EditorExportPreset::EXPORT_ALL_FILES: {
- config->set_value(section,"export_filter","all_files");
- } break;
+
}
@@ -527,8 +795,6 @@ void EditorExport::load_config() {
} else if (export_filter=="resources") {
preset->set_export_filter(EditorExportPreset::EXPORT_SELECTED_RESOURCES);
get_files=true;
- } else if (export_filter=="all_files") {
- preset->set_export_filter(EditorExportPreset::EXPORT_ALL_FILES);
}
if (get_files) {
diff --git a/tools/editor/editor_export.h b/tools/editor/editor_export.h
index 1aa4f103ec..d30ce9bd92 100644
--- a/tools/editor/editor_export.h
+++ b/tools/editor/editor_export.h
@@ -39,6 +39,7 @@
class EditorProgress;
class FileAccess;
class EditorExportPlatform;
+class EditorFileSystemDirectory;
class EditorExportPreset : public Reference {
@@ -48,7 +49,6 @@ public:
EXPORT_ALL_RESOURCES,
EXPORT_SELECTED_SCENES,
EXPORT_SELECTED_RESOURCES,
- EXPORT_ALL_FILES,
};
private:
@@ -64,6 +64,7 @@ private:
Vector<String> patches;
+
friend class EditorExport;
friend class EditorExportPlatform;
@@ -78,7 +79,7 @@ protected:
public:
- Ref<EditorExportPlatform> get_platform();
+ Ref<EditorExportPlatform> get_platform() const;
bool has(const StringName& p_property) const { return values.has(p_property); }
Vector<String> get_files_to_export() const;
@@ -126,9 +127,14 @@ private:
struct SavedData {
- String path;
uint64_t ofs;
uint64_t size;
+ Vector<uint8_t> md5;
+ CharString path_utf8;
+
+ bool operator<(const SavedData& p_data) const {
+ return path_utf8 < p_data.path_utf8;
+ }
};
struct PackData {
@@ -142,10 +148,12 @@ private:
void* zip;
EditorProgress *ep;
- int count;
};
+ void _export_find_resources(EditorFileSystemDirectory *p_dir,Set<String>& p_paths);
+ void _export_find_dependencies(const String& p_path,Set<String>& p_paths);
+
void gen_debug_flags(Vector<String> &r_flags, int p_flags);
static Error _save_pack_file(void *p_userdata,const String& p_path, const Vector<uint8_t>& p_data,int p_file,int p_total);
static Error _save_zip_file(void *p_userdata,const String& p_path, const Vector<uint8_t>& p_data,int p_file,int p_total);
@@ -176,7 +184,7 @@ public:
Error export_project_files(const Ref<EditorExportPreset>& p_preset,EditorExportSaveFunction p_func, void* p_udata);
- Error save_pack(const Ref<EditorExportPreset>& p_preset,FileAccess *p_where);
+ Error save_pack(const Ref<EditorExportPreset>& p_preset,const String& p_path);
Error save_zip(const Ref<EditorExportPreset>& p_preset,const String& p_path);
diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp
index b9b8345282..cd151cd90b 100644
--- a/tools/editor/editor_file_system.cpp
+++ b/tools/editor/editor_file_system.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "editor_file_system.h"
-#include "globals.h"
+#include "global_config.h"
#include "io/resource_loader.h"
#include "os/os.h"
#include "os/file_access.h"
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index f6e2d5f954..5e2d6e7d6b 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -37,7 +37,7 @@
#include "servers/physics_2d_server.h"
#include "scene/resources/packed_scene.h"
#include "editor_settings.h"
-#include "globals.h"
+#include "global_config.h"
#include <stdio.h>
#include "class_db.h"
#include "os/keyboard.h"
diff --git a/tools/editor/editor_plugin_settings.cpp b/tools/editor/editor_plugin_settings.cpp
index 2b6828e82f..2d879e38cf 100644
--- a/tools/editor/editor_plugin_settings.cpp
+++ b/tools/editor/editor_plugin_settings.cpp
@@ -32,7 +32,7 @@
#include "io/config_file.h"
#include "os/file_access.h"
#include "os/main_loop.h"
-#include "globals.h"
+#include "global_config.h"
#include "editor_node.h"
void EditorPluginSettings::_notification(int p_what) {
diff --git a/tools/editor/editor_resource_preview.cpp b/tools/editor/editor_resource_preview.cpp
index b6cf24e527..ab2226e79a 100644
--- a/tools/editor/editor_resource_preview.cpp
+++ b/tools/editor/editor_resource_preview.cpp
@@ -32,7 +32,7 @@
#include "os/file_access.h"
#include "io/resource_loader.h"
#include "io/resource_saver.h"
-#include "globals.h"
+#include "global_config.h"
#include "editor_scale.h"
#include "message_queue.h"
diff --git a/tools/editor/editor_run.cpp b/tools/editor/editor_run.cpp
index 813a8ee5b7..a5d39db6be 100644
--- a/tools/editor/editor_run.cpp
+++ b/tools/editor/editor_run.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "editor_run.h"
-#include "globals.h"
+#include "global_config.h"
#include "editor_settings.h"
EditorRun::Status EditorRun::get_status() const {
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index 2e32cfe38b..f977a40243 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -39,7 +39,7 @@
#include "scene/main/viewport.h"
#include "io/config_file.h"
#include "editor_node.h"
-#include "globals.h"
+#include "global_config.h"
#include "translations.h"
#include "io/file_access_memory.h"
#include "io/translation_loader_po.h"
diff --git a/tools/editor/file_type_cache.cpp b/tools/editor/file_type_cache.cpp
index aff99fbc05..891669db13 100644
--- a/tools/editor/file_type_cache.cpp
+++ b/tools/editor/file_type_cache.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "file_type_cache.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/file_access.h"
FileTypeCache* FileTypeCache::singleton=NULL;
diff --git a/tools/editor/filesystem_dock.cpp b/tools/editor/filesystem_dock.cpp
index c6c1a02f3f..f5e4ef661a 100644
--- a/tools/editor/filesystem_dock.cpp
+++ b/tools/editor/filesystem_dock.cpp
@@ -30,7 +30,7 @@
#include "os/dir_access.h"
#include "os/file_access.h"
-#include "globals.h"
+#include "global_config.h"
#include "io/resource_loader.h"
#include "os/os.h"
#include "editor_node.h"
diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp
index 7d6598bd4b..71173038e9 100644
--- a/tools/editor/plugins/animation_player_editor_plugin.cpp
+++ b/tools/editor/plugins/animation_player_editor_plugin.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "animation_player_editor_plugin.h"
-#include "globals.h"
+#include "global_config.h"
#include "io/resource_loader.h"
#include "io/resource_saver.h"
#include "os/keyboard.h"
diff --git a/tools/editor/plugins/animation_tree_editor_plugin.cpp b/tools/editor/plugins/animation_tree_editor_plugin.cpp
index 1ed52d2df6..988136d475 100644
--- a/tools/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/tools/editor/plugins/animation_tree_editor_plugin.cpp
@@ -32,7 +32,7 @@
#include "scene/gui/panel.h"
#include "scene/main/viewport.h"
#include "core/io/resource_loader.h"
-#include "core/globals.h"
+#include "core/global_config.h"
#include "os/input.h"
#include "os/keyboard.h"
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp
index 0830556ac1..8af925db7a 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp
@@ -38,7 +38,7 @@
#include "scene/2d/particles_2d.h"
#include "scene/2d/polygon_2d.h"
#include "scene/2d/screen_button.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/input.h"
#include "tools/editor/editor_settings.h"
#include "scene/gui/grid_container.h"
diff --git a/tools/editor/plugins/resource_preloader_editor_plugin.cpp b/tools/editor/plugins/resource_preloader_editor_plugin.cpp
index cfdfbdc1c6..de2245d98f 100644
--- a/tools/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/tools/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -29,7 +29,7 @@
#include "resource_preloader_editor_plugin.h"
#include "io/resource_loader.h"
-#include "globals.h"
+#include "global_config.h"
#include "tools/editor/editor_settings.h"
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 0a880de35b..b7d8cc2ba9 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -35,7 +35,7 @@
#include "os/os.h"
#include "tools/editor/editor_node.h"
#include "tools/editor/script_editor_debugger.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/file_access.h"
#include "scene/main/viewport.h"
#include "os/keyboard.h"
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index 5e425ef3c4..ef971034cd 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -38,7 +38,7 @@
#include "tools/editor/editor_settings.h"
#include "scene/resources/surface_tool.h"
#include "tools/editor/spatial_editor_gizmos.h"
-#include "globals.h"
+#include "global_config.h"
#include "tools/editor/plugins/animation_player_editor_plugin.h"
#include "tools/editor/animation_editor.h"
diff --git a/tools/editor/plugins/sprite_frames_editor_plugin.cpp b/tools/editor/plugins/sprite_frames_editor_plugin.cpp
index 48808d9e04..c3c68e471e 100644
--- a/tools/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/tools/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -29,7 +29,7 @@
#include "sprite_frames_editor_plugin.h"
#include "io/resource_loader.h"
-#include "globals.h"
+#include "global_config.h"
#include "tools/editor/editor_settings.h"
#include "scene/3d/sprite_3d.h"
diff --git a/tools/editor/plugins/texture_editor_plugin.cpp b/tools/editor/plugins/texture_editor_plugin.cpp
index 1bfc05e2a7..90a798667f 100644
--- a/tools/editor/plugins/texture_editor_plugin.cpp
+++ b/tools/editor/plugins/texture_editor_plugin.cpp
@@ -29,7 +29,7 @@
#include "texture_editor_plugin.h"
#include "io/resource_loader.h"
-#include "globals.h"
+#include "global_config.h"
#include "tools/editor/editor_settings.h"
void TextureEditor::_gui_input(InputEvent p_event) {
diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp
index 86324f1cac..f6593a4895 100644
--- a/tools/editor/project_export.cpp
+++ b/tools/editor/project_export.cpp
@@ -29,7 +29,7 @@
#include "project_export.h"
#include "os/dir_access.h"
#include "os/file_access.h"
-#include "globals.h"
+#include "global_config.h"
#include "io/resource_loader.h"
#include "io/resource_saver.h"
#include "os/os.h"
@@ -48,6 +48,8 @@ void ProjectExportDialog::_notification(int p_what) {
if (p_what==NOTIFICATION_READY) {
delete_preset->set_icon(get_icon("Del","EditorIcons"));
+ connect("confirmed",this,"_export_pck_zip");
+
}
}
@@ -528,7 +530,7 @@ void ProjectExportDialog::_fill_resource_tree() {
EditorExportPreset::ExportFilter f = current->get_export_filter();
- if (f==EditorExportPreset::EXPORT_ALL_RESOURCES || f==EditorExportPreset::EXPORT_ALL_FILES) {
+ if (f==EditorExportPreset::EXPORT_ALL_RESOURCES) {
return;
}
@@ -616,6 +618,27 @@ void ProjectExportDialog::_tree_changed() {
}
}
+
+void ProjectExportDialog::_export_pck_zip() {
+
+ export_pck_zip->popup_centered_ratio();
+}
+
+void ProjectExportDialog::_export_pck_zip_selected(const String& p_path) {
+
+ Ref<EditorExportPreset> current = EditorExport::get_singleton()->get_export_preset(presets->get_current());
+ ERR_FAIL_COND (current.is_null());
+ Ref<EditorExportPlatform> platform = current->get_platform();
+ ERR_FAIL_COND( platform.is_null() );
+
+ if (p_path.ends_with(".zip")) {
+ platform->save_zip(current,p_path);
+ } else if (p_path.ends_with(".pck")) {
+ platform->save_pack(current,p_path);
+ }
+}
+
+
void ProjectExportDialog::_bind_methods() {
ClassDB::bind_method("_add_preset",&ProjectExportDialog::_add_preset);
@@ -634,8 +657,8 @@ void ProjectExportDialog::_bind_methods() {
ClassDB::bind_method("_patch_selected",&ProjectExportDialog::_patch_selected);
ClassDB::bind_method("_patch_deleted",&ProjectExportDialog::_patch_deleted);
ClassDB::bind_method("_patch_edited",&ProjectExportDialog::_patch_edited);
-
-
+ ClassDB::bind_method("_export_pck_zip",&ProjectExportDialog::_export_pck_zip);
+ ClassDB::bind_method("_export_pck_zip_selected",&ProjectExportDialog::_export_pck_zip_selected);
}
@@ -699,7 +722,6 @@ ProjectExportDialog::ProjectExportDialog() {
export_filter->add_item(TTR("Export all resources in the project"));
export_filter->add_item(TTR("Export selected scenes (and dependencies)"));
export_filter->add_item(TTR("Export selected resources (and dependencies)"));
- export_filter->add_item(TTR("Export all files in the project directory"));
resources_vb->add_margin_child(TTR("Export Mode:"),export_filter);
export_filter->connect("item_selected",this,"_export_type_changed");
@@ -770,7 +792,19 @@ ProjectExportDialog::ProjectExportDialog() {
updating=false;
get_ok()->set_text("Export PCK/Zip");
- add_button("Export Project",!OS::get_singleton()->get_swap_ok_cancel(),"export");
+ export_button = add_button("Export Project",!OS::get_singleton()->get_swap_ok_cancel(),"export");
+
+ export_pck_zip = memnew( FileDialog );
+ export_pck_zip->add_filter("*.zip ; ZIP File");
+ export_pck_zip->add_filter("*.pck ; Godot Game Pack");
+ export_pck_zip->set_access(FileDialog::ACCESS_FILESYSTEM);
+ export_pck_zip->set_mode(FileDialog::MODE_SAVE_FILE);
+ add_child(export_pck_zip);
+ export_pck_zip->connect("file_selected",this,"_export_pck_zip_selected");
+
+ set_hide_on_ok(false);
+
+
editor_icons = "EditorIcons";
}
diff --git a/tools/editor/project_export.h b/tools/editor/project_export.h
index 715d3c3e68..c977e90e56 100644
--- a/tools/editor/project_export.h
+++ b/tools/editor/project_export.h
@@ -91,6 +91,8 @@ private:
FileDialog *patch_dialog;
ConfirmationDialog *patch_erase;
+ Button *export_button;
+
void _patch_selected(const String& p_path);
void _patch_deleted();
@@ -117,6 +119,10 @@ private:
bool can_drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from) const;
void drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from);
+ FileDialog *export_pck_zip;
+
+ void _export_pck_zip();
+ void _export_pck_zip_selected(const String& p_path);
protected:
void _notification(int p_what);
diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp
index 2acd347dc6..ed3c59cc4a 100644
--- a/tools/editor/project_settings.cpp
+++ b/tools/editor/project_settings.cpp
@@ -29,7 +29,7 @@
#include "project_settings.h"
#include "scene/gui/tab_container.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/keyboard.h"
#include "editor_node.h"
#include "scene/gui/margin_container.h"
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index 9fc47b7da4..19b7b2ce66 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -33,7 +33,7 @@
#include "io/image_loader.h"
#include "class_db.h"
#include "print_string.h"
-#include "globals.h"
+#include "global_config.h"
#include "scene/resources/font.h"
#include "pair.h"
#include "scene/scene_string_names.h"
@@ -48,7 +48,7 @@
#include "editor_file_system.h"
#include "create_dialog.h"
#include "property_selector.h"
-#include "globals.h"
+#include "global_config.h"
void CustomPropertyEditor::_notification(int p_what) {
diff --git a/tools/editor/resources_dock.cpp b/tools/editor/resources_dock.cpp
index 5348c8c122..8648361bae 100644
--- a/tools/editor/resources_dock.cpp
+++ b/tools/editor/resources_dock.cpp
@@ -33,7 +33,7 @@
#include "io/resource_saver.h"
#include "editor_settings.h"
#include "project_settings.h"
-#include "globals.h"
+#include "global_config.h"
#include "editor_file_system.h"
diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp
index eee4aefce3..4f3700adb5 100644
--- a/tools/editor/scene_tree_dock.cpp
+++ b/tools/editor/scene_tree_dock.cpp
@@ -29,7 +29,7 @@
#include "scene_tree_dock.h"
#include "editor_node.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/keyboard.h"
#include "scene/resources/packed_scene.h"
#include "editor_settings.h"
diff --git a/tools/editor/script_create_dialog.cpp b/tools/editor/script_create_dialog.cpp
index 496d8670eb..dfaa1f645c 100644
--- a/tools/editor/script_create_dialog.cpp
+++ b/tools/editor/script_create_dialog.cpp
@@ -29,7 +29,7 @@
#include "script_create_dialog.h"
#include "script_language.h"
-#include "globals.h"
+#include "global_config.h"
#include "io/resource_saver.h"
#include "os/file_access.h"
#include "editor_file_system.h"
diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp
index 248eecc1c8..fa33ffe5c7 100644
--- a/tools/editor/script_editor_debugger.cpp
+++ b/tools/editor/script_editor_debugger.cpp
@@ -39,7 +39,7 @@
#include "scene/gui/rich_text_label.h"
#include "scene/gui/margin_container.h"
#include "property_editor.h"
-#include "globals.h"
+#include "global_config.h"
#include "editor_node.h"
#include "main/performance.h"
#include "editor_profiler.h"
diff --git a/tools/editor/settings_config_dialog.cpp b/tools/editor/settings_config_dialog.cpp
index cd8403b271..6a62e035ec 100644
--- a/tools/editor/settings_config_dialog.cpp
+++ b/tools/editor/settings_config_dialog.cpp
@@ -30,7 +30,7 @@
#include "editor_settings.h"
#include "scene/gui/margin_container.h"
-#include "globals.h"
+#include "global_config.h"
#include "editor_file_system.h"
#include "editor_node.h"
#include "os/keyboard.h"