示例#1
0
//#include "..\\User\\AppTask.h"
void 	TskGuiProc(void *p_arg)//30
{

	volatile	INT8U err;
		TLOG("TskGuiProc start Prio=%02d\n",OSTCBCur->OSTCBPrio);
		GUI_Initialize();				// 初始化LCM
 		GUI_SetColor(1, 0);//设置前景色和背景色的
		DispLog();						// 显示LOG
		RunMenuDemo();					// 显示菜单
		for(;;)
	{	   

		OSTimeDly(OS_TICKS_PER_SEC);//
		
	}
};
示例#2
0
int main (int argc, char *argv[])
{
#ifdef HW_RVL
  /* initialize DVDX */
  DI_Init();
#endif

  /* initialize hardware */
  gx_video_Init();
  gx_input_Init();
#ifdef HW_DOL
  DVD_Init ();
  dvd_drive_detect();
#endif

  /* initialize FAT devices */
  if (fatInitDefault())
  {
    /* check for default directories */
    DIR_ITER *dir = NULL;

    /* base directory */
    char pathname[MAXPATHLEN];
    sprintf (pathname, DEFAULT_PATH);
    dir = diropen(pathname);
    if (dir == NULL) mkdir(pathname,S_IRWXU);
    else dirclose(dir);

    /* SRAM & Savestate files directory */ 
    sprintf (pathname, "%s/saves",DEFAULT_PATH);
    dir = diropen(pathname);
    if (dir == NULL) mkdir(pathname,S_IRWXU);
    else dirclose(dir);

    /* Snapshot files directory */ 
    sprintf (pathname, "%s/snaps",DEFAULT_PATH);
    dir = diropen(pathname);
    if (dir == NULL) mkdir(pathname,S_IRWXU);
    else dirclose(dir);

    /* Cheat files directory */ 
    sprintf (pathname, "%s/cheats",DEFAULT_PATH);
    dir = diropen(pathname);
    if (dir == NULL) mkdir(pathname,S_IRWXU);
    else dirclose(dir);
  }

  /* initialize sound engine */
  gx_audio_Init();

  /* initialize core engine */
  legal();
  config_default();
  history_default();
  init_machine();

  /* run any injected rom */
  if (cart.romsize)
  {
    ARAMFetch((char *)cart.rom, (void *)0x8000, cart.romsize);
    reloadrom (cart.romsize,"INJECT.bin");
    gx_video_Start();
    gx_audio_Start();
    frameticker = 1;
  }
  else
  {
    /* Main Menu */
    ConfigRequested = 1;
  }

  /* initialize GUI engine */
  GUI_Initialize();

#ifdef HW_RVL
  /* Power button callback */
  SYS_SetPowerCallback(Power_Off);
#endif

  /* main emulation loop */
  while (1)
  {
    /* Main Menu request */
    if (ConfigRequested)
    {
      /* stop video & audio */
      gx_audio_Stop();
      gx_video_Stop();

      /* show menu */
      MainMenu ();
      ConfigRequested = 0;

      /* start video & audio */
      gx_audio_Start();
      gx_video_Start();
      frameticker = 1;
    }

    if (frameticker > 1)
    {
      /* skip frame */
      system_frame(1);
      --frameticker;
    }
    else
    {
      while (frameticker < 1)
        usleep(10);

      /* render frame */
      system_frame(0);
      --frameticker;

      /* update video */
      gx_video_Update();
    }

    /* update audio */
    gx_audio_Update();
  }

  return 0;
}
示例#3
0
static void ConfigureGraphics(void)
{
    Widget graphics_widgets[] = {
        { WIDGET_TEXT, ALIGN_CENTER, 158, 20, 0, 0, "Graphics", 0, 0, 0, 0, NULL, NULL, NULL, 0 },
        { WIDGET_TEXT, ALIGN_LEFT, 20, 60, 0, 0, "Graphics mode:", -1, 0, 0, 0, NULL, NULL, NULL, 0 },
        { WIDGET_OPTION, ALIGN_RIGHT,287, 60, 0, 0, NULL, 0, 0, 0, 0, (void *)graphics_mode_getter, NULL, NULL, 0 },
        { WIDGET_TEXT, ALIGN_LEFT, 20, 85, 0, 0, "Resolution:", -1, 0, 0, 0, NULL, NULL, NULL, 0 },
        { WIDGET_OPTION, ALIGN_RIGHT, 287, 85, 0, 0, NULL, 0, 0, 0, 0, (void *)resolution_getter, NULL, NULL, 0 },
        { WIDGET_TEXT, ALIGN_LEFT, 20, 110, 0, 0, "Color depth:", -1, 0, 0, 0, NULL, NULL, NULL, 0 },
        { WIDGET_OPTION, ALIGN_RIGHT, 287, 110, 0, 0, NULL, 0, 0, 0, 0, (void *)color_depth_getter, NULL, NULL, 0 },
        { WIDGET_BUTTON, ALIGN_CENTER, 158, 140, -1, 0, "OK", 2, 3, 0, 0, NULL, NULL, NULL, 0 },
        { WIDGET_END, }
    };

    graphics_widgets[0].d1 = makecol(255, 255, 0);

    int old_driver = configuration.graphics_driver;
    int old_depth = configuration.color_depth;
    int old_width = configuration.screen_width;
    int old_height = configuration.screen_height;

    if (old_driver == GFX_AUTODETECT_FULLSCREEN)
        graphics_widgets[2].d1 = 1;
    else
        graphics_widgets[2].d1 = 0;

    if (configuration.screen_width == 640 && configuration.screen_height == 480)
        graphics_widgets[4].d1 = 0;
    else if (configuration.screen_width == 1024 && configuration.screen_height == 768)
        graphics_widgets[4].d1 = 2;
    else
        graphics_widgets[4].d1 = 1;

    switch (configuration.color_depth) {
    case 32:
        graphics_widgets[6].d1 = 3;
        break;
    case 24:
        graphics_widgets[6].d1 = 2;
        break;
    case 16:
        graphics_widgets[6].d1 = 1;
        break;
    case 15:
        graphics_widgets[6].d1 = 0;
        break;
    }

    GUI_Go(400-158, 300-97, 316, 195, graphics_widgets, 2, 0);

    if (graphics_widgets[2].d1 == 0)
        configuration.graphics_driver = GFX_AUTODETECT_WINDOWED;
    else
        configuration.graphics_driver = GFX_AUTODETECT_FULLSCREEN;

    switch (graphics_widgets[4].d1) {
    case 0:
        configuration.screen_width = 640;
        configuration.screen_height = 480;
        break;
    case 1:
        configuration.screen_width = 800;
        configuration.screen_height = 600;
        break;
    case 2:
        configuration.screen_width = 1024;
        configuration.screen_height = 768;
        break;
    }

    switch (graphics_widgets[6].d1) {
    case 0:
        configuration.color_depth = 15;
        break;
    case 1:
        configuration.color_depth = 16;
        break;
    case 2:
        configuration.color_depth = 24;
        break;
    case 3:
        configuration.color_depth = 32;
        break;
    }

    try {
        SetGraphicsMode();
        DestroyBuffer();
        CreateBuffer();
        DestroyData();
        LoadData();
        GUI_Initialize();
    }
    catch (BadGraphicsMode) {
        configuration.graphics_driver = old_driver;
        configuration.screen_width = old_width;
        configuration.screen_height = old_height;
        configuration.color_depth = old_depth;
        SetGraphicsMode();
        GUI_WaitMessage("|255000000Error setting graphics mode...\n|255000000Reverted to previous mode.");
    }
    catch (...) {
        allegro_message("Error reloading data");
        allegro_exit();
        exit(1);
    }
    PlayIntroMusic();
}