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

Function HIPLBlockRead

src/SB/Core/x/xhipio.cpp:234–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232}
233
234static S32 HIPLBlockRead(st_HIPLOADDATA* lddata, void* data, S32 cnt, S32 size)
235{
236 st_HIPLOADBLOCK* top;
237 S32 got = 0;
238 S32 left = 0;
239 S32 head = 0;
240
241 if (lddata->bypass)
242 {
243 return 0;
244 }
245
246 if (cnt == 0)
247 {
248 return 0;
249 }
250
251 if (lddata->top < 0)
252 {
253 top = NULL;
254 }
255 else
256 {
257 top = &lddata->stk[lddata->top];
258 left = top->blk_remain / size;
259 }
260
261 if (cnt < 0)
262 {
263 cnt = -cnt;
264 head = 1;
265
266 if (top && cnt > left)
267 {
268 cnt = left;
269 }
270 }
271
272 if (!head && left < cnt)
273 {
274 cnt = left;
275 }
276
277 if (cnt == 0)
278 {
279 got = 0;
280 }
281 else if (size == 1)
282 {
283 got = lddata->fli->readBytes(lddata->fli, (char*)data, cnt);
284 }
285 else if (size == 2)
286 {
287 got = lddata->fli->readMShorts(lddata->fli, (S16*)data, cnt);
288 }
289 else if (size == 4)
290 {
291 got = lddata->fli->readMLongs(lddata->fli, (S32*)data, cnt);

Callers 5

HIPLReadBytesFunction · 0.70
HIPLReadShortsFunction · 0.70
HIPLReadLongsFunction · 0.70
HIPLReadFloatsFunction · 0.70
HIPLReadStringFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected