Virtualx Game Engine. Forked from Godot 3.6
Find a file
Sai Nane e6a7c63125 binder_common: Fix uninitialized marshalling
C# uses `long`s to access many native values. With `PtrToArg<m_enum>` and
`PtrToArg<bitfield<m_enum>>` this isn't a problem, as C++ code converts
through a `*(int64_t*)` cast in assignment, so all 64-bits are initialized.

However, with `PtrToArg<char32_t>`, value assignment happens through an
`*(int *)` cast, leaving 32 bits uninitialized where `int` is 32 bits. On
platforms where `int` is 16 bits, there are presumably 48 bits uninitialized,
though there are very few platforms where this is still the case.

The easiest way to see the practical effects of this is by looking at
`EventInputKey.Unicode`:

```csharp
    public override void _Input(InputEvent @event) {
        if (@event is InputEventKey keyEvent) {
            if (keyEvent.IsPressed() && !keyEvent.Echo) {
                var raw = keyEvent.Unicode;
                var value = raw & 0xffffffff;
                GD.Print($"Key pressed: raw: {raw}; masked: {(char) value} ({value})");
            }
        }
    }
```

Pressing 'a' emits the following line:
```
Key pressed: raw: -3617008645356650399; masked: a (97)
```

Examining execution flow in gdb shows this conversion going through the
following line:
```
PtrToArg<char32_t>::encode (p_ptr=0x7ffcd5bb4b18, p_val=97 U'a') at ./core/variant/binder_common.h:221
221			*(int *)p_ptr = p_val;
```

Here, `p_val` is still 97, which is the value `InputEventKey.Unicode`
is expected to have. After assignment, `p *(int64_t *)0x7ffcd5bb4b18` displays
`-3617008645356650399`, with only the lower 32 bits being properly assigned,
and is the value we see from C#.

With this patch applied, the above testing `_Input` now prints:
```
Key pressed: raw: 97; masked: a (97)
```

Thank you to blujay1269 for asking about an unexpected value they saw in
`EventInputKey.Unicode`, which prompted this investigation.
2024-08-09 05:15:54 +00:00
.github CI: Update Emscripten to 3.1.64 2024-08-08 11:17:35 +02:00
core binder_common: Fix uninitialized marshalling 2024-08-09 05:15:54 +00:00
doc Document converting a TileMap node to TileMapLayer using the editor 2024-08-07 11:15:29 +02:00
drivers Merge pull request #95074 from RandomShaper/d3d12_exit_crash 2024-08-08 10:16:24 +02:00
editor Fix reimport file multiple scenes 2024-08-07 20:22:46 -04:00
main Merge pull request #94796 from kus04e4ek/backfall 2024-07-29 15:17:26 +02:00
misc Merge pull request #94652 from shana/fix-header-guards 2024-07-23 16:19:15 +02:00
modules Merge pull request #95194 from Faless/mp/fix_relay_negative_target 2024-08-08 10:16:31 +02:00
platform [macOS] Load OpenGL.framework by path to avoid issues with non-Latin executable names. 2024-08-07 11:57:27 +03:00
scene Merge pull request #95239 from AThousandShips/skeleton_internal_fix 2024-08-07 12:08:12 +02:00
servers Fix LightmapGI causes crash when using --headless 2024-08-07 11:38:05 +02:00
tests Fix compilation failure in test_graph_node.h with disable_exceptions=false 2024-07-27 15:00:58 +02:00
thirdparty [ENet] Better handle disconnected peers in DTLS server 2024-08-02 16:07:37 +02:00
.clang-format
.clang-tidy CI: Add pre-commit hook for clang-tidy 2024-06-17 11:27:18 -05:00
.editorconfig CI: Add svgo pre-commit hook 2024-06-23 08:14:54 -05:00
.git-blame-ignore-revs
.gitattributes
.gitignore
.mailmap
.pre-commit-config.yaml CI: Add svgo pre-commit hook 2024-06-23 08:14:54 -05:00
AUTHORS.md
CHANGELOG.md
CONTRIBUTING.md Update godot documentation contribution link 2024-07-20 20:51:11 -06:00
COPYRIGHT.txt Remove unused Bitstream Vera license 2024-07-26 22:51:09 -03:00
DONORS.md
gles3_builders.py
glsl_builders.py
godot.manifest
icon.png
icon.svg Style: Optimize .svg files with svgo 2024-06-23 08:15:19 -05:00
icon_outlined.png
icon_outlined.svg Style: Optimize .svg files with svgo 2024-06-23 08:15:19 -05:00
LICENSE.txt
logo.png
logo.svg Style: Optimize .svg files with svgo 2024-06-23 08:15:19 -05:00
LOGO_LICENSE.txt
logo_outlined.png
logo_outlined.svg Style: Optimize .svg files with svgo 2024-06-23 08:15:19 -05:00
methods.py Merge pull request #93753 from Repiteo/scons/visual-studio-fixes 2024-07-22 17:30:25 +02:00
platform_methods.py
pyproject.toml
README.md
SConstruct SCons: Load optional ninja tool before setting its options 2024-07-31 23:03:59 +02:00
scu_builders.py
version.py Bump version to 4.3-rc 2024-07-24 13:04:22 +02:00

Godot Engine

Godot Engine logo

2D and 3D cross-platform game engine

Godot Engine is a feature-packed, cross-platform game engine to create 2D and 3D games from a unified interface. It provides a comprehensive set of common tools, so that users can focus on making games without having to reinvent the wheel. Games can be exported with one click to a number of platforms, including the major desktop platforms (Linux, macOS, Windows), mobile platforms (Android, iOS), as well as Web-based platforms and consoles.

Free, open source and community-driven

Godot is completely free and open source under the very permissive MIT license. No strings attached, no royalties, nothing. The users' games are theirs, down to the last line of engine code. Godot's development is fully independent and community-driven, empowering users to help shape their engine to match their expectations. It is supported by the Godot Foundation not-for-profit.

Before being open sourced in February 2014, Godot had been developed by Juan Linietsky and Ariel Manzur (both still maintaining the project) for several years as an in-house engine, used to publish several work-for-hire titles.

Screenshot of a 3D scene in the Godot Engine editor

Getting the engine

Binary downloads

Official binaries for the Godot editor and the export templates can be found on the Godot website.

Compiling from source

See the official docs for compilation instructions for every supported platform.

Community and contributing

Godot is not only an engine but an ever-growing community of users and engine developers. The main community channels are listed on the homepage.

The best way to get in touch with the core engine developers is to join the Godot Contributors Chat.

To get started contributing to the project, see the contributing guide. This document also includes guidelines for reporting bugs.

Documentation and demos

The official documentation is hosted on Read the Docs. It is maintained by the Godot community in its own GitHub repository.

The class reference is also accessible from the Godot editor.

We also maintain official demos in their own GitHub repository as well as a list of awesome Godot community resources.

There are also a number of other learning resources provided by the community, such as text and video tutorials, demos, etc. Consult the community channels for more information.

Code Triagers Badge Translate on Weblate TODOs