summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorFranco M <francomaro@gmail.com>2023-10-27 00:11:15 +0200
committerGitHub <noreply@github.com>2023-10-27 00:11:15 +0200
commitb5415b687203599fe18e2cefc78700e4c6f2ae7c (patch)
treeddd4c82cab9e367cdcf2bbf4a1d444f85ed0b02e /src/common
parentMerge branch 'yuzu-emu:master' into new-shortcut (diff)
parentMerge pull request #11880 from abouvier/unbundle-stb (diff)
downloadyuzu-b5415b687203599fe18e2cefc78700e4c6f2ae7c.tar
yuzu-b5415b687203599fe18e2cefc78700e4c6f2ae7c.tar.gz
yuzu-b5415b687203599fe18e2cefc78700e4c6f2ae7c.tar.bz2
yuzu-b5415b687203599fe18e2cefc78700e4c6f2ae7c.tar.lz
yuzu-b5415b687203599fe18e2cefc78700e4c6f2ae7c.tar.xz
yuzu-b5415b687203599fe18e2cefc78700e4c6f2ae7c.tar.zst
yuzu-b5415b687203599fe18e2cefc78700e4c6f2ae7c.zip
Diffstat (limited to '')
-rw-r--r--src/common/CMakeLists.txt6
-rw-r--r--src/common/stb.cpp8
-rw-r--r--src/common/stb.h8
-rw-r--r--src/common/thread.cpp24
4 files changed, 23 insertions, 23 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 8a1861051..e216eb3de 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -120,6 +120,8 @@ add_library(common STATIC
socket_types.h
spin_lock.cpp
spin_lock.h
+ stb.cpp
+ stb.h
steady_clock.cpp
steady_clock.h
stream.cpp
@@ -208,6 +210,8 @@ if (MSVC)
/we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
/we4800 # Implicit conversion from 'type' to bool. Possible information loss
)
+else()
+ set_source_files_properties(stb.cpp PROPERTIES COMPILE_OPTIONS "-Wno-implicit-fallthrough;-Wno-missing-declarations;-Wno-missing-field-initializers")
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
@@ -223,7 +227,7 @@ endif()
create_target_directory_groups(common)
-target_link_libraries(common PUBLIC Boost::context Boost::headers fmt::fmt microprofile Threads::Threads)
+target_link_libraries(common PUBLIC Boost::context Boost::headers fmt::fmt microprofile stb::headers Threads::Threads)
target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd LLVM::Demangle)
if (ANDROID)
diff --git a/src/common/stb.cpp b/src/common/stb.cpp
new file mode 100644
index 000000000..d3b16665d
--- /dev/null
+++ b/src/common/stb.cpp
@@ -0,0 +1,8 @@
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#define STB_IMAGE_IMPLEMENTATION
+#define STB_IMAGE_RESIZE_IMPLEMENTATION
+#define STB_IMAGE_WRITE_IMPLEMENTATION
+
+#include "common/stb.h"
diff --git a/src/common/stb.h b/src/common/stb.h
new file mode 100644
index 000000000..e5c197c11
--- /dev/null
+++ b/src/common/stb.h
@@ -0,0 +1,8 @@
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <stb_image.h>
+#include <stb_image_resize.h>
+#include <stb_image_write.h>
diff --git a/src/common/thread.cpp b/src/common/thread.cpp
index 919e33af9..34cc1527b 100644
--- a/src/common/thread.cpp
+++ b/src/common/thread.cpp
@@ -11,6 +11,7 @@
#include <mach/mach.h>
#elif defined(_WIN32)
#include <windows.h>
+#include "common/string_util.h"
#else
#if defined(__Bitrig__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
#include <pthread_np.h>
@@ -82,29 +83,8 @@ void SetCurrentThreadPriority(ThreadPriority new_priority) {
#ifdef _MSC_VER
// Sets the debugger-visible name of the current thread.
-// Uses trick documented in:
-// https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-set-a-thread-name-in-native-code
void SetCurrentThreadName(const char* name) {
- static const DWORD MS_VC_EXCEPTION = 0x406D1388;
-
-#pragma pack(push, 8)
- struct THREADNAME_INFO {
- DWORD dwType; // must be 0x1000
- LPCSTR szName; // pointer to name (in user addr space)
- DWORD dwThreadID; // thread ID (-1=caller thread)
- DWORD dwFlags; // reserved for future use, must be zero
- } info;
-#pragma pack(pop)
-
- info.dwType = 0x1000;
- info.szName = name;
- info.dwThreadID = std::numeric_limits<DWORD>::max();
- info.dwFlags = 0;
-
- __try {
- RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR*)&info);
- } __except (EXCEPTION_CONTINUE_EXECUTION) {
- }
+ SetThreadDescription(GetCurrentThread(), UTF8ToUTF16W(name).data());
}
#else // !MSVC_VER, so must be POSIX threads