MCPcopy Create free account
hub / github.com/TASEmulators/fceux / savestate_loadscriptdata

Function savestate_loadscriptdata

src/lua-engine.cpp:3192–3214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3190}
3191
3192static int savestate_loadscriptdata(lua_State *L) {
3193
3194 const char *filename = savestateobj2filename(L,1);
3195
3196 {
3197 LuaSaveData saveData;
3198
3199 std::string luaSaveFilename;
3200 luaSaveFilename.assign( filename );
3201 luaSaveFilename.append( ".luasav");
3202 FILE* luaSaveFile = fopen(luaSaveFilename.c_str(), "rb");
3203 if(luaSaveFile)
3204 {
3205 saveData.ImportRecords(luaSaveFile);
3206 fclose(luaSaveFile);
3207
3208 lua_settop(L, 0);
3209 saveData.LoadRecord(L, LUA_DATARECORDKEY, (unsigned int)-1);
3210 return lua_gettop(L);
3211 }
3212 }
3213 return 0;
3214}
3215
3216
3217// int emu.framecount()

Callers

nothing calls this directly

Calls 5

savestateobj2filenameFunction · 0.85
lua_settopFunction · 0.85
lua_gettopFunction · 0.85
ImportRecordsMethod · 0.80
LoadRecordMethod · 0.80

Tested by

no test coverage detected