Skip to content

Commit

Permalink
2007-01-07 Pace Willisson <[email protected]>
Browse files Browse the repository at this point in the history
	* V54

	* basic support for cross compiling for windows; use autoconf


2007-01-06  Pace Willisson  <[email protected]>
  • Loading branch information
pace committed Jan 8, 2007
1 parent 712dddc commit e13bbbd
Show file tree
Hide file tree
Showing 26 changed files with 227 additions and 86 deletions.
5 changes: 5 additions & 0 deletions .cvsignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ sdltest
TMP
raceintospace
raceintospace.tar.gz
autom4te.cache
config.log
config.status
configure
race.h
4 changes: 4 additions & 0 deletions Buzz_inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ typedef long i32;

#include "pace.h"

#ifdef _WIN32
#include <winsock2.h>
#endif

#include <stdio.h>
#include <string.h>
#include <ctype.h>
Expand Down
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2007-01-07 Pace Willisson <[email protected]>

* V54

* basic support for cross compiling for windows; use autoconf


2007-01-06 Pace Willisson <[email protected]>

* V53
Expand Down
55 changes: 55 additions & 0 deletions DEVELOPER
Original file line number Diff line number Diff line change
@@ -1,3 +1,58 @@
compiling on linux:

$ autoconf
$ configure
$ make

================================================================

cross compiling linux -> windows:

1. install the cross compiler as described at:

http://www.libsdl.org/extras/win32/cross/README.txt

2. download SDL:

http://www.libsdl.org/release/SDL-devel-1.2.11-mingw32.tar.gz

copy SDL-1.2.11/lib/* from this tar file into
/usr/local/cross/i386-mingw32msvc/lib

(the SDL include files apparantly come from the host environment -
dangerous, but it works)

3. download SDL runtime:

http://www.libsdl.org/release/SDL-1.2.11-win32.zip

extract SDL.dll from this and put it in raceintospace source directory

4. compile

run "autoconf" as a normal linux program
run "cross-configure.sh"
run "cross-make.sh"

5. run (I'm using wine-0.9.27 on Fedora core 5)

get the wine environment initialized with "wine notepad", then

mkdir ~/.wine/drive_c/raceintospace

copy all of the cdrom data to ~/.wine/drive_c/raceintospace/cdrom

music isn't supported yet, but when it is, copy all of the ogg
compressed music files to

~/.wine/drive_c/raceintospace/music

run

wine ./raceintospace.exe


================================================================
for making rpm's

useful instructions:
Expand Down
24 changes: 18 additions & 6 deletions Makefile → Makefile.in
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
CC=@CC@
LIBS=@LIBS@
CPPFLAGS=@CPPFLAGS@
PROG_NAME=@PROG_NAME@

EXTRA_WARNINGS = -Wextra -Wno-unused-parameter \
-Wno-char-subscripts \
-Werror

CFLAGS = -g -Wall -Dfar= -Dpascal= -I. `sdl-config --cflags`

LIBS = `sdl-config --libs` -lvorbisfile -lm

.c.o:
@echo "$(CC) ...flags... -c $*.c"
@$(CC) $(CFLAGS) $(EXTRA_WARNINGS) -O -c -o TMP.o $*.c
@$(CC) $(CFLAGS) $(EXTRA_WARNINGS) -c $*.c

PROGS = raceintospace imgsplit vtest decode getport mkmovie getvab mtest sdltest
all: $(PROGS)
PROGS = imgsplit vtest decode getport mkmovie getvab mtest sdltest
all: $(PROG_NAME)

extra: all $(PROGS)

EXTRA_SOURCES = README raceintospace.1

Expand Down Expand Up @@ -53,8 +58,8 @@ BARIS_OBJS = admin.o aimast.o aimis.o aipur.o ast0.o ast1.o \
place.o port.o prefs.o prest.o radar.o rdplex.o recods.o \
replay.o review.o rush.o start.o \
vab.o pace.o gx.o gr.o sdl.o music.o
raceintospace: $(BARIS_OBJS)
$(CC) $(CFLAGS) -o raceintospace $(BARIS_OBJS) $(LIBS)
$(PROG_NAME): $(BARIS_OBJS)
$(CC) $(CFLAGS) -o $(PROG_NAME) $(BARIS_OBJS) $(LIBS)

# $(BARIS_OBJS): $(BARIS_HFILES)

Expand Down Expand Up @@ -88,6 +93,13 @@ sdltest: sdltest.o

clean:
rm -f *.o *~
rm -f raceintospace imgsplit sdltest decode getport
rm -f getvab mkmovie mtest vtest

distclean: clean
rm -f config.log config.status Makefile race.h
rm -f configure
rm -rf autom4te.cache

tar:
rm -f raceintospace.tar raceintospace.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
1/1/2007
See also the file DEVELOPER

To run the game:

Expand Down
23 changes: 23 additions & 0 deletions configure.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
AC_INIT(raceintospace.spec)
AC_PROG_CC

AC_CHECK_LIB(vorbisfile,main)
AC_CHECK_LIB(asound,main)
AC_CHECK_LIB(m,main)
AC_CHECK_LIB(SDL,main)

case "$target" in
i386-mingw32msvc)
LIBS="$LIBS -lSDL"
PROG_NAME=raceintospace.exe
;;
*)
PROG_NAME=raceintospace
;;
esac


AC_SUBST(PROG_NAME)

AC_CONFIG_HEADER(race.h)
AC_OUTPUT(Makefile, chmod a-w Makefile race.h)
4 changes: 2 additions & 2 deletions decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ main (int argc, char **argv)
if (optind != argc)
usage ();

if ((f = fopen (filename, "r")) == NULL) {
if ((f = fopen (filename, "rb")) == NULL) {
fprintf (stderr, "can't open %s\n", filename);
exit (1);
}
Expand All @@ -198,7 +198,7 @@ main (int argc, char **argv)
printf ("output size %d\n", outsize);

if (width && height) {
if ((outf = fopen ("d.pgm", "w")) == NULL) {
if ((outf = fopen ("d.pgm", "wb")) == NULL) {
fprintf (stderr, "can't create d.pgm\n");
exit (1);
}
Expand Down
8 changes: 4 additions & 4 deletions future.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void DrawFuture(char plr,int mis,char pad)
UPArrow(8,95);DNArrow(8,157);

gxVirtualDisplay(&vh,140,5,5,132,15,146,0);
Toggle(5,1);Pie(0);OutBox(5,49,53,72);
Toggle(5,1);draw_Pie(0);OutBox(5,49,53,72);
Toggle(1,1);TogBox(55,49,0);
Toggle(2,1);TogBox(92,49,0);
Toggle(3,1);TogBox(129,49,0);
Expand Down Expand Up @@ -289,14 +289,14 @@ void PianoKey(int X)
else
{
Toggle(5,1);
t=(F5==0) ? V[X].E : F5;Pie(t);
t=(F5==0) ? V[X].E : F5;draw_Pie(t);
status[0]=t;
}
DrawLocks();
return;
}

void Pie(int s)
void draw_Pie(int s)
{
int off;
if (s==0) off=1;
Expand Down Expand Up @@ -543,7 +543,7 @@ void Future(char plr)
MouseOff();
if (DuraType==0) Toggle(5,0);
else if (DuraType==1) Toggle(5,1);
if (DuraType!=0) Pie(DuraType);
if (DuraType!=0) draw_Pie(DuraType);
MouseOn();
status[0] = DuraType;

Expand Down
4 changes: 2 additions & 2 deletions getport.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ write_ppm (char *filename, char unsigned *buf, int w, int h)
int pixel;
unsigned char *cp;

if ((outf = fopen (filename, "w")) == NULL) {
if ((outf = fopen (filename, "wb")) == NULL) {
fprintf (stderr, "can't create %s\n", filename);
exit (1);
}
Expand Down Expand Up @@ -225,7 +225,7 @@ main (int argc, char **argv)
if (optind != argc)
usage ();

if ((fin = fopen (filename, "r")) == NULL) {
if ((fin = fopen (filename, "rb")) == NULL) {
fprintf (stderr, "can't open %s\n", filename);
exit (1);
}
Expand Down
4 changes: 2 additions & 2 deletions getvab.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ main (int argc, char **argv)
if (optind != argc)
usage ();

if ((f = fopen (filename, "r")) == NULL) {
if ((f = fopen (filename, "rb")) == NULL) {
fprintf (stderr, "can't open %s\n", filename);
exit (1);
}
Expand All @@ -81,7 +81,7 @@ main (int argc, char **argv)
PCX_D (cbuf, pixels, M.fSize);

sprintf (outname, "vab%d.ppm", plr);
outf = fopen (outname, "w");
outf = fopen (outname, "wb");
fprintf (outf, "P6\n320 200\n255\n");
for (i = 0; i < 320*200; i++) {
pixel = pixels[i];
Expand Down
4 changes: 2 additions & 2 deletions imgsplit.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ main (int argc, char **argv)
if (optind != argc)
usage ();

if ((inf = fopen (inname, "r")) == NULL) {
if ((inf = fopen (inname, "rb")) == NULL) {
fprintf (stderr, "can't open %s\n", inname);
exit (1);
}
Expand All @@ -111,7 +111,7 @@ main (int argc, char **argv)
break;

sprintf (outname, "c%02d.ppm", fnum);
if ((outf = fopen (outname, "w")) == NULL) {
if ((outf = fopen (outname, "wb")) == NULL) {
fprintf (stderr, "can't create %s\n", outname);
exit (1);
}
Expand Down
36 changes: 19 additions & 17 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ static char BUZZ_DIR[32];
char far *sbuf0,far *sbuf1;
void Plop(char plr,char mode);

int TimingThing(void);

void mikeCrearScreen(void)
{
MouseOff();
Expand Down Expand Up @@ -152,13 +150,15 @@ add_gamedat_files (char *dirname)
void
env_setup (void)
{
char *home;
char *alt_location;
FILE *f;
char buf[1000];
char keyword[1000], value[1000];
char dirname[1000];

#ifdef linux
char *home;

if ((home = getenv ("HOME")) == NULL) {
printf ("you must set your $HOME environment variable\n");
exit (1);
Expand All @@ -170,6 +170,21 @@ env_setup (void)
strcpy (cdrom_dir, "/usr/share/raceintospace/cdrom");
strcpy (music_dir, "/usr/share/raceintospace/music");

#elif _WIN32
mkdir ("c:/raceintospace");
strcpy (savedat_dir, "c:/raceintospace/savedat");
if (mkdir (savedat_dir) < 0) {
printf ("mkdir %s => %s\n", savedat_dir,
strerror (errno));
}

strcpy (cdrom_dir, "c:/raceintospace/cdrom");
strcpy (music_dir, "c:/raceintospace/music");
#elif
#error "unknown os"
#endif


if ((f = open_savedat ("CONFIG", "r")) != NULL) {
while (fgets (buf, sizeof buf, f) != NULL) {
if (sscanf (buf, "%s %s", keyword, value) != 2)
Expand Down Expand Up @@ -270,7 +285,7 @@ open_gamedat (char *raw_name)

for (gp = gamedat_files; gp; gp = gp->next) {
if (strcasecmp (gp->filename, cooked_name) == 0) {
f = fopen (gp->fullname, "r");
f = fopen (gp->fullname, "rb");

printf ("open_gamedat (\"%s\") => %s\n",
gp->fullname,
Expand Down Expand Up @@ -499,19 +514,6 @@ int main(int argc, char *argv[])
exit(1);
}

int TimingThing(void)
{
long bt1,bt3,bt4;
int mmm;

bt1=biostime(0,0L);
bt3=bt1+3;bt4=0L;
while (biostime(0,0L)==bt1);
while (biostime(0,0L)<bt3) bt4++;
mmm=(int)bt4%10000000L;
return mmm;
}

char CheckScrub(char plr,char m)
{
char k,RT_value,mcode;
Expand Down
Loading

0 comments on commit e13bbbd

Please sign in to comment.