1
0
Fork 0

Fixup! string_util: Remove StringFromFormat() and related functions

This commit is contained in:
fearlessTobi 2018-08-28 20:42:10 +02:00
parent 3284bef360
commit cb3ef488c7
5 changed files with 13 additions and 14 deletions

View File

@ -166,15 +166,14 @@ std::string GetExtSaveDataPath(const std::string& mount_point, const Path& path)
ExtSaveDataArchivePath path_data; ExtSaveDataArchivePath path_data;
std::memcpy(&path_data, vec_data.data(), sizeof(path_data)); std::memcpy(&path_data, vec_data.data(), sizeof(path_data));
return fmt::format("{}{:08x}/{:08x}/", mount_point.c_str(), path_data.save_high, return fmt::format("{}{:08X}/{:08X}/", mount_point, path_data.save_high, path_data.save_low);
path_data.save_low);
} }
std::string GetExtDataContainerPath(const std::string& mount_point, bool shared) { std::string GetExtDataContainerPath(const std::string& mount_point, bool shared) {
if (shared) if (shared)
return fmt::format("{}data/{}/extdata/", mount_point.c_str(), SYSTEM_ID); return fmt::format("{}data/{}/extdata/", mount_point, SYSTEM_ID);
return fmt::format("{}Nintendo 3DS/{}/{}/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) { Path ConstructExtDataBinaryPath(u32 media_type, u32 high, u32 low) {

View File

@ -19,19 +19,19 @@ namespace FileSys {
namespace { namespace {
std::string GetSaveDataContainerPath(const std::string& sdmc_directory) { std::string GetSaveDataContainerPath(const std::string& sdmc_directory) {
return fmt::format("{}Nintendo 3DS/{}/{}/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) { std::string GetSaveDataPath(const std::string& mount_location, u64 program_id) {
u32 high = static_cast<u32>(program_id >> 32); u32 high = static_cast<u32>(program_id >> 32);
u32 low = static_cast<u32>(program_id & 0xFFFFFFFF); u32 low = static_cast<u32>(program_id & 0xFFFFFFFF);
return fmt::format("{}{: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) { std::string GetSaveDataMetadataPath(const std::string& mount_location, u64 program_id) {
u32 high = static_cast<u32>(program_id >> 32); u32 high = static_cast<u32>(program_id >> 32);
u32 low = static_cast<u32>(program_id & 0xFFFFFFFF); u32 low = static_cast<u32>(program_id & 0xFFFFFFFF);
return fmt::format("{}{:08x}/{:08x}/data/00000001.metadata", mount_location.c_str(), high, low); return fmt::format("{}{:08x}/{:08x}/data/00000001.metadata", mount_location, high, low);
} }
} // namespace } // namespace

View File

@ -26,11 +26,11 @@ std::string GetSystemSaveDataPath(const std::string& mount_point, const Path& pa
u32 save_high; u32 save_high;
std::memcpy(&save_low, &vec_data[4], sizeof(u32)); std::memcpy(&save_low, &vec_data[4], sizeof(u32));
std::memcpy(&save_high, &vec_data[0], sizeof(u32)); std::memcpy(&save_high, &vec_data[0], sizeof(u32));
return fmt::format("{}{: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) { std::string GetSystemSaveDataContainerPath(const std::string& mount_point) {
return fmt::format("{}data/{}/sysdata/", mount_point.c_str(), SYSTEM_ID); return fmt::format("{}data/{}/sysdata/", mount_point, SYSTEM_ID);
} }
Path ConstructSystemSaveDataBinaryPath(u32 high, u32 low) { Path ConstructSystemSaveDataBinaryPath(u32 high, u32 low) {

View File

@ -724,7 +724,7 @@ static ResultCode GetResourceLimitLimitValues(VAddr values, Handle resource_limi
/// Creates a new thread /// Creates a new thread
static ResultCode CreateThread(Handle* out_handle, u32 priority, u32 entry_point, u32 arg, static ResultCode CreateThread(Handle* out_handle, u32 priority, u32 entry_point, u32 arg,
u32 stack_top, s32 processor_id) { u32 stack_top, s32 processor_id) {
std::string name = fmt::format("unknown-{:08X}" PRIX32, entry_point); std::string name = fmt::format("unknown-{:08X}", entry_point);
if (priority > THREADPRIO_LOWEST) { if (priority > THREADPRIO_LOWEST) {
return ERR_OUT_OF_RANGE; return ERR_OUT_OF_RANGE;

View File

@ -418,7 +418,7 @@ std::string GetTitleContentPath(Service::FS::MediaType media_type, u64 tid, u16
} }
} }
return fmt::format("{}{: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) { std::string GetTitlePath(Service::FS::MediaType media_type, u64 tid) {
@ -426,7 +426,7 @@ std::string GetTitlePath(Service::FS::MediaType media_type, u64 tid) {
u32 low = static_cast<u32>(tid & 0xFFFFFFFF); u32 low = static_cast<u32>(tid & 0xFFFFFFFF);
if (media_type == Service::FS::MediaType::NAND || media_type == Service::FS::MediaType::SDMC) if (media_type == Service::FS::MediaType::NAND || media_type == Service::FS::MediaType::SDMC)
return fmt::format("{}{: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) { if (media_type == Service::FS::MediaType::GameCard) {
// TODO(shinyquagsire23): get current app path if TID matches? // TODO(shinyquagsire23): get current app path if TID matches?
@ -439,10 +439,10 @@ std::string GetTitlePath(Service::FS::MediaType media_type, u64 tid) {
std::string GetMediaTitlePath(Service::FS::MediaType media_type) { std::string GetMediaTitlePath(Service::FS::MediaType media_type) {
if (media_type == Service::FS::MediaType::NAND) if (media_type == Service::FS::MediaType::NAND)
return fmt::format("{}{}/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) if (media_type == Service::FS::MediaType::SDMC)
return fmt::format("{}Nintendo 3DS/{}/{}/title/", FileUtil::GetUserPath(D_SDMC_IDX).c_str(), return fmt::format("{}Nintendo 3DS/{}/{}/title/", FileUtil::GetUserPath(D_SDMC_IDX),
SYSTEM_ID, SDCARD_ID); SYSTEM_ID, SDCARD_ID);
if (media_type == Service::FS::MediaType::GameCard) { if (media_type == Service::FS::MediaType::GameCard) {