Fix variable names

This commit is contained in:
Huntereb 2019-12-13 11:46:23 -05:00
parent 6c85761a10
commit 62da4232df
4 changed files with 41 additions and 43 deletions

View file

@ -31,10 +31,9 @@ SOFTWARE.
#include "sdInstall.hpp"
#include "util/util.hpp"
bool stopThreads;
namespace tin::install::nsp
{
bool stopThreadsHttpNsp;
HTTPNSP::HTTPNSP(std::string url) :
m_download(url)
@ -66,7 +65,7 @@ namespace tin::install::nsp
return streamBufSize;
};
if (args->download->StreamDataRange(args->pfs0Offset, args->ncaSize, streamFunc) == 1) stopThreads = true;
if (args->download->StreamDataRange(args->pfs0Offset, args->ncaSize, streamFunc) == 1) stopThreadsHttpNsp = true;
return 0;
}
@ -74,7 +73,7 @@ namespace tin::install::nsp
{
StreamFuncArgs* args = reinterpret_cast<StreamFuncArgs*>(in);
while (!args->bufferedPlaceholderWriter->IsPlaceholderComplete() && !stopThreads)
while (!args->bufferedPlaceholderWriter->IsPlaceholderComplete() && !stopThreadsHttpNsp)
{
if (args->bufferedPlaceholderWriter->CanWriteSegmentToPlaceholder())
args->bufferedPlaceholderWriter->WriteSegmentToPlaceholder();
@ -100,7 +99,7 @@ namespace tin::install::nsp
thrd_t curlThread;
thrd_t writeThread;
stopThreads = false;
stopThreadsHttpNsp = false;
thrd_create(&curlThread, CurlStreamFunc, &args);
thrd_create(&writeThread, PlaceholderWriteFunc, &args);
@ -110,7 +109,7 @@ namespace tin::install::nsp
double speed = 0.0;
inst::ui::setInstBarPerc(0);
while (!bufferedPlaceholderWriter.IsBufferDataComplete() && !stopThreads)
while (!bufferedPlaceholderWriter.IsBufferDataComplete() && !stopThreadsHttpNsp)
{
u64 newTime = armGetSystemTick();
@ -134,7 +133,7 @@ namespace tin::install::nsp
inst::ui::setInstInfoText("Installing " + ncaFileName + "...");
inst::ui::setInstBarPerc(0);
while (!bufferedPlaceholderWriter.IsPlaceholderComplete() && !stopThreads)
while (!bufferedPlaceholderWriter.IsPlaceholderComplete() && !stopThreadsHttpNsp)
{
int installProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0);
@ -144,7 +143,7 @@ namespace tin::install::nsp
thrd_join(curlThread, NULL);
thrd_join(writeThread, NULL);
if (stopThreads) THROW_FORMAT("An error occured during data transfer. Check your network connection.");
if (stopThreadsHttpNsp) THROW_FORMAT("An error occured during data transfer. Check your network connection.");
}
void HTTPNSP::BufferData(void* buf, off_t offset, size_t size)

View file

@ -28,10 +28,10 @@ SOFTWARE.
#include "sdInstall.hpp"
#include "util/util.hpp"
bool stopThreads;
namespace tin::install::xci
{
bool stopThreadsHttpXci;
HTTPXCI::HTTPXCI(std::string url) :
m_download(url)
{
@ -62,7 +62,7 @@ namespace tin::install::xci
return streamBufSize;
};
if (args->download->StreamDataRange(args->pfs0Offset, args->ncaSize, streamFunc) == 1) stopThreads = true;
if (args->download->StreamDataRange(args->pfs0Offset, args->ncaSize, streamFunc) == 1) stopThreadsHttpXci = true;
return 0;
}
@ -70,7 +70,7 @@ namespace tin::install::xci
{
StreamFuncArgs* args = reinterpret_cast<StreamFuncArgs*>(in);
while (!args->bufferedPlaceholderWriter->IsPlaceholderComplete() && !stopThreads)
while (!args->bufferedPlaceholderWriter->IsPlaceholderComplete() && !stopThreadsHttpXci)
{
if (args->bufferedPlaceholderWriter->CanWriteSegmentToPlaceholder())
args->bufferedPlaceholderWriter->WriteSegmentToPlaceholder();
@ -96,7 +96,7 @@ namespace tin::install::xci
thrd_t curlThread;
thrd_t writeThread;
stopThreads = false;
stopThreadsHttpXci = false;
thrd_create(&curlThread, CurlStreamFunc, &args);
thrd_create(&writeThread, PlaceholderWriteFunc, &args);
@ -106,7 +106,7 @@ namespace tin::install::xci
double speed = 0.0;
inst::ui::setInstBarPerc(0);
while (!bufferedPlaceholderWriter.IsBufferDataComplete() && !stopThreads)
while (!bufferedPlaceholderWriter.IsBufferDataComplete() && !stopThreadsHttpXci)
{
u64 newTime = armGetSystemTick();
@ -138,7 +138,7 @@ namespace tin::install::xci
inst::ui::setInstInfoText("Installing " + ncaFileName + "...");
inst::ui::setInstBarPerc(0);
while (!bufferedPlaceholderWriter.IsPlaceholderComplete() && !stopThreads)
while (!bufferedPlaceholderWriter.IsPlaceholderComplete() && !stopThreadsHttpXci)
{
int installProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0);
#ifdef NXLINK_DEBUG
@ -151,7 +151,7 @@ namespace tin::install::xci
thrd_join(curlThread, NULL);
thrd_join(writeThread, NULL);
if (stopThreads) THROW_FORMAT("An error occured during data transfer. Check your network connection.");
if (stopThreadsHttpXci) THROW_FORMAT("An error occured during data transfer. Check your network connection.");
}
void HTTPXCI::BufferData(void* buf, off_t offset, size_t size)

View file

@ -36,11 +36,11 @@ SOFTWARE.
#include "util/util.hpp"
#include "util/usb_comms_awoo.h"
bool stopThreads;
std::string errorMessage;
namespace tin::install::nsp
{
bool stopThreadsUsbNsp;
std::string errorMessageUsbNsp;
USBNSP::USBNSP(std::string nspName) :
m_nspName(nspName)
@ -67,7 +67,7 @@ namespace tin::install::nsp
try
{
while (sizeRemaining && !stopThreads)
while (sizeRemaining && !stopThreadsUsbNsp)
{
tmpSizeRead = awoo_usbCommsRead(buf, std::min(sizeRemaining, (u64)0x800000));
if (tmpSizeRead == 0) THROW_FORMAT("USB transfer timed out or failed");
@ -84,8 +84,8 @@ namespace tin::install::nsp
}
catch (std::exception& e)
{
stopThreads = true;
errorMessage = e.what();
stopThreadsUsbNsp = true;
errorMessageUsbNsp = e.what();
}
free(buf);
@ -107,7 +107,7 @@ namespace tin::install::nsp
try
{
while (sizeRemaining && !stopThreads)
while (sizeRemaining && !stopThreadsUsbNsp)
{
if (!curRequestLeft) {
reqSize = std::min(sizeRemaining, (u64)0x800000);
@ -132,8 +132,8 @@ namespace tin::install::nsp
}
catch (std::exception& e)
{
stopThreads = true;
errorMessage = e.what();
stopThreadsUsbNsp = true;
errorMessageUsbNsp = e.what();
}
free(buf);
@ -145,7 +145,7 @@ namespace tin::install::nsp
{
USBFuncArgs* args = reinterpret_cast<USBFuncArgs*>(in);
while (!args->bufferedPlaceholderWriter->IsPlaceholderComplete() && !stopThreads)
while (!args->bufferedPlaceholderWriter->IsPlaceholderComplete() && !stopThreadsUsbNsp)
{
if (args->bufferedPlaceholderWriter->CanWriteSegmentToPlaceholder())
args->bufferedPlaceholderWriter->WriteSegmentToPlaceholder();
@ -171,7 +171,7 @@ namespace tin::install::nsp
thrd_t usbThread;
thrd_t writeThread;
stopThreads = false;
stopThreadsUsbNsp = false;
if (m_nspName.substr(m_nspName.size() - 1, 1) == "z") thrd_create(&usbThread, USBThreadFuncNcz, &args);
else thrd_create(&usbThread, USBThreadFunc, &args);
thrd_create(&writeThread, USBPlaceholderWriteFunc, &args);
@ -182,7 +182,7 @@ namespace tin::install::nsp
double speed = 0.0;
inst::ui::setInstBarPerc(0);
while (!bufferedPlaceholderWriter.IsBufferDataComplete() && !stopThreads)
while (!bufferedPlaceholderWriter.IsBufferDataComplete() && !stopThreadsUsbNsp)
{
u64 newTime = armGetSystemTick();
@ -214,7 +214,7 @@ namespace tin::install::nsp
inst::ui::setInstInfoText("Installing " + ncaFileName + "...");
inst::ui::setInstBarPerc(0);
while (!bufferedPlaceholderWriter.IsPlaceholderComplete() && !stopThreads)
while (!bufferedPlaceholderWriter.IsPlaceholderComplete() && !stopThreadsUsbNsp)
{
int installProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0);
#ifdef NXLINK_DEBUG
@ -227,7 +227,7 @@ namespace tin::install::nsp
thrd_join(usbThread, NULL);
thrd_join(writeThread, NULL);
if (stopThreads) throw std::runtime_error(errorMessage.c_str());
if (stopThreadsUsbNsp) throw std::runtime_error(errorMessageUsbNsp.c_str());
}
void USBNSP::BufferData(void* buf, off_t offset, size_t size)

View file

@ -36,11 +36,10 @@ SOFTWARE.
#include "util/util.hpp"
#include "util/usb_comms_awoo.h"
bool stopThreads;
std::string errorMessage;
namespace tin::install::xci
{
bool stopThreadsUsbXci;
std::string errorMessageUsbXci;
USBXCI::USBXCI(std::string xciName) :
m_xciName(xciName)
@ -67,7 +66,7 @@ namespace tin::install::xci
try
{
while (sizeRemaining && !stopThreads)
while (sizeRemaining && !stopThreadsUsbXci)
{
tmpSizeRead = awoo_usbCommsRead(buf, std::min(sizeRemaining, (u64)0x800000));
if (tmpSizeRead == 0) THROW_FORMAT("USB transfer timed out or failed");
@ -84,8 +83,8 @@ namespace tin::install::xci
}
catch (std::exception& e)
{
stopThreads = true;
errorMessage = e.what();
stopThreadsUsbXci = true;
errorMessageUsbXci = e.what();
}
free(buf);
@ -107,7 +106,7 @@ namespace tin::install::xci
try
{
while (sizeRemaining && !stopThreads)
while (sizeRemaining && !stopThreadsUsbXci)
{
if (!curRequestLeft) {
reqSize = std::min(sizeRemaining, (u64)0x800000);
@ -132,8 +131,8 @@ namespace tin::install::xci
}
catch (std::exception& e)
{
stopThreads = true;
errorMessage = e.what();
stopThreadsUsbXci = true;
errorMessageUsbXci = e.what();
}
free(buf);
@ -145,7 +144,7 @@ namespace tin::install::xci
{
USBFuncArgs* args = reinterpret_cast<USBFuncArgs*>(in);
while (!args->bufferedPlaceholderWriter->IsPlaceholderComplete() && !stopThreads)
while (!args->bufferedPlaceholderWriter->IsPlaceholderComplete() && !stopThreadsUsbXci)
{
if (args->bufferedPlaceholderWriter->CanWriteSegmentToPlaceholder())
args->bufferedPlaceholderWriter->WriteSegmentToPlaceholder();
@ -171,7 +170,7 @@ namespace tin::install::xci
thrd_t usbThread;
thrd_t writeThread;
stopThreads = false;
stopThreadsUsbXci = false;
if (m_xciName.substr(m_xciName.size() - 1, 1) == "z") thrd_create(&usbThread, USBThreadFuncNcz, &args);
else thrd_create(&usbThread, USBThreadFunc, &args);
thrd_create(&writeThread, USBPlaceholderWriteFunc, &args);
@ -182,7 +181,7 @@ namespace tin::install::xci
double speed = 0.0;
inst::ui::setInstBarPerc(0);
while (!bufferedPlaceholderWriter.IsBufferDataComplete() && !stopThreads)
while (!bufferedPlaceholderWriter.IsBufferDataComplete() && !stopThreadsUsbXci)
{
u64 newTime = armGetSystemTick();
@ -214,7 +213,7 @@ namespace tin::install::xci
inst::ui::setInstInfoText("Installing " + ncaFileName + "...");
inst::ui::setInstBarPerc(0);
while (!bufferedPlaceholderWriter.IsPlaceholderComplete() && !stopThreads)
while (!bufferedPlaceholderWriter.IsPlaceholderComplete() && !stopThreadsUsbXci)
{
int installProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0);
#ifdef NXLINK_DEBUG
@ -227,7 +226,7 @@ namespace tin::install::xci
thrd_join(usbThread, NULL);
thrd_join(writeThread, NULL);
if (stopThreads) throw std::runtime_error(errorMessage.c_str());
if (stopThreadsUsbXci) throw std::runtime_error(errorMessageUsbXci.c_str());
}
void USBXCI::BufferData(void* buf, off_t offset, size_t size)