mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Convert more HLE logging to the hleLog system
This commit is contained in:
parent
bb914ca4bf
commit
9165711cef
6 changed files with 29 additions and 46 deletions
|
@ -216,12 +216,13 @@ T hleDoLog(Log t, LogLevel level, T res, const char *file, int line, const char
|
|||
return res;
|
||||
}
|
||||
|
||||
// This will become important later.
|
||||
// These will become important later.
|
||||
template <typename T>
|
||||
[[nodiscard]]
|
||||
T hleNoLog(T t) {
|
||||
inline T hleNoLog(T t) {
|
||||
return t;
|
||||
}
|
||||
inline void hleNoLogVoid() {}
|
||||
|
||||
// This is just a quick way to force logging to be more visible for one file.
|
||||
#ifdef HLE_LOG_FORCE
|
||||
|
|
|
@ -514,8 +514,7 @@ static int sceCtrlReadBufferPositive(u32 ctrlDataPtr, u32 nBufs)
|
|||
{
|
||||
int done = __CtrlReadBuffer(ctrlDataPtr, nBufs, false, false);
|
||||
hleEatCycles(330);
|
||||
if (done != 0)
|
||||
{
|
||||
if (done != 0) {
|
||||
DEBUG_LOG(Log::sceCtrl, "%d=sceCtrlReadBufferPositive(%08x, %i)", done, ctrlDataPtr, nBufs);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -2033,8 +2033,7 @@ int __KernelGPUReplay() {
|
|||
return result == GPURecord::ReplayResult::Break ? 1 : 0;
|
||||
}
|
||||
|
||||
int sceKernelLoadExec(const char *filename, u32 paramPtr)
|
||||
{
|
||||
int sceKernelLoadExec(const char *filename, u32 paramPtr) {
|
||||
std::string exec_filename = filename;
|
||||
PSPFileInfo info = pspFileSystem.GetFileInfo(exec_filename);
|
||||
|
||||
|
@ -2050,27 +2049,24 @@ int sceKernelLoadExec(const char *filename, u32 paramPtr)
|
|||
}
|
||||
|
||||
if (!info.exists) {
|
||||
ERROR_LOG(Log::Loader, "sceKernelLoadExec(%s, ...): File does not exist", filename);
|
||||
return SCE_KERNEL_ERROR_NOFILE;
|
||||
return hleLogError(Log::Loader, SCE_KERNEL_ERROR_NOFILE, "File does not exist");
|
||||
}
|
||||
|
||||
s64 size = (s64)info.size;
|
||||
if (!size) {
|
||||
ERROR_LOG(Log::Loader, "sceKernelLoadExec(%s, ...): File is size 0", filename);
|
||||
return SCE_KERNEL_ERROR_ILLEGAL_OBJECT;
|
||||
return hleLogError(Log::Loader, SCE_KERNEL_ERROR_ILLEGAL_OBJECT, "File is size 0", filename);
|
||||
}
|
||||
|
||||
DEBUG_LOG(Log::sceModule, "sceKernelLoadExec(name=%s,...): loading %s", filename, exec_filename.c_str());
|
||||
std::string error_string;
|
||||
if (!__KernelLoadExec(exec_filename.c_str(), paramPtr, &error_string)) {
|
||||
ERROR_LOG(Log::sceModule, "sceKernelLoadExec failed: %s", error_string.c_str());
|
||||
Core_UpdateState(CORE_RUNTIME_ERROR);
|
||||
return -1;
|
||||
return hleLogError(Log::sceModule, -1, "failed: %s", error_string.c_str());;
|
||||
}
|
||||
if (gpu) {
|
||||
gpu->Reinitialize();
|
||||
}
|
||||
return 0;
|
||||
return hleLogDebug(Log::sceModule, 0);
|
||||
}
|
||||
|
||||
u32 sceKernelLoadModule(const char *name, u32 flags, u32 optionAddr) {
|
||||
|
@ -2547,11 +2543,9 @@ u32 sceKernelFindModuleByName(const char *name)
|
|||
if (strcmp(name, module->nm.name) == 0) {
|
||||
if (!module->isFake) {
|
||||
INFO_LOG(Log::sceModule, "%d = sceKernelFindModuleByName(%s)", module->modulePtr.ptr, name);
|
||||
return module->modulePtr.ptr;
|
||||
}
|
||||
else {
|
||||
WARN_LOG(Log::sceModule, "0 = sceKernelFindModuleByName(%s): Module Fake", name);
|
||||
return hleDelayResult(0, "Module Fake", 1000 * 1000);
|
||||
return hleLogSuccessInfoI(Log::sceModule, module->modulePtr.ptr);
|
||||
} else {
|
||||
return hleDelayResult(hleLogWarning(Log::sceModule, 0, "Module Fake"), "Module Fake", 1000 * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2619,7 +2613,7 @@ static u32 sceKernelLoadModuleByID(u32 id, u32 flags, u32 lmoptionPtr)
|
|||
static u32 sceKernelLoadModuleDNAS(const char *name, u32 flags)
|
||||
{
|
||||
ERROR_LOG_REPORT(Log::sceModule, "UNIMPL 0=sceKernelLoadModuleDNAS()");
|
||||
return 0;
|
||||
return hleNoLog(0);
|
||||
}
|
||||
|
||||
// Pretty sure this is a badly brute-forced function name...
|
||||
|
@ -2643,12 +2637,10 @@ static SceUID sceKernelLoadModuleBufferUsbWlan(u32 size, u32 bufPtr, u32 flags,
|
|||
// Some games try to load strange stuff as PARAM.SFO as modules and expect it to fail.
|
||||
// This checks for the SFO magic number.
|
||||
if (magic == 0x46535000) {
|
||||
ERROR_LOG(Log::Loader, "Game tried to load an SFO as a module. Go figure? Magic = %08x", magic);
|
||||
return error;
|
||||
return hleLogError(Log::Loader, error, "Game tried to load an SFO as a module. Go figure? Magic = %08x", magic);
|
||||
}
|
||||
|
||||
if ((int)error >= 0)
|
||||
{
|
||||
if ((int)error >= 0) {
|
||||
// Module was blacklisted or couldn't be decrypted, which means it's a kernel module we don't want to run..
|
||||
// Let's just act as if it worked.
|
||||
NOTICE_LOG(Log::Loader, "Module is blacklisted or undecryptable - we lie about success");
|
||||
|
@ -2669,7 +2661,7 @@ static SceUID sceKernelLoadModuleBufferUsbWlan(u32 size, u32 bufPtr, u32 flags,
|
|||
INFO_LOG(Log::sceModule,"%i=sceKernelLoadModuleBufferUsbWlan(%x,%08x,flag=%08x,(...))", module->GetUID(), size,bufPtr, flags);
|
||||
}
|
||||
|
||||
return module->GetUID();
|
||||
return hleNoLog(module->GetUID());
|
||||
}
|
||||
|
||||
static u32 sceKernelQueryModuleInfo(u32 uid, u32 infoAddr)
|
||||
|
|
|
@ -810,8 +810,7 @@ int sceKernelSendMsgPipe(SceUID uid, u32 sendBufAddr, u32 sendSize, u32 waitMode
|
|||
}
|
||||
MsgPipe *m = kernelObjects.Get<MsgPipe>(uid, error);
|
||||
if (!m) {
|
||||
ERROR_LOG(Log::sceKernel, "sceKernelSendMsgPipe(%i) - ERROR %08x", uid, error);
|
||||
return error;
|
||||
return hleLogError(Log::sceKernel, error, "ERROR %08x", error);
|
||||
}
|
||||
|
||||
DEBUG_LOG(Log::sceKernel, "sceKernelSendMsgPipe(id=%i, addr=%08x, size=%i, mode=%i, result=%08x, timeout=%08x)", uid, sendBufAddr, sendSize, waitMode, resultAddr, timeoutPtr);
|
||||
|
@ -826,7 +825,7 @@ int sceKernelSendMsgPipeCB(SceUID uid, u32 sendBufAddr, u32 sendSize, u32 waitMo
|
|||
}
|
||||
MsgPipe *m = kernelObjects.Get<MsgPipe>(uid, error);
|
||||
if (!m) {
|
||||
return hleLogError(Log::sceKernel, error, "ERROR %08x, couldn't find msgpipe", error);
|
||||
return hleLogError(Log::sceKernel, error, "ERROR %08x", error);
|
||||
}
|
||||
|
||||
DEBUG_LOG(Log::sceKernel, "sceKernelSendMsgPipeCB(id=%i, addr=%08x, size=%i, mode=%i, result=%08x, timeout=%08x)", uid, sendBufAddr, sendSize, waitMode, resultAddr, timeoutPtr);
|
||||
|
@ -915,8 +914,7 @@ int sceKernelReceiveMsgPipe(SceUID uid, u32 receiveBufAddr, u32 receiveSize, u32
|
|||
}
|
||||
MsgPipe *m = kernelObjects.Get<MsgPipe>(uid, error);
|
||||
if (!m) {
|
||||
ERROR_LOG(Log::sceKernel, "sceKernelReceiveMsgPipe(%i) - ERROR %08x", uid, error);
|
||||
return error;
|
||||
return hleLogError(Log::sceKernel, error, "ERROR %08x", error);
|
||||
}
|
||||
|
||||
DEBUG_LOG(Log::sceKernel, "sceKernelReceiveMsgPipe(%i, %08x, %i, %i, %08x, %08x)", uid, receiveBufAddr, receiveSize, waitMode, resultAddr, timeoutPtr);
|
||||
|
@ -931,8 +929,7 @@ int sceKernelReceiveMsgPipeCB(SceUID uid, u32 receiveBufAddr, u32 receiveSize, u
|
|||
}
|
||||
MsgPipe *m = kernelObjects.Get<MsgPipe>(uid, error);
|
||||
if (!m) {
|
||||
ERROR_LOG(Log::sceKernel, "sceKernelReceiveMsgPipeCB(%i) - ERROR %08x", uid, error);
|
||||
return error;
|
||||
return hleLogError(Log::sceKernel, error, "ERROR %08x", error);
|
||||
}
|
||||
|
||||
DEBUG_LOG(Log::sceKernel, "sceKernelReceiveMsgPipeCB(%i, %08x, %i, %i, %08x, %08x)", uid, receiveBufAddr, receiveSize, waitMode, resultAddr, timeoutPtr);
|
||||
|
@ -949,8 +946,7 @@ int sceKernelTryReceiveMsgPipe(SceUID uid, u32 receiveBufAddr, u32 receiveSize,
|
|||
}
|
||||
MsgPipe *m = kernelObjects.Get<MsgPipe>(uid, error);
|
||||
if (!m) {
|
||||
ERROR_LOG(Log::sceKernel, "sceKernelTryReceiveMsgPipe(%i) - ERROR %08x", uid, error);
|
||||
return error;
|
||||
return hleLogError(Log::sceKernel, error, "ERROR %08x", error);
|
||||
}
|
||||
|
||||
DEBUG_LOG(Log::sceKernel, "sceKernelTryReceiveMsgPipe(%i, %08x, %i, %i, %08x)", uid, receiveBufAddr, receiveSize, waitMode, resultAddr);
|
||||
|
@ -963,10 +959,8 @@ int sceKernelCancelMsgPipe(SceUID uid, u32 numSendThreadsAddr, u32 numReceiveThr
|
|||
|
||||
u32 error;
|
||||
MsgPipe *m = kernelObjects.Get<MsgPipe>(uid, error);
|
||||
if (!m)
|
||||
{
|
||||
ERROR_LOG(Log::sceKernel, "sceKernelCancelMsgPipe(%i) - ERROR %08x", uid, error);
|
||||
return error;
|
||||
if (!m) {
|
||||
return hleLogError(Log::sceKernel, error, "ERROR %08x", error);
|
||||
}
|
||||
|
||||
hleEatCycles(1100);
|
||||
|
@ -988,8 +982,7 @@ int sceKernelCancelMsgPipe(SceUID uid, u32 numSendThreadsAddr, u32 numReceiveThr
|
|||
// And now the entire buffer is free.
|
||||
m->nmp.freeSize = m->nmp.bufSize;
|
||||
|
||||
DEBUG_LOG(Log::sceKernel, "sceKernelCancelMsgPipe(%i, %i, %i)", uid, numSendThreadsAddr, numReceiveThreadsAddr);
|
||||
return 0;
|
||||
return hleLogDebug(Log::sceKernel, 0);
|
||||
}
|
||||
|
||||
int sceKernelReferMsgPipeStatus(SceUID uid, u32 statusPtr) {
|
||||
|
|
|
@ -819,16 +819,12 @@ static int sceNetInit(u32 poolSize, u32 calloutPri, u32 calloutStack, u32 netini
|
|||
// Free(delete) thread info / data.
|
||||
// Normal usage: sceKernelDeleteThread followed by sceNetFreeThreadInfo with the same threadID as argument
|
||||
static int sceNetFreeThreadinfo(SceUID thid) {
|
||||
ERROR_LOG(Log::sceNet, "UNIMPL sceNetFreeThreadinfo(%i)", thid);
|
||||
|
||||
return 0;
|
||||
return hleLogError(Log::sceNet, 0, "UNIMPL");
|
||||
}
|
||||
|
||||
// Abort a thread.
|
||||
static int sceNetThreadAbort(SceUID thid) {
|
||||
ERROR_LOG(Log::sceNet, "UNIMPL sceNetThreadAbort(%i)", thid);
|
||||
|
||||
return 0;
|
||||
return hleLogError(Log::sceNet, 0, "UNIMPL");
|
||||
}
|
||||
|
||||
static u32 sceWlanGetEtherAddr(u32 addrAddr) {
|
||||
|
@ -884,6 +880,8 @@ static void sceNetEtherNtostr(u32 macPtr, u32 bufferPtr) {
|
|||
|
||||
VERBOSE_LOG(Log::sceNet, "sceNetEtherNtostr - [%s]", buffer);
|
||||
}
|
||||
|
||||
hleNoLogVoid();
|
||||
}
|
||||
|
||||
static int hex_to_digit(int c) {
|
||||
|
@ -932,6 +930,7 @@ static void sceNetEtherStrton(u32 bufferPtr, u32 macPtr) {
|
|||
// Seems to maybe kinda return the last value. Probably returns void.
|
||||
//return value;
|
||||
}
|
||||
hleNoLogVoid();
|
||||
}
|
||||
|
||||
// Write static data since we don't actually manage any memory for sceNet* yet.
|
||||
|
|
|
@ -772,7 +772,6 @@ static int sceNetInetClose(int socket) {
|
|||
}
|
||||
|
||||
g_socketManager.Close(inetSock);
|
||||
|
||||
return hleLogSuccessInfoI(Log::sceNet, 0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue