Autoloader for Content Library Games


From SamyGO
Revision as of 17:47, 27 July 2011 by Erdem ua (talk | contribs) (Fixed old forums links.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

With this hack, you can load content library programs to your TV even if your TV doesn't have game menu.

Hack uses GDB to injecting code to exeDSP. Here is the script that loads plugins.

#!/bin/sh

### begin configure me
# gdb_binary: where your gdb binary resides
gdb_binary=/mtd_rwarea/gdb
# gdb_commands: this is a temporary file where gdb commands are stored
gdb_commands=/mtd_rwarea/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=5
# libraries: absolute path of libraries to be loaded
#            there can be several, separated spaces!!
#            this script requires paths WITHOUT spaces
libraries="/mtd_tlib/GGame/avrfix2-cip/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++
                temp=$temp'call dlclose($'$((i-2))')\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; rm $gdb_commands; } &

Related forum page is here