コード例 #1
0
ファイル: task_content.c プロジェクト: alerinoreis/RetroArch
static void check_defaults_dir_create_dir(const char *path)
{
   char new_path[PATH_MAX_LENGTH];
   fill_pathname_expand_special(new_path,
         path, sizeof(new_path));

   if (path_is_directory(new_path))
      return;
   path_mkdir(new_path);
}
コード例 #2
0
bool config_get_path(config_file_t *conf, const char *key,
      char *buf, size_t size)
{
#if defined(RARCH_CONSOLE)
   return config_get_array(conf, key, buf, size);
#else
   const struct config_entry_list *entry = config_get_entry(conf, key, NULL);

   if (entry)
      fill_pathname_expand_special(buf, entry->value, size);

   return entry != NULL;
#endif
}
コード例 #3
0
ファイル: config_file.c プロジェクト: RobLoach/RetroArch
bool config_get_path(config_file_t *conf, const char *key,
      char *buf, size_t size)
{
#if defined(RARCH_CONSOLE) || !defined(RARCH_INTERNAL)
   if (config_get_array(conf, key, buf, size))
      return true;
#else
   const struct config_entry_list *entry = config_get_entry(conf, key, NULL);

   if (entry)
   {
      fill_pathname_expand_special(buf, entry->value, size);
      return true;
   }
#endif
   return false;
}
コード例 #4
0
ファイル: config_file.c プロジェクト: Markko/RetroArch
bool config_get_path(config_file_t *conf, const char *key,
      char *buf, size_t size)
{
#if defined(RARCH_CONSOLE)
   return config_get_array(conf, key, buf, size);
#else
   struct config_entry_list *list = conf->entries;

   while (list)
   {
      if (strcmp(key, list->key) == 0)
      {
         fill_pathname_expand_special(buf, list->value, size);
         return true;
      }
      list = list->next;
   }
   return false;
#endif
}
コード例 #5
0
ファイル: platform_win32.c プロジェクト: leiradel/RetroArch
static void frontend_win32_environment_get(int *argc, char *argv[],
      void *args, void *params_data)
{
   gfx_set_dwm();

   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_ASSETS],
      ":\\assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER],
      ":\\filters\\audio", sizeof(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER],
      ":\\filters\\video", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CHEATS],
      ":\\cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_DATABASE],
      ":\\database\\rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CURSOR],
      ":\\database\\cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_PLAYLIST],
      ":\\playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_RECORD_CONFIG],
      ":\\config\\record", sizeof(g_defaults.dirs[DEFAULT_DIR_RECORD_CONFIG]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_RECORD_OUTPUT],
      ":\\recordings", sizeof(g_defaults.dirs[DEFAULT_DIR_RECORD_OUTPUT]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG],
      ":\\config", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_REMAP],
      ":\\config\\remaps", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_WALLPAPERS],
      ":\\assets\\wallpapers", sizeof(g_defaults.dirs[DEFAULT_DIR_WALLPAPERS]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS],
      ":\\thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_OVERLAY],
      ":\\overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CORE],
      ":\\cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CORE_INFO],
      ":\\info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG],
      ":\\autoconfig", sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_SHADER],
      ":\\shaders", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS],
      ":\\downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT],
      ":\\screenshots", sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_SRAM],
      ":\\saves", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_SAVESTATE],
      ":\\states", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_SYSTEM],
      ":\\system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
   fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_LOGS],
      ":\\logs", sizeof(g_defaults.dirs[DEFAULT_DIR_LOGS]));
#ifdef HAVE_MENU
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
   snprintf(g_defaults.settings.menu,
         sizeof(g_defaults.settings.menu), "xmb");
#endif
#endif
}
コード例 #6
0
ファイル: platform_win32.c プロジェクト: pindet015/RetroArch
static void frontend_win32_environment_get(int *argc, char *argv[],
      void *args, void *params_data)
{
   gfx_set_dwm();

   fill_pathname_expand_special(g_defaults.dir.assets,
      ":/assets", sizeof(g_defaults.dir.assets));
   fill_pathname_expand_special(g_defaults.dir.audio_filter,
      ":/filters/audio", sizeof(g_defaults.dir.audio_filter));
   fill_pathname_expand_special(g_defaults.dir.video_filter,
      ":/filters/video", sizeof(g_defaults.dir.video_filter));
   fill_pathname_expand_special(g_defaults.dir.cheats,
      ":/cheats", sizeof(g_defaults.dir.cheats));
   fill_pathname_expand_special(g_defaults.dir.database,
      ":/database/rdb", sizeof(g_defaults.dir.database));
   fill_pathname_expand_special(g_defaults.dir.cursor,
   ":/database/cursors", sizeof(g_defaults.dir.cursor));
   fill_pathname_expand_special(g_defaults.dir.playlist,
      ":/playlists", sizeof(g_defaults.dir.assets));
   fill_pathname_expand_special(g_defaults.dir.menu_config,
      ":/config", sizeof(g_defaults.dir.menu_config));
   fill_pathname_expand_special(g_defaults.dir.remap,
      ":/config/remaps", sizeof(g_defaults.dir.remap));
   fill_pathname_expand_special(g_defaults.dir.wallpapers,
      ":/assets/wallpapers", sizeof(g_defaults.dir.wallpapers));
   fill_pathname_expand_special(g_defaults.dir.thumbnails,
      ":/thumbnails", sizeof(g_defaults.dir.thumbnails));
   fill_pathname_expand_special(g_defaults.dir.overlay,
      ":/overlays", sizeof(g_defaults.dir.overlay));
   fill_pathname_expand_special(g_defaults.dir.osk_overlay,
      ":/overlays", sizeof(g_defaults.dir.osk_overlay));
   fill_pathname_expand_special(g_defaults.dir.osk_overlay,
      ":/overlays", sizeof(g_defaults.dir.osk_overlay));
   fill_pathname_expand_special(g_defaults.dir.core,
      ":/cores", sizeof(g_defaults.dir.core));
   fill_pathname_expand_special(g_defaults.dir.core_info,
      ":/info", sizeof(g_defaults.dir.core_info));
   fill_pathname_expand_special(g_defaults.dir.autoconfig,
      ":/autoconfig", sizeof(g_defaults.dir.autoconfig));
   fill_pathname_expand_special(g_defaults.dir.shader,
      ":/shaders", sizeof(g_defaults.dir.shader));
   fill_pathname_expand_special(g_defaults.dir.core_assets,
      ":/downloads", sizeof(g_defaults.dir.core_assets));
   fill_pathname_expand_special(g_defaults.dir.screenshot,
      ":/screenshots", sizeof(g_defaults.dir.screenshot));

/* don't force this in the driver anymore, these will be handled by
   a dummy config file  so they can be reset to content dir

   fill_pathname_expand_special(g_defaults.dir.sram,
      ":/saves", sizeof(g_defaults.dir.sram));
   fill_pathname_expand_special(g_defaults.dir.savestate,
      ":/states", sizeof(g_defaults.dir.savestate));
   fill_pathname_expand_special(g_defaults.dir.system,
      ":/system", sizeof(g_defaults.dir.system));
*/
#ifdef HAVE_MENU
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
   snprintf(g_defaults.settings.menu, sizeof(g_defaults.settings.menu), "xmb");
#endif
#endif
}
コード例 #7
0
ファイル: settings.c プロジェクト: Gamesonic/RetroArch
void config_set_defaults(void)
{
   unsigned i, j;
   const char *def_video = config_get_default_video();
   const char *def_audio = config_get_default_audio();
   const char *def_input = config_get_default_input();
#ifdef HAVE_CAMERA
   const char *def_camera = config_get_default_camera();

   if (def_camera)
      strlcpy(g_settings.camera.driver, def_camera, sizeof(g_settings.camera.driver));
#endif

#ifdef HAVE_LOCATION
   const char *def_location = config_get_default_location();

   if (def_location)
      strlcpy(g_settings.location.driver, def_location, sizeof(g_settings.location.driver));
#endif

#ifdef HAVE_OSK
   const char *def_osk = config_get_default_osk();

   if (def_osk)
      strlcpy(g_settings.osk.driver, def_osk, sizeof(g_settings.osk.driver));
#endif
   if (def_video)
      strlcpy(g_settings.video.driver, def_video, sizeof(g_settings.video.driver));
   if (def_audio)
      strlcpy(g_settings.audio.driver, def_audio, sizeof(g_settings.audio.driver));
   if (def_input)
      strlcpy(g_settings.input.driver, def_input, sizeof(g_settings.input.driver));

   g_settings.video.xscale = xscale;
   g_settings.video.yscale = yscale;
   g_settings.video.fullscreen = g_extern.force_fullscreen ? true : fullscreen;
   g_settings.video.windowed_fullscreen = windowed_fullscreen;
   g_settings.video.monitor_index = monitor_index;
   g_settings.video.fullscreen_x = fullscreen_x;
   g_settings.video.fullscreen_y = fullscreen_y;
   g_settings.video.disable_composition = disable_composition;
   g_settings.video.vsync = vsync;
   g_settings.video.hard_sync = hard_sync;
   g_settings.video.hard_sync_frames = hard_sync_frames;
   g_settings.video.black_frame_insertion = black_frame_insertion;
   g_settings.video.swap_interval = swap_interval;
   g_settings.video.threaded = video_threaded;
   g_settings.video.smooth = video_smooth;
   g_settings.video.force_aspect = force_aspect;
   g_settings.video.scale_integer = scale_integer;
   g_settings.video.crop_overscan = crop_overscan;
   g_settings.video.aspect_ratio = aspect_ratio;
   g_settings.video.aspect_ratio_auto = aspect_ratio_auto; // Let implementation decide if automatic, or 1:1 PAR.
   g_settings.video.aspect_ratio_idx = aspect_ratio_idx;
   g_settings.video.shader_enable = shader_enable;
   g_settings.video.allow_rotate = allow_rotate;

   g_settings.video.font_enable = font_enable;
   g_settings.video.font_size = font_size;
   g_settings.video.font_scale = font_scale;
   g_settings.video.msg_pos_x = message_pos_offset_x;
   g_settings.video.msg_pos_y = message_pos_offset_y;
   
   g_settings.video.msg_color_r = ((message_color >> 16) & 0xff) / 255.0f;
   g_settings.video.msg_color_g = ((message_color >>  8) & 0xff) / 255.0f;
   g_settings.video.msg_color_b = ((message_color >>  0) & 0xff) / 255.0f;

   g_settings.video.refresh_rate = refresh_rate;
   g_settings.video.post_filter_record = post_filter_record;
   g_settings.video.gpu_record = gpu_record;
   g_settings.video.gpu_screenshot = gpu_screenshot;
   g_settings.video.rotation = ORIENTATION_NORMAL;

   g_settings.audio.enable = audio_enable;
   g_settings.audio.out_rate = out_rate;
   g_settings.audio.block_frames = 0;
   g_settings.audio.in_rate = out_rate;
   if (audio_device)
      strlcpy(g_settings.audio.device, audio_device, sizeof(g_settings.audio.device));
   g_settings.audio.latency = out_latency;
   g_settings.audio.sync = audio_sync;
   g_settings.audio.rate_control = rate_control;
   g_settings.audio.rate_control_delta = rate_control_delta;
   g_settings.audio.volume = audio_volume;

   g_settings.rewind_enable = rewind_enable;
   g_settings.rewind_buffer_size = rewind_buffer_size;
   g_settings.rewind_granularity = rewind_granularity;
   g_settings.slowmotion_ratio = slowmotion_ratio;
   g_settings.fastforward_ratio = fastforward_ratio;
   g_settings.pause_nonactive = pause_nonactive;
   g_settings.autosave_interval = autosave_interval;

   g_settings.block_sram_overwrite = block_sram_overwrite;
   g_settings.savestate_auto_index = savestate_auto_index;
   g_settings.savestate_auto_save  = savestate_auto_save;
   g_settings.savestate_auto_load  = savestate_auto_load;
   g_settings.network_cmd_enable   = network_cmd_enable;
   g_settings.network_cmd_port     = network_cmd_port;
   g_settings.stdin_cmd_enable     = stdin_cmd_enable;
   g_settings.game_history_size    = game_history_size;

   g_settings.rgui_show_start_screen = rgui_show_start_screen;

   rarch_assert(sizeof(g_settings.input.binds[0]) >= sizeof(retro_keybinds_1));
   rarch_assert(sizeof(g_settings.input.binds[1]) >= sizeof(retro_keybinds_rest));
   memcpy(g_settings.input.binds[0], retro_keybinds_1, sizeof(retro_keybinds_1));
#ifdef RARCH_CONSOLE
   memcpy(g_settings.input.menu_binds, retro_keybinds_menu, sizeof(retro_keybinds_menu));
#endif
   for (i = 1; i < MAX_PLAYERS; i++)
      memcpy(g_settings.input.binds[i], retro_keybinds_rest, sizeof(retro_keybinds_rest));

   for (i = 0; i < MAX_PLAYERS; i++)
   {
      for (j = 0; j < RARCH_BIND_LIST_END; j++)
      {
         g_settings.input.autoconf_binds[i][j].joykey = NO_BTN;
         g_settings.input.autoconf_binds[i][j].joyaxis = AXIS_NONE;
      }
   }
   memset(g_settings.input.autoconfigured, 0, sizeof(g_settings.input.autoconfigured));

   // Verify that binds are in proper order.
   for (i = 0; i < MAX_PLAYERS; i++)
      for (j = 0; j < RARCH_BIND_LIST_END; j++)
         if (g_settings.input.binds[i][j].valid)
            rarch_assert(j == g_settings.input.binds[i][j].id);

   g_settings.input.axis_threshold = axis_threshold;
   g_settings.input.netplay_client_swap_input = netplay_client_swap_input;
   g_settings.input.turbo_period = turbo_period;
   g_settings.input.turbo_duty_cycle = turbo_duty_cycle;
   g_settings.input.overlay_opacity = 0.7f;
   g_settings.input.overlay_scale = 1.0f;
   g_settings.input.debug_enable = input_debug_enable;
   g_settings.input.autodetect_enable = input_autodetect_enable;
   *g_settings.input.keyboard_layout = '\0';
#ifdef ANDROID
   g_settings.input.back_behavior = BACK_BUTTON_QUIT;
#endif

   for (i = 0; i < MAX_PLAYERS; i++)
   {
      g_settings.input.joypad_map[i] = i;
      g_settings.input.analog_dpad_mode[i] = ANALOG_DPAD_NONE;
      if (!g_extern.has_set_libretro_device[i])
         g_settings.input.libretro_device[i] = RETRO_DEVICE_JOYPAD;
   }

   g_extern.console.screen.viewports.custom_vp.width = 0;
   g_extern.console.screen.viewports.custom_vp.height = 0;
   g_extern.console.screen.viewports.custom_vp.x = 0;
   g_extern.console.screen.viewports.custom_vp.y = 0;

   // Make sure settings from other configs carry over into defaults for another config.
   if (!g_extern.has_set_save_path)
      *g_extern.savefile_dir = '\0';
   if (!g_extern.has_set_state_path)
      *g_extern.savestate_dir = '\0';
   *g_settings.libretro_info_path = '\0';
   *g_settings.core_options_path = '\0';
   *g_settings.game_history_path = '\0';
   *g_settings.cheat_database = '\0';
   *g_settings.cheat_settings_path = '\0';
   *g_settings.screenshot_directory = '\0';
   *g_settings.system_directory = '\0';
   *g_settings.input.autoconfig_dir = '\0';
   *g_settings.input.overlay = '\0';
   *g_settings.content_directory = '\0';
#ifdef HAVE_MENU
   *g_settings.rgui_content_directory = '\0';
   *g_settings.rgui_config_directory = '\0';
#endif

#ifdef RARCH_CONSOLE
   g_extern.lifecycle_state |= (1ULL << MODE_MENU_PREINIT);

   strlcpy(g_settings.system_directory, default_paths.system_dir, sizeof(g_settings.system_directory));

   g_settings.video.msg_pos_x = 0.05f;
   g_settings.video.msg_pos_y = 0.90f;
   g_settings.video.aspect_ratio = -1.0f;

   g_settings.core_specific_config = default_core_specific_config;

   // g_extern
   strlcpy(g_extern.savefile_dir, default_paths.sram_dir, sizeof(g_extern.savefile_dir));
   g_extern.console.screen.gamma_correction = DEFAULT_GAMMA;
   g_extern.lifecycle_state |= (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE);
   g_extern.lifecycle_state |= (1ULL << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE);
   g_extern.lifecycle_state |= (1ULL << MODE_VIDEO_SOFT_FILTER_ENABLE);
   g_extern.lifecycle_state |= (1ULL << MODE_VIDEO_FLICKER_FILTER_ENABLE);

   g_extern.console.screen.resolutions.current.id = 0;
   strlcpy(g_extern.savestate_dir, default_paths.savestate_dir, sizeof(g_extern.savestate_dir));

   g_extern.state_slot = 0;
   g_extern.audio_data.mute = 0;
   g_extern.verbose = true;

   g_extern.console.sound.mode = SOUND_MODE_NORMAL;
#ifdef _XBOX1
   g_extern.console.sound.volume_level = 0;
#endif
#endif
   
#ifdef HAVE_OVERLAY
   if (default_overlay_dir)
   {
      fill_pathname_expand_special(g_extern.overlay_dir, default_overlay_dir, sizeof(g_extern.overlay_dir));
#if defined(__QNX__) || defined(IOS)
      fill_pathname_join(g_settings.input.overlay, g_extern.overlay_dir, "snes/snes.cfg", sizeof(g_settings.input.overlay));
#endif
   }
#endif

   if (default_shader_dir)
      fill_pathname_expand_special(g_settings.video.shader_dir, default_shader_dir, sizeof(g_settings.video.shader_dir));

   if (default_libretro_path && !g_extern.has_set_libretro)
      fill_pathname_expand_special(g_settings.libretro, default_libretro_path, sizeof(g_settings.libretro));

   if (default_libretro_info_path)
      fill_pathname_expand_special(g_settings.libretro_info_path, default_libretro_info_path, sizeof(g_settings.libretro_info_path));

   if (default_config_path)
      fill_pathname_expand_special(g_extern.config_path, default_config_path, sizeof(g_extern.config_path));

   g_extern.config_save_on_exit = config_save_on_exit;

   /* Avoid reloading config on every ROM load */
   g_extern.block_config_read = default_block_config_read;

   rarch_init_msg_queue();
}