summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/DiscIO')
-rw-r--r--Source/Core/DiscIO/Src/BannerLoader.h2
-rw-r--r--Source/Core/DiscIO/Src/BannerLoaderGC.cpp16
-rw-r--r--Source/Core/DiscIO/Src/BannerLoaderGC.h2
-rw-r--r--Source/Core/DiscIO/Src/BannerLoaderWii.cpp39
-rw-r--r--Source/Core/DiscIO/Src/BannerLoaderWii.h2
5 files changed, 18 insertions, 43 deletions
diff --git a/Source/Core/DiscIO/Src/BannerLoader.h b/Source/Core/DiscIO/Src/BannerLoader.h
index 7fec9c57bd..da0075f7f3 100644
--- a/Source/Core/DiscIO/Src/BannerLoader.h
+++ b/Source/Core/DiscIO/Src/BannerLoader.h
@@ -26,7 +26,7 @@ class IBannerLoader
virtual bool IsValid() = 0;
- virtual bool GetBanner(u32* _pBannerImage) = 0;
+ virtual std::vector<u32> GetBanner(int* pWidth, int* pHeight) = 0;
virtual std::vector<std::string> GetNames() = 0;
virtual std::string GetCompany() = 0;
diff --git a/Source/Core/DiscIO/Src/BannerLoaderGC.cpp b/Source/Core/DiscIO/Src/BannerLoaderGC.cpp
index 58b79d12db..cbe09c5804 100644
--- a/Source/Core/DiscIO/Src/BannerLoaderGC.cpp
+++ b/Source/Core/DiscIO/Src/BannerLoaderGC.cpp
@@ -50,17 +50,15 @@ bool CBannerLoaderGC::IsValid()
return m_IsValid;
}
-bool CBannerLoaderGC::GetBanner(u32* _pBannerImage)
+std::vector<u32> CBannerLoaderGC::GetBanner(int* pWidth, int* pHeight)
{
- if (!IsValid())
- {
- return false;
- }
-
+ std::vector<u32> Buffer;
+ Buffer.resize(DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT);
auto const pBanner = (DVDBanner*)m_pBannerFile;
- decode5A3image(_pBannerImage, pBanner->image, DVD_BANNER_WIDTH, DVD_BANNER_HEIGHT);
-
- return true;
+ decode5A3image(&Buffer[0], pBanner->image, DVD_BANNER_WIDTH, DVD_BANNER_HEIGHT);
+ *pWidth = DVD_BANNER_WIDTH;
+ *pHeight = DVD_BANNER_HEIGHT;
+ return std::move(Buffer);
}
diff --git a/Source/Core/DiscIO/Src/BannerLoaderGC.h b/Source/Core/DiscIO/Src/BannerLoaderGC.h
index b9674feb58..e18a2fee82 100644
--- a/Source/Core/DiscIO/Src/BannerLoaderGC.h
+++ b/Source/Core/DiscIO/Src/BannerLoaderGC.h
@@ -20,7 +20,7 @@ class CBannerLoaderGC
virtual bool IsValid();
- virtual bool GetBanner(u32* _pBannerImage);
+ virtual std::vector<u32> GetBanner(int* pWidth, int* pHeight);
virtual std::vector<std::string> GetNames();
virtual std::string GetCompany();
diff --git a/Source/Core/DiscIO/Src/BannerLoaderWii.cpp b/Source/Core/DiscIO/Src/BannerLoaderWii.cpp
index e682ca13c6..915ce4debc 100644
--- a/Source/Core/DiscIO/Src/BannerLoaderWii.cpp
+++ b/Source/Core/DiscIO/Src/BannerLoaderWii.cpp
@@ -98,38 +98,15 @@ bool CBannerLoaderWii::IsValid()
return m_IsValid;
}
-static inline u32 Average32(u32 a, u32 b) {
- return ((a >> 1) & 0x7f7f7f7f) + ((b >> 1) & 0x7f7f7f7f);
-}
-
-static inline u32 GetPixel(u32 *buffer, unsigned int x, unsigned int y) {
- // thanks to unsignedness, these also check for <0 automatically.
- if (x > 191) return 0;
- if (y > 63) return 0;
- return buffer[y * 192 + x];
-}
-
-bool CBannerLoaderWii::GetBanner(u32* _pBannerImage)
+std::vector<u32> CBannerLoaderWii::GetBanner(int* pWidth, int* pHeight)
{
- if (IsValid())
- {
- SWiiBanner* pBanner = (SWiiBanner*)m_pBannerFile;
- u32* Buffer = new u32[192 * 64];
- decode5A3image(Buffer, (u16*)pBanner->m_BannerTexture, 192, 64);
- for (int y = 0; y < 32; y++)
- {
- for (int x = 0; x < 96; x++)
- {
- // simplified plus-shaped "gaussian"
- u32 surround = Average32(
- Average32(GetPixel(Buffer, x*2 - 1, y*2), GetPixel(Buffer, x*2 + 1, y*2)),
- Average32(GetPixel(Buffer, x*2, y*2 - 1), GetPixel(Buffer, x*2, y*2 + 1)));
- _pBannerImage[y * 96 + x] = Average32(GetPixel(Buffer, x*2, y*2), surround);
- }
- }
- delete[] Buffer;
- }
- return true;
+ SWiiBanner* pBanner = (SWiiBanner*)m_pBannerFile;
+ std::vector<u32> Buffer;
+ Buffer.resize(192 * 64);
+ decode5A3image(&Buffer[0], (u16*)pBanner->m_BannerTexture, 192, 64);
+ *pWidth = 192;
+ *pHeight = 64;
+ return std::move(Buffer);
}
bool CBannerLoaderWii::GetStringFromComments(const CommentIndex index, std::string& result)
diff --git a/Source/Core/DiscIO/Src/BannerLoaderWii.h b/Source/Core/DiscIO/Src/BannerLoaderWii.h
index 33a1dce6ae..455213cbf9 100644
--- a/Source/Core/DiscIO/Src/BannerLoaderWii.h
+++ b/Source/Core/DiscIO/Src/BannerLoaderWii.h
@@ -20,7 +20,7 @@ class CBannerLoaderWii
virtual bool IsValid();
- virtual bool GetBanner(u32* _pBannerImage);
+ virtual std::vector<u32> GetBanner(int* pWidth, int* pHeight);
virtual std::vector<std::string> GetNames();
virtual std::string GetCompany();