From 47201c807a4141b4f918f4877b37e589ef7d7e53 Mon Sep 17 00:00:00 2001 From: dimok321 <15055714+dimok789@users.noreply.github.com> Date: Sun, 19 Jul 2009 17:48:15 +0000 Subject: [PATCH] *Changes in the Banner Class. Now loading the TPL files into memory and display from there. --- Languages/czech.lang | 5 +- Languages/danish.lang | 5 +- Languages/dutch.lang | 5 +- Languages/english.lang | 5 +- Languages/finnish.lang | 5 +- Languages/french.lang | 5 +- Languages/german.lang | 5 +- Languages/hungarian.lang | 5 +- Languages/italian.lang | 5 +- Languages/japanese.lang | 5 +- Languages/korean.lang | 5 +- Languages/norwegian.lang | 5 +- Languages/portuguese_br.lang | 5 +- Languages/portuguese_pt.lang | 5 +- Languages/russian.lang | 5 +- Languages/schinese.lang | 5 +- Languages/spanish.lang | 5 +- Languages/swedish.lang | 5 +- Languages/tchinese.lang | 5 +- Languages/turkish.lang | 5 +- source/banner/gui_banner.cpp | 157 +++++++++++++++--------- source/banner/gui_banner.h | 20 +-- source/banner/openingbnr.h | 3 +- source/video.cpp | 230 +++++++---------------------------- source/video.h | 8 +- 25 files changed, 240 insertions(+), 278 deletions(-) diff --git a/Languages/czech.lang b/Languages/czech.lang index 507751ad..bb651a14 100644 --- a/Languages/czech.lang +++ b/Languages/czech.lang @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 12:57+0200\n" +"POT-Creation-Date: 2009-07-19 19:46+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: David Jelinek (djelinek@hotmail.com) \n" "Language-Team: Last version on http://startgolf.tym.cz/czech.lang \n" @@ -493,6 +493,9 @@ msgstr "Vlevo" msgid "Like SysMenu" msgstr "Jako hlavní menu" +msgid "Load" +msgstr "" + msgid "Load this dol as alternate dol?" msgstr "" diff --git a/Languages/danish.lang b/Languages/danish.lang index 16f852ba..5ef53ffe 100644 --- a/Languages/danish.lang +++ b/Languages/danish.lang @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 12:57+0200\n" +"POT-Creation-Date: 2009-07-19 19:46+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -493,6 +493,9 @@ msgstr "Venstre" msgid "Like SysMenu" msgstr "Ligesom wii-menuen" +msgid "Load" +msgstr "" + msgid "Load this dol as alternate dol?" msgstr "" diff --git a/Languages/dutch.lang b/Languages/dutch.lang index 7fe2a58f..9514d8f8 100644 --- a/Languages/dutch.lang +++ b/Languages/dutch.lang @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 12:57+0200\n" +"POT-Creation-Date: 2009-07-19 19:46+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -493,6 +493,9 @@ msgstr "Links" msgid "Like SysMenu" msgstr "Als systeemmenu" +msgid "Load" +msgstr "" + msgid "Load this dol as alternate dol?" msgstr "Deze dol als alt dol gebruiken?" diff --git a/Languages/english.lang b/Languages/english.lang index a851da73..919c4ea2 100644 --- a/Languages/english.lang +++ b/Languages/english.lang @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 12:57+0200\n" +"POT-Creation-Date: 2009-07-19 19:46+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -493,6 +493,9 @@ msgstr "" msgid "Like SysMenu" msgstr "" +msgid "Load" +msgstr "" + msgid "Load this dol as alternate dol?" msgstr "" diff --git a/Languages/finnish.lang b/Languages/finnish.lang index caae532e..09b6f5cb 100644 --- a/Languages/finnish.lang +++ b/Languages/finnish.lang @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 12:57+0200\n" +"POT-Creation-Date: 2009-07-19 19:46+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -493,6 +493,9 @@ msgstr "Vasen" msgid "Like SysMenu" msgstr "Kuin wii-menu" +msgid "Load" +msgstr "" + msgid "Load this dol as alternate dol?" msgstr "" diff --git a/Languages/french.lang b/Languages/french.lang index 27bf3fbc..0776d268 100644 --- a/Languages/french.lang +++ b/Languages/french.lang @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 12:57+0200\n" +"POT-Creation-Date: 2009-07-19 19:46+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: Kin8\n" "Language-Team: Badablek, Amour, ikya, OuahOuah & Kin8\n" @@ -493,6 +493,9 @@ msgstr "Gauche" msgid "Like SysMenu" msgstr "Menu système" +msgid "Load" +msgstr "" + msgid "Load this dol as alternate dol?" msgstr "Charger ce DOL comme DOL alternatif ?" diff --git a/Languages/german.lang b/Languages/german.lang index 387fe680..b7fdd612 100644 --- a/Languages/german.lang +++ b/Languages/german.lang @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 12:57+0200\n" +"POT-Creation-Date: 2009-07-19 19:46+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -493,6 +493,9 @@ msgstr "Links" msgid "Like SysMenu" msgstr "Wie SysMenü" +msgid "Load" +msgstr "" + msgid "Load this dol as alternate dol?" msgstr "" diff --git a/Languages/hungarian.lang b/Languages/hungarian.lang index a9502c33..a01b8dd0 100644 --- a/Languages/hungarian.lang +++ b/Languages/hungarian.lang @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 12:57+0200\n" +"POT-Creation-Date: 2009-07-19 19:46+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: Tusk\n" "Language-Team: \n" @@ -493,6 +493,9 @@ msgstr "Balra" msgid "Like SysMenu" msgstr "Mint a Rendszermenû" +msgid "Load" +msgstr "" + msgid "Load this dol as alternate dol?" msgstr "" diff --git a/Languages/italian.lang b/Languages/italian.lang index b3876f00..5838c342 100644 --- a/Languages/italian.lang +++ b/Languages/italian.lang @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 12:57+0200\n" +"POT-Creation-Date: 2009-07-19 19:46+0200\n" "PO-Revision-Date: 2009-07-18 23:50+0200\n" "Last-Translator: Cambo \n" "Language-Team: FoxeJoe & Cambo\n" @@ -493,6 +493,9 @@ msgstr "Sinistra" msgid "Like SysMenu" msgstr "Come SysMenu" +msgid "Load" +msgstr "" + msgid "Load this dol as alternate dol?" msgstr "Vuoi caricare questo dol come dol alternativo?" diff --git a/Languages/japanese.lang b/Languages/japanese.lang index 2522eb7f..4e3517e7 100644 --- a/Languages/japanese.lang +++ b/Languages/japanese.lang @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 12:57+0200\n" +"POT-Creation-Date: 2009-07-19 19:46+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -493,6 +493,9 @@ msgstr "左" msgid "Like SysMenu" msgstr "Like SysMenu" +msgid "Load" +msgstr "" + msgid "Load this dol as alternate dol?" msgstr "" diff --git a/Languages/korean.lang b/Languages/korean.lang index 3ff859e3..57c471f8 100644 --- a/Languages/korean.lang +++ b/Languages/korean.lang @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 12:57+0200\n" +"POT-Creation-Date: 2009-07-19 19:46+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -493,6 +493,9 @@ msgstr "왼쪽" msgid "Like SysMenu" msgstr "시스템 메뉴처럼" +msgid "Load" +msgstr "" + msgid "Load this dol as alternate dol?" msgstr "" diff --git a/Languages/norwegian.lang b/Languages/norwegian.lang index d26508a5..bb63cff5 100644 --- a/Languages/norwegian.lang +++ b/Languages/norwegian.lang @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 12:57+0200\n" +"POT-Creation-Date: 2009-07-19 19:46+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -493,6 +493,9 @@ msgstr "Venstre" msgid "Like SysMenu" msgstr "Lik Systemmeny" +msgid "Load" +msgstr "" + msgid "Load this dol as alternate dol?" msgstr "Last denne DOL som alternativ DOL?" diff --git a/Languages/portuguese_br.lang b/Languages/portuguese_br.lang index 2f355873..3d1441b0 100644 --- a/Languages/portuguese_br.lang +++ b/Languages/portuguese_br.lang @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 12:57+0200\n" +"POT-Creation-Date: 2009-07-19 19:46+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -493,6 +493,9 @@ msgstr "Esquerda" msgid "Like SysMenu" msgstr "Igual ao Menu do Wii" +msgid "Load" +msgstr "" + msgid "Load this dol as alternate dol?" msgstr "" diff --git a/Languages/portuguese_pt.lang b/Languages/portuguese_pt.lang index 3591bf2e..96935006 100644 --- a/Languages/portuguese_pt.lang +++ b/Languages/portuguese_pt.lang @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 12:57+0200\n" +"POT-Creation-Date: 2009-07-19 19:46+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: Sky8000\n" "Language-Team: \n" @@ -493,6 +493,9 @@ msgstr "Esquerda" msgid "Like SysMenu" msgstr "Igual ao Menu da Wii" +msgid "Load" +msgstr "" + msgid "Load this dol as alternate dol?" msgstr "" diff --git a/Languages/russian.lang b/Languages/russian.lang index a2fe2e30..2bdd98dd 100644 --- a/Languages/russian.lang +++ b/Languages/russian.lang @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 12:57+0200\n" +"POT-Creation-Date: 2009-07-19 19:46+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: Kir\n" "Language-Team: Kir\n" @@ -493,6 +493,9 @@ msgstr "Налево" msgid "Like SysMenu" msgstr "как SysMenu" +msgid "Load" +msgstr "" + msgid "Load this dol as alternate dol?" msgstr "" diff --git a/Languages/schinese.lang b/Languages/schinese.lang index 3a7d7fd8..db6d5137 100644 --- a/Languages/schinese.lang +++ b/Languages/schinese.lang @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 12:57+0200\n" +"POT-Creation-Date: 2009-07-19 19:46+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -493,6 +493,9 @@ msgstr "左" msgid "Like SysMenu" msgstr "同系统选单" +msgid "Load" +msgstr "" + msgid "Load this dol as alternate dol?" msgstr "" diff --git a/Languages/spanish.lang b/Languages/spanish.lang index 4384b925..438b3c42 100644 --- a/Languages/spanish.lang +++ b/Languages/spanish.lang @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 12:57+0200\n" +"POT-Creation-Date: 2009-07-19 19:46+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -493,6 +493,9 @@ msgstr "Izquierda" msgid "Like SysMenu" msgstr "Como Menú Sist." +msgid "Load" +msgstr "" + msgid "Load this dol as alternate dol?" msgstr "¿Cargar este dol como dol alternativo?" diff --git a/Languages/swedish.lang b/Languages/swedish.lang index 2b7bfaab..2e2852ab 100644 --- a/Languages/swedish.lang +++ b/Languages/swedish.lang @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 12:57+0200\n" +"POT-Creation-Date: 2009-07-19 19:46+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: Katsurou\n" "Language-Team: \n" @@ -493,6 +493,9 @@ msgstr "Vänster" msgid "Like SysMenu" msgstr "Som System-menyn" +msgid "Load" +msgstr "" + msgid "Load this dol as alternate dol?" msgstr "" diff --git a/Languages/tchinese.lang b/Languages/tchinese.lang index dc3fc29a..9c8aaa57 100644 --- a/Languages/tchinese.lang +++ b/Languages/tchinese.lang @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 12:57+0200\n" +"POT-Creation-Date: 2009-07-19 19:46+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -493,6 +493,9 @@ msgstr "左" msgid "Like SysMenu" msgstr "同系統選單" +msgid "Load" +msgstr "" + msgid "Load this dol as alternate dol?" msgstr "載入這個dol做為替代的dol?" diff --git a/Languages/turkish.lang b/Languages/turkish.lang index 2a043dd2..e581f9ce 100644 --- a/Languages/turkish.lang +++ b/Languages/turkish.lang @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: USB Loader GX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 12:57+0200\n" +"POT-Creation-Date: 2009-07-19 19:46+0200\n" "PO-Revision-Date: 2009-07-18 15:18+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -493,6 +493,9 @@ msgstr "Sol" msgid "Like SysMenu" msgstr "Sistem Menüsü Gibi" +msgid "Load" +msgstr "" + msgid "Load this dol as alternate dol?" msgstr "" diff --git a/source/banner/gui_banner.cpp b/source/banner/gui_banner.cpp index 0ced0853..267d2685 100644 --- a/source/banner/gui_banner.cpp +++ b/source/banner/gui_banner.cpp @@ -5,73 +5,110 @@ * Shows TPL Banner images ***************************************************************************/ #include "gui_banner.h" - -GuiBanner::GuiBanner() -{ - deg_beta=0.0; -} + +GuiBanner::GuiBanner(const char *tplfilepath) +{ + memory = NULL; + tplfilesize = 0; + width = 0; + height = 0; + + FILE *tplfp = fopen(tplfilepath,"rb"); + + if(tplfp !=NULL) { + + unsigned short heighttemp = 0; + unsigned short widthtemp = 0; + + fseek(tplfp , 0x14, SEEK_SET); + fread((void*)&heighttemp,1,2,tplfp); + fread((void*)&widthtemp,1,2,tplfp); + fseek (tplfp , 0 , SEEK_END); + tplfilesize = ftell (tplfp); + rewind (tplfp); + memory = memalign(32, tplfilesize); + if(!memory) { + fclose(tplfp); + return; + } + fread(memory, 1, tplfilesize, tplfp); + fclose(tplfp); + + TPLFile tplfile; + int ret; + + ret = TPL_OpenTPLFromMemory(&tplfile, memory, tplfilesize); + if(ret < 0) { + free(memory); + memory = NULL; + return; + } + ret = TPL_GetTexture(&tplfile,0,&texObj); + if(ret < 0) { + free(memory); + memory = NULL; + return; + } + TPL_CloseTPLFile(&tplfile); + + width = widthtemp; + height = heighttemp; + widescreen = 0; + filecheck = true; + + } else { + filecheck = false; + fclose(tplfp); + } +} + +GuiBanner::GuiBanner(void *mem, u32 len, int w, int h) +{ + if(!mem || !len) + return; + memory = mem; + tplfilesize = len; + width = w; + height = h; + + TPLFile tplfile; + + int ret; + + ret = TPL_OpenTPLFromMemory(&tplfile, memory, tplfilesize); + if(ret < 0) { + free(memory); + memory = NULL; + return; + } + ret = TPL_GetTexture(&tplfile,0,&texObj); + if(ret < 0) { + free(memory); + memory = NULL; + return; + } + TPL_CloseTPLFile(&tplfile); + + filecheck = true; +} GuiBanner::~GuiBanner() -{ - +{ + if(memory != NULL) { + free(memory); + memory = NULL; + } } -GuiBanner::GuiBanner(const char *tplfilepath) -{ - FILE *tplfp = fopen(tplfilepath,"rb"); - - if(tplfp !=NULL) - { - unsigned short heighttemp = 0; - unsigned short widthtemp = 0; - - fseek(tplfp , 0x14, SEEK_SET); - fread((void*)&heighttemp,1,2,tplfp); - fread((void*)&widthtemp,1,2,tplfp); - fclose(tplfp); - - filepath = tplfilepath; - width = widthtemp; - height = heighttemp; - widescreen = 0; - filecheck = true; - } - else - { - filecheck = false; - fclose(tplfp); - } -} - -GuiBanner::GuiBanner(void *mem,u32 len,u16 w, u16 h) -{ - if(memory !=NULL) - { - memory = mem; - width = w; - height = h; - widescreen = 0; - filecheck = true; - free(mem); - } - else - { - filecheck = false; - free(mem); - } - -} -//void Menu_DrawTPL(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 distance,const char *filepath,f32 deg_alpha, f32 deg_beta, f32 scaleX, f32 scaleY, u8 alpha, bool shadow); -//void Menu_DrawTPLMem(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 distance,const void *memory,u32 len, f32 deg_alpha, f32 deg_beta, f32 scaleX, f32 scaleY, u8 alpha, bool shadow); - void GuiBanner::Draw() { LOCK(this); if(!filecheck ||!this->IsVisible()) - return; - float currScale = this->GetScale(); - //Menu_DrawTPL(50,70, 20, width, height, 50, filepath, 1, deg_beta, widescreen ? currScale*0.8 : currScale, currScale, 64, true); - Menu_DrawTPL(xoffset,yoffset, 50, width, height, 50, filepath, 0, deg_beta, widescreen ? currScale*0.8 : currScale, currScale, 64, true); - + return; + + float currScale = this->GetScale(); + + Menu_DrawTPLImg(this->GetLeft(), this->GetTop(), 0, width, height, &texObj, imageangle, widescreen ? currScale*0.80 : currScale, currScale, this->GetAlpha(), xx1,yy1,xx2,yy2,xx3,yy3,xx4,yy4); + this->UpdateEffects(); } diff --git a/source/banner/gui_banner.h b/source/banner/gui_banner.h index fd326c4f..eece8927 100644 --- a/source/banner/gui_banner.h +++ b/source/banner/gui_banner.h @@ -13,17 +13,23 @@ class GuiBanner : public GuiImage { public: - GuiBanner(); + //!Constructor + //!\param tplfilepath Path of the tpl file GuiBanner(const char *tplfilepath); - GuiBanner(void *mem,u32 len,u16 w, u16 h); + //!Constructor + //!\param mem Memory of the loaded tpl + //!\param len Filesize of the tpl + //!\param w Width of the tpl + //!\param h Height of the tpl + GuiBanner(void *mem, u32 len, int w, int h); + //!Destructor ~GuiBanner(); - void Draw(); -private: - f32 deg_beta; - const char *filepath; - const void *memory; +protected: + void * memory; bool filecheck; + u32 tplfilesize; + GXTexObj texObj; }; #endif /* _GUIBANNER_H_ */ diff --git a/source/banner/openingbnr.h b/source/banner/openingbnr.h index 64eedac2..818c446f 100644 --- a/source/banner/openingbnr.h +++ b/source/banner/openingbnr.h @@ -27,7 +27,8 @@ extern "C" //! Extract opening.bnr from filepath to destpath //! Files extracted: banner.bin icon.bin and sound.bin -int extractbnrfile(char * filepath, char * destpath); +int extractbnrfile(const char * filepath, const char * destpath); +int unpackBin(const char * filename,const char * outdir); //int unpackBanner(const char * filename,const char * outdir); int unpackBanner(const char * gameid, const char * outdir); //! Extract the lz77 compressed banner, icon and sound .bin diff --git a/source/video.cpp b/source/video.cpp index 9212e495..3e98de3f 100644 --- a/source/video.cpp +++ b/source/video.cpp @@ -427,188 +427,48 @@ void Menu_DrawDiskCover(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 GX_SetVtxDesc (GX_VA_TEX0, GX_NONE); } -void Menu_DrawTPL(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 distance,const char *filepath, - f32 deg_alpha, f32 deg_beta, f32 scaleX, f32 scaleY, u8 alpha, bool shadow) -{ - TPLFile tplfile; - GXTexObj texObj; - - TPL_OpenTPLFromFile(&tplfile,filepath); - TPL_GetTexture(&tplfile,0,&texObj); //Get - - GX_LoadTexObj(&texObj, GX_TEXMAP0); - GX_InvalidateTexAll(); - - TPL_CloseTPLFile(&tplfile); - - GX_SetTevOp (GX_TEVSTAGE0, GX_REPLACE); - GX_SetVtxDesc (GX_VA_TEX0, GX_DIRECT); - - f32 cos_beta = cos(DegToRad(deg_beta)); - f32 s_offset_y = (zpos + (cos_beta * distance)) * tan(DegToRad(5)); - f32 s_offset_x = (cos_beta<0?-cos_beta:cos_beta) * s_offset_y; - f32 s_offset_z = (s_offset_y<0 ? 0 : s_offset_y)*2; - - Mtx m,m1,m2,m3,m4, mv; - width *=.5; - height*=.5; - guMtxIdentity (m4); - guMtxTransApply(m4,m4, 0, 0, distance); - - guMtxIdentity (m1); - guMtxScaleApply(m1,m1,scaleX,scaleY,1.0); - guVector axis2 = (guVector) {0 , 1, 0 }; - guMtxRotAxisDeg (m2, &axis2, deg_beta); - guVector axis = (guVector) {0 , 0, 1 }; - guMtxRotAxisDeg (m3, &axis, deg_alpha); -// guMtxConcat(m2,m1,m); - guMtxConcat(m3,m4,m3); // move distance then rotate z-axis - guMtxConcat(m2,m3,m2); // rotate y-axis - guMtxConcat(m1,m2,m); // scale - - if(shadow) - guMtxTransApply(m,m, xpos+width+0.5+s_offset_x,ypos+height+0.5+s_offset_y,zpos-s_offset_z); - else - guMtxTransApply(m,m, xpos+width+0.5,ypos+height+0.5,zpos); - - guMtxConcat (GXmodelView2D, m, mv); - GX_LoadPosMtxImm (mv, GX_PNMTX0); - - if(shadow) - { - GX_Begin(GX_QUADS, GX_VTXFMT0,4); - GX_Position3f32(-width, -height, 0); - GX_Color4u8(0,0,0,alpha); - GX_TexCoord2f32(0, 0); - - GX_Position3f32(width, -height, 0); - GX_Color4u8(0,0,0,alpha); - GX_TexCoord2f32(1, 0); - - GX_Position3f32(width, height, 0); - GX_Color4u8(0,0,0,alpha); - GX_TexCoord2f32(1, 1); - - GX_Position3f32(-width, height, 0); - GX_Color4u8(0,0,0,alpha); - GX_TexCoord2f32(0, 1); - } - else - { - GX_Begin(GX_QUADS, GX_VTXFMT0,4); - GX_Position3f32(-width, -height, 0); - GX_Color4u8(0xFF,0xFF,0xFF,alpha); - GX_TexCoord2f32(0, 0); - - GX_Position3f32(width, -height, 0); - GX_Color4u8(0xFF,0xFF,0xFF,alpha); - GX_TexCoord2f32(1, 0); - - GX_Position3f32(width, height, 0); - GX_Color4u8(0xFF,0xFF,0xFF,alpha); - GX_TexCoord2f32(1, 1); - - GX_Position3f32(-width, height, 0); - GX_Color4u8(0xFF,0xFF,0xFF,alpha); - GX_TexCoord2f32(0, 1); - } - - GX_End(); - GX_LoadPosMtxImm (GXmodelView2D, GX_PNMTX0); - - GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR); - GX_SetVtxDesc (GX_VA_TEX0, GX_NONE); -} - -void Menu_DrawTPLMem(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 distance,const void *memory,u32 len, - f32 deg_alpha, f32 deg_beta, f32 scaleX, f32 scaleY, u8 alpha, bool shadow) -{ - TPLFile tplfile; - GXTexObj texObj; - - TPL_OpenTPLFromMemory(&tplfile, memory,len); - TPL_GetTexture(&tplfile,0,&texObj); //Get - - GX_LoadTexObj(&texObj, GX_TEXMAP0); - GX_InvalidateTexAll(); - - TPL_CloseTPLFile(&tplfile); - - GX_SetTevOp (GX_TEVSTAGE0, GX_REPLACE); - GX_SetVtxDesc (GX_VA_TEX0, GX_DIRECT); - - f32 cos_beta = cos(DegToRad(deg_beta)); - f32 s_offset_y = (zpos + (cos_beta * distance)) * tan(DegToRad(5)); - f32 s_offset_x = (cos_beta<0?-cos_beta:cos_beta) * s_offset_y; - f32 s_offset_z = (s_offset_y<0 ? 0 : s_offset_y)*2; - - Mtx m,m1,m2,m3,m4, mv; - width *=.5; - height*=.5; - guMtxIdentity (m4); - guMtxTransApply(m4,m4, 0, 0, distance); - - guMtxIdentity (m1); - guMtxScaleApply(m1,m1,scaleX,scaleY,1.0); - guVector axis2 = (guVector) {0 , 1, 0 }; - guMtxRotAxisDeg (m2, &axis2, deg_beta); - guVector axis = (guVector) {0 , 0, 1 }; - guMtxRotAxisDeg (m3, &axis, deg_alpha); -// guMtxConcat(m2,m1,m); - guMtxConcat(m3,m4,m3); // move distance then rotate z-axis - guMtxConcat(m2,m3,m2); // rotate y-axis - guMtxConcat(m1,m2,m); // scale - - if(shadow) - guMtxTransApply(m,m, xpos+width+0.5+s_offset_x,ypos+height+0.5+s_offset_y,zpos-s_offset_z); - else - guMtxTransApply(m,m, xpos+width+0.5,ypos+height+0.5,zpos); - - guMtxConcat (GXmodelView2D, m, mv); - GX_LoadPosMtxImm (mv, GX_PNMTX0); - - if(shadow) - { - GX_Begin(GX_QUADS, GX_VTXFMT0,4); - GX_Position3f32(-width, -height, 0); - GX_Color4u8(0,0,0,alpha); - GX_TexCoord2f32(0, 0); - - GX_Position3f32(width, -height, 0); - GX_Color4u8(0,0,0,alpha); - GX_TexCoord2f32(1, 0); - - GX_Position3f32(width, height, 0); - GX_Color4u8(0,0,0,alpha); - GX_TexCoord2f32(1, 1); - - GX_Position3f32(-width, height, 0); - GX_Color4u8(0,0,0,alpha); - GX_TexCoord2f32(0, 1); - } - else - { - GX_Begin(GX_QUADS, GX_VTXFMT0,4); - GX_Position3f32(-width, -height, 0); - GX_Color4u8(0xFF,0xFF,0xFF,alpha); - GX_TexCoord2f32(0, 0); - - GX_Position3f32(width, -height, 0); - GX_Color4u8(0xFF,0xFF,0xFF,alpha); - GX_TexCoord2f32(1, 0); - - GX_Position3f32(width, height, 0); - GX_Color4u8(0xFF,0xFF,0xFF,alpha); - GX_TexCoord2f32(1, 1); - - GX_Position3f32(-width, height, 0); - GX_Color4u8(0xFF,0xFF,0xFF,alpha); - GX_TexCoord2f32(0, 1); - } - - GX_End(); - GX_LoadPosMtxImm (GXmodelView2D, GX_PNMTX0); - - GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR); - GX_SetVtxDesc (GX_VA_TEX0, GX_NONE); -} +void Menu_DrawTPLImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, GXTexObj *texObj, + f32 degrees, f32 scaleX, f32 scaleY, u8 alpha, int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int XX4, int YY4) +{ + GX_LoadTexObj(texObj, GX_TEXMAP0); + GX_InvalidateTexAll(); + + GX_SetTevOp (GX_TEVSTAGE0, GX_REPLACE); + GX_SetVtxDesc (GX_VA_TEX0, GX_DIRECT); + + Mtx m,m1,m2, mv; + width *=.5; + height*=.5; + guMtxIdentity (m1); + guMtxScaleApply(m1,m1,scaleX,scaleY,1.0); + guVector axis = (guVector) {0 , 0, 1 }; + guMtxRotAxisDeg (m2, &axis, degrees); + guMtxConcat(m1,m2,m); + + guMtxTransApply(m,m, xpos+width+0.5,ypos+height+0.5,zpos); + guMtxConcat (GXmodelView2D, m, mv); + GX_LoadPosMtxImm (mv, GX_PNMTX0); + + GX_Begin(GX_QUADS, GX_VTXFMT0,4); + GX_Position3f32(-width+XX1 , -height+YY1, 0); + GX_Color4u8(0xFF,0xFF,0xFF,alpha); + GX_TexCoord2f32(0, 0); + + GX_Position3f32(width+XX2, -height+YY2, 0); + GX_Color4u8(0xFF,0xFF,0xFF,alpha); + GX_TexCoord2f32(1, 0); + + GX_Position3f32(width+XX3, height+YY3, 0); + GX_Color4u8(0xFF,0xFF,0xFF,alpha); + GX_TexCoord2f32(1, 1); + + GX_Position3f32(-width+XX4, height+YY4, 0); + GX_Color4u8(0xFF,0xFF,0xFF,alpha); + GX_TexCoord2f32(0, 1); + + GX_End(); + GX_LoadPosMtxImm (GXmodelView2D, GX_PNMTX0); + + GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR); + GX_SetVtxDesc (GX_VA_TEX0, GX_NONE); +} diff --git a/source/video.h b/source/video.h index 6bb4f5c7..56f891f3 100644 --- a/source/video.h +++ b/source/video.h @@ -15,12 +15,10 @@ void InitVideo (); void StopGX(); void ResetVideo_Menu(); void Menu_Render(); -void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, u8 data[], +void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, u8 data[], f32 degrees, f32 scaleX, f32 scaleY, u8 alphaF ,int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int XX4, int YY4); -void Menu_DrawTPL(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 distance, - const char *filepath,f32 deg_alpha, f32 deg_beta, f32 scaleX, f32 scaleY, u8 alpha, bool shadow); -void Menu_DrawTPLMem(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 distance, - const void *memory,u32 len, f32 deg_alpha, f32 deg_beta, f32 scaleX, f32 scaleY, u8 alpha, bool shadow); +void Menu_DrawTPLImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, GXTexObj *texObj, + f32 degrees, f32 scaleX, f32 scaleY, u8 alpha, int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int XX4, int YY4); void Menu_DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 filled); extern int screenheight;