Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
syscall function parameter
#1
const HLEFunction sceNetAdhocctl[] =
{
{...}, {...},
{0x20B317A0, WrapI_UU<sceNetAdhocctlAddHandler>, "sceNetAdhocctlAddHandler"},
...,
{...},
}
typedef void(* sceNetAdhocctlHandler)(int flag, int error, void *unknown);

int sceNetAdhocctlAddHandler(u32 handler, u32 unknown)
{
netActHandler = (sceNetAdhocctlHandler)Memory::GetPointer(handler);
netActParam=(void*)unknown;
// I know this function is not here call, just test
if (netActHandler)
netActHandler(3, 0, netActParam); // this will break when debug
return 0; //return Handler id on success, < 0 on error.
}

Parameter handler point to function is not compile???
How to make it run well?

My English is not good, don't dispute my grammar.
Reply
#2
It's a MIPS function, not a C function. You can't call it directly. It doesn't have ARM/Intel instructions at that memory address.

Instead, it needs to bail into emulation. For example, using __KernelCallAddress. But you probably need to do something after it is called too. Look for example at sceFont.cpp, which also calls handlers.

-[Unknown]
Reply
#3
It seems the handler is used as a callback function whenever the network connection state of an adhoc connection has changed.

The state is obtained by calling sceNetAdhocctlGetState(int *event);

Possible connection states:

PSP_NET_APCTL_STATE_DISCONNECTED 0
PSP_NET_APCTL_STATE_SCANNING 1
PSP_NET_APCTL_STATE_JOINING 2
PSP_NET_APCTL_STATE_GETTING_IP 3
PSP_NET_APCTL_STATE_GOT_IP 4
PSP_NET_APCTL_STATE_EAP_AUTH 5
PSP_NET_APCTL_STATE_KEY_EXCHANGE 6
Reply
#4
(05-28-2013, 06:04 AM)[Unknown] Wrote: It's a MIPS function, not a C function. You can't call it directly. It doesn't have ARM/Intel instructions at that memory address.

Instead, it needs to bail into emulation. For example, using __KernelCallAddress. But you probably need to do something after it is called too. Look for example at sceFont.cpp, which also calls handlers.

-[Unknown]
Think you!Big Grin
Reply


Forum Jump: