diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 1d7eafeb18..d9be5a4586 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -406,17 +406,27 @@ ELF - HLE\Libraries HLE\Libraries - FileSystems + + HLE\Libraries + + + HW + + + HW + + + MIPS\JitCommon + @@ -761,14 +771,27 @@ ELF - HLE\Libraries HLE\Libraries - + + HLE\Libraries + + + HW + + + HW + + + HW + + + MIPS\JitCommon + diff --git a/Core/HLE/HLETables.cpp b/Core/HLE/HLETables.cpp index b1a9881fa9..365a8ff264 100644 --- a/Core/HLE/HLETables.cpp +++ b/Core/HLE/HLETables.cpp @@ -135,7 +135,7 @@ const HLEFunction LoadCoreForKernel[] = {0xBF983EF2, 0, "sceKernelProbeExecutableObject"}, {0x7068E6BA, 0, "sceKernelLoadExecutableObject"}, {0xB4D6FECC, 0, "sceKernelApplyElfRelSection"}, - {0x54AB2675, 0, "LoadCoreForKernel_54AB2675"}, + {0x54AB2675, 0, "sceKernelApplyPspRelSection"}, {0x2952F5AC, 0, "sceKernelDcacheWBinvAll"}, {0xD8779AC6, WrapU_V, "sceKernelIcacheClearAll"}, {0x99A695F0, 0, "sceKernelRegisterLibrary"}, @@ -159,7 +159,7 @@ const HLEFunction LoadCoreForKernel[] = {0xCCE4A157, 0, "sceKernelFindModuleByUID"}, {0x82CE54ED, 0, "sceKernelModuleCount"}, {0xC0584F0C, 0, "sceKernelGetModuleList"}, - {0xCF8A41B1, WrapU_V,"sceKernelFindModuleByName"}, + {0xCF8A41B1, WrapU_C,"sceKernelFindModuleByName"}, }; diff --git a/Core/HLE/sceCtrl.cpp b/Core/HLE/sceCtrl.cpp index 537ca36772..d38bd48151 100644 --- a/Core/HLE/sceCtrl.cpp +++ b/Core/HLE/sceCtrl.cpp @@ -482,8 +482,8 @@ static const HLEFunction sceCtrl[] = {0x60B81F86, WrapV_UU, "sceCtrlReadBufferNegative"}, {0xB1D0E5CD, WrapU_U, "sceCtrlPeekLatch"}, {0x0B588501, WrapU_U, "sceCtrlReadLatch"}, - {0x348D99D4, 0, "sceCtrl_348D99D4"}, - {0xAF5960F3, 0, "sceCtrl_AF5960F3"}, + {0x348D99D4, 0, "sceCtrlSetSuspendingExtraSamples"}, + {0xAF5960F3, 0, "sceCtrlGetSuspendingExtraSamples"}, {0xA68FD260, 0, "sceCtrlClearRapidFire"}, {0x6841BE1A, 0, "sceCtrlSetRapidFire"}, {0xa7144800, WrapI_II, "sceCtrlSetIdleCancelThreshold"}, diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 4bb32564c4..52fb503000 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -115,6 +115,13 @@ enum { PSP_DISPLAY_SETBUF_NEXTFRAME = 1 }; +static int lastFpsFrame = 0; +static double lastFpsTime = 0.0; +static double fps = 0.0; +static double fpsHistory[120]; +static size_t fpsHistoryPos = 0; +static size_t fpsHistoryValid = 0; + void hleEnterVblank(u64 userdata, int cyclesLate); void hleLeaveVblank(u64 userdata, int cyclesLate); void hleAfterFlip(u64 userdata, int cyclesLate); @@ -143,6 +150,9 @@ void __DisplayInit() { curFrameTime = 0.0; nextFrameTime = 0.0; + fpsHistoryPos = 0; + fpsHistoryValid = 0; + InitGfxState(); } @@ -203,15 +213,25 @@ void __DisplayFireVblank() { } } -static double highestFps = 0.0; -static int lastFpsFrame = 0; -static double lastFpsTime = 0.0; -static double fps = 0.0; - void __DisplayGetFPS(float *out_vps, float *out_fps) { *out_vps = *out_fps = fps; } +void __DisplayGetAveragedFPS(float *out_vps, float *out_fps) { + float avg = 0.0; + if (fpsHistoryValid > 0) { + if (fpsHistoryValid > ARRAY_SIZE(fpsHistory)) { + fpsHistoryValid = ARRAY_SIZE(fpsHistory); + } + for (size_t i = 0; i < fpsHistoryValid; ++i) { + avg += fpsHistory[i]; + } + avg /= (double) fpsHistoryValid; + } + + *out_vps = *out_fps = avg; +} + void CalculateFPS() { time_update(); @@ -220,11 +240,13 @@ void CalculateFPS() if (now >= lastFpsTime + 1.0) { fps = (gpuStats.numFrames - lastFpsFrame) / (now - lastFpsTime); - if (fps > highestFps) - highestFps = fps; lastFpsFrame = gpuStats.numFrames; lastFpsTime = now; + + fpsHistory[fpsHistoryPos++] = fps; + fpsHistoryPos = fpsHistoryPos % ARRAY_SIZE(fpsHistory); + ++fpsHistoryValid; } } @@ -657,7 +679,7 @@ u32 sceDisplaySetHoldMode(u32 hMode) { const HLEFunction sceDisplay[] = { {0x0E20F177,WrapU_III, "sceDisplaySetMode"}, - {0x289D82FE,WrapU_UIII, "sceDisplaySetFramebuf"}, + {0x289D82FE,WrapU_UIII, "sceDisplaySetFrameBuf"}, {0xEEDA2E54,WrapU_UUUI,"sceDisplayGetFrameBuf"}, {0x36CDFADE,WrapU_V, "sceDisplayWaitVblank"}, {0x984C27E7,WrapU_V, "sceDisplayWaitVblankStart"}, diff --git a/Core/HLE/sceDisplay.h b/Core/HLE/sceDisplay.h index c32799eb78..c6d784eef0 100644 --- a/Core/HLE/sceDisplay.h +++ b/Core/HLE/sceDisplay.h @@ -35,3 +35,4 @@ void __DisplayListenVblank(VblankCallback callback); void __DisplayGetDebugStats(char stats[2048]); void __DisplayGetFPS(float *out_vps, float *out_fps); +void __DisplayGetAveragedFPS(float *out_vps, float *out_fps); diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index aca1f6663a..c896dc10fa 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -11,6 +11,7 @@ #include "../MIPS/MIPS.h" #include "ChunkFile.h" #include "Core/FileSystems/FileSystem.h" +#include "Core/Reporting.h" #include "Core/System.h" #include "Core/HLE/sceKernel.h" #include "Core/Font/PGF.h" @@ -793,7 +794,7 @@ int sceFontGetCharInfo(u32 fontHandle, u32 charCode, u32 charInfoPtr) { // Not sure about the arguments. int sceFontGetShadowInfo(u32 fontHandle, u32 charCode, u32 shadowCharInfoPtr) { - ERROR_LOG(HLE, "UNIMPL sceFontGetShadowInfo(%08x, %i, %08x)", fontHandle, charCode, shadowCharInfoPtr); + ERROR_LOG_REPORT(HLE, "UNIMPL sceFontGetShadowInfo(%08x, %i, %08x)", fontHandle, charCode, shadowCharInfoPtr); // TODO return 0; } @@ -816,7 +817,7 @@ int sceFontGetCharImageRect(u32 fontHandle, u32 charCode, u32 charRectPtr) { } int sceFontGetShadowImageRect(u32 fontHandle, u32 charCode, u32 charRectPtr) { - ERROR_LOG(HLE, "UNIMPL sceFontGetShadowImageRect()"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceFontGetShadowImageRect()"); return 0; } @@ -946,17 +947,17 @@ float sceFontPointToPixelV(int fontLibHandle, float fontPointsV, u32 errorCodePt } int sceFontCalcMemorySize() { - ERROR_LOG(HLE, "UNIMPL sceFontCalcMemorySize()"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceFontCalcMemorySize()"); return 0; } int sceFontGetShadowGlyphImage() { - ERROR_LOG(HLE, "UNIMPL sceFontGetShadowGlyphImage()"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceFontGetShadowGlyphImage()"); return 0; } int sceFontGetShadowGlyphImage_Clip() { - ERROR_LOG(HLE, "UNIMPL sceFontGetShadowGlyphImage_Clip()"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceFontGetShadowGlyphImage_Clip()"); return 0; } diff --git a/Core/HLE/sceGameUpdate.cpp b/Core/HLE/sceGameUpdate.cpp index 650783c0b4..b1c49e78b4 100644 --- a/Core/HLE/sceGameUpdate.cpp +++ b/Core/HLE/sceGameUpdate.cpp @@ -20,7 +20,7 @@ u32 sceGameUpdateInit() { - ERROR_LOG(HLE, "UNIMPL ceGameUpdateInit()"); + ERROR_LOG(HLE, "UNIMPL sceGameUpdateInit()"); return 0; } diff --git a/Core/HLE/sceGe.cpp b/Core/HLE/sceGe.cpp index 525cce4faa..d41ecfae48 100644 --- a/Core/HLE/sceGe.cpp +++ b/Core/HLE/sceGe.cpp @@ -263,18 +263,15 @@ u32 sceGeListEnQueueHead(u32 listAddress, u32 stallAddress, int callbackId, DEBUG_LOG(HLE, "sceGeListEnQueueHead(addr=%08x, stall=%08x, cbid=%08x, param=%08x)", listAddress, stallAddress, callbackId, optParamAddr); - //if (!stallAddress) - // stallAddress = listAddress; u32 listID = gpu->EnqueueList(listAddress, stallAddress, __GeSubIntrBase(callbackId), true); DEBUG_LOG(HLE, "List %i enqueued.", listID); - //return display list ID return listID; } int sceGeListDeQueue(u32 listID) { - ERROR_LOG(HLE, "UNIMPL sceGeListDeQueue(%08x)", listID); + WARN_LOG(HLE, "sceGeListDeQueue(%08x)", listID); return gpu->DequeueList(listID); } diff --git a/Core/HLE/sceHprm.cpp b/Core/HLE/sceHprm.cpp index 6d1d3196a6..a4967be2e7 100644 --- a/Core/HLE/sceHprm.cpp +++ b/Core/HLE/sceHprm.cpp @@ -45,13 +45,13 @@ u32 sceHprmIsRemoteExist() { const HLEFunction sceHprm[] = { - {0x089fdfa4, 0, "sceHprm_0x089fdfa4"}, + {0x089fdfa4, 0, "sceHprm_089fdfa4"}, {0x1910B327, &WrapU_U, "sceHprmPeekCurrentKey"}, {0x208DB1BD, WrapU_V, "sceHprmIsRemoteExist"}, {0x7E69EDA4, WrapU_V, "sceHprmIsHeadphoneExist"}, {0x219C58F1, WrapU_V, "sceHprmIsMicrophoneExist"}, {0xC7154136, 0, "sceHprmRegisterCallback"}, - {0x444ED0B7, 0, "sceHprmUnregisterCallback"}, + {0x444ED0B7, 0, "sceHprmUnregitserCallback"}, // Typo. {0x1910B327, 0, "sceHprmPeekCurrentKey"}, {0x2BCEC83E, 0, "sceHprmPeekLatch"}, {0x40D2F9F0, 0, "sceHprmReadLatch"}, diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index cfb1afde2a..40dc45e5f3 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -574,7 +574,7 @@ u32 sceIoWriteAsync(int id, u32 data_addr, int size) { u32 sceIoGetDevType(int id) { - ERROR_LOG(HLE, "UNIMPL sceIoGetDevType(%d)", id); + ERROR_LOG_REPORT(HLE, "UNIMPL sceIoGetDevType(%d)", id); u32 error; FileNode *f = kernelObjects.Get < FileNode > (id, error); int result; @@ -590,7 +590,7 @@ u32 sceIoGetDevType(int id) u32 sceIoCancel(int id) { - ERROR_LOG(HLE, "UNIMPL sceIoCancel(%d)", id); + ERROR_LOG_REPORT(HLE, "UNIMPL sceIoCancel(%d)", id); u32 error; FileNode *f = kernelObjects.Get < FileNode > (id, error); if (f) { @@ -1561,24 +1561,24 @@ u32 sceIoIoctlAsync(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u __IoSchedAsync(f, id, 100); return 0; } else { - ERROR_LOG(HLE, "UNIMPL %08x=sceIoIoctl id: %08x, cmd %08x, bad file", error, id, cmd); + ERROR_LOG(HLE, "UNIMPL %08x=sceIoIoctlAsync id: %08x, cmd %08x, bad file", error, id, cmd); return error; } } u32 sceIoGetFdList(u32 outAddr, int outSize, u32 fdNumAddr) { - ERROR_LOG(HLE, "UNIMPL sceIoGetFdList(%08x, %i, %08x)", outAddr, outSize, fdNumAddr); + ERROR_LOG_REPORT(HLE, "UNIMPL sceIoGetFdList(%08x, %i, %08x)", outAddr, outSize, fdNumAddr); return 0; } // Presumably lets you hook up stderr to a MsgPipe. u32 sceKernelRegisterStderrPipe(u32 msgPipeUID) { - ERROR_LOG(HLE, "UNIMPL sceKernelRegisterStderrPipe(%08x)", msgPipeUID); + ERROR_LOG_REPORT(HLE, "UNIMPL sceKernelRegisterStderrPipe(%08x)", msgPipeUID); return 0; } u32 sceKernelRegisterStdoutPipe(u32 msgPipeUID) { - ERROR_LOG(HLE, "UNIMPL sceKernelRegisterStdoutPipe(%08x)", msgPipeUID); + ERROR_LOG_REPORT(HLE, "UNIMPL sceKernelRegisterStdoutPipe(%08x)", msgPipeUID); return 0; } diff --git a/Core/HLE/sceJpeg.cpp b/Core/HLE/sceJpeg.cpp index 679d2eb5e3..3ab3e8c169 100644 --- a/Core/HLE/sceJpeg.cpp +++ b/Core/HLE/sceJpeg.cpp @@ -15,84 +15,85 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "HLE.h" +#include "Core/HLE/HLE.h" +#include "Core/Reporting.h" int sceJpegDecompressAllImage() { - ERROR_LOG(HLE, "UNIMPL sceJpegDecompressAllImage"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceJpegDecompressAllImage"); return 0; } int sceJpegMJpegCsc() { - ERROR_LOG(HLE, "UNIMPL sceJpegMJpegCsc"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceJpegMJpegCsc"); return 0; } int sceJpegDecodeMJpeg() { - ERROR_LOG(HLE, "UNIMPL sceJpegDecodeMJpeg"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceJpegDecodeMJpeg"); return 0; } int sceJpegDecodeMJpegYCbCrSuccessively() { - ERROR_LOG(HLE, "UNIMPL sceJpegDecodeMJpegYCbCrSuccessively"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceJpegDecodeMJpegYCbCrSuccessively"); return 0; } int sceJpegDeleteMJpeg() { - ERROR_LOG(HLE, "UNIMPL sceJpegDeleteMJpeg"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceJpegDeleteMJpeg"); return 0; } int sceJpegDecodeMJpegSuccessively() { - ERROR_LOG(HLE, "UNIMPL sceJpegDecodeMJpegSuccessively"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceJpegDecodeMJpegSuccessively"); return 0; } int sceJpegCsc() { - ERROR_LOG(HLE, "UNIMPL sceJpegCsc"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceJpegCsc"); return 0; } int sceJpegFinishMJpeg() { - ERROR_LOG(HLE, "UNIMPL sceJpegFinishMJpeg"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceJpegFinishMJpeg"); return 0; } int sceJpegGetOutputInfo() { - ERROR_LOG(HLE, "UNIMPL sceJpegGetOutputInfo"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceJpegGetOutputInfo"); return 0; } int sceJpegDecodeMJpegYCbCr() { - ERROR_LOG(HLE, "UNIMPL sceJpegDecodeMJpegYCbCr"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceJpegDecodeMJpegYCbCr"); return 0; } int sceJpeg_9B36444C() { - ERROR_LOG(HLE, "UNIMPL sceJpeg_9B36444C"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceJpeg_9B36444C"); return 0; } int sceJpegCreateMJpeg() { - ERROR_LOG(HLE, "UNIMPL sceJpegCreateMJpeg"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceJpegCreateMJpeg"); return 0; } int sceJpegInitMJpeg() { - ERROR_LOG(HLE, "UNIMPL sceJpegInitMJpeg"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceJpegInitMJpeg"); return 0; } diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index 42c6e59904..42f4aa0774 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -829,6 +829,7 @@ const HLEFunction LoadExecForUser[] = {0xBD2F1094,&WrapI_CU,"sceKernelLoadExec"}, {0x2AC9954B,&WrapV_V,"sceKernelExitGameWithStatus"}, {0x362A956B,&WrapI_V, "LoadExecForUser_362A956B"}, + {0x8ada38d3,0, "LoadExecForUser_8ADA38D3"}, }; void Register_LoadExecForUser() diff --git a/Core/HLE/sceKernel.h b/Core/HLE/sceKernel.h index f5e03e6dab..96dd55374a 100644 --- a/Core/HLE/sceKernel.h +++ b/Core/HLE/sceKernel.h @@ -376,7 +376,7 @@ u32 sceKernelDevkitVersion(); u32 sceKernelRegisterKprintfHandler(); void sceKernelRegisterDefaultExceptionHandler(); -u32 sceKernelFindModuleByName(); +u32 sceKernelFindModuleByName(const char *name); void sceKernelSetGPO(u32 ledAddr); u32 sceKernelGetGPI(); diff --git a/Core/HLE/sceKernelInterrupt.cpp b/Core/HLE/sceKernelInterrupt.cpp index c7dcc9a8ae..c92b99fbf4 100644 --- a/Core/HLE/sceKernelInterrupt.cpp +++ b/Core/HLE/sceKernelInterrupt.cpp @@ -576,7 +576,7 @@ const HLEFunction Kernel_Library[] = {0xc1734599,WrapI_UU, "sceKernelReferLwMutexStatus"}, {0x293b45b8,WrapI_V, "sceKernelGetThreadId"}, {0xD13BDE95,WrapI_V, "sceKernelCheckThreadStack"}, - {0x1839852A,WrapU_UUU, "sce_paf_private_memcpy"}, + {0x1839852A,WrapU_UUU, "sceKernelMemcpy"}, // Name is only a guess. {0xfa835cde,WrapI_I, "sceKernelAllocateTls"}, }; diff --git a/Core/HLE/sceKernelMemory.cpp b/Core/HLE/sceKernelMemory.cpp index a1c2de341b..59f99c68a5 100644 --- a/Core/HLE/sceKernelMemory.cpp +++ b/Core/HLE/sceKernelMemory.cpp @@ -16,6 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include +#include #include "HLE.h" #include "../System.h" #include "../MIPS/MIPS.h" @@ -555,13 +556,93 @@ u32 sceKernelGetBlockHeadAddr(SceUID id) } -void sceKernelPrintf() +int sceKernelPrintf(const char *formatString) { - const char *formatString = Memory::GetCharPointer(PARAM(0)); + if (formatString == NULL) + return -1; - ERROR_LOG(HLE,"UNIMPL sceKernelPrintf(%08x, %08x, %08x, %08x)", PARAM(0),PARAM(1),PARAM(2),PARAM(3)); - ERROR_LOG(HLE,"%s", formatString); - RETURN(0); + bool supported = true; + int param = 1; + char tempStr[24]; + char tempFormat[24] = {'%'}; + std::string result, format = formatString; + + // Each printf is a separate line already in the log, so don't double space. + // This does mean we break up strings, unfortunately. + if (!format.empty() && format[format.size() - 1] == '\n') + format.resize(format.size() - 1); + + for (size_t i = 0, n = format.size(); supported && i < n; ) + { + size_t next = format.find('%', i); + if (next == format.npos) + { + result += format.substr(i); + break; + } + else if (next != i) + result += format.substr(i, next - i); + + i = next + 1; + if (i >= n) + { + supported = false; + break; + } + + switch (format[i]) + { + case '%': + result += '%'; + ++i; + break; + + case 's': + result += Memory::GetCharPointer(PARAM(param++)); + ++i; + break; + + case 'd': + case 'i': + case 'x': + case 'u': + tempFormat[1] = format[i]; + tempFormat[2] = '\0'; + snprintf(tempStr, sizeof(tempStr), tempFormat, PARAM(param++)); + result += tempStr; + ++i; + break; + + case '0': + if (i + 3 >= n || format[i + 1] != '8' || format[i + 2] != 'x') + supported = false; + else + { + snprintf(tempFormat + 1, sizeof(tempFormat) - 1, "08x"); + snprintf(tempStr, sizeof(tempStr), tempFormat, PARAM(param++)); + result += tempStr; + i += 3; + } + break; + + default: + supported = false; + break; + } + + if (param > 6) + supported = false; + } + + // Just in case there were embedded strings that had \n's. + if (!result.empty() && result[result.size() - 1] == '\n') + result.resize(result.size() - 1); + + if (supported) + INFO_LOG(HLE, "sceKernelPrintf: %s", result.c_str()) + else + ERROR_LOG(HLE, "UNIMPL sceKernelPrintf(%s, %08x, %08x, %08x)", format.c_str(), PARAM(1), PARAM(2), PARAM(3)); + return 0; } void sceKernelSetCompiledSdkVersion(int sdkVersion) @@ -1481,7 +1562,7 @@ const HLEFunction SysMemUserForUser[] = { {0x237DBD4F,WrapI_ICIUU,"sceKernelAllocPartitionMemory"}, //(int size) ? {0xB6D61D02,WrapI_I,"sceKernelFreePartitionMemory"}, //(void *ptr) ? {0x9D9A5BA1,WrapU_I,"sceKernelGetBlockHeadAddr"}, //(void *ptr) ? - {0x13a5abef,sceKernelPrintf,"sceKernelPrintf 0x13a5abef"}, + {0x13a5abef,WrapI_C,"sceKernelPrintf"}, {0x7591c7db,&WrapV_I,"sceKernelSetCompiledSdkVersion"}, {0x342061E5,&WrapV_I,"sceKernelSetCompiledSdkVersion370"}, {0x315AD3A0,&WrapV_I,"sceKernelSetCompiledSdkVersion380_390"}, diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index a6055039de..9b06e572e7 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -17,6 +17,7 @@ #include #include +#include #include "HLE.h" #include "Core/Reporting.h" @@ -428,16 +429,20 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro PspLibStubEntry *entry = (PspLibStubEntry *)Memory::GetPointer(modinfo->libstub); - int numSyms=0; + bool needReport = false; + int numSyms = 0; for (int m = 0; m < numModules; m++) { const char *modulename; - if (Memory::IsValidAddress(entry[m].name)) + if (Memory::IsValidAddress(entry[m].name)) { modulename = (const char*)Memory::GetPointer(entry[m].name); - else + } else { modulename = "(invalidname)"; + needReport = true; + } if (!Memory::IsValidAddress(entry[m].nidData)) { ERROR_LOG(LOADER, "Crazy niddata address %08x, skipping entire module", entry[m].nidData); + needReport = true; continue; } u32 *nidDataPtr = (u32*)Memory::GetPointer(entry[m].nidData); @@ -463,6 +468,25 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro DEBUG_LOG(LOADER,"-------------------------------------------------------------"); } + if (needReport) { + std::string debugInfo; + for (int m = 0; m < numModules; m++) { + char temp[512]; + const char *modulename; + if (Memory::IsValidAddress(entry[m].name)) { + modulename = (const char*)Memory::GetPointer(entry[m].name); + } else { + modulename = "(invalidname)"; + } + + snprintf(temp, sizeof(temp), "%s ver=%04x, flags=%04x, size=%d, numFuncs=%d, nidData=%08x, firstSym=%08x\n", + modulename, entry[m].version, entry[m].flags, entry[m].size, entry[m].numFuncs, entry[m].nidData, entry[m].firstSymAddr); + debugInfo += temp; + } + + Reporting::ReportMessage("Module linking debug info:\n%s", debugInfo.c_str()); + } + // Look at the exports, too. struct PspLibEntEntry @@ -854,7 +878,7 @@ void sceKernelStartModule(u32 moduleId, u32 argsize, u32 argAddr, u32 returnValu INFO_LOG(HLE, "sceKernelStartModule(%d,asize=%08x,aptr=%08x,retptr=%08x,%08x): faked (undecryptable module)", moduleId,argsize,argAddr,returnValueAddr,optionAddr); } else { - WARN_LOG(HLE, "UNIMPL sceKernelStartModule(%d,asize=%08x,aptr=%08x,retptr=%08x,%08x)", + WARN_LOG(HLE, "sceKernelStartModule(%d,asize=%08x,aptr=%08x,retptr=%08x,%08x)", moduleId,argsize,argAddr,returnValueAddr,optionAddr); u32 entryAddr = module->nm.entry_addr; @@ -887,6 +911,7 @@ u32 sceKernelStopModule(u32 moduleId, u32 argSize, u32 argAddr, u32 returnValueA ERROR_LOG(HLE,"UNIMPL sceKernelStopModule(%08x, %08x, %08x, %08x, %08x)", moduleId, argSize, argAddr, returnValueAddr, optionAddr); // We should call the "stop" entry point and return the value in returnValueAddr. See StartModule. + // Possibly also kill all its threads? return 0; } @@ -902,9 +927,11 @@ u32 sceKernelUnloadModule(u32 moduleId) return 0; } -u32 sceKernelStopUnloadSelfModuleWithStatus(u32 moduleId, u32 argSize, u32 argp, u32 statusAddr, u32 optionAddr) +u32 sceKernelStopUnloadSelfModuleWithStatus(u32 exitCode, u32 argSize, u32 argp, u32 statusAddr, u32 optionAddr) { - ERROR_LOG(HLE,"UNIMPL sceKernelStopUnloadSelfModuleWithStatus(%08x, %08x, %08x, %08x, %08x,)", moduleId, argSize, argp, statusAddr, optionAddr); + ERROR_LOG_REPORT(HLE, "UNIMPL sceKernelStopUnloadSelfModuleWithStatus(%08x, %08x, %08x, %08x, %08x): game has likely crashed", exitCode, argSize, argp, statusAddr, optionAddr); + + // Probably similar to sceKernelStopModule, but games generally call this when they die. return 0; } @@ -945,9 +972,9 @@ u32 sceKernelGetModuleId() return __KernelGetCurThreadModuleId(); } -u32 sceKernelFindModuleByName() +u32 sceKernelFindModuleByName(const char *name) { - ERROR_LOG(HLE,"UNIMPL sceKernelFindModuleByName()"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceKernelFindModuleByName(%s)", name); return 1; } @@ -993,7 +1020,7 @@ u32 sceKernelLoadModuleByID(u32 id, u32 flags, u32 lmoptionPtr) u32 sceKernelLoadModuleDNAS(const char *name, u32 flags) { - ERROR_LOG(HLE,"UNIMPL 0=sceKernelLoadModuleDNAS()"); + ERROR_LOG_REPORT(HLE, "UNIMPL 0=sceKernelLoadModuleDNAS()"); return 0; } @@ -1042,6 +1069,7 @@ const HLEFunction ModuleMgrForUser[] = {0xf0a26395,WrapU_V, "sceKernelGetModuleId"}, {0x8f2df740,WrapU_UUUUU,"sceKernelStopUnloadSelfModuleWithStatus"}, {0xfef27dc1,&WrapU_CU , "sceKernelLoadModuleDNAS"}, + {0x644395e2,0,"sceKernelGetModuleIdList"}, }; diff --git a/Core/HLE/sceMd5.cpp b/Core/HLE/sceMd5.cpp index 5e0239cb96..96d2a8f456 100644 --- a/Core/HLE/sceMd5.cpp +++ b/Core/HLE/sceMd5.cpp @@ -15,7 +15,8 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "HLE.h" +#include "Core/HLE/HLE.h" +#include "Core/Reporting.h" // Not really sure where these belong - is it worth giving them their own file? u32 sceKernelUtilsMt19937Init(u32 ctx, u32 seed) { @@ -39,25 +40,25 @@ u32 sceKernelUtilsMt19937UInt(u32 ctx) { int sceMd5BlockInit(u32 ctxAddr) { - ERROR_LOG(HLE, "UNIMPL sceMd5BlockInit(%08x)", ctxAddr); + ERROR_LOG_REPORT(HLE, "UNIMPL sceMd5BlockInit(%08x)", ctxAddr); return 0; } int sceMd5BlockUpdate(u32 ctxAddr, u32 dataPtr, u32 len) { - ERROR_LOG(HLE, "UNIMPL sceMd5BlockUpdate(%08x, %08x, %d)", ctxAddr, dataPtr, len); + ERROR_LOG_REPORT(HLE, "UNIMPL sceMd5BlockUpdate(%08x, %08x, %d)", ctxAddr, dataPtr, len); return 0; } int sceMd5BlockResult(u32 ctxAddr, u32 digestAddr) { - ERROR_LOG(HLE, "UNIMPL sceMd5BlockResult(%08x, %08x)", ctxAddr, digestAddr); + ERROR_LOG_REPORT(HLE, "UNIMPL sceMd5BlockResult(%08x, %08x)", ctxAddr, digestAddr); return 0; } int sceMd5Digest(u32 dataPtr, u32 len, u32 digestAddr) { - ERROR_LOG(HLE, "UNIMPL sceMd5Digest(%08x, %d, %08x)", dataPtr, len, digestAddr); + ERROR_LOG_REPORT(HLE, "UNIMPL sceMd5Digest(%08x, %d, %08x)", dataPtr, len, digestAddr); return 0; } diff --git a/Core/HLE/sceMp3.cpp b/Core/HLE/sceMp3.cpp index 6808a08e2e..67a63971e7 100644 --- a/Core/HLE/sceMp3.cpp +++ b/Core/HLE/sceMp3.cpp @@ -16,8 +16,9 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include -#include "HLE.h" -#include "../HW/MediaEngine.h" +#include "Core/HLE/HLE.h" +#include "Core/HW/MediaEngine.h" +#include "Core/Reporting.h" static const int MP3_BITRATES[] = {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320}; @@ -279,7 +280,7 @@ int sceMp3NotifyAddStreamData(u32 mp3, int size) { } int sceMp3GetSumDecodedSample(u32 mp3) { - DEBUG_LOG(HLE, "UNIMPL: sceMp3GetSumDecodedSample(%08X)", mp3); + ERROR_LOG_REPORT(HLE, "UNIMPL sceMp3GetSumDecodedSample(%08X)", mp3); return 0; } @@ -359,17 +360,17 @@ int sceMp3ReleaseMp3Handle(u32 mp3) { } u32 sceMp3EndEntry() { - DEBUG_LOG(HLE, "UNIMPL sceMp3StartEntry(.)"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceMp3EndEntry(...)"); return 0; } u32 sceMp3StartEntry() { - DEBUG_LOG(HLE, "UNIMPL sceMp3StartEntry(.)"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceMp3StartEntry(...)"); return 0; } u32 sceMp3GetFrameNum(u32 mp3) { - DEBUG_LOG(HLE, "UNIMPL sceMp3GetFrameNum(%08x)", mp3); + ERROR_LOG_REPORT(HLE, "UNIMPL sceMp3GetFrameNum(%08x)", mp3); return 0; } @@ -404,8 +405,9 @@ const HLEFunction sceMp3[] = {0xD0A56296,WrapI_U,"sceMp3CheckStreamDataNeeded"}, {0xD8F54A51,WrapI_U,"sceMp3GetLoopNum"}, {0xF5478233,WrapI_U,"sceMp3ReleaseMp3Handle"}, - {0xAE6D2027,WrapU_U,"sceMp3GetVersion"}, + {0xAE6D2027,WrapU_U,"sceMp3GetVersion"}, // Name is wrong. {0x3548AEC8,WrapU_U,"sceMp3GetFrameNum"}, + {0x0840e808,0,"sceMp3_0840e808"}, }; void Register_sceMp3() diff --git a/Core/HLE/sceMp4.cpp b/Core/HLE/sceMp4.cpp index 45a179659f..678ccb0cf2 100644 --- a/Core/HLE/sceMp4.cpp +++ b/Core/HLE/sceMp4.cpp @@ -15,12 +15,13 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "HLE.h" +#include "Core/HLE/HLE.h" +#include "Core/Reporting.h" u32 sceMp4Init() { - ERROR_LOG(HLE, "UNIMPL sceMp4Init()"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceMp4Init()"); return 0; } @@ -32,7 +33,7 @@ u32 sceMp4Finish() u32 sceMp4Create() { - ERROR_LOG(HLE, "UNIMPL sceMp4Create()"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceMp4Create()"); return 0; } diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index 8fb8f9bf93..a3a051627c 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -1421,6 +1421,7 @@ const HLEFunction sceMpeg[] = {0xfcbdb5ad,WrapU_U,"sceMpegAvcResourceInit"}, {0xF5E7EA31,WrapI_UUUI,"sceMpegAvcConvertToYuv420"}, {0x01977054,WrapI_UUUU,"sceMpegGetUserdataAu"}, + {0x3c37a7a6,0,"sceMpegNextAvcRpAu"}, }; void Register_sceMpeg() diff --git a/Core/HLE/sceNet.cpp b/Core/HLE/sceNet.cpp index 21a1c9ba78..34bee3de46 100644 --- a/Core/HLE/sceNet.cpp +++ b/Core/HLE/sceNet.cpp @@ -123,6 +123,7 @@ const HLEFunction sceNet[] = {0xd27961c9, 0, "sceNetEtherStrton"}, {0x50647530, 0, "sceNetFreeThreadinfo"}, {0xcc393e48, 0, "sceNetGetMallocStat"}, + {0xad6844c6, 0, "sceNetThreadAbort"}, }; const HLEFunction sceNetAdhoc[] = @@ -152,6 +153,7 @@ const HLEFunction sceNetAdhoc[] = {0x7F75C338, 0, "sceNetAdhocGameModeCreateMaster"}, {0x73bfd52d, 0, "sceNetAdhocSetSocketAlert"}, {0x7a662d6b, 0, "sceNetAdhocPollSocket"}, + {0x4d2ce199, 0, "sceNetAdhocGetSocketAlert"}, }; int sceNetAdhocMatchingInit(u32 memsize) { @@ -175,6 +177,8 @@ const HLEFunction sceNetAdhocMatching[] = {0xec19337d, 0, "sceNetAdhocMatchingAbortSendData"}, {0xf79472d7, 0, "sceNetAdhocMatchingSendData"}, {0x40F8F435, 0, "sceNetAdhocMatchingGetPoolMaxAlloc"}, + {0xb5d96c2a, 0, "sceNetAdhocMatchingGetHelloOpt"}, + {0x9c5cfb7d, 0, "sceNetAdhocMatchingGetPoolStat"}, }; const HLEFunction sceNetAdhocctl[] = @@ -186,7 +190,7 @@ const HLEFunction sceNetAdhocctl[] = {0x34401D65, 0, "sceNetAdhocctlDisconnect"}, {0x0ad043ed, 0, "sceNetAdhocctlConnect"}, {0x08fff7a0, 0, "sceNetAdhocctlScan"}, - {0x75ecd386, 0, "sceNetAdhocctlGetNameByAddr"}, + {0x75ecd386, 0, "sceNetAdhocctlGetState"}, {0x8916c003, 0, "sceNetAdhocctlGetNameByAddr"}, {0xded9d28e, 0, "sceNetAdhocctlGetParameter"}, {0x81aee1be, 0, "sceNetAdhocctlGetScanInfo"}, @@ -198,6 +202,9 @@ const HLEFunction sceNetAdhocctl[] = {0xcf8e084d, 0, "sceNetAdhocctlExitGameMode"}, {0xe162cb14, 0, "sceNetAdhocctlGetPeerList"}, {0x362cbe8f, 0, "sceNetAdhocctlGetAdhocId"}, + {0x5a014ce0, 0, "sceNetAdhocctlGetGameModeInfo"}, + {0x99560abe, 0, "sceNetAdhocctlGetAddrByName"}, + {0xb0b80e80, 0, "sceNetAdhocctlCreateEnterGameModeMin"}, }; const HLEFunction sceNetResolver[] = @@ -207,7 +214,12 @@ const HLEFunction sceNetResolver[] = {0x94523e09, 0, "sceNetResolverDelete"}, {0xf3370e61, 0, "sceNetResolverInit"}, {0x808F6063, 0, "sceNetResolverStop"}, - {0x6138194A, 0, "sceNetResolverTermFunction"}, + {0x6138194A, 0, "sceNetResolverTerm"}, + {0x629e2fb7, 0, "sceNetResolverStartAtoN"}, + {0x14c17ef9, 0, "sceNetResolverStartNtoAAsync"}, + {0xaac09184, 0, "sceNetResolverStartAtoNAsync"}, + {0x12748eb9, 0, "sceNetResolverWaitAsync"}, + {0x4ee99358, 0, "sceNetResolverPollAsync"}, }; const HLEFunction sceNetInet[] = @@ -240,6 +252,9 @@ const HLEFunction sceNetInet[] = {0x1BDF5D13, 0, "sceNetInetInetAton"}, {0x80A21ABD, 0, "sceNetInetSocketAbort"}, {0x805502DD, 0, "sceNetInetCloseWithRST"}, + {0x774e36f4, 0, "sceNetInetSendmsg"}, + {0xeece61d2, 0, "sceNetInetRecvmsg"}, + {0x39b0c7d3, 0, "sceNetInetGetUdpcbstat"}, }; const HLEFunction sceNetApctl[] = @@ -248,10 +263,13 @@ const HLEFunction sceNetApctl[] = {0x24fe91a1, 0, "sceNetApctlDisconnect"}, {0x5deac81b, 0, "sceNetApctlGetState"}, {0x8abadd51, 0, "sceNetApctlAddHandler"}, - {0xe2f91f9b, 0, "sceNetApctlInitFunction"}, + {0xe2f91f9b, 0, "sceNetApctlInit"}, {0x5963991b, 0, "sceNetApctlDelHandler"}, {0xb3edd0ec, 0, "sceNetApctlTerm"}, {0x2BEFDF23, 0, "sceNetApctlGetInfo"}, + {0xa3e77e13, 0, "sceNetApctlScanSSID2"}, + {0xf25a5006, 0, "sceNetApctlGetBSSDescIDList2"}, + {0x2935c45b, 0, "sceNetApctlGetBSSDescEntry2"}, }; const HLEFunction sceWlanDrv[] = diff --git a/Core/HLE/sceP3da.cpp b/Core/HLE/sceP3da.cpp index 1cbfd63a5c..5676032e5a 100644 --- a/Core/HLE/sceP3da.cpp +++ b/Core/HLE/sceP3da.cpp @@ -15,24 +15,25 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "HLE.h" +#include "Core/HLE/HLE.h" +#include "Core/Reporting.h" u32 sceP3daBridgeInit(u32 channelsNum, u32 samplesNum) { - DEBUG_LOG(HLE, "UNIMPL sceP3daBridgeInit(%08x, %08x)", channelsNum, samplesNum); + ERROR_LOG_REPORT(HLE, "UNIMPL sceP3daBridgeInit(%08x, %08x)", channelsNum, samplesNum); return 0; } u32 sceP3daBridgeExit() { - DEBUG_LOG(HLE, "UNIMPL sceP3daBridgeExit()"); + ERROR_LOG_REPORT(HLE, "UNIMPL sceP3daBridgeExit()"); return 0; } u32 sceP3daBridgeCore(u32 p3daCoreAddr, u32 channelsNum, u32 samplesNum, u32 inputAddr, u32 outputAddr) { - DEBUG_LOG(HLE, "UNIMPL sceP3daBridgeCore(%08x, %08x, %08x, %08x, %08x)", p3daCoreAddr, channelsNum, samplesNum, inputAddr, outputAddr); + ERROR_LOG_REPORT(HLE, "UNIMPL sceP3daBridgeCore(%08x, %08x, %08x, %08x, %08x)", p3daCoreAddr, channelsNum, samplesNum, inputAddr, outputAddr); return 0; } diff --git a/Core/HLE/sceParseHttp.cpp b/Core/HLE/sceParseHttp.cpp index 6ad04ec026..19359552f7 100644 --- a/Core/HLE/sceParseHttp.cpp +++ b/Core/HLE/sceParseHttp.cpp @@ -21,8 +21,8 @@ const HLEFunction sceParseHttp [] = { - {0x8077A433, 0, "sceParseHttpStatusLineFunction"}, - {0xAD7BFDEF, 0, "sceParseHttpResponseHeaderFunction"}, + {0x8077A433, 0, "sceParseHttpStatusLine"}, + {0xAD7BFDEF, 0, "sceParseHttpResponseHeader"}, }; void Register_sceParseHttp() diff --git a/Core/HLE/sceParseUri.cpp b/Core/HLE/sceParseUri.cpp index 10268b47a9..a44c9d4407 100644 --- a/Core/HLE/sceParseUri.cpp +++ b/Core/HLE/sceParseUri.cpp @@ -21,10 +21,10 @@ const HLEFunction sceParseUri[] = { - {0x49E950EC, 0, "sceUriEscapeFunction"}, - {0x062BB07E, 0, "sceUriUnescapeFunction"}, - {0x568518C9, 0, "sceUriParseFunction"}, - {0x7EE318AF, 0, "sceUriBuildFunction"}, + {0x49E950EC, 0, "sceUriEscape"}, + {0x062BB07E, 0, "sceUriUnescape"}, + {0x568518C9, 0, "sceUriParse"}, + {0x7EE318AF, 0, "sceUriBuild"}, }; void Register_sceParseUri() diff --git a/Core/HLE/scePower.cpp b/Core/HLE/scePower.cpp index ead31b33c8..bc26a04976 100644 --- a/Core/HLE/scePower.cpp +++ b/Core/HLE/scePower.cpp @@ -335,7 +335,7 @@ static const HLEFunction scePower[] = { {0x737486F2,WrapU_UUU,"scePowerSetClockFrequency"}, {0x34f9c463,WrapU_V,"scePowerGetPllClockFrequencyInt"}, {0xea382a27,WrapF_V,"scePowerGetPllClockFrequencyFloat"}, - {0xebd177d6,WrapU_UUU,"scePower_driver_ebd177d6"}, // This is also the same as SetClockFrequency + {0xebd177d6,WrapU_UUU,"scePower_EBD177D6"}, // This is also the same as SetClockFrequency {0x469989ad,WrapU_UUU,"scePower_469989ad"}, // This is also the same as SetClockFrequency {0xa85880d0,WrapU_V,"scePower_a85880d0_IsPSPNonFat"}, }; diff --git a/Core/HLE/scePsmf.cpp b/Core/HLE/scePsmf.cpp index 4e36e3c508..10c3b4406f 100644 --- a/Core/HLE/scePsmf.cpp +++ b/Core/HLE/scePsmf.cpp @@ -15,11 +15,12 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "HLE.h" -#include "ChunkFile.h" +#include "Core/HLE/HLE.h" +#include "Common/ChunkFile.h" +#include "Core/Reporting.h" -#include "scePsmf.h" -#include "sceMpeg.h" +#include "Core/HLE/scePsmf.h" +#include "Core/HLE/sceMpeg.h" #include @@ -391,7 +392,7 @@ u32 scePsmfGetNumberOfSpecificStreams(u32 psmfStruct, u32 streamType) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { - ERROR_LOG(HLE, "UNIMPL scePsmfGetNumberOfSpecificStreams - invalid psmf"); + ERROR_LOG(HLE, "scePsmfGetNumberOfSpecificStreams - invalid psmf"); return ERROR_PSMF_NOT_FOUND; } INFO_LOG(HLE, "scePsmfGetNumberOfSpecificStreams(%08x, %08x)", psmfStruct, streamType); @@ -1034,6 +1035,8 @@ const HLEFunction scePsmfPlayer[] = {0xf3efaa91, WrapU_UUU, "scePsmfPlayerGetCurrentPlayMode"}, {0xf8ef08a6, WrapI_U, "scePsmfPlayerGetCurrentStatus"}, {0x2D0E4E0A, WrapI_UUU, "scePsmfPlayerSetTempBuf"}, + {0x76C0F4AE, 0, "scePsmfPlayerSetPsmfOffset"}, + {0xA72DB4F9, 0, "scePsmfPlayerSetPsmfOffsetCB"}, }; void Register_scePsmf() { diff --git a/Core/HLE/sceRtc.cpp b/Core/HLE/sceRtc.cpp index 1295f7e0ba..8dbde5f0c7 100644 --- a/Core/HLE/sceRtc.cpp +++ b/Core/HLE/sceRtc.cpp @@ -24,12 +24,13 @@ #include #include "base/timeutil.h" -#include "HLE.h" -#include "../MIPS/MIPS.h" +#include "Core/HLE/HLE.h" +#include "Core/MIPS/MIPS.h" +#include "Core/Reporting.h" +#include "Core/CoreTiming.h" -#include "sceKernel.h" -#include "sceRtc.h" -#include "../CoreTiming.h" +#include "Core/HLE/sceKernel.h" +#include "Core/HLE/sceRtc.h" // This is a base time that everything is relative to. // This way, time doesn't move strangely with savestates, turbo speed, etc. @@ -625,13 +626,13 @@ int sceRtcGetDosTime(u32 datePtr, u32 dosTime) int sceRtcSetWin32FileTime(u32 datePtr, u32 win32TimePtr) { - ERROR_LOG(HLE, "UNIMPL sceRtcSetWin32FileTime(%d,%d)", datePtr, win32TimePtr); + ERROR_LOG_REPORT(HLE, "UNIMPL sceRtcSetWin32FileTime(%d,%d)", datePtr, win32TimePtr); return 0; } int sceRtcGetWin32FileTime(u32 datePtr, u32 win32TimePtr) { - ERROR_LOG(HLE, "UNIMPL sceRtcGetWin32FileTime(%d,%d)", datePtr, win32TimePtr); + ERROR_LOG_REPORT(HLE, "UNIMPL sceRtcGetWin32FileTime(%d,%d)", datePtr, win32TimePtr); return 0; } @@ -822,7 +823,7 @@ int sceRtcTickAddYears(u32 destTickPtr, u32 srcTickPtr, int numYears) int sceRtcParseDateTime(u32 destTickPtr, u32 dateStringPtr) { - ERROR_LOG(HLE, "UNIMPL sceRtcParseDateTime(%d,%d)", destTickPtr, dateStringPtr); + ERROR_LOG_REPORT(HLE, "UNIMPL sceRtcParseDateTime(%d,%d)", destTickPtr, dateStringPtr); return 0; } @@ -876,6 +877,7 @@ const HLEFunction sceRtc[] = {0xe1c93e47, &WrapI_UU, "sceRtcGetTime64_t"}, {0x1909c99b, &WrapI_UU64, "sceRtcSetTime64_t"}, {0x62685E98, &WrapI_U, "sceRtcGetLastAdjustedTime"}, + {0x203ceb0d, 0, "sceRtcGetLastReincarnatedTime"}, }; void Register_sceRtc() diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index 5618105d38..0db0dda278 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -416,27 +416,27 @@ u32 sceSasGetAllEnvelopeHeights(u32 core, u32 heightsAddr) { } u32 sceSasSetTriangularWave(u32 sasCore, int voice, int unknown) { - ERROR_LOG(HLE,"UNIMPL sceSasSetTriangularWave(%08x, %i, %i)", sasCore, voice, unknown); + ERROR_LOG_REPORT(HLE, "UNIMPL sceSasSetTriangularWave(%08x, %i, %i)", sasCore, voice, unknown); return 0; } u32 sceSasSetSteepWave(u32 sasCore, int voice, int unknown) { - ERROR_LOG(HLE,"UNIMPL sceSasSetSteepWave(%08x, %i, %i)", sasCore, voice, unknown); + ERROR_LOG_REPORT(HLE, "UNIMPL sceSasSetSteepWave(%08x, %i, %i)", sasCore, voice, unknown); return 0; } u32 __sceSasSetVoiceATRAC3(u32 core, int voice, int atrac3Context) { - ERROR_LOG(HLE,"UNIMPL __sceSasSetVoiceATRAC3(%08x, %i, %i)", core, voice, atrac3Context); + ERROR_LOG_REPORT(HLE, "UNIMPL __sceSasSetVoiceATRAC3(%08x, %i, %i)", core, voice, atrac3Context); return 0; } u32 __sceSasConcatenateATRAC3(u32 core, int voice, u32 atrac3DataAddr, int atrac3DataLength) { - ERROR_LOG(HLE,"UNIMPL __sceSasConcatenateATRAC3(%08x, %i, %08x, %i)", core, voice, atrac3DataAddr, atrac3DataLength); + ERROR_LOG_REPORT(HLE, "UNIMPL __sceSasConcatenateATRAC3(%08x, %i, %08x, %i)", core, voice, atrac3DataAddr, atrac3DataLength); return 0; } u32 __sceSasUnsetATRAC3(u32 core, int voice) { - ERROR_LOG(HLE, "UNIMPL __sceSasUnsetATRAC3(%08x, %i)", core, voice); + ERROR_LOG_REPORT(HLE, "UNIMPL __sceSasUnsetATRAC3(%08x, %i)", core, voice); return 0; } @@ -463,7 +463,7 @@ const HLEFunction sceSasCore[] = {0x267a6dd2, WrapU_UII, "__sceSasRevParam"}, {0x2c8e6ab3, WrapU_U, "__sceSasGetPauseFlag"}, {0x787d04d5, WrapU_UII, "__sceSasSetPause"}, - {0xa232cbe6, WrapU_UII, "__sceSasSetTriangularWave"}, + {0xa232cbe6, WrapU_UII, "__sceSasSetTrianglarWave"}, // Typo. {0xd5ebbbcd, WrapU_UII, "__sceSasSetSteepWave"}, {0xBD11B7C2, WrapU_U, "__sceSasGetGrain"}, {0xd1e0a01e, WrapU_UI, "__sceSasSetGrain"}, diff --git a/Core/HLE/sceUtility.cpp b/Core/HLE/sceUtility.cpp index f20bee688d..17f13fb59d 100644 --- a/Core/HLE/sceUtility.cpp +++ b/Core/HLE/sceUtility.cpp @@ -386,7 +386,7 @@ int sceUtilityScreenshotGetStatus() void sceUtilityGamedataInstallInitStart(u32 unkown) { - ERROR_LOG(HLE, "UNIMPL sceUtilityGamedataInstallInitStart(%i)", unkown); + ERROR_LOG_REPORT(HLE, "UNIMPL sceUtilityGamedataInstallInitStart(%i)", unkown); } int sceUtilityGamedataInstallGetStatus() @@ -488,7 +488,7 @@ int sceUtilityStoreCheckoutShutdownStart() int sceUtilityStoreCheckoutInitStart(u32 paramsPtr) { - ERROR_LOG(HLE,"UNIMPL sceUtilityStoreCheckoutInitStart(%d)", paramsPtr); + ERROR_LOG_REPORT(HLE,"UNIMPL sceUtilityStoreCheckoutInitStart(%d)", paramsPtr); return 0; } @@ -545,10 +545,10 @@ const HLEFunction sceUtility[] = {0x7853182d, 0, "sceUtilityGameSharingUpdate"}, {0x946963f3, 0, "sceUtilityGameSharingGetStatus"}, - {0x2995d020, 0, "sceUtility_2995d020"}, - {0xb62a4061, 0, "sceUtility_b62a4061"}, - {0xed0fad38, 0, "sceUtility_ed0fad38"}, - {0x88bc7406, 0, "sceUtility_88bc7406"}, + {0x2995d020, 0, "sceUtilitySavedataErrInitStart"}, + {0xb62a4061, 0, "sceUtilitySavedataErrShutdownStart"}, + {0xed0fad38, 0, "sceUtilitySavedataErrUpdate"}, + {0x88bc7406, 0, "sceUtilitySavedataErrGetStatus"}, {0xbda7d894, 0, "sceUtilityHtmlViewerGetStatus"}, {0xcdc3aa41, 0, "sceUtilityHtmlViewerInitStart"}, @@ -590,6 +590,16 @@ const HLEFunction sceUtility[] = {0xDA97F1AA, &WrapI_U, "sceUtilityStoreCheckoutInitStart"}, {0xB8592D5F, &WrapI_I, "sceUtilityStoreCheckoutUpdate"}, {0x3AAD51DC, &WrapI_V, "sceUtilityStoreCheckoutGetStatus"}, + + {0xe1bc175e, 0, "sceUtility_E1BC175E"}, + {0x43e521b7, 0, "sceUtility_43E521B7"}, + {0xdb4149ee, 0, "sceUtility_DB4149EE"}, + {0xcfe7c460, 0, "sceUtility_CFE7C460"}, + + {0xc130d441, 0, "sceUtility_C130D441"}, + {0x0940a1b9, 0, "sceUtility_0940A1B9"}, + {0x094198b8, 0, "sceUtility_094198B8"}, + {0xa7bb7c67, 0, "sceUtility_A7BB7C67"}, }; void Register_sceUtility() diff --git a/Core/HLE/sceVaudio.cpp b/Core/HLE/sceVaudio.cpp index 6583eb7bc2..d8b24c32e8 100644 --- a/Core/HLE/sceVaudio.cpp +++ b/Core/HLE/sceVaudio.cpp @@ -16,6 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "Common/ChunkFile.h" +#include "Core/Reporting.h" #include "Core/HLE/HLE.h" #include "Core/HLE/sceVaudio.h" #include "Core/HLE/sceAudio.h" @@ -76,12 +77,12 @@ u32 sceVaudioOutputBlocking(int vol, u32 buffer) { } u32 sceVaudioSetEffectType(int effectType, int vol) { - ERROR_LOG(HLE, "UNIMPL sceVaudioSetEffectType(%i, %i)", effectType, vol); + ERROR_LOG_REPORT(HLE, "UNIMPL sceVaudioSetEffectType(%i, %i)", effectType, vol); return 0; } u32 sceVaudioSetAlcMode(int alcMode) { - ERROR_LOG(HLE, "UNIMPL sceVaudioSetAlcMode(%i)", alcMode); + ERROR_LOG_REPORT(HLE, "UNIMPL sceVaudioSetAlcMode(%i)", alcMode); return 0; } diff --git a/Core/Reporting.cpp b/Core/Reporting.cpp index 26b9ee44af..be8d1f1917 100644 --- a/Core/Reporting.cpp +++ b/Core/Reporting.cpp @@ -19,8 +19,11 @@ #include "Common/CPUDetect.h" #include "Common/StdThread.h" +#include "Core/CoreTiming.h" #include "Core/Config.h" #include "Core/System.h" +#include "Core/HLE/sceDisplay.h" +#include "Core/HLE/sceKernelMemory.h" #include "GPU/GPUInterface.h" #include "GPU/GPUState.h" @@ -59,6 +62,45 @@ namespace Reporting AppendEscaped(value); } + void Add(const std::string &key, const char *value) + { + Add(key, std::string(value)); + } + + template + void AddT(const std::string &key, const char *fmt, const T value) + { + char temp[64]; + snprintf(temp, sizeof(temp), fmt, value); + temp[sizeof(temp) - 1] = '\0'; + Add(key, temp); + } + + void Add(const std::string &key, const int value) + { + AddT(key, "%d", value); + } + + void Add(const std::string &key, const u32 value) + { + AddT(key, "%u", value); + } + + void Add(const std::string &key, const u64 value) + { + AddT(key, "%llu", value); + } + + void Add(const std::string &key, const double value) + { + AddT(key, "%f", value); + } + + void Add(const std::string &key, const bool value) + { + Add(key, value ? "true" : "false"); + } + // Percent encoding, aka application/x-www-form-urlencoded. void AppendEscaped(const std::string &value) { @@ -255,6 +297,17 @@ namespace Reporting postdata.Add("gpu_full", gpuFull); postdata.Add("cpu", cpu_info.Summarize()); postdata.Add("platform", GetPlatformIdentifer()); + postdata.Add("sdkver", sceKernelGetCompiledSdkVersion()); + postdata.Add("pixel_width", PSP_CoreParameter().pixelWidth); + postdata.Add("pixel_height", PSP_CoreParameter().pixelHeight); + postdata.Add("ticks", CoreTiming::GetTicks()); + + if (g_Config.bShowFPSCounter) + { + float vps, fps; + __DisplayGetAveragedFPS(&vps, &fps); + postdata.Add("vps", vps); + } // TODO: Settings, savestate/savedata status, some measure of speed/fps?