Compare commits

...

5 commits

Author SHA1 Message Date
XargonWan d3f0041043 fixed ViewController.cpp ifs - tentative fix
Some checks failed
Build ES-DE / Building_RetroDECK-ES-DE (push) Has been cancelled
2024-10-28 16:33:31 +09:00
XargonWan 9173b3cdc1 fixed ViewController.cpp ifs 2024-10-28 14:45:51 +09:00
XargonWan 2384ad2ab2 fixed ViewController.cpp ifs 2024-10-28 13:55:41 +09:00
XargonWan 5d75983b3f fixed ViewController.cpp syntax 2024-10-28 12:33:25 +09:00
XargonWan c0efc79ae8 Wrong version name tentative fix 2024-10-28 11:58:14 +09:00
2 changed files with 45 additions and 38 deletions

View file

@ -2362,40 +2362,43 @@ void GuiMenu::addVersionInfo()
"ES-DE";
#endif
#if defined(__RETRODECK__)
std::ifstream file("/app/retrodeck/version");
std::string version;
if (file.is_open() && std::getline(file, version) && !version.empty()) {
file.close();
#undef PROGRAM_VERSION_STRING
#define PROGRAM_VERSION_STRING version.c_str()
std::cout << "Version read from file: " << PROGRAM_VERSION_STRING << std::endl;
// Only execute this block if RETRODECK is defined
LOG(LogInfo) << "Reading /app/retrodeck/version...";
std::ifstream versionFile("/app/retrodeck/version");
std::string retroDeckVersion;
// Attempt to open the version file and read a line into retroDeckVersion;
// also check that the line is not empty to ensure valid version information
if (versionFile && std::getline(versionFile, retroDeckVersion) && !retroDeckVersion.empty()) {
mVersion.setText(applicationName + " " + retroDeckVersion);
LOG(LogInfo) << "RetroDECK version read OK.";
} else {
std::cerr << "Error: Cannot read version from file or file is empty!" << std::endl;
// Set a default value in case the file can't be read
#define PROGRAM_VERSION_STRING "UNKNOWN"
LOG(LogInfo) << "Error: Cannot read version from file or file is empty!";
retroDeckVersion = "UNKNOWN";
mVersion.setText(applicationName + " " + retroDeckVersion);
}
#else // not RetroDECK
#if defined(IS_PRERELEASE)
#if defined(__ANDROID__)
mVersion.setText(applicationName + " " + Utils::String::toUpper(PROGRAM_VERSION_STRING) + "-" +
std::to_string(ANDROID_VERSION_CODE) + " (Built " + __DATE__ + ")");
#else
mVersion.setText(applicationName + " " + Utils::String::toUpper(PROGRAM_VERSION_STRING) +
" (Built " + __DATE__ + ")");
#endif
#else
#if defined(__ANDROID__)
mVersion.setText(applicationName + " " + Utils::String::toUpper(PROGRAM_VERSION_STRING) + "-" +
std::to_string(ANDROID_VERSION_CODE));
#else
mVersion.setText(applicationName + " " + Utils::String::toUpper(PROGRAM_VERSION_STRING));
#endif
#endif
#else // If RETRODECK is NOT defined, execute this block
#endif //RetroDECK
#if defined(IS_PRERELEASE)
#if defined(__ANDROID__)
mVersion.setText(applicationName + " " + Utils::String::toUpper(PROGRAM_VERSION_STRING) + "-" +
std::to_string(ANDROID_VERSION_CODE) + " (Built " + __DATE__ + ")");
#else
mVersion.setText(applicationName + " " + Utils::String::toUpper(PROGRAM_VERSION_STRING) +
" (Built " + __DATE__ + ")");
#endif
#else
#if defined(__ANDROID__)
mVersion.setText(applicationName + " " + Utils::String::toUpper(PROGRAM_VERSION_STRING) + "-" +
std::to_string(ANDROID_VERSION_CODE));
#else
mVersion.setText(applicationName + " " + Utils::String::toUpper(PROGRAM_VERSION_STRING));
#endif
#endif
#endif // End of RetroDECK logic check
}
void GuiMenu::openThemeDownloader(GuiSettings* settings)

View file

@ -262,16 +262,16 @@ void ViewController::invalidSystemsFileDialog()
void ViewController::noGamesDialog()
{
#if defined(__ANDROID__)
#if defined(__RETRODECK__)
mNoGamesErrorMessage = _("NO GAME WERE FOUND. PLEASE PLACE YOUR GAMES IN "
"THE RETRODECK ROM DIRECTORY LOCATED IN:\n");
#elif defined(__ANDROID__)
mNoGamesErrorMessage = _("NO GAME FILES WERE FOUND, PLEASE PLACE YOUR GAMES IN "
"THE CONFIGURED ROM DIRECTORY. 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");
#elif defined(__RETRODECK__)
mNoGamesErrorMessage = _("NO GAME WERE FOUND. PLEASE PLACE YOUR GAMES IN "
"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 "
@ -289,6 +289,7 @@ void ViewController::noGamesDialog()
#endif
#if defined(__RETRODECK__)
// Show a simple message with a "QUIT" option if RETRODECK is defined
mNoGamesMessageBox = new GuiMsgBox(
HelpStyle(),
mNoGamesErrorMessage + mRomDirectory,
@ -297,9 +298,11 @@ void ViewController::noGamesDialog()
SDL_Event quit {};
quit.type = SDL_QUIT;
SDL_PushEvent(&quit);
},
)
#elif defined(__ANDROID__)
}
);
#else
#if defined(__ANDROID__)
mNoGamesMessageBox = new GuiMsgBox(
HelpStyle(), mNoGamesErrorMessage + mRomDirectory,
#else
@ -418,13 +421,14 @@ void ViewController::noGamesDialog()
"", nullptr, nullptr, true, false,
(mRenderer->getIsVerticalOrientation() ?
0.90f :
0.58f * (1.778f / mRenderer->getScreenAspectRatio()));
0.58f * (1.778f / mRenderer->getScreenAspectRatio())));
#else
nullptr, true, false,
(mRenderer->getIsVerticalOrientation() ?
0.90f :
0.62f * (1.778f / mRenderer->getScreenAspectRatio()));
0.62f * (1.778f / mRenderer->getScreenAspectRatio())));
#endif
#endif // RetroDECK
mWindow->pushGui(mNoGamesMessageBox);
}