Homebrew Homebrew Development

Manurocker95

Game Developer & Pokémon Master
Member
Joined
May 29, 2016
Messages
1,511
Trophies
0
Age
29
Location
Madrid
Website
manuelrodriguezmatesanz.com
XP
2,792
Country
Spain
It's not so strange, the romfs service could use some nemory to handle reading calls amd some cache maybe.

The main point is that the game works with the emulator and with the 3dsx, so the romfs is called correctly.

With the Cia version there are two big differences: the program that packs the Cia file (makerom) and the enviroment where the exec runs (the 3ds normal enviroment instead of the homebrew launcher)

For the makerom I used my version that I know works fine.

For the enviroment I had a game running with no problem with the 3dsx and finishing the linear memory with the Cia version.

I don't have time to fully debug your code, I'm only giving you a hint.

You could try to change all the wav files with dummy file of only 1 sec of music (to save memory) and see if this changes something.

When I port games to 3ds I often have to lower the quality.of the sound files to make them load.
Good luck, debugging on the 3ds is always a pain.

I'll give it a try anyway. Thanks
 

umbjolt

Wild jolteon
Member
Joined
Sep 15, 2016
Messages
558
Trophies
0
Age
27
Location
Magnolia, Fiore
XP
316
Country
Hi everybody. I've got a problem with this while loop that freeze the 3ds. I'm a bit tired and I'm 100% sure it's a really stupid fault but I don't see why it freeze...

Code:
void showRomPathMarquee(const int XposValue,int Ypos, std::string text) {
    std::string path = text;
   
    while(!(hidKeysDown() & KEY_UP)){
        while( clock() < (clock() + 100) ) continue;
        std::string scrolled,temp,temp2;
           
        temp = path.substr(1,(path.length()));
        temp2 = path.substr(0,1);
        path = temp + temp2;
        if(path.length() + 1 == ' '){
            sftd_draw_textf(font, XposValue, Ypos, SET_ALPHA(color_data->color, 255), 12, "%s %s", temp.c_str(), temp2.c_str());
        }else{
            sftd_draw_textf(font, XposValue, Ypos, SET_ALPHA(color_data->color, 255), 12, "%s", path.c_str());
        }
    }
}

Thanks everybody.
 

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
Hi everybody. I've got a problem with this while loop that freeze the 3ds. I'm a bit tired and I'm 100% sure it's a really stupid fault but I don't see why it freeze...

Code:
void showRomPathMarquee(const int XposValue,int Ypos, std::string text) {
    std::string path = text;
  
    while(!(hidKeysDown() & KEY_UP)){
        while( clock() < (clock() + 100) ) continue;
        std::string scrolled,temp,temp2;
          
        temp = path.substr(1,(path.length()));
        temp2 = path.substr(0,1);
        path = temp + temp2;
        if(path.length() + 1 == ' '){
            sftd_draw_textf(font, XposValue, Ypos, SET_ALPHA(color_data->color, 255), 12, "%s %s", temp.c_str(), temp2.c_str());
        }else{
            sftd_draw_textf(font, XposValue, Ypos, SET_ALPHA(color_data->color, 255), 12, "%s", path.c_str());
        }
    }
}

Thanks everybody.

You need to call hidScanInput() in the loop or the value returned by hidKeysDown() will never change.
 
  • Like
Reactions: umbjolt

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
Oh, I see... and how can I "stop" the main while? I want to print the string slower

Code:
double temp= clock();
while( clock() < (temp + 100) ) continue;

You can do something like this.But dDon't know if 100 is the riight value for your delay, and using it without the constant CLOCKS_PER_SEC is not very clean.
 
  • Like
Reactions: umbjolt

umbjolt

Wild jolteon
Member
Joined
Sep 15, 2016
Messages
558
Trophies
0
Age
27
Location
Magnolia, Fiore
XP
316
Country
Code:
double temp= clock();
while( clock() < (temp + 100) ) continue;

You can do something like this.But dDon't know if 100 is the riight value for your delay, and using it without the constant CLOCKS_PER_SEC is not very clean.
Thanks you. I changed double temp and temp + 100 to clk because temp was already declared but the method still freeze the 3ds. :cry:
 

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
Yes my mistake. Init clk outside the big loop and update it only after the if.

Anyway take this only as an exercise.

A clean way to do what you want isto sleep the execution for a given amount of time at every loop
 
  • Like
Reactions: umbjolt

ShinobuMeahera

New Member
Newbie
Joined
Jan 9, 2017
Messages
4
Trophies
0
Age
29
XP
52
Country
Poland
Can you help me guys?
I am using sfillib and I want to load image from sd card, here is code:
Code:
void Button::setTextureFromFilePng(){
    if(folderPath == NULL) return;
    sf2d_texture *temp = sfil_load_PNG_file("NCData/button.jpeg", SF2D_PLACE_RAM);
    if(temp != NULL)    buttonTexture = temp;
}
Here is pic with error that i get in citra.
upload_2017-2-15_16-43-14.png
 

umbjolt

Wild jolteon
Member
Joined
Sep 15, 2016
Messages
558
Trophies
0
Age
27
Location
Magnolia, Fiore
XP
316
Country
Can you help me guys?
I am using sfillib and I want to load image from sd card, here is code:
Code:
void Button::setTextureFromFilePng(){
    if(folderPath == NULL) return;
    sf2d_texture *temp = sfil_load_PNG_file("NCData/button.jpeg", SF2D_PLACE_RAM);
    if(temp != NULL)    buttonTexture = temp;
}
Here is pic with error that i get in citra.
View attachment 78446

Try changing this
Code:
    sf2d_texture *temp = sfil_load_PNG_file("NCData/button.jpeg", SF2D_PLACE_RAM);
to this:
Code:
    sf2d_texture *temp = sfil_load_JPEG_file("sdmc:/NCData/button.jpeg", SF2D_PLACE_RAM);
 
Last edited by umbjolt,

ShinobuMeahera

New Member
Newbie
Joined
Jan 9, 2017
Messages
4
Trophies
0
Age
29
XP
52
Country
Poland
I think you can ignore this error in citra. I have often such a error (more warning) in the emulator, bit I have no problems on the real hw.

The real problem is that in you code you're trying to open a jpeg with a PNG lib :blink:
When i lunch it on my 3ds and i load Graphic 10~15 times app just crash.
I want to make options where you can choose your own graphic and load it.
I know loading 10 times in row is stupid, but if it happens on citra and 3ds something is bad for sure.

No, its example function where i put path to img static. But in my app it looks like this.
Code:
sf2d_texture *temp = sfil_load_PNG_file(stringCat(folderPath, buttonFileName), SF2D_PLACE_RAM);
 
Last edited by ShinobuMeahera,

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,032
Country
United States
Thanks you. I changed double temp and temp + 100 to clk because temp was already declared but the method still freeze the 3ds. :cry:
This sort of "busy" loop for timing is not really a good ideas as it prevents the CPU from doing other work while you delay. svcSleepThread is likely a better solution.
void svcSleepThread(s64 ns);
Where ns is the time to sleep in nanoseconds.
 
  • Like
Reactions: umbjolt

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: https://m.youtube.com/watch?v=FzVN9kIUNxw +1