Homebrew Homebrew game How to make a loading screen timer for a DS homebrew game?

andreixl5

Member
OP
Newcomer
Joined
Aug 19, 2024
Messages
10
Trophies
0
Age
25
XP
63
Country
Romania
Hello!

How can I make a loading screen that runs on a timer for a DS homebrew game? I don't want to load scenes too quickly and I need to create a "loading" transition between game states and scenes.

For example, when I start the game I show 2 logos on both screens, I want to display these logos for aprox. 3 seconds before fading out the screens and start a new timer for a loading screen that will lead to the main menu. I tried making this sort of thing using C++'s <thread> header, but unfortunately when I run the game with no$gba in debug this seems to crash my entire emulator. Maybe the ARM chips in the DS weren't made with multithreading in mind...

When I look at open-source DS homebrew games I can't find anything that would help me with loading screens, especially regarding my needs. Both devkitPro and nflib lack any examples for loading screens (or even fade in/out for that matter). What can I do here?
 

andreixl5

Member
OP
Newcomer
Joined
Aug 19, 2024
Messages
10
Trophies
0
Age
25
XP
63
Country
Romania
Not a DS dev so pardon any stupidity, but maybe a janky solution would be to just use loops with a counter, although maybe something like the GBA's timers might be useful?
https://problemkaputt.de/gbatek.htm#gbatimers

I would ideally aim for something hardware based though.

Or maybe even just sleep the CPU for the 3 seconds.
I managed to make the game run again by switching to usleep() but that doesn't seem to affect anything, the loading is still instantaneous. I see that the 3DS library has a dedicated sleep function, what would be an equivalent for GBA/DS?
 

tech3475

Well-Known Member
Member
Joined
Jun 12, 2009
Messages
3,931
Trophies
2
XP
6,565
Country
I managed to make the game run again by switching to usleep() but that doesn't seem to affect anything, the loading is still instantaneous. I see that the 3DS library has a dedicated sleep function, what would be an equivalent for GBA/DS?

How long are you sleeping for?
 

andreixl5

Member
OP
Newcomer
Joined
Aug 19, 2024
Messages
10
Trophies
0
Age
25
XP
63
Country
Romania
How long are you sleeping for?
I want the program to sleep for 3 seconds, I use a function that reads an integer representing the time in seconds and convert it into microseconds to be read by usleep:
void RunSleepStd(int seconds){ auto convertTime = std::chrono::microseconds(seconds * 1000000); usleep(convertTime.count()); }
 

tech3475

Well-Known Member
Member
Joined
Jun 12, 2009
Messages
3,931
Trophies
2
XP
6,565
Country
I want the program to sleep for 3 seconds, I use a function that reads an integer representing the time in seconds and convert it into microseconds to be read by usleep:
void RunSleepStd(int seconds){ auto convertTime = std::chrono::microseconds(seconds * 1000000); usleep(convertTime.count()); }

Maybe try just using a 'hardcoded' value, at least for testing e.g. usleep(3000000)?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • realtimesave @ realtimesave:
    I can smoke indica it doesn't phase me at all
  • realtimesave @ realtimesave:
    but thc is like poison for the mind
  • K3Nv2 @ K3Nv2:
    The problem is getting regulated and not from some slut that could lace it with meth and fetty
  • realtimesave @ realtimesave:
    it didn't have meth in it tho, didn't taste like chemicals
  • realtimesave @ realtimesave:
    I was told meth smoke tastes like chemicals..
  • K3Nv2 @ K3Nv2:
    Well they aren't flavored it's not like meth taste like strawberry banana
  • K3Nv2 @ K3Nv2:
    I only believe in Marijuana if it comes from a reputable pharmacy
  • realtimesave @ realtimesave:
    too bad meth causes so much harm. it sounds like being on a high on that stuff is something else... all I can say
  • realtimesave @ realtimesave:
    I only believe in marijuana if it is very low on thc.
  • realtimesave @ realtimesave:
    I forget what the other stuff is called that's in it
  • K3Nv2 @ K3Nv2:
    I did k2 in my high-school days and saw white lights never again
  • realtimesave @ realtimesave:
    I did special K with an escort once
  • realtimesave @ realtimesave:
    didn't seem to have any long term effects
  • K3Nv2 @ K3Nv2:
    At least try robbing a bank if you're that down and depressed imo
  • realtimesave @ realtimesave:
    later on she told me not to do that stuff any more, I was like yea well I don't know where to get it anyways lol
  • realtimesave @ realtimesave:
    she thought it was coke
  • realtimesave @ realtimesave:
    clearly was not coke lol
  • realtimesave @ realtimesave:
    but man women.. idk... not too important
  • realtimesave @ realtimesave:
    collecting video games is more important
  • Sonic Angel Knight @ Sonic Angel Knight:
    Save states is more important :P
    K3Nv2 @ K3Nv2: https://www.pcgamer.com/hardware/introducing-the-beth-deck-a-3d-printed-gaming-handheld-that-can-...