PayloadLoaderInstaller/source/ApplicationState.h

102 lines
2.4 KiB
C
Raw Permalink Normal View History

2020-10-16 19:48:13 +02:00
#pragma once
#include <string>
#include <optional>
#include "common/common.h"
#include "InstallerService.h"
#include "Input.h"
2020-12-02 15:57:13 +01:00
#include "Menu.h"
2020-10-16 19:48:13 +02:00
class ApplicationState {
public:
enum eErrorState {
ERROR_NONE,
ERROR_IOSUHAX_FAILED,
ERROR_NO_APP_INSTALLED,
ERROR_INSTALLER_ERROR
};
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-16 19:48:13 +02:00
STATE_INSTALL_CONFIRM_DIALOG,
STATE_INSTALL_STARTED,
STATE_INSTALL_BACKUP,
2020-10-16 19:48:13 +02:00
STATE_INSTALL_FST,
STATE_INSTALL_COS,
2020-10-16 22:51:14 +02:00
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-16 19:48:13 +02:00
};
ApplicationState();
void setError(eErrorState error);
2020-12-02 15:57:13 +01:00
void changeState(eGameState newState);
2020-10-16 19:48:13 +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-16 19:48:13 +02:00
void getAppInformation();
std::optional<appInformation> appInfo;
std::string ErrorMessage();
std::string ErrorDescription();
bool installColdboot = false;
InstallerService::eResults installerError = InstallerService::eResults::SUCCESS;
private:
2020-12-02 15:57:13 +01:00
Menu<eGameState> menu;
2020-10-16 19:48:13 +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 alreadyInstalled = false;
bool systemXMLPatchPossible = false;
bool systemXMLPatchAllowed = false;
bool systemXMLAlreadyPatched = false;
bool systemXMLRestorePossible = false;
2020-10-16 19:48:13 +02:00
eGameState state;
eErrorState error = ERROR_NONE;
2020-11-30 17:49:32 +01:00
uint64_t coldbootTitleId;
_gList_t *coldbootTitle;
2020-12-01 02:05:24 +01:00
std::optional<uint64_t> systemMenuTitleId;
2020-11-30 17:49:32 +01:00
bool fstAlreadyPatched;
bool rpxAlreadyPatched;
bool cosAlreadyPatched;
bool tmdValid;
2020-10-16 19:48:13 +02:00
};