You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Merge pull request #107574 from stuartcarnie/apple_embedded_fixes
Apple: Improve Apple embedded export and debugging
This commit is contained in:
@@ -10,7 +10,6 @@ files = [
|
||||
"godot_application.mm",
|
||||
"godot_application_delegate.mm",
|
||||
"crash_handler_macos.mm",
|
||||
"macos_terminal_logger.mm",
|
||||
"display_server_macos_base.mm",
|
||||
"display_server_embedded.mm",
|
||||
"display_server_macos.mm",
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/**************************************************************************/
|
||||
/* macos_terminal_logger.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef MACOS_ENABLED
|
||||
|
||||
#include "core/io/logger.h"
|
||||
|
||||
class MacOSTerminalLogger : public StdLogger {
|
||||
public:
|
||||
virtual void log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, bool p_editor_notify = false, ErrorType p_type = ERR_ERROR, const Vector<Ref<ScriptBacktrace>> &p_script_backtraces = {}) override;
|
||||
};
|
||||
|
||||
#endif // MACOS_ENABLED
|
||||
@@ -1,85 +0,0 @@
|
||||
/**************************************************************************/
|
||||
/* macos_terminal_logger.mm */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#import "macos_terminal_logger.h"
|
||||
|
||||
#ifdef MACOS_ENABLED
|
||||
|
||||
#include <os/log.h>
|
||||
|
||||
void MacOSTerminalLogger::log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, bool p_editor_notify, ErrorType p_type, const Vector<Ref<ScriptBacktrace>> &p_script_backtraces) {
|
||||
if (!should_log(true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const char *err_details;
|
||||
if (p_rationale && p_rationale[0]) {
|
||||
err_details = p_rationale;
|
||||
} else {
|
||||
err_details = p_code;
|
||||
}
|
||||
|
||||
const char *bold_color;
|
||||
const char *normal_color;
|
||||
switch (p_type) {
|
||||
case ERR_WARNING:
|
||||
bold_color = "\E[1;33m";
|
||||
normal_color = "\E[0;93m";
|
||||
break;
|
||||
case ERR_SCRIPT:
|
||||
bold_color = "\E[1;35m";
|
||||
normal_color = "\E[0;95m";
|
||||
break;
|
||||
case ERR_SHADER:
|
||||
bold_color = "\E[1;36m";
|
||||
normal_color = "\E[0;96m";
|
||||
break;
|
||||
case ERR_ERROR:
|
||||
default:
|
||||
bold_color = "\E[1;31m";
|
||||
normal_color = "\E[0;91m";
|
||||
break;
|
||||
}
|
||||
|
||||
os_log_error(OS_LOG_DEFAULT,
|
||||
"%{public}s: %{public}s\nat: %{public}s (%{public}s:%i)",
|
||||
error_type_string(p_type), err_details, p_function, p_file, p_line);
|
||||
logf_error("%s%s:%s %s\n", bold_color, error_type_string(p_type), normal_color, err_details);
|
||||
logf_error("\E[0;90m%sat: %s (%s:%i)\E[0m\n", error_type_indent(p_type), p_function, p_file, p_line);
|
||||
|
||||
for (const Ref<ScriptBacktrace> &backtrace : p_script_backtraces) {
|
||||
if (!backtrace->is_empty()) {
|
||||
os_log_error(OS_LOG_DEFAULT, "%{public}s", backtrace->format().utf8().get_data());
|
||||
logf_error("\E[0;90m%s\E[0m\n", backtrace->format(strlen(error_type_indent(p_type))).utf8().get_data());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // MACOS_ENABLED
|
||||
@@ -37,10 +37,10 @@
|
||||
#import "display_server_macos.h"
|
||||
#import "godot_application.h"
|
||||
#import "godot_application_delegate.h"
|
||||
#import "macos_terminal_logger.h"
|
||||
|
||||
#include "core/crypto/crypto_core.h"
|
||||
#include "core/version_generated.gen.h"
|
||||
#include "drivers/apple/os_log_logger.h"
|
||||
#include "main/main.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
@@ -1023,9 +1023,9 @@ OS_MacOS::OS_MacOS(const char *p_execpath, int p_argc, char **p_argv) {
|
||||
}
|
||||
[[NSUserDefaults standardUserDefaults] setObject:new_bookmarks forKey:@"sec_bookmarks"];
|
||||
}
|
||||
|
||||
Vector<Logger *> loggers;
|
||||
loggers.push_back(memnew(MacOSTerminalLogger));
|
||||
loggers.push_back(memnew(OsLogLogger(NSBundle.mainBundle.bundleIdentifier.UTF8String)));
|
||||
loggers.push_back(memnew(UnixTerminalLogger));
|
||||
_set_logger(memnew(CompositeLogger(loggers)));
|
||||
|
||||
#ifdef COREAUDIO_ENABLED
|
||||
|
||||
Reference in New Issue
Block a user