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.

User avatar
geo650
Official SamyGO Developer
Posts: 302
Joined: Wed Oct 07, 2009 12:03 pm

Re: Autoloader for custom "Game" plug-ins

Post by geo650 »

Thank you for inventing this method for loading Game modules. Finally, I tested this, too. It works. My old geopvr (with SDL graphics) has been loaded well and works as usual. There were "dlopen failed on 'libthread_db.so.1'" and "(no debugging symbols found)" erros but the whole thing started.
One thing that I changed in your script was temporary gdb-script path: I moved it to RAM-disk partition to save flash memory lifetime.

Code: Select all

gdb_commands=/mtd_ram/gdbtrick.gdb

smartsmurf
Official SamyGO Developer
Posts: 111
Joined: Thu Jun 24, 2010 8:26 am
Location: Frankfurt, Germany

Re: Autoloader for custom "Game" plug-ins

Post by smartsmurf »

tusko wrote: Also I think that this method is a bit too much... loading the whole gdb binary to only call some functions. As an alternative, I am working in a small C program using ptrace syscall to load a "boot" library with dlopen. Then, this library will load plugins and call Game_Main. This will be more or less the same that gdb does but it will be more efficient.
I did this some time ago, please find the result here:
http://forum.samygo.tv/viewtopic.php?f=6&t=862

Hopefully it will server your needs, too.

Good luck!
SM

steve-austin
Posts: 78
Joined: Tue Oct 20, 2009 8:04 pm

Re: Autoloader for custom "Game" plug-ins

Post by steve-austin »

Hello,

I just would like to add at startup 3 games stored in content library, is my script ok because that don't work ...

Code: Select all

gdb_binary=/mtd_rwarea/gdb
gdb_commands=/mtd_rwarea/gdbtrick.gdb
gdb_delay=5
libraries="/mtd_tlib/GGame/ChannelInfo/load.so /mtd_tlib/GGame/SamyGO/libSamyGO.so /mtd_tlib/GGame/SamyGO-PVR/loader.so"
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; } &
Thanks in advance.
Last edited by steve-austin on Thu Nov 11, 2010 1:37 pm, edited 1 time in total.
55B650 and 37B650 with patched firmware

User avatar
juusso
SamyGO Moderator
Posts: 10124
Joined: Sun Mar 07, 2010 6:20 pm

Re: Autoloader for custom "Game" plug-ins

Post by juusso »

You have to add your script to samygo.sh startup. Fo example like this:

Code: Select all

if [ -f /mtd_rwarea/gdbtrick.sh ];then
	echo "Running SamyGO extensions Startup"
	/mtd_rwarea/gdbtrick.sh& # Run samygo extensions
	fi
Here is my full samygo.sh code to understand better:

Code: Select all

#!/bin/sh
#====================================================================
# Enable Telnetd
#====================================================================
if [ `cat /proc/mounts | grep -c "/dev/pts"` -lt "1" ] ; then
        echo "telnetd Enabled"
             mount -t devpts devpts /dev/pts
             telnetd
     else
        echo "/dev/pts is mounted"
fi

sleep 10

#=====================================================================
#Wi-fi draiveriai 1
#=====================================================================
#if [ -f /mtd_rwarea/wifi.sh ];then
#   echo "Loading wi-fi adapter drivers"
#   /mtd_rwarea/wifi.sh& # Loading wi-fi adapter drivers
#fi

#====================================================================
#Network Time Protocol (ntp - tikslus sistemos laikas)
#====================================================================
# example NTP server from Poland (change this if you want)
#SERVER="193.110.137.171"
## we must wait for internet
#sleep 10
## Synchronize now
#/path/to/your/binary/ntpclient -s -h $SERVER -p 123

SERVER="129.6.15.28"
/mtd_rwarea/ntpclient/ntpclient -s -h $SERVER -p 123

#=====================================================================
#Wi-fi draiveriai
#=====================================================================
rmmod rt2870sta # Unloading original rt2870sta
rmmod rt73    # Unloading original rt73
insmod /mtd_rwarea/modules/rt2870sta.ko
sleep 10

#Paleidziam FTP======================================================
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mtd_rwarea/SamyGO
#/mtd_rwarea/SamyGO/bftpd -d -c /mtd_rwarea/SamyGO/bftpd.conf
#====================================================================

#====================================================================
#Install VUSB
#sleep 10
#====================================================================
modules="/mtd_rwarea/modules"
insmod $modules/dummy_hcd.ko
sleep 10
insmod $modules/g_file_storage.ko file=/mtd_rwarea/vusb.image
#sleep 10

#====================================================================
# Open back-door for fixing boot-loop situations
#====================================================================
sleep 20             # Allow USB-stick to settle
    USB="/dtv/usb/sda1" # USB mount-point
                                    
if [ -f $USB/usb.sh ];then
	echo "USB-File detected"
        $USB/usb.sh
			exit
	else
	if [ -f /mtd_rwarea/mtd_rwarea.sh ];then
	echo "Running normal samsung TV startup"
	/mtd_rwarea/mtd_rwarea.sh # Run normal startup script
	fi
	
	if [ -f /mtd_rwarea/mount.sh ];then
	echo "Running SamyGO NFS mounts"
	/mtd_rwarea/mount.sh& # Run mount script
	fi

	if [ -f /mtd_rwarea/gdbtrick.sh ];then
	echo "Running SamyGO extensions Startup"
	/mtd_rwarea/gdbtrick.sh& # Run samygo extensions
	fi
fi

#Your lines here!
#/mtd_tlib/GGame/SamyGO/rcSGO

exit
And one thing more: do you use patched firmware? For autostart of extensions you need patched firmware with adwanced option enabled.
Isn`t gdb delay to long? it enough 5 secs for me, you have set it for 30 :shock:
LE40B653T5W,UE40D6750,UE65Q8C
Have questions? Read SamyGO Wiki, Search on forum first!
FFB (v0.8), FFB for CI+ . Get root on: C series, D series, E series, F series, H series. rooting K series, exeDSP/exeTV patches[C/D/E/F/H]

DO NOT EVER INSTALL FIRMWARE UPGRADE

Post Reply

Return to “[B] Software”