1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-15 23:50:44 +00:00
freebsd-ports/emulators/snes9x/files/patch-ae
Chris Piazza 5cb5d6fbb6 o Support CC/CXX
o Support CFLAGS/CXXFLAGS
o Make this actually build on my system (alfred had the same problem,
  but, oddly enough, green didn't)
1999-09-20 01:56:08 +00:00

581 lines
15 KiB
Plaintext

diff -ruN ./Makefile ../release/Makefile
--- ./Makefile Wed Sep 15 17:22:32 1999
+++ ../release/Makefile Sun Sep 19 18:41:45 1999
@@ -3,8 +3,8 @@
#SPC700ASM=1
NETPLAY=1
UNZIP=1
-GLIDE=1
-GUI=1
+#GLIDE=1
+#GUI=1
ifdef ZSNESFX
FXOBJ=i386/fxemu2b.o i386/fxemu2.o i386/fxemu2c.o i386/fxtable.o i386/sfxproc.o i386/zsnes.o
@@ -67,13 +67,13 @@
endif
MOC = $(QTDIR)/bin/moc
-CCC = g++ -fno-rtti
-CC = gcc
+CCC = ${CXX} -fno-rtti
+CC ?= gcc
NASM = nasm
INCLUDES=-I/usr/X11R6/include -I/usr/local/include
-OPTIMISE=-O6 -mpentium -fomit-frame-pointer -fno-exceptions
+OPTIMISE= ${CXXFLAGS} -fomit-frame-pointer
#OPTIMISE=-g -fno-exceptions
#-DMITSHM
@@ -81,7 +81,6 @@
-Ii386 \
-I. \
-Iunzip \
--DJOYSTICK_SUPPORT \
-DZLIB \
-DNO_INLINE_SET_GET \
-DVAR_CYCLES \
@@ -94,7 +93,8 @@
$(NETPLAYDEFINES) \
$(UNZIPDEFINES) \
$(GLIDEDEFINES) \
-$(GUIDEFINES)
+$(GUIDEFINES) \
+-DSOUND
#-DSOUND
#-DDEBUGGER
@@ -106,12 +106,12 @@
CFLAGS=$(CCFLAGS)
.SUFFIXES: .o .cpp .c .cc .h .m .i .S .asm
-LDLIBS = -L/usr/X11R6/lib frame.o
+LDLIBS = -L/usr/X11R6/lib
ifdef NETPLAY
-all: offsets snes9x ssnes9x s9xserver
+all: offsets snes9x s9xserver
else
-all: offsets snes9x ssnes9x
+all: offsets snes9x
endif
#ggisnes9x
@@ -230,5 +230,4 @@
snaporig.o: cpuexec.h
unix/x11.o: snes9x.h port.h
unix/glide.o: snes9x.h port.h 3d.h
-unix/x11.o: unix/snes9x_gui.h
unix/snes9x_gui.o: unix/snes9x_gui.h
diff -ruN ./Makefile.alpha ../release/Makefile.alpha
--- ./Makefile.alpha Wed Dec 31 16:00:00 1969
+++ ../release/Makefile.alpha Sun Sep 19 18:41:45 1999
@@ -0,0 +1,232 @@
+#ZSNESFX=1
+#ASMCPU=1
+#SPC700ASM=1
+NETPLAY=1
+UNZIP=1
+#GLIDE=1
+#GUI=1
+
+ifdef ZSNESFX
+FXOBJ=i386/fxemu2b.o i386/fxemu2.o i386/fxemu2c.o i386/fxtable.o i386/sfxproc.o i386/zsnes.o
+FXDEFINES=-DZSNES_FX -DEXECUTE_SUPERFX_PER_LINE
+FXDEPENDS=zsnes_fx
+FXNO_DEPENDS=c_fx
+else
+FXOBJ=fxinst.o fxemu.o fxdbg.o
+FXDEFINES=-DEXECUTE_SUPERFX_PER_LINE
+FXDEPENDS=c_fx
+FXNO_DEPENDS=zsnes_fx
+endif
+
+LINUXDEFINES=-DUSE_DGA_EXTENSION -DUSE_VIDMODE_EXTENSION
+
+ifdef ASMCPU
+ifdef SPC700ASM
+CPUOBJ=i386/cpuops.o i386/cpuexec.o i386/spc700.o sa1cpu.o
+CPUDEFINES=
+else
+CPUOBJ=i386/cpuops.o i386/cpuexec.o spc700.o i386/sa1ops.o
+CPUDEFINES=-DSPC700_C
+endif
+else
+CPUOBJ=cpuops.o cpuexec.o spc700.o sa1cpu.o
+CPUDEFINES=
+endif
+
+OBJECTS=$(CPUOBJ) cpu.o sa1.o debug.o tile.o \
+ gfx.o memmap.o snaporig.o clip.o dsp1.o \
+ ppu.o dma.o snes9x.o snapshot.o apu.o soundux.o \
+ cheats.o data.o unix/unix.o unix/config.o $(FXOBJ) globals.o
+
+ifdef GUI
+GUIOBJS = unix/snes9x_gui.o unix/moc_snes9x_gui.o
+GUILIBS = -L$(QTDIR)/lib -lqt
+GUIDEFINES = -I$(QTDIR)/include
+endif
+
+ifdef NETPLAY
+OBJECTS += netplay.o
+NETPLAYDEFINES=-DNETPLAY_SUPPORT
+SERVER_OBJECTS=server.o
+endif
+
+ifdef UNZIP
+OBJECTS += loadzip.o unzip/unzip.o unzip/explode.o unzip/unreduce.o unzip/unshrink.o
+UNZIPDEFINES=-DUNZIP_SUPPORT
+endif
+
+ifdef GLIDE
+GLIDEOBJS = unix/glide.o
+GLIDEDEFINES = -DUSE_GLIDE -I/usr/include/glide
+GLIDELIBS = -lglide2x
+GLIDEDEPENDS=use_glide
+GLIDENO_DEPENDS=no_glide
+else
+GLIDEDEPENDS=no_glide
+GLIDENO_DEPENDS=use_glide
+endif
+
+MOC = $(QTDIR)/bin/moc
+CCC = ${CXX} -fno-rtti
+CC ?= gcc
+NASM = nasm
+
+INCLUDES=-I/usr/X11R6/include -I/usr/local/include
+
+OPTIMISE=${CXXFLAGS} -fomit-frame-pointer
+#OPTIMISE=-g -fno-exceptions
+#-DMITSHM
+
+CCFLAGS = $(OPTIMISE) -DMITSHM \
+-I. \
+-Iunzip \
+-DZLIB \
+-DNO_INLINE_SET_GET \
+-DVAR_CYCLES \
+-DDEBUGGER \
+-DCPU_SHUTDOWN \
+-DSPC700_SHUTDOWN \
+$(LINUXDEFINES) \
+$(FXDEFINES) \
+$(CPUDEFINES) \
+$(NETPLAYDEFINES) \
+$(UNZIPDEFINES) \
+$(GLIDEDEFINES) \
+$(GUIDEFINES) \
+-DSOUND
+
+#-DSOUND
+#-DDEBUGGER
+#-DNO_INLINE_SET_GET
+#-DVAR_CYCLES
+#-DCPU_SHUTDOWN
+#-DSPC700_SHUTDOWN
+
+CFLAGS=$(CCFLAGS)
+
+.SUFFIXES: .o .cpp .c .cc .h .m .i .S .asm
+LDLIBS = -L/usr/X11R6/lib
+
+ifdef NETPLAY
+all: offsets snes9x s9xserver
+else
+all: offsets snes9x
+endif
+
+#ggisnes9x
+#xf86snes9x
+
+$(FXDEPENDS):
+ touch $(FXDEPENDS)
+ $(RM) $(FXNO_DEPENDS)
+
+$(GLIDEDEPENDS):
+ touch $(GLIDEDEPENDS)
+ $(RM) $(GLIDENO_DEPENDS)
+
+offsets: offsets.o
+ $(CCC) $(INCLUDES) -o $@ offsets.o
+ ./offsets >i386/offsets.h
+
+snes9x: $(OBJECTS) unix/x11.o $(GLIDEOBJS) $(GUIOBJS)
+ $(CCC) $(INCLUDES) -o $@ $(OBJECTS) $(GLIDEOBJS) unix/x11.o $(GUIOBJS) $(LDLIBS) $(GLIDELIBS) $(GUILIBS) -lXxf86dga -lXxf86vm -lXext -lX11 -lz -lm
+
+ssnes9x: $(OBJECTS) unix/svga.o $(GLIDEOBJS)
+ $(CCC) $(INCLUDES) -o $@ $(OBJECTS) $(GLIDEOBJS) unix/svga.o $(LDLIBS) $(GLIDELIBS) -lvga -lvgagl -lz -lm
+
+gsnes9x: $(OBJECTS) unix/ggi.o
+ $(CCC) $(INCLUDES) -o $@ $(OBJECTS) unix/ggi.o $(LDLIBS) -lggi -lz -lm
+
+s9xserver: $(SERVER_OBJECTS)
+ $(CCC) $(INCLUDES) -o $@ $(SERVER_OBJECTS)
+
+.cpp.o:
+ $(CCC) $(INCLUDES) -c $(CCFLAGS) $*.cpp -o $@
+
+.c.o:
+ $(CC) $(INCLUDES) -c $(CCFLAGS) $*.c -o $@
+
+.cpp.S:
+ $(CCC) $(INCLUDES) -S $(CCFLAGS) $*.cpp -o $@
+
+.cpp.i:
+ $(CCC) $(INCLUDES) -E $(CCFLAGS) $*.cpp -o $@
+
+.S.o:
+ $(CCC) $(INCLUDES) -c $(CCFLAGS) $*.S -o $@
+
+.S.i:
+ $(CCC) $(INCLUDES) -c -E $(CCFLAGS) $*.S -o $@
+
+.asm.o:
+ $(NASM) -f elf -i. -ii386 -o $@ $*.asm
+
+unix/moc_snes9x_gui.cpp: unix/snes9x_gui.h
+ $(MOC) unix/snes9x_gui.h -o $@
+
+clean:
+ rm -f $(OBJECTS) offsets.o unix/svga.o unix/x11.o unix/ggi.o unix/xf86.o unix/glide.o
+
+#release: CCFLAGS += -DNO_DEBUGGER
+
+release: clean all
+
+ppu.o: $(FXDEPENDS)
+cpu.o: $(FXDEPENDS)
+memmap.o: $(FXDEPENDS)
+globals.o: $(FXDEPENDS)
+i386/cpuexec.o: $(FXDEPENDS)
+snapshot.o: $(FXDEPENDS)
+snaporig.o: $(FXDEPENDS)
+
+unix/unix.o: $(GLIDEDEPENDS)
+unix/x11.o: $(GLIDEDEPENDS)
+unix/glide.o: $(GLIDEDEPENDS)
+gfx.o: $(GLIDEDEPENDS)
+
+i386/cpuexec.o: i386/asmstruc.h i386/offsets.h
+i386/cpuops.o: i386/asmstruc.h i386/asmops.h i386/getset.S i386/asmaddr.h \
+ i386/offsets.h
+i386/spc700.o: i386/asmstruc.h i386/spcops.h i386/offsets.h
+i386/sa1ops.o: i386/offsets.h i386/sa1struc.h i386/sa1addr.h i386/sa1ops.h \
+ i386/sa1gs.S
+cpuexec.o: cpuexec.h cpuops.h snes9x.h snapshot.h gfx.h sa1.h \
+ memmap.h ppu.h debug.h port.h display.h apu.h spc700.h apu.h
+cpuops.o: cpuops.h memmap.h snes9x.h spc700.h apu.h \
+ cpuaddr.h cpumacro.h debug.h port.h cpuexec.h
+debug.o: cpuops.h cpuexec.h snes9x.h sa1.h \
+ memmap.h ppu.h debug.h missing.h port.h display.h apu.h
+ppu.o: snes9x.h memmap.h ppu.h missing.h port.h cpuexec.h \
+ apu.h spc700.h fxemu.h fxinst.h sa1.h
+dsp1.o: snes9x.h port.h dsp1.h
+snapshot.o: snapshot.h memmap.h snes9x.h 65c816.h ppu.h \
+ cpuexec.h display.h apu.h spc700.h soundux.h sa1.h
+snes96.o: port.h snes9x.h memmap.h
+memmap.o: cpuexec.h snes9x.h memmap.h ppu.h port.h cheats.h getset.h apu.h \
+ spc700.h sa1.h
+unix.o: cpuexec.h snes9x.h port.h snapshot.h display.h apu.h gfx.h cheats.h
+x11.o: display.h snes9x.h memmap.h debug.h ppu.h snapshot.h gfx.h
+ggi.o: display.h snes9x.h memmap.h debug.h ppu.h snapshot.h gfx.h
+svga.o: display.h snes9x.h memmap.h debug.h ppu.h snapshot.h gfx.h soundux.h
+gfx.o: memmap.h snes9x.h ppu.h gfx.h display.h port.h
+tile.o: memmap.h snes9x.h ppu.h display.h gfx.h tile.h 3d.h
+spc700.o: spc700.h apu.h apumem.h snes9x.h memmap.h
+sa1.o: snes9x.h memmap.h ppu.h cpuexec.h dma.h sa1.h cpuops.cpp 65c816.h
+sa1cpu.o: snes9x.h memmap.h ppu.h cpuexec.h dma.h sa1.h cpuops.cpp 65c816.h
+apu.o: spc700.h apu.h apumem.h snes9x.h soundux.h
+soundux.o: snes9x.h soundux.h apu.h
+dma.o: ppu.h dma.h memmap.h getset.h snes9x.h port.h apu.h spc700.h
+cheats.o: cheats.h snes9x.h port.h memmap.h
+fxemu.o: fxemu.h fxinst.h
+fxinst.o: fxemu.h fxinst.h
+fxdbg.o: fxemu.h fxinst.h
+offsets.o: port.h snes9x.h memmap.h ppu.h apu.h cpuexec.h 65c816.h sa1.h
+globals.o: memmap.h spc700.h apu.h cpuexec.h ppu.h cheats.h snes9x.h gfx.h \
+ missing.h dma.h dsp1.h soundux.h sa1.h
+xf86.o: display.h snes9x.h memmap.h debug.h ppu.h snapshot.h gfx.h
+server.o: snes9x.h port.h memmap.h netplay.h
+netplay.o: snes9x.h port.h memmap.h netplay.h
+snaporig.o: cpuexec.h
+unix/x11.o: snes9x.h port.h
+unix/glide.o: snes9x.h port.h 3d.h
+unix/snes9x_gui.o: unix/snes9x_gui.h
diff -ruN ./fxemu.h ../release/fxemu.h
--- ./fxemu.h Sat Sep 18 09:18:08 1999
+++ ../release/fxemu.h Sun Sep 19 18:41:45 1999
@@ -39,18 +39,7 @@
#ifndef _FXEMU_H_
#define _FXEMU_H_ 1
-/* Types used by structures and code */
-#ifndef snes9x_types_defined
-#define snes9x_types_defined
-
-typedef unsigned char uint8;
-typedef unsigned short uint16;
-typedef unsigned long uint32;
-typedef unsigned char bool8;
-typedef signed char int8;
-typedef short int16;
-typedef int int32;
-#endif
+#include "port.h"
#ifndef TRUE
#define TRUE 1
diff -ruN ./i386/offsets.h ../release/i386/offsets.h
--- ./i386/offsets.h Sat Sep 18 09:18:08 1999
+++ ../release/i386/offsets.h Sun Sep 19 18:47:04 1999
@@ -1,41 +1,3 @@
-/*
- * Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
- *
- * (c) Copyright 1996, 1997, 1998, 1999 Gary Henderson (gary@daniver.demon.co.uk) and
- * Jerremy Koot (jkoot@snes9x.com)
- *
- * Super FX C emulator code
- * (c) Copyright 1997, 1998, 1999 Ivar (Ivar@snes9x.com) and
- * Gary Henderson.
- * Super FX assembler emulator code (c) Copyright 1998 zsKnight and _Demo_.
- *
- * DSP1 emulator code (c) Copyright 1998 Ivar, _Demo_ and Gary Henderson.
- * DOS port code contains the works of other authors. See headers in
- * individual files.
- *
- * Snes9x homepage: www.snes9x.com
- *
- * Permission to use, copy, modify and distribute Snes9x in both binary and
- * source form, for non-commercial purposes, is hereby granted without fee,
- * providing that this license information and copyright notice appear with
- * all copies and any derived work.
- *
- * This software is provided 'as-is', without any express or implied
- * warranty. In no event shall the authors be held liable for any damages
- * arising from the use of this software.
- *
- * Snes9x is freeware for PERSONAL USE only. Commercial users should
- * seek permission of the copyright holders first. Commercial use includes
- * charging money for Snes9x or software derived from Snes9x.
- *
- * The copyright holders request that bug fixes and improvements to the code
- * should be forwarded to them so everyone can benefit from the modifications
- * in future versions.
- *
- * Super NES and Super Nintendo Entertainment System are trademarks of
- * Nintendo Co., Limited and its subsidiary companies.
- */
-
#define Flags CPU + 0
#define BranchSkip CPU + 4
#define NMIActive CPU + 5
diff -ruN ./memmap.cpp ../release/memmap.cpp
--- ./memmap.cpp Sat Sep 18 09:18:08 1999
+++ ../release/memmap.cpp Sun Sep 19 18:41:45 1999
@@ -39,7 +39,7 @@
#include <string.h>
#include <ctype.h>
-#ifdef __linux
+#if defined(__linux) || defined(__FreeBSD__)
#include <unistd.h>
#endif
@@ -737,7 +737,7 @@
{
fwrite ((char *) ::SRAM, size, 1, file);
fclose (file);
-#if defined(__linux)
+#if defined(__linux) || defined(__FreeBSD__)
chown (filename, getuid (), getgid ());
#endif
return (TRUE);
Binary files ./offsets and ../release/offsets differ
diff -ruN ./port.h ../release/port.h
--- ./port.h Sat Sep 18 09:18:08 1999
+++ ../release/port.h Sun Sep 19 18:41:45 1999
@@ -50,17 +50,17 @@
#ifndef snes9x_types_defined
#define snes9x_types_defined
-typedef unsigned char uint8;
-typedef unsigned short uint16;
-typedef unsigned long uint32;
-typedef unsigned char bool8;
-typedef signed char int8;
-typedef short int16;
-typedef int int32;
+typedef u_int8_t uint8;
+typedef u_int16_t uint16;
+typedef u_int32_t uint32;
+typedef u_int8_t bool8;
+typedef int8_t int8;
+typedef int16_t int16;
+typedef int32_t int32;
#ifndef _WIN32
typedef long long int64;
#else
-typedef __int64 int64;
+typedef u_int64_t int64;
#endif
#endif
@@ -137,6 +137,10 @@
#ifdef __linux
#define TITLE "Snes9X: Linux"
+#endif
+
+#ifdef __FreeBSD__
+#define TITLE "Snes9X: FreeBSD"
#endif
#ifndef TITLE
Binary files ./s9xserver and ../release/s9xserver differ
Binary files ./server.o and ../release/server.o differ
Binary files ./snes9x and ../release/snes9x differ
diff -ruN ./unix/unix.cpp ../release/unix/unix.cpp
--- ./unix/unix.cpp Sat Sep 18 09:18:08 1999
+++ ../release/unix/unix.cpp Sun Sep 19 18:41:45 1999
@@ -48,18 +48,21 @@
#include <sys/types.h>
#include <ctype.h>
-#if defined(__linux) || defined(__sun)
+#if defined(__linux) || defined(__sun) || defined(__FreeBSD__)
#include <unistd.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <signal.h>
-#endif
-
+#ifndef __sun
#ifdef __linux
#include <sys/soundcard.h>
+#else
+#include <machine/soundcard.h>
+#endif
#include <sys/mman.h>
#endif
+#endif
#ifdef __sun
#ifdef __SVR4
@@ -73,6 +76,10 @@
typedef void (*SIG_PF)();
#endif
+#if defined(__FreeBSD__)
+typedef sig_t SIG_PF;
+#endif
+
#include "snes9x.h"
#include "memmap.h"
#include "debug.h"
@@ -149,7 +156,7 @@
char *rom_filename = NULL;
char *snapshot_filename = NULL;
-#if defined(__linux) || defined(__sun)
+#if defined(__linux) || defined(__sun) || defined(__FreeBSD__)
static void sigbrkhandler(int)
{
#ifdef DEBUGGER
@@ -392,7 +399,7 @@
#if !defined(__MSDOS) && defined(DEBUGGER)
#if defined(__unix) && !defined(__NeXT__)
struct sigaction sa;
-#if defined(__linux)
+#if defined(__linux) || defined(__FreeBSD__)
sa.sa_handler = sigbrkhandler;
#else
sa.sa_handler = (SIG_PF) sigbrkhandler;
@@ -1379,7 +1386,7 @@
}
#endif
-#if defined(__linux)
+#if defined(__linux) || defined(__FreeBSD__)
static int Rates[8] =
{
0, 8192, 11025, 16500, 22050, 29300, 36600, 44000
@@ -1496,7 +1503,7 @@
}
#endif
-#if defined (__linux) || defined (__sun)
+#if defined (__linux) || defined (__sun) || defined(__FreeBSD__)
void S9xUnixProcessSound (void)
{
}
@@ -1579,7 +1586,7 @@
void S9xProcessSound ()
{
-#ifdef __linux
+#if defined(__linux) || defined(__FreeBSD__)
audio_buf_info info;
count_info count;
diff -ruN ./unix/xf86.cpp ../release/unix/xf86.cpp
--- ./unix/xf86.cpp Tue Sep 22 06:36:50 1998
+++ ../release/unix/xf86.cpp Sun Sep 19 18:41:45 1999
@@ -4,16 +4,20 @@
Question/comments regarding this file only: maciej@imsa.edu
*/
-#ifdef __linux
+#if defined(__linux) || defined(__FreeBSD__)
//#define USE_XF86VIDMODE
+#ifdef __linux
#include <asm/ioctls.h>
+#endif
+#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/time.h>
+#ifdef __linux
#include <linux/ioctl.h>
+#endif
#include <fcntl.h>
-#include <sys/types.h>
#include <string.h>
#include <ctype.h>
@@ -833,4 +837,4 @@
ret = 1;
return (ret);
}
-#endif /* __linux */
+#endif /* __linux || __FreeBSD__ */
diff -ruN ./unzip/unzip.h ../release/unzip/unzip.h
--- ./unzip/unzip.h Wed Aug 25 05:52:56 1999
+++ ../release/unzip/unzip.h Sun Sep 19 18:47:00 1999
@@ -41,13 +41,17 @@
#ifndef _unz_H
#define _unz_H
+#include <sys/types.h>
+
+#ifndef _ZLIB_H
+#include <zlib.h>
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _ZLIB_H
-#include "zlib.h"
-#endif
+#define ZEXPORT
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
/* like the STRICT of WIN32, we define a pointer that cannot be converted