Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Include the most common headers from the C standard library
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- // Include the main libnx system header, for Switch development
- #include <switch.h>
- // Sysmodules should not use applet*.
- u32 __nx_applet_type = AppletType_None;
- // Adjust size as needed.
- #define INNER_HEAP_SIZE 0x80000
- size_t nx_inner_heap_size = INNER_HEAP_SIZE;
- char nx_inner_heap[INNER_HEAP_SIZE];
- void __libnx_initheap(void) {
- void* addr = nx_inner_heap;
- size_t size = nx_inner_heap_size;
- // Newlib
- extern char* fake_heap_start;
- extern char* fake_heap_end;
- fake_heap_start = (char*)addr;
- fake_heap_end = (char*)addr + size;
- }
- // Init/exit services, update as needed.
- void __attribute__((weak)) __appInit(void) {
- Result rc;
- // Initialize default services.
- rc = smInitialize();
- if (R_FAILED(rc))
- fatalSimple(MAKERESULT(Module_Libnx, LibnxError_InitFail_SM));
- //Enable this if you want to use time.
- /*rc = timeInitialize();
- if (R_FAILED(rc))
- fatalSimple(MAKERESULT(Module_Libnx, LibnxError_InitFail_Time));
- __libnx_init_time();*/
- rc = fsInitialize();
- if (R_FAILED(rc))
- fatalSimple(MAKERESULT(Module_Libnx, LibnxError_InitFail_FS));
- fsdevMountSdmc();
- }
- void __attribute__((weak)) userAppExit(void);
- void __attribute__((weak)) __appExit(void) {
- // Cleanup default services.
- fsdevUnmountAll();
- fsExit();
- //timeExit();//Enable this if you want to use time.
- smExit();
- }
- // Main program entrypoint
- int main(int argc, char* argv[]) {
- setInitialize();
- while(appletMainLoop()) {
- bool wlan;
- setsysGetFlag(73, &wlan);
- if(wlan) {
- setsysSetFlag(73, true);
- }
- svcSleepThread(1000000000L);
- }
- // Deinitialization and resources clean up code can go here.
- setExit();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement