(Scripts generated by Antigravity with Gemini Flash 3.5)
This commit is contained in:
Executable
+77
@@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
# =======================
|
||||
CUSTOM_PCSX2_PATH="" # e.g. "/usr/bin/pcsx2" or "flatpak run net.pcsx2.PCSX2"
|
||||
# =======================
|
||||
|
||||
get_target_elf_name() {
|
||||
if [ -f "./Makefile" ]; then
|
||||
grep -oP '\S+\.elf' Makefile | head -n 1
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
find_pcsx2() {
|
||||
if [ -n "$CUSTOM_PCSX2_PATH" ]; then
|
||||
echo "$CUSTOM_PCSX2_PATH"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Check flatpak
|
||||
if command -v flatpak >/dev/null 2>&1 && flatpak list | grep -q "net.pcsx2.PCSX2"; then
|
||||
echo "flatpak run net.pcsx2.PCSX2"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Check if pcsx2-qt is in PATH
|
||||
if command -v pcsx2-qt >/dev/null 2>&1; then
|
||||
echo "pcsx2-qt"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Check if pcsx2 is in PATH
|
||||
if command -v pcsx2 >/dev/null 2>&1; then
|
||||
echo "pcsx2"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Error: PCSX2 not found! Please install it, put it in PATH, or specify CUSTOM_PCSX2_PATH in this script." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
run_pcsx2() {
|
||||
local pcsx2_cmd
|
||||
pcsx2_cmd=$(find_pcsx2)
|
||||
|
||||
local elf_name
|
||||
elf_name=$(get_target_elf_name)
|
||||
if [ -z "$elf_name" ]; then
|
||||
echo "Error: Could not find target ELF name in Makefile!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local target_file
|
||||
target_file="$(pwd)/bin/$elf_name"
|
||||
|
||||
if [ ! -f "$target_file" ]; then
|
||||
echo "Error: ELF file not found at $target_file. Did you build the project?" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Kill existing PCSX2 instances
|
||||
if [[ "$pcsx2_cmd" == *"flatpak"* ]]; then
|
||||
pkill -f "net.pcsx2.PCSX2" >/dev/null 2>&1 || true
|
||||
pkill -f "pcsx2-qt" >/dev/null 2>&1 || true
|
||||
else
|
||||
local bin_name
|
||||
bin_name=$(basename "$pcsx2_cmd")
|
||||
pkill "$bin_name" >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
echo "Running PCSX2: $pcsx2_cmd -elf $target_file"
|
||||
|
||||
# Run PCSX2 in the background
|
||||
$pcsx2_cmd -elf "$target_file" &
|
||||
}
|
||||
|
||||
run_pcsx2
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||
cd "$SCRIPT_DIR" || exit 1
|
||||
./linux-pcsx2.sh
|
||||
Reference in New Issue
Block a user