Read game title from ini file, or titles.txt if it exists.

This commit is contained in:
Rachel Bryk 2014-10-22 17:25:00 -04:00
parent ce3a039eed
commit b1e14a65a2
4 changed files with 52 additions and 3 deletions

View File

@ -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"

View File

@ -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;

View File

@ -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,

View File

@ -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