Files
ample/AmpleLinux/AmpleLinux.sh
T
anomixerandUser fdd02b9d5b Pull Request: Add native Windows (AmpleWin) and Linux (AmpleLinux) ports (#46)
* Initialize and finalize AmpleWin: Full-featured Windows Port with Adaptive UI, optimized engine, and internationalized documentation

* Update media args

* AmpleWin: Finalized Windows Port with Adaptive UI, Optimized Engine, VGM Recording, and Shared Directory Support

* Fix NameError: subprocess not defined in main.py

* UI: Remove redundant MAME path label from Paths tab

* UI: Implement smart slot validation for disabled options and click-to-browse Shared Directory

* feat(win): editable console, launch logic fixes & doc updates

* Fix path quoting issues, add file selectors for A/V, and normalize shared dir path

* feat: sync with Ample v0.285 resources, update to MAME 0.285, and add ROM search filter

* v0.285: Expand ROM library, implement download failover, and advanced SCSI sub-slot emulation

* Adjust ROM download priority: prefer callapple.org for stability, mdk.cab as fallback

* Sync roms.plist with upstream/master

* docs(agent): record upstream synchronization session

* refactor: rename mame_bin to mame directory

* chore: update .gitignore for mame directory rename

* fix(main): update download and detection paths to 'mame'

* fix(main): robust path resolution for pyinstaller builds

* docs(readme): add build_exe.bat to project structure

* fix(build): remove creation of empty mame directory to avoid confusion

* feat(build): auto-generate application icon from Assets.xcassets

* Add AmpleLinux - Linux Port of Ample (Apple II/Mac emulator frontend)

- Ported from AmpleWin with ~20 Linux-specific adaptations
- Replaced winreg with gsettings/KDE dark mode detection
- Replaced os.startfile with xdg-open
- Removed MAME auto-download (users install via package manager)
- Added system-wide MAME detection (PATH, /usr/bin, /usr/games)
- Removed all .exe suffixes from binary references
- Created AmpleLinux.sh launcher script
- Dual-language READMEs (English + Traditional Chinese)

* Fix: use python3 -m pip instead of pip3/pip for modern Linux compatibility

* feat(linux): Finalize AmpleLinux port documentation and build scripts

* Fix formatting for Windows and Linux user notes

Updated user guidance for Windows and Linux users.

* feat(linux): interactive .desktop install, runtime icon loading, updated docs

* docs(linux): clarify mame_downloader.py usage status

* docs: add PR draft template

* fix(linux): add binutils dependency check for pyinstaller

* Update: mame 0.286

---------

Co-authored-by: User <user@example.com>
2026-03-07 21:57:26 -05:00

114 lines
3.4 KiB
Bash
Executable File

#!/bin/bash
echo "========================================"
echo " Ample - Linux Port Auto Launcher"
echo "========================================"
# --- First-Time Setup: Install system-level dependencies ---
if command -v apt &> /dev/null; then
# libxcb-cursor0 is required by Qt/PySide6 on X11
NEED_INSTALL=0
for pkg in python3-full libxcb-cursor0; do
if ! dpkg -s "$pkg" &> /dev/null 2>&1; then
NEED_INSTALL=1
break
fi
done
if [ $NEED_INSTALL -eq 1 ]; then
echo "[SETUP] Installing required system packages..."
echo " sudo apt install python3-full libxcb-cursor*"
sudo apt install -y python3-full libxcb-cursor*
if [ $? -ne 0 ]; then
echo "[WARN] Some packages may have failed to install. Continuing anyway..."
else
echo "[SETUP] System packages installed successfully."
fi
fi
fi
# --- ALSA Audio Permission Fix ---
if [ -d /proc/asound ]; then
if ! id -nG "$(whoami)" | grep -qw "audio"; then
echo "[SETUP] ALSA audio system detected. Adding user to 'audio' group..."
sudo usermod -a -G audio "$(whoami)"
if [ $? -eq 0 ]; then
echo "[SETUP] Added $(whoami) to 'audio' group. Please log out and back in for this to take effect."
else
echo "[WARN] Failed to add user to 'audio' group. Sound may not work properly."
fi
fi
fi
# Check for Python 3
if ! command -v python3 &> /dev/null; then
echo "[ERROR] Python 3 not found! Please install Python 3.9 or newer."
echo " Ubuntu/Debian: sudo apt install python3 python3-full"
echo " Fedora: sudo dnf install python3 python3-pip"
echo " Arch: sudo pacman -S python python-pip"
exit 1
fi
# Navigate to script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
# --- Virtual Environment Setup ---
VENV_DIR=".venv"
# Ensure python3-venv is available
if ! python3 -m venv --help &> /dev/null; then
echo "[INFO] python3-venv is required but not installed."
if command -v apt &> /dev/null; then
PY_VER=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
echo "[INFO] Installing python3.${PY_VER}-venv ..."
sudo apt install -y "python3.${PY_VER}-venv" python3-full
else
echo "[ERROR] Please install python3-venv for your distro and try again."
exit 1
fi
fi
# Recreate if venv is broken
if [ -d "$VENV_DIR" ] && [ ! -f "$VENV_DIR/bin/activate" ]; then
echo "[WARN] Virtual environment is broken, recreating..."
rm -rf "$VENV_DIR"
fi
# Create venv if it doesn't exist
if [ ! -d "$VENV_DIR" ]; then
echo "[1/3] Creating virtual environment..."
python3 -m venv "$VENV_DIR"
else
echo "[1/3] Virtual environment found."
fi
# Activate venv
source "$VENV_DIR/bin/activate"
# Install/Update dependencies
echo "[2/3] Checking dependencies..."
pip install -r requirements.txt --quiet 2>/dev/null
if [ $? -ne 0 ]; then
echo "[WARN] pip install failed, retrying with upgrade..."
pip install --upgrade pip --quiet 2>/dev/null
pip install -r requirements.txt --quiet
if [ $? -ne 0 ]; then
echo "[ERROR] Failed to install requirements."
deactivate
exit 1
fi
fi
# Run the application
echo "[3/3] Launching Ample..."
python3 main.py
if [ $? -ne 0 ]; then
echo ""
echo "[INFO] Application exited with error."
read -p "Press Enter to continue..."
fi
deactivate