mirror of
https://github.com/libretro/RetroArch
synced 2025-03-05 01:14:31 +00:00
commit
1bf6887c59
@ -378,6 +378,9 @@ CFLAGS += -DHAVE_THREADS
|
|||||||
ifeq ($(platform), psp1)
|
ifeq ($(platform), psp1)
|
||||||
LIBS += -lpthread-psp
|
LIBS += -lpthread-psp
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(platform), vita)
|
||||||
|
LIBS += -lpthread
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(HAVE_RSOUND), 1)
|
ifeq ($(HAVE_RSOUND), 1)
|
||||||
|
@ -101,7 +101,7 @@ static int audioMainLoop(SceSize args, void* argp)
|
|||||||
|
|
||||||
#ifdef VITA
|
#ifdef VITA
|
||||||
sceKernelUnlockLwMutex((struct SceKernelLwMutexWork*)&psp->lock, 1);
|
sceKernelUnlockLwMutex((struct SceKernelLwMutexWork*)&psp->lock, 1);
|
||||||
sceKernelSignalLwCond(&psp->cond);
|
sceKernelSignalLwCond((struct SceKernelLwCondWork*)&psp->cond);
|
||||||
|
|
||||||
sceAudioOutOutput(port,
|
sceAudioOutOutput(port,
|
||||||
cond ? (psp->zeroBuffer)
|
cond ? (psp->zeroBuffer)
|
||||||
@ -145,7 +145,7 @@ static void *psp_audio_init(const char *device,
|
|||||||
|
|
||||||
sceKernelCreateLwMutex((struct SceKernelLwMutexWork*)&psp->lock, "audio_get_lock", 0, 0, 0);
|
sceKernelCreateLwMutex((struct SceKernelLwMutexWork*)&psp->lock, "audio_get_lock", 0, 0, 0);
|
||||||
sceKernelCreateLwMutex((struct SceKernelLwMutexWork*)&psp->cond_lock, "audio_get_cond_lock", 0, 0, 0);
|
sceKernelCreateLwMutex((struct SceKernelLwMutexWork*)&psp->cond_lock, "audio_get_cond_lock", 0, 0, 0);
|
||||||
sceKernelCreateLwCond(&psp->cond, "audio_get_cond", 0, &psp->cond_lock, 0);
|
sceKernelCreateLwCond((struct SceKernelLwCondWork*)&psp->cond, "audio_get_cond", 0, (struct SceKernelLwMutexWork*)&psp->cond_lock, 0);
|
||||||
psp->thread = sceKernelCreateThread
|
psp->thread = sceKernelCreateThread
|
||||||
("audioMainLoop", audioMainLoop, 0x10000100, 0x10000, 0, 0, NULL);
|
("audioMainLoop", audioMainLoop, 0x10000100, 0x10000, 0, 0, NULL);
|
||||||
#else
|
#else
|
||||||
@ -172,7 +172,7 @@ static void psp_audio_free(void *data)
|
|||||||
sceKernelWaitThreadEnd(psp->thread, NULL, &timeout);
|
sceKernelWaitThreadEnd(psp->thread, NULL, &timeout);
|
||||||
sceKernelDeleteLwMutex((struct SceKernelLwMutexWork*)&psp->lock);
|
sceKernelDeleteLwMutex((struct SceKernelLwMutexWork*)&psp->lock);
|
||||||
sceKernelDeleteLwMutex((struct SceKernelLwMutexWork*)&psp->cond_lock);
|
sceKernelDeleteLwMutex((struct SceKernelLwMutexWork*)&psp->cond_lock);
|
||||||
sceKernelDeleteLwCond(&psp->cond);
|
sceKernelDeleteLwCond((struct SceKernelLwCondWork*)&psp->cond);
|
||||||
#else
|
#else
|
||||||
sceKernelWaitThreadEnd(psp->thread, &timeout);
|
sceKernelWaitThreadEnd(psp->thread, &timeout);
|
||||||
#endif
|
#endif
|
||||||
@ -198,7 +198,7 @@ static ssize_t psp_audio_write(void *data, const void *buf, size_t size)
|
|||||||
|
|
||||||
while (AUDIO_BUFFER_SIZE - ((uint16_t)
|
while (AUDIO_BUFFER_SIZE - ((uint16_t)
|
||||||
(psp->write_pos - psp->read_pos) & AUDIO_BUFFER_SIZE_MASK) < size){
|
(psp->write_pos - psp->read_pos) & AUDIO_BUFFER_SIZE_MASK) < size){
|
||||||
sceKernelWaitLwCond(&psp->cond, 0);
|
sceKernelWaitLwCond((struct SceKernelLwCondWork*)&psp->cond, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
sceKernelLockLwMutex((struct SceKernelLwMutexWork*)&psp->lock, 1, 0);
|
sceKernelLockLwMutex((struct SceKernelLwMutexWork*)&psp->lock, 1, 0);
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <psp2/power.h>
|
#include <psp2/power.h>
|
||||||
#include <psp2/sysmodule.h>
|
#include <psp2/sysmodule.h>
|
||||||
#include <psp2/appmgr.h>
|
#include <psp2/appmgr.h>
|
||||||
|
#include <pthread.h>
|
||||||
#else
|
#else
|
||||||
#include <pspkernel.h>
|
#include <pspkernel.h>
|
||||||
#include <pspdebug.h>
|
#include <pspdebug.h>
|
||||||
@ -298,6 +299,7 @@ static void frontend_psp_init(void *data)
|
|||||||
#ifdef VITA
|
#ifdef VITA
|
||||||
scePowerSetArmClockFrequency(444);
|
scePowerSetArmClockFrequency(444);
|
||||||
sceSysmoduleLoadModule(SCE_SYSMODULE_NET);
|
sceSysmoduleLoadModule(SCE_SYSMODULE_NET);
|
||||||
|
pthread_init();
|
||||||
#else
|
#else
|
||||||
(void)data;
|
(void)data;
|
||||||
/* initialize debug screen */
|
/* initialize debug screen */
|
||||||
|
@ -73,7 +73,7 @@ static int psp_thread_wrap(SceSize args, void *argp)
|
|||||||
static INLINE int pthread_create(pthread_t *thread,
|
static INLINE int pthread_create(pthread_t *thread,
|
||||||
const pthread_attr_t *attr, void *(*start_routine)(void*), void *arg)
|
const pthread_attr_t *attr, void *(*start_routine)(void*), void *arg)
|
||||||
{
|
{
|
||||||
sprintf(name_buffer, "0x%08X", (uint32_t) thread);
|
sprintf(name_buffer, "0x%08X", (unsigned int) thread);
|
||||||
|
|
||||||
#ifdef VITA
|
#ifdef VITA
|
||||||
*thread = sceKernelCreateThread(name_buffer, psp_thread_wrap,
|
*thread = sceKernelCreateThread(name_buffer, psp_thread_wrap,
|
||||||
@ -93,7 +93,7 @@ static INLINE int pthread_create(pthread_t *thread,
|
|||||||
static INLINE int pthread_mutex_init(pthread_mutex_t *mutex,
|
static INLINE int pthread_mutex_init(pthread_mutex_t *mutex,
|
||||||
const pthread_mutexattr_t *attr)
|
const pthread_mutexattr_t *attr)
|
||||||
{
|
{
|
||||||
sprintf(name_buffer, "0x%08X", (uint32_t) mutex);
|
sprintf(name_buffer, "0x%08X", (unsigned int) mutex);
|
||||||
|
|
||||||
#ifdef VITA
|
#ifdef VITA
|
||||||
*mutex = sceKernelCreateMutex(name_buffer, 0, 0, 0);
|
*mutex = sceKernelCreateMutex(name_buffer, 0, 0, 0);
|
||||||
@ -224,7 +224,7 @@ static INLINE int pthread_cond_init(pthread_cond_t *cond,
|
|||||||
if(cond->mutex<0){
|
if(cond->mutex<0){
|
||||||
return cond->mutex;
|
return cond->mutex;
|
||||||
}
|
}
|
||||||
sprintf(name_buffer, "0x%08X", (uint32_t) cond);
|
sprintf(name_buffer, "0x%08X", (unsigned int) cond);
|
||||||
//cond->sema = sceKernelCreateCond(name_buffer, 0, cond->mutex, 0);
|
//cond->sema = sceKernelCreateCond(name_buffer, 0, cond->mutex, 0);
|
||||||
cond->sema = sceKernelCreateSema(name_buffer, 0, 0, 1, 0);
|
cond->sema = sceKernelCreateSema(name_buffer, 0, 0, 1, 0);
|
||||||
if(cond->sema<0){
|
if(cond->sema<0){
|
||||||
@ -251,7 +251,7 @@ static INLINE int pthread_cond_signal(pthread_cond_t *cond)
|
|||||||
if (cond->waiting)
|
if (cond->waiting)
|
||||||
{
|
{
|
||||||
--cond->waiting;
|
--cond->waiting;
|
||||||
int ret = sceKernelSignalSema(cond->sema, 1);
|
sceKernelSignalSema(cond->sema, 1);
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&cond->mutex);
|
pthread_mutex_unlock(&cond->mutex);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#elif defined(GEKKO)
|
#elif defined(GEKKO)
|
||||||
#include "gx_pthread.h"
|
#include "gx_pthread.h"
|
||||||
#elif defined(PSP) || defined(VITA)
|
#elif defined(PSP)
|
||||||
#include "psp_pthread.h"
|
#include "psp_pthread.h"
|
||||||
#elif defined(__CELLOS_LV2__)
|
#elif defined(__CELLOS_LV2__)
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user