diff options
Diffstat (limited to 'core/os')
40 files changed, 353 insertions, 1363 deletions
diff --git a/core/os/copymem.cpp b/core/os/copymem.cpp deleted file mode 100644 index 49f53f1a51..0000000000 --- a/core/os/copymem.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/*************************************************************************/ -/* copymem.cpp */ -/*************************************************************************/ -/* 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. */ -/*************************************************************************/ -#include "copymem.h" - -#include <string.h> - -void movemem_system(void *to, void *from,int amount) { - - memmove(to,from,amount); - -} - -void zeromem(void* p_mem,size_t p_bytes) { - - memset(p_mem,0,p_bytes); -} diff --git a/core/os/copymem.h b/core/os/copymem.h index d7fc46aae4..0452b1a36c 100644 --- a/core/os/copymem.h +++ b/core/os/copymem.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ @@ -31,89 +31,18 @@ #include "typedefs.h" -///@TODO use optimized routines for this, depending on platform. these are just the standard ones +#ifdef PLATFORM_COPYMEM -#define copymem(m_to,m_from,m_count) \ - do { \ - unsigned char * _from=(unsigned char*)m_from; \ - unsigned char * _to=(unsigned char*)m_to; \ - int _count=m_count; \ - for (int _i=0;_i<_count;_i++) \ - _to[_i]=_from[_i]; \ - } while (0); - /* - case 0: *_dto++ = *_dfrom++; \ - case 7: *_dto++ = *_dfrom++; \ - case 6: *_dto++ = *_dfrom++; \ - case 5: *_dto++ = *_dfrom++; \ - case 4: *_dto++ = *_dfrom++; \ - case 3: *_dto++ = *_dfrom++; \ - case 2: *_dto++ = *_dfrom++; \ - case 1: *_dto++ = *_dfrom++; \ - */ -#define movemem_duff(m_to, m_from, m_count) \ - do { \ - if (m_to<m_from) { \ - unsigned char* _dto = (unsigned char*)m_to; \ - unsigned char* _dfrom = (unsigned char*)m_from; \ - int n = (m_count + 7) / 8; \ - switch (m_count % 8) { \ - do { \ - case 0: *_dto++ = *_dfrom++; \ - case 7: *_dto++ = *_dfrom++; \ - case 6: *_dto++ = *_dfrom++; \ - case 5: *_dto++ = *_dfrom++; \ - case 4: *_dto++ = *_dfrom++; \ - case 3: *_dto++ = *_dfrom++; \ - case 2: *_dto++ = *_dfrom++; \ - case 1: *_dto++ = *_dfrom++; \ - } while (--n > 0); \ - }; \ - } else if (m_to>m_from) { \ - unsigned char* _dto = &((unsigned char*)m_to)[m_count-1]; \ - unsigned char* _dfrom = &((unsigned char*)m_from)[m_count-1]; \ - int n = (m_count + 7) / 8; \ - switch (m_count % 8) { \ - do { \ - case 0: *_dto-- = *_dfrom--; \ - case 7: *_dto-- = *_dfrom--; \ - case 6: *_dto-- = *_dfrom--; \ - case 5: *_dto-- = *_dfrom--; \ - case 4: *_dto-- = *_dfrom--; \ - case 3: *_dto-- = *_dfrom--; \ - case 2: *_dto-- = *_dfrom--; \ - case 1: *_dto-- = *_dfrom--; \ - } while (--n > 0); \ - }; \ - } \ - } while(0) \ +#include "platform_copymem.h" // included from platform/<current_platform>/platform_copymem.h" -#define movemem_conventional(m_to,m_from,m_count) \ - do { \ - if (m_to<m_from) { \ - unsigned char * _from=(unsigned char*)m_from; \ - unsigned char * _to=(unsigned char*)m_to; \ - int _count=m_count; \ - for (int _i=0;_i<_count;_i++) \ - _to[_i]=_from[_i]; \ - \ - } else if (m_to>m_from) { \ - unsigned char * _from=(unsigned char*)m_from; \ - unsigned char * _to=(unsigned char*)m_to; \ - int _count=m_count; \ - while (_count--) \ - _to[_count]=_from[_count]; \ - \ - \ - } \ - } while (0); \ +#else -void movemem_system(void*,void*,int); +#include <string.h> -#define movemem movemem_system - - -void zeromem(void* p_mem,size_t p_bytes); +#define copymem(to,from,count) memcpy(to,from,count) +#define zeromem(to, count) memset(to, 0, count) +#define movemem(to, from, count) memmove(to, from, count) #endif +#endif diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp index c2402183fd..804fe15c39 100644 --- a/core/os/dir_access.cpp +++ b/core/os/dir_access.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ @@ -37,7 +37,7 @@ String DirAccess::_get_root_path() const { switch(_access_type) { - case ACCESS_RESOURCES: return Globals::get_singleton()->get_resource_path(); + case ACCESS_RESOURCES: return GlobalConfig::get_singleton()->get_resource_path(); case ACCESS_USERDATA: return OS::get_singleton()->get_data_dir(); default: return ""; } @@ -204,10 +204,10 @@ String DirAccess::fix_path(String p_path) const { case ACCESS_RESOURCES: { - if (Globals::get_singleton()) { + if (GlobalConfig::get_singleton()) { if (p_path.begins_with("res://")) { - String resource_path = Globals::get_singleton()->get_resource_path(); + String resource_path = GlobalConfig::get_singleton()->get_resource_path(); if (resource_path != "") { return p_path.replace_first("res:/",resource_path); diff --git a/core/os/dir_access.h b/core/os/dir_access.h index 83288b7c91..7c173fc780 100644 --- a/core/os/dir_access.h +++ b/core/os/dir_access.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ @@ -72,7 +72,7 @@ protected: public: - virtual bool list_dir_begin()=0; ///< This starts dir listing + virtual Error list_dir_begin()=0; ///< This starts dir listing virtual String get_next(bool* p_is_dir); // compatibility virtual String get_next()=0; virtual bool current_is_dir() const=0; diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp index 2f1693c044..06723c5131 100644 --- a/core/os/file_access.cpp +++ b/core/os/file_access.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ @@ -139,10 +139,10 @@ String FileAccess::fix_path(const String& p_path) const { case ACCESS_RESOURCES: { - if (Globals::get_singleton()) { + if (GlobalConfig::get_singleton()) { if (r_path.begins_with("res://")) { - String resource_path = Globals::get_singleton()->get_resource_path(); + String resource_path = GlobalConfig::get_singleton()->get_resource_path(); if (resource_path != "") { return r_path.replace("res:/",resource_path); diff --git a/core/os/file_access.h b/core/os/file_access.h index 5178c469bc..7d61099bc2 100644 --- a/core/os/file_access.h +++ b/core/os/file_access.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ diff --git a/core/os/input.cpp b/core/os/input.cpp index 4ab57a84ea..acfd5ba540 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ @@ -49,39 +49,39 @@ Input::MouseMode Input::get_mouse_mode() const { void Input::_bind_methods() { - ObjectTypeDB::bind_method(_MD("is_key_pressed","scancode"),&Input::is_key_pressed); - ObjectTypeDB::bind_method(_MD("is_mouse_button_pressed","button"),&Input::is_mouse_button_pressed); - ObjectTypeDB::bind_method(_MD("is_joy_button_pressed","device","button"),&Input::is_joy_button_pressed); - ObjectTypeDB::bind_method(_MD("is_action_pressed","action"),&Input::is_action_pressed); - ObjectTypeDB::bind_method(_MD("is_action_just_pressed","action"),&Input::is_action_just_pressed); - ObjectTypeDB::bind_method(_MD("is_action_just_released","action"),&Input::is_action_just_released); - ObjectTypeDB::bind_method(_MD("add_joy_mapping","mapping", "update_existing"),&Input::add_joy_mapping, DEFVAL(false)); - ObjectTypeDB::bind_method(_MD("remove_joy_mapping","guid"),&Input::remove_joy_mapping); - ObjectTypeDB::bind_method(_MD("is_joy_known","device"),&Input::is_joy_known); - ObjectTypeDB::bind_method(_MD("get_joy_axis","device","axis"),&Input::get_joy_axis); - ObjectTypeDB::bind_method(_MD("get_joy_name","device"),&Input::get_joy_name); - ObjectTypeDB::bind_method(_MD("get_joy_guid","device"),&Input::get_joy_guid); - ObjectTypeDB::bind_method(_MD("get_connected_joysticks"),&Input::get_connected_joysticks); - ObjectTypeDB::bind_method(_MD("get_joy_vibration_strength", "device"), &Input::get_joy_vibration_strength); - ObjectTypeDB::bind_method(_MD("get_joy_vibration_duration", "device"), &Input::get_joy_vibration_duration); - ObjectTypeDB::bind_method(_MD("get_joy_button_string", "button_index"), &Input::get_joy_button_string); - ObjectTypeDB::bind_method(_MD("get_joy_button_index_from_string", "button"), &Input::get_joy_button_index_from_string); - ObjectTypeDB::bind_method(_MD("get_joy_axis_string", "axis_index"), &Input::get_joy_axis_string); - ObjectTypeDB::bind_method(_MD("get_joy_axis_index_from_string", "axis"), &Input::get_joy_axis_index_from_string); - ObjectTypeDB::bind_method(_MD("start_joy_vibration", "device", "weak_magnitude", "strong_magnitude", "duration"), &Input::start_joy_vibration, DEFVAL(0)); - ObjectTypeDB::bind_method(_MD("stop_joy_vibration", "device"), &Input::stop_joy_vibration); - ObjectTypeDB::bind_method(_MD("get_accelerometer"),&Input::get_accelerometer); - ObjectTypeDB::bind_method(_MD("get_magnetometer"),&Input::get_magnetometer); - ObjectTypeDB::bind_method(_MD("get_gyroscope"),&Input::get_gyroscope); - //ObjectTypeDB::bind_method(_MD("get_mouse_pos"),&Input::get_mouse_pos); - this is not the function you want - ObjectTypeDB::bind_method(_MD("get_mouse_speed"),&Input::get_mouse_speed); - ObjectTypeDB::bind_method(_MD("get_mouse_button_mask"),&Input::get_mouse_button_mask); - ObjectTypeDB::bind_method(_MD("set_mouse_mode","mode"),&Input::set_mouse_mode); - ObjectTypeDB::bind_method(_MD("get_mouse_mode"),&Input::get_mouse_mode); - ObjectTypeDB::bind_method(_MD("warp_mouse_pos","to"),&Input::warp_mouse_pos); - ObjectTypeDB::bind_method(_MD("action_press","action"),&Input::action_press); - ObjectTypeDB::bind_method(_MD("action_release","action"),&Input::action_release); - ObjectTypeDB::bind_method(_MD("set_custom_mouse_cursor","image:Texture","hotspot"),&Input::set_custom_mouse_cursor,DEFVAL(Vector2())); + ClassDB::bind_method(_MD("is_key_pressed","scancode"),&Input::is_key_pressed); + ClassDB::bind_method(_MD("is_mouse_button_pressed","button"),&Input::is_mouse_button_pressed); + ClassDB::bind_method(_MD("is_joy_button_pressed","device","button"),&Input::is_joy_button_pressed); + ClassDB::bind_method(_MD("is_action_pressed","action"),&Input::is_action_pressed); + ClassDB::bind_method(_MD("is_action_just_pressed","action"),&Input::is_action_just_pressed); + ClassDB::bind_method(_MD("is_action_just_released","action"),&Input::is_action_just_released); + ClassDB::bind_method(_MD("add_joy_mapping","mapping", "update_existing"),&Input::add_joy_mapping, DEFVAL(false)); + ClassDB::bind_method(_MD("remove_joy_mapping","guid"),&Input::remove_joy_mapping); + ClassDB::bind_method(_MD("is_joy_known","device"),&Input::is_joy_known); + ClassDB::bind_method(_MD("get_joy_axis","device","axis"),&Input::get_joy_axis); + ClassDB::bind_method(_MD("get_joy_name","device"),&Input::get_joy_name); + ClassDB::bind_method(_MD("get_joy_guid","device"),&Input::get_joy_guid); + ClassDB::bind_method(_MD("get_connected_joypads"),&Input::get_connected_joypads); + ClassDB::bind_method(_MD("get_joy_vibration_strength", "device"), &Input::get_joy_vibration_strength); + ClassDB::bind_method(_MD("get_joy_vibration_duration", "device"), &Input::get_joy_vibration_duration); + ClassDB::bind_method(_MD("get_joy_button_string", "button_index"), &Input::get_joy_button_string); + ClassDB::bind_method(_MD("get_joy_button_index_from_string", "button"), &Input::get_joy_button_index_from_string); + ClassDB::bind_method(_MD("get_joy_axis_string", "axis_index"), &Input::get_joy_axis_string); + ClassDB::bind_method(_MD("get_joy_axis_index_from_string", "axis"), &Input::get_joy_axis_index_from_string); + ClassDB::bind_method(_MD("start_joy_vibration", "device", "weak_magnitude", "strong_magnitude", "duration"), &Input::start_joy_vibration, DEFVAL(0)); + ClassDB::bind_method(_MD("stop_joy_vibration", "device"), &Input::stop_joy_vibration); + ClassDB::bind_method(_MD("get_accelerometer"),&Input::get_accelerometer); + ClassDB::bind_method(_MD("get_magnetometer"),&Input::get_magnetometer); + ClassDB::bind_method(_MD("get_gyroscope"),&Input::get_gyroscope); + //ClassDB::bind_method(_MD("get_mouse_pos"),&Input::get_mouse_pos); - this is not the function you want + ClassDB::bind_method(_MD("get_last_mouse_speed"),&Input::get_last_mouse_speed); + ClassDB::bind_method(_MD("get_mouse_button_mask"),&Input::get_mouse_button_mask); + ClassDB::bind_method(_MD("set_mouse_mode","mode"),&Input::set_mouse_mode); + ClassDB::bind_method(_MD("get_mouse_mode"),&Input::get_mouse_mode); + ClassDB::bind_method(_MD("warp_mouse_pos","to"),&Input::warp_mouse_pos); + ClassDB::bind_method(_MD("action_press","action"),&Input::action_press); + ClassDB::bind_method(_MD("action_release","action"),&Input::action_release); + ClassDB::bind_method(_MD("set_custom_mouse_cursor","image:Texture","hotspot"),&Input::set_custom_mouse_cursor,DEFVAL(Vector2())); BIND_CONSTANT( MOUSE_MODE_VISIBLE ); BIND_CONSTANT( MOUSE_MODE_HIDDEN ); @@ -97,7 +97,7 @@ void Input::get_argument_options(const StringName& p_function,int p_idx,List<Str if (p_idx==0 && (pf=="is_action_pressed" || pf=="action_press" || pf=="action_release" || pf=="is_action_just_pressed" || pf=="is_action_just_released")) { List<PropertyInfo> pinfo; - Globals::get_singleton()->get_property_list(&pinfo); + GlobalConfig::get_singleton()->get_property_list(&pinfo); for(List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) { const PropertyInfo &pi=E->get(); diff --git a/core/os/input.h b/core/os/input.h index d8f3be09df..a1b60ba0c8 100644 --- a/core/os/input.h +++ b/core/os/input.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ @@ -35,7 +35,7 @@ class Input : public Object { - OBJ_TYPE( Input, Object ); + GDCLASS( Input, Object ); static Input *singleton; @@ -64,7 +64,7 @@ public: virtual float get_joy_axis(int p_device,int p_axis) const=0; virtual String get_joy_name(int p_idx)=0; - virtual Array get_connected_joysticks()=0; + virtual Array get_connected_joypads()=0; virtual void joy_connection_changed(int p_idx, bool p_connected, String p_name, String p_guid)=0; virtual void add_joy_mapping(String p_mapping, bool p_update_existing=false)=0; virtual void remove_joy_mapping(String p_guid)=0; @@ -77,7 +77,7 @@ public: virtual void stop_joy_vibration(int p_device)=0; virtual Point2 get_mouse_pos() const=0; - virtual Point2 get_mouse_speed() const=0; + virtual Point2 get_last_mouse_speed() const=0; virtual int get_mouse_button_mask() const=0; virtual void warp_mouse_pos(const Vector2& p_to)=0; diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp index 7350be824a..3cc595208f 100644 --- a/core/os/input_event.cpp +++ b/core/os/input_event.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ @@ -61,10 +61,10 @@ bool InputEvent::operator==(const InputEvent &p_event) const { && mouse_button.button_index == p_event.mouse_button.button_index && mouse_button.button_mask == p_event.mouse_button.button_mask && key.mod == p_event.key.mod; - case JOYSTICK_MOTION: + case JOYPAD_MOTION: return joy_motion.axis == p_event.joy_motion.axis && joy_motion.axis_value == p_event.joy_motion.axis_value; - case JOYSTICK_BUTTON: + case JOYPAD_BUTTON: return joy_button.pressed == p_event.joy_button.pressed && joy_button.button_index == p_event.joy_button.button_index && joy_button.pressure == p_event.joy_button.pressure; @@ -155,14 +155,14 @@ InputEvent::operator String() const { return str; } break; - case JOYSTICK_MOTION: { - str+= "Event: JoystickMotion "; + case JOYPAD_MOTION: { + str+= "Event: JoypadMotion "; str=str+"Axis: "+itos(joy_motion.axis)+" Value: " +rtos(joy_motion.axis_value); return str; } break; - case JOYSTICK_BUTTON: { - str+= "Event: JoystickButton "; + case JOYPAD_BUTTON: { + str+= "Event: JoypadButton "; str=str+"Pressed: "+itos(joy_button.pressed)+" Index: " +itos(joy_button.button_index)+" pressure "+rtos(joy_button.pressure); return str; @@ -203,9 +203,9 @@ bool InputEvent::is_pressed() const { case KEY: return key.pressed; case MOUSE_BUTTON: return mouse_button.pressed; - case JOYSTICK_BUTTON: return joy_button.pressed; + case JOYPAD_BUTTON: return joy_button.pressed; case SCREEN_TOUCH: return screen_touch.pressed; - case JOYSTICK_MOTION: return ABS(joy_motion.axis_value) > 0.5; + case JOYPAD_MOTION: return ABS(joy_motion.axis_value) > 0.5; case ACTION: return action.pressed; default: {} } @@ -249,7 +249,7 @@ uint32_t InputEventKey::get_scancode_with_modifiers() const { } -InputEvent InputEvent::xform_by(const Matrix32& p_xform) const { +InputEvent InputEvent::xform_by(const Transform2D& p_xform) const { InputEvent ev=*this; diff --git a/core/os/input_event.h b/core/os/input_event.h index 1c4f1dcf96..1af4ef20c2 100644 --- a/core/os/input_event.h +++ b/core/os/input_event.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ @@ -205,8 +205,8 @@ struct InputEventMouse { InputModifierState mod; int button_mask; - int x,y; - int global_x,global_y; + float x,y; + float global_x,global_y; int pointer_index; }; @@ -221,17 +221,17 @@ struct InputEventMouseButton : public InputEventMouse { struct InputEventMouseMotion : public InputEventMouse { - int relative_x,relative_y; + float relative_x,relative_y; float speed_x,speed_y; }; -struct InputEventJoystickMotion { +struct InputEventJoypadMotion { - int axis; ///< Joystick axis + int axis; ///< Joypad axis float axis_value; ///< -1 to 1 }; -struct InputEventJoystickButton { +struct InputEventJoypadButton { int button_index; bool pressed; @@ -241,14 +241,14 @@ struct InputEventJoystickButton { struct InputEventScreenTouch { int index; - int x,y; + float x,y; bool pressed; }; struct InputEventScreenDrag { int index; - int x,y; - int relative_x,relative_y; + float x,y; + float relative_x,relative_y; float speed_x,speed_y; }; @@ -267,8 +267,8 @@ struct InputEvent { KEY, MOUSE_MOTION, MOUSE_BUTTON, - JOYSTICK_MOTION, - JOYSTICK_BUTTON, + JOYPAD_MOTION, + JOYPAD_BUTTON, SCREEN_TOUCH, SCREEN_DRAG, ACTION, @@ -282,8 +282,8 @@ struct InputEvent { union { InputEventMouseMotion mouse_motion; InputEventMouseButton mouse_button; - InputEventJoystickMotion joy_motion; - InputEventJoystickButton joy_button; + InputEventJoypadMotion joy_motion; + InputEventJoypadButton joy_button; InputEventKey key; InputEventScreenTouch screen_touch; InputEventScreenDrag screen_drag; @@ -298,7 +298,7 @@ struct InputEvent { void set_as_action(const String& p_action, bool p_pressed); - InputEvent xform_by(const Matrix32& p_xform) const; + InputEvent xform_by(const Transform2D& p_xform) const; bool operator==(const InputEvent &p_event) const; operator String() const; InputEvent() { zeromem(this,sizeof(InputEvent)); } diff --git a/core/os/keyboard.cpp b/core/os/keyboard.cpp index 9710638234..309348ea31 100644 --- a/core/os/keyboard.cpp +++ b/core/os/keyboard.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ diff --git a/core/os/keyboard.h b/core/os/keyboard.h index fd52d331c8..1357cc8b8e 100644 --- a/core/os/keyboard.h +++ b/core/os/keyboard.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp index e5feebfbfc..11396666d2 100644 --- a/core/os/main_loop.cpp +++ b/core/os/main_loop.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ @@ -31,19 +31,19 @@ void MainLoop::_bind_methods() { - ObjectTypeDB::bind_method(_MD("input_event","ev"),&MainLoop::input_event); - ObjectTypeDB::bind_method(_MD("input_text","text"),&MainLoop::input_text); - ObjectTypeDB::bind_method(_MD("init"),&MainLoop::init); - ObjectTypeDB::bind_method(_MD("iteration","delta"),&MainLoop::iteration); - ObjectTypeDB::bind_method(_MD("idle","delta"),&MainLoop::idle); - ObjectTypeDB::bind_method(_MD("finish"),&MainLoop::finish); + ClassDB::bind_method(_MD("input_event","ev"),&MainLoop::input_event); + ClassDB::bind_method(_MD("input_text","text"),&MainLoop::input_text); + ClassDB::bind_method(_MD("init"),&MainLoop::init); + ClassDB::bind_method(_MD("iteration","delta"),&MainLoop::iteration); + ClassDB::bind_method(_MD("idle","delta"),&MainLoop::idle); + ClassDB::bind_method(_MD("finish"),&MainLoop::finish); BIND_VMETHOD( MethodInfo("_input_event",PropertyInfo(Variant::INPUT_EVENT,"ev")) ); BIND_VMETHOD( MethodInfo("_input_text",PropertyInfo(Variant::STRING,"text")) ); BIND_VMETHOD( MethodInfo("_initialize") ); BIND_VMETHOD( MethodInfo("_iteration",PropertyInfo(Variant::REAL,"delta")) ); BIND_VMETHOD( MethodInfo("_idle",PropertyInfo(Variant::REAL,"delta")) ); - BIND_VMETHOD( MethodInfo("_drop_files",PropertyInfo(Variant::STRING_ARRAY,"files"),PropertyInfo(Variant::INT,"screen")) ); + BIND_VMETHOD( MethodInfo("_drop_files",PropertyInfo(Variant::POOL_STRING_ARRAY,"files"),PropertyInfo(Variant::INT,"screen")) ); BIND_VMETHOD( MethodInfo("_finalize") ); BIND_CONSTANT(NOTIFICATION_WM_MOUSE_ENTER); diff --git a/core/os/main_loop.h b/core/os/main_loop.h index 57185d9d3d..456a6be4d3 100644 --- a/core/os/main_loop.h +++ b/core/os/main_loop.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ @@ -37,7 +37,7 @@ */ class MainLoop : public Object { - OBJ_TYPE( MainLoop, Object ); + GDCLASS( MainLoop, Object ); OBJ_CATEGORY("Main Loop"); Ref<Script> init_script; @@ -47,13 +47,15 @@ protected: public: enum { - NOTIFICATION_WM_MOUSE_ENTER = 3, - NOTIFICATION_WM_MOUSE_EXIT = 4, - NOTIFICATION_WM_FOCUS_IN = 5, - NOTIFICATION_WM_FOCUS_OUT = 6, - NOTIFICATION_WM_QUIT_REQUEST = 7, + NOTIFICATION_WM_MOUSE_ENTER = 2, + NOTIFICATION_WM_MOUSE_EXIT = 3, + NOTIFICATION_WM_FOCUS_IN = 4, + NOTIFICATION_WM_FOCUS_OUT = 5, + NOTIFICATION_WM_QUIT_REQUEST = 6, + NOTIFICATION_WM_GO_BACK_REQUEST = 7, NOTIFICATION_WM_UNFOCUS_REQUEST = 8, NOTIFICATION_OS_MEMORY_WARNING = 9, + NOTIFICATION_TRANSLATION_CHANGED = 10, }; virtual void input_event( const InputEvent& p_event ); diff --git a/core/os/memory.cpp b/core/os/memory.cpp index c2ff2aa781..37a523b763 100644 --- a/core/os/memory.cpp +++ b/core/os/memory.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ @@ -30,9 +30,13 @@ #include "error_macros.h" #include "copymem.h" #include <stdio.h> +#include <stdlib.h> + + + void * operator new(size_t p_size,const char *p_description) { - return Memory::alloc_static( p_size, p_description ); + return Memory::alloc_static( p_size, false ); } void * operator new(size_t p_size,void* (*p_allocfunc)(size_t p_size)) { @@ -42,74 +46,144 @@ void * operator new(size_t p_size,void* (*p_allocfunc)(size_t p_size)) { #include <stdio.h> -void * Memory::alloc_static(size_t p_bytes,const char *p_alloc_from) { +#ifdef DEBUG_ENABLED +size_t Memory::mem_usage=0; +size_t Memory::max_usage=0; +#endif - ERR_FAIL_COND_V( !MemoryPoolStatic::get_singleton(), NULL ); - return MemoryPoolStatic::get_singleton()->alloc(p_bytes,p_alloc_from); -} -void * Memory::realloc_static(void *p_memory,size_t p_bytes) { +size_t Memory::alloc_count=0; - ERR_FAIL_COND_V( !MemoryPoolStatic::get_singleton(), NULL ); - return MemoryPoolStatic::get_singleton()->realloc(p_memory,p_bytes); -} -void Memory::free_static(void *p_ptr) { +void * Memory::alloc_static(size_t p_bytes,bool p_pad_align) { - ERR_FAIL_COND( !MemoryPoolStatic::get_singleton()); - MemoryPoolStatic::get_singleton()->free(p_ptr); -} +#ifdef DEBUG_ENABLED + bool prepad=true; +#else + bool prepad=p_pad_align; +#endif -size_t Memory::get_static_mem_available() { + void * mem = malloc( p_bytes + (prepad?PAD_ALIGN:0)); - ERR_FAIL_COND_V( !MemoryPoolStatic::get_singleton(), 0); - return MemoryPoolStatic::get_singleton()->get_available_mem(); + alloc_count++; -} + ERR_FAIL_COND_V(!mem,NULL); -size_t Memory::get_static_mem_max_usage() { + if (prepad) { + uint64_t *s = (uint64_t*)mem; + *s=p_bytes; - ERR_FAIL_COND_V( !MemoryPoolStatic::get_singleton(), 0); - return MemoryPoolStatic::get_singleton()->get_max_usage(); + uint8_t *s8 = (uint8_t*)mem; + +#ifdef DEBUG_ENABLED + mem_usage+=p_bytes; + if (mem_usage>max_usage) { + max_usage=mem_usage; + } +#endif + return s8 + PAD_ALIGN; + } else { + return mem; + } } -size_t Memory::get_static_mem_usage() { +void * Memory::realloc_static(void *p_memory,size_t p_bytes,bool p_pad_align) { - ERR_FAIL_COND_V( !MemoryPoolStatic::get_singleton(), 0); - return MemoryPoolStatic::get_singleton()->get_total_usage(); + if (p_memory==NULL) { + return alloc_static(p_bytes,p_pad_align); + } -} + uint8_t *mem = (uint8_t*)p_memory; -void Memory::dump_static_mem_to_file(const char* p_file) { +#ifdef DEBUG_ENABLED + bool prepad=true; +#else + bool prepad=p_pad_align; +#endif - MemoryPoolStatic::get_singleton()->dump_mem_to_file(p_file); -} + if (prepad) { + mem-=PAD_ALIGN; + uint64_t *s = (uint64_t*)mem; -MID Memory::alloc_dynamic(size_t p_bytes, const char *p_descr) { +#ifdef DEBUG_ENABLED + mem_usage-=*s; + mem_usage+=p_bytes; +#endif - MemoryPoolDynamic::ID id = MemoryPoolDynamic::get_singleton()->alloc(p_bytes,p_descr); + if (p_bytes==0) { + free(mem); + return NULL; + } else { + *s=p_bytes; - return MID(id); -} -Error Memory::realloc_dynamic(MID p_mid,size_t p_bytes) { + mem = (uint8_t*)realloc(mem,p_bytes+PAD_ALIGN); + ERR_FAIL_COND_V(!mem,NULL); + + s = (uint64_t*)mem; + + *s=p_bytes; - MemoryPoolDynamic::ID id = p_mid.data?p_mid.data->id:MemoryPoolDynamic::INVALID_ID; + return mem+PAD_ALIGN; + } + } else { - if (id==MemoryPoolDynamic::INVALID_ID) - return ERR_INVALID_PARAMETER; + mem = (uint8_t*)realloc(mem,p_bytes); - return MemoryPoolDynamic::get_singleton()->realloc(p_mid, p_bytes); + ERR_FAIL_COND_V(mem==NULL && p_bytes>0,NULL); + return mem; + } } -size_t Memory::get_dynamic_mem_available() { +void Memory::free_static(void *p_ptr,bool p_pad_align) { + + ERR_FAIL_COND(p_ptr==NULL); + + uint8_t *mem = (uint8_t*)p_ptr; + +#ifdef DEBUG_ENABLED + bool prepad=true; +#else + bool prepad=p_pad_align; +#endif + + alloc_count--; + + if (prepad) { + mem-=PAD_ALIGN; + uint64_t *s = (uint64_t*)mem; + +#ifdef DEBUG_ENABLED + mem_usage-=*s; +#endif + + free(mem); + } else { + + free(mem); + } - return MemoryPoolDynamic::get_singleton()->get_available_mem(); } -size_t Memory::get_dynamic_mem_usage() { +size_t Memory::get_mem_available() { + + return 0xFFFFFFFFFFFFF; - return MemoryPoolDynamic::get_singleton()->get_total_usage(); +} + +size_t Memory::get_mem_usage(){ +#ifdef DEBUG_ENABLED + return mem_usage; +#else + return 0; +#endif +} +size_t Memory::get_mem_max_usage(){ +#ifdef DEBUG_ENABLED + return max_usage; +#else + return 0; +#endif } diff --git a/core/os/memory.h b/core/os/memory.h index 5f4c6f929c..49424037ff 100644 --- a/core/os/memory.h +++ b/core/os/memory.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ @@ -31,175 +31,45 @@ #include <stddef.h> #include "safe_refcount.h" -#include "os/memory_pool_dynamic.h" -#include "os/memory_pool_static.h" /** @author Juan Linietsky <reduzio@gmail.com> */ -class MID { - - struct Data { - - SafeRefCount refcount; - MemoryPoolDynamic::ID id; - }; - - mutable Data *data; - - void unref() { - - if (!data) - return; - if (data->refcount.unref()) { - - if (data->id!=MemoryPoolDynamic::INVALID_ID) - MemoryPoolDynamic::get_singleton()->free(data->id); - MemoryPoolStatic::get_singleton()->free(data); - } - - data=NULL; - } - - void ref(Data *p_data) { - - if (data==p_data) - return; - unref(); - - if (p_data && p_data->refcount.ref()) - data=p_data; - } - -friend class MID_Lock; - - inline void lock() { - - if (data && data->id!=MemoryPoolDynamic::INVALID_ID) - MemoryPoolDynamic::get_singleton()->lock(data->id); - } - inline void unlock() { - - if (data && data->id!=MemoryPoolDynamic::INVALID_ID) - MemoryPoolDynamic::get_singleton()->unlock(data->id); - - } - - inline void * get() { - - if (data && data->id!=MemoryPoolDynamic::INVALID_ID) - return MemoryPoolDynamic::get_singleton()->get(data->id); - - return NULL; - } - - Error _resize(size_t p_size) { - - if (p_size==0 && (!data || data->id==MemoryPoolDynamic::INVALID_ID)) - return OK; - if (p_size && !data) { - // create data because we'll need it - data = (Data*)MemoryPoolStatic::get_singleton()->alloc(sizeof(Data),"MID::Data"); - ERR_FAIL_COND_V( !data,ERR_OUT_OF_MEMORY ); - data->refcount.init(); - data->id=MemoryPoolDynamic::INVALID_ID; - } - - if (p_size==0 && data && data->id==MemoryPoolDynamic::INVALID_ID) { - - MemoryPoolDynamic::get_singleton()->free(data->id); - data->id=MemoryPoolDynamic::INVALID_ID; - } - - if (p_size>0) { - - if (data->id==MemoryPoolDynamic::INVALID_ID) { - - data->id=MemoryPoolDynamic::get_singleton()->alloc(p_size,"Unnamed MID"); - ERR_FAIL_COND_V( data->id==MemoryPoolDynamic::INVALID_ID, ERR_OUT_OF_MEMORY ); - - } else { - - MemoryPoolDynamic::get_singleton()->realloc(data->id,p_size); - ERR_FAIL_COND_V( data->id==MemoryPoolDynamic::INVALID_ID, ERR_OUT_OF_MEMORY ); - - } - } - - return OK; - } -friend class Memory; - - MID(MemoryPoolDynamic::ID p_id) { - - data = (Data*)MemoryPoolStatic::get_singleton()->alloc(sizeof(Data),"MID::Data"); - data->refcount.init(); - data->id=p_id; - } -public: - - bool is_valid() const { return data; } - operator bool() const { return data; } - - - size_t get_size() const { return (data && data->id!=MemoryPoolDynamic::INVALID_ID) ? MemoryPoolDynamic::get_singleton()->get_size(data->id) : 0; } - Error resize(size_t p_size) { return _resize(p_size); } - inline void operator=(const MID& p_mid) { ref( p_mid.data ); } - inline bool is_locked() const { return (data && data->id!=MemoryPoolDynamic::INVALID_ID) ? MemoryPoolDynamic::get_singleton()->is_locked(data->id) : false; } - inline MID(const MID& p_mid) { data=NULL; ref( p_mid.data ); } - inline MID() { data = NULL; } - ~MID() { unref(); } -}; - - -class MID_Lock { - - MID mid; - -public: - - void *data() { return mid.get(); } +#ifndef PAD_ALIGN +#define PAD_ALIGN 16 //must always be greater than this at much +#endif - void operator=(const MID_Lock& p_lock ) { mid.unlock(); mid = p_lock.mid; mid.lock(); } - inline MID_Lock(const MID& p_mid) { mid=p_mid; mid.lock(); } - inline MID_Lock(const MID_Lock& p_lock) { mid=p_lock.mid; mid.lock(); } - MID_Lock() {} - ~MID_Lock() { mid.unlock(); } -}; class Memory{ Memory(); -public: +#ifdef DEBUG_ENABLED + static size_t mem_usage; + static size_t max_usage; +#endif + + static size_t alloc_count; - static void * alloc_static(size_t p_bytes,const char *p_descr=""); - static void * realloc_static(void *p_memory,size_t p_bytes); - static void free_static(void *p_ptr); - static size_t get_static_mem_available(); - static size_t get_static_mem_usage(); - static size_t get_static_mem_max_usage(); - static void dump_static_mem_to_file(const char* p_file); +public: - static MID alloc_dynamic(size_t p_bytes, const char *p_descr=""); - static Error realloc_dynamic(MID p_mid,size_t p_bytes); + static void * alloc_static(size_t p_bytes,bool p_pad_align=false); + static void * realloc_static(void *p_memory,size_t p_bytes,bool p_pad_align=false); + static void free_static(void *p_ptr,bool p_pad_align=false); - static size_t get_dynamic_mem_available(); - static size_t get_dynamic_mem_usage(); + static size_t get_mem_available(); + static size_t get_mem_usage(); + static size_t get_mem_max_usage(); -}; -template<class T> -struct MemAalign { - static _FORCE_INLINE_ int get_align() { return DEFAULT_ALIGNMENT; } }; class DefaultAllocator { public: - _FORCE_INLINE_ static void *alloc(size_t p_memory) { return Memory::alloc_static(p_memory, ""); } - _FORCE_INLINE_ static void free(void *p_ptr) { return Memory::free_static(p_ptr); } + _FORCE_INLINE_ static void *alloc(size_t p_memory) { return Memory::alloc_static(p_memory, false); } + _FORCE_INLINE_ static void free(void *p_ptr) { return Memory::free_static(p_ptr,false); } }; @@ -209,31 +79,10 @@ void * operator new(size_t p_size,void* (*p_allocfunc)(size_t p_size)); ///< ope void * operator new(size_t p_size,void *p_pointer,size_t check, const char *p_description); ///< operator new that takes a description and uses a pointer to the preallocated memory -#ifdef DEBUG_MEMORY_ENABLED - -#define memalloc(m_size) Memory::alloc_static(m_size, __FILE__ ":" __STR(__LINE__) ", memalloc.") -#define memrealloc(m_mem,m_size) Memory::realloc_static(m_mem,m_size) -#define memfree(m_size) Memory::free_static(m_size) - -#else - #define memalloc(m_size) Memory::alloc_static(m_size) #define memrealloc(m_mem,m_size) Memory::realloc_static(m_mem,m_size) #define memfree(m_size) Memory::free_static(m_size) -#endif - -#ifdef DEBUG_MEMORY_ENABLED -#define dynalloc(m_size) Memory::alloc_dynamic(m_size, __FILE__ ":" __STR(__LINE__) ", type: DYNAMIC") -#define dynrealloc(m_mem,m_size) m_mem.resize(m_size) - -#else - -#define dynalloc(m_size) Memory::alloc_dynamic(m_size) -#define dynrealloc(m_mem,m_size) m_mem.resize(m_size) - -#endif - _ALWAYS_INLINE_ void postinitialize_handler(void *) {} @@ -245,19 +94,11 @@ _ALWAYS_INLINE_ T *_post_initialize(T *p_obj) { return p_obj; } -#ifdef DEBUG_MEMORY_ENABLED - -#define memnew(m_class) _post_initialize(new(__FILE__ ":" __STR(__LINE__) ", memnew type: " __STR(m_class)) m_class) - -#else - #define memnew(m_class) _post_initialize(new("") m_class) -#endif - _ALWAYS_INLINE_ void * operator new(size_t p_size,void *p_pointer,size_t check, const char *p_description) { -// void *failptr=0; -// ERR_FAIL_COND_V( check < p_size , failptr); /** bug, or strange compiler, most likely */ + //void *failptr=0; + //ERR_FAIL_COND_V( check < p_size , failptr); /** bug, or strange compiler, most likely */ return p_pointer; } @@ -275,7 +116,7 @@ void memdelete(T *p_class) { if (!predelete_handler(p_class)) return; // doesn't want to be deleted p_class->~T(); - Memory::free_static(p_class); + Memory::free_static(p_class,false); } template<class T,class A> @@ -288,15 +129,9 @@ void memdelete_allocator(T *p_class) { } #define memdelete_notnull(m_v) { if (m_v) memdelete(m_v); } -#ifdef DEBUG_MEMORY_ENABLED - -#define memnew_arr( m_class, m_count ) memnew_arr_template<m_class>(m_count,__FILE__ ":" __STR(__LINE__) ", memnew_arr type: " _STR(m_class)) - -#else #define memnew_arr( m_class, m_count ) memnew_arr_template<m_class>(m_count) -#endif template<typename T> T* memnew_arr_template(size_t p_elements,const char *p_descr="") { @@ -304,14 +139,14 @@ T* memnew_arr_template(size_t p_elements,const char *p_descr="") { if (p_elements==0) return 0; /** overloading operator new[] cannot be done , because it may not return the real allocated address (it may pad the 'element count' before the actual array). Because of that, it must be done by hand. This is the - same strategy used by std::vector, and the DVector class, so it should be safe.*/ + same strategy used by std::vector, and the PoolVector class, so it should be safe.*/ size_t len = sizeof(T) * p_elements; - unsigned int *mem = (unsigned int*)Memory::alloc_static( len + MAX(sizeof(size_t), DEFAULT_ALIGNMENT), p_descr ); + uint64_t *mem = (uint64_t*)Memory::alloc_static( len , true ); T *failptr=0; //get rid of a warning ERR_FAIL_COND_V( !mem, failptr ); - *mem=p_elements; - mem = (unsigned int *)( ((uint8_t*)mem) + MAX(sizeof(size_t), DEFAULT_ALIGNMENT)); + *(mem-1)=p_elements; + T* elems = (T*)mem; /* call operator new */ @@ -330,20 +165,22 @@ T* memnew_arr_template(size_t p_elements,const char *p_descr="") { template<typename T> size_t memarr_len(const T *p_class) { - uint8_t* ptr = ((uint8_t*)p_class) - MAX(sizeof(size_t), DEFAULT_ALIGNMENT); - return *(size_t*)ptr; + uint64_t* ptr = (uint64_t*)p_class; + return *(ptr-1); } template<typename T> void memdelete_arr(T *p_class) { - unsigned int * elems = (unsigned int*)(((uint8_t*)p_class) - MAX(sizeof(size_t), DEFAULT_ALIGNMENT)); + uint64_t* ptr = (uint64_t*)p_class; + + uint64_t elem_count = *(ptr-1); - for (unsigned int i=0;i<*elems;i++) { + for (uint64_t i=0;i<elem_count;i++) { p_class[i].~T(); }; - Memory::free_static(elems); + Memory::free_static(ptr,true); } diff --git a/core/os/memory_pool_dynamic.cpp b/core/os/memory_pool_dynamic.cpp deleted file mode 100644 index 6be8d0a36d..0000000000 --- a/core/os/memory_pool_dynamic.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/*************************************************************************/ -/* memory_pool_dynamic.cpp */ -/*************************************************************************/ -/* 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. */ -/*************************************************************************/ -#include "memory_pool_dynamic.h" - - -MemoryPoolDynamic* MemoryPoolDynamic::singleton=NULL; - - -MemoryPoolDynamic* MemoryPoolDynamic::get_singleton() { - - return singleton; -} - - -MemoryPoolDynamic::MemoryPoolDynamic() { - - ERR_FAIL_COND(singleton!=NULL); - singleton=this; -} - -MemoryPoolDynamic::~MemoryPoolDynamic() { - - singleton=NULL; -} diff --git a/core/os/memory_pool_dynamic.h b/core/os/memory_pool_dynamic.h deleted file mode 100644 index 70752fb10d..0000000000 --- a/core/os/memory_pool_dynamic.h +++ /dev/null @@ -1,79 +0,0 @@ -/*************************************************************************/ -/* memory_pool_dynamic.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 MEMORY_POOL_DYNAMIC_H -#define MEMORY_POOL_DYNAMIC_H - -#include "typedefs.h" - - -class MemoryPoolDynamic { - - static MemoryPoolDynamic* singleton; -protected: -friend class Memory; -friend class MID; - - enum { - - INVALID_ID=0xFFFFFFFF - }; - - static MemoryPoolDynamic* get_singleton(); - - typedef uint64_t ID; - - - virtual ID alloc(size_t p_amount,const char* p_description)=0; - virtual void free(ID p_id)=0; - virtual Error realloc(ID p_id, size_t p_amount)=0; - virtual bool is_valid(ID p_id)=0; - virtual size_t get_size(ID p_id) const=0; - virtual const char* get_description(ID p_id) const=0; - - virtual Error lock(ID p_id)=0; - virtual void * get(ID p_ID)=0; - virtual Error unlock(ID p_id)=0; - virtual bool is_locked(ID p_id) const=0; - - virtual size_t get_available_mem() const=0; - virtual size_t get_total_usage() const=0; - - MemoryPoolDynamic(); -public: - virtual ~MemoryPoolDynamic(); - -}; - - -#endif - - - - - diff --git a/core/os/memory_pool_dynamic_prealloc.cpp b/core/os/memory_pool_dynamic_prealloc.cpp deleted file mode 100644 index f76c2a12b4..0000000000 --- a/core/os/memory_pool_dynamic_prealloc.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/*************************************************************************/ -/* memory_pool_dynamic_prealloc.cpp */ -/*************************************************************************/ -/* 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. */ -/*************************************************************************/ -#include "memory_pool_dynamic_prealloc.h" -#include "os/memory.h" - -#include "print_string.h" -MemoryPoolDynamicPrealloc::ID MemoryPoolDynamicPrealloc::alloc(size_t p_amount,const char* p_description) { - - -// print_line("dynpool - allocating: "+itos(p_amount)); - ID id = pool_alloc->alloc(p_amount); -// print_line("dynpool - free: "+itos(pool_alloc->get_free_mem())); - return id; - -} - -void MemoryPoolDynamicPrealloc::free(ID p_id) { - - pool_alloc->free(p_id); -} - -Error MemoryPoolDynamicPrealloc::realloc(ID p_id, size_t p_amount) { - - return pool_alloc->resize(p_id,p_amount); -} - -bool MemoryPoolDynamicPrealloc::is_valid(ID p_id) { - - return true; -} - -size_t MemoryPoolDynamicPrealloc::get_size(ID p_id) const { - - return pool_alloc->get_size(p_id); -} - -const char* MemoryPoolDynamicPrealloc::get_description(ID p_id) const { - - return ""; -} - -Error MemoryPoolDynamicPrealloc::lock(ID p_id) { - -// print_line("lock: "+itos(p_id)); - return pool_alloc->lock(p_id); -} - -void * MemoryPoolDynamicPrealloc::get(ID p_ID) { - -// print_line("get: "+itos(p_ID)); - return pool_alloc->get(p_ID); -} - -Error MemoryPoolDynamicPrealloc::unlock(ID p_id) { - -// print_line("unlock: "+itos(p_id)); - pool_alloc->unlock(p_id); - return OK; -} - -bool MemoryPoolDynamicPrealloc::is_locked(ID p_id) const { - - return pool_alloc->is_locked(p_id); -} - - -size_t MemoryPoolDynamicPrealloc::get_available_mem() const { - - return pool_alloc->get_free_mem(); -} - -size_t MemoryPoolDynamicPrealloc::get_total_usage() const { - - return pool_alloc->get_used_mem(); -} - - - -MemoryPoolDynamicPrealloc::MemoryPoolDynamicPrealloc(void * p_mem,int p_size, int p_align, int p_max_entries) { - - pool_alloc = memnew( PoolAllocator(p_mem,p_size,p_align,true,p_max_entries)); - -} - -MemoryPoolDynamicPrealloc::~MemoryPoolDynamicPrealloc() { - - - memdelete( pool_alloc ); -} - diff --git a/core/os/memory_pool_dynamic_prealloc.h b/core/os/memory_pool_dynamic_prealloc.h deleted file mode 100644 index d2256c0c98..0000000000 --- a/core/os/memory_pool_dynamic_prealloc.h +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************/ -/* memory_pool_dynamic_prealloc.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 MEMORY_POOL_DYNAMIC_PREALLOC_H -#define MEMORY_POOL_DYNAMIC_PREALLOC_H - -#include "pool_allocator.h" -#include "core/os/memory_pool_dynamic.h" - -class MemoryPoolDynamicPrealloc : public MemoryPoolDynamic { - - PoolAllocator *pool_alloc; - -public: - - virtual ID alloc(size_t p_amount,const char* p_description); - virtual void free(ID p_id); - virtual Error realloc(ID p_id, size_t p_amount); - virtual bool is_valid(ID p_id); - virtual size_t get_size(ID p_id) const; - virtual const char* get_description(ID p_id) const; - - virtual Error lock(ID p_id); - virtual void * get(ID p_ID); - virtual Error unlock(ID p_id); - virtual bool is_locked(ID p_id) const; - - virtual size_t get_available_mem() const; - virtual size_t get_total_usage() const; - - MemoryPoolDynamicPrealloc(void * p_mem,int p_size, int p_align = 16, int p_max_entries=PoolAllocator::DEFAULT_MAX_ALLOCS); - ~MemoryPoolDynamicPrealloc(); -}; - -#endif // MEMORY_POOL_DYNAMIC_PREALLOC_H diff --git a/core/os/memory_pool_dynamic_static.cpp b/core/os/memory_pool_dynamic_static.cpp deleted file mode 100644 index c047c931ec..0000000000 --- a/core/os/memory_pool_dynamic_static.cpp +++ /dev/null @@ -1,272 +0,0 @@ -/*************************************************************************/ -/* memory_pool_dynamic_static.cpp */ -/*************************************************************************/ -/* 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. */ -/*************************************************************************/ -#include "memory_pool_dynamic_static.h" -#include "os/memory.h" -#include "os/os.h" -#include "ustring.h" -#include "print_string.h" -#include <stdio.h> - -MemoryPoolDynamicStatic::Chunk *MemoryPoolDynamicStatic::get_chunk(ID p_id) { - - uint64_t check = p_id/MAX_CHUNKS; - uint64_t idx = p_id%MAX_CHUNKS; - - if (!chunk[idx].mem || chunk[idx].check!=check) - return NULL; - - return &chunk[idx]; -} - - -const MemoryPoolDynamicStatic::Chunk *MemoryPoolDynamicStatic::get_chunk(ID p_id) const { - - uint64_t check = p_id/MAX_CHUNKS; - uint64_t idx = p_id%MAX_CHUNKS; - - if (!chunk[idx].mem || chunk[idx].check!=check) - return NULL; - - return &chunk[idx]; -} - -MemoryPoolDynamic::ID MemoryPoolDynamicStatic::alloc(size_t p_amount,const char* p_description) { - - _THREAD_SAFE_METHOD_ - - int idx=-1; - - for (int i=0;i<MAX_CHUNKS;i++) { - - last_alloc++; - if (last_alloc>=MAX_CHUNKS) - last_alloc=0; - - if ( !chunk[last_alloc].mem ) { - - idx=last_alloc; - break; - } - } - - - if (idx==-1) { - ERR_EXPLAIN("Out of dynamic Memory IDs"); - ERR_FAIL_V(INVALID_ID); - //return INVALID_ID; - } - - //chunk[idx].mem = Memory::alloc_static(p_amount,p_description); - chunk[idx].mem = memalloc(p_amount); - if (!chunk[idx].mem) - return INVALID_ID; - - chunk[idx].size=p_amount; - chunk[idx].check=++last_check; - chunk[idx].descr=p_description; - chunk[idx].lock=0; - - total_usage+=p_amount; - if (total_usage>max_usage) - max_usage=total_usage; - - ID id = chunk[idx].check*MAX_CHUNKS + (uint64_t)idx; - - return id; - -} -void MemoryPoolDynamicStatic::free(ID p_id) { - - _THREAD_SAFE_METHOD_ - - Chunk *c = get_chunk(p_id); - ERR_FAIL_COND(!c); - - - total_usage-=c->size; - memfree(c->mem); - - c->mem=0; - - if (c->lock>0) { - - ERR_PRINT("Freed ID Still locked"); - } -} - -Error MemoryPoolDynamicStatic::realloc(ID p_id, size_t p_amount) { - - _THREAD_SAFE_METHOD_ - - Chunk *c = get_chunk(p_id); - ERR_FAIL_COND_V(!c,ERR_INVALID_PARAMETER); - ERR_FAIL_COND_V(c->lock > 0 , ERR_LOCKED ); - - - void * new_mem = memrealloc(c->mem,p_amount); - - ERR_FAIL_COND_V(!new_mem,ERR_OUT_OF_MEMORY); - total_usage-=c->size; - c->mem=new_mem; - c->size=p_amount; - total_usage+=c->size; - if (total_usage>max_usage) - max_usage=total_usage; - - - return OK; -} -bool MemoryPoolDynamicStatic::is_valid(ID p_id) { - - _THREAD_SAFE_METHOD_ - - Chunk *c = get_chunk(p_id); - - return c!=NULL; - -} -size_t MemoryPoolDynamicStatic::get_size(ID p_id) const { - - _THREAD_SAFE_METHOD_ - - const Chunk *c = get_chunk(p_id); - ERR_FAIL_COND_V(!c,0); - - return c->size; - - -} -const char* MemoryPoolDynamicStatic::get_description(ID p_id) const { - - _THREAD_SAFE_METHOD_ - - const Chunk *c = get_chunk(p_id); - ERR_FAIL_COND_V(!c,""); - - return c->descr; - -} - - -bool MemoryPoolDynamicStatic::is_locked(ID p_id) const { - - _THREAD_SAFE_METHOD_ - - const Chunk *c = get_chunk(p_id); - ERR_FAIL_COND_V(!c,false); - - return c->lock>0; - -} - -Error MemoryPoolDynamicStatic::lock(ID p_id) { - - _THREAD_SAFE_METHOD_ - - Chunk *c = get_chunk(p_id); - ERR_FAIL_COND_V(!c,ERR_INVALID_PARAMETER); - - c->lock++; - - return OK; -} -void * MemoryPoolDynamicStatic::get(ID p_id) { - - _THREAD_SAFE_METHOD_ - - const Chunk *c = get_chunk(p_id); - ERR_FAIL_COND_V(!c,NULL); - ERR_FAIL_COND_V( c->lock==0, NULL ); - - return c->mem; -} -Error MemoryPoolDynamicStatic::unlock(ID p_id) { - - _THREAD_SAFE_METHOD_ - - Chunk *c = get_chunk(p_id); - ERR_FAIL_COND_V(!c,ERR_INVALID_PARAMETER); - - ERR_FAIL_COND_V( c->lock<=0, ERR_INVALID_PARAMETER ); - c->lock--; - - return OK; -} - -size_t MemoryPoolDynamicStatic::get_available_mem() const { - - return Memory::get_static_mem_available(); -} - -size_t MemoryPoolDynamicStatic::get_total_usage() const { - _THREAD_SAFE_METHOD_ - - return total_usage; -} - -MemoryPoolDynamicStatic::MemoryPoolDynamicStatic() { - - last_check=1; - last_alloc=0; - total_usage=0; - max_usage=0; -} - -MemoryPoolDynamicStatic::~MemoryPoolDynamicStatic() { - -#ifdef DEBUG_MEMORY_ENABLED - - if (OS::get_singleton()->is_stdout_verbose()) { - - if (total_usage>0) { - - ERR_PRINT("DYNAMIC ALLOC: ** MEMORY LEAKS DETECTED **"); - ERR_PRINT(String("DYNAMIC ALLOC: "+String::num(total_usage)+" bytes of memory in use at exit.").ascii().get_data()); - - ERR_PRINT("DYNAMIC ALLOC: Following is the list of leaked allocations:"); - - for (int i=0;i<MAX_CHUNKS;i++) { - - if (chunk[i].mem) { - - ERR_PRINT(String("\t"+String::num(chunk[i].size)+" bytes - "+String(chunk[i].descr)).ascii().get_data()); - } - } - - ERR_PRINT("DYNAMIC ALLOC: End of Report."); - - print_line("INFO: dynmem - max: "+itos(max_usage)+", "+itos(total_usage)+" leaked."); - } else { - - print_line("INFO: dynmem - max: "+itos(max_usage)+", no leaks."); - } - } - -#endif -} diff --git a/core/os/memory_pool_dynamic_static.h b/core/os/memory_pool_dynamic_static.h deleted file mode 100644 index a72d39355c..0000000000 --- a/core/os/memory_pool_dynamic_static.h +++ /dev/null @@ -1,86 +0,0 @@ -/*************************************************************************/ -/* memory_pool_dynamic_static.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 MEMORY_POOL_DYNAMIC_STATIC_H -#define MEMORY_POOL_DYNAMIC_STATIC_H - -#include "os/memory_pool_dynamic.h" -#include "typedefs.h" -#include "os/thread_safe.h" - -class MemoryPoolDynamicStatic : public MemoryPoolDynamic { - - _THREAD_SAFE_CLASS_ - - enum { - MAX_CHUNKS=65536 - }; - - - struct Chunk { - - uint64_t lock; - uint64_t check; - void *mem; - size_t size; - const char *descr; - - Chunk() { mem=NULL; lock=0; check=0; } - }; - - Chunk chunk[MAX_CHUNKS]; - uint64_t last_check; - int last_alloc; - size_t total_usage; - size_t max_usage; - - Chunk *get_chunk(ID p_id); - const Chunk *get_chunk(ID p_id) const; -public: - - virtual ID alloc(size_t p_amount,const char* p_description); - virtual void free(ID p_id); - virtual Error realloc(ID p_id, size_t p_amount); - virtual bool is_valid(ID p_id); - virtual size_t get_size(ID p_id) const; - virtual const char* get_description(ID p_id) const; - - virtual bool is_locked(ID p_id) const; - virtual Error lock(ID p_id); - virtual void * get(ID p_ID); - virtual Error unlock(ID p_id); - - virtual size_t get_available_mem() const; - virtual size_t get_total_usage() const; - - MemoryPoolDynamicStatic(); - virtual ~MemoryPoolDynamicStatic(); - -}; - -#endif diff --git a/core/os/memory_pool_static.cpp b/core/os/memory_pool_static.cpp deleted file mode 100644 index 88c2ba3b3e..0000000000 --- a/core/os/memory_pool_static.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/*************************************************************************/ -/* memory_pool_static.cpp */ -/*************************************************************************/ -/* 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. */ -/*************************************************************************/ -#include "memory_pool_static.h" - -MemoryPoolStatic *MemoryPoolStatic::singleton=0; - -MemoryPoolStatic *MemoryPoolStatic::get_singleton() { - - return singleton; -} - - -MemoryPoolStatic::MemoryPoolStatic() { - - singleton=this; -} - - -MemoryPoolStatic::~MemoryPoolStatic() { - singleton=NULL; -} - - diff --git a/core/os/memory_pool_static.h b/core/os/memory_pool_static.h deleted file mode 100644 index f7f60b8df8..0000000000 --- a/core/os/memory_pool_static.h +++ /dev/null @@ -1,69 +0,0 @@ -/*************************************************************************/ -/* memory_pool_static.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 MEMORY_POOL_STATIC_H -#define MEMORY_POOL_STATIC_H - -#include <stddef.h> - -#include "core/typedefs.h" - -/** - @author Juan Linietsky <red@lunatea> -*/ -class MemoryPoolStatic { -private: - - static MemoryPoolStatic *singleton; - -public: - - static MemoryPoolStatic *get_singleton(); - - virtual void* alloc(size_t p_bytes,const char *p_description)=0; ///< Pointer in p_description shold be to a const char const like "hello" - virtual void* realloc(void * p_memory,size_t p_bytes)=0; ///< Pointer in p_description shold be to a const char const like "hello" - virtual void free(void *p_ptr)=0; ///< Pointer in p_description shold be to a const char const - - virtual size_t get_available_mem() const=0; - virtual size_t get_total_usage()=0; - virtual size_t get_max_usage()=0; - - /* Most likely available only if memory debugger was compiled in */ - virtual int get_alloc_count()=0; - virtual void * get_alloc_ptr(int p_alloc_idx)=0; - virtual const char* get_alloc_description(int p_alloc_idx)=0; - virtual size_t get_alloc_size(int p_alloc_idx)=0; - - virtual void dump_mem_to_file(const char* p_file)=0; - - MemoryPoolStatic(); - virtual ~MemoryPoolStatic(); - -}; - -#endif diff --git a/core/os/mutex.cpp b/core/os/mutex.cpp index 21400d2ccf..f5f7f757c3 100644 --- a/core/os/mutex.cpp +++ b/core/os/mutex.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ diff --git a/core/os/mutex.h b/core/os/mutex.h index 5870171dc7..a1004965bb 100644 --- a/core/os/mutex.h +++ b/core/os/mutex.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ diff --git a/core/os/os.cpp b/core/os/os.cpp index ee32476234..3a8e15a692 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ @@ -27,13 +27,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "os.h" -#include "os/file_access.h" -#include <stdarg.h> + #include "dir_access.h" #include "globals.h" #include "input.h" -// For get_engine_version, could be removed if it's moved to a new Engine singleton -#include "version.h" +#include "os/file_access.h" + +#include <stdarg.h> OS* OS::singleton=NULL; @@ -68,6 +68,7 @@ void OS::print_error(const char* p_function,const char* p_file,int p_line,const case ERR_ERROR: err_type="**ERROR**"; break; case ERR_WARNING: err_type="**WARNING**"; break; case ERR_SCRIPT: err_type="**SCRIPT ERROR**"; break; + case ERR_SHADER: err_type="**SHADER ERROR**"; break; } if (p_rationale && *p_rationale) @@ -97,23 +98,6 @@ void OS::printerr(const char* p_format, ...) { }; -void OS::set_iterations_per_second(int p_ips) { - - ips=p_ips; -} -int OS::get_iterations_per_second() const { - - return ips; -} - -void OS::set_target_fps(int p_fps) { - _target_fps=p_fps>0? p_fps : 0; -} - -float OS::get_target_fps() const { - return _target_fps; -} - void OS::set_keep_screen_on(bool p_enabled) { _keep_screen_on=p_enabled; } @@ -151,10 +135,6 @@ int OS::get_process_ID() const { return -1; }; -uint64_t OS::get_frames_drawn() { - - return frames_drawn; -} bool OS::is_stdout_verbose() const { @@ -186,7 +166,7 @@ const char *OS::get_last_error() const { void OS::dump_memory_to_file(const char* p_file) { - Memory::dump_static_mem_to_file(p_file); + //Memory::dump_static_mem_to_file(p_file); } static FileAccess *_OSPRF=NULL; @@ -197,7 +177,7 @@ static void _OS_printres(Object *p_obj) { if (!res) return; - String str = itos(res->get_instance_ID())+String(res->get_type())+":"+String(res->get_name())+" - "+res->get_path(); + String str = itos(res->get_instance_ID())+String(res->get_class())+":"+String(res->get_name())+" - "+res->get_path(); if (_OSPRF) _OSPRF->store_line(str); else @@ -260,15 +240,7 @@ void OS::clear_last_error() { memfree(last_error); last_error=NULL; } -void OS::set_frame_delay(uint32_t p_msec) { - _frame_delay=p_msec; -} - -uint32_t OS::get_frame_delay() const { - - return _frame_delay; -} void OS::set_no_window_mode(bool p_enable) { @@ -296,7 +268,7 @@ String OS::get_locale() const { String OS::get_resource_dir() const { - return Globals::get_singleton()->get_resource_path(); + return GlobalConfig::get_singleton()->get_resource_path(); } @@ -306,7 +278,7 @@ String OS::get_system_dir(SystemDir p_dir) const { } String OS::get_safe_application_name() const { - String an = Globals::get_singleton()->get("application/name"); + String an = GlobalConfig::get_singleton()->get("application/name"); Vector<String> invalid_char = String("\\ / : * ? \" < > |").split(" "); for (int i=0;i<invalid_char.size();i++) { an = an.replace(invalid_char[i],"-"); @@ -366,16 +338,16 @@ Error OS::dialog_input_text(String p_title, String p_description, String p_parti int OS::get_static_memory_usage() const { - return Memory::get_static_mem_usage(); + return Memory::get_mem_usage(); } int OS::get_dynamic_memory_usage() const{ - return Memory::get_dynamic_mem_usage(); + return MemoryPool::total_memory; } int OS::get_static_memory_peak_usage() const { - return Memory::get_static_mem_max_usage(); + return Memory::get_mem_max_usage(); } Error OS::set_cwd(const String& p_cwd) { @@ -391,7 +363,7 @@ bool OS::has_touchscreen_ui_hint() const { int OS::get_free_static_memory() const { - return Memory::get_static_mem_available(); + return Memory::get_mem_available(); } void OS::yield() { @@ -512,27 +484,20 @@ OS::MouseMode OS::get_mouse_mode() const{ return MOUSE_MODE_VISIBLE; } -void OS::set_time_scale(float p_scale) { - - _time_scale=p_scale; -} OS::LatinKeyboardVariant OS::get_latin_keyboard_variant() const { return LATIN_KEYBOARD_QWERTY; } -float OS::get_time_scale() const { - return _time_scale; -} bool OS::is_joy_known(int p_device) { return true; } String OS::get_joy_guid(int p_device) const { - return "Default Joystick"; + return "Default Joypad"; } void OS::set_context(int p_context) { @@ -542,54 +507,26 @@ void OS::set_use_vsync(bool p_enable) { } -bool OS::is_vsnc_enabled() const{ +bool OS::is_vsync_enabled() const{ return true; } -Dictionary OS::get_engine_version() const { - - Dictionary dict; - dict["major"] = _MKSTR(VERSION_MAJOR); - dict["minor"] = _MKSTR(VERSION_MINOR); -#ifdef VERSION_PATCH - dict["patch"] = _MKSTR(VERSION_PATCH); -#else - dict["patch"] = ""; -#endif - dict["status"] = _MKSTR(VERSION_STATUS); - dict["revision"] = _MKSTR(VERSION_REVISION); - - String stringver = String(dict["major"]) + "." + String(dict["minor"]); - if (dict["patch"] != "") - stringver += "." + String(dict["patch"]); - stringver += "-" + String(dict["status"]) + " (" + String(dict["revision"]) + ")"; - dict["string"] = stringver; - - return dict; -} OS::OS() { last_error=NULL; - frames_drawn=0; singleton=this; - ips=60; _keep_screen_on=true; // set default value to true, because this had been true before godot 2.0. low_processor_usage_mode=false; _verbose_stdout=false; - _frame_delay=0; _no_window=false; _exit_code=0; _orientation=SCREEN_LANDSCAPE; - _fps=1; - _target_fps=0; + _render_thread_mode=RENDER_THREAD_SAFE; - _time_scale=1.0; - _pixel_snap=false; + + _allow_hidpi=true; - _fixed_frames=0; - _idle_frames=0; - _in_fixed=false; Math::seed(1234567); } diff --git a/core/os/os.h b/core/os/os.h index c2b46a5420..ea03481a92 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ @@ -32,6 +32,7 @@ #include "ustring.h" #include "list.h" #include "vector.h" +#include "engine.h" #include "os/main_loop.h" #include <stdarg.h> @@ -43,28 +44,17 @@ class OS { static OS* singleton; String _execpath; - String _custom_level; List<String> _cmdline; - int ips; bool _keep_screen_on; bool low_processor_usage_mode; bool _verbose_stdout; String _local_clipboard; - uint64_t frames_drawn; - uint32_t _frame_delay; uint64_t _msec_splash; bool _no_window; int _exit_code; int _orientation; - float _fps; - int _target_fps; - float _time_scale; - bool _pixel_snap; bool _allow_hidpi; - uint64_t _fixed_frames; - uint64_t _idle_frames; - bool _in_fixed; char *last_error; @@ -120,7 +110,8 @@ public: enum ErrorType { ERR_ERROR, ERR_WARNING, - ERR_SCRIPT + ERR_SCRIPT, + ERR_SHADER }; virtual void print_error(const char* p_function,const char* p_file,int p_line,const char *p_code,const char*p_rationale,ErrorType p_type=ERR_ERROR); @@ -184,15 +175,6 @@ public: virtual bool get_borderless_window() { return 0; } - - virtual void set_iterations_per_second(int p_ips); - virtual int get_iterations_per_second() const; - - virtual void set_target_fps(int p_fps); - virtual float get_target_fps() const; - - virtual float get_frames_per_second() const { return _fps; } - virtual void set_keep_screen_on(bool p_enabled); virtual bool is_keep_screen_on() const; virtual void set_low_processor_usage_mode(bool p_enabled); @@ -216,7 +198,6 @@ public: virtual MainLoop *get_main_loop() const=0; - String get_custom_level() const { return _custom_level; } virtual void yield(); @@ -279,17 +260,9 @@ public: uint32_t get_ticks_msec() const; uint64_t get_splash_tick_msec() const; - void set_frame_delay(uint32_t p_msec); - uint32_t get_frame_delay() const; virtual bool can_draw() const = 0; - uint64_t get_frames_drawn(); - - uint64_t get_fixed_frames() const { return _fixed_frames; } - uint64_t get_idle_frames() const { return _idle_frames; } - bool is_in_fixed_frame() const { return _in_fixed; } - bool is_stdout_verbose() const; enum CursorShape { @@ -415,10 +388,6 @@ public: virtual LatinKeyboardVariant get_latin_keyboard_variant() const; - void set_time_scale(float p_scale); - float get_time_scale() const; - - _FORCE_INLINE_ bool get_use_pixel_snap() const { return _pixel_snap; } virtual bool is_joy_known(int p_device); virtual String get_joy_guid(int p_device)const; @@ -431,9 +400,7 @@ public: virtual void set_context(int p_context); virtual void set_use_vsync(bool p_enable); - virtual bool is_vsnc_enabled() const; - - Dictionary get_engine_version() const; + virtual bool is_vsync_enabled() const; bool is_hidpi_allowed() const { return _allow_hidpi; } OS(); diff --git a/core/os/rw_lock.cpp b/core/os/rw_lock.cpp new file mode 100644 index 0000000000..9b2d1f8a46 --- /dev/null +++ b/core/os/rw_lock.cpp @@ -0,0 +1,21 @@ +#include "rw_lock.h" +#include "error_macros.h" +#include <stddef.h> + + + +RWLock* (*RWLock::create_func)()=0; + +RWLock *RWLock::create() { + + ERR_FAIL_COND_V( !create_func, 0 ); + + return create_func(); +} + + +RWLock::~RWLock() { + + +} + diff --git a/core/os/rw_lock.h b/core/os/rw_lock.h new file mode 100644 index 0000000000..c513e6d636 --- /dev/null +++ b/core/os/rw_lock.h @@ -0,0 +1,46 @@ +#ifndef RWLOCK_H +#define RWLOCK_H + +#include "error_list.h" + +class RWLock { +protected: + static RWLock* (*create_func)(); + +public: + + virtual void read_lock()=0; ///< Lock the rwlock, block if locked by someone else + virtual void read_unlock()=0; ///< Unlock the rwlock, let other threads continue + virtual Error read_try_lock()=0; ///< Attempt to lock the rwlock, OK on success, ERROR means it can't lock. + + virtual void write_lock()=0; ///< Lock the rwlock, block if locked by someone else + virtual void write_unlock()=0; ///< Unlock the rwlock, let other thwrites continue + virtual Error write_try_lock()=0; ///< Attempt to lock the rwlock, OK on success, ERROR means it can't lock. + + static RWLock * create(); ///< Create a rwlock + + virtual ~RWLock(); +}; + + +class RWLockRead { + + RWLock *lock; +public: + + RWLockRead(RWLock* p_lock) { lock=p_lock; if (lock) lock->read_lock(); } + ~RWLockRead() { if (lock) lock->read_unlock(); } + +}; + +class RWLockWrite { + + RWLock *lock; +public: + + RWLockWrite(RWLock* p_lock) { lock=p_lock; if (lock) lock->write_lock(); } + ~RWLockWrite() { if (lock) lock->write_unlock(); } + +}; + +#endif // RWLOCK_H diff --git a/core/os/semaphore.cpp b/core/os/semaphore.cpp index 5fa2d339dc..fe476c5888 100644 --- a/core/os/semaphore.cpp +++ b/core/os/semaphore.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ diff --git a/core/os/semaphore.h b/core/os/semaphore.h index 8469408e65..e0b4460b22 100644 --- a/core/os/semaphore.h +++ b/core/os/semaphore.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ diff --git a/core/os/shell.cpp b/core/os/shell.cpp index 8737d97fa0..60f4203dbe 100644 --- a/core/os/shell.cpp +++ b/core/os/shell.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ diff --git a/core/os/shell.h b/core/os/shell.h index 8b0c286d73..f26f01846e 100644 --- a/core/os/shell.h +++ b/core/os/shell.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ diff --git a/core/os/thread.cpp b/core/os/thread.cpp index c1ae53074b..689fed7537 100644 --- a/core/os/thread.cpp +++ b/core/os/thread.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ diff --git a/core/os/thread.h b/core/os/thread.h index 5f0ec707f2..23ed76d486 100644 --- a/core/os/thread.h +++ b/core/os/thread.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ diff --git a/core/os/thread_dummy.cpp b/core/os/thread_dummy.cpp index 30a0e2696c..93a020b7a8 100644 --- a/core/os/thread_dummy.cpp +++ b/core/os/thread_dummy.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ diff --git a/core/os/thread_dummy.h b/core/os/thread_dummy.h index 800eef9ef9..01e366e2fa 100644 --- a/core/os/thread_dummy.h +++ b/core/os/thread_dummy.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ diff --git a/core/os/thread_safe.cpp b/core/os/thread_safe.cpp index a742b1144e..a0bfb86c82 100644 --- a/core/os/thread_safe.cpp +++ b/core/os/thread_safe.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ diff --git a/core/os/thread_safe.h b/core/os/thread_safe.h index 1c82cbe704..c9a832b41b 100644 --- a/core/os/thread_safe.h +++ b/core/os/thread_safe.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* 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 */ |