2015-05-23 22:55:12 -06:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-17 17:08:10 -06:00
|
|
|
// Licensed under GPLv2+
|
2013-04-17 21:43:35 -06:00
|
|
|
// Refer to the license.txt file included.
|
2008-12-07 22:30:24 -07:00
|
|
|
|
|
|
|
#include <algorithm>
|
2013-10-26 03:55:41 -06:00
|
|
|
#include <cinttypes>
|
2014-02-22 15:36:30 -07:00
|
|
|
#include <cstddef>
|
|
|
|
#include <cstdio>
|
|
|
|
#include <cstring>
|
2011-03-22 03:40:47 -06:00
|
|
|
#include <memory>
|
2014-02-22 15:36:30 -07:00
|
|
|
#include <string>
|
2015-09-13 06:17:58 -06:00
|
|
|
#include <unordered_map>
|
2014-02-22 15:36:30 -07:00
|
|
|
#include <vector>
|
|
|
|
#include <wx/bitmap.h>
|
|
|
|
#include <wx/buffer.h>
|
|
|
|
#include <wx/colour.h>
|
|
|
|
#include <wx/dirdlg.h>
|
|
|
|
#include <wx/filedlg.h>
|
|
|
|
#include <wx/filefn.h>
|
2014-02-18 18:56:29 -07:00
|
|
|
#include <wx/filename.h>
|
|
|
|
#include <wx/imaglist.h>
|
2014-02-22 15:36:30 -07:00
|
|
|
#include <wx/listctrl.h>
|
|
|
|
#include <wx/menu.h>
|
|
|
|
#include <wx/msgdlg.h>
|
|
|
|
#include <wx/progdlg.h>
|
|
|
|
#include <wx/settings.h>
|
|
|
|
#include <wx/tipwin.h>
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "Common/CDUtils.h"
|
2014-10-22 15:25:00 -06:00
|
|
|
#include "Common/CommonPaths.h"
|
2014-09-07 19:06:58 -06:00
|
|
|
#include "Common/CommonTypes.h"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "Common/FileSearch.h"
|
|
|
|
#include "Common/FileUtil.h"
|
|
|
|
#include "Common/MathUtil.h"
|
|
|
|
#include "Common/StringUtil.h"
|
2014-02-22 15:36:30 -07:00
|
|
|
#include "Common/SysConf.h"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "Core/ConfigManager.h"
|
|
|
|
#include "Core/Core.h"
|
2014-02-22 15:36:30 -07:00
|
|
|
#include "Core/Movie.h"
|
|
|
|
#include "Core/Boot/Boot.h"
|
2014-06-23 22:07:46 -06:00
|
|
|
#include "Core/HW/DVDInterface.h"
|
2014-09-07 07:57:49 -06:00
|
|
|
#include "Core/HW/WiiSaveCrypted.h"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "DiscIO/Blob.h"
|
2014-02-22 15:36:30 -07:00
|
|
|
#include "DiscIO/Volume.h"
|
|
|
|
#include "DiscIO/VolumeCreator.h"
|
|
|
|
#include "DolphinWX/Frame.h"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "DolphinWX/GameListCtrl.h"
|
|
|
|
#include "DolphinWX/Globals.h"
|
2014-02-22 15:36:30 -07:00
|
|
|
#include "DolphinWX/ISOFile.h"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "DolphinWX/ISOProperties.h"
|
|
|
|
#include "DolphinWX/Main.h"
|
|
|
|
#include "DolphinWX/WxUtils.h"
|
2014-10-26 15:47:07 -06:00
|
|
|
#include "DolphinWX/resources/Flag_Australia.xpm"
|
2014-02-18 04:09:38 -07:00
|
|
|
#include "DolphinWX/resources/Flag_Europe.xpm"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "DolphinWX/resources/Flag_France.xpm"
|
2014-02-18 18:56:29 -07:00
|
|
|
#include "DolphinWX/resources/Flag_Germany.xpm"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "DolphinWX/resources/Flag_Italy.xpm"
|
|
|
|
#include "DolphinWX/resources/Flag_Japan.xpm"
|
|
|
|
#include "DolphinWX/resources/Flag_Korea.xpm"
|
2014-10-30 08:35:46 -06:00
|
|
|
#include "DolphinWX/resources/Flag_Netherlands.xpm"
|
2014-10-26 15:47:07 -06:00
|
|
|
#include "DolphinWX/resources/Flag_Russia.xpm"
|
2014-10-30 08:35:46 -06:00
|
|
|
#include "DolphinWX/resources/Flag_Spain.xpm"
|
2014-02-18 18:56:29 -07:00
|
|
|
#include "DolphinWX/resources/Flag_Taiwan.xpm"
|
|
|
|
#include "DolphinWX/resources/Flag_Unknown.xpm"
|
|
|
|
#include "DolphinWX/resources/Flag_USA.xpm"
|
|
|
|
#include "DolphinWX/resources/Platform_Gamecube.xpm"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "DolphinWX/resources/Platform_Wad.xpm"
|
|
|
|
#include "DolphinWX/resources/Platform_Wii.xpm"
|
|
|
|
#include "DolphinWX/resources/rating_gamelist.h"
|
2008-12-07 22:30:24 -07:00
|
|
|
|
|
|
|
size_t CGameListCtrl::m_currentItem = 0;
|
|
|
|
size_t CGameListCtrl::m_numberItem = 0;
|
|
|
|
std::string CGameListCtrl::m_currentFilename;
|
2014-07-08 07:58:25 -06:00
|
|
|
static bool sorted = false;
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2011-11-01 19:16:49 -06:00
|
|
|
static int CompareGameListItems(const GameListItem* iso1, const GameListItem* iso2,
|
2014-02-16 21:51:41 -07:00
|
|
|
long sortData = CGameListCtrl::COLUMN_TITLE)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2011-11-01 19:16:49 -06:00
|
|
|
int t = 1;
|
|
|
|
|
|
|
|
if (sortData < 0)
|
|
|
|
{
|
|
|
|
t = -1;
|
|
|
|
sortData = -sortData;
|
|
|
|
}
|
|
|
|
|
2014-03-10 05:30:55 -06:00
|
|
|
switch (sortData)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2010-07-31 08:14:01 -06:00
|
|
|
case CGameListCtrl::COLUMN_TITLE:
|
2015-09-13 04:45:06 -06:00
|
|
|
if (!strcasecmp(iso1->GetName().c_str(), iso2->GetName().c_str()))
|
2013-01-25 01:07:50 -07:00
|
|
|
{
|
2015-03-07 02:26:04 -07:00
|
|
|
if (iso1->GetUniqueID() != iso2->GetUniqueID())
|
|
|
|
return t * (iso1->GetUniqueID() > iso2->GetUniqueID() ? 1 : -1);
|
|
|
|
if (iso1->GetRevision() != iso2->GetRevision())
|
2015-04-20 05:00:15 -06:00
|
|
|
return t * (iso1->GetRevision() > iso2->GetRevision() ? 1 : -1);
|
2015-05-29 13:14:02 -06:00
|
|
|
if (iso1->GetDiscNumber() != iso2->GetDiscNumber())
|
|
|
|
return t * (iso1->GetDiscNumber() > iso2->GetDiscNumber() ? 1 : -1);
|
2013-01-25 01:07:50 -07:00
|
|
|
}
|
2015-09-13 04:45:06 -06:00
|
|
|
return strcasecmp(iso1->GetName().c_str(), iso2->GetName().c_str()) * t;
|
2015-04-20 05:00:15 -06:00
|
|
|
case CGameListCtrl::COLUMN_MAKER:
|
|
|
|
return strcasecmp(iso1->GetCompany().c_str(), iso2->GetCompany().c_str()) * t;
|
2014-06-04 07:54:48 -06:00
|
|
|
case CGameListCtrl::COLUMN_ID:
|
2015-04-20 05:00:15 -06:00
|
|
|
return strcasecmp(iso1->GetUniqueID().c_str(), iso2->GetUniqueID().c_str()) * t;
|
2010-07-31 08:14:01 -06:00
|
|
|
case CGameListCtrl::COLUMN_COUNTRY:
|
2014-03-10 05:30:55 -06:00
|
|
|
if (iso1->GetCountry() > iso2->GetCountry())
|
2011-11-01 19:16:49 -06:00
|
|
|
return 1 * t;
|
2014-03-10 05:30:55 -06:00
|
|
|
if (iso1->GetCountry() < iso2->GetCountry())
|
2011-11-01 19:16:49 -06:00
|
|
|
return -1 * t;
|
|
|
|
return 0;
|
2010-07-31 08:14:01 -06:00
|
|
|
case CGameListCtrl::COLUMN_SIZE:
|
2011-11-01 19:16:49 -06:00
|
|
|
if (iso1->GetFileSize() > iso2->GetFileSize())
|
|
|
|
return 1 * t;
|
|
|
|
if (iso1->GetFileSize() < iso2->GetFileSize())
|
|
|
|
return -1 * t;
|
|
|
|
return 0;
|
2010-07-31 08:14:01 -06:00
|
|
|
case CGameListCtrl::COLUMN_PLATFORM:
|
2014-03-10 05:30:55 -06:00
|
|
|
if (iso1->GetPlatform() > iso2->GetPlatform())
|
2011-11-01 19:16:49 -06:00
|
|
|
return 1 * t;
|
2014-03-10 05:30:55 -06:00
|
|
|
if (iso1->GetPlatform() < iso2->GetPlatform())
|
2011-11-01 19:16:49 -06:00
|
|
|
return -1 * t;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case CGameListCtrl::COLUMN_EMULATION_STATE:
|
|
|
|
{
|
|
|
|
const int
|
|
|
|
nState1 = iso1->GetEmuState(),
|
|
|
|
nState2 = iso2->GetEmuState();
|
|
|
|
|
|
|
|
if (nState1 > nState2)
|
|
|
|
return 1 * t;
|
|
|
|
if (nState1 < nState2)
|
|
|
|
return -1 * t;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
2011-12-18 05:58:44 -07:00
|
|
|
break;
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
2011-11-01 19:16:49 -06:00
|
|
|
|
|
|
|
return 0;
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
2010-07-31 08:14:01 -06:00
|
|
|
CGameListCtrl::CGameListCtrl(wxWindow* parent, const wxWindowID id, const
|
|
|
|
wxPoint& pos, const wxSize& size, long style)
|
2014-03-09 14:14:26 -06:00
|
|
|
: wxListCtrl(parent, id, pos, size, style), toolTip(nullptr)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2014-11-08 17:26:20 -07:00
|
|
|
Bind(wxEVT_SIZE, &CGameListCtrl::OnSize, this);
|
|
|
|
Bind(wxEVT_RIGHT_DOWN, &CGameListCtrl::OnRightClick, this);
|
|
|
|
Bind(wxEVT_LEFT_DOWN, &CGameListCtrl::OnLeftClick, this);
|
|
|
|
Bind(wxEVT_MOTION, &CGameListCtrl::OnMouseMotion, this);
|
|
|
|
Bind(wxEVT_LIST_KEY_DOWN, &CGameListCtrl::OnKeyPress, this);
|
|
|
|
Bind(wxEVT_LIST_COL_BEGIN_DRAG, &CGameListCtrl::OnColBeginDrag, this);
|
|
|
|
Bind(wxEVT_LIST_COL_CLICK, &CGameListCtrl::OnColumnClick, this);
|
|
|
|
|
|
|
|
Bind(wxEVT_MENU, &CGameListCtrl::OnProperties, this, IDM_PROPERTIES);
|
2014-12-20 18:36:26 -07:00
|
|
|
Bind(wxEVT_MENU, &CGameListCtrl::OnWiki, this, IDM_GAME_WIKI);
|
|
|
|
Bind(wxEVT_MENU, &CGameListCtrl::OnOpenContainingFolder, this, IDM_OPEN_CONTAINING_FOLDER);
|
|
|
|
Bind(wxEVT_MENU, &CGameListCtrl::OnOpenSaveFolder, this, IDM_OPEN_SAVE_FOLDER);
|
|
|
|
Bind(wxEVT_MENU, &CGameListCtrl::OnExportSave, this, IDM_EXPORT_SAVE);
|
|
|
|
Bind(wxEVT_MENU, &CGameListCtrl::OnSetDefaultISO, this, IDM_SET_DEFAULT_ISO);
|
|
|
|
Bind(wxEVT_MENU, &CGameListCtrl::OnCompressISO, this, IDM_COMPRESS_ISO);
|
|
|
|
Bind(wxEVT_MENU, &CGameListCtrl::OnMultiCompressISO, this, IDM_MULTI_COMPRESS_ISO);
|
|
|
|
Bind(wxEVT_MENU, &CGameListCtrl::OnMultiDecompressISO, this, IDM_MULTI_DECOMPRESS_ISO);
|
|
|
|
Bind(wxEVT_MENU, &CGameListCtrl::OnDeleteISO, this, IDM_DELETE_ISO);
|
|
|
|
Bind(wxEVT_MENU, &CGameListCtrl::OnChangeDisc, this, IDM_LIST_CHANGE_DISC);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
CGameListCtrl::~CGameListCtrl()
|
|
|
|
{
|
2009-03-23 15:19:43 -06:00
|
|
|
if (m_imageListSmall)
|
|
|
|
delete m_imageListSmall;
|
2011-03-22 01:27:23 -06:00
|
|
|
|
2011-03-22 22:31:00 -06:00
|
|
|
ClearIsoFiles();
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void CGameListCtrl::InitBitmaps()
|
|
|
|
{
|
|
|
|
m_imageListSmall = new wxImageList(96, 32);
|
|
|
|
SetImageList(m_imageListSmall, wxIMAGE_LIST_SMALL);
|
2009-07-03 16:34:51 -06:00
|
|
|
|
2010-02-21 12:19:16 -07:00
|
|
|
m_FlagImageIndex.resize(DiscIO::IVolume::NUMBER_OF_COUNTRIES);
|
2014-10-30 08:35:46 -06:00
|
|
|
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_JAPAN] = m_imageListSmall->Add(wxBitmap(Flag_Japan_xpm));
|
|
|
|
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_EUROPE] = m_imageListSmall->Add(wxBitmap(Flag_Europe_xpm));
|
|
|
|
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_USA] = m_imageListSmall->Add(wxBitmap(Flag_USA_xpm));
|
|
|
|
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_AUSTRALIA] = m_imageListSmall->Add(wxBitmap(Flag_Australia_xpm));
|
|
|
|
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_FRANCE] = m_imageListSmall->Add(wxBitmap(Flag_France_xpm));
|
|
|
|
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_GERMANY] = m_imageListSmall->Add(wxBitmap(Flag_Germany_xpm));
|
|
|
|
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_ITALY] = m_imageListSmall->Add(wxBitmap(Flag_Italy_xpm));
|
|
|
|
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_KOREA] = m_imageListSmall->Add(wxBitmap(Flag_Korea_xpm));
|
|
|
|
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_NETHERLANDS] = m_imageListSmall->Add(wxBitmap(Flag_Netherlands_xpm));
|
|
|
|
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_RUSSIA] = m_imageListSmall->Add(wxBitmap(Flag_Russia_xpm));
|
|
|
|
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_SPAIN] = m_imageListSmall->Add(wxBitmap(Flag_Spain_xpm));
|
|
|
|
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_TAIWAN] = m_imageListSmall->Add(wxBitmap(Flag_Taiwan_xpm));
|
2015-04-08 16:55:16 -06:00
|
|
|
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_WORLD] = m_imageListSmall->Add(wxBitmap(Flag_Europe_xpm)); // Uses European flag as a placeholder
|
2014-10-30 08:35:46 -06:00
|
|
|
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_UNKNOWN] = m_imageListSmall->Add(wxBitmap(Flag_Unknown_xpm));
|
2009-05-27 00:41:01 -06:00
|
|
|
|
2015-08-25 23:13:55 -06:00
|
|
|
m_PlatformImageIndex.resize(4);
|
2014-03-05 21:02:34 -07:00
|
|
|
m_PlatformImageIndex[0] = m_imageListSmall->Add(wxBitmap(Platform_Gamecube_xpm));
|
|
|
|
m_PlatformImageIndex[1] = m_imageListSmall->Add(wxBitmap(Platform_Wii_xpm));
|
|
|
|
m_PlatformImageIndex[2] = m_imageListSmall->Add(wxBitmap(Platform_Wad_xpm));
|
2015-08-25 23:13:55 -06:00
|
|
|
m_PlatformImageIndex[3] = m_imageListSmall->Add(wxBitmap(StrToWxStr(File::GetThemeDir(SConfig::GetInstance().theme_name) + "fileplatform.png"), wxBITMAP_TYPE_PNG));
|
2009-09-25 10:29:00 -06:00
|
|
|
|
|
|
|
m_EmuStateImageIndex.resize(6);
|
2014-03-05 21:02:34 -07:00
|
|
|
m_EmuStateImageIndex[0] = m_imageListSmall->Add(wxBitmap(rating_0));
|
|
|
|
m_EmuStateImageIndex[1] = m_imageListSmall->Add(wxBitmap(rating_1));
|
|
|
|
m_EmuStateImageIndex[2] = m_imageListSmall->Add(wxBitmap(rating_2));
|
|
|
|
m_EmuStateImageIndex[3] = m_imageListSmall->Add(wxBitmap(rating_3));
|
|
|
|
m_EmuStateImageIndex[4] = m_imageListSmall->Add(wxBitmap(rating_4));
|
|
|
|
m_EmuStateImageIndex[5] = m_imageListSmall->Add(wxBitmap(rating_5));
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void CGameListCtrl::BrowseForDirectory()
|
|
|
|
{
|
|
|
|
wxString dirHome;
|
|
|
|
wxGetHomeDir(&dirHome);
|
|
|
|
|
|
|
|
// browse
|
2010-07-31 08:14:01 -06:00
|
|
|
wxDirDialog dialog(this, _("Browse for a directory to add"), dirHome,
|
|
|
|
wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
|
2008-12-07 22:30:24 -07:00
|
|
|
|
|
|
|
if (dialog.ShowModal() == wxID_OK)
|
|
|
|
{
|
2013-02-27 21:37:38 -07:00
|
|
|
std::string sPath(WxStrToStr(dialog.GetPath()));
|
2009-01-04 22:09:23 -07:00
|
|
|
std::vector<std::string>::iterator itResult = std::find(
|
2010-07-31 08:14:01 -06:00
|
|
|
SConfig::GetInstance().m_ISOFolder.begin(),
|
|
|
|
SConfig::GetInstance().m_ISOFolder.end(), sPath);
|
2009-01-04 22:09:23 -07:00
|
|
|
|
|
|
|
if (itResult == SConfig::GetInstance().m_ISOFolder.end())
|
|
|
|
{
|
|
|
|
SConfig::GetInstance().m_ISOFolder.push_back(sPath);
|
|
|
|
SConfig::GetInstance().SaveSettings();
|
|
|
|
}
|
2010-07-31 08:14:01 -06:00
|
|
|
|
2008-12-07 22:30:24 -07:00
|
|
|
Update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-03 08:03:34 -07:00
|
|
|
void CGameListCtrl::Update()
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2013-01-10 11:35:32 -07:00
|
|
|
int scrollPos = wxWindow::GetScrollPos(wxVERTICAL);
|
2009-06-06 20:27:36 -06:00
|
|
|
// Don't let the user refresh it while a game is running
|
2009-04-15 14:19:25 -06:00
|
|
|
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
|
|
|
return;
|
2009-06-06 20:27:36 -06:00
|
|
|
|
2008-12-07 22:30:24 -07:00
|
|
|
if (m_imageListSmall)
|
|
|
|
{
|
|
|
|
delete m_imageListSmall;
|
2014-03-09 14:14:26 -06:00
|
|
|
m_imageListSmall = nullptr;
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
Hide();
|
|
|
|
|
2009-02-03 08:03:34 -07:00
|
|
|
ScanForISOs();
|
2008-12-07 22:30:24 -07:00
|
|
|
|
|
|
|
ClearAll();
|
|
|
|
|
|
|
|
if (m_ISOFiles.size() != 0)
|
|
|
|
{
|
|
|
|
// Don't load bitmaps unless there are games to list
|
|
|
|
InitBitmaps();
|
|
|
|
|
|
|
|
// add columns
|
2014-05-17 11:17:28 -06:00
|
|
|
InsertColumn(COLUMN_DUMMY, "");
|
|
|
|
InsertColumn(COLUMN_PLATFORM, "");
|
2008-12-07 22:30:24 -07:00
|
|
|
InsertColumn(COLUMN_BANNER, _("Banner"));
|
|
|
|
InsertColumn(COLUMN_TITLE, _("Title"));
|
2010-07-31 08:14:01 -06:00
|
|
|
|
2015-04-20 05:00:15 -06:00
|
|
|
InsertColumn(COLUMN_MAKER, _("Maker"));
|
2014-06-04 07:54:48 -06:00
|
|
|
InsertColumn(COLUMN_ID, _("ID"));
|
2014-05-17 11:17:28 -06:00
|
|
|
InsertColumn(COLUMN_COUNTRY, "");
|
2008-12-07 22:30:24 -07:00
|
|
|
InsertColumn(COLUMN_SIZE, _("Size"));
|
2009-09-27 15:28:09 -06:00
|
|
|
InsertColumn(COLUMN_EMULATION_STATE, _("State"));
|
2011-12-18 05:58:44 -07:00
|
|
|
|
2012-03-22 19:45:11 -06:00
|
|
|
#ifdef __WXMSW__
|
|
|
|
const int platform_padding = 0;
|
|
|
|
#else
|
|
|
|
const int platform_padding = 8;
|
|
|
|
#endif
|
2013-10-28 23:23:17 -06:00
|
|
|
|
2008-12-07 22:30:24 -07:00
|
|
|
// set initial sizes for columns
|
2012-12-17 04:08:45 -07:00
|
|
|
SetColumnWidth(COLUMN_DUMMY,0);
|
2014-06-04 07:54:48 -06:00
|
|
|
SetColumnWidth(COLUMN_PLATFORM, SConfig::GetInstance().m_showSystemColumn ? 35 + platform_padding : 0);
|
|
|
|
SetColumnWidth(COLUMN_BANNER, SConfig::GetInstance().m_showBannerColumn ? 96 + platform_padding : 0);
|
|
|
|
SetColumnWidth(COLUMN_TITLE, 175 + platform_padding);
|
2015-04-20 05:00:15 -06:00
|
|
|
SetColumnWidth(COLUMN_MAKER, SConfig::GetInstance().m_showMakerColumn ? 150 + platform_padding : 0);
|
2014-06-04 07:54:48 -06:00
|
|
|
SetColumnWidth(COLUMN_ID, SConfig::GetInstance().m_showIDColumn ? 75 + platform_padding : 0);
|
|
|
|
SetColumnWidth(COLUMN_COUNTRY, SConfig::GetInstance().m_showRegionColumn ? 32 + platform_padding : 0);
|
|
|
|
SetColumnWidth(COLUMN_EMULATION_STATE, SConfig::GetInstance().m_showStateColumn ? 50 + platform_padding : 0);
|
2009-06-06 20:27:36 -06:00
|
|
|
|
2008-12-07 22:30:24 -07:00
|
|
|
// add all items
|
|
|
|
for (int i = 0; i < (int)m_ISOFiles.size(); i++)
|
|
|
|
{
|
|
|
|
InsertItemInReportView(i);
|
2014-06-04 07:54:48 -06:00
|
|
|
if (SConfig::GetInstance().m_ColorCompressed && m_ISOFiles[i]->IsCompressed())
|
2008-12-07 22:30:24 -07:00
|
|
|
SetItemTextColour(i, wxColour(0xFF0000));
|
|
|
|
}
|
|
|
|
|
2009-09-25 10:29:00 -06:00
|
|
|
// Sort items by Title
|
2012-12-24 11:04:57 -07:00
|
|
|
if (!sorted)
|
|
|
|
last_column = 0;
|
2012-12-24 10:48:14 -07:00
|
|
|
sorted = false;
|
2009-09-25 10:29:00 -06:00
|
|
|
wxListEvent event;
|
2012-12-17 04:08:45 -07:00
|
|
|
event.m_col = SConfig::GetInstance().m_ListSort2;
|
2009-09-25 10:29:00 -06:00
|
|
|
OnColumnClick(event);
|
|
|
|
|
2012-12-17 04:08:45 -07:00
|
|
|
event.m_col = SConfig::GetInstance().m_ListSort;
|
|
|
|
OnColumnClick(event);
|
|
|
|
sorted = true;
|
|
|
|
|
2014-07-05 23:59:38 -06:00
|
|
|
SetColumnWidth(COLUMN_SIZE, SConfig::GetInstance().m_showSizeColumn ? wxLIST_AUTOSIZE : 0);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-08-01 23:59:55 -06:00
|
|
|
wxString errorString;
|
2010-07-31 08:14:01 -06:00
|
|
|
// We just check for one hide setting to be enabled, as we may only
|
|
|
|
// have GC games for example, and hide them, so we should show the
|
|
|
|
// second message instead
|
2009-09-25 10:29:00 -06:00
|
|
|
if ((SConfig::GetInstance().m_ListGC &&
|
|
|
|
SConfig::GetInstance().m_ListWii &&
|
2009-06-08 23:08:58 -06:00
|
|
|
SConfig::GetInstance().m_ListWad) &&
|
2009-09-25 10:29:00 -06:00
|
|
|
(SConfig::GetInstance().m_ListJap &&
|
|
|
|
SConfig::GetInstance().m_ListUsa &&
|
2009-06-08 23:08:58 -06:00
|
|
|
SConfig::GetInstance().m_ListPal))
|
|
|
|
{
|
2014-10-03 11:40:39 -06:00
|
|
|
errorString = _("Dolphin could not find any GameCube/Wii ISOs or WADs. Double-click here to browse for files...");
|
2009-06-08 23:08:58 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-10-03 11:40:39 -06:00
|
|
|
errorString = _("Dolphin is currently set to hide all games. Double-click here to show all games...");
|
2009-06-08 23:08:58 -06:00
|
|
|
}
|
2014-08-24 14:00:37 -06:00
|
|
|
InsertColumn(0, "");
|
2009-09-25 10:29:00 -06:00
|
|
|
long index = InsertItem(0, errorString);
|
2008-12-07 22:30:24 -07:00
|
|
|
SetItemFont(index, *wxITALIC_FONT);
|
2009-09-25 10:29:00 -06:00
|
|
|
SetColumnWidth(0, wxLIST_AUTOSIZE);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
2014-03-09 14:14:26 -06:00
|
|
|
if (GetSelectedISO() == nullptr)
|
2013-02-06 22:31:57 -07:00
|
|
|
main_frame->UpdateGUI();
|
2008-12-07 22:30:24 -07:00
|
|
|
Show();
|
2009-06-07 15:10:02 -06:00
|
|
|
|
|
|
|
AutomaticColumnWidth();
|
2013-01-10 11:35:32 -07:00
|
|
|
ScrollLines(scrollPos);
|
2013-01-10 12:29:48 -07:00
|
|
|
SetFocus();
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
2014-07-08 06:29:26 -06:00
|
|
|
static wxString NiceSizeFormat(u64 _size)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2014-05-17 21:00:34 -06:00
|
|
|
// Return a pretty filesize string from byte count.
|
|
|
|
// e.g. 1134278 -> "1.08 MiB"
|
|
|
|
|
2013-03-05 02:12:17 -07:00
|
|
|
const char* const unit_symbols[] = {"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"};
|
2013-10-28 23:23:17 -06:00
|
|
|
|
2014-05-17 21:00:34 -06:00
|
|
|
// Find largest power of 2 less than _size.
|
|
|
|
// div 10 to get largest named unit less than _size
|
|
|
|
// 10 == log2(1024) (number of B in a KiB, KiB in a MiB, etc)
|
2014-08-24 12:03:07 -06:00
|
|
|
const u64 unit = IntLog2(std::max<u64>(_size, 1)) / 10;
|
2015-03-15 20:28:47 -06:00
|
|
|
const u64 unit_size = (1ull << (unit * 10));
|
2013-10-28 23:23:17 -06:00
|
|
|
|
2014-05-17 21:00:34 -06:00
|
|
|
// mul 1000 for 3 decimal places, add 5 to round up, div 10 for 2 decimal places
|
|
|
|
std::string value = std::to_string((_size * 1000 / unit_size + 5) / 10);
|
|
|
|
// Insert decimal point.
|
|
|
|
value.insert(value.size() - 2, ".");
|
|
|
|
return StrToWxStr(StringFromFormat("%s %s", value.c_str(), unit_symbols[unit]));
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void CGameListCtrl::InsertItemInReportView(long _Index)
|
|
|
|
{
|
2009-03-23 15:19:43 -06:00
|
|
|
// When using wxListCtrl, there is no hope of per-column text colors.
|
|
|
|
// But for reference, here are the old colors that were used: (BGR)
|
|
|
|
// title: 0xFF0000
|
|
|
|
// company: 0x007030
|
2009-12-28 12:34:19 -07:00
|
|
|
int ImageIndex = -1;
|
2011-01-27 16:59:12 -07:00
|
|
|
|
2011-03-22 01:27:23 -06:00
|
|
|
GameListItem& rISOFile = *m_ISOFiles[_Index];
|
2010-02-21 12:19:16 -07:00
|
|
|
|
2012-12-17 04:08:45 -07:00
|
|
|
// Insert a first row with nothing in it, that will be used as the Index
|
|
|
|
long ItemIndex = InsertItem(_Index, wxEmptyString);
|
|
|
|
|
|
|
|
// Insert the platform's image in the first (visible) column
|
|
|
|
SetItemColumnImage(_Index, COLUMN_PLATFORM, m_PlatformImageIndex[rISOFile.GetPlatform()]);
|
2009-09-25 10:29:00 -06:00
|
|
|
|
2013-09-25 01:05:36 -06:00
|
|
|
if (rISOFile.GetBitmap().IsOk())
|
|
|
|
ImageIndex = m_imageListSmall->Add(rISOFile.GetBitmap());
|
2009-12-28 12:34:19 -07:00
|
|
|
|
2009-09-25 10:29:00 -06:00
|
|
|
// Set the game's banner in the second column
|
|
|
|
SetItemColumnImage(_Index, COLUMN_BANNER, ImageIndex);
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2015-05-27 04:28:23 -06:00
|
|
|
wxString name = StrToWxStr(rISOFile.GetName());
|
2014-10-22 15:25:00 -06:00
|
|
|
|
2015-05-29 13:14:02 -06:00
|
|
|
int disc_number = rISOFile.GetDiscNumber() + 1;
|
|
|
|
if (disc_number > 1 && name.Lower().find(wxString::Format("disc %i", disc_number)) == std::string::npos
|
|
|
|
&& name.Lower().find(wxString::Format("disc%i", disc_number)) == std::string::npos)
|
|
|
|
{
|
|
|
|
name = wxString::Format(_("%s (Disc %i)"), name.c_str(), disc_number);
|
|
|
|
}
|
2015-02-02 11:35:46 -07:00
|
|
|
|
|
|
|
SetItem(_Index, COLUMN_TITLE, name, -1);
|
2015-04-20 05:00:15 -06:00
|
|
|
SetItem(_Index, COLUMN_MAKER, StrToWxStr(rISOFile.GetCompany()), -1);
|
2011-12-18 23:01:46 -07:00
|
|
|
|
2010-02-21 12:19:16 -07:00
|
|
|
// Emulation state
|
2011-03-22 22:31:00 -06:00
|
|
|
SetItemColumnImage(_Index, COLUMN_EMULATION_STATE, m_EmuStateImageIndex[rISOFile.GetEmuState()]);
|
2008-12-07 22:30:24 -07:00
|
|
|
|
|
|
|
// Country
|
2009-03-23 15:19:43 -06:00
|
|
|
SetItemColumnImage(_Index, COLUMN_COUNTRY, m_FlagImageIndex[rISOFile.GetCountry()]);
|
2010-02-21 12:19:16 -07:00
|
|
|
|
|
|
|
// File size
|
|
|
|
SetItem(_Index, COLUMN_SIZE, NiceSizeFormat(rISOFile.GetFileSize()), -1);
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2014-06-04 07:54:48 -06:00
|
|
|
// Game ID
|
|
|
|
SetItem(_Index, COLUMN_ID, rISOFile.GetUniqueID(), -1);
|
|
|
|
|
2009-03-23 15:19:43 -06:00
|
|
|
// Background color
|
|
|
|
SetBackgroundColor();
|
2008-12-07 22:30:24 -07:00
|
|
|
|
|
|
|
// Item data
|
|
|
|
SetItemData(_Index, ItemIndex);
|
|
|
|
}
|
|
|
|
|
2014-07-08 06:29:26 -06:00
|
|
|
static wxColour blend50(const wxColour& c1, const wxColour& c2)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
|
|
|
unsigned char r,g,b,a;
|
|
|
|
r = c1.Red()/2 + c2.Red()/2;
|
|
|
|
g = c1.Green()/2 + c2.Green()/2;
|
|
|
|
b = c1.Blue()/2 + c2.Blue()/2;
|
|
|
|
a = c1.Alpha()/2 + c2.Alpha()/2;
|
|
|
|
return a << 24 | b << 16 | g << 8 | r;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CGameListCtrl::SetBackgroundColor()
|
|
|
|
{
|
2014-03-10 05:30:55 -06:00
|
|
|
for (long i = 0; i < GetItemCount(); i++)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2010-07-31 08:14:01 -06:00
|
|
|
wxColour color = (i & 1) ?
|
|
|
|
blend50(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT),
|
|
|
|
wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)) :
|
|
|
|
wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
|
2008-12-07 22:30:24 -07:00
|
|
|
CGameListCtrl::SetItemBackgroundColour(i, color);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-03 08:03:34 -07:00
|
|
|
void CGameListCtrl::ScanForISOs()
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2011-03-22 22:31:00 -06:00
|
|
|
ClearIsoFiles();
|
|
|
|
|
2015-09-13 06:17:58 -06:00
|
|
|
// Load custom game titles from titles.txt
|
|
|
|
// http://www.gametdb.com/Wii/Downloads
|
|
|
|
std::unordered_map<std::string, std::string> custom_title_map;
|
|
|
|
std::ifstream titlestxt;
|
|
|
|
OpenFStream(titlestxt, File::GetUserPath(D_LOAD_IDX) + "titles.txt", std::ios::in);
|
|
|
|
|
|
|
|
if (!titlestxt.is_open())
|
|
|
|
OpenFStream(titlestxt, File::GetUserPath(D_LOAD_IDX) + "wiitdb.txt", std::ios::in);
|
|
|
|
|
|
|
|
if (titlestxt.is_open())
|
|
|
|
{
|
|
|
|
std::string line;
|
|
|
|
while (!titlestxt.eof() && std::getline(titlestxt, line))
|
|
|
|
{
|
|
|
|
const size_t equals_index = line.find('=');
|
|
|
|
if (equals_index != std::string::npos)
|
|
|
|
custom_title_map.emplace(StripSpaces(line.substr(0, equals_index)),
|
|
|
|
StripSpaces(line.substr(equals_index + 1)));
|
|
|
|
}
|
|
|
|
titlestxt.close();
|
|
|
|
}
|
|
|
|
|
2014-11-15 13:46:40 -07:00
|
|
|
std::vector<std::string> Extensions;
|
2009-06-07 11:22:29 -06:00
|
|
|
|
|
|
|
if (SConfig::GetInstance().m_ListGC)
|
|
|
|
Extensions.push_back("*.gcm");
|
|
|
|
if (SConfig::GetInstance().m_ListWii || SConfig::GetInstance().m_ListGC)
|
|
|
|
{
|
|
|
|
Extensions.push_back("*.iso");
|
2010-12-29 07:42:20 -07:00
|
|
|
Extensions.push_back("*.ciso");
|
2009-06-07 11:22:29 -06:00
|
|
|
Extensions.push_back("*.gcz");
|
2012-05-03 08:09:01 -06:00
|
|
|
Extensions.push_back("*.wbfs");
|
2009-06-07 11:22:29 -06:00
|
|
|
}
|
|
|
|
if (SConfig::GetInstance().m_ListWad)
|
|
|
|
Extensions.push_back("*.wad");
|
2015-08-25 23:13:55 -06:00
|
|
|
if (SConfig::GetInstance().m_ListElfDol)
|
|
|
|
{
|
|
|
|
Extensions.push_back("*.dol");
|
|
|
|
Extensions.push_back("*.elf");
|
|
|
|
}
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2014-11-15 13:46:40 -07:00
|
|
|
auto rFilenames = DoFileSearch(Extensions, SConfig::GetInstance().m_ISOFolder, SConfig::GetInstance().m_RecursiveISOFolder);
|
2008-12-07 22:30:24 -07:00
|
|
|
|
|
|
|
if (rFilenames.size() > 0)
|
|
|
|
{
|
2012-03-24 21:59:20 -06:00
|
|
|
wxProgressDialog dialog(
|
|
|
|
_("Scanning for ISOs"),
|
|
|
|
_("Scanning..."),
|
|
|
|
(int)rFilenames.size() - 1,
|
|
|
|
this,
|
|
|
|
wxPD_APP_MODAL |
|
|
|
|
wxPD_AUTO_HIDE |
|
|
|
|
wxPD_CAN_ABORT |
|
|
|
|
wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME | wxPD_REMAINING_TIME |
|
|
|
|
wxPD_SMOOTH // - makes updates as small as possible (down to 1px)
|
|
|
|
);
|
2008-12-07 22:30:24 -07:00
|
|
|
|
|
|
|
for (u32 i = 0; i < rFilenames.size(); i++)
|
|
|
|
{
|
|
|
|
std::string FileName;
|
2014-03-09 14:14:26 -06:00
|
|
|
SplitPath(rFilenames[i], nullptr, &FileName, nullptr);
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2011-06-03 22:34:44 -06:00
|
|
|
// Update with the progress (i) and the message
|
2012-03-24 21:59:20 -06:00
|
|
|
dialog.Update(i, wxString::Format(_("Scanning %s"),
|
2013-02-28 01:39:06 -07:00
|
|
|
StrToWxStr(FileName)));
|
2012-03-24 21:59:20 -06:00
|
|
|
if (dialog.WasCancelled())
|
2008-12-07 22:30:24 -07:00
|
|
|
break;
|
2011-01-09 07:11:46 -07:00
|
|
|
|
2015-09-13 06:17:58 -06:00
|
|
|
auto iso_file = std::make_unique<GameListItem>(rFilenames[i], custom_title_map);
|
2011-03-22 01:27:23 -06:00
|
|
|
|
2014-05-06 04:35:50 -06:00
|
|
|
if (iso_file->IsValid())
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2009-04-27 20:30:50 -06:00
|
|
|
bool list = true;
|
|
|
|
|
2014-05-06 04:35:50 -06:00
|
|
|
switch(iso_file->GetPlatform())
|
2009-06-06 01:36:22 -06:00
|
|
|
{
|
2015-06-04 08:26:36 -06:00
|
|
|
case DiscIO::IVolume::WII_DISC:
|
2010-07-31 08:14:01 -06:00
|
|
|
if (!SConfig::GetInstance().m_ListWii)
|
|
|
|
list = false;
|
|
|
|
break;
|
2015-06-04 08:26:36 -06:00
|
|
|
case DiscIO::IVolume::WII_WAD:
|
2010-07-31 08:14:01 -06:00
|
|
|
if (!SConfig::GetInstance().m_ListWad)
|
|
|
|
list = false;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (!SConfig::GetInstance().m_ListGC)
|
|
|
|
list = false;
|
|
|
|
break;
|
2009-06-06 01:36:22 -06:00
|
|
|
}
|
2009-04-27 20:30:50 -06:00
|
|
|
|
2014-05-06 04:35:50 -06:00
|
|
|
switch(iso_file->GetCountry())
|
2009-04-27 20:30:50 -06:00
|
|
|
{
|
2014-10-30 08:35:46 -06:00
|
|
|
case DiscIO::IVolume::COUNTRY_AUSTRALIA:
|
|
|
|
if (!SConfig::GetInstance().m_ListAustralia)
|
|
|
|
list = false;
|
|
|
|
break;
|
2015-01-05 22:30:48 -07:00
|
|
|
case DiscIO::IVolume::COUNTRY_EUROPE:
|
|
|
|
if (!SConfig::GetInstance().m_ListPal)
|
2014-10-30 08:35:46 -06:00
|
|
|
list = false;
|
|
|
|
break;
|
2015-01-05 22:30:48 -07:00
|
|
|
case DiscIO::IVolume::COUNTRY_FRANCE:
|
|
|
|
if (!SConfig::GetInstance().m_ListFrance)
|
2014-10-30 08:35:46 -06:00
|
|
|
list = false;
|
|
|
|
break;
|
2015-01-05 22:30:48 -07:00
|
|
|
case DiscIO::IVolume::COUNTRY_GERMANY:
|
|
|
|
if (!SConfig::GetInstance().m_ListGermany)
|
2014-10-30 08:35:46 -06:00
|
|
|
list = false;
|
|
|
|
break;
|
2015-01-05 22:30:48 -07:00
|
|
|
case DiscIO::IVolume::COUNTRY_ITALY:
|
|
|
|
if (!SConfig::GetInstance().m_ListItaly)
|
2010-07-31 08:14:01 -06:00
|
|
|
list = false;
|
|
|
|
break;
|
|
|
|
case DiscIO::IVolume::COUNTRY_JAPAN:
|
|
|
|
if (!SConfig::GetInstance().m_ListJap)
|
|
|
|
list = false;
|
|
|
|
break;
|
2015-01-05 22:30:48 -07:00
|
|
|
case DiscIO::IVolume::COUNTRY_KOREA:
|
|
|
|
if (!SConfig::GetInstance().m_ListKorea)
|
2010-07-31 08:14:01 -06:00
|
|
|
list = false;
|
|
|
|
break;
|
2015-01-05 22:30:48 -07:00
|
|
|
case DiscIO::IVolume::COUNTRY_NETHERLANDS:
|
|
|
|
if (!SConfig::GetInstance().m_ListNetherlands)
|
2010-07-31 08:14:01 -06:00
|
|
|
list = false;
|
|
|
|
break;
|
2015-01-05 22:30:48 -07:00
|
|
|
case DiscIO::IVolume::COUNTRY_RUSSIA:
|
|
|
|
if (!SConfig::GetInstance().m_ListRussia)
|
2010-07-31 08:14:01 -06:00
|
|
|
list = false;
|
|
|
|
break;
|
2014-10-30 08:35:46 -06:00
|
|
|
case DiscIO::IVolume::COUNTRY_SPAIN:
|
|
|
|
if (!SConfig::GetInstance().m_ListSpain)
|
|
|
|
list = false;
|
|
|
|
break;
|
2015-01-05 22:30:48 -07:00
|
|
|
case DiscIO::IVolume::COUNTRY_TAIWAN:
|
|
|
|
if (!SConfig::GetInstance().m_ListTaiwan)
|
|
|
|
list = false;
|
|
|
|
break;
|
|
|
|
case DiscIO::IVolume::COUNTRY_USA:
|
|
|
|
if (!SConfig::GetInstance().m_ListUsa)
|
2014-10-30 08:35:46 -06:00
|
|
|
list = false;
|
|
|
|
break;
|
2015-04-08 16:55:16 -06:00
|
|
|
case DiscIO::IVolume::COUNTRY_WORLD:
|
|
|
|
if (!SConfig::GetInstance().m_ListWorld)
|
|
|
|
list = false;
|
|
|
|
break;
|
2015-01-05 22:30:48 -07:00
|
|
|
case DiscIO::IVolume::COUNTRY_UNKNOWN:
|
2010-07-31 08:14:01 -06:00
|
|
|
default:
|
2015-01-05 22:30:48 -07:00
|
|
|
if (!SConfig::GetInstance().m_ListUnknown)
|
2010-07-31 08:14:01 -06:00
|
|
|
list = false;
|
|
|
|
break;
|
2009-04-27 20:30:50 -06:00
|
|
|
}
|
|
|
|
|
2010-07-31 08:14:01 -06:00
|
|
|
if (list)
|
2011-03-22 22:31:00 -06:00
|
|
|
m_ISOFiles.push_back(iso_file.release());
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-04-27 20:30:50 -06:00
|
|
|
|
|
|
|
if (SConfig::GetInstance().m_ListDrives)
|
|
|
|
{
|
2011-03-22 01:27:23 -06:00
|
|
|
const std::vector<std::string> drives = cdio_get_devices();
|
|
|
|
|
2013-10-28 23:09:01 -06:00
|
|
|
for (const auto& drive : drives)
|
2009-04-27 20:30:50 -06:00
|
|
|
{
|
2015-09-13 06:17:58 -06:00
|
|
|
auto gli = std::make_unique<GameListItem>(drive, custom_title_map);
|
2011-03-22 01:27:23 -06:00
|
|
|
|
|
|
|
if (gli->IsValid())
|
|
|
|
m_ISOFiles.push_back(gli.release());
|
2009-04-27 20:30:50 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-07 22:30:24 -07:00
|
|
|
std::sort(m_ISOFiles.begin(), m_ISOFiles.end());
|
|
|
|
}
|
|
|
|
|
|
|
|
void CGameListCtrl::OnColBeginDrag(wxListEvent& event)
|
|
|
|
{
|
2015-04-20 05:00:15 -06:00
|
|
|
if (event.GetColumn() != COLUMN_TITLE && event.GetColumn() != COLUMN_MAKER)
|
2008-12-07 22:30:24 -07:00
|
|
|
event.Veto();
|
|
|
|
}
|
|
|
|
|
2014-11-13 19:28:27 -07:00
|
|
|
const GameListItem* CGameListCtrl::GetISO(size_t index) const
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2011-03-22 01:27:23 -06:00
|
|
|
if (index < m_ISOFiles.size())
|
|
|
|
return m_ISOFiles[index];
|
|
|
|
else
|
2014-03-09 14:14:26 -06:00
|
|
|
return nullptr;
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
2014-11-13 19:28:27 -07:00
|
|
|
static CGameListCtrl* caller;
|
2014-07-08 06:29:26 -06:00
|
|
|
static int wxCALLBACK wxListCompare(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2010-07-31 08:14:01 -06:00
|
|
|
// return 1 if item1 > item2
|
|
|
|
// return -1 if item1 < item2
|
|
|
|
// return 0 for identity
|
2014-11-13 19:28:27 -07:00
|
|
|
const GameListItem* iso1 = caller->GetISO(item1);
|
|
|
|
const GameListItem* iso2 = caller->GetISO(item2);
|
2010-07-31 08:14:01 -06:00
|
|
|
|
2011-11-01 19:16:49 -06:00
|
|
|
return CompareGameListItems(iso1, iso2, sortData);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void CGameListCtrl::OnColumnClick(wxListEvent& event)
|
|
|
|
{
|
2014-03-10 05:30:55 -06:00
|
|
|
if (event.GetColumn() != COLUMN_BANNER)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
|
|
|
int current_column = event.GetColumn();
|
2012-12-24 11:29:19 -07:00
|
|
|
if (sorted)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2012-12-24 11:29:19 -07:00
|
|
|
if (last_column == current_column)
|
|
|
|
{
|
|
|
|
last_sort = -last_sort;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SConfig::GetInstance().m_ListSort2 = last_sort;
|
|
|
|
last_column = current_column;
|
|
|
|
last_sort = current_column;
|
|
|
|
}
|
|
|
|
SConfig::GetInstance().m_ListSort = last_sort;
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
last_sort = current_column;
|
2012-12-24 11:29:19 -07:00
|
|
|
last_column = current_column;
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
caller = this;
|
|
|
|
SortItems(wxListCompare, last_sort);
|
|
|
|
}
|
|
|
|
|
|
|
|
SetBackgroundColor();
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
2009-09-25 10:29:00 -06:00
|
|
|
// This is used by keyboard gamelist search
|
|
|
|
void CGameListCtrl::OnKeyPress(wxListEvent& event)
|
|
|
|
{
|
|
|
|
static int lastKey = 0, sLoop = 0;
|
|
|
|
int Loop = 0;
|
|
|
|
|
|
|
|
for (int i = 0; i < (int)m_ISOFiles.size(); i++)
|
|
|
|
{
|
|
|
|
// Easy way to get game string
|
|
|
|
wxListItem bleh;
|
|
|
|
bleh.SetId(i);
|
|
|
|
bleh.SetColumn(COLUMN_TITLE);
|
|
|
|
bleh.SetMask(wxLIST_MASK_TEXT);
|
|
|
|
GetItem(bleh);
|
|
|
|
|
|
|
|
wxString text = bleh.GetText();
|
|
|
|
|
2011-02-21 08:01:00 -07:00
|
|
|
if (text.MakeUpper()[0] == event.GetKeyCode())
|
2009-09-25 10:29:00 -06:00
|
|
|
{
|
|
|
|
if (lastKey == event.GetKeyCode() && Loop < sLoop)
|
|
|
|
{
|
|
|
|
Loop++;
|
|
|
|
if (i+1 == (int)m_ISOFiles.size())
|
|
|
|
i = -1;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if (lastKey != event.GetKeyCode())
|
2013-04-07 23:16:50 -06:00
|
|
|
{
|
2009-09-25 10:29:00 -06:00
|
|
|
sLoop = 0;
|
2013-04-07 23:16:50 -06:00
|
|
|
}
|
2009-09-25 10:29:00 -06:00
|
|
|
|
|
|
|
lastKey = event.GetKeyCode();
|
|
|
|
sLoop++;
|
|
|
|
|
|
|
|
UnselectAll();
|
2010-07-31 08:14:01 -06:00
|
|
|
SetItemState(i, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED,
|
|
|
|
wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
|
2009-09-25 10:29:00 -06:00
|
|
|
EnsureVisible(i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-07-31 08:14:01 -06:00
|
|
|
// If we get past the last game in the list,
|
|
|
|
// we'll have to go back to the first one.
|
2009-09-25 10:29:00 -06:00
|
|
|
if (i+1 == (int)m_ISOFiles.size() && sLoop > 0 && Loop > 0)
|
|
|
|
i = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
// This shows a little tooltip with the current Game's emulation state
|
|
|
|
void CGameListCtrl::OnMouseMotion(wxMouseEvent& event)
|
|
|
|
{
|
2010-07-31 08:14:01 -06:00
|
|
|
int flags;
|
|
|
|
long subitem = 0;
|
2011-03-22 22:31:00 -06:00
|
|
|
const long item = HitTest(event.GetPosition(), flags, &subitem);
|
2009-09-25 10:29:00 -06:00
|
|
|
static int lastItem = -1;
|
|
|
|
|
2011-03-07 13:19:20 -07:00
|
|
|
if (GetColumnCount() <= 1)
|
|
|
|
return;
|
|
|
|
|
2010-07-31 08:14:01 -06:00
|
|
|
if (item != wxNOT_FOUND)
|
2009-09-25 10:29:00 -06:00
|
|
|
{
|
2011-02-20 15:56:03 -07:00
|
|
|
wxRect Rect;
|
|
|
|
#ifdef __WXMSW__
|
2009-09-25 10:29:00 -06:00
|
|
|
if (subitem == COLUMN_EMULATION_STATE)
|
2011-02-20 15:56:03 -07:00
|
|
|
#else
|
|
|
|
// The subitem parameter of HitTest is only implemented for wxMSW. On
|
|
|
|
// all other platforms it will always be -1. Check the x position
|
|
|
|
// instead.
|
2011-02-21 08:01:00 -07:00
|
|
|
GetItemRect(item, Rect);
|
2011-02-20 15:56:03 -07:00
|
|
|
if (Rect.GetX() + Rect.GetWidth() - GetColumnWidth(COLUMN_EMULATION_STATE) < event.GetX())
|
2011-02-20 11:03:14 -07:00
|
|
|
#endif
|
2009-09-25 10:29:00 -06:00
|
|
|
{
|
2010-07-31 08:14:01 -06:00
|
|
|
if (toolTip || lastItem == item || this != FindFocus())
|
|
|
|
{
|
2011-02-20 15:56:03 -07:00
|
|
|
if (lastItem != item) lastItem = -1;
|
2009-09-25 10:29:00 -06:00
|
|
|
event.Skip();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-03-22 22:31:00 -06:00
|
|
|
// Emulation status
|
|
|
|
static const char* const emuState[] = { "Broken", "Intro", "In-Game", "Playable", "Perfect" };
|
2009-09-25 10:29:00 -06:00
|
|
|
|
2011-03-22 22:31:00 -06:00
|
|
|
const GameListItem& rISO = *m_ISOFiles[GetItemData(item)];
|
2009-09-25 10:29:00 -06:00
|
|
|
|
2011-03-22 22:31:00 -06:00
|
|
|
const int emu_state = rISO.GetEmuState();
|
2011-12-18 05:58:44 -07:00
|
|
|
const std::string& issues = rISO.GetIssues();
|
|
|
|
|
2009-09-25 10:29:00 -06:00
|
|
|
// Show a tooltip containing the EmuState and the state description
|
2011-03-22 22:31:00 -06:00
|
|
|
if (emu_state > 0 && emu_state < 6)
|
2009-11-11 04:07:04 -07:00
|
|
|
{
|
|
|
|
char temp[2048];
|
2011-12-18 05:58:44 -07:00
|
|
|
sprintf(temp, "^ %s%s%s", emuState[emu_state - 1],
|
|
|
|
issues.size() > 0 ? " :\n" : "", issues.c_str());
|
2013-02-27 21:37:38 -07:00
|
|
|
toolTip = new wxEmuStateTip(this, StrToWxStr(temp), &toolTip);
|
2009-11-11 04:07:04 -07:00
|
|
|
}
|
2009-09-25 10:29:00 -06:00
|
|
|
else
|
2013-04-07 23:16:50 -06:00
|
|
|
{
|
2011-01-04 21:35:46 -07:00
|
|
|
toolTip = new wxEmuStateTip(this, _("Not Set"), &toolTip);
|
2013-04-07 23:16:50 -06:00
|
|
|
}
|
2009-09-25 10:29:00 -06:00
|
|
|
|
2011-02-20 11:03:14 -07:00
|
|
|
// Get item Coords
|
|
|
|
GetItemRect(item, Rect);
|
|
|
|
int mx = Rect.GetWidth();
|
|
|
|
int my = Rect.GetY();
|
2011-02-20 15:56:03 -07:00
|
|
|
#ifndef __WXMSW__
|
2011-02-20 11:03:14 -07:00
|
|
|
// For some reason the y position does not account for the header
|
|
|
|
// row, so subtract the y position of the first visible item.
|
|
|
|
GetItemRect(GetTopItem(), Rect);
|
2011-02-20 15:56:03 -07:00
|
|
|
my -= Rect.GetY();
|
2011-02-20 11:03:14 -07:00
|
|
|
#endif
|
2011-02-20 15:56:03 -07:00
|
|
|
// Convert to screen coordinates
|
|
|
|
ClientToScreen(&mx, &my);
|
|
|
|
toolTip->SetBoundingRect(wxRect(mx - GetColumnWidth(COLUMN_EMULATION_STATE),
|
|
|
|
my, GetColumnWidth(COLUMN_EMULATION_STATE), Rect.GetHeight()));
|
|
|
|
toolTip->SetPosition(wxPoint(mx - GetColumnWidth(COLUMN_EMULATION_STATE),
|
|
|
|
my - 5 + Rect.GetHeight()));
|
2009-09-25 10:29:00 -06:00
|
|
|
lastItem = item;
|
|
|
|
}
|
|
|
|
}
|
2011-02-20 15:56:03 -07:00
|
|
|
if (!toolTip)
|
2011-02-20 11:03:14 -07:00
|
|
|
lastItem = -1;
|
2009-09-25 10:29:00 -06:00
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
2010-01-19 06:43:51 -07:00
|
|
|
void CGameListCtrl::OnLeftClick(wxMouseEvent& event)
|
|
|
|
{
|
|
|
|
// Focus the clicked item.
|
|
|
|
int flags;
|
2010-07-31 08:14:01 -06:00
|
|
|
long item = HitTest(event.GetPosition(), flags);
|
|
|
|
if ((item != wxNOT_FOUND) && (GetSelectedItemCount() == 0) &&
|
|
|
|
(!event.ControlDown()) && (!event.ShiftDown()))
|
2010-01-19 06:43:51 -07:00
|
|
|
{
|
2010-01-22 14:41:25 -07:00
|
|
|
SetItemState(item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
|
2010-01-19 06:43:51 -07:00
|
|
|
SetItemState(item, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);
|
2010-01-22 14:41:25 -07:00
|
|
|
wxGetApp().GetCFrame()->UpdateGUI();
|
2010-01-19 06:43:51 -07:00
|
|
|
}
|
2010-07-31 08:14:01 -06:00
|
|
|
|
2010-01-22 14:41:25 -07:00
|
|
|
event.Skip();
|
2010-01-19 06:43:51 -07:00
|
|
|
}
|
|
|
|
|
2008-12-07 22:30:24 -07:00
|
|
|
void CGameListCtrl::OnRightClick(wxMouseEvent& event)
|
2013-10-28 23:23:17 -06:00
|
|
|
{
|
2008-12-07 22:30:24 -07:00
|
|
|
// Focus the clicked item.
|
|
|
|
int flags;
|
2010-07-31 08:14:01 -06:00
|
|
|
long item = HitTest(event.GetPosition(), flags);
|
|
|
|
if (item != wxNOT_FOUND)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
|
|
|
if (GetItemState(item, wxLIST_STATE_SELECTED) != wxLIST_STATE_SELECTED)
|
|
|
|
{
|
|
|
|
UnselectAll();
|
|
|
|
SetItemState(item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
|
|
|
|
}
|
|
|
|
SetItemState(item, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);
|
|
|
|
}
|
|
|
|
if (GetSelectedItemCount() == 1)
|
|
|
|
{
|
2014-11-13 19:28:27 -07:00
|
|
|
const GameListItem* selected_iso = GetSelectedISO();
|
2008-12-07 22:30:24 -07:00
|
|
|
if (selected_iso)
|
|
|
|
{
|
2014-11-11 07:50:11 -07:00
|
|
|
wxMenu popupMenu;
|
2015-09-06 04:34:48 -06:00
|
|
|
DiscIO::IVolume::EPlatform platform = selected_iso->GetPlatform();
|
2009-06-06 20:27:36 -06:00
|
|
|
|
2015-09-06 04:34:48 -06:00
|
|
|
if (platform != DiscIO::IVolume::ELF_DOL)
|
2015-08-25 23:13:55 -06:00
|
|
|
{
|
|
|
|
popupMenu.Append(IDM_PROPERTIES, _("&Properties"));
|
|
|
|
popupMenu.Append(IDM_GAME_WIKI, _("&Wiki"));
|
|
|
|
popupMenu.AppendSeparator();
|
|
|
|
}
|
2015-09-06 04:34:48 -06:00
|
|
|
if (platform == DiscIO::IVolume::WII_DISC || platform == DiscIO::IVolume::WII_WAD)
|
2010-01-14 00:19:10 -07:00
|
|
|
{
|
2014-12-20 18:36:26 -07:00
|
|
|
popupMenu.Append(IDM_OPEN_SAVE_FOLDER, _("Open Wii &save folder"));
|
|
|
|
popupMenu.Append(IDM_EXPORT_SAVE, _("Export Wii save (Experimental)"));
|
2010-01-14 00:19:10 -07:00
|
|
|
}
|
2014-12-20 18:36:26 -07:00
|
|
|
popupMenu.Append(IDM_OPEN_CONTAINING_FOLDER, _("Open &containing folder"));
|
2015-08-25 23:13:55 -06:00
|
|
|
|
2015-09-06 04:34:48 -06:00
|
|
|
if (platform != DiscIO::IVolume::ELF_DOL)
|
2015-08-25 23:13:55 -06:00
|
|
|
popupMenu.AppendCheckItem(IDM_SET_DEFAULT_ISO, _("Set as &default ISO"));
|
2010-07-31 08:14:01 -06:00
|
|
|
|
2008-12-08 22:37:15 -07:00
|
|
|
// First we have to decide a starting value when we append it
|
2015-09-06 04:34:48 -06:00
|
|
|
if (platform == SConfig::GetInstance().m_strDefaultISO)
|
2014-12-20 18:36:26 -07:00
|
|
|
popupMenu.FindItem(IDM_SET_DEFAULT_ISO)->Check();
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2014-11-11 07:50:11 -07:00
|
|
|
popupMenu.AppendSeparator();
|
2015-08-25 23:13:55 -06:00
|
|
|
popupMenu.Append(IDM_DELETE_ISO, _("&Delete File..."));
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2015-09-06 04:34:48 -06:00
|
|
|
if (platform == DiscIO::IVolume::GAMECUBE_DISC || platform == DiscIO::IVolume::WII_DISC)
|
2009-06-06 20:27:36 -06:00
|
|
|
{
|
|
|
|
if (selected_iso->IsCompressed())
|
2014-12-20 18:36:26 -07:00
|
|
|
popupMenu.Append(IDM_COMPRESS_ISO, _("Decompress ISO..."));
|
2014-03-10 05:30:55 -06:00
|
|
|
else if (selected_iso->GetFileName().substr(selected_iso->GetFileName().find_last_of(".")) != ".ciso" &&
|
|
|
|
selected_iso->GetFileName().substr(selected_iso->GetFileName().find_last_of(".")) != ".wbfs")
|
2014-12-20 18:36:26 -07:00
|
|
|
popupMenu.Append(IDM_COMPRESS_ISO, _("Compress ISO..."));
|
2015-09-06 04:38:07 -06:00
|
|
|
|
2014-12-20 18:36:26 -07:00
|
|
|
wxMenuItem* changeDiscItem = popupMenu.Append(IDM_LIST_CHANGE_DISC, _("Change &Disc"));
|
2014-06-23 22:07:46 -06:00
|
|
|
changeDiscItem->Enable(Core::IsRunning());
|
|
|
|
}
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2015-09-06 04:38:07 -06:00
|
|
|
if (platform == DiscIO::IVolume::WII_WAD)
|
|
|
|
popupMenu.Append(IDM_LIST_INSTALL_WAD, _("Install to Wii Menu"));
|
|
|
|
|
2014-11-11 07:50:11 -07:00
|
|
|
PopupMenu(&popupMenu);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (GetSelectedItemCount() > 1)
|
|
|
|
{
|
2014-11-11 07:50:11 -07:00
|
|
|
wxMenu popupMenu;
|
2014-12-20 18:36:26 -07:00
|
|
|
popupMenu.Append(IDM_DELETE_ISO, _("&Delete selected ISOs..."));
|
2014-11-11 07:50:11 -07:00
|
|
|
popupMenu.AppendSeparator();
|
2014-12-20 18:36:26 -07:00
|
|
|
popupMenu.Append(IDM_MULTI_COMPRESS_ISO, _("Compress selected ISOs..."));
|
|
|
|
popupMenu.Append(IDM_MULTI_DECOMPRESS_ISO, _("Decompress selected ISOs..."));
|
2014-11-11 07:50:11 -07:00
|
|
|
PopupMenu(&popupMenu);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const GameListItem * CGameListCtrl::GetSelectedISO()
|
|
|
|
{
|
2009-01-18 18:30:54 -07:00
|
|
|
if (m_ISOFiles.size() == 0)
|
2013-04-07 23:16:50 -06:00
|
|
|
{
|
2014-03-09 14:14:26 -06:00
|
|
|
return nullptr;
|
2013-04-07 23:16:50 -06:00
|
|
|
}
|
2010-01-18 05:10:51 -07:00
|
|
|
else if (GetSelectedItemCount() == 0)
|
2013-04-07 23:16:50 -06:00
|
|
|
{
|
2014-03-09 14:14:26 -06:00
|
|
|
return nullptr;
|
2013-04-07 23:16:50 -06:00
|
|
|
}
|
2008-12-07 22:30:24 -07:00
|
|
|
else
|
|
|
|
{
|
2010-07-31 08:14:01 -06:00
|
|
|
long item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
2009-06-30 22:55:53 -06:00
|
|
|
if (item == wxNOT_FOUND)
|
2013-04-07 23:16:50 -06:00
|
|
|
{
|
2014-03-09 14:14:26 -06:00
|
|
|
return nullptr;
|
2013-04-07 23:16:50 -06:00
|
|
|
}
|
2009-01-18 18:30:54 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// Here is a little workaround for multiselections:
|
|
|
|
// when > 1 item is selected, return info on the first one
|
|
|
|
// and deselect it so the next time GetSelectedISO() is called,
|
|
|
|
// the next item's info is returned
|
|
|
|
if (GetSelectedItemCount() > 1)
|
|
|
|
SetItemState(item, 0, wxLIST_STATE_SELECTED);
|
|
|
|
|
2011-03-22 01:27:23 -06:00
|
|
|
return m_ISOFiles[GetItemData(item)];
|
2009-01-18 18:30:54 -07:00
|
|
|
}
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-31 08:14:01 -06:00
|
|
|
void CGameListCtrl::OnOpenContainingFolder(wxCommandEvent& WXUNUSED (event))
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2014-11-13 19:28:27 -07:00
|
|
|
const GameListItem* iso = GetSelectedISO();
|
2008-12-07 22:30:24 -07:00
|
|
|
if (!iso)
|
|
|
|
return;
|
2013-01-11 09:24:52 -07:00
|
|
|
|
2013-03-03 01:30:45 -07:00
|
|
|
wxFileName path = wxFileName::FileName(StrToWxStr(iso->GetFileName()));
|
2013-01-11 09:24:52 -07:00
|
|
|
path.MakeAbsolute();
|
2014-03-12 13:33:41 -06:00
|
|
|
WxUtils::Explore(WxStrToStr(path.GetPath()));
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
2010-07-31 08:14:01 -06:00
|
|
|
void CGameListCtrl::OnOpenSaveFolder(wxCommandEvent& WXUNUSED (event))
|
2009-05-02 12:06:42 -06:00
|
|
|
{
|
2014-11-13 19:28:27 -07:00
|
|
|
const GameListItem* iso = GetSelectedISO();
|
2009-05-02 12:06:42 -06:00
|
|
|
if (!iso)
|
|
|
|
return;
|
2011-01-06 06:57:46 -07:00
|
|
|
std::string path = iso->GetWiiFSPath();
|
|
|
|
if (!path.empty())
|
2014-03-12 13:33:41 -06:00
|
|
|
WxUtils::Explore(path);
|
2009-05-02 12:06:42 -06:00
|
|
|
}
|
|
|
|
|
2010-01-14 00:19:10 -07:00
|
|
|
void CGameListCtrl::OnExportSave(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
2015-02-15 12:43:31 -07:00
|
|
|
const GameListItem* iso = GetSelectedISO();
|
2010-01-14 00:19:10 -07:00
|
|
|
if (!iso)
|
|
|
|
return;
|
2014-09-20 10:57:53 -06:00
|
|
|
|
2015-09-22 11:25:54 -06:00
|
|
|
u64 title_id;
|
2014-09-20 10:57:53 -06:00
|
|
|
std::unique_ptr<DiscIO::IVolume> volume(DiscIO::CreateVolumeFromFilename(iso->GetFileName()));
|
2015-09-22 11:25:54 -06:00
|
|
|
if (volume && volume->GetTitleID(&title_id))
|
2010-01-14 00:19:10 -07:00
|
|
|
{
|
2015-09-22 11:25:54 -06:00
|
|
|
CWiiSaveCrypted::ExportWiiSave(title_id);
|
2010-01-14 00:19:10 -07:00
|
|
|
}
|
|
|
|
}
|
2008-12-07 22:30:24 -07:00
|
|
|
|
|
|
|
// Save this file as the default file
|
2014-09-28 17:05:27 -06:00
|
|
|
void CGameListCtrl::OnSetDefaultISO(wxCommandEvent& event)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2014-11-13 19:28:27 -07:00
|
|
|
const GameListItem* iso = GetSelectedISO();
|
2008-12-07 22:30:24 -07:00
|
|
|
if (!iso) return;
|
2010-07-31 08:14:01 -06:00
|
|
|
|
|
|
|
if (event.IsChecked())
|
2008-12-08 22:37:15 -07:00
|
|
|
{
|
2010-07-31 08:14:01 -06:00
|
|
|
// Write the new default value and save it the ini file
|
2015-06-12 05:56:53 -06:00
|
|
|
SConfig::GetInstance().m_strDefaultISO =
|
2010-07-31 08:14:01 -06:00
|
|
|
iso->GetFileName();
|
2008-12-08 22:37:15 -07:00
|
|
|
SConfig::GetInstance().SaveSettings();
|
|
|
|
}
|
2010-07-31 08:14:01 -06:00
|
|
|
else
|
2008-12-08 22:37:15 -07:00
|
|
|
{
|
2013-04-19 07:21:45 -06:00
|
|
|
// Otherwise blank the value and save it
|
2015-06-12 05:56:53 -06:00
|
|
|
SConfig::GetInstance().m_strDefaultISO = "";
|
2008-12-08 22:37:15 -07:00
|
|
|
SConfig::GetInstance().SaveSettings();
|
|
|
|
}
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
2014-09-28 17:05:27 -06:00
|
|
|
void CGameListCtrl::OnDeleteISO(wxCommandEvent& WXUNUSED (event))
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
|
|
|
if (GetSelectedItemCount() == 1)
|
|
|
|
{
|
2014-11-13 19:28:27 -07:00
|
|
|
const GameListItem* iso = GetSelectedISO();
|
2008-12-07 22:30:24 -07:00
|
|
|
if (!iso)
|
|
|
|
return;
|
2011-01-05 10:56:08 -07:00
|
|
|
if (wxMessageBox(_("Are you sure you want to delete this file? It will be gone forever!"),
|
2010-07-31 08:14:01 -06:00
|
|
|
wxMessageBoxCaptionStr, wxYES_NO | wxICON_EXCLAMATION) == wxYES)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2011-02-28 20:06:14 -07:00
|
|
|
File::Delete(iso->GetFileName());
|
2008-12-07 22:30:24 -07:00
|
|
|
Update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-01-05 10:56:08 -07:00
|
|
|
if (wxMessageBox(_("Are you sure you want to delete these files?\nThey will be gone forever!"),
|
2010-07-31 08:14:01 -06:00
|
|
|
wxMessageBoxCaptionStr, wxYES_NO | wxICON_EXCLAMATION) == wxYES)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
|
|
|
int selected = GetSelectedItemCount();
|
|
|
|
|
|
|
|
for (int i = 0; i < selected; i++)
|
|
|
|
{
|
2014-11-13 19:28:27 -07:00
|
|
|
const GameListItem* iso = GetSelectedISO();
|
2011-02-28 20:06:14 -07:00
|
|
|
File::Delete(iso->GetFileName());
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
Update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-31 08:14:01 -06:00
|
|
|
void CGameListCtrl::OnProperties(wxCommandEvent& WXUNUSED (event))
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2014-11-13 19:28:27 -07:00
|
|
|
const GameListItem* iso = GetSelectedISO();
|
2008-12-07 22:30:24 -07:00
|
|
|
if (!iso)
|
|
|
|
return;
|
2013-04-07 23:16:50 -06:00
|
|
|
|
2015-09-13 06:17:58 -06:00
|
|
|
CISOProperties* ISOProperties = new CISOProperties(*iso, this);
|
2015-02-24 16:32:17 -07:00
|
|
|
ISOProperties->Show();
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
2011-02-25 16:33:11 -07:00
|
|
|
void CGameListCtrl::OnWiki(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
2014-11-13 19:28:27 -07:00
|
|
|
const GameListItem* iso = GetSelectedISO();
|
2011-02-25 16:33:11 -07:00
|
|
|
if (!iso)
|
|
|
|
return;
|
|
|
|
|
2014-11-24 23:06:41 -07:00
|
|
|
std::string wikiUrl = "https://wiki.dolphin-emu.org/dolphin-redirect.php?gameid=" + iso->GetUniqueID();
|
2014-03-12 13:33:41 -06:00
|
|
|
WxUtils::Launch(wikiUrl);
|
2011-02-25 16:33:11 -07:00
|
|
|
}
|
|
|
|
|
2014-11-27 08:53:28 -07:00
|
|
|
bool CGameListCtrl::MultiCompressCB(const std::string& text, float percent, void* arg)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2009-11-18 14:11:05 -07:00
|
|
|
percent = (((float)m_currentItem) + percent) / (float)m_numberItem;
|
2013-02-27 21:37:38 -07:00
|
|
|
wxString textString(StrToWxStr(StringFromFormat("%s (%i/%i) - %s",
|
2015-02-15 12:43:31 -07:00
|
|
|
m_currentFilename.c_str(), (int)m_currentItem + 1,
|
2014-06-02 23:08:54 -06:00
|
|
|
(int)m_numberItem, text.c_str())));
|
2009-11-18 14:11:05 -07:00
|
|
|
|
2015-02-15 12:43:31 -07:00
|
|
|
return ((wxProgressDialog*)arg)->Update((int)(percent * 1000), textString);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
2014-09-28 17:05:27 -06:00
|
|
|
void CGameListCtrl::OnMultiCompressISO(wxCommandEvent& /*event*/)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
|
|
|
CompressSelection(true);
|
|
|
|
}
|
|
|
|
|
2014-09-28 17:05:27 -06:00
|
|
|
void CGameListCtrl::OnMultiDecompressISO(wxCommandEvent& /*event*/)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
|
|
|
CompressSelection(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CGameListCtrl::CompressSelection(bool _compress)
|
|
|
|
{
|
|
|
|
wxString dirHome;
|
|
|
|
wxGetHomeDir(&dirHome);
|
|
|
|
|
2010-07-31 08:14:01 -06:00
|
|
|
wxDirDialog browseDialog(this, _("Browse for output directory"), dirHome,
|
|
|
|
wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
|
2008-12-07 22:30:24 -07:00
|
|
|
if (browseDialog.ShowModal() != wxID_OK)
|
|
|
|
return;
|
|
|
|
|
2013-01-09 18:59:31 -07:00
|
|
|
bool all_good = true;
|
|
|
|
|
|
|
|
{
|
2014-11-13 19:28:27 -07:00
|
|
|
wxProgressDialog progressDialog(
|
|
|
|
_compress ? _("Compressing ISO") : _("Decompressing ISO"),
|
|
|
|
_("Working..."),
|
|
|
|
1000,
|
|
|
|
this,
|
|
|
|
wxPD_APP_MODAL |
|
2014-11-27 08:53:28 -07:00
|
|
|
wxPD_CAN_ABORT |
|
2014-11-13 19:28:27 -07:00
|
|
|
wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME | wxPD_REMAINING_TIME |
|
|
|
|
wxPD_SMOOTH
|
|
|
|
);
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2014-11-13 19:28:27 -07:00
|
|
|
m_currentItem = 0;
|
|
|
|
m_numberItem = GetSelectedItemCount();
|
2015-02-15 12:43:31 -07:00
|
|
|
for (u32 i = 0; i < m_numberItem; i++)
|
2014-11-13 19:28:27 -07:00
|
|
|
{
|
|
|
|
const GameListItem* iso = GetSelectedISO();
|
2015-06-04 08:26:36 -06:00
|
|
|
if (iso->GetPlatform() == DiscIO::IVolume::WII_WAD || iso->GetFileName().rfind(".wbfs") != std::string::npos)
|
2014-11-13 19:28:27 -07:00
|
|
|
continue;
|
2008-12-07 22:30:24 -07:00
|
|
|
|
|
|
|
if (!iso->IsCompressed() && _compress)
|
|
|
|
{
|
2010-07-31 22:09:59 -06:00
|
|
|
std::string FileName, FileExt;
|
2014-03-09 14:14:26 -06:00
|
|
|
SplitPath(iso->GetFileName(), nullptr, &FileName, &FileExt);
|
2008-12-07 22:30:24 -07:00
|
|
|
m_currentFilename = FileName;
|
|
|
|
FileName.append(".gcz");
|
|
|
|
|
|
|
|
std::string OutputFileName;
|
2010-07-31 08:14:01 -06:00
|
|
|
BuildCompleteFilename(OutputFileName,
|
2013-02-27 21:37:38 -07:00
|
|
|
WxStrToStr(browseDialog.GetPath()),
|
2010-07-31 08:14:01 -06:00
|
|
|
FileName);
|
|
|
|
|
2014-10-10 09:20:10 -06:00
|
|
|
if (File::Exists(OutputFileName) &&
|
2010-07-31 22:09:59 -06:00
|
|
|
wxMessageBox(
|
2011-01-25 21:11:20 -07:00
|
|
|
wxString::Format(_("The file %s already exists.\nDo you wish to replace it?"),
|
2013-10-28 23:23:17 -06:00
|
|
|
StrToWxStr(OutputFileName)),
|
2010-07-31 22:09:59 -06:00
|
|
|
_("Confirm File Overwrite"),
|
|
|
|
wxYES_NO) == wxNO)
|
|
|
|
continue;
|
|
|
|
|
2014-03-12 13:33:41 -06:00
|
|
|
all_good &= DiscIO::CompressFileToBlob(iso->GetFileName(),
|
|
|
|
OutputFileName,
|
2015-06-04 08:26:36 -06:00
|
|
|
(iso->GetPlatform() == DiscIO::IVolume::WII_DISC) ? 1 : 0,
|
2010-07-31 08:14:01 -06:00
|
|
|
16384, &MultiCompressCB, &progressDialog);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
else if (iso->IsCompressed() && !_compress)
|
|
|
|
{
|
2010-07-31 22:09:59 -06:00
|
|
|
std::string FileName, FileExt;
|
2014-03-09 14:14:26 -06:00
|
|
|
SplitPath(iso->GetFileName(), nullptr, &FileName, &FileExt);
|
2008-12-07 22:30:24 -07:00
|
|
|
m_currentFilename = FileName;
|
2015-06-04 08:26:36 -06:00
|
|
|
if (iso->GetPlatform() == DiscIO::IVolume::WII_DISC)
|
2010-05-27 23:30:03 -06:00
|
|
|
FileName.append(".iso");
|
|
|
|
else
|
|
|
|
FileName.append(".gcm");
|
2008-12-07 22:30:24 -07:00
|
|
|
|
|
|
|
std::string OutputFileName;
|
2010-07-31 08:14:01 -06:00
|
|
|
BuildCompleteFilename(OutputFileName,
|
2013-02-27 21:37:38 -07:00
|
|
|
WxStrToStr(browseDialog.GetPath()),
|
2010-07-31 08:14:01 -06:00
|
|
|
FileName);
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2014-10-10 09:20:10 -06:00
|
|
|
if (File::Exists(OutputFileName) &&
|
2010-07-31 22:09:59 -06:00
|
|
|
wxMessageBox(
|
2011-01-25 21:11:20 -07:00
|
|
|
wxString::Format(_("The file %s already exists.\nDo you wish to replace it?"),
|
2013-10-28 23:23:17 -06:00
|
|
|
StrToWxStr(OutputFileName)),
|
2010-07-31 22:09:59 -06:00
|
|
|
_("Confirm File Overwrite"),
|
|
|
|
wxYES_NO) == wxNO)
|
|
|
|
continue;
|
|
|
|
|
2013-01-09 18:59:31 -07:00
|
|
|
all_good &= DiscIO::DecompressBlobToFile(iso->GetFileName().c_str(),
|
2010-07-31 08:14:01 -06:00
|
|
|
OutputFileName.c_str(), &MultiCompressCB, &progressDialog);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
m_currentItem++;
|
2014-11-13 19:28:27 -07:00
|
|
|
}
|
2013-01-09 18:59:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!all_good)
|
2014-07-24 19:46:46 -06:00
|
|
|
WxUtils::ShowErrorDialog(_("Dolphin was unable to complete the requested action."));
|
2013-01-09 18:59:31 -07:00
|
|
|
|
2008-12-07 22:30:24 -07:00
|
|
|
Update();
|
|
|
|
}
|
|
|
|
|
2014-11-27 08:53:28 -07:00
|
|
|
bool CGameListCtrl::CompressCB(const std::string& text, float percent, void* arg)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2014-11-27 08:53:28 -07:00
|
|
|
return ((wxProgressDialog*)arg)->
|
2015-02-15 12:43:31 -07:00
|
|
|
Update((int)(percent * 1000), StrToWxStr(text));
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
2014-09-28 17:05:27 -06:00
|
|
|
void CGameListCtrl::OnCompressISO(wxCommandEvent& WXUNUSED (event))
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2014-11-13 19:28:27 -07:00
|
|
|
const GameListItem* iso = GetSelectedISO();
|
2008-12-07 22:30:24 -07:00
|
|
|
if (!iso)
|
|
|
|
return;
|
|
|
|
|
2010-07-31 22:09:59 -06:00
|
|
|
wxString path;
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2010-07-31 22:09:59 -06:00
|
|
|
std::string FileName, FilePath, FileExtension;
|
|
|
|
SplitPath(iso->GetFileName(), &FilePath, &FileName, &FileExtension);
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2010-07-31 22:09:59 -06:00
|
|
|
do
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2010-07-31 22:09:59 -06:00
|
|
|
if (iso->IsCompressed())
|
|
|
|
{
|
2010-08-01 19:52:00 -06:00
|
|
|
wxString FileType;
|
2015-06-04 08:26:36 -06:00
|
|
|
if (iso->GetPlatform() == DiscIO::IVolume::WII_DISC)
|
2014-05-17 11:17:28 -06:00
|
|
|
FileType = _("All Wii ISO files (iso)") + "|*.iso";
|
2010-07-31 22:09:59 -06:00
|
|
|
else
|
2014-06-06 20:30:39 -06:00
|
|
|
FileType = _("All GameCube GCM files (gcm)") + "|*.gcm";
|
2010-07-31 22:09:59 -06:00
|
|
|
|
|
|
|
path = wxFileSelector(
|
2011-01-04 21:35:46 -07:00
|
|
|
_("Save decompressed GCM/ISO"),
|
2013-02-27 21:37:38 -07:00
|
|
|
StrToWxStr(FilePath),
|
|
|
|
StrToWxStr(FileName) + FileType.After('*'),
|
2010-07-31 22:09:59 -06:00
|
|
|
wxEmptyString,
|
2014-05-17 11:17:28 -06:00
|
|
|
FileType + "|" + wxGetTranslation(wxALL_FILES),
|
2010-07-31 22:09:59 -06:00
|
|
|
wxFD_SAVE,
|
|
|
|
this);
|
|
|
|
}
|
2010-05-27 23:30:03 -06:00
|
|
|
else
|
2010-07-31 22:09:59 -06:00
|
|
|
{
|
|
|
|
path = wxFileSelector(
|
2011-01-04 21:35:46 -07:00
|
|
|
_("Save compressed GCM/ISO"),
|
2013-02-27 21:37:38 -07:00
|
|
|
StrToWxStr(FilePath),
|
2014-05-17 11:17:28 -06:00
|
|
|
StrToWxStr(FileName) + ".gcz",
|
2010-07-31 22:09:59 -06:00
|
|
|
wxEmptyString,
|
2013-10-28 23:23:17 -06:00
|
|
|
_("All compressed GC/Wii ISO files (gcz)") +
|
2014-05-17 11:17:28 -06:00
|
|
|
wxString::Format("|*.gcz|%s", wxGetTranslation(wxALL_FILES)),
|
2010-07-31 22:09:59 -06:00
|
|
|
wxFD_SAVE,
|
|
|
|
this);
|
|
|
|
}
|
2008-12-07 22:30:24 -07:00
|
|
|
if (!path)
|
|
|
|
return;
|
2010-07-31 22:09:59 -06:00
|
|
|
} while (wxFileExists(path) &&
|
|
|
|
wxMessageBox(
|
2013-10-28 23:23:17 -06:00
|
|
|
wxString::Format(_("The file %s already exists.\nDo you wish to replace it?"), path.c_str()),
|
2010-07-31 22:09:59 -06:00
|
|
|
_("Confirm File Overwrite"),
|
|
|
|
wxYES_NO) == wxNO);
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2013-01-09 18:59:31 -07:00
|
|
|
bool all_good = false;
|
|
|
|
|
|
|
|
{
|
2012-03-24 21:59:20 -06:00
|
|
|
wxProgressDialog dialog(
|
|
|
|
iso->IsCompressed() ? _("Decompressing ISO") : _("Compressing ISO"),
|
|
|
|
_("Working..."),
|
|
|
|
1000,
|
|
|
|
this,
|
|
|
|
wxPD_APP_MODAL |
|
2014-11-27 08:53:28 -07:00
|
|
|
wxPD_CAN_ABORT |
|
2012-03-24 21:59:20 -06:00
|
|
|
wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME | wxPD_REMAINING_TIME |
|
|
|
|
wxPD_SMOOTH
|
|
|
|
);
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2013-01-09 18:59:31 -07:00
|
|
|
|
2008-12-07 22:30:24 -07:00
|
|
|
if (iso->IsCompressed())
|
2014-03-12 13:33:41 -06:00
|
|
|
all_good = DiscIO::DecompressBlobToFile(iso->GetFileName(),
|
|
|
|
WxStrToStr(path), &CompressCB, &dialog);
|
2008-12-07 22:30:24 -07:00
|
|
|
else
|
2014-03-12 13:33:41 -06:00
|
|
|
all_good = DiscIO::CompressFileToBlob(iso->GetFileName(),
|
|
|
|
WxStrToStr(path),
|
2015-06-04 08:26:36 -06:00
|
|
|
(iso->GetPlatform() == DiscIO::IVolume::WII_DISC) ? 1 : 0,
|
2010-07-31 08:14:01 -06:00
|
|
|
16384, &CompressCB, &dialog);
|
2013-01-09 18:59:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!all_good)
|
2014-07-24 19:46:46 -06:00
|
|
|
WxUtils::ShowErrorDialog(_("Dolphin was unable to complete the requested action."));
|
2008-12-07 22:30:24 -07:00
|
|
|
|
|
|
|
Update();
|
|
|
|
}
|
|
|
|
|
2014-06-23 22:07:46 -06:00
|
|
|
void CGameListCtrl::OnChangeDisc(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
2014-11-13 19:28:27 -07:00
|
|
|
const GameListItem* iso = GetSelectedISO();
|
2014-06-23 22:07:46 -06:00
|
|
|
if (!iso || !Core::IsRunning())
|
|
|
|
return;
|
|
|
|
DVDInterface::ChangeDisc(WxStrToStr(iso->GetFileName()));
|
|
|
|
}
|
|
|
|
|
2008-12-07 22:30:24 -07:00
|
|
|
void CGameListCtrl::OnSize(wxSizeEvent& event)
|
|
|
|
{
|
2013-04-07 23:16:50 -06:00
|
|
|
if (lastpos == event.GetSize())
|
|
|
|
return;
|
|
|
|
|
2009-07-26 22:26:56 -06:00
|
|
|
lastpos = event.GetSize();
|
2008-12-07 22:30:24 -07:00
|
|
|
AutomaticColumnWidth();
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CGameListCtrl::AutomaticColumnWidth()
|
|
|
|
{
|
2010-07-31 08:14:01 -06:00
|
|
|
wxRect rc(GetClientRect());
|
2008-12-07 22:30:24 -07:00
|
|
|
|
|
|
|
if (GetColumnCount() == 1)
|
2013-04-07 23:16:50 -06:00
|
|
|
{
|
2008-12-07 22:30:24 -07:00
|
|
|
SetColumnWidth(0, rc.GetWidth());
|
2013-04-07 23:16:50 -06:00
|
|
|
}
|
2014-06-20 05:40:04 -06:00
|
|
|
else if (GetColumnCount() > 0)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2009-03-18 11:17:58 -06:00
|
|
|
int resizable = rc.GetWidth() - (
|
2014-06-04 07:54:48 -06:00
|
|
|
GetColumnWidth(COLUMN_PLATFORM)
|
|
|
|
+ GetColumnWidth(COLUMN_BANNER)
|
|
|
|
+ GetColumnWidth(COLUMN_ID)
|
2009-03-18 11:17:58 -06:00
|
|
|
+ GetColumnWidth(COLUMN_COUNTRY)
|
|
|
|
+ GetColumnWidth(COLUMN_SIZE)
|
2014-06-04 07:54:48 -06:00
|
|
|
+ GetColumnWidth(COLUMN_EMULATION_STATE));
|
2009-09-25 10:29:00 -06:00
|
|
|
|
2015-04-20 05:00:15 -06:00
|
|
|
// We hide the Maker column if the window is too small
|
2010-07-31 08:14:01 -06:00
|
|
|
if (resizable > 400)
|
2009-09-25 10:29:00 -06:00
|
|
|
{
|
2015-04-20 05:00:15 -06:00
|
|
|
if (SConfig::GetInstance().m_showMakerColumn)
|
2014-06-04 07:54:48 -06:00
|
|
|
{
|
|
|
|
SetColumnWidth(COLUMN_TITLE, resizable / 2);
|
2015-04-20 05:00:15 -06:00
|
|
|
SetColumnWidth(COLUMN_MAKER, resizable / 2);
|
2014-06-04 07:54:48 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetColumnWidth(COLUMN_TITLE, resizable);
|
|
|
|
}
|
2009-09-25 10:29:00 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetColumnWidth(COLUMN_TITLE, resizable);
|
2015-04-20 05:00:15 -06:00
|
|
|
SetColumnWidth(COLUMN_MAKER, 0);
|
2009-09-25 10:29:00 -06:00
|
|
|
}
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CGameListCtrl::UnselectAll()
|
|
|
|
{
|
2015-02-15 12:43:31 -07:00
|
|
|
for (int i = 0; i < GetItemCount(); i++)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
|
|
|
SetItemState(i, 0, wxLIST_STATE_SELECTED);
|
|
|
|
}
|
|
|
|
}
|