I installed the SDL library a couple days ago and noticed that it dumped them into /usr/lib. I know this is the standard for Linux and it has worked great for all my linux boxes in the past. But I think to continue to do this is a bad idea. We need to be able to load libraries off the SD card. And to do that we need to come up with a defacto standard for where to put them. I suggest /mnt/sd/gp2xlibs. If we do this then users and developers could just put the libraries they need into that directory instead of the user having to execute a shell script to copy everying over to their NAND. I wrote up a bash script to take care of all this. It adds a place for the dynamic linker to look then mounts the sd and executes the application then when the application is complete it dumps back to the menu. I would like to say 2xquake's loader script is what inspired this. If you want to download these scripts there will be a link below. Just unzip the file onto the base of your SD card. You will also need to make a launcher script for games. I have tried to make that as easy as possible. Here is a example launcher:
everything happens in the run fuction so really you just have to change EXECPATH and EXECNAME to match your game. I really hope other developers will take advantage of this, and ship a launcher with their game. But like I said its easy to create one yourself, just copy that into a textfile and edit each variable accordingly save it (making sure to give the filename a .gpe at the end) and put it anywhere on your SD card. After that you just use that to load the game. If it feels like your head is spinning I have went ahead and made a full zip that includes the libraries and nes and snes emulators. Just unzip it onto your SD card.
Scripts and SDL Libraries:
sdlibs.zip
Scripts, Libraries, Emulators, Launchers (eg everything you need to rock)
sdlibs_full.zip
The rest of this will be in FAQ form mostly because its easier for me to think that way and hopefully I will make more sense.
Why shouldn't we copy our libraries to the /usr/lib folder, it has been the standard practice for years?
There are two big reasons. The first being there is a very limited amount of memory on the gp2x; 20mb of free space *. As more libraries are needed to play games it will begin to fill to the max. The system needs a certain amount of space to function correctly and if you max out the memory you may brick your gp2x.
The second big reason is from a user standpoint it is hard to get rid of stuff once its been copied over. New versions of libraries come out all the time, and when you install the new one you often have to delete the old one. The only way to do that is to look up the names of every file that was installed by your old library make a shell script that manually deletes each one. While most people who are firmiliar with linux can handle this task, there are alot of people who wouldnt know ls from grep. If you install your libraries to the SD card or they copy them there, with a card reader they can actually see all the files; not just infer they exist because of the output of some dump script.
Why not just statically link everything?
Memory on the gp2x is very finite. If every developer out there compiles everything in our SD cards are going to fill up very fast. It is not like a PC where there is 100gig of freespace waiting to be used. Most you can get is a 4gig SD card, but most of us can't afford to drop that much money.
Okay so there you have it. Thoughts, Flames, Flowers?
(Oh hey I am new to the community! *wave* once I get a toolchain up and running I will begin porting lua (with sdl and input modules thrown on too) over to the gp2x. Hopefully a solid scripting language will help others get into development.)
*Thanks psymastr for correcting that.
Code:
#!/bin/sh
source /mnt/sd/gp2x.env
#The path to the folder that the game rests in.
#This path is in relation to your SD card so don't
#put /mnt/sd/ at the begining.
export EXECPATH="data/games/emulators/nes"
#The name of the program to be executed
export EXECNAME="nesgp2x.gpe"
run
Scripts and SDL Libraries:
sdlibs.zip
Scripts, Libraries, Emulators, Launchers (eg everything you need to rock)
sdlibs_full.zip
The rest of this will be in FAQ form mostly because its easier for me to think that way and hopefully I will make more sense.
Why shouldn't we copy our libraries to the /usr/lib folder, it has been the standard practice for years?
There are two big reasons. The first being there is a very limited amount of memory on the gp2x; 20mb of free space *. As more libraries are needed to play games it will begin to fill to the max. The system needs a certain amount of space to function correctly and if you max out the memory you may brick your gp2x.
The second big reason is from a user standpoint it is hard to get rid of stuff once its been copied over. New versions of libraries come out all the time, and when you install the new one you often have to delete the old one. The only way to do that is to look up the names of every file that was installed by your old library make a shell script that manually deletes each one. While most people who are firmiliar with linux can handle this task, there are alot of people who wouldnt know ls from grep. If you install your libraries to the SD card or they copy them there, with a card reader they can actually see all the files; not just infer they exist because of the output of some dump script.
Why not just statically link everything?
Memory on the gp2x is very finite. If every developer out there compiles everything in our SD cards are going to fill up very fast. It is not like a PC where there is 100gig of freespace waiting to be used. Most you can get is a 4gig SD card, but most of us can't afford to drop that much money.
Okay so there you have it. Thoughts, Flames, Flowers?
(Oh hey I am new to the community! *wave* once I get a toolchain up and running I will begin porting lua (with sdl and input modules thrown on too) over to the gp2x. Hopefully a solid scripting language will help others get into development.)
*Thanks psymastr for correcting that.