mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
Fix crash on VFS Tool (#16146)
This commit is contained in:
parent
37d2317b68
commit
3f66297593
@ -43,7 +43,7 @@ bool vfs::mount(std::string_view vpath, std::string_view path, bool is_dir)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Workaround
|
// Initialize vfs_manager if not yet initialized (e.g. g_fxo->reset() was previously invoked)
|
||||||
g_fxo->need<vfs_manager>();
|
g_fxo->need<vfs_manager>();
|
||||||
|
|
||||||
auto& table = g_fxo->get<vfs_manager>();
|
auto& table = g_fxo->get<vfs_manager>();
|
||||||
@ -196,6 +196,13 @@ bool vfs::unmount(std::string_view vpath)
|
|||||||
|
|
||||||
std::string vfs::get(std::string_view vpath, std::vector<std::string>* out_dir, std::string* out_path)
|
std::string vfs::get(std::string_view vpath, std::vector<std::string>* out_dir, std::string* out_path)
|
||||||
{
|
{
|
||||||
|
// Just to make the code more robust.
|
||||||
|
// It should never happen because we take care to initialize Emu (and so also vfs_manager) with Emu.Init() before this function is invoked
|
||||||
|
if (!g_fxo->is_init<vfs_manager>())
|
||||||
|
{
|
||||||
|
fmt::throw_exception("vfs_manager not initialized");
|
||||||
|
}
|
||||||
|
|
||||||
auto& table = g_fxo->get<vfs_manager>();
|
auto& table = g_fxo->get<vfs_manager>();
|
||||||
|
|
||||||
reader_lock lock(table.mutex);
|
reader_lock lock(table.mutex);
|
||||||
@ -372,6 +379,13 @@ using char2 = char8_t;
|
|||||||
|
|
||||||
std::string vfs::retrieve(std::string_view path, const vfs_directory* node, std::vector<std::string_view>* mount_path)
|
std::string vfs::retrieve(std::string_view path, const vfs_directory* node, std::vector<std::string_view>* mount_path)
|
||||||
{
|
{
|
||||||
|
// Just to make the code more robust.
|
||||||
|
// It should never happen because we take care to initialize Emu (and so also vfs_manager) with Emu.Init() before this function is invoked
|
||||||
|
if (!g_fxo->is_init<vfs_manager>())
|
||||||
|
{
|
||||||
|
fmt::throw_exception("vfs_manager not initialized");
|
||||||
|
}
|
||||||
|
|
||||||
auto& table = g_fxo->get<vfs_manager>();
|
auto& table = g_fxo->get<vfs_manager>();
|
||||||
|
|
||||||
if (!node)
|
if (!node)
|
||||||
|
@ -1986,7 +1986,7 @@ void main_window::OnEmuStop()
|
|||||||
ui->removeHDD1CachesAct->setEnabled(true);
|
ui->removeHDD1CachesAct->setEnabled(true);
|
||||||
ui->removeAllCachesAct->setEnabled(true);
|
ui->removeAllCachesAct->setEnabled(true);
|
||||||
ui->removeSavestatesAct->setEnabled(true);
|
ui->removeSavestatesAct->setEnabled(true);
|
||||||
ui->cleanupGameListAct->setEnabled(true);
|
ui->cleanUpGameListAct->setEnabled(true);
|
||||||
|
|
||||||
ui->actionManage_Users->setEnabled(true);
|
ui->actionManage_Users->setEnabled(true);
|
||||||
ui->confCamerasAct->setEnabled(true);
|
ui->confCamerasAct->setEnabled(true);
|
||||||
@ -2039,7 +2039,7 @@ void main_window::OnEmuReady() const
|
|||||||
ui->removeHDD1CachesAct->setEnabled(false);
|
ui->removeHDD1CachesAct->setEnabled(false);
|
||||||
ui->removeAllCachesAct->setEnabled(false);
|
ui->removeAllCachesAct->setEnabled(false);
|
||||||
ui->removeSavestatesAct->setEnabled(false);
|
ui->removeSavestatesAct->setEnabled(false);
|
||||||
ui->cleanupGameListAct->setEnabled(false);
|
ui->cleanUpGameListAct->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void main_window::EnableMenus(bool enabled) const
|
void main_window::EnableMenus(bool enabled) const
|
||||||
@ -2694,7 +2694,7 @@ void main_window::CreateConnects()
|
|||||||
connect(ui->removeHDD1CachesAct, &QAction::triggered, this, &main_window::RemoveHDD1Caches);
|
connect(ui->removeHDD1CachesAct, &QAction::triggered, this, &main_window::RemoveHDD1Caches);
|
||||||
connect(ui->removeAllCachesAct, &QAction::triggered, this, &main_window::RemoveAllCaches);
|
connect(ui->removeAllCachesAct, &QAction::triggered, this, &main_window::RemoveAllCaches);
|
||||||
connect(ui->removeSavestatesAct, &QAction::triggered, this, &main_window::RemoveSavestates);
|
connect(ui->removeSavestatesAct, &QAction::triggered, this, &main_window::RemoveSavestates);
|
||||||
connect(ui->cleanupGameListAct, &QAction::triggered, this, &main_window::CleanupGameList);
|
connect(ui->cleanUpGameListAct, &QAction::triggered, this, &main_window::CleanUpGameList);
|
||||||
|
|
||||||
connect(ui->removeFirmwareCacheAct, &QAction::triggered, this, &main_window::RemoveFirmwareCache);
|
connect(ui->removeFirmwareCacheAct, &QAction::triggered, this, &main_window::RemoveFirmwareCache);
|
||||||
connect(ui->createFirmwareCacheAct, &QAction::triggered, this, &main_window::CreateFirmwareCache);
|
connect(ui->createFirmwareCacheAct, &QAction::triggered, this, &main_window::CreateFirmwareCache);
|
||||||
@ -3604,7 +3604,7 @@ void main_window::RemoveSavestates()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void main_window::CleanupGameList()
|
void main_window::CleanUpGameList()
|
||||||
{
|
{
|
||||||
if (QMessageBox::question(this, tr("Confirm Removal"), tr("Remove invalid game paths from game list?\n"
|
if (QMessageBox::question(this, tr("Confirm Removal"), tr("Remove invalid game paths from game list?\n"
|
||||||
"Undetectable games (zombies) as well as corrupted games will be removed from the game list file (games.yml)")) != QMessageBox::Yes)
|
"Undetectable games (zombies) as well as corrupted games will be removed from the game list file (games.yml)")) != QMessageBox::Yes)
|
||||||
|
@ -132,7 +132,7 @@ private Q_SLOTS:
|
|||||||
void RemoveHDD1Caches();
|
void RemoveHDD1Caches();
|
||||||
void RemoveAllCaches();
|
void RemoveAllCaches();
|
||||||
void RemoveSavestates();
|
void RemoveSavestates();
|
||||||
void CleanupGameList();
|
void CleanUpGameList();
|
||||||
|
|
||||||
void RemoveFirmwareCache();
|
void RemoveFirmwareCache();
|
||||||
void CreateFirmwareCache();
|
void CreateFirmwareCache();
|
||||||
|
@ -193,7 +193,7 @@
|
|||||||
<addaction name="removeAllCachesAct"/>
|
<addaction name="removeAllCachesAct"/>
|
||||||
<addaction name="removeSavestatesAct"/>
|
<addaction name="removeSavestatesAct"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="cleanupGameListAct"/>
|
<addaction name="cleanUpGameListAct"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuFirmware">
|
<widget class="QMenu" name="menuFirmware">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -1166,7 +1166,7 @@
|
|||||||
<string>Remove Savestates</string>
|
<string>Remove Savestates</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="cleanupGameListAct">
|
<action name="cleanUpGameListAct">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Clean up Game List</string>
|
<string>Clean up Game List</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "vfs_tool_dialog.h"
|
#include "vfs_tool_dialog.h"
|
||||||
#include "ui_vfs_tool_dialog.h"
|
#include "ui_vfs_tool_dialog.h"
|
||||||
#include "Emu/VFS.h"
|
#include "Emu/VFS.h"
|
||||||
|
#include "Emu/System.h"
|
||||||
|
|
||||||
vfs_tool_dialog::vfs_tool_dialog(QWidget *parent)
|
vfs_tool_dialog::vfs_tool_dialog(QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
@ -22,6 +23,12 @@ vfs_tool_dialog::~vfs_tool_dialog()
|
|||||||
|
|
||||||
void vfs_tool_dialog::handle_vfs_path(const QString& path)
|
void vfs_tool_dialog::handle_vfs_path(const QString& path)
|
||||||
{
|
{
|
||||||
|
// Initialize Emu if not yet initialized (e.g. Emu.Kill() was previously invoked) before using some of the following vfs:: functions (e.g. vfs::get())
|
||||||
|
if (Emu.IsStopped())
|
||||||
|
{
|
||||||
|
Emu.Init();
|
||||||
|
}
|
||||||
|
|
||||||
const std::string spath = path.toStdString();
|
const std::string spath = path.toStdString();
|
||||||
const std::string vfs_get_path = vfs::get(spath);
|
const std::string vfs_get_path = vfs::get(spath);
|
||||||
const std::string vfs_retrieve_path = vfs::retrieve(spath);
|
const std::string vfs_retrieve_path = vfs::retrieve(spath);
|
||||||
|
Loading…
Reference in New Issue
Block a user