mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
UniStore list and screenshots (#54)
* Initial push. * Fix png loading * Remove unneeded casts * Push my progress. * Improve screenshot display * Hopefully last commit here before merge? Co-authored-by: StackZ <47382115+SuperSaiyajinStackZ@users.noreply.github.com>
This commit is contained in:
+13
-5
@@ -68,8 +68,15 @@ public:
|
||||
void drawThread();
|
||||
void captureThread();
|
||||
void handler(std::vector<u8>& out);
|
||||
bool done() const { return finished; };
|
||||
bool cancelled() const { return cancel; };
|
||||
bool done() const { return this->finished; };
|
||||
bool cancelled() const { return this->cancel; };
|
||||
bool Mode() const { return this->mode; };
|
||||
void Info(bool v) { this->displayInfo = v; };
|
||||
|
||||
int selectedStore = 0, sPos = 0;
|
||||
std::vector<StoreList> stores = { };
|
||||
bool FromList = false;
|
||||
uint8_t timeout = 30;
|
||||
private:
|
||||
void buffToImage();
|
||||
void finish();
|
||||
@@ -83,15 +90,16 @@ private:
|
||||
std::atomic<bool> finished = false;
|
||||
bool capturing = false;
|
||||
bool cancel = false;
|
||||
bool mode = true; // True -> Camera, False -> URL.
|
||||
bool displayInfo = false;
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
This is, what should get called.
|
||||
*/
|
||||
namespace QR_Scanner {
|
||||
/* Empty == cancelled. */
|
||||
std::vector<u8> scan();
|
||||
std::string GetQRURL();
|
||||
std::string StoreHandle();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -40,6 +40,7 @@
|
||||
2: Search + Favorites.
|
||||
3: Sorting.
|
||||
4: Settings / Credits(?).
|
||||
5: Screenshot Menu.
|
||||
*/
|
||||
|
||||
class MainScreen : public Screen {
|
||||
@@ -52,13 +53,20 @@ private:
|
||||
std::unique_ptr<Meta> meta = nullptr;
|
||||
std::vector<std::unique_ptr<StoreEntry>> entries;
|
||||
std::vector<std::string> dwnldList, dwnldSizes;
|
||||
bool initialized = false, fetchDown = false, showMarks = false, showSettings = false, ascending = false, updateFilter = false;
|
||||
int storeMode = 0, marks = 0, markIndex = 0, sPage = 0, lMode = 0, sSelection = 0, lastMode = 0, smallDelay = 0, sPos = 0;
|
||||
|
||||
bool initialized = false, fetchDown = false, showMarks = false, showSettings = false,
|
||||
ascending = false, updateFilter = false, screenshotFetch = false;
|
||||
|
||||
int storeMode = 0, marks = 0, markIndex = 0, sPage = 0, lMode = 0, sSelection = 0,
|
||||
lastMode = 0, smallDelay = 0, sPos = 0, screenshotIndex = 0, sSize = 0, zoom = 0;
|
||||
|
||||
SortType sorttype = SortType::LAST_UPDATED;
|
||||
|
||||
/* Title, Author, Category, Console. */
|
||||
std::vector<bool> searchIncludes = { false, false, false, false };
|
||||
std::string searchResult = "";
|
||||
std::string searchResult = "", screenshotName = "";
|
||||
|
||||
C2D_Image Screenshot = { nullptr, nullptr };
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -55,6 +55,8 @@ public:
|
||||
std::string GetLicenseEntry(int index) const;
|
||||
C2D_Image GetIconEntry(int index) const;
|
||||
std::string GetFileSizes(int index, const std::string &entry) const;
|
||||
std::vector<std::string> GetScreenshotList(int index) const;
|
||||
std::vector<std::string> GetScreenshotNames(int index) const;
|
||||
|
||||
std::vector<std::string> GetDownloadList(int index) const;
|
||||
|
||||
|
||||
@@ -53,6 +53,8 @@ public:
|
||||
std::vector<std::string> GetCategoryFull() const { return this->FullCategory; };
|
||||
std::vector<std::string> GetConsoleFull() const { return this->FullConsole; };
|
||||
std::vector<std::string> GetSizes() const { return this->Sizes; };
|
||||
std::vector<std::string> GetScreenshots() const { return this->Screenshots; };
|
||||
std::vector<std::string> GetScreenshotNames() const { return this->ScreenshotNames; };
|
||||
|
||||
bool GetUpdateAvl() const { return this->UpdateAvailable; };
|
||||
void SetUpdateAvl(bool v) { this->UpdateAvailable = v; };
|
||||
@@ -66,7 +68,7 @@ private:
|
||||
std::string Title, Author, Description, Category, Version, Console, LastUpdated, License, MarkString;
|
||||
C2D_Image Icon;
|
||||
int SheetIndex, EntryIndex, Marks;
|
||||
std::vector<std::string> FullCategory, FullConsole, Sizes;
|
||||
std::vector<std::string> FullCategory, FullConsole, Sizes, Screenshots, ScreenshotNames;
|
||||
bool UpdateAvailable;
|
||||
};
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace StoreUtils {
|
||||
|
||||
/* Entry Info. */
|
||||
void DrawEntryInfo(const std::unique_ptr<Store> &store, const std::unique_ptr<StoreEntry> &entry);
|
||||
void EntryHandle(bool &showMark, bool &fetch);
|
||||
void EntryHandle(bool &showMark, bool &fetch, bool &sFetch, int &mode);
|
||||
|
||||
/* Side Menu. */
|
||||
void DrawSideMenu(int currentMenu);
|
||||
@@ -70,6 +70,10 @@ namespace StoreUtils {
|
||||
/* Credits. */
|
||||
void DrawCredits();
|
||||
|
||||
/* Screenshot menu. */
|
||||
void DrawScreenshotMenu(const C2D_Image &img, const int sIndex, const bool sFetch, const int screenshotSize, const std::string &name, const int zoom);
|
||||
void ScreenshotMenu(C2D_Image &img, int &sIndex, bool &sFetch, int &storeMode, const int screenshotSize, int &zoom);
|
||||
|
||||
/* Settings. */
|
||||
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);
|
||||
|
||||
@@ -41,6 +41,13 @@ enum DownloadError {
|
||||
DL_CANCEL, // No clue if that's needed tho.
|
||||
};
|
||||
|
||||
struct StoreList {
|
||||
std::string Title;
|
||||
std::string Author;
|
||||
std::string URL;
|
||||
std::string Description;
|
||||
};
|
||||
|
||||
Result downloadToFile(const std::string &url, const std::string &path);
|
||||
Result downloadFromRelease(const std::string &url, const std::string &asset, const std::string &path, bool includePrereleases);
|
||||
|
||||
@@ -70,5 +77,7 @@ bool DownloadUniStore(const std::string &URL, int currentRev, std::string &fl, b
|
||||
bool DownloadSpriteSheet(const std::string &URL, const std::string &file);
|
||||
bool IsUUUpdateAvailable();
|
||||
void UpdateAction();
|
||||
std::vector<StoreList> FetchStores();
|
||||
C2D_Image FetchScreenshot(const std::string &URL);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2020 Universal-Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _UNIVERSAL_UPDATER_SCREENSHOT_HPP
|
||||
#define _UNIVERSAL_UPDATER_SCREENSHOT_HPP
|
||||
|
||||
#include <citro2d.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Screenshot {
|
||||
C2D_Image Convert(const std::string &filename);
|
||||
C2D_Image ConvertFromBuffer(const std::vector<u8> &buffer);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user