Added RetroDECK cases under custom ifdef to not interfere with the rest of the code

This commit is contained in:
XargonWan 2024-09-25 10:40:05 +09:00
parent 142335e31b
commit b61c5d4a1d
6 changed files with 191 additions and 9 deletions

View file

@ -54,9 +54,11 @@ GuiMenu::GuiMenu()
{ {
const bool isFullUI {UIModeController::getInstance()->isUIModeFull()}; const bool isFullUI {UIModeController::getInstance()->isUIModeFull()};
if (isFullUI) if (isFullUI)
addEntry(_("SCRAPER"), mMenuColorPrimary, true, [this] { openScraperOptions(); }); addEntry(_("SCRAPER"), mMenuColorPrimary, true, [this] { openScraperOptions(); });
#if defined(__RETRODECK__)
if (isFullUI) if (isFullUI)
addEntry(_("RETRODECK CLASSIC CONFIGURATOR"), mMenuColorPrimary, false, [this] { openRetroDeckClassicConfigurator(); }); addEntry(_("RETRODECK CLASSIC CONFIGURATOR"), mMenuColorPrimary, false, [this] { openRetroDeckClassicConfigurator(); });
@ -65,6 +67,25 @@ GuiMenu::GuiMenu()
if (isFullUI) if (isFullUI)
addEntry(_("ES-DE CONFIGURATIONS"), mMenuColorPrimary, true, [this] { openESDEConfiguration(); }); addEntry(_("ES-DE CONFIGURATIONS"), mMenuColorPrimary, true, [this] { openESDEConfiguration(); });
#else // Not RetroDECK
if (isFullUI)
addEntry(_("UI SETTINGS"), mMenuColorPrimary, true, [this] { openUIOptions(); });
addEntry(_("SOUND SETTINGS"), mMenuColorPrimary, true, [this] { openSoundOptions(); });
if (isFullUI)
addEntry(_("INPUT DEVICE SETTINGS"), mMenuColorPrimary, true,
[this] { openInputDeviceOptions(); });
if (isFullUI)
addEntry(_("GAME COLLECTION SETTINGS"), mMenuColorPrimary, true,
[this] { openCollectionSystemOptions(); });
if (isFullUI)
addEntry(_("OTHER SETTINGS"), mMenuColorPrimary, true, [this] { openOtherOptions(); });
#endif // RetroDECK
if (isFullUI) if (isFullUI)
addEntry(_("UTILITIES"), mMenuColorPrimary, true, [this] { openUtilities(); }); addEntry(_("UTILITIES"), mMenuColorPrimary, true, [this] { openUtilities(); });
@ -72,15 +93,17 @@ GuiMenu::GuiMenu()
if (!Settings::getInstance()->getBool("ForceKiosk") && if (!Settings::getInstance()->getBool("ForceKiosk") &&
Settings::getInstance()->getString("UIMode") != "kiosk") { Settings::getInstance()->getString("UIMode") != "kiosk") {
#if defined(__APPLE__) #if defined(__APPLE__)
addEntry(_("QUIT RETRODECK")}, mMenuColorPrimary, false, [this] { openQuitMenu(); }); addEntry(_("QUIT ES-DE")}, mMenuColorPrimary, false, [this] { openQuitMenu(); });
#elif defined(__ANDROID__) #elif defined(__ANDROID__)
if (!AndroidVariables::sIsHomeApp) if (!AndroidVariables::sIsHomeApp)
addEntry(_("QUIT RETRODECK"), mMenuColorPrimary, false, [this] { openQuitMenu(); }); addEntry(_("QUIT ES-DE"), mMenuColorPrimary, false, [this] { openQuitMenu(); });
#elif defined(__RETRODECK__)
addEntry(_("QUIT RETRODECK"), mMenuColorPrimary, false, [this] { openQuitMenu(); });
#else #else
if (Settings::getInstance()->getBool("ShowQuitMenu")) if (Settings::getInstance()->getBool("ShowQuitMenu"))
addEntry(_("QUIT"), mMenuColorPrimary, true, [this] { openQuitMenu(); }); addEntry(_("QUIT"), mMenuColorPrimary, true, [this] { openQuitMenu(); });
else else
addEntry(_("QUIT RETRODECK"), mMenuColorPrimary, false, [this] { openQuitMenu(); }); addEntry(_("QUIT ES-DE"), mMenuColorPrimary, false, [this] { openQuitMenu(); });
#endif #endif
} }
@ -2179,6 +2202,8 @@ void GuiMenu::openUtilities()
mWindow->pushGui(s); mWindow->pushGui(s);
} }
#if defined(__RETRODECK__)
void GuiMenu::openESDEConfiguration() { void GuiMenu::openESDEConfiguration() {
// RetroDECK: Create a new GuiSettings instance for the ES-DE Configurations menu // RetroDECK: Create a new GuiSettings instance for the ES-DE Configurations menu
auto s = new GuiSettings(_("ES-DE CONFIGURATIONS")); auto s = new GuiSettings(_("ES-DE CONFIGURATIONS"));
@ -2245,6 +2270,7 @@ void GuiMenu::openESDEConfiguration() {
mWindow->pushGui(s); mWindow->pushGui(s);
} }
#endif
void GuiMenu::openQuitMenu() void GuiMenu::openQuitMenu()
{ {
@ -2329,6 +2355,7 @@ void GuiMenu::addVersionInfo()
mVersion.setAutoCalcExtent(glm::ivec2 {0, 0}); mVersion.setAutoCalcExtent(glm::ivec2 {0, 0});
mVersion.setColor(mMenuColorTertiary); mVersion.setColor(mMenuColorTertiary);
#if defined(__RETRODECK__)
const std::string applicationName {"RetroDECK"}; const std::string applicationName {"RetroDECK"};
std::ifstream file("/app/retrodeck/version"); std::ifstream file("/app/retrodeck/version");
std::string version; std::string version;
@ -2342,6 +2369,7 @@ void GuiMenu::addVersionInfo()
// Set a default value in case the file can't be read // Set a default value in case the file can't be read
#define PROGRAM_VERSION_STRING "UNKNOWN" #define PROGRAM_VERSION_STRING "UNKNOWN"
} }
#else // not RetroDECK
#if defined(IS_PRERELEASE) #if defined(IS_PRERELEASE)
#if defined(__ANDROID__) #if defined(__ANDROID__)
@ -2359,6 +2387,8 @@ void GuiMenu::addVersionInfo()
mVersion.setText(applicationName + " " + Utils::String::toUpper(PROGRAM_VERSION_STRING)); mVersion.setText(applicationName + " " + Utils::String::toUpper(PROGRAM_VERSION_STRING));
#endif #endif
#endif #endif
#endif //RetroDECK
} }
void GuiMenu::openThemeDownloader(GuiSettings* settings) void GuiMenu::openThemeDownloader(GuiSettings* settings)

View file

@ -44,12 +44,15 @@ private:
void openConfigInput(GuiSettings* settings); void openConfigInput(GuiSettings* settings);
void openCollectionSystemOptions(); void openCollectionSystemOptions();
void openOtherOptions(); void openOtherOptions();
void openRetroDeckClassicConfigurator();
void openRetroDeckGodotConfigurator();
void openESDEConfiguration();
void openUtilities(); void openUtilities();
void openQuitMenu(); void openQuitMenu();
if defined(__RETRODECK__)
void openRetroDeckClassicConfigurator();
void openRetroDeckGodotConfigurator();
void openESDEConfiguration();
#endif
Renderer* mRenderer; Renderer* mRenderer;
MenuComponent mMenu; MenuComponent mMenu;
TextComponent mVersion; TextComponent mVersion;

View file

@ -635,11 +635,23 @@ void GuiThemeDownloader::parseThemesList()
if (latestStableRelease > PROGRAM_RELEASE_NUMBER) { if (latestStableRelease > PROGRAM_RELEASE_NUMBER) {
LOG(LogWarning) << "Not running the most current application release, theme " LOG(LogWarning) << "Not running the most current application release, theme "
"downloading is not recommended"; "downloading is not recommended";
#if defined(__RETRODECK__)
mWindow->pushGui(new GuiMsgBox( mWindow->pushGui(new GuiMsgBox(
getHelpStyle(), getHelpStyle(),
_("ES-DE THEME ENGINE WAS UPDATED UPSTREAM. THESE THEMES MAY NOT BE COMPATIBLE WITH THE CURRENT RETRODECK VERSION." _("ES-DE THEME ENGINE WAS UPDATED UPSTREAM. THESE THEMES MAY NOT BE COMPATIBLE WITH THE CURRENT RETRODECK VERSION."
"CHECK IF A NEW RETRODECK UPDATE IS AVAILABLE, ELSE PLEASE WAIT FOR IT OR PROCEED AT YOUR OWN RISK."), "CHECK IF A NEW RETRODECK UPDATE IS AVAILABLE, ELSE PLEASE WAIT FOR IT OR PROCEED AT YOUR OWN RISK."),
_("OK"), [] { return; }, "", nullptr, "", nullptr, nullptr, true)); _("OK"), [] { return; }, "", nullptr, "", nullptr, nullptr, true));
#else
mWindow->pushGui(new GuiMsgBox(
getHelpStyle(),
_("IT SEEMS AS IF YOU'RE NOT RUNNING THE LATEST ES-DE RELEASE, PLEASE UPGRADE "
"BEFORE PROCEEDING AS THESE THEMES MAY NOT BE COMPATIBLE WITH YOUR VERSION"),
_("OK"), [] { return; }, "", nullptr, "", nullptr, nullptr, true));
#endif
} }
} }

View file

@ -694,7 +694,10 @@ int main(int argc, char* argv[])
Log::init(); Log::init();
Log::open(); Log::open();
{ {
#if defined(__RETRODECK__)
const std::string applicationName {"RetroDECK"}; const std::string applicationName {"RetroDECK"};
#endif
#if defined(__ANDROID__) #if defined(__ANDROID__)
LOG(LogInfo) << applicationName << " " << PROGRAM_VERSION_STRING << "-" LOG(LogInfo) << applicationName << " " << PROGRAM_VERSION_STRING << "-"
<< ANDROID_VERSION_CODE << " (r" << PROGRAM_RELEASE_NUMBER << "), built " << ANDROID_VERSION_CODE << " (r" << PROGRAM_RELEASE_NUMBER << "), built "

View file

@ -269,9 +269,17 @@ void ViewController::noGamesDialog()
"CREATE A TEXT FILE FOR EACH SYSTEM PROVIDING SOME " "CREATE A TEXT FILE FOR EACH SYSTEM PROVIDING SOME "
"INFORMATION SUCH AS THE SUPPORTED FILE EXTENSIONS.\n" "INFORMATION SUCH AS THE SUPPORTED FILE EXTENSIONS.\n"
"THIS IS THE CURRENTLY CONFIGURED ROM DIRECTORY:\n"); "THIS IS THE CURRENTLY CONFIGURED ROM DIRECTORY:\n");
#else #elif defined(__RETRODECK__)
mNoGamesErrorMessage = _("NO GAME WERE FOUND. PLEASE PLACE YOUR GAMES IN " mNoGamesErrorMessage = _("NO GAME WERE FOUND. PLEASE PLACE YOUR GAMES IN "
"THE RETRODECK ROM DIRECTORY LOCATED IN:\n"); "THE RETRODECK ROM DIRECTORY LOCATED IN:\n");
#else
mNoGamesErrorMessage = _("NO GAME FILES WERE FOUND. EITHER PLACE YOUR GAMES IN "
"THE CURRENTLY CONFIGURED ROM DIRECTORY OR CHANGE "
"ITS PATH USING THE BUTTON BELOW. OPTIONALLY THE ROM "
"DIRECTORY STRUCTURE CAN BE GENERATED WHICH WILL "
"CREATE A TEXT FILE FOR EACH SYSTEM PROVIDING SOME "
"INFORMATION SUCH AS THE SUPPORTED FILE EXTENSIONS.\n"
"THIS IS THE CURRENTLY CONFIGURED ROM DIRECTORY:\n");
#endif #endif
#if defined(_WIN64) #if defined(_WIN64)
@ -283,7 +291,7 @@ void ViewController::noGamesDialog()
#if defined(__ANDROID__) #if defined(__ANDROID__)
mNoGamesMessageBox = new GuiMsgBox( mNoGamesMessageBox = new GuiMsgBox(
HelpStyle(), mNoGamesErrorMessage + mRomDirectory, HelpStyle(), mNoGamesErrorMessage + mRomDirectory,
#else #elif defined(__RETRODECK__)
mNoGamesMessageBox = new GuiMsgBox( mNoGamesMessageBox = new GuiMsgBox(
HelpStyle(), mNoGamesErrorMessage + mRomDirectory, _("QUIT"), HelpStyle(), mNoGamesErrorMessage + mRomDirectory, _("QUIT"),
[] { [] {
@ -295,6 +303,128 @@ void ViewController::noGamesDialog()
(mRenderer->getIsVerticalOrientation() ? (mRenderer->getIsVerticalOrientation() ?
0.90f : 0.90f :
0.62f * (1.778f / mRenderer->getScreenAspectRatio()))); 0.62f * (1.778f / mRenderer->getScreenAspectRatio())));
#else
mNoGamesMessageBox = new GuiMsgBox(
HelpStyle(), mNoGamesErrorMessage + mRomDirectory, _("CHANGE ROM DIRECTORY"),
[this] {
std::string currentROMDirectory;
#if defined(_WIN64)
currentROMDirectory = Utils::String::replace(FileData::getROMDirectory(), "/", "\\");
#else
currentROMDirectory = FileData::getROMDirectory();
#endif
if (Settings::getInstance()->getBool("VirtualKeyboard")) {
mWindow->pushGui(new GuiTextEditKeyboardPopup(
HelpStyle(), 0.0f, _("ENTER ROM DIRECTORY PATH"), currentROMDirectory,
[this, currentROMDirectory](const std::string& newROMDirectory) {
if (currentROMDirectory != newROMDirectory) {
Settings::getInstance()->setString(
"ROMDirectory", Utils::String::trim(newROMDirectory));
Settings::getInstance()->saveFile();
#if defined(_WIN64)
mRomDirectory =
Utils::String::replace(FileData::getROMDirectory(), "/", "\\");
#else
mRomDirectory = FileData::getROMDirectory();
#endif
mNoGamesMessageBox->changeText(mNoGamesErrorMessage + mRomDirectory);
mWindow->pushGui(new GuiMsgBox(
HelpStyle(),
_("ROM DIRECTORY SETTING SAVED, RESTART "
"THE APPLICATION TO RESCAN THE SYSTEMS"),
_("OK"), nullptr, "", nullptr, "", nullptr, nullptr, true, true,
(mRenderer->getIsVerticalOrientation() ?
0.66f :
0.42f * (1.778f / mRenderer->getScreenAspectRatio()))));
}
},
false, _("SAVE"), _("SAVE CHANGES?"), _("Currently configured path:"),
currentROMDirectory, _("LOAD CURRENTLY CONFIGURED PATH"),
_("CLEAR (LEAVE BLANK TO RESET TO DEFAULT PATH)")));
}
else {
mWindow->pushGui(new GuiTextEditPopup(
HelpStyle(), _("ENTER ROM DIRECTORY PATH"), currentROMDirectory,
[this](const std::string& newROMDirectory) {
Settings::getInstance()->setString("ROMDirectory",
Utils::String::trim(newROMDirectory));
Settings::getInstance()->saveFile();
#if defined(_WIN64)
mRomDirectory =
Utils::String::replace(FileData::getROMDirectory(), "/", "\\");
#else
mRomDirectory = FileData::getROMDirectory();
#endif
mNoGamesMessageBox->changeText(mNoGamesErrorMessage + mRomDirectory);
mWindow->pushGui(new GuiMsgBox(
HelpStyle(),
_("ROM DIRECTORY SETTING SAVED, RESTART "
"THE APPLICATION TO RESCAN THE SYSTEMS"),
_("OK"), nullptr, "", nullptr, "", nullptr, nullptr, true, true,
(mRenderer->getIsVerticalOrientation() ?
0.66f :
0.42f * (1.778f / mRenderer->getScreenAspectRatio()))));
},
false, _("SAVE"), _("SAVE CHANGES?"), _("Currently configured path:"),
currentROMDirectory, _("LOAD CURRENTLY CONFIGURED PATH"),
_("CLEAR (LEAVE BLANK TO RESET TO DEFAULT PATH)")));
}
},
#endif // __ANDROID__
_("CREATE DIRECTORIES"),
[this] {
mWindow->pushGui(new GuiMsgBox(
HelpStyle(),
_("THIS WILL CREATE DIRECTORIES FOR ALL THE "
"GAME SYSTEMS DEFINED IN es_systems.xml\n\n"
"THIS MAY CREATE A LOT OF FOLDERS SO IT'S "
"ADVICED TO REMOVE THE ONES YOU DON'T NEED"),
_("PROCEED"),
[this] {
if (!SystemData::createSystemDirectories()) {
mWindow->pushGui(new GuiMsgBox(
HelpStyle(),
_("THE SYSTEM DIRECTORIES WERE SUCCESSFULLY "
"GENERATED, EXIT THE APPLICATION AND PLACE "
"YOUR GAMES IN THE NEW FOLDERS"),
_("OK"), nullptr, "", nullptr, "", nullptr, nullptr, true, true,
(mRenderer->getIsVerticalOrientation() ?
0.74f :
0.46f * (1.778f / mRenderer->getScreenAspectRatio()))));
}
else {
mWindow->pushGui(new GuiMsgBox(
HelpStyle(),
_("ERROR CREATING THE SYSTEM DIRECTORIES, "
"PERMISSION PROBLEMS OR DISK FULL?\n\n"
"SEE THE LOG FILE FOR MORE DETAILS"),
_("OK"), nullptr, "", nullptr, "", nullptr, nullptr, true, true,
(mRenderer->getIsVerticalOrientation() ?
0.75f :
0.47f * (1.778f / mRenderer->getScreenAspectRatio()))));
}
},
_("CANCEL"), nullptr, "", nullptr, nullptr, false, true,
(mRenderer->getIsVerticalOrientation() ?
0.78f :
0.50f * (1.778f / mRenderer->getScreenAspectRatio()))));
},
_("QUIT"),
[] {
SDL_Event quit {};
quit.type = SDL_QUIT;
SDL_PushEvent(&quit);
},
#if defined(__ANDROID__)
"", nullptr, nullptr, true, false,
(mRenderer->getIsVerticalOrientation() ?
0.90f :
0.58f * (1.778f / mRenderer->getScreenAspectRatio())));
#else
nullptr, true, false,
(mRenderer->getIsVerticalOrientation() ?
0.90f :
0.62f * (1.778f / mRenderer->getScreenAspectRatio())));
#endif #endif
mWindow->pushGui(mNoGamesMessageBox); mWindow->pushGui(mNoGamesMessageBox);

View file

@ -171,7 +171,11 @@ bool Window::init()
progressBarRect.barHeight -= borderThickness * 2.0f; progressBarRect.barHeight -= borderThickness * 2.0f;
progressBarRect.barPosX += borderThickness; progressBarRect.barPosX += borderThickness;
progressBarRect.barPosY += borderThickness; progressBarRect.barPosY += borderThickness;
progressBarRect.color = 0xC858E6FF; #if defined(__RETRODECK__)
progressBarRect.color = 0xC858E6FF;
else
progressBarRect.color = 0x79010FFF;
#endif
mProgressBarRectangles.emplace_back(progressBarRect); mProgressBarRectangles.emplace_back(progressBarRect);
mBackgroundOverlay->setImage(":/graphics/frame.png"); mBackgroundOverlay->setImage(":/graphics/frame.png");