aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dgen/dgen-sdl-1.18/fix-everything.patch
blob: 9aa4a027afa75838d951a43f0f6d75377a69f078 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
diff -urNd ../dgen-sdl-1.18-r0/dgen-sdl-1.18/Makefile dgen-sdl-1.18/Makefile
--- ../dgen-sdl-1.18-r0/dgen-sdl-1.18/Makefile	1999-08-08 21:29:03 +01:00
+++ dgen-sdl-1.18/Makefile	2005-02-25 04:26:39 +00:00
@@ -13,7 +13,7 @@
 
 DGENOBJS = rc.o romload.o md.o mdfr.o md-joe.o decode.o vdp.o mem.o \
 	save.o graph.o myfm.o fm.o sn76496.o ras.o main.o pd.a \
-	$(STAR) $(MUSA) $(M68KEM) $(Z80) $(TILES) $(CTV) $(JOY) $(MEMCPY) \
+	$(STAR) $(MUSA) $(M68KEM) $(Z80) $(TILES) $(CTV) $(JOY) $(MEMCPY)
 
 .PHONY: all setuidroot install clean bindist
 
@@ -22,7 +22,7 @@
 	@echo "Or, $(MAKE) install to copy dgen to /usr/local/bin."
 
 dgen : $(DGENOBJS)
-	g++ $(STRIP) -o dgen $(LIB) $(DGENOBJS) $(LIBS) $(PDLIBS)
+	$(CXX) -o dgen $(LIB) $(LIBS) $(PDLIBS) $(DGENOBJS)
 
 pd.a :
 	$(MAKE) -C $(INTERFACE)
@@ -45,7 +45,7 @@
 	cp mz80/mz80.o .
 
 ras.o : ras.cpp ras-drawplane.h
-	$(CPP) $(INCLUDE) -c ras.cpp
+	$(CXX) $(INCLUDE) -c ras.cpp
 
 zz80.o : zz80.c
 	$(CCNW) -c zz80.c
@@ -58,10 +58,10 @@
 gra.asm_: mkgra
 	./mkgra
 mkgra : mkgra.c
-	$(CC) -o mkgra mkgra.c
+	$(HOSTCC) -o mkgra mkgra.c
 
 %.o : %.cpp
-	$(CPP) $(INCLUDE) -c $<
+	$(CXX) $(INCLUDE) -c $<
 %.o : %.c
 	$(CC) $(INCLUDE) -c $<
 %.o : %.asm
@@ -98,4 +98,4 @@
 	tar cvzf dgen-sdl-linuxi386_1.17.tar.gz dgen README sample.dgenrc.?
 
 tobin: tobin.c romload.o
-	gcc -o tobin tobin.c romload.o
+	$(CC) -o tobin tobin.c romload.o
diff -urNd ../dgen-sdl-1.18-r0/dgen-sdl-1.18/Makefile.config dgen-sdl-1.18/Makefile.config
--- ../dgen-sdl-1.18-r0/dgen-sdl-1.18/Makefile.config	1999-08-08 21:42:22 +01:00
+++ dgen-sdl-1.18/Makefile.config	2005-02-25 05:19:26 +00:00
@@ -4,37 +4,37 @@
 # Otherwise, you have to use the slower C-based Musashi emulator.
 # Define at least one of these CPU core emulators!  :)
 # You can define all or one, and hot swap them during the game with F11 [PKH]
-STAR=starcpu.o
+#STAR=starcpu.o
 MUSA=musa68.a
 #M68KEM=68kem.a # Not just yet... but there's some code there. Want to fix? :)
 
 # Similarly, you can use the assembler MZ80 emulator, or the C ZZ80 emulator.
 # But not both!
-Z80=mz80.o
-#Z80=zz80.o
+#Z80=mz80.o
+Z80=zz80.o
 
 # If you are on a Linux platform and have fairly recent joystick drivers,
 # define JOYSTICK_SUPPORT and enable it using the -j runtime switch.
-JOY=md-phil.o
+#JOY=md-phil.o
 
 # If you use StarScream and you want the insanest maximum speed possible, you
 # can use its 'hog mode', which increases speed at the cost of ~130K (!)
 # executable size.
-HOG=-hog
+#HOG=-hog
 
 # Also, you may uncomment this if you want to try the assembler crap TV
 # filters. Worth a look! Only works in 16-bit or 15-bit color modes
-CTV=ctv.o
+#CTV=ctv.o
 
 # Most Linux/ELF and *BSD systems don't put underscores at the beginning of
 # symbol names, but many other systems do. If your system doesn't, uncomment
 # this. (no effect unless you're using assembler routines)
-NO_USCORE = 1
+#NO_USCORE = 1
 
 # Phil has done it again, with some assembly language memcpy() substitutes!
 # asm_memcpy.o is the straight assembler version; mmx_memcpy.o uses MMX.
 # Or pick neither, and use the standard libc memcpy().
-MEMCPY = mmx_memcpy.o
+#MEMCPY = mmx_memcpy.o
 #MEMCPY = asm_memcpy.o
 
 # Pick the object format your system uses, for NASM
@@ -42,7 +42,7 @@
 #			aoutb (*BSD a.out)
 #			coff  (COFF ;)
 #			elf   (Linux/BeOS/FreeBSD ELF)
-NASM_FMT=elf
+NASM_FMT=aout
 
 # If your processor is big-endian, try uncommenting this. But all the endian
 # bugs aren't quite ironed out yet, so YMMV.
@@ -55,8 +55,8 @@
 # Add any other directories you want to grab includes and libraries from, for
 # the SDL includes and libraries
 #INCLUDE = -I/usr/local/include
-INCLUDE = -I/usr/local/include -I/usr/local/include/SDL
-LIB = -L/usr/local/lib
+INCLUDE = -I$(STAGING_INCDIR) -I$(STAGING_INCDIR)/SDL
+LIB = -L$(STAGING_LIBDIR) -Wl,-rpath-link,$(STAGING_LIBDIR) -Wl,-rpath,${libdir}
 
 # If your libraries use the pthread library, use this.
 # Linux libc5 systems should comment this (as well as any other systems without 
@@ -68,7 +68,7 @@
 DEFINES += -D_REENTRANT
 
 # Uncomment this for assembler tile rendering. Thanks Phil!
-TILES=asm_tiles.o
+#TILES=asm_tiles.o
 
 # My cflags, for pgcc on an AMD K6
 #CFLAGS = -O3 -mk6 -march=k6 -fstrength-reduce \
@@ -78,10 +78,10 @@
 #	 -fomit-frame-pointer
 
 # For gcc/egcs on Intel:
-CFLAGS = -O3 -mpentium -march=pentium -fstrength-reduce -fomit-frame-pointer \
-         -frerun-cse-after-loop -funroll-loops \
-	 -ffast-math -malign-functions=5 -malign-jumps=5 -malign-loops=5 \
-	 -malign-double -fno-exceptions -fno-rtti
+#CFLAGS = -O3 -mpentium -march=pentium -fstrength-reduce -fomit-frame-pointer \
+#         -frerun-cse-after-loop -funroll-loops \
+#	 -ffast-math -malign-functions=5 -malign-jumps=5 -malign-loops=5 \
+#	 -malign-double -fno-exceptions -fno-rtti
 
 # For egcs on non-Intel (probably not optimal):
 #CFLAGS = -O3 -ffast-math -fomit-frame-pointer -fno-exceptions -fno-rtti \
@@ -94,12 +94,12 @@
 
 # To strip the executable, leave this uncommented. Recommended, unless you're
 # debugging
-STRIP = -s
+#STRIP = -s
 
 # Adjust these for your C and C++ compilers
-CPP=g++ -Wall -W $(CFLAGS)
-CCNW=gcc -w $(CFLAGS)
-CC=gcc -Wall -W $(CFLAGS)
+CXX=$(TARGET_CXX) -Wall -W $(CFLAGS)
+CCNW=$(TARGET_CC) -w $(CFLAGS)
+CC=$(TARGET_CC) -Wall -W $(CFLAGS)
 
 ########## No more configuration options, run make and have fun ##########
 ##########  Don't edit below this line, unless you want to. ;)  ##########
@@ -142,6 +142,6 @@
 
 INCLUDE += -I$(INTERFACE) -I. -I..
 
-CPP  += $(DEFINES) $(INCLUDE)
+CXX  += $(DEFINES) $(INCLUDE)
 CC   += $(DEFINES) $(INCLUDE)
 CCNW += $(DEFINES) $(INCLUDE)
diff -urNd ../dgen-sdl-1.18-r0/dgen-sdl-1.18/musa/Makefile dgen-sdl-1.18/musa/Makefile
--- ../dgen-sdl-1.18-r0/dgen-sdl-1.18/musa/Makefile	1999-06-19 19:56:48 +01:00
+++ dgen-sdl-1.18/musa/Makefile	2005-02-25 02:47:27 +00:00
@@ -1,7 +1,7 @@
 include ../Makefile.config
 
 test: musa68.a test.o
-	gcc -s -o test -Wall -W test.c musa68.a
+	$(CC) -s -o test -Wall -W test.c musa68.a
 
 %.o : %.c
 	$(CC) -c $<
@@ -27,7 +27,7 @@
 	./m68kmake
 
 m68kmake : m68kmake.c
-	$(CC) m68kmake.c -o m68kmake
+	$(HOSTCC) m68kmake.c -o m68kmake
 
 clean:
 	rm -f test
diff -urNd ../dgen-sdl-1.18-r0/dgen-sdl-1.18/rc.cpp dgen-sdl-1.18/rc.cpp
--- ../dgen-sdl-1.18-r0/dgen-sdl-1.18/rc.cpp	1999-07-28 00:42:34 +01:00
+++ dgen-sdl-1.18/rc.cpp	2005-02-25 05:35:11 +00:00
@@ -252,6 +252,12 @@
   return -1;
 }
 
+/* Wrapper for atoi to put it in the struct below */
+static int _atoi(char *string)
+{
+	return atoi(string);
+}
+
 /* This is a table of all the RC options, the variables they affect, and the
  * functions to parse their values. */
 struct rc_field {
@@ -310,10 +316,10 @@
   { "bool_show_carthead", boolean, &dgen_show_carthead },
   { "ctv_craptv_startup", ctv, &dgen_craptv },
   { "bool_sound", boolean, &dgen_sound },
-  { "int_soundrate", atoi, &dgen_soundrate },
+  { "int_soundrate", _atoi, &dgen_soundrate },
   { "bool_16bit", boolean, &dgen_16bit },
-  { "int_soundsegs", atoi, &dgen_soundsegs },
-  { "int_nice", atoi, &dgen_nice },
+  { "int_soundsegs", _atoi, &dgen_soundsegs },
+  { "int_nice", _atoi, &dgen_nice },
   { "bool_joystick", boolean, &dgen_joystick },
 #if defined (__linux) && (JOYSTICK_SUPPORT)
   { "joypad1_b0", jsmap, &js_map_button[0][1] },
diff -urNd ../dgen-sdl-1.18-r0/dgen-sdl-1.18/sdl/Makefile dgen-sdl-1.18/sdl/Makefile
--- ../dgen-sdl-1.18-r0/dgen-sdl-1.18/sdl/Makefile	1999-07-24 22:18:23 +01:00
+++ dgen-sdl-1.18/sdl/Makefile	2005-02-25 04:27:19 +00:00
@@ -19,10 +19,13 @@
 dgenfont.cpp: pbm2df dgenfont.pbm
 	./pbm2df dgenfont.pbm dgenfont.cpp
 
+pbm2df: pbm2df.c
+	$(HOSTCC) $(INCLUDE) -o $@ $<
+
 %: %.c
 	$(CC) $(INCLUDE) -o $@ $<
 %.o: %.cpp
-	$(CPP) $(INCLUDE) -c $<
+	$(CXX) $(INCLUDE) -c $<
 %.o: %.c
 	$(CC) $(INCLUDE) -c $<
 
diff -urNd ../dgen-sdl-1.18-r0/dgen-sdl-1.18/sdl/Makefile.pd dgen-sdl-1.18/sdl/Makefile.pd
--- ../dgen-sdl-1.18-r0/dgen-sdl-1.18/sdl/Makefile.pd	1999-08-08 21:42:33 +01:00
+++ dgen-sdl-1.18/sdl/Makefile.pd	2005-02-25 05:14:53 +00:00
@@ -1,4 +1,4 @@
 # Platform-dependent libraries
 # Put the libraries your interface needs to link to here.
-PDLIBS = -lSDL -ldl
+PDLIBS = `$(STAGING_BINDIR)/sdl-config --libs`
 
diff -urNd ../dgen-sdl-1.18-r0/dgen-sdl-1.18/sdl/sdl.cpp dgen-sdl-1.18/sdl/sdl.cpp
--- ../dgen-sdl-1.18-r0/dgen-sdl-1.18/sdl/sdl.cpp	1999-07-25 01:18:40 +01:00
+++ dgen-sdl-1.18/sdl/sdl.cpp	2005-02-25 04:23:31 +00:00
@@ -123,9 +123,9 @@
   SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE);
   SDL_EventState(SDL_MOUSEBUTTONDOWN, SDL_IGNORE);
   SDL_EventState(SDL_MOUSEBUTTONUP, SDL_IGNORE);
-  SDL_EventState(SDL_JOYMOTION, SDL_IGNORE);
+/*  SDL_EventState(SDL_JOYMOTION, SDL_IGNORE);
   SDL_EventState(SDL_JOYBUTTONDOWN, SDL_IGNORE);
-  SDL_EventState(SDL_JOYBUTTONUP, SDL_IGNORE);
+  SDL_EventState(SDL_JOYBUTTONUP, SDL_IGNORE); */
   SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE);
 
   // Set up the MegaDrive screen