Homebrew Homebrew Development

AlbertoSONIC

Pasta Team Member
Member
Joined
Jun 27, 2014
Messages
927
Trophies
0
Age
52
Website
www.albertosonic.com
XP
1,396
Country
Italy
in C++ it's not actually possible to send arrays as arguments without losing a dimension so you'd actually need a 3D array with the first dimension zero and then you can pass it to get a 2D array, the way you're doing it now also sends the WHOLE array instead of a pointer to which is very inefficient

I got it to work using:

FUNCTION:
void guiBottomPaint(int color, int cTable[][SIZE1], int posxy[][SIZE2])
{
...
}

I basically had to write second dimension in the fuction itself and then i just had to pass the array's name:

guiBottomPaint(color, cTable, posxy);

Anyway i have another question. Is it possible to write a boolean variable? Something like

sprintf(buffer, "Value = %d", variable);
 

themperror

Well-Known Member
Member
Joined
Aug 12, 2009
Messages
181
Trophies
0
XP
367
Country
Netherlands
I got it to work using:

FUNCTION:
void guiBottomPaint(int color, int cTable[][SIZE1], int posxy[][SIZE2])
{
...
}

I basically had to write second dimension in the fuction itself and then i just had to pass the array's name:

guiBottomPaint(color, cTable, posxy);

Anyway i have another question. Is it possible to write a boolean variable? Something like

sprintf(buffer, "Value = %d", variable);


I'd say look here: http://www.cplusplus.com/reference/cstdio/printf/

If you really can't find it I'll tell you
 

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
Some news with the CIA file:
Now, i created a CIA which sounds good (it request only 3 MB for importing) but when i import it and try to launch it from emuNand, i don't get the normal 3DS loading screen (splashscreen with Nintendo 3DS and two rectangle on top-left and bottom-right of the screen) and after few seconds (1-2 seconds) i get the error screen which tell me to hold Power button to shut down console. How can i solve?
 

Technicmaster0

Well-Known Member
Member
Joined
Oct 22, 2011
Messages
4,406
Trophies
2
Website
www.flashkarten.tk
XP
3,497
Country
Gambia, The
Some news with the CIA file:
Now, i created a CIA which sounds good (it request only 3 MB for importing) but when i import it and try to launch it from emuNand, i don't get the normal 3DS loading screen (splashscreen with Nintendo 3DS and two rectangle on top-left and bottom-right of the screen) and after few seconds (1-2 seconds) i get the error screen which tell me to hold Power button to shut down console. How can i solve?
Have you stripped the elf? I can make CIAs properly with the following example:
Code:
arm-none-eabi-strip 3DNES.elf
makerom -f cia -o 3DNES.cia -elf 3DNES.elf -rsf build_cia.rsf -icon icon.icn -banner banner.bnr -exefslogo -target t
 

DEElekgolo

Well-Known Member
Newcomer
Joined
Apr 7, 2009
Messages
75
Trophies
0
Age
29
Website
Visit site
XP
262
Country
United States
Got a cool ray-tracer going.
LU7AzVz.png
 

Apache Thunder

I have cameras in your head!
Member
Joined
Oct 7, 2007
Messages
4,426
Trophies
3
Age
36
Location
Levelland, Texas
Website
www.mariopc.co.nr
XP
6,791
Country
United States
3DS Banner Maker
Create custom banner and icon files for your 3ds homebrews. Today I introduce you to an improved version of SnailFace's Banner Maker made by me! It has many usefull changes:

Does this support making 3D/Animated banners? I think it's time homebrew gets the same fancy banners that retail games can have. :)
 

Slushie3DS

Cold Beverage Lover
Member
Joined
Jan 9, 2015
Messages
707
Trophies
0
Age
29
XP
420
Country
United States
I just set up the devkit via the tutorial for Linux found here: http://3dbrew.org/wiki/Setting_up_Development_Environment

Everything went perfectly, and there was no errors at all. Yet, when I tried to compile the template source with the 'make' command, I kept getting the error below. It made a 'build' folder for which my output files should store, but no output files appear. This is beyond frustrating, and I hope one of you can help me.

Code:
bbnorman@bbnorman-Veriton-M460:~/Documents/3DS/template$ make
main.c
arm-none-eabi-gcc -MMD -MP -MF /home/bbnorman/Documents/3DS/template/build/main.d -g -Wall -O2 -mword-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=softfp -I/home/bbnorman/Documents/3DS/template/include -I/opt/devkitpro/libctru/include -I/home/bbnorman/Documents/3DS/template/build -DARM11 -D_3DS -c /home/bbnorman/Documents/3DS/template/source/main.c -o main.o
/home/bbnorman/Documents/3DS/template/source/main.c: In function 'main':
/home/bbnorman/Documents/3DS/template/source/main.c:11:3: error: too few arguments to function 'gfxInit'
  gfxInit();        // graphics
  ^
In file included from /opt/devkitpro/libctru/include/3ds.h:14:0,
                from /home/bbnorman/Documents/3DS/template/source/main.c:3:
/opt/devkitpro/libctru/include/3ds/gfx.h:23:6: note: declared here
void gfxInit(GSP_FramebufferFormats topFormat, GSP_FramebufferFormats bottomFormat, bool vrambuffers);
      ^
/home/bbnorman/Documents/3DS/template/source/main.c:15:7: warning: variable 'kUp' set but not used [-Wunused-but-set-variable]
  u32 kUp;          // keys up
      ^
/home/bbnorman/Documents/3DS/template/source/main.c:14:7: warning: variable 'kHeld' set but not used [-Wunused-but-set-variable]
  u32 kHeld;        // keys pressed
      ^
make[1]: *** [main.o] Error 1
make: *** [build] Error 2
 

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
Does this support making 3D/Animated banners? I think it's time homebrew gets the same fancy banners that retail games can have. :)

No, actually it supports only PNG image so static banners (I think that if you try to use an APNG, it will also be converted as static).

Slushie3ds: Change gfxInit(); with gfxInitDefault();
 

themperror

Well-Known Member
Member
Joined
Aug 12, 2009
Messages
181
Trophies
0
XP
367
Country
Netherlands
When trying to build a .3ds for gateway use I get this: (It's the Hello-World project from CTRULib examples (in the graphics folder)

nqiqzm.png
 

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
How can i decode BigIcon from SMDH?

According to info on 3dbrew ( http://3dbrew.org/wiki/SMDH ), i wrote this piece of code but icon is rendered corrupted:
Code:
static inline void putPixel565(u8* dst, u8 x, u8 y, u16 v) //Put RGB565 pixels in a Bitmap-like formatted buffer
{
dst[(x+(47-y)*48)*3+0]=(v&0x1F)<<3;
dst[(x+(47-y)*48)*3+1]=((v>>5)&0x3F)<<2;
dst[(x+(47-y)*48)*3+2]=((v>>11)&0x1F)<<3;
}
 
const char* file = "/file.smdh";
    char name[64];
    char desc[128];
    char author[64];
    Handle fileHandle;
    u32 bytesRead;
    FS_archive sdmcArchive=(FS_archive){ARCH_SDMC, (FS_path){PATH_EMPTY, 1, (u8*)""}};
    FS_path filePath=FS_makePath(PATH_CHAR, file);
    FSUSER_OpenFileDirectly(NULL, &fileHandle, sdmcArchive, filePath, FS_OPEN_READ, FS_ATTRIBUTE_NONE);
    u32 magic;
    FSFILE_Read(fileHandle, &bytesRead, 0, &magic, 4);
    if (magic != 0x48444D53) return luaL_error(L, "error opening SMDH file");
    unsigned char *buffer = (unsigned char*)(malloc((129) * sizeof (char)));
    buffer[128] = 0;
    FSFILE_Read(fileHandle, &bytesRead, 8, buffer, 128);
    int i = 0;
    while (i < 129){
    if (buffer[i*2] == 0) break;
    else name[i] = buffer[i*2];
    i++;
    }
    name[i] = 0;
    FSFILE_Read(fileHandle, &bytesRead, 392, buffer, 128);
    i = 0;
    while (i < 129){
    if (buffer[i*2] == 0) break;
    else author[i] = buffer[i*2];
    i++;
    }
    author[i] = 0;
    free(buffer);
    buffer = (unsigned char*)(malloc((257) * sizeof (char)));
    buffer[256] = 0;
    FSFILE_Read(fileHandle, &bytesRead, 136, buffer, 256);
    i = 0;
    while (i < 257){
    if (buffer[i*2] == 0) break;
    else desc[i] = buffer[i*2];
    i++;
    }
    desc[i] = 0;
    free(buffer);
    Bitmap *bitmap = (Bitmap*)malloc(sizeof(Bitmap));
    bitmap->width = 48;
    bitmap->height = 48;
    bitmap->pixels = (u8*)malloc(6912);
    bitmap->bitperpixel = 24;
    u16* icon_buffer = (u16*)malloc(0x1200);
    FSFILE_Read(fileHandle, &bytesRead, 0x24C0, icon_buffer, 0x1200);
    FSFILE_Close(fileHandle);
    svcCloseHandle(fileHandle);
    //convert RGB565 to RGB24
    int x=0;
    int    y=0;
    int real_x,real_y;
    int low_up_x = 4;
    int big_up_x = 12;
    int low_up_y = 2;
    int big_up_y = 6;
    bool switch_tile_x = false;
    bool switch_tile_y = false;
    bool jump = false;
    i = 0;
    int j=0;
    while (y < 48){
        i=j;
        while (x < 48){
            putPixel565(bitmap->pixels, x, y, icon_buffer[i]);
            x++;
            putPixel565(bitmap->pixels, x, y, icon_buffer[i+1]);
            if (switch_tile_x) i = i + big_up_x;
            else i = i + low_up_x;
            x++;
            switch_tile_x = !switch_tile_x;
        }
        x=0;
        if (switch_tile_y){
            if (jump) j = j + 183;
            else j = j + big_up_y;
            jump = !jump;
        }else j = j + low_up_y;
        switch_tile_y = !switch_tile_y;
        y++;
    }
    free(icon_buffer);
 

DEElekgolo

Well-Known Member
Newcomer
Joined
Apr 7, 2009
Messages
75
Trophies
0
Age
29
Website
Visit site
XP
262
Country
United States
Raytracer, phong, etc. and also a simple radiosity renderer just for fun (monte carlo or other method).
I don't know if it's possible.

We'll see! This is actually my first time dealing with ray-tracer related stuff.
This was actually a port of an ascii-ray-tracer I made.
3cXESGL.gif

Once I have the time I'd definitely be up for making it much more advanced than what it is now!
 

Slushie3DS

Cold Beverage Lover
Member
Joined
Jan 9, 2015
Messages
707
Trophies
0
Age
29
XP
420
Country
United States
We'll see! This is actually my first time dealing with ray-tracer related stuff.
This was actually a port of an ascii-ray-tracer I made.
3cXESGL.gif

Once I have the time I'd definitely be up for making it much more advanced than what it is now!

That tripped me out.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    AncientBoi @ AncientBoi: Imma make quesadillas for lunch :D +1