add gc_menu, add progress, icon, time remaining to progress bar (see full commit message).
- fix ignore distribution bit doing nothing. - fix yati failing to parse control nca causing the transfer to abort. - yati now uses ncm rather than ns to get the latest app version. - improve ui::list input handling (it handles directional buttons now). - progress bar displays speed and time remaining. - added gc menu (taken from my gc installer nx and gci).
This commit is contained in:
@@ -3,20 +3,38 @@
|
||||
#include "ui/menus/menu_base.hpp"
|
||||
#include "yati/container/base.hpp"
|
||||
#include "yati/source/base.hpp"
|
||||
#include "ui/list.hpp"
|
||||
#include <span>
|
||||
#include <memory>
|
||||
|
||||
namespace sphaira::ui::menu::gc {
|
||||
|
||||
enum class State {
|
||||
// no gamecard inserted.
|
||||
None,
|
||||
// set whilst transfer is in progress.
|
||||
Progress,
|
||||
// set when the transfer is finished.
|
||||
Done,
|
||||
// set when no gamecard is inserted.
|
||||
NotFound,
|
||||
// failed to parse gamecard.
|
||||
Failed,
|
||||
struct GcCollection : yati::container::CollectionEntry {
|
||||
GcCollection(const char* _name, s64 _size, u8 _type) {
|
||||
name = _name;
|
||||
size = _size;
|
||||
type = _type;
|
||||
}
|
||||
|
||||
// NcmContentType
|
||||
u8 type{};
|
||||
};
|
||||
|
||||
using GcCollections = std::vector<GcCollection>;
|
||||
|
||||
struct ApplicationEntry {
|
||||
u64 app_id{};
|
||||
u32 version{};
|
||||
u8 key_gen{};
|
||||
|
||||
std::vector<GcCollections> application{};
|
||||
std::vector<GcCollections> patch{};
|
||||
std::vector<GcCollections> add_on{};
|
||||
std::vector<GcCollections> data_patch{};
|
||||
yati::container::Collections tickets{};
|
||||
|
||||
auto GetSize() const -> s64;
|
||||
auto GetSize(const std::vector<GcCollections>& entries) const -> s64;
|
||||
};
|
||||
|
||||
struct Menu final : MenuBase {
|
||||
@@ -26,13 +44,32 @@ struct Menu final : MenuBase {
|
||||
void Update(Controller* controller, TouchInfo* touch) override;
|
||||
void Draw(NVGcontext* vg, Theme* theme) override;
|
||||
|
||||
Result ScanGamecard();
|
||||
private:
|
||||
Result GcMount();
|
||||
void GcUnmount();
|
||||
Result GcPoll(bool* inserted);
|
||||
Result UpdateStorageSize();
|
||||
|
||||
void FreeImage();
|
||||
void OnChangeIndex(s64 new_index);
|
||||
|
||||
private:
|
||||
std::unique_ptr<fs::FsNativeGameCard> m_fs{};
|
||||
FsDeviceOperator m_dev_op{};
|
||||
yati::container::Collections m_collections{};
|
||||
State m_state{State::None};
|
||||
FsGameCardHandle m_handle{};
|
||||
std::unique_ptr<fs::FsNativeGameCard> m_fs{};
|
||||
|
||||
std::vector<ApplicationEntry> m_entries{};
|
||||
std::unique_ptr<List> m_list{};
|
||||
s64 m_entry_index{};
|
||||
s64 m_option_index{};
|
||||
|
||||
s64 m_size_free_sd{};
|
||||
s64 m_size_total_sd{};
|
||||
s64 m_size_free_nand{};
|
||||
s64 m_size_total_nand{};
|
||||
NacpLanguageEntry m_lang_entry{};
|
||||
int m_icon{};
|
||||
bool m_mounted{};
|
||||
};
|
||||
|
||||
} // namespace sphaira::ui::menu::gc
|
||||
|
||||
Reference in New Issue
Block a user