PayloadLoaderInstaller/source/ApplicationState.h

103 lines
2.5 KiB
C
Raw Normal View History

2020-10-14 13:54:25 +02:00
#pragma once
#include <string>
#include <optional>
#include <input/Input.h>
2020-10-14 13:54:25 +02:00
#include "common/common.h"
#include "InstallerService.h"
2020-12-02 15:57:13 +01:00
#include "Menu.h"
2020-10-14 13:54:25 +02:00
class ApplicationState {
public:
enum eErrorState {
ERROR_NONE,
ERROR_IOSUHAX_FAILED,
ERROR_NO_APP_INSTALLED,
ERROR_INSTALLER_ERROR,
ERROR_UNEXPECTED_STATE
2020-10-14 13:54:25 +02:00
};
enum eGameState {
STATE_ERROR,
STATE_WELCOME_SCREEN,
STATE_GET_APP_INFORMATION,
STATE_CHECK_PATCH_POSSIBLE,
2020-12-02 15:57:13 +01:00
STATE_CHECK_COLDBOOT_STATUS,
2020-12-01 02:05:24 +01:00
STATE_CHECK_REMOVAL_POSSIBLE,
2020-12-02 15:57:13 +01:00
STATE_COMPATIBILITY_RESULTS,
STATE_APP_INCOMPATIBLE,
STATE_MAIN_MENU,
2020-10-14 13:54:25 +02:00
STATE_INSTALL_CONFIRM_DIALOG,
STATE_INSTALL_STARTED,
STATE_INSTALL_BACKUP,
2020-10-14 13:54:25 +02:00
STATE_INSTALL_FST,
STATE_INSTALL_COS,
STATE_INSTALL_RPX,
2020-12-01 02:05:24 +01:00
STATE_INSTALL_SUCCESS,
STATE_REMOVE_CONFIRM_DIALOG,
STATE_REMOVE_STARTED,
STATE_REMOVE_COLDBOOT,
STATE_REMOVE_AROMA,
2020-12-02 15:57:13 +01:00
STATE_REMOVE_SUCCESS,
STATE_BOOT_MENU,
STATE_BOOT_SWITCH_SYSMENU,
STATE_BOOT_SWITCH_AROMA,
STATE_BOOT_SWITCH_SUCCESS,
STATE_EXIT_SYSMENU,
STATE_EXIT_SHUTDOWN,
2020-10-14 13:54:25 +02:00
};
ApplicationState();
void setError(eErrorState error);
2020-12-02 15:57:13 +01:00
void changeState(eGameState newState);
2020-10-14 13:54:25 +02:00
void render();
void update(Input *input);
void checkPatchPossible();
2020-12-02 15:57:13 +01:00
void checkColdbootStatus();
2020-12-01 02:05:24 +01:00
void checkRemovalPossible();
2020-10-14 13:54:25 +02:00
void getAppInformation();
std::optional<appInformation> appInfo;
std::string ErrorMessage();
std::string ErrorDescription();
InstallerService::eResults installerError = InstallerService::eResults::SUCCESS;
private:
2020-12-02 15:57:13 +01:00
Menu<eGameState> menu;
2020-10-14 13:54:25 +02:00
bool fstPatchPossible = false;
bool cosPatchPossible = false;
2020-12-02 15:57:13 +01:00
2020-12-01 02:05:24 +01:00
bool removalPossible = false;
2020-12-02 15:57:13 +01:00
bool installPossible = false;
bool alreadyInstalledAndUpdated = false;
2020-12-02 15:57:13 +01:00
bool systemXMLPatchPossible = false;
bool systemXMLPatchAllowed = false;
bool systemXMLPatchAllowedButNoRPXCheck = false;
2020-12-02 15:57:13 +01:00
bool systemXMLAlreadyPatched = false;
bool systemXMLRestorePossible = false;
2020-10-14 13:54:25 +02:00
eGameState state = STATE_WELCOME_SCREEN;
2020-10-14 13:54:25 +02:00
eErrorState error = ERROR_NONE;
uint64_t coldbootTitleId = 0;
_gList_t *coldbootTitle = nullptr;
2020-12-01 02:05:24 +01:00
std::optional<uint64_t> systemMenuTitleId;
bool fstAlreadyPatched = false;
bool rpxAlreadyPatched = false;
bool cosAlreadyPatched = false;
bool tmdValid = false;
2020-10-14 13:54:25 +02:00
};