Homebrew Development

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

Jan 16, 2014

Homebrew Development by aliak11 at 3:25 AM (840,140 Views / 45 Likes) 5,436 replies

  1. Theon

    Newcomer Theon Newbie

    Joined:
    Dec 11, 2016
    Messages:
    4
    Country:
    Korea, North
    Oh, man. Just found out that there's a 3DS-plugin for Unity! Maybe I'll just try to learn some basics and go solo for now.
    Anyone have experience with Unity for 3DS?
     


  2. nop90

    Member nop90 GBAtemp Maniac

    Joined:
    Jan 11, 2014
    Messages:
    1,174
    Location:
    Rome
    Country:
    Italy
    Unity is supported by the official devkit, that you can download for free subscribing a Nintendo licence. But you have to accept a NDA a you can't release your project as homebrew.
     
  3. erman1337

    Member erman1337 GBAtemp Advanced Fan

    Joined:
    Sep 27, 2015
    Messages:
    928
    Country:
    Turkey
    What would stop people from releasing their Unity game anonymously? Does the exported game have some sort of identification?
     
  4. Theon

    Newcomer Theon Newbie

    Joined:
    Dec 11, 2016
    Messages:
    4
    Country:
    Korea, North


    Here's what the NDA says (the important part):

    That said, I was able to register and get instant access to all development tools by simply providing a name and a verified email address, so it would be easy to use a fake name and release your work anonymously.

    What's more, there's actually a lot of different software and tools available, and this really seems like a godsend for the homebrew community!
    (Not so much for what it can do, but for how much power and knowledge could be unlocked by homebrew people!)

    There are also devkits for sale, but they mostly seem to be normal consoles with the ability to load ROMs from flashcarts or USB (though there is mention of some debugging function).

    You homebrew wizards REALLY ought to sign in and have a look at all the stuff there!
     
  5. Theon

    Newcomer Theon Newbie

    Joined:
    Dec 11, 2016
    Messages:
    4
    Country:
    Korea, North
    Here's the debugger devkit:

    Apart from debugging, video output sounds really cool (although hardly very useful for homebrewing).

    The most interesting stuff is the vast number of software tools provided!
    Check out the two .txt files attached here to see what tools are available for download
     

    Attached Files:

  6. CuriousTommy

    Member CuriousTommy GBAtemp Fan

    Joined:
    Jul 22, 2014
    Messages:
    334
    Country:
    United States
    I apologize for the really dumb question, but I have a question about the 3ds example, in particular, the read-controls example.

    So I noticed that if statements are written like this:
    Code:
    int i;
    for (i = 0; i < 32; i++)
    {
        if (kDown & BIT(i)) printf("%s down\n", keysNames[i]);
        if (kHeld & BIT(i)) printf("%s held\n", keysNames[i]);
        if (kUp & BIT(i)) printf("%s up\n", keysNames[i]);
    }
    My question is why is there an ampersand sign in the if condition. Why wouldn't == be used instead? Also doesn't a single ampersand sign mean that the variable is passed by reference?
     
  7. nop90

    Member nop90 GBAtemp Maniac

    Joined:
    Jan 11, 2014
    Messages:
    1,174
    Location:
    Rome
    Country:
    Italy
    KeyDown is not the key for the down direction, but is avariable where every bit tells if the one of the available key swas pressed.

    KeyUp is for the released keys.

    KeyHeld is for keys pressed and not released.

    Since the code is in loop, it checks every bit and prints for ever key one of this tree events.

    Edit: & as unary operator gets the pointer to the memory location containing a variable, but as a binary operator (between two variables) performs a bit by bit logical AND
     
    Last edited by nop90, Dec 16, 2016
    CuriousTommy likes this.
  8. CuriousTommy

    Member CuriousTommy GBAtemp Fan

    Joined:
    Jul 22, 2014
    Messages:
    334
    Country:
    United States
    Is it possible to use the for_sleep function on the 3DS? I making a silly 3DS program that gives a prompt with the user pressing the button to change the amount. But the error messages disappear too fast before the user the read the message.

    Here is a link to my source code: https://gist.github.com/CuriousTommy/ff14de96428e8e503697f55c7020a366

    I make a simple version to compile for Linux and this code works fine:
    Code:
    #include <iostream>
    #include <chrono>
    #include <thread>
    
    using namespace std;
    using namespace std::this_thread;     // sleep_for, sleep_until
    using namespace std::chrono_literals; // ns, us, ms, s, h, etc.
    using std::chrono::system_clock;
    
    int main()
    {
        cout << "For five seconds" << endl;
        sleep_for(5s);
        cout << "Hello World" << endl;
        return 0;
    }
    But when applying it to my 3ds code, I get this error message...
    Code:
    docker run --user `id -u` -v $(pwd):/source -it devkitpro make
    main.cpp
    arm-none-eabi-g++ -MMD -MP -MF /source/build/main.d -g -Wall -O2 -mword-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=hard -I/source/include -I/opt/devkitpro/libctru/include -I/source/build -DARM11 -D_3DS -fno-rtti -fno-exceptions -std=gnu++11 -c /source/source/main.cpp -o main.o
    /source/source/main.cpp:8:22: error: 'this_thread' is not a namespace-name
    using namespace std::this_thread; // sleep_for, sleep_until
                          ^
    /source/source/main.cpp:8:33: error: expected namespace-name before ';' token
    using namespace std::this_thread; // sleep_for, sleep_until
                                     ^
    /source/source/main.cpp:9:22: error: 'chrono_literals' is not a namespace-name
    using namespace std::chrono_literals; // ns, us, ms, s, h, etc.
                          ^
    /source/source/main.cpp:9:37: error: expected namespace-name before ';' token
    using namespace std::chrono_literals; // ns, us, ms, s, h, etc.
                                         ^
    /source/source/main.cpp: In function 'int main(int, char**)':
    /source/source/main.cpp:55:14: error: unable to find numeric literal operator 'operator""s'
        sleep_for(2s);
                  ^
    /source/source/main.cpp:55:16: error: 'sleep_for' was not declared in this scope
        sleep_for(2s);
                    ^
    /opt/devkitpro/devkitARM/base_rules:79: recipe for target 'main.o' failed
    make[1]: *** [main.o] Error 1
    Makefile:126: recipe for target 'build' failed
    make: *** [build] Error 2
    
    Does anyone know what I am doing wrong?
     
    Last edited by CuriousTommy, Dec 18, 2016
  9. GalladeGuy

    Member GalladeGuy Freeze Kirby :3

    Joined:
    Oct 28, 2015
    Messages:
    2,474
    Country:
    United States
    This_thread and chrono_literals don't exist, sleep_for is undefined, and there should be no "s" after the number of seconds.
     
  10. CuriousTommy

    Member CuriousTommy GBAtemp Fan

    Joined:
    Jul 22, 2014
    Messages:
    334
    Country:
    United States
    At first, I had that error when I didn't include chrono and thread header in my Linux test source code, but once I added that, the problem was fixed. However, even when I included chrono and thread in the header for the 3ds source code, I still have the same error message.

    The reason why I did that was because the example on stackoverflow did that (used ns instead of s) and it does work (at least the Linux example compiled fine with there being an s)
     
  11. B_E_P_I_S_M_A_N

    Member B_E_P_I_S_M_A_N I can see you, even through the sunglasses

    Joined:
    Jun 7, 2016
    Messages:
    343
    Location:
    Sixth Circle of Hell
    Country:
    Antarctica
    Use svcSleepThread(). It's in <3ds.h>. Here's an example: https://github.com/TheKingy34/arm11loaderhax/blob/master/source/main.c
     
    CuriousTommy likes this.
  12. Verequies

    Newcomer Verequies Newbie

    Joined:
    Oct 14, 2014
    Messages:
    4
    Country:
    Australia
    Hey Guys,

    Having a bit of trouble here. I'm trying to modify FBI to add a few functions, however on compilation I get the following error:
    Code:
    source/ui/section/update.c:16:32: fatal error: builtin_rootca_der.h: No such file or directory
    I understand why that error is coming up, however I'm not sure how to add the build options to FBI's Makefile so that it automatically builds and includes the 'builtin_rootca_der.h' & 'builtin_rootca.der.o' for 'data/builtin_rootca.der'.
     
    Last edited by Verequies, Dec 19, 2016
  13. elhobbs

    Member elhobbs GBAtemp Advanced Fan

    Joined:
    Jul 28, 2008
    Messages:
    694
    Country:
    United States
    You need to add a bin2o rule in the makefile to convert files in the data directory. Or you could just add the file to the romfs directory and read it from there instead.
     
  14. B_E_P_I_S_M_A_N

    Member B_E_P_I_S_M_A_N I can see you, even through the sunglasses

    Joined:
    Jun 7, 2016
    Messages:
    343
    Location:
    Sixth Circle of Hell
    Country:
    Antarctica
    Lately, I've been trying to use ctrulib's wrappers for the ssl:c service. I tried writing a program that would send and HTTPS request to a certain website, in order to learn how the service works. The code is below:

    Code:
    Handle sslcHandle;
    
            char *endpoint = "https://www.somewebsite.com";
            char *message  = "GET https://www.somewebsite.com/api HTTP/1.0\r\n\r\nAuthorization: auth";
           
            sslcContext ctx;
            Result res;
            int sockfd;
           
            int retval;
            u32 out;
           
            char *response;
           
            printf("Getting ssl:c handle...\n");
           
            sslcInit(sslcHandle);
           
            printf("Handle obtained.\n");
           
            sockfd = socket(AF_INET, SOCK_STREAM, 0);
           
            printf("Socket created.\n");
           
            res = sslcCreateContext(&ctx, &sockfd, 0, endpoint);
            printf("SSL Context created.\n");
           
            res = sslcStartConnection(&ctx, retval, out);
            printf("Connection started.\n");
           
            printf(out);
           
            res = sslcWrite(&ctx, message, sizeof(message));
            printf("Writing...\n");
           
            res = sslcRead(&ctx, out, 1024, false);
            printf("Reading...\n");
           
            printf("Output: ");
            printf(out);
            printf("\n");
           
            res = sslcDestroyContext(&ctx);
            printf("Context destroyed.\n");
           
            close(sockfd);
            printf("Socket closed.\n");
    
    This code runs without crashing the 3DS, but it returns no output. I assume that the problem lies in how I read/write data to/from the server, though I could be missing something else. Keep in mind, I'm fairly new to socketing, so I'm still pretty new to the protocol. Am I using the service correctly? Is there anything I'm doing incorrectly/missing?
     
  15. Verequies

    Newcomer Verequies Newbie

    Joined:
    Oct 14, 2014
    Messages:
    4
    Country:
    Australia
    Could you give an example of how I would add this to the 'buildtools/make_base'? I tried this from the examples:
    Code:
    %.der.o:%.der
        @echo $(notdir $<)
        @$(bin2o)
    
    However the compiler just ignored it.
     
  16. elhobbs

    Member elhobbs GBAtemp Advanced Fan

    Joined:
    Jul 28, 2008
    Messages:
    694
    Country:
    United States
    You need to add the data directory. I think you might be able to add it to SOURCE_DIRS
     
  17. Verequies

    Newcomer Verequies Newbie

    Joined:
    Oct 14, 2014
    Messages:
    4
    Country:
    Australia
    Okay so I've moved the data folder to 'source/data' and modified BUILD_FILTER & OBJECT_FILES like so:
    Code:
    # TARGET SETUP #
    
        BUILT_FILTER := $(patsubst %.v.pica,$(BUILD_DIR)/%.shbin.o,$(BUILD_FILTER)) \
            $(patsubst %.shlist,$(BUILD_DIR)/%.shbin.o,$(BUILD_FILTER)) \
            $(patsubst %.der,$(BUILD_DIR)/%.der.o,$(BUILD_FILTER)) \
    
        OBJECT_FILES := $(foreach dir,$(SOURCE_DIRS), \
                $(patsubst %.v.pica,$(BUILD_DIR)/%.shbin.o,$(call rwildcard,$(dir),*.v.pica)) \
                $(patsubst %.shlist,$(BUILD_DIR)/%.shbin.o,$(call rwildcard,$(dir),*.shlist)) \
                $(patsubst %.der,$(BUILD_DIR)/%.der.o,$(call rwildcard,$(dir),*.der)) \
            ) $(OBJECT_FILES)
    
    Also moved the %.der build options to:
    Code:
    # TARGET RULES #
    
    $(BUILD_DIR)/%.der.o: %.der
        @echo $@
        @$(bin2o)
    
    When compiling it shows that it is building it 'build/source/data/builtin_rootca.der.o' however nothing is actually built.
     
    Last edited by Verequies, Dec 20, 2016
  18. LinkKenedy

    Newcomer LinkKenedy Member

    Joined:
    Feb 14, 2015
    Messages:
    49
    Country:
    France
    Help, i follow all instructions for setup my enviorement on a OSx and when write make in a terminal, this returns that -->

    Makefile:6: *** "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM". Stop.
     
  19. CuriousTommy

    Member CuriousTommy GBAtemp Fan

    Joined:
    Jul 22, 2014
    Messages:
    334
    Country:
    United States
    Can you post a link to the instructions?

    But it seems like you didn't set up your environment properly.
     
    Last edited by CuriousTommy, Dec 22, 2016
  20. MasterFeizz

    Member MasterFeizz GBAtemp Advanced Fan

    Joined:
    Oct 15, 2015
    Messages:
    849
    Country:
    United States
    The makefile is giving you the error and telling you the solution.
     

Share This Page