mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-09 18:45:40 +00:00
fixed gamelist cache not dealing with long longs correctly :)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1056 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
c9b1cced9c
commit
d62d517c72
@ -60,6 +60,8 @@
|
|||||||
#define fseek _fseeki64
|
#define fseek _fseeki64
|
||||||
#define ftell _ftelli64
|
#define ftell _ftelli64
|
||||||
|
|
||||||
|
#define atoll _atoi64
|
||||||
|
|
||||||
#define POSIX 0
|
#define POSIX 0
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ void CFrame::OnConfigMain(wxCommandEvent& WXUNUSED (event))
|
|||||||
CConfigMain ConfigMain(this);
|
CConfigMain ConfigMain(this);
|
||||||
ConfigMain.ShowModal();
|
ConfigMain.ShowModal();
|
||||||
if (ConfigMain.bRefreshList)
|
if (ConfigMain.bRefreshList)
|
||||||
m_GameListCtrl->Update(true);
|
m_GameListCtrl->Update(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ void CGameListCtrl::BrowseForDirectory()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameListCtrl::Update(bool Loadcache)
|
void CGameListCtrl::Update(bool loadcache)
|
||||||
{
|
{
|
||||||
if (m_imageListSmall)
|
if (m_imageListSmall)
|
||||||
{
|
{
|
||||||
@ -130,7 +130,7 @@ void CGameListCtrl::Update(bool Loadcache)
|
|||||||
|
|
||||||
Hide();
|
Hide();
|
||||||
|
|
||||||
ScanForISOs(Loadcache);
|
ScanForISOs(loadcache);
|
||||||
|
|
||||||
ClearAll();
|
ClearAll();
|
||||||
|
|
||||||
@ -332,17 +332,17 @@ void CGameListCtrl::SetBackgroundColor()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameListCtrl::ScanForISOs(bool Loadcache)
|
void CGameListCtrl::ScanForISOs(bool loadcache)
|
||||||
{
|
{
|
||||||
FILE * CacheFile;
|
FILE * cacheFile;
|
||||||
bool ScanIso = true;
|
bool scanISO = true;
|
||||||
if (Loadcache)
|
if (loadcache)
|
||||||
{
|
{
|
||||||
ScanIso = false;
|
scanISO = false;
|
||||||
if((CacheFile = fopen("DolphinWx.cache","rb")) == NULL)
|
if ((cacheFile = fopen("DolphinWx.cache", "rb")) == NULL)
|
||||||
{
|
{
|
||||||
ScanIso = true;
|
scanISO = true;
|
||||||
if((CacheFile = fopen("DolphinWx.cache","wb")) == NULL)
|
if ((cacheFile = fopen("DolphinWx.cache", "wb")) == NULL)
|
||||||
{
|
{
|
||||||
PanicAlert("Unable to make or open the dolphin iso cache: is the directory write protected?");
|
PanicAlert("Unable to make or open the dolphin iso cache: is the directory write protected?");
|
||||||
}
|
}
|
||||||
@ -350,7 +350,7 @@ void CGameListCtrl::ScanForISOs(bool Loadcache)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if((CacheFile = fopen("DolphinWx.cache","wb")) == NULL)
|
if ((cacheFile = fopen("DolphinWx.cache", "wb")) == NULL)
|
||||||
{
|
{
|
||||||
// Normally the file should be made when it is opened so if it can't open the file it's
|
// Normally the file should be made when it is opened so if it can't open the file it's
|
||||||
// write protected or something is stopping us from writing
|
// write protected or something is stopping us from writing
|
||||||
@ -358,19 +358,19 @@ void CGameListCtrl::ScanForISOs(bool Loadcache)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_ISOFiles.clear();
|
m_ISOFiles.clear();
|
||||||
if (!ScanIso)
|
if (!scanISO)
|
||||||
{
|
{
|
||||||
// TODO: complete cache loading here. this means ADDING THE BANNER >_<
|
// TODO: complete cache loading here. this means ADDING THE BANNER >_<
|
||||||
char Buffer[257];
|
char buffer[257];
|
||||||
char temp[257];
|
char temp[257];
|
||||||
std::string Filename = " ";
|
std::string filename = " ";
|
||||||
GameListItem ISOFile(Filename.c_str());
|
GameListItem ISOFile(filename.c_str());
|
||||||
// Looping every line of the file
|
// Looping every line of the file
|
||||||
while (fgets(Buffer, 256, CacheFile) != NULL)
|
while (fgets(buffer, 256, cacheFile) != NULL)
|
||||||
{
|
{
|
||||||
strncpy(temp,"",257);
|
strncpy(temp, "", 257);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
switch(Buffer[0])
|
switch (buffer[0])
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
! = file name
|
! = file name
|
||||||
@ -385,22 +385,22 @@ void CGameListCtrl::ScanForISOs(bool Loadcache)
|
|||||||
case '!':
|
case '!':
|
||||||
while (i < 256)
|
while (i < 256)
|
||||||
{
|
{
|
||||||
if (Buffer[1+i] != '\n')
|
if (buffer[1+i] != '\n')
|
||||||
temp[i] = Buffer[1+i];
|
temp[i] = buffer[1+i];
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
Filename = temp;
|
filename = temp;
|
||||||
ISOFile.m_FileName = Filename.c_str();
|
ISOFile.m_FileName = filename.c_str();
|
||||||
break;
|
break;
|
||||||
case 'I':
|
case 'I':
|
||||||
memcpy(temp, &Buffer[1], 6);
|
memcpy(temp, &buffer[1], 6);
|
||||||
ISOFile.m_UniqueID = temp;
|
ISOFile.m_UniqueID = temp;
|
||||||
break;
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
while (i < 257)
|
while (i < 257)
|
||||||
{
|
{
|
||||||
if (Buffer[1+i] != '\n')
|
if (buffer[1+i] != '\n')
|
||||||
temp[i] = Buffer[1+i];
|
temp[i] = buffer[1+i];
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
ISOFile.m_Name = temp;
|
ISOFile.m_Name = temp;
|
||||||
@ -408,8 +408,8 @@ void CGameListCtrl::ScanForISOs(bool Loadcache)
|
|||||||
case 'D':
|
case 'D':
|
||||||
while (i < 257)
|
while (i < 257)
|
||||||
{
|
{
|
||||||
if (Buffer[1+i] != '\n')
|
if (buffer[1+i] != '\n')
|
||||||
temp[i] = Buffer[1+i];
|
temp[i] = buffer[1+i];
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
ISOFile.m_Description = temp;
|
ISOFile.m_Description = temp;
|
||||||
@ -417,29 +417,29 @@ void CGameListCtrl::ScanForISOs(bool Loadcache)
|
|||||||
case 'O':
|
case 'O':
|
||||||
while (i < 257)
|
while (i < 257)
|
||||||
{
|
{
|
||||||
if (Buffer[1+i] != '\n')
|
if (buffer[1+i] != '\n')
|
||||||
temp[i] = Buffer[1+i];
|
temp[i] = buffer[1+i];
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
ISOFile.m_Company = temp;
|
ISOFile.m_Company = temp;
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
memcpy(temp,&Buffer[1],3);
|
memcpy(temp, &buffer[1], 3);
|
||||||
ISOFile.m_Country = (DiscIO::IVolume::ECountry) atoi(temp);
|
ISOFile.m_Country = (DiscIO::IVolume::ECountry) atoi(temp);
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
memcpy(temp,&Buffer[1],11);
|
memcpy(temp, &buffer[1], 11);
|
||||||
ISOFile.m_FileSize = atoi(temp);
|
ISOFile.m_FileSize = atoll(temp);
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
memcpy(temp, &Buffer[1], 11);
|
memcpy(temp, &buffer[1], 11);
|
||||||
ISOFile.m_VolumeSize = atoi(temp);
|
ISOFile.m_VolumeSize = atoll(temp);
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
memcpy(temp, &Buffer[1], 1);
|
memcpy(temp, &buffer[1], 1);
|
||||||
if (temp[0] == '1')
|
if (temp[0] == '1')
|
||||||
ISOFile.m_BlobCompressed = true;
|
ISOFile.m_BlobCompressed = true;
|
||||||
else if(temp[0] == '0')
|
else if (temp[0] == '0')
|
||||||
ISOFile.m_BlobCompressed = false;
|
ISOFile.m_BlobCompressed = false;
|
||||||
else
|
else
|
||||||
PanicAlert("unknown Compressed value %c", temp[1]);
|
PanicAlert("unknown Compressed value %c", temp[1]);
|
||||||
@ -477,7 +477,7 @@ void CGameListCtrl::ScanForISOs(bool Loadcache)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PanicAlert("Unknown Cache line Found:\n%s", Buffer);
|
PanicAlert("Unknown Cache line Found:\n%s", buffer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -528,15 +528,22 @@ void CGameListCtrl::ScanForISOs(bool Loadcache)
|
|||||||
GameListItem ISOFile(rFilenames[i]);
|
GameListItem ISOFile(rFilenames[i]);
|
||||||
if (ISOFile.IsValid())
|
if (ISOFile.IsValid())
|
||||||
{
|
{
|
||||||
if(CacheFile)
|
if(cacheFile)
|
||||||
{
|
{
|
||||||
fseek( CacheFile, 0L, SEEK_END );
|
fseek(cacheFile, 0L, SEEK_END);
|
||||||
fprintf(CacheFile,"!%s\nI%s\nN%s\nD%s\nC%u\nO%s\nS%u\n",ISOFile.GetFileName().c_str(),
|
|
||||||
ISOFile.GetUniqueID().c_str(), ISOFile.GetName().c_str(), ISOFile.GetDescription().c_str()
|
fprintf(cacheFile, "!%s\nI%s\nN%s\nD%s\nC%u\nO%s\nS%llu\nV%llu\nB%u\n$\n",
|
||||||
,ISOFile.GetCountry(), ISOFile.GetCompany().c_str(), ISOFile.GetFileSize());
|
ISOFile.GetFileName().c_str(),
|
||||||
// Why a new fprintf? cause volume size got writen as 0 for some bloody odd reason
|
ISOFile.GetUniqueID().c_str(),
|
||||||
fprintf(CacheFile,"V%u\nB%u\n$\n", ISOFile.GetVolumeSize(), ISOFile.IsCompressed());
|
ISOFile.GetName().c_str(),
|
||||||
ISOFile.m_Image.SaveFile("GameIni\\" + ISOFile.GetUniqueID() + ".png",wxBITMAP_TYPE_PNG);//".JPG",wxBITMAP_TYPE_JPEG);
|
ISOFile.GetDescription().c_str(),
|
||||||
|
ISOFile.GetCountry(),
|
||||||
|
ISOFile.GetCompany().c_str(),
|
||||||
|
ISOFile.GetFileSize(),
|
||||||
|
ISOFile.GetVolumeSize(),
|
||||||
|
ISOFile.IsCompressed());
|
||||||
|
|
||||||
|
ISOFile.m_Image.SaveFile("GameIni\\" + ISOFile.GetUniqueID() + ".png", wxBITMAP_TYPE_PNG);//".JPG",wxBITMAP_TYPE_JPEG);
|
||||||
// TODO: add the banner saving TO 1 FILE AND JPG as well & make the cache MUCH better.
|
// TODO: add the banner saving TO 1 FILE AND JPG as well & make the cache MUCH better.
|
||||||
// This is ugly as fuck
|
// This is ugly as fuck
|
||||||
}
|
}
|
||||||
@ -546,7 +553,7 @@ void CGameListCtrl::ScanForISOs(bool Loadcache)
|
|||||||
PanicAlert("Invalid ISO file %s", rFilenames[i].c_str());
|
PanicAlert("Invalid ISO file %s", rFilenames[i].c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose (CacheFile);
|
fclose (cacheFile);
|
||||||
}
|
}
|
||||||
std::sort(m_ISOFiles.begin(), m_ISOFiles.end());
|
std::sort(m_ISOFiles.begin(), m_ISOFiles.end());
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public:
|
|||||||
CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style);
|
CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style);
|
||||||
~CGameListCtrl();
|
~CGameListCtrl();
|
||||||
|
|
||||||
void Update(bool Loadcache);
|
void Update(bool loadcache);
|
||||||
void BrowseForDirectory();
|
void BrowseForDirectory();
|
||||||
const GameListItem *GetSelectedISO();
|
const GameListItem *GetSelectedISO();
|
||||||
const GameListItem *GetISO(int index) const;
|
const GameListItem *GetISO(int index) const;
|
||||||
@ -59,7 +59,7 @@ private:
|
|||||||
void InitBitmaps();
|
void InitBitmaps();
|
||||||
void InsertItemInReportView(long _Index);
|
void InsertItemInReportView(long _Index);
|
||||||
void SetBackgroundColor();
|
void SetBackgroundColor();
|
||||||
void ScanForISOs(bool Loadcache);
|
void ScanForISOs(bool loadcache);
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user