summaryrefslogtreecommitdiff
blob: bd1c21ce503b59875b0a738f7d9325c30482389f (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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
--- sexypsf/driver.h
+++ sexypsf/driver.h
@@ -23,4 +23,4 @@
 PSFINFO *sexy_getpsfinfo(char *path);
 void sexy_freepsfinfo(PSFINFO *info);
 
-void sexyd_update(char*,long);
+void sexyd_update(unsigned char*,long);
--- sexypsf/Linux/LnxMain.c
+++ sexypsf/Linux/LnxMain.c
@@ -26,6 +26,7 @@
 #include <time.h>
 
 #include "driver.h"
+#include "oss.h"
 #include "Linux.h"
 
 int main(int argc, char *argv[]) {
--- sexypsf/Linux/Makefile
+++ sexypsf/Linux/Makefile
@@ -4,12 +4,10 @@
 
 all: sexypsf
 
-CC = gcc 
 RM = rm -f
 STRIP = strip
 
-OPTIMIZE = -O2 -fomit-frame-pointer -finline-functions -ffast-math
-FLAGS = -g  -D__LINUX__ -DPSS_STYLE=1 
+FLAGS = -D__LINUX__ -DPSS_STYLE=1 
 #-DTIMEO
 LIBS = -lz
 
@@ -20,11 +18,11 @@
 
 OBJS+= LnxMain.o
 
-CFLAGS = -Wall -Winline ${OPTIMIZE} -I. -I.. ${FLAGS}
+CFLAGS += -Wall -Winline -Wno-nonnull -I. -I.. ${FLAGS}
 #CFLAGS+= $(shell pkg-config gtk+-2.0 --cflags)
 
 sexypsf:	${OBJS}
-		${CC} ${CFLAGS} ${OBJS} -o sexypsf ${LIBS}
+		${CC} ${LDFLAGS} ${CFLAGS} ${OBJS} -o sexypsf ${LIBS}
 
 .PHONY: clean sexypsf
 
--- sexypsf/Linux/oss.c
+++ sexypsf/Linux/oss.c
@@ -54,6 +54,9 @@
 
 #define OSS_MEM_DEF
 #include "oss.h"
+
+#include "driver.h"
+
 static int oss_audio_fd = -1;
 extern int errno;
 
@@ -66,8 +69,6 @@
  int pspeed=44100;
  int pstereo;
  int format;
- int fragsize = 0;
- int myfrag;
  int oss_speed, oss_stereo;
 
  pstereo=OSS_MODE_STEREO;
--- sexypsf/Linux/oss.h
+++ sexypsf/Linux/oss.h
@@ -32,4 +32,6 @@
 
 #define OSS_SPEED_44100	44100
 
+void SetupSound(void);
+
 #endif // _OSS_SOUND_H
--- sexypsf/Makefile
+++ sexypsf/Makefile
@@ -12,18 +12,13 @@
 RM = rm -f
 
 LIBS = -shared -lz
-OPTIMIZE = -O2 -finline-functions -ffast-math
-FLAGS = -DPSS_STYLE=1 -DSPSFVERSION="\"${VERSION}\""
+FLAGS = -DPSS_STYLE=1 -DSPSFVERSION="\"${VERSION}\"" -fPIC
 
 OBJS =	PsxBios.o PsxCounters.o PsxDma.o Spu.o PsxHw.o PsxMem.o Misc.o	\
 	R3000A.o PsxInterpreter.o PsxHLE.o spu/spu.o
 
 OBJS+=	xmms/xmms.o
-FLAGS+=	`gtk-config --cflags`
+FLAGS+=	`xmms-config --cflags`
-
-ifeq (${CPU}, ix86)
-	OPTIMIZE += -fomit-frame-pointer -mcpu=i686 -fno-exceptions
-endif
 
 ifeq (${CPU}, ppc)
 	FLAGS+=-DMSB_FIRST
@@ -33,10 +28,10 @@
 	FLAGS+=-DMSB_FIRST
 endif
 
-CFLAGS = -Wall ${OPTIMIZE} -I. ${FLAGS}
+CFLAGS += -Wall -Wno-nonnull -I. ${FLAGS}
 
 sexypsf: ${OBJS}
-	${CC} ${CFLAGS} ${OBJS} -o libsexypsf.so ${LIBS}
+	${CC} ${LDFLAGS} ${OBJS} -o libsexypsf.so ${LIBS}
 
 install: sexypsf
 	mv libsexypsf.so ${HOME}/.xmms/Plugins
--- sexypsf/Misc.c
+++ sexypsf/Misc.c
@@ -226,7 +226,7 @@
 {
         FILE *fp;
         EXE_HEADER tmpHead;
-        char *in,*out=0;
+        unsigned char *in,*out=0;
 	u8 head[4];
         u32 reserved;
         u32 complen;
--- sexypsf/PsxInterpreter.c
+++ sexypsf/PsxInterpreter.c
@@ -417,7 +417,7 @@
 * Load higher 16 bits of the first word in GPR with imm  *
 * Format:  OP rt, immediate                              *
 *********************************************************/
-static void psxLUI() { if (!_Rt_) return; _u32(_rRt_) = psxRegs.code << 16; } // Upper halfword of Rt = Im
+static void psxLUI() { if (!_Rt_) return; _rRt_ = psxRegs.code << 16; } // Upper halfword of Rt = Im
 
 /*********************************************************
 * Move from HI/LO to GPR                                 *
@@ -491,7 +491,7 @@
 
 static void psxLBU() {
 	if (_Rt_) {
-		_u32(_rRt_) = psxMemRead8(_oB_);
+		_rRt_ = psxMemRead8(_oB_);
 	} else {
 		psxMemRead8(_oB_); 
 	}
@@ -507,7 +507,7 @@
 
 static void psxLHU() {
 	if (_Rt_) {
-		_u32(_rRt_) = psxMemRead16(_oB_);
+		_rRt_ = psxMemRead16(_oB_);
 	} else {
 		psxMemRead16(_oB_);
 	}
@@ -515,7 +515,7 @@
 
 static void psxLW() {
 	if (_Rt_) {
-		_u32(_rRt_) = psxMemRead32(_oB_);
+		_rRt_ = psxMemRead32(_oB_);
 	} else {
 		psxMemRead32(_oB_);
 	}
@@ -530,7 +530,7 @@
 	u32 mem = psxMemRead32(addr & ~3);
 
 	if (!_Rt_) return;
-	_u32(_rRt_) =	( _u32(_rRt_) & LWL_MASK[shift]) | 
+	_rRt_ =	( _u32(_rRt_) & LWL_MASK[shift]) | 
 					( mem << LWL_SHIFT[shift]);
 
 	/*
@@ -552,7 +552,7 @@
 	u32 mem = psxMemRead32(addr & ~3);
 
 	if (!_Rt_) return;
-	_u32(_rRt_) =	( _u32(_rRt_) & LWR_MASK[shift]) | 
+	_rRt_ =	( _u32(_rRt_) & LWR_MASK[shift]) | 
 					( mem >> LWR_SHIFT[shift]);
 
 	/*
--- sexypsf/PsxMem.c
+++ sexypsf/PsxMem.c
@@ -21,7 +21,7 @@
 
 #include "PsxCommon.h"
 
-void LoadPSXMem(u32 address, s32 length, char *data)
+void LoadPSXMem(u32 address, s32 length, unsigned char *data)
 {
  //printf("%08x %08x\n",address,length);
  while(length>0)
@@ -56,8 +56,8 @@
 
 	writeok=1;
 
-	psxMemLUT = (u32*)malloc(0x10000 * 4);
+	psxMemLUT = malloc(0x10000 * sizeof *psxMemLUT);
-	memset(psxMemLUT, 0, 0x10000 * 4);
+	memset(psxMemLUT, 0, 0x10000 * sizeof *psxMemLUT);
 
 	psxM = (char*)malloc(0x00200000);
 	psxP = (char*)malloc(0x00010000);
@@ -67,16 +67,16 @@
 		printf("Error allocating memory"); return -1;
 	}
 
-	for (i=0; i<0x80; i++) psxMemLUT[i + 0x0000] = (u32)&psxM[(i & 0x1f) << 16];
+	for (i=0; i<0x80; i++) psxMemLUT[i + 0x0000] = &psxM[(i & 0x1f) << 16];
 
-	memcpy(psxMemLUT + 0x8000, psxMemLUT, 0x80 * 4);
+	memcpy(psxMemLUT + 0x8000, psxMemLUT, 0x80 * sizeof *psxMemLUT);
-	memcpy(psxMemLUT + 0xa000, psxMemLUT, 0x80 * 4);
+	memcpy(psxMemLUT + 0xa000, psxMemLUT, 0x80 * sizeof *psxMemLUT);
 
-	for (i=0; i<0x01; i++) psxMemLUT[i + 0x1f00] = (u32)&psxP[i << 16];
+	for (i=0; i<0x01; i++) psxMemLUT[i + 0x1f00] = &psxP[i << 16];
 
-	for (i=0; i<0x01; i++) psxMemLUT[i + 0x1f80] = (u32)&psxH[i << 16];
+	for (i=0; i<0x01; i++) psxMemLUT[i + 0x1f80] = &psxH[i << 16];
 
-	for (i=0; i<0x08; i++) psxMemLUT[i + 0xbfc0] = (u32)&psxR[i << 16];
+	for (i=0; i<0x08; i++) psxMemLUT[i + 0xbfc0] = &psxR[i << 16];
 
 	return 0;
 }
@@ -215,16 +215,16 @@
 					case 0x800: case 0x804:
 						if (writeok == 0) break;
 						writeok = 0;
-						memset(psxMemLUT + 0x0000, 0, 0x80 * 4);
+						memset(psxMemLUT + 0x0000, 0, 0x80 * sizeof *psxMemLUT);
-						memset(psxMemLUT + 0x8000, 0, 0x80 * 4);
+						memset(psxMemLUT + 0x8000, 0, 0x80 * sizeof *psxMemLUT);
-						memset(psxMemLUT + 0xa000, 0, 0x80 * 4);
+						memset(psxMemLUT + 0xa000, 0, 0x80 * sizeof *psxMemLUT);
 						break;
 					case 0x1e988:
 						if (writeok == 1) break;
 						writeok = 1;
-						for (i=0; i<0x80; i++) psxMemLUT[i + 0x0000] = (u32)&psxM[(i & 0x1f) << 16];
+						for (i=0; i<0x80; i++) psxMemLUT[i + 0x0000] = &psxM[(i & 0x1f) << 16];
-						memcpy(psxMemLUT + 0x8000, psxMemLUT, 0x80 * 4);
+						memcpy(psxMemLUT + 0x8000, psxMemLUT, 0x80 * sizeof *psxMemLUT);
-						memcpy(psxMemLUT + 0xa000, psxMemLUT, 0x80 * 4);
+						memcpy(psxMemLUT + 0xa000, psxMemLUT, 0x80 * sizeof *psxMemLUT);
 						break;
 					default:
 						break;
--- sexypsf/PsxMem.h
+++ sexypsf/PsxMem.h
@@ -41,21 +41,21 @@
 }
 #endif
 
-s8 *psxM;
+char *psxM;
 #define psxMu32(mem)	(*(u32*)&psxM[(mem) & 0x1fffff])
 
-s8 *psxP;
+char *psxP;
-s8 *psxR;
+char *psxR;
 #define psxRu32(mem)	(*(u32*)&psxR[(mem) & 0x7ffff])
 
-s8 *psxH;
+char *psxH;
 
 #define psxHu8(mem)	(*(u8*) &psxH[(mem) & 0xffff])
 
 #define psxHu16(mem)   	(*(u16*)&psxH[(mem) & 0xffff])
 #define psxHu32(mem)   	(*(u32*)&psxH[(mem) & 0xffff])
 
-u32 *psxMemLUT;
+char **psxMemLUT;
 
 #define PSXM(mem)		(psxMemLUT[(mem) >> 16] == 0 ? NULL : (void*)(psxMemLUT[(mem) >> 16] + ((mem) & 0xffff)))
 
@@ -76,6 +76,6 @@
 void psxMemWrite16(u32 mem, u16 value);
 void psxMemWrite32(u32 mem, u32 value);
 
-void LoadPSXMem(u32 address, s32 length, char *data);
+void LoadPSXMem(u32 address, s32 length, unsigned char *data);
 
 #endif /* __PSXMEMORY_H__ */
--- sexypsf/xmms/xmms.c
+++ sexypsf/xmms/xmms.c
@@ -101,7 +101,7 @@
 }
 
 static pthread_t dethread;
-void sexyd_update(char *Buffer, long count)
+void sexyd_update(unsigned char *Buffer, long count)
 {
  int mask = ~((((16 / 8) * 2)) - 1);
  if(count)