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"; "ES-DE";
#endif #endif
#if defined(__RETRODECK__) #if defined(__RETRODECK__)
std::ifstream file("/app/retrodeck/version"); // Only execute this block if RETRODECK is defined
std::string version; LOG(LogInfo) << "Reading /app/retrodeck/version...";
if (file.is_open() && std::getline(file, version) && !version.empty()) { std::ifstream versionFile("/app/retrodeck/version");
file.close(); std::string retroDeckVersion;
#undef PROGRAM_VERSION_STRING
#define PROGRAM_VERSION_STRING version.c_str() // Attempt to open the version file and read a line into retroDeckVersion;
std::cout << "Version read from file: " << PROGRAM_VERSION_STRING << std::endl; // 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 { } else {
std::cerr << "Error: Cannot read version from file or file is empty!" << std::endl; LOG(LogInfo) << "Error: Cannot read version from file or file is empty!";
// Set a default value in case the file can't be read retroDeckVersion = "UNKNOWN";
#define PROGRAM_VERSION_STRING "UNKNOWN" mVersion.setText(applicationName + " " + retroDeckVersion);
} }
#else // not RetroDECK
#if defined(IS_PRERELEASE) #else // If RETRODECK is NOT defined, execute this block
#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 //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) void GuiMenu::openThemeDownloader(GuiSettings* settings)

View file

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