(Wii) implement audio controll rate settings

have left/right act as page up/down in file browser
change "Start" to reset values in settings
This commit is contained in:
Toad King 2012-07-18 20:38:09 -04:00
parent 64260b8d33
commit f9d72f583e
5 changed files with 101 additions and 44 deletions

View File

@ -35,7 +35,20 @@ void rarch_settings_change(unsigned setting)
g_console.aspect_ratio_index++;
break;
case S_AUDIO_MUTE:
g_extern.audio_data.mute = !g_extern.audio_data.mute;
g_extern.audio_data.mute = !g_extern.audio_data.mute;
break;
case S_AUDIO_CONTROL_RATE_DECREMENT:
if (g_settings.audio.rate_control_delta > 0.0)
g_settings.audio.rate_control_delta -= 0.001;
if (g_settings.audio.rate_control_delta == 0.0)
g_settings.audio.rate_control = false;
else
g_settings.audio.rate_control = true;
break;
case S_AUDIO_CONTROL_RATE_INCREMENT:
if (g_settings.audio.rate_control_delta < 0.2)
g_settings.audio.rate_control_delta += 0.001;
g_settings.audio.rate_control = true;
break;
case S_FRAME_ADVANCE:
g_console.frame_advance_enable = true;
@ -68,11 +81,11 @@ void rarch_settings_change(unsigned setting)
}
break;
case S_RESOLUTION_NEXT:
if (g_console.current_resolution_index + 1 < g_console.supported_resolutions_count)
{
if (g_console.current_resolution_index + 1 < g_console.supported_resolutions_count)
{
g_console.current_resolution_index++;
g_console.current_resolution_id = g_console.supported_resolutions[g_console.current_resolution_index];
}
g_console.current_resolution_id = g_console.supported_resolutions[g_console.current_resolution_index];
}
break;
case S_QUIT:
g_console.menu_enable = false;
@ -139,7 +152,7 @@ void rarch_settings_change(unsigned setting)
break;
case S_TRIPLE_BUFFERING:
g_console.triple_buffering_enable = !g_console.triple_buffering_enable;
break;
break;
}
}
@ -151,7 +164,16 @@ void rarch_settings_default(unsigned setting)
g_console.aspect_ratio_index = ASPECT_RATIO_4_3;
break;
case S_DEF_AUDIO_MUTE:
g_extern.audio_data.mute = false;
g_extern.audio_data.mute = false;
break;
case S_DEF_AUDIO_CONTROL_RATE:
#ifdef GEKKO
g_settings.audio.rate_control_delta = 0.004;
g_settings.audio.rate_control = true;
#else
g_settings.audio.rate_control_delta = 0.0;
g_settings.audio.rate_control = false;
#endif
break;
case S_DEF_HW_TEXTURE_FILTER:
g_settings.video.smooth = 1;
@ -163,7 +185,7 @@ void rarch_settings_default(unsigned setting)
g_console.overscan_amount = 0.0f;
g_console.overscan_enable = false;
break;
case S_DEF_ROTATION:
case S_DEF_ROTATION:
g_console.screen_orientation = ORIENTATION_NORMAL;
break;
case S_DEF_THROTTLE:
@ -215,19 +237,19 @@ void rarch_settings_msg(unsigned setting, unsigned delay)
case S_MSG_NOT_IMPLEMENTED:
snprintf(str, sizeof(str), "TODO - Not yet implemented.");
break;
case S_MSG_RESIZE_SCREEN:
case S_MSG_RESIZE_SCREEN:
snprintf(str, sizeof(str), "INFO - Resize the screen by moving around the two analog sticks.\nPress [RetroPad X] to reset to default values, and [RetroPad A] to go back.\nTo select the resized screen mode, set Aspect Ratio to: 'Custom'.");
break;
case S_MSG_RESTART_RARCH:
case S_MSG_RESTART_RARCH:
snprintf(str, sizeof(str), "INFO - You need to restart RetroArch for this change to take effect.");
break;
case S_MSG_SELECT_LIBRETRO_CORE:
case S_MSG_SELECT_LIBRETRO_CORE:
snprintf(str, sizeof(str), "INFO - Select a Libretro core from the menu by pressing [RetroPad B].");
break;
case S_MSG_SELECT_SHADER:
case S_MSG_SELECT_SHADER:
snprintf(str, sizeof(str), "INFO - Select a shader from the menu by pressing [RetroPad A].");
break;
case S_MSG_SHADER_LOADING_SUCCEEDED:
case S_MSG_SHADER_LOADING_SUCCEEDED:
snprintf(str, sizeof(str), "INFO - Shader successfully loaded.");
break;
}
@ -250,26 +272,26 @@ void rarch_settings_create_menu_item_label(char * str, unsigned setting, size_t
case S_LBL_ASPECT_RATIO:
snprintf(str, size, "Aspect Ratio: %s", aspectratio_lut[g_console.aspect_ratio_index].name);
break;
case S_LBL_SHADER:
case S_LBL_SHADER:
snprintf(str, size, "Shader #1: %s", g_settings.video.cg_shader_path);
break;
case S_LBL_SHADER_2:
case S_LBL_SHADER_2:
snprintf(str, size, "Shader #2: %s", g_settings.video.second_pass_shader);
break;
case S_LBL_RARCH_VERSION:
case S_LBL_RARCH_VERSION:
snprintf(str, size, "RetroArch %s", PACKAGE_VERSION);
break;
case S_LBL_SCALE_FACTOR:
case S_LBL_SCALE_FACTOR:
snprintf(str, size, "Scale Factor: %f (X) / %f (Y)", g_settings.video.fbo_scale_x, g_settings.video.fbo_scale_y);
break;
case S_LBL_ROTATION:
case S_LBL_ROTATION:
snprintf(str, size, "Rotation: %s", rotation_lut[g_console.screen_orientation]);
break;
case S_LBL_LOAD_STATE_SLOT:
case S_LBL_LOAD_STATE_SLOT:
snprintf(str, size, "Load State #%d", g_extern.state_slot);
break;
case S_LBL_SAVE_STATE_SLOT:
snprintf(str, size, "Save State #%d", g_extern.state_slot);
case S_LBL_SAVE_STATE_SLOT:
snprintf(str, size, "Save State #%d", g_extern.state_slot);
break;
}
}

View File

@ -32,6 +32,8 @@ enum
S_ASPECT_RATIO_DECREMENT = 0,
S_ASPECT_RATIO_INCREMENT,
S_AUDIO_MUTE,
S_AUDIO_CONTROL_RATE_DECREMENT,
S_AUDIO_CONTROL_RATE_INCREMENT,
S_FRAME_ADVANCE,
S_HW_TEXTURE_FILTER,
S_HW_TEXTURE_FILTER_2,
@ -61,6 +63,7 @@ enum
{
S_DEF_ASPECT_RATIO = 0,
S_DEF_AUDIO_MUTE,
S_DEF_AUDIO_CONTROL_RATE,
S_DEF_HW_TEXTURE_FILTER,
S_DEF_HW_TEXTURE_FILTER_2,
S_DEF_OVERSCAN,

View File

@ -119,6 +119,12 @@ static bool get_rom_path(rgui_handle_t *rgui)
action = RGUI_ACTION_UP;
else if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_DOWN))
action = RGUI_ACTION_DOWN;
else if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_LEFT))
action = RGUI_ACTION_LEFT;
else if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_RIGHT))
action = RGUI_ACTION_RIGHT;
else if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
action = RGUI_ACTION_START;
else if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_SELECT) && !first) // don't catch start+select+l+r when exiting
action = RGUI_ACTION_SETTINGS;

View File

@ -42,7 +42,7 @@ struct rgui_handle
rgui_list_t *path_stack;
rgui_list_t *folder_buf;
size_t directory_ptr;
int directory_ptr;
bool need_refresh;
rgui_mode_t mode;
@ -209,32 +209,33 @@ static void render_text(rgui_handle_t *rgui, size_t begin, size_t end)
rgui_list_at(rgui->folder_buf, i, &path, &type, NULL);
char message[TERM_WIDTH + 1];
char *type_str;
int w;
char type_str[TERM_WIDTH + 1];
int w = 18;
switch (type)
{
case RGUI_FILE_PLAIN:
type_str = "(FILE)";
snprintf(type_str, sizeof(type_str), "(FILE)");
w = 6;
break;
case RGUI_FILE_DIRECTORY:
type_str = "(DIR)";
snprintf(type_str, sizeof(type_str), "(DIR)");
w = 5;
break;
case RGUI_FILE_DEVICE:
type_str = "(DEV)";
snprintf(type_str, sizeof(type_str), "(DEV)");
w = 5;
break;
case RGUI_SETTINGS_VIDEO_FILTER:
type_str = g_settings.video.smooth ? "Bilinear filtering" : "Point filtering";
w = 18;
snprintf(type_str, sizeof(type_str), g_settings.video.smooth ? "Bilinear filtering" : "Point filtering");
break;
case RGUI_SETTINGS_AUDIO_MUTE:
type_str = g_extern.audio_data.mute ? "ON" : "OFF";
w = 18;
snprintf(type_str, sizeof(type_str), g_extern.audio_data.mute ? "ON" : "OFF");
break;
case RGUI_SETTINGS_AUDIO_CONTROL_RATE:
snprintf(type_str, sizeof(type_str), "%.3f", g_settings.audio.rate_control_delta);
break;
default:
type_str = "";
type_str[0] = 0;
w = 0;
break;
}
@ -287,19 +288,29 @@ static void render_messagebox(rgui_handle_t *rgui, const char *message)
free(msg);
}
static void rgui_settings_toggle_setting(rgui_file_type_t setting)
static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t action)
{
switch (setting)
{
/*case RGUI_SETTINGS_VIDEO_STRETCH:
break;*/
case RGUI_SETTINGS_VIDEO_FILTER:
rarch_settings_change(S_HW_TEXTURE_FILTER);
if (action == RGUI_ACTION_START)
rarch_settings_default(S_DEF_HW_TEXTURE_FILTER);
else
rarch_settings_change(S_HW_TEXTURE_FILTER);
break;
case RGUI_SETTINGS_AUDIO_MUTE:
rarch_settings_change(S_AUDIO_MUTE);
if (action == RGUI_ACTION_START)
rarch_settings_default(S_DEF_AUDIO_MUTE);
else
rarch_settings_change(S_AUDIO_MUTE);
break;
case RGUI_SETTINGS_AUDIO_CONTROL_RATE:
if (action == RGUI_ACTION_START)
rarch_settings_default(S_DEF_AUDIO_CONTROL_RATE);
else if (action == RGUI_ACTION_LEFT)
rarch_settings_change(S_AUDIO_CONTROL_RATE_DECREMENT);
else if (action == RGUI_ACTION_RIGHT)
rarch_settings_change(S_AUDIO_CONTROL_RATE_INCREMENT);
break;
default:
break;
@ -312,6 +323,7 @@ static void rgui_settings_populate_entries(rgui_handle_t *rgui)
rgui_list_push(rgui->folder_buf, "Hardware filtering", RGUI_SETTINGS_VIDEO_FILTER, 0);
rgui_list_push(rgui->folder_buf, "Mute Audio", RGUI_SETTINGS_AUDIO_MUTE, 0);
rgui_list_push(rgui->folder_buf, "Audio Control Rate", RGUI_SETTINGS_AUDIO_CONTROL_RATE, 0);
}
static bool rgui_settings_iterate(rgui_handle_t *rgui, rgui_action_t action)
@ -332,19 +344,20 @@ static bool rgui_settings_iterate(rgui_handle_t *rgui, rgui_action_t action)
rgui->directory_ptr = 0;
break;
case RGUI_ACTION_LEFT:
case RGUI_ACTION_CANCEL:
case RGUI_ACTION_SETTINGS:
rgui->mode = RGUI_FILEBROWSER;
return true;
break;
case RGUI_ACTION_LEFT:
case RGUI_ACTION_RIGHT:
case RGUI_ACTION_OK:
case RGUI_ACTION_START:
{
rgui_file_type_t type;
rgui_list_at(rgui->folder_buf, rgui->directory_ptr, NULL, &type, NULL);
rgui_settings_toggle_setting(type);
rgui_settings_toggle_setting(type, action);
break;
}
@ -404,6 +417,19 @@ const char *rgui_iterate(rgui_handle_t *rgui, rgui_action_t action)
break;
case RGUI_ACTION_LEFT:
if (rgui->directory_ptr - 8 > 0)
rgui->directory_ptr -= 8;
else
rgui->directory_ptr = 0;
break;
case RGUI_ACTION_RIGHT:
if (rgui->directory_ptr + 8 < rgui_list_size(rgui->folder_buf))
rgui->directory_ptr += 8;
else
rgui->directory_ptr = rgui_list_size(rgui->folder_buf) - 1;
break;
case RGUI_ACTION_CANCEL:
if (rgui_list_size(rgui->path_stack) > 1)
{
@ -415,7 +441,6 @@ const char *rgui_iterate(rgui_handle_t *rgui, rgui_action_t action)
}
break;
case RGUI_ACTION_RIGHT:
case RGUI_ACTION_OK:
{
if (rgui_list_size(rgui->folder_buf) == 0)

View File

@ -32,9 +32,9 @@ typedef enum
RGUI_FILE_DEVICE,
// settings options are done here too
//RGUI_SETTINGS_VIDEO_STRETCH,
RGUI_SETTINGS_VIDEO_FILTER,
RGUI_SETTINGS_AUDIO_MUTE
RGUI_SETTINGS_AUDIO_MUTE,
RGUI_SETTINGS_AUDIO_CONTROL_RATE
} rgui_file_type_t;
typedef enum
@ -47,6 +47,7 @@ typedef enum
RGUI_ACTION_CANCEL,
RGUI_ACTION_REFRESH,
RGUI_ACTION_SETTINGS,
RGUI_ACTION_START,
RGUI_ACTION_NOOP
} rgui_action_t;