Sega Saturn Development > General Jo Engine Help
Read file asynchronously without blocking the game
mindslight:
I added some functions to read file asynchronously, because I working on a video reader, but it's working for any file and any usage :)
If you're interested, here 's how it works:
The function bellow will be called when the file is loaded:
--- Code: ---
void my_async_read(char *contents, int length, int optional_token)
{
}
--- End code ---
To read a file asynchronously, you just have to call jo_fs_read_file_async() with the filename, the callback and an optional token (user value for the callback)
--- Code: ---
jo_fs_read_file_async("DEMO.TXT", my_async_read, 0);
--- End code ---
In attachement, you will find a sample code to load a background image (TGA) from the CD asynchronously
NeoSnk:
Amazing, tks man!
mindslight:
you're welcome ;)
NeoSnk:
is it possible to execute this function while the CD is playing some music? I'm trying here but the music stops.
Tks man!!!!
NeoSnk:
I think the problem is when the console will read a image from the CD it stops to read the music... I don't know if it can read two things at the same time!
Navigation
[0] Message Index
[#] Next page
Go to full version