diff options
| author | Pringo <Pringo@users.noreply.github.com> | 2014-11-24 21:54:15 -0800 |
|---|---|---|
| committer | Pringo <Pringo@users.noreply.github.com> | 2014-11-24 21:54:15 -0800 |
| commit | 670d94967a64b6a3e99127caf5511b07825f21cb (patch) | |
| tree | e83e2909a2db5dbe8387a40f3839d27abf588c0c /Source/Core/DolphinWX/ISOFile.cpp | |
| parent | 5a89ba20d75b17b1aeec090544934b95bdb0ec74 (diff) | |
| parent | 245ff601b7033f4122b48d837171c21baa9ac306 (diff) | |
Merge pull request #1 from dolphin-emu/master
update
Diffstat (limited to 'Source/Core/DolphinWX/ISOFile.cpp')
| -rw-r--r-- | Source/Core/DolphinWX/ISOFile.cpp | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/Source/Core/DolphinWX/ISOFile.cpp b/Source/Core/DolphinWX/ISOFile.cpp index 5bbfaa7f40..41345ccdcb 100644 --- a/Source/Core/DolphinWX/ISOFile.cpp +++ b/Source/Core/DolphinWX/ISOFile.cpp @@ -5,13 +5,16 @@ #include <cinttypes> #include <cstdio> #include <cstring> +#include <memory> #include <string> #include <vector> +#include <wx/app.h> #include <wx/bitmap.h> #include <wx/filefn.h> #include <wx/gdicmn.h> #include <wx/image.h> #include <wx/string.h> +#include <wx/window.h> #include "Common/ChunkFile.h" #include "Common/CommonPaths.h" @@ -34,7 +37,7 @@ #include "DolphinWX/ISOFile.h" #include "DolphinWX/WxUtils.h" -static const u32 CACHE_REVISION = 0x115; +static const u32 CACHE_REVISION = 0x117; #define DVD_BANNER_WIDTH 96 #define DVD_BANNER_HEIGHT 32 @@ -62,9 +65,7 @@ GameListItem::GameListItem(const std::string& _rFileName) if (!DiscIO::IsVolumeWadFile(pVolume)) m_Platform = DiscIO::IsVolumeWiiDisc(pVolume) ? WII_DISC : GAMECUBE_DISC; else - { m_Platform = WII_WAD; - } m_volume_names = pVolume->GetNames(); @@ -82,30 +83,26 @@ GameListItem::GameListItem(const std::string& _rFileName) if (pFileSystem != nullptr || m_Platform == WII_WAD) { - DiscIO::IBannerLoader* pBannerLoader = DiscIO::CreateBannerLoader(*pFileSystem, pVolume); + std::unique_ptr<DiscIO::IBannerLoader> pBannerLoader(DiscIO::CreateBannerLoader(*pFileSystem, pVolume)); - if (pBannerLoader != nullptr) + if (pBannerLoader != nullptr && pBannerLoader->IsValid()) { - if (pBannerLoader->IsValid()) + if (m_Platform != WII_WAD) + m_banner_names = pBannerLoader->GetNames(); + m_company = pBannerLoader->GetCompany(); + m_descriptions = pBannerLoader->GetDescriptions(); + + std::vector<u32> Buffer = pBannerLoader->GetBanner(&m_ImageWidth, &m_ImageHeight); + u32* pData = &Buffer[0]; + // resize vector to image size + m_pImage.resize(m_ImageWidth * m_ImageHeight * 3); + + for (int i = 0; i < m_ImageWidth * m_ImageHeight; i++) { - if (m_Platform != WII_WAD) - m_banner_names = pBannerLoader->GetNames(); - m_company = pBannerLoader->GetCompany(); - m_descriptions = pBannerLoader->GetDescriptions(); - - std::vector<u32> Buffer = pBannerLoader->GetBanner(&m_ImageWidth, &m_ImageHeight); - u32* pData = &Buffer[0]; - // resize vector to image size - m_pImage.resize(m_ImageWidth * m_ImageHeight * 3); - - for (int i = 0; i < m_ImageWidth * m_ImageHeight; i++) - { - m_pImage[i * 3 + 0] = (pData[i] & 0xFF0000) >> 16; - m_pImage[i * 3 + 1] = (pData[i] & 0x00FF00) >> 8; - m_pImage[i * 3 + 2] = (pData[i] & 0x0000FF) >> 0; - } + m_pImage[i * 3 + 0] = (pData[i] & 0xFF0000) >> 16; + m_pImage[i * 3 + 1] = (pData[i] & 0x00FF00) >> 8; + m_pImage[i * 3 + 2] = (pData[i] & 0x0000FF) >> 0; } - delete pBannerLoader; } delete pFileSystem; @@ -136,7 +133,7 @@ GameListItem::GameListItem(const std::string& _rFileName) if (!m_pImage.empty()) { wxImage Image(m_ImageWidth, m_ImageHeight, &m_pImage[0], true); - double Scale = WxUtils::GetCurrentBitmapLogicalScale(); + double Scale = wxTheApp->GetTopWindow()->GetContentScaleFactor(); // Note: This uses nearest neighbor, which subjectively looks a lot // better for GC banners than smooths caling. Image.Rescale(DVD_BANNER_WIDTH * Scale, DVD_BANNER_HEIGHT * Scale); @@ -165,9 +162,7 @@ bool GameListItem::LoadFromCache() void GameListItem::SaveToCache() { if (!File::IsDirectory(File::GetUserPath(D_CACHE_IDX))) - { File::CreateDir(File::GetUserPath(D_CACHE_IDX)); - } CChunkFileReader::Save<GameListItem>(CreateCacheFilename(), CACHE_REVISION, *this); } |
