2020-10-14 13:54:25 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <optional>
|
2021-10-17 15:26:25 +02:00
|
|
|
#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,
|
2020-12-05 20:27:46 +01:00
|
|
|
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,
|
2020-11-30 22:09:08 +01:00
|
|
|
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;
|
2020-12-05 20:27:46 +01:00
|
|
|
bool alreadyInstalledAndUpdated = false;
|
2020-12-02 15:57:13 +01:00
|
|
|
|
|
|
|
bool systemXMLPatchPossible = false;
|
|
|
|
bool systemXMLPatchAllowed = false;
|
2020-12-05 20:27:46 +01:00
|
|
|
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
|
|
|
|
2020-12-05 20:53:20 +01:00
|
|
|
eGameState state = STATE_WELCOME_SCREEN;
|
2020-10-14 13:54:25 +02:00
|
|
|
eErrorState error = ERROR_NONE;
|
2020-12-05 20:53:20 +01:00
|
|
|
uint64_t coldbootTitleId = 0;
|
|
|
|
_gList_t *coldbootTitle = nullptr;
|
2020-12-01 02:05:24 +01:00
|
|
|
std::optional<uint64_t> systemMenuTitleId;
|
2020-12-05 20:53:20 +01:00
|
|
|
bool fstAlreadyPatched = false;
|
|
|
|
bool rpxAlreadyPatched = false;
|
|
|
|
bool cosAlreadyPatched = false;
|
|
|
|
bool tmdValid = false;
|
2020-10-14 13:54:25 +02:00
|
|
|
};
|