Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

156 Neutral

About Devil0150

  • Rank

Personal Information

  • Interests
  1. I'm trying to emulate a gameboy, but it plays a little too fast. This how I'm doing my timing inside the main loop. if (cpu.T >= CLOCKSPEED / 40) // if more than 1/40th of cycles passed {     // Get milliseconds passed QueryPerformanceCounter(&EndCounter); unsigned long long counter = EndCounter.QuadPart - LastCounter.QuadPart; MSperFrame = 1000.0 * ((double)counter / (double)PerfCountFrequency); LastCounter = EndCounter;         // if 1/40th of a second hasn't passed, wait until it passes if (MSperFrame < 25) Sleep(25 - MSperFrame); cpu.T -= CLOCKSPEED / 40; } CLOCKSPEED is the cycles per second of the emulated cpu (4194304) cpu.T is cycles passed.   I'm using Visual Studio 2013. I even tried switching to C++ and using steady_clock but nothing changed. What could be the problem?
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!