diff options
Diffstat (limited to 'platform/windows')
-rw-r--r-- | platform/windows/SCsub | 3 | ||||
-rw-r--r-- | platform/windows/godot.natvis | 171 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 34 | ||||
-rw-r--r-- | platform/windows/os_windows.h | 2 |
4 files changed, 179 insertions, 31 deletions
diff --git a/platform/windows/SCsub b/platform/windows/SCsub index 30df9df809..eaa5ceff88 100644 --- a/platform/windows/SCsub +++ b/platform/windows/SCsub @@ -60,6 +60,9 @@ sources += res_obj prog = env.add_program("#bin/godot", sources, PROGSUFFIX=env["PROGSUFFIX"]) arrange_program_clean(prog) +if env.msvc: + env.Depends(prog, "godot.natvis") + # Build console wrapper app. if env["windows_subsystem"] == "gui": env_wrap = env.Clone() diff --git a/platform/windows/godot.natvis b/platform/windows/godot.natvis index fc34ad3cb3..e3a535580f 100644 --- a/platform/windows/godot.natvis +++ b/platform/windows/godot.natvis @@ -30,16 +30,6 @@ </Expand> </Type> - <Type Name="TypedArray<*>"> - <Expand> - <Item Name="[size]"> _p->array._cowdata._ptr ? (((const unsigned long long *)(_p->array._cowdata._ptr))[-1]) : 0</Item> - <ArrayItems> - <Size>_p->array._cowdata._ptr ? (((const unsigned long long *)(_p->array._cowdata._ptr))[-1]) : 0</Size> - <ValuePointer >(Variant *) _p->array._cowdata._ptr</ValuePointer> - </ArrayItems> - </Expand> - </Type> - <Type Name="Dictionary"> <Expand> <Item Name="[size]">_p && _p->variant_map.head_element ? _p->variant_map.num_elements : 0</Item> @@ -153,7 +143,7 @@ <Type Name="HashMapElement<*,*>" IncludeView="MapHelper"> <DisplayString>{data.value}</DisplayString> <Expand> - <Item Name="[key]" >($T1 *) &data.key</Item> + <Item Name="[key]">($T1 *) &data.key</Item> <Item Name="[value]">($T2 *) &data.value</Item> </Expand> </Type> @@ -285,39 +275,164 @@ </Type> <Type Name="Vector2"> - <DisplayString>{{{x},{y}}}</DisplayString> + <DisplayString>({x,g}, {y,g})</DisplayString> + <Expand> + <Item Name="[x]">x</Item> + <Item Name="[y]">y</Item> + </Expand> + </Type> + <Type Name="Vector2i"> + <DisplayString>({x}, {y})</DisplayString> <Expand> - <Item Name="x">x</Item> - <Item Name="y">y</Item> + <Item Name="[x]">x</Item> + <Item Name="[y]">y</Item> </Expand> </Type> <Type Name="Vector3"> - <DisplayString>{{{x},{y},{z}}}</DisplayString> + <DisplayString>({x,g}, {y,g}, {z,g})</DisplayString> + <Expand> + <Item Name="[x]">x</Item> + <Item Name="[y]">y</Item> + <Item Name="[z]">z</Item> + </Expand> + </Type> + <Type Name="Vector3i"> + <DisplayString>({x}, {y}, {z})</DisplayString> <Expand> - <Item Name="x">x</Item> - <Item Name="y">y</Item> - <Item Name="z">z</Item> + <Item Name="[x]">x</Item> + <Item Name="[y]">y</Item> + <Item Name="[z]">z</Item> + </Expand> + </Type> + + <Type Name="Vector4"> + <DisplayString>({x,g}, {y,g}, {z,g}, {w,g})</DisplayString> + <Expand> + <Item Name="[x]">x</Item> + <Item Name="[y]">y</Item> + <Item Name="[z]">z</Item> + <Item Name="[w]">w</Item> + </Expand> + </Type> + <Type Name="Vector4i"> + <DisplayString>({x}, {y}, {z}, {w})</DisplayString> + <Expand> + <Item Name="[x]">x</Item> + <Item Name="[y]">y</Item> + <Item Name="[z]">z</Item> + <Item Name="[w]">w</Item> </Expand> </Type> <Type Name="Quaternion"> - <DisplayString>Quaternion {{{x},{y},{z},{w}}}</DisplayString> + <DisplayString>({x,g}, {y,g}, {z,g}, {w,g})</DisplayString> <Expand> - <Item Name="x">x</Item> - <Item Name="y">y</Item> - <Item Name="z">z</Item> - <Item Name="w">w</Item> + <Item Name="[x]">x</Item> + <Item Name="[y]">y</Item> + <Item Name="[z]">z</Item> + <Item Name="[w]">w</Item> </Expand> </Type> <Type Name="Color"> - <DisplayString>Color {{{r},{g},{b},{a}}}</DisplayString> + <DisplayString>({r,g}, {g,g}, {b,g}, {a,g})</DisplayString> + <Expand> + <Item Name="[red]">r</Item> + <Item Name="[green]">g</Item> + <Item Name="[blue]">b</Item> + <Item Name="[alpha]">a</Item> + </Expand> + </Type> + + <Type Name="Rect2"> + <DisplayString>[P: {position}, S: {size}]</DisplayString> + <Expand> + <Item Name="[position]">position,nr</Item> + <Item Name="[size]">size,nr</Item> + </Expand> + </Type> + <Type Name="Rect2i"> + <DisplayString>[P: {position}, S: {size}]</DisplayString> + <Expand> + <Item Name="[position]">position,nr</Item> + <Item Name="[size]">size,nr</Item> + </Expand> + </Type> + + <Type Name="AABB"> + <DisplayString>[P: {position}, S: {size}]</DisplayString> + <Expand> + <Item Name="[position]">position,nr</Item> + <Item Name="[size]">size,nr</Item> + </Expand> + </Type> + + <Type Name="Plane"> + <DisplayString>[N: {normal}, D: {d,g}]</DisplayString> + <Expand> + <Item Name="[normal]">normal,nr</Item> + <Item Name="[d]">d</Item> + </Expand> + </Type> + + <Type Name="Basis"> + <DisplayString>[X: {rows[0]}, Y: {rows[1]}, Z: {rows[2]}]</DisplayString> + <Expand> + <Item Name="[x]">rows[0],nr</Item> + <Item Name="[y]">rows[1],nr</Item> + <Item Name="[z]">rows[2],nr</Item> + </Expand> + </Type> + + <Type Name="Transform2D"> + <DisplayString>[X: {columns[0]}, Y: {columns[1]}, O: {columns[2]}]</DisplayString> + <Expand> + <Item Name="[x]">columns[0],nr</Item> + <Item Name="[y]">columns[1],nr</Item> + <Item Name="[origin]">columns[2],nr</Item> + </Expand> + </Type> + + <Type Name="Transform3D"> + <!-- Can't call column functions, so just pretend we can via obscene code duplication. --> + <DisplayString>[X: ({basis.rows[0].x,g}, {basis.rows[1].x,g}, {basis.rows[2].x,g}), Y: ({basis.rows[0].y,g}, {basis.rows[1].y,g}, {basis.rows[2].y,g}), Z: ({basis.rows[0].z,g}, {basis.rows[1].z,g}, {basis.rows[2].z,g}), O: {origin}]</DisplayString> + <Expand> + <Synthetic Name="[x]"> + <DisplayString>({basis.rows[0].x,g}, {basis.rows[1].x,g}, {basis.rows[2].x,g})</DisplayString> + <Expand> + <Item Name="[x]">basis.rows[0].x</Item> + <Item Name="[y]">basis.rows[1].x</Item> + <Item Name="[z]">basis.rows[2].x</Item> + </Expand> + </Synthetic> + <Synthetic Name="[y]"> + <DisplayString>({basis.rows[0].y,g}, {basis.rows[1].y,g}, {basis.rows[2].y,g})</DisplayString> + <Expand> + <Item Name="[x]">basis.rows[0].y</Item> + <Item Name="[y]">basis.rows[1].y</Item> + <Item Name="[z]">basis.rows[2].y</Item> + </Expand> + </Synthetic> + <Synthetic Name="[z]"> + <DisplayString>({basis.rows[0].z,g}, {basis.rows[1].z,g}, {basis.rows[2].z,g})</DisplayString> + <Expand> + <Item Name="[x]">basis.rows[0].z</Item> + <Item Name="[y]">basis.rows[1].z</Item> + <Item Name="[z]">basis.rows[2].z</Item> + </Expand> + </Synthetic> + <Item Name="[origin]">origin,nr</Item> + </Expand> + </Type> + + <Type Name="Projection"> + <DisplayString>[X: {columns[0]}, Y: {columns[1]}, Z: {columns[2]}, W: {columns[3]}]</DisplayString> <Expand> - <Item Name="red">r</Item> - <Item Name="green">g</Item> - <Item Name="blue">b</Item> - <Item Name="alpha">a</Item> + <Item Name="[x]">columns[0],nr</Item> + <Item Name="[y]">columns[1],nr</Item> + <Item Name="[z]">columns[2],nr</Item> + <Item Name="[w]">columns[3],nr</Item> </Expand> </Type> </AutoVisualizer> diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index bff3443214..0d151668ba 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -40,10 +40,10 @@ #include "core/debugger/script_debugger.h" #include "core/io/marshalls.h" #include "core/version_generated.gen.h" -#include "drivers/unix/net_socket_posix.h" #include "drivers/windows/dir_access_windows.h" #include "drivers/windows/file_access_windows.h" #include "drivers/windows/file_access_windows_pipe.h" +#include "drivers/windows/net_socket_winsock.h" #include "main/main.h" #include "servers/audio_server.h" #include "servers/rendering/rendering_server_default.h" @@ -209,7 +209,7 @@ void OS_Windows::initialize() { DirAccess::make_default<DirAccessWindows>(DirAccess::ACCESS_USERDATA); DirAccess::make_default<DirAccessWindows>(DirAccess::ACCESS_FILESYSTEM); - NetSocketPosix::make_default(); + NetSocketWinSock::make_default(); // We need to know how often the clock is updated QueryPerformanceFrequency((LARGE_INTEGER *)&ticks_per_second); @@ -303,7 +303,7 @@ void OS_Windows::finalize_core() { timeEndPeriod(1); memdelete(process_map); - NetSocketPosix::cleanup(); + NetSocketWinSock::cleanup(); #ifdef WINDOWS_DEBUG_OUTPUT_ENABLED remove_error_handler(&error_handlers); @@ -1740,6 +1740,34 @@ String OS_Windows::get_locale() const { return "en"; } +String OS_Windows::get_model_name() const { + HKEY hkey; + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\BIOS", 0, KEY_QUERY_VALUE, &hkey) != ERROR_SUCCESS) { + return OS::get_model_name(); + } + + String sys_name; + String board_name; + WCHAR buffer[256]; + DWORD buffer_len = 256; + DWORD vtype = REG_SZ; + if (RegQueryValueExW(hkey, L"SystemProductName", nullptr, &vtype, (LPBYTE)buffer, &buffer_len) == ERROR_SUCCESS && buffer_len != 0) { + sys_name = String::utf16((const char16_t *)buffer, buffer_len).strip_edges(); + } + buffer_len = 256; + if (RegQueryValueExW(hkey, L"BaseBoardProduct", nullptr, &vtype, (LPBYTE)buffer, &buffer_len) == ERROR_SUCCESS && buffer_len != 0) { + board_name = String::utf16((const char16_t *)buffer, buffer_len).strip_edges(); + } + RegCloseKey(hkey); + if (!sys_name.is_empty() && sys_name.to_lower() != "system product name") { + return sys_name; + } + if (!board_name.is_empty() && board_name.to_lower() != "base board product") { + return board_name; + } + return OS::get_model_name(); +} + String OS_Windows::get_processor_name() const { const String id = "Hardware\\Description\\System\\CentralProcessor\\0"; diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 4f9bc049ee..34af004822 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -210,6 +210,8 @@ public: virtual String get_processor_name() const override; + virtual String get_model_name() const override; + virtual uint64_t get_embedded_pck_offset() const override; virtual String get_config_path() const override; |