From 83228a2911f27a6b58ec7fb644af68cbfce790bf Mon Sep 17 00:00:00 2001 From: J-D-K Date: Sat, 15 Apr 2023 05:37:19 -0400 Subject: [PATCH] Libnx update --- .Makefile.kate-swp | Bin 0 -> 129 bytes Makefile | 2 +- inc/data.h | 4 ++-- inc/util.h | 2 -- src/data.cpp | 4 ++-- src/fs/zip.cpp | 9 +++---- src/gd.cpp | 10 ++++---- src/ui/fld.cpp | 4 ---- src/ui/ttl.cpp | 6 ++--- src/util.cpp | 58 --------------------------------------------- 10 files changed, 15 insertions(+), 84 deletions(-) create mode 100644 .Makefile.kate-swp diff --git a/.Makefile.kate-swp b/.Makefile.kate-swp new file mode 100644 index 0000000000000000000000000000000000000000..2450e76d00aae68e68c959c5282bb1be6b3dbda6 GIT binary patch literal 129 zcmZQzU=Z?7EJ;-eE>A2_aLdd|RWQ;sU|?Vn`83C6$x%+r+m b.playStats.playtimeMinutes; + return a.playStats.playtime > b.playStats.playtime; break; case cfg::LAST_PLAYED: - return a.playStats.last_timestampUser > b.playStats.last_timestampUser; + return a.playStats.last_timestamp_user> b.playStats.last_timestamp_user; break; } return false; diff --git a/src/fs/zip.cpp b/src/fs/zip.cpp index 10fae2d..069aa9b 100644 --- a/src/fs/zip.cpp +++ b/src/fs/zip.cpp @@ -25,9 +25,6 @@ static void writeFileFromZip_t(void *a) std::vector localBuffer; unsigned int written = 0, journalCount = 0; - data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - uint64_t journalSpace = fs::getJournalSize(utinfo); - FILE *out = fopen(in->dst.c_str(), "wb"); while(written < in->fileSize) { @@ -79,8 +76,8 @@ void fs::copyDirToZip(const std::string& src, zipFile dst, bool trimPath, int tr time_t raw; time(&raw); tm *locTime = localtime(&raw); - zip_fileinfo inf = { (unsigned)locTime->tm_sec, (unsigned)locTime->tm_min, (unsigned)locTime->tm_hour, - (unsigned)locTime->tm_mday, (unsigned)locTime->tm_mon, (unsigned)(1900 + locTime->tm_year), 0, 0, 0 }; + zip_fileinfo inf = { locTime->tm_sec, locTime->tm_min, locTime->tm_hour, + locTime->tm_mday, locTime->tm_mon, (1900 + locTime->tm_year), 0, 0, 0 }; std::string filename = src + itm; size_t zipNameStart = 0; @@ -155,7 +152,7 @@ void fs::copyZipToDir(unzFile src, const std::string& dst, const std::string& de c = (fs::copyArgs *)t->argPtr; data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - uint64_t journalSize = getJournalSize(utinfo), writeCount = 0; + uint64_t journalSize = getJournalSize(utinfo); char filename[FS_MAX_PATH]; uint8_t *buff = new uint8_t[BUFF_SIZE]; int readIn = 0; diff --git a/src/gd.cpp b/src/gd.cpp index c9cd947..bc2f90b 100644 --- a/src/gd.cpp +++ b/src/gd.cpp @@ -52,7 +52,7 @@ static void writeThread_t(void *a) { dlWriteThreadStruct *in = (dlWriteThreadStruct *)a; std::vector localBuff; - int written = 0; + unsigned written = 0; FILE *out = fopen(in->cfa->path.c_str(), "wb"); @@ -98,8 +98,6 @@ static size_t writeDataBufferThreaded(uint8_t *buff, size_t sz, size_t cnt, void bool drive::gd::exhangeAuthCode(const std::string& _authCode) { - bool ret = false; - // Header curl_slist *postHeader = NULL; postHeader = curl_slist_append(postHeader, HEADER_CONTENT_TYPE_APP_JSON); @@ -140,7 +138,6 @@ bool drive::gd::exhangeAuthCode(const std::string& _authCode) { token = json_object_get_string(accessToken); rToken = json_object_get_string(refreshToken); - ret = true; } else writeDriveError("exchangeAuthCode", jsonResp->c_str()); @@ -647,7 +644,8 @@ void drive::gd::downloadFile(const std::string& _fileID, curlFuncs::curlDlArgs * curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeDataBufferThreaded); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &dlWrite); threadStart(&writeThread); - int error = curl_easy_perform(curl); + + curl_easy_perform(curl); threadWaitForExit(&writeThread); threadClose(&writeThread); @@ -675,7 +673,7 @@ void drive::gd::deleteFile(const std::string& _fileID) curl_easy_setopt(curl, CURLOPT_USERAGENT, userAgent); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, delHeaders); curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); - int error = curl_easy_perform(curl); + curl_easy_perform(curl); for(unsigned i = 0; i < driveList.size(); i++) { diff --git a/src/ui/fld.cpp b/src/ui/fld.cpp index 54e696d..11bed8c 100644 --- a/src/ui/fld.cpp +++ b/src/ui/fld.cpp @@ -88,7 +88,6 @@ static void fldFuncUpload_t(void *a) fsSetPriority(FsPriority_Realtime); data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - data::titleInfo *tinfo = data::getTitleInfoByTID(utinfo->tid); std::string path, tmpZip, filename;//Final path to upload from if(cfg::config["ovrClk"]) @@ -164,7 +163,6 @@ static void fldFuncDownload_t(void *a) threadInfo *t = (threadInfo *)a; drive::gdItem *in = (drive::gdItem *)t->argPtr; data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - data::titleInfo *tinfo = data::getTitleInfoByTID(utinfo->tid); std::string targetPath = util::generatePathByTID(utinfo->tid) + in->name; t->status->setStatus(ui::getUICString("threadStatusDownloadingFile", 0), in->name.c_str()); @@ -206,7 +204,6 @@ static void fldFuncDownload(void *a) { drive::gdItem *in = (drive::gdItem *)a; data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - data::titleInfo *tinfo = data::getTitleInfoByTID(utinfo->tid); std::string testPath = util::generatePathByTID(utinfo->tid) + in->name; if(fs::fileExists(testPath)) { @@ -359,7 +356,6 @@ void ui::fldRefreshMenu() fldMenu->reset(); data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - data::titleInfo *tinfo = data::getTitleInfoByTID(utinfo->tid); std::string targetDir = util::generatePathByTID(utinfo->tid); fldList->reassign(targetDir); diff --git a/src/ui/ttl.cpp b/src/ui/ttl.cpp index 4c4ea58..8d88505 100644 --- a/src/ui/ttl.cpp +++ b/src/ui/ttl.cpp @@ -296,14 +296,14 @@ static void infoPanelDraw(void *a) drawY += 40; uint32_t hours, mins; - hours = d->playStats.playtimeMinutes / 60; - mins = d->playStats.playtimeMinutes - (hours * 60); + hours = ((d->playStats.playtime / 1e+9) / 60) / 60; + mins = ((d->playStats.playtime / 1e+9) / 60) - (hours * 60); gfx::drawRect(panel, &ui::rectLt, 10, drawY, rectWidth, 38); gfx::drawTextf(panel, 18, 20, drawY + 10, &ui::txtCont, ui::getUICString("infoStatus", 2), hours, mins); drawY += 40; gfx::drawRect(panel, &ui::rectSh, 10, drawY, rectWidth, 38); - gfx::drawTextf(panel, 18, 20, drawY + 10, &ui::txtCont, ui::getUICString("infoStatus", 3), d->playStats.totalLaunches); + gfx::drawTextf(panel, 18, 20, drawY + 10, &ui::txtCont, ui::getUICString("infoStatus", 3), d->playStats.total_launches); drawY += 40; gfx::drawRect(panel, &ui::rectLt, 10, drawY, rectWidth, 38); diff --git a/src/util.cpp b/src/util.cpp index 88fed8c..2092b91 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -191,64 +191,6 @@ static inline std::string getTimeString(const uint32_t& _h, const uint32_t& _m) return std::string(tmp); } -std::string util::getInfoString(data::user& u, const uint64_t& tid) -{ - data::titleInfo *tinfo = data::getTitleInfoByTID(tid); - data::userTitleInfo *userTinfo = data::getCurrentUserTitleInfo(); - - std::string ret = tinfo->title + "\n"; - - ret += ui::getUICString("infoStatus", 0) + util::getIDStr(tid) + "\n"; - ret += ui::getUICString("infoStatus", 1) + util::getIDStr(userTinfo->saveInfo.save_data_id) + "\n"; - - uint32_t hours, mins; - hours = userTinfo->playStats.playtimeMinutes / 60; - mins = userTinfo->playStats.playtimeMinutes - (hours * 60); - - ret += ui::getUICString("infoStatus", 2) + getTimeString(hours, mins) + "\n"; - ret += ui::getUICString("infoStatus", 3) + std::to_string(userTinfo->playStats.totalLaunches) + "\n"; - - - switch(userTinfo->saveInfo.save_data_type) - { - case FsSaveDataType_System: - ret += ui::getUICString("saveDataTypeText", 0); - break; - - case FsSaveDataType_Account: - ret += ui::getUICString("saveDataTypeText", 1); - break; - - case FsSaveDataType_Bcat: - ret += ui::getUICString("saveDataTypeText", 2); - break; - - case FsSaveDataType_Device: - ret += ui::getUICString("saveDataTypeText", 3); - break; - - case FsSaveDataType_Temporary: - ret += ui::getUICString("saveDataTypeText", 4); - break; - - case FsSaveDataType_Cache: - { - data::userTitleInfo *d = data::getCurrentUserTitleInfo(); - ret += ui::getUICString("saveDataTypeText", 5); - ret += ui::getUICString("saveDataIndexText", 0) + std::to_string(d->saveInfo.save_data_index) + "\n"; - } - break; - - case FsSaveDataType_SystemBcat: - ret += ui::getUICString("saveDataTypeText", 6); - break; - } - - ret += u.getUsername(); - - return ret; -} - std::string util::getStringInput(SwkbdType _type, const std::string& def, const std::string& head, size_t maxLength, unsigned dictCnt, const std::string dictWords[]) { SwkbdConfig swkbd;