Skip to content

Commit

Permalink
Added System.shutdown and System.standby.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinnegatamante committed Apr 1, 2021
1 parent b7932b3 commit 80f4641
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
22 changes: 22 additions & 0 deletions doc/luaSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,28 @@ class System{
*/
int reboot(void);

/**
* Shutdown the console.
* \ingroup System
*
* @par Usage example:
* @code
* System.shutdown()
* @endcode
*/
int shutdown(void);

/**
* Put the console in standby.
* \ingroup System
*
* @par Usage example:
* @code
* System.standby()
* @endcode
*/
int standby(void);

/**
* Get if application is running in safe mode.
* \ingroup System
Expand Down
22 changes: 21 additions & 1 deletion source/luaSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,24 @@ static int lua_reboot(lua_State *L){
return 0;
}

static int lua_shutdown(lua_State *L){
int argc = lua_gettop(L);
#ifndef SKIP_ERROR_HANDLING
if (argc != 0) return luaL_error(L, "wrong number of arguments");
#endif
scePowerRequestStandby();
return 0;
}

static int lua_standby(lua_State *L){
int argc = lua_gettop(L);
#ifndef SKIP_ERROR_HANDLING
if (argc != 0) return luaL_error(L, "wrong number of arguments");
#endif
scePowerRequestSuspend();
return 0;
}

static int lua_issafe(lua_State *L){
int argc = lua_gettop(L);
#ifndef SKIP_ERROR_HANDLING
Expand Down Expand Up @@ -1242,7 +1260,9 @@ static const luaL_Reg System_functions[] = {
{"extractFromZipAsync", lua_getfilefromzipasync},
{"takeScreenshot", lua_screenshot},
{"executeUri", lua_executeuri},
{"reboot", lua_reboot},
{"reboot", lua_reboot},
{"shutdown", lua_shutdown},
{"standby", lua_standby},
{"isSafeMode", lua_issafe},
{"setMessage", lua_setmsg},
{"getMessageState", lua_getmsg},
Expand Down

0 comments on commit 80f4641

Please sign in to comment.