Re: [Tuxnes-devel] Smoother scrolling
Brought to you by:
tmmm
From: Mike M. <che...@ya...> - 2004-01-19 09:21:28
|
I was chasing a simular problem, but I coulden't get any thing to work. I don't think it's correct to cahnge the usleep, as it's based on the NTSC standared. I.E. 16666 = 1 frame and if were n frames ahead 16666 * ( n - 1 ) is how long we wait. My solution was to eliminate the extra gettimeof day call. You only need one to get timing right. Here is how I normaly do video games... Loop () Read input <-- this is done inline with nes code and will not be called every frame. Adjust position of objects, calculate score, ect <-- this is all in nes code. Draw x = gettimeofday sleep frametime * ( x - y - 1 ) y = x <-- we now use another gettimeof day call for this endloop This is how tuxnes lookes... set_renderer_basetime Loop () { /* renderer.c */ set_timeframe /* This is my y = x */ call nes rom { /* These may happen in any order based on rom loaded */ Optionaly read input Optionaly play sound Change memory /* This includes drawing something */ } Draw contens of nes memory. set_frameskip resynchronize /* Notice time spent in resynchronize is not accounted for! */ } Here is the last commit. Mon Dec 8 16:46:33 2003 UTC (5 weeks, 6 days ago) by cheako RCS file: /cvsroot/tuxnes/tuxnes/emu.c,v retrieving revision 1.89 retrieving revision 1.90 diff -u -r1.89 -r1.90 --- tuxnes/tuxnes/emu.c 2003/12/05 23:05:37 1.89 +++ tuxnes/tuxnes/emu.c 2003/12/08 16:46:33 1.90 @@ -4,7 +4,7 @@ * Please see the README and COPYING files for more information regarding * this project. * - * $Id: emu.c,v 1.89 2003/12/05 23:05:37 cheako Exp $ + * $Id: emu.c,v 1.90 2003/12/08 16:46:33 cheako Exp $ * * Description: This file contains the main() function of the emulator. */ @@ -2116,7 +2116,7 @@ } /* enter the Game Genie codes */ - while (gamegenie != 0) + while (gamegenie > 0) { if ( gamegenie == 1 ) gamegenie = 0; if (verbose) fprintf (stderr, "------------------------\n"); @@ -2162,6 +2162,7 @@ fprintf (stderr, "Game Genie: value at %04X = %02X\n", address, MAPTABLE[address >> 12][address]); } + if ( gamegenie == 0 ) break; ggcode[--gamegenie] = '\0'; for (; gamegenie >= 2; gamegenie--) if ( ggcode[gamegenie-1] == ',' ) break; --- Ryan Jackson <pro...@ya...> wrote: > I'm new to the list, but I've been following the project for quite some > time now. So please forgive me if I say something stupid ;-). > > I've noticed that on my hardware (a rather unimpressive PII-350 with > nVidia RIVA TNT video card) that tuxnes' scrolling seemed kindof choppy. > I started looking around the code, and found the resynchronize() > function. By tweaking the value passed to usleep(), the scrolling > became almost perfectly smooth. The one side effect I've noticed is > that sound gets out of sync a bit more often than before, but not by > much. > > I was considering writing a patch that would add a command-line option > to decrease this delay by some amount (1 or 2 milliseconds seems to do > it for me), but I was wondering if anyone might have a better solution. > I'm not sure what unintended effects my hack might have. Any ideas? > > Also, has anything been committed to CVS in the last couple of months? > There have been some postings to the list that indicate there has, but > 'cvs update' doesn't download anything. Maybe I'm just smoking > something... ;-) > > -- > Ryan Jackson > pro...@ya... > > > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Tuxnes-devel mailing list > Tux...@li... > https://lists.sourceforge.net/lists/listinfo/tuxnes-devel __________________________________ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus |