(PS3) Can now return to menu from game by pressing L3 + R3

This commit is contained in:
TwinAphex51224 2012-02-11 16:27:13 +01:00
parent 390628b1e3
commit 2148ce9dec
5 changed files with 38 additions and 36 deletions

View File

@ -46,7 +46,6 @@
#define EMULATOR_CONTENT_DIR "SSNE10000"
char special_action_msg[256]; /* message which should be overlaid on top of the screen*/
uint32_t special_action_msg_expired; /* time at which the message no longer needs to be overlaid onscreen*/
uint64_t ingame_menu_item = 0;
char contentInfoPath[MAX_PATH_LENGTH];
@ -71,15 +70,10 @@ SYS_PROCESS_PARAM(1001, 0x100000)
#undef main
uint32_t set_text_message_speed(uint32_t value)
{
return g_frame_count + value;
}
void set_text_message(const char * message, uint32_t speed)
{
snprintf(special_action_msg, sizeof(special_action_msg), message);
special_action_msg_expired = set_text_message_speed(speed);
SET_TIMER_EXPIRATION(speed);
}
static bool file_exists(const char * filename)
@ -386,10 +380,7 @@ static void ingame_menu(void)
ssnes_render_cached_frame();
if(g_frame_count < special_action_msg_expired && blocking)
{
}
else
if(IS_TIMER_EXPIRED() && blocking == false)
{
if(CTRL_CIRCLE(state))
{
@ -728,7 +719,7 @@ static void ingame_menu(void)
cellDbgFontPuts (x_position, (ypos+(ypos_increment*MENU_ITEM_RETURN_TO_XMB)), font_size+0.01f, BLUE, "Return to XMB");
cellDbgFontPuts(x_position, (ypos+(ypos_increment*MENU_ITEM_RETURN_TO_XMB)), font_size, menuitem_colors[MENU_ITEM_RETURN_TO_XMB], "Return to XMB");
if(g_frame_count < special_action_msg_expired)
if(IS_TIMER_NOT_EXPIRED())
{
cellDbgFontPrintf (0.09f, 0.90f, 1.51f, BLUE, special_action_msg);
cellDbgFontPrintf (0.09f, 0.90f, 1.50f, WHITE, special_action_msg);
@ -736,7 +727,6 @@ static void ingame_menu(void)
}
else
{
special_action_msg_expired = 0;
cellDbgFontPrintf (0.09f, 0.90f, 0.98f+0.01f, BLUE, comment);
cellDbgFontPrintf (0.09f, 0.90f, 0.98f, LIGHTBLUE, comment);
}

View File

@ -164,10 +164,7 @@ static void browser_update(filebrowser_t * b)
diff_state = old_state ^ state;
button_was_pressed = old_state & diff_state;
if(g_frame_count < special_action_msg_expired)
{
}
else
if(IS_TIMER_EXPIRED())
{
if (CTRL_LSTICK_DOWN(state))
{
@ -276,16 +273,11 @@ static void browser_update(filebrowser_t * b)
}
if (CTRL_L3(state) && CTRL_R3(state))
{
/* if a rom is loaded then resume it */
if (g_console.emulator_initialized)
{
g_console.menu_enable = false;
g_console.mode_switch = MODE_EMULATION;
set_text_message("", 15);
}
}
g_console.menu_enable = !((CTRL_L3(state) && CTRL_R3(state) && g_console.emulator_initialized));
g_console.mode_switch = g_console.menu_enable ? MODE_MENU : MODE_EMULATION;
if(g_console.mode_switch == MODE_EMULATION)
SET_TIMER_EXPIRATION(60);
old_state = state;
}
@ -1420,10 +1412,7 @@ static void select_setting(menu * menu_obj)
button_was_pressed = old_state & diff_state;
if(g_frame_count < special_action_msg_expired)
{
}
else
if(IS_TIMER_EXPIRED())
{
/* back to ROM menu if CIRCLE is pressed */
if (CTRL_L1(button_was_pressed) || CTRL_CIRCLE(button_was_pressed))

View File

@ -18,9 +18,11 @@
#include "../driver.h"
#include "ps3_input.h"
#include "ps3_video_psgl.h"
#include <stdint.h>
#include "../libsnes.hpp"
#include "../general.h"
#include "shared.h"
#include <stdlib.h>
@ -89,7 +91,7 @@ static bool ps3_key_pressed(void *data, int key)
switch (key)
{
case SSNES_FAST_FORWARD_HOLD_KEY:
return CTRL_RSTICK_UP(state[0]) && CTRL_R2(~state[0]);
return CTRL_RSTICK_DOWN(state[0]) && CTRL_R2(~state[0]);
case SSNES_LOAD_STATE_KEY:
return (CTRL_RSTICK_UP(state[0]) && CTRL_R2(state[0]));
case SSNES_SAVE_STATE_KEY:
@ -99,10 +101,27 @@ static bool ps3_key_pressed(void *data, int key)
case SSNES_STATE_SLOT_MINUS:
return (CTRL_RSTICK_LEFT(state[0]) && CTRL_R2(state[0]));
case SSNES_REWIND:
return CTRL_RSTICK_DOWN(state[0]) && CTRL_R2(~state[0]);
return CTRL_RSTICK_UP(state[0]) && CTRL_R2(~state[0]);
case SSNES_QUIT_KEY:
g_console.ingame_menu_enable = CTRL_R3(state[0]) && !CTRL_L3(state[0]);
return CTRL_R3(state[0]);
{
uint32_t r3_pressed = CTRL_R3(state[0]);
uint32_t l3_pressed = CTRL_L3(state[0]);
bool retval = false;
g_console.menu_enable = (r3_pressed && l3_pressed && IS_TIMER_EXPIRED());
g_console.ingame_menu_enable = r3_pressed && !l3_pressed;
if(g_console.menu_enable && !g_console.ingame_menu_enable)
{
g_console.mode_switch = MODE_MENU;
SET_TIMER_EXPIRATION(60);
retval = g_console.menu_enable;
}
else
{
g_console.mode_switch = MODE_EMULATION;
retval = g_console.ingame_menu_enable;
}
return retval;
}
default:
return false;
}

View File

@ -41,6 +41,10 @@ enum
LAST_ASPECT_RATIO
};
#define IS_TIMER_NOT_EXPIRED() (g_frame_count < g_console.timer_expiration_frame_count)
#define IS_TIMER_EXPIRED() (!(IS_TIMER_NOT_EXPIRED()))
#define SET_TIMER_EXPIRATION(value) g_console.timer_expiration_frame_count = g_frame_count + value;
bool ps3_setup_texture(void);
const char * ps3_get_resolution_label(uint32_t resolution);
int ps3_check_resolution(uint32_t resolution_id);
@ -60,5 +64,6 @@ void ps3graphics_video_init(bool get_all_resolutions);
void ps3graphics_video_reinit(void);
extern void *g_gl;
extern unsigned g_frame_count;
#endif

View File

@ -57,7 +57,6 @@ enum {
#define MENU_ITEM_LAST MENU_ITEM_RETURN_TO_XMB+1
extern char special_action_msg[256];
extern uint32_t special_action_msg_expired;
extern unsigned g_frame_count;
extern bool g_quitting;