1
0
Fork 0
mirror of https://github.com/ctruLua/ctruLua.git synced 2025-10-27 16:39:29 +00:00

ADDED THREAD ! Minor changes on other libs.

To communicate with a thread, use sockets on localhost, this should work.
Or use the return code, or the "last error", but that's crappy.
For the return code, just `return <number>`; only works with integers.
This commit is contained in:
Firew0lf 2016-01-17 12:18:39 +01:00
parent ca22cf1558
commit 499bfa99a3
6 changed files with 196 additions and 14 deletions

View file

@ -14,6 +14,8 @@ The `fs` module.
#include <lua.h>
#include <lauxlib.h>
bool isFsInitialized = false;
Handle *fsuHandle;
FS_Archive sdmcArchive;
#ifdef ROMFS
@ -211,18 +213,21 @@ int luaopen_fs_lib(lua_State *L) {
}
void load_fs_lib(lua_State *L) {
fsInit();
if (!isFsInitialized) {
fsInit();
fsuHandle = fsGetSessionHandle();
FSUSER_Initialize(*fsuHandle);
sdmcArchive = (FS_Archive){ARCHIVE_SDMC, fsMakePath(PATH_EMPTY, "")};
FSUSER_OpenArchive(&sdmcArchive);
#ifdef ROMFS
romfsArchive = (FS_Archive){ARCHIVE_ROMFS, fsMakePath(PATH_EMPTY, "")};
FSUSER_OpenArchive(&romfsArchive);
#endif
fsuHandle = fsGetSessionHandle();
FSUSER_Initialize(*fsuHandle);
sdmcArchive = (FS_Archive){ARCHIVE_SDMC, fsMakePath(PATH_EMPTY, "")};
FSUSER_OpenArchive(&sdmcArchive);
#ifdef ROMFS
romfsArchive = (FS_Archive){ARCHIVE_ROMFS, fsMakePath(PATH_EMPTY, "")};
FSUSER_OpenArchive(&romfsArchive);
#endif
isFsInitialized = true;
}
luaL_requiref(L, "ctr.fs", luaopen_fs_lib, false);
}