mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 17:33:05 +00:00
added save ,load funcs
This commit is contained in:
parent
ce72edc1a7
commit
64e1113686
@ -46,6 +46,10 @@ void Engine::mainLoop() {
|
||||
unsigned int frameCounter = 0;
|
||||
unsigned int timeAccum = 0;
|
||||
char fps[8] = "";
|
||||
_savegameLoadRequest = false;
|
||||
_savegameSaveRequest = false;
|
||||
_savegameFileName = NULL;
|
||||
|
||||
|
||||
for (;;) {
|
||||
// Process events
|
||||
|
4
engine.h
4
engine.h
@ -140,6 +140,10 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool _savegameLoadRequest;
|
||||
bool _savegameSaveRequest;
|
||||
char *_savegameFileName;
|
||||
|
||||
private:
|
||||
static Engine *instance_;
|
||||
|
||||
|
32
lua.cpp
32
lua.cpp
@ -1192,6 +1192,32 @@ static void GetCurrentScript() {
|
||||
current_script();
|
||||
}
|
||||
|
||||
static void Load() {
|
||||
lua_Object fileName = lua_getparam(1);
|
||||
if (lua_isnil(fileName)) {
|
||||
Engine::instance()->_savegameFileName = NULL;
|
||||
} else if (lua_isstring(fileName)) {
|
||||
Engine::instance()->_savegameFileName = lua_getstring(fileName);
|
||||
} else {
|
||||
warning("Load() fileName is wrong");
|
||||
return;
|
||||
}
|
||||
Engine::instance()->_savegameLoadRequest = true;
|
||||
}
|
||||
|
||||
static void Save() {
|
||||
lua_Object fileName = lua_getparam(1);
|
||||
if (lua_isnil(fileName)) {
|
||||
Engine::instance()->_savegameFileName = NULL;
|
||||
} else if (lua_isstring(fileName)) {
|
||||
Engine::instance()->_savegameFileName = lua_getstring(fileName);
|
||||
} else {
|
||||
warning("Save() fileName is wrong");
|
||||
return;
|
||||
}
|
||||
Engine::instance()->_savegameSaveRequest = true;
|
||||
}
|
||||
|
||||
// Stub function for builtin functions not yet implemented
|
||||
|
||||
static void stubWarning() {
|
||||
@ -1395,8 +1421,6 @@ static char *stubFuncs[] = {
|
||||
"GetActorTimeScale",
|
||||
"SetActorScale",
|
||||
"SetActorColormap",
|
||||
"Save",
|
||||
"Load",
|
||||
"SearchForFileOrSwapCDs",
|
||||
"EngineDisplay",
|
||||
"SetOffscreenTextPos",
|
||||
@ -1680,7 +1704,9 @@ struct luaL_reg builtins[] = {
|
||||
{ "GetTextCharPosition", GetTextCharPosition },
|
||||
{ "GetDiskFreeSpace", GetDiskFreeSpace },
|
||||
{ "Is3DHardwareEnabled", Is3DHardwareEnabled },
|
||||
{ "GetCurrentScript", GetCurrentScript }
|
||||
{ "GetCurrentScript", GetCurrentScript },
|
||||
{ "Save", Save },
|
||||
{ "Load", Load }
|
||||
};
|
||||
|
||||
void register_lua() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user