diff options
-rw-r--r-- | core/ustring.cpp | 4 | ||||
-rw-r--r-- | editor/editor_network_profiler.cpp | 20 | ||||
-rw-r--r-- | editor/editor_network_profiler.h | 1 | ||||
-rw-r--r-- | modules/mono/editor/GodotTools/GodotTools/GodotSharpExport.cs | 2 | ||||
-rw-r--r-- | modules/mono/editor/editor_internal_calls.cpp | 1 |
5 files changed, 6 insertions, 22 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp index 3f5e198281..fb4bd6d802 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -3285,7 +3285,7 @@ static int _humanize_digits(int p_num) { String String::humanize_size(size_t p_size) { uint64_t _div = 1; - static const char *prefix[] = { " Bytes", " KB", " MB", " GB", " TB", " PB", " EB", "" }; + static const char *prefix[] = { " B", " KiB", " MiB", " GiB", " TiB", " PiB", " EiB", "" }; int prefix_idx = 0; while (p_size > (_div * 1024) && prefix[prefix_idx][0]) { @@ -3296,7 +3296,7 @@ String String::humanize_size(size_t p_size) { int digits = prefix_idx > 0 ? _humanize_digits(p_size / _div) : 0; double divisor = prefix_idx > 0 ? _div : 1; - return String::num(p_size / divisor).pad_decimals(digits) + prefix[prefix_idx]; + return String::num(p_size / divisor).pad_decimals(digits) + RTR(prefix[prefix_idx]); } bool String::is_abs_path() const { diff --git a/editor/editor_network_profiler.cpp b/editor/editor_network_profiler.cpp index 5666448887..b90fe96cee 100644 --- a/editor/editor_network_profiler.cpp +++ b/editor/editor_network_profiler.cpp @@ -92,22 +92,6 @@ void EditorNetworkProfiler::_clear_pressed() { } } -String EditorNetworkProfiler::_format_bandwidth(int p_value) { - String unit = "B"; - float v = p_value; - if (v > 1073741824.0) { - unit = "GiB"; - v /= 1073741824.0; - } else if (v > 1048576.0) { - unit = "MiB"; - v /= 1048576.0; - } else if (v > 1024.0) { - unit = "KiB"; - v /= 1024.0; - } - return vformat("%.1f %s/s", v, unit); -} - void EditorNetworkProfiler::add_node_frame_data(const MultiplayerAPI::ProfilingInfo p_frame) { if (!nodes_data.has(p_frame.node)) { @@ -127,8 +111,8 @@ void EditorNetworkProfiler::add_node_frame_data(const MultiplayerAPI::ProfilingI void EditorNetworkProfiler::set_bandwidth(int p_incoming, int p_outgoing) { - incoming_bandwidth_text->set_text(_format_bandwidth(p_incoming)); - outgoing_bandwidth_text->set_text(_format_bandwidth(p_outgoing)); + incoming_bandwidth_text->set_text(vformat(TTR("%s/s"), String::humanize_size(p_incoming))); + outgoing_bandwidth_text->set_text(vformat(TTR("%s/s"), String::humanize_size(p_outgoing))); } bool EditorNetworkProfiler::is_profiling() { diff --git a/editor/editor_network_profiler.h b/editor/editor_network_profiler.h index 5046741cbc..85fec340fd 100644 --- a/editor/editor_network_profiler.h +++ b/editor/editor_network_profiler.h @@ -56,7 +56,6 @@ private: void _activate_pressed(); void _clear_pressed(); - String _format_bandwidth(int p_value); protected: void _notification(int p_what); diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotSharpExport.cs b/modules/mono/editor/GodotTools/GodotTools/GodotSharpExport.cs index aefc51545e..4f93ef8530 100644 --- a/modules/mono/editor/GodotTools/GodotTools/GodotSharpExport.cs +++ b/modules/mono/editor/GodotTools/GodotTools/GodotSharpExport.cs @@ -16,7 +16,7 @@ namespace GodotTools { private void AddFile(string srcPath, string dstPath, bool remap = false) { - AddFile(dstPath, File.ReadAllBytes(srcPath), remap); + AddFile(dstPath.Replace("\\", "/"), File.ReadAllBytes(srcPath), remap); } public override void _ExportFile(string path, string type, string[] features) diff --git a/modules/mono/editor/editor_internal_calls.cpp b/modules/mono/editor/editor_internal_calls.cpp index cd1ca2a2c7..5a84d9e3b8 100644 --- a/modules/mono/editor/editor_internal_calls.cpp +++ b/modules/mono/editor/editor_internal_calls.cpp @@ -429,6 +429,7 @@ void register_editor_internal_calls() { mono_add_internal_call("GodotTools.Internals.Internal::internal_ScriptEditorEdit", (void *)godot_icall_Internal_ScriptEditorEdit); mono_add_internal_call("GodotTools.Internals.Internal::internal_EditorNodeShowScriptScreen", (void *)godot_icall_Internal_EditorNodeShowScriptScreen); mono_add_internal_call("GodotTools.Internals.Internal::internal_GetScriptsMetadataOrNothing", (void *)godot_icall_Internal_GetScriptsMetadataOrNothing); + mono_add_internal_call("GodotTools.Internals.Internal::internal_MonoWindowsInstallRoot", (void *)godot_icall_Internal_MonoWindowsInstallRoot); mono_add_internal_call("GodotTools.Internals.Internal::internal_EditorRunPlay", (void *)godot_icall_Internal_EditorRunPlay); mono_add_internal_call("GodotTools.Internals.Internal::internal_EditorRunStop", (void *)godot_icall_Internal_EditorRunStop); mono_add_internal_call("GodotTools.Internals.Internal::internal_ScriptEditorDebugger_ReloadScripts", (void *)godot_icall_Internal_ScriptEditorDebugger_ReloadScripts); |