Skip to content

Commit

Permalink
Revert "git subrepo pull (merge) --force --branch=groups-4.4.2025-01-…
Browse files Browse the repository at this point in the history
…30T081317Z godot"

This reverts commit afa7186.
  • Loading branch information
fire committed Jan 30, 2025
1 parent 133be86 commit 5306f90
Show file tree
Hide file tree
Showing 128 changed files with 1,212 additions and 3,908 deletions.
6 changes: 3 additions & 3 deletions godot/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
;
[subrepo]
remote = https://github.com/V-Sekai/godot.git
branch = groups-4.4.2025-01-30T081317Z
commit = 7392ee7b0c86621aa3018c6a64b8a98709456d70
parent = 20728e2968cb1d60a0dde5aaa4a9d06860d7646e
branch = groups-4.4.2025-01-25T174454Z
commit = 917c48af166507bd61d7cc767de62e848fa9d904
parent = 91b1da34be145c1e8c59a26027828d8f347a6bc5
method = merge
cmdver = 0.4.9
55 changes: 30 additions & 25 deletions godot/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,22 @@ for x in sorted(glob.glob("platform/*")):
sys.path.remove(tmppath)
sys.modules.pop("detect")

custom_tools = ["default"]

platform_arg = ARGUMENTS.get("platform", ARGUMENTS.get("p", False))

if platform_arg == "android":
custom_tools = ["clang", "clang++", "as", "ar", "link"]
elif platform_arg == "web":
# Use generic POSIX build toolchain for Emscripten.
custom_tools = ["cc", "c++", "ar", "link", "textfile", "zip"]
elif os.name == "nt" and methods.get_cmdline_bool("use_mingw", False):
custom_tools = ["mingw"]

# We let SCons build its default ENV as it includes OS-specific things which we don't
# want to have to pull in manually. However we enforce no "tools", which we register
# further down after parsing our platform-specific configuration.
# want to have to pull in manually.
# Then we prepend PATH to make it take precedence, while preserving SCons' own entries.
env = Environment(tools=[])
env = Environment(tools=custom_tools)
env.PrependENVPath("PATH", os.getenv("PATH"))
env.PrependENVPath("PKG_CONFIG_PATH", os.getenv("PKG_CONFIG_PATH"))
if "TERM" in os.environ: # Used for colored output.
Expand Down Expand Up @@ -157,7 +168,11 @@ if profile:
opts = Variables(customs, ARGUMENTS)

# Target build options
opts.Add((["platform", "p"], "Target platform (%s)" % "|".join(platform_list), ""))
if env.scons_version >= (4, 3):
opts.Add(["platform", "p"], "Target platform (%s)" % "|".join(platform_list), "")
else:
opts.Add("platform", "Target platform (%s)" % "|".join(platform_list), "")
opts.Add("p", "Alias for 'platform'", "")
opts.Add(EnumVariable("target", "Compilation target", "editor", ("editor", "template_release", "template_debug")))
opts.Add(EnumVariable("arch", "CPU architecture", "auto", ["auto"] + architectures, architecture_aliases))
opts.Add(BoolVariable("dev_build", "Developer build with dev-only debugging code (DEV_ENABLED)", False))
Expand Down Expand Up @@ -297,7 +312,10 @@ if env["import_env_vars"]:

# Platform selection: validate input, and add options.

if not env["platform"]:
if env.scons_version < (4, 3) and not env["platform"]:
env["platform"] = env["p"]

if env["platform"] == "":
# Missing `platform` argument, try to detect platform automatically
if (
sys.platform.startswith("linux")
Expand All @@ -312,7 +330,7 @@ if not env["platform"]:
elif sys.platform == "win32":
env["platform"] = "windows"

if env["platform"]:
if env["platform"] != "":
print(f'Automatically detected platform: {env["platform"]}')

# Deprecated aliases kept for compatibility.
Expand All @@ -334,7 +352,7 @@ if env["platform"] not in platform_list:

if env["platform"] == "list":
print(text)
elif not env["platform"]:
elif env["platform"] == "":
print_error("Could not detect platform automatically.\n" + text)
else:
print_error(f'Invalid target platform "{env["platform"]}".\n' + text)
Expand Down Expand Up @@ -416,23 +434,6 @@ env.modules_detected = modules_detected
opts.Update(env, {**ARGUMENTS, **env.Dictionary()})
Help(opts.GenerateHelpText(env))


# FIXME: Tool assignment happening at this stage is a direct consequence of getting the platform logic AFTER the SCons
# environment was already been constructed. Fixing this would require a broader refactor where all options are setup
# ahead of time with native validator/converter functions.
tmppath = "./platform/" + env["platform"]
sys.path.insert(0, tmppath)
import detect

custom_tools = ["default"]
try: # Platform custom tools are optional
custom_tools = detect.get_tools(env)
except AttributeError:
pass
for tool in custom_tools:
env.Tool(tool)


# add default include paths

env.Prepend(CPPPATH=["#"])
Expand Down Expand Up @@ -514,6 +515,10 @@ if not env["deprecated"]:
if env["precision"] == "double":
env.Append(CPPDEFINES=["REAL_T_IS_DOUBLE"])

tmppath = "./platform/" + env["platform"]
sys.path.insert(0, tmppath)
import detect

# Default num_jobs to local cpu count if not user specified.
# SCons has a peculiarity where user-specified options won't be overridden
# by SetOption, so we can rely on this to know if we should use our default.
Expand Down Expand Up @@ -582,7 +587,7 @@ if env["dev_mode"]:
if env["production"]:
env["use_static_cpp"] = methods.get_cmdline_bool("use_static_cpp", True)
env["debug_symbols"] = methods.get_cmdline_bool("debug_symbols", False)
if env["platform"] == "android":
if platform_arg == "android":
env["swappy"] = methods.get_cmdline_bool("swappy", True)
# LTO "auto" means we handle the preferred option in each platform detect.py.
env["lto"] = ARGUMENTS.get("lto", "auto")
Expand Down
53 changes: 35 additions & 18 deletions godot/core/input/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ Input *Input::singleton = nullptr;

void (*Input::set_mouse_mode_func)(Input::MouseMode) = nullptr;
Input::MouseMode (*Input::get_mouse_mode_func)() = nullptr;
void (*Input::set_mouse_mode_override_func)(Input::MouseMode) = nullptr;
Input::MouseMode (*Input::get_mouse_mode_override_func)() = nullptr;
void (*Input::set_mouse_mode_override_enabled_func)(bool) = nullptr;
bool (*Input::is_mouse_mode_override_enabled_func)() = nullptr;
void (*Input::warp_mouse_func)(const Vector2 &p_position) = nullptr;
Input::CursorShape (*Input::get_current_cursor_shape_func)() = nullptr;
void (*Input::set_custom_mouse_cursor_func)(const Ref<Resource> &, Input::CursorShape, const Vector2 &) = nullptr;
Expand All @@ -90,29 +86,51 @@ Input *Input::get_singleton() {
}

void Input::set_mouse_mode(MouseMode p_mode) {
ERR_FAIL_INDEX(p_mode, MouseMode::MOUSE_MODE_MAX);
ERR_FAIL_INDEX((int)p_mode, 5);

if (p_mode == mouse_mode) {
return;
}

// Allow to be set even if overridden, to see if the platform allows the mode.
set_mouse_mode_func(p_mode);
mouse_mode = get_mouse_mode_func();

if (mouse_mode_override_enabled) {
set_mouse_mode_func(mouse_mode_override);
}
}

Input::MouseMode Input::get_mouse_mode() const {
return get_mouse_mode_func();
return mouse_mode;
}

void Input::set_mouse_mode_override(MouseMode p_mode) {
ERR_FAIL_INDEX(p_mode, MouseMode::MOUSE_MODE_MAX);
set_mouse_mode_override_func(p_mode);
}
void Input::set_mouse_mode_override_enabled(bool p_enabled) {
if (p_enabled == mouse_mode_override_enabled) {
return;
}

Input::MouseMode Input::get_mouse_mode_override() const {
return get_mouse_mode_override_func();
}
mouse_mode_override_enabled = p_enabled;

void Input::set_mouse_mode_override_enabled(bool p_override_enabled) {
set_mouse_mode_override_enabled_func(p_override_enabled);
if (p_enabled) {
set_mouse_mode_func(mouse_mode_override);
mouse_mode_override = get_mouse_mode_func();
} else {
set_mouse_mode_func(mouse_mode);
}
}

bool Input::is_mouse_mode_override_enabled() {
return is_mouse_mode_override_enabled_func();
void Input::set_mouse_mode_override(MouseMode p_mode) {
ERR_FAIL_INDEX((int)p_mode, 5);

if (p_mode == mouse_mode_override) {
return;
}

if (mouse_mode_override_enabled) {
set_mouse_mode_func(p_mode);
mouse_mode_override = get_mouse_mode_func();
}
}

void Input::_bind_methods() {
Expand Down Expand Up @@ -181,7 +199,6 @@ void Input::_bind_methods() {
BIND_ENUM_CONSTANT(MOUSE_MODE_CAPTURED);
BIND_ENUM_CONSTANT(MOUSE_MODE_CONFINED);
BIND_ENUM_CONSTANT(MOUSE_MODE_CONFINED_HIDDEN);
BIND_ENUM_CONSTANT(MOUSE_MODE_MAX);

BIND_ENUM_CONSTANT(CURSOR_ARROW);
BIND_ENUM_CONSTANT(CURSOR_IBEAM);
Expand Down
14 changes: 5 additions & 9 deletions godot/core/input/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,12 @@ class Input : public Object {
static constexpr uint64_t MAX_EVENT = 32;

public:
// Keep synced with "DisplayServer::MouseMode" enum.
enum MouseMode {
MOUSE_MODE_VISIBLE,
MOUSE_MODE_HIDDEN,
MOUSE_MODE_CAPTURED,
MOUSE_MODE_CONFINED,
MOUSE_MODE_CONFINED_HIDDEN,
MOUSE_MODE_MAX,
};

#undef CursorShape
Expand Down Expand Up @@ -107,6 +105,10 @@ class Input : public Object {
bool legacy_just_pressed_behavior = false;
bool disable_input = false;

MouseMode mouse_mode = MOUSE_MODE_VISIBLE;
bool mouse_mode_override_enabled = false;
MouseMode mouse_mode_override = MOUSE_MODE_VISIBLE;

struct ActionState {
uint64_t pressed_physics_frame = UINT64_MAX;
uint64_t pressed_process_frame = UINT64_MAX;
Expand Down Expand Up @@ -266,10 +268,6 @@ class Input : public Object {

static void (*set_mouse_mode_func)(MouseMode);
static MouseMode (*get_mouse_mode_func)();
static void (*set_mouse_mode_override_func)(MouseMode);
static MouseMode (*get_mouse_mode_override_func)();
static void (*set_mouse_mode_override_enabled_func)(bool);
static bool (*is_mouse_mode_override_enabled_func)();
static void (*warp_mouse_func)(const Vector2 &p_position);

static CursorShape (*get_current_cursor_shape_func)();
Expand All @@ -288,10 +286,8 @@ class Input : public Object {
public:
void set_mouse_mode(MouseMode p_mode);
MouseMode get_mouse_mode() const;
void set_mouse_mode_override_enabled(bool p_enabled);
void set_mouse_mode_override(MouseMode p_mode);
MouseMode get_mouse_mode_override() const;
void set_mouse_mode_override_enabled(bool p_override_enabled);
bool is_mouse_mode_override_enabled();

#ifdef TOOLS_ENABLED
void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const override;
Expand Down
31 changes: 13 additions & 18 deletions godot/core/io/resource_format_binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@ Error ResourceLoaderBinary::parse_variant(Variant &r_v) {
}

//always use internal cache for loading internal resources

if (!internal_index_cache.has(path)) {
WARN_PRINT(vformat("Couldn't load resource (no cache): %s.", path));
r_v = Variant();
Expand All @@ -427,24 +426,16 @@ Error ResourceLoaderBinary::parse_variant(Variant &r_v) {
path = ProjectSettings::get_singleton()->localize_path(res_path.get_base_dir().path_join(path));
}

if (remaps.has(path)) {
if (remaps.find(path)) {
path = remaps[path];
}

if (using_whitelist && !external_path_whitelist.has(path)) {
WARN_PRINT(vformat("Blocked path not on whitelist: %s.", path));
r_v = Variant();
error = ERR_FILE_CANT_OPEN;
return error;
Ref<Resource> res;
if (!using_whitelist || external_path_whitelist.has(path)) {
res = ResourceLoader::load(path, exttype, cache_mode_for_external);
}

Ref<Resource> res = ResourceLoader::load(path, exttype, cache_mode_for_external);

if (res.is_null()) {
ERR_PRINT(vformat("Couldn't load resource: %s.", path));
r_v = Variant();
error = ERR_FILE_CANT_OPEN;
return error;
WARN_PRINT(vformat("Couldn't load resource: %s.", path));
}
r_v = res;

Expand All @@ -454,10 +445,8 @@ Error ResourceLoaderBinary::parse_variant(Variant &r_v) {
int erindex = f->get_32();

if (erindex < 0 || erindex >= external_resources.size()) {
ERR_PRINT("Broken external resource! (index out of size)");
WARN_PRINT("Broken external resource! (index out of size)");
r_v = Variant();
error = ERR_FILE_CORRUPT;
return error;
} else {
Ref<ResourceLoader::LoadToken> &load_token = external_resources.write[erindex].load_token;
if (load_token.is_valid()) { // If not valid, it's OK since then we know this load accepts broken dependencies.
Expand Down Expand Up @@ -709,7 +698,13 @@ Error ResourceLoaderBinary::load() {
}

external_resources.write[i].path = path; //remap happens here, not on load because on load it can actually be used for filesystem dock resource remap
external_resources.write[i].load_token = ResourceLoader::_load_start(path, external_resources[i].type, use_sub_threads ? ResourceLoader::LOAD_THREAD_DISTRIBUTE : ResourceLoader::LOAD_THREAD_FROM_CURRENT, cache_mode_for_external, false, false, Dictionary(), Dictionary());

if (using_whitelist && !external_path_whitelist.has(path)) {
error = ERR_FILE_MISSING_DEPENDENCIES;
ERR_FAIL_V_MSG(error, "External dependency not in whitelist: " + path + ".");
}

external_resources.write[i].load_token = ResourceLoader::_load_start(path, external_resources[i].type, use_sub_threads ? ResourceLoader::LOAD_THREAD_DISTRIBUTE : ResourceLoader::LOAD_THREAD_FROM_CURRENT, cache_mode_for_external, true, using_whitelist, external_path_whitelist, type_whitelist);

if (!external_resources[i].load_token.is_valid()) {
if (!ResourceLoader::get_abort_on_missing_resources()) {
Expand Down
16 changes: 4 additions & 12 deletions godot/core/io/resource_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ void ResourceFormatLoader::_bind_methods() {
GDVIRTUAL_BIND(_exists, "path");
GDVIRTUAL_BIND(_get_classes_used, "path");
GDVIRTUAL_BIND(_load, "path", "original_path", "use_sub_threads", "cache_mode");
//GDVIRTUAL_BIND(_load_whitelisted, "path", "external_path_whitelist", "type_Whitelist", "original_path", "use_sub_threads", "cache_mode");
}

///////////////////////////////////
Expand Down Expand Up @@ -305,11 +306,11 @@ Ref<Resource> ResourceLoader::_load(const String &p_path, const String &p_origin
}
found = true;
if (p_using_whitelist) {
res = loader[i]->load_whitelisted(p_path, p_external_path_whitelist, p_type_whitelist, p_original_path.is_valid_filename() ? p_path : p_original_path, r_error, p_use_sub_threads, r_progress, p_cache_mode);
res = loader[i]->load_whitelisted(p_path, p_external_path_whitelist, p_type_whitelist, !p_original_path.is_empty() ? p_original_path : p_path, r_error, p_use_sub_threads, r_progress, p_cache_mode);
} else {
res = loader[i]->load(p_path, p_original_path.is_valid_filename() ? p_path : p_original_path, r_error, p_use_sub_threads, r_progress, p_cache_mode);
res = loader[i]->load(p_path, !p_original_path.is_empty() ? p_original_path : p_path, r_error, p_use_sub_threads, r_progress, p_cache_mode);
}
if (res.is_valid()) {
if (!res.is_null()) {
break;
}
}
Expand Down Expand Up @@ -603,11 +604,6 @@ Ref<Resource> ResourceLoader::load_whitelisted(const String &p_path, Dictionary
Ref<ResourceLoader::LoadToken> ResourceLoader::_load_start(const String &p_path, const String &p_type_hint, LoadThreadMode p_thread_mode, ResourceFormatLoader::CacheMode p_cache_mode, bool p_for_user, bool p_use_whitelist, Dictionary p_external_path_whitelist, Dictionary p_type_whitelist) {
String local_path = _validate_local_path(p_path);

if (p_use_whitelist && !p_external_path_whitelist.has(local_path)) {
WARN_PRINT(vformat("Blocked path not on whitelist: %s.", local_path));
return Ref<ResourceLoader::LoadToken>();
}

bool ignoring_cache = p_cache_mode == ResourceFormatLoader::CACHE_MODE_IGNORE || p_cache_mode == ResourceFormatLoader::CACHE_MODE_IGNORE_DEEP;

Ref<LoadToken> load_token;
Expand Down Expand Up @@ -1625,7 +1621,3 @@ HashMap<String, Vector<String>> ResourceLoader::translation_remaps;
HashMap<String, String> ResourceLoader::path_remaps;

ResourceLoaderImport ResourceLoader::import = nullptr;

Ref<Resource> ResourceFormatLoader::load_whitelisted(const String &p_path, Dictionary p_external_path_whitelist, Dictionary p_type_whitelist, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) {
return Ref<Resource>();
}
4 changes: 3 additions & 1 deletion godot/core/io/resource_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ class ResourceFormatLoader : public RefCounted {

public:
virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
virtual Ref<Resource> load_whitelisted(const String &p_path, Dictionary p_external_path_whitelist, Dictionary p_type_whitelist, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
virtual Ref<Resource> load_whitelisted(const String &p_path, Dictionary p_external_path_whitelist, Dictionary p_type_whitelist, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) {
return Ref<Resource>();
}
virtual bool exists(const String &p_path) const;
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
Expand Down
Loading

0 comments on commit 5306f90

Please sign in to comment.