Ejemplo n.º 1
0
Archivo: pif.c Proyecto: cxd4/mupen86
void update_pif_read()
{
   int i=0, channel=0;
#ifdef DEBUG_PIF
   printf("read\n");
   print_pif();
#endif
   while (i<0x40)
     {
	switch(PIF_RAMb[i])
	  {
	   case 0x00:
	     channel++;
	     if (channel > 6) i=0x40;
	     break;
	   case 0xFE:
	     i = 0x40;
	     break;
	   case 0xFF:
	     break;
	   case 0xB4:
	   case 0x56:
	   case 0xB8:
	     break;
	   default:
	     if (!(PIF_RAMb[i] & 0xC0))
	       {
		  if (channel < 4)
		    {
		       if (Controls[channel].Present && 
			   Controls[channel].RawData)
			 readController(channel, &PIF_RAMb[i]);
		       else
			 internal_ReadController(channel, &PIF_RAMb[i]);
		    }
		  i += PIF_RAMb[i] + (PIF_RAMb[(i+1)] & 0x3F) + 1;
		  channel++;
	       }
	     else
	       i=0x40;
	  }
	i++;
     }
   readController(-1, NULL);
#ifdef DEBUG_PIF
   print_pif();
#endif
}
Ejemplo n.º 2
0
void update_pif_read()
{
   int i=0, channel=0;
#ifdef DEBUG_PIF
   printf("read\n");
   print_pif();
#endif
   while (i<0x40)
     {
	switch(PIF_RAMb[i])
	  {
	   case 0x00:
	     channel++;
	     if (channel > 6) i=0x40;
	     break;
	   case 0xFE:
	     i = 0x40;
	     break;
	   case 0xFF:
	     break;
	   case 0xB4:
	   case 0x56:
	   case 0xB8:
	     break;
	   default:
    #ifdef __WIN32__           
    if (KailleraRunningGame)
      {
                       
       if (!(PIF_RAMb[i] & 0xC0))
  	   {
       
         
	  	 if (channel == 0)
         {
                

                getKeys(0,&NetPlayKeys);
                NetPlayInformation[0].KailleraMessageType = 0x01;
			    NetPlayInformation[0].KailleraMessage = NetPlayKeys.Value;
                NetPlayKeys.Value = 0x00;
                KailleraModifyPlayValues(NetPlayInformation,5);
               
				
          }
         
        
		  if (channel < 4 && Controls[channel].Present)
		  {

                       if (NetPlayInformation[channel].KailleraMessageType == 0x01)
                       {
                                                                                    
                          NetPlayKeys.Value = NetPlayInformation[channel].KailleraMessage;
                       }
                       else { NetPlayKeys.Value = 0x0000; }
                       // VCR_getKeys(channel, &NetPlayKeys);
                       *((unsigned long *)(&PIF_RAMb[i] + 3)) =  NetPlayKeys.Value;
		  }
		  
		  i += PIF_RAMb[i] + (PIF_RAMb[(i+1)] & 0x3F) + 1;
       
		  channel++;
       }
       
       else
       {
            
             i=0x40;
       }
    } 
    else 
    {
    #endif     
	     if (!(PIF_RAMb[i] & 0xC0))
	       {
		  if (channel < 4)
		    {
		       if (Controls[channel].Present && 
			   Controls[channel].RawData)
			 readController(channel, &PIF_RAMb[i]);
		       else
			 internal_ReadController(channel, &PIF_RAMb[i]);
		    }
		  i += PIF_RAMb[i] + (PIF_RAMb[(i+1)] & 0x3F) + 1;
		  channel++;
	       }
	     else
	       i=0x40;
	  }
	#ifdef __WIN32__  
    }
    #endif  
	i++;
   }
   readController(-1, NULL);
#ifdef DEBUG_PIF
   print_pif();
#endif
}