Advertisement
inukaze

Touhouvania - Script Failure

Aug 13th, 2012
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.32 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # Autor : Inukaze ( Venezuela )
  4. # Sitio : http://inukaze.wordpress.com
  5. # Correo-E : inukaze.otaku@gmail.com
  6. # Licensia : 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 archivos 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. # Definir el directorio actual , como el principal
  29. # del juego o programa
  30. GamePath=""$( cd -P "$( dirname "$" )" && pwd )""
  31.  
  32. rm -rf "$GamePath/wine/data/drive_c/users"
  33. rm -rf "$GamePath/wine/data/drive_c/windows"
  34. rm -rf "$GamePath/wine/data/Program Files (x86)"
  35. rm -rf "$GamePath/wine/data/Program Files"
  36. rm -rf "$GamePath/wine/data/drive_c/Archivos de programa"
  37. rm -rf "$GamePath/wine/data/drive_c/Program Files (x86)"
  38. rm -rf "$GamePath/wine/data/drive_c/Program Files"
  39. rm -rf "$GamePath/wine/data/system.reg"
  40. rm -rf "$GamePath/wine/data/user.reg"
  41. rm -rf "$GamePath/wine/data/userdef.reg"
  42. rm -rf "$GamePath/wine/data/dosdevices"
  43. rm -rf "$GamePath/wine/data/.update-timestamp"
  44. rm -rf "$GamePath/wine/.DS_Store"
  45. rm -rf "$GamePath/wine/linux/.DS_Store"
  46. rm -rf "$GamePath/wine/linux/x86/.DS_Store"
  47. rm -rf "$GamePath/wine/linux/x86_64/.DS_Store"
  48. rm -rf "$GamePath/wine/linux/x86/bin/.DS_Store"
  49. rm -rf "$GamePath/wine/linux/x86_64/bin/.DS_Store"
  50. rm -rf "$GamePath/wine/mac/.DS_Store"
  51. rm -rf "$GamePath/wine/mac/x86/.DS_Store"
  52. rm -rf "$GamePath/wine/mac/x86_64/.DS_Store"
  53. rm -rf "$GamePath/wine/mac/x86/bin/.DS_Store"
  54. rm -rf "$GamePath/wine/mac/x86_64/bin/.DS_Store"
  55. rm -rf "$GamePath"/wine/data/cachedmetrics.\:0
  56.  
  57. # Obtener el nombre del nucleo del sistema
  58. kernel=$(uname -s)
  59.  
  60. if [ $kernel = "Darwin" ]; then
  61. kernel=mac
  62. elif [ $kernel = "Linux" ]; then
  63. kernel=linux
  64. else
  65. echo "Sistema Operativo NO SOPORTADO"
  66. fi
  67.  
  68. # Determinando la arquitectura de la maquina
  69. arch=$(uname -m)
  70.  
  71. if [ $arch = "i386" ]; then
  72. PATH="$PWD/wine/$kernel/x86/bin:$PATH"
  73. export WINEPREFIX="$PWD/wine/data"
  74. export WINEDEBUG=-all
  75. arch="32 Bits"
  76. elif [ $arch = "i486" ]; then
  77. PATH="$PWD/wine/$kernel/x86/bin:$PATH"
  78. export WINEPREFIX="$PWD/wine/data"
  79. export WINEDEBUG=-all
  80. arch="32 Bits"
  81. elif [ $arch = "i586" ]; then
  82. PATH="$PWD/wine/$kernel/x86/bin:$PATH"
  83. export WINEPREFIX="$PWD/wine/data"
  84. export WINEDEBUG=-all
  85. arch="32 Bits"
  86. elif [ $arch = "i686" ]; then
  87. PATH="$PWD/wine/$kernel/x86/bin:$PATH"
  88. export WINEPREFIX="$PWD/wine/data"
  89. export WINEDEBUG=-all
  90. arch="32 Bits"
  91. elif [ $arch = "x86_64" ]; then
  92. PATH="$PWD/wine/$kernel/x86_64/bin:$PATH"
  93. export WINEPREFIX="$PWD/wine/data"
  94. export WINEDEBUG=-all
  95. arch="64 Bits"
  96. else
  97. echo "Arquitectura NO SOPORTADA"
  98. fi
  99.  
  100. # Muestra en la terminal La arquitectura &" >> "$GamePath"/Iniciar
  101. # La version especifica de Wine usada" >> "$GamePath"/Iniciar
  102. wver=$(wine --version)
  103. echo ""
  104. echo ""
  105. echo "Corriendo $wver en $kernel ( Maquina de $arch )"
  106. echo ""
  107. echo ""
  108.  
  109. # Guardar la resolucion Actual :
  110. echo `xrandr --current | grep current | awk '{print $8}'` >> RES1
  111. echo `xrandr --current | grep current | awk '{print $10}'` >> RES2
  112. cat RES2 | sed -i 's/,//g' RES2
  113. P1RES=$(cat RES1)
  114. P2RES=$(cat RES2)
  115. rm RES1 RES2
  116. echo "$P1RES"'x'"$P2RES" >> RES
  117. RES=$(cat RES)
  118. rm RES
  119. # Resolucion Actual Guardada.
  120.  
  121. echo 'REGEDIT4' >> audio.reg
  122. echo '' >> audio.reg
  123. echo '[HKEY_CURRENT_USER\Software\Wine\DirectSound]' >> audio.reg
  124. echo '"DefaultSampleRate"="48000"' >> audio.reg
  125. echo '"HardwareAcceleration"="Emulation"' >> audio.reg
  126. regedit -s audio.reg
  127. rm audio.reg
  128.  
  129. # Arreglo de Video para evitar errores graficos
  130. tvid=$(lspci -v -s `lspci | awk '/VGA/{print $1}'` | sed -n '/Memory.*, prefetchable/s/.*\[size=\([^]]\+\)M\]/\1/p')
  131. let "mvid"="$tvid"/2
  132.  
  133. echo "REGEDIT4" >> "$GamePath"/video.reg
  134. echo "[HKEY_CURRENT_USER\Software\Wine\Direct3D]" >> "$GamePath"/video.reg
  135. echo '"DirectDrawRenderer"="gdi"' >> "$GamePath"/video.reg
  136. echo '"OffscreenRenderingMode"="backbuffer"' >> "$GamePath"/video.reg
  137. echo '"VideoMemorySize"'='"'"$mvid"'"' >> "$GamePath"/video.reg
  138. wine regedit -s "$GamePath"/video.reg
  139. rm "$GamePath"/video.reg
  140. # Arreglo de Video para evitar errores graficos
  141.  
  142. # Instalar Arreglos para el Correcto Funcionamiento
  143. # Del Software a usar :
  144. cd "$GamePath"/wine/data/drive_c/software/lib
  145. cp -rf scrrun.dll "$GamePath"/wine/data/drive_c/windows/system32/
  146. cp -rf usp10.dll "$GamePath"/wine/data/drive_c/windows/system32/
  147. cp -rf vbscript.dll "$GamePath"/wine/data/drive_c/windows/system32/
  148. ############################ Videos : ###############################
  149. #~½¬{cp -rf qasf.dll "$GamePath"/wine/data/drive_c/windows/system32/
  150. #~½¬{cp -rf wmasf.dll "$GamePath"/wine/data/drive_c/windows/system32/
  151. #~½¬{cp -rf wmvcore.dll "$GamePath"/wine/data/drive_c/windows/system32/
  152. #~½¬{cp -rf wmvdecod.dll "$GamePath"/wine/data/drive_c/windows/system32/
  153. #~½¬{cp -rf wmvd mod.dll "$GamePath"/wine/data/drive_c/windows/system32/
  154. #~½¬{cp -rf wmvsdecd.dll "$GamePath"/wine/data/drive_c/windows/system32/
  155. ########################## Registro ###############################
  156. echo "REGEDIT4" >> arreglos.reg
  157. echo "" >> arreglos.reg
  158. echo "[HKEY_CURRENT_USER\Software\Wine\DllOverrides]" >> arreglos.reg
  159. echo '"scrrun"="native, builtin"' >> arreglos.reg
  160. echo '"usp10"="native, builtin"' >> arreglos.reg
  161. echo '"vbscript"="native, builtin"' >> arreglos.reg
  162. #################### Registro - Videos : ############################
  163. #~½¬{echo '"msimg32.dll"="native, builtin"' >> arreglos.reg
  164. #~½¬{echo '"msvfw32.dll"="native, builtin"' >> arreglos.reg
  165. #~½¬{echo '"qasf.dll"="native, builtin"' >> arreglos.reg
  166. #~½¬{echo '"wmasf.dll"="native, builtin"' >> arreglos.reg
  167. #~½¬{echo '"wmvcore.dll"="native, builtin"' >> arreglos.reg
  168. #~½¬{echo '"wmvdecod.dll"="native, builtin"' >> arreglos.reg
  169. #~½¬{echo '"wmvdmod.dll"="native, builtin"' >> arreglos.reg
  170. #~½¬{echo '"wmvsdecd.dll"="native, builtin"' >> arreglos.reg
  171. regedit -s arreglos.reg
  172. rm -rf arreglos.reg
  173. cd "$GamePath"/wine/data/drive_c/windows/system32
  174. regsvr32 atl.dll
  175. regsvr32 scrrun.dll
  176. regsvr32 vbscript.dll
  177.  
  178.  
  179. # Matar a PulseAudio si esta en ejecucion
  180. #~½¬{paeudua=`ps -A | grep pulseaudio | awk '{print $4}'`
  181. #~½¬{if [ $paeudua = "pulseaudio" ]; then
  182. #~½¬{ killall -9 pulseaudio
  183. #~½¬{ echo `ps -A | grep pulseaudio | awk '{print $1}'` >> ID1
  184. #~½¬{ PID1=$(cat ID1)
  185. #~½¬{ rm -rf ID1
  186. #~½¬{ kill -s TERM $PID1
  187. #~½¬{ echo "PulseAudio Terminado"
  188. #~½¬{else
  189. #~½¬{ echo "PulseAudio no se esta ejecutando"
  190. #~½¬{fi
  191.  
  192. # Detectar si en el archivo de configuracion
  193. # del Juego esta defino usar "Pantalla Completa"
  194. # o no. Si se usa a Pantalla Completa bajar
  195. # La Resolucion a 640x480 , Iniciar el software
  196. # Luego de finalizar , Restaurar la resolucion
  197. cd "$GamePath"/wine/data/drive_c/software
  198.  
  199. mdv=`cat config.ini | grep FullScreen= | cut -d " " -f03 | sed 's/^[FullScreen= \t]*//' | sed 's/^[mdv= \t]*//'`
  200. typeset -i str
  201. if [ "${mdv}" = "1" ]; then
  202. echo "Modo Pantalla Completa : ""$mdv"
  203. else
  204. mdv=`expr $mdv - 1`
  205. echo "Modo Ventana : ""$mdv"
  206. fi
  207.  
  208. #~½¬{ echo "Modo Pantalla Completa"
  209. #~½¬{ CEUJA=$(ps -A | grep compiz | awk '{print $4}')
  210. #~½¬{ if [ $CEUJA = "compiz" ]; then
  211. #~½¬{ echo ""
  212. #~½¬{ echo "Detectado Compiz en ejecucion"
  213. #~½¬{ echo "El Juego se ejecutara en la resolucion"
  214. #~½¬{ echo "640x480 para su correcto funcionamiento"
  215. #~½¬{ echo "Tu resolucion actual $RES sera restaurada"
  216. #~½¬{ echo "al Finalizar"
  217. #~½¬{ `xrandr -s 640x480`
  218. #~½¬{ wine "Koumajou.exe"
  219. #~½¬{ `xrandr -s $RES`
  220. #~½¬{ else
  221. #~½¬{ echo "Compiz no esta en uso"
  222. #~½¬{ echo "Modo Ventana"
  223. #~½¬{ wine "Koumajou.exe"
  224. #~½¬{ fi
  225. #~½¬{ echo ""
  226. #~½¬{ echo "No se comprobo si compiz esta en uso"
  227. #~½¬{ wine "Koumajou.exe"
  228. #~½¬{fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement