Homebrew Homebrew Development

MasterFeizz

Well-Known Member
Member
Joined
Oct 15, 2015
Messages
1,098
Trophies
1
Age
29
XP
3,710
Country
United States
I think I understood the difference between, parallelism and concurrency.

So there isn't an advantage, in terms of performance, when using threads, within an application, on 3ds, right(except for things like running something while waiting for VBlank)?

You can run parallel threads on the 3DS, so you can gain some speed by doing that. But running multiple threads on the same core will only help if your current single threaded implementation is idling for a significant amount of time.
 

catlover007

Developer
Developer
Joined
Oct 23, 2015
Messages
722
Trophies
1
XP
3,967
Country
Germany
really? I thought that the two cores can't work at the same time. When bringing the thread on the syscore to sleep, are there any guide lines how long it should sleep.
E.g. in 3dscraft it just does 1 Mio Nano Seconds, but that seems to be guessed, is there a safer way?
 

MasterFeizz

Well-Known Member
Member
Joined
Oct 15, 2015
Messages
1,098
Trophies
1
Age
29
XP
3,710
Country
United States
really? I thought that the two cores can't work at the same time. When bringing the thread on the syscore to sleep, are there any guide lines how long it should sleep.
E.g. in 3dscraft it just does 1 Mio Nano Seconds, but that seems to be guessed, is there a safer way?
It depends on what you are trying to achieve, you can have a thread sleep until you trigger an event or sleep a set amount of time, how to figure out that time I don't know.
 

catlover007

Developer
Developer
Joined
Oct 23, 2015
Messages
722
Trophies
1
XP
3,967
Country
Germany
While writing I solved the problem I was going to ask by myself. Because the multi threading is cooperative it's not that important how much time the os is given by sleeping, it is much more important to reguarly sleep and let the os core do it's stuff which needs as much time as it needs.

Ok, I think I'm prepared for cooperative multi threading, I'm currently working on a bigger (orginal) homebrew application and I think it would be useful to use it there. Thank you for your answers they were very useful!
 
D

Deleted User

Guest
Hi all,
I am hoping to implement basic audio support into my project, and I am seeing quite a few ways of doing it; however I am confident that I would like to go with the simple option; loading audio in the xxxxxx_raw.bin format.

My question is what is the method to converting audio in a format such as WAV to the said _raw.bin format? Is there certain tools I should be using? (Audacity, maybe?)

I'm pretty confused as to where I should be going with it. Any support is kindly appreciated.
 

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
Hi all,
I am hoping to implement basic audio support into my project, and I am seeing quite a few ways of doing it; however I am confident that I would like to go with the simple option; loading audio in the xxxxxx_raw.bin format.

My question is what is the method to converting audio in a format such as WAV to the said _raw.bin format? Is there certain tools I should be using? (Audacity, maybe?)

I'm pretty confused as to where I should be going with it. Any support is kindly appreciated.

You can export an audio track with Audacity in uncompressed raw format. It uses .aiff extension by default, but you can rename it in whatever you want. I use .raw.

If you want to load a raw aufio stream in memory without any processing, remmber to convert your audio to a mono track before exporting it.
 
  • Like
Reactions: Deleted User
D

Deleted User

Guest
You can export an audio track with Audacity in uncompressed raw format.
Thanks for the info! I think I now remember hearing about Audacity having the ability to convert to RAW format.

Do you know what encoding I should use, by any chance? Or does it depend on what flags I have set in csndPlaySound?
 

Ryuzaki_MrL

Green Thunder
Member
Joined
Jun 23, 2015
Messages
781
Trophies
0
Age
26
XP
2,046
Country
Brazil
Thanks for the info! I think I now remember hearing about Audacity having the ability to convert to RAW format.

Do you know what encoding I should use, by any chance? Or does it depend on what flags I have set in csndPlaySound?

It depends on the flags.
csnd supports 8-bit PCM, 16-bit PCM, ADPCM and PSG.
All audio files must be exported as mono track.
 
  • Like
Reactions: Deleted User
D

Deleted User

Guest
It depends on the flags.
csnd supports 8-bit PCM, 16-bit PCM, ADPCM and PSG.
All audio files must be exported as mono track.
Thanks; I was wondering what encoding types were supported.
At the moment, I have made my sound effects all mono and are being exported with 'signed 16-Bit PCM' encoding, so I am guessing that is going to be okay.
 
  • Like
Reactions: Ryuzaki_MrL
D

Deleted User

Guest
Is there currently any way to decompress rar files on the 3DS?

Maybe through zlib or something like that?
 
D

Deleted User

Guest
The same as you would on a desktop application, you will just need to cross compile it.

I apologize for being a noob, as I'm still kinda new to C, but how would one cross-compile for 3DS?

libarchive13 is already installed on my Ubuntu laptop. Putting in the appropriate header makes the compiler spit out errors. Would I have to compile and install libarchive for devkitPro? If so, how would I do that?
 

TricksterGuy

Well-Known Member
Newcomer
Joined
Jan 16, 2016
Messages
81
Trophies
0
Age
37
Location
California
XP
221
Country
United States
I apologize for being a noob, as I'm still kinda new to C, but how would one cross-compile for 3DS?

libarchive13 is already installed on my Ubuntu laptop. Putting in the appropriate header makes the compiler spit out errors. Would I have to compile and install libarchive for devkitPro? If so, how would I do that?

The same way as libpng, libjpeg, etc from installing sfillib

Seems libarchive's source is located here https://github.com/libarchive/libarchive

It has a configure.ac file so just run build/autogen.sh to generate the configure script. After that its just a matter of running configure, make, and make install

export PATH=$DEVKITARM/bin:$PATH
export CFLAGS=-march=armv6k -mtune=mpcore -mfloat-abi=hard -O3 -mword-relocations -fomit-frame-pointer -ffast-math
./configure --disable-shared --enable-static --host=arm-none-eabi --prefix=$DEVKITPRO/portlibs/armv6k --without-xml2
make
make install

If you have the source code and it uses configure then the above set of commands may work to compile it.

As for how to use the library there's always the documentation.


Heh this is proving tough to compile...

Anyway this is as far as I got after disabling pthreads in config.h (somehow it was still enabled) and removed <memory.h> include from archive_ppmd7.c

libarchive/archive_read_disk_posix.c:103:2: error: #error fchdir function required.
#error fchdir function required.
 
Last edited by TricksterGuy,
  • Like
Reactions: Deleted User
D

Deleted User

Guest
The same way as libpng, libjpeg, etc from installing sfillib

Seems libarchive's source is located here https://github.com/libarchive/libarchive

It has a configure.ac file so just run build/autogen.sh to generate the configure script. After that its just a matter of running configure, make, and make install

export PATH=$DEVKITARM/bin:$PATH
export CFLAGS=-march=armv6k -mtune=mpcore -mfloat-abi=hard -O3 -mword-relocations -fomit-frame-pointer -ffast-math
./configure --disable-shared --enable-static --host=arm-none-eabi --prefix=$DEVKITPRO/portlibs/armv6k --without-xml2
make
make install

If you have the source code and it uses configure then the above set of commands may work to compile it.

As for how to use the library there's always the documentation.


Heh this is proving tough to compile...

Anyway this is as far as I got after disabling pthreads in config.h (somehow it was still enabled) and removed <memory.h> include from archive_ppmd7.c

libarchive/archive_read_disk_posix.c:103:2: error: #error fchdir function required.
#error fchdir function required.

Tried searching for alternatives, came across this library called unrarlib: http://www.unrarlib.org/download.html

Maybe this would work?
 
Last edited by ,

TricksterGuy

Well-Known Member
Newcomer
Joined
Jan 16, 2016
Messages
81
Trophies
0
Age
37
Location
California
XP
221
Country
United States
D

Deleted User

Guest
I looked at the source code. I'd try dropping urarlib.c/h into your project and seeing if it compiles if it does great try using it. If not then see if you can fix the compile errors.

Alright, I'll try using this. Thanks again for the help!
 

catlover007

Developer
Developer
Joined
Oct 23, 2015
Messages
722
Trophies
1
XP
3,967
Country
Germany
I'm currently experimenting with 3D graphics and I faced a really wired problem. After hours I got my code to work. It renders what it should render, but some triangles flicker and move around, but only on real hardware, with Citra it works perfectly. Then I reduced the polygon count to just a cube and after seperating the projection and the modelview matrix uniform instead of multiplying them on the CPU solved the problem on real hardware.

But after changing back to the model I used before it still doesn't work. The setup with the cube and with the other model is exactly the same. I already dumped all data to files and analyzed which triangles flicker but they are valid and as metioned before it works as it should with Citra.

So what could be the problem, I don't know what to do?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BigOnYa @ BigOnYa:
    Sixteenth
  • Psionic Roshambo @ Psionic Roshambo:
    Also it was literally out of a kilo when I got it off the boat so absolutely pure
  • Psionic Roshambo @ Psionic Roshambo:
    Holy shiz that's a lot
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    I was getting 3.5 Grams for 320 could have stepped on it and doubled my money easy lol
    +1
  • BigOnYa @ BigOnYa:
    I'd be afraid to it nowdays, my heart would explode prob. I just stick beers n buds nowdays.
  • Psionic Roshambo @ Psionic Roshambo:
    I would get to drive from tarpon springs to like Miami a thousand bucks lol do that twice a week and back in 92 that was good money
  • Xdqwerty @ Xdqwerty:
    @BigOnYa,
    @Psionic Roshambo what are you guys talking about?
  • Psionic Roshambo @ Psionic Roshambo:
    Blew it on women and muscle cars lol
    +1
  • BigOnYa @ BigOnYa:
    @Xdqwerty Hamster food, its pricey nowadays to keep PCs running.
    +2
  • Psionic Roshambo @ Psionic Roshambo:
    I don't do anything except cigarettes and gotta stop eventually lol
    +1
  • BigOnYa @ BigOnYa:
    I'd do shrooms again if could find, and I was outside camping/fishing, and had a cooler full of beer.
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    I wouldn't mind some LSD, laughing until my face hurt sounds fun lol
    +1
  • BigOnYa @ BigOnYa:
    You ever try soaper powder/qauludes? I did once and like a dumbass drank beer on top of taking, I woke up laying in my backyard in the pouring rain, it knocked me out. I have not seen it around in many many years.
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    No never tried a lot of things but never that lol
  • Psionic Roshambo @ Psionic Roshambo:
    I did pass out one time on a floor after taking a bunch of Ambien lol thought it would help me sleep and did it lol
  • Psionic Roshambo @ Psionic Roshambo:
    Girlfriend was working at a pharmacy and stole like 500 of them, was and still is the biggest pill bottle I have ever seen lol
  • K3Nv2 @ K3Nv2:
    Ativan is pretty legit
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    The last time I had to take something to help me sleep, I was prescribed Trazadone it was pretty OK to be honest.
  • Psionic Roshambo @ Psionic Roshambo:
    Not something I need at all these days, doing a lot better lol
  • BigOnYa @ BigOnYa:
    That Nuka Cola video with old ice grinder is cool, I want one.
    +1
  • K3Nv2 @ K3Nv2:
    @BigOnYa, ANSWER HIS DAMN QUESTION
    +2
  • BigOnYa @ BigOnYa:
    I'm good, how r u
    BigOnYa @ BigOnYa: I'm good, how r u