diff --git a/libs/sf2dlib/libsf2d/Makefile b/libs/sf2dlib/libsf2d/Makefile index a035946..14e1112 100644 --- a/libs/sf2dlib/libsf2d/Makefile +++ b/libs/sf2dlib/libsf2d/Makefile @@ -30,6 +30,10 @@ CFLAGS := -g -Wall -O2\ $(ARCH) CFLAGS += $(INCLUDE) -DARM11 -D_3DS + +#WILL HAVE TO BE REMOVED SOON +CFLAGS += -DLIBCTRU_NO_DEPRECATION + CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions ASFLAGS := -g $(ARCH) diff --git a/libs/sf2dlib/libsf2d/source/sf2d.c b/libs/sf2dlib/libsf2d/source/sf2d.c index 52e5309..be9e4aa 100644 --- a/libs/sf2dlib/libsf2d/source/sf2d.c +++ b/libs/sf2dlib/libsf2d/source/sf2d.c @@ -35,7 +35,7 @@ static float ortho_matrix_bot[4*4]; //Apt hook cookie static aptHookCookie apt_hook_cookie; //Functions -static void apt_hook_func(int hook, void* param); +static void apt_hook_func(APT_HookType hook, void *param); static void reset_gpu_apt_resume(); int sf2d_init() @@ -87,7 +87,7 @@ int sf2d_init_advanced(int gpucmd_size, int temppool_size) cur_side = GFX_LEFT; GPUCMD_Finalize(); - GPUCMD_FlushAndRun(NULL); + GPUCMD_FlushAndRun(); gspWaitForP3D(); sf2d_pool_reset(); @@ -144,8 +144,8 @@ void sf2d_start_frame(gfxScreen_t screen, gfx3dSide_t side) } else { screen_w = 320; } - GPU_SetViewport((u32 *)osConvertVirtToPhys((u32)gpu_depth_fb_addr), - (u32 *)osConvertVirtToPhys((u32)gpu_fb_addr), + GPU_SetViewport((u32 *)osConvertVirtToPhys(gpu_depth_fb_addr), + (u32 *)osConvertVirtToPhys(gpu_fb_addr), 0, 0, 240, screen_w); GPU_DepthMap(-1.0f, 0.0f); @@ -154,8 +154,8 @@ void sf2d_start_frame(gfxScreen_t screen, gfx3dSide_t side) GPU_SetStencilOp(GPU_STENCIL_KEEP, GPU_STENCIL_KEEP, GPU_STENCIL_KEEP); GPU_SetBlendingColor(0,0,0,0); GPU_SetDepthTestAndWriteMask(true, GPU_GEQUAL, GPU_WRITE_ALL); - GPUCMD_AddMaskedWrite(GPUREG_0062, 0x1, 0); - GPUCMD_AddWrite(GPUREG_0118, 0); + GPUCMD_AddMaskedWrite(GPUREG_EARLYDEPTH_TEST1, 0x1, 0); + GPUCMD_AddWrite(GPUREG_EARLYDEPTH_TEST2, 0); GPU_SetAlphaBlending( GPU_BLEND_ADD, @@ -177,23 +177,23 @@ void sf2d_end_frame() { GPU_FinishDrawing(); GPUCMD_Finalize(); - GPUCMD_FlushAndRun(NULL); + GPUCMD_FlushAndRun(); gspWaitForP3D(); //Copy the GPU rendered FB to the screen FB if (cur_screen == GFX_TOP) { - GX_SetDisplayTransfer(NULL, gpu_fb_addr, GX_BUFFER_DIM(240, 400), + GX_DisplayTransfer(gpu_fb_addr, GX_BUFFER_DIM(240, 400), (u32 *)gfxGetFramebuffer(GFX_TOP, cur_side, NULL, NULL), GX_BUFFER_DIM(240, 400), 0x1000); } else { - GX_SetDisplayTransfer(NULL, gpu_fb_addr, GX_BUFFER_DIM(240, 320), + GX_DisplayTransfer(gpu_fb_addr, GX_BUFFER_DIM(240, 320), (u32 *)gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL), GX_BUFFER_DIM(240, 320), 0x1000); } gspWaitForPPF(); //Clear the screen - GX_SetMemoryFill(NULL, + GX_MemoryFill( gpu_fb_addr, clear_color, &gpu_fb_addr[240*400], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH, gpu_depth_fb_addr, 0, &gpu_depth_fb_addr[240*400], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH); gspWaitForPSC0(); @@ -203,7 +203,7 @@ void sf2d_swapbuffers() { gfxSwapBuffersGpu(); if (vblank_wait) { - gspWaitForEvent(GSPEVENT_VBlank0, false); + gspWaitForEvent(GSPGPU_EVENT_VBlank0, false); } //Calculate FPS frames++; @@ -289,7 +289,7 @@ gfx3dSide_t sf2d_get_current_side() return cur_side; } -static void apt_hook_func(int hook, void* param) +static void apt_hook_func(APT_HookType hook, void *param) { if (hook == APTHOOK_ONRESTORE) { reset_gpu_apt_resume(); @@ -308,6 +308,6 @@ static void reset_gpu_apt_resume() } GPUCMD_Finalize(); - GPUCMD_FlushAndRun(NULL); + GPUCMD_FlushAndRun(); gspWaitForP3D(); } diff --git a/libs/sf2dlib/libsf2d/source/sf2d_draw.c b/libs/sf2dlib/libsf2d/source/sf2d_draw.c index d84966b..28ef34b 100644 --- a/libs/sf2dlib/libsf2d/source/sf2d_draw.c +++ b/libs/sf2dlib/libsf2d/source/sf2d_draw.c @@ -29,7 +29,7 @@ void sf2d_draw_line(int x0, int y0, int x1, int y1, u32 color) GPU_SetAttributeBuffers( 2, // number of attributes - (u32*)osConvertVirtToPhys((u32)vertices), + (u32*)osConvertVirtToPhys(vertices), GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | GPU_ATTRIBFMT(1, 4, GPU_UNSIGNED_BYTE), 0xFFFC, //0b1100 0x10, @@ -69,7 +69,7 @@ void sf2d_draw_rectangle(int x, int y, int w, int h, u32 color) GPU_SetAttributeBuffers( 2, // number of attributes - (u32*)osConvertVirtToPhys((u32)vertices), + (u32*)osConvertVirtToPhys(vertices), GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | GPU_ATTRIBFMT(1, 4, GPU_UNSIGNED_BYTE), 0xFFFC, //0b1100 0x10, @@ -122,7 +122,7 @@ void sf2d_draw_rectangle_rotate(int x, int y, int w, int h, u32 color, float rad GPU_SetAttributeBuffers( 2, // number of attributes - (u32*)osConvertVirtToPhys((u32)vertices), + (u32*)osConvertVirtToPhys(vertices), GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | GPU_ATTRIBFMT(1, 4, GPU_UNSIGNED_BYTE), 0xFFFC, //0b1100 0x10, @@ -177,7 +177,7 @@ void sf2d_draw_fill_circle(int x, int y, int radius, u32 color) GPU_SetAttributeBuffers( 2, // number of attributes - (u32*)osConvertVirtToPhys((u32)vertices), + (u32*)osConvertVirtToPhys(vertices), GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | GPU_ATTRIBFMT(1, 4, GPU_UNSIGNED_BYTE), 0xFFFC, //0b1100 0x10, diff --git a/libs/sf2dlib/libsf2d/source/sf2d_texture.c b/libs/sf2dlib/libsf2d/source/sf2d_texture.c index 9918953..df314a9 100644 --- a/libs/sf2dlib/libsf2d/source/sf2d_texture.c +++ b/libs/sf2dlib/libsf2d/source/sf2d_texture.c @@ -83,7 +83,7 @@ sf2d_texture *sf2d_create_texture(int width, int height, sf2d_texfmt pixel_forma texture->data = data; if (place == SF2D_PLACE_VRAM) { - GX_SetMemoryFill(NULL, texture->data, 0x00000000, (u32*)&((u8*)texture->data)[texture->data_size], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH, + GX_MemoryFill(texture->data, 0x00000000, (u32*)&((u8*)texture->data)[texture->data_size], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH, NULL, 0x00000000, NULL, 0); gspWaitForPSC0(); } else { @@ -146,7 +146,7 @@ void sf2d_bind_texture(const sf2d_texture *texture, GPU_TEXUNIT unit) GPU_SetTexture( unit, - (u32 *)osConvertVirtToPhys((u32)texture->data), + (u32 *)osConvertVirtToPhys(texture->data), texture->pow2_w, texture->pow2_h, texture->params, @@ -170,7 +170,7 @@ void sf2d_bind_texture_color(const sf2d_texture *texture, GPU_TEXUNIT unit, u32 GPU_SetTexture( unit, - (u32 *)osConvertVirtToPhys((u32)texture->data), + (u32 *)osConvertVirtToPhys(texture->data), texture->pow2_w, texture->pow2_h, texture->params, @@ -194,7 +194,7 @@ void sf2d_bind_texture_parameters(const sf2d_texture *texture, GPU_TEXUNIT unit, GPU_SetTexture( unit, - (u32 *)osConvertVirtToPhys((u32)texture->data), + (u32 *)osConvertVirtToPhys(texture->data), texture->pow2_w, texture->pow2_h, params, @@ -235,7 +235,7 @@ static inline void sf2d_draw_texture_generic(const sf2d_texture *texture, int x, GPU_SetAttributeBuffers( 2, // number of attributes - (u32*)osConvertVirtToPhys((u32)vertices), + (u32*)osConvertVirtToPhys(vertices), GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | GPU_ATTRIBFMT(1, 2, GPU_FLOAT), 0xFFFC, //0b1100 0x10, @@ -304,7 +304,7 @@ static inline void sf2d_draw_texture_rotate_hotspot_generic(const sf2d_texture * GPU_SetAttributeBuffers( 2, // number of attributes - (u32*)osConvertVirtToPhys((u32)vertices), + (u32*)osConvertVirtToPhys(vertices), GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | GPU_ATTRIBFMT(1, 2, GPU_FLOAT), 0xFFFC, //0b1100 0x10, @@ -366,7 +366,7 @@ static inline void sf2d_draw_texture_part_generic(const sf2d_texture *texture, i GPU_SetAttributeBuffers( 2, // number of attributes - (u32*)osConvertVirtToPhys((u32)vertices), + (u32*)osConvertVirtToPhys(vertices), GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | GPU_ATTRIBFMT(1, 2, GPU_FLOAT), 0xFFFC, //0b1100 0x10, @@ -414,7 +414,7 @@ static inline void sf2d_draw_texture_scale_generic(const sf2d_texture *texture, GPU_SetAttributeBuffers( 2, // number of attributes - (u32*)osConvertVirtToPhys((u32)vertices), + (u32*)osConvertVirtToPhys(vertices), GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | GPU_ATTRIBFMT(1, 2, GPU_FLOAT), 0xFFFC, //0b1100 0x10, @@ -464,7 +464,7 @@ static inline void sf2d_draw_texture_part_scale_generic(const sf2d_texture *text GPU_SetAttributeBuffers( 2, // number of attributes - (u32*)osConvertVirtToPhys((u32)vertices), + (u32*)osConvertVirtToPhys(vertices), GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | GPU_ATTRIBFMT(1, 2, GPU_FLOAT), 0xFFFC, //0b1100 0x10, @@ -524,7 +524,7 @@ static inline void sf2d_draw_texture_part_rotate_scale_generic(const sf2d_textur GPU_SetAttributeBuffers( 2, // number of attributes - (u32*)osConvertVirtToPhys((u32)vertices), + (u32*)osConvertVirtToPhys(vertices), GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | GPU_ATTRIBFMT(1, 2, GPU_FLOAT), 0xFFFC, //0b1100 0x10, @@ -573,7 +573,7 @@ static inline void sf2d_draw_texture_depth_generic(const sf2d_texture *texture, GPU_SetAttributeBuffers( 2, // number of attributes - (u32*)osConvertVirtToPhys((u32)vertices), + (u32*)osConvertVirtToPhys(vertices), GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | GPU_ATTRIBFMT(1, 2, GPU_FLOAT), 0xFFFC, //0b1100 0x10, @@ -618,7 +618,7 @@ void sf2d_draw_quad_uv(const sf2d_texture *texture, float left, float top, float GPU_SetAttributeBuffers( 2, // number of attributes - (u32*)osConvertVirtToPhys((u32)vertices), + (u32*)osConvertVirtToPhys(vertices), GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | GPU_ATTRIBFMT(1, 2, GPU_FLOAT), 0xFFFC, //0b1100 0x10, diff --git a/libs/sftdlib/libsftd/source/texture_atlas.c b/libs/sftdlib/libsftd/source/texture_atlas.c index 58f433d..03320c5 100644 --- a/libs/sftdlib/libsftd/source/texture_atlas.c +++ b/libs/sftdlib/libsftd/source/texture_atlas.c @@ -63,7 +63,7 @@ int texture_atlas_insert(texture_atlas *atlas, unsigned int character, const voi } } - GSPGPU_FlushDataCache(NULL, atlas->tex->data, atlas->tex->data_size); + GSPGPU_FlushDataCache(atlas->tex->data, atlas->tex->data_size); return 1; } diff --git a/source/cam.c b/source/cam.c index afa9009..961d26f 100644 --- a/source/cam.c +++ b/source/cam.c @@ -585,10 +585,6 @@ struct { char *name; int value; } cam_constants[] = { */ {"WHITE_BALANCE_7000K", WHITE_BALANCE_7000K}, /*** - @field WHITE_BALANCE_MAX - */ - {"WHITE_BALANCE_MAX", WHITE_BALANCE_MAX }, - /*** @field WHITE_BALANCE_TUNGSTEN */ {"WHITE_BALANCE_TUNGSTEN", WHITE_BALANCE_TUNGSTEN }, diff --git a/source/cfgu.c b/source/cfgu.c index 57829d0..4c4fb74 100644 --- a/source/cfgu.c +++ b/source/cfgu.c @@ -19,7 +19,7 @@ Initialize the CFGU module. @function init */ static int cfgu_init(lua_State *L) { - initCfgu(); + cfguInit(); return 0; } @@ -29,7 +29,7 @@ Disable the CFGU module. @function shutdown */ static int cfgu_shutdown(lua_State *L) { - exitCfgu(); + cfguExit(); return 0; } diff --git a/source/fs.c b/source/fs.c index 684570b..6d367cb 100644 --- a/source/fs.c +++ b/source/fs.c @@ -15,9 +15,9 @@ The `fs` module. #include Handle *fsuHandle; -FS_archive sdmcArchive; +FS_Archive sdmcArchive; #ifdef ROMFS -FS_archive romfsArchive; +FS_Archive romfsArchive; #endif /*** @@ -73,9 +73,9 @@ static int fs_list(lua_State *L) { // Get default archive #ifdef ROMFS - FS_archive archive = romfsArchive; + FS_Archive archive = romfsArchive; #else - FS_archive archive = sdmcArchive; + FS_Archive archive = sdmcArchive; #endif // Archive path override (and skip path prefix) if (strncmp(path, "sdmc:", 5) == 0) { @@ -88,14 +88,14 @@ static int fs_list(lua_State *L) { #endif } - FS_path dirPath = FS_makePath(PATH_CHAR, path); + FS_Path dirPath = fsMakePath(PATH_ASCII, path); Handle dirHandle; - FSUSER_OpenDirectory(fsuHandle, &dirHandle, archive, dirPath); + FSUSER_OpenDirectory(&dirHandle, archive, dirPath); u32 entriesRead = 0; do { - FS_dirent buffer; + FS_DirectoryEntry buffer; FSDIR_Read(dirHandle, &entriesRead, 1, &buffer); @@ -113,13 +113,13 @@ static int fs_list(lua_State *L) { lua_setfield(L, -2, "shortName"); lua_pushstring(L, (const char *)buffer.shortExt); lua_setfield(L, -2, "shortExt"); - lua_pushboolean(L, buffer.isDirectory); + lua_pushboolean(L, buffer.attributes&FS_ATTRIBUTE_DIRECTORY); lua_setfield(L, -2, "isDirectory"); - lua_pushboolean(L, buffer.isHidden); + lua_pushboolean(L, buffer.attributes&FS_ATTRIBUTE_HIDDEN); lua_setfield(L, -2, "isHidden"); - lua_pushboolean(L, buffer.isArchive); + lua_pushboolean(L, buffer.attributes&FS_ATTRIBUTE_ARCHIVE); lua_setfield(L, -2, "isArchive"); - lua_pushboolean(L, buffer.isReadOnly); + lua_pushboolean(L, buffer.attributes&FS_ATTRIBUTE_READ_ONLY); lua_setfield(L, -2, "isReadOnly"); lua_pushinteger(L, buffer.fileSize); lua_setfield(L, -2, "fileSize"); @@ -214,22 +214,22 @@ void load_fs_lib(lua_State *L) { fsInit(); fsuHandle = fsGetSessionHandle(); - FSUSER_Initialize(fsuHandle); + FSUSER_Initialize(*fsuHandle); - sdmcArchive = (FS_archive){ARCH_SDMC, FS_makePath(PATH_EMPTY, "")}; - FSUSER_OpenArchive(fsuHandle, &sdmcArchive); + sdmcArchive = (FS_Archive){ARCHIVE_SDMC, fsMakePath(PATH_EMPTY, "")}; + FSUSER_OpenArchive(&sdmcArchive); #ifdef ROMFS - romfsArchive = (FS_archive){ARCH_ROMFS, FS_makePath(PATH_EMPTY, "")}; - FSUSER_OpenArchive(fsuHandle, &romfsArchive); + romfsArchive = (FS_Archive){ARCHIVE_ROMFS, fsMakePath(PATH_EMPTY, "")}; + FSUSER_OpenArchive(&romfsArchive); #endif luaL_requiref(L, "ctr.fs", luaopen_fs_lib, false); } void unload_fs_lib(lua_State *L) { - FSUSER_CloseArchive(fsuHandle, &sdmcArchive); + FSUSER_CloseArchive(&sdmcArchive); #ifdef ROMFS - FSUSER_CloseArchive(fsuHandle, &romfsArchive); + FSUSER_CloseArchive(&romfsArchive); #endif fsExit(); diff --git a/source/gfx.c b/source/gfx.c index b984027..aa64956 100644 --- a/source/gfx.c +++ b/source/gfx.c @@ -9,7 +9,7 @@ The `gfx` module. #include #include <3ds/vram.h> -#include <3ds/services/gsp.h> +//#include <3ds/services/gsp.h> #include #include diff --git a/source/hid.c b/source/hid.c index 6d54b20..141f49d 100644 --- a/source/hid.c +++ b/source/hid.c @@ -51,7 +51,7 @@ Keys states */ // Key list based on hid.h from the ctrulib by smealum -struct { PAD_KEY key; char *name; } hid_keys_name[] = { +struct { u32 key; char *name; } hid_keys_name[] = { { KEY_A , "a" }, { KEY_B , "b" }, { KEY_SELECT , "select" }, @@ -117,7 +117,7 @@ static int hid_keys(lua_State *L) { lua_newtable(L); // up table for (int i = 0; hid_keys_name[i].key; i++) { - PAD_KEY key = hid_keys_name[i].key; + u32 key = hid_keys_name[i].key; char *name = hid_keys_name[i].name; if (kDown & key) { diff --git a/source/ir.c b/source/ir.c index 705091b..5c5864e 100644 --- a/source/ir.c +++ b/source/ir.c @@ -10,8 +10,7 @@ The `ir` module. #include #include -u32 bufferSize = 0; -u32 *buffer; +#include /*** Bitrate codes list (this is not a part of the module, just a reference) @@ -38,19 +37,11 @@ Bitrate codes list (this is not a part of the module, just a reference) Initialize the IR module. @function init @tparam[opt=6] number bitrate bitrate of the IR module (more informations below) -@tparam[opt=2048] number buffer size of the buffer, in bytes (max 2048) */ static int ir_init(lua_State *L) { u8 bitrate = luaL_optinteger(L, 1, 6); - bufferSize = luaL_optinteger(L, 2, 2048); //default: 2Kio - if (bufferSize > 2048) { - lua_pushboolean(L, false); - lua_pushstring(L, "the buffer can't be larger than 2048 bytes."); - return 2; - } - buffer = linearAlloc(bufferSize); - Result ret = IRU_Initialize(buffer, bufferSize); + Result ret = IRU_Initialize(); if (ret) { lua_pushboolean(L, false); lua_pushinteger(L, ret); @@ -88,37 +79,41 @@ static int ir_send(lua_State *L) { u8 *data = (u8*)luaL_checkstring(L, 1); u32 wait = lua_toboolean(L, 2); - Result ret = IRU_SendData(data, sizeof(data), wait); + Result ret = IRU_StartSendTransfer(data, strlen((const char*)data)); + if (wait) + IRU_WaitSendTransfer(); + if (ret) { lua_pushboolean(L, false); lua_pushinteger(L, ret); return 2; } - return 0; + lua_pushboolean(L, true); + return 1; } /*** Receive some data from the IR module. @function receive -@tparam[opt=buffer size] number size bytes to receive +@tparam number size bytes to receive @tparam[opt=false] boolean wait wait until the data is received @return string data */ static int ir_receive(lua_State *L) { - u32 size = luaL_optinteger(L, 1, bufferSize); + u32 size = luaL_checkinteger(L, 1); u32 wait = lua_toboolean(L, 2); u8 *data = 0; - u32 *transfercount = 0; + u32 transfercount = 0; - Result ret = IRU_RecvData(data, size, 0x00, transfercount, wait); + Result ret = iruRecvData(data, size, 0x00, &transfercount, wait); if (ret) { lua_pushboolean(L, false); lua_pushinteger(L, ret); return 2; } - lua_pushstring(L, (const char *)data); + lua_pushlstring(L, (const char *)data, (size_t)transfercount); return 1; } diff --git a/source/news.c b/source/news.c index 20f78d8..d20b61b 100644 --- a/source/news.c +++ b/source/news.c @@ -47,7 +47,7 @@ static int news_notification(lua_State *L) { titleLength = (u32) utf8_to_utf16((uint16_t*)cTitle, (uint8_t*)title, strlen(title)); messageLength = (u32) utf8_to_utf16((uint16_t*)cMessage, (uint8_t*)message, strlen(message)); - NEWSU_AddNotification(cTitle, titleLength, cMessage, messageLength, imageData, imageDataLength, jpeg); + NEWS_AddNotification(cTitle, titleLength, cMessage, messageLength, imageData, imageDataLength, jpeg); return 0; } diff --git a/source/ptm.c b/source/ptm.c index 79099bd..8a902e9 100644 --- a/source/ptm.c +++ b/source/ptm.c @@ -4,19 +4,18 @@ The `ptm` module. @usage local ptm = require("ctr.ptm") */ #include <3ds/types.h> -#include <3ds/services/ptm.h> +#include <3ds/services/ptmu.h> +#include <3ds/services/ptmsysm.h> #include #include -static Handle *ptmHandle; - /*** Initialize the PTM module. @function init */ static int ptm_init(lua_State *L) { - ptmInit(); + ptmuInit(); ptmSysmInit(); return 0; @@ -27,7 +26,7 @@ Disable the PTM module. @function shutdown */ static int ptm_shutdown(lua_State *L) { - ptmExit(); + ptmuExit(); ptmSysmExit(); return 0; @@ -40,7 +39,7 @@ Return the shell state. */ static int ptm_getShellState(lua_State *L) { u8 out = 0; - PTMU_GetShellState(ptmHandle, &out); + PTMU_GetShellState(&out); lua_pushinteger(L, out); @@ -54,7 +53,7 @@ Return the battery level. */ static int ptm_getBatteryLevel(lua_State *L) { u8 out = 0; - PTMU_GetBatteryLevel(ptmHandle, &out); + PTMU_GetBatteryLevel(&out); lua_pushinteger(L, out); @@ -68,7 +67,7 @@ Return whether or not the battery is charging. */ static int ptm_getBatteryChargeState(lua_State *L) { u8 out = 0; - PTMU_GetBatteryChargeState(ptmHandle, &out); + PTMU_GetBatteryChargeState(&out); lua_pushboolean(L, out); @@ -82,7 +81,7 @@ Return whether or not the pedometer is counting. */ static int ptm_getPedometerState(lua_State *L) { u8 out = 0; - PTMU_GetPedometerState(ptmHandle, &out); + PTMU_GetPedometerState(&out); lua_pushboolean(L, out); @@ -96,7 +95,7 @@ Return the total steps taken with the system. */ static int ptm_getTotalStepCount(lua_State *L) { u32 steps = 0; - PTMU_GetTotalStepCount(ptmHandle, &steps); + PTMU_GetTotalStepCount(&steps); lua_pushinteger(L, steps); diff --git a/source/qtm.c b/source/qtm.c index 2e31cf3..6ad02e3 100644 --- a/source/qtm.c +++ b/source/qtm.c @@ -14,7 +14,7 @@ The `qtm` module, for headtracking. New3ds only. #include typedef struct { - qtmHeadtrackingInfo *info; + QTM_HeadTrackingInfo *info; } qtm_userdata; static const struct luaL_Reg qtm_methods[]; @@ -66,7 +66,7 @@ static int qtm_getHeadtrackingInfo(lua_State *L) { qtm_userdata *data = lua_newuserdata(L, sizeof(*data)); luaL_getmetatable(L, "LQTM"); lua_setmetatable(L, -2); - Result ret = qtmGetHeadtrackingInfo(0, data->info); + Result ret = QTM_GetHeadTrackingInfo(0, data->info); if (ret) { lua_pushnil(L); return 1; diff --git a/source/socket.c b/source/socket.c index 4183284..c4eef76 100644 --- a/source/socket.c +++ b/source/socket.c @@ -25,7 +25,7 @@ The UDP part is only without connection. typedef struct { int socket; struct sockaddr_in addr; - struct hostent *host; // only user for client sockets + struct hostent *host; // only used for client sockets } socket_userdata; /*** @@ -35,7 +35,7 @@ Initialize the socket module */ static int socket_init(lua_State *L) { u32 size = luaL_optinteger(L, 1, 0x100000); - Result ret = SOC_Initialize((u32*)memalign(0x1000, size), size); + Result ret = socInit((u32*)memalign(0x1000, size), size); if (ret) { lua_pushboolean(L, false); @@ -52,7 +52,7 @@ Disable the socket module. Must be called before exiting ctrµLua. @function shutdown */ static int socket_shutdown(lua_State *L) { - SOC_Shutdown(); + socExit(); return 0; }