mveplayer working in Visual C++

This commit is contained in:
Bradley Bell 2003-11-26 03:07:45 +00:00
parent c28fed7970
commit ed4aa98a5f
4 changed files with 18 additions and 41 deletions

View file

@ -1,5 +1,14 @@
2003-11-25 Bradley Bell <btb@icculus.org>
* libmve/mve_main.c, libmve/mvelib.c, libmve/mveplay.c: mveplayer
working w/Visual C++
* VisualC, VisualC/.cvsignore, VisualC/d2x.dsw, VisualC/libmve,
VisualC/libmve/.cvsignore, VisualC/libmve/libmve.dsp,
VisualC/mveplayer, VisualC/mveplayer/.cvsignore,
VisualC/mveplayer/mveplayer.dsp: added project files for Visual
C++
* VisualCE/.cvsignore, VisualCE/d2x/.cvsignore,
VisualCE/libmve/.cvsignore, VisualCE/mveplayer/.cvsignore: added
.cvsignore files

View file

@ -1,9 +1,9 @@
/* $Id: mve_main.c,v 1.4 2003-11-25 04:36:25 btb Exp $ */
/* $Id: mve_main.c,v 1.5 2003-11-26 03:07:45 btb Exp $ */
#include <stdlib.h>
#include <assert.h>
#ifdef _WIN32_WCE
#ifdef _WIN32
# include <windows.h>
#endif

View file

@ -1,5 +1,5 @@
#include <string.h> // for mem* functions
#ifndef _WIN32_WCE
#ifndef _WIN32
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>

View file

@ -1,4 +1,4 @@
/* $Id: mveplay.c,v 1.15 2003-11-25 04:36:25 btb Exp $ */
/* $Id: mveplay.c,v 1.16 2003-11-26 03:07:45 btb Exp $ */
#ifdef HAVE_CONFIG_H
#include <conf.h>
#endif
@ -9,7 +9,7 @@
//#define DEBUG
#include <string.h>
#ifndef _WIN32_WCE
#ifndef _WIN32
#include <errno.h>
#include <time.h>
#include <sys/time.h>
@ -102,13 +102,6 @@ static int end_movie_handler(unsigned char major, unsigned char minor, unsigned
* timer handlers
*************************/
#if !HAVE_STRUCT_TIMEVAL
struct timeval {
long tv_sec;
long tv_usec;
};
#endif
/*
* timer variables
*/
@ -129,40 +122,17 @@ struct timespec
int nanosleep(struct timespec *ts, void *rem);
#endif
#ifdef _WIN32_WCE
#ifdef _WIN32
int gettimeofday(struct timeval *tv, void *tz)
{
static int counter = 0;
DWORD now;
counter++;
now = GetTickCount();
now = GetTickCount();
tv->tv_sec = now / 1000;
tv->tv_usec = (now % 1000) * 1000 + counter;
return 0;
}
#elif defined(__WIN32)
#include <sys/timeb.h>
int gettimeofday(struct timeval *tv, void *tz)
{
static int counter = 0;
struct timeb tm;
counter++; /* to avoid collisions */
ftime(&tm);
tv->tv_sec = tm.time;
tv->tv_usec = (tm.millitm * 1000) + counter;
return 0;
}
int nanosleep(struct timespec *ts, void *rem)
{
_sleep(ts->tv_sec * 1000 + ts->tv_nsec / 1000000);
return 0;
}
@ -171,7 +141,7 @@ int nanosleep(struct timespec *ts, void *rem)
static int create_timer_handler(unsigned char major, unsigned char minor, unsigned char *data, int len, void *context)
{
#ifndef _WIN32_WCE
#ifndef _WIN32 //FIXME
__extension__ long long temp;
#else
long temp;
@ -236,10 +206,8 @@ static void do_timer_wait(void)
ts.tv_nsec += 1000000000UL;
--ts.tv_sec;
}
#ifdef _WIN32_WCE
#ifdef _WIN32
Sleep(ts.tv_sec * 1000 + ts.tv_nsec / 1000000);
#elif defined(__CYGWIN__)
usleep(ts.tv_sec * 1000000 + ts.tv_nsec / 1000);
#else
if (nanosleep(&ts, NULL) == -1 && errno == EINTR)
exit(1);