
Uhm, yes please!
It is weird though. I load up my homebrew that has all the text and what not, and even when I remove the sound stuff, it now crashes. I guess something updated and something I am using is outdated? Anyway, I'll try to do it from scratch and see where the problem is.
Edit: Also, would you happen to know how to convert wav files to bin? I've been googling and I can't seem to find a way to do it. I figured it would be a lot easier to do my idea for a homebrew with .bin files instead of using wav files loaded from the SD.
And that worked perfectly after I figured out how big the header is ^^ (Normally 44 bytes, but it can be different)the .bin file is just the data segment of the .wav file.
just cut that segment (minus the header) into a new file with a hex editor and that should be fine.
u8 *Ab4 = linearAlloc(piano_Ab4_bin_size);
u8 *A4 = linearAlloc(piano_A4_bin_size);
u8 *Bb4 = linearAlloc(piano_Bb4_bin_size);
u8 *B4 = linearAlloc(piano_B4_bin_size);
u8 *C4 = linearAlloc(piano_C4_bin_size);
int a, b, c, d, e;
for (a=0;a<piano_Ab4_bin_size;a++){
memcpy(&Ab4[a], &piano_Ab4_bin[a], 1);
}
for (b=0;b<piano_A4_bin_size;b++){
memcpy(&A4[b], &piano_A4_bin[b], 1);
}
for (c=0;c<piano_Bb4_bin_size;c++){
memcpy(&Bb4[c], &piano_Bb4_bin[c], 1);
}
for (d=0;d<piano_B4_bin_size;d++){
memcpy(&B4[d], &piano_B4_bin[d], 1);
}
for (e=0;e<piano_C4_bin_size;e++){
memcpy(&C4[e], &piano_C4_bin[e], 1);
}

And that worked perfectly after I figured out how big the header is ^^ (Normally 44 bytes, but it can be different)
Now, I love having condensed code. I have a code that I know that can be condenced more, I'm just not sure how to do it. If this was Javascript I would do it easily, buuuttt it's not. I was thinking about either using Array's or functions so that I can easily add more lines if need be.
Code:u8 *Ab4 = linearAlloc(piano_Ab4_bin_size); u8 *A4 = linearAlloc(piano_A4_bin_size); u8 *Bb4 = linearAlloc(piano_Bb4_bin_size); u8 *B4 = linearAlloc(piano_B4_bin_size); u8 *C4 = linearAlloc(piano_C4_bin_size); int a, b, c, d, e; for (a=0;a<piano_Ab4_bin_size;a++){ memcpy(&Ab4[a], &piano_Ab4_bin[a], 1); } for (b=0;b<piano_A4_bin_size;b++){ memcpy(&A4[b], &piano_A4_bin[b], 1); } for (c=0;c<piano_Bb4_bin_size;c++){ memcpy(&Bb4[c], &piano_Bb4_bin[c], 1); } for (d=0;d<piano_B4_bin_size;d++){ memcpy(&B4[d], &piano_B4_bin[d], 1); } for (e=0;e<piano_C4_bin_size;e++){ memcpy(&C4[e], &piano_C4_bin[e], 1); }
u32 pos = 16;
while (chunk != 0x61746164){
FSFILE_Read(fileHandle, &bytesRead, pos, &jump, 4);
pos=pos+4+jump;
FSFILE_Read(fileHandle, &bytesRead, pos, &chunk, 4);
pos=pos+4;
}

3dscraft has a python script to convert png files to the proper block encoded format - texconv.pyI looked at GFX example, and it's using textures.
How are created the textures? which tools are used to convert it?
Can I paint models with plain color instead of texturing them?
Thank you![]()


void UpdateScreens(){
if(BGLoaded){
memcpy( tflb, imgbuf, 240*400*3);
}
gfxFlushBuffers();
gfxSwapBuffers();
gspWaitForVBlank();
}
Forgive the double post, I'm trying to simple place an image on the screen, from what I understand, images are drawn to the back buffer then need to be swapped.
I'm calling this function every frame in an attempt to redraw the screen, but I'm getting flickering as if the image is only drawn to the buffer once and is switching between the image and a blank screen each frame.
Code:void UpdateScreens(){ if(BGLoaded){ memcpy( tflb, imgbuf, 240*400*3); } gfxFlushBuffers(); gfxSwapBuffers(); gspWaitForVBlank(); }
Am I going about this the right way?

if tflb is your top screen's framebuffer, and your image is 240x400 and encoded in BGR binary, so yeah, you're doing things well.
The flickering you see is on real hardware or on an emulator?

1- are you drawing on both top screens or only the left or the right? (you may draw on both OR disable stereoscopy)
2 - isn't your main() fnction already doing the swap job? (gfxFlushBuffers(); gfxSwapBuffers(); gspWaitForVBlank(); ) Because this should be done only once per frame, and if your main() and your updateScreens() both do it, than you're doing once too much.
while (1)
{
hidScanInput();
keysPressed = hidKeysHeld();
if ((keysPressed & KEY_X) && !(lastKeysPressed & KEY_X)){
QuitGame = 1;
}
UpdateScreens();
lastKeysPressed = keysPressed;
if(QuitGame==1) break;
}
#include <stdio.h>
#include <string.h>
#include <3ds.h>
int main()
{
// Initializations
srvInit(); // services
aptInit(); // applets
hidInit(NULL); // input
gfxInit(); // graphics
gfxSet3D(false); // stereoscopy (true/false == on/off)
u32 kDown; // keys down
u32 kHeld; // keys pressed
u32 kUp; // keys up
u8* fbTopLeft; // top left screen's framebuffer
u8* fbTopRight; // top right screen's framebuffer
u8* fbBottom; // bottom screen's framebuffer
// Main loop
while (aptMainLoop())
{
// Wait for next frame
gspWaitForVBlank();
// Read which buttons are currently pressed or not
hidScanInput();
kDown = hidKeysDown();
kHeld = hidKeysHeld();
kUp = hidKeysUp();
// If START button is pressed, break loop and quit
if (kDown & KEY_START){
break;
}
// Reset framebuffers
fbTopLeft = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
fbTopRight = gfxGetFramebuffer(GFX_TOP, GFX_RIGHT, NULL, NULL);
fbBottom = gfxGetFramebuffer(GFX_BOTTOM, 0, NULL, NULL);
memset(fbTopLeft, 0, 240 * 400 * 3);
memset(fbTopRight, 0, 240 * 400 * 3);
memset(fbBottom, 0, 240 * 320 * 3);
/** Your code goes here **/
// Flush and swap framebuffers
gfxFlushBuffers();
gfxSwapBuffers();
}
// Exit
gfxExit();
hidExit();
aptExit();
srvExit();
// Return to hbmenu
return 0;
}

Real hardware, it's as if the image is only written to one buffer(back?/front?) so flipping is switching between the image and a blank screen.

afrer swapping buffers you have to get the new pointer to back buffer, otherwise you always write on the same buffer and the second remain empty (black).
Worst of all, if you go to main menu and then return to the app, the buffers change. You have to always update back buffers pointer at the beginning of the mail loop.

static int lua_listdir(lua_State *L){
int argc = lua_gettop(L);
if (argc != 1) return luaL_error(L, "wrong number of arguments");
const char *path = luaL_checkstring(L, 1);
Handle dirHandle;
FS_archive sdmcArchive=(FS_archive){ARCH_SDMC, (FS_path){PATH_EMPTY, 1, (u8*)""}};
FS_path dirPath=FS_makePath(PATH_CHAR, path);
FSUSER_OpenDirectory(NULL, &dirHandle, sdmcArchive, dirPath);
u32 entriesRead;
lua_newtable(L);
int i = 1;
static char name[1024];
do{
static FS_dirent entry;
memset(&entry,0,sizeof(FS_dirent));
entriesRead=0;
FSDIR_Read(dirHandle, &entriesRead, 1, &entry);
if (entriesRead){
lua_pushnumber(L, i++);
lua_newtable(L);
lua_pushstring(L, "name");
unicodeToChar(&name[0],entry.name);
DrawScreenText(0,0+(i*15),name,0xFFFFFF,0,0); //Debug Print
lua_pushstring(L, name);
lua_settable(L, -3);
lua_pushstring(L, "size");
lua_pushnumber(L, entry.fileSize);
lua_settable(L, -3);
lua_pushstring(L, "directory");
lua_pushboolean(L, entry.isDirectory);
lua_settable(L, -3);
lua_settable(L, -3);
}
}while(entriesRead);
FSDIR_Close(dirHandle);
return 1;
}
