From ddbea3ab36f78495525f6033539d53940dcaf7c4 Mon Sep 17 00:00:00 2001 From: StackZ <47382115+SuperSaiyajinStackZ@users.noreply.github.com> Date: Fri, 6 Nov 2020 02:10:58 +0100 Subject: [PATCH] Some inline + remove useless const&. --- include/common.hpp | 4 ++- include/gui/gfx.hpp | 7 ++-- include/store/meta.hpp | 10 +++--- include/store/store.hpp | 20 +++++------ include/store/storeEntry.hpp | 6 ++-- include/store/storeUtils.hpp | 32 ++++++++--------- include/utils/animation.hpp | 2 +- include/utils/cia.hpp | 6 ++-- include/utils/download.hpp | 6 ++-- include/utils/files.hpp | 2 +- include/utils/scriptUtils.hpp | 8 ++--- include/utils/stringutils.hpp | 2 +- source/gui/gfx.cpp | 34 +++++++++--------- source/init.cpp | 5 ++- source/qr/decode.cpp | 1 - source/screens/mainScreen.cpp | 17 +++++---- source/store/downList.cpp | 9 ++--- source/store/entryInfo.cpp | 5 +-- source/store/grid.cpp | 11 +++--- source/store/list.cpp | 5 +-- source/store/markMenu.cpp | 9 ++--- source/store/meta.cpp | 20 +++++------ source/store/searchMenu.cpp | 11 +++--- source/store/settings.cpp | 66 +++++++++++++---------------------- source/store/sideMenu.cpp | 8 ++--- source/store/sortMenu.cpp | 15 ++++---- source/store/store.cpp | 40 ++++++++++----------- source/store/storeEntry.cpp | 4 +-- source/store/storeUtils.cpp | 6 ++-- source/utils/animation.cpp | 6 ++-- source/utils/cia.cpp | 8 ++--- source/utils/download.cpp | 17 ++++----- source/utils/files.cpp | 2 +- source/utils/scriptUtils.cpp | 8 ++--- source/utils/stringutils.cpp | 2 +- 35 files changed, 186 insertions(+), 228 deletions(-) diff --git a/include/common.hpp b/include/common.hpp index ccfade9..6961913 100644 --- a/include/common.hpp +++ b/include/common.hpp @@ -27,6 +27,7 @@ #ifndef _UNIVERSAL_UPDATER_COMMON_HPP #define _UNIVERSAL_UPDATER_COMMON_HPP +#include <3ds.h> #include "config.hpp" #include "gfx.hpp" #include "lang.hpp" @@ -37,6 +38,7 @@ inline std::unique_ptr config; #define _STORE_PATH "sdmc:/3ds/Universal-Updater/stores/" #define _META_PATH "sdmc:/3ds/Universal-Updater/MetaData.json" -inline uint32_t hRepeat; +inline uint32_t hRepeat, hDown, hHeld; +inline touchPosition touch; #endif \ No newline at end of file diff --git a/include/gui/gfx.hpp b/include/gui/gfx.hpp index 284fe07..21ce886 100644 --- a/include/gui/gfx.hpp +++ b/include/gui/gfx.hpp @@ -72,10 +72,9 @@ namespace GFX { void DrawTop(void); void DrawBottom(); - void DrawSprite(const int &img, const int &x, const int &y, const float &ScaleX = 1, const float &ScaleY = 1); - void DrawBox(const float &xPos, const float &yPos, const float &width = 50, const float &height = 50, const bool &selected = false, const uint32_t &clr = BOX_INSIDE_COLOR); - void DrawButton(const float &xPos, const float &yPos, const float &width, const float &height, const bool &selected, const std::string &Text = ""); - void DrawCheckbox(const float &xPos, const float &yPos, const bool &selected); + void DrawSprite(int img, int x, int y, float ScaleX = 1, float ScaleY = 1); + void DrawBox(float xPos, float yPos, float width = 50, float height = 50, bool selected = false, uint32_t clr = BOX_INSIDE_COLOR); + void DrawCheckbox(float xPos, float yPos, bool selected); void DrawToggle(float xPos, float yPos, bool toggled); }; diff --git a/include/store/meta.hpp b/include/store/meta.hpp index 89f3fe2..d7bbec9 100644 --- a/include/store/meta.hpp +++ b/include/store/meta.hpp @@ -43,15 +43,15 @@ public: Meta(); ~Meta() { this->SaveCall(); }; - std::string GetUpdated(std::string unistoreName, std::string entry) const; - int GetMarks(std::string unistoreName, std::string entry) const; - bool UpdateAvailable(std::string unistoreName, std::string entry, std::string updated) const; + std::string GetUpdated(const std::string &unistoreName, const std::string &entry) const; + int GetMarks(const std::string &unistoreName, const std::string &entry) const; + bool UpdateAvailable(const std::string &unistoreName, const std::string &entry, const std::string &updated) const; - void SetUpdated(std::string unistoreName, std::string entry, std::string updated) { + void SetUpdated(const std::string &unistoreName, const std::string &entry, const std::string &updated) { this->metadataJson[unistoreName][entry]["updated"] = updated; }; - void SetMarks(std::string unistoreName, std::string entry, int marks) { + void SetMarks(const std::string &unistoreName, const std::string &entry, int marks) { this->metadataJson[unistoreName][entry]["marks"] = marks; }; diff --git a/include/store/store.hpp b/include/store/store.hpp index ad3e819..b27bfb5 100644 --- a/include/store/store.hpp +++ b/include/store/store.hpp @@ -45,17 +45,17 @@ public: std::string GetUniStoreAuthor() const; /* Get Information of the UniStore Entries. */ - std::string GetTitleEntry(const int &index) const; - std::string GetAuthorEntry(const int &index) const; - std::string GetDescriptionEntry(const int &index) const; - std::vector GetCategoryIndex(const int &index) const; - std::string GetVersionEntry(const int &index) const; - std::vector GetConsoleEntry(const int &index) const; - std::string GetLastUpdatedEntry(const int &index) const; - std::string GetLicenseEntry(const int &index) const; - C2D_Image GetIconEntry(const int &index) const; + std::string GetTitleEntry(int index) const; + std::string GetAuthorEntry(int index) const; + std::string GetDescriptionEntry(int index) const; + std::vector GetCategoryIndex(int index) const; + std::string GetVersionEntry(int index) const; + std::vector GetConsoleEntry(int index) const; + std::string GetLastUpdatedEntry(int index) const; + std::string GetLicenseEntry(int index) const; + C2D_Image GetIconEntry(int index) const; - std::vector GetDownloadList(const int &index) const; + std::vector GetDownloadList(int index) const; int GetStoreSize() const { return (int)this->storeJson["storeContent"].size(); }; diff --git a/include/store/storeEntry.hpp b/include/store/storeEntry.hpp index 43664ab..48f22f9 100644 --- a/include/store/storeEntry.hpp +++ b/include/store/storeEntry.hpp @@ -33,7 +33,7 @@ class StoreEntry { public: - StoreEntry(const std::unique_ptr &store, const std::unique_ptr &meta, const int &index); + StoreEntry(const std::unique_ptr &store, const std::unique_ptr &meta, int index); std::string GetTitle() const { return this->Title; }; std::string GetAuthor() const { return this->Author; }; @@ -54,9 +54,9 @@ public: std::vector GetConsoleFull() const { return this->FullConsole; }; bool GetUpdateAvl() const { return this->UpdateAvailable; }; - void SetUpdateAvl(const bool &v) { this->UpdateAvailable = v; }; + void SetUpdateAvl(bool v) { this->UpdateAvailable = v; }; - void SetMark(const int &marks) { + void SetMark(int marks) { this->Marks = marks; this->MarkString = StringUtils::GetMarkString(this->Marks); }; diff --git a/include/store/storeUtils.hpp b/include/store/storeUtils.hpp index cd2ef34..a2f8b2e 100644 --- a/include/store/storeUtils.hpp +++ b/include/store/storeUtils.hpp @@ -41,42 +41,42 @@ enum class SortType : uint8_t { namespace StoreUtils { /* Grid. */ void DrawGrid(const std::unique_ptr &store, const std::vector> &entries); - void GridLogic(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr &store, std::vector> &entries, int ¤tMode, int &lastMode, bool &fetch, int &smallDelay); + void GridLogic(std::unique_ptr &store, std::vector> &entries, int ¤tMode, int &lastMode, bool &fetch, int &smallDelay); /* Top List. */ void DrawList(const std::unique_ptr &store, const std::vector> &entries); - void ListLogic(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr &store, std::vector> &entries, int ¤tMode, int &lastMode, bool &fetch, int &smallDelay); + void ListLogic(std::unique_ptr &store, std::vector> &entries, int ¤tMode, int &lastMode, bool &fetch, int &smallDelay); /* Entry Info. */ void DrawEntryInfo(const std::unique_ptr &store, const std::unique_ptr &entry); - void EntryHandle(u32 hDown, u32 hHeld, touchPosition touch, bool &showMark, bool &fetch); + void EntryHandle(bool &showMark, bool &fetch); /* Side Menu. */ - void DrawSideMenu(const int ¤tMenu); - void SideMenuHandle(u32 hDown, touchPosition touch, int ¤tMenu, bool &fetch); + void DrawSideMenu(int currentMenu); + void SideMenuHandle(int ¤tMenu, bool &fetch); /* Download Entries. */ - void DrawDownList(const std::unique_ptr &store, const std::vector &entries, const bool &fetch); - void DownloadHandle(u32 hDown, u32 hHeld, touchPosition touch, const std::unique_ptr &store, const std::unique_ptr &entry, const std::vector &entries, int ¤tMenu, std::unique_ptr &meta, const int &lastMode, int &smallDelay); + void DrawDownList(const std::unique_ptr &store, const std::vector &entries, bool fetch); + void DownloadHandle(const std::unique_ptr &store, const std::unique_ptr &entry, const std::vector &entries, int ¤tMenu, std::unique_ptr &meta, const int &lastMode, int &smallDelay); /* Search + Favorite Menu. */ - void DrawSearchMenu(const std::vector &searchIncludes, const std::string &searchResult, const int &marks, const bool &updateFilter); - void SearchHandle(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr &store, std::vector> &entries, std::vector &searchIncludes, std::unique_ptr &meta, std::string &searchResult, int &marks, bool &updateFilter, bool ascending, SortType sorttype); + void DrawSearchMenu(const std::vector &searchIncludes, const std::string &searchResult, int marks, bool updateFilter); + void SearchHandle(std::unique_ptr &store, std::vector> &entries, std::vector &searchIncludes, std::unique_ptr &meta, std::string &searchResult, int &marks, bool &updateFilter, bool ascending, SortType sorttype); /* Mark Menu. */ - void DisplayMarkBox(const int &marks); - void MarkHandle(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr &entry, const std::unique_ptr &store, bool &showMark, std::unique_ptr &meta); + void DisplayMarkBox(int marks); + void MarkHandle(std::unique_ptr &entry, const std::unique_ptr &store, bool &showMark, std::unique_ptr &meta); /* Credits. */ void DrawCredits(); /* Settings. */ - void DrawSettings(const int &page, const int &selection, const int &sPos); - void SettingsHandle(u32 hDown, u32 hHeld, touchPosition touch, int &page, bool &dspSettings, int &storeMode, int &selection, std::unique_ptr &store, std::vector> &entries, std::unique_ptr &meta, int &sPos); + void DrawSettings(int page, int selection, int sPos); + void SettingsHandle(int &page, bool &dspSettings, int &storeMode, int &selection, std::unique_ptr &store, std::vector> &entries, std::unique_ptr &meta, int &sPos); /* Sorting. */ - void DrawSorting(const bool &asc, const SortType &st); - void SortHandle(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr &store, std::vector> &entries, bool &asc, SortType &st); + void DrawSorting(bool asc, SortType st); + void SortHandle(std::unique_ptr &store, std::vector> &entries, bool &asc, SortType &st); bool compareTitleDescending(const std::unique_ptr &a, const std::unique_ptr &b); bool compareTitleAscending(const std::unique_ptr &a, const std::unique_ptr &b); @@ -87,7 +87,7 @@ namespace StoreUtils { bool compareUpdateDescending(const std::unique_ptr &a, const std::unique_ptr &b); bool compareUpdateAscending(const std::unique_ptr &a, const std::unique_ptr &b); - void SortEntries(const bool &Ascending, const SortType &sorttype, std::vector> &entries); + void SortEntries(bool Ascending, SortType sorttype, std::vector> &entries); void search(std::vector> &entries, const std::string &query, bool title, bool author, bool category, bool console, int selectedMarks, bool updateAvl); diff --git a/include/utils/animation.hpp b/include/utils/animation.hpp index 204557f..9e050d8 100644 --- a/include/utils/animation.hpp +++ b/include/utils/animation.hpp @@ -38,7 +38,7 @@ enum class ProgressBar { }; namespace Animation { - void DrawProgressBar(const u64 ¤tProgress, const u64 &totalProgress); + void DrawProgressBar(u64 currentProgress, u64 totalProgress); void displayProgressBar(); }; diff --git a/include/utils/cia.hpp b/include/utils/cia.hpp index 8fb7ae3..a78a995 100644 --- a/include/utils/cia.hpp +++ b/include/utils/cia.hpp @@ -31,8 +31,8 @@ #include <3ds.h> -Result CIA_LaunchTitle(const u64 &titleId, const FS_MediaType &mediaType); -Result deletePrevious(const u64 &titleid, const FS_MediaType &media); -Result installCia(const char *ciaPath, const bool &updateSelf); +Result CIA_LaunchTitle(u64 titleId, FS_MediaType mediaType); +Result deletePrevious(u64 titleid, FS_MediaType media); +Result installCia(const char *ciaPath, bool updateSelf); #endif \ No newline at end of file diff --git a/include/utils/download.hpp b/include/utils/download.hpp index a07cb29..af09cde 100644 --- a/include/utils/download.hpp +++ b/include/utils/download.hpp @@ -42,7 +42,7 @@ enum DownloadError { }; Result downloadToFile(const std::string &url, const std::string &path); -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); /* Check Wi-Fi status. @@ -65,8 +65,8 @@ void notImplemented(void); */ void doneMsg(void); -bool IsUpdateAvailable(const std::string &URL, const int &revCurrent); -bool DownloadUniStore(const std::string &URL, const int ¤tRev, std::string &fl, const bool &isDownload = false, const bool &isUDB = false); +bool IsUpdateAvailable(const std::string &URL, int revCurrent); +bool DownloadUniStore(const std::string &URL, int currentRev, std::string &fl, bool isDownload = false, bool isUDB = false); bool DownloadSpriteSheet(const std::string &URL, const std::string &file); bool IsUUUpdateAvailable(); void UpdateAction(); diff --git a/include/utils/files.hpp b/include/utils/files.hpp index b1e58ca..259ce1d 100644 --- a/include/utils/files.hpp +++ b/include/utils/files.hpp @@ -30,7 +30,7 @@ #include "common.hpp" Result makeDirs(const char *path); -Result openFile(Handle *fileHandle, const char *path, const bool &write); +Result openFile(Handle *fileHandle, const char *path, bool write); Result deleteFile(const char *path); Result removeDir(const char *path); Result removeDirRecursive(const char *path); diff --git a/include/utils/scriptUtils.hpp b/include/utils/scriptUtils.hpp index 56d67c5..de792a8 100644 --- a/include/utils/scriptUtils.hpp +++ b/include/utils/scriptUtils.hpp @@ -45,16 +45,16 @@ namespace ScriptUtils { bool matchPattern(const std::string &pattern, const std::string &tested); Result removeFile(const std::string &file, const std::string &message); - void bootTitle(const std::string &TitleID, const bool &isNAND, const std::string &message); + void bootTitle(const std::string &TitleID, bool isNAND, const std::string &message); Result prompt(const std::string &message); Result copyFile(const std::string &source, const std::string &destination, const std::string &message); Result renameFile(const std::string &oldName, const std::string &newName, const std::string &message); - Result downloadRelease(const std::string &repo, const std::string &file, const std::string &output, const bool &includePrereleases, const std::string &message); + Result downloadRelease(const std::string &repo, const std::string &file, const std::string &output, bool includePrereleases, const std::string &message); Result downloadFile(const std::string &file, const std::string &output, const std::string &message); - void installFile(const std::string &file, const bool &updatingSelf, const std::string &message); + void installFile(const std::string &file, bool pdatingSelf, const std::string &message); void extractFile(const std::string &file, const std::string &input, const std::string &output, const std::string &message); - Result runFunctions(const nlohmann::json &storeJson, const int &selection, const std::string &entry); + Result runFunctions(nlohmann::json storeJson, int selection, const std::string &entry); }; #endif \ No newline at end of file diff --git a/include/utils/stringutils.hpp b/include/utils/stringutils.hpp index 6fcf8fa..2baea94 100644 --- a/include/utils/stringutils.hpp +++ b/include/utils/stringutils.hpp @@ -34,7 +34,7 @@ namespace StringUtils { std::string lower_case(const std::string &str); std::string FetchStringsFromVector(const std::vector &fetch); - std::string formatBytes(const int bytes); + std::string formatBytes(int bytes); std::string GetMarkString(int marks); std::vector GetMarks(int marks); }; diff --git a/source/gui/gfx.cpp b/source/gui/gfx.cpp index 09d87eb..bb42478 100644 --- a/source/gui/gfx.cpp +++ b/source/gui/gfx.cpp @@ -48,14 +48,14 @@ void GFX::DrawBottom() { /* Draw the box. - const float &xPos: Const Reference to the X-Position where to draw the box. - const float &yPos: Const Reference to the Y-Position where to draw the box. - const float &width: Const Reference to the Width of the button. - const float &height: Const Reference to the Height of the button. - const bool &selected: Const Reference, if outline is selected (Red) or not (Black). - const uint32_t &clr: (Optional) The color of the inside of the box. + float xPos: The X-Position where to draw the box. + float yPos: The Y-Position where to draw the box. + float width: The Width of the button. + float height: The Height of the button. + bool selected: If selected, or not. + uint32_t clr: (Optional) The color of the inside of the box. */ -void GFX::DrawBox(const float &xPos, const float &yPos, const float &width, const float &height, const bool &selected, const uint32_t &clr) { +void GFX::DrawBox(float xPos, float yPos, float width, float height, bool selected, uint32_t clr) { Gui::Draw_Rect(xPos, yPos, width, height, BOX_INSIDE_COLOR); // Draw middle BG. if (selected) { @@ -73,24 +73,24 @@ extern C2D_SpriteSheet sprites; /* Draw a Sprite of the sprites SpriteSheet. - const int &img: Const Reference to the Image index. - const int &x: Const Reference to the X-Position where to draw. - const int &y: Const Reference to the Y-Position where to draw. - const float &ScaleX: (Optional) Const Reference to the X-Scale of the Sprite. (1 by default) - const float &ScaleY: (Optional) Const Reference to the Y-Scale of the Sprite. (1 by default) + int img: The Image index. + int x: The X-Position where to draw. + int y: The Y-Position where to draw. + float ScaleX: (Optional) The X-Scale of the Sprite. (1 by default) + float ScaleY: (Optional) The Y-Scale of the Sprite. (1 by default) */ -void GFX::DrawSprite(const int &img, const int &x, const int &y, const float &ScaleX, const float &ScaleY) { +void GFX::DrawSprite(int img, int x, int y, float ScaleX, float ScaleY) { Gui::DrawSprite(sprites, img, x, y, ScaleX, ScaleY); } /* Draw the checkbox. - const float &xPos: Const Reference to the X-Position where to draw the box. - const float &yPos: Const Reference to the Y-Position where to draw the box. - const bool &selected: Const Reference, checked or not. + float xPos: The X-Position where to draw the box. + float yPos: The Y-Position where to draw the box. + bool selected: if checked, or not. */ -void GFX::DrawCheckbox(const float &xPos, const float &yPos, const bool &selected) { +void GFX::DrawCheckbox(float xPos, float yPos, bool selected) { GFX::DrawSprite((selected ? sprites_checked_idx : sprites_unchecked_idx), xPos, yPos); } diff --git a/source/init.cpp b/source/init.cpp index aa4a930..4883bc6 100644 --- a/source/init.cpp +++ b/source/init.cpp @@ -33,10 +33,9 @@ #include bool exiting = false, is3DSX = false; -touchPosition touch; C2D_SpriteSheet sprites; int fadeAlpha = 0; -u32 old_time_limit, hDown = 0; +u32 old_time_limit; /* Set, if 3DSX or CIA. @@ -111,7 +110,7 @@ Result Init::MainLoop() { /* Loop as long as the status is not fullExit. */ while (aptMainLoop() && !fullExit) { hidScanInput(); - u32 hHeld = hidKeysHeld(); + hHeld = hidKeysHeld(); hDown = hidKeysDown(); hRepeat = hidKeysDownRepeat(); hidTouchRead(&touch); diff --git a/source/qr/decode.cpp b/source/qr/decode.cpp index 9f8b978..7754110 100644 --- a/source/qr/decode.cpp +++ b/source/qr/decode.cpp @@ -15,7 +15,6 @@ */ #include "quirc_internal.hpp" - #include #include diff --git a/source/screens/mainScreen.cpp b/source/screens/mainScreen.cpp index af72463..9559c18 100644 --- a/source/screens/mainScreen.cpp +++ b/source/screens/mainScreen.cpp @@ -31,7 +31,6 @@ #include extern int fadeAlpha; -extern u32 hRepeat; extern UniStoreInfo GetInfo(const std::string &file, const std::string &fileName); @@ -131,14 +130,14 @@ void MainScreen::Draw(void) const { MainScreen Logic. */ void MainScreen::Logic(u32 hDown, u32 hHeld, touchPosition touch) { - if (this->showMarks) StoreUtils::MarkHandle(hDown, hHeld, touch, this->entries[this->store->GetEntry()], this->store, this->showMarks, this->meta); + if (this->showMarks) StoreUtils::MarkHandle(this->entries[this->store->GetEntry()], this->store, this->showMarks, this->meta); if (!this->showMarks) { if (this->storeMode == 0 || this->storeMode == 2 || this->storeMode == 3) { - config->list() ? StoreUtils::ListLogic(hDown, hHeld, touch, this->store, this->entries, this->storeMode, this->lastMode, this->fetchDown, this->smallDelay) : StoreUtils::GridLogic(hDown, hHeld, touch, this->store, this->entries, this->storeMode, this->lastMode, this->fetchDown, this->smallDelay); + config->list() ? StoreUtils::ListLogic(this->store, this->entries, this->storeMode, this->lastMode, this->fetchDown, this->smallDelay) : StoreUtils::GridLogic(this->store, this->entries, this->storeMode, this->lastMode, this->fetchDown, this->smallDelay); } - StoreUtils::SideMenuHandle(hDown, touch, this->storeMode, this->fetchDown); + StoreUtils::SideMenuHandle(this->storeMode, this->fetchDown); /* Fetch Download list. */ if (this->fetchDown) { @@ -158,23 +157,23 @@ void MainScreen::Logic(u32 hDown, u32 hHeld, touchPosition touch) { switch(this->storeMode) { case 0: - if (this->store && this->store->GetValid()) StoreUtils::EntryHandle(hDown, hHeld, touch, this->showMarks, this->fetchDown); + if (this->store && this->store->GetValid()) StoreUtils::EntryHandle(this->showMarks, this->fetchDown); break; case 1: - if (this->store && this->store->GetValid()) StoreUtils::DownloadHandle(hDown, hHeld, touch, this->store, this->entries[this->store->GetEntry()], this->dwnldList, this->storeMode, this->meta, this->lastMode, this->smallDelay); + if (this->store && this->store->GetValid()) StoreUtils::DownloadHandle(this->store, this->entries[this->store->GetEntry()], this->dwnldList, this->storeMode, this->meta, this->lastMode, this->smallDelay); break; case 2: - StoreUtils::SearchHandle(hDown, hHeld, touch, this->store, this->entries, this->searchIncludes, this->meta, this->searchResult, this->marks, this->updateFilter, this->ascending, this->sorttype); + StoreUtils::SearchHandle(this->store, this->entries, this->searchIncludes, this->meta, this->searchResult, this->marks, this->updateFilter, this->ascending, this->sorttype); break; case 3: - StoreUtils::SortHandle(hDown, hHeld, touch, this->store, this->entries, this->ascending, this->sorttype); + StoreUtils::SortHandle(this->store, this->entries, this->ascending, this->sorttype); break; case 4: - StoreUtils::SettingsHandle(hDown, hHeld, touch, this->sPage, this->showSettings, this->storeMode, this->sSelection, this->store, this->entries, this->meta, this->sPos); + StoreUtils::SettingsHandle(this->sPage, this->showSettings, this->storeMode, this->sSelection, this->store, this->entries, this->meta, this->sPos); break; } } diff --git a/source/store/downList.cpp b/source/store/downList.cpp index b02d76e..f908b67 100644 --- a/source/store/downList.cpp +++ b/source/store/downList.cpp @@ -45,9 +45,9 @@ static const std::vector downloadBoxes = { const std::unique_ptr &store: Const Reference to the Store class. const std::vector &entries: Const Reference to the download list as a vector of strings. - const bool &fetch: Const Reference to Fetch. + bool fetch: if fetching or not. */ -void StoreUtils::DrawDownList(const std::unique_ptr &store, const std::vector &entries, const bool &fetch) { +void StoreUtils::DrawDownList(const std::unique_ptr &store, const std::vector &entries, bool fetch) { if (store && !fetch) { Gui::Draw_Rect(48, 0, 272, 25, ENTRY_BAR_COLOR); Gui::Draw_Rect(48, 25, 272, 1, ENTRY_BAR_OUTL_COLOR); @@ -73,9 +73,6 @@ void StoreUtils::DrawDownList(const std::unique_ptr &store, const std::ve - Execute an Entry of the download list. - Return back to EntryInfo through `B`. - u32 hDown: The hidKeysDown() variable. - u32 hHeld: The hidKeysHeld() variable. - touchPosition touch: The TouchPosition variable. const std::unique_ptr &store: Const Reference to the Store class, since we do not modify anything in it. const std::unique_ptr &entry: Const Reference to the current StoreEntry, since we do not modify anything in it. const std::vector &entries: Const Reference to the download list, since we do not modify anything in it. @@ -84,7 +81,7 @@ void StoreUtils::DrawDownList(const std::unique_ptr &store, const std::ve const int &lastMode: Const Reference to the last mode. int &smallDelay: Reference to the small delay. This helps to not directly press A. */ -void StoreUtils::DownloadHandle(u32 hDown, u32 hHeld, touchPosition touch, const std::unique_ptr &store, const std::unique_ptr &entry, const std::vector &entries, int ¤tMenu, std::unique_ptr &meta, const int &lastMode, int &smallDelay) { +void StoreUtils::DownloadHandle(const std::unique_ptr &store, const std::unique_ptr &entry, const std::vector &entries, int ¤tMenu, std::unique_ptr &meta, const int &lastMode, int &smallDelay) { if (store && entry) { // Ensure, store & entry is not a nullptr. if (smallDelay > 0) { smallDelay--; diff --git a/source/store/entryInfo.cpp b/source/store/entryInfo.cpp index a838e67..78c16b6 100644 --- a/source/store/entryInfo.cpp +++ b/source/store/entryInfo.cpp @@ -72,12 +72,9 @@ void StoreUtils::DrawEntryInfo(const std::unique_ptr &store, const std::u - Go to the download list, by pressing `A`. - Show the MarkMenu with START. - u32 hDown: The hidKeysDown() variable. - u32 hHeld: The hidKeysHeld() variable. - touchPosition touch: The TouchPosition variable. bool &showMark: Reference to showMark.. to show the mark menu. bool &fetch: Reference to fetch, so we know, if we need to fetch, when accessing download list. */ -void StoreUtils::EntryHandle(u32 hDown, u32 hHeld, touchPosition touch, bool &showMark, bool &fetch) { +void StoreUtils::EntryHandle(bool &showMark, bool &fetch) { if ((hDown & KEY_START) || (hDown & KEY_TOUCH && touching(touch, btn))) showMark = true; } \ No newline at end of file diff --git a/source/store/grid.cpp b/source/store/grid.cpp index 2e5747a..28141b2 100644 --- a/source/store/grid.cpp +++ b/source/store/grid.cpp @@ -92,9 +92,6 @@ void StoreUtils::DrawGrid(const std::unique_ptr &store, const std::vector - Scroll through the Grid with the D-Pad. - u32 hDown: The hidKeysDown() variable. - u32 hHeld: The hidKeysHeld() variable. - touchPosition touch: The TouchPosition variable. std::unique_ptr &store: Reference to the Store class. std::vector> &entries: Reference to the StoreEntries. const int ¤tMode: Reference to the current Mode. @@ -102,14 +99,14 @@ void StoreUtils::DrawGrid(const std::unique_ptr &store, const std::vector bool &fetch: Reference to fetch. int &smallDelay: Reference to the small delay. */ -void StoreUtils::GridLogic(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr &store, std::vector> &entries, int ¤tMode, int &lastMode, bool &fetch, int &smallDelay) { +void StoreUtils::GridLogic(std::unique_ptr &store, std::vector> &entries, int ¤tMode, int &lastMode, bool &fetch, int &smallDelay) { if (store) { // Ensure, store is not a nullptr. if (hRepeat & KEY_DOWN) { if (store->GetBox() > 9) { if (store->GetEntry() + 5 < (int)entries.size()) { store->SetEntry(store->GetEntry() + 5); - if (store->GetScreenIndx() < ((entries.size() / 5) - 2)) { + if (store->GetScreenIndx() < (((int)entries.size() / 5) - 2)) { store->SetScreenIndx(store->GetScreenIndx() + 1); } @@ -118,7 +115,7 @@ void StoreUtils::GridLogic(u32 hDown, u32 hHeld, touchPosition touch, std::uniqu store->SetEntry(entries.size() - 1); store->SetBox(10 + (store->GetEntry() % 5)); - if (store->GetScreenIndx() < ((entries.size() / 5) - 2)) { + if (store->GetScreenIndx() < (((int)entries.size() / 5) - 2)) { store->SetScreenIndx(store->GetScreenIndx() + 1); } } @@ -142,7 +139,7 @@ void StoreUtils::GridLogic(u32 hDown, u32 hHeld, touchPosition touch, std::uniqu store->SetBox(10); store->SetEntry(store->GetEntry() + 1); - if (store->GetScreenIndx() < ((entries.size() / 5) - 2)) { + if (store->GetScreenIndx() < (((int)entries.size() / 5) - 2)) { store->SetScreenIndx(store->GetScreenIndx() + 1); } } diff --git a/source/store/list.cpp b/source/store/list.cpp index 453f4da..5a918cb 100644 --- a/source/store/list.cpp +++ b/source/store/list.cpp @@ -82,9 +82,6 @@ void StoreUtils::DrawList(const std::unique_ptr &store, const std::vector - Scroll through the Grid with the D-Pad Up / Down and skip 3 Entries with Left / Right. - u32 hDown: The hidKeysDown() variable. - u32 hHeld: The hidKeysHeld() variable. - touchPosition touch: The TouchPosition variable. std::unique_ptr &store: Reference to the Store class. std::vector> &entries: Reference to the StoreEntries. int ¤tMode: Const Reference to the current Mode. @@ -92,7 +89,7 @@ void StoreUtils::DrawList(const std::unique_ptr &store, const std::vector bool &fetch: Reference to fetch. int &smallDelay: Reference to the small delay. */ -void StoreUtils::ListLogic(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr &store, std::vector> &entries, int ¤tMode, int &lastMode, bool &fetch, int &smallDelay) { +void StoreUtils::ListLogic(std::unique_ptr &store, std::vector> &entries, int ¤tMode, int &lastMode, bool &fetch, int &smallDelay) { if (store) { // Ensure, store is not a nullptr. if (hRepeat & KEY_DOWN) { if (store->GetEntry() < (int)entries.size() - 1) store->SetEntry(store->GetEntry() + 1); diff --git a/source/store/markMenu.cpp b/source/store/markMenu.cpp index a158800..05c7820 100644 --- a/source/store/markMenu.cpp +++ b/source/store/markMenu.cpp @@ -41,9 +41,9 @@ static const std::vector markBox = { /* Draw the Marking part. - const int &marks: A Reference to the active mark flags. + int marks: The active mark flags. */ -void StoreUtils::DisplayMarkBox(const int &marks) { +void StoreUtils::DisplayMarkBox(int marks) { Gui::Draw_Rect(0, 0, 320, 240, DIM_COLOR); // Darken. Gui::Draw_Rect(markBox[0].x, markBox[0].y, markBox[0].w, markBox[0].h, (marks & favoriteMarks::STAR ? @@ -78,15 +78,12 @@ void StoreUtils::DisplayMarkBox(const int &marks) { - Mark the selected app. - Return to EntryInfo with `B`. - u32 hDown: The hidKeysDown() variable. - u32 hHeld: The hidKeysHeld() variable. - touchPosition touch: The TouchPosition variable. std::unique_ptr &entry: Reference to the current StoreEntry. const std::unique_ptr &store: Const Reference to the Store, since we do not modify anything there. bool &showMark: Reference to showMark, so we know, if we should stay here or not. std::unique_ptr &meta: Reference to the Meta class. */ -void StoreUtils::MarkHandle(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr &entry, const std::unique_ptr &store, bool &showMark, std::unique_ptr &meta) { +void StoreUtils::MarkHandle(std::unique_ptr &entry, const std::unique_ptr &store, bool &showMark, std::unique_ptr &meta) { hidScanInput(); touchPosition t; hidTouchRead(&t); diff --git a/source/store/meta.cpp b/source/store/meta.cpp index 4faa286..bc7c492 100644 --- a/source/store/meta.cpp +++ b/source/store/meta.cpp @@ -79,10 +79,10 @@ void Meta::ImportMetadata() { /* Get Last Updated. - std::string unistoreName: The UniStore name. - std::string entry: The Entry name. + const std::string &unistoreName: The UniStore name. + const std::string &entry: The Entry name. */ -std::string Meta::GetUpdated(std::string unistoreName, std::string entry) const { +std::string Meta::GetUpdated(const std::string &unistoreName, const std::string &entry) const { if (!this->metadataJson.contains(unistoreName)) return ""; // UniStore Name does not exist. if (!this->metadataJson[unistoreName].contains(entry)) return ""; // Entry does not exist. @@ -96,10 +96,10 @@ std::string Meta::GetUpdated(std::string unistoreName, std::string entry) const /* Get the marks. - std::string unistoreName: The UniStore name. - std::string entry: The Entry name. + const std::string &unistoreName: The UniStore name. + const std::string &entry: The Entry name. */ -int Meta::GetMarks(std::string unistoreName, std::string entry) const { +int Meta::GetMarks(const std::string &unistoreName, const std::string &entry) const { int temp = 0; if (!this->metadataJson.contains(unistoreName)) return temp; // UniStore Name does not exist. @@ -115,11 +115,11 @@ int Meta::GetMarks(std::string unistoreName, std::string entry) const { /* Return, if update available. - std::string unistoreName: The UniStore name. - std::string entry: The Entry name. - std::string updated: Compare for the update. + const std::string &unistoreName: The UniStore name. + const std::string &entry: The Entry name. + const std::string &updated: Compare for the update. */ -bool Meta::UpdateAvailable(std::string unistoreName, std::string entry, std::string updated) const { +bool Meta::UpdateAvailable(const std::string &unistoreName, const std::string &entry, const std::string &updated) const { if (this->GetUpdated(unistoreName, entry) != "" && updated != "") { return strcasecmp(updated.c_str(), this->GetUpdated(unistoreName, entry).c_str()) > 0; } diff --git a/source/store/searchMenu.cpp b/source/store/searchMenu.cpp index f9c2b00..554a673 100644 --- a/source/store/searchMenu.cpp +++ b/source/store/searchMenu.cpp @@ -52,10 +52,10 @@ static const std::vector SearchMenu = { const std::vector &searchIncludes: Const Reference to the searchIncludes. const std::string &searchResult: Const Reference to the searchResult. - const int &marks: Const Reference to the filter mark flags. - const bool &updateFilter: Const Reference to the update filter. + int marks: The filter mark flags. + bool updateFilter: The update filter. */ -void StoreUtils::DrawSearchMenu(const std::vector &searchIncludes, const std::string &searchResult, const int &marks, const bool &updateFilter) { +void StoreUtils::DrawSearchMenu(const std::vector &searchIncludes, const std::string &searchResult, int marks, bool updateFilter) { Gui::Draw_Rect(48, 0, 272, 25, ENTRY_BAR_COLOR); Gui::Draw_Rect(48, 25, 272, 1, ENTRY_BAR_OUTL_COLOR); Gui::DrawStringCentered(25, 2, 0.6, TEXT_COLOR, Lang::get("SEARCH_FILTERS"), 265); @@ -115,9 +115,6 @@ void StoreUtils::DrawSearchMenu(const std::vector &searchIncludes, const s - Search the UniStore. - Include stuff into the search. - u32 hDown: The hidKeysDown() variable. - u32 hHeld: The hidKeysHeld() variable. - touchPosition touch: The TouchPosition variable. std::unique_ptr &store: Reference to the Store class. std::vector> &entries: Reference to the Store Entries. std::vector &searchIncludes: Reference to the searchIncludes. @@ -126,7 +123,7 @@ void StoreUtils::DrawSearchMenu(const std::vector &searchIncludes, const s int &marks: Reference to the mark flags. bool &updateFilter: Reference to the update filter. */ -void StoreUtils::SearchHandle(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr &store, std::vector> &entries, std::vector &searchIncludes, std::unique_ptr &meta, std::string &searchResult, int &marks, bool &updateFilter, bool ascending, SortType sorttype) { +void StoreUtils::SearchHandle(std::unique_ptr &store, std::vector> &entries, std::vector &searchIncludes, std::unique_ptr &meta, std::string &searchResult, int &marks, bool &updateFilter, bool ascending, SortType sorttype) { /* Checkboxes. */ if (hDown & KEY_TOUCH) { bool didTouch = false; diff --git a/source/store/settings.cpp b/source/store/settings.cpp index f309e20..bf0d8d7 100644 --- a/source/store/settings.cpp +++ b/source/store/settings.cpp @@ -69,9 +69,9 @@ static const std::string langsTemp[] = { "br", "da", "de", "en", "es", "fr", "it /* Main Settings. - const int &selection: Const Reference to the Settings Selection. + int selection: The Settings Selection. */ -static void DrawSettingsMain(const int &selection) { +static void DrawSettingsMain(int selection) { Gui::Draw_Rect(48, 0, 272, 25, ENTRY_BAR_COLOR); Gui::Draw_Rect(48, 25, 272, 1, ENTRY_BAR_OUTL_COLOR); Gui::DrawStringCentered(25, 2, 0.6, TEXT_COLOR, Lang::get("SETTINGS"), 265); @@ -85,10 +85,10 @@ static void DrawSettingsMain(const int &selection) { /* Draw the Language Selection. - const int &selection: Const Reference to the Language Selection. - const int &sPos: Const Reference to the Screen Position. + int selection: The Language Selection. + int sPos: The Screen Position. */ -static void DrawLanguageSettings(const int &selection, const int &sPos) { +static void DrawLanguageSettings(int selection, int sPos) { Gui::Draw_Rect(48, 0, 272, 25, ENTRY_BAR_COLOR); Gui::Draw_Rect(48, 25, 272, 1, ENTRY_BAR_OUTL_COLOR); GFX::DrawSprite(sprites_arrow_idx, back.x, back.y); @@ -103,9 +103,9 @@ static void DrawLanguageSettings(const int &selection, const int &sPos) { /* Directory Change Draw. - const int &selection: Const Reference to the Settings Selection. + int selection: The Settings Selection. */ -static void DrawSettingsDir(const int &selection) { +static void DrawSettingsDir(int selection) { Gui::Draw_Rect(48, 0, 272, 25, ENTRY_BAR_COLOR); Gui::Draw_Rect(48, 25, 272, 1, ENTRY_BAR_OUTL_COLOR); GFX::DrawSprite(sprites_arrow_idx, back.x, back.y); @@ -120,7 +120,7 @@ static void DrawSettingsDir(const int &selection) { /* Draw Auto-Update Settings page. */ -static void DrawAutoUpdate(const int &selection) { +static void DrawAutoUpdate(int selection) { Gui::Draw_Rect(48, 0, 272, 36, ENTRY_BAR_COLOR); Gui::Draw_Rect(48, 36, 272, 1, ENTRY_BAR_OUTL_COLOR); GFX::DrawSprite(sprites_arrow_idx, 52, 6); @@ -142,9 +142,9 @@ static void DrawAutoUpdate(const int &selection) { /* Draw the GUI Settings. - const int &selection: Const Reference to the Settings Selection. + int selection: The Settings Selection. */ -static void DrawGUISettings(const int &selection) { +static void DrawGUISettings(int selection) { Gui::Draw_Rect(48, 0, 272, 36, ENTRY_BAR_COLOR); Gui::Draw_Rect(48, 36, 272, 1, ENTRY_BAR_OUTL_COLOR); GFX::DrawSprite(sprites_arrow_idx, 52, 6); @@ -168,9 +168,6 @@ static void DrawGUISettings(const int &selection) { - Show the Credits. - Exit Universal-Updater. - u32 hDown: The hidKeysDown() variable. - u32 hHeld: The hidKeysHeld() variable. - touchPosition touch: The TouchPosition variable. int &page: Reference to the page. bool &dspSettings: Reference to the display Settings. int &storeMode: Reference to the Store Mode. @@ -179,7 +176,7 @@ static void DrawGUISettings(const int &selection) { std::vector> &entries: Reference to the StoreEntries. std::unique_ptr &meta: Reference to the Meta class. */ -static void SettingsHandleMain(u32 hDown, u32 hHeld, touchPosition touch, int &page, bool &dspSettings, int &storeMode, int &selection, std::unique_ptr &store, std::vector> &entries, std::unique_ptr &meta) { +static void SettingsHandleMain(int &page, bool &dspSettings, int &storeMode, int &selection, std::unique_ptr &store, std::vector> &entries, std::unique_ptr &meta) { if (hDown & KEY_B) { selection = 0; storeMode = 0; @@ -277,13 +274,10 @@ static void SettingsHandleMain(u32 hDown, u32 hHeld, touchPosition touch, int &p - Change the Directory of... - 3DSX, NDS & Archives. - u32 hDown: The hidKeysDown() variable. - u32 hHeld: The hidKeysHeld() variable. - touchPosition touch: The TouchPosition variable. int &page: Reference to the page. int &selection: Reference to the Selection. */ -static void SettingsHandleDir(u32 hDown, u32 hHeld, touchPosition touch, int &page, int &selection, const std::unique_ptr &store) { +static void SettingsHandleDir(int &page, int &selection, const std::unique_ptr &store) { if (hDown & KEY_B) { page = 0; selection = 4; @@ -358,13 +352,10 @@ static void SettingsHandleDir(u32 hDown, u32 hHeld, touchPosition touch, int &pa - Enable / Disable Automatically updating the UniStore on boot. - Enable / Disable Automatically check for Universal-Updater updates on boot. - u32 hDown: The hidKeysDown() variable. - u32 hHeld: The hidKeysHeld() variable. - touchPosition touch: The TouchPosition variable. int &page: Reference to the page. int &selection: Reference to the Selection. */ -static void AutoUpdateLogic(u32 hDown, u32 hHeld, touchPosition touch, int &page, int &selection) { +static void AutoUpdateLogic(int &page, int &selection) { if (hDown & KEY_B) { page = 0; selection = 2; @@ -411,13 +402,10 @@ static void AutoUpdateLogic(u32 hDown, u32 hHeld, touchPosition touch, int &page - Enable / Disable using the SpriteSheet Background Image, if exist. - u32 hDown: The hidKeysDown() variable. - u32 hHeld: The hidKeysHeld() variable. - touchPosition touch: The TouchPosition variable. int &page: Reference to the page. int &selection: Reference to the Selection. */ -static void GUISettingsLogic(u32 hDown, u32 hHeld, touchPosition touch, int &page, int &selection) { +static void GUISettingsLogic(int &page, int &selection) { if (hDown & KEY_B) { page = 0; selection = 3; @@ -449,14 +437,11 @@ static void GUISettingsLogic(u32 hDown, u32 hHeld, touchPosition touch, int &pag - Select the language, which should be used with the app. - u32 hDown: The hidKeysDown() variable. - u32 hHeld: The hidKeysHeld() variable. - touchPosition touch: The TouchPosition variable. int &page: Reference to the page. int &selection: Reference to the Selection. int &sPos: Reference to the ScreenPos variable. */ -static void LanguageLogic(u32 hDown, u32 hHeld, touchPosition touch, int &page, int &selection, int &sPos) { +static void LanguageLogic(int &page, int &selection, int &sPos) { if (hRepeat & KEY_DOWN) { if (selection < (int)languages.size() - 1) selection++; else selection = 0; @@ -514,10 +499,10 @@ static void LanguageLogic(u32 hDown, u32 hHeld, touchPosition touch, int &page, /* Draw the Settings. - const int &page: Const Reference to the page. - const int &selection: Const Reference to the selection. + int page: The page. + int selection: The selection. */ -void StoreUtils::DrawSettings(const int &page, const int &selection, const int &sPos) { +void StoreUtils::DrawSettings(int page, int selection, int sPos) { switch(page) { case 0: DrawSettingsMain(selection); @@ -544,9 +529,6 @@ void StoreUtils::DrawSettings(const int &page, const int &selection, const int & /* Settings Handle. - u32 hDown: The hidKeysDown() variable. - u32 hHeld: The hidKeysHeld() variable. - touchPosition touch: The TouchPosition variable. int &page: Reference to the page. bool &dspSettings: Reference to the display Settings. int &storeMode: Reference to the Store Mode. @@ -555,26 +537,26 @@ void StoreUtils::DrawSettings(const int &page, const int &selection, const int & std::vector> &entries: Reference to the StoreEntries. std::unique_ptr &meta: Reference to the Meta class. */ -void StoreUtils::SettingsHandle(u32 hDown, u32 hHeld, touchPosition touch, int &page, bool &dspSettings, int &storeMode, int &selection, std::unique_ptr &store, std::vector> &entries, std::unique_ptr &meta, int &sPos) { +void StoreUtils::SettingsHandle(int &page, bool &dspSettings, int &storeMode, int &selection, std::unique_ptr &store, std::vector> &entries, std::unique_ptr &meta, int &sPos) { switch(page) { case 0: - SettingsHandleMain(hDown, hHeld, touch, page, dspSettings, storeMode, selection, store, entries, meta); + SettingsHandleMain(page, dspSettings, storeMode, selection, store, entries, meta); break; case 1: - SettingsHandleDir(hDown, hHeld, touch, page, selection, store); + SettingsHandleDir(page, selection, store); break; case 2: - AutoUpdateLogic(hDown, hHeld, touch, page, selection); + AutoUpdateLogic(page, selection); break; case 3: - GUISettingsLogic(hDown, hHeld, touch, page, selection); + GUISettingsLogic(page, selection); break; case 4: - LanguageLogic(hDown, hHeld, touch, page, selection, sPos); + LanguageLogic(page, selection, sPos); break; } } \ No newline at end of file diff --git a/source/store/sideMenu.cpp b/source/store/sideMenu.cpp index dcdb7d8..e995ac3 100644 --- a/source/store/sideMenu.cpp +++ b/source/store/sideMenu.cpp @@ -39,9 +39,9 @@ static const std::vector sidePos = { /* Draw the Side Menu part. - const int ¤tMenu: Const Reference to the current Store Mode / Menu. + int currentMenu: The current Store Mode / Menu. */ -void StoreUtils::DrawSideMenu(const int ¤tMenu) { +void StoreUtils::DrawSideMenu(int currentMenu) { for (int i = 0; i < 5; i++) { if (i == currentMenu) { Gui::Draw_Rect(sidePos[i].x, sidePos[i].y, sidePos[i].w, sidePos[i].h, SIDEBAR_SELECTED_COLOR); @@ -66,12 +66,10 @@ void StoreUtils::DrawSideMenu(const int ¤tMenu) { - Switch between the Menus through the sidebar. - u32 hDown: The hidKeysDown() variable. - touchPosition touch: The TouchPosition variable. int ¤tMenu: Reference to the Store Mode / Menu. bool &fetch: Reference of the download fetch variable.. so we know, if we need to fetch the download entries. */ -void StoreUtils::SideMenuHandle(u32 hDown, touchPosition touch, int ¤tMenu, bool &fetch) { +void StoreUtils::SideMenuHandle(int ¤tMenu, bool &fetch) { if (hDown & KEY_TOUCH) { for (int i = 0; i < 5; i++) { if (touching(touch, sidePos[i])) { diff --git a/source/store/sortMenu.cpp b/source/store/sortMenu.cpp index 871e482..70ed358 100644 --- a/source/store/sortMenu.cpp +++ b/source/store/sortMenu.cpp @@ -49,9 +49,9 @@ static void DrawCheck(int pos, bool v) { /* Return SortType as an uint8_t. - const SortType &st: Const Reference to the SortType variable. + SortType st: The SortType variable. */ -static const uint8_t GetType(const SortType &st) { +static const uint8_t GetType(SortType st) { switch(st) { case SortType::TITLE: return 0; @@ -69,10 +69,10 @@ static const uint8_t GetType(const SortType &st) { /* Draw the Sort Menu. - const bool &asc: Const Reference to the Ascending variable. - const SortType &st: Const Reference to the SortType variable. + bool asc: The Ascending variable. + SortType st: The SortType variable. */ -void StoreUtils::DrawSorting(const bool &asc, const SortType &st) { +void StoreUtils::DrawSorting(bool asc, SortType st) { Gui::Draw_Rect(48, 0, 272, 25, ENTRY_BAR_COLOR); Gui::Draw_Rect(48, 25, 272, 1, ENTRY_BAR_OUTL_COLOR); Gui::DrawStringCentered(25, 2, 0.6, TEXT_COLOR, Lang::get("SORTING"), 265); @@ -113,15 +113,12 @@ void StoreUtils::DrawSorting(const bool &asc, const SortType &st) { - Change the Top Style. - u32 hDown: The hidKeysDown() variable. - u32 hHeld: The hidKeysHeld() variable. - touchPosition touch: The TouchPosition variable. std::unique_ptr &store: Reference to the Store class. std::vector> &entries: Reference to the StoreEntries. bool &asc: Reference to the Ascending variable. SortType &st: Reference to the SortType. */ -void StoreUtils::SortHandle(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr &store, std::vector> &entries, bool &asc, SortType &st) { +void StoreUtils::SortHandle(std::unique_ptr &store, std::vector> &entries, bool &asc, SortType &st) { if (store && store->GetValid() && entries.size() > 0) { // Ensure, this is valid and more than 0 entries exist. if (hDown & KEY_TOUCH) { /* SortType Part. */ diff --git a/source/store/store.cpp b/source/store/store.cpp index 78a166d..86b231f 100644 --- a/source/store/store.cpp +++ b/source/store/store.cpp @@ -238,9 +238,9 @@ std::string Store::GetUniStoreTitle() const { /* Return the Title of an index. - const int &index: Const Reference to the index. + int index: The index. */ -std::string Store::GetTitleEntry(const int &index) const { +std::string Store::GetTitleEntry(int index) const { if (!this->valid) return ""; if (index > (int)this->storeJson["storeContent"].size() - 1) return ""; // Empty. @@ -254,9 +254,9 @@ std::string Store::GetTitleEntry(const int &index) const { /* Return the Author name of an index. - const int &index: Const Reference to the index. + int index: The index. */ -std::string Store::GetAuthorEntry(const int &index) const { +std::string Store::GetAuthorEntry(int index) const { if (!this->valid) return ""; if (index > (int)this->storeJson["storeContent"].size() - 1) return ""; // Empty. @@ -270,9 +270,9 @@ std::string Store::GetAuthorEntry(const int &index) const { /* Return the Description of an index. - const int &index: Const Reference to the index. + int index: The index. */ -std::string Store::GetDescriptionEntry(const int &index) const { +std::string Store::GetDescriptionEntry(int index) const { if (!this->valid) return ""; if (index > (int)this->storeJson["storeContent"].size() - 1) return ""; // Empty. @@ -286,9 +286,9 @@ std::string Store::GetDescriptionEntry(const int &index) const { /* Return the Category of an index. - const int &index: Const Reference to the index. + int index: The index. */ -std::vector Store::GetCategoryIndex(const int &index) const { +std::vector Store::GetCategoryIndex(int index) const { if (!this->valid) return { "" }; if (index > (int)this->storeJson["storeContent"].size() - 1) return { "" }; // Empty. @@ -309,9 +309,9 @@ std::vector Store::GetCategoryIndex(const int &index) const { /* Return the Version of an index. - const int &index: Const Reference to the index. + int index: The index. */ -std::string Store::GetVersionEntry(const int &index) const { +std::string Store::GetVersionEntry(int index) const { if (!this->valid) return ""; if (index > (int)this->storeJson["storeContent"].size() - 1) return ""; // Empty. @@ -325,9 +325,9 @@ std::string Store::GetVersionEntry(const int &index) const { /* Return the Console of an index. - const int &index: Const Reference to the index. + int index: The index. */ -std::vector Store::GetConsoleEntry(const int &index) const { +std::vector Store::GetConsoleEntry(int index) const { if (!this->valid) return { "" }; if (index > (int)this->storeJson["storeContent"].size() - 1) return { "" }; // Empty. @@ -348,9 +348,9 @@ std::vector Store::GetConsoleEntry(const int &index) const { /* Return the Last updated date of an index. - const int &index: Const Reference to the index. + int index: The index. */ -std::string Store::GetLastUpdatedEntry(const int &index) const { +std::string Store::GetLastUpdatedEntry(int index) const { if (!this->valid) return ""; if (index > (int)this->storeJson["storeContent"].size() - 1) return ""; // Empty. @@ -364,9 +364,9 @@ std::string Store::GetLastUpdatedEntry(const int &index) const { /* Return the License of an index. - const int &index: Const Reference to the index. + int index: The index. */ -std::string Store::GetLicenseEntry(const int &index) const { +std::string Store::GetLicenseEntry(int index) const { if (!this->valid) return Lang::get("NO_LICENSE"); if (index > (int)this->storeJson["storeContent"].size() - 1) return Lang::get("NO_LICENSE"); // Empty. @@ -382,9 +382,9 @@ std::string Store::GetLicenseEntry(const int &index) const { /* Return a C2D_Image of an index. - const int &index: Const Reference to the index. + int index: The index. */ -C2D_Image Store::GetIconEntry(const int &index) const { +C2D_Image Store::GetIconEntry(int index) const { if (!this->valid) return C2D_SpriteSheetGetImage(sprites, sprites_noIcon_idx); if (this->sheets.empty()) return C2D_SpriteSheetGetImage(sprites, sprites_noIcon_idx); int iconIndex = -1, sheetIndex = 0; @@ -446,9 +446,9 @@ void Store::SetC2DBGImage() { /* Return the download list of an entry. - const int &index: Const Reference to the index. + int index: The index. */ -std::vector Store::GetDownloadList(const int &index) const { +std::vector Store::GetDownloadList(int index) const { if (!this->valid) return { "" }; std::vector temp; diff --git a/source/store/storeEntry.cpp b/source/store/storeEntry.cpp index 84a32c3..16f922b 100644 --- a/source/store/storeEntry.cpp +++ b/source/store/storeEntry.cpp @@ -31,9 +31,9 @@ const std::unique_ptr &store: Const Reference to the Store class. const std::unique_ptr &meta: Const Reference to the Meta class. - const int &index: Const Reference Index of the entry. + int index: Index of the entry. */ -StoreEntry::StoreEntry(const std::unique_ptr &store, const std::unique_ptr &meta, const int &index) { +StoreEntry::StoreEntry(const std::unique_ptr &store, const std::unique_ptr &meta, int index) { this->Title = store->GetTitleEntry(index); this->Author = store->GetAuthorEntry(index); diff --git a/source/store/storeUtils.cpp b/source/store/storeUtils.cpp index af7c5b7..e7c5d73 100644 --- a/source/store/storeUtils.cpp +++ b/source/store/storeUtils.cpp @@ -80,11 +80,11 @@ bool StoreUtils::compareUpdateAscending(const std::unique_ptr &a, co /* Sort the entries. - const bool &Ascending: Const Reference to Ascending. - const SortType &sorttype: Const Reference to the sort type. + bool Ascending: If Ascending. + SortType sorttype: The sort type. std::vector> &entries: Reference to the Entries, which should be sorted. */ -void StoreUtils::SortEntries(const bool &Ascending, const SortType &sorttype, std::vector> &entries) { +void StoreUtils::SortEntries(bool Ascending, SortType sorttype, std::vector> &entries) { switch(sorttype) { case SortType::TITLE: Ascending ? std::sort(entries.begin(), entries.end(), StoreUtils::compareTitleAscending) : std::sort(entries.begin(), entries.end(), StoreUtils::compareTitleDescending); diff --git a/source/utils/animation.cpp b/source/utils/animation.cpp index fa83fd0..1504a4d 100644 --- a/source/utils/animation.cpp +++ b/source/utils/animation.cpp @@ -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); } diff --git a/source/utils/cia.cpp b/source/utils/cia.cpp index 5856ac7..cfe196d 100644 --- a/source/utils/cia.cpp +++ b/source/utils/cia.cpp @@ -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; diff --git a/source/utils/download.cpp b/source/utils/download.cpp index a53b6aa..a9697e6 100644 --- a/source/utils/download.cpp +++ b/source/utils/download.cpp @@ -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")); diff --git a/source/utils/files.cpp b/source/utils/files.cpp index 7f74ff2..833a519 100644 --- a/source/utils/files.cpp +++ b/source/utils/files.cpp @@ -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); diff --git a/source/utils/scriptUtils.cpp b/source/utils/scriptUtils.cpp index 23f21c6..219da31 100644 --- a/source/utils/scriptUtils.cpp +++ b/source/utils/scriptUtils.cpp @@ -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; }; diff --git a/source/utils/stringutils.cpp b/source/utils/stringutils.cpp index 588fe59..da2e24e 100644 --- a/source/utils/stringutils.cpp +++ b/source/utils/stringutils.cpp @@ -64,7 +64,7 @@ std::string StringUtils::FetchStringsFromVector(const std::vector & /* 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);