Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 157 lines (141 sloc) 7.97 KB
#!/usr/bin/env bash
echo "
===
~=~
+I+
~~:
~~:
~~~
:~~
:~~
==?
I77?=I77:
7??I?+I+=~=I:
,+=+?I?====~~=?=
?=+?=.:++I.,~~+?
==+:,:?+??,:,=++
777III?+II+II+I+=?~+II+??+IIIIII,
7IIII??+++++++I+=?~++++++++??II?:
77?~====~~~~~~~~~~=?I7I?+I?+==+I,
77I7=::=:::~::::::=====++???+++I,
77?I7~:++::++~~~::,,::~+++=??~+I,
?++7I~:++~:+++7+=+:~,,:::?+=?I=+:
I7?=I~:+??,+++~~~?:I=,,:::++++?I,
I7~??:,++7,=++?=~~:I7,,:::++~?:7, ::=~~~~~= ::~=~~~+ ,~~~=~~~=+ ~:=~~~~~~=+= :~::~~~=== ~~~~~~~~~? ~~~~~~~=+ ~~~=~~~~~=? ~~~~=~~~~~~~~~~~+ ~~=~~~~~~~~~~~~~= :~~~~~~=~~~=++~
I7==?:,==7,~+=I+==:??,,:::+=~,+7, :,:~~~++ :,,~~++ :,,=:: ,,:~~~:,,~==+ ,,,::,,,,,:+=? :,,~~~~=+ ,,~~~=:~, :,,~~=~:: ,,:,,,,,,,,:~~~~~ :,,~~~:,,,,,,,== ,,,:~~=,,,,,,===+,
??++=::+=7,~+=I+=+:?,,:::~=+~+=+, ,,:::++ ,,::++? ,,++ ,,::++ ,,,+++, ,,,~:~ ,,=++, ,,::::~+? ,,:::++ ,,::=+, ,:= ,,::~~ :,::~=, ,,:+ ,,::++ ,,,:++?
I7=?+:,++,,++=I+=?~,,::::~~,+?~I, :,:::~++ ,,:::=?? ,,++ ,,::+= ,,:++? ,,:~=+ ,,:++, ,,:::::++, :,::::++ ,,::=+, ,: ,,::~~, :,::~+, :,= ,,::=+ ,,::??
7I+?I,,~~,,++~I+=+:::::::=~=I?+I, ,:,,,:~+= ,,::::~++ ,,++ ,,::++ ,,:++? :,,:== :,::++ ,,::,:::+? ,,::::++ ,,::=+, : ,,,::~= :,,:~+, ,~ ,,::++ ,,::+=
77+I7:,~~I,,~~7+=+:,,,,~:=I7II+I, :,=+,,::+I ,,~,,,:~++ ,,++ ,,::++ :,,:?+ ,,::=? ,,:=++ ,,=~,,::++, :,~,,::++ ,,::=+, ,,,::~~ :,,:~+, , : ,,::++ ,,::==
I7+II~,??:,~,,7+=?=+,~+7I?=II7+I, ,,=,:,,:=+ ,,++:,,::++,,,++ ,,::++ ,,:~++ ,,:~=? + ,,::+? ,,=+,,,:~+? ,,=,,,:++ ,,::=+, ,,::~~, :,::~+, :, ,,::++ ,,,::~+
?+=II:,::,,++~7?+?=+?=+III?+II+=, :,=+ ,,::+? ,,+= ,,,::++,,+= ,,::++ ,,::+? ,::~+= ,+? ,,::++ ,,=+,:,,:++~,~=:,,:++ ,,::=+, ,,::~~= :,:::+=~~,+, ,,::++~~:::,,,:,:
I7=?=:,~==,~+I7?+?:=??+?I7?+=I+I, ,=: :,::++ ,,+= ,,,:::::++ ,,::++ ,,::=+ ,,::=+= ,,:~+ ,,::++ ,,=+, ,,::+~~=::,,:++ ,,::=+, :,::~~+ :,::::,,,,+, ,,:::,,,::=::,
I7+=+:,+:I,~+?7I?I::~++=?7I?==+I,,,=+=++~,,:=+~ ,,+= ,,,:::+= ,,::++ ,,:~=? ,,:~++ ::= ,,::=+ ,,==, :,,:::~+ :,,:++ ,,::=+, ,,,:~~+ :,::~=, ::, ,,::++:,,:=+~
77+++:,+=?,=+?77?I:::=+?+I7I+++I,,,,,:,,,,,::+? ,,+= ,,,::+= ,,::++ ,,,:~== ,,:~+? + ,,::=? ,,==, ,,::==~ ,,,:++ ,,::=+, ,,,::~~ :,,:~+, , : ,,::++ :,,:++
?+++?:,++~,+++77I7,,:~=+?+II?++?:,~=, :,::++ ,,+= :,,:+= ,,::++ ,,::~~ ,,::+? ,,,:=~: ,,==, ,,,:== ,,,:++ ,,::=+, ,,::~~: + :,,:~+, ,= ,,::++ ,,,:?+,
77+?I:,+?~,+++7II7:,:::~+??7I?+7,,=+ ,,:~+? ,,+= : ,++ ,,::=+ ,,,:~~ ,,,:++ ,,:~~+ ,,==, ,,~=: ,,,:++ ,,::++, ,,::~== ,:~ :,,:~+, ,+ ,,::++ :,::++,
I7+I7:,++:,++=7??7~,,:::~?+?I?+I,~=, ,::++ ,,+= ,,= ,,::++ ,,,::: :,,:+? ,,,::= ,,=+, ,~= :,,:++ ,,::++, ,,,:~~+ :,= :,,:~+, ,,+ ,,::++ ,,::+?:
II+II,,++,,?++7?+7~I,,:::~++II+,,=+ :,::=+= ,,++ ,= ,,::++=:,,,::~ ,,,?++ ~,,:,= ,,++: :~: ,,::++, ,,::=+: ,,::++~=====~,=+ ,,:::+=~~~~:,=+ ,,,::++ ,,::?+:
II++,,,,,,,,,=?++7~7I,,,,,,,=?,,,,=? ,,,,,,,=? :,,,,:+, , :,,,,,,,,,,,:: :,,:==~::,,~ :,,,:+I = :,,,,,:+I ,,,,,,:=? ,,,,,,::::::::,~+ ,,,,,,,,,,,,,,,+ :,,,,,,:+= ,,,,,,=?
+?:::::::::~~=:~I~77I~:::::::=: :::::
II7+=====?I?I+=?:777II?+?+77I A Link to the Past: Randomizer
:7+?+===?7?I+=?:77IIII+II7: by Veetorp, Karkat, Christos0wen, Smallhacker and Dessyreqt
?I7I=+?7?I+=?:77I?I777~ alttpr.com/en/daily
,II77+++I+=+:?+?7777
~?=III+=+:77+7: Patcher Node.js port by loadedsith.
~II+=?~I: github.com/loadedsith/alttpr-cli
I+=?
I+=?
I+=?
~+=?
+~:
|
"
# Check for ALTTPR_SNES_ROMS, use it as SNES_ROM or a default
# "/home/pi/RetroPie/roms/snes"
if [[ -z "${ALTTPR_SNES_ROMS}" ]]; then
SNES_ROM="/home/pi/RetroPie/roms/snes"
echo "ALTTPR_SNES_ROMS not set, using default: $SNES_ROM";
else
SNES_ROM="${ALTTPR_SNES_ROMS}"
fi
# Check for ALTTPR_BUILD_FLAGS, use it as BUILD_FLAGS or a default "-t random"
if [[ -z "${ALTTPR_BUILD_FLAGS}" ]]; then
BUILD_FLAGS="-t random"
echo "ALTTPR_BUILD_FLAGS not set, using default: $BUILD_FLAGS";
else
BUILD_FLAGS="${ALTTPR_BUILD_FLAGS}"
fi
# Check for ALTTPR_GAMELIST
if [[ -z "${ALTTPR_GAMELIST}" ]]; then
GAMELIST="/home/pi/RetroPie/roms/snes/gamelist.xml"
echo "ALTTPR_GAMELIST not set, using default: $GAMELIST";
else
GAMELIST="${ALTTPR_GAMELIST}"
fi
cd $SNES_ROM;
npx -p github:loadedsith/alttpr-cli -c "
alttpr-cli update && \
echo 'Build from latest.' && \
alttpr-cli build $BUILD_FLAGS && \
echo 'Get gameslist snippet.' && \
alttpr-cli gamelist ./daily.json > ./daily.xml
"
echo "
Updating of gamelist.xml.
"
if [ ! -f $GAMELIST ]; then
echo "gamelist.xml not found! (GAMELIST: $GAMELIST)"
else
if [ ! -f ./daily.xml ]; then
echo "daily.xml not found! (PWD: ${pwd})"
else
GAME_PATH=$(xmlstarlet sel -t -v "/game/path" daily.xml);
if [[ -z "${GAME_PATH}" ]]; then
echo "No game/path found in daily.xml data retrieval has failed on its first attempt. $GAMELIST will not be updated.";
echo "daily.xml";
cat ./daily.xml
else
HAS_GAME=$(xmlstarlet sel -t -v "/gameList/game[path='$GAME_PATH']" \
$GAMELIST);
if [[ -z "${HAS_GAME}" ]]; then
echo "Updating gamedata.xml for $GAME_PATH"
XML_PATH="./$(xmlstarlet sel -t -v "/game/path" daily.xml)";
NAME=$(xmlstarlet sel -t -v "/game/name" daily.xml);
DESC=$(xmlstarlet sel -t -v "/game/desc" daily.xml);
IMAGE=$(xmlstarlet sel -t -v "/game/image" daily.xml);
MARQUEE=$(xmlstarlet sel -t -v "/game/marquee" daily.xml);
GENRE=$(xmlstarlet sel -t -v "/game/genre" daily.xml);
RELEASE_DATE=$(xmlstarlet sel -t -v "/game/releasedate" daily.xml);
DEVELOPER=$(xmlstarlet sel -t -v "/game/developer" daily.xml);
PUBLISHER=$(xmlstarlet sel -t -v "/game/publisher" daily.xml);
xmlstarlet ed --inplace --subnode "/gameList" --type elem -n gameTMP -v "" \
-s //gameTMP -t elem -n path -v "$XML_PATH" \
-s //gameTMP -t elem -n name -v "$NAME" \
-s //gameTMP -t elem -n desc -v "$DESC" \
-s //gameTMP -t elem -n image -v "$IMAGE" \
-s //gameTMP -t elem -n marquee -v "$MARQUEE" \
-s //gameTMP -t elem -n releasedate -v "$RELEASE_DATE" \
-s //gameTMP -t elem -n genre -v "$GENRE" \
-s //gameTMP -t elem -n developer -v "$DEVELOPER" \
-s //gameTMP -t elem -n publisher -v "$PUBLISHER" \
-r //gameTMP -v game \
$GAMELIST
else
echo "Already had gamedata in xml. $HAS_GAME"
fi
echo "GAMELIST_XML_GAME $GAMELIST_XML_GAME"
fi
fi
fi
echo "
Rom built!
Waiting 15 seconds so you can see what you're up against!
"
sleep 15s
echo "
Restarting emulation station.
"
touch /tmp/es-restart
killall emulationstation
sleep 3s
You can’t perform that action at this time.