From: Alexei S. <ale...@gm...> - 2009-08-17 20:45:25
|
Committed. Thanks. -Alexei On Mon, Aug 17, 2009 at 3:29 PM, Charles Srstka<bas...@ch...> wrote: > Attached is a set of patches to port the precise timer that is currently > used in the Linux and BeOS builds of SheepShaver to Mac OS X (and any other > Mach-based operating systems). > > Currently, the Linux build uses the clock_gettime() function to get > nanosecond-precision time, and falls back on gettimeofday() if it is not > present. Unfortunately, Mac OS X does not currently support clock_gettime(), > and gettimeofday() has only microsecond granularity. The Mach kernel, > however, has a clock_get_time() function that does very nearly the same > thing as clock_gettime(). The patches to BasiliskII cause the timing > functions such as timer_current_time() to use clock_get_time() instead of > gettimeofday() on Mach-based systems that do not support clock_gettime(). > > The changes to SheepShaver involve the precise timer. The existing code for > Linux uses pthreads and real-time signals to handle the timing. Mac OS X > unfortunately does not seem to support real-time signals, so Mach calls are > again used to suspend and resume the timer thread in order to attempt to > duplicate the Linux and BeOS versions of the timer. The code is somewhat > ugly right now, as I decided to leave alone the pre-existing style of the > source file, which unfortunately involves #ifdefs scattered throughout the > file and some duplication of code. A future patch may want to clean this up > to separate out the OS-specific code and put it all together at the top of > the file. However, for the time being, this seems to work. > > This has not been extensively tested, because I have not been able to get my > hands on a good test-case app for the classic Mac OS that would run inside > the emulator and try out the timer. However, performance does seem to be > better than with the pre-existing code, and nothing seems to have blown up > as far as I can tell. I did find a game via a Google search - Cap'n Magneto > - that is known to have problems with Basilisk/SheepShaver's legacy 60 Hz > timer, and the opening fade-to-color for this game appears to run much more > smoothly with the precise timer code in place. > > I hope that you find these patches satisfactory. > > > > > Charles > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus > on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > basilisk-devel mailing list > bas...@li... > https://lists.sourceforge.net/lists/listinfo/basilisk-devel > > |