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

Allow launching a profile with command line arguments (--launch <uuid>) #48

Merged

Conversation

Sulfrix
Copy link
Contributor

@Sulfrix Sulfrix commented Aug 2, 2024

Some users may want to skip using the launcher and have a shortcut that directly launches YARG. This PR allows the YARC Launcher to read command line arguments and open the game immediately.

explorer_hbDyPyFZqi.mp4

Note that this is not the implementation for a "Create Shortcut" button or something similar, the shortcut shown in the example video was created manually. Nevertheless, it should make creating shortcuts fairly simple.

Some implementation details:

  • This PR uses the "clap" crate for argument parsing. It includes --help and --version arguments by default. I'm not sure if the extra dependency is wanted, but it seems like the easiest way to include argument parsing.
  • Since profile information doesn't seem to be accessible from the Rust backend, it doesn't directly launch the game. It stores the launch parameter, exposing it to the frontend, which later accesses it (right after profile information is initialized, in the loading screen component) and then launches it. Preferably, the backend would completely skip opening the frontend at all and would truly launch the game directly, but this is the easiest way I found to add this system to the launcher without moving any profile logic to the backend.
  • The launch logic was copied from the "ProfileState" code directly into the loading screen because useProfileState uses hooks, which makes it inaccessible during an effect. However, I could be wrong and there may be a way to directly use the launch() method without duplicating the logic.

@EliteAsian123
Copy link
Member

Hello, thanks for the PR! I appreciate it 😄

@EliteAsian123 EliteAsian123 merged commit 82b857b into YARC-Official:profile-rewrite Aug 2, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants