Homebrew Homebrew Development

  • Thread starter Thread starter aliak11
  • Start date Start date
  • Views Views 1,475,181
  • Replies Replies 6,048
  • Likes Likes 54
How much memory do we have access to as a 3dsx or a CIA/3DS? my program keep freezing while trying load about 18 MB of music files into memory.
 
Post your code.

Code:
char* MusicBuffer[7];
unsigned int MusicSize[7];
 
static void LoadMusic(int audio);
 
//...
 
for (i = 0; i < 7; i++)
{
LoadMusic(i);
LoadingAnimation();
}
 
//...
 
void LoadMusic(int audio)
{
FILE *file;
snprintf(StringBuffer, sizeof(StringBuffer), "/3ds/Columns/data/Sounds/Music/%03d.raw\n", audio);
file = fopen(StringBuffer, "rb");
fseek(file, 0, SEEK_END);
MusicSize[audio] = ftell(file);
MusicBuffer[audio] = linearAlloc(MusicSize[audio]);
fseek(file, 0, SEEK_SET);
 
if (MusicBuffer[audio] != NULL)
{
fread(MusicBuffer[audio], 1, MusicSize[audio], file);
}
else
{
snprintf(StringBuffer, sizeof(StringBuffer), "%03d.raw failed to allocate memory!", audio);
printf(StringBuffer);
}
fclose(file);
}

Code:
 Directory of G:\3ds\Columns\data\Sounds\Music
 
05/21/2015  12:20 PM    <DIR>          .
05/21/2015  12:20 PM    <DIR>          ..
05/23/2015  10:37 PM         5,617,200 000.raw
05/23/2015  10:38 PM         4,967,736 001.raw
05/23/2015  10:39 PM         5,073,458 002.raw
05/23/2015  10:39 PM         1,208,632 003.raw
05/23/2015  10:40 PM           380,240 004.raw
05/23/2015  10:41 PM         2,231,546 005.raw
05/23/2015  10:47 PM           300,870 006.raw

I just added the NULL check and it seems track 005.raw is failing to get memory allocated.
 
You're using linearAlloc which works with a heap size defined in 3dsx_crt0.s (now in devkitARM):
Code:
__linear_heap_size:
        .word 32*1024*1024 @ Default linear heap size (32 MiB)
 
You're using linearAlloc which works with a heap size defined in 3dsx_crt0.s (now in devkitARM):
Code:
__linear_heap_size:
        .word 32*1024*1024 @ Default linear heap size (32 MiB)

I tried to use malloc but music never plays(though all the music is loaded into memory just fine). the code i looked at for csnd was using linearAlloc. i guess i could load the music into memory on demand, but i don't know what kind of lag it could introduce.
 
Does anyone know if it is possible to use the 3DS on screen keyboard in homebrew or do we need to make our own?

You need to make your own, but I remember someone made one not a long ago. You should look for "keyboard" on the homebrew forum. ATM we can't call the 3ds one.
 
Arg, I'm trying to port a certain SDL app (replacing the relevant SDL code), but I'm having a hell of a time getting the graphics displaying right... I can see the right pixels/colours trying to appear but they're massively garbled. I'm on the verge of asking for help but I also don't want to spoil the surprise...
(PS: it's not ScummVM)
 
Arg, I'm trying to port a certain SDL app (replacing the relevant SDL code), but I'm having a hell of a time getting the graphics displaying right... I can see the right pixels/colours trying to appear but they're massively garbled. I'm on the verge of asking for help but I also don't want to spoil the surprise...
(PS: it's not ScummVM)

Maybe it's because the 3DS buffer is BGR and not RGB?
 
Nah the colours are coming out right, just not in the right places :wtf: Um hard to explain, hold on...

IMG_20150527_222837.jpgIMG_20150527_222906.jpg
 
Oh hmmm not knowing how it should look it's difficult to understand... Could you post a snippet of your code?
 
That's the problem really, because it's a port most of the drawing code isn't mine, and it's spread around in a complex and confusing fashion, I'm trying to figure out how to interpret the result into what I need, or modify the process to make it work. Urgh.
 
Are you compensating for the rotated frame buffer? The bottom left corner of the screen is the start of the frame buffer.
 
Are are you writing the pixels to the texture buffer sf2dlib generates? If so, maybe after filling it you should try to run sf2d_texture_tile32(texture);
 
Yes and yes, am tiling. I've tried a few different ways, am probably still missing something obvious tho.
sf2d_texture_tile32() does a check to see if the texture has already been tiled and if so it doesn't do anything. To correctly tile your texture you have to do
texture->tiled = 0;
just before calling sf2d_texture_tile32()
 

Site & Scene News

Popular threads in this forum