Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix up an issue with sceNpTrophyCreateContext #2382

Merged
merged 2 commits into from
Feb 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions rpcs3/Emu/Cell/Modules/cellGameExec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
32 changes: 28 additions & 4 deletions rpcs3/Emu/Cell/Modules/sceNpTrophy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
12 changes: 6 additions & 6 deletions rpcs3/MMJoystickHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ void MMJoystickHandler::Init(const u32 max_connect)
supportedJoysticks = joyGetNumDevs();
if (supportedJoysticks > 0)
{
LOG_ERROR(HLE, "Driver supports %u joysticks", supportedJoysticks);
LOG_NOTICE(GENERAL, "Driver supports %u joysticks", supportedJoysticks);
}
else
{
LOG_ERROR(HLE, "Driver doesn't support Joysticks");
LOG_ERROR(GENERAL, "Driver doesn't support Joysticks");
}
js_info.dwSize = sizeof(js_info);
js_info.dwFlags = JOY_RETURNALL;
joyGetDevCaps(JOYSTICKID1, &js_caps, sizeof(js_caps));
bool JoyPresent = (joyGetPosEx(JOYSTICKID1, &js_info) == JOYERR_NOERROR);
if (JoyPresent)
{
LOG_ERROR(HLE, "Found connected joystick with %u buttons", js_caps.wNumButtons);

LOG_NOTICE(GENERAL, "Found connected joystick with %u buttons and %u axes", js_caps.wNumButtons,js_caps.wNumAxes);
LOG_NOTICE(GENERAL, "Axes info %u %u %u %u %u %u %u %u", js_caps.wXmin, js_caps.wXmax,js_caps.wYmin,js_caps.wYmax,js_caps.wZmin,js_caps.wZmax,js_caps.wRmin,js_caps.wRmax);
std::memset(&m_info, 0, sizeof m_info);
m_info.max_connect = max_connect;

Expand Down Expand Up @@ -90,7 +90,7 @@ void MMJoystickHandler::Init(const u32 max_connect)
}
else
{
LOG_ERROR(HLE, "Joystick not found");
LOG_ERROR(GENERAL, "Joystick not found");
}
}

Expand All @@ -102,7 +102,7 @@ void MMJoystickHandler::Close()
{
active = false;
if (WaitForSingleObject(thread, THREAD_TIMEOUT) != WAIT_OBJECT_0)
LOG_ERROR(HLE, "MMJoystick thread could not stop within %d milliseconds", (u32)THREAD_TIMEOUT);
LOG_ERROR(GENERAL, "MMJoystick thread could not stop within %d milliseconds", (u32)THREAD_TIMEOUT);
thread = nullptr;
}
}
Expand Down