Fix for issue #746
This commit is contained in:
parent
5d1d8f109c
commit
5a13c67b54
|
@ -11,6 +11,7 @@ phire
|
||||||
x1mixmzeng
|
x1mixmzeng
|
||||||
RadWolfie
|
RadWolfie
|
||||||
Luca D'Amico (Luca1991/Luca91)
|
Luca D'Amico (Luca1991/Luca91)
|
||||||
|
ergo720
|
||||||
|
|
||||||
Supporters:
|
Supporters:
|
||||||
Cisco Martinez
|
Cisco Martinez
|
||||||
|
|
|
@ -1004,3 +1004,12 @@ void *Xbe::FindSection(char *zsSectionName)
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Xbe::PurgeBadChar(std::string &s, const std::string &illegalChars)
|
||||||
|
{
|
||||||
|
for (auto it = s.begin(); it < s.end(); ++it)
|
||||||
|
{
|
||||||
|
bool found = illegalChars.find(*it) != std::string::npos;
|
||||||
|
if (found) { *it = ' '; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -71,6 +71,9 @@ class Xbe : public Error
|
||||||
// export logo bitmap to raw monochrome data
|
// export logo bitmap to raw monochrome data
|
||||||
void ExportLogoBitmap(uint08 x_Gray[100*17]);
|
void ExportLogoBitmap(uint08 x_Gray[100*17]);
|
||||||
|
|
||||||
|
// purge illegal characters in Windows filenames or other OS's
|
||||||
|
void PurgeBadChar(std::string &s, const std::string &illegalChars = "\\/:?\"<>|");
|
||||||
|
|
||||||
// Xbe header
|
// Xbe header
|
||||||
#include "AlignPrefix1.h"
|
#include "AlignPrefix1.h"
|
||||||
struct Header
|
struct Header
|
||||||
|
|
|
@ -1010,7 +1010,9 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
||||||
// Hash the loaded XBE's header, use it as a filename
|
// Hash the loaded XBE's header, use it as a filename
|
||||||
uint32_t uiHash = XXHash32::hash((void*)&m_Xbe->m_Header, sizeof(Xbe::Header), 0);
|
uint32_t uiHash = XXHash32::hash((void*)&m_Xbe->m_Header, sizeof(Xbe::Header), 0);
|
||||||
std::stringstream sstream;
|
std::stringstream sstream;
|
||||||
sstream << cacheDir << std::hex << uiHash << ".ini";
|
std::string szTitleName(m_Xbe->m_szAsciiTitle);
|
||||||
|
m_Xbe->PurgeBadChar(szTitleName);
|
||||||
|
sstream << cacheDir << szTitleName << "-" << std::hex << uiHash << ".ini";
|
||||||
std::string fullpath = sstream.str();
|
std::string fullpath = sstream.str();
|
||||||
|
|
||||||
if (DeleteFile(fullpath.c_str())) {
|
if (DeleteFile(fullpath.c_str())) {
|
||||||
|
|
|
@ -137,8 +137,14 @@ void EmuHLEIntercept(Xbe::Header *pXbeHeader)
|
||||||
// Hash the loaded XBE's header, use it as a filename
|
// Hash the loaded XBE's header, use it as a filename
|
||||||
uint32_t uiHash = XXHash32::hash((void*)&CxbxKrnl_Xbe->m_Header, sizeof(Xbe::Header), 0);
|
uint32_t uiHash = XXHash32::hash((void*)&CxbxKrnl_Xbe->m_Header, sizeof(Xbe::Header), 0);
|
||||||
std::stringstream sstream;
|
std::stringstream sstream;
|
||||||
sstream << cachePath << std::hex << uiHash << ".ini";
|
char tAsciiTitle[40] = "Unknown";
|
||||||
|
setlocale(LC_ALL, "English");
|
||||||
|
wcstombs(tAsciiTitle, g_pCertificate->wszTitleName, sizeof(tAsciiTitle));
|
||||||
|
std::string szTitleName(tAsciiTitle);
|
||||||
|
CxbxKrnl_Xbe->PurgeBadChar(szTitleName);
|
||||||
|
sstream << cachePath << szTitleName << "-" << std::hex << uiHash << ".ini";
|
||||||
std::string filename = sstream.str();
|
std::string filename = sstream.str();
|
||||||
|
setlocale(LC_ALL, "");
|
||||||
|
|
||||||
if (PathFileExists(filename.c_str())) {
|
if (PathFileExists(filename.c_str())) {
|
||||||
printf("Found HLE Cache File: %08X.ini\n", uiHash);
|
printf("Found HLE Cache File: %08X.ini\n", uiHash);
|
||||||
|
@ -587,9 +593,7 @@ void EmuHLEIntercept(Xbe::Header *pXbeHeader)
|
||||||
WritePrivateProfileString("Info", "HLEDatabaseVersion", szHLELastCompileTime, filename.c_str());
|
WritePrivateProfileString("Info", "HLEDatabaseVersion", szHLELastCompileTime, filename.c_str());
|
||||||
|
|
||||||
// Write the Certificate Details to the cache file
|
// Write the Certificate Details to the cache file
|
||||||
char tAsciiTitle[40] = "Unknown";
|
|
||||||
setlocale(LC_ALL, "English");
|
setlocale(LC_ALL, "English");
|
||||||
wcstombs(tAsciiTitle, g_pCertificate->wszTitleName, sizeof(tAsciiTitle));
|
|
||||||
WritePrivateProfileString("Certificate", "Name", tAsciiTitle, filename.c_str());
|
WritePrivateProfileString("Certificate", "Name", tAsciiTitle, filename.c_str());
|
||||||
|
|
||||||
std::stringstream titleId;
|
std::stringstream titleId;
|
||||||
|
|
Loading…
Reference in New Issue