You may have seen in the SVN log that I've just added a packaging system.
The idea is very simple: create a ZIP file, add some files in it, and register it in your application. Raydium will then be able to find/use files in ZIP with no particular modification to the application. This feature will probably simplify a lot of things (application testing, deployment, ...)
Off course, you can have many packages registered at the same time. There's also a cache system to make all this quicker as possible. You can have a look at raydium/headers/path.h, the doc is up-to-date.
But !To write this feature, I needed a new feature from PHP: ZipArchive, so it requires a few changes to SDKs:
- Linux: you must rebuild PHP and Raydium: ./configure --force-php-install && make clean && make
- win32: php.ini should be copied in the bin/ directory, and a the php_zip.dll should be added as well. With the latest SDK, the PHP release is 5.2.9, so the DLL is available here:
http://www.php.net/get/php-5.2.9-2-Win3 ... m/a/mirror- OSX / iPhone: PHP should be compiled with the --enable-zip switch (nothing else needed ?)
To ouille and st: can you update SDKs, guys ?
Note to vicente: this commit also allows "Path API" to use subdirectories, so it will probably help you for the Cal3D animation system, since I've seen some tricky things about paths in the patch. Anyway, I think it's pretty interesting to move from the "data/anim" directory to a package system (one animated model = one package), it will probably simplify your work, and make things waaaay better for users.
Very simple test for this feature with text files (of course, it works to all files: textures, sounds, ...):
Code:
// 'space' key
if(raydium_key_last==1000+' ')
{
FILE *fp;
char data[1024];
raydium_path_package_register("test.zip");
// print test file content
//fp=raydium_file_fopen("zip_flag.txt","rt");
fp=raydium_file_fopen("zip_subdir/zip_flagsub.txt","rt");
if(fp)
{
raydium_file_binary_fgets(data,1000,fp);
fclose(fp);
raydium_log("zip_flag.txt: %s",data);
}
else
raydium_log("failed !");
}
The archive
test.zip is available on official R3S servers, so it will be downloaded.
Please, do not hesitate to comment this commit, I really want to know what you're thinking of this feature (easy to understand or not ? what's wrong ? what good ? what can be changed ?)