Allows edivstd.so te built on non-windows systems

This commit is contained in:
Víctor Román Archidona 2014-07-24 13:02:52 +02:00
parent 4af999b286
commit 59a8f5c6b9
2 changed files with 26 additions and 18 deletions

16
dlls/src/edivstd/build.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
NAME="edivstd"
CCOPTS="-I. -I/usr/local/include -I../include"
FILES="edivstd"
OBJECTS=""
for FILE in $FILES; do
gcc -c $FILE.c $CCOPTS -o $FILE.o
OBJECTS+="$FILE.o "
done
gcc $OBJECTS -shared -o ../../bin/${NAME}.so -L/usr/local/lib -lSDL
rm $OBJECTS

View file

@ -24,14 +24,10 @@
* DIV, tal como las opciones de compilación, estructura reserved, etc. * DIV, tal como las opciones de compilación, estructura reserved, etc.
*/ */
#ifdef _WIN32
#include <time.h> #include <time.h>
#include <sys/timeb.h> #include <sys/timeb.h>
unsigned int tiempo; unsigned int tiempo;
unsigned int ultimo_tiempo; unsigned int ultimo_tiempo;
#else
#error ¡adapta las rutinas de timer a Linux! (edivstd no debe usar SDL)
#endif
#include <limits.h> #include <limits.h>
#include <assert.h> #include <assert.h>
@ -303,26 +299,22 @@ int eDIV_Let_Me_Alone(FUNCTION_PARAMS)
*/ */
void first_load(FUNCTION_PARAMS) void first_load(FUNCTION_PARAMS)
{ {
#ifdef _WIN32 struct timeb tiempob;
struct timeb tiempob; ftime(&tiempob);
ftime(&tiempob); ultimo_tiempo=tiempob.time*100+tiempob.millitm/10;
ultimo_tiempo=tiempob.time*100+tiempob.millitm/10;
#endif
} }
void frame(FUNCTION_PARAMS) void frame(FUNCTION_PARAMS)
{ {
int i; int i;
int timer; int timer;
#ifdef _WIN32 struct timeb tiempob;
struct timeb tiempob; ftime(&tiempob);
ftime(&tiempob); tiempo=tiempob.time*100+tiempob.millitm/10;
tiempo=tiempob.time*100+tiempob.millitm/10; timer=globalptr("timer");
timer=globalptr("timer"); for(i=0;i<10;i++)
for(i=0;i<10;i++) fp->mem[timer+i]+=tiempo-ultimo_tiempo;
fp->mem[timer+i]+=tiempo-ultimo_tiempo; ultimo_tiempo=tiempo;
ultimo_tiempo=tiempo;
#endif
} }