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

Function xSGAddLoadClient

src/SB/Core/x/xsavegame.cpp:391–445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

389}
390
391S32 xSGAddLoadClient(st_XSAVEGAME_DATA* xsgdata, U32 clttag, void* cltdata,
392 S32 (*loadfunc)(void*, st_XSAVEGAME_DATA*, st_XSAVEGAME_READCONTEXT*,
393 U32, S32))
394{
395 S32 result = 1;
396 if (xsgdata->stage & 0x40000000)
397 {
398 result = 0;
399 }
400 else if (!(xsgdata->stage & 1))
401 {
402 result = 0;
403 }
404 else if (xsgdata->stkcnt + 1 >= 128)
405 {
406 xUtil_idtag2string(clttag, 0);
407 result = 0;
408 }
409
410 if (clttag != 0 || xsgdata->dfltloadclt.idtag == 0)
411 {
412 if (clttag == 0)
413 {
414 xsgdata->dfltloadclt.idtag = 1;
415 xsgdata->dfltloadclt.cltload = loadfunc;
416 xsgdata->dfltloadclt.cltdata = cltdata;
417 xsgdata->dfltloadclt.blokact = 0;
418 xsgdata->dfltloadclt.blokmax = 0;
419 xsgdata->dfltloadclt.blokpos = NULL;
420 xsgdata->dfltloadclt.readpos = NULL;
421 xsgdata->dfltloadclt.readremain = 0;
422 xsgdata->dfltloadclt.readamt = 0;
423 }
424 else
425 {
426 st_XSAVEGAME_CLIENT* clt = &xsgdata->cltstk[xsgdata->stkcnt++];
427 clt->idtag = clttag;
428 clt->cltload = loadfunc;
429 clt->cltdata = cltdata;
430 clt->blokact = 0;
431 clt->blokmax = 0;
432 clt->blokpos = NULL;
433 clt->readpos = NULL;
434 clt->readremain = 0;
435 clt->readamt = 0;
436 }
437 }
438
439 xsgdata->stage |= 2;
440 if (result == 0)
441 {
442 xsgdata->stage |= 0x40000000;
443 }
444 return result;
445}
446
447S32 xSGSetup(st_XSAVEGAME_DATA* xsgdata)
448{

Callers 3

xSerial_svgame_registerFunction · 0.70
xSGInitFunction · 0.70
zSaveLoad_LoadGameFunction · 0.50

Calls 1

xUtil_idtag2stringFunction · 0.70

Tested by

no test coverage detected