Browse Source

Merge pull request #8246 from GodotNativeTools/dlscript-module

DLScript module
Rémi Verschelde 8 years ago
parent
commit
46bc14e66f
57 changed files with 6598 additions and 609 deletions
  1. 4 0
      core/os/os.h
  2. 1 1
      core/script_language.h
  3. 31 0
      drivers/unix/os_unix.cpp
  4. 4 0
      drivers/unix/os_unix.h
  5. 0 7
      modules/cscript/SCsub
  6. 0 29
      modules/cscript/godot_c.cpp
  7. 0 567
      modules/cscript/godot_c.h
  8. 14 0
      modules/dlscript/SCsub
  9. 382 0
      modules/dlscript/api_generator.cpp
  10. 9 0
      modules/dlscript/api_generator.h
  11. 1 1
      modules/dlscript/config.py
  12. 1048 0
      modules/dlscript/dl_script.cpp
  13. 402 0
      modules/dlscript/dl_script.h
  14. 193 0
      modules/dlscript/godot.cpp
  15. 389 0
      modules/dlscript/godot.h
  16. 271 0
      modules/dlscript/godot/godot_array.cpp
  17. 88 0
      modules/dlscript/godot/godot_array.h
  18. 58 0
      modules/dlscript/godot/godot_basis.cpp
  19. 34 0
      modules/dlscript/godot/godot_basis.h
  20. 34 0
      modules/dlscript/godot/godot_color.cpp
  21. 29 0
      modules/dlscript/godot/godot_color.h
  22. 109 0
      modules/dlscript/godot/godot_dictionary.cpp
  23. 51 0
      modules/dlscript/godot/godot_dictionary.h
  24. 85 0
      modules/dlscript/godot/godot_image.cpp
  25. 95 0
      modules/dlscript/godot/godot_image.h
  26. 280 0
      modules/dlscript/godot/godot_input_event.cpp
  27. 206 0
      modules/dlscript/godot/godot_input_event.h
  28. 87 0
      modules/dlscript/godot/godot_node_path.cpp
  29. 38 0
      modules/dlscript/godot/godot_node_path.h
  30. 48 0
      modules/dlscript/godot/godot_plane.cpp
  31. 37 0
      modules/dlscript/godot/godot_plane.h
  32. 558 0
      modules/dlscript/godot/godot_pool_arrays.cpp
  33. 256 0
      modules/dlscript/godot/godot_pool_arrays.h
  34. 79 0
      modules/dlscript/godot/godot_quat.cpp
  35. 33 0
      modules/dlscript/godot/godot_quat.h
  36. 48 0
      modules/dlscript/godot/godot_rect2.cpp
  37. 31 0
      modules/dlscript/godot/godot_rect2.h
  38. 48 0
      modules/dlscript/godot/godot_rect3.cpp
  39. 31 0
      modules/dlscript/godot/godot_rect3.h
  40. 36 0
      modules/dlscript/godot/godot_rid.cpp
  41. 28 0
      modules/dlscript/godot/godot_rid.h
  42. 83 0
      modules/dlscript/godot/godot_string.cpp
  43. 42 0
      modules/dlscript/godot/godot_string.h
  44. 44 0
      modules/dlscript/godot/godot_transform.cpp
  45. 29 0
      modules/dlscript/godot/godot_transform.h
  46. 59 0
      modules/dlscript/godot/godot_transform2d.cpp
  47. 48 0
      modules/dlscript/godot/godot_transform2d.h
  48. 466 0
      modules/dlscript/godot/godot_variant.cpp
  49. 148 0
      modules/dlscript/godot/godot_variant.h
  50. 124 0
      modules/dlscript/godot/godot_vector2.cpp
  51. 78 0
      modules/dlscript/godot/godot_vector2.h
  52. 150 0
      modules/dlscript/godot/godot_vector3.cpp
  53. 82 0
      modules/dlscript/godot/godot_vector3.h
  54. 37 2
      modules/dlscript/register_types.cpp
  55. 2 2
      modules/dlscript/register_types.h
  56. 26 0
      platform/windows/os_windows.cpp
  57. 4 0
      platform/windows/os_windows.h

+ 4 - 0
core/os/os.h

@@ -177,6 +177,10 @@ public:
 	virtual void set_borderless_window(int p_borderless) {}
 	virtual void set_borderless_window(int p_borderless) {}
 	virtual bool get_borderless_window() { return 0; }
 	virtual bool get_borderless_window() { return 0; }
 
 
+	virtual Error open_dynamic_library(const String p_path, void *&p_library_handle) { return ERR_UNAVAILABLE; };
+	virtual Error close_dynamic_library(void *p_library_handle) { return ERR_UNAVAILABLE; };
+	virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle) { return ERR_UNAVAILABLE; };
+
 	virtual void set_keep_screen_on(bool p_enabled);
 	virtual void set_keep_screen_on(bool p_enabled);
 	virtual bool is_keep_screen_on() const;
 	virtual bool is_keep_screen_on() const;
 	virtual void set_low_processor_usage_mode(bool p_enabled);
 	virtual void set_low_processor_usage_mode(bool p_enabled);

+ 1 - 1
core/script_language.h

@@ -43,7 +43,7 @@ typedef void (*ScriptEditRequestFunction)(const String &p_path);
 class ScriptServer {
 class ScriptServer {
 	enum {
 	enum {
 
 
-		MAX_LANGUAGES = 4
+		MAX_LANGUAGES = 16
 	};
 	};
 
 
 	static ScriptLanguage *_languages[MAX_LANGUAGES];
 	static ScriptLanguage *_languages[MAX_LANGUAGES];

+ 31 - 0
drivers/unix/os_unix.cpp

@@ -54,6 +54,7 @@
 #endif
 #endif
 #include "global_config.h"
 #include "global_config.h"
 #include <assert.h>
 #include <assert.h>
+#include <dlfcn.h>
 #include <errno.h>
 #include <errno.h>
 #include <poll.h>
 #include <poll.h>
 #include <signal.h>
 #include <signal.h>
@@ -435,6 +436,36 @@ String OS_Unix::get_locale() const {
 	return locale;
 	return locale;
 }
 }
 
 
+Error OS_Unix::open_dynamic_library(const String p_path, void *&p_library_handle) {
+	p_library_handle = dlopen(p_path.utf8().get_data(), RTLD_NOW);
+	if (!p_library_handle) {
+		ERR_EXPLAIN("Can't open dynamic library: " + p_path + ". Error: " + dlerror());
+		ERR_FAIL_V(ERR_CANT_OPEN);
+	}
+	return OK;
+}
+
+Error OS_Unix::close_dynamic_library(void *p_library_handle) {
+	if (dlclose(p_library_handle)) {
+		return FAILED;
+	}
+	return OK;
+}
+
+Error OS_Unix::get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle) {
+	char *error;
+	dlerror(); // Clear existing errors
+
+	p_symbol_handle = dlsym(p_library_handle, p_name.utf8().get_data());
+
+	error = dlerror();
+	if (error != NULL) {
+		ERR_EXPLAIN("Can't resolve symbol " + p_name + ". Error: " + error);
+		ERR_FAIL_V(ERR_CANT_RESOLVE);
+	}
+	return OK;
+}
+
 Error OS_Unix::set_cwd(const String &p_cwd) {
 Error OS_Unix::set_cwd(const String &p_cwd) {
 
 
 	if (chdir(p_cwd.utf8().get_data()) != 0)
 	if (chdir(p_cwd.utf8().get_data()) != 0)

+ 4 - 0
drivers/unix/os_unix.h

@@ -82,6 +82,10 @@ public:
 	//virtual VideoMode get_video_mode() const;
 	//virtual VideoMode get_video_mode() const;
 	//virtual void get_fullscreen_mode_list(List<VideoMode> *p_list) const;
 	//virtual void get_fullscreen_mode_list(List<VideoMode> *p_list) const;
 
 
+	virtual Error open_dynamic_library(const String p_path, void *&p_library_handle);
+	virtual Error close_dynamic_library(void *p_library_handle);
+	virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle);
+
 	virtual Error set_cwd(const String &p_cwd);
 	virtual Error set_cwd(const String &p_cwd);
 
 
 	virtual String get_name();
 	virtual String get_name();

+ 0 - 7
modules/cscript/SCsub

@@ -1,7 +0,0 @@
-#!/usr/bin/env python
-
-Import('env')
-
-env.add_source_files(env.modules_sources, "*.cpp")
-
-Export('env')

+ 0 - 29
modules/cscript/godot_c.cpp

@@ -1,29 +0,0 @@
-/*************************************************************************/
-/*  godot_c.cpp                                                          */
-/*************************************************************************/
-/*                       This file is part of:                           */
-/*                           GODOT ENGINE                                */
-/*                    http://www.godotengine.org                         */
-/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur.                 */
-/*                                                                       */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the       */
-/* "Software"), to deal in the Software without restriction, including   */
-/* without limitation the rights to use, copy, modify, merge, publish,   */
-/* distribute, sublicense, and/or sell copies of the Software, and to    */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions:                                             */
-/*                                                                       */
-/* The above copyright notice and this permission notice shall be        */
-/* included in all copies or substantial portions of the Software.       */
-/*                                                                       */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
-/*************************************************************************/
-#include "godot_c.h"

+ 0 - 567
modules/cscript/godot_c.h

@@ -1,567 +0,0 @@
-/*************************************************************************/
-/*  godot_c.h                                                            */
-/*************************************************************************/
-/*                       This file is part of:                           */
-/*                           GODOT ENGINE                                */
-/*                    http://www.godotengine.org                         */
-/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur.                 */
-/*                                                                       */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the       */
-/* "Software"), to deal in the Software without restriction, including   */
-/* without limitation the rights to use, copy, modify, merge, publish,   */
-/* distribute, sublicense, and/or sell copies of the Software, and to    */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions:                                             */
-/*                                                                       */
-/* The above copyright notice and this permission notice shall be        */
-/* included in all copies or substantial portions of the Software.       */
-/*                                                                       */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
-/*************************************************************************/
-#ifndef GODOT_C_H
-#define GODOT_C_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(GDAPI_BUILT_IN) || !defined(WINDOWS_ENABLED)
-#define GDAPI
-#elif defined(GDAPI_EXPORTS)
-#define GDAPI __declspec(dllexport)
-#else
-#define GDAPI __declspec(dllimport)
-#endif
-
-#define GODOT_API_VERSION 1
-
-typedef int godot_bool;
-
-#define GODOT_FALSE 0
-#define GODOT_TRUE 1
-
-////// Image
-
-#define GODOT_IMAGE_FORMAT_GRAYSCALE 0
-#define GODOT_IMAGE_FORMAT_INTENSITY 1
-#define GODOT_IMAGE_FORMAT_GRAYSCALE_ALPHA 2
-#define GODOT_IMAGE_FORMAT_RGB 3
-#define GODOT_IMAGE_FORMAT_RGBA 4
-#define GODOT_IMAGE_FORMAT_INDEXED 5
-#define GODOT_IMAGE_FORMAT_INDEXED_ALPHA 6
-#define GODOT_IMAGE_FORMAT_YUV_422 7
-#define GODOT_IMAGE_FORMAT_YUV_444 8
-#define GODOT_IMAGE_FORMAT_BC1 9
-#define GODOT_IMAGE_FORMAT_BC2 10
-#define GODOT_IMAGE_FORMAT_BC3 11
-#define GODOT_IMAGE_FORMAT_BC4 12
-#define GODOT_IMAGE_FORMAT_BC5 13
-#define GODOT_IMAGE_FORMAT_PVRTC2 14
-#define GODOT_IMAGE_FORMAT_PVRTC2_ALPHA 15
-#define GODOT_IMAGE_FORMAT_PVRTC4 16
-#define GODOT_IMAGE_FORMAT_PVRTC4_ALPHA 17
-#define GODOT_IMAGE_FORMAT_ETC 18
-#define GODOT_IMAGE_FORMAT_ATC 19
-#define GODOT_IMAGE_FORMAT_ATC_ALPHA_EXPLICIT 20
-#define GODOT_IMAGE_FORMAT_ATC_ALPHA_INTERPOLATED 21
-
-typedef void *godot_image;
-
-godot_image GDAPI godot_image_create_empty();
-godot_image GDAPI godot_image_create(int p_width, int p_height, int p_format, int p_use_mipmaps);
-godot_image GDAPI godot_image_create_with_data(int p_width, int p_height, int p_format, int p_use_mipmaps, unsigned char *p_buffer);
-int GDAPI godot_image_get_width(godot_image p_image);
-int GDAPI godot_image_get_height(godot_image p_image);
-int GDAPI godot_image_get_format(godot_image p_image);
-int GDAPI godot_image_get_mipmap_count(godot_image p_image);
-godot_image GDAPI godot_image_copy(godot_image p_image);
-void GDAPI godot_image_free(godot_image p_image);
-
-////// RID
-
-typedef void *godot_rid;
-
-godot_rid GDAPI godot_rid_create();
-godot_rid GDAPI godot_rid_copy(godot_rid p_rid);
-void GDAPI godot_rid_free(godot_rid p_rid);
-
-////// Variant (forward declared)
-
-typedef void *godot_variant;
-
-////// Dictionary
-
-typedef void *godot_dictionary;
-
-godot_dictionary GDAPI godot_dictionary_create();
-void GDAPI godot_dictionary_has(godot_dictionary p_dictionary, godot_variant p_key);
-godot_variant GDAPI godot_dictionary_get(godot_dictionary p_dictionary, godot_variant p_key);
-void GDAPI godot_dictionary_insert(godot_dictionary p_dictionary, godot_variant p_key, godot_variant p_value);
-void GDAPI godot_dictionary_remove(godot_dictionary p_dictionary, godot_variant p_key);
-void GDAPI godot_dictionary_clear(godot_dictionary p_dictionary);
-int GDAPI godot_dictionary_get_size(godot_dictionary p_dictionary);
-void GDAPI godot_dictionary_get_keys(godot_dictionary p_dictionary, godot_variant *p_keys);
-godot_dictionary GDAPI godot_dictionary_copy(godot_dictionary p_dictionary);
-void GDAPI godot_dictionary_free(godot_dictionary p_dictionary);
-
-////// Array
-
-typedef void *godot_array;
-
-godot_array GDAPI godot_array_create();
-godot_variant GDAPI godot_array_get(godot_array p_array, int p_index);
-void GDAPI godot_array_set(godot_array p_array, int p_index, godot_variant p_value);
-void GDAPI godot_array_resize(godot_array p_array, int p_size);
-void GDAPI godot_array_insert(godot_array p_array, int p_position, godot_variant p_value);
-void GDAPI godot_array_remove(godot_array p_array, int p_position);
-void GDAPI godot_array_clear(godot_array p_array);
-int GDAPI godot_array_get_size(godot_array p_array);
-int GDAPI godot_array_find(godot_array p_array, godot_variant p_value, int p_from_pos = -1);
-godot_array GDAPI godot_array_copy(godot_array p_array);
-void GDAPI godot_array_free(godot_array p_array);
-
-////// InputEvent
-
-#define INPUT_EVENT_BUTTON_LEFT 1
-#define INPUT_EVENT_BUTTON_RIGHT 2
-#define INPUT_EVENT_BUTTON_MIDDLE 3
-#define INPUT_EVENT_BUTTON_WHEEL_UP 4
-#define INPUT_EVENT_BUTTON_WHEEL_DOWN 5
-#define INPUT_EVENT_BUTTON_WHEEL_LEFT 6
-#define INPUT_EVENT_BUTTON_WHEEL_RIGHT 7
-#define INPUT_EVENT_BUTTON_MASK_LEFT (1 << (INPUT_EVENT_BUTTON_LEFT - 1))
-#define INPUT_EVENT_BUTTON_MASK_RIGHT (1 << (INPUT_EVENT_BUTTON_RIGHT - 1))
-#define INPUT_EVENT_BUTTON_MASK_MIDDLE (1 << (INPUT_EVENT_BUTTON_MIDDLE - 1))
-
-#define INPUT_EVENT_TYPE_NONE 0
-#define INPUT_EVENT_TYPE_KEY 1
-#define INPUT_EVENT_TYPE_MOUSE_MOTION 2
-#define INPUT_EVENT_TYPE_MOUSE_BUTTON 3
-#define INPUT_EVENT_TYPE_JOYPAD_MOTION 4
-#define INPUT_EVENT_TYPE_JOYPAD_BUTTON 5
-#define INPUT_EVENT_TYPE_SCREEN_TOUCH 6
-#define INPUT_EVENT_TYPE_SCREEN_DRAG 7
-#define INPUT_EVENT_TYPE_ACTION 8
-
-typedef void *godot_input_event;
-
-godot_input_event GDAPI godot_input_event_create();
-godot_input_event GDAPI godot_input_event_copy(godot_input_event p_input_event);
-void GDAPI godot_input_event_free(godot_input_event p_input_event);
-
-int GDAPI godot_input_event_get_type(godot_input_event p_event);
-int GDAPI godot_input_event_get_device(godot_input_event p_event);
-
-godot_bool GDAPI godot_input_event_mod_has_alt(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_mod_has_ctrl(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_mod_has_command(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_mod_has_shift(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_mod_has_meta(godot_input_event p_event);
-
-int GDAPI godot_input_event_key_get_scancode(godot_input_event p_event);
-int GDAPI godot_input_event_key_get_unicode(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_key_is_pressed(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_key_is_echo(godot_input_event p_event);
-
-int GDAPI godot_input_event_mouse_get_x(godot_input_event p_event);
-int GDAPI godot_input_event_mouse_get_y(godot_input_event p_event);
-int GDAPI godot_input_event_mouse_get_global_x(godot_input_event p_event);
-int GDAPI godot_input_event_mouse_get_global_y(godot_input_event p_event);
-int GDAPI godot_input_event_mouse_get_button_mask(godot_input_event p_event);
-
-int GDAPI godot_input_event_mouse_button_get_button_index(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_mouse_button_is_pressed(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_mouse_button_is_doubleclick(godot_input_event p_event);
-
-int GDAPI godot_input_event_mouse_motion_get_relative_x(godot_input_event p_event);
-int GDAPI godot_input_event_mouse_motion_get_relative_y(godot_input_event p_event);
-
-int GDAPI godot_input_event_mouse_motion_get_speed_x(godot_input_event p_event);
-int GDAPI godot_input_event_mouse_motion_get_speed_y(godot_input_event p_event);
-
-int GDAPI godot_input_event_joypad_motion_get_axis(godot_input_event p_event);
-float GDAPI godot_input_event_joypad_motion_get_axis_value(godot_input_event p_event);
-
-int GDAPI godot_input_event_joypad_button_get_button_index(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_joypad_button_is_pressed(godot_input_event p_event);
-float GDAPI godot_input_event_joypad_button_get_pressure(godot_input_event p_event);
-
-int GDAPI godot_input_event_screen_touch_get_index(godot_input_event p_event);
-int GDAPI godot_input_event_screen_touch_get_x(godot_input_event p_event);
-int GDAPI godot_input_event_screen_touch_get_y(godot_input_event p_event);
-int GDAPI godot_input_event_screen_touch_is_pressed(godot_input_event p_event);
-
-int GDAPI godot_input_event_screen_drag_get_index(godot_input_event p_event);
-int GDAPI godot_input_event_screen_drag_get_x(godot_input_event p_event);
-int GDAPI godot_input_event_screen_drag_get_y(godot_input_event p_event);
-int GDAPI godot_input_event_screen_drag_get_relative_x(godot_input_event p_event);
-int GDAPI godot_input_event_screen_drag_get_relative_y(godot_input_event p_event);
-int GDAPI godot_input_event_screen_drag_get_speed_x(godot_input_event p_event);
-int GDAPI godot_input_event_screen_drag_get_speed_y(godot_input_event p_event);
-
-int GDAPI godot_input_event_is_action(godot_input_event p_event, char *p_action);
-int GDAPI godot_input_event_is_action_pressed(godot_input_event p_event, char *p_action);
-
-////// ByteArray
-
-typedef void *godot_byte_array;
-
-godot_byte_array GDAPI godot_byte_array_create();
-godot_byte_array GDAPI godot_byte_array_copy(godot_byte_array p_byte_array);
-void GDAPI godot_byte_array_free(godot_byte_array p_byte_array);
-
-int GDAPI godot_byte_array_get_size(godot_byte_array p_byte_array);
-unsigned char GDAPI godot_byte_array_get(godot_byte_array p_byte_array, int p_index);
-void GDAPI godot_byte_array_set(godot_byte_array p_byte_array, int p_index, unsigned char p_value);
-void GDAPI godot_byte_array_remove(godot_byte_array p_byte_array, int p_index);
-void GDAPI godot_byte_array_clear(godot_byte_array p_byte_array);
-
-typedef void *godot_byte_array_lock;
-
-godot_byte_array_lock GDAPI godot_byte_array_get_lock(godot_byte_array p_byte_array);
-unsigned char GDAPI *godot_byte_array_lock_get_pointer(godot_byte_array_lock p_byte_array_lock);
-void GDAPI godot_byte_array_lock_free(godot_byte_array_lock p_byte_array_lock);
-
-godot_image GDAPI godot_image_create_with_array(int p_width, int p_height, int p_format, int p_use_mipmaps, godot_array p_array);
-godot_byte_array GDAPI godot_image_get_data(godot_image p_image);
-
-////// IntArray
-
-typedef void *godot_int_array;
-
-godot_int_array GDAPI godot_int_array_create();
-godot_int_array GDAPI godot_int_array_copy(godot_int_array p_int_array);
-void GDAPI godot_int_array_free(godot_int_array p_int_array);
-
-int GDAPI godot_int_array_get_size(godot_int_array p_int_array);
-int GDAPI godot_int_array_get(godot_int_array p_int_array, int p_index);
-void GDAPI godot_int_array_set(godot_int_array p_int_array, int p_index, int p_value);
-void GDAPI godot_int_array_remove(godot_int_array p_int_array, int p_index);
-void GDAPI godot_int_array_clear(godot_int_array p_int_array);
-
-typedef void *godot_int_array_lock;
-
-godot_int_array_lock GDAPI godot_int_array_get_lock(godot_int_array p_int_array);
-int GDAPI *godot_int_array_lock_get_pointer(godot_int_array_lock p_int_array_lock);
-void GDAPI godot_int_array_lock_free(godot_int_array_lock p_int_array_lock);
-
-////// RealArray
-
-typedef void *godot_real_array;
-
-godot_real_array GDAPI godot_real_array_create();
-godot_real_array GDAPI godot_real_array_copy(godot_real_array p_real_array);
-void GDAPI godot_real_array_free(godot_real_array p_real_array);
-
-int GDAPI godot_real_array_get_size(godot_real_array p_real_array);
-float GDAPI godot_real_array_get(godot_real_array p_real_array, int p_index);
-void GDAPI godot_real_array_set(godot_real_array p_real_array, int p_index, float p_value);
-void GDAPI godot_real_array_remove(godot_real_array p_real_array, int p_index);
-void GDAPI godot_real_array_clear(godot_real_array p_real_array);
-
-typedef void *godot_real_array_lock;
-
-godot_real_array_lock GDAPI godot_real_array_get_lock(godot_real_array p_real_array);
-float GDAPI *godot_real_array_lock_get_pointer(godot_real_array_lock p_real_array_lock);
-void GDAPI godot_real_array_lock_free(godot_real_array_lock p_real_array_lock);
-
-////// StringArray
-
-typedef void *godot_string_array;
-
-godot_string_array GDAPI godot_string_array_create();
-godot_string_array GDAPI godot_string_array_copy(godot_string_array p_string_array);
-void GDAPI godot_string_array_free(godot_string_array p_string_array);
-
-int GDAPI godot_string_array_get_size(godot_string_array p_string_array);
-int GDAPI godot_string_array_get(godot_string_array p_string_array, int p_index, unsigned char *p_string, int p_max_len);
-void GDAPI godot_string_array_set(godot_string_array p_string_array, int p_index, unsigned char *p_string);
-void GDAPI godot_string_array_remove(godot_string_array p_string_array, int p_index);
-void GDAPI godot_string_array_clear(godot_string_array p_string_array);
-
-////// Vector2Array
-
-typedef void *godot_vector2_array;
-
-godot_vector2_array GDAPI godot_vector2_array_create();
-godot_vector2_array GDAPI godot_vector2_array_copy(godot_vector2_array p_vector2_array);
-void GDAPI godot_vector2_array_free(godot_vector2_array p_vector2_array);
-
-int GDAPI godot_vector2_array_get_size(godot_vector2_array p_vector2_array);
-int GDAPI godot_vector2_array_get_stride(godot_vector2_array p_vector2_array);
-void GDAPI godot_vector2_array_get(godot_vector2_array p_vector2_array, int p_index, float *p_vector2);
-void GDAPI godot_vector2_array_set(godot_vector2_array p_vector2_array, int p_index, float *p_vector2);
-void GDAPI godot_vector2_array_remove(godot_vector2_array p_vector2_array, int p_index);
-void GDAPI godot_vector2_array_clear(godot_vector2_array p_vector2_array);
-
-typedef void *godot_vector2_array_lock;
-
-godot_vector2_array_lock GDAPI godot_vector2_array_get_lock(godot_vector2_array p_vector2_array);
-float GDAPI *godot_vector2_array_lock_get_pointer(godot_vector2_array_lock p_vector2_array_lock);
-void GDAPI godot_vector2_array_lock_free(godot_vector2_array_lock p_vector2_array_lock);
-
-////// Vector3Array
-
-typedef void *godot_vector3_array;
-
-godot_vector3_array GDAPI godot_vector3_array_create();
-godot_vector3_array GDAPI godot_vector3_array_copy(godot_vector3_array p_vector3_array);
-void GDAPI godot_vector3_array_free(godot_vector3_array p_vector3_array);
-
-int GDAPI godot_vector3_array_get_size(godot_vector3_array p_vector3_array);
-int GDAPI godot_vector3_array_get_stride(godot_vector3_array p_vector3_array);
-void GDAPI godot_vector3_array_get(godot_vector3_array p_vector3_array, int p_index, float *p_vector3);
-void GDAPI godot_vector3_array_set(godot_vector3_array p_vector3_array, int p_index, float *p_vector3);
-void GDAPI godot_vector3_array_remove(godot_vector3_array p_vector3_array, int p_index);
-void GDAPI godot_vector3_array_clear(godot_vector3_array p_vector3_array);
-
-typedef void *godot_vector3_array_lock;
-
-godot_vector3_array_lock GDAPI godot_vector3_array_get_lock(godot_vector3_array p_vector3_array);
-float GDAPI *godot_vector3_array_lock_get_pointer(godot_vector3_array_lock p_vector3_array_lock);
-void GDAPI godot_vector3_array_lock_free(godot_vector3_array_lock p_vector3_array_lock);
-
-////// ColorArray
-
-typedef void *godot_color_array;
-
-godot_color_array GDAPI godot_color_array_create();
-godot_color_array GDAPI godot_color_array_copy(godot_color_array p_color_array);
-void GDAPI godot_color_array_free(godot_color_array p_color_array);
-
-int GDAPI godot_color_array_get_size(godot_color_array p_color_array);
-int GDAPI godot_color_array_get_stride(godot_color_array p_color_array);
-void GDAPI godot_color_array_get(godot_color_array p_color_array, int p_index, float *p_color);
-void GDAPI godot_color_array_set(godot_color_array p_color_array, int p_index, float *p_color);
-void GDAPI godot_color_array_remove(godot_color_array p_color_array, int p_index);
-void GDAPI godot_color_array_clear(godot_color_array p_color_array);
-
-typedef void *godot_color_array_lock;
-
-godot_color_array_lock GDAPI godot_color_array_get_lock(godot_color_array p_color_array);
-float GDAPI *godot_color_array_lock_get_pointer(godot_color_array_lock p_color_array_lock);
-void GDAPI godot_color_array_lock_free(godot_color_array_lock p_color_array_lock);
-
-////// Instance (forward declared)
-
-typedef void *godot_instance;
-
-////// Variant
-
-#define GODOT_VARIANT_NIL 0
-#define GODOT_VARIANT_BOOL 1
-#define GODOT_VARIANT_INT 2
-#define GODOT_VARIANT_REAL 3
-#define GODOT_VARIANT_STRING 4
-#define GODOT_VARIANT_VECTOR2 5
-#define GODOT_VARIANT_RECT2 6
-#define GODOT_VARIANT_VECTOR3 7
-#define GODOT_VARIANT_MATRIX32 8
-#define GODOT_VARIANT_PLANE 9
-#define GODOT_VARIANT_QUAT 10
-#define GODOT_VARIANT_AABB 11
-#define GODOT_VARIANT_MATRIX3 12
-#define GODOT_VARIANT_TRANSFORM 13
-#define GODOT_VARIANT_COLOR 14
-#define GODOT_VARIANT_IMAGE 15
-#define GODOT_VARIANT_NODE_PATH 16
-#define GODOT_VARIANT_RID 17
-#define GODOT_VARIANT_OBJECT 18
-#define GODOT_VARIANT_INPUT_EVENT 19
-#define GODOT_VARIANT_DICTIONARY 20
-#define GODOT_VARIANT_ARRAY 21
-#define GODOT_VARIANT_BYTE_ARRAY 22
-#define GODOT_VARIANT_INT_ARRAY 23
-#define GODOT_VARIANT_REAL_ARRAY 24
-#define GODOT_VARIANT_STRING_ARRAY 25
-#define GODOT_VARIANT_VECTOR2_ARRAY 26
-#define GODOT_VARIANT_VECTOR3_ARRAY 27
-#define GODOT_VARIANT_COLOR_ARRAY 28
-#define GODOT_VARIANT_MAX 29
-
-godot_variant *godot_variant_new();
-
-int GDAPI godot_variant_get_type(godot_variant p_variant);
-
-void GDAPI godot_variant_set_null(godot_variant p_variant);
-void GDAPI godot_variant_set_bool(godot_variant p_variant, godot_bool p_bool);
-void GDAPI godot_variant_set_int(godot_variant p_variant, int p_int);
-void GDAPI godot_variant_set_float(godot_variant p_variant, int p_float);
-void GDAPI godot_variant_set_string(godot_variant p_variant, char *p_string);
-void GDAPI godot_variant_set_vector2(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_set_rect2(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_set_vector3(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_set_matrix32(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_set_plane(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_set_aabb(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_set_matrix3(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_set_transform(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_set_color(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_set_image(godot_variant p_variant, godot_image *p_image);
-void GDAPI godot_variant_set_node_path(godot_variant p_variant, char *p_path);
-void GDAPI godot_variant_set_rid(godot_variant p_variant, char *p_path);
-void GDAPI godot_variant_set_instance(godot_variant p_variant, godot_instance p_instance);
-void GDAPI godot_variant_set_input_event(godot_variant p_variant, godot_input_event p_instance);
-void GDAPI godot_variant_set_dictionary(godot_variant p_variant, godot_dictionary p_dictionary);
-void GDAPI godot_variant_set_array(godot_variant p_variant, godot_array p_array);
-void GDAPI godot_variant_set_byte_array(godot_variant p_variant, godot_byte_array p_array);
-void GDAPI godot_variant_set_int_array(godot_variant p_variant, godot_byte_array p_array);
-void GDAPI godot_variant_set_string_array(godot_variant p_variant, godot_string_array p_array);
-void GDAPI godot_variant_set_vector2_array(godot_variant p_variant, godot_vector2_array p_array);
-void GDAPI godot_variant_set_vector3_array(godot_variant p_variant, godot_vector3_array p_array);
-void GDAPI godot_variant_set_color_array(godot_variant p_variant, godot_color_array p_array);
-
-godot_bool GDAPI godot_variant_get_bool(godot_variant p_variant);
-int GDAPI godot_variant_get_int(godot_variant p_variant);
-float GDAPI godot_variant_get_float(godot_variant p_variant);
-int GDAPI godot_variant_get_string(godot_variant p_variant, char *p_string, int p_bufsize);
-void GDAPI godot_variant_get_vector2(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_get_rect2(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_get_vector3(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_get_matrix32(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_get_plane(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_get_aabb(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_get_matrix3(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_get_transform(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_get_color(godot_variant p_variant, float *p_elems);
-godot_image GDAPI *godot_variant_get_image(godot_variant p_variant);
-int GDAPI godot_variant_get_node_path(godot_variant p_variant, char *p_path, int p_bufsize);
-godot_rid GDAPI godot_variant_get_rid(godot_variant p_variant);
-godot_instance GDAPI godot_variant_get_instance(godot_variant p_variant);
-void GDAPI godot_variant_get_input_event(godot_variant p_variant, godot_input_event);
-void GDAPI godot_variant_get_dictionary(godot_variant p_variant, godot_dictionary);
-godot_array GDAPI godot_variant_get_array(godot_variant p_variant);
-godot_byte_array GDAPI godot_variant_get_byte_array(godot_variant p_variant);
-godot_byte_array GDAPI godot_variant_get_int_array(godot_variant p_variant);
-godot_string_array GDAPI godot_variant_get_string_array(godot_variant p_variant);
-godot_vector2_array GDAPI godot_variant_get_vector2_array(godot_variant p_variant);
-godot_vector3_array GDAPI godot_variant_get_vector3_array(godot_variant p_variant);
-godot_color_array GDAPI godot_variant_get_color_array(godot_variant p_variant);
-
-void GDAPI godot_variant_delete(godot_variant p_variant);
-
-////// Class
-///
-
-char GDAPI **godot_class_get_list(); //get list of classes in array to array of strings, must be freed, use godot_list_free()
-
-int GDAPI godot_class_get_base(char *p_class, char *p_base, int p_max_len);
-int GDAPI godot_class_get_name(char *p_class, char *p_base, int p_max_len);
-
-char GDAPI **godot_class_get_method_list(char *p_class); //free with godot_list_free()
-int GDAPI godot_class_method_get_argument_count(char *p_class, char *p_method);
-int GDAPI godot_class_method_get_argument_type(char *p_class, char *p_method, int p_argument);
-godot_variant GDAPI godot_class_method_get_argument_default_value(char *p_class, char *p_method, int p_argument);
-
-char GDAPI **godot_class_get_constant_list(char *p_class); //free with godot_list_free()
-int GDAPI godot_class_constant_get_value(char *p_class, char *p_constant);
-
-////// Instance
-
-typedef int godot_call_error;
-
-#define GODOT_CALL_OK
-#define GODOT_CALL_ERROR_WRONG_ARGUMENTS
-#define GODOT_CALL_ERROR_INVALID_INSTANCE
-
-godot_instance GDAPI godot_instance_new(char *p_class);
-int GDAPI godot_instance_get_class(godot_instance p_instance, char *p_class, int p_max_len);
-
-typedef struct {
-	char *name;
-	int hint;
-	char *hint_string;
-	int usage;
-} godot_property_info;
-
-godot_call_error GDAPI godot_instance_call(godot_instance p_instance, char *p_method, ...);
-godot_call_error GDAPI godot_instance_call_ret(godot_instance p_instance, godot_variant r_return, char *p_method, ...);
-godot_bool GDAPI godot_instance_set(godot_instance p_instance, char *p_prop, godot_variant p_value);
-godot_variant GDAPI godot_instance_get(godot_instance p_instance, char *p_prop);
-
-#define GODOT_PROPERTY_HINT_NONE 0 ///< no hint provided.
-#define GODOT_PROPERTY_HINT_RANGE 1 ///< hint_text = "min,max,step,slider; //slider is optional"
-#define GODOT_PROPERTY_HINT_EXP_RANGE 2 ///< hint_text = "min,max,step", exponential edit
-#define GODOT_PROPERTY_HINT_ENUM 3 ///< hint_text= "val1,val2,val3,etc"
-#define GODOT_PROPERTY_HINT_EXP_EASING 4 /// exponential easing function (Math::ease)
-#define GODOT_PROPERTY_HINT_LENGTH 5 ///< hint_text= "length" (as integer)
-#define GODOT_PROPERTY_HINT_SPRITE_FRAME 6
-#define GODOT_PROPERTY_HINT_KEY_ACCEL 7 ///< hint_text= "length" (as integer)
-#define GODOT_PROPERTY_HINT_FLAGS 8 ///< hint_text= "flag1,flag2,etc" (as bit flags)
-#define GODOT_PROPERTY_HINT_ALL_FLAGS 9
-#define GODOT_PROPERTY_HINT_FILE 10 ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,"
-#define GODOT_PROPERTY_HINT_DIR 11 ///< a directort path must be passed
-#define GODOT_PROPERTY_HINT_GLOBAL_FILE 12 ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,"
-#define GODOT_PROPERTY_HINT_GLOBAL_DIR 13 ///< a directort path must be passed
-#define GODOT_PROPERTY_HINT_RESOURCE_TYPE 14 ///< a resource object type
-#define GODOT_PROPERTY_HINT_MULTILINE_TEXT 15 ///< used for string properties that can contain multiple lines
-#define GODOT_PROPERTY_HINT_COLOR_NO_ALPHA 16 ///< used for ignoring alpha component when editing a color
-#define GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSY 17
-#define GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS 18
-#define GODOT_PROPERTY_HINT_OBJECT_ID 19
-
-#define GODOT_PROPERTY_USAGE_STORAGE 1
-#define GODOT_PROPERTY_USAGE_EDITOR 2
-#define GODOT_PROPERTY_USAGE_NETWORK 4
-#define GODOT_PROPERTY_USAGE_EDITOR_HELPER 8
-#define GODOT_PROPERTY_USAGE_CHECKABLE 16 //used for editing global variables
-#define GODOT_PROPERTY_USAGE_CHECKED 32 //used for editing global variables
-#define GODOT_PROPERTY_USAGE_INTERNATIONALIZED 64 //hint for internationalized strings
-#define GODOT_PROPERTY_USAGE_BUNDLE 128 //used for optimized bundles
-#define GODOT_PROPERTY_USAGE_CATEGORY 256
-#define GODOT_PROPERTY_USAGE_STORE_IF_NONZERO 512 //only store if nonzero
-#define GODOT_PROPERTY_USAGE_STORE_IF_NONONE 1024 //only store if false
-#define GODOT_PROPERTY_USAGE_NO_INSTANCE_STATE 2048
-#define GODOT_PROPERTY_USAGE_RESTART_IF_CHANGED 4096
-#define GODOT_PROPERTY_USAGE_SCRIPT_VARIABLE 8192
-#define GODOT_PROPERTY_USAGE_STORE_IF_NULL 16384
-#define GODOT_PROPERTY_USAGE_ANIMATE_AS_TRIGGER 32768
-
-#define GODOT_PROPERTY_USAGE_DEFAULT GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_EDITOR | GODOT_PROPERTY_USAGE_NETWORK
-#define GODOT_PROPERTY_USAGE_DEFAULT_INTL GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_EDITOR | GODOT_PROPERTY_USAGE_NETWORK | GODOT_PROPERTY_USAGE_INTERNATIONALIZED
-#define GODOT_PROPERTY_USAGE_NOEDITOR GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_NETWORK
-
-godot_property_info GDAPI **godot_instance_get_property_list(godot_instance p_instance);
-void GDAPI godot_instance_free_property_list(godot_instance p_instance, godot_property_info **p_list);
-
-void GDAPI godot_list_free(char **p_name); //helper to free all the class list
-
-////// Script API
-
-typedef void *(godot_script_instance_func)(godot_instance); //passed an instance, return a pointer to your userdata
-typedef void(godot_script_free_func)(godot_instance, void *); //passed an instance, please free your userdata
-
-void GDAPI godot_script_register(char *p_base, char *p_name, godot_script_instance_func p_instance_func, godot_script_free_func p_free_func);
-void GDAPI godot_script_unregister(char *p_name);
-
-typedef GDAPI godot_variant(godot_script_func)(godot_instance, void *, godot_variant *, int); //instance,userdata,arguments,argument count. Return something or NULL. Arguments must not be freed.
-
-void GDAPI godot_script_add_function(char *p_name, char *p_function_name, godot_script_func p_func);
-void GDAPI godot_script_add_validated_function(char *p_name, char *p_function_name, godot_script_func p_func, int *p_arg_types, int p_arg_count, godot_variant *p_default_args, int p_default_arg_count);
-
-typedef void(godot_set_property_func)(godot_instance, void *, godot_variant); //instance,userdata,value. Value must not be freed.
-typedef godot_variant(godot_get_property_func)(godot_instance, void *); //instance,userdata. Return a value or NULL.
-
-void GDAPI godot_script_add_property(char *p_name, char *p_path, godot_set_property_func p_set_func, godot_get_property_func p_get_func);
-void GDAPI godot_script_add_listed_property(char *p_name, char *p_path, godot_set_property_func p_set_func, godot_get_property_func p_get_func, int p_type, int p_hint, char *p_hint_string, int p_usage);
-
-////// System Functions
-
-//using these will help Godot track how much memory is in use in debug mode
-void GDAPI *godot_alloc(int p_bytes);
-void GDAPI *godot_realloc(void *p_ptr, int p_bytes);
-void GDAPI godot_free(void *p_ptr);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // GODOT_C_H

+ 14 - 0
modules/dlscript/SCsub

@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+
+Import('env')
+
+env.add_source_files(env.modules_sources, "*.cpp")
+env.add_source_files(env.modules_sources, "godot/*.cpp")
+
+env.Append(CPPFLAGS=['-DGDAPI_BUILT_IN'])
+
+if "platform" in env and env["platform"] == "x11": # there has to be a better solution?
+    env.Append(LINKFLAGS=["-rdynamic"])
+env.use_ptrcall = True
+
+Export('env')

+ 382 - 0
modules/dlscript/api_generator.cpp

@@ -0,0 +1,382 @@
+#include "api_generator.h"
+
+#include "class_db.h"
+#include "core/global_config.h"
+#include "os/file_access.h"
+
+// helper stuff
+
+static Error save_file(const String &p_path, const List<String> &p_content) {
+
+	FileAccessRef file = FileAccess::open(p_path, FileAccess::WRITE);
+
+	ERR_FAIL_COND_V(!file, ERR_FILE_CANT_WRITE);
+
+	for (const List<String>::Element *e = p_content.front(); e != NULL; e = e->next()) {
+		file->store_string(e->get());
+	}
+
+	file->close();
+
+	return OK;
+}
+
+// helper stuff end
+
+struct MethodAPI {
+	String method_name;
+	String return_type;
+
+	List<String> argument_types;
+	List<String> argument_names;
+
+	Map<int, Variant> default_arguments;
+
+	int argument_count;
+	bool has_varargs;
+	bool is_editor;
+	bool is_noscript;
+	bool is_const;
+	bool is_reverse;
+	bool is_virtual;
+	bool is_from_script;
+};
+
+struct PropertyAPI {
+	String name;
+	String getter;
+	String setter;
+	String type;
+};
+
+struct ConstantAPI {
+	String constant_name;
+	int constant_value;
+};
+
+struct SignalAPI {
+	String name;
+	List<String> argument_types;
+	List<String> argument_names;
+	Map<int, Variant> default_arguments;
+};
+
+struct ClassAPI {
+	String class_name;
+	String super_class_name;
+
+	ClassDB::APIType api_type;
+
+	bool is_singleton;
+	bool is_instanciable;
+	// @Unclear
+	bool is_creatable;
+	// @Unclear
+	bool memory_own;
+
+	List<MethodAPI> methods;
+	List<PropertyAPI> properties;
+	List<ConstantAPI> constants;
+	List<SignalAPI> signals_;
+};
+
+/*
+ * Reads the entire Godot API to a list
+ */
+List<ClassAPI> generate_c_api_classes() {
+
+	List<ClassAPI> api;
+
+	List<StringName> classes;
+	ClassDB::get_class_list(&classes);
+
+	for (List<StringName>::Element *e = classes.front(); e != NULL; e = e->next()) {
+		StringName class_name = e->get();
+
+		ClassAPI class_api;
+		class_api.api_type = ClassDB::get_api_type(e->get());
+		class_api.class_name = class_name;
+		class_api.super_class_name = ClassDB::get_parent_class(class_name);
+		{
+			String name = class_name;
+			if (name.begins_with("_")) {
+				name.remove(0);
+			}
+			class_api.is_singleton = GlobalConfig::get_singleton()->has_singleton(name);
+		}
+		class_api.is_instanciable = !class_api.is_singleton && ClassDB::can_instance(class_name);
+
+		{
+			bool is_reference = false;
+			List<StringName> inheriters;
+			ClassDB::get_inheriters_from_class("Reference", &inheriters);
+			is_reference = inheriters.find(class_name) < 0;
+			// @Unclear
+			class_api.memory_own = !class_api.is_singleton && is_reference;
+		}
+
+		// constants
+		{
+			List<String> constant;
+			ClassDB::get_integer_constant_list(class_name, &constant, true);
+			for (List<String>::Element *c = constant.front(); c != NULL; c = c->next()) {
+				ConstantAPI constant_api;
+				constant_api.constant_name = c->get();
+				constant_api.constant_value = ClassDB::get_integer_constant(class_name, c->get());
+
+				class_api.constants.push_back(constant_api);
+			}
+		}
+
+		// signals
+		{
+			List<MethodInfo> signals_;
+			ClassDB::get_signal_list(class_name, &signals_, true);
+
+			for (int i = 0; i < signals_.size(); i++) {
+				SignalAPI signal;
+
+				MethodInfo method_info = signals_[i];
+				signal.name = method_info.name;
+
+				for (int j = 0; j < method_info.arguments.size(); j++) {
+					PropertyInfo argument = method_info.arguments[j];
+					String type;
+					String name = argument.name;
+
+					if (argument.name.find(":") != -1) {
+						type = argument.name.get_slice(":", 1);
+						name = argument.name.get_slice(":", 0);
+					} else if (argument.hint == PROPERTY_HINT_RESOURCE_TYPE) {
+						type = argument.hint_string;
+					} else if (argument.type == Variant::NIL) {
+						type = "Variant";
+					} else {
+						type = Variant::get_type_name(argument.type);
+					}
+
+					signal.argument_names.push_back(name);
+					signal.argument_types.push_back(type);
+				}
+
+				Vector<Variant> default_arguments = method_info.default_arguments;
+
+				int default_start = signal.argument_names.size() - default_arguments.size();
+
+				for (int j = 0; j < default_arguments.size(); j++) {
+					signal.default_arguments[default_start + j] = default_arguments[j];
+				}
+
+				class_api.signals_.push_back(signal);
+			}
+		}
+
+		//properties
+		{
+			List<PropertyInfo> properties;
+			ClassDB::get_property_list(class_name, &properties, true);
+
+			for (List<PropertyInfo>::Element *p = properties.front(); p != NULL; p = p->next()) {
+				PropertyAPI property_api;
+
+				property_api.name = p->get().name;
+				property_api.getter = ClassDB::get_property_getter(class_name, p->get().name);
+				property_api.setter = ClassDB::get_property_setter(class_name, p->get().name);
+
+				if (p->get().name.find(":") != -1) {
+					property_api.type = p->get().name.get_slice(":", 1);
+					property_api.name = p->get().name.get_slice(":", 0);
+				} else if (p->get().hint == PROPERTY_HINT_RESOURCE_TYPE) {
+					property_api.type = p->get().hint_string;
+				} else if (p->get().type == Variant::NIL) {
+					property_api.type = "Variant";
+				} else {
+					property_api.type = Variant::get_type_name(p->get().type);
+				}
+
+				if (!property_api.setter.empty() || !property_api.getter.empty()) {
+					class_api.properties.push_back(property_api);
+				}
+			}
+		}
+
+		//methods
+		{
+			List<MethodInfo> methods;
+			ClassDB::get_method_list(class_name, &methods, true);
+
+			for (List<MethodInfo>::Element *m = methods.front(); m != NULL; m = m->next()) {
+				MethodAPI method_api;
+				MethodBind *method_bind = ClassDB::get_method(class_name, m->get().name);
+				MethodInfo &method_info = m->get();
+
+				//method name
+				method_api.method_name = m->get().name;
+				//method return type
+				if (method_bind && method_bind->get_return_type() != StringName()) {
+					method_api.return_type = method_bind->get_return_type();
+				} else if (method_api.method_name.find(":") != -1) {
+					method_api.return_type = method_api.method_name.get_slice(":", 1);
+					method_api.method_name = method_api.method_name.get_slice(":", 0);
+				} else if (m->get().return_val.type != Variant::NIL) {
+					method_api.return_type = m->get().return_val.hint == PROPERTY_HINT_RESOURCE_TYPE ? m->get().return_val.hint_string : Variant::get_type_name(m->get().return_val.type);
+				} else {
+					method_api.return_type = "void";
+				}
+
+				method_api.argument_count = method_info.arguments.size();
+				method_api.has_varargs = method_bind && method_bind->is_vararg();
+
+				// Method flags
+				if (method_bind && method_bind->get_hint_flags()) {
+					const uint32_t flags = method_bind->get_hint_flags();
+					method_api.is_editor = flags & METHOD_FLAG_EDITOR;
+					method_api.is_noscript = flags & METHOD_FLAG_NOSCRIPT;
+					method_api.is_const = flags & METHOD_FLAG_CONST;
+					method_api.is_reverse = flags & METHOD_FLAG_REVERSE;
+					method_api.is_virtual = flags & METHOD_FLAG_VIRTUAL;
+					method_api.is_from_script = flags & METHOD_FLAG_FROM_SCRIPT;
+				}
+
+				// method argument name and type
+
+				for (int i = 0; i < method_api.argument_count; i++) {
+					String arg_name;
+					String arg_type;
+					PropertyInfo arg_info = method_info.arguments[i];
+
+					arg_name = arg_info.name;
+
+					if (arg_info.name.find(":") != -1) {
+						arg_type = arg_info.name.get_slice(":", 1);
+						arg_name = arg_info.name.get_slice(":", 0);
+					} else if (arg_info.hint == PROPERTY_HINT_RESOURCE_TYPE) {
+						arg_type = arg_info.hint_string;
+					} else if (arg_info.type == Variant::NIL) {
+						arg_type = "Variant";
+					} else {
+						arg_type = Variant::get_type_name(arg_info.type);
+					}
+
+					method_api.argument_names.push_back(arg_name);
+					method_api.argument_types.push_back(arg_type);
+
+					if (method_bind && method_bind->has_default_argument(i)) {
+						method_api.default_arguments[i] = method_bind->get_default_argument(i);
+					}
+				}
+
+				class_api.methods.push_back(method_api);
+			}
+		}
+
+		api.push_back(class_api);
+	}
+
+	return api;
+}
+
+/*
+ * Generates the JSON source from the API in p_api
+ */
+static List<String> generate_c_api_json(const List<ClassAPI> &p_api) {
+
+	// I'm sorry for the \t mess
+
+	List<String> source;
+
+	source.push_back("[\n");
+
+	for (const List<ClassAPI>::Element *c = p_api.front(); c != NULL; c = c->next()) {
+		ClassAPI api = c->get();
+
+		source.push_back("\t{\n");
+
+		source.push_back("\t\t\"name\": \"" + api.class_name + "\",\n");
+		source.push_back("\t\t\"base_class\": \"" + api.super_class_name + "\",\n");
+		source.push_back(String("\t\t\"api_type\": \"") + (api.api_type == ClassDB::API_CORE ? "core" : (api.api_type == ClassDB::API_EDITOR ? "tools" : "none")) + "\",\n");
+		source.push_back(String("\t\t\"singleton\": ") + (api.is_singleton ? "true" : "false") + ",\n");
+		source.push_back(String("\t\t\"instanciable\": ") + (api.is_instanciable ? "true" : "false") + ",\n");
+		// @Unclear
+		// source.push_back(String("\t\t\"createable\": ") + (api.is_creatable ? "true" : "false") + ",\n");
+
+		source.push_back("\t\t\"constants\": {\n");
+		for (List<ConstantAPI>::Element *e = api.constants.front(); e; e = e->next()) {
+			source.push_back("\t\t\t\"" + e->get().constant_name + "\": " + String::num_int64(e->get().constant_value) + (e->next() ? "," : "") + "\n");
+		}
+		source.push_back("\t\t},\n");
+
+		source.push_back("\t\t\"properties\": [\n");
+		for (List<PropertyAPI>::Element *e = api.properties.front(); e; e = e->next()) {
+			source.push_back("\t\t\t{\n");
+			source.push_back("\t\t\t\t\"name\": \"" + e->get().name + "\",\n");
+			source.push_back("\t\t\t\t\"type\": \"" + e->get().type + "\",\n");
+			source.push_back("\t\t\t\t\"getter\": \"" + e->get().getter + "\",\n");
+			source.push_back("\t\t\t\t\"setter\": \"" + e->get().setter + "\"\n");
+			source.push_back(String("\t\t\t}") + (e->next() ? "," : "") + "\n");
+		}
+		source.push_back("\t\t],\n");
+
+		source.push_back("\t\t\"signals\": [\n");
+		for (List<SignalAPI>::Element *e = api.signals_.front(); e; e = e->next()) {
+			source.push_back("\t\t\t{\n");
+			source.push_back("\t\t\t\t\"name\": \"" + e->get().name + "\",\n");
+			source.push_back("\t\t\t\t\"arguments\": [\n");
+			for (int i = 0; i < e->get().argument_names.size(); i++) {
+				source.push_back("\t\t\t\t\t{\n");
+				source.push_back("\t\t\t\t\t\t\"name\": \"" + e->get().argument_names[i] + "\",\n");
+				source.push_back("\t\t\t\t\t\t\"type\": \"" + e->get().argument_types[i] + "\",\n");
+				source.push_back("\t\t\t\t\t\t\"default_value\": \"" + (e->get().default_arguments.has(i) ? (String)e->get().default_arguments[i] : "") + "\"\n");
+				source.push_back(String("\t\t\t\t\t}") + ((i < e->get().argument_names.size() - 1) ? "," : "") + "\n");
+			}
+			source.push_back("\t\t\t\t]\n");
+			source.push_back(String("\t\t\t}") + (e->next() ? "," : "") + "\n");
+		}
+		source.push_back("\t\t],\n");
+
+		source.push_back("\t\t\"methods\": [\n");
+		for (List<MethodAPI>::Element *e = api.methods.front(); e; e = e->next()) {
+			source.push_back("\t\t\t{\n");
+			source.push_back("\t\t\t\t\"name\": \"" + e->get().method_name + "\",\n");
+			source.push_back("\t\t\t\t\"return_type\": \"" + e->get().return_type + "\",\n");
+			source.push_back(String("\t\t\t\t\"is_editor\": ") + (e->get().is_editor ? "true" : "false") + ",\n");
+			source.push_back(String("\t\t\t\t\"is_noscript\": ") + (e->get().is_noscript ? "true" : "false") + ",\n");
+			source.push_back(String("\t\t\t\t\"is_const\": ") + (e->get().is_const ? "true" : "false") + ",\n");
+			source.push_back(String("\t\t\t\t\"is_reverse\": ") + (e->get().is_reverse ? "true" : "false") + ",\n");
+			source.push_back(String("\t\t\t\t\"is_virtual\": ") + (e->get().is_virtual ? "true" : "false") + ",\n");
+			source.push_back(String("\t\t\t\t\"is_from_script\": ") + (e->get().is_from_script ? "true" : "false") + ",\n");
+			source.push_back("\t\t\t\t\"arguments\": [\n");
+			for (int i = 0; i < e->get().argument_names.size(); i++) {
+				source.push_back("\t\t\t\t\t{\n");
+				source.push_back("\t\t\t\t\t\t\"name\": \"" + e->get().argument_names[i] + "\",\n");
+				source.push_back("\t\t\t\t\t\t\"type\": \"" + e->get().argument_types[i] + "\",\n");
+				source.push_back("\t\t\t\t\t\t\"default_value\": \"" + (e->get().default_arguments.has(i) ? (String)e->get().default_arguments[i] : "") + "\"\n");
+				source.push_back(String("\t\t\t\t\t}") + ((i < e->get().argument_names.size() - 1) ? "," : "") + "\n");
+			}
+			source.push_back("\t\t\t\t]\n");
+			source.push_back(String("\t\t\t}") + (e->next() ? "," : "") + "\n");
+		}
+		source.push_back("\t\t]\n");
+
+		source.push_back(String("\t}") + (c->next() ? "," : "") + "\n");
+	}
+
+	source.push_back("]");
+
+	return source;
+}
+
+//
+
+/*
+ * Saves the whole Godot API to a JSON file located at
+ *  p_path
+ */
+Error generate_c_api(const String &p_path) {
+
+	List<ClassAPI> api = generate_c_api_classes();
+
+	List<String> json_source = generate_c_api_json(api);
+
+	return save_file(p_path, json_source);
+}

+ 9 - 0
modules/dlscript/api_generator.h

@@ -0,0 +1,9 @@
+#ifndef API_GENERATOR_H
+#define API_GENERATOR_H
+
+#include "core/ustring.h"
+#include "typedefs.h"
+
+Error generate_c_api(const String &p_path);
+
+#endif // API_GENERATOR_H

+ 1 - 1
modules/cscript/config.py → modules/dlscript/config.py

@@ -5,4 +5,4 @@ def can_build(platform):
 
 
 
 
 def configure(env):
 def configure(env):
-    pass
+    env.use_ptrcall = True

+ 1048 - 0
modules/dlscript/dl_script.cpp

@@ -0,0 +1,1048 @@
+/*************************************************************************/
+/*  dl_script.cpp                                                        */
+/*************************************************************************/
+/*                       This file is part of:                           */
+/*                           GODOT ENGINE                                */
+/*                    http://www.godotengine.org                         */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur.                 */
+/*                                                                       */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the       */
+/* "Software"), to deal in the Software without restriction, including   */
+/* without limitation the rights to use, copy, modify, merge, publish,   */
+/* distribute, sublicense, and/or sell copies of the Software, and to    */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions:                                             */
+/*                                                                       */
+/* The above copyright notice and this permission notice shall be        */
+/* included in all copies or substantial portions of the Software.       */
+/*                                                                       */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
+/*************************************************************************/
+#include "dl_script.h"
+
+#include "global_config.h"
+#include "global_constants.h"
+#include "io/file_access_encrypted.h"
+#include "os/file_access.h"
+#include "os/os.h"
+
+#include "scene/resources/scene_format_text.h"
+
+#ifdef TOOLS_ENABLED
+// #include "editor/editor_import_export.h"
+#endif
+
+#if defined(TOOLS_ENABLED) && defined(DEBUG_METHODS_ENABLED)
+#include "api_generator.h"
+#endif
+
+// Script
+
+bool DLScript::can_instance() const {
+#ifdef DLSCRIPT_EDITOR_FEATURES
+	return script_data || (!is_tool() && !ScriptServer::is_scripting_enabled());
+#else
+	// allow defaultlibrary without editor features
+	if (!library.is_valid()) {
+		String path = GLOBAL_GET("dlscript/default_dllibrary");
+
+		RES lib = ResourceLoader::load(path);
+
+		if (lib.is_valid() && lib->cast_to<DLLibrary>()) {
+			return true;
+		}
+	}
+
+	return script_data;
+#endif
+	//return script_data || (!tool && !ScriptServer::is_scripting_enabled());
+	// change to true enable in editor stuff.
+}
+
+Ref<Script> DLScript::get_base_script() const {
+	Ref<DLScript> base_script;
+	base_script->library = library;
+	base_script->script_data = script_data;
+	base_script->script_name = script_data->base;
+	return base_script;
+}
+
+StringName DLScript::get_instance_base_type() const {
+	return script_data->base_native_type;
+}
+
+ScriptInstance *DLScript::instance_create(Object *p_this) {
+
+#ifdef TOOLS_ENABLED
+
+// find a good way to initialize stuff in the editor
+#ifdef DLSCRIPT_EDITOR_FEATURES
+	if (!ScriptServer::is_scripting_enabled() && !is_tool()) {
+		// placeholder, for nodes. But for tools we want the real thing
+
+		PlaceHolderScriptInstance *sins = memnew(PlaceHolderScriptInstance(DLScriptLanguage::singleton, Ref<Script>((Script *)this), p_this));
+		placeholders.insert(sins);
+
+		List<PropertyInfo> pinfo;
+		Map<StringName, Variant> values;
+
+		if (!library.is_valid())
+			return sins;
+
+		if (!library->library_handle) {
+			Error err = library->_initialize_handle(true);
+			if (err != OK) {
+				return sins;
+			}
+		}
+
+		if (!script_data) {
+			script_data = library->get_script_data(script_name);
+		}
+		if (script_data)
+			script_data->create_func.create_func((godot_object *)p_this, script_data->create_func.method_data);
+
+		if (script_data) {
+			for (Map<StringName, DLScriptData::Property>::Element *E = script_data->properties.front(); E; E = E->next()) {
+
+				PropertyInfo p = E->get().info;
+				p.name = String(E->key());
+				pinfo.push_back(p);
+				values[p.name] = E->get().default_value;
+			}
+		}
+
+		sins->update(pinfo, values);
+
+		return sins;
+	}
+#endif
+
+#endif
+
+	if (!library.is_valid()) {
+		String path = GLOBAL_GET("dlscript/default_dllibrary");
+
+		RES lib = ResourceLoader::load(path);
+
+		if (lib.is_valid() && lib->cast_to<DLLibrary>()) {
+			set_library(lib);
+		}
+	}
+
+	DLInstance *new_instance = memnew(DLInstance);
+
+	new_instance->owner = p_this;
+	new_instance->script = Ref<DLScript>(this);
+
+#ifndef DLSCRIPT_EDITOR_FEATURES
+	if (!ScriptServer::is_scripting_enabled()) {
+		new_instance->userdata = 0;
+	} else {
+		new_instance->userdata = script_data->create_func.create_func((godot_object *)p_this, script_data->create_func.method_data);
+	}
+#else
+	new_instance->userdata = script_data->create_func.create_func((godot_object *)p_this, script_data->create_func.method_data);
+#endif
+
+	instances.insert(p_this);
+	return new_instance;
+}
+
+bool DLScript::instance_has(const Object *p_this) const {
+	return instances.has((Object *)p_this); // TODO
+}
+
+bool DLScript::has_source_code() const {
+	return false;
+}
+
+String DLScript::get_source_code() const {
+	return "";
+}
+
+Error DLScript::reload(bool p_keep_state) {
+	return FAILED;
+}
+
+bool DLScript::has_method(const StringName &p_method) const {
+	if (!script_data)
+		return false;
+	return script_data->methods.has(p_method);
+}
+
+MethodInfo DLScript::get_method_info(const StringName &p_method) const {
+	if (!script_data)
+		return MethodInfo();
+	ERR_FAIL_COND_V(!script_data->methods.has(p_method), MethodInfo());
+	return script_data->methods[p_method].info;
+}
+
+void DLScript::get_script_method_list(List<MethodInfo> *p_list) const {
+	if (!script_data) return;
+	for (Map<StringName, DLScriptData::Method>::Element *E = script_data->methods.front(); E; E = E->next()) {
+		p_list->push_back(E->get().info);
+	}
+}
+
+void DLScript::get_script_property_list(List<PropertyInfo> *p_list) const {
+	if (!script_data) return;
+	for (Map<StringName, DLScriptData::Property>::Element *E = script_data->properties.front(); E; E = E->next()) {
+		p_list->push_back(E->get().info);
+	}
+}
+
+bool DLScript::get_property_default_value(const StringName &p_property, Variant &r_value) const {
+	if (!script_data) return false;
+	if (script_data->properties.has(p_property)) {
+		r_value = script_data->properties[p_property].default_value;
+		return true;
+	}
+	return false;
+}
+
+bool DLScript::is_tool() const {
+	ERR_FAIL_COND_V(!script_data, false);
+	return script_data->is_tool;
+}
+
+String DLScript::get_node_type() const {
+	return ""; // ?
+}
+
+ScriptLanguage *DLScript::get_language() const {
+	return DLScriptLanguage::singleton;
+}
+
+bool DLScript::has_script_signal(const StringName &p_signal) const {
+	if (!script_data)
+		return false;
+	return script_data->signals_.has(p_signal);
+}
+
+void DLScript::get_script_signal_list(List<MethodInfo> *r_signals) const {
+	if (!script_data)
+		return;
+	for (Map<StringName, DLScriptData::Signal>::Element *S = script_data->signals_.front(); S; S = S->next()) {
+		r_signals->push_back(S->get().signal);
+	}
+}
+
+Ref<DLLibrary> DLScript::get_library() const {
+	return library;
+}
+
+void DLScript::set_library(Ref<DLLibrary> p_library) {
+	library = p_library;
+
+#ifdef TOOLS_ENABLED
+	if (!ScriptServer::is_scripting_enabled())
+		return;
+#endif
+	if (library.is_valid()) {
+		Error initalize_status = library->_initialize_handle(!ScriptServer::is_scripting_enabled());
+		ERR_FAIL_COND(initalize_status != OK);
+		if (script_name) {
+			script_data = library->get_script_data(script_name);
+			ERR_FAIL_COND(!script_data);
+		}
+	}
+}
+
+StringName DLScript::get_script_name() const {
+	return script_name;
+}
+
+void DLScript::set_script_name(StringName p_script_name) {
+	script_name = p_script_name;
+
+	if (library.is_valid()) {
+		script_data = library->get_script_data(script_name);
+		ERR_FAIL_COND(!script_data);
+	}
+}
+
+void DLScript::_bind_methods() {
+	ClassDB::bind_method(D_METHOD("get_library"), &DLScript::get_library);
+	ClassDB::bind_method(D_METHOD("set_library", "library"), &DLScript::set_library);
+	ClassDB::bind_method(D_METHOD("get_script_name"), &DLScript::get_script_name);
+	ClassDB::bind_method(D_METHOD("set_script_name", "script_name"), &DLScript::set_script_name);
+
+	ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "DLLibrary"), "set_library", "get_library");
+	ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "script_name"), "set_script_name", "get_script_name");
+}
+
+DLScript::DLScript() {
+	script_data = NULL;
+}
+
+DLScript::~DLScript() {
+	//hmm
+}
+
+// Library
+
+DLLibrary *DLLibrary::currently_initialized_library = NULL;
+
+DLLibrary *DLLibrary::get_currently_initialized_library() {
+	return currently_initialized_library;
+}
+
+static const char *_dl_platforms_info[] = {
+	"|unix|so|Unix",
+	"unix|x11|so|X11",
+	"unix|server|so|Server",
+	"unix|android|so|Android",
+	"unix|blackberry|so|Blackberry 10",
+	"unix|haiku|so|Haiku", // Right?
+	"|mac|dynlib|Mac",
+	"mac|ios|dynlib|iOS",
+	"mac|osx|dynlib|OSX",
+	"|html5|js|HTML5",
+	"|windows|dll|Windows",
+	"windows|uwp|dll|UWP",
+	NULL // Finishing condition
+};
+
+void DLLibrary::set_platform_file(StringName p_platform, String p_file) {
+	if (p_file.empty()) {
+		platform_files.erase(p_platform);
+	} else {
+		platform_files[p_platform] = p_file;
+	}
+}
+
+String DLLibrary::get_platform_file(StringName p_platform) const {
+	if (platform_files.has(p_platform)) {
+		return platform_files[p_platform];
+	} else {
+		return "";
+	}
+}
+
+Error DLLibrary::_initialize_handle(bool p_in_editor) {
+	_THREAD_SAFE_METHOD_
+
+	void *_library_handle;
+
+	// Get the file
+
+	const String platform_name = OS::get_singleton()->get_name();
+	String platform_file("");
+	char **platform_info = (char **)_dl_platforms_info;
+
+	if (platform_files.has(platform_name.to_lower())) {
+		platform_file = platform_files[platform_name.to_lower()];
+	}
+
+	while (*platform_info) {
+		String platform_info_string(*platform_info);
+
+		if (platform_name == platform_info_string.get_slicec('|', 3)) {
+			String platform_key = platform_info_string.get_slicec('|', 1);
+			String fallback_platform_key = platform_info_string.get_slicec('|', 0);
+
+			if (platform_files.has(platform_key)) {
+				platform_file = platform_files[platform_key];
+			} else if (!fallback_platform_key.empty() && platform_files.has(fallback_platform_key)) {
+				platform_file = platform_files[fallback_platform_key];
+			} else {
+				return ERR_UNAVAILABLE;
+			}
+		}
+		platform_info++;
+	}
+	ERR_FAIL_COND_V(platform_file == "", ERR_DOES_NOT_EXIST);
+
+	library_path = GlobalConfig::get_singleton()->globalize_path(platform_file);
+
+	if (DLScriptLanguage::get_singleton()->is_library_initialized(library_path)) {
+		*this = *DLScriptLanguage::get_singleton()->get_library_dllibrary(library_path);
+		return OK;
+	}
+
+	// Open the file
+
+	Error error;
+	error = OS::get_singleton()->open_dynamic_library(library_path, _library_handle);
+	if (error) return error;
+	ERR_FAIL_COND_V(!_library_handle, ERR_BUG);
+
+	// Get the method
+
+	void *library_init;
+	error = OS::get_singleton()->get_dynamic_library_symbol_handle(_library_handle, DLScriptLanguage::get_init_symbol_name(), library_init);
+	if (error) return error;
+	ERR_FAIL_COND_V(!library_init, ERR_BUG);
+
+	DLLibrary::currently_initialized_library = this;
+
+	void (*library_init_fpointer)(godot_dlscript_init_options *) = (void (*)(godot_dlscript_init_options *))library_init;
+
+	godot_dlscript_init_options options;
+
+	options.in_editor = p_in_editor;
+	options.core_api_hash = ClassDB::get_api_hash(ClassDB::API_CORE);
+	options.editor_api_hash = ClassDB::get_api_hash(ClassDB::API_EDITOR);
+	options.no_api_hash = ClassDB::get_api_hash(ClassDB::API_NONE);
+
+	library_init_fpointer(&options); // Catch errors?
+	/*{
+		ERR_EXPLAIN("Couldn't initialize library");
+		ERR_FAIL_V(ERR_SCRIPT_FAILED);
+	}*/
+
+	DLLibrary::currently_initialized_library = NULL;
+	library_handle = _library_handle;
+
+	DLScriptLanguage::get_singleton()->set_library_initialized(library_path, this);
+
+	return OK;
+}
+
+Error DLLibrary::_free_handle(bool p_in_editor) {
+	ERR_FAIL_COND_V(!library_handle, ERR_BUG);
+
+	if (!DLScriptLanguage::get_singleton()->is_library_initialized(library_path)) {
+		OS::get_singleton()->close_dynamic_library(library_handle);
+		library_handle = 0;
+		return OK;
+	}
+
+	Error error = OK;
+	void *library_terminate;
+	error = OS::get_singleton()->get_dynamic_library_symbol_handle(library_handle, DLScriptLanguage::get_terminate_symbol_name(), library_terminate);
+	if (error)
+		return OK; // no terminate? okay, not that important lol
+
+	void (*library_terminate_pointer)(godot_dlscript_terminate_options *) = (void (*)(godot_dlscript_terminate_options *))library_terminate;
+
+	godot_dlscript_terminate_options options;
+	options.in_editor = p_in_editor;
+
+	library_terminate_pointer(&options);
+
+	DLScriptLanguage::get_singleton()->set_library_uninitialized(library_path);
+
+	OS::get_singleton()->close_dynamic_library(library_handle);
+	library_handle = 0;
+
+	return OK;
+}
+
+void DLLibrary::_register_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func) {
+	ERR_FAIL_COND(scripts.has(p_name));
+
+	DLScriptData *s = memnew(DLScriptData);
+	s->base = p_base;
+	s->create_func = p_instance_func;
+	s->destroy_func = p_destroy_func;
+	Map<StringName, DLScriptData *>::Element *E = scripts.find(p_base);
+	if (E) {
+		s->base_data = E->get();
+		s->base_native_type = s->base_data->base_native_type;
+	} else {
+		if (!ClassDB::class_exists(p_base)) {
+			memdelete(s);
+			ERR_EXPLAIN("Invalid base for registered type '" + p_name + "'");
+			ERR_FAIL();
+		}
+		s->base_native_type = p_base;
+	}
+
+	scripts.insert(p_name, s);
+}
+
+void DLLibrary::_register_tool_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func) {
+	ERR_FAIL_COND(scripts.has(p_name));
+
+	DLScriptData *s = memnew(DLScriptData);
+	s->base = p_base;
+	s->create_func = p_instance_func;
+	s->destroy_func = p_destroy_func;
+	s->is_tool = true;
+	Map<StringName, DLScriptData *>::Element *E = scripts.find(p_base);
+	if (E) {
+		s->base_data = E->get();
+		s->base_native_type = s->base_data->base_native_type;
+	} else {
+		if (!ClassDB::class_exists(p_base)) {
+			memdelete(s);
+			ERR_EXPLAIN("Invalid base for registered type '" + p_name + "'");
+			ERR_FAIL();
+		}
+		s->base_native_type = p_base;
+	}
+
+	scripts.insert(p_name, s);
+}
+
+void DLLibrary::_register_script_method(const StringName p_name, const StringName p_method, godot_method_attributes p_attr, godot_instance_method p_func, MethodInfo p_info) {
+	ERR_FAIL_COND(!scripts.has(p_name));
+
+	p_info.name = p_method;
+	DLScriptData::Method method;
+
+	method = DLScriptData::Method(p_func, p_info, p_attr.rpc_type);
+
+	scripts[p_name]->methods.insert(p_method, method);
+}
+
+void DLLibrary::_register_script_property(const StringName p_name, const String p_path, godot_property_attributes *p_attr, godot_property_set_func p_setter, godot_property_get_func p_getter) {
+	ERR_FAIL_COND(!scripts.has(p_name));
+
+	DLScriptData::Property p;
+
+	PropertyInfo pi;
+	pi.name = p_path;
+
+	if (p_attr != NULL) {
+		pi = PropertyInfo((Variant::Type)p_attr->type, p_path, (PropertyHint)p_attr->hint, *(String *)&p_attr->hint_string, p_attr->usage);
+
+		p = DLScriptData::Property(p_setter, p_getter, pi, *(Variant *)&p_attr->default_value, p_attr->rset_type);
+	}
+
+	scripts[p_name]->properties.insert(p_path, p);
+}
+
+void DLLibrary::_register_script_signal(const StringName p_name, const godot_signal *p_signal) {
+	ERR_FAIL_COND(!scripts.has(p_name));
+	ERR_FAIL_COND(!p_signal);
+
+	DLScriptData::Signal signal;
+
+	signal.signal.name = *(String *)&p_signal->name;
+
+	{
+		List<PropertyInfo> arguments;
+		for (int i = 0; i < p_signal->num_args; i++) {
+			PropertyInfo info;
+			godot_signal_argument attrib = p_signal->args[i];
+
+			String *name = (String *)&attrib.name;
+			info.name = *name;
+			info.type = (Variant::Type)attrib.type;
+			info.hint = (PropertyHint)attrib.hint;
+			info.hint_string = *(String *)&attrib.hint_string;
+			info.usage = attrib.usage;
+
+			arguments.push_back(info);
+		}
+
+		signal.signal.arguments = arguments;
+	}
+
+	{
+		Vector<Variant> default_arguments;
+		for (int i = 0; i < p_signal->num_default_args; i++) {
+			Variant *v;
+			godot_signal_argument attrib = p_signal->args[i];
+
+			v = (Variant *)&attrib.default_value;
+
+			default_arguments.push_back(*v);
+		}
+
+		signal.signal.default_arguments = default_arguments;
+	}
+
+	scripts[p_name]->signals_.insert(*(String *)&p_signal->name, signal);
+}
+
+DLScriptData *DLLibrary::get_script_data(const StringName p_name) {
+
+	if (!scripts.has(p_name)) {
+		if (DLScriptLanguage::get_singleton()->is_library_initialized(library_path)) {
+			_update_library(*DLScriptLanguage::get_singleton()->get_library_dllibrary(library_path));
+		}
+		ERR_FAIL_COND_V(!scripts.has(p_name), NULL);
+	}
+
+	return scripts[p_name];
+}
+
+bool DLLibrary::_set(const StringName &p_name, const Variant &p_value) {
+	String name = p_name;
+	if (name.begins_with("platform/")) {
+		set_platform_file(name.get_slice("/", 1), p_value);
+		return true;
+	}
+	return false;
+}
+
+bool DLLibrary::_get(const StringName &p_name, Variant &r_ret) const {
+	String name = p_name;
+	if (name.begins_with("platform/")) {
+		r_ret = get_platform_file(name.get_slice("/", 1));
+		return true;
+	}
+	return false;
+}
+
+void DLLibrary::_get_property_list(List<PropertyInfo> *p_list) const {
+	char **platform_info = (char **)_dl_platforms_info;
+
+	Set<String> registered_platform_names;
+	{
+		List<StringName> ep;
+		// ep.push_back("X11");
+		// EditorImportExport::get_singleton()->get_export_platforms(&ep);
+		for (List<StringName>::Element *E = ep.front(); E; E = E->next()) {
+			registered_platform_names.insert(String(E->get()).to_lower());
+		}
+	}
+
+	while (*platform_info) {
+		String platform_info_string(*platform_info);
+		String fallback_platform_key = platform_info_string.get_slicec('|', 0);
+		String platform_key = platform_info_string.get_slicec('|', 1);
+		String platform_extension = platform_info_string.get_slicec('|', 2);
+		String platform_name = platform_info_string.get_slicec('|', 3);
+
+		registered_platform_names.erase(platform_name);
+
+		if (fallback_platform_key.empty()) {
+			p_list->push_back(PropertyInfo(Variant::STRING, "platform/" + platform_key, PROPERTY_HINT_FILE, "*." + platform_extension));
+
+		} else {
+			if (platform_files.has(platform_key)) {
+				p_list->push_back(PropertyInfo(Variant::STRING, "platform/" + platform_key, PROPERTY_HINT_FILE, "*." + platform_extension, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_CHECKABLE | PROPERTY_USAGE_CHECKED));
+			} else {
+				p_list->push_back(PropertyInfo(Variant::STRING, "platform/" + platform_key, PROPERTY_HINT_FILE, "*." + platform_extension, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_CHECKABLE));
+			}
+		}
+		platform_info++;
+	}
+
+	while (registered_platform_names.size()) {
+		const String platform_name = registered_platform_names.front()->get();
+		registered_platform_names.erase(platform_name);
+		p_list->push_back(PropertyInfo(Variant::STRING, "platform/" + platform_name.to_lower(), PROPERTY_HINT_FILE, "*"));
+	}
+}
+
+void DLLibrary::_notification(int what) {
+	// TODO
+}
+
+void DLLibrary::_bind_methods() {
+	ClassDB::bind_method(D_METHOD("set_platform_file", "platform", "file"), &DLLibrary::set_platform_file);
+	ClassDB::bind_method(D_METHOD("get_platform_file", "platform"), &DLLibrary::get_platform_file);
+}
+
+DLLibrary::DLLibrary() {
+	library_handle = NULL;
+}
+
+DLLibrary::~DLLibrary() {
+
+	for (Map<StringName, DLScriptData *>::Element *E = scripts.front(); E; E = E->next()) {
+		for (Map<StringName, DLScriptData::Method>::Element *M = E->get()->methods.front(); M; M = M->next()) {
+			if (M->get().method.free_func) {
+				M->get().method.free_func(M->get().method.method_data);
+			}
+		}
+		memdelete(E->get());
+	}
+
+	if (library_handle) {
+		bool in_editor = false;
+#ifdef TOOLS_ENABLED
+		in_editor = !ScriptServer::is_scripting_enabled();
+#endif
+		_free_handle(in_editor);
+	}
+}
+
+// Instance
+
+bool DLInstance::set(const StringName &p_name, const Variant &p_value) {
+	if (!script->script_data)
+		return false;
+	if (script->script_data->properties.has(p_name)) {
+		script->script_data->properties[p_name].setter.set_func((godot_object *)owner, script->script_data->properties[p_name].setter.method_data, userdata, *(godot_variant *)&p_value);
+		return true;
+	}
+	return false;
+}
+
+bool DLInstance::get(const StringName &p_name, Variant &r_ret) const {
+	if (!script->script_data)
+		return false;
+	if (script->script_data->properties.has(p_name)) {
+		godot_variant value = script->script_data->properties[p_name].getter.get_func((godot_object *)owner, script->script_data->properties[p_name].getter.method_data, userdata);
+		r_ret = *(Variant *)&value;
+		return true;
+	}
+	return false;
+}
+
+void DLInstance::get_property_list(List<PropertyInfo> *p_properties) const {
+	script->get_script_property_list(p_properties);
+	// TODO: dynamic properties
+}
+
+Variant::Type DLInstance::get_property_type(const StringName &p_name, bool *r_is_valid) const {
+	if (script->script_data->properties.has(p_name)) {
+		*r_is_valid = true;
+		return script->script_data->properties[p_name].info.type;
+	}
+	*r_is_valid = false;
+	return Variant::NIL;
+}
+
+void DLInstance::get_method_list(List<MethodInfo> *p_list) const {
+	script->get_script_method_list(p_list);
+}
+
+bool DLInstance::has_method(const StringName &p_method) const {
+	return script->has_method(p_method);
+}
+
+Variant DLInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
+	// TODO: validated methods & errors
+
+	DLScriptData *data_ptr = script->script_data;
+	while (data_ptr) {
+		Map<StringName, DLScriptData::Method>::Element *E = data_ptr->methods.find(p_method);
+		if (E) {
+			godot_variant result = E->get().method.method((godot_object *)owner, E->get().method.method_data, userdata, p_argcount, (godot_variant **)p_args);
+			return *(Variant *)&result;
+		}
+		data_ptr = data_ptr->base_data;
+	}
+	r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
+	return Variant();
+}
+
+void DLInstance::call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount) {
+	// TODO: validated methods & errors
+
+	DLScriptData *data_ptr = script->script_data;
+	while (data_ptr) {
+		Map<StringName, DLScriptData::Method>::Element *E = data_ptr->methods.find(p_method);
+		if (E) {
+			E->get().method.method((godot_object *)owner, E->get().method.method_data, userdata, p_argcount, (godot_variant **)p_args);
+		}
+		data_ptr = data_ptr->base_data;
+	}
+}
+
+void DLInstance::_ml_call_reversed(DLScriptData *data_ptr, const StringName &p_method, const Variant **p_args, int p_argcount) {
+	// TODO: validated methods & errors
+
+	if (data_ptr->base_data)
+		_ml_call_reversed(data_ptr->base_data, p_method, p_args, p_argcount);
+
+	// Variant::CallError ce;
+
+	Map<StringName, DLScriptData::Method>::Element *E = data_ptr->methods.find(p_method);
+	if (E) {
+		E->get().method.method((godot_object *)owner, E->get().method.method_data, userdata, p_argcount, (godot_variant **)p_args);
+	}
+}
+
+void DLInstance::call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount) {
+	if (script.ptr() && script->script_data) {
+		_ml_call_reversed(script->script_data, p_method, p_args, p_argcount);
+	}
+}
+
+void DLInstance::notification(int p_notification) {
+	Variant value = p_notification;
+	const Variant *args[1] = { &value };
+	call_multilevel(DLScriptLanguage::singleton->strings._notification, args, 1);
+}
+
+Ref<Script> DLInstance::get_script() const {
+	return script;
+}
+
+ScriptLanguage *DLInstance::get_language() {
+	return DLScriptLanguage::singleton;
+}
+
+ScriptInstance::RPCMode DLInstance::get_rpc_mode(const StringName &p_method) const {
+	DLScriptData::Method m = script->script_data->methods[p_method];
+	switch (m.rpc_mode) {
+		case GODOT_METHOD_RPC_MODE_DISABLED:
+			return RPC_MODE_DISABLED;
+		case GODOT_METHOD_RPC_MODE_REMOTE:
+			return RPC_MODE_REMOTE;
+		case GODOT_METHOD_RPC_MODE_SYNC:
+			return RPC_MODE_SYNC;
+		case GODOT_METHOD_RPC_MODE_MASTER:
+			return RPC_MODE_MASTER;
+		case GODOT_METHOD_RPC_MODE_SLAVE:
+			return RPC_MODE_SLAVE;
+		default:
+			return RPC_MODE_DISABLED;
+	}
+}
+
+ScriptInstance::RPCMode DLInstance::get_rset_mode(const StringName &p_variable) const {
+	DLScriptData::Property p = script->script_data->properties[p_variable];
+	switch (p.rset_mode) {
+		case GODOT_METHOD_RPC_MODE_DISABLED:
+			return RPC_MODE_DISABLED;
+		case GODOT_METHOD_RPC_MODE_REMOTE:
+			return RPC_MODE_REMOTE;
+		case GODOT_METHOD_RPC_MODE_SYNC:
+			return RPC_MODE_SYNC;
+		case GODOT_METHOD_RPC_MODE_MASTER:
+			return RPC_MODE_MASTER;
+		case GODOT_METHOD_RPC_MODE_SLAVE:
+			return RPC_MODE_SLAVE;
+		default:
+			return RPC_MODE_DISABLED;
+	}
+}
+
+DLInstance::DLInstance() {
+	owner = NULL;
+	userdata = NULL;
+}
+
+DLInstance::~DLInstance() {
+	if (script.is_valid()) {
+		if (owner) {
+			script->instances.erase(owner);
+		}
+		if (!script->script_data)
+			return;
+		script->script_data->destroy_func.destroy_func((godot_object *)owner, script->script_data->destroy_func.method_data, userdata);
+		if (script->script_data->destroy_func.free_func)
+			script->script_data->destroy_func.free_func(script->script_data->destroy_func.method_data);
+		if (script->script_data->create_func.free_func)
+			script->script_data->create_func.free_func(script->script_data->create_func.method_data);
+	}
+}
+
+// Language
+
+DLScriptLanguage *DLScriptLanguage::singleton = NULL;
+
+String DLScriptLanguage::get_name() const {
+	return "DLScript";
+}
+
+bool DLScriptLanguage::is_library_initialized(const String &p_path) {
+
+	return initialized_libraries.has(p_path);
+}
+
+void DLScriptLanguage::set_library_initialized(const String &p_path, DLLibrary *p_dllibrary) {
+
+	initialized_libraries[p_path] = p_dllibrary;
+}
+
+DLLibrary *DLScriptLanguage::get_library_dllibrary(const String &p_path) {
+
+	return initialized_libraries[p_path];
+}
+
+void DLScriptLanguage::set_library_uninitialized(const String &p_path) {
+
+	initialized_libraries.erase(p_path);
+}
+
+void DLScriptLanguage::init() {
+	// TODO: Expose globals
+	GLOBAL_DEF("dlscript/default_dllibrary", "");
+	PropertyInfo prop_info(Variant::STRING, "dlscript/default_dllibrary", PROPERTY_HINT_FILE, "tres,res,dllib");
+	GlobalConfig::get_singleton()->set_custom_property_info("dlscript/default_dllibrary", prop_info);
+
+// generate bindings
+#if defined(TOOLS_ENABLED) && defined(DEBUG_METHODS_ENABLED)
+
+	List<String> args = OS::get_singleton()->get_cmdline_args();
+
+	List<String>::Element *E = args.find("--dlscript-generate-json-api");
+
+	if (E && E->next()) {
+		if (generate_c_api(E->next()->get()) != OK) {
+			ERR_PRINT("Failed to generate C API\n");
+		}
+	}
+#endif
+}
+
+String DLScriptLanguage::get_type() const {
+	return "DLScript";
+}
+
+String DLScriptLanguage::get_extension() const {
+	return "dl";
+}
+
+Error DLScriptLanguage::execute_file(const String &p_path) {
+	return OK; // ??
+}
+
+void DLScriptLanguage::finish() {
+	// cleanup is for noobs
+}
+
+// scons doesn't want to link in the api source so we need to call a dummy function to cause it to link
+extern "C" void _api_anchor();
+
+void DLScriptLanguage::_compile_dummy_for_the_api() {
+	_api_anchor();
+}
+
+Ref<Script> DLScriptLanguage::get_template(const String &p_class_name, const String &p_base_class_name) const {
+	DLScript *src = memnew(DLScript);
+	src->set_script_name(p_class_name);
+	return Ref<DLScript>(src);
+}
+
+bool DLScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions) const {
+	return false; // TODO
+}
+
+Script *DLScriptLanguage::create_script() const {
+	DLScript *scr = memnew(DLScript);
+	return scr;
+}
+
+bool DLScriptLanguage::has_named_classes() const {
+	return true;
+}
+
+int DLScriptLanguage::find_function(const String &p_function, const String &p_code) const {
+	return -1; // No source code!
+}
+
+String DLScriptLanguage::make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const {
+	return ""; // No source code!
+}
+
+void DLScriptLanguage::add_global_constant(const StringName &p_variable, const Variant &p_value) {
+	// TODO TODO TODO
+}
+
+// TODO: Any debugging? (research)
+String DLScriptLanguage::debug_get_error() const {
+	return "";
+}
+
+int DLScriptLanguage::debug_get_stack_level_count() const {
+	return 1; // ?
+}
+
+int DLScriptLanguage::debug_get_stack_level_line(int p_level) const {
+	return -1;
+}
+
+String DLScriptLanguage::debug_get_stack_level_function(int p_level) const {
+	return "[native code]"; // ?
+}
+
+String DLScriptLanguage::debug_get_stack_level_source(int p_level) const {
+	return "";
+}
+
+void DLScriptLanguage::debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {}
+
+void DLScriptLanguage::debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {}
+
+String DLScriptLanguage::debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems, int p_max_depth) {
+	return ""; // ??
+}
+
+void DLScriptLanguage::reload_all_scripts() {
+	// @Todo
+}
+
+void DLScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_soft_reload) {
+	// @Todo
+	OS::get_singleton()->print("reload tool scripts\n");
+}
+
+void DLScriptLanguage::get_recognized_extensions(List<String> *p_extensions) const {
+	p_extensions->push_back("dl"); // Container file format
+}
+
+void DLScriptLanguage::get_public_functions(List<MethodInfo> *p_functions) const {
+}
+
+void DLScriptLanguage::get_public_constants(List<Pair<String, Variant> > *p_constants) const {
+}
+
+// TODO: all profilling
+void DLScriptLanguage::profiling_start() {
+}
+
+void DLScriptLanguage::profiling_stop() {
+}
+
+int DLScriptLanguage::profiling_get_accumulated_data(ProfilingInfo *p_info_arr, int p_info_max) {
+	return 0;
+}
+
+int DLScriptLanguage::profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max) {
+	return 0;
+}
+
+void DLScriptLanguage::frame() {
+}
+
+String DLScriptLanguage::get_init_symbol_name() {
+	return "godot_dlscript_init"; // TODO: Maybe make some internal function which would do the actual stuff
+}
+
+String DLScriptLanguage::get_terminate_symbol_name() {
+	return "godot_dlscript_terminate";
+}
+
+DLScriptLanguage::DLScriptLanguage() {
+	ERR_FAIL_COND(singleton);
+	strings._notification = StringName("_notification");
+	singleton = this;
+	initialized_libraries = Map<String, DLLibrary *>();
+}
+
+DLScriptLanguage::~DLScriptLanguage() {
+	singleton = NULL;
+}
+
+RES ResourceFormatLoaderDLScript::load(const String &p_path, const String &p_original_path, Error *r_error) {
+	ResourceFormatLoaderText rsflt;
+	return rsflt.load(p_path, p_original_path, r_error);
+}
+
+void ResourceFormatLoaderDLScript::get_recognized_extensions(List<String> *p_extensions) const {
+	p_extensions->push_back("dl");
+}
+bool ResourceFormatLoaderDLScript::handles_type(const String &p_type) const {
+	return (p_type == "Script" || p_type == "DLScript");
+}
+String ResourceFormatLoaderDLScript::get_resource_type(const String &p_path) const {
+	String el = p_path.get_extension().to_lower();
+	if (el == "dl")
+		return "DLScript";
+	return "";
+}
+
+Error ResourceFormatSaverDLScript::save(const String &p_path, const RES &p_resource, uint32_t p_flags) {
+	ResourceFormatSaverText rfst;
+	return rfst.save(p_path, p_resource, p_flags);
+}
+
+bool ResourceFormatSaverDLScript::recognize(const RES &p_resource) const {
+	return p_resource->cast_to<DLScript>() != NULL;
+}
+
+void ResourceFormatSaverDLScript::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const {
+	if (p_resource->cast_to<DLScript>()) {
+		p_extensions->push_back("dl");
+	}
+}

+ 402 - 0
modules/dlscript/dl_script.h

@@ -0,0 +1,402 @@
+/*************************************************************************/
+/*  dl_script.h                                                          */
+/*************************************************************************/
+/*                       This file is part of:                           */
+/*                           GODOT ENGINE                                */
+/*                    http://www.godotengine.org                         */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur.                 */
+/*                                                                       */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the       */
+/* "Software"), to deal in the Software without restriction, including   */
+/* without limitation the rights to use, copy, modify, merge, publish,   */
+/* distribute, sublicense, and/or sell copies of the Software, and to    */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions:                                             */
+/*                                                                       */
+/* The above copyright notice and this permission notice shall be        */
+/* included in all copies or substantial portions of the Software.       */
+/*                                                                       */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
+/*************************************************************************/
+#ifndef DL_SCRIPT_H
+#define DL_SCRIPT_H
+
+#include "io/resource_loader.h"
+#include "io/resource_saver.h"
+#include "os/thread_safe.h"
+#include "resource.h"
+#include "script_language.h"
+#include "self_list.h"
+
+#include "godot.h"
+
+#ifdef TOOLS_ENABLED
+// #define DLSCRIPT_EDITOR_FEATURES
+#endif
+
+struct DLScriptData {
+	/* typedef void* (InstanceFunc)(godot_object* instance);
+	typedef void (DestroyFunc)(godot_object* instance,void* userdata);
+	typedef godot_variant (MethodFunc)(godot_object *instance, void *userdata, void *method_data, int arg_count,godot_variant **args);
+	typedef void (MethodDataFreeFunc)(void *method_data);
+	typedef void (SetterFunc)(godot_object* instance,void* userdata,godot_variant value);
+	typedef godot_variant (GetterFunc)(godot_object* instance,void* userdata);*/
+
+	struct Method {
+		godot_instance_method method;
+		MethodInfo info;
+		int rpc_mode;
+
+		Method() {
+		}
+		Method(godot_instance_method p_method, MethodInfo p_info, int p_rpc_mode) {
+			method = p_method;
+			info = p_info;
+			rpc_mode = p_rpc_mode;
+		}
+	};
+	struct Property {
+		godot_property_set_func setter;
+		godot_property_get_func getter;
+		PropertyInfo info;
+		Variant default_value;
+		int rset_mode;
+
+		Property() {
+		}
+		Property(godot_property_set_func p_setter, godot_property_get_func p_getter) {
+			setter = p_setter;
+			getter = p_getter;
+		}
+		Property(godot_property_set_func p_setter, godot_property_get_func p_getter, PropertyInfo p_info, Variant p_default_value, int p_rset_mode) {
+			setter = p_setter;
+			getter = p_getter;
+			info = p_info;
+			default_value = p_default_value;
+			rset_mode = p_rset_mode;
+		}
+	};
+
+	struct Signal {
+		MethodInfo signal;
+	};
+
+	Map<StringName, Method> methods;
+	Map<StringName, Property> properties;
+	Map<StringName, Signal> signals_; // QtCreator doesn't like the name signals
+	StringName base;
+	StringName base_native_type;
+	DLScriptData *base_data;
+	godot_instance_create_func create_func;
+	godot_instance_destroy_func destroy_func;
+
+	bool is_tool;
+
+	DLScriptData() {
+		base = StringName();
+		base_data = NULL;
+		is_tool = false;
+	}
+	DLScriptData(StringName p_base, godot_instance_create_func p_instance, godot_instance_destroy_func p_free) {
+		base = p_base;
+		base_data = NULL;
+		create_func = p_instance;
+		destroy_func = p_free;
+		is_tool = false;
+	}
+};
+
+class DLLibrary;
+
+class DLScript : public Script {
+
+	GDCLASS(DLScript, Script);
+
+	Ref<DLLibrary> library;
+	StringName script_name;
+	StringName base_native_type;
+	Set<Object *> instances;
+	DLScriptData *script_data;
+
+#ifdef TOOLS_ENABLED
+	Set<PlaceHolderScriptInstance *> placeholders;
+// void _update_placeholder(PlaceHolderScriptInstance *p_placeholder);
+// virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder);
+#endif
+
+	friend class DLInstance;
+	friend class DLScriptLanguage;
+
+protected:
+	static void _bind_methods();
+
+public:
+	virtual bool can_instance() const;
+
+	virtual Ref<Script> get_base_script() const; //for script inheritance
+
+	virtual StringName get_instance_base_type() const; // this may not work in all scripts, will return empty if so
+	virtual ScriptInstance *instance_create(Object *p_this);
+	virtual bool instance_has(const Object *p_this) const;
+
+	virtual bool has_source_code() const;
+	virtual String get_source_code() const;
+	virtual void set_source_code(const String &p_code) {}
+	virtual Error reload(bool p_keep_state = false);
+
+	virtual bool has_method(const StringName &p_method) const;
+	virtual MethodInfo get_method_info(const StringName &p_method) const;
+
+	virtual bool is_tool() const;
+
+	virtual String get_node_type() const;
+
+	virtual ScriptLanguage *get_language() const;
+
+	virtual bool has_script_signal(const StringName &p_signal) const;
+	virtual void get_script_signal_list(List<MethodInfo> *r_signals) const;
+
+	virtual bool get_property_default_value(const StringName &p_property, Variant &r_value) const;
+
+	virtual void update_exports() {} //editor tool
+	virtual void get_script_method_list(List<MethodInfo> *p_list) const;
+	virtual void get_script_property_list(List<PropertyInfo> *p_list) const;
+
+	Ref<DLLibrary> get_library() const;
+	void set_library(Ref<DLLibrary> p_library);
+
+	StringName get_script_name() const;
+	void set_script_name(StringName p_script_name);
+
+	DLScript();
+	~DLScript();
+};
+
+class DLLibrary : public Resource {
+	_THREAD_SAFE_CLASS_
+
+	GDCLASS(DLLibrary, Resource);
+	OBJ_SAVE_TYPE(DLLibrary);
+
+	Map<StringName, String> platform_files;
+	void *library_handle;
+	String library_path;
+	static DLLibrary *currently_initialized_library;
+	Map<StringName, DLScriptData *> scripts;
+
+protected:
+	friend class DLScript;
+	_FORCE_INLINE_ void _update_library(const DLLibrary &p_other) {
+		platform_files = p_other.platform_files;
+		library_handle = p_other.library_handle;
+		library_path = p_other.library_path;
+		scripts = p_other.scripts;
+	}
+
+	Error _initialize_handle(bool p_in_editor = false);
+
+	Error _free_handle(bool p_in_editor = false);
+
+	DLScriptData *get_script_data(const StringName p_name);
+
+	bool _set(const StringName &p_name, const Variant &p_value);
+	bool _get(const StringName &p_name, Variant &r_ret) const;
+	void _get_property_list(List<PropertyInfo> *p_list) const;
+	void _notification(int p_what);
+	static void _bind_methods();
+
+public:
+	static DLLibrary *get_currently_initialized_library();
+
+	void _register_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func);
+	void _register_tool_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func);
+	void _register_script_method(const StringName p_name, const StringName p_method, godot_method_attributes p_attr, godot_instance_method p_func, MethodInfo p_info);
+	void _register_script_property(const StringName p_name, const String p_path, godot_property_attributes *p_attr, godot_property_set_func p_setter, godot_property_get_func p_getter);
+	void _register_script_signal(const StringName p_name, const godot_signal *p_signal);
+
+	void set_platform_file(StringName p_platform, String p_file);
+	String get_platform_file(StringName p_platform) const;
+
+	DLLibrary();
+	~DLLibrary();
+};
+
+class DLInstance : public ScriptInstance {
+	friend class DLScript;
+
+	Object *owner;
+	Ref<DLScript> script;
+	void *userdata;
+
+	void _ml_call_reversed(DLScriptData *data_ptr, const StringName &p_method, const Variant **p_args, int p_argcount);
+
+public:
+	_FORCE_INLINE_ Object *get_owner() { return owner; }
+
+	virtual bool set(const StringName &p_name, const Variant &p_value);
+	virtual bool get(const StringName &p_name, Variant &r_ret) const;
+	virtual void get_property_list(List<PropertyInfo> *p_properties) const;
+	virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = NULL) const;
+
+	virtual void get_method_list(List<MethodInfo> *p_list) const;
+	virtual bool has_method(const StringName &p_method) const;
+	virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error);
+	virtual void call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount);
+	virtual void call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount);
+
+	Variant debug_get_member_by_index(int p_idx) const { return Variant(); }
+
+	virtual void notification(int p_notification);
+
+	virtual Ref<Script> get_script() const;
+
+	virtual ScriptLanguage *get_language();
+
+	void set_path(const String &p_path);
+
+	void reload_members();
+
+	virtual RPCMode get_rpc_mode(const StringName &p_method) const;
+	virtual RPCMode get_rset_mode(const StringName &p_variable) const;
+
+	DLInstance();
+	~DLInstance();
+};
+
+class DLScriptLanguage : public ScriptLanguage {
+	friend class DLScript;
+	friend class DLInstance;
+
+	static DLScriptLanguage *singleton;
+
+	Variant *_global_array; // @Unused necessary?
+	Vector<Variant> global_array; // @Unused necessary?
+	Map<StringName, int> globals; // @Unused necessary?
+
+	// @Unused necessary?
+	void _add_global(const StringName &p_name, const Variant &p_value);
+
+	Mutex *lock;
+
+	SelfList<DLScript>::List script_list;
+
+	Map<String, DLLibrary *> initialized_libraries;
+
+	bool profiling;
+	uint64_t script_frame_time;
+
+	struct {
+
+		StringName _notification;
+
+	} strings;
+
+public:
+	_FORCE_INLINE_ static DLScriptLanguage *get_singleton() { return singleton; }
+
+	virtual String get_name() const;
+
+	bool is_library_initialized(const String &p_path);
+	void set_library_initialized(const String &p_path, DLLibrary *p_dllibrary);
+	DLLibrary *get_library_dllibrary(const String &p_path);
+	void set_library_uninitialized(const String &p_path);
+
+	/* LANGUAGE FUNCTIONS */
+	virtual void init();
+	virtual String get_type() const;
+	virtual String get_extension() const;
+	virtual Error execute_file(const String &p_path);
+	virtual void finish();
+
+	/* EDITOR FUNCTIONS */
+
+	virtual void get_reserved_words(List<String> *p_words) const {};
+	virtual void get_comment_delimiters(List<String> *p_delimiters) const {};
+	virtual void get_string_delimiters(List<String> *p_delimiters) const {};
+	virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const;
+	virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_functions = NULL) const;
+	virtual Script *create_script() const;
+	virtual bool has_named_classes() const;
+	virtual int find_function(const String &p_function, const String &p_code) const;
+	virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const;
+
+	virtual Error complete_code(const String &p_code, const String &p_base_path, Object *p_owner, List<String> *r_options, String &r_call_hint) { return ERR_UNAVAILABLE; }
+
+	virtual Error lookup_code(const String &p_code, const String &p_symbol, const String &p_base_path, Object *p_owner, LookupResult &r_result) { return ERR_UNAVAILABLE; }
+
+	virtual void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const {};
+	virtual void add_global_constant(const StringName &p_variable, const Variant &p_value);
+
+	/* MULTITHREAD FUNCTIONS */
+
+	//some VMs need to be notified of thread creation/exiting to allocate a stack
+	virtual void thread_enter() {}
+	virtual void thread_exit() {}
+
+	/* DEBUGGER FUNCTIONS */
+
+	virtual String debug_get_error() const;
+	virtual int debug_get_stack_level_count() const;
+	virtual int debug_get_stack_level_line(int p_level) const;
+	virtual String debug_get_stack_level_function(int p_level) const;
+	virtual String debug_get_stack_level_source(int p_level) const;
+	virtual void debug_get_stack_level_locals(int p_level, List<String> *p_locals, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1){};
+	virtual void debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1);
+	virtual void debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1);
+	virtual String debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems = -1, int p_max_depth = -1);
+
+	virtual Vector<StackInfo> debug_get_current_stack_info() { return Vector<StackInfo>(); }
+
+	virtual void reload_all_scripts();
+	virtual void reload_tool_script(const Ref<Script> &p_script, bool p_soft_reload);
+	/* LOADER FUNCTIONS */
+
+	virtual void get_recognized_extensions(List<String> *p_extensions) const;
+	virtual void get_public_functions(List<MethodInfo> *p_functions) const;
+	virtual void get_public_constants(List<Pair<String, Variant> > *p_constants) const;
+
+	/* PROFILLER FUNCTIONS */
+
+	virtual void profiling_start();
+	virtual void profiling_stop();
+
+	virtual int profiling_get_accumulated_data(ProfilingInfo *p_info_arr, int p_info_max);
+	virtual int profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max);
+
+	virtual void frame();
+
+	static String get_init_symbol_name();
+	static String get_terminate_symbol_name();
+
+	/* HACKER FUNCTIONS */
+	void _compile_dummy_for_the_api();
+
+	DLScriptLanguage();
+	~DLScriptLanguage();
+};
+
+class ResourceFormatLoaderDLScript : public ResourceFormatLoader {
+public:
+	virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
+	virtual void get_recognized_extensions(List<String> *p_extensions) const;
+	virtual bool handles_type(const String &p_type) const;
+	virtual String get_resource_type(const String &p_path) const;
+};
+
+class ResourceFormatSaverDLScript : public ResourceFormatSaver {
+	virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0);
+	virtual bool recognize(const RES &p_resource) const;
+	virtual void get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const;
+};
+
+// ugly, but hey
+
+#endif // DL_SCRIPT_H

+ 193 - 0
modules/dlscript/godot.cpp

@@ -0,0 +1,193 @@
+/*************************************************************************/
+/*  godot_c.cpp                                                          */
+/*************************************************************************/
+/*                       This file is part of:                           */
+/*                           GODOT ENGINE                                */
+/*                    http://www.godotengine.org                         */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur.                 */
+/*                                                                       */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the       */
+/* "Software"), to deal in the Software without restriction, including   */
+/* without limitation the rights to use, copy, modify, merge, publish,   */
+/* distribute, sublicense, and/or sell copies of the Software, and to    */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions:                                             */
+/*                                                                       */
+/* The above copyright notice and this permission notice shall be        */
+/* included in all copies or substantial portions of the Software.       */
+/*                                                                       */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
+/*************************************************************************/
+#include "godot.h"
+
+#include <cassert>
+#include <cstdlib>
+
+#include "class_db.h"
+#include "dl_script.h"
+#include "global_config.h"
+#include "variant.h"
+
+#include <memory.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern "C" void _string_api_anchor();
+extern "C" void _vector2_api_anchor();
+extern "C" void _rect2_api_anchor();
+extern "C" void _vector3_api_anchor();
+extern "C" void _transform2d_api_anchor();
+extern "C" void _plane_api_anchor();
+extern "C" void _quat_api_anchor();
+extern "C" void _basis_api_anchor();
+extern "C" void _rect3_api_anchor();
+extern "C" void _transform_api_anchor();
+extern "C" void _color_api_anchor();
+extern "C" void _image_api_anchor();
+extern "C" void _node_path_api_anchor();
+extern "C" void _rid_api_anchor();
+extern "C" void _input_event_api_anchor();
+extern "C" void _dictionary_api_anchor();
+extern "C" void _array_api_anchor();
+extern "C" void _pool_arrays_api_anchor();
+extern "C" void _variant_api_anchor();
+
+void _api_anchor() {
+
+	_string_api_anchor();
+	_vector2_api_anchor();
+	_rect2_api_anchor();
+	_vector3_api_anchor();
+	_transform2d_api_anchor();
+	_plane_api_anchor();
+	_quat_api_anchor();
+	_rect3_api_anchor();
+	_basis_api_anchor();
+	_transform_api_anchor();
+	_color_api_anchor();
+	_image_api_anchor();
+	_node_path_api_anchor();
+	_rid_api_anchor();
+	_input_event_api_anchor();
+	_dictionary_api_anchor();
+	_array_api_anchor();
+	_pool_arrays_api_anchor();
+	_variant_api_anchor();
+}
+
+extern "C++" {
+template <class a, class b>
+_FORCE_INLINE_ a memcast(b v) {
+	return *((a *)&v);
+}
+}
+
+void GDAPI godot_object_destroy(godot_object *p_o) {
+	memdelete((Object *)p_o);
+}
+
+// Singleton API
+
+godot_object GDAPI *godot_global_get_singleton(char *p_name) {
+	return (godot_object *)GlobalConfig::get_singleton()->get_singleton_object(String(p_name));
+} // result shouldn't be freed
+
+// MethodBind API
+
+godot_method_bind GDAPI *godot_method_bind_get_method(const char *p_classname, const char *p_methodname) {
+
+	MethodBind *mb = ClassDB::get_method(StringName(p_classname), StringName(p_methodname));
+	// MethodBind *mb = ClassDB::get_method("Node", "get_name");
+	return (godot_method_bind *)mb;
+}
+
+void GDAPI godot_method_bind_ptrcall(godot_method_bind *p_method_bind, godot_object *p_instance, const void **p_args, void *p_ret) {
+
+	MethodBind *mb = (MethodBind *)p_method_bind;
+	Object *o = (Object *)p_instance;
+	mb->ptrcall(o, p_args, p_ret);
+}
+
+// @Todo
+/*
+void GDAPI godot_method_bind_varcall(godot_method_bind *p_method_bind)
+{
+
+}
+*/
+
+// Script API
+
+void GDAPI godot_script_register_class(const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func) {
+	DLLibrary *library = DLLibrary::get_currently_initialized_library();
+	if (!library) {
+		ERR_EXPLAIN("Attempt to register script after initializing library!");
+		ERR_FAIL();
+	}
+	library->_register_script(p_name, p_base, p_create_func, p_destroy_func);
+}
+
+void GDAPI godot_script_register_tool_class(const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func) {
+	DLLibrary *library = DLLibrary::get_currently_initialized_library();
+	if (!library) {
+		ERR_EXPLAIN("Attempt to register script after initializing library!");
+		ERR_FAIL();
+	}
+	library->_register_tool_script(p_name, p_base, p_create_func, p_destroy_func);
+}
+
+void GDAPI godot_script_register_method(const char *p_name, const char *p_function_name, godot_method_attributes p_attr, godot_instance_method p_method) {
+	DLLibrary *library = DLLibrary::get_currently_initialized_library();
+	if (!library) {
+		ERR_EXPLAIN("Attempt to register script after initializing library!");
+		ERR_FAIL();
+	}
+	library->_register_script_method(p_name, p_function_name, p_attr, p_method, MethodInfo());
+}
+
+void GDAPI godot_script_register_property(const char *p_name, const char *p_path, godot_property_attributes *p_attr, godot_property_set_func p_set_func, godot_property_get_func p_get_func) {
+	DLLibrary *library = DLLibrary::get_currently_initialized_library();
+	if (!library) {
+		ERR_EXPLAIN("Attempt to register script after initializing library!");
+		ERR_FAIL();
+	}
+
+	library->_register_script_property(p_name, p_path, p_attr, p_set_func, p_get_func);
+}
+
+void GDAPI godot_script_register_signal(const char *p_name, const godot_signal *p_signal) {
+	DLLibrary *library = DLLibrary::get_currently_initialized_library();
+	if (!library) {
+		ERR_EXPLAIN("Attempt to register script after initializing library!");
+		ERR_FAIL();
+	}
+
+	library->_register_script_signal(p_name, p_signal);
+}
+
+// System functions
+void GDAPI *godot_alloc(int p_bytes) {
+	return memalloc(p_bytes);
+}
+
+void GDAPI *godot_realloc(void *p_ptr, int p_bytes) {
+	return memrealloc(p_ptr, p_bytes);
+}
+
+void GDAPI godot_free(void *p_ptr) {
+	memfree(p_ptr);
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 389 - 0
modules/dlscript/godot.h

@@ -0,0 +1,389 @@
+/*************************************************************************/
+/*  godot_c.h                                                            */
+/*************************************************************************/
+/*                       This file is part of:                           */
+/*                           GODOT ENGINE                                */
+/*                    http://www.godotengine.org                         */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur.                 */
+/*                                                                       */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the       */
+/* "Software"), to deal in the Software without restriction, including   */
+/* without limitation the rights to use, copy, modify, merge, publish,   */
+/* distribute, sublicense, and/or sell copies of the Software, and to    */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions:                                             */
+/*                                                                       */
+/* The above copyright notice and this permission notice shall be        */
+/* included in all copies or substantial portions of the Software.       */
+/*                                                                       */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
+/*************************************************************************/
+#ifndef GODOT_C_H
+#define GODOT_C_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef GDAPI_BUILT_IN
+#define GDAPI_EXPORT
+#endif
+
+#if !defined(_WIN32) && !defined(_MSC_VER)
+#define GDAPI
+#elif defined(GDAPI_EXPORT)
+#define GDAPI __declspec(dllexport)
+#else
+#define GDAPI __declspec(dllimport)
+#endif
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#define GODOT_API_VERSION 1
+
+////// Error
+
+typedef enum godot_error {
+	GODOT_OK,
+	GODOT_FAILED, ///< Generic fail error
+	GODOT_ERR_UNAVAILABLE, ///< What is requested is unsupported/unavailable
+	GODOT_ERR_UNCONFIGURED, ///< The object being used hasnt been properly set up yet
+	GODOT_ERR_UNAUTHORIZED, ///< Missing credentials for requested resource
+	GODOT_ERR_PARAMETER_RANGE_ERROR, ///< Parameter given out of range (5)
+	GODOT_ERR_OUT_OF_MEMORY, ///< Out of memory
+	GODOT_ERR_FILE_NOT_FOUND,
+	GODOT_ERR_FILE_BAD_DRIVE,
+	GODOT_ERR_FILE_BAD_PATH,
+	GODOT_ERR_FILE_NO_PERMISSION, // (10)
+	GODOT_ERR_FILE_ALREADY_IN_USE,
+	GODOT_ERR_FILE_CANT_OPEN,
+	GODOT_ERR_FILE_CANT_WRITE,
+	GODOT_ERR_FILE_CANT_READ,
+	GODOT_ERR_FILE_UNRECOGNIZED, // (15)
+	GODOT_ERR_FILE_CORRUPT,
+	GODOT_ERR_FILE_MISSING_DEPENDENCIES,
+	GODOT_ERR_FILE_EOF,
+	GODOT_ERR_CANT_OPEN, ///< Can't open a resource/socket/file
+	GODOT_ERR_CANT_CREATE, // (20)
+	GODOT_ERR_QUERY_FAILED,
+	GODOT_ERR_ALREADY_IN_USE,
+	GODOT_ERR_LOCKED, ///< resource is locked
+	GODOT_ERR_TIMEOUT,
+	GODOT_ERR_CANT_CONNECT, // (25)
+	GODOT_ERR_CANT_RESOLVE,
+	GODOT_ERR_CONNECTION_ERROR,
+	GODOT_ERR_CANT_AQUIRE_RESOURCE,
+	GODOT_ERR_CANT_FORK,
+	GODOT_ERR_INVALID_DATA, ///< Data passed is invalid	(30)
+	GODOT_ERR_INVALID_PARAMETER, ///< Parameter passed is invalid
+	GODOT_ERR_ALREADY_EXISTS, ///< When adding, item already exists
+	GODOT_ERR_DOES_NOT_EXIST, ///< When retrieving/erasing, it item does not exist
+	GODOT_ERR_DATABASE_CANT_READ, ///< database is full
+	GODOT_ERR_DATABASE_CANT_WRITE, ///< database is full	(35)
+	GODOT_ERR_COMPILATION_FAILED,
+	GODOT_ERR_METHOD_NOT_FOUND,
+	GODOT_ERR_LINK_FAILED,
+	GODOT_ERR_SCRIPT_FAILED,
+	GODOT_ERR_CYCLIC_LINK, // (40)
+	GODOT_ERR_INVALID_DECLARATION,
+	GODOT_ERR_DUPLICATE_SYMBOL,
+	GODOT_ERR_PARSE_ERROR,
+	GODOT_ERR_BUSY,
+	GODOT_ERR_SKIP, // (45)
+	GODOT_ERR_HELP, ///< user requested help!!
+	GODOT_ERR_BUG, ///< a bug in the software certainly happened, due to a double check failing or unexpected behavior.
+	GODOT_ERR_PRINTER_ON_FIRE, /// the parallel port printer is engulfed in flames
+	GODOT_ERR_OMFG_THIS_IS_VERY_VERY_BAD, ///< shit happens, has never been used, though
+	GODOT_ERR_WTF = GODOT_ERR_OMFG_THIS_IS_VERY_VERY_BAD ///< short version of the above
+} godot_error;
+
+////// bool
+
+typedef bool godot_bool;
+
+#define GODOT_TRUE 1
+#define GODOT_FALSE 0
+
+/////// int
+
+typedef int godot_int;
+
+/////// real
+
+typedef float godot_real;
+
+typedef double godot_real64; // for Variant in 3.0
+
+/////// Object (forward declared)
+typedef void godot_object;
+
+/////// String
+
+#include "godot/godot_string.h"
+
+////// Vector2
+
+#include "godot/godot_vector2.h"
+
+////// Rect2
+
+#include "godot/godot_rect2.h"
+
+////// Vector3
+
+#include "godot/godot_vector3.h"
+
+////// Transform2D
+
+#include "godot/godot_transform2d.h"
+
+/////// Plane
+
+#include "godot/godot_plane.h"
+
+/////// Quat
+
+#include "godot/godot_quat.h"
+
+/////// Rect3
+
+#include "godot/godot_rect3.h"
+
+/////// Basis
+
+#include "godot/godot_basis.h"
+
+/////// Transform
+
+#include "godot/godot_transform.h"
+
+/////// Color
+
+#include "godot/godot_color.h"
+
+/////// Image
+
+#include "godot/godot_image.h"
+
+/////// NodePath
+
+#include "godot/godot_node_path.h"
+
+/////// RID
+
+#include "godot/godot_rid.h"
+
+/////// InputEvent
+
+#include "godot/godot_input_event.h"
+
+/////// Dictionary
+
+#include "godot/godot_dictionary.h"
+
+/////// Array
+
+#include "godot/godot_array.h"
+
+// single API file for Pool*Array
+#include "godot/godot_pool_arrays.h"
+
+void GDAPI godot_object_destroy(godot_object *p_o);
+
+////// Variant
+
+#include "godot/godot_variant.h"
+
+////// Singleton API
+
+godot_object GDAPI *godot_global_get_singleton(char *p_name); // result shouldn't be freed
+
+////// MethodBind API
+
+typedef struct godot_method_bind {
+	uint8_t _dont_touch_that[1]; // TODO
+} godot_method_bind;
+
+godot_method_bind GDAPI *godot_method_bind_get_method(const char *p_classname, const char *p_methodname);
+void GDAPI godot_method_bind_ptrcall(godot_method_bind *p_method_bind, godot_object *p_instance, const void **p_args, void *p_ret);
+
+////// Script API
+
+typedef struct godot_dlscript_init_options {
+	godot_bool in_editor;
+	uint64_t core_api_hash;
+	uint64_t editor_api_hash;
+	uint64_t no_api_hash;
+} godot_dlscript_init_options;
+
+typedef struct godot_dlscript_terminate_options {
+	godot_bool in_editor;
+} godot_dlscript_terminate_options;
+
+typedef enum godot_method_rpc_mode {
+	GODOT_METHOD_RPC_MODE_DISABLED,
+	GODOT_METHOD_RPC_MODE_REMOTE,
+	GODOT_METHOD_RPC_MODE_SYNC,
+	GODOT_METHOD_RPC_MODE_MASTER,
+	GODOT_METHOD_RPC_MODE_SLAVE,
+} godot_method_rpc_mode;
+
+typedef struct godot_method_attributes {
+	godot_method_rpc_mode rpc_type;
+} godot_method_attributes;
+
+typedef enum godot_property_hint {
+	GODOT_PROPERTY_HINT_NONE, ///< no hint provided.
+	GODOT_PROPERTY_HINT_RANGE, ///< hint_text = "min,max,step,slider; //slider is optional"
+	GODOT_PROPERTY_HINT_EXP_RANGE, ///< hint_text = "min,max,step", exponential edit
+	GODOT_PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc"
+	GODOT_PROPERTY_HINT_EXP_EASING, /// exponential easing funciton (Math::ease)
+	GODOT_PROPERTY_HINT_LENGTH, ///< hint_text= "length" (as integer)
+	GODOT_PROPERTY_HINT_SPRITE_FRAME,
+	GODOT_PROPERTY_HINT_KEY_ACCEL, ///< hint_text= "length" (as integer)
+	GODOT_PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags)
+	GODOT_PROPERTY_HINT_LAYERS_2D_RENDER,
+	GODOT_PROPERTY_HINT_LAYERS_2D_PHYSICS,
+	GODOT_PROPERTY_HINT_LAYERS_3D_RENDER,
+	GODOT_PROPERTY_HINT_LAYERS_3D_PHYSICS,
+	GODOT_PROPERTY_HINT_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,"
+	GODOT_PROPERTY_HINT_DIR, ///< a directort path must be passed
+	GODOT_PROPERTY_HINT_GLOBAL_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,"
+	GODOT_PROPERTY_HINT_GLOBAL_DIR, ///< a directort path must be passed
+	GODOT_PROPERTY_HINT_RESOURCE_TYPE, ///< a resource object type
+	GODOT_PROPERTY_HINT_MULTILINE_TEXT, ///< used for string properties that can contain multiple lines
+	GODOT_PROPERTY_HINT_COLOR_NO_ALPHA, ///< used for ignoring alpha component when editing a color
+	GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSY,
+	GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS,
+	GODOT_PROPERTY_HINT_OBJECT_ID,
+	GODOT_PROPERTY_HINT_TYPE_STRING, ///< a type string, the hint is the base type to choose
+	GODOT_PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE, ///< so something else can provide this (used in scripts)
+	GODOT_PROPERTY_HINT_METHOD_OF_VARIANT_TYPE, ///< a method of a type
+	GODOT_PROPERTY_HINT_METHOD_OF_BASE_TYPE, ///< a method of a base type
+	GODOT_PROPERTY_HINT_METHOD_OF_INSTANCE, ///< a method of an instance
+	GODOT_PROPERTY_HINT_METHOD_OF_SCRIPT, ///< a method of a script & base
+	GODOT_PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE, ///< a property of a type
+	GODOT_PROPERTY_HINT_PROPERTY_OF_BASE_TYPE, ///< a property of a base type
+	GODOT_PROPERTY_HINT_PROPERTY_OF_INSTANCE, ///< a property of an instance
+	GODOT_PROPERTY_HINT_PROPERTY_OF_SCRIPT, ///< a property of a script & base
+	GODOT_PROPERTY_HINT_MAX,
+} godot_property_hint;
+
+typedef enum godot_property_usage_flags {
+
+	GODOT_PROPERTY_USAGE_STORAGE = 1,
+	GODOT_PROPERTY_USAGE_EDITOR = 2,
+	GODOT_PROPERTY_USAGE_NETWORK = 4,
+	GODOT_PROPERTY_USAGE_EDITOR_HELPER = 8,
+	GODOT_PROPERTY_USAGE_CHECKABLE = 16, //used for editing global variables
+	GODOT_PROPERTY_USAGE_CHECKED = 32, //used for editing global variables
+	GODOT_PROPERTY_USAGE_INTERNATIONALIZED = 64, //hint for internationalized strings
+	GODOT_PROPERTY_USAGE_GROUP = 128, //used for grouping props in the editor
+	GODOT_PROPERTY_USAGE_CATEGORY = 256,
+	GODOT_PROPERTY_USAGE_STORE_IF_NONZERO = 512, //only store if nonzero
+	GODOT_PROPERTY_USAGE_STORE_IF_NONONE = 1024, //only store if false
+	GODOT_PROPERTY_USAGE_NO_INSTANCE_STATE = 2048,
+	GODOT_PROPERTY_USAGE_RESTART_IF_CHANGED = 4096,
+	GODOT_PROPERTY_USAGE_SCRIPT_VARIABLE = 8192,
+	GODOT_PROPERTY_USAGE_STORE_IF_NULL = 16384,
+	GODOT_PROPERTY_USAGE_ANIMATE_AS_TRIGGER = 32768,
+	GODOT_PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED = 65536,
+
+	GODOT_PROPERTY_USAGE_DEFAULT = GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_EDITOR | GODOT_PROPERTY_USAGE_NETWORK,
+	GODOT_PROPERTY_USAGE_DEFAULT_INTL = GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_EDITOR | GODOT_PROPERTY_USAGE_NETWORK | GODOT_PROPERTY_USAGE_INTERNATIONALIZED,
+	GODOT_PROPERTY_USAGE_NOEDITOR = GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_NETWORK,
+} godot_property_usage_flags;
+
+typedef struct godot_property_attributes {
+	godot_method_rpc_mode rset_type;
+
+	godot_int type;
+	godot_property_hint hint;
+	godot_string hint_string;
+	godot_property_usage_flags usage;
+	godot_variant default_value;
+} godot_property_attributes;
+
+typedef struct godot_instance_create_func {
+	// instance pointer, method_data - return user data
+	void *(*create_func)(godot_object *, void *);
+	void *method_data;
+	void (*free_func)(void *);
+} godot_script_instance_func;
+
+typedef struct godot_instance_destroy_func {
+	// instance pointer, method data, user data
+	void (*destroy_func)(godot_object *, void *, void *);
+	void *method_data;
+	void (*free_func)(void *);
+} godot_instance_destroy_func;
+
+void GDAPI godot_script_register_class(const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func);
+
+void GDAPI godot_script_register_tool_class(const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func);
+
+typedef struct godot_instance_method {
+	// instance pointer, method data, user data, num args, args - return result as varaint
+	godot_variant (*method)(godot_object *, void *, void *, int, godot_variant **);
+	void *method_data;
+	void (*free_func)(void *);
+} godot_instance_method;
+
+void GDAPI godot_script_register_method(const char *p_name, const char *p_function_name, godot_method_attributes p_attr, godot_instance_method p_method);
+
+typedef struct godot_property_set_func {
+	// instance pointer, method data, user data, value
+	void (*set_func)(godot_object *, void *, void *, godot_variant);
+	void *method_data;
+	void (*free_func)(void *);
+} godot_property_set_func;
+
+typedef struct godot_property_get_func {
+	// instance pointer, method data, user data, value
+	godot_variant (*get_func)(godot_object *, void *, void *);
+	void *method_data;
+	void (*free_func)(void *);
+} godot_property_get_func;
+
+void GDAPI godot_script_register_property(const char *p_name, const char *p_path, godot_property_attributes *p_attr, godot_property_set_func p_set_func, godot_property_get_func p_get_func);
+
+typedef struct godot_signal_argument {
+	godot_string name;
+	godot_int type;
+	godot_property_hint hint;
+	godot_string hint_string;
+	godot_property_usage_flags usage;
+	godot_variant default_value;
+} godot_signal_argument;
+
+typedef struct godot_signal {
+	godot_string name;
+	int num_args;
+	godot_signal_argument *args;
+	int num_default_args;
+	godot_variant *default_args;
+} godot_signal;
+
+void GDAPI godot_script_register_signal(const char *p_name, const godot_signal *p_signal);
+
+////// System Functions
+
+//using these will help Godot track how much memory is in use in debug mode
+void GDAPI *godot_alloc(int p_bytes);
+void GDAPI *godot_realloc(void *p_ptr, int p_bytes);
+void GDAPI godot_free(void *p_ptr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_C_H

+ 271 - 0
modules/dlscript/godot/godot_array.cpp

@@ -0,0 +1,271 @@
+#include "godot_array.h"
+
+#include "core/array.h"
+#include "core/os/memory.h"
+
+#include "core/color.h"
+#include "core/dvector.h"
+
+#include "core/variant.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _array_api_anchor() {
+}
+
+void GDAPI godot_array_new(godot_array *p_arr) {
+	Array *a = (Array *)p_arr;
+	memnew_placement(a, Array);
+}
+
+void GDAPI godot_array_new_pool_color_array(godot_array *p_arr, const godot_pool_color_array *p_pca) {
+	Array *a = (Array *)p_arr;
+	PoolVector<Color> *pca = (PoolVector<Color> *)p_pca;
+	memnew_placement(a, Array);
+	a->resize(pca->size());
+
+	for (size_t i = 0; i < a->size(); i++) {
+		Variant v = pca->operator[](i);
+		a->operator[](i) = v;
+	}
+}
+
+void GDAPI godot_array_new_pool_vector3_array(godot_array *p_arr, const godot_pool_vector3_array *p_pv3a) {
+	Array *a = (Array *)p_arr;
+	PoolVector<Vector3> *pca = (PoolVector<Vector3> *)p_pv3a;
+	memnew_placement(a, Array);
+	a->resize(pca->size());
+
+	for (size_t i = 0; i < a->size(); i++) {
+		Variant v = pca->operator[](i);
+		a->operator[](i) = v;
+	}
+}
+
+void GDAPI godot_array_new_pool_vector2_array(godot_array *p_arr, const godot_pool_vector2_array *p_pv2a) {
+	Array *a = (Array *)p_arr;
+	PoolVector<Vector2> *pca = (PoolVector<Vector2> *)p_pv2a;
+	memnew_placement(a, Array);
+	a->resize(pca->size());
+
+	for (size_t i = 0; i < a->size(); i++) {
+		Variant v = pca->operator[](i);
+		a->operator[](i) = v;
+	}
+}
+
+void GDAPI godot_array_new_pool_string_array(godot_array *p_arr, const godot_pool_string_array *p_psa) {
+	Array *a = (Array *)p_arr;
+	PoolVector<String> *pca = (PoolVector<String> *)p_psa;
+	memnew_placement(a, Array);
+	a->resize(pca->size());
+
+	for (size_t i = 0; i < a->size(); i++) {
+		Variant v = pca->operator[](i);
+		a->operator[](i) = v;
+	}
+}
+
+void GDAPI godot_array_new_pool_real_array(godot_array *p_arr, const godot_pool_real_array *p_pra) {
+	Array *a = (Array *)p_arr;
+	PoolVector<godot_real> *pca = (PoolVector<godot_real> *)p_pra;
+	memnew_placement(a, Array);
+	a->resize(pca->size());
+
+	for (size_t i = 0; i < a->size(); i++) {
+		Variant v = pca->operator[](i);
+		a->operator[](i) = v;
+	}
+}
+
+void GDAPI godot_array_new_pool_int_array(godot_array *p_arr, const godot_pool_int_array *p_pia) {
+	Array *a = (Array *)p_arr;
+	PoolVector<godot_int> *pca = (PoolVector<godot_int> *)p_pia;
+	memnew_placement(a, Array);
+	a->resize(pca->size());
+
+	for (size_t i = 0; i < a->size(); i++) {
+		Variant v = pca->operator[](i);
+		a->operator[](i) = v;
+	}
+}
+
+void GDAPI godot_array_new_pool_byte_array(godot_array *p_arr, const godot_pool_byte_array *p_pba) {
+	Array *a = (Array *)p_arr;
+	PoolVector<uint8_t> *pca = (PoolVector<uint8_t> *)p_pba;
+	memnew_placement(a, Array);
+	a->resize(pca->size());
+
+	for (size_t i = 0; i < a->size(); i++) {
+		Variant v = pca->operator[](i);
+		a->operator[](i) = v;
+	}
+}
+
+void GDAPI godot_array_set(godot_array *p_arr, const godot_int p_idx, const godot_variant *p_value) {
+	Array *a = (Array *)p_arr;
+	Variant *val = (Variant *)p_value;
+	a->operator[](p_idx) = *val;
+}
+
+godot_variant GDAPI *godot_array_get(godot_array *p_arr, const godot_int p_idx) {
+	Array *a = (Array *)p_arr;
+	return (godot_variant *)&a->operator[](p_idx);
+}
+
+void GDAPI godot_array_append(godot_array *p_arr, const godot_variant *p_value) {
+	Array *a = (Array *)p_arr;
+	Variant *val = (Variant *)p_value;
+	a->append(*val);
+}
+
+void GDAPI godot_array_clear(godot_array *p_arr) {
+	Array *a = (Array *)p_arr;
+	a->clear();
+}
+
+godot_int GDAPI godot_array_count(godot_array *p_arr, const godot_variant *p_value) {
+	Array *a = (Array *)p_arr;
+	Variant *val = (Variant *)p_value;
+	return a->count(*val);
+}
+
+godot_bool GDAPI godot_array_empty(const godot_array *p_arr) {
+	Array *a = (Array *)p_arr;
+	return a->empty();
+}
+
+void GDAPI godot_array_erase(godot_array *p_arr, const godot_variant *p_value) {
+	Array *a = (Array *)p_arr;
+	Variant *val = (Variant *)p_value;
+	a->erase(*val);
+}
+
+godot_variant GDAPI godot_array_front(const godot_array *p_arr) {
+	Array *a = (Array *)p_arr;
+	godot_variant v;
+	Variant *val = (Variant *)&v;
+	memnew_placement(val, Variant);
+	*val = a->front();
+	return v;
+}
+
+godot_variant GDAPI godot_array_back(const godot_array *p_arr) {
+	Array *a = (Array *)p_arr;
+	godot_variant v;
+	Variant *val = (Variant *)&v;
+	memnew_placement(val, Variant);
+	*val = a->back();
+	return v;
+}
+
+godot_int GDAPI godot_array_find(const godot_array *p_arr, const godot_variant *p_what, const godot_int p_from) {
+	Array *a = (Array *)p_arr;
+	Variant *val = (Variant *)p_what;
+	return a->find(*val, p_from);
+}
+
+godot_int GDAPI godot_array_find_last(const godot_array *p_arr, const godot_variant *p_what) {
+	Array *a = (Array *)p_arr;
+	Variant *val = (Variant *)p_what;
+	return a->find_last(*val);
+}
+
+godot_bool GDAPI godot_array_has(const godot_array *p_arr, const godot_variant *p_value) {
+	Array *a = (Array *)p_arr;
+	Variant *val = (Variant *)p_value;
+	return a->has(*val);
+}
+
+uint32_t GDAPI godot_array_hash(const godot_array *p_arr) {
+	Array *a = (Array *)p_arr;
+	return a->hash();
+}
+
+void GDAPI godot_array_insert(godot_array *p_arr, const godot_int p_pos, const godot_variant *p_value) {
+	Array *a = (Array *)p_arr;
+	Variant *val = (Variant *)p_value;
+	a->insert(p_pos, *val);
+}
+
+void GDAPI godot_array_invert(godot_array *p_arr) {
+	Array *a = (Array *)p_arr;
+	a->invert();
+}
+
+godot_bool GDAPI godot_array_is_shared(const godot_array *p_arr) {
+	Array *a = (Array *)p_arr;
+	return false; // @Todo how do I do it?
+}
+
+godot_variant GDAPI godot_array_pop_back(godot_array *p_arr) {
+	Array *a = (Array *)p_arr;
+	godot_variant v;
+	Variant *val = (Variant *)&v;
+	memnew_placement(val, Variant);
+	*val = a->pop_back();
+	return v;
+}
+
+godot_variant GDAPI godot_array_pop_front(godot_array *p_arr) {
+	Array *a = (Array *)p_arr;
+	godot_variant v;
+	Variant *val = (Variant *)&v;
+	memnew_placement(val, Variant);
+	*val = a->pop_front();
+	return v;
+}
+
+void GDAPI godot_array_push_back(godot_array *p_arr, const godot_variant *p_value) {
+	Array *a = (Array *)p_arr;
+	Variant *val = (Variant *)p_value;
+	a->push_back(*val);
+}
+
+void GDAPI godot_array_push_front(godot_array *p_arr, const godot_variant *p_value) {
+	Array *a = (Array *)p_arr;
+	Variant *val = (Variant *)p_value;
+	a->push_front(*val);
+}
+
+void GDAPI godot_array_remove(godot_array *p_arr, const godot_int p_idx) {
+	Array *a = (Array *)p_arr;
+	a->remove(p_idx);
+}
+
+void GDAPI godot_array_resize(godot_array *p_arr, const godot_int p_size) {
+	Array *a = (Array *)p_arr;
+	a->resize(p_size);
+}
+
+godot_int GDAPI godot_array_rfind(const godot_array *p_arr, const godot_variant *p_what, const godot_int p_from) {
+	Array *a = (Array *)p_arr;
+	Variant *val = (Variant *)p_what;
+	return a->rfind(*val, p_from);
+}
+
+godot_int GDAPI godot_array_size(const godot_array *p_arr) {
+	Array *a = (Array *)p_arr;
+	return a->size();
+}
+
+void GDAPI godot_array_sort(godot_array *p_arr) {
+	Array *a = (Array *)p_arr;
+	a->sort();
+}
+
+void GDAPI godot_array_sort_custom(godot_array *p_arr, godot_object *p_obj, const godot_string *p_func) {
+	Array *a = (Array *)p_arr;
+	String *func = (String *)p_func;
+	a->sort_custom((Object *)p_obj, *func);
+}
+
+void GDAPI godot_array_destroy(godot_array *p_arr) {
+	((Array *)p_arr)->~Array();
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 88 - 0
modules/dlscript/godot/godot_array.h

@@ -0,0 +1,88 @@
+#ifndef GODOT_DLSCRIPT_ARRAY_H
+#define GODOT_DLSCRIPT_ARRAY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_ARRAY_TYPE_DEFINED
+typedef struct godot_array {
+	uint8_t _dont_touch_that[8];
+} godot_array;
+#endif
+
+#include "../godot.h"
+
+#include "godot_pool_arrays.h"
+#include "godot_variant.h"
+
+void GDAPI godot_array_new(godot_array *p_arr);
+void GDAPI godot_array_new_pool_color_array(godot_array *p_arr, const godot_pool_color_array *p_pca);
+void GDAPI godot_array_new_pool_vector3_array(godot_array *p_arr, const godot_pool_vector3_array *p_pv3a);
+void GDAPI godot_array_new_pool_vector2_array(godot_array *p_arr, const godot_pool_vector2_array *p_pv2a);
+void GDAPI godot_array_new_pool_string_array(godot_array *p_arr, const godot_pool_string_array *p_psa);
+void GDAPI godot_array_new_pool_real_array(godot_array *p_arr, const godot_pool_real_array *p_pra);
+void GDAPI godot_array_new_pool_int_array(godot_array *p_arr, const godot_pool_int_array *p_pia);
+void GDAPI godot_array_new_pool_byte_array(godot_array *p_arr, const godot_pool_byte_array *p_pba);
+
+void GDAPI godot_array_set(godot_array *p_arr, const godot_int p_idx, const godot_variant *p_value);
+
+godot_variant GDAPI *godot_array_get(godot_array *p_arr, const godot_int p_idx);
+
+void GDAPI godot_array_append(godot_array *p_arr, const godot_variant *p_value);
+
+void GDAPI godot_array_clear(godot_array *p_arr);
+
+godot_int GDAPI godot_array_count(godot_array *p_arr, const godot_variant *p_value);
+
+godot_bool GDAPI godot_array_empty(const godot_array *p_arr);
+
+void GDAPI godot_array_erase(godot_array *p_arr, const godot_variant *p_value);
+
+godot_variant GDAPI godot_array_front(const godot_array *p_arr);
+
+godot_variant GDAPI godot_array_back(const godot_array *p_arr);
+
+godot_int GDAPI godot_array_find(const godot_array *p_arr, const godot_variant *p_what, const godot_int p_from);
+
+godot_int GDAPI godot_array_find_last(const godot_array *p_arr, const godot_variant *p_what);
+
+godot_bool GDAPI godot_array_has(const godot_array *p_arr, const godot_variant *p_value);
+
+uint32_t GDAPI godot_array_hash(const godot_array *p_arr);
+
+void GDAPI godot_array_insert(godot_array *p_arr, const godot_int p_pos, const godot_variant *p_value);
+
+void GDAPI godot_array_invert(godot_array *p_arr);
+
+godot_bool GDAPI godot_array_is_shared(const godot_array *p_arr);
+
+godot_variant GDAPI godot_array_pop_back(godot_array *p_arr);
+
+godot_variant GDAPI godot_array_pop_front(godot_array *p_arr);
+
+void GDAPI godot_array_push_back(godot_array *p_arr, const godot_variant *p_value);
+
+void GDAPI godot_array_push_front(godot_array *p_arr, const godot_variant *p_value);
+
+void GDAPI godot_array_remove(godot_array *p_arr, const godot_int p_idx);
+
+void GDAPI godot_array_resize(godot_array *p_arr, const godot_int p_size);
+
+godot_int GDAPI godot_array_rfind(const godot_array *p_arr, const godot_variant *p_what, const godot_int p_from);
+
+godot_int GDAPI godot_array_size(const godot_array *p_arr);
+
+void GDAPI godot_array_sort(godot_array *p_arr);
+
+void GDAPI godot_array_sort_custom(godot_array *p_arr, godot_object *p_obj, const godot_string *p_func);
+
+void GDAPI godot_array_destroy(godot_array *p_arr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_DLSCRIPT_ARRAY_H

+ 58 - 0
modules/dlscript/godot/godot_basis.cpp

@@ -0,0 +1,58 @@
+#include "godot_basis.h"
+
+#include "math/matrix3.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _basis_api_anchor() {
+}
+
+void GDAPI godot_basis_new(godot_basis *p_basis) {
+	Basis *basis = (Basis *)p_basis;
+	*basis = Basis();
+}
+
+void GDAPI godot_basis_new_with_euler_quat(godot_basis *p_basis, const godot_quat *p_euler) {
+	Basis *basis = (Basis *)p_basis;
+	Quat *euler = (Quat *)p_euler;
+	*basis = Basis(*euler);
+}
+
+void GDAPI godot_basis_new_with_euler(godot_basis *p_basis, const godot_vector3 *p_euler) {
+	Basis *basis = (Basis *)p_basis;
+	Vector3 *euler = (Vector3 *)p_euler;
+	*basis = Basis(*euler);
+}
+
+godot_quat GDAPI godot_basis_as_quat(const godot_basis *p_basis) {
+	const Basis *basis = (const Basis *)p_basis;
+	godot_quat quat;
+	Quat *p_quat = (Quat *)&quat;
+	*p_quat = basis->operator Quat();
+	return quat;
+}
+
+godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_basis) {
+	const Basis *basis = (const Basis *)p_basis;
+	godot_vector3 euler;
+	Vector3 *p_euler = (Vector3 *)&euler;
+	*p_euler = basis->get_euler();
+	return euler;
+}
+
+/*
+ * p_elements is a pointer to an array of 3 (!!) vector3
+ */
+void GDAPI godot_basis_get_elements(godot_basis *p_basis, godot_vector3 *p_elements) {
+	Basis *basis = (Basis *)p_basis;
+	Vector3 *elements = (Vector3 *)p_elements;
+	elements[0] = basis->elements[0];
+	elements[1] = basis->elements[1];
+	elements[2] = basis->elements[2];
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 34 - 0
modules/dlscript/godot/godot_basis.h

@@ -0,0 +1,34 @@
+#ifndef GODOT_DLSCRIPT_BASIS_H
+#define GODOT_DLSCRIPT_BASIS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED
+typedef struct godot_basis {
+	uint8_t _dont_touch_that[36];
+} godot_basis;
+#endif
+
+#include "../godot.h"
+
+void GDAPI godot_basis_new(godot_basis *p_basis);
+void GDAPI godot_basis_new_with_euler_quat(godot_basis *p_basis, const godot_quat *p_euler);
+void GDAPI godot_basis_new_with_euler(godot_basis *p_basis, const godot_vector3 *p_euler);
+
+godot_quat GDAPI godot_basis_as_quat(const godot_basis *p_basis);
+godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_basis);
+
+/*
+ * p_elements is a pointer to an array of 3 (!!) vector3
+ */
+void GDAPI godot_basis_get_elements(godot_basis *p_basis, godot_vector3 *p_elements);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_DLSCRIPT_BASIS_H

+ 34 - 0
modules/dlscript/godot/godot_color.cpp

@@ -0,0 +1,34 @@
+#include "godot_color.h"
+
+#include "color.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _color_api_anchor() {
+}
+
+void GDAPI godot_color_new(godot_color *p_color) {
+	Color *color = (Color *)p_color;
+	*color = Color();
+}
+
+void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a) {
+	Color *color = (Color *)p_color;
+	*color = Color(r, g, b, a);
+}
+
+uint32_t GDAPI godot_color_get_32(const godot_color *p_color) {
+	const Color *color = (const Color *)p_color;
+	return color->to_32();
+}
+
+float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx) {
+	Color *color = (Color *)p_color;
+	return &color->operator[](idx);
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 29 - 0
modules/dlscript/godot/godot_color.h

@@ -0,0 +1,29 @@
+#ifndef GODOT_DLSCRIPT_COLOR_H
+#define GODOT_DLSCRIPT_COLOR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED
+typedef struct godot_color {
+	uint8_t _dont_touch_that[16];
+} godot_color;
+#endif
+
+#include "../godot.h"
+
+void GDAPI godot_color_new(godot_color *p_color);
+void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a);
+
+uint32_t GDAPI godot_color_get_32(const godot_color *p_color);
+
+float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_DLSCRIPT_COLOR_H

+ 109 - 0
modules/dlscript/godot/godot_dictionary.cpp

@@ -0,0 +1,109 @@
+#include "godot_dictionary.h"
+
+#include "core/dictionary.h"
+
+#include "core/os/memory.h"
+
+#include "core/io/json.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _dictionary_api_anchor() {
+}
+
+void GDAPI godot_dictionary_new(godot_dictionary *p_dict) {
+	Dictionary *dict = (Dictionary *)p_dict;
+	memnew_placement(dict, Dictionary);
+}
+
+void GDAPI godot_dictionary_clear(godot_dictionary *p_dict) {
+	Dictionary *dict = (Dictionary *)p_dict;
+	dict->clear();
+}
+
+godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_dict) {
+	const Dictionary *dict = (const Dictionary *)p_dict;
+	return dict->empty();
+}
+
+void GDAPI godot_dictionary_erase(godot_dictionary *p_dict, const godot_variant *p_key) {
+	Dictionary *dict = (Dictionary *)p_dict;
+	Variant *key = (Variant *)p_key;
+	dict->erase(*key);
+}
+
+godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_dict, const godot_variant *p_key) {
+	const Dictionary *dict = (const Dictionary *)p_dict;
+	const Variant *key = (const Variant *)p_key;
+	return dict->has(*key);
+}
+
+godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_dict, const godot_array *p_keys) {
+	const Dictionary *dict = (const Dictionary *)p_dict;
+	const Array *keys = (const Array *)p_keys;
+	return dict->has_all(*keys);
+}
+
+uint32_t GDAPI godot_dictionary_hash(const godot_dictionary *p_dict) {
+	const Dictionary *dict = (const Dictionary *)p_dict;
+	return dict->hash();
+}
+
+godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_dict) {
+	godot_array a;
+	godot_array_new(&a);
+	const Dictionary *dict = (const Dictionary *)p_dict;
+	Array *array = (Array *)&a;
+	*array = dict->keys();
+	return a;
+}
+
+godot_int GDAPI godot_dictionary_parse_json(godot_dictionary *p_dict, const godot_string *p_json) {
+	Dictionary *dict = (Dictionary *)p_dict;
+	const String *json = (const String *)p_json;
+	Variant ret;
+	int err_line;
+	String err_str;
+	int err = (int)JSON::parse(*json, ret, err_str, err_line);
+	*dict = ret;
+	return err;
+}
+
+godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key) {
+	Dictionary *dict = (Dictionary *)p_dict;
+	Variant *key = (Variant *)p_key;
+	return (godot_variant *)&dict->operator[](*key);
+}
+
+godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_dict) {
+	const Dictionary *dict = (const Dictionary *)p_dict;
+	return dict->size();
+}
+
+godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_dict) {
+	const Dictionary *dict = (const Dictionary *)p_dict;
+	godot_string str;
+	godot_string_new(&str);
+	String *s = (String *)&str;
+	*s = JSON::print(Variant(*dict));
+	return str;
+}
+
+godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_dict) {
+	godot_array a;
+	godot_array_new(&a);
+	const Dictionary *dict = (const Dictionary *)p_dict;
+	Array *array = (Array *)&a;
+	*array = dict->values();
+	return a;
+}
+
+void GDAPI godot_dictionary_destroy(godot_dictionary *p_dict) {
+	((Dictionary *)p_dict)->~Dictionary();
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 51 - 0
modules/dlscript/godot/godot_dictionary.h

@@ -0,0 +1,51 @@
+#ifndef GODOT_DLSCRIPT_DICTIONARY_H
+#define GODOT_DLSCRIPT_DICTIONARY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_DICITIONARY_TYPE_DEFINED
+typedef struct godot_dictionary {
+	uint8_t _dont_touch_that[8];
+} godot_dictionary;
+#endif
+
+#include "godot_array.h"
+#include "godot_variant.h"
+
+void GDAPI godot_dictionary_new(godot_dictionary *p_dict);
+
+void GDAPI godot_dictionary_clear(godot_dictionary *p_dict);
+
+godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_dict);
+
+void GDAPI godot_dictionary_erase(godot_dictionary *p_dict, const godot_variant *p_key);
+
+godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_dict, const godot_variant *p_key);
+
+godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_dict, const godot_array *p_keys);
+
+uint32_t GDAPI godot_dictionary_hash(const godot_dictionary *p_dict);
+
+godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_dict);
+
+godot_int GDAPI godot_dictionary_parse_json(godot_dictionary *p_dict, const godot_string *p_json);
+
+godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key);
+
+godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_dict);
+
+godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_dict);
+
+godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_dict);
+
+void GDAPI godot_dictionary_destroy(godot_dictionary *p_dict);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_DLSCRIPT_DICTIONARY_H

+ 85 - 0
modules/dlscript/godot/godot_image.cpp

@@ -0,0 +1,85 @@
+#include "godot_image.h"
+
+#include "image.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _image_api_anchor() {
+}
+
+#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr)
+
+void GDAPI godot_image_new(godot_image *p_img) {
+	Image *img = (Image *)p_img;
+	memnew_placement_custom(img, Image, Image());
+}
+
+void GDAPI godot_image_new_with_png_jpg(godot_image *p_img, const uint8_t *p_mem_png_jpg, int p_len) {
+	Image *img = (Image *)p_img;
+	memnew_placement_custom(img, Image, Image(p_mem_png_jpg, p_len));
+}
+
+void GDAPI godot_image_new_with_xpm(godot_image *p_img, const char **p_xpm) {
+	Image *img = (Image *)p_img;
+	memnew_placement_custom(img, Image, Image(p_xpm));
+}
+
+void GDAPI godot_image_new_with_size_format(godot_image *p_img, int p_width, int p_height, bool p_use_mipmaps, godot_image_format p_format) {
+	Image *img = (Image *)p_img;
+	memnew_placement_custom(img, Image, Image(p_width, p_height, p_use_mipmaps, (Image::Format)p_format));
+}
+
+void GDAPI godot_image_new_with_size_format_data(godot_image *p_img, int p_width, int p_height, bool p_use_mipmaps, godot_image_format p_format, godot_pool_byte_array *p_data) {
+	Image *img = (Image *)p_img;
+	PoolVector<uint8_t> *data = (PoolVector<uint8_t> *)p_data;
+	memnew_placement_custom(img, Image, Image(p_width, p_height, p_use_mipmaps, (Image::Format)p_format, *data));
+}
+
+godot_pool_byte_array GDAPI godot_image_get_data(godot_image *p_img) {
+	Image *img = (Image *)p_img;
+	PoolVector<uint8_t> cpp_data = img->get_data();
+	godot_pool_byte_array *data = (godot_pool_byte_array *)&cpp_data;
+	return *data;
+}
+
+godot_error GDAPI godot_image_load(godot_image *p_img, const godot_string *p_path) {
+	Image *img = (Image *)p_img;
+	String *path = (String *)p_path;
+	return (godot_error)img->load(*path);
+}
+
+godot_error GDAPI godot_image_save_png(godot_image *p_img, const godot_string *p_path) {
+	Image *img = (Image *)p_img;
+	String *path = (String *)p_path;
+	return (godot_error)img->save_png(*path);
+}
+
+int GDAPI godot_image_get_width(const godot_image *p_img) {
+	Image *img = (Image *)p_img;
+	return img->get_width();
+}
+
+int GDAPI godot_image_get_height(const godot_image *p_img) {
+	Image *img = (Image *)p_img;
+	return img->get_height();
+}
+
+godot_bool GDAPI godot_image_has_mipmaps(const godot_image *p_img) {
+	Image *img = (Image *)p_img;
+	return img->has_mipmaps();
+}
+
+int GDAPI godot_image_get_mipmap_count(const godot_image *p_img) {
+	Image *img = (Image *)p_img;
+	return img->get_mipmap_count();
+}
+
+void GDAPI godot_image_destroy(godot_image *p_img) {
+	((Image *)p_img)->~Image();
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 95 - 0
modules/dlscript/godot/godot_image.h

@@ -0,0 +1,95 @@
+#ifndef GODOT_DLSCRIPT_IMAGE_H
+#define GODOT_DLSCRIPT_IMAGE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_IMAGE_TYPE_DEFINED
+typedef struct godot_image {
+	uint8_t _dont_touch_that[32];
+} godot_image;
+#endif
+
+#include "godot_pool_arrays.h"
+
+#include "../godot.h"
+
+// This is a copypasta of the C++ enum inside the Image class
+// There's no neat way of automatically updating the C enum / using the C++ enum directly
+// if somebody knows a way feel free to open a PR or open an issue (or ask for Karroffel or bojidar-bg on IRC)
+
+enum godot_image_format {
+
+	GODOT_IMAGE_FORMAT_L8, //luminance
+	GODOT_IMAGE_FORMAT_LA8, //luminance-alpha
+	GODOT_IMAGE_FORMAT_R8,
+	GODOT_IMAGE_FORMAT_RG8,
+	GODOT_IMAGE_FORMAT_RGB8,
+	GODOT_IMAGE_FORMAT_RGBA8,
+	GODOT_IMAGE_FORMAT_RGB565, //16 bit
+	GODOT_IMAGE_FORMAT_RGBA4444,
+	GODOT_IMAGE_FORMAT_RGBA5551,
+	GODOT_IMAGE_FORMAT_RF, //float
+	GODOT_IMAGE_FORMAT_RGF,
+	GODOT_IMAGE_FORMAT_RGBF,
+	GODOT_IMAGE_FORMAT_RGBAF,
+	GODOT_IMAGE_FORMAT_RH, //half float
+	GODOT_IMAGE_FORMAT_RGH,
+	GODOT_IMAGE_FORMAT_RGBH,
+	GODOT_IMAGE_FORMAT_RGBAH,
+	GODOT_IMAGE_FORMAT_DXT1, //s3tc bc1
+	GODOT_IMAGE_FORMAT_DXT3, //bc2
+	GODOT_IMAGE_FORMAT_DXT5, //bc3
+	GODOT_IMAGE_FORMAT_ATI1, //bc4
+	GODOT_IMAGE_FORMAT_ATI2, //bc5
+	GODOT_IMAGE_FORMAT_BPTC_RGBA, //btpc bc6h
+	GODOT_IMAGE_FORMAT_BPTC_RGBF, //float /
+	GODOT_IMAGE_FORMAT_BPTC_RGBFU, //unsigned float
+	GODOT_IMAGE_FORMAT_PVRTC2, //pvrtc
+	GODOT_IMAGE_FORMAT_PVRTC2A,
+	GODOT_IMAGE_FORMAT_PVRTC4,
+	GODOT_IMAGE_FORMAT_PVRTC4A,
+	GODOT_IMAGE_FORMAT_ETC, //etc1
+	GODOT_IMAGE_FORMAT_ETC2_R11, //etc2
+	GODOT_IMAGE_FORMAT_ETC2_R11S, //signed, NOT srgb.
+	GODOT_IMAGE_FORMAT_ETC2_RG11,
+	GODOT_IMAGE_FORMAT_ETC2_RG11S,
+	GODOT_IMAGE_FORMAT_ETC2_RGB8,
+	GODOT_IMAGE_FORMAT_ETC2_RGBA8,
+	GODOT_IMAGE_FORMAT_ETC2_RGB8A1,
+	GODOT_IMAGE_FORMAT_MAX
+};
+typedef enum godot_image_format godot_image_format;
+
+void GDAPI godot_image_new(godot_image *p_img);
+// p_len can be -1
+void GDAPI godot_image_new_with_png_jpg(godot_image *p_img, const uint8_t *p_mem_png_jpg, int p_len);
+void GDAPI godot_image_new_with_xpm(godot_image *p_img, const char **p_xpm);
+
+void GDAPI godot_image_new_with_size_format(godot_image *p_img, int p_width, int p_height, bool p_use_mipmaps, godot_image_format p_format);
+void GDAPI godot_image_new_with_size_format_data(godot_image *p_img, int p_width, int p_height, bool p_use_mipmaps, godot_image_format p_format, godot_pool_byte_array *p_data);
+
+godot_pool_byte_array GDAPI godot_image_get_data(godot_image *p_img);
+
+godot_error GDAPI godot_image_load(godot_image *p_img, const godot_string *p_path);
+godot_error GDAPI godot_image_save_png(godot_image *p_img, const godot_string *p_path);
+
+int GDAPI godot_image_get_width(const godot_image *p_img);
+int GDAPI godot_image_get_height(const godot_image *p_img);
+godot_bool GDAPI godot_image_has_mipmaps(const godot_image *p_img);
+int GDAPI godot_image_get_mipmap_count(const godot_image *p_img);
+
+// @Incomplete
+// I think it's too complex for the binding authors to implement the image class anew, so we should definitely
+// export all methods here. That takes a while so it's on my @Todo list
+
+void GDAPI godot_image_destroy(godot_image *p_img);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_DLSCRIPT_IMAGE_H

+ 280 - 0
modules/dlscript/godot/godot_input_event.cpp

@@ -0,0 +1,280 @@
+#include "godot_input_event.h"
+
+#include "os/input_event.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _input_event_api_anchor() {
+}
+
+void GDAPI godot_input_event_new(godot_input_event *p_ie) {
+	InputEvent *ie = (InputEvent *)p_ie;
+	*ie = InputEvent();
+}
+
+godot_bool GDAPI godot_input_event_is_pressed(const godot_input_event *p_ie) {
+	const InputEvent *ie = (const InputEvent *)p_ie;
+	return ie->is_pressed();
+}
+
+godot_bool GDAPI godot_input_event_is_action(const godot_input_event *p_ie, const godot_string *p_action) {
+	const InputEvent *ie = (const InputEvent *)p_ie;
+	const String *action = (const String *)p_action;
+	return ie->is_action(*action);
+}
+
+godot_bool GDAPI godot_input_event_is_action_pressed(const godot_input_event *p_ie, const godot_string *p_action) {
+	const InputEvent *ie = (const InputEvent *)p_ie;
+	const String *action = (const String *)p_action;
+	return ie->is_action_pressed(*action);
+}
+
+godot_bool GDAPI godot_input_event_is_action_released(const godot_input_event *p_ie, const godot_string *p_action) {
+	const InputEvent *ie = (const InputEvent *)p_ie;
+	const String *action = (const String *)p_action;
+	return ie->is_action_released(*action);
+}
+
+godot_bool GDAPI godot_input_event_is_echo(const godot_input_event *p_ie) {
+	const InputEvent *ie = (const InputEvent *)p_ie;
+	return ie->is_echo();
+}
+
+void GDAPI godot_input_event_set_as_action(godot_input_event *p_ie, const godot_string *p_action, const godot_bool p_pressed) {
+	InputEvent *ie = (InputEvent *)p_ie;
+	const String *action = (const String *)p_action;
+	return ie->set_as_action(*action, p_pressed);
+}
+
+godot_string GDAPI godot_input_event_as_string(const godot_input_event *p_ie) {
+	const InputEvent *ie = (const InputEvent *)p_ie;
+	godot_string str;
+	String *s = (String *)&str;
+	memnew_placement(s, String);
+	*s = (String)*ie;
+	return str;
+}
+
+uint32_t GDAPI *godot_input_event_get_id(godot_input_event *p_ie) {
+	InputEvent *ie = (InputEvent *)p_ie;
+	return &ie->ID;
+}
+
+godot_input_event_type GDAPI *godot_input_event_get_type(godot_input_event *p_ie) {
+	InputEvent *ie = (InputEvent *)p_ie;
+	return (godot_input_event_type *)&ie->type;
+}
+
+godot_int GDAPI *godot_input_event_get_device(godot_input_event *p_ie) {
+	InputEvent *ie = (InputEvent *)p_ie;
+	return &ie->device;
+}
+
+static InputModifierState *_get_mod_for_type(InputEvent *ie) {
+	switch (ie->type) {
+		case InputEvent::MOUSE_BUTTON:
+			return &ie->mouse_button.mod;
+		case InputEvent::MOUSE_MOTION:
+			return &ie->mouse_motion.mod;
+		case InputEvent::KEY:
+			return &ie->key.mod;
+		default:
+			return 0;
+	}
+}
+
+godot_bool GDAPI *godot_input_event_mod_get_alt(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	InputModifierState *mod = _get_mod_for_type(ie);
+	return &mod->alt;
+}
+
+godot_bool GDAPI *godot_input_event_mod_get_ctrl(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	InputModifierState *mod = _get_mod_for_type(ie);
+	return &mod->control;
+}
+
+godot_bool GDAPI *godot_input_event_mod_get_command(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	InputModifierState *mod = _get_mod_for_type(ie);
+	return &mod->command;
+}
+
+godot_bool GDAPI *godot_input_event_mod_get_shift(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	InputModifierState *mod = _get_mod_for_type(ie);
+	return &mod->shift;
+}
+
+godot_bool GDAPI *godot_input_event_mod_get_meta(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	InputModifierState *mod = _get_mod_for_type(ie);
+	return &mod->meta;
+}
+
+uint32_t GDAPI *godot_input_event_key_get_scancode(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->key.scancode;
+}
+
+uint32_t GDAPI *godot_input_event_key_get_unicode(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->key.unicode;
+}
+
+godot_bool GDAPI *godot_input_event_key_get_pressed(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->key.pressed;
+}
+
+godot_bool GDAPI *godot_input_event_key_get_echo(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->key.echo;
+}
+
+float GDAPI *godot_input_event_mouse_get_x(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->mouse_button.x;
+}
+
+float GDAPI *godot_input_event_mouse_get_y(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->mouse_button.y;
+}
+
+float GDAPI *godot_input_event_mouse_get_global_x(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->mouse_button.global_x;
+}
+
+float GDAPI *godot_input_event_mouse_get_global_y(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->mouse_button.global_y;
+}
+
+godot_int GDAPI *godot_input_event_mouse_get_button_mask(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->mouse_button.button_mask;
+}
+
+godot_int GDAPI *godot_input_event_mouse_button_get_button_index(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->mouse_button.button_index;
+}
+
+godot_bool GDAPI *godot_input_event_mouse_button_get_pressed(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->mouse_button.pressed;
+}
+
+godot_bool GDAPI *godot_input_event_mouse_button_get_doubleclick(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->mouse_button.doubleclick;
+}
+
+float GDAPI *godot_input_event_mouse_motion_get_relative_x(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->mouse_motion.relative_x;
+}
+
+float GDAPI *godot_input_event_mouse_motion_get_relative_y(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->mouse_motion.relative_y;
+}
+
+float GDAPI *godot_input_event_mouse_motion_get_speed_x(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->mouse_motion.speed_x;
+}
+
+float GDAPI *godot_input_event_mouse_motion_get_speed_y(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->mouse_motion.speed_y;
+}
+
+godot_int GDAPI *godot_input_event_joypad_motion_get_axis(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->joy_motion.axis;
+}
+
+float GDAPI *godot_input_event_joypad_motion_get_axis_value(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->joy_motion.axis_value;
+}
+
+godot_int GDAPI *godot_input_event_joypad_button_get_button_index(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->joy_button.button_index;
+}
+
+godot_bool GDAPI *godot_input_event_joypad_button_get_pressed(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->joy_button.pressed;
+}
+
+float GDAPI *godot_input_event_joypad_button_get_pressure(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->joy_button.pressure;
+}
+
+godot_int GDAPI *godot_input_event_screen_touch_get_index(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->screen_touch.index;
+}
+
+float GDAPI *godot_input_event_screen_touch_get_x(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->screen_touch.x;
+}
+
+float GDAPI *godot_input_event_screen_touch_get_y(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->screen_touch.y;
+}
+
+godot_bool GDAPI *godot_input_event_screen_touch_get_pressed(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->screen_touch.pressed;
+}
+
+godot_int GDAPI *godot_input_event_screen_drag_get_index(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->screen_drag.index;
+}
+
+float GDAPI *godot_input_event_screen_drag_get_x(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->screen_drag.x;
+}
+
+float GDAPI *godot_input_event_screen_drag_get_y(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->screen_drag.y;
+}
+
+float GDAPI *godot_input_event_screen_drag_get_relative_x(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->screen_drag.relative_x;
+}
+
+float GDAPI *godot_input_event_screen_drag_get_relative_y(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->screen_drag.relative_y;
+}
+
+float GDAPI *godot_input_event_screen_drag_get_speed_x(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->screen_drag.speed_x;
+}
+
+float GDAPI *godot_input_event_screen_drag_get_speed_y(godot_input_event *p_event) {
+	InputEvent *ie = (InputEvent *)p_event;
+	return &ie->screen_drag.speed_y;
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 206 - 0
modules/dlscript/godot/godot_input_event.h

@@ -0,0 +1,206 @@
+#ifndef GODOT_DLSCRIPT_INPUT_EVENT_H
+#define GODOT_DLSCRIPT_INPUT_EVENT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_INPUT_EVENT_TYPE_DEFINED
+typedef struct godot_input_event {
+	uint8_t _dont_touch_that[56];
+} godot_input_event;
+#endif
+
+enum godot_input_event_type {
+	GODOT_INPUT_EVENT_TYPE_NONE,
+	GODOT_INPUT_EVENT_TYPE_KEY,
+	GODOT_INPUT_EVENT_TYPE_MOUSE_MOTION,
+	GODOT_INPUT_EVENT_TYPE_MOUSE_BUTTON,
+	GODOT_INPUT_EVENT_TYPE_JOYPAD_MOTION,
+	GODOT_INPUT_EVENT_TYPE_JOYPAD_BUTTON,
+	GODOT_INPUT_EVENT_TYPE_SCREEN_TOUCH,
+	GODOT_INPUT_EVENT_TYPE_SCREEN_DRAG,
+	GODOT_INPUT_EVENT_TYPE_ACTION,
+	GODOT_INPUT_EVENT_TYPE_TYPE_MAX
+};
+typedef enum godot_input_event_type godot_input_event_type;
+
+enum {
+	GODOT_BUTTON_LEFT = 1,
+	GODOT_BUTTON_RIGHT = 2,
+	GODOT_BUTTON_MIDDLE = 3,
+	GODOT_BUTTON_WHEEL_UP = 4,
+	GODOT_BUTTON_WHEEL_DOWN = 5,
+	GODOT_BUTTON_WHEEL_LEFT = 6,
+	GODOT_BUTTON_WHEEL_RIGHT = 7,
+	GODOT_BUTTON_MASK_LEFT = (1 << (GODOT_BUTTON_LEFT - 1)),
+	GODOT_BUTTON_MASK_RIGHT = (1 << (GODOT_BUTTON_RIGHT - 1)),
+	GODOT_BUTTON_MASK_MIDDLE = (1 << (GODOT_BUTTON_MIDDLE - 1)),
+
+};
+
+enum {
+
+	GODOT_JOY_BUTTON_0 = 0,
+	GODOT_JOY_BUTTON_1 = 1,
+	GODOT_JOY_BUTTON_2 = 2,
+	GODOT_JOY_BUTTON_3 = 3,
+	GODOT_JOY_BUTTON_4 = 4,
+	GODOT_JOY_BUTTON_5 = 5,
+	GODOT_JOY_BUTTON_6 = 6,
+	GODOT_JOY_BUTTON_7 = 7,
+	GODOT_JOY_BUTTON_8 = 8,
+	GODOT_JOY_BUTTON_9 = 9,
+	GODOT_JOY_BUTTON_10 = 10,
+	GODOT_JOY_BUTTON_11 = 11,
+	GODOT_JOY_BUTTON_12 = 12,
+	GODOT_JOY_BUTTON_13 = 13,
+	GODOT_JOY_BUTTON_14 = 14,
+	GODOT_JOY_BUTTON_15 = 15,
+	GODOT_JOY_BUTTON_MAX = 16,
+
+	GODOT_JOY_L = GODOT_JOY_BUTTON_4,
+	GODOT_JOY_R = GODOT_JOY_BUTTON_5,
+	GODOT_JOY_L2 = GODOT_JOY_BUTTON_6,
+	GODOT_JOY_R2 = GODOT_JOY_BUTTON_7,
+	GODOT_JOY_L3 = GODOT_JOY_BUTTON_8,
+	GODOT_JOY_R3 = GODOT_JOY_BUTTON_9,
+	GODOT_JOY_SELECT = GODOT_JOY_BUTTON_10,
+	GODOT_JOY_START = GODOT_JOY_BUTTON_11,
+	GODOT_JOY_DPAD_UP = GODOT_JOY_BUTTON_12,
+	GODOT_JOY_DPAD_DOWN = GODOT_JOY_BUTTON_13,
+	GODOT_JOY_DPAD_LEFT = GODOT_JOY_BUTTON_14,
+	GODOT_JOY_DPAD_RIGHT = GODOT_JOY_BUTTON_15,
+
+	// a little history about game controllers (who copied who)
+
+	GODOT_JOY_SNES_B = GODOT_JOY_BUTTON_0,
+	GODOT_JOY_SNES_A = GODOT_JOY_BUTTON_1,
+	GODOT_JOY_SNES_Y = GODOT_JOY_BUTTON_2,
+	GODOT_JOY_SNES_X = GODOT_JOY_BUTTON_3,
+
+	GODOT_JOY_SONY_CIRCLE = GODOT_JOY_SNES_A,
+	GODOT_JOY_SONY_X = GODOT_JOY_SNES_B,
+	GODOT_JOY_SONY_SQUARE = GODOT_JOY_SNES_Y,
+	GODOT_JOY_SONY_TRIANGLE = GODOT_JOY_SNES_X,
+
+	GODOT_JOY_SEGA_B = GODOT_JOY_SNES_A,
+	GODOT_JOY_SEGA_A = GODOT_JOY_SNES_B,
+	GODOT_JOY_SEGA_X = GODOT_JOY_SNES_Y,
+	GODOT_JOY_SEGA_Y = GODOT_JOY_SNES_X,
+
+	GODOT_JOY_XBOX_B = GODOT_JOY_SEGA_B,
+	GODOT_JOY_XBOX_A = GODOT_JOY_SEGA_A,
+	GODOT_JOY_XBOX_X = GODOT_JOY_SEGA_X,
+	GODOT_JOY_XBOX_Y = GODOT_JOY_SEGA_Y,
+
+	GODOT_JOY_DS_A = GODOT_JOY_SNES_A,
+	GODOT_JOY_DS_B = GODOT_JOY_SNES_B,
+	GODOT_JOY_DS_X = GODOT_JOY_SNES_X,
+	GODOT_JOY_DS_Y = GODOT_JOY_SNES_Y,
+
+	GODOT_JOY_WII_C = GODOT_JOY_BUTTON_5,
+	GODOT_JOY_WII_Z = GODOT_JOY_BUTTON_6,
+
+	GODOT_JOY_WII_MINUS = GODOT_JOY_BUTTON_9,
+	GODOT_JOY_WII_PLUS = GODOT_JOY_BUTTON_10,
+
+	// end of history
+
+	GODOT_JOY_AXIS_0 = 0,
+	GODOT_JOY_AXIS_1 = 1,
+	GODOT_JOY_AXIS_2 = 2,
+	GODOT_JOY_AXIS_3 = 3,
+	GODOT_JOY_AXIS_4 = 4,
+	GODOT_JOY_AXIS_5 = 5,
+	GODOT_JOY_AXIS_6 = 6,
+	GODOT_JOY_AXIS_7 = 7,
+	GODOT_JOY_AXIS_MAX = 8,
+
+	GODOT_JOY_ANALOG_0_X = GODOT_JOY_AXIS_0,
+	GODOT_JOY_ANALOG_0_Y = GODOT_JOY_AXIS_1,
+
+	GODOT_JOY_ANALOG_1_X = GODOT_JOY_AXIS_2,
+	GODOT_JOY_ANALOG_1_Y = GODOT_JOY_AXIS_3,
+
+	GODOT_JOY_ANALOG_2_X = GODOT_JOY_AXIS_4,
+	GODOT_JOY_ANALOG_2_Y = GODOT_JOY_AXIS_5,
+
+	GODOT_JOY_ANALOG_L2 = GODOT_JOY_AXIS_6,
+	GODOT_JOY_ANALOG_R2 = GODOT_JOY_AXIS_7,
+};
+
+#include "../godot.h"
+
+void GDAPI godot_input_event_new(godot_input_event *p_ie);
+
+godot_bool GDAPI godot_input_event_is_pressed(const godot_input_event *p_ie);
+godot_bool GDAPI godot_input_event_is_action(const godot_input_event *p_ie, const godot_string *p_action);
+godot_bool GDAPI godot_input_event_is_action_pressed(const godot_input_event *p_ie, const godot_string *p_action);
+godot_bool GDAPI godot_input_event_is_action_released(const godot_input_event *p_ie, const godot_string *p_action);
+godot_bool GDAPI godot_input_event_is_echo(const godot_input_event *p_ie);
+void GDAPI godot_input_event_set_as_action(godot_input_event *p_ie, const godot_string *p_action, const godot_bool p_pressed);
+
+godot_string GDAPI godot_input_event_as_string(const godot_input_event *p_ie);
+
+// Note:
+// We're returning pointers to the fields in the unions.
+// This is because I'm too lazy to write setter functions
+
+uint32_t GDAPI *godot_input_event_get_id(godot_input_event *p_ie);
+godot_input_event_type GDAPI *godot_input_event_get_type(godot_input_event *p_ie);
+godot_int GDAPI *godot_input_event_get_device(godot_input_event *p_ie);
+
+godot_bool GDAPI *godot_input_event_mod_get_alt(godot_input_event *p_event);
+godot_bool GDAPI *godot_input_event_mod_get_ctrl(godot_input_event *p_event);
+godot_bool GDAPI *godot_input_event_mod_get_command(godot_input_event *p_event);
+godot_bool GDAPI *godot_input_event_mod_get_shift(godot_input_event *p_event);
+godot_bool GDAPI *godot_input_event_mod_get_meta(godot_input_event *p_event);
+
+uint32_t GDAPI *godot_input_event_key_get_scancode(godot_input_event *p_event);
+uint32_t GDAPI *godot_input_event_key_get_unicode(godot_input_event *p_event);
+godot_bool GDAPI *godot_input_event_key_get_pressed(godot_input_event *p_event);
+godot_bool GDAPI *godot_input_event_key_get_echo(godot_input_event *p_event);
+
+float GDAPI *godot_input_event_mouse_get_x(godot_input_event *p_event);
+float GDAPI *godot_input_event_mouse_get_y(godot_input_event *p_event);
+float GDAPI *godot_input_event_mouse_get_global_x(godot_input_event *p_event);
+float GDAPI *godot_input_event_mouse_get_global_y(godot_input_event *p_event);
+godot_int GDAPI *godot_input_event_mouse_get_button_mask(godot_input_event *p_event);
+
+godot_int GDAPI *godot_input_event_mouse_button_get_button_index(godot_input_event *p_event);
+godot_bool GDAPI *godot_input_event_mouse_button_get_pressed(godot_input_event *p_event);
+godot_bool GDAPI *godot_input_event_mouse_button_get_doubleclick(godot_input_event *p_event);
+
+float GDAPI *godot_input_event_mouse_motion_get_relative_x(godot_input_event *p_event);
+float GDAPI *godot_input_event_mouse_motion_get_relative_y(godot_input_event *p_event);
+float GDAPI *godot_input_event_mouse_motion_get_speed_x(godot_input_event *p_event);
+float GDAPI *godot_input_event_mouse_motion_get_speed_y(godot_input_event *p_event);
+
+godot_int GDAPI *godot_input_event_joypad_motion_get_axis(godot_input_event *p_event);
+float GDAPI *godot_input_event_joypad_motion_get_axis_value(godot_input_event *p_event);
+
+godot_int GDAPI *godot_input_event_joypad_button_get_button_index(godot_input_event *p_event);
+godot_bool GDAPI *godot_input_event_joypad_button_get_pressed(godot_input_event *p_event);
+float GDAPI *godot_input_event_joypad_button_get_pressure(godot_input_event *p_event);
+
+godot_int GDAPI *godot_input_event_screen_touch_get_index(godot_input_event *p_event);
+float GDAPI *godot_input_event_screen_touch_get_x(godot_input_event *p_event);
+float GDAPI *godot_input_event_screen_touch_get_y(godot_input_event *p_event);
+godot_bool GDAPI *godot_input_event_screen_touch_get_pressed(godot_input_event *p_event);
+
+godot_int GDAPI *godot_input_event_screen_drag_get_index(godot_input_event *p_event);
+float GDAPI *godot_input_event_screen_drag_get_x(godot_input_event *p_event);
+float GDAPI *godot_input_event_screen_drag_get_y(godot_input_event *p_event);
+float GDAPI *godot_input_event_screen_drag_get_relative_x(godot_input_event *p_event);
+float GDAPI *godot_input_event_screen_drag_get_relative_y(godot_input_event *p_event);
+float GDAPI *godot_input_event_screen_drag_get_speed_x(godot_input_event *p_event);
+float GDAPI *godot_input_event_screen_drag_get_speed_y(godot_input_event *p_event);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_DLSCRIPT_INPUT_EVENT_H

+ 87 - 0
modules/dlscript/godot/godot_node_path.cpp

@@ -0,0 +1,87 @@
+#include "godot_node_path.h"
+
+#include "path_db.h"
+
+#include <memory.h> // why is there no <cmemory> btw?
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _node_path_api_anchor() {
+}
+
+#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr)
+
+// @Bug ?
+// Do I need to memnew_placement when returning strings?
+
+void GDAPI godot_node_path_new(godot_node_path *p_np, const godot_string *p_from) {
+	NodePath *np = (NodePath *)p_np;
+	String *from = (String *)p_from;
+	memnew_placement_custom(np, NodePath, NodePath(*from));
+}
+
+godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_np, const godot_int p_idx) {
+	const NodePath *np = (const NodePath *)p_np;
+	godot_string str;
+	String *s = (String *)&str;
+	memnew_placement(s, String);
+	*s = np->get_name(p_idx);
+	return str;
+}
+
+godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_np) {
+	const NodePath *np = (const NodePath *)p_np;
+	return np->get_name_count();
+}
+
+godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_np) {
+	const NodePath *np = (const NodePath *)p_np;
+	godot_string str;
+	String *s = (String *)&str;
+	memnew_placement(s, String);
+	*s = np->get_property();
+	return str;
+}
+
+godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_np, const godot_int p_idx) {
+	const NodePath *np = (const NodePath *)p_np;
+	godot_string str;
+	String *s = (String *)&str;
+	memnew_placement(s, String);
+	*s = np->get_subname(p_idx);
+	return str;
+}
+
+godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_np) {
+	const NodePath *np = (const NodePath *)p_np;
+	return np->get_subname_count();
+}
+
+godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_np) {
+	const NodePath *np = (const NodePath *)p_np;
+	return np->is_absolute();
+}
+
+godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_np) {
+	const NodePath *np = (const NodePath *)p_np;
+	return np->is_empty();
+}
+
+godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_np) {
+	const NodePath *np = (const NodePath *)p_np;
+	godot_string str;
+	String *s = (String *)&str;
+	memnew_placement(s, String);
+	*s = *np;
+	return str;
+}
+
+void GDAPI godot_node_path_destroy(godot_node_path *p_np) {
+	((NodePath *)p_np)->~NodePath();
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 38 - 0
modules/dlscript/godot/godot_node_path.h

@@ -0,0 +1,38 @@
+#ifndef GODOT_DLSCRIPT_NODE_PATH_H
+#define GODOT_DLSCRIPT_NODE_PATH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED
+typedef struct godot_node_path {
+	uint8_t _dont_touch_that[8];
+} godot_node_path;
+#endif
+
+#include "../godot.h"
+
+void GDAPI godot_node_path_new(godot_node_path *p_np, const godot_string *p_from);
+
+godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_np, const godot_int p_idx);
+godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_np);
+
+godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_np);
+godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_np, const godot_int p_idx);
+godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_np);
+
+godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_np);
+godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_np);
+
+godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_np);
+
+void GDAPI godot_node_path_destroy(godot_node_path *p_np);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_DLSCRIPT_NODE_PATH_H

+ 48 - 0
modules/dlscript/godot/godot_plane.cpp

@@ -0,0 +1,48 @@
+#include "godot_plane.h"
+
+#include "math/plane.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _plane_api_anchor() {
+}
+
+void GDAPI godot_plane_new(godot_plane *p_pl) {
+	Plane *pl = (Plane *)p_pl;
+	*pl = Plane();
+}
+
+void GDAPI godot_plane_new_with_normal(godot_plane *p_pl, const godot_vector3 *p_normal, const godot_real p_d) {
+	Plane *pl = (Plane *)p_pl;
+	const Vector3 *normal = (const Vector3 *)p_normal;
+	*pl = Plane(*normal, p_d);
+}
+
+void GDAPI godot_plane_set_normal(godot_plane *p_pl, const godot_vector3 *p_normal) {
+	Plane *pl = (Plane *)p_pl;
+	const Vector3 *normal = (const Vector3 *)p_normal;
+	pl->set_normal(*normal);
+}
+
+godot_vector3 godot_plane_get_normal(const godot_plane *p_pl) {
+	const Plane *pl = (const Plane *)p_pl;
+	const Vector3 normal = pl->get_normal();
+	godot_vector3 *v3 = (godot_vector3 *)&normal;
+	return *v3;
+}
+
+void GDAPI godot_plane_set_d(godot_plane *p_pl, const godot_real p_d) {
+	Plane *pl = (Plane *)p_pl;
+	pl->d = p_d;
+}
+
+godot_real GDAPI godot_plane_get_d(const godot_plane *p_pl) {
+	const Plane *pl = (const Plane *)p_pl;
+	return pl->d;
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 37 - 0
modules/dlscript/godot/godot_plane.h

@@ -0,0 +1,37 @@
+#ifndef GODOT_DLSCRIPT_PLANE_H
+#define GODOT_DLSCRIPT_PLANE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED
+typedef struct godot_plane {
+	uint8_t _dont_touch_that[16];
+} godot_plane;
+#endif
+
+#include "godot_vector3.h"
+
+void GDAPI godot_plane_new(godot_plane *p_pl);
+void GDAPI godot_plane_new_with_normal(godot_plane *p_pl, const godot_vector3 *p_normal, const godot_real p_d);
+
+// @Incomplete
+// These are additional valid constructors
+// _FORCE_INLINE_ Plane(const Vector3 &p_normal, real_t p_d);
+// _FORCE_INLINE_ Plane(const Vector3 &p_point, const Vector3& p_normal);
+// _FORCE_INLINE_ Plane(const Vector3 &p_point1, const Vector3 &p_point2,const Vector3 &p_point3,ClockDirection p_dir = CLOCKWISE);
+
+void GDAPI godot_plane_set_normal(godot_plane *p_pl, const godot_vector3 *p_normal);
+godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_pl);
+
+godot_real GDAPI godot_plane_get_d(const godot_plane *p_pl);
+void GDAPI godot_plane_set_d(godot_plane *p_pl, const godot_real p_d);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_DLSCRIPT_PLANE_H

+ 558 - 0
modules/dlscript/godot/godot_pool_arrays.cpp

@@ -0,0 +1,558 @@
+#include "godot_pool_arrays.h"
+
+#include "array.h"
+#include "dvector.h"
+#include "variant.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _pool_arrays_api_anchor() {
+}
+
+#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr)
+
+// byte
+
+void GDAPI godot_pool_byte_array_new(godot_pool_byte_array *p_pba) {
+	PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+	memnew_placement(pba, PoolVector<uint8_t>);
+}
+
+void GDAPI godot_pool_byte_array_new_with_array(godot_pool_byte_array *p_pba, const godot_array *p_a) {
+	PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+	Array *a = (Array *)p_a;
+	memnew_placement(pba, PoolVector<uint8_t>);
+
+	pba->resize(a->size());
+	for (size_t i = 0; i < a->size(); i++) {
+		pba->set(i, (*a)[i]);
+	}
+}
+
+void GDAPI godot_pool_byte_array_append(godot_pool_byte_array *p_pba, const uint8_t p_data) {
+	PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+	pba->append(p_data);
+}
+
+void GDAPI godot_pool_byte_array_append_array(godot_pool_byte_array *p_pba, const godot_pool_byte_array *p_array) {
+	PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+	PoolVector<uint8_t> *array = (PoolVector<uint8_t> *)p_array;
+	pba->append_array(*array);
+}
+
+int GDAPI godot_pool_byte_array_insert(godot_pool_byte_array *p_pba, const godot_int p_idx, const uint8_t p_data) {
+	PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+	return pba->insert(p_idx, p_data);
+}
+
+void GDAPI godot_pool_byte_array_invert(godot_pool_byte_array *p_pba) {
+	PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+	pba->invert();
+}
+
+void GDAPI godot_pool_byte_array_push_back(godot_pool_byte_array *p_pba, const uint8_t p_data) {
+	PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+	pba->push_back(p_data);
+}
+
+void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_pba, const godot_int p_idx) {
+	PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+	pba->remove(p_idx);
+}
+
+void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_pba, const godot_int p_size) {
+	PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+	pba->resize(p_size);
+}
+
+void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_pba, const godot_int p_idx, const uint8_t p_data) {
+	PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+	pba->set(p_idx, p_data);
+}
+
+uint8_t GDAPI godot_pool_byte_array_get(godot_pool_byte_array *p_pba, const godot_int p_idx) {
+	PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+	return pba->get(p_idx);
+}
+
+godot_int GDAPI godot_pool_byte_array_size(godot_pool_byte_array *p_pba) {
+	PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+	return pba->size();
+}
+
+void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_pba) {
+	((PoolVector<uint8_t> *)p_pba)->~PoolVector();
+}
+
+// int
+
+void GDAPI godot_pool_int_array_new(godot_pool_int_array *p_pba) {
+	PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+	memnew_placement(pba, PoolVector<uint8_t>);
+}
+
+void GDAPI godot_pool_int_array_new_with_array(godot_pool_int_array *p_pba, const godot_array *p_a) {
+	PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+	Array *a = (Array *)p_a;
+	memnew_placement(pba, PoolVector<uint8_t>);
+
+	pba->resize(a->size());
+	for (size_t i = 0; i < a->size(); i++) {
+		pba->set(i, (*a)[i]);
+	}
+}
+
+void GDAPI godot_pool_int_array_append(godot_pool_int_array *p_pba, const godot_int p_data) {
+	PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+	pba->append(p_data);
+}
+
+void GDAPI godot_pool_int_array_append_array(godot_pool_int_array *p_pba, const godot_pool_int_array *p_array) {
+	PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+	PoolVector<godot_int> *array = (PoolVector<godot_int> *)p_array;
+	pba->append_array(*array);
+}
+
+int GDAPI godot_pool_int_array_insert(godot_pool_int_array *p_pba, const godot_int p_idx, const godot_int p_data) {
+	PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+	return pba->insert(p_idx, p_data);
+}
+
+void GDAPI godot_pool_int_array_invert(godot_pool_int_array *p_pba) {
+	PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+	pba->invert();
+}
+
+void GDAPI godot_pool_int_array_push_back(godot_pool_int_array *p_pba, const godot_int p_data) {
+	PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+	pba->push_back(p_data);
+}
+
+void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_pba, const godot_int p_idx) {
+	PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+	pba->remove(p_idx);
+}
+
+void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_pba, const godot_int p_size) {
+	PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+	pba->resize(p_size);
+}
+
+void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_pba, const godot_int p_idx, const godot_int p_data) {
+	PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+	pba->set(p_idx, p_data);
+}
+
+godot_int GDAPI godot_pool_int_array_get(godot_pool_int_array *p_pba, const godot_int p_idx) {
+	PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+	return pba->get(p_idx);
+}
+
+godot_int GDAPI godot_pool_int_array_size(godot_pool_int_array *p_pba) {
+	PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+	return pba->size();
+}
+
+void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_pba) {
+	((PoolVector<godot_int> *)p_pba)->~PoolVector();
+}
+
+// real
+
+void GDAPI godot_pool_real_array_new(godot_pool_real_array *p_pba) {
+	PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+	memnew_placement(pba, PoolVector<uint8_t>);
+}
+
+void GDAPI godot_pool_real_array_new_with_array(godot_pool_real_array *p_pba, const godot_array *p_a) {
+	PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+	Array *a = (Array *)p_a;
+	memnew_placement(pba, PoolVector<uint8_t>);
+
+	pba->resize(a->size());
+	for (size_t i = 0; i < a->size(); i++) {
+		pba->set(i, (*a)[i]);
+	}
+}
+
+void GDAPI godot_pool_real_array_append(godot_pool_real_array *p_pba, const godot_real p_data) {
+	PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
+	pba->append(p_data);
+}
+
+void GDAPI godot_pool_real_array_append_array(godot_pool_real_array *p_pba, const godot_pool_real_array *p_array) {
+	PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
+	PoolVector<godot_real> *array = (PoolVector<godot_real> *)p_array;
+	pba->append_array(*array);
+}
+
+int GDAPI godot_pool_real_array_insert(godot_pool_real_array *p_pba, const godot_int p_idx, const godot_real p_data) {
+	PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
+	return pba->insert(p_idx, p_data);
+}
+
+void GDAPI godot_pool_real_array_invert(godot_pool_real_array *p_pba) {
+	PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
+	pba->invert();
+}
+
+void GDAPI godot_pool_real_array_push_back(godot_pool_real_array *p_pba, const godot_real p_data) {
+	PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
+	pba->push_back(p_data);
+}
+
+void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_pba, const godot_int p_idx) {
+	PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
+	pba->remove(p_idx);
+}
+
+void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_pba, const godot_int p_size) {
+	PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+	pba->resize(p_size);
+}
+
+void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_pba, const godot_int p_idx, const godot_real p_data) {
+	PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
+	pba->set(p_idx, p_data);
+}
+
+godot_real GDAPI godot_pool_real_array_get(godot_pool_real_array *p_pba, const godot_int p_idx) {
+	PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
+	return pba->get(p_idx);
+}
+
+godot_int GDAPI godot_pool_real_array_size(godot_pool_real_array *p_pba) {
+	PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
+	return pba->size();
+}
+
+void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_pba) {
+	((PoolVector<godot_real> *)p_pba)->~PoolVector();
+}
+
+// string
+
+void GDAPI godot_pool_string_array_new(godot_pool_string_array *p_pba) {
+	PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+	memnew_placement(pba, PoolVector<String>);
+}
+
+void GDAPI godot_pool_string_array_new_with_array(godot_pool_string_array *p_pba, const godot_array *p_a) {
+	PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+	Array *a = (Array *)p_a;
+	memnew_placement(pba, PoolVector<String>);
+
+	pba->resize(a->size());
+	for (size_t i = 0; i < a->size(); i++) {
+		pba->set(i, (*a)[i]);
+	}
+}
+
+void GDAPI godot_pool_string_array_append(godot_pool_string_array *p_pba, const godot_string *p_data) {
+	PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+	String &s = *(String *)p_data;
+	pba->append(s);
+}
+
+void GDAPI godot_pool_string_array_append_array(godot_pool_string_array *p_pba, const godot_pool_string_array *p_array) {
+	PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+	PoolVector<String> *array = (PoolVector<String> *)p_array;
+	pba->append_array(*array);
+}
+
+int GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_pba, const godot_int p_idx, const godot_string *p_data) {
+	PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+	String &s = *(String *)p_data;
+	return pba->insert(p_idx, s);
+}
+
+void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_pba) {
+	PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+	pba->invert();
+}
+
+void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_pba, const godot_string *p_data) {
+	PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+	String &s = *(String *)p_data;
+	pba->push_back(s);
+}
+
+void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_pba, const godot_int p_idx) {
+	PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+	pba->remove(p_idx);
+}
+
+void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_pba, const godot_int p_size) {
+	PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+	pba->resize(p_size);
+}
+
+void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_pba, const godot_int p_idx, const godot_string *p_data) {
+	PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+	String &s = *(String *)p_data;
+	pba->set(p_idx, s);
+}
+
+godot_string GDAPI godot_pool_string_array_get(godot_pool_string_array *p_pba, const godot_int p_idx) {
+	PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+	godot_string str;
+	String *s = (String *)&str;
+	memnew_placement(s, String);
+	*s = pba->get(p_idx);
+	return str;
+}
+
+godot_int GDAPI godot_pool_string_array_size(godot_pool_string_array *p_pba) {
+	PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+	return pba->size();
+}
+
+void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_pba) {
+	((PoolVector<String> *)p_pba)->~PoolVector();
+}
+
+// vector2
+
+void GDAPI godot_pool_vector2_array_new(godot_pool_vector2_array *p_pba) {
+	PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+	memnew_placement(pba, PoolVector<Vector2>);
+}
+
+void GDAPI godot_pool_vector2_array_new_with_array(godot_pool_vector2_array *p_pba, const godot_array *p_a) {
+	PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+	Array *a = (Array *)p_a;
+	memnew_placement(pba, PoolVector<Vector2>);
+
+	pba->resize(a->size());
+	for (size_t i = 0; i < a->size(); i++) {
+		pba->set(i, (*a)[i]);
+	}
+}
+
+void GDAPI godot_pool_vector2_array_append(godot_pool_vector2_array *p_pba, const godot_vector2 *p_data) {
+	PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+	Vector2 &s = *(Vector2 *)p_data;
+	pba->append(s);
+}
+
+void GDAPI godot_pool_vector2_array_append_array(godot_pool_vector2_array *p_pba, const godot_pool_vector2_array *p_array) {
+	PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+	PoolVector<Vector2> *array = (PoolVector<Vector2> *)p_array;
+	pba->append_array(*array);
+}
+
+int GDAPI godot_pool_vector2_array_insert(godot_pool_vector2_array *p_pba, const godot_int p_idx, const godot_vector2 *p_data) {
+	PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+	Vector2 &s = *(Vector2 *)p_data;
+	return pba->insert(p_idx, s);
+}
+
+void GDAPI godot_pool_vector2_array_invert(godot_pool_vector2_array *p_pba) {
+	PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+	pba->invert();
+}
+
+void GDAPI godot_pool_vector2_array_push_back(godot_pool_vector2_array *p_pba, const godot_vector2 *p_data) {
+	PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+	Vector2 &s = *(Vector2 *)p_data;
+	pba->push_back(s);
+}
+
+void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_pba, const godot_int p_idx) {
+	PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+	pba->remove(p_idx);
+}
+
+void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_pba, const godot_int p_size) {
+	PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+	pba->resize(p_size);
+}
+
+void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_pba, const godot_int p_idx, const godot_vector2 *p_data) {
+	PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+	Vector2 &s = *(Vector2 *)p_data;
+	pba->set(p_idx, s);
+}
+
+godot_vector2 GDAPI godot_pool_vector2_array_get(godot_pool_vector2_array *p_pba, const godot_int p_idx) {
+	PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+	godot_vector2 v;
+	Vector2 *s = (Vector2 *)&v;
+	*s = pba->get(p_idx);
+	return v;
+}
+
+godot_int GDAPI godot_pool_vector2_array_size(godot_pool_vector2_array *p_pba) {
+	PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+	return pba->size();
+}
+
+void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_pba) {
+	((PoolVector<Vector2> *)p_pba)->~PoolVector();
+}
+
+// vector3
+
+void GDAPI godot_pool_vector3_array_new(godot_pool_vector3_array *p_pba) {
+	PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+	memnew_placement(pba, PoolVector<Vector3>);
+}
+
+void GDAPI godot_pool_vector3_array_new_with_array(godot_pool_vector3_array *p_pba, const godot_array *p_a) {
+	PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+	Array *a = (Array *)p_a;
+	memnew_placement(pba, PoolVector<Vector3>);
+
+	pba->resize(a->size());
+	for (size_t i = 0; i < a->size(); i++) {
+		pba->set(i, (*a)[i]);
+	}
+}
+
+void GDAPI godot_pool_vector3_array_append(godot_pool_vector3_array *p_pba, const godot_vector3 *p_data) {
+	PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+	Vector3 &s = *(Vector3 *)p_data;
+	pba->append(s);
+}
+
+void GDAPI godot_pool_vector3_array_append_array(godot_pool_vector3_array *p_pba, const godot_pool_vector3_array *p_array) {
+	PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+	PoolVector<Vector3> *array = (PoolVector<Vector3> *)p_array;
+	pba->append_array(*array);
+}
+
+int GDAPI godot_pool_vector3_array_insert(godot_pool_vector3_array *p_pba, const godot_int p_idx, const godot_vector3 *p_data) {
+	PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+	Vector3 &s = *(Vector3 *)p_data;
+	return pba->insert(p_idx, s);
+}
+
+void GDAPI godot_pool_vector3_array_invert(godot_pool_vector3_array *p_pba) {
+	PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+	pba->invert();
+}
+
+void GDAPI godot_pool_vector3_array_push_back(godot_pool_vector3_array *p_pba, const godot_vector3 *p_data) {
+	PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+	Vector3 &s = *(Vector3 *)p_data;
+	pba->push_back(s);
+}
+
+void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_pba, const godot_int p_idx) {
+	PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+	pba->remove(p_idx);
+}
+
+void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_pba, const godot_int p_size) {
+	PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+	pba->resize(p_size);
+}
+
+void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_pba, const godot_int p_idx, const godot_vector3 *p_data) {
+	PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+	Vector3 &s = *(Vector3 *)p_data;
+	pba->set(p_idx, s);
+}
+
+godot_vector3 GDAPI godot_pool_vector3_array_get(godot_pool_vector3_array *p_pba, const godot_int p_idx) {
+	PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+	godot_vector3 v;
+	Vector3 *s = (Vector3 *)&v;
+	*s = pba->get(p_idx);
+	return v;
+}
+
+godot_int GDAPI godot_pool_vector3_array_size(godot_pool_vector3_array *p_pba) {
+	PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+	return pba->size();
+}
+
+void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_pba) {
+	((PoolVector<Vector3> *)p_pba)->~PoolVector();
+}
+
+// color
+
+void GDAPI godot_pool_color_array_new(godot_pool_color_array *p_pba) {
+	PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+	memnew_placement(pba, PoolVector<Color>);
+}
+
+void GDAPI godot_pool_color_array_new_with_array(godot_pool_color_array *p_pba, const godot_array *p_a) {
+	PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+	Array *a = (Array *)p_a;
+	memnew_placement(pba, PoolVector<Color>);
+
+	pba->resize(a->size());
+	for (size_t i = 0; i < a->size(); i++) {
+		pba->set(i, (*a)[i]);
+	}
+}
+
+void GDAPI godot_pool_color_array_append(godot_pool_color_array *p_pba, const godot_color *p_data) {
+	PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+	Color &s = *(Color *)p_data;
+	pba->append(s);
+}
+
+void GDAPI godot_pool_color_array_append_array(godot_pool_color_array *p_pba, const godot_pool_color_array *p_array) {
+	PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+	PoolVector<Color> *array = (PoolVector<Color> *)p_array;
+	pba->append_array(*array);
+}
+
+int GDAPI godot_pool_color_array_insert(godot_pool_color_array *p_pba, const godot_int p_idx, const godot_color *p_data) {
+	PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+	Color &s = *(Color *)p_data;
+	return pba->insert(p_idx, s);
+}
+
+void GDAPI godot_pool_color_array_invert(godot_pool_color_array *p_pba) {
+	PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+	pba->invert();
+}
+
+void GDAPI godot_pool_color_array_push_back(godot_pool_color_array *p_pba, const godot_color *p_data) {
+	PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+	Color &s = *(Color *)p_data;
+	pba->push_back(s);
+}
+
+void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_pba, const godot_int p_idx) {
+	PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+	pba->remove(p_idx);
+}
+
+void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_pba, const godot_int p_size) {
+	PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+	pba->resize(p_size);
+}
+
+void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_pba, const godot_int p_idx, const godot_color *p_data) {
+	PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+	Color &s = *(Color *)p_data;
+	pba->set(p_idx, s);
+}
+
+godot_color GDAPI godot_pool_color_array_get(godot_pool_color_array *p_pba, const godot_int p_idx) {
+	PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+	godot_color v;
+	Color *s = (Color *)&v;
+	*s = pba->get(p_idx);
+	return v;
+}
+
+godot_int GDAPI godot_pool_color_array_size(godot_pool_color_array *p_pba) {
+	PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+	return pba->size();
+}
+
+void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_pba) {
+	((PoolVector<Color> *)p_pba)->~PoolVector();
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 256 - 0
modules/dlscript/godot/godot_pool_arrays.h

@@ -0,0 +1,256 @@
+#ifndef GODOT_DLSCRIPT_POOL_ARRAYS_H
+#define GODOT_DLSCRIPT_POOL_ARRAYS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+/////// PoolByteArray
+
+#ifndef GODOT_CORE_API_GODOT_POOL_BYTE_ARRAY_TYPE_DEFINED
+typedef struct godot_pool_byte_array {
+	uint8_t _dont_touch_that[8];
+} godot_pool_byte_array;
+#endif
+
+/////// PoolIntArray
+
+#ifndef GODOT_CORE_API_GODOT_POOL_INT_ARRAY_TYPE_DEFINED
+typedef struct godot_pool_int_array {
+	uint8_t _dont_touch_that[8];
+} godot_pool_int_array;
+#endif
+
+/////// PoolRealArray
+
+#ifndef GODOT_CORE_API_GODOT_POOL_REAL_ARRAY_TYPE_DEFINED
+typedef struct godot_pool_real_array {
+	uint8_t _dont_touch_that[8];
+} godot_pool_real_array;
+#endif
+
+/////// PoolStringArray
+
+#ifndef GODOT_CORE_API_GODOT_POOL_STRING_ARRAY_TYPE_DEFINED
+typedef struct godot_pool_string_array {
+	uint8_t _dont_touch_that[8];
+} godot_pool_string_array;
+#endif
+
+/////// PoolVector2Array
+
+#ifndef GODOT_CORE_API_GODOT_POOL_VECTOR2_ARRAY_TYPE_DEFINED
+typedef struct godot_pool_vector2_array {
+	uint8_t _dont_touch_that[8];
+} godot_pool_vector2_array;
+#endif
+
+/////// PoolVector3Array
+
+#ifndef GODOT_CORE_API_GODOT_POOL_VECTOR3_ARRAY_TYPE_DEFINED
+typedef struct godot_pool_vector3_array {
+	uint8_t _dont_touch_that[8];
+} godot_pool_vector3_array;
+#endif
+
+/////// PoolColorArray
+
+#ifndef GODOT_CORE_API_GODOT_POOL_COLOR_ARRAY_TYPE_DEFINED
+typedef struct godot_pool_color_array {
+	uint8_t _dont_touch_that[8];
+} godot_pool_color_array;
+#endif
+
+#include "../godot.h"
+
+#include "godot_array.h"
+
+// byte
+
+void GDAPI godot_pool_byte_array_new(godot_pool_byte_array *p_pba);
+void GDAPI godot_pool_byte_array_new_with_array(godot_pool_byte_array *p_pba, const godot_array *p_a);
+
+void GDAPI godot_pool_byte_array_append(godot_pool_byte_array *p_pba, const uint8_t p_data);
+
+void GDAPI godot_pool_byte_array_append_array(godot_pool_byte_array *p_pba, const godot_pool_byte_array *p_array);
+
+int GDAPI godot_pool_byte_array_insert(godot_pool_byte_array *p_pba, const godot_int p_idx, const uint8_t p_data);
+
+void GDAPI godot_pool_byte_array_invert(godot_pool_byte_array *p_pba);
+
+void GDAPI godot_pool_byte_array_push_back(godot_pool_byte_array *p_pba, const uint8_t p_data);
+
+void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_pba, const godot_int p_idx);
+
+void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_pba, const godot_int p_size);
+
+void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_pba, const godot_int p_idx, const uint8_t p_data);
+uint8_t GDAPI godot_pool_byte_array_get(godot_pool_byte_array *p_pba, const godot_int p_idx);
+
+godot_int GDAPI godot_pool_byte_array_size(godot_pool_byte_array *p_pba);
+
+void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_pba);
+
+// int
+
+void GDAPI godot_pool_int_array_new(godot_pool_int_array *p_pia);
+void GDAPI godot_pool_int_array_new_with_array(godot_pool_int_array *p_pia, const godot_array *p_a);
+
+void GDAPI godot_pool_int_array_append(godot_pool_int_array *p_pia, const godot_int p_data);
+
+void GDAPI godot_pool_int_array_append_array(godot_pool_int_array *p_pia, const godot_pool_int_array *p_array);
+
+int GDAPI godot_pool_int_array_insert(godot_pool_int_array *p_pia, const godot_int p_idx, const godot_int p_data);
+
+void GDAPI godot_pool_int_array_invert(godot_pool_int_array *p_pia);
+
+void GDAPI godot_pool_int_array_push_back(godot_pool_int_array *p_pia, const godot_int p_data);
+
+void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_pia, const godot_int p_idx);
+
+void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_pia, const godot_int p_size);
+
+void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_pia, const godot_int p_idx, const godot_int p_data);
+godot_int GDAPI godot_pool_int_array_get(godot_pool_int_array *p_pia, const godot_int p_idx);
+
+godot_int GDAPI godot_pool_int_array_size(godot_pool_int_array *p_pia);
+
+void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_pia);
+
+// real
+
+void GDAPI godot_pool_real_array_new(godot_pool_real_array *p_pra);
+void GDAPI godot_pool_real_array_new_with_array(godot_pool_real_array *p_pra, const godot_array *p_a);
+
+void GDAPI godot_pool_real_array_append(godot_pool_real_array *p_pra, const godot_real p_data);
+
+void GDAPI godot_pool_real_array_append_array(godot_pool_real_array *p_pra, const godot_pool_real_array *p_array);
+
+int GDAPI godot_pool_real_array_insert(godot_pool_real_array *p_pra, const godot_int p_idx, const godot_real p_data);
+
+void GDAPI godot_pool_real_array_invert(godot_pool_real_array *p_pra);
+
+void GDAPI godot_pool_real_array_push_back(godot_pool_real_array *p_pra, const godot_real p_data);
+
+void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_pra, const godot_int p_idx);
+
+void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_pra, const godot_int p_size);
+
+void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_pra, const godot_int p_idx, const godot_real p_data);
+godot_real GDAPI godot_pool_real_array_get(godot_pool_real_array *p_pra, const godot_int p_idx);
+
+godot_int GDAPI godot_pool_real_array_size(godot_pool_real_array *p_pra);
+
+void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_pra);
+
+// string
+
+void GDAPI godot_pool_string_array_new(godot_pool_string_array *p_psa);
+void GDAPI godot_pool_string_array_new_with_array(godot_pool_string_array *p_psa, const godot_array *p_a);
+
+void GDAPI godot_pool_string_array_append(godot_pool_string_array *p_psa, const godot_string *p_data);
+
+void GDAPI godot_pool_string_array_append_array(godot_pool_string_array *p_psa, const godot_pool_string_array *p_array);
+
+int GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_psa, const godot_int p_idx, const godot_string *p_data);
+
+void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_psa);
+
+void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_psa, const godot_string *p_data);
+
+void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_psa, const godot_int p_idx);
+
+void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_psa, const godot_int p_size);
+
+void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_psa, const godot_int p_idx, const godot_string *p_data);
+godot_string GDAPI godot_pool_string_array_get(godot_pool_string_array *p_psa, const godot_int p_idx);
+
+godot_int GDAPI godot_pool_string_array_size(godot_pool_string_array *p_psa);
+
+void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_psa);
+
+// vector2
+
+void GDAPI godot_pool_vector2_array_new(godot_pool_vector2_array *p_pv2a);
+void GDAPI godot_pool_vector2_array_new_with_array(godot_pool_vector2_array *p_pv2a, const godot_array *p_a);
+
+void GDAPI godot_pool_vector2_array_append(godot_pool_vector2_array *p_pv2a, const godot_vector2 *p_data);
+
+void GDAPI godot_pool_vector2_array_append_array(godot_pool_vector2_array *p_pv2a, const godot_pool_vector2_array *p_array);
+
+int GDAPI godot_pool_vector2_array_insert(godot_pool_vector2_array *p_pv2a, const godot_int p_idx, const godot_vector2 *p_data);
+
+void GDAPI godot_pool_vector2_array_invert(godot_pool_vector2_array *p_pv2a);
+
+void GDAPI godot_pool_vector2_array_push_back(godot_pool_vector2_array *p_pv2a, const godot_vector2 *p_data);
+
+void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_pv2a, const godot_int p_idx);
+
+void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_pv2a, const godot_int p_size);
+
+void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_pv2a, const godot_int p_idx, const godot_vector2 *p_data);
+godot_vector2 GDAPI godot_pool_vector2_array_get(godot_pool_vector2_array *p_pv2a, const godot_int p_idx);
+
+godot_int GDAPI godot_pool_vector2_array_size(godot_pool_vector2_array *p_pv2a);
+
+void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_pv2a);
+
+// vector3
+
+void GDAPI godot_pool_vector3_array_new(godot_pool_vector3_array *p_pv3a);
+void GDAPI godot_pool_vector3_array_new_with_array(godot_pool_vector3_array *p_pv3a, const godot_array *p_a);
+
+void GDAPI godot_pool_vector3_array_append(godot_pool_vector3_array *p_pv3a, const godot_vector3 *p_data);
+
+void GDAPI godot_pool_vector3_array_append_array(godot_pool_vector3_array *p_pv3a, const godot_pool_vector3_array *p_array);
+
+int GDAPI godot_pool_vector3_array_insert(godot_pool_vector3_array *p_pv3a, const godot_int p_idx, const godot_vector3 *p_data);
+
+void GDAPI godot_pool_vector3_array_invert(godot_pool_vector3_array *p_pv3a);
+
+void GDAPI godot_pool_vector3_array_push_back(godot_pool_vector3_array *p_pv3a, const godot_vector3 *p_data);
+
+void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_pv3a, const godot_int p_idx);
+
+void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_pv3a, const godot_int p_size);
+
+void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_pv3a, const godot_int p_idx, const godot_vector3 *p_data);
+godot_vector3 GDAPI godot_pool_vector3_array_get(godot_pool_vector3_array *p_pv3a, const godot_int p_idx);
+
+godot_int GDAPI godot_pool_vector3_array_size(godot_pool_vector3_array *p_pv3a);
+
+void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_pv3a);
+
+// color
+
+void GDAPI godot_pool_color_array_new(godot_pool_color_array *p_pca);
+void GDAPI godot_pool_color_array_new_with_array(godot_pool_color_array *p_pca, const godot_array *p_a);
+
+void GDAPI godot_pool_color_array_append(godot_pool_color_array *p_pca, const godot_color *p_data);
+
+void GDAPI godot_pool_color_array_append_array(godot_pool_color_array *p_pca, const godot_pool_color_array *p_array);
+
+int GDAPI godot_pool_color_array_insert(godot_pool_color_array *p_pca, const godot_int p_idx, const godot_color *p_data);
+
+void GDAPI godot_pool_color_array_invert(godot_pool_color_array *p_pca);
+
+void GDAPI godot_pool_color_array_push_back(godot_pool_color_array *p_pca, const godot_color *p_data);
+
+void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_pca, const godot_int p_idx);
+
+void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_pca, const godot_int p_size);
+
+void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_pca, const godot_int p_idx, const godot_color *p_data);
+godot_color GDAPI godot_pool_color_array_get(godot_pool_color_array *p_pca, const godot_int p_idx);
+
+godot_int GDAPI godot_pool_color_array_size(godot_pool_color_array *p_pca);
+
+void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_pca);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_DLSCRIPT_POOL_ARRAYS_H

+ 79 - 0
modules/dlscript/godot/godot_quat.cpp

@@ -0,0 +1,79 @@
+#include "godot_quat.h"
+
+#include "math/quat.h"
+
+#include <memory.h> // why is there no <cmemory> btw?
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _quat_api_anchor() {
+}
+
+void GDAPI godot_quat_new(godot_quat *p_quat) {
+	Quat *quat = (Quat *)p_quat;
+	*quat = Quat();
+}
+
+void GDAPI godot_quat_new_with_elements(godot_quat *p_quat, const godot_real x, const godot_real y, const godot_real z, const godot_real w) {
+	Quat *quat = (Quat *)p_quat;
+	*quat = Quat(x, y, z, w);
+}
+
+void GDAPI godot_quat_new_with_rotation(godot_quat *p_quat, const godot_vector3 *p_axis, const godot_real p_angle) {
+	Quat *quat = (Quat *)p_quat;
+	const Vector3 *axis = (const Vector3 *)p_axis;
+	*quat = Quat(*axis, p_angle);
+}
+
+void GDAPI godot_quat_new_with_shortest_arc(godot_quat *p_quat, const godot_vector3 *p_v0, const godot_vector3 *p_v1) {
+	Quat *quat = (Quat *)p_quat;
+	const Vector3 *v0 = (const Vector3 *)p_v0;
+	const Vector3 *v1 = (const Vector3 *)p_v1;
+	*quat = Quat(*v0, *v1);
+}
+
+godot_vector3 GDAPI godot_quat_get_euler(const godot_quat *p_quat) {
+	Quat *quat = (Quat *)p_quat;
+	Vector3 euler = quat->get_euler();
+	return *(godot_vector3 *)&euler;
+}
+
+void GDAPI godot_quat_set_euler(godot_quat *p_quat, const godot_vector3 *p_euler) {
+	Quat *quat = (Quat *)p_quat;
+	const Vector3 *euler = (const Vector3 *)p_euler;
+	quat->set_euler(*euler);
+}
+
+godot_real GDAPI *godot_quat_index(godot_quat *p_quat, const godot_int p_idx) {
+	Quat *quat = (Quat *)p_quat;
+	switch (p_idx) {
+		case 0:
+			return &quat->x;
+		case 1:
+			return &quat->y;
+		case 2:
+			return &quat->z;
+		default:
+			return &quat->y;
+	}
+}
+
+godot_real GDAPI godot_quat_const_index(const godot_quat *p_quat, const godot_int p_idx) {
+	const Quat *quat = (const Quat *)p_quat;
+	switch (p_idx) {
+		case 0:
+			return quat->x;
+		case 1:
+			return quat->y;
+		case 2:
+			return quat->z;
+		default:
+			return quat->y;
+	}
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 33 - 0
modules/dlscript/godot/godot_quat.h

@@ -0,0 +1,33 @@
+#ifndef GODOT_DLSCRIPT_QUAT_H
+#define GODOT_DLSCRIPT_QUAT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED
+typedef struct godot_quat {
+	uint8_t _dont_touch_that[16];
+} godot_quat;
+#endif
+
+#include "../godot.h"
+
+void GDAPI godot_quat_new(godot_quat *p_quat);
+void GDAPI godot_quat_new_with_elements(godot_quat *p_quat, const godot_real x, const godot_real y, const godot_real z, const godot_real w);
+void GDAPI godot_quat_new_with_rotation(godot_quat *p_quat, const godot_vector3 *p_axis, const godot_real p_angle);
+void GDAPI godot_quat_new_with_shortest_arc(godot_quat *p_quat, const godot_vector3 *p_v0, const godot_vector3 *p_v1);
+
+godot_vector3 GDAPI godot_quat_get_euler(const godot_quat *p_quat);
+void GDAPI godot_quat_set_euler(godot_quat *p_quat, const godot_vector3 *p_euler);
+
+godot_real GDAPI *godot_quat_index(godot_quat *p_quat, const godot_int p_idx);
+godot_real GDAPI godot_quat_const_index(const godot_quat *p_quat, const godot_int p_idx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_DLSCRIPT_QUAT_H

+ 48 - 0
modules/dlscript/godot/godot_rect2.cpp

@@ -0,0 +1,48 @@
+#include "godot_rect2.h"
+
+#include "math/math_2d.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _rect2_api_anchor() {
+}
+
+void GDAPI godot_rect2_new(godot_rect2 *p_rect) {
+	Rect2 *rect = (Rect2 *)p_rect;
+	*rect = Rect2();
+}
+
+void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *p_rect, const godot_vector2 *p_pos, const godot_vector2 *p_size) {
+	Rect2 *rect = (Rect2 *)p_rect;
+	const Vector2 *pos = (const Vector2 *)p_pos;
+	const Vector2 *size = (const Vector2 *)p_size;
+	*rect = Rect2(*pos, *size);
+}
+
+godot_vector2 GDAPI *godot_rect2_get_pos(godot_rect2 *p_rect) {
+	Rect2 *rect = (Rect2 *)p_rect;
+	return (godot_vector2 *)&rect->pos;
+}
+
+void GDAPI godot_rect2_set_pos(godot_rect2 *p_rect, const godot_vector2 *p_pos) {
+	Rect2 *rect = (Rect2 *)p_rect;
+	const Vector2 *pos = (const Vector2 *)p_pos;
+	rect->pos = *pos;
+}
+
+godot_vector2 GDAPI *godot_rect2_get_size(godot_rect2 *p_rect) {
+	Rect2 *rect = (Rect2 *)p_rect;
+	return (godot_vector2 *)&rect->size;
+}
+
+void GDAPI godot_rect2_set_size(godot_rect2 *p_rect, const godot_vector2 *p_size) {
+	Rect2 *rect = (Rect2 *)p_rect;
+	const Vector2 *size = (const Vector2 *)p_size;
+	rect->size = *size;
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 31 - 0
modules/dlscript/godot/godot_rect2.h

@@ -0,0 +1,31 @@
+#ifndef GODOT_DLSCRIPT_RECT2_H
+#define GODOT_DLSCRIPT_RECT2_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED
+typedef struct godot_rect2 {
+	uint8_t _dont_touch_that[16];
+} godot_rect2;
+#endif
+
+#include "../godot.h"
+
+void GDAPI godot_rect2_new(godot_rect2 *p_rect);
+void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *p_rect, const godot_vector2 *p_pos, const godot_vector2 *p_size);
+
+godot_vector2 GDAPI *godot_rect2_get_pos(godot_rect2 *p_rect);
+void GDAPI godot_rect2_set_pos(godot_rect2 *p_rect, const godot_vector2 *p_pos);
+
+godot_vector2 GDAPI *godot_rect2_get_size(godot_rect2 *p_rect);
+void GDAPI godot_rect2_set_size(godot_rect2 *p_rect, const godot_vector2 *p_size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_DLSCRIPT_RECT3_H

+ 48 - 0
modules/dlscript/godot/godot_rect3.cpp

@@ -0,0 +1,48 @@
+#include "godot_rect3.h"
+
+#include "math/rect3.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _rect3_api_anchor() {
+}
+
+void GDAPI godot_rect3_new(godot_rect3 *p_rect) {
+	Rect3 *rect = (Rect3 *)p_rect;
+	*rect = Rect3();
+}
+
+void GDAPI godot_rect3_new_with_pos_and_size(godot_rect3 *p_rect, const godot_vector3 *p_pos, const godot_vector3 *p_size) {
+	Rect3 *rect = (Rect3 *)p_rect;
+	const Vector3 *pos = (const Vector3 *)p_pos;
+	const Vector3 *size = (const Vector3 *)p_size;
+	*rect = Rect3(*pos, *size);
+}
+
+godot_vector3 GDAPI *godot_rect3_get_pos(godot_rect3 *p_rect) {
+	Rect3 *rect = (Rect3 *)p_rect;
+	return (godot_vector3 *)&rect->pos;
+}
+
+void GDAPI godot_rect3_set_pos(godot_rect3 *p_rect, const godot_vector3 *p_pos) {
+	Rect3 *rect = (Rect3 *)p_rect;
+	const Vector3 *pos = (const Vector3 *)p_pos;
+	rect->pos = *pos;
+}
+
+godot_vector3 GDAPI *godot_rect3_get_size(godot_rect3 *p_rect) {
+	Rect3 *rect = (Rect3 *)p_rect;
+	return (godot_vector3 *)&rect->size;
+}
+
+void GDAPI godot_rect3_set_size(godot_rect3 *p_rect, const godot_vector3 *p_size) {
+	Rect3 *rect = (Rect3 *)p_rect;
+	const Vector3 *size = (const Vector3 *)p_size;
+	rect->size = *size;
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 31 - 0
modules/dlscript/godot/godot_rect3.h

@@ -0,0 +1,31 @@
+#ifndef GODOT_DLSCRIPT_RECT3_H
+#define GODOT_DLSCRIPT_RECT3_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED
+typedef struct godot_rect3 {
+	uint8_t _dont_touch_that[24];
+} godot_rect3;
+#endif
+
+#include "../godot.h"
+
+void GDAPI godot_rect3_new(godot_rect3 *p_rect);
+void GDAPI godot_rect3_new_with_pos_and_size(godot_rect3 *p_rect, const godot_vector3 *p_pos, const godot_vector3 *p_size);
+
+godot_vector3 GDAPI *godot_rect3_get_pos(godot_rect3 *p_rect);
+void GDAPI godot_rect3_set_pos(godot_rect3 *p_rect, const godot_vector3 *p_pos);
+
+godot_vector3 GDAPI *godot_rect3_get_size(godot_rect3 *p_rect);
+void GDAPI godot_rect3_set_size(godot_rect3 *p_rect, const godot_vector3 *p_size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_DLSCRIPT_RECT3_H

+ 36 - 0
modules/dlscript/godot/godot_rid.cpp

@@ -0,0 +1,36 @@
+#include "godot_rid.h"
+
+#include "object.h"
+#include "resource.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _rid_api_anchor() {
+}
+
+void GDAPI godot_rid_new(godot_rid *p_rid, godot_object *p_from) {
+
+	Resource *res_from = ((Object *)p_from)->cast_to<Resource>();
+
+	RID *rid = (RID *)p_rid;
+	memnew_placement(rid, RID);
+
+	if (res_from) {
+		*rid = RID(res_from->get_rid());
+	}
+}
+
+uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid) {
+	RID *rid = (RID *)p_rid;
+	return rid->get_id();
+}
+
+void GDAPI godot_rid_destroy(godot_rid *p_rid) {
+	((RID *)p_rid)->~RID();
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 28 - 0
modules/dlscript/godot/godot_rid.h

@@ -0,0 +1,28 @@
+#ifndef GODOT_DLSCRIPT_RID_H
+#define GODOT_DLSCRIPT_RID_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_RID_TYPE_DEFINED
+typedef struct godot_rid {
+	uint8_t _dont_touch_that[8];
+} godot_rid;
+#endif
+
+#include "../godot.h"
+
+void GDAPI godot_rid_new(godot_rid *p_rid, godot_object *p_from);
+
+uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid);
+
+void GDAPI godot_rid_destroy(godot_rid *p_rid);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_DLSCRIPT_RID_H

+ 83 - 0
modules/dlscript/godot/godot_string.cpp

@@ -0,0 +1,83 @@
+#include "godot_string.h"
+
+#include "string_db.h"
+#include "ustring.h"
+
+#include <memory.h> // why is there no <cmemory> btw?
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _string_api_anchor() {
+}
+
+void GDAPI godot_string_new(godot_string *p_str) {
+	String *p = (String *)p_str;
+	memnew_placement(p, String);
+	// *p = String(); // useless here
+}
+
+void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size) {
+	String *p = (String *)p_str;
+	memnew_placement(p, String);
+	*p = String::utf8(p_contents, p_size);
+}
+
+void GDAPI godot_string_get_data(const godot_string *p_str, wchar_t *p_dest, int *p_size) {
+	String *p = (String *)p_str;
+	if (p_size != NULL) {
+		*p_size = p->length();
+	}
+	if (p_dest != NULL) {
+		memcpy(p_dest, p->ptr(), *p_size * sizeof(CharType));
+	}
+}
+
+void GDAPI godot_string_copy_string(const godot_string *p_dest, const godot_string *p_src) {
+	String *dest = (String *)p_dest;
+	String *src = (String *)p_src;
+
+	*dest = *src;
+}
+
+wchar_t GDAPI *godot_string_operator_index(godot_string *p_str, const godot_int p_idx) {
+	String *s = (String *)p_str;
+	return &(s->operator[](p_idx));
+}
+
+const wchar_t GDAPI *godot_string_c_str(const godot_string *p_str) {
+	const String *s = (const String *)p_str;
+	return s->c_str();
+}
+
+godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godot_string *p_b) {
+	String *a = (String *)p_a;
+	String *b = (String *)p_b;
+	return *a == *b;
+}
+
+godot_bool GDAPI godot_string_operator_less(const godot_string *p_a, const godot_string *p_b) {
+	String *a = (String *)p_a;
+	String *b = (String *)p_b;
+	return *a < *b;
+}
+
+void GDAPI godot_string_operator_plus(godot_string *p_dest, const godot_string *p_a, const godot_string *p_b) {
+	String *dest = (String *)p_dest;
+	const String *a = (String *)p_a;
+	const String *b = (String *)p_b;
+
+	String tmp = *a + *b;
+	godot_string_new(p_dest);
+	*dest = tmp;
+}
+
+void GDAPI godot_string_destroy(godot_string *p_str) {
+	String *p = (String *)p_str;
+	p->~String();
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 42 - 0
modules/dlscript/godot/godot_string.h

@@ -0,0 +1,42 @@
+#ifndef GODOT_DLSCRIPT_STRING_H
+#define GODOT_DLSCRIPT_STRING_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED
+typedef struct godot_string {
+	uint8_t _dont_touch_that[8];
+} godot_string;
+#endif
+
+#include "../godot.h"
+
+void GDAPI godot_string_new(godot_string *p_str);
+void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size);
+
+void GDAPI godot_string_get_data(const godot_string *p_str, wchar_t *p_dest, int *p_size);
+
+void GDAPI godot_string_copy_string(const godot_string *p_dest, const godot_string *p_src);
+
+wchar_t GDAPI *godot_string_operator_index(godot_string *p_str, const godot_int p_idx);
+const wchar_t GDAPI *godot_string_c_str(const godot_string *p_str);
+
+godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godot_string *p_b);
+godot_bool GDAPI godot_string_operator_less(const godot_string *p_a, const godot_string *p_b);
+void GDAPI godot_string_operator_plus(godot_string *p_dest, const godot_string *p_a, const godot_string *p_b);
+
+// @Incomplete
+// hmm, I guess exposing the whole API doesn't make much sense
+// since the language used in the library has its own string funcs
+
+void GDAPI godot_string_destroy(godot_string *p_str);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_DLSCRIPT_STRING_H

+ 44 - 0
modules/dlscript/godot/godot_transform.cpp

@@ -0,0 +1,44 @@
+#include "godot_transform.h"
+
+#include "math/transform.h"
+
+#include <memory.h> // why is there no <cmemory> btw?
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _transform_api_anchor() {
+}
+
+void GDAPI godot_transform_new(godot_transform *p_trans) {
+	Transform *trans = (Transform *)p_trans;
+	*trans = Transform();
+}
+
+void GDAPI godot_transform_new_with_basis(godot_transform *p_trans, const godot_basis *p_basis) {
+	Transform *trans = (Transform *)p_trans;
+	const Basis *basis = (const Basis *)p_basis;
+	*trans = Transform(*basis);
+}
+
+void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const godot_basis *p_basis, const godot_vector3 *p_origin) {
+	Transform *trans = (Transform *)p_trans;
+	const Basis *basis = (const Basis *)p_basis;
+	const Vector3 *origin = (const Vector3 *)p_origin;
+	*trans = Transform(*basis, *origin);
+}
+
+godot_basis GDAPI *godot_transform_get_basis(godot_transform *p_trans) {
+	Transform *trans = (Transform *)p_trans;
+	return (godot_basis *)&trans->basis;
+}
+
+godot_vector3 GDAPI *godot_transform_get_origin(godot_transform *p_trans) {
+	Transform *trans = (Transform *)p_trans;
+	return (godot_vector3 *)&trans->origin;
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 29 - 0
modules/dlscript/godot/godot_transform.h

@@ -0,0 +1,29 @@
+#ifndef GODOT_DLSCRIPT_TRANSFORM_H
+#define GODOT_DLSCRIPT_TRANSFORM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED
+typedef struct godot_transform {
+	uint8_t _dont_touch_that[48];
+} godot_transform;
+#endif
+
+#include "../godot.h"
+
+void GDAPI godot_transform_new(godot_transform *p_trans);
+void GDAPI godot_transform_new_with_basis(godot_transform *p_trans, const godot_basis *p_basis);
+void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const godot_basis *p_basis, const godot_vector3 *p_origin);
+
+godot_basis GDAPI *godot_transform_get_basis(godot_transform *p_trans);
+godot_vector3 GDAPI *godot_transform_get_origin(godot_transform *p_trans);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_DLSCRIPT_TRANSFORM_H

+ 59 - 0
modules/dlscript/godot/godot_transform2d.cpp

@@ -0,0 +1,59 @@
+#include "godot_transform2d.h"
+
+#include "../godot.h"
+
+#include "math/math_2d.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _transform2d_api_anchor() {
+}
+
+void GDAPI godot_transform2d_new_identity(godot_transform2d *p_t) {
+	Transform2D *t = (Transform2D *)p_t;
+	*t = Transform2D();
+}
+
+void GDAPI godot_transform2d_new_elements(godot_transform2d *p_t, const godot_vector2 *p_a, const godot_vector2 *p_b, const godot_vector2 *p_c) {
+	Transform2D *t = (Transform2D *)p_t;
+	Vector2 *a = (Vector2 *)p_a;
+	Vector2 *b = (Vector2 *)p_b;
+	Vector2 *c = (Vector2 *)p_c;
+	*t = Transform2D(a->x, a->y, b->x, b->y, c->x, c->y);
+}
+
+void GDAPI godot_transform2d_new(godot_transform2d *p_t, const godot_real p_rot, const godot_vector2 *p_pos) {
+	Transform2D *t = (Transform2D *)p_t;
+	Vector2 *pos = (Vector2 *)p_pos;
+	*t = Transform2D(p_rot, *pos);
+}
+
+godot_vector2 const GDAPI *godot_transform2d_const_index(const godot_transform2d *p_t, const godot_int p_idx) {
+	const Transform2D *t = (const Transform2D *)p_t;
+	const Vector2 *e = &t->operator[](p_idx);
+	return (godot_vector2 const *)e;
+}
+
+godot_vector2 GDAPI *godot_transform2d_index(godot_transform2d *p_t, const godot_int p_idx) {
+	Transform2D *t = (Transform2D *)p_t;
+	Vector2 *e = &t->operator[](p_idx);
+	return (godot_vector2 *)e;
+}
+
+godot_vector2 GDAPI godot_transform2d_get_axis(const godot_transform2d *p_t, const godot_int p_axis) {
+	return *godot_transform2d_const_index(p_t, p_axis);
+}
+
+void GDAPI godot_transform2d_set_axis(godot_transform2d *p_t, const godot_int p_axis, const godot_vector2 *p_vec) {
+	godot_vector2 *origin_v = godot_transform2d_index(p_t, p_axis);
+	*origin_v = *p_vec;
+}
+
+// @Incomplete
+// See header file
+
+#ifdef __cplusplus
+}
+#endif

+ 48 - 0
modules/dlscript/godot/godot_transform2d.h

@@ -0,0 +1,48 @@
+#ifndef GODOT_TRANSFORM2D_H
+#define GODOT_TRANSFORM2D_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED
+#define GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED
+typedef struct godot_transform2d {
+	uint8_t _dont_touch_that[24];
+} godot_transform2d;
+#endif
+
+#include "../godot.h"
+
+#include "godot_vector2.h"
+
+void GDAPI godot_transform2d_new_identity(godot_transform2d *p_t);
+void GDAPI godot_transform2d_new_elements(godot_transform2d *p_t, const godot_vector2 *p_a, const godot_vector2 *p_b, const godot_vector2 *p_c);
+void GDAPI godot_transform2d_new(godot_transform2d *p_t, const godot_real p_rot, const godot_vector2 *p_pos);
+
+/*
+godot_real GDAPI godot_transform2d_tdotx(const godot_transform2d *p_t, const godot_vector2 *p_v);
+godot_real GDAPI godot_transform2d_tdoty(const godot_transform2d *p_t, const godot_vector2 *p_v);
+*/
+
+godot_vector2 const GDAPI *godot_transform2d_const_index(const godot_transform2d *p_t, const godot_int p_idx);
+godot_vector2 GDAPI *godot_transform2d_index(godot_transform2d *p_t, const godot_int p_idx);
+
+godot_vector2 GDAPI godot_transform2d_get_axis(const godot_transform2d *p_t, const godot_int p_axis);
+void GDAPI godot_transform2d_set_axis(godot_transform2d *p_t, const godot_int p_axis, const godot_vector2 *p_vec);
+
+/*
+void GDAPI godot_transform2d_invert(godot_transform2d *p_t);
+godot_transform2d GDAPI godot_transform2d_inverse(const godot_transform2d *p_t);
+*/
+
+// @Incomplete
+// I feel like it should be enough to expose get and set, the whole logic can be done in the bindings.
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_TRANSFORM2D_H

+ 466 - 0
modules/dlscript/godot/godot_variant.cpp

@@ -0,0 +1,466 @@
+#include "godot_variant.h"
+
+#include "../godot.h"
+
+#include "variant.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _variant_api_anchor() {
+}
+
+#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr)
+
+godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	return (godot_variant_type)v->get_type();
+}
+
+void GDAPI godot_variant_copy(godot_variant *p_dest, const godot_variant *p_src) {
+	Variant *dest = (Variant *)p_dest;
+	Variant *src = (Variant *)p_src;
+	*dest = *src;
+}
+
+void GDAPI godot_variant_new_nil(godot_variant *p_v) {
+	Variant *v = (Variant *)p_v;
+	memnew_placement(v, Variant);
+}
+
+void GDAPI godot_variant_new_bool(godot_variant *p_v, const godot_bool p_b) {
+	Variant *v = (Variant *)p_v;
+	memnew_placement_custom(v, Variant, Variant(p_b));
+}
+
+void GDAPI godot_variant_new_int(godot_variant *p_v, const uint64_t p_i) {
+	Variant *v = (Variant *)p_v;
+	memnew_placement_custom(v, Variant, Variant(p_i));
+}
+
+void GDAPI godot_variant_new_real(godot_variant *p_v, const double p_r) {
+	Variant *v = (Variant *)p_v;
+	memnew_placement_custom(v, Variant, Variant(p_r));
+}
+
+void GDAPI godot_variant_new_string(godot_variant *p_v, const godot_string *p_s) {
+	Variant *v = (Variant *)p_v;
+	String *s = (String *)p_s;
+	memnew_placement_custom(v, Variant, Variant(*s));
+}
+
+void GDAPI godot_variant_new_vector2(godot_variant *p_v, const godot_vector2 *p_v2) {
+	Variant *v = (Variant *)p_v;
+	Vector2 *v2 = (Vector2 *)p_v2;
+	memnew_placement_custom(v, Variant, Variant(*v2));
+}
+
+void GDAPI godot_variant_new_rect2(godot_variant *p_v, const godot_rect2 *p_rect2) {
+	Variant *v = (Variant *)p_v;
+	Rect2 *rect2 = (Rect2 *)p_rect2;
+	memnew_placement_custom(v, Variant, Variant(*rect2));
+}
+
+void GDAPI godot_variant_new_vector3(godot_variant *p_v, const godot_vector3 *p_v3) {
+	Variant *v = (Variant *)p_v;
+	Vector3 *v3 = (Vector3 *)p_v3;
+	memnew_placement_custom(v, Variant, Variant(*v3));
+}
+
+void GDAPI godot_variant_new_transform2d(godot_variant *p_v, const godot_transform2d *p_t2d) {
+	Variant *v = (Variant *)p_v;
+	Transform2D *t2d = (Transform2D *)p_t2d;
+	memnew_placement_custom(v, Variant, Variant(*t2d));
+}
+
+void GDAPI godot_variant_new_plane(godot_variant *p_v, const godot_plane *p_plane) {
+	Variant *v = (Variant *)p_v;
+	Plane *plane = (Plane *)p_plane;
+	memnew_placement_custom(v, Variant, Variant(*plane));
+}
+
+void GDAPI godot_variant_new_quat(godot_variant *p_v, const godot_quat *p_quat) {
+	Variant *v = (Variant *)p_v;
+	Quat *quat = (Quat *)p_quat;
+	memnew_placement_custom(v, Variant, Variant(*quat));
+}
+
+void GDAPI godot_variant_new_rect3(godot_variant *p_v, const godot_rect3 *p_rect3) {
+	Variant *v = (Variant *)p_v;
+	Rect3 *rect3 = (Rect3 *)p_rect3;
+	memnew_placement_custom(v, Variant, Variant(*rect3));
+}
+
+void GDAPI godot_variant_new_basis(godot_variant *p_v, const godot_basis *p_basis) {
+	Variant *v = (Variant *)p_v;
+	Basis *basis = (Basis *)p_basis;
+	memnew_placement_custom(v, Variant, Variant(*basis));
+}
+
+void GDAPI godot_variant_new_transform(godot_variant *p_v, const godot_transform *p_trans) {
+	Variant *v = (Variant *)p_v;
+	Transform *trans = (Transform *)p_trans;
+	memnew_placement_custom(v, Variant, Variant(*trans));
+}
+
+void GDAPI godot_variant_new_color(godot_variant *p_v, const godot_color *p_color) {
+	Variant *v = (Variant *)p_v;
+	Color *color = (Color *)p_color;
+	memnew_placement_custom(v, Variant, Variant(*color));
+}
+
+void GDAPI godot_variant_new_image(godot_variant *p_v, const godot_image *p_img) {
+	Variant *v = (Variant *)p_v;
+	Image *img = (Image *)p_img;
+	memnew_placement_custom(v, Variant, Variant(*img));
+}
+
+void GDAPI godot_variant_new_node_path(godot_variant *p_v, const godot_node_path *p_np) {
+	Variant *v = (Variant *)p_v;
+	NodePath *np = (NodePath *)p_np;
+	memnew_placement_custom(v, Variant, Variant(*np));
+}
+
+void GDAPI godot_variant_new_rid(godot_variant *p_v, const godot_rid *p_rid) {
+	Variant *v = (Variant *)p_v;
+	RID *rid = (RID *)p_rid;
+	memnew_placement_custom(v, Variant, Variant(*rid));
+}
+
+void GDAPI godot_variant_new_object(godot_variant *p_v, const godot_object *p_obj) {
+	Variant *v = (Variant *)p_v;
+	Object *obj = (Object *)p_obj;
+	memnew_placement_custom(v, Variant, Variant(obj));
+}
+
+void GDAPI godot_variant_new_input_event(godot_variant *p_v, const godot_input_event *p_event) {
+	Variant *v = (Variant *)p_v;
+	InputEvent *event = (InputEvent *)p_event;
+	memnew_placement_custom(v, Variant, Variant(*event));
+}
+
+void GDAPI godot_variant_new_dictionary(godot_variant *p_v, const godot_dictionary *p_dict) {
+	Variant *v = (Variant *)p_v;
+	Dictionary *dict = (Dictionary *)p_dict;
+	memnew_placement_custom(v, Variant, Variant(*dict));
+}
+
+void GDAPI godot_variant_new_array(godot_variant *p_v, const godot_array *p_arr) {
+	Variant *v = (Variant *)p_v;
+	Array *arr = (Array *)p_arr;
+	memnew_placement_custom(v, Variant, Variant(*arr));
+}
+
+void GDAPI godot_variant_new_pool_byte_array(godot_variant *p_v, const godot_pool_byte_array *p_pba) {
+	Variant *v = (Variant *)p_v;
+	PoolByteArray *pba = (PoolByteArray *)p_pba;
+	memnew_placement_custom(v, Variant, Variant(*pba));
+}
+
+void GDAPI godot_variant_new_pool_int_array(godot_variant *p_v, const godot_pool_int_array *p_pia) {
+	Variant *v = (Variant *)p_v;
+	PoolIntArray *pia = (PoolIntArray *)p_pia;
+	memnew_placement_custom(v, Variant, Variant(*pia));
+}
+
+void GDAPI godot_variant_new_pool_real_array(godot_variant *p_v, const godot_pool_real_array *p_pra) {
+	Variant *v = (Variant *)p_v;
+	PoolRealArray *pra = (PoolRealArray *)p_pra;
+	memnew_placement_custom(v, Variant, Variant(*pra));
+}
+
+void GDAPI godot_variant_new_pool_string_array(godot_variant *p_v, const godot_pool_string_array *p_psa) {
+	Variant *v = (Variant *)p_v;
+	PoolStringArray *psa = (PoolStringArray *)p_psa;
+	memnew_placement_custom(v, Variant, Variant(*psa));
+}
+
+void GDAPI godot_variant_new_pool_vector2_array(godot_variant *p_v, const godot_pool_vector2_array *p_pv2a) {
+	Variant *v = (Variant *)p_v;
+	PoolVector2Array *pv2a = (PoolVector2Array *)p_pv2a;
+	memnew_placement_custom(v, Variant, Variant(*pv2a));
+}
+
+void GDAPI godot_variant_new_pool_vector3_array(godot_variant *p_v, const godot_pool_vector3_array *p_pv3a) {
+	Variant *v = (Variant *)p_v;
+	PoolVector3Array *pv3a = (PoolVector3Array *)p_pv3a;
+	memnew_placement_custom(v, Variant, Variant(*pv3a));
+}
+
+void GDAPI godot_variant_new_pool_color_array(godot_variant *p_v, const godot_pool_color_array *p_pca) {
+	Variant *v = (Variant *)p_v;
+	PoolColorArray *pca = (PoolColorArray *)p_pca;
+	memnew_placement_custom(v, Variant, Variant(*pca));
+}
+
+godot_bool GDAPI godot_variant_as_bool(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	return v->operator bool();
+}
+
+uint64_t GDAPI godot_variant_as_int(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	return v->operator godot_int();
+}
+
+godot_real GDAPI godot_variant_as_real(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	return v->operator godot_real();
+}
+
+godot_string GDAPI godot_variant_as_string(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_string s;
+	godot_string_new(&s);
+	String *str = (String *)&s;
+	*str = v->operator String();
+	return s;
+}
+
+godot_vector2 GDAPI godot_variant_as_vector2(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_vector2 v2;
+	Vector2 *vec2 = (Vector2 *)&v2;
+	*vec2 = *v;
+	return v2;
+}
+
+godot_rect2 GDAPI godot_variant_as_rect2(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_rect2 r2;
+	Rect2 *rect2 = (Rect2 *)&r2;
+	*rect2 = *v;
+	return r2;
+}
+
+godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_vector3 v3;
+	Vector3 *vec3 = (Vector3 *)&v3;
+	*vec3 = *v;
+	return v3;
+}
+
+godot_transform2d GDAPI godot_variant_as_transform2d(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_transform2d t2;
+	Transform2D *t = (Transform2D *)&t2;
+	*t = *v;
+	return t2;
+}
+
+godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_plane p;
+	Plane *pl = (Plane *)&p;
+	*pl = *v;
+	return p;
+}
+
+godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_quat q;
+	Quat *qt = (Quat *)&q;
+	*qt = *v;
+	return q;
+}
+
+godot_rect3 GDAPI godot_variant_as_rect3(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_rect3 r;
+	Rect3 *r3 = (Rect3 *)&r;
+	*r3 = *v;
+	return r;
+}
+
+godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_basis b;
+	Basis *bs = (Basis *)&b;
+	*bs = *v;
+	return b;
+}
+
+godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_transform t;
+	Transform *tr = (Transform *)&t;
+	*tr = *v;
+	return t;
+}
+
+godot_color GDAPI godot_variant_as_color(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_color c;
+	Color *col = (Color *)&c;
+	*col = *v;
+	return c;
+}
+
+godot_image GDAPI godot_variant_as_image(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_image img;
+	godot_image_new(&img);
+	Image *i = (Image *)&img;
+	*i = *v;
+	return img;
+}
+
+godot_node_path GDAPI godot_variant_as_node_path(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_node_path np;
+	memnew_placement_custom((NodePath *)&np, NodePath, NodePath((String)*v));
+	return np;
+}
+
+godot_rid GDAPI godot_variant_as_rid(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_rid rid;
+	memnew_placement_custom((RID *)&rid, RID, RID(*v));
+	return rid;
+}
+
+godot_object GDAPI *godot_variant_as_object(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_object *p = NULL;
+	Object **op = (Object **)&p;
+	*op = *v;
+	return p;
+}
+
+godot_input_event GDAPI godot_variant_as_input_event(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_input_event ev;
+	InputEvent *event = (InputEvent *)&ev;
+	*event = *v;
+	return ev;
+}
+
+godot_dictionary GDAPI godot_variant_as_dictionary(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_dictionary dict;
+	godot_dictionary_new(&dict);
+	Dictionary *d = (Dictionary *)&dict;
+	*d = *v;
+	return dict;
+}
+
+godot_array GDAPI godot_variant_as_array(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_array array;
+	godot_array_new(&array);
+	Array *a = (Array *)&array;
+	*a = *v;
+	return array;
+}
+
+godot_pool_byte_array GDAPI godot_variant_as_pool_byte_array(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_pool_byte_array pba;
+	godot_pool_byte_array_new(&pba);
+	PoolByteArray *p = (PoolByteArray *)&pba;
+	*p = *v;
+	return pba;
+}
+
+godot_pool_int_array GDAPI godot_variant_as_pool_int_array(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_pool_int_array pba;
+	godot_pool_int_array_new(&pba);
+	PoolIntArray *p = (PoolIntArray *)&pba;
+	*p = *v;
+	return pba;
+}
+
+godot_pool_real_array GDAPI godot_variant_as_pool_real_array(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_pool_real_array pba;
+	godot_pool_real_array_new(&pba);
+	PoolRealArray *p = (PoolRealArray *)&pba;
+	*p = *v;
+	return pba;
+}
+
+godot_pool_string_array GDAPI godot_variant_as_pool_string_array(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_pool_string_array pba;
+	godot_pool_string_array_new(&pba);
+	PoolStringArray *p = (PoolStringArray *)&pba;
+	*p = *v;
+	return pba;
+}
+
+godot_pool_vector2_array GDAPI godot_variant_as_pool_vector2_array(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_pool_vector2_array pba;
+	godot_pool_vector2_array_new(&pba);
+	PoolVector2Array *p = (PoolVector2Array *)&pba;
+	*p = *v;
+	return pba;
+}
+
+godot_pool_vector3_array GDAPI godot_variant_as_pool_vector3_array(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_pool_vector3_array pba;
+	godot_pool_vector3_array_new(&pba);
+	PoolVector3Array *p = (PoolVector3Array *)&pba;
+	*p = *v;
+	return pba;
+}
+
+godot_pool_color_array GDAPI godot_variant_as_pool_color_array(const godot_variant *p_v) {
+	const Variant *v = (const Variant *)p_v;
+	godot_pool_color_array pba;
+	godot_pool_color_array_new(&pba);
+	PoolColorArray *p = (PoolColorArray *)&pba;
+	*p = *v;
+	return pba;
+}
+
+godot_variant GDAPI godot_variant_call(godot_variant *p_v, const godot_string *p_method, const godot_variant **p_args, const godot_int p_argcount /*, godot_variant_call_error *r_error */) {
+	Variant *v = (Variant *)p_v;
+	String *method = (String *)p_method;
+	Variant **args = (Variant **)p_args;
+	godot_variant res;
+	memnew_placement_custom((Variant *)&res, Variant, Variant(v->call(*method, args, p_argcount)));
+	return res;
+}
+
+godot_bool GDAPI godot_variant_has_method(godot_variant *p_v, const godot_string *p_method) {
+	Variant *v = (Variant *)p_v;
+	String *method = (String *)p_method;
+	return v->has_method(*method);
+}
+
+godot_bool GDAPI godot_variant_operator_equal(const godot_variant *p_a, const godot_variant *p_b) {
+	const Variant *a = (const Variant *)p_a;
+	const Variant *b = (const Variant *)p_b;
+	return a->operator==(*b);
+}
+
+godot_bool GDAPI godot_variant_operator_less(const godot_variant *p_a, const godot_variant *p_b) {
+	const Variant *a = (const Variant *)p_a;
+	const Variant *b = (const Variant *)p_b;
+	return a->operator<(*b);
+}
+
+godot_bool GDAPI godot_variant_hash_compare(const godot_variant *p_a, const godot_variant *p_b) {
+	const Variant *a = (const Variant *)p_a;
+	const Variant *b = (const Variant *)p_b;
+	return a->hash_compare(*b);
+}
+
+godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_v, godot_bool *p_valid) {
+	const Variant *v = (const Variant *)p_v;
+	bool &valid = *p_valid;
+	return v->booleanize(valid);
+}
+
+void GDAPI godot_variant_destroy(godot_variant *p_v) {
+	((Variant *)p_v)->~Variant();
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 148 - 0
modules/dlscript/godot/godot_variant.h

@@ -0,0 +1,148 @@
+#ifndef GODOT_VARIANT_H
+#define GODOT_VARIANT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED
+typedef struct godot_variant {
+	uint8_t _dont_touch_that[24];
+} godot_variant;
+#endif
+
+struct godot_transform2d;
+typedef struct godot_transform2d godot_transform2d;
+
+#include "godot_array.h"
+#include "godot_dictionary.h"
+#include "godot_input_event.h"
+#include "godot_node_path.h"
+#include "godot_rid.h"
+#include "godot_transform2d.h"
+
+typedef enum godot_variant_type {
+	GODOT_VARIANT_TYPE_NIL,
+
+	// atomic types
+	GODOT_VARIANT_TYPE_BOOL,
+	GODOT_VARIANT_TYPE_INT,
+	GODOT_VARIANT_TYPE_REAL,
+	GODOT_VARIANT_TYPE_STRING,
+
+	// math types
+
+	GODOT_VARIANT_TYPE_VECTOR2, // 5
+	GODOT_VARIANT_TYPE_RECT2,
+	GODOT_VARIANT_TYPE_VECTOR3,
+	GODOT_VARIANT_TYPE_TRANSFORM2D,
+	GODOT_VARIANT_TYPE_PLANE,
+	GODOT_VARIANT_TYPE_QUAT, // 10
+	GODOT_VARIANT_TYPE_RECT3, //sorry naming convention fail :( not like it's used often
+	GODOT_VARIANT_TYPE_BASIS,
+	GODOT_VARIANT_TYPE_TRANSFORM,
+
+	// misc types
+	GODOT_VARIANT_TYPE_COLOR,
+	GODOT_VARIANT_TYPE_IMAGE, // 15
+	GODOT_VARIANT_TYPE_NODE_PATH,
+	GODOT_VARIANT_TYPE_RID,
+	GODOT_VARIANT_TYPE_OBJECT,
+	GODOT_VARIANT_TYPE_INPUT_EVENT,
+	GODOT_VARIANT_TYPE_DICTIONARY, // 20
+	GODOT_VARIANT_TYPE_ARRAY,
+
+	// arrays
+	GODOT_VARIANT_TYPE_POOL_BYTE_ARRAY,
+	GODOT_VARIANT_TYPE_POOL_INT_ARRAY,
+	GODOT_VARIANT_TYPE_POOL_REAL_ARRAY,
+	GODOT_VARIANT_TYPE_POOL_STRING_ARRAY, // 25
+	GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY,
+	GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY,
+	GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY,
+} godot_variant_type;
+
+godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_v);
+
+void GDAPI godot_variant_copy(godot_variant *p_dest, const godot_variant *p_src);
+
+void GDAPI godot_variant_new_nil(godot_variant *p_v);
+
+void GDAPI godot_variant_new_bool(godot_variant *p_v, const godot_bool p_b);
+void GDAPI godot_variant_new_int(godot_variant *p_v, const uint64_t p_i);
+void GDAPI godot_variant_new_real(godot_variant *p_v, const double p_r);
+void GDAPI godot_variant_new_string(godot_variant *p_v, const godot_string *p_s);
+void GDAPI godot_variant_new_vector2(godot_variant *p_v, const godot_vector2 *p_v2);
+void GDAPI godot_variant_new_rect2(godot_variant *p_v, const godot_rect2 *p_rect2);
+void GDAPI godot_variant_new_vector3(godot_variant *p_v, const godot_vector3 *p_v3);
+void GDAPI godot_variant_new_transform2d(godot_variant *p_v, const godot_transform2d *p_t2d);
+void GDAPI godot_variant_new_plane(godot_variant *p_v, const godot_plane *p_plane);
+void GDAPI godot_variant_new_quat(godot_variant *p_v, const godot_quat *p_quat);
+void GDAPI godot_variant_new_rect3(godot_variant *p_v, const godot_rect3 *p_rect3);
+void GDAPI godot_variant_new_basis(godot_variant *p_v, const godot_basis *p_basis);
+void GDAPI godot_variant_new_transform(godot_variant *p_v, const godot_transform *p_trans);
+void GDAPI godot_variant_new_color(godot_variant *p_v, const godot_color *p_color);
+void GDAPI godot_variant_new_image(godot_variant *p_v, const godot_image *p_img);
+void GDAPI godot_variant_new_node_path(godot_variant *p_v, const godot_node_path *p_np);
+void GDAPI godot_variant_new_rid(godot_variant *p_v, const godot_rid *p_rid);
+void GDAPI godot_variant_new_object(godot_variant *p_v, const godot_object *p_obj);
+void GDAPI godot_variant_new_input_event(godot_variant *p_v, const godot_input_event *p_event);
+void GDAPI godot_variant_new_dictionary(godot_variant *p_v, const godot_dictionary *p_dict);
+void GDAPI godot_variant_new_array(godot_variant *p_v, const godot_array *p_arr);
+void GDAPI godot_variant_new_pool_byte_array(godot_variant *p_v, const godot_pool_byte_array *p_pba);
+void GDAPI godot_variant_new_pool_int_array(godot_variant *p_v, const godot_pool_int_array *p_pia);
+void GDAPI godot_variant_new_pool_real_array(godot_variant *p_v, const godot_pool_real_array *p_pra);
+void GDAPI godot_variant_new_pool_string_array(godot_variant *p_v, const godot_pool_string_array *p_psa);
+void GDAPI godot_variant_new_pool_vector2_array(godot_variant *p_v, const godot_pool_vector2_array *p_pv2a);
+void GDAPI godot_variant_new_pool_vector3_array(godot_variant *p_v, const godot_pool_vector3_array *p_pv3a);
+void GDAPI godot_variant_new_pool_color_array(godot_variant *p_v, const godot_pool_color_array *p_pca);
+
+godot_bool GDAPI godot_variant_as_bool(const godot_variant *p_v);
+uint64_t GDAPI godot_variant_as_int(const godot_variant *p_v);
+godot_real GDAPI godot_variant_as_real(const godot_variant *p_v);
+godot_string GDAPI godot_variant_as_string(const godot_variant *p_v);
+godot_vector2 GDAPI godot_variant_as_vector2(const godot_variant *p_v);
+godot_rect2 GDAPI godot_variant_as_rect2(const godot_variant *p_v);
+godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_v);
+godot_transform2d GDAPI godot_variant_as_transform2d(const godot_variant *p_v);
+godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_v);
+godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_v);
+godot_rect3 GDAPI godot_variant_as_rect3(const godot_variant *p_v);
+godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_v);
+godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_v);
+godot_color GDAPI godot_variant_as_color(const godot_variant *p_v);
+godot_image GDAPI godot_variant_as_image(const godot_variant *p_v);
+godot_node_path GDAPI godot_variant_as_node_path(const godot_variant *p_v);
+godot_rid GDAPI godot_variant_as_rid(const godot_variant *p_v);
+godot_object GDAPI *godot_variant_as_object(const godot_variant *p_v);
+godot_input_event GDAPI godot_variant_as_input_event(const godot_variant *p_v);
+godot_dictionary GDAPI godot_variant_as_dictionary(const godot_variant *p_v);
+godot_array GDAPI godot_variant_as_array(const godot_variant *p_v);
+godot_pool_byte_array GDAPI godot_variant_as_pool_byte_array(const godot_variant *p_v);
+godot_pool_int_array GDAPI godot_variant_as_pool_int_array(const godot_variant *p_v);
+godot_pool_real_array GDAPI godot_variant_as_pool_real_array(const godot_variant *p_v);
+godot_pool_string_array GDAPI godot_variant_as_pool_string_array(const godot_variant *p_v);
+godot_pool_vector2_array GDAPI godot_variant_as_pool_vector2_array(const godot_variant *p_v);
+godot_pool_vector3_array GDAPI godot_variant_as_pool_vector3_array(const godot_variant *p_v);
+godot_pool_color_array GDAPI godot_variant_as_pool_color_array(const godot_variant *p_v);
+
+godot_variant GDAPI godot_variant_call(godot_variant *p_v, const godot_string *p_method, const godot_variant **p_args, const godot_int p_argcount /*, godot_variant_call_error *r_error */);
+
+godot_bool GDAPI godot_variant_has_method(godot_variant *p_v, const godot_string *p_method);
+
+godot_bool GDAPI godot_variant_operator_equal(const godot_variant *p_a, const godot_variant *p_b);
+godot_bool GDAPI godot_variant_operator_less(const godot_variant *p_a, const godot_variant *p_b);
+
+godot_bool GDAPI godot_variant_hash_compare(const godot_variant *p_a, const godot_variant *p_b);
+
+godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_v, godot_bool *p_valid);
+
+void GDAPI godot_variant_destroy(godot_variant *p_v);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 124 - 0
modules/dlscript/godot/godot_vector2.cpp

@@ -0,0 +1,124 @@
+#include "godot_vector2.h"
+
+#include "math/math_2d.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _vector2_api_anchor() {
+}
+
+void GDAPI godot_vector2_new(godot_vector2 *p_v, godot_real p_x, godot_real p_y) {
+	Vector2 *v = (Vector2 *)p_v;
+	v->x = p_x;
+	v->y = p_y;
+}
+
+void GDAPI godot_vector2_set_x(godot_vector2 *p_v, const godot_real p_x) {
+	Vector2 *v = (Vector2 *)p_v;
+	v->x = p_x;
+}
+
+void GDAPI godot_vector2_set_y(godot_vector2 *p_v, const godot_real p_y) {
+	Vector2 *v = (Vector2 *)p_v;
+	v->y = p_y;
+}
+
+godot_real GDAPI godot_vector2_get_x(const godot_vector2 *p_v) {
+	Vector2 *v = (Vector2 *)p_v;
+	return v->x;
+}
+godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_v) {
+	Vector2 *v = (Vector2 *)p_v;
+	return v->y;
+}
+
+void GDAPI godot_vector2_normalize(godot_vector2 *p_v) {
+	Vector2 *v = (Vector2 *)p_v;
+	v->normalize();
+}
+void GDAPI godot_vector2_normalized(godot_vector2 *p_dest, const godot_vector2 *p_src) {
+	Vector2 *v = (Vector2 *)p_src;
+	Vector2 *d = (Vector2 *)p_dest;
+
+	*d = v->normalized();
+}
+
+godot_real GDAPI godot_vector2_length(const godot_vector2 *p_v) {
+	Vector2 *v = (Vector2 *)p_v;
+	return v->length();
+}
+
+godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_v) {
+	Vector2 *v = (Vector2 *)p_v;
+	return v->length_squared();
+}
+
+godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_a, const godot_vector2 *p_b) {
+	Vector2 *a = (Vector2 *)p_a;
+	Vector2 *b = (Vector2 *)p_b;
+	return a->distance_to(*b);
+}
+
+godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_a, const godot_vector2 *p_b) {
+	Vector2 *a = (Vector2 *)p_a;
+	Vector2 *b = (Vector2 *)p_b;
+	return a->distance_squared_to(*b);
+}
+
+void GDAPI godot_vector2_operator_add(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b) {
+	Vector2 *dest = (Vector2 *)p_dest;
+	const Vector2 *a = (Vector2 *)p_a;
+	const Vector2 *b = (Vector2 *)p_b;
+	*dest = *a + *b;
+}
+
+void GDAPI godot_vector2_operator_subtract(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b) {
+	Vector2 *dest = (Vector2 *)p_dest;
+	const Vector2 *a = (Vector2 *)p_a;
+	const Vector2 *b = (Vector2 *)p_b;
+	*dest = *a - *b;
+}
+
+void GDAPI godot_vector2_operator_multiply_vector(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b) {
+	Vector2 *dest = (Vector2 *)p_dest;
+	const Vector2 *a = (Vector2 *)p_a;
+	const Vector2 *b = (Vector2 *)p_b;
+	*dest = *a * *b;
+}
+
+void GDAPI godot_vector2_operator_multiply_scalar(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_real p_b) {
+	Vector2 *dest = (Vector2 *)p_dest;
+	const Vector2 *a = (Vector2 *)p_a;
+	*dest = *a * p_b;
+}
+
+void GDAPI godot_vector2_operator_divide_vector(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b) {
+	Vector2 *dest = (Vector2 *)p_dest;
+	const Vector2 *a = (Vector2 *)p_a;
+	const Vector2 *b = (Vector2 *)p_b;
+	*dest = *a / *b;
+}
+
+void GDAPI godot_vector2_operator_divide_scalar(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_real p_b) {
+	Vector2 *dest = (Vector2 *)p_dest;
+	const Vector2 *a = (Vector2 *)p_a;
+	*dest = *a / p_b;
+}
+
+godot_bool GDAPI godot_vector2_operator_equal(const godot_vector2 *p_a, const godot_vector2 *p_b) {
+	const Vector2 *a = (Vector2 *)p_a;
+	const Vector2 *b = (Vector2 *)p_b;
+	return *a == *b;
+}
+
+godot_bool GDAPI godot_vector2_operator_less(const godot_vector2 *p_a, const godot_vector2 *p_b) {
+	const Vector2 *a = (Vector2 *)p_a;
+	const Vector2 *b = (Vector2 *)p_b;
+	return *a < *b;
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 78 - 0
modules/dlscript/godot/godot_vector2.h

@@ -0,0 +1,78 @@
+#ifndef GODOT_VECTOR2_H
+#define GODOT_VECTOR2_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED
+#define GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED
+typedef struct godot_vector2 {
+	uint8_t _dont_touch_that[8];
+} godot_vector2;
+#endif
+
+#include "../godot.h"
+
+void GDAPI godot_vector2_new(godot_vector2 *p_v, const godot_real p_x, const godot_real p_y);
+
+void GDAPI godot_vector2_set_x(godot_vector2 *p_v, const godot_real p_x);
+void GDAPI godot_vector2_set_y(godot_vector2 *p_v, const godot_real p_y);
+godot_real GDAPI godot_vector2_get_x(const godot_vector2 *p_v);
+godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_v);
+
+void GDAPI godot_vector2_normalize(godot_vector2 *p_v);
+void GDAPI godot_vector2_normalized(godot_vector2 *p_dest, const godot_vector2 *p_src);
+
+godot_real GDAPI godot_vector2_length(const godot_vector2 *p_v);
+godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_v);
+
+godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_a, const godot_vector2 *p_b);
+godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_a, const godot_vector2 *p_b);
+
+// @Incomplete
+/*
+ * missing:
+ *
+ *	angle_to
+ *	angle_to_point
+ *	dot
+ *	cross_vector
+ *	cross_scalar
+ *	project
+ *	plane_project
+ *	clamped
+ *	linear_interpolate
+ *	cubic_interpolate
+ *	cubic_interpolate_soft
+ *	slide
+ *	reflect
+ *	angle
+ *	abs
+ *	rotated
+ *	tangent
+ *	floor
+ *	snapped
+ *	aspect
+ *
+ *
+ *	to_string
+ */
+
+void GDAPI godot_vector2_operator_add(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b);
+void GDAPI godot_vector2_operator_subtract(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b);
+void GDAPI godot_vector2_operator_multiply_vector(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b);
+void GDAPI godot_vector2_operator_multiply_scalar(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_real p_b);
+void GDAPI godot_vector2_operator_divide_vector(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b);
+void GDAPI godot_vector2_operator_divide_scalar(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_real p_b);
+
+godot_bool GDAPI godot_vector2_operator_equal(const godot_vector2 *p_a, const godot_vector2 *p_b);
+godot_bool GDAPI godot_vector2_operator_less(const godot_vector2 *p_a, const godot_vector2 *p_b);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_VECTOR2_H

+ 150 - 0
modules/dlscript/godot/godot_vector3.cpp

@@ -0,0 +1,150 @@
+#include "godot_vector3.h"
+
+#include "math/vector3.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _vector3_api_anchor() {
+}
+
+void GDAPI godot_vector3_new(godot_vector3 *p_v, const godot_real p_x, const godot_real p_y, const godot_real p_z) {
+	Vector3 *v = (Vector3 *)p_v;
+	*v = Vector3(p_x, p_y, p_z);
+}
+
+void GDAPI godot_vector3_set_axis(godot_vector3 *p_v, const godot_int p_axis, const godot_real p_val) {
+	Vector3 *v = (Vector3 *)p_v;
+	v->set_axis(p_axis, p_val);
+}
+
+godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_v, const godot_int p_axis) {
+	Vector3 *v = (Vector3 *)p_v;
+	return v->get_axis(p_axis);
+}
+
+godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_v) {
+	Vector3 *v = (Vector3 *)p_v;
+	return v->min_axis();
+}
+
+godot_int GDAPI godot_vector3_max_axis(const godot_vector3 *p_v) {
+	Vector3 *v = (Vector3 *)p_v;
+	return v->max_axis();
+}
+
+godot_real GDAPI godot_vector3_length(const godot_vector3 *p_v) {
+	Vector3 *v = (Vector3 *)p_v;
+	return v->length();
+}
+
+godot_real GDAPI godot_vector3_length_squared(const godot_vector3 *p_v) {
+	Vector3 *v = (Vector3 *)p_v;
+	return v->length_squared();
+}
+
+void GDAPI godot_vector3_normalize(godot_vector3 *p_v) {
+	Vector3 *v = (Vector3 *)p_v;
+	v->normalize();
+}
+
+void GDAPI godot_vector3_normalized(godot_vector3 *p_dest, const godot_vector3 *p_src) {
+	Vector3 *src = (Vector3 *)p_src;
+	Vector3 *dest = (Vector3 *)p_dest;
+	*dest = src->normalized();
+}
+
+/*
+ * inverse
+ * zero
+ * snap
+ * snapped
+ * rotate
+ * rotated
+ *
+ *
+ * linear_interpolate
+ * cubic_interpolate
+ * cubic_interpolaten
+ * cross
+ * dot
+ * outer
+ * to_diagonal_matrix
+ * abs
+ * floor
+ * ceil
+ */
+
+godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_a, const godot_vector3 *p_b) {
+	Vector3 *a = (Vector3 *)p_a;
+	Vector3 *b = (Vector3 *)p_b;
+	return a->distance_to(*b);
+}
+
+godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_a, const godot_vector3 *p_b) {
+	Vector3 *a = (Vector3 *)p_a;
+	Vector3 *b = (Vector3 *)p_b;
+	return a->distance_squared_to(*b);
+}
+
+/*
+ * slide
+ * reflect
+ */
+
+void GDAPI godot_vector3_operator_add(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b) {
+	Vector3 *dest = (Vector3 *)p_dest;
+	Vector3 *a = (Vector3 *)p_a;
+	Vector3 *b = (Vector3 *)p_b;
+	*dest = *a + *b;
+}
+
+void GDAPI godot_vector3_operator_subtract(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b) {
+	Vector3 *dest = (Vector3 *)p_dest;
+	Vector3 *a = (Vector3 *)p_a;
+	Vector3 *b = (Vector3 *)p_b;
+	*dest = *a - *b;
+}
+
+void GDAPI godot_vector3_operator_multiply_vector(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b) {
+	Vector3 *dest = (Vector3 *)p_dest;
+	Vector3 *a = (Vector3 *)p_a;
+	Vector3 *b = (Vector3 *)p_b;
+	*dest = *a * *b;
+}
+
+void GDAPI godot_vector3_operator_multiply_scalar(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_real p_b) {
+	Vector3 *dest = (Vector3 *)p_dest;
+	Vector3 *a = (Vector3 *)p_a;
+	*dest = *a * p_b;
+}
+
+void GDAPI godot_vector3_operator_divide_vector(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b) {
+	Vector3 *dest = (Vector3 *)p_dest;
+	Vector3 *a = (Vector3 *)p_a;
+	Vector3 *b = (Vector3 *)p_b;
+	*dest = *a / *b;
+}
+
+void GDAPI godot_vector3_operator_divide_scalar(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_real p_b) {
+	Vector3 *dest = (Vector3 *)p_dest;
+	Vector3 *a = (Vector3 *)p_a;
+	*dest = *a / p_b;
+}
+
+godot_bool GDAPI godot_vector3_operator_equal(const godot_vector3 *p_a, const godot_vector3 *p_b) {
+	Vector3 *a = (Vector3 *)p_a;
+	Vector3 *b = (Vector3 *)p_b;
+	return *a == *b;
+}
+
+godot_bool GDAPI godot_vector3_operator_less(const godot_vector3 *p_a, const godot_vector3 *p_b) {
+	Vector3 *a = (Vector3 *)p_a;
+	Vector3 *b = (Vector3 *)p_b;
+	return *a < *b;
+}
+
+#ifdef __cplusplus
+}
+#endif

+ 82 - 0
modules/dlscript/godot/godot_vector3.h

@@ -0,0 +1,82 @@
+#ifndef GODOT_VECTOR3_H
+#define GODOT_VECTOR3_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_VECTOR3_TYPE_DEFINED
+typedef struct godot_vector3 {
+	uint8_t _dont_touch_that[12];
+} godot_vector3;
+#endif
+
+#include "../godot.h"
+
+void GDAPI godot_vector3_new(godot_vector3 *p_v, const godot_real p_x, const godot_real p_y, const godot_real p_z);
+
+void GDAPI godot_vector3_set_axis(godot_vector3 *p_v, const godot_int p_axis, const godot_real p_val);
+godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_v, const godot_int p_axis);
+
+godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_v);
+godot_int GDAPI godot_vector3_max_axis(const godot_vector3 *p_v);
+
+godot_real GDAPI godot_vector3_length(const godot_vector3 *p_v);
+godot_real GDAPI godot_vector3_length_squared(const godot_vector3 *p_v);
+
+void GDAPI godot_vector3_normalize(godot_vector3 *p_v);
+void GDAPI godot_vector3_normalized(godot_vector3 *p_dest, const godot_vector3 *p_src);
+
+// @Incomplete
+
+/*
+ * inverse
+ * zero
+ * snap
+ * snapped
+ * rotate
+ * rotated
+ *
+ *
+ * linear_interpolate
+ * cubic_interpolate
+ * cubic_interpolaten
+ * cross
+ * dot
+ * outer
+ * to_diagonal_matrix
+ * abs
+ * floor
+ * ceil
+ */
+
+godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_a, const godot_vector3 *p_b);
+godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_a, const godot_vector3 *p_b);
+
+// @Incomplete
+/*
+ * slide
+ * reflect
+ */
+
+void GDAPI godot_vector3_operator_add(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b);
+void GDAPI godot_vector3_operator_subtract(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b);
+void GDAPI godot_vector3_operator_multiply_vector(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b);
+void GDAPI godot_vector3_operator_multiply_scalar(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_real p_b);
+void GDAPI godot_vector3_operator_divide_vector(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b);
+void GDAPI godot_vector3_operator_divide_scalar(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_real p_b);
+
+godot_bool GDAPI godot_vector3_operator_equal(const godot_vector3 *p_a, const godot_vector3 *p_b);
+godot_bool GDAPI godot_vector3_operator_less(const godot_vector3 *p_a, const godot_vector3 *p_b);
+
+/*
+ * to_string
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_VECTOR3_H

+ 37 - 2
modules/cscript/register_types.cpp → modules/dlscript/register_types.cpp

@@ -27,8 +27,43 @@
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
 /*************************************************************************/
 /*************************************************************************/
 #include "register_types.h"
 #include "register_types.h"
+#include "dl_script.h"
 
 
-void register_cscript_types() {
+#include "io/resource_loader.h"
+#include "io/resource_saver.h"
+
+DLScriptLanguage *script_language_dl = NULL;
+ResourceFormatLoaderDLScript *resource_loader_dl = NULL;
+ResourceFormatSaverDLScript *resource_saver_dl = NULL;
+//ResourceFormatLoaderDLLibrary *resource_loader_dllib=NULL;
+
+void register_dlscript_types() {
+
+	ClassDB::register_class<DLLibrary>();
+	ClassDB::register_class<DLScript>();
+
+	script_language_dl = memnew(DLScriptLanguage);
+	//script_language_gd->init();
+	ScriptServer::register_language(script_language_dl);
+	resource_loader_dl = memnew(ResourceFormatLoaderDLScript);
+	ResourceLoader::add_resource_format_loader(resource_loader_dl);
+	resource_saver_dl = memnew(ResourceFormatSaverDLScript);
+	ResourceSaver::add_resource_format_saver(resource_saver_dl);
+
+	// resource_loader_dllib=memnew( ResourceFormatLoaderDLLibrary );
+	// ResourceLoader::add_resource_format_loader(resource_loader_gd);
 }
 }
-void unregister_cscript_types() {
+
+void unregister_dlscript_types() {
+
+	ScriptServer::unregister_language(script_language_dl);
+
+	if (script_language_dl)
+		memdelete(script_language_dl);
+
+	if (resource_loader_dl)
+		memdelete(resource_loader_dl);
+
+	if (resource_saver_dl)
+		memdelete(resource_saver_dl);
 }
 }

+ 2 - 2
modules/cscript/register_types.h → modules/dlscript/register_types.h

@@ -26,5 +26,5 @@
 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
 /*************************************************************************/
 /*************************************************************************/
-void register_cscript_types();
-void unregister_cscript_types();
+void register_dlscript_types();
+void unregister_dlscript_types();

+ 26 - 0
platform/windows/os_windows.cpp

@@ -1582,6 +1582,32 @@ bool OS_Windows::get_borderless_window() {
 	return video_mode.borderless_window;
 	return video_mode.borderless_window;
 }
 }
 
 
+Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_handle) {
+	p_library_handle = (void *)LoadLibrary(p_path.utf8().get_data());
+	if (!p_library_handle) {
+		ERR_EXPLAIN("Can't open dynamic library: " + p_path + ". Error: " + String::num(GetLastError()));
+		ERR_FAIL_V(ERR_CANT_OPEN);
+	}
+	return OK;
+}
+
+Error OS_Windows::close_dynamic_library(void *p_library_handle) {
+	if (!FreeLibrary((HMODULE)p_library_handle)) {
+		return FAILED;
+	}
+	return OK;
+}
+
+Error OS_Windows::get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle) {
+	char *error;
+	p_symbol_handle = (void *)GetProcAddress((HMODULE)p_library_handle, p_name.utf8().get_data());
+	if (!p_symbol_handle) {
+		ERR_EXPLAIN("Can't resolve symbol " + p_name + ". Error: " + String::num(GetLastError()));
+		ERR_FAIL_V(ERR_CANT_RESOLVE);
+	}
+	return OK;
+}
+
 void OS_Windows::request_attention() {
 void OS_Windows::request_attention() {
 
 
 	FLASHWINFO info;
 	FLASHWINFO info;

+ 4 - 0
platform/windows/os_windows.h

@@ -222,6 +222,10 @@ public:
 	virtual void set_borderless_window(int p_borderless);
 	virtual void set_borderless_window(int p_borderless);
 	virtual bool get_borderless_window();
 	virtual bool get_borderless_window();
 
 
+	virtual Error open_dynamic_library(const String p_path, void *&p_library_handle);
+	virtual Error close_dynamic_library(void *p_library_handle);
+	virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle);
+
 	virtual MainLoop *get_main_loop() const;
 	virtual MainLoop *get_main_loop() const;
 
 
 	virtual String get_name();
 	virtual String get_name();