Added some more info in Debug Log to help debugging

This commit is contained in:
ANR2ME 2020-09-07 03:21:29 +07:00
parent 2040be06e1
commit b1d6f6aa48
2 changed files with 15 additions and 2 deletions

View file

@ -645,7 +645,7 @@ static u32 sceWlanGetSwitchState() {
// Probably a void function, but often returns a useful value.
static void sceNetEtherNtostr(u32 macPtr, u32 bufferPtr) {
DEBUG_LOG(SCENET, "sceNetEtherNtostr(%08x, %08x)", macPtr, bufferPtr);
DEBUG_LOG(SCENET, "sceNetEtherNtostr(%08x, %08x) at %08x", macPtr, bufferPtr, currentMIPS->pc);
if (Memory::IsValidAddress(bufferPtr) && Memory::IsValidAddress(macPtr)) {
char *buffer = (char *)Memory::GetPointer(bufferPtr);

View file

@ -1953,7 +1953,7 @@ int sceNetAdhocctlTerm() {
}
static int sceNetAdhocctlGetNameByAddr(const char *mac, u32 nameAddr) {
DEBUG_LOG(SCENET, "UNTESTED sceNetAdhocctlGetNameByAddr(%s, %08x)", mac2str((SceNetEtherAddr*)mac).c_str(), nameAddr);
DEBUG_LOG(SCENET, "UNTESTED sceNetAdhocctlGetNameByAddr(%s, %08x) at %08x", mac2str((SceNetEtherAddr*)mac).c_str(), nameAddr, currentMIPS->pc);
// Library initialized
if (netAdhocctlInited)
@ -5043,9 +5043,17 @@ void broadcastHelloMessage(SceNetAdhocMatchingContext * context)
// Hello Data Length (have to memcpy this to avoid cpu alignment crash)
memcpy(hello + 1, &context->hellolen, sizeof(context->hellolen));
// FIXME: When using JPCSP + prx files the data being sent have a header of 12 bytes instead of 5 bytes:
// [01(always 1? size of the next data? or combined with next byte as U16_BE opcode?) 01(matching opcode, or combined with previous byte as U16_BE opcode?) 01 E0(size of next data + hello data in big-endian/U16_BE) 00 0F 42 40(U32_BE? time?) 00 0F 42 40(U32_BE? time?)],
// followed by hello data (0x1D8 bytes of opt data, based on Ys vs. Sora no Kiseki), and followed by 16 bytes of (optional?) footer [01 00 00 .. 00 00](footer doesn't exist if the size after opcode is 00 00)
// Copy Hello Data
if (context->hellolen > 0) memcpy(hello + 5, context->hello, context->hellolen);
std::string hellohex;
DataToHexString(" ", 0, context->hello, context->hellolen, &hellohex);
DEBUG_LOG(SCENET, "HELLO Dump:\n%s", hellohex.c_str());
// Send Broadcast
context->socketlock->lock();
sceNetAdhocPdpSend(context->socket, (const char*)(SceNetEtherAddr *)broadcastMAC, context->port, hello, 5 + context->hellolen, 0, ADHOC_F_NONBLOCK);
@ -5472,6 +5480,10 @@ void actOnHelloPacket(SceNetAdhocMatchingContext * context, SceNetEtherAddr * se
// Peer available now
if (peer != NULL && peer->state != PSP_ADHOC_MATCHING_PEER_OUTGOING_REQUEST && peer->state != PSP_ADHOC_MATCHING_PEER_INCOMING_REQUEST)
{
std::string hellohex;
DataToHexString(" ", 0, (u8*)opt, optlen, &hellohex);
DEBUG_LOG(SCENET, "HELLO Dump:\n%s", hellohex.c_str());
// Spawn Hello Event. FIXME: HELLO event should not be triggered in the middle of joining? This will cause Bleach 7 to Cancel the join request
spawnLocalEvent(context, PSP_ADHOC_MATCHING_EVENT_HELLO, sendermac, optlen, opt);
}
@ -6210,6 +6222,7 @@ int matchingInputThread(int matchingId) // TODO: The MatchingInput thread is usi
}
// Receive PDP Datagram
// FIXME: When using JPCSP + prx files, the "SceNetAdhocMatchingInput" thread is using blocking PdpRecv with infinite(0) timeout, which can be stopped/aborted using SetSocketAlert, while "SceNetAdhocMatchingEvent" thread is using non-blocking for sending
rxbuflen = context->rxbuflen;
senderport = 0;
context->socketlock->lock();