示例#1
0
void HandleMouse(int X, int Y, int State)
{
	if (lastKeyTouch)
	{
		KBD_RES(lastKeyTouch);
		return;
	}
    int J;
    int Flags = State ? 0:CON_RELEASE;
    for(J=0;TouchMap[J].W;++J)
      if((X>=TouchMap[J].X)&&(Y>=TouchMap[J].Y))
        if((X<TouchMap[J].X+TouchMap[J].W)&&(Y<TouchMap[J].Y+TouchMap[J].H))
        {
          if (State)
          {
            KBD_SET(TouchMap[J].KeyCode);
          }
          else
          {
            KBD_RES(TouchMap[J].KeyCode);
          }
          break;
        }
}
示例#2
0
void retro_run(void)
{
   int i;
   bool updated = false;

   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
      check_variables();

   input_poll_cb();

   for (i=0; i < 130; i++)
      KBD_RES(i);

   for (i=0; i < sizeof(keymap)/sizeof(keymap_t); i++)
      if (input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0, keymap[i].retro))
         KBD_SET(keymap[i].fmsx);

   joystate = 0;

   for (i = 0; i < sizeof(joymap) / sizeof(keymap_t); i++)
   {
	   if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, joymap[i].retro))
	   {
		   if (i < joy_keyboard_begin)
			   JOY_SET(joymap[i].fmsx);
		   else
			   KBD_SET(joymap[i].fmsx);
	   }
   }

   RETRO_PERFORMANCE_INIT(core_retro_run);
   RETRO_PERFORMANCE_START(core_retro_run);

   RunZ80(&CPU);
   RenderAndPlayAudio(SND_RATE / 60);

   RETRO_PERFORMANCE_STOP(core_retro_run);

   fflush(stdout);

#ifdef PSP
   static unsigned int __attribute__((aligned(16))) d_list[32];
   void* const texture_vram_p = (void*) (0x44200000 - (640 * 480)); // max VRAM address - frame size

   sceKernelDcacheWritebackRange(XBuf, 256*240 );
   sceGuStart(GU_DIRECT, d_list);
   sceGuCopyImage(GU_PSM_5650, 0, 0, image_buffer_width, image_buffer_height, image_buffer_width, image_buffer, 0, 0, image_buffer_width, texture_vram_p);

   sceGuTexSync();
   sceGuTexImage(0, 512, 256, image_buffer_width, texture_vram_p);
   sceGuTexMode(GU_PSM_5650, 0, 0, GU_FALSE);
   sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGB);
   sceGuDisable(GU_BLEND);
   sceGuFinish();

   video_cb(texture_vram_p, image_buffer_width, image_buffer_height, image_buffer_width * sizeof(uint16_t));
#else
   video_cb(image_buffer, image_buffer_width, image_buffer_height, image_buffer_width * sizeof(uint16_t));
#endif



}
示例#3
0
void HandleKeys(unsigned int Key)
{
  if(InMenu||CPU.Trace) return;

  if(Key&CON_RELEASE)
    switch(Key&CON_KEYCODE)
    {
    case KEYCODE_F9:
	case KEYCODE_PG_UP:
        if(FastForward)
        {
          BPSSetEffects(UseEffects);
          UPeriod=FastForward;
          FastForward=0;
        }
        break;

	case KEYCODE_Q:
	case KEYCODE_CAPITAL_Q:          KBD_RES(KBD_ON);KeyReady=1;break;
	case KEYCODE_F1:		         KBD_RES(KBD_F1);KeyReady=1;break;
	case KEYCODE_F2:		         KBD_RES(KBD_F2);KeyReady=1;break;
	case KEYCODE_F3:		         KBD_RES(KBD_F3);KeyReady=1;break;
	case KEYCODE_F4:		         KBD_RES(KBD_F4);KeyReady=1;break;
	case KEYCODE_F5:		         KBD_RES(KBD_F5);KeyReady=1;break;
	case KEYCODE_RETURN:
	case KEYCODE_KP_ENTER: 		     KBD_RES(KBD_ENTER);KeyReady=1;break;
	case KEYCODE_LEFT_SHIFT:
	case KEYCODE_RIGHT_SHIFT: 		 KBD_RES(KBD_2ND);KeyReady=1;break;
	case KEYCODE_ESCAPE:		     KBD_RES(KBD_EXIT);KeyReady=1;break;
	case KEYCODE_LEFT:		         KBD_RES(KBD_LEFT);KeyReady=1;break;
	case KEYCODE_RIGHT:			     KBD_RES(KBD_RIGHT);KeyReady=1;break;
	case KEYCODE_UP:				 KBD_RES(KBD_UP);KeyReady=1;break;
	case KEYCODE_DOWN:				 KBD_RES(KBD_DOWN);KeyReady=1;break;
	case KEYCODE_GREATER_THAN:		 KBD_RES(KBD_STO);KeyReady=1;break;
	case KEYCODE_DELETE:
	case KEYCODE_BACKSPACE:			 KBD_RES(KBD_DEL);KeyReady=1;break;
	case KEYCODE_HOME:				 KBD_RES(KBD_CLEAR);KeyReady=1;break;
	case KEYCODE_LEFT_ALT:
	case KEYCODE_RIGHT_ALT:			 KBD_RES(KBD_ALPHA);KeyReady=1;break;
	default:
        Key&=CON_KEYCODE;
        if((Key>=' ')&&(Key<0x80)) { KBD_RES(Key);KeyReady=1; }
        break;
    }
  else
    switch(Key&CON_KEYCODE)
    {
    case KEYCODE_F6:				 LoadSTA("DEFAULT.STA");break;
    case KEYCODE_F7:        		 SaveSTA("DEFAULT.STA");break;
    case KEYCODE_F9:
	case KEYCODE_PG_UP:
        if(!FastForward)
        {
          FastForward=UPeriod;
          UPeriod=10;
        }
        break;
	case KEYCODE_Q:
	case KEYCODE_CAPITAL_Q:			 KBD_SET(KBD_ON);KeyReady=1;break;
	case KEYCODE_F11:				 ResetTI85(Mode);break;
	case KEYCODE_F12:				 ExitNow=1;break;
	case KEYCODE_F1:				 KBD_SET(KBD_F1);KeyReady=1;break;
	case KEYCODE_F2:				 KBD_SET(KBD_F2);KeyReady=1;break;
	case KEYCODE_F3:				 KBD_SET(KBD_F3);KeyReady=1;break;
	case KEYCODE_F4:				 KBD_SET(KBD_F4);KeyReady=1;break;
	case KEYCODE_F5:				 KBD_SET(KBD_F5);KeyReady=1;break;
	case KEYCODE_RETURN:
	case KEYCODE_KP_ENTER:			 KBD_SET(KBD_ENTER);KeyReady=1;break;
	case KEYCODE_LEFT_SHIFT:
	case KEYCODE_RIGHT_SHIFT:		 KBD_SET(KBD_2ND);KeyReady=1;break;
	case KEYCODE_ESCAPE:			 KBD_SET(KBD_EXIT);KeyReady=1;break;
	case KEYCODE_LEFT:				 KBD_SET(KBD_LEFT);KeyReady=1;break;
	case KEYCODE_RIGHT:				 KBD_SET(KBD_RIGHT);KeyReady=1;break;
	case KEYCODE_UP:				 KBD_SET(KBD_UP);KeyReady=1;break;
	case KEYCODE_DOWN:				 KBD_SET(KBD_DOWN);KeyReady=1;break;
	case KEYCODE_GREATER_THAN:		 KBD_SET(KBD_STO);KeyReady=1;break;
	case KEYCODE_DELETE:
	case KEYCODE_BACKSPACE:			 KBD_SET(KBD_DEL);KeyReady=1;break;
	case KEYCODE_HOME:				 KBD_SET(KBD_CLEAR);KeyReady=1;break;
	case KEYCODE_LEFT_ALT:
	case KEYCODE_RIGHT_ALT:			 KBD_SET(KBD_ALPHA);KeyReady=1;break;
	default:
        Key&=CON_KEYCODE;
        if((Key>=' ')&&(Key<0x80)) { KBD_SET(Key);KeyReady=1; }
        break; 
    }
}