mirror of
https://github.com/ctruLua/ctruLua.git
synced 2025-10-28 00:39:30 +00:00
Added ctr.gfx.getFPS, renamed ctr.hid.read to ctr.hid.keys, unload font from memory when exiting and did some cleaning
This commit is contained in:
parent
bea69d4e30
commit
b772a42d28
8 changed files with 42 additions and 19 deletions
|
|
@ -9,6 +9,7 @@
|
|||
#define BOOT_FILE "/ctruLua/main.lua"
|
||||
|
||||
int load_ctr_lib(lua_State *L);
|
||||
void unload_font_lib();
|
||||
|
||||
// Display an error
|
||||
void error(char *error) {
|
||||
|
|
@ -18,7 +19,7 @@ void error(char *error) {
|
|||
printf("------------------ FATAL ERROR -------------------");
|
||||
printf(error);
|
||||
printf("\n--------------------------------------------------");
|
||||
printf("Please exit ctruLua by pressing the home button.");
|
||||
printf("Please exit ctruLua by rebooting the console.");
|
||||
|
||||
while (aptMainLoop()) {
|
||||
gfxFlushBuffers();
|
||||
|
|
@ -40,12 +41,15 @@ int main() {
|
|||
|
||||
// Init Lua
|
||||
lua_State *L = luaL_newstate();
|
||||
if (L == NULL) error("memory allocation error while creating a new Lua state");
|
||||
if (L == NULL) error("Memory allocation error while creating a new Lua state");
|
||||
luaL_openlibs(L);
|
||||
load_ctr_lib(L);
|
||||
|
||||
// Do the actual thing
|
||||
if(luaL_dofile(L, BOOT_FILE)) error("Can open "BOOT_FILE);
|
||||
if (luaL_dofile(L, BOOT_FILE)) error("Can't open the boot file "BOOT_FILE);
|
||||
|
||||
// Unload current font
|
||||
unload_font_lib();
|
||||
|
||||
// Disable accel/gyro
|
||||
HIDUSER_DisableAccelerometer();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue