1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
--- a/src/Cafe/CafeSystem.cpp
+++ b/src/Cafe/CafeSystem.cpp
@@ -704,9 +704,8 @@ namespace CafeSystem
std::string GetForegroundTitleName()
{
if (sLaunchModeIsStandalone)
- return "Missing meta data";
- // todo - use language based on Cemu console language
- return sGameInfo_ForegroundTitle.GetBase().GetMetaInfo()->GetShortName(CafeConsoleLanguage::EN);
+ return "Unknown Game";
+ return sGameInfo_ForegroundTitle.GetBase().GetMetaInfo()->GetShortName(GetConfig().console_language);
}
std::string GetForegroundTitleArgStr()
--- a/src/gui/MainWindow.cpp
+++ b/src/gui/MainWindow.cpp
@@ -543,8 +543,7 @@ bool MainWindow::FileLoad(std::wstring fileName, wxLaunchGameEvent::INITIATED_BY
m_game_list = nullptr;
}
- const auto game_name = GetGameName(fileName);
- m_launched_game_name = boost::nowide::narrow(game_name);
+ m_launched_game_name = CafeSystem::GetForegroundTitleName();
#ifdef ENABLE_DISCORD_RPC
if (m_discord)
m_discord->UpdatePresence(DiscordPresence::Playing, m_launched_game_name);
@@ -1496,79 +1495,6 @@ void MainWindow::DestroyCanvas()
}
}
-
-std::wstring MainWindow::GetGameName(std::wstring_view file_name)
-{
- fs::path path{ std::wstring{file_name} };
- const auto extension = path.extension();
- if (extension == ".wud" || extension == ".wux")
- {
- std::unique_ptr<FSTVolume> volume(FSTVolume::OpenFromDiscImage(path));
- if (!volume)
- return path.filename().generic_wstring();
-
- bool foundFile = false;
- std::vector<uint8> metaContent = volume->ExtractFile("meta/meta.xml", &foundFile);
- if (!foundFile)
- return path.filename().generic_wstring();
-
- namespace xml = tinyxml2;
- xml::XMLDocument doc;
- doc.Parse((const char*)metaContent.data(), metaContent.size());
-
- // parse meta.xml
- xml::XMLElement* root = doc.FirstChildElement("menu");
- if (root)
- {
- xml::XMLElement* element = root->FirstChildElement("longname_en");
- if (element)
- {
-
- auto game_name = boost::nowide::widen(element->GetText());
- const auto it = game_name.find(L'\n');
- if (it != std::wstring::npos)
- game_name.replace(it, 1, L" - ");
-
- return game_name;
- }
- }
- return path.filename().generic_wstring();
- }
- else if (extension == ".rpx")
- {
- if (path.has_parent_path() && path.parent_path().has_parent_path())
- {
- auto meta_xml = path.parent_path().parent_path() / "meta/meta.xml";
- auto metaXmlData = FileStream::LoadIntoMemory(meta_xml);
- if (metaXmlData)
- {
- namespace xml = tinyxml2;
- xml::XMLDocument doc;
- if (doc.Parse((const char*)metaXmlData->data(), metaXmlData->size()) == xml::XML_SUCCESS)
- {
- xml::XMLElement* root = doc.FirstChildElement("menu");
- if (root)
- {
- xml::XMLElement* element = root->FirstChildElement("longname_en");
- if (element)
- {
-
- auto game_name = boost::nowide::widen(element->GetText());
- const auto it = game_name.find(L'\n');
- if (it != std::wstring::npos)
- game_name.replace(it, 1, L" - ");
-
- return game_name;
- }
- }
- }
- }
- }
- }
-
- return path.filename().generic_wstring();
-}
-
void MainWindow::OnSizeEvent(wxSizeEvent& event)
{
if (!IsMaximized() && !gui_isFullScreen())
--- a/src/gui/MainWindow.h
+++ b/src/gui/MainWindow.h
@@ -130,7 +130,6 @@ class MainWindow : public wxFrame
void CreateCanvas();
void DestroyCanvas();
- std::wstring GetGameName(std::wstring_view file_name);
static void ShowCursor(bool state);
uintptr_t GetRenderCanvasHWND();
|