Add game name to window title (#74)

* Add game title resolution from internal database

* +

* -
This commit is contained in:
DanielSvoboda
2026-02-22 22:30:27 -03:00
committed by GitHub
parent 8584c0613a
commit bac1fc9ef8
3 changed files with 843 additions and 2 deletions
+35 -2
View File
@@ -1,9 +1,27 @@
#include "ps2_runtime.h"
#include "register_functions.h"
#include "games_database.h"
#include <iostream>
#include <string>
#include <filesystem>
int main(int argc, char *argv[])
std::string normalizeGameId(const std::string& folderName)
{
std::string result = folderName;
size_t underscore = result.find('_');
if (underscore != std::string::npos)
result[underscore] = '-';
size_t dot = result.find('.');
if (dot != std::string::npos)
result.erase(dot, 1);
return result;
}
int main(int argc, char* argv[])
{
if (argc < 2)
{
@@ -12,9 +30,24 @@ int main(int argc, char *argv[])
}
std::string elfPath = argv[1];
std::filesystem::path pathObj(elfPath);
std::string folderName = pathObj.filename().string();
std::string normalizedId = normalizeGameId(folderName);
std::string windowTitle = "PS2-Recomp | ";
const char* gameName = getGameName(normalizedId);
if (gameName)
{
windowTitle += std::string(gameName) + " | " + folderName;
}
else
{
windowTitle += folderName;
}
PS2Runtime runtime;
if (!runtime.initialize("ps2xRuntime (Raylib host)"))
if (!runtime.initialize(windowTitle.c_str()))
{
std::cerr << "Failed to initialize PS2 runtime" << std::endl;
return 1;