mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-28 13:28:01 +03:00
overlays: play ICON1.PAM in save data list if possible
This commit is contained in:
parent
40e8bc530c
commit
e816636676
8 changed files with 33 additions and 31 deletions
|
@ -307,7 +307,7 @@ static error_code select_and_delete(ppu_thread& ppu)
|
||||||
// Display a blocking Save Data List asynchronously in the GUI thread.
|
// Display a blocking Save Data List asynchronously in the GUI thread.
|
||||||
if (auto save_dialog = Emu.GetCallbacks().get_save_dialog())
|
if (auto save_dialog = Emu.GetCallbacks().get_save_dialog())
|
||||||
{
|
{
|
||||||
selected = save_dialog->ShowSaveDataList(save_entries, focused, SAVEDATA_OP_LIST_DELETE, vm::null, g_fxo->get<savedata_manager>().enable_overlay);
|
selected = save_dialog->ShowSaveDataList(base_dir, save_entries, focused, SAVEDATA_OP_LIST_DELETE, vm::null, g_fxo->get<savedata_manager>().enable_overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reschedule after a blocking dialog returns
|
// Reschedule after a blocking dialog returns
|
||||||
|
@ -1183,7 +1183,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||||
// Display a blocking Save Data List asynchronously in the GUI thread.
|
// Display a blocking Save Data List asynchronously in the GUI thread.
|
||||||
if (auto save_dialog = Emu.GetCallbacks().get_save_dialog())
|
if (auto save_dialog = Emu.GetCallbacks().get_save_dialog())
|
||||||
{
|
{
|
||||||
selected = save_dialog->ShowSaveDataList(save_entries, focused, operation, listSet, g_fxo->get<savedata_manager>().enable_overlay);
|
selected = save_dialog->ShowSaveDataList(base_dir, save_entries, focused, operation, listSet, g_fxo->get<savedata_manager>().enable_overlay);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -361,5 +361,5 @@ class SaveDialogBase
|
||||||
public:
|
public:
|
||||||
virtual ~SaveDialogBase();
|
virtual ~SaveDialogBase();
|
||||||
|
|
||||||
virtual s32 ShowSaveDataList(std::vector<SaveDataEntry>& save_entries, s32 focused, u32 op, vm::ptr<CellSaveDataListSet> listSet, bool enable_overlay) = 0;
|
virtual s32 ShowSaveDataList(const std::string& base_dir, std::vector<SaveDataEntry>& save_entries, s32 focused, u32 op, vm::ptr<CellSaveDataListSet> listSet, bool enable_overlay) = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "overlay_save_dialog.h"
|
#include "overlay_save_dialog.h"
|
||||||
|
#include "overlay_video.h"
|
||||||
#include "Utilities/date_time.h"
|
#include "Utilities/date_time.h"
|
||||||
#include "Emu/System.h"
|
#include "Emu/System.h"
|
||||||
|
|
||||||
|
@ -7,26 +8,18 @@ namespace rsx
|
||||||
{
|
{
|
||||||
namespace overlays
|
namespace overlays
|
||||||
{
|
{
|
||||||
save_dialog::save_dialog_entry::save_dialog_entry(const std::string& text1, const std::string& text2, const std::string& text3, u8 resource_id, const std::vector<u8>& icon_buf)
|
save_dialog::save_dialog_entry::save_dialog_entry(const std::string& text1, const std::string& text2, const std::string& text3, u8 resource_id, const std::vector<u8>& icon_buf, const std::string& video_path)
|
||||||
{
|
{
|
||||||
std::unique_ptr<overlay_element> image = std::make_unique<image_view>();
|
std::unique_ptr<overlay_element> image = resource_id != image_resource_id::raw_image
|
||||||
|
? std::make_unique<video_view>(video_path, resource_id)
|
||||||
|
: !icon_buf.empty() ? std::make_unique<video_view>(video_path, icon_buf)
|
||||||
|
: std::make_unique<video_view>(video_path, resource_config::standard_image_resource::save); // Fallback
|
||||||
image->set_size(160, 110);
|
image->set_size(160, 110);
|
||||||
image->set_padding(36, 36, 11, 11); // Square image, 88x88
|
image->set_padding(36, 36, 11, 11); // Square image, 88x88
|
||||||
|
|
||||||
if (resource_id != image_resource_id::raw_image)
|
if (resource_id == image_resource_id::raw_image && !icon_buf.empty())
|
||||||
{
|
|
||||||
static_cast<image_view*>(image.get())->set_image_resource(resource_id);
|
|
||||||
}
|
|
||||||
else if (!icon_buf.empty())
|
|
||||||
{
|
{
|
||||||
image->set_padding(0, 0, 11, 11); // Half sized icon, 320x176->160x88
|
image->set_padding(0, 0, 11, 11); // Half sized icon, 320x176->160x88
|
||||||
icon_data = std::make_unique<image_info>(icon_buf);
|
|
||||||
static_cast<image_view*>(image.get())->set_raw_image(icon_data.get());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Fallback
|
|
||||||
static_cast<image_view*>(image.get())->set_image_resource(resource_config::standard_image_resource::save);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<overlay_element> text_stack = std::make_unique<vertical_layout>();
|
std::unique_ptr<overlay_element> text_stack = std::make_unique<vertical_layout>();
|
||||||
|
@ -74,10 +67,18 @@ namespace rsx
|
||||||
|
|
||||||
// Pack
|
// Pack
|
||||||
this->pack_padding = 15;
|
this->pack_padding = 15;
|
||||||
add_element(image);
|
m_image = add_element(image);
|
||||||
add_element(text_stack);
|
add_element(text_stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save_dialog::save_dialog_entry::set_selected(bool selected)
|
||||||
|
{
|
||||||
|
if (m_image)
|
||||||
|
{
|
||||||
|
static_cast<video_view*>(m_image)->set_active(selected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
save_dialog::save_dialog()
|
save_dialog::save_dialog()
|
||||||
{
|
{
|
||||||
m_dim_background = std::make_unique<overlay_element>();
|
m_dim_background = std::make_unique<overlay_element>();
|
||||||
|
@ -197,7 +198,7 @@ namespace rsx
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 save_dialog::show(std::vector<SaveDataEntry>& save_entries, u32 focused, u32 op, vm::ptr<CellSaveDataListSet> listSet, bool enable_overlay)
|
s32 save_dialog::show(const std::string& base_dir, std::vector<SaveDataEntry>& save_entries, u32 focused, u32 op, vm::ptr<CellSaveDataListSet> listSet, bool enable_overlay)
|
||||||
{
|
{
|
||||||
rsx_log.notice("Showing native UI save_dialog (save_entries=%d, focused=%d, op=0x%x, listSet=*0x%x, enable_overlay=%d)", save_entries.size(), focused, op, listSet, enable_overlay);
|
rsx_log.notice("Showing native UI save_dialog (save_entries=%d, focused=%d, op=0x%x, listSet=*0x%x, enable_overlay=%d)", save_entries.size(), focused, op, listSet, enable_overlay);
|
||||||
|
|
||||||
|
@ -218,7 +219,7 @@ namespace rsx
|
||||||
{
|
{
|
||||||
const std::string date_and_size = fmt::format("%s %s", entry.date(), entry.data_size());
|
const std::string date_and_size = fmt::format("%s %s", entry.date(), entry.data_size());
|
||||||
std::unique_ptr<overlay_element> e;
|
std::unique_ptr<overlay_element> e;
|
||||||
e = std::make_unique<save_dialog_entry>(entry.subtitle, date_and_size, entry.details, image_resource_id::raw_image, entry.iconBuf);
|
e = std::make_unique<save_dialog_entry>(entry.subtitle, date_and_size, entry.details, image_resource_id::raw_image, entry.iconBuf, base_dir + entry.dirName + "/ICON1.PAM");
|
||||||
entries.emplace_back(std::move(e));
|
entries.emplace_back(std::move(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +271,7 @@ namespace rsx
|
||||||
id = image_resource_id::raw_image;
|
id = image_resource_id::raw_image;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<overlay_element> new_stub = std::make_unique<save_dialog_entry>(title, get_localized_string(localized_string_id::CELL_SAVEDATA_NEW_SAVED_DATA_SUB_TITLE), "", id, icon);
|
std::unique_ptr<overlay_element> new_stub = std::make_unique<save_dialog_entry>(title, get_localized_string(localized_string_id::CELL_SAVEDATA_NEW_SAVED_DATA_SUB_TITLE), "", id, icon, "");
|
||||||
|
|
||||||
m_list->add_entry(new_stub);
|
m_list->add_entry(new_stub);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,11 +13,12 @@ namespace rsx
|
||||||
private:
|
private:
|
||||||
struct save_dialog_entry : horizontal_layout
|
struct save_dialog_entry : horizontal_layout
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
std::unique_ptr<image_info> icon_data;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
save_dialog_entry(const std::string& text1, const std::string& text2, const std::string& text3, u8 resource_id, const std::vector<u8>& icon_buf);
|
save_dialog_entry(const std::string& text1, const std::string& text2, const std::string& text3, u8 resource_id, const std::vector<u8>& icon_buf, const std::string& video_path);
|
||||||
|
void set_selected(bool selected) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
overlay_element* m_image = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<overlay_element> m_dim_background;
|
std::unique_ptr<overlay_element> m_dim_background;
|
||||||
|
@ -38,7 +39,7 @@ namespace rsx
|
||||||
|
|
||||||
compiled_resource get_compiled() override;
|
compiled_resource get_compiled() override;
|
||||||
|
|
||||||
s32 show(std::vector<SaveDataEntry>& save_entries, u32 focused, u32 op, vm::ptr<CellSaveDataListSet> listSet, bool enable_overlay);
|
s32 show(const std::string& base_dir, std::vector<SaveDataEntry>& save_entries, u32 focused, u32 op, vm::ptr<CellSaveDataListSet> listSet, bool enable_overlay);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
LOG_CHANNEL(cellSaveData);
|
LOG_CHANNEL(cellSaveData);
|
||||||
|
|
||||||
s32 save_data_dialog::ShowSaveDataList(std::vector<SaveDataEntry>& save_entries, s32 focused, u32 op, vm::ptr<CellSaveDataListSet> listSet, bool enable_overlay)
|
s32 save_data_dialog::ShowSaveDataList(const std::string& base_dir, std::vector<SaveDataEntry>& save_entries, s32 focused, u32 op, vm::ptr<CellSaveDataListSet> listSet, bool enable_overlay)
|
||||||
{
|
{
|
||||||
cellSaveData.notice("ShowSaveDataList(save_entries=%d, focused=%d, op=0x%x, listSet=*0x%x, enable_overlay=%d)", save_entries.size(), focused, op, listSet, enable_overlay);
|
cellSaveData.notice("ShowSaveDataList(save_entries=%d, focused=%d, op=0x%x, listSet=*0x%x, enable_overlay=%d)", save_entries.size(), focused, op, listSet, enable_overlay);
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ s32 save_data_dialog::ShowSaveDataList(std::vector<SaveDataEntry>& save_entries,
|
||||||
{
|
{
|
||||||
cellSaveData.notice("ShowSaveDataList: Showing native UI dialog");
|
cellSaveData.notice("ShowSaveDataList: Showing native UI dialog");
|
||||||
|
|
||||||
const s32 result = manager->create<rsx::overlays::save_dialog>()->show(save_entries, focused, op, listSet, enable_overlay);
|
const s32 result = manager->create<rsx::overlays::save_dialog>()->show(base_dir, save_entries, focused, op, listSet, enable_overlay);
|
||||||
if (result != rsx::overlays::user_interface::selection_code::error)
|
if (result != rsx::overlays::user_interface::selection_code::error)
|
||||||
{
|
{
|
||||||
cellSaveData.notice("ShowSaveDataList: Native UI dialog returned with selection %d", result);
|
cellSaveData.notice("ShowSaveDataList: Native UI dialog returned with selection %d", result);
|
||||||
|
|
|
@ -6,5 +6,5 @@
|
||||||
class save_data_dialog : public SaveDialogBase
|
class save_data_dialog : public SaveDialogBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
s32 ShowSaveDataList(std::vector<SaveDataEntry>& save_entries, s32 focused, u32 op, vm::ptr<CellSaveDataListSet> listSet, bool enable_overlay) override;
|
s32 ShowSaveDataList(const std::string& base_dir, std::vector<SaveDataEntry>& save_entries, s32 focused, u32 op, vm::ptr<CellSaveDataListSet> listSet, bool enable_overlay) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -585,7 +585,7 @@ void save_manager_dialog::OnEntriesRemove()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pop-up a small context-menu, being a replacement for save_data_manage_dialog
|
// Pop-up a small context-menu, being a replacement for save_data_manage_dialog
|
||||||
void save_manager_dialog::ShowContextMenu(const QPoint &pos)
|
void save_manager_dialog::ShowContextMenu(const QPoint& pos)
|
||||||
{
|
{
|
||||||
const int idx = m_list->currentRow();
|
const int idx = m_list->currentRow();
|
||||||
if (idx == -1)
|
if (idx == -1)
|
||||||
|
|
|
@ -42,7 +42,7 @@ private:
|
||||||
void Init();
|
void Init();
|
||||||
void UpdateList();
|
void UpdateList();
|
||||||
void UpdateIcons();
|
void UpdateIcons();
|
||||||
void ShowContextMenu(const QPoint &pos);
|
void ShowContextMenu(const QPoint& pos);
|
||||||
void WaitForRepaintThreads(bool abort);
|
void WaitForRepaintThreads(bool abort);
|
||||||
|
|
||||||
void closeEvent(QCloseEvent* event) override;
|
void closeEvent(QCloseEvent* event) override;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue