mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 22:41:25 +12:00
Add overlay animations
This commit is contained in:
parent
05e80aad90
commit
6b370e85d5
9 changed files with 130 additions and 17 deletions
|
@ -14,6 +14,7 @@ namespace rsx
|
||||||
void shader_loading_dialog_native::create(const std::string& msg, const std::string&/* title*/)
|
void shader_loading_dialog_native::create(const std::string& msg, const std::string&/* title*/)
|
||||||
{
|
{
|
||||||
MsgDialogType type = {};
|
MsgDialogType type = {};
|
||||||
|
type.se_mute_on = true;
|
||||||
type.disable_cancel = true;
|
type.disable_cancel = true;
|
||||||
type.progress_bar_count = 2;
|
type.progress_bar_count = 2;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "Emu/Cell/ErrorCodes.h"
|
#include "Emu/Cell/ErrorCodes.h"
|
||||||
#include "Emu/IdManager.h"
|
#include "Emu/IdManager.h"
|
||||||
#include "Utilities/Thread.h"
|
#include "Utilities/Thread.h"
|
||||||
|
#include "Emu/RSX/RSXThread.h"
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
@ -55,6 +56,8 @@ namespace rsx
|
||||||
btn_cancel.set_image_resource(resource_config::standard_image_resource::circle);
|
btn_cancel.set_image_resource(resource_config::standard_image_resource::circle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fade_animation.duration = 0.15f;
|
||||||
|
|
||||||
update_custom_background();
|
update_custom_background();
|
||||||
|
|
||||||
return_code = CELL_MSGDIALOG_BUTTON_NONE;
|
return_code = CELL_MSGDIALOG_BUTTON_NONE;
|
||||||
|
@ -101,11 +104,15 @@ namespace rsx
|
||||||
result.add(btn_cancel.get_compiled());
|
result.add(btn_cancel.get_compiled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fade_animation.apply(result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void message_dialog::on_button_pressed(pad_button button_press)
|
void message_dialog::on_button_pressed(pad_button button_press)
|
||||||
{
|
{
|
||||||
|
if (fade_animation.active) return;
|
||||||
|
|
||||||
switch (button_press)
|
switch (button_press)
|
||||||
{
|
{
|
||||||
case pad_button::cross:
|
case pad_button::cross:
|
||||||
|
@ -124,7 +131,7 @@ namespace rsx
|
||||||
return_code = CELL_MSGDIALOG_BUTTON_YES;
|
return_code = CELL_MSGDIALOG_BUTTON_YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_system_ok.wav");
|
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_decide.wav");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case pad_button::circle:
|
case pad_button::circle:
|
||||||
|
@ -150,7 +157,14 @@ namespace rsx
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fade_animation.current = color4f(1.f);
|
||||||
|
fade_animation.end = color4f(0.f);
|
||||||
|
fade_animation.active = true;
|
||||||
|
|
||||||
|
fade_animation.on_finish = [this]
|
||||||
|
{
|
||||||
close(true, true);
|
close(true, true);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void message_dialog::close(bool use_callback, bool stop_pad_interception)
|
void message_dialog::close(bool use_callback, bool stop_pad_interception)
|
||||||
|
@ -168,6 +182,12 @@ namespace rsx
|
||||||
static constexpr auto thread_name = "MsgDialog Thread"sv;
|
static constexpr auto thread_name = "MsgDialog Thread"sv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void message_dialog::update()
|
||||||
|
{
|
||||||
|
if (fade_animation.active)
|
||||||
|
fade_animation.update(rsx::get_current_renderer()->vblank_count);
|
||||||
|
}
|
||||||
|
|
||||||
error_code message_dialog::show(bool is_blocking, const std::string& text, const MsgDialogType& type, std::function<void(s32 status)> on_close)
|
error_code message_dialog::show(bool is_blocking, const std::string& text, const MsgDialogType& type, std::function<void(s32 status)> on_close)
|
||||||
{
|
{
|
||||||
visible = false;
|
visible = false;
|
||||||
|
@ -189,6 +209,20 @@ namespace rsx
|
||||||
btn_ok.translate(0, offset);
|
btn_ok.translate(0, offset);
|
||||||
btn_cancel.translate(0, offset);
|
btn_cancel.translate(0, offset);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fade_animation.current = color4f(0.f);
|
||||||
|
fade_animation.end = color4f(1.f);
|
||||||
|
fade_animation.active = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
set_text(text);
|
set_text(text);
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,14 @@ namespace rsx
|
||||||
u32 background_darkening_strength = 0;
|
u32 background_darkening_strength = 0;
|
||||||
std::unique_ptr<image_info> background_image;
|
std::unique_ptr<image_info> background_image;
|
||||||
|
|
||||||
|
animation_color_interpolate fade_animation;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
message_dialog(bool allow_custom_background = false);
|
message_dialog(bool allow_custom_background = false);
|
||||||
|
|
||||||
compiled_resource get_compiled() override;
|
compiled_resource get_compiled() override;
|
||||||
|
|
||||||
|
void update() override;
|
||||||
void on_button_pressed(pad_button button_press) override;
|
void on_button_pressed(pad_button button_press) override;
|
||||||
void close(bool use_callback, bool stop_pad_interception) override;
|
void close(bool use_callback, bool stop_pad_interception) override;
|
||||||
|
|
||||||
|
|
|
@ -528,7 +528,7 @@ namespace rsx
|
||||||
}
|
}
|
||||||
case pad_button::start:
|
case pad_button::start:
|
||||||
{
|
{
|
||||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_system_ok.wav");
|
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_oskenter.wav");
|
||||||
Close(CELL_OSKDIALOG_CLOSE_CONFIRM);
|
Close(CELL_OSKDIALOG_CLOSE_CONFIRM);
|
||||||
play_cursor_sound = false;
|
play_cursor_sound = false;
|
||||||
break;
|
break;
|
||||||
|
@ -545,7 +545,7 @@ namespace rsx
|
||||||
}
|
}
|
||||||
case pad_button::cross:
|
case pad_button::cross:
|
||||||
{
|
{
|
||||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_decide.wav");
|
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_oskenter.wav");
|
||||||
on_accept();
|
on_accept();
|
||||||
m_reset_pulse = true;
|
m_reset_pulse = true;
|
||||||
play_cursor_sound = false;
|
play_cursor_sound = false;
|
||||||
|
@ -553,7 +553,7 @@ namespace rsx
|
||||||
}
|
}
|
||||||
case pad_button::circle:
|
case pad_button::circle:
|
||||||
{
|
{
|
||||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cancel.wav");
|
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_oskcancel.wav");
|
||||||
Close(CELL_OSKDIALOG_CLOSE_CANCEL);
|
Close(CELL_OSKDIALOG_CLOSE_CANCEL);
|
||||||
play_cursor_sound = false;
|
play_cursor_sound = false;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "overlay_save_dialog.h"
|
#include "overlay_save_dialog.h"
|
||||||
#include "Utilities/date_time.h"
|
#include "Utilities/date_time.h"
|
||||||
#include "Emu/System.h"
|
#include "Emu/System.h"
|
||||||
|
#include "Emu/RSX/RSXThread.h"
|
||||||
|
|
||||||
namespace rsx
|
namespace rsx
|
||||||
{
|
{
|
||||||
|
@ -104,6 +105,8 @@ namespace rsx
|
||||||
m_description->back_color.a = 0.f;
|
m_description->back_color.a = 0.f;
|
||||||
m_time_thingy->back_color.a = 0.f;
|
m_time_thingy->back_color.a = 0.f;
|
||||||
|
|
||||||
|
fade_animation.duration = 0.15f;
|
||||||
|
|
||||||
return_code = selection_code::canceled;
|
return_code = selection_code::canceled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,23 +114,32 @@ namespace rsx
|
||||||
{
|
{
|
||||||
m_time_thingy->set_text(date_time::current_time());
|
m_time_thingy->set_text(date_time::current_time());
|
||||||
m_time_thingy->auto_resize();
|
m_time_thingy->auto_resize();
|
||||||
|
|
||||||
|
if (fade_animation.active)
|
||||||
|
{
|
||||||
|
fade_animation.update(rsx::get_current_renderer()->vblank_count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void save_dialog::on_button_pressed(pad_button button_press)
|
void save_dialog::on_button_pressed(pad_button button_press)
|
||||||
{
|
{
|
||||||
|
if (fade_animation.active) return;
|
||||||
|
|
||||||
|
bool close_dialog = false;
|
||||||
|
|
||||||
switch (button_press)
|
switch (button_press)
|
||||||
{
|
{
|
||||||
case pad_button::cross:
|
case pad_button::cross:
|
||||||
if (m_no_saves)
|
if (m_no_saves)
|
||||||
break;
|
break;
|
||||||
return_code = m_list->get_selected_index();
|
return_code = m_list->get_selected_index();
|
||||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_system_ok.wav");
|
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_decide.wav");
|
||||||
close(true, true);
|
close_dialog = true;
|
||||||
return;
|
break;
|
||||||
case pad_button::circle:
|
case pad_button::circle:
|
||||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cancel.wav");
|
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cancel.wav");
|
||||||
close(true, true);
|
close_dialog = true;
|
||||||
return;
|
break;
|
||||||
case pad_button::dpad_up:
|
case pad_button::dpad_up:
|
||||||
case pad_button::ls_up:
|
case pad_button::ls_up:
|
||||||
m_list->select_previous();
|
m_list->select_previous();
|
||||||
|
@ -147,7 +159,21 @@ namespace rsx
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_decide.wav");
|
if (close_dialog)
|
||||||
|
{
|
||||||
|
fade_animation.current = color4f(1.f);
|
||||||
|
fade_animation.end = color4f(0.f);
|
||||||
|
fade_animation.active = true;
|
||||||
|
|
||||||
|
fade_animation.on_finish = [this]
|
||||||
|
{
|
||||||
|
close(true, true);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cursor.wav");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compiled_resource save_dialog::get_compiled()
|
compiled_resource save_dialog::get_compiled()
|
||||||
|
@ -166,6 +192,8 @@ namespace rsx
|
||||||
if (m_no_saves)
|
if (m_no_saves)
|
||||||
result.add(m_no_saves_text->get_compiled());
|
result.add(m_no_saves_text->get_compiled());
|
||||||
|
|
||||||
|
fade_animation.apply(result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,6 +300,11 @@ namespace rsx
|
||||||
}
|
}
|
||||||
|
|
||||||
m_description->auto_resize();
|
m_description->auto_resize();
|
||||||
|
|
||||||
|
fade_animation.current = color4f(0.f);
|
||||||
|
fade_animation.end = color4f(1.f);
|
||||||
|
fade_animation.active = true;
|
||||||
|
|
||||||
visible = true;
|
visible = true;
|
||||||
|
|
||||||
if (const auto err = run_input_loop())
|
if (const auto err = run_input_loop())
|
||||||
|
|
|
@ -28,6 +28,8 @@ namespace rsx
|
||||||
|
|
||||||
bool m_no_saves = false;
|
bool m_no_saves = false;
|
||||||
|
|
||||||
|
animation_color_interpolate fade_animation;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
save_dialog();
|
save_dialog();
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "Emu/vfs_config.h"
|
#include "Emu/vfs_config.h"
|
||||||
#include "Emu/system_utils.hpp"
|
#include "Emu/system_utils.hpp"
|
||||||
#include "Emu/System.h"
|
#include "Emu/System.h"
|
||||||
|
#include "Emu/RSX/RSXThread.h"
|
||||||
#include "Utilities/StrUtil.h"
|
#include "Utilities/StrUtil.h"
|
||||||
#include "Utilities/Thread.h"
|
#include "Utilities/Thread.h"
|
||||||
|
|
||||||
|
@ -80,11 +81,25 @@ namespace rsx
|
||||||
m_description->auto_resize();
|
m_description->auto_resize();
|
||||||
m_description->back_color.a = 0.f;
|
m_description->back_color.a = 0.f;
|
||||||
|
|
||||||
|
fade_animation.duration = 0.15f;
|
||||||
|
|
||||||
return_code = selection_code::canceled;
|
return_code = selection_code::canceled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void user_list_dialog::update()
|
||||||
|
{
|
||||||
|
if (fade_animation.active)
|
||||||
|
{
|
||||||
|
fade_animation.update(rsx::get_current_renderer()->vblank_count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void user_list_dialog::on_button_pressed(pad_button button_press)
|
void user_list_dialog::on_button_pressed(pad_button button_press)
|
||||||
{
|
{
|
||||||
|
if (fade_animation.active) return;
|
||||||
|
|
||||||
|
bool close_dialog = false;
|
||||||
|
|
||||||
switch (button_press)
|
switch (button_press)
|
||||||
{
|
{
|
||||||
case pad_button::cross:
|
case pad_button::cross:
|
||||||
|
@ -99,13 +114,13 @@ namespace rsx
|
||||||
{
|
{
|
||||||
return_code = selection_code::error;
|
return_code = selection_code::error;
|
||||||
}
|
}
|
||||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_system_ok.wav");
|
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_decide.wav");
|
||||||
close(true, true);
|
close_dialog = true;
|
||||||
return;
|
break;
|
||||||
case pad_button::circle:
|
case pad_button::circle:
|
||||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cancel.wav");
|
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cancel.wav");
|
||||||
close(true, true);
|
close_dialog = true;
|
||||||
return;
|
break;
|
||||||
case pad_button::dpad_up:
|
case pad_button::dpad_up:
|
||||||
case pad_button::ls_up:
|
case pad_button::ls_up:
|
||||||
m_list->select_previous();
|
m_list->select_previous();
|
||||||
|
@ -125,7 +140,21 @@ namespace rsx
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_decide.wav");
|
if (close_dialog)
|
||||||
|
{
|
||||||
|
fade_animation.current = color4f(1.f);
|
||||||
|
fade_animation.end = color4f(0.f);
|
||||||
|
fade_animation.active = true;
|
||||||
|
|
||||||
|
fade_animation.on_finish = [this]
|
||||||
|
{
|
||||||
|
close(true, true);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cursor.wav");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compiled_resource user_list_dialog::get_compiled()
|
compiled_resource user_list_dialog::get_compiled()
|
||||||
|
@ -139,6 +168,9 @@ namespace rsx
|
||||||
result.add(m_dim_background->get_compiled());
|
result.add(m_dim_background->get_compiled());
|
||||||
result.add(m_list->get_compiled());
|
result.add(m_list->get_compiled());
|
||||||
result.add(m_description->get_compiled());
|
result.add(m_description->get_compiled());
|
||||||
|
|
||||||
|
fade_animation.apply(result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,6 +236,10 @@ namespace rsx
|
||||||
m_description->set_text(title);
|
m_description->set_text(title);
|
||||||
m_description->auto_resize();
|
m_description->auto_resize();
|
||||||
|
|
||||||
|
fade_animation.current = color4f(0.f);
|
||||||
|
fade_animation.end = color4f(1.f);
|
||||||
|
fade_animation.active = true;
|
||||||
|
|
||||||
this->on_close = std::move(on_close);
|
this->on_close = std::move(on_close);
|
||||||
visible = true;
|
visible = true;
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,12 @@ namespace rsx
|
||||||
std::unique_ptr<list_view> m_list;
|
std::unique_ptr<list_view> m_list;
|
||||||
std::unique_ptr<label> m_description;
|
std::unique_ptr<label> m_description;
|
||||||
|
|
||||||
|
animation_color_interpolate fade_animation;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
user_list_dialog();
|
user_list_dialog();
|
||||||
|
|
||||||
|
void update() override;
|
||||||
void on_button_pressed(pad_button button_press) override;
|
void on_button_pressed(pad_button button_press) override;
|
||||||
|
|
||||||
compiled_resource get_compiled() override;
|
compiled_resource get_compiled() override;
|
||||||
|
|
|
@ -70,6 +70,7 @@ void progress_dialog_server::operator()()
|
||||||
if (manager && !skip_this_one)
|
if (manager && !skip_this_one)
|
||||||
{
|
{
|
||||||
MsgDialogType type{};
|
MsgDialogType type{};
|
||||||
|
type.se_mute_on = true;
|
||||||
type.se_normal = true;
|
type.se_normal = true;
|
||||||
type.bg_invisible = true;
|
type.bg_invisible = true;
|
||||||
type.disable_cancel = true;
|
type.disable_cancel = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue