gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Multiplayer (hardware) testing

#61822 - Crs - Thu Nov 24, 2005 12:57 am

Hi folks,

Just wondering if anyone can suggest or help regarding some multiplayer functionality I have going on.

Using the NO-CASH-GBA emulator I have multiplayer working to how I would like, its not perfect but its acceptable for my game :)

The methods I am using are actually by other forum members methods I have found recently which has been a really BIG help.

I am limited to testing as far as hardware goes, I have 2*GBA's and 1*flash cartridge. So trying various things I am wanting to see "Player 2" listed (detected) as the current player.

I have tried powering on both GBA's with my game installed and the slave cable end in one gba. This will not show as player 2 which is my concern.

I would like to assume that what I see on NO-CASH-GBA will be the final result when I have my game put on cartridges, but to me it doesnt seem like the code I have requires both GBA's to have the same gamepack installed.

Some detection code I have, with permission, as follows:
Code:

   SIOCNT = 0;

   // enable multiplayer
   SIOCNT |= (1 << 13);

   // set mode multiplayer mode
   REG_RCNT = 0;
   REG_RCNT |= (1 << 14);

   // search for GBA ready signal..
   int ready = 0;

   // ready detected
   if (SIOCNT & (1<<3)) ready = 1;

   if (ready == 0)   return -1;

   // get *this* player id
   PID = (SIOCNT >> 4) & 3;

   return 0;


The function is repeatedly called if -1 is returned, should that work? Seems to in the emulator, I'm not sure, but just how does the GBA know what end of the cable is in?

Well if you know what I'm talking about I would really like to hear from you :) I appreciate your reading!

Chris.

#61823 - Miked0801 - Thu Nov 24, 2005 1:18 am

The GBA knows because the master's connection cable is a different shape than all the others. It sets a special bit somewhere when the current GBA is master/Player 1

#61864 - Crs - Thu Nov 24, 2005 9:52 am

Right, I thought it might have been something like that thanks for clearing that up Mike.

So that would suggest on hardware I should be able to show which end of the cable is attached, even without another GBA attached to the other end?

Therefore I must be doing something wrong here, can someone clue me in how I can get this working correctly? It does make it tricky when it works on emulation but not on hardware don't you think? ;)

Thanks guys.

Chris.

#62215 - Crs - Mon Nov 28, 2005 9:59 am

Hi,

I finally got myself some results by changing the bits I read from SIOCNT,

bit 2 (L) = SI-Terminal (0 - Parent, 1- Child)

bits 4-5 (D) = ID of GBA [00=master,01=slave1,10=slave2,11=slave3]

Before I was reading bits 4-5 to get the player ID (only no$gba worked with this) but I am now only checking bit 2 to identify the unit as a master or slave. This worked on all: no$gba, vba-link, hardware. (finally! :))

Now I am guessing the correct method is to read bit 2 and if it is set then continue to read bits 4-5 to get the actual ID? Since I am only working on a 2 player game I should be ok just with bit 2.

Well hopefully this info is corret and maybe it will help another in a similar situation,

Regards

Chris.

P.S. what is a good transfer rate to use in multiplayer mode? I get intermittent slow down while Im testing during 2 player mode? I am really hoping its an emulation problem (or lack of cpu) and not my actual game.

#62680 - circle7820 - Sun Dec 04, 2005 9:01 am

Miked0801 wrote:
It sets a special bit somewhere when the current GBA is master/Player 1.


Is everything like this these days?:lol:

#62718 - Miked0801 - Mon Dec 05, 2005 12:03 am

Lol - not always. The problem is, I'm one of the few who has done a bunch of MP games, but I'm busy going towards a milestone right now and the info requested is in GBATek. When people have very specific questions on MP, I try to answer.