Adhoc questiion
Adhoc questiion
Hi Guys,
I just started playing with Adhoc between two PSPs,
and got streaming data working in both 1.50 and 3.xx,
but all sample code seems to send data in only one direction from the Server to the Client.
Clearly for a game to work, the Server PSP would need to know what's going on
with the Client PSP as well.
Is there any sample code to show data flow in both directions?
Cheers, Art.
I just started playing with Adhoc between two PSPs,
and got streaming data working in both 1.50 and 3.xx,
but all sample code seems to send data in only one direction from the Server to the Client.
Clearly for a game to work, the Server PSP would need to know what's going on
with the Client PSP as well.
Is there any sample code to show data flow in both directions?
Cheers, Art.
If not actually, then potentially.
-
- Posts: 376
- Joined: Wed May 10, 2006 11:31 pm
No idea,
The only samples I have are all similar to this loop
If there is a more efficient (faster way, I'd love to see a sample).
Maybe the updated sdk has some, but I'll never get to see those by updating. It's only ever worked the once.
The only samples I have are all similar to this loop
Code: Select all
int user_main(SceSize args, void *argp){
SetupCallbacks();
static char buffer[0x8000];
unsigned int length;
int err, bD = 0;
int i, done, mainDone, server=0;
char *data;
int size = 0;
SceCtrlData pad;
pspDebugScreenInit();
do {
if((adhocInit("") >= 0) && ((server = adhocSelect()) >=0)){
pspDebugScreenPrintf("\n\n## AdHoc INITALISED ##\n\n");
sceKernelDelayThread(1000000);
if(server)
pspDebugScreenPrintf("Server Assigned\n\n");
else
pspDebugScreenPrintf("Client Assigned\n\n");
if(server){
sceKernelDelayThread(5000000);
done = 0;
do {
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons != 0)
if(pad.Buttons & PSP_CTRL_CROSS)
done = 1;
if((i % 2) == 0){
data = ".";
i = 0;
} else
data = "|";
i++;
if(done == 1)
data = "x";
size = sizeof(data);
err = adhocSendRecvAck(&size, 4);
err = adhocSendRecvAck(&data, 4); //# send data
pspDebugScreenPrintf("%s", data);
} while(done==0);
} else {
done = 0;
do {
//sceCtrlReadBufferPositive(&pad, 1);
//if(pad.Buttons != 0)
// if(pad.Buttons & PSP_CTRL_CROSS)
// done = 1;
size = 0;
length = 4;
err = adhocRecvSendAck(&size, &length);
length = size;
err = adhocRecvSendAck(&data, &length);
data = (char *)data;
if(data == "x")
done = 1;
pspDebugScreenPrintf("%s", data);
} while(done==0);
}
}
pspDebugScreenPrintf("\n\n");
adhocTerm();
done = 0;
pspDebugScreenInit();
pspDebugScreenPrintf("\n\nPress START to Exit, X to Continue\n\n");
do {
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons != 0){
if(pad.Buttons & PSP_CTRL_START){
done = 1; mainDone=1;
sceKernelExitGame();
}
if(pad.Buttons & PSP_CTRL_CROSS)
done = 1; mainDone=0;
}
} while(!done);
} while(!mainDone);
//pspDebugScreenPrintf("Press any key to exit..\n");
//done = 0;
//do {
// sceCtrlReadBufferPositive(&pad, 1);
// if(pad.Buttons != 0)
// done = 1;
//} while(!done);
sceKernelExitGame();
}
Maybe the updated sdk has some, but I'll never get to see those by updating. It's only ever worked the once.
If not actually, then potentially.
-
- Posts: 376
- Joined: Wed May 10, 2006 11:31 pm
I think those functions are from PSPPet's original adhoc sample code, which is almost 3 years old.
You would be better to update your SDK, I've added lots of adhoc goodies over the past months.
The code from PSPPet's sample uses PDP (similar to UDP) and it is possible to send in both directions.
If I recall correctly the adhoc adhocSendRecvAck() function sends some data, then waits for a response from the receiver to acknowledge.
You also have the option of PTP, which is peer-to-peer and is perfect for two way transmission between two PSPs.
You would be better to update your SDK, I've added lots of adhoc goodies over the past months.
The code from PSPPet's sample uses PDP (similar to UDP) and it is possible to send in both directions.
If I recall correctly the adhoc adhocSendRecvAck() function sends some data, then waits for a response from the receiver to acknowledge.
You also have the option of PTP, which is peer-to-peer and is perfect for two way transmission between two PSPs.
The SDK I use is about as old as it gets, but there are some extra libs I've collected.
If I update a lot of my stuff stops working, and I only know that from a precompiled toolchain I've tried on another op system
I can't (in practice) upgrade the normal way if I wanted to (ie. sh /toolchain.sh 6 doesn't do anything).
but depending only on whether the PSP is the client or server.
If I update a lot of my stuff stops working, and I only know that from a precompiled toolchain I've tried on another op system
I can't (in practice) upgrade the normal way if I wanted to (ie. sh /toolchain.sh 6 doesn't do anything).
The adhocSendRecvAck() is being used to both send and receive in this code,f I recall correctly the adhoc adhocSendRecvAck() function sends some data, then waits for a response from the receiver to acknowledge.
but depending only on whether the PSP is the client or server.
If not actually, then potentially.
nope..Art wrote:The adhocSendRecvAck() is being used to both send and receive in this code,
but depending only on whether the PSP is the client or server.
notice to send the function is
Code: Select all
adhocSendRecvAck
Code: Select all
adhocRecvSendAck
and i also ported zorbas adhoc sample to the new sdk..
but ... you only need the old one so.. pointless to mention, w/e
take a look at zorbas sample as well, theres much to learn if you look at both.
lol, i don't think thats to hard.Art wrote:I did just notie that today ;) I was seeing the same command.
Now I suppose I need to figure out how to send other types of variables.
what im trying to do is find the perfect delay between sending two things.
you can either have lag and no loss sync, or you can have near perfect response but you can bet at some point you will loose sync.
The people here make me feel like shit :/
Way to advanced... (hate being a programming noob.)
Way to advanced... (hate being a programming noob.)
sure http://www.mediafire.com/?2mzxd5mgnnuphobox wrote:please, can you post it?pspjokeand wrote: i also ported zorbas adhoc sample to the new sdk..
The people here make me feel like shit :/
Way to advanced... (hate being a programming noob.)
Way to advanced... (hate being a programming noob.)