mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
A bunch of minor tweaks from cppcheck
This commit is contained in:
@@ -188,80 +188,58 @@ void StoreUtils::DownloadHandle(const std::unique_ptr<StoreEntry> &entry, const
|
||||
}
|
||||
|
||||
if (hRepeat & KEY_DOWN) {
|
||||
if (entries.size() <= 0) return; // Smaller *than* 0 -> Invalid.
|
||||
|
||||
if (StoreUtils::store->GetDownloadIndex() < (int)entries.size() - 1) StoreUtils::store->SetDownloadIndex(StoreUtils::store->GetDownloadIndex() + 1);
|
||||
else StoreUtils::store->SetDownloadIndex(0);
|
||||
}
|
||||
|
||||
if (hRepeat & KEY_UP) {
|
||||
if (entries.size() <= 0) return; // Smaller *than* 0 -> Invalid.
|
||||
|
||||
if (StoreUtils::store->GetDownloadIndex() > 0) StoreUtils::store->SetDownloadIndex(StoreUtils::store->GetDownloadIndex() - 1);
|
||||
else StoreUtils::store->SetDownloadIndex(entries.size() - 1);
|
||||
}
|
||||
|
||||
|
||||
if (hRepeat & KEY_RIGHT) {
|
||||
if (entries.size() <= 0) return; // Smaller *than* 0 -> Invalid.
|
||||
|
||||
if (StoreUtils::store->GetDownloadIndex() + DOWNLOAD_ENTRIES < (int)entries.size()-1) StoreUtils::store->SetDownloadIndex(StoreUtils::store->GetDownloadIndex() + DOWNLOAD_ENTRIES);
|
||||
else StoreUtils::store->SetDownloadIndex(entries.size()-1);
|
||||
}
|
||||
|
||||
if (hRepeat & KEY_LEFT) {
|
||||
if (entries.size() <= 0) return; // Smaller *than* 0 -> Invalid.
|
||||
|
||||
if (StoreUtils::store->GetDownloadIndex() - DOWNLOAD_ENTRIES > 0) StoreUtils::store->SetDownloadIndex(StoreUtils::store->GetDownloadIndex() - DOWNLOAD_ENTRIES);
|
||||
else StoreUtils::store->SetDownloadIndex(0);
|
||||
}
|
||||
|
||||
if (smallDelay == 0 && hDown & KEY_TOUCH) {
|
||||
if (entries.size() <= 0) return; // Smaller *than* 0 -> Invalid.
|
||||
|
||||
bool didTouch = false;
|
||||
|
||||
for (int i = 0; i < DOWNLOAD_ENTRIES; i++) {
|
||||
if (touching(touch, downloadBoxes[i])) {
|
||||
if (i + StoreUtils::store->GetDownloadSIndex() < (int)entries.size()) {
|
||||
if (Msg::promptMsg(Lang::get("EXECUTE_ENTRY") + "\n\n" + entries[i + StoreUtils::store->GetDownloadSIndex()])) {
|
||||
StoreUtils::AddToQueue(entry->GetEntryIndex(), entries[i + StoreUtils::store->GetDownloadSIndex()], entry->GetTitle(), entry->GetLastUpdated());
|
||||
}
|
||||
|
||||
didTouch = true;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!didTouch) {
|
||||
for (int i = 0; i < DOWNLOAD_ENTRIES; i++) {
|
||||
if (touching(touch, installedPos[i])) {
|
||||
if (i + StoreUtils::store->GetDownloadSIndex() < (int)entries.size()) {
|
||||
if (installs[i + StoreUtils::store->GetDownloadSIndex()]) {
|
||||
StoreUtils::meta->RemoveInstalled(StoreUtils::store->GetUniStoreTitle(), entry->GetTitle(), entries[i + StoreUtils::store->GetDownloadSIndex()]);
|
||||
installs[i + StoreUtils::store->GetDownloadSIndex()] = false;
|
||||
}
|
||||
if (touching(touch, installedPos[i])) {
|
||||
if (i + StoreUtils::store->GetDownloadSIndex() < (int)entries.size()) {
|
||||
if (installs[i + StoreUtils::store->GetDownloadSIndex()]) {
|
||||
StoreUtils::meta->RemoveInstalled(StoreUtils::store->GetUniStoreTitle(), entry->GetTitle(), entries[i + StoreUtils::store->GetDownloadSIndex()]);
|
||||
installs[i + StoreUtils::store->GetDownloadSIndex()] = false;
|
||||
}
|
||||
|
||||
didTouch = true;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (smallDelay == 0 && hDown & KEY_A) {
|
||||
if (entries.size() <= 0) return; // Smaller *than* 0 -> Invalid.
|
||||
|
||||
if (Msg::promptMsg(Lang::get("EXECUTE_ENTRY") + "\n\n" + entries[StoreUtils::store->GetDownloadIndex()])) {
|
||||
StoreUtils::AddToQueue(entry->GetEntryIndex(), entries[StoreUtils::store->GetDownloadIndex()], entry->GetTitle(), entry->GetLastUpdated());
|
||||
}
|
||||
}
|
||||
|
||||
if (hDown & KEY_X) {
|
||||
if (entries.size() <= 0) return; // Smaller *than* 0 -> Invalid.
|
||||
|
||||
if (installs[StoreUtils::store->GetDownloadIndex()]) {
|
||||
StoreUtils::meta->RemoveInstalled(StoreUtils::store->GetUniStoreTitle(), entry->GetTitle(), entries[StoreUtils::store->GetDownloadIndex()]);
|
||||
installs[StoreUtils::store->GetDownloadIndex()] = false;
|
||||
|
||||
@@ -47,19 +47,19 @@ static const std::vector<Structs::ButtonPos> markBox = {
|
||||
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 ?
|
||||
Gui::Draw_Rect(markBox[0].x, markBox[0].y, markBox[0].w, markBox[0].h, ((marks & favoriteMarks::STAR) ?
|
||||
UIThemes->MarkSelected() : UIThemes->MarkUnselected()));
|
||||
|
||||
Gui::Draw_Rect(markBox[1].x, markBox[1].y, markBox[1].w, markBox[1].h, (marks & favoriteMarks::HEART ?
|
||||
Gui::Draw_Rect(markBox[1].x, markBox[1].y, markBox[1].w, markBox[1].h, ((marks & favoriteMarks::HEART) ?
|
||||
UIThemes->MarkSelected() : UIThemes->MarkUnselected()));
|
||||
|
||||
Gui::Draw_Rect(markBox[2].x, markBox[2].y, markBox[2].w, markBox[2].h, (marks & favoriteMarks::DIAMOND ?
|
||||
Gui::Draw_Rect(markBox[2].x, markBox[2].y, markBox[2].w, markBox[2].h, ((marks & favoriteMarks::DIAMOND) ?
|
||||
UIThemes->MarkSelected() : UIThemes->MarkUnselected()));
|
||||
|
||||
Gui::Draw_Rect(markBox[3].x, markBox[3].y, markBox[3].w, markBox[3].h, (marks & favoriteMarks::CLUBS ?
|
||||
Gui::Draw_Rect(markBox[3].x, markBox[3].y, markBox[3].w, markBox[3].h, ((marks & favoriteMarks::CLUBS) ?
|
||||
UIThemes->MarkSelected() : UIThemes->MarkUnselected()));
|
||||
|
||||
Gui::Draw_Rect(markBox[4].x, markBox[4].y, markBox[4].w, markBox[4].h, (marks & favoriteMarks::SPADE ?
|
||||
Gui::Draw_Rect(markBox[4].x, markBox[4].y, markBox[4].w, markBox[4].h, ((marks & favoriteMarks::SPADE) ?
|
||||
UIThemes->MarkSelected() : UIThemes->MarkUnselected()));
|
||||
|
||||
Gui::DrawString(markBox[0].x + 15, markBox[0].y + 11, 0.9, UIThemes->TextColor(), "★", 0, 0, font);
|
||||
|
||||
@@ -90,19 +90,19 @@ void StoreUtils::DrawSearchMenu(const std::vector<bool> &searchIncludes, const s
|
||||
/* Filters. */
|
||||
Gui::DrawString(84, SearchMenu[5].y - 20, 0.5f, UIThemes->TextColor(), Lang::get("FILTER_TO"), 265, 0, font);
|
||||
|
||||
Gui::Draw_Rect(SearchMenu[5].x, SearchMenu[5].y, SearchMenu[5].w, SearchMenu[5].h, (marks & favoriteMarks::STAR ?
|
||||
Gui::Draw_Rect(SearchMenu[5].x, SearchMenu[5].y, SearchMenu[5].w, SearchMenu[5].h, ((marks & favoriteMarks::STAR) ?
|
||||
UIThemes->SideBarUnselected() : UIThemes->BoxInside()));
|
||||
|
||||
Gui::Draw_Rect(SearchMenu[6].x, SearchMenu[6].y, SearchMenu[6].w, SearchMenu[6].h, (marks & favoriteMarks::HEART ?
|
||||
Gui::Draw_Rect(SearchMenu[6].x, SearchMenu[6].y, SearchMenu[6].w, SearchMenu[6].h, ((marks & favoriteMarks::HEART) ?
|
||||
UIThemes->SideBarUnselected() : UIThemes->BoxInside()));
|
||||
|
||||
Gui::Draw_Rect(SearchMenu[7].x, SearchMenu[7].y, SearchMenu[7].w, SearchMenu[7].h, (marks & favoriteMarks::DIAMOND ?
|
||||
Gui::Draw_Rect(SearchMenu[7].x, SearchMenu[7].y, SearchMenu[7].w, SearchMenu[7].h, ((marks & favoriteMarks::DIAMOND) ?
|
||||
UIThemes->SideBarUnselected() : UIThemes->BoxInside()));
|
||||
|
||||
Gui::Draw_Rect(SearchMenu[8].x, SearchMenu[8].y, SearchMenu[8].w, SearchMenu[8].h, (marks & favoriteMarks::CLUBS ?
|
||||
Gui::Draw_Rect(SearchMenu[8].x, SearchMenu[8].y, SearchMenu[8].w, SearchMenu[8].h, ((marks & favoriteMarks::CLUBS) ?
|
||||
UIThemes->SideBarUnselected() : UIThemes->BoxInside()));
|
||||
|
||||
Gui::Draw_Rect(SearchMenu[9].x, SearchMenu[9].y, SearchMenu[9].w, SearchMenu[9].h, (marks & favoriteMarks::SPADE ?
|
||||
Gui::Draw_Rect(SearchMenu[9].x, SearchMenu[9].y, SearchMenu[9].w, SearchMenu[9].h, ((marks & favoriteMarks::SPADE) ?
|
||||
UIThemes->SideBarUnselected() : UIThemes->BoxInside()));
|
||||
|
||||
Gui::Draw_Rect(SearchMenu[10].x, SearchMenu[10].y, SearchMenu[10].w, SearchMenu[10].h, (updateFilter ?
|
||||
|
||||
@@ -636,14 +636,13 @@ static void LanguageLogic(int &page, int &selection, int &sPos) {
|
||||
sPos = 0;
|
||||
page = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hDown & KEY_TOUCH) {
|
||||
if (touching(touch, langButtons[6])) {
|
||||
/* Download Font. */
|
||||
std::string l = config->language();
|
||||
ScriptUtils::downloadFile("https://github.com/Universal-Team/extras/raw/master/files/universal-updater.bcfnt", "sdmc:/3ds/Universal-Updater/font.bcfnt", Lang::get("DOWNLOADING_COMPATIBLE_FONT"), true);
|
||||
config->customfont(true);
|
||||
Init::UnloadFont();
|
||||
|
||||
Reference in New Issue
Block a user