-
Notifications
You must be signed in to change notification settings - Fork 52
/
mpg123.patch
161 lines (155 loc) · 4.57 KB
/
mpg123.patch
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
diff -Naur mpg123-1.25.10-old/configure.ac mpg123-1.25.10/configure.ac
--- mpg123-1.25.10-old/configure.ac 2017-08-29 01:49:00.661996762 +0200
+++ mpg123-1.25.10/configure.ac 2017-08-29 01:49:41.609026671 +0200
@@ -1217,6 +1217,20 @@
# AC_DEFINE(
#fi
+if test x"$ac_cv_header_sys_signal_h" = xyes; then
+ AC_CHECK_FUNCS( sigemptyset sigaddset sigprocmask sigaction )
+ if test x"$ac_cv_func_sigemptyset" = xno ||
+ test x"$ac_cv_func_sigaddset" = xno ||
+ test x"$ac_cv_func_sigprocmask" = xno ||
+ test x"$ac_cv_func_sigaction" = xno; then
+ AC_DEFINE(DONT_CATCH_SIGNALS, 1, [ Signal handling is not supported on this platform ])
+ fi
+else
+ AC_DEFINE(DONT_CATCH_SIGNALS, 1, [ Signal handling is not supported on this platform ])
+fi
+
+AC_CHECK_FUNCS( sleep, [ have_sleep=yes ], [ have_sleep=no ] )
+
dnl ############## Choose compiler flags and CPU
# do not assume gcc here, so no flags by default
diff -Naur mpg123-1.25.10-old/src/compat/compat.c mpg123-1.25.10/src/compat/compat.c
--- mpg123-1.25.10-old/src/compat/compat.c 2017-08-29 01:49:00.675330213 +0200
+++ mpg123-1.25.10/src/compat/compat.c 2017-08-29 01:50:35.966177221 +0200
@@ -45,6 +45,15 @@
# endif
#endif
+/* vitasdk support */
+#ifdef PSP2
+# include <psp2/io/dirent.h>
+# include <psp2/io/stat.h>
+
+# define opendir sceIoDopen
+# define closedir sceIoDclose
+#endif
+
#include "debug.h"
#ifndef WINDOWS_UWP
@@ -423,6 +432,8 @@
int gotone; /* Got a result stored from FindFirstFileW. */
WIN32_FIND_DATAW d;
HANDLE ffn;
+#elif PSP2
+ int dir;
#else
DIR* dir;
#endif
@@ -509,15 +520,25 @@
}
#else
{
+#ifdef PSP2
+ struct SceIoDirent dp;
+ while (sceIoDread(cd->dir, &dp) > 0)
+#else
struct dirent *dp;
while((dp = readdir(cd->dir)))
+#endif
{
struct stat fst;
- char *fullpath = compat_catpath(cd->path, dp->d_name);
+#ifdef PSP2
+ char *d_name = dp.d_name;
+#else
+ char *d_name = dp->d_name;
+#endif
+ char *fullpath = compat_catpath(cd->path, d_name);
if(fullpath && !stat(fullpath, &fst) && S_ISREG(fst.st_mode))
{
free(fullpath);
- return compat_strdup(dp->d_name);
+ return compat_strdup(d_name);
}
free(fullpath);
}
@@ -543,15 +564,25 @@
}
#else
{
+#ifdef PSP2
+ struct SceIoDirent dp;
+ while (sceIoDread(cd->dir, &dp) > 0)
+#else
struct dirent *dp;
while((dp = readdir(cd->dir)))
+#endif
{
struct stat fst;
- char *fullpath = compat_catpath(cd->path, dp->d_name);
+#ifdef PSP2
+ char *d_name = dp.d_name;
+#else
+ char *d_name = dp->d_name;
+#endif
+ char *fullpath = compat_catpath(cd->path, d_name);
if(fullpath && !stat(fullpath, &fst) && S_ISDIR(fst.st_mode))
{
free(fullpath);
- return compat_strdup(dp->d_name);
+ return compat_strdup(d_name);
}
free(fullpath);
}
diff -Naur mpg123-1.25.10-old/src/compat/compat.h mpg123-1.25.10/src/compat/compat.h
--- mpg123-1.25.10-old/src/compat/compat.h 2017-08-29 01:49:00.675330213 +0200
+++ mpg123-1.25.10/src/compat/compat.h 2017-08-29 01:50:34.099493907 +0200
@@ -85,7 +85,8 @@
#include <sys/time.h>
#endif
/* For select(), I need select.h according to POSIX 2001, else: sys/time.h sys/types.h unistd.h */
-#ifdef HAVE_SYS_SELECT_H
+/* PSP2: Including sys/select.h results in fd_set undefined error */
+#if defined(HAVE_SYS_SELECT_H) && !defined(PSP2)
#include <sys/select.h>
#endif
diff -Naur mpg123-1.25.10-old/src/control_generic.c mpg123-1.25.10/src/control_generic.c
--- mpg123-1.25.10-old/src/control_generic.c 2017-08-29 01:49:00.668663487 +0200
+++ mpg123-1.25.10/src/control_generic.c 2017-08-29 01:50:15.649329482 +0200
@@ -28,8 +28,10 @@
#include <ctype.h>
#if !defined (WIN32) || defined (__CYGWIN__)
#include <sys/wait.h>
+#ifdef NETWORK
#include <sys/socket.h>
#endif
+#endif
#include <errno.h>
#include <string.h>
@@ -311,8 +313,11 @@
outstream = stderr;
else
outstream = stdout;
-
-#ifndef WIN32
+
+#if defined(GEKKO) || defined(_3DS)
+ fprintf(outstream, "The control interface is not supported on this platform\n");
+ return 0;
+#elif !defined(WIN32)
setlinebuf(outstream);
#else /* perhaps just use setvbuf as it's C89 */
/*
diff -Naur mpg123-1.25.10-old/src/mpg123.c mpg123-1.25.10/src/mpg123.c
--- mpg123-1.25.10-old/src/mpg123.c 2017-08-29 01:49:00.668663487 +0200
+++ mpg123-1.25.10/src/mpg123.c 2017-08-29 01:49:54.475807710 +0200
@@ -1239,6 +1239,8 @@
if(param.verbose > 2) fprintf(stderr, "Note: pausing %i seconds before next track.\n", param.delay);
#ifdef WIN32
Sleep(param.delay*1000);
+#elif !defined(HAVE_SLEEP)
+ fprintf(stderr, "sleep not supported on this platform\n");
#else
sleep(param.delay);
#endif