Merge pull request #12085 from crystalct/master

Add some PSL1GHT ifdefs
This commit is contained in:
Autechre 2021-03-02 22:08:01 +01:00 committed by GitHub
commit 6957a766ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 60 additions and 2 deletions

View File

@ -31,6 +31,20 @@
#include "drivers/rsound.h"
#ifdef __PS3__
#ifdef __PSL1GHT__
#include <sysmodule/sysmodule.h>
#include <sys/systime.h>
#include <net/net.h>
#else
#include <cell/sysmodule.h>
#include <sys/timer.h>
#include <sys/sys_time.h>
#include <netex/net.h>
#include <netex/errno.h>
#endif
#endif
#if defined(GEKKO)
#include <network.h>
#else
@ -43,8 +57,16 @@
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#ifdef __PS3__
#ifdef __PSL1GHT__
#include <net/poll.h>
#else
#include <sys/poll.h>
#endif
#else
#include <poll.h>
#endif
#endif
#include <fcntl.h>
#ifdef _WIN32
#include <direct.h>
@ -94,7 +116,16 @@ enum rsd_conn_type
#define RSD_ERR(fmt, args...)
#define RSD_DEBUG(fmt, args...)
#if defined(GEKKO)
#if defined(__PS3__)
static int init_count = 0;
#define pollfd_fd(x) x.fd
#define net_send(a,b,c,d) send(a,b,c,d)
#define net_socket(a,b,c) socket(a,b,c)
#define net_connect(a,b,c) connect(a,b,c)
#define net_shutdown(a,b) shutdown(a,b)
#define net_socketclose(x) socketclose(x)
#define net_recv(a,b,c,d) recv(a,b,c,d)
#elif defined(GEKKO)
#define SHUT_RD 0
#define socketpoll(x, y, z) net_poll(x, y, z)
@ -232,8 +263,13 @@ static int rsnd_connect_server( rsound_t *rd )
/* Uses non-blocking IO since it performed more deterministic with poll()/send() */
#ifdef __PS3__
setsockopt(rd->conn.socket, SOL_SOCKET, SO_NBIO, &i, sizeof(int));
setsockopt(rd->conn.ctl_socket, SOL_SOCKET, SO_NBIO, &i, sizeof(int));
#else
fcntl(rd->conn.socket, F_SETFL, O_NONBLOCK);
fcntl(rd->conn.ctl_socket, F_SETFL, O_NONBLOCK);
#endif
/* Nonblocking connect with 3 second timeout */
net_connect(rd->conn.socket, (struct sockaddr*)&addr, sizeof(addr));
@ -698,6 +734,8 @@ static int64_t rsnd_get_time_usec(void)
if (!QueryPerformanceCounter(&count))
return 0;
return count.QuadPart * 1000000 / freq.QuadPart;
#elif defined(__PS3__)
return sysGetSystemTime();
#elif defined(GEKKO)
return ticks_to_microsecs(gettime());
#elif defined(__MACH__) // OSX doesn't have clock_gettime ...
@ -1346,7 +1384,12 @@ int rsd_exec(rsound_t *rsound)
rsnd_stop_thread(rsound);
#ifdef __PS3__
int i = 0;
setsockopt(rsound->conn.socket, SOL_SOCKET, SO_NBIO, &i, sizeof(int));
#else
fcntl(rsound->conn.socket, F_SETFL, O_NONBLOCK);
#endif
/* Flush the buffer */
if (FIFO_READ_AVAIL(rsound->fifo_buffer) > 0 )
@ -1533,6 +1576,15 @@ int rsd_init(rsound_t** rsound)
rsd_set_param(*rsound, RSD_HOST, RSD_DEFAULT_HOST);
rsd_set_param(*rsound, RSD_PORT, RSD_DEFAULT_PORT);
#ifdef __PS3__
if (init_count == 0)
{
sysModuleLoad(SYSMODULE_NET);
netInitialize();
init_count++;
}
#endif
return 0;
}

View File

@ -73,13 +73,19 @@ extern int audioAddData(uint32_t portNum, float *data,
#define sysLwMutexCreate sys_lwmutex_create
#define AUDIO_BLOCK_SAMPLES CELL_AUDIO_BLOCK_SAMPLES
#define SYSMODULE_NET CELL_SYSMODULE_NET
#define PS3_SYS_NO_TIMEOUT SYS_NO_TIMEOUT
#define sys_lwmutex_attr_t sys_lwmutex_attribute_t
#define sys_lwcond_attr_t sys_lwcond_attribute_t
#define sys_sem_t sys_semaphore_t
#define sysGetSystemTime sys_time_get_system_time
#define sysModuleLoad cellSysmoduleLoadModule
#define sysModuleUnload cellSysmoduleUnloadModule
#define netInitialize sys_net_initialize_network
#endif
/*============================================================