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

Function zSaveLoad_SaveGame

src/SB/Game/zSaveLoad.cpp:1833–1952  ·  view source on GitHub ↗

Reordering at beginning

Source from the content-addressed store, hash-verified

1831
1832// Reordering at beginning
1833S32 zSaveLoad_SaveGame()
1834{
1835 S32 success = false;
1836 S32 teststat = true;
1837 en_XSGASYNC_STATUS asstat = XSG_ASTAT_NOOP;
1838 S32 use_tgt = CardtoTgt(currentCard);
1839 S32 use_game = currentGame;
1840 autoSaveCard = currentCard;
1841
1842 st_XSAVEGAME_DATA* xsgdata = zSaveLoadSGInit(XSG_MODE_SAVE);
1843 if (xSGCheckMemoryCard(xsgdata, currentCard) == 0)
1844 {
1845 zSaveLoadSGDone(xsgdata);
1846 return 8;
1847 }
1848
1849 xSGTgtSelect(xsgdata, use_tgt);
1850 xSGGameSet(xsgdata, use_game);
1851 if (xsgdata == NULL)
1852 {
1853 teststat = false;
1854 }
1855
1856 zSceneSave(globals.sceneCur, NULL);
1857
1858 xSGAddSaveClient(xsgdata, 'ROOM', NULL, xSGT_SaveInfoCB, xSGT_SaveProcCB);
1859 xSGAddSaveClient(xsgdata, 'PREF', NULL, xSGT_SaveInfoPrefsCB, xSGT_SaveProcPrefsCB);
1860
1861 xSerial_svgame_register(xsgdata, XSG_MODE_SAVE);
1862
1863 U32 progress = zSceneCalcProgress();
1864 char label[64];
1865 const char* area;
1866
1867 if (globals.sceneCur->sceneID == 'PG12')
1868 {
1869 area = zSceneGetLevelName('HB01');
1870 }
1871 else
1872 {
1873 area = zSceneGetLevelName(globals.sceneCur->sceneID);
1874 }
1875
1876 strncpy(label, area, sizeof(label));
1877
1878 if (!xSGSetup(xsgdata, use_game, label, progress, 0, zSceneGetLevelIndex()))
1879 {
1880 teststat = false;
1881 }
1882
1883 en_XSG_WHYFAIL whyFail = XSG_WHYERR_NONE;
1884 if (teststat)
1885 {
1886 S32 rc = xSGProcess(xsgdata);
1887 if (rc)
1888 {
1889 asstat = xSGAsyncStatus(xsgdata, 1, &whyFail, NULL);
1890 }

Callers 1

zSaveLoad_SaveLoopFunction · 0.70

Calls 15

zSaveLoadSGInitFunction · 0.85
xSGCheckMemoryCardFunction · 0.85
zSaveLoadSGDoneFunction · 0.85
xSGGameSetFunction · 0.85
zSceneCalcProgressFunction · 0.85
strncpyFunction · 0.85
zSceneGetLevelIndexFunction · 0.85
xSGGameIsEmptyFunction · 0.85
xSGAutoSave_GetCacheFunction · 0.85
xSGTgtPhysSlotIdxFunction · 0.85
SetCacheMethod · 0.80
CardtoTgtFunction · 0.70

Tested by

no test coverage detected