Disable reporting for some thread funcs.

We know they are misused and it's not giving us extra information.
This commit is contained in:
Unknown W. Brackets 2015-03-28 14:28:51 -07:00
parent 0edfb75bfb
commit fc3d6ff04a

View file

@ -1046,8 +1046,7 @@ static void __KernelSleepBeginCallback(SceUID threadID, SceUID prevCallbackId) {
static void __KernelSleepEndCallback(SceUID threadID, SceUID prevCallbackId) { static void __KernelSleepEndCallback(SceUID threadID, SceUID prevCallbackId) {
u32 error; u32 error;
Thread *thread = kernelObjects.Get<Thread>(threadID, error); Thread *thread = kernelObjects.Get<Thread>(threadID, error);
if (!thread) if (!thread) {
{
// This probably should not happen. // This probably should not happen.
WARN_LOG_REPORT(SCEKERNEL, "sceKernelSleepThreadCB: thread deleted?"); WARN_LOG_REPORT(SCEKERNEL, "sceKernelSleepThreadCB: thread deleted?");
return; return;
@ -2273,7 +2272,7 @@ int sceKernelGetThreadStackFreeSize(SceUID threadID)
DEBUG_LOG(SCEKERNEL, "sceKernelGetThreadStackFreeSize(%i)", threadID); DEBUG_LOG(SCEKERNEL, "sceKernelGetThreadStackFreeSize(%i)", threadID);
if (threadID == 0) if (threadID == 0)
threadID = currentThread; threadID = __KernelGetCurThread();
u32 error; u32 error;
Thread *thread = kernelObjects.Get<Thread>(threadID, error); Thread *thread = kernelObjects.Get<Thread>(threadID, error);
@ -2544,34 +2543,28 @@ SceUID sceKernelGetThreadId()
return currentThread; return currentThread;
} }
int sceKernelGetThreadCurrentPriority() int sceKernelGetThreadCurrentPriority() {
{
u32 retVal = __GetCurrentThread()->nt.currentPriority; u32 retVal = __GetCurrentThread()->nt.currentPriority;
DEBUG_LOG(SCEKERNEL,"%i = sceKernelGetThreadCurrentPriority()", retVal); return hleLogSuccessI(SCEKERNEL, retVal);
return retVal;
} }
int sceKernelChangeCurrentThreadAttr(u32 clearAttr, u32 setAttr) int sceKernelChangeCurrentThreadAttr(u32 clearAttr, u32 setAttr) {
{
// Seems like this is the only allowed attribute? // Seems like this is the only allowed attribute?
if ((clearAttr & ~PSP_THREAD_ATTR_VFPU) != 0 || (setAttr & ~PSP_THREAD_ATTR_VFPU) != 0) if ((clearAttr & ~PSP_THREAD_ATTR_VFPU) != 0 || (setAttr & ~PSP_THREAD_ATTR_VFPU) != 0) {
{ return hleReportError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "invalid attr");
ERROR_LOG_REPORT(SCEKERNEL, "sceKernelChangeCurrentThreadAttr(clear = %08x, set = %08x): invalid attr", clearAttr, setAttr);
return SCE_KERNEL_ERROR_ILLEGAL_ATTR;
} }
DEBUG_LOG(SCEKERNEL, "0 = sceKernelChangeCurrentThreadAttr(clear = %08x, set = %08x)", clearAttr, setAttr);
Thread *t = __GetCurrentThread(); Thread *t = __GetCurrentThread();
if (t) if (!t)
return hleReportError(SCEKERNEL, -1, "no current thread");
t->nt.attr = (t->nt.attr & ~clearAttr) | setAttr; t->nt.attr = (t->nt.attr & ~clearAttr) | setAttr;
else return hleLogSuccessI(SCEKERNEL, 0);
ERROR_LOG_REPORT(SCEKERNEL, "%s(): No current thread?", __FUNCTION__);
return 0;
} }
int sceKernelChangeThreadPriority(SceUID threadID, int priority) { int sceKernelChangeThreadPriority(SceUID threadID, int priority) {
if (threadID == 0) { if (threadID == 0) {
threadID = currentThread; threadID = __KernelGetCurThread();
} }
// 0 means the current (running) thread's priority, not target's. // 0 means the current (running) thread's priority, not target's.
@ -2588,17 +2581,13 @@ int sceKernelChangeThreadPriority(SceUID threadID, int priority) {
Thread *thread = kernelObjects.Get<Thread>(threadID, error); Thread *thread = kernelObjects.Get<Thread>(threadID, error);
if (thread) { if (thread) {
if (thread->isStopped()) { if (thread->isStopped()) {
ERROR_LOG_REPORT(SCEKERNEL, "sceKernelChangeThreadPriority(%i, %i): thread is dormant", threadID, priority); return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_DORMANT, "thread is dormant");
return SCE_KERNEL_ERROR_DORMANT;
} }
if (priority < 0x08 || priority > 0x77) { if (priority < 0x08 || priority > 0x77) {
ERROR_LOG_REPORT(SCEKERNEL, "sceKernelChangeThreadPriority(%i, %i): bogus priority", threadID, priority); return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_PRIORITY, "bogus priority");
return SCE_KERNEL_ERROR_ILLEGAL_PRIORITY;
} }
DEBUG_LOG(SCEKERNEL, "sceKernelChangeThreadPriority(%i, %i)", threadID, priority);
int old = thread->nt.currentPriority; int old = thread->nt.currentPriority;
threadReadyQueue.remove(old, threadID); threadReadyQueue.remove(old, threadID);
@ -2613,10 +2602,10 @@ int sceKernelChangeThreadPriority(SceUID threadID, int priority) {
hleEatCycles(450); hleEatCycles(450);
hleReSchedule("change thread priority"); hleReSchedule("change thread priority");
return 0;
return hleLogSuccessI(SCEKERNEL, 0);
} else { } else {
ERROR_LOG(SCEKERNEL, "%08x=sceKernelChangeThreadPriority(%i, %i) failed - no such thread", error, threadID, priority); return hleLogError(SCEKERNEL, error, "thread not found");
return error;
} }
} }
@ -2709,78 +2698,66 @@ bool __KernelThreadSortPriority(SceUID thread1, SceUID thread2)
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// WAIT/SLEEP ETC // WAIT/SLEEP ETC
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
int sceKernelWakeupThread(SceUID uid) int sceKernelWakeupThread(SceUID uid) {
{ if (uid == currentThread) {
if (uid == currentThread) return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_THID, "unable to wakeup current thread");
{
WARN_LOG_REPORT(SCEKERNEL, "sceKernelWakeupThread(%i): unable to wakeup current thread", uid);
return SCE_KERNEL_ERROR_ILLEGAL_THID;
} }
u32 error; u32 error;
Thread *t = kernelObjects.Get<Thread>(uid, error); Thread *t = kernelObjects.Get<Thread>(uid, error);
if (t) if (t) {
{
if (!t->isWaitingFor(WAITTYPE_SLEEP, 0)) { if (!t->isWaitingFor(WAITTYPE_SLEEP, 0)) {
t->nt.wakeupCount++; t->nt.wakeupCount++;
DEBUG_LOG(SCEKERNEL,"sceKernelWakeupThread(%i) - wakeupCount incremented to %i", uid, t->nt.wakeupCount); return hleLogSuccessI(SCEKERNEL, 0, "wakeupCount incremented to %i", t->nt.wakeupCount);
} else { } else {
VERBOSE_LOG(SCEKERNEL,"sceKernelWakeupThread(%i) - woke thread at %i", uid, t->nt.wakeupCount);
__KernelResumeThreadFromWait(uid, 0); __KernelResumeThreadFromWait(uid, 0);
hleReSchedule("thread woken up"); hleReSchedule("thread woken up");
return hleLogSuccessVerboseI(SCEKERNEL, 0, "woke thread at %i", t->nt.wakeupCount);
} }
return 0; } else {
} return hleLogError(SCEKERNEL, error, "bad thread id");
else {
ERROR_LOG(SCEKERNEL,"sceKernelWakeupThread(%i) - bad thread id", uid);
return error;
} }
} }
int sceKernelCancelWakeupThread(SceUID uid) int sceKernelCancelWakeupThread(SceUID uid) {
{ if (uid == 0) {
uid = __KernelGetCurThread();
}
u32 error; u32 error;
if (uid == 0) uid = __KernelGetCurThread();
Thread *t = kernelObjects.Get<Thread>(uid, error); Thread *t = kernelObjects.Get<Thread>(uid, error);
if (t) if (t) {
{
int wCount = t->nt.wakeupCount; int wCount = t->nt.wakeupCount;
t->nt.wakeupCount = 0; t->nt.wakeupCount = 0;
DEBUG_LOG(SCEKERNEL,"sceKernelCancelWakeupThread(%i) - wakeupCount reset from %i", uid, wCount); return hleLogSuccessI(SCEKERNEL, wCount, "wakeupCount reset to 0");
return wCount; } else {
} return hleLogError(SCEKERNEL, error, "bad thread id");
else {
ERROR_LOG(SCEKERNEL,"sceKernelCancelWakeupThread(%i) - bad thread id", uid);
return error;
} }
} }
static int __KernelSleepThread(bool doCallbacks) { static int __KernelSleepThread(bool doCallbacks) {
Thread *thread = __GetCurrentThread(); Thread *thread = __GetCurrentThread();
if (!thread) { if (!thread) {
ERROR_LOG(SCEKERNEL, "sceKernelSleepThread*(): bad current thread"); ERROR_LOG_REPORT(SCEKERNEL, "sceKernelSleepThread*(): bad current thread");
return -1; return -1;
} }
if (thread->nt.wakeupCount > 0) { if (thread->nt.wakeupCount > 0) {
thread->nt.wakeupCount--; thread->nt.wakeupCount--;
DEBUG_LOG(SCEKERNEL, "sceKernelSleepThread() - wakeupCount decremented to %i", thread->nt.wakeupCount); return hleLogSuccessI(SCEKERNEL, 0, "wakeupCount decremented to %i", thread->nt.wakeupCount);
} else { } else {
VERBOSE_LOG(SCEKERNEL, "sceKernelSleepThread()");
__KernelWaitCurThread(WAITTYPE_SLEEP, 0, 0, 0, doCallbacks, "thread slept"); __KernelWaitCurThread(WAITTYPE_SLEEP, 0, 0, 0, doCallbacks, "thread slept");
return hleLogSuccessVerboseI(SCEKERNEL, 0, "sleeping");
} }
return 0; return 0;
} }
int sceKernelSleepThread() int sceKernelSleepThread() {
{
return __KernelSleepThread(false); return __KernelSleepThread(false);
} }
//the homebrew PollCallbacks //the homebrew PollCallbacks
int sceKernelSleepThreadCB() int sceKernelSleepThreadCB() {
{
VERBOSE_LOG(SCEKERNEL, "sceKernelSleepThreadCB()");
return __KernelSleepThread(true); return __KernelSleepThread(true);
} }