From faedf1bc5cd53861e0dc825acc8237f4f56d7189 Mon Sep 17 00:00:00 2001 From: Anthony Serna Date: Tue, 25 Aug 2015 22:13:55 -0700 Subject: [PATCH] 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 --- Data/Sys/Themes/Boomy/fileplatform.png | Bin 0 -> 278 bytes Data/Sys/Themes/Clean Blue/README.txt | 3 -- Data/Sys/Themes/Clean Blue/fileplatform.png | Bin 0 -> 278 bytes Data/Sys/Themes/Clean Lite/README.txt | 3 -- Data/Sys/Themes/Clean Lite/fileplatform.png | Bin 0 -> 278 bytes Data/Sys/Themes/Clean Pink/README.txt | 3 -- Data/Sys/Themes/Clean Pink/fileplatform.png | Bin 0 -> 278 bytes Data/Sys/Themes/Clean/README.txt | 3 -- Data/Sys/Themes/Clean/fileplatform.png | Bin 0 -> 278 bytes Source/Core/Core/ConfigManager.cpp | 2 ++ Source/Core/Core/ConfigManager.h | 1 + Source/Core/DiscIO/Volume.h | 1 + Source/Core/DolphinWX/FrameTools.cpp | 5 ++++ Source/Core/DolphinWX/GameListCtrl.cpp | 29 ++++++++++++++------ Source/Core/DolphinWX/Globals.h | 1 + Source/Core/DolphinWX/ISOFile.cpp | 29 +++++++++++++++++++- Source/Core/DolphinWX/ISOFile.h | 4 ++- Source/Core/DolphinWX/NetPlay/NetWindow.cpp | 6 ++++ 18 files changed, 67 insertions(+), 23 deletions(-) create mode 100644 Data/Sys/Themes/Boomy/fileplatform.png delete mode 100644 Data/Sys/Themes/Clean Blue/README.txt create mode 100644 Data/Sys/Themes/Clean Blue/fileplatform.png delete mode 100644 Data/Sys/Themes/Clean Lite/README.txt create mode 100644 Data/Sys/Themes/Clean Lite/fileplatform.png delete mode 100644 Data/Sys/Themes/Clean Pink/README.txt create mode 100644 Data/Sys/Themes/Clean Pink/fileplatform.png delete mode 100644 Data/Sys/Themes/Clean/README.txt create mode 100644 Data/Sys/Themes/Clean/fileplatform.png diff --git a/Data/Sys/Themes/Boomy/fileplatform.png b/Data/Sys/Themes/Boomy/fileplatform.png new file mode 100644 index 0000000000000000000000000000000000000000..0e6a2367292e6725159bfec0699d755d896bad53 GIT binary patch literal 278 zcmeAS@N?(olHy`uVBq!ia0vp^2|%pC!3HGX9;gigQfx`y?k)`fL2$v|<&%LToCO|{ z#S9GG!XV7ZFl&wkP>{XE)7O>#K8FmyvFb*Hz;8gI#hxyXAsP4HUUB4V3J__1n7n2E zj$BQSMI22n4h6P;Pqvt-v-N8j8}k0y|M4mBIevd828M`5YtB!68+B>hW0n36;o`dd ztDo0p|CzgF@muZUe|iU^1p|c=k1=?**b1g`U2xNw#38{XE)7O>#K8FmyvFb*Hz;8gI#hxyXAsP4HUUB4V3J__1n7n2E zj$BQSMI22n4h6P;Pqvt-v-N8j8}k0y|M4mBIevd828M`5YtB!68+B>hW0n36;o`dd ztDo0p|CzgF@muZUe|iU^1p|c=k1=?**b1g`U2xNw#38{XE)7O>#K8FmyvFb*Hz;8gI#hxyXAsP4HUUB4V3J__1n7n2E zj$BQSMI22n4h6P;Pqvt-v-N8j8}k0y|M4mBIevd828M`5YtB!68+B>hW0n36;o`dd ztDo0p|CzgF@muZUe|iU^1p|c=k1=?**b1g`U2xNw#38{XE)7O>#K8FmyvFb*Hz;8gI#hxyXAsP4HUUB4V3J__1n7n2E zj$BQSMI22n4h6P;Pqvt-v-N8j8}k0y|M4mBIevd828M`5YtB!68+B>hW0n36;o`dd ztDo0p|CzgF@muZUe|iU^1p|c=k1=?**b1g`U2xNw#38{XE)7O>#K8FmyvFb*Hz;8gI#hxyXAsP4HUUB4V3J__1n7n2E zj$BQSMI22n4h6P;Pqvt-v-N8j8}k0y|M4mBIevd828M`5YtB!68+B>hW0n36;o`dd ztDo0p|CzgF@muZUe|iU^1p|c=k1=?**b1g`U2xNw#38Set("ListDrives", m_ListDrives); gamelist->Set("ListWad", m_ListWad); + gamelist->Set("ListElfDol", m_ListElfDol); gamelist->Set("ListWii", m_ListWii); gamelist->Set("ListGC", m_ListGC); gamelist->Set("ListJap", m_ListJap); @@ -430,6 +431,7 @@ void SConfig::LoadGameListSettings(IniFile& ini) gamelist->Get("ListDrives", &m_ListDrives, false); gamelist->Get("ListWad", &m_ListWad, true); + gamelist->Get("ListElfDol", &m_ListElfDol, true); gamelist->Get("ListWii", &m_ListWii, true); gamelist->Get("ListGC", &m_ListGC, true); gamelist->Get("ListJap", &m_ListJap, true); diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h index caeec25152..bc4403326d 100644 --- a/Source/Core/Core/ConfigManager.h +++ b/Source/Core/Core/ConfigManager.h @@ -207,6 +207,7 @@ struct SConfig : NonCopyable bool m_ListDrives; bool m_ListWad; + bool m_ListElfDol; bool m_ListWii; bool m_ListGC; bool m_ListPal; diff --git a/Source/Core/DiscIO/Volume.h b/Source/Core/DiscIO/Volume.h index 294cf94c01..01b6bdd3b5 100644 --- a/Source/Core/DiscIO/Volume.h +++ b/Source/Core/DiscIO/Volume.h @@ -24,6 +24,7 @@ public: GAMECUBE_DISC = 0, WII_DISC, WII_WAD, + ELF_DOL, NUMBER_OF_PLATFORMS }; diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index 736ea19aae..5479902a87 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -308,6 +308,8 @@ wxMenuBar* CFrame::CreateMenu() platformMenu->Check(IDM_LIST_GC, SConfig::GetInstance().m_ListGC); platformMenu->AppendCheckItem(IDM_LIST_WAD, _("Show Wad")); 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; viewMenu->AppendSubMenu(regionMenu, _("Show Regions")); @@ -1905,6 +1907,9 @@ void CFrame::GameListChanged(wxCommandEvent& event) case IDM_LIST_WAD: SConfig::GetInstance().m_ListWad = event.IsChecked(); break; + case IDM_LIST_ELFDOL: + SConfig::GetInstance().m_ListElfDol = event.IsChecked(); + break; case IDM_LIST_JAP: SConfig::GetInstance().m_ListJap = event.IsChecked(); break; diff --git a/Source/Core/DolphinWX/GameListCtrl.cpp b/Source/Core/DolphinWX/GameListCtrl.cpp index 1b967a5f7c..a386485ce3 100644 --- a/Source/Core/DolphinWX/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/GameListCtrl.cpp @@ -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_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[1] = m_imageListSmall->Add(wxBitmap(Platform_Wii_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[0] = m_imageListSmall->Add(wxBitmap(rating_0)); @@ -482,6 +483,11 @@ void CGameListCtrl::ScanForISOs() } if (SConfig::GetInstance().m_ListWad) 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); @@ -837,26 +843,31 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event) if (selected_iso) { wxMenu popupMenu; - popupMenu.Append(IDM_PROPERTIES, _("&Properties")); - popupMenu.Append(IDM_GAME_WIKI, _("&Wiki")); - popupMenu.AppendSeparator(); - if (selected_iso->GetPlatform() != DiscIO::IVolume::GAMECUBE_DISC) + if (!selected_iso->IsElfOrDol()) + { + popupMenu.Append(IDM_PROPERTIES, _("&Properties")); + popupMenu.Append(IDM_GAME_WIKI, _("&Wiki")); + popupMenu.AppendSeparator(); + } + if (selected_iso->GetPlatform() != DiscIO::IVolume::GAMECUBE_DISC && !selected_iso->IsElfOrDol()) { popupMenu.Append(IDM_OPEN_SAVE_FOLDER, _("Open Wii &save folder")); popupMenu.Append(IDM_EXPORT_SAVE, _("Export Wii save (Experimental)")); } popupMenu.Append(IDM_OPEN_CONTAINING_FOLDER, _("Open &containing folder")); - popupMenu.AppendCheckItem(IDM_SET_DEFAULT_ISO, _("Set as &default ISO")); + + if (!selected_iso->IsElfOrDol()) + popupMenu.AppendCheckItem(IDM_SET_DEFAULT_ISO, _("Set as &default ISO")); // First we have to decide a starting value when we append it if (selected_iso->GetFileName() == SConfig::GetInstance().m_strDefaultISO) popupMenu.FindItem(IDM_SET_DEFAULT_ISO)->Check(); 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()) 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") popupMenu.Append(IDM_COMPRESS_ISO, _("Compress ISO...")); } - else + else if (!selected_iso->IsElfOrDol()) { popupMenu.Append(IDM_LIST_INSTALL_WAD, _("Install to Wii Menu")); } diff --git a/Source/Core/DolphinWX/Globals.h b/Source/Core/DolphinWX/Globals.h index 956cc9342f..c784e94479 100644 --- a/Source/Core/DolphinWX/Globals.h +++ b/Source/Core/DolphinWX/Globals.h @@ -133,6 +133,7 @@ enum IDM_LIST_WAD, IDM_LIST_WII, IDM_LIST_GC, + IDM_LIST_ELFDOL, IDM_LIST_JAP, IDM_LIST_PAL, IDM_LIST_USA, diff --git a/Source/Core/DolphinWX/ISOFile.cpp b/Source/Core/DolphinWX/ISOFile.cpp index 2ae56e8fb1..4be36d6fd7 100644 --- a/Source/Core/DolphinWX/ISOFile.cpp +++ b/Source/Core/DolphinWX/ISOFile.cpp @@ -66,10 +66,12 @@ GameListItem::GameListItem(const std::string& _rFileName) , m_emu_state(0) , m_FileSize(0) , m_Revision(0) + , m_Country(DiscIO::IVolume::COUNTRY_UNKNOWN) , m_Valid(false) , m_BlobCompressed(false) , m_ImageWidth(0) , m_ImageHeight(0) + , m_disc_number(0) { if (LoadFromCache()) { @@ -129,6 +131,13 @@ GameListItem::GameListItem(const std::string& _rFileName) 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()) { 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)); if (name.empty()) { + std::string ext; + // No usable name, return filename (better than nothing) - SplitPath(GetFileName(), nullptr, &name, nullptr); + SplitPath(GetFileName(), nullptr, &name, &ext); + return name + ext; } return name; } @@ -283,3 +295,18 @@ const std::string GameListItem::GetWiiFSPath() const 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; +} diff --git a/Source/Core/DolphinWX/ISOFile.h b/Source/Core/DolphinWX/ISOFile.h index ce9e6684f6..fad3f22c9e 100644 --- a/Source/Core/DolphinWX/ISOFile.h +++ b/Source/Core/DolphinWX/ISOFile.h @@ -42,7 +42,9 @@ public: u64 GetFileSize() const {return m_FileSize;} u64 GetVolumeSize() const {return m_VolumeSize;} // 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 const wxBitmap& GetBitmap() const {return m_Bitmap;} #endif diff --git a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp index 0de691a281..eb9f1d811f 100644 --- a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp +++ b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp @@ -75,7 +75,13 @@ static std::string BuildGameName(const GameListItem& game) if (game.GetRevision() != 0) return name + " (" + game.GetUniqueID() + ", Revision " + std::to_string((long long)game.GetRevision()) + ")"; else + { + if (game.GetUniqueID().empty()) + { + return game.GetName(); + } return name + " (" + game.GetUniqueID() + ")"; + } } void NetPlayDialog::FillWithGameNames(wxListBox* game_lbox, const CGameListCtrl& game_list)