Some inline + remove useless const&.

This commit is contained in:
StackZ
2020-11-06 02:10:58 +01:00
parent 689192e902
commit ddbea3ab36
35 changed files with 186 additions and 228 deletions
+3 -1
View File
@@ -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> 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
+3 -4
View File
@@ -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);
};
+5 -5
View File
@@ -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;
};
+10 -10
View File
@@ -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<std::string> GetCategoryIndex(const int &index) const;
std::string GetVersionEntry(const int &index) const;
std::vector<std::string> 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<std::string> GetCategoryIndex(int index) const;
std::string GetVersionEntry(int index) const;
std::vector<std::string> GetConsoleEntry(int index) const;
std::string GetLastUpdatedEntry(int index) const;
std::string GetLicenseEntry(int index) const;
C2D_Image GetIconEntry(int index) const;
std::vector<std::string> GetDownloadList(const int &index) const;
std::vector<std::string> GetDownloadList(int index) const;
int GetStoreSize() const { return (int)this->storeJson["storeContent"].size(); };
+3 -3
View File
@@ -33,7 +33,7 @@
class StoreEntry {
public:
StoreEntry(const std::unique_ptr<Store> &store, const std::unique_ptr<Meta> &meta, const int &index);
StoreEntry(const std::unique_ptr<Store> &store, const std::unique_ptr<Meta> &meta, int index);
std::string GetTitle() const { return this->Title; };
std::string GetAuthor() const { return this->Author; };
@@ -54,9 +54,9 @@ public:
std::vector<std::string> 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);
};
+16 -16
View File
@@ -41,42 +41,42 @@ enum class SortType : uint8_t {
namespace StoreUtils {
/* Grid. */
void DrawGrid(const std::unique_ptr<Store> &store, const std::vector<std::unique_ptr<StoreEntry>> &entries);
void GridLogic(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, int &currentMode, int &lastMode, bool &fetch, int &smallDelay);
void GridLogic(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, int &currentMode, int &lastMode, bool &fetch, int &smallDelay);
/* Top List. */
void DrawList(const std::unique_ptr<Store> &store, const std::vector<std::unique_ptr<StoreEntry>> &entries);
void ListLogic(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, int &currentMode, int &lastMode, bool &fetch, int &smallDelay);
void ListLogic(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, int &currentMode, int &lastMode, bool &fetch, int &smallDelay);
/* Entry Info. */
void DrawEntryInfo(const std::unique_ptr<Store> &store, const std::unique_ptr<StoreEntry> &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 &currentMenu);
void SideMenuHandle(u32 hDown, touchPosition touch, int &currentMenu, bool &fetch);
void DrawSideMenu(int currentMenu);
void SideMenuHandle(int &currentMenu, bool &fetch);
/* Download Entries. */
void DrawDownList(const std::unique_ptr<Store> &store, const std::vector<std::string> &entries, const bool &fetch);
void DownloadHandle(u32 hDown, u32 hHeld, touchPosition touch, const std::unique_ptr<Store> &store, const std::unique_ptr<StoreEntry> &entry, const std::vector<std::string> &entries, int &currentMenu, std::unique_ptr<Meta> &meta, const int &lastMode, int &smallDelay);
void DrawDownList(const std::unique_ptr<Store> &store, const std::vector<std::string> &entries, bool fetch);
void DownloadHandle(const std::unique_ptr<Store> &store, const std::unique_ptr<StoreEntry> &entry, const std::vector<std::string> &entries, int &currentMenu, std::unique_ptr<Meta> &meta, const int &lastMode, int &smallDelay);
/* Search + Favorite Menu. */
void DrawSearchMenu(const std::vector<bool> &searchIncludes, const std::string &searchResult, const int &marks, const bool &updateFilter);
void SearchHandle(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::vector<bool> &searchIncludes, std::unique_ptr<Meta> &meta, std::string &searchResult, int &marks, bool &updateFilter, bool ascending, SortType sorttype);
void DrawSearchMenu(const std::vector<bool> &searchIncludes, const std::string &searchResult, int marks, bool updateFilter);
void SearchHandle(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::vector<bool> &searchIncludes, std::unique_ptr<Meta> &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<StoreEntry> &entry, const std::unique_ptr<Store> &store, bool &showMark, std::unique_ptr<Meta> &meta);
void DisplayMarkBox(int marks);
void MarkHandle(std::unique_ptr<StoreEntry> &entry, const std::unique_ptr<Store> &store, bool &showMark, std::unique_ptr<Meta> &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> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::unique_ptr<Meta> &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> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::unique_ptr<Meta> &meta, int &sPos);
/* Sorting. */
void DrawSorting(const bool &asc, const SortType &st);
void SortHandle(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, bool &asc, SortType &st);
void DrawSorting(bool asc, SortType st);
void SortHandle(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, bool &asc, SortType &st);
bool compareTitleDescending(const std::unique_ptr<StoreEntry> &a, const std::unique_ptr<StoreEntry> &b);
bool compareTitleAscending(const std::unique_ptr<StoreEntry> &a, const std::unique_ptr<StoreEntry> &b);
@@ -87,7 +87,7 @@ namespace StoreUtils {
bool compareUpdateDescending(const std::unique_ptr<StoreEntry> &a, const std::unique_ptr<StoreEntry> &b);
bool compareUpdateAscending(const std::unique_ptr<StoreEntry> &a, const std::unique_ptr<StoreEntry> &b);
void SortEntries(const bool &Ascending, const SortType &sorttype, std::vector<std::unique_ptr<StoreEntry>> &entries);
void SortEntries(bool Ascending, SortType sorttype, std::vector<std::unique_ptr<StoreEntry>> &entries);
void search(std::vector<std::unique_ptr<StoreEntry>> &entries, const std::string &query, bool title, bool author, bool category, bool console, int selectedMarks, bool updateAvl);
+1 -1
View File
@@ -38,7 +38,7 @@ enum class ProgressBar {
};
namespace Animation {
void DrawProgressBar(const u64 &currentProgress, const u64 &totalProgress);
void DrawProgressBar(u64 currentProgress, u64 totalProgress);
void displayProgressBar();
};
+3 -3
View File
@@ -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
+3 -3
View File
@@ -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 &currentRev, 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();
+1 -1
View File
@@ -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);
+4 -4
View File
@@ -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
+1 -1
View File
@@ -34,7 +34,7 @@
namespace StringUtils {
std::string lower_case(const std::string &str);
std::string FetchStringsFromVector(const std::vector<std::string> &fetch);
std::string formatBytes(const int bytes);
std::string formatBytes(int bytes);
std::string GetMarkString(int marks);
std::vector<std::string> GetMarks(int marks);
};
+17 -17
View File
@@ -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);
}
+2 -3
View File
@@ -33,10 +33,9 @@
#include <unistd.h>
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);
-1
View File
@@ -15,7 +15,6 @@
*/
#include "quirc_internal.hpp"
#include <string.h>
#include <stdlib.h>
+8 -9
View File
@@ -31,7 +31,6 @@
#include <unistd.h>
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;
}
}
+3 -6
View File
@@ -45,9 +45,9 @@ static const std::vector<Structs::ButtonPos> downloadBoxes = {
const std::unique_ptr<Store> &store: Const Reference to the Store class.
const std::vector<std::string> &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> &store, const std::vector<std::string> &entries, const bool &fetch) {
void StoreUtils::DrawDownList(const std::unique_ptr<Store> &store, const std::vector<std::string> &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> &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> &store: Const Reference to the Store class, since we do not modify anything in it.
const std::unique_ptr<StoreEntry> &entry: Const Reference to the current StoreEntry, since we do not modify anything in it.
const std::vector<std::string> &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> &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> &store, const std::unique_ptr<StoreEntry> &entry, const std::vector<std::string> &entries, int &currentMenu, std::unique_ptr<Meta> &meta, const int &lastMode, int &smallDelay) {
void StoreUtils::DownloadHandle(const std::unique_ptr<Store> &store, const std::unique_ptr<StoreEntry> &entry, const std::vector<std::string> &entries, int &currentMenu, std::unique_ptr<Meta> &meta, const int &lastMode, int &smallDelay) {
if (store && entry) { // Ensure, store & entry is not a nullptr.
if (smallDelay > 0) {
smallDelay--;
+1 -4
View File
@@ -72,12 +72,9 @@ void StoreUtils::DrawEntryInfo(const std::unique_ptr<Store> &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;
}
+4 -7
View File
@@ -92,9 +92,6 @@ void StoreUtils::DrawGrid(const std::unique_ptr<Store> &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> &store: Reference to the Store class.
std::vector<std::unique_ptr<StoreEntry>> &entries: Reference to the StoreEntries.
const int &currentMode: Reference to the current Mode.
@@ -102,14 +99,14 @@ void StoreUtils::DrawGrid(const std::unique_ptr<Store> &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> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, int &currentMode, int &lastMode, bool &fetch, int &smallDelay) {
void StoreUtils::GridLogic(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, int &currentMode, 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);
}
}
+1 -4
View File
@@ -82,9 +82,6 @@ void StoreUtils::DrawList(const std::unique_ptr<Store> &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> &store: Reference to the Store class.
std::vector<std::unique_ptr<StoreEntry>> &entries: Reference to the StoreEntries.
int &currentMode: Const Reference to the current Mode.
@@ -92,7 +89,7 @@ void StoreUtils::DrawList(const std::unique_ptr<Store> &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> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, int &currentMode, int &lastMode, bool &fetch, int &smallDelay) {
void StoreUtils::ListLogic(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, int &currentMode, 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);
+3 -6
View File
@@ -41,9 +41,9 @@ static const std::vector<Structs::ButtonPos> 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<StoreEntry> &entry: Reference to the current StoreEntry.
const std::unique_ptr<Store> &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> &meta: Reference to the Meta class.
*/
void StoreUtils::MarkHandle(u32 hDown, u32 hHeld, touchPosition touch, std::unique_ptr<StoreEntry> &entry, const std::unique_ptr<Store> &store, bool &showMark, std::unique_ptr<Meta> &meta) {
void StoreUtils::MarkHandle(std::unique_ptr<StoreEntry> &entry, const std::unique_ptr<Store> &store, bool &showMark, std::unique_ptr<Meta> &meta) {
hidScanInput();
touchPosition t;
hidTouchRead(&t);
+10 -10
View File
@@ -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;
}
+4 -7
View File
@@ -52,10 +52,10 @@ static const std::vector<Structs::ButtonPos> SearchMenu = {
const std::vector<bool> &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<bool> &searchIncludes, const std::string &searchResult, const int &marks, const bool &updateFilter) {
void StoreUtils::DrawSearchMenu(const std::vector<bool> &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<bool> &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> &store: Reference to the Store class.
std::vector<std::unique_ptr<StoreEntry>> &entries: Reference to the Store Entries.
std::vector<bool> &searchIncludes: Reference to the searchIncludes.
@@ -126,7 +123,7 @@ void StoreUtils::DrawSearchMenu(const std::vector<bool> &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> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::vector<bool> &searchIncludes, std::unique_ptr<Meta> &meta, std::string &searchResult, int &marks, bool &updateFilter, bool ascending, SortType sorttype) {
void StoreUtils::SearchHandle(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::vector<bool> &searchIncludes, std::unique_ptr<Meta> &meta, std::string &searchResult, int &marks, bool &updateFilter, bool ascending, SortType sorttype) {
/* Checkboxes. */
if (hDown & KEY_TOUCH) {
bool didTouch = false;
+24 -42
View File
@@ -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<std::unique_ptr<StoreEntry>> &entries: Reference to the StoreEntries.
std::unique_ptr<Meta> &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> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::unique_ptr<Meta> &meta) {
static void SettingsHandleMain(int &page, bool &dspSettings, int &storeMode, int &selection, std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::unique_ptr<Meta> &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> &store) {
static void SettingsHandleDir(int &page, int &selection, const std::unique_ptr<Store> &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<std::unique_ptr<StoreEntry>> &entries: Reference to the StoreEntries.
std::unique_ptr<Meta> &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> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::unique_ptr<Meta> &meta, int &sPos) {
void StoreUtils::SettingsHandle(int &page, bool &dspSettings, int &storeMode, int &selection, std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::unique_ptr<Meta> &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;
}
}
+3 -5
View File
@@ -39,9 +39,9 @@ static const std::vector<Structs::ButtonPos> sidePos = {
/*
Draw the Side Menu part.
const int &currentMenu: Const Reference to the current Store Mode / Menu.
int currentMenu: The current Store Mode / Menu.
*/
void StoreUtils::DrawSideMenu(const int &currentMenu) {
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 &currentMenu) {
- Switch between the Menus through the sidebar.
u32 hDown: The hidKeysDown() variable.
touchPosition touch: The TouchPosition variable.
int &currentMenu: 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 &currentMenu, bool &fetch) {
void StoreUtils::SideMenuHandle(int &currentMenu, bool &fetch) {
if (hDown & KEY_TOUCH) {
for (int i = 0; i < 5; i++) {
if (touching(touch, sidePos[i])) {
+6 -9
View File
@@ -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> &store: Reference to the Store class.
std::vector<std::unique_ptr<StoreEntry>> &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> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, bool &asc, SortType &st) {
void StoreUtils::SortHandle(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &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. */
+20 -20
View File
@@ -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<std::string> Store::GetCategoryIndex(const int &index) const {
std::vector<std::string> 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<std::string> 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<std::string> Store::GetConsoleEntry(const int &index) const {
std::vector<std::string> 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<std::string> 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<std::string> Store::GetDownloadList(const int &index) const {
std::vector<std::string> Store::GetDownloadList(int index) const {
if (!this->valid) return { "" };
std::vector<std::string> temp;
+2 -2
View File
@@ -31,9 +31,9 @@
const std::unique_ptr<Store> &store: Const Reference to the Store class.
const std::unique_ptr<Meta> &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> &store, const std::unique_ptr<Meta> &meta, const int &index) {
StoreEntry::StoreEntry(const std::unique_ptr<Store> &store, const std::unique_ptr<Meta> &meta, int index) {
this->Title = store->GetTitleEntry(index);
this->Author = store->GetAuthorEntry(index);
+3 -3
View File
@@ -80,11 +80,11 @@ bool StoreUtils::compareUpdateAscending(const std::unique_ptr<StoreEntry> &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<std::unique_ptr<StoreEntry>> &entries: Reference to the Entries, which should be sorted.
*/
void StoreUtils::SortEntries(const bool &Ascending, const SortType &sorttype, std::vector<std::unique_ptr<StoreEntry>> &entries) {
void StoreUtils::SortEntries(bool Ascending, SortType sorttype, std::vector<std::unique_ptr<StoreEntry>> &entries) {
switch(sorttype) {
case SortType::TITLE:
Ascending ? std::sort(entries.begin(), entries.end(), StoreUtils::compareTitleAscending) : std::sort(entries.begin(), entries.end(), StoreUtils::compareTitleDescending);
+3 -3
View File
@@ -45,10 +45,10 @@ extern curl_off_t downloadNow;
/*
Draw the progressbar.
const u64 &currentProgress: 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 &currentProgress, 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);
}
+4 -4
View File
@@ -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;
+9 -8
View File
@@ -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 &currentRev: 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 &currentRev, 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"));
+1 -1
View File
@@ -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);
+4 -4
View File
@@ -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; };
+1 -1
View File
@@ -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);