summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2021-06-23 09:59:56 -0400
committerGravatar Lioncash2021-06-23 13:48:21 -0400
commitd0b1f2bd05a2fcadbb4c148be2105e337dd986e8 (patch)
tree17e7abb608ab936ae6696e0507c9d1441256c66a /src
parentexternals: Update dynarmic to allow fmt compilation to succeed (diff)
downloadyuzu-d0b1f2bd05a2fcadbb4c148be2105e337dd986e8.tar.gz
yuzu-d0b1f2bd05a2fcadbb4c148be2105e337dd986e8.tar.xz
yuzu-d0b1f2bd05a2fcadbb4c148be2105e337dd986e8.zip
General: Resolve fmt specifiers to adhere to 8.0.0 API where applicable
Also removes some deprecated API usages.
Diffstat (limited to 'src')
-rw-r--r--src/common/hex_util.h3
-rw-r--r--src/core/crypto/key_manager.cpp2
-rw-r--r--src/core/file_sys/registered_cache.cpp13
-rw-r--r--src/core/frontend/input.h1
-rw-r--r--src/core/hle/service/service.cpp6
-rw-r--r--src/video_core/renderer_opengl/gl_arb_decompiler.cpp2
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp2
-rw-r--r--src/yuzu/about_dialog.cpp3
-rw-r--r--src/yuzu/main.cpp6
9 files changed, 23 insertions, 15 deletions
diff --git a/src/common/hex_util.h b/src/common/hex_util.h
index a8d414fb8..f5f9e4507 100644
--- a/src/common/hex_util.h
+++ b/src/common/hex_util.h
@@ -53,8 +53,9 @@ template <typename ContiguousContainer>
53 std::string out; 53 std::string out;
54 out.reserve(std::size(data) * pad_width); 54 out.reserve(std::size(data) * pad_width);
55 55
56 const auto format_str = fmt::runtime(upper ? "{:02X}" : "{:02x}");
56 for (const u8 c : data) { 57 for (const u8 c : data) {
57 out += fmt::format(upper ? "{:02X}" : "{:02x}", c); 58 out += fmt::format(format_str, c);
58 } 59 }
59 60
60 return out; 61 return out;
diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp
index fb451a423..a98daed89 100644
--- a/src/core/crypto/key_manager.cpp
+++ b/src/core/crypto/key_manager.cpp
@@ -835,7 +835,7 @@ void KeyManager::SetKey(S128KeyType id, Key128 key, u64 field1, u64 field2) {
835 "key_area_key_ocean_{:02X}", 835 "key_area_key_ocean_{:02X}",
836 "key_area_key_system_{:02X}", 836 "key_area_key_system_{:02X}",
837 }; 837 };
838 WriteKeyToFile(category, fmt::format(kak_names.at(field2), field1), key); 838 WriteKeyToFile(category, fmt::format(fmt::runtime(kak_names.at(field2)), field1), key);
839 } else if (id == S128KeyType::Master) { 839 } else if (id == S128KeyType::Master) {
840 WriteKeyToFile(category, fmt::format("master_key_{:02X}", field1), key); 840 WriteKeyToFile(category, fmt::format("master_key_{:02X}", field1), key);
841 } else if (id == S128KeyType::Package1) { 841 } else if (id == S128KeyType::Package1) {
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp
index 066c6789a..7a646b5f1 100644
--- a/src/core/file_sys/registered_cache.cpp
+++ b/src/core/file_sys/registered_cache.cpp
@@ -58,14 +58,17 @@ static bool FollowsNcaIdFormat(std::string_view name) {
58 58
59static std::string GetRelativePathFromNcaID(const std::array<u8, 16>& nca_id, bool second_hex_upper, 59static std::string GetRelativePathFromNcaID(const std::array<u8, 16>& nca_id, bool second_hex_upper,
60 bool within_two_digit, bool cnmt_suffix) { 60 bool within_two_digit, bool cnmt_suffix) {
61 if (!within_two_digit) 61 if (!within_two_digit) {
62 return fmt::format(cnmt_suffix ? "{}.cnmt.nca" : "/{}.nca", 62 const auto format_str = fmt::runtime(cnmt_suffix ? "{}.cnmt.nca" : "/{}.nca");
63 Common::HexToString(nca_id, second_hex_upper)); 63 return fmt::format(format_str, Common::HexToString(nca_id, second_hex_upper));
64 }
64 65
65 Core::Crypto::SHA256Hash hash{}; 66 Core::Crypto::SHA256Hash hash{};
66 mbedtls_sha256_ret(nca_id.data(), nca_id.size(), hash.data(), 0); 67 mbedtls_sha256_ret(nca_id.data(), nca_id.size(), hash.data(), 0);
67 return fmt::format(cnmt_suffix ? "/000000{:02X}/{}.cnmt.nca" : "/000000{:02X}/{}.nca", hash[0], 68
68 Common::HexToString(nca_id, second_hex_upper)); 69 const auto format_str =
70 fmt::runtime(cnmt_suffix ? "/000000{:02X}/{}.cnmt.nca" : "/000000{:02X}/{}.nca");
71 return fmt::format(format_str, hash[0], Common::HexToString(nca_id, second_hex_upper));
69} 72}
70 73
71static std::string GetCNMTName(TitleType type, u64 title_id) { 74static std::string GetCNMTName(TitleType type, u64 title_id) {
diff --git a/src/core/frontend/input.h b/src/core/frontend/input.h
index 7a047803e..f1747c5b2 100644
--- a/src/core/frontend/input.h
+++ b/src/core/frontend/input.h
@@ -4,6 +4,7 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <functional>
7#include <memory> 8#include <memory>
8#include <string> 9#include <string>
9#include <tuple> 10#include <tuple>
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 4e1541630..663b83cd3 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -149,10 +149,10 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(Kernel::HLERequestContext
149 std::string function_name = info == nullptr ? fmt::format("{}", ctx.GetCommand()) : info->name; 149 std::string function_name = info == nullptr ? fmt::format("{}", ctx.GetCommand()) : info->name;
150 150
151 fmt::memory_buffer buf; 151 fmt::memory_buffer buf;
152 fmt::format_to(buf, "function '{}': port='{}' cmd_buf={{[0]=0x{:X}", function_name, 152 fmt::format_to(std::back_inserter(buf), "function '{}': port='{}' cmd_buf={{[0]=0x{:X}",
153 service_name, cmd_buf[0]); 153 function_name, service_name, cmd_buf[0]);
154 for (int i = 1; i <= 8; ++i) { 154 for (int i = 1; i <= 8; ++i) {
155 fmt::format_to(buf, ", [{}]=0x{:X}", i, cmd_buf[i]); 155 fmt::format_to(std::back_inserter(buf), ", [{}]=0x{:X}", i, cmd_buf[i]);
156 } 156 }
157 buf.push_back('}'); 157 buf.push_back('}');
158 158
diff --git a/src/video_core/renderer_opengl/gl_arb_decompiler.cpp b/src/video_core/renderer_opengl/gl_arb_decompiler.cpp
index 3e4d88c30..e8d8d2aa5 100644
--- a/src/video_core/renderer_opengl/gl_arb_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_arb_decompiler.cpp
@@ -454,7 +454,7 @@ private:
454 454
455 template <typename... Args> 455 template <typename... Args>
456 void AddExpression(std::string_view text, Args&&... args) { 456 void AddExpression(std::string_view text, Args&&... args) {
457 shader_source += fmt::format(text, std::forward<Args>(args)...); 457 shader_source += fmt::format(fmt::runtime(text), std::forward<Args>(args)...);
458 } 458 }
459 459
460 template <typename... Args> 460 template <typename... Args>
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index ac78d344c..9c28498e8 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -96,7 +96,7 @@ public:
96 // etc). 96 // etc).
97 template <typename... Args> 97 template <typename... Args>
98 void AddLine(std::string_view text, Args&&... args) { 98 void AddLine(std::string_view text, Args&&... args) {
99 AddExpression(fmt::format(text, std::forward<Args>(args)...)); 99 AddExpression(fmt::format(fmt::runtime(text), std::forward<Args>(args)...));
100 AddNewLine(); 100 AddNewLine();
101 } 101 }
102 102
diff --git a/src/yuzu/about_dialog.cpp b/src/yuzu/about_dialog.cpp
index a2e0e6962..6b0155a78 100644
--- a/src/yuzu/about_dialog.cpp
+++ b/src/yuzu/about_dialog.cpp
@@ -14,7 +14,8 @@ AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDia
14 const auto build_id = std::string(Common::g_build_id); 14 const auto build_id = std::string(Common::g_build_id);
15 15
16 const auto yuzu_build = fmt::format("yuzu Development Build | {}-{}", branch_name, description); 16 const auto yuzu_build = fmt::format("yuzu Development Build | {}-{}", branch_name, description);
17 const auto override_build = fmt::format(std::string(Common::g_title_bar_format_idle), build_id); 17 const auto override_build =
18 fmt::format(fmt::runtime(std::string(Common::g_title_bar_format_idle)), build_id);
18 const auto yuzu_build_version = override_build.empty() ? yuzu_build : override_build; 19 const auto yuzu_build_version = override_build.empty() ? yuzu_build : override_build;
19 20
20 ui->setupUi(this); 21 ui->setupUi(this);
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 75ab5ef44..6f5b2f6d6 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -236,7 +236,8 @@ GMainWindow::GMainWindow()
236 const auto build_id = std::string(Common::g_build_id); 236 const auto build_id = std::string(Common::g_build_id);
237 237
238 const auto yuzu_build = fmt::format("yuzu Development Build | {}-{}", branch_name, description); 238 const auto yuzu_build = fmt::format("yuzu Development Build | {}-{}", branch_name, description);
239 const auto override_build = fmt::format(std::string(Common::g_title_bar_format_idle), build_id); 239 const auto override_build =
240 fmt::format(fmt::runtime(std::string(Common::g_title_bar_format_idle)), build_id);
240 const auto yuzu_build_version = override_build.empty() ? yuzu_build : override_build; 241 const auto yuzu_build_version = override_build.empty() ? yuzu_build : override_build;
241 242
242 LOG_INFO(Frontend, "yuzu Version: {}", yuzu_build_version); 243 LOG_INFO(Frontend, "yuzu Version: {}", yuzu_build_version);
@@ -2858,7 +2859,8 @@ void GMainWindow::UpdateWindowTitle(const std::string& title_name,
2858 const auto build_id = std::string(Common::g_build_id); 2859 const auto build_id = std::string(Common::g_build_id);
2859 2860
2860 const auto yuzu_title = fmt::format("yuzu | {}-{}", branch_name, description); 2861 const auto yuzu_title = fmt::format("yuzu | {}-{}", branch_name, description);
2861 const auto override_title = fmt::format(std::string(Common::g_title_bar_format_idle), build_id); 2862 const auto override_title =
2863 fmt::format(fmt::runtime(std::string(Common::g_title_bar_format_idle)), build_id);
2862 const auto window_title = override_title.empty() ? yuzu_title : override_title; 2864 const auto window_title = override_title.empty() ? yuzu_title : override_title;
2863 2865
2864 if (title_name.empty()) { 2866 if (title_name.empty()) {