summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Morph2023-07-06 13:04:27 -0400
committerGravatar Morph2023-07-06 13:04:27 -0400
commit9d7671ec3be87730d7faa70c9e11a3b1e36491cd (patch)
treef5cf479fb4d411127a1f55326170903a4851a23b /src
parentmain: Fix install progress calculation (diff)
downloadyuzu-9d7671ec3be87730d7faa70c9e11a3b1e36491cd.tar.gz
yuzu-9d7671ec3be87730d7faa70c9e11a3b1e36491cd.tar.xz
yuzu-9d7671ec3be87730d7faa70c9e11a3b1e36491cd.zip
main: Use 1_MiB as a constant for copy buffer size
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/main.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 83f502351..6cd557c29 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -178,6 +178,8 @@ constexpr int default_mouse_hide_timeout = 2500;
178constexpr int default_mouse_center_timeout = 10; 178constexpr int default_mouse_center_timeout = 10;
179constexpr int default_input_update_timeout = 1; 179constexpr int default_input_update_timeout = 1;
180 180
181constexpr size_t CopyBufferSize = 1_MiB;
182
181/** 183/**
182 * "Callouts" are one-time instructional messages shown to the user. In the config settings, there 184 * "Callouts" are one-time instructional messages shown to the user. In the config settings, there
183 * is a bitfield "callout_flags" options, used to track if a message has already been shown to the 185 * is a bitfield "callout_flags" options, used to track if a message has already been shown to the
@@ -2932,7 +2934,7 @@ void GMainWindow::OnMenuInstallToNAND() {
2932 // This would only overflow above 2^51 bytes (2.252 PB) 2934 // This would only overflow above 2^51 bytes (2.252 PB)
2933 int total_size = 0; 2935 int total_size = 0;
2934 for (const QString& file : files) { 2936 for (const QString& file : files) {
2935 total_size += static_cast<int>(QFile(file).size() / 1_MiB); 2937 total_size += static_cast<int>(QFile(file).size() / CopyBufferSize);
2936 } 2938 }
2937 if (total_size < 0) { 2939 if (total_size < 0) {
2938 LOG_CRITICAL(Frontend, "Attempting to install too many files, aborting."); 2940 LOG_CRITICAL(Frontend, "Attempting to install too many files, aborting.");
@@ -3032,7 +3034,7 @@ InstallResult GMainWindow::InstallNSPXCI(const QString& filename) {
3032 return false; 3034 return false;
3033 } 3035 }
3034 3036
3035 std::vector<u8> buffer(1_MiB); 3037 std::vector<u8> buffer(CopyBufferSize);
3036 3038
3037 for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) { 3039 for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) {
3038 if (install_progress->wasCanceled()) { 3040 if (install_progress->wasCanceled()) {
@@ -3088,7 +3090,7 @@ InstallResult GMainWindow::InstallNCA(const QString& filename) {
3088 return false; 3090 return false;
3089 } 3091 }
3090 3092
3091 std::vector<u8> buffer(1_MiB); 3093 std::vector<u8> buffer(CopyBufferSize);
3092 3094
3093 for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) { 3095 for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) {
3094 if (install_progress->wasCanceled()) { 3096 if (install_progress->wasCanceled()) {