mirror of
https://github.com/libretro/RetroArch
synced 2025-04-02 07:20:34 +00:00
Fix C++ comments
This commit is contained in:
parent
6be8dccd46
commit
ace21d28f7
@ -79,13 +79,14 @@ static void *gx_audio_init(const char *device,
|
|||||||
AIInit(NULL);
|
AIInit(NULL);
|
||||||
AIRegisterDMACallback(dma_callback);
|
AIRegisterDMACallback(dma_callback);
|
||||||
|
|
||||||
//ranges 0-32000 (default low) and 40000-47999 (in settings going down from 48000) -> set to 32000 hz
|
/* Ranges 0-32000 (default low) and 40000-47999
|
||||||
|
(in settings going down from 48000) -> set to 32000 hz */
|
||||||
if (rate <= 32000 || (rate >= 40000 && rate < 48000))
|
if (rate <= 32000 || (rate >= 40000 && rate < 48000))
|
||||||
{
|
{
|
||||||
AISetDSPSampleRate(AI_SAMPLERATE_32KHZ);
|
AISetDSPSampleRate(AI_SAMPLERATE_32KHZ);
|
||||||
*new_rate = 32000;
|
*new_rate = 32000;
|
||||||
}
|
}
|
||||||
else //ranges 32001-39999 (in settings going up from 32000) and 48000-max (default high) -> set to 48000 hz
|
else /* Ranges 32001-39999 (in settings going up from 32000) and 48000-max (default high) -> set to 48000 hz */
|
||||||
{
|
{
|
||||||
AISetDSPSampleRate(AI_SAMPLERATE_48KHZ);
|
AISetDSPSampleRate(AI_SAMPLERATE_48KHZ);
|
||||||
*new_rate = 48000;
|
*new_rate = 48000;
|
||||||
@ -93,7 +94,7 @@ static void *gx_audio_init(const char *device,
|
|||||||
|
|
||||||
wa->dma_write = BLOCKS - 1;
|
wa->dma_write = BLOCKS - 1;
|
||||||
DCFlushRange(wa->data, sizeof(wa->data));
|
DCFlushRange(wa->data, sizeof(wa->data));
|
||||||
stop_audio = false;
|
stop_audio = false;
|
||||||
AIInitDMA((uint32_t)wa->data[wa->dma_next], CHUNK_SIZE);
|
AIInitDMA((uint32_t)wa->data[wa->dma_next], CHUNK_SIZE);
|
||||||
AIStartDMA();
|
AIStartDMA();
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ fail_audio_output:
|
|||||||
fail_audio_ipc:
|
fail_audio_ipc:
|
||||||
switch_audio_ipc_finalize();
|
switch_audio_ipc_finalize();
|
||||||
fail:
|
fail:
|
||||||
free(swa); // freeing a null ptr is valid
|
free(swa); /* freeing a NULL ptr is valid */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@
|
|||||||
****************************************************************************
|
****************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Internal enumerations
|
/* Internal enumerations */
|
||||||
enum rsd_logtype
|
enum rsd_logtype
|
||||||
{
|
{
|
||||||
RSD_LOG_DEBUG = 0,
|
RSD_LOG_DEBUG = 0,
|
||||||
@ -111,7 +111,7 @@ enum rsd_conn_type
|
|||||||
RSD_CONN_PROTO = 0x100
|
RSD_CONN_PROTO = 0x100
|
||||||
};
|
};
|
||||||
|
|
||||||
// Some logging macros.
|
/* Some logging macros. */
|
||||||
#define RSD_WARN(fmt, args...)
|
#define RSD_WARN(fmt, args...)
|
||||||
#define RSD_ERR(fmt, args...)
|
#define RSD_ERR(fmt, args...)
|
||||||
#define RSD_DEBUG(fmt, args...)
|
#define RSD_DEBUG(fmt, args...)
|
||||||
@ -159,7 +159,7 @@ static size_t rsnd_get_delay(rsound_t *rd);
|
|||||||
static size_t rsnd_get_ptr(rsound_t *rd);
|
static size_t rsnd_get_ptr(rsound_t *rd);
|
||||||
static int rsnd_reset(rsound_t *rd);
|
static int rsnd_reset(rsound_t *rd);
|
||||||
|
|
||||||
// Protocol functions
|
/* Protocol functions */
|
||||||
static int rsnd_send_identity_info(rsound_t *rd);
|
static int rsnd_send_identity_info(rsound_t *rd);
|
||||||
static int rsnd_close_ctl(rsound_t *rd);
|
static int rsnd_close_ctl(rsound_t *rd);
|
||||||
static int rsnd_send_info_query(rsound_t *rd);
|
static int rsnd_send_info_query(rsound_t *rd);
|
||||||
@ -328,7 +328,7 @@ static int rsnd_send_header_info(rsound_t *rd)
|
|||||||
uint16_t temp_bits = 8 * rsnd_format_to_samplesize(rd->format);
|
uint16_t temp_bits = 8 * rsnd_format_to_samplesize(rd->format);
|
||||||
uint16_t temp_format = rd->format;
|
uint16_t temp_format = rd->format;
|
||||||
|
|
||||||
// Checks the format for native endian which will need to be set properly.
|
/* Checks the format for native endian which will need to be set properly. */
|
||||||
switch ( temp_format )
|
switch ( temp_format )
|
||||||
{
|
{
|
||||||
case RSD_S16_NE:
|
case RSD_S16_NE:
|
||||||
@ -365,7 +365,7 @@ static int rsnd_send_header_info(rsound_t *rd)
|
|||||||
to determine whether we're running it or not, so we can byte swap accordingly.
|
to determine whether we're running it or not, so we can byte swap accordingly.
|
||||||
Could determine this compile time, but it was simpler to do it this way. */
|
Could determine this compile time, but it was simpler to do it this way. */
|
||||||
|
|
||||||
// Fancy macros for embedding little endian values into the header.
|
/* Fancy macros for embedding little endian values into the header. */
|
||||||
#define SET32(buf,offset,x) (*((uint32_t*)(buf+offset)) = x)
|
#define SET32(buf,offset,x) (*((uint32_t*)(buf+offset)) = x)
|
||||||
#define SET16(buf,offset,x) (*((uint16_t*)(buf+offset)) = x)
|
#define SET16(buf,offset,x) (*((uint16_t*)(buf+offset)) = x)
|
||||||
|
|
||||||
@ -383,7 +383,7 @@ static int rsnd_send_header_info(rsound_t *rd)
|
|||||||
LSB32(temp32);
|
LSB32(temp32);
|
||||||
SET32(header, 16, temp32);
|
SET32(header, 16, temp32);
|
||||||
|
|
||||||
temp16 = 0; // PCM data
|
temp16 = 0; /* PCM data */
|
||||||
|
|
||||||
switch( rd->format )
|
switch( rd->format )
|
||||||
{
|
{
|
||||||
@ -404,10 +404,10 @@ static int rsnd_send_header_info(rsound_t *rd)
|
|||||||
LSB16(temp16);
|
LSB16(temp16);
|
||||||
SET16(header, 20, temp16);
|
SET16(header, 20, temp16);
|
||||||
|
|
||||||
// Channels here
|
/* Channels here */
|
||||||
LSB16(temp_channels);
|
LSB16(temp_channels);
|
||||||
SET16(header, CHANNEL, temp_channels);
|
SET16(header, CHANNEL, temp_channels);
|
||||||
// Samples per sec
|
/* Samples per sec */
|
||||||
LSB32(temp_rate);
|
LSB32(temp_rate);
|
||||||
SET32(header, RATE, temp_rate);
|
SET32(header, RATE, temp_rate);
|
||||||
|
|
||||||
@ -419,7 +419,7 @@ static int rsnd_send_header_info(rsound_t *rd)
|
|||||||
LSB16(temp16);
|
LSB16(temp16);
|
||||||
SET16(header, 32, temp16);
|
SET16(header, 32, temp16);
|
||||||
|
|
||||||
// Bits per sample
|
/* Bits per sample */
|
||||||
LSB16(temp_bits);
|
LSB16(temp_bits);
|
||||||
SET16(header, FRAMESIZE, temp_bits);
|
SET16(header, FRAMESIZE, temp_bits);
|
||||||
|
|
||||||
@ -450,7 +450,7 @@ static int rsnd_get_backend_info ( rsound_t *rd )
|
|||||||
#define LATENCY 0
|
#define LATENCY 0
|
||||||
#define CHUNKSIZE 1
|
#define CHUNKSIZE 1
|
||||||
|
|
||||||
// Header is 2 uint32_t's. = 8 bytes.
|
/* Header is 2 uint32_t's. = 8 bytes. */
|
||||||
uint32_t rsnd_header[2] = {0};
|
uint32_t rsnd_header[2] = {0};
|
||||||
|
|
||||||
if ( rsnd_recv_chunk(rd->conn.socket, rsnd_header, RSND_HEADER_SIZE, 1) != RSND_HEADER_SIZE )
|
if ( rsnd_recv_chunk(rd->conn.socket, rsnd_header, RSND_HEADER_SIZE, 1) != RSND_HEADER_SIZE )
|
||||||
@ -470,7 +470,7 @@ static int rsnd_get_backend_info ( rsound_t *rd )
|
|||||||
rd->backend_info.latency = rsnd_header[LATENCY];
|
rd->backend_info.latency = rsnd_header[LATENCY];
|
||||||
rd->backend_info.chunk_size = rsnd_header[CHUNKSIZE];
|
rd->backend_info.chunk_size = rsnd_header[CHUNKSIZE];
|
||||||
|
|
||||||
#define MAX_CHUNK_SIZE 1024 // We do not want larger chunk sizes than this.
|
#define MAX_CHUNK_SIZE 1024 /* We do not want larger chunk sizes than this. */
|
||||||
if ( rd->backend_info.chunk_size > MAX_CHUNK_SIZE || rd->backend_info.chunk_size <= 0 )
|
if ( rd->backend_info.chunk_size > MAX_CHUNK_SIZE || rd->backend_info.chunk_size <= 0 )
|
||||||
rd->backend_info.chunk_size = MAX_CHUNK_SIZE;
|
rd->backend_info.chunk_size = MAX_CHUNK_SIZE;
|
||||||
|
|
||||||
@ -487,7 +487,7 @@ static int rsnd_get_backend_info ( rsound_t *rd )
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only bother with setting network buffer size if we're doing TCP.
|
/* Only bother with setting network buffer size if we're doing TCP. */
|
||||||
if ( rd->conn_type & RSD_CONN_TCP )
|
if ( rd->conn_type & RSD_CONN_TCP )
|
||||||
{
|
{
|
||||||
#define MAX_TCP_BUFSIZE (1 << 14)
|
#define MAX_TCP_BUFSIZE (1 << 14)
|
||||||
@ -507,17 +507,17 @@ static int rsnd_get_backend_info ( rsound_t *rd )
|
|||||||
setsockopt(rd->conn.ctl_socket, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int));
|
setsockopt(rd->conn.ctl_socket, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can we read the last 8 bytes so we can use the protocol interface?
|
/* Can we read the last 8 bytes so we can use the protocol interface? */
|
||||||
// This is non-blocking.
|
/* This is non-blocking. */
|
||||||
if ( rsnd_recv_chunk(rd->conn.socket, rsnd_header, RSND_HEADER_SIZE, 0) == RSND_HEADER_SIZE )
|
if ( rsnd_recv_chunk(rd->conn.socket, rsnd_header, RSND_HEADER_SIZE, 0) == RSND_HEADER_SIZE )
|
||||||
rd->conn_type |= RSD_CONN_PROTO;
|
rd->conn_type |= RSD_CONN_PROTO;
|
||||||
else
|
else
|
||||||
{ RSD_DEBUG("[RSound] Failed to get new proto.\n"); }
|
{ RSD_DEBUG("[RSound] Failed to get new proto.\n"); }
|
||||||
|
|
||||||
// We no longer want to read from this socket.
|
/* We no longer want to read from this socket. */
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
net_shutdown(rd->conn.socket, SD_RECEIVE);
|
net_shutdown(rd->conn.socket, SD_RECEIVE);
|
||||||
#elif !defined(__APPLE__) // OSX doesn't seem to like shutdown()
|
#elif !defined(__APPLE__) /* OSX doesn't seem to like shutdown() */
|
||||||
net_shutdown(rd->conn.socket, SHUT_RD);
|
net_shutdown(rd->conn.socket, SHUT_RD);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -727,7 +727,7 @@ static int64_t rsnd_get_time_usec(void)
|
|||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
static LARGE_INTEGER freq;
|
static LARGE_INTEGER freq;
|
||||||
if (!freq.QuadPart && !QueryPerformanceFrequency(&freq)) // Frequency is guaranteed to not change.
|
if (!freq.QuadPart && !QueryPerformanceFrequency(&freq)) /* Frequency is guaranteed to not change. */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
LARGE_INTEGER count;
|
LARGE_INTEGER count;
|
||||||
@ -738,7 +738,7 @@ static int64_t rsnd_get_time_usec(void)
|
|||||||
return sysGetSystemTime();
|
return sysGetSystemTime();
|
||||||
#elif defined(GEKKO)
|
#elif defined(GEKKO)
|
||||||
return ticks_to_microsecs(gettime());
|
return ticks_to_microsecs(gettime());
|
||||||
#elif defined(__MACH__) // OSX doesn't have clock_gettime ...
|
#elif defined(__MACH__) /* OSX doesn't have clock_gettime ... */
|
||||||
clock_serv_t cclock;
|
clock_serv_t cclock;
|
||||||
mach_timespec_t mts;
|
mach_timespec_t mts;
|
||||||
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
|
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
|
||||||
@ -818,10 +818,14 @@ static size_t rsnd_fill_buffer(rsound_t *rd, const char *buf, size_t size)
|
|||||||
slock_lock(rd->thread.mutex);
|
slock_lock(rd->thread.mutex);
|
||||||
fifo_write(rd->fifo_buffer, buf, size);
|
fifo_write(rd->fifo_buffer, buf, size);
|
||||||
slock_unlock(rd->thread.mutex);
|
slock_unlock(rd->thread.mutex);
|
||||||
//RSD_DEBUG("[RSound] fill_buffer: Wrote to buffer.\n");
|
#if 0
|
||||||
|
RSD_DEBUG("[RSound] fill_buffer: Wrote to buffer.\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Send signal to thread that buffer has been updated */
|
/* Send signal to thread that buffer has been updated */
|
||||||
//RSD_DEBUG("[RSound] fill_buffer: Waking up thread.\n");
|
#if 0
|
||||||
|
RSD_DEBUG("[RSound] fill_buffer: Waking up thread.\n");
|
||||||
|
#endif
|
||||||
scond_signal(rd->thread.cond);
|
scond_signal(rd->thread.cond);
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
@ -941,7 +945,7 @@ static int rsnd_close_ctl(rsound_t *rd)
|
|||||||
else if ( fd.revents & POLLHUP )
|
else if ( fd.revents & POLLHUP )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Let's wait for reply (or POLLHUP)
|
/* Let's wait for reply (or POLLHUP) */
|
||||||
|
|
||||||
fd.events = POLLIN;
|
fd.events = POLLIN;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
@ -958,14 +962,14 @@ static int rsnd_close_ctl(rsound_t *rd)
|
|||||||
if (fd.revents & POLLIN)
|
if (fd.revents & POLLIN)
|
||||||
{
|
{
|
||||||
const char *subchar;
|
const char *subchar;
|
||||||
|
/* We just read everything in large chunks until we find
|
||||||
// We just read everything in large chunks until we find what we're looking for
|
* what we're looking for */
|
||||||
int rc = net_recv(rd->conn.ctl_socket, buf + index, RSD_PROTO_MAXSIZE*2 - 1 - index, 0);
|
int rc = net_recv(rd->conn.ctl_socket, buf + index, RSD_PROTO_MAXSIZE*2 - 1 - index, 0);
|
||||||
|
|
||||||
if (rc <= 0 )
|
if (rc <= 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Can we find it directly?
|
/* Can we find it directly? */
|
||||||
if ( strstr(buf, "RSD 12 CLOSECTL OK") != NULL )
|
if ( strstr(buf, "RSD 12 CLOSECTL OK") != NULL )
|
||||||
break;
|
break;
|
||||||
else if ( strstr(buf, "RSD 15 CLOSECTL ERROR") != NULL )
|
else if ( strstr(buf, "RSD 15 CLOSECTL ERROR") != NULL )
|
||||||
@ -989,8 +993,9 @@ static int rsnd_close_ctl(rsound_t *rd)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sends delay info request to server on the ctl socket. This code section isn't critical, and will work if it works.
|
/* Sends delay info request to server on the ctl socket.
|
||||||
// It will never block.
|
* This code section isn't critical, and will work if it works.
|
||||||
|
* It will never block. */
|
||||||
static int rsnd_send_info_query(rsound_t *rd)
|
static int rsnd_send_info_query(rsound_t *rd)
|
||||||
{
|
{
|
||||||
char tmpbuf[RSD_PROTO_MAXSIZE];
|
char tmpbuf[RSD_PROTO_MAXSIZE];
|
||||||
@ -1007,15 +1012,15 @@ static int rsnd_send_info_query(rsound_t *rd)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We check if there's any pending delay information from the server.
|
/* We check if there's any pending delay information from the server.
|
||||||
// In that case, we read the packet.
|
* In that case, we read the packet. */
|
||||||
static int rsnd_update_server_info(rsound_t *rd)
|
static int rsnd_update_server_info(rsound_t *rd)
|
||||||
{
|
{
|
||||||
long long int client_ptr = -1;
|
long long int client_ptr = -1;
|
||||||
long long int serv_ptr = -1;
|
long long int serv_ptr = -1;
|
||||||
char temp[RSD_PROTO_MAXSIZE + 1] = {0};
|
char temp[RSD_PROTO_MAXSIZE + 1] = {0};
|
||||||
|
|
||||||
// We read until we have the last (most recent) data in the network buffer.
|
/* We read until we have the last (most recent) data in the network buffer. */
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
ssize_t rc;
|
ssize_t rc;
|
||||||
@ -1023,7 +1028,7 @@ static int rsnd_update_server_info(rsound_t *rd)
|
|||||||
char *tmpstr;
|
char *tmpstr;
|
||||||
memset(temp, 0, sizeof(temp));
|
memset(temp, 0, sizeof(temp));
|
||||||
|
|
||||||
// We first recieve the small header. We just use the larger buffer as it is disposable.
|
/* We first recieve the small header. We just use the larger buffer as it is disposable. */
|
||||||
rc = rsnd_recv_chunk(rd->conn.ctl_socket, temp, RSD_PROTO_CHUNKSIZE, 0);
|
rc = rsnd_recv_chunk(rd->conn.ctl_socket, temp, RSD_PROTO_CHUNKSIZE, 0);
|
||||||
if ( rc == 0 )
|
if ( rc == 0 )
|
||||||
break;
|
break;
|
||||||
@ -1035,22 +1040,22 @@ static int rsnd_update_server_info(rsound_t *rd)
|
|||||||
if (!(substr = strstr(temp, "RSD")))
|
if (!(substr = strstr(temp, "RSD")))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Jump over "RSD" in header
|
/* Jump over "RSD" in header */
|
||||||
substr += 3;
|
substr += 3;
|
||||||
|
|
||||||
// The length of the argument message is stored in the small 8 byte header.
|
/* The length of the argument message is stored in the small 8 byte header. */
|
||||||
long int len = strtol(substr, NULL, 0);
|
long int len = strtol(substr, NULL, 0);
|
||||||
|
|
||||||
// Recieve the rest of the data.
|
/* Recieve the rest of the data. */
|
||||||
if ( rsnd_recv_chunk(rd->conn.ctl_socket, temp, len, 0) < len )
|
if ( rsnd_recv_chunk(rd->conn.ctl_socket, temp, len, 0) < len )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// We only bother if this is an INFO message.
|
/* We only bother if this is an INFO message. */
|
||||||
substr = strstr(temp, "INFO");
|
substr = strstr(temp, "INFO");
|
||||||
if (!substr)
|
if (!substr)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Jump over "INFO" in header
|
/* Jump over "INFO" in header */
|
||||||
substr += 4;
|
substr += 4;
|
||||||
|
|
||||||
client_ptr = strtoull(substr, &tmpstr, 0);
|
client_ptr = strtoull(substr, &tmpstr, 0);
|
||||||
@ -1074,7 +1079,7 @@ static int rsnd_update_server_info(rsound_t *rd)
|
|||||||
|
|
||||||
RSD_DEBUG("[RSound] Delay: %d, Delta: %d.\n", delay, delta);
|
RSD_DEBUG("[RSound] Delay: %d, Delta: %d.\n", delay, delta);
|
||||||
|
|
||||||
// We only update the pointer if the data we got is quite recent.
|
/* We only update the pointer if the data we got is quite recent. */
|
||||||
if ( rd->total_written - client_ptr < 4 * rd->backend_info.chunk_size && rd->total_written > client_ptr )
|
if ( rd->total_written - client_ptr < 4 * rd->backend_info.chunk_size && rd->total_written > client_ptr )
|
||||||
{
|
{
|
||||||
int offset_delta = delta - delay;
|
int offset_delta = delta - delay;
|
||||||
@ -1094,7 +1099,7 @@ static int rsnd_update_server_info(rsound_t *rd)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort of simulates the behavior of pthread_cancel()
|
/* Sort of simulates the behavior of pthread_cancel() */
|
||||||
#define _TEST_CANCEL() \
|
#define _TEST_CANCEL() \
|
||||||
if ( !rd->thread_active ) \
|
if ( !rd->thread_active ) \
|
||||||
break
|
break
|
||||||
@ -1115,8 +1120,8 @@ static void rsnd_thread ( void * thread_data )
|
|||||||
{
|
{
|
||||||
_TEST_CANCEL();
|
_TEST_CANCEL();
|
||||||
|
|
||||||
// We ask the server to send its latest backend data. Do not really care about errors atm.
|
/* We ask the server to send its latest backend data. Do not really care about errors atm.
|
||||||
// We only bother to check after 1 sec of audio has been played, as it might be quite inaccurate in the start of the stream.
|
* We only bother to check after 1 sec of audio has been played, as it might be quite inaccurate in the start of the stream. */
|
||||||
if ( (rd->conn_type & RSD_CONN_PROTO) && (rd->total_written > rd->channels * rd->rate * rd->samplesize) )
|
if ( (rd->conn_type & RSD_CONN_PROTO) && (rd->total_written > rd->channels * rd->rate * rd->samplesize) )
|
||||||
{
|
{
|
||||||
rsnd_send_info_query(rd);
|
rsnd_send_info_query(rd);
|
||||||
@ -1175,8 +1180,9 @@ static void rsnd_thread ( void * thread_data )
|
|||||||
|
|
||||||
if ( rd->thread_active )
|
if ( rd->thread_active )
|
||||||
{
|
{
|
||||||
// There is a very slim change of getting a deadlock using the cond_wait scheme.
|
/* There is a very slim change of getting a deadlock using the cond_wait scheme.
|
||||||
// This solution is rather dirty, but avoids complete deadlocks at the very least.
|
* This solution is rather dirty, but avoids complete deadlocks at the very least.
|
||||||
|
*/
|
||||||
|
|
||||||
slock_lock(rd->thread.cond_mutex);
|
slock_lock(rd->thread.cond_mutex);
|
||||||
scond_signal(rd->thread.cond);
|
scond_signal(rd->thread.cond);
|
||||||
@ -1243,9 +1249,10 @@ static void rsnd_cb_thread(void *thread_data)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// The network might do things in large chunks, so it may request large amounts of data in short periods of time.
|
/* The network might do things in large chunks, so it may request large amounts of data in short periods of time.
|
||||||
// This breaks when the caller cannot buffer up big buffers beforehand, so do short sleeps inbetween.
|
* This breaks when the caller cannot buffer up big buffers beforehand, so do short sleeps inbetween.
|
||||||
// This is somewhat dirty, but I cannot see a better solution
|
* This is somewhat dirty, but I cannot see a better solution
|
||||||
|
*/
|
||||||
retro_sleep(1);
|
retro_sleep(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1306,13 +1313,13 @@ static int rsnd_reset(rsound_t *rd)
|
|||||||
|
|
||||||
int rsd_stop(rsound_t *rd)
|
int rsd_stop(rsound_t *rd)
|
||||||
{
|
{
|
||||||
|
const char buf[] = "RSD 5 STOP";
|
||||||
|
|
||||||
retro_assert(rd != NULL);
|
retro_assert(rd != NULL);
|
||||||
rsnd_stop_thread(rd);
|
rsnd_stop_thread(rd);
|
||||||
|
|
||||||
const char buf[] = "RSD 5 STOP";
|
/* Do not really care about errors here.
|
||||||
|
* The socket will be closed down in any case in rsnd_reset(). */
|
||||||
// Do not really care about errors here.
|
|
||||||
// The socket will be closed down in any case in rsnd_reset().
|
|
||||||
rsnd_send_chunk(rd->conn.ctl_socket, buf, strlen(buf), 0);
|
rsnd_send_chunk(rd->conn.ctl_socket, buf, strlen(buf), 0);
|
||||||
|
|
||||||
rsnd_reset(rd);
|
rsnd_reset(rd);
|
||||||
@ -1364,7 +1371,7 @@ int rsd_exec(rsound_t *rsound)
|
|||||||
retro_assert(rsound != NULL);
|
retro_assert(rsound != NULL);
|
||||||
RSD_DEBUG("[RSound] rsd_exec().\n");
|
RSD_DEBUG("[RSound] rsd_exec().\n");
|
||||||
|
|
||||||
// Makes sure we have a working connection
|
/* Makes sure we have a working connection */
|
||||||
if ( rsound->conn.socket < 0 )
|
if ( rsound->conn.socket < 0 )
|
||||||
{
|
{
|
||||||
RSD_DEBUG("[RSound] Calling rsd_start().\n");
|
RSD_DEBUG("[RSound] Calling rsd_start().\n");
|
||||||
@ -1459,7 +1466,7 @@ int rsd_set_param(rsound_t *rd, enum rsd_settings option, void* param)
|
|||||||
rd->max_latency = *((int*)param);
|
rd->max_latency = *((int*)param);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Checks if format is valid.
|
/* Checks if format is valid. */
|
||||||
case RSD_FORMAT:
|
case RSD_FORMAT:
|
||||||
rd->format = (uint16_t)(*((int*)param));
|
rd->format = (uint16_t)(*((int*)param));
|
||||||
rd->samplesize = rsnd_format_to_samplesize(rd->format);
|
rd->samplesize = rsnd_format_to_samplesize(rd->format);
|
||||||
@ -1555,7 +1562,8 @@ int rsd_pause(rsound_t* rsound, int enable)
|
|||||||
|
|
||||||
int rsd_init(rsound_t** rsound)
|
int rsd_init(rsound_t** rsound)
|
||||||
{
|
{
|
||||||
*rsound = calloc(1, sizeof(rsound_t));
|
int format = RSD_S16_LE;
|
||||||
|
*rsound = calloc(1, sizeof(rsound_t));
|
||||||
if (*rsound == NULL)
|
if (*rsound == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -1569,8 +1577,7 @@ int rsd_init(rsound_t** rsound)
|
|||||||
(*rsound)->cb_lock = slock_new();
|
(*rsound)->cb_lock = slock_new();
|
||||||
(*rsound)->thread.cond = scond_new();
|
(*rsound)->thread.cond = scond_new();
|
||||||
|
|
||||||
// Assumes default of S16_LE samples.
|
/* Assumes default of S16_LE samples. */
|
||||||
int format = RSD_S16_LE;
|
|
||||||
rsd_set_param(*rsound, RSD_FORMAT, &format);
|
rsd_set_param(*rsound, RSD_FORMAT, &format);
|
||||||
|
|
||||||
rsd_set_param(*rsound, RSD_HOST, RSD_DEFAULT_HOST);
|
rsd_set_param(*rsound, RSD_HOST, RSD_DEFAULT_HOST);
|
||||||
|
@ -205,4 +205,4 @@ static INLINE void ctr_set_scale_vector(ctr_scale_vector_t* vec,
|
|||||||
vec->v = -1.0 / texture_height;
|
vec->v = -1.0 / texture_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CTR_COMMON_H__
|
#endif /* CTR_COMMON_H__ */
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#ifndef __FPGA_COMMON_H
|
#ifndef __FPGA_COMMON_H
|
||||||
#define __FPGA_COMMON_H
|
#define __FPGA_COMMON_H
|
||||||
|
|
||||||
#define NUMBER_OF_WRITE_FRAMES 1//XPAR_AXIVDMA_0_NUM_FSTORES
|
#define NUMBER_OF_WRITE_FRAMES 1 /* XPAR_AXIVDMA_0_NUM_FSTORES */
|
||||||
#define STORAGE_SIZE NUMBER_OF_WRITE_FRAMES * ((1920*1080)<<2)
|
#define STORAGE_SIZE NUMBER_OF_WRITE_FRAMES * ((1920*1080)<<2)
|
||||||
#define FRAME_SIZE (STORAGE_SIZE / NUMBER_OF_WRITE_FRAMES)
|
#define FRAME_SIZE (STORAGE_SIZE / NUMBER_OF_WRITE_FRAMES)
|
||||||
|
|
||||||
|
@ -159,9 +159,9 @@ matrix_float4x4 matrix_rotate_z(float rot)
|
|||||||
id<CAMetalDrawable> _drawable;
|
id<CAMetalDrawable> _drawable;
|
||||||
video_viewport_t _viewport;
|
video_viewport_t _viewport;
|
||||||
id<MTLSamplerState> _samplers[TEXTURE_FILTER_MIPMAP_NEAREST + 1];
|
id<MTLSamplerState> _samplers[TEXTURE_FILTER_MIPMAP_NEAREST + 1];
|
||||||
Filter *_filters[RPixelFormatCount]; // convert to bgra8888
|
Filter *_filters[RPixelFormatCount]; /* convert to BGRA8888 */
|
||||||
|
|
||||||
// main render pass state
|
/* Main render pass state */
|
||||||
id<MTLRenderCommandEncoder> _rce;
|
id<MTLRenderCommandEncoder> _rce;
|
||||||
|
|
||||||
id<MTLCommandBuffer> _blitCommandBuffer;
|
id<MTLCommandBuffer> _blitCommandBuffer;
|
||||||
@ -402,9 +402,9 @@ matrix_float4x4 matrix_rotate_z(float rot)
|
|||||||
{
|
{
|
||||||
vals = [MTLFunctionConstantValues new];
|
vals = [MTLFunctionConstantValues new];
|
||||||
float values[3] = {
|
float values[3] = {
|
||||||
1.25f, // baseScale
|
1.25f, /* baseScale */
|
||||||
0.50f, // density
|
0.50f, /* density */
|
||||||
0.15f, // speed
|
0.15f, /* speed */
|
||||||
};
|
};
|
||||||
[vals setConstantValue:&values[0] type:MTLDataTypeFloat withName:@"snowBaseScale"];
|
[vals setConstantValue:&values[0] type:MTLDataTypeFloat withName:@"snowBaseScale"];
|
||||||
[vals setConstantValue:&values[1] type:MTLDataTypeFloat withName:@"snowDensity"];
|
[vals setConstantValue:&values[1] type:MTLDataTypeFloat withName:@"snowDensity"];
|
||||||
@ -423,9 +423,9 @@ matrix_float4x4 matrix_rotate_z(float rot)
|
|||||||
{
|
{
|
||||||
vals = [MTLFunctionConstantValues new];
|
vals = [MTLFunctionConstantValues new];
|
||||||
float values[3] = {
|
float values[3] = {
|
||||||
3.50f, // baseScale
|
3.50f, /* baseScale */
|
||||||
0.70f, // density
|
0.70f, /* density */
|
||||||
0.25f, // speed
|
0.25f, /* speed */
|
||||||
};
|
};
|
||||||
[vals setConstantValue:&values[0] type:MTLDataTypeFloat withName:@"snowBaseScale"];
|
[vals setConstantValue:&values[0] type:MTLDataTypeFloat withName:@"snowBaseScale"];
|
||||||
[vals setConstantValue:&values[1] type:MTLDataTypeFloat withName:@"snowDensity"];
|
[vals setConstantValue:&values[1] type:MTLDataTypeFloat withName:@"snowDensity"];
|
||||||
@ -633,8 +633,10 @@ matrix_float4x4 matrix_rotate_z(float rot)
|
|||||||
if (_captureEnabled == captureEnabled)
|
if (_captureEnabled == captureEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_captureEnabled = captureEnabled;
|
_captureEnabled = captureEnabled;
|
||||||
//_layer.framebufferOnly = !captureEnabled;
|
#if 0
|
||||||
|
_layer.framebufferOnly = !captureEnabled;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)captureEnabled
|
- (bool)captureEnabled
|
||||||
@ -772,7 +774,7 @@ matrix_float4x4 matrix_rotate_z(float rot)
|
|||||||
[bce endEncoding];
|
[bce endEncoding];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// pending blits for mipmaps or render passes for slang shaders
|
/* Pending blits for mipmaps or render passes for slang shaders */
|
||||||
[_blitCommandBuffer commit];
|
[_blitCommandBuffer commit];
|
||||||
[_blitCommandBuffer waitUntilCompleted];
|
[_blitCommandBuffer waitUntilCompleted];
|
||||||
_blitCommandBuffer = nil;
|
_blitCommandBuffer = nil;
|
||||||
@ -829,7 +831,7 @@ matrix_float4x4 matrix_rotate_z(float rot)
|
|||||||
id<MTLDevice> _device;
|
id<MTLDevice> _device;
|
||||||
NSUInteger _blockLen;
|
NSUInteger _blockLen;
|
||||||
BufferNode *_head;
|
BufferNode *_head;
|
||||||
NSUInteger _offset; // offset into _current
|
NSUInteger _offset; /* offset into _current */
|
||||||
BufferNode *_current;
|
BufferNode *_current;
|
||||||
NSUInteger _length;
|
NSUInteger _length;
|
||||||
NSUInteger _allocated;
|
NSUInteger _allocated;
|
||||||
@ -1285,13 +1287,13 @@ static const NSUInteger kConstantAlignment = 4;
|
|||||||
@implementation TexturedView
|
@implementation TexturedView
|
||||||
{
|
{
|
||||||
Context *_context;
|
Context *_context;
|
||||||
id<MTLTexture> _texture; // optimal render texture
|
id<MTLTexture> _texture; /* Optimal render texture */
|
||||||
Vertex _v[4];
|
Vertex _v[4];
|
||||||
CGSize _size; // size of view in pixels
|
CGSize _size; /* Size of view in pixels */
|
||||||
CGRect _frame;
|
CGRect _frame;
|
||||||
NSUInteger _bpp;
|
NSUInteger _bpp;
|
||||||
|
|
||||||
id<MTLTexture> _src; // source texture
|
id<MTLTexture> _src; /* Source texture */
|
||||||
bool _srcDirty;
|
bool _srcDirty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -216,11 +216,12 @@ static void supertwoxsai_generic_xrgb8888(unsigned width, unsigned height,
|
|||||||
{
|
{
|
||||||
supertwoxsai_declare_variables(uint32_t, in, nextline);
|
supertwoxsai_declare_variables(uint32_t, in, nextline);
|
||||||
|
|
||||||
//--------------------------- B1 B2
|
/*--------------------------- B1 B2
|
||||||
// 4 5 6 S2
|
* 4 5 6 S2
|
||||||
// 1 2 3 S1
|
* 1 2 3 S1
|
||||||
// A1 A2
|
* A1 A2
|
||||||
//--------------------------------------
|
*--------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
supertwoxsai_function(supertwoxsai_result, supertwoxsai_interpolate_xrgb8888, supertwoxsai_interpolate2_xrgb8888);
|
supertwoxsai_function(supertwoxsai_result, supertwoxsai_interpolate_xrgb8888, supertwoxsai_interpolate2_xrgb8888);
|
||||||
}
|
}
|
||||||
@ -246,11 +247,12 @@ static void supertwoxsai_generic_rgb565(unsigned width, unsigned height,
|
|||||||
{
|
{
|
||||||
supertwoxsai_declare_variables(uint16_t, in, nextline);
|
supertwoxsai_declare_variables(uint16_t, in, nextline);
|
||||||
|
|
||||||
//--------------------------- B1 B2
|
/*--------------------------- B1 B2
|
||||||
// 4 5 6 S2
|
* 4 5 6 S2
|
||||||
// 1 2 3 S1
|
* 1 2 3 S1
|
||||||
// A1 A2
|
* A1 A2
|
||||||
//--------------------------------------
|
*--------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
supertwoxsai_function(supertwoxsai_result, supertwoxsai_interpolate_rgb565, supertwoxsai_interpolate2_rgb565);
|
supertwoxsai_function(supertwoxsai_result, supertwoxsai_interpolate_rgb565, supertwoxsai_interpolate2_rgb565);
|
||||||
}
|
}
|
||||||
@ -311,7 +313,8 @@ static void supertwoxsai_generic_packets(void *data,
|
|||||||
thr->width = width;
|
thr->width = width;
|
||||||
thr->height = y_end - y_start;
|
thr->height = y_end - y_start;
|
||||||
|
|
||||||
// Workers need to know if they can access pixels outside their given buffer.
|
/* Workers need to know if they can access pixels
|
||||||
|
* outside their given buffer. */
|
||||||
thr->first = y_start;
|
thr->first = y_start;
|
||||||
thr->last = y_end == height;
|
thr->last = y_end == height;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Needed for memfd_create
|
/* Needed for memfd_create */
|
||||||
#ifndef _GNU_SOURCE
|
#ifndef _GNU_SOURCE
|
||||||
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
||||||
#endif
|
#endif
|
||||||
@ -85,7 +85,7 @@ static void keyboard_handle_leave(void *data,
|
|||||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
|
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
|
||||||
wl->input.keyboard_focus = false;
|
wl->input.keyboard_focus = false;
|
||||||
|
|
||||||
// Release all keys
|
/* Release all keys */
|
||||||
memset(wl->input.key_state, 0, sizeof(wl->input.key_state));
|
memset(wl->input.key_state, 0, sizeof(wl->input.key_state));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -727,7 +727,7 @@ void* wayland_data_offer_receive(struct wl_display *display, struct wl_data_offe
|
|||||||
{
|
{
|
||||||
wl_data_offer_receive(offer, mime_type, pipefd[1]);
|
wl_data_offer_receive(offer, mime_type, pipefd[1]);
|
||||||
|
|
||||||
// Wait for sending client to transfer
|
/* Wait for sending client to transfer */
|
||||||
wl_display_roundtrip(display);
|
wl_display_roundtrip(display);
|
||||||
|
|
||||||
close(pipefd[1]);
|
close(pipefd[1]);
|
||||||
@ -849,9 +849,12 @@ static void data_device_handle_drop(void *data,
|
|||||||
line[strcspn(line, "\r\n")] = 0;
|
line[strcspn(line, "\r\n")] = 0;
|
||||||
RARCH_LOG("[Wayland]: > \"%s\"\n", line);
|
RARCH_LOG("[Wayland]: > \"%s\"\n", line);
|
||||||
|
|
||||||
// TODO: Convert from file:// URI, Implement file loading
|
/* TODO/FIXME: Convert from file:// URI, Implement file loading
|
||||||
//if (wayland_load_content_from_drop(g_filename_from_uri(line, NULL, NULL)))
|
* Drag and Drop */
|
||||||
// RARCH_WARN("----- wayland_load_content_from_drop success\n");
|
#if 0
|
||||||
|
if (wayland_load_content_from_drop(g_filename_from_uri(line, NULL, NULL)))
|
||||||
|
RARCH_WARN("----- wayland_load_content_from_drop success\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(stream);
|
fclose(stream);
|
||||||
@ -867,7 +870,7 @@ static void data_offer_handle_offer(void *data, struct wl_data_offer *offer,
|
|||||||
{
|
{
|
||||||
data_offer_ctx *offer_data = data;
|
data_offer_ctx *offer_data = data;
|
||||||
|
|
||||||
// TODO: Keep list of mime types for offer if beneficial
|
/* TODO: Keep list of mime types for offer if beneficial */
|
||||||
if (string_is_equal(mime_type, FILE_MIME))
|
if (string_is_equal(mime_type, FILE_MIME))
|
||||||
offer_data->is_file_mime_type = true;
|
offer_data->is_file_mime_type = true;
|
||||||
}
|
}
|
||||||
@ -875,8 +878,8 @@ static void data_offer_handle_offer(void *data, struct wl_data_offer *offer,
|
|||||||
static void data_offer_handle_source_actions(void *data,
|
static void data_offer_handle_source_actions(void *data,
|
||||||
struct wl_data_offer *offer, enum wl_data_device_manager_dnd_action actions)
|
struct wl_data_offer *offer, enum wl_data_device_manager_dnd_action actions)
|
||||||
{
|
{
|
||||||
// Report of actions for this offer supported by compositor
|
/* Report of actions for this offer supported by compositor */
|
||||||
data_offer_ctx *offer_data = data;
|
data_offer_ctx *offer_data = data;
|
||||||
offer_data->supported_actions = actions;
|
offer_data->supported_actions = actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,8 +42,8 @@ float cocoa_screen_get_backing_scale_factor(void);
|
|||||||
|
|
||||||
static bool apple_key_state[MAX_KEYS];
|
static bool apple_key_state[MAX_KEYS];
|
||||||
|
|
||||||
// Send keyboard inputs directly using RETROK_* codes
|
/* Send keyboard inputs directly using RETROK_* codes
|
||||||
// Used by the iOS custom keyboard implementation
|
* Used by the iOS custom keyboard implementation */
|
||||||
void apple_direct_input_keyboard_event(bool down,
|
void apple_direct_input_keyboard_event(bool down,
|
||||||
unsigned code, uint32_t character, uint32_t mod, unsigned device)
|
unsigned code, uint32_t character, uint32_t mod, unsigned device)
|
||||||
{
|
{
|
||||||
|
@ -358,64 +358,58 @@ static inline void initAttributeGem(gemAttribute * attribute,
|
|||||||
|
|
||||||
int initGemVideoConvert(ps3_input_t *ps3)
|
int initGemVideoConvert(ps3_input_t *ps3)
|
||||||
{
|
{
|
||||||
int ret;
|
ps3->gem_video_convert.version = 2;
|
||||||
|
ps3->gem_video_convert.format = 2; /* GEM_RGBA_640x480; */
|
||||||
ps3->gem_video_convert.version = 2;
|
ps3->gem_video_convert.conversion = GEM_AUTO_WHITE_BALANCE
|
||||||
ps3->gem_video_convert.format = 2; //GEM_RGBA_640x480;
|
| GEM_COMBINE_PREVIOUS_INPUT_FRAME
|
||||||
ps3->gem_video_convert.conversion= GEM_AUTO_WHITE_BALANCE | GEM_COMBINE_PREVIOUS_INPUT_FRAME |
|
| GEM_FILTER_OUTLIER_PIXELS
|
||||||
GEM_FILTER_OUTLIER_PIXELS | GEM_GAMMA_BOOST;
|
| GEM_GAMMA_BOOST;
|
||||||
ps3->gem_video_convert.gain = 1.0f;
|
ps3->gem_video_convert.gain = 1.0f;
|
||||||
ps3->gem_video_convert.red_gain = 1.0f;
|
ps3->gem_video_convert.red_gain = 1.0f;
|
||||||
ps3->gem_video_convert.green_gain = 1.0f;
|
ps3->gem_video_convert.green_gain = 1.0f;
|
||||||
ps3->gem_video_convert.blue_gain = 1.0f;
|
ps3->gem_video_convert.blue_gain = 1.0f;
|
||||||
ps3->buffer_mem = (void *)memalign(128, 640*480);
|
ps3->buffer_mem = (void *)memalign(128, 640*480);
|
||||||
ps3->video_out = (void *)ps3->video_frame;
|
ps3->video_out = (void *)ps3->video_frame;
|
||||||
ps3->gem_video_convert.buffer_memory = ps3->buffer_mem;
|
ps3->gem_video_convert.buffer_memory = ps3->buffer_mem;
|
||||||
ps3->gem_video_convert.video_data_out = ps3->video_out;
|
ps3->gem_video_convert.video_data_out = ps3->video_out;
|
||||||
ps3->gem_video_convert.alpha = 255;
|
ps3->gem_video_convert.alpha = 255;
|
||||||
ret = gemPrepareVideoConvert(&ps3->gem_video_convert);
|
|
||||||
return ret;
|
return gemPrepareVideoConvert(&ps3->gem_video_convert);
|
||||||
}
|
}
|
||||||
|
|
||||||
int initGem(ps3_input_t *ps3)
|
int initGem(ps3_input_t *ps3)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
int i;
|
int i;
|
||||||
|
gemAttribute gem_attr;
|
||||||
ret = initSpurs(ps3);
|
u8 gem_spu_priorities[8] = { 1, 1, 1, 1, 1, 0, 0, 0 }; /* execute */
|
||||||
if (ret)
|
/* libgem jobs */
|
||||||
{
|
/* on 5 SPUs */
|
||||||
|
if (initSpurs(ps3))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
ret = gemGetMemorySize(1);
|
ps3->gem_memory = (void *)malloc(gemGetMemorySize(1));
|
||||||
ps3->gem_memory = (void *)malloc(ret);
|
|
||||||
if (!ps3->gem_memory)
|
if (!ps3->gem_memory)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
u8 gem_spu_priorities[8] = { 1, 1, 1, 1, 1, 0, 0, 0 }; // execute
|
initAttributeGem(&gem_attr, 1, ps3->gem_memory,
|
||||||
// libgem jobs
|
ps3->spurs, gem_spu_priorities);
|
||||||
// on 5 spu
|
|
||||||
gemAttribute gem_attr;
|
|
||||||
|
|
||||||
initAttributeGem(&gem_attr, 1, ps3->gem_memory, ps3->spurs, gem_spu_priorities);
|
gemInit (&gem_attr);
|
||||||
|
initGemVideoConvert(ps3);
|
||||||
|
gemPrepareCamera (128, 0.5);
|
||||||
|
gemReset(0);
|
||||||
|
|
||||||
ret = gemInit (&gem_attr);
|
|
||||||
ret= initGemVideoConvert(ps3);
|
|
||||||
ret = gemPrepareCamera (128, 0.5);
|
|
||||||
ret = gemReset(0);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void readGemPad(ps3_input_t *ps3, int num_gem)
|
void readGemPad(ps3_input_t *ps3, int num_gem)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
unsigned int hues[] = { 4 << 24, 4 << 24, 4 << 24, 4 << 24 };
|
unsigned int hues[] = { 4 << 24, 4 << 24, 4 << 24, 4 << 24 };
|
||||||
ret = gemGetState (0, 0, -22000, &ps3->gem_state);
|
int ret = gemGetState(0, 0, -22000, &ps3->gem_state);
|
||||||
|
|
||||||
ps3->newGemPad = ps3->gem_state.paddata.buttons & (~ps3->oldGemPad);
|
ps3->newGemPad = ps3->gem_state.paddata.buttons & (~ps3->oldGemPad);
|
||||||
ps3->newGemAnalogT = ps3->gem_state.paddata.ANA_T;
|
ps3->newGemAnalogT = ps3->gem_state.paddata.ANA_T;
|
||||||
ps3->oldGemPad = ps3->gem_state.paddata.buttons;
|
ps3->oldGemPad = ps3->gem_state.paddata.buttons;
|
||||||
|
|
||||||
switch (ret)
|
switch (ret)
|
||||||
{
|
{
|
||||||
@ -441,10 +435,8 @@ void readGemAccPosition(int num_gem)
|
|||||||
|
|
||||||
void readGemInertial(ps3_input_t *ps3, int num_gem)
|
void readGemInertial(ps3_input_t *ps3, int num_gem)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
VmathVector4 v;
|
VmathVector4 v;
|
||||||
|
int ret = gemGetInertialState(num_gem, 0, -22000, &ps3->gem_inertial_state);
|
||||||
ret = gemGetInertialState(num_gem, 0, -22000, &ps3->gem_inertial_state);
|
|
||||||
v.vec128 = ps3->gem_inertial_state.accelerometer;
|
v.vec128 = ps3->gem_inertial_state.accelerometer;
|
||||||
v.vec128 = ps3->gem_inertial_state.accelerometer_bias;
|
v.vec128 = ps3->gem_inertial_state.accelerometer_bias;
|
||||||
v.vec128 = ps3->gem_inertial_state.gyro;
|
v.vec128 = ps3->gem_inertial_state.gyro;
|
||||||
@ -453,14 +445,16 @@ void readGemInertial(ps3_input_t *ps3, int num_gem)
|
|||||||
|
|
||||||
void readGem(ps3_input_t *ps3)
|
void readGem(ps3_input_t *ps3)
|
||||||
{
|
{
|
||||||
|
VmathVector4 v;
|
||||||
|
|
||||||
proccessGem(ps3, 0);
|
proccessGem(ps3, 0);
|
||||||
proccessGem(ps3, 1);
|
proccessGem(ps3, 1);
|
||||||
proccessGem(ps3, 2);
|
proccessGem(ps3, 2);
|
||||||
proccessGem(ps3, 3);
|
proccessGem(ps3, 3);
|
||||||
readGemPad(ps3, 0); // This will read buttons from Move
|
readGemPad(ps3, 0); /* This will read buttons from Move */
|
||||||
VmathVector4 v;
|
|
||||||
v.vec128 = ps3->gem_state.pos;
|
v.vec128 = ps3->gem_state.pos;
|
||||||
switch (ps3->newGemPad) {
|
switch (ps3->newGemPad)
|
||||||
|
{
|
||||||
case 1:
|
case 1:
|
||||||
ps3->select_pressed++;
|
ps3->select_pressed++;
|
||||||
break;
|
break;
|
||||||
@ -478,23 +472,27 @@ void readGem(ps3_input_t *ps3)
|
|||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
ps3->triangle_pressed++;
|
ps3->triangle_pressed++;
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
ps3->circle_pressed++;
|
ps3->circle_pressed++;
|
||||||
break;
|
break;
|
||||||
case 64:
|
case 64:
|
||||||
ps3->cross_pressed++;
|
ps3->cross_pressed++;
|
||||||
//readGemAccPosition(0);
|
#if 0
|
||||||
|
readGemAccPosition(0);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case 128:
|
case 128:
|
||||||
ps3->square_pressed++;
|
ps3->square_pressed++;
|
||||||
//readGemInertial(ps3, 0);
|
#if 0
|
||||||
|
readGemInertial(ps3, 0);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // HAVE_LIGHTGUN
|
#endif /* HAVE_LIGHTGUN */
|
||||||
|
|
||||||
static void ps3_input_poll(void *data)
|
static void ps3_input_poll(void *data)
|
||||||
{
|
{
|
||||||
@ -665,11 +663,14 @@ static int16_t ps3_mouse_device_state(ps3_input_t *ps3,
|
|||||||
static int16_t ps3_lightgun_device_state(ps3_input_t *ps3,
|
static int16_t ps3_lightgun_device_state(ps3_input_t *ps3,
|
||||||
unsigned user, unsigned id)
|
unsigned user, unsigned id)
|
||||||
{
|
{
|
||||||
if (!ps3->gem_connected || !ps3->gem_init)
|
float center_x;
|
||||||
return 0;
|
float center_y;
|
||||||
|
float pointer_x;
|
||||||
readCamera(ps3);
|
float pointer_y;
|
||||||
readGem(ps3);
|
videoState state;
|
||||||
|
videoConfiguration vconfig;
|
||||||
|
videoResolution res;
|
||||||
|
VmathVector4 ray_start, ray_dir;
|
||||||
struct video_viewport vp;
|
struct video_viewport vp;
|
||||||
const int edge_detect = 32700;
|
const int edge_detect = 32700;
|
||||||
bool inside = false;
|
bool inside = false;
|
||||||
@ -677,29 +678,27 @@ static int16_t ps3_lightgun_device_state(ps3_input_t *ps3,
|
|||||||
int16_t res_y = 0;
|
int16_t res_y = 0;
|
||||||
int16_t res_screen_x = 0;
|
int16_t res_screen_x = 0;
|
||||||
int16_t res_screen_y = 0;
|
int16_t res_screen_y = 0;
|
||||||
float center_x;
|
float sensitivity = 1.0f;
|
||||||
float center_y;
|
if (!ps3->gem_connected || !ps3->gem_init)
|
||||||
float pointer_x;
|
return 0;
|
||||||
float pointer_y;
|
|
||||||
float sensitivity = 1.0f;
|
readCamera(ps3);
|
||||||
|
readGem(ps3);
|
||||||
|
|
||||||
videoState state;
|
|
||||||
videoConfiguration vconfig;
|
|
||||||
videoResolution res;
|
|
||||||
videoGetState(0, 0, &state);
|
videoGetState(0, 0, &state);
|
||||||
videoGetResolution(state.displayMode.resolution, &res);
|
videoGetResolution(state.displayMode.resolution, &res);
|
||||||
|
|
||||||
if (res.height == 720)
|
if (res.height == 720)
|
||||||
{
|
{
|
||||||
// 720p offset adjustments
|
/* 720p offset adjustments */
|
||||||
center_x = 645.0f;
|
center_x = 645.0f;
|
||||||
center_y = 375.0f;
|
center_y = 375.0f;
|
||||||
}
|
}
|
||||||
else if (res.height == 1080)
|
else if (res.height == 1080)
|
||||||
{
|
{
|
||||||
// 1080p offset adjustments
|
/* 1080p offset adjustments */
|
||||||
center_x = 960.0f;
|
center_x = 960.0f;
|
||||||
center_y = 565.0f;
|
center_y = 565.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
vp.x = 0;
|
vp.x = 0;
|
||||||
@ -709,25 +708,23 @@ static int16_t ps3_lightgun_device_state(ps3_input_t *ps3,
|
|||||||
vp.full_width = 0;
|
vp.full_width = 0;
|
||||||
vp.full_height = 0;
|
vp.full_height = 0;
|
||||||
|
|
||||||
#if 1
|
/* tracking mode 1: laser pointer mode (this is closest
|
||||||
// tracking mode 1: laser pointer mode (this is closest to actual lightgun behavior)
|
to actual lightgun behavior) */
|
||||||
VmathVector4 ray_start;
|
ray_start.vec128 = ps3->gem_state.pos;
|
||||||
ray_start.vec128 = ps3->gem_state.pos;
|
VmathVector4 ray_tmp = {.vec128 = {0.0f,0.0f,-1.0f,0.0f}};
|
||||||
VmathVector4 ray_tmp = {.vec128 = {0.0f,0.0f,-1.0f,0.0f}};
|
const VmathQuat *quat = &ps3->gem_state.quat;
|
||||||
const VmathQuat *quat = &ps3->gem_state.quat;
|
|
||||||
VmathVector4 ray_dir;
|
|
||||||
vmathQRotate(&ray_dir, quat, &ray_tmp);
|
vmathQRotate(&ray_dir, quat, &ray_tmp);
|
||||||
float t = -ray_start.vec128[2] / ray_dir.vec128[2];
|
float t = -ray_start.vec128[2] / ray_dir.vec128[2];
|
||||||
pointer_x = ray_start.vec128[0] + ray_dir.vec128[0]*t;
|
pointer_x = ray_start.vec128[0] + ray_dir.vec128[0]*t;
|
||||||
pointer_y = ray_start.vec128[1] + ray_dir.vec128[1]*t;
|
pointer_y = ray_start.vec128[1] + ray_dir.vec128[1]*t;
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// tracking mode 2: 3D coordinate system (move pointer position by moving the whole controller)
|
/* tracking mode 2: 3D coordinate system (move pointer position by moving the
|
||||||
|
* whole controller) */
|
||||||
VmathVector4 v;
|
VmathVector4 v;
|
||||||
v.vec128 = ps3->gem_state.pos;
|
v.vec128 = ps3->gem_state.pos;
|
||||||
pointer_x = v.vec128[0];
|
pointer_x = v.vec128[0];
|
||||||
pointer_y = v.vec128[1];
|
pointer_y = v.vec128[1];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (video_driver_translate_coord_viewport_wrap(&vp,
|
if (video_driver_translate_coord_viewport_wrap(&vp,
|
||||||
@ -782,15 +779,11 @@ static int16_t ps3_lightgun_device_state(ps3_input_t *ps3,
|
|||||||
break;
|
break;
|
||||||
case RETRO_DEVICE_ID_LIGHTGUN_SCREEN_X:
|
case RETRO_DEVICE_ID_LIGHTGUN_SCREEN_X:
|
||||||
if (inside)
|
if (inside)
|
||||||
{
|
|
||||||
return (res_x);
|
return (res_x);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case RETRO_DEVICE_ID_LIGHTGUN_SCREEN_Y:
|
case RETRO_DEVICE_ID_LIGHTGUN_SCREEN_Y:
|
||||||
if (inside)
|
if (inside)
|
||||||
{
|
|
||||||
return (~res_y);
|
return (~res_y);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case RETRO_DEVICE_ID_LIGHTGUN_IS_OFFSCREEN:
|
case RETRO_DEVICE_ID_LIGHTGUN_IS_OFFSCREEN:
|
||||||
return !inside;
|
return !inside;
|
||||||
@ -825,7 +818,7 @@ static int16_t ps3_input_state(
|
|||||||
case RETRO_DEVICE_JOYPAD:
|
case RETRO_DEVICE_JOYPAD:
|
||||||
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
|
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
|
||||||
{
|
{
|
||||||
unsigned i;
|
int i;
|
||||||
int16_t ret = 0;
|
int16_t ret = 0;
|
||||||
|
|
||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
@ -880,7 +873,10 @@ static void ps3_input_free_input(void *data)
|
|||||||
|
|
||||||
static void* ps3_input_init(const char *joypad_driver)
|
static void* ps3_input_init(const char *joypad_driver)
|
||||||
{
|
{
|
||||||
unsigned i;
|
int i;
|
||||||
|
#ifdef HAVE_LIGHTGUN
|
||||||
|
gemInfo gem_info;
|
||||||
|
#endif
|
||||||
ps3_input_t *ps3 = (ps3_input_t*)calloc(1, sizeof(*ps3));
|
ps3_input_t *ps3 = (ps3_input_t*)calloc(1, sizeof(*ps3));
|
||||||
if (!ps3)
|
if (!ps3)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -902,8 +898,7 @@ static void* ps3_input_init(const char *joypad_driver)
|
|||||||
ioMouseInit(MAX_MICE);
|
ioMouseInit(MAX_MICE);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LIGHTGUN
|
#ifdef HAVE_LIGHTGUN
|
||||||
ps3->gem_init = 0;
|
ps3->gem_init = 0;
|
||||||
gemInfo gem_info;
|
|
||||||
gemGetInfo(&gem_info);
|
gemGetInfo(&gem_info);
|
||||||
ps3->gem_connected = gem_info.connected;
|
ps3->gem_connected = gem_info.connected;
|
||||||
if (ps3->gem_connected)
|
if (ps3->gem_connected)
|
||||||
@ -918,9 +913,7 @@ static void* ps3_input_init(const char *joypad_driver)
|
|||||||
if (!setupCamera(ps3));
|
if (!setupCamera(ps3));
|
||||||
{
|
{
|
||||||
if (!initGem(ps3))
|
if (!initGem(ps3))
|
||||||
{
|
|
||||||
ps3->gem_init = 1;
|
ps3->gem_init = 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,17 +177,17 @@ static void qnx_process_joystick_event(qnx_input_t *qnx, screen_event_t screen_e
|
|||||||
int displacement[2];
|
int displacement[2];
|
||||||
screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_DISPLACEMENT, displacement);
|
screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_DISPLACEMENT, displacement);
|
||||||
|
|
||||||
if(displacement != 0)
|
if (displacement != 0)
|
||||||
{
|
{
|
||||||
qnx->trackpad_acc[0] += displacement[0];
|
qnx->trackpad_acc[0] += displacement[0];
|
||||||
if(abs(qnx->trackpad_acc[0]) > TRACKPAD_THRESHOLD)
|
if (abs(qnx->trackpad_acc[0]) > TRACKPAD_THRESHOLD)
|
||||||
{
|
{
|
||||||
if(qnx->trackpad_acc < 0)
|
if (qnx->trackpad_acc < 0)
|
||||||
{
|
{
|
||||||
input_keyboard_event(true, RETROK_LEFT, 0, 0, RETRO_DEVICE_KEYBOARD);
|
input_keyboard_event(true, RETROK_LEFT, 0, 0, RETRO_DEVICE_KEYBOARD);
|
||||||
input_keyboard_event(false, RETROK_LEFT, 0, 0, RETRO_DEVICE_KEYBOARD);
|
input_keyboard_event(false, RETROK_LEFT, 0, 0, RETRO_DEVICE_KEYBOARD);
|
||||||
}
|
}
|
||||||
else if(qnx->trackpad_acc > 0)
|
else if (qnx->trackpad_acc > 0)
|
||||||
{
|
{
|
||||||
input_keyboard_event(true, RETROK_RIGHT, 0, 0, RETRO_DEVICE_KEYBOARD);
|
input_keyboard_event(true, RETROK_RIGHT, 0, 0, RETRO_DEVICE_KEYBOARD);
|
||||||
input_keyboard_event(false, RETROK_RIGHT, 0, 0, RETRO_DEVICE_KEYBOARD);
|
input_keyboard_event(false, RETROK_RIGHT, 0, 0, RETRO_DEVICE_KEYBOARD);
|
||||||
@ -197,14 +197,14 @@ static void qnx_process_joystick_event(qnx_input_t *qnx, screen_event_t screen_e
|
|||||||
}
|
}
|
||||||
|
|
||||||
qnx->trackpad_acc[1] += displacement[1];
|
qnx->trackpad_acc[1] += displacement[1];
|
||||||
if(abs(qnx->trackpad_acc[1]) > TRACKPAD_THRESHOLD)
|
if (abs(qnx->trackpad_acc[1]) > TRACKPAD_THRESHOLD)
|
||||||
{
|
{
|
||||||
if(qnx->trackpad_acc < 0)
|
if (qnx->trackpad_acc < 0)
|
||||||
{
|
{
|
||||||
input_keyboard_event(true, RETROK_UP, 0, 0, RETRO_DEVICE_KEYBOARD);
|
input_keyboard_event(true, RETROK_UP, 0, 0, RETRO_DEVICE_KEYBOARD);
|
||||||
input_keyboard_event(false, RETROK_UP, 0, 0, RETRO_DEVICE_KEYBOARD);
|
input_keyboard_event(false, RETROK_UP, 0, 0, RETRO_DEVICE_KEYBOARD);
|
||||||
}
|
}
|
||||||
else if(qnx->trackpad_acc > 0)
|
else if (qnx->trackpad_acc > 0)
|
||||||
{
|
{
|
||||||
input_keyboard_event(true, RETROK_DOWN, 0, 0, RETRO_DEVICE_KEYBOARD);
|
input_keyboard_event(true, RETROK_DOWN, 0, 0, RETRO_DEVICE_KEYBOARD);
|
||||||
input_keyboard_event(false, RETROK_DOWN, 0, 0, RETRO_DEVICE_KEYBOARD);
|
input_keyboard_event(false, RETROK_DOWN, 0, 0, RETRO_DEVICE_KEYBOARD);
|
||||||
@ -228,9 +228,9 @@ static void qnx_input_autodetect_gamepad(qnx_input_t *qnx,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
name_buf[0] = '\0';
|
name_buf[0] = '\0';
|
||||||
if(controller && controller->type == SCREEN_EVENT_GAMEPAD)
|
if (controller && controller->type == SCREEN_EVENT_GAMEPAD)
|
||||||
{
|
{
|
||||||
if(strstr(controller->id, "0-054C-05C4-1.0"))
|
if (strstr(controller->id, "0-054C-05C4-1.0"))
|
||||||
strlcpy(name_buf, "DS4 Controller", sizeof(name_buf));
|
strlcpy(name_buf, "DS4 Controller", sizeof(name_buf));
|
||||||
else
|
else
|
||||||
strlcpy(name_buf, "QNX Gamepad", sizeof(name_buf));
|
strlcpy(name_buf, "QNX Gamepad", sizeof(name_buf));
|
||||||
@ -372,33 +372,26 @@ static void qnx_process_keyboard_event(
|
|||||||
qnx_input_t *qnx,
|
qnx_input_t *qnx,
|
||||||
screen_event_t event, int type)
|
screen_event_t event, int type)
|
||||||
{
|
{
|
||||||
// Get key properties from screen event
|
/* Get key properties from screen event */
|
||||||
int flags = 0;
|
int flags = 0, cap = 0, mod = 0;
|
||||||
screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_FLAGS, &flags);
|
screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_FLAGS, &flags);
|
||||||
|
|
||||||
int cap = 0;
|
|
||||||
screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_CAP, &cap);
|
screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_CAP, &cap);
|
||||||
|
|
||||||
int mod = 0;
|
|
||||||
screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_MODIFIERS, &mod);
|
screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_MODIFIERS, &mod);
|
||||||
|
|
||||||
// Calculate state
|
/* Calculate state */
|
||||||
unsigned keycode = input_keymaps_translate_keysym_to_rk(cap);
|
unsigned keycode = input_keymaps_translate_keysym_to_rk(cap);
|
||||||
bool keydown = flags & KEY_DOWN;
|
bool keydown = flags & KEY_DOWN;
|
||||||
bool keyrepeat = flags & KEY_REPEAT;
|
bool keyrepeat = flags & KEY_REPEAT;
|
||||||
|
/* Fire keyboard event */
|
||||||
// Fire keyboard event
|
if (!keyrepeat)
|
||||||
if(!keyrepeat)
|
|
||||||
{
|
|
||||||
input_keyboard_event(keydown, keycode, 0, mod, RETRO_DEVICE_KEYBOARD);
|
input_keyboard_event(keydown, keycode, 0, mod, RETRO_DEVICE_KEYBOARD);
|
||||||
}
|
|
||||||
|
|
||||||
// Apply keyboard state
|
/* Apply keyboard state */
|
||||||
if(keydown && !keyrepeat)
|
if (keydown && !keyrepeat)
|
||||||
{
|
{
|
||||||
BIT_SET(qnx->keyboard_state, cap);
|
BIT_SET(qnx->keyboard_state, cap);
|
||||||
}
|
}
|
||||||
else if(!keydown && !keyrepeat)
|
else if (!keydown && !keyrepeat)
|
||||||
{
|
{
|
||||||
BIT_CLEAR(qnx->keyboard_state, cap);
|
BIT_CLEAR(qnx->keyboard_state, cap);
|
||||||
}
|
}
|
||||||
@ -421,7 +414,7 @@ static void qnx_process_touch_event(
|
|||||||
/* Find a free touch struct. */
|
/* Find a free touch struct. */
|
||||||
for (i = 0; i < MAX_TOUCH; ++i)
|
for (i = 0; i < MAX_TOUCH; ++i)
|
||||||
{
|
{
|
||||||
if(qnx->pointer[i].contact_id == -1)
|
if (qnx->pointer[i].contact_id == -1)
|
||||||
{
|
{
|
||||||
struct video_viewport vp;
|
struct video_viewport vp;
|
||||||
|
|
||||||
@ -458,7 +451,7 @@ static void qnx_process_touch_event(
|
|||||||
case SCREEN_EVENT_MTOUCH_RELEASE:
|
case SCREEN_EVENT_MTOUCH_RELEASE:
|
||||||
for (i = 0; i < MAX_TOUCH; ++i)
|
for (i = 0; i < MAX_TOUCH; ++i)
|
||||||
{
|
{
|
||||||
if(qnx->pointer[i].contact_id == contact_id)
|
if (qnx->pointer[i].contact_id == contact_id)
|
||||||
{
|
{
|
||||||
/* Invalidate the finger. */
|
/* Invalidate the finger. */
|
||||||
qnx->pointer[i].contact_id = -1;
|
qnx->pointer[i].contact_id = -1;
|
||||||
@ -488,7 +481,7 @@ static void qnx_process_touch_event(
|
|||||||
/* Find the finger we're tracking and update. */
|
/* Find the finger we're tracking and update. */
|
||||||
for (i = 0; i < qnx->pointer_count; ++i)
|
for (i = 0; i < qnx->pointer_count; ++i)
|
||||||
{
|
{
|
||||||
if(qnx->pointer[i].contact_id == contact_id)
|
if (qnx->pointer[i].contact_id == contact_id)
|
||||||
{
|
{
|
||||||
struct video_viewport vp;
|
struct video_viewport vp;
|
||||||
|
|
||||||
@ -507,14 +500,14 @@ static void qnx_process_touch_event(
|
|||||||
* numbers larger than the screen resolution.
|
* numbers larger than the screen resolution.
|
||||||
*
|
*
|
||||||
* Normalize. */
|
* Normalize. */
|
||||||
if(pos[0] < 0)
|
if (pos[0] < 0)
|
||||||
pos[0] = 0;
|
pos[0] = 0;
|
||||||
if(pos[0] > gl->full_x)
|
if (pos[0] > gl->full_x)
|
||||||
pos[0] = gl->full_x;
|
pos[0] = gl->full_x;
|
||||||
|
|
||||||
if(pos[1] < 0)
|
if (pos[1] < 0)
|
||||||
pos[1] = 0;
|
pos[1] = 0;
|
||||||
if(pos[1] > gl->full_y)
|
if (pos[1] > gl->full_y)
|
||||||
pos[1] = gl->full_y;
|
pos[1] = gl->full_y;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -647,12 +640,12 @@ static void qnx_handle_navigator_event(
|
|||||||
bps_get_event(&event_pause, -1);
|
bps_get_event(&event_pause, -1);
|
||||||
event_code = bps_event_get_code(event_pause);
|
event_code = bps_event_get_code(event_pause);
|
||||||
|
|
||||||
if(event_code == NAVIGATOR_WINDOW_STATE)
|
if (event_code == NAVIGATOR_WINDOW_STATE)
|
||||||
{
|
{
|
||||||
if(navigator_event_get_window_state(event_pause) == NAVIGATOR_WINDOW_FULLSCREEN)
|
if (navigator_event_get_window_state(event_pause) == NAVIGATOR_WINDOW_FULLSCREEN)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(event_code == NAVIGATOR_EXIT)
|
else if (event_code == NAVIGATOR_EXIT)
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -714,7 +707,7 @@ static void qnx_input_poll(void *data)
|
|||||||
bps_event_t *event = NULL;
|
bps_event_t *event = NULL;
|
||||||
int rc = bps_get_event(&event, 0);
|
int rc = bps_get_event(&event, 0);
|
||||||
|
|
||||||
if(rc == BPS_SUCCESS)
|
if (rc == BPS_SUCCESS)
|
||||||
{
|
{
|
||||||
int domain;
|
int domain;
|
||||||
|
|
||||||
@ -742,7 +735,7 @@ static int16_t qnx_pointer_input_state(qnx_input_t *qnx,
|
|||||||
int16_t x;
|
int16_t x;
|
||||||
int16_t y;
|
int16_t y;
|
||||||
|
|
||||||
if(screen)
|
if (screen)
|
||||||
{
|
{
|
||||||
x = qnx->pointer[idx].full_x;
|
x = qnx->pointer[idx].full_x;
|
||||||
y = qnx->pointer[idx].full_y;
|
y = qnx->pointer[idx].full_y;
|
||||||
|
@ -279,16 +279,16 @@ BTDIMPORT const hci_cmd_t* l2cap_decline_connection_ptr;
|
|||||||
|
|
||||||
/* RFCOMM EVENTS */
|
/* RFCOMM EVENTS */
|
||||||
|
|
||||||
// data: event(8), len(8), status (8), address (48), handle (16), server channel(8), rfcomm_cid(16), max frame size(16)
|
/* data: event(8), len(8), status (8), address (48), handle (16), server channel(8), rfcomm_cid(16), max frame size(16) */
|
||||||
#define RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE 0x80
|
#define RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE 0x80
|
||||||
|
|
||||||
// data: event(8), len(8), rfcomm_cid(16)
|
/* data: event(8), len(8), rfcomm_cid(16) */
|
||||||
#define RFCOMM_EVENT_CHANNEL_CLOSED 0x81
|
#define RFCOMM_EVENT_CHANNEL_CLOSED 0x81
|
||||||
|
|
||||||
// data: event (8), len(8), address(48), channel (8), rfcomm_cid (16)
|
/* data: event (8), len(8), address(48), channel (8), rfcomm_cid (16) */
|
||||||
#define RFCOMM_EVENT_INCOMING_CONNECTION 0x82
|
#define RFCOMM_EVENT_INCOMING_CONNECTION 0x82
|
||||||
|
|
||||||
// data: event (8), len(8), rfcommid (16), ...
|
/* data: event (8), len(8), rfcommid (16), ... */
|
||||||
#define RFCOMM_EVENT_REMOTE_LINE_STATUS 0x83
|
#define RFCOMM_EVENT_REMOTE_LINE_STATUS 0x83
|
||||||
|
|
||||||
/* data: event(8), len(8), rfcomm_cid(16), credits(8) */
|
/* data: event(8), len(8), rfcomm_cid(16), credits(8) */
|
||||||
|
@ -60,7 +60,7 @@ static void apple_gamecontroller_joypad_poll_internal(GCController *controller)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
slot = (uint32_t)controller.playerIndex;
|
slot = (uint32_t)controller.playerIndex;
|
||||||
// if we have not assigned a slot to this controller yet, ignore it.
|
/* If we have not assigned a slot to this controller yet, ignore it. */
|
||||||
if (slot >= MAX_USERS)
|
if (slot >= MAX_USERS)
|
||||||
return;
|
return;
|
||||||
buttons = &mfi_buttons[slot];
|
buttons = &mfi_buttons[slot];
|
||||||
@ -68,13 +68,14 @@ static void apple_gamecontroller_joypad_poll_internal(GCController *controller)
|
|||||||
/* retain the values from the paused controller handler and pass them through */
|
/* retain the values from the paused controller handler and pass them through */
|
||||||
if (@available(iOS 13, *))
|
if (@available(iOS 13, *))
|
||||||
{
|
{
|
||||||
// The menu button can be pressed/unpressed like any other button in iOS 13
|
/* The menu button can be pressed/unpressed
|
||||||
// so no need to passthrough anything
|
* like any other button in iOS 13,
|
||||||
|
* so no need to passthrough anything */
|
||||||
*buttons = 0;
|
*buttons = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Use the paused controller handler for iOS versions below 13
|
/* Use the paused controller handler for iOS versions below 13 */
|
||||||
pause = *buttons & (1 << RETRO_DEVICE_ID_JOYPAD_START);
|
pause = *buttons & (1 << RETRO_DEVICE_ID_JOYPAD_START);
|
||||||
select = *buttons & (1 << RETRO_DEVICE_ID_JOYPAD_SELECT);
|
select = *buttons & (1 << RETRO_DEVICE_ID_JOYPAD_SELECT);
|
||||||
l3 = *buttons & (1 << RETRO_DEVICE_ID_JOYPAD_L3);
|
l3 = *buttons & (1 << RETRO_DEVICE_ID_JOYPAD_L3);
|
||||||
@ -110,14 +111,15 @@ static void apple_gamecontroller_joypad_poll_internal(GCController *controller)
|
|||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 || __TV_OS_VERSION_MAX_ALLOWED >= 130000
|
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 || __TV_OS_VERSION_MAX_ALLOWED >= 130000
|
||||||
if (@available(iOS 13, *))
|
if (@available(iOS 13, *))
|
||||||
{
|
{
|
||||||
// Support "Options" button present in PS4 / XBox One controllers
|
/* Support "Options" button present in PS4 / XBox One controllers */
|
||||||
*buttons |= gp.buttonOptions.pressed ? (1 << RETRO_DEVICE_ID_JOYPAD_SELECT) : 0;
|
*buttons |= gp.buttonOptions.pressed ? (1 << RETRO_DEVICE_ID_JOYPAD_SELECT) : 0;
|
||||||
|
|
||||||
// Support buttons that aren't supported by older mFi controller via "hotkey" combinations:
|
/* Support buttons that aren't supported by older mFi controller via "hotkey" combinations:
|
||||||
//
|
*
|
||||||
// LS + Menu => Select
|
* LS + Menu => Select
|
||||||
// LT + Menu => L3
|
* LT + Menu => L3
|
||||||
// RT + Menu => R3
|
* RT + Menu => R3
|
||||||
|
*/
|
||||||
if (gp.buttonMenu.pressed )
|
if (gp.buttonMenu.pressed )
|
||||||
{
|
{
|
||||||
if (gp.leftShoulder.pressed)
|
if (gp.leftShoulder.pressed)
|
||||||
@ -138,7 +140,8 @@ static void apple_gamecontroller_joypad_poll_internal(GCController *controller)
|
|||||||
mfi_axes[slot][3] = gp.rightThumbstick.yAxis.value * 32767.0f;
|
mfi_axes[slot][3] = gp.rightThumbstick.yAxis.value * 32767.0f;
|
||||||
|
|
||||||
}
|
}
|
||||||
// GCGamepad is deprecated
|
|
||||||
|
/* GCGamepad is deprecated */
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wdeprecated"
|
#pragma clang diagnostic ignored "-Wdeprecated"
|
||||||
else if (controller.gamepad)
|
else if (controller.gamepad)
|
||||||
@ -168,19 +171,21 @@ static void apple_gamecontroller_joypad_poll(void)
|
|||||||
apple_gamecontroller_joypad_poll_internal(controller);
|
apple_gamecontroller_joypad_poll_internal(controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GCGamepad is deprecated
|
/* GCGamepad is deprecated */
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wdeprecated"
|
#pragma clang diagnostic ignored "-Wdeprecated"
|
||||||
static void apple_gamecontroller_joypad_register(GCGamepad *gamepad)
|
static void apple_gamecontroller_joypad_register(GCGamepad *gamepad)
|
||||||
{
|
{
|
||||||
#ifdef __IPHONE_14_0
|
#ifdef __IPHONE_14_0
|
||||||
// dont let tvOS or iOS do anything with **our** buttons!!
|
/* Don't let tvOS or iOS do anything with **our** buttons!!
|
||||||
// iOS will start a screen recording if you hold or dbl click the OPTIONS button, we dont want that.
|
* iOS will start a screen recording if you hold or doubleclick
|
||||||
if (@available(iOS 14.0, tvOS 14.0, *)) {
|
* the OPTIONS button, we don't want that. */
|
||||||
|
if (@available(iOS 14.0, tvOS 14.0, *))
|
||||||
|
{
|
||||||
GCExtendedGamepad *gp = (GCExtendedGamepad *)gamepad.controller.extendedGamepad;
|
GCExtendedGamepad *gp = (GCExtendedGamepad *)gamepad.controller.extendedGamepad;
|
||||||
gp.buttonOptions.preferredSystemGestureState = GCSystemGestureStateDisabled;
|
gp.buttonOptions.preferredSystemGestureState = GCSystemGestureStateDisabled;
|
||||||
gp.buttonMenu.preferredSystemGestureState = GCSystemGestureStateDisabled;
|
gp.buttonMenu.preferredSystemGestureState = GCSystemGestureStateDisabled;
|
||||||
gp.buttonHome.preferredSystemGestureState = GCSystemGestureStateDisabled;
|
gp.buttonHome.preferredSystemGestureState = GCSystemGestureStateDisabled;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -189,13 +194,12 @@ static void apple_gamecontroller_joypad_register(GCGamepad *gamepad)
|
|||||||
apple_gamecontroller_joypad_poll_internal(updateGamepad.controller);
|
apple_gamecontroller_joypad_poll_internal(updateGamepad.controller);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* controllerPausedHandler is deprecated in favor
|
||||||
|
* of being able to deal with the menu
|
||||||
|
* button as any other button */
|
||||||
if (@available(iOS 13, *))
|
if (@available(iOS 13, *))
|
||||||
{
|
|
||||||
// controllerPausedHandler is deprecated in favor of being able to deal with the menu
|
|
||||||
// button as any other button
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
gamepad.controller.controllerPausedHandler = ^(GCController *controller)
|
gamepad.controller.controllerPausedHandler = ^(GCController *controller)
|
||||||
|
|
||||||
@ -294,11 +298,11 @@ static void apple_gamecontroller_joypad_connect(GCController *controller)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GCGamepad is deprecated
|
/* GCGamepad is deprecated */
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wdeprecated"
|
#pragma clang diagnostic ignored "-Wdeprecated"
|
||||||
[mfiControllers addObject:controller];
|
[mfiControllers addObject:controller];
|
||||||
// move any non-game controllers (like the siri remote) to the end
|
/* Move any non-game controllers (like the siri remote) to the end */
|
||||||
if (mfiControllers.count > 1)
|
if (mfiControllers.count > 1)
|
||||||
{
|
{
|
||||||
int newPlayerIndex = 0;
|
int newPlayerIndex = 0;
|
||||||
|
@ -16,8 +16,9 @@
|
|||||||
#ifndef _KEYBOARD_EVENT_ANDROID_H
|
#ifndef _KEYBOARD_EVENT_ANDROID_H
|
||||||
#define _KEYBOARD_EVENT_ANDROID_H
|
#define _KEYBOARD_EVENT_ANDROID_H
|
||||||
|
|
||||||
// The list of defined Android keycodes is incomplete in SDK version 12 and lower.
|
/* The list of defined Android keycodes is incomplete in SDK version 12
|
||||||
// If using an SDK lower than 13 then add missing keycodes here
|
* and lower.
|
||||||
|
* If using an SDK lower than 13, add missing keycodes here */
|
||||||
#if __ANDROID_API__ < 13
|
#if __ANDROID_API__ < 13
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1459,7 +1459,7 @@ const struct rarch_key_map rarch_key_map_qnx[] = {
|
|||||||
{ KEYCODE_RIGHT_CTRL, RETROK_RCTRL },
|
{ KEYCODE_RIGHT_CTRL, RETROK_RCTRL },
|
||||||
{ KEYCODE_LEFT_ALT, RETROK_LALT },
|
{ KEYCODE_LEFT_ALT, RETROK_LALT },
|
||||||
{ KEYCODE_RIGHT_ALT, RETROK_RALT },
|
{ KEYCODE_RIGHT_ALT, RETROK_RALT },
|
||||||
// TODO/FIXME: Code for 'sym' key on BB keyboards. Figure out which sys/keycodes.h define this maps to.
|
/* TODO/FIXME: Code for 'sym' key on BB keyboards. Figure out which sys/keycodes.h define this maps to. */
|
||||||
{ 61651, RETROK_RSUPER },
|
{ 61651, RETROK_RSUPER },
|
||||||
{ KEYCODE_DOLLAR, RETROK_DOLLAR },
|
{ KEYCODE_DOLLAR, RETROK_DOLLAR },
|
||||||
{ KEYCODE_MENU, RETROK_MENU },
|
{ KEYCODE_MENU, RETROK_MENU },
|
||||||
|
@ -337,7 +337,7 @@ static ui_application_t ui_application_cocoa = {
|
|||||||
void *data;
|
void *data;
|
||||||
enum event_command cmd;
|
enum event_command cmd;
|
||||||
}
|
}
|
||||||
@end // @interface CommandPerformer
|
@end /* @interface CommandPerformer */
|
||||||
|
|
||||||
@implementation CommandPerformer
|
@implementation CommandPerformer
|
||||||
|
|
||||||
@ -358,7 +358,7 @@ static ui_application_t ui_application_cocoa = {
|
|||||||
command_event(self->cmd, self->data);
|
command_event(self->cmd, self->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@end // @implementation CommandPerformer
|
@end /* @implementation CommandPerformer */
|
||||||
|
|
||||||
#if defined(HAVE_COCOA_METAL)
|
#if defined(HAVE_COCOA_METAL)
|
||||||
@interface RAWindow : NSWindow
|
@interface RAWindow : NSWindow
|
||||||
|
@ -310,9 +310,9 @@ enum
|
|||||||
/* Keyboard event hack for iOS versions prior to iOS 7.
|
/* Keyboard event hack for iOS versions prior to iOS 7.
|
||||||
*
|
*
|
||||||
* Derived from:
|
* Derived from:
|
||||||
* http://nacho4d-nacho4d.blogspot.com/2012/01/
|
* http://nacho4d-nacho4d.blogspot.com/2012/01/
|
||||||
* catching-keyboard-events-in-ios.html
|
* catching-keyboard-events-in-ios.html
|
||||||
*/
|
*/
|
||||||
const uint8_t *eventMem = objc_unretainedPointer([event performSelector:@selector(_gsEvent)]);
|
const uint8_t *eventMem = objc_unretainedPointer([event performSelector:@selector(_gsEvent)]);
|
||||||
int eventType = eventMem ? *(int*)&eventMem[8] : 0;
|
int eventType = eventMem ? *(int*)&eventMem[8] : 0;
|
||||||
|
|
||||||
@ -471,8 +471,8 @@ enum
|
|||||||
NSString *filename = (NSString*)url.path.lastPathComponent;
|
NSString *filename = (NSString*)url.path.lastPathComponent;
|
||||||
NSError *error = nil;
|
NSError *error = nil;
|
||||||
NSString *destination = [self.documentsDirectory stringByAppendingPathComponent:filename];
|
NSString *destination = [self.documentsDirectory stringByAppendingPathComponent:filename];
|
||||||
|
/* Copy file to documents directory if it's not already
|
||||||
// copy file to documents directory if its not already inside of documents directory
|
* inside Documents directory */
|
||||||
if ([url startAccessingSecurityScopedResource]) {
|
if ([url startAccessingSecurityScopedResource]) {
|
||||||
if (![[url path] containsString: self.documentsDirectory])
|
if (![[url path] containsString: self.documentsDirectory])
|
||||||
if (![manager fileExistsAtPath:destination])
|
if (![manager fileExistsAtPath:destination])
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#define IDI_ICON 1
|
#define IDI_ICON 1
|
||||||
|
|
||||||
#ifndef _WIN32_WINNT
|
#ifndef _WIN32_WINNT
|
||||||
#define _WIN32_WINNT 0x0500 //_WIN32_WINNT_WIN2K
|
#define _WIN32_WINNT 0x0500 /* _WIN32_WINNT_WIN2K */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _WIN32_IE
|
#ifndef _WIN32_IE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user