Update copyright. Added passcode view. Added force_es_patches to internal file. Have the passcode view show up when holding down X for 2 seconds.

sdl-less
Nichole Mattera 4 years ago
parent 91fbb1271b
commit 46ae6c31ee
  1. 3
      README.md
  2. 2
      src/AssetManager.cpp
  3. 2
      src/AssetManager.hpp
  4. 50
      src/ConfigManager.cpp
  5. 39
      src/ConfigManager.hpp
  6. 7
      src/FileManager.cpp
  7. 4
      src/FileManager.hpp
  8. 4
      src/ModalView.cpp
  9. 4
      src/ModalView.hpp
  10. 2
      src/NetManager.cpp
  11. 2
      src/NetManager.hpp
  12. 4
      src/Scene.cpp
  13. 4
      src/Scene.hpp
  14. 6
      src/SceneDirector.cpp
  15. 2
      src/SceneDirector.hpp
  16. 2
      src/View.cpp
  17. 2
      src/View.hpp
  18. 2
      src/main.cpp
  19. 2
      src/models/Action.cpp
  20. 2
      src/models/Action.hpp
  21. 2
      src/models/Ini.cpp
  22. 2
      src/models/Ini.hpp
  23. 2
      src/models/IniOption.cpp
  24. 2
      src/models/IniOption.hpp
  25. 2
      src/models/IniSection.cpp
  26. 2
      src/models/IniSection.hpp
  27. 2
      src/models/NetRequest.cpp
  28. 2
      src/models/NetRequest.hpp
  29. 2
      src/models/ThreadObj.cpp
  30. 2
      src/models/ThreadObj.hpp
  31. 2
      src/models/Touch.cpp
  32. 2
      src/models/Touch.hpp
  33. 2
      src/models/Zip.cpp
  34. 2
      src/models/Zip.hpp
  35. 4
      src/scenes/AppUpdateScene.cpp
  36. 4
      src/scenes/AppUpdateScene.hpp
  37. 4
      src/scenes/ExFatWarningScene.cpp
  38. 4
      src/scenes/ExFatWarningScene.hpp
  39. 4
      src/scenes/PackageDownloadScene.cpp
  40. 4
      src/scenes/PackageDownloadScene.hpp
  41. 23
      src/scenes/PackageSelectScene.cpp
  42. 10
      src/scenes/PackageSelectScene.hpp
  43. 2
      src/views/AlertButtonView.cpp
  44. 2
      src/views/AlertButtonView.hpp
  45. 4
      src/views/AlertView.cpp
  46. 4
      src/views/AlertView.hpp
  47. 2
      src/views/ControlView.cpp
  48. 2
      src/views/ControlView.hpp
  49. 2
      src/views/FooterView.cpp
  50. 2
      src/views/FooterView.hpp
  51. 2
      src/views/HeaderView.cpp
  52. 2
      src/views/HeaderView.hpp
  53. 2
      src/views/ImageView.cpp
  54. 2
      src/views/ImageView.hpp
  55. 2
      src/views/ListHeaderView.cpp
  56. 2
      src/views/ListHeaderView.hpp
  57. 2
      src/views/ListRowView.cpp
  58. 2
      src/views/ListRowView.hpp
  59. 4
      src/views/MultiSelectView.cpp
  60. 4
      src/views/MultiSelectView.hpp
  61. 45
      src/views/PasscodeView.cpp
  62. 34
      src/views/PasscodeView.hpp
  63. 2
      src/views/ProgressBarView.cpp
  64. 2
      src/views/ProgressBarView.hpp
  65. 2
      src/views/StatusView.cpp
  66. 2
      src/views/StatusView.hpp
  67. 2
      src/views/TextView.cpp
  68. 2
      src/views/TextView.hpp
  69. 2
      src/views/UpdateView.cpp
  70. 2
      src/views/UpdateView.hpp

@ -7,9 +7,6 @@ A homebrew application for the Nintendo Switch that will automatically update yo
| Config option | Description
| --------------------------------------------------------------------------- | ---
| `host = "http://kosmos-updater.teamatlasnx.com";` | Which server to connect to. You can host your own server using the files in the [server repository](https://github.com/AtlasNX/Kosmos-Updater-Server).
| `channel = "stable";` | Stable (*stable*) will download the latest tag and bleeding edge (*bleeding-edge*) will download the latest commit.
| `bundle = "kosmos";` | The bundle to install. (`kosmos`, `hekate`, or `atmosphere`)
| `version = "";` | The version of Kosmos that is currently installed on your SD card.
| `ignore = [ "sdmc://fileToIgnore.nro", "sdmc://anotherFileToIgnore.nro" ];` | Array of files to ignore when extracting.
| `autoupdate = true;` | Whether or not to auto update Kosmos Updater.
| `proxy_enabled = false;` | Whether or not to use a proxy for network calls.

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -68,6 +68,9 @@ void ConfigManager::initialize() {
setting = config_setting_add(root, RECEIVED_EXFAT_WARNING_KEY.c_str(), CONFIG_TYPE_BOOL);
config_setting_set_bool(setting, RECEIVED_EXFAT_WARNING_DEF);
setting = config_setting_add(root, FORCE_ES_PATCHES_KEY.c_str(), CONFIG_TYPE_BOOL);
config_setting_set_bool(setting, FORCE_ES_PATCHES_DEF);
config_write_file(&_internalDb, INTERNAL_FILENAME.c_str());
}
@ -84,18 +87,6 @@ string ConfigManager::getHost() {
return _readString(HOST_KEY, HOST_DEF, _cfg);
}
string ConfigManager::getChannel() {
return _readString(CHANNEL_KEY, CHANNEL_DEF, _internalDb);
}
string ConfigManager::getBundle() {
return _readString(BUNDLE_KEY, BUNDLE_DEF, _internalDb);
}
string ConfigManager::getCurrentVersion() {
return _readString(VERSION_KEY, VERSION_DEF, _internalDb);
}
vector<string> ConfigManager::getFilesToIgnore() {
vector<string> defaultValue;
return _readArrayOfStrings(IGNORE_KEY, defaultValue, _cfg);
@ -125,16 +116,17 @@ string ConfigManager::getProxyPassword() {
return _readString(PROXY_PASSWORD_KEY, PROXY_PASSWORD_DEF, _cfg);
}
bool ConfigManager::setChannel(string channel) {
return _writeString(CHANNEL_KEY, channel, _internalDb, INTERNAL_FILENAME);
string ConfigManager::getChannel() {
return _readString(CHANNEL_KEY, CHANNEL_DEF, _internalDb);
}
bool ConfigManager::setBundle(string bundle) {
return _writeString(BUNDLE_KEY, bundle, _internalDb, INTERNAL_FILENAME);
string ConfigManager::getBundle() {
return _readString(BUNDLE_KEY, BUNDLE_DEF, _internalDb);
}
bool ConfigManager::setCurrentVersion(string version) {
return _writeString(VERSION_KEY, version, _internalDb, INTERNAL_FILENAME);
string ConfigManager::getCurrentVersion() {
return _readString(VERSION_KEY, VERSION_DEF, _internalDb);
}
vector<string> ConfigManager::getInstalledFiles() {
@ -150,6 +142,22 @@ bool ConfigManager::getReceivedExFATWarning() {
return _readBoolean(RECEIVED_EXFAT_WARNING_KEY, RECEIVED_EXFAT_WARNING_DEF, _internalDb);
}
bool ConfigManager::getForceESPatches() {
return _readBoolean(FORCE_ES_PATCHES_KEY, FORCE_ES_PATCHES_DEF, _internalDb);
}
bool ConfigManager::setChannel(string channel) {
return _writeString(CHANNEL_KEY, channel, _internalDb, INTERNAL_FILENAME);
}
bool ConfigManager::setBundle(string bundle) {
return _writeString(BUNDLE_KEY, bundle, _internalDb, INTERNAL_FILENAME);
}
bool ConfigManager::setCurrentVersion(string version) {
return _writeString(VERSION_KEY, version, _internalDb, INTERNAL_FILENAME);
}
bool ConfigManager::setInstalledFiles(vector<string> files) {
return _writeArrayOfStrings(INSTALLED_FILES_KEY, files, _internalDb, INTERNAL_FILENAME);
}
@ -162,6 +170,10 @@ bool ConfigManager::setReceivedExFATWarning(bool received) {
return _writeBoolean(RECEIVED_EXFAT_WARNING_KEY, received, _internalDb, INTERNAL_FILENAME);
}
bool ConfigManager::setForceESPatches(bool enabled) {
return _writeBoolean(FORCE_ES_PATCHES_KEY, enabled, _internalDb, INTERNAL_FILENAME);
}
// Private Methods
void ConfigManager::_performMigration() {

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -29,9 +29,6 @@ class ConfigManager {
static void dealloc();
static string getHost();
static string getChannel();
static string getBundle();
static string getCurrentVersion();
static vector<string> getFilesToIgnore();
static bool shouldAutoUpdate();
static bool shouldUseProxy();
@ -39,17 +36,21 @@ class ConfigManager {
static string getProxyUsername();
static string getProxyPassword();
static bool setChannel(string channel);
static bool setBundle(string bundle);
static bool setCurrentVersion(string version);
static string getChannel();
static string getBundle();
static string getCurrentVersion();
static vector<string> getInstalledFiles();
static bool getDisabledGameCart();
static bool getReceivedExFATWarning();
static bool getForceESPatches();
static bool setChannel(string channel);
static bool setBundle(string bundle);
static bool setCurrentVersion(string version);
static bool setInstalledFiles(vector<string> files);
static bool setDisabledGameCart(bool disabled);
static bool setReceivedExFATWarning(bool received);
static bool setForceESPatches(bool enabled);
private:
static inline config_t _cfg;
@ -73,15 +74,6 @@ class ConfigManager {
static inline const string HOST_KEY = "host";
static inline const string HOST_DEF = "http://kosmos-updater.teamatlasnx.com";
static inline const string CHANNEL_KEY = "channel";
static inline const string CHANNEL_DEF = "stable";
static inline const string BUNDLE_KEY = "bundle";
static inline const string BUNDLE_DEF = "kosmos";
static inline const string VERSION_KEY = "version";
static inline const string VERSION_DEF = "";
static inline const string IGNORE_KEY = "ignore";
static inline const string AUTOUPDATE_KEY = "autoupdate";
@ -99,6 +91,16 @@ class ConfigManager {
static inline const string PROXY_PASSWORD_KEY = "proxy_password";
static inline const string PROXY_PASSWORD_DEF = "";
static inline const string CHANNEL_KEY = "channel";
static inline const string CHANNEL_DEF = "stable";
static inline const string BUNDLE_KEY = "bundle";
static inline const string BUNDLE_DEF = "kosmos";
static inline const string VERSION_KEY = "version";
static inline const string VERSION_DEF = "";
static inline const string INSTALLED_FILES_KEY = "installed_files";
static inline const string DISABLED_GAME_CART_KEY = "disabled_game_cart";
@ -106,4 +108,7 @@ class ConfigManager {
static inline const string RECEIVED_EXFAT_WARNING_KEY = "received_exfat_warning";
static inline const bool RECEIVED_EXFAT_WARNING_DEF = false;
static inline const string FORCE_ES_PATCHES_KEY = "force_es_patches";
static inline const bool FORCE_ES_PATCHES_DEF = false;
};

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -103,6 +103,11 @@ void FileManager::applyNoGC(ThreadObj * status) {
_createThread(_applyNoGC, status);
}
bool FileManager::esPatchesExists() {
struct stat info;
return stat(ES_PATCH_DIR.c_str(), &info) != 0 && info.st_mode & S_IFDIR;
}
Result FileManager::_createThread(ThreadFunc func, ThreadObj * arg) {
Thread thread;
Result res;

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -35,6 +35,7 @@ class FileManager {
static void extract(Zip * zip);
static void cleanUpFiles(ThreadObj * status);
static void applyNoGC(ThreadObj * status);
static bool esPatchesExists();
private:
static inline vector<Thread> _threads;
@ -49,4 +50,5 @@ class FileManager {
static int _extractFile(const char * path, unzFile unz, unz_file_info_s * fileInfo);
static inline const string HEKATE_FILE = "sdmc:/bootloader/hekate_ipl.ini";
static inline const string ES_PATCH_DIR = "sdmc:/atmosphere/exefs_patches/es_patches";
};

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -18,7 +18,7 @@
#include "ModalView.hpp"
#include "SceneDirector.hpp"
void ModalView::handleButton(u32 buttons) {}
void ModalView::handleButton(u32 buttons, double dTime) {}
void ModalView::show() {
SceneDirector::modal = this;

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -29,7 +29,7 @@ class ModalView : public View {
public:
function<void(ModalView *, bool)> onDismiss;
virtual void handleButton(u32 buttons);
virtual void handleButton(u32 buttons, double dTime);
void show();
void dismiss(bool success);

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -23,7 +23,7 @@ Scene::Scene() {
Scene::~Scene() {}
void Scene::handleButton(u32 buttons) {}
void Scene::handleButton(u32 buttons, double dTime) {}
void Scene::render(SDL_Rect rect, double dTime) {
for (auto const& view : subviews) {

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -29,7 +29,7 @@ class Scene {
Scene();
virtual ~Scene();
virtual void handleButton(u32 buttons);
virtual void handleButton(u32 buttons, double dTime);
virtual void render(SDL_Rect rect, double dTime);
/* Touch Controls */

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -168,9 +168,9 @@ bool SceneDirector::direct() {
}
if (modal != NULL) {
modal->handleButton(kDown);
modal->handleButton(kDown, dTime);
} else {
_currentScene->handleButton(kDown);
_currentScene->handleButton(kDown, dTime);
}
_currentScene->render({ 0, 0, 1280, 720 }, dTime);

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -65,7 +65,7 @@ AppUpdateScene::~AppUpdateScene() {
delete _footerView;
}
void AppUpdateScene::handleButton(u32 buttons) {
void AppUpdateScene::handleButton(u32 buttons, double dTime) {
if (!_statusView->hidden && buttons & KEY_A) {
SceneDirector::exitApp = true;
}

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -32,7 +32,7 @@ class AppUpdateScene : public Scene {
AppUpdateScene();
~AppUpdateScene();
void handleButton(u32 buttons);
void handleButton(u32 buttons, double dTime);
void render(SDL_Rect rect, double dTime);
private:

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -54,7 +54,7 @@ ExFatWarningScene::~ExFatWarningScene() {
delete _footerTextView;
}
void ExFatWarningScene::handleButton(u32 buttons) {
void ExFatWarningScene::handleButton(u32 buttons, double dTime) {
if (buttons > 0 && _footerVisible) {
Mix_PlayChannel(-1, AssetManager::enter, 0);
ConfigManager::setReceivedExFATWarning(true);

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -28,7 +28,7 @@ class ExFatWarningScene : public Scene {
ExFatWarningScene();
~ExFatWarningScene();
void handleButton(u32 buttons);
void handleButton(u32 buttons, double dTime);
void render(SDL_Rect rect, double dTime);
private:

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -89,7 +89,7 @@ PackageDownloadScene::~PackageDownloadScene() {
bpcExit();
}
void PackageDownloadScene::handleButton(u32 buttons) {
void PackageDownloadScene::handleButton(u32 buttons, double dTime) {
if (!_statusView->hidden && buttons & KEY_A) {
SceneDirector::exitApp = true;
}

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -33,7 +33,7 @@ class PackageDownloadScene : public Scene {
PackageDownloadScene();
~PackageDownloadScene();
void handleButton(u32 buttons);
void handleButton(u32 buttons, double dTime);
void render(SDL_Rect rect, double dTime);
private:

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -26,6 +26,8 @@ PackageSelectScene::PackageSelectScene() {
_channelOpen = false;
_bundleOpen = false;
_focusSelection = 0;
_passcodeButtonTime = 0;
_passcodeView = NULL;
_headerView = new HeaderView("Kosmos Updater", true);
_headerView->frame = { 0, 0, 1280, 88 };
@ -149,9 +151,26 @@ PackageSelectScene::~PackageSelectScene() {
if (_versionRequest != NULL)
delete _versionRequest;
if (_passcodeView != NULL)
delete _passcodeView;
}
void PackageSelectScene::handleButton(u32 buttons) {
void PackageSelectScene::handleButton(u32 buttons, double dTime) {
if (buttons & KEY_X) {
_passcodeButtonTime += dTime;
if (dTime >= PASSCODE_DELAY) {
if (_passcodeView == NULL) {
_passcodeView = new PasscodeView();
}
_passcodeView->show();
_passcodeButtonTime = 0;
}
} else {
_passcodeButtonTime = 0;
}
if (!_statusView->hidden && buttons & KEY_A) {
Mix_PlayChannel(-1, AssetManager::back, 0);
SceneDirector::exitApp = true;

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -17,6 +17,7 @@
#pragma once
#include <switch.h>
#include "../Scene.hpp"
#include "../views/HeaderView.hpp"
#include "../views/UpdateView.hpp"
@ -28,13 +29,14 @@
#include "../views/AlertView.hpp"
#include "../models/NetRequest.hpp"
#include "../ModalView.hpp"
#include "../views/PasscodeView.hpp"
class PackageSelectScene : public Scene {
public:
PackageSelectScene();
~PackageSelectScene();
void handleButton(u32 buttons);
void handleButton(u32 buttons, double dTime);
void render(SDL_Rect rect, double dTime);
private:
@ -45,6 +47,7 @@ class PackageSelectScene : public Scene {
string _bundleSelected;
int _focusSelection;
bool _disabledGameCart;
double _passcodeButtonTime;
NetRequest * _versionRequest;
@ -61,6 +64,7 @@ class PackageSelectScene : public Scene {
MultiSelectView * _channelMultiSelectView;
MultiSelectView * _bundleMultiSelectView;
AlertView * _disabledGameCartAlertView;
PasscodeView * _passcodeView;
void _updateVersionRequest();
void _showUpdateView();
@ -74,4 +78,6 @@ class PackageSelectScene : public Scene {
void _handleButtonsForChannelMutliSelect(u32 buttons);
void _handleButtonsForBundleMutliSelect(u32 buttons);
void _resetVersion(bool channelChange);
static inline double PASSCODE_DELAY = 2000;
};

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -64,7 +64,7 @@ AlertView::~AlertView() {
_buttons.clear();
}
void AlertView::handleButton(u32 buttons) {
void AlertView::handleButton(u32 buttons, double dTime) {
if (buttons & KEY_LEFT && _focusSelection > 0) {
Mix_PlayChannel(-1, AssetManager::select, 0);
_focusSelection--;

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -32,7 +32,7 @@ class AlertView : public ModalView {
AlertView(string title, string message, vector<string> buttons);
~AlertView();
void handleButton(u32 buttons);
void handleButton(u32 buttons, double dTime);
void render(SDL_Rect rect, double dTime);
int getSelectedOption();
void reset();

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -61,7 +61,7 @@ MultiSelectView::~MultiSelectView() {
delete _footerView;
}
void MultiSelectView::handleButton(u32 buttons) {
void MultiSelectView::handleButton(u32 buttons, double dTime) {
if (buttons & KEY_A) {
Mix_PlayChannel(-1, AssetManager::enter, 0);
dismiss(true);

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -31,7 +31,7 @@ class MultiSelectView : public ModalView {
MultiSelectView(string title, vector<string> options, string selectedOption);
~MultiSelectView();
void handleButton(u32 buttons);
void handleButton(u32 buttons, double dTime);
void render(SDL_Rect rect, double dTime);
string getSelectedOption();
void reset(string selectedOption);

@ -0,0 +1,45 @@
// Kosmos Updater
// Copyright (C) 2019 Steven Mattera
//
// 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 2
// 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, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <SDL2/SDL2_gfxPrimitives.h>
#include "PasscodeView.hpp"
#include "../AssetManager.hpp"
#include "../SceneDirector.hpp"
PasscodeView::PasscodeView() {
}
PasscodeView::~PasscodeView() {
}
void PasscodeView::handleButton(u32 buttons, double dTime) {
}
void PasscodeView::render(SDL_Rect rect, double dTime) {
// Draw background.
roundedBoxRGBA(
SceneDirector::renderer,
255,
0,
1025,
0,
4,
AssetManager::background.r, AssetManager::background.g, AssetManager::background.b, AssetManager::background.a);
// Render any subviews.
View::render(rect, dTime);
}

@ -0,0 +1,34 @@
// Kosmos Updater
// Copyright (C) 2019 Steven Mattera
//
// 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 2
// 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, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#pragma once
#include "../ModalView.hpp"
using namespace std;
class PasscodeView : public ModalView {
public:
PasscodeView();
~PasscodeView();
void handleButton(u32 buttons, double dTime);
void render(SDL_Rect rect, double dTime);
private:
static inline u8 PASSCODE[] = { 0, 3, 1, 2 };
};

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

@ -1,5 +1,5 @@
// Kosmos Updater
// Copyright (C) 2018 Steven Mattera
// Copyright (C) 2019 Steven Mattera
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License

Loading…
Cancel
Save