Jo Engine Forum

Sega Saturn Development => General Jo Engine Help => Topic started by: mindslight on September 18, 2016, 08:36:45 pm

Title: Read file asynchronously without blocking the game
Post by: mindslight on September 18, 2016, 08:36:45 pm
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: [Select]
void            my_async_read(char *contents, int length, int optional_token)
{
}

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: [Select]
jo_fs_read_file_async("DEMO.TXT", my_async_read, 0);

In attachement, you will find a sample code to load a background image (TGA) from the CD asynchronously
Title: Re: Read file asynchronously without blocking the game
Post by: NeoSnk on September 22, 2016, 01:28:55 am
Amazing, tks man!
Title: Re: Read file asynchronously without blocking the game
Post by: mindslight on September 22, 2016, 11:01:09 am
you're welcome  ;)
Title: Re: Read file asynchronously without blocking the game
Post by: NeoSnk on December 16, 2016, 02:45:30 pm
is it possible to execute this function while the CD is playing some music? I'm trying here but the music stops.


Tks man!!!!
Title: Re: Read file asynchronously without blocking the game
Post by: NeoSnk on December 17, 2016, 04:33:29 am
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!
Title: Re: Read file asynchronously without blocking the game
Post by: mindslight on December 19, 2016, 09:23:22 am
You can read multiple file at the same time but not with the audio CD (I think)
Title: Re: Read file asynchronously without blocking the game
Post by: NeoSnk on December 19, 2016, 03:33:58 pm
Yes, I realized that, but I found another way to do what I wanted heheheh! Thank you :)