mirror of
https://github.com/PabloMK7/citra
synced 2024-11-15 05:08:23 +00:00
Merge pull request #4147 from FearlessTobi/port-424
Port #424 from yuzu: "string_util: Remove StringFromFormat() and related functions"
This commit is contained in:
commit
dd2a0f2387
16 changed files with 52 additions and 146 deletions
|
@ -7,11 +7,11 @@
|
|||
#include <string>
|
||||
#define SDL_MAIN_HANDLED
|
||||
#include <SDL.h>
|
||||
#include <fmt/format.h>
|
||||
#include <glad/glad.h>
|
||||
#include "citra/emu_window/emu_window_sdl2.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/scm_rev.h"
|
||||
#include "common/string_util.h"
|
||||
#include "core/3ds.h"
|
||||
#include "core/settings.h"
|
||||
#include "input_common/keyboard.h"
|
||||
|
@ -100,8 +100,8 @@ EmuWindow_SDL2::EmuWindow_SDL2(bool fullscreen) {
|
|||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0);
|
||||
|
||||
std::string window_title = Common::StringFromFormat(
|
||||
"Citra %s| %s-%s ", Common::g_build_fullname, Common::g_scm_branch, Common::g_scm_desc);
|
||||
std::string window_title = fmt::format("Citra {} | {}-{}", Common::g_build_fullname,
|
||||
Common::g_scm_branch, Common::g_scm_desc);
|
||||
render_window =
|
||||
SDL_CreateWindow(window_title.c_str(),
|
||||
SDL_WINDOWPOS_UNDEFINED, // x position
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
#include <QKeyEvent>
|
||||
#include <QScreen>
|
||||
#include <QWindow>
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "citra_qt/bootmanager.h"
|
||||
#include "common/microprofile.h"
|
||||
#include "common/scm_rev.h"
|
||||
#include "common/string_util.h"
|
||||
#include "core/3ds.h"
|
||||
#include "core/core.h"
|
||||
#include "core/settings.h"
|
||||
|
@ -103,8 +103,8 @@ private:
|
|||
GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread)
|
||||
: QWidget(parent), child(nullptr), emu_thread(emu_thread) {
|
||||
|
||||
std::string window_title = Common::StringFromFormat("Citra %s| %s-%s", Common::g_build_name,
|
||||
Common::g_scm_branch, Common::g_scm_desc);
|
||||
std::string window_title = fmt::format("Citra {} | {}-{}", Common::g_build_name,
|
||||
Common::g_scm_branch, Common::g_scm_desc);
|
||||
setWindowTitle(QString::fromStdString(window_title));
|
||||
|
||||
InputCommon::Init();
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
#include <QThreadPool>
|
||||
#include <QToolButton>
|
||||
#include <QTreeView>
|
||||
#include <fmt/format.h>
|
||||
#include "citra_qt/game_list.h"
|
||||
#include "citra_qt/game_list_p.h"
|
||||
#include "citra_qt/main.h"
|
||||
#include "citra_qt/ui_settings.h"
|
||||
#include "common/common_paths.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/string_util.h"
|
||||
#include "core/hle/service/fs/archive.h"
|
||||
#include "core/loader/loader.h"
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <QtConcurrent/QtConcurrentRun>
|
||||
#include <QtGui>
|
||||
#include <QtWidgets>
|
||||
#include <fmt/format.h>
|
||||
#include "citra_qt/aboutdialog.h"
|
||||
#include "citra_qt/applets/swkbd.h"
|
||||
#include "citra_qt/bootmanager.h"
|
||||
|
@ -49,7 +50,6 @@
|
|||
#include "common/microprofile.h"
|
||||
#include "common/scm_rev.h"
|
||||
#include "common/scope_exit.h"
|
||||
#include "common/string_util.h"
|
||||
#include "core/core.h"
|
||||
#include "core/file_sys/archive_source_sd_savedata.h"
|
||||
#include "core/frontend/applets/default_applets.h"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include "common/logging/log.h"
|
||||
#include "common/memory_util.h"
|
||||
|
||||
|
@ -167,8 +168,7 @@ std::string MemUsage() {
|
|||
return "MemUsage Error";
|
||||
|
||||
if (GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc)))
|
||||
Ret = Common::StringFromFormat(
|
||||
"%s K", Common::ThousandSeparate(pmc.WorkingSetSize / 1024, 7).c_str());
|
||||
Ret = fmt::format("{} K", Common::ThousandSeparate(pmc.WorkingSetSize / 1024, 7));
|
||||
|
||||
CloseHandle(hProcess);
|
||||
return Ret;
|
||||
|
|
|
@ -36,76 +36,6 @@ std::string ToUpper(std::string str) {
|
|||
return str;
|
||||
}
|
||||
|
||||
bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args) {
|
||||
int writtenCount;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// You would think *printf are simple, right? Iterate on each character,
|
||||
// if it's a format specifier handle it properly, etc.
|
||||
//
|
||||
// Nooooo. Not according to the C standard.
|
||||
//
|
||||
// According to the C99 standard (7.19.6.1 "The fprintf function")
|
||||
// The format shall be a multibyte character sequence
|
||||
//
|
||||
// Because some character encodings might have '%' signs in the middle of
|
||||
// a multibyte sequence (SJIS for example only specifies that the first
|
||||
// byte of a 2 byte sequence is "high", the second byte can be anything),
|
||||
// printf functions have to decode the multibyte sequences and try their
|
||||
// best to not screw up.
|
||||
//
|
||||
// Unfortunately, on Windows, the locale for most languages is not UTF-8
|
||||
// as we would need. Notably, for zh_TW, Windows chooses EUC-CN as the
|
||||
// locale, and completely fails when trying to decode UTF-8 as EUC-CN.
|
||||
//
|
||||
// On the other hand, the fix is simple: because we use UTF-8, no such
|
||||
// multibyte handling is required as we can simply assume that no '%' char
|
||||
// will be present in the middle of a multibyte sequence.
|
||||
//
|
||||
// This is why we lookup an ANSI (cp1252) locale here and use _vsnprintf_l.
|
||||
static locale_t c_locale = nullptr;
|
||||
if (!c_locale)
|
||||
c_locale = _create_locale(LC_ALL, ".1252");
|
||||
writtenCount = _vsnprintf_l(out, outsize, format, c_locale, args);
|
||||
#else
|
||||
writtenCount = vsnprintf(out, outsize, format, args);
|
||||
#endif
|
||||
|
||||
if (writtenCount > 0 && writtenCount < outsize) {
|
||||
out[writtenCount] = '\0';
|
||||
return true;
|
||||
} else {
|
||||
out[outsize - 1] = '\0';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
std::string StringFromFormat(const char* format, ...) {
|
||||
va_list args;
|
||||
char* buf = nullptr;
|
||||
#ifdef _WIN32
|
||||
int required = 0;
|
||||
|
||||
va_start(args, format);
|
||||
required = _vscprintf(format, args);
|
||||
buf = new char[required + 1];
|
||||
CharArrayFromFormatV(buf, required + 1, format, args);
|
||||
va_end(args);
|
||||
|
||||
std::string temp = buf;
|
||||
delete[] buf;
|
||||
#else
|
||||
va_start(args, format);
|
||||
if (vasprintf(&buf, format, args) < 0)
|
||||
LOG_ERROR(Common, "Unable to allocate memory for string");
|
||||
va_end(args);
|
||||
|
||||
std::string temp = buf;
|
||||
free(buf);
|
||||
#endif
|
||||
return temp;
|
||||
}
|
||||
|
||||
// For Debugging. Read out an u8 array.
|
||||
std::string ArrayToString(const u8* data, size_t size, int line_len, bool spaces) {
|
||||
std::ostringstream oss;
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstddef>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
@ -20,19 +19,6 @@ std::string ToLower(std::string str);
|
|||
/// Make a string uppercase
|
||||
std::string ToUpper(std::string str);
|
||||
|
||||
std::string StringFromFormat(const char* format, ...);
|
||||
// Cheap!
|
||||
bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args);
|
||||
|
||||
template <size_t Count>
|
||||
inline void CharArrayFromFormat(char (&out)[Count], const char* format, ...) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
CharArrayFromFormatV(out, Count, format, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
// Good
|
||||
std::string ArrayToString(const u8* data, size_t size, int line_len = 20, bool spaces = true);
|
||||
|
||||
std::string StripSpaces(const std::string& s);
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include <ctime>
|
||||
#include <fmt/format.h>
|
||||
#include "common/common_types.h"
|
||||
#include "common/string_util.h"
|
||||
#include "common/timer.h"
|
||||
|
||||
namespace Common {
|
||||
|
@ -91,9 +91,8 @@ std::string Timer::GetTimeElapsedFormatted() const {
|
|||
// Hours
|
||||
std::chrono::hours Hours = std::chrono::duration_cast<std::chrono::hours>(Milliseconds);
|
||||
|
||||
std::string TmpStr =
|
||||
StringFromFormat("%02d:%02d:%02d:%03d", Hours.count(), Minutes.count() % 60,
|
||||
Seconds.count() % 60, Milliseconds.count() % 1000);
|
||||
std::string TmpStr = fmt::format("{:02}:{:02}:{:02}:{:03}", Hours.count(), Minutes.count() % 60,
|
||||
Seconds.count() % 60, Milliseconds.count() % 1000);
|
||||
return TmpStr;
|
||||
}
|
||||
|
||||
|
@ -135,7 +134,7 @@ std::string Timer::GetTimeFormatted() {
|
|||
strftime(tmp, 6, "%M:%S", gmTime);
|
||||
|
||||
u64 milliseconds = static_cast<u64>(GetTimeMs().count()) % 1000;
|
||||
return StringFromFormat("%s:%03d", tmp, milliseconds);
|
||||
return fmt::format("{}:{:03}", tmp, milliseconds);
|
||||
}
|
||||
|
||||
// Returns a timestamp with decimals for precise time comparisons
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <fmt/format.h>
|
||||
#include "common/common_types.h"
|
||||
#include "common/file_util.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/string_util.h"
|
||||
#include "core/file_sys/archive_extsavedata.h"
|
||||
#include "core/file_sys/disk_archive.h"
|
||||
#include "core/file_sys/errors.h"
|
||||
|
@ -165,16 +165,14 @@ std::string GetExtSaveDataPath(const std::string& mount_point, const Path& path)
|
|||
ExtSaveDataArchivePath path_data;
|
||||
std::memcpy(&path_data, vec_data.data(), sizeof(path_data));
|
||||
|
||||
return Common::StringFromFormat("%s%08X/%08X/", mount_point.c_str(), path_data.save_high,
|
||||
path_data.save_low);
|
||||
return fmt::format("{}{:08X}/{:08X}/", mount_point, path_data.save_high, path_data.save_low);
|
||||
}
|
||||
|
||||
std::string GetExtDataContainerPath(const std::string& mount_point, bool shared) {
|
||||
if (shared)
|
||||
return Common::StringFromFormat("%sdata/%s/extdata/", mount_point.c_str(), SYSTEM_ID);
|
||||
return fmt::format("{}data/{}/extdata/", mount_point, SYSTEM_ID);
|
||||
|
||||
return Common::StringFromFormat("%sNintendo 3DS/%s/%s/extdata/", mount_point.c_str(), SYSTEM_ID,
|
||||
SDCARD_ID);
|
||||
return fmt::format("{}Nintendo 3DS/{}/{}/extdata/", mount_point, SYSTEM_ID, SDCARD_ID);
|
||||
}
|
||||
|
||||
Path ConstructExtDataBinaryPath(u32 media_type, u32 high, u32 low) {
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include "common/file_util.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/string_util.h"
|
||||
#include "core/file_sys/archive_source_sd_savedata.h"
|
||||
#include "core/file_sys/errors.h"
|
||||
#include "core/file_sys/savedata_archive.h"
|
||||
|
@ -18,22 +18,19 @@ namespace FileSys {
|
|||
namespace {
|
||||
|
||||
std::string GetSaveDataContainerPath(const std::string& sdmc_directory) {
|
||||
return Common::StringFromFormat("%sNintendo 3DS/%s/%s/title/", sdmc_directory.c_str(),
|
||||
SYSTEM_ID, SDCARD_ID);
|
||||
return fmt::format("{}Nintendo 3DS/{}/{}/title/", sdmc_directory, SYSTEM_ID, SDCARD_ID);
|
||||
}
|
||||
|
||||
std::string GetSaveDataPath(const std::string& mount_location, u64 program_id) {
|
||||
u32 high = static_cast<u32>(program_id >> 32);
|
||||
u32 low = static_cast<u32>(program_id & 0xFFFFFFFF);
|
||||
return Common::StringFromFormat("%s%08x/%08x/data/00000001/", mount_location.c_str(), high,
|
||||
low);
|
||||
return fmt::format("{}{:08x}/{:08x}/data/00000001/", mount_location, high, low);
|
||||
}
|
||||
|
||||
std::string GetSaveDataMetadataPath(const std::string& mount_location, u64 program_id) {
|
||||
u32 high = static_cast<u32>(program_id >> 32);
|
||||
u32 low = static_cast<u32>(program_id & 0xFFFFFFFF);
|
||||
return Common::StringFromFormat("%s%08x/%08x/data/00000001.metadata", mount_location.c_str(),
|
||||
high, low);
|
||||
return fmt::format("{}{:08x}/{:08x}/data/00000001.metadata", mount_location, high, low);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <fmt/format.h>
|
||||
#include "common/common_types.h"
|
||||
#include "common/file_util.h"
|
||||
#include "common/string_util.h"
|
||||
#include "core/file_sys/archive_systemsavedata.h"
|
||||
#include "core/file_sys/errors.h"
|
||||
#include "core/file_sys/savedata_archive.h"
|
||||
|
@ -25,11 +25,11 @@ std::string GetSystemSaveDataPath(const std::string& mount_point, const Path& pa
|
|||
u32 save_high;
|
||||
std::memcpy(&save_low, &vec_data[4], sizeof(u32));
|
||||
std::memcpy(&save_high, &vec_data[0], sizeof(u32));
|
||||
return Common::StringFromFormat("%s%08X/%08X/", mount_point.c_str(), save_low, save_high);
|
||||
return fmt::format("{}{:08X}/{:08X}/", mount_point, save_low, save_high);
|
||||
}
|
||||
|
||||
std::string GetSystemSaveDataContainerPath(const std::string& mount_point) {
|
||||
return Common::StringFromFormat("%sdata/%s/sysdata/", mount_point.c_str(), SYSTEM_ID);
|
||||
return fmt::format("{}data/{}/sysdata/", mount_point, SYSTEM_ID);
|
||||
}
|
||||
|
||||
Path ConstructSystemSaveDataBinaryPath(u32 high, u32 low) {
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <map>
|
||||
#include <numeric>
|
||||
#include <fcntl.h>
|
||||
#include <fmt/format.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
|
@ -31,7 +32,6 @@
|
|||
#endif
|
||||
|
||||
#include "common/logging/log.h"
|
||||
#include "common/string_util.h"
|
||||
#include "core/arm/arm_interface.h"
|
||||
#include "core/core.h"
|
||||
#include "core/gdbstub/gdbstub.h"
|
||||
|
@ -610,16 +610,17 @@ static void SendSignal(Kernel::Thread* thread, u32 signal, bool full = true) {
|
|||
|
||||
std::string buffer;
|
||||
if (full) {
|
||||
buffer = Common::StringFromFormat("T%02x%02x:%08x;%02x:%08x;%02x:%08x", latest_signal,
|
||||
PC_REGISTER, htonl(Core::CPU().GetPC()), SP_REGISTER,
|
||||
htonl(Core::CPU().GetReg(SP_REGISTER)), LR_REGISTER,
|
||||
htonl(Core::CPU().GetReg(LR_REGISTER)));
|
||||
|
||||
buffer = fmt::format("T{:02x}{:02x}:{:08x};{:02x}:{:08x};{:02x}:{:08x}", latest_signal,
|
||||
PC_REGISTER, htonl(Core::CPU().GetPC()), SP_REGISTER,
|
||||
htonl(Core::CPU().GetReg(SP_REGISTER)), LR_REGISTER,
|
||||
htonl(Core::CPU().GetReg(LR_REGISTER)));
|
||||
} else {
|
||||
buffer = Common::StringFromFormat("T%02x", latest_signal);
|
||||
buffer = fmt::format("T{:02x}", latest_signal);
|
||||
}
|
||||
|
||||
if (thread) {
|
||||
buffer += Common::StringFromFormat(";thread:%x;", thread->GetThreadId());
|
||||
buffer += fmt::format(";thread:{:x};", thread->GetThreadId());
|
||||
}
|
||||
|
||||
LOG_DEBUG(Debug_GDBStub, "Response: {}", buffer);
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
#include <algorithm>
|
||||
#include <cinttypes>
|
||||
#include <map>
|
||||
#include <fmt/format.h>
|
||||
#include "common/logging/log.h"
|
||||
#include "common/microprofile.h"
|
||||
#include "common/scope_exit.h"
|
||||
#include "common/string_util.h"
|
||||
#include "core/arm/arm_interface.h"
|
||||
#include "core/core_timing.h"
|
||||
#include "core/hle/function_wrappers.h"
|
||||
|
@ -723,7 +723,7 @@ static ResultCode GetResourceLimitLimitValues(VAddr values, Handle resource_limi
|
|||
/// Creates a new thread
|
||||
static ResultCode CreateThread(Handle* out_handle, u32 priority, u32 entry_point, u32 arg,
|
||||
u32 stack_top, s32 processor_id) {
|
||||
std::string name = Common::StringFromFormat("unknown-%08" PRIX32, entry_point);
|
||||
std::string name = fmt::format("unknown-{:08X}", entry_point);
|
||||
|
||||
if (priority > THREADPRIO_LOWEST) {
|
||||
return ERR_OUT_OF_RANGE;
|
||||
|
@ -825,7 +825,7 @@ static ResultCode SetThreadPriority(Handle handle, u32 priority) {
|
|||
/// Create a mutex
|
||||
static ResultCode CreateMutex(Handle* out_handle, u32 initial_locked) {
|
||||
SharedPtr<Mutex> mutex = Mutex::Create(initial_locked != 0);
|
||||
mutex->name = Common::StringFromFormat("mutex-%08x", Core::CPU().GetReg(14));
|
||||
mutex->name = fmt::format("mutex-{:08x}", Core::CPU().GetReg(14));
|
||||
CASCADE_RESULT(*out_handle, g_handle_table.Create(std::move(mutex)));
|
||||
|
||||
LOG_TRACE(Kernel_SVC, "called initial_locked={} : created handle=0x{:08X}",
|
||||
|
@ -888,7 +888,7 @@ static ResultCode GetThreadId(u32* thread_id, Handle handle) {
|
|||
/// Creates a semaphore
|
||||
static ResultCode CreateSemaphore(Handle* out_handle, s32 initial_count, s32 max_count) {
|
||||
CASCADE_RESULT(SharedPtr<Semaphore> semaphore, Semaphore::Create(initial_count, max_count));
|
||||
semaphore->name = Common::StringFromFormat("semaphore-%08x", Core::CPU().GetReg(14));
|
||||
semaphore->name = fmt::format("semaphore-{:08x}", Core::CPU().GetReg(14));
|
||||
CASCADE_RESULT(*out_handle, g_handle_table.Create(std::move(semaphore)));
|
||||
|
||||
LOG_TRACE(Kernel_SVC, "called initial_count={}, max_count={}, created handle=0x{:08X}",
|
||||
|
@ -938,9 +938,8 @@ static ResultCode QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, u32
|
|||
|
||||
/// Create an event
|
||||
static ResultCode CreateEvent(Handle* out_handle, u32 reset_type) {
|
||||
SharedPtr<Event> evt =
|
||||
Event::Create(static_cast<ResetType>(reset_type),
|
||||
Common::StringFromFormat("event-%08x", Core::CPU().GetReg(14)));
|
||||
SharedPtr<Event> evt = Event::Create(static_cast<ResetType>(reset_type),
|
||||
fmt::format("event-{:08x}", Core::CPU().GetReg(14)));
|
||||
CASCADE_RESULT(*out_handle, g_handle_table.Create(std::move(evt)));
|
||||
|
||||
LOG_TRACE(Kernel_SVC, "called reset_type=0x{:08X} : created handle=0x{:08X}", reset_type,
|
||||
|
@ -982,9 +981,8 @@ static ResultCode ClearEvent(Handle handle) {
|
|||
|
||||
/// Creates a timer
|
||||
static ResultCode CreateTimer(Handle* out_handle, u32 reset_type) {
|
||||
SharedPtr<Timer> timer =
|
||||
Timer::Create(static_cast<ResetType>(reset_type),
|
||||
Common::StringFromFormat("timer-%08x", Core::CPU().GetReg(14)));
|
||||
SharedPtr<Timer> timer = Timer::Create(static_cast<ResetType>(reset_type),
|
||||
fmt ::format("timer-{:08x}", Core::CPU().GetReg(14)));
|
||||
CASCADE_RESULT(*out_handle, g_handle_table.Create(std::move(timer)));
|
||||
|
||||
LOG_TRACE(Kernel_SVC, "called reset_type=0x{:08X} : created handle=0x{:08X}", reset_type,
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <cinttypes>
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#include <fmt/format.h>
|
||||
#include "common/file_util.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/string_util.h"
|
||||
|
@ -380,7 +381,7 @@ std::string GetTitleMetadataPath(Service::FS::MediaType media_type, u64 tid, boo
|
|||
if (base_id == update_id)
|
||||
update_id++;
|
||||
|
||||
return content_path + Common::StringFromFormat("%08x.tmd", (update ? update_id : base_id));
|
||||
return content_path + fmt::format("{:08x}.tmd", (update ? update_id : base_id));
|
||||
}
|
||||
|
||||
std::string GetTitleContentPath(Service::FS::MediaType media_type, u64 tid, u16 index,
|
||||
|
@ -417,7 +418,7 @@ std::string GetTitleContentPath(Service::FS::MediaType media_type, u64 tid, u16
|
|||
}
|
||||
}
|
||||
|
||||
return Common::StringFromFormat("%s%08x.app", content_path.c_str(), content_id);
|
||||
return fmt::format("{}{:08x}.app", content_path, content_id);
|
||||
}
|
||||
|
||||
std::string GetTitlePath(Service::FS::MediaType media_type, u64 tid) {
|
||||
|
@ -425,8 +426,7 @@ std::string GetTitlePath(Service::FS::MediaType media_type, u64 tid) {
|
|||
u32 low = static_cast<u32>(tid & 0xFFFFFFFF);
|
||||
|
||||
if (media_type == Service::FS::MediaType::NAND || media_type == Service::FS::MediaType::SDMC)
|
||||
return Common::StringFromFormat("%s%08x/%08x/", GetMediaTitlePath(media_type).c_str(), high,
|
||||
low);
|
||||
return fmt::format("{}{:08x}/{:08x}/", GetMediaTitlePath(media_type), high, low);
|
||||
|
||||
if (media_type == Service::FS::MediaType::GameCard) {
|
||||
// TODO(shinyquagsire23): get current app path if TID matches?
|
||||
|
@ -439,13 +439,11 @@ std::string GetTitlePath(Service::FS::MediaType media_type, u64 tid) {
|
|||
|
||||
std::string GetMediaTitlePath(Service::FS::MediaType media_type) {
|
||||
if (media_type == Service::FS::MediaType::NAND)
|
||||
return Common::StringFromFormat("%s%s/title/", FileUtil::GetUserPath(D_NAND_IDX).c_str(),
|
||||
SYSTEM_ID);
|
||||
return fmt::format("{}{}/title/", FileUtil::GetUserPath(D_NAND_IDX), SYSTEM_ID);
|
||||
|
||||
if (media_type == Service::FS::MediaType::SDMC)
|
||||
return Common::StringFromFormat("%sNintendo 3DS/%s/%s/title/",
|
||||
FileUtil::GetUserPath(D_SDMC_IDX).c_str(), SYSTEM_ID,
|
||||
SDCARD_ID);
|
||||
return fmt::format("{}Nintendo 3DS/{}/{}/title/", FileUtil::GetUserPath(D_SDMC_IDX),
|
||||
SYSTEM_ID, SDCARD_ID);
|
||||
|
||||
if (media_type == Service::FS::MediaType::GameCard) {
|
||||
// TODO(shinyquagsire23): get current app parent folder if TID matches?
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include <fmt/format.h>
|
||||
#include "common/assert.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/string_util.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/ipc.h"
|
||||
#include "core/hle/kernel/client_port.h"
|
||||
|
@ -125,10 +124,9 @@ static std::string MakeFunctionString(const char* name, const char* port_name,
|
|||
// Number of params == bits 0-5 + bits 6-11
|
||||
int num_params = (cmd_buff[0] & 0x3F) + ((cmd_buff[0] >> 6) & 0x3F);
|
||||
|
||||
std::string function_string =
|
||||
Common::StringFromFormat("function '%s': port=%s", name, port_name);
|
||||
std::string function_string = fmt::format("function '{}': port={}", name, port_name);
|
||||
for (int i = 1; i <= num_params; ++i) {
|
||||
function_string += Common::StringFromFormat(", cmd_buff[%i]=0x%X", i, cmd_buff[i]);
|
||||
function_string += fmt::format(", cmd_buff[{}]={:#X}", i, cmd_buff[i]);
|
||||
}
|
||||
return function_string;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <cstring>
|
||||
#include <locale>
|
||||
#include <memory>
|
||||
#include <fmt/format.h>
|
||||
#include "common/logging/log.h"
|
||||
#include "common/string_util.h"
|
||||
#include "common/swap.h"
|
||||
|
@ -156,7 +157,7 @@ ResultStatus AppLoader_NCCH::Load(Kernel::SharedPtr<Kernel::Process>& process) {
|
|||
return result;
|
||||
|
||||
ReadProgramId(ncch_program_id);
|
||||
std::string program_id{Common::StringFromFormat("%016" PRIX64, ncch_program_id)};
|
||||
std::string program_id{fmt::format("{:016X}", ncch_program_id)};
|
||||
|
||||
LOG_INFO(Loader, "Program ID: {}", program_id);
|
||||
|
||||
|
|
Loading…
Reference in a new issue