cellSaveData: improve logging for overlays

This commit is contained in:
Megamouse 2024-09-20 15:17:47 +02:00
parent d0a13c1a5a
commit d88b7f6fde
3 changed files with 19 additions and 6 deletions

View File

@ -199,6 +199,8 @@ namespace rsx
s32 save_dialog::show(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);
visible = false;
if (enable_overlay)

View File

@ -15,6 +15,8 @@ LOG_CHANNEL(cellSaveData);
s32 save_data_dialog::ShowSaveDataList(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);
// TODO: Implement proper error checking in savedata_op?
const bool use_end = sysutil_send_system_cmd(CELL_SYSUTIL_DRAWING_BEGIN, 0) >= 0;
@ -26,21 +28,28 @@ s32 save_data_dialog::ShowSaveDataList(std::vector<SaveDataEntry>& save_entries,
// TODO: Install native shell as an Emu callback
if (auto manager = g_fxo->try_get<rsx::overlays::display_manager>())
{
cellSaveData.notice("ShowSaveDataList: Showing native UI dialog");
const s32 result = manager->create<rsx::overlays::save_dialog>()->show(save_entries, focused, op, listSet, enable_overlay);
if (result != rsx::overlays::user_interface::selection_code::error)
{
cellSaveData.notice("ShowSaveDataList: Native UI dialog returned with selection %d", result);
if (use_end) sysutil_send_system_cmd(CELL_SYSUTIL_DRAWING_END, 0);
return result;
}
cellSaveData.error("ShowSaveDataList: Native UI dialog returned error");
}
if (!Emu.HasGui())
{
cellSaveData.notice("ShowSaveDataList(): Aborting: Emulation has no GUI attached");
if (use_end) sysutil_send_system_cmd(CELL_SYSUTIL_DRAWING_END, 0);
return -2;
}
// Fall back to front-end GUI
cellSaveData.notice("ShowSaveDataList(): Using fallback GUI");
atomic_t<s32> selection = 0;
input::SetIntercepted(true);

View File

@ -10,7 +10,7 @@
#include <QScreen>
#include <QMouseEvent>
constexpr auto qstr = QString::fromStdString;
LOG_CHANNEL(cellSaveData);
//Show up the savedata list, either to choose one to save/load or to manage saves.
//I suggest to use function callbacks to give save data list or get save data entry. (Not implemented or stubbed)
@ -18,6 +18,8 @@ save_data_list_dialog::save_data_list_dialog(const std::vector<SaveDataEntry>& e
: QDialog(parent)
, m_save_entries(entries)
{
cellSaveData.notice("Creating Qt save_data_list_dialog (entries=%d, focusedEntry=%d, op=0x%x, listSet=*0x%x)", entries.size(), focusedEntry, op, listSet);
if (op >= 8)
{
setWindowTitle(tr("Save Data Interface (Delete)"));
@ -107,7 +109,7 @@ save_data_list_dialog::save_data_list_dialog(const std::vector<SaveDataEntry>& e
{
const int original_index = m_list->item(row, 0)->data(Qt::UserRole).toInt();
const SaveDataEntry original_entry = m_save_entries[original_index];
const QString original_dir_name = qstr(original_entry.dirName);
const QString original_dir_name = QString::fromStdString(original_entry.dirName);
QVariantMap notes = m_persistent_settings->GetValue(gui::persistent::save_notes).toMap();
notes[original_dir_name] = m_list->item(row, col)->text();
m_persistent_settings->SetValue(gui::persistent::save_notes, notes);
@ -127,7 +129,7 @@ void save_data_list_dialog::UpdateSelectionLabel()
else
{
const int entry = m_list->item(m_list->currentRow(), 0)->data(Qt::UserRole).toInt();
m_entry_label->setText(tr("Currently Selected: ") + qstr(m_save_entries[entry].dirName));
m_entry_label->setText(tr("Currently Selected: ") + QString::fromStdString(m_save_entries[entry].dirName));
}
}
}
@ -186,9 +188,9 @@ void save_data_list_dialog::UpdateList()
int row = 0;
for (const SaveDataEntry& entry: m_save_entries)
{
QString title = qstr(entry.title);
QString subtitle = qstr(entry.subtitle);
QString dirName = qstr(entry.dirName);
const QString title = QString::fromStdString(entry.title);
const QString subtitle = QString::fromStdString(entry.subtitle);
const QString dirName = QString::fromStdString(entry.dirName);
QTableWidgetItem* titleItem = new QTableWidgetItem(title);
titleItem->setData(Qt::UserRole, row); // For sorting to work properly