mirror of
https://github.com/ran-j/PS2Recomp.git
synced 2026-09-30 02:04:32 -04:00
Add game name to window title (#74)
* Add game title resolution from internal database * + * -
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user