Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-picks for the 3.5 branch (future 3.5.3) - 2nd batch #81077

Merged
merged 32 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b884fe2
[3.x] Core: Add recursion level check for `Array` and `Dictionary` ha…
dalexeev Aug 22, 2023
2783deb
Fix mesh library remove selected item menu option
Hassan-A Feb 26, 2021
bf1511d
Notify child controls when BackBufferCopy's rect changed
timothyqiu Mar 3, 2023
3be4f3a
Fix scrolling behaviour with low page value
pkowal1982 Oct 26, 2022
38cb389
Document how to use logarithm of base 10 with `log()`
Calinou Mar 24, 2023
0dfc9d0
Prevent color conversion of the big Godot logo
YuriSizov Apr 4, 2023
497b77c
Fix moving position indicator out of bounds in FileAccessMemory
Listwon Apr 4, 2023
7eba909
Convert the logo's text outlines into paths
Riteo Apr 7, 2023
706f939
Fix Windows StringFileInfo structure
pkowal1982 Apr 12, 2023
ff8c53d
Document custom mouse cursors larger than 128×128 potentially having …
Calinou Apr 21, 2023
596aeb9
Add information about how `Engine.time_scale` affects Timers
AThousandShips Apr 23, 2023
478185f
ios splash screen rotation fix
theromis Apr 13, 2023
15fabc7
Added note to used set_deferred while setting scroll values in _ready…
stmSi Apr 29, 2023
337e960
add venv and .venv to the .gitignore
brno32 May 1, 2023
50d6f74
Fix the Python type error when creating the .sln file
HK-SHAO Mar 25, 2023
bf205d7
Add mono audio support to WASAPI
KoBeWi Apr 28, 2023
3f4910b
Added a few additional GUIDs to list of hardcoded IDs in is_xinput_de…
mrTag Jun 5, 2023
a5ba0a2
Document the database for `Input.get_joy_name()` and `Input.get_joy_g…
Calinou Jun 2, 2023
cdcab75
certs: Sync with Mozilla bundle as of Mar 23, 2023
akien-mga May 11, 2023
6b9c644
Update certs (2023.06 revision)
DeeJayLSP Jun 6, 2023
2426cfa
tinyexr: Sync with upstream 1.0.2
akien-mga May 22, 2023
c2dae21
tinyexr: Sync with upstream 1.0.4
bitsawer Jun 5, 2023
d29ec6a
tinyexr: Sync with upstream 1.0.5
akien-mga Jun 7, 2023
a2e4df4
tinyexr: Sync with upstream 1.0.7
akien-mga Aug 7, 2023
212190a
Build `JoypadLinux` sandbox detection method only with udev
Riteo May 25, 2023
ac4daf4
mbedtls: Update to upstream version 2.28.3
akien-mga Apr 18, 2023
75e0db7
mbedtls: Update to upstream version 2.28.4
akien-mga Aug 4, 2023
6a9c714
libwebp: Sync with upstream 1.3.0
DeeJayLSP Jan 25, 2023
2051e38
libwebp: Sync with upstream 1.3.1
akien-mga Aug 7, 2023
591feae
Add missing stdint.h includes for GCC 13+
akien-mga Jun 7, 2023
8e5c177
Ensure `joy_connection_changed` is emitted on the main thread
rsubtil Aug 8, 2023
10af8ad
SCons: Disable misbehaving MSVC incremental linking
akien-mga Aug 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ tests/data/*.translation
# Binutils tmp linker output of the form "stXXXXXX" where "X" is alphanumeric
st[A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9]

# Python development
.venv
venv

# Python generated
__pycache__/
*.pyc
Expand Down
11 changes: 10 additions & 1 deletion core/array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,25 @@ bool Array::operator==(const Array &p_array) const {
}

uint32_t Array::hash() const {
return recursive_hash(0);
}

uint32_t Array::recursive_hash(int p_recursion_count) const {
ERR_FAIL_COND_V_MSG(p_recursion_count > MAX_RECURSION, 0, "Max recursion reached");
p_recursion_count++;

uint32_t h = hash_djb2_one_32(0);

for (int i = 0; i < _p->array.size(); i++) {
h = hash_djb2_one_32(_p->array[i].hash(), h);
h = hash_djb2_one_32(_p->array[i].recursive_hash(p_recursion_count), h);
}
return h;
}

void Array::operator=(const Array &p_array) {
_ref(p_array);
}

void Array::push_back(const Variant &p_value) {
_p->array.push_back(p_value);
}
Expand Down
1 change: 1 addition & 0 deletions core/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class Array {
bool operator==(const Array &p_array) const;

uint32_t hash() const;
uint32_t recursive_hash(int p_recursion_count) const;
void operator=(const Array &p_array);

void push_back(const Variant &p_value);
Expand Down
12 changes: 10 additions & 2 deletions core/dictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,20 @@ void Dictionary::_unref() const {
}
_p = nullptr;
}

uint32_t Dictionary::hash() const {
return recursive_hash(0);
}

uint32_t Dictionary::recursive_hash(int p_recursion_count) const {
ERR_FAIL_COND_V_MSG(p_recursion_count > MAX_RECURSION, 0, "Max recursion reached");
p_recursion_count++;

uint32_t h = hash_djb2_one_32(Variant::DICTIONARY);

for (OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.front(); E; E = E.next()) {
h = hash_djb2_one_32(E.key().hash(), h);
h = hash_djb2_one_32(E.value().hash(), h);
h = hash_djb2_one_32(E.key().recursive_hash(p_recursion_count), h);
h = hash_djb2_one_32(E.value().recursive_hash(p_recursion_count), h);
}

return h;
Expand Down
1 change: 1 addition & 0 deletions core/dictionary.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class Dictionary {
bool operator!=(const Dictionary &p_dictionary) const;

uint32_t hash() const;
uint32_t recursive_hash(int p_recursion_count) const;
void operator=(const Dictionary &p_dictionary);

const Variant *next(const Variant *p_key = nullptr) const;
Expand Down
4 changes: 2 additions & 2 deletions core/io/file_access_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ uint64_t FileAccessMemory::get_buffer(uint8_t *p_dst, uint64_t p_length) const {
}

memcpy(p_dst, &data[pos], read);
pos += p_length;
pos += read;

return read;
}
Expand Down Expand Up @@ -176,7 +176,7 @@ void FileAccessMemory::store_buffer(const uint8_t *p_src, uint64_t p_length) {
}

memcpy(&data[pos], p_src, write);
pos += p_length;
pos += write;
}

FileAccessMemory::FileAccessMemory() {
Expand Down
11 changes: 6 additions & 5 deletions core/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2508,6 +2508,10 @@ Variant::~Variant() {
}*/

uint32_t Variant::hash() const {
return recursive_hash(0);
}

uint32_t Variant::recursive_hash(int p_recursion_count) const {
switch (type) {
case NIL: {
return 0;
Expand Down Expand Up @@ -2622,13 +2626,10 @@ uint32_t Variant::hash() const {
return reinterpret_cast<const NodePath *>(_data._mem)->hash();
} break;
case DICTIONARY: {
return reinterpret_cast<const Dictionary *>(_data._mem)->hash();

return reinterpret_cast<const Dictionary *>(_data._mem)->recursive_hash(p_recursion_count);
} break;
case ARRAY: {
const Array &arr = *reinterpret_cast<const Array *>(_data._mem);
return arr.hash();

return reinterpret_cast<const Array *>(_data._mem)->recursive_hash(p_recursion_count);
} break;
case POOL_BYTE_ARRAY: {
const PoolVector<uint8_t> &arr = *reinterpret_cast<const PoolVector<uint8_t> *>(_data._mem);
Expand Down
1 change: 1 addition & 0 deletions core/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ class Variant {
bool operator!=(const Variant &p_variant) const;
bool operator<(const Variant &p_variant) const;
uint32_t hash() const;
uint32_t recursive_hash(int p_recursion_count) const;

bool hash_compare(const Variant &p_variant) const;
bool booleanize() const;
Expand Down
12 changes: 6 additions & 6 deletions core/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
// Defines the main "branch" version. Patch versions in this branch should be
// forward-compatible.
// Example: "3.1"
#define VERSION_BRANCH "" _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR)
#define VERSION_BRANCH _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR)
#if VERSION_PATCH
// Example: "3.1.4"
#define VERSION_NUMBER "" VERSION_BRANCH "." _MKSTR(VERSION_PATCH)
#define VERSION_NUMBER VERSION_BRANCH "." _MKSTR(VERSION_PATCH)
#else // patch is 0, we don't include it in the "pretty" version number.
// Example: "3.1" instead of "3.1.0"
#define VERSION_NUMBER "" VERSION_BRANCH
#define VERSION_NUMBER VERSION_BRANCH
#endif // VERSION_PATCH

// Version number encoded as hexadecimal int with one byte for each number,
Expand All @@ -57,16 +57,16 @@
// Describes the full configuration of that Godot version, including the version number,
// the status (beta, stable, etc.) and potential module-specific features (e.g. mono).
// Example: "3.1.4.stable.mono"
#define VERSION_FULL_CONFIG "" VERSION_NUMBER "." VERSION_STATUS VERSION_MODULE_CONFIG
#define VERSION_FULL_CONFIG VERSION_NUMBER "." VERSION_STATUS VERSION_MODULE_CONFIG

// Similar to VERSION_FULL_CONFIG, but also includes the (potentially custom) VERSION_BUILD
// description (e.g. official, custom_build, etc.).
// Example: "3.1.4.stable.mono.official"
#define VERSION_FULL_BUILD "" VERSION_FULL_CONFIG "." VERSION_BUILD
#define VERSION_FULL_BUILD VERSION_FULL_CONFIG "." VERSION_BUILD

// Same as above, but prepended with Godot's name and a cosmetic "v" for "version".
// Example: "Godot v3.1.4.stable.official.mono"
#define VERSION_FULL_NAME "" VERSION_NAME " v" VERSION_FULL_BUILD
#define VERSION_FULL_NAME VERSION_NAME " v" VERSION_FULL_BUILD

// Git commit hash, generated at build time in `core/version_hash.gen.cpp`.
extern const char *const VERSION_HASH;
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/Engine.xml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
The desired frames per second. If the hardware cannot keep up, this setting may not be respected. A value of 0 means no limit.
</member>
<member name="time_scale" type="float" setter="set_time_scale" getter="get_time_scale" default="1.0">
Controls how fast or slow the in-game clock ticks versus the real life one. It defaults to 1.0. A value of 2.0 means the game moves twice as fast as real life, whilst a value of 0.5 means the game moves at half the regular speed.
Controls how fast or slow the in-game clock ticks versus the real life one. It defaults to 1.0. A value of 2.0 means the game moves twice as fast as real life, whilst a value of 0.5 means the game moves at half the regular speed. This also affects [Timer] and [SceneTreeTimer] (see [method SceneTree.create_timer] for how to control this).
</member>
</members>
<constants>
Expand Down
6 changes: 3 additions & 3 deletions doc/classes/Input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@
<return type="String" />
<argument index="0" name="device" type="int" />
<description>
Returns a SDL2-compatible device GUID on platforms that use gamepad remapping. Returns [code]"Default Gamepad"[/code] otherwise.
Returns a SDL2-compatible device GUID on platforms that use gamepad remapping, e.g. [code]030000004c050000c405000000010000[/code]. Returns [code]"Default Gamepad"[/code] otherwise. Godot uses the [url=https://github.com/gabomdq/SDL_GameControllerDB]SDL2 game controller database[/url] to determine gamepad names and mappings based on this GUID.
</description>
</method>
<method name="get_joy_name">
<return type="String" />
<argument index="0" name="device" type="int" />
<description>
Returns the name of the joypad at the specified device index.
Returns the name of the joypad at the specified device index, e.g. [code]PS4 Controller[/code]. Godot uses the [url=https://github.com/gabomdq/SDL_GameControllerDB]SDL2 game controller database[/url] to determine gamepad names.
</description>
</method>
<method name="get_joy_vibration_duration">
Expand Down Expand Up @@ -318,7 +318,7 @@
<argument index="2" name="hotspot" type="Vector2" default="Vector2( 0, 0 )" />
<description>
Sets a custom mouse cursor image, which is only visible inside the game window. The hotspot can also be specified. Passing [code]null[/code] to the image parameter resets to the system cursor. See [enum CursorShape] for the list of shapes.
[code]image[/code]'s size must be lower than 256×256.
[code]image[/code]'s size must be lower than or equal to 256×256. To avoid rendering issues, sizes lower than or equal to 128×128 are recommended.
[code]hotspot[/code] must be within [code]image[/code]'s size.
[b]Note:[/b] [AnimatedTexture]s aren't supported as custom mouse cursors. If using an [AnimatedTexture], only the first frame will be displayed.
[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or [b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] compression mode can't be used for custom cursors.
Expand Down
10 changes: 10 additions & 0 deletions doc/classes/ScrollContainer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,22 @@
</member>
<member name="scroll_horizontal" type="int" setter="set_h_scroll" getter="get_h_scroll" default="0">
The current horizontal scroll value.
[b]Note:[/b] If you are setting this value in the [method Node._ready] function or earlier, it needs to be wrapped with [method Object.set_deferred], since scroll bar's [member Range.max_value] is not initialized yet.
[codeblock]
func _ready():
set_deferred("scroll_horizontal", 600)
[/codeblock]
</member>
<member name="scroll_horizontal_enabled" type="bool" setter="set_enable_h_scroll" getter="is_h_scroll_enabled" default="true">
If [code]true[/code], enables horizontal scrolling.
</member>
<member name="scroll_vertical" type="int" setter="set_v_scroll" getter="get_v_scroll" default="0">
The current vertical scroll value.
[b]Note:[/b] Setting it early needs to be deferred, just like in [member scroll_horizontal].
[codeblock]
func _ready():
set_deferred("scroll_vertical", 600)
[/codeblock]
</member>
<member name="scroll_vertical_enabled" type="bool" setter="set_enable_v_scroll" getter="is_v_scroll_enabled" default="true">
If [code]true[/code], enables vertical scrolling.
Expand Down
3 changes: 2 additions & 1 deletion doc/classes/Timer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
</brief_description>
<description>
Counts down a specified interval and emits a signal on reaching 0. Can be set to repeat or "one-shot" mode.
[b]Note:[/b] Timers are affected by [member Engine.time_scale], a higher scale means quicker timeouts, and vice versa.
[b]Note:[/b] To create a one-shot timer without instantiating a node, use [method SceneTree.create_timer].
</description>
<tutorials>
Expand Down Expand Up @@ -52,7 +53,7 @@
</member>
<member name="wait_time" type="float" setter="set_wait_time" getter="get_wait_time" default="1.0">
The wait time in seconds.
[b]Note:[/b] Timers can only emit once per rendered frame at most (or once per physics frame if [member process_mode] is [constant TIMER_PROCESS_PHYSICS]). This means very low wait times (lower than 0.05 seconds) will behave in significantly different ways depending on the rendered framerate. For very low wait times, it is recommended to use a process loop in a script instead of using a Timer node.
[b]Note:[/b] Timers can only emit once per rendered frame at most (or once per physics frame if [member process_mode] is [constant TIMER_PROCESS_PHYSICS]). This means very low wait times (lower than 0.05 seconds) will behave in significantly different ways depending on the rendered framerate. For very low wait times, it is recommended to use a process loop in a script instead of using a Timer node. Timers are affected by [member Engine.time_scale], a higher scale means quicker timeouts, and vice versa.
</member>
</members>
<signals>
Expand Down
23 changes: 22 additions & 1 deletion drivers/wasapi/audio_driver_wasapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,14 @@ Error AudioDriverWASAPI::init_render_device(bool reinit) {
return err;

switch (audio_output.channels) {
case 1: // Mono
case 3: // Surround 2.1
case 5: // Surround 5.0
case 7: // Surround 7.0
// We will downmix as required.
channels = audio_output.channels + 1;
break;

case 2: // Stereo
case 4: // Surround 3.1
case 6: // Surround 5.1
Expand All @@ -343,7 +351,7 @@ Error AudioDriverWASAPI::init_render_device(bool reinit) {
input_position = 0;
input_size = 0;

print_verbose("WASAPI: detected " + itos(channels) + " channels");
print_verbose("WASAPI: detected " + itos(audio_output.channels) + " channels");
print_verbose("WASAPI: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");

return OK;
Expand Down Expand Up @@ -584,6 +592,19 @@ void AudioDriverWASAPI::thread_func(void *p_udata) {
for (unsigned int i = 0; i < write_frames * ad->channels; i++) {
ad->write_sample(ad->audio_output.format_tag, ad->audio_output.bits_per_sample, buffer, i, ad->samples_in.write[write_ofs++]);
}
} else if (ad->channels == ad->audio_output.channels + 1) {
// Pass all channels except the last two as-is, and then mix the last two
// together as one channel. E.g. stereo -> mono, or 3.1 -> 2.1.
unsigned int last_chan = ad->audio_output.channels - 1;
for (unsigned int i = 0; i < write_frames; i++) {
for (unsigned int j = 0; j < last_chan; j++) {
ad->write_sample(ad->audio_output.format_tag, ad->audio_output.bits_per_sample, buffer, i * ad->audio_output.channels + j, ad->samples_in.write[write_ofs++]);
}
int32_t l = ad->samples_in.write[write_ofs++];
int32_t r = ad->samples_in.write[write_ofs++];
int32_t c = (int32_t)(((int64_t)l + (int64_t)r) / 2);
ad->write_sample(ad->audio_output.format_tag, ad->audio_output.bits_per_sample, buffer, i * ad->audio_output.channels + last_chan, c);
}
} else {
for (unsigned int i = 0; i < write_frames; i++) {
for (unsigned int j = 0; j < MIN(ad->channels, ad->audio_output.channels); j++) {
Expand Down
Loading
Loading