-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wip * various fixes, first working version * rename script from cart-loader to chimera-cart-loader * detect and use rom name to be able to use saves * add monitor service for automatically loading games from carts * whitespace fix * update setup to package new files * add artwork * prevent rewriting of system shortcuts * put binaries in the correct place * attempt to fix test failures
- Loading branch information
Showing
14 changed files
with
115 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#! /bin/bash | ||
|
||
hascart=false | ||
|
||
while true; do | ||
chimera-cart-loader --check | ||
result=$? | ||
if [ "$result" == "0" ] && [ $hascart == false ]; then | ||
chimera-cart-loader --trigger | ||
hascart=true | ||
elif [ "$result" != "0" ] && [ $hascart == true ]; then | ||
hascart=false | ||
fi | ||
sleep 3 | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Unit] | ||
Description=Chimera Cart Monitor - Automatically launch games from physical cartridges | ||
Requires=dev-gboperator.device | ||
After=dev-gboperator.device | ||
|
||
[Service] | ||
ExecStart=/usr/share/chimera/bin/chimera-cart-monitor | ||
Restart=always | ||
|
||
[Install] | ||
WantedBy=default.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
|
||
DUMP_DIR=/tmp/chimera-cart-loader | ||
|
||
function check { | ||
if ! lsusb | grep "1d50:6018" &> /dev/null; then | ||
# gboperator not connected | ||
return 1 | ||
fi | ||
|
||
cart_name=$(gbopyrator 2> /dev/null | grep "Detected game:" | cut -d":" -f2- | awk '{$1=$1;print}') | ||
|
||
if echo $cart_name | grep ".gb$" &> /dev/null; then | ||
# Game Boy cart detected | ||
echo "gb:::$cart_name" | ||
return 0 | ||
elif echo $cart_name | grep ".gbc$" &> /dev/null; then | ||
# Game Boy Color cart detected | ||
echo "gbc:::$cart_name" | ||
return 0 | ||
else | ||
# No valid cart detected | ||
return 2 | ||
fi | ||
} | ||
|
||
function load { | ||
launcher=$1 | ||
cart=$2 | ||
|
||
ROM="$DUMP_DIR/$cart" | ||
|
||
mkdir -p "$DUMP_DIR" | ||
trap "rm -rf $DUMP_DIR" EXIT | ||
gbopyrator --dump-rom "$ROM" | ||
$launcher "$ROM" | ||
} | ||
|
||
result=$(check) | ||
code=$? | ||
cart_type=$(echo $result | cut -d":" -f1) | ||
cart_name=$(echo $result | cut -d":" -f4-) | ||
|
||
if [ "$1" == "--check" ]; then | ||
echo "Detected: [$cart_type] $cart_name" | ||
exit $code | ||
elif [ "$1" == "--trigger" ] && [ "$code" == "0" ] && [ ! -e $DUMP_DIR ]; then | ||
# cart detected, trigger cart launch through Steam if not already triggered | ||
steam steam://rungameid/12273638796687310848 | ||
elif [ -z "$1" ] && [ -n "$cart_type" ] && [ -n "$cart_name" ]; then | ||
# no parameters means this script has been called from Steam, launch the cart directly if one is detected | ||
load "$cart_type" "$cart_name" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
- name: Cart Loader | ||
cmd: chimera-cart-loader | ||
condition: lsusb | grep 1d50:6018 | ||
hidden: false | ||
poster: /usr/share/chimera/images/cart-loader/poster.png | ||
banner: /usr/share/chimera/images/cart-loader/banner.png | ||
background: /usr/share/chimera/images/cart-loader/background.png | ||
logo: /usr/share/chimera/images/cart-loader/logo.png | ||
icon: /usr/share/chimera/images/cart-loader/icon.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters