Commit Graph

7452 Commits

Author SHA1 Message Date
Rémi Verschelde 71accb9008
Merge pull request #94679 from rune-scape/remove-unused-initialize_ref
Remove unused `initialize_ref`
2024-08-28 00:12:16 +02:00
Rémi Verschelde 3e8d051a4a
Merge pull request #94068 from dalexeev/core-remove-is-gpl-reversed
Core: Remove unused method `_is_gpl_reversed()`
2024-08-28 00:11:58 +02:00
Rémi Verschelde 330fca1ffd
Merge pull request #93985 from alvinhochun/windows-gpu-pref
Respect integrated GPU preference in Windows Settings
2024-08-28 00:11:45 +02:00
Rémi Verschelde 2fadd095a7
Merge pull request #93893 from Togira123/fix-rand-weighted-return-value
Fix `rand_weighted` incorrectly returning -1
2024-08-28 00:11:35 +02:00
Rémi Verschelde 1e6b6eaf49
Merge pull request #92123 from timothyqiu/estimate-end
Change param name of AStar's `_estimate_cost` method
2024-08-28 00:10:47 +02:00
Rémi Verschelde 9c7cf5440c
Merge pull request #91868 from Chaosus/astargrid_get_point_positions_in_region
Add a method to retrieve all points within a region to `AStarGrid2D`
2024-08-28 00:10:42 +02:00
Kongfa Waroros bfb5570c03 Fix ResourceLoader is not verbosely printing a resource path on loading 2024-08-28 03:37:51 +07:00
Rémi Verschelde 012ccbc301
Merge pull request #95048 from KoBeWi/keep_the_party_going
Add `keep_screen_on` editor setting
2024-08-27 22:27:35 +02:00
Rémi Verschelde 8ae2c3a000
Merge pull request #93605 from RadiantUwU/thread-barriers
Add optional count argument to `Semaphore::post`
2024-08-27 22:27:21 +02:00
Rémi Verschelde 6e3320446a
Merge pull request #92799 from BlueCube3310/image-detech-signed
Image: Add a method for detecting signed values
2024-08-27 22:27:18 +02:00
Rémi Verschelde 142d33211c
Merge pull request #96173 from Repiteo/core/fix-unreachable-code
Core: Fix unreachable code
2024-08-27 17:52:47 +02:00
Rémi Verschelde 431c5839fe
Merge pull request #96168 from CreatedBySeb/remove-user-prefix
Remove confusing USER prefix from script-logged errors
2024-08-27 17:52:40 +02:00
Thaddeus Crews 231f3323d3
Core: Fix unreachable code 2024-08-27 10:26:06 -05:00
Radiant 6311ee5bd5 Add optional count argument to Sempahore::post
Co-authored-by: RandomShaper <RandomShaper@users.noreply.github.com>
Co-authored-by: A Thousand Ships (she/her) <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: Mickeon <Mickeon@users.noreply.github.com>
2024-08-27 18:18:01 +03:00
Rémi Verschelde 9dfc41568a
Merge pull request #95984 from timothyqiu/what-identifier
Add `String.is_valid_unicode_identifier()`
2024-08-27 16:55:06 +02:00
Sébastien Dunne Fulmer c3ed8a842c
Remove confusing USER prefix from script-logged errors 2024-08-27 15:00:48 +01:00
Danil Alexeev 2d8f6c1b1d
GDScript: Fix message when calling non-tool function in tool mode 2024-08-27 12:30:15 +03:00
BlueCube3310 76c8211653 Image: Add a method for detecting signed values 2024-08-27 09:23:17 +02:00
Haoyu Qiu 8bf4ecc026 Add `String.is_valid_unicode_identifier()`
- Adds `is_valid_unicode_identifier()`
- Adds `is_valid_ascii_identifier()`
- Deprecates `is_valid_identifier()`
- Renames `validate_identifier()` to `validate_ascii_identifier()`
2024-08-27 11:34:08 +08:00
Rémi Verschelde 2e825c7d9c
Merge pull request #93141 from RadiantUwU/add_static_classdb_calls
Implement `ClassDB::class_call_static_method`
2024-08-26 23:28:36 +02:00
Rémi Verschelde c7702b350a
Merge pull request #92548 from AThousandShips/string_cleaning
[Core] Optimize some `String` methods
2024-08-26 23:28:24 +02:00
Rémi Verschelde ac5a528620
Merge pull request #84944 from KoBeWi/legacy_of_ancient_godots
Fix some legacy code
2024-08-26 23:28:14 +02:00
Rémi Verschelde 8019cdb444
Merge pull request #94137 from Craig-Stoneham/master
Improve template class conditionals with constexpr (code style)
2024-08-26 22:45:17 +02:00
Rémi Verschelde ce44c91223
Merge pull request #93739 from AThousandShips/lock_unlock
[Core] Allow locking/unlocking of `MutexLock`
2024-08-26 22:45:13 +02:00
Rémi Verschelde 0f16336be0
Merge pull request #93526 from m4gr3d/add_apksigner_util
[Android Editor] Add support for exporting platform binaries
2024-08-26 22:45:09 +02:00
Rémi Verschelde b78da13e2a
Merge pull request #93064 from Hilderin/fix-fileSystem-dock-wont-show-any-file-folders
Fix FileSystem dock won't show any file folders (v2)
2024-08-26 22:45:04 +02:00
Rémi Verschelde 8dad1ba482
Merge pull request #92933 from TokageItLab/match-concatenating
Match the coding style for concatenating String
2024-08-26 22:44:59 +02:00
Fredia Huya-Kouadio 794ea99240 Update the storage access handler logic to support accessing / retrieving contents with the `assets:/` prefix 2024-08-26 11:16:37 -07:00
Pedro J. Estébanez 9cbc3f1419 Change warning muting so it affects all levels, but locally 2024-08-26 13:13:29 +02:00
A Thousand Ships 723f5500f4
[Core] Allow locking/unlocking of `MutexLock` 2024-08-26 12:38:03 +02:00
Rémi Verschelde 0ba0be27c7
Merge pull request #94169 from RandomShaper/wtp_rl_prize
Batch of fixes for `WorkerThreadPool` and `ResourceLoader`
2024-08-26 10:51:25 +02:00
Rémi Verschelde 04f6321ecc
Merge pull request #91166 from raulsntos/gdextension/loader
GDExtension: Implement `GDExtensionLoader` concept
2024-08-26 10:51:21 +02:00
Rémi Verschelde b4f268fae8
Merge pull request #91018 from Daylily-Zeleen/daylily-zeleen/optionally_postinitialization_for_extension_owner
Allow ClassDB to create a Object without postinitialization for GDExtension.
2024-08-26 10:51:17 +02:00
Craig-Stoneham 604df4fc83 Improve Template Class Conditionals (Code Style)
Refactored the following template classes by replacing runtime checks with compile-time checks using if constexpr for improved code clarity and maintainability:

- RID_Alloc
- SortArray
- PagedAllocator

Changes made:

- Updated conditional checks for THREAD_SAFE in the RID_Alloc class.
- Updated conditional checks for Validate in the SortArray class.
- Updated conditional checks for thread_safe in the PagedAllocator class.
2024-08-25 18:10:51 +01:00
Matias N. Goldberg 59d0422dcd Disable extra memory tracking by default
PR #90993 added several debugging utilities.

Among them, advanced memory tracking through the use of custom
allocators and VK_EXT_device_memory_report.

However as issue #95967 reveals, it is dangerous to leave it on by
default because drivers (or even the Vulkan loader) can too easily
accidentally break custom allocators by allocating memory through std
malloc but then request us to deallocate it (or viceversa).

This PR fixes the following problems:
 - Adds --extra-gpu-memory-tracking cmd line argument
 - Adds missing enum entries to
RenderingContextDriverVulkan::VkTrackedObjectType
 - Adds RenderingDevice::get_driver_and_device_memory_report
    - GDScript users can easily check via print(
RenderingServer.get_rendering_device().get_driver_and_device_memory_report()
)
- Uses get_driver_and_device_memory_report on device lost for appending
further info.

Fixes #95967
2024-08-24 20:52:39 -03:00
Radiant 02fc4bbc2a Implement `ClassDB::class_call_static_method` 2024-08-23 02:56:29 +03:00
Raul Santos 4dd6e8eca5
GDExtension: Implement `GDExtensionLoader` concept
- Implements the concept of GDExtension loaders that can be used to customize how GDExtensions are loaded and initialized.
- Moves the parsing of `.gdextension` config files to the new `GDExtensionLibraryLoader`.
- `GDExtensionManager` is now meant to be the main way to load/unload extensions and can optionally take a `GDExtensionLoader`.
- `EditorFileSystem` avoids unloading extensions if the file still exists, this should prevent unloading extensions that are outside the user project.
2024-08-22 05:29:11 +02:00
Rémi Verschelde 568589c9d8
Merge pull request #90993 from darksylinc/matias-TheForge
Add debug utilities for Vulkan
2024-08-22 00:38:22 +02:00
Rémi Verschelde 39b77ea04e
Merge pull request #95790 from aaronfranke/rect-aabb-support
Simplify Rect2/AABB `get_support` function
2024-08-22 00:10:39 +02:00
Rémi Verschelde 091212b4f1
Merge pull request #93602 from aaronp64/inspector_latency
Improve Editor Inspector/Theme item lookup performance
2024-08-22 00:10:26 +02:00
Matias N. Goldberg 364f916f3f
Add debug utilities for Vulkan
Features:
- Debug-only tracking of objects by type. See
get_driver_allocs_by_object_type et al.
 - Debug-only Breadcrumb info for debugging GPU crashes and device lost
 - Performance report per frame from get_perf_report
- Some VMA calls had to be modified in order to insert the necessary
memory callbacks

Functionality marked as "debug-only" is only available in debug or dev
builds.

Misc fixes:
 - Early break optimization in RenderingDevice::uniform_set_create

============================

The work was performed by collaboration of TheForge and Google. I am
merely splitting it up into smaller PRs and cleaning it up.
2024-08-21 23:48:08 +02:00
Pedro J. Estébanez f4d76853b9 WorkerThreadPool (plus friends): Overhaul unlock allowance zones
This fixes a rare but possible deadlock, maybe due to undefined behavior. The new implementation is safer, at the cost of some added boilerplate.
2024-08-21 12:22:52 +02:00
Pedro J. Estébanez df23858488 ResourceLoader: Fix edge cases in the management of user tokens
1. Make handling of user tokens atomic:
   Loads started with the external-facing API used to perform a two-step setup of the user token. Between both, the mutex was unlocked without its reference count having been increased. A non-user-initiated load could therefore destroy the load task when it unreferenced the token.
   Those stages now happen atomically so in the one hand, the described race condition can't happen so the load task life insurance doesn't have a gap anymore and, on the other hand, the ugliness that the call to load could return `ERR_BUSY` if happening while other thread was between both steps is gone.
   The code has been refactored so the user token concerns are still outside the inner load start function, which is agnostic to that for a cleaner implementation.
2. Clear ambiguity between load operations running on `WorkerThreadPool`:
   The two cases are: single-loaded thread directly started by a user pool task and a load started by the system as part of a multi-threaded load.
   Since ensuring all the code dealing with this distinction would make it very complex, and error-prone, a different measure is applied instead: just take one of the cases out of the dicotomy. We now ensure every load happening on a pool thread has been initiated by the system.
   The way of achieving that is that a single-threaded user-started load initiated from a pool thread, is run as another task.
2024-08-21 12:22:52 +02:00
Pedro J. Estébanez 5c970db2e4 ResourceLoader: Optimize remap check by deferring until a non-mutex zone 2024-08-21 12:19:43 +02:00
Pedro J. Estébanez 28619e26cf ResourceLoader: Enhance deadlock prevention
Benefits:
- Simpler code. The main load function is renamed so it's apparent that it's not just a thread entry point anymore.
- Cache and thread modes of the original task are honored. A beautiful consequence of this is that, unlike formerly, re-issued loads can use the resource cache, which makes this mechanism much more performant.
- The newly added getter for caller task id in WorkerThreadPool allows to remove the custom tracking of that in ResourceLoader.
- The check to replace a cached resource and the replacement itself happen atomically. That fixes deadlock prevention leading to multiple resource instances of the same one on disk. As a side effect, it also makes the regular check for replace load mode more robust.
2024-08-21 12:19:43 +02:00
Pedro J. Estébanez bd0959ebdd ResourceLoader: Properly push & pop TLS state on recursive load tasks 2024-08-21 12:19:43 +02:00
Rémi Verschelde 5ca419e32c
Merge pull request #94801 from gamelessone/fix-cond-var
Fix use-after-free of `ConditionVariable` in `ResourceLoader`
2024-08-21 11:14:22 +02:00
Rémi Verschelde 4b8946102b
Merge pull request #91535 from BlueCube3310/betsy-bc6h
Add Betsy to speed up BC6 compression
2024-08-21 06:38:03 +02:00
Hilderin 1b0c5cbc01 Fix FileSystem dock won't show any file folders (v2) 2024-08-20 21:23:13 -04:00
aaronp64 7593e55527 Improve Editor Inspector/Theme item lookup performance
Changes to reduce the latency between changing node selection in the editor and seeing the new node reflected in the Inspector tab

- Use Vector instead of List for ThemeOwner::get_theme_type_dependencies and related functions
- Use Vector instead of List for ThemeContext::themes, set_themes(), and get_themes()
- Add ClassDB:get_inheritance_chain_nocheck to get all parent/ancestor classes at once, to avoid repeated ClassDB locking overhead
- Update BIND_THEME_ITEM macros and ThemeDB::update_class_instance_items to use provided StringNames for call to ThemeItemSetter, instead of creating a new StringName in each call

These changes reduce the time taken by EditorInspector::update_tree by around 30-35%
2024-08-20 13:39:40 -04:00
Daylily-Zeleen 3d575801ce Allow ClassDB to create a Object without postinitialization for GDExtension. 2024-08-20 20:19:02 +08:00
Stuart Carnie 2d0165574d
Add Metal support for macOS (arm64) and iOS 2024-08-20 12:11:06 +02:00
Rémi Verschelde 6a9ecdcf0c
Merge pull request #91818 from rburing/fti_multimesh
Physics interpolation: `MultiMesh`
2024-08-20 10:01:46 +02:00
Aaron Franke 7db24a9ad5
Simplify and fix Rect2/AABB get_support function 2024-08-19 23:55:31 -07:00
Rémi Verschelde af919a845f
Merge pull request #94683 from kisg/string_name_fix
StringName: Use inline static field definitions
2024-08-19 16:05:16 +02:00
Rémi Verschelde 6a829d5a86
Merge pull request #95508 from Summersay415/loaded-when-not
Return error when no ResourceFormatLoader found
2024-08-19 14:34:17 +02:00
Rémi Verschelde 86212c1fe4
Merge pull request #94666 from RandomShaper/fix_tangled_obj_clear_crash
Avoid potential crash on signal disconnection
2024-08-19 14:33:44 +02:00
Pedro J. Estébanez e9407d4877 ResourceLoader: Revert workaround resource loading crashes due to buggy TLS
This reverts commit 41c0785636.
2024-08-19 12:22:31 +02:00
Pedro J. Estébanez 32b7f835d8 Avoid potential crash on signal disconnection 2024-08-19 12:18:04 +02:00
Rémi Verschelde ab2b06b8b1
Merge pull request #95730 from voidedWarranties/fix_reload_scripts_bind
Fix virtual binding for `ScriptLanguageExtension::_reload_scripts`
2024-08-19 12:09:39 +02:00
Rémi Verschelde 4afcbb1c8b
Merge pull request #92546 from AThousandShips/faster_replace
[Core] Optimize `String::replace` methods
2024-08-19 12:08:45 +02:00
Rémi Verschelde f4037d6f6c
Merge pull request #92496 from clayjohn/HDR-2D-sRGB
Ensure MovieWriter output is in gamma space when using HDR 2D
2024-08-19 12:08:40 +02:00
Ricardo Buring 1728f80e7c Fixed Timestep Interpolation: MultiMesh
Adds fixed timestep interpolation to multimeshes.

Co-authored-by: lawnjelly <lawnjelly@gmail.com>
2024-08-18 17:14:59 +02:00
BlueCube3310 394ea653aa Add Betsy to speed up BC6 compression 2024-08-18 11:14:05 +02:00
voidedWarranties d65ea6fb9c Fix virtual binding for `ScriptLanguageExtension::_reload_scripts` 2024-08-17 21:09:32 -07:00
Rémi Verschelde 49e5fbfbd2
Merge pull request #95184 from jsjtxietian/shader-include-relative
Fix `String::simplify_path` handling of relative paths to parent dir (`../`), fixes relative shader includes
2024-08-17 00:46:11 +02:00
Rémi Verschelde 82adfebcf8
Merge pull request #94799 from m4gr3d/memory_allocation_cleanup_and_optimizations
Android memory cleanup and optimizations
2024-08-16 23:45:39 +02:00
Fredia Huya-Kouadio a57a99f5bc Memory cleanup and optimizations
- Returns an empty list when there's not registered plugins, thus preventing the creation of spurious iterator objects

- Inline `Godot#getRotatedValues(...)` given it only had a single caller. This allows to remove the allocation of a float array on each call and replace it with float variables

- Disable sensor events by default. Sensor events can fired at 10-100s Hz taking cpu and memory resources. Now the use of sensor data is behind a project setting allowing projects that have use of it to enable it, while other projects don't pay the cost for a feature they don't use

- Create a pool of specialized input `Runnable` objects to prevent spurious, unbounded `Runnable` allocations

- Disable showing the boot logo for Android XR projects

- Delete locale references of jni strings
2024-08-16 09:27:41 -07:00
Rémi Verschelde 803dfcc3cb
Merge pull request #95613 from timothyqiu/split-empty
Fix `split_floats` behavior when spaces are used as separators
2024-08-16 14:36:40 +02:00
Rémi Verschelde f01e052162
Merge pull request #95549 from timothyqiu/split-translation-server
Split `TranslationServer` into its own file
2024-08-16 14:36:16 +02:00
Rémi Verschelde 1d4303c1fe
Merge pull request #95502 from bruvzg/net_ext_detect
[.NET] Move search in files extension list definition to be after Scene level module init.
2024-08-16 14:35:12 +02:00
Rémi Verschelde 69db19f058
Merge pull request #94826 from Naros/classdb-expose-property-getter-setter
Expose ClassDB methods `get_property_setter` / `get_property_getter`
2024-08-16 14:32:32 +02:00
Rémi Verschelde 6042c66663
Merge pull request #94720 from noidexe/fix-gamepad-triggers
Fix gamepad triggers not working on web exports
2024-08-16 14:32:27 +02:00
Haoyu Qiu f483c3aafa Fix split_floats behavior when spaces are used as separators 2024-08-16 17:30:44 +08:00
Rémi Verschelde ae2044dccb
Merge pull request #95477 from RandomShaper/res_load_dev_bugs
ResourceLoader: Use better error handling for possible engine bugs
2024-08-16 10:36:33 +02:00
Rémi Verschelde f1d6677713
Merge pull request #95469 from bruvzg/cowdata_unref
`CowData` remove hardcoded offset and unused argument from `_unref`.
2024-08-16 10:36:28 +02:00
Rémi Verschelde 886d5865a4
Merge pull request #95291 from BlueCube3310/hdr-optimizations
Optimize .hdr loading and RGB9E5 conversion
2024-08-16 10:35:32 +02:00
Rémi Verschelde a8bbb09bd5
Merge pull request #95143 from TV4Fun/fix_non_windows_library_load
Fix reload of GDExtension libraries in framework package on macOS
2024-08-16 10:35:19 +02:00
Rémi Verschelde 70096c0e6a
Merge pull request #94558 from stuartcarnie/sgc/sprintf_allocations
Reduce allocations in `String::sprintf`
2024-08-16 10:34:28 +02:00
Rémi Verschelde 91bf992168
Merge pull request #94353 from aaronp64/cowdata_insert
Improve `CowData::insert` performance
2024-08-16 10:34:22 +02:00
Rémi Verschelde 27f3dd8d01
Merge pull request #93149 from Malcolmnixon/smoothstep-degenerate-case
Handle the smoothstep degenerate case of empty range
2024-08-16 10:33:58 +02:00
Rémi Verschelde 71ca5aa5ec
Merge pull request #92555 from AThousandShips/insert_improve
[Core] Optimize `String::insert`
2024-08-16 10:33:47 +02:00
Rémi Verschelde e057c49bf7
Merge pull request #92550 from AThousandShips/join_improve
[Core] Optimize `String::join`
2024-08-16 10:33:42 +02:00
Rémi Verschelde 46c6865979
Merge pull request #92391 from rburing/fti_3d
Physics interpolation (3D)
2024-08-16 10:33:37 +02:00
Rémi Verschelde eb684cccdc
Merge pull request #92291 from BlueCube3310/image-convert-optimized
Optimize image conversion for half and float formats.
2024-08-16 10:33:32 +02:00
Malcolm Nixon 23fc704cbc This PR handles the smoothstep degenerate case where the range is empty.
It also updates the documentation to describe positive and negative ranges.

Co-Authored-By: Hugo Locurcio <hugo.locurcio@hugo.pro>
Co-Authored-By: kleonc <9283098+kleonc@users.noreply.github.com>
2024-08-15 19:08:05 -04:00
A Thousand Ships ee19a092d9
[Core] Optimize some `String` methods
Avoids unnecessary COW checks by using pointers directly.
2024-08-15 17:17:11 +02:00
A Thousand Ships e211d08c92
[Core] Optimize `String::join`
Avoid reallocation by pre-computing size
2024-08-15 16:19:07 +02:00
A Thousand Ships 746c6b87eb
[Core] Optimize `String::insert` 2024-08-15 16:18:47 +02:00
A Thousand Ships cbaec62b03
[Core] Optimize `String::replace` methods
Performs a single allocation, only when any instances are found, and
avoids concatenations and other unnecessary conversions.
2024-08-15 16:15:58 +02:00
Haoyu Qiu 7343dc3a5d Split TranslationServer into its own file 2024-08-15 15:00:47 +08:00
Lisandro Lorea 9dd372f316 Fix gamepad triggers not working on web exports
Fixes #81758

DisplayServerWeb::process_joypads handles buttons 6 and 7 of the
HTML5 Standard Gamepad as a special case by doing:
`input->joy_axis(idx, (JoyAxis)b, s_btns[b]);`

This doesn't work because there is no JoyAxis 6 or 7 in the enum

To fix this we use JoyAxis::TRIGGER_LEFT and TRIGGER_RIGHT for button 6
and 7

However since we are now lying to input->joy_axis we also need to lie in
the mappings for the standard gamepad in godotcontrollersdb.txt,
otherwise input->joy_axis will try to find a mapping to axis 4(LT) and
axis 5(RT) that's not defined.

Therefore we set lefttrigger to +a4 and righttrigger to +a5 in the
mapping, to match what we are actually sending.

A cleaner, and more involved fix to this would be modifying
input->joy_button so that it can handle analog buttons and map them to
axes preserving their value instead of converting to boolean
2024-08-14 16:13:16 -03:00
Summersay415 6df3621b47 Return error when no ResourceFormatLoader found. 2024-08-14 11:45:23 +07:00
bruvzg 69d52ed081
[.NET] Move search in files extension list definition to be after Scene level module init. 2024-08-14 00:16:09 +03:00
Pedro J. Estébanez 31a9e10ddb ResourceLoader: Use better error handling for possible engine bugs 2024-08-13 12:52:08 +02:00
Pedro J. Estébanez 17ea4b405a ResourceLoader: Fix error on querying progress for uncached loads 2024-08-13 12:41:11 +02:00
bruvzg 273ba27c2f
`CowData` remove hardcoded offset and unused argument from `_unref`. 2024-08-13 08:53:45 +03:00
BlueCube3310 80cf6cbfe9 Optimize .hdr loading and RGB9E5 conversion 2024-08-09 22:39:30 +02:00
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
Mikael Hermansson 613600fa89 Fix use-after-free in `FileAccess::exists` 2024-08-09 03:33:51 +02:00