void menu_input_st_string_callback(void *userdata, const char *str) { menu_handle_t *menu = menu_driver_get_ptr(); if (!menu) return; if (str && *str) { rarch_setting_t *current_setting = NULL; global_t *global = global_get_ptr(); if ((current_setting = (rarch_setting_t*) setting_find_setting( menu->list_settings, menu->keyboard.label_setting))) { strlcpy(current_setting->value.string, str, current_setting->size); menu_setting_generic(current_setting); } else { if (!strcmp(menu->keyboard.label_setting, "video_shader_preset_save_as")) menu_shader_manager_save_preset(str, false); else if (!strcmp(menu->keyboard.label_setting, "remap_file_save_as")) input_remapping_save_file(str); else if (!strcmp(menu->keyboard.label_setting, "cheat_file_save_as")) cheat_manager_save(global->cheat, str); } } menu_input_key_end_line(); }
void menu_input_st_string_callback(void *userdata, const char *str) { if (str && *str) { rarch_setting_t *setting = NULL; const char *label = NULL; global_t *global = global_get_ptr(); menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_LABEL_SETTING, &label); setting = menu_setting_find(label); if (setting) { menu_setting_set_with_string_representation(setting, str); menu_setting_generic(setting, false); } else { uint32_t hash_label = menu_hash_calculate(label); switch (hash_label) { case MENU_LABEL_VIDEO_SHADER_PRESET_SAVE_AS: menu_shader_manager_save_preset(str, false); break; case MENU_LABEL_CHEAT_FILE_SAVE_AS: cheat_manager_save(global->cheat, str); break; } } } menu_input_key_end_line(); }
/** * menu_shader_manager_apply_changes: * * Apply shader state changes. **/ void menu_shader_manager_apply_changes(void) { #ifdef HAVE_SHADER_MANAGER menu_handle_t *menu = menu_driver_get_ptr(); unsigned shader_type = menu_shader_manager_get_type(menu->shader); if (menu->shader->passes && shader_type != RARCH_SHADER_NONE) { menu_shader_manager_save_preset(NULL, true); return; } /* Fall-back */ #if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL) shader_type = video_shader_parse_type("", DEFAULT_SHADER_TYPE); #endif if (shader_type == RARCH_SHADER_NONE) { #if defined(HAVE_GLSL) shader_type = RARCH_SHADER_GLSL; #elif defined(HAVE_CG) || defined(HAVE_HLSL) shader_type = RARCH_SHADER_CG; #endif } menu_shader_manager_set_preset(NULL, shader_type, NULL); #endif }
void menu_input_st_string_callback(void *userdata, const char *str) { menu_handle_t *menu = menu_driver_resolve(); if (!menu) return; if (str && *str) { rarch_setting_t *current_setting = NULL; if ((current_setting = (rarch_setting_t*) setting_data_find_setting( menu->list_settings, menu->keyboard.label_setting))) menu_action_setting_set_current_string(current_setting, str); else { if (!strcmp(menu->keyboard.label_setting, "video_shader_preset_save_as")) menu_shader_manager_save_preset(str, false); else if (!strcmp(menu->keyboard.label_setting, "remap_file_save_as")) input_remapping_save_file(str); else if (!strcmp(menu->keyboard.label_setting, "cheat_file_save_as")) cheat_manager_save(g_extern.cheat, str); } } menu_input_key_end_line(); }
/** * menu_shader_manager_apply_changes: * * Apply shader state changes. **/ void menu_shader_manager_apply_changes(void) { #ifdef HAVE_SHADER_MANAGER unsigned shader_type; struct video_shader *shader = menu_shader_get(); if (!shader) return; shader_type = menu_shader_manager_get_type(shader); if (shader->passes && shader_type != RARCH_SHADER_NONE) { menu_shader_manager_save_preset(NULL, true, false); return; } /* Fall-back */ #if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL) shader_type = video_shader_parse_type("", DEFAULT_SHADER_TYPE); #endif if (shader_type == RARCH_SHADER_NONE) { #if defined(HAVE_GLSL) shader_type = RARCH_SHADER_GLSL; #elif defined(HAVE_CG) || defined(HAVE_HLSL) shader_type = RARCH_SHADER_CG; #elif defined(HAVE_VULKAN) shader_type = RARCH_SHADER_SLANG; #endif } menu_shader_manager_set_preset(NULL, shader_type, NULL); #endif }
void menu_input_st_string_callback(void *userdata, const char *str) { menu_input_t *menu_input = menu_input_get_ptr(); if (!menu_input) return; if (str && *str) { global_t *global = global_get_ptr(); rarch_setting_t *current_setting = menu_setting_find(menu_input->keyboard.label_setting); if (current_setting) { setting_set_with_string_representation(current_setting, str); menu_setting_generic(current_setting, false); } else { uint32_t hash_label = menu_hash_calculate(menu_input->keyboard.label_setting); switch (hash_label) { case MENU_LABEL_VIDEO_SHADER_PRESET_SAVE_AS: menu_shader_manager_save_preset(str, false); break; case MENU_LABEL_REMAP_FILE_SAVE_AS: input_remapping_save_file(str); break; case MENU_LABEL_CHEAT_FILE_SAVE_AS: cheat_manager_save(global->cheat, str); break; } } } menu_input_key_end_line(); }
void ShaderParamsDialog::saveShaderPreset(const char *path, unsigned action_type) { char directory[PATH_MAX_LENGTH]; char file[PATH_MAX_LENGTH]; char tmp[PATH_MAX_LENGTH]; settings_t *settings = config_get_ptr(); struct retro_system_info *system = runloop_get_libretro_system_info(); const char *core_name = system ? system->library_name : NULL; directory[0] = file[0] = tmp[0] = '\0'; if (!string_is_empty(core_name)) { fill_pathname_join( tmp, settings->paths.directory_video_shader, "presets", sizeof(tmp)); fill_pathname_join( directory, tmp, core_name, sizeof(directory)); } if (!filestream_exists(directory)) path_mkdir(directory); switch (action_type) { case SHADER_PRESET_SAVE_CORE: if (!string_is_empty(core_name)) fill_pathname_join(file, directory, core_name, sizeof(file)); break; case SHADER_PRESET_SAVE_GAME: { const char *game_name = path_basename(path_get(RARCH_PATH_BASENAME)); fill_pathname_join(file, directory, game_name, sizeof(file)); break; } case SHADER_PRESET_SAVE_PARENT: fill_pathname_parent_dir_name(tmp, path_get(RARCH_PATH_BASENAME), sizeof(tmp)); fill_pathname_join(file, directory, tmp, sizeof(file)); break; case SHADER_PRESET_SAVE_NORMAL: default: if (!string_is_empty(path)) strlcpy(file, path, sizeof(file)); break; } if (menu_shader_manager_save_preset(file, false, true)) runloop_msg_queue_push( msg_hash_to_str(MSG_SHADER_PRESET_SAVED_SUCCESSFULLY), 1, 100, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO ); else runloop_msg_queue_push( msg_hash_to_str(MSG_ERROR_SAVING_SHADER_PRESET), 1, 100, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR ); }