From 21ee18b730992468db1ef4041050ba1ce18e7611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 27 Sep 2024 00:47:05 +0200 Subject: [PATCH] Add even more logging to savedata code --- Core/Dialog/PSPSaveDialog.cpp | 20 +++---- Core/Dialog/PSPSaveDialog.h | 4 +- Core/Dialog/SavedataParam.cpp | 29 ++++++--- Core/FileSystems/DirectoryFileSystem.cpp | 4 +- Core/FileSystems/ISOFileSystem.cpp | 10 ++-- Core/HLE/sceUtility.cpp | 76 ++++++++++++++++-------- 6 files changed, 88 insertions(+), 55 deletions(-) diff --git a/Core/Dialog/PSPSaveDialog.cpp b/Core/Dialog/PSPSaveDialog.cpp index 144336e507..867465cbab 100755 --- a/Core/Dialog/PSPSaveDialog.cpp +++ b/Core/Dialog/PSPSaveDialog.cpp @@ -120,7 +120,7 @@ int PSPSaveDialog::Init(int paramAddr) const u32 mode = (u32)param.GetPspParam()->mode; const char *modeName = mode < ARRAY_SIZE(utilitySavedataTypeNames) ? utilitySavedataTypeNames[mode] : "UNKNOWN"; INFO_LOG(Log::sceUtility,"sceUtilitySavedataInitStart(%08x) - %s (%d)", paramAddr, modeName, mode); - INFO_LOG(Log::sceUtility,"sceUtilitySavedataInitStart(%08x) : Game key (hex): %s", paramAddr, param.GetKey(param.GetPspParam()).c_str()); + INFO_LOG(Log::sceUtility,"Game key (hex): %s", param.GetKey(param.GetPspParam()).c_str()); yesnoChoice = 1; switch ((SceUtilitySavedataFocus)(u32)param.GetPspParam()->focus) @@ -245,7 +245,7 @@ int PSPSaveDialog::Init(int paramAddr) display = DS_NONE; break; - case SCE_UTILITY_SAVEDATA_TYPE_LISTDELETE: + case SCE_UTILITY_SAVEDATA_TYPE_LISTDELETE: DEBUG_LOG(Log::sceUtility, "Delete. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); if (param.GetFilenameCount() == 0) display = DS_DELETE_NODATA; @@ -798,7 +798,7 @@ int PSPSaveDialog::Update(int animSpeed) case DS_LOAD_LIST_CHOICE: StartDraw(); - + DisplaySaveList(); DisplaySaveDataInfo1(); @@ -878,7 +878,7 @@ int PSPSaveDialog::Update(int animSpeed) case DS_LOAD_DONE: JoinIOThread(); StartDraw(); - + DisplaySaveIcon(true); DisplaySaveDataInfo2(); @@ -917,7 +917,7 @@ int PSPSaveDialog::Update(int animSpeed) case DS_DELETE_LIST_CHOICE: StartDraw(); - + DisplaySaveList(); DisplaySaveDataInfo1(); @@ -940,8 +940,8 @@ int PSPSaveDialog::Update(int animSpeed) DisplaySaveIcon(true); DisplaySaveDataInfo2(); - DisplayMessage(di->T("DeleteConfirm", - "This save data will be deleted.\nAre you sure you want to continue?"), + DisplayMessage(di->T("DeleteConfirm", + "This save data will be deleted.\nAre you sure you want to continue?"), true); DisplayButtons(DS_BUTTON_OK | DS_BUTTON_CANCEL); @@ -998,7 +998,7 @@ int PSPSaveDialog::Update(int animSpeed) param.SetPspParam(param.GetPspParam()); } StartDraw(); - + DisplayMessage(di->T("Delete completed")); DisplayButtons(DS_BUTTON_CANCEL); @@ -1021,7 +1021,7 @@ int PSPSaveDialog::Update(int animSpeed) break; case DS_DELETE_NODATA: StartDraw(); - + DisplayMessage(di->T("There is no data")); DisplayButtons(DS_BUTTON_CANCEL); @@ -1061,7 +1061,7 @@ int PSPSaveDialog::Update(int animSpeed) if (ReadStatus() == SCE_UTILITY_STATUS_FINISHED || pendingStatus == SCE_UTILITY_STATUS_FINISHED) Memory::Memcpy(requestAddr, &request, request.common.size, "SaveDialogParam"); param.ClearSFOCache(); - + return 0; } diff --git a/Core/Dialog/PSPSaveDialog.h b/Core/Dialog/PSPSaveDialog.h index 5c452a3c84..72d2f751d5 100644 --- a/Core/Dialog/PSPSaveDialog.h +++ b/Core/Dialog/PSPSaveDialog.h @@ -69,7 +69,7 @@ #define SCE_UTILITY_SAVEDATA_ERROR_SIZES_WRONG_UMD (0x801103Ca) #define SCE_UTILITY_SAVEDATA_ERROR_SIZES_INTERNAL (0x801103Cb) -class PSPSaveDialog: public PSPDialog { +class PSPSaveDialog : public PSPDialog { public: PSPSaveDialog(UtilityDialogType type); ~PSPSaveDialog(); @@ -88,7 +88,6 @@ protected: } private: - void DisplayBanner(int which); void DisplaySaveList(bool canMove = true); void DisplaySaveIcon(bool checkExists); @@ -158,4 +157,3 @@ private: std::mutex paramLock; volatile SaveIOStatus ioThreadStatus; }; - diff --git a/Core/Dialog/SavedataParam.cpp b/Core/Dialog/SavedataParam.cpp index bdb893cfe2..95bc8eaa6d 100644 --- a/Core/Dialog/SavedataParam.cpp +++ b/Core/Dialog/SavedataParam.cpp @@ -459,7 +459,7 @@ int SavedataParam::Save(SceUtilitySavedataParam* param, const std::string &saveD } } - u8* cryptedData = 0; + u8 *cryptedData = 0; int cryptedSize = 0; u8 cryptedHash[0x10]{}; // Encrypt save. @@ -487,6 +487,7 @@ int SavedataParam::Save(SceUtilitySavedataParam* param, const std::string &saveD bool hasKey = decryptMode > 1; if (hasKey && !HasKey(param)) { delete[] cryptedData; + ERROR_LOG(Log::sceUtility, "Inconsistent hasKey"); return SCE_UTILITY_SAVEDATA_ERROR_SAVE_PARAM; } @@ -596,7 +597,7 @@ int SavedataParam::Save(SceUtilitySavedataParam* param, const std::string &saveD delete[] cryptedData; return SCE_UTILITY_SAVEDATA_ERROR_SAVE_MS_NOSPACE; } - } + } delete[] cryptedData; } @@ -629,9 +630,12 @@ int SavedataParam::Save(SceUtilitySavedataParam* param, const std::string &saveD int SavedataParam::Load(SceUtilitySavedataParam *param, const std::string &saveDirName, int saveId, bool secureMode) { if (!param) { + ERROR_LOG(Log::sceUtility, "Param missing"); return SCE_UTILITY_SAVEDATA_ERROR_LOAD_NO_DATA; } + INFO_LOG(Log::sceUtility, "Load: %s", saveDirName.c_str()); + bool isRWMode = param->mode == SCE_UTILITY_SAVEDATA_TYPE_READDATA || param->mode == SCE_UTILITY_SAVEDATA_TYPE_READDATASECURE; std::string dirPath = GetSaveFilePath(param, GetSaveDir(param, saveDirName)); @@ -639,10 +643,12 @@ int SavedataParam::Load(SceUtilitySavedataParam *param, const std::string &saveD std::string filePath = dirPath + "/" + fileName; if (!pspFileSystem.GetFileInfo(dirPath).exists) { + WARN_LOG(Log::sceUtility, "Load: Dir not found: %s", dirPath.c_str()); return isRWMode ? SCE_UTILITY_SAVEDATA_ERROR_RW_NO_DATA : SCE_UTILITY_SAVEDATA_ERROR_LOAD_NO_DATA; } if (!fileName.empty() && !pspFileSystem.GetFileInfo(filePath).exists) { + WARN_LOG(Log::sceUtility, "Load: File not found: %s", filePath.c_str()); return isRWMode ? SCE_UTILITY_SAVEDATA_ERROR_RW_FILE_NOT_FOUND : SCE_UTILITY_SAVEDATA_ERROR_LOAD_FILE_NOT_FOUND; } @@ -650,8 +656,10 @@ int SavedataParam::Load(SceUtilitySavedataParam *param, const std::string &saveD // This isn't reset if the path doesn't even exist. param->dataSize = 0; int result = LoadSaveData(param, saveDirName, dirPath, secureMode); - if (result != 0) + if (result != 0) { + WARN_LOG(Log::sceUtility, "LoadSaveData failed: %s", dirPath.c_str()); return result; + } // Load sfo if (!LoadSFO(param, dirPath)) { @@ -691,8 +699,10 @@ int SavedataParam::LoadSaveData(SceUtilitySavedataParam *param, const std::strin std::string filename = GetFileName(param); std::string filePath = dirPath + "/" + filename; // Blank filename always means success, if secureVersion was correct. - if (filename.empty()) + if (filename.empty()) { + INFO_LOG(Log::sceUtility, "'Loading' blank filename, returning success."); return 0; + } s64 readSize; INFO_LOG(Log::sceUtility, "Loading file with size %u in %s", param->dataBufSize, filePath.c_str()); @@ -1553,7 +1563,7 @@ int SavedataParam::SetPspParam(SceUtilitySavedataParam *param) if (saveDataListCount > 0 && WouldHaveMultiSaveName(param)) { hasMultipleFileName = true; saveDataList = new SaveFileInfo[saveDataListCount]; - + // get and stock file info for each file int realCount = 0; for (int i = 0; i < saveDataListCount; i++) { @@ -1565,7 +1575,7 @@ int SavedataParam::SetPspParam(SceUtilitySavedataParam *param) for (auto it = allSaves.begin(); it != allSaves.end(); ++it) { if (it->name.compare(0, gameName.length(), gameName) == 0) { std::string saveName = it->name.substr(gameName.length()); - + if (IsInSaveDataList(saveName, realCount)) // Already in SaveDataList, skip... continue; @@ -1592,7 +1602,7 @@ int SavedataParam::SetPspParam(SceUtilitySavedataParam *param) PSPFileInfo info = GetSaveInfo(fileDataDir); if (info.exists) { SetFileInfo(realCount, info, thisSaveName); - INFO_LOG(Log::sceUtility, "Save data exists: %s = %s", thisSaveName.c_str(), fileDataDir.c_str()); + INFO_LOG(Log::sceUtility, "Save data folder exists: %s = %s", thisSaveName.c_str(), fileDataDir.c_str()); realCount++; } else { if (listEmptyFile) { @@ -1607,7 +1617,8 @@ int SavedataParam::SetPspParam(SceUtilitySavedataParam *param) saveNameListDataCount = realCount; } } - // Load info on only save + + // Load info on only save if (!hasMultipleFileName) { saveNameListData = 0; @@ -1620,7 +1631,7 @@ int SavedataParam::SetPspParam(SceUtilitySavedataParam *param) PSPFileInfo info = GetSaveInfo(fileDataDir); if (info.exists) { SetFileInfo(0, info, GetSaveName(param)); - INFO_LOG(Log::sceUtility, "Save data exists: %s = %s", GetSaveName(param).c_str(), fileDataDir.c_str()); + INFO_LOG(Log::sceUtility, "Save data folder exists: %s = %s", GetSaveName(param).c_str(), fileDataDir.c_str()); saveNameListDataCount = 1; } else { if (listEmptyFile) { diff --git a/Core/FileSystems/DirectoryFileSystem.cpp b/Core/FileSystems/DirectoryFileSystem.cpp index f3948bf347..fdd41d60e8 100644 --- a/Core/FileSystems/DirectoryFileSystem.cpp +++ b/Core/FileSystems/DirectoryFileSystem.cpp @@ -1039,8 +1039,8 @@ void VFSFileSystem::CloseFile(u32 handle) { delete [] iter->second.fileData; entries.erase(iter); } else { - //This shouldn't happen... - ERROR_LOG(Log::FileSystem,"Cannot close file that hasn't been opened: %08x", handle); + // This shouldn't happen... + ERROR_LOG(Log::FileSystem, "Cannot close file that hasn't been opened: %08x", handle); } } diff --git a/Core/FileSystems/ISOFileSystem.cpp b/Core/FileSystems/ISOFileSystem.cpp index 49574702f3..a2d95f11e1 100644 --- a/Core/FileSystems/ISOFileSystem.cpp +++ b/Core/FileSystems/ISOFileSystem.cpp @@ -300,7 +300,7 @@ ISOFileSystem::TreeEntry *ISOFileSystem::GetFromPath(const std::string &path, bo } } } - + if (nextEntry) { entry = nextEntry; if (!entry->valid) @@ -479,10 +479,10 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) { OpenFileEntry &e = iter->second; if (size < 0) { - ERROR_LOG_REPORT(Log::FileSystem, "Invalid read for %lld bytes from umd %s", size, e.file ? e.file->name.c_str() : "device"); + ERROR_LOG_REPORT(Log::FileSystem, "Invalid read for %lld bytes from umd %s", size, e.file ? e.file->name.c_str() : "lba"); return 0; } - + if (e.isBlockSectorMode) { // Whole sectors! Shortcut to this simple code. blockDevice->ReadBlocks(e.seekPos, (int)size, pointer); @@ -520,7 +520,7 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) { if (newSize == 0) { INFO_LOG(Log::FileSystem, "Attempted read at end of file, 0-size read simulated"); } else { - INFO_LOG(Log::FileSystem, "Reading beyond end of file from seekPos %d, clamping size %lld to %lld", e.seekPos, size, newSize); + WARN_LOG(Log::FileSystem, "Reading beyond end of file (%s) from seekPos %d, clamping size %lld to %lld", e.file ? e.file->name.c_str() : "lba", e.seekPos, size, newSize); } size = newSize; } @@ -625,7 +625,7 @@ PSPFileInfo ISOFileSystem::GetFileInfo(std::string filename) { } TreeEntry *entry = GetFromPath(filename, false); - PSPFileInfo x; + PSPFileInfo x; if (entry) { x.name = entry->name; // Strangely, it seems to be executable even for files. diff --git a/Core/HLE/sceUtility.cpp b/Core/HLE/sceUtility.cpp index 39e547e295..cae5c88411 100644 --- a/Core/HLE/sceUtility.cpp +++ b/Core/HLE/sceUtility.cpp @@ -79,6 +79,20 @@ static const int atrac3PlusModuleDeps[] = {0x0300, 0}; static const int mpegBaseModuleDeps[] = {0x0300, 0}; static const int mp4ModuleDeps[] = {0x0300, 0}; +static const char *g_paramNames[] = { + "N/A (0)", + "NICKNAME", // 1 + "ADHOC_CHANNEL", // 2 + "WLAN_POWERSAVE", // =3 + "DATE_FORMAT", // 4 + "TIME_FORMAT", // 5 + "TIMEZONE", // 6 + "INT_DAYLIGHTSAVINGS", // 7 + "INT_LANGUAGE", // 8 + "BUTTON_PREFERENCE", // 9 + "LOCK_PARENTAL_LEVEL", // 10 +}; + struct ModuleLoadInfo { ModuleLoadInfo(int m, u32 s, void(*n)(int) = nullptr) : mod(m), size(s), dependencies(noDeps), notify(n) { } @@ -467,7 +481,7 @@ static int sceUtilitySavedataUpdate(int animSpeed) { if (currentDialogType != UtilityDialogType::SAVEDATA) { return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - + int result = hleLogSuccessI(Log::sceUtility, saveDialog->Update(animSpeed)); if (result >= 0) return hleDelayResult(result, "savedata update", 300); @@ -481,7 +495,7 @@ static u32 sceUtilityLoadAvModule(u32 module) ERROR_LOG_REPORT(Log::sceUtility, "sceUtilityLoadAvModule(%i): invalid module id", module); return SCE_ERROR_AV_MODULE_BAD_ID; } - + INFO_LOG(Log::sceUtility, "0=sceUtilityLoadAvModule(%i)", module); if (module == 0) JpegNotifyLoadStatus(1); @@ -571,7 +585,7 @@ static int sceUtilityMsgDialogInitStart(u32 paramAddr) { if (currentDialogActive && currentDialogType != UtilityDialogType::MSG) { return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - + ActivateDialog(UtilityDialogType::MSG); return hleLogSuccessInfoX(Log::sceUtility, msgDialog->Init(paramAddr)); } @@ -580,7 +594,7 @@ static int sceUtilityMsgDialogShutdownStart() { if (currentDialogType != UtilityDialogType::MSG) { return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - + DeactivateDialog(); return hleLogSuccessX(Log::sceUtility, msgDialog->Shutdown()); } @@ -589,7 +603,7 @@ static int sceUtilityMsgDialogUpdate(int animSpeed) { if (currentDialogType != UtilityDialogType::MSG) { return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - + int ret = hleLogSuccessX(Log::sceUtility, msgDialog->Update(animSpeed)); if (ret >= 0) return hleDelayResult(ret, "msgdialog update", 800); @@ -614,7 +628,7 @@ static int sceUtilityMsgDialogAbort() { if (currentDialogType != UtilityDialogType::MSG) { return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - + return hleLogSuccessX(Log::sceUtility, msgDialog->Abort()); } @@ -624,7 +638,7 @@ static int sceUtilityOskInitStart(u32 oskPtr) { if (currentDialogActive && currentDialogType != UtilityDialogType::OSK) { return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - + ActivateDialog(UtilityDialogType::OSK); return hleLogSuccessInfoX(Log::sceUtility, oskDialog->Init(oskPtr)); } @@ -633,7 +647,7 @@ static int sceUtilityOskShutdownStart() { if (currentDialogType != UtilityDialogType::OSK) { return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - + DeactivateDialog(); return hleLogSuccessX(Log::sceUtility, oskDialog->Shutdown()); } @@ -642,7 +656,7 @@ static int sceUtilityOskUpdate(int animSpeed) { if (currentDialogType != UtilityDialogType::OSK) { return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - + // This is the vblank period, plus a little slack. Needed to fix timing bug in Ghost Recon: Predator. // See issue #12044. hleEatCycles(msToCycles(0.7315 + 0.1)); @@ -668,7 +682,7 @@ static int sceUtilityNetconfInitStart(u32 paramsAddr) { if (currentDialogActive && currentDialogType != UtilityDialogType::NET) { return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - + ActivateDialog(UtilityDialogType::NET); return hleLogSuccessInfoI(Log::sceUtility, netDialog->Init(paramsAddr)); } @@ -677,7 +691,7 @@ static int sceUtilityNetconfShutdownStart() { if (currentDialogType != UtilityDialogType::NET) { return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - + DeactivateDialog(); return hleLogSuccessI(Log::sceUtility, netDialog->Shutdown()); } @@ -720,7 +734,7 @@ static int sceUtilityScreenshotInitStart(u32 paramAddr) { if (currentDialogActive && currentDialogType != UtilityDialogType::SCREENSHOT) { return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - + ActivateDialog(UtilityDialogType::SCREENSHOT); return hleReportWarning(Log::sceUtility, screenshotDialog->Init(paramAddr)); } @@ -729,7 +743,7 @@ static int sceUtilityScreenshotShutdownStart() { if (currentDialogType != UtilityDialogType::SCREENSHOT) { return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - + DeactivateDialog(); return hleLogWarning(Log::sceUtility, screenshotDialog->Shutdown()); } @@ -738,7 +752,7 @@ static int sceUtilityScreenshotUpdate(u32 animSpeed) { if (currentDialogType != UtilityDialogType::SCREENSHOT) { return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - + return hleLogWarning(Log::sceUtility, screenshotDialog->Update(animSpeed)); } @@ -760,7 +774,7 @@ static int sceUtilityScreenshotContStart(u32 paramAddr) { if (currentDialogType != UtilityDialogType::SCREENSHOT) { return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - + return hleLogWarning(Log::sceUtility, screenshotDialog->ContStart()); } @@ -780,7 +794,7 @@ static int sceUtilityGamedataInstallShutdownStart() { if (!currentDialogActive || currentDialogType != UtilityDialogType::GAMEDATAINSTALL) { return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - + DeactivateDialog(); return hleLogSuccessX(Log::sceUtility, gamedataInstallDialog->Shutdown()); } @@ -789,7 +803,7 @@ static int sceUtilityGamedataInstallUpdate(int animSpeed) { if (!currentDialogActive || currentDialogType != UtilityDialogType::GAMEDATAINSTALL) { return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - + return hleLogSuccessX(Log::sceUtility, gamedataInstallDialog->Update(animSpeed)); } @@ -809,7 +823,7 @@ static int sceUtilityGamedataInstallAbort() { if (!currentDialogActive || currentDialogType != UtilityDialogType::GAMEDATAINSTALL) { return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - + DeactivateDialog(); return hleLogSuccessX(Log::sceUtility, gamedataInstallDialog->Abort()); } @@ -827,7 +841,12 @@ static u32 sceUtilityGetSystemParamString(u32 id, u32 destAddr, int destSize) // TODO: What error code? return -1; } - DEBUG_LOG(Log::sceUtility, "sceUtilityGetSystemParamString(%i, %08x, %i)", id, destAddr, destSize); + + const char *name = "N/A ??"; + if (id < ARRAY_SIZE(g_paramNames)) { + name = g_paramNames[id]; + } + DEBUG_LOG(Log::sceUtility, "sceUtilityGetSystemParamString(%i - %s, %08x, %i)", id, name, destAddr, destSize); char *buf = (char *)Memory::GetPointerWriteUnchecked(destAddr); switch (id) { case PSP_SYSTEMPARAM_ID_STRING_NICKNAME: @@ -871,10 +890,10 @@ static u32 sceUtilityGetSystemParamInt(u32 id, u32 destaddr) case PSP_SYSTEMPARAM_ID_INT_ADHOC_CHANNEL: param = g_Config.iWlanAdhocChannel; if (param == PSP_SYSTEMPARAM_ADHOC_CHANNEL_AUTOMATIC) { - // FIXME: Actually.. it's always returning 0x800ADF4 regardless using Auto channel or Not, and regardless the connection state either, + // FIXME: Actually.. it's always returning 0x800ADF4 regardless using Auto channel or Not, and regardless the connection state either, // Not sure whether this error code only returned after Adhocctl Initialized (ie. netAdhocctlInited) or also before initialized. - // FIXME: Outputted channel (might be unchanged?) either 0 when not connected to a group yet (ie. adhocctlState == ADHOCCTL_STATE_DISCONNECTED), - // or -1 (0xFFFFFFFF) when a scan is in progress (ie. adhocctlState == ADHOCCTL_STATE_SCANNING), + // FIXME: Outputted channel (might be unchanged?) either 0 when not connected to a group yet (ie. adhocctlState == ADHOCCTL_STATE_DISCONNECTED), + // or -1 (0xFFFFFFFF) when a scan is in progress (ie. adhocctlState == ADHOCCTL_STATE_SCANNING), // or 0x60 early when in connected state (ie. adhocctlState == ADHOCCTL_STATE_CONNECTED) right after Creating a group, regardless the channel settings. Memory::Write_U32(param, destaddr); return 0x800ADF4; @@ -916,7 +935,12 @@ static u32 sceUtilityGetSystemParamInt(u32 id, u32 destaddr) return PSP_SYSTEMPARAM_RETVAL_FAIL; } - INFO_LOG(Log::sceUtility, "sceUtilityGetSystemParamInt(%i, %08x <- %08x)", id, destaddr, param); + const char *name = "N/A ??"; + if (id < ARRAY_SIZE(g_paramNames)) { + name = g_paramNames[id]; + } + + INFO_LOG(Log::sceUtility, "sceUtilityGetSystemParamInt(%i (%s), %08x <- %08x)", id, name, destaddr, param); Memory::Write_U32(param, destaddr); return 0; } @@ -1007,7 +1031,7 @@ static int sceUtilityGameSharingShutdownStart() { WARN_LOG(Log::sceUtility, "sceUtilityGameSharingShutdownStart(): wrong dialog type"); return SCE_ERROR_UTILITY_WRONG_TYPE; } - + DeactivateDialog(); ERROR_LOG(Log::sceUtility, "UNIMPL sceUtilityGameSharingShutdownStart()"); return 0; @@ -1018,7 +1042,7 @@ static int sceUtilityGameSharingInitStart(u32 paramsPtr) { WARN_LOG(Log::sceUtility, "sceUtilityGameSharingInitStart(%08x)", paramsPtr); return SCE_ERROR_UTILITY_WRONG_TYPE; } - + ActivateDialog(UtilityDialogType::GAMESHARING); ERROR_LOG_REPORT(Log::sceUtility, "UNIMPL sceUtilityGameSharingInitStart(%08x)", paramsPtr); return 0; @@ -1067,7 +1091,7 @@ static u32 sceUtilityUnloadUsbModule(u32 module) return 0; } -const HLEFunction sceUtility[] = +const HLEFunction sceUtility[] = { {0X1579A159, &WrapU_U, "sceUtilityLoadNetModule", 'x', "x" }, {0X64D50C56, &WrapU_U, "sceUtilityUnloadNetModule", 'x', "x" },