MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / BFD_AsyncRead

Function BFD_AsyncRead

src/SB/Core/x/xbinio.cpp:617–663  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

615}
616
617static S32 BFD_AsyncRead(st_FILELOADINFO* fli, S32 pos, void* data, S32 size, S32 n, S32 endian)
618{
619 tag_xFile* file = (tag_xFile*)fli->privdata;
620 st_BINIO_XTRADATA* xtra = (st_BINIO_XTRADATA*)fli->xtradata;
621
622 if (fli->error != FIOERR_NONE)
623 {
624 return 0;
625 }
626
627 if (g_async_context)
628 {
629 return 0;
630 }
631
632 g_async_context = xtra;
633
634 xtra->asyn_status = BINIO_ASYNC_INPROG;
635 xtra->asyn_data = (char*)data;
636 xtra->asyn_elesize = size;
637 xtra->asyn_amt = n;
638 xtra->asyn_ismot = 1;
639
640 iFileSeek(file, pos, IFILE_SEEK_SET);
641 xFileSetUserData(file, fli);
642
643 S32 result = iFileReadAsync(file, data, size * n, BFD_cb_GCP2_readasync, 0);
644 S32 rc;
645
646 if (result < 0)
647 {
648 rc = 0;
649 }
650 else
651 {
652 xtra->gcaskey = result;
653 rc = 1;
654 }
655
656 if (rc == 0)
657 {
658 g_async_context = NULL;
659 xtra->asyn_status = BINIO_ASYNC_NOOP;
660 }
661
662 return 1;
663}
664
665static en_BIO_ASYNC_ERRCODES BFD_AsyncReadStatus(st_FILELOADINFO* fli)
666{

Callers 2

AsyncMReadFunction · 0.70
AsyncIReadFunction · 0.70

Calls 3

xFileSetUserDataFunction · 0.85
iFileSeekFunction · 0.50
iFileReadAsyncFunction · 0.50

Tested by

no test coverage detected