Homebrew Homebrew Development

Togetoge

Active Member
Newcomer
Joined
Sep 18, 2017
Messages
32
Trophies
0
Age
124
Website
github.com
XP
301
Country
Japan
fopen() and friends takes UTF-8 strings by default. Should open folders and files with special characters in the name fine.

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;
}
 

Spaqin

Well-Known Member
Member
Joined
Feb 17, 2015
Messages
123
Trophies
0
Age
29
XP
199
Country
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.
 

ry755

Well-Known Member
Member
Joined
Nov 29, 2017
Messages
535
Trophies
1
Age
20
Location
California
XP
1,497
Country
United States
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.
 

Aridez

New Member
Newbie
Joined
Oct 16, 2018
Messages
4
Trophies
0
Age
30
XP
68
Country
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
 

G44Gonzalo

New Member
Newbie
Joined
Dec 24, 2018
Messages
2
Trophies
0
Age
24
XP
53
Country
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
 

Attachments

  • CtrRBGPATTY.zip
    3 MB · Views: 125

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,790
Country
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

Seems you have a build folder. Delete it and recompile. Do you have devkitpro installed, right?
 

G44Gonzalo

New Member
Newbie
Joined
Dec 24, 2018
Messages
2
Trophies
0
Age
24
XP
53
Country
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.

--------------------- MERGED ---------------------------

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,

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,036
Country
Italy
C:/Escritorio/CtrRBGPATTY/source/main.cpp:231:5: error: 'mkdir' was not declared in this scope
mkdir("/luma", 0777);
^~~~~

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).
 

DeadlyKitten36

New Member
Newbie
Joined
Jan 8, 2019
Messages
1
Trophies
0
Age
27
XP
52
Country
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
 

ghjfdtg

Well-Known Member
Member
Joined
Jul 13, 2014
Messages
1,360
Trophies
1
XP
3,274
Country
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.
 

randomdev

Well-Known Member
Member
Joined
Jun 7, 2015
Messages
155
Trophies
0
XP
235
Country
Brazil
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 !
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    SylverReZ @ SylverReZ: https://www.youtube.com/watch?v=pnRVIC7kS4s