disable sleep whilst downloading, uploading, using usb, inside ftp menu.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "defines.hpp"
|
||||
#include "evman.hpp"
|
||||
#include "fs.hpp"
|
||||
#include "app.hpp"
|
||||
|
||||
#include <switch.h>
|
||||
#include <cstring>
|
||||
@@ -669,6 +670,9 @@ void SetCommonCurlOptions(CURL* curl, const Api& e) {
|
||||
|
||||
}
|
||||
auto DownloadInternal(CURL* curl, const Api& e) -> ApiResult {
|
||||
App::SetAutoSleepDisabled(true);
|
||||
ON_SCOPE_EXIT(App::SetAutoSleepDisabled(false));
|
||||
|
||||
// check if stop has been requested before starting download
|
||||
if (e.GetToken().stop_requested()) {
|
||||
return {};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "threaded_file_transfer.hpp"
|
||||
#include "log.hpp"
|
||||
#include "defines.hpp"
|
||||
#include "app.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
@@ -302,6 +303,9 @@ auto GetAlternateCore(int id) {
|
||||
}
|
||||
|
||||
Result TransferInternal(ui::ProgressBox* pbox, s64 size, ReadFunctionCallback rfunc, WriteFunctionCallback wfunc, StartFunctionCallback sfunc) {
|
||||
App::SetAutoSleepDisabled(true);
|
||||
ON_SCOPE_EXIT(App::SetAutoSleepDisabled(false));
|
||||
|
||||
const auto WRITE_THREAD_CORE = sfunc ? pbox->GetCpuId() : GetAlternateCore(pbox->GetCpuId());
|
||||
const auto READ_THREAD_CORE = GetAlternateCore(WRITE_THREAD_CORE);
|
||||
|
||||
|
||||
@@ -151,6 +151,8 @@ Menu::Menu() : MenuBase{"FTP Install (EXPERIMENTAL)"_i18n} {
|
||||
App::DisplayInstallOptions(false);
|
||||
}});
|
||||
|
||||
App::SetAutoSleepDisabled(true);
|
||||
|
||||
mutexInit(&m_mutex);
|
||||
m_was_ftp_enabled = App::GetFtpEnable();
|
||||
if (!m_was_ftp_enabled) {
|
||||
@@ -182,6 +184,7 @@ Menu::~Menu() {
|
||||
App::SetFtpEnable(false);
|
||||
}
|
||||
|
||||
App::SetAutoSleepDisabled(false);
|
||||
log_write("closing data!!!!\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -19,18 +19,25 @@
|
||||
#include "usb/base.hpp"
|
||||
#include "log.hpp"
|
||||
#include "defines.hpp"
|
||||
#include "app.hpp"
|
||||
#include <ranges>
|
||||
#include <cstring>
|
||||
|
||||
namespace sphaira::usb {
|
||||
|
||||
Base::Base(u64 transfer_timeout) {
|
||||
App::SetAutoSleepDisabled(true);
|
||||
|
||||
m_transfer_timeout = transfer_timeout;
|
||||
ueventCreate(GetCancelEvent(), true);
|
||||
// this avoids allocations during transfers.
|
||||
m_aligned.reserve(1024 * 1024 * 16);
|
||||
}
|
||||
|
||||
Base::~Base() {
|
||||
App::SetAutoSleepDisabled(false);
|
||||
}
|
||||
|
||||
Result Base::TransferPacketImpl(bool read, void *page, u32 size, u32 *out_size_transferred, u64 timeout) {
|
||||
u32 xfer_id;
|
||||
|
||||
|
||||
@@ -754,7 +754,7 @@ struct BufHelper {
|
||||
};
|
||||
|
||||
Yati::Yati(ui::ProgressBox* _pbox, std::shared_ptr<source::Base> _source) : pbox{_pbox}, source{_source} {
|
||||
appletSetMediaPlaybackState(true);
|
||||
App::SetAutoSleepDisabled(true);
|
||||
}
|
||||
|
||||
Yati::~Yati() {
|
||||
@@ -768,11 +768,11 @@ Yati::~Yati() {
|
||||
ncmContentStorageClose(std::addressof(ncm_cs[i]));
|
||||
}
|
||||
|
||||
appletSetMediaPlaybackState(false);
|
||||
|
||||
if (config.boost_mode) {
|
||||
appletSetCpuBoostMode(ApmCpuBoostMode_Normal);
|
||||
}
|
||||
|
||||
App::SetAutoSleepDisabled(false);
|
||||
}
|
||||
|
||||
Result Yati::Setup(const ConfigOverride& override) {
|
||||
|
||||
Reference in New Issue
Block a user