(PS3) Menu refactoring

This commit is contained in:
TwinAphex51224 2012-01-16 04:07:02 +01:00
parent ee7bacd2bc
commit 44bc9fe291
8 changed files with 760 additions and 637 deletions

18
ps3/colors.h Normal file
View File

@ -0,0 +1,18 @@
/*******************************************************************************
* colors.h - SNES9x PS3
*
* Created on: Oct 20, 2010
********************************************************************************/
// define some colours for dbgfont output (remember it uses ABGR colour format)
#define WHITE 0xffffffffu
#define RED 0xff0000ffu
#define GREEN 0xff00ff00u
#define BLUE 0xffff0000u
#define YELLOW 0xff00ffffu
#define PURPLE 0xffff00ffu
#define CYAN 0xffffff00u
#define ORANGE 0xff0063ffu
#define SILVER 0xff8c848cu
#define LIGHTBLUE 0xFFFFE0E0U
#define LIGHTORANGE 0xFFE0EEFFu

View File

@ -68,6 +68,7 @@
bool g_rom_loaded;
bool return_to_MM; /* launch multiMAN on exit if ROM is passed*/
uint32_t g_screenshots_enabled;
uint32_t g_emulator_initialized = 0;
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*/
@ -124,36 +125,13 @@ static void init_settings(void)
config_file_t * currentconfig = config_file_new(SYS_CONFIG_FILE);
//init_setting_uint("PS3General::ApplyShaderPresetOnStartup", Settings.ApplyShaderPresetOnStartup, 0);
//init_setting_uint("video_aspect_ratio", g_settings.video.aspect_ratio, ASPECT_RATIO_4_3);
init_setting_bool("video_smooth", g_settings.video.smooth, 1);
init_setting_bool("video_second_pass_smooth", g_settings.video.second_pass_smooth, 1);
init_setting_char("video_cg_shader", g_settings.video.cg_shader_path, DEFAULT_SHADER_FILE);
//init_setting_char("video_second_pass_shader", g_settings.video.second_pass_shader, DEFAULT_SHADER_FILE);
//init_setting_char("PS3General::Border", Settings.PS3CurrentBorder, DEFAULT_BORDER_FILE);
//init_setting_uint("PS3General::PS3TripleBuffering",Settings.TripleBuffering, 1);
//init_setting_char("PS3General::ShaderPresetPath", Settings.ShaderPresetPath, "");
//init_setting_char("PS3General::ShaderPresetTitle", Settings.ShaderPresetTitle, "None");
//init_setting_uint("PS3General::ScaleFactor", Settings.ScaleFactor, 2);
init_setting_float("video_fbo_scale_x", g_settings.video.fbo_scale_x, 2.0f);
init_setting_float("video_fbo_scale_y", g_settings.video.fbo_scale_y, 2.0f);
//init_setting_uint("PS3General::ViewportX", Settings.ViewportX, 0);
//init_setting_uint("PS3General::ViewportY", Settings.ViewportY, 0);
//init_setting_uint("PS3General::ViewportWidth", Settings.ViewportWidth, 0);
//init_setting_uint("PS3General::ViewportHeight", Settings.ViewportHeight, 0);
init_setting_bool("video_render_to_texture", g_settings.video.render_to_texture, 1);
//init_setting_uint("PS3General::Orientation", Settings.Orientation, 0);
//init_setting_uint("PS3General::PS3CurrentResolution", Settings.PS3CurrentResolution, NULL);
//init_setting_uint("PS3General::OverscanEnabled", Settings.PS3OverscanEnabled, 0);
//init_setting_int("PS3General::OverscanAmount", Settings.PS3OverscanAmount, 0);
//init_setting_uint("PS3General::PS3PALTemporalMode60Hz", Settings.PS3PALTemporalMode60Hz, 0);
//init_setting_uint("Sound::SoundMode", Settings.SoundMode, SOUND_MODE_NORMAL);
//init_setting_char("RSound::RSoundServerIPAddress", Settings.RSoundServerIPAddress, "0.0.0.0");
init_setting_bool("video_vsync", g_settings.video.vsync, 1);
//init_setting_uint("PS3General::PS3FontSize", Settings.PS3FontSize, 100);
//init_setting_char("savestate_directory", Settings.PS3PathSaveStates, usrDirPath);
//init_setting_char("savefile_directory", g_settings., usrDirPath);
//init_setting_char("PS3Paths::PathROMDirectory", Settings.PS3PathROMDirectory, "/");
init_setting_uint("state_slot", g_extern.state_slot, 0);
init_setting_uint("screenshots_enabled", g_screenshots_enabled, 0);
init_setting_char("cheat_database_path", g_settings.cheat_database, usrDirPath);
@ -237,6 +215,9 @@ int main(int argc, char *argv[])
cellSysmoduleLoadModule(CELL_SYSMODULE_FS);
cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_GAME);
memset(&g_extern, 0, sizeof(g_extern));
memset(&g_settings, 0, sizeof(g_settings));
SSNES_LOG("Registering Callback\n");
cellSysutilRegisterCallback(0, callback_sysutil_exit, NULL);
@ -271,6 +252,9 @@ int main(int argc, char *argv[])
snprintf(arg5, sizeof(arg5), SYS_CONFIG_FILE);
char *argv_[] = { arg1, arg2, arg3, arg4, arg5, NULL };
g_emulator_initialized = 1;
return ssnes_main(sizeof(argv_) / sizeof(argv_[0]) - 1, argv_);
ps3_input_deinit();

File diff suppressed because it is too large Load Diff

35
ps3/menu-port-defines.h Normal file
View File

@ -0,0 +1,35 @@
/* SSNES - A Super Nintendo Entertainment System (SNES) Emulator frontend for libsnes.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
* Copyright (C) 2011-2012 - Daniel De Matteis
*
* Some code herein may be based on code found in BSNES.
*
* SSNES is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* SSNES is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with SSNES.
* If not, see <http://www.gnu.org/licenses/>.
*/
/* allowed ROM extensions - ROMs are separated by a '|' character */
#define ROM_EXTENSIONS "smc|fig|sfc|gd3|gd7|dx2|bsx|swc|zip|SMC|FIG|SFC|BSX|GD3|GD7|DX2|SWC|ZIP"
#define FONT_SIZE 1.0f
#define EMU_MENU_TITLE "SSNES |"
#define VIDEO_MENU_TITLE "SSNES VIDEO |"
#define AUDIO_MENU_TITLE "SSNES AUDIO |"
#define EMULATOR_NAME "SSNES"
#define EMULATOR_VERSION PACKAGE_VERSION
#define cell_console_poll()
#define ps3graphics_draw_menu()
#define Emulator_GetFontSize() FONT_SIZE
#define EXTRA_SELECT_FILE_PART1()
#define EXTRA_SELECT_FILE_PART2()

File diff suppressed because it is too large Load Diff

View File

@ -19,51 +19,36 @@
#ifndef MENU_H_
#define MENU_H_
#define WHITE 0xffffffffu
#define RED 0xff0000ffu
#define GREEN 0xff00ff00u
#define BLUE 0xffff0000u
#define YELLOW 0xff00ffffu
#define PURPLE 0xffff00ffu
#define CYAN 0xffffff00u
#define ORANGE 0xff0063ffu
#define SILVER 0xff8c848cu
#define LIGHTBLUE 0xFFFFE0E0U
#define LIGHTORANGE 0xFFE0EEFFu
#define FONT_SIZE 1.0f
#include "colors.h"
typedef struct
{
uint32_t enum_id; /* enum ID of item */
char text[256]; /* item label */
char setting_text[256]; /* setting label */
float text_xpos; /* text X position (upper left corner) */
float text_ypos; /* text Y position (upper left corner) */
uint32_t text_selected_color; /* text color if selected */
uint32_t text_unselected_color; /* text color if not selected */
uint32_t text_color; /* text color */
char comment[256]; /* item comment */
uint32_t comment_color; /* color of item comment */
uint32_t item_color; /* color of item */
float comment_scalefont; /* font scale of item comment */
float comment_xpos; /* comment X position (upper left corner) */
float comment_ypos; /* comment Y position (upper left corner) */
unsigned int * setting_ptr; /* associated pointer to setting member */
char comment_yes[256]; /* item comment (yes - if setting_ptr true) */
char comment_no[256]; /* item comment (no - if setting_ptr false) */
uint32_t default_value; /* default value of item */
uint32_t enabled; /* is the item enabled? */
uint32_t page; /* page */
} item;
typedef struct
{
char title[64]; /* menu title */
uint32_t enum_id; /* enum ID of menu */
uint32_t selected; /* index of selected item */
uint32_t page; /* page */
uint32_t refreshpage; /* bit whether or not to refresh page */
uint32_t first_setting; /* first setting */
uint32_t max_settings; /* max no of settings in menu */
item *items; /* menu items */
char title[64]; /* menu title */
uint32_t enum_id; /* enum ID of menu */
uint32_t selected; /* index of selected item */
uint32_t page; /* page */
uint32_t max_pages; /* max pages */
uint32_t refreshpage; /* bit whether or not to refresh page */
uint32_t first_setting; /* first setting */
uint32_t max_settings; /* max no of settings in menu */
item *items; /* menu items */
} menu;
@ -75,17 +60,15 @@ typedef struct
#define EMU_AUDIO_MENU 5
#define PATH_MENU 6
#define CONTROLS_MENU 7
#define SHADER_CHOICE 8
#define PRESET_CHOICE 9
#define BORDER_CHOICE 10
#define PATH_CHOICE 11
#define GAME_AWARE_SHADER_CHOICE 12
#define PATH_SAVESTATES_DIR_CHOICE 13
#define PATH_DEFAULT_ROM_DIR_CHOICE 14
#define PATH_CHEATS_DIR_CHOICE 15
#define PATH_SRAM_DIR_CHOICE 16
#define PATH_BASE_DIR_CHOICE 17
#define INPUT_PRESET_CHOICE 18
#define GAME_AWARE_SHADER_CHOICE 8
#define SHADER_CHOICE 9
#define PRESET_CHOICE 10
#define BORDER_CHOICE 11
#define PATH_SAVESTATES_DIR_CHOICE 12
#define PATH_DEFAULT_ROM_DIR_CHOICE 13
#define PATH_CHEATS_DIR_CHOICE 14
#define PATH_SRAM_DIR_CHOICE 15
#define INPUT_PRESET_CHOICE 16
enum
{
@ -111,10 +94,12 @@ enum
SETTING_SOUND_MODE,
SETTING_RSOUND_SERVER_IP_ADDRESS,
SETTING_DEFAULT_AUDIO_ALL,
SETTING_EMU_CURRENT_SAVE_STATE_SLOT,
SETTING_EMU_DEFAULT_ALL,
/* port-specific */
SETTING_EMU_CURRENT_SAVE_STATE_SLOT,
SETTING_EMU_DEFAULT_ALL,
SETTING_EMU_VIDEO_DEFAULT_ALL,
SETTING_EMU_AUDIO_DEFAULT_ALL,
/* end of port-specific */
SETTING_PATH_DEFAULT_ROM_DIRECTORY,
SETTING_PATH_SAVESTATES_DIRECTORY,
SETTING_PATH_SRAM_DIRECTORY,
@ -175,9 +160,8 @@ enum
#define MAX_NO_OF_PATH_SETTINGS SETTING_PATH_DEFAULT_ALL+1
#define MAX_NO_OF_CONTROLS_SETTINGS SETTING_CONTROLS_DEFAULT_ALL+1
void menu_init(void);
void menu_loop(void);
extern uint32_t menu_is_running;
void menu_init (void);
void menu_loop (void);
extern uint32_t menu_is_running;
#endif /* MENU_H_ */

View File

@ -56,20 +56,18 @@ static void producesettingentry(uint64_t switchvalue)
}
break;
*/
#ifdef HAVE_GAMEAWARE
case SETTING_GAME_AWARE_SHADER:
if((CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_CROSS(state)) && Settings.ScaleEnabled)
if((CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_CROSS(state)))
{
menuStackindex++;
menuStack[menuStackindex] = menu_filebrowser;
menuStack[menuStackindex].enum_id = GAME_AWARE_SHADER_CHOICE;
set_initial_dir_tmpbrowser = true;
}
if(CTRL_START(state) && Settings.ScaleEnabled)
if(CTRL_START(state))
{
}
break;
#endif
case SETTING_SHADER_PRESETS:
if(g_settings.video.render_to_texture)
{
@ -409,5 +407,7 @@ static void producesettingentry(uint64_t switchvalue)
//emulator_set_controls("", SET_ALL_CONTROLS_TO_DEFAULT, "Default");
}
break;
default:
break;
}
}

View File

@ -19,6 +19,7 @@
#define MAX_PATH_LENGTH 1024
extern char special_action_msg[256];
extern uint32_t g_emulator_initialized;
extern uint32_t special_action_msg_expired;
extern unsigned g_frame_count;
extern bool g_rom_loaded;