diff --git a/source/actions.cpp b/source/actions.cpp index 0780b14..1252a65 100644 --- a/source/actions.cpp +++ b/source/actions.cpp @@ -409,6 +409,7 @@ namespace Actions snprintf(activity_message, 1024, "%s %s", lang_strings[STR_UPLOADING], entries[i].path); bytes_to_download = entries[i].file_size; bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); ret = UploadFile(entries[i].path, new_path); if (ret <= 0) { @@ -1067,6 +1068,7 @@ namespace Actions void *InstallUrlPkgThread(void *argp) { bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); sprintf(status_message, "%s", ""); pkg_header header; char filename[2000]; @@ -1384,6 +1386,7 @@ namespace Actions snprintf(activity_message, 1024, "%s %s", isCopy ? lang_strings[STR_COPYING] : lang_strings[STR_MOVING], entries[i].path); bytes_to_download = entries[i].file_size; bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); ret = CopyOrMoveLocalFile(entries[i].path, new_path, isCopy); if (ret <= 0) { @@ -1633,6 +1636,7 @@ namespace Actions snprintf(activity_message, 1024, "%s %s", lang_strings[STR_COPYING], entries[i].path); bytes_to_download = entries[i].file_size; bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); ret = CopyOrMoveRemoteFile(entries[i].path, new_path, true); if (ret <= 0) { @@ -1726,6 +1730,7 @@ namespace Actions sprintf(activity_message, "%s %s to %s", lang_strings[STR_DOWNLOADING], filename.c_str(), local_file); remoteclient->Size(filename, &bytes_to_download); bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); file_transfering = true; int ret = remoteclient->Get(local_file, filename); if (ret == 0) diff --git a/source/actions.h b/source/actions.h index 1b846cf..c0caf55 100644 --- a/source/actions.h +++ b/source/actions.h @@ -1,5 +1,5 @@ -#ifndef ACTIONS_H -#define ACTIONS_H +#ifndef EZ_ACTIONS_H +#define EZ_ACTIONS_H #include #include "installer.h" diff --git a/source/base64.h b/source/base64.h index 7286933..cea9ea6 100644 --- a/source/base64.h +++ b/source/base64.h @@ -1,5 +1,5 @@ -#ifndef BASE64_H_ -#define BASE64_H_ +#ifndef EZ_BASE64_H_ +#define EZ_BASE64_H_ #include diff --git a/source/clients/apache.h b/source/clients/apache.h index 4885019..eab0aa8 100644 --- a/source/clients/apache.h +++ b/source/clients/apache.h @@ -1,5 +1,5 @@ -#ifndef APACHE_H -#define APACHE_H +#ifndef EZ_APACHE_H +#define EZ_APACHE_H #include #include diff --git a/source/clients/baseclient.cpp b/source/clients/baseclient.cpp index abd80b1..6b5af45 100644 --- a/source/clients/baseclient.cpp +++ b/source/clients/baseclient.cpp @@ -102,6 +102,8 @@ int BaseClient::Get(const std::string &outputfile, const std::string &path, uint { std::ofstream file_stream(outputfile, std::ios::binary); bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); + if (auto res = client->Get(GetFullPath(path), [&](const char *data, size_t data_length) { diff --git a/source/clients/baseclient.h b/source/clients/baseclient.h index b2cfe52..652e681 100644 --- a/source/clients/baseclient.h +++ b/source/clients/baseclient.h @@ -1,5 +1,5 @@ -#ifndef BASESERVER_H -#define BASESERVER_H +#ifndef EZ_BASESERVER_H +#define EZ_BASESERVER_H #include #include diff --git a/source/clients/ftpclient.h b/source/clients/ftpclient.h index dc7d81a..c7e0ded 100644 --- a/source/clients/ftpclient.h +++ b/source/clients/ftpclient.h @@ -1,5 +1,5 @@ -#ifndef FTPCLIENT_H -#define FTPCLIENT_H +#ifndef EZ_FTPCLIENT_H +#define EZ_FTPCLIENT_H #include #include diff --git a/source/clients/gdrive.cpp b/source/clients/gdrive.cpp index 988061f..732aa86 100644 --- a/source/clients/gdrive.cpp +++ b/source/clients/gdrive.cpp @@ -307,6 +307,7 @@ int GDriveClient::Get(const std::string &outputfile, const std::string &path, ui { std::ofstream file_stream(outputfile, std::ios::binary); bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); std::string id = GetValue(path_id_map, path); std::string drive_id = GetDriveId(path); @@ -399,9 +400,9 @@ int GDriveClient::Update(const std::string &inputfile, const std::string &path) { bytes_to_download = FS::GetSize(inputfile); bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); std::ifstream file_stream(inputfile, std::ios::binary); - bytes_transfered = 0; std::string id = GetValue(path_id_map, path); std::string drive_id = GetDriveId(path); @@ -473,9 +474,9 @@ int GDriveClient::Put(const std::string &inputfile, const std::string &path, uin bytes_to_download = FS::GetSize(inputfile); bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); std::ifstream file_stream(inputfile, std::ios::binary); - bytes_transfered = 0; size_t path_pos = path.find_last_of("/"); std::string parent_dir; diff --git a/source/clients/gdrive.h b/source/clients/gdrive.h index 8f39f9e..9b5c32a 100644 --- a/source/clients/gdrive.h +++ b/source/clients/gdrive.h @@ -1,5 +1,5 @@ -#ifndef GDRIVE_H -#define GDRIVE_H +#ifndef EZ_GDRIVE_H +#define EZ_GDRIVE_H #include #include diff --git a/source/clients/iis.h b/source/clients/iis.h index 1c4e340..264b391 100644 --- a/source/clients/iis.h +++ b/source/clients/iis.h @@ -1,5 +1,5 @@ -#ifndef IIS_H -#define IIS_H +#ifndef EZ_IIS_H +#define EZ_IIS_H #include #include diff --git a/source/clients/nfsclient.cpp b/source/clients/nfsclient.cpp index cdebfa6..8a4c671 100644 --- a/source/clients/nfsclient.cpp +++ b/source/clients/nfsclient.cpp @@ -213,6 +213,7 @@ int NfsClient::Get(const std::string &outputfile, const std::string &ppath, uint void *buff = malloc(BUF_SIZE); int count = 0; bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); while ((count = nfs_read(nfs, nfsfh, BUF_SIZE, buff)) > 0) { if (count < 0) @@ -382,6 +383,7 @@ int NfsClient::Put(const std::string &inputfile, const std::string &ppath, uint6 void* buff = malloc(BUF_SIZE); uint64_t count = 0; bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); while ((count = FS::Read(in, buff, BUF_SIZE)) > 0) { if (count < 0) diff --git a/source/clients/nfsclient.h b/source/clients/nfsclient.h index 692cf96..3c3450b 100644 --- a/source/clients/nfsclient.h +++ b/source/clients/nfsclient.h @@ -1,5 +1,5 @@ -#ifndef NFSCLIENT_H -#define NFSCLIENT_H +#ifndef EZ_NFSCLIENT_H +#define EZ_NFSCLIENT_H #include #include diff --git a/source/clients/nginx.h b/source/clients/nginx.h index 1043b03..99b37ce 100644 --- a/source/clients/nginx.h +++ b/source/clients/nginx.h @@ -1,5 +1,5 @@ -#ifndef NGINX_H -#define NGINX_H +#ifndef EZ_NGINX_H +#define EZ_NGINX_H #include #include diff --git a/source/clients/npxserve.h b/source/clients/npxserve.h index 9801506..cf36a2e 100644 --- a/source/clients/npxserve.h +++ b/source/clients/npxserve.h @@ -1,5 +1,5 @@ -#ifndef NPXSERVE_H -#define NPXSERVE_H +#ifndef EZ_NPXSERVE_H +#define EZ_NPXSERVE_H #include #include diff --git a/source/clients/rclone.h b/source/clients/rclone.h index 575a051..f284748 100644 --- a/source/clients/rclone.h +++ b/source/clients/rclone.h @@ -1,5 +1,5 @@ -#ifndef RCLONE_H -#define RCLONE_H +#ifndef EZ_RCLONE_H +#define EZ_RCLONE_H #include #include diff --git a/source/clients/remote_client.h b/source/clients/remote_client.h index 5d6074c..071d18d 100644 --- a/source/clients/remote_client.h +++ b/source/clients/remote_client.h @@ -1,5 +1,5 @@ -#ifndef REMOTECLIENT_H -#define REMOTECLIENT_H +#ifndef EZ_REMOTECLIENT_H +#define EZ_REMOTECLIENT_H #include #include diff --git a/source/clients/sftpclient.cpp b/source/clients/sftpclient.cpp index f221416..4531d51 100644 --- a/source/clients/sftpclient.cpp +++ b/source/clients/sftpclient.cpp @@ -284,6 +284,8 @@ int SFTPClient::Get(const std::string &outputfile, const std::string &path, uint char *buff = (char *)malloc(FTP_CLIENT_BUFSIZ); int rc, count = 0; bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); + do { rc = libssh2_sftp_read(sftp_handle, buff, FTP_CLIENT_BUFSIZ); @@ -418,6 +420,8 @@ int SFTPClient::Put(const std::string &inputfile, const std::string &path, uint6 buff = (char *)malloc(FTP_CLIENT_BUFSIZ); int nread, count = 0; bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); + do { nread = FS::Read(in, buff, FTP_CLIENT_BUFSIZ); diff --git a/source/clients/sftpclient.h b/source/clients/sftpclient.h index 774d5fb..1f787ce 100644 --- a/source/clients/sftpclient.h +++ b/source/clients/sftpclient.h @@ -1,5 +1,5 @@ -#ifndef SFTPCLIENT_H -#define SFTPCLIENT_H +#ifndef EZ_SFTPCLIENT_H +#define EZ_SFTPCLIENT_H #include #include diff --git a/source/clients/smbclient.cpp b/source/clients/smbclient.cpp index 4958f71..48b1b02 100644 --- a/source/clients/smbclient.cpp +++ b/source/clients/smbclient.cpp @@ -214,6 +214,8 @@ int SmbClient::Get(const std::string &outputfile, const std::string &ppath, uint uint8_t *buff = (uint8_t*)malloc(max_read_size); int count = 0; bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); + while ((count = smb2_read(smb2, in, buff, max_read_size)) > 0) { if (count < 0) @@ -418,6 +420,8 @@ int SmbClient::Put(const std::string &inputfile, const std::string &ppath, uint6 uint8_t* buff = (uint8_t*)malloc(max_write_size); int count = 0; bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); + while ((count = FS::Read(in, buff, max_write_size)) > 0) { if (count < 0) diff --git a/source/clients/smbclient.h b/source/clients/smbclient.h index 01ea552..4058e5c 100644 --- a/source/clients/smbclient.h +++ b/source/clients/smbclient.h @@ -1,5 +1,5 @@ -#ifndef SMBCLIENT_H -#define SMBCLIENT_H +#ifndef EZ_SMBCLIENT_H +#define EZ_SMBCLIENT_H #include #include diff --git a/source/clients/webdav.cpp b/source/clients/webdav.cpp index 1f87706..c0f495a 100644 --- a/source/clients/webdav.cpp +++ b/source/clients/webdav.cpp @@ -151,6 +151,7 @@ int WebDAVClient::Put(const std::string &inputfile, const std::string &path, uin { size_t bytes_remaining = FS::GetSize(inputfile); bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); FILE* in = FS::OpenRead(inputfile); diff --git a/source/clients/webdav.h b/source/clients/webdav.h index f3f6e20..4ad043e 100644 --- a/source/clients/webdav.h +++ b/source/clients/webdav.h @@ -1,5 +1,5 @@ -#ifndef WEBDAV_H -#define WEBDAV_H +#ifndef EZ_WEBDAV_H +#define EZ_WEBDAV_H #include #include diff --git a/source/common.h b/source/common.h index 22aa254..4a9e2e3 100644 --- a/source/common.h +++ b/source/common.h @@ -1,5 +1,5 @@ -#ifndef COMMON_H -#define COMMON_H +#ifndef EZ_COMMON_H +#define EZ_COMMON_H #include #include diff --git a/source/config.h b/source/config.h index f14b3a5..a4d7f3b 100644 --- a/source/config.h +++ b/source/config.h @@ -1,5 +1,5 @@ -#ifndef LAUNCHER_CONFIG_H -#define LAUNCHER_CONFIG_H +#ifndef EZ_CONFIG_H +#define EZ_CONFIG_H #include #include diff --git a/source/filehost/1fichier.h b/source/filehost/1fichier.h index 712e9de..64b704b 100644 --- a/source/filehost/1fichier.h +++ b/source/filehost/1fichier.h @@ -1,5 +1,5 @@ -#ifndef FICHIER_HOST_H -#define FICHIER_HOST_H +#ifndef EZ_FICHIER_HOST_H +#define EZ_FICHIER_HOST_H #include "filehost.h" diff --git a/source/filehost/alldebrid.h b/source/filehost/alldebrid.h index 319c569..9fa9661 100644 --- a/source/filehost/alldebrid.h +++ b/source/filehost/alldebrid.h @@ -1,5 +1,5 @@ -#ifndef ALLDEBRID_HOST_H -#define ALLDEBRID_HOST_H +#ifndef EZ_ALLDEBRID_HOST_H +#define EZ_ALLDEBRID_HOST_H #include "filehost.h" diff --git a/source/filehost/directhost.h b/source/filehost/directhost.h index 3982431..685d027 100644 --- a/source/filehost/directhost.h +++ b/source/filehost/directhost.h @@ -1,5 +1,5 @@ -#ifndef DIRECT_HOST_H -#define DIRECT_HOST_H +#ifndef EZ_DIRECT_HOST_H +#define EZ_DIRECT_HOST_H #include "filehost.h" diff --git a/source/filehost/filehost.h b/source/filehost/filehost.h index 77e789a..91f12de 100644 --- a/source/filehost/filehost.h +++ b/source/filehost/filehost.h @@ -1,5 +1,5 @@ -#ifndef FILEHOST_H -#define FILEHOST_H +#ifndef EZ_FILEHOST_H +#define EZ_FILEHOST_H #include #include diff --git a/source/filehost/gdrive.h b/source/filehost/gdrive.h index ee70599..eb944f6 100644 --- a/source/filehost/gdrive.h +++ b/source/filehost/gdrive.h @@ -1,5 +1,5 @@ -#ifndef GDRIVE_HOST_H -#define GDRIVE_HOST_H +#ifndef EZ_GDRIVE_HOST_H +#define EZ_GDRIVE_HOST_H #include "filehost.h" diff --git a/source/filehost/mediafire.h b/source/filehost/mediafire.h index 94a97f9..55ac5e4 100644 --- a/source/filehost/mediafire.h +++ b/source/filehost/mediafire.h @@ -1,5 +1,5 @@ -#ifndef MEDIAFIRE_HOST_H -#define MEDIAFIRE_HOST_H +#ifndef EZ_MEDIAFIRE_HOST_H +#define EZ_MEDIAFIRE_HOST_H #include "filehost.h" diff --git a/source/filehost/pixeldrain.h b/source/filehost/pixeldrain.h index d8cad33..a057bcf 100644 --- a/source/filehost/pixeldrain.h +++ b/source/filehost/pixeldrain.h @@ -1,5 +1,5 @@ -#ifndef PIXELDRAIN_HOST_H -#define PIXELDRAIN_HOST_H +#ifndef EZ_PIXELDRAIN_HOST_H +#define EZ_PIXELDRAIN_HOST_H #include "filehost.h" diff --git a/source/filehost/realdebrid.h b/source/filehost/realdebrid.h index 99f5dd4..10a5b04 100644 --- a/source/filehost/realdebrid.h +++ b/source/filehost/realdebrid.h @@ -1,5 +1,5 @@ -#ifndef REALDEBRID_HOST_H -#define REALDEBRID_HOST_H +#ifndef EZ_REALDEBRID_HOST_H +#define EZ_REALDEBRID_HOST_H #include "filehost.h" diff --git a/source/fs.cpp b/source/fs.cpp index 18e4338..f9d188f 100644 --- a/source/fs.cpp +++ b/source/fs.cpp @@ -510,6 +510,8 @@ namespace FS size_t bytes_read = 0; bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); + const size_t buf_size = 0x10000; unsigned char *buf = new unsigned char[buf_size]; diff --git a/source/fs.h b/source/fs.h index bac39e0..409d4d6 100644 --- a/source/fs.h +++ b/source/fs.h @@ -1,5 +1,5 @@ -#ifndef LAUNCHER_FS_H -#define LAUNCHER_FS_H +#ifndef EZ_FS_H +#define EZ_FS_H #pragma once #include diff --git a/source/gui.h b/source/gui.h index 82c31b9..2e0c546 100644 --- a/source/gui.h +++ b/source/gui.h @@ -1,5 +1,5 @@ -#ifndef LAUNCHER_GUI_H -#define LAUNCHER_GUI_H +#ifndef EZ_GUI_H +#define EZ_GUI_H #include #include "SDL2/SDL.h" diff --git a/source/ime_dialog.h b/source/ime_dialog.h index 3a53dc4..b1f8d63 100644 --- a/source/ime_dialog.h +++ b/source/ime_dialog.h @@ -16,8 +16,8 @@ along with this program. If not, see . */ -#ifndef __IME_DIALOG_H__ -#define __IME_DIALOG_H__ +#ifndef __EZ_IME_DIALOG_H__ +#define __EZ_IME_DIALOG_H__ #define IME_DIALOG_RESULT_NONE 0 #define IME_DIALOG_RESULT_RUNNING 1 diff --git a/source/installer.cpp b/source/installer.cpp index 9d1691d..3cd6112 100644 --- a/source/installer.cpp +++ b/source/installer.cpp @@ -390,6 +390,8 @@ namespace INSTALLER file_transfering = true; bytes_to_download = 100; bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); + while (!completed) { memset(&progress_info, 0, sizeof(progress_info)); @@ -489,6 +491,7 @@ namespace INSTALLER file_transfering = true; bytes_to_download = 100; bytes_transfered = 0; + while (!completed) { memset(&progress_info, 0, sizeof(progress_info)); @@ -600,6 +603,8 @@ namespace INSTALLER sprintf(activity_message, "%s", lang_strings[STR_WAIT_FOR_INSTALL_MSG]); bytes_to_download = 1; bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); + while (!completed) { memset(&progress_info, 0, sizeof(progress_info)); @@ -916,6 +921,8 @@ namespace INSTALLER file_transfering = true; bytes_to_download = 100; bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); + while (!completed) { memset(&progress_info, 0, sizeof(progress_info)); diff --git a/source/lang.h b/source/lang.h index 0ee937b..70eafc3 100644 --- a/source/lang.h +++ b/source/lang.h @@ -1,5 +1,5 @@ -#ifndef __LANG_H__ -#define __LANG_H__ +#ifndef __EZ_LANG_H__ +#define __EZ_LANG_H__ #include "config.h" diff --git a/source/mem_file.h b/source/mem_file.h index 3b79416..67d6ef7 100644 --- a/source/mem_file.h +++ b/source/mem_file.h @@ -1,5 +1,5 @@ -#ifndef MEM_FILE_H -#define MEM_FILE_H +#ifndef EZ_MEM_FILE_H +#define EZ_MEM_FILE_H #include #include diff --git a/source/server/http_server.cpp b/source/server/http_server.cpp index 6770321..e4ef179 100644 --- a/source/server/http_server.cpp +++ b/source/server/http_server.cpp @@ -1061,6 +1061,7 @@ namespace HttpServer range_len = PKG_INITIAL_REQUEST_SIZE; res.set_header("Content-Length", std::to_string(range_len)); res.set_header("Content-Range", std::string("bytes ") + std::to_string(req.ranges[0].first)+"-" + std::to_string(req.ranges[0].first+PKG_INITIAL_REQUEST_SIZE-1) + "/"+std::to_string(range_len)); + sceRtcGetCurrentTick(&prev_tick); if (site_idx != 98) tmp_client = GetRemoteClient(site_idx, true); } @@ -1151,6 +1152,7 @@ namespace HttpServer range_len = PKG_INITIAL_REQUEST_SIZE; res.set_header("Content-Length", std::to_string(range_len)); res.set_header("Content-Range", std::string("bytes ") + std::to_string(req.ranges[0].first)+"-" + std::to_string(req.ranges[0].first+PKG_INITIAL_REQUEST_SIZE-1) + "/"+std::to_string(range_len)); + sceRtcGetCurrentTick(&prev_tick); } std::pair range = req.ranges[0]; res.set_content_provider( @@ -1213,6 +1215,8 @@ namespace HttpServer file_transfering = true; bytes_to_download = 100; bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); + Windows::SetModalMode(true); std::string download_url = filehost->GetDownloadUrl(); diff --git a/source/server/http_server.h b/source/server/http_server.h index 971c017..be47782 100644 --- a/source/server/http_server.h +++ b/source/server/http_server.h @@ -1,5 +1,5 @@ -#ifndef HTTP_SERVER_H -#define HTTP_SERVER_H +#ifndef EZ_HTTP_SERVER_H +#define EZ_HTTP_SERVER_H #include "http/httplib.h" diff --git a/source/sfo.h b/source/sfo.h index 761ac56..5d54292 100644 --- a/source/sfo.h +++ b/source/sfo.h @@ -1,5 +1,5 @@ -#ifndef LAUNCHER_SFO_H -#define LAUNCHER_SFO_H +#ifndef EZ_SFO_H +#define EZ_SFO_H #pragma once diff --git a/source/split_file.h b/source/split_file.h index 9333e3f..2e8b55c 100644 --- a/source/split_file.h +++ b/source/split_file.h @@ -1,5 +1,5 @@ -#ifndef SPLIT_FILE_H -#define SPLIT_FILE_H +#ifndef EZ_SPLIT_FILE_H +#define EZ_SPLIT_FILE_H #include #include diff --git a/source/system.h b/source/system.h index a981964..4f1e3e1 100644 --- a/source/system.h +++ b/source/system.h @@ -1,3 +1,6 @@ +#ifndef EZ_SYSTEM_H +#define EZ_SYSTEM_H + #include #ifdef __cplusplus @@ -42,3 +45,5 @@ void convertLocalTimeToUtc(const OrbisDateTime *local_time, OrbisDateTime *utc); #ifdef __cplusplus } #endif + +#endif \ No newline at end of file diff --git a/source/textures.h b/source/textures.h index 7433a07..ed4d2b1 100644 --- a/source/textures.h +++ b/source/textures.h @@ -1,5 +1,5 @@ -#ifndef LAUNCHER_TEXTURES_H -#define LAUNCHER_TEXTURES_H +#ifndef EZ_TEXTURES_H +#define EZ_TEXTURES_H #include #include diff --git a/source/windows.cpp b/source/windows.cpp index c2eb0f9..5966213 100644 --- a/source/windows.cpp +++ b/source/windows.cpp @@ -14,10 +14,11 @@ #include "util.h" #include "lang.h" #include "ime_dialog.h" -#include "IconsFontAwesome6.h" +#include "IconsFontAwesome6.h" #include "OpenFontIcons.h" #include "textures.h" #include "sfo.h" +#include "system.h" #define MAX_IMAGE_HEIGHT 980 #define MAX_IMAGE_WIDTH 1820 @@ -46,6 +47,8 @@ static char txt_http_server_port[6]; bool handle_updates = false; int64_t bytes_transfered; int64_t bytes_to_download; +OrbisTick prev_tick; + std::vector local_files; std::vector remote_files; std::set multi_selected_local_files; @@ -1403,9 +1406,18 @@ namespace Windows if (file_transfering) { static float progress = 0.0f; + static double transfer_speed = 0.0f; static char progress_text[32]; + static OrbisTick cur_tick; + static double tick_delta; + + sceRtcGetCurrentTick(&cur_tick); + tick_delta = (cur_tick.mytick - prev_tick.mytick) * 1.0f / 1000000.0f; + progress = bytes_transfered * 1.0f / (float)bytes_to_download; - sprintf(progress_text, "%.2f%%", progress*100.0f); + transfer_speed = (bytes_transfered * 1.0f / tick_delta) / 1048576.0f; + + sprintf(progress_text, "%.2fMB/s", transfer_speed); ImGui::ProgressBar(progress, ImVec2(625, 0), progress_text); } diff --git a/source/windows.h b/source/windows.h index c778c08..5c5d692 100644 --- a/source/windows.h +++ b/source/windows.h @@ -1,5 +1,5 @@ -#ifndef LAUNCHER_WINDOWS_H -#define LAUNCHER_WINDOWS_H +#ifndef EZ_WINDOWS_H +#define EZ_WINDOWS_H #define IMGUI_DEFINE_MATH_OPERATORS #include @@ -7,6 +7,7 @@ #include "imgui_internal.h" #include "common.h" #include "actions.h" +#include "system.h" #include "SDL2/SDL.h" #define LOCAL_BROWSER 1 @@ -16,6 +17,7 @@ extern int view_mode; extern bool handle_updates; extern int64_t bytes_transfered; extern int64_t bytes_to_download; +extern OrbisTick prev_tick; extern std::vector local_files; extern std::vector remote_files; extern std::set multi_selected_local_files; diff --git a/source/zip_util.cpp b/source/zip_util.cpp index 275971d..c9e9cb8 100644 --- a/source/zip_util.cpp +++ b/source/zip_util.cpp @@ -72,6 +72,8 @@ namespace ZipUtil convertToZipTime(file_stat.st_mtim.tv_sec, &zi.tmz_date); bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); + bytes_to_download = file_stat.st_size; // Large file? @@ -290,6 +292,7 @@ namespace ZipUtil ssize_t len; unsigned char *buffer = (unsigned char *) malloc(ARCHIVE_TRANSFER_SIZE); bytes_transfered = 0; + sceRtcGetCurrentTick(&prev_tick); /* loop over file contents and write to fd */ for (int n = 0;; n++) diff --git a/source/zip_util.h b/source/zip_util.h index 0bc6053..aae8261 100644 --- a/source/zip_util.h +++ b/source/zip_util.h @@ -1,5 +1,5 @@ -#ifndef ZIP_UTIL_H -#define ZIP_UTIL_H +#ifndef EZ_ZIP_UTIL_H +#define EZ_ZIP_UTIL_H #include #include