TEMPORARY MODE ENABLED
New posts, edits, and any changes will not be saved during the transition period.
Registrations are temporarily disabled until the migration is complete.

  1. Aridez

    OP Aridez Newbie
    Newcomer

    Joined:
    Oct 16, 2018
    Messages:
    4
    Country:
    Spain
    I'm trying to make a homebrew application but it seems to crash every time it goes into sleep mode, I guess that is because I'm making network requests using sslc so I would like to disable sleep mode altogether.

    I've found the function "void aptSetSleepAllowed(bool allowed)" in libctru here:

    github. com/smealum/ctrulib/blob/master/libctru/source/services/apt.c
    (sorry I can't post links yet)

    But it doesn't seem to be working.

    Is is possible to disable sleep mode? Is it possible to turn off the screens too? If so, are there any examples?

    Thanks!
     
    Last edited by Aridez, Oct 17, 2018
  2. StuntHacks

    StuntHacks Member
    Newcomer

    Joined:
    Jan 19, 2017
    Messages:
    46
    Country:
    Austria
    `aptSetSleepAllowed` should work. Can you show your code, please?
     
  3. Aridez

    OP Aridez Newbie
    Newcomer

    Joined:
    Oct 16, 2018
    Messages:
    4
    Country:
    Spain
    It seems like at least the wifi and the screens are turned off when entering in sleep mode, I'm not sure about the rest of things but I'm guessing that everything goes to sleep. I found an open issue but it's been there for 2 years already and is not answered:

    github . com/smealum/ctrulib/issues/286

    I made a repo with my code at:

    github . com/Aridez/sslc_example_3ds

    There I try to simplify the code I'm using, it presents the same problem, when put to sleep it first says "failed to created the socket" and then "socinit failed" the rest of iterations so it seems like the wifi module stops. This is the main loop (there's a space in the url because I can't post links yet):

    Code:
    #include "request.h"
    
    int main()
    {
        gfxInitDefault();
        consoleInit(GFX_TOP, NULL);
    
        printf("Press B to exit\n");
        while (aptMainLoop())
        {
            gspWaitForVBlank();
            hidScanInput();
    
            u32 kDown = hidKeysDown();
            if (kDown & KEY_B)
                break; // break in order to return to hbmenu
            if (kDown & KEY_START) {
                aptInit();
                aptSetSleepAllowed(false);
                aptExit();
            }
    
    
            printf("Request Start\n");
            Request* request = new_Request("GET", "yls8.mtheall. com", "/testpage", "limit=1");
            char* out = malloc(sizeof(char)*2048);
            if (network_request(request, out)) {
                printf("%s\n", out);
                printf("Request Done\n");
            } else {
                printf("Request failed\n");
            }
            printf("Allowed to sleep: %d\n", aptIsSleepAllowed());
            destroy_Request(request);
            free(out);
            svcSleepThread(2000000000);
    
            // Flush and swap framebuffers
            gfxFlushBuffers();
            gfxSwapBuffers();
        }
    
        gfxExit();
        return 0;
    }
     
    Last edited by Aridez, Oct 17, 2018
Draft saved Draft deleted
Loading...

Hide similar threads Similar threads with keywords - possible, disable, libctru