summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/os_android.cpp7
-rw-r--r--platform/haiku/os_haiku.cpp6
-rw-r--r--platform/javascript/os_javascript.cpp22
-rw-r--r--platform/osx/crash_handler_osx.mm3
-rw-r--r--platform/osx/os_osx.mm7
-rw-r--r--platform/server/os_server.cpp8
-rw-r--r--platform/server/os_server.h2
-rw-r--r--platform/uwp/os_uwp.cpp7
-rw-r--r--platform/windows/crash_handler_win.cpp4
-rw-r--r--platform/windows/godot_win.cpp38
-rw-r--r--platform/windows/os_windows.cpp7
-rw-r--r--platform/x11/crash_handler_x11.cpp3
-rw-r--r--platform/x11/export/export.cpp1
-rw-r--r--platform/x11/os_x11.cpp33
-rw-r--r--platform/x11/os_x11.h7
15 files changed, 44 insertions, 111 deletions
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 1de2608b9e..dbea2d7531 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -137,12 +137,7 @@ void OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int
visual_server->init();
// visual_server->cursor_set_visible(false, 0);
- AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
-
- if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) {
-
- ERR_PRINT("Initializing audio failed.");
- }
+ AudioDriverManager::initialize(p_audio_driver);
physics_server = memnew(PhysicsServerSW);
physics_server->init();
diff --git a/platform/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp
index de2f79a0ac..9f2f88bb4e 100644
--- a/platform/haiku/os_haiku.cpp
+++ b/platform/haiku/os_haiku.cpp
@@ -137,11 +137,7 @@ void OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p_
//physics_2d_server = Physics2DServerWrapMT::init_server<Physics2DServerSW>();
physics_2d_server->init();
- AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
-
- if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) {
- ERR_PRINT("Initializing audio failed.");
- }
+ AudioDriverManager::initialize(p_audio_driver);
power_manager = memnew(PowerHaiku);
}
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 543d028576..f103035b27 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -172,14 +172,14 @@ static EM_BOOL _mousebutton_callback(int event_type, const EmscriptenMouseEvent
if (!is_canvas_focused()) {
focus_canvas();
}
- mask |= 1 << ev->get_button_index();
- } else if (mask & (1 << ev->get_button_index())) {
- mask &= ~(1 << ev->get_button_index());
+ mask |= ev->get_button_index();
+ } else if (mask & ev->get_button_index()) {
+ mask &= ~ev->get_button_index();
} else {
// release event, but press was outside the canvas, so ignore
return false;
}
- ev->set_button_mask(mask >> 1);
+ ev->set_button_mask(mask);
_input->parse_input_event(ev);
// prevent selection dragging
@@ -200,7 +200,7 @@ static EM_BOOL _mousemove_callback(int event_type, const EmscriptenMouseEvent *m
Ref<InputEventMouseMotion> ev;
ev.instance();
dom2godot_mod(mouse_event, ev);
- ev->set_button_mask(input_mask >> 1);
+ ev->set_button_mask(input_mask);
ev->set_position(pos);
ev->set_global_position(ev->get_position());
@@ -227,7 +227,7 @@ static EM_BOOL _wheel_callback(int event_type, const EmscriptenWheelEvent *wheel
Ref<InputEventMouseButton> ev;
ev.instance();
- ev->set_button_mask(_input->get_mouse_button_mask() >> 1);
+ ev->set_button_mask(_input->get_mouse_button_mask());
ev->set_position(_input->get_mouse_position());
ev->set_global_position(ev->get_position());
@@ -291,7 +291,7 @@ static EM_BOOL _touchpress_callback(int event_type, const EmscriptenTouchEvent *
Ref<InputEventMouseButton> ev_mouse;
ev_mouse.instance();
- ev_mouse->set_button_mask(_input->get_mouse_button_mask() >> 1);
+ ev_mouse->set_button_mask(_input->get_mouse_button_mask());
dom2godot_mod(touch_event, ev_mouse);
const EmscriptenTouchPoint &first_touch = touch_event->touches[lowest_id_index];
@@ -334,7 +334,7 @@ static EM_BOOL _touchmove_callback(int event_type, const EmscriptenTouchEvent *t
Ref<InputEventMouseMotion> ev_mouse;
ev_mouse.instance();
dom2godot_mod(touch_event, ev_mouse);
- ev_mouse->set_button_mask(_input->get_mouse_button_mask() >> 1);
+ ev_mouse->set_button_mask(_input->get_mouse_button_mask());
const EmscriptenTouchPoint &first_touch = touch_event->touches[lowest_id_index];
ev_mouse->set_position(Point2(first_touch.canvasX, first_touch.canvasY));
@@ -464,11 +464,7 @@ void OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, i
print_line("Init Audio");
AudioDriverManager::add_driver(&audio_driver_javascript);
- audio_driver_javascript.set_singleton();
- if (audio_driver_javascript.init() != OK) {
-
- ERR_PRINT("Initializing audio failed.");
- }
+ AudioDriverManager::initialize(p_audio_driver);
RasterizerGLES3::register_config();
RasterizerGLES3::make_current();
diff --git a/platform/osx/crash_handler_osx.mm b/platform/osx/crash_handler_osx.mm
index 9239573734..2ed88db309 100644
--- a/platform/osx/crash_handler_osx.mm
+++ b/platform/osx/crash_handler_osx.mm
@@ -43,6 +43,7 @@
#include <dlfcn.h>
#include <execinfo.h>
#include <signal.h>
+#include <stdlib.h>
#include <mach-o/dyld.h>
#include <mach-o/getsect.h>
@@ -77,7 +78,7 @@ static void handle_crash(int sig) {
void *bt_buffer[256];
size_t size = backtrace(bt_buffer, 256);
String _execpath = OS::get_singleton()->get_executable_path();
- String msg = GLOBAL_GET("debug/settings/backtrace/message");
+ String msg = GLOBAL_GET("debug/settings/crash_handler/message");
// Dump the backtrace to stderr with a message to the user
fprintf(stderr, "%s: Program crashed with signal %d\n", __FUNCTION__, sig);
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 5a23d76755..111cdb0cf1 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1088,12 +1088,7 @@ void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
visual_server->init();
// visual_server->cursor_set_visible(false, 0);
- AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
-
- if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) {
-
- ERR_PRINT("Initializing audio failed.");
- }
+ AudioDriverManager::initialize(p_audio_driver);
//
physics_server = memnew(PhysicsServerSW);
diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp
index e2bb464e76..300c5cffcc 100644
--- a/platform/server/os_server.cpp
+++ b/platform/server/os_server.cpp
@@ -62,12 +62,7 @@ void OS_Server::initialize(const VideoMode &p_desired, int p_video_driver, int p
//visual_server = memnew( VisualServerRaster(rasterizer) );
- AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
-
- if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) {
-
- ERR_PRINT("Initializing audio failed.");
- }
+ AudioDriverManager::initialize(p_audio_driver);
sample_manager = memnew(SampleManagerMallocSW);
audio_server = memnew(AudioServerSW(sample_manager));
@@ -232,7 +227,6 @@ void OS_Server::run() {
OS_Server::OS_Server() {
- AudioDriverManager::add_driver(&driver_dummy);
//adriver here
grab = false;
};
diff --git a/platform/server/os_server.h b/platform/server/os_server.h
index 8c0ca1a58d..ba12f649be 100644
--- a/platform/server/os_server.h
+++ b/platform/server/os_server.h
@@ -34,7 +34,6 @@
#include "drivers/rtaudio/audio_driver_rtaudio.h"
#include "drivers/unix/os_unix.h"
#include "main/input_default.h"
-#include "servers/audio/audio_driver_dummy.h"
#include "servers/audio_server.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "servers/physics_server.h"
@@ -55,7 +54,6 @@ class OS_Server : public OS_Unix {
List<String> args;
MainLoop *main_loop;
- AudioDriverDummy driver_dummy;
bool grab;
PhysicsServer *physics_server;
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index fd8904fa0a..b909ccccd6 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -268,12 +268,7 @@ void OSUWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_aud
joypad = ref new JoypadUWP(input);
joypad->register_events();
- AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
-
- if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) {
-
- ERR_PRINT("Initializing audio failed.");
- }
+ AudioDriverManager::initialize(p_audio_driver);
power_manager = memnew(PowerUWP);
diff --git a/platform/windows/crash_handler_win.cpp b/platform/windows/crash_handler_win.cpp
index c9385f36d6..2f5ee7956e 100644
--- a/platform/windows/crash_handler_win.cpp
+++ b/platform/windows/crash_handler_win.cpp
@@ -116,7 +116,7 @@ DWORD CrashHandlerException(EXCEPTION_POINTERS *ep) {
DWORD cbNeeded;
std::vector<HMODULE> module_handles(1);
- if (OS::get_singleton() == NULL || OS::get_singleton()->is_disable_crash_handler()) {
+ if (OS::get_singleton() == NULL || OS::get_singleton()->is_disable_crash_handler() || IsDebuggerPresent()) {
return EXCEPTION_CONTINUE_SEARCH;
}
@@ -159,7 +159,7 @@ DWORD CrashHandlerException(EXCEPTION_POINTERS *ep) {
IMAGE_NT_HEADERS *h = ImageNtHeader(base);
DWORD image_type = h->FileHeader.Machine;
int n = 0;
- String msg = GLOBAL_GET("debug/settings/backtrace/message");
+ String msg = GLOBAL_GET("debug/settings/crash_handler/message");
fprintf(stderr, "Dumping the backtrace. %ls\n", msg.c_str());
diff --git a/platform/windows/godot_win.cpp b/platform/windows/godot_win.cpp
index 4450cb3670..cff2cbad42 100644
--- a/platform/windows/godot_win.cpp
+++ b/platform/windows/godot_win.cpp
@@ -156,32 +156,36 @@ int widechar_main(int argc, wchar_t **argv) {
return os.get_exit_code();
};
-int main(int _argc, char **_argv) {
-// _argc and _argv are ignored
-// we are going to use the WideChar version of them instead
+int _main() {
+ LPWSTR *wc_argv;
+ int argc;
+ int result;
-#ifdef CRASH_HANDLER_EXCEPTION
- __try {
-#endif
- LPWSTR *wc_argv;
- int argc;
- int result;
+ wc_argv = CommandLineToArgvW(GetCommandLineW(), &argc);
+
+ if (NULL == wc_argv) {
+ wprintf(L"CommandLineToArgvW failed\n");
+ return 0;
+ }
- wc_argv = CommandLineToArgvW(GetCommandLineW(), &argc);
+ result = widechar_main(argc, wc_argv);
- if (NULL == wc_argv) {
- wprintf(L"CommandLineToArgvW failed\n");
- return 0;
- }
+ LocalFree(wc_argv);
+ return result;
+}
- result = widechar_main(argc, wc_argv);
+int main(int _argc, char **_argv) {
+// _argc and _argv are ignored
+// we are going to use the WideChar version of them instead
- LocalFree(wc_argv);
- return result;
#ifdef CRASH_HANDLER_EXCEPTION
+ __try {
+ return _main();
} __except (CrashHandlerException(GetExceptionInformation())) {
return 1;
}
+#else
+ return _main();
#endif
}
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 62954e1a56..461caf479c 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -1081,12 +1081,7 @@ void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
power_manager = memnew(PowerWindows);
- AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
-
- if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) {
-
- ERR_PRINT("Initializing audio failed.");
- }
+ AudioDriverManager::initialize(p_audio_driver);
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(TRACKMOUSEEVENT);
diff --git a/platform/x11/crash_handler_x11.cpp b/platform/x11/crash_handler_x11.cpp
index c926b7799d..3c54d5cbc2 100644
--- a/platform/x11/crash_handler_x11.cpp
+++ b/platform/x11/crash_handler_x11.cpp
@@ -39,6 +39,7 @@
#include <dlfcn.h>
#include <execinfo.h>
#include <signal.h>
+#include <stdlib.h>
static void handle_crash(int sig) {
if (OS::get_singleton() == NULL)
@@ -47,7 +48,7 @@ static void handle_crash(int sig) {
void *bt_buffer[256];
size_t size = backtrace(bt_buffer, 256);
String _execpath = OS::get_singleton()->get_executable_path();
- String msg = GLOBAL_GET("debug/settings/backtrace/message");
+ String msg = GLOBAL_GET("debug/settings/crash_handler/message");
// Dump the backtrace to stderr with a message to the user
fprintf(stderr, "%s: Program crashed with signal %d\n", __FUNCTION__, sig);
diff --git a/platform/x11/export/export.cpp b/platform/x11/export/export.cpp
index 59b1a44247..fdb43c9ae0 100644
--- a/platform/x11/export/export.cpp
+++ b/platform/x11/export/export.cpp
@@ -50,6 +50,7 @@ void register_x11_exporter() {
platform->set_release_64("linux_x11_64_release");
platform->set_debug_64("linux_x11_64_debug");
platform->set_os_name("X11");
+ platform->set_chmod_flags(0755);
EditorExport::get_singleton()->add_export_platform(platform);
}
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 4e78e0318c..3e8709a11e 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -313,29 +313,7 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
XFree(xsh);
}
- AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
-
- audio_driver_index = p_audio_driver;
- if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) {
-
- bool success = false;
- audio_driver_index = -1;
- for (int i = 0; i < AudioDriverManager::get_driver_count(); i++) {
- if (i == p_audio_driver)
- continue;
- AudioDriverManager::get_driver(i)->set_singleton();
- if (AudioDriverManager::get_driver(i)->init() == OK) {
- success = true;
- print_line("Audio Driver Failed: " + String(AudioDriverManager::get_driver(p_audio_driver)->get_name()));
- print_line("Using alternate audio driver: " + String(AudioDriverManager::get_driver(i)->get_name()));
- audio_driver_index = i;
- break;
- }
- }
- if (!success) {
- ERR_PRINT("Initializing audio failed.");
- }
- }
+ AudioDriverManager::initialize(p_audio_driver);
ERR_FAIL_COND(!visual_server);
ERR_FAIL_COND(x11_window == 0);
@@ -2189,10 +2167,6 @@ bool OS_X11::is_disable_crash_handler() const {
OS_X11::OS_X11() {
-#ifdef RTAUDIO_ENABLED
- AudioDriverManager::add_driver(&driver_rtaudio);
-#endif
-
#ifdef PULSEAUDIO_ENABLED
AudioDriverManager::add_driver(&driver_pulseaudio);
#endif
@@ -2201,11 +2175,6 @@ OS_X11::OS_X11() {
AudioDriverManager::add_driver(&driver_alsa);
#endif
- if (AudioDriverManager::get_driver_count() == 0) {
- WARN_PRINT("No sound driver found... Defaulting to dummy driver");
- AudioDriverManager::add_driver(&driver_dummy);
- }
-
minimized = false;
xim_style = 0L;
mouse_mode = MOUSE_MODE_VISIBLE;
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index 2ba7f07cef..0e2430c650 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -38,11 +38,9 @@
//#include "servers/visual/visual_server_wrap_mt.h"
#include "drivers/alsa/audio_driver_alsa.h"
#include "drivers/pulseaudio/audio_driver_pulseaudio.h"
-#include "drivers/rtaudio/audio_driver_rtaudio.h"
#include "joypad_linux.h"
#include "main/input_default.h"
#include "power_x11.h"
-#include "servers/audio/audio_driver_dummy.h"
#include "servers/audio_server.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "servers/physics_2d/physics_2d_server_wrap_mt.h"
@@ -154,10 +152,6 @@ class OS_X11 : public OS_Unix {
JoypadLinux *joypad;
#endif
-#ifdef RTAUDIO_ENABLED
- AudioDriverRtAudio driver_rtaudio;
-#endif
-
#ifdef ALSA_ENABLED
AudioDriverALSA driver_alsa;
#endif
@@ -165,7 +159,6 @@ class OS_X11 : public OS_Unix {
#ifdef PULSEAUDIO_ENABLED
AudioDriverPulseAudio driver_pulseaudio;
#endif
- AudioDriverDummy driver_dummy;
Atom net_wm_icon;