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> 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/.cvsignore, VisualCE/d2x/.cvsignore,
VisualCE/libmve/.cvsignore, VisualCE/mveplayer/.cvsignore: added VisualCE/libmve/.cvsignore, VisualCE/mveplayer/.cvsignore: added
.cvsignore files .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 <stdlib.h>
#include <assert.h> #include <assert.h>
#ifdef _WIN32_WCE #ifdef _WIN32
# include <windows.h> # include <windows.h>
#endif #endif

View file

@ -1,5 +1,5 @@
#include <string.h> // for mem* functions #include <string.h> // for mem* functions
#ifndef _WIN32_WCE #ifndef _WIN32
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.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 #ifdef HAVE_CONFIG_H
#include <conf.h> #include <conf.h>
#endif #endif
@ -9,7 +9,7 @@
//#define DEBUG //#define DEBUG
#include <string.h> #include <string.h>
#ifndef _WIN32_WCE #ifndef _WIN32
#include <errno.h> #include <errno.h>
#include <time.h> #include <time.h>
#include <sys/time.h> #include <sys/time.h>
@ -102,13 +102,6 @@ static int end_movie_handler(unsigned char major, unsigned char minor, unsigned
* timer handlers * timer handlers
*************************/ *************************/
#if !HAVE_STRUCT_TIMEVAL
struct timeval {
long tv_sec;
long tv_usec;
};
#endif
/* /*
* timer variables * timer variables
*/ */
@ -129,40 +122,17 @@ struct timespec
int nanosleep(struct timespec *ts, void *rem); int nanosleep(struct timespec *ts, void *rem);
#endif #endif
#ifdef _WIN32_WCE #ifdef _WIN32
int gettimeofday(struct timeval *tv, void *tz) int gettimeofday(struct timeval *tv, void *tz)
{ {
static int counter = 0; static int counter = 0;
DWORD now; DWORD now;
counter++; counter++;
now = GetTickCount(); now = GetTickCount();
tv->tv_sec = now / 1000; tv->tv_sec = now / 1000;
tv->tv_usec = (now % 1000) * 1000 + counter; 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; 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) 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; __extension__ long long temp;
#else #else
long temp; long temp;
@ -236,10 +206,8 @@ static void do_timer_wait(void)
ts.tv_nsec += 1000000000UL; ts.tv_nsec += 1000000000UL;
--ts.tv_sec; --ts.tv_sec;
} }
#ifdef _WIN32_WCE #ifdef _WIN32
Sleep(ts.tv_sec * 1000 + ts.tv_nsec / 1000000); Sleep(ts.tv_sec * 1000 + ts.tv_nsec / 1000000);
#elif defined(__CYGWIN__)
usleep(ts.tv_sec * 1000000 + ts.tv_nsec / 1000);
#else #else
if (nanosleep(&ts, NULL) == -1 && errno == EINTR) if (nanosleep(&ts, NULL) == -1 && errno == EINTR)
exit(1); exit(1);