Advertisement
inukaze

Inukaze - ePSXe Bash Launcher

Jun 2nd, 2011
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.21 KB | None | 0 0
  1. !#/bin/sh
  2.  
  3. # Inukaze - ePSXe Launcher
  4. # Blog : http://inukaze.wordpress.com
  5. # License GPL
  6. # If you use this source code or part of this , you must specify the Autor and the part
  7. # of this source code are you using.
  8. # Special Thanks to :   Facebook user "Beakos GNU Linux" for giveme the command "sed 's/[.].*//'"
  9. # Special Thanks to :   ArchLinux user "alfPlayer" for commands Like "Path=${0%/*}"
  10. #           & Testing and Corrections Ideas for this Script
  11.  
  12. clear && reset
  13.  
  14. # Change to game directory
  15. ePSXe_Path=${0%/*}
  16. cd "$ePSXe_Path"
  17.  
  18. # Checking if there are relevant files and directories
  19. # For the correct execution of the emulator ePSXe.
  20. if [ ! -f keycodes.lst ] || [ ! -f bios/scph1001.bin ] || [ ! -e cfg ] || [ ! -e plugins ] || [ ! -e memcards ]
  21. then
  22.     echo "Missing needs files / and / directories in `$ePSXe_Path`"
  23.     echo "Your ePSXe is incomplete!"
  24.     exit 1
  25. fi
  26.  
  27. # Determining CPU Speed
  28. CPUMHz=`dmesg | grep "MHz processor" | cut -d " " -f07 | sed 's/[.].*//'`
  29. if [ "$CPUMHz" -ge "800" ]
  30.     then
  31.         if [ "$CPUMHz" -ge "1048" ]
  32.         then       
  33.         let "CPUGHz"=$CPUMHz/1000
  34.             echo "You have $CPUGHz GHz Processor"
  35.         else
  36.             echo "You have $CPUMHz Mhz Processor"
  37.         fi
  38.     else
  39.         echo "You need a 800 MHz Processor to run ePSXe"
  40. fi
  41.  
  42. # Determining If the user has enough RAM to run the emulator
  43. RAM_Kb=`grep MemTotal /proc/meminfo | awk '{print $2}'`
  44. if [ "$RAM_Kb" -ge "128000" ]
  45.     then
  46.         if [ "$RAM_Kb" -ge "1096000" ]
  47.         then
  48.         let "RAMGb"=$RAM_Kb/1000
  49.             echo "You have $RAMGb GB Ram"
  50.         else
  51.         let RAM_MB=$RAM_Kb/1000
  52.             echo "You have $RAM_MB MB RAM"
  53.         fi
  54.     else
  55.     echo "You need 128 MB RAM , please install more RAM Memory"
  56. fi
  57.  
  58. # Determining Video Card & Video Card Size & 3D Support
  59. vcard=`lspci -v | grep "VGA" | cut -d " " -f05`
  60. if [ "$vcard" = nVidia ]
  61.     then
  62.     echo "You have NVIDIA Graphics Card"
  63.     nv_card_size=`nvidia-settings -q VideoRam | grep "Attribute 'VideoRam'" | cut -d " " -f06 | sed 's/[.].*//'`
  64.         if [ "$nv_card_size" -ge "64000" ]
  65.             then
  66.             let nvcard_mbmem=$nv_card_size/1000
  67.             echo "You have $nvcard_mbmem MB VIDEO"
  68.             nvsupport3d=`nvidia-settings -g | grep "direct rendering: Yes" | cut -d " " -f05`
  69.                 if [ $nvsupport3d = "Yes" ]
  70.             then
  71.                 echo "You have 3D Support & Direct Rendering"
  72.             else
  73.                 echo "You dont have 3D Support"
  74.                 echo "You need 3D Support to use ePSXe to run PlayStation 1 Games"
  75.             fi
  76.         else
  77.         echo ""
  78.         echo "You need 64 MB Video Card with 3D Support"
  79.         echo ""    
  80.         fi
  81. else
  82.         echo "You have $vcard Video Card"
  83. vidsize=lspci -v -s `lspci | awk '/VGA/{print $1}'` | sed -n '/Memory.*, prefetchable/s/.*\[size=\([^]]\+\)M\]/\1/p'
  84.     if [ "$vidsize" -ge 64 ]
  85.         then
  86.             echo "You have $vidsize MB Video"
  87.                 support3d=glxinfo | grep "direct rendering: Yes" | cut -d " " -f03
  88.                 if [ $support3d = Yes ]
  89.                     then
  90.                         echo "You have 3D Support & Direct Rendering"
  91.                     else
  92.                         echo "You dont have 3D Support"
  93.                         echo "You need 3D Support to use ePSXe to run PlayStation 1 Games"
  94.                 fi
  95.         else
  96.             echo "You need 64 MB Video Card to Gaming with ePSXe"
  97.     fi
  98.  
  99. # Determining Operating System Architecture
  100.  
  101. MACHINE=`uname -m`
  102. if [ "$MACHINE" = "x86_64" ]
  103. then
  104.     export LD_LIBRARY_PATH="$ePSXe_Path/32bits_libs"
  105.     echo ""
  106.     echo ""    
  107.     BIN=./.epsxe
  108.     chmod 666 $ePSXe_Path/cfg/*.cfg $ePSXe_Path/sstates/* \
  109.     $ePSXe_Path/memcards/*.mcr $ePSXe_Path/snap/* 2>/dev/null
  110. else
  111.     echo ""
  112.     echo ""    
  113.     BIN=./.epsxe
  114.     chmod 666 $ePSXe_Path/cfg/*.cfg $ePSXe_Path/sstates/* \
  115.     $ePSXe_Path/memcards/*.mcr $ePSXe_Path/snap/* 2>/dev/null
  116. fi
  117.  
  118. # Run the ePSXe - Sony PlayStation Emulator:
  119. $BIN "$@"
  120.  
  121. # Check for errors
  122. e=$?
  123. if [ $e -ne 0 ]
  124. then
  125.     echo ""
  126.     echo "It looks like ePSXe crashed! If you need support, please include the"
  127.     echo "contents of the log file in your problem report."
  128.  
  129.     LOGPATH="$HOME/.epsxe/epsxe.log"
  130.     if [ -f "$LOGPATH" ]
  131.     then
  132.         echo "The log file is stored at: $LOGPATH"
  133.  
  134.         echo "" >> $LOGPATH
  135.         echo "Libraries used:" >> $LOGPATH
  136.         ldd $BIN >> $LOGPATH 2>&1
  137.  
  138.         echo "" >> $LOGPATH
  139.         GLXINFO=`which glxinfo`
  140.         if [ -z "$GLXINFO" ]
  141.         then
  142.             echo "glxinfo not found!" >> $LOGPATH
  143.         else
  144.             echo "Output of glxinfo:" >>$LOGPATH
  145.             glxinfo >>$LOGPATH 2>&1
  146.         fi
  147.        
  148.     else
  149.         echo "Unfortunately, no log file has been created!"
  150.     fi
  151. fi
  152.  
  153. exit $e
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement