![]() |
Benvenuto Visitatore ( Log In | Registrati )
![]() |
![]()
Messaggio
#1
|
|
Utente GBARL ![]() Gruppo: Membri Messaggi: 17 Iscritto il: Wed 19 May 2004 - 17:40 Utente Nr.: 684 Feedback: 0 (0%) ![]() |
scusate, e possibile giocare con il visula boy advance,in sistem link,inserendo l'ip del computer di un amico?l'opzione c'e' mi da una porta 55555 qualcuno sa dirmi gli eventuali parametri?grazie
|
|
|
![]() |
![]()
Messaggio
#2
|
|
![]() Fanatic GBA/NDS ![]() Gruppo: Banned Lamer Messaggi: 843 Iscritto il: Wed 21 January 2004 - 18:59 Utente Nr.: 44 Feedback: 1 (100%) ![]() |
Ma, veramente quando si possa usare non saprei, ma quello che posso dire che non riesco a capire come funzioni, ho questo esempio, scaricato da gbadev, e dopo alcune ore non capisco come funzioni il gba link, ti riporto il codice
CITAZIONE void ExchangePackets(u16 outPacket) { u16 myPlayerNumber = EWRAM[0xc5]; if (myPlayerNumber == 0) { // IF WE'RE THE MASTER while(SIOCNT & SIO_ACTIVE) { } // wait until the bus is not active SIODATA = outPacket; // post our data SIOCNT = SIO_MP115200 | SIO_ACTIVE | SIO_IRQ; // initiate the transfer } else { // IF NOT THE MASTER SIODATA = outPacket; // just post our data while(!(SIOCNT & SIO_ACTIVE)) { } // then wait until the bus becomes active } while(SIOCNT & SIO_ACTIVE) { } // wait until it's done SIODATA = outPacket; // repost our packet, in case of timing problems } void ExchangeStructs(int totalPlayers) { u16 sender,receiver,totalResponses,totalPackets,inPacketNumber,currentPacketNumber,i nPacket; u8* targetStruct; u8 inData; u16 outPacket = 0xFFFF; // 0xFFFF is the "null" code for the IO Bus u16 myPlayerNumber = EWRAM[0xc5]; // loop through all the players so they can update everyone's copy of their mpData Struct for (sender=0; sender<totalPlayers; sender++ ) { // figure out which mpData struct we're targeting and get its size if (sender==0) { totalPackets = sizeof(mpData0); targetStruct = (u8*)&mpData0; } else if (sender==1) { totalPackets = sizeof(mpData1); targetStruct = (u8*)&mpData1; } else if (sender==2) { totalPackets = sizeof(mpData2); targetStruct = (u8*)&mpData2; } else { totalPackets = sizeof(mpData3); targetStruct = (u8*)&mpData3; } // get ready to send or receive currentPacketNumber = 0; if (myPlayerNumber == sender) { // if we are the sender while (currentPacketNumber < totalPackets) { // iterate across our mpData and send it a byte at a time // encode the packet: the 1st 8 bits contain the packetNumber, and 9-16 contain the data outPacket = (currentPacketNumber<<8) + *(targetStruct+currentPacketNumber); totalResponses = 0; // wait for everyone to say they are ready by posting the packet back to you while (totalResponses < totalPlayers) { totalResponses = 0; ExchangePackets(outPacket); for (receiver=0; receiver<totalPlayers; receiver++ ) { inPacket = SIOMPRECV[receiver]; if (inPacket == outPacket) { totalResponses++; } } } // move on to the next packet currentPacketNumber++; } } else { // we are a receiver while (currentPacketNumber < totalPackets) { ExchangePackets(outPacket); inPacket = SIOMPRECV[sender]; inPacketNumber = (inPacket >> 8); inData = (u8)inPacket; // if it's the next packet we need, then grab it if (inPacketNumber == currentPacketNumber) { // grab our data *(targetStruct+inPacketNumber) = inData; // then let the sender know that we got it outPacket = inPacket; currentPacketNumber++; } } // send our packets out one last time to make sure the // master got our final confirmation ExchangePackets(outPacket); } } } Sinceramente non capisco quando il master dopo aver trasmesso si ritrovi sul suo buffer (SIOMPRECV) lo stesso valore trasmesso e dopo ritrasmettendo si trovi il valore dell'altro gba. Quando e' che l'altro gba puo' trasmettere? ![]() ![]() ![]() -------------------- |
|
|
![]() ![]() |
![]() |
Versione Lo-Fi | Oggi è il: Thu 3 July 2025- 19:35 |