Advertisement
inukaze

Experimental - Autoconent - League Of Legends Launcher Scrip

Oct 14th, 2013
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 7.17 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # Author    :   Inukaze ( From Venezuela )
  4. # Site      :   http://inukaze.wordpress.com
  5. # E-Mail    :   inukaze.otaku@gmail.com
  6. # License   :   GPL 3
  7. #
  8. # Acerca de este Script :  
  9. #
  10. # Yo intento escribir Scripts compatibles con
  11. # Sistemas Operativos Unix & Posix , y cualquier
  12. # Sistema Operativo que soporte versiones de la API
  13. # conocida como "Wine" o "WineHQ" para poder ejecutar
  14. # software de Microsoft Windows , sin necesidad de su
  15. # sistema operativo , y crear paquetes autocontenidos
  16. # para sistemas operativos como por ejemplo :
  17. # Linux , FreeBSD , OpenSolaris
  18. # Unix  , BSD     , Solaris     , MacOS
  19.  
  20. # Usando versiones pre-compiladas , para arquitecturas
  21. # como x86 & x86_64 (32 Bits & 64 Bits ) con versiones
  22. # Especificas de Wine/WineHQ y los Arquitecturaivos oficiales
  23. # para "Windows" para una mayor compatibilidad usando
  24. # los requisitos de Sistema Originales y que esto pueda
  25. # ser aprovechado , por Juegos , Programas , Software
  26. # Ahora apartir de aqui comienza mi Script :
  27.  
  28. # Este Script es para Solucionar problemas de Directx
  29. # Para el Software que esta Intentado Ejecutar
  30. # Como NATIVO de un SISTEMA QUE NO ES WINDOWS
  31.  
  32. # Definir el directorio actual , como el principal
  33. # del juego o programa
  34. RUTA=""$( cd -P "$( dirname "$" )" && pwd )""
  35. RUTA_DEL_SOFTWARE="$RUTA"/wine/data/drive_c/software
  36. RUTASYSTEM32="$RUTA"/wine/data/drive_c/windows/system32
  37. ARREGLOS="$RUTA"/arreglos
  38.  
  39. # Obtener el nombre del nucleo del sistema
  40. Nucleo=$(uname -s)
  41.  
  42. if      [ $Nucleo = "Darwin" ]; then
  43.         Nucleo=mac
  44. elif        [ $Nucleo = "Linux" ]; then
  45.         Nucleo=linux
  46. elif        [ $Nucleo = "FreeBSD" ]; then
  47.         Nucleo=linux
  48. elif        [ $Nucleo = "OpenSolaris" ]; then
  49.         Nucleo=linux
  50. else
  51.         echo "Sistema Operativo NO SOPORTADO"
  52. fi
  53.  
  54. # Determinando la arquitectura de la maquina
  55. Arquitectura=$(uname -m)
  56.  
  57. if         [ $Arquitectura = "i386" ]; then
  58.             PATH="$PWD/wine/$Nucleo/x86/bin:$PATH"
  59.             export WINESERVER="$PWD/wine/$Nucleo/x86/bin/wineserver"
  60.             export WINELOADER="$PWD/wine/$Nucleo/x86/bin/wine"
  61.             export WINEPREFIX="$PWD/wine/data"
  62.             export WINEDEBUG=-all
  63.             Arquitectura="32 Bits"
  64.     elif    [ $Arquitectura = "i486" ]; then
  65.             PATH="$PWD/wine/$Nucleo/x86/bin:$PATH"
  66.             export WINESERVER="$PWD/wine/$Nucleo/x86/bin/wineserver"
  67.             export WINELOADER="$PWD/wine/$Nucleo/x86/bin/wine"
  68.             export WINEPREFIX="$PWD/wine/data"
  69.             export WINEDEBUG=-all
  70.             Arquitectura="32 Bits"
  71.     elif    [ $Arquitectura = "i586" ]; then
  72.             PATH="$PWD/wine/$Nucleo/x86/bin:$PATH"
  73.             export WINESERVER="$PWD/wine/$Nucleo/x86/bin/wineserver"
  74.             export WINELOADER="$PWD/wine/$Nucleo/x86/bin/wine"
  75.             export WINEPREFIX="$PWD/wine/data"
  76.             export WINEDEBUG=-all
  77.             Arquitectura="32 Bits"
  78.     elif    [ $Arquitectura = "i686" ]; then
  79.             PATH="$PWD/wine/$Nucleo/x86/bin:$PATH"
  80.             export WINESERVER="$PWD/wine/$Nucleo/x86/bin/wineserver"
  81.             export WINELOADER="$PWD/wine/$Nucleo/x86/bin/wine"
  82.             export WINEPREFIX="$PWD/wine/data"
  83.             export WINEDEBUG=-all
  84.             Arquitectura="32 Bits"
  85.          elif [ $Arquitectura = "x86_64" ]; then
  86.             PATH="$PWD/wine/$Nucleo/x86/bin:$PATH"
  87.             export WINESERVER="$PWD/wine/$Nucleo/x86/bin/wineserver"
  88.             export WINELOADER="$PWD/wine/$Nucleo/x86/bin/wine"
  89.             export WINEPREFIX="$PWD/wine/data"
  90.             export WINEDEBUG=-all
  91.             Arquitectura="32 Bits (Modo x86) en 64 Bits"
  92.     else
  93.         echo "Arquitectura NO SOPORTADA"
  94. fi
  95.  
  96. # Muestra en la terminal La arquitectura &
  97. # La version especifica de Wine usada
  98. Version_De_Wine=$(wine --version)
  99. echo ""
  100. echo ""
  101. echo "Corriendo '$Version_De_Wine' en '$Nucleo' ( Maquina de '$Arquitectura' )"
  102. echo ""
  103. echo ""
  104.  
  105. # Solucion de Resolucion - Parte 1
  106. echo `xrandr --current | grep current | awk '{print $8}'` >> RES1
  107. echo `xrandr --current | grep current | awk '{print $10}'` >> RES2
  108. cat RES2 | sed -i 's/,//g' RES2
  109. P1RES=$(cat RES1)
  110. P2RES=$(cat RES2)
  111. rm RES1 RES2
  112. echo "$P1RES"'x'"$P2RES" >> RES
  113. RES=$(cat RES)
  114. rm RES
  115. # Solucion de Resolucion - Parte 1
  116.  
  117. # Modo Ventana/Pantalla Completa :
  118. echo "REGEDIT4" >> modo_ventana.reg
  119. echo "" >> modo_ventana.reg
  120. echo "[HKEY_CURRENT_USER\Software\Wine\Explorer]" >> modo_ventana.reg
  121. echo '"Desktop"="Default"' >> modo_ventana.reg
  122. echo "" >> modo_ventana.reg
  123. echo "[HKEY_CURRENT_USER\Software\Wine\Explorer\Desktops]" >> modo_ventana.reg
  124.  
  125. # Para Activar el Modo Ventana :
  126. #echo '"Default"'='"'"$RES"'"' >> modo_ventana.reg
  127.  
  128. # Para DesActivar el Modo Ventana :
  129. echo '"Default"'='"'""'"' >> modo_ventana.reg
  130.  
  131. regedit -s modo_ventana.reg
  132. rm -rf modo_ventana.reg
  133.  
  134.  
  135. killall -9 services.exe winedevice.exe plugplay.exe explorer.exe wineboot.exe dplaysvr.exe winemenubuilder
  136. killall -9 winemenubuilder rpcss.exe wineserver  pulseaudio
  137. # Modo Ventana/Pantalla Completa :
  138.  
  139. cd "$RUTA"/arreglos
  140. regedit -s "$Nucleo"_video.reg
  141. regedit -s "$Nucleo"_sonido.reg
  142.  
  143. # Extraer la cantidad de MB de video
  144. tvid=$(lspci -v -s `lspci | awk '/VGA/{print $1}'` | sed -n '/Memory.*, prefetchable/s/.*\[size=\([^]]\+\)M\]/\1/p')
  145.  
  146. # Dividir los MB de video totales
  147. # Depende del Juego usado en Wine
  148. # Siempre dividir por un Numero PAR
  149. # Para evitar errores
  150. # utiliza ; 2 , 4 , 8 , 16 , 32 .
  151.  
  152. let "mvid"=$tvid/2
  153. echo 'REGEDIT4' >> video.reg
  154. echo '' >> video.reg
  155. echo '[HKEY_CURRENT_USER\Software\Wine\Direct3D]' >> video.reg
  156. echo '"VideoMemorySize"'='"'"$tvid"'"' >> video.reg
  157. regedit -s video.reg && rm -rf video.reg
  158.  
  159. echo "Informacion :"
  160. echo "Arquitectura -> `uname -m` ($Arquitectura) "
  161. echo "DEBUG -> $WINEDEBUG "
  162. echo "Prefijo  -> $WINEPREFIX"
  163. echo "Cargador -> $WINELOADER"
  164. echo "Servidor -> $WINESERVER"
  165. echo ""
  166. echo ""
  167. echo "$RUTA"
  168. echo "RUTA -> $RUTA_DEL_SOFTWARE"
  169.  
  170. cd "$RUTA_DEL_SOFTWARE"
  171. echo ""
  172. echo "Ejecutando el Software"
  173. echo "League Of Legends "
  174.  
  175.     function Launcher()
  176. {
  177.     cd "$RUTA_DEL_SOFTWARE"/RADS/system
  178.     killall -9 "League Of Legends.exe" "LolClient.exe" "LoLLauncher.exe" "lol.launcher.admin.exe"
  179. #   winecfg
  180. #   regedit
  181.     wine "rads_user_kernel.exe" run lol_launcher $(ls ../projects/lol_launcher/releases/) LoLLauncher.exe &
  182.     echo ""
  183.     echo ""
  184. MigrationFlag="1"
  185. unset PULSEAUDIO
  186. PULSEAUDIO=$(ps -A  |   grep pulseaudio |   awk '{print $4}')
  187. }
  188.  
  189. Lanzar=`Launcher`
  190.  
  191.     function JugandoLOL()
  192.     {
  193.         until pidlols=$(pidof "League of Legends.exe")
  194.             do  
  195.                 sleep 1
  196.             done
  197.  
  198.         for pidlol in $pidlols
  199.             do  
  200.  
  201. #           if [ $pidlols -ne 0 ]; then
  202.                 echo ""
  203.                 taskset -p 0xFFFFFFFF $pidlols && echo "Estableciendo Afinidad con Todos Los Procesadores"
  204.                 echo ""
  205.                 echo ""
  206.                 #sudo renice -n -15 -p $pidlols $PULSEAUDIO && echo "Cambiando La Prioridad a Muy Alta"
  207.                 unset $pidlols
  208.                 echo ""
  209. #           else
  210.                 echo ""
  211.                 echo "No hay Ninguna Partida de League Of Legends"
  212.                 echo ""
  213.  
  214.             done
  215.     }
  216.  
  217.  
  218. # -> Creo que esto esta mal definido XD ->
  219.  
  220. while Launchers=$(pidof "LoLLauncher.exe")
  221.     do  
  222.         sleep 60   
  223.     done
  224.  
  225.     for Launcher in $Launchers
  226.     do  
  227.             if [ $Launcher -ne 0 ]
  228.             then
  229.                     JUGAR=`JugandoLOL`
  230.                     wait $Launchers
  231.                     unset Launcher
  232.                         killall -9 "League Of Legends.exe" "LolClient.exe" "LoLLauncher.exe" "lol.launcher.admin.exe"
  233.                         killall -9 rpcss.exe wineserver services.exe winedevice.exe plugplay.exe explorer.exe winemenubuilderset
  234.                     exit 1
  235.             else
  236.                 echo
  237.                 echo "El Lanzador de League Of Legends"
  238.                 echo "No esta en ejecucion"
  239.                 echo
  240.             fi
  241.     done
  242. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement