Example #1
0
void main() {
List_head lista_reservas ;
List_head lista_pre_reservas ;
lista_reservas = cria_lista() ;
lista_pre_reservas = cria_lista() ;
menu_main(lista_reservas, lista_pre_reservas) ;
}
Example #2
0
void main()
{
    clear_screens();

    if(mount_sd() != 0) {
        draw_loading("Failed to mount SD", "Make sure your SD card can be read correctly");
        return;
    }

    // This function already correctly draws error messages
    if (load_firm() != 0) return;

    if (load_cakes_info("/cakes/patches") != 0) {
        draw_loading("Failed to read some cakes", "Make sure your cakes are up to date\n  and your SD card can be read correctly");
        return;
    }

    load_config();

    // If the L button isn't pressed, autoboot.
    if (config->autoboot_enabled && *hid_regs ^ 0xFFF ^ key_l) {
        boot_cfw();
    }

    menu_main();
}
Example #3
0
File: menu.c Project: zid/naev
/**
 * @brief Closes the small ingame menu and goes back to the main menu.
 *    @param str Unused.
 */
static void menu_small_exit( unsigned int wid, char* str )
{
   (void) str;
   unsigned int info_wid;
   
   /* if landed we must save anyways */
   if (landed) {
      /* increment time to match takeoff */
      ntime_inc( RNG( 2*NTIME_UNIT_LENGTH, 3*NTIME_UNIT_LENGTH ) );
      save_all();
      land_cleanup();
   }

   /* Close info menu if open. */
   if (menu_isOpen(MENU_INFO)) {
      info_wid = window_get("Info");
      window_destroy( info_wid );
      menu_Close(MENU_INFO);
   }

   /* Stop player sounds because sometimes they hang. */
   player_abortAutonav( "Exited game." );
   player_stopSound();

   /* Clean up. */
   window_destroy( wid );
   menu_Close(MENU_SMALL);
   menu_main();
}
Example #4
0
File: menu.c Project: naev/naev
/**
 * @brief Closes the small ingame menu and goes back to the main menu.
 *    @param str Unused.
 */
static void menu_small_exit( unsigned int wid, char* str )
{
   (void) str;
   unsigned int info_wid, board_wid;

   /* if landed we must save anyways */
   if (landed) {
      save_all();
      land_cleanup();
   }

   /* Close info menu if open. */
   if (menu_isOpen(MENU_INFO)) {
      info_wid = window_get("Info");
      window_destroy( info_wid );
      menu_Close(MENU_INFO);
   }

   /* Force unboard. */
   if (player_isBoarded()) {
      board_wid = window_get("Boarding");
      board_exit(board_wid, NULL);
   }

   /* Stop player sounds because sometimes they hang. */
   player_restoreControl( 0, _("Exited game.") );
   player_soundStop();

   /* Clean up. */
   window_destroy( wid );
   menu_Close(MENU_SMALL);
   menu_main();
}
void change_menu_section()
{
	if(menu_section == MENU_SECTION_MAIN)
	{
		menu_main();
	}
#ifndef LIGHT
	else if(menu_section == MENU_SECTION_MUSIC)
	{
		menu_music();
		if(music_prx_load) { all_done = 1; menu_main_done = 1; }
	}
#endif
#ifndef GAME
	else if(menu_section == MENU_SECTION_TM)
	{
		menu_tm();
	}
#endif
	else if(menu_section == MENU_SECTION_INFO)
	{
		menu_info();
	}
	else if(menu_section == MENU_SECTION_CFG)
	{
		menu_cfg();
	}
}
Example #6
0
task main(){
  show_log();//show the log
  NSLog("start");
  menu_init();//init the menu
  while(true){
    menu_main();//run menu
  }
}
Example #7
0
File: menu.c Project: zid/naev
/**
 * @brief Closes the player death menu.
 *    @param str Unused.
 */
static void menu_death_main( unsigned int wid, char* str )
{
   (void) str;

   window_destroy( wid );
   menu_Close(MENU_DEATH);

   /* Game will repause now since toolkit closes and reopens. */
   menu_main();
}
Example #8
0
void main()
{
    clear_screens();

    if(mount_sd() != 0) {
        draw_loading("Failed to mount SD", "Make sure your SD card can be read correctly");
        return;
    }

    load_config();

    // If the L button isn't pressed, autoboot.
    if (config->autoboot_enabled && *hid_regs ^ 0xFFF ^ key_l) {
        print("Autobooting...");

        if (read_file(firm_loc, PATH_PATCHED_FIRMWARE, FCRAM_SPACING) != 0 ||
                firm_loc->magic != FIRM_MAGIC) {
            print("Failed to load patched FIRM");
            draw_message("Failed to load patched FIRM", "The option to autoboot was selected,\n  but no valid FIRM could be found at:\n  " PATH_PATCHED_FIRMWARE);
        } else {
            if (read_file(memory_loc, PATH_MEMORY, FCRAM_SPACING) != 0) {
                print("Failed to load memory patches");
                draw_message("Failed to load memory patches", "The option to autoboot was selected,\n  but no valid memory patches could be found at:\n  " PATH_MEMORY);
            } else {
                if (config->firm_console == console_n3ds && config->firm_ver > 0x0F) {
                    slot0x11key96_init();
                }

                // boot_firm() requires current_firm->console and current_firm->version.
                struct firm_signature config_firm = {.console = config->firm_console,
                                                     .version = config->firm_ver};
                current_firm = &config_firm;

                boot_firm();
            }
        }
    }

    if (load_firms() != 0) {
        if(menu_firms() !=0) return;
    }

    print("Loading cakes");
    if (load_cakes_info(PATH_PATCHES) != 0) {
        draw_loading("Failed to read some cakes", "Make sure your cakes are up to date\n  and your SD card can be read correctly");
        return;
    }

    load_config_cakes();

    menu_main();
}
Example #9
0
File: main.c Project: odrevet/GE
game_status state_main_menu(SDL_Surface *screen, game* p_game)
{
  bool done=false;
  image* main_title;
  main_title = image_load("./res/images/main_title.png");
  SDL_Rect srcrect = {0,0,160,144};
  SDL_Rect dstrect = set_rect(0,0,SCREEN_HEIGHT,SCREEN_WIDTH);
  int next_state=STAY;
  while (!done)
    {
      //events
      SDL_Event event;
      while (SDL_PollEvent(&event))
        {
	  switch ( event.type )
            {
            case SDL_QUIT:
	      done = true;
	      break;
            default:
	      break;
            }
        }

      image_draw(main_title, get_backbuffer_surface(), 0, 0);
      SDL_SoftStretch(get_backbuffer_surface(), &srcrect, screen, &dstrect);
      SDL_Flip(screen);

      if(next_state == STAY)next_state = menu_main(screen, p_game);
      else if(next_state!=QUIT){
	switch(next_state){
	case LOAD:
	  menu_load(screen, &p_game);
	  next_state = state_in_game(screen, p_game);
	  break;
	case 1:
	  p_game = game_load("./res/scripts/state.xml");
	  next_state = state_in_game(screen, p_game);
	  break;
	default:
	  break;
	}
      }
      else if(next_state==QUIT)done=true;
    }

  image_free(main_title);

  return QUIT;
}
Example #10
0
File: menu.c Project: naev/naev
/**
 * @brief Closes the editors menu.
 *    @param str Unused.
 */
static void menu_editors_close( unsigned int wid, char* str )
{
   (void)str;
   
   /* Close the Editors Menu and mark it as closed */
   /*WARN("Entering function.");*/
   window_destroy( wid );
   menu_Close( MENU_EDITORS );
   
   /* Restores Main Menu */
   /*WARN("Restoring Main Menu.");*/
   menu_main();
   /*WARN("Exiting function.");*/
   
   return;
}
Example #11
0
task main() {

  //waitForStart();

  initializeRobot();

  while (true) {

      getJoystickSettings(joystick);
      menu_main();
      driveRobot();
      // Activates Crate Uprighter, Use Button 5 on Controller to Activate
      if (joy1Btn(5)) {
        StartTask(runArm);
      }
  }
}
Example #12
0
File: save.c Project: isfos/naev
/**
 * @brief Loads a new game.
 *    @param wdw Window triggering function.
 *    @param str Unused.
 */
static void load_menu_load( unsigned int wdw, char *str )
{
   (void)str;
   char *save, path[PATH_MAX];
   int wid;

   wid = window_get( "Load Game" );
   save = toolkit_getList( wid, "lstSaves" );

   if (strcmp(save,"None") == 0)
      return;

   snprintf( path, PATH_MAX, "%ssaves/%s.ns", nfile_basePath(), save );

   /* Close menus before loading for proper rendering. */
   load_menu_close(wdw, NULL);
   menu_main_close();

   if (load_game( path )) {
      menu_main();
      load_game_menu();
   }
}
Example #13
0
void main()/* This is Main function. This function will executed on program startup */
{
	short int blnRun=true;
	do{
		switch(menu_main())
		{
			case 1: sell();		break;
			case 2: list();		break;
			case 3: create();	break;
			case 4: edit();		break;
			case 5: del();		break;
			case 6: sort();		break;
			case 7: search();	break;
			case 8: fSave();	break;
			case 9: fLoad();	break;

			case 0: default:	blnRun=false;
		}
	}while(blnRun==true);
	clrscr();
	puts("Press Enter to exit application...");
	getch();
}
Example #14
0
void main()
{
	setup();
	PORTAbits.RA5 = 0;
	
	lcd_cursor(LCD_NOCURSOR);

	char timezone = EEPROM_READ(STORE_TZADDRESS);
	__delay_ms(20);

	sys_ready();
	
	while(1)
	{
		if(PORTBbits.RB2 == 0)
		{
			timezone = EEPROM_READ(STORE_TZADDRESS);

			rtc_get_time_and_date(time,date);
			tz_get_date(screenbuf,date);
			lcd_write_at(0,0,screenbuf);
			tz_get_time(screenbuf,time,timezone);
			lcd_write_at(1,0,screenbuf);

			if(input_get_button_no_block() == b_menu)
			{
				menu_main();
			}
		}
		else
		{
			lcd_blankscreen();
			sys_sleep();
		}
	}
}
Example #15
0
int main(int argc, char *argv[])
{
  openconsole(&dev_rawcon_r, &dev_vesaserial_w);
  return menu_main(argc, argv);
}
Example #16
0
File: naev.c Project: ekrumme/naev
/**
 * @brief The entry point of NAEV.
 *
 *    @param[in] argc Number of arguments.
 *    @param[in] argv Array of argc arguments.
 *    @return EXIT_SUCCESS on success.
 */
int main( int argc, char** argv )
{
   char buf[PATH_MAX];

   /* Save the binary path. */
   binary_path = argv[0];
   
   /* Print the version */
   LOG( " "APPNAME" v%s", naev_version(0) );
#ifdef GIT_COMMIT
   DEBUG( " git HEAD at " GIT_COMMIT );
#endif /* GIT_COMMIT */

   /* Initializes SDL for possible warnings. */
   SDL_Init(0);

   /* Set up debug signal handlers. */
   debug_sigInit();

   /* Create the home directory if needed. */
   if (nfile_dirMakeExist("%s", nfile_basePath()))
      WARN("Unable to create naev directory '%s'", nfile_basePath());

   /* Must be initialized before input_init is called. */
   if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) {
      WARN("Unable to initialize SDL Video: %s", SDL_GetError());
      return -1;
   }

   /* Get desktop dimensions. */
#if SDL_VERSION_ATLEAST(1,2,10)
   const SDL_VideoInfo *vidinfo = SDL_GetVideoInfo();
   gl_screen.desktop_w = vidinfo->current_w;
   gl_screen.desktop_h = vidinfo->current_h;
#else /* #elif SDL_VERSION_ATLEAST(1,2,10) */
   gl_screen.desktop_w = 0;
   gl_screen.desktop_h = 0;
#endif /* #elif SDL_VERSION_ATLEAST(1,2,10) */

   /* We'll be parsing XML. */
   LIBXML_TEST_VERSION
   xmlInitParser();

   /* Input must be initialized for config to work. */
   input_init(); 

   /* Set the configuration. */
   snprintf(buf, PATH_MAX, "%s"CONF_FILE, nfile_basePath());
   conf_setDefaults(); /* set the default config values */
   conf_loadConfig(buf); /* Lua to parse the configuration file */
   conf_parseCLI( argc, argv ); /* parse CLI arguments */

   /* Enable FPU exceptions. */
#if !(HAS_WIN32) && defined(DEBUGGING)
   if (conf.fpu_except)
      feenableexcept( FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW );
#endif /* DEBUGGING */

   /* Open data. */
   if (ndata_open() != 0)
      ERR("Failed to open ndata.");

   /* Load the data basics. */
   LOG(" %s", ndata_name());
   DEBUG();

   /* Display the SDL Version. */
   print_SDLversion();
   DEBUG();

   /* random numbers */
   rng_init();


   /*
    * OpenGL
    */
   if (gl_init()) { /* initializes video output */
      ERR("Initializing video output failed, exiting...");
      SDL_Quit();
      exit(EXIT_FAILURE);
   }
   window_caption();
   gl_fontInit( NULL, NULL, FONT_SIZE ); /* initializes default font to size */
   gl_fontInit( &gl_smallFont, NULL, FONT_SIZE_SMALL ); /* small font */

   /* Display the load screen. */
   loadscreen_load();
   loadscreen_render( 0., "Initializing subsystems..." );
   time = SDL_GetTicks();


   /*
    * Input
    */
   if ((conf.joystick_ind >= 0) || (conf.joystick_nam != NULL)) {
      if (joystick_init()) WARN("Error initializing joystick input");
      if (conf.joystick_nam != NULL) { /* use the joystick name to find a joystick */
         if (joystick_use(joystick_get(conf.joystick_nam))) {
            WARN("Failure to open any joystick, falling back to default keybinds");
            input_setDefault();
         }
         free(conf.joystick_nam);
      }
      else if (conf.joystick_ind >= 0) /* use a joystick id instead */
         if (joystick_use(conf.joystick_ind)) {
            WARN("Failure to open any joystick, falling back to default keybinds");
            input_setDefault();
         }
   }


   /*
    * OpenAL - Sound
    */
   if (conf.nosound) {
      LOG("Sound is disabled!");
      sound_disabled = 1;
      music_disabled = 1;
   }
   if (sound_init()) WARN("Problem setting up sound!");
   music_choose("load");


   /* Misc graphics init */
   if (nebu_init() != 0) { /* Initializes the nebula */
      /* An error has happened */
      ERR("Unable to initialize the Nebula subsystem!");
      /* Weirdness will occur... */
   }
   gui_init(); /* initializes the GUI graphics */
   toolkit_init(); /* initializes the toolkit */
   map_init(); /* initializes the map. */
   cond_init(); /* Initialize conditional subsystem. */

   /* Data loading */
   load_all();

   /* Unload load screen. */
   loadscreen_unload();

   /* Start menu. */
   menu_main();

   /* Force a minimum delay with loading screen */
   if ((SDL_GetTicks() - time) < NAEV_INIT_DELAY)
      SDL_Delay( NAEV_INIT_DELAY - (SDL_GetTicks() - time) );
   time = SDL_GetTicks(); /* initializes the time */
   /* 
    * main loop
    */
   SDL_Event event;
   /* flushes the event loop since I noticed that when the joystick is loaded it
    * creates button events that results in the player starting out acceling */
   while (SDL_PollEvent(&event));
   /* primary loop */
   while (!quit) {
      while (SDL_PollEvent(&event)) { /* event loop */
         if (event.type == SDL_QUIT)
            quit = 1; /* quit is handled here */

         input_handle(&event); /* handles all the events and player keybinds */
      }

      main_loop();
   }


   /* Save configuration. */
   conf_saveConfig(buf);

   /* cleanup some stuff */
   player_cleanup(); /* cleans up the player stuff */
   gui_free(); /* cleans up the player's GUI */
   weapon_exit(); /* destroys all active weapons */
   pilots_free(); /* frees the pilots, they were locked up :( */
   cond_exit(); /* destroy conditional subsystem. */
   land_exit(); /* Destroys landing vbo and friends. */

   /* data unloading */
   unload_all();

   /* cleanup opengl fonts */
   gl_freeFont(NULL);
   gl_freeFont(&gl_smallFont);

   /* Close data. */
   ndata_close();

   /* Destroy conf. */
   conf_cleanup(); /* Frees some memory the configuration allocated. */

   /* exit subsystems */
   map_exit(); /* destroys the map. */
   toolkit_exit(); /* kills the toolkit */
   ai_exit(); /* stops the Lua AI magic */
   joystick_exit(); /* releases joystick */
   input_exit(); /* cleans up keybindings */
   nebu_exit(); /* destroys the nebula */
   gl_exit(); /* kills video output */
   sound_exit(); /* kills the sound */
   news_exit(); /* destroys the news. */

   /* Free the icon. */
   if (naev_icon)
      free(naev_icon);

   SDL_Quit(); /* quits SDL */

   /* all is well */
   exit(EXIT_SUCCESS);
}
Example #17
0
/**
 * @brief The entry point of Naev.
 *
 *    @param[in] argc Number of arguments.
 *    @param[in] argv Array of argc arguments.
 *    @return EXIT_SUCCESS on success.
 */
int main( int argc, char** argv )
{
   char buf[PATH_MAX];

   /* Save the binary path. */
   binary_path = strdup(argv[0]);

   /* Print the version */
   LOG( " "APPNAME" v%s", naev_version(0) );
#ifdef GIT_COMMIT
   DEBUG( " git HEAD at " GIT_COMMIT );
#endif /* GIT_COMMIT */

   /* Initializes SDL for possible warnings. */
   SDL_Init(0);

   /* Initialize the threadpool */
   threadpool_init();

   /* Set up debug signal handlers. */
   debug_sigInit();

   /* Must be initialized before input_init is called. */
   if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) {
      WARN("Unable to initialize SDL Video: %s", SDL_GetError());
      return -1;
   }

   /* Get desktop dimensions. */
#if SDL_VERSION_ATLEAST(1,2,10)
   const SDL_VideoInfo *vidinfo = SDL_GetVideoInfo();
   gl_screen.desktop_w = vidinfo->current_w;
   gl_screen.desktop_h = vidinfo->current_h;
#else /* #elif SDL_VERSION_ATLEAST(1,2,10) */
   gl_screen.desktop_w = 0;
   gl_screen.desktop_h = 0;
#endif /* #elif SDL_VERSION_ATLEAST(1,2,10) */

   /* We'll be parsing XML. */
   LIBXML_TEST_VERSION
   xmlInitParser();

   /* Input must be initialized for config to work. */
   input_init();

   conf_setDefaults(); /* set the default config values */

   /*
    * Attempts to load the data path from datapath.lua
    * At this early point in the load process, the binary path
    * is the only place likely to be checked.
    */
   conf_loadConfigPath();

   /* Parse the user data path override first. */
   conf_parseCLIPath( argc, argv );

   /* Create the home directory if needed. */
   if (nfile_dirMakeExist("%s", nfile_configPath()))
      WARN("Unable to create config directory '%s'", nfile_configPath());

   /* Set the configuration. */
   nsnprintf(buf, PATH_MAX, "%s"CONF_FILE, nfile_configPath());

#if HAS_UNIX
   /* TODO get rid of this cruft ASAP. */
   int oldconfig = 0;
   if (!nfile_fileExists( buf )) {
      char *home, buf2[PATH_MAX];
      home = SDL_getenv( "HOME" );
      if (home != NULL) {
         nsnprintf( buf2, PATH_MAX, "%s/.naev/"CONF_FILE, home );
         if (nfile_fileExists( buf2 ))
            oldconfig = 1;
      }
   }
#endif /* HAS_UNIX */

   conf_loadConfig(buf); /* Lua to parse the configuration file */
   conf_parseCLI( argc, argv ); /* parse CLI arguments */

   /* Enable FPU exceptions. */
#if defined(HAVE_FEENABLEEXCEPT) && defined(DEBUGGING)
   if (conf.fpu_except)
      feenableexcept( FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW );
#endif /* defined(HAVE_FEENABLEEXCEPT) && defined(DEBUGGING) */

   /* Open data. */
   if (ndata_open() != 0)
      ERR("Failed to open ndata.");

   /* Load the start info. */
   if (start_load())
      ERR("Failed to load module start data.");

   /* Load the data basics. */
   LOG(" %s", ndata_name());
   DEBUG();

   /* Display the SDL Version. */
   print_SDLversion();
   DEBUG();

   /* random numbers */
   rng_init();

   /*
    * OpenGL
    */
   if (gl_init()) { /* initializes video output */
      ERR("Initializing video output failed, exiting...");
      SDL_Quit();
      exit(EXIT_FAILURE);
   }
   window_caption();
   gl_fontInit( NULL, NULL, conf.font_size_def ); /* initializes default font to size */
   gl_fontInit( &gl_smallFont, NULL, conf.font_size_small ); /* small font */

   /* Display the load screen. */
   loadscreen_load();
   loadscreen_render( 0., "Initializing subsystems..." );
   time_ms = SDL_GetTicks();


   /*
    * Input
    */
   if ((conf.joystick_ind >= 0) || (conf.joystick_nam != NULL)) {
      if (joystick_init()) WARN("Error initializing joystick input");
      if (conf.joystick_nam != NULL) { /* use the joystick name to find a joystick */
         if (joystick_use(joystick_get(conf.joystick_nam))) {
            WARN("Failure to open any joystick, falling back to default keybinds");
            input_setDefault();
         }
         free(conf.joystick_nam);
      }
      else if (conf.joystick_ind >= 0) /* use a joystick id instead */
         if (joystick_use(conf.joystick_ind)) {
            WARN("Failure to open any joystick, falling back to default keybinds");
            input_setDefault();
         }
   }


   /*
    * OpenAL - Sound
    */
   if (conf.nosound) {
      LOG("Sound is disabled!");
      sound_disabled = 1;
      music_disabled = 1;
   }
   if (sound_init()) WARN("Problem setting up sound!");
   music_choose("load");

   /* FPS stuff. */
   fps_setPos( 15., (double)(gl_screen.h-15-gl_defFont.h) );

   /* Misc graphics init */
   if (nebu_init() != 0) { /* Initializes the nebula */
      /* An error has happened */
      ERR("Unable to initialize the Nebula subsystem!");
      /* Weirdness will occur... */
   }
   gui_init(); /* initializes the GUI graphics */
   toolkit_init(); /* initializes the toolkit */
   map_init(); /* initializes the map. */
   cond_init(); /* Initialize conditional subsystem. */
   cli_init(); /* Initialize console. */

   /* Data loading */
   load_all();

   /* Generate the CSV. */
   if (conf.devcsv)
      dev_csv();

   /* Unload load screen. */
   loadscreen_unload();

   /* Start menu. */
   menu_main();

   /* Force a minimum delay with loading screen */
   if ((SDL_GetTicks() - time_ms) < NAEV_INIT_DELAY)
      SDL_Delay( NAEV_INIT_DELAY - (SDL_GetTicks() - time_ms) );
   fps_init(); /* initializes the time_ms */

#if HAS_UNIX
   /* Tell the player to migrate their configuration files out of ~/.naev */
   /* TODO get rid of this cruft ASAP. */
   if ((oldconfig) && (!conf.datapath)) {
      char path[PATH_MAX], *script, *home;
      uint32_t scriptsize;
      int ret;

      nsnprintf( path, PATH_MAX, "%s/naev-confupdate.sh", ndata_getDirname() );
      home = SDL_getenv("HOME");
      ret = dialogue_YesNo( "Warning", "Your configuration files are in a deprecated location and must be migrated:\n"
            "   \er%s/.naev/\e0\n\n"
            "The update script can likely be found in your Naev data directory:\n"
            "   \er%s\e0\n\n"
            "Would you like to run it automatically?", home, path );

      /* Try to run the script. */
      if (ret) {
         ret = -1;
         /* Running from ndata. */
         if (ndata_getPath() != NULL) {
            script = ndata_read( "naev-confupdate.sh", &scriptsize );
            if (script != NULL)
               ret = system(script);
         }

         /* Running from laid-out files or ndata_read failed. */
         if ((nfile_fileExists(path)) && (ret == -1)) {
            script = nfile_readFile( (int*)&scriptsize, path );
            if (script != NULL)
               ret = system(script);
         }

         /* We couldn't find the script. */
         if (ret == -1) {
            dialogue_alert( "The update script was not found at:\n\er%s\e0\n\n"
                  "Please locate and run it manually.", path );
         }
         /* Restart, as the script succeeded. */
         else if (!ret) {
            dialogue_msg( "Update Completed",
                  "Configuration files were successfully migrated. Naev will now restart." );
            execv(argv[0], argv);
         }
         else { /* I sincerely hope this else is never hit. */
            dialogue_alert( "The update script encountered an error. Please exit Naev and move your config and save files manually:\n\n"
                  "\er%s/%s\e0 =>\n   \eD%s\e0\n\n"
                  "\er%s/%s\e0 =>\n   \eD%s\e0\n\n"
                  "\er%s/%s\e0 =>\n   \eD%snebula/\e0\n\n",
                  home, ".naev/conf.lua", nfile_configPath(),
                  home, ".naev/{saves,screenshots}/", nfile_dataPath(),
                  home, ".naev/gen/*.png", nfile_cachePath() );
         }
      }
      else {
Example #18
0
int main(int argc, char **argv) {

  GRRLIB_Init();	
	
  // Initialise the attached controllers
  WPAD_Init();
  WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR);
	
  // Initialise the audio subsystem
  AESND_Init(NULL);
	
  MODPlay_Init(&play);
  MODPlay_SetMOD(&play,bg_music);
  MODPlay_SetVolume(&play,63,63);
  MODPlay_Start(&play);

  cui_cursor cursor;
  cursor.tex[0]=GRRLIB_LoadTexture(player1_point_png);
  cursor.tex[1]=GRRLIB_LoadTexture(player1_grab_png);
  cursor.is_grabbing=false; 
	
  cui_board board;
	
  ENGINE engine = FIRSTCHESS;
  if(engine == TSCP){
    int i;
    for (i=0; i < CUI_TILE_NB; i++) {
      board.piece[i]=init_piece[i];
      if(init_color[i] == 1){
	board.color[i]=CUI_BLACK;
      }else if (init_color[i] == 6){
	board.color[i]=CUI_EMPTY;
      }else if (init_color[i] == 0){
	board.color[i]=CUI_WHITE;
      }
    }
			
    init_hash();
    init_board();
    open_book();
    gen();
  }


  cui_board_read_core(&board, engine);

  GRRLIB_SetBackgroundColour(0x030, 0x30, 0x42, 0xFF);
	
  board.tile_color1 = 0xAAAAAAFF;
  board.tile_color2 = 0x444444FF;
  board.piece_color1 = 0xAAAAAAFF;
  board.piece_color2 = 0x444444FF;
	
  cui_board_init(&board);

  cui_game game;
  game.board = &board;
  game.engine = engine; 
  game.cursor = &cursor;
  game.is_mute = false;
  GRRLIB_texImg *tex_wallpaper = GRRLIB_LoadTexture(wall_jpg);
  game.tex_wallpaper = tex_wallpaper;
			
	
  voice = AESND_AllocateVoice(aesnd_callback);
  AESND_SetVoiceVolume(voice, 0xFF, 0xFF);
  AESND_SetVoiceStream(voice, true);

  cui_menu current_state = CUI_MENU_MAIN;
	 
  while(current_state != CUI_MENU_EXIT) {
    switch(current_state){
    case CUI_MENU_MAIN:	current_state=menu_main(&game);break;
    case CUI_MENU_PLAY:	current_state=menu_play(&game);break;
    case CUI_MENU_OPTION:current_state=menu_option(&game);break;
    case CUI_MENU_OPTION_GENERAL:current_state=menu_option_general(&game);break;
    case CUI_MENU_OPTION_GFX:current_state=menu_option_gfx(&game);break;
    case CUI_MENU_OPTION_SND:current_state=menu_option_snd(&game);break;
    case CUI_MENU_CREDITS:current_state=menu_credits(&game);break;
    case CUI_MENU_PAUSE:current_state=menu_pause(&game);break;
    case CUI_MENU_HOME:current_state=menu_home(&game);break;
    case CUI_MENU_EXIT:current_state=menu_exit(&game);break;
    default:break;
    }
  }
	
  GRRLIB_FreeTexture(tex_wallpaper);
  GRRLIB_FreeTexture(cursor.tex[0]);
  GRRLIB_FreeTexture(cursor.tex[1]);
  GRRLIB_Exit();
  return 0;
}
Example #19
0
int main(int argc, const char* argv[])
{
    /* Sadly svchax crashes too much, so only allow install mode when running as a CIA
    // Trigger svchax so we can install CIAs
    if(argc > 0) {
        svchax_init(true);
        if(!__ctr_svchax || !__ctr_svchax_srv) {
            bSvcHaxAvailable = false;
            //printf("Failed to acquire kernel access. Install mode disabled.\n");
        }
    }
    */
    
    // argc is 0 when running as a CIA, and 1 when running as a 3dsx
    if (argc > 0)
    {
        bSvcHaxAvailable = false;
    }

    u32 *soc_sharedmem, soc_sharedmem_size = 0x100000;
    gfxInitDefault();
    consoleInit(GFX_TOP, NULL);

    httpcInit(0);
    soc_sharedmem = (u32 *)memalign(0x1000, soc_sharedmem_size);
    socInit(soc_sharedmem, soc_sharedmem_size);
    sslcInit(0);
    hidInit();
    acInit();
    cfguInit();

    if (bSvcHaxAvailable)
    {
        amInit();
        AM_InitializeExternalTitleDatabase(false);
    }

    init_menu(GFX_TOP);

    // Make sure all CIAngel directories exists on the SD card
    mkpath("/CIAngel", 0777);
    mkpath("/CIAngel/tmp/", 0777);
    loadConfig();
    
    // Set up the reading of json
    check_JSON();
    load_JSON_data();
    
    menu_main();

    if (bSvcHaxAvailable)
    {
        amExit();
    }

    cfguExit();
    acExit();
    gfxExit();
    hidExit();
    httpcExit();
    socExit();
    sslcExit();
}