mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-20 22:05:12 +00:00
fix up an issue with sceNpTrophyCreateContext (#2382)
This commit is contained in:
parent
682924b51a
commit
5d705c0e9c
3 changed files with 40 additions and 13 deletions
|
|
@ -29,14 +29,17 @@ s32 cellGameGetHomeDataImportPath()
|
|||
fmt::throw_exception("Unimplemented" HERE);
|
||||
}
|
||||
|
||||
s32 cellGameGetHomeLaunchOptionPath()
|
||||
s32 cellGameGetHomeLaunchOptionPath(vm::ptr<char> commonPath, vm::ptr<char> personalPath)
|
||||
{
|
||||
fmt::throw_exception("Unimplemented" HERE);
|
||||
cellGameExec.todo("cellGameGetHomeLaunchOptionPath(commonPath=%s, personalPath=%s)", commonPath, personalPath);
|
||||
|
||||
// TODO: PlayStation home is not supported atm.
|
||||
return CELL_GAME_ERROR_NOAPP;
|
||||
}
|
||||
|
||||
s32 cellGameGetBootGameInfo(vm::ptr<u32> type, vm::ptr<char> dirName, vm::ptr<u32> execData)
|
||||
{
|
||||
cellGameExec.todo("cellGameGetBootGameInfo(type=*0x%x, dirName=*0x%x, execData=*0x%x)", type, dirName, execData);
|
||||
cellGameExec.todo("cellGameGetBootGameInfo(type=*0x%x, dirName=%s, execData=*0x%x)", type, dirName, execData);
|
||||
|
||||
// TODO: Support more boot types
|
||||
*type = CELL_GAME_GAMETYPE_SYS;
|
||||
|
|
|
|||
|
|
@ -92,26 +92,50 @@ s32 sceNpTrophyAbortHandle(u32 handle)
|
|||
|
||||
return CELL_OK;
|
||||
}
|
||||
void deleteTerminateChar(char* myStr,char _char) {
|
||||
|
||||
char *del = &myStr[strlen(myStr)];
|
||||
|
||||
while (del > myStr && *del != _char)
|
||||
del--;
|
||||
|
||||
if (*del == _char)
|
||||
*del = '\0';
|
||||
|
||||
return;
|
||||
}
|
||||
s32 sceNpTrophyCreateContext(vm::ptr<u32> context, vm::cptr<SceNpCommunicationId> commId, vm::cptr<SceNpCommunicationSignature> commSign, u64 options)
|
||||
{
|
||||
sceNpTrophy.warning("sceNpTrophyCreateContext(context=*0x%x, commId=*0x%x, commSign=*0x%x, options=0x%llx)", context, commId, commSign, options);
|
||||
|
||||
// rough checks for further fmt::format call
|
||||
if (commId->term || commId->num > 99)
|
||||
if (commId->num > 99)
|
||||
{
|
||||
sceNpTrophy.error("sceNpTrophyCreateContext Invalid NP_COMM_ID");
|
||||
return SCE_NP_TROPHY_ERROR_INVALID_NP_COMM_ID;
|
||||
}
|
||||
|
||||
// generate trophy context name
|
||||
std::string name = fmt::format("%s_%02d", commId->data, commId->num);
|
||||
|
||||
std::string name;
|
||||
sceNpTrophy.warning("sceNpTrophyCreateContext term=%s data=%s num=%d", commId->term, commId->data, commId->num);
|
||||
if (commId->term)
|
||||
{
|
||||
char trimchar[9];
|
||||
strcpy(trimchar, commId->data);
|
||||
deleteTerminateChar(trimchar,commId->term);
|
||||
name = fmt::format("%s_%02d", trimchar, commId->num);
|
||||
}
|
||||
else
|
||||
{
|
||||
name = fmt::format("%s_%02d", commId->data,commId->num);
|
||||
}
|
||||
|
||||
// open trophy pack file
|
||||
fs::file stream(vfs::get("/app_home/../TROPDIR/" + name + "/TROPHY.TRP"));
|
||||
|
||||
// check if exists and opened
|
||||
if (!stream)
|
||||
{
|
||||
sceNpTrophy.error("sceNpTrophyCreateContext CONF does not exist");
|
||||
return SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue