Open RetroArch Menu Long Pressing Start button

This commit is contained in:
Francisco Javier Trujillo Mata 2019-01-07 00:25:45 +01:00
parent 3bb0c7caa4
commit f48ffb9aac
5 changed files with 87 additions and 89 deletions

View File

@ -86,21 +86,22 @@ static void audioCreateThread(ps2_audio_t *ps2)
ps2->running = true;
ps2->worker_thread = CreateThread(&thread);
if (ps2->worker_thread >= 0)
{
if (ps2->worker_thread >= 0) {
ret = StartThread(ps2->worker_thread, NULL);
if (ret < 0)
if (ret < 0) {
printf("sound_init: StartThread returned %d\n", ret);
}
else
} else {
printf("CreateThread failed: %d\n", ps2->worker_thread);
}
}
static void audioStopNDeleteThread(ps2_audio_t *ps2)
{
ps2->running = false;
if (ps2->worker_thread)
if (ps2->worker_thread) {
ps2->worker_thread = 0;
}
}
static void audioConfigure(ps2_audio_t *ps2, unsigned rate)
@ -114,8 +115,7 @@ static void audioConfigure(ps2_audio_t *ps2, unsigned rate)
err = audsrv_set_format(&format);
if (err)
{
if (err){
printf("set format returned %d\n", err);
printf("audsrv returned error string: %s\n", audsrv_get_error_string());
}
@ -164,18 +164,15 @@ static void ps2_audio_free(void *data)
if(!ps2)
return;
if(ps2->running)
{
if(ps2->running){
audioStopNDeleteThread(ps2);
if (ps2->lock)
{
if (ps2->lock){
iDeleteSema(ps2->lock);
ps2->lock = 0;
}
if (ps2->cond_lock)
{
if (ps2->cond_lock){
iDeleteSema(ps2->cond_lock);
ps2->cond_lock = 0;
}
@ -192,14 +189,14 @@ static ssize_t ps2_audio_write(void *data, const void *buf, size_t size)
if (!ps2->running)
return -1;
if (ps2->nonblocking)
{
if (ps2->nonblocking){
if (fifo_write_avail(ps2->buffer) < size)
return 0;
}
while (fifo_write_avail(ps2->buffer) < size)
while (fifo_write_avail(ps2->buffer) < size) {
WaitSema(ps2->cond_lock);
}
WaitSema(ps2->lock);
fifo_write(ps2->buffer, buf, size);
@ -213,8 +210,9 @@ static bool ps2_audio_alive(void *data)
bool alive = false;
ps2_audio_t* ps2 = (ps2_audio_t*)data;
if (ps2)
if (ps2) {
alive = ps2->running;
}
return alive;
}
@ -224,8 +222,7 @@ static bool ps2_audio_stop(void *data)
bool stop = true;
ps2_audio_t* ps2 = (ps2_audio_t*)data;
if (ps2)
{
if (ps2) {
audioStopNDeleteThread(ps2);
audsrv_stop_audio();
}
@ -235,14 +232,14 @@ static bool ps2_audio_stop(void *data)
static bool ps2_audio_start(void *data, bool is_shutdown)
{
bool start = true;
ps2_audio_t* ps2 = (ps2_audio_t*)data;
bool start = true;
if(ps2)
{
if (!ps2->running && !ps2->worker_thread)
if (ps2) {
if (!ps2->running && !ps2->worker_thread) {
audioCreateThread(ps2);
}
}
return start;
}
@ -250,8 +247,10 @@ static bool ps2_audio_start(void *data, bool is_shutdown)
static void ps2_audio_set_nonblock_state(void *data, bool toggle)
{
ps2_audio_t* ps2 = (ps2_audio_t*)data;
if (ps2)
if (ps2) {
ps2->nonblocking = toggle;
}
}
static bool ps2_audio_use_float(void *data)
@ -263,8 +262,7 @@ static size_t ps2_audio_write_avail(void *data)
{
ps2_audio_t* ps2 = (ps2_audio_t*)data;
if (ps2 && ps2->running)
{
if (ps2 && ps2->running) {
size_t size;
WaitSema(ps2->lock);
size = AUDIO_BUFFER - fifo_read_avail(ps2->buffer);

View File

@ -401,6 +401,8 @@ static bool default_screenshots_in_content_dir = false;
#if defined(__CELLOS_LV2__) || defined(_XBOX1) || defined(_XBOX360)
static unsigned menu_toggle_gamepad_combo = INPUT_TOGGLE_L3_R3;
#elif defined(PS2)
static unsigned menu_toggle_gamepad_combo = INPUT_TOGGLE_HOLD_START;
#elif defined(VITA)
static unsigned menu_toggle_gamepad_combo = INPUT_TOGGLE_L1_R1_START_SELECT;
#elif defined(SWITCH)

View File

@ -62,14 +62,12 @@ static GSGLOBAL *init_GSGlobal(void) {
dmaKit_init(D_CTRL_RELE_OFF,D_CTRL_MFD_OFF, D_CTRL_STS_UNSPEC,
D_CTRL_STD_OFF, D_CTRL_RCYC_8, 1 << DMA_CHANNEL_GIF);
// Initialize the DMAC
/* Initialize the DMAC */
dmaKit_chan_init(DMA_CHANNEL_GIF);
gsKit_init_screen(gsGlobal);
gsKit_mode_switch(gsGlobal, GS_ONESHOT);
gsKit_clear(gsGlobal, GS_BLACK);
return gsGlobal;
}
@ -144,7 +142,7 @@ if (color_correction) {
static void vram_alloc(GSGLOBAL *gsGlobal, GSTEXTURE *texture) {
uint32_t size = gsKit_texture_size(texture->Width, texture->Height, texture->PSM);
texture->Vram=gsKit_vram_alloc(gsGlobal, size, GSKIT_ALLOC_USERBUFFER);
texture->Vram = gsKit_vram_alloc(gsGlobal, size, GSKIT_ALLOC_USERBUFFER);
if(texture->Vram == GSKIT_ALLOC_ERROR) {
printf("VRAM Allocation Failed. Will not upload texture.\n");
}
@ -225,13 +223,15 @@ static bool ps2_gfx_frame(void *data, const void *frame,
static float fps = 0.0;
#endif
ps2_video_t *ps2 = (ps2_video_t*)data;
bool texture_empty = true;
if (!width || !height)
return false;
if (frame_count%120==0) {
printf("ps2_gfx_frame %d\n", frame_count);
printf("ps2_gfx_frame %lu\n", frame_count);
}
gsKit_clear(ps2->gsGlobal, GS_BLACK);
gsKit_vram_clear(ps2->gsGlobal);
if (frame) {
@ -241,7 +241,7 @@ static bool ps2_gfx_frame(void *data, const void *frame,
prim_texture(ps2->gsGlobal, ps2->coreTexture, 1, ps2->force_aspect);
}
bool texture_empty = !ps2->menuTexture->Width || !ps2->menuTexture->Height;
texture_empty = !ps2->menuTexture->Width || !ps2->menuTexture->Height;
if (ps2->menuVisible && !texture_empty) {
vram_alloc(ps2->gsGlobal, ps2->menuTexture);
gsKit_texture_upload(ps2->gsGlobal, ps2->menuTexture);

View File

@ -32,6 +32,7 @@ static char padBuf[256] __attribute__((aligned(64)));
static uint64_t pad_state[PS2_MAX_PADS];
extern uint64_t lifecycle_state;
static const char *ps2_joypad_name(unsigned pad)
{
@ -45,6 +46,8 @@ static bool ps2_joypad_init(void *data)
for (i = 0; i < players_count; i++)
{
int ret, port, slot;
bool auto_configure = input_autoconfigure_connect( ps2_joypad_name(i),
NULL,
ps2_joypad.ident,
@ -57,9 +60,6 @@ static bool ps2_joypad_init(void *data)
padInit(i);
int ret;
int port, slot;
port = 0; // 0 -> Connector 1, 1 -> Connector 2
slot = 0; // Always zero if not using multitap
@ -101,15 +101,13 @@ static void ps2_joypad_poll(void)
unsigned players_count = PS2_MAX_PADS;
struct padButtonStatus buttons;
for (player = 0; player < players_count; player++)
{
for (player = 0; player < players_count; player++) {
unsigned j, k;
unsigned i = player;
unsigned p = player;
int ret = padRead(player, player, &buttons); // port, slot, buttons
if (ret != 0)
{
if (ret != 0) {
int32_t state_tmp = 0xffff ^ buttons.btns;
pad_state[i] = 0;