Homebrew Homebrew Development

NCDyson

Hello Boys...
Member
Joined
Nov 9, 2009
Messages
278
Trophies
1
XP
319
Country
United States
._.
Yes... I got that much.
The various tutorials that mention Netbeans specifically just assume you are on Linux or already have it configured.
What I don't understand is how to configure the Netbeans IDE (I am used to eclipse) to see DevkitARM and Python 3.


Open up Netbeans, go to Tools > Options > C/C++.
There will be a list on the left side, (Mine had Cygwin and Cygwin_4.x).
Click the Add button.
In the dialog that pops up, click the browse button next to Base Directory.
Browse to you devkitpro/devkitarm/bin folder and select Open.
In the Tool collection Family, select "GNU Cygwin"
name your Tool Collection Name whatever you want, I used "devkitARM"
Hit Ok.

Back on the C/C++ options page, your new tool collection should be selected in the list.
On the right hand side, you'll have to manually browse and set the complier/linkers. Mine are set as:

Code:
C Compiler: C:\devkitPro\devkitARM\bin\arm-none-eabi-gcc-4.8.2.exe
C++ Compiler: C:\devkitPro\devkitARM\bin\arm-none-eabi-g++.exe
Fortran Compiler:
Assembler: C:\devkitPro\devkitARM\bin\arm-none-eabi-as.exe
Make Command: c:\devkitPro\msys\bin\make.exe
Debugger Command: C:\devkitPro\devkitARM\bin\arm-none-eabi-gdb.exe
QMake Command:
CMake Command:

In the Code Assistance tab, make sure your tool collection is selected then add in the include directories for devkitarm. I set mine up a while ago, so I'm not sure if I took the shotgun approach or what, but I had
Code:
C Compiler :
C:\devkitPro\devkitARM\arm-none-eabi\include\c++\4.8.2
C:\devkitPro\devkitARM\lib\gcc\arm-none-eabi\4.8.2\include-fixed
C:\devkitPro\devkitARM\arm-none-eabi\include
C:\devkitPro\libctru\include
 
C++ Compiler:
C:\devkitPro\devkitARM\arm-none-eabi\include\c++\4.8.2
C:\devkitPro\devkitARM\arm-none-eabi\include\c++\4.8.2\arm-none-eabi
C:\devkitPro\devkitARM\arm-none-eabi\include\c++\4.8.2\backward
C:\devkitPro\devkitARM\lib\gcc\arm-none-eabi\4.8.2\include
C:\devkitPro\devkitARM\lib\gcc\arm-none-eabi\4.8.2\include-fixed
C:\devkitPro\devkitARM\include
C:\devkitPro\libctru\include

Again, those may or may not be correct, I think I just went for the shotgun approach.

Then, I went to File > New Project and selected "C/C++ Project with Existing Sources"
I selected my a 3ds project template and let it do it's thing.
This is where I'm stuck.
Make returns the error:
Code:
c:/3ds/3dstemp/Makefile:146: *** target pattern contains no '%'.  Stop.

I'm sure there's something I'm missing, but I haven't figured it out yet after hours of googling.
The project will still build from the command line, but code completion is...iffy at best. For some reason it refuses to find to the ctrulib includes.
 
  • Like
Reactions: jonthedit and Cyan

yodamerlin

Bok bok.
Member
Joined
Apr 1, 2014
Messages
322
Trophies
0
XP
1,050
Country
United Kingdom
I got the X and Y values the wrong way around (because of the screen being flipped) so if I change the drawPixel code to swap the X and Y, will this fix it.
 

Rinnegatamante

Well-Known Member
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,857
Country
Italy
So this is what I decided to try. I went down to the bare bones of what I believe I need for the sound. It's just the filesystem read and the CSND functions to play the file. It still freezes, but I only get one error in the terminal, and that's the fact that "ret" is an unused variable.

Code:
#include <string.h>
 
#include <3ds.h>
 
u8* audiobuf;
 
int main()
{
    // Initialize services
    srvInit();
    aptInit();
    hidInit(NULL);
    gfxInit();
    fsInit();
    //gfxSet3D(true); // uncomment if using stereoscopic 3D
 
 
    u64 size;
    u32 magic, samplerate = 44100, bytesRead, jump, chunk=0x00000000;
    u32 pos = 16;
    const char *file_tbo = "/canary.wav";
    Handle fileHandle;
 
    //Open wav file
    FS_archive sdmcArchive=(FS_archive){ARCH_SDMC, (FS_path){PATH_EMPTY, 1, (u8*)""}};
    FS_path filePath=FS_makePath(PATH_CHAR, file_tbo);
    Result ret=FSUSER_OpenFileDirectly(NULL, &fileHandle, sdmcArchive, filePath, FS_OPEN_READ, FS_ATTRIBUTE_NONE);
    FSFILE_Read(fileHandle, &bytesRead, 0, &magic, 4);
    if (magic == 0x46464952){
        while (chunk != 0x61746164){
            FSFILE_Read(fileHandle, &bytesRead, pos, &jump, 4);
            pos=pos+jump;
            FSFILE_Read(fileHandle, &bytesRead, pos, &chunk, 4);
            pos=pos+4;
        }
        FSFILE_GetSize(fileHandle, &size);
        u8* audiobuf = (u8*)linearAlloc(size-(pos+4));
        FSFILE_Read(fileHandle, &bytesRead, 24, &samplerate, 4);
        FSFILE_Read(fileHandle, &bytesRead, pos+4, audiobuf, size-(pos+4));
    }
    FSFILE_Close(fileHandle);
 
    // 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
 
        //Start wav file
        CSND_initialize(NULL);
        CSND_playsound(0x8, CSND_LOOP_DISABLE, CSND_ENCODING_PCM16, samplerate, (u32*)audiobuf, NULL, size-(pos+4), 2, 0);
   
        // Flush and swap framebuffers
        gfxFlushBuffers();
        gfxSwapBuffers();
    }
    linearFree(audiobuf);
    CSND_shutdown();
    svcCloseHandle(fileHandle);
    // Exit services
    fsExit();
    gfxExit();
    hidExit();
    aptExit();
    srvExit();
    return 0;
}

There is a difference between a warning (which depends on what command you give to your compiler, if you give a -wall -Pedantic for example you get many more warnings then passing only -wall .) and an error (with an error you cannot compile your code.).

Code:
//Start wav file
 
        CSND_initialize(NULL);
 
        CSND_playsound(0x8, CSND_LOOP_DISABLE, CSND_ENCODING_PCM16, samplerate, (u32*)audiobuf, NULL, size-(pos+4), 2, 0);

You putted this code in the main cycle. If you try to initialize for a second time without shutdowning first the CSND system, ninjhax will crash. (And playsound also must be used only one time.).
 

Agent Moose

Well-Known Member
Member
Joined
Dec 6, 2014
Messages
407
Trophies
0
Age
33
XP
552
Country
United States
Aaaaaand it still freezes. I moved the CSND_Initialized function to the top and did an if statement around the playsound. I'm about to just scratch this idea. (I also feel like I'm annoying you with this, to be honest). :P

Code:
#include <string.h>

#include <3ds.h>

u8* audiobuf;

int main()
{
    // Initialize services
    srvInit();
    aptInit();
    hidInit(NULL);
    gfxInit();
    fsInit();
    CSND_initialize(NULL);
    //gfxSet3D(true); // uncomment if using stereoscopic 3D
    
    
    u64 size;
    u32 magic, samplerate = 44100, bytesRead, jump, chunk=0x00000000;
    u32 pos = 16;
    const char *file_tbo = "/canary.wav";
    Handle fileHandle;
    
    //Open wav file
    FS_archive sdmcArchive=(FS_archive){ARCH_SDMC, (FS_path){PATH_EMPTY, 1, (u8*)""}};
    FS_path filePath=FS_makePath(PATH_CHAR, file_tbo);
    Result ret=FSUSER_OpenFileDirectly(NULL, &fileHandle, sdmcArchive, filePath, FS_OPEN_READ, FS_ATTRIBUTE_NONE);
    FSFILE_Read(fileHandle, &bytesRead, 0, &magic, 4);
    if (magic == 0x46464952){
        while (chunk != 0x61746164){
            FSFILE_Read(fileHandle, &bytesRead, pos, &jump, 4);
            pos=pos+jump;
            FSFILE_Read(fileHandle, &bytesRead, pos, &chunk, 4);
            pos=pos+4;
        }
        FSFILE_GetSize(fileHandle, &size);
        audiobuf = (u8*)linearAlloc(size-(pos+4));
        FSFILE_Read(fileHandle, &bytesRead, 24, &samplerate, 4);
        FSFILE_Read(fileHandle, &bytesRead, pos+4, audiobuf, size-(pos+4));
    }
    FSFILE_Close(fileHandle);

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

        u32 kDown = hidKeysDown();
        if (kDown & KEY_START){
            break;
        };
        
        //Start wav file
        if(hidKeysUp() & KEY_A){
            CSND_playsound(0x8, CSND_LOOP_DISABLE, CSND_ENCODING_PCM16, samplerate, (u32*)audiobuf, NULL, size-(pos+4), 2, 0);
        };
        
        // Flush and swap framebuffers
        gfxFlushBuffers();
        gfxSwapBuffers();
    }
    linearFree(audiobuf);
    CSND_shutdown();
    svcCloseHandle(fileHandle);
    // Exit services
    fsExit();
    gfxExit();
    hidExit();
    aptExit();
    srvExit();
    return 0;
}
 

Agent Moose

Well-Known Member
Member
Joined
Dec 6, 2014
Messages
407
Trophies
0
Age
33
XP
552
Country
United States
yep. I've got the canary.wav file right on the root of my SD card, and I am running it through cubic ninja with no gateway. I don't have the money to spend on a flash cart :P

I just did an update on ctrulib (All I needed to do was just download the zip from smeal's github and replace the old ctrulib folder with the one I got from the zip, correct?) and it still does the same thing (freezes)
 

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
46
Location
Engine room, learning
XP
15,662
Country
France
Why 3DS has swap X and Y axis?
Is it named X and Y internally in the console? in SDK?

I think the coordinates are managed by the used libraries, here libctru? which is defining the GFX functions, and sending data to registers.
Couldn't the libctru used the "X" in all horizontal references of the registers instead or naming it "X" first, "Y" second?
or is it based on the origin? bottom left is the origin so vertical is considered X?

It's more complicated ?
 

Rinnegatamante

Well-Known Member
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,857
Country
Italy
yep. I've got the canary.wav file right on the root of my SD card, and I am running it through cubic ninja with no gateway. I don't have the money to spend on a flash cart :P

I just did an update on ctrulib (All I needed to do was just download the zip from smeal's github and replace the old ctrulib folder with the one I got from the zip, correct?) and it still does the same thing (freezes)

It's strange that your code freezes :/ Try to take this: http://rinnegatamante.netsons.org/wav_test.rar
Name your wav as "blood.wav" and put it in SD root. When you start lpp according to the script (i used the wav sample from my repo ( https://github.com/Rinnegatamante/lpp-3ds/blob/master/source/samples/wav.lua ) ) your wav have to be opened at hb startup and you can stop it and resume it with B button.
Tell me if it freezes or not.
 

Agent Moose

Well-Known Member
Member
Joined
Dec 6, 2014
Messages
407
Trophies
0
Age
33
XP
552
Country
United States
It's strange that your code freezes :/ Try to take this: http://rinnegatamante.netsons.org/wav_test.rar
Name your wav as "blood.wav" and put it in SD root. When you start lpp according to the script (i used the wav sample from my repo ( https://github.com/Rinnegatamante/lpp-3ds/blob/master/source/samples/wav.lua ) ) your wav have to be opened at hb startup and you can stop it and resume it with B button.
Tell me if it freezes or not.
Well, there's something not liking me. I tested your code and it froze me. It has to do with the audio though. I accidently put in an .mp3 (I was testing different .wav's to see if that could of been the issue) and it said there was an error since it wasn't a .wav.

So yeah...I just think my 3DS hates homebrew with sound. :(
 

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
I just did an update on ctrulib (All I needed to do was just download the zip from smeal's github and replace the old ctrulib folder with the one I got from the zip, correct?) and it still does the same thing (freezes)

just to check you are not missing the last step: you have to delete the old "lib" and "build" directory (or use "make clean") and compile again the sources with the "make" command after copying the new source file.
 

Rinnegatamante

Well-Known Member
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,857
Country
Italy
Well, there's something not liking me. I tested your code and it froze me. It has to do with the audio though. I accidently put in an .mp3 (I was testing different .wav's to see if that could of been the issue) and it said there was an error since it wasn't a .wav.

So yeah...I just think my 3DS hates homebrew with sound. :(

Can you upload me the wav you're trying to reproduce? (Are you sure the wav is mono?)
 

ichichfly

Well-Known Member
Member
Joined
Sep 23, 2009
Messages
619
Trophies
1
XP
1,076
Country
Gambia, The
Someone knows how Gyroscope works with libctru? I tried to print values returned from a simple reading but i get variable values also when i'm not moving the 3DS (the range of the values is between -XX and XXX values.)
after you have called hidInit try
try HIDUSER_EnableGyroscope(); and than hidGyroRead

offtopic: what is you avatar form I thought I remember here
 

ichichfly

Well-Known Member
Member
Joined
Sep 23, 2009
Messages
619
Trophies
1
XP
1,076
Country
Gambia, The
I done my test as you said but i get variable values every millisecond :/ Has someone tested them?

P.S. It's Gasai Yuno from Mirai Nikki.
no sorry

PS call dumps form 3dmoo (CN) (the grafic is not working but the API calls should be correct)

GetIPCHandles
EnableAccelerometer
the strange thing is it dose not call EnableGyroscope only EnableAccelerometer
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • SylverReZ @ SylverReZ:
    @mthrnite, Cheetah Girls, the sequel to Action 52's Cheetah Men.
    +2
  • Psionic Roshambo @ Psionic Roshambo:
    Pokemon Black I played that one a lot
  • K3Nv2 @ K3Nv2:
    Honestly never messed with Pokémon on ds much
  • mthrnite @ mthrnite:
    I played pokemon once, was bored, never tried again
  • Psionic Roshambo @ Psionic Roshambo:
    Oh Dragon Quest IX
  • K3Nv2 @ K3Nv2:
    Spent like 5 hours on switch one never touched it again
  • Psionic Roshambo @ Psionic Roshambo:
    Sentinel of the stary skies
  • K3Nv2 @ K3Nv2:
    Ds is 20 years old this year
  • Psionic Roshambo @ Psionic Roshambo:
    So MJ no longer wants to play with it?
  • K3Nv2 @ K3Nv2:
    He put it down when the 3ds came out
  • SylverReZ @ SylverReZ:
    @K3Nv2, RIP Felix does great videos on the PS3 yellow-light-of-death.
  • Jayro @ Jayro:
    Eventhough the New 3DS XL is more powerful, I still feel like the DS Lite was a more polished system. It's a real shame that it never got an XL variant keeping the GBA slot. You'd have to go on AliExpress and buy an ML shell to give a DS phat the unofficial "DS Lite" treatment, and that's the best we'll ever get I'm afraid.
    +1
  • Jayro @ Jayro:
    The phat model had amazingly loud speakers tho.
    +1
  • SylverReZ @ SylverReZ:
    @Jayro, I don't see whats so special about the DS ML, its just a DS lite in a phat shell. At least the phat model had louder speakers, whereas the lite has a much better screen.
    +1
  • SylverReZ @ SylverReZ:
    They probably said "Hey, why not we combine the two together and make a 'new' DS to sell".
  • Veho @ Veho:
    It's a DS Lite in a slightly bigger DS Lite shell.
    +1
  • Veho @ Veho:
    It's not a Nintendo / iQue official product, it's a 3rd party custom.
    +1
  • Veho @ Veho:
    Nothing special about it other than it's more comfortable than the Lite
    for people with beefy hands.
    +1
  • Jayro @ Jayro:
    I have yaoi anime hands, very lorge but slender.
  • Jayro @ Jayro:
    I'm Slenderman.
  • Veho @ Veho:
    I have hands.
    Veho @ Veho: +1