Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window name arg #12

Merged
merged 9 commits into from
Oct 10, 2024
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
35 changes: 33 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ When the highest value is determined by the ducat value and there is more than o
- Due to buffering when the game writes the `EE.log` file, it is possible that WFInfo doesn't pick up the reward screen event until the screen has disappeared. I haven't found a way of getting around the buffered writer.
If this happens, you can manually trigger the detection by pressing the F12 key.


- If you are using gamescope add the flag `--window-name=gamescope`

# Logging

Using the Environment Variables WFINFO_LOG you can control the output.
Expand Down
9 changes: 8 additions & 1 deletion src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,24 @@ fn benchmark() -> Result<(), Box<dyn Error>> {
}

#[derive(Parser)]
#[command(version, about, long_about = None)]
struct Arguments {
/// Path to the `EE.log` file located in the game installation directory
///
/// Most likely located at `~/.local/share/Steam/steamapps/compatdata/230410/pfx/drive_c/users/steamuser/AppData/Local/Warframe/EE.log`
game_log_file_path: Option<PathBuf>,
/// Warframe Window Name
///
/// some systems may require the window name to be specified (e.g. when using gamescope)
#[arg(short, long, default_value = "Warframe")]
window_name: String,
}

fn main() -> Result<(), Box<dyn Error>> {
let arguments = Arguments::parse();
let default_log_path = PathBuf::from_str(&std::env::var("HOME").unwrap()).unwrap().join(PathBuf::from_str(".local/share/Steam/steamapps/compatdata/230410/pfx/drive_c/users/steamuser/AppData/Local/Warframe/EE.log")?);
let log_path = arguments.game_log_file_path.unwrap_or(default_log_path);
let window_name = arguments.window_name;
let env = Env::default()
.filter_or("WFINFO_LOG", "info")
.write_style_or("WFINFO_STYLE", "always");
Expand All @@ -174,7 +181,7 @@ fn main() -> Result<(), Box<dyn Error>> {

let windows = Window::all()?;
let db = Database::load_from_file(None, None);
let Some(warframe_window) = windows.iter().find(|x| x.title() == "Warframe") else {
let Some(warframe_window) = windows.iter().find(|x| x.title() == window_name) else {
return Err("Warframe window not found".into());
};

Expand Down
Loading