Skip to content

Commit

Permalink
Cleanups/style nits
Browse files Browse the repository at this point in the history
  • Loading branch information
LibretroAdmin committed Feb 23, 2023
1 parent 3f3262f commit 7ebab64
Show file tree
Hide file tree
Showing 121 changed files with 1,517 additions and 1,781 deletions.
7 changes: 3 additions & 4 deletions audio/drivers/alsa_qsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static void *alsa_qsa_init(const char *device,
goto error;
}

if((err = snd_pcm_nonblock_mode(alsa->pcm, 1)) < 0)
if ((err = snd_pcm_nonblock_mode(alsa->pcm, 1)) < 0)
{
RARCH_ERR("[ALSA QSA]: Can't set blocking mode: %s\n",
snd_strerror(err));
Expand Down Expand Up @@ -313,11 +313,10 @@ static bool alsa_qsa_start(void *data, bool is_shutdown)

static void alsa_qsa_set_nonblock_state(void *data, bool state)
{
alsa_qsa_t *alsa = (alsa_qsa_t*)data;

int err;
alsa_qsa_t *alsa = (alsa_qsa_t*)data;

if((err = snd_pcm_nonblock_mode(alsa->pcm, state)) < 0)
if ((err = snd_pcm_nonblock_mode(alsa->pcm, state)) < 0)
{
RARCH_ERR("Can't set blocking mode to %d: %s\n", state,
snd_strerror(err));
Expand Down
7 changes: 1 addition & 6 deletions audio/drivers/ctr_csnd_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,9 @@ static ssize_t ctr_csnd_audio_write(void *data, const void *buf, size_t size)
const uint16_t *src = buf;
ctr_csnd_audio_t *ctr = (ctr_csnd_audio_t*)data;

(void)data;
(void)buf;
(void)samples_played;
(void)current_tick;

ctr_csnd_audio_update_playpos(ctr);

if((((ctr->playpos - ctr->pos) & CTR_CSND_AUDIO_COUNT_MASK) < (CTR_CSND_AUDIO_COUNT >> 2)) ||
if ((((ctr->playpos - ctr->pos) & CTR_CSND_AUDIO_COUNT_MASK) < (CTR_CSND_AUDIO_COUNT >> 2)) ||
(((ctr->pos - ctr->playpos ) & CTR_CSND_AUDIO_COUNT_MASK) < (CTR_CSND_AUDIO_COUNT >> 4)) ||
(((ctr->playpos - ctr->pos) & CTR_CSND_AUDIO_COUNT_MASK) < (size >> 2)))
{
Expand Down
11 changes: 6 additions & 5 deletions audio/drivers/ctr_dsp_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,34 +97,35 @@ static ssize_t ctr_dsp_audio_write(void *data, const void *buf, size_t size)
ctr_dsp_audio_t * ctr = (ctr_dsp_audio_t*)data;
uint32_t sample_pos = ndspChnGetSamplePos(ctr->channel);

if((((sample_pos - ctr->pos) & CTR_DSP_AUDIO_COUNT_MASK) < (CTR_DSP_AUDIO_COUNT >> 2)) ||
if ((((sample_pos - ctr->pos) & CTR_DSP_AUDIO_COUNT_MASK) < (CTR_DSP_AUDIO_COUNT >> 2)) ||
(((ctr->pos - sample_pos ) & CTR_DSP_AUDIO_COUNT_MASK) < (CTR_DSP_AUDIO_COUNT >> 4)) ||
(((sample_pos - ctr->pos) & CTR_DSP_AUDIO_COUNT_MASK) < (size >> 2)))
{
if (ctr->nonblock)
ctr->pos = (sample_pos + (CTR_DSP_AUDIO_COUNT >> 1)) & CTR_DSP_AUDIO_COUNT_MASK;
else
{
do{
do
{
svcSleepThread(100000);

/* Run aptMainLoop to update APT state if DSP state
* changed, this prevents a hang on sleep. */
if(!aptMainLoop())
if (!aptMainLoop())
{
command_event(CMD_EVENT_QUIT, NULL);
return true;
}

sample_pos = ndspChnGetSamplePos(ctr->channel);
}while (((sample_pos - (ctr->pos + (size >>2))) & CTR_DSP_AUDIO_COUNT_MASK) > (CTR_DSP_AUDIO_COUNT >> 1)
}while ( ((sample_pos - (ctr->pos + (size >>2))) & CTR_DSP_AUDIO_COUNT_MASK) > (CTR_DSP_AUDIO_COUNT >> 1)
|| (((ctr->pos - (CTR_DSP_AUDIO_COUNT >> 4) - sample_pos) & CTR_DSP_AUDIO_COUNT_MASK) > (CTR_DSP_AUDIO_COUNT >> 1)));
}
}

pos = ctr->pos << 2;

if((pos + size) > CTR_DSP_AUDIO_SIZE)
if ((pos + size) > CTR_DSP_AUDIO_SIZE)
{
memcpy(ctr->dsp_buf.data_pcm8 + pos, buf,
(CTR_DSP_AUDIO_SIZE - pos));
Expand Down
2 changes: 1 addition & 1 deletion audio/drivers/ps3_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static void *ps3_audio_init(const char *device,
params.param_attrib = 0;
#if 0
#ifdef HAVE_HEADSET
if(global->console.sound.mode == SOUND_MODE_HEADSET)
if (global->console.sound.mode == SOUND_MODE_HEADSET)
params.param_attrib = CELL_AUDIO_PORTATTR_OUT_SECONDARY;
#endif
#endif
Expand Down
32 changes: 16 additions & 16 deletions audio/drivers/psp_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,22 +166,23 @@ static void *psp_audio_init(const char *device,
static void psp_audio_free(void *data)
{
psp_audio_t* psp = (psp_audio_t*)data;
if(!psp)
if (!psp)
return;

if(psp->running){
if (psp->running)
{
if (psp->worker_thread)
{
psp->running = false;
sthread_join(psp->worker_thread);
psp->running = false;
sthread_join(psp->worker_thread);
}

if (psp->cond)
scond_free(psp->cond);
scond_free(psp->cond);
if (psp->fifo_lock)
slock_free(psp->fifo_lock);
slock_free(psp->fifo_lock);
if (psp->cond_lock)
slock_free(psp->cond_lock);
slock_free(psp->cond_lock);
}
free(psp->buffer);
psp->worker_thread = NULL;
Expand Down Expand Up @@ -222,7 +223,7 @@ static ssize_t psp_audio_write(void *data, const void *buf, size_t size)
slock_unlock(psp->cond_lock);

slock_lock(psp->fifo_lock);
if((write_pos + sampleCount) > AUDIO_BUFFER_SIZE)
if ((write_pos + sampleCount) > AUDIO_BUFFER_SIZE)
{
memcpy(psp->buffer + write_pos, buf,
(AUDIO_BUFFER_SIZE - write_pos) * sizeof(uint32_t));
Expand Down Expand Up @@ -274,13 +275,13 @@ static bool psp_audio_start(void *data, bool is_shutdown)
{
psp_audio_t* psp = (psp_audio_t*)data;

if(psp && psp->running)
return true;

if (!psp->worker_thread)
if (psp && !psp->running)
{
psp->running = true;
psp->worker_thread = sthread_create(audioMainLoop, psp);
if (!psp->worker_thread)
{
psp->running = true;
psp->worker_thread = sthread_create(audioMainLoop, psp);
}
}

return true;
Expand All @@ -295,7 +296,6 @@ static void psp_audio_set_nonblock_state(void *data, bool toggle)

static bool psp_audio_use_float(void *data)
{
(void)data;
return false;
}

Expand All @@ -315,7 +315,7 @@ static size_t psp_write_avail(void *data)

static size_t psp_buffer_size(void *data)
{
/* TODO */
/* TODO/FIXME - implement? */
return AUDIO_BUFFER_SIZE /** sizeof(uint32_t)*/;
}

Expand Down
2 changes: 1 addition & 1 deletion cores/libretro-ffmpeg/ffmpeg_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,7 @@ static void decode_thread_seek(double time)

decode_last_audio_time = time;

if(avformat_seek_file(fctx, -1, INT64_MIN, seek_to, INT64_MAX, 0) < 0)
if (avformat_seek_file(fctx, -1, INT64_MIN, seek_to, INT64_MAX, 0) < 0)
log_cb(RETRO_LOG_ERROR, "[FFMPEG] av_seek_frame() failed.\n");

if (video_stream_index >= 0)
Expand Down
16 changes: 8 additions & 8 deletions ctr/gpu_old.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,17 +264,17 @@ const u8 GPU_TEVID[]={0xC0,0xC8,0xD0,0xD8,0xF0,0xF8};

void GPU_SetTexEnv(u8 id, u16 rgbSources, u16 alphaSources, u16 rgbOperands, u16 alphaOperands, GPU_COMBINEFUNC rgbCombine, GPU_COMBINEFUNC alphaCombine, u32 constantColor)
{
u32 param[0x5];
if(id > 6)
u32 param[0x5];
if (id > 6)
return;

param[0x0] = (alphaSources << 16) | (rgbSources);
param[0x1] = (alphaOperands << 12) | (rgbOperands);
param[0x2] = (alphaCombine << 16) | (rgbCombine);
param[0x3] = constantColor;
param[0x4] = 0x00000000; /* ? */
param[0x0] = (alphaSources << 16) | (rgbSources);
param[0x1] = (alphaOperands << 12) | (rgbOperands);
param[0x2] = (alphaCombine << 16) | (rgbCombine);
param[0x3] = constantColor;
param[0x4] = 0x00000000; /* ? */

GPUCMD_AddIncrementalWrites(GPUREG_0000|GPU_TEVID[id], param, 0x00000005);
GPUCMD_AddIncrementalWrites(GPUREG_0000|GPU_TEVID[id], param, 0x00000005);
}

void GPU_DrawArray(GPU_Primitive_t primitive, u32 first, u32 count)
Expand Down
6 changes: 4 additions & 2 deletions frontend/drivers/platform_ctr.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ u8* gfxBottomFramebuffers[2];

void gfxSetFramebufferInfo(gfxScreen_t screen, u8 id)
{
if(screen==GFX_TOP)
if (screen==GFX_TOP)
{
u8 enable3d = 0;
u8 bit5=(enable3d != 0);
Expand All @@ -387,7 +387,9 @@ void gfxSetFramebufferInfo(gfxScreen_t screen, u8 id)
enable3d ? (u32*)gfxTopRightFramebuffers[id] : (u32*)gfxTopLeftFramebuffers[id],
240 * 3,
((1)<<8)|((1^bit5)<<6)|((bit5)<<5)|GSP_BGR8_OES);
} else {
}
else
{
gspPresentBuffer(GFX_BOTTOM,
id,
(u32*)gfxBottomFramebuffers[id],
Expand Down
Loading

0 comments on commit 7ebab64

Please sign in to comment.