mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-12-06 07:12:28 +01:00
overlays: use enum for sound effects
This commit is contained in:
parent
e938b93f48
commit
e2cbbcf646
|
|
@ -1,7 +1,6 @@
|
|||
#include "stdafx.h"
|
||||
#include "../overlay_manager.h"
|
||||
#include "overlay_friends_list_dialog.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/NP/rpcn_config.h"
|
||||
#include "Emu/vfs_config.h"
|
||||
|
||||
|
|
@ -306,11 +305,11 @@ namespace rsx
|
|||
}
|
||||
}
|
||||
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_decide.wav");
|
||||
play_sound(sound_effect::accept);
|
||||
return;
|
||||
}
|
||||
case pad_button::circle:
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cancel.wav");
|
||||
play_sound(sound_effect::cancel);
|
||||
close_dialog = true;
|
||||
break;
|
||||
case pad_button::square:
|
||||
|
|
@ -359,7 +358,7 @@ namespace rsx
|
|||
// Play a sound unless this is a fast auto repeat which would induce a nasty noise
|
||||
else if (!is_auto_repeat || m_auto_repeat_ms_interval >= m_auto_repeat_ms_interval_default)
|
||||
{
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cursor.wav");
|
||||
play_sound(sound_effect::cursor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#include "stdafx.h"
|
||||
#include "overlay_home_menu_message_box.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/system_config.h"
|
||||
|
||||
namespace rsx
|
||||
|
|
@ -77,7 +76,7 @@ namespace rsx
|
|||
{
|
||||
case pad_button::cross:
|
||||
{
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_decide.wav");
|
||||
play_sound(sound_effect::accept);
|
||||
if (m_on_accept)
|
||||
{
|
||||
m_on_accept();
|
||||
|
|
@ -86,7 +85,7 @@ namespace rsx
|
|||
}
|
||||
case pad_button::circle:
|
||||
{
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cancel.wav");
|
||||
play_sound(sound_effect::cancel);
|
||||
if (m_on_cancel)
|
||||
{
|
||||
m_on_cancel();
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ namespace rsx
|
|||
// Play a sound unless this is a fast auto repeat which would induce a nasty noise
|
||||
if (!is_auto_repeat || auto_repeat_interval_ms >= user_interface::m_auto_repeat_ms_interval_default)
|
||||
{
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_decide.wav");
|
||||
play_sound(sound_effect::accept);
|
||||
}
|
||||
return func(button_press);
|
||||
}
|
||||
|
|
@ -169,7 +169,7 @@ namespace rsx
|
|||
}
|
||||
case pad_button::circle:
|
||||
{
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cancel.wav");
|
||||
play_sound(sound_effect::cancel);
|
||||
if (parent)
|
||||
{
|
||||
set_current_page(parent);
|
||||
|
|
@ -244,7 +244,7 @@ namespace rsx
|
|||
// Play a sound unless this is a fast auto repeat which would induce a nasty noise
|
||||
if (!is_auto_repeat || auto_repeat_interval_ms >= user_interface::m_auto_repeat_ms_interval_default)
|
||||
{
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cursor.wav");
|
||||
play_sound(sound_effect::cursor);
|
||||
}
|
||||
return page_navigation::stay;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,11 +127,11 @@ namespace rsx
|
|||
{
|
||||
return_code = selection_code::error;
|
||||
}
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_decide.wav");
|
||||
play_sound(sound_effect::accept);
|
||||
close_dialog = true;
|
||||
break;
|
||||
case pad_button::circle:
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cancel.wav");
|
||||
play_sound(sound_effect::cancel);
|
||||
close_dialog = true;
|
||||
break;
|
||||
case pad_button::dpad_up:
|
||||
|
|
@ -167,7 +167,7 @@ namespace rsx
|
|||
// Play a sound unless this is a fast auto repeat which would induce a nasty noise
|
||||
else if (!is_auto_repeat || m_auto_repeat_ms_interval >= m_auto_repeat_ms_interval_default)
|
||||
{
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cursor.wav");
|
||||
play_sound(sound_effect::cursor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ namespace rsx
|
|||
if (m_list->m_items.empty() || is_auto_repeat)
|
||||
break;
|
||||
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_decide.wav");
|
||||
play_sound(sound_effect::accept);
|
||||
|
||||
if (!get_current_selection().empty())
|
||||
{
|
||||
|
|
@ -95,7 +95,7 @@ namespace rsx
|
|||
close_dialog = true;
|
||||
break;
|
||||
case pad_button::circle:
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cancel.wav");
|
||||
play_sound(sound_effect::cancel);
|
||||
close_dialog = true;
|
||||
break;
|
||||
case pad_button::dpad_up:
|
||||
|
|
@ -131,7 +131,7 @@ namespace rsx
|
|||
// Play a sound unless this is a fast auto repeat which would induce a nasty noise
|
||||
else if (!is_auto_repeat || m_auto_repeat_ms_interval >= m_auto_repeat_ms_interval_default)
|
||||
{
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cursor.wav");
|
||||
play_sound(sound_effect::cursor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ namespace rsx
|
|||
switch (button_press)
|
||||
{
|
||||
case pad_button::circle:
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cancel.wav");
|
||||
play_sound(sound_effect::cancel);
|
||||
close_dialog = true;
|
||||
break;
|
||||
case pad_button::square:
|
||||
|
|
@ -172,7 +172,7 @@ namespace rsx
|
|||
// Play a sound unless this is a fast auto repeat which would induce a nasty noise
|
||||
else if (!is_auto_repeat || m_auto_repeat_ms_interval >= m_auto_repeat_ms_interval_default)
|
||||
{
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cursor.wav");
|
||||
play_sound(sound_effect::cursor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
#include "overlay_media_list_dialog.h"
|
||||
|
||||
#include "Emu/Cell/Modules/cellMusic.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/VFS.h"
|
||||
#include "Utilities/StrUtil.h"
|
||||
#include "Utilities/Thread.h"
|
||||
|
|
@ -154,13 +153,13 @@ namespace rsx
|
|||
return_code = m_list->get_selected_index();
|
||||
m_stop_input_loop = true;
|
||||
play_cursor_sound = false;
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_decide.wav");
|
||||
play_sound(sound_effect::accept);
|
||||
break;
|
||||
case pad_button::circle:
|
||||
return_code = selection_code::canceled;
|
||||
m_stop_input_loop = true;
|
||||
play_cursor_sound = false;
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cancel.wav");
|
||||
play_sound(sound_effect::cancel);
|
||||
break;
|
||||
case pad_button::dpad_up:
|
||||
m_list->select_previous();
|
||||
|
|
@ -182,7 +181,7 @@ namespace rsx
|
|||
// Play a sound unless this is a fast auto repeat which would induce a nasty noise
|
||||
if (play_cursor_sound && (!is_auto_repeat || m_auto_repeat_ms_interval >= m_auto_repeat_ms_interval_default))
|
||||
{
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cursor.wav");
|
||||
play_sound(sound_effect::cursor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ namespace rsx
|
|||
return_code = CELL_MSGDIALOG_BUTTON_YES;
|
||||
}
|
||||
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_decide.wav");
|
||||
play_sound(sound_effect::accept);
|
||||
break;
|
||||
}
|
||||
case pad_button::circle:
|
||||
|
|
@ -175,7 +175,7 @@ namespace rsx
|
|||
return_code = CELL_MSGDIALOG_BUTTON_NO;
|
||||
}
|
||||
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cancel.wav");
|
||||
play_sound(sound_effect::cancel);
|
||||
break;
|
||||
}
|
||||
default: return;
|
||||
|
|
@ -238,10 +238,7 @@ namespace rsx
|
|||
|
||||
if (!type.se_mute_on)
|
||||
{
|
||||
if (type.se_normal)
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_system_ok.wav");
|
||||
else
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_system_ng.wav");
|
||||
play_sound(type.se_normal ? sound_effect::dialog_ok : sound_effect::dialog_error);
|
||||
}
|
||||
|
||||
set_text(text);
|
||||
|
|
|
|||
|
|
@ -823,7 +823,7 @@ namespace rsx
|
|||
}
|
||||
case pad_button::start:
|
||||
{
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_oskenter.wav");
|
||||
play_sound(sound_effect::osk_accept);
|
||||
Close(CELL_OSKDIALOG_CLOSE_CONFIRM);
|
||||
play_cursor_sound = false;
|
||||
break;
|
||||
|
|
@ -840,7 +840,7 @@ namespace rsx
|
|||
}
|
||||
case pad_button::cross:
|
||||
{
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_oskenter.wav");
|
||||
play_sound(sound_effect::osk_accept);
|
||||
on_accept();
|
||||
m_reset_pulse = true;
|
||||
play_cursor_sound = false;
|
||||
|
|
@ -848,7 +848,7 @@ namespace rsx
|
|||
}
|
||||
case pad_button::circle:
|
||||
{
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_oskcancel.wav");
|
||||
play_sound(sound_effect::osk_cancel);
|
||||
Close(CELL_OSKDIALOG_CLOSE_CANCEL);
|
||||
play_cursor_sound = false;
|
||||
break;
|
||||
|
|
@ -890,7 +890,7 @@ namespace rsx
|
|||
// Play a sound unless this is a fast auto repeat which would induce a nasty noise
|
||||
if (play_cursor_sound && (!is_auto_repeat || m_auto_repeat_ms_interval >= m_auto_repeat_ms_interval_default))
|
||||
{
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cursor.wav");
|
||||
play_sound(sound_effect::cursor);
|
||||
}
|
||||
|
||||
if (m_reset_pulse)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#include "overlay_save_dialog.h"
|
||||
#include "overlay_video.h"
|
||||
#include "Utilities/date_time.h"
|
||||
#include "Emu/System.h"
|
||||
|
||||
namespace rsx
|
||||
{
|
||||
|
|
@ -133,11 +132,11 @@ namespace rsx
|
|||
if (m_no_saves)
|
||||
break;
|
||||
return_code = m_list->get_selected_index();
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_decide.wav");
|
||||
play_sound(sound_effect::accept);
|
||||
close_dialog = true;
|
||||
break;
|
||||
case pad_button::circle:
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cancel.wav");
|
||||
play_sound(sound_effect::cancel);
|
||||
close_dialog = true;
|
||||
break;
|
||||
case pad_button::dpad_up:
|
||||
|
|
@ -173,7 +172,7 @@ namespace rsx
|
|||
// Play a sound unless this is a fast auto repeat which would induce a nasty noise
|
||||
else if (!is_auto_repeat || m_auto_repeat_ms_interval >= m_auto_repeat_ms_interval_default)
|
||||
{
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cursor.wav");
|
||||
play_sound(sound_effect::cursor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#include "stdafx.h"
|
||||
#include "overlay_trophy_notification.h"
|
||||
#include "Emu/Cell/ErrorCodes.h"
|
||||
#include "Emu/System.h"
|
||||
|
||||
namespace rsx
|
||||
{
|
||||
|
|
@ -70,7 +69,7 @@ namespace rsx
|
|||
{
|
||||
// First tick
|
||||
creation_time_us = timestamp_us;
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_trophy.wav");
|
||||
play_sound(sound_effect::trophy);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -113,11 +113,11 @@ namespace rsx
|
|||
{
|
||||
return_code = selection_code::error;
|
||||
}
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_decide.wav");
|
||||
play_sound(sound_effect::accept);
|
||||
close_dialog = true;
|
||||
break;
|
||||
case pad_button::circle:
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cancel.wav");
|
||||
play_sound(sound_effect::cancel);
|
||||
close_dialog = true;
|
||||
break;
|
||||
case pad_button::dpad_up:
|
||||
|
|
@ -153,7 +153,7 @@ namespace rsx
|
|||
// Play a sound unless this is a fast auto repeat which would induce a nasty noise
|
||||
else if (!is_auto_repeat || m_auto_repeat_ms_interval >= m_auto_repeat_ms_interval_default)
|
||||
{
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cursor.wav");
|
||||
play_sound(sound_effect::cursor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,28 @@ namespace rsx
|
|||
{
|
||||
namespace overlays
|
||||
{
|
||||
void play_sound(sound_effect sound)
|
||||
{
|
||||
const auto get_sound_filename = [sound]()
|
||||
{
|
||||
switch (sound)
|
||||
{
|
||||
case sound_effect::cursor: return "snd_cursor"sv;
|
||||
case sound_effect::accept: return "snd_decide"sv;
|
||||
case sound_effect::cancel: return "snd_cancel"sv;
|
||||
case sound_effect::osk_accept: return "snd_oskenter"sv;
|
||||
case sound_effect::osk_cancel: return "snd_oskcancel"sv;
|
||||
case sound_effect::dialog_ok: return "snd_system_ok"sv;
|
||||
case sound_effect::dialog_error: return "snd_system_ng"sv;
|
||||
case sound_effect::trophy: return "snd_trophy"sv;
|
||||
}
|
||||
|
||||
fmt::throw_exception("Unreachable (sound=%d)", static_cast<u32>(sound));
|
||||
};
|
||||
|
||||
Emu.GetCallbacks().play_sound(fmt::format("%ssounds/%s.wav", fs::get_config_dir(), get_sound_filename()));
|
||||
}
|
||||
|
||||
thread_local DECLARE(user_interface::g_thread_bit) = 0;
|
||||
|
||||
u32 user_interface::alloc_thread_bit()
|
||||
|
|
|
|||
|
|
@ -17,6 +17,20 @@ namespace rsx
|
|||
{
|
||||
namespace overlays
|
||||
{
|
||||
enum class sound_effect
|
||||
{
|
||||
cursor,
|
||||
accept,
|
||||
cancel,
|
||||
osk_accept,
|
||||
osk_cancel,
|
||||
dialog_ok,
|
||||
dialog_error,
|
||||
trophy,
|
||||
};
|
||||
|
||||
void play_sound(sound_effect sound);
|
||||
|
||||
// Bitfield of UI signals to overlay manager
|
||||
enum status_bits : u32
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue