Add tutorial for installer wizard for add files and add folder.

This commit is contained in:
Dario 2025-01-16 08:46:27 -03:00
parent 4b7f2c0ae7
commit 22720191b4
2 changed files with 56 additions and 9 deletions

View file

@ -255,6 +255,18 @@ std::unordered_map<std::string, std::unordered_map<ELanguage, std::string>> g_lo
{ ELanguage::Italian, "Alcuni dei file che sono stati\nselezionati non sono validi.\n\nAssicurati che tutti\ni file sono quelli corretti\ne riprova." } { ELanguage::Italian, "Alcuni dei file che sono stati\nselezionati non sono validi.\n\nAssicurati che tutti\ni file sono quelli corretti\ne riprova." }
} }
}, },
{
"Installer_Message_FilePickerTutorial",
{
{ ELanguage::English, "Placeholder.\n\nSelect digital dumps from Xbox 360.\n\nFor picking a folder with the game's files,\nuse the 'Add Folder' option instead." },
}
},
{
"Installer_Message_FolderPickerTutorial",
{
{ ELanguage::English, "Placeholder.\n\nSelect a folder that contain the files\nthat have been extracted from the game.\n\nFor picking digital dumps from Xbox 360,\nuse the 'Add Files' option instead." },
}
},
{ {
"Installer_Message_IncompatibleGameData", "Installer_Message_IncompatibleGameData",
{ {

View file

@ -137,6 +137,9 @@ static std::list<std::filesystem::path> g_currentPickerResults;
static std::atomic<bool> g_currentPickerResultsReady = false; static std::atomic<bool> g_currentPickerResultsReady = false;
static std::string g_currentPickerErrorMessage; static std::string g_currentPickerErrorMessage;
static std::unique_ptr<std::thread> g_currentPickerThread; static std::unique_ptr<std::thread> g_currentPickerThread;
static bool g_pickerTutorialCleared[2] = {};
static bool g_pickerTutorialTriggered = false;
static bool g_pickerTutorialFolderMode = false;
static bool g_currentPickerVisible = false; static bool g_currentPickerVisible = false;
static bool g_currentPickerFolderMode = false; static bool g_currentPickerFolderMode = false;
static int g_currentMessageResult = -1; static int g_currentMessageResult = -1;
@ -913,8 +916,7 @@ static void PickerThreadProcess()
g_currentPickerResultsReady = true; g_currentPickerResultsReady = true;
} }
static void ShowPicker(bool folderMode) static void PickerStart(bool folderMode) {
{
if (g_currentPickerThread != nullptr) if (g_currentPickerThread != nullptr)
{ {
g_currentPickerThread->join(); g_currentPickerThread->join();
@ -925,7 +927,7 @@ static void ShowPicker(bool folderMode)
g_currentPickerFolderMode = folderMode; g_currentPickerFolderMode = folderMode;
g_currentPickerResultsReady = false; g_currentPickerResultsReady = false;
g_currentPickerVisible = true; g_currentPickerVisible = true;
// Optional single thread mode for testing on systems that do not interact well with the separate thread being used for NFD. // Optional single thread mode for testing on systems that do not interact well with the separate thread being used for NFD.
constexpr bool singleThreadMode = false; constexpr bool singleThreadMode = false;
if (singleThreadMode) if (singleThreadMode)
@ -934,7 +936,22 @@ static void ShowPicker(bool folderMode)
g_currentPickerThread = std::make_unique<std::thread>(PickerThreadProcess); g_currentPickerThread = std::make_unique<std::thread>(PickerThreadProcess);
} }
static void ParseSourcePaths(std::list<std::filesystem::path> &paths) static void PickerShow(bool folderMode)
{
if (g_pickerTutorialCleared[folderMode])
{
PickerStart(folderMode);
}
else
{
g_currentMessagePrompt = Localise(folderMode ? "Installer_Message_FolderPickerTutorial" : "Installer_Message_FilePickerTutorial");
g_currentMessagePromptConfirmation = false;
g_pickerTutorialTriggered = true;
g_pickerTutorialFolderMode = folderMode;
}
}
static bool ParseSourcePaths(std::list<std::filesystem::path> &paths)
{ {
assert((g_currentPage == WizardPage::SelectGameAndUpdate) || (g_currentPage == WizardPage::SelectDLC)); assert((g_currentPage == WizardPage::SelectGameAndUpdate) || (g_currentPage == WizardPage::SelectDLC));
@ -995,6 +1012,8 @@ static void ParseSourcePaths(std::list<std::filesystem::path> &paths)
g_currentMessagePrompt = stringStream.str(); g_currentMessagePrompt = stringStream.str();
g_currentMessagePromptConfirmation = false; g_currentMessagePromptConfirmation = false;
} }
return failedPaths.empty();
} }
static void DrawLanguagePicker() static void DrawLanguagePicker()
@ -1040,7 +1059,7 @@ static void DrawSourcePickers()
DrawButton(min, max, addFilesText.c_str(), false, true, buttonPressed, ADD_BUTTON_MAX_TEXT_WIDTH); DrawButton(min, max, addFilesText.c_str(), false, true, buttonPressed, ADD_BUTTON_MAX_TEXT_WIDTH);
if (buttonPressed) if (buttonPressed)
{ {
ShowPicker(false); PickerShow(false);
} }
min.x += Scale(BOTTOM_X_GAP + textSize.x * squashRatio); min.x += Scale(BOTTOM_X_GAP + textSize.x * squashRatio);
@ -1053,7 +1072,7 @@ static void DrawSourcePickers()
DrawButton(min, max, addFolderText.c_str(), false, true, buttonPressed, ADD_BUTTON_MAX_TEXT_WIDTH); DrawButton(min, max, addFolderText.c_str(), false, true, buttonPressed, ADD_BUTTON_MAX_TEXT_WIDTH);
if (buttonPressed) if (buttonPressed)
{ {
ShowPicker(true); PickerShow(true);
} }
} }
} }
@ -1344,7 +1363,18 @@ static void DrawMessagePrompt()
} }
} }
static void CheckPickerResults() static void PickerCheckTutorial()
{
if (!g_pickerTutorialTriggered || !g_currentMessagePrompt.empty())
{
return;
}
PickerStart(g_pickerTutorialFolderMode);
g_pickerTutorialTriggered = false;
}
static void PickerCheckResults()
{ {
if (!g_currentPickerResultsReady) if (!g_currentPickerResultsReady)
{ {
@ -1358,7 +1388,11 @@ static void CheckPickerResults()
g_currentPickerErrorMessage.clear(); g_currentPickerErrorMessage.clear();
} }
ParseSourcePaths(g_currentPickerResults); if (!g_currentPickerResults.empty() && ParseSourcePaths(g_currentPickerResults))
{
g_pickerTutorialCleared[g_pickerTutorialFolderMode] = true;
}
g_currentPickerResultsReady = false; g_currentPickerResultsReady = false;
g_currentPickerVisible = false; g_currentPickerVisible = false;
} }
@ -1401,7 +1435,8 @@ void InstallerWizard::Draw()
DrawNextButton(); DrawNextButton();
DrawBorders(); DrawBorders();
DrawMessagePrompt(); DrawMessagePrompt();
CheckPickerResults(); PickerCheckTutorial();
PickerCheckResults();
if (g_isDisappearing) if (g_isDisappearing)
{ {