View Single Post
Old 04-16-2012, 07:07 PM   #51
inameiname
Groupie
inameiname can self-interpret dreams as they happen.inameiname can self-interpret dreams as they happen.inameiname can self-interpret dreams as they happen.inameiname can self-interpret dreams as they happen.inameiname can self-interpret dreams as they happen.inameiname can self-interpret dreams as they happen.inameiname can self-interpret dreams as they happen.inameiname can self-interpret dreams as they happen.inameiname can self-interpret dreams as they happen.inameiname can self-interpret dreams as they happen.inameiname can self-interpret dreams as they happen.
 
Posts: 159
Karma: 20390
Join Date: Feb 2009
Device: none
Thank you jmseight for your script. I was using myts and a few aliases via the 'profile' file inside the myts folder to run this emulator, but your method is much better.

Although, I did notice two issues I had to alter a little to make it work for me for Launchpad. I simply changed "*.gb" to "*.g*" at the bottom (since the emulator runs GameBoy color games as well "*.gbc"; though I don't think it would have mattered), and I changed the two lines that start and stop cvm, since yours, I'm guessing, was for use with Kite, and not Launchpad. Therefore, you can either have two scripts, one for Launchpad and one for Kite, or just one, set for whichever you use.

So far so good. It takes a bit to actually close the program for some reason once pressing "HOME", but not a big issue. Thanks.

via LAUNCHPAD or KITE: /mnt/us/fbgnuboy/gameboy.sh (by jmseight)
Code:
#!/bin/sh
#===================================================
# getkb - get translated ascii keys from K3 keyboard
# v1.2                                 by geekmaster
# STDOUT: pressed keys, until Enter key pressed.
#---------------------------------------------------
getkb() {
  eips -z 2 38  # scroll
  XP=0
  YP=39
  DN=/dev/null
  KN="1234567890____qwertyuiop____asdfghjkl_____zxcvbnm_."
  KS="1234567890____QWERTYUIOP____ASDFGHJKL_____ZXCVBNM_,"
  KP="1234567890____~@#$%^&*()____<>[]{}?/\_____;:'|-+=_?"
  KM=$KN
  ST=""
  while :;do
    eips $XP $YP "$ST""_ "
    L="_"
    set $(waitforkey); K=$1 D=$2
    [[ $D -eq 0 ]]&& continue
#    [[ $K -eq 28 ]]&& break # enter
    [[ $K -eq 190 ]]&& break # use Aa for enter
    [[ $K -eq 14 ]]&& ST="$(echo ${ST%?})" && continue # del
    [[ $K -eq 42 ]]&& KM=$KS && continue # shift
    [[ $K -eq 126 ]]&& KM=$KP && continue # Sym
    [[ $K -eq 57 ]]&& L=" " # space
    [[ $K -le 52 ]]&& L="$(echo \"$KM\"|cut -b$K-$K)"
#    [[ "$L" == "_" ]]&& L="($K)"
    [[ "$L" == "_" ]]&& continue
#    echo -n "$L"
    ST="$ST$L"
    KM=$KN
  done
  echo "$ST"
}

putei() {
  st=$1
  ii=${#st}
  while [ $ii -ge 0 ]
  do
    eips -z 2 38  # scroll
    eips 0 39 "$(echo $st | cut -b-50)"  # write to the bottom
    st="$(echo $st | cut -b51-)"
    ii=$(( ii - 50 ))
  done
}


# killall -stop cvm launchpad 2>$DN	# use if running via Kite
killall -stop cvm 			# use if running via Launchpad
cd /mnt/us/fbgnuboy
eips -c;
putei "fbgnuboy - Games Boy Advanced Emulator"
putei ""
putei "Available ROMS -"
putei "$(ls ./roms)"
putei ""
putei "Execute Which ROM?"
HOME=/tmp ./fbgnuboy ./roms/"$(getkb)".g* 2>gnuboy.log
# killall -cont cvm launchpad 2>$DN	# use if running via Kite
killall -cont cvm 			# use if running via Launchpad
Note: the above script does not work if directly run from a terminal emulator (at least not with myts) It might even freeze the Kindle. Therefore, if you want to run fbgnuboy in that way feel free (of course, why would you want to since the above script works fine with Launchpad (and Kite, though I have not tried that method)).

Perhaps hawhill should add jmseight's script to the first post of this thread and then it will be super easy for people to install and run the GameBoy emulator with only Launchpad or Kite.

Last edited by inameiname; 04-17-2012 at 12:32 AM.
inameiname is offline   Reply With Quote