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

Function xBinioLoadCreate

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

Source from the content-addressed store, hash-verified

68static en_BIO_ASYNC_ERRCODES BFD_AsyncReadStatus(st_FILELOADINFO* fli);
69
70st_FILELOADINFO* xBinioLoadCreate(const char* filename)
71{
72 st_FILELOADINFO* fli = NULL;
73 tag_xFile* tmp_fp;
74 S32 i;
75 S32 uselock = -1;
76
77 for (i = 0; i < 8; i++)
78 {
79 if (!(g_loadlock & (1 << i)))
80 {
81 g_loadlock |= 1 << i;
82
83 uselock = i;
84 fli = &g_loadinst[i];
85
86 break;
87 }
88 }
89
90 if (fli)
91 {
92 memset(fli, 0, sizeof(st_FILELOADINFO));
93
94 fli->lockid = uselock & ~(uselock >> 31);
95 fli->xtradata = &g_xtraload[uselock];
96 fli->destroy = LoadDestroy;
97 fli->readBytes = ReadBytes;
98 fli->readMShorts = ReadMShorts;
99 fli->readMLongs = ReadMLongs;
100 fli->readMFloats = ReadMFloats;
101 fli->readMDoubles = ReadMDoubles;
102 fli->readIShorts = ReadIShorts;
103 fli->readILongs = ReadILongs;
104 fli->readIFloats = ReadIFloats;
105 fli->readIDoubles = ReadIDoubles;
106 fli->asyncIRead = AsyncIRead;
107 fli->asyncMRead = AsyncMRead;
108 fli->asyncReadStatus = AsyncReadStatus;
109 fli->skipBytes = SkipBytes;
110 fli->seekSpot = ReadSeek;
111 fli->setDoubleBuf = SetBuffer;
112 fli->discardDblBuf = DiscardBuffer;
113 fli->error = FIOERR_NONE;
114 fli->remain = 0;
115 fli->basesector = 0;
116 fli->filesize = 0;
117 fli->position = 0;
118 fli->basesector = 0;
119
120 tmp_fp = BFD_open(filename, "rb", uselock, 0, fli->xtradata);
121
122 if (tmp_fp)
123 {
124 fli->basesector = BFD_startSector(filename);
125 fli->privdata = tmp_fp;
126 fli->filesize = BFD_getLength(tmp_fp, fli->xtradata);
127 fli->remain = fli->filesize;

Callers 1

HIPLCreateFunction · 0.70

Calls 5

memsetFunction · 0.85
BFD_startSectorFunction · 0.85
BFD_getLengthFunction · 0.85
BFD_openFunction · 0.70
LoadDestroyFunction · 0.70

Tested by

no test coverage detected