#!/bin/sh
# show a warning if kickroms is missing
if [ ! -e ./kick.rom ]; then
files=$(ls ./kickstarts/* | wc -l )
if [ "$files" = "0" ]; then
zenity --warning --text="You have not yet installed a kickstart rom. Please check the setup guide for more information."
exit 1
fi
fi
# copy default config over if it doesn't exist
if [ ! -e ./conf/uaeconfig.conf ]; then
mkdir conf
cp defconf/uaeconfig.conf conf/
mkdir screenshots
mkdir scripts
fi
# Ask for mouse once
if [ ! -e ./mouse ]; then
if zenity --question --title="Mouse Mode" --text="Do you want move the mouse with the RIGHT or LEFT nub?" --ok-label="Left" --cancel-label="Right"; then
echo left > ./mouse
else
echo right > ./mouse
fi
fi
# Change mouse mode
curmodel=$(cat /proc/pandora/nub0/mode)
curmoder=$(cat /proc/pandora/nub1/mode)
mouse=$(cat ./mouse)
if [ "$mouse" = "left" ]; then
echo mouse > /proc/pandora/nub0/mode
echo mbuttons > /proc/pandora/nub1/mode
else
echo mouse > /proc/pandora/nub1/mode
echo mbuttons > /proc/pandora/nub0/mode
fi
# create autosave directory if it doesn't exist
if [ ! -e /saves/2E323333.ads ]; then
mkdir saves
cp defsaves/* saves/
fi
core=$(zenity --list --text "Select M68K core and refresh rate:" --radiolist --column " " --column "M68K core" FALSE "Cyclone 50Hz" TRUE "FAME/C 50Hz" FALSE "UAE 50Hz" FALSE "Cyclone 60Hz" FALSE "FAME/C 60Hz" FALSE "UAE 60Hz");
if [ "$core" = "" ]; then
echo aborted
fi
res=$(zenity --list --text "Select resolution:" --radiolist --column " " --column "Resolution" FALSE "320x205 => 750x480" FALSE "320x216 => 712x480" TRUE "320x240 DOUBLED PIXELS" FALSE "320x240 => 640x480" FALSE "320x256 => 600x480" FALSE "320x262 => 588x480" FALSE "320x205 => 800x480" FALSE "320x205 => 640x480");
if [ "$res" = "" ]; then
echo aborted
fi
if [ "$res" = "320x240 DOUBLED PIXELS" ]; then
echo doubled pixels mode
else
echo framebuffer mode
export SDL_VIDEODRIVER=fbcon
export SDL_FBDEV=/dev/fb1
export SDL_FB_BROKEN_MODES=1
if [ "$res" = "320x205 => 750x480" ]; then
ofbset -fb $SDL_FBDEV -pos 25 0 -size 750 480 -mem 131600 -en 1
fbset -fb $SDL_FBDEV -g 320 205 320 205 16
fi
if [ "$res" = "320x216 => 712x480" ]; then
ofbset -fb $SDL_FBDEV -pos 44 0 -size 712 480 -mem 138240 -en 1
fbset -fb $SDL_FBDEV -g 320 216 320 216 16
fi
if [ "$res" = "320x240 => 640x480" ]; then
ofbset -fb $SDL_FBDEV -pos 80 0 -size 640 480 -mem 153600 -en 1
fbset -fb $SDL_FBDEV -g 320 240 320 240 16
fi
if [ "$res" = "320x256 => 600x480" ]; then
ofbset -fb $SDL_FBDEV -pos 100 0 -size 600 480 -mem 163840 -en 1
fbset -fb $SDL_FBDEV -g 320 256 320 256 16
fi
if [ "$res" = "320x262 => 588x480" ]; then
ofbset -fb $SDL_FBDEV -pos 106 0 -size 588 480 -mem 167680 -en 1
fbset -fb $SDL_FBDEV -g 320 262 320 262 16
fi
if [ "$res" = "320x205 => 800x480" ]; then
ofbset -fb $SDL_FBDEV -pos 0 0 -size 800 480 -mem 131600 -en 1
fbset -fb $SDL_FBDEV -g 320 205 320 205 16
fi
if [ "$res" = "320x205 => 640x480" ]; then
ofbset -fb $SDL_FBDEV -pos 80 0 -size 640 480 -mem 131600 -en 1
fbset -fb $SDL_FBDEV -g 320 205 320 205 16
fi
fi
echo 2 > /proc/pandora/game_button_mode # gamepad mode
#if zenity --question --title="Doubled pixels or softstretched?" --text="Press Start while emulating to toggle between Joystick-, Mouse/Pinball- and Stylus/Arrowkeys-modes.\nHold (Y) for slow mouse\n\nF12 (while emulating): toggle fullsreen/windowed\n\nMove Screen: L-trigger + dpad (Joystick- and Stylus-modes only)\n\nQuicksave: L-trigger + S\nQuickload: L-trigger + L\n\nSoftstretched Modes need 750MHz and frameskip 1.\nSoftstretched Modes (while emulating):\nL+1: 320x256\nL+2: 320x216\nL+3: 320x200\nL+4: 320x200 NTSC" --ok-label="Doubled Mode (fast)" --cancel-label="Softstretched Modes"; then
if [ "$core" = "Cyclone 50Hz" ]; then
sudo /usr/pandora/scripts/op_lcdrate.sh 50
if [ "$res" = "320x205 => 750x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_cyclone 205
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x216 => 712x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_cyclone 216
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x240 DOUBLED PIXELS" ]; then
./uae4all_cyclone
fi
if [ "$res" = "320x240 => 640x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_cyclone 240
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x256 => 600x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_cyclone 256
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x262 => 588x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_cyclone 262
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x205 => 800x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_cyclone 205
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x205 => 640x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_cyclone 205
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
fi
if [ "$core" = "Cyclone 60Hz" ]; then
sudo /usr/pandora/scripts/op_lcdrate.sh 60
if [ "$res" = "320x205 => 750x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_cyclone 205
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x216 => 712x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_cyclone 216
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x240 DOUBLED PIXELS" ]; then
./uae4all_cyclone
fi
if [ "$res" = "320x240 => 640x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_cyclone 240
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x256 => 600x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_cyclone 256
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x262 => 588x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_cyclone 262
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x205 => 800x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_cyclone 205
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x205 => 640x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_cyclone 205
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
fi
if [ "$core" = "FAME/C 50Hz" ]; then
sudo /usr/pandora/scripts/op_lcdrate.sh 50
if [ "$res" = "320x205 => 750x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_fame 205
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x216 => 712x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_fame 216
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x240 DOUBLED PIXELS" ]; then
./uae4all_fame
fi
if [ "$res" = "320x240 => 640x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_fame 240
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x256 => 600x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_fame 256
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x262 => 588x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_fame 262
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x205 => 800x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_fame 205
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x205 => 640x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_fame 205
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
fi
if [ "$core" = "FAME/C 60Hz" ]; then
sudo /usr/pandora/scripts/op_lcdrate.sh 60
if [ "$res" = "320x205 => 750x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_fame 205
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x216 => 712x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_fame 216
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x240 DOUBLED PIXELS" ]; then
./uae4all_fame
fi
if [ "$res" = "320x240 => 640x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_fame 240
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x256 => 600x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_fame 256
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x262 => 588x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_fame 262
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x205 => 800x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_fame 205
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x205 => 640x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_fame 205
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
fi
if [ "$core" = "UAE 50Hz" ]; then
sudo /usr/pandora/scripts/op_lcdrate.sh 50
if [ "$res" = "320x205 => 750x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_uaecore 205
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x216 => 712x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_uaecore 216
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x240 DOUBLED PIXELS" ]; then
./uae4all_uaecore
fi
if [ "$res" = "320x240 => 640x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_uaecore 240
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x256 => 600x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_uaecore 256
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x262 => 588x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_uaecore 262
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x205 => 800x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_uaecore 205
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x205 => 640x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_uaecore 205
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
fi
if [ "$core" = "UAE 60Hz" ]; then
sudo /usr/pandora/scripts/op_lcdrate.sh 60
if [ "$res" = "320x205 => 750x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_uaecore 205
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x216 => 712x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_uaecore 216
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x240 DOUBLED PIXELS" ]; then
./uae4all_uaecore
fi
if [ "$res" = "320x240 => 640x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_uaecore 240
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x256 => 600x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_uaecore 256
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x262 => 588x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_uaecore 262
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x205 => 800x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_uaecore 205
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
if [ "$res" = "320x205 => 640x480" ]; then
LD_PRELOAD=./libSDL-1.2.so.0.11.3 op_runfbapp ./uae4all_uaecore 205
ofbset -fb $SDL_FBDEV -pos 0 0 -size 0 0 -mem 0 -en 0
fi
fi
echo 1 > /proc/pandora/game_button_mode # keyboard mode
sudo /usr/pandora/scripts/op_lcdrate.sh 60 # Back to 60Hz
echo $curmodel > /proc/pandora/nub0/mode # Left Nub back to normal
echo $curmoder > /proc/pandora/nub1/mode # Right Nub back to normal