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