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
60
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
60
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,877
Trophies
2
XP
6,468
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
60
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,877
Trophies
2
XP
6,468
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
  • Kirbydogs
    Yesterday was history, tomorrow is a mystery, and I love me a good pancake
  • Xdqwerty
    what are you looking at?
  • K3Nv2 @ K3Nv2:
    At least you didn't turn into a mj type of phile
  • ZeroT21 @ ZeroT21:
    ruined me childhood memories
  • ZeroT21 @ ZeroT21:
    mj's music didn't get ruined luckily
  • K3Nv2 @ K3Nv2:
    Just the tabloids ruined him
  • ZeroT21 @ ZeroT21:
    his vocals were just that gud
  • BigOnYa @ BigOnYa:
    He was an awesome dancer, nobody can deny that.
  • ZeroT21 @ ZeroT21:
    no comment on dat part

    :rolleyes:
  • BigOnYa @ BigOnYa:
    Ken just upset he wasn't molested by him
  • K3Nv2 @ K3Nv2:
    Vote for trump
  • BigOnYa @ BigOnYa:
    I'm voting for Kanye. Yeet Yeet mofo.
  • K3Nv2 @ K3Nv2:
    Until info gets leaked Kanye was at a diddy party
    +1
  • BigOnYa @ BigOnYa:
    Wasn't Trump, Kanye, and Diddy all friends? What a freak show that would be.
  • K3Nv2 @ K3Nv2:
    Probably in the woods some place
    +1
  • Domestica @ Domestica:
    A surprising amount of mods on. Something about to happen?
  • BigOnYa @ BigOnYa:
    Its Bantober....Mods are preparing.
    +1
  • Veho @ Veho:
    It's Bansgiving.
    +1
  • Jayro @ Jayro:
    Subscribe to my OnlyBans. <3
  • ZeroT21 @ ZeroT21:
    I only have 1 nut to offer
  • Xdqwerty @ Xdqwerty:
    I need context
  • Kirbydogs @ Kirbydogs:
    @Xdqwerty I think it's because mods are preparing for possible crappy users who will make GBAtemp worse
  • Kirbydogs @ Kirbydogs:
    @Xdqwerty could be wrong tho
    Kirbydogs @ Kirbydogs: @Xdqwerty could be wrong tho