Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Spartan322 committed Jan 16, 2025
2 parents 178fda8 + d33da79 commit b5b2fda
Show file tree
Hide file tree
Showing 284 changed files with 9,485 additions and 2,002 deletions.
12 changes: 3 additions & 9 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,18 @@ root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = tab
insert_final_newline = true

[*.{cpp,hpp,c,h,mm}]
max_line_length = 120
trim_trailing_whitespace = true

[{*.gradle,AndroidManifest.xml}]
indent_style = space
indent_size = 4

[{*.py,SConstruct,SCsub}]
indent_style = space
indent_size = 4

# YAML requires indentation with spaces instead of tabs.
[{*.{yml,yaml},.clang{-format,-tidy,d}}]
indent_style = space
indent_size = 2
indent_style = space

[*.svg]
insert_final_newline = false
1 change: 1 addition & 0 deletions .github/workflows/android_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ jobs:
cd platform/android/java
./gradlew generateGodotEditor
./gradlew generateGodotHorizonOSEditor
./gradlew generateGodotPicoOSEditor
cd ../../..
ls -l bin/android_editor_builds/
Expand Down
4 changes: 2 additions & 2 deletions core/debugger/remote_debugger_peer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@ Error RemoteDebuggerPeerTCP::connect_to_host(const String &p_host, uint16_t p_po
} else {
const int ms = waits[i];
OS::get_singleton()->delay_usec(ms * 1000);
print_verbose("Remote Debugger: Connection failed with status: '" + String::num(tcp_client->get_status()) + "', retrying in " + String::num(ms) + " msec.");
print_verbose("Remote Debugger: Connection failed with status: '" + String::num_int64(tcp_client->get_status()) + "', retrying in " + String::num_int64(ms) + " msec.");
}
}

if (tcp_client->get_status() != StreamPeerTCP::STATUS_CONNECTED) {
ERR_PRINT(vformat("Remote Debugger: Unable to connect. Status: %s.", String::num(tcp_client->get_status())));
ERR_PRINT(vformat("Remote Debugger: Unable to connect. Status: %s.", String::num_int64(tcp_client->get_status())));
return FAILED;
}
connected = true;
Expand Down
14 changes: 11 additions & 3 deletions core/extension/gdextension_special_compat_hashes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ void GDExtensionSpecialCompatHashes::initialize() {
#endif
});
mappings.insert("DirAccess", {
{ "list_dir_begin", 2018049411, 2610976713 },
{ "list_dir_begin", 2018049411, 166280745 },
{ "list_dir_begin", 2610976713, 166280745 },
{ "copy", 198434953, 1063198817 },
{ "copy_absolute", 198434953, 1063198817 },
});
Expand All @@ -279,7 +280,8 @@ void GDExtensionSpecialCompatHashes::initialize() {
{ "global_menu_add_multistate_item", 3431222859, 3297554655 },
{ "global_menu_add_separator", 1041533178, 3214812433 },
{ "tts_speak", 3741216677, 903992738 },
{ "is_touchscreen_available", 4162880507, 3323674545 },
{ "is_touchscreen_available", 4162880507, 36873697 },
{ "is_touchscreen_available", 3323674545, 36873697 },
{ "screen_set_orientation", 2629526904, 2211511631 },
{ "window_get_native_handle", 2709193271, 1096425680 },
{ "window_set_title", 3043792800, 441246282 },
Expand Down Expand Up @@ -550,6 +552,9 @@ void GDExtensionSpecialCompatHashes::initialize() {
{ "tr", 2475554935, 1195764410 },
{ "tr_n", 4021311862, 162698058 },
});
mappings.insert("OpenXRAPIExtension", {
{ "transform_from_pose", 3255299855, 2963875352 },
});
mappings.insert("OptionButton", {
{ "add_item", 3043792800, 2697778442 },
{ "add_icon_item", 3944051090, 3781678508 },
Expand Down Expand Up @@ -773,7 +778,7 @@ void GDExtensionSpecialCompatHashes::initialize() {
{ "push_paragraph", 3218895358, 3089306873 },
{ "push_list", 4036303897, 3017143144 },
{ "push_table", 1125058220, 2623499273 },
{ "set_table_column_expand", 4132157579, 2185176273 },
{ "set_table_column_expand", 4258957458, 2185176273 },
#ifdef REAL_T_IS_DOUBLE
{ "add_image", 3346058748, 1507062345 },
{ "push_dropcap", 981432822, 763534173 },
Expand Down Expand Up @@ -914,6 +919,9 @@ void GDExtensionSpecialCompatHashes::initialize() {
{ "set_cells_terrain_path", 3072115677, 3578627656 },
{ "get_used_cells_by_id", 4152068407, 2931012785 },
});
mappings.insert("TileMapLayer", {
{ "notify_runtime_tile_data_update", 2275361663, 3218959716 },
});
mappings.insert("TileMapPattern", {
{ "set_cell", 634000503, 2224802556 },
});
Expand Down
2 changes: 1 addition & 1 deletion core/io/dir_access.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ void DirAccess::_bind_methods() {
ClassDB::bind_static_method("DirAccess", D_METHOD("get_open_error"), &DirAccess::get_open_error);
ClassDB::bind_static_method("DirAccess", D_METHOD("create_temp", "prefix", "keep"), &DirAccess::_create_temp, DEFVAL(""), DEFVAL(false));

ClassDB::bind_method(D_METHOD("list_dir_begin"), &DirAccess::list_dir_begin, DEFVAL(false), DEFVAL(false));
ClassDB::bind_method(D_METHOD("list_dir_begin"), &DirAccess::list_dir_begin);
ClassDB::bind_method(D_METHOD("get_next"), &DirAccess::_get_next);
ClassDB::bind_method(D_METHOD("current_is_dir"), &DirAccess::current_is_dir);
ClassDB::bind_method(D_METHOD("list_dir_end"), &DirAccess::list_dir_end);
Expand Down
93 changes: 92 additions & 1 deletion core/io/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,7 @@ static void _overlay(const uint8_t *__restrict p_src, uint8_t *__restrict p_dst,
}

bool Image::is_size_po2() const {
return uint32_t(width) == next_power_of_2(width) && uint32_t(height) == next_power_of_2(height);
return is_power_of_2(width) && is_power_of_2(height);
}

void Image::resize_to_po2(bool p_square, Interpolation p_interpolation) {
Expand Down Expand Up @@ -3955,6 +3955,97 @@ String Image::get_format_name(Format p_format) {
return format_names[p_format];
}

uint32_t Image::get_format_component_mask(Format p_format) {
const uint32_t r = 1;
const uint32_t rg = 3;
const uint32_t rgb = 7;
const uint32_t rgba = 15;

switch (p_format) {
case FORMAT_L8:
return rgb;
case FORMAT_LA8:
return rgba;
case FORMAT_R8:
return r;
case FORMAT_RG8:
return rg;
case FORMAT_RGB8:
return rgb;
case FORMAT_RGBA8:
return rgba;
case FORMAT_RGBA4444:
return rgba;
case FORMAT_RGB565:
return rgb;
case FORMAT_RF:
return r;
case FORMAT_RGF:
return rg;
case FORMAT_RGBF:
return rgb;
case FORMAT_RGBAF:
return rgba;
case FORMAT_RH:
return r;
case FORMAT_RGH:
return rg;
case FORMAT_RGBH:
return rgb;
case FORMAT_RGBAH:
return rgba;
case FORMAT_RGBE9995:
return rgba;
case FORMAT_DXT1:
return rgb;
case FORMAT_DXT3:
return rgb;
case FORMAT_DXT5:
return rgba;
case FORMAT_RGTC_R:
return r;
case FORMAT_RGTC_RG:
return rg;
case FORMAT_BPTC_RGBA:
return rgba;
case FORMAT_BPTC_RGBF:
return rgb;
case FORMAT_BPTC_RGBFU:
return rgb;
case FORMAT_ETC:
return rgb;
case FORMAT_ETC2_R11:
return r;
case FORMAT_ETC2_R11S:
return r;
case FORMAT_ETC2_RG11:
return rg;
case FORMAT_ETC2_RG11S:
return rg;
case FORMAT_ETC2_RGB8:
return rgb;
case FORMAT_ETC2_RGBA8:
return rgba;
case FORMAT_ETC2_RGB8A1:
return rgba;
case FORMAT_ETC2_RA_AS_RG:
return rgba;
case FORMAT_DXT5_RA_AS_RG:
return rgba;
case FORMAT_ASTC_4x4:
return rgba;
case FORMAT_ASTC_4x4_HDR:
return rgba;
case FORMAT_ASTC_8x8:
return rgba;
case FORMAT_ASTC_8x8_HDR:
return rgba;
default:
ERR_PRINT("Unhandled format.");
return rgba;
}
}

Error Image::load_png_from_buffer(const Vector<uint8_t> &p_array) {
return _load_from_buffer(p_array, _png_mem_loader_func);
}
Expand Down
1 change: 1 addition & 0 deletions core/io/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ class Image : public Resource {
Ref<Image> get_region(const Rect2i &p_area) const;

static String get_format_name(Format p_format);
static uint32_t get_format_component_mask(Format p_format);

Error load_png_from_buffer(const Vector<uint8_t> &p_array);
Error load_jpg_from_buffer(const Vector<uint8_t> &p_array);
Expand Down
5 changes: 5 additions & 0 deletions core/object/class_db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1961,6 +1961,11 @@ MethodBind *ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind, bool p_
ERR_FAIL_V_MSG(nullptr, vformat("Method definition provides more arguments than the method actually has '%s::%s'.", instance_type, mdname));
}

if (p_defcount > p_bind->get_argument_count()) {
memdelete(p_bind);
ERR_FAIL_V_MSG(nullptr, vformat("Method definition for '%s::%s' provides more default arguments than the method has arguments.", instance_type, mdname));
}

p_bind->set_argument_names(method_name.args);

if (!p_compatibility) {
Expand Down
26 changes: 6 additions & 20 deletions core/object/method_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,15 @@
#include "method_bind.h"

uint32_t MethodBind::get_hash() const {
uint32_t hash = hash_murmur3_one_32(has_return() ? 1 : 0);
hash = hash_murmur3_one_32(get_argument_count(), hash);

for (int i = (has_return() ? -1 : 0); i < get_argument_count(); i++) {
PropertyInfo pi = i == -1 ? get_return_info() : get_argument_info(i);
hash = hash_murmur3_one_32(get_argument_type(i), hash);
if (pi.class_name != StringName()) {
hash = hash_murmur3_one_32(pi.class_name.operator String().hash(), hash);
}
}

hash = hash_murmur3_one_32(get_default_argument_count(), hash);
MethodInfo mi;
mi.return_val = get_return_info();
mi.flags = get_hint_flags();
for (int i = 0; i < get_argument_count(); i++) {
if (has_default_argument(i)) {
Variant v = get_default_argument(i);
hash = hash_murmur3_one_32(v.hash(), hash);
}
mi.arguments.push_back(get_argument_info(i));
}
mi.default_arguments = default_arguments;

hash = hash_murmur3_one_32(is_const(), hash);
hash = hash_murmur3_one_32(is_vararg(), hash);

return hash_fmix32(hash);
return mi.get_compatibility_hash();
}

PropertyInfo MethodBind::get_argument_info(int p_argument) const {
Expand Down
1 change: 0 additions & 1 deletion core/object/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ MethodInfo MethodInfo::from_dict(const Dictionary &p_dict) {
return mi;
}

// This was copied from MethodBind::get_hash() so that the compatibility hashes for virtual and non-virtual methods would be the same.
uint32_t MethodInfo::get_compatibility_hash() const {
bool has_return = (return_val.type != Variant::NIL) || (return_val.usage & PROPERTY_USAGE_NIL_IS_VARIANT);

Expand Down
4 changes: 0 additions & 4 deletions core/os/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ SafeNumeric<uint64_t> Memory::max_usage;

SafeNumeric<uint64_t> Memory::alloc_count;

inline bool is_power_of_2(size_t x) {
return x && ((x & (x - 1U)) == 0U);
}

void *Memory::alloc_aligned_static(size_t p_bytes, size_t p_alignment) {
DEV_ASSERT(is_power_of_2(p_alignment));

Expand Down
Loading

0 comments on commit b5b2fda

Please sign in to comment.