(PS3) Added custom BGM music hooks

This commit is contained in:
TwinAphex51224 2012-03-03 17:23:00 +01:00
parent d76d8a7d9c
commit ed5e67425c
5 changed files with 68 additions and 2 deletions

View File

@ -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;

View File

@ -21,12 +21,17 @@
#include <stddef.h>
#include <string.h>
#include <sdk_version.h>
#include <sys/process.h>
#include <cell/sysmodule.h>
#include <sysutil/sysutil_screenshot.h>
#include <sysutil/sysutil_common.h>
#include <sysutil/sysutil_gamecontent.h>
#if(CELL_SDK_VERSION > 0x340000)
#include <sysutil/sysutil_bgmplayback.h>
#endif
#include <cell/sysmodule.h>
#include <sysutil/sysutil_common.h>
#include <sys/process.h>
@ -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);

View File

@ -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",

View File

@ -16,10 +16,15 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <sdk_version.h>
#include <cell/sysmodule.h>
#include <sysutil/sysutil_screenshot.h>
#include <cell/dbgfont.h>
#if(CELL_SDK_VERSION > 0x340000)
#include <sysutil/sysutil_bgmplayback.h>
#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:

View File

@ -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,