From 714aafa267cf4716041fccb4ddd739398ea19ac9 Mon Sep 17 00:00:00 2001
From: dimok321 <15055714+dimok789@users.noreply.github.com>
Date: Sat, 27 Feb 2010 18:18:01 +0000
Subject: [PATCH] *Added WiiPowers Brawl+ stuff (Thanks WiiPower)
---
gui.pnproj | 2 +-
source/menu/menu_disclist.cpp | 3236 +++++++++++++++---------------
source/patches/codehandler.h | 277 +++
source/patches/codehandleronly.h | 180 ++
source/patches/fst.c | 774 ++++++-
source/patches/fst.h | 10 +-
source/patches/multidol.c | 36 +
source/patches/multidol.h | 14 +
source/patches/patchcode.c | 289 ++-
source/patches/patchcode.h | 8 +-
source/usbloader/alternatedol.c | 4 +-
source/usbloader/apploader.c | 32 +-
source/usbloader/apploader.h | 2 +-
source/usbloader/disc.c | 40 +-
source/usbloader/disc.h | 14 +-
source/usbloader/usbstorage2.h | 6 +-
16 files changed, 3100 insertions(+), 1824 deletions(-)
create mode 100644 source/patches/codehandler.h
create mode 100644 source/patches/codehandleronly.h
create mode 100644 source/patches/multidol.c
create mode 100644 source/patches/multidol.h
diff --git a/gui.pnproj b/gui.pnproj
index 5ab34d26..f3128446 100644
--- a/gui.pnproj
+++ b/gui.pnproj
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/source/menu/menu_disclist.cpp b/source/menu/menu_disclist.cpp
index 03a76c41..3ee5cc6b 100644
--- a/source/menu/menu_disclist.cpp
+++ b/source/menu/menu_disclist.cpp
@@ -1,1626 +1,1610 @@
-#include "menus.h"
-#include "fatmounter.h"
-#include "usbloader/wdvd.h"
-#include "usbloader/getentries.h"
-#include "usbloader/wbfs.h"
-#include "patches/fst.h"
-#include "network/networkops.h"
-#include "prompts/gameinfo.h"
-#include "prompts/DiscBrowser.h"
-#include "settings/Settings.h"
-#include "wpad.h"
-#include "sys.h"
-
-#include "libwiigui/gui_gamebrowser.h"
-#include "libwiigui/gui_gamegrid.h"
-#include "libwiigui/gui_gamecarousel.h"
-#include "libwiigui/gui_searchbar.h"
-
-#define MAX_CHARACTERS 38
-extern u8 * gameScreenTex;
-extern struct discHdr *dvdheader;
-extern u8 mountMethod;
-extern int load_from_fs;
-extern s32 gameSelected;
-extern GuiText * GameIDTxt;
-extern GuiText * GameRegionTxt;
-extern const u8 data1;
-extern FreeTypeGX *fontClock;
-extern bool updateavailable;
-extern int cntMissFiles;
-extern GuiImageData * cover;
-extern GuiImage * coverImg;
-extern GuiImageData * pointer[4];
-extern bool altdoldefault;
-extern GuiImage * bgImg;
-
-GuiButton *Toolbar[9];
-int idiotFlag=-1;
-char idiotChar[50];
-
-void DiscListWinUpdateCallback(void * e);
-void rockout(int f = 0);
-
-static u32 startat = 0;
-
-/****************************************************************************
- * MenuDiscList
- ***************************************************************************/
-int MenuDiscList() {
-
- gprintf("\nMenuDiscList()");
- //TakeScreenshot("SD:/screenshot1.png");
- __Menu_GetEntries();
- int offset = MIN(startat,gameCnt-1);
- startat = offset;
- //gprintf("\n\tstartat:%d offset:%d",startat,offset);
- int datag = 0;
- int datagB =0;
- int dataed = -1;
- int cosa=0,sina=0;
- int selectImg1 = 0;
- char ID[4];
- char IDfull[7];
- u32 covert = 0;
- char imgPath[100];
- if (!dvdheader)
- dvdheader = new struct discHdr;
- u8 mountMethodOLD =0;
-
- WDVD_GetCoverStatus(&covert);
- u32 covertOld=covert;
-
- f32 freespace, used, size = 0.0;
- wchar_t searchChar;
- //SCREENSAVER
- int check = 0; //to skip the first cycle when wiimote isn't completely connected
-
- datagB=0;
- int menu = MENU_NONE, dataef=0;
-
-
- u32 nolist;
- char text[MAX_CHARACTERS + 4];
- int choice = 0, selectedold = 100;
- s32 ret;
-
- //CLOCK
- struct tm * timeinfo;
- char theTime[80]="";
- time_t lastrawtime=0;
-
- if (mountMethod != 3 && WBFS_ShowFreeSpace()) {
- WBFS_DiskSpace(&used, &freespace);
- }
-
- if (!gameCnt) { //if there is no list of games to display
- nolist = 1;
- }
-
- GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
- // because destroy GuiSound must wait while sound playing is finished, we use a global sound
- if(!btnClick2) btnClick2=new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
- // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
-
- snprintf(imgPath, sizeof(imgPath), "%sbutton_install.png", CFG.theme_path);
- GuiImageData btnInstall(imgPath, button_install_png);
- snprintf(imgPath, sizeof(imgPath), "%sbutton_install_over.png", CFG.theme_path);
- GuiImageData btnInstallOver(imgPath, button_install_over_png);
-
- snprintf(imgPath, sizeof(imgPath), "%ssettings_button.png", CFG.theme_path);
- GuiImageData btnSettings(imgPath, settings_button_png);
- snprintf(imgPath, sizeof(imgPath), "%ssettings_button_over.png", CFG.theme_path);
- GuiImageData btnSettingsOver(imgPath, settings_button_over_png);
- GuiImageData dataID(&data1);
-
- snprintf(imgPath, sizeof(imgPath), "%swiimote_poweroff.png", CFG.theme_path);
- GuiImageData btnpwroff(imgPath, wiimote_poweroff_png);
- snprintf(imgPath, sizeof(imgPath), "%swiimote_poweroff_over.png", CFG.theme_path);
- GuiImageData btnpwroffOver(imgPath, wiimote_poweroff_over_png);
- snprintf(imgPath, sizeof(imgPath), "%smenu_button.png", CFG.theme_path);
- GuiImageData btnhome(imgPath, menu_button_png);
- snprintf(imgPath, sizeof(imgPath), "%smenu_button_over.png", CFG.theme_path);
- GuiImageData btnhomeOver(imgPath, menu_button_over_png);
- snprintf(imgPath, sizeof(imgPath), "%sSDcard_over.png", CFG.theme_path);
- GuiImageData btnsdcardOver(imgPath, sdcard_over_png);
- snprintf(imgPath, sizeof(imgPath), "%sSDcard.png", CFG.theme_path);
- GuiImageData btnsdcard(imgPath, sdcard_png);
-
-
- snprintf(imgPath, sizeof(imgPath), "%sfavIcon.png", CFG.theme_path);
- GuiImageData imgfavIcon(imgPath, favIcon_png);
- snprintf(imgPath, sizeof(imgPath), "%sfavIcon_gray.png", CFG.theme_path);
- GuiImageData imgfavIcon_gray(imgPath, NULL);
- snprintf(imgPath, sizeof(imgPath), "%ssearchIcon.png", CFG.theme_path);
- GuiImageData imgsearchIcon(imgPath, searchIcon_png);
- snprintf(imgPath, sizeof(imgPath), "%ssearchIcon_gray.png", CFG.theme_path);
- GuiImageData imgsearchIcon_gray(imgPath, NULL);
- snprintf(imgPath, sizeof(imgPath), "%sabcIcon.png", CFG.theme_path);
- GuiImageData imgabcIcon(imgPath, abcIcon_png);
- snprintf(imgPath, sizeof(imgPath), "%sabcIcon_gray.png", CFG.theme_path);
- GuiImageData imgabcIcon_gray(imgPath, NULL);
- snprintf(imgPath, sizeof(imgPath), "%srankIcon.png", CFG.theme_path);
- GuiImageData imgrankIcon(imgPath, rankIcon_png);
- snprintf(imgPath, sizeof(imgPath), "%srankIcon_gray.png", CFG.theme_path);
- GuiImageData imgrankIcon_gray(imgPath, NULL);
- snprintf(imgPath, sizeof(imgPath), "%splayCountIcon.png", CFG.theme_path);
- GuiImageData imgplayCountIcon(imgPath, playCountIcon_png);
- snprintf(imgPath, sizeof(imgPath), "%splayCountIcon_gray.png", CFG.theme_path);
- GuiImageData imgplayCountIcon_gray(imgPath, NULL);
- snprintf(imgPath, sizeof(imgPath), "%sarrangeGrid.png", CFG.theme_path);
- GuiImageData imgarrangeGrid(imgPath, arrangeGrid_png);
- snprintf(imgPath, sizeof(imgPath), "%sarrangeGrid_gray.png", CFG.theme_path);
- GuiImageData imgarrangeGrid_gray(imgPath, NULL);
- snprintf(imgPath, sizeof(imgPath), "%sarrangeList.png", CFG.theme_path);
- GuiImageData imgarrangeList(imgPath, arrangeList_png);
- snprintf(imgPath, sizeof(imgPath), "%sarrangeList_gray.png", CFG.theme_path);
- GuiImageData imgarrangeList_gray(imgPath, NULL);
- snprintf(imgPath, sizeof(imgPath), "%sarrangeCarousel.png", CFG.theme_path);
- GuiImageData imgarrangeCarousel(imgPath, arrangeCarousel_png);
- snprintf(imgPath, sizeof(imgPath), "%sarrangeCarousel_gray.png", CFG.theme_path);
- GuiImageData imgarrangeCarousel_gray(imgPath, NULL);
-
- snprintf(imgPath, sizeof(imgPath), "%slock.png", CFG.theme_path);
- GuiImageData imgLock(imgPath, lock_png);
- snprintf(imgPath, sizeof(imgPath), "%slock_gray.png", CFG.theme_path);
- GuiImageData imgLock_gray(imgPath, NULL);
- snprintf(imgPath, sizeof(imgPath), "%sunlock.png", CFG.theme_path);
- GuiImageData imgUnlock(imgPath, unlock_png);
- snprintf(imgPath, sizeof(imgPath), "%sunlock_gray.png", CFG.theme_path);
- GuiImageData imgUnlock_gray(imgPath, NULL);
-
- snprintf(imgPath, sizeof(imgPath), "%sdvd.png", CFG.theme_path);
- GuiImageData imgdvd(imgPath, dvd_png);
- snprintf(imgPath, sizeof(imgPath), "%sdvd_gray.png", CFG.theme_path);
- GuiImageData imgdvd_gray(imgPath, NULL);
-
- snprintf(imgPath, sizeof(imgPath), "%sbrowser.png", CFG.theme_path);
- GuiImageData homebrewImgData(imgPath, browser_png);
- snprintf(imgPath, sizeof(imgPath), "%sbrowser_over.png", CFG.theme_path);
- GuiImageData homebrewImgDataOver(imgPath, browser_over_png);
-
-
- GuiTrigger trigA;
- trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
- GuiTrigger trigHome;
- trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, PAD_BUTTON_START);
- GuiTrigger trig2;
- trig2.SetButtonOnlyTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_X, 0);
- GuiTrigger trig1;
- trig1.SetButtonOnlyTrigger(-1, WPAD_BUTTON_1 | WPAD_CLASSIC_BUTTON_Y, 0);
- GuiTrigger trigZ;
- trigZ.SetButtonOnlyTrigger(-1, WPAD_NUNCHUK_BUTTON_Z | WPAD_CLASSIC_BUTTON_ZL, PAD_TRIGGER_Z);
-
- GuiButton screenShotBtn(0,0);
- screenShotBtn.SetPosition(0,0);
- screenShotBtn.SetTrigger(&trigZ);
-
- char spaceinfo[30];
- if (load_from_fs == PART_FS_FAT) {
- memset(spaceinfo, 0, 30);
- } else {
- if (!strcmp(Settings.db_language,"JA")) {
- // needs to be "total...used" for Japanese
- sprintf(spaceinfo,(mountMethod!=3?"%.2fGB %s %.2fGB %s":" "),(freespace+used),tr("of"),freespace,tr("free"));
- } else {
- sprintf(spaceinfo,(mountMethod!=3?"%.2fGB %s %.2fGB %s":" "),freespace,tr("of"),(freespace+used),tr("free"));
- }
- }
- GuiText usedSpaceTxt(spaceinfo, 18, THEME.info);
- usedSpaceTxt.SetAlignment(THEME.hddinfo_align, ALIGN_TOP);
- usedSpaceTxt.SetPosition(THEME.hddinfo_x, THEME.hddinfo_y);
-
- char GamesCnt[15];
- sprintf(GamesCnt,"%s: %i",(mountMethod!=3?tr("Games"):tr("Channels")), gameCnt);
- GuiText gamecntTxt(GamesCnt, 18, THEME.info);
-
- GuiButton gamecntBtn(100,18);
- gamecntBtn.SetAlignment(THEME.gamecount_align, ALIGN_TOP);
- gamecntBtn.SetPosition(THEME.gamecount_x,THEME.gamecount_y);
- gamecntBtn.SetLabel(&gamecntTxt);
- gamecntBtn.SetEffectGrow();
- gamecntBtn.SetTrigger(&trigA);
-
- GuiTooltip installBtnTT(tr("Install a game"));
- if (Settings.wsprompt == yes)
- installBtnTT.SetWidescreen(CFG.widescreen);
- installBtnTT.SetAlpha(THEME.tooltipAlpha);
- GuiImage installBtnImg(&btnInstall);
- GuiImage installBtnImgOver(&btnInstallOver);
- installBtnImg.SetWidescreen(CFG.widescreen);
- installBtnImgOver.SetWidescreen(CFG.widescreen);
-
- GuiButton installBtn(&installBtnImg, &installBtnImgOver, ALIGN_LEFT, ALIGN_TOP, THEME.install_x, THEME.install_y, &trigA, &btnSoundOver, btnClick2, 1, &installBtnTT,24,-30, 0,5);
-
-
- GuiTooltip settingsBtnTT(tr("Settings"));
- if (Settings.wsprompt == yes)
- settingsBtnTT.SetWidescreen(CFG.widescreen);
- settingsBtnTT.SetAlpha(THEME.tooltipAlpha);
- GuiImage settingsBtnImg(&btnSettings);
- settingsBtnImg.SetWidescreen(CFG.widescreen);
- GuiImage settingsBtnImgOver(&btnSettingsOver);
- settingsBtnImgOver.SetWidescreen(CFG.widescreen);
- GuiButton settingsBtn(&settingsBtnImg,&settingsBtnImgOver, 0, 3, THEME.setting_x, THEME.setting_y, &trigA, &btnSoundOver, btnClick2,1,&settingsBtnTT,65,-30,0,5);
-
- GuiTooltip homeBtnTT(tr("Back to HBC or Wii Menu"));
- if (Settings.wsprompt == yes)
- homeBtnTT.SetWidescreen(CFG.widescreen);
- settingsBtnTT.SetAlpha(THEME.tooltipAlpha);
- GuiImage homeBtnImg(&btnhome);
- homeBtnImg.SetWidescreen(CFG.widescreen);
- GuiImage homeBtnImgOver(&btnhomeOver);
- homeBtnImgOver.SetWidescreen(CFG.widescreen);
- GuiButton homeBtn(&homeBtnImg,&homeBtnImgOver, 0, 3, THEME.home_x, THEME.home_y, &trigA, &btnSoundOver, btnClick2,1,&homeBtnTT,15,-30,1,5);
- homeBtn.RemoveSoundClick();
- homeBtn.SetTrigger(&trigHome);
-
- GuiTooltip poweroffBtnTT(tr("Power off the Wii"));
- if (Settings.wsprompt == yes)
- poweroffBtnTT.SetWidescreen(CFG.widescreen);
- poweroffBtnTT.SetAlpha(THEME.tooltipAlpha);
- GuiImage poweroffBtnImg(&btnpwroff);
- GuiImage poweroffBtnImgOver(&btnpwroffOver);
- poweroffBtnImg.SetWidescreen(CFG.widescreen);
- poweroffBtnImgOver.SetWidescreen(CFG.widescreen);
- GuiButton poweroffBtn(&poweroffBtnImg,&poweroffBtnImgOver, 0, 3, THEME.power_x, THEME.power_y, &trigA, &btnSoundOver, btnClick2,1,&poweroffBtnTT,-10,-30,1,5);
-
- GuiTooltip sdcardBtnTT(tr("Reload SD"));
- if (Settings.wsprompt == yes)
- sdcardBtnTT.SetWidescreen(CFG.widescreen);
- sdcardBtnTT.SetAlpha(THEME.tooltipAlpha);
- GuiImage sdcardImg(&btnsdcard);
- GuiImage sdcardImgOver(&btnsdcardOver);
- sdcardImg.SetWidescreen(CFG.widescreen);
- sdcardImgOver.SetWidescreen(CFG.widescreen);
- GuiButton sdcardBtn(&sdcardImg,&sdcardImgOver, 0, 3, THEME.sdcard_x, THEME.sdcard_y, &trigA, &btnSoundOver, btnClick2,1,&sdcardBtnTT,15,-30,0,5);
-
- GuiButton gameInfo(0,0);
- gameInfo.SetTrigger(&trig2);
- gameInfo.SetSoundClick(btnClick2);
-
-
- GuiImage wiiBtnImg(&dataID);
- wiiBtnImg.SetWidescreen(CFG.widescreen);
- GuiButton wiiBtn(&wiiBtnImg,&wiiBtnImg, 0, 4, 0, -10, &trigA, &btnSoundOver, btnClick2,0);
-
- GuiTooltip favoriteBtnTT(tr("Display favorites"));
- if (Settings.wsprompt == yes)
- favoriteBtnTT.SetWidescreen(CFG.widescreen);
- favoriteBtnTT.SetAlpha(THEME.tooltipAlpha);
- GuiImage favoriteBtnImg(&imgfavIcon);
- favoriteBtnImg.SetWidescreen(CFG.widescreen);
-// GuiImage favoriteBtnImg_g(favoriteBtnImg);favoriteBtnImg_g.SetGrayscale();
- GuiImage favoriteBtnImg_g(&imgfavIcon_gray);
- if(favoriteBtnImg_g.GetImage() == NULL) { favoriteBtnImg_g = favoriteBtnImg; favoriteBtnImg_g.SetGrayscale();}
- favoriteBtnImg_g.SetWidescreen(CFG.widescreen);
- GuiButton favoriteBtn(&favoriteBtnImg_g,&favoriteBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_favorite_x, THEME.gamelist_favorite_y, &trigA, &btnSoundOver, btnClick2,1, &favoriteBtnTT, -15, 52, 0, 3);
- favoriteBtn.SetAlpha(180);
-
- GuiTooltip searchBtnTT(tr("Set Search-Filter"));
- if (Settings.wsprompt == yes)
- searchBtnTT.SetWidescreen(CFG.widescreen);
- searchBtnTT.SetAlpha(THEME.tooltipAlpha);
- GuiImage searchBtnImg(&imgsearchIcon);
- searchBtnImg.SetWidescreen(CFG.widescreen);
-// GuiImage searchBtnImg_g(searchBtnImg); searchBtnImg_g.SetGrayscale();
- GuiImage searchBtnImg_g(&imgsearchIcon_gray);
- if(searchBtnImg_g.GetImage() == NULL) { searchBtnImg_g = searchBtnImg; searchBtnImg_g.SetGrayscale();}
- searchBtnImg_g.SetWidescreen(CFG.widescreen);
- GuiButton searchBtn(&searchBtnImg_g,&searchBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_search_x, THEME.gamelist_search_y, &trigA, &btnSoundOver, btnClick2,1, &searchBtnTT, -15, 52, 0, 3);
- searchBtn.SetAlpha(180);
-
- GuiTooltip abcBtnTT(Settings.fave ? tr("Sort by rank") : tr("Sort alphabetically"));
- if (Settings.wsprompt == yes)
- abcBtnTT.SetWidescreen(CFG.widescreen);
- abcBtnTT.SetAlpha(THEME.tooltipAlpha);
- GuiImage abcBtnImg(Settings.fave ? &imgrankIcon : &imgabcIcon);
- abcBtnImg.SetWidescreen(CFG.widescreen);
-// GuiImage abcBtnImg_g(abcBtnImg); abcBtnImg_g.SetGrayscale();
- GuiImage abcBtnImg_g(Settings.fave ? &imgrankIcon_gray : &imgabcIcon_gray);
- if(abcBtnImg_g.GetImage() == NULL) { abcBtnImg_g = abcBtnImg; abcBtnImg_g.SetGrayscale();}
- abcBtnImg_g.SetWidescreen(CFG.widescreen);
- GuiButton abcBtn(&abcBtnImg_g,&abcBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_abc_x, THEME.gamelist_abc_y, &trigA, &btnSoundOver, btnClick2,1,&abcBtnTT, -15, 52, 0, 3);
- abcBtn.SetAlpha(180);
-
- GuiTooltip countBtnTT(tr("Sort order by most played"));
- if (Settings.wsprompt == yes)
- countBtnTT.SetWidescreen(CFG.widescreen);
- countBtnTT.SetAlpha(THEME.tooltipAlpha);
- GuiImage countBtnImg(&imgplayCountIcon);
- countBtnImg.SetWidescreen(CFG.widescreen);
-// GuiImage countBtnImg_g(countBtnImg); countBtnImg_g.SetGrayscale();
- GuiImage countBtnImg_g(&imgplayCountIcon_gray);
- if(countBtnImg_g.GetImage() == NULL) { countBtnImg_g = countBtnImg; countBtnImg_g.SetGrayscale();}
- countBtnImg_g.SetWidescreen(CFG.widescreen);
- GuiButton countBtn(&countBtnImg_g,&countBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_count_x, THEME.gamelist_count_y, &trigA, &btnSoundOver, btnClick2,1, &countBtnTT, -15, 52, 0, 3);
- countBtn.SetAlpha(180);
-
- GuiTooltip listBtnTT(tr("Display as a list"));
- if (Settings.wsprompt == yes)
- listBtnTT.SetWidescreen(CFG.widescreen);
- listBtnTT.SetAlpha(THEME.tooltipAlpha);
- GuiImage listBtnImg(&imgarrangeList);
- listBtnImg.SetWidescreen(CFG.widescreen);
-// GuiImage listBtnImg_g(listBtnImg); listBtnImg_g.SetGrayscale();
- GuiImage listBtnImg_g(&imgarrangeList_gray);
- if(listBtnImg_g.GetImage() == NULL) { listBtnImg_g = listBtnImg; listBtnImg_g.SetGrayscale();}
- listBtnImg_g.SetWidescreen(CFG.widescreen);
- GuiButton listBtn(&listBtnImg_g,&listBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_list_x, THEME.gamelist_list_y, &trigA, &btnSoundOver, btnClick2,1, &listBtnTT, 15, 52, 1, 3);
- listBtn.SetAlpha(180);
-
- GuiTooltip gridBtnTT(tr("Display as a grid"));
- if (Settings.wsprompt == yes)
- gridBtnTT.SetWidescreen(CFG.widescreen);
- gridBtnTT.SetAlpha(THEME.tooltipAlpha);
- GuiImage gridBtnImg(&imgarrangeGrid);
- gridBtnImg.SetWidescreen(CFG.widescreen);
-// GuiImage gridBtnImg_g(gridBtnImg); gridBtnImg_g.SetGrayscale();
- GuiImage gridBtnImg_g(&imgarrangeGrid_gray);
- if(gridBtnImg_g.GetImage() == NULL) { gridBtnImg_g = gridBtnImg; gridBtnImg_g.SetGrayscale();}
- gridBtnImg_g.SetWidescreen(CFG.widescreen);
- GuiButton gridBtn(&gridBtnImg_g,&gridBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_grid_x, THEME.gamelist_grid_y, &trigA, &btnSoundOver, btnClick2,1, &gridBtnTT, 15, 52, 1, 3);
- gridBtn.SetAlpha(180);
-
- GuiTooltip carouselBtnTT(tr("Display as a carousel"));
- if (Settings.wsprompt == yes)
- carouselBtnTT.SetWidescreen(CFG.widescreen);
- carouselBtnTT.SetAlpha(THEME.tooltipAlpha);
- GuiImage carouselBtnImg(&imgarrangeCarousel);
- carouselBtnImg.SetWidescreen(CFG.widescreen);
-// GuiImage carouselBtnImg_g(carouselBtnImg); carouselBtnImg_g.SetGrayscale();
- GuiImage carouselBtnImg_g(&imgarrangeCarousel_gray);
- if(carouselBtnImg_g.GetImage() == NULL) { carouselBtnImg_g = carouselBtnImg; carouselBtnImg_g.SetGrayscale();}
- carouselBtnImg_g.SetWidescreen(CFG.widescreen);
- GuiButton carouselBtn(&carouselBtnImg_g,&carouselBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_carousel_x, THEME.gamelist_carousel_y, &trigA, &btnSoundOver, btnClick2,1, &carouselBtnTT, 15, 52, 1, 3);
- carouselBtn.SetAlpha(180);
-
- bool canUnlock = (Settings.parentalcontrol == 0 && Settings.parental.enabled == 1);
-
- GuiTooltip lockBtnTT(canUnlock ? tr("Unlock Parental Control") : tr("Parental Control disabled"));
- if (Settings.wsprompt == yes)
- lockBtnTT.SetWidescreen(CFG.widescreen);
- lockBtnTT.SetAlpha(THEME.tooltipAlpha);
- GuiImage lockBtnImg(&imgLock);
- lockBtnImg.SetWidescreen(CFG.widescreen);
- GuiImage lockBtnImg_g(&imgLock_gray);
- if(lockBtnImg_g.GetImage() == NULL) { lockBtnImg_g = lockBtnImg; lockBtnImg_g.SetGrayscale(); }
- lockBtnImg_g.SetWidescreen(CFG.widescreen);
- GuiButton lockBtn(&lockBtnImg_g, &lockBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_lock_x, THEME.gamelist_lock_y, &trigA, &btnSoundOver, btnClick2,1, &lockBtnTT, 15, 52, 1, 3);
- lockBtn.SetAlpha(180);
-
- GuiTooltip unlockBtnTT(tr("Enable Parental Control"));
- if (Settings.wsprompt == yes)
- unlockBtnTT.SetWidescreen(CFG.widescreen);
- unlockBtnTT.SetAlpha(THEME.tooltipAlpha);
- GuiImage unlockBtnImg(&imgUnlock);
- unlockBtnImg.SetWidescreen(CFG.widescreen);
- GuiImage unlockBtnImg_g(&imgUnlock_gray);
- if(unlockBtnImg_g.GetImage() == NULL) { unlockBtnImg_g = unlockBtnImg; unlockBtnImg_g.SetGrayscale(); }
- unlockBtnImg_g.SetWidescreen(CFG.widescreen);
-
- if (canUnlock && Settings.godmode)
- {
- lockBtn.SetImage(&unlockBtnImg_g);
- lockBtn.SetImageOver(&unlockBtnImg_g);
- lockBtn.SetToolTip(&unlockBtnTT, 15, 52, 1, 3);
- }
-
-/*
- GuiButton unlockBtn(&unlockBtnImg_g, &unlockBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_lock_x, THEME.gamelist_lock_y, &trigA, &btnSoundOver, btnClick2,1, &lockBtnTT, 15, 52, 1, 3);
- unlockBtn.SetAlpha(180);
-*/
-
- GuiTooltip dvdBtnTT(tr("Mount DVD drive"));
- if (Settings.wsprompt == yes)
- dvdBtnTT.SetWidescreen(CFG.widescreen);
- dvdBtnTT.SetAlpha(THEME.tooltipAlpha);
- GuiImage dvdBtnImg(&imgdvd);
- dvdBtnImg.SetWidescreen(CFG.widescreen);
- GuiImage dvdBtnImg_g(dvdBtnImg); //dvdBtnImg_g.SetGrayscale();
-// GuiImage carouselBtnImg_g(&imgarrangeCarousel_gray);
- dvdBtnImg_g.SetWidescreen(CFG.widescreen);
- GuiButton dvdBtn(&dvdBtnImg_g,&dvdBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_dvd_x, THEME.gamelist_dvd_y, &trigA, &btnSoundOver, btnClick2,1, &dvdBtnTT, 15, 52, 1, 3);
- dvdBtn.SetAlpha(180);
-
- GuiTooltip homebrewBtnTT(tr("Homebrew Launcher"));
- if (Settings.wsprompt == yes)
- homebrewBtnTT.SetWidescreen(CFG.widescreen);
- homebrewBtnTT.SetAlpha(THEME.tooltipAlpha);
- GuiImage homebrewImg(&homebrewImgData);
- GuiImage homebrewImgOver(&homebrewImgDataOver);
- homebrewImg.SetWidescreen(CFG.widescreen);
- homebrewImgOver.SetWidescreen(CFG.widescreen);
- GuiButton homebrewBtn(&homebrewImg,&homebrewImgOver, ALIGN_LEFT, ALIGN_TOP, THEME.homebrew_x, THEME.homebrew_y, &trigA, &btnSoundOver, btnClick2,1,&homebrewBtnTT,15,-30,1,5);
-
- if (Settings.fave) {
- favoriteBtn.SetImage(&favoriteBtnImg);
- favoriteBtn.SetImageOver(&favoriteBtnImg);
- favoriteBtn.SetAlpha(255);
- }
- static bool show_searchwindow = false;
- if(gameFilter && *gameFilter)
- {
- if(show_searchwindow && gameCnt==1)
- show_searchwindow = false;
- if(!show_searchwindow)
- searchBtn.SetEffect(EFFECT_PULSE, 10, 105);
- searchBtn.SetImage(&searchBtnImg);
- searchBtn.SetImageOver(&searchBtnImg);
- searchBtn.SetAlpha(255);
- }
- if (Settings.sort==all) {
- abcBtn.SetImage(&abcBtnImg);
- abcBtn.SetImageOver(&abcBtnImg);
- abcBtn.SetAlpha(255);
- } else if (Settings.sort==pcount) {
- countBtn.SetImage(&countBtnImg);
- countBtn.SetImageOver(&countBtnImg);
- countBtn.SetAlpha(255);
- }
- if (Settings.gameDisplay==list) {
- listBtn.SetImage(&listBtnImg);
- listBtn.SetImageOver(&listBtnImg);
- listBtn.SetAlpha(255);
- } else if (Settings.gameDisplay==grid) {
- gridBtn.SetImage(&gridBtnImg);
- gridBtn.SetImageOver(&gridBtnImg);
- gridBtn.SetAlpha(255);
- } else if (Settings.gameDisplay==carousel) {
- carouselBtn.SetImage(&carouselBtnImg);
- carouselBtn.SetImageOver(&carouselBtnImg);
- carouselBtn.SetAlpha(255);
- }
-
- if (Settings.gameDisplay==list) {
- favoriteBtn.SetPosition(THEME.gamelist_favorite_x, THEME.gamelist_favorite_y);
- searchBtn.SetPosition(THEME.gamelist_search_x, THEME.gamelist_search_y);
- abcBtn.SetPosition(THEME.gamelist_abc_x, THEME.gamelist_abc_y);
- countBtn.SetPosition(THEME.gamelist_count_x, THEME.gamelist_count_y);
- listBtn.SetPosition(THEME.gamelist_list_x, THEME.gamelist_list_y);
- gridBtn.SetPosition(THEME.gamelist_grid_x, THEME.gamelist_grid_y);
- carouselBtn.SetPosition(THEME.gamelist_carousel_x, THEME.gamelist_carousel_y);
- lockBtn.SetPosition(THEME.gamelist_lock_x, THEME.gamelist_lock_y);
- dvdBtn.SetPosition(THEME.gamelist_dvd_x, THEME.gamelist_dvd_y);
- } else if(Settings.gameDisplay==grid) {
- favoriteBtn.SetPosition(THEME.gamegrid_favorite_x, THEME.gamegrid_favorite_y);
- searchBtn.SetPosition(THEME.gamegrid_search_x, THEME.gamegrid_search_y);
- abcBtn.SetPosition(THEME.gamegrid_abc_x, THEME.gamegrid_abc_y);
- countBtn.SetPosition(THEME.gamegrid_count_x, THEME.gamegrid_count_y);
- listBtn.SetPosition(THEME.gamegrid_list_x, THEME.gamegrid_list_y);
- gridBtn.SetPosition(THEME.gamegrid_grid_x, THEME.gamegrid_grid_y);
- carouselBtn.SetPosition(THEME.gamegrid_carousel_x, THEME.gamegrid_carousel_y);
- lockBtn.SetPosition(THEME.gamegrid_lock_x, THEME.gamegrid_lock_y);
- dvdBtn.SetPosition(THEME.gamegrid_dvd_x, THEME.gamegrid_dvd_y);
- } else if(Settings.gameDisplay==carousel) {
- favoriteBtn.SetPosition(THEME.gamecarousel_favorite_x, THEME.gamecarousel_favorite_y);
- searchBtn.SetPosition(THEME.gamecarousel_search_x, THEME.gamecarousel_favorite_y);
- abcBtn.SetPosition(THEME.gamecarousel_abc_x, THEME.gamecarousel_abc_y);
- countBtn.SetPosition(THEME.gamecarousel_count_x, THEME.gamecarousel_count_y);
- listBtn.SetPosition(THEME.gamecarousel_list_x, THEME.gamecarousel_list_y);
- gridBtn.SetPosition(THEME.gamecarousel_grid_x, THEME.gamecarousel_grid_y);
- carouselBtn.SetPosition(THEME.gamecarousel_carousel_x, THEME.gamecarousel_carousel_y);
- lockBtn.SetPosition(THEME.gamecarousel_lock_x, THEME.gamecarousel_lock_y);
- dvdBtn.SetPosition(THEME.gamecarousel_dvd_x, THEME.gamecarousel_dvd_y);
- }
-
-
- //Downloading Covers
- GuiTooltip DownloadBtnTT(tr("Click to Download Covers"));
- if (Settings.wsprompt == yes)
- DownloadBtnTT.SetWidescreen(CFG.widescreen);
- DownloadBtnTT.SetAlpha(THEME.tooltipAlpha);
- GuiButton DownloadBtn(0,0);
- DownloadBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
- DownloadBtn.SetPosition(THEME.covers_x,THEME.covers_y);
-
- GuiTooltip IDBtnTT(tr("Click to change game ID"));
- if (Settings.wsprompt == yes)
- IDBtnTT.SetWidescreen(CFG.widescreen);
- IDBtnTT.SetAlpha(THEME.tooltipAlpha);
- GuiButton idBtn(0,0);
- idBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
- idBtn.SetPosition(THEME.id_x,THEME.id_y);
-
- if (Settings.godmode == 1 && mountMethod!=3) {//only make the button have trigger & tooltip if in godmode
- DownloadBtn.SetSoundOver(&btnSoundOver);
- DownloadBtn.SetTrigger(&trigA);
- DownloadBtn.SetTrigger(&trig1);
- DownloadBtn.SetToolTip(&DownloadBtnTT,205,-30);
-
- idBtn.SetSoundOver(&btnSoundOver);
- idBtn.SetTrigger(&trigA);
- idBtn.SetToolTip(&IDBtnTT,205,-30);
-
- } else
- {
- DownloadBtn.SetRumble(false);
- idBtn.SetRumble(false);
- }
-
- GuiGameBrowser * gameBrowser = NULL;
- GuiGameGrid * gameGrid = NULL;
- GuiGameCarousel * gameCarousel = NULL;
- if (Settings.gameDisplay==list) {
- gameBrowser = new GuiGameBrowser(THEME.gamelist_w, THEME.gamelist_h, gameList, gameCnt, CFG.theme_path, bg_options_png, startat, offset);
- gameBrowser->SetPosition(THEME.gamelist_x, THEME.gamelist_y);
- gameBrowser->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE);
- } else if (Settings.gameDisplay==grid) {
- gameGrid = new GuiGameGrid(THEME.gamegrid_w,THEME.gamegrid_h, gameList, gameCnt, CFG.theme_path, bg_options_png, 0, 0);
- gameGrid->SetPosition(THEME.gamegrid_x,THEME.gamegrid_y);
- gameGrid->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE);
- } else if (Settings.gameDisplay==carousel) {
- //GuiGameCarousel gameCarousel(THEME.gamecarousel_w, THEME.gamecarousel_h, gameList, gameCnt, CFG.theme_path, bg_options_png, startat, offset);
- gameCarousel = new GuiGameCarousel(640, 400, gameList, gameCnt, CFG.theme_path, bg_options_png, startat, offset);
- gameCarousel->SetPosition(THEME.gamecarousel_x,THEME.gamecarousel_y);
- gameCarousel->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE);
- }
-
- GuiText clockTimeBack("88:88", 40, (GXColor) {THEME.clock.r, THEME.clock.g, THEME.clock.b, THEME.clock.a/6});
- clockTimeBack.SetAlignment(THEME.clock_align, ALIGN_TOP);
- clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y);
- clockTimeBack.SetFont(fontClock);
- GuiText clockTime(theTime, 40, THEME.clock);
- clockTime.SetAlignment(THEME.clock_align, ALIGN_TOP);
- clockTime.SetPosition(THEME.clock_x, THEME.clock_y);
- clockTime.SetFont(fontClock);
-
- HaltGui();
- GuiWindow w(screenwidth, screenheight);
-
- if (THEME.show_hddinfo == -1 || THEME.show_hddinfo == 1) { //force show hdd info
- w.Append(&usedSpaceTxt);
- }
- if (THEME.show_gamecount == -1 || THEME.show_gamecount == 1) { //force show game cnt info
- w.Append(&gamecntBtn);
- }
- w.Append(&sdcardBtn);
- w.Append(&poweroffBtn);
- w.Append(&gameInfo);
- if (Settings.godmode) {
- w.Append(&installBtn);
- }
- w.Append(&homeBtn);
- w.Append(&settingsBtn);
- w.Append(&DownloadBtn);
- w.Append(&idBtn);
- w.Append(&screenShotBtn);
-
-
- // Begin Toolbar
- w.Append(&favoriteBtn);
- Toolbar[0] = &favoriteBtn;
- w.Append(&searchBtn);
- Toolbar[1] = &searchBtn;
- w.Append(&abcBtn);
- Toolbar[2] = &abcBtn;
- w.Append(&countBtn);
- Toolbar[3] = &countBtn;
- w.Append(&listBtn);
- Toolbar[4] = &listBtn;
- w.Append(&gridBtn);
- Toolbar[5] = &gridBtn;
- w.Append(&carouselBtn);
- Toolbar[6] = &carouselBtn;
- w.Append(&lockBtn);
- Toolbar[7] = &lockBtn;
- w.Append(&dvdBtn);
- Toolbar[8] = &dvdBtn;
- w.SetUpdateCallback(DiscListWinUpdateCallback);
- // End Toolbar
-
-
-
- if (Settings.godmode == 1)
- w.Append(&homebrewBtn);
-
- if ((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) {
- w.Append(&clockTimeBack);
- w.Append(&clockTime);
- }
-
- if (Settings.gameDisplay==list) {
- mainWindow->Append(gameBrowser);
- }
- if (Settings.gameDisplay==grid) {
- mainWindow->Append(gameGrid);
- }
- if (Settings.gameDisplay==carousel) {
- mainWindow->Append(gameCarousel);
- }
- mainWindow->Append(&w);
-
- GuiSearchBar *searchBar=NULL;
- if(show_searchwindow) {
- searchBar = new GuiSearchBar(gameFilterNextList);
- if(searchBar)
- mainWindow->Append(searchBar);
- }
-
- ResumeGui();
-
-// ShowMemInfo();
-
- while (menu == MENU_NONE) {
-
- if (idiotFlag==1) {
- gprintf("\n\tIdiot flag");
- char idiotBuffer[200];
- snprintf(idiotBuffer, sizeof(idiotBuffer), "%s (%s). %s",tr("You have attempted to load a bad image"),
- idiotChar,tr("Most likely it has dimensions that are not evenly divisible by 4."));
-
- int deleteImg = WindowPrompt(0,idiotBuffer,tr("OK"),tr("Delete"));
- if (deleteImg==0) {
- snprintf(idiotBuffer, sizeof(idiotBuffer), "%s %s.",tr("You are about to delete "), idiotChar);
- deleteImg = WindowPrompt(tr("Confirm"),idiotBuffer,tr("Delete"),tr("Cancel"));
- if (deleteImg==1) {
- remove(idiotChar);
- }
- }
- idiotFlag=-1;
- }
-
- WDVD_GetCoverStatus(&covert);//for detecting if i disc has been inserted
-
- // if the idiot is showing favorites and don't have any
- if (Settings.fave && !gameCnt) {
- WindowPrompt(tr("No Favorites"),tr("You are choosing to display favorites and you do not have any selected."),tr("Back"));
- Settings.fave=!Settings.fave;
- if (isInserted(bootDevice)) {
- cfg_save_global();
- }
- __Menu_GetEntries();
- menu = MENU_DISCLIST;
- break;
- }
-
- //CLOCK
- time_t rawtime = time(0); //this fixes code dump caused by the clock
- if (((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) && rawtime != lastrawtime) {
- lastrawtime = rawtime;
- timeinfo = localtime (&rawtime);
- if (dataed < 1) {
- if (Settings.hddinfo == hr12) {
- if (rawtime & 1)
- strftime(theTime, sizeof(theTime), "%I:%M", timeinfo);
- else
- strftime(theTime, sizeof(theTime), "%I %M", timeinfo);
- }
- if (Settings.hddinfo == hr24) {
- if (rawtime & 1)
- strftime(theTime, sizeof(theTime), "%H:%M", timeinfo);
- else
- strftime(theTime, sizeof(theTime), "%H %M", timeinfo);
- }
- clockTime.SetText(theTime);
-
- } else if (dataed > 0) {
-
- clockTime.SetTextf("%i", (dataed-1));
- }
-
- }
-
- if ((datagB<1)&&(Settings.cios==1)&&(Settings.video == ntsc)&&(Settings.hddinfo == hr12)&&(Settings.qboot==1)&&(Settings.wsprompt==0)&&(Settings.language==ger)&&(Settings.tooltips==0)){dataed=1;dataef=1;}if (dataef==1){if (cosa>7){cosa=1;}datag++;if (sina==3){wiiBtn.SetAlignment(ALIGN_LEFT,ALIGN_BOTTOM);wiiBtnImg.SetAngle(0);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((cosa)*70),(-2*(datag)+120));}else if(62<=datag){wiiBtn.SetPosition(((cosa)*70),((datag*2)-130));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==2){wiiBtn.SetAlignment(ALIGN_RIGHT,ALIGN_TOP);wiiBtnImg.SetAngle(270);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((-2*(datag)+130)),((cosa)*50));}else if(62<=datag){wiiBtn.SetPosition((2*(datag)-120),((cosa)*50));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==1){wiiBtn.SetAlignment(ALIGN_TOP,ALIGN_LEFT);wiiBtnImg.SetAngle(180);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((cosa)*70),(2*(datag)-120));}else if(62<=datag){wiiBtn.SetPosition(((cosa)*70),(-2*(datag)+130));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==0){wiiBtn.SetAlignment(ALIGN_TOP,ALIGN_LEFT);wiiBtnImg.SetAngle(90);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((2*(datag)-130)),((cosa)*50));}else if(62<=datag){wiiBtn.SetPosition((-2*(datag)+120),((cosa)*50));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}}
- // respond to button presses
- if (shutdown == 1) {
- gprintf("\n\tshutdown");
- Sys_Shutdown();
- }
- if (reset == 1)
- Sys_Reboot();
-
- if (updateavailable == true) {
- gprintf("\n\tUpdate Available");
- HaltGui();
- GuiWindow ww(640,480);
- w.SetState(STATE_DISABLED);
- mainWindow->Append(&ww);
- ResumeGui();
- ProgressUpdateWindow();
- updateavailable = false;
- mainWindow->Remove(&ww);
- w.SetState(STATE_DEFAULT);
- menu = MENU_DISCLIST;
- }
-
- if (poweroffBtn.GetState() == STATE_CLICKED) {
-
-
- gprintf("\n\tpoweroffBtn clicked");
- choice = WindowPrompt(tr("How to Shutdown?"),0,tr("Full Shutdown"), tr("Shutdown to Idle"), tr("Cancel"));
- if (choice == 2) {
- Sys_ShutdownToIdel();
- } else if (choice == 1) {
- Sys_ShutdownToStandby();
- } else {
- poweroffBtn.ResetState();
- if (Settings.gameDisplay==list) {
- gameBrowser->SetFocus(1);
- } else if (Settings.gameDisplay==grid) {
- gameGrid->SetFocus(1);
- } else if (Settings.gameDisplay==carousel) {
- gameCarousel->SetFocus(1);
- }
- }
-
- } else if (gamecntBtn.GetState() == STATE_CLICKED && mountMethod!=3) {
- gprintf("\n\tgameCntBtn clicked");
- gamecntBtn.ResetState();
- char linebuf[150];
- snprintf(linebuf, sizeof(linebuf), "%s %sGameList ?",tr("Save Game List to"), Settings.update_path);
- choice = WindowPrompt(0,linebuf,"TXT","CSV",tr("Back"));
- if (choice) {
- if (save_gamelist(choice-1))
- WindowPrompt(0,tr("Saved"),tr("OK"));
- else
- WindowPrompt(tr("Error"),tr("Could not save."),tr("OK"));
- }
- menu = MENU_DISCLIST;
- break;
-
- }
- else if (screenShotBtn.GetState() == STATE_CLICKED) {
- gprintf("\n\tscreenShotBtn clicked");
- screenShotBtn.ResetState();
- ScreenShot();
- gprintf("...It's easy, mmmmmmKay");
-
-
- }else if (homeBtn.GetState() == STATE_CLICKED) {
- gprintf("\n\thomeBtn clicked");
- bgMusic->Pause();
- choice = WindowExitPrompt();
- bgMusic->Resume();
-
- if (choice == 3) {
- Sys_LoadMenu(); // Back to System Menu
- } else if (choice == 2) {
- Sys_BackToLoader();
- } else {
- homeBtn.ResetState();
- if (Settings.gameDisplay==list) {
- gameBrowser->SetFocus(1);
- } else if (Settings.gameDisplay==grid) {
- gameGrid->SetFocus(1);
- } else if (Settings.gameDisplay==carousel) {
- gameCarousel->SetFocus(1);
- }
- }
-
- } else if (wiiBtn.GetState() == STATE_CLICKED) {
- gprintf("\n\twiiBtn clicked");
-
- dataed++;
- wiiBtn.ResetState();
- if (Settings.gameDisplay==list) {
- gameBrowser->SetFocus(1);
- } else if (Settings.gameDisplay==grid) {
- gameGrid->SetFocus(1);
- } else if (Settings.gameDisplay==carousel) {
- gameCarousel->SetFocus(1);
- }
- } else if (installBtn.GetState() == STATE_CLICKED) {
- gprintf("\n\tinstallBtn clicked");
- choice = WindowPrompt(tr("Install a game"),0,tr("Yes"),tr("No"));
- if (choice == 1) {
- menu = MENU_INSTALL;
- break;
- } else {
- installBtn.ResetState();
- if (Settings.gameDisplay==list) {
- gameBrowser->SetFocus(1);
- } else if (Settings.gameDisplay==grid) {
- gameGrid->SetFocus(1);
- } else if (Settings.gameDisplay==carousel) {
- gameCarousel->SetFocus(1);
- }
- }
- }else if ((covert & 0x2)&&(covert!=covertOld)) {
- gprintf("\n\tNew Disc Detected");
- choice = WindowPrompt(tr("New Disc Detected"),0,tr("Install"),tr("Mount DVD drive"),tr("Cancel"));
- if (choice == 1) {
- menu = MENU_INSTALL;
- break;
- }
- else if (choice ==2)
- {
- dvdBtn.SetState(STATE_CLICKED);
- }else {
- if (Settings.gameDisplay==list) {
- gameBrowser->SetFocus(1);
- } else if (Settings.gameDisplay==grid) {
- gameGrid->SetFocus(1);
- } else if (Settings.gameDisplay==carousel) {
- gameCarousel->SetFocus(1);
- }
- }
- }
-
- else if (sdcardBtn.GetState() == STATE_CLICKED) {
- gprintf("\n\tsdCardBtn Clicked");
- SDCard_deInit();
- SDCard_Init();
- if (Settings.gameDisplay==list) {
- startat = gameBrowser->GetSelectedOption();
- offset = gameBrowser->GetOffset();
- } else if (Settings.gameDisplay==grid) {
- startat = gameGrid->GetSelectedOption();
- offset = gameGrid->GetOffset();
- } else if (Settings.gameDisplay==carousel) {
- startat = gameCarousel->GetSelectedOption();
- offset = gameCarousel->GetOffset();
- }
- if (isInserted(bootDevice)) {
- HaltGui(); // to fix endless rumble when clicking on the SD icon when rumble is disabled because rumble is set to on in Global_Default()
- CFG_Load();
- ResumeGui();
- }
- sdcardBtn.ResetState();
- menu = MENU_DISCLIST;
- break;
- }
-
- else if (DownloadBtn.GetState() == STATE_CLICKED) {
- gprintf("\n\tDownloadBtn Clicked");
- if (isInserted(bootDevice)) {
- choice = WindowPrompt(tr("Cover Download"), 0, tr("Normal Covers"), tr("3D Covers"), tr("Disc Images"), tr("Back")); // ask for download choice
- if (choice != 0) {
- int choice2 = choice;
- bool missing;
- missing = SearchMissingImages(choice2);
- if (IsNetworkInit() == false && missing == true) {
- WindowPrompt(tr("Network init error"), 0, tr("OK"));
- } else {
- if (GetMissingFiles() != NULL && cntMissFiles > 0) {
- char tempCnt[40];
- sprintf(tempCnt,"%i %s",cntMissFiles,tr("Missing files"));
- if (choice!=3)choice = WindowPrompt(tr("Download Boxart image?"),tempCnt,tr("Yes"),tr("No"));
- else if (choice==3)choice = WindowPrompt(tr("Download Discart image?"),tempCnt,tr("Yes"),tr("No"));
- if (choice == 1) {
- ret = ProgressDownloadWindow(choice2);
- if (ret == 0) {
- WindowPrompt(tr("Download finished"),0,tr("OK"));
- } else {
- sprintf(tempCnt,"%i %s",ret,tr("files not found on the server!"));
- WindowPrompt(tr("Download finished"),tempCnt,tr("OK"));
- }
- }
- }
- }
- }
- } else {
- WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to download images."), tr("OK"));
- }
- menu = MENU_DISCLIST;
- DownloadBtn.ResetState();
- if (Settings.gameDisplay==list) {
- gameBrowser->SetFocus(1);
- } else if (Settings.gameDisplay==grid) {
- gameGrid->SetFocus(1);
- } else if (Settings.gameDisplay==carousel) {
- gameCarousel->SetFocus(1);
- }
- }//end download
-
- else if (settingsBtn.GetState() == STATE_CLICKED) {
- gprintf("\n\tsettingsBtn Clicked");
- if (Settings.gameDisplay==list) {
- startat = gameBrowser->GetSelectedOption();
- offset = gameBrowser->GetOffset();
- } else if (Settings.gameDisplay==grid) {
- startat = gameGrid->GetSelectedOption();
- offset = gameGrid->GetOffset();
- } else if (Settings.gameDisplay==carousel) {
- startat = gameCarousel->GetSelectedOption();
- offset = gameCarousel->GetOffset();
- }
- menu = MENU_SETTINGS;
- break;
-
- }
-
- else if (favoriteBtn.GetState() == STATE_CLICKED) {
- gprintf("\n\tfavoriteBtn Clicked");
- Settings.fave=!Settings.fave;
- if (isInserted(bootDevice)) {
- cfg_save_global();
- }
- __Menu_GetEntries();
- menu = MENU_DISCLIST;
- break;
-
- }
-
- else if (searchBtn.GetState() == STATE_CLICKED && mountMethod!=3) {
-
- gprintf("\n\tsearchBtn Clicked");
- show_searchwindow=!show_searchwindow;
- HaltGui();
- if(searchBar)
- {
- mainWindow->Remove(searchBar);
- delete searchBar;
- searchBar = NULL;
- }
- if(show_searchwindow)
- {
- if(gameFilter && *gameFilter)
- {
- searchBtn.StopEffect();
- searchBtn.SetEffectGrow();
- }
- searchBar = new GuiSearchBar(gameFilterNextList);
- if(searchBar)
- mainWindow->Append(searchBar);
- }
- else
- {
- if(gameFilter && *gameFilter)
- searchBtn.SetEffect(EFFECT_PULSE, 10, 105);
- }
- searchBtn.ResetState();
- ResumeGui();
- }
-
- else if (searchBar && (searchChar=searchBar->GetClicked())) {
- if(searchChar > 27)
- {
- int len = gameFilter ? wcslen(gameFilter) : 0;
- wchar_t newFilter[len+2];
- if(gameFilter)
- wcscpy(newFilter, gameFilter);
- newFilter[len] = searchChar;
- newFilter[len+1] = 0;
-
-
- __Menu_GetEntries(0, newFilter);
- menu = MENU_DISCLIST;
- break;
- }
- else if(searchChar == 7) // Close
- {
- show_searchwindow=false;
- HaltGui();
- if(searchBar)
- {
- mainWindow->Remove(searchBar);
- delete searchBar;
- searchBar = NULL;
- }
- if(gameFilter && *gameFilter)
- {
- searchBtn.SetEffect(EFFECT_PULSE, 10, 105);
- searchBtn.SetImage(&searchBtnImg);
- searchBtn.SetImageOver(&searchBtnImg);
- searchBtn.SetAlpha(255);
- }
- else
- {
- searchBtn.StopEffect();
- searchBtn.SetEffectGrow();
- searchBtn.SetImage(&searchBtnImg_g);
- searchBtn.SetImageOver(&searchBtnImg_g);
- searchBtn.SetAlpha(180);
- }
-
- ResumeGui();
- }
- else if(searchChar == 8) // Backspace
- {
- __Menu_GetEntries(0, gameFilterPrev);
- menu = MENU_DISCLIST;
- break;
- }
-
- }
-
- else if (abcBtn.GetState() == STATE_CLICKED) {
- gprintf("\n\tabcBtn clicked");
- if (Settings.sort != all) {
- Settings.sort=all;
- if (isInserted(bootDevice)) {
- cfg_save_global();
- }
- __Menu_GetEntries();
-
- menu = MENU_DISCLIST;
- break;
- }
- abcBtn.ResetState();
- }
-
- else if (countBtn.GetState() == STATE_CLICKED) {
- gprintf("\n\tcountBtn Clicked");
- if (Settings.sort != pcount) {
- Settings.sort=pcount;
- //if(isSdInserted()) {
- if (isInserted(bootDevice)) {
- cfg_save_global();
- }
- __Menu_GetEntries();
-
- menu = MENU_DISCLIST;
- break;
- }
- countBtn.ResetState();
-
- }
-
- else if (listBtn.GetState() == STATE_CLICKED) {
- gprintf("\n\tlistBtn Clicked");
- if (Settings.gameDisplay!=list) {
- Settings.gameDisplay=list;
- menu = MENU_DISCLIST;
- if (isInserted(bootDevice)) {
- cfg_save_global();
- }
- listBtn.ResetState();
- break;
- } else {
- listBtn.ResetState();
- }
- }
-
-
- else if (gridBtn.GetState() == STATE_CLICKED) {
- gprintf("\n\tgridBtn Clicked");
- if (Settings.gameDisplay!=grid) {
-
- Settings.gameDisplay=grid;
- menu = MENU_DISCLIST;
- if (isInserted(bootDevice)) {
- cfg_save_global();
- }
- gridBtn.ResetState();
- break;
- } else {
- gridBtn.ResetState();
- }
- }
-
- else if (carouselBtn.GetState() == STATE_CLICKED) {
- gprintf("\n\tcarouselBtn Clicked");
- if (Settings.gameDisplay!=carousel) {
- Settings.gameDisplay=carousel;
- menu = MENU_DISCLIST;
- if (isInserted(bootDevice)) {
- cfg_save_global();
- }
- carouselBtn.ResetState();
- break;
- } else {
- carouselBtn.ResetState();
- }
- }
- else if (homebrewBtn.GetState() == STATE_CLICKED) {
- gprintf("\n\thomebrewBtn Clicked");
- menu = MENU_HOMEBREWBROWSE;
- break;
- }
- else if (gameInfo.GetState() == STATE_CLICKED && mountMethod!=3) {
- gprintf("\n\tgameinfo Clicked");
- gameInfo.ResetState();
- if(selectImg1>=0 && selectImg1<(s32)gameCnt) {
- gameSelected = selectImg1;
- rockout();
- struct discHdr *header = &gameList[selectImg1];
- snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
- choice = showGameInfo(IDfull);
- rockout(2);
- if (choice==2)
- homeBtn.SetState(STATE_CLICKED);
- if (choice==3) {
- menu = MENU_DISCLIST;
- break;
- }
- }
- }
- else if (lockBtn.GetState() == STATE_CLICKED) {
- gprintf("\n\tlockBtn clicked");
- lockBtn.ResetState();
- if (!canUnlock) {
- WindowPrompt(tr("Parental Control"), tr("You don't have Parental Control enabled. If you wish to use Parental Control, enable it in the Wii Settings."), tr("OK"));
- } else {
- if (Settings.godmode) {
- if (WindowPrompt(tr("Parental Control"), tr("Are you sure you want to enable Parent Control?"), tr("Yes"), tr("No")) == 1) {
- Settings.godmode = 0;
- lockBtn.SetImage(&lockBtnImg_g);
- lockBtn.SetImageOver(&lockBtnImg_g);
- lockBtn.SetToolTip(&lockBtnTT, 15, 52, 1, 3);
-
- // Retrieve the gamelist again
- menu = MENU_DISCLIST;
- break;
- }
- } else {
- // Require the user to enter the PIN code
- char pin[5];
- memset(&pin, 0, 5);
- int ret = OnScreenNumpad((char *) &pin, 5);
-
- if (ret == 1) {
- if (memcmp(pin, Settings.parental.pin, 4) == 0) {
- Settings.godmode = 1;
- lockBtn.SetImage(&unlockBtnImg_g);
- lockBtn.SetImageOver(&unlockBtnImg_g);
- lockBtn.SetToolTip(&unlockBtnTT, 15, 52, 1, 3);
-
- // Retrieve the gamelist again
- menu = MENU_DISCLIST;
- break;
- } else {
- WindowPrompt(tr("Parental Control"), tr("Invalid PIN code"), tr("OK"));
- }
- }
- }
- }
- }
- else if (dvdBtn.GetState() == STATE_CLICKED) {
- gprintf("\n\tdvdBtn Clicked");
- mountMethodOLD = (mountMethod==3?mountMethod:0);
-
- mountMethod=DiscMount(dvdheader);
- dvdBtn.ResetState();
-
- rockout();
- //break;
- }
- if (Settings.gameDisplay==grid) {
- int selectimg;
- DownloadBtn.SetSize(0,0);
- selectimg = gameGrid->GetSelectedOption();
- gameSelected = gameGrid->GetClickedOption();
- selectImg1=selectimg;
- }
-
- if (Settings.gameDisplay==carousel) {
- int selectimg;
- DownloadBtn.SetSize(0,0);
- selectimg = gameCarousel->GetSelectedOption();
- gameSelected = gameCarousel->GetClickedOption();
- selectImg1=selectimg;
- }
- if (Settings.gameDisplay==list) {
- //Get selected game under cursor
- int selectimg;
- DownloadBtn.SetSize(160,224);
- idBtn.SetSize(100,40);
-
- selectimg = gameBrowser->GetSelectedOption();
- gameSelected = gameBrowser->GetClickedOption();
- selectImg1=selectimg;
-
- if (gameSelected > 0) //if click occured
- selectimg = gameSelected;
-
- char gameregion[7];
- if ((selectimg >= 0) && (selectimg < (s32) gameCnt)) {
- if (selectimg != selectedold) {
- selectedold = selectimg;//update displayed cover, game ID, and region if the selected game changes
- struct discHdr *header = &gameList[selectimg];
- snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
- snprintf (IDfull,sizeof(IDfull),"%s%c%c%c", ID, header->id[3], header->id[4], header->id[5]);
- w.Remove(&DownloadBtn);
-
- if (GameIDTxt) {
- w.Remove(&idBtn);
- delete GameIDTxt;
- GameIDTxt = NULL;
- }
- if (GameRegionTxt) {
- w.Remove(GameRegionTxt);
- delete GameRegionTxt;
- GameRegionTxt = NULL;
- }
-
- switch (header->id[3]) {
- case 'E':
- sprintf(gameregion,"NTSC U");
- break;
- case 'J':
- sprintf(gameregion,"NTSC J");
- break;
- case 'W':
- sprintf(gameregion,"NTSC T");
- break;
- default:
- case 'K':
- sprintf(gameregion,"NTSC K");
- break;
- case 'P':
- case 'D':
- case 'F':
- case 'I':
- case 'S':
- case 'H':
- case 'U':
- case 'X':
- case 'Y':
- case 'Z':
- sprintf(gameregion," PAL ");
- break;
- }
-
- //load game cover
- if (cover) {
- delete cover;
- cover = NULL;
- }
-
- cover = LoadCoverImage(header);
-
- if (coverImg) {
- delete coverImg;
- coverImg = NULL;
- }
- coverImg = new GuiImage(cover);
- coverImg->SetWidescreen(CFG.widescreen);
-
- DownloadBtn.SetImage(coverImg);// put the new image on the download button
- w.Append(&DownloadBtn);
-
- if ((Settings.sinfo == GameID) || (Settings.sinfo == Both)) {
- GameIDTxt = new GuiText(IDfull, 22, THEME.info);
- GameIDTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
- //GameIDTxt->SetPosition(THEME.id_x,THEME.id_y);
- idBtn.SetEffect(EFFECT_FADE, 20);
- idBtn.SetLabel(GameIDTxt);
- w.Append(&idBtn);
- }
- //don't try to show region for channels because all the custom channels wont follow the rules
- if (((Settings.sinfo == GameRegion) || (Settings.sinfo == Both))&&mountMethod!=3) {
- GameRegionTxt = new GuiText(gameregion, 22, THEME.info);
- GameRegionTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
- GameRegionTxt->SetPosition(THEME.region_x, THEME.region_y);
- GameRegionTxt->SetEffect(EFFECT_FADE, 20);
- w.Append(GameRegionTxt);
- }
- }
- }
-
- if (idBtn.GetState() == STATE_CLICKED && mountMethod!=3) {
- gprintf("\n\tidBtn Clicked");
- struct discHdr * header = &gameList[gameBrowser->GetSelectedOption()];
- //enter new game ID
- char entered[10];
- snprintf(entered, sizeof(entered), "%s", IDfull);
- //entered[9] = '\0';
- int result = OnScreenKeyboard(entered, 7,0);
- if (result == 1) {
- WBFS_ReIDGame(header->id, entered);
- //__Menu_GetEntries();
- menu = MENU_DISCLIST;
- }
-
- idBtn.ResetState();
- }
- startat=gameBrowser->GetOffset(), offset=startat;
- }
-
- if (((gameSelected >= 0) && (gameSelected < (s32)gameCnt))
- || mountMethod==1
- || mountMethod==2) {
- if(searchBar)
- {
- HaltGui();
- mainWindow->Remove(searchBar);
- ResumeGui();
- }
- rockout();
- struct discHdr *header = (mountMethod==1||mountMethod==2?dvdheader:&gameList[gameSelected]);
- // struct discHdr *header = dvdheader:&gameList[gameSelected]);
- if (!mountMethod)//only get this stuff it we are booting a game from USB
- {
- WBFS_GameSize(header->id, &size);
- if (strlen(get_title(header)) < (MAX_CHARACTERS + 3)) {
- sprintf(text, "%s", get_title(header));
- } else {
- strncpy(text, get_title(header), MAX_CHARACTERS);
- text[MAX_CHARACTERS] = '\0';
- strncat(text, "...", 3);
- }
- }
-
- //check if alt Dol and gct file is present
- FILE *exeFile = NULL;
- char nipple[100];
- header = (mountMethod==1||mountMethod==2?dvdheader:&gameList[gameSelected]); //reset header
- snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
- struct Game_CFG* game_cfg = CFG_get_game_opt(header->id);
-
- if (game_cfg) {
- alternatedol = game_cfg->loadalternatedol;
- ocarinaChoice = game_cfg->ocarina;
- } else {
- alternatedol = off;
- ocarinaChoice = Settings.ocarina;
- }
-
-
- if (Settings.qboot == yes) { //quickboot game
- if (alternatedol == on) {
- /* Open dol File and check exist */
- sprintf(nipple, "%s%s.dol",Settings.dolpath,IDfull);
- exeFile = fopen (nipple ,"rb");
- if (exeFile==NULL) {
- sprintf(nipple, "%s %s",nipple,tr("does not exist!"));
- WindowPrompt(tr("Error"),nipple,tr("OK"));
- menu = MENU_CHECK;
- wiilight(0);
- break;
- } else {
- fclose(exeFile);
- }
- }
- if (ocarinaChoice != off) {
- /* Open gct File and check exist */
- sprintf(nipple, "%s%s.gct",Settings.Cheatcodespath,IDfull);
- exeFile = fopen (nipple ,"rb");
- if (exeFile==NULL) {
- gprintf("\n\ttried to load missing gct.");
- sprintf(nipple, "%s %s",nipple,tr("does not exist! Loading game without cheats."));
- WindowPrompt(tr("Error"),nipple,NULL,NULL,NULL,NULL,170);
- } else {
- fseek (exeFile, 0, SEEK_END);
- long size=ftell (exeFile);
- rewind (exeFile);
- fclose(exeFile);
- if (size>MAX_GCT_SIZE) {
- gprintf("\n\tgct is too big");
- sprintf(nipple, "%s %s",nipple,tr("contains over 255 lines of code. It will produce unexpected results."));
- WindowPrompt(tr("Error"),nipple,NULL,NULL,NULL,NULL,170);
- }
- }
-
- }
-
- wiilight(0);
- if (isInserted(bootDevice)) {
- //////////save game play count////////////////
- struct Game_NUM* game_num = CFG_get_game_num(header->id);
-
- if (game_num) {
- favoritevar = game_num->favorite;
- playcount = game_num->count;
- } else {
- favoritevar = 0;
- playcount = 0;
- }
- playcount += 1;
-
- CFG_save_game_num(header->id);
- gprintf("\n\tplaycount for %c%c%c%c%c%c raised to %i",header->id[0],header->id[1],header->id[2],header->id[3],header->id[4],header->id[5],playcount);
-
- }
- menu = MENU_EXIT;
- break;
-
- }
- bool returnHere = true;// prompt to start game
- while (returnHere) {
- returnHere = false;
- if (Settings.wiilight != wiilight_forInstall) wiilight(1);
- choice = GameWindowPrompt();
- // header = &gameList[gameSelected]; //reset header
-
- if (choice == 1) {
- if (alternatedol == on) {
- /* Open dol File and check exist */
- sprintf(nipple, "%s%s.dol",Settings.dolpath,IDfull);
- exeFile = fopen (nipple ,"rb");
- if (exeFile==NULL) {
- gprintf("\n\tTried to load alt dol that isn't there");
- sprintf(nipple, "%s %s",nipple,tr("does not exist! You Messed something up, Idiot."));
- WindowPrompt(tr("Error"),nipple,tr("OK"));
- menu = MENU_CHECK;
- wiilight(0);
- break;
- } else {
- fclose(exeFile);
- }
- }
- if (ocarinaChoice != off) {
- /* Open gct File and check exist */
- sprintf(nipple, "%s%s.gct",Settings.Cheatcodespath,IDfull);
- exeFile = fopen (nipple ,"rb");
- if (exeFile==NULL) {
- gprintf("\n\ttried to load gct file that isn't there");
- sprintf(nipple, "%s %s",nipple,tr("does not exist! Loading game without cheats."));
- WindowPrompt(tr("Error"),nipple,NULL,NULL,NULL,NULL,170);
- } else {
- fseek (exeFile, 0, SEEK_END);
- long size=ftell (exeFile);
- rewind (exeFile);
- fclose(exeFile);
- if (size>MAX_GCT_SIZE) {
- gprintf("\n\tgct file is too big");
- sprintf(nipple, "%s %s",nipple,tr("contains over 255 lines of code. It will produce unexpected results."));
- WindowPrompt(tr("Error"),nipple,NULL,NULL,NULL,NULL,170);
- }
- }
-
- }
- wiilight(0);
- returnHere = false;
- menu = MENU_EXIT;
-
- } else if (choice == 2) {
- wiilight(0);
- HaltGui();
- if (Settings.gameDisplay==list) mainWindow->Remove(gameBrowser);
- else if (Settings.gameDisplay==grid) mainWindow->Remove(gameGrid);
- else if (Settings.gameDisplay==carousel) mainWindow->Remove(gameCarousel);
- mainWindow->Remove(&w);
- ResumeGui();
-
- //re-evaluate header now in case they changed games while on the game prompt
- header = (mountMethod==1||mountMethod==2?dvdheader:&gameList[gameSelected]);
- int settret = GameSettings(header);
- /* unneeded for now, kept in case database gets a separate language setting
- //menu = MENU_DISCLIST; // refresh titles (needed if the language setting has changed)
- */
- HaltGui();
- if (Settings.gameDisplay==list) mainWindow->Append(gameBrowser);
- else if (Settings.gameDisplay==grid) mainWindow->Append(gameGrid);
- else if (Settings.gameDisplay==carousel) mainWindow->Append(gameCarousel);
- mainWindow->Append(&w);
- ResumeGui();
- if (settret == 1) { //if deleted
- menu = MENU_DISCLIST;
- break;
- }
- returnHere = true;
- rockout(2);
- }
-
- else if (choice == 3 && !mountMethod) { //WBFS renaming
- wiilight(0);
- //re-evaluate header now in case they changed games while on the game prompt
- header = &gameList[gameSelected];
-
- //enter new game title
- char entered[60];
- snprintf(entered, sizeof(entered), "%s", get_title(header));
- entered[59] = '\0';
- int result = OnScreenKeyboard(entered, 60,0);
- if (result == 1) {
- WBFS_RenameGame(header->id, entered);
- __Menu_GetEntries();
- menu = MENU_DISCLIST;
- }
- } else if (choice == 0) {
- rockout(2);
- if (mountMethod==1||mountMethod==2)mountMethod = mountMethodOLD;
- if (Settings.gameDisplay==list) {
- gameBrowser->SetFocus(1);
- } else if (Settings.gameDisplay==grid) {
- gameGrid->SetFocus(1);
- } else if (Settings.gameDisplay==carousel) {
- gameCarousel->SetFocus(1);
- }
- }
-
-
- }
- if(searchBar)
- {
- HaltGui();
- mainWindow->Append(searchBar);
- ResumeGui();
- }
- }
- // to skip the first call of windowScreensaver at startup when wiimote is not connected
- if (IsWpadConnected()) {
- check = 1;
- }
-
- // screensaver is called when wiimote shuts down, depending on the wiimotet idletime
- if (!IsWpadConnected() && check !=0 && Settings.screensaver!=0) {
- check++;
- int screensaverIsOn=0;
- if (check==11500) { //to allow time for the wii to turn off and not show the screensaver
- screensaverIsOn=WindowScreensaver();
- }
- if (screensaverIsOn==1)check=0;
- }
- covertOld=covert;
- }
-
- // set alt dol default
- if (menu == MENU_EXIT && altdoldefault) {
- struct discHdr *header = (mountMethod==1||mountMethod==2?dvdheader:&gameList[gameSelected]);
- struct Game_CFG* game_cfg = CFG_get_game_opt(header->id);
- // use default only if no alt dol was selected manually
- if (game_cfg) {
- if (game_cfg->alternatedolstart != 0)
- altdoldefault = false;
- }
- if (altdoldefault) {
- int autodol = autoSelectDol((char*)header->id, true);
- if (autodol>0) {
- alternatedol = 2;
- alternatedoloffset = autodol;
- char temp[20];
- sprintf(temp,"%d",autodol);
- } else {
- // alt dol menu for games that require more than a single alt dol
- int autodol = autoSelectDolMenu((char*)header->id, true);
- if (autodol>0) {
- alternatedol = 2;
- alternatedoloffset = autodol;
- }
- }
- }
- }
-//no need to close sd here. we still need to get settings and codes and shit
- /*if (menu == MENU_EXIT) {
- SDCard_deInit();
- }*/
- //if (Settings.gameDisplay==list) {startat=gameBrowser->GetOffset(), offset=startat;}//save the variables in case we are refreshing the list
- //gprintf("\n\tstartat:%d offset:%d",startat,offset);
- HaltGui();
- mainWindow->RemoveAll();
- mainWindow->Append(bgImg);
- delete searchBar;
- searchBar = NULL;
- delete gameBrowser;
- gameBrowser = NULL;
- delete gameGrid;
- gameGrid = NULL;
- delete gameCarousel;
- gameCarousel = NULL;
- ResumeGui();
- return menu;
-}
-
-void DiscListWinUpdateCallback(void * e)
-{
- GuiWindow *w = (GuiWindow *)e;
- for(int i=0; i<8; ++i)
- {
- if(Toolbar[i]->GetState() == STATE_SELECTED)
- {
- w->Remove(Toolbar[i]);
- w->Append(Toolbar[i]); // draw the selected Icon allways on top
- break;
- }
- }
-}
-
-void rockout(int f) {
-
-
- HaltGui();
- int num=(f==2?-1:gameSelected);
-
- char imgPath[100];
- if ((!(strcasestr(get_title(&gameList[num]),"guitar")||
- strcasestr(get_title(&gameList[num]),"band")||
- strcasestr(get_title(&gameList[num]),"rock")||
- f==1))||mountMethod) {
- for (int i = 0; i < 4; i++)
- delete pointer[i];
- snprintf(imgPath, sizeof(imgPath), "%splayer1_point.png", CFG.theme_path);
- pointer[0] = new GuiImageData(imgPath, player1_point_png);
- snprintf(imgPath, sizeof(imgPath), "%splayer2_point.png", CFG.theme_path);
- pointer[1] = new GuiImageData(imgPath, player2_point_png);
- snprintf(imgPath, sizeof(imgPath), "%splayer3_point.png", CFG.theme_path);
- pointer[2] = new GuiImageData(imgPath, player3_point_png);
- snprintf(imgPath, sizeof(imgPath), "%splayer4_point.png", CFG.theme_path);
- pointer[3] = new GuiImageData(imgPath, player4_point_png);
- } else {
-
- for (int i = 0; i < 4; i++)
- delete pointer[i];
- snprintf(imgPath, sizeof(imgPath), "%srplayer1_point.png", CFG.theme_path);
- pointer[0] = new GuiImageData(imgPath, rplayer1_point_png);
- snprintf(imgPath, sizeof(imgPath), "%srplayer2_point.png", CFG.theme_path);
- pointer[1] = new GuiImageData(imgPath, rplayer2_point_png);
- snprintf(imgPath, sizeof(imgPath), "%srplayer3_point.png", CFG.theme_path);
- pointer[2] = new GuiImageData(imgPath, rplayer3_point_png);
- snprintf(imgPath, sizeof(imgPath), "%srplayer4_point.png", CFG.theme_path);
- pointer[3] = new GuiImageData(imgPath, rplayer4_point_png);
- }
- ResumeGui();
-}
+#include "menus.h"
+#include "fatmounter.h"
+#include "usbloader/wdvd.h"
+#include "usbloader/getentries.h"
+#include "usbloader/wbfs.h"
+#include "patches/fst.h"
+#include "network/networkops.h"
+#include "prompts/gameinfo.h"
+#include "prompts/DiscBrowser.h"
+#include "settings/Settings.h"
+#include "wpad.h"
+#include "sys.h"
+
+#include "libwiigui/gui_gamebrowser.h"
+#include "libwiigui/gui_gamegrid.h"
+#include "libwiigui/gui_gamecarousel.h"
+#include "libwiigui/gui_searchbar.h"
+
+#define MAX_CHARACTERS 38
+extern u8 * gameScreenTex;
+extern struct discHdr *dvdheader;
+extern u8 mountMethod;
+extern int load_from_fs;
+extern s32 gameSelected;
+extern GuiText * GameIDTxt;
+extern GuiText * GameRegionTxt;
+extern const u8 data1;
+extern FreeTypeGX *fontClock;
+extern bool updateavailable;
+extern int cntMissFiles;
+extern GuiImageData * cover;
+extern GuiImage * coverImg;
+extern GuiImageData * pointer[4];
+extern bool altdoldefault;
+extern GuiImage * bgImg;
+
+GuiButton *Toolbar[9];
+int idiotFlag=-1;
+char idiotChar[50];
+
+void DiscListWinUpdateCallback(void * e);
+void rockout(int f = 0);
+
+static u32 startat = 0;
+
+/****************************************************************************
+ * MenuDiscList
+ ***************************************************************************/
+int MenuDiscList() {
+
+ gprintf("\nMenuDiscList()");
+ //TakeScreenshot("SD:/screenshot1.png");
+ __Menu_GetEntries();
+ int offset = MIN(startat,gameCnt-1);
+ startat = offset;
+ //gprintf("\n\tstartat:%d offset:%d",startat,offset);
+ int datag = 0;
+ int datagB =0;
+ int dataed = -1;
+ int cosa=0,sina=0;
+ int selectImg1 = 0;
+ char ID[4];
+ char IDfull[7];
+ u32 covert = 0;
+ char imgPath[100];
+ if (!dvdheader)
+ dvdheader = new struct discHdr;
+ u8 mountMethodOLD =0;
+
+ WDVD_GetCoverStatus(&covert);
+ u32 covertOld=covert;
+
+ f32 freespace, used, size = 0.0;
+ wchar_t searchChar;
+ //SCREENSAVER
+ int check = 0; //to skip the first cycle when wiimote isn't completely connected
+
+ datagB=0;
+ int menu = MENU_NONE, dataef=0;
+
+
+ u32 nolist;
+ char text[MAX_CHARACTERS + 4];
+ int choice = 0, selectedold = 100;
+ s32 ret;
+
+ //CLOCK
+ struct tm * timeinfo;
+ char theTime[80]="";
+ time_t lastrawtime=0;
+
+ if (mountMethod != 3 && WBFS_ShowFreeSpace()) {
+ WBFS_DiskSpace(&used, &freespace);
+ }
+
+ if (!gameCnt) { //if there is no list of games to display
+ nolist = 1;
+ }
+
+ GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
+ // because destroy GuiSound must wait while sound playing is finished, we use a global sound
+ if(!btnClick2) btnClick2=new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
+ // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
+
+ snprintf(imgPath, sizeof(imgPath), "%sbutton_install.png", CFG.theme_path);
+ GuiImageData btnInstall(imgPath, button_install_png);
+ snprintf(imgPath, sizeof(imgPath), "%sbutton_install_over.png", CFG.theme_path);
+ GuiImageData btnInstallOver(imgPath, button_install_over_png);
+
+ snprintf(imgPath, sizeof(imgPath), "%ssettings_button.png", CFG.theme_path);
+ GuiImageData btnSettings(imgPath, settings_button_png);
+ snprintf(imgPath, sizeof(imgPath), "%ssettings_button_over.png", CFG.theme_path);
+ GuiImageData btnSettingsOver(imgPath, settings_button_over_png);
+ GuiImageData dataID(&data1);
+
+ snprintf(imgPath, sizeof(imgPath), "%swiimote_poweroff.png", CFG.theme_path);
+ GuiImageData btnpwroff(imgPath, wiimote_poweroff_png);
+ snprintf(imgPath, sizeof(imgPath), "%swiimote_poweroff_over.png", CFG.theme_path);
+ GuiImageData btnpwroffOver(imgPath, wiimote_poweroff_over_png);
+ snprintf(imgPath, sizeof(imgPath), "%smenu_button.png", CFG.theme_path);
+ GuiImageData btnhome(imgPath, menu_button_png);
+ snprintf(imgPath, sizeof(imgPath), "%smenu_button_over.png", CFG.theme_path);
+ GuiImageData btnhomeOver(imgPath, menu_button_over_png);
+ snprintf(imgPath, sizeof(imgPath), "%sSDcard_over.png", CFG.theme_path);
+ GuiImageData btnsdcardOver(imgPath, sdcard_over_png);
+ snprintf(imgPath, sizeof(imgPath), "%sSDcard.png", CFG.theme_path);
+ GuiImageData btnsdcard(imgPath, sdcard_png);
+
+
+ snprintf(imgPath, sizeof(imgPath), "%sfavIcon.png", CFG.theme_path);
+ GuiImageData imgfavIcon(imgPath, favIcon_png);
+ snprintf(imgPath, sizeof(imgPath), "%sfavIcon_gray.png", CFG.theme_path);
+ GuiImageData imgfavIcon_gray(imgPath, NULL);
+ snprintf(imgPath, sizeof(imgPath), "%ssearchIcon.png", CFG.theme_path);
+ GuiImageData imgsearchIcon(imgPath, searchIcon_png);
+ snprintf(imgPath, sizeof(imgPath), "%ssearchIcon_gray.png", CFG.theme_path);
+ GuiImageData imgsearchIcon_gray(imgPath, NULL);
+ snprintf(imgPath, sizeof(imgPath), "%sabcIcon.png", CFG.theme_path);
+ GuiImageData imgabcIcon(imgPath, abcIcon_png);
+ snprintf(imgPath, sizeof(imgPath), "%sabcIcon_gray.png", CFG.theme_path);
+ GuiImageData imgabcIcon_gray(imgPath, NULL);
+ snprintf(imgPath, sizeof(imgPath), "%srankIcon.png", CFG.theme_path);
+ GuiImageData imgrankIcon(imgPath, rankIcon_png);
+ snprintf(imgPath, sizeof(imgPath), "%srankIcon_gray.png", CFG.theme_path);
+ GuiImageData imgrankIcon_gray(imgPath, NULL);
+ snprintf(imgPath, sizeof(imgPath), "%splayCountIcon.png", CFG.theme_path);
+ GuiImageData imgplayCountIcon(imgPath, playCountIcon_png);
+ snprintf(imgPath, sizeof(imgPath), "%splayCountIcon_gray.png", CFG.theme_path);
+ GuiImageData imgplayCountIcon_gray(imgPath, NULL);
+ snprintf(imgPath, sizeof(imgPath), "%sarrangeGrid.png", CFG.theme_path);
+ GuiImageData imgarrangeGrid(imgPath, arrangeGrid_png);
+ snprintf(imgPath, sizeof(imgPath), "%sarrangeGrid_gray.png", CFG.theme_path);
+ GuiImageData imgarrangeGrid_gray(imgPath, NULL);
+ snprintf(imgPath, sizeof(imgPath), "%sarrangeList.png", CFG.theme_path);
+ GuiImageData imgarrangeList(imgPath, arrangeList_png);
+ snprintf(imgPath, sizeof(imgPath), "%sarrangeList_gray.png", CFG.theme_path);
+ GuiImageData imgarrangeList_gray(imgPath, NULL);
+ snprintf(imgPath, sizeof(imgPath), "%sarrangeCarousel.png", CFG.theme_path);
+ GuiImageData imgarrangeCarousel(imgPath, arrangeCarousel_png);
+ snprintf(imgPath, sizeof(imgPath), "%sarrangeCarousel_gray.png", CFG.theme_path);
+ GuiImageData imgarrangeCarousel_gray(imgPath, NULL);
+
+ snprintf(imgPath, sizeof(imgPath), "%slock.png", CFG.theme_path);
+ GuiImageData imgLock(imgPath, lock_png);
+ snprintf(imgPath, sizeof(imgPath), "%slock_gray.png", CFG.theme_path);
+ GuiImageData imgLock_gray(imgPath, NULL);
+ snprintf(imgPath, sizeof(imgPath), "%sunlock.png", CFG.theme_path);
+ GuiImageData imgUnlock(imgPath, unlock_png);
+ snprintf(imgPath, sizeof(imgPath), "%sunlock_gray.png", CFG.theme_path);
+ GuiImageData imgUnlock_gray(imgPath, NULL);
+
+ snprintf(imgPath, sizeof(imgPath), "%sdvd.png", CFG.theme_path);
+ GuiImageData imgdvd(imgPath, dvd_png);
+ snprintf(imgPath, sizeof(imgPath), "%sdvd_gray.png", CFG.theme_path);
+ GuiImageData imgdvd_gray(imgPath, NULL);
+
+ snprintf(imgPath, sizeof(imgPath), "%sbrowser.png", CFG.theme_path);
+ GuiImageData homebrewImgData(imgPath, browser_png);
+ snprintf(imgPath, sizeof(imgPath), "%sbrowser_over.png", CFG.theme_path);
+ GuiImageData homebrewImgDataOver(imgPath, browser_over_png);
+
+
+ GuiTrigger trigA;
+ trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
+ GuiTrigger trigHome;
+ trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, PAD_BUTTON_START);
+ GuiTrigger trig2;
+ trig2.SetButtonOnlyTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_X, 0);
+ GuiTrigger trig1;
+ trig1.SetButtonOnlyTrigger(-1, WPAD_BUTTON_1 | WPAD_CLASSIC_BUTTON_Y, 0);
+ GuiTrigger trigZ;
+ trigZ.SetButtonOnlyTrigger(-1, WPAD_NUNCHUK_BUTTON_Z | WPAD_CLASSIC_BUTTON_ZL, PAD_TRIGGER_Z);
+
+ GuiButton screenShotBtn(0,0);
+ screenShotBtn.SetPosition(0,0);
+ screenShotBtn.SetTrigger(&trigZ);
+
+ char spaceinfo[30];
+ if (load_from_fs == PART_FS_FAT) {
+ memset(spaceinfo, 0, 30);
+ } else {
+ if (!strcmp(Settings.db_language,"JA")) {
+ // needs to be "total...used" for Japanese
+ sprintf(spaceinfo,(mountMethod!=3?"%.2fGB %s %.2fGB %s":" "),(freespace+used),tr("of"),freespace,tr("free"));
+ } else {
+ sprintf(spaceinfo,(mountMethod!=3?"%.2fGB %s %.2fGB %s":" "),freespace,tr("of"),(freespace+used),tr("free"));
+ }
+ }
+ GuiText usedSpaceTxt(spaceinfo, 18, THEME.info);
+ usedSpaceTxt.SetAlignment(THEME.hddinfo_align, ALIGN_TOP);
+ usedSpaceTxt.SetPosition(THEME.hddinfo_x, THEME.hddinfo_y);
+
+ char GamesCnt[15];
+ sprintf(GamesCnt,"%s: %i",(mountMethod!=3?tr("Games"):tr("Channels")), gameCnt);
+ GuiText gamecntTxt(GamesCnt, 18, THEME.info);
+
+ GuiButton gamecntBtn(100,18);
+ gamecntBtn.SetAlignment(THEME.gamecount_align, ALIGN_TOP);
+ gamecntBtn.SetPosition(THEME.gamecount_x,THEME.gamecount_y);
+ gamecntBtn.SetLabel(&gamecntTxt);
+ gamecntBtn.SetEffectGrow();
+ gamecntBtn.SetTrigger(&trigA);
+
+ GuiTooltip installBtnTT(tr("Install a game"));
+ if (Settings.wsprompt == yes)
+ installBtnTT.SetWidescreen(CFG.widescreen);
+ installBtnTT.SetAlpha(THEME.tooltipAlpha);
+ GuiImage installBtnImg(&btnInstall);
+ GuiImage installBtnImgOver(&btnInstallOver);
+ installBtnImg.SetWidescreen(CFG.widescreen);
+ installBtnImgOver.SetWidescreen(CFG.widescreen);
+
+ GuiButton installBtn(&installBtnImg, &installBtnImgOver, ALIGN_LEFT, ALIGN_TOP, THEME.install_x, THEME.install_y, &trigA, &btnSoundOver, btnClick2, 1, &installBtnTT,24,-30, 0,5);
+
+
+ GuiTooltip settingsBtnTT(tr("Settings"));
+ if (Settings.wsprompt == yes)
+ settingsBtnTT.SetWidescreen(CFG.widescreen);
+ settingsBtnTT.SetAlpha(THEME.tooltipAlpha);
+ GuiImage settingsBtnImg(&btnSettings);
+ settingsBtnImg.SetWidescreen(CFG.widescreen);
+ GuiImage settingsBtnImgOver(&btnSettingsOver);
+ settingsBtnImgOver.SetWidescreen(CFG.widescreen);
+ GuiButton settingsBtn(&settingsBtnImg,&settingsBtnImgOver, 0, 3, THEME.setting_x, THEME.setting_y, &trigA, &btnSoundOver, btnClick2,1,&settingsBtnTT,65,-30,0,5);
+
+ GuiTooltip homeBtnTT(tr("Back to HBC or Wii Menu"));
+ if (Settings.wsprompt == yes)
+ homeBtnTT.SetWidescreen(CFG.widescreen);
+ settingsBtnTT.SetAlpha(THEME.tooltipAlpha);
+ GuiImage homeBtnImg(&btnhome);
+ homeBtnImg.SetWidescreen(CFG.widescreen);
+ GuiImage homeBtnImgOver(&btnhomeOver);
+ homeBtnImgOver.SetWidescreen(CFG.widescreen);
+ GuiButton homeBtn(&homeBtnImg,&homeBtnImgOver, 0, 3, THEME.home_x, THEME.home_y, &trigA, &btnSoundOver, btnClick2,1,&homeBtnTT,15,-30,1,5);
+ homeBtn.RemoveSoundClick();
+ homeBtn.SetTrigger(&trigHome);
+
+ GuiTooltip poweroffBtnTT(tr("Power off the Wii"));
+ if (Settings.wsprompt == yes)
+ poweroffBtnTT.SetWidescreen(CFG.widescreen);
+ poweroffBtnTT.SetAlpha(THEME.tooltipAlpha);
+ GuiImage poweroffBtnImg(&btnpwroff);
+ GuiImage poweroffBtnImgOver(&btnpwroffOver);
+ poweroffBtnImg.SetWidescreen(CFG.widescreen);
+ poweroffBtnImgOver.SetWidescreen(CFG.widescreen);
+ GuiButton poweroffBtn(&poweroffBtnImg,&poweroffBtnImgOver, 0, 3, THEME.power_x, THEME.power_y, &trigA, &btnSoundOver, btnClick2,1,&poweroffBtnTT,-10,-30,1,5);
+
+ GuiTooltip sdcardBtnTT(tr("Reload SD"));
+ if (Settings.wsprompt == yes)
+ sdcardBtnTT.SetWidescreen(CFG.widescreen);
+ sdcardBtnTT.SetAlpha(THEME.tooltipAlpha);
+ GuiImage sdcardImg(&btnsdcard);
+ GuiImage sdcardImgOver(&btnsdcardOver);
+ sdcardImg.SetWidescreen(CFG.widescreen);
+ sdcardImgOver.SetWidescreen(CFG.widescreen);
+ GuiButton sdcardBtn(&sdcardImg,&sdcardImgOver, 0, 3, THEME.sdcard_x, THEME.sdcard_y, &trigA, &btnSoundOver, btnClick2,1,&sdcardBtnTT,15,-30,0,5);
+
+ GuiButton gameInfo(0,0);
+ gameInfo.SetTrigger(&trig2);
+ gameInfo.SetSoundClick(btnClick2);
+
+
+ GuiImage wiiBtnImg(&dataID);
+ wiiBtnImg.SetWidescreen(CFG.widescreen);
+ GuiButton wiiBtn(&wiiBtnImg,&wiiBtnImg, 0, 4, 0, -10, &trigA, &btnSoundOver, btnClick2,0);
+
+ GuiTooltip favoriteBtnTT(tr("Display favorites"));
+ if (Settings.wsprompt == yes)
+ favoriteBtnTT.SetWidescreen(CFG.widescreen);
+ favoriteBtnTT.SetAlpha(THEME.tooltipAlpha);
+ GuiImage favoriteBtnImg(&imgfavIcon);
+ favoriteBtnImg.SetWidescreen(CFG.widescreen);
+// GuiImage favoriteBtnImg_g(favoriteBtnImg);favoriteBtnImg_g.SetGrayscale();
+ GuiImage favoriteBtnImg_g(&imgfavIcon_gray);
+ if(favoriteBtnImg_g.GetImage() == NULL) { favoriteBtnImg_g = favoriteBtnImg; favoriteBtnImg_g.SetGrayscale();}
+ favoriteBtnImg_g.SetWidescreen(CFG.widescreen);
+ GuiButton favoriteBtn(&favoriteBtnImg_g,&favoriteBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_favorite_x, THEME.gamelist_favorite_y, &trigA, &btnSoundOver, btnClick2,1, &favoriteBtnTT, -15, 52, 0, 3);
+ favoriteBtn.SetAlpha(180);
+
+ GuiTooltip searchBtnTT(tr("Set Search-Filter"));
+ if (Settings.wsprompt == yes)
+ searchBtnTT.SetWidescreen(CFG.widescreen);
+ searchBtnTT.SetAlpha(THEME.tooltipAlpha);
+ GuiImage searchBtnImg(&imgsearchIcon);
+ searchBtnImg.SetWidescreen(CFG.widescreen);
+// GuiImage searchBtnImg_g(searchBtnImg); searchBtnImg_g.SetGrayscale();
+ GuiImage searchBtnImg_g(&imgsearchIcon_gray);
+ if(searchBtnImg_g.GetImage() == NULL) { searchBtnImg_g = searchBtnImg; searchBtnImg_g.SetGrayscale();}
+ searchBtnImg_g.SetWidescreen(CFG.widescreen);
+ GuiButton searchBtn(&searchBtnImg_g,&searchBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_search_x, THEME.gamelist_search_y, &trigA, &btnSoundOver, btnClick2,1, &searchBtnTT, -15, 52, 0, 3);
+ searchBtn.SetAlpha(180);
+
+ GuiTooltip abcBtnTT(Settings.fave ? tr("Sort by rank") : tr("Sort alphabetically"));
+ if (Settings.wsprompt == yes)
+ abcBtnTT.SetWidescreen(CFG.widescreen);
+ abcBtnTT.SetAlpha(THEME.tooltipAlpha);
+ GuiImage abcBtnImg(Settings.fave ? &imgrankIcon : &imgabcIcon);
+ abcBtnImg.SetWidescreen(CFG.widescreen);
+// GuiImage abcBtnImg_g(abcBtnImg); abcBtnImg_g.SetGrayscale();
+ GuiImage abcBtnImg_g(Settings.fave ? &imgrankIcon_gray : &imgabcIcon_gray);
+ if(abcBtnImg_g.GetImage() == NULL) { abcBtnImg_g = abcBtnImg; abcBtnImg_g.SetGrayscale();}
+ abcBtnImg_g.SetWidescreen(CFG.widescreen);
+ GuiButton abcBtn(&abcBtnImg_g,&abcBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_abc_x, THEME.gamelist_abc_y, &trigA, &btnSoundOver, btnClick2,1,&abcBtnTT, -15, 52, 0, 3);
+ abcBtn.SetAlpha(180);
+
+ GuiTooltip countBtnTT(tr("Sort order by most played"));
+ if (Settings.wsprompt == yes)
+ countBtnTT.SetWidescreen(CFG.widescreen);
+ countBtnTT.SetAlpha(THEME.tooltipAlpha);
+ GuiImage countBtnImg(&imgplayCountIcon);
+ countBtnImg.SetWidescreen(CFG.widescreen);
+// GuiImage countBtnImg_g(countBtnImg); countBtnImg_g.SetGrayscale();
+ GuiImage countBtnImg_g(&imgplayCountIcon_gray);
+ if(countBtnImg_g.GetImage() == NULL) { countBtnImg_g = countBtnImg; countBtnImg_g.SetGrayscale();}
+ countBtnImg_g.SetWidescreen(CFG.widescreen);
+ GuiButton countBtn(&countBtnImg_g,&countBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_count_x, THEME.gamelist_count_y, &trigA, &btnSoundOver, btnClick2,1, &countBtnTT, -15, 52, 0, 3);
+ countBtn.SetAlpha(180);
+
+ GuiTooltip listBtnTT(tr("Display as a list"));
+ if (Settings.wsprompt == yes)
+ listBtnTT.SetWidescreen(CFG.widescreen);
+ listBtnTT.SetAlpha(THEME.tooltipAlpha);
+ GuiImage listBtnImg(&imgarrangeList);
+ listBtnImg.SetWidescreen(CFG.widescreen);
+// GuiImage listBtnImg_g(listBtnImg); listBtnImg_g.SetGrayscale();
+ GuiImage listBtnImg_g(&imgarrangeList_gray);
+ if(listBtnImg_g.GetImage() == NULL) { listBtnImg_g = listBtnImg; listBtnImg_g.SetGrayscale();}
+ listBtnImg_g.SetWidescreen(CFG.widescreen);
+ GuiButton listBtn(&listBtnImg_g,&listBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_list_x, THEME.gamelist_list_y, &trigA, &btnSoundOver, btnClick2,1, &listBtnTT, 15, 52, 1, 3);
+ listBtn.SetAlpha(180);
+
+ GuiTooltip gridBtnTT(tr("Display as a grid"));
+ if (Settings.wsprompt == yes)
+ gridBtnTT.SetWidescreen(CFG.widescreen);
+ gridBtnTT.SetAlpha(THEME.tooltipAlpha);
+ GuiImage gridBtnImg(&imgarrangeGrid);
+ gridBtnImg.SetWidescreen(CFG.widescreen);
+// GuiImage gridBtnImg_g(gridBtnImg); gridBtnImg_g.SetGrayscale();
+ GuiImage gridBtnImg_g(&imgarrangeGrid_gray);
+ if(gridBtnImg_g.GetImage() == NULL) { gridBtnImg_g = gridBtnImg; gridBtnImg_g.SetGrayscale();}
+ gridBtnImg_g.SetWidescreen(CFG.widescreen);
+ GuiButton gridBtn(&gridBtnImg_g,&gridBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_grid_x, THEME.gamelist_grid_y, &trigA, &btnSoundOver, btnClick2,1, &gridBtnTT, 15, 52, 1, 3);
+ gridBtn.SetAlpha(180);
+
+ GuiTooltip carouselBtnTT(tr("Display as a carousel"));
+ if (Settings.wsprompt == yes)
+ carouselBtnTT.SetWidescreen(CFG.widescreen);
+ carouselBtnTT.SetAlpha(THEME.tooltipAlpha);
+ GuiImage carouselBtnImg(&imgarrangeCarousel);
+ carouselBtnImg.SetWidescreen(CFG.widescreen);
+// GuiImage carouselBtnImg_g(carouselBtnImg); carouselBtnImg_g.SetGrayscale();
+ GuiImage carouselBtnImg_g(&imgarrangeCarousel_gray);
+ if(carouselBtnImg_g.GetImage() == NULL) { carouselBtnImg_g = carouselBtnImg; carouselBtnImg_g.SetGrayscale();}
+ carouselBtnImg_g.SetWidescreen(CFG.widescreen);
+ GuiButton carouselBtn(&carouselBtnImg_g,&carouselBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_carousel_x, THEME.gamelist_carousel_y, &trigA, &btnSoundOver, btnClick2,1, &carouselBtnTT, 15, 52, 1, 3);
+ carouselBtn.SetAlpha(180);
+
+ bool canUnlock = (Settings.parentalcontrol == 0 && Settings.parental.enabled == 1);
+
+ GuiTooltip lockBtnTT(canUnlock ? tr("Unlock Parental Control") : tr("Parental Control disabled"));
+ if (Settings.wsprompt == yes)
+ lockBtnTT.SetWidescreen(CFG.widescreen);
+ lockBtnTT.SetAlpha(THEME.tooltipAlpha);
+ GuiImage lockBtnImg(&imgLock);
+ lockBtnImg.SetWidescreen(CFG.widescreen);
+ GuiImage lockBtnImg_g(&imgLock_gray);
+ if(lockBtnImg_g.GetImage() == NULL) { lockBtnImg_g = lockBtnImg; lockBtnImg_g.SetGrayscale(); }
+ lockBtnImg_g.SetWidescreen(CFG.widescreen);
+ GuiButton lockBtn(&lockBtnImg_g, &lockBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_lock_x, THEME.gamelist_lock_y, &trigA, &btnSoundOver, btnClick2,1, &lockBtnTT, 15, 52, 1, 3);
+ lockBtn.SetAlpha(180);
+
+ GuiTooltip unlockBtnTT(tr("Enable Parental Control"));
+ if (Settings.wsprompt == yes)
+ unlockBtnTT.SetWidescreen(CFG.widescreen);
+ unlockBtnTT.SetAlpha(THEME.tooltipAlpha);
+ GuiImage unlockBtnImg(&imgUnlock);
+ unlockBtnImg.SetWidescreen(CFG.widescreen);
+ GuiImage unlockBtnImg_g(&imgUnlock_gray);
+ if(unlockBtnImg_g.GetImage() == NULL) { unlockBtnImg_g = unlockBtnImg; unlockBtnImg_g.SetGrayscale(); }
+ unlockBtnImg_g.SetWidescreen(CFG.widescreen);
+
+ if (canUnlock && Settings.godmode)
+ {
+ lockBtn.SetImage(&unlockBtnImg_g);
+ lockBtn.SetImageOver(&unlockBtnImg_g);
+ lockBtn.SetToolTip(&unlockBtnTT, 15, 52, 1, 3);
+ }
+
+/*
+ GuiButton unlockBtn(&unlockBtnImg_g, &unlockBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_lock_x, THEME.gamelist_lock_y, &trigA, &btnSoundOver, btnClick2,1, &lockBtnTT, 15, 52, 1, 3);
+ unlockBtn.SetAlpha(180);
+*/
+
+ GuiTooltip dvdBtnTT(tr("Mount DVD drive"));
+ if (Settings.wsprompt == yes)
+ dvdBtnTT.SetWidescreen(CFG.widescreen);
+ dvdBtnTT.SetAlpha(THEME.tooltipAlpha);
+ GuiImage dvdBtnImg(&imgdvd);
+ dvdBtnImg.SetWidescreen(CFG.widescreen);
+ GuiImage dvdBtnImg_g(dvdBtnImg); //dvdBtnImg_g.SetGrayscale();
+// GuiImage carouselBtnImg_g(&imgarrangeCarousel_gray);
+ dvdBtnImg_g.SetWidescreen(CFG.widescreen);
+ GuiButton dvdBtn(&dvdBtnImg_g,&dvdBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_dvd_x, THEME.gamelist_dvd_y, &trigA, &btnSoundOver, btnClick2,1, &dvdBtnTT, 15, 52, 1, 3);
+ dvdBtn.SetAlpha(180);
+
+ GuiTooltip homebrewBtnTT(tr("Homebrew Launcher"));
+ if (Settings.wsprompt == yes)
+ homebrewBtnTT.SetWidescreen(CFG.widescreen);
+ homebrewBtnTT.SetAlpha(THEME.tooltipAlpha);
+ GuiImage homebrewImg(&homebrewImgData);
+ GuiImage homebrewImgOver(&homebrewImgDataOver);
+ homebrewImg.SetWidescreen(CFG.widescreen);
+ homebrewImgOver.SetWidescreen(CFG.widescreen);
+ GuiButton homebrewBtn(&homebrewImg,&homebrewImgOver, ALIGN_LEFT, ALIGN_TOP, THEME.homebrew_x, THEME.homebrew_y, &trigA, &btnSoundOver, btnClick2,1,&homebrewBtnTT,15,-30,1,5);
+
+ if (Settings.fave) {
+ favoriteBtn.SetImage(&favoriteBtnImg);
+ favoriteBtn.SetImageOver(&favoriteBtnImg);
+ favoriteBtn.SetAlpha(255);
+ }
+ static bool show_searchwindow = false;
+ if(gameFilter && *gameFilter)
+ {
+ if(show_searchwindow && gameCnt==1)
+ show_searchwindow = false;
+ if(!show_searchwindow)
+ searchBtn.SetEffect(EFFECT_PULSE, 10, 105);
+ searchBtn.SetImage(&searchBtnImg);
+ searchBtn.SetImageOver(&searchBtnImg);
+ searchBtn.SetAlpha(255);
+ }
+ if (Settings.sort==all) {
+ abcBtn.SetImage(&abcBtnImg);
+ abcBtn.SetImageOver(&abcBtnImg);
+ abcBtn.SetAlpha(255);
+ } else if (Settings.sort==pcount) {
+ countBtn.SetImage(&countBtnImg);
+ countBtn.SetImageOver(&countBtnImg);
+ countBtn.SetAlpha(255);
+ }
+ if (Settings.gameDisplay==list) {
+ listBtn.SetImage(&listBtnImg);
+ listBtn.SetImageOver(&listBtnImg);
+ listBtn.SetAlpha(255);
+ } else if (Settings.gameDisplay==grid) {
+ gridBtn.SetImage(&gridBtnImg);
+ gridBtn.SetImageOver(&gridBtnImg);
+ gridBtn.SetAlpha(255);
+ } else if (Settings.gameDisplay==carousel) {
+ carouselBtn.SetImage(&carouselBtnImg);
+ carouselBtn.SetImageOver(&carouselBtnImg);
+ carouselBtn.SetAlpha(255);
+ }
+
+ if (Settings.gameDisplay==list) {
+ favoriteBtn.SetPosition(THEME.gamelist_favorite_x, THEME.gamelist_favorite_y);
+ searchBtn.SetPosition(THEME.gamelist_search_x, THEME.gamelist_search_y);
+ abcBtn.SetPosition(THEME.gamelist_abc_x, THEME.gamelist_abc_y);
+ countBtn.SetPosition(THEME.gamelist_count_x, THEME.gamelist_count_y);
+ listBtn.SetPosition(THEME.gamelist_list_x, THEME.gamelist_list_y);
+ gridBtn.SetPosition(THEME.gamelist_grid_x, THEME.gamelist_grid_y);
+ carouselBtn.SetPosition(THEME.gamelist_carousel_x, THEME.gamelist_carousel_y);
+ lockBtn.SetPosition(THEME.gamelist_lock_x, THEME.gamelist_lock_y);
+ dvdBtn.SetPosition(THEME.gamelist_dvd_x, THEME.gamelist_dvd_y);
+ } else if(Settings.gameDisplay==grid) {
+ favoriteBtn.SetPosition(THEME.gamegrid_favorite_x, THEME.gamegrid_favorite_y);
+ searchBtn.SetPosition(THEME.gamegrid_search_x, THEME.gamegrid_search_y);
+ abcBtn.SetPosition(THEME.gamegrid_abc_x, THEME.gamegrid_abc_y);
+ countBtn.SetPosition(THEME.gamegrid_count_x, THEME.gamegrid_count_y);
+ listBtn.SetPosition(THEME.gamegrid_list_x, THEME.gamegrid_list_y);
+ gridBtn.SetPosition(THEME.gamegrid_grid_x, THEME.gamegrid_grid_y);
+ carouselBtn.SetPosition(THEME.gamegrid_carousel_x, THEME.gamegrid_carousel_y);
+ lockBtn.SetPosition(THEME.gamegrid_lock_x, THEME.gamegrid_lock_y);
+ dvdBtn.SetPosition(THEME.gamegrid_dvd_x, THEME.gamegrid_dvd_y);
+ } else if(Settings.gameDisplay==carousel) {
+ favoriteBtn.SetPosition(THEME.gamecarousel_favorite_x, THEME.gamecarousel_favorite_y);
+ searchBtn.SetPosition(THEME.gamecarousel_search_x, THEME.gamecarousel_favorite_y);
+ abcBtn.SetPosition(THEME.gamecarousel_abc_x, THEME.gamecarousel_abc_y);
+ countBtn.SetPosition(THEME.gamecarousel_count_x, THEME.gamecarousel_count_y);
+ listBtn.SetPosition(THEME.gamecarousel_list_x, THEME.gamecarousel_list_y);
+ gridBtn.SetPosition(THEME.gamecarousel_grid_x, THEME.gamecarousel_grid_y);
+ carouselBtn.SetPosition(THEME.gamecarousel_carousel_x, THEME.gamecarousel_carousel_y);
+ lockBtn.SetPosition(THEME.gamecarousel_lock_x, THEME.gamecarousel_lock_y);
+ dvdBtn.SetPosition(THEME.gamecarousel_dvd_x, THEME.gamecarousel_dvd_y);
+ }
+
+
+ //Downloading Covers
+ GuiTooltip DownloadBtnTT(tr("Click to Download Covers"));
+ if (Settings.wsprompt == yes)
+ DownloadBtnTT.SetWidescreen(CFG.widescreen);
+ DownloadBtnTT.SetAlpha(THEME.tooltipAlpha);
+ GuiButton DownloadBtn(0,0);
+ DownloadBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
+ DownloadBtn.SetPosition(THEME.covers_x,THEME.covers_y);
+
+ GuiTooltip IDBtnTT(tr("Click to change game ID"));
+ if (Settings.wsprompt == yes)
+ IDBtnTT.SetWidescreen(CFG.widescreen);
+ IDBtnTT.SetAlpha(THEME.tooltipAlpha);
+ GuiButton idBtn(0,0);
+ idBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
+ idBtn.SetPosition(THEME.id_x,THEME.id_y);
+
+ if (Settings.godmode == 1 && mountMethod!=3) {//only make the button have trigger & tooltip if in godmode
+ DownloadBtn.SetSoundOver(&btnSoundOver);
+ DownloadBtn.SetTrigger(&trigA);
+ DownloadBtn.SetTrigger(&trig1);
+ DownloadBtn.SetToolTip(&DownloadBtnTT,205,-30);
+
+ idBtn.SetSoundOver(&btnSoundOver);
+ idBtn.SetTrigger(&trigA);
+ idBtn.SetToolTip(&IDBtnTT,205,-30);
+
+ } else
+ {
+ DownloadBtn.SetRumble(false);
+ idBtn.SetRumble(false);
+ }
+
+ GuiGameBrowser * gameBrowser = NULL;
+ GuiGameGrid * gameGrid = NULL;
+ GuiGameCarousel * gameCarousel = NULL;
+ if (Settings.gameDisplay==list) {
+ gameBrowser = new GuiGameBrowser(THEME.gamelist_w, THEME.gamelist_h, gameList, gameCnt, CFG.theme_path, bg_options_png, startat, offset);
+ gameBrowser->SetPosition(THEME.gamelist_x, THEME.gamelist_y);
+ gameBrowser->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE);
+ } else if (Settings.gameDisplay==grid) {
+ gameGrid = new GuiGameGrid(THEME.gamegrid_w,THEME.gamegrid_h, gameList, gameCnt, CFG.theme_path, bg_options_png, 0, 0);
+ gameGrid->SetPosition(THEME.gamegrid_x,THEME.gamegrid_y);
+ gameGrid->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE);
+ } else if (Settings.gameDisplay==carousel) {
+ //GuiGameCarousel gameCarousel(THEME.gamecarousel_w, THEME.gamecarousel_h, gameList, gameCnt, CFG.theme_path, bg_options_png, startat, offset);
+ gameCarousel = new GuiGameCarousel(640, 400, gameList, gameCnt, CFG.theme_path, bg_options_png, startat, offset);
+ gameCarousel->SetPosition(THEME.gamecarousel_x,THEME.gamecarousel_y);
+ gameCarousel->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE);
+ }
+
+ GuiText clockTimeBack("88:88", 40, (GXColor) {THEME.clock.r, THEME.clock.g, THEME.clock.b, THEME.clock.a/6});
+ clockTimeBack.SetAlignment(THEME.clock_align, ALIGN_TOP);
+ clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y);
+ clockTimeBack.SetFont(fontClock);
+ GuiText clockTime(theTime, 40, THEME.clock);
+ clockTime.SetAlignment(THEME.clock_align, ALIGN_TOP);
+ clockTime.SetPosition(THEME.clock_x, THEME.clock_y);
+ clockTime.SetFont(fontClock);
+
+ HaltGui();
+ GuiWindow w(screenwidth, screenheight);
+
+ if (THEME.show_hddinfo == -1 || THEME.show_hddinfo == 1) { //force show hdd info
+ w.Append(&usedSpaceTxt);
+ }
+ if (THEME.show_gamecount == -1 || THEME.show_gamecount == 1) { //force show game cnt info
+ w.Append(&gamecntBtn);
+ }
+ w.Append(&sdcardBtn);
+ w.Append(&poweroffBtn);
+ w.Append(&gameInfo);
+ if (Settings.godmode) {
+ w.Append(&installBtn);
+ }
+ w.Append(&homeBtn);
+ w.Append(&settingsBtn);
+ w.Append(&DownloadBtn);
+ w.Append(&idBtn);
+ w.Append(&screenShotBtn);
+
+
+ // Begin Toolbar
+ w.Append(&favoriteBtn);
+ Toolbar[0] = &favoriteBtn;
+ w.Append(&searchBtn);
+ Toolbar[1] = &searchBtn;
+ w.Append(&abcBtn);
+ Toolbar[2] = &abcBtn;
+ w.Append(&countBtn);
+ Toolbar[3] = &countBtn;
+ w.Append(&listBtn);
+ Toolbar[4] = &listBtn;
+ w.Append(&gridBtn);
+ Toolbar[5] = &gridBtn;
+ w.Append(&carouselBtn);
+ Toolbar[6] = &carouselBtn;
+ w.Append(&lockBtn);
+ Toolbar[7] = &lockBtn;
+ w.Append(&dvdBtn);
+ Toolbar[8] = &dvdBtn;
+ w.SetUpdateCallback(DiscListWinUpdateCallback);
+ // End Toolbar
+
+
+
+ if (Settings.godmode == 1)
+ w.Append(&homebrewBtn);
+
+ if ((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) {
+ w.Append(&clockTimeBack);
+ w.Append(&clockTime);
+ }
+
+ if (Settings.gameDisplay==list) {
+ mainWindow->Append(gameBrowser);
+ }
+ if (Settings.gameDisplay==grid) {
+ mainWindow->Append(gameGrid);
+ }
+ if (Settings.gameDisplay==carousel) {
+ mainWindow->Append(gameCarousel);
+ }
+ mainWindow->Append(&w);
+
+ GuiSearchBar *searchBar=NULL;
+ if(show_searchwindow) {
+ searchBar = new GuiSearchBar(gameFilterNextList);
+ if(searchBar)
+ mainWindow->Append(searchBar);
+ }
+
+ ResumeGui();
+
+// ShowMemInfo();
+
+ while (menu == MENU_NONE) {
+
+ if (idiotFlag==1) {
+ gprintf("\n\tIdiot flag");
+ char idiotBuffer[200];
+ snprintf(idiotBuffer, sizeof(idiotBuffer), "%s (%s). %s",tr("You have attempted to load a bad image"),
+ idiotChar,tr("Most likely it has dimensions that are not evenly divisible by 4."));
+
+ int deleteImg = WindowPrompt(0,idiotBuffer,tr("OK"),tr("Delete"));
+ if (deleteImg==0) {
+ snprintf(idiotBuffer, sizeof(idiotBuffer), "%s %s.",tr("You are about to delete "), idiotChar);
+ deleteImg = WindowPrompt(tr("Confirm"),idiotBuffer,tr("Delete"),tr("Cancel"));
+ if (deleteImg==1) {
+ remove(idiotChar);
+ }
+ }
+ idiotFlag=-1;
+ }
+
+ WDVD_GetCoverStatus(&covert);//for detecting if i disc has been inserted
+
+ // if the idiot is showing favorites and don't have any
+ if (Settings.fave && !gameCnt) {
+ WindowPrompt(tr("No Favorites"),tr("You are choosing to display favorites and you do not have any selected."),tr("Back"));
+ Settings.fave=!Settings.fave;
+ if (isInserted(bootDevice)) {
+ cfg_save_global();
+ }
+ __Menu_GetEntries();
+ menu = MENU_DISCLIST;
+ break;
+ }
+
+ //CLOCK
+ time_t rawtime = time(0); //this fixes code dump caused by the clock
+ if (((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) && rawtime != lastrawtime) {
+ lastrawtime = rawtime;
+ timeinfo = localtime (&rawtime);
+ if (dataed < 1) {
+ if (Settings.hddinfo == hr12) {
+ if (rawtime & 1)
+ strftime(theTime, sizeof(theTime), "%I:%M", timeinfo);
+ else
+ strftime(theTime, sizeof(theTime), "%I %M", timeinfo);
+ }
+ if (Settings.hddinfo == hr24) {
+ if (rawtime & 1)
+ strftime(theTime, sizeof(theTime), "%H:%M", timeinfo);
+ else
+ strftime(theTime, sizeof(theTime), "%H %M", timeinfo);
+ }
+ clockTime.SetText(theTime);
+
+ } else if (dataed > 0) {
+
+ clockTime.SetTextf("%i", (dataed-1));
+ }
+
+ }
+
+ if ((datagB<1)&&(Settings.cios==1)&&(Settings.video == ntsc)&&(Settings.hddinfo == hr12)&&(Settings.qboot==1)&&(Settings.wsprompt==0)&&(Settings.language==ger)&&(Settings.tooltips==0)){dataed=1;dataef=1;}if (dataef==1){if (cosa>7){cosa=1;}datag++;if (sina==3){wiiBtn.SetAlignment(ALIGN_LEFT,ALIGN_BOTTOM);wiiBtnImg.SetAngle(0);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((cosa)*70),(-2*(datag)+120));}else if(62<=datag){wiiBtn.SetPosition(((cosa)*70),((datag*2)-130));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==2){wiiBtn.SetAlignment(ALIGN_RIGHT,ALIGN_TOP);wiiBtnImg.SetAngle(270);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((-2*(datag)+130)),((cosa)*50));}else if(62<=datag){wiiBtn.SetPosition((2*(datag)-120),((cosa)*50));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==1){wiiBtn.SetAlignment(ALIGN_TOP,ALIGN_LEFT);wiiBtnImg.SetAngle(180);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((cosa)*70),(2*(datag)-120));}else if(62<=datag){wiiBtn.SetPosition(((cosa)*70),(-2*(datag)+130));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==0){wiiBtn.SetAlignment(ALIGN_TOP,ALIGN_LEFT);wiiBtnImg.SetAngle(90);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((2*(datag)-130)),((cosa)*50));}else if(62<=datag){wiiBtn.SetPosition((-2*(datag)+120),((cosa)*50));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}}
+ // respond to button presses
+ if (shutdown == 1) {
+ gprintf("\n\tshutdown");
+ Sys_Shutdown();
+ }
+ if (reset == 1)
+ Sys_Reboot();
+
+ if (updateavailable == true) {
+ gprintf("\n\tUpdate Available");
+ HaltGui();
+ GuiWindow ww(640,480);
+ w.SetState(STATE_DISABLED);
+ mainWindow->Append(&ww);
+ ResumeGui();
+ ProgressUpdateWindow();
+ updateavailable = false;
+ mainWindow->Remove(&ww);
+ w.SetState(STATE_DEFAULT);
+ menu = MENU_DISCLIST;
+ }
+
+ if (poweroffBtn.GetState() == STATE_CLICKED) {
+
+
+ gprintf("\n\tpoweroffBtn clicked");
+ choice = WindowPrompt(tr("How to Shutdown?"),0,tr("Full Shutdown"), tr("Shutdown to Idle"), tr("Cancel"));
+ if (choice == 2) {
+ Sys_ShutdownToIdel();
+ } else if (choice == 1) {
+ Sys_ShutdownToStandby();
+ } else {
+ poweroffBtn.ResetState();
+ if (Settings.gameDisplay==list) {
+ gameBrowser->SetFocus(1);
+ } else if (Settings.gameDisplay==grid) {
+ gameGrid->SetFocus(1);
+ } else if (Settings.gameDisplay==carousel) {
+ gameCarousel->SetFocus(1);
+ }
+ }
+
+ } else if (gamecntBtn.GetState() == STATE_CLICKED && mountMethod!=3) {
+ gprintf("\n\tgameCntBtn clicked");
+ gamecntBtn.ResetState();
+ char linebuf[150];
+ snprintf(linebuf, sizeof(linebuf), "%s %sGameList ?",tr("Save Game List to"), Settings.update_path);
+ choice = WindowPrompt(0,linebuf,"TXT","CSV",tr("Back"));
+ if (choice) {
+ if (save_gamelist(choice-1))
+ WindowPrompt(0,tr("Saved"),tr("OK"));
+ else
+ WindowPrompt(tr("Error"),tr("Could not save."),tr("OK"));
+ }
+ menu = MENU_DISCLIST;
+ break;
+
+ }
+ else if (screenShotBtn.GetState() == STATE_CLICKED) {
+ gprintf("\n\tscreenShotBtn clicked");
+ screenShotBtn.ResetState();
+ ScreenShot();
+ gprintf("...It's easy, mmmmmmKay");
+
+
+ }else if (homeBtn.GetState() == STATE_CLICKED) {
+ gprintf("\n\thomeBtn clicked");
+ bgMusic->Pause();
+ choice = WindowExitPrompt();
+ bgMusic->Resume();
+
+ if (choice == 3) {
+ Sys_LoadMenu(); // Back to System Menu
+ } else if (choice == 2) {
+ Sys_BackToLoader();
+ } else {
+ homeBtn.ResetState();
+ if (Settings.gameDisplay==list) {
+ gameBrowser->SetFocus(1);
+ } else if (Settings.gameDisplay==grid) {
+ gameGrid->SetFocus(1);
+ } else if (Settings.gameDisplay==carousel) {
+ gameCarousel->SetFocus(1);
+ }
+ }
+
+ } else if (wiiBtn.GetState() == STATE_CLICKED) {
+ gprintf("\n\twiiBtn clicked");
+
+ dataed++;
+ wiiBtn.ResetState();
+ if (Settings.gameDisplay==list) {
+ gameBrowser->SetFocus(1);
+ } else if (Settings.gameDisplay==grid) {
+ gameGrid->SetFocus(1);
+ } else if (Settings.gameDisplay==carousel) {
+ gameCarousel->SetFocus(1);
+ }
+ } else if (installBtn.GetState() == STATE_CLICKED) {
+ gprintf("\n\tinstallBtn clicked");
+ choice = WindowPrompt(tr("Install a game"),0,tr("Yes"),tr("No"));
+ if (choice == 1) {
+ menu = MENU_INSTALL;
+ break;
+ } else {
+ installBtn.ResetState();
+ if (Settings.gameDisplay==list) {
+ gameBrowser->SetFocus(1);
+ } else if (Settings.gameDisplay==grid) {
+ gameGrid->SetFocus(1);
+ } else if (Settings.gameDisplay==carousel) {
+ gameCarousel->SetFocus(1);
+ }
+ }
+ }else if ((covert & 0x2)&&(covert!=covertOld)) {
+ gprintf("\n\tNew Disc Detected");
+ choice = WindowPrompt(tr("New Disc Detected"),0,tr("Install"),tr("Mount DVD drive"),tr("Cancel"));
+ if (choice == 1) {
+ menu = MENU_INSTALL;
+ break;
+ }
+ else if (choice ==2)
+ {
+ dvdBtn.SetState(STATE_CLICKED);
+ }else {
+ if (Settings.gameDisplay==list) {
+ gameBrowser->SetFocus(1);
+ } else if (Settings.gameDisplay==grid) {
+ gameGrid->SetFocus(1);
+ } else if (Settings.gameDisplay==carousel) {
+ gameCarousel->SetFocus(1);
+ }
+ }
+ }
+
+ else if (sdcardBtn.GetState() == STATE_CLICKED) {
+ gprintf("\n\tsdCardBtn Clicked");
+ SDCard_deInit();
+ SDCard_Init();
+ if (Settings.gameDisplay==list) {
+ startat = gameBrowser->GetSelectedOption();
+ offset = gameBrowser->GetOffset();
+ } else if (Settings.gameDisplay==grid) {
+ startat = gameGrid->GetSelectedOption();
+ offset = gameGrid->GetOffset();
+ } else if (Settings.gameDisplay==carousel) {
+ startat = gameCarousel->GetSelectedOption();
+ offset = gameCarousel->GetOffset();
+ }
+ if (isInserted(bootDevice)) {
+ HaltGui(); // to fix endless rumble when clicking on the SD icon when rumble is disabled because rumble is set to on in Global_Default()
+ CFG_Load();
+ ResumeGui();
+ }
+ sdcardBtn.ResetState();
+ menu = MENU_DISCLIST;
+ break;
+ }
+
+ else if (DownloadBtn.GetState() == STATE_CLICKED) {
+ gprintf("\n\tDownloadBtn Clicked");
+ if (isInserted(bootDevice)) {
+ choice = WindowPrompt(tr("Cover Download"), 0, tr("Normal Covers"), tr("3D Covers"), tr("Disc Images"), tr("Back")); // ask for download choice
+ if (choice != 0) {
+ int choice2 = choice;
+ bool missing;
+ missing = SearchMissingImages(choice2);
+ if (IsNetworkInit() == false && missing == true) {
+ WindowPrompt(tr("Network init error"), 0, tr("OK"));
+ } else {
+ if (GetMissingFiles() != NULL && cntMissFiles > 0) {
+ char tempCnt[40];
+ sprintf(tempCnt,"%i %s",cntMissFiles,tr("Missing files"));
+ if (choice!=3)choice = WindowPrompt(tr("Download Boxart image?"),tempCnt,tr("Yes"),tr("No"));
+ else if (choice==3)choice = WindowPrompt(tr("Download Discart image?"),tempCnt,tr("Yes"),tr("No"));
+ if (choice == 1) {
+ ret = ProgressDownloadWindow(choice2);
+ if (ret == 0) {
+ WindowPrompt(tr("Download finished"),0,tr("OK"));
+ } else {
+ sprintf(tempCnt,"%i %s",ret,tr("files not found on the server!"));
+ WindowPrompt(tr("Download finished"),tempCnt,tr("OK"));
+ }
+ }
+ }
+ }
+ }
+ } else {
+ WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to download images."), tr("OK"));
+ }
+ menu = MENU_DISCLIST;
+ DownloadBtn.ResetState();
+ if (Settings.gameDisplay==list) {
+ gameBrowser->SetFocus(1);
+ } else if (Settings.gameDisplay==grid) {
+ gameGrid->SetFocus(1);
+ } else if (Settings.gameDisplay==carousel) {
+ gameCarousel->SetFocus(1);
+ }
+ }//end download
+
+ else if (settingsBtn.GetState() == STATE_CLICKED) {
+ gprintf("\n\tsettingsBtn Clicked");
+ if (Settings.gameDisplay==list) {
+ startat = gameBrowser->GetSelectedOption();
+ offset = gameBrowser->GetOffset();
+ } else if (Settings.gameDisplay==grid) {
+ startat = gameGrid->GetSelectedOption();
+ offset = gameGrid->GetOffset();
+ } else if (Settings.gameDisplay==carousel) {
+ startat = gameCarousel->GetSelectedOption();
+ offset = gameCarousel->GetOffset();
+ }
+ menu = MENU_SETTINGS;
+ break;
+
+ }
+
+ else if (favoriteBtn.GetState() == STATE_CLICKED) {
+ gprintf("\n\tfavoriteBtn Clicked");
+ Settings.fave=!Settings.fave;
+ if (isInserted(bootDevice)) {
+ cfg_save_global();
+ }
+ __Menu_GetEntries();
+ menu = MENU_DISCLIST;
+ break;
+
+ }
+
+ else if (searchBtn.GetState() == STATE_CLICKED && mountMethod!=3) {
+
+ gprintf("\n\tsearchBtn Clicked");
+ show_searchwindow=!show_searchwindow;
+ HaltGui();
+ if(searchBar)
+ {
+ mainWindow->Remove(searchBar);
+ delete searchBar;
+ searchBar = NULL;
+ }
+ if(show_searchwindow)
+ {
+ if(gameFilter && *gameFilter)
+ {
+ searchBtn.StopEffect();
+ searchBtn.SetEffectGrow();
+ }
+ searchBar = new GuiSearchBar(gameFilterNextList);
+ if(searchBar)
+ mainWindow->Append(searchBar);
+ }
+ else
+ {
+ if(gameFilter && *gameFilter)
+ searchBtn.SetEffect(EFFECT_PULSE, 10, 105);
+ }
+ searchBtn.ResetState();
+ ResumeGui();
+ }
+
+ else if (searchBar && (searchChar=searchBar->GetClicked())) {
+ if(searchChar > 27)
+ {
+ int len = gameFilter ? wcslen(gameFilter) : 0;
+ wchar_t newFilter[len+2];
+ if(gameFilter)
+ wcscpy(newFilter, gameFilter);
+ newFilter[len] = searchChar;
+ newFilter[len+1] = 0;
+
+
+ __Menu_GetEntries(0, newFilter);
+ menu = MENU_DISCLIST;
+ break;
+ }
+ else if(searchChar == 7) // Close
+ {
+ show_searchwindow=false;
+ HaltGui();
+ if(searchBar)
+ {
+ mainWindow->Remove(searchBar);
+ delete searchBar;
+ searchBar = NULL;
+ }
+ if(gameFilter && *gameFilter)
+ {
+ searchBtn.SetEffect(EFFECT_PULSE, 10, 105);
+ searchBtn.SetImage(&searchBtnImg);
+ searchBtn.SetImageOver(&searchBtnImg);
+ searchBtn.SetAlpha(255);
+ }
+ else
+ {
+ searchBtn.StopEffect();
+ searchBtn.SetEffectGrow();
+ searchBtn.SetImage(&searchBtnImg_g);
+ searchBtn.SetImageOver(&searchBtnImg_g);
+ searchBtn.SetAlpha(180);
+ }
+
+ ResumeGui();
+ }
+ else if(searchChar == 8) // Backspace
+ {
+ __Menu_GetEntries(0, gameFilterPrev);
+ menu = MENU_DISCLIST;
+ break;
+ }
+
+ }
+
+ else if (abcBtn.GetState() == STATE_CLICKED) {
+ gprintf("\n\tabcBtn clicked");
+ if (Settings.sort != all) {
+ Settings.sort=all;
+ if (isInserted(bootDevice)) {
+ cfg_save_global();
+ }
+ __Menu_GetEntries();
+
+ menu = MENU_DISCLIST;
+ break;
+ }
+ abcBtn.ResetState();
+ }
+
+ else if (countBtn.GetState() == STATE_CLICKED) {
+ gprintf("\n\tcountBtn Clicked");
+ if (Settings.sort != pcount) {
+ Settings.sort=pcount;
+ //if(isSdInserted()) {
+ if (isInserted(bootDevice)) {
+ cfg_save_global();
+ }
+ __Menu_GetEntries();
+
+ menu = MENU_DISCLIST;
+ break;
+ }
+ countBtn.ResetState();
+
+ }
+
+ else if (listBtn.GetState() == STATE_CLICKED) {
+ gprintf("\n\tlistBtn Clicked");
+ if (Settings.gameDisplay!=list) {
+ Settings.gameDisplay=list;
+ menu = MENU_DISCLIST;
+ if (isInserted(bootDevice)) {
+ cfg_save_global();
+ }
+ listBtn.ResetState();
+ break;
+ } else {
+ listBtn.ResetState();
+ }
+ }
+
+
+ else if (gridBtn.GetState() == STATE_CLICKED) {
+ gprintf("\n\tgridBtn Clicked");
+ if (Settings.gameDisplay!=grid) {
+
+ Settings.gameDisplay=grid;
+ menu = MENU_DISCLIST;
+ if (isInserted(bootDevice)) {
+ cfg_save_global();
+ }
+ gridBtn.ResetState();
+ break;
+ } else {
+ gridBtn.ResetState();
+ }
+ }
+
+ else if (carouselBtn.GetState() == STATE_CLICKED) {
+ gprintf("\n\tcarouselBtn Clicked");
+ if (Settings.gameDisplay!=carousel) {
+ Settings.gameDisplay=carousel;
+ menu = MENU_DISCLIST;
+ if (isInserted(bootDevice)) {
+ cfg_save_global();
+ }
+ carouselBtn.ResetState();
+ break;
+ } else {
+ carouselBtn.ResetState();
+ }
+ }
+ else if (homebrewBtn.GetState() == STATE_CLICKED) {
+ gprintf("\n\thomebrewBtn Clicked");
+ menu = MENU_HOMEBREWBROWSE;
+ break;
+ }
+ else if (gameInfo.GetState() == STATE_CLICKED && mountMethod!=3) {
+ gprintf("\n\tgameinfo Clicked");
+ gameInfo.ResetState();
+ if(selectImg1>=0 && selectImg1<(s32)gameCnt) {
+ gameSelected = selectImg1;
+ rockout();
+ struct discHdr *header = &gameList[selectImg1];
+ snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
+ choice = showGameInfo(IDfull);
+ rockout(2);
+ if (choice==2)
+ homeBtn.SetState(STATE_CLICKED);
+ if (choice==3) {
+ menu = MENU_DISCLIST;
+ break;
+ }
+ }
+ }
+ else if (lockBtn.GetState() == STATE_CLICKED) {
+ gprintf("\n\tlockBtn clicked");
+ lockBtn.ResetState();
+ if (!canUnlock) {
+ WindowPrompt(tr("Parental Control"), tr("You don't have Parental Control enabled. If you wish to use Parental Control, enable it in the Wii Settings."), tr("OK"));
+ } else {
+ if (Settings.godmode) {
+ if (WindowPrompt(tr("Parental Control"), tr("Are you sure you want to enable Parent Control?"), tr("Yes"), tr("No")) == 1) {
+ Settings.godmode = 0;
+ lockBtn.SetImage(&lockBtnImg_g);
+ lockBtn.SetImageOver(&lockBtnImg_g);
+ lockBtn.SetToolTip(&lockBtnTT, 15, 52, 1, 3);
+
+ // Retrieve the gamelist again
+ menu = MENU_DISCLIST;
+ break;
+ }
+ } else {
+ // Require the user to enter the PIN code
+ char pin[5];
+ memset(&pin, 0, 5);
+ int ret = OnScreenNumpad((char *) &pin, 5);
+
+ if (ret == 1) {
+ if (memcmp(pin, Settings.parental.pin, 4) == 0) {
+ Settings.godmode = 1;
+ lockBtn.SetImage(&unlockBtnImg_g);
+ lockBtn.SetImageOver(&unlockBtnImg_g);
+ lockBtn.SetToolTip(&unlockBtnTT, 15, 52, 1, 3);
+
+ // Retrieve the gamelist again
+ menu = MENU_DISCLIST;
+ break;
+ } else {
+ WindowPrompt(tr("Parental Control"), tr("Invalid PIN code"), tr("OK"));
+ }
+ }
+ }
+ }
+ }
+ else if (dvdBtn.GetState() == STATE_CLICKED) {
+ gprintf("\n\tdvdBtn Clicked");
+ mountMethodOLD = (mountMethod==3?mountMethod:0);
+
+ mountMethod=DiscMount(dvdheader);
+ dvdBtn.ResetState();
+
+ rockout();
+ //break;
+ }
+ if (Settings.gameDisplay==grid) {
+ int selectimg;
+ DownloadBtn.SetSize(0,0);
+ selectimg = gameGrid->GetSelectedOption();
+ gameSelected = gameGrid->GetClickedOption();
+ selectImg1=selectimg;
+ }
+
+ if (Settings.gameDisplay==carousel) {
+ int selectimg;
+ DownloadBtn.SetSize(0,0);
+ selectimg = gameCarousel->GetSelectedOption();
+ gameSelected = gameCarousel->GetClickedOption();
+ selectImg1=selectimg;
+ }
+ if (Settings.gameDisplay==list) {
+ //Get selected game under cursor
+ int selectimg;
+ DownloadBtn.SetSize(160,224);
+ idBtn.SetSize(100,40);
+
+ selectimg = gameBrowser->GetSelectedOption();
+ gameSelected = gameBrowser->GetClickedOption();
+ selectImg1=selectimg;
+
+ if (gameSelected > 0) //if click occured
+ selectimg = gameSelected;
+
+ char gameregion[7];
+ if ((selectimg >= 0) && (selectimg < (s32) gameCnt)) {
+ if (selectimg != selectedold) {
+ selectedold = selectimg;//update displayed cover, game ID, and region if the selected game changes
+ struct discHdr *header = &gameList[selectimg];
+ snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
+ snprintf (IDfull,sizeof(IDfull),"%s%c%c%c", ID, header->id[3], header->id[4], header->id[5]);
+ w.Remove(&DownloadBtn);
+
+ if (GameIDTxt) {
+ w.Remove(&idBtn);
+ delete GameIDTxt;
+ GameIDTxt = NULL;
+ }
+ if (GameRegionTxt) {
+ w.Remove(GameRegionTxt);
+ delete GameRegionTxt;
+ GameRegionTxt = NULL;
+ }
+
+ switch (header->id[3]) {
+ case 'E':
+ sprintf(gameregion,"NTSC U");
+ break;
+ case 'J':
+ sprintf(gameregion,"NTSC J");
+ break;
+ case 'W':
+ sprintf(gameregion,"NTSC T");
+ break;
+ default:
+ case 'K':
+ sprintf(gameregion,"NTSC K");
+ break;
+ case 'P':
+ case 'D':
+ case 'F':
+ case 'I':
+ case 'S':
+ case 'H':
+ case 'U':
+ case 'X':
+ case 'Y':
+ case 'Z':
+ sprintf(gameregion," PAL ");
+ break;
+ }
+
+ //load game cover
+ if (cover) {
+ delete cover;
+ cover = NULL;
+ }
+
+ cover = LoadCoverImage(header);
+
+ if (coverImg) {
+ delete coverImg;
+ coverImg = NULL;
+ }
+ coverImg = new GuiImage(cover);
+ coverImg->SetWidescreen(CFG.widescreen);
+
+ DownloadBtn.SetImage(coverImg);// put the new image on the download button
+ w.Append(&DownloadBtn);
+
+ if ((Settings.sinfo == GameID) || (Settings.sinfo == Both)) {
+ GameIDTxt = new GuiText(IDfull, 22, THEME.info);
+ GameIDTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
+ //GameIDTxt->SetPosition(THEME.id_x,THEME.id_y);
+ idBtn.SetEffect(EFFECT_FADE, 20);
+ idBtn.SetLabel(GameIDTxt);
+ w.Append(&idBtn);
+ }
+ //don't try to show region for channels because all the custom channels wont follow the rules
+ if (((Settings.sinfo == GameRegion) || (Settings.sinfo == Both))&&mountMethod!=3) {
+ GameRegionTxt = new GuiText(gameregion, 22, THEME.info);
+ GameRegionTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
+ GameRegionTxt->SetPosition(THEME.region_x, THEME.region_y);
+ GameRegionTxt->SetEffect(EFFECT_FADE, 20);
+ w.Append(GameRegionTxt);
+ }
+ }
+ }
+
+ if (idBtn.GetState() == STATE_CLICKED && mountMethod!=3) {
+ gprintf("\n\tidBtn Clicked");
+ struct discHdr * header = &gameList[gameBrowser->GetSelectedOption()];
+ //enter new game ID
+ char entered[10];
+ snprintf(entered, sizeof(entered), "%s", IDfull);
+ //entered[9] = '\0';
+ int result = OnScreenKeyboard(entered, 7,0);
+ if (result == 1) {
+ WBFS_ReIDGame(header->id, entered);
+ //__Menu_GetEntries();
+ menu = MENU_DISCLIST;
+ }
+
+ idBtn.ResetState();
+ }
+ startat=gameBrowser->GetOffset(), offset=startat;
+ }
+
+ if (((gameSelected >= 0) && (gameSelected < (s32)gameCnt))
+ || mountMethod==1
+ || mountMethod==2) {
+ if(searchBar)
+ {
+ HaltGui();
+ mainWindow->Remove(searchBar);
+ ResumeGui();
+ }
+ rockout();
+ struct discHdr *header = (mountMethod==1||mountMethod==2?dvdheader:&gameList[gameSelected]);
+ // struct discHdr *header = dvdheader:&gameList[gameSelected]);
+ if (!mountMethod)//only get this stuff it we are booting a game from USB
+ {
+ WBFS_GameSize(header->id, &size);
+ if (strlen(get_title(header)) < (MAX_CHARACTERS + 3)) {
+ sprintf(text, "%s", get_title(header));
+ } else {
+ strncpy(text, get_title(header), MAX_CHARACTERS);
+ text[MAX_CHARACTERS] = '\0';
+ strncat(text, "...", 3);
+ }
+ }
+
+ //check if alt Dol and gct file is present
+ FILE *exeFile = NULL;
+ char nipple[100];
+ header = (mountMethod==1||mountMethod==2?dvdheader:&gameList[gameSelected]); //reset header
+ snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
+ struct Game_CFG* game_cfg = CFG_get_game_opt(header->id);
+
+ if (game_cfg) {
+ alternatedol = game_cfg->loadalternatedol;
+ ocarinaChoice = game_cfg->ocarina;
+ } else {
+ alternatedol = off;
+ ocarinaChoice = Settings.ocarina;
+ }
+
+
+ if (Settings.qboot == yes) { //quickboot game
+ if (alternatedol == on) {
+ /* Open dol File and check exist */
+ sprintf(nipple, "%s%s.dol",Settings.dolpath,IDfull);
+ exeFile = fopen (nipple ,"rb");
+ if (exeFile==NULL) {
+ sprintf(nipple, "%s %s",nipple,tr("does not exist!"));
+ WindowPrompt(tr("Error"),nipple,tr("OK"));
+ menu = MENU_CHECK;
+ wiilight(0);
+ break;
+ } else {
+ fclose(exeFile);
+ }
+ }
+ if (ocarinaChoice != off) {
+ /* Open gct File and check exist */
+ sprintf(nipple, "%s%s.gct",Settings.Cheatcodespath,IDfull);
+ exeFile = fopen (nipple ,"rb");
+ if (exeFile==NULL) {
+ gprintf("\n\ttried to load missing gct.");
+ sprintf(nipple, "%s %s",nipple,tr("does not exist! Loading game without cheats."));
+ WindowPrompt(tr("Error"),nipple,NULL,NULL,NULL,NULL,170);
+ } else {
+ fclose(exeFile);
+ }
+
+ }
+
+ wiilight(0);
+ if (isInserted(bootDevice)) {
+ //////////save game play count////////////////
+ struct Game_NUM* game_num = CFG_get_game_num(header->id);
+
+ if (game_num) {
+ favoritevar = game_num->favorite;
+ playcount = game_num->count;
+ } else {
+ favoritevar = 0;
+ playcount = 0;
+ }
+ playcount += 1;
+
+ CFG_save_game_num(header->id);
+ gprintf("\n\tplaycount for %c%c%c%c%c%c raised to %i",header->id[0],header->id[1],header->id[2],header->id[3],header->id[4],header->id[5],playcount);
+
+ }
+ menu = MENU_EXIT;
+ break;
+
+ }
+ bool returnHere = true;// prompt to start game
+ while (returnHere) {
+ returnHere = false;
+ if (Settings.wiilight != wiilight_forInstall) wiilight(1);
+ choice = GameWindowPrompt();
+ // header = &gameList[gameSelected]; //reset header
+
+ if (choice == 1) {
+ if (alternatedol == on) {
+ /* Open dol File and check exist */
+ sprintf(nipple, "%s%s.dol",Settings.dolpath,IDfull);
+ exeFile = fopen (nipple ,"rb");
+ if (exeFile==NULL) {
+ gprintf("\n\tTried to load alt dol that isn't there");
+ sprintf(nipple, "%s %s",nipple,tr("does not exist! You Messed something up, Idiot."));
+ WindowPrompt(tr("Error"),nipple,tr("OK"));
+ menu = MENU_CHECK;
+ wiilight(0);
+ break;
+ } else {
+ fclose(exeFile);
+ }
+ }
+ if (ocarinaChoice != off) {
+ /* Open gct File and check exist */
+ sprintf(nipple, "%s%s.gct",Settings.Cheatcodespath,IDfull);
+ exeFile = fopen (nipple ,"rb");
+ if (exeFile==NULL) {
+ gprintf("\n\ttried to load gct file that isn't there");
+ sprintf(nipple, "%s %s",nipple,tr("does not exist! Loading game without cheats."));
+ WindowPrompt(tr("Error"),nipple,NULL,NULL,NULL,NULL,170);
+ } else {
+ fclose(exeFile);
+ }
+
+ }
+ wiilight(0);
+ returnHere = false;
+ menu = MENU_EXIT;
+
+ } else if (choice == 2) {
+ wiilight(0);
+ HaltGui();
+ if (Settings.gameDisplay==list) mainWindow->Remove(gameBrowser);
+ else if (Settings.gameDisplay==grid) mainWindow->Remove(gameGrid);
+ else if (Settings.gameDisplay==carousel) mainWindow->Remove(gameCarousel);
+ mainWindow->Remove(&w);
+ ResumeGui();
+
+ //re-evaluate header now in case they changed games while on the game prompt
+ header = (mountMethod==1||mountMethod==2?dvdheader:&gameList[gameSelected]);
+ int settret = GameSettings(header);
+ /* unneeded for now, kept in case database gets a separate language setting
+ //menu = MENU_DISCLIST; // refresh titles (needed if the language setting has changed)
+ */
+ HaltGui();
+ if (Settings.gameDisplay==list) mainWindow->Append(gameBrowser);
+ else if (Settings.gameDisplay==grid) mainWindow->Append(gameGrid);
+ else if (Settings.gameDisplay==carousel) mainWindow->Append(gameCarousel);
+ mainWindow->Append(&w);
+ ResumeGui();
+ if (settret == 1) { //if deleted
+ menu = MENU_DISCLIST;
+ break;
+ }
+ returnHere = true;
+ rockout(2);
+ }
+
+ else if (choice == 3 && !mountMethod) { //WBFS renaming
+ wiilight(0);
+ //re-evaluate header now in case they changed games while on the game prompt
+ header = &gameList[gameSelected];
+
+ //enter new game title
+ char entered[60];
+ snprintf(entered, sizeof(entered), "%s", get_title(header));
+ entered[59] = '\0';
+ int result = OnScreenKeyboard(entered, 60,0);
+ if (result == 1) {
+ WBFS_RenameGame(header->id, entered);
+ __Menu_GetEntries();
+ menu = MENU_DISCLIST;
+ }
+ } else if (choice == 0) {
+ rockout(2);
+ if (mountMethod==1||mountMethod==2)mountMethod = mountMethodOLD;
+ if (Settings.gameDisplay==list) {
+ gameBrowser->SetFocus(1);
+ } else if (Settings.gameDisplay==grid) {
+ gameGrid->SetFocus(1);
+ } else if (Settings.gameDisplay==carousel) {
+ gameCarousel->SetFocus(1);
+ }
+ }
+
+
+ }
+ if(searchBar)
+ {
+ HaltGui();
+ mainWindow->Append(searchBar);
+ ResumeGui();
+ }
+ }
+ // to skip the first call of windowScreensaver at startup when wiimote is not connected
+ if (IsWpadConnected()) {
+ check = 1;
+ }
+
+ // screensaver is called when wiimote shuts down, depending on the wiimotet idletime
+ if (!IsWpadConnected() && check !=0 && Settings.screensaver!=0) {
+ check++;
+ int screensaverIsOn=0;
+ if (check==11500) { //to allow time for the wii to turn off and not show the screensaver
+ screensaverIsOn=WindowScreensaver();
+ }
+ if (screensaverIsOn==1)check=0;
+ }
+ covertOld=covert;
+ }
+
+ // set alt dol default
+ if (menu == MENU_EXIT && altdoldefault) {
+ struct discHdr *header = (mountMethod==1||mountMethod==2?dvdheader:&gameList[gameSelected]);
+ struct Game_CFG* game_cfg = CFG_get_game_opt(header->id);
+ // use default only if no alt dol was selected manually
+ if (game_cfg) {
+ if (game_cfg->alternatedolstart != 0)
+ altdoldefault = false;
+ }
+ if (altdoldefault) {
+ int autodol = autoSelectDol((char*)header->id, true);
+ if (autodol>0) {
+ alternatedol = 2;
+ alternatedoloffset = autodol;
+ char temp[20];
+ sprintf(temp,"%d",autodol);
+ } else {
+ // alt dol menu for games that require more than a single alt dol
+ int autodol = autoSelectDolMenu((char*)header->id, true);
+ if (autodol>0) {
+ alternatedol = 2;
+ alternatedoloffset = autodol;
+ }
+ }
+ }
+ }
+//no need to close sd here. we still need to get settings and codes and shit
+ /*if (menu == MENU_EXIT) {
+ SDCard_deInit();
+ }*/
+ //if (Settings.gameDisplay==list) {startat=gameBrowser->GetOffset(), offset=startat;}//save the variables in case we are refreshing the list
+ //gprintf("\n\tstartat:%d offset:%d",startat,offset);
+ HaltGui();
+ mainWindow->RemoveAll();
+ mainWindow->Append(bgImg);
+ delete searchBar;
+ searchBar = NULL;
+ delete gameBrowser;
+ gameBrowser = NULL;
+ delete gameGrid;
+ gameGrid = NULL;
+ delete gameCarousel;
+ gameCarousel = NULL;
+ ResumeGui();
+ return menu;
+}
+
+void DiscListWinUpdateCallback(void * e)
+{
+ GuiWindow *w = (GuiWindow *)e;
+ for(int i=0; i<8; ++i)
+ {
+ if(Toolbar[i]->GetState() == STATE_SELECTED)
+ {
+ w->Remove(Toolbar[i]);
+ w->Append(Toolbar[i]); // draw the selected Icon allways on top
+ break;
+ }
+ }
+}
+
+void rockout(int f) {
+
+
+ HaltGui();
+ int num=(f==2?-1:gameSelected);
+
+ char imgPath[100];
+ if ((!(strcasestr(get_title(&gameList[num]),"guitar")||
+ strcasestr(get_title(&gameList[num]),"band")||
+ strcasestr(get_title(&gameList[num]),"rock")||
+ f==1))||mountMethod) {
+ for (int i = 0; i < 4; i++)
+ delete pointer[i];
+ snprintf(imgPath, sizeof(imgPath), "%splayer1_point.png", CFG.theme_path);
+ pointer[0] = new GuiImageData(imgPath, player1_point_png);
+ snprintf(imgPath, sizeof(imgPath), "%splayer2_point.png", CFG.theme_path);
+ pointer[1] = new GuiImageData(imgPath, player2_point_png);
+ snprintf(imgPath, sizeof(imgPath), "%splayer3_point.png", CFG.theme_path);
+ pointer[2] = new GuiImageData(imgPath, player3_point_png);
+ snprintf(imgPath, sizeof(imgPath), "%splayer4_point.png", CFG.theme_path);
+ pointer[3] = new GuiImageData(imgPath, player4_point_png);
+ } else {
+
+ for (int i = 0; i < 4; i++)
+ delete pointer[i];
+ snprintf(imgPath, sizeof(imgPath), "%srplayer1_point.png", CFG.theme_path);
+ pointer[0] = new GuiImageData(imgPath, rplayer1_point_png);
+ snprintf(imgPath, sizeof(imgPath), "%srplayer2_point.png", CFG.theme_path);
+ pointer[1] = new GuiImageData(imgPath, rplayer2_point_png);
+ snprintf(imgPath, sizeof(imgPath), "%srplayer3_point.png", CFG.theme_path);
+ pointer[2] = new GuiImageData(imgPath, rplayer3_point_png);
+ snprintf(imgPath, sizeof(imgPath), "%srplayer4_point.png", CFG.theme_path);
+ pointer[3] = new GuiImageData(imgPath, rplayer4_point_png);
+ }
+ ResumeGui();
+}
diff --git a/source/patches/codehandler.h b/source/patches/codehandler.h
new file mode 100644
index 00000000..a5a80be1
--- /dev/null
+++ b/source/patches/codehandler.h
@@ -0,0 +1,277 @@
+/*
+ This file was autogenerated by raw2c.
+Visit http://www.devkitpro.org
+*/
+
+const unsigned char codehandler[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x27, 0x74, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94, 0x21, 0xff, 0x58, 0x90, 0x01, 0x00, 0x08,
+ 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0xac, 0x7c, 0x00, 0x00, 0x26, 0x90, 0x01, 0x00, 0x0c,
+ 0x7c, 0x09, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x10, 0x7c, 0x01, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x14,
+ 0xbc, 0x61, 0x00, 0x18, 0x7f, 0x20, 0x00, 0xa6, 0x63, 0x3a, 0x20, 0x00, 0x73, 0x5a, 0xf9, 0xff,
+ 0x7f, 0x40, 0x01, 0x24, 0xd8, 0x41, 0x00, 0x98, 0xd8, 0x61, 0x00, 0xa0, 0x3f, 0xe0, 0x80, 0x00,
+ 0x3e, 0x80, 0xcc, 0x00, 0xa3, 0x94, 0x40, 0x10, 0x63, 0x95, 0x00, 0xff, 0xb2, 0xb4, 0x40, 0x10,
+ 0x48, 0x00, 0x06, 0x55, 0x3a, 0xa0, 0x00, 0x00, 0x3a, 0xc0, 0x00, 0x19, 0x3a, 0xe0, 0x00, 0xd0,
+ 0x3f, 0x00, 0xcd, 0x00, 0x63, 0xf2, 0x27, 0x74, 0x80, 0x01, 0x00, 0xac, 0x90, 0x12, 0x00, 0x04,
+ 0x92, 0xb8, 0x64, 0x3c, 0x48, 0x00, 0x04, 0x2d, 0x41, 0x82, 0x05, 0xa4, 0x2c, 0x1d, 0x00, 0x04,
+ 0x40, 0x80, 0x00, 0x10, 0x2c, 0x1d, 0x00, 0x01, 0x41, 0x80, 0x05, 0x94, 0x48, 0x00, 0x03, 0x4c,
+ 0x41, 0x82, 0x04, 0xf0, 0x2c, 0x1d, 0x00, 0x06, 0x41, 0x82, 0x00, 0x8c, 0x2c, 0x1d, 0x00, 0x07,
+ 0x41, 0x82, 0x03, 0x30, 0x2c, 0x1d, 0x00, 0x08, 0x41, 0x82, 0x05, 0x80, 0x2c, 0x1d, 0x00, 0x09,
+ 0x41, 0x82, 0x00, 0xa0, 0x2c, 0x1d, 0x00, 0x10, 0x41, 0x82, 0x00, 0x98, 0x2c, 0x1d, 0x00, 0x2f,
+ 0x41, 0x82, 0x00, 0x70, 0x2c, 0x1d, 0x00, 0x30, 0x41, 0x82, 0x00, 0x78, 0x2c, 0x1d, 0x00, 0x38,
+ 0x41, 0x82, 0x05, 0x28, 0x2c, 0x1d, 0x00, 0x40, 0x41, 0x82, 0x03, 0x40, 0x2c, 0x1d, 0x00, 0x41,
+ 0x41, 0x82, 0x03, 0x58, 0x2c, 0x1d, 0x00, 0x44, 0x41, 0x82, 0x00, 0x68, 0x2c, 0x1d, 0x00, 0x50,
+ 0x41, 0x82, 0x00, 0x20, 0x2c, 0x1d, 0x00, 0x60, 0x41, 0x82, 0x00, 0x24, 0x2c, 0x1d, 0x00, 0x89,
+ 0x41, 0x82, 0x00, 0x50, 0x2c, 0x1d, 0x00, 0x99, 0x41, 0x82, 0x05, 0x0c, 0x48, 0x00, 0x05, 0x10,
+ 0x80, 0x72, 0x00, 0x00, 0x48, 0x00, 0x04, 0x29, 0x48, 0x00, 0x05, 0x04, 0x48, 0x00, 0x05, 0x89,
+ 0x48, 0x00, 0x04, 0xfc, 0x38, 0x80, 0x00, 0x01, 0x90, 0x92, 0x00, 0x00, 0x48, 0x00, 0x04, 0xf0,
+ 0x48, 0x00, 0x04, 0x09, 0x3a, 0x00, 0x00, 0xa0, 0x63, 0xec, 0x27, 0x98, 0x48, 0x00, 0x03, 0x14,
+ 0x38, 0x60, 0x01, 0x20, 0x63, 0xec, 0x27, 0x98, 0x48, 0x00, 0x03, 0xc9, 0x48, 0x00, 0x04, 0xd0,
+ 0x2f, 0x1d, 0x00, 0x10, 0x2e, 0x9d, 0x00, 0x44, 0x63, 0xe4, 0x1a, 0xb4, 0x3c, 0x60, 0x80, 0x00,
+ 0x60, 0x63, 0x03, 0x00, 0x48, 0x00, 0x05, 0x09, 0x38, 0x63, 0x0a, 0x00, 0x48, 0x00, 0x05, 0x01,
+ 0x38, 0x63, 0x06, 0x00, 0x48, 0x00, 0x04, 0xf9, 0x63, 0xec, 0x27, 0x88, 0x92, 0xac, 0x00, 0x00,
+ 0x92, 0xac, 0x00, 0x04, 0x92, 0xac, 0x00, 0x08, 0x63, 0xe4, 0x27, 0x98, 0x81, 0x24, 0x00, 0x18,
+ 0x80, 0x72, 0x00, 0x00, 0x2c, 0x03, 0x00, 0x02, 0x40, 0x82, 0x00, 0x0c, 0x41, 0x96, 0x00, 0x0c,
+ 0x48, 0x00, 0x00, 0x20, 0x38, 0x60, 0x00, 0x00, 0x90, 0x6c, 0x00, 0x0c, 0x40, 0x82, 0x00, 0x14,
+ 0x40, 0x96, 0x00, 0x10, 0x61, 0x29, 0x04, 0x00, 0x91, 0x24, 0x00, 0x18, 0x48, 0x00, 0x02, 0x14,
+ 0x55, 0x29, 0x05, 0xa8, 0x91, 0x24, 0x00, 0x18, 0x41, 0x96, 0x04, 0x54, 0x41, 0x9a, 0x00, 0x08,
+ 0x39, 0x8c, 0x00, 0x04, 0x38, 0x60, 0x00, 0x04, 0x48, 0x00, 0x03, 0x09, 0x40, 0x99, 0x00, 0x10,
+ 0x39, 0x8c, 0x00, 0x04, 0x38, 0x60, 0x00, 0x04, 0x48, 0x00, 0x02, 0xf9, 0x63, 0xe4, 0x27, 0x88,
+ 0x80, 0x64, 0x00, 0x00, 0x80, 0x84, 0x00, 0x04, 0x7c, 0x72, 0xfb, 0xa6, 0x7c, 0x95, 0xfb, 0xa6,
+ 0x48, 0x00, 0x04, 0x1c, 0x7c, 0x32, 0x43, 0xa6, 0x7c, 0x3a, 0x02, 0xa6, 0x7c, 0x73, 0x43, 0xa6,
+ 0x7c, 0x7b, 0x02, 0xa6, 0x54, 0x63, 0x05, 0xa8, 0x90, 0x60, 0x27, 0xb0, 0x54, 0x63, 0x06, 0x1e,
+ 0x60, 0x63, 0x20, 0x00, 0x7c, 0x7b, 0x03, 0xa6, 0x3c, 0x60, 0x80, 0x00, 0x60, 0x63, 0x1a, 0xe8,
+ 0x7c, 0x7a, 0x03, 0xa6, 0x4c, 0x00, 0x00, 0x64, 0x3c, 0x60, 0x80, 0x00, 0x60, 0x63, 0x27, 0x98,
+ 0x90, 0x23, 0x00, 0x14, 0x7c, 0x61, 0x1b, 0x78, 0x7c, 0x73, 0x42, 0xa6, 0xbc, 0x41, 0x00, 0x24,
+ 0x7c, 0x24, 0x0b, 0x78, 0x7c, 0x32, 0x42, 0xa6, 0x90, 0x04, 0x00, 0x1c, 0x90, 0x24, 0x00, 0x20,
+ 0x7c, 0x68, 0x02, 0xa6, 0x90, 0x64, 0x00, 0x9c, 0x7c, 0x60, 0x00, 0x26, 0x90, 0x64, 0x00, 0x00,
+ 0x7c, 0x61, 0x02, 0xa6, 0x90, 0x64, 0x00, 0x04, 0x7c, 0x69, 0x02, 0xa6, 0x90, 0x64, 0x00, 0x08,
+ 0x7c, 0x72, 0x02, 0xa6, 0x90, 0x64, 0x00, 0x0c, 0x7c, 0x73, 0x02, 0xa6, 0x90, 0x64, 0x00, 0x10,
+ 0x39, 0x20, 0x00, 0x00, 0x7d, 0x32, 0xfb, 0xa6, 0x7d, 0x35, 0xfb, 0xa6, 0x3c, 0xa0, 0x80, 0x00,
+ 0x60, 0xa5, 0x1b, 0x70, 0x3f, 0xe0, 0xd0, 0x04, 0x63, 0xff, 0x00, 0xa0, 0x93, 0xe5, 0x00, 0x00,
+ 0x7c, 0x00, 0x28, 0x6c, 0x7c, 0x00, 0x04, 0xac, 0x7c, 0x00, 0x2f, 0xac, 0x4c, 0x00, 0x01, 0x2c,
+ 0xd0, 0x04, 0x00, 0xa0, 0x3b, 0xff, 0x00, 0x04, 0x3f, 0xff, 0x00, 0x20, 0x57, 0xf0, 0x01, 0x4b,
+ 0x41, 0x82, 0xff, 0xdc, 0x3f, 0xe0, 0x80, 0x00, 0x63, 0xe5, 0x27, 0x88, 0x82, 0x05, 0x00, 0x00,
+ 0x82, 0x25, 0x00, 0x04, 0x82, 0x65, 0x00, 0x0c, 0x2c, 0x13, 0x00, 0x00, 0x41, 0x82, 0x00, 0x74,
+ 0x2c, 0x13, 0x00, 0x02, 0x40, 0x82, 0x00, 0x18, 0x81, 0x24, 0x00, 0x14, 0x39, 0x33, 0x00, 0x03,
+ 0x91, 0x25, 0x00, 0x00, 0x91, 0x25, 0x00, 0x0c, 0x48, 0x00, 0x00, 0x6c, 0x7c, 0x10, 0x98, 0x00,
+ 0x41, 0x82, 0x00, 0x38, 0x7c, 0x11, 0x98, 0x00, 0x41, 0x82, 0x00, 0x30, 0x7d, 0x30, 0x8a, 0x14,
+ 0x91, 0x25, 0x00, 0x0c, 0x82, 0x05, 0x00, 0x08, 0x2c, 0x10, 0x00, 0x00, 0x41, 0x82, 0x00, 0x48,
+ 0x80, 0x64, 0x00, 0x10, 0x7c, 0x10, 0x18, 0x00, 0x40, 0x82, 0x00, 0x10, 0x3a, 0x00, 0x00, 0x00,
+ 0x92, 0x05, 0x00, 0x08, 0x48, 0x00, 0x00, 0x30, 0x3a, 0x20, 0x00, 0x00, 0x92, 0x25, 0x00, 0x0c,
+ 0x81, 0x24, 0x00, 0x18, 0x61, 0x29, 0x04, 0x00, 0x91, 0x24, 0x00, 0x18, 0x48, 0x00, 0x00, 0x30,
+ 0x7e, 0x12, 0xfb, 0xa6, 0x7e, 0x35, 0xfb, 0xa6, 0x39, 0x20, 0x00, 0x01, 0x91, 0x25, 0x00, 0x0c,
+ 0x48, 0x00, 0x00, 0x1c, 0x38, 0xa0, 0x00, 0x02, 0x63, 0xe4, 0x27, 0x74, 0x90, 0xa4, 0x00, 0x00,
+ 0x38, 0x60, 0x00, 0x11, 0x48, 0x00, 0x01, 0xb9, 0x4b, 0xff, 0xfc, 0x71, 0x7c, 0x20, 0x00, 0xa6,
+ 0x54, 0x21, 0x07, 0xfa, 0x54, 0x21, 0x04, 0x5e, 0x7c, 0x20, 0x01, 0x24, 0x63, 0xe1, 0x27, 0x98,
+ 0x80, 0x61, 0x00, 0x00, 0x7c, 0x6f, 0xf1, 0x20, 0x80, 0x61, 0x00, 0x14, 0x7c, 0x7a, 0x03, 0xa6,
+ 0x80, 0x61, 0x00, 0x18, 0x7c, 0x7b, 0x03, 0xa6, 0x80, 0x61, 0x00, 0x9c, 0x7c, 0x68, 0x03, 0xa6,
+ 0xb8, 0x41, 0x00, 0x24, 0x80, 0x01, 0x00, 0x1c, 0x80, 0x21, 0x00, 0x20, 0x4c, 0x00, 0x00, 0x64,
+ 0x92, 0xb2, 0x00, 0x00, 0x48, 0x00, 0x02, 0x54, 0x2e, 0x9d, 0x00, 0x02, 0x38, 0x60, 0x00, 0x08,
+ 0x63, 0xec, 0x27, 0x7c, 0x48, 0x00, 0x00, 0xfd, 0x80, 0xac, 0x00, 0x00, 0x80, 0x6c, 0x00, 0x04,
+ 0x98, 0x65, 0x00, 0x00, 0x41, 0x94, 0x00, 0x10, 0xb0, 0x65, 0x00, 0x00, 0x41, 0x96, 0x00, 0x08,
+ 0x90, 0x65, 0x00, 0x00, 0x7c, 0x00, 0x28, 0xac, 0x7c, 0x00, 0x04, 0xac, 0x7c, 0x00, 0x2f, 0xac,
+ 0x4c, 0x00, 0x01, 0x2c, 0x48, 0x00, 0x02, 0x08, 0x48, 0x00, 0x01, 0x21, 0x38, 0x60, 0x00, 0x04,
+ 0x63, 0xec, 0x27, 0x7c, 0x48, 0x00, 0x00, 0xbd, 0x82, 0x0c, 0x00, 0x00, 0x3d, 0x80, 0x80, 0x00,
+ 0x61, 0x8c, 0x28, 0xb8, 0x48, 0x00, 0x00, 0x1c, 0x48, 0x00, 0x01, 0x01, 0x38, 0x60, 0x00, 0x08,
+ 0x63, 0xec, 0x27, 0x7c, 0x48, 0x00, 0x00, 0x9d, 0x82, 0x0c, 0x00, 0x04, 0x81, 0x8c, 0x00, 0x00,
+ 0x63, 0xfb, 0x27, 0x84, 0x3a, 0x20, 0x0f, 0x80, 0x48, 0x00, 0x02, 0x39, 0x41, 0x82, 0x00, 0x20,
+ 0x7e, 0x23, 0x8b, 0x78, 0x48, 0x00, 0x00, 0x7d, 0x48, 0x00, 0x00, 0xd1, 0x41, 0x82, 0xff, 0xfc,
+ 0x7d, 0x8c, 0x72, 0x14, 0x35, 0x6b, 0xff, 0xff, 0x41, 0x81, 0xff, 0xe8, 0x80, 0x7b, 0x00, 0x00,
+ 0x2c, 0x03, 0x00, 0x00, 0x41, 0x82, 0x00, 0x08, 0x48, 0x00, 0x00, 0x59, 0x7c, 0x00, 0x60, 0xac,
+ 0x7c, 0x00, 0x04, 0xac, 0x7c, 0x00, 0x67, 0xac, 0x4c, 0x00, 0x01, 0x2c, 0x48, 0x00, 0x01, 0x80,
+ 0x7f, 0xc8, 0x02, 0xa6, 0x3c, 0x60, 0xa0, 0x00, 0x48, 0x00, 0x00, 0x15, 0x76, 0x03, 0x08, 0x00,
+ 0x56, 0x1d, 0x86, 0x3e, 0x7f, 0xc8, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x92, 0xf8, 0x68, 0x14,
+ 0x90, 0x78, 0x68, 0x24, 0x92, 0xd8, 0x68, 0x20, 0x80, 0xb8, 0x68, 0x20, 0x70, 0xa5, 0x00, 0x01,
+ 0x40, 0x82, 0xff, 0xf8, 0x82, 0x18, 0x68, 0x24, 0x90, 0xb8, 0x68, 0x14, 0x4e, 0x80, 0x00, 0x20,
+ 0x7d, 0x48, 0x02, 0xa6, 0x7c, 0x69, 0x03, 0xa6, 0x39, 0xc0, 0x00, 0x00, 0x48, 0x00, 0x00, 0x79,
+ 0x48, 0x00, 0x00, 0x75, 0x4b, 0xff, 0xff, 0xad, 0x41, 0x82, 0xff, 0xf4, 0x7f, 0xae, 0x61, 0xae,
+ 0x39, 0xce, 0x00, 0x01, 0x42, 0x00, 0xff, 0xe8, 0x7d, 0x48, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20,
+ 0x7d, 0x48, 0x02, 0xa6, 0x7c, 0x69, 0x03, 0xa6, 0x39, 0xc0, 0x00, 0x00, 0x7c, 0x6c, 0x70, 0xae,
+ 0x48, 0x00, 0x00, 0x1d, 0x41, 0x82, 0xff, 0xf8, 0x39, 0xce, 0x00, 0x01, 0x42, 0x00, 0xff, 0xf0,
+ 0x7d, 0x48, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x38, 0x60, 0x00, 0xaa, 0x7f, 0xc8, 0x02, 0xa6,
+ 0x54, 0x63, 0xa0, 0x16, 0x64, 0x63, 0xb0, 0x00, 0x3a, 0xc0, 0x00, 0x19, 0x3a, 0xe0, 0x00, 0xd0,
+ 0x3f, 0x00, 0xcd, 0x00, 0x4b, 0xff, 0xff, 0x69, 0x56, 0x03, 0x37, 0xff, 0x7f, 0xc8, 0x03, 0xa6,
+ 0x4e, 0x80, 0x00, 0x20, 0x7f, 0xc8, 0x02, 0xa6, 0x3c, 0x60, 0xd0, 0x00, 0x4b, 0xff, 0xff, 0x51,
+ 0x56, 0x03, 0x37, 0xff, 0x41, 0x82, 0xff, 0xf4, 0x7f, 0xc8, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20,
+ 0x4b, 0xff, 0xff, 0xb9, 0x38, 0x60, 0x00, 0x08, 0x63, 0xec, 0x27, 0x7c, 0x4b, 0xff, 0xff, 0x55,
+ 0x80, 0xac, 0x00, 0x04, 0x81, 0x8c, 0x00, 0x00, 0x63, 0xfb, 0x27, 0x84, 0x62, 0xb1, 0xf8, 0x00,
+ 0x7e, 0x0c, 0x28, 0x50, 0x48, 0x00, 0x00, 0xed, 0x41, 0x81, 0x00, 0x10, 0x82, 0x3b, 0x00, 0x00,
+ 0x2c, 0x11, 0x00, 0x00, 0x41, 0x82, 0x00, 0x68, 0x7e, 0x23, 0x8b, 0x78, 0x4b, 0xff, 0xff, 0x55,
+ 0x4b, 0xff, 0xff, 0xa5, 0x4b, 0xff, 0xff, 0xa1, 0x4b, 0xff, 0xfe, 0xd9, 0x41, 0x82, 0xff, 0xf4,
+ 0x2c, 0x1d, 0x00, 0xcc, 0x41, 0x82, 0x00, 0x48, 0x2c, 0x1d, 0x00, 0xbb, 0x41, 0x82, 0xff, 0xdc,
+ 0x2c, 0x1d, 0x00, 0xaa, 0x40, 0x82, 0xff, 0xdc, 0x7d, 0x8c, 0x72, 0x14, 0x35, 0x6b, 0xff, 0xff,
+ 0x41, 0x80, 0x00, 0x2c, 0x4b, 0xff, 0xff, 0xb4, 0x7e, 0xb5, 0xfb, 0xa6, 0x7e, 0xb2, 0xfb, 0xa6,
+ 0x63, 0xe4, 0x27, 0x98, 0x81, 0x24, 0x00, 0x18, 0x55, 0x29, 0x05, 0xa8, 0x91, 0x24, 0x00, 0x18,
+ 0x48, 0x00, 0x00, 0x0c, 0x38, 0x60, 0x00, 0x80, 0x4b, 0xff, 0xff, 0x25, 0x80, 0x92, 0x00, 0x00,
+ 0x2c, 0x04, 0x00, 0x00, 0x40, 0x82, 0xfa, 0x50, 0xb3, 0x94, 0x40, 0x10, 0xc8, 0x41, 0x00, 0x98,
+ 0xc8, 0x61, 0x00, 0xa0, 0x7f, 0x20, 0x00, 0xa6, 0x80, 0x01, 0x00, 0xac, 0x7c, 0x08, 0x03, 0xa6,
+ 0x80, 0x01, 0x00, 0x0c, 0x7c, 0x0f, 0xf1, 0x20, 0x80, 0x01, 0x00, 0x10, 0x7c, 0x09, 0x03, 0xa6,
+ 0x80, 0x01, 0x00, 0x14, 0x7c, 0x01, 0x03, 0xa6, 0xb8, 0x61, 0x00, 0x18, 0x80, 0x01, 0x00, 0x08,
+ 0x38, 0x21, 0x00, 0xa8, 0x4c, 0x00, 0x01, 0x2c, 0x4e, 0x80, 0x00, 0x20, 0x7e, 0x23, 0x20, 0x50,
+ 0x3c, 0xa0, 0x48, 0x00, 0x52, 0x25, 0x01, 0xba, 0x90, 0xa3, 0x00, 0x00, 0x7c, 0x00, 0x18, 0xac,
+ 0x7c, 0x00, 0x04, 0xac, 0x7c, 0x00, 0x1f, 0xac, 0x4c, 0x00, 0x01, 0x2c, 0x4e, 0x80, 0x00, 0x20,
+ 0x7d, 0x70, 0x8b, 0xd7, 0x7d, 0x4b, 0x89, 0xd6, 0x7d, 0x4a, 0x80, 0x50, 0x91, 0x5b, 0x00, 0x00,
+ 0x4e, 0x80, 0x00, 0x20, 0x7f, 0xa8, 0x02, 0xa6, 0x3d, 0xe0, 0x80, 0x00, 0x61, 0xef, 0x28, 0xb8,
+ 0x63, 0xe7, 0x18, 0x08, 0x3c, 0xc0, 0x80, 0x00, 0x7c, 0xd0, 0x33, 0x78, 0x39, 0x00, 0x00, 0x00,
+ 0x3c, 0x60, 0x00, 0xd0, 0x60, 0x63, 0xc0, 0xde, 0x80, 0x8f, 0x00, 0x00, 0x7c, 0x03, 0x20, 0x00,
+ 0x40, 0x82, 0x00, 0x18, 0x80, 0x8f, 0x00, 0x04, 0x7c, 0x03, 0x20, 0x00, 0x40, 0x82, 0x00, 0x0c,
+ 0x39, 0xef, 0x00, 0x08, 0x48, 0x00, 0x00, 0x0c, 0x7f, 0xa8, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20,
+ 0x80, 0x6f, 0x00, 0x00, 0x80, 0x8f, 0x00, 0x04, 0x39, 0xef, 0x00, 0x08, 0x71, 0x09, 0x00, 0x01,
+ 0x2f, 0x89, 0x00, 0x00, 0x39, 0x20, 0x00, 0x00, 0x54, 0x6a, 0x1f, 0x7e, 0x54, 0x65, 0x3f, 0x7e,
+ 0x74, 0x6b, 0x10, 0x00, 0x54, 0x63, 0x01, 0xfe, 0x40, 0x82, 0x00, 0x0c, 0x54, 0xcc, 0x00, 0x0c,
+ 0x48, 0x00, 0x00, 0x08, 0x7e, 0x0c, 0x83, 0x78, 0x2e, 0x05, 0x00, 0x00, 0x2c, 0x0a, 0x00, 0x01,
+ 0x41, 0xa0, 0x00, 0x2c, 0x41, 0xa2, 0x00, 0xe4, 0x2c, 0x0a, 0x00, 0x03, 0x41, 0xa0, 0x01, 0xac,
+ 0x41, 0x82, 0x02, 0x50, 0x2c, 0x0a, 0x00, 0x05, 0x41, 0x80, 0x02, 0xd4, 0x41, 0xa2, 0x04, 0xe0,
+ 0x2c, 0x0a, 0x00, 0x07, 0x41, 0xa0, 0x05, 0x0c, 0x48, 0x00, 0x05, 0xf0, 0x7d, 0x8c, 0x1a, 0x14,
+ 0x2c, 0x05, 0x00, 0x03, 0x41, 0x82, 0x00, 0x48, 0x41, 0x81, 0x00, 0x60, 0x40, 0xbe, 0xff, 0x84,
+ 0x2e, 0x05, 0x00, 0x01, 0x41, 0x91, 0x00, 0x2c, 0x54, 0x8a, 0x84, 0x3e, 0x41, 0x92, 0x00, 0x10,
+ 0x7c, 0x89, 0x61, 0xae, 0x39, 0x29, 0x00, 0x01, 0x48, 0x00, 0x00, 0x0c, 0x7c, 0x89, 0x63, 0x2e,
+ 0x39, 0x29, 0x00, 0x02, 0x35, 0x4a, 0xff, 0xff, 0x40, 0xa0, 0xff, 0xe4, 0x4b, 0xff, 0xff, 0x54,
+ 0x55, 0x8c, 0x00, 0x3a, 0x90, 0x8c, 0x00, 0x00, 0x4b, 0xff, 0xff, 0x48, 0x7c, 0x89, 0x23, 0x78,
+ 0x40, 0x9e, 0x04, 0xc8, 0x35, 0x29, 0xff, 0xff, 0x41, 0x80, 0x04, 0xc0, 0x7c, 0xa9, 0x78, 0xae,
+ 0x7c, 0xa9, 0x61, 0xae, 0x4b, 0xff, 0xff, 0xf0, 0x39, 0xef, 0x00, 0x08, 0x40, 0xbe, 0xff, 0x24,
+ 0x80, 0xaf, 0xff, 0xf8, 0x81, 0x6f, 0xff, 0xfc, 0x54, 0xb1, 0x04, 0x3e, 0x54, 0xaa, 0x85, 0x3e,
+ 0x54, 0xa5, 0x27, 0x3e, 0x2e, 0x85, 0x00, 0x01, 0x41, 0x96, 0x00, 0x10, 0x41, 0xb5, 0x00, 0x14,
+ 0x7c, 0x89, 0x61, 0xae, 0x48, 0x00, 0x00, 0x10, 0x7c, 0x89, 0x63, 0x2e, 0x48, 0x00, 0x00, 0x08,
+ 0x7c, 0x89, 0x61, 0x2e, 0x7c, 0x84, 0x5a, 0x14, 0x7d, 0x29, 0x8a, 0x14, 0x35, 0x4a, 0xff, 0xff,
+ 0x40, 0x80, 0xff, 0xd4, 0x4b, 0xff, 0xfe, 0xdc, 0x54, 0x69, 0x07, 0xff, 0x41, 0x82, 0x00, 0x10,
+ 0x55, 0x08, 0xf8, 0x7e, 0x71, 0x09, 0x00, 0x01, 0x2f, 0x89, 0x00, 0x00, 0x2e, 0x85, 0x00, 0x04,
+ 0x2d, 0x8a, 0x00, 0x05, 0x51, 0x08, 0x08, 0x3c, 0x40, 0x9e, 0x00, 0x78, 0x41, 0x8d, 0x04, 0xb8,
+ 0x7d, 0x8c, 0x1a, 0x14, 0x41, 0x8c, 0x00, 0x0c, 0x41, 0x94, 0x00, 0x30, 0x48, 0x00, 0x00, 0x1c,
+ 0x40, 0x94, 0x00, 0x10, 0x55, 0x8c, 0x00, 0x3a, 0x81, 0x6c, 0x00, 0x00, 0x48, 0x00, 0x00, 0x1c,
+ 0x55, 0x8c, 0x00, 0x3c, 0xa1, 0x6c, 0x00, 0x00, 0x7c, 0x89, 0x20, 0xf8, 0x55, 0x29, 0x84, 0x3e,
+ 0x7d, 0x6b, 0x48, 0x38, 0x54, 0x84, 0x04, 0x3e, 0x7f, 0x0b, 0x20, 0x40, 0x70, 0xa9, 0x00, 0x03,
+ 0x41, 0x82, 0x00, 0x18, 0x2c, 0x09, 0x00, 0x02, 0x41, 0x82, 0x00, 0x18, 0x41, 0x81, 0x00, 0x1c,
+ 0x40, 0x9a, 0x00, 0x20, 0x48, 0x00, 0x00, 0x18, 0x41, 0x9a, 0x00, 0x18, 0x48, 0x00, 0x00, 0x10,
+ 0x41, 0x99, 0x00, 0x10, 0x48, 0x00, 0x00, 0x08, 0x41, 0x98, 0x00, 0x08, 0x61, 0x08, 0x00, 0x01,
+ 0x40, 0x8e, 0xfe, 0x40, 0x41, 0x94, 0xfe, 0x3c, 0x81, 0x6f, 0xff, 0xf8, 0x40, 0x9e, 0x00, 0x20,
+ 0x70, 0x6c, 0x00, 0x08, 0x41, 0x82, 0x00, 0x0c, 0x71, 0x0c, 0x00, 0x01, 0x41, 0x82, 0x00, 0x10,
+ 0x39, 0x8b, 0x00, 0x10, 0x51, 0x8b, 0x03, 0x36, 0x48, 0x00, 0x00, 0x08, 0x55, 0x6b, 0x07, 0x16,
+ 0x91, 0x6f, 0xff, 0xf8, 0x4b, 0xff, 0xfe, 0x0c, 0x40, 0xbe, 0xfe, 0x08, 0x54, 0x69, 0x16, 0xba,
+ 0x54, 0x6e, 0x87, 0xfe, 0x2d, 0x8e, 0x00, 0x00, 0x2e, 0x05, 0x00, 0x04, 0x70, 0xae, 0x00, 0x03,
+ 0x2e, 0x8e, 0x00, 0x02, 0x41, 0x94, 0x00, 0x14, 0x41, 0x96, 0x00, 0x50, 0x7c, 0x64, 0x07, 0x34,
+ 0x7c, 0x84, 0x7a, 0x14, 0x48, 0x00, 0x00, 0x68, 0x54, 0x65, 0xa7, 0xff, 0x41, 0x82, 0x00, 0x0c,
+ 0x7d, 0x27, 0x48, 0x2e, 0x7c, 0x84, 0x4a, 0x14, 0x41, 0x8e, 0x00, 0x08, 0x7c, 0x8c, 0x22, 0x14,
+ 0x2e, 0x8e, 0x00, 0x01, 0x41, 0x96, 0x00, 0x08, 0x80, 0x84, 0x00, 0x00, 0x54, 0x63, 0x67, 0xff,
+ 0x41, 0x82, 0x00, 0x3c, 0x40, 0x90, 0x00, 0x0c, 0x7c, 0x84, 0x32, 0x14, 0x48, 0x00, 0x00, 0x30,
+ 0x7c, 0x84, 0x82, 0x14, 0x48, 0x00, 0x00, 0x28, 0x54, 0x65, 0xa7, 0xff, 0x41, 0x82, 0x00, 0x0c,
+ 0x7d, 0x27, 0x48, 0x2e, 0x7c, 0x84, 0x4a, 0x14, 0x40, 0x90, 0x00, 0x0c, 0x7c, 0xcc, 0x21, 0x2e,
+ 0x4b, 0xff, 0xfd, 0x80, 0x7e, 0x0c, 0x21, 0x2e, 0x4b, 0xff, 0xfd, 0x78, 0x40, 0x90, 0x00, 0x0c,
+ 0x7c, 0x86, 0x23, 0x78, 0x4b, 0xff, 0xfd, 0x6c, 0x7c, 0x90, 0x23, 0x78, 0x4b, 0xff, 0xfd, 0x64,
+ 0x54, 0x89, 0x1e, 0x78, 0x39, 0x29, 0x00, 0x40, 0x2c, 0x05, 0x00, 0x02, 0x41, 0x80, 0x00, 0x48,
+ 0x54, 0x6b, 0x50, 0x03, 0x41, 0x82, 0x00, 0x14, 0x41, 0x81, 0x00, 0x08, 0x48, 0x00, 0x00, 0x10,
+ 0x41, 0xbe, 0xfd, 0x40, 0x48, 0x00, 0x00, 0x08, 0x40, 0xbe, 0xfd, 0x38, 0x2c, 0x05, 0x00, 0x03,
+ 0x41, 0x81, 0x00, 0x10, 0x41, 0xa2, 0x00, 0x10, 0x7d, 0xe7, 0x48, 0x2e, 0x4b, 0xff, 0xfd, 0x24,
+ 0x7d, 0xe7, 0x49, 0x2e, 0x7c, 0x64, 0x07, 0x34, 0x54, 0x84, 0x1a, 0x78, 0x7d, 0xef, 0x22, 0x14,
+ 0x4b, 0xff, 0xfd, 0x10, 0x40, 0xbe, 0xfd, 0x0c, 0x7c, 0xa7, 0x4a, 0x14, 0x40, 0x92, 0x00, 0x14,
+ 0x54, 0x64, 0x04, 0x3e, 0x91, 0xe5, 0x00, 0x00, 0x90, 0x85, 0x00, 0x04, 0x4b, 0xff, 0xfc, 0xf4,
+ 0x81, 0x25, 0x00, 0x04, 0x2c, 0x09, 0x00, 0x00, 0x41, 0xa2, 0xfc, 0xe8, 0x39, 0x29, 0xff, 0xff,
+ 0x91, 0x25, 0x00, 0x04, 0x81, 0xe5, 0x00, 0x00, 0x4b, 0xff, 0xfc, 0xd8, 0x40, 0xbe, 0xfc, 0xd4,
+ 0x54, 0x6b, 0x16, 0xba, 0x7f, 0x47, 0x5a, 0x14, 0x81, 0x3a, 0x00, 0x00, 0x54, 0x6e, 0x67, 0xbe,
+ 0x41, 0x92, 0x00, 0x84, 0x2e, 0x05, 0x00, 0x05, 0x40, 0x90, 0x01, 0x74, 0x2e, 0x05, 0x00, 0x03,
+ 0x40, 0x90, 0x00, 0x90, 0x2e, 0x05, 0x00, 0x01, 0x54, 0x65, 0x87, 0xff, 0x41, 0x82, 0x00, 0x08,
+ 0x7c, 0x8c, 0x22, 0x14, 0x2f, 0x0e, 0x00, 0x01, 0x40, 0x92, 0x00, 0x24, 0x41, 0xb9, 0x00, 0x18,
+ 0x41, 0x9a, 0x00, 0x0c, 0x88, 0x84, 0x00, 0x00, 0x48, 0x00, 0x00, 0xf8, 0xa0, 0x84, 0x00, 0x00,
+ 0x48, 0x00, 0x00, 0xf0, 0x80, 0x84, 0x00, 0x00, 0x48, 0x00, 0x00, 0xe8, 0x54, 0x73, 0xe5, 0x3e,
+ 0x41, 0xb9, 0x00, 0x20, 0x41, 0x9a, 0x00, 0x10, 0x99, 0x24, 0x00, 0x00, 0x38, 0x84, 0x00, 0x01,
+ 0x48, 0x00, 0x00, 0x18, 0xb1, 0x24, 0x00, 0x00, 0x38, 0x84, 0x00, 0x02, 0x48, 0x00, 0x00, 0x0c,
+ 0x91, 0x24, 0x00, 0x00, 0x38, 0x84, 0x00, 0x04, 0x36, 0x73, 0xff, 0xff, 0x40, 0x80, 0xff, 0xd4,
+ 0x4b, 0xff, 0xfc, 0x40, 0x54, 0x65, 0x87, 0xff, 0x41, 0x82, 0x00, 0x08, 0x7c, 0x84, 0x62, 0x14,
+ 0x71, 0xc5, 0x00, 0x01, 0x41, 0x82, 0x00, 0x9c, 0x7c, 0x84, 0x4a, 0x14, 0x48, 0x00, 0x00, 0x94,
+ 0x54, 0x6a, 0x87, 0xbe, 0x54, 0x8e, 0x16, 0xba, 0x7e, 0x67, 0x72, 0x14, 0x40, 0x92, 0x00, 0x08,
+ 0x3a, 0x6f, 0xff, 0xfc, 0x80, 0x9a, 0x00, 0x00, 0x81, 0x33, 0x00, 0x00, 0x71, 0x4b, 0x00, 0x01,
+ 0x41, 0x82, 0x00, 0x08, 0x7c, 0x9a, 0x23, 0x78, 0x71, 0x4b, 0x00, 0x02, 0x41, 0x82, 0x00, 0x10,
+ 0x7d, 0x33, 0x4b, 0x78, 0x40, 0xb2, 0x00, 0x08, 0x7e, 0x6c, 0x9a, 0x14, 0x54, 0x65, 0x67, 0x3f,
+ 0x2c, 0x05, 0x00, 0x09, 0x40, 0x80, 0x00, 0x54, 0x48, 0x00, 0x00, 0x79, 0x7c, 0x89, 0x22, 0x14,
+ 0x48, 0x00, 0x00, 0x40, 0x7c, 0x89, 0x21, 0xd6, 0x48, 0x00, 0x00, 0x38, 0x7d, 0x24, 0x23, 0x78,
+ 0x48, 0x00, 0x00, 0x30, 0x7d, 0x24, 0x20, 0x38, 0x48, 0x00, 0x00, 0x28, 0x7d, 0x24, 0x22, 0x78,
+ 0x48, 0x00, 0x00, 0x20, 0x7d, 0x24, 0x20, 0x30, 0x48, 0x00, 0x00, 0x18, 0x7d, 0x24, 0x24, 0x30,
+ 0x48, 0x00, 0x00, 0x10, 0x5d, 0x24, 0x20, 0x3e, 0x48, 0x00, 0x00, 0x08, 0x7d, 0x24, 0x26, 0x30,
+ 0x90, 0x9a, 0x00, 0x00, 0x4b, 0xff, 0xfb, 0x8c, 0x2c, 0x05, 0x00, 0x0a, 0x41, 0x81, 0xfb, 0x84,
+ 0xc0, 0x5a, 0x00, 0x00, 0xc0, 0x73, 0x00, 0x00, 0x41, 0x82, 0x00, 0x0c, 0xec, 0x43, 0x10, 0x2a,
+ 0x48, 0x00, 0x00, 0x08, 0xec, 0x43, 0x00, 0xb2, 0xd0, 0x5a, 0x00, 0x00, 0x4b, 0xff, 0xfb, 0x64,
+ 0x7d, 0x48, 0x02, 0xa6, 0x54, 0xa5, 0x1e, 0x78, 0x7d, 0x4a, 0x2a, 0x14, 0x80, 0x9a, 0x00, 0x00,
+ 0x81, 0x33, 0x00, 0x00, 0x7d, 0x48, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x40, 0xbe, 0xfb, 0x44,
+ 0x54, 0x69, 0xc0, 0x3e, 0x7d, 0x8e, 0x63, 0x78, 0x48, 0x00, 0x00, 0x35, 0x41, 0x92, 0x00, 0x0c,
+ 0x7e, 0x31, 0x22, 0x14, 0x48, 0x00, 0x00, 0x08, 0x7d, 0x29, 0x22, 0x14, 0x54, 0x64, 0xc4, 0x3f,
+ 0x38, 0xa0, 0x00, 0x00, 0x41, 0x82, 0xfb, 0x1c, 0x7d, 0x45, 0x88, 0xae, 0x7d, 0x45, 0x49, 0xae,
+ 0x38, 0xa5, 0x00, 0x01, 0x7c, 0x05, 0x20, 0x00, 0x4b, 0xff, 0xff, 0xec, 0x2e, 0x8a, 0x00, 0x04,
+ 0x55, 0x31, 0x36, 0xba, 0x2c, 0x11, 0x00, 0x3c, 0x7e, 0x27, 0x88, 0x2e, 0x40, 0x82, 0x00, 0x08,
+ 0x7d, 0xd1, 0x73, 0x78, 0x41, 0x96, 0x00, 0x08, 0xa2, 0x31, 0x00, 0x00, 0x55, 0x29, 0x56, 0xba,
+ 0x2c, 0x09, 0x00, 0x3c, 0x7d, 0x27, 0x48, 0x2e, 0x40, 0x82, 0x00, 0x08, 0x7d, 0xc9, 0x73, 0x78,
+ 0x41, 0x96, 0x00, 0x08, 0xa1, 0x29, 0x00, 0x00, 0x4e, 0x80, 0x00, 0x20, 0x2c, 0x05, 0x00, 0x04,
+ 0x40, 0x80, 0x00, 0x28, 0x7c, 0x89, 0x23, 0x78, 0x7d, 0xc3, 0x62, 0x14, 0x55, 0xce, 0x00, 0x3c,
+ 0x4b, 0xff, 0xff, 0xad, 0x7c, 0x84, 0x20, 0xf8, 0x54, 0x84, 0x04, 0x3e, 0x7d, 0x2b, 0x20, 0x38,
+ 0x7e, 0x24, 0x20, 0x38, 0x4b, 0xff, 0xfb, 0xc4, 0x54, 0x6b, 0xe4, 0x3e, 0x4b, 0xff, 0xfb, 0xbc,
+ 0x7c, 0x9a, 0x23, 0x78, 0x54, 0x84, 0x18, 0x38, 0x40, 0x92, 0x00, 0x20, 0x40, 0x9e, 0x00, 0x0c,
+ 0x7d, 0xe8, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x21, 0x7d, 0xe4, 0x7a, 0x14, 0x39, 0xef, 0x00, 0x07,
+ 0x55, 0xef, 0x00, 0x38, 0x4b, 0xff, 0xfa, 0x6c, 0x2e, 0x05, 0x00, 0x03, 0x41, 0x91, 0x00, 0x5c,
+ 0x3c, 0xa0, 0x48, 0x00, 0x7d, 0x83, 0x62, 0x14, 0x55, 0x8c, 0x00, 0x3a, 0x40, 0x92, 0x00, 0x20,
+ 0x40, 0xbe, 0xfa, 0x50, 0x57, 0x44, 0x00, 0x3a, 0x7c, 0x8c, 0x20, 0x50, 0x50, 0x85, 0x01, 0xba,
+ 0x50, 0x65, 0x07, 0xfe, 0x90, 0xac, 0x00, 0x00, 0x4b, 0xff, 0xfa, 0x38, 0x40, 0xbe, 0xff, 0xbc,
+ 0x7d, 0x2c, 0x78, 0x50, 0x51, 0x25, 0x01, 0xba, 0x90, 0xac, 0x00, 0x00, 0x39, 0x8c, 0x00, 0x04,
+ 0x7d, 0x6f, 0x22, 0x14, 0x39, 0x6b, 0xff, 0xfc, 0x7d, 0x2b, 0x60, 0x50, 0x51, 0x25, 0x01, 0xba,
+ 0x90, 0xab, 0x00, 0x00, 0x4b, 0xff, 0xff, 0x94, 0x2e, 0x05, 0x00, 0x06, 0x41, 0x92, 0x00, 0x28,
+ 0x4b, 0xff, 0xfb, 0x28, 0x55, 0x8c, 0x84, 0x3e, 0x57, 0x44, 0x84, 0x3e, 0x57, 0x5a, 0x04, 0x3e,
+ 0x7c, 0x0c, 0x20, 0x00, 0x41, 0x80, 0xfb, 0xa8, 0x7c, 0x0c, 0xd0, 0x00, 0x40, 0x80, 0xfb, 0xa0,
+ 0x4b, 0xff, 0xf9, 0xe0, 0x57, 0x45, 0xff, 0xfe, 0x68, 0xa5, 0x00, 0x01, 0x71, 0x03, 0x00, 0x01,
+ 0x7c, 0x05, 0x18, 0x00, 0x41, 0x82, 0x00, 0x1c, 0x51, 0x1a, 0x0f, 0xbc, 0x6b, 0x5a, 0x00, 0x02,
+ 0x57, 0x45, 0xff, 0xff, 0x41, 0x82, 0x00, 0x08, 0x6b, 0x5a, 0x00, 0x01, 0x93, 0x4f, 0xff, 0xfc,
+ 0x53, 0x48, 0x07, 0xfe, 0x4b, 0xff, 0xf9, 0xac, 0x2c, 0x0b, 0x00, 0x00, 0x41, 0x82, 0x01, 0x38,
+ 0x2c, 0x05, 0x00, 0x01, 0x41, 0x82, 0x00, 0x18, 0x2c, 0x05, 0x00, 0x02, 0x41, 0x82, 0x00, 0x14,
+ 0x2c, 0x05, 0x00, 0x03, 0x41, 0x82, 0x00, 0x70, 0x4b, 0xff, 0xf9, 0x80, 0x54, 0xcc, 0x00, 0x0c,
+ 0x54, 0x97, 0x46, 0x3e, 0x54, 0x98, 0xc4, 0x3e, 0x54, 0x84, 0x06, 0x3e, 0x40, 0x9e, 0x00, 0xfc,
+ 0x56, 0xf9, 0x06, 0x31, 0x7d, 0x9a, 0x63, 0x78, 0x7f, 0x43, 0xd2, 0x14, 0x57, 0x5a, 0x00, 0x3a,
+ 0x41, 0x82, 0x00, 0x18, 0x7e, 0xf7, 0x07, 0x74, 0x7e, 0xf7, 0x00, 0xd0, 0x1f, 0x37, 0x00, 0x02,
+ 0x3b, 0x39, 0x00, 0x04, 0x7f, 0x59, 0xd0, 0x50, 0x2c, 0x17, 0x00, 0x00, 0x41, 0x82, 0x00, 0x1c,
+ 0x3b, 0x20, 0x00, 0x00, 0x7e, 0xe9, 0x03, 0xa6, 0xa3, 0x7a, 0x00, 0x04, 0x7f, 0x79, 0xca, 0x78,
+ 0x3b, 0x5a, 0x00, 0x02, 0x42, 0x00, 0xff, 0xf4, 0x7c, 0x18, 0xc8, 0x00, 0x40, 0x82, 0x00, 0xac,
+ 0x4b, 0xff, 0xfe, 0x90, 0x51, 0x08, 0x08, 0x3c, 0x40, 0x9e, 0x00, 0x9c, 0x54, 0x77, 0xb0, 0x03,
+ 0x41, 0x81, 0x00, 0x88, 0x41, 0x80, 0x00, 0x8c, 0x54, 0x7e, 0x06, 0x3e, 0x1f, 0xde, 0x00, 0x02,
+ 0x54, 0x97, 0x00, 0x1e, 0x6e, 0xf8, 0x80, 0x00, 0x2c, 0x18, 0x00, 0x00, 0x40, 0x82, 0x00, 0x08,
+ 0x62, 0xf7, 0x30, 0x00, 0x54, 0x98, 0x80, 0x1e, 0x1f, 0x3e, 0x00, 0x04, 0x7f, 0x19, 0xc0, 0x50,
+ 0x3b, 0x20, 0x00, 0x00, 0x1f, 0x59, 0x00, 0x04, 0x7f, 0x6f, 0xd0, 0x2e, 0x7f, 0x57, 0xd0, 0x2e,
+ 0x3b, 0x39, 0x00, 0x01, 0x7c, 0x17, 0xc0, 0x40, 0x41, 0x81, 0x00, 0x34, 0x7c, 0x19, 0xf0, 0x00,
+ 0x41, 0x81, 0x00, 0x14, 0x7c, 0x1a, 0xd8, 0x00, 0x41, 0x82, 0xff, 0xdc, 0x3a, 0xf7, 0x00, 0x04,
+ 0x4b, 0xff, 0xff, 0xd0, 0x80, 0x6f, 0xff, 0xf8, 0x60, 0x63, 0x03, 0x00, 0x90, 0x6f, 0xff, 0xf8,
+ 0x92, 0xef, 0xff, 0xfc, 0x7e, 0xf0, 0xbb, 0x78, 0x48, 0x00, 0x00, 0x1c, 0x80, 0x6f, 0xff, 0xf8,
+ 0x60, 0x63, 0x01, 0x00, 0x90, 0x6f, 0xff, 0xf8, 0x61, 0x08, 0x00, 0x01, 0x48, 0x00, 0x00, 0x08,
+ 0x7c, 0x90, 0x23, 0x78, 0x54, 0x64, 0x06, 0x3e, 0x1c, 0x84, 0x00, 0x08, 0x7d, 0xe4, 0x7a, 0x14,
+ 0x4b, 0xff, 0xf8, 0x70, 0x40, 0x92, 0x00, 0x0c, 0x39, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x14,
+ 0x54, 0x69, 0x06, 0xff, 0x54, 0x65, 0x67, 0xfe, 0x7d, 0x08, 0x4c, 0x30, 0x55, 0x17, 0xff, 0xff,
+ 0x40, 0x82, 0x00, 0x08, 0x7d, 0x08, 0x2a, 0x78, 0x54, 0x85, 0x00, 0x1f, 0x41, 0x82, 0x00, 0x08,
+ 0x7c, 0xa6, 0x2b, 0x78, 0x54, 0x85, 0x80, 0x1f, 0x41, 0x82, 0x00, 0x08, 0x7c, 0xb0, 0x2b, 0x78,
+ 0x4b, 0xff, 0xf8, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+
+};
+const int codehandler_size = sizeof(codehandler);
diff --git a/source/patches/codehandleronly.h b/source/patches/codehandleronly.h
new file mode 100644
index 00000000..d125bae7
--- /dev/null
+++ b/source/patches/codehandleronly.h
@@ -0,0 +1,180 @@
+/*
+ This file was autogenerated by raw2c.
+Visit http://www.devkitpro.org
+*/
+
+const unsigned char codehandleronly[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x21, 0x60, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94, 0x21, 0xff, 0x58, 0x90, 0x01, 0x00, 0x08,
+ 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0xac, 0x7c, 0x00, 0x00, 0x26, 0x90, 0x01, 0x00, 0x0c,
+ 0x7c, 0x09, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x10, 0x7c, 0x01, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x14,
+ 0xbc, 0x61, 0x00, 0x18, 0x7f, 0x20, 0x00, 0xa6, 0x63, 0x3a, 0x20, 0x00, 0x73, 0x5a, 0xf9, 0xff,
+ 0x7f, 0x40, 0x01, 0x24, 0xd8, 0x41, 0x00, 0x98, 0xd8, 0x61, 0x00, 0xa0, 0x3f, 0xe0, 0x80, 0x00,
+ 0x3e, 0x80, 0xcc, 0x00, 0xa3, 0x94, 0x40, 0x10, 0x63, 0x95, 0x00, 0xff, 0xb2, 0xb4, 0x40, 0x10,
+ 0x7f, 0xa8, 0x02, 0xa6, 0x3d, 0xe0, 0x80, 0x00, 0x61, 0xef, 0x22, 0xa8, 0x63, 0xe7, 0x18, 0x08,
+ 0x3c, 0xc0, 0x80, 0x00, 0x7c, 0xd0, 0x33, 0x78, 0x39, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x00, 0xd0,
+ 0x60, 0x63, 0xc0, 0xde, 0x80, 0x8f, 0x00, 0x00, 0x7c, 0x03, 0x20, 0x00, 0x40, 0x82, 0x00, 0x18,
+ 0x80, 0x8f, 0x00, 0x04, 0x7c, 0x03, 0x20, 0x00, 0x40, 0x82, 0x00, 0x0c, 0x39, 0xef, 0x00, 0x08,
+ 0x48, 0x00, 0x00, 0x4c, 0x7f, 0xa8, 0x03, 0xa6, 0xb3, 0x94, 0x40, 0x10, 0xc8, 0x41, 0x00, 0x98,
+ 0xc8, 0x61, 0x00, 0xa0, 0x7f, 0x20, 0x00, 0xa6, 0x80, 0x01, 0x00, 0xac, 0x7c, 0x08, 0x03, 0xa6,
+ 0x80, 0x01, 0x00, 0x0c, 0x7c, 0x0f, 0xf1, 0x20, 0x80, 0x01, 0x00, 0x10, 0x7c, 0x09, 0x03, 0xa6,
+ 0x80, 0x01, 0x00, 0x14, 0x7c, 0x01, 0x03, 0xa6, 0xb8, 0x61, 0x00, 0x18, 0x80, 0x01, 0x00, 0x08,
+ 0x38, 0x21, 0x00, 0xa8, 0x4c, 0x00, 0x01, 0x2c, 0x4e, 0x80, 0x00, 0x20, 0x80, 0x6f, 0x00, 0x00,
+ 0x80, 0x8f, 0x00, 0x04, 0x39, 0xef, 0x00, 0x08, 0x71, 0x09, 0x00, 0x01, 0x2f, 0x89, 0x00, 0x00,
+ 0x39, 0x20, 0x00, 0x00, 0x54, 0x6a, 0x1f, 0x7e, 0x54, 0x65, 0x3f, 0x7e, 0x74, 0x6b, 0x10, 0x00,
+ 0x54, 0x63, 0x01, 0xfe, 0x40, 0x82, 0x00, 0x0c, 0x54, 0xcc, 0x00, 0x0c, 0x48, 0x00, 0x00, 0x08,
+ 0x7e, 0x0c, 0x83, 0x78, 0x2e, 0x05, 0x00, 0x00, 0x2c, 0x0a, 0x00, 0x01, 0x41, 0xa0, 0x00, 0x2c,
+ 0x41, 0xa2, 0x00, 0xe4, 0x2c, 0x0a, 0x00, 0x03, 0x41, 0xa0, 0x01, 0xac, 0x41, 0x82, 0x02, 0x50,
+ 0x2c, 0x0a, 0x00, 0x05, 0x41, 0x80, 0x02, 0xd4, 0x41, 0xa2, 0x04, 0xe0, 0x2c, 0x0a, 0x00, 0x07,
+ 0x41, 0xa0, 0x05, 0x0c, 0x48, 0x00, 0x05, 0xf0, 0x7d, 0x8c, 0x1a, 0x14, 0x2c, 0x05, 0x00, 0x03,
+ 0x41, 0x82, 0x00, 0x48, 0x41, 0x81, 0x00, 0x60, 0x40, 0xbe, 0xff, 0x84, 0x2e, 0x05, 0x00, 0x01,
+ 0x41, 0x91, 0x00, 0x2c, 0x54, 0x8a, 0x84, 0x3e, 0x41, 0x92, 0x00, 0x10, 0x7c, 0x89, 0x61, 0xae,
+ 0x39, 0x29, 0x00, 0x01, 0x48, 0x00, 0x00, 0x0c, 0x7c, 0x89, 0x63, 0x2e, 0x39, 0x29, 0x00, 0x02,
+ 0x35, 0x4a, 0xff, 0xff, 0x40, 0xa0, 0xff, 0xe4, 0x4b, 0xff, 0xff, 0x54, 0x55, 0x8c, 0x00, 0x3a,
+ 0x90, 0x8c, 0x00, 0x00, 0x4b, 0xff, 0xff, 0x48, 0x7c, 0x89, 0x23, 0x78, 0x40, 0x9e, 0x04, 0xc8,
+ 0x35, 0x29, 0xff, 0xff, 0x41, 0x80, 0x04, 0xc0, 0x7c, 0xa9, 0x78, 0xae, 0x7c, 0xa9, 0x61, 0xae,
+ 0x4b, 0xff, 0xff, 0xf0, 0x39, 0xef, 0x00, 0x08, 0x40, 0xbe, 0xff, 0x24, 0x80, 0xaf, 0xff, 0xf8,
+ 0x81, 0x6f, 0xff, 0xfc, 0x54, 0xb1, 0x04, 0x3e, 0x54, 0xaa, 0x85, 0x3e, 0x54, 0xa5, 0x27, 0x3e,
+ 0x2e, 0x85, 0x00, 0x01, 0x41, 0x96, 0x00, 0x10, 0x41, 0xb5, 0x00, 0x14, 0x7c, 0x89, 0x61, 0xae,
+ 0x48, 0x00, 0x00, 0x10, 0x7c, 0x89, 0x63, 0x2e, 0x48, 0x00, 0x00, 0x08, 0x7c, 0x89, 0x61, 0x2e,
+ 0x7c, 0x84, 0x5a, 0x14, 0x7d, 0x29, 0x8a, 0x14, 0x35, 0x4a, 0xff, 0xff, 0x40, 0x80, 0xff, 0xd4,
+ 0x4b, 0xff, 0xfe, 0xdc, 0x54, 0x69, 0x07, 0xff, 0x41, 0x82, 0x00, 0x10, 0x55, 0x08, 0xf8, 0x7e,
+ 0x71, 0x09, 0x00, 0x01, 0x2f, 0x89, 0x00, 0x00, 0x2e, 0x85, 0x00, 0x04, 0x2d, 0x8a, 0x00, 0x05,
+ 0x51, 0x08, 0x08, 0x3c, 0x40, 0x9e, 0x00, 0x78, 0x41, 0x8d, 0x04, 0xb8, 0x7d, 0x8c, 0x1a, 0x14,
+ 0x41, 0x8c, 0x00, 0x0c, 0x41, 0x94, 0x00, 0x30, 0x48, 0x00, 0x00, 0x1c, 0x40, 0x94, 0x00, 0x10,
+ 0x55, 0x8c, 0x00, 0x3a, 0x81, 0x6c, 0x00, 0x00, 0x48, 0x00, 0x00, 0x1c, 0x55, 0x8c, 0x00, 0x3c,
+ 0xa1, 0x6c, 0x00, 0x00, 0x7c, 0x89, 0x20, 0xf8, 0x55, 0x29, 0x84, 0x3e, 0x7d, 0x6b, 0x48, 0x38,
+ 0x54, 0x84, 0x04, 0x3e, 0x7f, 0x0b, 0x20, 0x40, 0x70, 0xa9, 0x00, 0x03, 0x41, 0x82, 0x00, 0x18,
+ 0x2c, 0x09, 0x00, 0x02, 0x41, 0x82, 0x00, 0x18, 0x41, 0x81, 0x00, 0x1c, 0x40, 0x9a, 0x00, 0x20,
+ 0x48, 0x00, 0x00, 0x18, 0x41, 0x9a, 0x00, 0x18, 0x48, 0x00, 0x00, 0x10, 0x41, 0x99, 0x00, 0x10,
+ 0x48, 0x00, 0x00, 0x08, 0x41, 0x98, 0x00, 0x08, 0x61, 0x08, 0x00, 0x01, 0x40, 0x8e, 0xfe, 0x40,
+ 0x41, 0x94, 0xfe, 0x3c, 0x81, 0x6f, 0xff, 0xf8, 0x40, 0x9e, 0x00, 0x20, 0x70, 0x6c, 0x00, 0x08,
+ 0x41, 0x82, 0x00, 0x0c, 0x71, 0x0c, 0x00, 0x01, 0x41, 0x82, 0x00, 0x10, 0x39, 0x8b, 0x00, 0x10,
+ 0x51, 0x8b, 0x03, 0x36, 0x48, 0x00, 0x00, 0x08, 0x55, 0x6b, 0x07, 0x16, 0x91, 0x6f, 0xff, 0xf8,
+ 0x4b, 0xff, 0xfe, 0x0c, 0x40, 0xbe, 0xfe, 0x08, 0x54, 0x69, 0x16, 0xba, 0x54, 0x6e, 0x87, 0xfe,
+ 0x2d, 0x8e, 0x00, 0x00, 0x2e, 0x05, 0x00, 0x04, 0x70, 0xae, 0x00, 0x03, 0x2e, 0x8e, 0x00, 0x02,
+ 0x41, 0x94, 0x00, 0x14, 0x41, 0x96, 0x00, 0x50, 0x7c, 0x64, 0x07, 0x34, 0x7c, 0x84, 0x7a, 0x14,
+ 0x48, 0x00, 0x00, 0x68, 0x54, 0x65, 0xa7, 0xff, 0x41, 0x82, 0x00, 0x0c, 0x7d, 0x27, 0x48, 0x2e,
+ 0x7c, 0x84, 0x4a, 0x14, 0x41, 0x8e, 0x00, 0x08, 0x7c, 0x8c, 0x22, 0x14, 0x2e, 0x8e, 0x00, 0x01,
+ 0x41, 0x96, 0x00, 0x08, 0x80, 0x84, 0x00, 0x00, 0x54, 0x63, 0x67, 0xff, 0x41, 0x82, 0x00, 0x3c,
+ 0x40, 0x90, 0x00, 0x0c, 0x7c, 0x84, 0x32, 0x14, 0x48, 0x00, 0x00, 0x30, 0x7c, 0x84, 0x82, 0x14,
+ 0x48, 0x00, 0x00, 0x28, 0x54, 0x65, 0xa7, 0xff, 0x41, 0x82, 0x00, 0x0c, 0x7d, 0x27, 0x48, 0x2e,
+ 0x7c, 0x84, 0x4a, 0x14, 0x40, 0x90, 0x00, 0x0c, 0x7c, 0xcc, 0x21, 0x2e, 0x4b, 0xff, 0xfd, 0x80,
+ 0x7e, 0x0c, 0x21, 0x2e, 0x4b, 0xff, 0xfd, 0x78, 0x40, 0x90, 0x00, 0x0c, 0x7c, 0x86, 0x23, 0x78,
+ 0x4b, 0xff, 0xfd, 0x6c, 0x7c, 0x90, 0x23, 0x78, 0x4b, 0xff, 0xfd, 0x64, 0x54, 0x89, 0x1e, 0x78,
+ 0x39, 0x29, 0x00, 0x40, 0x2c, 0x05, 0x00, 0x02, 0x41, 0x80, 0x00, 0x48, 0x54, 0x6b, 0x50, 0x03,
+ 0x41, 0x82, 0x00, 0x14, 0x41, 0x81, 0x00, 0x08, 0x48, 0x00, 0x00, 0x10, 0x41, 0xbe, 0xfd, 0x40,
+ 0x48, 0x00, 0x00, 0x08, 0x40, 0xbe, 0xfd, 0x38, 0x2c, 0x05, 0x00, 0x03, 0x41, 0x81, 0x00, 0x10,
+ 0x41, 0xa2, 0x00, 0x10, 0x7d, 0xe7, 0x48, 0x2e, 0x4b, 0xff, 0xfd, 0x24, 0x7d, 0xe7, 0x49, 0x2e,
+ 0x7c, 0x64, 0x07, 0x34, 0x54, 0x84, 0x1a, 0x78, 0x7d, 0xef, 0x22, 0x14, 0x4b, 0xff, 0xfd, 0x10,
+ 0x40, 0xbe, 0xfd, 0x0c, 0x7c, 0xa7, 0x4a, 0x14, 0x40, 0x92, 0x00, 0x14, 0x54, 0x64, 0x04, 0x3e,
+ 0x91, 0xe5, 0x00, 0x00, 0x90, 0x85, 0x00, 0x04, 0x4b, 0xff, 0xfc, 0xf4, 0x81, 0x25, 0x00, 0x04,
+ 0x2c, 0x09, 0x00, 0x00, 0x41, 0xa2, 0xfc, 0xe8, 0x39, 0x29, 0xff, 0xff, 0x91, 0x25, 0x00, 0x04,
+ 0x81, 0xe5, 0x00, 0x00, 0x4b, 0xff, 0xfc, 0xd8, 0x40, 0xbe, 0xfc, 0xd4, 0x54, 0x6b, 0x16, 0xba,
+ 0x7f, 0x47, 0x5a, 0x14, 0x81, 0x3a, 0x00, 0x00, 0x54, 0x6e, 0x67, 0xbe, 0x41, 0x92, 0x00, 0x84,
+ 0x2e, 0x05, 0x00, 0x05, 0x40, 0x90, 0x01, 0x74, 0x2e, 0x05, 0x00, 0x03, 0x40, 0x90, 0x00, 0x90,
+ 0x2e, 0x05, 0x00, 0x01, 0x54, 0x65, 0x87, 0xff, 0x41, 0x82, 0x00, 0x08, 0x7c, 0x8c, 0x22, 0x14,
+ 0x2f, 0x0e, 0x00, 0x01, 0x40, 0x92, 0x00, 0x24, 0x41, 0xb9, 0x00, 0x18, 0x41, 0x9a, 0x00, 0x0c,
+ 0x88, 0x84, 0x00, 0x00, 0x48, 0x00, 0x00, 0xf8, 0xa0, 0x84, 0x00, 0x00, 0x48, 0x00, 0x00, 0xf0,
+ 0x80, 0x84, 0x00, 0x00, 0x48, 0x00, 0x00, 0xe8, 0x54, 0x73, 0xe5, 0x3e, 0x41, 0xb9, 0x00, 0x20,
+ 0x41, 0x9a, 0x00, 0x10, 0x99, 0x24, 0x00, 0x00, 0x38, 0x84, 0x00, 0x01, 0x48, 0x00, 0x00, 0x18,
+ 0xb1, 0x24, 0x00, 0x00, 0x38, 0x84, 0x00, 0x02, 0x48, 0x00, 0x00, 0x0c, 0x91, 0x24, 0x00, 0x00,
+ 0x38, 0x84, 0x00, 0x04, 0x36, 0x73, 0xff, 0xff, 0x40, 0x80, 0xff, 0xd4, 0x4b, 0xff, 0xfc, 0x40,
+ 0x54, 0x65, 0x87, 0xff, 0x41, 0x82, 0x00, 0x08, 0x7c, 0x84, 0x62, 0x14, 0x71, 0xc5, 0x00, 0x01,
+ 0x41, 0x82, 0x00, 0x9c, 0x7c, 0x84, 0x4a, 0x14, 0x48, 0x00, 0x00, 0x94, 0x54, 0x6a, 0x87, 0xbe,
+ 0x54, 0x8e, 0x16, 0xba, 0x7e, 0x67, 0x72, 0x14, 0x40, 0x92, 0x00, 0x08, 0x3a, 0x6f, 0xff, 0xfc,
+ 0x80, 0x9a, 0x00, 0x00, 0x81, 0x33, 0x00, 0x00, 0x71, 0x4b, 0x00, 0x01, 0x41, 0x82, 0x00, 0x08,
+ 0x7c, 0x9a, 0x23, 0x78, 0x71, 0x4b, 0x00, 0x02, 0x41, 0x82, 0x00, 0x10, 0x7d, 0x33, 0x4b, 0x78,
+ 0x40, 0xb2, 0x00, 0x08, 0x7e, 0x6c, 0x9a, 0x14, 0x54, 0x65, 0x67, 0x3f, 0x2c, 0x05, 0x00, 0x09,
+ 0x40, 0x80, 0x00, 0x54, 0x48, 0x00, 0x00, 0x79, 0x7c, 0x89, 0x22, 0x14, 0x48, 0x00, 0x00, 0x40,
+ 0x7c, 0x89, 0x21, 0xd6, 0x48, 0x00, 0x00, 0x38, 0x7d, 0x24, 0x23, 0x78, 0x48, 0x00, 0x00, 0x30,
+ 0x7d, 0x24, 0x20, 0x38, 0x48, 0x00, 0x00, 0x28, 0x7d, 0x24, 0x22, 0x78, 0x48, 0x00, 0x00, 0x20,
+ 0x7d, 0x24, 0x20, 0x30, 0x48, 0x00, 0x00, 0x18, 0x7d, 0x24, 0x24, 0x30, 0x48, 0x00, 0x00, 0x10,
+ 0x5d, 0x24, 0x20, 0x3e, 0x48, 0x00, 0x00, 0x08, 0x7d, 0x24, 0x26, 0x30, 0x90, 0x9a, 0x00, 0x00,
+ 0x4b, 0xff, 0xfb, 0x8c, 0x2c, 0x05, 0x00, 0x0a, 0x41, 0x81, 0xfb, 0x84, 0xc0, 0x5a, 0x00, 0x00,
+ 0xc0, 0x73, 0x00, 0x00, 0x41, 0x82, 0x00, 0x0c, 0xec, 0x43, 0x10, 0x2a, 0x48, 0x00, 0x00, 0x08,
+ 0xec, 0x43, 0x00, 0xb2, 0xd0, 0x5a, 0x00, 0x00, 0x4b, 0xff, 0xfb, 0x64, 0x7d, 0x48, 0x02, 0xa6,
+ 0x54, 0xa5, 0x1e, 0x78, 0x7d, 0x4a, 0x2a, 0x14, 0x80, 0x9a, 0x00, 0x00, 0x81, 0x33, 0x00, 0x00,
+ 0x7d, 0x48, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x40, 0xbe, 0xfb, 0x44, 0x54, 0x69, 0xc0, 0x3e,
+ 0x7d, 0x8e, 0x63, 0x78, 0x48, 0x00, 0x00, 0x35, 0x41, 0x92, 0x00, 0x0c, 0x7e, 0x31, 0x22, 0x14,
+ 0x48, 0x00, 0x00, 0x08, 0x7d, 0x29, 0x22, 0x14, 0x54, 0x64, 0xc4, 0x3f, 0x38, 0xa0, 0x00, 0x00,
+ 0x41, 0x82, 0xfb, 0x1c, 0x7d, 0x45, 0x88, 0xae, 0x7d, 0x45, 0x49, 0xae, 0x38, 0xa5, 0x00, 0x01,
+ 0x7c, 0x05, 0x20, 0x00, 0x4b, 0xff, 0xff, 0xec, 0x2e, 0x8a, 0x00, 0x04, 0x55, 0x31, 0x36, 0xba,
+ 0x2c, 0x11, 0x00, 0x3c, 0x7e, 0x27, 0x88, 0x2e, 0x40, 0x82, 0x00, 0x08, 0x7d, 0xd1, 0x73, 0x78,
+ 0x41, 0x96, 0x00, 0x08, 0xa2, 0x31, 0x00, 0x00, 0x55, 0x29, 0x56, 0xba, 0x2c, 0x09, 0x00, 0x3c,
+ 0x7d, 0x27, 0x48, 0x2e, 0x40, 0x82, 0x00, 0x08, 0x7d, 0xc9, 0x73, 0x78, 0x41, 0x96, 0x00, 0x08,
+ 0xa1, 0x29, 0x00, 0x00, 0x4e, 0x80, 0x00, 0x20, 0x2c, 0x05, 0x00, 0x04, 0x40, 0x80, 0x00, 0x28,
+ 0x7c, 0x89, 0x23, 0x78, 0x7d, 0xc3, 0x62, 0x14, 0x55, 0xce, 0x00, 0x3c, 0x4b, 0xff, 0xff, 0xad,
+ 0x7c, 0x84, 0x20, 0xf8, 0x54, 0x84, 0x04, 0x3e, 0x7d, 0x2b, 0x20, 0x38, 0x7e, 0x24, 0x20, 0x38,
+ 0x4b, 0xff, 0xfb, 0xc4, 0x54, 0x6b, 0xe4, 0x3e, 0x4b, 0xff, 0xfb, 0xbc, 0x7c, 0x9a, 0x23, 0x78,
+ 0x54, 0x84, 0x18, 0x38, 0x40, 0x92, 0x00, 0x20, 0x40, 0x9e, 0x00, 0x0c, 0x7d, 0xe8, 0x03, 0xa6,
+ 0x4e, 0x80, 0x00, 0x21, 0x7d, 0xe4, 0x7a, 0x14, 0x39, 0xef, 0x00, 0x07, 0x55, 0xef, 0x00, 0x38,
+ 0x4b, 0xff, 0xfa, 0x6c, 0x2e, 0x05, 0x00, 0x03, 0x41, 0x91, 0x00, 0x5c, 0x3c, 0xa0, 0x48, 0x00,
+ 0x7d, 0x83, 0x62, 0x14, 0x55, 0x8c, 0x00, 0x3a, 0x40, 0x92, 0x00, 0x20, 0x40, 0xbe, 0xfa, 0x50,
+ 0x57, 0x44, 0x00, 0x3a, 0x7c, 0x8c, 0x20, 0x50, 0x50, 0x85, 0x01, 0xba, 0x50, 0x65, 0x07, 0xfe,
+ 0x90, 0xac, 0x00, 0x00, 0x4b, 0xff, 0xfa, 0x38, 0x40, 0xbe, 0xff, 0xbc, 0x7d, 0x2c, 0x78, 0x50,
+ 0x51, 0x25, 0x01, 0xba, 0x90, 0xac, 0x00, 0x00, 0x39, 0x8c, 0x00, 0x04, 0x7d, 0x6f, 0x22, 0x14,
+ 0x39, 0x6b, 0xff, 0xfc, 0x7d, 0x2b, 0x60, 0x50, 0x51, 0x25, 0x01, 0xba, 0x90, 0xab, 0x00, 0x00,
+ 0x4b, 0xff, 0xff, 0x94, 0x2e, 0x05, 0x00, 0x06, 0x41, 0x92, 0x00, 0x28, 0x4b, 0xff, 0xfb, 0x28,
+ 0x55, 0x8c, 0x84, 0x3e, 0x57, 0x44, 0x84, 0x3e, 0x57, 0x5a, 0x04, 0x3e, 0x7c, 0x0c, 0x20, 0x00,
+ 0x41, 0x80, 0xfb, 0xa8, 0x7c, 0x0c, 0xd0, 0x00, 0x40, 0x80, 0xfb, 0xa0, 0x4b, 0xff, 0xf9, 0xe0,
+ 0x57, 0x45, 0xff, 0xfe, 0x68, 0xa5, 0x00, 0x01, 0x71, 0x03, 0x00, 0x01, 0x7c, 0x05, 0x18, 0x00,
+ 0x41, 0x82, 0x00, 0x1c, 0x51, 0x1a, 0x0f, 0xbc, 0x6b, 0x5a, 0x00, 0x02, 0x57, 0x45, 0xff, 0xff,
+ 0x41, 0x82, 0x00, 0x08, 0x6b, 0x5a, 0x00, 0x01, 0x93, 0x4f, 0xff, 0xfc, 0x53, 0x48, 0x07, 0xfe,
+ 0x4b, 0xff, 0xf9, 0xac, 0x2c, 0x0b, 0x00, 0x00, 0x41, 0x82, 0x01, 0x38, 0x2c, 0x05, 0x00, 0x01,
+ 0x41, 0x82, 0x00, 0x18, 0x2c, 0x05, 0x00, 0x02, 0x41, 0x82, 0x00, 0x14, 0x2c, 0x05, 0x00, 0x03,
+ 0x41, 0x82, 0x00, 0x70, 0x4b, 0xff, 0xf9, 0x40, 0x54, 0xcc, 0x00, 0x0c, 0x54, 0x97, 0x46, 0x3e,
+ 0x54, 0x98, 0xc4, 0x3e, 0x54, 0x84, 0x06, 0x3e, 0x40, 0x9e, 0x00, 0xfc, 0x56, 0xf9, 0x06, 0x31,
+ 0x7d, 0x9a, 0x63, 0x78, 0x7f, 0x43, 0xd2, 0x14, 0x57, 0x5a, 0x00, 0x3a, 0x41, 0x82, 0x00, 0x18,
+ 0x7e, 0xf7, 0x07, 0x74, 0x7e, 0xf7, 0x00, 0xd0, 0x1f, 0x37, 0x00, 0x02, 0x3b, 0x39, 0x00, 0x04,
+ 0x7f, 0x59, 0xd0, 0x50, 0x2c, 0x17, 0x00, 0x00, 0x41, 0x82, 0x00, 0x1c, 0x3b, 0x20, 0x00, 0x00,
+ 0x7e, 0xe9, 0x03, 0xa6, 0xa3, 0x7a, 0x00, 0x04, 0x7f, 0x79, 0xca, 0x78, 0x3b, 0x5a, 0x00, 0x02,
+ 0x42, 0x00, 0xff, 0xf4, 0x7c, 0x18, 0xc8, 0x00, 0x40, 0x82, 0x00, 0xac, 0x4b, 0xff, 0xfe, 0x90,
+ 0x51, 0x08, 0x08, 0x3c, 0x40, 0x9e, 0x00, 0x9c, 0x54, 0x77, 0xb0, 0x03, 0x41, 0x81, 0x00, 0x88,
+ 0x41, 0x80, 0x00, 0x8c, 0x54, 0x7e, 0x06, 0x3e, 0x1f, 0xde, 0x00, 0x02, 0x54, 0x97, 0x00, 0x1e,
+ 0x6e, 0xf8, 0x80, 0x00, 0x2c, 0x18, 0x00, 0x00, 0x40, 0x82, 0x00, 0x08, 0x62, 0xf7, 0x30, 0x00,
+ 0x54, 0x98, 0x80, 0x1e, 0x1f, 0x3e, 0x00, 0x04, 0x7f, 0x19, 0xc0, 0x50, 0x3b, 0x20, 0x00, 0x00,
+ 0x1f, 0x59, 0x00, 0x04, 0x7f, 0x6f, 0xd0, 0x2e, 0x7f, 0x57, 0xd0, 0x2e, 0x3b, 0x39, 0x00, 0x01,
+ 0x7c, 0x17, 0xc0, 0x40, 0x41, 0x81, 0x00, 0x34, 0x7c, 0x19, 0xf0, 0x00, 0x41, 0x81, 0x00, 0x14,
+ 0x7c, 0x1a, 0xd8, 0x00, 0x41, 0x82, 0xff, 0xdc, 0x3a, 0xf7, 0x00, 0x04, 0x4b, 0xff, 0xff, 0xd0,
+ 0x80, 0x6f, 0xff, 0xf8, 0x60, 0x63, 0x03, 0x00, 0x90, 0x6f, 0xff, 0xf8, 0x92, 0xef, 0xff, 0xfc,
+ 0x7e, 0xf0, 0xbb, 0x78, 0x48, 0x00, 0x00, 0x1c, 0x80, 0x6f, 0xff, 0xf8, 0x60, 0x63, 0x01, 0x00,
+ 0x90, 0x6f, 0xff, 0xf8, 0x61, 0x08, 0x00, 0x01, 0x48, 0x00, 0x00, 0x08, 0x7c, 0x90, 0x23, 0x78,
+ 0x54, 0x64, 0x06, 0x3e, 0x1c, 0x84, 0x00, 0x08, 0x7d, 0xe4, 0x7a, 0x14, 0x4b, 0xff, 0xf8, 0x70,
+ 0x40, 0x92, 0x00, 0x0c, 0x39, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x14, 0x54, 0x69, 0x06, 0xff,
+ 0x54, 0x65, 0x67, 0xfe, 0x7d, 0x08, 0x4c, 0x30, 0x55, 0x17, 0xff, 0xff, 0x40, 0x82, 0x00, 0x08,
+ 0x7d, 0x08, 0x2a, 0x78, 0x54, 0x85, 0x00, 0x1f, 0x41, 0x82, 0x00, 0x08, 0x7c, 0xa6, 0x2b, 0x78,
+ 0x54, 0x85, 0x80, 0x1f, 0x41, 0x82, 0x00, 0x08, 0x7c, 0xb0, 0x2b, 0x78, 0x4b, 0xff, 0xf8, 0x30,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+
+};
+const int codehandleronly_size = sizeof(codehandleronly);
diff --git a/source/patches/fst.c b/source/patches/fst.c
index 8da88968..3816aa82 100644
--- a/source/patches/fst.c
+++ b/source/patches/fst.c
@@ -26,94 +26,750 @@
#include
#include
#include
-#include
#include
-
-#include "settings/cfg.h"
#include "fst.h"
#include "dvd_broadway.h"
-#include "wpad.h"
#include "fatmounter.h"
-#include "sys.h"
-#include "../gecko.h"
+#include "settings/cfg.h"
#include "mload/mload.h"
#include "mload/dip_plugin.h"
-#include "patches/wip.h"
+#include "gecko.h"
-extern struct SSettings Settings;
+#include "patchcode.h"
+#include "language/gettext.h"
-// Pre-allocate the buffer size for ocarina codes
-u8 filebuff[MAX_GCT_SIZE];
+#include "codehandler.h"
+//#include "codehandlerslota.h"
+#include "codehandleronly.h"
+#include "multidol.h"
-u32 do_sd_code(char *filename)
+#define FSTDIRTYPE 1
+#define FSTFILETYPE 0
+#define ENTRYSIZE 0xC
+//#define FILEDIR "fat0:/codes"
+//#define FILEDIR "sd:/codes"
+#define FILEDIR "/codes"
+
+#define MAX_FILENAME_LEN 128
+
+static u8 *codelistend;
+void *codelist;
+
+u32 gameconfsize = 0;
+u32 *gameconf = NULL;
+
+u8 debuggerselect;
+
+extern const u32 viwiihooks[4];
+extern const u32 kpadhooks[4];
+extern const u32 joypadhooks[4];
+extern const u32 gxdrawhooks[4];
+extern const u32 gxflushhooks[4];
+extern const u32 ossleepthreadhooks[4];
+extern const u32 axnextframehooks[4];
+extern const u32 wpadbuttonsdownhooks[4];
+extern const u32 wpadbuttonsdown2hooks[4];
+
+
+//static vu32 dvddone = 0;
+
+//---------------------------------------------------------------------------------
+void app_loadgameconfig(char *discid)
+//---------------------------------------------------------------------------------
{
-gprintf("\ndo_sd_code(%s)",filename);
-printf("\ndo_sd_code(%s)",filename);
+ gameconfsize = 0;
- FILE *fp;
- //u8 *filebuff;
- u32 filesize;
+ if (gameconf == NULL)
+ {
+ gameconf = malloc(65536);
+ if (gameconf == NULL)
+ {
+ //TODO for oggzee
+ //print_status("Out of memory");
+ return;
+ }
+ }
+
+ FILE* fp;
u32 ret;
+ u32 filesize;
+ s32 gameidmatch, maxgameidmatch = -1, maxgameidmatch2 = -1;
+ u32 i, numnonascii, parsebufpos;
+ u32 codeaddr, codeval, codeaddr2, codeval2, codeoffset;
+ u32 temp, tempoffset = 0;
+ char parsebuffer[18];
+
+ //if (config_bytes[2] == 8)
+ // hookset = 1;
+
+ u8 *tempgameconf;
+ u32 tempgameconfsize = 0;
+
+ //memcpy(tempgameconf, defaultgameconfig, defaultgameconfig_size);
+ //tempgameconf[defaultgameconfig_size] = '\n';
+ //tempgameconfsize = defaultgameconfig_size + 1;
+
+ char filepath[200];
+ snprintf(filepath, "%s/gameconfig.txt", Settings.Cheatcodespath);
+
+ fp = fopen(filepath, "rb");
+
+ if (!fp)
+ {
+ snprintf(filepath, "%s/gameconfig.txt", bootDevice);
+ fp = fopen(filepath, "rb");
+ }
+
+ if (fp) {
+ fseek(fp, 0, SEEK_END);
+ filesize = ftell(fp);
+ fseek(fp, 0, SEEK_SET);
+
+ tempgameconf = malloc(filesize);
+ if (tempgameconf == NULL)
+ {
+ //TODO for oggzee
+ //print_status("Out of memory");
+ //wait(4);
+ return;
+ }
+
+ ret = fread((void*)tempgameconf, 1, filesize, fp);
+ fclose(fp);
+ if (ret != filesize)
+ {
+ //TODO for oggzee
+ //print_status("Error reading gameconfig.txt");
+ //wait(4);
+ return;
+ }
+ tempgameconfsize = filesize;
+ }
+ else
+ {
+ return;
+ }
+
+ // Remove non-ASCII characters
+ numnonascii = 0;
+ for (i = 0; i < tempgameconfsize; i++)
+ {
+ if (tempgameconf[i] < 9 || tempgameconf[i] > 126)
+ numnonascii++;
+ else
+ tempgameconf[i-numnonascii] = tempgameconf[i];
+ }
+ tempgameconfsize -= numnonascii;
+
+ *(tempgameconf + tempgameconfsize) = 0;
+ //gameconf = (tempgameconf + tempgameconfsize) + (4 - (((u32) (tempgameconf + tempgameconfsize)) % 4));
+
+ for (maxgameidmatch = 0; maxgameidmatch <= 6; maxgameidmatch++)
+ {
+ i = 0;
+ while (i < tempgameconfsize)
+ {
+ maxgameidmatch2 = -1;
+ while (maxgameidmatch != maxgameidmatch2)
+ {
+ while (i != tempgameconfsize && tempgameconf[i] != ':') i++;
+ if (i == tempgameconfsize) break;
+ while ((tempgameconf[i] != 10 && tempgameconf[i] != 13) && (i != 0)) i--;
+ if (i != 0) i++;
+ parsebufpos = 0;
+ gameidmatch = 0;
+ while (tempgameconf[i] != ':')
+ {
+ if (tempgameconf[i] == '?')
+ {
+ parsebuffer[parsebufpos] = discid[parsebufpos];
+ parsebufpos++;
+ gameidmatch--;
+ i++;
+ }
+ else if (tempgameconf[i] != 0 && tempgameconf[i] != ' ')
+ parsebuffer[parsebufpos++] = tempgameconf[i++];
+ else if (tempgameconf[i] == ' ')
+ break;
+ else
+ i++;
+ if (parsebufpos == 8) break;
+ }
+ parsebuffer[parsebufpos] = 0;
+ if (strncasecmp("DEFAULT", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 7)
+ {
+ gameidmatch = 0;
+ goto idmatch;
+ }
+ if (strncmp(discid, parsebuffer, strlen(parsebuffer)) == 0)
+ {
+ gameidmatch += strlen(parsebuffer);
+ idmatch:
+ if (gameidmatch > maxgameidmatch2)
+ {
+ maxgameidmatch2 = gameidmatch;
+ }
+ }
+ while ((i != tempgameconfsize) && (tempgameconf[i] != 10 && tempgameconf[i] != 13)) i++;
+ }
+ while (i != tempgameconfsize && tempgameconf[i] != ':')
+ {
+ parsebufpos = 0;
+ while ((i != tempgameconfsize) && (tempgameconf[i] != 10 && tempgameconf[i] != 13))
+ {
+ if (tempgameconf[i] != 0 && tempgameconf[i] != ' ' && tempgameconf[i] != '(' && tempgameconf[i] != ':')
+ parsebuffer[parsebufpos++] = tempgameconf[i++];
+ else if (tempgameconf[i] == ' ' || tempgameconf[i] == '(' || tempgameconf[i] == ':')
+ break;
+ else
+ i++;
+ if (parsebufpos == 17) break;
+ }
+ parsebuffer[parsebufpos] = 0;
+ //if (!autobootcheck)
+ {
+ //if (strncasecmp("addtocodelist(", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 14)
+ //{
+ // ret = sscanf(tempgameconf + i, "%x %x", &codeaddr, &codeval);
+ // if (ret == 2)
+ // addtocodelist(codeaddr, codeval);
+ //}
+ if (strncasecmp("codeliststart", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 13)
+ {
+ sscanf((char *)(tempgameconf + i), " = %x", (unsigned int *)&codelist);
+ }
+ if (strncasecmp("codelistend", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 11)
+ {
+ sscanf((char *)(tempgameconf + i), " = %x", (unsigned int *)&codelistend);
+ }
+ /*
+ if (strncasecmp("hooktype", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 8)
+ {
+ if (hookset == 1)
+ {
+ ret = sscanf(tempgameconf + i, " = %u", &temp);
+ if (ret == 1)
+ if (temp >= 0 && temp <= 7)
+ config_bytes[2] = temp;
+ }
+ }
+ */
+ if (strncasecmp("poke", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 4)
+ {
+ ret = sscanf((char *)tempgameconf + i, "( %x , %x", &codeaddr, &codeval);
+ if (ret == 2)
+ {
+ *(gameconf + (gameconfsize / 4)) = 0;
+ gameconfsize += 4;
+ *(gameconf + (gameconfsize / 4)) = 0;
+ gameconfsize += 8;
+ *(gameconf + (gameconfsize / 4)) = codeaddr;
+ gameconfsize += 4;
+ *(gameconf + (gameconfsize / 4)) = codeval;
+ gameconfsize += 4;
+ DCFlushRange((void *) (gameconf + (gameconfsize / 4) - 5), 20);
+ }
+ }
+ if (strncasecmp("pokeifequal", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 11)
+ {
+ ret = sscanf((char *)(tempgameconf + i), "( %x , %x , %x , %x", &codeaddr, &codeval, &codeaddr2, &codeval2);
+ if (ret == 4)
+ {
+ *(gameconf + (gameconfsize / 4)) = 0;
+ gameconfsize += 4;
+ *(gameconf + (gameconfsize / 4)) = codeaddr;
+ gameconfsize += 4;
+ *(gameconf + (gameconfsize / 4)) = codeval;
+ gameconfsize += 4;
+ *(gameconf + (gameconfsize / 4)) = codeaddr2;
+ gameconfsize += 4;
+ *(gameconf + (gameconfsize / 4)) = codeval2;
+ gameconfsize += 4;
+ DCFlushRange((void *) (gameconf + (gameconfsize / 4) - 5), 20);
+ }
+ }
+ if (strncasecmp("searchandpoke", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 13)
+ {
+ ret = sscanf((char *)(tempgameconf + i), "( %x%n", &codeval, &tempoffset);
+ if (ret == 1)
+ {
+ gameconfsize += 4;
+ temp = 0;
+ while (ret == 1)
+ {
+ *(gameconf + (gameconfsize / 4)) = codeval;
+ gameconfsize += 4;
+ temp++;
+ i += tempoffset;
+ ret = sscanf((char *)(tempgameconf + i), " %x%n", &codeval, &tempoffset);
+ }
+ *(gameconf + (gameconfsize / 4) - temp - 1) = temp;
+ ret = sscanf((char *)(tempgameconf + i), " , %x , %x , %x , %x", &codeaddr, &codeaddr2, &codeoffset, &codeval2);
+ if (ret == 4)
+ {
+ *(gameconf + (gameconfsize / 4)) = codeaddr;
+ gameconfsize += 4;
+ *(gameconf + (gameconfsize / 4)) = codeaddr2;
+ gameconfsize += 4;
+ *(gameconf + (gameconfsize / 4)) = codeoffset;
+ gameconfsize += 4;
+ *(gameconf + (gameconfsize / 4)) = codeval2;
+ gameconfsize += 4;
+ DCFlushRange((void *) (gameconf + (gameconfsize / 4) - temp - 5), temp * 4 + 20);
+ }
+ else
+ gameconfsize -= temp * 4 + 4;
+ }
+
+ }
+ /*
+ if (strncasecmp("hook", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 4)
+ {
+ ret = sscanf(tempgameconf + i, "( %x %x %x %x %x %x %x %x", customhook, customhook + 1, customhook + 2, customhook + 3, customhook + 4, customhook + 5, customhook + 6, customhook + 7);
+ if (ret >= 3)
+ {
+ if (hookset != 1)
+ configwarn |= 4;
+ config_bytes[2] = 0x08;
+ customhooksize = ret * 4;
+ }
+ }
+ if (strncasecmp("002fix", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 6)
+ {
+ ret = sscanf(tempgameconf + i, " = %u", &temp);
+ if (ret == 1)
+ if (temp >= 0 && temp <= 0x1)
+ fakeiosversion = temp;
+ }
+ if (strncasecmp("switchios", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 9)
+ {
+ ret = sscanf(tempgameconf + i, " = %u", &temp);
+ if (ret == 1)
+ if (temp >= 0 && temp <= 1)
+ willswitchios = temp;
+ }
+ if (strncasecmp("videomode", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 9)
+ {
+ ret = sscanf(tempgameconf + i, " = %u", &temp);
+ if (ret == 1)
+ {
+ if (temp == 0)
+ {
+ if (config_bytes[1] != 0x00)
+ configwarn |= 1;
+ config_bytes[1] = 0x00;
+ }
+ else if (temp == 1)
+ {
+ if (config_bytes[1] != 0x03)
+ configwarn |= 1;
+ config_bytes[1] = 0x03;
+ }
+ else if (temp == 2)
+ {
+ if (config_bytes[1] != 0x01)
+ configwarn |= 1;
+ config_bytes[1] = 0x01;
+ }
+ else if (temp == 3)
+ {
+ if (config_bytes[1] != 0x02)
+ configwarn |= 1;
+ config_bytes[1] = 0x02;
+ }
+ }
+ }
+ if (strncasecmp("language", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 8)
+ {
+ ret = sscanf(tempgameconf + i, " = %u", &temp);
+ if (ret == 1)
+ {
+ if (temp == 0)
+ {
+ if (config_bytes[0] != 0xCD)
+ configwarn |= 2;
+ config_bytes[0] = 0xCD;
+ }
+ else if (temp > 0 && temp <= 10)
+ {
+ if (config_bytes[0] != temp-1)
+ configwarn |= 2;
+ config_bytes[0] = temp-1;
+ }
+ }
+ }
+ if (strncasecmp("diagnostic", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 10)
+ {
+ ret = sscanf(tempgameconf + i, " = %u", &temp);
+ if (ret == 1)
+ {
+ if (temp == 0 || temp == 1)
+ diagcreate = temp;
+ }
+ }
+ if (strncasecmp("vidtv", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 5)
+ {
+ ret = sscanf(tempgameconf + i, " = %u", &temp);
+ if (ret == 1)
+ if (temp >= 0 && temp <= 1)
+ vipatchon = temp;
+ }
+ if (strncasecmp("fwritepatch", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 11)
+ {
+ ret = sscanf(tempgameconf + i, " = %u", &temp);
+ if (ret == 1)
+ if (temp >= 0 && temp <= 1)
+ applyfwritepatch = temp;
+ }
+ if (strncasecmp("dumpmaindol", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 11)
+ {
+ ret = sscanf(tempgameconf + i, " = %u", &temp);
+ if (ret == 1)
+ if (temp >= 0 && temp <= 1)
+ dumpmaindol = temp;
+ }
+ */
+ }
+ /*else
+ {
+
+ if (strncasecmp("autoboot", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 8)
+ {
+ ret = sscanf(tempgameconf + i, " = %u", &temp);
+ if (ret == 1)
+ if (temp >= 0 && temp <= 1)
+ autoboot = temp;
+ }
+ if (strncasecmp("autobootwait", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 12)
+ {
+ ret = sscanf(tempgameconf + i, " = %u", &temp);
+ if (ret == 1)
+ if (temp >= 0 && temp <= 255)
+ autobootwait = temp;
+ }
+ if (strncasecmp("autoboothbc", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 11)
+ {
+ ret = sscanf(tempgameconf + i, " = %u", &temp);
+ if (ret == 1)
+ if (temp >= 0 && temp <= 1)
+ autoboothbc = temp;
+ }
+ if (strncasecmp("autobootocarina", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 15)
+ {
+ ret = sscanf(tempgameconf + i, " = %u", &temp);
+ if (ret == 1)
+ if (temp >= 0 && temp <= 1)
+ config_bytes[4] = temp;
+ }
+ if (strncasecmp("autobootdebugger", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 16)
+ {
+ ret = sscanf(tempgameconf + i, " = %u", &temp);
+ if (ret == 1)
+ if (temp >= 0 && temp <= 1)
+ config_bytes[7] = temp;
+ }
+ if (strncasecmp("rebootermenuitem", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 16)
+ {
+ ret = sscanf(tempgameconf + i, " = %u", &temp);
+ if (ret == 1)
+ if (temp >= 0 && temp <= 1)
+ rebooterasmenuitem = temp;
+ }
+ if (strncasecmp("startupios", parsebuffer, strlen(parsebuffer)) == 0 && strlen(parsebuffer) == 10)
+ {
+ ret = sscanf(tempgameconf + i, " = %u", &temp);
+ if (ret == 1)
+ if (temp >= 0 && temp <= 255)
+ {
+ sdio_Shutdown();
+ IOS_ReloadIOS(temp);
+ detectIOScapabilities();
+ sd_init();
+ startupiosloaded = 1;
+ }
+ }
+
+ }*/
+ if (tempgameconf[i] != ':')
+ {
+ while ((i != tempgameconfsize) && (tempgameconf[i] != 10 && tempgameconf[i] != 13)) i++;
+ if (i != tempgameconfsize) i++;
+ }
+ }
+ if (i != tempgameconfsize) while ((tempgameconf[i] != 10 && tempgameconf[i] != 13) && (i != 0)) i--;
+ }
+ }
+
+ free(tempgameconf);
+ //tempcodelist = ((u8 *) gameconf) + gameconfsize;
+}
+
+u8 *code_buf = NULL;
+int code_size = 0;
+
+int ocarina_load_code(u8 *id)
+{
+ if (debuggerselect == 0x00)
+ codelist = (u8 *) 0x800022A8;
+ else
+ codelist = (u8 *) 0x800028B8;
+ codelistend = (u8 *) 0x80003000;
+
+
+ app_loadgameconfig((char *)id);
+
char filepath[150];
- //SDCard_Init();
- //USBDevice_Init();
+ gprintf("Ocarina: Searching codes...");
+ gprintf("\n");
- sprintf(filepath, "%s%s", Settings.Cheatcodespath, filename);
+ sprintf(filepath, "%s%s", Settings.Cheatcodespath, (char *) id);
filepath[strlen(Settings.Cheatcodespath)+6] = 0x2E;
filepath[strlen(Settings.Cheatcodespath)+7] = 0x67;
filepath[strlen(Settings.Cheatcodespath)+8] = 0x63;
filepath[strlen(Settings.Cheatcodespath)+9] = 0x74;
filepath[strlen(Settings.Cheatcodespath)+10] = 0;
- fp = fopen(filepath, "rb");
- if (!fp) {
- USBDevice_deInit();
- SDCard_deInit();
- gprintf("\n\tcan't open %s",filepath);
- printf("\n\tcan't open %s",filepath);
- sleep(10);
+ FILE * fp = fopen(filepath, "rb");
+ if(!fp) {
+ gprintf("Ocarina: No codes found");
+ printf("\n");
return 0;
}
fseek(fp, 0, SEEK_END);
- filesize = ftell(fp);
- if(filesize <= 16 || filesize>MAX_GCT_SIZE){
- fclose(fp);
- sleep(2);
- USBDevice_deInit();
- SDCard_deInit();
- gprintf("\n\tError. size = %d",filesize);
- printf("\n\tError. size = %d",filesize);
- sleep(10);
+ u32 filesize = ftell(fp);
+ rewind(fp);
+
+ code_buf = (u8*) malloc(filesize);
+ if (!code_buf) {
+ gprintf("Ocarina: No codes found");
+ printf("\n");
+ fclose(fp);
return 0;
}
- fseek(fp, 0, SEEK_SET);
-
- ret = fread(&filebuff, 1, filesize, fp);
- if(ret != filesize){
- fclose(fp);
- USBDevice_deInit();
- SDCard_deInit();
- gprintf("\n\tError. ret != size");
- printf("\n\tError. ret != size");
- sleep(10);
+ code_size = fread(code_buf, 1, filesize, fp);
+
+ fclose(fp);
+
+ if(code_size <= 0) {
+ gprintf("Ocarina: could not read file.");
+ gprintf("\n");
+ free(code_buf);
+ code_buf = NULL;
+ code_size = 0;
return 0;
}
- fclose(fp);
- //USBDevice_deInit();
- //SDCard_deInit();
- memcpy((void*)0x800027E8, &filebuff,filesize);
- *(vu8*)0x80001807 = 0x01;
- //gprintf("\n\tDe-init SD & USB");
-
+ if (code_size > (u32)codelistend - (u32)codelist)
+ {
+ gprintf("Ocarina: Too many codes found");
+ gprintf("\n");
+ free(code_buf);
+ code_buf = NULL;
+ code_size = 0;
+ return 0;
+ }
-
- gprintf("\n\tDone");
- printf("...Done");
+ gprintf("Ocarina: Codes found.");
+ gprintf("\n");
+ return code_size;
+}
+
+//---------------------------------------------------------------------------------
+void app_pokevalues()
+//---------------------------------------------------------------------------------
+{
+ u32 i, *codeaddr, *codeaddr2, *addrfound = NULL;
+
+ if (gameconfsize != 0)
+ {
+ for (i = 0; i < gameconfsize/4; i++)
+ {
+ if (*(gameconf + i) == 0)
+ {
+ if (((u32 *) (*(gameconf + i + 1))) == NULL ||
+ *((u32 *) (*(gameconf + i + 1))) == *(gameconf + i + 2))
+ {
+ *((u32 *) (*(gameconf + i + 3))) = *(gameconf + i + 4);
+ DCFlushRange((void *) *(gameconf + i + 3), 4);
+ }
+ i += 4;
+ }
+ else
+ {
+ codeaddr = (u32 *)*(gameconf + i + *(gameconf + i) + 1);
+ codeaddr2 = (u32 *)*(gameconf + i + *(gameconf + i) + 2);
+ if (codeaddr == 0 && addrfound != NULL)
+ codeaddr = addrfound;
+ else if (codeaddr == 0 && codeaddr2 != 0)
+ codeaddr = (u32 *) ((((u32) codeaddr2) >> 28) << 28);
+ else if (codeaddr == 0 && codeaddr2 == 0)
+ {
+ i += *(gameconf + i) + 4;
+ continue;
+ }
+ if (codeaddr2 == 0)
+ codeaddr2 = codeaddr + *(gameconf + i);
+ addrfound = NULL;
+ while (codeaddr <= (codeaddr2 - *(gameconf + i)))
+ {
+ if (memcmp(codeaddr, gameconf + i + 1, (*(gameconf + i)) * 4) == 0)
+ {
+ *(codeaddr + ((*(gameconf + i + *(gameconf + i) + 3)) / 4)) = *(gameconf + i + *(gameconf + i) + 4);
+ if (addrfound == NULL) addrfound = codeaddr;
+ }
+ codeaddr++;
+ }
+ i += *(gameconf + i) + 4;
+ }
+ }
+ }
+}
+
+
+//---------------------------------------------------------------------------------
+void load_handler()
+//---------------------------------------------------------------------------------
+{
+ if (hooktype != 0x00)
+ {
+ if (debuggerselect == 0x01)
+ {
+ /*switch(gecko_channel)
+ {
+ case 0: // Slot A
+
+ memset((void*)0x80001800,0,codehandlerslota_size);
+ memcpy((void*)0x80001800,codehandlerslota,codehandlerslota_size);
+ if (pausedstartoption == 0x01)
+ *(u32*)0x80002798 = 1;
+ memcpy((void*)0x80001CDE, &codelist, 2);
+ memcpy((void*)0x80001CE2, ((u8*) &codelist) + 2, 2);
+ memcpy((void*)0x80001F7E, &codelist, 2);
+ memcpy((void*)0x80001F82, ((u8*) &codelist) + 2, 2);
+ DCFlushRange((void*)0x80001800,codehandlerslota_size);
+ break;
+
+ case 1: // slot B
+ */ memset((void*)0x80001800,0,codehandler_size);
+ memcpy((void*)0x80001800,codehandler,codehandler_size);
+ //TODO for oggzee: Consider adding an option for paused start, debugging related
+ //if (pausedstartoption == 0x01)
+ // *(u32*)0x80002798 = 1;
+ memcpy((void*)0x80001CDE, &codelist, 2);
+ memcpy((void*)0x80001CE2, ((u8*) &codelist) + 2, 2);
+ memcpy((void*)0x80001F5A, &codelist, 2);
+ memcpy((void*)0x80001F5E, ((u8*) &codelist) + 2, 2);
+ DCFlushRange((void*)0x80001800,codehandler_size);
+ /* break;
+
+ case 2:
+ memset((void*)0x80001800,0,codehandler_size);
+ memcpy((void*)0x80001800,codehandler,codehandler_size);
+ if (pausedstartoption == 0x01)
+ *(u32*)0x80002798 = 1;
+ memcpy((void*)0x80001CDE, &codelist, 2);
+ memcpy((void*)0x80001CE2, ((u8*) &codelist) + 2, 2);
+ memcpy((void*)0x80001F5A, &codelist, 2);
+ memcpy((void*)0x80001F5E, ((u8*) &codelist) + 2, 2);
+ DCFlushRange((void*)0x80001800,codehandler_size);
+ break;
+ }*/
+ }
+ else
+ {
+ memset((void*)0x80001800,0,codehandleronly_size);
+ memcpy((void*)0x80001800,codehandleronly,codehandleronly_size);
+ memcpy((void*)0x80001906, &codelist, 2);
+ memcpy((void*)0x8000190A, ((u8*) &codelist) + 2, 2);
+ DCFlushRange((void*)0x80001800,codehandleronly_size);
+ }
+ // Load multidol handler
+ memset((void*)0x80001000,0,multidol_size);
+ memcpy((void*)0x80001000,multidol,multidol_size);
+ DCFlushRange((void*)0x80001000,multidol_size);
+ switch(hooktype)
+ {
+ case 0x01:
+ memcpy((void*)0x8000119C,viwiihooks,12);
+ memcpy((void*)0x80001198,viwiihooks+3,4);
+ break;
+ case 0x02:
+ memcpy((void*)0x8000119C,kpadhooks,12);
+ memcpy((void*)0x80001198,kpadhooks+3,4);
+ break;
+ case 0x03:
+ memcpy((void*)0x8000119C,joypadhooks,12);
+ memcpy((void*)0x80001198,joypadhooks+3,4);
+ break;
+ case 0x04:
+ memcpy((void*)0x8000119C,gxdrawhooks,12);
+ memcpy((void*)0x80001198,gxdrawhooks+3,4);
+ break;
+ case 0x05:
+ memcpy((void*)0x8000119C,gxflushhooks,12);
+ memcpy((void*)0x80001198,gxflushhooks+3,4);
+ break;
+ case 0x06:
+ memcpy((void*)0x8000119C,ossleepthreadhooks,12);
+ memcpy((void*)0x80001198,ossleepthreadhooks+3,4);
+ break;
+ case 0x07:
+ memcpy((void*)0x8000119C,axnextframehooks,12);
+ memcpy((void*)0x80001198,axnextframehooks+3,4);
+ break;
+ case 0x08:
+ //if (customhooksize == 16)
+ //{
+ // memcpy((void*)0x8000119C,customhook,12);
+ // memcpy((void*)0x80001198,customhook+3,4);
+ //}
+ break;
+ case 0x09:
+ //memcpy((void*)0x8000119C,wpadbuttonsdownhooks,12);
+ //memcpy((void*)0x80001198,wpadbuttonsdownhooks+3,4);
+ break;
+ case 0x0A:
+ //memcpy((void*)0x8000119C,wpadbuttonsdown2hooks,12);
+ //memcpy((void*)0x80001198,wpadbuttonsdown2hooks+3,4);
+ break;
+ }
+ DCFlushRange((void*)0x80001198,16);
+ }
+ memcpy((void *)0x80001800, (void*)0x80000000, 6);
+}
+
+int ocarina_do_code()
+{
+ if (!code_buf) {
+ return 0;
+ }
+
+ memset((void *)0x80001800, 0, 0x1800);
+
+ load_handler();
+ memset(codelist, 0, (u32)codelistend - (u32)codelist);
+
+ //Copy the codes
+ if (code_size > 0)
+ {
+ memcpy(codelist, code_buf, code_size);
+ DCFlushRange(codelist, (u32)codelistend - (u32)codelist);
+ free(code_buf);
+ code_buf = NULL;
+ }
+
+ // TODO What's this???
+ // enable flag
+ //*(vu8*)0x80001807 = 0x01;
+
+ //This needs to be done after loading the .dol into memory
+ app_pokevalues();
+
+ // hooks are patched in dogamehooks()
return 1;
}
@@ -142,7 +798,7 @@ u32 do_bca_code(u8 *gameid)
filepath[strlen(Settings.BcaCodepath)+5] = 'c';
filepath[strlen(Settings.BcaCodepath)+6] = 'a';
fp = fopen(filepath, "rb");
-
+
if (!fp) {
// Set default bcaCode
memset(bcaCode, 0, 64);
@@ -155,8 +811,8 @@ u32 do_bca_code(u8 *gameid)
fseek(fp, 0, SEEK_END);
filesize = ftell(fp);
-
- if (filesize == 64) {
+
+ if (filesize == 64) {
fseek(fp, 0, SEEK_SET);
ret = fread(bcaCode, 1, 64, fp);
}
@@ -168,7 +824,7 @@ u32 do_bca_code(u8 *gameid)
bcaCode[0x33] = 1;
}
}
-
+
mload_seek(*((u32 *) (dip_plugin+15*4)), SEEK_SET); // offset 15 (bca_data area)
mload_write(bcaCode, 64);
mload_close();
diff --git a/source/patches/fst.h b/source/patches/fst.h
index 254a6d2a..73126e90 100644
--- a/source/patches/fst.h
+++ b/source/patches/fst.h
@@ -23,19 +23,19 @@
#define __FST_H__
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
+//u32 do_fst(u32 fstlocation);
+//u32 do_sd_code(char *filename);
#define MAX_GCT_SIZE 2056
-//u32 do_fst(u32 fstlocation);
-u32 do_sd_code(char *filename);
u32 do_bca_code(u8 *gameid);
+int ocarina_load_code(u8 *id);
+int ocarina_do_code();
#ifdef __cplusplus
}
#endif
#endif
-
diff --git a/source/patches/multidol.c b/source/patches/multidol.c
new file mode 100644
index 00000000..eada5c26
--- /dev/null
+++ b/source/patches/multidol.c
@@ -0,0 +1,36 @@
+/*
+ This file was autogenerated by raw2c.
+Visit http://www.devkitpro.org
+*/
+
+const unsigned char multidol[] = {
+ 0x7f, 0xe8, 0x03, 0xa6, 0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0xac, 0x7c, 0x00, 0x00, 0x26,
+ 0x90, 0x01, 0x00, 0x0c, 0x7c, 0x09, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x10, 0x7c, 0x01, 0x02, 0xa6,
+ 0x90, 0x01, 0x00, 0x14, 0xbc, 0x61, 0x00, 0x18, 0x3c, 0x60, 0x80, 0x00, 0x60, 0x63, 0x18, 0xa8,
+ 0x3c, 0xe0, 0x80, 0x00, 0x60, 0xe7, 0x11, 0x98, 0x3e, 0x60, 0x80, 0x00, 0x62, 0x73, 0x11, 0x88,
+ 0x3e, 0x40, 0x4e, 0x80, 0x62, 0x52, 0x00, 0x20, 0x81, 0xc7, 0x00, 0x04, 0x81, 0xe7, 0x00, 0x08,
+ 0x82, 0x07, 0x00, 0x0c, 0x82, 0x27, 0x00, 0x00, 0x3c, 0x80, 0x80, 0x00, 0x3c, 0xa0, 0x81, 0x33,
+ 0x38, 0x84, 0xff, 0xfc, 0x84, 0xc4, 0x00, 0x04, 0x7c, 0x04, 0x28, 0x00, 0x40, 0x80, 0x00, 0x4c,
+ 0x7c, 0x06, 0x70, 0x00, 0x40, 0x82, 0xff, 0xf0, 0x84, 0xc4, 0x00, 0x04, 0x7c, 0x06, 0x78, 0x00,
+ 0x40, 0x82, 0xff, 0xe0, 0x84, 0xc4, 0x00, 0x04, 0x7c, 0x06, 0x80, 0x00, 0x40, 0x82, 0xff, 0xd4,
+ 0x84, 0xc4, 0x00, 0x04, 0x7c, 0x06, 0x88, 0x00, 0x40, 0x82, 0xff, 0xc8, 0x84, 0xc4, 0x00, 0x04,
+ 0x7c, 0x04, 0x28, 0x00, 0x40, 0x80, 0x00, 0x14, 0x7c, 0x06, 0x90, 0x00, 0x40, 0x82, 0xff, 0xf0,
+ 0x48, 0x00, 0x00, 0xad, 0x4b, 0xff, 0xff, 0xb0, 0x3c, 0x60, 0x80, 0x00, 0x60, 0x63, 0x10, 0x00,
+ 0x3e, 0x60, 0x80, 0x00, 0x62, 0x73, 0x11, 0x90, 0x3c, 0xe0, 0x80, 0x00, 0x60, 0xe7, 0x11, 0xa8,
+ 0x81, 0xc7, 0x00, 0x04, 0x81, 0xe7, 0x00, 0x08, 0x82, 0x07, 0x00, 0x0c, 0x82, 0x27, 0x00, 0x00,
+ 0x3c, 0x80, 0x80, 0x00, 0x3c, 0xa0, 0x81, 0x40, 0x38, 0x84, 0xff, 0xfc, 0x84, 0xc4, 0x00, 0x04,
+ 0x7c, 0x04, 0x28, 0x00, 0x40, 0x80, 0x00, 0x38, 0x7c, 0x06, 0x70, 0x00, 0x40, 0x82, 0xff, 0xf0,
+ 0x84, 0xc4, 0x00, 0x04, 0x7c, 0x06, 0x78, 0x00, 0x40, 0x82, 0xff, 0xe0, 0x84, 0xc4, 0x00, 0x04,
+ 0x7c, 0x06, 0x80, 0x00, 0x40, 0x82, 0xff, 0xd4, 0x84, 0xc4, 0x00, 0x04, 0x7c, 0x06, 0x88, 0x00,
+ 0x40, 0x82, 0xff, 0xc8, 0x48, 0x00, 0x00, 0x39, 0x4b, 0xff, 0xff, 0xc4, 0x80, 0x01, 0x00, 0xac,
+ 0x7c, 0x08, 0x03, 0xa6, 0x80, 0x01, 0x00, 0x0c, 0x7c, 0x0f, 0xf1, 0x20, 0x80, 0x01, 0x00, 0x10,
+ 0x7c, 0x09, 0x03, 0xa6, 0x80, 0x01, 0x00, 0x14, 0x7c, 0x01, 0x03, 0xa6, 0xb8, 0x61, 0x00, 0x18,
+ 0x80, 0x01, 0x00, 0x08, 0x38, 0x21, 0x00, 0xa8, 0x48, 0x00, 0x07, 0x50, 0x7e, 0x44, 0x18, 0x50,
+ 0x3c, 0xc0, 0x48, 0x00, 0x52, 0x46, 0x01, 0xba, 0x90, 0xc4, 0x00, 0x00, 0x90, 0xd3, 0x00, 0x00,
+ 0x90, 0x93, 0x00, 0x04, 0x7c, 0x00, 0x20, 0xac, 0x7c, 0x00, 0x04, 0xac, 0x7c, 0x00, 0x27, 0xac,
+ 0x4c, 0x00, 0x01, 0x2c, 0x4e, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0xc7, 0x00, 0x4c, 0x7c, 0xe3, 0x3b, 0x78,
+ 0x38, 0x87, 0x00, 0x34, 0x38, 0xa7, 0x00, 0x38, 0x4e, 0x80, 0x04, 0x20, 0x7c, 0x00, 0x04, 0xac,
+ 0x4c, 0x00, 0x01, 0x2c, 0x7f, 0xe9, 0x03, 0xa6
+};
+const int multidol_size = sizeof(multidol);
diff --git a/source/patches/multidol.h b/source/patches/multidol.h
new file mode 100644
index 00000000..6984bc32
--- /dev/null
+++ b/source/patches/multidol.h
@@ -0,0 +1,14 @@
+/*
+ This file was autogenerated by raw2c.
+Visit http://www.devkitpro.org
+*/
+
+//---------------------------------------------------------------------------------
+#ifndef _multidol_h_
+#define _multidol_h_
+//---------------------------------------------------------------------------------
+extern const unsigned char multidol[];
+extern const int multidol_size;
+//---------------------------------------------------------------------------------
+#endif //_multidol_h_
+//---------------------------------------------------------------------------------
diff --git a/source/patches/patchcode.c b/source/patches/patchcode.c
index cedda4cc..29699385 100644
--- a/source/patches/patchcode.c
+++ b/source/patches/patchcode.c
@@ -1,37 +1,21 @@
-/*
- * Copyright (C) 2008 Nuke (wiinuke@gmail.com)
- *
- * this file is part of GeckoOS for USB Gecko
- * http://www.usbgecko.com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
#include
#include
#include
#include
+#include
+
#include "usbloader/apploader.h"
-#include "geckomenu.h"
#include "patchcode.h"
-#include "fwrite_patch.h"
+
+//#include "sd.h"
+//#include "fwrite_patch.h"
+//#include "fwrite_patch_slota.h"
+//#include "main.h"
extern void patchhook(u32 address, u32 len);
extern void patchhook2(u32 address, u32 len);
extern void patchhook3(u32 address, u32 len);
-extern void patchhook4(u32 address, u32 len);
+
extern void multidolpatchone(u32 address, u32 len);
extern void multidolpatchtwo(u32 address, u32 len);
@@ -51,15 +35,9 @@ extern void patchupdatecheck(u32 address, u32 len);
extern void movedvdhooks(u32 address, u32 len);
-
-extern void patchhookdol(u32 address, u32 len);
+extern void multidolhook(u32 address);
extern void langvipatch(u32 address, u32 len, u8 langbyte);
extern void vipatch(u32 address, u32 len);
-extern u32 regionfreeselect;
-
-static const u32 viwiihooks[4] = {
- 0x7CE33B78,0x38870034,0x38A70038,0x38C7004C
-};
static const u32 multidolpatch1[2] = {
0x3C03FFB4,0x28004F43
@@ -110,106 +88,241 @@ static const u32 movedvdpatch[3] = {
0x2C040000, 0x41820120, 0x3C608109
};
-
-
static const u32 regionfreehooks[5] = {
0x7C600774, 0x2C000001, 0x41820030,0x40800010,0x2C000000
};
+static const u32 cIOScode[16] = {
+ 0x7f06c378, 0x7f25cb78, 0x387e02c0, 0x4cc63182
+};
+
+static const u32 cIOSblock[16] = {
+ 0x2C1800F9, 0x40820008, 0x3B000024
+};
+
static const u32 fwritepatch[8] = {
0x9421FFD0,0x7C0802A6,0x90010034,0xBF210014,0x7C9B2378,0x7CDC3378,0x7C7A1B78,0x7CB92B78 // bushing fwrite
};
-static const u32 kpadhooks[4] = {
+static const u32 vipatchcode[3] = {
+0x4182000C,0x4180001C,0x48000018
+};
+
+const u32 viwiihooks[4] = {
+ 0x7CE33B78,0x38870034,0x38A70038,0x38C7004C
+};
+
+const u32 kpadhooks[4] = {
0x9A3F005E,0x38AE0080,0x389FFFFC,0x7E0903A6
};
-static const u32 kpadoldhooks[6] = {
+const u32 kpadoldhooks[6] = {
0x801D0060, 0x901E0060, 0x801D0064, 0x901E0064, 0x801D0068, 0x901E0068
};
-static const u32 joypadhooks[4] = {
+const u32 joypadhooks[4] = {
0x3AB50001, 0x3A73000C, 0x2C150004, 0x3B18000C
};
-static const u32 langpatch[3] = {
+const u32 gxdrawhooks[4] = {
+ 0x3CA0CC01, 0x38000061, 0x3C804500, 0x98058000
+};
+
+const u32 gxflushhooks[4] = {
+ 0x90010014, 0x800305FC, 0x2C000000, 0x41820008
+};
+
+const u32 ossleepthreadhooks[4] = {
+ 0x90A402E0, 0x806502E4, 0x908502E4, 0x2C030000
+};
+
+const u32 axnextframehooks[4] = {
+ 0x3800000E, 0x7FE3FB78, 0xB0050000, 0x38800080
+};
+
+const u32 wpadbuttonsdownhooks[4] = {
+ 0x7D6B4A14, 0x816B0010, 0x7D635B78, 0x4E800020
+};
+
+const u32 wpadbuttonsdown2hooks[4] = {
+ 0x7D6B4A14, 0x800B0010, 0x7C030378, 0x4E800020
+};
+
+const u32 multidolhooks[4] = {
+ 0x7C0004AC, 0x4C00012C, 0x7FE903A6, 0x4E800420
+};
+
+const u32 multidolchanhooks[4] = {
+ 0x4200FFF4, 0x48000004, 0x38800000, 0x4E800020
+};
+
+const u32 langpatch[3] = {
0x7C600775, 0x40820010, 0x38000000
};
-static const u32 vipatchcode[3] = {
- 0x4182000C,0x4180001C,0x48000018
+static const u32 oldpatch002[3] = {
+ 0x2C000000, 0x40820214, 0x3C608000
};
-static const u32 wpadlibogc[5] = {
-// 0x38A00140, 0x7C095878, 0x7D600078, 0x901F0010,0x913F0014
-// 0x7FA00124, 0x8001001C, 0x83810008, 0x83A1000C,0x7C0803A6
- 0x90A402E0,0x806502E4,0x908502E4,0x2C030000,0x906402E4
+static const u32 newpatch002[3] = {
+ 0x2C000000, 0x48000214, 0x3C608000
};
-void dogamehooks(void *addr, u32 len, bool vpatch)
+//---------------------------------------------------------------------------------
+bool dogamehooks(void *addr, u32 len)
+//---------------------------------------------------------------------------------
{
+ //TODO for oggzee: when using Ocarina check if a hook as patched
+
+ hooktype = 1; // TODO for oggzee: Create an option for hooktype
+ /*
+0 No Hook
+1 VBI
+2 KPAD read
+3 Joypad Hook
+4 GXDraw Hook
+5 GXFlush Hook
+6 OSSleepThread Hook
+7 AXNextFrame Hook
+ */
+
void *addr_start = addr;
void *addr_end = addr+len;
+ bool hookpatched = false;
while(addr_start < addr_end)
{
-
switch(hooktype)
{
- case 0:
-
+ case 0x00:
+ hookpatched = true;
break;
-
- case 1:
- if(memcmp(addr_start, viwiihooks, sizeof(viwiihooks))==0){
- // printf("\n\n\n");
- // printf("found at address %x\n", addr_start);
- // sleep(2);
+
+ case 0x01:
+ if(memcmp(addr_start, viwiihooks, sizeof(viwiihooks))==0)
+ {
patchhook((u32)addr_start, len);
- patched = 1;
- hooktype = 1;
+ hookpatched = true;
+ }
+ if(memcmp(addr_start, multidolhooks, sizeof(multidolhooks))==0)
+ {
+ multidolhook((u32)addr_start+sizeof(multidolhooks)-4);
+ hookpatched = true;
}
break;
- case 2:
-
- if(memcmp(addr_start, viwiihooks, sizeof(viwiihooks))==0){
- patchhook2((u32)addr_start, len);
- }
+ case 0x02:
+ if(memcmp(addr_start, kpadhooks, sizeof(kpadhooks))==0)
+ {
+ patchhook((u32)addr_start, len);
+ hookpatched = true;
+ }
+
+ if(memcmp(addr_start, kpadoldhooks, sizeof(kpadoldhooks))==0)
+ {
+ patchhook((u32)addr_start, len);
+ hookpatched = true;
+ }
+ if(memcmp(addr_start, multidolhooks, sizeof(multidolhooks))==0)
+ {
+ multidolhook((u32)addr_start+sizeof(multidolhooks)-4);
+ hookpatched = true;
+ }
break;
-
- // multidol
- case 3:
-
- if(memcmp(addr_start, multidolpatch1, sizeof(multidolpatch1))==0){
- multidolpatchone((u32)addr_start, len);
+
+ case 0x03:
+
+ if(memcmp(addr_start, joypadhooks, sizeof(joypadhooks))==0)
+ {
+ patchhook((u32)addr_start, len);
+ hookpatched = true;
}
- if(memcmp(addr_start, multidolpatch2, sizeof(multidolpatch2))==0){
- multidolpatchtwo((u32)addr_start, len);
+ if(memcmp(addr_start, multidolhooks, sizeof(multidolhooks))==0)
+ {
+ multidolhook((u32)addr_start+sizeof(multidolhooks)-4);
+ hookpatched = true;
}
- break;
- }
-
- if (vpatch){
- if(memcmp(addr_start, vipatchcode, sizeof(vipatchcode))==0) {
- vipatch((u32)addr_start, len);
- }
+ break;
+
+ case 0x04:
+
+ if(memcmp(addr_start, gxdrawhooks, sizeof(gxdrawhooks))==0)
+ {
+ patchhook((u32)addr_start, len);
+ hookpatched = true;
+ }
+ if(memcmp(addr_start, multidolhooks, sizeof(multidolhooks))==0)
+ {
+ multidolhook((u32)addr_start+sizeof(multidolhooks)-4);
+ hookpatched = true;
+ }
+ break;
+
+ case 0x05:
+
+ if(memcmp(addr_start, gxflushhooks, sizeof(gxflushhooks))==0)
+ {
+ patchhook((u32)addr_start, len);
+ hookpatched = true;
+ }
+ if(memcmp(addr_start, multidolhooks, sizeof(multidolhooks))==0)
+ {
+ multidolhook((u32)addr_start+sizeof(multidolhooks)-4);
+ hookpatched = true;
+ }
+ break;
+
+ case 0x06:
+
+ if(memcmp(addr_start, ossleepthreadhooks, sizeof(ossleepthreadhooks))==0)
+ {
+ patchhook((u32)addr_start, len);
+ hookpatched = true;
+ }
+ if(memcmp(addr_start, multidolhooks, sizeof(multidolhooks))==0)
+ {
+ multidolhook((u32)addr_start+sizeof(multidolhooks)-4);
+ hookpatched = true;
+ }
+ break;
+
+ case 0x07:
+
+ if(memcmp(addr_start, axnextframehooks, sizeof(axnextframehooks))==0)
+ {
+ patchhook((u32)addr_start, len);
+ hookpatched = true;
+ }
+ if(memcmp(addr_start, multidolhooks, sizeof(multidolhooks))==0)
+ {
+ multidolhook((u32)addr_start+sizeof(multidolhooks)-4);
+ hookpatched = true;
+ }
+ break;
+
+ case 0x08:
+
+ //if(memcmp(addr_start, customhook, customhooksize)==0)
+ //{
+ // patchhook((u32)addr_start, len);
+ // hookpatched = true;
+ //}
+ if(memcmp(addr_start, multidolhooks, sizeof(multidolhooks))==0)
+ {
+ multidolhook((u32)addr_start+sizeof(multidolhooks)-4);
+ hookpatched = true;
+ }
+ break;
}
-
- if(memcmp(addr_start, langpatch, sizeof(langpatch))==0) {
- if(configbytes[0] != 0xCD){
- langvipatch((u32)addr_start, len, configbytes[0]);
- }
- }
-
-
addr_start += 4;
- }
+ }
+ return hookpatched;
}
// Not used yet, for patching DOL once loaded into memory and befor execution
+/*
void patchdol(void *addr, u32 len)
{
@@ -229,7 +342,7 @@ void patchdol(void *addr, u32 len)
addr_start += 4;
}
}
-
+*/
void langpatcher(void *addr, u32 len)
{
@@ -247,7 +360,7 @@ void langpatcher(void *addr, u32 len)
addr_start += 4;
}
}
-
+/*
void patchdebug(void *addr, u32 len)
{
@@ -265,7 +378,7 @@ void patchdebug(void *addr, u32 len)
addr_start += 4;
}
}
-
+*/
void vidolpatcher(void *addr, u32 len)
{
@@ -280,3 +393,5 @@ void vidolpatcher(void *addr, u32 len)
addr_start += 4;
}
}
+
+
diff --git a/source/patches/patchcode.h b/source/patches/patchcode.h
index 1d1c1a9e..a67b6fda 100644
--- a/source/patches/patchcode.h
+++ b/source/patches/patchcode.h
@@ -21,9 +21,9 @@
#ifndef __PATCHCODE_H__
#define __PATCHCODE_H__
+
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
// Globals
u32 hooktype;
@@ -32,13 +32,11 @@ u8 configbytes[2];
u32 regionfree;
// Function prototypes
-void dogamehooks(void *addr, u32 len, bool vpatch);
+bool dogamehooks(void *addr, u32 len);
void langpatcher(void *addr, u32 len);
void vidolpatcher(void *addr, u32 len);
void patchdebug(void *addr, u32 len);
-
-
#ifdef __cplusplus
}
#endif
diff --git a/source/usbloader/alternatedol.c b/source/usbloader/alternatedol.c
index f5199529..236eeab1 100644
--- a/source/usbloader/alternatedol.c
+++ b/source/usbloader/alternatedol.c
@@ -188,7 +188,7 @@ void __dvd_readidcb(s32 result)
{
dvddone = result;
}
-u32 Load_Dol_from_disc(u32 doloffset, u8 videoSelected, u8 patchcountrystring, u8 vipatch) {
+u32 Load_Dol_from_disc(u32 doloffset, u8 videoSelected, u8 patchcountrystring, u8 vipatch, u8 cheat) {
int ret;
void *dol_header;
u32 entrypoint;
@@ -223,7 +223,7 @@ u32 Load_Dol_from_disc(u32 doloffset, u8 videoSelected, u8 patchcountrystring, u
DCFlushRange(offset, len);
- gamepatches(offset, len, videoSelected, patchcountrystring, vipatch);
+ gamepatches(offset, len, videoSelected, patchcountrystring, vipatch, cheat);
DCFlushRange(offset, len);
diff --git a/source/usbloader/apploader.c b/source/usbloader/apploader.c
index 5b9ce60a..885df7f3 100644
--- a/source/usbloader/apploader.c
+++ b/source/usbloader/apploader.c
@@ -4,7 +4,6 @@
#include
#include "patches/patchcode.h"
-#include "patches/kenobiwii.h" /*FISHEARS*/
#include "apploader.h"
#include "wdvd.h"
#include "wpad.h"
@@ -15,11 +14,6 @@
#include "gecko.h"
#include "patches/wip.h"
-/*KENOBI! - FISHEARS*/
-extern const unsigned char kenobiwii[];
-extern const int kenobiwii_size;
-/*KENOBI! - FISHEARS*/
-
extern bool geckoinit;
/* Apploader function pointers */
@@ -298,7 +292,7 @@ bool NewSuperMarioBrosPatch(void *Address, int Size)
return false;
}
-void gamepatches(void * dst, int len, u8 videoSelected, u8 patchcountrystring, u8 vipatch) {
+void gamepatches(void * dst, int len, u8 videoSelected, u8 patchcountrystring, u8 vipatch, u8 cheat) {
PretendThereIsADiscInTheDrive(dst, len);
@@ -330,8 +324,8 @@ void gamepatches(void * dst, int len, u8 videoSelected, u8 patchcountrystring, u
Search_and_patch_Video_Modes(dst, len, table);
}
- /*GAME HOOK - FISHEARS*/
- dogamehooks(dst,len,vipatch);
+ if(cheat)
+ dogamehooks(dst,len);
//if (vipatch)//moved to degamehooks()
// vidolpatcher(dst,len);
@@ -345,14 +339,14 @@ void gamepatches(void * dst, int len, u8 videoSelected, u8 patchcountrystring, u
PatchCountryStrings(dst, len);
NewSuperMarioBrosPatch(dst, len);
-
+
do_wip_code((u8 *)0x80000000);
//if(Settings.anti002fix == on)
if (fix002 == 2)
Anti_002_fix(dst, len);
-
+
//patchdebug(dst, len);
}
@@ -399,18 +393,6 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8
// *(u32 *)0x80003140 = *(u32 *)0x80003188;
}
- if (cheat || geckoinit) {
-// gprintf("\n\tkenobiwii loaded");
- /*HOOKS STUFF - FISHEARS*/
- memset((void*)0x80001800,0,kenobiwii_size);
- memcpy((void*)0x80001800,kenobiwii,kenobiwii_size);
- DCFlushRange((void*)0x80001800,kenobiwii_size);
- hooktype = 1;
- memcpy((void*)0x80001800, (char*)0x80000000, 6); // For WiiRD
- /*HOOKS STUFF - FISHEARS*/
- gprintf("\n\tcode handler loaded");
- }
-
for (;;) {
void *dst = NULL;
int len = 0, offset = 0;
@@ -423,7 +405,7 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8
/* Read data from DVD */
WDVD_Read(dst, len, (u64)(offset << 2));
- gamepatches(dst, len, videoSelected, patchcountrystring, vipatch);
+ gamepatches(dst, len, videoSelected, patchcountrystring, vipatch, cheat);
DCFlushRange(dst, len);
}
@@ -442,7 +424,7 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8
DCFlushRange(dolbuffer, dollen);
- gamepatches(dolbuffer, dollen, videoSelected, patchcountrystring, vipatch);
+ gamepatches(dolbuffer, dollen, videoSelected, patchcountrystring, vipatch, cheat);
DCFlushRange(dolbuffer, dollen);
diff --git a/source/usbloader/apploader.h b/source/usbloader/apploader.h
index aa5ab99b..627555e0 100644
--- a/source/usbloader/apploader.h
+++ b/source/usbloader/apploader.h
@@ -10,7 +10,7 @@ extern "C" {
/* Prototypes */
s32 Apploader_Run(entry_point *, u8, u8, u8, u8, u8, u8, u32);
- void gamepatches(void * dst, int len, u8 videoSelected, u8 patchcountrystring, u8 vipatch);
+ void gamepatches(void * dst, int len, u8 videoSelected, u8 patchcountrystring, u8 vipatch, u8 cheat);
#ifdef __cplusplus
}
diff --git a/source/usbloader/disc.c b/source/usbloader/disc.c
index c97632c8..a2c7af05 100644
--- a/source/usbloader/disc.c
+++ b/source/usbloader/disc.c
@@ -15,11 +15,14 @@
#include "wbfs.h"
#include "../gecko.h"
#include "../fatmounter.h"
-
+
/* Constants */
#define PTABLE_OFFSET 0x40000
#define WII_MAGIC 0x5D1C9EA3
+//appentrypoint
+u32 appentrypoint;
+
/* Disc pointers */
static u32 *buffer = (u32 *)0x93000000;
static u8 *diskid = (u8 *)Disc_ID;
@@ -38,6 +41,7 @@ void __Disc_SetLowMem(void) {
*(u32 *)0x800000E4 = 0x80431A80;
*Dev_Debugger = 0x81800000; // Dev Debugger Monitor Address
*Simulated_Mem = 0x01800000; // Simulated Memory Size
+ *(vu32 *)0xCD00643C = 0x00000000; // 32Mhz on Bus
//If the game is sam & max: season 1 put this shit in
char gameid[8];
@@ -152,7 +156,7 @@ void __Disc_SetVMode(u8 videoselected) {
VIDEO_WaitVSync();
}
gprintf("\nVideo mode - %s",((progressive)?"progressive":"interlaced"));
-
+
}
void __Disc_SetTime(void) {
@@ -293,7 +297,10 @@ s32 Disc_BootPartition(u64 offset, u8 videoselected, u8 cheat, u8 vipatch, u8 pa
if (cheat == 1) {
/* OCARINA STUFF - FISHEARS*/
- do_sd_code(gameid);
+ if(ocarina_load_code((u8 *) gameid) > 0)
+ {
+ ocarina_do_code();
+ }
}
//kill the USB and SD
@@ -326,8 +333,31 @@ s32 Disc_BootPartition(u64 offset, u8 videoselected, u8 cheat, u8 vipatch, u8 pa
__IOS_ShutdownSubsystems();
__exception_closeall();
- /* Jump to entry point */
- p_entry();
+ appentrypoint = (u32) p_entry;
+
+ if (cheat == 1)
+ {
+ __asm__(
+ "lis %r3, appentrypoint@h\n"
+ "ori %r3, %r3, appentrypoint@l\n"
+ "lwz %r3, 0(%r3)\n"
+ "mtlr %r3\n"
+ "lis %r3, 0x8000\n"
+ "ori %r3, %r3, 0x18A8\n"
+ "mtctr %r3\n"
+ "bctr\n"
+ );
+ }
+ else
+ {
+ __asm__(
+ "lis %r3, appentrypoint@h\n"
+ "ori %r3, %r3, appentrypoint@l\n"
+ "lwz %r3, 0(%r3)\n"
+ "mtlr %r3\n"
+ "blr\n"
+ );
+ }
return 0;
}
diff --git a/source/usbloader/disc.h b/source/usbloader/disc.h
index 7d1f6d24..2effe5c2 100644
--- a/source/usbloader/disc.h
+++ b/source/usbloader/disc.h
@@ -1,12 +1,12 @@
-#ifndef _DISC_H_
-#define _DISC_H_
-
+#ifndef _DISC_H_
+#define _DISC_H_
+
#include /* for define ATTRIBUTE_PACKED */
-#ifdef __cplusplus
-extern "C" {
-#endif
- /* Disc header structure */
+#ifdef __cplusplus
+extern "C" {
+#endif
+ /* Disc header structure */
struct discHdr {
/* Game ID */
u8 id[6];
diff --git a/source/usbloader/usbstorage2.h b/source/usbloader/usbstorage2.h
index 75f1cb17..a4d81421 100644
--- a/source/usbloader/usbstorage2.h
+++ b/source/usbloader/usbstorage2.h
@@ -1,5 +1,5 @@
#ifndef _USBSTORAGE2_H_
-#define _USBSTORAGE2_H_
+#define _USBSTORAGE2_H_
#include "ogc/disc_io.h"
@@ -22,6 +22,10 @@ s32 USBStorage2_TestMode(u32 on_off);
s32 USBStorage2_EHC_Off(void);
+s32 USBStorage_WBFS_Read(u32 woffset, u32 len, void *buffer);
+s32 USBStorage_WBFS_SetDevice(int dev);
+s32 USBStorage_WBFS_SetFragList(void *p, int size);
+
#define DEVICE_TYPE_WII_UMS (('W'<<24)|('U'<<16)|('M'<<8)|'S')
extern const DISC_INTERFACE __io_usbstorage2;