Homebrew Development

Discussion in '3DS - Homebrew Development and Emulators' started by aliak11, Jan 16, 2014.

  1. Brawl345

    Brawl345 GBAtemp Advanced Fan

    Member
    8
    Jan 14, 2012
    Germany
  2. Togetoge

    Togetoge Member

    Newcomer
    1
    Sep 18, 2017
    Japan
    Is there a way to access folders containing multibyte characters in the SD card?
     
  3. ghjfdtg

    ghjfdtg GBAtemp Advanced Fan

    Member
    6
    Jul 13, 2014
    fopen() and friends takes UTF-8 strings by default. Should open folders and files with special characters in the name fine.
     
  4. Togetoge

    Togetoge Member

    Newcomer
    1
    Sep 18, 2017
    Japan
    I placed the "あ.txt" in the root of the SD card and ran the following program, but it failed.
    What was wrong?

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <3ds.h>
    
    int main(int argc, char* argv[]) {
    	
    	gfxInitDefault();
    	consoleInit(GFX_TOP, NULL);
    
    	FILE *fp;
    	fp = fopen("sdmc:/あ.txt", "r");
    
    	if( fp == NULL ) {
    		perror("error\n");
    		return 1;
    	}
    	fclose(fp);
    
    	
    	while (aptMainLoop()){
    		
    		gspWaitForVBlank();
    		gfxSwapBuffers();
    		hidScanInput();
    
    		u32 kDown = hidKeysDown();
    		if (kDown & KEY_START) break;
    		
    	}
    
    	gfxExit();
    	return 0;
    }
    
     
  5. ghjfdtg

    ghjfdtg GBAtemp Advanced Fan

    Member
    6
    Jul 13, 2014
  6. Togetoge

    Togetoge Member

    Newcomer
    1
    Sep 18, 2017
    Japan
  7. Togetoge

    Togetoge Member

    Newcomer
    1
    Sep 18, 2017
    Japan
    I wanted to use libiconv, I put -liconv in LIBS but it got an error.
    Do I need a procedure?
     
  8. Spaqin

    Spaqin GBAtemp Regular

    Member
    2
    Feb 17, 2015
    Poland
    Yo, is there any way to change the OS clock?
    3dbrew mentions RTC, but it may seem that it refers to the "real"/"raw" RTC, not the software one.

    I sometimes swap batteries and CBA to update the time on every occassion. Wanna do something dumb as NTP client.
     
  9. ry755

    ry755 GBAtemp Advanced Fan

    Member
    6
    Nov 29, 2017
    United States
    California
    Is there an example for multithreading on separate cores? I'm working on a homebrew app exclusively for the New 3DS, and I'd like to make use of the extra cores.
     
  10. ghjfdtg

    ghjfdtg GBAtemp Advanced Fan

    Member
    6
    Jul 13, 2014
  11. Aridez

    Aridez Newbie

    Newcomer
    1
    Oct 16, 2018
    Spain
    Hello! I made a separate thread but since it's not getting any answers I thought that I might try my luck in here since this seems more targeted to developers.

    I'm trying to make a homebrew application but every time it goes into sleep mode it stops working. That's because I'm making network requests using ssl.c. The function "aptSetSleepAllowed(bool allowed)" doesn't work regarding networking. It seems like at least the wifi and the screens are turned off when entering in sleep mode no matter what.

    I don't care that much about the screens but I want this applications making requests in the background. Is there any way to keep making requests even when the system 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;
    }
    Any help would be appreciated! I'm at a loss in here
     
  12. TSP184

    TSP184 Member

    Newcomer
    2
    Oct 26, 2018
    United Arab Emirates
    did Homebrew fixed hans so that we can play SSB4 correctly ?
     
  13. trainboy2019

    trainboy2019 Well-Known Member

    Member
    6
    GBAtemp Patron
    trainboy2019 is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Oct 6, 2015
    United States
    GA
    Is hans still around?
     
  14. G44Gonzalo

    G44Gonzalo Newbie

    Newcomer
    1
    Dec 24, 2018
    Spain
    I made an accoint only for this;
    I have an error compiling a 3DS project (I didn't make the proyect, i only modified it.)
    I have Windows 10.

    I don't know where i need to ask this.


    The official page of this is "htttps://gbatemp.net/threads/release-ctrrgbpatty-notification-led-changer.489129/"
    You can download to test it. I only edited the main.cpp | My edited files are in this .zip

    (Sorry bad english)
    Please help.

    What i need to do?/to fix it?

    Error:

    C:\Escritorio\CtrRBGPATTY>make
    built ... CtrRGBPATTYG44.smdh
    make[1]: *** No rule to make target 'c:/3dsBrew/CtrRBGPATTY/source/main.cpp', needed by 'main.o'. Stop.
    make: *** [Makefile:94: all] Error 2
     

    Attached Files:

  15. Manurocker95

    Manurocker95 Game Developer & Pokémon Master

    Member
    8
    May 29, 2016
    Spain
    Madrid
    Seems you have a build folder. Delete it and recompile. Do you have devkitpro installed, right?
     
  16. G44Gonzalo

    G44Gonzalo Newbie

    Newcomer
    1
    Dec 24, 2018
    Spain
    Muchisimas gracias, a lot of thanks.

    I have another error, but It seems that it is a script error.
    Well, it asks me to replace the mkdir command with the rmdir. I have no idea because I did not do the script. I hope it goes well.

    — Posts automatically merged - Please don't double post! —

    No sabia como editar los mensajes :V . Bueno mas errores. El comando MKDIR funciona en el .cia compilado por el creador original. A mi me da error ese comando mientras lo compilo y me pide que lo cambie (me pide rmdir pero ese sirve para borrar directorios según wikipedia). ¿Que debería hacer?

    ---------------------------------

    I did not know how to edit messages. xD More errors. The MKDIR command works in the .cia compiled by the original creator. To me that command gives me error in devkitpro and asks me to change it (It ask rmdir but that serves to delete directories according to wikipedia). What should I do?

    All:

    C:\Escritorio\CtrRBGPATTY>make
    main.cpp
    arm-none-eabi-g++ -MMD -MP -MF /c/Escritorio/CtrRBGPATTY/build/main.d -g -Wall -Wno-strict-aliasing -O3 -mword-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=hard -I/c/Escritorio/CtrRBGPATTY/source -I/c/Escritorio/CtrRBGPATTY/include -I/opt/devkitpro/portlibs/3ds/include -I/opt/devkitpro/libctru/include -I./lib/include -I/c/Escritorio/CtrRBGPATTY/build -DARM11 -D_3DS -std=gnu++11 -fno-rtti -fno-exceptions -c /c/Escritorio/CtrRBGPATTY/source/main.cpp -o main.o
    C:/Escritorio/CtrRBGPATTY/source/main.cpp: In function 'void writepatch(LED)':
    C:/Escritorio/CtrRBGPATTY/source/main.cpp:231:5: error: 'mkdir' was not declared in this scope
    mkdir("/luma", 0777);
    ^~~~~
    C:/Escritorio/CtrRBGPATTY/source/main.cpp:231:5: note: suggested alternative: 'rmdir'
    mkdir("/luma", 0777);
    ^~~~~
    rmdir
    make[1]: *** [/opt/devkitpro/devkitARM/base_rules:80: main.o] Error 1
    make: *** [Makefile:94: all] Error 2
     
    Last edited by G44Gonzalo, Dec 26, 2018
  17. nop90

    nop90 GBAtemp Advanced Maniac

    Member
    12
    Jan 11, 2014
    Italy
    Rome
    From the above quoted line you can see the real problem is that the compiler doesn't recognize mkdir as a function, ad it's suggesting to use rmdir because it has only one different char (such hints are useful for finding typos, but don't rely too much on them in other cases).

    To make it compile you need to include the right header (mkdir reference reports it's sys/stat.h, can't remember if with devkitARM this header is available or if you need to include something else).
     
  18. DeadlyKitten36

    DeadlyKitten36 Newbie

    Newcomer
    1
    Jan 8, 2019
    United Kingdom
    Hi, I'm trying to learn about 3DS homebrew and after going through the examples I was wondering if anyone could help with some questions I have.

    I was trying to learn about 2D rendering and I'm wondering if I can load a C2D_Sprite from pixel data and format information from memory or if I can otherwise load from the romfs (and then to memory?).
    The GPU sprite example makes use of C2D_SpriteSheet loaded from a t3x file but I'm not sure what the importance of format is?
    Do 2D texture atlases really need to be in this format? I would assume the benefits relate to 3D textures / minimizing state changes etc but maybe I'm being ignorant about that.

    Thank you for reading
    I'd appreciate any guidance
     
  19. ghjfdtg

    ghjfdtg GBAtemp Advanced Fan

    Member
    6
    Jul 13, 2014
    Use t3x. It's designed to have low overhead but still has decent compression. Don't hardcode assets in the executable because it's bad practice. It's much better converting your assets and throwing them in the RomFS.
     
  20. cynosura

    cynosura GBAtemp Regular

    Member
    2
    Jun 7, 2015
    France
    Bed
    Hi there, can someone explain me how to use pictures with Citro2D (Citro3D?), as I don't understand the devkitpro's "gpusprites" example (they use a lot of sprites here, and from what I have understood, it all goes into 1 big t3x spritesheet ?)
    Thanks to anyone who can point me the way to use pictures with Citro !
     
Quick Reply
Draft saved Draft deleted
Loading...