summaryrefslogtreecommitdiffstats
path: root/src/launcher/runner.rs
diff options
context:
space:
mode:
authorLibravatar bigfoot547 <[email protected]>2025-01-19 21:07:40 -0600
committerLibravatar bigfoot547 <[email protected]>2025-01-19 21:07:40 -0600
commitcce48864a2338a11cf7b9585350a327f70b8376b (patch)
tree137a81b56dd7426701f492d978662dc46db649b9 /src/launcher/runner.rs
parentmore stuff (diff)
update strsub
Diffstat (limited to 'src/launcher/runner.rs')
-rw-r--r--src/launcher/runner.rs47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/launcher/runner.rs b/src/launcher/runner.rs
new file mode 100644
index 0000000..8d12197
--- /dev/null
+++ b/src/launcher/runner.rs
@@ -0,0 +1,47 @@
+use std::borrow::Cow;
+use crate::launcher::Launch;
+use crate::launcher::strsub::SubFunc;
+
+impl<'k, 'rep, 'l: 'rep> SubFunc<'k, 'rep> for &'rep Launch<'l> {
+ fn substitute(self, key: &'k str) -> Option<Cow<'rep, str>> {
+ match key {
+ "assets_index_name" => self.asset_index_name.as_ref().map(|s| Cow::Borrowed(s.as_str())),
+ "assets_root" => Some(self.launcher.assets.get_home().to_string_lossy()),
+ "auth_access_token" => Some(Cow::Borrowed("-")), // TODO
+ "auth_player_name" => Some(Cow::Borrowed("Player")), // TODO
+ "auth_session" => Some(Cow::Borrowed("-")), // TODO
+ "auth_uuid" => Some(Cow::Borrowed("00000000-0000-0000-0000-000000000000")), // TODO
+ "auth_xuid" => Some(Cow::Borrowed("00000000-0000-0000-0000-000000000000")), // TODO
+ "classpath" => Some(Cow::Borrowed(self.classpath.as_str())), // TODO
+ "classpath_separator" => None, // FIXME
+ "game_assets" => self.virtual_assets_path.as_ref().map(|s| s.to_string_lossy()),
+ "game_directory" => Some(self.instance_home.to_string_lossy()),
+ "language" => Some(Cow::Borrowed("en-us")), // ???
+ "launcher_name" => Some(Cow::Borrowed("ozone (olauncher 3)")), // TODO
+ "launcher_version" => Some(Cow::Borrowed("yeah")), // TODO
+ "library_directory" => Some(self.launcher.libraries.home.to_string_lossy()),
+ "natives_directory" => Some(self.natives_path.to_string_lossy()),
+ "primary_jar" => self.client_jar.as_ref().map(|p| p.to_string_lossy()),
+ "quickPlayMultiplayer" => None, // TODO
+ "quickPlayPath" => None, // TODO
+ "quickPlayRealms" => None, // TODO
+ "quickPlaySingleplayer" => None, // TODO
+ "resolution_height" => None, // TODO
+ "resolution_width" => None, // TODO
+ "user_properties" => Some(Cow::Borrowed("{}")), // TODO
+ "user_property_map" => Some(Cow::Borrowed("[]")), // TODO
+ "user_type" => Some(Cow::Borrowed("legacy")), // TODO
+ "version_name" => Some(Cow::Borrowed(&self.version_id.as_ref())),
+ "version_type" => self.version_type.as_ref().map(|s| Cow::Borrowed(s.to_str())),
+ _ => {
+ if let Some(asset_key) = key.strip_prefix("asset=") {
+ return self.asset_index.as_ref()
+ .map_or(None, |idx| idx.objects.get(asset_key))
+ .map(|obj| Cow::Owned(self.launcher.assets.get_object_path(obj).to_string_lossy().into_owned()))
+ }
+
+ None
+ }
+ }
+ }
+} \ No newline at end of file