|
|
|
@@ -30,7 +30,6 @@
|
|
|
|
|
#include "Blob.h"
|
|
|
|
|
#include "Core.h"
|
|
|
|
|
#include "ISOProperties.h"
|
|
|
|
|
#include "IniFile.h"
|
|
|
|
|
#include "FileUtil.h"
|
|
|
|
|
#include "CDUtils.h"
|
|
|
|
|
#include "WxUtils.h"
|
|
|
|
@@ -149,11 +148,7 @@ CGameListCtrl::~CGameListCtrl()
|
|
|
|
|
if (m_imageListSmall)
|
|
|
|
|
delete m_imageListSmall;
|
|
|
|
|
|
|
|
|
|
while (!m_ISOFiles.empty()) // so lazy
|
|
|
|
|
{
|
|
|
|
|
delete m_ISOFiles.back();
|
|
|
|
|
m_ISOFiles.pop_back();
|
|
|
|
|
}
|
|
|
|
|
ClearIsoFiles();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CGameListCtrl::InitBitmaps()
|
|
|
|
@@ -359,41 +354,37 @@ std::string CGameListCtrl::GetGameNames() const
|
|
|
|
|
// This draws our icons on top of the gamelist, it's only used on Windows
|
|
|
|
|
void CGameListCtrl::OnPaintDrawImages(wxPaintEvent& event)
|
|
|
|
|
{
|
|
|
|
|
int i = 0, nState = 0;
|
|
|
|
|
IniFile ini;
|
|
|
|
|
wxRect itemRect;
|
|
|
|
|
wxPaintDC dc(this);
|
|
|
|
|
|
|
|
|
|
// Calls the default drawing code
|
|
|
|
|
wxControl::OnPaint(event);
|
|
|
|
|
|
|
|
|
|
// Draw the flags, platform icons and emustate icons on top if there's games to show
|
|
|
|
|
if (m_ISOFiles.size() != 0)
|
|
|
|
|
|
|
|
|
|
// Retrieve the topmost shown item and get drawing offsets
|
|
|
|
|
const long
|
|
|
|
|
top_item = GetTopItem(),
|
|
|
|
|
bottom_item = std::min(top_item + GetCountPerPage() + 2, (long)GetItemCount());
|
|
|
|
|
|
|
|
|
|
int flagOffset = GetColumnWidth(0) + GetColumnWidth(1) +
|
|
|
|
|
GetColumnWidth(2) + GetColumnWidth(3);
|
|
|
|
|
int stateOffset = flagOffset + GetColumnWidth(4) + GetColumnWidth(5);
|
|
|
|
|
|
|
|
|
|
// Only redraw shown lines
|
|
|
|
|
for (long i = top_item; i != bottom_item; ++i)
|
|
|
|
|
{
|
|
|
|
|
// Retrieve the topmost shown item and get drawing offsets
|
|
|
|
|
long top = GetTopItem();
|
|
|
|
|
int flagOffset = GetColumnWidth(0) + GetColumnWidth(1) +
|
|
|
|
|
GetColumnWidth(2) + GetColumnWidth(3);
|
|
|
|
|
int stateOffset = flagOffset + GetColumnWidth(4) + GetColumnWidth(5);
|
|
|
|
|
|
|
|
|
|
// Only redraw shown lines
|
|
|
|
|
for (i = top; i < top + GetCountPerPage() + 2; i++)
|
|
|
|
|
wxRect itemRect;
|
|
|
|
|
if (GetItemRect(i, itemRect))
|
|
|
|
|
{
|
|
|
|
|
if (GetItemRect(i, itemRect))
|
|
|
|
|
{
|
|
|
|
|
int itemY = itemRect.GetTop();
|
|
|
|
|
const GameListItem& rISOFile = *m_ISOFiles[GetItemData(i)];
|
|
|
|
|
const int itemY = itemRect.GetTop();
|
|
|
|
|
const GameListItem& rISOFile = *m_ISOFiles[GetItemData(i)];
|
|
|
|
|
|
|
|
|
|
m_imageListSmall->Draw(m_PlatformImageIndex[rISOFile.GetPlatform()],
|
|
|
|
|
dc, itemRect.GetX()+3, itemY);
|
|
|
|
|
m_imageListSmall->Draw(m_FlagImageIndex[rISOFile.GetCountry()],
|
|
|
|
|
dc, flagOffset, itemY);
|
|
|
|
|
|
|
|
|
|
ini.Load(File::GetUserPath(D_GAMECONFIG_IDX) + rISOFile.GetUniqueID() + ".ini");
|
|
|
|
|
ini.Get("EmuState", "EmulationStateId", &nState);
|
|
|
|
|
m_imageListSmall->Draw(m_EmuStateImageIndex[nState],
|
|
|
|
|
dc, stateOffset, itemY);
|
|
|
|
|
}
|
|
|
|
|
m_imageListSmall->Draw(m_PlatformImageIndex[rISOFile.GetPlatform()],
|
|
|
|
|
dc, itemRect.GetX()+3, itemY);
|
|
|
|
|
m_imageListSmall->Draw(m_FlagImageIndex[rISOFile.GetCountry()],
|
|
|
|
|
dc, flagOffset, itemY);
|
|
|
|
|
m_imageListSmall->Draw(m_EmuStateImageIndex[rISOFile.GetEmuState()],
|
|
|
|
|
dc, stateOffset, itemY);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -494,16 +485,8 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifndef _WIN32
|
|
|
|
|
// Load the INI file for columns that read from it
|
|
|
|
|
IniFile ini;
|
|
|
|
|
ini.Load(File::GetUserPath(D_GAMECONFIG_IDX) + rISOFile.GetUniqueID() + ".ini");
|
|
|
|
|
|
|
|
|
|
// Emulation status
|
|
|
|
|
int nState;
|
|
|
|
|
ini.Get("EmuState", "EmulationStateId", &nState);
|
|
|
|
|
|
|
|
|
|
// Emulation state
|
|
|
|
|
SetItemColumnImage(_Index, COLUMN_EMULATION_STATE, m_EmuStateImageIndex[nState]);
|
|
|
|
|
SetItemColumnImage(_Index, COLUMN_EMULATION_STATE, m_EmuStateImageIndex[rISOFile.GetEmuState()]);
|
|
|
|
|
|
|
|
|
|
// Country
|
|
|
|
|
SetItemColumnImage(_Index, COLUMN_COUNTRY, m_FlagImageIndex[rISOFile.GetCountry()]);
|
|
|
|
@@ -543,7 +526,8 @@ void CGameListCtrl::SetBackgroundColor()
|
|
|
|
|
|
|
|
|
|
void CGameListCtrl::ScanForISOs()
|
|
|
|
|
{
|
|
|
|
|
m_ISOFiles.clear();
|
|
|
|
|
ClearIsoFiles();
|
|
|
|
|
|
|
|
|
|
CFileSearch::XStringVector Directories(SConfig::GetInstance().m_ISOFolder);
|
|
|
|
|
|
|
|
|
|
if (SConfig::GetInstance().m_RecursiveISOFolder)
|
|
|
|
@@ -619,7 +603,7 @@ void CGameListCtrl::ScanForISOs()
|
|
|
|
|
if (!Cont)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
GameListItem* const iso_file = new GameListItem(rFilenames[i]);
|
|
|
|
|
std::auto_ptr<GameListItem> iso_file(new GameListItem(rFilenames[i]));
|
|
|
|
|
const GameListItem& ISOFile = *iso_file;
|
|
|
|
|
|
|
|
|
|
if (ISOFile.IsValid())
|
|
|
|
@@ -674,7 +658,7 @@ void CGameListCtrl::ScanForISOs()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (list)
|
|
|
|
|
m_ISOFiles.push_back(iso_file);
|
|
|
|
|
m_ISOFiles.push_back(iso_file.release());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -786,24 +770,21 @@ int wxCALLBACK wxListCompare(long item1, long item2, long sortData)
|
|
|
|
|
if(iso1->GetPlatform() < iso2->GetPlatform())
|
|
|
|
|
return -1 * t;
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
case CGameListCtrl::COLUMN_EMULATION_STATE:
|
|
|
|
|
IniFile ini;
|
|
|
|
|
int nState1 = 0, nState2 = 0;
|
|
|
|
|
std::string GameIni1 = File::GetUserPath(D_GAMECONFIG_IDX) +
|
|
|
|
|
iso1->GetUniqueID() + ".ini";
|
|
|
|
|
std::string GameIni2 = File::GetUserPath(D_GAMECONFIG_IDX) +
|
|
|
|
|
iso2->GetUniqueID() + ".ini";
|
|
|
|
|
{
|
|
|
|
|
const int
|
|
|
|
|
nState1 = iso1->GetEmuState(),
|
|
|
|
|
nState2 = iso2->GetEmuState();
|
|
|
|
|
|
|
|
|
|
ini.Load(GameIni1.c_str());
|
|
|
|
|
ini.Get("EmuState", "EmulationStateId", &nState1);
|
|
|
|
|
ini.Load(GameIni2.c_str());
|
|
|
|
|
ini.Get("EmuState", "EmulationStateId", &nState2);
|
|
|
|
|
|
|
|
|
|
if(nState1 > nState2)
|
|
|
|
|
if (nState1 > nState2)
|
|
|
|
|
return 1 * t;
|
|
|
|
|
if(nState1 < nState2)
|
|
|
|
|
if (nState1 < nState2)
|
|
|
|
|
return -1 * t;
|
|
|
|
|
return 0;
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
@@ -891,7 +872,7 @@ void CGameListCtrl::OnMouseMotion(wxMouseEvent& event)
|
|
|
|
|
{
|
|
|
|
|
int flags;
|
|
|
|
|
long subitem = 0;
|
|
|
|
|
long item = HitTest(event.GetPosition(), flags, &subitem);
|
|
|
|
|
const long item = HitTest(event.GetPosition(), flags, &subitem);
|
|
|
|
|
static int lastItem = -1;
|
|
|
|
|
|
|
|
|
|
if (GetColumnCount() <= 1)
|
|
|
|
@@ -917,30 +898,19 @@ void CGameListCtrl::OnMouseMotion(wxMouseEvent& event)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Emulation status
|
|
|
|
|
static const char* const emuState[] = { "Broken", "Intro", "In-Game", "Playable", "Perfect" };
|
|
|
|
|
|
|
|
|
|
const GameListItem& rISO = *m_ISOFiles[GetItemData(item)];
|
|
|
|
|
|
|
|
|
|
IniFile ini;
|
|
|
|
|
ini.Load(File::GetUserPath(D_GAMECONFIG_IDX) + rISO.GetUniqueID() + ".ini");
|
|
|
|
|
|
|
|
|
|
// Emulation status
|
|
|
|
|
std::string emuState[5] = {
|
|
|
|
|
"Broken",
|
|
|
|
|
"Intro",
|
|
|
|
|
"In-Game",
|
|
|
|
|
"Playable",
|
|
|
|
|
"Perfect"
|
|
|
|
|
};
|
|
|
|
|
std::string issues;
|
|
|
|
|
|
|
|
|
|
int nState;
|
|
|
|
|
ini.Get("EmuState", "EmulationStateId", &nState);
|
|
|
|
|
ini.Get("EmuState", "EmulationIssues", &issues, "");
|
|
|
|
|
const int emu_state = rISO.GetEmuState();
|
|
|
|
|
const std::string& issues = rISO.GetIssues();
|
|
|
|
|
|
|
|
|
|
// Show a tooltip containing the EmuState and the state description
|
|
|
|
|
if (nState > 0 && nState < 6)
|
|
|
|
|
if (emu_state > 0 && emu_state < 6)
|
|
|
|
|
{
|
|
|
|
|
char temp[2048];
|
|
|
|
|
sprintf(temp, "^ %s%s%s", emuState[nState -1].c_str(),
|
|
|
|
|
sprintf(temp, "^ %s%s%s", emuState[emu_state - 1],
|
|
|
|
|
issues.size() > 0 ? " :\n" : "", issues.c_str());
|
|
|
|
|
toolTip = new wxEmuStateTip(this, wxString(temp, *wxConvCurrent), &toolTip);
|
|
|
|
|
}
|
|
|
|
@@ -1062,7 +1032,7 @@ const GameListItem * CGameListCtrl::GetSelectedISO()
|
|
|
|
|
{
|
|
|
|
|
long item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
|
|
|
|
if (item == wxNOT_FOUND)
|
|
|
|
|
return new GameListItem("");
|
|
|
|
|
return new GameListItem(""); // TODO: wtf is this
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Here is a little workaround for multiselections:
|
|
|
|
|