1
0
Fork 0

Compare commits

..

20 Commits

Author SHA1 Message Date
Pāvels Nadtočajevs 189d18be58 Use list properties for display drivers. 2025-02-28 08:03:07 +02:00
Pāvels Nadtočajevs 9cc6e4a1be Add support for "ordered" list properties.
Add support for "ordered" list properties.
2025-02-28 08:00:32 +02:00
Rémi Verschelde 15ff450680
Merge pull request #103371 from m4gr3d/add_checks_for_game_menu_utils_jni
Add checks to prevent crashes when accessing the GameMenu api
2025-02-28 01:12:11 +01:00
Fredia Huya-Kouadio 7fb37a088b Add checks to prevent crashes when accessing the GameMenu api
This should address crashes reported on the Play store. Note that those crashes lack debug symbols which reduces our ability to narrow down the exact cause of the crash. We aim to resolve that in Godot 4.5.
2025-02-27 13:20:23 -08:00
Rémi Verschelde 33a15a12b1
Merge pull request #103370 from m4gr3d/inform_android_sensors_mobile_vr
Inform that Android sensors must be enabled for MobileVR support
2025-02-27 22:17:07 +01:00
Rémi Verschelde c01b9de703
Merge pull request #103364 from akien-mga/input-deadzone-ui-0.5
Input: Change default deadzone back to 0.5 for `ui_*` actions and axis `pressed` state
2025-02-27 22:17:01 +01:00
Fredia Huya-Kouadio 33a235beb8 Inform that Android sensors must be enabled for MobileVR support 2025-02-27 12:53:57 -08:00
Rémi Verschelde a9c5c4db71
Merge pull request #103201 from beicause/shaders-only-convert-source-color-linear
Shaders: Only convert default value to linear color if type hint is `source_color`
2025-02-27 19:34:12 +01:00
Rémi Verschelde 1af42620fa
Merge pull request #103362 from bruvzg/gds_get_set_bchk
Add bound checks to `Array`/`Packed*Array` variant call `get` and `set` methods.
2025-02-27 18:50:57 +01:00
Rémi Verschelde 672fe2487f
Input: Change default deadzone back to 0.5 for `ui_*` actions and axis `pressed` state
Fixes #103360.
Partial revert of changes in #97281 and #99135.
2025-02-27 17:30:48 +01:00
Pāvels Nadtočajevs f9c7d348c3 Add bound checks to `Array`/`Packed*Array` variant call `get` and `set` methods. 2025-02-27 17:54:40 +02:00
Rémi Verschelde 53faed5351
Merge pull request #103339 from Hilderin/adjustment-error-message-embedded-game
Replace error to info messages for embedded game
2025-02-27 12:40:39 +01:00
Rémi Verschelde dd43d401ec
Merge pull request #103338 from dsnopek/openxr-passthrough-emulation-wins
OpenXR: Emulated alpha blend mode should override the real blend mode
2025-02-27 12:40:36 +01:00
Rémi Verschelde 9014202366
Merge pull request #103337 from stuartcarnie/fix_ios_options
Metal: Fix SPIR-V → MSL compilation on iOS targets
2025-02-27 12:40:33 +01:00
Rémi Verschelde bb88938596
Merge pull request #103354 from bruvzg/gproc
Add `(void *)` cast directly to `GetProcAddress` calls.
2025-02-27 12:40:27 +01:00
Pāvels Nadtočajevs ddd807ff7d Add `(void *)` cast directly to `GetProcAddress` calls. 2025-02-27 12:30:04 +02:00
Hilderin 0c384e7217 Replace error to info messages for embedded game 2025-02-26 19:32:25 -05:00
David Snopek fd622afb1d OpenXR: Emulated alpha blend mode should override the real blend mode 2025-02-26 17:35:03 -06:00
Stuart Carnie 5312811c4d Metal: Fix SPIR-V → MSL compilation on iOS targets 2025-02-27 10:22:39 +11:00
LuoZhihao 5ca3862636 Shaders: Only convert default value to linear color if type is `source_color` 2025-02-23 12:35:53 +08:00
16 changed files with 177 additions and 128 deletions

View File

@ -1439,7 +1439,7 @@ void ProjectSettings::_add_builtin_input_map() {
}
Dictionary action;
action["deadzone"] = Variant(InputMap::DEFAULT_DEADZONE);
action["deadzone"] = Variant(InputMap::DEFAULT_TOGGLE_DEADZONE);
action["events"] = events;
String action_name = "input/" + E.key;

View File

@ -1104,7 +1104,7 @@ JoyAxis InputEventJoypadMotion::get_axis() const {
void InputEventJoypadMotion::set_axis_value(float p_value) {
axis_value = p_value;
pressed = Math::abs(axis_value) >= InputMap::DEFAULT_DEADZONE;
pressed = Math::abs(axis_value) >= InputMap::DEFAULT_TOGGLE_DEADZONE;
emit_changed();
}

View File

@ -55,6 +55,8 @@ public:
};
static constexpr float DEFAULT_DEADZONE = 0.2f;
// Keep bigger deadzone for toggle actions (default `ui_*` actions, axis `pressed`) (GH-103360).
static constexpr float DEFAULT_TOGGLE_DEADZONE = 0.5f;
private:
static InputMap *singleton;

View File

@ -657,22 +657,28 @@ static _FORCE_INLINE_ void vc_ptrcall(void (*method)(T *, P...), void *p_base, c
} \
};
#define VARCALL_PACKED_GETTER(m_packed_type, m_return_type) \
static m_return_type func_##m_packed_type##_get(m_packed_type *p_instance, int64_t p_index) { \
return p_instance->get(p_index); \
#define VARCALL_ARRAY_GETTER_SETTER(m_packed_type, m_type) \
static m_type func_##m_packed_type##_get(m_packed_type *p_instance, int64_t p_index) { \
ERR_FAIL_INDEX_V(p_index, p_instance->size(), m_type()); \
return p_instance->get(p_index); \
} \
static void func_##m_packed_type##_set(m_packed_type *p_instance, int64_t p_index, const m_type &p_value) { \
ERR_FAIL_INDEX(p_index, p_instance->size()); \
p_instance->set(p_index, p_value); \
}
struct _VariantCall {
VARCALL_PACKED_GETTER(PackedByteArray, uint8_t)
VARCALL_PACKED_GETTER(PackedColorArray, Color)
VARCALL_PACKED_GETTER(PackedFloat32Array, float)
VARCALL_PACKED_GETTER(PackedFloat64Array, double)
VARCALL_PACKED_GETTER(PackedInt32Array, int32_t)
VARCALL_PACKED_GETTER(PackedInt64Array, int64_t)
VARCALL_PACKED_GETTER(PackedStringArray, String)
VARCALL_PACKED_GETTER(PackedVector2Array, Vector2)
VARCALL_PACKED_GETTER(PackedVector3Array, Vector3)
VARCALL_PACKED_GETTER(PackedVector4Array, Vector4)
VARCALL_ARRAY_GETTER_SETTER(PackedByteArray, uint8_t)
VARCALL_ARRAY_GETTER_SETTER(PackedColorArray, Color)
VARCALL_ARRAY_GETTER_SETTER(PackedFloat32Array, float)
VARCALL_ARRAY_GETTER_SETTER(PackedFloat64Array, double)
VARCALL_ARRAY_GETTER_SETTER(PackedInt32Array, int32_t)
VARCALL_ARRAY_GETTER_SETTER(PackedInt64Array, int64_t)
VARCALL_ARRAY_GETTER_SETTER(PackedStringArray, String)
VARCALL_ARRAY_GETTER_SETTER(PackedVector2Array, Vector2)
VARCALL_ARRAY_GETTER_SETTER(PackedVector3Array, Vector3)
VARCALL_ARRAY_GETTER_SETTER(PackedVector4Array, Vector4)
VARCALL_ARRAY_GETTER_SETTER(Array, Variant)
static String func_PackedByteArray_get_string_from_ascii(PackedByteArray *p_instance) {
String s;
@ -2354,8 +2360,8 @@ static void _register_variant_builtin_methods_array() {
bind_method(Array, clear, sarray(), varray());
bind_method(Array, hash, sarray(), varray());
bind_method(Array, assign, sarray("array"), varray());
bind_method(Array, get, sarray("index"), varray());
bind_method(Array, set, sarray("index", "value"), varray());
bind_function(Array, get, _VariantCall::func_Array_get, sarray("index"), varray());
bind_functionnc(Array, set, _VariantCall::func_Array_set, sarray("index", "value"), varray());
bind_method(Array, push_back, sarray("value"), varray());
bind_method(Array, push_front, sarray("value"), varray());
bind_method(Array, append, sarray("value"), varray());
@ -2400,7 +2406,7 @@ static void _register_variant_builtin_methods_array() {
bind_method(Array, make_read_only, sarray(), varray());
bind_method(Array, is_read_only, sarray(), varray());
/* Packed*Array get (see VARCALL_PACKED_GETTER macro) */
/* Packed*Array get/set (see VARCALL_ARRAY_GETTER_SETTER macro) */
bind_function(PackedByteArray, get, _VariantCall::func_PackedByteArray_get, sarray("index"), varray());
bind_function(PackedColorArray, get, _VariantCall::func_PackedColorArray_get, sarray("index"), varray());
bind_function(PackedFloat32Array, get, _VariantCall::func_PackedFloat32Array_get, sarray("index"), varray());
@ -2412,10 +2418,20 @@ static void _register_variant_builtin_methods_array() {
bind_function(PackedVector3Array, get, _VariantCall::func_PackedVector3Array_get, sarray("index"), varray());
bind_function(PackedVector4Array, get, _VariantCall::func_PackedVector4Array_get, sarray("index"), varray());
bind_functionnc(PackedByteArray, set, _VariantCall::func_PackedByteArray_set, sarray("index", "value"), varray());
bind_functionnc(PackedColorArray, set, _VariantCall::func_PackedColorArray_set, sarray("index", "value"), varray());
bind_functionnc(PackedFloat32Array, set, _VariantCall::func_PackedFloat32Array_set, sarray("index", "value"), varray());
bind_functionnc(PackedFloat64Array, set, _VariantCall::func_PackedFloat64Array_set, sarray("index", "value"), varray());
bind_functionnc(PackedInt32Array, set, _VariantCall::func_PackedInt32Array_set, sarray("index", "value"), varray());
bind_functionnc(PackedInt64Array, set, _VariantCall::func_PackedInt64Array_set, sarray("index", "value"), varray());
bind_functionnc(PackedStringArray, set, _VariantCall::func_PackedStringArray_set, sarray("index", "value"), varray());
bind_functionnc(PackedVector2Array, set, _VariantCall::func_PackedVector2Array_set, sarray("index", "value"), varray());
bind_functionnc(PackedVector3Array, set, _VariantCall::func_PackedVector3Array_set, sarray("index", "value"), varray());
bind_functionnc(PackedVector4Array, set, _VariantCall::func_PackedVector4Array_set, sarray("index", "value"), varray());
/* Byte Array */
bind_method(PackedByteArray, size, sarray(), varray());
bind_method(PackedByteArray, is_empty, sarray(), varray());
bind_method(PackedByteArray, set, sarray("index", "value"), varray());
bind_method(PackedByteArray, push_back, sarray("value"), varray());
bind_method(PackedByteArray, append, sarray("value"), varray());
bind_method(PackedByteArray, append_array, sarray("array"), varray());
@ -2481,7 +2497,6 @@ static void _register_variant_builtin_methods_array() {
bind_method(PackedInt32Array, size, sarray(), varray());
bind_method(PackedInt32Array, is_empty, sarray(), varray());
bind_method(PackedInt32Array, set, sarray("index", "value"), varray());
bind_method(PackedInt32Array, push_back, sarray("value"), varray());
bind_method(PackedInt32Array, append, sarray("value"), varray());
bind_method(PackedInt32Array, append_array, sarray("array"), varray());
@ -2505,7 +2520,6 @@ static void _register_variant_builtin_methods_array() {
bind_method(PackedInt64Array, size, sarray(), varray());
bind_method(PackedInt64Array, is_empty, sarray(), varray());
bind_method(PackedInt64Array, set, sarray("index", "value"), varray());
bind_method(PackedInt64Array, push_back, sarray("value"), varray());
bind_method(PackedInt64Array, append, sarray("value"), varray());
bind_method(PackedInt64Array, append_array, sarray("array"), varray());
@ -2529,7 +2543,6 @@ static void _register_variant_builtin_methods_array() {
bind_method(PackedFloat32Array, size, sarray(), varray());
bind_method(PackedFloat32Array, is_empty, sarray(), varray());
bind_method(PackedFloat32Array, set, sarray("index", "value"), varray());
bind_method(PackedFloat32Array, push_back, sarray("value"), varray());
bind_method(PackedFloat32Array, append, sarray("value"), varray());
bind_method(PackedFloat32Array, append_array, sarray("array"), varray());
@ -2553,7 +2566,6 @@ static void _register_variant_builtin_methods_array() {
bind_method(PackedFloat64Array, size, sarray(), varray());
bind_method(PackedFloat64Array, is_empty, sarray(), varray());
bind_method(PackedFloat64Array, set, sarray("index", "value"), varray());
bind_method(PackedFloat64Array, push_back, sarray("value"), varray());
bind_method(PackedFloat64Array, append, sarray("value"), varray());
bind_method(PackedFloat64Array, append_array, sarray("array"), varray());
@ -2577,7 +2589,6 @@ static void _register_variant_builtin_methods_array() {
bind_method(PackedStringArray, size, sarray(), varray());
bind_method(PackedStringArray, is_empty, sarray(), varray());
bind_method(PackedStringArray, set, sarray("index", "value"), varray());
bind_method(PackedStringArray, push_back, sarray("value"), varray());
bind_method(PackedStringArray, append, sarray("value"), varray());
bind_method(PackedStringArray, append_array, sarray("array"), varray());
@ -2601,7 +2612,6 @@ static void _register_variant_builtin_methods_array() {
bind_method(PackedVector2Array, size, sarray(), varray());
bind_method(PackedVector2Array, is_empty, sarray(), varray());
bind_method(PackedVector2Array, set, sarray("index", "value"), varray());
bind_method(PackedVector2Array, push_back, sarray("value"), varray());
bind_method(PackedVector2Array, append, sarray("value"), varray());
bind_method(PackedVector2Array, append_array, sarray("array"), varray());
@ -2625,7 +2635,6 @@ static void _register_variant_builtin_methods_array() {
bind_method(PackedVector3Array, size, sarray(), varray());
bind_method(PackedVector3Array, is_empty, sarray(), varray());
bind_method(PackedVector3Array, set, sarray("index", "value"), varray());
bind_method(PackedVector3Array, push_back, sarray("value"), varray());
bind_method(PackedVector3Array, append, sarray("value"), varray());
bind_method(PackedVector3Array, append_array, sarray("array"), varray());
@ -2649,7 +2658,6 @@ static void _register_variant_builtin_methods_array() {
bind_method(PackedColorArray, size, sarray(), varray());
bind_method(PackedColorArray, is_empty, sarray(), varray());
bind_method(PackedColorArray, set, sarray("index", "value"), varray());
bind_method(PackedColorArray, push_back, sarray("value"), varray());
bind_method(PackedColorArray, append, sarray("value"), varray());
bind_method(PackedColorArray, append_array, sarray("array"), varray());
@ -2673,7 +2681,6 @@ static void _register_variant_builtin_methods_array() {
bind_method(PackedVector4Array, size, sarray(), varray());
bind_method(PackedVector4Array, is_empty, sarray(), varray());
bind_method(PackedVector4Array, set, sarray("index", "value"), varray());
bind_method(PackedVector4Array, push_back, sarray("value"), varray());
bind_method(PackedVector4Array, append, sarray("value"), varray());
bind_method(PackedVector4Array, append_array, sarray("array"), varray());

View File

@ -2045,6 +2045,7 @@ Vector<uint8_t> RenderingDeviceDriverMetal::shader_compile_binary_from_spirv(Vec
#if TARGET_OS_IPHONE
msl_options.ios_use_simdgroup_functions = (*device_properties).features.simdPermute;
msl_options.ios_support_base_vertex_instance = true;
#endif
bool disable_argument_buffers = false;

View File

@ -12,6 +12,7 @@
if interface and interface.initialize():
get_viewport().use_xr = true
[/codeblock]
[b]Note:[/b] For Android, [member ProjectSettings.input_devices/sensors/enable_accelerometer], [member ProjectSettings.input_devices/sensors/enable_gravity], [member ProjectSettings.input_devices/sensors/enable_gyroscope] and [member ProjectSettings.input_devices/sensors/enable_magnetometer] must be enabled.
</description>
<tutorials>
</tutorials>

View File

@ -135,7 +135,7 @@ typedef BOOL(WINAPI *LPFN_ISWOW64PROCESS)(HANDLE, PBOOL);
BOOL is_wow64() {
BOOL wow64 = FALSE;
LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process");
LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)(void *)GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process");
if (fnIsWow64Process) {
if (!fnIsWow64Process(GetCurrentProcess(), &wow64)) {

View File

@ -3641,10 +3641,10 @@ void OpenXRAPI::set_emulate_environment_blend_mode_alpha_blend(bool p_enabled) {
}
OpenXRAPI::OpenXRAlphaBlendModeSupport OpenXRAPI::is_environment_blend_mode_alpha_blend_supported() {
if (is_environment_blend_mode_supported(XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND)) {
return OPENXR_ALPHA_BLEND_MODE_SUPPORT_REAL;
} else if (emulate_environment_blend_mode_alpha_blend) {
if (emulate_environment_blend_mode_alpha_blend) {
return OPENXR_ALPHA_BLEND_MODE_SUPPORT_EMULATING;
} else if (is_environment_blend_mode_supported(XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND)) {
return OPENXR_ALPHA_BLEND_MODE_SUPPORT_REAL;
}
return OPENXR_ALPHA_BLEND_MODE_SUPPORT_NONE;
}

View File

@ -34,13 +34,20 @@
#include "editor/editor_interface.h"
#include "editor/editor_node.h"
#include "editor/plugins/game_view_plugin.h"
static GameViewPlugin *_get_game_view_plugin() {
ERR_FAIL_NULL_V(EditorNode::get_singleton(), nullptr);
ERR_FAIL_NULL_V(EditorNode::get_singleton()->get_editor_main_screen(), nullptr);
return Object::cast_to<GameViewPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_plugin_by_name("Game"));
}
#endif
extern "C" {
JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setSuspend(JNIEnv *env, jclass clazz, jboolean enabled) {
#ifdef TOOLS_ENABLED
GameViewPlugin *game_view_plugin = Object::cast_to<GameViewPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_plugin_by_name("Game"));
GameViewPlugin *game_view_plugin = _get_game_view_plugin();
if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) {
game_view_plugin->get_debugger()->set_suspend(enabled);
}
@ -49,7 +56,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setSuspend
JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_nextFrame(JNIEnv *env, jclass clazz) {
#ifdef TOOLS_ENABLED
GameViewPlugin *game_view_plugin = Object::cast_to<GameViewPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_plugin_by_name("Game"));
GameViewPlugin *game_view_plugin = _get_game_view_plugin();
if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) {
game_view_plugin->get_debugger()->next_frame();
}
@ -58,7 +65,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_nextFrame(
JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setNodeType(JNIEnv *env, jclass clazz, jint type) {
#ifdef TOOLS_ENABLED
GameViewPlugin *game_view_plugin = Object::cast_to<GameViewPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_plugin_by_name("Game"));
GameViewPlugin *game_view_plugin = _get_game_view_plugin();
if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) {
game_view_plugin->get_debugger()->set_node_type(type);
}
@ -67,7 +74,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setNodeTyp
JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setSelectMode(JNIEnv *env, jclass clazz, jint mode) {
#ifdef TOOLS_ENABLED
GameViewPlugin *game_view_plugin = Object::cast_to<GameViewPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_plugin_by_name("Game"));
GameViewPlugin *game_view_plugin = _get_game_view_plugin();
if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) {
game_view_plugin->get_debugger()->set_select_mode(mode);
}
@ -76,7 +83,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setSelectM
JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setSelectionVisible(JNIEnv *env, jclass clazz, jboolean visible) {
#ifdef TOOLS_ENABLED
GameViewPlugin *game_view_plugin = Object::cast_to<GameViewPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_plugin_by_name("Game"));
GameViewPlugin *game_view_plugin = _get_game_view_plugin();
if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) {
game_view_plugin->get_debugger()->set_selection_visible(visible);
}
@ -85,7 +92,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setSelecti
JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setCameraOverride(JNIEnv *env, jclass clazz, jboolean enabled) {
#ifdef TOOLS_ENABLED
GameViewPlugin *game_view_plugin = Object::cast_to<GameViewPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_plugin_by_name("Game"));
GameViewPlugin *game_view_plugin = _get_game_view_plugin();
if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) {
game_view_plugin->get_debugger()->set_camera_override(enabled);
}
@ -94,7 +101,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setCameraO
JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setCameraManipulateMode(JNIEnv *env, jclass clazz, jint mode) {
#ifdef TOOLS_ENABLED
GameViewPlugin *game_view_plugin = Object::cast_to<GameViewPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_plugin_by_name("Game"));
GameViewPlugin *game_view_plugin = _get_game_view_plugin();
if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) {
game_view_plugin->get_debugger()->set_camera_manipulate_mode(static_cast<EditorDebuggerNode::CameraOverride>(mode));
}
@ -103,7 +110,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_setCameraM
JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_resetCamera2DPosition(JNIEnv *env, jclass clazz) {
#ifdef TOOLS_ENABLED
GameViewPlugin *game_view_plugin = Object::cast_to<GameViewPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_plugin_by_name("Game"));
GameViewPlugin *game_view_plugin = _get_game_view_plugin();
if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) {
game_view_plugin->get_debugger()->reset_camera_2d_position();
}
@ -112,7 +119,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_resetCamer
JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_resetCamera3DPosition(JNIEnv *env, jclass clazz) {
#ifdef TOOLS_ENABLED
GameViewPlugin *game_view_plugin = Object::cast_to<GameViewPlugin>(EditorNode::get_singleton()->get_editor_main_screen()->get_plugin_by_name("Game"));
GameViewPlugin *game_view_plugin = _get_game_view_plugin();
if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) {
game_view_plugin->get_debugger()->reset_camera_3d_position();
}
@ -121,7 +128,9 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_resetCamer
JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_GameMenuUtils_playMainScene(JNIEnv *env, jclass clazz) {
#ifdef TOOLS_ENABLED
EditorInterface::get_singleton()->play_main_scene();
if (EditorInterface::get_singleton()) {
EditorInterface::get_singleton()->play_main_scene();
}
#endif
}
}

View File

@ -2173,7 +2173,10 @@ void DisplayServerX11::window_set_current_screen(int p_screen, WindowID p_window
return;
}
ERR_FAIL_COND_MSG(wd.embed_parent, "Embedded window can't be moved to another screen.");
if (wd.embed_parent) {
print_line("Embedded window can't be moved to another screen.");
return;
}
if (window_get_mode(p_window) == WINDOW_MODE_FULLSCREEN || window_get_mode(p_window) == WINDOW_MODE_MAXIMIZED) {
Point2i position = screen_get_position(p_screen);
@ -2332,7 +2335,10 @@ void DisplayServerX11::window_set_position(const Point2i &p_position, WindowID p
ERR_FAIL_COND(!windows.has(p_window));
WindowData &wd = windows[p_window];
ERR_FAIL_COND_MSG(wd.embed_parent, "Embedded window can't be moved.");
if (wd.embed_parent) {
print_line("Embedded window can't be moved.");
return;
}
int x = 0;
int y = 0;
@ -2366,7 +2372,10 @@ void DisplayServerX11::window_set_max_size(const Size2i p_size, WindowID p_windo
ERR_FAIL_COND(!windows.has(p_window));
WindowData &wd = windows[p_window];
ERR_FAIL_COND_MSG(wd.embed_parent, "Embedded windows can't have a maximum size.");
if (wd.embed_parent) {
print_line("Embedded windows can't have a maximum size.");
return;
}
if ((p_size != Size2i()) && ((p_size.x < wd.min_size.x) || (p_size.y < wd.min_size.y))) {
ERR_PRINT("Maximum window size can't be smaller than minimum window size!");
@ -2393,7 +2402,10 @@ void DisplayServerX11::window_set_min_size(const Size2i p_size, WindowID p_windo
ERR_FAIL_COND(!windows.has(p_window));
WindowData &wd = windows[p_window];
ERR_FAIL_COND_MSG(wd.embed_parent, "Embedded windows can't have a minimum size.");
if (wd.embed_parent) {
print_line("Embedded windows can't have a minimum size.");
return;
}
if ((p_size != Size2i()) && (wd.max_size != Size2i()) && ((p_size.x > wd.max_size.x) || (p_size.y > wd.max_size.y))) {
ERR_PRINT("Minimum window size can't be larger than maximum window size!");
@ -2424,7 +2436,10 @@ void DisplayServerX11::window_set_size(const Size2i p_size, WindowID p_window) {
WindowData &wd = windows[p_window];
ERR_FAIL_COND_MSG(wd.embed_parent, "Embedded window can't be resized.");
if (wd.embed_parent) {
print_line("Embedded window can't be resized.");
return;
}
if (wd.size.width == size.width && wd.size.height == size.height) {
return;
@ -2844,7 +2859,10 @@ void DisplayServerX11::window_set_mode(WindowMode p_mode, WindowID p_window) {
return; // do nothing
}
ERR_FAIL_COND_MSG(p_mode != WINDOW_MODE_WINDOWED && wd.embed_parent, "Embedded window only supports Windowed mode.");
if (p_mode != WINDOW_MODE_WINDOWED && wd.embed_parent) {
print_line("Embedded window only supports Windowed mode.");
return;
}
// Remove all "extra" modes.
switch (old_mode) {
@ -2946,7 +2964,10 @@ void DisplayServerX11::window_set_flag(WindowFlags p_flag, bool p_enabled, Windo
switch (p_flag) {
case WINDOW_FLAG_RESIZE_DISABLED: {
ERR_FAIL_COND_MSG(p_enabled && wd.embed_parent, "Embedded window resize can't be disabled.");
if (p_enabled && wd.embed_parent) {
print_line("Embedded window resize can't be disabled.");
return;
}
wd.resize_disabled = p_enabled;
_update_size_hints(p_window);
@ -2973,7 +2994,10 @@ void DisplayServerX11::window_set_flag(WindowFlags p_flag, bool p_enabled, Windo
} break;
case WINDOW_FLAG_ALWAYS_ON_TOP: {
ERR_FAIL_COND_MSG(wd.transient_parent != INVALID_WINDOW_ID, "Can't make a window transient if the 'on top' flag is active.");
ERR_FAIL_COND_MSG(p_enabled && wd.embed_parent, "Embedded window can't become on top.");
if (p_enabled && wd.embed_parent) {
print_line("Embedded window can't become on top.");
return;
}
if (p_enabled && wd.fullscreen) {
_set_wm_maximized(p_window, true);
}
@ -3015,7 +3039,10 @@ void DisplayServerX11::window_set_flag(WindowFlags p_flag, bool p_enabled, Windo
ERR_FAIL_COND_MSG(p_window == MAIN_WINDOW_ID, "Main window can't be popup.");
ERR_FAIL_COND_MSG((xwa.map_state == IsViewable) && (wd.is_popup != p_enabled), "Popup flag can't changed while window is opened.");
ERR_FAIL_COND_MSG(p_enabled && wd.embed_parent, "Embedded window can't be popup.");
if (p_enabled && wd.embed_parent) {
print_line("Embedded window can't be popup.");
return;
}
wd.is_popup = p_enabled;
} break;
default: {

View File

@ -84,11 +84,6 @@
#define WM_INDICATOR_CALLBACK_MESSAGE (WM_USER + 1)
#if defined(__GNUC__)
// Workaround GCC warning from -Wcast-function-type.
#define GetProcAddress (void *)GetProcAddress
#endif
static String format_error_message(DWORD id) {
LPWSTR messageBuffer = nullptr;
size_t size = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
@ -1295,7 +1290,7 @@ static int QueryDpiForMonitor(HMONITOR hmon, _MonitorDpiType dpiType = MDT_Defau
if (Shcore == nullptr) {
Shcore = LoadLibraryW(L"Shcore.dll");
getDPIForMonitor = Shcore ? (GetDPIForMonitor_t)GetProcAddress(Shcore, "GetDpiForMonitor") : nullptr;
getDPIForMonitor = Shcore ? (GetDPIForMonitor_t)(void *)GetProcAddress(Shcore, "GetDpiForMonitor") : nullptr;
if ((Shcore == nullptr) || (getDPIForMonitor == nullptr)) {
if (Shcore) {
@ -1975,7 +1970,10 @@ void DisplayServerWindows::window_set_current_screen(int p_screen, WindowID p_wi
return;
}
const WindowData &wd = windows[p_window];
ERR_FAIL_COND_MSG(wd.parent_hwnd, "Embedded window can't be moved to another screen.");
if (wd.parent_hwnd) {
print_line("Embedded window can't be moved to another screen.");
return;
}
if (wd.fullscreen) {
Point2 pos = screen_get_position(p_screen) + _get_screens_origin();
Size2 size = screen_get_size(p_screen);
@ -2056,7 +2054,10 @@ void DisplayServerWindows::window_set_position(const Point2i &p_position, Window
ERR_FAIL_COND(!windows.has(p_window));
WindowData &wd = windows[p_window];
ERR_FAIL_COND_MSG(wd.parent_hwnd, "Embedded window can't be moved.");
if (wd.parent_hwnd) {
print_line("Embedded window can't be moved.");
return;
}
if (wd.fullscreen || wd.maximized) {
return;
@ -2142,7 +2143,10 @@ void DisplayServerWindows::window_set_max_size(const Size2i p_size, WindowID p_w
ERR_FAIL_COND(!windows.has(p_window));
WindowData &wd = windows[p_window];
ERR_FAIL_COND_MSG(wd.parent_hwnd, "Embedded windows can't have a maximum size.");
if (wd.parent_hwnd) {
print_line("Embedded windows can't have a maximum size.");
return;
}
if ((p_size != Size2()) && ((p_size.x < wd.min_size.x) || (p_size.y < wd.min_size.y))) {
ERR_PRINT("Maximum window size can't be smaller than minimum window size!");
@ -2165,7 +2169,10 @@ void DisplayServerWindows::window_set_min_size(const Size2i p_size, WindowID p_w
ERR_FAIL_COND(!windows.has(p_window));
WindowData &wd = windows[p_window];
ERR_FAIL_COND_MSG(wd.parent_hwnd, "Embedded windows can't have a minimum size.");
if (wd.parent_hwnd) {
print_line("Embedded windows can't have a minimum size.");
return;
}
if ((p_size != Size2()) && (wd.max_size != Size2()) && ((p_size.x > wd.max_size.x) || (p_size.y > wd.max_size.y))) {
ERR_PRINT("Minimum window size can't be larger than maximum window size!");
@ -2188,7 +2195,10 @@ void DisplayServerWindows::window_set_size(const Size2i p_size, WindowID p_windo
ERR_FAIL_COND(!windows.has(p_window));
WindowData &wd = windows[p_window];
ERR_FAIL_COND_MSG(wd.parent_hwnd, "Embedded window can't be resized.");
if (wd.parent_hwnd) {
print_line("Embedded window can't be resized.");
return;
}
if (wd.fullscreen || wd.maximized) {
return;
@ -2346,7 +2356,10 @@ void DisplayServerWindows::window_set_mode(WindowMode p_mode, WindowID p_window)
ERR_FAIL_COND(!windows.has(p_window));
WindowData &wd = windows[p_window];
ERR_FAIL_COND_MSG(p_mode != WINDOW_MODE_WINDOWED && wd.parent_hwnd, "Embedded window only supports Windowed mode.");
if (p_mode != WINDOW_MODE_WINDOWED && wd.parent_hwnd) {
print_line("Embedded window only supports Windowed mode.");
return;
}
bool was_fullscreen = wd.fullscreen;
wd.was_fullscreen_pre_min = false;
@ -2481,7 +2494,10 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W
WindowData &wd = windows[p_window];
switch (p_flag) {
case WINDOW_FLAG_RESIZE_DISABLED: {
ERR_FAIL_COND_MSG(p_enabled && wd.parent_hwnd, "Embedded window resize can't be disabled.");
if (p_enabled && wd.parent_hwnd) {
print_line("Embedded window resize can't be disabled.");
return;
}
wd.resizable = !p_enabled;
_update_window_style(p_window);
} break;
@ -2493,7 +2509,10 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W
} break;
case WINDOW_FLAG_ALWAYS_ON_TOP: {
ERR_FAIL_COND_MSG(wd.transient_parent != INVALID_WINDOW_ID && p_enabled, "Transient windows can't become on top.");
ERR_FAIL_COND_MSG(p_enabled && wd.parent_hwnd, "Embedded window can't become on top.");
if (p_enabled && wd.parent_hwnd) {
print_line("Embedded window can't become on top.");
return;
}
wd.always_on_top = p_enabled;
_update_window_style(p_window);
} break;
@ -2553,7 +2572,10 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W
case WINDOW_FLAG_POPUP: {
ERR_FAIL_COND_MSG(p_window == MAIN_WINDOW_ID, "Main window can't be popup.");
ERR_FAIL_COND_MSG(IsWindowVisible(wd.hWnd) && (wd.is_popup != p_enabled), "Popup flag can't changed while window is opened.");
ERR_FAIL_COND_MSG(p_enabled && wd.parent_hwnd, "Embedded window can't be popup.");
if (p_enabled && wd.parent_hwnd) {
print_line("Embedded window can't be popup.");
return;
}
wd.is_popup = p_enabled;
} break;
default:
@ -3138,7 +3160,7 @@ Error DisplayServerWindows::dialog_show(String p_title, String p_description, Ve
if (comctl) {
typedef HRESULT(WINAPI * TaskDialogIndirectPtr)(const TASKDIALOGCONFIG *pTaskConfig, int *pnButton, int *pnRadioButton, BOOL *pfVerificationFlagChecked);
TaskDialogIndirectPtr task_dialog_indirect = (TaskDialogIndirectPtr)GetProcAddress(comctl, "TaskDialogIndirect");
TaskDialogIndirectPtr task_dialog_indirect = (TaskDialogIndirectPtr)(void *)GetProcAddress(comctl, "TaskDialogIndirect");
int button_pressed;
if (task_dialog_indirect && SUCCEEDED(task_dialog_indirect(&config, &button_pressed, nullptr, nullptr))) {
@ -6591,9 +6613,9 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
HMODULE nt_lib = LoadLibraryW(L"ntdll.dll");
if (nt_lib) {
WineGetVersionPtr wine_get_version = (WineGetVersionPtr)GetProcAddress(nt_lib, "wine_get_version"); // Do not read Windows build number under Wine, it can be set to arbitrary value.
WineGetVersionPtr wine_get_version = (WineGetVersionPtr)(void *)GetProcAddress(nt_lib, "wine_get_version"); // Do not read Windows build number under Wine, it can be set to arbitrary value.
if (!wine_get_version) {
RtlGetVersionPtr RtlGetVersion = (RtlGetVersionPtr)GetProcAddress(nt_lib, "RtlGetVersion");
RtlGetVersionPtr RtlGetVersion = (RtlGetVersionPtr)(void *)GetProcAddress(nt_lib, "RtlGetVersion");
if (RtlGetVersion) {
RtlGetVersion(&os_ver);
}
@ -6604,28 +6626,28 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
// Load Shell API.
HMODULE shellapi_lib = LoadLibraryW(L"shlwapi.dll");
if (shellapi_lib) {
load_indirect_string = (SHLoadIndirectStringPtr)GetProcAddress(shellapi_lib, "SHLoadIndirectString");
load_indirect_string = (SHLoadIndirectStringPtr)(void *)GetProcAddress(shellapi_lib, "SHLoadIndirectString");
}
// Load UXTheme, available on Windows 10+ only.
if (os_ver.dwBuildNumber >= 10240) {
HMODULE ux_theme_lib = LoadLibraryW(L"uxtheme.dll");
if (ux_theme_lib) {
ShouldAppsUseDarkMode = (ShouldAppsUseDarkModePtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(132));
GetImmersiveColorFromColorSetEx = (GetImmersiveColorFromColorSetExPtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(95));
GetImmersiveColorTypeFromName = (GetImmersiveColorTypeFromNamePtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(96));
GetImmersiveUserColorSetPreference = (GetImmersiveUserColorSetPreferencePtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(98));
ShouldAppsUseDarkMode = (ShouldAppsUseDarkModePtr)(void *)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(132));
GetImmersiveColorFromColorSetEx = (GetImmersiveColorFromColorSetExPtr)(void *)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(95));
GetImmersiveColorTypeFromName = (GetImmersiveColorTypeFromNamePtr)(void *)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(96));
GetImmersiveUserColorSetPreference = (GetImmersiveUserColorSetPreferencePtr)(void *)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(98));
if (os_ver.dwBuildNumber >= 17763) { // Windows 10 Redstone 5 (1809)+ only.
AllowDarkModeForAppPtr AllowDarkModeForApp = nullptr;
SetPreferredAppModePtr SetPreferredAppMode = nullptr;
FlushMenuThemesPtr FlushMenuThemes = nullptr;
if (os_ver.dwBuildNumber < 18362) { // Windows 10 Redstone 5 (1809) and 19H1 (1903) only.
AllowDarkModeForApp = (AllowDarkModeForAppPtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(135));
AllowDarkModeForApp = (AllowDarkModeForAppPtr)(void *)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(135));
} else { // Windows 10 19H2 (1909)+ only.
SetPreferredAppMode = (SetPreferredAppModePtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(135));
FlushMenuThemes = (FlushMenuThemesPtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(136));
SetPreferredAppMode = (SetPreferredAppModePtr)(void *)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(135));
FlushMenuThemes = (FlushMenuThemesPtr)(void *)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(136));
}
RefreshImmersiveColorPolicyStatePtr RefreshImmersiveColorPolicyState = (RefreshImmersiveColorPolicyStatePtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(104));
RefreshImmersiveColorPolicyStatePtr RefreshImmersiveColorPolicyState = (RefreshImmersiveColorPolicyStatePtr)(void *)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(104));
if (ShouldAppsUseDarkMode) {
bool dark_mode = ShouldAppsUseDarkMode();
if (SetPreferredAppMode) {
@ -6658,10 +6680,10 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
// Note: DPI conversion API, available on Windows 8.1+ only.
HMODULE user32_lib = LoadLibraryW(L"user32.dll");
if (user32_lib) {
win8p_GetPointerType = (GetPointerTypePtr)GetProcAddress(user32_lib, "GetPointerType");
win8p_GetPointerPenInfo = (GetPointerPenInfoPtr)GetProcAddress(user32_lib, "GetPointerPenInfo");
win81p_LogicalToPhysicalPointForPerMonitorDPI = (LogicalToPhysicalPointForPerMonitorDPIPtr)GetProcAddress(user32_lib, "LogicalToPhysicalPointForPerMonitorDPI");
win81p_PhysicalToLogicalPointForPerMonitorDPI = (PhysicalToLogicalPointForPerMonitorDPIPtr)GetProcAddress(user32_lib, "PhysicalToLogicalPointForPerMonitorDPI");
win8p_GetPointerType = (GetPointerTypePtr)(void *)GetProcAddress(user32_lib, "GetPointerType");
win8p_GetPointerPenInfo = (GetPointerPenInfoPtr)(void *)GetProcAddress(user32_lib, "GetPointerPenInfo");
win81p_LogicalToPhysicalPointForPerMonitorDPI = (LogicalToPhysicalPointForPerMonitorDPIPtr)(void *)GetProcAddress(user32_lib, "LogicalToPhysicalPointForPerMonitorDPI");
win81p_PhysicalToLogicalPointForPerMonitorDPI = (PhysicalToLogicalPointForPerMonitorDPIPtr)(void *)GetProcAddress(user32_lib, "PhysicalToLogicalPointForPerMonitorDPI");
winink_available = win8p_GetPointerType && win8p_GetPointerPenInfo;
}
@ -6673,11 +6695,11 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
// Note: Wacom WinTab driver API for pen input, for devices incompatible with Windows Ink.
HMODULE wintab_lib = LoadLibraryW(L"wintab32.dll");
if (wintab_lib) {
wintab_WTOpen = (WTOpenPtr)GetProcAddress(wintab_lib, "WTOpenW");
wintab_WTClose = (WTClosePtr)GetProcAddress(wintab_lib, "WTClose");
wintab_WTInfo = (WTInfoPtr)GetProcAddress(wintab_lib, "WTInfoW");
wintab_WTPacket = (WTPacketPtr)GetProcAddress(wintab_lib, "WTPacket");
wintab_WTEnable = (WTEnablePtr)GetProcAddress(wintab_lib, "WTEnable");
wintab_WTOpen = (WTOpenPtr)(void *)GetProcAddress(wintab_lib, "WTOpenW");
wintab_WTClose = (WTClosePtr)(void *)GetProcAddress(wintab_lib, "WTClose");
wintab_WTInfo = (WTInfoPtr)(void *)GetProcAddress(wintab_lib, "WTInfoW");
wintab_WTPacket = (WTPacketPtr)(void *)GetProcAddress(wintab_lib, "WTPacket");
wintab_WTEnable = (WTEnablePtr)(void *)GetProcAddress(wintab_lib, "WTEnable");
wintab_available = wintab_WTOpen && wintab_WTClose && wintab_WTInfo && wintab_WTPacket && wintab_WTEnable;
}
@ -6715,7 +6737,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
if (Shcore != nullptr) {
typedef HRESULT(WINAPI * SetProcessDpiAwareness_t)(SHC_PROCESS_DPI_AWARENESS);
SetProcessDpiAwareness_t SetProcessDpiAwareness = (SetProcessDpiAwareness_t)GetProcAddress(Shcore, "SetProcessDpiAwareness");
SetProcessDpiAwareness_t SetProcessDpiAwareness = (SetProcessDpiAwareness_t)(void *)GetProcAddress(Shcore, "SetProcessDpiAwareness");
if (SetProcessDpiAwareness) {
SetProcessDpiAwareness(SHC_PROCESS_SYSTEM_DPI_AWARE);
@ -6726,7 +6748,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
HMODULE comctl32 = LoadLibraryW(L"comctl32.dll");
if (comctl32) {
typedef BOOL(WINAPI * InitCommonControlsExPtr)(_In_ const INITCOMMONCONTROLSEX *picce);
InitCommonControlsExPtr init_common_controls_ex = (InitCommonControlsExPtr)GetProcAddress(comctl32, "InitCommonControlsEx");
InitCommonControlsExPtr init_common_controls_ex = (InitCommonControlsExPtr)(void *)GetProcAddress(comctl32, "InitCommonControlsEx");
// Fails if the incorrect version was loaded. Probably not a big enough deal to print an error about.
if (init_common_controls_ex) {

View File

@ -50,11 +50,6 @@
#define _WGL_CONTEXT_DEBUG_BIT_ARB 0x0001
#if defined(__GNUC__)
// Workaround GCC warning from -Wcast-function-type.
#define GetProcAddress (void *)GetProcAddress
#endif
typedef HGLRC(APIENTRY *PFNWGLCREATECONTEXT)(HDC);
typedef BOOL(APIENTRY *PFNWGLDELETECONTEXT)(HGLRC);
typedef BOOL(APIENTRY *PFNWGLMAKECURRENT)(HDC, HGLRC);
@ -364,10 +359,10 @@ Error GLManagerNative_Windows::_create_context(GLWindow &win, GLDisplay &gl_disp
if (!module) {
return ERR_CANT_CREATE;
}
gd_wglCreateContext = (PFNWGLCREATECONTEXT)GetProcAddress(module, "wglCreateContext");
gd_wglMakeCurrent = (PFNWGLMAKECURRENT)GetProcAddress(module, "wglMakeCurrent");
gd_wglDeleteContext = (PFNWGLDELETECONTEXT)GetProcAddress(module, "wglDeleteContext");
gd_wglGetProcAddress = (PFNWGLGETPROCADDRESS)GetProcAddress(module, "wglGetProcAddress");
gd_wglCreateContext = (PFNWGLCREATECONTEXT)(void *)GetProcAddress(module, "wglCreateContext");
gd_wglMakeCurrent = (PFNWGLMAKECURRENT)(void *)GetProcAddress(module, "wglMakeCurrent");
gd_wglDeleteContext = (PFNWGLDELETECONTEXT)(void *)GetProcAddress(module, "wglDeleteContext");
gd_wglGetProcAddress = (PFNWGLGETPROCADDRESS)(void *)GetProcAddress(module, "wglGetProcAddress");
if (!gd_wglCreateContext || !gd_wglMakeCurrent || !gd_wglDeleteContext || !gd_wglGetProcAddress) {
return ERR_CANT_CREATE;
}

View File

@ -33,11 +33,6 @@
#include <oleauto.h>
#include <wbemidl.h>
#if defined(__GNUC__)
// Workaround GCC warning from -Wcast-function-type.
#define GetProcAddress (void *)GetProcAddress
#endif
DWORD WINAPI _xinput_get_state(DWORD dwUserIndex, XINPUT_STATE *pState) {
return ERROR_DEVICE_NOT_CONNECTED;
}
@ -597,8 +592,8 @@ void JoypadWindows::load_xinput() {
// (LPCSTR)100 is the magic number to get XInputGetStateEx, which also provides the state for the guide button
LPCSTR get_state_func_name = legacy_xinput ? "XInputGetState" : (LPCSTR)100;
XInputGetState_t func = (XInputGetState_t)GetProcAddress((HMODULE)xinput_dll, get_state_func_name);
XInputSetState_t set_func = (XInputSetState_t)GetProcAddress((HMODULE)xinput_dll, "XInputSetState");
XInputGetState_t func = (XInputGetState_t)(void *)GetProcAddress((HMODULE)xinput_dll, get_state_func_name);
XInputSetState_t set_func = (XInputSetState_t)(void *)GetProcAddress((HMODULE)xinput_dll, "XInputSetState");
if (!func || !set_func) {
unload_xinput();
return;
@ -608,7 +603,7 @@ void JoypadWindows::load_xinput() {
winmm_dll = LoadLibrary("Winmm.dll");
if (winmm_dll) {
joyGetDevCaps_t caps_func = (joyGetDevCaps_t)GetProcAddress((HMODULE)winmm_dll, "joyGetDevCapsW");
joyGetDevCaps_t caps_func = (joyGetDevCaps_t)(void *)GetProcAddress((HMODULE)winmm_dll, "joyGetDevCapsW");
if (caps_func) {
winmm_get_joycaps = caps_func;
} else {

View File

@ -106,11 +106,6 @@ __declspec(dllexport) void NoHotPatch() {} // Disable Nahimic code injection.
#define DWRITE_FONT_WEIGHT_SEMI_LIGHT (DWRITE_FONT_WEIGHT)350
#endif
#if defined(__GNUC__)
// Workaround GCC warning from -Wcast-function-type.
#define GetProcAddress (void *)GetProcAddress
#endif
static String fix_path(const String &p_path) {
String path = p_path;
if (p_path.is_relative_path()) {
@ -503,8 +498,8 @@ Error OS_Windows::open_dynamic_library(const String &p_path, void *&p_library_ha
typedef DLL_DIRECTORY_COOKIE(WINAPI * PAddDllDirectory)(PCWSTR);
typedef BOOL(WINAPI * PRemoveDllDirectory)(DLL_DIRECTORY_COOKIE);
PAddDllDirectory add_dll_directory = (PAddDllDirectory)GetProcAddress(GetModuleHandle("kernel32.dll"), "AddDllDirectory");
PRemoveDllDirectory remove_dll_directory = (PRemoveDllDirectory)GetProcAddress(GetModuleHandle("kernel32.dll"), "RemoveDllDirectory");
PAddDllDirectory add_dll_directory = (PAddDllDirectory)(void *)GetProcAddress(GetModuleHandle("kernel32.dll"), "AddDllDirectory");
PRemoveDllDirectory remove_dll_directory = (PRemoveDllDirectory)(void *)GetProcAddress(GetModuleHandle("kernel32.dll"), "RemoveDllDirectory");
bool has_dll_directory_api = ((add_dll_directory != nullptr) && (remove_dll_directory != nullptr));
DLL_DIRECTORY_COOKIE cookie = nullptr;
@ -603,7 +598,7 @@ String OS_Windows::get_distribution_name() const {
}
String OS_Windows::get_version() const {
RtlGetVersionPtr version_ptr = (RtlGetVersionPtr)GetProcAddress(GetModuleHandle("ntdll.dll"), "RtlGetVersion");
RtlGetVersionPtr version_ptr = (RtlGetVersionPtr)(void *)GetProcAddress(GetModuleHandle("ntdll.dll"), "RtlGetVersion");
if (version_ptr != nullptr) {
RTL_OSVERSIONINFOEXW fow;
ZeroMemory(&fow, sizeof(fow));
@ -616,7 +611,7 @@ String OS_Windows::get_version() const {
}
String OS_Windows::get_version_alias() const {
RtlGetVersionPtr version_ptr = (RtlGetVersionPtr)GetProcAddress(GetModuleHandle("ntdll.dll"), "RtlGetVersion");
RtlGetVersionPtr version_ptr = (RtlGetVersionPtr)(void *)GetProcAddress(GetModuleHandle("ntdll.dll"), "RtlGetVersion");
if (version_ptr != nullptr) {
RTL_OSVERSIONINFOEXW fow;
ZeroMemory(&fow, sizeof(fow));
@ -789,7 +784,7 @@ bool OS_Windows::get_user_prefers_integrated_gpu() const {
HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
if (kernel32) {
using GetCurrentApplicationUserModelIdPtr = LONG(WINAPI *)(UINT32 * length, PWSTR id);
GetCurrentApplicationUserModelIdPtr GetCurrentApplicationUserModelId = (GetCurrentApplicationUserModelIdPtr)GetProcAddress(kernel32, "GetCurrentApplicationUserModelId");
GetCurrentApplicationUserModelIdPtr GetCurrentApplicationUserModelId = (GetCurrentApplicationUserModelIdPtr)(void *)GetProcAddress(kernel32, "GetCurrentApplicationUserModelId");
if (GetCurrentApplicationUserModelId) {
UINT32 length = sizeof(value_name) / sizeof(value_name[0]);
@ -991,7 +986,7 @@ Dictionary OS_Windows::get_memory_info() const {
GetPerformanceInfo(&pref_info, sizeof(pref_info));
typedef void(WINAPI * PGetCurrentThreadStackLimits)(PULONG_PTR, PULONG_PTR);
PGetCurrentThreadStackLimits GetCurrentThreadStackLimits = (PGetCurrentThreadStackLimits)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetCurrentThreadStackLimits");
PGetCurrentThreadStackLimits GetCurrentThreadStackLimits = (PGetCurrentThreadStackLimits)(void *)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetCurrentThreadStackLimits");
ULONG_PTR LowLimit = 0;
ULONG_PTR HighLimit = 0;

View File

@ -53,11 +53,6 @@
#define WGL_RENDERER 0x1F01
#define WGL_VERSION 0x1F02
#if defined(__GNUC__)
// Workaround GCC warning from -Wcast-function-type.
#define GetProcAddress (void *)GetProcAddress
#endif
typedef HGLRC(APIENTRY *PFNWGLCREATECONTEXT)(HDC);
typedef BOOL(APIENTRY *PFNWGLDELETECONTEXT)(HGLRC);
typedef BOOL(APIENTRY *PFNWGLMAKECURRENT)(HDC, HGLRC);
@ -80,10 +75,10 @@ Dictionary detect_wgl() {
if (!module) {
return gl_info;
}
gd_wglCreateContext = (PFNWGLCREATECONTEXT)GetProcAddress(module, "wglCreateContext");
gd_wglMakeCurrent = (PFNWGLMAKECURRENT)GetProcAddress(module, "wglMakeCurrent");
gd_wglDeleteContext = (PFNWGLDELETECONTEXT)GetProcAddress(module, "wglDeleteContext");
gd_wglGetProcAddress = (PFNWGLGETPROCADDRESS)GetProcAddress(module, "wglGetProcAddress");
gd_wglCreateContext = (PFNWGLCREATECONTEXT)(void *)GetProcAddress(module, "wglCreateContext");
gd_wglMakeCurrent = (PFNWGLMAKECURRENT)(void *)GetProcAddress(module, "wglMakeCurrent");
gd_wglDeleteContext = (PFNWGLDELETECONTEXT)(void *)GetProcAddress(module, "wglDeleteContext");
gd_wglGetProcAddress = (PFNWGLGETPROCADDRESS)(void *)GetProcAddress(module, "wglGetProcAddress");
if (!gd_wglCreateContext || !gd_wglMakeCurrent || !gd_wglDeleteContext || !gd_wglGetProcAddress) {
return gl_info;
}
@ -143,7 +138,7 @@ Dictionary detect_wgl() {
HGLRC new_hRC = gd_wglCreateContextAttribsARB(hDC, nullptr, attribs);
if (new_hRC) {
if (gd_wglMakeCurrent(hDC, new_hRC)) {
PFNWGLGETSTRINGPROC gd_wglGetString = (PFNWGLGETSTRINGPROC)GetProcAddress(module, "glGetString");
PFNWGLGETSTRINGPROC gd_wglGetString = (PFNWGLGETSTRINGPROC)(void *)GetProcAddress(module, "glGetString");
if (gd_wglGetString) {
const char *prefixes[] = {
"OpenGL ES-CM ",

View File

@ -799,7 +799,7 @@ void MaterialStorage::MaterialData::update_uniform_buffer(const HashMap<StringNa
} else if (E.value.default_value.size()) {
//default value
_fill_std140_ubo_value(E.value.type, E.value.default_value, data, p_use_linear_color);
_fill_std140_ubo_value(E.value.type, E.value.default_value, data, E.value.hint == ShaderLanguage::ShaderNode::Uniform::HINT_SOURCE_COLOR && p_use_linear_color);
//value=E.value.default_value;
} else {
//zero because it was not provided