diff options
Diffstat (limited to 'platform')
33 files changed, 146 insertions, 156 deletions
diff --git a/platform/android/AndroidManifest.xml.template b/platform/android/AndroidManifest.xml.template index be5afb406a..9d8eb951c4 100644 --- a/platform/android/AndroidManifest.xml.template +++ b/platform/android/AndroidManifest.xml.template @@ -17,7 +17,7 @@ android:launchMode="singleTask" android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize"> - + <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> @@ -26,7 +26,7 @@ <service android:name="org.godotengine.godot.GodotDownloaderService" /> - + $$ADD_APPLICATION_CHUNKS$$ @@ -200,6 +200,6 @@ $$ADD_PERMISSION_CHUNKS$$ <uses-permission android:name="godot.custom.18"/> <uses-permission android:name="godot.custom.19"/> -<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="23"/> - -</manifest> +<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="23"/> + +</manifest> diff --git a/platform/android/SCsub b/platform/android/SCsub index 87e7ee4747..e9a370869f 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -73,7 +73,7 @@ for x in env.android_gradle_plugins: gradle_classpath = "" for x in env.android_gradle_classpath: gradle_classpath += "\t\tclasspath \"" + x + "\"\n" - + gradle_res_dirs_text = "" for x in env.android_res_dirs: @@ -93,13 +93,13 @@ gradle_asset_dirs_text = "" gradle_default_config_text = "" -minSdk = 14 +minSdk = 18 targetSdk = 23 for x in env.android_default_config: - if x.startswith("minSdkVersion") and int(x.split(" ")[-1]) < minSdk: + if x.startswith("minSdkVersion") and int(x.split(" ")[-1]) < minSdk: x = "minSdkVersion " + str(minSdk) - if x.startswith("targetSdkVersion") and int(x.split(" ")[-1]) > targetSdk: + if x.startswith("targetSdkVersion") and int(x.split(" ")[-1]) > targetSdk: x = "targetSdkVersion " + str(targetSdk) gradle_default_config_text += x + "\n\t\t" diff --git a/platform/android/file_access_android.cpp b/platform/android/file_access_android.cpp index f207b81b4b..c7b0d9afcd 100644 --- a/platform/android/file_access_android.cpp +++ b/platform/android/file_access_android.cpp @@ -95,7 +95,7 @@ void FileAccessAndroid::seek_end(int64_t p_position) { pos = len + p_position; } -size_t FileAccessAndroid::get_pos() const { +size_t FileAccessAndroid::get_position() const { return pos; } diff --git a/platform/android/file_access_android.h b/platform/android/file_access_android.h index c2ce2b0bfe..beccf494dd 100644 --- a/platform/android/file_access_android.h +++ b/platform/android/file_access_android.h @@ -53,7 +53,7 @@ public: virtual void seek(size_t p_position); ///< seek to a given position virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file - virtual size_t get_pos() const; ///< get position in the file + virtual size_t get_position() const; ///< get position in the file virtual size_t get_len() const; ///< get size of the file virtual bool eof_reached() const; ///< reading passed EOF diff --git a/platform/android/file_access_jandroid.cpp b/platform/android/file_access_jandroid.cpp index ad855c790d..fe934c89fb 100644 --- a/platform/android/file_access_jandroid.cpp +++ b/platform/android/file_access_jandroid.cpp @@ -106,7 +106,7 @@ void FileAccessJAndroid::seek_end(int64_t p_position) { seek(get_len()); } -size_t FileAccessJAndroid::get_pos() const { +size_t FileAccessJAndroid::get_position() const { JNIEnv *env = ThreadAndroid::get_env(); ERR_FAIL_COND_V(!is_open(), 0); diff --git a/platform/android/file_access_jandroid.h b/platform/android/file_access_jandroid.h index 8060312182..75a6a21335 100644 --- a/platform/android/file_access_jandroid.h +++ b/platform/android/file_access_jandroid.h @@ -57,7 +57,7 @@ public: virtual void seek(size_t p_position); ///< seek to a given position virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file - virtual size_t get_pos() const; ///< get position in the file + virtual size_t get_position() const; ///< get position in the file virtual size_t get_len() const; ///< get size of the file virtual bool eof_reached() const; ///< reading passed EOF 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/detect.py b/platform/haiku/detect.py index c0e003a3d2..61ee32d2dd 100644 --- a/platform/haiku/detect.py +++ b/platform/haiku/detect.py @@ -21,7 +21,7 @@ def can_build(): def get_opts(): return [ - ('debug_release', 'Add debug symbols to release version', 'no') + ('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes') ] @@ -36,16 +36,21 @@ def configure(env): ## Build type if (env["target"] == "release"): - if (env["debug_release"] == "yes"): + env.Prepend(CCFLAGS=['-O3', '-ffast-math']) + if (env["debug_symbols"] == "yes"): + env.Prepend(CCFLAGS=['-g1']) + if (env["debug_symbols"] == "full"): env.Prepend(CCFLAGS=['-g2']) - else: - env.Prepend(CCFLAGS=['-O3', '-ffast-math']) elif (env["target"] == "release_debug"): env.Prepend(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED']) + if (env["debug_symbols"] == "yes"): + env.Prepend(CCFLAGS=['-g1']) + if (env["debug_symbols"] == "full"): + env.Prepend(CCFLAGS=['-g2']) elif (env["target"] == "debug"): - env.Prepend(CCFLAGS=['-g2', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED']) + env.Prepend(CCFLAGS=['-g3', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED']) ## Architecture diff --git a/platform/haiku/haiku_direct_window.cpp b/platform/haiku/haiku_direct_window.cpp index 572df493ff..24a8a4b17b 100644 --- a/platform/haiku/haiku_direct_window.cpp +++ b/platform/haiku/haiku_direct_window.cpp @@ -157,8 +157,8 @@ void HaikuDirectWindow::HandleMouseButton(BMessage *message) { mouse_event.mouse_button.mod = GetKeyModifierState(modifiers); mouse_event->get_button_mask() = GetMouseButtonState(buttons); - mouse_event->get_pos().x = where.x; - mouse_event->get_pos().y = where.y; + mouse_event->get_position().x = where.x; + mouse_event->get_position().y = where.y; mouse_event.mouse_button.global_x = where.x; mouse_event.mouse_button.global_y = where.y; @@ -242,8 +242,8 @@ void HaikuDirectWindow::HandleMouseWheelChanged(BMessage *message) { mouse_event->get_button_index() = wheel_delta_y < 0 ? 4 : 5; mouse_event.mouse_button.mod = GetKeyModifierState(last_key_modifier_state); mouse_event->get_button_mask() = last_button_mask; - mouse_event->get_pos().x = last_mouse_position.x; - mouse_event->get_pos().y = last_mouse_position.y; + mouse_event->get_position().x = last_mouse_position.x; + mouse_event->get_position().y = last_mouse_position.y; mouse_event.mouse_button.global_x = last_mouse_position.x; mouse_event.mouse_button.global_y = last_mouse_position.y; 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/iphone/game_center.mm b/platform/iphone/game_center.mm index c05bdea005..821ef2a3ab 100644 --- a/platform/iphone/game_center.mm +++ b/platform/iphone/game_center.mm @@ -89,6 +89,7 @@ Error GameCenter::connect() { ret["type"] = "authentication"; if (player.isAuthenticated) { ret["result"] = "ok"; + ret["player_id"] = player.playerID; GameCenter::get_singleton()->connected = true; } else { ret["result"] = "error"; 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/SCsub b/platform/osx/SCsub index 5b2de54535..27bffbe80e 100644 --- a/platform/osx/SCsub +++ b/platform/osx/SCsub @@ -1,7 +1,11 @@ #!/usr/bin/env python +import os Import('env') +def make_debug(target, source, env): + os.system('dsymutil %s -o %s.dSYM' % (target[0], target[0])) + files = [ 'crash_handler_osx.mm', 'os_osx.mm', @@ -13,8 +17,7 @@ files = [ 'power_osx.cpp', ] -prog = env.Program('#bin/godot', files) -if (env['target'] == "debug" or env['target'] == "release_debug"): - # Build the .dSYM file for atos - action = "dsymutil " + File(prog)[0].path + " -o " + File(prog)[0].path + ".dSYM" - env.AddPostAction(prog, action) +binary = env.Program('#bin/godot', files) +if env["debug_symbols"] == "full" or env["debug_symbols"] == "yes": + env.AddPostAction(binary, make_debug) + 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/detect.py b/platform/osx/detect.py index d3ebdfe992..24302b5ff9 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -22,6 +22,7 @@ def get_opts(): return [ ('osxcross_sdk', 'OSXCross SDK version', 'darwin14'), + ('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes'), ] @@ -36,10 +37,18 @@ def configure(env): ## Build type if (env["target"] == "release"): - env.Prepend(CCFLAGS=['-O2', '-ffast-math', '-fomit-frame-pointer', '-ftree-vectorize', '-msse2']) + env.Prepend(CCFLAGS=['-O3', '-ffast-math', '-fomit-frame-pointer', '-ftree-vectorize', '-msse2']) + if (env["debug_symbols"] == "yes"): + env.Prepend(CCFLAGS=['-g1']) + if (env["debug_symbols"] == "full"): + env.Prepend(CCFLAGS=['-g2']) elif (env["target"] == "release_debug"): env.Prepend(CCFLAGS=['-O2', '-DDEBUG_ENABLED']) + if (env["debug_symbols"] == "yes"): + env.Prepend(CCFLAGS=['-g1']) + if (env["debug_symbols"] == "full"): + env.Prepend(CCFLAGS=['-g2']) elif (env["target"] == "debug"): env.Prepend(CCFLAGS=['-g3', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED']) diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index 059dd5afd0..c6a9aeba88 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -152,7 +152,7 @@ public: virtual void set_mouse_show(bool p_show); virtual void set_mouse_grab(bool p_grab); virtual bool is_mouse_grab_enabled() const; - virtual void warp_mouse_pos(const Point2 &p_to); + virtual void warp_mouse_position(const Point2 &p_to); virtual Point2 get_mouse_position() const; virtual int get_mouse_button_state() const; virtual void set_window_title(const String &p_title); diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 5a23d76755..da7321d72a 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); @@ -1245,7 +1240,7 @@ bool OS_OSX::is_mouse_grab_enabled() const { return mouse_grab; } -void OS_OSX::warp_mouse_pos(const Point2 &p_to) { +void OS_OSX::warp_mouse_position(const Point2 &p_to) { //copied from windows impl with osx native calls if (mouse_mode == MOUSE_MODE_CAPTURED) { 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/export/export.cpp b/platform/uwp/export/export.cpp index 25d44c24b5..d66bcaa91c 100644 --- a/platform/uwp/export/export.cpp +++ b/platform/uwp/export/export.cpp @@ -471,7 +471,7 @@ void AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t meta.uncompressed_size = p_len; meta.compressed_size = p_len; meta.compressed = p_compress; - meta.zip_offset = package->get_pos(); + meta.zip_offset = package->get_position(); Vector<uint8_t> file_buffer; @@ -619,11 +619,11 @@ void AppxPackager::finish() { // Write central directory EditorNode::progress_task_step("export", "Finishing package...", 6); - central_dir_offset = package->get_pos(); + central_dir_offset = package->get_position(); package->store_buffer(central_dir_data.ptr(), central_dir_data.size()); // End record - end_of_central_dir_offset = package->get_pos(); + end_of_central_dir_offset = package->get_position(); Vector<uint8_t> end_record = make_end_of_central_record(); package->store_buffer(end_record.ptr(), end_record.size()); 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/SCsub b/platform/windows/SCsub index b56a5c6a80..fd041e096e 100644 --- a/platform/windows/SCsub +++ b/platform/windows/SCsub @@ -1,7 +1,12 @@ #!/usr/bin/env python +import os Import('env') +def make_debug_mingw(target, source, env): + os.system('objcopy --only-keep-debug %s %s.debug' % (target[0], target[0])) + os.system('strip --strip-debug --strip-unneeded %s' % (target[0])) + os.system('objcopy --add-gnu-debuglink=%s.debug %s' % (target[0], target[0])) common_win = [ "context_gl_win.cpp", @@ -22,10 +27,14 @@ obj = env.RES(restarget, 'godot_res.rc') common_win.append(obj) -env.Program('#bin/godot', ['godot_win.cpp'] + common_win, PROGSUFFIX=env["PROGSUFFIX"]) +binary = env.Program('#bin/godot', ['godot_win.cpp'] + common_win, PROGSUFFIX=env["PROGSUFFIX"]) # Microsoft Visual Studio Project Generation if (env['vsproj']) == "yes": env.vs_srcs = env.vs_srcs + ["platform/windows/godot_win.cpp"] for x in common_win: env.vs_srcs = env.vs_srcs + ["platform/windows/" + str(x)] + +if not os.getenv("VCINSTALLDIR"): + if env["debug_symbols"] == "full" or env["debug_symbols"] == "yes": + env.AddPostAction(binary, make_debug_mingw) 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/detect.py b/platform/windows/detect.py index 5bd9a78f49..65eb51a2f3 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -64,6 +64,7 @@ def get_opts(): return [ ('mingw_prefix_32', 'MinGW prefix (Win32)', mingw32), ('mingw_prefix_64', 'MinGW prefix (Win64)', mingw64), + ('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes') ] @@ -213,11 +214,20 @@ def configure(env): env.Append(LINKFLAGS=['-Wl,--subsystem,windows']) + if (env["debug_symbols"] == "yes"): + env.Prepend(CCFLAGS=['-g1']) + if (env["debug_symbols"] == "full"): + env.Prepend(CCFLAGS=['-g2']) + elif (env["target"] == "release_debug"): env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED']) + if (env["debug_symbols"] == "yes"): + env.Prepend(CCFLAGS=['-g1']) + if (env["debug_symbols"] == "full"): + env.Prepend(CCFLAGS=['-g2']) elif (env["target"] == "debug"): - env.Append(CCFLAGS=['-g', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED']) + env.Append(CCFLAGS=['-g3', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED']) ## Compiler configuration 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..db7cd0b938 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); @@ -1309,7 +1304,7 @@ OS_Windows::MouseMode OS_Windows::get_mouse_mode() const { return mouse_mode; } -void OS_Windows::warp_mouse_pos(const Point2 &p_to) { +void OS_Windows::warp_mouse_position(const Point2 &p_to) { if (mouse_mode == MOUSE_MODE_CAPTURED) { diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 1a01ac950d..8a955aa224 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -189,7 +189,7 @@ public: void set_mouse_mode(MouseMode p_mode); MouseMode get_mouse_mode() const; - virtual void warp_mouse_pos(const Point2 &p_to); + virtual void warp_mouse_position(const Point2 &p_to); virtual Point2 get_mouse_position() const; virtual int get_mouse_button_state() const; virtual void set_window_title(const String &p_title); diff --git a/platform/x11/SCsub b/platform/x11/SCsub index 62717f3221..aabc49149f 100644 --- a/platform/x11/SCsub +++ b/platform/x11/SCsub @@ -1,7 +1,12 @@ #!/usr/bin/env python +import os Import('env') +def make_debug(target, source, env): + os.system('objcopy --only-keep-debug %s %s.debug' % (target[0], target[0])) + os.system('strip --strip-debug --strip-unneeded %s' % (target[0])) + os.system('objcopy --add-gnu-debuglink=%s.debug %s' % (target[0], target[0])) common_x11 = [ "context_gl_x11.cpp", @@ -12,4 +17,6 @@ common_x11 = [ "power_x11.cpp", ] -env.Program('#bin/godot', ['godot_x11.cpp'] + common_x11) +binary = env.Program('#bin/godot', ['godot_x11.cpp'] + common_x11) +if env["debug_symbols"] == "full" or env["debug_symbols"] == "yes": + env.AddPostAction(binary, make_debug) 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/detect.py b/platform/x11/detect.py index d61175da60..efd388e44f 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -44,7 +44,6 @@ def can_build(): return True - def get_opts(): return [ @@ -55,7 +54,7 @@ def get_opts(): ('use_lto', 'Use link time optimization', 'no'), ('pulseaudio', 'Detect & use pulseaudio', 'yes'), ('udev', 'Use udev for gamepad connection callbacks', 'no'), - ('debug_release', 'Add debug symbols to release version', 'no'), + ('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes') ] @@ -77,16 +76,20 @@ def configure(env): # -O3 -ffast-math is identical to -Ofast. We need to split it out so we can selectively disable # -ffast-math in code for which it generates wrong results. env.Prepend(CCFLAGS=['-O3', '-ffast-math']) - if (env["debug_release"] == "yes"): + if (env["debug_symbols"] == "yes"): + env.Prepend(CCFLAGS=['-g1']) + if (env["debug_symbols"] == "full"): env.Prepend(CCFLAGS=['-g2']) elif (env["target"] == "release_debug"): env.Prepend(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED']) - if (env["debug_release"] == "yes"): + if (env["debug_symbols"] == "yes"): + env.Prepend(CCFLAGS=['-g1']) + if (env["debug_symbols"] == "full"): env.Prepend(CCFLAGS=['-g2']) elif (env["target"] == "debug"): - env.Prepend(CCFLAGS=['-g2', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED']) + env.Prepend(CCFLAGS=['-g3', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED']) env.Append(LINKFLAGS=['-rdynamic']) ## Architecture 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..599c0d2278 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); @@ -635,7 +613,7 @@ void OS_X11::set_mouse_mode(MouseMode p_mode) { XFlush(x11_display); } -void OS_X11::warp_mouse_pos(const Point2 &p_to) { +void OS_X11::warp_mouse_position(const Point2 &p_to) { if (mouse_mode == MOUSE_MODE_CAPTURED) { @@ -730,6 +708,16 @@ void OS_X11::set_wm_fullscreen(bool p_enabled) { XSetWMNormalHints(x11_display, x11_window, xsh); XFree(xsh); } + + if (!p_enabled && !get_borderless_window()) { + // put decorations back if the window wasn't suppoesed to be borderless + Hints hints; + Atom property; + hints.flags = 2; + hints.decorations = 1; + property = XInternAtom(x11_display, "_MOTIF_WM_HINTS", True); + XChangeProperty(x11_display, x11_window, property, property, 32, PropModeReplace, (unsigned char *)&hints, 5); + } } int OS_X11::get_screen_count() const { @@ -2189,10 +2177,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 +2185,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..a0338dacf1 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; @@ -208,7 +201,7 @@ public: void set_mouse_mode(MouseMode p_mode); MouseMode get_mouse_mode() const; - virtual void warp_mouse_pos(const Point2 &p_to); + virtual void warp_mouse_position(const Point2 &p_to); virtual Point2 get_mouse_position() const; virtual int get_mouse_button_state() const; virtual void set_window_title(const String &p_title); |