mirror of
https://github.com/godotengine/godot
synced 2024-09-05 06:08:26 +00:00
Add print_verbose to print to stdout only in verbose mode
Equivalent of the cumbersome: if (OS::get_singleton()->is_stdout_verbose()) print_line(msg);
This commit is contained in:
parent
34e58fd831
commit
de59fe04e7
|
@ -204,8 +204,7 @@ RES ResourceLoader::load(const String &p_path, const String &p_type_hint, bool p
|
||||||
|
|
||||||
if (!p_no_cache && ResourceCache::has(local_path)) {
|
if (!p_no_cache && ResourceCache::has(local_path)) {
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose())
|
print_verbose("Loading resource: " + local_path + " (cached)");
|
||||||
print_line("load resource: " + local_path + " (cached)");
|
|
||||||
if (r_error)
|
if (r_error)
|
||||||
*r_error = OK;
|
*r_error = OK;
|
||||||
return RES(ResourceCache::get(local_path));
|
return RES(ResourceCache::get(local_path));
|
||||||
|
@ -216,9 +215,7 @@ RES ResourceLoader::load(const String &p_path, const String &p_type_hint, bool p
|
||||||
|
|
||||||
ERR_FAIL_COND_V(path == "", RES());
|
ERR_FAIL_COND_V(path == "", RES());
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose())
|
print_verbose("Loading resource: " + path);
|
||||||
print_line("load resource: " + path);
|
|
||||||
|
|
||||||
RES res = _load(path, local_path, p_type_hint, p_no_cache, r_error);
|
RES res = _load(path, local_path, p_type_hint, p_no_cache, r_error);
|
||||||
|
|
||||||
if (res.is_null()) {
|
if (res.is_null()) {
|
||||||
|
@ -286,9 +283,7 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_
|
||||||
|
|
||||||
if (!p_no_cache && ResourceCache::has(local_path)) {
|
if (!p_no_cache && ResourceCache::has(local_path)) {
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose())
|
print_verbose("Loading resource: " + local_path + " (cached)");
|
||||||
print_line("load resource: " + local_path + " (cached)");
|
|
||||||
|
|
||||||
Ref<Resource> res_cached = ResourceCache::get(local_path);
|
Ref<Resource> res_cached = ResourceCache::get(local_path);
|
||||||
Ref<ResourceInteractiveLoaderDefault> ril = Ref<ResourceInteractiveLoaderDefault>(memnew(ResourceInteractiveLoaderDefault));
|
Ref<ResourceInteractiveLoaderDefault> ril = Ref<ResourceInteractiveLoaderDefault>(memnew(ResourceInteractiveLoaderDefault));
|
||||||
|
|
||||||
|
@ -298,14 +293,10 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_
|
||||||
|
|
||||||
bool xl_remapped = false;
|
bool xl_remapped = false;
|
||||||
String path = _path_remap(local_path, &xl_remapped);
|
String path = _path_remap(local_path, &xl_remapped);
|
||||||
|
|
||||||
ERR_FAIL_COND_V(path == "", Ref<ResourceInteractiveLoader>());
|
ERR_FAIL_COND_V(path == "", Ref<ResourceInteractiveLoader>());
|
||||||
|
print_verbose("Loading resource: " + path);
|
||||||
if (OS::get_singleton()->is_stdout_verbose())
|
|
||||||
print_line("load resource: ");
|
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
for (int i = 0; i < loader_count; i++) {
|
for (int i = 0; i < loader_count; i++) {
|
||||||
|
|
||||||
if (!loader[i]->recognize_path(path, p_type_hint))
|
if (!loader[i]->recognize_path(path, p_type_hint))
|
||||||
|
|
|
@ -2080,10 +2080,10 @@ void ObjectDB::cleanup() {
|
||||||
|
|
||||||
String node_name;
|
String node_name;
|
||||||
if (instances[*K]->is_class("Node"))
|
if (instances[*K]->is_class("Node"))
|
||||||
node_name = " - Node Name: " + String(instances[*K]->call("get_name"));
|
node_name = " - Node name: " + String(instances[*K]->call("get_name"));
|
||||||
if (instances[*K]->is_class("Resource"))
|
if (instances[*K]->is_class("Resource"))
|
||||||
node_name = " - Resource Name: " + String(instances[*K]->call("get_name")) + " Path: " + String(instances[*K]->call("get_path"));
|
node_name = " - Resource name: " + String(instances[*K]->call("get_name")) + " Path: " + String(instances[*K]->call("get_path"));
|
||||||
print_line("Leaked Instance: " + String(instances[*K]->get_class()) + ":" + itos(*K) + node_name);
|
print_line("Leaked instance: " + String(instances[*K]->get_class()) + ":" + itos(*K) + node_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,3 +107,10 @@ void print_error(String p_string) {
|
||||||
|
|
||||||
_global_unlock();
|
_global_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void print_verbose(String p_string) {
|
||||||
|
|
||||||
|
if (OS::get_singleton()->is_stdout_verbose()) {
|
||||||
|
print_line(p_string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -58,5 +58,6 @@ extern bool _print_line_enabled;
|
||||||
extern bool _print_error_enabled;
|
extern bool _print_error_enabled;
|
||||||
extern void print_line(String p_string);
|
extern void print_line(String p_string);
|
||||||
extern void print_error(String p_string);
|
extern void print_error(String p_string);
|
||||||
|
extern void print_verbose(String p_string);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -73,7 +73,6 @@ void StringName::cleanup() {
|
||||||
_Data *d = _table[i];
|
_Data *d = _table[i];
|
||||||
lost_strings++;
|
lost_strings++;
|
||||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
if (OS::get_singleton()->is_stdout_verbose()) {
|
||||||
|
|
||||||
if (d->cname) {
|
if (d->cname) {
|
||||||
print_line("Orphan StringName: " + String(d->cname));
|
print_line("Orphan StringName: " + String(d->cname));
|
||||||
} else {
|
} else {
|
||||||
|
@ -85,8 +84,8 @@ void StringName::cleanup() {
|
||||||
memdelete(d);
|
memdelete(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (OS::get_singleton()->is_stdout_verbose() && lost_strings) {
|
if (lost_strings) {
|
||||||
print_line("StringName: " + itos(lost_strings) + " unclaimed string names at exit.");
|
print_verbose("StringName: " + itos(lost_strings) + " unclaimed string names at exit.");
|
||||||
}
|
}
|
||||||
lock->unlock();
|
lock->unlock();
|
||||||
|
|
||||||
|
|
|
@ -116,9 +116,7 @@ Error AudioDriverALSA::init_device() {
|
||||||
status = snd_pcm_hw_params_set_period_size_near(pcm_handle, hwparams, &period_size, NULL);
|
status = snd_pcm_hw_params_set_period_size_near(pcm_handle, hwparams, &period_size, NULL);
|
||||||
CHECK_FAIL(status < 0);
|
CHECK_FAIL(status < 0);
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
print_verbose("Audio buffer frames: " + itos(period_size) + " calculated latency: " + itos(period_size * 1000 / mix_rate) + "ms");
|
||||||
print_line("audio buffer frames: " + itos(period_size) + " calculated latency: " + itos(period_size * 1000 / mix_rate) + "ms");
|
|
||||||
}
|
|
||||||
|
|
||||||
status = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &periods, NULL);
|
status = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &periods, NULL);
|
||||||
CHECK_FAIL(status < 0);
|
CHECK_FAIL(status < 0);
|
||||||
|
|
|
@ -178,10 +178,8 @@ Error AudioDriverCoreAudio::init() {
|
||||||
input_position = 0;
|
input_position = 0;
|
||||||
input_size = 0;
|
input_size = 0;
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
print_verbose("CoreAudio: detected " + itos(channels) + " channels");
|
||||||
print_line("CoreAudio: detected " + itos(channels) + " channels");
|
print_verbose("CoreAudio: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");
|
||||||
print_line("CoreAudio: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");
|
|
||||||
}
|
|
||||||
|
|
||||||
AURenderCallbackStruct callback;
|
AURenderCallbackStruct callback;
|
||||||
zeromem(&callback, sizeof(AURenderCallbackStruct));
|
zeromem(&callback, sizeof(AURenderCallbackStruct));
|
||||||
|
|
|
@ -138,9 +138,7 @@ RasterizerScene *RasterizerGLES2::get_scene() {
|
||||||
|
|
||||||
void RasterizerGLES2::initialize() {
|
void RasterizerGLES2::initialize() {
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
print_verbose("Using GLES2 video driver");
|
||||||
print_line("Using GLES2 video driver");
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef GLAD_ENABLED
|
#ifdef GLAD_ENABLED
|
||||||
if (!gladLoadGL()) {
|
if (!gladLoadGL()) {
|
||||||
|
|
|
@ -33,7 +33,9 @@
|
||||||
#include "gl_context/context_gl.h"
|
#include "gl_context/context_gl.h"
|
||||||
#include "os/os.h"
|
#include "os/os.h"
|
||||||
#include "project_settings.h"
|
#include "project_settings.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
RasterizerStorage *RasterizerGLES3::get_storage() {
|
RasterizerStorage *RasterizerGLES3::get_storage() {
|
||||||
|
|
||||||
return storage;
|
return storage;
|
||||||
|
@ -136,9 +138,7 @@ typedef void (*DebugMessageCallbackARB)(DEBUGPROCARB callback, const void *userP
|
||||||
|
|
||||||
void RasterizerGLES3::initialize() {
|
void RasterizerGLES3::initialize() {
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
print_verbose("Using GLES3 video driver");
|
||||||
print_line("Using GLES3 video driver");
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef GLAD_ENABLED
|
#ifdef GLAD_ENABLED
|
||||||
if (!gladLoadGL()) {
|
if (!gladLoadGL()) {
|
||||||
|
|
|
@ -183,10 +183,8 @@ Error AudioDriverPulseAudio::init_device() {
|
||||||
buffer_frames = closest_power_of_2(latency * mix_rate / 1000);
|
buffer_frames = closest_power_of_2(latency * mix_rate / 1000);
|
||||||
pa_buffer_size = buffer_frames * pa_map.channels;
|
pa_buffer_size = buffer_frames * pa_map.channels;
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
print_verbose("PulseAudio: detected " + itos(pa_map.channels) + " channels");
|
||||||
print_line("PulseAudio: detected " + itos(pa_map.channels) + " channels");
|
print_verbose("PulseAudio: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");
|
||||||
print_line("PulseAudio: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");
|
|
||||||
}
|
|
||||||
|
|
||||||
pa_sample_spec spec;
|
pa_sample_spec spec;
|
||||||
spec.format = PA_SAMPLE_S16LE;
|
spec.format = PA_SAMPLE_S16LE;
|
||||||
|
@ -614,9 +612,7 @@ Error AudioDriverPulseAudio::capture_init_device() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
print_verbose("PulseAudio: detected " + itos(pa_rec_map.channels) + " input channels");
|
||||||
print_line("PulseAudio: detected " + itos(pa_rec_map.channels) + " input channels");
|
|
||||||
}
|
|
||||||
|
|
||||||
pa_sample_spec spec;
|
pa_sample_spec spec;
|
||||||
|
|
||||||
|
|
|
@ -112,10 +112,7 @@ Error AudioDriverRtAudio::init() {
|
||||||
|
|
||||||
int latency = GLOBAL_DEF("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
|
int latency = GLOBAL_DEF("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
|
||||||
unsigned int buffer_frames = closest_power_of_2(latency * mix_rate / 1000);
|
unsigned int buffer_frames = closest_power_of_2(latency * mix_rate / 1000);
|
||||||
|
print_verbose("Audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");
|
||||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
|
||||||
print_line("audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");
|
|
||||||
}
|
|
||||||
|
|
||||||
short int tries = 2;
|
short int tries = 2;
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,6 @@ Error FileAccessUnix::_open(const String &p_path, int p_mode_flags) {
|
||||||
if (is_backup_save_enabled() && (p_mode_flags & WRITE) && !(p_mode_flags & READ)) {
|
if (is_backup_save_enabled() && (p_mode_flags & WRITE) && !(p_mode_flags & READ)) {
|
||||||
save_path = path;
|
save_path = path;
|
||||||
path = path + ".tmp";
|
path = path + ".tmp";
|
||||||
//print_line("saving instead to "+path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
f = fopen(path.utf8().get_data(), mode_string);
|
f = fopen(path.utf8().get_data(), mode_string);
|
||||||
|
@ -134,9 +133,6 @@ void FileAccessUnix::close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (save_path != "") {
|
if (save_path != "") {
|
||||||
|
|
||||||
//unlink(save_path.utf8().get_data());
|
|
||||||
//print_line("renaming...");
|
|
||||||
int rename_error = rename((save_path + ".tmp").utf8().get_data(), save_path.utf8().get_data());
|
int rename_error = rename((save_path + ".tmp").utf8().get_data(), save_path.utf8().get_data());
|
||||||
|
|
||||||
if (rename_error && close_fail_notify) {
|
if (rename_error && close_fail_notify) {
|
||||||
|
@ -291,8 +287,7 @@ uint64_t FileAccessUnix::_get_modified_time(const String &p_file) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
return flags.st_mtime;
|
return flags.st_mtime;
|
||||||
} else {
|
} else {
|
||||||
print_line("ERROR IN: " + p_file);
|
ERR_EXPLAIN("Failed to get modified time for: " + p_file);
|
||||||
|
|
||||||
ERR_FAIL_V(0);
|
ERR_FAIL_V(0);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -321,10 +321,8 @@ Error AudioDriverWASAPI::init_render_device(bool reinit) {
|
||||||
input_position = 0;
|
input_position = 0;
|
||||||
input_size = 0;
|
input_size = 0;
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
print_verbose("WASAPI: detected " + itos(channels) + " channels");
|
||||||
print_line("WASAPI: detected " + itos(channels) + " channels");
|
print_verbose("WASAPI: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");
|
||||||
print_line("WASAPI: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");
|
|
||||||
}
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -853,10 +853,7 @@ void EditorSettings::create() {
|
||||||
singleton->data_dir = data_dir;
|
singleton->data_dir = data_dir;
|
||||||
singleton->cache_dir = cache_dir;
|
singleton->cache_dir = cache_dir;
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
print_verbose("EditorSettings: Load OK!");
|
||||||
|
|
||||||
print_line("EditorSettings: Load OK!");
|
|
||||||
}
|
|
||||||
|
|
||||||
singleton->setup_language();
|
singleton->setup_language();
|
||||||
singleton->setup_network();
|
singleton->setup_network();
|
||||||
|
@ -968,8 +965,8 @@ void EditorSettings::save() {
|
||||||
|
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
ERR_PRINTS("Error saving editor settings to " + singleton->config_file_path);
|
ERR_PRINTS("Error saving editor settings to " + singleton->config_file_path);
|
||||||
} else if (OS::get_singleton()->is_stdout_verbose()) {
|
} else {
|
||||||
print_line("EditorSettings Save OK!");
|
print_verbose("EditorSettings: Save OK!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1214,10 +1214,8 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
|
||||||
|
|
||||||
ClassDB::set_current_api(ClassDB::API_NONE); //no more api is registered at this point
|
ClassDB::set_current_api(ClassDB::API_NONE); //no more api is registered at this point
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
print_verbose("CORE API HASH: " + itos(ClassDB::get_api_hash(ClassDB::API_CORE)));
|
||||||
print_line("CORE API HASH: " + itos(ClassDB::get_api_hash(ClassDB::API_CORE)));
|
print_verbose("EDITOR API HASH: " + itos(ClassDB::get_api_hash(ClassDB::API_EDITOR)));
|
||||||
print_line("EDITOR API HASH: " + itos(ClassDB::get_api_hash(ClassDB::API_EDITOR)));
|
|
||||||
}
|
|
||||||
MAIN_PRINT("Main: Done");
|
MAIN_PRINT("Main: Done");
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|
|
@ -2118,11 +2118,7 @@ Error CSharpScript::reload(bool p_keep_state) {
|
||||||
|
|
||||||
if (script_class) {
|
if (script_class) {
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
print_verbose("Found class " + script_class->get_namespace() + "." + script_class->get_name() + " for script " + get_path());
|
||||||
OS::get_singleton()->print(String("Found class " + script_class->get_namespace() + "." +
|
|
||||||
script_class->get_name() + " for script " + get_path() + "\n")
|
|
||||||
.utf8());
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tool = script_class->has_attribute(CACHED_CLASS(ToolAttribute));
|
tool = script_class->has_attribute(CACHED_CLASS(ToolAttribute));
|
||||||
|
|
|
@ -97,8 +97,7 @@ MonoString *godot_icall_BuildInstance_get_MSBuildPath() {
|
||||||
return GDMonoMarshal::mono_string_from_godot(msbuild_tools_path + "MSBuild.exe");
|
return GDMonoMarshal::mono_string_from_godot(msbuild_tools_path + "MSBuild.exe");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose())
|
print_verbose("Cannot find executable for '" PROP_NAME_MSBUILD_VS "'. Trying with '" PROP_NAME_MSBUILD_MONO "'...");
|
||||||
OS::get_singleton()->print("Cannot find executable for '" PROP_NAME_MSBUILD_VS "'. Trying with '" PROP_NAME_MSBUILD_MONO "'...\n");
|
|
||||||
} // FALL THROUGH
|
} // FALL THROUGH
|
||||||
case GodotSharpBuilds::MSBUILD_MONO: {
|
case GodotSharpBuilds::MSBUILD_MONO: {
|
||||||
String msbuild_path = GDMono::get_singleton()->get_mono_reg_info().bin_dir.plus_file("msbuild.bat");
|
String msbuild_path = GDMono::get_singleton()->get_mono_reg_info().bin_dir.plus_file("msbuild.bat");
|
||||||
|
@ -556,8 +555,9 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
|
||||||
exited = true;
|
exited = true;
|
||||||
exit_code = klass->get_field("exitCode")->get_int_value(mono_object);
|
exit_code = klass->get_field("exitCode")->get_int_value(mono_object);
|
||||||
|
|
||||||
if (exit_code != 0 && OS::get_singleton()->is_stdout_verbose())
|
if (exit_code != 0) {
|
||||||
OS::get_singleton()->print(String("MSBuild finished with exit code " + itos(exit_code) + "\n").utf8());
|
print_verbose("MSBuild finished with exit code " + itos(exit_code));
|
||||||
|
}
|
||||||
|
|
||||||
build_tab->on_build_exit(exit_code == 0 ? MonoBuildTab::RESULT_SUCCESS : MonoBuildTab::RESULT_ERROR);
|
build_tab->on_build_exit(exit_code == 0 ? MonoBuildTab::RESULT_SUCCESS : MonoBuildTab::RESULT_ERROR);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -148,7 +148,7 @@ void GDMono::initialize() {
|
||||||
|
|
||||||
ERR_FAIL_NULL(Engine::get_singleton());
|
ERR_FAIL_NULL(Engine::get_singleton());
|
||||||
|
|
||||||
OS::get_singleton()->print("Mono: Initializing module...\n");
|
print_verbose("Mono: Initializing module...");
|
||||||
|
|
||||||
#ifdef DEBUG_METHODS_ENABLED
|
#ifdef DEBUG_METHODS_ENABLED
|
||||||
_initialize_and_check_api_hashes();
|
_initialize_and_check_api_hashes();
|
||||||
|
@ -202,7 +202,7 @@ void GDMono::initialize() {
|
||||||
|
|
||||||
runtime_initialized = true;
|
runtime_initialized = true;
|
||||||
|
|
||||||
OS::get_singleton()->print("Mono: Runtime initialized\n");
|
print_verbose("Mono: Runtime initialized");
|
||||||
|
|
||||||
// mscorlib assembly MUST be present at initialization
|
// mscorlib assembly MUST be present at initialization
|
||||||
ERR_EXPLAIN("Mono: Failed to load mscorlib assembly");
|
ERR_EXPLAIN("Mono: Failed to load mscorlib assembly");
|
||||||
|
@ -226,7 +226,7 @@ void GDMono::initialize() {
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
bool debugger_attached = _wait_for_debugger_msecs(500);
|
bool debugger_attached = _wait_for_debugger_msecs(500);
|
||||||
if (!debugger_attached && OS::get_singleton()->is_stdout_verbose())
|
if (!debugger_attached && OS::get_singleton()->is_stdout_verbose())
|
||||||
OS::get_singleton()->printerr("Mono: Debugger wait timeout\n");
|
print_error("Mono: Debugger wait timeout");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_register_internal_calls();
|
_register_internal_calls();
|
||||||
|
@ -256,7 +256,7 @@ void GDMono::initialize() {
|
||||||
metadata_set_api_assembly_invalidated(APIAssembly::API_EDITOR, true);
|
metadata_set_api_assembly_invalidated(APIAssembly::API_EDITOR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
OS::get_singleton()->print("Mono: Proceeding to unload scripts domain because of invalid API assemblies\n");
|
print_line("Mono: Proceeding to unload scripts domain because of invalid API assemblies.");
|
||||||
|
|
||||||
Error err = _unload_scripts_domain();
|
Error err = _unload_scripts_domain();
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
|
@ -269,11 +269,10 @@ void GDMono::initialize() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (OS::get_singleton()->is_stdout_verbose())
|
print_verbose("Mono: Glue disabled, ignoring script assemblies.");
|
||||||
OS::get_singleton()->print("Mono: Glue disabled, ignoring script assemblies\n");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OS::get_singleton()->print("Mono: INITIALIZED\n");
|
print_verbose("Mono: INITIALIZED");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef MONO_GLUE_DISABLED
|
#ifndef MONO_GLUE_DISABLED
|
||||||
|
@ -352,8 +351,7 @@ bool GDMono::load_assembly(const String &p_name, MonoAssemblyName *p_aname, GDMo
|
||||||
|
|
||||||
CRASH_COND(!r_assembly);
|
CRASH_COND(!r_assembly);
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose())
|
print_verbose("Mono: Loading assembly " + p_name + (p_refonly ? " (refonly)" : "") + "...");
|
||||||
OS::get_singleton()->print((String() + "Mono: Loading assembly " + p_name + (p_refonly ? " (refonly)" : "") + "...\n").utf8());
|
|
||||||
|
|
||||||
MonoImageOpenStatus status = MONO_IMAGE_OK;
|
MonoImageOpenStatus status = MONO_IMAGE_OK;
|
||||||
MonoAssembly *assembly = mono_assembly_load_full(p_aname, NULL, &status, p_refonly);
|
MonoAssembly *assembly = mono_assembly_load_full(p_aname, NULL, &status, p_refonly);
|
||||||
|
@ -372,8 +370,7 @@ bool GDMono::load_assembly(const String &p_name, MonoAssemblyName *p_aname, GDMo
|
||||||
|
|
||||||
*r_assembly = *stored_assembly;
|
*r_assembly = *stored_assembly;
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose())
|
print_verbose("Mono: Assembly " + p_name + (p_refonly ? " (refonly)" : "") + " loaded from path: " + (*r_assembly)->get_path());
|
||||||
OS::get_singleton()->print(String("Mono: Assembly " + p_name + (p_refonly ? " (refonly)" : "") + " loaded from path: " + (*r_assembly)->get_path() + "\n").utf8());
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -500,7 +497,7 @@ bool GDMono::_load_project_assembly() {
|
||||||
mono_assembly_set_main(project_assembly->get_assembly());
|
mono_assembly_set_main(project_assembly->get_assembly());
|
||||||
} else {
|
} else {
|
||||||
if (OS::get_singleton()->is_stdout_verbose())
|
if (OS::get_singleton()->is_stdout_verbose())
|
||||||
OS::get_singleton()->printerr("Mono: Failed to load project assembly\n");
|
print_error("Mono: Failed to load project assembly");
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
|
@ -510,13 +507,13 @@ bool GDMono::_load_api_assemblies() {
|
||||||
|
|
||||||
if (!_load_core_api_assembly()) {
|
if (!_load_core_api_assembly()) {
|
||||||
if (OS::get_singleton()->is_stdout_verbose())
|
if (OS::get_singleton()->is_stdout_verbose())
|
||||||
OS::get_singleton()->printerr("Mono: Failed to load Core API assembly\n");
|
print_error("Mono: Failed to load Core API assembly");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
if (!_load_editor_api_assembly()) {
|
if (!_load_editor_api_assembly()) {
|
||||||
if (OS::get_singleton()->is_stdout_verbose())
|
if (OS::get_singleton()->is_stdout_verbose())
|
||||||
OS::get_singleton()->printerr("Mono: Failed to load Editor API assembly\n");
|
print_error("Mono: Failed to load Editor API assembly");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -593,9 +590,7 @@ Error GDMono::_load_scripts_domain() {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(scripts_domain != NULL, ERR_BUG);
|
ERR_FAIL_COND_V(scripts_domain != NULL, ERR_BUG);
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
print_verbose("Mono: Loading scripts domain...");
|
||||||
OS::get_singleton()->print("Mono: Loading scripts domain...\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
scripts_domain = GDMonoUtils::create_domain("GodotEngine.ScriptsDomain");
|
scripts_domain = GDMonoUtils::create_domain("GodotEngine.ScriptsDomain");
|
||||||
|
|
||||||
|
@ -611,9 +606,7 @@ Error GDMono::_unload_scripts_domain() {
|
||||||
|
|
||||||
ERR_FAIL_NULL_V(scripts_domain, ERR_BUG);
|
ERR_FAIL_NULL_V(scripts_domain, ERR_BUG);
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
print_verbose("Mono: Unloading scripts domain...");
|
||||||
OS::get_singleton()->print("Mono: Unloading scripts domain...\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
_GodotSharp::get_singleton()->_dispose_callback();
|
_GodotSharp::get_singleton()->_dispose_callback();
|
||||||
|
|
||||||
|
@ -661,9 +654,7 @@ Error GDMono::_load_tools_domain() {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(tools_domain != NULL, ERR_BUG);
|
ERR_FAIL_COND_V(tools_domain != NULL, ERR_BUG);
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
print_verbose("Mono: Loading tools domain...");
|
||||||
OS::get_singleton()->print("Mono: Loading tools domain...\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
tools_domain = GDMonoUtils::create_domain("GodotEngine.ToolsDomain");
|
tools_domain = GDMonoUtils::create_domain("GodotEngine.ToolsDomain");
|
||||||
|
|
||||||
|
@ -728,8 +719,7 @@ Error GDMono::reload_scripts_domain() {
|
||||||
if (!_load_project_assembly())
|
if (!_load_project_assembly())
|
||||||
return ERR_CANT_OPEN;
|
return ERR_CANT_OPEN;
|
||||||
#else
|
#else
|
||||||
if (OS::get_singleton()->is_stdout_verbose())
|
print_verbose("Mono: Glue disabled, ignoring script assemblies.");
|
||||||
OS::get_singleton()->print("Mono: Glue disabled, ignoring script assemblies\n");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -742,9 +732,7 @@ Error GDMono::finalize_and_unload_domain(MonoDomain *p_domain) {
|
||||||
|
|
||||||
String domain_name = mono_domain_get_friendly_name(p_domain);
|
String domain_name = mono_domain_get_friendly_name(p_domain);
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
print_verbose("Mono: Unloading domain `" + domain_name + "`...");
|
||||||
OS::get_singleton()->print(String("Mono: Unloading domain `" + domain_name + "`...\n").utf8());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mono_domain_get() != root_domain)
|
if (mono_domain_get() != root_domain)
|
||||||
mono_domain_set(root_domain, true);
|
mono_domain_set(root_domain, true);
|
||||||
|
@ -877,7 +865,7 @@ GDMono::~GDMono() {
|
||||||
|
|
||||||
GDMonoUtils::clear_cache();
|
GDMonoUtils::clear_cache();
|
||||||
|
|
||||||
OS::get_singleton()->print("Mono: Runtime cleanup...\n");
|
print_verbose("Mono: Runtime cleanup...");
|
||||||
|
|
||||||
runtime_initialized = false;
|
runtime_initialized = false;
|
||||||
mono_jit_cleanup(root_domain);
|
mono_jit_cleanup(root_domain);
|
||||||
|
|
|
@ -152,8 +152,7 @@ void GDMonoLog::initialize() {
|
||||||
log_level_id = log_level_get_id(log_level);
|
log_level_id = log_level_get_id(log_level);
|
||||||
|
|
||||||
if (log_file) {
|
if (log_file) {
|
||||||
if (OS::get_singleton()->is_stdout_verbose())
|
print_verbose("Mono: Logfile is " + log_file_path);
|
||||||
OS::get_singleton()->print(String("Mono: Logfile is " + log_file_path + "\n").utf8());
|
|
||||||
mono_trace_set_log_handler(gdmono_MonoLogCallback, this);
|
mono_trace_set_log_handler(gdmono_MonoLogCallback, this);
|
||||||
} else {
|
} else {
|
||||||
OS::get_singleton()->printerr("Mono: No log file, using default log handler\n");
|
OS::get_singleton()->printerr("Mono: No log file, using default log handler\n");
|
||||||
|
|
|
@ -82,9 +82,7 @@ Error AudioDriverAndroid::init() {
|
||||||
|
|
||||||
int latency = GLOBAL_DEF_RST("audio/output_latency", 25);
|
int latency = GLOBAL_DEF_RST("audio/output_latency", 25);
|
||||||
unsigned int buffer_size = next_power_of_2(latency * mix_rate / 1000);
|
unsigned int buffer_size = next_power_of_2(latency * mix_rate / 1000);
|
||||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
print_verbose("Audio buffer size: " + itos(buffer_size));
|
||||||
print_line("audio buffer size: " + itos(buffer_size));
|
|
||||||
}
|
|
||||||
|
|
||||||
audioBuffer = env->CallObjectMethod(io, _init_audio, mix_rate, buffer_size);
|
audioBuffer = env->CallObjectMethod(io, _init_audio, mix_rate, buffer_size);
|
||||||
|
|
||||||
|
|
|
@ -540,9 +540,7 @@ void JoypadWindows::load_xinput() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!xinput_dll) {
|
if (!xinput_dll) {
|
||||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
print_verbose("Could not find XInput, using DirectInput only");
|
||||||
print_line("Could not find XInput, using DirectInput only");
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,13 +170,13 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
|
||||||
|
|
||||||
#ifdef TOUCH_ENABLED
|
#ifdef TOUCH_ENABLED
|
||||||
if (!XQueryExtension(x11_display, "XInputExtension", &touch.opcode, &event_base, &error_base)) {
|
if (!XQueryExtension(x11_display, "XInputExtension", &touch.opcode, &event_base, &error_base)) {
|
||||||
fprintf(stderr, "XInput extension not available");
|
print_verbose("XInput extension not available, touch support disabled.");
|
||||||
} else {
|
} else {
|
||||||
// 2.2 is the first release with multitouch
|
// 2.2 is the first release with multitouch
|
||||||
int xi_major = 2;
|
int xi_major = 2;
|
||||||
int xi_minor = 2;
|
int xi_minor = 2;
|
||||||
if (XIQueryVersion(x11_display, &xi_major, &xi_minor) != Success) {
|
if (XIQueryVersion(x11_display, &xi_major, &xi_minor) != Success) {
|
||||||
fprintf(stderr, "XInput 2.2 not available (server supports %d.%d)\n", xi_major, xi_minor);
|
print_verbose(vformat("XInput 2.2 not available (server supports %d.%d), touch support disabled.", xi_major, xi_minor));
|
||||||
touch.opcode = 0;
|
touch.opcode = 0;
|
||||||
} else {
|
} else {
|
||||||
int dev_count;
|
int dev_count;
|
||||||
|
@ -198,14 +198,14 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
|
||||||
}
|
}
|
||||||
if (direct_touch) {
|
if (direct_touch) {
|
||||||
touch.devices.push_back(dev->deviceid);
|
touch.devices.push_back(dev->deviceid);
|
||||||
fprintf(stderr, "Using touch device: %s\n", dev->name);
|
print_verbose("XInput: Using touch device: " + String(dev->name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XIFreeDeviceInfo(info);
|
XIFreeDeviceInfo(info);
|
||||||
|
|
||||||
if (is_stdout_verbose() && !touch.devices.size()) {
|
if (!touch.devices.size()) {
|
||||||
fprintf(stderr, "No touch devices found\n");
|
print_verbose("XInput: No touch devices found.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,6 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// maybe contextgl wants to be in charge of creating the window
|
// maybe contextgl wants to be in charge of creating the window
|
||||||
//print_line("def videomode "+itos(current_videomode.width)+","+itos(current_videomode.height));
|
|
||||||
#if defined(OPENGL_ENABLED)
|
#if defined(OPENGL_ENABLED)
|
||||||
|
|
||||||
ContextGL_X11::ContextType opengl_api_type = ContextGL_X11::GLES_3_0_COMPATIBLE;
|
ContextGL_X11::ContextType opengl_api_type = ContextGL_X11::GLES_3_0_COMPATIBLE;
|
||||||
|
@ -427,9 +426,7 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
|
||||||
cursor_theme = XcursorGetTheme(x11_display);
|
cursor_theme = XcursorGetTheme(x11_display);
|
||||||
|
|
||||||
if (!cursor_theme) {
|
if (!cursor_theme) {
|
||||||
if (is_stdout_verbose()) {
|
print_verbose("XcursorGetTheme could not get cursor theme");
|
||||||
print_line("XcursorGetTheme could not get cursor theme");
|
|
||||||
}
|
|
||||||
cursor_theme = "default";
|
cursor_theme = "default";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,7 +439,6 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
|
||||||
current_cursor = CURSOR_ARROW;
|
current_cursor = CURSOR_ARROW;
|
||||||
|
|
||||||
if (cursor_theme) {
|
if (cursor_theme) {
|
||||||
//print_line("cursor theme: "+String(cursor_theme));
|
|
||||||
for (int i = 0; i < CURSOR_MAX; i++) {
|
for (int i = 0; i < CURSOR_MAX; i++) {
|
||||||
|
|
||||||
static const char *cursor_file[] = {
|
static const char *cursor_file[] = {
|
||||||
|
@ -468,10 +464,8 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
|
||||||
img[i] = XcursorLibraryLoadImage(cursor_file[i], cursor_theme, cursor_size);
|
img[i] = XcursorLibraryLoadImage(cursor_file[i], cursor_theme, cursor_size);
|
||||||
if (img[i]) {
|
if (img[i]) {
|
||||||
cursors[i] = XcursorImageLoadCursor(x11_display, img[i]);
|
cursors[i] = XcursorImageLoadCursor(x11_display, img[i]);
|
||||||
//print_line("found cursor: "+String(cursor_file[i])+" id "+itos(cursors[i]));
|
|
||||||
} else {
|
} else {
|
||||||
if (OS::is_stdout_verbose())
|
print_verbose("Failed loading custom cursor: " + String(cursor_file[i]));
|
||||||
print_line("failed cursor: " + String(cursor_file[i]));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1516,7 +1510,6 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) {
|
||||||
// KeyMappingX11 also translates keysym to unicode.
|
// KeyMappingX11 also translates keysym to unicode.
|
||||||
// It does a binary search on a table to translate
|
// It does a binary search on a table to translate
|
||||||
// most properly.
|
// most properly.
|
||||||
//print_line("keysym_unicode: "+rtos(keysym_unicode));
|
|
||||||
unsigned int unicode = keysym_unicode > 0 ? KeyMappingX11::get_unicode_from_keysym(keysym_unicode) : 0;
|
unsigned int unicode = keysym_unicode > 0 ? KeyMappingX11::get_unicode_from_keysym(keysym_unicode) : 0;
|
||||||
|
|
||||||
/* Phase 4, determine if event must be filtered */
|
/* Phase 4, determine if event must be filtered */
|
||||||
|
|
Loading…
Reference in a new issue