Commit Graph

741 Commits

Author SHA1 Message Date
Jamie Pate b18e1e0dcd Fix Game window stops responding when debugger pauses
Fixes #73374

As of godot 4 On windows/osx the game window will be frozen and will not
be updated.

In the debugger loop it calls

OS::get_singleton()->process_and_drop_events();
which allows windows/osx to handle system events. If the window doesn't
handle these events then both systems will judge the window to be 'not
responding' (osx beachball cursor)

When the event processing code was migrated from OS to DisplayServer the
process_and_drop_events() logic was moved to DisplayServer, but the call
inside the remote debugger pause loop was not updated to call the
DisplayServer version, there are currently no implementations of
OS::process_and_drop_events() so i removed it and switched to the new
DisplayServer::force_process_and_drop_events() method.
2024-07-10 13:38:57 -07:00
Hugo Locurcio 492787b134
Prevent folder names with trailing periods from being used automatically
Folder names ending with one or more `.` characters are not allowed
on Windows, so this would break writing logs, shader cache and other
project-specific files. Trailing periods are now stripped in this case.

On non-Windows platforms, this change still applies in the interest
of portability.
2024-06-26 17:42:47 +02:00
Ibrahn Sahir 607c5ec49f Move MIDI parsing up from ALSA driver to platform independent driver.
Aims for more consistent MIDI support across Windows, MacOS, Linux and
to provide a base for adding MIDI drivers for other platforms.
Reworks the MIDIDriverALSAMidi MIDI parsing implementation as a platform
independent version in MIDIDriver::Parser.
Uses MIDIDriver::Parser to provide running status support in MacOS
MIDIDriverCoreMidi.
Collects connected input names at open, ensuring devices indices reported
in events match names in array returned from get_connected_inputs.

Fixes #77035.
Fixes #79811.

With code review changes by: A Thousand Ships (she/her)
<96648715+AThousandShips@users.noreply.github.com>
2024-06-25 16:46:30 +01:00
Mikael Hermansson 53d3d66f9f Add `nothreads` feature tag to signify lack of `THREADS_ENABLED` 2024-06-24 19:52:21 +02:00
Radiant 789c6ebdfd Implement `amplitude` to Input.vibrate_handheld
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: m4gr3d <m4gr3d@users.noreply.github.com>
2024-05-02 19:09:42 +03:00
kobewi 3ebb5b84a0 Add separate feature tags for editor runtime 2024-04-26 14:44:38 +02:00
Fredia Huya-Kouadio 764de7fe31 Collapse the gdextension arguments into the `GDExtensionData` struct
This is used to reduce the number of arguments to `OS::open_dynamic_library(...)`.
2024-04-19 07:56:02 -07:00
Fredia Huya-Kouadio ede88cf59d Fix loading GDExtension dependencies on Android 2024-04-19 07:55:08 -07:00
kobewi dce4a3e4c2 Add get_process_exit_code() method 2024-04-16 12:46:15 +02:00
Rémi Verschelde e73f40e260
Merge pull request #87117 from DmitriySalnikov/rename_pdb
Add renaming of PDB files to avoid blocking them
2024-04-11 11:02:31 +02:00
DmitriySalnikov b73e740786 Add renaming of PDB files to avoid blocking them 2024-04-05 00:14:23 +03:00
Thaddeus Crews bbb3eb3a1a
Update lingering `do/while(0)` defines 2024-04-04 14:17:22 -05:00
bruvzg 082b420c0a
Implement `OS.execute_with_pipe` method to run process with redirected stdio.
Implement `pipe://*` path handling for creation of named pipes.
2024-03-27 11:41:16 +02:00
Rémi Verschelde f49efbe0e5
Merge pull request #89229 from akien-mga/main-refactor-os-exit-code
Refactor OS exit code to be `EXIT_SUCCESS` by default
2024-03-24 01:15:06 +01:00
Ricardo Buring 2ed2ccc2d8 Fixed Timestep Interpolation (2D)
Adds fixed timestep interpolation to the rendering server (2D only).
Switchable on and off with a project setting (default is off).

Co-authored-by: lawnjelly <lawnjelly@gmail.com>
2024-03-23 12:28:36 +01:00
Rémi Verschelde 023dcd44c1
Refactor OS exit code to be `EXIT_SUCCESS` by default
- `Main::setup` early exits (failure or `--help`/`--version`) now
  consistently return `EXIT_FAILURE` or `EXIT_SUCCESS` on all platforms,
  instead of 255 on some and a Godot Error code on others.
- `Main::start` now returns the exit code, simplifying the handling of early
  failures.
- `Main::iteration` needs to explicit set the exit code in OS if it errors
  out.
- Web and iOS now properly return `OS::get_exit_code()` instead of 0.
2024-03-08 23:31:24 +01:00
Thaddeus Crews 9903e6779b
Enforce template syntax `typename` over `class` 2024-03-07 22:39:09 -06:00
Rémi Verschelde 8a3a559023
Merge pull request #86620 from fbcosentino/midi_device_id
Add MIDI controller device index to `InputEventMIDI.device` property.
2024-02-19 17:06:22 +01:00
Fernando Cosentino b9fd25ea18 Add MIDI controller device index to InputEventMIDI.device property.
It is possible to query the OS for the connected MIDI controllers,
but the event messages' device field was not being used. This implements
controller index being sent in InputEventMIDI messages in the device
property, matching the index from OS.get_connected_midi_inputs().

Based on the work done by @ramdor.

Closes godotengine/godot-proposals#7733

Co-authored-by: Richie <richie_github@grange-lane.co.uk>
2024-02-19 10:23:19 +00:00
Muller-Castro a8bc9f3e78 Add const lvalue ref to core/* container parameters 2024-02-14 11:20:36 -03:00
Rémi Verschelde 62143552f3
Merge pull request #87635 from rune-scape/manage-time-singleton
Manage time singleton in `register_core_types`
2024-02-12 13:34:13 +01:00
rune-scape c5bcc3ae86 Manage time singleton 2024-02-11 14:39:20 -08:00
bruvzg 7bcb419149
[Core] Improve `CowData` and `Memory` metadata alignment. 2024-02-05 17:30:02 +02:00
Rémi Verschelde 63d6bda8e9
Merge pull request #87871 from vittorioromeo/use_v_shorthand
Use `_v` shorthand for type traits and `if constexpr` where appropriate
2024-02-05 15:00:23 +01:00
vittorioromeo 71e0082ab0 Extract 'SafeBinaryMutex' to separate header
This change simply extracts 'SafeBinaryMutex' from 'mutex.h' to
    'safe_binary_mutex.h', in an effort to reduce the compilation
    speed impact of including `mutex.h`.
2024-02-04 16:59:54 +01:00
vittorioromeo 55ed34e37c Use '_v' shorthand for type traits and 'if constexpr' where appropriate 2024-02-02 15:43:21 +01:00
Rémi Verschelde c1dbaa73a6
Merge pull request #87393 from stuartcarnie/bugfix
Use `os_unfair_lock` on Apple platforms
2024-01-29 13:17:00 +01:00
Mel Collins 8406e60522 Add InputEventKey.location to tell left from right
This adds a new enum `KeyLocation` and associated property
`InputEventKey.location`, which indicates the left/right location of key
events which may come from one of two physical keys, eg. Shift, Ctrl.

It also adds simulation of missing Shift KEYUP events for Windows.
When multiple Shifts are held down at the same time, Windows natively
only sends a KEYUP for the last one to be released.
2024-01-26 14:42:28 +01:00
Stuart Carnie e28b31ec96
Use `os_unfair_lock` on Apple platforms 2024-01-21 06:23:09 +11:00
Adam Scott bd70b8e1f6
Add THREADS_ENABLED macro in order to compile Godot to run on the main thread 2024-01-17 13:58:29 -05:00
Rémi Verschelde dc79e956b6
Merge pull request #86587 from RandomShaper/wtp_enhance
Enhance & fix `WorkerThreadPool`
2024-01-11 17:38:09 +01:00
Pedro J. Estébanez 9444d297ed WorkerThreadPool: Overhaul scheduling and synchronization
This commits rewrites the sync logic in a way that the
`use_system_threads_for_low_priority_tasks` setting, which was added due to
the lack of a cross-platform wait-for-multiple-objects functionality, can be
removed (it's as if it was effectively hardcoded to `false`).

With the new implementation, we have the best of both worlds: threads don't
have to poll, plus no bespoke threads are used.

In addition, regarding deadlock prevention, since not every possible case of
wait-deadlock could be avoided, this commits removes the current best-effort
avoidance mechanisms and keeps only a simple, pessimistic way of detection.

It turns out that the only current user of deadlock prevention, ResourceLoader,
works fine with it and so every possible situation in resource loading is now
properly handled, with no possibilities of deadlocking. There's a comment in
the code with further details.

Lastly, a potential for load tasks never being awaited/disposed is cleared.
2024-01-08 12:45:42 +01:00
Wilson E. Alvarez a3cb1b096f
Add const references detected by clang-tidy 2023-12-16 13:36:44 -05:00
Yuri Sizov fc3f40f37d Improve engine startup/shutdown benchmarks
- Add contexts to give a better sense of benchmarked areas.
- Add missing benchmarks and adjust some begin/end points.
- Clean up names.
- Improve Android's internal benchmarks in a similar manner.

Co-authored-by: Fredia Huya-Kouadio <fhuya@meta.com>
2023-12-08 12:53:04 +01:00
Pedro J. Estébanez fe4850c0d0 Use mingw-std-threads in MinGW builds 2023-11-18 11:56:05 +01:00
bruvzg d4d5d68eda
[iOS, GDExtension] Fix loading and exporting static libraries and xcframeworks. 2023-11-09 20:04:40 +02:00
Rémi Verschelde 0a10f09ce4
Web: Clarify that `OS.get_unique_id` is not supported
Remove the base error message in `OS`, we no longer really error out this
way for not implemented methods. Instead, each platform should override them
to provide the context they want.

Fixes #82439.
2023-09-27 15:17:45 +02:00
A Thousand Ships 893f889d74 [Core] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-09-11 19:45:49 +02:00
Yuri Sizov d8ff69d53c Extract ScriptInstance to simplify includes
This allows to include script_instance.h directly in the
generated gdvirtual.gen.inc, and remove excessive includes
from the codebase.

This should also allow Resource to use GDVIRTUAL macros,
which wasn't possible previously due to a circular dependency.
2023-09-06 22:54:38 +02:00
Fredia Huya-Kouadio 8cc7739197 Godot Android plugin re-architecture 2023-09-03 17:04:10 -07:00
AttackButton 8908ac4e6e Add missing YEN, SECTION and OPENURL names to keycode mappings 2023-08-28 03:37:22 -03:00
bruvzg 4790da7900
[macOS] Implement optional native file selection dialog support for sandboxed apps. 2023-07-12 22:36:24 +03:00
Yuri Sizov 95da8e1394 Merge pull request #70771 from kleonc/main-loop-set-after-resolved
Ensure `MainLoop` and its custom script is set right after it's resolved
2023-07-12 17:15:59 +02:00
Rémi Verschelde 91f029e912
Merge pull request #74012 from myaaaaaaaaa/remove-tap
Remove unused `threaded_array_processor.h`
2023-07-08 18:15:15 +02:00
Daylily-Zeleen 9dd9818c88 Fixed the fallback logic of OS::shell_show_in_file_manager 2023-07-06 13:16:04 +08:00
Rémi Verschelde 92ca08311c
Merge pull request #47996 from madmiraal/fix-17430
Fix `OS.find_scancode_from_string()` not working with modifiers
2023-06-19 15:39:06 +02:00
Danil Alexeev eb391d3302
Display `BitField[Enum]` in docs to distinguish from `Enum` 2023-06-15 17:23:02 +03:00
Rémi Verschelde 390d87e974
Merge pull request #71352 from m4gr3d/editor_optimization_main
Improve startup benchmarking
2023-05-24 08:43:52 +02:00
Pedro J. Estébanez e725b4b02b Allow threads to mark themselves as safe for nodes 2023-05-24 00:22:58 +02:00
Fredia Huya-Kouadio 831b4a5366 Improve startup benchmarking
Move the benchmarking measuring methods from `Engine` to `OS` to allow for platform specific overrides (e.g: can be used to hook into platform specific benchmarking and tracing capabilities).
2023-05-23 13:22:35 -07:00