Homebrew Homebrew Development

zombigrn

Well-Known Member
Newcomer
Joined
Jan 20, 2016
Messages
64
Trophies
0
Age
33
XP
96
Country
United States
Noob here, are there any tutorials using builds as example? I see there is also programming via lua possible on the 3ds as well. Is lua a good place to start?
 

ShinobuMeahera

New Member
Newbie
Joined
Jan 9, 2017
Messages
4
Trophies
0
Age
29
XP
52
Country
Poland
Can 3ds connect to wifi even if it doesn't have internet connection? (i mean using homebrew luncher)
I need to connect 3ds to ESP8266 and recive/send info.
Is it even possible?
I did connected to wifi network without internet using nintendo browser and some http server on my phone, but that is all.
 

CuriousTommy

Well-Known Member
Member
Joined
Jul 22, 2014
Messages
524
Trophies
0
Age
27
XP
647
Country
United States
I see there is also programming via lua possible on the 3ds as well. Is lua a good place to start?

It probably would be better to learn C or C++. Most 3DS code is in C. There might be certain things that you can't do in Lua that you can do in C or C++. Plus C (or C++) is more supported with other libraries than Lua.

Noob here, are there any tutorials using builds as example?
There is a guide on 3dbrew.
 

zombigrn

Well-Known Member
Newcomer
Joined
Jan 20, 2016
Messages
64
Trophies
0
Age
33
XP
96
Country
United States
It probably would be better to learn C or C++. Most 3DS code is in C. There might be certain things that you can't do in Lua that you can do in C or C++. Plus C (or C++) is more supported with other libraries than Lua.


There is a guide on 3dbrew.
Nice. Thanks for the info, going to have to do a lot of reading on programming in c.
Wish I could just use game maker's drag and drop lol
 

OctoNezd

*insert some funny quote here*
Member
Joined
Aug 11, 2016
Messages
234
Trophies
0
Location
Moscow
XP
219
Country
Russia
How do I download file? I tried everything, here is mine current code(server is currently down):
Code:
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <inttypes.h>

#include <3ds.h>

Result http_download(httpcContext *context)//This error handling needs updated with proper text printing once ctrulib itself supports that.
{
    Result ret=0;
    u8* framebuf_top;
    u32 statuscode=0;
    u32 size=0, contentsize=0;
    u8 *buf;

    ret = httpcBeginRequest(context);
    if(ret!=0)return ret;

    ret = httpcGetResponseStatusCode(context, &statuscode, 0);
    if(ret!=0)return ret;

    if(statuscode!=200)return -2;

    ret=httpcGetDownloadSizeState(context, NULL, &contentsize);
    if(ret!=0)return ret;

    printf("size: %"PRId32"\n",contentsize);
    gfxFlushBuffers();

    buf = (u8*)malloc(contentsize);
    //if(buf==NULL)return -1;
    ret = httpcDownloadData(context, buf, contentsize, NULL);
    return buf;
}

int main()
{
    Result ret=0;
    httpcContext context;
    FILE* file1 = fopen("test1.txt","wb");
    FILE* file2 = fopen("test2.txt","w");
    gfxInitDefault();
    httpcInit();

    consoleInit(GFX_BOTTOM,NULL);

    //Change this to your own URL.
    char *url = "http://194.87.95.146/test.txt";

    printf("Downloading %s\n",url);
    gfxFlushBuffers();

    ret = httpcOpenContext(&context, url, 1);
    printf("return from httpcOpenContext: %"PRId32"\n",ret);
    gfxFlushBuffers();

    if(ret==0)
    {
        ret=http_download(&context);
        printf("http_download %\n"PRId32, ret);
        printf("writing test1...");
        fprintf(file1, "%",ret);
        fclose(file1);
        printf("done\n");
        printf("writing test2...");
        fprintf(file2, "%s",ret);
        fclose(file2);
        printf("done\n");
        printf("validating test1...");
        FILE* file = fopen("test1.txt", "r");
        char* valid;
        fgets(valid,255,file);
        if (valid == "12345"){
            printf(":)\n");
        }
        else{
            printf(":(\n");
        }
        fclose(file);
        FILE* file1 = fopen("test2.txt", "r");
        char* valid1;
        fgets(valid1,255,file1);
        if (valid1 == "12345"){
            printf(":)\n");
        }
        else{
            printf(":(\n");
        }
        fclose(file1);
        printf("%s:%s", valid, valid1);
        gfxFlushBuffers();
        httpcCloseContext(&context);
    }

    // Main loop
    while (aptMainLoop())
    {
        gspWaitForVBlank();
        hidScanInput();

        // Your code goes here

        u32 kDown = hidKeysDown();
        if (kDown & KEY_START)
            break; // break in order to return to hbmenu

        // Flush and swap framebuffers
        gfxFlushBuffers();
        gfxSwapBuffers();
    }

    // Exit services
    httpcExit();
    gfxExit();
    return 0;
}
 

GabeCello

New Member
Newbie
Joined
Jan 16, 2017
Messages
1
Trophies
0
Age
27
XP
41
Country
Uruguay
I'm really new to homebrew development and I've been following this tutorial, and I'm kind of having trouble getting my program to run properly
I'm at part 1.3, the application is supposed to launch, print "Hello world!", wait 10 seconds, then close, which my 3DS sort of does
The problem is though, that the "Hello world!" text is missing a big bunch of its pixels to the point where it's practically unreadable
What could be causing this?

Here's a picture I whipped up in Paint: (left is what should be coming out, right is what is actually being printed out)
mMebWqf.png
 

Sengoh

New Member
Newbie
Joined
Jan 20, 2017
Messages
1
Trophies
0
Age
25
XP
47
Country
Norway
So I've recently started learning C++, and managed to make some simple programs that display text and use button inputs. Right now I'm trying to make a program with an interface, and using the GUI Template as reference (although my code is pretty much just copy-paste from it at the moment). However, I get error when trying to use sftd. It builds fine, but when trying to launch the .3dsx with Citra, I get an endless error and it doesn't display the text. It does show texture, colors and rectangles from sf2d though. If try to run it on my 3ds, I just get a black screen and I have to turn it off. If I remove the sftd codes, I don't get any error, and it runs fine on both Citra and 3ds. I get the same errors after building the GUI Template, while the premade .3dsx runs fine. I feel like it has to be my libraries or something. Any ideas? I have download link to my project (my code may be a little messy). I’m using Visual Studio.
Not sure if I'm supposed to make a new thread or not, so I posted it here.
BGsNBEb.png

Download
 

Slimfr01

Active Member
Newcomer
Joined
Mar 10, 2016
Messages
29
Trophies
0
Age
37
XP
98
Country
France
Hello,
I have an issue for using Threads on a homebrew app.
When a create a new thread, with a loop in it, every other threads frooze ( including system ones ).

I create the thread with this :

Code:
ThreadFunc nfcEntry;
nfcEntry = (*nfcLoop)();

NFCThread = threadCreate(nfcEntry,0,1000,63,0,1);

( the complete file is availble here : https://github.com/Slimfr01/amiibo-Collection/blob/master/source/main.cpp )

Does anyone know how to fix the issue ?
Thank you.
 

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
Hello,
I have an issue for using Threads on a homebrew app.
When a create a new thread, with a loop in it, every other threads frooze ( including system ones ).

I create the thread with this :

Code:
ThreadFunc nfcEntry;
nfcEntry = (*nfcLoop)();

NFCThread = threadCreate(nfcEntry,0,1000,63,0,1);

( the complete file is availble here : https://github.com/Slimfr01/amiibo-Collection/blob/master/source/main.cpp )

Does anyone know how to fix the issue ?
Thank you.

3ds isn't really multithread: every thread has a priority and when higher priority threads are sleeping the first one eith lower priority can run, so use svcSleepThread(nanoseconds) in every thread loop. It's to you to calculate ne nanoseconds every thread has to sleep at every loop.
 

Slimfr01

Active Member
Newcomer
Joined
Mar 10, 2016
Messages
29
Trophies
0
Age
37
XP
98
Country
France
3ds isn't really multithread: every thread has a priority and when higher priority threads are sleeping the first one eith lower priority can run, so use svcSleepThread(nanoseconds) in every thread loop. It's to you to calculate ne nanoseconds every thread has to sleep at every loop.

Thank's but apparently there is a problem elsewhere too. When I create a Thread, regardless of the priority ( 0x18 or 0x3F ) and the sleeping time ( even at 10 seconds ), system threads ( including home button and off button ) and the main application thread doesn't seem to respond during the sleep time.
 
Last edited by Slimfr01,

Canzah

Well-Known Member
Member
Joined
Jul 8, 2012
Messages
492
Trophies
0
XP
1,410
Country
United Kingdom
I'm having a problem compiling SNES9x, supposedly due to changes implemented in ctrulib 1.2.0 that came out few days ago.

Problem is that the devkitpro has also been update alongside it and now it's impossible to compile ctrulib 1.1.0 and there's only source available on the git https://github.com/smealum/ctrulib/releases

Could anyone provide me with compiled binaries of ctrulib 1.1.0?
 

Manurocker95

Game Developer & Pokémon Master
Member
Joined
May 29, 2016
Messages
1,511
Trophies
0
Age
29
Location
Madrid
Website
manuelrodriguezmatesanz.com
XP
2,791
Country
Spain
Yo! I'm having troubles with sftd as I dunno why.

First I'm loading a font using
Code:
sftd_font* font = sftd_load_font_file(<Path to the .ttf>);

But whenever I want to draw a text with sftd_draw_text, it simply does nothing (Except slowing soooo much the program). In Citra I can see the error message Failed to get a handle for file, so what kind of fonts can I use, as it seems it cannot use .ttf? Or how do I do it? :(
 

cheuble

squid
Member
Joined
Feb 6, 2016
Messages
746
Trophies
0
Age
22
Location
Fourside
XP
1,308
Country
France
Yo! I'm having troubles with sftd as I dunno why.

First I'm loading a font using
Code:
sftd_font* font = sftd_load_font_file(<Path to the .ttf>);

But whenever I want to draw a text with sftd_draw_text, it simply does nothing (Except slowing soooo much the program). In Citra I can see the error message Failed to get a handle for file, so what kind of fonts can I use, as it seems it cannot use .ttf? Or how do I do it? :(
Looks like I'm not the only one who noticed the issue. There seems to be a problem while loading the file from the SD Card. The conflict comes from the newest ctrulib. I found a quick fix for this: load the font file from a buffer.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Bunjolio @ Bunjolio:
    dune 2 popcorn bucket
  • SylverReZ @ SylverReZ:
    Many schools use some form of firewall or protection, to prevent certain types of content from being viewable.
  • SylverReZ @ SylverReZ:
    @Bunjolio, And that haha
  • Bunjolio @ Bunjolio:
    our school blocks stuff but allows some stuff, its annoying, they legit can see our screens if they want
  • AncientBoi @ AncientBoi:
    Nah. That popcorns got sand in it :(
  • SylverReZ @ SylverReZ:
    There was a time where we were able to bypass the school's network using a VPN that wasn't blocked on the radar. Can't exactly remember the name, but I was able to watch YouTube.
  • Bunjolio @ Bunjolio:
    I used to go on proxy sites but I'm too lazy and it isn't worth it
    +1
  • SylverReZ @ SylverReZ:
    @Bunjolio, Proxy sites, not very effective.
  • Bunjolio @ Bunjolio:
    if ur on a Chromebook and cant change jack about the laptop that's what I gotta use
  • SylverReZ @ SylverReZ:
    One of the sites that weren't blocked on the school's network was some file uploading sites. I would upload some games, write down the URL and take it to school one day.
  • Bunjolio @ Bunjolio:
    lol
  • SylverReZ @ SylverReZ:
    I did it when the teachers werent looking ofc. I even managed to take in a USB stick that wasn't allowed.
  • Bunjolio @ Bunjolio:
    my school has a chrome extension called light speed filter agent and it legit blocks YouTube pfps since the file cdn(I think aka yt3.ggpht.com) is classed as mature
  • Bunjolio @ Bunjolio:
    mhm
  • Bunjolio @ Bunjolio:
    they have other stuff like goguardian too
  • SylverReZ @ SylverReZ:
    Ours mainly relied on the router, I believe.
  • Bunjolio @ Bunjolio:
    our school network and chrome policies block stuff too
  • Bunjolio @ Bunjolio:
    alot of yt to mp3 sites are blocked by light speed for "Security"
  • SylverReZ @ SylverReZ:
    It was easy to bypass some of the restrictions, as one of the admins left a registry key in the administrative shares drive, which allowed me to get around the blocking of some sites.
  • Bunjolio @ Bunjolio:
    tf does tta mean
  • Bunjolio @ Bunjolio:
    yeah this is chrome os
  • Bunjolio @ Bunjolio:
    cant do shit
  • SylverReZ @ SylverReZ:
    @Bunjolio, Wdym 'TTA'?
  • Bunjolio @ Bunjolio:
    that* as in why yt to mp3 sites are blocked for security
    Bunjolio @ Bunjolio: that* as in why yt to mp3 sites are blocked for security