示例#1
0
文件: main.c 项目: ficoos/RetroArch
int main(void)
{
#ifdef HW_RVL
   L2Enhance();
#endif

   fatInitDefault();

#ifdef HAVE_FILE_LOGGER
   g_extern.verbose = true;
   log_fp = fopen("/retroarch-log.txt", "w");
#endif

   config_set_defaults();

   g_settings.audio.rate_control = true;
   g_settings.audio.rate_control_delta = 0.004;
   g_console.block_config_read = true;

   wii_video_init();
   input_wii.init();

   rgui_handle_t *rgui = rgui_init("",
         menu_framebuf, RGUI_WIDTH * sizeof(uint16_t),
         _binary_console_font_bmp_start, folder_cb, NULL);
   rgui_iterate(rgui, RGUI_ACTION_REFRESH);

   int ret = 0;
   while (get_rom_path(rgui) && ret == 0)
   {
      bool repeat = false;

      input_wii.poll(NULL);

      do{
         repeat = rarch_main_iterate();
      }while(repeat && !g_console.frame_advance_enable);

      audio_stop_func();
   }

   if(g_console.emulator_initialized)
      rarch_main_deinit();

   wii_video_deinit();
   input_wii.free(NULL);

#ifdef HAVE_FILE_LOGGER
   fclose(log_fp);
#endif

   rgui_free(rgui);
   return ret;
}
示例#2
0
/*
=============================================================================
check_model_support:	This function checks for support for the specified 
						Model and returns TRUE if that model is supported.

						Model Support is determined by checking for the 
						appropriate directory structure with the correct ROM
						file.
=============================================================================
*/
int check_model_support(int model)
{
	char	file[256];
	FILE*	fd;

	/* Get the path for the model supplied */
	get_rom_path(file, model);

	/* Attempt to open the ROM file */
	if ((fd = fopen(file, "r")) == NULL)
		return FALSE;

	/* Open successful, close the file and return */
	fclose(fd);
	return TRUE;
}
示例#3
0
文件: main.c 项目: magicseb/RetroArch
int main(void)
{
   fatInitDefault();

#ifdef HAVE_FILE_LOGGER
   g_extern.verbose = true;
   log_fp = fopen("sd:/ssnes-log.txt", "w");
#endif

   wii_video_init();
   wii_input_init();

   sgui_handle_t *sgui = sgui_init("sd:/",
         menu_framebuf, SGUI_WIDTH * sizeof(uint16_t),
         _binary_console_font_bmp_start, folder_cb, NULL);

   const char *rom_path;
   int ret = 0;
   while ((rom_path = get_rom_path(sgui)) && ret == 0)
   {
      g_console.initialize_rarch_enable = true;
      strlcpy(g_console.rom_path, rom_path, sizeof(g_console.rom_path));
      rarch_startup(NULL);
      bool repeat = false;

      input_wii.poll(NULL);

      do{
         repeat = rarch_main_iterate();
      }while(repeat && !g_console.frame_advance_enable);
   }

   if(g_console.emulator_initialized)
      rarch_main_deinit();

   wii_input_deinit();
   wii_video_deinit();

#ifdef HAVE_FILE_LOGGER
   fclose(log_fp);
#endif

   sgui_free(sgui);
   return ret;
}
示例#4
0
/*
=============================================================================
check_installation:	This routine checks that VirtualT is properly installed
					with model directories and appropriate rom files.

					If the files are not installed, it attempts to create
					them using files in the ROMs directory.
=============================================================================
*/
void check_installation(void)
{
	int 	model, len;
	char	localpath[256];
	char	roms_path[512];
	char	errors[256];
	FILE	*fd, *fd2;

	/* Test if Mac OSX and no path specified */
#ifdef __APPLE__
	struct stat romStat;
	if (strlen(path) == 0)
		return;
#endif

	errors[0] = 0;

	/* Check each model */
	for (model = MODEL_M100; model <= MODEL_PC8300; model++)
	{
		/* Check if ROM file exists for this model */
		if (check_model_support(model))
			continue;

		/* ROM file doesn't exist.  Try to open in ROMs dir */
		get_rom_path(localpath, model);
#if defined(__APPLE__)
		sprintf(roms_path, "%sROMs%s", path, strrchr(localpath, '/'));
		
		/* Test if the ROM file exists in the working directory */
		if (stat(roms_path, &romStat) != 0)
		{
			/* Test if running from a bundle & get the bundle path */
			if (strlen(gOsxBundlePath) > 0)
			{
				sprintf(roms_path, "%s/Resources%s", gOsxBundlePath, strrchr(localpath, '/'));
			}
		}
#else
		sprintf(roms_path, "ROMs%s", strrchr(localpath, '/'));
#endif

		if ((fd = fopen(roms_path, "rb")) == NULL)
		{
			/* Error - ROM file not in ROMs dir */
			if (strlen(errors) != 0)
				strcat(errors, ", ");
			get_model_string(localpath, model);
			strcat(errors, localpath);
			continue;		
		}

		/* Create the emulation directory */
		get_emulation_path(localpath, model);
#ifdef WIN32
		_mkdir(localpath);
#else
		mkdir(localpath, 0755);
#endif
		/* Create ROM in the emulation directory */
		get_rom_path(localpath, model);
		fd2 = fopen(localpath, "wb");
		if (fd2 == NULL)
		{
			if (strlen(errors) != 0)
				strcat(errors, ", ");
			get_model_string(localpath, model);
			strcat(errors, localpath);
			fclose(fd);
			continue;
		}

		/* Copy the ROM file from ROMs dir */
		while (1)
		{
			/* Read the ROM contents so we can save in Model directory */
			len = fread(gOptROM, 1, 32768, fd);
			if (len == 0)
				break;
			fwrite(gOptROM, 1, len, fd2);
		}

		/* Close both files */
		fclose(fd);
		fclose(fd2);
	}

	if (strlen(errors) > 0)
	{
		sprintf(localpath, "No ROM file for %s", errors);
		show_error(localpath);
	}
}