[*] fmt -> std::format, initial C++26 migration (#4677)

Replaces all usages of fmt with std::format. Also makes some changes for preliminary c++26 compat.

Some were a bit tricky to migrate, notably all the runtime formatting and fmt::join.

Assisted-by: Local Ornith-1.5 35B (code review)

- [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions).
- [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability.
- [x] I have read and followed the [website policy](https://git.eden-emu.dev/eden-emu/site-policy).
- [x] I affirm that the content of this pull request body was written and submitted entirely by me, in my own words, and not by an AI agent or LLM.
- [ ] I affirm that I did not read any of this, and understand that my pull request will be closed if I check this box.
- [x] I affirm that, by submitting this pull request, I am responsible for all of the changes contained within these commits.

-------------------

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4677
Reviewed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
crueter committed 2026-11-09 19:16:23 +01:00
1 parent 295823040b
commit d3ee883e53
309 files changed
+1883 -1644

No files matched your search

-5
View File
@@ -75,7 +75,6 @@ if (YUZU_STATIC_ROOM)
set(OpenSSL_FORCE_SYSTEM ON)
set(zstd_FORCE_BUNDLED ON)
set(fmt_FORCE_BUNDLED ON)
endif()
# qt stuff
@@ -147,7 +146,6 @@ if (YUZU_STATIC_BUILD)
set(YUZU_USE_BUNDLED_OPENSSL ON)
# these libs do not properly provide static libs/let you do it with cmake
set(fmt_FORCE_BUNDLED ON)
set(SPIRV-Headers_FORCE_BUNDLED ON)
set(zstd_FORCE_BUNDLED ON)
@@ -440,9 +438,6 @@ if (Boost_ADDED)
endif()
endif()
# fmt
AddJsonPackage(fmt)
# lz4
AddJsonPackage(lz4)
-6
View File
@@ -78,12 +78,6 @@
"repo": "crueter-ci/FFmpeg",
"version": "9.0.2-1790726865-946fcce07b"
},
"fmt": {
"hash": "f0da82c545b01692e9fd30fdfb613dbb8dd9716983dcd0ff19ac2a8d36f74beb5540ef38072fdecc1e34191b3682a8542ecbf3a61ef287dbba0a2679d4e023f2",
"min_version": "8",
"repo": "fmtlib/fmt",
"version": "12.1.0"
},
"frozen": {
"hash": "b8dfe741c82bc178dfc9749d4ab5a130cee718d9ee7b71d9b547cf5f7f23027ed0152ad250012a8546399fcc1e12187efc68d89d6731256c4d2df7d04eef8d5c",
"package": "frozen",
+14 -15
View File
@@ -51,7 +51,6 @@ All other dependencies will be downloaded and built by CPM, but will always use
- [Boost](https://www.boost.org/users/download/) 1.87.0+
- [Catch2](https://github.com/catchorg/Catch2) 3.0.1 if `YUZU_TESTS` or `DYNARMIC_TESTS` are on
- [fmt](https://fmt.dev/) 8.0.1+
- [lz4](http://www.lz4.org)
- [OpenSSL](https://www.openssl.org/source/) 3+
- [ZLIB](https://www.zlib.net/) 1.2+
@@ -114,7 +113,7 @@ Now, install all deps:
```sh
sudo emerge -a \
app-arch/lz4 app-arch/zstd app-arch/unzip \
dev-libs/libfmt dev-libs/libusb dev-libs/mcl dev-libs/sirit \
dev-libs/libusb dev-libs/mcl dev-libs/sirit \
dev-libs/boost dev-libs/openssl dev-libs/discord-rpc \
dev-util/spirv-tools dev-util/spirv-headers dev-util/vulkan-headers \
dev-util/vulkan-utility-libraries dev-util/glslang \
@@ -148,7 +147,7 @@ Required USE flags:
<summary>Arch Linux</summary>
```sh
sudo pacman -Syu --needed base-devel boost catch2 cmake enet ffmpeg fmt git glslang libzip lz4 ninja openssl opus qt6-base qt6-multimedia qt6-charts sdl3 zlib zstd zip unzip vulkan-headers vulkan-utility-libraries libusb spirv-tools spirv-headers
sudo pacman -Syu --needed base-devel boost catch2 cmake enet ffmpeg git glslang libzip lz4 ninja openssl opus qt6-base qt6-multimedia qt6-charts sdl3 zlib zstd zip unzip vulkan-headers vulkan-utility-libraries libusb spirv-tools spirv-headers
```
- Building with QT Web Engine requires `qt6-webengine` as well.
@@ -161,7 +160,7 @@ sudo pacman -Syu --needed base-devel boost catch2 cmake enet ffmpeg fmt git glsl
<summary>Ubuntu, Debian, Mint Linux</summary>
```sh
sudo apt-get install autoconf cmake g++ gcc git glslang-tools libglu1-mesa-dev libhidapi-dev libpulse-dev libtool libudev-dev libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0 libxcb-xkb1 libxext-dev libxkbcommon-x11-0 mesa-common-dev nasm ninja-build qt6-base-private-dev catch2 libfmt-dev liblz4-dev libzstd-dev libssl-dev libavfilter-dev libavcodec-dev libswscale-dev pkg-config zlib1g-dev libva-dev libvdpau-dev qt6-tools-dev qt6-charts-dev libvulkan-dev spirv-tools spirv-headers libusb-1.0-0-dev libxbyak-dev libboost-dev libboost-fiber-dev libboost-context-dev libsdl3-dev libopus-dev libasound2t64 vulkan-utility-libraries-dev
sudo apt-get install autoconf cmake g++ gcc git glslang-tools libglu1-mesa-dev libhidapi-dev libpulse-dev libtool libudev-dev libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0 libxcb-xkb1 libxext-dev libxkbcommon-x11-0 mesa-common-dev nasm ninja-build qt6-base-private-dev catch2 liblz4-dev libzstd-dev libssl-dev libavfilter-dev libavcodec-dev libswscale-dev pkg-config zlib1g-dev libva-dev libvdpau-dev qt6-tools-dev qt6-charts-dev libvulkan-dev spirv-tools spirv-headers libusb-1.0-0-dev libxbyak-dev libboost-dev libboost-fiber-dev libboost-context-dev libsdl3-dev libopus-dev libasound2t64 vulkan-utility-libraries-dev
```
- Ubuntu 26.04, Linux Mint 22.3, or Debian 13 or later is required.
@@ -175,7 +174,7 @@ sudo apt-get install autoconf cmake g++ gcc git glslang-tools libglu1-mesa-dev l
Fedora:
```sh
sudo dnf install autoconf cmake fmt-devel gcc{,-c++} glslang hidapi-devel json-devel libtool libusb1-devel libzstd-devel lz4-devel nasm ninja-build openssl-devel pulseaudio-libs-devel qt6-linguist qt6-qtbase{-private,}-devel qt6-qtwebengine-devel qt6-qtmultimedia-devel qt6-charts-devel speexdsp-devel wayland-devel zlib-devel ffmpeg-devel libXext-devel boost jq
sudo dnf install autoconf cmake gcc{,-c++} glslang hidapi-devel json-devel libtool libusb1-devel libzstd-devel lz4-devel nasm ninja-build openssl-devel pulseaudio-libs-devel qt6-linguist qt6-qtbase{-private,}-devel qt6-qtwebengine-devel qt6-qtmultimedia-devel qt6-charts-devel speexdsp-devel wayland-devel zlib-devel ffmpeg-devel libXext-devel boost jq
```
AlmaLinux (use `YUZU_USE_CPM=ON`):
@@ -191,7 +190,7 @@ sudo dnf config-manager --enable crb
sudo dnf install qt6-qtbase-private-devel
```
For systems like OpenEuler or derivates, don't forget to also install: `SDL3-devel pkg-config fmt-dev`.
For systems like OpenEuler or derivates, don't forget to also install: `SDL3-devel pkg-config`.
- [RPM Fusion](https://rpmfusion.org/Configuration) is required for `ffmpeg-devel`
- Fedora 42 or later is required.
@@ -215,7 +214,7 @@ apk add g++ git cmake make mesa-dev qt6-qtbase-dev qt6-qtbase-private-dev libqua
<summary>Void Linux</summary>
```sh
xbps-install -Su git make cmake clang pkg-config patch SPIRV-Tools-devel SPIRV-Headers lz4 liblz4-devel boost-devel ffmpeg6-devel catch2 Vulkan-Utility-Libraries Vulkan-Headers glslang openssl-devel SDL3-devel quazip-qt6-devel qt6-base-devel qt6-charts-devel fmt-devel libenet-devel libusb-devel
xbps-install -Su git make cmake clang pkg-config patch SPIRV-Tools-devel SPIRV-Headers lz4 liblz4-devel boost-devel ffmpeg6-devel catch2 Vulkan-Utility-Libraries Vulkan-Headers glslang openssl-devel SDL3-devel quazip-qt6-devel qt6-base-devel qt6-charts-devel libenet-devel libusb-devel
```
</details>
@@ -234,7 +233,7 @@ If you're going for a pure build (i.e no downloaded deps), use `-DYUZU_USE_CPM=O
Install dependencies from **[Homebrew](https://brew.sh/)**
```sh
brew install autoconf automake boost ffmpeg fmt glslang hidapi libtool libusb lz4 ninja openssl pkg-config qt@6 sdl3 speexdsp zlib zstd cmake Catch2 molten-vk vulkan-loader spirv-tools
brew install autoconf automake boost ffmpeg glslang hidapi libtool libusb lz4 ninja openssl pkg-config qt@6 sdl3 speexdsp zlib zstd cmake Catch2 molten-vk vulkan-loader spirv-tools
```
If you are compiling on Intel Mac, or are using a Rosetta Homebrew installation, you must replace all references of `/opt/homebrew` with `/usr/local`.
@@ -254,7 +253,7 @@ brew install molten-vk
As root run:
```sh
pkg install devel/cmake devel/sdl3 devel/boost-libs devel/catch2 devel/libfmt devel/ninja devel/nasm devel/autoconf devel/pkgconf devel/qt6-base x11-toolkits/qt6-charts devel/simpleini net/enet multimedia/ffnvcodec-headers multimedia/ffmpeg audio/opus archivers/liblz4 lang/gcc16 graphics/glslang graphics/vulkan-utility-libraries graphics/spirv-tools graphics/vulkan-utility-libraries graphics/vulkan-headers graphics/spirv-headers quazip-qt6
pkg install devel/cmake devel/sdl3 devel/boost-libs devel/catch2 devel/ninja devel/nasm devel/autoconf devel/pkgconf devel/qt6-base x11-toolkits/qt6-charts devel/simpleini net/enet multimedia/ffnvcodec-headers multimedia/ffmpeg audio/opus archivers/liblz4 lang/gcc16 graphics/glslang graphics/vulkan-utility-libraries graphics/spirv-tools graphics/vulkan-utility-libraries graphics/vulkan-headers graphics/spirv-headers quazip-qt6
```
FreeBSD 15 or later is required.
@@ -268,7 +267,7 @@ FreeBSD 15 or later is required.
For NetBSD +10.1:
```sh
pkgin install git cmake boost fmtlib SDL3 catch2 libjwt spirv-headers spirv-tools ffmpeg7 libva jq libopus qt6-qtbase qt6-qtcharts qt6-qtmultimedia qt6-qttools lz4 vulkan-headers nasm autoconf enet pkg-config libusb1 libcxx frozen
pkgin install git cmake boost SDL3 catch2 libjwt spirv-headers spirv-tools ffmpeg7 libva jq libopus qt6-qtbase qt6-qtcharts qt6-qtmultimedia qt6-qttools lz4 vulkan-headers nasm autoconf enet pkg-config libusb1 libcxx frozen
```
[Caveats](./Caveats.md#netbsd).
@@ -279,7 +278,7 @@ pkgin install git cmake boost fmtlib SDL3 catch2 libjwt spirv-headers spirv-tool
```sh
pkg_add -u
pkg_add cmake nasm git boost unzip--iconv autoconf-2.72p0 bash ffmpeg glslang gmake qt6 jq fmt enet boost vulkan-utility-libraries vulkan-headers spirv-headers spirv-tools catch2 sdl3 libusb1-1.0.29 quazip-qt6
pkg_add cmake nasm git boost unzip--iconv autoconf-2.72p0 bash ffmpeg glslang gmake qt6 jq enet boost vulkan-utility-libraries vulkan-headers spirv-headers spirv-tools catch2 sdl3 libusb1-1.0.29 quazip-qt6
```
[Caveats](./Caveats.md#openbsd).
@@ -289,7 +288,7 @@ pkg_add cmake nasm git boost unzip--iconv autoconf-2.72p0 bash ffmpeg glslang gm
<summary>DragonFlyBSD</summary>
```sh
pkg install gcc16 git cmake unzip nasm autoconf bash pkgconf ffmpeg glslang gmake jq enet spirv-tools sdl3 vulkan-utility-libraries vulkan-headers catch2 libfmt openssl liblz4 boost-libs qt6-base qt6-charts quazip-qt6 libva-vdpau-driver libva-utils libva-intel-driver
pkg install gcc16 git cmake unzip nasm autoconf bash pkgconf ffmpeg glslang gmake jq enet spirv-tools sdl3 vulkan-utility-libraries vulkan-headers catch2 openssl liblz4 boost-libs qt6-base qt6-charts quazip-qt6 libva-vdpau-driver libva-utils libva-intel-driver
```
[Caveats](./Caveats.md#dragonflybsd).
@@ -301,7 +300,7 @@ pkg install gcc16 git cmake unzip nasm autoconf bash pkgconf ffmpeg glslang gmak
OpenIndiana is currently unsupported due to its GCC version being too old. When GCC 16 gets added to the main repositories:
```sh
sudo pkg install git cmake qt6 boost glslang libzip library/lz4 libusb-1 openssl opus sdl3 zlib compress/zstd unzip pkg-config nasm autoconf mesa library/libdrm header-drm developer/fmt gcc-16
sudo pkg install git cmake qt6 boost glslang libzip library/lz4 libusb-1 openssl opus sdl3 zlib compress/zstd unzip pkg-config nasm autoconf mesa library/libdrm header-drm gcc-16
```
[Caveats](./Caveats.md#openindiana).
@@ -328,7 +327,7 @@ sudo pkgin install git cmake autoconf build-essential libusb-1 nasm gcc16
```sh
pacman -Syu
pacman -S --needed git make autoconf libtool automake-wrapper jq patch pactoys
pacboy -S --needed qt6-base qt6-charts qt6-tools qt6-translations qt6-svg cmake toolchain clang python-pip openssl vulkan-memory-allocator vulkan-devel glslang boost fmt lz4 zlib zstd enet opus libusb openssl SDL3
pacboy -S --needed qt6-base qt6-charts qt6-tools qt6-translations qt6-svg cmake toolchain clang python-pip openssl vulkan-memory-allocator vulkan-devel glslang boost lz4 zlib zstd enet opus libusb openssl SDL3
```
- Notes:
@@ -345,7 +344,7 @@ pacboy -S --needed qt6-base qt6-charts qt6-tools qt6-translations qt6-svg cmake
<summary>HaikuOS</summary>
```sh
pkgman install git cmake patch libfmt_devel lz4_devel opus_devel boost1.90_devel vulkan_devel qt6_base_devel qt6_declarative_devel libsdl3_devel ffmpeg7_devel libx11_devel enet_devel catch2_devel quazip1_qt5_devel qt6_5compat_devel glslang qt6_devel qt6_charts_devel cubeb_devel simpleini quazip_qt6_devel
pkgman install git cmake patch lz4_devel opus_devel boost1.90_devel vulkan_devel qt6_base_devel qt6_declarative_devel libsdl3_devel ffmpeg7_devel libx11_devel enet_devel catch2_devel quazip1_qt5_devel qt6_5compat_devel glslang qt6_devel qt6_charts_devel cubeb_devel simpleini quazip_qt6_devel
```
[Caveats](./Caveats.md#haikuos).
+1 -1
View File
@@ -11,7 +11,7 @@ pkgs.mkShellNoCC {
# essential programs
git cmake clang gnumake patch jq pkg-config
# libraries
openssl boost fmt lz4 zlib zstd
openssl boost lz4 zlib zstd
enet vulkan-headers vulkan-utility-libraries
spirv-tools spirv-headers vulkan-loader unzip
glslang python3 cpp-jwt ffmpeg-headless
+13 -12
View File
@@ -10,6 +10,7 @@
#include <codecvt>
#include <cstdio>
#include <cstring>
#include <format>
#include <locale>
#include <map>
#include <set>
@@ -655,7 +656,7 @@ std::pair<u32, std::string> get_pretty_cpus() {
const auto part = (midr >> 4) & 0xfff;
if (!cpus.empty()) cpus += " + ";
cpus += fmt::format("{}x {}", count, find_cpu_name(vendor, part));
cpus += std::format("{}x {}", count, find_cpu_name(vendor, part));
}
}
@@ -879,7 +880,7 @@ jobjectArray Java_org_yuzu_yuzu_1emu_utils_GpuDriverHelper_getSystemDriverInfo(
auto driver_version = device.GetDriverVersion();
auto version_string =
fmt::format("{}.{}.{}", VK_API_VERSION_MAJOR(driver_version),
std::format("{}.{}.{}", VK_API_VERSION_MAJOR(driver_version),
VK_API_VERSION_MINOR(driver_version), VK_API_VERSION_PATCH(driver_version));
auto driver_name = device.GetDriverName();
#else
@@ -1075,7 +1076,7 @@ jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_getCpuSummary(JNIEnv* env, jobject
u32 threads = pretty_cpus.first;
std::string cpus = pretty_cpus.second;
fmt::format_to(std::back_inserter(result), "CPUs: {}\n{} Threads",
std::format_to(std::back_inserter(result), "CPUs: {}\n{} Threads",
cpus, threads);
FILE* f = std::fopen(CPUINFO_PATH, "r");
@@ -1163,7 +1164,7 @@ jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_getCpuSummary(JNIEnv* env, jobject
}
}
fmt::format_to(std::back_inserter(result), "\nLLVM CPU: {}", fallback_cpu_detection());
std::format_to(std::back_inserter(result), "\nLLVM CPU: {}", fallback_cpu_detection());
return Common::Android::ToJString(env, result);
} catch (...) {
@@ -1247,7 +1248,7 @@ jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_getVulkanDriverVersion(JNIEnv* env
const u32 major = (driver_version >> 24) << 2;
const u32 minor = (driver_version >> 12) & 0xFFF;
const u32 patch = driver_version & 0xFFF;
version_str = fmt::format("{}.{}.{}", major, minor, patch);
version_str = std::format("{}.{}.{}", major, minor, patch);
}
else if (vendor_id == VENDOR_ARM) {
u32 major = VK_API_VERSION_MAJOR(driver_version);
@@ -1260,14 +1261,14 @@ jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_getVulkanDriverVersion(JNIEnv* env
minor = (driver_version >> 12) & 0x3FF;
patch = driver_version & 0xFFF;
}
version_str = fmt::format("{}.{}.{}", major, minor, patch);
version_str = std::format("{}.{}.{}", major, minor, patch);
}
// Standard Vulkan version encoding for other vendors
else {
const u32 major = VK_API_VERSION_MAJOR(driver_version);
const u32 minor = VK_API_VERSION_MINOR(driver_version);
const u32 patch = VK_API_VERSION_PATCH(driver_version);
version_str = fmt::format("{}.{}.{}", major, minor, patch);
version_str = std::format("{}.{}.{}", major, minor, patch);
}
return Common::Android::ToJString(env, version_str);
@@ -1291,8 +1292,8 @@ jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_getVulkanApiVersion(JNIEnv* env, j
// Include variant if non-zero (rare on Android)
const std::string version_str = variant > 0
? fmt::format("{}.{}.{}.{}", variant, major, minor, patch)
: fmt::format("{}.{}.{}", major, minor, patch);
? std::format("{}.{}.{}.{}", variant, major, minor, patch)
: std::format("{}.{}.{}", major, minor, patch);
return Common::Android::ToJString(env, version_str);
} catch (...) {
@@ -1382,7 +1383,7 @@ void Java_org_yuzu_yuzu_1emu_NativeLibrary_run(JNIEnv* env, jobject jobj, jstrin
}
void Java_org_yuzu_yuzu_1emu_NativeLibrary_logDeviceInfo(JNIEnv* env, jclass clazz) {
LOG_INFO(Frontend, "eden Version: {}-{}", Common::g_scm_branch, Common::g_scm_desc);
LOG_INFO(Frontend, "eden Version: {}-{}", std::string_view{Common::g_scm_branch}, std::string_view{Common::g_scm_desc});
LOG_INFO(Frontend, "Host OS: Android API level {}", android_get_device_api_level());
}
@@ -2161,7 +2162,7 @@ JNIEXPORT jstring JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_getUserImagePath
const auto uuid = Common::UUID{uuid_string};
const auto path = Common::FS::GetEdenPath(Common::FS::EdenPath::NANDDir) /
fmt::format("system/save/8000000000000010/su/avators/{}.jpg", uuid.FormattedString());
std::format("system/save/8000000000000010/su/avators/{}.jpg", uuid.FormattedString());
jstring result = Common::Android::ToJString(env, Common::FS::PathToUTF8String(path));
return result ? result : env->NewStringUTF("");
@@ -2177,7 +2178,7 @@ JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_saveUserImage(
const auto image_source = Common::Android::GetJString(env, jimagePath);
const auto dest_path = Common::FS::GetEdenPath(Common::FS::EdenPath::NANDDir) /
fmt::format("system/save/8000000000000010/su/avators/{}.jpg", uuid.FormattedString());
std::format("system/save/8000000000000010/su/avators/{}.jpg", uuid.FormattedString());
const auto dest_dir = dest_path.parent_path();
if (!Common::FS::CreateDirs(dest_dir)) {
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
#include <string>
#include <format>
#include <jni.h>
@@ -72,7 +73,7 @@ void Java_org_yuzu_yuzu_1emu_utils_NativeConfig_initializePerGameConfig(JNIEnv*
jstring jfileName) {
auto program_id = EmulationSession::GetProgramId(env, jprogramId);
auto file_name = Common::Android::GetJString(env, jfileName);
const auto config_file_name = program_id == 0 ? file_name : fmt::format("{:016X}", program_id);
const auto config_file_name = program_id == 0 ? file_name : std::format("{:016X}", program_id);
per_game_config =
std::make_unique<AndroidConfig>(config_file_name, Config::ConfigType::PerGameConfig);
}
@@ -4,6 +4,8 @@
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <format>
#include <common/fs/fs.h>
#include <common/fs/path_util.h>
#include <common/settings.h>
@@ -48,7 +50,7 @@ bool IsProfileNameValid(std::string_view profile_name) {
bool ProfileExistsInFilesystem(std::string_view profile_name) {
return Common::FS::Exists(Common::FS::GetEdenPath(Common::FS::EdenPath::ConfigDir) / "input" /
fmt::format("{}.ini", profile_name));
std::format("{}.ini", profile_name));
}
bool ProfileExistsInMap(const std::string& profile_name) {
@@ -122,7 +122,7 @@ u64 AudioRenderer::GetRenderingStartTick(s32 session_id) const noexcept {
void AudioRenderer::CreateSinkStreams() {
u32 channels{sink.GetDeviceChannels()};
for (u32 i = 0; i < MaxRendererSessions; i++) {
std::string name{fmt::format("ADSP_RenderStream-{}", i)};
std::string name{std::format("ADSP_RenderStream-{}", i)};
streams[i] =
sink.AcquireSinkStream(system, channels, name, ::AudioCore::Sink::StreamType::Render);
streams[i]->SetRingSize(4);
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -53,7 +56,7 @@ u64 CommandListProcessor::Process(u32 session_id) {
current_processing_time = 0;
}
std::string dump{fmt::format("\nSession {}\n", session_id)};
std::string dump{std::format("\nSession {}\n", session_id)};
for (u32 index = 0; index < command_count; index++) {
auto& command{*reinterpret_cast<Renderer::ICommand*>(commands)};
@@ -85,7 +88,7 @@ u64 CommandListProcessor::Process(u32 session_id) {
if (command.enabled) {
command.Process(*this);
} else {
dump += fmt::format("\tDisabled!\n");
dump += std::format("\tDisabled!\n");
}
processed_command_count++;
+1 -1
View File
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
+1 -1
View File
@@ -36,7 +36,7 @@ Result DeviceSession::Initialize(std::string_view name_, SampleFormat sample_for
if (stream) {
Finalize();
}
name = fmt::format("{}-{}", name_, session_id_);
name = std::format("{}-{}", name_, session_id_);
type = type_;
sample_format = sample_format_;
channel_count = channel_count_;
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -11,7 +14,7 @@ namespace AudioCore::Renderer {
void AdpcmDataSourceVersion1Command::Dump(const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("AdpcmDataSourceVersion1Command\n\toutput_index {:02X} source sample "
string += std::format("AdpcmDataSourceVersion1Command\n\toutput_index {:02X} source sample "
"rate {} target sample rate {} src quality {}\n",
output_index, sample_rate, processor.target_sample_rate, src_quality);
}
@@ -53,7 +56,7 @@ bool AdpcmDataSourceVersion1Command::Verify(const AudioRenderer::CommandListProc
void AdpcmDataSourceVersion2Command::Dump(const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("AdpcmDataSourceVersion2Command\n\toutput_index {:02X} source sample "
string += std::format("AdpcmDataSourceVersion2Command\n\toutput_index {:02X} source sample "
"rate {} target sample rate {} src quality {}\n",
output_index, sample_rate, processor.target_sample_rate, src_quality);
}
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -10,7 +13,7 @@ namespace AudioCore::Renderer {
void PcmFloatDataSourceVersion1Command::Dump(const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string +=
fmt::format("PcmFloatDataSourceVersion1Command\n\toutput_index {:02X} channel {} "
std::format("PcmFloatDataSourceVersion1Command\n\toutput_index {:02X} channel {} "
"channel count {} source sample rate {} target sample rate {} src quality {}\n",
output_index, channel_index, channel_count, sample_rate,
processor.target_sample_rate, src_quality);
@@ -56,7 +59,7 @@ bool PcmFloatDataSourceVersion1Command::Verify(
void PcmFloatDataSourceVersion2Command::Dump(const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string +=
fmt::format("PcmFloatDataSourceVersion2Command\n\toutput_index {:02X} channel {} "
std::format("PcmFloatDataSourceVersion2Command\n\toutput_index {:02X} channel {} "
"channel count {} source sample rate {} target sample rate {} src quality {}\n",
output_index, channel_index, channel_count, sample_rate,
processor.target_sample_rate, src_quality);
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -12,7 +15,7 @@ namespace AudioCore::Renderer {
void PcmInt16DataSourceVersion1Command::Dump(const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string +=
fmt::format("PcmInt16DataSourceVersion1Command\n\toutput_index {:02X} channel {} "
std::format("PcmInt16DataSourceVersion1Command\n\toutput_index {:02X} channel {} "
"channel count {} source sample rate {} target sample rate {} src quality {}\n",
output_index, channel_index, channel_count, sample_rate,
processor.target_sample_rate, src_quality);
@@ -58,7 +61,7 @@ bool PcmInt16DataSourceVersion1Command::Verify(
void PcmInt16DataSourceVersion2Command::Dump(const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string +=
fmt::format("PcmInt16DataSourceVersion2Command\n\toutput_index {:02X} channel {} "
std::format("PcmInt16DataSourceVersion2Command\n\toutput_index {:02X} channel {} "
"channel count {} source sample rate {} target sample rate {} src quality {}\n",
output_index, channel_index, channel_count, sample_rate,
processor.target_sample_rate, src_quality);
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
@@ -180,7 +180,7 @@ static u32 ReadAuxBufferDsp(Core::Memory::Memory& memory, CpuAddr return_info_,
void AuxCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("AuxCommand\n\tenabled {} input {:02X} output {:02X}\n", effect_enabled,
string += std::format("AuxCommand\n\tenabled {} input {:02X} output {:02X}\n", effect_enabled,
input, output);
}
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
@@ -116,7 +116,7 @@ static void ApplyBiquadFilterInt(std::span<s32> output, std::span<const s32> inp
void BiquadFilterCommand::Dump(
[[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) {
string += fmt::format(
string += std::format(
"BiquadFilterCommand\n\tinput {:02X} output {:02X} needs_init {} use_float_processing {}\n",
input, output, needs_init, use_float_processing);
}
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
@@ -123,7 +123,7 @@ static u32 WriteAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr send_in
void CaptureCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("CaptureCommand\n\tenabled {} input {:02X} output {:02X}", effect_enabled,
string += std::format("CaptureCommand\n\tenabled {} input {:02X} output {:02X}", effect_enabled,
input, output);
}
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -112,13 +115,13 @@ static void ApplyCompressorEffect(const CompressorInfo::ParameterVersion2& param
void CompressorCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("CompressorCommand\n\tenabled {} \n\tinputs: ", effect_enabled);
string += std::format("CompressorCommand\n\tenabled {} \n\tinputs: ", effect_enabled);
for (s16 i = 0; i < parameter.channel_count; i++) {
string += fmt::format("{:02X}, ", inputs[i]);
string += std::format("{:02X}, ", inputs[i]);
}
string += "\n\toutputs: ";
for (s16 i = 0; i < parameter.channel_count; i++) {
string += fmt::format("{:02X}, ", outputs[i]);
string += std::format("{:02X}, ", outputs[i]);
}
string += "\n";
}
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -196,13 +199,13 @@ static void ApplyDelayEffect(const DelayInfo::ParameterVersion1& params, DelayIn
void DelayCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("DelayCommand\n\tenabled {} \n\tinputs: ", effect_enabled);
string += std::format("DelayCommand\n\tenabled {} \n\tinputs: ", effect_enabled);
for (u32 i = 0; i < MaxChannels; i++) {
string += fmt::format("{:02X}, ", inputs[i]);
string += std::format("{:02X}, ", inputs[i]);
}
string += "\n\toutputs: ";
for (u32 i = 0; i < MaxChannels; i++) {
string += fmt::format("{:02X}, ", outputs[i]);
string += std::format("{:02X}, ", outputs[i]);
}
string += "\n";
}
@@ -1,10 +1,11 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <numbers>
#include <cmath>
#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/effect/i3dl2_reverb.h"
@@ -399,13 +400,13 @@ static void ApplyI3dl2ReverbEffect(const I3dl2ReverbInfo::ParameterVersion1& par
void I3dl2ReverbCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("I3dl2ReverbCommand\n\tenabled {} \n\tinputs: ", effect_enabled);
string += std::format("I3dl2ReverbCommand\n\tenabled {} \n\tinputs: ", effect_enabled);
for (u32 i = 0; i < parameter.channel_count; i++) {
string += fmt::format("{:02X}, ", inputs[i]);
string += std::format("{:02X}, ", inputs[i]);
}
string += "\n\toutputs: ";
for (u32 i = 0; i < parameter.channel_count; i++) {
string += fmt::format("{:02X}, ", outputs[i]);
string += std::format("{:02X}, ", outputs[i]);
}
string += "\n";
}
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
@@ -138,13 +138,13 @@ static void ApplyLightLimiterEffect(const LightLimiterInfo::ParameterVersion2& p
void LightLimiterVersion1Command::Dump(
[[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) {
string += fmt::format("LightLimiterVersion1Command\n\tinputs: ");
string += std::format("LightLimiterVersion1Command\n\tinputs: ");
for (u32 i = 0; i < MaxChannels; i++) {
string += fmt::format("{:02X}, ", inputs[i]);
string += std::format("{:02X}, ", inputs[i]);
}
string += "\n\toutputs: ";
for (u32 i = 0; i < MaxChannels; i++) {
string += fmt::format("{:02X}, ", outputs[i]);
string += std::format("{:02X}, ", outputs[i]);
}
string += "\n";
}
@@ -181,13 +181,13 @@ bool LightLimiterVersion1Command::Verify(const AudioRenderer::CommandListProcess
void LightLimiterVersion2Command::Dump(
[[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) {
string += fmt::format("LightLimiterVersion2Command\n\tinputs: \n");
string += std::format("LightLimiterVersion2Command\n\tinputs: \n");
for (u32 i = 0; i < MaxChannels; i++) {
string += fmt::format("{:02X}, ", inputs[i]);
string += std::format("{:02X}, ", inputs[i]);
}
string += "\n\toutputs: ";
for (u32 i = 0; i < MaxChannels; i++) {
string += fmt::format("{:02X}, ", outputs[i]);
string += std::format("{:02X}, ", outputs[i]);
}
string += "\n";
}
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
@@ -12,7 +12,7 @@ namespace AudioCore::Renderer {
void MultiTapBiquadFilterCommand::Dump(
[[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) {
string += fmt::format(
string += std::format(
"MultiTapBiquadFilterCommand\n\tinput {:02X}\n\toutput {:02X}\n\tneeds_init ({}, {})\n",
input, output, needs_init[0], needs_init[1]);
}
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
@@ -6,6 +6,7 @@
#include <numbers>
#include <ranges>
#include <cmath>
#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/effect/reverb.h"
@@ -434,15 +435,15 @@ static void ApplyReverbEffect(const ReverbInfo::ParameterVersion2& params, Rever
void ReverbCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format(
string += std::format(
"ReverbCommand\n\tenabled {} long_size_pre_delay_supported {}\n\tinputs: ", effect_enabled,
long_size_pre_delay_supported);
for (u32 i = 0; i < MaxChannels; i++) {
string += fmt::format("{:02X}, ", inputs[i]);
string += std::format("{:02X}, ", inputs[i]);
}
string += "\n\toutputs: ";
for (u32 i = 0; i < MaxChannels; i++) {
string += fmt::format("{:02X}, ", outputs[i]);
string += std::format("{:02X}, ", outputs[i]);
}
string += "\n";
}
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -10,7 +13,7 @@ namespace AudioCore::Renderer {
void ClearMixBufferCommand::Dump(
[[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) {
string += fmt::format("ClearMixBufferCommand\n");
string += std::format("ClearMixBufferCommand\n");
}
void ClearMixBufferCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -8,7 +11,7 @@ namespace AudioCore::Renderer {
void CopyMixBufferCommand::Dump(
[[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) {
string += fmt::format("CopyMixBufferCommand\n\tinput {:02X} output {:02X}\n", input_index,
string += std::format("CopyMixBufferCommand\n\tinput {:02X} output {:02X}\n", input_index,
output_index);
}
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
@@ -41,7 +41,7 @@ static s32 ApplyDepopMix(std::span<s32> output, const s32 depop_sample,
void DepopForMixBuffersCommand::Dump(
[[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) {
string += fmt::format("DepopForMixBuffersCommand\n\tinput {:02X} count {} decay {}\n", input,
string += std::format("DepopForMixBuffersCommand\n\tinput {:02X} count {} decay {}\n", input,
count, decay.to_float());
}
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -10,9 +13,9 @@ namespace AudioCore::Renderer {
void DepopPrepareCommand::Dump(
[[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) {
string += fmt::format("DepopPrepareCommand\n\tinputs: ");
string += std::format("DepopPrepareCommand\n\tinputs: ");
for (u32 i = 0; i < buffer_count; i++) {
string += fmt::format("{:02X}, ", inputs[i]);
string += std::format("{:02X}, ", inputs[i]);
}
string += "\n";
}
+7 -4
View File
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -30,10 +33,10 @@ static void ApplyMix(std::span<s32> output, std::span<const s32> input, const f3
void MixCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("MixCommand");
string += fmt::format("\n\tinput {:02X}", input_index);
string += fmt::format("\n\toutput {:02X}", output_index);
string += fmt::format("\n\tvolume {:.8f}", volume);
string += std::format("MixCommand");
string += std::format("\n\tinput {:02X}", input_index);
string += std::format("\n\toutput {:02X}", output_index);
string += std::format("\n\tvolume {:.8f}", volume);
string += "\n";
}
@@ -39,12 +39,12 @@ template s32 ApplyMixRamp<23>(std::span<s32>, std::span<const s32>, f32, f32, u3
void MixRampCommand::Dump(const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
const auto ramp{(volume - prev_volume) / static_cast<f32>(processor.sample_count)};
string += fmt::format("MixRampCommand");
string += fmt::format("\n\tinput {:02X}", input_index);
string += fmt::format("\n\toutput {:02X}", output_index);
string += fmt::format("\n\tvolume {:.8f}", volume);
string += fmt::format("\n\tprev_volume {:.8f}", prev_volume);
string += fmt::format("\n\tramp {:.8f}", ramp);
string += std::format("MixRampCommand");
string += std::format("\n\tinput {:02X}", input_index);
string += std::format("\n\toutput {:02X}", output_index);
string += std::format("\n\tvolume {:.8f}", volume);
string += std::format("\n\tprev_volume {:.8f}", prev_volume);
string += std::format("\n\tramp {:.8f}", ramp);
string += "\n";
}
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -11,13 +14,13 @@ void MixRampGroupedCommand::Dump(const AudioRenderer::CommandListProcessor& proc
std::string& string) {
string += "MixRampGroupedCommand";
for (u32 i = 0; i < buffer_count; i++) {
string += fmt::format("\n\t{}", i);
string += std::format("\n\t{}", i);
const auto ramp{(volumes[i] - prev_volumes[i]) / static_cast<f32>(processor.sample_count)};
string += fmt::format("\n\t\tinput {:02X}", inputs[i]);
string += fmt::format("\n\t\toutput {:02X}", outputs[i]);
string += fmt::format("\n\t\tvolume {:.8f}", volumes[i]);
string += fmt::format("\n\t\tprev_volume {:.8f}", prev_volumes[i]);
string += fmt::format("\n\t\tramp {:.8f}", ramp);
string += std::format("\n\t\tinput {:02X}", inputs[i]);
string += std::format("\n\t\toutput {:02X}", outputs[i]);
string += std::format("\n\t\tvolume {:.8f}", volumes[i]);
string += std::format("\n\t\tprev_volume {:.8f}", prev_volumes[i]);
string += std::format("\n\t\tramp {:.8f}", ramp);
string += "\n";
}
}
@@ -34,10 +34,10 @@ static void ApplyUniformGain(std::span<s32> output, std::span<const s32> input,
void VolumeCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("VolumeCommand");
string += fmt::format("\n\tinput {:02X}", input_index);
string += fmt::format("\n\toutput {:02X}", output_index);
string += fmt::format("\n\tvolume {:.8f}", volume);
string += std::format("VolumeCommand");
string += std::format("\n\tinput {:02X}", input_index);
string += std::format("\n\toutput {:02X}", output_index);
string += std::format("\n\tvolume {:.8f}", volume);
string += "\n";
}
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -41,12 +44,12 @@ static void ApplyLinearEnvelopeGain(std::span<s32> output, std::span<const s32>
void VolumeRampCommand::Dump(const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
const auto ramp{(volume - prev_volume) / static_cast<f32>(processor.sample_count)};
string += fmt::format("VolumeRampCommand");
string += fmt::format("\n\tinput {:02X}", input_index);
string += fmt::format("\n\toutput {:02X}", output_index);
string += fmt::format("\n\tvolume {:.8f}", volume);
string += fmt::format("\n\tprev_volume {:.8f}", prev_volume);
string += fmt::format("\n\tramp {:.8f}", ramp);
string += std::format("VolumeRampCommand");
string += std::format("\n\tinput {:02X}", input_index);
string += std::format("\n\toutput {:02X}", output_index);
string += std::format("\n\tvolume {:.8f}", volume);
string += std::format("\n\tprev_volume {:.8f}", prev_volume);
string += std::format("\n\tramp {:.8f}", ramp);
string += "\n";
}
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -10,7 +13,7 @@ namespace AudioCore::Renderer {
void PerformanceCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("PerformanceCommand\n\tstate {}\n", static_cast<u32>(state));
string += std::format("PerformanceCommand\n\tstate {}\n", static_cast<u32>(state));
}
void PerformanceCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -8,13 +11,13 @@ namespace AudioCore::Renderer {
void DownMix6chTo2chCommand::Dump(
[[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) {
string += fmt::format("DownMix6chTo2chCommand\n\tinputs: ");
string += std::format("DownMix6chTo2chCommand\n\tinputs: ");
for (u32 i = 0; i < MaxChannels; i++) {
string += fmt::format("{:02X}, ", inputs[i]);
string += std::format("{:02X}, ", inputs[i]);
}
string += "\n\toutputs: ";
for (u32 i = 0; i < MaxChannels; i++) {
string += fmt::format("{:02X}, ", outputs[i]);
string += std::format("{:02X}, ", outputs[i]);
}
string += "\n";
}
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
@@ -203,14 +203,14 @@ static void SrcProcessFrame(std::span<s32> output, std::span<const s32> input,
auto UpsampleCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) -> void {
string += fmt::format("UpsampleCommand\n\tsource_sample_count {} source_sample_rate {}",
string += std::format("UpsampleCommand\n\tsource_sample_count {} source_sample_rate {}",
source_sample_count, source_sample_rate);
const auto upsampler{reinterpret_cast<UpsamplerInfo*>(upsampler_info)};
if (upsampler != nullptr) {
string += fmt::format("\n\tUpsampler\n\t\tenabled {} sample count {}\n\tinputs: ",
string += std::format("\n\tUpsampler\n\t\tenabled {} sample count {}\n\tinputs: ",
upsampler->enabled, upsampler->sample_count);
for (u32 i = 0; i < upsampler->input_count; i++) {
string += fmt::format("{:02X}, ", upsampler->inputs[i]);
string += std::format("{:02X}, ", upsampler->inputs[i]);
}
}
string += "\n";
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
@@ -14,11 +14,11 @@ namespace AudioCore::Renderer {
void CircularBufferSinkCommand::Dump(
[[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) {
string += fmt::format(
string += std::format(
"CircularBufferSinkCommand\n\tinput_count {} ring size {:04X} ring pos {:04X}\n\tinputs: ",
input_count, size, pos);
for (u32 i = 0; i < input_count; i++) {
string += fmt::format("{:02X}, ", inputs[i]);
string += std::format("{:02X}, ", inputs[i]);
}
string += "\n";
}
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
@@ -14,10 +14,10 @@ namespace AudioCore::Renderer {
void DeviceSinkCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("DeviceSinkCommand\n\t{} session {} input_count {}\n\tinputs: ",
string += std::format("DeviceSinkCommand\n\t{} session {} input_count {}\n\tinputs: ",
std::string_view(name), session_id, input_count);
for (u32 i = 0; i < input_count; i++) {
string += fmt::format("{:02X}, ", inputs[i]);
string += std::format("{:02X}, ", inputs[i]);
}
string += "\n";
}
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
+1
View File
@@ -9,6 +9,7 @@
#include <memory>
#include <span>
#include <vector>
#include <cmath>
#include "audio_core/audio_core.h"
#include "audio_core/common/common.h"
+1 -1
View File
@@ -245,7 +245,7 @@ if (lz4_ADDED)
target_include_directories(common PRIVATE ${lz4_SOURCE_DIR}/lib)
endif()
target_link_libraries(common PUBLIC fmt::fmt stb::headers Threads::Threads)
target_link_libraries(common PUBLIC stb::headers Threads::Threads)
target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd)
# Please refer to src/common/demangle.cpp
+11 -4
View File
@@ -11,6 +11,8 @@
#include <limits>
#include <type_traits>
#include <climits>
#include <format>
#include "common/swap.h"
/*
@@ -169,7 +171,12 @@ private:
template <std::size_t Position, std::size_t Bits, typename T>
using BitFieldBE = BitField<Position, Bits, T, BETag>;
template <std::size_t Position, std::size_t Bits, typename T, typename EndianTag = LETag>
inline auto format_as(BitField<Position, Bits, T, EndianTag> bitfield) {
return bitfield.Value();
}
template <std::size_t Position, std::size_t Bits, typename T, typename EndianTag>
struct std::formatter<BitField<Position, Bits, T, EndianTag>> : std::formatter<T> {
using std::formatter<T>::parse;
template <typename FormatContext>
auto format(const BitField<Position, Bits, T, EndianTag>& bitfield, FormatContext& ctx) const
-> decltype(ctx.out()) {
return std::formatter<T>::format(bitfield.Value(), ctx);
}
};
-11
View File
@@ -12,17 +12,6 @@
#include <cstdlib> // for exit
#include "common/common_types.h"
#ifndef __cpp_lib_to_underlying
namespace std {
// https://en.cppreference.com/cpp/utility/to_underlying
template<class T>
requires std::is_enum_v<T>
constexpr std::underlying_type_t<T> to_underlying(T e) noexcept {
return std::underlying_type_t<T>(e);
}
}
#endif
/// Textually concatenates two tokens. The double-expansion is required by the C preprocessor.
#define CONCAT2(x, y) DO_CONCAT2(x, y)
#define DO_CONCAT2(x, y) x##y
+11 -11
View File
@@ -12,10 +12,10 @@
#include <utility>
#include <fmt/ranges.h>
#include "common/dynamic_library.h"
#include <format>
#ifdef _WIN32
#include <windows.h>
#else
@@ -58,27 +58,27 @@ std::string DynamicLibrary::GetUnprefixedFilename(const char* filename) {
std::string DynamicLibrary::GetVersionedFilename(const char* libname, int major, int minor) {
#if defined(_WIN32)
if (major >= 0 && minor >= 0)
return fmt::format("{}-{}-{}.dll", libname, major, minor);
return std::format("{}-{}-{}.dll", libname, major, minor);
else if (major >= 0)
return fmt::format("{}-{}.dll", libname, major);
return std::format("{}-{}.dll", libname, major);
else
return fmt::format("{}.dll", libname);
return std::format("{}.dll", libname);
#elif defined(__APPLE__)
const char* prefix = std::strncmp(libname, "lib", 3) ? "lib" : "";
if (major >= 0 && minor >= 0)
return fmt::format("{}{}.{}.{}.dylib", prefix, libname, major, minor);
return std::format("{}{}.{}.{}.dylib", prefix, libname, major, minor);
else if (major >= 0)
return fmt::format("{}{}.{}.dylib", prefix, libname, major);
return std::format("{}{}.{}.dylib", prefix, libname, major);
else
return fmt::format("{}{}.dylib", prefix, libname);
return std::format("{}{}.dylib", prefix, libname);
#else
const char* prefix = std::strncmp(libname, "lib", 3) ? "lib" : "";
if (major >= 0 && minor >= 0)
return fmt::format("{}{}.so.{}.{}", prefix, libname, major, minor);
return std::format("{}{}.so.{}.{}", prefix, libname, major, minor);
else if (major >= 0)
return fmt::format("{}{}.so.{}", prefix, libname, major);
return std::format("{}{}.so.{}", prefix, libname, major);
else
return fmt::format("{}{}.so", prefix, libname);
return std::format("{}{}.so", prefix, libname);
#endif
}
+1 -1
View File
@@ -559,7 +559,7 @@ bool IOFile::Seek(s64 offset, SeekOrigin origin) const {
if (!seek_result) {
const auto ec = std::error_code{errno, std::generic_category()};
LOG_ERROR(Common_Filesystem, "Failed to seek the file at path={}, offset={}, origin={}, ec_message={}",
PathToUTF8String(file_path), offset, origin, ec.message());
PathToUTF8String(file_path), offset, s64(origin), ec.message());
}
return seek_result;
}
+2 -2
View File
@@ -154,14 +154,14 @@ std::shared_ptr<IOFile> FileOpen(const fs::path& path, FileAccessMode mode, File
LOG_ERROR(Common_Filesystem,
"Failed to open the file at path={} with mode={}, type={}, flag={}",
PathToUTF8String(path), mode, type, flag);
PathToUTF8String(path), s64(mode), s64(type), s64(flag));
return nullptr;
}
LOG_DEBUG(Common_Filesystem,
"Successfully opened the file at path={} with mode={}, type={}, flag={}",
PathToUTF8String(path), mode, type, flag);
PathToUTF8String(path), s64(mode), s64(type), s64(flag));
return io_file;
}
+3 -3
View File
@@ -1,11 +1,11 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#include "ryujinx_compat.h"
#include "common/fs/path_util.h"
#include <cstddef>
#include <cstring>
#include <fmt/ranges.h>
#include <format>
#include <fstream>
namespace Common::FS {
@@ -33,7 +33,7 @@ fs::path GetRyuSavePath(const u64 &save_id)
}
std::filesystem::path GetRyuSavePath(const std::filesystem::path& path, const u64& save_id) {
std::string hex = fmt::format("{:016x}", save_id);
std::string hex = std::format("{:016x}", save_id);
// TODO: what's the difference between 0 and 1?
return path / "bis" / "user" / "save" / hex / "0";
+3 -3
View File
@@ -1,10 +1,10 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#include "symlink.h"
#ifdef _WIN32
#include <fmt/format.h>
#include <format>
#include <windows.h>
#endif
@@ -38,7 +38,7 @@ bool CreateSymlink(fs::path from, fs::path to)
fs::create_directory_symlink(from, to, ec);
#ifdef _WIN32
if (ec) {
const std::string command = fmt::format("mklink /J \"{}\" \"{}\"",
const std::string command = std::format("mklink /J \"{}\" \"{}\"",
to.string(),
from.string());
return system(command.c_str()) == 0;
+9 -3
View File
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2013 Dolphin Emulator Project
// SPDX-FileCopyrightText: 2014 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -6,9 +9,10 @@
#include <array>
#include <cstddef>
#include <iterator>
#include <string>
#include <vector>
#include <fmt/ranges.h>
#include <format>
#include "common/assert.h"
#include "common/common_types.h"
@@ -55,9 +59,11 @@ template <typename ContiguousContainer>
std::string out;
out.reserve(std::size(data) * pad_width);
const auto format_str = fmt::runtime(upper ? "{:02X}" : "{:02x}");
for (const u8 c : data) {
out += fmt::format(format_str, c);
if (upper)
std::format_to(std::back_inserter(out), "{:02X}", c);
else
std::format_to(std::back_inserter(out), "{:02x}", c);
}
return out;
+32 -31
View File
@@ -7,7 +7,9 @@
#include <atomic>
#include <chrono>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <format>
#include <regex>
#include <thread>
@@ -22,7 +24,7 @@
#endif
#include <boost/algorithm/string/replace.hpp>
#include <fmt/ranges.h>
#include <format>
#include "common/fs/file.h"
#include "common/fs/fs.h"
@@ -86,11 +88,15 @@ const char* GetLevelName(Level log_level) {
// Some IDEs prefer <file>:<line> instead, so let's just do that :)
std::string FormatLogMessage(const Entry& entry) noexcept {
if (!entry.filename) return "";
auto const time_seconds = uint32_t(entry.timestamp.count() / 1000000);
auto const time_fractional = uint32_t(entry.timestamp.count() % 1000000);
auto const class_name = GetLogClassName(entry.log_class);
auto const level_name = GetLevelName(entry.log_level);
return fmt::format("[{:4d}.{:06d}] {} <{}> {}:{}:{}: {}\n", time_seconds, time_fractional, class_name, level_name, entry.filename, entry.line_num, entry.function, entry.message);
return std::format("[{:4d}.{:06d}] {} <{}> {}:{}:{}: {}\n", time_seconds, time_fractional,
class_name, level_name, entry.filename, entry.line_num,
entry.function ? entry.function : "",
entry.message ? entry.message : "");
}
template <typename It>
@@ -155,10 +161,10 @@ struct Backend {
virtual void Flush() noexcept = 0;
};
/// @brief Formatting specifier (to use with printf) of the equivalent fmt::format() expression
/// @brief Formatting specifier (to use with printf) of the equivalent std::format() expression
#define CCB_PRINTF_FMT "[%4d.%06d] %s <%s> %s:%u:%s: %s"
/// @brief Instead of using fmt::format() just use the system's formatting capabilities directly
/// @brief Instead of using std::format() just use the system's formatting capabilities directly
struct DirectFormatArgs {
const char *class_name;
const char *level_name;
@@ -199,7 +205,9 @@ struct ColorConsoleBackend final : public Backend {
}());
SetConsoleTextAttribute(console_handle, color);
auto const df = GetDirectFormatArgs(entry);
std::fprintf(stdout, CCB_PRINTF_FMT "\n", df.time_seconds, df.time_fractional, df.class_name, df.level_name, entry.filename, entry.line_num, entry.function, entry.message);
std::fprintf(stdout, CCB_PRINTF_FMT "\n", df.time_seconds, df.time_fractional, df.class_name,
df.level_name, entry.filename ? entry.filename : "", entry.line_num,
entry.function ? entry.function : "", entry.message ? entry.message : "");
}
}
void Flush() noexcept override {}
@@ -224,10 +232,14 @@ struct ColorConsoleBackend final : public Backend {
auto const df = GetDirectFormatArgs(entry);
// more restrictive, because take for example this simple prelude:
// [ 50.872256] Config <Info> common/settings.cpp:142:LogSettings:
char buffer[256];
auto result = fmt::format_to_n(buffer, sizeof(buffer) - 1, "\x1b{}[{:4d}.{:06d}] {} <{}> {}:{}:{}: ", color_str, df.time_seconds, df.time_fractional, df.class_name, df.level_name, entry.filename, entry.line_num, entry.function, entry.message);
std::fwrite(buffer, 1, (std::min)(sizeof(buffer) - 1, result.size), stdout);
std::fwrite(entry.message, 1, entry.message_len, stdout);
auto result = std::format("\x1b{}[{:4d}.{:06d}] {} <{}> {}:{}:{}: ", color_str, df.time_seconds,
df.time_fractional, df.class_name, df.level_name,
entry.filename ? entry.filename : "", entry.line_num,
entry.function ? entry.function : "");
std::fwrite(result.data(), 1, result.size(), stdout);
if (entry.message && entry.message_len)
std::fwrite(entry.message, 1, entry.message_len, stdout);
std::fwrite("\x1b[0m\n", 1, sizeof("\x1b[0m\n"), stdout);
}
}
@@ -427,14 +439,15 @@ void SetColorConsoleBackendEnabled(bool enabled) {
logging_instance->color_console_backend.enabled = enabled;
}
void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename, unsigned int line_num, const char* function, fmt::string_view format, const fmt::format_args& args) {
void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename, unsigned int line_num, const char* function, std::string_view format, const std::format_args& args) {
if (logging_instance && logging_instance->filter.CheckMessage(log_class, log_level)) {
auto const flush = ::Settings::values.log_flush_line.GetValue();
char buffer[BUFSIZ];
auto result = fmt::vformat_to_n(buffer, sizeof(buffer) - 1, format, args);
std::string msg = std::vformat(format, args);
Entry e{
.message = nullptr,
.message_len = 0,
.message = msg.c_str(),
.message_len = msg.size(),
.timestamp = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now() - logging_instance->time_origin),
.log_class = log_class,
.log_level = log_level,
@@ -442,23 +455,11 @@ void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename, u
.function = function,
.line_num = line_num,
};
if (result.size <= sizeof(buffer) - 1) {
buffer[(std::min)(result.size, sizeof(buffer) - 1)] = '\0';
e.message = buffer;
e.message_len = (std::min)(result.size, sizeof(buffer) - 1);
logging_instance->ForEachBackend([=](Backend& backend) {
backend.Write(e);
if (flush) backend.Flush();
});
} else {
std::string s = fmt::vformat(format, args);
e.message = s.c_str();
e.message_len = s.size();
logging_instance->ForEachBackend([=](Backend& backend) {
backend.Write(e);
if (flush) backend.Flush();
});
}
logging_instance->ForEachBackend([&](Backend& backend) {
backend.Write(e);
if (flush) backend.Flush();
});
}
}
} // namespace Common::Log
+8 -10
View File
@@ -9,31 +9,29 @@
#include <chrono>
#include <algorithm>
#include <type_traits>
#include <fmt/ranges.h>
#include <format>
#include "common/swap.h"
// adapted from https://github.com/fmtlib/fmt/issues/2704
// a generic formatter for enum classes
#if FMT_VERSION >= 80100
template <typename T>
struct fmt::formatter<T, std::enable_if_t<std::is_enum_v<T>, char>>
struct std::formatter<T, std::enable_if_t<std::is_enum_v<T>, char>>
: formatter<std::underlying_type_t<T>> {
template <typename FormatContext>
auto format(const T& value, FormatContext& ctx) const -> decltype(ctx.out()) {
return fmt::formatter<std::underlying_type_t<T>>::format(
return std::formatter<std::underlying_type_t<T>>::format(
static_cast<std::underlying_type_t<T>>(value), ctx);
}
};
#endif
template <typename T, typename U>
struct fmt::formatter<SwapStructT<T, U>> {
struct std::formatter<SwapStructT<T, U>> {
constexpr auto parse(format_parse_context& ctx) {
return ctx.begin();
}
template <typename FormatContext>
auto format(const SwapStructT<T, U>& reg, FormatContext& ctx) const {
return fmt::format_to(ctx.out(), "{}", T(reg));
return std::format_to(ctx.out(), "{}", T(reg));
}
};
@@ -85,11 +83,11 @@ enum class Class : u8 {
};
/// Logs a message to the global logger, using fmt
void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename, unsigned int line_num, const char* function, fmt::string_view format, const fmt::format_args& args);
void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename, unsigned int line_num, const char* function, std::string_view format, const std::format_args& args);
template <typename... Args>
void FmtLogMessage(Class log_class, Level log_level, const char* filename, unsigned int line_num, const char* function, fmt::format_string<Args...> format, const Args&... args) {
FmtLogMessageImpl(log_class, log_level, filename, line_num, function, format.get(), fmt::make_format_args(args...));
void FmtLogMessage(Class log_class, Level log_level, const char* filename, unsigned int line_num, const char* function, std::format_string<Args...> format, const Args&... args) {
FmtLogMessageImpl(log_class, log_level, filename, line_num, function, format.get(), std::make_format_args(args...));
}
/// Implements a log message filter which allows different log classes to have different minimum
+2 -2
View File
@@ -117,7 +117,7 @@ std::optional<std::string> MakeRequest(const std::string& url) {
LOG_ERROR(Frontend, "Failed to download {}: {}", url, res.error());
return std::nullopt;
} else if (res->status_code < hydro::Status::Ok || res->status_code >= hydro::Status::MultipleChoices) {
LOG_ERROR(Frontend, "Received status code {} for {}", std::to_underlying(res->status_code), url);
LOG_ERROR(Frontend, "Received status code {} for {}", res->status_code, url);
return std::nullopt;
}
@@ -195,7 +195,7 @@ bool HeadRequest(const std::string& url) {
LOG_ERROR(Frontend, "Failed to download {}: {}", url, res.error());
return false;
} else if (res->status_code < hydro::Status::Ok || res->status_code >= hydro::Status::MultipleChoices) {
LOG_ERROR(Frontend, "Received status code {} for {}", std::to_underlying(res->status_code), url);
LOG_ERROR(Frontend, "Received status code {} for {}", res->status_code, url);
return false;
}
+1 -1
View File
@@ -23,7 +23,7 @@ namespace Common {
/// @tparam T Element type
/// @tparam capacity Number of slots in ring buffer
template <typename T, std::size_t capacity>
requires std::is_trivial_v<T>
requires std::is_trivially_default_constructible_v<T> && std::is_trivially_copyable_v<T>
class RingBuffer {
/// A "slot" is made of a single `T`.
static constexpr std::size_t slot_size = sizeof(T);
+4 -4
View File
@@ -17,7 +17,7 @@
#include <string_view>
#include <type_traits>
#include <deque>
#include <fmt/core.h>
#include <format>
#include "common/settings_enums.h"
#include "common/assert.h"
@@ -120,15 +120,15 @@ void LogSettings() {
// Hide the token secret, for security reasons.
if (setting->Id() != values.eden_token.Id()) {
auto const is_default = setting->ToString() == setting->DefaultToString();
auto const name = fmt::format(
auto const name = std::format(
"{:c}{:c} {}.{}",
is_default ? '-' : 'M',
setting->UsingGlobal() ? '-' : 'C', TranslateCategory(category),
setting->GetLabel());
if (is_default)
settings_list.push_back(fmt::format("{}: {}", name, setting->Canonicalize()));
settings_list.push_back(std::format("{}: {}", name, setting->Canonicalize()));
else
settings_list.push_front(fmt::format("{}: {}", name, setting->Canonicalize()));
settings_list.push_front(std::format("{}: {}", name, setting->Canonicalize()));
}
}
}
+2 -2
View File
@@ -12,7 +12,7 @@
#include <stdexcept>
#include <string>
#include <type_traits>
#include <fmt/ranges.h>
#include <format>
#include "common/common_types.h"
#include "common/settings_common.h"
#include "common/settings_enums.h"
@@ -134,7 +134,7 @@ protected:
} else if constexpr (std::is_same_v<Type, bool>) {
return value_ ? "true" : "false";
} else if constexpr (std::is_floating_point_v<Type>) {
return fmt::format("{:f}", value_);
return std::format("{:f}", value_);
} else if constexpr (std::is_enum_v<Type>) {
return std::to_string(std::underlying_type_t<Type>(value_));
} else {
+4 -5
View File
@@ -10,8 +10,7 @@
#include <map>
#include <sstream>
#include <stdexcept>
#include <fmt/chrono.h>
#include <fmt/core.h>
#include <format>
#include "common/logging.h"
#include "common/time_zone.h"
@@ -96,12 +95,12 @@ std::string FindSystemTimeZone() {
// -6 hours instead of +6 hours, so these signs are purposefully reversed to fix it.
std::string postfix{""};
if (hours > 0) {
postfix = fmt::format("-{:d}", std::abs(hours));
postfix = std::format("-{:d}", std::abs(hours));
} else if (hours < 0) {
postfix = fmt::format("+{:d}", std::abs(hours));
postfix = std::format("+{:d}", std::abs(hours));
}
return fmt::format("Etc/GMT{:s}", postfix);
return std::format("Etc/GMT{:s}", postfix);
}
} // namespace Common::TimeZone
+10 -11
View File
@@ -6,9 +6,8 @@
#pragma once
#include <compare>
#include <type_traits>
#include <fmt/ranges.h>
#include <format>
#include "common/common_types.h"
@@ -260,35 +259,35 @@ constexpr inline uint64_t GetInteger(Common::TypedAddress<Virtual, T> address) {
}
template <>
struct fmt::formatter<Common::PhysicalAddress> {
constexpr auto parse(fmt::format_parse_context& ctx) {
struct std::formatter<Common::PhysicalAddress> {
constexpr auto parse(std::format_parse_context& ctx) {
return ctx.begin();
}
template <typename FormatContext>
auto format(const Common::PhysicalAddress& addr, FormatContext& ctx) const {
return fmt::format_to(ctx.out(), "{:#x}", static_cast<u64>(addr.GetValue()));
return std::format_to(ctx.out(), "{:#x}", static_cast<u64>(addr.GetValue()));
}
};
template <>
struct fmt::formatter<Common::ProcessAddress> {
constexpr auto parse(fmt::format_parse_context& ctx) {
struct std::formatter<Common::ProcessAddress> {
constexpr auto parse(std::format_parse_context& ctx) {
return ctx.begin();
}
template <typename FormatContext>
auto format(const Common::ProcessAddress& addr, FormatContext& ctx) const {
return fmt::format_to(ctx.out(), "{:#x}", static_cast<u64>(addr.GetValue()));
return std::format_to(ctx.out(), "{:#x}", static_cast<u64>(addr.GetValue()));
}
};
template <>
struct fmt::formatter<Common::VirtualAddress> {
constexpr auto parse(fmt::format_parse_context& ctx) {
struct std::formatter<Common::VirtualAddress> {
constexpr auto parse(std::format_parse_context& ctx) {
return ctx.begin();
}
template <typename FormatContext>
auto format(const Common::VirtualAddress& addr, FormatContext& ctx) const {
return fmt::format_to(ctx.out(), "{:#x}", static_cast<u64>(addr.GetValue()));
return std::format_to(ctx.out(), "{:#x}", static_cast<u64>(addr.GetValue()));
}
};
+3 -3
View File
@@ -8,7 +8,7 @@
#include <optional>
#include <random>
#include <fmt/ranges.h>
#include <format>
#include "common/assert.h"
#include "common/tiny_mt.h"
@@ -146,7 +146,7 @@ std::array<u8, 0x10> ConstructUUID(std::string_view uuid_string) {
UUID::UUID(std::string_view uuid_string) : uuid{ConstructUUID(uuid_string)} {}
std::string UUID::RawString() const {
return fmt::format("{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}"
return std::format("{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}"
"{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}",
uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7],
uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14],
@@ -154,7 +154,7 @@ std::string UUID::RawString() const {
}
std::string UUID::FormattedString() const {
return fmt::format("{:02x}{:02x}{:02x}{:02x}"
return std::format("{:02x}{:02x}{:02x}{:02x}"
"-{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-"
"{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}",
uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7],
+1 -1
View File
@@ -109,7 +109,7 @@ struct UUID {
friend constexpr bool operator==(const UUID& lhs, const UUID& rhs) = default;
};
static_assert(sizeof(UUID) == 0x10, "UUID has incorrect size.");
static_assert(std::is_trivial_v<UUID>);
static_assert(std::is_trivially_default_constructible_v<UUID> && std::is_trivially_copyable_v<UUID>);
/// An invalid UUID. This UUID has all its bytes set to 0.
constexpr UUID InvalidUUID = {};
-1
View File
@@ -1220,7 +1220,6 @@ endif()
target_link_libraries(core PRIVATE
OpenSSL::SSL
OpenSSL::Crypto
fmt::fmt
RenderDoc::API
jacinth::jacinth
ZLIB::ZLIB)
+6 -6
View File
@@ -26,20 +26,20 @@ void ArmInterface::LogBacktrace(Kernel::KProcess* process) const {
ctx.r[28], ctx.fp, ctx.lr, ctx.sp,
};
std::string msg = fmt::format("Backtrace @ PC={:016X}\n", ctx.pc);
std::string msg = std::format("Backtrace @ PC={:016X}\n", ctx.pc);
for (size_t i = 0; i < 32; i += 4)
msg += fmt::format("R{:02}={:016X} R{:02}={:016X} R{:02}={:016X} R{:02}={:016X}\n",
msg += std::format("R{:02}={:016X} R{:02}={:016X} R{:02}={:016X} R{:02}={:016X}\n",
i + 0, xreg[i + 0], i + 1, xreg[i + 1],
i + 2, xreg[i + 2], i + 3, xreg[i + 3]);
for (size_t i = 0; i < 32; i += 2)
msg += fmt::format("V{:02}={:016X}_{:016X} V{:02}={:016X}_{:016X}\n",
msg += std::format("V{:02}={:016X}_{:016X} V{:02}={:016X}_{:016X}\n",
i + 0, ctx.v[i + 0][0], ctx.v[i + 0][1],
i + 1, ctx.v[i + 1][0], ctx.v[i + 1][1]);
msg += fmt::format("PSTATE={:08X} FPCR={:08X} FPSR={:08X} TPIDR={:016X}\n", ctx.pstate, ctx.fpcr, ctx.fpsr, ctx.tpidr);
msg += fmt::format("{:20}{:20}{:20}{:20}{}\n", "Module", "Address", "Original Address", "Offset", "Symbol");
msg += std::format("PSTATE={:08X} FPCR={:08X} FPSR={:08X} TPIDR={:016X}\n", ctx.pstate, ctx.fpcr, ctx.fpsr, ctx.tpidr);
msg += std::format("{:20}{:20}{:20}{:20}{}\n", "Module", "Address", "Original Address", "Offset", "Symbol");
auto const backtrace = GetBacktraceFromContext(process, ctx);
for (auto const& entry : backtrace)
msg += fmt::format("{:20}{:016X} {:016X} {:016X} {}\n", entry.module, entry.address, entry.original_address, entry.offset, entry.name);
msg += std::format("{:20}{:016X} {:016X} {:016X} {}\n", entry.module, entry.address, entry.original_address, entry.offset, entry.name);
LOG_ERROR(Core_ARM, "{}", msg);
}
+2 -2
View File
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
@@ -208,7 +208,7 @@ std::string GetThreadState(const Kernel::KThread* thread) {
case Kernel::ThreadState::Initialized:
return "Initialized";
case Kernel::ThreadState::Waiting:
return fmt::format("Waiting ({})", GetThreadWaitReason(thread));
return std::format("Waiting ({})", GetThreadWaitReason(thread));
case Kernel::ThreadState::Runnable:
return "Runnable";
case Kernel::ThreadState::Terminated:
+3 -3
View File
@@ -4,7 +4,7 @@
// SPDX-FileCopyrightText: 2017 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <fmt/ranges.h>
#include <format>
#include "common/logging.h"
#include "core/arm/dynarmic/arm_dynarmic_32.h"
#include "core/arm/dynarmic/dynarmic_cp15.h"
@@ -20,13 +20,13 @@ using CallbackOrAccessOneWord = Dynarmic::A32::Coprocessor::CallbackOrAccessOneW
using CallbackOrAccessTwoWords = Dynarmic::A32::Coprocessor::CallbackOrAccessTwoWords;
template <>
struct fmt::formatter<Dynarmic::A32::CoprocReg> {
struct std::formatter<Dynarmic::A32::CoprocReg> {
constexpr auto parse(format_parse_context& ctx) {
return ctx.begin();
}
template <typename FormatContext>
auto format(const Dynarmic::A32::CoprocReg& reg, FormatContext& ctx) const {
return fmt::format_to(ctx.out(), "cp{}", static_cast<size_t>(reg));
return std::format_to(ctx.out(), "cp{}", static_cast<size_t>(reg));
}
};
+1 -1
View File
@@ -80,7 +80,7 @@ FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs,
std::vector<FileSys::VirtualFile> concat;
for (u32 i = 0; i < 0x10; ++i) {
const auto file_name = fmt::format("{:02X}", i);
const auto file_name = std::format("{:02X}", i);
auto next = dir->GetFile(file_name);
if (next != nullptr) {
+1 -1
View File
@@ -52,7 +52,7 @@ static inline const std::string GetCipherName(Mode mode, u32 key_size) {
default:
UNREACHABLE();
}
return fmt::format("AES-{}-{}", effective_bits, cipher);
return std::format("AES-{}-{}", effective_bits, cipher);
};
static EVP_CIPHER *GetCipher(Mode mode, u32 key_size) {
+11 -11
View File
@@ -775,7 +775,7 @@ void KeyManager::WriteKeyToFile(KeyCategory category, std::string_view keyname,
"# If you are experiencing issues involving keys, it may help to delete this file\n"));
}
void(file.WriteString(fmt::format("\n{} = {}", keyname, Common::HexToString(key))));
void(file.WriteString(std::format("\n{} = {}", keyname, Common::HexToString(key))));
LoadFromFile(path, category == KeyCategory::Title);
}
@@ -810,21 +810,21 @@ void KeyManager::SetKey(S128KeyType id, Key128 key, u64 field1, u64 field2) {
"key_area_key_ocean_{:02X}",
"key_area_key_system_{:02X}",
};
WriteKeyToFile(category, fmt::format(fmt::runtime(kak_names.at(field2)), field1), key);
WriteKeyToFile(category, std::vformat(kak_names.at(field2), std::make_format_args(field1)), key);
} else if (id == S128KeyType::Master) {
WriteKeyToFile(category, fmt::format("master_key_{:02X}", field1), key);
WriteKeyToFile(category, std::format("master_key_{:02X}", field1), key);
} else if (id == S128KeyType::Package1) {
WriteKeyToFile(category, fmt::format("package1_key_{:02X}", field1), key);
WriteKeyToFile(category, std::format("package1_key_{:02X}", field1), key);
} else if (id == S128KeyType::Package2) {
WriteKeyToFile(category, fmt::format("package2_key_{:02X}", field1), key);
WriteKeyToFile(category, std::format("package2_key_{:02X}", field1), key);
} else if (id == S128KeyType::Titlekek) {
WriteKeyToFile(category, fmt::format("titlekek_{:02X}", field1), key);
WriteKeyToFile(category, std::format("titlekek_{:02X}", field1), key);
} else if (id == S128KeyType::Keyblob) {
WriteKeyToFile(category, fmt::format("keyblob_key_{:02X}", field1), key);
WriteKeyToFile(category, std::format("keyblob_key_{:02X}", field1), key);
} else if (id == S128KeyType::KeyblobMAC) {
WriteKeyToFile(category, fmt::format("keyblob_mac_key_{:02X}", field1), key);
WriteKeyToFile(category, std::format("keyblob_mac_key_{:02X}", field1), key);
} else if (id == S128KeyType::Source && field1 == u64(SourceKeyType::Keyblob)) {
WriteKeyToFile(category, fmt::format("keyblob_key_source_{:02X}", field2), key);
WriteKeyToFile(category, std::format("keyblob_key_source_{:02X}", field2), key);
}
s128_keys[{id, field1, field2}] = key;
@@ -954,7 +954,7 @@ void KeyManager::DeriveBase() {
// Decrypt keyblob
if (keyblobs[i] == std::array<u8, 0x90>{}) {
keyblobs[i] = DecryptKeyblob(encrypted_keyblobs[i], key);
WriteKeyToFile<0x90>(KeyCategory::Console, fmt::format("keyblob_{:02X}", i),
WriteKeyToFile<0x90>(KeyCategory::Console, std::format("keyblob_{:02X}", i),
keyblobs[i]);
}
@@ -1089,7 +1089,7 @@ void KeyManager::PopulateFromPartitionData(PartitionDataManager& data) {
for (size_t i = 0; i < encrypted_keyblobs.size(); ++i) {
if (encrypted_keyblobs[i] == std::array<u8, 0xB0>{}) {
encrypted_keyblobs[i] = data.GetEncryptedKeyblob(i);
WriteKeyToFile<0xB0>(KeyCategory::Console, fmt::format("encrypted_keyblob_{:02X}", i), encrypted_keyblobs[i]);
WriteKeyToFile<0xB0>(KeyCategory::Console, std::format("encrypted_keyblob_{:02X}", i), encrypted_keyblobs[i]);
}
}
+2 -2
View File
@@ -14,7 +14,7 @@
#include <string>
#include <variant>
#include <fmt/ranges.h>
#include <format>
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "core/crypto/partition_data_manager.h"
@@ -241,7 +241,7 @@ struct KeyIndex {
u8 key_size = 16;
if constexpr (std::is_same_v<KeyType, S256KeyType>)
key_size = 32;
return fmt::format("key_size={:02X}, key={:02X}, field1={:016X}, field2={:016X}", key_size,
return std::format("key_size={:02X}, key={:02X}, field1={:016X}, field2={:016X}", key_size,
static_cast<u8>(type), field1, field2);
}
};
+2 -2
View File
@@ -32,7 +32,7 @@
template <typename Readable, typename Buffer, typename Callback>
static void AsyncReceiveInto(Readable& r, Buffer& buffer, Callback&& c) {
static_assert(std::is_trivial_v<Buffer>);
static_assert(std::is_trivially_default_constructible_v<Buffer> && std::is_trivially_copyable_v<Buffer>);
auto boost_buffer{boost::asio::buffer(&buffer, sizeof(Buffer))};
r.async_read_some(
boost_buffer, [&, c](const boost::system::error_code& error, size_t bytes_read) {
@@ -57,7 +57,7 @@ static void AsyncAccept(boost::asio::ip::tcp::acceptor& acceptor, Callback&& c)
template <typename Readable, typename Buffer>
static std::span<const u8> ReceiveInto(Readable& r, Buffer& buffer) {
static_assert(std::is_trivial_v<Buffer>);
static_assert(std::is_trivially_default_constructible_v<Buffer> && std::is_trivially_copyable_v<Buffer>);
auto boost_buffer{boost::asio::buffer(&buffer, sizeof(Buffer))};
size_t bytes_read = r.read_some(boost_buffer);
const u8* buffer_start = reinterpret_cast<const u8*>(&buffer);
+29 -18
View File
@@ -12,6 +12,7 @@
#include <numeric>
#include <optional>
#include <thread>
#include <ranges>
#include "common/hex_util.h"
#include "common/logging.h"
@@ -76,7 +77,7 @@ static std::string EscapeXML(std::string_view data) {
case '>': escaped += "&gt;"; break;
default:
if (c > 0x7f) {
escaped += fmt::format("&#{};", u32(c));
escaped += std::format("&#{};", u32(c));
} else {
escaped += char(c);
}
@@ -109,14 +110,14 @@ void GDBStub::Watchpoint(Kernel::KThread* thread, const Kernel::DebugWatchpoint&
switch (watch.type) {
case Kernel::DebugWatchpointType::Read:
SendReply(fmt::format("{}rwatch:{:x};", status, GetInteger(watch.start_address)));
SendReply(std::format("{}rwatch:{:x};", status, GetInteger(watch.start_address)));
break;
case Kernel::DebugWatchpointType::Write:
SendReply(fmt::format("{}watch:{:x};", status, GetInteger(watch.start_address)));
SendReply(std::format("{}watch:{:x};", status, GetInteger(watch.start_address)));
break;
case Kernel::DebugWatchpointType::ReadOrWrite:
default:
SendReply(fmt::format("{}awatch:{:x};", status, GetInteger(watch.start_address)));
SendReply(std::format("{}awatch:{:x};", status, GetInteger(watch.start_address)));
break;
}
}
@@ -395,9 +396,9 @@ static std::string PaginateBuffer(std::string_view buffer, std::string_view requ
const auto amount_val{static_cast<u64>(strtoll(amount.data(), nullptr, 16))};
if (offset_val + amount_val > buffer.size()) {
return fmt::format("l{}", buffer.substr(offset_val));
return std::format("l{}", buffer.substr(offset_val));
} else {
return fmt::format("m{}", buffer.substr(offset_val, amount_val));
return std::format("m{}", buffer.substr(offset_val, amount_val));
}
}
@@ -413,14 +414,14 @@ void GDBStub::HandleQuery(std::string_view sv) {
SendReply(PaginateBuffer(target_xml, sv.substr(30)));
} else if (sv.starts_with("Offsets")) {
const auto main_offset = Core::FindMainModuleEntrypoint(debug_process);
SendReply(fmt::format("TextSeg={:x}", GetInteger(main_offset)));
SendReply(std::format("TextSeg={:x}", GetInteger(main_offset)));
} else if (sv.starts_with("Xfer:libraries:read::")) {
auto modules = Core::FindModules(debug_process);
std::string buffer;
buffer += R"(<?xml version="1.0"?>)";
buffer += "<library-list>";
for (const auto& [base, name] : modules) {
buffer += fmt::format(R"(<library name="{}"><segment address="{:#x}"/></library>)",
buffer += std::format(R"(<library name="{}"><segment address="{:#x}"/></library>)",
EscapeXML(name), base);
}
buffer += "</library-list>";
@@ -431,8 +432,18 @@ void GDBStub::HandleQuery(std::string_view sv) {
const auto& threads = debug_process->GetThreadList();
std::vector<std::string> thread_ids;
for (const auto& thread : threads)
thread_ids.push_back(fmt::format("{:x}", thread.GetThreadId()));
SendReply(fmt::format("m{}", fmt::join(thread_ids, ",")));
thread_ids.push_back(std::format("{:x}", thread.GetThreadId()));
std::string joined;
bool first = true;
for (const auto& id : thread_ids) {
if (!first) {
joined += ',';
}
joined += id;
first = false;
}
SendReply(std::format("m{}", joined));
} else if (sv.starts_with("sThreadInfo")) {
// end of list
SendReply("l");
@@ -445,10 +456,10 @@ void GDBStub::HandleQuery(std::string_view sv) {
for (const auto& thread : threads) {
auto thread_name{Core::GetThreadName(&thread)};
if (!thread_name) {
thread_name = fmt::format("Thread {:d}", thread.GetThreadId());
thread_name = std::format("Thread {:d}", thread.GetThreadId());
}
buffer += fmt::format(R"(<thread id="{:x}" core="{:d}" name="{}">{}</thread>)",
buffer += std::format(R"(<thread id="{:x}" core="{:d}" name="{}">{}</thread>)",
thread.GetThreadId(), thread.GetActiveCore(),
EscapeXML(*thread_name), GetThreadState(&thread));
}
@@ -664,7 +675,7 @@ void GDBStub::HandleRcmd(const std::vector<u8>& command) {
const auto region_bits = impl.current_address_space_width_in_bits;
const auto region_size = 1ULL << region_bits;
reply = fmt::format("Region bits: {}\n"
reply = std::format("Region bits: {}\n"
"Host address: {:#x} - {:#x}\n",
region_bits, region, region + region_size - 1);
} else {
@@ -673,12 +684,12 @@ void GDBStub::HandleRcmd(const std::vector<u8>& command) {
} else if (command_str == "info" || command_str == "get info") {
auto modules = Core::FindModules(debug_process);
reply = fmt::format("Process: {:#x} ({})\n"
reply = std::format("Process: {:#x} ({})\n"
"Program Id: {:#018x}\n",
debug_process->GetProcessId(),
debug_process->GetName(),
debug_process->GetProgramId());
reply += fmt::format(
reply += std::format(
"Layout:\n"
" Alias: {:#012x} - {:#012x}\n"
" Heap: {:#012x} - {:#012x}\n"
@@ -695,7 +706,7 @@ void GDBStub::HandleRcmd(const std::vector<u8>& command) {
GetInteger(page_table.GetStackRegionStart()) + page_table.GetStackRegionSize() - 1);
for (const auto& [vaddr, name] : modules)
reply += fmt::format(" {:#012x} - {:#012x} {}\n", vaddr, GetInteger(Core::GetModuleEnd(debug_process, vaddr)), name);
reply += std::format(" {:#012x} - {:#012x} {}\n", vaddr, GetInteger(Core::GetModuleEnd(debug_process, vaddr)), name);
} else if (command_str == "mappings" || command_str == "get mappings") {
reply = "Mappings:\n";
VAddr cur_addr = 0;
@@ -720,7 +731,7 @@ void GDBStub::HandleRcmd(const std::vector<u8>& command) {
const char u = True(svc_mem_info.attribute & MemoryAttribute::Uncached) ? 'U' : '-';
const char p =True(svc_mem_info.attribute & MemoryAttribute::PermissionLocked) ? 'P' : '-';
reply += fmt::format(
reply += std::format(
" {:#012x} - {:#012x} {} {} {}{}{}{}{} [{}, {}]\n", svc_mem_info.base_address,
svc_mem_info.base_address + svc_mem_info.size - 1, perm, state, l, i, d, u, p,
svc_mem_info.ipc_count, svc_mem_info.device_count);
@@ -784,7 +795,7 @@ std::optional<std::string> GDBStub::DetachCommand() {
void GDBStub::SendReply(std::string_view data) {
const auto escaped = EscapeGDB(data);
const auto output = fmt::format("{}{}{}{:02x}", GDB_STUB_START, escaped, GDB_STUB_END, CalculateChecksum(escaped));
const auto output = std::format("{}{}{}{:02x}", GDB_STUB_START, escaped, GDB_STUB_END, CalculateChecksum(escaped));
LOG_TRACE(Debug_GDBStub, "Writing reply: {}", output);
// C++ string support is complete rubbish
+2 -2
View File
@@ -253,7 +253,7 @@ void GDBStubA64::WriteRegisters(Kernel::KThread* thread, std::string_view regist
}
std::string GDBStubA64::ThreadStatus(const Kernel::KThread* thread, u8 signal) const {
return fmt::format("T{:02x}{:02x}:{};{:02x}:{};{:02x}:{};thread:{:x};", signal, PC_REGISTER,
return std::format("T{:02x}{:02x}:{};{:02x}:{};{:02x}:{};thread:{:x};", signal, PC_REGISTER,
RegRead(thread, PC_REGISTER), SP_REGISTER, RegRead(thread, SP_REGISTER),
LR_REGISTER, RegRead(thread, LR_REGISTER), thread->GetThreadId());
}
@@ -462,7 +462,7 @@ void GDBStubA32::WriteRegisters(Kernel::KThread* thread, std::string_view regist
}
std::string GDBStubA32::ThreadStatus(const Kernel::KThread* thread, u8 signal) const {
return fmt::format("T{:02x}{:02x}:{};{:02x}:{};{:02x}:{};thread:{:x};", signal, PC_REGISTER,
return std::format("T{:02x}{:02x}:{};{:02x}:{};{:02x}:{};thread:{:x};", signal, PC_REGISTER,
RegRead(thread, PC_REGISTER), SP_REGISTER, RegRead(thread, SP_REGISTER),
LR_REGISTER, RegRead(thread, LR_REGISTER), thread->GetThreadId());
}
+7 -4
View File
@@ -1,7 +1,10 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <fmt/ranges.h>
#include <format>
#include "common/fs/path_util.h"
#include "core/file_sys/bis_factory.h"
#include "core/file_sys/registered_cache.h"
@@ -55,13 +58,13 @@ VirtualDir BISFactory::GetModificationLoadRoot(u64 title_id) const {
// LayeredFS doesn't work on updates and title id-less homebrew
if (title_id == 0 || (title_id & 0xFFF) == 0x800)
return nullptr;
return GetOrCreateDirectoryRelative(load_root, fmt::format("/{:016X}", title_id));
return GetOrCreateDirectoryRelative(load_root, std::format("/{:016X}", title_id));
}
VirtualDir BISFactory::GetModificationDumpRoot(u64 title_id) const {
if (title_id == 0)
return nullptr;
return GetOrCreateDirectoryRelative(dump_root, fmt::format("/{:016X}", title_id));
return GetOrCreateDirectoryRelative(dump_root, std::format("/{:016X}", title_id));
}
VirtualDir BISFactory::OpenPartition(BisPartitionId id) const {
@@ -138,7 +141,7 @@ u64 BISFactory::GetFullNANDTotalSpace() const {
VirtualDir BISFactory::GetBCATDirectory(u64 title_id) const {
return GetOrCreateDirectoryRelative(nand_root,
fmt::format("/system/save/bcat/{:016X}", title_id));
std::format("/system/save/bcat/{:016X}", title_id));
}
} // namespace FileSys
+1 -1
View File
@@ -7,7 +7,7 @@
#include <array>
#include <string>
#include <fmt/ostream.h>
#include <format>
#include "common/logging.h"
#include "core/crypto/key_manager.h"
+3 -3
View File
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
@@ -7,7 +7,7 @@
#pragma once
#include <array>
#include <fmt/ranges.h>
#include <format>
#include "common/common_funcs.h"
#include "common/common_types.h"
@@ -132,7 +132,7 @@ struct SaveDataAttribute {
}
std::string DebugInfo() const {
return fmt::format(
return std::format(
"[title_id={:016X}, user_id={:016X}{:016X}, save_id={:016X}, type={:02X}, "
"rank={}, index={}]",
program_id, user_id[1], user_id[0], system_save_data_id, static_cast<u8>(type),
+1 -1
View File
@@ -39,7 +39,7 @@ struct HashSalt {
std::array<u8, Size> value;
};
static_assert(std::is_trivial_v<HashSalt>);
static_assert(std::is_trivially_default_constructible_v<HashSalt> && std::is_trivially_copyable_v<HashSalt>);
static_assert(sizeof(HashSalt) == HashSalt::Size);
constexpr inline size_t IntegrityMinLayerCount = 2;
@@ -57,7 +57,7 @@ public:
};
static_assert(sizeof(Entry) == 0x10);
static_assert(alignof(Entry) == 4);
static_assert(std::is_trivial_v<Entry>);
static_assert(std::is_trivially_default_constructible_v<Entry> && std::is_trivially_copyable_v<Entry>);
public:
static constexpr s64 QueryHeaderStorageSize() {
@@ -15,7 +15,7 @@ namespace {
using Node = impl::BucketTreeNode<const s64*>;
static_assert(sizeof(Node) == sizeof(BucketTree::NodeHeader));
static_assert(std::is_trivial_v<Node>);
static_assert(std::is_trivially_default_constructible_v<Node> && std::is_trivially_copyable_v<Node>);
constexpr inline s32 NodeHeaderSize = sizeof(BucketTree::NodeHeader);
@@ -44,7 +44,7 @@ public:
void Format(s32 entry_count);
Result Verify() const;
};
static_assert(std::is_trivial_v<Header>);
static_assert(std::is_trivially_default_constructible_v<Header> && std::is_trivially_copyable_v<Header>);
static_assert(sizeof(Header) == 0x10);
struct NodeHeader {
@@ -54,7 +54,7 @@ public:
Result Verify(s32 node_index, size_t node_size, size_t entry_size) const;
};
static_assert(std::is_trivial_v<NodeHeader>);
static_assert(std::is_trivially_default_constructible_v<NodeHeader> && std::is_trivially_copyable_v<NodeHeader>);
static_assert(sizeof(NodeHeader) == 0x10);
struct Offsets {
@@ -69,7 +69,7 @@ public:
return size > 0 && this->start_offset <= offset && size <= (this->end_offset - offset);
}
};
static_assert(std::is_trivial_v<Offsets>);
static_assert(std::is_trivially_default_constructible_v<Offsets> && std::is_trivially_copyable_v<Offsets>);
static_assert(sizeof(Offsets) == 0x10);
struct OffsetCache {
@@ -184,7 +184,7 @@ private:
template <typename T>
T* Get() const {
static_assert(std::is_trivial_v<T>);
static_assert(std::is_trivially_default_constructible_v<T> && std::is_trivially_copyable_v<T>);
static_assert(sizeof(T) == sizeof(NodeHeader));
return reinterpret_cast<T*>(m_header);
}
@@ -405,9 +405,9 @@ private:
s64 end;
s64 start;
} info;
static_assert(std::is_trivial_v<Info>);
static_assert(std::is_trivially_default_constructible_v<Info> && std::is_trivially_copyable_v<Info>);
};
static_assert(std::is_trivial_v<EntrySetHeader>);
static_assert(std::is_trivially_default_constructible_v<EntrySetHeader> && std::is_trivially_copyable_v<EntrySetHeader>);
const BucketTree* m_tree;
BucketTree::Offsets m_offsets;
@@ -16,7 +16,7 @@ namespace FileSys {
template <typename EntryType>
Result BucketTree::ScanContinuousReading(ContinuousReadingInfo* out_info,
const ContinuousReadingParam<EntryType>& param) const {
static_assert(std::is_trivial_v<ContinuousReadingParam<EntryType>>);
static_assert(std::is_trivially_default_constructible_v<ContinuousReadingParam<EntryType>> && std::is_trivially_copyable_v<ContinuousReadingParam<EntryType>>);
// Validate our preconditions.
ASSERT(this->IsInitialized());
@@ -140,7 +140,7 @@ Result BucketTree::ScanContinuousReading(ContinuousReadingInfo* out_info,
template <typename EntryType>
Result BucketTree::Visitor::ScanContinuousReading(ContinuousReadingInfo* out_info, s64 offset,
size_t size) const {
static_assert(std::is_trivial_v<EntryType>);
static_assert(std::is_trivially_default_constructible_v<EntryType> && std::is_trivially_copyable_v<EntryType>);
ASSERT(this->IsValid());
// Create our parameters.
@@ -36,7 +36,7 @@ public:
return this->phys_size;
}
};
static_assert(std::is_trivial_v<Entry>);
static_assert(std::is_trivially_default_constructible_v<Entry> && std::is_trivially_copyable_v<Entry>);
static_assert(sizeof(Entry) == 0x18);
public:
@@ -679,7 +679,7 @@ private:
return this->virtual_offset + this->virtual_size;
}
};
static_assert(std::is_trivial_v<AccessRange>);
static_assert(std::is_trivially_default_constructible_v<AccessRange> && std::is_trivially_copyable_v<AccessRange>);
public:
CacheManager() = default;
@@ -22,7 +22,7 @@ struct HierarchicalIntegrityVerificationLevelInformation {
s32 block_order;
std::array<u8, 4> reserved;
};
static_assert(std::is_trivial_v<HierarchicalIntegrityVerificationLevelInformation>);
static_assert(std::is_trivially_default_constructible_v<HierarchicalIntegrityVerificationLevelInformation> && std::is_trivially_copyable_v<HierarchicalIntegrityVerificationLevelInformation>);
static_assert(sizeof(HierarchicalIntegrityVerificationLevelInformation) == 0x18);
static_assert(alignof(HierarchicalIntegrityVerificationLevelInformation) == 0x4);
@@ -43,7 +43,7 @@ struct HierarchicalIntegrityVerificationInformation {
return this->info[this->max_layers - 2].size;
}
};
static_assert(std::is_trivial_v<HierarchicalIntegrityVerificationInformation>);
static_assert(std::is_trivially_default_constructible_v<HierarchicalIntegrityVerificationInformation> && std::is_trivially_copyable_v<HierarchicalIntegrityVerificationInformation>);
struct HierarchicalIntegrityVerificationMetaInformation {
u32 magic;
@@ -51,14 +51,14 @@ struct HierarchicalIntegrityVerificationMetaInformation {
u32 master_hash_size;
HierarchicalIntegrityVerificationInformation level_hash_info;
};
static_assert(std::is_trivial_v<HierarchicalIntegrityVerificationMetaInformation>);
static_assert(std::is_trivially_default_constructible_v<HierarchicalIntegrityVerificationMetaInformation> && std::is_trivially_copyable_v<HierarchicalIntegrityVerificationMetaInformation>);
struct HierarchicalIntegrityVerificationSizeSet {
s64 control_size;
s64 master_hash_size;
std::array<s64, IntegrityMaxLayerCount - 2> layered_hash_sizes;
};
static_assert(std::is_trivial_v<HierarchicalIntegrityVerificationSizeSet>);
static_assert(std::is_trivially_default_constructible_v<HierarchicalIntegrityVerificationSizeSet> && std::is_trivially_copyable_v<HierarchicalIntegrityVerificationSizeSet>);
class HierarchicalIntegrityVerificationStorage : public IReadOnlyStorage {
YUZU_NON_COPYABLE(HierarchicalIntegrityVerificationStorage);
@@ -51,7 +51,7 @@ public:
return offset;
}
};
static_assert(std::is_trivial_v<Entry>);
static_assert(std::is_trivially_default_constructible_v<Entry> && std::is_trivially_copyable_v<Entry>);
static_assert(sizeof(Entry) == 0x14);
struct EntryData {
@@ -65,7 +65,7 @@ public:
this->storage_index = entry.storage_index;
}
};
static_assert(std::is_trivial_v<EntryData>);
static_assert(std::is_trivially_default_constructible_v<EntryData> && std::is_trivially_copyable_v<EntryData>);
public:
IndirectStorage() : m_table(), m_data_storage() {}
@@ -158,7 +158,7 @@ private:
return this->entry.storage_index != 0;
}
};
static_assert(std::is_trivial_v<ContinuousReadingEntry>);
static_assert(std::is_trivially_default_constructible_v<ContinuousReadingEntry> && std::is_trivially_copyable_v<ContinuousReadingEntry>);
private:
mutable BucketTree m_table;
@@ -26,7 +26,7 @@ public:
struct BlockHash {
std::array<u8, HashSize> hash;
};
static_assert(std::is_trivial_v<BlockHash>);
static_assert(std::is_trivially_default_constructible_v<BlockHash> && std::is_trivially_copyable_v<BlockHash>);
public:
IntegrityVerificationStorage()
@@ -54,12 +54,12 @@ struct NcaCryptoConfiguration {
bool is_plaintext_header_available;
bool is_available_sw_key;
};
static_assert(std::is_trivial_v<NcaCryptoConfiguration>);
static_assert(std::is_trivially_default_constructible_v<NcaCryptoConfiguration> && std::is_trivially_copyable_v<NcaCryptoConfiguration>);
struct NcaCompressionConfiguration {
GetDecompressorFunction get_decompressor;
};
static_assert(std::is_trivial_v<NcaCompressionConfiguration>);
static_assert(std::is_trivially_default_constructible_v<NcaCompressionConfiguration> && std::is_trivially_copyable_v<NcaCompressionConfiguration>);
constexpr inline s32 KeyAreaEncryptionKeyCount =
NcaCryptoConfiguration::KeyAreaEncryptionKeyIndexCount *
@@ -25,7 +25,7 @@ struct Hash {
std::array<u8, Size> value;
};
static_assert(sizeof(Hash) == Hash::Size);
static_assert(std::is_trivial_v<Hash>);
static_assert(std::is_trivially_default_constructible_v<Hash> && std::is_trivially_copyable_v<Hash>);
using NcaDigest = Hash;
@@ -72,7 +72,7 @@ struct NcaHeader {
u32 reserved;
};
static_assert(sizeof(FsInfo) == 0x10);
static_assert(std::is_trivial_v<FsInfo>);
static_assert(std::is_trivially_default_constructible_v<FsInfo> && std::is_trivially_copyable_v<FsInfo>);
static constexpr u32 Magic0 = Common::MakeMagic('N', 'C', 'A', '0');
static constexpr u32 Magic1 = Common::MakeMagic('N', 'C', 'A', '1');
@@ -126,7 +126,7 @@ struct NcaHeader {
u8 GetProperKeyGeneration() const;
};
static_assert(sizeof(NcaHeader) == NcaHeader::Size);
static_assert(std::is_trivial_v<NcaHeader>);
static_assert(std::is_trivially_default_constructible_v<NcaHeader> && std::is_trivially_copyable_v<NcaHeader>);
struct NcaBucketInfo {
static constexpr size_t HeaderSize = 0x10;
@@ -134,7 +134,7 @@ struct NcaBucketInfo {
Int64 size;
std::array<u8, HeaderSize> header;
};
static_assert(std::is_trivial_v<NcaBucketInfo>);
static_assert(std::is_trivially_default_constructible_v<NcaBucketInfo> && std::is_trivially_copyable_v<NcaBucketInfo>);
struct NcaPatchInfo {
static constexpr size_t Size = 0x40;
@@ -150,7 +150,7 @@ struct NcaPatchInfo {
bool HasIndirectTable() const;
bool HasAesCtrExTable() const;
};
static_assert(std::is_trivial_v<NcaPatchInfo>);
static_assert(std::is_trivially_default_constructible_v<NcaPatchInfo> && std::is_trivially_copyable_v<NcaPatchInfo>);
union NcaAesCtrUpperIv {
u64 value;
@@ -159,7 +159,7 @@ union NcaAesCtrUpperIv {
u32 secure_value;
} part;
};
static_assert(std::is_trivial_v<NcaAesCtrUpperIv>);
static_assert(std::is_trivially_default_constructible_v<NcaAesCtrUpperIv> && std::is_trivially_copyable_v<NcaAesCtrUpperIv>);
struct NcaSparseInfo {
NcaBucketInfo bucket;
@@ -181,20 +181,20 @@ struct NcaSparseInfo {
return sparse_upper_iv;
}
};
static_assert(std::is_trivial_v<NcaSparseInfo>);
static_assert(std::is_trivially_default_constructible_v<NcaSparseInfo> && std::is_trivially_copyable_v<NcaSparseInfo>);
struct NcaCompressionInfo {
NcaBucketInfo bucket;
std::array<u8, 8> resreved;
};
static_assert(std::is_trivial_v<NcaCompressionInfo>);
static_assert(std::is_trivially_default_constructible_v<NcaCompressionInfo> && std::is_trivially_copyable_v<NcaCompressionInfo>);
struct NcaMetaDataHashDataInfo {
Int64 offset;
Int64 size;
Hash hash;
};
static_assert(std::is_trivial_v<NcaMetaDataHashDataInfo>);
static_assert(std::is_trivially_default_constructible_v<NcaMetaDataHashDataInfo> && std::is_trivially_copyable_v<NcaMetaDataHashDataInfo>);
struct NcaFsHeader {
static constexpr size_t Size = 0x200;
@@ -204,7 +204,7 @@ struct NcaFsHeader {
Int64 offset;
Int64 size;
};
static_assert(std::is_trivial_v<Region>);
static_assert(std::is_trivially_default_constructible_v<Region> && std::is_trivially_copyable_v<Region>);
enum class FsType : u8 {
RomFs = 0,
@@ -246,7 +246,7 @@ struct NcaFsHeader {
s32 hash_layer_count;
std::array<Region, HashLayerCountMax> hash_layer_region;
} hierarchical_sha256_data;
static_assert(std::is_trivial_v<HierarchicalSha256Data>);
static_assert(std::is_trivially_default_constructible_v<HierarchicalSha256Data> && std::is_trivially_copyable_v<HierarchicalSha256Data>);
struct IntegrityMetaInfo {
static const size_t MasterHashOffset;
@@ -279,7 +279,7 @@ struct NcaFsHeader {
Hash master_hash;
} integrity_meta_info;
static_assert(std::is_trivial_v<IntegrityMetaInfo>);
static_assert(std::is_trivially_default_constructible_v<IntegrityMetaInfo> && std::is_trivially_copyable_v<IntegrityMetaInfo>);
std::array<u8, NcaPatchInfo::Offset - HashDataOffset> padding;
};
@@ -325,7 +325,7 @@ struct NcaFsHeader {
}
};
static_assert(sizeof(NcaFsHeader) == NcaFsHeader::Size);
static_assert(std::is_trivial_v<NcaFsHeader>);
static_assert(std::is_trivially_default_constructible_v<NcaFsHeader> && std::is_trivially_copyable_v<NcaFsHeader>);
static_assert(offsetof(NcaFsHeader, patch_info) == NcaPatchInfo::Offset);
inline constexpr const size_t NcaFsHeader::HashData::HierarchicalSha256Data::MasterHashOffset =
@@ -339,6 +339,6 @@ struct NcaMetaDataHashData {
};
static_assert(sizeof(NcaMetaDataHashData) ==
sizeof(NcaFsHeader::HashData::IntegrityMetaInfo) + sizeof(s64));
static_assert(std::is_trivial_v<NcaMetaDataHashData>);
static_assert(std::is_trivially_default_constructible_v<NcaMetaDataHashData> && std::is_trivially_copyable_v<NcaMetaDataHashData>);
} // namespace FileSys
+1 -1
View File
@@ -162,7 +162,7 @@ void IPSwitchCompiler::Parse(std::span<u8 const> bytes) {
// yes, @nsobid too -- NSO Build ID Specifier
case 'n':
case 'N':
nso_build_id = Common::HexStringToArray<0x20>(fmt::format("{:0<64}", line.substr(8)));
nso_build_id = Common::HexStringToArray<0x20>(std::format("{:0<64}", line.substr(8)));
break;
// @stop
case 's':
+10 -10
View File
@@ -60,9 +60,9 @@ std::string FormatTitleVersion(u32 version,
}
if (format == TitleVersionFormat::FourElements) {
return fmt::format("v{}.{}.{}.{}", bytes[3], bytes[2], bytes[1], bytes[0]);
return std::format("v{}.{}.{}.{}", bytes[3], bytes[2], bytes[1], bytes[0]);
}
return fmt::format("v{}.{}.{}", bytes[3], bytes[2], bytes[1]);
return std::format("v{}.{}.{}", bytes[3], bytes[2], bytes[1]);
}
// Returns a directory with name matching name case-insensitive. Returns nullptr if directory
@@ -87,7 +87,7 @@ std::optional<std::vector<Core::Memory::CheatEntry>> ReadCheatFileFromFolder(
u64 title_id, const PatchManager::BuildID& build_id_, const VirtualDir& base_path, bool upper) {
const auto build_id_raw = Common::HexToString(build_id_, upper);
const auto build_id = build_id_raw.substr(0, sizeof(u64) * 2);
const auto file = base_path->GetFile(fmt::format("{}.txt", build_id));
const auto file = base_path->GetFile(std::format("{}.txt", build_id));
if (file == nullptr) {
LOG_INFO(Common_Filesystem, "No cheats file found for title_id={:016X}, build_id={}",
@@ -120,7 +120,7 @@ bool IsDirValidAndNonEmpty(const VirtualDir& dir) {
}
bool IsVersionedExternalUpdateDisabled(const std::vector<std::string>& disabled, u32 version) {
const std::string disabled_key = fmt::format("Update@{}", version);
const std::string disabled_key = std::format("Update@{}", version);
return std::find(disabled.cbegin(), disabled.cend(), disabled_key) != disabled.cend() ||
std::find(disabled.cbegin(), disabled.cend(), "Update") != disabled.cend();
}
@@ -373,7 +373,7 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const {
std::vector<VirtualFile> PatchManager::CollectPatches(const std::vector<VirtualDir>& patch_dirs, const std::string& build_id) const {
const auto disabled = GetDisabledAddons();
const auto nso_build_id = fmt::format("{:0<64}", build_id);
const auto nso_build_id = std::format("{:0<64}", build_id);
std::vector<VirtualFile> out;
out.reserve(patch_dirs.size());
@@ -386,7 +386,7 @@ std::vector<VirtualFile> PatchManager::CollectPatches(const std::vector<VirtualD
for (const auto& file : exefs_dir->GetFiles()) {
if (file->GetExtension() == "ips") {
auto name = file->GetName();
const auto this_build_id = fmt::format("{:0<64}", name.substr(0, name.find('.')));
const auto this_build_id = std::format("{:0<64}", name.substr(0, name.find('.')));
if (nso_build_id == this_build_id)
out.push_back(file);
} else if (file->GetExtension() == "pchtxt") {
@@ -422,7 +422,7 @@ std::vector<u8> PatchManager::PatchNSO(const std::vector<u8>& nso, const std::st
const auto dump_dir = fs_controller.GetModificationDumpRoot(title_id);
if (dump_dir != nullptr) {
const auto nso_dir = GetOrCreateDirectoryRelative(dump_dir, "/nso");
const auto file = nso_dir->CreateFile(fmt::format("{}-{}.nso", name, build_id));
const auto file = nso_dir->CreateFile(std::format("{}-{}.nso", name, build_id));
file->Resize(nso.size());
file->WriteBytes(nso);
@@ -605,7 +605,7 @@ void PatchManager::ApplyLayeredFS(VirtualFile& romfs, ContentRecordType type) co
VirtualFile PatchManager::PatchRomFS(const NCA* base_nca, VirtualFile base_romfs,
ContentRecordType type, VirtualFile packed_update_raw,
bool apply_layeredfs) const {
const auto log_string = fmt::format("Patching RomFS for title_id={:016X}, type={:02X}",
const auto log_string = std::format("Patching RomFS for title_id={:016X}, type={:02X}",
title_id, static_cast<u8>(type));
if (type == ContentRecordType::Program || type == ContentRecordType::Data) {
LOG_INFO(Loader, "{}", log_string);
@@ -1068,9 +1068,9 @@ std::vector<Patch> PatchManager::GetPatches(VirtualFile update_raw) const {
std::string list;
for (size_t i = 0; i < dlc_match.size() - 1; ++i)
list += fmt::format("{}, ", dlc_match[i].title_id & 0x7FF);
list += std::format("{}, ", dlc_match[i].title_id & 0x7FF);
list += fmt::format("{}", dlc_match.back().title_id & 0x7FF);
list += std::format("{}", dlc_match.back().title_id & 0x7FF);
const auto dlc_disabled =
std::find(disabled.begin(), disabled.end(), "DLC") != disabled.end();
+14 -17
View File
@@ -8,6 +8,7 @@
#include <limits>
#include <random>
#include <regex>
#include <utility>
#include <openssl/evp.h>
#include "common/assert.h"
#include "common/fs/path_util.h"
@@ -34,7 +35,7 @@ namespace FileSys {
constexpr size_t VFS_RC_LARGE_COPY_BLOCK = 0x400000;
std::string ContentProviderEntry::DebugInfo() const {
return fmt::format("title_id={:016X}, content_type={:02X}", title_id, static_cast<u8>(type));
return std::format("title_id={:016X}, content_type={:02X}", title_id, static_cast<u8>(type));
}
bool operator<(const ContentProviderEntry& lhs, const ContentProviderEntry& rhs) {
@@ -69,20 +70,16 @@ static std::string GetRelativePathFromNcaID(const std::array<u8, 16>& nca_id, bo
const auto nca_str = Common::HexToString(nca_id, second_hex_upper);
if (!within_two_digit) {
const auto format_str = fmt::runtime(cnmt_suffix ? "{}.cnmt.nca" : "/{}.nca");
return fmt::format(format_str, nca_str);
return cnmt_suffix ? std::format("{}.cnmt.nca", nca_str) : std::format("/{}.nca", nca_str);
}
Core::Crypto::SHA256Hash hash{};
u32 hash_len = 0;
EVP_Digest(nca_id.data(), nca_id.size(), hash.data(), &hash_len, EVP_sha256(), nullptr);
const auto format_str =
fmt::runtime(cnmt_suffix ? "/000000{:02X}/{}.cnmt.nca" : "/000000{:02X}/{}.nca");
LOG_DEBUG(Loader, "Decoded {} bytes, nca id {}", hash_len, nca_str);
return fmt::format(format_str, hash[0], nca_str);
return cnmt_suffix ? std::format("/000000{:02X}/{}.cnmt.nca", hash[0], nca_str) : std::format("/000000{:02X}/{}.nca", hash[0], nca_str);
}
static std::string GetCNMTName(TitleType type, u64 title_id) {
@@ -104,7 +101,7 @@ static std::string GetCNMTName(TitleType type, u64 title_id) {
index -= static_cast<std::size_t>(TitleType::Application) -
static_cast<std::size_t>(TitleType::FirmwarePackageB);
}
return fmt::format("{}_{:016x}.cnmt", TITLE_TYPE_NAMES[index], title_id);
return std::format("{}_{:016x}.cnmt", TITLE_TYPE_NAMES[index], title_id);
}
static std::shared_ptr<NSP> OpenContainerAsNsp(const VirtualFile& file, Loader::FileType type) {
@@ -400,14 +397,14 @@ bool PlaceholderCache::Create(const NcaID& id, u64 size) const {
LOG_DEBUG(Loader, "Decoded {} bytes, nca id {}", hash_len, id);
const auto dirname = fmt::format("000000{:02X}", hash[0]);
const auto dirname = std::format("000000{:02X}", hash[0]);
const auto dir2 = GetOrCreateDirectoryRelative(dir, dirname);
if (dir2 == nullptr)
return false;
const auto file = dir2->CreateFile(fmt::format("{}.nca", Common::HexToString(id, false)));
const auto file = dir2->CreateFile(std::format("{}.nca", Common::HexToString(id, false)));
if (file == nullptr)
return false;
@@ -428,11 +425,11 @@ bool PlaceholderCache::Delete(const NcaID& id) const {
LOG_DEBUG(Loader, "Decoded {} bytes, nca id {}", hash_len, id);
const auto dirname = fmt::format("000000{:02X}", hash[0]);
const auto dirname = std::format("000000{:02X}", hash[0]);
const auto dir2 = GetOrCreateDirectoryRelative(dir, dirname);
const auto res = dir2->DeleteFile(fmt::format("{}.nca", Common::HexToString(id, false)));
const auto res = dir2->DeleteFile(std::format("{}.nca", Common::HexToString(id, false)));
return res;
}
@@ -561,11 +558,11 @@ VirtualFile RegisteredCache::OpenFileOrDirectoryConcat(const VirtualDir& open_di
std::vector<VirtualFile> concat;
// Since the files are a two-digit hex number, max is FF.
for (std::size_t i = 0; i < 0x100; ++i) {
auto next = nca_dir->GetFile(fmt::format("{:02X}", i));
auto next = nca_dir->GetFile(std::format("{:02X}", i));
if (next != nullptr) {
concat.push_back(std::move(next));
} else {
next = nca_dir->GetFile(fmt::format("{:02x}", i));
next = nca_dir->GetFile(std::format("{:02x}", i));
if (next != nullptr) {
concat.push_back(std::move(next));
} else {
@@ -832,11 +829,11 @@ std::vector<ContentProviderEntry> RegisteredCache::ListEntriesFilter(
static std::shared_ptr<NCA> GetNCAFromNSPForID(const NSP& nsp, const NcaID& id) {
const auto id_string = Common::HexToString(id, false);
auto file = nsp.GetFile(fmt::format("{}.nca", id_string));
auto file = nsp.GetFile(std::format("{}.nca", id_string));
if (file == nullptr) {
if (auto ncz_file = nsp.GetFile(fmt::format("{}.ncz", id_string))) {
if (auto ncz_file = nsp.GetFile(std::format("{}.ncz", id_string))) {
file = Core::Crypto::DecompressNCZForInstall(
ncz_file, fmt::format("{}.nca", id_string));
ncz_file, std::format("{}.nca", id_string));
}
}
if (file == nullptr) {
+9 -9
View File
@@ -45,9 +45,9 @@ std::string GetFutureSaveDataPath(SaveDataSpaceId space_id, SaveDataType type, u
// Only detect account/device saves from the future location.
switch (type) {
case SaveDataType::Account:
return fmt::format("{}/account/{}/{:016X}/0", space_id_path, uuid.RawString(), title_id);
return std::format("{}/account/{}/{:016X}/0", space_id_path, uuid.RawString(), title_id);
case SaveDataType::Device:
return fmt::format("{}/device/{:016X}/0", space_id_path, title_id);
return std::format("{}/device/{:016X}/0", space_id_path, title_id);
default:
return "";
}
@@ -127,19 +127,19 @@ std::string SaveDataFactory::GetFullPath(ProgramId program_id, VirtualDir dir,
switch (type) {
case SaveDataType::System:
return fmt::format("{}save/{:016X}/{:016X}{:016X}", out, save_id, user_id[1], user_id[0]);
return std::format("{}save/{:016X}/{:016X}{:016X}", out, save_id, user_id[1], user_id[0]);
case SaveDataType::Account:
case SaveDataType::Device:
return fmt::format("{}save/{:016X}/{:016X}{:016X}/{:016X}", out, 0, user_id[1], user_id[0],
return std::format("{}save/{:016X}/{:016X}{:016X}/{:016X}", out, 0, user_id[1], user_id[0],
title_id);
case SaveDataType::Temporary:
return fmt::format("{}{:016X}/{:016X}{:016X}/{:016X}", out, 0, user_id[1], user_id[0],
return std::format("{}{:016X}/{:016X}{:016X}/{:016X}", out, 0, user_id[1], user_id[0],
title_id);
case SaveDataType::Cache:
return fmt::format("{}save/cache/{:016X}", out, title_id);
return std::format("{}save/cache/{:016X}", out, title_id);
default:
ASSERT_MSG(false, "Unrecognized SaveDataType: {:02X}", static_cast<u8>(type));
return fmt::format("{}save/unknown_{:X}/{:016X}", out, static_cast<u8>(type), title_id);
return std::format("{}save/unknown_{:X}/{:016X}", out, static_cast<u8>(type), title_id);
}
}
@@ -147,9 +147,9 @@ std::string SaveDataFactory::GetUserGameSaveDataRoot(u128 user_id, bool future)
if (future) {
Common::UUID uuid;
std::memcpy(uuid.uuid.data(), user_id.data(), sizeof(Common::UUID));
return fmt::format("/user/save/account/{}", uuid.RawString());
return std::format("/user/save/account/{}", uuid.RawString());
}
return fmt::format("/user/save/{:016X}/{:016X}{:016X}", 0, user_id[1], user_id[0]);
return std::format("/user/save/{:016X}/{:016X}{:016X}", 0, user_id[1], user_id[0]);
}
SaveDataSize SaveDataFactory::ReadSaveDataSize(SaveDataType type, u64 title_id,
+1 -1
View File
@@ -35,7 +35,7 @@ VirtualDir SDMCFactory::GetSDMCModificationLoadRoot(u64 title_id) const {
if (title_id == 0 || (title_id & 0xFFF) == 0x800) {
return nullptr;
}
return GetOrCreateDirectoryRelative(sd_mod_dir, fmt::format("/{:016X}", title_id));
return GetOrCreateDirectoryRelative(sd_mod_dir, std::format("/{:016X}", title_id));
}
VirtualDir SDMCFactory::GetSDMCContentDirectory() const {
+4 -4
View File
@@ -7,7 +7,7 @@
#include <algorithm>
#include <cstring>
#include <fmt/ostream.h>
#include <format>
#include "common/hex_util.h"
#include "common/logging.h"
@@ -245,12 +245,12 @@ void NSP::ReadNCAs(const std::vector<VirtualFile>& files) {
for (const auto& rec : cnmt.GetContentRecords()) {
const auto id_string = Common::HexToString(rec.nca_id, false);
auto next_file = pfs->GetFile(fmt::format("{}.nca", id_string));
auto next_file = pfs->GetFile(std::format("{}.nca", id_string));
if (next_file == nullptr) {
auto ncz_file = pfs->GetFile(fmt::format("{}.ncz", id_string));
auto ncz_file = pfs->GetFile(std::format("{}.ncz", id_string));
if (ncz_file != nullptr) {
next_file = Core::Crypto::DecompressNCZ(ncz_file, fmt::format("{}.nca", id_string));
next_file = Core::Crypto::DecompressNCZ(ncz_file, std::format("{}.nca", id_string));
if (next_file == nullptr) {
LOG_DEBUG(Service_FS, "Skipping solid or unsupported NCZ content {}.ncz", id_string);
continue;
+8 -5
View File
@@ -1,7 +1,10 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <fmt/ranges.h>
#include <format>
#include "common/common_types.h"
#include "core/file_sys/system_archive/ng_word.h"
#include "core/file_sys/vfs/vfs_vector.h"
@@ -27,7 +30,7 @@ VirtualDir NgWord1() {
files.reserve(NgWord1Data::NUMBER_WORD_TXT_FILES);
for (std::size_t i = 0; i < files.size(); ++i) {
files.push_back(MakeArrayFile(NgWord1Data::WORD_TXT, fmt::format("{}.txt", i)));
files.push_back(MakeArrayFile(NgWord1Data::WORD_TXT, std::format("{}.txt", i)));
}
files.push_back(MakeArrayFile(NgWord1Data::WORD_TXT, "common.txt"));
@@ -57,9 +60,9 @@ VirtualDir NgWord2() {
files.reserve(NgWord2Data::NUMBER_AC_NX_FILES * 3);
for (std::size_t i = 0; i < NgWord2Data::NUMBER_AC_NX_FILES; ++i) {
files.push_back(MakeArrayFile(NgWord2Data::AC_NX_DATA, fmt::format("ac_{}_b1_nx", i)));
files.push_back(MakeArrayFile(NgWord2Data::AC_NX_DATA, fmt::format("ac_{}_b2_nx", i)));
files.push_back(MakeArrayFile(NgWord2Data::AC_NX_DATA, fmt::format("ac_{}_not_b_nx", i)));
files.push_back(MakeArrayFile(NgWord2Data::AC_NX_DATA, std::format("ac_{}_b1_nx", i)));
files.push_back(MakeArrayFile(NgWord2Data::AC_NX_DATA, std::format("ac_{}_b2_nx", i)));
files.push_back(MakeArrayFile(NgWord2Data::AC_NX_DATA, std::format("ac_{}_not_b_nx", i)));
}
files.push_back(MakeArrayFile(NgWord2Data::AC_NX_DATA, "ac_common_b1_nx"));
+2 -2
View File
@@ -65,7 +65,7 @@ NAX::NAX(VirtualFile file_)
const std::string two_dir = Common::ToUpper(std::string{match[1]});
const std::string nca_id = Common::ToLower(std::string{match[2]});
status = Parse(fmt::format("/registered/{}/{}.nca", two_dir, nca_id));
status = Parse(std::format("/registered/{}/{}.nca", two_dir, nca_id));
}
NAX::NAX(VirtualFile file_, std::array<u8, 0x10> nca_id)
@@ -78,7 +78,7 @@ NAX::NAX(VirtualFile file_, std::array<u8, 0x10> nca_id)
LOG_DEBUG(Loader, "Decoded {} bytes, nca id {}", hash_len, nca_id);
status = Parse(fmt::format("/registered/000000{:02X}/{}.nca", hash[0],
status = Parse(std::format("/registered/000000{:02X}/{}.nca", hash[0],
Common::HexToString(nca_id, false)));
}
+1
View File
@@ -4,6 +4,7 @@
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <utility>
#include "common/logging.h"
#include "core/frontend/applets/error.h"
+1 -1
View File
@@ -7,7 +7,7 @@
#pragma once
#include <string_view>
#include <fmt/format.h>
#include <format>
#include "common/common_types.h"
// This file contains yuzu's HLE API version constants.
+2 -2
View File
@@ -46,7 +46,7 @@ struct KPageProperties {
bool uncached;
DisableMergeAttribute disable_merge_attributes;
};
static_assert(std::is_trivial_v<KPageProperties>);
static_assert(std::is_trivially_default_constructible_v<KPageProperties> && std::is_trivially_copyable_v<KPageProperties>);
static_assert(sizeof(KPageProperties) == sizeof(u32));
class KResourceLimit;
@@ -121,7 +121,7 @@ protected:
Node* m_next;
std::array<u8, PageSize - sizeof(Node*)> m_buffer;
};
static_assert(std::is_trivial_v<Node>);
static_assert(std::is_trivially_default_constructible_v<Node> && std::is_trivially_copyable_v<Node>);
private:
Node* m_root{};
+1 -1
View File
@@ -34,7 +34,7 @@ static void SetArg64(std::span<uint64_t, 8> args, int n, uint64_t result) {
// Like bit_cast, but handles the case when the source and dest
// are differently-sized.
template <typename To, typename From>
requires(std::is_trivial_v<To> && std::is_trivially_copyable_v<From>)
requires(std::is_trivially_default_constructible_v<To> && std::is_trivially_copyable_v<To> && std::is_trivially_copyable_v<From>)
static To Convert(const From& from) {
To to{};
if constexpr (sizeof(To) >= sizeof(From))
+1 -1
View File
@@ -41,7 +41,7 @@ void Break(Core::System& system, BreakReason reason, u64 info1, u64 info2) {
memory.ReadBlock(addr, debug_buffer.data(), sz);
std::string hexdump;
for (std::size_t i = 0; i < debug_buffer.size(); i++) {
hexdump += fmt::format("{:02X} ", debug_buffer[i]);
hexdump += std::format("{:02X} ", debug_buffer[i]);
if ((i + 1) % 32 == 0) {
hexdump += '\n';
}
+1 -1
View File
@@ -258,7 +258,7 @@ union Result {
return GetInnerValue() == result.GetInnerValue();
}
};
static_assert(std::is_trivial_v<Result>);
static_assert(std::is_trivially_default_constructible_v<Result> && std::is_trivially_copyable_v<Result>);
[[nodiscard]] constexpr bool operator==(const Result& a, const Result& b) {
return a.raw == b.raw;
+1 -1
View File
@@ -36,7 +36,7 @@ constexpr std::size_t THUMBNAIL_SIZE = 0x24000;
static std::filesystem::path GetImagePath(const Common::UUID& uuid) {
return Common::FS::GetEdenPath(Common::FS::EdenPath::NANDDir) /
fmt::format("system/save/8000000000000010/su/avators/{}.jpg", uuid.FormattedString());
std::format("system/save/8000000000000010/su/avators/{}.jpg", uuid.FormattedString());
}
static void JPGToMemory(void* context, void* data, int len) {
+2 -2
View File
@@ -10,7 +10,7 @@
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/string/find.hpp>
#include <fmt/ranges.h>
#include <format>
#include "common/fs/file.h"
#include "common/fs/fs.h"
@@ -507,7 +507,7 @@ std::vector<std::string> ProfileManager::FindExistingProfileStrings()
for (const UUID &uuid : uuids) {
auto user_id = uuid.AsU128();
uuid_strings.emplace_back(fmt::format("{:016X}{:016X}", user_id[1], user_id[0]));
uuid_strings.emplace_back(std::format("{:016X}{:016X}", user_id[1], user_id[0]));
}
return uuid_strings;
@@ -6,6 +6,7 @@
#include <array>
#include <cstring>
#include <utility>
#include "common/assert.h"
#include "common/logging.h"
#include "common/string_util.h"
@@ -198,7 +199,7 @@ void Error::Execute() {
case ErrorAppletMode::ShowErrorPctl:
case ErrorAppletMode::ShowErrorRecord:
reporter.SaveErrorReport(title_id, error_code,
fmt::format("{:016X}", args->error_record.posix_time));
std::format("{:016X}", args->error_record.posix_time));
frontend.ShowErrorWithTimestamp(
error_code, std::chrono::seconds{args->error_record.posix_time}, callback);
break;
Loaded 100 of 309 files, more files were not shown because too many files have changed in this diff. Show more