Skip to content
Open
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
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -429,13 +429,13 @@ jobs:
- name: Cache APT packages
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: clang cmake meson ninja-build pkg-config nasm libgtk-3-dev liblzma-dev libstdc++-12-dev libasound2-dev libass-dev libfreetype-dev libfontconfig-dev libfribidi-dev libharfbuzz-dev libepoxy-dev libegl-dev libgl-dev libgnutls28-dev libpipewire-0.3-dev libva-dev libvdpau-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev libxpresent-dev libxkbcommon-dev libpulse-dev libdbus-1-dev libdrm-dev libgbm-dev libwayland-dev wayland-protocols liblcms2-dev ruby ruby-dev rubygems build-essential rpm libarchive-tools imagemagick
packages: clang cmake meson ninja-build pkg-config nasm libgtk-3-dev liblzma-dev libstdc++-12-dev libmanette-0.2-dev libasound2-dev libass-dev libfreetype-dev libfontconfig-dev libfribidi-dev libharfbuzz-dev libepoxy-dev libegl-dev libgl-dev libgnutls28-dev libpipewire-0.3-dev libva-dev libvdpau-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev libxpresent-dev libxkbcommon-dev libpulse-dev libdbus-1-dev libdrm-dev libgbm-dev libwayland-dev wayland-protocols liblcms2-dev ruby ruby-dev rubygems build-essential rpm libarchive-tools imagemagick
version: 1.1

- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake meson ninja-build pkg-config nasm libgtk-3-dev liblzma-dev libstdc++-12-dev libasound2-dev libass-dev libfreetype-dev libfontconfig-dev libfribidi-dev libharfbuzz-dev libepoxy-dev libegl-dev libgl-dev libgnutls28-dev libpipewire-0.3-dev libva-dev libvdpau-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev libxpresent-dev libxkbcommon-dev libpulse-dev libdbus-1-dev libdrm-dev libgbm-dev libwayland-dev wayland-protocols liblcms2-dev ruby ruby-dev rubygems build-essential rpm libarchive-tools imagemagick
sudo apt-get install -y clang cmake meson ninja-build pkg-config nasm libgtk-3-dev liblzma-dev libstdc++-12-dev libmanette-0.2-dev libasound2-dev libass-dev libfreetype-dev libfontconfig-dev libfribidi-dev libharfbuzz-dev libepoxy-dev libegl-dev libgl-dev libgnutls28-dev libpipewire-0.3-dev libva-dev libvdpau-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev libxpresent-dev libxkbcommon-dev libpulse-dev libdbus-1-dev libdrm-dev libgbm-dev libwayland-dev wayland-protocols liblcms2-dev ruby ruby-dev rubygems build-essential rpm libarchive-tools imagemagick

- name: Cache libmpv build
id: libmpv-cache
Expand Down Expand Up @@ -537,13 +537,13 @@ jobs:
- name: Cache APT packages
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: clang cmake meson ninja-build pkg-config nasm libgtk-3-dev liblzma-dev libstdc++-12-dev libasound2-dev libass-dev libfreetype-dev libfontconfig-dev libfribidi-dev libharfbuzz-dev libepoxy-dev libegl-dev libgl-dev libgnutls28-dev libpipewire-0.3-dev libva-dev libvdpau-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev libxpresent-dev libxkbcommon-dev libpulse-dev libdbus-1-dev libdrm-dev libgbm-dev libwayland-dev wayland-protocols liblcms2-dev ruby ruby-dev rubygems build-essential rpm libarchive-tools imagemagick
packages: clang cmake meson ninja-build pkg-config nasm libgtk-3-dev liblzma-dev libstdc++-12-dev libmanette-0.2-dev libasound2-dev libass-dev libfreetype-dev libfontconfig-dev libfribidi-dev libharfbuzz-dev libepoxy-dev libegl-dev libgl-dev libgnutls28-dev libpipewire-0.3-dev libva-dev libvdpau-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev libxpresent-dev libxkbcommon-dev libpulse-dev libdbus-1-dev libdrm-dev libgbm-dev libwayland-dev wayland-protocols liblcms2-dev ruby ruby-dev rubygems build-essential rpm libarchive-tools imagemagick
version: 1.1

- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake meson ninja-build pkg-config nasm libgtk-3-dev liblzma-dev libstdc++-12-dev libasound2-dev libass-dev libfreetype-dev libfontconfig-dev libfribidi-dev libharfbuzz-dev libepoxy-dev libegl-dev libgl-dev libgnutls28-dev libpipewire-0.3-dev libva-dev libvdpau-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev libxpresent-dev libxkbcommon-dev libpulse-dev libdbus-1-dev libdrm-dev libgbm-dev libwayland-dev wayland-protocols liblcms2-dev ruby ruby-dev rubygems build-essential rpm libarchive-tools imagemagick
sudo apt-get install -y clang cmake meson ninja-build pkg-config nasm libgtk-3-dev liblzma-dev libstdc++-12-dev libmanette-0.2-dev libasound2-dev libass-dev libfreetype-dev libfontconfig-dev libfribidi-dev libharfbuzz-dev libepoxy-dev libegl-dev libgl-dev libgnutls28-dev libpipewire-0.3-dev libva-dev libvdpau-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev libxpresent-dev libxkbcommon-dev libpulse-dev libdbus-1-dev libdrm-dev libgbm-dev libwayland-dev wayland-protocols liblcms2-dev ruby ruby-dev rubygems build-essential rpm libarchive-tools imagemagick

- name: Cache libmpv build
id: libmpv-cache
Expand Down
31 changes: 23 additions & 8 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/gestures.dart';
import 'package:plezy/utils/mouse_back_recognizer.dart';
import 'dart:io' show Platform;
import 'package:window_manager/window_manager.dart';
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -187,6 +188,9 @@ void _registerShaderLicenses() {
// Global RouteObserver for tracking navigation
final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();

// Global navigator key for accessing navigator from anywhere
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();

class MainApp extends StatefulWidget {
const MainApp({super.key});

Expand Down Expand Up @@ -317,14 +321,25 @@ class _MainAppState extends State<MainApp> with WidgetsBindingObserver {
builder: (context, themeProvider, child) {
return TranslationProvider(
child: InputModeTracker(
child: MaterialApp(
title: t.app.title,
debugShowCheckedModeBanner: false,
theme: themeProvider.lightTheme,
darkTheme: themeProvider.darkTheme,
themeMode: themeProvider.materialThemeMode,
navigatorObservers: [routeObserver, BackKeySuppressorObserver()],
home: const OrientationAwareSetup(),
child: RawGestureDetector(
gestures: <Type, GestureRecognizerFactory>{
MouseBackRecognizer: GestureRecognizerFactoryWithHandlers<MouseBackRecognizer>(
() => MouseBackRecognizer(),
(instance) => instance.onTapDown = (details) {
navigatorKey.currentState?.maybePop();
},
),
},
child: MaterialApp(
navigatorKey: navigatorKey,
title: t.app.title,
debugShowCheckedModeBanner: false,
theme: themeProvider.lightTheme,
darkTheme: themeProvider.darkTheme,
themeMode: themeProvider.materialThemeMode,
navigatorObservers: [routeObserver, BackKeySuppressorObserver()],
home: const OrientationAwareSetup(),
),
),
),
);
Expand Down
27 changes: 27 additions & 0 deletions lib/utils/mouse_back_recognizer.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import 'package:flutter/gestures.dart';

// From here: https://github.com/flutter/flutter/issues/115641#issuecomment-2267579790
class MouseBackRecognizer extends BaseTapGestureRecognizer {
GestureTapDownCallback? onTapDown;

MouseBackRecognizer({super.debugOwner, super.supportedDevices, super.allowedButtonsFilter});

@override
void handleTapCancel({required PointerDownEvent down, PointerCancelEvent? cancel, required String reason}) {}

@override
void handleTapDown({required PointerDownEvent down}) {
final TapDownDetails details = TapDownDetails(
globalPosition: down.position,
localPosition: down.localPosition,
kind: getKindForPointer(down.pointer),
);

if (down.buttons == kBackMouseButton && onTapDown != null) {
invokeCallback<void>('onTapDown', () => onTapDown!(details));
}
}

@override
void handleTapUp({required PointerDownEvent down, required PointerUpEvent up}) {}
}
4 changes: 0 additions & 4 deletions linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ set_target_properties(${BINARY_NAME}
)


# Bundle SDL3 from source so the build works on systems without libsdl3-dev
# (e.g. arm64 Linux where no distro package exists yet).
set(BUNDLE_SDL3 ON CACHE BOOL "" FORCE)

# Generated plugin build rules, which manage building the plugins and adding
# them to the application.
include(flutter/generated_plugins.cmake)
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1263,10 +1263,10 @@ packages:
dependency: "direct main"
description:
name: universal_gamepad
sha256: ab16fd55ad164101cd36ff5ea2252006aa2ba2a4929c63e6e68206795ef16084
sha256: "571461c8c1861b03c9ae4a160fb2cb5576b46fbbcd27f67a4f7a4bf5231c28ce"
url: "https://pub.dev"
source: hosted
version: "1.1.1"
version: "1.2.1"
url_launcher:
dependency: "direct main"
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dependencies:
path: wakelock_plus
path_provider: ^2.1.0
path: ^1.9.0
universal_gamepad: ^1.1.1
universal_gamepad: ^1.2.1
drift: ^2.28.2
sqlite3_flutter_libs: ^0.5.41
workmanager: ^0.9.0+3
Expand Down
42 changes: 26 additions & 16 deletions scripts/bundle_steam.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,41 @@ LIBMPV_DIR=$(dirname "$(find /build/libmpv-prefix -name libmpv.so | head -1)")
cp -a "$LIBMPV_DIR"/libmpv.so* "$BUNDLE_LIB/"
cp -a /build/libmpv-prefix/lib/libshaderc_shared.so* "$BUNDLE_LIB/"

# Bundle libmpv's runtime deps that the Steam Runtime doesn't ship.
# Bundle runtime deps that the Steam Runtime doesn't ship.
# /steam-rt-libs.txt was snapshot before we built anything (see Dockerfile).
echo ""
echo "==> Bundling libmpv runtime dependencies..."
echo "==> Bundling runtime dependencies not in Steam Runtime..."
RT_LIBS="/steam-rt-libs.txt"
ldd "$LIBMPV_DIR/libmpv.so" 2>/dev/null | grep "=> /" | awk '{print $3}' | while read dep; do
dep_name=$(basename "$dep")
if ! grep -qF "$dep_name" "$RT_LIBS"; then
if [ ! -f "$BUNDLE_LIB/$dep_name" ]; then
echo " Bundling $dep_name"
cp -a "$dep" "$BUNDLE_LIB/"
# Also copy any symlink variants
dep_dir=$(dirname "$dep")
dep_base=$(echo "$dep_name" | sed 's/\.so.*//')
cp -a "$dep_dir"/${dep_base}.so* "$BUNDLE_LIB/" 2>/dev/null || true

# Collect all binaries to scan: main binary, libmpv, and all plugin .so files.
SCAN_BINS=("$BUNDLE/plezy" "$LIBMPV_DIR/libmpv.so")
for so in "$BUNDLE_LIB"/*.so; do
[ -f "$so" ] && SCAN_BINS+=("$so")
done

for bin in "${SCAN_BINS[@]}"; do
ldd "$bin" 2>/dev/null | grep "=> /" | awk '{print $3}' | while read dep; do
dep_name=$(basename "$dep")
if ! grep -qF "$dep_name" "$RT_LIBS"; then
if [ ! -f "$BUNDLE_LIB/$dep_name" ]; then
echo " Bundling $dep_name (needed by $(basename "$bin"))"
cp -a "$dep" "$BUNDLE_LIB/"
dep_dir=$(dirname "$dep")
dep_base=$(echo "$dep_name" | sed 's/\.so.*//')
cp -a "$dep_dir"/${dep_base}.so* "$BUNDLE_LIB/" 2>/dev/null || true
fi
fi
fi
done
done

# Verify all deps resolve
echo ""
echo "==> Checking dependencies..."
MISSING=$(LD_LIBRARY_PATH="$BUNDLE_LIB" ldd "$BUNDLE/plezy" 2>&1 | grep "not found" || true)
MISSING_MPV=$(LD_LIBRARY_PATH="$BUNDLE_LIB" ldd "$BUNDLE_LIB/libmpv.so" 2>&1 | grep "not found" || true)
MISSING="$MISSING$MISSING_MPV"
MISSING=""
for bin in "$BUNDLE/plezy" "$BUNDLE_LIB"/*.so*; do
[ -f "$bin" ] || continue
MISSING+=$(LD_LIBRARY_PATH="$BUNDLE_LIB" ldd "$bin" 2>&1 | grep "not found" || true)
done
if [[ -n "$MISSING" ]]; then
echo "WARNING: Unresolved dependencies (will need Steam runtime):"
echo "$MISSING"
Expand Down
2 changes: 1 addition & 1 deletion scripts/steam.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ COPY --from=runtime-snapshot /steam-rt-libs.txt /steam-rt-libs.txt
# ─── Layer 1: apt deps (cached unless this block changes) ─────────────────────
RUN apt-get update -qq && apt-get install -y -qq \
clang cmake meson ninja-build pkg-config nasm git curl unzip xz-utils \
libgtk-3-dev liblzma-dev \
libgtk-3-dev liblzma-dev libmanette-0.2-dev \
libasound2-dev libass-dev libfreetype-dev libfontconfig-dev libfribidi-dev libharfbuzz-dev \
libepoxy-dev libegl-dev libgl-dev libgnutls28-dev \
libpipewire-0.3-dev libva-dev libvdpau-dev \
Expand Down