mirror of
https://github.com/J-D-K/JKSV.git
synced 2026-04-26 10:15:22 -05:00
Libnx update
This commit is contained in:
parent
09f610b3c9
commit
83228a2911
BIN
.Makefile.kate-swp
Normal file
BIN
.Makefile.kate-swp
Normal file
Binary file not shown.
2
Makefile
2
Makefile
|
|
@ -38,7 +38,7 @@ INCLUDES := inc inc/ui inc/fs
|
||||||
EXEFS_SRC := exefs_src
|
EXEFS_SRC := exefs_src
|
||||||
APP_TITLE := JKSV
|
APP_TITLE := JKSV
|
||||||
APP_AUTHOR := JK
|
APP_AUTHOR := JK
|
||||||
APP_VERSION := 02.12.2023
|
APP_VERSION := 02.23.2023
|
||||||
ROMFS := romfs
|
ROMFS := romfs
|
||||||
ICON := icon.jpg
|
ICON := icon.jpg
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
#include "gfx.h"
|
#include "gfx.h"
|
||||||
|
|
||||||
#define BLD_MON 02
|
#define BLD_MON 02
|
||||||
#define BLD_DAY 12
|
#define BLD_DAY 23
|
||||||
#define BLD_YEAR 2023
|
#define BLD_YEAR 2023
|
||||||
|
|
||||||
namespace data
|
namespace data
|
||||||
|
|
@ -99,4 +99,4 @@ namespace data
|
||||||
SDL_Texture *getTitleIconByTID(const uint64_t& tid);
|
SDL_Texture *getTitleIconByTID(const uint64_t& tid);
|
||||||
int getTitleIndexInUser(const data::user& u, const uint64_t& tid);
|
int getTitleIndexInUser(const data::user& u, const uint64_t& tid);
|
||||||
extern SetLanguage sysLang;
|
extern SetLanguage sysLang;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,8 +84,6 @@ namespace util
|
||||||
}
|
}
|
||||||
std::string safeString(const std::string& s);
|
std::string safeString(const std::string& s);
|
||||||
|
|
||||||
std::string getInfoString(data::user& u, const uint64_t& tid);
|
|
||||||
|
|
||||||
std::string getStringInput(SwkbdType _type, const std::string& def, const std::string& head, size_t maxLength, unsigned dictCnt, const std::string dictWords[]);
|
std::string getStringInput(SwkbdType _type, const std::string& def, const std::string& head, size_t maxLength, unsigned dictCnt, const std::string dictWords[]);
|
||||||
|
|
||||||
std::string getExtensionFromString(const std::string& get);
|
std::string getExtensionFromString(const std::string& get);
|
||||||
|
|
|
||||||
|
|
@ -58,11 +58,11 @@ static struct
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case cfg::MOST_PLAYED:
|
case cfg::MOST_PLAYED:
|
||||||
return a.playStats.playtimeMinutes > b.playStats.playtimeMinutes;
|
return a.playStats.playtime > b.playStats.playtime;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case cfg::LAST_PLAYED:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,6 @@ static void writeFileFromZip_t(void *a)
|
||||||
std::vector<uint8_t> localBuffer;
|
std::vector<uint8_t> localBuffer;
|
||||||
unsigned int written = 0, journalCount = 0;
|
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");
|
FILE *out = fopen(in->dst.c_str(), "wb");
|
||||||
while(written < in->fileSize)
|
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_t raw;
|
||||||
time(&raw);
|
time(&raw);
|
||||||
tm *locTime = localtime(&raw);
|
tm *locTime = localtime(&raw);
|
||||||
zip_fileinfo inf = { (unsigned)locTime->tm_sec, (unsigned)locTime->tm_min, (unsigned)locTime->tm_hour,
|
zip_fileinfo inf = { locTime->tm_sec, locTime->tm_min, locTime->tm_hour,
|
||||||
(unsigned)locTime->tm_mday, (unsigned)locTime->tm_mon, (unsigned)(1900 + locTime->tm_year), 0, 0, 0 };
|
locTime->tm_mday, locTime->tm_mon, (1900 + locTime->tm_year), 0, 0, 0 };
|
||||||
|
|
||||||
std::string filename = src + itm;
|
std::string filename = src + itm;
|
||||||
size_t zipNameStart = 0;
|
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;
|
c = (fs::copyArgs *)t->argPtr;
|
||||||
|
|
||||||
data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo();
|
data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo();
|
||||||
uint64_t journalSize = getJournalSize(utinfo), writeCount = 0;
|
uint64_t journalSize = getJournalSize(utinfo);
|
||||||
char filename[FS_MAX_PATH];
|
char filename[FS_MAX_PATH];
|
||||||
uint8_t *buff = new uint8_t[BUFF_SIZE];
|
uint8_t *buff = new uint8_t[BUFF_SIZE];
|
||||||
int readIn = 0;
|
int readIn = 0;
|
||||||
|
|
|
||||||
10
src/gd.cpp
10
src/gd.cpp
|
|
@ -52,7 +52,7 @@ static void writeThread_t(void *a)
|
||||||
{
|
{
|
||||||
dlWriteThreadStruct *in = (dlWriteThreadStruct *)a;
|
dlWriteThreadStruct *in = (dlWriteThreadStruct *)a;
|
||||||
std::vector<uint8_t> localBuff;
|
std::vector<uint8_t> localBuff;
|
||||||
int written = 0;
|
unsigned written = 0;
|
||||||
|
|
||||||
FILE *out = fopen(in->cfa->path.c_str(), "wb");
|
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 drive::gd::exhangeAuthCode(const std::string& _authCode)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
curl_slist *postHeader = NULL;
|
curl_slist *postHeader = NULL;
|
||||||
postHeader = curl_slist_append(postHeader, HEADER_CONTENT_TYPE_APP_JSON);
|
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);
|
token = json_object_get_string(accessToken);
|
||||||
rToken = json_object_get_string(refreshToken);
|
rToken = json_object_get_string(refreshToken);
|
||||||
ret = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
writeDriveError("exchangeAuthCode", jsonResp->c_str());
|
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_WRITEFUNCTION, writeDataBufferThreaded);
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &dlWrite);
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &dlWrite);
|
||||||
threadStart(&writeThread);
|
threadStart(&writeThread);
|
||||||
int error = curl_easy_perform(curl);
|
|
||||||
|
curl_easy_perform(curl);
|
||||||
|
|
||||||
threadWaitForExit(&writeThread);
|
threadWaitForExit(&writeThread);
|
||||||
threadClose(&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_USERAGENT, userAgent);
|
||||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, delHeaders);
|
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, delHeaders);
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
|
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++)
|
for(unsigned i = 0; i < driveList.size(); i++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,6 @@ static void fldFuncUpload_t(void *a)
|
||||||
fsSetPriority(FsPriority_Realtime);
|
fsSetPriority(FsPriority_Realtime);
|
||||||
|
|
||||||
data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo();
|
data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo();
|
||||||
data::titleInfo *tinfo = data::getTitleInfoByTID(utinfo->tid);
|
|
||||||
std::string path, tmpZip, filename;//Final path to upload from
|
std::string path, tmpZip, filename;//Final path to upload from
|
||||||
|
|
||||||
if(cfg::config["ovrClk"])
|
if(cfg::config["ovrClk"])
|
||||||
|
|
@ -164,7 +163,6 @@ static void fldFuncDownload_t(void *a)
|
||||||
threadInfo *t = (threadInfo *)a;
|
threadInfo *t = (threadInfo *)a;
|
||||||
drive::gdItem *in = (drive::gdItem *)t->argPtr;
|
drive::gdItem *in = (drive::gdItem *)t->argPtr;
|
||||||
data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo();
|
data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo();
|
||||||
data::titleInfo *tinfo = data::getTitleInfoByTID(utinfo->tid);
|
|
||||||
std::string targetPath = util::generatePathByTID(utinfo->tid) + in->name;
|
std::string targetPath = util::generatePathByTID(utinfo->tid) + in->name;
|
||||||
t->status->setStatus(ui::getUICString("threadStatusDownloadingFile", 0), in->name.c_str());
|
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;
|
drive::gdItem *in = (drive::gdItem *)a;
|
||||||
data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo();
|
data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo();
|
||||||
data::titleInfo *tinfo = data::getTitleInfoByTID(utinfo->tid);
|
|
||||||
std::string testPath = util::generatePathByTID(utinfo->tid) + in->name;
|
std::string testPath = util::generatePathByTID(utinfo->tid) + in->name;
|
||||||
if(fs::fileExists(testPath))
|
if(fs::fileExists(testPath))
|
||||||
{
|
{
|
||||||
|
|
@ -359,7 +356,6 @@ void ui::fldRefreshMenu()
|
||||||
|
|
||||||
fldMenu->reset();
|
fldMenu->reset();
|
||||||
data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo();
|
data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo();
|
||||||
data::titleInfo *tinfo = data::getTitleInfoByTID(utinfo->tid);
|
|
||||||
std::string targetDir = util::generatePathByTID(utinfo->tid);
|
std::string targetDir = util::generatePathByTID(utinfo->tid);
|
||||||
|
|
||||||
fldList->reassign(targetDir);
|
fldList->reassign(targetDir);
|
||||||
|
|
|
||||||
|
|
@ -296,14 +296,14 @@ static void infoPanelDraw(void *a)
|
||||||
drawY += 40;
|
drawY += 40;
|
||||||
|
|
||||||
uint32_t hours, mins;
|
uint32_t hours, mins;
|
||||||
hours = d->playStats.playtimeMinutes / 60;
|
hours = ((d->playStats.playtime / 1e+9) / 60) / 60;
|
||||||
mins = d->playStats.playtimeMinutes - (hours * 60);
|
mins = ((d->playStats.playtime / 1e+9) / 60) - (hours * 60);
|
||||||
gfx::drawRect(panel, &ui::rectLt, 10, drawY, rectWidth, 38);
|
gfx::drawRect(panel, &ui::rectLt, 10, drawY, rectWidth, 38);
|
||||||
gfx::drawTextf(panel, 18, 20, drawY + 10, &ui::txtCont, ui::getUICString("infoStatus", 2), hours, mins);
|
gfx::drawTextf(panel, 18, 20, drawY + 10, &ui::txtCont, ui::getUICString("infoStatus", 2), hours, mins);
|
||||||
drawY += 40;
|
drawY += 40;
|
||||||
|
|
||||||
gfx::drawRect(panel, &ui::rectSh, 10, drawY, rectWidth, 38);
|
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;
|
drawY += 40;
|
||||||
|
|
||||||
gfx::drawRect(panel, &ui::rectLt, 10, drawY, rectWidth, 38);
|
gfx::drawRect(panel, &ui::rectLt, 10, drawY, rectWidth, 38);
|
||||||
|
|
|
||||||
58
src/util.cpp
58
src/util.cpp
|
|
@ -191,64 +191,6 @@ static inline std::string getTimeString(const uint32_t& _h, const uint32_t& _m)
|
||||||
return std::string(tmp);
|
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[])
|
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;
|
SwkbdConfig swkbd;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user