diff --git a/ps3/colors.h b/ps3/colors.h new file mode 100644 index 0000000000..a9db4543bf --- /dev/null +++ b/ps3/colors.h @@ -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 diff --git a/ps3/main.c b/ps3/main.c index 10b5b3e0fc..9b590e2bd1 100644 --- a/ps3/main.c +++ b/ps3/main.c @@ -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(); diff --git a/ps3/menu-entries.h b/ps3/menu-entries.h index 6f7ee41aaa..4ca1dfe868 100644 --- a/ps3/menu-entries.h +++ b/ps3/menu-entries.h @@ -21,1158 +21,959 @@ static item items_generalsettings[MAX_NO_OF_CONTROLS_SETTINGS] = { SETTING_CHANGE_RESOLUTION, /* enum ID of item*/ "Resolution", /* item label */ + "", /* setting label */ 0.0f, /* text X position */ 0.0f, /* text Y position */ - YELLOW, /* text color if selected */ - WHITE, /* text color if not selected */ + YELLOW, /* text color */ "INFO - Change the display resolution - press X to confirm.", /* item comment */ - LIGHTBLUE, /* color of item comment */ + WHITE, /* color of item comment */ 0.91f, /* font scale of item comment */ 0.09f, /* comment X position */ 0.83f, /* comment Y position */ - NULL, /* associated pointer to setting */ - {0}, /* item comment (yes if setting_ptr true) */ - {0} /* item comment (no if setting_ptr false) */ }, { SETTING_SHADER_PRESETS, "Shader Preset", + "", 0.0f, 0.0f, YELLOW, - WHITE, "", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0} }, { SETTING_BORDER, "Selected border", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - Select an image file as the background border for 'border shaders'.\nNOTE: The image has to be in PNG format.", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0}, 0, 1 }, { SETTING_SHADER, "Selected shader #1", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - Select a shader as [Shader #1]. NOTE: Some shaders might be\ntoo slow at 1080p. If you experience any slowdown, try another shader.", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0}, 0, 1 }, { SETTING_SHADER_2, "Selected shader #2", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - Select a shader as [Shader #2]. NOTE: Some shaders might be\ntoo slow at 1080p. If you experience any slowdown, try another shader.", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0}, 0, 1 }, { SETTING_GAME_AWARE_SHADER, "Game Aware Shader Script", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - Select a [Game Aware Shader] script.", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0}, 0, 1 }, { SETTING_FONT_SIZE, "Font Size", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - Increase or decrease the font size in the menu.", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0}, 0, 1 }, { SETTING_KEEP_ASPECT_RATIO, "Aspect Ratio", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - [Aspect Ratio] is set to 'Scaled (4:3)' - screen will have black\nborders left/right on widescreen TVs/monitors.", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - "INFO - [Aspect ratio] is set to 'Scaled' - screen will have black\nborders left and right on widescreen TVs/monitors.", - "INFO - [Aspect ratio] is set to 'Stretched' - widescreen TVs/monitors will\n have a full stretched picture.", 1, 1 }, { SETTING_HW_TEXTURE_FILTER, "Hardware Filtering shader #1", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - Hardware filtering is set to 'Bilinear filtering' for [Shader #1].", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - "INFO - Hardware filtering is set to 'Bilinear filtering' for [Shader #1].", - "INFO - Hardware filtering is set to 'Point filtering' for [Shader #1] -\nmost shaders look much better on this setting.", 1, 1 }, { SETTING_HW_TEXTURE_FILTER_2, "Hardware Filtering shader #2", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - Hardware filtering is set to 'Bilinear filtering' for [Shader #2].", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - "INFO - Hardware filtering is set to 'Bilinear filtering' for [Shader #2].", - "INFO - Hardware filtering is set to 'Point filtering' for [Shader #2] -\nmost shaders look much better on this setting.", 1, 1 }, { SETTING_SCALE_ENABLED, "Custom Scaling/Dual Shaders", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - [Custom Scaling] is set to 'ON' - 2x shaders will look much\nbetter, and you can select a shader for [Shader #2].", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - "INFO - [Custom Scaling] is set to 'ON' - 2x shaders will look much\nbetter, and you can select a shader for [Shader #2].", - "INFO - [Custom Scaling] is set to 'OFF'. You will only be able to select\na shader for [Shader #1].", 1, 1 }, { SETTING_SCALE_FACTOR, "Custom Scaling Factor", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - [Custom Scaling Factor] is set to '2x'.", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0}, 2, 1 }, { SETTING_HW_OVERSCAN_AMOUNT, "Overscan", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - Adjust or decrease [Overscan]. Set this to higher than 0.000\nif the screen doesn't fit on your TV/monitor.", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0}, 0, 1 }, { SETTING_THROTTLE_MODE, "Throttle Mode", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - [Throttle Mode] is set to 'ON' - VSync is enabled and sound\nis turned on.", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - "INFO - [Throttle mode] is set to 'ON' - VSync is enabled and sound\nis turned on.", - "INFO - [Throttle Mode] is set to 'OFF' - VSync is disabled and sound\nis turned off. NOTE: Useful for benchmarking (measure raw FPS).", 1, 1 }, { SETTING_TRIPLE_BUFFERING, "Triple Buffering", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - [Triple Buffering] is set to 'ON' - faster graphics/shaders at\nthe possible expense of input lag.", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - "INFO - [Triple Buffering] is set to 'ON' - faster graphics/shaders at\nthe possible expense of input lag", - "INFO - [Triple Buffering] is set to 'OFF' - slower graphics, but\npossibly better input response times.", 1, 1 }, { SETTING_ENABLE_SCREENSHOTS, "Enable Screenshots Feature", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - [Enable Screenshots] feature is set to 'OFF'.", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - "INFO - [Enable Screenshots] is set to 'ON'.", - "INFO - [Enable Screenshots] is set to 'OFF'.", 1, 1 }, { SETTING_SAVE_SHADER_PRESET, "SAVE SETTINGS AS SHADER PRESET", + "", 0.0f, 0.0f, YELLOW, - GREEN, "INFO - Save the current video settings to a shader preset file.", - LIGHTBLUE, + GREEN, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0}, 0, 1 }, { SETTING_APPLY_SHADER_PRESET_ON_STARTUP, "APPLY SHADER PRESET ON STARTUP", + "", 0.0f, 0.0f, YELLOW, - GREEN, "INFO - Automatically load the shader preset on startup.", - LIGHTBLUE, + GREEN, 0.91f, 0.09f, 0.83f, - NULL, - "INFO - [Apply Shader Preset On Startup] is set to 'ON'.", - "INFO - [Apply Shader Preset On Startup] is set to 'OFF'.", 0, 1 }, { SETTING_DEFAULT_VIDEO_ALL, "DEFAULT", + "", 0.0f, 0.0f, YELLOW, - GREEN, "INFO - Set all [General Video Settings] back to their 'DEFAULT' values.", - LIGHTBLUE, + GREEN, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0}, 0, 1 }, { SETTING_SOUND_MODE, "Sound Output", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - [Sound Output] is set to 'Normal' - normal audio output will be\nused.", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0}, 0, 1 }, { SETTING_RSOUND_SERVER_IP_ADDRESS, "RSound Audio Server IP Address", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - Enter the IP Address of the [RSound Audio Server]. IP address\nmust be an IPv4 32-bits address, eg: '192.168.1.7'.", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0}, 0, 1 }, { SETTING_DEFAULT_AUDIO_ALL, "DEFAULT", + "", 0.0f, 0.0f, YELLOW, - GREEN, "INFO - Set all [General Audio Settings] back to their 'DEFAULT' values.", - LIGHTBLUE, + GREEN, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0}, 0, 1 }, + /* port-specific */ { SETTING_EMU_CURRENT_SAVE_STATE_SLOT, "Current save state slot", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - Set the current savestate slot (can also be configured ingame).", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0}, 0, 1 }, { SETTING_EMU_DEFAULT_ALL, "DEFAULT", + "", 0.0f, 0.0f, YELLOW, + "INFO - Set [all SNES9x settings] back to their 'DEFAULT' values.", GREEN, - "INFO - Set [all SSNES settings] back to their 'DEFAULT' values.", - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0}, 0, 1 }, { SETTING_EMU_VIDEO_DEFAULT_ALL, "DEFAULT", + "", 0.0f, 0.0f, YELLOW, + "INFO - Set [all SNES9x Video settings] back to their 'DEFAULT' values.", GREEN, - "INFO - Set [all SSNES Video settings] back to their 'DEFAULT' values.", - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0}, 0, 1 }, { SETTING_EMU_AUDIO_DEFAULT_ALL, "DEFAULT", + "", 0.0f, 0.0f, YELLOW, + "INFO - Set [all SNES9x Audio settings] back to their 'DEFAULT' values.", GREEN, - "INFO - Set [all SSNES Audio settings] back to their 'DEFAULT' values.", - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0}, 0, 1 }, + /* end of port-specific */ { SETTING_PATH_DEFAULT_ROM_DIRECTORY, "Startup ROM Directory", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - Set the default [Startup ROM directory]. NOTE: You will have to\nrestart the emulator for this change to have any effect.", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0} }, { SETTING_PATH_SAVESTATES_DIRECTORY, "Savestate Directory", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - Set the default path where all the savestate files will be saved to.", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0} }, { SETTING_PATH_SRAM_DIRECTORY, "SRAM Directory", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - Set the default SRAM (SaveRAM) directory path. All the\nbattery backup saves will be stored in this directory.", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0} }, { SETTING_PATH_CHEATS, "Cheatfile Directory", + "", 0.0f, 0.0f, YELLOW, - WHITE, "INFO - Set the default [Cheatfile directory] path. All CHT (cheat) files\nwill be stored here.", - LIGHTBLUE, + WHITE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0} }, { SETTING_PATH_DEFAULT_ALL, "DEFAULT", + "", 0.0f, 0.0f, YELLOW, - GREEN, "INFO - Set [all Path settings] back to their 'DEFAULT' values.", - LIGHTBLUE, + GREEN, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0} }, { SETTING_CONTROLS_SCHEME, "Control Scheme Preset", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0} }, { SETTING_CONTROLS_NUMBER, "Controller No", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0} }, { SETTING_CONTROLS_DPAD_UP, "D-Pad Up", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SNES_DEVICE_ID_JOYPAD_UP }, { SETTING_CONTROLS_DPAD_DOWN, "D-Pad Down", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SNES_DEVICE_ID_JOYPAD_DOWN }, { SETTING_CONTROLS_DPAD_LEFT, "D-Pad Left", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SNES_DEVICE_ID_JOYPAD_LEFT }, { SETTING_CONTROLS_DPAD_RIGHT, "D-Pad Right", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SNES_DEVICE_ID_JOYPAD_RIGHT }, { SETTING_CONTROLS_BUTTON_CIRCLE, "Circle button", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SNES_DEVICE_ID_JOYPAD_A }, { SETTING_CONTROLS_BUTTON_CROSS, "Cross button", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SNES_DEVICE_ID_JOYPAD_B }, { SETTING_CONTROLS_BUTTON_TRIANGLE, "Triangle button", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SNES_DEVICE_ID_JOYPAD_X }, { SETTING_CONTROLS_BUTTON_SQUARE, "Square button", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SNES_DEVICE_ID_JOYPAD_Y }, { SETTING_CONTROLS_BUTTON_SELECT, "Select button", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SNES_DEVICE_ID_JOYPAD_SELECT }, { SETTING_CONTROLS_BUTTON_START, "Start button", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SNES_DEVICE_ID_JOYPAD_START }, { SETTING_CONTROLS_BUTTON_L1, "L1 button", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SNES_DEVICE_ID_JOYPAD_L }, { SETTING_CONTROLS_BUTTON_R1, "R1 button", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SNES_DEVICE_ID_JOYPAD_R }, { SETTING_CONTROLS_BUTTON_L2, "L2 button", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, 0 }, { SETTING_CONTROLS_BUTTON_R2, "R2 button", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, 0 }, { SETTING_CONTROLS_BUTTON_L3, "L3 button", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, 0 }, { SETTING_CONTROLS_BUTTON_R3, "R3 button", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SSNES_INGAME_MENU }, { SETTING_CONTROLS_BUTTON_L2_BUTTON_L3, "Button combo: L2 & L3", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, 0 }, { SETTING_CONTROLS_BUTTON_L2_BUTTON_R3, "Button combo: L2 & R3", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, 0 }, { SETTING_CONTROLS_BUTTON_L2_ANALOG_R_RIGHT, "Button combo: L2 & RStick Right", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SSNES_CHEAT_INDEX_PLUS }, { SETTING_CONTROLS_BUTTON_L2_ANALOG_R_LEFT, "Button combo: L2 & RStick Left", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SSNES_CHEAT_INDEX_MINUS }, { SETTING_CONTROLS_BUTTON_L2_ANALOG_R_UP, "Button combo: L2 & RStick Up", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SSNES_CHEAT_TOGGLE }, { SETTING_CONTROLS_BUTTON_L2_ANALOG_R_DOWN, "Button combo: L2 & RStick Down", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SSNES_CHEAT_INPUT }, { SETTING_CONTROLS_BUTTON_R2_ANALOG_R_RIGHT, "Button combo: R2 & RStick Right", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SSNES_STATE_SLOT_PLUS }, { SETTING_CONTROLS_BUTTON_R2_ANALOG_R_LEFT, "Button combo: R2 & RStick Left", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SSNES_STATE_SLOT_MINUS }, { SETTING_CONTROLS_BUTTON_R2_ANALOG_R_UP, "Button combo: R2 & RStick Up", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SSNES_LOAD_STATE_KEY }, { SETTING_CONTROLS_BUTTON_R2_ANALOG_R_DOWN, "Button combo: R2 & RStick Down", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SSNES_SAVE_STATE_KEY }, { SETTING_CONTROLS_BUTTON_R2_BUTTON_R3, "Button combo: R2 & R3", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SSNES_SRAM_WRITE_PROTECT }, { SETTING_CONTROLS_BUTTON_R3_BUTTON_L3, "Button combo: R3 & L3", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SSNES_EXIT_TO_MENU }, { SETTING_CONTROLS_ANALOG_R_UP, "Right Stick - Up", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, 0 }, { SETTING_CONTROLS_ANALOG_R_DOWN, "Right Stick - Down", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, SSNES_FAST_FORWARD_KEY }, { SETTING_CONTROLS_ANALOG_R_LEFT, "Right Stick - Left", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, 0, 1 }, { SETTING_CONTROLS_ANALOG_R_RIGHT, "Right Stick - Right", + "", 0.0f, 0.0f, YELLOW, + "", WHITE, - {0}, - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, //setting ptr - {0}, - {0}, - 0, + SSNES_FAST_FORWARD_KEY, 1 }, { SETTING_CONTROLS_SAVE_CUSTOM_CONTROLS, "SAVE CUSTOM CONTROLS", + "", 0.0f, 0.0f, YELLOW, + "INFO - Save the custom control settings.", GREEN, - "INFO - Save the custom control settings.\nNOTE: This option will not do anything with Control Scheme [New] or [Default].", - LIGHTBLUE, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0}, 0, 1 }, { SETTING_CONTROLS_DEFAULT_ALL, "DEFAULT", + "", 0.0f, 0.0f, YELLOW, - GREEN, "INFO - Set all [Controls settings] back to their 'DEFAULT' values.", - LIGHTBLUE, + GREEN, 0.91f, 0.09f, 0.83f, - NULL, - {0}, - {0}, 0, 1 } diff --git a/ps3/menu-port-defines.h b/ps3/menu-port-defines.h new file mode 100644 index 0000000000..0767607974 --- /dev/null +++ b/ps3/menu-port-defines.h @@ -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 . + */ + +/* 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() diff --git a/ps3/menu.c b/ps3/menu.c index a428c13764..9bdd5d8f65 100644 --- a/ps3/menu.c +++ b/ps3/menu.c @@ -16,6 +16,7 @@ * If not, see . */ +#include #include #include @@ -27,6 +28,7 @@ #include "shared.h" #include "../general.h" +#include "menu-port-defines.h" #include "menu.h" #include "menu-entries.h" @@ -35,22 +37,21 @@ #define NUM_ENTRY_PER_PAGE 19 -static int menuStackindex = 0; -static menu menuStack[25]; -uint32_t menu_is_running = 0; /* is the menu running?*/ +menu menuStack[25]; +int menuStackindex = 0; +uint32_t menu_is_running = false; /* is the menu running?*/ static bool set_initial_dir_tmpbrowser; filebrowser_t browser; /* main file browser->for rom browser*/ filebrowser_t tmpBrowser; /* tmp file browser->for everything else*/ - uint32_t set_shader = 0; static uint32_t currently_selected_controller_menu = 0; - static menu menu_filebrowser = { "FILE BROWSER |", /* title*/ FILE_BROWSER_MENU, /* enum*/ 0, /* selected item*/ 0, /* page*/ + 1, /* maxpages */ 1, /* refreshpage*/ NULL /* items*/ }; @@ -60,6 +61,7 @@ static menu menu_generalvideosettings = { GENERAL_VIDEO_MENU, /* enum*/ FIRST_VIDEO_SETTING, /* selected item*/ 0, /* page*/ + MAX_NO_OF_VIDEO_SETTINGS/NUM_ENTRY_PER_PAGE, /* max pages */ 1, /* refreshpage*/ FIRST_VIDEO_SETTING, /* first setting*/ MAX_NO_OF_VIDEO_SETTINGS, /* max no of path settings*/ @@ -71,6 +73,7 @@ static menu menu_generalaudiosettings = { GENERAL_AUDIO_MENU, /* enum*/ FIRST_AUDIO_SETTING, /* selected item*/ 0, /* page*/ + MAX_NO_OF_AUDIO_SETTINGS/NUM_ENTRY_PER_PAGE, /* max pages */ 1, /* refreshpage*/ FIRST_AUDIO_SETTING, /* first setting*/ MAX_NO_OF_AUDIO_SETTINGS, /* max no of path settings*/ @@ -78,80 +81,85 @@ static menu menu_generalaudiosettings = { }; static menu menu_emu_settings = { - "SSNES |", /* title*/ - EMU_GENERAL_MENU, /* enum*/ - FIRST_EMU_SETTING, /* selected item*/ - 0, /* page*/ - 1, /* refreshpage*/ - FIRST_EMU_SETTING, /* first setting*/ - MAX_NO_OF_EMU_SETTINGS, /* max no of path settings*/ - items_generalsettings /* items*/ + EMU_MENU_TITLE, /* title*/ + EMU_GENERAL_MENU, /* enum*/ + FIRST_EMU_SETTING, /* selected item*/ + 0, /* page*/ + MAX_NO_OF_EMU_SETTINGS/NUM_ENTRY_PER_PAGE, /* max pages*/ + 1, /* refreshpage*/ + FIRST_EMU_SETTING, /* first setting*/ + MAX_NO_OF_EMU_SETTINGS, /* max no of path settings*/ + items_generalsettings /* items*/ }; static menu menu_emu_videosettings = { - "SSNES VIDEO |", /* title*/ - EMU_VIDEO_MENU, /* enum*/ - FIRST_EMU_VIDEO_SETTING, /* selected item*/ - 0, /* page*/ - 1, /* refreshpage*/ - FIRST_EMU_VIDEO_SETTING, /* first setting*/ - MAX_NO_OF_EMU_VIDEO_SETTINGS, /* max no of path settings*/ - items_generalsettings /* items*/ + VIDEO_MENU_TITLE, /* title*/ + EMU_VIDEO_MENU, /* enum */ + FIRST_EMU_VIDEO_SETTING, /* selected item*/ + 0, /* page*/ + MAX_NO_OF_EMU_VIDEO_SETTINGS/NUM_ENTRY_PER_PAGE, /* max pages */ + 1, /* refreshpage*/ + FIRST_EMU_VIDEO_SETTING, /* first setting*/ + MAX_NO_OF_EMU_VIDEO_SETTINGS, /* max no of settings*/ + items_generalsettings /* items*/ }; static menu menu_emu_audiosettings = { - "SSNES AUDIO |", /* title*/ - EMU_AUDIO_MENU, /* enum*/ - FIRST_EMU_AUDIO_SETTING, /* selected item*/ - 0, /* page*/ - 1, /* refreshpage*/ - FIRST_EMU_AUDIO_SETTING, /* first setting*/ - MAX_NO_OF_EMU_AUDIO_SETTINGS, /* max no of path settings*/ - items_generalsettings /* items*/ + AUDIO_MENU_TITLE, /* title*/ + EMU_AUDIO_MENU, /* enum*/ + FIRST_EMU_AUDIO_SETTING, /* selected item*/ + 0, /* page*/ + MAX_NO_OF_EMU_AUDIO_SETTINGS/NUM_ENTRY_PER_PAGE, /* max pages*/ + 1, /* refreshpage*/ + FIRST_EMU_AUDIO_SETTING, /* first setting*/ + MAX_NO_OF_EMU_AUDIO_SETTINGS, /* max no of path settings*/ + items_generalsettings /* items*/ }; static menu menu_pathsettings = { - "PATH |", /* title*/ - PATH_MENU, /* enum*/ - FIRST_PATH_SETTING, /* selected item*/ - 0, /* page*/ - 1, /* refreshpage*/ - FIRST_PATH_SETTING, /* first setting*/ - MAX_NO_OF_PATH_SETTINGS, /* max no of path settings*/ - items_generalsettings /* items*/ + "PATH |", /* title*/ + PATH_MENU, /* enum*/ + FIRST_PATH_SETTING, /* selected item*/ + 0, /* page*/ + MAX_NO_OF_PATH_SETTINGS/NUM_ENTRY_PER_PAGE, /* max pages*/ + 1, /* refreshpage*/ + FIRST_PATH_SETTING, /* first setting*/ + MAX_NO_OF_PATH_SETTINGS, /* max no of path settings*/ + items_generalsettings /* items*/ }; static menu menu_controlssettings = { - "CONTROLS |", /* title*/ - CONTROLS_MENU, /* enum*/ - FIRST_CONTROLS_SETTING_PAGE_1, /* selected item*/ - 0, /* page*/ - 1, /* refreshpage*/ - FIRST_CONTROLS_SETTING_PAGE_1, /* first setting*/ - MAX_NO_OF_CONTROLS_SETTINGS, /* max no of path settings*/ - items_generalsettings /* items*/ + "CONTROLS |", /* title */ + CONTROLS_MENU, /* enum */ + FIRST_CONTROLS_SETTING_PAGE_1, /* selected item */ + 0, /* page */ + MAX_NO_OF_CONTROLS_SETTINGS/NUM_ENTRY_PER_PAGE, /* max pages */ + 1, /* refreshpage */ + FIRST_CONTROLS_SETTING_PAGE_1, /* first setting */ + MAX_NO_OF_CONTROLS_SETTINGS, /* max no of path settings*/ + items_generalsettings /* items */ }; static void display_menubar(uint32_t menu_enum) { - cellDbgFontPuts (0.09f, 0.05f, FONT_SIZE, menu_enum == GENERAL_VIDEO_MENU ? RED : GREEN, menu_generalvideosettings.title); - cellDbgFontPuts (0.19f, 0.05f, FONT_SIZE, menu_enum == GENERAL_AUDIO_MENU ? RED : GREEN, menu_generalaudiosettings.title); - cellDbgFontPuts (0.29f, 0.05f, FONT_SIZE, menu_enum == EMU_GENERAL_MENU ? RED : GREEN, menu_emu_settings.title); - cellDbgFontPuts (0.38f, 0.05f, FONT_SIZE, menu_enum == EMU_VIDEO_MENU ? RED : GREEN, menu_emu_videosettings.title); - cellDbgFontPuts (0.54f, 0.05f, FONT_SIZE, menu_enum == EMU_AUDIO_MENU ? RED : GREEN, menu_emu_audiosettings.title); - cellDbgFontPuts (0.70f, 0.05f, FONT_SIZE, menu_enum == PATH_MENU ? RED : GREEN, menu_pathsettings.title); - cellDbgFontPuts (0.80f, 0.05f, FONT_SIZE, menu_enum == CONTROLS_MENU ? RED : GREEN, menu_controlssettings.title); + cellDbgFontPuts (0.09f, 0.05f, Emulator_GetFontSize(), menu_enum == GENERAL_VIDEO_MENU ? RED : GREEN, menu_generalvideosettings.title); + cellDbgFontPuts (0.19f, 0.05f, Emulator_GetFontSize(), menu_enum == GENERAL_AUDIO_MENU ? RED : GREEN, menu_generalaudiosettings.title); + cellDbgFontPuts (0.29f, 0.05f, Emulator_GetFontSize(), menu_enum == EMU_GENERAL_MENU ? RED : GREEN, menu_emu_settings.title); + cellDbgFontPuts (0.39f, 0.05f, Emulator_GetFontSize(), menu_enum == EMU_VIDEO_MENU ? RED : GREEN, menu_emu_videosettings.title); + cellDbgFontPuts (0.57f, 0.05f, Emulator_GetFontSize(), menu_enum == EMU_AUDIO_MENU ? RED : GREEN, menu_emu_audiosettings.title); + cellDbgFontPuts (0.75f, 0.05f, Emulator_GetFontSize(), menu_enum == PATH_MENU ? RED : GREEN, menu_pathsettings.title); + cellDbgFontPuts (0.84f, 0.05f, Emulator_GetFontSize(), menu_enum == CONTROLS_MENU ? RED : GREEN, menu_controlssettings.title); cellDbgFontDraw(); } -#define ROM_EXTENSIONS "fds|FDS|zip|ZIP|nes|NES|unif|UNIF|smc|fig|sfc|gd3|gd7|dx2|bsx|swc|SMC|FIG|SFC|BSX|GD3|GD7|DX2|SWC" - -static void UpdateBrowser(filebrowser_t * b) +static void browser_update(filebrowser_t * b) { static uint64_t old_state = 0; - uint64_t state = cell_pad_input_poll_device(0); - uint64_t diff_state = old_state ^ state; - uint64_t button_was_pressed = old_state & diff_state; + uint64_t state, diff_state, button_was_pressed; + + state = cell_pad_input_poll_device(0); + diff_state = old_state ^ state; + button_was_pressed = old_state & diff_state; if(g_frame_count < special_action_msg_expired) { @@ -232,6 +240,22 @@ static void UpdateBrowser(filebrowser_t * b) set_text_message("", 7); } + if (CTRL_R2(state)) + { + b->currently_selected = (MIN(b->currently_selected + 50, b->file_count-1)); + set_text_message("", 7); + } + + if (CTRL_L2(state)) + { + if (b->currently_selected <= NUM_ENTRY_PER_PAGE) + b->currently_selected= 0; + else + b->currently_selected -= 50; + + set_text_message("", 7); + } + if (CTRL_L1(state)) { if (b->currently_selected <= NUM_ENTRY_PER_PAGE) @@ -251,8 +275,8 @@ static void UpdateBrowser(filebrowser_t * b) if (CTRL_L3(state) && CTRL_R3(state)) { - /* if a rom is loaded then resume it*/ - if (g_rom_loaded) + /* if a rom is loaded then resume it */ + if (g_emulator_initialized) { menu_is_running = 0; set_text_message("", 15); @@ -263,29 +287,40 @@ static void UpdateBrowser(filebrowser_t * b) } } -static void RenderBrowser(filebrowser_t * b) +static void browser_render(filebrowser_t * b) { uint32_t file_count = b->file_count; - int current_index = b->currently_selected; + int current_index, page_number, page_base, i; + float currentX, currentY, ySpacing; - int page_number = current_index / NUM_ENTRY_PER_PAGE; - int page_base = page_number * NUM_ENTRY_PER_PAGE; - float currentX = 0.09f; - float currentY = 0.09f; - float ySpacing = 0.035f; + current_index = b->currently_selected; + page_number = current_index / NUM_ENTRY_PER_PAGE; + page_base = page_number * NUM_ENTRY_PER_PAGE; - for (int i = page_base; i < file_count && i < page_base + NUM_ENTRY_PER_PAGE; ++i) + currentX = 0.09f; + currentY = 0.09f; + ySpacing = 0.035f; + + for ( i = page_base; i < file_count && i < page_base + NUM_ENTRY_PER_PAGE; ++i) { currentY = currentY + ySpacing; - cellDbgFontPuts(currentX, currentY, FONT_SIZE, i == current_index ? RED : b->cur[i].d_type == CELL_FS_TYPE_DIRECTORY ? GREEN : WHITE, b->cur[i].d_name); + cellDbgFontPuts(currentX, currentY, Emulator_GetFontSize(), i == current_index ? RED : b->cur[i].d_type == CELL_FS_TYPE_DIRECTORY ? GREEN : WHITE, b->cur[i].d_name); cellDbgFontDraw(); } cellDbgFontDraw(); } -static void do_select_file(uint32_t menu_id) +static void select_file(uint32_t menu_id) { - char extensions[256], title[256], object[256], comment[256], dir_path[MAX_PATH_LENGTH]; + char extensions[256], title[256], object[256], comment[256], dir_path[MAX_PATH_LENGTH], + path[MAX_PATH_LENGTH], *separatorslash; + uint64_t state, diff_state, button_was_pressed; + static uint64_t old_state = 0; + + state = cell_pad_input_poll_device(0); + diff_state = old_state ^ state; + button_was_pressed = old_state & diff_state; + switch(menu_id) { case GAME_AWARE_SHADER_CHOICE: @@ -306,6 +341,7 @@ static void do_select_file(uint32_t menu_id) strncpy(dir_path, PRESETS_DIR_PATH, sizeof(dir_path)); strncpy(extensions, "conf|CONF", sizeof(extensions)); strncpy(title, "SHADER PRESETS SELECTION", sizeof(title)); + strncpy(object, "Shader", sizeof(object)); strncpy(object, "Shader preset", sizeof(object)); strncpy(comment, "INFO - Select a shader preset from the menu by pressing the X button. ", sizeof(comment)); break; @@ -321,9 +357,11 @@ static void do_select_file(uint32_t menu_id) strncpy(dir_path, BORDERS_DIR_PATH, sizeof(dir_path)); strncpy(extensions, "png|PNG|jpg|JPG|JPEG|jpeg", sizeof(extensions)); strncpy(title, "BORDER SELECTION", sizeof(title)); + strncpy(object, "Border", sizeof(object)); strncpy(object, "Border image file", sizeof(object)); strncpy(comment, "INFO - Select a border image file from the menu by pressing the X button. ", sizeof(comment)); break; + EXTRA_SELECT_FILE_PART1(); } if(set_initial_dir_tmpbrowser) @@ -332,14 +370,7 @@ static void do_select_file(uint32_t menu_id) set_initial_dir_tmpbrowser = false; } - char path[MAX_PATH_LENGTH]; - - uint64_t state = cell_pad_input_poll_device(0); - static uint64_t old_state = 0; - uint64_t diff_state = old_state ^ state; - uint64_t button_was_pressed = old_state & diff_state; - - UpdateBrowser(&tmpBrowser); + browser_update(&tmpBrowser); if (CTRL_START(button_was_pressed)) filebrowser_reset_start_directory(&tmpBrowser, "/", extensions); @@ -348,7 +379,8 @@ static void do_select_file(uint32_t menu_id) { if(FILEBROWSER_IS_CURRENT_A_DIRECTORY(tmpBrowser)) { - /*if 'filename' is in fact '..' - then pop back directory instead of adding '..' to filename path*/ + /*if 'filename' is in fact '..' - then pop back directory instead of + adding '..' to filename path */ if(tmpBrowser.currently_selected == 0) { old_state = state; @@ -356,7 +388,7 @@ static void do_select_file(uint32_t menu_id) } else { - const char * separatorslash = (strcmp(FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser),"/") == 0) ? "" : "/"; + separatorslash = (strcmp(FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser),"/") == 0) ? "" : "/"; snprintf(path, sizeof(path), "%s%s%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser), separatorslash, FILEBROWSER_GET_CURRENT_FILENAME(tmpBrowser)); filebrowser_push_directory(&tmpBrowser, path, true); } @@ -364,16 +396,13 @@ static void do_select_file(uint32_t menu_id) else if (FILEBROWSER_IS_CURRENT_A_FILE(tmpBrowser)) { snprintf(path, sizeof(path), "%s/%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser), FILEBROWSER_GET_CURRENT_FILENAME(tmpBrowser)); + printf("path: %s\n", path); switch(menu_id) { case GAME_AWARE_SHADER_CHOICE: break; case SHADER_CHOICE: - if(set_shader) - strncpy(g_settings.video.second_pass_shader, path, sizeof(g_settings.video.second_pass_shader)); - else - strncpy(g_settings.video.cg_shader_path, path, sizeof(g_settings.video.cg_shader_path)); break; case PRESET_CHOICE: break; @@ -381,6 +410,7 @@ static void do_select_file(uint32_t menu_id) break; case BORDER_CHOICE: break; + EXTRA_SELECT_FILE_PART2(); } menuStackindex--; @@ -390,127 +420,421 @@ static void do_select_file(uint32_t menu_id) if (CTRL_TRIANGLE(button_was_pressed)) menuStackindex--; - cellDbgFontPrintf (0.09f, 0.09f, FONT_SIZE, YELLOW, "PATH: %s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser)); - cellDbgFontPuts (0.09f, 0.05f, FONT_SIZE, RED, title); + cellDbgFontPrintf(0.09f, 0.09f, Emulator_GetFontSize(), YELLOW, "PATH: %s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser)); + cellDbgFontPuts (0.09f, 0.05f, Emulator_GetFontSize(), RED, title); cellDbgFontPrintf(0.09f, 0.92f, 0.92, YELLOW, "X - Select %s /\\ - return to settings START - Reset Startdir", object); cellDbgFontPrintf(0.09f, 0.83f, 0.91f, LIGHTBLUE, "%s", comment); cellDbgFontDraw(); - RenderBrowser(&tmpBrowser); + browser_render(&tmpBrowser); old_state = state; } -static void do_pathChoice(uint32_t menu_id) +static void select_directory(uint32_t menu_id) { + char path[1024], newpath[1024], *separatorslash; + uint64_t state, diff_state, button_was_pressed; + static uint64_t old_state = 0; + + state = cell_pad_input_poll_device(0); + diff_state = old_state ^ state; + button_was_pressed = old_state & diff_state; + if(set_initial_dir_tmpbrowser) { filebrowser_new(&tmpBrowser, "/\0", "empty"); set_initial_dir_tmpbrowser = false; } - char path[1024]; - char newpath[1024]; + browser_update(&tmpBrowser); - uint64_t state = cell_pad_input_poll_device(0); - static uint64_t old_state = 0; - uint64_t diff_state = old_state ^ state; - uint64_t button_was_pressed = old_state & diff_state; - - UpdateBrowser(&tmpBrowser); - - if (CTRL_START(button_was_pressed)) + if (CTRL_START(button_was_pressed)) filebrowser_reset_start_directory(&tmpBrowser, "/","empty"); - if (CTRL_SQUARE(button_was_pressed)) - { + if (CTRL_SQUARE(button_was_pressed)) + { if(FILEBROWSER_IS_CURRENT_A_DIRECTORY(tmpBrowser)) - { + { snprintf(path, sizeof(path), "%s/%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser), FILEBROWSER_GET_CURRENT_FILENAME(tmpBrowser)); - switch(menu_id) - { - case PATH_SAVESTATES_DIR_CHOICE: - break; - case PATH_SRAM_DIR_CHOICE: - break; + switch(menu_id) + { + case PATH_SAVESTATES_DIR_CHOICE: + break; + case PATH_SRAM_DIR_CHOICE: + break; + case PATH_DEFAULT_ROM_DIR_CHOICE: + break; case PATH_CHEATS_DIR_CHOICE: - strcpy(g_settings.cheat_database, path); break; - case PATH_DEFAULT_ROM_DIR_CHOICE: - break; - } - menuStackindex--; - } - } - - if (CTRL_TRIANGLE(button_was_pressed)) - { - strcpy(path, usrDirPath); - switch(menu_id) - { - case PATH_SAVESTATES_DIR_CHOICE: - break; - case PATH_SRAM_DIR_CHOICE: - break; + } + menuStackindex--; + } + } + if (CTRL_TRIANGLE(button_was_pressed)) + { + strcpy(path, usrDirPath); + switch(menu_id) + { + case PATH_SAVESTATES_DIR_CHOICE: + break; + case PATH_SRAM_DIR_CHOICE: + break; + case PATH_DEFAULT_ROM_DIR_CHOICE: + break; case PATH_CHEATS_DIR_CHOICE: - strcpy(g_settings.cheat_database, path); break; - case PATH_DEFAULT_ROM_DIR_CHOICE: - break; - } - menuStackindex--; - } - - if (CTRL_CROSS(button_was_pressed)) - { + } + menuStackindex--; + } + if (CTRL_CROSS(button_was_pressed)) + { if(FILEBROWSER_IS_CURRENT_A_DIRECTORY(tmpBrowser)) - { - /*if 'filename' is in fact '..' - then pop back directory instead of adding '..' to filename path*/ + { + /* if 'filename' is in fact '..' - then pop back + directory instead of adding '..' to filename path */ + if(tmpBrowser.currently_selected == 0) - { - old_state = state; + { + old_state = state; filebrowser_pop_directory(&tmpBrowser); - } - else - { - const char * separatorslash = (strcmp(FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser),"/") == 0) ? "" : "/"; + } + else + { + separatorslash = (strcmp(FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser),"/") == 0) ? "" : "/"; snprintf(newpath, sizeof(newpath), "%s%s%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser), separatorslash, FILEBROWSER_GET_CURRENT_FILENAME(tmpBrowser)); filebrowser_push_directory(&tmpBrowser, newpath, false); - } - } + } + } + } + + cellDbgFontPrintf (0.09f, 0.09f, Emulator_GetFontSize(), YELLOW, + "PATH: %s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser)); + cellDbgFontPuts (0.09f, 0.05f, Emulator_GetFontSize(), RED, "DIRECTORY SELECTION"); + cellDbgFontPuts(0.09f, 0.93f, 0.92f, YELLOW, + "X - Enter dir /\\ - return to settings START - Reset Startdir"); + cellDbgFontPrintf(0.09f, 0.83f, 0.91f, LIGHTBLUE, "%s", + "INFO - Browse to a directory and assign it as the path by\npressing SQUARE button."); + cellDbgFontDraw(); + + browser_render(&tmpBrowser); + old_state = state; +} + +static void set_setting_label(menu * menu_obj, int currentsetting) +{ + switch(currentsetting) + { + case SETTING_CHANGE_RESOLUTION: + break; + case SETTING_SHADER_PRESETS: + /* add a comment */ + break; + case SETTING_BORDER: + break; + case SETTING_SHADER: + break; + case SETTING_SHADER_2: + break; + case SETTING_GAME_AWARE_SHADER: + break; + case SETTING_FONT_SIZE: + break; + case SETTING_KEEP_ASPECT_RATIO: + break; + case SETTING_HW_TEXTURE_FILTER: + break; + case SETTING_HW_TEXTURE_FILTER_2: + break; + case SETTING_SCALE_ENABLED: + break; + case SETTING_SCALE_FACTOR: + break; + case SETTING_HW_OVERSCAN_AMOUNT: + break; + case SETTING_THROTTLE_MODE: + break; + case SETTING_TRIPLE_BUFFERING: + break; + case SETTING_ENABLE_SCREENSHOTS: + break; + case SETTING_SAVE_SHADER_PRESET: + break; + case SETTING_APPLY_SHADER_PRESET_ON_STARTUP: + break; + case SETTING_DEFAULT_VIDEO_ALL: + break; + case SETTING_SOUND_MODE: + break; + case SETTING_RSOUND_SERVER_IP_ADDRESS: + break; + case SETTING_DEFAULT_AUDIO_ALL: + break; + case SETTING_EMU_CURRENT_SAVE_STATE_SLOT: + break; + /* emu-specific */ + case SETTING_EMU_DEFAULT_ALL: + if(menu_obj->selected == currentsetting) + menu_obj->items[currentsetting].text_color = GREEN; + else + menu_obj->items[currentsetting].text_color = ORANGE; + break; + case SETTING_EMU_VIDEO_DEFAULT_ALL: + if(menu_obj->selected == currentsetting) + menu_obj->items[currentsetting].text_color = GREEN; + else + menu_obj->items[currentsetting].text_color = ORANGE; + break; + case SETTING_EMU_AUDIO_DEFAULT_ALL: + if(menu_obj->selected == currentsetting) + menu_obj->items[currentsetting].text_color = GREEN; + else + menu_obj->items[currentsetting].text_color = ORANGE; + break; + case SETTING_PATH_DEFAULT_ROM_DIRECTORY: + break; + case SETTING_PATH_SAVESTATES_DIRECTORY: + break; + case SETTING_PATH_SRAM_DIRECTORY: + break; + case SETTING_PATH_CHEATS: + break; + case SETTING_PATH_DEFAULT_ALL: + if(menu_obj->selected == currentsetting) + menu_obj->items[currentsetting].text_color = GREEN; + else + menu_obj->items[currentsetting].text_color = ORANGE; + break; + case SETTING_CONTROLS_SCHEME: + break; + case SETTING_CONTROLS_NUMBER: + break; + case SETTING_CONTROLS_DPAD_UP: + case SETTING_CONTROLS_DPAD_DOWN: + case SETTING_CONTROLS_DPAD_LEFT: + case SETTING_CONTROLS_DPAD_RIGHT: + case SETTING_CONTROLS_BUTTON_CIRCLE: + case SETTING_CONTROLS_BUTTON_CROSS: + case SETTING_CONTROLS_BUTTON_TRIANGLE: + case SETTING_CONTROLS_BUTTON_SQUARE: + case SETTING_CONTROLS_BUTTON_SELECT: + case SETTING_CONTROLS_BUTTON_START: + case SETTING_CONTROLS_BUTTON_L1: + case SETTING_CONTROLS_BUTTON_R1: + case SETTING_CONTROLS_BUTTON_L2: + case SETTING_CONTROLS_BUTTON_R2: + case SETTING_CONTROLS_BUTTON_L3: + case SETTING_CONTROLS_BUTTON_R3: + case SETTING_CONTROLS_BUTTON_L2_BUTTON_L3: + case SETTING_CONTROLS_BUTTON_L2_BUTTON_R3: + case SETTING_CONTROLS_BUTTON_L2_ANALOG_R_RIGHT: + case SETTING_CONTROLS_BUTTON_L2_ANALOG_R_LEFT: + case SETTING_CONTROLS_BUTTON_L2_ANALOG_R_UP: + case SETTING_CONTROLS_BUTTON_L2_ANALOG_R_DOWN: + case SETTING_CONTROLS_BUTTON_R2_ANALOG_R_RIGHT: + case SETTING_CONTROLS_BUTTON_R2_ANALOG_R_LEFT: + case SETTING_CONTROLS_BUTTON_R2_ANALOG_R_UP: + case SETTING_CONTROLS_BUTTON_R2_ANALOG_R_DOWN: + case SETTING_CONTROLS_BUTTON_R2_BUTTON_R3: + case SETTING_CONTROLS_BUTTON_R3_BUTTON_L3: + case SETTING_CONTROLS_ANALOG_R_UP: + case SETTING_CONTROLS_ANALOG_R_DOWN: + case SETTING_CONTROLS_ANALOG_R_LEFT: + case SETTING_CONTROLS_ANALOG_R_RIGHT: + break; + case SETTING_CONTROLS_SAVE_CUSTOM_CONTROLS: + if(menu_obj->selected == currentsetting) + menu_obj->items[currentsetting].text_color = GREEN; + else + menu_obj->items[currentsetting].text_color = ORANGE; + break; + case SETTING_CONTROLS_DEFAULT_ALL: + if(menu_obj->selected == currentsetting) + menu_obj->items[currentsetting].text_color = GREEN; + else + menu_obj->items[currentsetting].text_color = ORANGE; + break; + default: + break; } - - cellDbgFontPrintf (0.09f, 0.09f, FONT_SIZE, YELLOW, "PATH: %s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser)); - cellDbgFontPuts (0.09f, 0.05f, FONT_SIZE, RED, "DIRECTORY SELECTION"); - cellDbgFontPuts (0.09f, 0.93f, 0.92f, YELLOW, "X - Enter dir /\\ - return to settings START - Reset Startdir"); - cellDbgFontPrintf(0.09f, 0.83f, 0.91f, LIGHTBLUE, "INFO - Browse to a directory and assign it as the path by pressing SQUARE."); - cellDbgFontDraw(); - - RenderBrowser(&tmpBrowser); - old_state = state; } -#define print_help_message_yesno(menu, currentsetting) \ - snprintf(menu.items[currentsetting].comment, sizeof(menu.items[currentsetting].comment), *(menu.items[currentsetting].setting_ptr) ? menu.items[currentsetting].comment_yes : menu.items[currentsetting].comment_no); \ - print_help_message(menu, currentsetting); - -#define print_help_message(menu, currentsetting) \ - cellDbgFontPrintf(menu.items[currentsetting].comment_xpos, menu.items[currentsetting].comment_ypos, menu.items[currentsetting].comment_scalefont, menu.items[currentsetting].comment_color, menu.items[currentsetting].comment); - -static void display_help_text(int currentsetting) +static void menu_init_settings_pages(menu * menu_obj) { + int page, i, j; + float increment; + + page = 0; + j = 0; + increment = 0.13f; + + for(i = menu_obj->first_setting; i < menu_obj->max_settings; i++) + { + if(!(j < (NUM_ENTRY_PER_PAGE))) + { + j = 0; + increment = 0.13f; + page++; + } + + menu_obj->items[i].text_xpos = 0.09f; + menu_obj->items[i].text_ypos = increment; + menu_obj->items[i].page = page; + set_setting_label(menu_obj, i); + increment += 0.03f; + j++; + } + menu_obj->refreshpage = 0; } -static void display_label_value(uint64_t switchvalue) +static void menu_reinit_settings (void) { + menu_init_settings_pages(&menu_generalvideosettings); + menu_init_settings_pages(&menu_generalaudiosettings); + menu_init_settings_pages(&menu_emu_settings); + menu_init_settings_pages(&menu_emu_videosettings); + menu_init_settings_pages(&menu_emu_audiosettings); + menu_init_settings_pages(&menu_pathsettings); + menu_init_settings_pages(&menu_controlssettings); } static void apply_scaling(void) { } -#include "settings-logic.h" +static void producesettingentry(menu * menu_obj, uint64_t switchvalue) +{ + uint64_t state; -static void do_settings(menu * menu_obj) + state = cell_pad_input_poll_device(0); + + switch(switchvalue) + { + case SETTING_CHANGE_RESOLUTION: + break; + /* + case SETTING_PAL60_MODE: + if(CTRL_RIGHT(state) || CTRL_LSTICK_LEFT(state) || CTRL_CROSS(state) || CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state)) + { + if (Graphics->GetCurrentResolution() == CELL_VIDEO_OUT_RESOLUTION_576) + { + if(Graphics->CheckResolution(CELL_VIDEO_OUT_RESOLUTION_576)) + { + Settings.PS3PALTemporalMode60Hz = !Settings.PS3PALTemporalMode60Hz; + Graphics->SetPAL60Hz(Settings.PS3PALTemporalMode60Hz); + Graphics->SwitchResolution(Graphics->GetCurrentResolution(), Settings.PS3PALTemporalMode60Hz, Settings.TripleBuffering); + } + } + + } + break; + */ +#ifdef HAVE_GAMEAWARE + case SETTING_GAME_AWARE_SHADER: + break; +#endif + case SETTING_SHADER_PRESETS: + break; + case SETTING_BORDER: + break; + case SETTING_SHADER: + break; + case SETTING_SHADER_2: + break; + case SETTING_FONT_SIZE: + break; + case SETTING_KEEP_ASPECT_RATIO: + break; + case SETTING_HW_TEXTURE_FILTER: + break; + case SETTING_HW_TEXTURE_FILTER_2: + break; + case SETTING_SCALE_ENABLED: + break; + case SETTING_SCALE_FACTOR: + break; + case SETTING_HW_OVERSCAN_AMOUNT: + break; + case SETTING_THROTTLE_MODE: + break; + case SETTING_TRIPLE_BUFFERING: + break; + case SETTING_ENABLE_SCREENSHOTS: + break; + case SETTING_SAVE_SHADER_PRESET: + break; + case SETTING_APPLY_SHADER_PRESET_ON_STARTUP: + break; + case SETTING_DEFAULT_VIDEO_ALL: + break; + case SETTING_SOUND_MODE: + break; + case SETTING_RSOUND_SERVER_IP_ADDRESS: + break; + case SETTING_DEFAULT_AUDIO_ALL: + break; + case SETTING_EMU_CURRENT_SAVE_STATE_SLOT: + break; + case SETTING_EMU_VIDEO_DEFAULT_ALL: + break; + case SETTING_EMU_AUDIO_DEFAULT_ALL: + break; + case SETTING_PATH_DEFAULT_ROM_DIRECTORY: + break; + case SETTING_PATH_SAVESTATES_DIRECTORY: + break; + case SETTING_PATH_SRAM_DIRECTORY: + break; + case SETTING_PATH_CHEATS: + break; + case SETTING_PATH_DEFAULT_ALL: + break; + case SETTING_CONTROLS_SCHEME: + break; + case SETTING_CONTROLS_NUMBER: + break; + case SETTING_CONTROLS_DPAD_UP: + case SETTING_CONTROLS_DPAD_DOWN: + case SETTING_CONTROLS_DPAD_LEFT: + case SETTING_CONTROLS_DPAD_RIGHT: + case SETTING_CONTROLS_BUTTON_CIRCLE: + case SETTING_CONTROLS_BUTTON_CROSS: + case SETTING_CONTROLS_BUTTON_TRIANGLE: + case SETTING_CONTROLS_BUTTON_SQUARE: + case SETTING_CONTROLS_BUTTON_SELECT: + case SETTING_CONTROLS_BUTTON_START: + case SETTING_CONTROLS_BUTTON_L1: + case SETTING_CONTROLS_BUTTON_R1: + case SETTING_CONTROLS_BUTTON_L2: + case SETTING_CONTROLS_BUTTON_R2: + case SETTING_CONTROLS_BUTTON_L3: + case SETTING_CONTROLS_BUTTON_R3: + case SETTING_CONTROLS_BUTTON_L2_BUTTON_L3: + case SETTING_CONTROLS_BUTTON_L2_BUTTON_R3: + case SETTING_CONTROLS_BUTTON_L2_ANALOG_R_RIGHT: + case SETTING_CONTROLS_BUTTON_L2_ANALOG_R_LEFT: + case SETTING_CONTROLS_BUTTON_L2_ANALOG_R_UP: + case SETTING_CONTROLS_BUTTON_L2_ANALOG_R_DOWN: + case SETTING_CONTROLS_BUTTON_R2_ANALOG_R_RIGHT: + case SETTING_CONTROLS_BUTTON_R2_ANALOG_R_LEFT: + case SETTING_CONTROLS_BUTTON_R2_ANALOG_R_UP: + case SETTING_CONTROLS_BUTTON_R2_ANALOG_R_DOWN: + case SETTING_CONTROLS_BUTTON_R2_BUTTON_R3: + case SETTING_CONTROLS_BUTTON_R3_BUTTON_L3: + case SETTING_CONTROLS_ANALOG_R_UP: + case SETTING_CONTROLS_ANALOG_R_DOWN: + case SETTING_CONTROLS_ANALOG_R_LEFT: + case SETTING_CONTROLS_ANALOG_R_RIGHT: + break; + case SETTING_CONTROLS_SAVE_CUSTOM_CONTROLS: + break; + case SETTING_CONTROLS_DEFAULT_ALL: + break; + } + + set_setting_label(menu_obj, switchvalue); +} + +static void select_setting(menu * menu_obj) { uint64_t state, diff_state, button_was_pressed, i; static uint64_t old_state = 0; @@ -606,7 +930,7 @@ static void do_settings(menu * menu_obj) if (CTRL_L3(state) && CTRL_R3(state)) { - if (g_rom_loaded) + if (g_emulator_initialized) { menu_is_running = 0; set_text_message("", 15); @@ -616,7 +940,7 @@ static void do_settings(menu * menu_obj) } - producesettingentry(menu_obj->selected); + producesettingentry(menu_obj, menu_obj->selected); } display_menubar(menu_obj->enum_id); @@ -626,30 +950,31 @@ static void do_settings(menu * menu_obj) { if(menu_obj->items[i].page == menu_obj->page) { - cellDbgFontPuts(menu_obj->items[i].text_xpos, menu_obj->items[i].text_ypos, FONT_SIZE, menu_obj->selected == menu_obj->items[i].enum_id ? menu_obj->items[i].text_selected_color : menu_obj->items[i].text_unselected_color, menu_obj->items[i].text); - display_label_value(i); + cellDbgFontPuts(menu_obj->items[i].text_xpos, menu_obj->items[i].text_ypos, Emulator_GetFontSize(), menu_obj->selected == menu_obj->items[i].enum_id ? YELLOW : menu_obj->items[i].item_color, menu_obj->items[i].text); + cellDbgFontPuts(0.5f, menu_obj->items[i].text_ypos, Emulator_GetFontSize(), menu_obj->items[i].text_color, menu_obj->items[i].setting_text); cellDbgFontDraw(); } } - display_help_text(menu_obj->selected); + cellDbgFontPuts(0.09f, menu_obj->items[menu_obj->selected].comment_ypos, 0.86f, LIGHTBLUE, menu_obj->items[menu_obj->selected].comment); - cellDbgFontPuts(0.09f, 0.91f, FONT_SIZE, YELLOW, "UP/DOWN - select L3+R3 - resume game X/LEFT/RIGHT - change"); - cellDbgFontPuts(0.09f, 0.95f, FONT_SIZE, YELLOW, "START - default L1/CIRCLE - go back R1 - go forward"); + cellDbgFontPuts(0.09f, 0.91f, Emulator_GetFontSize(), YELLOW, "UP/DOWN - select L3+R3 - resume game X/LEFT/RIGHT - change"); + cellDbgFontPuts(0.09f, 0.95f, Emulator_GetFontSize(), YELLOW, "START - default L1/CIRCLE - go back R1 - go forward"); cellDbgFontDraw(); old_state = state; } -static void do_ROMMenu(void) +static void select_rom(void) { - char newpath[1024]; - - uint64_t state = cell_pad_input_poll_device(0); + char newpath[1024], *separatorslash; + uint64_t state, diff_state, button_was_pressed; static uint64_t old_state = 0; - uint64_t diff_state = old_state ^ state; - uint64_t button_was_pressed = old_state & diff_state; - UpdateBrowser(&browser); + state = cell_pad_input_poll_device(0); + diff_state = old_state ^ state; + button_was_pressed = old_state & diff_state; + + browser_update(&browser); if (CTRL_SELECT(button_was_pressed)) { @@ -664,7 +989,9 @@ static void do_ROMMenu(void) { if(FILEBROWSER_IS_CURRENT_A_DIRECTORY(browser)) { - /*if 'filename' is in fact '..' - then pop back directory instead of adding '..' to filename path*/ + /*if 'filename' is in fact '..' - then pop back directory + instead of adding '..' to filename path */ + if(browser.currently_selected == 0) { old_state = state; @@ -672,16 +999,21 @@ static void do_ROMMenu(void) } else { - const char * separatorslash = (strcmp(FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser),"/") == 0) ? "" : "/"; + separatorslash = (strcmp(FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser),"/") == 0) ? "" : "/"; snprintf(newpath, sizeof(newpath), "%s%s%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), separatorslash, FILEBROWSER_GET_CURRENT_FILENAME(browser)); filebrowser_push_directory(&browser, newpath, true); } } else if (FILEBROWSER_IS_CURRENT_A_FILE(browser)) { - snprintf(g_extern.system.fullpath, sizeof(g_extern.system.fullpath), "%s/%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), FILEBROWSER_GET_CURRENT_FILENAME(browser)); + char rom_path_temp[MAX_PATH_LENGTH]; + bool retval; + + snprintf(rom_path_temp, sizeof(rom_path_temp), "%s/%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), FILEBROWSER_GET_CURRENT_FILENAME(browser)); menu_is_running = 0; + snprintf(g_extern.system.fullpath, sizeof(g_extern.system.fullpath), "%s/%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), FILEBROWSER_GET_CURRENT_FILENAME(browser)); + old_state = state; return; } @@ -701,55 +1033,21 @@ static void do_ROMMenu(void) if (FILEBROWSER_IS_CURRENT_A_FILE(browser)) cellDbgFontPrintf(0.09f, 0.83f, 0.91f, LIGHTBLUE, "INFO - Press X to load the game. "); - cellDbgFontPuts (0.09f, 0.05f, FONT_SIZE, RED, "FILE BROWSER"); - cellDbgFontPrintf (0.7f, 0.05f, 0.82f, WHITE, "%s v%s", "SSNES", PACKAGE_VERSION); - cellDbgFontPrintf (0.09f, 0.09f, FONT_SIZE, YELLOW, "PATH: %s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser)); - cellDbgFontPuts (0.09f, 0.93f, FONT_SIZE, YELLOW, + cellDbgFontPuts (0.09f, 0.05f, Emulator_GetFontSize(), RED, "FILE BROWSER"); + cellDbgFontPrintf (0.7f, 0.05f, 0.82f, WHITE, "%s v%s", EMULATOR_NAME, EMULATOR_VERSION); + cellDbgFontPrintf (0.09f, 0.09f, Emulator_GetFontSize(), YELLOW, + "PATH: %s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser)); + cellDbgFontPuts (0.09f, 0.93f, Emulator_GetFontSize(), YELLOW, "L3 + R3 - resume game SELECT - Settings screen"); cellDbgFontDraw(); - RenderBrowser(&browser); + browser_render(&browser); old_state = state; } -static void menu_init_settings_pages(menu * menu_obj) -{ - int page, i, j; - float increment; - - page = 0; - j = 0; - increment = 0.13f; - - for(i = menu_obj->first_setting; i < menu_obj->max_settings; i++) - { - if(!(j < (NUM_ENTRY_PER_PAGE))) - { - j = 0; - increment = 0.13f; - page++; - } - - menu_obj->items[i].text_xpos = 0.09f; - menu_obj->items[i].text_ypos = increment; - menu_obj->items[i].page = page; - increment += 0.03f; - j++; - } - menu_obj->refreshpage = 0; -} - -void menu_init(void) +void menu_init (void) { filebrowser_new(&browser, "/", ROM_EXTENSIONS); - - menu_init_settings_pages(&menu_generalvideosettings); - menu_init_settings_pages(&menu_generalaudiosettings); - menu_init_settings_pages(&menu_emu_settings); - menu_init_settings_pages(&menu_emu_videosettings); - menu_init_settings_pages(&menu_emu_audiosettings); - menu_init_settings_pages(&menu_pathsettings); - menu_init_settings_pages(&menu_controlssettings); } void menu_loop(void) @@ -759,16 +1057,18 @@ void menu_loop(void) menu_is_running = true; + menu_reinit_settings(); + do { glClear(GL_COLOR_BUFFER_BIT); - //ps3graphics_draw_menu(); + ps3graphics_draw_menu(); g_frame_count++; switch(menuStack[menuStackindex].enum_id) { case FILE_BROWSER_MENU: - do_ROMMenu(); + select_rom(); break; case GENERAL_VIDEO_MENU: case GENERAL_AUDIO_MENU: @@ -777,25 +1077,25 @@ void menu_loop(void) case EMU_AUDIO_MENU: case PATH_MENU: case CONTROLS_MENU: - do_settings(&menuStack[menuStackindex]); + select_setting(&menuStack[menuStackindex]); break; case GAME_AWARE_SHADER_CHOICE: case SHADER_CHOICE: case PRESET_CHOICE: case BORDER_CHOICE: case INPUT_PRESET_CHOICE: - do_select_file(menuStack[menuStackindex].enum_id); + select_file(menuStack[menuStackindex].enum_id); break; case PATH_SAVESTATES_DIR_CHOICE: case PATH_DEFAULT_ROM_DIR_CHOICE: case PATH_CHEATS_DIR_CHOICE: case PATH_SRAM_DIR_CHOICE: - case PATH_BASE_DIR_CHOICE: - do_pathChoice(menuStack[menuStackindex].enum_id); + select_directory(menuStack[menuStackindex].enum_id); break; } psglSwap(); + cell_console_poll(); cellSysutilCheckCallback(); }while (menu_is_running); } diff --git a/ps3/menu.h b/ps3/menu.h index 21e5981c91..a4e7dc5c48 100644 --- a/ps3/menu.h +++ b/ps3/menu.h @@ -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_ */ diff --git a/ps3/settings-logic.h b/ps3/settings-logic.h index 8370cae742..03b7da453e 100644 --- a/ps3/settings-logic.h +++ b/ps3/settings-logic.h @@ -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; } } diff --git a/ps3/shared.h b/ps3/shared.h index 08ae0786ec..b5f2123b5b 100644 --- a/ps3/shared.h +++ b/ps3/shared.h @@ -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;