mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-03-17 18:55:19 +01:00
overlays: allow to reset current setting
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux-aarch64.sh, gcc, rpcs3/rpcs3-ci-jammy-aarch64:1.9, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.9, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1, rpcs3/rpcs3-binaries-linux-arm64, /rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.9, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (d812f1254a1157c80fd402f94446310560f54e5f, rpcs3/rpcs3-binaries-linux, /rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.9, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (0, 51ae32f468089a8169aaf1567de355ff4a3e0842, rpcs3/rpcs3-binaries-mac, Intel) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (1, 8e21bdbc40711a3fccd18fbf17b742348b0f4281, rpcs3/rpcs3-binaries-mac-arm64, Apple Silicon) (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang ${{ matrix.arch }} (aarch64, clang, clangarm64, ARM64, windows-11-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang ${{ matrix.arch }} (x86_64, clang, clang64, X64, windows-2025) (push) Waiting to run
Build RPCS3 / RPCS3 FreeBSD (push) Waiting to run
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux-aarch64.sh, gcc, rpcs3/rpcs3-ci-jammy-aarch64:1.9, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.9, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1, rpcs3/rpcs3-binaries-linux-arm64, /rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.9, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (d812f1254a1157c80fd402f94446310560f54e5f, rpcs3/rpcs3-binaries-linux, /rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.9, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (0, 51ae32f468089a8169aaf1567de355ff4a3e0842, rpcs3/rpcs3-binaries-mac, Intel) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (1, 8e21bdbc40711a3fccd18fbf17b742348b0f4281, rpcs3/rpcs3-binaries-mac-arm64, Apple Silicon) (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang ${{ matrix.arch }} (aarch64, clang, clangarm64, ARM64, windows-11-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang ${{ matrix.arch }} (x86_64, clang, clang64, X64, windows-2025) (push) Waiting to run
Build RPCS3 / RPCS3 FreeBSD (push) Waiting to run
This commit is contained in:
parent
951d47c94c
commit
b734ceb2e7
|
|
@ -11,6 +11,7 @@ namespace rsx
|
|||
: list_view(width, height, use_separators)
|
||||
, parent(parent)
|
||||
, title(title)
|
||||
, m_reset_btn(120, 30)
|
||||
, m_save_btn(120, 30)
|
||||
, m_discard_btn(120, 30)
|
||||
{
|
||||
|
|
@ -20,15 +21,19 @@ namespace rsx
|
|||
m_config_changed = parent->m_config_changed;
|
||||
}
|
||||
|
||||
m_reset_btn.set_image_resource(resource_config::standard_image_resource::select);
|
||||
m_save_btn.set_image_resource(resource_config::standard_image_resource::square);
|
||||
m_discard_btn.set_image_resource(resource_config::standard_image_resource::triangle);
|
||||
|
||||
m_reset_btn.set_pos((width - 120) / 2, height + 20);
|
||||
m_save_btn.set_pos(width - 2 * (30 + 120), height + 20);
|
||||
m_discard_btn.set_pos(width - (30 + 120), height + 20);
|
||||
|
||||
m_reset_btn.set_text(localized_string_id::HOME_MENU_SETTINGS_RESET_BUTTON);
|
||||
m_save_btn.set_text(localized_string_id::HOME_MENU_SETTINGS_SAVE_BUTTON);
|
||||
m_discard_btn.set_text(localized_string_id::HOME_MENU_SETTINGS_DISCARD_BUTTON);
|
||||
|
||||
m_reset_btn.set_font("Arial", 16);
|
||||
m_save_btn.set_font("Arial", 16);
|
||||
m_discard_btn.set_font("Arial", 16);
|
||||
|
||||
|
|
@ -152,6 +157,7 @@ namespace rsx
|
|||
case pad_button::ls_left:
|
||||
case pad_button::ls_right:
|
||||
case pad_button::cross:
|
||||
case pad_button::select:
|
||||
{
|
||||
if (const usz index = static_cast<usz>(get_selected_index()); index < m_callbacks.size())
|
||||
{
|
||||
|
|
@ -266,6 +272,7 @@ namespace rsx
|
|||
list_view::translate(_x, _y);
|
||||
m_save_btn.translate(_x, _y);
|
||||
m_discard_btn.translate(_x, _y);
|
||||
m_reset_btn.translate(_x, _y);
|
||||
}
|
||||
|
||||
compiled_resource& home_menu_page::get_compiled()
|
||||
|
|
@ -286,10 +293,18 @@ namespace rsx
|
|||
{
|
||||
compiled_resources.add(m_message_box->get_compiled());
|
||||
}
|
||||
else if (m_config_changed && *m_config_changed)
|
||||
else
|
||||
{
|
||||
compiled_resources.add(m_save_btn.get_compiled());
|
||||
compiled_resources.add(m_discard_btn.get_compiled());
|
||||
if (show_reset_button())
|
||||
{
|
||||
compiled_resources.add(m_reset_btn.get_compiled());
|
||||
}
|
||||
|
||||
if (m_config_changed && *m_config_changed)
|
||||
{
|
||||
compiled_resources.add(m_save_btn.get_compiled());
|
||||
compiled_resources.add(m_discard_btn.get_compiled());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ namespace rsx
|
|||
void translate(s16 _x, s16 _y) override;
|
||||
compiled_resource& get_compiled() override;
|
||||
|
||||
virtual bool show_reset_button() const { return false; }
|
||||
|
||||
bool is_current_page = false;
|
||||
home_menu_page* parent = nullptr;
|
||||
std::string title;
|
||||
|
|
@ -36,6 +38,7 @@ namespace rsx
|
|||
std::vector<std::shared_ptr<home_menu_page>> m_pages;
|
||||
|
||||
private:
|
||||
image_button m_reset_btn;
|
||||
image_button m_save_btn;
|
||||
image_button m_discard_btn;
|
||||
std::vector<std::unique_ptr<overlay_element>> m_entries;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ namespace rsx
|
|||
{
|
||||
using home_menu_page::home_menu_page;
|
||||
|
||||
bool show_reset_button() const override { return true; }
|
||||
|
||||
void add_checkbox(cfg::_bool* setting, localized_string_id loc_id)
|
||||
{
|
||||
ensure(setting && setting->get_is_dynamic());
|
||||
|
|
@ -30,16 +32,30 @@ namespace rsx
|
|||
|
||||
add_item(elem, [this, setting](pad_button btn) -> page_navigation
|
||||
{
|
||||
if (btn != pad_button::cross) return page_navigation::stay;
|
||||
|
||||
if (setting)
|
||||
{
|
||||
const bool value = !setting->get();
|
||||
rsx_log.notice("User toggled checkbox in '%s'. Setting '%s' to %d", title, setting->get_name(), value);
|
||||
setting->set(value);
|
||||
Emu.GetCallbacks().update_emu_settings();
|
||||
if (m_config_changed) *m_config_changed = true;
|
||||
refresh();
|
||||
bool value = setting->get();
|
||||
|
||||
switch (btn)
|
||||
{
|
||||
case pad_button::cross:
|
||||
value = !value;
|
||||
break;
|
||||
case pad_button::select:
|
||||
value = setting->def;
|
||||
break;
|
||||
default:
|
||||
return page_navigation::stay;
|
||||
}
|
||||
|
||||
if (value != setting->get())
|
||||
{
|
||||
rsx_log.notice("User toggled checkbox in '%s'. Setting '%s' to %d", title, setting->get_name(), value);
|
||||
setting->set(value);
|
||||
Emu.GetCallbacks().update_emu_settings();
|
||||
if (m_config_changed) *m_config_changed = true;
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
|
||||
return page_navigation::stay;
|
||||
|
|
@ -56,12 +72,33 @@ namespace rsx
|
|||
|
||||
add_item(elem, [this, setting](pad_button btn) -> page_navigation
|
||||
{
|
||||
if (btn != pad_button::cross) return page_navigation::stay;
|
||||
|
||||
if (setting)
|
||||
{
|
||||
bool set_default = false;
|
||||
switch (btn)
|
||||
{
|
||||
case pad_button::cross:
|
||||
break;
|
||||
case pad_button::select:
|
||||
set_default = true;
|
||||
break;
|
||||
default:
|
||||
return page_navigation::stay;
|
||||
}
|
||||
|
||||
T value = setting->get();
|
||||
|
||||
if (set_default)
|
||||
{
|
||||
if (value == setting->def)
|
||||
{
|
||||
return page_navigation::stay;
|
||||
}
|
||||
|
||||
value = setting->def;
|
||||
}
|
||||
|
||||
usz new_index = 0;
|
||||
const T value = setting->get();
|
||||
const std::string val = fmt::format("%s", value);
|
||||
const std::vector<std::string> list = setting->to_list();
|
||||
|
||||
|
|
@ -70,10 +107,17 @@ namespace rsx
|
|||
const std::string& entry = list[i];
|
||||
if (entry == val)
|
||||
{
|
||||
if (set_default)
|
||||
{
|
||||
new_index = i;
|
||||
break;
|
||||
}
|
||||
|
||||
new_index = (i + 1) % list.size();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (const std::string& next_value = ::at32(list, new_index); setting->from_string(next_value))
|
||||
{
|
||||
rsx_log.notice("User toggled dropdown in '%s'. Setting '%s' to %s", title, setting->get_name(), next_value);
|
||||
|
|
@ -114,6 +158,9 @@ namespace rsx
|
|||
case pad_button::ls_right:
|
||||
value = std::min(value + step_size, maximum);
|
||||
break;
|
||||
case pad_button::select:
|
||||
value = setting->def;
|
||||
break;
|
||||
default:
|
||||
return page_navigation::stay;
|
||||
}
|
||||
|
|
@ -164,6 +211,9 @@ namespace rsx
|
|||
}
|
||||
while (exceptions.contains(value));
|
||||
break;
|
||||
case pad_button::select:
|
||||
value = setting->def;
|
||||
break;
|
||||
default:
|
||||
return page_navigation::stay;
|
||||
}
|
||||
|
|
@ -205,6 +255,9 @@ namespace rsx
|
|||
case pad_button::ls_right:
|
||||
value = std::min(value + step_size, static_cast<f64>(maximum));
|
||||
break;
|
||||
case pad_button::select:
|
||||
value = setting->def;
|
||||
break;
|
||||
default:
|
||||
return page_navigation::stay;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -204,6 +204,7 @@ enum class localized_string_id
|
|||
HOME_MENU_SETTINGS_SAVE_BUTTON,
|
||||
HOME_MENU_SETTINGS_DISCARD,
|
||||
HOME_MENU_SETTINGS_DISCARD_BUTTON,
|
||||
HOME_MENU_SETTINGS_RESET_BUTTON,
|
||||
HOME_MENU_SETTINGS_AUDIO,
|
||||
HOME_MENU_SETTINGS_AUDIO_MASTER_VOLUME,
|
||||
HOME_MENU_SETTINGS_AUDIO_BACKEND,
|
||||
|
|
|
|||
|
|
@ -225,6 +225,7 @@ private:
|
|||
case localized_string_id::HOME_MENU_SETTINGS_SAVE_BUTTON: return tr("Save");
|
||||
case localized_string_id::HOME_MENU_SETTINGS_DISCARD: return tr("Discard the current settings' changes?");
|
||||
case localized_string_id::HOME_MENU_SETTINGS_DISCARD_BUTTON: return tr("Discard");
|
||||
case localized_string_id::HOME_MENU_SETTINGS_RESET_BUTTON: return tr("To default");
|
||||
case localized_string_id::HOME_MENU_SETTINGS_AUDIO: return tr("Audio");
|
||||
case localized_string_id::HOME_MENU_SETTINGS_AUDIO_MASTER_VOLUME: return tr("Master Volume", "Audio");
|
||||
case localized_string_id::HOME_MENU_SETTINGS_AUDIO_BACKEND: return tr("Audio Backend", "Audio");
|
||||
|
|
|
|||
Loading…
Reference in a new issue