From e4223dbcb094206520029eb4690ab6fd0f841f3f Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Tue, 26 Mar 2013 00:54:00 -0700 Subject: [PATCH] Simplify adding report messages, add a bunch more. --- Core/Dialog/PSPMsgDialog.cpp | 3 +-- Core/Dialog/PSPSaveDialog.cpp | 3 +-- Core/HLE/sceIo.cpp | 5 ++-- Core/HLE/sceKernelEventFlag.cpp | 17 +++++++------ Core/HLE/sceKernelMbx.cpp | 9 ++++--- Core/HLE/sceKernelMemory.cpp | 29 +++++++++++----------- Core/HLE/sceKernelModule.cpp | 11 ++++----- Core/HLE/sceKernelMutex.cpp | 17 +++++++------ Core/HLE/sceKernelSemaphore.cpp | 9 ++++--- Core/HLE/sceKernelThread.cpp | 44 +++++++++------------------------ Core/HLE/sceKernelVTimer.cpp | 3 ++- Core/HLE/sceSas.cpp | 3 +-- Core/HLE/sceUtility.cpp | 9 +++---- Core/MIPS/ARM/ArmCompVFPU.cpp | 3 +-- Core/MIPS/MIPSIntVFPU.cpp | 3 +-- Core/MIPS/x86/CompVFPU.cpp | 3 +-- Core/Reporting.h | 5 ++++ GPU/GLES/TextureCache.cpp | 6 ++--- 18 files changed, 79 insertions(+), 103 deletions(-) diff --git a/Core/Dialog/PSPMsgDialog.cpp b/Core/Dialog/PSPMsgDialog.cpp index 993fdb4b8a..0229403531 100644 --- a/Core/Dialog/PSPMsgDialog.cpp +++ b/Core/Dialog/PSPMsgDialog.cpp @@ -53,8 +53,7 @@ int PSPMsgDialog::Init(unsigned int paramAddr) int optionsNotCoded = ((messageDialog.options | SCE_UTILITY_MSGDIALOG_DEBUG_OPTION_CODED) ^ SCE_UTILITY_MSGDIALOG_DEBUG_OPTION_CODED); if(optionsNotCoded) { - ERROR_LOG(HLE,"PSPMsgDialog options not coded : 0x%08x",optionsNotCoded); - Reporting::ReportMessage("PSPMsgDialog options not coded: 0x%08x", optionsNotCoded); + ERROR_LOG_REPORT(HLE, "PSPMsgDialog options not coded : 0x%08x", optionsNotCoded); } flag = 0; diff --git a/Core/Dialog/PSPSaveDialog.cpp b/Core/Dialog/PSPSaveDialog.cpp index 99d4b1d62e..4821045305 100644 --- a/Core/Dialog/PSPSaveDialog.cpp +++ b/Core/Dialog/PSPSaveDialog.cpp @@ -100,8 +100,7 @@ int PSPSaveDialog::Init(int paramAddr) break; default: { - ERROR_LOG(HLE, "Load/Save function %d not coded. Title: %s Save: %s File: %s", param.GetPspParam()->mode, param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); - Reporting::ReportMessage("Load/Save function %d not coded. Title: %s Save: %s File: %s", param.GetPspParam()->mode, param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); + ERROR_LOG_REPORT(HLE, "Load/Save function %d not coded. Title: %s Save: %s File: %s", param.GetPspParam()->mode, param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); param.GetPspParam()->result = 0; status = SCE_UTILITY_STATUS_INITIALIZE; display = DS_NONE; diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index 6ee31ebada..04fa2a07b3 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -859,8 +859,7 @@ u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 outPtr, case 0x01F100A8: case 0x01F100A9: case 0x01F300A7: - Reporting::ReportMessage("sceIoDevctl(\"%s\", %08x, %08x, %i, %08x, %i)", name, cmd, argAddr, argLen, outPtr, outLen); - ERROR_LOG(HLE, "UNIMPL sceIoDevctl(\"%s\", %08x, %08x, %i, %08x, %i)", name, cmd, argAddr, argLen, outPtr, outLen); + ERROR_LOG_REPORT(HLE, "UNIMPL sceIoDevctl(\"%s\", %08x, %08x, %i, %08x, %i)", name, cmd, argAddr, argLen, outPtr, outLen); return 0; } @@ -930,7 +929,7 @@ u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 outPtr, DEBUG_LOG(HLE, "Returned memstick size: maxSectors=%i", deviceSize.maxSectors); return 0; } else { - ERROR_LOG(HLE, "memstick size query: bad params"); + ERROR_LOG_REPORT(HLE, "memstick size query: bad params"); return ERROR_MEMSTICK_DEVCTL_BAD_PARAMS; } diff --git a/Core/HLE/sceKernelEventFlag.cpp b/Core/HLE/sceKernelEventFlag.cpp index fa7bd94f13..fc532d10cd 100644 --- a/Core/HLE/sceKernelEventFlag.cpp +++ b/Core/HLE/sceKernelEventFlag.cpp @@ -20,6 +20,7 @@ #include "HLE.h" #include "../MIPS/MIPS.h" #include "Core/CoreTiming.h" +#include "Core/Reporting.h" #include "ChunkFile.h" #include "sceKernel.h" @@ -190,14 +191,14 @@ int sceKernelCreateEventFlag(const char *name, u32 flag_attr, u32 flag_initPatte { if (!name) { - WARN_LOG(HLE, "%08x=sceKernelCreateEventFlag(): invalid name", SCE_KERNEL_ERROR_ERROR); + WARN_LOG_REPORT(HLE, "%08x=sceKernelCreateEventFlag(): invalid name", SCE_KERNEL_ERROR_ERROR); return SCE_KERNEL_ERROR_ERROR; } // These attributes aren't valid. if ((flag_attr & 0x100) != 0 || flag_attr >= 0x300) { - WARN_LOG(HLE, "%08x=sceKernelCreateEventFlag(): invalid attr parameter: %08x", SCE_KERNEL_ERROR_ILLEGAL_ATTR, flag_attr); + WARN_LOG_REPORT(HLE, "%08x=sceKernelCreateEventFlag(): invalid attr parameter: %08x", SCE_KERNEL_ERROR_ILLEGAL_ATTR, flag_attr); return SCE_KERNEL_ERROR_ILLEGAL_ATTR; } @@ -215,9 +216,9 @@ int sceKernelCreateEventFlag(const char *name, u32 flag_attr, u32 flag_initPatte DEBUG_LOG(HLE, "%i=sceKernelCreateEventFlag(\"%s\", %08x, %08x, %08x)", id, e->nef.name, e->nef.attr, e->nef.currentPattern, optPtr); if (optPtr != 0) - WARN_LOG(HLE, "sceKernelCreateEventFlag(%s) unsupported options parameter: %08x", name, optPtr); + WARN_LOG_REPORT(HLE, "sceKernelCreateEventFlag(%s) unsupported options parameter: %08x", name, optPtr); if ((flag_attr & ~PSP_EVENT_WAITMULTIPLE) != 0) - WARN_LOG(HLE, "sceKernelCreateEventFlag(%s) unsupported attr parameter: %08x", name, flag_attr); + WARN_LOG_REPORT(HLE, "sceKernelCreateEventFlag(%s) unsupported attr parameter: %08x", name, flag_attr); return id; } @@ -382,7 +383,7 @@ int sceKernelWaitEventFlag(SceUID id, u32 bits, u32 wait, u32 outBitsPtr, u32 ti if ((wait & ~PSP_EVENT_WAITKNOWN) != 0) { - WARN_LOG(HLE, "sceKernelWaitEventFlag(%i) invalid mode parameter: %08x", id, wait); + WARN_LOG_REPORT(HLE, "sceKernelWaitEventFlag(%i) invalid mode parameter: %08x", id, wait); return SCE_KERNEL_ERROR_ILLEGAL_MODE; } // Can't wait on 0, that's guaranteed to wait forever. @@ -435,7 +436,7 @@ int sceKernelWaitEventFlagCB(SceUID id, u32 bits, u32 wait, u32 outBitsPtr, u32 if ((wait & ~PSP_EVENT_WAITKNOWN) != 0) { - WARN_LOG(HLE, "sceKernelWaitEventFlagCB(%i) invalid mode parameter: %08x", id, wait); + WARN_LOG_REPORT(HLE, "sceKernelWaitEventFlagCB(%i) invalid mode parameter: %08x", id, wait); return SCE_KERNEL_ERROR_ILLEGAL_MODE; } // Can't wait on 0, that's guaranteed to wait forever. @@ -490,13 +491,13 @@ int sceKernelPollEventFlag(SceUID id, u32 bits, u32 wait, u32 outBitsPtr, u32 ti if ((wait & ~PSP_EVENT_WAITKNOWN) != 0) { - WARN_LOG(HLE, "sceKernelPollEventFlag(%i) invalid mode parameter: %08x", id, wait); + WARN_LOG_REPORT(HLE, "sceKernelPollEventFlag(%i) invalid mode parameter: %08x", id, wait); return SCE_KERNEL_ERROR_ILLEGAL_MODE; } // Poll seems to also fail when CLEAR and CLEARALL are used together, but not wait. if ((wait & PSP_EVENT_WAITCLEAR) != 0 && (wait & PSP_EVENT_WAITCLEARALL) != 0) { - WARN_LOG(HLE, "sceKernelPollEventFlag(%i) invalid mode parameter: %08x", id, wait); + WARN_LOG_REPORT(HLE, "sceKernelPollEventFlag(%i) invalid mode parameter: %08x", id, wait); return SCE_KERNEL_ERROR_ILLEGAL_MODE; } // Can't wait on 0, it never matches. diff --git a/Core/HLE/sceKernelMbx.cpp b/Core/HLE/sceKernelMbx.cpp index b56751231e..98560a3216 100644 --- a/Core/HLE/sceKernelMbx.cpp +++ b/Core/HLE/sceKernelMbx.cpp @@ -20,6 +20,7 @@ #include "sceKernelMbx.h" #include "HLE.h" #include "Core/CoreTiming.h" +#include "Core/Reporting.h" #include "ChunkFile.h" #define SCE_KERNEL_MBA_THPRI 0x100 @@ -290,13 +291,13 @@ SceUID sceKernelCreateMbx(const char *name, u32 attr, u32 optAddr) { if (!name) { - WARN_LOG(HLE, "%08x=%s(): invalid name", SCE_KERNEL_ERROR_ERROR, __FUNCTION__); + WARN_LOG_REPORT(HLE, "%08x=sceKernelCreateMbx(): invalid name", SCE_KERNEL_ERROR_ERROR); return SCE_KERNEL_ERROR_ERROR; } // Accepts 0x000 - 0x0FF, 0x100 - 0x1FF, and 0x400 - 0x4FF. if (((attr & ~SCE_KERNEL_MBA_ATTR_KNOWN) & ~0xFF) != 0) { - WARN_LOG(HLE, "%08x=%s(): invalid attr parameter: %08x", SCE_KERNEL_ERROR_ILLEGAL_ATTR, __FUNCTION__, attr); + WARN_LOG_REPORT(HLE, "%08x=sceKernelCreateMbx(): invalid attr parameter: %08x", SCE_KERNEL_ERROR_ILLEGAL_ATTR, attr); return SCE_KERNEL_ERROR_ILLEGAL_ATTR; } @@ -314,9 +315,9 @@ SceUID sceKernelCreateMbx(const char *name, u32 attr, u32 optAddr) DEBUG_LOG(HLE, "%i=sceKernelCreateMbx(%s, %08x, %08x)", id, name, attr, optAddr); if (optAddr != 0) - WARN_LOG(HLE, "%s(%s) unsupported options parameter: %08x", __FUNCTION__, name, optAddr); + WARN_LOG_REPORT(HLE, "sceKernelCreateMbx(%s) unsupported options parameter: %08x", name, optAddr); if ((attr & ~SCE_KERNEL_MBA_ATTR_KNOWN) != 0) - WARN_LOG(HLE, "%s(%s) unsupported attr parameter: %08x", __FUNCTION__, name, attr); + WARN_LOG_REPORT(HLE, "sceKernelCreateMbx(%s) unsupported attr parameter: %08x", name, attr); return id; } diff --git a/Core/HLE/sceKernelMemory.cpp b/Core/HLE/sceKernelMemory.cpp index 921774077b..b35a280b51 100644 --- a/Core/HLE/sceKernelMemory.cpp +++ b/Core/HLE/sceKernelMemory.cpp @@ -20,7 +20,8 @@ #include "../System.h" #include "../MIPS/MIPS.h" #include "../MemMap.h" -#include "../../Core/CoreTiming.h" +#include "Core/CoreTiming.h" +#include "Core/Reporting.h" #include "sceKernel.h" #include "sceKernelThread.h" @@ -472,34 +473,34 @@ int sceKernelAllocPartitionMemory(int partition, const char *name, int type, u32 { if (name == NULL) { - WARN_LOG(HLE, "%08x=sceKernelAllocPartitionMemory(): invalid name", SCE_KERNEL_ERROR_ERROR); + WARN_LOG_REPORT(HLE, "%08x=sceKernelAllocPartitionMemory(): invalid name", SCE_KERNEL_ERROR_ERROR); return SCE_KERNEL_ERROR_ERROR; } if (size == 0) { - WARN_LOG(HLE, "%08x=sceKernelAllocPartitionMemory(): invalid size %x", SCE_KERNEL_ERROR_MEMBLOCK_ALLOC_FAILED, size); + WARN_LOG_REPORT(HLE, "%08x=sceKernelAllocPartitionMemory(): invalid size %x", SCE_KERNEL_ERROR_MEMBLOCK_ALLOC_FAILED, size); return SCE_KERNEL_ERROR_MEMBLOCK_ALLOC_FAILED; } if (partition < 1 || partition > 9 || partition == 7) { - WARN_LOG(HLE, "%08x=sceKernelAllocPartitionMemory(): invalid partition %x", SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, partition); + WARN_LOG_REPORT(HLE, "%08x=sceKernelAllocPartitionMemory(): invalid partition %x", SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, partition); return SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT; } // We only support user right now. if (partition != 2 && partition != 5 && partition != 6) { - WARN_LOG(HLE, "%08x=sceKernelAllocPartitionMemory(): invalid partition %x", SCE_KERNEL_ERROR_ILLEGAL_PARTITION, partition); + WARN_LOG_REPORT(HLE, "%08x=sceKernelAllocPartitionMemory(): invalid partition %x", SCE_KERNEL_ERROR_ILLEGAL_PARTITION, partition); return SCE_KERNEL_ERROR_ILLEGAL_PARTITION; } if (type < PSP_SMEM_Low || type > PSP_SMEM_HighAligned) { - WARN_LOG(HLE, "%08x=sceKernelAllocPartitionMemory(): invalid type %x", SCE_KERNEL_ERROR_ILLEGAL_MEMBLOCKTYPE, type); + WARN_LOG_REPORT(HLE, "%08x=sceKernelAllocPartitionMemory(): invalid type %x", SCE_KERNEL_ERROR_ILLEGAL_MEMBLOCKTYPE, type); return SCE_KERNEL_ERROR_ILLEGAL_MEMBLOCKTYPE; } // Alignment is only allowed for powers of 2. if ((type == PSP_SMEM_LowAligned || type == PSP_SMEM_HighAligned) && ((addr & (addr - 1)) != 0 || addr == 0)) { - WARN_LOG(HLE, "%08x=sceKernelAllocPartitionMemory(): invalid alignment %x", SCE_ERROR_KERNEL_ILLEGAL_ALIGNMENT_SIZE, addr); + WARN_LOG_REPORT(HLE, "%08x=sceKernelAllocPartitionMemory(): invalid alignment %x", SCE_ERROR_KERNEL_ILLEGAL_ALIGNMENT_SIZE, addr); return SCE_ERROR_KERNEL_ILLEGAL_ALIGNMENT_SIZE; } @@ -514,8 +515,6 @@ int sceKernelAllocPartitionMemory(int partition, const char *name, int type, u32 DEBUG_LOG(HLE,"%i = sceKernelAllocPartitionMemory(partition = %i, %s, type= %i, size= %i, addr= %08x)", uid, partition, name, type, size, addr); - if (type == 2) - ERROR_LOG(HLE, "ARGH! sceKernelAllocPartitionMemory wants a specific address"); return uid; } @@ -847,34 +846,34 @@ SceUID sceKernelCreateVpl(const char *name, int partition, u32 attr, u32 vplSize { if (!name) { - WARN_LOG(HLE, "%08x=sceKernelCreateVpl(): invalid name", SCE_KERNEL_ERROR_ERROR); + WARN_LOG_REPORT(HLE, "%08x=sceKernelCreateVpl(): invalid name", SCE_KERNEL_ERROR_ERROR); return SCE_KERNEL_ERROR_ERROR; } if (partition < 1 || partition > 9 || partition == 7) { - WARN_LOG(HLE, "%08x=sceKernelCreateVpl(): invalid partition %d", SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, partition); + WARN_LOG_REPORT(HLE, "%08x=sceKernelCreateVpl(): invalid partition %d", SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, partition); return SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT; } // We only support user right now. if (partition != 2 && partition != 6) { - WARN_LOG(HLE, "%08x=sceKernelCreateVpl(): invalid partition %d", SCE_KERNEL_ERROR_ILLEGAL_PERM, partition); + WARN_LOG_REPORT(HLE, "%08x=sceKernelCreateVpl(): invalid partition %d", SCE_KERNEL_ERROR_ILLEGAL_PERM, partition); return SCE_KERNEL_ERROR_ILLEGAL_PERM; } if (((attr & ~PSP_VPL_ATTR_KNOWN) & ~0xFF) != 0) { - WARN_LOG(HLE, "%08x=sceKernelCreateVpl(): invalid attr parameter: %08x", SCE_KERNEL_ERROR_ILLEGAL_ATTR, attr); + WARN_LOG_REPORT(HLE, "%08x=sceKernelCreateVpl(): invalid attr parameter: %08x", SCE_KERNEL_ERROR_ILLEGAL_ATTR, attr); return SCE_KERNEL_ERROR_ILLEGAL_ATTR; } if (vplSize == 0) { - WARN_LOG(HLE, "%08x=sceKernelCreateVpl(): invalid size", SCE_KERNEL_ERROR_ILLEGAL_MEMSIZE); + WARN_LOG_REPORT(HLE, "%08x=sceKernelCreateVpl(): invalid size", SCE_KERNEL_ERROR_ILLEGAL_MEMSIZE); return SCE_KERNEL_ERROR_ILLEGAL_MEMSIZE; } // Block Allocator seems to A-OK this, let's stop it here. if (vplSize >= 0x80000000) { - WARN_LOG(HLE, "%08x=sceKernelCreateVpl(): way too big size", SCE_KERNEL_ERROR_NO_MEMORY); + WARN_LOG_REPORT(HLE, "%08x=sceKernelCreateVpl(): way too big size", SCE_KERNEL_ERROR_NO_MEMORY); return SCE_KERNEL_ERROR_NO_MEMORY; } diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index d2f8249f2b..86340bc514 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -293,9 +293,8 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro if (*(u32*)ptr != 0x464c457f) { - ERROR_LOG(HLE, "Wrong magic number %08x",*(u32*)ptr); + ERROR_LOG_REPORT(HLE, "Wrong magic number %08x", *(u32*)ptr); *error_string = "File corrupt"; - Reporting::ReportMessage("Wrong ELF magic number %08x", *(u32*)ptr); if (newptr) { delete [] newptr; } @@ -535,21 +534,21 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro break; case NID_MODULE_START_THREAD_PARAMETER: if (Memory::Read_U32(exportAddr) != 3) - WARN_LOG(LOADER, "Strange value at module_start_thread_parameter export: %08x", Memory::Read_U32(exportAddr)); + WARN_LOG_REPORT(LOADER, "Strange value at module_start_thread_parameter export: %08x", Memory::Read_U32(exportAddr)); module->nm.module_start_thread_priority = Memory::Read_U32(exportAddr + 4); module->nm.module_start_thread_stacksize = Memory::Read_U32(exportAddr + 8); module->nm.module_start_thread_attr = Memory::Read_U32(exportAddr + 12); break; case NID_MODULE_STOP_THREAD_PARAMETER: if (Memory::Read_U32(exportAddr) != 3) - WARN_LOG(LOADER, "Strange value at module_stop_thread_parameter export: %08x", Memory::Read_U32(exportAddr)); + WARN_LOG_REPORT(LOADER, "Strange value at module_stop_thread_parameter export: %08x", Memory::Read_U32(exportAddr)); module->nm.module_stop_thread_priority = Memory::Read_U32(exportAddr + 4); module->nm.module_stop_thread_stacksize = Memory::Read_U32(exportAddr + 8); module->nm.module_stop_thread_attr = Memory::Read_U32(exportAddr + 12); break; case NID_MODULE_REBOOT_BEFORE_THREAD_PARAMETER: if (Memory::Read_U32(exportAddr) != 3) - WARN_LOG(LOADER, "Strange value at module_reboot_before_thread_parameter export: %08x", Memory::Read_U32(exportAddr)); + WARN_LOG_REPORT(LOADER, "Strange value at module_reboot_before_thread_parameter export: %08x", Memory::Read_U32(exportAddr)); module->nm.module_reboot_before_thread_priority = Memory::Read_U32(exportAddr + 4); module->nm.module_reboot_before_thread_stacksize = Memory::Read_U32(exportAddr + 8); module->nm.module_reboot_before_thread_attr = Memory::Read_U32(exportAddr + 12); @@ -667,7 +666,7 @@ void __KernelStartModule(Module *m, int args, const char *argp, SceKernelSMOptio if (m->nm.module_start_func != 0 && m->nm.module_start_func != (u32)-1) { if (m->nm.module_start_func != m->nm.entry_addr) - WARN_LOG(LOADER, "Main module has start func (%08x) different from entry (%08x)?", m->nm.module_start_func, m->nm.entry_addr); + WARN_LOG_REPORT(LOADER, "Main module has start func (%08x) different from entry (%08x)?", m->nm.module_start_func, m->nm.entry_addr); } __KernelSetupRootThread(m->GetUID(), args, argp, options->priority, options->stacksize, options->attribute); diff --git a/Core/HLE/sceKernelMutex.cpp b/Core/HLE/sceKernelMutex.cpp index 04f96a5007..bf7c4565c5 100644 --- a/Core/HLE/sceKernelMutex.cpp +++ b/Core/HLE/sceKernelMutex.cpp @@ -20,6 +20,7 @@ #include "HLE.h" #include "../MIPS/MIPS.h" #include "Core/CoreTiming.h" +#include "Core/Reporting.h" #include "ChunkFile.h" #include "sceKernel.h" #include "sceKernelMutex.h" @@ -235,12 +236,12 @@ int sceKernelCreateMutex(const char *name, u32 attr, int initialCount, u32 optio { if (!name) { - WARN_LOG(HLE, "%08x=sceKernelCreateMutex(): invalid name", SCE_KERNEL_ERROR_ERROR); + WARN_LOG_REPORT(HLE, "%08x=sceKernelCreateMutex(): invalid name", SCE_KERNEL_ERROR_ERROR); return SCE_KERNEL_ERROR_ERROR; } if (attr >= 0xC00) { - WARN_LOG(HLE, "%08x=sceKernelCreateMutex(): invalid attr parameter: %08x", SCE_KERNEL_ERROR_ILLEGAL_ATTR, attr); + WARN_LOG_REPORT(HLE, "%08x=sceKernelCreateMutex(): invalid attr parameter: %08x", SCE_KERNEL_ERROR_ILLEGAL_ATTR, attr); return SCE_KERNEL_ERROR_ILLEGAL_ATTR; } @@ -268,9 +269,9 @@ int sceKernelCreateMutex(const char *name, u32 attr, int initialCount, u32 optio DEBUG_LOG(HLE, "%i=sceKernelCreateMutex(%s, %08x, %d, %08x)", id, name, attr, initialCount, optionsPtr); if (optionsPtr != 0) - WARN_LOG(HLE, "sceKernelCreateMutex(%s) unsupported options parameter: %08x", name, optionsPtr); + WARN_LOG_REPORT(HLE, "sceKernelCreateMutex(%s) unsupported options parameter: %08x", name, optionsPtr); if ((attr & ~PSP_MUTEX_ATTR_KNOWN) != 0) - WARN_LOG(HLE, "sceKernelCreateMutex(%s) unsupported attr parameter: %08x", name, attr); + WARN_LOG_REPORT(HLE, "sceKernelCreateMutex(%s) unsupported attr parameter: %08x", name, attr); return id; } @@ -583,12 +584,12 @@ int sceKernelCreateLwMutex(u32 workareaPtr, const char *name, u32 attr, int init { if (!name) { - WARN_LOG(HLE, "%08x=sceKernelCreateLwMutex(): invalid name", SCE_KERNEL_ERROR_ERROR); + WARN_LOG_REPORT(HLE, "%08x=sceKernelCreateLwMutex(): invalid name", SCE_KERNEL_ERROR_ERROR); return SCE_KERNEL_ERROR_ERROR; } if (attr >= 0x400) { - WARN_LOG(HLE, "%08x=sceKernelCreateLwMutex(): invalid attr parameter: %08x", SCE_KERNEL_ERROR_ILLEGAL_ATTR, attr); + WARN_LOG_REPORT(HLE, "%08x=sceKernelCreateLwMutex(): invalid attr parameter: %08x", SCE_KERNEL_ERROR_ILLEGAL_ATTR, attr); return SCE_KERNEL_ERROR_ILLEGAL_ATTR; } @@ -621,9 +622,9 @@ int sceKernelCreateLwMutex(u32 workareaPtr, const char *name, u32 attr, int init DEBUG_LOG(HLE, "sceKernelCreateLwMutex(%08x, %s, %08x, %d, %08x)", workareaPtr, name, attr, initialCount, optionsPtr); if (optionsPtr != 0) - WARN_LOG(HLE, "sceKernelCreateLwMutex(%s) unsupported options parameter: %08x", name, optionsPtr); + WARN_LOG_REPORT(HLE, "sceKernelCreateLwMutex(%s) unsupported options parameter: %08x", name, optionsPtr); if ((attr & ~PSP_MUTEX_ATTR_KNOWN) != 0) - WARN_LOG(HLE, "sceKernelCreateLwMutex(%s) unsupported attr parameter: %08x", name, attr); + WARN_LOG_REPORT(HLE, "sceKernelCreateLwMutex(%s) unsupported attr parameter: %08x", name, attr); return 0; } diff --git a/Core/HLE/sceKernelSemaphore.cpp b/Core/HLE/sceKernelSemaphore.cpp index 4efdeb7cc7..2af329f7a1 100644 --- a/Core/HLE/sceKernelSemaphore.cpp +++ b/Core/HLE/sceKernelSemaphore.cpp @@ -19,6 +19,7 @@ #include "HLE.h" #include "../MIPS/MIPS.h" #include "Core/CoreTiming.h" +#include "Core/Reporting.h" #include "ChunkFile.h" #include "sceKernel.h" #include "sceKernelThread.h" @@ -172,12 +173,12 @@ int sceKernelCreateSema(const char* name, u32 attr, int initVal, int maxVal, u32 { if (!name) { - WARN_LOG(HLE, "%08x=sceKernelCreateSema(): invalid name", SCE_KERNEL_ERROR_ERROR); + WARN_LOG_REPORT(HLE, "%08x=sceKernelCreateSema(): invalid name", SCE_KERNEL_ERROR_ERROR); return SCE_KERNEL_ERROR_ERROR; } if (attr >= 0x200) { - WARN_LOG(HLE, "%08x=sceKernelCreateSema(): invalid attr parameter: %08x", SCE_KERNEL_ERROR_ILLEGAL_ATTR, attr); + WARN_LOG_REPORT(HLE, "%08x=sceKernelCreateSema(): invalid attr parameter: %08x", SCE_KERNEL_ERROR_ILLEGAL_ATTR, attr); return SCE_KERNEL_ERROR_ILLEGAL_ATTR; } @@ -196,9 +197,9 @@ int sceKernelCreateSema(const char* name, u32 attr, int initVal, int maxVal, u32 DEBUG_LOG(HLE, "%i=sceKernelCreateSema(%s, %08x, %i, %i, %08x)", id, s->ns.name, s->ns.attr, s->ns.initCount, s->ns.maxCount, optionPtr); if (optionPtr != 0) - WARN_LOG(HLE, "sceKernelCreateSema(%s) unsupported options parameter: %08x", name, optionPtr); + WARN_LOG_REPORT(HLE, "sceKernelCreateSema(%s) unsupported options parameter: %08x", name, optionPtr); if ((attr & ~PSP_SEMA_ATTR_PRIORITY) != 0) - WARN_LOG(HLE, "sceKernelCreateSema(%s) unsupported attr parameter: %08x", name, attr); + WARN_LOG_REPORT(HLE, "sceKernelCreateSema(%s) unsupported attr parameter: %08x", name, attr); return id; } diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 1b39863c08..29133da21b 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -818,8 +818,7 @@ void __KernelIdle() } else { - WARN_LOG(HLE, "UNTESTED - Callback thread deleted during interrupt?"); - Reporting::ReportMessage("Callback thread deleted during interrupt?"); + WARN_LOG_REPORT(HLE, "UNTESTED - Callback thread deleted during interrupt?"); g_inCbCount = 0; currentCallbackThreadID = 0; } @@ -1146,17 +1145,13 @@ void __KernelWaitCurThread(WaitType type, SceUID waitID, u32 waitValue, u32 time { if (!dispatchEnabled) { - WARN_LOG(HLE, "Ignoring wait, dispatching disabled... right thing to do?"); - Reporting::ReportMessage("Ignoring wait, dispatching disabled"); + WARN_LOG_REPORT(HLE, "Ignoring wait, dispatching disabled... right thing to do?"); return; } // TODO: Need to defer if in callback? if (g_inCbCount > 0) - { - WARN_LOG(HLE, "UNTESTED - waiting within a callback, probably bad mojo."); - Reporting::ReportMessage("Waiting within callback"); - } + WARN_LOG_REPORT(HLE, "UNTESTED - waiting within a callback, probably bad mojo."); Thread *thread = __GetCurrentThread(); thread->nt.waitID = waitID; @@ -1492,20 +1487,13 @@ int __KernelCreateThread(const char *threadName, SceUID moduleID, u32 entry, u32 // TODO: PSP actually fails for many of these cases, but trying for compat. if (stacksize < 0x200 || stacksize >= 0x20000000) { - WARN_LOG(HLE, "sceKernelCreateThread(name=\"%s\"): bogus stack size %08x, using 0x4000", threadName, stacksize); - Reporting::ReportMessage("sceKernelCreateThread(name=\"%s\"): bogus stack size %08x, using 0x4000", threadName, stacksize); + WARN_LOG_REPORT(HLE, "sceKernelCreateThread(name=\"%s\"): bogus stack size %08x, using 0x4000", threadName, stacksize); stacksize = 0x4000; } if (prio < 0x08 || prio > 0x77) - { - WARN_LOG(HLE, "sceKernelCreateThread(name=\"%s\"): bogus priority %08x", threadName, prio); - Reporting::ReportMessage("sceKernelCreateThread(name=\"%s\"): bogus priority %08x", threadName, prio); - } + WARN_LOG_REPORT(HLE, "sceKernelCreateThread(name=\"%s\"): bogus priority %08x", threadName, prio); if (!Memory::IsValidAddress(entry)) - { - WARN_LOG(HLE, "sceKernelCreateThread(name=\"%s\"): invalid entry %08x", threadName, entry); - Reporting::ReportMessage("sceKernelCreateThread(name=\"%s\"): invalid entry %08x", threadName, entry); - } + WARN_LOG_REPORT(HLE, "sceKernelCreateThread(name=\"%s\"): invalid entry %08x", threadName, entry); // We're assuming all threads created are user threads. if ((attr & PSP_THREAD_ATTR_KERNEL) == 0) @@ -1515,10 +1503,7 @@ int __KernelCreateThread(const char *threadName, SceUID moduleID, u32 entry, u32 __KernelCreateThread(id, moduleID, threadName, entry, prio, stacksize, attr); INFO_LOG(HLE, "%i = sceKernelCreateThread(name=\"%s\", entry=%08x, prio=%x, stacksize=%i)", id, threadName, entry, prio, stacksize); if (optionAddr != 0) - { - WARN_LOG(HLE, "sceKernelCreateThread(name=\"%s\"): unsupported options parameter %08x", threadName, optionAddr); - Reporting::ReportMessage("sceKernelCreateThread(name=\"%s\"): unsupported options parameter %08x", threadName, optionAddr); - } + WARN_LOG_REPORT(HLE, "sceKernelCreateThread(name=\"%s\"): unsupported options parameter %08x", threadName, optionAddr); return id; } @@ -1589,10 +1574,8 @@ int sceKernelStartThread(SceUID threadToStartID, u32 argSize, u32 argBlockPtr) hleReSchedule("thread started"); } else if (!dispatchEnabled) - { - WARN_LOG(HLE, "UNTESTED Dispatch disabled while starting worse-priority thread"); - Reporting::ReportMessage("UNTESTED Dispatch disabled while starting worse-priority thread"); - } + WARN_LOG_REPORT(HLE, "UNTESTED Dispatch disabled while starting worse-priority thread"); + __KernelChangeReadyState(startThread, threadToStartID, true); return 0; } @@ -2139,10 +2122,7 @@ int sceKernelReleaseWaitThread(SceUID threadID) { DEBUG_LOG(HLE, "sceKernelReleaseWaitThread(%i)", threadID); if (__KernelInCallback()) - { - WARN_LOG(HLE, "UNTESTED sceKernelReleaseWaitThread() might not do the right thing in a callback"); - Reporting::ReportMessage("sceKernelReleaseWaitThread() might not do the right thing in a callback"); - } + WARN_LOG_REPORT(HLE, "UNTESTED sceKernelReleaseWaitThread() might not do the right thing in a callback"); if (threadID == 0 || threadID == currentThread) return SCE_KERNEL_ERROR_ILLEGAL_THID; @@ -2592,7 +2572,7 @@ void __KernelExecuteMipsCallOnCurrentThread(u32 callId, bool reschedAfter) } if (g_inCbCount > 0) { - WARN_LOG(HLE, "__KernelExecuteMipsCallOnCurrentThread(): Already in a callback!"); + WARN_LOG_REPORT(HLE, "__KernelExecuteMipsCallOnCurrentThread(): Already in a callback!"); } DEBUG_LOG(HLE, "Executing mipscall %i", callId); MipsCall *call = mipsCalls.get(callId); @@ -2633,7 +2613,7 @@ void __KernelReturnFromMipsCall() u32 callId = cur->currentCallbackId; if (currentMIPS->r[MIPS_REG_CALL_ID] != callId) - WARN_LOG(HLE, "__KernelReturnFromMipsCall(): s0 is %08x != %08x", currentMIPS->r[MIPS_REG_CALL_ID], callId); + WARN_LOG_REPORT(HLE, "__KernelReturnFromMipsCall(): s0 is %08x != %08x", currentMIPS->r[MIPS_REG_CALL_ID], callId); MipsCall *call = mipsCalls.pop(callId); diff --git a/Core/HLE/sceKernelVTimer.cpp b/Core/HLE/sceKernelVTimer.cpp index 0f7e24f34c..b7f8b78406 100644 --- a/Core/HLE/sceKernelVTimer.cpp +++ b/Core/HLE/sceKernelVTimer.cpp @@ -16,6 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "Core/CoreTiming.h" +#include "Core/Reporting.h" #include "sceKernel.h" #include "sceKernelInterrupt.h" #include "sceKernelMemory.h" @@ -177,7 +178,7 @@ void __KernelVTimerInit() { u32 sceKernelCreateVTimer(const char *name, u32 optParamAddr) { DEBUG_LOG(HLE, "sceKernelCreateVTimer(%s, %08x)", name, optParamAddr); if (optParamAddr != 0) - WARN_LOG(HLE, "sceKernelCreateVTimer: unsupported options parameter %08x", optParamAddr); + WARN_LOG_REPORT(HLE, "sceKernelCreateVTimer: unsupported options parameter %08x", optParamAddr); VTimer *vtimer = new VTimer; SceUID id = kernelObjects.Create(vtimer); diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index 59f4897c5c..5be29cc8dc 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -143,8 +143,7 @@ u32 sceSasSetVoice(u32 core, int voiceNum, u32 vagAddr, int size, int loop) { u32 sceSasSetVoicePCM(u32 core, int voiceNum, u32 pcmAddr, int size, int loop) { - INFO_LOG(HLE,"sceSasSetVoicePCM(%08x, %i, %08x, %i, %i)", core, voiceNum, pcmAddr, size, loop); - Reporting::ReportMessage("sceSasSetVoicePCM(%x, %i)", core, voiceNum); + INFO_LOG_REPORT(HLE, "sceSasSetVoicePCM(%08x, %i, %08x, %i, %i)", core, voiceNum, pcmAddr, size, loop); if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0) { WARN_LOG(HLE, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); diff --git a/Core/HLE/sceUtility.cpp b/Core/HLE/sceUtility.cpp index 759a421be5..48665cc6ff 100644 --- a/Core/HLE/sceUtility.cpp +++ b/Core/HLE/sceUtility.cpp @@ -98,8 +98,7 @@ u32 sceUtilityLoadAvModule(u32 module) { if (module > 7) { - ERROR_LOG(HLE, "sceUtilityLoadAvModule(%i): invalid module id", module); - Reporting::ReportMessage("sceUtilityLoadAvModule(%i): invalid module id", module); + ERROR_LOG_REPORT(HLE, "sceUtilityLoadAvModule(%i): invalid module id", module); return SCE_ERROR_AV_MODULE_BAD_ID; } @@ -118,8 +117,7 @@ u32 sceUtilityLoadModule(u32 module) // TODO: Not all modules between 0x100 and 0x601 are valid. if (module < 0x100 || module > 0x601) { - ERROR_LOG(HLE, "sceUtilityLoadModule(%i): invalid module id", module); - Reporting::ReportMessage("sceUtilityLoadModule(%i): invalid module id", module); + ERROR_LOG_REPORT(HLE, "sceUtilityLoadModule(%i): invalid module id", module); return SCE_ERROR_MODULE_BAD_ID; } @@ -137,8 +135,7 @@ u32 sceUtilityUnloadModule(u32 module) // TODO: Not all modules between 0x100 and 0x601 are valid. if (module < 0x100 || module > 0x601) { - ERROR_LOG(HLE, "sceUtilityUnloadModule(%i): invalid module id", module); - Reporting::ReportMessage("sceUtilityUnloadModule(%i): invalid module id", module); + ERROR_LOG_REPORT(HLE, "sceUtilityUnloadModule(%i): invalid module id", module); return SCE_ERROR_MODULE_BAD_ID; } diff --git a/Core/MIPS/ARM/ArmCompVFPU.cpp b/Core/MIPS/ARM/ArmCompVFPU.cpp index db9764d9b6..51cbf5cc1c 100644 --- a/Core/MIPS/ARM/ArmCompVFPU.cpp +++ b/Core/MIPS/ARM/ArmCompVFPU.cpp @@ -117,8 +117,7 @@ namespace MIPSComp // Prefix may say "z, z, z, z" but if this is a pair, we force to x. // TODO: But some ops seem to use const 0 instead? if (regnum >= n) { - ERROR_LOG(CPU, "Invalid VFPU swizzle: %08x / %d", prefix, sz); - Reporting::ReportMessage("Invalid VFPU swizzle: %08x / %d", prefix, sz); + ERROR_LOG_REPORT(CPU, "Invalid VFPU swizzle: %08x / %d", prefix, sz); regnum = 0; } diff --git a/Core/MIPS/MIPSIntVFPU.cpp b/Core/MIPS/MIPSIntVFPU.cpp index b031c0dc00..d3bd067014 100644 --- a/Core/MIPS/MIPSIntVFPU.cpp +++ b/Core/MIPS/MIPSIntVFPU.cpp @@ -150,8 +150,7 @@ void ApplyPrefixST(float *v, u32 data, VectorSize size) // TODO: But some ops seem to use const 0 instead? if (regnum >= n) { - ERROR_LOG(CPU, "Invalid VFPU swizzle: %08x / %d", data, size); - Reporting::ReportMessage("Invalid VFPU swizzle: %08x / %d", data, size); + ERROR_LOG_REPORT(CPU, "Invalid VFPU swizzle: %08x / %d", data, size); regnum = 0; } diff --git a/Core/MIPS/x86/CompVFPU.cpp b/Core/MIPS/x86/CompVFPU.cpp index a2b0f34779..d6b3aa1ab9 100644 --- a/Core/MIPS/x86/CompVFPU.cpp +++ b/Core/MIPS/x86/CompVFPU.cpp @@ -105,8 +105,7 @@ void Jit::ApplyPrefixST(u8 *vregs, u32 prefix, VectorSize sz) { // Prefix may say "z, z, z, z" but if this is a pair, we force to x. // TODO: But some ops seem to use const 0 instead? if (regnum >= n) { - ERROR_LOG(CPU, "Invalid VFPU swizzle: %08x / %d", prefix, sz); - Reporting::ReportMessage("Invalid VFPU swizzle: %08x / %d", prefix, sz); + ERROR_LOG_REPORT(CPU, "Invalid VFPU swizzle: %08x / %d", prefix, sz); regnum = 0; } MOVSS(fpr.VX(vregs[i]), fpr.V(origV[regnum])); diff --git a/Core/Reporting.h b/Core/Reporting.h index a5ebc5baa9..62b1ee0924 100644 --- a/Core/Reporting.h +++ b/Core/Reporting.h @@ -17,6 +17,11 @@ #include "Common/CommonTypes.h" +#define ERROR_LOG_REPORT(t,...) { ERROR_LOG(t, __VA_ARGS__); Reporting::ReportMessage(__VA_ARGS__); } +#define WARN_LOG_REPORT(t,...) { WARN_LOG(t, __VA_ARGS__); Reporting::ReportMessage(__VA_ARGS__); } +#define NOTICE_LOG_REPORT(t,...) { NOTICE_LOG(t, __VA_ARGS__); Reporting::ReportMessage(__VA_ARGS__); } +#define INFO_LOG_REPORT(t,...) { INFO_LOG(t, __VA_ARGS__); Reporting::ReportMessage(__VA_ARGS__); } + namespace Reporting { bool IsEnabled(); diff --git a/GPU/GLES/TextureCache.cpp b/GPU/GLES/TextureCache.cpp index 5921aef3a9..ab3a3eb059 100644 --- a/GPU/GLES/TextureCache.cpp +++ b/GPU/GLES/TextureCache.cpp @@ -672,8 +672,7 @@ void TextureCache::SetTexture() { u32 format = gstate.texformat & 0xF; if (format >= 11) { - Reporting::ReportMessage("Unknown texture format %i", format); - ERROR_LOG(G3D, "Unknown texture format %i", format); + ERROR_LOG_REPORT(G3D, "Unknown texture format %i", format); format = 0; } bool hasClut = formatUsesClut[format]; @@ -1089,8 +1088,7 @@ void TextureCache::LoadTextureLevel(TexCacheEntry &entry, int level) break; default: - Reporting::ReportMessage("Unknown texture format %i", entry.format); - ERROR_LOG(G3D, "Unknown Texture Format %d!!!", entry.format); + ERROR_LOG_REPORT(G3D, "Unknown Texture Format %d!!!", entry.format); finalBuf = tmpTexBuf32; return; }