forked from ShuriZma/suyu
Removed RomFSRawCopy + VfsDirectoryCreateFileWrapper obsolete functions
This commit is contained in:
parent
ba5b604f9a
commit
51862e862d
|
@ -612,7 +612,7 @@ struct Values {
|
||||||
|
|
||||||
// WebService
|
// WebService
|
||||||
Setting<bool> enable_telemetry{linkage, false, "enable_telemetry", Category::WebService};
|
Setting<bool> enable_telemetry{linkage, false, "enable_telemetry", Category::WebService};
|
||||||
Setting<std::string> web_api_url{linkage, "https://api.yuzu-emu.org", "web_api_url",
|
Setting<std::string> web_api_url{linkage, "https://api.suyu.dev", "web_api_url",
|
||||||
Category::WebService};
|
Category::WebService};
|
||||||
Setting<std::string> yuzu_username{linkage, std::string(), "yuzu_username",
|
Setting<std::string> yuzu_username{linkage, std::string(), "yuzu_username",
|
||||||
Category::WebService};
|
Category::WebService};
|
||||||
|
|
|
@ -54,14 +54,6 @@
|
||||||
#include "yuzu/multiplayer/state.h"
|
#include "yuzu/multiplayer/state.h"
|
||||||
#include "yuzu/util/controller_navigation.h"
|
#include "yuzu/util/controller_navigation.h"
|
||||||
|
|
||||||
// These are wrappers to avoid the calls to CreateFile because of the Windows
|
|
||||||
// defines.
|
|
||||||
|
|
||||||
static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::VirtualDir& dir,
|
|
||||||
const std::string& path) {
|
|
||||||
return dir->CreateFile(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
#include <fmt/ostream.h>
|
#include <fmt/ostream.h>
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
|
|
||||||
|
@ -2374,68 +2366,6 @@ void GMainWindow::OnTransferableShaderCacheOpenFile(u64 program_id) {
|
||||||
QDesktopServices::openUrl(QUrl::fromLocalFile(qt_shader_cache_path));
|
QDesktopServices::openUrl(QUrl::fromLocalFile(qt_shader_cache_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool RomFSRawCopy(size_t total_size, size_t& read_size, QProgressDialog& dialog,
|
|
||||||
const FileSys::VirtualDir& src, const FileSys::VirtualDir& dest,
|
|
||||||
bool full) {
|
|
||||||
if (src == nullptr || dest == nullptr || !src->IsReadable() || !dest->IsWritable())
|
|
||||||
return false;
|
|
||||||
if (dialog.wasCanceled())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
std::vector<u8> buffer(CopyBufferSize);
|
|
||||||
auto last_timestamp = std::chrono::steady_clock::now();
|
|
||||||
|
|
||||||
const auto QtRawCopy = [&](const FileSys::VirtualFile& src_file,
|
|
||||||
const FileSys::VirtualFile& dest_file) {
|
|
||||||
if (src_file == nullptr || dest_file == nullptr) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!dest_file->Resize(src_file->GetSize())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (std::size_t i = 0; i < src_file->GetSize(); i += buffer.size()) {
|
|
||||||
if (dialog.wasCanceled()) {
|
|
||||||
dest_file->Resize(0);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
using namespace std::literals::chrono_literals;
|
|
||||||
const auto new_timestamp = std::chrono::steady_clock::now();
|
|
||||||
|
|
||||||
if ((new_timestamp - last_timestamp) > 33ms) {
|
|
||||||
last_timestamp = new_timestamp;
|
|
||||||
dialog.setValue(
|
|
||||||
static_cast<int>(std::min(read_size, total_size) * 100 / total_size));
|
|
||||||
QCoreApplication::processEvents();
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto read = src_file->Read(buffer.data(), buffer.size(), i);
|
|
||||||
dest_file->Write(buffer.data(), read, i);
|
|
||||||
|
|
||||||
read_size += read;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (full) {
|
|
||||||
for (const auto& file : src->GetFiles()) {
|
|
||||||
const auto out = VfsDirectoryCreateFileWrapper(dest, file->GetName());
|
|
||||||
if (!QtRawCopy(file, out))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const auto& dir : src->GetSubdirectories()) {
|
|
||||||
const auto out = dest->CreateSubdirectory(dir->GetName());
|
|
||||||
if (!RomFSRawCopy(total_size, read_size, dialog, dir, out, full))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString GMainWindow::GetGameListErrorRemoving(InstalledEntryType type) const {
|
QString GMainWindow::GetGameListErrorRemoving(InstalledEntryType type) const {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case InstalledEntryType::Game:
|
case InstalledEntryType::Game:
|
||||||
|
|
Loading…
Reference in New Issue