mirror of
https://github.com/ctruLua/ctruLua.git
synced 2025-10-27 16:39:29 +00:00
Errors in 2D. Cleaned main.c
This commit is contained in:
parent
ee4ea72335
commit
547512c951
1 changed files with 9 additions and 14 deletions
|
|
@ -11,13 +11,12 @@
|
||||||
int load_ctr_lib(lua_State *L);
|
int load_ctr_lib(lua_State *L);
|
||||||
void unload_font_lib();
|
void unload_font_lib();
|
||||||
|
|
||||||
bool errored, gfxinit = false;
|
bool gfxinit = false;
|
||||||
|
|
||||||
// Display an error
|
// Display an error
|
||||||
void error(const char *error) {
|
void error(const char *error) {
|
||||||
if (!gfxinit) {
|
if (!gfxinit) gfxInitDefault();
|
||||||
gfxInitDefault();
|
gfxSet3D(false);
|
||||||
}
|
|
||||||
|
|
||||||
consoleInit(GFX_TOP, NULL);
|
consoleInit(GFX_TOP, NULL);
|
||||||
printf("------------------ FATAL ERROR -------------------");
|
printf("------------------ FATAL ERROR -------------------");
|
||||||
|
|
@ -25,27 +24,23 @@ void error(const char *error) {
|
||||||
printf("\n--------------------------------------------------");
|
printf("\n--------------------------------------------------");
|
||||||
printf("Please exit ctruLua by pressing start.");
|
printf("Please exit ctruLua by pressing start.");
|
||||||
|
|
||||||
errored = true;
|
|
||||||
|
|
||||||
while (aptMainLoop()) {
|
while (aptMainLoop()) {
|
||||||
hidScanInput();
|
hidScanInput();
|
||||||
if (hidKeysDown() & KEY_START)
|
if (hidKeysDown() & KEY_START) break;
|
||||||
break;
|
|
||||||
gfxFlushBuffers();
|
gfxFlushBuffers();
|
||||||
gfxSwapBuffers();
|
gfxSwapBuffers();
|
||||||
gspWaitForVBlank();
|
gspWaitForVBlank();
|
||||||
}
|
}
|
||||||
if (!gfxinit) {
|
|
||||||
gfxExit();
|
if (!gfxinit) gfxExit();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main loop
|
// Main loop
|
||||||
int main() {
|
int main() {
|
||||||
// Init Lua
|
// Init Lua
|
||||||
lua_State *L = luaL_newstate();
|
lua_State *L = luaL_newstate();
|
||||||
if (L == NULL) error("Memory allocation error while creating a new Lua state");
|
if (L == NULL) {
|
||||||
if (errored) {
|
error("Memory allocation error while creating a new Lua state");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -59,7 +54,7 @@ int main() {
|
||||||
HIDUSER_EnableAccelerometer();
|
HIDUSER_EnableAccelerometer();
|
||||||
HIDUSER_EnableGyroscope();
|
HIDUSER_EnableGyroscope();
|
||||||
|
|
||||||
|
// Load libs
|
||||||
luaL_openlibs(L);
|
luaL_openlibs(L);
|
||||||
load_ctr_lib(L);
|
load_ctr_lib(L);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue