From 72cd1466652cdb00d3fecdd6ac505af67010a5e4 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Wed, 14 Aug 2024 19:38:38 +0200 Subject: [PATCH] Qt: vfs tool dialog --- rpcs3/rpcs3.vcxproj | 28 ++++++++++ rpcs3/rpcs3.vcxproj.filters | 18 +++++++ rpcs3/rpcs3qt/CMakeLists.txt | 1 + rpcs3/rpcs3qt/main_window.cpp | 7 +++ rpcs3/rpcs3qt/main_window.ui | 6 +++ rpcs3/rpcs3qt/vfs_tool_dialog.cpp | 44 +++++++++++++++ rpcs3/rpcs3qt/vfs_tool_dialog.h | 23 ++++++++ rpcs3/rpcs3qt/vfs_tool_dialog.ui | 89 +++++++++++++++++++++++++++++++ 8 files changed, 216 insertions(+) create mode 100644 rpcs3/rpcs3qt/vfs_tool_dialog.cpp create mode 100644 rpcs3/rpcs3qt/vfs_tool_dialog.h create mode 100644 rpcs3/rpcs3qt/vfs_tool_dialog.ui diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index 2df8f7d822..4136187cb8 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -416,6 +416,9 @@ true + + true + true @@ -683,6 +686,9 @@ true + + true + true @@ -798,6 +804,7 @@ + @@ -1022,6 +1029,7 @@ + $(QTDIR)\bin\moc.exe;%(FullPath) @@ -1492,6 +1500,16 @@ .\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DWIN32_LEAN_AND_MEAN -DHAVE_VULKAN -DWITH_DISCORD_RPC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -DQT_WINEXTRAS_LIB -DQT_CONCURRENT_LIB -DQT_MULTIMEDIA_LIB -DQT_MULTIMEDIAWIDGETS_LIB -DQT_SVG_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\SoundTouch\soundtouch\include" "-I.\..\3rdparty\cubeb\extra" "-I.\..\3rdparty\cubeb\cubeb\include" "-I.\..\3rdparty\flatbuffers\include" "-I.\..\3rdparty\wolfssl\wolfssl" "-I.\..\3rdparty\curl\curl\include" "-I.\..\3rdparty\libusb\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtCore" "-I.\release" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtMultimedia" "-I$(QTDIR)\include\QtMultimediaWidgets" "-I$(QTDIR)\include\QtSvg" + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DWIN32_LEAN_AND_MEAN -DHAVE_VULKAN -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_WINEXTRAS_LIB -DQT_CONCURRENT_LIB -DQT_MULTIMEDIA_LIB -DQT_MULTIMEDIAWIDGETS_LIB -DQT_SVG_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\SoundTouch\soundtouch\include" "-I.\..\3rdparty\cubeb\extra" "-I.\..\3rdparty\cubeb\cubeb\include" "-I.\..\3rdparty\flatbuffers\include" "-I.\..\3rdparty\wolfssl\wolfssl" "-I.\..\3rdparty\curl\curl\include" "-I.\..\3rdparty\libusb\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtCore" "-I.\debug" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtMultimedia" "-I$(QTDIR)\include\QtMultimediaWidgets" "-I$(QTDIR)\include\QtSvg" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DWIN32_LEAN_AND_MEAN -DHAVE_VULKAN -DWITH_DISCORD_RPC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -DQT_WINEXTRAS_LIB -DQT_CONCURRENT_LIB -DQT_MULTIMEDIA_LIB -DQT_MULTIMEDIAWIDGETS_LIB -DQT_SVG_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\SoundTouch\soundtouch\include" "-I.\..\3rdparty\cubeb\extra" "-I.\..\3rdparty\cubeb\cubeb\include" "-I.\..\3rdparty\flatbuffers\include" "-I.\..\3rdparty\wolfssl\wolfssl" "-I.\..\3rdparty\curl\curl\include" "-I.\..\3rdparty\libusb\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtCore" "-I.\release" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtMultimedia" "-I$(QTDIR)\include\QtMultimediaWidgets" "-I$(QTDIR)\include\QtSvg" + $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing %(Identity)... @@ -1963,6 +1981,16 @@ .\QTGeneratedFiles\ui_%(Filename).h;%(Outputs) "$(QTDIR)\bin\uic.exe" -o ".\QTGeneratedFiles\ui_%(Filename).h" "%(FullPath)" + + $(QTDIR)\bin\uic.exe;%(AdditionalInputs) + Uic%27ing %(Identity)... + .\QTGeneratedFiles\ui_%(Filename).h;%(Outputs) + "$(QTDIR)\bin\uic.exe" -o ".\QTGeneratedFiles\ui_%(Filename).h" "%(FullPath)" + $(QTDIR)\bin\uic.exe;%(AdditionalInputs) + Uic%27ing %(Identity)... + .\QTGeneratedFiles\ui_%(Filename).h;%(Outputs) + "$(QTDIR)\bin\uic.exe" -o ".\QTGeneratedFiles\ui_%(Filename).h" "%(FullPath)" + diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index b426e00787..00982214ba 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -972,6 +972,12 @@ Generated Files\Release + + Generated Files\Debug + + + Generated Files\Release + Gui\progress @@ -1101,6 +1107,9 @@ rpcs3 + + Gui\vfs + @@ -1259,6 +1268,9 @@ Generated Files + + Generated Files + Gui\progress @@ -1561,6 +1573,9 @@ Form Files + + Form Files + Gui\dev tools @@ -1600,6 +1615,9 @@ Gui\settings + + Gui\vfs + diff --git a/rpcs3/rpcs3qt/CMakeLists.txt b/rpcs3/rpcs3qt/CMakeLists.txt index ea23b2b3a2..291b31b1f3 100644 --- a/rpcs3/rpcs3qt/CMakeLists.txt +++ b/rpcs3/rpcs3qt/CMakeLists.txt @@ -106,6 +106,7 @@ add_library(rpcs3_ui STATIC vfs_dialog_tab.cpp vfs_dialog_usb_input.cpp vfs_dialog_usb_tab.cpp + vfs_tool_dialog.cpp welcome_dialog.cpp about_dialog.ui diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index bcb12faf79..d69aa8abcd 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -38,6 +38,7 @@ #include "emulated_pad_settings_dialog.h" #include "basic_mouse_settings_dialog.h" #include "raw_mouse_settings_dialog.h" +#include "vfs_tool_dialog.h" #include "welcome_dialog.h" #include @@ -3017,6 +3018,12 @@ void main_window::CreateConnects() connect(ui->toolsExtractTARAct, &QAction::triggered, this, &main_window::ExtractTar); + connect(ui->toolsVfsDialogAct, &QAction::triggered, this, [this]() + { + vfs_tool_dialog* dlg = new vfs_tool_dialog(this); + dlg->show(); + }); + connect(ui->showDebuggerAct, &QAction::triggered, this, [this](bool checked) { checked ? m_debugger_frame->show() : m_debugger_frame->hide(); diff --git a/rpcs3/rpcs3qt/main_window.ui b/rpcs3/rpcs3qt/main_window.ui index c3ad462c49..739e2e87a8 100644 --- a/rpcs3/rpcs3qt/main_window.ui +++ b/rpcs3/rpcs3qt/main_window.ui @@ -301,6 +301,7 @@ + @@ -1366,6 +1367,11 @@ Raw Mouse + + + VFS Tool + + diff --git a/rpcs3/rpcs3qt/vfs_tool_dialog.cpp b/rpcs3/rpcs3qt/vfs_tool_dialog.cpp new file mode 100644 index 0000000000..91d01b5684 --- /dev/null +++ b/rpcs3/rpcs3qt/vfs_tool_dialog.cpp @@ -0,0 +1,44 @@ +#include "stdafx.h" +#include "vfs_tool_dialog.h" +#include "ui_vfs_tool_dialog.h" +#include "Emu/VFS.h" + +vfs_tool_dialog::vfs_tool_dialog(QWidget *parent) + : QDialog(parent) + , ui(new Ui::vfs_tool_dialog) +{ + setAttribute(Qt::WA_DeleteOnClose); + + ui->setupUi(this); + + connect(ui->pathEdit, &QLineEdit::textChanged, this, &vfs_tool_dialog::handle_vfs_path); + + handle_vfs_path(""); +} + +vfs_tool_dialog::~vfs_tool_dialog() +{ +} + +void vfs_tool_dialog::handle_vfs_path(const QString& path) +{ + const std::string spath = path.toStdString(); + const std::string vfs_get_path = vfs::get(spath); + const std::string vfs_retrieve_path = vfs::retrieve(spath); + const std::string vfs_escape_path = vfs::escape(spath); + const std::string vfs_unescape_path = vfs::unescape(spath); + const std::string result = fmt::format( + "Path:\n'%s'\n\n" + "vfs::get:\n'%s'\n\n" + "vfs::retrieve:\n'%s'\n\n" + "vfs::escape:\n'%s'\n\n" + "vfs::unescape:\n'%s'", + spath, + vfs_get_path, + vfs_retrieve_path, + vfs_escape_path, + vfs_unescape_path + ); + + ui->resultEdit->setPlainText(QString::fromStdString(result)); +} diff --git a/rpcs3/rpcs3qt/vfs_tool_dialog.h b/rpcs3/rpcs3qt/vfs_tool_dialog.h new file mode 100644 index 0000000000..3fd9667fe5 --- /dev/null +++ b/rpcs3/rpcs3qt/vfs_tool_dialog.h @@ -0,0 +1,23 @@ +#pragma once + +#include + +namespace Ui +{ + class vfs_tool_dialog; +} + +class vfs_tool_dialog : public QDialog +{ + Q_OBJECT + +public: + vfs_tool_dialog(QWidget *parent); + virtual ~vfs_tool_dialog(); + +private: + std::unique_ptr ui; + +private Q_SLOTS: + void handle_vfs_path(const QString& path); +}; diff --git a/rpcs3/rpcs3qt/vfs_tool_dialog.ui b/rpcs3/rpcs3qt/vfs_tool_dialog.ui new file mode 100644 index 0000000000..d0b6d4902b --- /dev/null +++ b/rpcs3/rpcs3qt/vfs_tool_dialog.ui @@ -0,0 +1,89 @@ + + + vfs_tool_dialog + + + + 0 + 0 + 400 + 500 + + + + VFS Tool + + + + + + Path + + + + + + true + + + + + + + + + + Result + + + + + + false + + + false + + + true + + + + + + + + + + 6 + + + 0 + + + + + Qt::Horizontal + + + + 131 + 31 + + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + +