user-manager: replacing fmt::format with string concat.

(cherry picked from commit 63379afc7a402edb2159912318281febc3e7438a)
This commit is contained in:
mpm11011 2018-06-13 18:11:51 -04:00 committed by Ivan
parent 948bd3673e
commit 68202eb2b7
7 changed files with 20 additions and 20 deletions

View File

@ -1295,7 +1295,7 @@ bool SELFDecrypter::GetKeyFromRap(u8* content_id, u8* npdrm_key)
// Try to find a matching RAP file under exdata folder.
const std::string ci_str = reinterpret_cast<const char*>(content_id);
const std::string rap_path = fmt::format("/dev_hdd0/home/%s/exdata/%s.rap", Emu.GetUsr(), ci_str);
const std::string rap_path = "/dev_hdd0/home/" + Emu.GetUsr() + "/exdata/" + ci_str + ".rap";
// Open the RAP file and read the key.
const fs::file rap_file(vfs::get(rap_path));

View File

@ -1207,7 +1207,7 @@ s32 cellSaveDataUserFixedExport(ppu_thread& ppu, u32 userId, vm::cptr<char> dirN
s32 cellSaveDataUserGetListItem(u32 userId, vm::cptr<char> dirName, vm::ptr<CellSaveDataDirStat> dir, vm::ptr<CellSaveDataSystemFileParam> sysFileParam, vm::ptr<u32> bind, vm::ptr<u32> sizeKB)
{
cellSaveData.warning("cellSaveDataGetListItem(dirName=%s, dir=*0x%x, sysFileParam=*0x%x, bind=*0x%x, sizeKB=*0x%x, userID=*0x%x)", dirName, dir, sysFileParam, bind, sizeKB, userId);
cellSaveData.warning("cellSaveDataUserGetListItem(dirName=%s, dir=*0x%x, sysFileParam=*0x%x, bind=*0x%x, sizeKB=*0x%x, userID=*0x%x)", dirName, dir, sysFileParam, bind, sizeKB, userId);
return savedata_get_list_item(dirName, dir, sysFileParam, bind, sizeKB, userId);
}

View File

@ -65,7 +65,7 @@ s32 npDrmIsAvailable(vm::cptr<u8> k_licensee_addr, vm::cptr<char> drm_path)
npdrmkeys->devKlic.fill(0);
npdrmkeys->rifKey.fill(0);
std::string rap_dir_path = fmt::format("/dev_hdd0/home/%s/exdata/", Emu.GetUsr());
std::string rap_dir_path = "/dev_hdd0/home/" + Emu.GetUsr() + "/exdata/";
const std::string& enc_drm_path_local = vfs::get(enc_drm_path);
const fs::file enc_file(enc_drm_path_local);
@ -144,7 +144,7 @@ s32 sceNpDrmVerifyUpgradeLicense(vm::cptr<char> content_id)
return SCE_NP_DRM_ERROR_INVALID_PARAM;
}
if (!fs::is_file(vfs::get(fmt::format("/dev_hdd0/home/%s/exdata/%s.rap", Emu.GetUsr(), content_id.get_ptr()))))
if (!fs::is_file(vfs::get("/dev_hdd0/home/" + Emu.GetUsr() + "/exdata/" + content_id.get_ptr() + ".rap")))
{
// Game hasn't been purchased therefore no RAP file present
return SCE_NP_DRM_ERROR_LICENSE_NOT_FOUND;
@ -163,7 +163,7 @@ s32 sceNpDrmVerifyUpgradeLicense2(vm::cptr<char> content_id)
return SCE_NP_DRM_ERROR_INVALID_PARAM;
}
if (!fs::is_file(vfs::get(fmt::format("/dev_hdd0/home/%s/exdata/%s.rap", Emu.GetUsr(), content_id.get_ptr()))))
if (!fs::is_file(vfs::get("/dev_hdd0/home/" + Emu.GetUsr() + "/exdata/" + content_id.get_ptr() + ".rap")))
{
// Game hasn't been purchased therefore no RAP file present
return SCE_NP_DRM_ERROR_LICENSE_NOT_FOUND;

View File

@ -296,7 +296,7 @@ error_code sceNpTrophyRegisterContext(ppu_thread& ppu, u32 context, u32 handle,
}
}
std::string trophyPath = fmt::format("/dev_hdd0/home/%s/trophy/%s", Emu.GetUsr(), ctxt->trp_name);
std::string trophyPath = "/dev_hdd0/home/" + Emu.GetUsr() + "/trophy/" + ctxt->trp_name;
if (!trp.Install(trophyPath))
{
return SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE;
@ -345,7 +345,7 @@ error_code sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, vm::ptr<u64>
return SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE;
}
if (!fs::is_dir(vfs::get(fmt::format("/dev_hdd0/home/%s/trophy/%s", Emu.GetUsr(), ctxt->trp_name))))
if (!fs::is_dir(vfs::get("/dev_hdd0/home/" + Emu.GetUsr() + "/trophy/" + ctxt->trp_name)))
{
TRPLoader trp(ctxt->trp_stream);
@ -404,7 +404,7 @@ error_code sceNpTrophyGetGameInfo(u32 context, u32 handle, vm::ptr<SceNpTrophyGa
return SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE;
}
fs::file config(vfs::get(fmt::format("/dev_hdd0/home/%s/trophy/%s/TROPCONF.SFM", Emu.GetUsr(), ctxt->trp_name)));
fs::file config(vfs::get("/dev_hdd0/home/" + Emu.GetUsr() + "/trophy/" + ctxt->trp_name + "/TROPCONF.SFM"));
if (!config)
{
@ -503,7 +503,7 @@ error_code sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::pt
return SCE_NP_TROPHY_ERROR_ALREADY_UNLOCKED;
ctxt->tropusr->UnlockTrophy(trophyId, 0, 0); // TODO
std::string trophyPath = fmt::format("/dev_hdd0/home/%s/trophy/%s/TROPUSR.DAT", Emu.GetUsr(), ctxt->trp_name);
std::string trophyPath = "/dev_hdd0/home/" + Emu.GetUsr() + "/trophy/" + ctxt->trp_name + "/TROPUSR.DAT";
ctxt->tropusr->Save(trophyPath);
if (platinumId)
@ -526,7 +526,7 @@ error_code sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::pt
// Get icon for the notification.
std::string paddedTrophyId = padding + std::to_string(trophyId);
std::string trophyIconPath = fmt::format("/dev_hdd0/home/%s/trophy/%s/TROP%s.PNG", Emu.GetUsr(), ctxt->trp_name, paddedTrophyId);
std::string trophyIconPath = "/dev_hdd0/home/" + Emu.GetUsr() + "/trophy/" + ctxt->trp_name + "/TROP" + paddedTrophyId + ".PNG";
fs::file trophyIconFile = fs::file(vfs::get(trophyIconPath));
size_t iconSize = trophyIconFile.size();
std::vector<uchar> trophyIconData;
@ -611,7 +611,7 @@ error_code sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, vm::p
return SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE;
}
fs::file config(vfs::get(fmt::format("/dev_hdd0/home/%s/trophy/%s/TROPCONF.SFM", Emu.GetUsr(), ctxt->trp_name)));
fs::file config(vfs::get("/dev_hdd0/home/" + Emu.GetUsr() + "/trophy/" + ctxt->trp_name + "/TROPCONF.SFM"));
if (!config)
{
@ -754,7 +754,7 @@ error_code sceNpTrophyGetGameIcon(u32 context, u32 handle, vm::ptr<void> buffer,
return SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE;
}
fs::file icon_file(vfs::get(fmt::format("/dev_hdd0/home/%s/trophy/%s/ICON0.PNG", Emu.GetUsr(), ctxt->trp_name)));
fs::file icon_file(vfs::get("/dev_hdd0/home/" + Emu.GetUsr() + "/trophy/" + ctxt->trp_name + "/ICON0.PNG"));
if (!icon_file)
{
@ -807,7 +807,7 @@ error_code sceNpTrophyGetTrophyIcon(u32 context, u32 handle, s32 trophyId, vm::p
return hidden ? SCE_NP_TROPHY_ERROR_HIDDEN : SCE_NP_TROPHY_ERROR_LOCKED;
}
fs::file icon_file(vfs::get(fmt::format("/dev_hdd0/home/%s/trophy/%s/TROP%03d.PNG", Emu.GetUsr(), ctxt->trp_name, trophyId)));
fs::file icon_file(vfs::get("/dev_hdd0/home/" + Emu.GetUsr() + "/trophy/" + ctxt->trp_name + fmt::format("/TROP%03d.PNG", trophyId)));
if (!icon_file)
{

View File

@ -1789,7 +1789,7 @@ void main_window::dropEvent(QDropEvent* event)
{
const std::string rapname = sstr(QFileInfo(rap).fileName());
if (!fs::copy_file(sstr(rap), fmt::format("%s/home/%s/exdata/%s", Emu.GetHddDir(), Emu.GetUsr(), rapname), false))
if (!fs::copy_file(sstr(rap), Emu.GetHddDir() + "/home/" + Emu.GetUsr() + "/exdata/" + rapname, false))
{
LOG_WARNING(GENERAL, "Could not copy rap file by drop: %s", rapname);
}

View File

@ -58,7 +58,7 @@ trophy_manager_dialog::trophy_manager_dialog(std::shared_ptr<gui_settings> gui_s
// Get the currently selected user's trophy path.
m_trophy_dir = fmt::format("/dev_hdd0/home/%s/trophy/", Emu.GetUsr());
m_trophy_dir = "/dev_hdd0/home/" + Emu.GetUsr() + "/trophy/";
// Game chooser combo box
m_game_combo = new QComboBox();

View File

@ -208,11 +208,11 @@ void user_manager_dialog::GenerateUser(const std::string& username)
const std::string homeDir = Emu.GetHddDir() + "home/";
const std::string userDir = homeDir + nextUserId;
fs::create_dir(homeDir);
fs::create_dir(fmt::format("%s/", userDir));
fs::create_dir(fmt::format("%s/exdata/", userDir));
fs::create_dir(fmt::format("%s/savedata/", userDir));
fs::create_dir(fmt::format("%s/trophy/", userDir));
fs::write_file(fmt::format("%s/localusername", userDir), fs::create + fs::excl + fs::write, username);
fs::create_dir(userDir + "/");
fs::create_dir(userDir + "/exdata/");
fs::create_dir(userDir + "/savedata/");
fs::create_dir(userDir + "/trophy/");
fs::write_file(userDir + "/localusername", fs::create + fs::excl + fs::write, username);
}
bool user_manager_dialog::ValidateUsername(const QString& textToValidate)