From ed5e67425cfc3525c4000b7f8cf40adc486679a6 Mon Sep 17 00:00:00 2001 From: TwinAphex51224 Date: Sat, 3 Mar 2012 17:23:00 +0100 Subject: [PATCH] (PS3) Added custom BGM music hooks --- general.h | 3 +++ ps3/main.c | 12 +++++++++++- ps3/menu-entries.h | 15 +++++++++++++++ ps3/menu.c | 39 ++++++++++++++++++++++++++++++++++++++- ps3/menu.h | 1 + 5 files changed, 68 insertions(+), 2 deletions(-) diff --git a/general.h b/general.h index 1ecffa124d..a7af7788a5 100644 --- a/general.h +++ b/general.h @@ -178,6 +178,9 @@ struct settings #ifdef SSNES_CONSOLE struct console_settings { +#ifdef __CELLOS_LV2__ + bool custom_bgm_enable; +#endif bool block_config_read; bool default_sram_dir_enable; bool default_savestate_dir_enable; diff --git a/ps3/main.c b/ps3/main.c index 417b0c463b..3d3d0e989e 100644 --- a/ps3/main.c +++ b/ps3/main.c @@ -21,12 +21,17 @@ #include #include +#include #include #include #include #include #include +#if(CELL_SDK_VERSION > 0x340000) +#include +#endif + #include #include #include @@ -141,7 +146,7 @@ static void set_default_settings(void) g_console.block_config_read = true; g_console.frame_advance_enable = false; g_console.emulator_initialized = 0; - g_console.screenshots_enable = false; + g_console.screenshots_enable = true; g_console.throttle_enable = true; g_console.initialize_ssnes_enable = false; g_console.triple_buffering_enable = true; @@ -164,6 +169,7 @@ static void set_default_settings(void) g_console.custom_viewport_x = 0; g_console.custom_viewport_y = 0; strlcpy(g_console.rsound_ip_address, "0.0.0.0", sizeof(g_console.rsound_ip_address)); + g_console.custom_bgm_enable = true; // g_extern g_extern.state_slot = 0; @@ -240,6 +246,7 @@ static void init_settings(bool load_libsnes_path) // g_console + CONFIG_GET_BOOL_CONSOLE(custom_bgm_enable, "custom_bgm_enable"); CONFIG_GET_BOOL_CONSOLE(overscan_enable, "overscan_enable"); CONFIG_GET_BOOL_CONSOLE(screenshots_enable, "screenshots_enable"); CONFIG_GET_BOOL_CONSOLE(throttle_enable, "throttle_enable"); @@ -303,6 +310,7 @@ static void save_settings(void) config_set_int(conf, "dpad_emulation_p7", g_settings.input.dpad_emulation[6]); // g_console + config_set_bool(conf, "custom_bgm_enable", g_console.custom_bgm_enable); config_set_bool(conf, "overscan_enable", g_console.overscan_enable); config_set_bool(conf, "screenshots_enable", g_console.screenshots_enable); config_set_bool(conf, "throttle_enable", g_console.throttle_enable); @@ -586,6 +594,8 @@ int main(int argc, char *argv[]) cellScreenShotSetParameter (&screenshot_param); cellScreenShotEnable(); } + if (g_console.custom_bgm_enable) + cellSysutilEnableBgmPlayback(); #endif ps3graphics_video_init(true); diff --git a/ps3/menu-entries.h b/ps3/menu-entries.h index dd3503273a..8f9aebbfa4 100644 --- a/ps3/menu-entries.h +++ b/ps3/menu-entries.h @@ -299,6 +299,21 @@ static item items_generalsettings[MAX_NO_OF_CONTROLS_SETTINGS] = 0, 1 }, + { + SETTING_ENABLE_CUSTOM_BGM, + "Enable Custom BGM Feature", + "", + 0.0f, + 0.0f, + YELLOW, + "INFO - [Enable Custom BGM] feature is set to 'ON'.", + WHITE, + 0.91f, + 0.09f, + 0.83f, + 1, + 1 + }, { SETTING_DEFAULT_AUDIO_ALL, "DEFAULT", diff --git a/ps3/menu.c b/ps3/menu.c index bc0951139f..4fccc6b777 100644 --- a/ps3/menu.c +++ b/ps3/menu.c @@ -16,10 +16,15 @@ * If not, see . */ +#include #include #include #include +#if(CELL_SDK_VERSION > 0x340000) +#include +#endif + #include "cellframework2/input/pad_input.h" #include "cellframework2/fileio/file_browser.h" @@ -636,6 +641,18 @@ static void set_setting_label(menu * menu_obj, uint64_t currentsetting) snprintf(menu_obj->items[currentsetting].comment, sizeof(menu_obj->items[currentsetting].comment), "INFO - [Audio Mute] feature is set to 'OFF'."); } break; + case SETTING_ENABLE_CUSTOM_BGM: + if(g_console.custom_bgm_enable) + { + snprintf(menu_obj->items[currentsetting].setting_text, sizeof(menu_obj->items[currentsetting].setting_text), "ON"); + menu_obj->items[currentsetting].text_color = GREEN; + } + else + { + snprintf(menu_obj->items[currentsetting].setting_text, sizeof(menu_obj->items[currentsetting].setting_text), "OFF"); + 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; @@ -1513,7 +1530,7 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue) if(CTRL_START(state)) { #if(CELL_SDK_VERSION > 0x340000) - g_console.screenshots_enable = false; + g_console.screenshots_enable = true; #endif } break; @@ -1617,6 +1634,26 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue) g_extern.audio_data.mute = false; } break; + case SETTING_ENABLE_CUSTOM_BGM: + if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state)) + { +#if(CELL_SDK_VERSION > 0x340000) + g_console.custom_bgm_enable = !g_console.custom_bgm_enable; + if(g_console.custom_bgm_enable) + cellSysutilEnableBgmPlayback(); + else + cellSysutilDisableBgmPlayback(); + + set_delay = DELAY_MEDIUM; +#endif + } + if(CTRL_START(state)) + { +#if(CELL_SDK_VERSION > 0x340000) + g_console.custom_bgm_enable = true; +#endif + } + break; case SETTING_EMU_VIDEO_DEFAULT_ALL: break; case SETTING_EMU_AUDIO_DEFAULT_ALL: diff --git a/ps3/menu.h b/ps3/menu.h index 68a9fbb7d7..8b2d72f0f5 100644 --- a/ps3/menu.h +++ b/ps3/menu.h @@ -93,6 +93,7 @@ enum SETTING_DEFAULT_VIDEO_ALL, SETTING_SOUND_MODE, SETTING_RSOUND_SERVER_IP_ADDRESS, + SETTING_ENABLE_CUSTOM_BGM, SETTING_DEFAULT_AUDIO_ALL, /* port-specific */ SETTING_EMU_CURRENT_SAVE_STATE_SLOT,