-
Notifications
You must be signed in to change notification settings - Fork 3
feat: app menu, more user prompts, cli and auto updater #1
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
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8a6e0e9
feat: add application menu and better user input
sinjs e9bb11d
reorganize components into own module
sinjs f171906
rename util -> utils and fix imports
sinjs 72e8d85
fix: wrap long messages
sinjs ee470b7
fix: ask for windows defender exclusion
sinjs 919b527
fix: some suggestions
sinjs 3f1dbf4
fix: compile error
sinjs 0abf6df
fix: use custom version of nalfix to remove required user input
sinjs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Valthrun Loader | ||
|
|
||
| The Valthrun Loader automatically maps the [Valthrun Kernel Driver](https://github.com/valthrun/valthrun-driver-kernel) using [KDMapper](https://github.com/TheCruZ/kdmapper) and starts the [Valthrun Overlay](https://github.com/valthrun/valthrun). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| use anyhow::Context; | ||
|
|
||
| use crate::{api, components, game, utils}; | ||
|
|
||
| pub async fn launch(http: &reqwest::Client, enhancer: components::Enhancer) -> anyhow::Result<()> { | ||
| for artifact in enhancer.required_artifacts() { | ||
| log::info!("Downloading {}", artifact.name()); | ||
|
|
||
| api::download_latest_artifact_version(http, artifact.slug(), artifact.file_name()) | ||
| .await | ||
| .context("failed to download {}")?; | ||
| } | ||
|
|
||
| // TODO: Make it game-independent to also allow PUBG, for example | ||
| if game::is_running() | ||
| .await | ||
| .context("failed to check if game is running")? | ||
| { | ||
| log::info!("Counter-Strike 2 is already running."); | ||
| } else { | ||
| log::info!("Counter-Strike 2 is not running."); | ||
|
|
||
| if utils::confirm_default("Do you want to launch the game?", true)? { | ||
| log::info!("Waiting for Counter-Strike 2 to start"); | ||
| game::launch_and_wait() | ||
| .await | ||
| .context("failed to wait for cs2 to launch")?; | ||
| } | ||
| } | ||
|
|
||
| utils::invoke_ps_command(&format!( | ||
| "Start-Process -FilePath '{}' -WorkingDirectory '{}'", | ||
| utils::get_downloads_path()? | ||
| .join(enhancer.artifact_to_execute().file_name()) | ||
| .display(), | ||
| std::env::current_exe() | ||
| .context("get current exe")? | ||
| .parent() | ||
| .context("get parent path")? | ||
| .display() | ||
| )) | ||
| .await | ||
| .context("failed to start overlay")?; | ||
|
|
||
| log::info!("Valthrun will now load. Have fun!"); | ||
|
|
||
| Ok(()) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| use anyhow::Context; | ||
|
|
||
| use crate::{api, driver, fixes, utils}; | ||
|
|
||
| pub async fn map_driver(http: &reqwest::Client) -> anyhow::Result<()> { | ||
| log::info!("Downloading Kernel Driver"); | ||
|
|
||
| api::download_latest_artifact_version(http, "kernel-driver", "kernel_driver.sys") | ||
| .await | ||
| .context("failed to download kernel driver")?; | ||
|
|
||
| log::info!("Downloading KDMapper"); | ||
|
|
||
| utils::download_file( | ||
| &http, | ||
| "https://github.com/sinjs/kdmapper/releases/latest/download/kdmapper.exe", | ||
| &utils::get_downloads_path()?.join("kdmapper.exe"), | ||
| ) | ||
| .await | ||
| .context("failed to download kdmapper")?; | ||
|
|
||
| for service in [c"faceit", c"vgc", c"vgk", c"ESEADriver2"] { | ||
sinjs marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if fixes::is_service_running(service).context("check service running")? { | ||
| log::warn!( | ||
| "Running service '{}' may interfere with the Valthrun Kernel Driver.", | ||
sinjs marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| service.to_str()? | ||
| ); | ||
| utils::confirm_default("Do you want to stop it?", true)?; | ||
|
|
||
| fixes::stop_service(service.to_str()?) | ||
| .await | ||
| .context("stop service")?; | ||
| } | ||
| } | ||
|
|
||
| driver::ui_map_driver(&http) | ||
| .await | ||
| .context("failed to map driver")?; | ||
|
|
||
| log::info!("Driver successfully mapped"); | ||
|
|
||
| Ok(()) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| mod map_driver; | ||
| pub use map_driver::*; | ||
|
|
||
| mod launch; | ||
| pub use launch::*; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.