diff --git a/Core/Dialog/PSPNetconfDialog.cpp b/Core/Dialog/PSPNetconfDialog.cpp index 8211bb474c..1ce932f197 100644 --- a/Core/Dialog/PSPNetconfDialog.cpp +++ b/Core/Dialog/PSPNetconfDialog.cpp @@ -219,13 +219,13 @@ int PSPNetconfDialog::Update(int animSpeed) { { case NETCONF_CREATE_ADHOC: if (connResult < 0) { - connResult = sceNetAdhocctlCreate(request.NetconfData->groupName); + connResult = hleCall(sceNetAdhocctl, int, sceNetAdhocctlCreate, request.NetconfData->groupName); } break; case NETCONF_JOIN_ADHOC: // FIXME: Should we Scan for a matching group first before Joining a Group (like adhoc games normally do)? Or Is it really allowed to join non-existing group? if (scanStep == 0) { - if (sceNetAdhocctlScan() >= 0) { + if (hleCall(sceNetAdhocctl, int, sceNetAdhocctlScan) >= 0) { u32 structsz = sizeof(ScanInfos); if (Memory::IsValidAddress(scanInfosAddr)) userMemory.Free(scanInfosAddr); @@ -237,7 +237,7 @@ int PSPNetconfDialog::Update(int animSpeed) { else if (scanStep == 1) { s32 sz = Memory::Read_U32(scanInfosAddr); // Get required buffer size - if (sceNetAdhocctlGetScanInfo(scanInfosAddr, 0) >= 0) { + if (hleCall(sceNetAdhocctl, int, sceNetAdhocctlGetScanInfo, scanInfosAddr, 0) >= 0) { s32 reqsz = Memory::Read_U32(scanInfosAddr); if (reqsz > sz) { sz = reqsz; @@ -248,7 +248,7 @@ int PSPNetconfDialog::Update(int animSpeed) { Memory::Write_U32(sz, scanInfosAddr); } if (reqsz > 0) { - if (sceNetAdhocctlGetScanInfo(scanInfosAddr, scanInfosAddr + sizeof(s32)) >= 0) { + if (hleCall(sceNetAdhocctl, int, sceNetAdhocctlGetScanInfo, scanInfosAddr, scanInfosAddr + (u32)sizeof(s32)) >= 0) { ScanInfos* scanInfos = (ScanInfos*)Memory::GetPointer(scanInfosAddr); int n = scanInfos->sz / sizeof(SceNetAdhocctlScanInfoEmu); // Assuming returned SceNetAdhocctlScanInfoEmu(s) are contagious where next is pointing to current addr + sizeof(SceNetAdhocctlScanInfoEmu) @@ -276,7 +276,7 @@ int PSPNetconfDialog::Update(int animSpeed) { } else if (scanStep == 2) { if (connResult < 0) { - connResult = sceNetAdhocctlJoin(scanInfosAddr + sizeof(s32)); + connResult = hleCall(sceNetAdhocctl, int, sceNetAdhocctlJoin, scanInfosAddr + (u32)sizeof(s32)); if (connResult >= 0) { // We are done! if (Memory::IsValidAddress(scanInfosAddr)) @@ -288,7 +288,7 @@ int PSPNetconfDialog::Update(int animSpeed) { break; default: if (connResult < 0) { - connResult = sceNetAdhocctlConnect(request.NetconfData->groupName); + connResult = hleCall(sceNetAdhocctl, int, sceNetAdhocctlConnect, request.NetconfData->groupName); } break; } diff --git a/Core/HLE/HLE.cpp b/Core/HLE/HLE.cpp index c2ca785ba3..95da66ab55 100644 --- a/Core/HLE/HLE.cpp +++ b/Core/HLE/HLE.cpp @@ -476,7 +476,7 @@ void hleEnqueueCall(u32 func, int argc, const u32 *argv, PSPAction *afterAction) void hleFlushCalls() { u32 &sp = currentMIPS->r[MIPS_REG_SP]; PSPPointer stackData; - _dbg_assert_(g_stackSize > 0); + _dbg_assert_(g_stackSize == 0); VERBOSE_LOG(Log::HLE, "Flushing %d HLE mips calls from %s, sp=%08x", (int)enqueuedMipsCalls.size(), g_stackSize ? g_stack[0]->name : "?", sp); // First, we'll add a marker for the final return. @@ -843,10 +843,12 @@ void CallSyscall(MIPSOpcode op) { void hlePushFuncDesc(std::string_view module, std::string_view funcName) { const HLEModule *mod = GetModuleByName(module); + _dbg_assert_(mod != nullptr); if (!mod) { return; } const HLEFunction *func = GetFuncByName(mod, funcName); + _dbg_assert_(func != nullptr); // Push to the stack. g_stack[g_stackSize++] = func; } diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index 3cdbb0de69..46790ccbf0 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -2599,7 +2599,7 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out // Everything OK. f->npdrm = true; f->pgdInfo->data_offset += f->pgd_offset; - return 0; + return hleLogDebug(Log::sceIo, 0); } break; } @@ -2764,11 +2764,11 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out // Position is in sectors, don't forget. if (newPos < 0 || newPos > f->FileInfo().size) { // Not allowed to seek past the end of the file with this API. - return SCE_KERNEL_ERROR_ERRNO_INVALID_FILE_SIZE; + return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_ERRNO_INVALID_FILE_SIZE); } pspFileSystem.SeekFile(f->handle, (s32)seekInfo->offset, seek); } else { - return SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT; + return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT); } break; @@ -2782,12 +2782,12 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out Reporting::ReportMessage(temp, f->fullpath.c_str(), indataPtr, inlen, outdataPtr, outlen); ERROR_LOG(Log::sceIo, "UNIMPL 0=sceIoIoctl id: %08x, cmd %08x, indataPtr %08x, inlen %08x, outdataPtr %08x, outLen %08x", id,cmd,indataPtr,inlen,outdataPtr,outlen); } - return result; + return hleLogSuccessOrError(Log::sceIo, result); } break; } - return 0; + return hleLogDebug(Log::sceIo, 0); } u32 sceIoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen) diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index d230f53707..c4e479c495 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -1544,8 +1544,7 @@ static u32 sceMpegRingbufferPut(u32 ringbufferAddr, int numPackets, int availabl auto ringbuffer = PSPPointer::Create(ringbufferAddr); if (!ringbuffer.IsValid()) { // Would have crashed before, TODO test behavior. - ERROR_LOG_REPORT(Log::ME, "sceMpegRingbufferPut(%08x, %i, %i): invalid ringbuffer address", ringbufferAddr, numPackets, available); - return -1; + return hleLogError(Log::ME, -1, "invalid ringbuffer address"); } numPackets = std::min(numPackets, available); @@ -1553,14 +1552,12 @@ static u32 sceMpegRingbufferPut(u32 ringbufferAddr, int numPackets, int availabl // Seems still need to check actual available, Patapon 3 for example. numPackets = std::min(numPackets, ringbuffer->packets - ringbuffer->packetsAvail); if (numPackets <= 0) { - DEBUG_LOG(Log::ME, "sceMpegRingbufferPut(%08x, %i, %i): no packets to enqueue", ringbufferAddr, numPackets, available); - return 0; + return hleLogDebug(Log::ME, 0, "no packets to enqueue"); } MpegContext *ctx = getMpegCtx(ringbuffer->mpeg); if (!ctx) { - WARN_LOG(Log::ME, "sceMpegRingbufferPut(%08x, %i, %i): bad mpeg handle %08x", ringbufferAddr, numPackets, available, ringbuffer->mpeg); - return -1; + return hleLogWarning(Log::ME, -1, "bad mpeg handle %08x", ringbuffer->mpeg); } ringbufferPutPacketsAdded = 0; // Execute callback function as a direct MipsCall, no blocking here so no messing around with wait states etc @@ -1588,29 +1585,26 @@ static u32 sceMpegRingbufferPut(u32 ringbufferAddr, int numPackets, int availabl } else { ERROR_LOG_REPORT(Log::ME, "sceMpegRingbufferPut: callback_addr zero"); } - return 0; + return hleNoLog(0); } static int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(Log::ME, "sceMpegGetAvcAu(%08x, %08x, %08x, %08x): bad mpeg handle", mpeg, streamId, auAddr, attrAddr); - return -1; + return hleLogError(Log::ME, -1, "bad mpeg handle"); } auto ringbuffer = PSPPointer::Create(ctx->mpegRingbufferAddr); if (!ringbuffer.IsValid()) { // Would have crashed before, TODO test behavior. - ERROR_LOG_REPORT(Log::ME, "sceMpegGetAvcAu(%08x, %08x, %08x, %08x): invalid ringbuffer address", mpeg, streamId, auAddr, attrAddr); - return -1; + return hleLogError(Log::ME, -1, "invalid ringbuffer address"); } if (PSP_CoreParameter().compat.flags().MpegAvcWarmUp) { if (ctx->mpegwarmUp == 0) { - DEBUG_LOG(Log::ME, "sceMpegGetAvcAu(%08x, %08x, %08x, %08x): warming up", mpeg, streamId, auAddr, attrAddr); ctx->mpegwarmUp++; - return ERROR_MPEG_NO_DATA; + return hleLogDebug(Log::ME, ERROR_MPEG_NO_DATA, "warming up (%d)", ctx->mpegwarmUp); } } @@ -1627,8 +1621,7 @@ static int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) auto streamInfo = ctx->streamMap.find(streamId); if (streamInfo == ctx->streamMap.end()) { - WARN_LOG_REPORT(Log::ME, "sceMpegGetAvcAu: invalid video stream %08x", streamId); - return -1; + return hleLogWarning(Log::ME, -1, "invalid video stream %08x", streamId); } if (streamInfo->second.needsReset) { diff --git a/Core/HLE/sceNet.cpp b/Core/HLE/sceNet.cpp index 015706e16a..b4ea9e8c23 100644 --- a/Core/HLE/sceNet.cpp +++ b/Core/HLE/sceNet.cpp @@ -635,11 +635,15 @@ void __NetApctlCallbacks() } // Similar to Adhocctl, new State might need to be set after delayed, right before executing the mipscall (ie. simulated beforeAction) ScheduleApctlState(event, newState, delayus, "apctl callback state"); + hleNoLogVoid(); return; } // Must be delayed long enough whenever there is a pending callback to make sure previous callback & it's afterAction are fully executed - sceKernelDelayThread(delayus); + + hleCall(ThreadManForUser, int, sceKernelDelayThread, delayus); + + hleNoLogVoid(); } static inline u32 AllocUser(u32 size, bool fromTop, const char *name) { @@ -1270,7 +1274,7 @@ int sceNetApctlConnect(int confId) { // Is this confId is the index to the scanning's result data or sceNetApctlGetBSSDescIDListUser result? netApctlInfoId = confId; // Note: We're borrowing AdhocServer for Grouping purpose, so we can simulate Broadcast over the internet just like Adhoc's pro-online implementation - int ret = sceNetAdhocctlConnect("INFRA"); + int ret = hleCall(sceNetAdhocctl, int, sceNetAdhocctlConnect, "INFRA"); if (netApctlState == PSP_NET_APCTL_STATE_DISCONNECTED) __UpdateApctlHandlers(0, PSP_NET_APCTL_STATE_JOINING, PSP_NET_APCTL_EVENT_CONNECT_REQUEST, 0); @@ -1481,12 +1485,14 @@ static int sceNetApctlDelInternalHandler(u32 handlerID) { static int sceNetApctl_A7BB73DF(u32 handlerPtr, u32 handlerArg) { ERROR_LOG(Log::sceNet, "UNIMPL %s(%08x, %08x)", __FUNCTION__, handlerPtr, handlerArg); // This seems to be a 3rd kind of handler + // Simple forward, don't need to use hleCall return sceNetApctlAddHandler(handlerPtr, handlerArg); } static int sceNetApctl_6F5D2981(u32 handlerID) { ERROR_LOG(Log::sceNet, "UNIMPL %s(%i)", __FUNCTION__, handlerID); // This seems to be a 3rd kind of handler + // Simple forward, don't need to use hleCall return sceNetApctlDelHandler(handlerID); } @@ -1496,6 +1502,7 @@ static int sceNetApctl_lib2_69745F0A(int handlerId) { static int sceNetApctl_lib2_4C19731F(int code, u32 pInfoAddr) { ERROR_LOG(Log::sceNet, "UNIMPL %s(%i, %08x)", __FUNCTION__, code, pInfoAddr); + // Simple forward, don't need to use hleCall return sceNetApctlGetInfo(code, pInfoAddr); } @@ -1515,6 +1522,7 @@ static int sceNetApctlGetBSSDescEntry(int entryId, int infoId, u32 resultAddr) { static int sceNetApctl_lib2_C20A144C(int connIndex, u32 ps3MacAddressPtr) { ERROR_LOG(Log::sceNet, "UNIMPL %s(%i, %08x)", __FUNCTION__, connIndex, ps3MacAddressPtr); + // Simple forward, don't need to use hleCall return sceNetApctlConnect(connIndex); } diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index aca973f955..87f483f8c7 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -1349,11 +1349,11 @@ int sceNetAdhocctlGetState(u32 ptrToStatus) { int sceNetAdhocPdpCreate(const char *mac, int port, int bufferSize, u32 flag) { INFO_LOG(Log::sceNet, "sceNetAdhocPdpCreate(%s, %u, %u, %u) at %08x", mac2str((SceNetEtherAddr*)mac).c_str(), port, bufferSize, flag, currentMIPS->pc); if (!g_Config.bEnableWlan) { - return -1; + return hleLogError(Log::sceNet, -1, "WLAN"); } if (!netInited) - return 0x800201CA; //PSP_LWMUTEX_ERROR_NO_SUCH_LWMUTEX; + return hleLogError(Log::sceNet, 0x800201CA); //PSP_LWMUTEX_ERROR_NO_SUCH_LWMUTEX; // Library is initialized SceNetEtherAddr * saddr = (SceNetEtherAddr *)mac; @@ -1517,7 +1517,7 @@ static int sceNetAdhocctlGetParameter(u32 paramAddr) { parameter.nickname.data[ADHOCCTL_NICKNAME_LEN - 1] = 0; DEBUG_LOG(Log::sceNet, "sceNetAdhocctlGetParameter(%08x) [Ch=%i][Group=%s][BSSID=%s][name=%s]", paramAddr, parameter.channel, grpName, mac2str(¶meter.bssid.mac_addr).c_str(), parameter.nickname.data); if (!g_Config.bEnableWlan) { - return ERROR_NET_ADHOCCTL_DISCONNECTED; + return hleLogError(Log::sceNet, ERROR_NET_ADHOCCTL_DISCONNECTED); } // Library initialized @@ -1552,7 +1552,7 @@ int sceNetAdhocPdpSend(int id, const char *mac, u32 port, void *data, int len, i VERBOSE_LOG(Log::sceNet, "sceNetAdhocPdpSend(%i, %s, %i, %p, %i, %i, %i) at %08x", id, mac2str((SceNetEtherAddr*)mac).c_str(), port, data, len, timeout, flag, currentMIPS->pc); } if (!g_Config.bEnableWlan) { - return -1; + return hleLogError(Log::sceNet, -1); } SceNetEtherAddr * daddr = (SceNetEtherAddr *)mac; uint16_t dport = (uint16_t)port; @@ -1776,7 +1776,7 @@ int sceNetAdhocPdpRecv(int id, void *addr, void * port, void *buf, void *dataLen } if (!g_Config.bEnableWlan) { - return -1; + return hleLogError(Log::sceNet, -1); } SceNetEtherAddr *saddr = (SceNetEtherAddr *)addr; @@ -2252,7 +2252,7 @@ static int sceNetAdhocctlGetAdhocId(u32 productStructAddr) { int sceNetAdhocctlScan() { INFO_LOG(Log::sceNet, "sceNetAdhocctlScan() at %08x", currentMIPS->pc); if (!g_Config.bEnableWlan) { - return -1; + return hleLogError(Log::sceNet, -1, "WLAN off"); } // Library initialized @@ -2310,7 +2310,7 @@ int sceNetAdhocctlGetScanInfo(u32 sizeAddr, u32 bufAddr) { INFO_LOG(Log::sceNet, "sceNetAdhocctlGetScanInfo([%08x]=%i, %08x) at %08x", sizeAddr, Memory::Read_U32(sizeAddr), bufAddr, currentMIPS->pc); if (!g_Config.bEnableWlan) { - return 0; + return hleLogWarning(Log::sceNet, 0, "WLAN off"); } // Library initialized @@ -2684,7 +2684,7 @@ static int sceNetAdhocctlGetNameByAddr(const char *mac, u32 nameAddr) { int sceNetAdhocctlGetPeerInfo(const char *mac, int size, u32 peerInfoAddr) { VERBOSE_LOG(Log::sceNet, "sceNetAdhocctlGetPeerInfo(%s, %i, %08x) at %08x", mac2str((SceNetEtherAddr*)mac).c_str(), size, peerInfoAddr, currentMIPS->pc); if (!g_Config.bEnableWlan) { - return -1; + return hleLogError(Log::sceNet, -1); } SceNetEtherAddr * maddr = (SceNetEtherAddr *)mac; @@ -2825,7 +2825,7 @@ int sceNetAdhocctlCreate(const char *groupName) { memcpy(grpName, groupName, ADHOCCTL_GROUPNAME_LEN); // For logging purpose, must not be truncated INFO_LOG(Log::sceNet, "sceNetAdhocctlCreate(%s) at %08x", grpName, currentMIPS->pc); if (!g_Config.bEnableWlan) { - return -1; + return hleLogError(Log::sceNet, -1, "WLAN off"); } adhocctlCurrentMode = ADHOCCTL_MODE_NORMAL; @@ -2839,7 +2839,7 @@ int sceNetAdhocctlConnect(const char* groupName) { strncpy(grpName, groupName, ADHOCCTL_GROUPNAME_LEN); // For logging purpose, must not be truncated INFO_LOG(Log::sceNet, "sceNetAdhocctlConnect(%s) at %08x", grpName, currentMIPS->pc); if (!g_Config.bEnableWlan) { - return -1; + return hleLogError(Log::sceNet, -1, "WLAN off"); } adhocctlCurrentMode = ADHOCCTL_MODE_NORMAL; @@ -3348,7 +3348,7 @@ int RecreatePtpSocket(int ptpId) { static int sceNetAdhocPtpOpen(const char *srcmac, int sport, const char *dstmac, int dport, int bufsize, int rexmt_int, int rexmt_cnt, int flag) { INFO_LOG(Log::sceNet, "sceNetAdhocPtpOpen(%s, %d, %s, %d, %d, %d, %d, %d) at %08x", mac2str((SceNetEtherAddr*)srcmac).c_str(), sport, mac2str((SceNetEtherAddr*)dstmac).c_str(),dport,bufsize, rexmt_int, rexmt_cnt, flag, currentMIPS->pc); if (!g_Config.bEnableWlan) { - return -1; + return hleLogError(Log::sceNet, -1, "WLAN off"); } SceNetEtherAddr* saddr = (SceNetEtherAddr*)srcmac; SceNetEtherAddr* daddr = (SceNetEtherAddr*)dstmac; @@ -3655,7 +3655,7 @@ static int sceNetAdhocPtpAccept(int id, u32 peerMacAddrPtr, u32 peerPortPtr, int VERBOSE_LOG(Log::sceNet, "sceNetAdhocPtpAccept(%d, [%08x]=%s, [%08x]=%u, %d, %u) at %08x", id, peerMacAddrPtr, mac2str(addr).c_str(), peerPortPtr, port ? *port : -1, timeout, flag, currentMIPS->pc); } if (!g_Config.bEnableWlan) { - return -1; + return hleLogError(Log::sceNet, -1, "WLAN off"); } // Library is initialized @@ -3868,7 +3868,7 @@ int NetAdhocPtp_Connect(int id, int timeout, int flag, bool allowForcedConnect) static int sceNetAdhocPtpConnect(int id, int timeout, int flag) { INFO_LOG(Log::sceNet, "sceNetAdhocPtpConnect(%i, %i, %i) at %08x", id, timeout, flag, currentMIPS->pc); if (!g_Config.bEnableWlan) { - return -1; + return hleLogError(Log::sceNet, -1, "WLAN off"); } return NetAdhocPtp_Connect(id, timeout, flag); @@ -3926,7 +3926,7 @@ int NetAdhocPtp_Close(int id, int unknown) { static int sceNetAdhocPtpClose(int id, int unknown) { INFO_LOG(Log::sceNet,"sceNetAdhocPtpClose(%d,%d) at %08x",id,unknown,currentMIPS->pc); /*if (!g_Config.bEnableWlan) { - return 0; + return hleLogError(Log::sceNet, -1, "WLAN off"); }*/ return NetAdhocPtp_Close(id, unknown); @@ -3947,7 +3947,7 @@ static int sceNetAdhocPtpClose(int id, int unknown) { static int sceNetAdhocPtpListen(const char *srcmac, int sport, int bufsize, int rexmt_int, int rexmt_cnt, int backlog, int flag) { INFO_LOG(Log::sceNet, "sceNetAdhocPtpListen(%s, %d, %d, %d, %d, %d, %d) at %08x", mac2str((SceNetEtherAddr*)srcmac).c_str(), sport,bufsize,rexmt_int,rexmt_cnt,backlog,flag, currentMIPS->pc); if (!g_Config.bEnableWlan) { - return -1; + return hleLogError(Log::sceNet, -1, "WLAN off"); } // Library is initialized SceNetEtherAddr * saddr = (SceNetEtherAddr *)srcmac; @@ -4712,13 +4712,13 @@ void __NetTriggerCallbacks() newState = ADHOCCTL_STATE_DISCONNECTED; delayus = adhocDefaultDelay; // Tekken 5 expects AdhocctlDisconnect to be done within ~17ms (a frame?) break; - case ADHOCCTL_EVENT_GAME: + case ADHOCCTL_EVENT_GAME: { newState = ADHOCCTL_STATE_GAMEMODE; delayus = adhocEventDelay; // TODO: Use blocking PTP connection to sync the timing just like official prx did (which is done before notifying user-defined Adhocctl Handlers) // Workaround: Extra delay to prevent Joining player to progress faster than the Creator on Pocket Pool, but unbalanced delays could cause an issue on Shaun White Snowboarding :( - if (adhocConnectionType == ADHOC_JOIN) + if (adhocConnectionType == ADHOC_JOIN) delayus += adhocExtraDelay * 3; // Shows player list INFO_LOG(Log::sceNet, "GameMode - All players have joined:"); @@ -4756,7 +4756,7 @@ void __NetTriggerCallbacks() } // Must be delayed long enough whenever there is a pending callback. Should it be 100-500ms for Adhocctl Events? or Not Less than the delays on sceNetAdhocctl HLE? - sceKernelDelayThread(adhocDefaultDelay); + hleCall(ThreadManForUser, int, sceKernelDelayThread, adhocDefaultDelay); } const HLEFunction sceNetAdhoc[] = { @@ -4841,7 +4841,7 @@ static int sceNetAdhocctlGetPeerList(u32 sizeAddr, u32 bufAddr) { DEBUG_LOG(Log::sceNet, "sceNetAdhocctlGetPeerList([%08x]=%i, %08x) at %08x", sizeAddr, /*buflen ? *buflen : -1*/Memory::Read_U32(sizeAddr), bufAddr, currentMIPS->pc); if (!g_Config.bEnableWlan) { - return -1; + return hleLogError(Log::sceNet, -1, "WLAN off"); } // Initialized Library diff --git a/Core/HLE/sceNetAdhocMatching.cpp b/Core/HLE/sceNetAdhocMatching.cpp index c2be59ad9e..db19e97b17 100644 --- a/Core/HLE/sceNetAdhocMatching.cpp +++ b/Core/HLE/sceNetAdhocMatching.cpp @@ -1737,7 +1737,7 @@ int sceNetAdhocMatchingTerm() { static int sceNetAdhocMatchingCreate(int mode, int maxnum, int port, int rxbuflen, int hello_int, int keepalive_int, int init_count, int rexmt_int, u32 callbackAddr) { WARN_LOG(Log::sceNet, "sceNetAdhocMatchingCreate(mode=%i, maxnum=%i, port=%i, rxbuflen=%i, hello=%i, keepalive=%i, initcount=%i, rexmt=%i, callbackAddr=%08x) at %08x", mode, maxnum, port, rxbuflen, hello_int, keepalive_int, init_count, rexmt_int, callbackAddr, currentMIPS->pc); if (!g_Config.bEnableWlan) { - return -1; + return hleLogError(Log::sceNet, -1, "WLAN off"); } SceNetAdhocMatchingHandler handler; @@ -1910,8 +1910,9 @@ int NetAdhocMatching_Start(int matchingId, int evthPri, int evthPartitionId, int // This should be similar with sceNetAdhocMatchingStart2 but using USER_PARTITION_ID (2) for PartitionId params static int sceNetAdhocMatchingStart(int matchingId, int evthPri, int evthStack, int inthPri, int inthStack, int optLen, u32 optDataAddr) { WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingStart(%i, %i, %i, %i, %i, %i, %08x) at %08x", matchingId, evthPri, evthStack, inthPri, inthStack, optLen, optDataAddr, currentMIPS->pc); - if (!g_Config.bEnableWlan) - return -1; + if (!g_Config.bEnableWlan) { + return hleLogError(Log::sceNet, -1, "WLAN off"); + } int retval = NetAdhocMatching_Start(matchingId, evthPri, USER_PARTITION_ID, evthStack, inthPri, USER_PARTITION_ID, inthStack, optLen, optDataAddr); // Give a little time to make sure matching Threads are ready before the game use the next sceNet functions, should've checked for status instead of guessing the time? @@ -1922,8 +1923,9 @@ static int sceNetAdhocMatchingStart(int matchingId, int evthPri, int evthStack, // With params for Partition ID for the event & input handler stack static int sceNetAdhocMatchingStart2(int matchingId, int evthPri, int evthPartitionId, int evthStack, int inthPri, int inthPartitionId, int inthStack, int optLen, u32 optDataAddr) { WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingStart2(%i, %i, %i, %i, %i, %i, %i, %i, %08x) at %08x", matchingId, evthPri, evthPartitionId, evthStack, inthPri, inthPartitionId, inthStack, optLen, optDataAddr, currentMIPS->pc); - if (!g_Config.bEnableWlan) - return -1; + if (!g_Config.bEnableWlan) { + return hleLogError(Log::sceNet, -1, "WLAN off"); + } int retval = NetAdhocMatching_Start(matchingId, evthPri, evthPartitionId, evthStack, inthPri, inthPartitionId, inthStack, optLen, optDataAddr); // Give a little time to make sure matching Threads are ready before the game use the next sceNet functions, should've checked for status instead of guessing the time? @@ -1933,8 +1935,9 @@ static int sceNetAdhocMatchingStart2(int matchingId, int evthPri, int evthPartit static int sceNetAdhocMatchingSelectTarget(int matchingId, const char *macAddress, int optLen, u32 optDataPtr) { WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingSelectTarget(%i, %s, %i, %08x) at %08x", matchingId, mac2str((SceNetEtherAddr*)macAddress).c_str(), optLen, optDataPtr, currentMIPS->pc); - if (!g_Config.bEnableWlan) - return -1; + if (!g_Config.bEnableWlan) { + return hleLogError(Log::sceNet, -1, "WLAN off"); + } if (!netAdhocMatchingInited) { // Uninitialized Library @@ -2139,24 +2142,29 @@ int NetAdhocMatching_CancelTargetWithOpt(int matchingId, const char* macAddress, int sceNetAdhocMatchingCancelTargetWithOpt(int matchingId, const char *macAddress, int optLen, u32 optDataPtr) { WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingCancelTargetWithOpt(%i, %s, %i, %08x) at %08x", matchingId, mac2str((SceNetEtherAddr*)macAddress).c_str(), optLen, optDataPtr, currentMIPS->pc); - if (!g_Config.bEnableWlan) - return -1; + if (!g_Config.bEnableWlan) { + return hleLogError(Log::sceNet, -1, "WLAN off"); + } return NetAdhocMatching_CancelTargetWithOpt(matchingId, macAddress, optLen, optDataPtr); } int sceNetAdhocMatchingCancelTarget(int matchingId, const char *macAddress) { WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingCancelTarget(%i, %s)", matchingId, mac2str((SceNetEtherAddr*)macAddress).c_str()); - if (!g_Config.bEnableWlan) - return -1; + if (!g_Config.bEnableWlan) { + return hleLogError(Log::sceNet, -1, "WLAN off"); + } return NetAdhocMatching_CancelTargetWithOpt(matchingId, macAddress, 0, 0); } int sceNetAdhocMatchingGetHelloOpt(int matchingId, u32 optLenAddr, u32 optDataAddr) { WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingGetHelloOpt(%i, %08x, %08x)", matchingId, optLenAddr, optDataAddr); - if (!g_Config.bEnableWlan) - return -1; + if (!g_Config.bEnableWlan) { + return hleLogError(Log::sceNet, -1, "WLAN off"); + } - if (!Memory::IsValidAddress(optLenAddr)) return ERROR_NET_ADHOC_MATCHING_INVALID_ARG; + if (!Memory::IsValidAddress(optLenAddr)) { + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_INVALID_ARG); + } s32_le *optlen = PSPPointer::Create(optLenAddr); @@ -2184,8 +2192,9 @@ int sceNetAdhocMatchingGetHelloOpt(int matchingId, u32 optLenAddr, u32 optDataAd int sceNetAdhocMatchingSetHelloOpt(int matchingId, int optLenAddr, u32 optDataAddr) { VERBOSE_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingSetHelloOpt(%i, %i, %08x) at %08x", matchingId, optLenAddr, optDataAddr, currentMIPS->pc); - if (!g_Config.bEnableWlan) - return -1; + if (!g_Config.bEnableWlan) { + return hleLogError(Log::sceNet, -1, "WLAN off"); + } if (!netAdhocMatchingInited) return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_MATCHING_NOT_INITIALIZED, "adhocmatching not initialized"); @@ -2255,8 +2264,9 @@ int sceNetAdhocMatchingSetHelloOpt(int matchingId, int optLenAddr, u32 optDataAd static int sceNetAdhocMatchingGetMembers(int matchingId, u32 sizeAddr, u32 buf) { DEBUG_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingGetMembers(%i, [%08x]=%i, %08x) at %08x", matchingId, sizeAddr, Memory::Read_U32(sizeAddr), buf, currentMIPS->pc); - if (!g_Config.bEnableWlan) - return -1; + if (!g_Config.bEnableWlan) { + return hleLogError(Log::sceNet, -1, "WLAN off"); + } if (!netAdhocMatchingInited) return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_MATCHING_NOT_INITIALIZED, "adhocmatching not initialized"); @@ -2449,8 +2459,9 @@ static int sceNetAdhocMatchingGetMembers(int matchingId, u32 sizeAddr, u32 buf) // Gran Turismo may replace the 1st bit of the 1st byte of MAC address's OUI with 0 (unicast bit), or replace the whole 6-bytes of MAC address with all 00 (invalid mac) for unknown reason int sceNetAdhocMatchingSendData(int matchingId, const char *mac, int dataLen, u32 dataAddr) { WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingSendData(%i, %s, %i, %08x) at %08x", matchingId, mac2str((SceNetEtherAddr*)mac).c_str(), dataLen, dataAddr, currentMIPS->pc); - if (!g_Config.bEnableWlan) - return -1; + if (!g_Config.bEnableWlan) { + return hleLogError(Log::sceNet, -1, "WLAN off"); + } if (!netAdhocMatchingInited) { // Uninitialized Library @@ -2516,8 +2527,9 @@ int sceNetAdhocMatchingSendData(int matchingId, const char *mac, int dataLen, u3 int sceNetAdhocMatchingAbortSendData(int matchingId, const char *mac) { WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingAbortSendData(%i, %s)", matchingId, mac2str((SceNetEtherAddr*)mac).c_str()); - if (!g_Config.bEnableWlan) - return -1; + if (!g_Config.bEnableWlan) { + return hleLogError(Log::sceNet, -1, "WLAN off"); + } if (!netAdhocMatchingInited) { // Uninitialized Library @@ -2566,8 +2578,9 @@ int sceNetAdhocMatchingAbortSendData(int matchingId, const char *mac) { // Get the maximum memory usage by the matching library static int sceNetAdhocMatchingGetPoolMaxAlloc() { ERROR_LOG(Log::sceNet, "UNIMPL sceNetAdhocMatchingGetPoolMaxAlloc() at %08x", currentMIPS->pc); - if (!g_Config.bEnableWlan) - return -1; + if (!g_Config.bEnableWlan) { + return hleLogError(Log::sceNet, -1, "WLAN off"); + } // Lazy way out - hardcoded return value return hleLogDebug(Log::sceNet, fakePoolSize / 2, "faked value"); @@ -2575,8 +2588,9 @@ static int sceNetAdhocMatchingGetPoolMaxAlloc() { int sceNetAdhocMatchingGetPoolStat(u32 poolstatPtr) { DEBUG_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingGetPoolStat(%08x) at %08x", poolstatPtr, currentMIPS->pc); - if (!g_Config.bEnableWlan) - return -1; + if (!g_Config.bEnableWlan) { + return hleLogError(Log::sceNet, -1, "WLAN off"); + } if (!netAdhocMatchingInited) { // Uninitialized Library @@ -2635,7 +2649,7 @@ void __NetMatchingCallbacks() { //(int matchingId) } // Must be delayed long enough whenever there is a pending callback. Should it be 10-100ms for Matching Events? or Not Less than the delays on sceNetAdhocMatching HLE? - sceKernelDelayThreadCB(delayus); + hleCall(ThreadManForUser, int, sceKernelDelayThread, delayus); } diff --git a/Core/HLE/sceNp.cpp b/Core/HLE/sceNp.cpp index b5534b9026..f528828ed4 100644 --- a/Core/HLE/sceNp.cpp +++ b/Core/HLE/sceNp.cpp @@ -195,11 +195,10 @@ static int sceNpGetOnlineId(u32 idPtr) return hleLogWarning(Log::sceNet, 0, "Online ID: %s", id->data); } -int NpGetNpId(SceNpId* npid) -{ +int NpGetNpId(SceNpId* npid) { // Callers make sure that the rest of npid is zero filled, which takes care of the terminator. strncpy(npid->handle.data, npOnlineId.c_str(), sizeof(npid->handle.data)); - return hleLogDebug(Log::sceNet, 0); + return 0; } static int sceNpGetNpId(u32 idPtr) diff --git a/Core/HLE/scePower.cpp b/Core/HLE/scePower.cpp index 68fe3fde78..7c324081ce 100644 --- a/Core/HLE/scePower.cpp +++ b/Core/HLE/scePower.cpp @@ -480,7 +480,7 @@ static u32 scePowerSetClockFrequency(u32 pllfreq, u32 cpufreq, u32 busfreq) { else if ((newPll == 266 && oldPll == 333) || (newPll == 333 && oldPll == 266)) usec = 16600; - return hleDelayResult(0, "scepower set clockFrequency", usec); + return hleDelayResult(hleNoLog(0), "scepower set clockFrequency", usec); } if (GetLockedCPUSpeedMhz() <= 0) CoreTiming::SetClockFrequencyHz(PowerCpuMhzToHz(cpufreq, pllFreq)); diff --git a/Core/HLE/scePsmf.cpp b/Core/HLE/scePsmf.cpp index 970b4fa2d2..693e2612f7 100644 --- a/Core/HLE/scePsmf.cpp +++ b/Core/HLE/scePsmf.cpp @@ -1154,8 +1154,7 @@ static int scePsmfPlayerCreate(u32 psmfPlayer, u32 dataPtr) { int delayUs = 20000; DelayPsmfStateChange(psmfPlayer, PSMF_PLAYER_STATUS_INIT, delayUs); - INFO_LOG(Log::ME, "psmfplayer create, psmfPlayerLibVersion 0x%0x, psmfPlayerLibcrc %x", psmfPlayerLibVersion, psmfPlayerLibcrc); - return hleDelayResult(0, "player create", delayUs); + return hleDelayResult(hleLogSuccessInfoI(Log::ME, 0, "psmfplayer create, psmfPlayerLibVersion 0x%0x, psmfPlayerLibcrc %x", psmfPlayerLibVersion, psmfPlayerLibcrc), "player create", delayUs); } static int scePsmfPlayerStop(u32 psmfPlayer) {