Homebrew Homebrew Development

NCDyson

Hello Boys...
Member
Joined
Nov 9, 2009
Messages
278
Trophies
1
XP
319
Country
United States
Was trying to convert an elf to cia.. i trimmed the elf and then it was saying something about elf text area not found

trimmed the elf or stripped the elf?

I made a really simple patch for devkitpro to make building .cia and .3ds files REALLY easy.

Copy 3ds_rules2 to your devkitPro/devkitARM directory. copy the cci folder to the main folder for the project(where the makefile resides)

make the following edits to the makefile:
Code:
look for:
include $(DEVKITARM)/3ds_rules
 
add the following line underneath it:
include $(DEVKITARM)/3ds_rules2
 
look for:
all    :    $(OUTPUT).3dsx $(OUTPUT).smdh
 
change to:
all    :    $(OUTPUT).3dsx $(OUTPUT).smdh $(OUTPUT).3ds $(OUTPUT).cia

when you build the project, you should get a .3dsx, .smdh, .3ds and .cia automatically built.

You'll want to use 3ds Banner Maker to make a proper icon and banner, and change the application name in the 3ds.rsf and cia.rsf files, since the one in the files I posted is set as "Homebrew", and probably also change the UniqueId (0x1337) to something else.

the reason I put the .cia and .3ds rules in a separate file is so that I wouldn't lose it and spend 10 minutes trying to figure it out again if I ever updated devkitpro(like I did earlier)
 

Attachments

  • 3dsCiaPatch.zip
    90.2 KB · Views: 363

NCDyson

Hello Boys...
Member
Joined
Nov 9, 2009
Messages
278
Trophies
1
XP
319
Country
United States
I swear I had one somewhere, but I get just a blank blue screen on top, but the game seems to be running because I can select blocks on the bottom screen. I just noticed that the .vsh file mentions aemstro update from 15/11/14, so it could be as simple as using the wrong version of aemstro... again. I'll love it when the shader crap gets nailed down and we don't have to worry about such things...
 

DiscostewSM

Well-Known Member
Member
Joined
Feb 10, 2009
Messages
5,484
Trophies
2
Location
Sacramento, California
Website
lazerlight.x10.mx
XP
5,503
Country
United States
Is something changed in CSND module with the last ctrulib version?

I found a bug in my WAV stream function which i never saw with oldest ctrulib :/


It may not have been specifically CSND, but perhaps something that CSND uses that got altered. Just to let you know, there is a separate branch of ctrulib that looks dedicated to fixing/improving CSND.
 

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
Seems that now if i try to stream a wav of 14MB in 16 memory blocks, i get corrupted sounds (but with 8 blocks it still works). Sounds strange, i'll get a look to find the problem, maybe the issue is related to buggy samplerate.
 

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
I'm having a little problem with alpha blending and i cannot find where is the bug:
Currently, all the 2D graphics functions works fine with alpha blending except for Text drawing.

For example: these are 4 functions for drawing rectangles (it works):
Code:
void FillImageRect(int x1,int x2,int y1,int y2,u32 color,int screen){
    if (x1 > x2){
    int temp_x = x1;
    x1 = x2;
    x2 = temp_x;
    }
    if (y1 > y2){
    int temp_y = y1;
    y1 = y2;
    y2 = temp_y;
    }
    int base_y = y1;
    while (x1 <= x2){
        while (y1 <= y2){
            DrawImagePixel(x1,y1,color,(Bitmap*)screen);
            y1++;
        }
        y1 = base_y;
        x1++;
    }
}
 
void FillAlphaImageRect(int x1,int x2,int y1,int y2,u32 color,int screen,u8 alpha){
    if (x1 > x2){
    int temp_x = x1;
    x1 = x2;
    x2 = temp_x;
    }
    if (y1 > y2){
    int temp_y = y1;
    y1 = y2;
    y2 = temp_y;
    }
    int base_y = y1;
    while (x1 <= x2){
        while (y1 <= y2){
            DrawAlphaImagePixel(x1,y1,color,(Bitmap*)screen,alpha);
            y1++;
        }
        y1 = base_y;
        x1++;
    }
}
 
void FillScreenRect(int x1,int x2,int y1,int y2,u32 color,int screen,int side){
    u8* buffer;
    if (screen == 0){
        if (side == 0) buffer = TopLFB;
        else buffer = TopRFB;
    }else if (screen == 1) buffer = BottomFB;
    if (x1 > x2){
    int temp_x = x1;
    x1 = x2;
    x2 = temp_x;
    }
    if (y1 > y2){
    int temp_y = y1;
    y1 = y2;
    y2 = temp_y;
    }
    int base_y = y1;
    while (x1 <= x2){
        while (y1 <= y2){
            DrawPixel(buffer,x1,y1,color);
            y1++;
        }
        y1 = base_y;
        x1++;
    }
}
 
void FillAlphaScreenRect(int x1,int x2,int y1,int y2,u32 color,int screen,int side,u8 alpha){
    u8* buffer;
    if (screen == 0){
        if (side == 0) buffer = TopLFB;
        else buffer = TopRFB;
    }else if (screen == 1) buffer = BottomFB;
    if (x1 > x2){
    int temp_x = x1;
    x1 = x2;
    x2 = temp_x;
    }
    if (y1 > y2){
    int temp_y = y1;
    y1 = y2;
    y2 = temp_y;
    }
    int base_y = y1;
    while (x1 <= x2){
        while (y1 <= y2){
            DrawAlphaPixel(buffer,x1,y1,color,alpha);
            y1++;
        }
        y1 = base_y;
        x1++;
    }
}

And these are the 4 functions for text drawing (not works):
Code:
void DrawScreenText(int x, int y, char* str, u32 color, int screen,int side){
u8* buffer;
if (screen == 0){
if (side == 0) buffer = TopLFB;
else buffer = TopRFB;
}else if (screen == 1) buffer = BottomFB;
unsigned short* ptr;
unsigned short glyphsize;
int i, cx, cy;
for (i = 0; str[i] != '\0'; i++)
{
if (str[i] < 0x21)
{
x += 6;
continue;
}
u16 ch = str[i];
if (ch > 0x7E) ch = 0x7F;
ptr = &font[(ch-0x20) << 4];
glyphsize = ptr[0];
if (!glyphsize)
{
x += 6;
continue;
}
x++;
for (cy = 0; cy < 12; cy++)
{
unsigned short val = ptr[4+cy];
for (cx = 0; cx < glyphsize; cx++)
{
if (val & (1 << cx))
DrawPixel(buffer, x+cx, y+cy, color);
}
}
x += glyphsize;
x++;
}
}
 
void DrawAlphaScreenText(int x, int y, char* str, u32 color, int screen,int side,u8 alpha){
u8* buffer;
if (screen == 0){
if (side == 0) buffer = TopLFB;
else buffer = TopRFB;
}else if (screen == 1) buffer = BottomFB;
unsigned short* ptr;
unsigned short glyphsize;
int i, cx, cy;
for (i = 0; str[i] != '\0'; i++)
{
if (str[i] < 0x21)
{
x += 6;
continue;
}
u16 ch = str[i];
if (ch > 0x7E) ch = 0x7F;
ptr = &font[(ch-0x20) << 4];
glyphsize = ptr[0];
if (!glyphsize)
{
x += 6;
continue;
}
x++;
for (cy = 0; cy < 12; cy++)
{
unsigned short val = ptr[4+cy];
for (cx = 0; cx < glyphsize; cx++)
{
if (val & (1 << cx))
DrawAlphaPixel(buffer, x+cx, y+cy, color, alpha);
}
}
x += glyphsize;
x++;
}
}
 
void DrawAlphaImageText(int x, int y, char* str, u32 color, int screen, u8 alpha){
unsigned short* ptr;
unsigned short glyphsize;
int i, cx, cy;
for (i = 0; str[i] != '\0'; i++)
{
if (str[i] < 0x21)
{
x += 6;
continue;
}
u16 ch = str[i];
if (ch > 0x7E) ch = 0x7F;
ptr = &font[(ch-0x20) << 4];
glyphsize = ptr[0];
if (!glyphsize)
{
x += 6;
continue;
}
x++;
for (cy = 0; cy < 12; cy++)
{
unsigned short val = ptr[4+cy];
for (cx = 0; cx < glyphsize; cx++)
{
if (val & (1 << cx))
DrawAlphaImagePixel(x+cx, y+cy, color, (Bitmap*)screen, alpha);
}
}
x += glyphsize;
x++;
}
}
 
void DrawImageText(int x, int y, char* str, u32 color, int screen){
unsigned short* ptr;
unsigned short glyphsize;
int i, cx, cy;
for (i = 0; str[i] != '\0'; i++)
{
if (str[i] < 0x21)
{
x += 6;
continue;
}
u16 ch = str[i];
if (ch > 0x7E) ch = 0x7F;
ptr = &font[(ch-0x20) << 4];
glyphsize = ptr[0];
if (!glyphsize)
{
x += 6;
continue;
}
x++;
for (cy = 0; cy < 12; cy++)
{
unsigned short val = ptr[4+cy];
for (cx = 0; cx < glyphsize; cx++)
{
if (val & (1 << cx))
DrawImagePixel(x+cx, y+cy, color, (Bitmap*)screen);
}
}
x += glyphsize;
x++;
}
}

The problem is that, if i use a color like B=0 G=0 R=0 A=255 i get a white text and not a black text (if i put A=0 text will be blended black :/).

EDIT: Complete source can be found here: https://github.com/Rinnegatamante/lpp-3ds/blob/master/source/luaGraphics.cpp
 

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 someone know why FSUSER_DeleteFile doesn't work for me?

Code:
Handle fileHandle;
    FS_archive sdmcArchive=(FS_archive){ARCH_SDMC, (FS_path){PATH_EMPTY, 1, (u8*)""}};
    FS_path filePath=FS_makePath(PATH_CHAR, "/test.txt");
    FSUSER_DeleteFile(fileHandle,sdmcArchive,filePath);
    svcCloseHandle(fileHandle);

Same issue with RenameDir,RenameFile,DeleteDirectory :/
 

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
Does someone know why FSUSER_DeleteFile doesn't work for me?

Code:
Handle fileHandle;
    FS_archive sdmcArchive=(FS_archive){ARCH_SDMC, (FS_path){PATH_EMPTY, 1, (u8*)""}};
    FS_path filePath=FS_makePath(PATH_CHAR, "/test.txt");
    FSUSER_DeleteFile(fileHandle,sdmcArchive,filePath);
    svcCloseHandle(fileHandle);

Same issue with RenameDir,RenameFile,DeleteDirectory :/

in your code seem to miss:

Code:
fsInit();  // probably this is in the beginning of your main func
    ...
FSUSER_OpenArchive(NULL, &sdmcArchive);
 

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
It's not related to 3DS programming directly but i'm having a little problem writing a cmd executable, i get a stackdump caused by my access to argv (if i comment framerate line, i get no stackdump error).

Here's my source:
Code:
/* Simple BMPV Encoder by Rinnegatamante */
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
#include <string.h>
#include <stdlib.h>
 
int main(int argc,char *argv[]){
    FILE* output = fopen("output.bmpv", "w");
    fwrite("BMPV",1,4,output);
    DIR* temp = opendir("./temp");
    char* p;
    unsigned long width = 0;
    unsigned long height = 0;
    unsigned long framerate = atoi(argv[1]);
    unsigned long samplerate;
    unsigned short bytepersample;
    unsigned short audiotype;
    unsigned long audiosize;
    struct dirent *file;
    while (file = readdir(temp)){
        char* name = file->d_name;
        if (strcmp(name,"audio.wav") == 0){
            FILE* input_audio = fopen("./temp/audio.wav","r");
            fseek(input_audio, 22, SEEK_SET);
            fread(&audiotype, 2, 1, input_audio);
            fread(&samplerate, 2, 1, input_audio);
            fseek(input_audio, 32, SEEK_SET);
            fread(&bytepersample, 2, 1, input_audio);
            fseek(input_audio, 16, SEEK_SET);
            unsigned long chunk = 0;
            unsigned long jump = 0;
            while (chunk != 0x61746164){
            fread(&jump, 4, 1, input_audio);
            fseek(input_audio,jump,SEEK_CUR);
            fread(&chunk, 4, 1, input_audio);
            }
            int read_start = ftell(input_audio) + 4;
            fseek(input_audio, 0, SEEK_END);
            int size = ftell(input_audio);
            audiosize = size - read_start;
            char* audio_buffer = (char*)malloc(audiosize);
            fseek(input_audio, read_start, SEEK_SET);
            fread(audio_buffer, 1, audiosize, input_audio);
            fclose(input_audio);
        }
        else if (strcmp(name,".") == 0) continue;
        else if (strcmp(name,"..") == 0) continue;
        else{
            char* filename;
            strcpy(filename,"./temp/");
            strcat(filename,name);
            FILE* input_frame = fopen(filename,"r");
            if (width == 0){
                fseek(input_frame,0x12,SEEK_SET);
                fread(&width, 4, 1, input_frame);
                fread(&height, 4, 1, input_frame);
                fwrite(&framerate, 4, 1, output);
                fwrite(&width, 4, 1, output);
                fwrite(&height, 4, 1, output);
                fwrite(&audiotype, 2, 1, output);
                fwrite(&bytepersample, 2, 1, output);
                fwrite(&samplerate, 4, 1, output);
                fwrite(&audiosize, 4, 1, output);
                fwrite(&audio_buffer, audiosize, 1, output);
            }
            char* buffer = (char*)malloc(width*height*3);
            fseek(input_frame,0x36,SEEK_SET);
            fread(buffer, 1, width*height*3, input_frame);
            fclose(input_frame);
            fwrite(buffer,1, width*height*3, output);
            free(buffer);
        }
    }
    fclose(output);
}

And this is what my stackdump report:
Code:
Exception: STATUS_ACCESS_VIOLATION at rip=0018016ADA7
rax=0000000000000000 rbx=000000000022AAF0 rcx=0000000000000001
rdx=0000000000000000 rsi=00000001801C905F rdi=000000000022AB38
r8 =0000000000000000 r9 =000000000000000A r10=0000000000230000
r11=000000010040112E r12=0000000000000001 r13=0000000000000000
r14=0000000000000000 r15=000000000022AB38
rbp=000000000022AA70 rsp=000000000022A968
program=C:\Users\Alessio\Desktop\vid2bmpv\a.exe, pid 7480, thread main
cs=0033 ds=002B es=002B fs=0053 gs=002B ss=002B
Stack trace:
Frame        Function    Args
0000022AA70  0018016ADA7 (00600028CB0, 00600043D38, 0000022AAF0, 00600028CB0)
0000022AA70  00180164D91 (0000022D6C0, 001802BF600, 0000022AA38, 00180174D30)
0000022AA70  00100401155 (0000022AAF0, FF0700010302FF00, 00180048270, 00180047410)
0000022AB90  001800482E1 (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  0018004619B (31000000000000, 30003900370039, 30003000310031, 00000000031)
00000000000  001800462F4 (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  00100401551 (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  00100401010 (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  00076AE59ED (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  00076D1C541 (00000000000, 00000000000, 00000000000, 00000000000)
End of stack trace

Does someone knows how to solve?
 

asdfx

Member
Newcomer
Joined
Dec 27, 2014
Messages
21
Trophies
0
Age
44
XP
162
Country
France
Hey guys, I was wondering if it was technically possible to have background running homebrews, like services.

It'd be really useful, but I can't find any infos on google. Asking anyway.
 

CalebW

Fellow Temper
Member
Joined
Jun 29, 2012
Messages
638
Trophies
0
Location
Texas
XP
545
Country
United States
Hey guys, I was wondering if it was technically possible to have background running homebrews, like services.

It'd be really useful, but I can't find any infos on google. Asking anyway.
Well, ninjhax uses a hb service that smea somehow added...
 
  • Like
Reactions: cearp

netnerd

Well-Known Member
Newcomer
Joined
Sep 13, 2013
Messages
53
Trophies
0
Location
Melbourne
XP
124
Country
It's not related to 3DS programming directly but i'm having a little problem writing a cmd executable, i get a stackdump caused by my access to argv (if i comment framerate line, i get no stackdump error).

Here's my source:
Code:
/* Simple BMPV Encoder by Rinnegatamante */
...

Does someone knows how to solve?

Are you sure that's the problem? It should work fine and in fact I did a quick test which I'll add below using the same definition for framerate which seems to work fine. Perhaps try a different compiler (I use mingw64).

Anyway, here's what I tested with.
Code:
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
#include <string.h>
#include <stdlib.h>
 
int main(int argc,char *argv[]){
    unsigned long framerate = atoi(argv[1]);
    printf("%i", framerate);
}
 

Huntereb

Well-Known Member
Member
Joined
Sep 1, 2013
Messages
3,234
Trophies
0
Website
lewd.pics
XP
2,446
Country
United States
Any possibility of being able to change your primary Mii into a "Special Mii"? Ya know, the one's with the gold pants? Would be cool to Streetpass people, and it say "You found a special Mii!" on their screen for your avatar. :P

Update to this since no one responded. I did it myself.


ry0uWrK.png
 
  • Like
Reactions: MrCheeze

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
I'm having a curious bug with my filebrowser.
I'm attempting to add backgrounds support for bottom screen but, when no files are loaded, every text seems to flicker on bottom screen. When i load a BMPV for example (so a video shown on top screen) texts are not flickering.
Where can be the problem?
 

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 understand in where coordinates i'm blitting my image if i'm using a memcpy to put it on framebuffer?

(Something like this:
Code:
offset = ???
memcpy(buffer+offset, result->pixels, result->width*result->height*3);
 

AlbertoSONIC

Pasta Team Member
Member
Joined
Jun 27, 2014
Messages
927
Trophies
0
Age
52
Website
www.albertosonic.com
XP
1,396
Country
Italy
Guys could someone link me to a online wav sounds repo? I need then for 3DS Paint, so they have to be playable on the 3DS... I just need a short "pop" sound that has to be played everytime the user changes the pencil color...
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Bunjolio @ Bunjolio: j