feat: modules moved and engine moved to submodule

This commit is contained in:
Jan van der Weide 2025-04-12 18:40:44 +02:00
parent dfb5e645cd
commit c33d2130cc
5136 changed files with 225275 additions and 64485 deletions

View file

@ -8,6 +8,8 @@ from pathlib import Path
import platform_windows_builders
from methods import redirect_emitter
sources = []
common_win = [
@ -49,6 +51,7 @@ def arrange_program_clean(prog):
Clean(prog, extra_files_to_clean)
env["BUILDERS"]["RES"].emitter = redirect_emitter
res_file = "godot_res.rc"
res_target = "godot_res" + env["OBJSUFFIX"]
res_obj = env.RES(res_target, res_file)
@ -57,6 +60,12 @@ env.Depends(res_obj, "#core/version_generated.gen.h")
env.add_source_files(sources, common_win)
sources += res_obj
if env["accesskit"] and not env.msvc:
def_file = "uiautomationcore." + env["arch"] + ".def"
def_target = "libuiautomationcore." + env["arch"] + ".a"
def_obj = env.DEF(def_target, def_file)
sources += def_obj
prog = env.add_program("#bin/godot", sources, PROGSUFFIX=env["PROGSUFFIX"])
arrange_program_clean(prog)
@ -109,7 +118,7 @@ if env["d3d12"]:
# Whether these are loaded from arch-specific directory or not has to be known at build time.
target_dir = arch_bin_dir if env["agility_sdk_multiarch"] else "#bin"
for dll in agility_dlls:
env.Command(
env.CommandNoCache(
target_dir + "/" + dll,
env["agility_sdk_path"] + "/build/native/bin/" + agility_arch_subdir + "/" + dll,
Copy("$TARGET", "$SOURCE"),
@ -118,13 +127,13 @@ if env["d3d12"]:
# PIX
if env["use_pix"]:
pix_dll = "WinPixEventRuntime.dll"
env.Command(
env.CommandNoCache(
"#bin/" + pix_dll,
env["pix_path"] + "/bin/" + dxc_arch_subdir + "/" + pix_dll,
Copy("$TARGET", "$SOURCE"),
)
if not os.getenv("VCINSTALLDIR"):
if not env.msvc:
if env["debug_symbols"]:
env.AddPostAction(prog, env.Run(platform_windows_builders.make_debug_mingw))
if env["windows_subsystem"] == "gui":

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef CRASH_HANDLER_WINDOWS_H
#define CRASH_HANDLER_WINDOWS_H
#pragma once
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@ -56,5 +55,3 @@ public:
CrashHandler();
~CrashHandler();
};
#endif // CRASH_HANDLER_WINDOWS_H

View file

@ -147,10 +147,10 @@ DWORD CrashHandlerException(EXCEPTION_POINTERS *ep) {
print_error(vformat("%s: Program crashed", __FUNCTION__));
// Print the engine version just before, so that people are reminded to include the version in backtrace reports.
if (String(VERSION_HASH).is_empty()) {
print_error(vformat("Engine version: %s", VERSION_FULL_NAME));
if (String(GODOT_VERSION_HASH).is_empty()) {
print_error(vformat("Engine version: %s", GODOT_VERSION_FULL_NAME));
} else {
print_error(vformat("Engine version: %s (%s)", VERSION_FULL_NAME, VERSION_HASH));
print_error(vformat("Engine version: %s (%s)", GODOT_VERSION_FULL_NAME, GODOT_VERSION_HASH));
}
print_error(vformat("Dumping the backtrace. %s", msg));

View file

@ -153,10 +153,10 @@ extern void CrashHandlerException(int signal) {
print_error(vformat("%s: Program crashed with signal %d", __FUNCTION__, signal));
// Print the engine version just before, so that people are reminded to include the version in backtrace reports.
if (String(VERSION_HASH).is_empty()) {
print_error(vformat("Engine version: %s", VERSION_FULL_NAME));
if (String(GODOT_VERSION_HASH).is_empty()) {
print_error(vformat("Engine version: %s", GODOT_VERSION_FULL_NAME));
} else {
print_error(vformat("Engine version: %s (%s)", VERSION_FULL_NAME, VERSION_HASH));
print_error(vformat("Engine version: %s (%s)", GODOT_VERSION_FULL_NAME, GODOT_VERSION_HASH));
}
print_error(vformat("Dumping the backtrace. %s", msg));
@ -172,7 +172,7 @@ extern void CrashHandlerException(int signal) {
if (FileAccess::exists(_execpath + ".debugsymbols")) {
_execpath = _execpath + ".debugsymbols";
}
_execpath = _execpath.replace("/", "\\");
_execpath = _execpath.replace_char('/', '\\');
CharString cs = _execpath.utf8(); // Note: should remain in scope during backtrace_simple call.
data.state = backtrace_create_state(cs.get_data(), 0, &error_callback, reinterpret_cast<void *>(&data));

View file

@ -5,7 +5,7 @@ import sys
from typing import TYPE_CHECKING
import methods
from methods import print_error, print_warning
from methods import print_error, print_info, print_warning
from platform_methods import detect_arch, validate_arch
if TYPE_CHECKING:
@ -47,14 +47,6 @@ def try_cmd(test, prefix, arch, check_clang=False):
def can_build():
if os.name == "nt":
# Building natively on Windows
# If VCINSTALLDIR is set in the OS environ, use traditional Godot logic to set up MSVC
if os.getenv("VCINSTALLDIR"): # MSVC, manual setup
return True
# Otherwise, let SCons find MSVC if installed, or else MinGW.
# Since we're just returning True here, if there's no compiler
# installed, we'll get errors when it tries to build with the
# null compiler.
return True
if os.name == "posix":
@ -156,10 +148,15 @@ def detect_build_env_arch():
def get_tools(env: "SConsEnvironment"):
if os.name != "nt" or env["use_mingw"]:
from SCons.Tool.MSCommon import msvc_exists
if os.name != "nt" or env.get("use_mingw") or not msvc_exists():
return ["mingw"]
else:
return ["default"]
msvc_arch_aliases = {"x86_32": "x86", "arm32": "arm"}
env["TARGET_ARCH"] = msvc_arch_aliases.get(env["arch"], env["arch"])
env["MSVC_VERSION"] = env["MSVS_VERSION"] = env.get("msvc_version")
return ["msvc", "mslink", "mslib"]
def get_opts():
@ -194,11 +191,7 @@ def get_opts():
"0x0601",
),
EnumVariable("windows_subsystem", "Windows subsystem", "gui", ("gui", "console")),
(
"msvc_version",
"MSVC version to use. Ignored if VCINSTALLDIR is set in shell env.",
None,
),
("msvc_version", "MSVC version to use. Handled automatically by SCons if omitted.", ""),
BoolVariable("use_mingw", "Use the Mingw compiler, even if MSVC is installed.", False),
BoolVariable("use_llvm", "Use the LLVM compiler", False),
BoolVariable("use_static_cpp", "Link MinGW/MSVC C++ runtime libraries statically", True),
@ -252,91 +245,45 @@ def get_flags():
}
def setup_msvc_manual(env: "SConsEnvironment"):
"""Running from VCVARS environment"""
def build_def_file(target, source, env: "SConsEnvironment"):
arch_aliases = {
"x86_32": "i386",
"x86_64": "i386:x86-64",
"arm32": "arm",
"arm64": "arm64",
}
env_arch = detect_build_env_arch()
if env["arch"] != env_arch:
print_error(
"Arch argument (%s) is not matching Native/Cross Compile Tools Prompt/Developer Console (or Visual Studio settings) that is being used to run SCons (%s).\n"
"Run SCons again without arch argument (example: scons p=windows) and SCons will attempt to detect what MSVC compiler will be executed and inform you."
% (env["arch"], env_arch)
)
sys.exit(255)
cmdbase = "dlltool -m " + arch_aliases[env["arch"]]
if env["arch"] != "x86_32":
cmdbase += " --no-leading-underscore"
print("Using VCVARS-determined MSVC, arch %s" % (env_arch))
mingw_bin_prefix = get_mingw_bin_prefix(env["mingw_prefix"], env["arch"])
for x in range(len(source)):
ok = True
# Try prefixed executable (MinGW on Linux).
cmd = mingw_bin_prefix + cmdbase + " -d " + str(source[x]) + " -l " + str(target[x])
try:
out = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE).communicate()
if len(out[1]):
ok = False
except Exception:
ok = False
# Try generic executable (MSYS2).
if not ok:
cmd = cmdbase + " -d " + str(source[x]) + " -l " + str(target[x])
try:
out = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE).communicate()
if len(out[1]):
return -1
except Exception:
return -1
return 0
def setup_msvc_auto(env: "SConsEnvironment"):
"""Set up MSVC using SCons's auto-detection logic"""
# If MSVC_VERSION is set by SCons, we know MSVC is installed.
# But we may want a different version or target arch.
# Valid architectures for MSVC's TARGET_ARCH:
# ['amd64', 'emt64', 'i386', 'i486', 'i586', 'i686', 'ia64', 'itanium', 'x86', 'x86_64', 'arm', 'arm64', 'aarch64']
# Our x86_64 and arm64 are the same, and we need to map the 32-bit
# architectures to other names since MSVC isn't as explicit.
# The rest we don't need to worry about because they are
# aliases or aren't supported by Godot (itanium & ia64).
msvc_arch_aliases = {"x86_32": "x86", "arm32": "arm"}
if env["arch"] in msvc_arch_aliases.keys():
env["TARGET_ARCH"] = msvc_arch_aliases[env["arch"]]
else:
env["TARGET_ARCH"] = env["arch"]
# The env may have already been set up with default MSVC tools, so
# reset a few things so we can set it up with the tools we want.
# (Ideally we'd decide on the tool config before configuring any
# environment, and just set the env up once, but this function runs
# on an existing env so this is the simplest way.)
env["MSVC_SETUP_RUN"] = False # Need to set this to re-run the tool
env["MSVS_VERSION"] = None
env["MSVC_VERSION"] = None
if "msvc_version" in env:
env["MSVC_VERSION"] = env["msvc_version"]
env.Tool("msvc")
env.Tool("mssdk") # we want the MS SDK
# Re-add potentially overwritten flags.
env.AppendUnique(CCFLAGS=env.get("ccflags", "").split())
env.AppendUnique(CXXFLAGS=env.get("cxxflags", "").split())
env.AppendUnique(CFLAGS=env.get("cflags", "").split())
env.AppendUnique(RCFLAGS=env.get("rcflags", "").split())
# Note: actual compiler version can be found in env['MSVC_VERSION'], e.g. "14.1" for VS2015
print("Using SCons-detected MSVC version %s, arch %s" % (env["MSVC_VERSION"], env["arch"]))
def setup_mingw(env: "SConsEnvironment"):
"""Set up env for use with mingw"""
env_arch = detect_build_env_arch()
if os.getenv("MSYSTEM") == "MSYS":
print_error(
"Running from base MSYS2 console/environment, use target specific environment instead (e.g., mingw32, mingw64, clang32, clang64)."
)
sys.exit(255)
if env_arch != "" and env["arch"] != env_arch:
print_error(
"Arch argument (%s) is not matching MSYS2 console/environment that is being used to run SCons (%s).\n"
"Run SCons again without arch argument (example: scons p=windows) and SCons will attempt to detect what MSYS2 compiler will be executed and inform you."
% (env["arch"], env_arch)
)
sys.exit(255)
if not try_cmd("gcc --version", env["mingw_prefix"], env["arch"]) and not try_cmd(
"clang --version", env["mingw_prefix"], env["arch"]
):
print_error("No valid compilers found, use MINGW_PREFIX environment variable to set MinGW path.")
sys.exit(255)
print("Using MinGW, arch %s" % (env["arch"]))
def configure_msvc(env: "SConsEnvironment", vcvars_msvc_config):
def configure_msvc(env: "SConsEnvironment"):
"""Configure env to work with MSVC"""
## Build type
@ -371,7 +318,7 @@ def configure_msvc(env: "SConsEnvironment", vcvars_msvc_config):
from tempfile import mkstemp
# Ensure we have a location to write captured output to, in case of false positives.
capture_path = methods.base_folder_path + "platform/windows/msvc_capture.log"
capture_path = methods.base_folder / "platform" / "windows" / "msvc_capture.log"
with open(capture_path, "wt", encoding="utf-8"):
pass
@ -454,14 +401,13 @@ def configure_msvc(env: "SConsEnvironment", vcvars_msvc_config):
# for notes on why this shouldn't be enabled for gcc
env.AppendUnique(CCFLAGS=["/bigobj"])
if vcvars_msvc_config: # should be automatic if SCons found it
if os.getenv("WindowsSdkDir") is not None:
env.Prepend(CPPPATH=[str(os.getenv("WindowsSdkDir")) + "/Include"])
else:
print_warning("Missing environment variable: WindowsSdkDir")
validate_win_version(env)
if env["accesskit"]:
if int(env["target_win_version"], 16) < 0x0602:
print_info("AcceeKit enabled, targeted Windows version changed to Windows 8 (0x602).")
env["target_win_version"] = "0x0602" # Accessibility API require Windows 8+
env.AppendUnique(
CPPDEFINES=[
"WINDOWS_ENABLED",
@ -518,6 +464,29 @@ def configure_msvc(env: "SConsEnvironment", vcvars_msvc_config):
if env.debug_features:
LIBS += ["psapi", "dbghelp"]
if env["accesskit"]:
if env["accesskit_sdk_path"] != "":
env.Prepend(CPPPATH=[env["accesskit_sdk_path"] + "/include"])
if env["arch"] == "arm64":
env.Append(LIBPATH=[env["accesskit_sdk_path"] + "/lib/windows/arm64/msvc/static"])
elif env["arch"] == "x86_64":
env.Append(LIBPATH=[env["accesskit_sdk_path"] + "/lib/windows/x86_64/msvc/static"])
elif env["arch"] == "x86_32":
env.Append(LIBPATH=[env["accesskit_sdk_path"] + "/lib/windows/x86/msvc/static"])
LIBS += [
"accesskit",
"uiautomationcore",
"runtimeobject",
"propsys",
"oleaut32",
"user32",
"userenv",
"ntdll",
]
else:
env.Append(CPPDEFINES=["ACCESSKIT_DYNAMIC"])
env.Append(CPPDEFINES=["ACCESSKIT_ENABLED"])
if env["vulkan"]:
env.AppendUnique(CPPDEFINES=["VULKAN_ENABLED", "RD_ENABLED"])
if not env["use_volk"]:
@ -558,7 +527,7 @@ def configure_msvc(env: "SConsEnvironment", vcvars_msvc_config):
"libGLES.windows." + env["arch"] + prebuilt_lib_extra_suffix,
]
LIBS += ["dxgi", "d3d9", "d3d11"]
env.Prepend(CPPPATH=["#thirdparty/angle/include"])
env.Prepend(CPPEXTPATH=["#thirdparty/angle/include"])
if env["target"] in ["editor", "template_debug"]:
LIBS += ["psapi", "dbghelp"]
@ -568,12 +537,6 @@ def configure_msvc(env: "SConsEnvironment", vcvars_msvc_config):
env.Append(LINKFLAGS=[p + env["LIBSUFFIX"] for p in LIBS])
if vcvars_msvc_config:
if os.getenv("WindowsSdkDir") is not None:
env.Append(LIBPATH=[str(os.getenv("WindowsSdkDir")) + "/Lib"])
else:
print_warning("Missing environment variable: WindowsSdkDir")
## LTO
if env["lto"] == "auto": # No LTO by default for MSVC, doesn't help.
@ -596,14 +559,6 @@ def configure_msvc(env: "SConsEnvironment", vcvars_msvc_config):
env.AppendUnique(LINKFLAGS=["/LTCG"])
env.AppendUnique(ARFLAGS=["/LTCG"])
if vcvars_msvc_config:
env.Prepend(CPPPATH=[p for p in str(os.getenv("INCLUDE")).split(";")])
env.Append(LIBPATH=[p for p in str(os.getenv("LIB")).split(";")])
# Incremental linking fix
env["BUILDERS"]["ProgramOriginal"] = env["BUILDERS"]["Program"]
env["BUILDERS"]["Program"] = methods.precious_program
env.Append(LINKFLAGS=["/NATVIS:platform\\windows\\godot.natvis"])
if env["use_asan"]:
@ -679,6 +634,25 @@ def tempfile_arg_esc_func(arg):
def configure_mingw(env: "SConsEnvironment"):
if os.getenv("MSYSTEM") == "MSYS":
print_error(
"Running from base MSYS2 console/environment, use target specific environment instead (e.g., mingw32, mingw64, clang32, clang64)."
)
sys.exit(255)
if (env_arch := detect_build_env_arch()) and env["arch"] != env_arch:
print_error(
f"Arch argument ({env['arch']}) is not matching MSYS2 console/environment that is being used to run SCons ({env_arch}).\n"
"Run SCons again without arch argument (example: scons p=windows) and SCons will attempt to detect what MSYS2 compiler will be executed and inform you."
)
sys.exit(255)
if not try_cmd("gcc --version", env["mingw_prefix"], env["arch"]) and not try_cmd(
"clang --version", env["mingw_prefix"], env["arch"]
):
print_error("No valid compilers found, use MINGW_PREFIX environment variable to set MinGW path.")
sys.exit(255)
# Workaround for MinGW. See:
# https://www.scons.org/wiki/LongCmdLinesOnWin32
env.use_windows_spawn_fix()
@ -795,6 +769,11 @@ def configure_mingw(env: "SConsEnvironment"):
validate_win_version(env)
if env["accesskit"]:
if int(env["target_win_version"], 16) < 0x0602:
print_info("AcceeKit enabled, targeted Windows version changed to Windows 8 (0x602).")
env["target_win_version"] = "0x0602" # Accessibility API require Windows 8+
if not env["use_llvm"]:
env.Append(CCFLAGS=["-mwindows"])
@ -859,6 +838,38 @@ def configure_mingw(env: "SConsEnvironment"):
]
)
if env["accesskit"]:
if env["accesskit_sdk_path"] != "":
env.Prepend(CPPPATH=[env["accesskit_sdk_path"] + "/include"])
if env["use_llvm"]:
if env["arch"] == "arm64":
env.Append(LIBPATH=[env["accesskit_sdk_path"] + "/lib/windows/arm64/mingw-llvm/static/"])
elif env["arch"] == "x86_64":
env.Append(LIBPATH=[env["accesskit_sdk_path"] + "/lib/windows/x86_64/mingw-llvm/static/"])
elif env["arch"] == "x86_32":
env.Append(LIBPATH=[env["accesskit_sdk_path"] + "/lib/windows/x86/mingw-llvm/static/"])
else:
if env["arch"] == "x86_64":
env.Append(LIBPATH=[env["accesskit_sdk_path"] + "/lib/windows/x86_64/mingw/static/"])
elif env["arch"] == "x86_32":
env.Append(LIBPATH=[env["accesskit_sdk_path"] + "/lib/windows/x86/mingw/static/"])
env.Append(
LIBS=[
"accesskit",
"uiautomationcore." + env["arch"],
"runtimeobject",
"propsys",
"oleaut32",
"user32",
"userenv",
"ntdll",
]
)
else:
env.Append(CPPDEFINES=["ACCESSKIT_DYNAMIC"])
env.Append(LIBPATH=["#platform/windows"])
env.Append(CPPDEFINES=["ACCESSKIT_ENABLED"])
if env.debug_features:
env.Append(LIBS=["psapi", "dbghelp"])
@ -900,10 +911,13 @@ def configure_mingw(env: "SConsEnvironment"):
]
)
env.Append(LIBS=["dxgi", "d3d9", "d3d11"])
env.Prepend(CPPPATH=["#thirdparty/angle/include"])
env.Prepend(CPPEXTPATH=["#thirdparty/angle/include"])
env.Append(CPPDEFINES=["MINGW_ENABLED", ("MINGW_HAS_SECURE_API", 1)])
# dlltool
env.Append(BUILDERS={"DEF": env.Builder(action=build_def_file, suffix=".a", src_suffix=".def")})
def configure(env: "SConsEnvironment"):
# Validate arch.
@ -913,28 +927,10 @@ def configure(env: "SConsEnvironment"):
# At this point the env has been set up with basic tools/compilers.
env.Prepend(CPPPATH=["#platform/windows"])
if os.name == "nt":
env["ENV"] = os.environ # this makes build less repeatable, but simplifies some things
env["ENV"]["TMP"] = os.environ["TMP"]
# First figure out which compiler, version, and target arch we're using
if os.getenv("VCINSTALLDIR") and detect_build_env_arch() and not env["use_mingw"]:
setup_msvc_manual(env)
env.msvc = True
vcvars_msvc_config = True
elif env.get("MSVC_VERSION", "") and not env["use_mingw"]:
setup_msvc_auto(env)
env.msvc = True
vcvars_msvc_config = False
else:
setup_mingw(env)
env.msvc = False
# Now set compiler/linker flags
env.msvc = "mingw" not in env["TOOLS"]
if env.msvc:
configure_msvc(env, vcvars_msvc_config)
else: # MinGW
configure_msvc(env)
else:
configure_mingw(env)

File diff suppressed because it is too large Load diff

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef DISPLAY_SERVER_WINDOWS_H
#define DISPLAY_SERVER_WINDOWS_H
#pragma once
#include "crash_handler_windows.h"
#include "joypad_windows.h"
@ -367,7 +366,7 @@ class DropTargetWindows;
#endif
class DisplayServerWindows : public DisplayServer {
// No need to register with GDCLASS, it's platform-specific and nothing is added.
GDSOFTCLASS(DisplayServerWindows, DisplayServer);
friend class DropTargetWindows;
@ -460,6 +459,7 @@ class DisplayServerWindows : public DisplayServer {
String rendering_driver;
bool app_focused = false;
bool keep_screen_on = false;
bool get_object_recieved = false;
HANDLE power_request;
TTS_Windows *tts = nullptr;
@ -467,6 +467,7 @@ class DisplayServerWindows : public DisplayServer {
struct WindowData {
HWND hWnd;
WindowID id;
Vector<Vector2> mpath;
@ -480,6 +481,8 @@ class DisplayServerWindows : public DisplayServer {
bool multiwindow_fs = false;
bool borderless = false;
bool resizable = true;
bool no_min_btn = false;
bool no_max_btn = false;
bool window_focused = false;
int activate_state = 0;
bool was_maximized_pre_fs = false;
@ -618,7 +621,7 @@ class DisplayServerWindows : public DisplayServer {
HashMap<int64_t, Vector2> pointer_last_pos;
void _send_window_event(const WindowData &wd, WindowEvent p_event);
void _get_window_style(bool p_main_window, bool p_initialized, bool p_fullscreen, bool p_multiwindow_fs, bool p_borderless, bool p_resizable, bool p_minimized, bool p_maximized, bool p_maximized_fs, bool p_no_activate_focus, bool p_embed_child, DWORD &r_style, DWORD &r_style_ex);
void _get_window_style(bool p_main_window, bool p_initialized, bool p_fullscreen, bool p_multiwindow_fs, bool p_borderless, bool p_resizable, bool p_no_min_btn, bool p_no_max_btn, bool p_minimized, bool p_maximized, bool p_maximized_fs, bool p_no_activate_focus, bool p_embed_child, DWORD &r_style, DWORD &r_style_ex);
MouseMode mouse_mode;
MouseMode mouse_mode_base = MOUSE_MODE_VISIBLE;
@ -654,6 +657,7 @@ class DisplayServerWindows : public DisplayServer {
void _set_mouse_mode_impl(MouseMode p_mode);
WindowID _get_focused_window_or_popup() const;
void _register_raw_input_devices(WindowID p_target_window);
bool _has_moving_window() const;
void _process_activate_event(WindowID p_window_id);
void _process_key_events();
@ -673,7 +677,7 @@ class DisplayServerWindows : public DisplayServer {
};
BitField<WinKeyModifierMask> _get_mods() const;
Error _file_dialog_with_options_show(const String &p_title, const String &p_current_directory, const String &p_root, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const TypedArray<Dictionary> &p_options, const Callable &p_callback, bool p_options_in_cb);
Error _file_dialog_with_options_show(const String &p_title, const String &p_current_directory, const String &p_root, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const TypedArray<Dictionary> &p_options, const Callable &p_callback, bool p_options_in_cb, WindowID p_window_id);
String _get_keyboard_layout_display_name(const String &p_klid) const;
String _get_klid(HKL p_hkl) const;
@ -687,6 +691,8 @@ class DisplayServerWindows : public DisplayServer {
HWND _find_window_from_process_id(OS::ProcessID p_pid, HWND p_current_hwnd);
void initialize_tts() const;
public:
LRESULT WndProcFileDialog(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
@ -713,8 +719,8 @@ public:
virtual Color get_base_color() const override;
virtual void set_system_theme_change_callback(const Callable &p_callable) override;
virtual Error file_dialog_show(const String &p_title, const String &p_current_directory, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const Callable &p_callback) override;
virtual Error file_dialog_with_options_show(const String &p_title, const String &p_current_directory, const String &p_root, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const TypedArray<Dictionary> &p_options, const Callable &p_callback) override;
virtual Error file_dialog_show(const String &p_title, const String &p_current_directory, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const Callable &p_callback, WindowID p_window_id) override;
virtual Error file_dialog_with_options_show(const String &p_title, const String &p_current_directory, const String &p_root, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const TypedArray<Dictionary> &p_options, const Callable &p_callback, WindowID p_window_id) override;
virtual void beep() const override;
@ -821,6 +827,11 @@ public:
virtual void window_set_ime_active(const bool p_active, WindowID p_window = MAIN_WINDOW_ID) override;
virtual void window_set_ime_position(const Point2i &p_pos, WindowID p_window = MAIN_WINDOW_ID) override;
virtual int accessibility_should_increase_contrast() const override;
virtual int accessibility_should_reduce_animation() const override;
virtual int accessibility_should_reduce_transparency() const override;
virtual int accessibility_screen_reader_active() const override;
virtual Point2i ime_get_selection() const override;
virtual String ime_get_text() const override;
@ -888,5 +899,3 @@ public:
DisplayServerWindows(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Context p_context, int64_t p_parent_window, Error &r_error);
~DisplayServerWindows();
};
#endif // DISPLAY_SERVER_WINDOWS_H

View file

@ -28,18 +28,13 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef DROP_TARGET_WINDOWS_H
#define DROP_TARGET_WINDOWS_H
#pragma once
#include "display_server_windows.h"
#include <shlobj.h>
// Silence warning due to a COM API weirdness.
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
#endif
GODOT_GCC_WARNING_PUSH_AND_IGNORE("-Wnon-virtual-dtor") // Silence warning due to a COM API weirdness.
// https://learn.microsoft.com/en-us/windows/win32/api/ole2/nf-ole2-dodragdrop#remarks
class DropTargetWindows : public IDropTarget {
@ -70,8 +65,4 @@ public:
HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) override;
};
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
#endif // DROP_TARGET_WINDOWS_H
GODOT_GCC_WARNING_POP

View file

@ -28,10 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef WINDOWS_EXPORT_H
#define WINDOWS_EXPORT_H
#pragma once
void register_windows_exporter_types();
void register_windows_exporter();
#endif // WINDOWS_EXPORT_H

View file

@ -43,6 +43,29 @@
#include "modules/svg/image_loader_svg.h"
#ifdef WINDOWS_ENABLED
#include "shlobj.h"
// Converts long path to Windows UNC format.
static String fix_path(const String &p_path) {
String path = p_path;
if (p_path.is_relative_path()) {
Char16String current_dir_name;
size_t str_len = GetCurrentDirectoryW(0, nullptr);
current_dir_name.resize(str_len + 1);
GetCurrentDirectoryW(current_dir_name.size(), (LPWSTR)current_dir_name.ptrw());
path = String::utf16((const char16_t *)current_dir_name.get_data()).trim_prefix(R"(\\?\)").replace_char('\\', '/').path_join(path);
}
path = path.simplify_path();
path = path.replace_char('/', '\\');
if (path.size() >= MAX_PATH && !path.is_network_share_path() && !path.begins_with(R"(\\?\)")) {
path = R"(\\?\)" + path;
}
return path;
}
#endif
Error EditorExportPlatformWindows::_process_icon(const Ref<EditorExportPreset> &p_preset, const String &p_src_path, const String &p_dst_path) {
static const uint8_t icon_size[] = { 16, 32, 48, 64, 128, 0 /*256*/ };
@ -96,7 +119,7 @@ Error EditorExportPlatformWindows::_process_icon(const Ref<EditorExportPreset> &
Ref<Image> src_image = _load_icon_or_splash_image(p_src_path, &err);
ERR_FAIL_COND_V(err != OK || src_image.is_null() || src_image->is_empty(), ERR_CANT_OPEN);
for (size_t i = 0; i < sizeof(icon_size) / sizeof(icon_size[0]); ++i) {
for (size_t i = 0; i < std::size(icon_size); ++i) {
int size = (icon_size[i] == 0) ? 256 : icon_size[i];
Ref<Image> res_image = src_image->duplicate();
@ -107,7 +130,7 @@ Error EditorExportPlatformWindows::_process_icon(const Ref<EditorExportPreset> &
}
uint16_t valid_icon_count = 0;
for (size_t i = 0; i < sizeof(icon_size) / sizeof(icon_size[0]); ++i) {
for (size_t i = 0; i < std::size(icon_size); ++i) {
if (images.has(icon_size[i])) {
valid_icon_count++;
} else {
@ -129,7 +152,7 @@ Error EditorExportPlatformWindows::_process_icon(const Ref<EditorExportPreset> &
// Write ICONDIRENTRY.
uint32_t img_offset = 6 + 16 * valid_icon_count;
for (size_t i = 0; i < sizeof(icon_size) / sizeof(icon_size[0]); ++i) {
for (size_t i = 0; i < std::size(icon_size); ++i) {
if (images.has(icon_size[i])) {
const IconData &di = images[icon_size[i]];
fw->store_8(icon_size[i]); // Width in pixels.
@ -146,7 +169,7 @@ Error EditorExportPlatformWindows::_process_icon(const Ref<EditorExportPreset> &
}
// Write image data.
for (size_t i = 0; i < sizeof(icon_size) / sizeof(icon_size[0]); ++i) {
for (size_t i = 0; i < std::size(icon_size); ++i) {
if (images.has(icon_size[i])) {
const IconData &di = images[icon_size[i]];
fw->store_buffer(di.data.ptr(), di.data.size());
@ -195,8 +218,8 @@ Error EditorExportPlatformWindows::export_project(const Ref<EditorExportPreset>
bool embedded = p_preset->get("binary_format/embed_pck");
String pkg_name;
if (String(ProjectSettings::get_singleton()->get("application/config/name")) != "") {
pkg_name = String(ProjectSettings::get_singleton()->get("application/config/name"));
if (String(get_project_setting(p_preset, "application/config/name")) != "") {
pkg_name = String(get_project_setting(p_preset, "application/config/name"));
} else {
pkg_name = "Unnamed";
}
@ -221,15 +244,15 @@ Error EditorExportPlatformWindows::export_project(const Ref<EditorExportPreset>
path = tmp_dir_path.path_join(p_path.get_file().get_basename() + ".exe");
}
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
int export_angle = p_preset->get("application/export_angle");
bool include_angle_libs = false;
if (export_angle == 0) {
include_angle_libs = (String(GLOBAL_GET("rendering/gl_compatibility/driver.windows")) == "opengl3_angle") && (String(GLOBAL_GET("rendering/renderer/rendering_method")) == "gl_compatibility");
include_angle_libs = (String(get_project_setting(p_preset, "rendering/gl_compatibility/driver.windows")) == "opengl3_angle") && (String(get_project_setting(p_preset, "rendering/renderer/rendering_method")) == "gl_compatibility");
} else if (export_angle == 1) {
include_angle_libs = true;
}
if (include_angle_libs) {
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
if (da->file_exists(template_path.get_base_dir().path_join("libEGL." + arch + ".dll"))) {
da->copy(template_path.get_base_dir().path_join("libEGL." + arch + ".dll"), path.get_base_dir().path_join("libEGL.dll"), get_chmod_flags());
}
@ -237,17 +260,19 @@ Error EditorExportPlatformWindows::export_project(const Ref<EditorExportPreset>
da->copy(template_path.get_base_dir().path_join("libGLESv2." + arch + ".dll"), path.get_base_dir().path_join("libGLESv2.dll"), get_chmod_flags());
}
}
if (da->file_exists(template_path.get_base_dir().path_join("accesskit." + arch + ".dll"))) {
da->copy(template_path.get_base_dir().path_join("accesskit." + arch + ".dll"), path.get_base_dir().path_join("accesskit." + arch + ".dll"), get_chmod_flags());
}
int export_d3d12 = p_preset->get("application/export_d3d12");
bool agility_sdk_multiarch = p_preset->get("application/d3d12_agility_sdk_multiarch");
bool include_d3d12_extra_libs = false;
if (export_d3d12 == 0) {
include_d3d12_extra_libs = (String(GLOBAL_GET("rendering/rendering_device/driver.windows")) == "d3d12") && (String(GLOBAL_GET("rendering/renderer/rendering_method")) != "gl_compatibility");
include_d3d12_extra_libs = (String(get_project_setting(p_preset, "rendering/rendering_device/driver.windows")) == "d3d12") && (String(get_project_setting(p_preset, "rendering/renderer/rendering_method")) != "gl_compatibility");
} else if (export_d3d12 == 1) {
include_d3d12_extra_libs = true;
}
if (include_d3d12_extra_libs) {
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
if (da->file_exists(template_path.get_base_dir().path_join("D3D12Core." + arch + ".dll"))) {
if (agility_sdk_multiarch) {
da->make_dir_recursive(path.get_base_dir().path_join(arch));
@ -316,6 +341,23 @@ Error EditorExportPlatformWindows::export_project(const Ref<EditorExportPreset>
tmp_app_dir->change_dir("..");
tmp_app_dir->remove(pkg_name);
}
#ifdef WINDOWS_ENABLED
} else {
// Update Windows icon cache.
String w_path = fix_path(path);
SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH, (LPCWSTR)w_path.utf16().get_data(), nullptr);
String wrapper_path = path.get_basename() + ".console.exe";
if (FileAccess::exists(wrapper_path)) {
String w_wrapper_path = fix_path(wrapper_path);
SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH, (LPCWSTR)w_wrapper_path.utf16().get_data(), nullptr);
}
w_path = fix_path(path.get_base_dir());
SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH, (LPCWSTR)w_path.utf16().get_data(), nullptr);
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nullptr, nullptr);
#endif
}
return err;
@ -489,10 +531,10 @@ Error EditorExportPlatformWindows::_rcedit_add_data(const Ref<EditorExportPreset
String icon_path;
if (p_preset->get("application/icon") != "") {
icon_path = p_preset->get("application/icon");
} else if (GLOBAL_GET("application/config/windows_native_icon") != "") {
icon_path = GLOBAL_GET("application/config/windows_native_icon");
} else if (get_project_setting(p_preset, "application/config/windows_native_icon") != "") {
icon_path = get_project_setting(p_preset, "application/config/windows_native_icon");
} else {
icon_path = GLOBAL_GET("application/config/icon");
icon_path = get_project_setting(p_preset, "application/config/icon");
}
icon_path = ProjectSettings::get_singleton()->globalize_path(icon_path);

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef WINDOWS_EXPORT_PLUGIN_H
#define WINDOWS_EXPORT_PLUGIN_H
#pragma once
#include "core/io/file_access.h"
#include "core/os/os.h"
@ -100,5 +99,3 @@ public:
EditorExportPlatformWindows();
};
#endif // WINDOWS_EXPORT_PLUGIN_H

View file

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><path fill="#00abed" d="m1 5.132 12.295-1.694v11.879H1zm0 21.736 12.295 1.695V16.83H1zm13.647 1.875L31 31V16.83H14.647zm0-25.486v12.06H31V1z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><path fill="#00abed" d="m1 5.132 12.295-1.694v11.879H1zm0 21.736 12.295 1.695V16.83H1zm13.647 1.875L31 31V16.83H14.647zm0-25.486v12.06H31V1z"/></svg>

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 213 B

Before After
Before After

View file

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="16" height="16"><path fill="#e0e0e0" d="m1.095 2.997 5.66-.78v5.469h-5.66zm0 10.006 5.66.78v-5.4h-5.66zm6.282.863 7.528 1.04V8.381H7.377Zm0-11.732v5.552h7.528V1.095Z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="16" height="16"><path fill="#e0e0e0" d="m1.095 2.997 5.66-.78v5.469h-5.66zm0 10.006 5.66.78v-5.4h-5.66zm6.282.863 7.528 1.04V8.381H7.377Zm0-11.732v5.552h7.528V1.095Z"/></svg>

Before

Width:  |  Height:  |  Size: 242 B

After

Width:  |  Height:  |  Size: 243 B

Before After
Before After

View file

@ -28,12 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GL_MANAGER_WINDOWS_ANGLE_H
#define GL_MANAGER_WINDOWS_ANGLE_H
#pragma once
#if defined(WINDOWS_ENABLED) && defined(GLES3_ENABLED)
#include "core/error/error_list.h"
#include "core/os/os.h"
#include "core/templates/local_vector.h"
#include "drivers/egl/egl_manager.h"
@ -57,5 +55,3 @@ public:
};
#endif // WINDOWS_ENABLED && GLES3_ENABLED
#endif // GL_MANAGER_WINDOWS_ANGLE_H

View file

@ -170,7 +170,7 @@ void GLManagerNative_Windows::_nvapi_setup_profile() {
// We need a name anyways, so let's use the engine name if an application name is not available
// (this is used mostly by the Project Manager)
if (app_profile_name.is_empty()) {
app_profile_name = VERSION_NAME;
app_profile_name = GODOT_VERSION_NAME;
}
String old_profile_name = app_profile_name + " Nvidia Profile";
Char16String app_profile_name_u16 = app_profile_name.utf16();

View file

@ -28,12 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GL_MANAGER_WINDOWS_NATIVE_H
#define GL_MANAGER_WINDOWS_NATIVE_H
#pragma once
#if defined(WINDOWS_ENABLED) && defined(GLES3_ENABLED)
#include "core/error/error_list.h"
#include "core/os/os.h"
#include "core/templates/local_vector.h"
#include "servers/display_server.h"
@ -105,5 +103,3 @@ public:
};
#endif // WINDOWS_ENABLED && GLES3_ENABLED
#endif // GL_MANAGER_WINDOWS_NATIVE_H

View file

@ -8,8 +8,8 @@ GODOT_ICON ICON platform/windows/godot.ico
1 RT_MANIFEST "godot.manifest"
1 VERSIONINFO
FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,0
PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,0
FILEVERSION GODOT_VERSION_MAJOR,GODOT_VERSION_MINOR,GODOT_VERSION_PATCH,0
PRODUCTVERSION GODOT_VERSION_MAJOR,GODOT_VERSION_MINOR,GODOT_VERSION_PATCH,0
FILEOS 4
FILETYPE 1
BEGIN
@ -18,13 +18,13 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Godot Engine"
VALUE "FileDescription", VERSION_NAME
VALUE "FileVersion", VERSION_NUMBER
VALUE "ProductName", VERSION_NAME
VALUE "FileDescription", GODOT_VERSION_NAME
VALUE "FileVersion", GODOT_VERSION_NUMBER
VALUE "ProductName", GODOT_VERSION_NAME
VALUE "Licence", "MIT"
VALUE "LegalCopyright", "(c) 2007-present Juan Linietsky, Ariel Manzur and Godot Engine contributors"
VALUE "Info", "https://godotengine.org"
VALUE "ProductVersion", VERSION_FULL_BUILD
VALUE "ProductVersion", GODOT_VERSION_FULL_BUILD
END
END
BLOCK "VarFileInfo"

View file

@ -8,8 +8,8 @@ GODOT_ICON ICON platform/windows/godot_console.ico
1 RT_MANIFEST "godot.manifest"
1 VERSIONINFO
FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,0
PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,0
FILEVERSION GODOT_VERSION_MAJOR,GODOT_VERSION_MINOR,GODOT_VERSION_PATCH,0
PRODUCTVERSION GODOT_VERSION_MAJOR,GODOT_VERSION_MINOR,GODOT_VERSION_PATCH,0
FILEOS 4
FILETYPE 1
BEGIN
@ -18,13 +18,13 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Godot Engine"
VALUE "FileDescription", VERSION_NAME " (Console)"
VALUE "FileVersion", VERSION_NUMBER
VALUE "ProductName", VERSION_NAME " (Console)"
VALUE "FileDescription", GODOT_VERSION_NAME " (Console)"
VALUE "FileVersion", GODOT_VERSION_NUMBER
VALUE "ProductName", GODOT_VERSION_NAME " (Console)"
VALUE "Licence", "MIT"
VALUE "LegalCopyright", "(c) 2007-present Juan Linietsky, Ariel Manzur and Godot Engine contributors"
VALUE "Info", "https://godotengine.org"
VALUE "ProductVersion", VERSION_FULL_BUILD
VALUE "ProductVersion", GODOT_VERSION_FULL_BUILD
END
END
BLOCK "VarFileInfo"

View file

@ -479,7 +479,7 @@ void JoypadWindows::process_joypads() {
}
void JoypadWindows::post_hat(int p_device, DWORD p_dpad) {
BitField<HatMask> dpad_val;
BitField<HatMask> dpad_val = HatMask::CENTER;
// Should be -1 when centered, but according to docs:
// "Some drivers report the centered position of the POV indicator as 65,535. Determine whether the indicator is centered as follows:

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef JOYPAD_WINDOWS_H
#define JOYPAD_WINDOWS_H
#pragma once
#include "os_windows.h"
@ -148,5 +147,3 @@ private:
XInputSetState_t xinput_set_state;
joyGetDevCaps_t winmm_get_joycaps; // Only for reading info on XInput joypads.
};
#endif // JOYPAD_WINDOWS_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef KEY_MAPPING_WINDOWS_H
#define KEY_MAPPING_WINDOWS_H
#pragma once
#include "core/os/keyboard.h"
@ -49,5 +48,3 @@ public:
static bool is_extended_key(unsigned int p_code);
static KeyLocation get_location(unsigned int p_code, bool p_extended);
};
#endif // KEY_MAPPING_WINDOWS_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef LANG_TABLE_H
#define LANG_TABLE_H
#pragma once
struct _WinLocale {
const char *locale;
@ -187,5 +186,3 @@ static const _WinLocale _win_locales[] = {
{ "zh_TW", LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL },
{ 0, 0, 0 },
};
#endif // LANG_TABLE_H

View file

@ -12,9 +12,13 @@ def get_configurations():
def get_build_prefix(env):
if not env.msvc:
return []
batch_file = methods.find_visual_c_batch_file(env)
return [
"cmd /V /C",
"set &quot;plat=$(PlatformTarget)&quot;",
"(if &quot;$(PlatformTarget)&quot;==&quot;x64&quot; (set &quot;plat=x86_amd64&quot;))",
f"call &quot;{batch_file}&quot; !plat!",
"^&amp; (if &quot;$(PlatformTarget)&quot;==&quot;x64&quot; (set &quot;plat=x86_amd64&quot;))",
f"^&amp; call &quot;{batch_file}&quot; !plat!",
"^&amp;",
]

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef NATIVE_MENU_WINDOWS_H
#define NATIVE_MENU_WINDOWS_H
#pragma once
#include "core/io/image.h"
#include "core/templates/hash_map.h"
@ -153,5 +152,3 @@ public:
NativeMenuWindows();
~NativeMenuWindows();
};
#endif // NATIVE_MENU_WINDOWS_H

View file

@ -113,10 +113,10 @@ static String fix_path(const String &p_path) {
size_t str_len = GetCurrentDirectoryW(0, nullptr);
current_dir_name.resize(str_len + 1);
GetCurrentDirectoryW(current_dir_name.size(), (LPWSTR)current_dir_name.ptrw());
path = String::utf16((const char16_t *)current_dir_name.get_data()).trim_prefix(R"(\\?\)").replace("\\", "/").path_join(path);
path = String::utf16((const char16_t *)current_dir_name.get_data()).trim_prefix(R"(\\?\)").replace_char('\\', '/').path_join(path);
}
path = path.simplify_path();
path = path.replace("/", "\\");
path = path.replace_char('/', '\\');
if (path.size() >= MAX_PATH && !path.is_network_share_path() && !path.begins_with(R"(\\?\)")) {
path = R"(\\?\)" + path;
}
@ -132,7 +132,7 @@ static String format_error_message(DWORD id) {
LocalFree(messageBuffer);
return msg.replace("\r", "").replace("\n", "");
return msg.remove_chars("\r\n");
}
void RedirectStream(const char *p_file_name, const char *p_mode, FILE *p_cpp_stream, const DWORD p_std_handle) {
@ -195,7 +195,7 @@ bool OS_Windows::is_using_con_wrapper() const {
WCHAR proc_name[MAX_PATH];
DWORD len = MAX_PATH;
if (QueryFullProcessImageNameW(process, 0, &proc_name[0], &len)) {
String name = String::utf16((const char16_t *)&proc_name[0], len).replace("\\", "/").to_lower();
String name = String::utf16((const char16_t *)&proc_name[0], len).replace_char('\\', '/').to_lower();
if (name == exe_name) {
found_exe = true;
}
@ -787,7 +787,7 @@ bool OS_Windows::get_user_prefers_integrated_gpu() const {
GetCurrentApplicationUserModelIdPtr GetCurrentApplicationUserModelId = (GetCurrentApplicationUserModelIdPtr)(void *)GetProcAddress(kernel32, "GetCurrentApplicationUserModelId");
if (GetCurrentApplicationUserModelId) {
UINT32 length = sizeof(value_name) / sizeof(value_name[0]);
UINT32 length = std::size(value_name);
LONG result = GetCurrentApplicationUserModelId(&length, value_name);
if (result == ERROR_SUCCESS) {
is_packaged = true;
@ -966,13 +966,211 @@ static void _append_to_pipe(char *p_bytes, int p_size, String *r_pipe, Mutex *p_
// Let's hope it's compatible with UTF-8.
(*r_pipe) += String::utf8(p_bytes, p_size);
} else {
(*r_pipe) += String(wchars.ptr(), total_wchars);
(*r_pipe) += String::utf16((char16_t *)wchars.ptr(), total_wchars);
}
if (p_pipe_mutex) {
p_pipe_mutex->unlock();
}
}
void OS_Windows::_init_encodings() {
encodings[""] = 0;
encodings["CP_ACP"] = 0;
encodings["CP_OEMCP"] = 1;
encodings["CP_MACCP"] = 2;
encodings["CP_THREAD_ACP"] = 3;
encodings["CP_SYMBOL"] = 42;
encodings["IBM037"] = 37;
encodings["IBM437"] = 437;
encodings["IBM500"] = 500;
encodings["ASMO-708"] = 708;
encodings["ASMO-449"] = 709;
encodings["DOS-710"] = 710;
encodings["DOS-720"] = 720;
encodings["IBM737"] = 737;
encodings["IBM775"] = 775;
encodings["IBM850"] = 850;
encodings["IBM852"] = 852;
encodings["IBM855"] = 855;
encodings["IBM857"] = 857;
encodings["IBM00858"] = 858;
encodings["IBM860"] = 860;
encodings["IBM861"] = 861;
encodings["DOS-862"] = 862;
encodings["IBM863"] = 863;
encodings["IBM864"] = 864;
encodings["IBM865"] = 865;
encodings["CP866"] = 866;
encodings["IBM869"] = 869;
encodings["IBM870"] = 870;
encodings["WINDOWS-874"] = 874;
encodings["CP875"] = 875;
encodings["SHIFT_JIS"] = 932;
encodings["GB2312"] = 936;
encodings["KS_C_5601-1987"] = 949;
encodings["BIG5"] = 950;
encodings["IBM1026"] = 1026;
encodings["IBM01047"] = 1047;
encodings["IBM01140"] = 1140;
encodings["IBM01141"] = 1141;
encodings["IBM01142"] = 1142;
encodings["IBM01143"] = 1143;
encodings["IBM01144"] = 1144;
encodings["IBM01145"] = 1145;
encodings["IBM01146"] = 1146;
encodings["IBM01147"] = 1147;
encodings["IBM01148"] = 1148;
encodings["IBM01149"] = 1149;
encodings["UTF-16"] = 1200;
encodings["UNICODEFFFE"] = 1201;
encodings["WINDOWS-1250"] = 1250;
encodings["WINDOWS-1251"] = 1251;
encodings["WINDOWS-1252"] = 1252;
encodings["WINDOWS-1253"] = 1253;
encodings["WINDOWS-1254"] = 1254;
encodings["WINDOWS-1255"] = 1255;
encodings["WINDOWS-1256"] = 1256;
encodings["WINDOWS-1257"] = 1257;
encodings["WINDOWS-1258"] = 1258;
encodings["JOHAB"] = 1361;
encodings["MACINTOSH"] = 10000;
encodings["X-MAC-JAPANESE"] = 10001;
encodings["X-MAC-CHINESETRAD"] = 10002;
encodings["X-MAC-KOREAN"] = 10003;
encodings["X-MAC-ARABIC"] = 10004;
encodings["X-MAC-HEBREW"] = 10005;
encodings["X-MAC-GREEK"] = 10006;
encodings["X-MAC-CYRILLIC"] = 10007;
encodings["X-MAC-CHINESESIMP"] = 10008;
encodings["X-MAC-ROMANIAN"] = 10010;
encodings["X-MAC-UKRAINIAN"] = 10017;
encodings["X-MAC-THAI"] = 10021;
encodings["X-MAC-CE"] = 10029;
encodings["X-MAC-ICELANDIC"] = 10079;
encodings["X-MAC-TURKISH"] = 10081;
encodings["X-MAC-CROATIAN"] = 10082;
encodings["UTF-32"] = 12000;
encodings["UTF-32BE"] = 12001;
encodings["X-CHINESE_CNS"] = 20000;
encodings["X-CP20001"] = 20001;
encodings["X_CHINESE-ETEN"] = 20002;
encodings["X-CP20003"] = 20003;
encodings["X-CP20004"] = 20004;
encodings["X-CP20005"] = 20005;
encodings["X-IA5"] = 20105;
encodings["X-IA5-GERMAN"] = 20106;
encodings["X-IA5-SWEDISH"] = 20107;
encodings["X-IA5-NORWEGIAN"] = 20108;
encodings["US-ASCII"] = 20127;
encodings["X-CP20261"] = 20261;
encodings["X-CP20269"] = 20269;
encodings["IBM273"] = 20273;
encodings["IBM277"] = 20277;
encodings["IBM278"] = 20278;
encodings["IBM280"] = 20280;
encodings["IBM284"] = 20284;
encodings["IBM285"] = 20285;
encodings["IBM290"] = 20290;
encodings["IBM297"] = 20297;
encodings["IBM420"] = 20420;
encodings["IBM423"] = 20423;
encodings["IBM424"] = 20424;
encodings["X-EBCDIC-KOREANEXTENDED"] = 20833;
encodings["IBM-THAI"] = 20838;
encodings["KOI8-R"] = 20866;
encodings["IBM871"] = 20871;
encodings["IBM880"] = 20880;
encodings["IBM905"] = 20905;
encodings["IBM00924"] = 20924;
encodings["EUC-JP"] = 20932;
encodings["X-CP20936"] = 20936;
encodings["X-CP20949"] = 20949;
encodings["CP1025"] = 21025;
encodings["KOI8-U"] = 21866;
encodings["ISO-8859-1"] = 28591;
encodings["ISO-8859-2"] = 28592;
encodings["ISO-8859-3"] = 28593;
encodings["ISO-8859-4"] = 28594;
encodings["ISO-8859-5"] = 28595;
encodings["ISO-8859-6"] = 28596;
encodings["ISO-8859-7"] = 28597;
encodings["ISO-8859-8"] = 28598;
encodings["ISO-8859-9"] = 28599;
encodings["ISO-8859-13"] = 28603;
encodings["ISO-8859-15"] = 28605;
encodings["X-EUROPA"] = 29001;
encodings["ISO-8859-8-I"] = 38598;
encodings["ISO-2022-JP"] = 50220;
encodings["CSISO2022JP"] = 50221;
encodings["ISO-2022-JP"] = 50222;
encodings["ISO-2022-KR"] = 50225;
encodings["X-CP50227"] = 50227;
encodings["EBCDIC-JP"] = 50930;
encodings["EBCDIC-US-JP"] = 50931;
encodings["EBCDIC-KR"] = 50933;
encodings["EBCDIC-CN-eXT"] = 50935;
encodings["EBCDIC-CN"] = 50936;
encodings["EBCDIC-US-CN"] = 50937;
encodings["EBCDIC-JP-EXT"] = 50939;
encodings["EUC-JP"] = 51932;
encodings["EUC-CN"] = 51936;
encodings["EUC-KR"] = 51949;
encodings["HZ-GB-2312"] = 52936;
encodings["GB18030"] = 54936;
encodings["X-ISCII-DE"] = 57002;
encodings["X-ISCII-BE"] = 57003;
encodings["X-ISCII-TA"] = 57004;
encodings["X-ISCII-TE"] = 57005;
encodings["X-ISCII-AS"] = 57006;
encodings["X-ISCII-OR"] = 57007;
encodings["X-ISCII-KA"] = 57008;
encodings["X-ISCII-MA"] = 57009;
encodings["X-ISCII-GU"] = 57010;
encodings["X-ISCII-PA"] = 57011;
encodings["UTF-7"] = 65000;
encodings["UTF-8"] = 65001;
}
String OS_Windows::multibyte_to_string(const String &p_encoding, const PackedByteArray &p_array) const {
const int *encoding = encodings.getptr(p_encoding.to_upper());
ERR_FAIL_NULL_V_MSG(encoding, String(), "Conversion failed: Unknown encoding");
LocalVector<wchar_t> wchars;
int total_wchars = MultiByteToWideChar(*encoding, 0, (const char *)p_array.ptr(), p_array.size(), nullptr, 0);
if (total_wchars == 0) {
DWORD err_code = GetLastError();
ERR_FAIL_V_MSG(String(), vformat("Conversion failed: %s", format_error_message(err_code)));
}
wchars.resize(total_wchars);
if (MultiByteToWideChar(*encoding, 0, (const char *)p_array.ptr(), p_array.size(), wchars.ptr(), total_wchars) == 0) {
DWORD err_code = GetLastError();
ERR_FAIL_V_MSG(String(), vformat("Conversion failed: %s", format_error_message(err_code)));
}
return String::utf16((const char16_t *)wchars.ptr(), wchars.size());
}
PackedByteArray OS_Windows::string_to_multibyte(const String &p_encoding, const String &p_string) const {
const int *encoding = encodings.getptr(p_encoding.to_upper());
ERR_FAIL_NULL_V_MSG(encoding, PackedByteArray(), "Conversion failed: Unknown encoding");
Char16String charstr = p_string.utf16();
PackedByteArray ret;
int total_mbchars = WideCharToMultiByte(*encoding, 0, (const wchar_t *)charstr.ptr(), charstr.size(), nullptr, 0, nullptr, nullptr);
if (total_mbchars == 0) {
DWORD err_code = GetLastError();
ERR_FAIL_V_MSG(PackedByteArray(), vformat("Conversion failed: %s", format_error_message(err_code)));
}
ret.resize(total_mbchars);
if (WideCharToMultiByte(*encoding, 0, (const wchar_t *)charstr.ptr(), charstr.size(), (char *)ret.ptrw(), ret.size(), nullptr, nullptr) == 0) {
DWORD err_code = GetLastError();
ERR_FAIL_V_MSG(PackedByteArray(), vformat("Conversion failed: %s", format_error_message(err_code)));
}
return ret;
}
Dictionary OS_Windows::get_memory_info() const {
Dictionary meminfo;
@ -1456,10 +1654,7 @@ Vector<String> OS_Windows::get_system_fonts() const {
return ret;
}
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
#endif
GODOT_GCC_WARNING_PUSH_AND_IGNORE("-Wnon-virtual-dtor") // Silence warning due to a COM API weirdness.
class FallbackTextAnalysisSource : public IDWriteTextAnalysisSource {
LONG _cRef = 1;
@ -1543,9 +1738,7 @@ public:
virtual ~FallbackTextAnalysisSource() {}
};
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
GODOT_GCC_WARNING_POP
String OS_Windows::_get_default_fontname(const String &p_font_name) const {
String font_name = p_font_name;
@ -1686,7 +1879,7 @@ Vector<String> OS_Windows::get_system_font_path_for_text(const String &p_font_na
if (FAILED(hr)) {
continue;
}
String fpath = String::utf16((const char16_t *)&file_path[0]).replace("\\", "/");
String fpath = String::utf16((const char16_t *)&file_path[0]).replace_char('\\', '/');
WIN32_FIND_DATAW d;
HANDLE fnd = FindFirstFileW((LPCWSTR)&file_path[0], &d);
@ -1765,7 +1958,7 @@ String OS_Windows::get_system_font_path(const String &p_font_name, int p_weight,
if (FAILED(hr)) {
continue;
}
String fpath = String::utf16((const char16_t *)&file_path[0]).replace("\\", "/");
String fpath = String::utf16((const char16_t *)&file_path[0]).replace_char('\\', '/');
WIN32_FIND_DATAW d;
HANDLE fnd = FindFirstFileW((LPCWSTR)&file_path[0], &d);
@ -1785,7 +1978,7 @@ String OS_Windows::get_system_font_path(const String &p_font_name, int p_weight,
String OS_Windows::get_executable_path() const {
WCHAR bufname[4096];
GetModuleFileNameW(nullptr, bufname, 4096);
String s = String::utf16((const char16_t *)bufname).replace("\\", "/");
String s = String::utf16((const char16_t *)bufname).replace_char('\\', '/');
return s;
}
@ -2002,14 +2195,14 @@ String OS_Windows::get_locale() const {
}
if (lang == wl->main_lang && sublang == wl->sublang) {
return String(wl->locale).replace("-", "_");
return String(wl->locale).replace_char('-', '_');
}
wl++;
}
if (!neutral.is_empty()) {
return String(neutral).replace("-", "_");
return String(neutral).replace_char('-', '_');
}
return "en";
@ -2138,7 +2331,7 @@ uint64_t OS_Windows::get_embedded_pck_offset() const {
String OS_Windows::get_config_path() const {
if (has_environment("APPDATA")) {
return get_environment("APPDATA").replace("\\", "/");
return get_environment("APPDATA").replace_char('\\', '/');
}
return ".";
}
@ -2151,7 +2344,7 @@ String OS_Windows::get_cache_path() const {
static String cache_path_cache;
if (cache_path_cache.is_empty()) {
if (has_environment("LOCALAPPDATA")) {
cache_path_cache = get_environment("LOCALAPPDATA").replace("\\", "/");
cache_path_cache = get_environment("LOCALAPPDATA").replace_char('\\', '/');
}
if (cache_path_cache.is_empty()) {
cache_path_cache = get_temp_path();
@ -2181,12 +2374,12 @@ String OS_Windows::get_temp_path() const {
temp_path_cache = get_config_path();
}
}
return temp_path_cache.replace("\\", "/").trim_suffix("/");
return temp_path_cache.replace_char('\\', '/').trim_suffix("/");
}
// Get properly capitalized engine name for system paths
String OS_Windows::get_godot_dir_name() const {
return String(VERSION_SHORT_NAME).capitalize();
return String(GODOT_VERSION_SHORT_NAME).capitalize();
}
String OS_Windows::get_system_dir(SystemDir p_dir, bool p_shared_storage) const {
@ -2222,19 +2415,19 @@ String OS_Windows::get_system_dir(SystemDir p_dir, bool p_shared_storage) const
PWSTR szPath;
HRESULT res = SHGetKnownFolderPath(id, 0, nullptr, &szPath);
ERR_FAIL_COND_V(res != S_OK, String());
String path = String::utf16((const char16_t *)szPath).replace("\\", "/");
String path = String::utf16((const char16_t *)szPath).replace_char('\\', '/');
CoTaskMemFree(szPath);
return path;
}
String OS_Windows::get_user_data_dir(const String &p_user_dir) const {
return get_data_path().path_join(p_user_dir).replace("\\", "/");
return get_data_path().path_join(p_user_dir).replace_char('\\', '/');
}
String OS_Windows::get_unique_id() const {
HW_PROFILE_INFOA HwProfInfo;
ERR_FAIL_COND_V(!GetCurrentHwProfileA(&HwProfInfo), "");
return String((HwProfInfo.szHwProfileGuid), HW_PROFILE_GUIDLEN);
return String::ascii(Span((HwProfInfo.szHwProfileGuid), HW_PROFILE_GUIDLEN));
}
bool OS_Windows::_check_internal_feature_support(const String &p_feature) {
@ -2307,7 +2500,7 @@ String OS_Windows::get_system_ca_certificates() {
PackedByteArray pba;
pba.resize(size);
CryptBinaryToStringA(curr->pbCertEncoded, curr->cbCertEncoded, CRYPT_STRING_BASE64HEADER | CRYPT_STRING_NOCR, (char *)pba.ptrw(), &size);
certs += String((char *)pba.ptr(), size);
certs += String::ascii(Span((char *)pba.ptr(), size));
curr = CertEnumCertificatesInStore(cert_store, curr);
}
CertCloseStore(cert_store, 0);
@ -2340,18 +2533,26 @@ void OS_Windows::add_frame_delay(bool p_can_draw) {
target_ticks += dynamic_delay;
uint64_t current_ticks = get_ticks_usec();
if (target_ticks > current_ticks + delay_resolution) {
uint64_t delay_time = target_ticks - current_ticks - delay_resolution;
// Make sure we always sleep for a multiple of delay_resolution to avoid overshooting.
// Refer to: https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-sleep#remarks
delay_time = (delay_time / delay_resolution) * delay_resolution;
if (delay_time > 0) {
delay_usec(delay_time);
if (!is_in_low_processor_usage_mode()) {
if (target_ticks > current_ticks + delay_resolution) {
uint64_t delay_time = target_ticks - current_ticks - delay_resolution;
// Make sure we always sleep for a multiple of delay_resolution to avoid overshooting.
// Refer to: https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-sleep#remarks
delay_time = (delay_time / delay_resolution) * delay_resolution;
if (delay_time > 0) {
delay_usec(delay_time);
}
}
// Busy wait for the remainder of time.
while (get_ticks_usec() < target_ticks) {
YieldProcessor();
}
} else {
// Use a more relaxed approach for low processor usage mode.
// This has worse frame pacing but is more power efficient.
if (current_ticks < target_ticks) {
delay_usec(target_ticks - current_ticks);
}
}
// Busy wait for the remainder of time.
while (get_ticks_usec() < target_ticks) {
YieldProcessor();
}
current_ticks = get_ticks_usec();
@ -2359,7 +2560,7 @@ void OS_Windows::add_frame_delay(bool p_can_draw) {
}
}
bool OS_Windows::_test_create_rendering_device() const {
bool OS_Windows::_test_create_rendering_device(const String &p_display_driver) const {
// Tests Rendering Device creation.
bool ok = false;
@ -2394,7 +2595,7 @@ bool OS_Windows::_test_create_rendering_device() const {
return ok;
}
bool OS_Windows::_test_create_rendering_device_and_gl() const {
bool OS_Windows::_test_create_rendering_device_and_gl(const String &p_display_driver) const {
// Tests OpenGL context and Rendering Device simultaneous creation. This function is expected to crash on some NVIDIA drivers.
WNDCLASSEXW wc_probe;
@ -2438,7 +2639,7 @@ bool OS_Windows::_test_create_rendering_device_and_gl() const {
}
if (ok) {
ok = _test_create_rendering_device();
ok = _test_create_rendering_device(p_display_driver);
}
#ifdef GLES3_ENABLED
@ -2455,6 +2656,8 @@ bool OS_Windows::_test_create_rendering_device_and_gl() const {
OS_Windows::OS_Windows(HINSTANCE _hInstance) {
hInstance = _hInstance;
_init_encodings();
// Reset CWD to ensure long path is used.
Char16String current_dir_name;
size_t str_len = GetCurrentDirectoryW(0, nullptr);

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef OS_WINDOWS_H
#define OS_WINDOWS_H
#pragma once
#include "crash_handler_windows.h"
#include "key_mapping_windows.h"
@ -137,6 +136,9 @@ class OS_Windows : public OS {
bool is_using_con_wrapper() const;
HashMap<String, int> encodings;
void _init_encodings();
// functions used by main to initialize/deinitialize the OS
protected:
virtual void initialize() override;
@ -242,6 +244,9 @@ public:
virtual bool _check_internal_feature_support(const String &p_feature) override;
virtual String multibyte_to_string(const String &p_encoding, const PackedByteArray &p_array) const override;
virtual PackedByteArray string_to_multibyte(const String &p_encoding, const String &p_string) const override;
virtual void disable_crash_handler() override;
virtual bool is_disable_crash_handler() const override;
virtual void initialize_debugging() override;
@ -252,12 +257,10 @@ public:
void set_main_window(HWND p_main_window) { main_window = p_main_window; }
virtual bool _test_create_rendering_device_and_gl() const override;
virtual bool _test_create_rendering_device() const override;
virtual bool _test_create_rendering_device_and_gl(const String &p_display_driver) const override;
virtual bool _test_create_rendering_device(const String &p_display_driver) const override;
HINSTANCE get_hinstance() { return hInstance; }
OS_Windows(HINSTANCE _hInstance);
~OS_Windows();
};
#endif // OS_WINDOWS_H

View file

@ -28,4 +28,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#pragma once
#include <malloc.h>

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef PLATFORM_GL_H
#define PLATFORM_GL_H
#pragma once
#ifndef GL_API_ENABLED
#define GL_API_ENABLED // Allow using desktop GL.
@ -49,5 +48,3 @@
#endif
#include "thirdparty/glad/glad/gl.h"
#endif // PLATFORM_GL_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef RENDERING_CONTEXT_DRIVER_VULKAN_WINDOWS_H
#define RENDERING_CONTEXT_DRIVER_VULKAN_WINDOWS_H
#pragma once
#ifdef VULKAN_ENABLED
@ -56,5 +55,3 @@ public:
};
#endif // VULKAN_ENABLED
#endif // RENDERING_CONTEXT_DRIVER_VULKAN_WINDOWS_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef TTS_WINDOWS_H
#define TTS_WINDOWS_H
#pragma once
#include "core/string/ustring.h"
#include "core/templates/hash_map.h"
@ -78,5 +77,3 @@ public:
TTS_Windows();
~TTS_Windows();
};
#endif // TTS_WINDOWS_H

View file

@ -0,0 +1,115 @@
;
; Definition file of UIAutomationCore.DLL
; Automatic generated by gendef
; written by Kai Tietz 2008
;
LIBRARY "UIAutomationCore.DLL"
EXPORTS
DllGetActivationFactory
DllCanUnloadNow
DllGetClassObject
DockPattern_SetDockPosition
ExpandCollapsePattern_Collapse
ExpandCollapsePattern_Expand
GridPattern_GetItem
IgnoreLeaksInCurrentlyTrackedMemory
InitializeChannelBasedConnectionForProviderProxy
InvokePattern_Invoke
IsIgnoringLeaks
ItemContainerPattern_FindItemByProperty
LegacyIAccessiblePattern_DoDefaultAction
LegacyIAccessiblePattern_GetIAccessible
LegacyIAccessiblePattern_Select
LegacyIAccessiblePattern_SetValue
MultipleViewPattern_GetViewName
MultipleViewPattern_SetCurrentView
PostTestCheckForLeaks
RangeValuePattern_SetValue
ScrollItemPattern_ScrollIntoView
ScrollPattern_Scroll
ScrollPattern_SetScrollPercent
SelectionItemPattern_AddToSelection
SelectionItemPattern_RemoveFromSelection
SelectionItemPattern_Select
StartIgnoringLeaks
StopIgnoringLeaks
SynchronizedInputPattern_Cancel
SynchronizedInputPattern_StartListening
TextPattern_GetSelection
TextPattern_GetVisibleRanges
TextPattern_RangeFromChild
TextPattern_RangeFromPoint
TextPattern_get_DocumentRange
TextPattern_get_SupportedTextSelection
TextRange_AddToSelection
TextRange_Clone
TextRange_Compare
TextRange_CompareEndpoints
TextRange_ExpandToEnclosingUnit
TextRange_FindAttribute
TextRange_FindText
TextRange_GetAttributeValue
TextRange_GetBoundingRectangles
TextRange_GetChildren
TextRange_GetEnclosingElement
TextRange_GetText
TextRange_Move
TextRange_MoveEndpointByRange
TextRange_MoveEndpointByUnit
TextRange_RemoveFromSelection
TextRange_ScrollIntoView
TextRange_Select
TogglePattern_Toggle
TransformPattern_Move
TransformPattern_Resize
TransformPattern_Rotate
UiaAddEvent
UiaClientsAreListening
UiaDisconnectAllProviders
UiaDisconnectProvider
UiaEventAddWindow
UiaEventRemoveWindow
UiaFind
UiaGetErrorDescription
UiaGetPatternProvider
UiaGetPropertyValue
UiaGetReservedMixedAttributeValue
UiaGetReservedNotSupportedValue
UiaGetRootNode
UiaGetRuntimeId
UiaGetUpdatedCache
UiaHPatternObjectFromVariant
UiaHTextRangeFromVariant
UiaHUiaNodeFromVariant
UiaHasServerSideProvider
UiaHostProviderFromHwnd
UiaIAccessibleFromProvider
UiaLookupId
UiaNavigate
UiaNodeFromFocus
UiaNodeFromHandle
UiaNodeFromPoint
UiaNodeFromProvider
UiaNodeRelease
UiaPatternRelease
UiaProviderForNonClient
UiaProviderFromIAccessible
UiaRaiseActiveTextPositionChangedEvent
UiaRaiseAsyncContentLoadedEvent
UiaRaiseAutomationEvent
UiaRaiseAutomationPropertyChangedEvent
UiaRaiseChangesEvent
UiaRaiseNotificationEvent
UiaRaiseStructureChangedEvent
UiaRaiseTextEditTextChangedEvent
UiaRegisterProviderCallback
UiaRemoveEvent
UiaReturnRawElementProvider
UiaSetFocus
UiaTextRangeRelease
UpdateErrorLoggingCallback
ValuePattern_SetValue
VirtualizedItemPattern_Realize
WindowPattern_Close
WindowPattern_SetWindowVisualState
WindowPattern_WaitForInputIdle

View file

@ -0,0 +1,115 @@
;
; Definition file of UIAutomationCore.DLL
; Automatic generated by gendef
; written by Kai Tietz 2008
;
LIBRARY "UIAutomationCore.DLL"
EXPORTS
DllGetActivationFactory
DllCanUnloadNow
DllGetClassObject
DockPattern_SetDockPosition
ExpandCollapsePattern_Collapse
ExpandCollapsePattern_Expand
GridPattern_GetItem
IgnoreLeaksInCurrentlyTrackedMemory
InitializeChannelBasedConnectionForProviderProxy
InvokePattern_Invoke
IsIgnoringLeaks
ItemContainerPattern_FindItemByProperty
LegacyIAccessiblePattern_DoDefaultAction
LegacyIAccessiblePattern_GetIAccessible
LegacyIAccessiblePattern_Select
LegacyIAccessiblePattern_SetValue
MultipleViewPattern_GetViewName
MultipleViewPattern_SetCurrentView
PostTestCheckForLeaks
RangeValuePattern_SetValue
ScrollItemPattern_ScrollIntoView
ScrollPattern_Scroll
ScrollPattern_SetScrollPercent
SelectionItemPattern_AddToSelection
SelectionItemPattern_RemoveFromSelection
SelectionItemPattern_Select
StartIgnoringLeaks
StopIgnoringLeaks
SynchronizedInputPattern_Cancel
SynchronizedInputPattern_StartListening
TextPattern_GetSelection
TextPattern_GetVisibleRanges
TextPattern_RangeFromChild
TextPattern_RangeFromPoint
TextPattern_get_DocumentRange
TextPattern_get_SupportedTextSelection
TextRange_AddToSelection
TextRange_Clone
TextRange_Compare
TextRange_CompareEndpoints
TextRange_ExpandToEnclosingUnit
TextRange_FindAttribute
TextRange_FindText
TextRange_GetAttributeValue
TextRange_GetBoundingRectangles
TextRange_GetChildren
TextRange_GetEnclosingElement
TextRange_GetText
TextRange_Move
TextRange_MoveEndpointByRange
TextRange_MoveEndpointByUnit
TextRange_RemoveFromSelection
TextRange_ScrollIntoView
TextRange_Select
TogglePattern_Toggle
TransformPattern_Move
TransformPattern_Resize
TransformPattern_Rotate
UiaAddEvent
UiaClientsAreListening
UiaDisconnectAllProviders
UiaDisconnectProvider
UiaEventAddWindow
UiaEventRemoveWindow
UiaFind
UiaGetErrorDescription
UiaGetPatternProvider
UiaGetPropertyValue
UiaGetReservedMixedAttributeValue
UiaGetReservedNotSupportedValue
UiaGetRootNode
UiaGetRuntimeId
UiaGetUpdatedCache
UiaHPatternObjectFromVariant
UiaHTextRangeFromVariant
UiaHUiaNodeFromVariant
UiaHasServerSideProvider
UiaHostProviderFromHwnd
UiaIAccessibleFromProvider
UiaLookupId
UiaNavigate
UiaNodeFromFocus
UiaNodeFromHandle
UiaNodeFromPoint
UiaNodeFromProvider
UiaNodeRelease
UiaPatternRelease
UiaProviderForNonClient
UiaProviderFromIAccessible
UiaRaiseActiveTextPositionChangedEvent
UiaRaiseAsyncContentLoadedEvent
UiaRaiseAutomationEvent
UiaRaiseAutomationPropertyChangedEvent
UiaRaiseChangesEvent
UiaRaiseNotificationEvent
UiaRaiseStructureChangedEvent
UiaRaiseTextEditTextChangedEvent
UiaRegisterProviderCallback
UiaRemoveEvent
UiaReturnRawElementProvider
UiaSetFocus
UiaTextRangeRelease
UpdateErrorLoggingCallback
ValuePattern_SetValue
VirtualizedItemPattern_Realize
WindowPattern_Close
WindowPattern_SetWindowVisualState
WindowPattern_WaitForInputIdle

View file

@ -0,0 +1,115 @@
;
; Definition file of UIAutomationCore.DLL
; Automatic generated by gendef
; written by Kai Tietz 2008
;
LIBRARY "UIAutomationCore.DLL"
EXPORTS
DllGetActivationFactory@8
DllCanUnloadNow
DllGetClassObject@12
DockPattern_SetDockPosition@8
ExpandCollapsePattern_Collapse@4
ExpandCollapsePattern_Expand@4
GridPattern_GetItem@16
IgnoreLeaksInCurrentlyTrackedMemory
InitializeChannelBasedConnectionForProviderProxy@12
InvokePattern_Invoke@4
IsIgnoringLeaks
ItemContainerPattern_FindItemByProperty@32
LegacyIAccessiblePattern_DoDefaultAction@4
LegacyIAccessiblePattern_GetIAccessible@8
LegacyIAccessiblePattern_Select@8
LegacyIAccessiblePattern_SetValue@8
MultipleViewPattern_GetViewName@12
MultipleViewPattern_SetCurrentView@8
PostTestCheckForLeaks@8
RangeValuePattern_SetValue@12
ScrollItemPattern_ScrollIntoView@4
ScrollPattern_Scroll@12
ScrollPattern_SetScrollPercent@20
SelectionItemPattern_AddToSelection@4
SelectionItemPattern_RemoveFromSelection@4
SelectionItemPattern_Select@4
StartIgnoringLeaks@4
StopIgnoringLeaks
SynchronizedInputPattern_Cancel@4
SynchronizedInputPattern_StartListening@8
TextPattern_GetSelection@8
TextPattern_GetVisibleRanges@8
TextPattern_RangeFromChild@12
TextPattern_RangeFromPoint@24
TextPattern_get_DocumentRange@8
TextPattern_get_SupportedTextSelection@8
TextRange_AddToSelection@4
TextRange_Clone@8
TextRange_Compare@12
TextRange_CompareEndpoints@20
TextRange_ExpandToEnclosingUnit@8
TextRange_FindAttribute@32
TextRange_FindText@20
TextRange_GetAttributeValue@12
TextRange_GetBoundingRectangles@8
TextRange_GetChildren@8
TextRange_GetEnclosingElement@8
TextRange_GetText@12
TextRange_Move@16
TextRange_MoveEndpointByRange@16
TextRange_MoveEndpointByUnit@20
TextRange_RemoveFromSelection@4
TextRange_ScrollIntoView@8
TextRange_Select@4
TogglePattern_Toggle@4
TransformPattern_Move@20
TransformPattern_Resize@20
TransformPattern_Rotate@12
UiaAddEvent@32
UiaClientsAreListening
UiaDisconnectAllProviders
UiaDisconnectProvider@4
UiaEventAddWindow@8
UiaEventRemoveWindow@8
UiaFind@24
UiaGetErrorDescription@4
UiaGetPatternProvider@12
UiaGetPropertyValue@12
UiaGetReservedMixedAttributeValue@4
UiaGetReservedNotSupportedValue@4
UiaGetRootNode@4
UiaGetRuntimeId@8
UiaGetUpdatedCache@24
UiaHPatternObjectFromVariant@8
UiaHTextRangeFromVariant@8
UiaHUiaNodeFromVariant@8
UiaHasServerSideProvider@4
UiaHostProviderFromHwnd@8
UiaIAccessibleFromProvider@16
UiaLookupId@8
UiaNavigate@24
UiaNodeFromFocus@12
UiaNodeFromHandle@8
UiaNodeFromPoint@28
UiaNodeFromProvider@8
UiaNodeRelease@4
UiaPatternRelease@4
UiaProviderForNonClient@16
UiaProviderFromIAccessible@16
UiaRaiseActiveTextPositionChangedEvent@8
UiaRaiseAsyncContentLoadedEvent@16
UiaRaiseAutomationEvent@8
UiaRaiseAutomationPropertyChangedEvent@40
UiaRaiseChangesEvent@12
UiaRaiseNotificationEvent@20
UiaRaiseStructureChangedEvent@16
UiaRaiseTextEditTextChangedEvent@12
UiaRegisterProviderCallback@4
UiaRemoveEvent@4
UiaReturnRawElementProvider@16
UiaSetFocus@4
UiaTextRangeRelease@4
UpdateErrorLoggingCallback@4
ValuePattern_SetValue@8
VirtualizedItemPattern_Realize@4
WindowPattern_Close@4
WindowPattern_SetWindowVisualState@8
WindowPattern_WaitForInputIdle@12

View file

@ -0,0 +1,115 @@
;
; Definition file of UIAutomationCore.DLL
; Automatic generated by gendef
; written by Kai Tietz 2008
;
LIBRARY "UIAutomationCore.DLL"
EXPORTS
DllGetActivationFactory
DllCanUnloadNow
DllGetClassObject
DockPattern_SetDockPosition
ExpandCollapsePattern_Collapse
ExpandCollapsePattern_Expand
GridPattern_GetItem
IgnoreLeaksInCurrentlyTrackedMemory
InitializeChannelBasedConnectionForProviderProxy
InvokePattern_Invoke
IsIgnoringLeaks
ItemContainerPattern_FindItemByProperty
LegacyIAccessiblePattern_DoDefaultAction
LegacyIAccessiblePattern_GetIAccessible
LegacyIAccessiblePattern_Select
LegacyIAccessiblePattern_SetValue
MultipleViewPattern_GetViewName
MultipleViewPattern_SetCurrentView
PostTestCheckForLeaks
RangeValuePattern_SetValue
ScrollItemPattern_ScrollIntoView
ScrollPattern_Scroll
ScrollPattern_SetScrollPercent
SelectionItemPattern_AddToSelection
SelectionItemPattern_RemoveFromSelection
SelectionItemPattern_Select
StartIgnoringLeaks
StopIgnoringLeaks
SynchronizedInputPattern_Cancel
SynchronizedInputPattern_StartListening
TextPattern_GetSelection
TextPattern_GetVisibleRanges
TextPattern_RangeFromChild
TextPattern_RangeFromPoint
TextPattern_get_DocumentRange
TextPattern_get_SupportedTextSelection
TextRange_AddToSelection
TextRange_Clone
TextRange_Compare
TextRange_CompareEndpoints
TextRange_ExpandToEnclosingUnit
TextRange_FindAttribute
TextRange_FindText
TextRange_GetAttributeValue
TextRange_GetBoundingRectangles
TextRange_GetChildren
TextRange_GetEnclosingElement
TextRange_GetText
TextRange_Move
TextRange_MoveEndpointByRange
TextRange_MoveEndpointByUnit
TextRange_RemoveFromSelection
TextRange_ScrollIntoView
TextRange_Select
TogglePattern_Toggle
TransformPattern_Move
TransformPattern_Resize
TransformPattern_Rotate
UiaAddEvent
UiaClientsAreListening
UiaDisconnectAllProviders
UiaDisconnectProvider
UiaEventAddWindow
UiaEventRemoveWindow
UiaFind
UiaGetErrorDescription
UiaGetPatternProvider
UiaGetPropertyValue
UiaGetReservedMixedAttributeValue
UiaGetReservedNotSupportedValue
UiaGetRootNode
UiaGetRuntimeId
UiaGetUpdatedCache
UiaHPatternObjectFromVariant
UiaHTextRangeFromVariant
UiaHUiaNodeFromVariant
UiaHasServerSideProvider
UiaHostProviderFromHwnd
UiaIAccessibleFromProvider
UiaLookupId
UiaNavigate
UiaNodeFromFocus
UiaNodeFromHandle
UiaNodeFromPoint
UiaNodeFromProvider
UiaNodeRelease
UiaPatternRelease
UiaProviderForNonClient
UiaProviderFromIAccessible
UiaRaiseActiveTextPositionChangedEvent
UiaRaiseAsyncContentLoadedEvent
UiaRaiseAutomationEvent
UiaRaiseAutomationPropertyChangedEvent
UiaRaiseChangesEvent
UiaRaiseNotificationEvent
UiaRaiseStructureChangedEvent
UiaRaiseTextEditTextChangedEvent
UiaRegisterProviderCallback
UiaRemoveEvent
UiaReturnRawElementProvider
UiaSetFocus
UiaTextRangeRelease
UpdateErrorLoggingCallback
ValuePattern_SetValue
VirtualizedItemPattern_Realize
WindowPattern_Close
WindowPattern_SetWindowVisualState
WindowPattern_WaitForInputIdle

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef WGL_DETECT_VERSION_H
#define WGL_DETECT_VERSION_H
#pragma once
#if defined(WINDOWS_ENABLED) && defined(GLES3_ENABLED)
@ -38,5 +37,3 @@ class Dictionary;
Dictionary detect_wgl();
#endif // WINDOWS_ENABLED && GLES3_ENABLED
#endif // WGL_DETECT_VERSION_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef WINDOWS_TERMINAL_LOGGER_H
#define WINDOWS_TERMINAL_LOGGER_H
#pragma once
#ifdef WINDOWS_ENABLED
@ -43,5 +42,3 @@ public:
};
#endif // WINDOWS_ENABLED
#endif // WINDOWS_TERMINAL_LOGGER_H

View file

@ -136,7 +136,7 @@ Error WindowsUtils::copy_and_rename_pdb(const String &p_dll_path) {
}
String utf_path;
Error err = utf_path.parse_utf8(raw_pdb_path);
Error err = utf_path.append_utf8(raw_pdb_path);
ERR_FAIL_COND_V_MSG(err != OK, err, vformat("Failed to read PDB path from '%s'.", p_dll_path));
pdb_info.path = utf_path;
@ -179,7 +179,8 @@ Error WindowsUtils::copy_and_rename_pdb(const String &p_dll_path) {
if (new_expected_buffer_size > original_path_size) {
ERR_FAIL_COND_V_MSG(original_path_size < min_base_size + suffix_size, FAILED, vformat("The original PDB path size in bytes is too small: '%s'. Expected size: %d or more bytes, but available %d.", pdb_info.path, min_base_size + suffix_size, original_path_size));
new_pdb_base_name.parse_utf8(utf8_name, original_path_size - suffix_size);
new_pdb_base_name.clear();
new_pdb_base_name.append_utf8(utf8_name, original_path_size - suffix_size);
new_pdb_base_name[new_pdb_base_name.length() - 1] = '_'; // Restore the last '_'
WARN_PRINT(vformat("The original path size of '%s' in bytes was too small to fit the new name, so it was shortened to '%s%d.pdb'.", pdb_info.path, new_pdb_base_name, max_pdb_names - 1));
}
@ -229,10 +230,8 @@ Error WindowsUtils::copy_and_rename_pdb(const String &p_dll_path) {
file->store_buffer(u8);
// Terminate string and fill the remaining part of the original string with the '\0'.
// Can be replaced by file->store_8('\0');
Vector<uint8_t> padding_buffer;
padding_buffer.resize((int64_t)original_path_size - u8.size());
padding_buffer.fill('\0');
padding_buffer.resize_zeroed((int64_t)original_path_size - u8.size());
file->store_buffer(padding_buffer);
ERR_FAIL_COND_V_MSG(err != OK, err, vformat("Failed to write a new PDB path to '%s'.", p_dll_path));

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef WINDOWS_UTILS_H
#define WINDOWS_UTILS_H
#pragma once
#ifdef WINDOWS_ENABLED
@ -45,5 +44,3 @@ public:
};
#endif // WINDOWS_ENABLED
#endif // WINDOWS_UTILS_H