Skip to content

Commit

Permalink
Only display Jak 3 dev video on Windows (#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
xTVaser authored Mar 8, 2024
1 parent 58784f6 commit f6e59e0
Show file tree
Hide file tree
Showing 3 changed files with 197 additions and 189 deletions.
28 changes: 15 additions & 13 deletions src-tauri/src/commands/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,19 +440,21 @@ pub async fn does_active_tooling_version_support_game(
game_name: String,
) -> Result<bool, CommandError> {
let config_lock = config.lock().await;
// If we can't determine the version, assume its our first release
let active_version = config_lock
.active_version
.as_ref()
.ok_or(CommandError::Configuration(
"No active version set, can't perform operation".to_owned(),
))?;
let tooling_version = Version::parse(active_version.strip_prefix('v').unwrap_or(&active_version))
.unwrap_or(Version::new(0, 0, 1));
match game_name.as_str() {
"jak1" => Ok(true),
"jak2" => Ok(tooling_version.minor > 1 || tooling_version.patch >= 44),
_ => Ok(false),
match &config_lock.active_version {
Some(version) => {
// If we can't determine the version, assume its our first release
let tooling_version = Version::parse(version.strip_prefix('v').unwrap_or(&version))
.unwrap_or(Version::new(0, 0, 1));
match game_name.as_str() {
"jak1" => Ok(true),
"jak2" => Ok(tooling_version.minor > 1 || tooling_version.patch >= 44),
_ => Ok(false),
}
}
None => {
log::warn!("No active tooling version set, can't check the game supports it!");
Ok(false)
}
}
}

Expand Down
23 changes: 15 additions & 8 deletions src/components/background/Background.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
import jak2Background from "$assets/images/background-jak2.webp";
import jak3InProgressVid from "$assets/videos/jak3-dev.mp4";
import jak3InProgressPoster from "$assets/videos/jak3-poster.png";
import { platform } from "@tauri-apps/api/os";
const location = useLocation();
$: $location.pathname, updateStyle();
let style = "absolute object-fill h-screen brightness-75";
let jak1Image = "";
let onWindows = false;
onMount(async () => {
onWindows = (await platform()) === "win32";
const unlistenInstalled = await listen("gameInstalled", (event) => {
updateStyle();
});
Expand Down Expand Up @@ -55,12 +58,16 @@
{:else if $location.pathname == "/jak2"}
<img class={style} src={jak2Background} />
{:else if $location.pathname == "/jak3"}
<video
class={style}
poster={jak3InProgressPoster}
src={jak3InProgressVid}
autoplay
muted
loop
/>
{#if onWindows}
<video
class={style}
poster={jak3InProgressPoster}
src={jak3InProgressVid}
autoplay
muted
loop
/>
{:else}
<img class={style} src={jak3InProgressPoster} />
{/if}
{/if}
Loading

0 comments on commit f6e59e0

Please sign in to comment.