diff --git a/assets/star.svg b/assets/star.svg
new file mode 100644
index 00000000..8fed1d34
--- /dev/null
+++ b/assets/star.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/crates/lcu/src/cmd.rs b/crates/lcu/src/cmd.rs
index 07a6fb54..238a9c84 100644
--- a/crates/lcu/src/cmd.rs
+++ b/crates/lcu/src/cmd.rs
@@ -20,6 +20,7 @@ lazy_static! {
static ref REGION_REGEXP: regex::Regex = regex::Regex::new(r"--region=\S+").unwrap();
static ref DIR_REGEXP: regex::Regex =
regex::Regex::new(r#"--install-directory=(.*?)""#).unwrap();
+ static ref MAC_DIR_REGEXP: regex::Regex = regex::Regex::new(r"--install-directory=([^\s]+).*?--").unwrap();
}
pub fn make_auth_url(token: &String, port: &String) -> String {
@@ -89,6 +90,7 @@ pub fn get_commandline() -> CommandLineOutput {
let mut auth_url = String::new();
let mut token = String::new();
let mut port = String::new();
+ let mut dir = String::new();
let mut is_tencent = false;
{
let stdout = cmd.stdout.as_mut().unwrap();
@@ -106,6 +108,11 @@ pub fn get_commandline() -> CommandLineOutput {
port,
..
} = match_stdout(&s);
+ dir = if let Some(dir_match) = MAC_DIR_REGEXP.find(&s) {
+ dir_match.as_str().replace(DIR_KEY, "").replace(" --", "")
+ } else {
+ "".to_string()
+ };
break;
}
}
@@ -122,6 +129,7 @@ pub fn get_commandline() -> CommandLineOutput {
is_tencent,
token,
port,
+ dir,
..Default::default()
}
}
diff --git a/crates/lcu/src/source.rs b/crates/lcu/src/source.rs
index 860d3681..08579f46 100644
--- a/crates/lcu/src/source.rs
+++ b/crates/lcu/src/source.rs
@@ -11,31 +11,3 @@ pub struct SourceItem {
#[serde(rename(serialize = "isUrf", deserialize = "isURF"))]
pub is_urf: Option,
}
-
-const SR_ICON: &[u8] = include_bytes!("../../../assets/sr.png");
-const ARAM_ICON: &[u8] = include_bytes!("../../../assets/aram.png");
-const URF_ICON: &[u8] = include_bytes!("../../../assets/urf.png");
-
-impl SourceItem {
- pub fn get_mode_text(s: &Self) -> &'static str {
- if let Some(true) = s.is_aram {
- return "ARAM";
- }
- if let Some(true) = s.is_urf {
- return "URF";
- }
-
- "SR"
- }
-
- pub fn get_mode_icon(s: &Self) -> &'static [u8] {
- if let Some(true) = s.is_aram {
- return ARAM_ICON;
- }
- if let Some(true) = s.is_urf {
- return URF_ICON;
- }
-
- SR_ICON
- }
-}
diff --git a/crates/source_gui/src/ui.rs b/crates/source_gui/src/ui.rs
index ffa78dcd..962a9317 100644
--- a/crates/source_gui/src/ui.rs
+++ b/crates/source_gui/src/ui.rs
@@ -68,10 +68,7 @@ impl eframe::App for SourceWindow {
self.show_rune_viewport.store(true, Ordering::Relaxed);
}
- if self
- .show_rune_viewport
- .load(Ordering::Relaxed)
- {
+ if self.show_rune_viewport.load(Ordering::Relaxed) {
let rune_ui_state = self.rune_ui_state.clone();
let show_rune_viewport = self.show_rune_viewport.clone();
let lcu_auth = self.lcu_auth.clone();
@@ -158,10 +155,12 @@ impl eframe::App for SourceWindow {
}
}
- if item.is_aram.unwrap_or_default() {
+ if item.value.ends_with("aram")
+ || item.value.starts_with("murderbridge")
+ {
ui.image(egui::include_image!("../../../assets/aram.png"))
.on_hover_text("All Random All Mid");
- } else if item.is_urf.unwrap_or_default() {
+ } else if item.value.ends_with("urf") {
ui.image(egui::include_image!("../../../assets/urf.png"))
.on_hover_text("Ultra Rapid Fire");
} else {
@@ -205,11 +204,14 @@ impl eframe::App for SourceWindow {
}
});
- let random_mode = self.random_mode.clone();
- ui.horizontal(|ui| {
- ui.label("Random mode");
- toogle_ui::make_toggle(ui, &mut random_mode.lock().unwrap());
- });
+ #[cfg(debug_assertions)]
+ {
+ let random_mode = self.random_mode.clone();
+ ui.horizontal(|ui| {
+ ui.label("Random mode");
+ toogle_ui::make_toggle(ui, &mut random_mode.lock().unwrap());
+ });
+ }
} else {
ui.horizontal(|ui| {
ui.label("Is League client running?");
@@ -222,7 +224,15 @@ impl eframe::App for SourceWindow {
ui.add_space(8.);
ui.vertical_centered(|ui| {
ui.hyperlink("https://github.com/cangzhang/champ-r");
- ui.label("If you like it, please star ⭐ on GitHub");
+ ui.spacing();
+ ui.horizontal_top(|ui| {
+ ui.label("If you like it, please star");
+ ui.add(
+ egui::Image::new(egui::include_image!("../../../assets/star.svg"))
+ .fit_to_exact_size(egui::vec2(16., 16.)),
+ );
+ ui.label("on GitHub");
+ });
});
ui.add_space(8.);
});
@@ -235,9 +245,7 @@ pub fn setup_custom_fonts(ctx: &egui::Context) {
fonts.font_data.insert(
"Inter-Regular".to_owned(),
- egui::FontData::from_static(include_bytes!(
- "../../../assets/fonts/Inter-Regular.ttf"
- )),
+ egui::FontData::from_static(include_bytes!("../../../assets/fonts/Inter-Regular.ttf")),
);
// Put font first (highest priority) for proportional text: