Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ User-facing changes only. The release workflow publishes the matching

## [Unreleased]

### Added

- A Setups page that opens first: every setup with its HUD's picture and key details, and
one click to switch, or to switch and play.

### Fixed

- Viewmodels: hiding a weapon no longer hides another weapon you left shown when the two share
Expand Down
23 changes: 23 additions & 0 deletions apps/desktop/src-tauri/core/src/comfig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,29 @@ pub fn read_comfig_state_from(
})
}

/// The preset a saved profile's setup hook selects, or `None` when the profile
/// has no mastercomfig base package. An unreadable hook reads as the default.
pub(crate) fn saved_preset(
profiles_dir: &Path,
manifest: &ProfileManifest,
) -> Option<ComfigPreset> {
if !manifest
.files
.iter()
.any(|file| is_shared_rel_path(&file.path))
{
return None;
}
let hook = read_profile_text(profiles_dir, &manifest.id, &manifest.files, SETUP_HOOK)
.ok()
.flatten();
Some(
hook.as_deref()
.map(parse_setup_hook)
.unwrap_or(ComfigPreset::Medium),
)
}

pub fn write_comfig_preset(
tf2_root: &Path,
profile_id: &str,
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src-tauri/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub mod profile_compare;
pub mod restore_points;
pub mod settings;
pub mod settings_copy;
pub mod setup_overview;
pub mod steam_inf;
pub mod storage;
pub mod surface;
Expand Down
16 changes: 11 additions & 5 deletions apps/desktop/src-tauri/core/src/profile_compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ pub(crate) fn tokens(line: &str) -> Vec<String> {
}

/// `name value` and `bind key command` lines, last one wins, credentials skipped.
fn managed_values(text: &str) -> BTreeMap<String, String> {
pub(crate) fn managed_values(text: &str) -> BTreeMap<String, String> {
let mut values = BTreeMap::new();
for line in text.lines() {
let parts = tokens(line);
Expand Down Expand Up @@ -221,16 +221,22 @@ pub(crate) fn sound_names(
)
}

fn library_side(profiles_dir: &Path, manifest: &ProfileManifest) -> CompareSide {
let mut managed_text = String::new();
/// The execs Gameplay and Binds cfg text a saved profile holds, concatenated.
pub(crate) fn managed_text(profiles_dir: &Path, manifest: &ProfileManifest) -> String {
let mut text = String::new();
for path in MANAGED_COMPARE_PATHS {
if manifest.files.iter().any(|file| file.path == path) {
if let Ok(bytes) = profile_file_bytes_from(profiles_dir, &manifest.id, path) {
managed_text.push_str(&String::from_utf8_lossy(&bytes));
managed_text.push('\n');
text.push_str(&String::from_utf8_lossy(&bytes));
text.push('\n');
}
}
}
text
}

fn library_side(profiles_dir: &Path, manifest: &ProfileManifest) -> CompareSide {
let managed_text = managed_text(profiles_dir, manifest);
let (hit_sound, kill_sound) = sound_names(manifest.hitsound.as_ref());
CompareSide {
id: manifest.id.clone(),
Expand Down
Loading
Loading