Skip to content

Commit

Permalink
Added System.getBootParams.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinnegatamante committed Apr 5, 2021
1 parent 6a5d99a commit 8f9f29d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
13 changes: 13 additions & 0 deletions doc/luaSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1100,5 +1100,18 @@ class System{
* @note This function is available only in unsafe mode.
*/
void installApp(string dir);

/**
* Retrieve params used at app boot.
* \ingroup System
*
* @par Usage example:
* @code
* args = System.getBootParams()
* @endcode
*
* @return The params passed to the app when it got launched.
*/
string getBootParams(void);

}
14 changes: 14 additions & 0 deletions source/luaSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1455,6 +1455,19 @@ static int lua_promote(lua_State *L){
return 0;
}

static int lua_bootparams(lua_State *L){
int argc = lua_gettop(L);
#ifndef SKIP_ERROR_HANDLING
if (argc != 0) return luaL_error(L, "wrong number of arguments");
if (!unsafe_mode) return luaL_error(L, "this function requires unsafe mode");
#endif
char bootparams[1024];
bootparams[0] = 0;
sceAppMgrGetAppParam(bootparams);
lua_pushstring(L, bootparams);
return 1;
}

//Register our System Functions
static const luaL_Reg System_functions[] = {
{"openFile", lua_openfile},
Expand Down Expand Up @@ -1529,6 +1542,7 @@ static const luaL_Reg System_functions[] = {
{"unmountPartition", lua_unmount},
{"mountPartition", lua_mount},
{"installApp", lua_promote},
{"getBootParams", lua_bootparams},
{0, 0}
};

Expand Down

0 comments on commit 8f9f29d

Please sign in to comment.