summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorskidau <skidau@gmail.com>2014-10-25 13:33:26 +1100
committerskidau <skidau@gmail.com>2014-10-25 13:33:26 +1100
commit8598d6bc2b77f908ec0b9673ec342c87a07bfd75 (patch)
tree38c5f8b1b5e24607583cd60bce64d21422976df0 /Source
parent726306fa27048f856d711867af48765ce98b2f98 (diff)
parentb1e14a65a22ed6ffd658a60ad22a7ccbbbf6c54f (diff)
Merge pull request #1364 from RachelBryk/titles
Read game title from ini file, or titles.txt if it exists.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Common/CommonPaths.h2
-rw-r--r--Source/Core/Common/FileUtil.cpp7
-rw-r--r--Source/Core/Common/FileUtil.h1
-rw-r--r--Source/Core/DolphinWX/GameListCtrl.cpp45
4 files changed, 52 insertions, 3 deletions
diff --git a/Source/Core/Common/CommonPaths.h b/Source/Core/Common/CommonPaths.h
index a3b15a2e8c..0f3cb682c1 100644
--- a/Source/Core/Common/CommonPaths.h
+++ b/Source/Core/Common/CommonPaths.h
@@ -62,7 +62,7 @@
#define STATESAVES_DIR "StateSaves"
#define SCREENSHOTS_DIR "ScreenShots"
#define LOAD_DIR "Load"
-#define HIRES_TEXTURES_DIR LOAD_DIR DIR_SEP "Textures"
+#define HIRES_TEXTURES_DIR "Textures"
#define DUMP_DIR "Dump"
#define DUMP_TEXTURES_DIR "Textures"
#define DUMP_FRAMES_DIR "Frames"
diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp
index 1cce81ed81..56d326d0fa 100644
--- a/Source/Core/Common/FileUtil.cpp
+++ b/Source/Core/Common/FileUtil.cpp
@@ -825,7 +825,8 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new
paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP;
paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP;
paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP;
- paths[D_HIRESTEXTURES_IDX] = paths[D_USER_IDX] + HIRES_TEXTURES_DIR DIR_SEP;
+ paths[D_LOAD_IDX] = paths[D_USER_IDX] + LOAD_DIR DIR_SEP;
+ paths[D_HIRESTEXTURES_IDX] = paths[D_LOAD_IDX] + HIRES_TEXTURES_DIR DIR_SEP;
paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP;
paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP;
paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP;
@@ -922,6 +923,10 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new
case D_LOGS_IDX:
paths[D_MAILLOGS_IDX] = paths[D_LOGS_IDX] + MAIL_LOGS_DIR DIR_SEP;
paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG;
+ break;
+
+ case D_LOAD_IDX:
+ paths[D_HIRESTEXTURES_IDX] = paths[D_LOAD_IDX] + HIRES_TEXTURES_DIR DIR_SEP;
}
paths[D_WIIUSER_IDX] = paths[D_WIIROOT_IDX] + DIR_SEP;
diff --git a/Source/Core/Common/FileUtil.h b/Source/Core/Common/FileUtil.h
index b587129761..dba184ba4e 100644
--- a/Source/Core/Common/FileUtil.h
+++ b/Source/Core/Common/FileUtil.h
@@ -36,6 +36,7 @@ enum {
D_DUMPAUDIO_IDX,
D_DUMPTEXTURES_IDX,
D_DUMPDSP_IDX,
+ D_LOAD_IDX,
D_LOGS_IDX,
D_MAILLOGS_IDX,
D_WIISYSCONF_IDX,
diff --git a/Source/Core/DolphinWX/GameListCtrl.cpp b/Source/Core/DolphinWX/GameListCtrl.cpp
index b801199d84..2addf1f64a 100644
--- a/Source/Core/DolphinWX/GameListCtrl.cpp
+++ b/Source/Core/DolphinWX/GameListCtrl.cpp
@@ -40,6 +40,7 @@
#include <wx/windowid.h>
#include "Common/CDUtils.h"
+#include "Common/CommonPaths.h"
#include "Common/CommonTypes.h"
#include "Common/FileSearch.h"
#include "Common/FileUtil.h"
@@ -437,7 +438,49 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
SelectedLanguage = SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG");
}
- std::string const name = rISOFile.GetName(SelectedLanguage);
+ std::string name = rISOFile.GetName(SelectedLanguage);
+
+ std::ifstream titlestxt;
+ OpenFStream(titlestxt, File::GetUserPath(D_LOAD_IDX) + "titles.txt", std::ios::in);
+
+ if (titlestxt.is_open() && rISOFile.GetUniqueID().size() > 3)
+ {
+ while (!titlestxt.eof())
+ {
+ std::string line;
+
+ if (!std::getline(titlestxt, line) && titlestxt.eof())
+ break;
+
+ if (line.substr(0,rISOFile.GetUniqueID().size()) == rISOFile.GetUniqueID())
+ {
+ name = line.substr(rISOFile.GetUniqueID().size() + 3);
+ break;
+ }
+
+ }
+ titlestxt.close();
+ }
+
+ std::string GameIni[3];
+ GameIni[0] = File::GetUserPath(D_GAMESETTINGS_IDX) + rISOFile.GetUniqueID() + ".ini";
+ GameIni[1] = File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + rISOFile.GetUniqueID() + std::to_string(rISOFile.GetRevision()) + ".ini";
+ GameIni[2] = File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + rISOFile.GetUniqueID() + ".ini";
+ std::string title;
+ IniFile gameini;
+ for (int i = 0; i < 3; ++i)
+ {
+ if (File::Exists(GameIni[i]))
+ {
+ gameini.Load(GameIni[i]);
+ if (gameini.GetIfExists("EmuState", "Title", &title))
+ {
+ name = title;
+ break;
+ }
+ }
+ }
+
SetItem(_Index, COLUMN_TITLE, StrToWxStr(name), -1);
// We show the company string on GameCube only