mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 03:32:46 +00:00
(Menu) refactor system_bgm_enable setting
This commit is contained in:
parent
262ec8881a
commit
80f67baf1f
@ -34,14 +34,6 @@
|
||||
|
||||
#include "../../../settings_data.h"
|
||||
|
||||
#if defined(__CELLOS_LV2__)
|
||||
#include <sdk_version.h>
|
||||
|
||||
#if (CELL_SDK_VERSION > 0x340000)
|
||||
#include <sysutil/sysutil_bgmplayback.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static inline struct gfx_shader *shader_manager_get_current_shader(menu_handle_t *menu, unsigned type)
|
||||
{
|
||||
if (type == MENU_SETTINGS_SHADER_PRESET_PARAMETERS)
|
||||
@ -419,10 +411,7 @@ static void menu_common_entries_init(menu_handle_t *menu, unsigned menu_type)
|
||||
add_setting_entry(menu,"audio_latency", 0, setting_data);
|
||||
add_setting_entry(menu,"audio_sync", 0, setting_data);
|
||||
add_setting_entry(menu,"audio_rate_control_delta", 0, setting_data);
|
||||
#ifdef __CELLOS_LV2__
|
||||
file_list_push(menu->selection_buf, "System BGM Control", "",
|
||||
MENU_SETTINGS_CUSTOM_BGM_CONTROL_ENABLE, 0);
|
||||
#endif
|
||||
add_setting_entry(menu,"system_bgm_enable", 0, setting_data);
|
||||
add_setting_entry(menu,"audio_volume", 0, setting_data);
|
||||
add_setting_entry(menu,"audio_device", MENU_SETTINGS_DRIVER_AUDIO_DEVICE, setting_data);
|
||||
break;
|
||||
@ -3366,29 +3355,6 @@ static int menu_common_setting_set(unsigned id, unsigned action)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MENU_SETTINGS_CUSTOM_BGM_CONTROL_ENABLE:
|
||||
switch (action)
|
||||
{
|
||||
case MENU_ACTION_OK:
|
||||
#if (CELL_SDK_VERSION > 0x340000)
|
||||
if (g_extern.lifecycle_state & (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE))
|
||||
g_extern.lifecycle_state &= ~(1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE);
|
||||
else
|
||||
g_extern.lifecycle_state |= (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE);
|
||||
if (g_extern.lifecycle_state & (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE))
|
||||
cellSysutilEnableBgmPlayback();
|
||||
else
|
||||
cellSysutilDisableBgmPlayback();
|
||||
|
||||
#endif
|
||||
break;
|
||||
case MENU_ACTION_START:
|
||||
#if (CELL_SDK_VERSION > 0x340000)
|
||||
g_extern.lifecycle_state |= (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#ifdef HAVE_NETPLAY
|
||||
case MENU_SETTINGS_NETPLAY_HOST_IP_ADDRESS:
|
||||
if (action == MENU_ACTION_OK)
|
||||
@ -3707,11 +3673,6 @@ static void menu_common_setting_set_label(char *type_str,
|
||||
case MENU_SETTINGS_CUSTOM_BIND_MODE:
|
||||
strlcpy(type_str, driver.menu->bind_mode_keyboard ? "RetroKeyboard" : "RetroPad", type_str_size);
|
||||
break;
|
||||
case MENU_SETTINGS_CUSTOM_BGM_CONTROL_ENABLE:
|
||||
strlcpy(type_str,
|
||||
(g_extern.lifecycle_state & (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE)) ? "ON" : "OFF",
|
||||
type_str_size);
|
||||
break;
|
||||
default:
|
||||
*type_str = '\0';
|
||||
*w = 0;
|
||||
|
@ -104,7 +104,6 @@ typedef enum
|
||||
MENU_EXTRACTION_DIR_PATH,
|
||||
MENU_SETTINGS_AUDIO_DSP_FILTER,
|
||||
MENU_SETTINGS_AUDIO_ENABLE,
|
||||
MENU_SETTINGS_CUSTOM_BGM_CONTROL_ENABLE,
|
||||
|
||||
MENU_SETTINGS_NETPLAY_HOST_IP_ADDRESS,
|
||||
MENU_SETTINGS_NETPLAY_NICKNAME,
|
||||
|
@ -250,10 +250,6 @@ static void frontend_ps3_init(void *data)
|
||||
cellScreenShotSetParameter (&screenshot_param);
|
||||
cellScreenShotEnable();
|
||||
#endif
|
||||
#ifdef HAVE_SYSUTILS
|
||||
//if (g_extern.lifecycle_state & (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE))
|
||||
cellSysutilEnableBgmPlayback();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -144,7 +144,6 @@ enum menu_enums
|
||||
MODE_EXITSPAWN_MULTIMAN,
|
||||
MODE_VIDEO_TRIPLE_BUFFERING_ENABLE,
|
||||
MODE_VIDEO_FLICKER_FILTER_ENABLE,
|
||||
MODE_AUDIO_CUSTOM_BGM_ENABLE,
|
||||
MODE_OSK_ENTRY_SUCCESS,
|
||||
MODE_OSK_ENTRY_FAIL,
|
||||
MODE_CLEAR_INPUT,
|
||||
@ -704,7 +703,9 @@ struct global
|
||||
struct
|
||||
{
|
||||
unsigned mode;
|
||||
bool system_bgm_enable;
|
||||
} sound;
|
||||
|
||||
bool softfilter_enable;
|
||||
} console;
|
||||
|
||||
|
14
settings.c
14
settings.c
@ -451,9 +451,9 @@ void config_set_defaults(void)
|
||||
|
||||
g_settings.user_language = 0;
|
||||
|
||||
g_extern.console.sound.system_bgm_enable = false;
|
||||
#ifdef RARCH_CONSOLE
|
||||
g_extern.console.screen.gamma_correction = DEFAULT_GAMMA;
|
||||
g_extern.lifecycle_state |= (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE);
|
||||
g_extern.lifecycle_state |= (1ULL << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE);
|
||||
g_extern.lifecycle_state |= (1ULL << MODE_VIDEO_FLICKER_FILTER_ENABLE);
|
||||
|
||||
@ -867,7 +867,6 @@ bool config_load_file(const char *path, bool set_defaults)
|
||||
CONFIG_GET_BOOL_EXTERN(console.screen.gamma_correction, "gamma_correction");
|
||||
|
||||
bool triple_buffering_enable = false;
|
||||
bool custom_bgm_enable = false;
|
||||
bool flicker_filter_enable = false;
|
||||
bool soft_filter_enable = false;
|
||||
|
||||
@ -879,13 +878,7 @@ bool config_load_file(const char *path, bool set_defaults)
|
||||
g_extern.lifecycle_state &= ~(1ULL << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE);
|
||||
}
|
||||
|
||||
if (config_get_bool(conf, "custom_bgm_enable", &custom_bgm_enable))
|
||||
{
|
||||
if (custom_bgm_enable)
|
||||
g_extern.lifecycle_state |= (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE);
|
||||
else
|
||||
g_extern.lifecycle_state &= ~(1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE);
|
||||
}
|
||||
config_get_bool(conf, "custom_bgm_enable", &g_extern.console.sound.system_bgm_enable);
|
||||
|
||||
if (config_get_bool(conf, "flicker_filter_enable", &flicker_filter_enable))
|
||||
{
|
||||
@ -1461,8 +1454,7 @@ bool config_save_file(const char *path)
|
||||
config_set_string(conf, "netplay_nickname", g_settings.username);
|
||||
config_set_int(conf, "user_language", g_settings.user_language);
|
||||
|
||||
bool custom_bgm_enable_val = g_extern.lifecycle_state & (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE);
|
||||
config_set_bool(conf, "custom_bgm_enable", custom_bgm_enable_val);
|
||||
config_set_bool(conf, "custom_bgm_enable", g_extern.console.sound.system_bgm_enable);
|
||||
|
||||
config_set_string(conf, "input_driver", g_settings.input.driver);
|
||||
config_set_string(conf, "input_joypad_driver", g_settings.input.joypad_driver);
|
||||
|
@ -24,6 +24,15 @@
|
||||
#include "input/apple_keycode.h"
|
||||
#endif
|
||||
|
||||
#if defined(__CELLOS_LV2__)
|
||||
#include <sdk_version.h>
|
||||
|
||||
#if (CELL_SDK_VERSION > 0x340000)
|
||||
#include <sysutil/sysutil_bgmplayback.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
static void get_input_config_prefix(char *buf, size_t sizeof_buf,
|
||||
const rarch_setting_t *setting)
|
||||
{
|
||||
@ -1194,6 +1203,8 @@ static void general_read_handler(const void *data)
|
||||
#endif
|
||||
else if (!strcmp(setting->name, "audio_enable"))
|
||||
*setting->value.boolean = g_settings.audio.enable;
|
||||
else if (!strcmp(setting->name, "system_bgm_enable"))
|
||||
*setting->value.boolean = g_extern.console.sound.system_bgm_enable;
|
||||
else if (!strcmp(setting->name, "audio_sync"))
|
||||
*setting->value.boolean = g_settings.audio.sync;
|
||||
else if (!strcmp(setting->name, "audio_mute"))
|
||||
@ -1576,6 +1587,23 @@ static void general_write_handler(const void *data)
|
||||
#endif
|
||||
else if (!strcmp(setting->name, "audio_enable"))
|
||||
g_settings.audio.enable = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "system_bgm_enable"))
|
||||
{
|
||||
g_extern.console.sound.system_bgm_enable = *setting->value.boolean;
|
||||
|
||||
if (*setting->value.boolean)
|
||||
{
|
||||
#if defined(__CELLOS_LV2__) && (CELL_SDK_VERSION > 0x340000)
|
||||
cellSysutilEnableBgmPlayback();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(__CELLOS_LV2__) && (CELL_SDK_VERSION > 0x340000)
|
||||
cellSysutilDisableBgmPlayback();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (!strcmp(setting->name, "audio_sync"))
|
||||
g_settings.audio.sync = *setting->value.boolean;
|
||||
else if (!strcmp(setting->name, "audio_mute"))
|
||||
@ -2118,6 +2146,9 @@ rarch_setting_t *setting_data_get_list(void)
|
||||
CONFIG_BOOL(g_settings.audio.enable, "audio_enable", "Audio Enable", audio_enable, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
|
||||
CONFIG_BOOL(g_extern.audio_data.mute, "audio_mute", "Audio Mute", false, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
|
||||
CONFIG_FLOAT(g_settings.audio.volume, "audio_volume", "Volume Level", audio_volume, "%.1f", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(-80, 12, 1.0, true, true)
|
||||
#ifdef __CELLOS_LV2__
|
||||
CONFIG_BOOL(g_extern.console.sound.system_bgm_enable, "system_bgm_enable", "System BGM Enable", false, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
|
||||
#endif
|
||||
END_SUB_GROUP()
|
||||
|
||||
START_SUB_GROUP("Synchronization")
|
||||
|
Loading…
x
Reference in New Issue
Block a user