diff options
Diffstat (limited to 'drivers/unix/os_unix.cpp')
-rw-r--r-- | drivers/unix/os_unix.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index aa01f22673..05dfd69f58 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -73,13 +73,21 @@ void OS_Unix::debug_break() { assert(false); }; -int OS_Unix::get_audio_driver_count() const { +static void handle_interrupt(int sig) { + if (ScriptDebugger::get_singleton() == NULL) + return; - return 1; + ScriptDebugger::get_singleton()->set_depth(-1); + ScriptDebugger::get_singleton()->set_lines_left(1); } -const char *OS_Unix::get_audio_driver_name(int p_driver) const { - return "dummy"; +void OS_Unix::initialize_debugging() { + + if (ScriptDebugger::get_singleton() != NULL) { + struct sigaction action; + action.sa_handler = handle_interrupt; + sigaction(SIGINT, &action, NULL); + } } int OS_Unix::unix_initialize_audio(int p_audio_driver) { @@ -98,10 +106,11 @@ void handle_sigchld(int sig) { void OS_Unix::initialize_core() { -#ifdef NO_PTHREADS +#ifdef NO_THREADS ThreadDummy::make_default(); SemaphoreDummy::make_default(); MutexDummy::make_default(); + RWLockDummy::make_default(); #else ThreadPosix::make_default(); SemaphorePosix::make_default(); @@ -235,7 +244,7 @@ OS::TimeZoneInfo OS_Unix::get_time_zone_info() const { void OS_Unix::delay_usec(uint32_t p_usec) const { - struct timespec rem = { p_usec / 1000000, (p_usec % 1000000) * 1000 }; + struct timespec rem = { static_cast<time_t>(p_usec / 1000000), static_cast<long>((p_usec % 1000000) * 1000) }; while (nanosleep(&rem, &rem) == EINTR) { } } @@ -357,6 +366,12 @@ Error OS_Unix::open_dynamic_library(const String p_path, void *&p_library_handle String path = p_path; + if (FileAccess::exists(path) && path.is_rel_path()) { + // dlopen expects a slash, in this case a leading ./ for it to be interpreted as a relative path, + // otherwise it will end up searching various system directories for the lib instead and finally failing. + path = "./" + path; + } + if (!FileAccess::exists(path)) { //this code exists so gdnative can load .so files from within the executable path path = get_executable_path().get_base_dir().plus_file(p_path.get_file()); |