builds godot
| -rw-r--r-- | patches/fix_buffer_underrun.patch | 23 | ||||
| -rw-r--r-- | patches/hex_decode.patch | 168 | ||||
| -rw-r--r-- | patches/no-arg-handling.patch | 175 | ||||
| -rw-r--r-- | patches/no-touchpad-gamepad.patch | 26 |
4 files changed, 120 insertions, 272 deletions
diff --git a/patches/fix_buffer_underrun.patch b/patches/fix_buffer_underrun.patch deleted file mode 100644 index 4cddcbf..0000000 --- a/patches/fix_buffer_underrun.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 5d10dc5da2508530a38c66d4aa1ec234327a3b34 Mon Sep 17 00:00:00 2001 -From: Ellen Poe <[email protected]> -Date: Sun, 12 Feb 2023 07:34:55 -0800 -Subject: [PATCH] Fix AudioStreamGenerator stopping playback after a buffer - underrun - ---- - servers/audio_server.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp -index 0344bf322d68..5e71d7af0550 100644 ---- a/servers/audio_server.cpp -+++ b/servers/audio_server.cpp -@@ -354,7 +354,7 @@ void AudioServer::_mix_step() { - playback->stream_playback->tag_used_streams(); - } - -- if (mixed_frames != buffer_size) { -+ if (!playback->stream_playback->is_playing()) { - // We know we have at least the size of our lookahead buffer for fade-out purposes. - - float fadeout_base = 0.94; diff --git a/patches/hex_decode.patch b/patches/hex_decode.patch deleted file mode 100644 index c698394..0000000 --- a/patches/hex_decode.patch +++ /dev/null @@ -1,168 +0,0 @@ -From 0742ae2f2c3aea760f0dfd48379e19ffe81a9c2c Mon Sep 17 00:00:00 2001 -From: bendn <[email protected]> -Date: Mon, 6 Mar 2023 10:17:33 +0700 -Subject: [PATCH] add `hex_decode()` to `String` - ---- - core/string/ustring.cpp | 29 +++++++++++++++++++ - core/string/ustring.h | 2 ++ - core/variant/variant_call.cpp | 1 + - doc/classes/String.xml | 18 ++++++++++++ - doc/classes/StringName.xml | 18 ++++++++++++ - .../GodotSharp/Core/StringExtensions.cs | 20 +++++++++++++ - 6 files changed, 88 insertions(+) - -diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp -index 1b3b070592b2..8381a176ce8a 100644 ---- a/core/string/ustring.cpp -+++ b/core/string/ustring.cpp -@@ -1644,6 +1644,35 @@ String String::hex_encode_buffer(const uint8_t *p_buffer, int p_len) { - return ret; - } - -+Vector<uint8_t> String::hex_decode() const { -+ ERR_FAIL_COND_V_MSG(length() % 2 != 0, Vector<uint8_t>(), "Hexadecimal string of uneven length."); -+ -+#define HEX_TO_BYTE(m_output, m_index) \ -+ uint8_t m_output; \ -+ c = operator[](m_index); \ -+ if (is_digit(c)) { \ -+ m_output = c - '0'; \ -+ } else if (c >= 'a' && c <= 'f') { \ -+ m_output = c - 'a' + 10; \ -+ } else if (c >= 'A' && c <= 'F') { \ -+ m_output = c - 'A' + 10; \ -+ } else { \ -+ ERR_FAIL_V_MSG(Vector<uint8_t>(), "Invalid hexadecimal character \"" + chr(c) + "\" at index " + m_index + "."); \ -+ } -+ -+ Vector<uint8_t> out; -+ int len = length() / 2; -+ out.resize(len); -+ for (int i = 0; i < len; i++) { -+ char32_t c; -+ HEX_TO_BYTE(first, i * 2); -+ HEX_TO_BYTE(second, i * 2 + 1); -+ out.write[i] = first * 16 + second; -+ } -+ return out; -+#undef HEX_TO_BYTE -+} -+ - void String::print_unicode_error(const String &p_message, bool p_critical) const { - if (p_critical) { - print_error(vformat("Unicode parsing error, some characters were replaced with spaces: %s", p_message)); -diff --git a/core/string/ustring.h b/core/string/ustring.h -index 1582504c57d4..1b36608d353e 100644 ---- a/core/string/ustring.h -+++ b/core/string/ustring.h -@@ -321,6 +321,8 @@ class String { - static String chr(char32_t p_char); - static String md5(const uint8_t *p_md5); - static String hex_encode_buffer(const uint8_t *p_buffer, int p_len); -+ Vector<uint8_t> hex_decode() const; -+ - bool is_numeric() const; - - double to_float() const; -diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp -index 0c0c8f657a26..7e5830d2ae7c 100644 ---- a/core/variant/variant_call.cpp -+++ b/core/variant/variant_call.cpp -@@ -1721,6 +1721,7 @@ static void _register_variant_builtin_methods() { - bind_string_method(to_utf8_buffer, sarray(), varray()); - bind_string_method(to_utf16_buffer, sarray(), varray()); - bind_string_method(to_utf32_buffer, sarray(), varray()); -+ bind_string_method(hex_decode, sarray(), varray()); - - bind_static_method(String, num_scientific, sarray("number"), varray()); - bind_static_method(String, num, sarray("number", "decimals"), varray(-1)); -diff --git a/doc/classes/String.xml b/doc/classes/String.xml -index d629a31bca1b..f909ccdba938 100644 ---- a/doc/classes/String.xml -+++ b/doc/classes/String.xml -@@ -313,6 +313,24 @@ - [b]Note:[/b] Strings with equal hash values are [i]not[/i] guaranteed to be the same, as a result of hash collisions. On the countrary, strings with different hash values are guaranteed to be different. - </description> - </method> -+ <method name="hex_decode" qualifiers="const"> -+ <return type="PackedByteArray" /> -+ <description> -+ Decodes a hexadecimal string as a [PackedByteArray]. -+ [codeblocks] -+ [gdscript] -+ var text = "hello world" -+ var encoded = text.to_utf8_buffer().hex_encode() -+ print(buf.hex_decode().get_string_from_utf8()) -+ [/gdscript] -+ [csharp] -+ var text = "hello world"; -+ var encoded = text.ToUtf8Buffer().HexEncode(); -+ GD.Print(buf.HexDecode().GetStringFromUtf8()); -+ [/csharp] -+ [/codeblocks] -+ </description> -+ </method> - <method name="hex_to_int" qualifiers="const"> - <return type="int" /> - <description> -diff --git a/doc/classes/StringName.xml b/doc/classes/StringName.xml -index 192cb1a6c2ab..57172b897b5f 100644 ---- a/doc/classes/StringName.xml -+++ b/doc/classes/StringName.xml -@@ -296,6 +296,24 @@ - [b]Note:[/b] Strings with equal hash values are [i]not[/i] guaranteed to be the same, as a result of hash collisions. On the countrary, strings with different hash values are guaranteed to be different. - </description> - </method> -+ <method name="hex_decode" qualifiers="const"> -+ <return type="PackedByteArray" /> -+ <description> -+ Decodes a hexadecimal string as a [PackedByteArray]. -+ [codeblocks] -+ [gdscript] -+ var text = "hello world" -+ var encoded = text.to_utf8_buffer().hex_encode() -+ print(buf.hex_decode().get_string_from_utf8()) -+ [/gdscript] -+ [csharp] -+ var text = "hello world"; -+ var encoded = text.ToUtf8Buffer().HexEncode(); -+ GD.Print(buf.HexDecode().GetStringFromUtf8()); -+ [/csharp] -+ [/codeblocks] -+ </description> -+ </method> - <method name="hex_to_int" qualifiers="const"> - <return type="int" /> - <description> -diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs -index df67e075aca3..e67e18b27613 100644 ---- a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs -+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs -@@ -728,6 +728,26 @@ public static uint Hash(this string instance) - return hash; - } - -+ /// <summary> -+ /// Decodes a hexadecimal string. -+ /// </summary> -+ /// <param name="instance">The hexadecimal string.</param> -+ /// <returns>The byte array representation of this string.</returns> -+ public static byte[] HexDecode(this string instance) -+ { -+ if (instance.Length % 2 != 0) -+ { -+ throw new ArgumentException("Hexadecimal string of uneven length.", nameof(instance)); -+ } -+ int len = instance.Length / 2; -+ byte[] ret = new byte[len]; -+ for (int i = 0; i < len; i++) -+ { -+ ret[i] = (byte)int.Parse(instance.Substring(i * 2, 2), NumberStyles.HexNumber); -+ } -+ return ret; -+ } -+ - /// <summary> - /// Returns a hexadecimal representation of this byte as a string. - /// </summary> diff --git a/patches/no-arg-handling.patch b/patches/no-arg-handling.patch index 692fe34..1323545 100644 --- a/patches/no-arg-handling.patch +++ b/patches/no-arg-handling.patch @@ -1,20 +1,18 @@ diff --git a/main/main.cpp b/main/main.cpp -index 2326e519bf..dddcae0be2 100644 +index 37ef4332..ecc30d7e 100644 --- a/main/main.cpp +++ b/main/main.cpp -@@ -156,10 +156,10 @@ static bool editor = false; +@@ -128,7 +128,9 @@ static int audio_driver_idx = -1; + static bool editor = false; static bool project_manager = false; - static bool cmdline_tool = false; static String locale; --static bool show_help = false; ++#ifdef TOOLS_ENABLED + static bool show_help = false; ++#endif static bool auto_quit = false; - static OS::ProcessID editor_pid = 0; - #ifdef TOOLS_ENABLED -+static bool show_help = false; - static bool found_project = false; - static bool auto_build_solutions = false; - static String debug_server_uri; -@@ -302,6 +302,7 @@ void finalize_theme_db() { + static OS::ProcessID allow_focus_steal_pid = 0; + static bool delta_sync_after_draw = false; +@@ -239,6 +241,7 @@ void finalize_navigation_server() { #define MAIN_PRINT(m_txt) #endif @@ -22,30 +20,40 @@ index 2326e519bf..dddcae0be2 100644 void Main::print_help(const char *p_binary) { print_line(String(VERSION_NAME) + " v" + get_full_version_string() + " - " + String(VERSION_WEBSITE)); OS::get_singleton()->print("Free and open source software under the terms of the MIT license.\n"); -@@ -435,6 +436,7 @@ void Main::print_help(const char *p_binary) { - #endif +@@ -256,11 +259,9 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print("\n"); - } -+#endif - #ifdef TESTS_ENABLED - // The order is the same as in `Main::setup()`, only core and some editor types -@@ -679,7 +681,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph - List<String> args; - List<String> main_args; - List<String> user_args; -+#ifdef TOOLS_ENABLED - bool adding_user_args = false; + OS::get_singleton()->print("Run options:\n"); +-#ifdef TOOLS_ENABLED + OS::get_singleton()->print(" -e, --editor Start the editor instead of running the scene.\n"); + OS::get_singleton()->print(" -p, --project-manager Start the project manager, even if a project is auto-detected.\n"); + OS::get_singleton()->print(" --debug-server <address> Start the editor debug server (<IP>:<port>, e.g. 127.0.0.1:6007)\n"); +-#endif + OS::get_singleton()->print(" -q, --quit Quit after the first iteration.\n"); + OS::get_singleton()->print(" -l, --language <locale> Use a specific locale (<locale> being a two-letter code).\n"); + OS::get_singleton()->print(" --path <directory> Path to a project (<directory> must contain a 'project.godot' file).\n"); +@@ -355,6 +356,7 @@ void Main::print_help(const char *p_binary) { + OS::get_singleton()->print(").\n"); + #endif + } +#endif - List<String> platform_args = OS::get_singleton()->get_cmdline_platform_args(); - // Add command line arguments. -@@ -774,6 +778,19 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph - } + /* Engine initialization + * +@@ -493,13 +495,22 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph #endif -+#ifndef TOOLS_ENABLED -+ if (I->get() == "--main-pack") { + List<String>::Element *N = I->next(); +- ++#ifdef TOOLS_ENABLED + if (I->get() == "-h" || I->get() == "--help" || I->get() == "/?") { // display help +- + show_help = true; + exit_code = ERR_HELP; // Hack to force an early exit in `main()` with a success code. + goto error; +- ++#else ++ if (I->get() == "--main-pack") { // needed for JS bindings + if (I->next()) { + main_pack = I->next()->get(); + N = I->next()->next(); @@ -53,34 +61,70 @@ index 2326e519bf..dddcae0be2 100644 + OS::get_singleton()->print("Missing path to main pack file, aborting.\n"); + goto error; + }; -+ } else { -+ user_args.push_back(I->get()); -+ } -+#else - if (adding_user_args) { - user_args.push_back(I->get()); - } else if (I->get() == "-h" || I->get() == "--help" || I->get() == "/?") { // display help -@@ -1315,18 +1328,15 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph - } else { ++#endif ++#ifdef TOOLS_ENABLED + } else if (I->get() == "--version") { + print_line(get_full_version_string()); + exit_code = ERR_HELP; // Hack to force an early exit in `main()` with a success code. +@@ -737,7 +748,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph + OS::get_singleton()->print("Missing render thread mode argument, aborting.\n"); + goto error; + } +-#ifdef TOOLS_ENABLED + } else if (I->get() == "-e" || I->get() == "--editor") { // starts editor + + editor = true; +@@ -773,7 +783,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph + + editor = true; main_args.push_back(I->get()); - } +-#endif + } else if (I->get() == "--path") { // set path of project to start or edit + + if (I->next()) { +@@ -806,9 +815,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph + } else { + project_path = path; + } +-#ifdef TOOLS_ENABLED + editor = true; +-#endif + } else if (I->get() == "-b" || I->get() == "--breakpoints") { // add breakpoints + + if (I->next()) { +@@ -840,15 +847,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph + goto error; + } + +- } else if (I->get() == "--main-pack") { +- if (I->next()) { +- main_pack = I->next()->get(); +- N = I->next()->next(); +- } else { +- OS::get_singleton()->print("Missing path to main pack file, aborting.\n"); +- goto error; +- }; - + } else if (I->get() == "-d" || I->get() == "--debug") { + debug_mode = "local"; + OS::get_singleton()->_debug_stdout = true; +@@ -897,6 +895,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph + OS::get_singleton()->disable_crash_handler(); + } else if (I->get() == "--skip-breakpoints") { + skip_breakpoints = true; +#endif - I = N; - } -- - #ifdef TOOLS_ENABLED - if (editor && project_manager) { - OS::get_singleton()->print( - "Error: Command line arguments implied opening both editor and project manager, which is not possible. Aborting.\n"); + } else { + main_args.push_back(I->get()); + } +@@ -909,7 +908,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph + OS::get_singleton()->print("Error: Command line arguments implied opening both editor and project manager, which is not possible. Aborting.\n"); goto error; } -#endif -- + // Network file system needs to be configured before globals, since globals are based on the // 'project.godot' file which will only be available through the network if this is enabled - FileAccessNetwork::configure(); -@@ -1348,7 +1358,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph +@@ -932,7 +930,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph FileAccess::make_default<FileAccessNetwork>(FileAccess::ACCESS_RESOURCES); } @@ -89,7 +133,28 @@ index 2326e519bf..dddcae0be2 100644 if (globals->setup(project_path, main_pack, upwards, editor) == OK) { #ifdef TOOLS_ENABLED found_project = true; -@@ -1848,9 +1858,11 @@ error: +@@ -1001,12 +999,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph + if (editor) { + packed_data->set_disabled(true); + globals->set_disable_feature_overrides(true); +- } +- +-#endif +- +-#ifdef TOOLS_ENABLED +- if (editor) { + Engine::get_singleton()->set_editor_hint(true); + main_args.push_back("--editor"); + if (!init_windowed) { +@@ -1281,7 +1273,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph + return OK; + + error: +- + video_driver = ""; + audio_driver = ""; + tablet_driver = ""; +@@ -1290,9 +1281,11 @@ error: args.clear(); main_args.clear(); @@ -99,14 +164,14 @@ index 2326e519bf..dddcae0be2 100644 } +#endif - EngineDebugger::deinitialize(); - -@@ -1897,7 +1909,7 @@ error: + if (performance) { + memdelete(performance); +@@ -1338,7 +1331,7 @@ error: Error Main::setup2(Thread::ID p_main_tid_override) { // Print engine name and version - print_line(String(VERSION_NAME) + " v" + get_full_version_string() + " - " + String(VERSION_WEBSITE)); + print_line("v" + get_full_version_string()); - engine->startup_benchmark_begin_measure("servers"); - + #if !defined(NO_THREADS) + if (p_main_tid_override) { diff --git a/patches/no-touchpad-gamepad.patch b/patches/no-touchpad-gamepad.patch deleted file mode 100644 index 41116af..0000000 --- a/patches/no-touchpad-gamepad.patch +++ /dev/null @@ -1,26 +0,0 @@ -From bc17abceea50eafee49824b8d93fbc2a94facc26 Mon Sep 17 00:00:00 2001 -From: Marcel Admiraal <[email protected]> -Date: Tue, 22 Mar 2022 11:20:17 +0000 -Subject: [PATCH] Improve detection of gamepads on Linux - -Requires gamepads to have a right x and y axis. ---- - platform/linuxbsd/joypad_linux.cpp | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/platform/linuxbsd/joypad_linux.cpp b/platform/linuxbsd/joypad_linux.cpp -index 65d53b266f7d..475107293f31 100644 ---- a/platform/linuxbsd/joypad_linux.cpp -+++ b/platform/linuxbsd/joypad_linux.cpp -@@ -333,9 +333,8 @@ void JoypadLinux::open_joypad(const char *p_path) { - } - - // Check if the device supports basic gamepad events -- bool has_abs_left = (test_bit(ABS_X, absbit) && test_bit(ABS_Y, absbit)); -- bool has_abs_right = (test_bit(ABS_RX, absbit) && test_bit(ABS_RY, absbit)); -- if (!(test_bit(EV_KEY, evbit) && test_bit(EV_ABS, evbit) && (has_abs_left || has_abs_right))) { -+ if (!(test_bit(EV_KEY, evbit) && test_bit(EV_ABS, evbit) && -+ test_bit(ABS_RX, absbit) && test_bit(ABS_RY, absbit))) { - close(fd); - return; - } |