Xfce Forum

Sub domains
 

You are not logged in.

#1 2021-12-31 12:26:19

inukaze
Member
Registered: 2014-07-31
Posts: 46

Xfce 4.12 & Custom Script for Launch mGBA with File

Hi there i had manually compile mGBA v0.9.3, QT5 & SDL2 Version native binary executable files results
Well i had write the follow script

#!/usr/bin/env bash

# Prevenir errores con diversas terminale y/o tipografias :
LC_ALL=C
export LC_ALL=C
DIRDATOS="$HOME/.config/mgba"


echo '
Autor ----------------> Inukaze ( Venezuela )
Sitio ----------------> [url]https://goo.gl/ij6WqW[/url]
Correo-E -------------> bloginukaze@gmail.com
Licencia -------------> GPL 2

******* Inicio : Acerca de este Guión ********

  Yo intento escribir guiones compatibles con
   Sistemas operativos Unix & POSIX , y otros
   Sistemas operativos que soporten bash

  Este archivo es un guion sencillo para
  Iniciar << mGBA-QT5 >> Nativo para Liñux

******** Fin : Acerca de este Guión **********'
sleep 3

#Determinar en que directorio estoy :
GUION=$(readlink -f "$0")
RUTA=$(dirname "$GUION")

# Entrar en este directorio
cd "$(dirname "$(realpath "$0")")" || exit

# Obtener la Arquitectura
Arquitectura=$(uname -m)
case "$Arquitectura" in
	x86)    Arquitectura="x32"						;;
	i?86)   Arquitectura="x32"						;;
	amd64)  Arquitectura="x64"						;;
	x86_64) Arquitectura="x64"						;;
	* ) echo    "Tu Arquitectura '$Arquitectura' -> NO ESTA SOPORTADA."	;;
esac

#Usar la Arquitectura detectada
    if [ "$Arquitectura" == "x64" ]
	then
	#Establecer las variables de entorno
	export LD_LIBRARY_PATH="$PWD/.libs/64":$LD_LIBRARY_PATH
    fi

    if [ "$Arquitectura" == "x32" ]
	then
	#Establecer las variables de entorno
	export LD_LIBRARY_PATH="$PWD/.libs/32":$LD_LIBRARY_PATH
    fi

#Crear y/o Actualizar Enlace : 
rm -rf "./mGBA-QT5.desktop"
echo '[Desktop Entry]
Name=mGBA-QT5
Comment=GameBoyAdvance Emulator
Type=Application
Terminal=false
Icon='$PWD/.mgba-96.png'
Exec=bash -c "'$RUTA'/mGBA-QT5.geb" "$@"
StartupNotify=false
Categories=Game;Emulator;
Keywords=emulator;Nintendo;gameboy;Game Boy;Game Boy Color;Game Boy Advance;
MimeType=application/x-gameboy-rom;application/x-gameboy-advance-rom;application/x-dmg-rom;application/x-agb-rom;application/x-gb-rom;application/x-gba-rom;' | tee ./mGBA-QT5.desktop  &>/dev/null
chmod a+o+x mGBA-QT5.desktop

if [ -e "$DIRDATOS" ]; then
		echo "Si existe el directorio de datos del usuario"
	else
		echo 'No existe el directorio de Datos para PPSSPP'
		ln -s "$PWD/Datos" "$DIRDATOS"	
fi

#Desactivar cualquier valor para la variable de entorno SDL_AUDIODRIVER
unset SDL_AUDIODRIVER

#Iniciar el Emulador :
if	[ "$Arquitectura" == "x64" ]; then
		cd "$RUTA"
		export LD_LIBRARY_PATH="$RUTA/.libs/64":$LD_LIBRARY_PATH
		export QT_DEBUG_PLUGINS=1
		export QT_QPA_PLATFORM_PLUGIN_PATH="$RUTA/.libs/64/plugins"
		export SDL_AUDIODRIVER="alsa"
#		exec ./.mGBA-QT5-v0.9.3."$Arquitectura" "$@"
		./.mGBA-QT5-v0.9.3."$Arquitectura" "%f"

fi
if	[ "$Arquitectura" == "x32" ]; then
		cd "$RUTA"
		export LD_LIBRARY_PATH="$RUTA/.libs/32":$LD_LIBRARY_PATH
		export QT_DEBUG_PLUGINS=1
		export QT_QPA_PLATFORM_PLUGIN_PATH="$RUTA/.libs/32/plugins"
		export SDL_AUDIODRIVER="alsa"
		exec ./.mGBA-QT5-v0.9.3."$Arquitectura" "$@" %f
fi

# Finalizar sin problemas este guion
exit 0

The idea is use this ".desktop" file in a "test" using "Open With", i want the desktop file run the script, and the script can open the target file (rom) inside the mGBA (QT Version) in this case directly ?

but i not had idea right now with things aditional i need for that happend. right now the script & desktop file just open the emulator windows without the file directly. is like the %f or %u are just empty values. i need this because QT open dialog takes minimun 5 minutes in appears, maximun 72 minutes when the excesive memory consumption does not hang-up the machine.

and the another weird thing is if i not specify for example

export QT_QPA_PLATFORM_PLUGIN_PATH="/usr/lib64/qt5/plugins"

i just got the error

QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled

the weird with this last thing is, that variable use that value by default but if i don't specify manually give me the error.


someon had idea if possible for example, when try to run a file in a path, import the values of "$path"/"full-filename.extension" into a variable in the script i am using ?

In this screenshot i am using zenity, and "$RUTA" value
https://i.postimg.cc/mZzJSmxF/m-GBA-v09 … error1.png
the var $RUTA value is

/media/72GB/LignuxEnVivo/opt/videojuegos/emuladores/mgba

but i want to get the current path and file with extension of the file y try to use in this case is :

/media/72GB/USB_INUKAZE/ROMS/Nintendo/GameBoyColor/Pokemon - Edicion Amarilla (S) [C][!].gbc

like when you specify %f using a binary executable does the trick when you don't need a script to launch the binary executable.

Well the thing i wrote this i need help with the script for make the mGBA open target file directly from the script, some idea for fix it ?

Last edited by inukaze (2021-12-31 13:23:56)

Offline

#2 2023-07-18 02:56:20

inukaze
Member
Registered: 2014-07-31
Posts: 46

Re: Xfce 4.12 & Custom Script for Launch mGBA with File

Well i make the question on Unix StackExchange to see if someone can help me -> https://unix.stackexchange.com/question … h-fullpath

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.009 seconds, 11 queries executed - Memory usage: 535.89 KiB (Peak: 543.09 KiB) ]