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

Function savestate_save

src/lua-engine.cpp:3112–3133  ·  view source on GitHub ↗

savestate.save(object state) Saves a state to the given object.

Source from the content-addressed store, hash-verified

3110//
3111// Saves a state to the given object.
3112static int savestate_save(lua_State *L) {
3113
3114 //char *filename = savestateobj2filename(L,1);
3115
3116 LuaSaveState *ss = (LuaSaveState *)lua_touserdata(L, 1);
3117 if (!ss) {
3118 luaL_error(L, "Invalid savestate.save object");
3119 return 0;
3120 }
3121
3122 if(ss->data) delete ss->data;
3123 ss->data = new EMUFILE_MEMORY();
3124
3125// printf("saving %s\n", filename);
3126
3127 // Save states are very expensive. They take time.
3128 numTries--;
3129
3130 FCEUSS_SaveMS(ss->data,Z_NO_COMPRESSION);
3131 ss->data->fseek(0,SEEK_SET);
3132 return 0;
3133}
3134
3135static int savestate_persist(lua_State *L) {
3136

Callers

nothing calls this directly

Calls 4

lua_touserdataFunction · 0.85
luaL_errorFunction · 0.85
FCEUSS_SaveMSFunction · 0.85
fseekMethod · 0.45

Tested by

no test coverage detected