Skip to content

Commit

Permalink
PSF loader renaming
Browse files Browse the repository at this point in the history
load() -> load_object()
save() -> save_object()
  • Loading branch information
Nekotekina committed Feb 26, 2016
1 parent 0cd32df commit de41631
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion rpcs3/Emu/SysCalls/Modules/cellGame.cpp
Expand Up @@ -79,7 +79,7 @@ s32 cellHddGameCheck(PPUThread& ppu, u32 version, vm::cptr<char> dirName, u32 er
else
{
// TODO: Is cellHddGameCheck really responsible for writing the information in get->getParam ? (If not, delete this else)
const auto& psf = psf::load(fs::file(local_dir +"/PARAM.SFO"));
const auto& psf = psf::load_object(fs::file(local_dir +"/PARAM.SFO"));

get->getParam.parentalLevel = psf.at("PARENTAL_LEVEL").as_integer();
get->getParam.attribute = psf.at("ATTRIBUTE").as_integer();
Expand Down
6 changes: 3 additions & 3 deletions rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp
Expand Up @@ -93,7 +93,7 @@ never_inline s32 savedata_op(PPUThread& ppu, u32 operation, u32 version, vm::cpt
listGet->dirNum++;

// PSF parameters
const auto& psf = psf::load(fs::file(base_dir + entry.name + "/PARAM.SFO"));
const auto& psf = psf::load_object(fs::file(base_dir + entry.name + "/PARAM.SFO"));

if (psf.empty())
{
Expand Down Expand Up @@ -337,7 +337,7 @@ never_inline s32 savedata_op(PPUThread& ppu, u32 operation, u32 version, vm::cpt
std::string dir_path = base_dir + save_entry.dirName + "/";
std::string sfo_path = dir_path + "PARAM.SFO";

auto&& psf = psf::load(fs::file(sfo_path));
auto&& psf = psf::load_object(fs::file(sfo_path));

// Get save stats
{
Expand Down Expand Up @@ -611,7 +611,7 @@ never_inline s32 savedata_op(PPUThread& ppu, u32 operation, u32 version, vm::cpt
// Write PARAM.SFO
if (psf.size())
{
fs::file(sfo_path, fom::rewrite).write(psf::save(psf));
fs::file(sfo_path, fom::rewrite).write(psf::save_object(psf));
}

return CELL_OK;
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/System.cpp
Expand Up @@ -213,7 +213,7 @@ void Emulator::Load()
g_cfg_vfs_app_home = elf_dir + '/';

// Load PARAM.SFO
m_psf = psf::load(fs::file(elf_dir + "/../PARAM.SFO"));
m_psf = psf::load_object(fs::file(elf_dir + "/../PARAM.SFO"));
m_title = psf::get_string(m_psf, "TITLE", m_path);
m_title_id = psf::get_string(m_psf, "TITLE_ID");
LOG_NOTICE(LOADER, "Title: %s", GetTitle());
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Gui/GameViewer.cpp
Expand Up @@ -104,7 +104,7 @@ void GameViewer::LoadPSF()
continue;
}

const auto& psf = psf::load(sfo_file);
const auto& psf = psf::load_object(sfo_file);

GameInfo game;
game.root = m_games[i];
Expand Down
6 changes: 3 additions & 3 deletions rpcs3/Loader/PSF.cpp
Expand Up @@ -61,10 +61,10 @@ namespace psf
return SIZE_32(u32);
}

throw EXCEPTION("Invalid format (0x%x)", m_type);
throw fmt::exception("Invalid format (0x%x)" HERE, m_type);
}

registry load(const std::vector<char>& data)
registry load_object(const std::vector<char>& data)
{
registry result;

Expand Down Expand Up @@ -147,7 +147,7 @@ namespace psf
return result;
}

std::vector<char> save(const registry& psf)
std::vector<char> save_object(const registry& psf)
{
std::vector<def_table_t> indices; indices.reserve(psf.size());

Expand Down
14 changes: 7 additions & 7 deletions rpcs3/Loader/PSF.h
Expand Up @@ -49,24 +49,24 @@ namespace psf
// Define PSF registry as a sorted map of entries:
using registry = std::map<std::string, entry>;

// Load PSF registry from binary data
registry load(const std::vector<char>&);
// Load PSF registry from SFO binary data
registry load_object(const std::vector<char>&);

// Load PSF registry from file, if opened
inline registry load(const fs::file& f)
// Load PSF registry from SFO file, if opened
inline registry load_object(const fs::file& f)
{
if (f)
{
return load(f.to_vector<char>());
return load_object(f.to_vector<char>());
}
else
{
return registry{};
}
}

// Convert PSF registry to binary format
std::vector<char> save(const registry&);
// Convert PSF registry to SFO binary format
std::vector<char> save_object(const registry&);

// Get string value or default value
std::string get_string(const registry& psf, const std::string& key, const std::string& def = {});
Expand Down

0 comments on commit de41631

Please sign in to comment.