Implemented .elf and .dol support in gamelist

Fixed a TON of structuring, formatting.

removed README.txt files from themes at MaJoR's request

Added platform icon for ELFs/DOLs
This commit is contained in:
Anthony Serna 2015-08-25 22:13:55 -07:00
parent d96be9250c
commit faedf1bc5c
18 changed files with 67 additions and 23 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

View File

@ -1,3 +0,0 @@
By Michael "MaJoR" Roesch of the Dolphin team
dolphin-emu.org

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

View File

@ -1,3 +0,0 @@
By Michael "MaJoR" Roesch of the Dolphin team
dolphin-emu.org

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

View File

@ -1,3 +0,0 @@
By Michael "MaJoR" Roesch of the Dolphin team
dolphin-emu.org

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

View File

@ -1,3 +0,0 @@
By Michael "MaJoR" Roesch of the Dolphin team
dolphin-emu.org

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

View File

@ -185,6 +185,7 @@ void SConfig::SaveGameListSettings(IniFile& ini)
gamelist->Set("ListDrives", m_ListDrives); gamelist->Set("ListDrives", m_ListDrives);
gamelist->Set("ListWad", m_ListWad); gamelist->Set("ListWad", m_ListWad);
gamelist->Set("ListElfDol", m_ListElfDol);
gamelist->Set("ListWii", m_ListWii); gamelist->Set("ListWii", m_ListWii);
gamelist->Set("ListGC", m_ListGC); gamelist->Set("ListGC", m_ListGC);
gamelist->Set("ListJap", m_ListJap); gamelist->Set("ListJap", m_ListJap);
@ -430,6 +431,7 @@ void SConfig::LoadGameListSettings(IniFile& ini)
gamelist->Get("ListDrives", &m_ListDrives, false); gamelist->Get("ListDrives", &m_ListDrives, false);
gamelist->Get("ListWad", &m_ListWad, true); gamelist->Get("ListWad", &m_ListWad, true);
gamelist->Get("ListElfDol", &m_ListElfDol, true);
gamelist->Get("ListWii", &m_ListWii, true); gamelist->Get("ListWii", &m_ListWii, true);
gamelist->Get("ListGC", &m_ListGC, true); gamelist->Get("ListGC", &m_ListGC, true);
gamelist->Get("ListJap", &m_ListJap, true); gamelist->Get("ListJap", &m_ListJap, true);

View File

@ -207,6 +207,7 @@ struct SConfig : NonCopyable
bool m_ListDrives; bool m_ListDrives;
bool m_ListWad; bool m_ListWad;
bool m_ListElfDol;
bool m_ListWii; bool m_ListWii;
bool m_ListGC; bool m_ListGC;
bool m_ListPal; bool m_ListPal;

View File

@ -24,6 +24,7 @@ public:
GAMECUBE_DISC = 0, GAMECUBE_DISC = 0,
WII_DISC, WII_DISC,
WII_WAD, WII_WAD,
ELF_DOL,
NUMBER_OF_PLATFORMS NUMBER_OF_PLATFORMS
}; };

View File

@ -308,6 +308,8 @@ wxMenuBar* CFrame::CreateMenu()
platformMenu->Check(IDM_LIST_GC, SConfig::GetInstance().m_ListGC); platformMenu->Check(IDM_LIST_GC, SConfig::GetInstance().m_ListGC);
platformMenu->AppendCheckItem(IDM_LIST_WAD, _("Show Wad")); platformMenu->AppendCheckItem(IDM_LIST_WAD, _("Show Wad"));
platformMenu->Check(IDM_LIST_WAD, SConfig::GetInstance().m_ListWad); platformMenu->Check(IDM_LIST_WAD, SConfig::GetInstance().m_ListWad);
platformMenu->AppendCheckItem(IDM_LIST_ELFDOL, _("Show Elf/Dol"));
platformMenu->Check(IDM_LIST_ELFDOL, SConfig::GetInstance().m_ListElfDol);
wxMenu *regionMenu = new wxMenu; wxMenu *regionMenu = new wxMenu;
viewMenu->AppendSubMenu(regionMenu, _("Show Regions")); viewMenu->AppendSubMenu(regionMenu, _("Show Regions"));
@ -1905,6 +1907,9 @@ void CFrame::GameListChanged(wxCommandEvent& event)
case IDM_LIST_WAD: case IDM_LIST_WAD:
SConfig::GetInstance().m_ListWad = event.IsChecked(); SConfig::GetInstance().m_ListWad = event.IsChecked();
break; break;
case IDM_LIST_ELFDOL:
SConfig::GetInstance().m_ListElfDol = event.IsChecked();
break;
case IDM_LIST_JAP: case IDM_LIST_JAP:
SConfig::GetInstance().m_ListJap = event.IsChecked(); SConfig::GetInstance().m_ListJap = event.IsChecked();
break; break;

View File

@ -197,10 +197,11 @@ void CGameListCtrl::InitBitmaps()
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_WORLD] = m_imageListSmall->Add(wxBitmap(Flag_Europe_xpm)); // Uses European flag as a placeholder m_FlagImageIndex[DiscIO::IVolume::COUNTRY_WORLD] = m_imageListSmall->Add(wxBitmap(Flag_Europe_xpm)); // Uses European flag as a placeholder
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_UNKNOWN] = m_imageListSmall->Add(wxBitmap(Flag_Unknown_xpm)); m_FlagImageIndex[DiscIO::IVolume::COUNTRY_UNKNOWN] = m_imageListSmall->Add(wxBitmap(Flag_Unknown_xpm));
m_PlatformImageIndex.resize(3); m_PlatformImageIndex.resize(4);
m_PlatformImageIndex[0] = m_imageListSmall->Add(wxBitmap(Platform_Gamecube_xpm)); m_PlatformImageIndex[0] = m_imageListSmall->Add(wxBitmap(Platform_Gamecube_xpm));
m_PlatformImageIndex[1] = m_imageListSmall->Add(wxBitmap(Platform_Wii_xpm)); m_PlatformImageIndex[1] = m_imageListSmall->Add(wxBitmap(Platform_Wii_xpm));
m_PlatformImageIndex[2] = m_imageListSmall->Add(wxBitmap(Platform_Wad_xpm)); m_PlatformImageIndex[2] = m_imageListSmall->Add(wxBitmap(Platform_Wad_xpm));
m_PlatformImageIndex[3] = m_imageListSmall->Add(wxBitmap(StrToWxStr(File::GetThemeDir(SConfig::GetInstance().theme_name) + "fileplatform.png"), wxBITMAP_TYPE_PNG));
m_EmuStateImageIndex.resize(6); m_EmuStateImageIndex.resize(6);
m_EmuStateImageIndex[0] = m_imageListSmall->Add(wxBitmap(rating_0)); m_EmuStateImageIndex[0] = m_imageListSmall->Add(wxBitmap(rating_0));
@ -482,6 +483,11 @@ void CGameListCtrl::ScanForISOs()
} }
if (SConfig::GetInstance().m_ListWad) if (SConfig::GetInstance().m_ListWad)
Extensions.push_back("*.wad"); Extensions.push_back("*.wad");
if (SConfig::GetInstance().m_ListElfDol)
{
Extensions.push_back("*.dol");
Extensions.push_back("*.elf");
}
auto rFilenames = DoFileSearch(Extensions, SConfig::GetInstance().m_ISOFolder, SConfig::GetInstance().m_RecursiveISOFolder); auto rFilenames = DoFileSearch(Extensions, SConfig::GetInstance().m_ISOFolder, SConfig::GetInstance().m_RecursiveISOFolder);
@ -837,16 +843,21 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
if (selected_iso) if (selected_iso)
{ {
wxMenu popupMenu; wxMenu popupMenu;
if (!selected_iso->IsElfOrDol())
{
popupMenu.Append(IDM_PROPERTIES, _("&Properties")); popupMenu.Append(IDM_PROPERTIES, _("&Properties"));
popupMenu.Append(IDM_GAME_WIKI, _("&Wiki")); popupMenu.Append(IDM_GAME_WIKI, _("&Wiki"));
popupMenu.AppendSeparator(); popupMenu.AppendSeparator();
}
if (selected_iso->GetPlatform() != DiscIO::IVolume::GAMECUBE_DISC) if (selected_iso->GetPlatform() != DiscIO::IVolume::GAMECUBE_DISC && !selected_iso->IsElfOrDol())
{ {
popupMenu.Append(IDM_OPEN_SAVE_FOLDER, _("Open Wii &save folder")); popupMenu.Append(IDM_OPEN_SAVE_FOLDER, _("Open Wii &save folder"));
popupMenu.Append(IDM_EXPORT_SAVE, _("Export Wii save (Experimental)")); popupMenu.Append(IDM_EXPORT_SAVE, _("Export Wii save (Experimental)"));
} }
popupMenu.Append(IDM_OPEN_CONTAINING_FOLDER, _("Open &containing folder")); popupMenu.Append(IDM_OPEN_CONTAINING_FOLDER, _("Open &containing folder"));
if (!selected_iso->IsElfOrDol())
popupMenu.AppendCheckItem(IDM_SET_DEFAULT_ISO, _("Set as &default ISO")); popupMenu.AppendCheckItem(IDM_SET_DEFAULT_ISO, _("Set as &default ISO"));
// First we have to decide a starting value when we append it // First we have to decide a starting value when we append it
@ -854,9 +865,9 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
popupMenu.FindItem(IDM_SET_DEFAULT_ISO)->Check(); popupMenu.FindItem(IDM_SET_DEFAULT_ISO)->Check();
popupMenu.AppendSeparator(); popupMenu.AppendSeparator();
popupMenu.Append(IDM_DELETE_ISO, _("&Delete ISO...")); popupMenu.Append(IDM_DELETE_ISO, _("&Delete File..."));
if (selected_iso->GetPlatform() != DiscIO::IVolume::WII_WAD) if (selected_iso->GetPlatform() != DiscIO::IVolume::WII_WAD && !selected_iso->IsElfOrDol())
{ {
if (selected_iso->IsCompressed()) if (selected_iso->IsCompressed())
popupMenu.Append(IDM_COMPRESS_ISO, _("Decompress ISO...")); popupMenu.Append(IDM_COMPRESS_ISO, _("Decompress ISO..."));
@ -864,7 +875,7 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
selected_iso->GetFileName().substr(selected_iso->GetFileName().find_last_of(".")) != ".wbfs") selected_iso->GetFileName().substr(selected_iso->GetFileName().find_last_of(".")) != ".wbfs")
popupMenu.Append(IDM_COMPRESS_ISO, _("Compress ISO...")); popupMenu.Append(IDM_COMPRESS_ISO, _("Compress ISO..."));
} }
else else if (!selected_iso->IsElfOrDol())
{ {
popupMenu.Append(IDM_LIST_INSTALL_WAD, _("Install to Wii Menu")); popupMenu.Append(IDM_LIST_INSTALL_WAD, _("Install to Wii Menu"));
} }

View File

@ -133,6 +133,7 @@ enum
IDM_LIST_WAD, IDM_LIST_WAD,
IDM_LIST_WII, IDM_LIST_WII,
IDM_LIST_GC, IDM_LIST_GC,
IDM_LIST_ELFDOL,
IDM_LIST_JAP, IDM_LIST_JAP,
IDM_LIST_PAL, IDM_LIST_PAL,
IDM_LIST_USA, IDM_LIST_USA,

View File

@ -66,10 +66,12 @@ GameListItem::GameListItem(const std::string& _rFileName)
, m_emu_state(0) , m_emu_state(0)
, m_FileSize(0) , m_FileSize(0)
, m_Revision(0) , m_Revision(0)
, m_Country(DiscIO::IVolume::COUNTRY_UNKNOWN)
, m_Valid(false) , m_Valid(false)
, m_BlobCompressed(false) , m_BlobCompressed(false)
, m_ImageWidth(0) , m_ImageWidth(0)
, m_ImageHeight(0) , m_ImageHeight(0)
, m_disc_number(0)
{ {
if (LoadFromCache()) if (LoadFromCache())
{ {
@ -129,6 +131,13 @@ GameListItem::GameListItem(const std::string& _rFileName)
ini.GetIfExists("EmuState", "EmulationIssues", &m_issues); ini.GetIfExists("EmuState", "EmulationIssues", &m_issues);
} }
if (!IsValid() && IsElfOrDol())
{
m_Valid = true;
m_FileSize = File::GetSize(_rFileName);
m_Platform = DiscIO::IVolume::ELF_DOL;
}
if (!m_pImage.empty()) if (!m_pImage.empty())
{ {
wxImage Image(m_ImageWidth, m_ImageHeight, &m_pImage[0], true); wxImage Image(m_ImageWidth, m_ImageHeight, &m_pImage[0], true);
@ -238,8 +247,11 @@ std::string GameListItem::GetName() const
std::string name = GetName(SConfig::GetInstance().GetCurrentLanguage(wii)); std::string name = GetName(SConfig::GetInstance().GetCurrentLanguage(wii));
if (name.empty()) if (name.empty())
{ {
std::string ext;
// No usable name, return filename (better than nothing) // No usable name, return filename (better than nothing)
SplitPath(GetFileName(), nullptr, &name, nullptr); SplitPath(GetFileName(), nullptr, &name, &ext);
return name + ext;
} }
return name; return name;
} }
@ -283,3 +295,18 @@ const std::string GameListItem::GetWiiFSPath() const
return ret; return ret;
} }
bool GameListItem::IsElfOrDol() const
{
const std::string name = GetName();
const size_t pos = name.rfind('.');
if (pos != std::string::npos)
{
std::string ext = name.substr(pos);
std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
return ext == ".elf" ||
ext == ".dol";
}
return false;
}

View File

@ -42,7 +42,9 @@ public:
u64 GetFileSize() const {return m_FileSize;} u64 GetFileSize() const {return m_FileSize;}
u64 GetVolumeSize() const {return m_VolumeSize;} u64 GetVolumeSize() const {return m_VolumeSize;}
// 0 is the first disc, 1 is the second disc // 0 is the first disc, 1 is the second disc
u8 GetDiscNumber() const {return m_disc_number;} u8 GetDiscNumber() const { return m_disc_number; }
bool IsElfOrDol() const;
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
const wxBitmap& GetBitmap() const {return m_Bitmap;} const wxBitmap& GetBitmap() const {return m_Bitmap;}
#endif #endif

View File

@ -75,7 +75,13 @@ static std::string BuildGameName(const GameListItem& game)
if (game.GetRevision() != 0) if (game.GetRevision() != 0)
return name + " (" + game.GetUniqueID() + ", Revision " + std::to_string((long long)game.GetRevision()) + ")"; return name + " (" + game.GetUniqueID() + ", Revision " + std::to_string((long long)game.GetRevision()) + ")";
else else
{
if (game.GetUniqueID().empty())
{
return game.GetName();
}
return name + " (" + game.GetUniqueID() + ")"; return name + " (" + game.GetUniqueID() + ")";
}
} }
void NetPlayDialog::FillWithGameNames(wxListBox* game_lbox, const CGameListCtrl& game_list) void NetPlayDialog::FillWithGameNames(wxListBox* game_lbox, const CGameListCtrl& game_list)