mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-02 16:49:05 +00:00
Some inline + remove useless const&.
This commit is contained in:
@@ -45,10 +45,10 @@ extern curl_off_t downloadNow;
|
||||
/*
|
||||
Draw the progressbar.
|
||||
|
||||
const u64 ¤tProgress: Const Reference to the current progress.
|
||||
const u64 &totalProgress: Const Reference to the total progress.
|
||||
u64 currentProgress: The current progress.
|
||||
u64 totalProgress: The total progress.
|
||||
*/
|
||||
void Animation::DrawProgressBar(const u64 ¤tProgress, const u64 &totalProgress) {
|
||||
void Animation::DrawProgressBar(u64 currentProgress, u64 totalProgress) {
|
||||
Gui::Draw_Rect(30, 120, 340, 30, PROGRESSBAR_OUT_COLOR);
|
||||
Gui::Draw_Rect(31, 121, (int)(((float)currentProgress / (float)totalProgress) * 338.0f), 28, PROGRESSBAR_IN_COLOR);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "cia.hpp"
|
||||
#include "files.hpp"
|
||||
|
||||
Result CIA_LaunchTitle(const u64 &titleId, const FS_MediaType &mediaType) {
|
||||
Result CIA_LaunchTitle(u64 titleId, FS_MediaType mediaType) {
|
||||
Result ret = 0;
|
||||
u8 param[0x300];
|
||||
u8 hmac[0x20];
|
||||
@@ -45,7 +45,7 @@ Result CIA_LaunchTitle(const u64 &titleId, const FS_MediaType &mediaType) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result deletePrevious(const u64 &titleid, const FS_MediaType &media) {
|
||||
Result deletePrevious(u64 titleid, FS_MediaType media) {
|
||||
Result ret = 0;
|
||||
u32 titles_amount = 0;
|
||||
|
||||
@@ -82,7 +82,7 @@ Result deletePrevious(const u64 &titleid, const FS_MediaType &media) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
FS_MediaType getTitleDestination(const u64 &titleId) {
|
||||
FS_MediaType getTitleDestination(u64 titleId) {
|
||||
u16 platform = (u16) ((titleId >> 48) & 0xFFFF);
|
||||
u16 category = (u16) ((titleId >> 32) & 0xFFFF);
|
||||
u8 variation = (u8) (titleId & 0xFF);
|
||||
@@ -93,7 +93,7 @@ FS_MediaType getTitleDestination(const u64 &titleId) {
|
||||
|
||||
u32 installSize = 0, installOffset = 0;
|
||||
|
||||
Result installCia(const char *ciaPath, const bool &updatingSelf) {
|
||||
Result installCia(const char *ciaPath, bool updatingSelf) {
|
||||
u32 bytes_read = 0, bytes_written;
|
||||
installSize = 0, installOffset = 0; u64 size = 0;
|
||||
Handle ciaHandle, fileHandle;
|
||||
|
||||
@@ -314,9 +314,9 @@ static Result setupContext(CURL *hnd, const char *url) {
|
||||
const std::string &url: Const Reference to the URL. (https://github.com/Owner/Repo)
|
||||
const std::string &asset: Const Reference to the Asset. (File.filetype)
|
||||
const std::string &path: Const Reference, where to store. (sdmc:/File.filetype)
|
||||
const bool &includePrereleases: Const Reference, if including Pre-Releases.
|
||||
bool includePrereleases: If including Pre-Releases.
|
||||
*/
|
||||
Result downloadFromRelease(const std::string &url, const std::string &asset, const std::string &path, const bool &includePrereleases) {
|
||||
Result downloadFromRelease(const std::string &url, const std::string &asset, const std::string &path, bool includePrereleases) {
|
||||
Result ret = 0;
|
||||
CURL *hnd;
|
||||
|
||||
@@ -446,9 +446,9 @@ void notConnectedMsg(void) { Msg::waitMsg(Lang::get("CONNECT_WIFI")); }
|
||||
Return, if an update is available.
|
||||
|
||||
const std::string &URL: Const Reference to the URL of the UniStore.
|
||||
const int &revCurrent: Const Reference to the current Revision. (-1 if unused)
|
||||
int revCurrent: The current Revision. (-1 if unused)
|
||||
*/
|
||||
bool IsUpdateAvailable(const std::string &URL, const int &revCurrent) {
|
||||
bool IsUpdateAvailable(const std::string &URL, int revCurrent) {
|
||||
Msg::DisplayMsg(Lang::get("CHECK_UNISTORE_UPDATES"));
|
||||
Result ret = 0;
|
||||
|
||||
@@ -524,11 +524,12 @@ bool IsUpdateAvailable(const std::string &URL, const int &revCurrent) {
|
||||
Download a UniStore and return, if revision is higher than current.
|
||||
|
||||
const std::string &URL: Const Reference to the URL of the UniStore.
|
||||
const int ¤tRev: Const Reference to the current Revision. (-1 if unused)
|
||||
const bool &isDownload: Const Reference, if download or updating.
|
||||
const bool &isUDB: Const Reference, if Universal-DB download or not.
|
||||
int currentRev: Const Reference to the current Revision. (-1 if unused)
|
||||
std::string &fl: Output for the filepath.
|
||||
bool isDownload: If download or updating.
|
||||
bool isUDB: If Universal-DB download or not.
|
||||
*/
|
||||
bool DownloadUniStore(const std::string &URL, const int ¤tRev, std::string &fl, const bool &isDownload, const bool &isUDB) {
|
||||
bool DownloadUniStore(const std::string &URL, int currentRev, std::string &fl, bool isDownload, bool isUDB) {
|
||||
if (isUDB) Msg::DisplayMsg(Lang::get("DOWNLOADING_UNIVERSAL_DB"));
|
||||
else {
|
||||
if (currentRev > -1) Msg::DisplayMsg(Lang::get("CHECK_UNISTORE_UPDATES"));
|
||||
|
||||
@@ -76,7 +76,7 @@ Result makeDirs(const char *path) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
Result openFile(Handle *fileHandle, const char *path, const bool &write) {
|
||||
Result openFile(Handle *fileHandle, const char *path, bool write) {
|
||||
FS_ArchiveID archive;
|
||||
FS_Path filePath = getPathInfo(path, &archive);
|
||||
u32 flags = (write ? (FS_OPEN_CREATE | FS_OPEN_WRITE) : FS_OPEN_READ);
|
||||
|
||||
@@ -67,7 +67,7 @@ Result ScriptUtils::removeFile(const std::string &file, const std::string &messa
|
||||
/*
|
||||
Boot a title.
|
||||
*/
|
||||
void ScriptUtils::bootTitle(const std::string &TitleID, const bool &isNAND, const std::string &message) {
|
||||
void ScriptUtils::bootTitle(const std::string &TitleID, bool isNAND, const std::string &message) {
|
||||
std::string MSG = Lang::get("BOOT_TITLE") + "\n\n";
|
||||
if (isNAND) MSG += Lang::get("MEDIATYPE_NAND") + "\n" + TitleID;
|
||||
else MSG += Lang::get("MEDIATYPE_SD") + "\n" + TitleID;
|
||||
@@ -151,7 +151,7 @@ Result ScriptUtils::renameFile(const std::string &oldName, const std::string &ne
|
||||
/*
|
||||
Download from GitHub Release.
|
||||
*/
|
||||
Result ScriptUtils::downloadRelease(const std::string &repo, const std::string &file, const std::string &output, const bool &includePrereleases, const std::string &message) {
|
||||
Result ScriptUtils::downloadRelease(const std::string &repo, const std::string &file, const std::string &output, bool includePrereleases, const std::string &message) {
|
||||
std::string out;
|
||||
out = std::regex_replace(output, std::regex("%3DSX%"), config->_3dsxPath());
|
||||
out = std::regex_replace(out, std::regex("%NDS%"), config->ndsPath());
|
||||
@@ -218,7 +218,7 @@ Result ScriptUtils::downloadFile(const std::string &file, const std::string &out
|
||||
/*
|
||||
Install CIA files.
|
||||
*/
|
||||
void ScriptUtils::installFile(const std::string &file, const bool &updatingSelf, const std::string &message) {
|
||||
void ScriptUtils::installFile(const std::string &file, bool updatingSelf, const std::string &message) {
|
||||
std::string in;
|
||||
in = std::regex_replace(file, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
|
||||
in = std::regex_replace(in, std::regex("%3DSX%"), config->_3dsxPath());
|
||||
@@ -269,7 +269,7 @@ void ScriptUtils::extractFile(const std::string &file, const std::string &input,
|
||||
/*
|
||||
Execute | run the script.
|
||||
*/
|
||||
Result ScriptUtils::runFunctions(const nlohmann::json &storeJson, const int &selection, const std::string &entry) {
|
||||
Result ScriptUtils::runFunctions(nlohmann::json storeJson, int selection, const std::string &entry) {
|
||||
Result ret = NONE; // No Error as of yet.
|
||||
|
||||
if (!storeJson.contains("storeContent")) { Msg::waitMsg(Lang::get("SYNTAX_ERROR")); return SYNTAX_ERROR; };
|
||||
|
||||
@@ -64,7 +64,7 @@ std::string StringUtils::FetchStringsFromVector(const std::vector<std::string> &
|
||||
/*
|
||||
adapted from GM9i's byte parsing.
|
||||
*/
|
||||
std::string StringUtils::formatBytes(const int bytes) {
|
||||
std::string StringUtils::formatBytes(int bytes) {
|
||||
char out[32];
|
||||
|
||||
if (bytes == 1) snprintf(out, sizeof(out), "%d Byte", bytes);
|
||||
|
||||
Reference in New Issue
Block a user