From f69e252c7a0d8f142c3ef436513f146bad36f71a Mon Sep 17 00:00:00 2001 From: Megamouse Date: Thu, 20 Jul 2017 10:24:16 +0200 Subject: [PATCH] cg_disasm: fixerinno --- rpcs3/rpcs3qt/cg_disasm_window.cpp | 31 ++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/rpcs3/rpcs3qt/cg_disasm_window.cpp b/rpcs3/rpcs3qt/cg_disasm_window.cpp index 81f0ffd4a0..adf2f5f5df 100644 --- a/rpcs3/rpcs3qt/cg_disasm_window.cpp +++ b/rpcs3/rpcs3qt/cg_disasm_window.cpp @@ -71,7 +71,7 @@ void cg_disasm_window::ShowContextMenu(const QPoint &pos) connect(open, &QAction::triggered, [=] { QString filePath = QFileDialog::getOpenFileName(this, tr("Select Cg program object"), m_path_last, tr("Cg program objects (*.fpo;*.vpo);;")); if (filePath == NULL) return; - m_path_last = QFileInfo(filePath).path(); + m_path_last = filePath; ShowDisasm(); }); @@ -81,6 +81,8 @@ void cg_disasm_window::ShowContextMenu(const QPoint &pos) void cg_disasm_window::ShowDisasm() { + xgui_settings->SetValue(GUI::fd_cg_disasm, m_path_last); + if (QFileInfo(m_path_last).isFile()) { CgBinaryDisasm disasm(sstr(m_path_last)); @@ -96,21 +98,22 @@ void cg_disasm_window::ShowDisasm() bool cg_disasm_window::IsValidFile(const QMimeData& md, bool save) { - for (auto url : md.urls()) - { - for (QString suff : {"fpo", "vpo"}) - { - if (QFileInfo(url.fileName()).suffix().toLower() == suff) - { - if (save) - { - m_path_last = url.toLocalFile(); - xgui_settings->SetValue(GUI::fd_cg_disasm, m_path_last); - } + const QList urls = md.urls(); - return true; - } + if (urls.count() > 1) + { + return false; + } + + const QString suff = QFileInfo(urls[0].fileName()).suffix().toLower(); + + if (suff == "fpo" || suff == "vpo") + { + if (save) + { + m_path_last = urls[0].toLocalFile(); } + return true; } return false; }