diff --git a/Core/ELF/ElfReader.cpp b/Core/ELF/ElfReader.cpp index 9d47e8ce5e..f495a8a4da 100644 --- a/Core/ELF/ElfReader.cpp +++ b/Core/ELF/ElfReader.cpp @@ -94,6 +94,11 @@ bool ElfReader::LoadInto(u32 loadAddress) else vaddr = userMemory.Alloc(totalSize, false, "ELF"); + if (vaddr == -1) { + ERROR_LOG(LOADER, "Failed to allocate memory for ELF!"); + return false; + } + if (bRelocate) { DEBUG_LOG(LOADER,"Relocatable module"); entryPoint += vaddr; diff --git a/Core/HLE/HLE.h b/Core/HLE/HLE.h index 171a7a2814..e7e8de026f 100644 --- a/Core/HLE/HLE.h +++ b/Core/HLE/HLE.h @@ -30,7 +30,6 @@ struct HLEFunction u32 ID; HLEFunc func; const char *name; - int minVersion; // for example: 150 for 1.5, 271 for 2.71, etc. If 0, counts as 150. }; struct HLEModule @@ -42,7 +41,7 @@ struct HLEModule struct Syscall { - char moduleName[32]; + char moduleName[32]; u32 symAddr; u32 nid; }; diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index 3e8281ddcb..ff7a38f0fb 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -150,13 +150,13 @@ void sceKernelRegisterDefaultExceptionHandler() void sceKernelSetGPO() { // Sets debug LEDs. - INFO_LOG(HLE,"sceKernelSetGPO(%02x)", PARAM(0)); + DEBUG_LOG(HLE,"sceKernelSetGPO(%02x)", PARAM(0)); } void sceKernelGetGPI() { // Always returns 0 on production systems. - INFO_LOG(HLE,"0=sceKernelGetGPI()"); + DEBUG_LOG(HLE,"0=sceKernelGetGPI()"); RETURN(0); } @@ -318,13 +318,13 @@ const HLEFunction ThreadManForUser[] = {0x17c1684e,sceKernelReferThreadStatus,"sceKernelReferThreadStatus"}, {0x2C34E053,0,"sceKernelReleaseWaitThread"}, {0x75156e8f,sceKernelResumeThread,"sceKernelResumeThread"}, - {0x27e22ec2,0,"sceKernelResumeDispatchThread"}, + {0x3ad58b8c,&WrapU_V,"sceKernelSuspendDispatchThread"}, + {0x27e22ec2,&WrapU_U,"sceKernelResumeDispatchThread"}, {0x912354a7,sceKernelRotateThreadReadyQueue,"sceKernelRotateThreadReadyQueue"}, {0x9ACE131E,sceKernelSleepThread,"sceKernelSleepThread"}, {0x82826f70,sceKernelSleepThreadCB,"sceKernelSleepThreadCB"}, {0xF475845D,&WrapU_V,"sceKernelStartThread"}, {0x9944f31f,sceKernelSuspendThread,"sceKernelSuspendThread"}, - {0x3ad58b8c,0,"sceKernelSuspendDispatchThread"}, {0x616403ba,0,"sceKernelTerminateThread"}, {0x383f7bcc,sceKernelTerminateDeleteThread,"sceKernelTerminateDeleteThread"}, {0x840E8133,sceKernelWaitThreadEndCB,"sceKernelWaitThreadEndCB"}, diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 879996780c..deb06d73e2 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -257,6 +257,9 @@ SceUID threadIdleID[2]; int eventScheduledWakeup; +bool dispatchSuspended = false; + + // This seems nasty SceUID curModule; @@ -286,6 +289,8 @@ void __KernelThreadingInit() { u32 blockSize = 4 * 4 + 4 * 2 * 3; // One 16-byte thread plus 3 8-byte "hacks" + dispatchSuspended = false; + idleThreadHackAddr = kernelMemory.Alloc(blockSize, false, "threadrethack"); // Make sure it got allocated where we expect it... at the very start of kernel RAM //CHECK_EQ(idleThreadHackAddr & 0x3FFFFFFF, 0x08000000); @@ -928,6 +933,21 @@ void sceKernelExitDeleteThread() } } +u32 sceKernelSuspendDispatchThread() +{ + u32 oldDispatchSuspended = dispatchSuspended; + dispatchSuspended = true; + DEBUG_LOG(HLE,"%i=sceKernelSuspendDispatchThread()", oldDispatchSuspended); + return oldDispatchSuspended; +} + +u32 sceKernelResumeDispatchThread(u32 suspended) +{ + u32 oldDispatchSuspended = dispatchSuspended; + dispatchSuspended = suspended; + DEBUG_LOG(HLE,"%i=sceKernelResumeDispatchThread(%i)",oldDispatchSuspended, suspended); + return oldDispatchSuspended; +} void sceKernelRotateThreadReadyQueue() { diff --git a/Core/HLE/sceKernelThread.h b/Core/HLE/sceKernelThread.h index c960798119..a9ff6316b5 100644 --- a/Core/HLE/sceKernelThread.h +++ b/Core/HLE/sceKernelThread.h @@ -36,6 +36,8 @@ void _sceKernelExitThread(); void sceKernelGetThreadId(); void sceKernelGetThreadCurrentPriority(); u32 sceKernelStartThread(); +u32 sceKernelSuspendDispatchThread(); +u32 sceKernelResumeDispatchThread(u32 suspended); void sceKernelWaitThreadEnd(); void sceKernelReferThreadStatus(); void sceKernelChangeCurrentThreadAttr(); diff --git a/Core/HLE/sceUtility.cpp b/Core/HLE/sceUtility.cpp index 956e1e4e8f..fbde6010fc 100644 --- a/Core/HLE/sceUtility.cpp +++ b/Core/HLE/sceUtility.cpp @@ -350,6 +350,33 @@ void sceUtilityOskGetStatus() } +void sceUtilityNetconfInitStart() +{ + DEBUG_LOG(HLE,"FAKE sceUtilityNetconfInitStart(%i)", PARAM(0)); + __UtilityInitStart(); +} + +void sceUtilityNetconfShutdownStart() +{ + DEBUG_LOG(HLE,"FAKE sceUtilityNetconfShutdownStart(%i)", PARAM(0)); + __UtilityShutdownStart(); + RETURN(0); +} + +void sceUtilityNetconfUpdate() +{ + DEBUG_LOG(HLE,"FAKE sceUtilityNetconfUpdate(%i)", PARAM(0)); + __UtilityUpdate(); + RETURN(0); +} + +void sceUtilityNetconfGetStatus() +{ + DEBUG_LOG(HLE,"sceUtilityNetconfGetStatus()"); + RETURN(__UtilityGetStatus()); +} + + void sceUtilityGetSystemParamString() { int id = PARAM(0); @@ -388,10 +415,10 @@ u32 sceUtilityLoadNetModule(u32 module) const HLEFunction sceUtility[] = { {0x1579a159, &WrapU_U, "sceUtilityLoadNetModule"}, - {0xf88155f6, 0, "sceUtilityNetconfShutdownStart"}, - {0x4db1e739, 0, "sceUtilityNetconfInitStart"}, - {0x91e70e35, 0, "sceUtilityNetconfUpdate"}, - {0x6332aa39, 0, "sceUtilityNetconfGetStatus"}, + {0xf88155f6, sceUtilityNetconfShutdownStart, "sceUtilityNetconfShutdownStart"}, + {0x4db1e739, sceUtilityNetconfInitStart, "sceUtilityNetconfInitStart"}, + {0x91e70e35, sceUtilityNetconfUpdate, "sceUtilityNetconfUpdate"}, + {0x6332aa39, sceUtilityNetconfGetStatus, "sceUtilityNetconfGetStatus"}, {0x67af3428, sceUtilityMsgDialogShutdownStart, "sceUtilityMsgDialogShutdownStart"}, {0x2ad8e239, sceUtilityMsgDialogInitStart, "sceUtilityMsgDialogInitStart"},