Autoloader for custom "Game" plug-ins

Here are software that related with Samsung B series TVs. Like hex editors, new version of BusyBox or internal software, app programs that will run in your TV hardware.:!:This forum is NOT FOR USER QUESTIONS or Problems.

manga00
Posts: 14
Joined: Fri Jun 11, 2010 10:52 pm

Re: Autoloader for custom "Game" plug-ins

Post by manga00 »

tusko wrote:The script. I called it gdbtrick.sh

Configure and try to execute it using telnet. Let me know what happens...

Code: Select all

#!/bin/sh

### begin configure me

# gdb_binary: where your gdb binary resides
gdb_binary=/dtv/usb/sda1/gdb

# gdb_commands: this is a temporary file where gdb commands are stored
gdb_commands=/dtv/usb/sda1/gdbtrick.gdb

# gdb_delay: gdb will be scheduled to run after $gdb_delay seconds
#            this is for letting exeDSP to settle down at TV startup
gdb_delay=30

# libraries: absolute path of libraries to be loaded
#            there can be several separated by commas (no spaces!!)
#            this script requires paths WITHOUT spaces AND commas
libraries=/dtv/usb/sda1/samygoPVR/loader.so, # add more libraries here

### end configure me

libraries=$(echo $libraries | sed 's/\,/ /')

exeDSP_PID=$(ps aux | grep exeDSP | grep -v grep | sed 's/[ ]*\([0-9]*\).*/\1/')
temp='attach '$exeDSP_PID'\n'

i=0
for l in $libraries
do 
   temp=$temp'call dlopen("'$l'", 2)\n'
   i=$(( i + 1 ))
   temp=$temp'call dlsym($'$i', "Game_Main")\n'
   i=$(( i + 1 ))
   l_dirname=$(echo $l | sed 's/[^\/]*$//')
   temp=$temp'call $'$i'("'$l_dirname'", 0)\n'
   i=$(( i + 1 ))
done
temp=$temp'detach\n'

echo -e 'The following commands:\n---\n'$temp'---\nwill be executed by '$gdb_binary' in '$gdb_delay' secs!!\n'

echo -e $temp >$gdb_commands

{ sleep $gdb_delay; $gdb_binary -batch -x $gdb_commands; } &
HI tusko,
I have a prob with your script. I have no value for exeDSP_PID, when i execute the command`s by hand is all fine.
can you take a look of

Code: Select all

exeDSP_PID=$(ps aux | grep exeDSP | grep -v grep | sed 's/[ ]*\([0-9]*\).*/\1/')
temp='attach '$exeDSP_PID'\n'
thanks
LEXXB750 T-CHLCIPDEUC 2006 pached with Samygo Extensions
channelinfo, AVRFIX 2, SamyGo PVR+,Lan Remote with autostart over gdbtrick
Bftp,

arris69
Official SamyGO Developer
Posts: 1700
Joined: Fri Oct 02, 2009 8:52 am
Location: Austria/Vienna (no Kangaroos here)
Contact:

Re: Autoloader for custom "Game" plug-ins

Post by arris69 »

manga00 wrote:...

Code: Select all

exeDSP_PID=$(ps aux | grep exeDSP | grep -v grep | sed 's/[ ]*\([0-9]*\).*/\1/')
temp='attach '$exeDSP_PID'\n'
thanks
may a

Code: Select all

exeDSP_PID=$(pidof exeDSP)
is a bit simpler
hope just 1 instance of exeDSP is running ;-)

arris69
Official SamyGO Developer
Posts: 1700
Joined: Fri Oct 02, 2009 8:52 am
Location: Austria/Vienna (no Kangaroos here)
Contact:

Re: Autoloader for custom "Game" plug-ins

Post by arris69 »

tusko wrote:arris69: damn, you are right :-P, thanks I edited the script. By the way, I would like to avoid the 'sed' command completely and using pidof is a step in the right direction. There is still more 'sed', though. For example, when assigning l_dirname. Unfortunately, the obvious solution (using dirname shell command) does not work in my TV.
....
may so?

Code: Select all

#!/bin/sh

### begin configure me

# gdb_binary: where your gdb binary resides
gdb_binary=/dtv/usb/sda1/gdb

# gdb_commands: this is a temporary file where gdb commands are stored
gdb_commands=/dtv/usb/sda1/gdbtrick.gdb

# gdb_delay: gdb will be scheduled to run after $gdb_delay seconds
#            this is for letting exeDSP to settle down at TV startup
gdb_delay=30

# libraries: absolute path of libraries to be loaded
#            there can be several, separated spaces!!
#            this script requires paths WITHOUT spaces
libraries="/mtd_tlib/GGame/channelinfo/loader.so /mtd_tlib/GGame/avrfix2/load.so" # add more libraries here

### end configure me

exeDSP_PID=$(pidof exeDSP)
temp='attach '$exeDSP_PID'\n'

i=0
for l in $libraries
do
        if [ -e "$l" ] ;then
                temp=$temp'call dlopen("'$l'", 2)\n'
                let i++
                temp=$temp'call dlsym($'$i', "Game_Main")\n'
                let i++
                temp=$temp'call $'$i'("'${l%/*}/'", 0)\n'
                let i++
        fi
done
temp=$temp'detach\n'

echo -e 'The following commands:\n---\n'$temp'---\nwill be executed by '$gdb_binary' in '$gdb_delay' secs!!\n'

echo -e $temp >$gdb_commands

{ sleep $gdb_delay; $gdb_binary -batch -x $gdb_commands; } &

Post Reply

Return to “[B] Software”