From 5d705c0e9cb93262d80cbd4d0d14db25acaaa101 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Tue, 14 Feb 2017 19:46:56 +0200 Subject: [PATCH] fix up an issue with sceNpTrophyCreateContext (#2382) --- rpcs3/Emu/Cell/Modules/cellGameExec.cpp | 9 ++++--- rpcs3/Emu/Cell/Modules/sceNpTrophy.cpp | 32 +++++++++++++++++++++---- rpcs3/MMJoystickHandler.cpp | 12 +++++----- 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellGameExec.cpp b/rpcs3/Emu/Cell/Modules/cellGameExec.cpp index 62cbc5efb9..9be1ce2c82 100644 --- a/rpcs3/Emu/Cell/Modules/cellGameExec.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGameExec.cpp @@ -29,14 +29,17 @@ s32 cellGameGetHomeDataImportPath() fmt::throw_exception("Unimplemented" HERE); } -s32 cellGameGetHomeLaunchOptionPath() +s32 cellGameGetHomeLaunchOptionPath(vm::ptr commonPath, vm::ptr 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 type, vm::ptr dirName, vm::ptr 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; diff --git a/rpcs3/Emu/Cell/Modules/sceNpTrophy.cpp b/rpcs3/Emu/Cell/Modules/sceNpTrophy.cpp index aa2763aec7..63a73ba49c 100644 --- a/rpcs3/Emu/Cell/Modules/sceNpTrophy.cpp +++ b/rpcs3/Emu/Cell/Modules/sceNpTrophy.cpp @@ -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 context, vm::cptr commId, vm::cptr 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; } diff --git a/rpcs3/MMJoystickHandler.cpp b/rpcs3/MMJoystickHandler.cpp index 2a792f7302..759dba1b82 100644 --- a/rpcs3/MMJoystickHandler.cpp +++ b/rpcs3/MMJoystickHandler.cpp @@ -31,11 +31,11 @@ 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; @@ -43,8 +43,8 @@ void MMJoystickHandler::Init(const u32 max_connect) 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; @@ -90,7 +90,7 @@ void MMJoystickHandler::Init(const u32 max_connect) } else { - LOG_ERROR(HLE, "Joystick not found"); + LOG_ERROR(GENERAL, "Joystick not found"); } } @@ -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; } }