Skip to content

Commit

Permalink
cellGame: Fix cellDiscGameGetBootDiscInfo return values (RPCS3#4241)
Browse files Browse the repository at this point in the history
  • Loading branch information
jarveson authored and Nekotekina committed Mar 2, 2018
1 parent 8db7ef4 commit ec0cd9f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
24 changes: 21 additions & 3 deletions rpcs3/Emu/Cell/Modules/cellGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ void fmt_class_string<CellGameDataError>::format(std::string& out, u64 arg)
});
}

template<>
void fmt_class_string<CellDiscGameError>::format(std::string& out, u64 arg)
{
format_enum(out, arg, [](auto error)
{
switch (error)
{
STR_CASE(CELL_DISCGAME_ERROR_INTERNAL);
STR_CASE(CELL_DISCGAME_ERROR_NOT_DISCBOOT);
STR_CASE(CELL_DISCGAME_ERROR_PARAM);
}

return unknown;
});
}

// If dir is empty:
// contentInfo = "/dev_bdvd/PS3_GAME"
// usrdir = "/dev_bdvd/PS3_GAME/USRDIR"
Expand Down Expand Up @@ -831,16 +847,18 @@ s32 cellDiscGameGetBootDiscInfo(vm::ptr<CellDiscGameSystemFileParam> getParam)
{
cellGame.warning("cellDiscGameGetBootDiscInfo(getParam=*0x%x)", getParam);

if (!getParam)
return CELL_DISCGAME_ERROR_PARAM;

// This is also called by non-disc games, see NPUB90029
const std::string dir = "/dev_bdvd/PS3_GAME"s;

if (!fs::is_dir(vfs::get(dir)))
{
// Not a disc game. TODO: Fetch PARAM.SFO from proper game dir
cellGame.warning("cellDiscGameGetBootDiscInfo(): directory '%s' not found", dir);
getParam->parentalLevel = 0;
strcpy_trunc(getParam->titleId, "0");
return CELL_OK;

return CELL_DISCGAME_ERROR_NOT_DISCBOOT;
}

const auto& psf = psf::load_object(fs::file(vfs::get(dir + "/PARAM.SFO")));
Expand Down
7 changes: 7 additions & 0 deletions rpcs3/Emu/Cell/Modules/cellGame.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ enum CellGameDataError : u32
CELL_GAMEDATA_ERROR_FAILURE = 0x8002b607,
};

enum CellDiscGameError : u32
{
CELL_DISCGAME_ERROR_INTERNAL = 0x8002bd01,
CELL_DISCGAME_ERROR_NOT_DISCBOOT = 0x8002bd02,
CELL_DISCGAME_ERROR_PARAM = 0x8002bd03,
};

// Definitions
enum
{
Expand Down

0 comments on commit ec0cd9f

Please sign in to comment.