From ca8bec90d118710487a3eca0197665c7202da40f Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Sun, 25 May 2014 20:54:39 +0000 Subject: [PATCH] -added id6 support for thp files -updated wiiflow to the latest devkitppc and latest libogc --- .../wiiflow_game_booter/source/videopatch.c | 37 +++++++++---------- source/banner/BannerTools.h | 16 ++++---- source/banner/BannerWindow.cpp | 8 ++-- source/banner/BannerWindow.hpp | 4 +- source/banner/Material.h | 1 + source/gui/FreeTypeGX.cpp | 12 +++--- source/gui/video.cpp | 33 +++++++++++++++++ source/menu/menu.cpp | 2 +- source/menu/menu.hpp | 2 +- source/menu/menu_game.cpp | 14 +++++-- source/menu/menu_system.cpp | 2 +- source/music/SoundDecoder.hpp | 2 +- source/network/gcard.c | 2 +- 13 files changed, 88 insertions(+), 47 deletions(-) diff --git a/resources/wiiflow_game_booter/source/videopatch.c b/resources/wiiflow_game_booter/source/videopatch.c index 9b4a2632..bc319393 100644 --- a/resources/wiiflow_game_booter/source/videopatch.c +++ b/resources/wiiflow_game_booter/source/videopatch.c @@ -113,38 +113,37 @@ GXRModeObj TVPal528ProgUnknown = }; -GXRModeObj TVMpal480Prog = +GXRModeObj TVPal574IntDfScale = { - 10, // viDisplayMode + VI_TVMODE_PAL_INT, // viDisplayMode 640, // fbWidth 480, // efbHeight - 480, // xfbHeight - (VI_MAX_WIDTH_NTSC - 640)/2, // viXOrigin - (VI_MAX_HEIGHT_NTSC - 480)/2, // viYOrigin + 574, // xfbHeight + (VI_MAX_WIDTH_PAL - 640)/2, // viXOrigin + (VI_MAX_HEIGHT_PAL - 574)/2, // viYOrigin 640, // viWidth - 480, // viHeight - VI_XFBMODE_SF, // xFBmode + 574, // viHeight + VI_XFBMODE_DF, // xFBmode GX_FALSE, // field_rendering GX_FALSE, // aa // sample points arranged in increasing Y order - { + { {6,6},{6,6},{6,6}, // pix 0, 3 sample points, 1/12 units, 4 bits each {6,6},{6,6},{6,6}, // pix 1 {6,6},{6,6},{6,6}, // pix 2 {6,6},{6,6},{6,6} // pix 3 - }, - + }, // vertical filter[7], 1/64 units, 6 bits each - { - 0, // line n-1 - 0, // line n-1 - 21, // line n - 22, // line n - 21, // line n - 0, // line n+1 - 0 // line n+1 - } + { + 8, // line n-1 + 8, // line n-1 + 10, // line n + 12, // line n + 10, // line n + 8, // line n+1 + 8 // line n+1 + } }; static const GXRModeObj *g_vidmodes[] = { diff --git a/source/banner/BannerTools.h b/source/banner/BannerTools.h index 40c92609..18a2535b 100644 --- a/source/banner/BannerTools.h +++ b/source/banner/BannerTools.h @@ -46,15 +46,15 @@ typedef struct } Vec3f; #define ALIGN32(x) (((x) + 31) & ~31) -#define LIMIT(x, min, max) \ - ({ \ - typeof( x ) _x = x; \ - typeof( min ) _min = min; \ - typeof( max ) _max = max; \ - ( ( ( _x ) < ( _min ) ) ? ( _min ) : ( ( _x ) > ( _max ) ) ? ( _max) : ( _x ) ); \ - }) +static inline u8 LIMIT(u8 x, u8 min, u8 max) +{ + return ( ( ( x ) < ( min ) ) ? ( min ) : ( ( x ) > ( max ) ) ? ( max) : ( x ) ); +} -#define MultiplyAlpha(a1, a2) ((u16) (a1) * (u16) (a2) / 0xFF) +static inline u8 MultiplyAlpha(u16 a1, u16 a2) +{ + return a1 * a2 / 0xFF; +} #define FLOAT_2_U8(x) ((u8)((x) > 255.0f ? 255.0f : ((x) < 0.0f ? 0.0f : (x) + 0.5f))) #define FLOAT_2_S16(x) ((s16)((x) > 32767.0f ? 32767.0f : ((x) < -32768.0f ? 32768.0f : (x) + 0.5f))) diff --git a/source/banner/BannerWindow.cpp b/source/banner/BannerWindow.cpp index 990597cb..94dd086b 100644 --- a/source/banner/BannerWindow.cpp +++ b/source/banner/BannerWindow.cpp @@ -43,7 +43,7 @@ void BannerWindow::Init(u8 *font1, u8 *font2) AnimPosX = 0.5f * (ScreenProps.x - fIconWidth); AnimPosY = 0.5f * (ScreenProps.y - fIconHeight); AnimationRunning = false; - Brightness = 0.f; + Brightness = 0; // this just looks better for banner/icon ratio xDiff = 0.5f * (m_vid.wide() ? (m_vid.vid_50hz() ? 616 : 620.0f) : 608.0f); @@ -161,7 +161,7 @@ void BannerWindow::Draw(void) // draw a black background image first if(AnimStep >= MaxAnimSteps) - DrawRectangle(0.0f, 0.0f, m_vid.width(), m_vid.height(), (GXColor) {0, 0, 0, 255.f}); + DrawRectangle(0.0f, 0.0f, m_vid.width(), m_vid.height(), (GXColor) {0, 0, 0, 0xFF}); if(changing) return; @@ -216,14 +216,14 @@ void BannerWindow::Draw(void) m_vid.setup2DProjection(); // If wanted - if(Brightness > 1.f) + if(Brightness == 200) DrawRectangle(0.0f, 0.0f, m_vid.width(), m_vid.height(), (GXColor) {0, 0, 0, Brightness}); } void BannerWindow::ToogleGameSettings() { ToogleZoom(); - Brightness = (Brightness > 1.f ? 0.f : 200.f); + Brightness = (Brightness == 200 ? 0 : 200); } void BannerWindow::ReSetup_GX(void) diff --git a/source/banner/BannerWindow.hpp b/source/banner/BannerWindow.hpp index 287e0c5b..0be5c928 100644 --- a/source/banner/BannerWindow.hpp +++ b/source/banner/BannerWindow.hpp @@ -51,7 +51,7 @@ public: void LoadBannerBin(u8 *bnr, u32 bnr_size, u8 *font1, u8 *font2); int GetSelectedGame() { return gameSelected; } bool GetZoomSetting() { return AnimZoom; } - bool GetInGameSettings() { return (Brightness > 1.f ? true : false); } + bool GetInGameSettings() { return (Brightness == 200 ? true : false); } void CreateGCBanner(u8 *bnr, u8 *font1, u8 *font2, const wchar_t *title); void Draw(void); bool ToogleZoom(void); @@ -73,7 +73,7 @@ protected: bool reducedVol; int returnVal; int gameSelected; - float Brightness; + u8 Brightness; int MaxAnimSteps; int AnimStep; diff --git a/source/banner/Material.h b/source/banner/Material.h index 77f1eff5..d136d38e 100644 --- a/source/banner/Material.h +++ b/source/banner/Material.h @@ -44,6 +44,7 @@ public: } ATTRIBUTE_PACKED; Material(); + virtual ~Material() { }; void Load(Material::Header *mat); void Apply(const BannerResources& resources, u8 render_alpha, bool modulate) const; diff --git a/source/gui/FreeTypeGX.cpp b/source/gui/FreeTypeGX.cpp index e0638b1f..5875359e 100644 --- a/source/gui/FreeTypeGX.cpp +++ b/source/gui/FreeTypeGX.cpp @@ -105,13 +105,13 @@ ftgxCharData *FreeTypeGX::cacheGlyphData(wchar_t charCode) this->fontData[charCode] = (ftgxCharData) { - this->ftSlot->advance.x >> 6, - gIndex, + (u16)(this->ftSlot->advance.x >> 6), + (u16)(gIndex), textureWidth, textureHeight, - this->ftSlot->bitmap_top, - this->ftSlot->bitmap_top, - textureHeight - this->ftSlot->bitmap_top, + (u16)(this->ftSlot->bitmap_top), + (u16)(this->ftSlot->bitmap_top), + (u16)(textureHeight - this->ftSlot->bitmap_top), NULL }; this->loadGlyphData(glyphBitmap, &this->fontData[charCode]); @@ -144,7 +144,7 @@ void FreeTypeGX::loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData) int glyphSize = (charData->textureWidth * charData->textureHeight) >> 1; uint8_t *glyphData = (uint8_t *) MEM2_alloc(glyphSize); - if(glyphData < 0) + if(glyphData == NULL) return; memset(glyphData, 0x00, glyphSize); diff --git a/source/gui/video.cpp b/source/gui/video.cpp index c570712b..1e1b0b81 100644 --- a/source/gui/video.cpp +++ b/source/gui/video.cpp @@ -79,6 +79,39 @@ const float CVideo::_jitter8[8][2] = { { 0.164216f, -0.054399f } }; +GXRModeObj TVPal574IntDfScale = +{ + VI_TVMODE_PAL_INT, // viDisplayMode + 640, // fbWidth + 480, // efbHeight + 574, // xfbHeight + (VI_MAX_WIDTH_PAL - 640)/2, // viXOrigin + (VI_MAX_HEIGHT_PAL - 574)/2, // viYOrigin + 640, // viWidth + 574, // viHeight + VI_XFBMODE_DF, // xFBmode + GX_FALSE, // field_rendering + GX_FALSE, // aa + + // sample points arranged in increasing Y order + { + {6,6},{6,6},{6,6}, // pix 0, 3 sample points, 1/12 units, 4 bits each + {6,6},{6,6},{6,6}, // pix 1 + {6,6},{6,6},{6,6}, // pix 2 + {6,6},{6,6},{6,6} // pix 3 + }, + // vertical filter[7], 1/64 units, 6 bits each + { + 8, // line n-1 + 8, // line n-1 + 10, // line n + 12, // line n + 10, // line n + 8, // line n+1 + 8 // line n+1 + } +}; + struct movieP normalMoviePos = { 410, 31, 610, 181 }; struct movieP zoomedMoviePos = { 0, 0, 640, 480 }; struct movieP currentMoviePos = normalMoviePos; diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index e245c63f..cf322cd9 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -303,7 +303,7 @@ void CMenu::init() m_helpDir = m_cfg.getString("GENERAL", "dir_help", fmt("%s/help", m_dataDir.c_str())); /* Cache Reload Checks */ - u32 ini_rev = m_cfg.getInt("GENERAL", "ini_rev", 0); + int ini_rev = m_cfg.getInt("GENERAL", "ini_rev", 0); if(ini_rev != SVN_REV_NUM) fsop_deleteFolder(m_listCacheDir.c_str()); m_cfg.setInt("GENERAL", "ini_rev", SVN_REV_NUM); diff --git a/source/menu/menu.hpp b/source/menu/menu.hpp index 12ddf365..ecf3b714 100644 --- a/source/menu/menu.hpp +++ b/source/menu/menu.hpp @@ -1192,7 +1192,7 @@ private: static int _version[9]; static const SCFParamDesc _cfParams[]; static const int _nbCfgPages; - static const u32 SVN_REV_NUM; + static const int SVN_REV_NUM; //thread stack static u8 downloadStack[8192]; static const u32 downloadStackSize; diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 1afde754..a16e6860 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -398,10 +398,18 @@ bool CMenu::_startVideo() } const char *videoPath = getVideoPath(m_videoDir, videoId); const char *THP_Path = fmt("%s.thp", videoPath); - if(!fsop_FileExist(THP_Path) && m_current_view == COVERFLOW_PLUGIN) + if(!fsop_FileExist(THP_Path)) { - videoPath = getVideoDefaultPath(m_videoDir); - THP_Path = fmt("%s.thp", videoPath); + if(m_current_view == COVERFLOW_PLUGIN) + { + videoPath = getVideoDefaultPath(m_videoDir); + THP_Path = fmt("%s.thp", videoPath); + } + else if(!NoGameID(CoverFlow.getHdr()->type)) + { + videoPath = getVideoPath(m_videoDir, CoverFlow.getId()); + THP_Path = fmt("%s.thp", videoPath); + } } if(fsop_FileExist(THP_Path)) { diff --git a/source/menu/menu_system.cpp b/source/menu/menu_system.cpp index 24e8d04f..c4ceb897 100644 --- a/source/menu/menu_system.cpp +++ b/source/menu/menu_system.cpp @@ -5,7 +5,7 @@ #include "loader/wbfs.h" int version_num = 0, num_versions = 0, i; -const u32 CMenu::SVN_REV_NUM = atoi(SVN_REV); +const int CMenu::SVN_REV_NUM = atoi(SVN_REV); int CMenu::_version[9] = {0, SVN_REV_NUM, SVN_REV_NUM, SVN_REV_NUM, SVN_REV_NUM, SVN_REV_NUM, SVN_REV_NUM, SVN_REV_NUM, SVN_REV_NUM}; const int pixels_to_skip = 10; diff --git a/source/music/SoundDecoder.hpp b/source/music/SoundDecoder.hpp index 972b33fd..00d6bfe8 100644 --- a/source/music/SoundDecoder.hpp +++ b/source/music/SoundDecoder.hpp @@ -50,7 +50,7 @@ public: SoundDecoder(); SoundDecoder(const char * filepath); SoundDecoder(const u8 * buffer, int size); - ~SoundDecoder(); + virtual ~SoundDecoder(); virtual int Read(u8 * buffer, int buffer_size, int pos); virtual int Tell() { return CurPos; }; virtual int Seek(int pos) { CurPos = pos; return file_fd->seek(CurPos, SEEK_SET); }; diff --git a/source/network/gcard.c b/source/network/gcard.c index 4df0b330..b6fab80c 100644 --- a/source/network/gcard.c +++ b/source/network/gcard.c @@ -45,7 +45,7 @@ void add_game_to_card(const char *gameid) int i; char *url = (char *)MEM2_alloc(MAX_URL_SIZE); // Too much memory, but only like 10 bytes - memset(url, 0, sizeof(url)); + memset(url, 0, MAX_URL_SIZE); for(i = 0; i < amount_of_providers && providers != NULL; i++) {