Homebrew [DEV] Limit/control FPS

Urbanshadow

Well-Known Member
OP
Member
Joined
Oct 16, 2015
Messages
1,578
Trophies
0
Age
33
XP
1,723
Country
Hi all!

I was wondering if there was a way for a userland homebrew to have a fps limiter or controller with millisecond precision or more. I have found svcSleepThread(nanoseconds), but I think this needs arm9 and I still need a way to tic/toc (check the amount of time a code block has taken) at least in milliseconds. time.h has time(null) which gives you unixtime but unfortunately this is down to second precision. The main goal is to have the system idling (sleeping) if the system can run accross a homebrew's logic and rendering cycle in less time than necessary or be able to actively do things it the system can't keep up with a desired framerate (ie 30).

Any clues for me?
 
Last edited by Urbanshadow,

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,034
Country
United States
Hi all!

I was wondering if there was a way for a userland homebrew to have a fps limiter or controller with millisecond precision or more. I have found svcSleepThread(nanoseconds), but I think this needs arm9 and I still need a way to tic/toc (check the amount of time a code block has taken) at least in milliseconds. time.h has time(null) which gives you unixtime but unfortunately this is down to second precision. The main goal is to have the system idling (sleeping) if the system can run accross a homebrew's logic and rendering cycle in less time than necessary or be able to actively do things it the system can't keep up with a desired framerate (ie 30).

Any clues for me?
osGetTime will get you milliseconds. There is also svcGetSystemTick which is a much higher precision timer - there are 268123480 ticks per second. svcSleepThread does not require arm9 it is usable in normal user code. You can also wait for vblank to idle the cpu as needed - gspWaitForVBlank. There are a few gspWait variants too.
 
  • Like
Reactions: Thelostrune

Urbanshadow

Well-Known Member
OP
Member
Joined
Oct 16, 2015
Messages
1,578
Trophies
0
Age
33
XP
1,723
Country
osGetTime will get you milliseconds. There is also svcGetSystemTick which is a much higher precision timer - there are 268123480 ticks per second. svcSleepThread does not require arm9 it is usable in normal user code. You can also wait for vblank to idle the cpu as needed - gspWaitForVBlank. There are a few gspWait variants too.

Yeah I was trying to get more info on the VBlank as it really looks like it does pretty much everything I want to implement. Looks like svcGetSystemTick and svcSleepThread are the way to go for manual control. Thanks! :)
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Psionic Roshambo @ Psionic Roshambo:
    When I worked for Dell we had access to data about military contracts and addresses for high ranking people.
  • Psionic Roshambo @ Psionic Roshambo:
    I personally handled a call from the second highest person at Raytheon. That call bothered me a lot... The guy was nice and smart what bothered me was the way management basically just blew him off instead of going the extra mile to help him.
  • Psionic Roshambo @ Psionic Roshambo:
    In the end that call ended up costing Dell millions in lost contracts with Raytheon, and really the issue could have been solved for like 450 bucks lol
  • NinStar @ NinStar:
    sometimes I wonder why anyone would ever buy mega man x legacy collection 2
  • NinStar @ NinStar:
    I always thought that capcom shuffled the games in these collection, but apparently they are all in chronological order, which makes legacy collection 2 worthless
  • BakerMan @ BakerMan:
    guys, i want to start singing pirate metal songs and sea shanties if i play sea of thieves
  • The Real Jdbye @ The Real Jdbye:
    find a pirate metal playlist
    +2
  • The Real Jdbye @ The Real Jdbye:
    and sing along
  • BakerMan @ BakerMan:
    nevermind i just learned swearing is against the rules in sea of thieves

    i was about to start singing the song i last put in "what song are you currently listening to" yesterday
  • BakerMan @ BakerMan:
    but yeah ig so
  • The Real Jdbye @ The Real Jdbye:
    swearing not allowed in a pirate game? what has the world come to
  • BakerMan @ BakerMan:
    (here's the song for context)
  • BigOnYa @ BigOnYa:
    Just add -izle to the end of every curse word, you will be fine.
    +2
  • The Real Jdbye @ The Real Jdbye:
    i like alestorm
    +1
  • The Real Jdbye @ The Real Jdbye:
    @BigOnYa too many syllables
    +1
  • BakerMan @ BakerMan:
    same lmao
  • BigOnYa @ BigOnYa:
    hi, welcome to the Temp!
    +1
  • BakerMan @ BakerMan:
    Welcome to the Underground!
    +1
  • BakerMan @ BakerMan:
    the booty boogie from (once again) the donkey kong country cartoon could also be a good song to sing while playing sea of thieves
  • BigOnYa @ BigOnYa:
    Please insert 25 cents for an additional 30 minutes of talk time.
    +2
  • Psionic Roshambo @ Psionic Roshambo:
    It's the Switcheroo
    Psionic Roshambo @ Psionic Roshambo: It's the Switcheroo