2009-05-03 22:30:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* libwiigui Template
|
|
|
|
* Tantric 2009
|
|
|
|
*
|
|
|
|
* menu.cpp
|
|
|
|
* Menu flow routines - handles all menu logic
|
|
|
|
***************************************************************************/
|
|
|
|
#include <gccore.h>
|
|
|
|
#include <ogcsys.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <wiiuse/wpad.h>
|
|
|
|
#include <stdio.h> //CLOCK
|
|
|
|
#include <time.h> //CLOCK
|
|
|
|
#include <dirent.h>
|
|
|
|
|
|
|
|
#include "libwiigui/gui.h"
|
|
|
|
#include "menu.h"
|
|
|
|
#include "main.h"
|
|
|
|
#include "input.h"
|
|
|
|
#include "http.h"
|
|
|
|
#include "dns.h"
|
|
|
|
#include "partition.h"
|
|
|
|
#include "wbfs.h"
|
2009-05-03 20:53:31 +02:00
|
|
|
#include "utils.h"
|
2009-05-03 22:30:17 +02:00
|
|
|
#include "usbstorage.h"
|
|
|
|
#include "disc.h"
|
|
|
|
#include "filelist.h"
|
|
|
|
#include "wdvd.h"
|
|
|
|
#include "libwbfs/libwbfs.h"
|
|
|
|
#include "sys.h"
|
|
|
|
#include "patchcode.h"
|
|
|
|
#include "wpad.h"
|
|
|
|
#include "cfg.h"
|
2009-05-16 17:38:52 +02:00
|
|
|
#include "language.h"
|
2009-05-03 22:30:17 +02:00
|
|
|
#include "libwiigui/gui_customoptionbrowser.h"
|
|
|
|
#include "libwiigui/gui_gamebrowser.h"
|
2009-05-20 22:09:57 +02:00
|
|
|
#include "libwiigui/gui_diskcover.h"
|
2009-05-13 17:56:16 +02:00
|
|
|
#include "mp3s.h"
|
2009-05-15 22:03:19 +02:00
|
|
|
#include "fatmounter.h"
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
#define MAX_CHARACTERS 38
|
|
|
|
|
2009-05-04 23:50:46 +02:00
|
|
|
extern FreeTypeGX *fontClock; //CLOCK
|
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
static GuiImage * coverImg = NULL;
|
|
|
|
static GuiImageData * cover = NULL;
|
|
|
|
|
|
|
|
//char GamesHDD[320][14];
|
|
|
|
|
|
|
|
static struct discHdr *gameList = NULL;
|
|
|
|
static GuiImageData * pointer[4];
|
|
|
|
static GuiImage * bgImg = NULL;
|
|
|
|
static GuiButton * btnLogo = NULL;
|
|
|
|
static GuiImageData * background = NULL;
|
2009-05-20 15:14:52 +02:00
|
|
|
static char prozent[10] = " ";
|
2009-05-03 22:30:17 +02:00
|
|
|
static char timet[50] = " ";
|
2009-05-06 17:44:15 +02:00
|
|
|
static char sizeshow[20] = " ";
|
2009-05-20 22:09:57 +02:00
|
|
|
static GuiText prTxt(prozent, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
|
|
|
static GuiText timeTxt(prozent, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
|
|
|
static GuiText sizeTxt(sizeshow, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
static GuiText *GameIDTxt = NULL;
|
|
|
|
static GuiText *GameRegionTxt = NULL;
|
|
|
|
static GuiSound * bgMusic = NULL;
|
|
|
|
static wbfs_t *hdd = NULL;
|
|
|
|
static u32 gameCnt = 0;
|
|
|
|
static s32 gameSelected = 0, gameStart = 0;
|
|
|
|
static GuiWindow * mainWindow = NULL;
|
|
|
|
static lwp_t guithread = LWP_THREAD_NULL;
|
|
|
|
static bool guiHalt = true;
|
|
|
|
static GuiImageData progressbar(progressbar_png);
|
|
|
|
static GuiImage progressbarImg(&progressbar);
|
|
|
|
int godmode = 0;
|
|
|
|
int height = 224;
|
|
|
|
int width = 160;
|
2009-05-06 17:44:15 +02:00
|
|
|
static float gamesize = 0.00;
|
2009-05-03 22:30:17 +02:00
|
|
|
static int startat = 0;
|
|
|
|
static int offset = 0, networkisinitialized = 0;
|
|
|
|
int vol = Settings.volume;
|
2009-05-11 21:55:14 +02:00
|
|
|
static int datag = 0;
|
|
|
|
int datagB =0;
|
|
|
|
int dataed = -1;
|
|
|
|
int cosa=0,sina=0,offa=0;
|
2009-05-21 10:56:23 +02:00
|
|
|
u8 dispFave=0;
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
//downloadvariables
|
|
|
|
static char missingFiles[500][12]; //fixed
|
|
|
|
static int cntMissFiles = 0;
|
|
|
|
|
|
|
|
int direction = 0; // direction the gameprompt slides in
|
|
|
|
|
|
|
|
static char gameregion[7];
|
|
|
|
//power button fix
|
|
|
|
extern u8 shutdown;
|
|
|
|
extern u8 reset;
|
|
|
|
|
|
|
|
//Wiilight stuff
|
|
|
|
static vu32 *_wiilight_reg = (u32*)0xCD0000C0;
|
|
|
|
void wiilight(int enable){ // Toggle wiilight (thanks Bool for wiilight source)
|
|
|
|
u32 val = (*_wiilight_reg&~0x20);
|
|
|
|
if(enable) val |= 0x20;
|
|
|
|
*_wiilight_reg=val;}
|
|
|
|
|
|
|
|
//Prototypes
|
2009-05-09 14:11:43 +02:00
|
|
|
int WindowPrompt(const char *title, const char *msg, const char *btn1Label, const char *btn2Label, const char *btn3Label, const char *btn4Label);
|
2009-05-03 22:30:17 +02:00
|
|
|
static void HaltGui();
|
|
|
|
static void ResumeGui();
|
2009-05-11 21:55:14 +02:00
|
|
|
extern const u8 data1;
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
bool findfile(const char * filename, const char * path)
|
|
|
|
{
|
|
|
|
DIR *dir;
|
|
|
|
struct dirent *file;
|
|
|
|
|
|
|
|
dir = opendir(path);
|
|
|
|
|
|
|
|
char temp[11];
|
|
|
|
while ((file = readdir(dir)))
|
|
|
|
{
|
|
|
|
snprintf(temp,sizeof(temp),"%s",file->d_name);
|
|
|
|
if (!strncmpi(temp,filename,11))
|
|
|
|
{
|
|
|
|
//WindowPrompt(path, filename,"go" ,0);
|
|
|
|
closedir(dir);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
closedir(dir);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* ResumeGui
|
|
|
|
*
|
|
|
|
* Signals the GUI thread to start, and resumes the thread. This is called
|
|
|
|
* after finishing the removal/insertion of new elements, and after initial
|
|
|
|
* GUI setup.
|
|
|
|
***************************************************************************/
|
|
|
|
static void
|
|
|
|
ResumeGui()
|
|
|
|
{
|
|
|
|
guiHalt = false;
|
|
|
|
LWP_ResumeThread (guithread);
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* HaltGui
|
|
|
|
*
|
|
|
|
* Signals the GUI thread to stop, and waits for GUI thread to stop
|
|
|
|
* This is necessary whenever removing/inserting new elements into the GUI.
|
|
|
|
* This eliminates the possibility that the GUI is in the middle of accessing
|
|
|
|
* an element that is being changed.
|
|
|
|
***************************************************************************/
|
|
|
|
static void
|
|
|
|
HaltGui()
|
|
|
|
{
|
|
|
|
guiHalt = true;
|
|
|
|
|
|
|
|
// wait for thread to finish
|
|
|
|
while(!LWP_ThreadIsSuspended(guithread))
|
|
|
|
usleep(50);
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* WindowCredits
|
|
|
|
* Display credits
|
|
|
|
***************************************************************************/
|
|
|
|
static void WindowCredits(void * ptr)
|
|
|
|
{
|
|
|
|
int angle = 0;
|
2009-05-20 02:03:43 +02:00
|
|
|
GuiSound * creditsMusic = NULL;
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
if(btnLogo->GetState() != STATE_CLICKED) {
|
|
|
|
return;
|
|
|
|
}
|
2009-05-20 02:03:43 +02:00
|
|
|
s32 thetimeofbg = bgMusic->GetPlayTime();
|
|
|
|
StopOgg();
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-08 18:39:10 +02:00
|
|
|
creditsMusic = new GuiSound(credits_music_ogg, credits_music_ogg_size, SOUND_OGG, 55);
|
2009-05-07 22:51:35 +02:00
|
|
|
creditsMusic->SetVolume(55);
|
2009-05-03 22:30:17 +02:00
|
|
|
creditsMusic->SetLoop(1);
|
|
|
|
creditsMusic->Play();
|
|
|
|
|
|
|
|
btnLogo->ResetState();
|
|
|
|
|
|
|
|
bool exit = false;
|
|
|
|
int i = 0;
|
2009-05-10 20:20:39 +02:00
|
|
|
int y = 20;
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
GuiWindow creditsWindow(screenwidth,screenheight);
|
|
|
|
GuiWindow creditsWindowBox(580,448);
|
|
|
|
creditsWindowBox.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
|
|
|
|
GuiImageData creditsBox(credits_bg_png);
|
|
|
|
GuiImage creditsBoxImg(&creditsBox);
|
|
|
|
creditsBoxImg.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
creditsWindowBox.Append(&creditsBoxImg);
|
|
|
|
|
|
|
|
GuiImageData star(little_star_png);
|
|
|
|
GuiImage starImg(&star);
|
|
|
|
starImg.SetWidescreen(CFG.widescreen); //added
|
|
|
|
starImg.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
2009-05-20 22:09:57 +02:00
|
|
|
starImg.SetPosition(505,350);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-20 22:09:57 +02:00
|
|
|
int numEntries = 25;
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiText * txt[numEntries];
|
2009-05-11 23:19:00 +02:00
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
txt[i] = new GuiText(LANGUAGE.Credits, 26, (GXColor){255, 255, 255, 255});
|
2009-05-10 20:20:39 +02:00
|
|
|
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(0,12); i++;
|
2009-05-11 23:19:00 +02:00
|
|
|
|
2009-05-10 20:20:39 +02:00
|
|
|
txt[i] = new GuiText("V 1 .0", 18, (GXColor){255, 255, 255, 255});
|
|
|
|
txt[i]->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); txt[i]->SetPosition(0,y); i++; y+=34;
|
2009-05-11 23:19:00 +02:00
|
|
|
|
2009-05-10 20:20:39 +02:00
|
|
|
txt[i] = new GuiText("USB Loader GX", 24, (GXColor){255, 255, 255, 255});
|
|
|
|
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(0,y); i++; y+=26;
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
txt[i] = new GuiText(": http://code.google.com/p/usbloader-gui/", 20, (GXColor){255, 255, 255, 255});
|
|
|
|
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(50,y); i++; //y+=28;
|
2009-05-16 21:12:36 +02:00
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
txt[i] = new GuiText(LANGUAGE.OfficialSite, 20, (GXColor){255, 255, 255, 255});
|
|
|
|
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(-180,y); i++; y+=28;
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
txt[i]->SetPresets(22, (GXColor){255, 255, 255, 255}, 0,
|
|
|
|
FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP, ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
|
|
|
|
txt[i] = new GuiText("Coding:");
|
2009-05-10 20:20:39 +02:00
|
|
|
txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); txt[i]->SetPosition(170,y);
|
2009-05-03 22:30:17 +02:00
|
|
|
i++;
|
|
|
|
|
|
|
|
txt[i] = new GuiText("dimok");
|
|
|
|
txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); txt[i]->SetPosition(320,y);
|
|
|
|
i++;
|
|
|
|
y+=22;
|
|
|
|
|
|
|
|
txt[i] = new GuiText("nIxx");
|
|
|
|
txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); txt[i]->SetPosition(320,y);
|
|
|
|
i++;
|
|
|
|
y+=22;
|
|
|
|
|
|
|
|
txt[i] = new GuiText("hungyip84");
|
|
|
|
txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); txt[i]->SetPosition(320,y);
|
|
|
|
i++;
|
|
|
|
y+=22;
|
|
|
|
|
|
|
|
txt[i] = new GuiText("giantpune");
|
|
|
|
txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); txt[i]->SetPosition(320,y);
|
|
|
|
i++;
|
2009-05-20 22:09:57 +02:00
|
|
|
y+=22;
|
|
|
|
txt[i] = new GuiText("ardi");
|
|
|
|
txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); txt[i]->SetPosition(320,y);
|
|
|
|
i++;
|
2009-05-03 22:30:17 +02:00
|
|
|
y+=24;
|
|
|
|
|
|
|
|
txt[i] = new GuiText("Design:");
|
2009-05-10 20:20:39 +02:00
|
|
|
txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); txt[i]->SetPosition(170,y);
|
2009-05-03 22:30:17 +02:00
|
|
|
i++;
|
|
|
|
|
|
|
|
txt[i] = new GuiText("cyrex");
|
|
|
|
txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); txt[i]->SetPosition(320,y);
|
|
|
|
i++;
|
|
|
|
y+=22;
|
|
|
|
|
|
|
|
txt[i] = new GuiText("NeoRame");
|
|
|
|
txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); txt[i]->SetPosition(320,y);
|
|
|
|
i++;
|
|
|
|
y+=22;
|
|
|
|
|
|
|
|
txt[i] = new GuiText("WiiShizza");
|
|
|
|
txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); txt[i]->SetPosition(320,y);
|
|
|
|
i++;
|
2009-05-10 20:20:39 +02:00
|
|
|
y+=28;
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
txt[i] = new GuiText(LANGUAGE.Specialthanksto);
|
|
|
|
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(-50,y);
|
|
|
|
i++;
|
2009-05-16 21:12:36 +02:00
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
txt[i] = new GuiText(":");
|
|
|
|
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(30,y+3);
|
2009-05-03 22:30:17 +02:00
|
|
|
i++;
|
|
|
|
y+=22;
|
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
txt[i] = new GuiText("Fishears/Nuke Ocarina & WiiPower Vidpatch");
|
2009-05-10 20:20:39 +02:00
|
|
|
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(0,y);
|
2009-05-03 22:30:17 +02:00
|
|
|
i++;
|
2009-05-17 10:40:47 +02:00
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
txt[i] = new GuiText(LANGUAGE.For);
|
|
|
|
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(-80,y);
|
2009-05-22 01:12:00 +02:00
|
|
|
txt[i]->SetPosition(-80, y);
|
2009-05-16 17:38:52 +02:00
|
|
|
i++;
|
|
|
|
txt[i] = new GuiText(LANGUAGE.For);
|
|
|
|
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(130,y);
|
2009-05-22 01:12:00 +02:00
|
|
|
txt[i]->SetPosition(130, y);
|
2009-05-16 17:38:52 +02:00
|
|
|
i++;
|
2009-05-16 21:12:36 +02:00
|
|
|
|
2009-05-10 20:20:39 +02:00
|
|
|
y+=22;
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
txt[i] = new GuiText("Tantric libwiigui");
|
2009-05-03 22:30:17 +02:00
|
|
|
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(0,y);
|
2009-05-03 20:53:31 +02:00
|
|
|
i++;
|
2009-05-16 17:38:52 +02:00
|
|
|
txt[i] = new GuiText(LANGUAGE.For);
|
2009-05-17 06:02:52 +02:00
|
|
|
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); //txt[i]->SetPosition(-3,y);
|
2009-05-22 01:12:00 +02:00
|
|
|
txt[i]->SetPosition(-3, y);
|
2009-05-16 17:38:52 +02:00
|
|
|
i++;
|
2009-05-03 22:30:17 +02:00
|
|
|
y+=22;
|
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
txt[i] = new GuiText("Waninkoko & Kwiirk USB Loader");
|
2009-05-03 22:30:17 +02:00
|
|
|
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(0,y);
|
|
|
|
i++;
|
2009-05-16 17:38:52 +02:00
|
|
|
txt[i] = new GuiText(LANGUAGE.For);
|
|
|
|
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(30,y);
|
2009-05-22 01:12:00 +02:00
|
|
|
txt[i]->SetPosition(30, y);
|
2009-05-16 17:38:52 +02:00
|
|
|
i++;
|
2009-05-03 22:30:17 +02:00
|
|
|
y+=22;
|
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
txt[i] = new GuiText(LANGUAGE.theUSBLoaderandreleasingthesourcecode);
|
2009-05-03 22:30:17 +02:00
|
|
|
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(0,y);
|
|
|
|
i++;
|
|
|
|
y+=22;
|
|
|
|
|
|
|
|
for(i=0; i < numEntries; i++)
|
|
|
|
creditsWindowBox.Append(txt[i]);
|
|
|
|
|
|
|
|
|
|
|
|
creditsWindow.Append(&creditsWindowBox);
|
|
|
|
creditsWindow.Append(&starImg);
|
|
|
|
|
|
|
|
while(!exit)
|
|
|
|
{
|
|
|
|
creditsWindow.Draw();
|
|
|
|
|
|
|
|
angle ++;
|
|
|
|
angle = int(angle) % 360;
|
|
|
|
usleep(12000);
|
|
|
|
starImg.SetAngle(angle);
|
|
|
|
|
|
|
|
for(i=3; i >= 0; i--)
|
|
|
|
{
|
|
|
|
#ifdef HW_RVL
|
|
|
|
if(userInput[i].wpad.ir.valid)
|
2009-05-20 22:09:57 +02:00
|
|
|
Menu_DrawImg(userInput[i].wpad.ir.x-48, userInput[i].wpad.ir.y-48, 200.0,
|
2009-05-03 22:30:17 +02:00
|
|
|
96, 96, pointer[i]->GetImage(), userInput[i].wpad.ir.angle, CFG.widescreen? 0.8 : 1, 1, 255);
|
|
|
|
if(Settings.rumble == RumbleOn){
|
|
|
|
DoRumble(i);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
Menu_Render();
|
|
|
|
|
|
|
|
for(i=0; i < 4; i++)
|
|
|
|
{
|
|
|
|
if(userInput[i].wpad.btns_d || userInput[i].pad.btns_d)
|
|
|
|
exit = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// clear buttons pressed
|
|
|
|
for(i=0; i < 4; i++)
|
|
|
|
{
|
|
|
|
userInput[i].wpad.btns_d = 0;
|
|
|
|
userInput[i].pad.btns_d = 0;
|
|
|
|
}
|
|
|
|
creditsMusic->Stop();
|
|
|
|
for(i=0; i < numEntries; i++)
|
|
|
|
delete txt[i];
|
|
|
|
|
|
|
|
delete creditsMusic;
|
2009-05-20 02:03:43 +02:00
|
|
|
|
|
|
|
if(!strcmp("", CFG.oggload_path) || !strcmp("notset", CFG.ogg_path)) {
|
|
|
|
bgMusic->Play();
|
|
|
|
} else {
|
|
|
|
bgMusic->PlayOggFile(CFG.ogg_path);
|
|
|
|
}
|
|
|
|
bgMusic->SetPlayTime(thetimeofbg);
|
|
|
|
SetVolumeOgg(255*(vol/100.0));
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* WindowPrompt
|
|
|
|
*
|
|
|
|
* Displays a prompt window to user, with information, an error message, or
|
2009-05-09 14:11:43 +02:00
|
|
|
* presenting a user with a choice of up to 4 Buttons.
|
|
|
|
*
|
|
|
|
* Give him 1 Titel, 1 Subtitel and 4 Buttons
|
|
|
|
* If titel/subtitle or one of the buttons is not needed give him a 0 on that
|
|
|
|
* place.
|
2009-05-03 22:30:17 +02:00
|
|
|
***************************************************************************/
|
|
|
|
int
|
2009-05-09 14:11:43 +02:00
|
|
|
WindowPrompt(const char *title, const char *msg, const char *btn1Label,
|
|
|
|
const char *btn2Label, const char *btn3Label,
|
|
|
|
const char *btn4Label)
|
2009-05-03 22:30:17 +02:00
|
|
|
{
|
|
|
|
int choice = -1;
|
|
|
|
|
|
|
|
GuiWindow promptWindow(472,320);
|
|
|
|
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
promptWindow.SetPosition(0, -10);
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol);
|
|
|
|
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, vol);
|
2009-05-18 11:33:23 +02:00
|
|
|
char imgPath[50];
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
|
|
|
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", CFG.theme_path);
|
|
|
|
GuiImageData dialogBox(imgPath, dialogue_box_png);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
GuiTrigger trigB;
|
|
|
|
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
//GuiImageData dialogBox(dialogue_box_png);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage dialogBoxImg(&dialogBox);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
|
|
|
dialogBoxImg.SetWidescreen(CFG.widescreen);}///////////
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText titleTxt(title, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(0,55);
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText msgTxt(msg, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
msgTxt.SetPosition(0,-40);
|
|
|
|
msgTxt.SetMaxWidth(430);
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText btn1Txt(btn1Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage btn1Img(&btnOutline);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
btn1Txt.SetWidescreen(CFG.widescreen);
|
2009-05-06 13:09:32 +02:00
|
|
|
btn1Img.SetWidescreen(CFG.widescreen);}///////////
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton btn1(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
btn1.SetLabel(&btn1Txt);
|
|
|
|
btn1.SetImage(&btn1Img);
|
|
|
|
btn1.SetSoundOver(&btnSoundOver);
|
|
|
|
btn1.SetSoundClick(&btnClick);
|
|
|
|
btn1.SetTrigger(&trigA);
|
|
|
|
btn1.SetState(STATE_SELECTED);
|
|
|
|
btn1.SetEffectGrow();
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText btn2Txt(btn2Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage btn2Img(&btnOutline);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
btn2Txt.SetWidescreen(CFG.widescreen);
|
2009-05-06 13:09:32 +02:00
|
|
|
btn2Img.SetWidescreen(CFG.widescreen);}///////////
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton btn2(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
btn2.SetLabel(&btn2Txt);
|
|
|
|
btn2.SetImage(&btn2Img);
|
|
|
|
btn2.SetSoundOver(&btnSoundOver);
|
|
|
|
btn2.SetSoundClick(&btnClick);
|
2009-05-09 14:11:43 +02:00
|
|
|
if(!btn3Label && !btn4Label)
|
2009-05-03 22:30:17 +02:00
|
|
|
btn2.SetTrigger(&trigB);
|
|
|
|
btn2.SetTrigger(&trigA);
|
|
|
|
btn2.SetEffectGrow();
|
2009-05-06 12:23:58 +02:00
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText btn3Txt(btn3Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage btn3Img(&btnOutline);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
btn3Txt.SetWidescreen(CFG.widescreen);
|
2009-05-06 13:09:32 +02:00
|
|
|
btn3Img.SetWidescreen(CFG.widescreen);}///////////
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton btn3(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
btn3.SetLabel(&btn3Txt);
|
|
|
|
btn3.SetImage(&btn3Img);
|
|
|
|
btn3.SetSoundOver(&btnSoundOver);
|
|
|
|
btn3.SetSoundClick(&btnClick);
|
2009-05-09 14:11:43 +02:00
|
|
|
if(!btn4Label)
|
2009-05-03 22:30:17 +02:00
|
|
|
btn3.SetTrigger(&trigB);
|
|
|
|
btn3.SetTrigger(&trigA);
|
|
|
|
btn3.SetEffectGrow();
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText btn4Txt(btn4Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage btn4Img(&btnOutline);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
btn4Txt.SetWidescreen(CFG.widescreen);
|
2009-05-06 13:09:32 +02:00
|
|
|
btn4Img.SetWidescreen(CFG.widescreen);}///////////
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton btn4(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
btn4.SetLabel(&btn4Txt);
|
|
|
|
btn4.SetImage(&btn4Img);
|
|
|
|
btn4.SetSoundOver(&btnSoundOver);
|
|
|
|
btn4.SetSoundClick(&btnClick);
|
2009-05-09 14:11:43 +02:00
|
|
|
if(btn4Label)
|
|
|
|
btn4.SetTrigger(&trigB);
|
2009-05-03 22:30:17 +02:00
|
|
|
btn4.SetTrigger(&trigA);
|
|
|
|
btn4.SetEffectGrow();
|
2009-05-06 12:23:58 +02:00
|
|
|
|
2009-05-06 13:09:32 +02:00
|
|
|
if ((Settings.wsprompt == yes) && (CFG.widescreen)){/////////////adjust buttons for widescreen
|
2009-05-09 14:11:43 +02:00
|
|
|
msgTxt.SetMaxWidth(330);
|
2009-05-20 22:09:57 +02:00
|
|
|
// btn1Txt.SetFontSize(20);
|
|
|
|
// btn2Txt.SetFontSize(20);
|
|
|
|
// btn3Txt.SetFontSize(20);
|
|
|
|
// btn4Txt.SetFontSize(20);
|
2009-05-09 14:11:43 +02:00
|
|
|
|
|
|
|
if(btn2Label && !btn3Label && !btn4Label)
|
|
|
|
{
|
|
|
|
btn1.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn1.SetPosition(70, -80);
|
|
|
|
btn2.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
btn2.SetPosition(-70, -80);
|
|
|
|
btn3.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
btn3.SetPosition(-70, -55);
|
|
|
|
btn4.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn4.SetPosition(70, -55);
|
|
|
|
} else if(btn2Label && btn3Label && !btn4Label) {
|
|
|
|
btn1.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn1.SetPosition(70, -120);
|
|
|
|
btn2.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
btn2.SetPosition(-70, -120);
|
|
|
|
btn3.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
|
|
|
btn3.SetPosition(0, -55);
|
|
|
|
btn4.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn4.SetPosition(70, -55);
|
|
|
|
} else if(btn2Label && btn3Label && btn4Label) {
|
|
|
|
btn1.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn1.SetPosition(70, -120);
|
|
|
|
btn2.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
btn2.SetPosition(-70, -120);
|
|
|
|
btn3.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn3.SetPosition(70, -55);
|
|
|
|
btn4.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
btn4.SetPosition(-70, -55);
|
|
|
|
} else if(!btn2Label && btn3Label && btn4Label) {
|
|
|
|
btn1.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
|
|
|
btn1.SetPosition(0, -120);
|
|
|
|
btn2.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
btn2.SetPosition(-70, -120);
|
|
|
|
btn3.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn3.SetPosition(70, -55);
|
|
|
|
btn4.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
btn4.SetPosition(-70, -55);
|
|
|
|
} else {
|
|
|
|
btn1.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
|
|
|
btn1.SetPosition(0, -80);
|
|
|
|
btn2.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn2.SetPosition(70, -120);
|
|
|
|
btn3.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
btn3.SetPosition(-70, -55);
|
|
|
|
btn4.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn4.SetPosition(70, -55);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if(btn2Label && !btn3Label && !btn4Label) {
|
|
|
|
btn1.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn1.SetPosition(40, -45);
|
|
|
|
btn2.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
btn2.SetPosition(-40, -45);
|
|
|
|
btn3.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn3.SetPosition(50, -65);
|
|
|
|
btn4.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
btn4.SetPosition(-50, -65);
|
|
|
|
} else if(btn2Label && btn3Label && !btn4Label) {
|
|
|
|
btn1.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn1.SetPosition(50, -120);
|
|
|
|
btn2.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
btn2.SetPosition(-50, -120);
|
|
|
|
btn3.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
|
|
|
btn3.SetPosition(0, -65);
|
|
|
|
btn4.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
btn4.SetPosition(-50, -65);
|
|
|
|
} else if(btn2Label && btn3Label && btn4Label) {
|
|
|
|
btn1.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn1.SetPosition(50, -120);
|
|
|
|
btn2.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
btn2.SetPosition(-50, -120);
|
|
|
|
btn3.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn3.SetPosition(50, -65);
|
|
|
|
btn4.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
btn4.SetPosition(-50, -65);
|
|
|
|
} else if(!btn2Label && btn3Label && btn4Label) {
|
|
|
|
btn1.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
|
|
|
btn1.SetPosition(0, -120);
|
|
|
|
btn2.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
btn2.SetPosition(-50, -120);
|
|
|
|
btn3.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn3.SetPosition(50, -65);
|
|
|
|
btn4.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
btn4.SetPosition(-50, -65);
|
|
|
|
} else {
|
|
|
|
btn1.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
|
|
|
btn1.SetPosition(0, -45);
|
|
|
|
btn2.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn2.SetPosition(50, -120);
|
|
|
|
btn3.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn3.SetPosition(50, -65);
|
|
|
|
btn4.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
btn4.SetPosition(-50, -65);
|
|
|
|
}
|
|
|
|
|
2009-05-06 12:01:15 +02:00
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
promptWindow.Append(&dialogBoxImg);
|
|
|
|
promptWindow.Append(&titleTxt);
|
2009-05-09 14:11:43 +02:00
|
|
|
promptWindow.Append(&msgTxt);
|
|
|
|
|
|
|
|
if(btn1Label)
|
2009-05-03 22:30:17 +02:00
|
|
|
promptWindow.Append(&btn1);
|
2009-05-09 14:11:43 +02:00
|
|
|
if(btn2Label)
|
|
|
|
promptWindow.Append(&btn2);
|
|
|
|
if(btn3Label)
|
|
|
|
promptWindow.Append(&btn3);
|
|
|
|
if(btn4Label)
|
|
|
|
promptWindow.Append(&btn4);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->SetState(STATE_DISABLED);
|
|
|
|
mainWindow->Append(&promptWindow);
|
|
|
|
mainWindow->ChangeFocus(&promptWindow);
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(choice == -1)
|
|
|
|
{
|
|
|
|
VIDEO_WaitVSync();
|
2009-05-09 14:11:43 +02:00
|
|
|
if(shutdown == 1)
|
|
|
|
{
|
|
|
|
wiilight(0);
|
|
|
|
Sys_Shutdown();
|
|
|
|
}
|
|
|
|
if(reset == 1)
|
|
|
|
Sys_Reboot();
|
2009-05-03 22:30:17 +02:00
|
|
|
if(btn1.GetState() == STATE_CLICKED) {
|
2009-05-09 14:11:43 +02:00
|
|
|
choice = 1;
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
else if(btn2.GetState() == STATE_CLICKED) {
|
2009-05-09 14:11:43 +02:00
|
|
|
if(!btn3Label)
|
|
|
|
choice = 0;
|
|
|
|
else
|
|
|
|
choice = 2;
|
|
|
|
}
|
|
|
|
else if(btn3.GetState() == STATE_CLICKED) {
|
|
|
|
if(!btn4Label)
|
|
|
|
choice = 0;
|
|
|
|
else
|
|
|
|
choice = 3;
|
|
|
|
}
|
|
|
|
else if(btn4.GetState() == STATE_CLICKED) {
|
|
|
|
choice = 0;
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
|
|
|
while(promptWindow.GetEffect() > 0) usleep(50);
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&promptWindow);
|
|
|
|
mainWindow->SetState(STATE_DEFAULT);
|
|
|
|
ResumeGui();
|
|
|
|
return choice;
|
|
|
|
}
|
|
|
|
|
2009-05-18 14:09:37 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* WindowExitPrompt
|
|
|
|
*
|
|
|
|
* Displays a prompt window to user, with information, an error message, or
|
|
|
|
* presenting a user with a choice of up to 4 Buttons.
|
|
|
|
*
|
|
|
|
* Give him 1 Titel, 1 Subtitel and 4 Buttons
|
|
|
|
* If titel/subtitle or one of the buttons is not needed give him a 0 on that
|
|
|
|
* place.
|
|
|
|
***************************************************************************/
|
|
|
|
int
|
|
|
|
WindowExitPrompt(const char *title, const char *msg, const char *btn1Label,
|
|
|
|
const char *btn2Label, const char *btn3Label,
|
|
|
|
const char *btn4Label)
|
|
|
|
{
|
2009-05-18 22:00:29 +02:00
|
|
|
GuiSound * homein = NULL;
|
|
|
|
homein = new GuiSound(menuin_ogg, menuin_ogg_size, SOUND_OGG, vol);
|
|
|
|
homein->SetVolume(vol);
|
|
|
|
homein->SetLoop(0);
|
|
|
|
homein->Play();
|
|
|
|
|
|
|
|
GuiSound * homeout = NULL;
|
|
|
|
homeout = new GuiSound(menuout_ogg, menuout_ogg_size, SOUND_OGG, vol);
|
|
|
|
homeout->SetVolume(vol);
|
|
|
|
homeout->SetLoop(0);
|
|
|
|
|
|
|
|
int choice = -1;
|
2009-05-18 14:09:37 +02:00
|
|
|
char imgPath[100];
|
|
|
|
GuiWindow promptWindow(640,480);
|
2009-05-18 22:00:29 +02:00
|
|
|
promptWindow.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
2009-05-18 14:09:37 +02:00
|
|
|
promptWindow.SetPosition(0, 0);
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol);
|
|
|
|
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, vol);
|
2009-05-18 22:00:29 +02:00
|
|
|
|
2009-05-18 14:09:37 +02:00
|
|
|
GuiImageData top(exit_top_png);
|
|
|
|
GuiImageData topOver(exit_top_over_png);
|
|
|
|
GuiImageData bottom(exit_bottom_png);
|
|
|
|
GuiImageData bottomOver(exit_bottom_over_png);
|
|
|
|
GuiImageData button(exit_button_png);
|
2009-05-19 13:39:37 +02:00
|
|
|
GuiImageData wiimote(wiimote_png);
|
2009-05-19 20:12:35 +02:00
|
|
|
GuiImageData close(closebutton_png);
|
2009-05-18 22:00:29 +02:00
|
|
|
|
2009-05-18 14:09:37 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbattery_white.png", CFG.theme_path);
|
|
|
|
GuiImageData battery(imgPath, battery_white_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbattery_red.png", CFG.theme_path);
|
|
|
|
GuiImageData batteryRed(imgPath, battery_red_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbattery_bar_white.png", CFG.theme_path);
|
|
|
|
GuiImageData batteryBar(imgPath, battery_bar_white_png);
|
|
|
|
|
|
|
|
#ifdef HW_RVL
|
2009-05-18 22:00:29 +02:00
|
|
|
int i = 0, ret = 0, level;
|
2009-05-18 14:09:37 +02:00
|
|
|
char txt[3];
|
|
|
|
GuiText * batteryTxt[4];
|
|
|
|
GuiImage * batteryImg[4];
|
|
|
|
GuiImage * batteryBarImg[4];
|
|
|
|
GuiButton * batteryBtn[4];
|
|
|
|
|
|
|
|
for(i=0; i < 4; i++)
|
|
|
|
{
|
|
|
|
|
|
|
|
if(i == 0)
|
|
|
|
sprintf(txt, "P%d", i+1);
|
|
|
|
else
|
|
|
|
sprintf(txt, "P%d", i+1);
|
|
|
|
|
|
|
|
batteryTxt[i] = new GuiText(txt, 22, (GXColor){255,255,255, 255});
|
|
|
|
batteryTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
batteryImg[i] = new GuiImage(&battery);
|
|
|
|
batteryImg[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
batteryImg[i]->SetPosition(36, 0);
|
|
|
|
batteryImg[i]->SetTile(0);
|
|
|
|
batteryBarImg[i] = new GuiImage(&batteryBar);
|
|
|
|
batteryBarImg[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
batteryBarImg[i]->SetPosition(33, 0);
|
|
|
|
|
|
|
|
batteryBtn[i] = new GuiButton(40, 20);
|
|
|
|
batteryBtn[i]->SetLabel(batteryTxt[i]);
|
|
|
|
batteryBtn[i]->SetImage(batteryBarImg[i]);
|
|
|
|
batteryBtn[i]->SetIcon(batteryImg[i]);
|
|
|
|
batteryBtn[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
batteryBtn[i]->SetRumble(false);
|
|
|
|
batteryBtn[i]->SetAlpha(70);
|
|
|
|
batteryBtn[i]->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN, 50);
|
|
|
|
}
|
|
|
|
|
|
|
|
batteryBtn[0]->SetPosition(180,150);
|
|
|
|
batteryBtn[1]->SetPosition(284, 150);
|
|
|
|
batteryBtn[2]->SetPosition(388, 150);
|
|
|
|
batteryBtn[3]->SetPosition(494, 150);
|
2009-05-18 22:00:29 +02:00
|
|
|
#endif
|
2009-05-18 14:09:37 +02:00
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
GuiTrigger trigB;
|
|
|
|
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
|
|
|
GuiTrigger trigHome;
|
|
|
|
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
|
|
|
|
|
2009-05-21 20:13:37 +02:00
|
|
|
GuiText titleTxt(LANGUAGE.Homemenu, 36, (GXColor){255, 255, 255, 255});
|
2009-05-19 20:12:35 +02:00
|
|
|
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(-180,40);
|
2009-05-18 22:00:29 +02:00
|
|
|
titleTxt.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
|
2009-05-18 14:09:37 +02:00
|
|
|
|
2009-05-21 20:13:37 +02:00
|
|
|
GuiText closeTxt(LANGUAGE.Close, 28, (GXColor){0, 0, 0, 255});
|
2009-05-19 20:12:35 +02:00
|
|
|
GuiImage closeImg(&close);
|
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
closeTxt.SetWidescreen(CFG.widescreen);
|
2009-05-19 20:12:35 +02:00
|
|
|
closeImg.SetWidescreen(CFG.widescreen);}///////////
|
|
|
|
GuiButton closeBtn(close.GetWidth(), close.GetHeight());
|
|
|
|
closeBtn.SetImage(&closeImg);
|
|
|
|
closeBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
2009-05-21 20:26:01 +02:00
|
|
|
closeBtn.SetPosition(205,40);
|
2009-05-20 22:09:57 +02:00
|
|
|
closeBtn.SetLabel(&closeTxt);
|
2009-05-19 20:12:35 +02:00
|
|
|
closeBtn.SetRumble(false);
|
|
|
|
closeBtn.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
|
2009-05-20 02:03:43 +02:00
|
|
|
|
2009-05-18 14:09:37 +02:00
|
|
|
GuiImage btn1Img(&top);
|
|
|
|
GuiImage btn1OverImg(&topOver);
|
|
|
|
GuiButton btn1(top.GetWidth(), top.GetHeight());
|
|
|
|
btn1.SetImage(&btn1Img);
|
|
|
|
btn1.SetImageOver(&btn1OverImg);
|
|
|
|
btn1.SetSoundOver(&btnSoundOver);
|
|
|
|
btn1.SetTrigger(&trigA);
|
|
|
|
btn1.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
btn1.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
|
|
|
|
btn1.SetPosition(0, 0);
|
|
|
|
|
2009-05-20 22:09:57 +02:00
|
|
|
GuiText btn2Txt(btn1Label, 34, (GXColor){0, 0, 0, 255});
|
2009-05-18 14:09:37 +02:00
|
|
|
GuiImage btn2Img(&button);
|
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
btn2Txt.SetWidescreen(CFG.widescreen);
|
2009-05-18 14:09:37 +02:00
|
|
|
btn2Img.SetWidescreen(CFG.widescreen);}///////////
|
|
|
|
GuiButton btn2(button.GetWidth(), button.GetHeight());
|
|
|
|
btn2.SetLabel(&btn2Txt);
|
|
|
|
btn2.SetImage(&btn2Img);
|
|
|
|
btn2.SetSoundOver(&btnSoundOver);
|
|
|
|
btn2.SetSoundClick(&btnClick);
|
|
|
|
btn2.SetTrigger(&trigA);
|
|
|
|
btn2.SetEffectGrow();
|
|
|
|
btn2.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
btn2.SetPosition(-150, 0);
|
2009-05-18 22:00:29 +02:00
|
|
|
btn2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 50);
|
|
|
|
btn2.SetRumble(false);
|
2009-05-18 14:09:37 +02:00
|
|
|
|
2009-05-20 22:09:57 +02:00
|
|
|
GuiText btn3Txt(btn2Label, 34, (GXColor){0, 0, 0, 255});
|
2009-05-18 14:09:37 +02:00
|
|
|
GuiImage btn3Img(&button);
|
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
btn3Txt.SetWidescreen(CFG.widescreen);
|
2009-05-18 14:09:37 +02:00
|
|
|
btn3Img.SetWidescreen(CFG.widescreen);}///////////
|
|
|
|
GuiButton btn3(button.GetWidth(), button.GetHeight());
|
|
|
|
btn3.SetLabel(&btn3Txt);
|
|
|
|
btn3.SetImage(&btn3Img);
|
|
|
|
btn3.SetSoundOver(&btnSoundOver);
|
|
|
|
btn3.SetSoundClick(&btnClick);
|
|
|
|
btn3.SetTrigger(&trigA);
|
|
|
|
btn3.SetEffectGrow();
|
|
|
|
btn3.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
btn3.SetPosition(150, 0);
|
2009-05-18 22:00:29 +02:00
|
|
|
btn3.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 50);
|
|
|
|
btn3.SetRumble(false);
|
2009-05-18 14:09:37 +02:00
|
|
|
|
|
|
|
GuiImage btn4Img(&bottom);
|
|
|
|
GuiImage btn4OverImg(&bottomOver);
|
|
|
|
GuiButton btn4(bottom.GetWidth(), bottom.GetHeight());
|
|
|
|
btn4.SetImage(&btn4Img);
|
|
|
|
btn4.SetImageOver(&btn4OverImg);
|
|
|
|
btn4.SetSoundOver(&btnSoundOver);
|
|
|
|
btn4.SetTrigger(&trigA);
|
2009-05-18 22:00:29 +02:00
|
|
|
btn4.SetTrigger(&trigB);
|
|
|
|
btn4.SetTrigger(&trigHome);
|
2009-05-18 14:09:37 +02:00
|
|
|
btn4.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
2009-05-18 22:00:29 +02:00
|
|
|
btn4.SetPosition(0,0);
|
2009-05-18 14:09:37 +02:00
|
|
|
btn4.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN, 50);
|
|
|
|
|
2009-05-20 22:09:57 +02:00
|
|
|
// btn2Txt.SetFontSize(22);
|
|
|
|
// btn3Txt.SetFontSize(22);
|
2009-05-20 02:03:43 +02:00
|
|
|
|
2009-05-19 13:39:37 +02:00
|
|
|
GuiImage wiimoteImg(&wiimote);
|
|
|
|
if (Settings.wsprompt == yes){wiimoteImg.SetWidescreen(CFG.widescreen);}
|
|
|
|
wiimoteImg.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
wiimoteImg.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN, 50);
|
|
|
|
wiimoteImg.SetPosition(50,210);
|
2009-05-18 14:09:37 +02:00
|
|
|
|
|
|
|
promptWindow.Append(&btn2);
|
|
|
|
promptWindow.Append(&btn3);
|
|
|
|
promptWindow.Append(&btn4);
|
2009-05-18 22:00:29 +02:00
|
|
|
promptWindow.Append(&btn1);
|
2009-05-19 20:12:35 +02:00
|
|
|
promptWindow.Append(&closeBtn);
|
2009-05-18 14:09:37 +02:00
|
|
|
promptWindow.Append(&titleTxt);
|
2009-05-19 13:39:37 +02:00
|
|
|
promptWindow.Append(&wiimoteImg);
|
2009-05-18 22:00:29 +02:00
|
|
|
|
2009-05-18 14:09:37 +02:00
|
|
|
#ifdef HW_RVL
|
|
|
|
promptWindow.Append(batteryBtn[0]);
|
2009-05-18 22:00:29 +02:00
|
|
|
promptWindow.Append(batteryBtn[1]);
|
|
|
|
promptWindow.Append(batteryBtn[2]);
|
|
|
|
promptWindow.Append(batteryBtn[3]);
|
|
|
|
#endif
|
2009-05-18 14:09:37 +02:00
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->SetState(STATE_DISABLED);
|
|
|
|
mainWindow->Append(&promptWindow);
|
|
|
|
mainWindow->ChangeFocus(&promptWindow);
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(choice == -1)
|
|
|
|
{
|
|
|
|
VIDEO_WaitVSync();
|
2009-05-18 22:00:29 +02:00
|
|
|
|
2009-05-18 14:09:37 +02:00
|
|
|
#ifdef HW_RVL
|
|
|
|
for(i=0; i < 4; i++)
|
|
|
|
{
|
|
|
|
if(WPAD_Probe(i, NULL) == WPAD_ERR_NONE) // controller connected
|
|
|
|
{
|
|
|
|
level = (userInput[i].wpad.battery_level / 100.0) * 4;
|
|
|
|
if(level > 4) level = 4;
|
|
|
|
batteryImg[i]->SetTile(level);
|
|
|
|
|
|
|
|
if(level == 0)
|
|
|
|
batteryBarImg[i]->SetImage(&batteryRed);
|
|
|
|
else
|
|
|
|
batteryBarImg[i]->SetImage(&batteryBar);
|
|
|
|
|
|
|
|
batteryBtn[i]->SetAlpha(255);
|
|
|
|
}
|
|
|
|
else // controller not connected
|
|
|
|
{
|
|
|
|
batteryImg[i]->SetTile(0);
|
|
|
|
batteryImg[i]->SetImage(&battery);
|
|
|
|
batteryBtn[i]->SetAlpha(70);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2009-05-18 22:00:29 +02:00
|
|
|
|
|
|
|
|
2009-05-18 14:09:37 +02:00
|
|
|
if(shutdown == 1)
|
|
|
|
{
|
|
|
|
wiilight(0);
|
|
|
|
Sys_Shutdown();
|
|
|
|
}
|
|
|
|
if(reset == 1)
|
|
|
|
Sys_Reboot();
|
|
|
|
if(btn1.GetState() == STATE_CLICKED) {
|
|
|
|
choice = 1;
|
2009-05-19 20:12:35 +02:00
|
|
|
btn1.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
|
|
|
closeBtn.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
2009-05-18 22:00:29 +02:00
|
|
|
btn4.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 50);
|
|
|
|
btn2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
|
|
|
|
btn3.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 50);
|
|
|
|
titleTxt.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
2009-05-19 13:39:37 +02:00
|
|
|
wiimoteImg.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 50);
|
2009-05-18 22:00:29 +02:00
|
|
|
#ifdef HW_RVL
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
batteryBtn[i]->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 50);
|
|
|
|
#endif
|
2009-05-18 14:09:37 +02:00
|
|
|
}
|
2009-05-19 13:39:37 +02:00
|
|
|
else if(btn4.GetState() == STATE_SELECTED)
|
|
|
|
{
|
|
|
|
wiimoteImg.SetPosition(50,165);
|
|
|
|
}
|
2009-05-18 14:09:37 +02:00
|
|
|
else if(btn2.GetState() == STATE_CLICKED) {
|
2009-05-18 22:00:29 +02:00
|
|
|
ret = WindowPrompt(LANGUAGE.Areyousure, 0, LANGUAGE.Yes, LANGUAGE.No, 0, 0);
|
|
|
|
if (ret == 1) {
|
2009-05-18 14:09:37 +02:00
|
|
|
choice = 2;
|
2009-05-18 22:00:29 +02:00
|
|
|
}
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->SetState(STATE_DISABLED);
|
|
|
|
promptWindow.SetState(STATE_DEFAULT);
|
|
|
|
mainWindow->ChangeFocus(&promptWindow);
|
|
|
|
ResumeGui();
|
|
|
|
btn2.ResetState();
|
2009-05-18 14:09:37 +02:00
|
|
|
}
|
|
|
|
else if(btn3.GetState() == STATE_CLICKED) {
|
2009-05-18 22:00:29 +02:00
|
|
|
ret = WindowPrompt(LANGUAGE.Areyousure, 0, LANGUAGE.Yes, LANGUAGE.No, 0, 0);
|
|
|
|
if (ret == 1) {
|
2009-05-18 14:09:37 +02:00
|
|
|
choice = 3;
|
2009-05-18 22:00:29 +02:00
|
|
|
}
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->SetState(STATE_DISABLED);
|
|
|
|
promptWindow.SetState(STATE_DEFAULT);
|
|
|
|
mainWindow->ChangeFocus(&promptWindow);
|
|
|
|
ResumeGui();
|
|
|
|
btn3.ResetState();
|
2009-05-18 14:09:37 +02:00
|
|
|
}
|
|
|
|
else if(btn4.GetState() == STATE_CLICKED) {
|
2009-05-18 22:00:29 +02:00
|
|
|
btn1.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
2009-05-19 20:12:35 +02:00
|
|
|
closeBtn.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
2009-05-18 22:00:29 +02:00
|
|
|
btn4.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 50);
|
|
|
|
btn2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
|
|
|
|
btn3.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 50);
|
|
|
|
titleTxt.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
2009-05-19 13:39:37 +02:00
|
|
|
wiimoteImg.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 50);
|
2009-05-18 22:00:29 +02:00
|
|
|
#ifdef HW_RVL
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
batteryBtn[i]->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 50);
|
|
|
|
#endif
|
2009-05-18 14:09:37 +02:00
|
|
|
choice = 0;
|
|
|
|
}
|
2009-05-19 13:39:37 +02:00
|
|
|
else if(btn4.GetState() != STATE_SELECTED)
|
|
|
|
{
|
|
|
|
wiimoteImg.SetPosition(50,210);
|
|
|
|
}
|
2009-05-18 14:09:37 +02:00
|
|
|
}
|
2009-05-18 22:00:29 +02:00
|
|
|
homeout->Play();
|
|
|
|
while(btn1.GetEffect() > 0) usleep(50);
|
2009-05-18 14:09:37 +02:00
|
|
|
while(promptWindow.GetEffect() > 0) usleep(50);
|
|
|
|
HaltGui();
|
2009-05-18 22:00:29 +02:00
|
|
|
homein->Stop();
|
|
|
|
delete homein;
|
2009-05-18 14:09:37 +02:00
|
|
|
mainWindow->Remove(&promptWindow);
|
|
|
|
mainWindow->SetState(STATE_DEFAULT);
|
2009-05-18 22:00:29 +02:00
|
|
|
while(homeout->IsPlaying() > 0) usleep(50);
|
|
|
|
homeout->Stop();
|
|
|
|
delete homeout;
|
2009-05-18 14:09:37 +02:00
|
|
|
ResumeGui();
|
|
|
|
return choice;
|
|
|
|
}
|
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* GameWindowPrompt
|
|
|
|
*
|
|
|
|
* Displays a prompt window to user, with information, an error message, or
|
|
|
|
* presenting a user with a choice
|
|
|
|
***************************************************************************/
|
|
|
|
int GameWindowPrompt()
|
|
|
|
{
|
|
|
|
int choice = -1, angle = 0;
|
|
|
|
char sizeText[15];
|
|
|
|
f32 size = 0.0;
|
|
|
|
char ID[4];
|
|
|
|
char IDFull[7];
|
|
|
|
char gameName[CFG.maxcharacters + 4];
|
2009-05-21 10:56:23 +02:00
|
|
|
u8 faveChoice = 0;
|
|
|
|
u8 playCount = 0;
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
GuiWindow promptWindow(472,320);
|
|
|
|
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
promptWindow.SetPosition(0, -10);
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol);
|
|
|
|
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, vol);
|
2009-05-18 22:00:29 +02:00
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
char imgPath[100];
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
|
|
|
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
2009-05-21 10:56:23 +02:00
|
|
|
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sfavorite.png", CFG.theme_path);
|
|
|
|
GuiImageData imgFavorite(imgPath, favorite_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%snot_favorite.png", CFG.theme_path);
|
|
|
|
GuiImageData imgNotFavorite(imgPath, not_favorite_png);
|
2009-05-20 02:03:43 +02:00
|
|
|
|
2009-05-19 07:08:14 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_left.png", CFG.theme_path);
|
|
|
|
GuiImageData imgLeft(imgPath, startgame_arrow_left_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_right.png", CFG.theme_path);
|
|
|
|
GuiImageData imgRight(imgPath, startgame_arrow_right_png);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
GuiTrigger trigB;
|
|
|
|
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
|
|
|
GuiTrigger trigL;
|
|
|
|
trigL.SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT);
|
|
|
|
GuiTrigger trigR;
|
|
|
|
trigR.SetButtonOnlyTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT);
|
|
|
|
GuiTrigger trigPlus;
|
|
|
|
trigPlus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, 0);
|
|
|
|
GuiTrigger trigMinus;
|
|
|
|
trigMinus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, 0);
|
|
|
|
|
|
|
|
if (CFG.widescreen)
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%swdialogue_box_startgame.png", CFG.theme_path);
|
|
|
|
else
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box_startgame.png", CFG.theme_path);
|
|
|
|
|
|
|
|
GuiImageData dialogBox(imgPath, CFG.widescreen ? wdialogue_box_startgame_png : dialogue_box_startgame_png);
|
|
|
|
GuiImage dialogBoxImg(&dialogBox);
|
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
GuiTooltip nameBtnTT(LANGUAGE.RenameGameonWBFS);
|
2009-05-15 06:07:34 +02:00
|
|
|
if (Settings.wsprompt == yes)
|
|
|
|
nameBtnTT.SetWidescreen(CFG.widescreen);
|
2009-05-20 22:09:57 +02:00
|
|
|
GuiText nameTxt("", 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{50, 50, 50, 255});
|
|
|
|
if (Settings.wsprompt == yes)
|
|
|
|
nameTxt.SetWidescreen(CFG.widescreen);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton nameBtn(120,50);
|
2009-05-20 22:09:57 +02:00
|
|
|
nameBtn.SetLabel(&nameTxt);
|
|
|
|
// nameBtn.SetLabelOver(&nameTxt);
|
2009-05-03 22:30:17 +02:00
|
|
|
nameBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
nameBtn.SetPosition(0,-122);
|
|
|
|
nameBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
nameBtn.SetSoundClick(&btnClick);
|
2009-05-15 06:07:34 +02:00
|
|
|
nameBtn.SetToolTip(&nameBtnTT,24,-30, ALIGN_LEFT);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
if (CFG.godmode == 1){
|
|
|
|
nameBtn.SetTrigger(&trigA);
|
|
|
|
nameBtn.SetEffectGrow();
|
|
|
|
}
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText sizeTxt("", 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{50, 50, 50, 255}); //TODO: get the size here
|
2009-05-03 22:30:17 +02:00
|
|
|
sizeTxt.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
|
|
|
sizeTxt.SetPosition(-60,70);
|
|
|
|
|
2009-05-20 22:09:57 +02:00
|
|
|
// GuiImage diskImg;
|
|
|
|
GuiDiskCover diskImg;
|
2009-05-03 22:30:17 +02:00
|
|
|
diskImg.SetWidescreen(CFG.widescreen);
|
|
|
|
diskImg.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
diskImg.SetAngle(angle);
|
2009-05-20 22:09:57 +02:00
|
|
|
GuiDiskCover diskImg2;
|
|
|
|
diskImg2.SetWidescreen(CFG.widescreen);
|
|
|
|
diskImg2.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
diskImg2.SetPosition(0, -20);
|
|
|
|
diskImg2.SetAngle(angle);
|
2009-05-21 10:56:23 +02:00
|
|
|
diskImg2.SetBeta(180);
|
|
|
|
|
|
|
|
char PlayCnt[25] = "";
|
|
|
|
GuiText playcntTxt(PlayCnt, 18, (GXColor){THEME.info_r, THEME.info_g, THEME.info_b, 255});
|
|
|
|
playcntTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
playcntTxt.SetPosition(-115,45);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
GuiButton btn1(160, 160);
|
|
|
|
btn1.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
btn1.SetPosition(0, -20);
|
|
|
|
btn1.SetImage(&diskImg);
|
|
|
|
|
|
|
|
btn1.SetSoundOver(&btnSoundOver);
|
|
|
|
btn1.SetSoundClick(&btnClick);
|
|
|
|
btn1.SetTrigger(&trigA);
|
|
|
|
btn1.SetState(STATE_SELECTED);
|
|
|
|
//btn1.SetEffectGrow(); just commented it out if anybody wants to use it again.
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText btn2Txt(LANGUAGE.Back, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage btn2Img(&btnOutline);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
btn2Txt.SetWidescreen(CFG.widescreen);
|
2009-05-06 13:09:32 +02:00
|
|
|
btn2Img.SetWidescreen(CFG.widescreen);}///////////
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton btn2(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
//check if unlocked
|
|
|
|
if (CFG.godmode == 1)
|
|
|
|
{
|
2009-05-10 03:01:41 +02:00
|
|
|
btn2.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
btn2.SetPosition(-50, -40);
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
btn2.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
|
|
|
btn2.SetPosition(0, -40);
|
|
|
|
}
|
|
|
|
|
|
|
|
btn2.SetLabel(&btn2Txt);
|
|
|
|
btn2.SetImage(&btn2Img);
|
|
|
|
btn2.SetSoundOver(&btnSoundOver);
|
|
|
|
btn2.SetSoundClick(&btnClick);
|
|
|
|
btn2.SetTrigger(&trigB);
|
|
|
|
btn2.SetTrigger(&trigA);
|
|
|
|
btn2.SetEffectGrow();
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText btn3Txt(LANGUAGE.settings, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage btn3Img(&btnOutline);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
btn3Txt.SetWidescreen(CFG.widescreen);
|
2009-05-20 15:14:52 +02:00
|
|
|
btn3Img.SetWidescreen(CFG.widescreen);}
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton btn3(btnOutline.GetWidth(), btnOutline.GetHeight());
|
2009-05-10 03:01:41 +02:00
|
|
|
btn3.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn3.SetPosition(50, -40);
|
2009-05-03 22:30:17 +02:00
|
|
|
btn3.SetLabel(&btn3Txt);
|
|
|
|
btn3.SetImage(&btn3Img);
|
|
|
|
btn3.SetSoundOver(&btnSoundOver);
|
|
|
|
btn3.SetSoundClick(&btnClick);
|
|
|
|
btn3.SetTrigger(&trigA);
|
|
|
|
btn3.SetEffectGrow();
|
2009-05-21 10:56:23 +02:00
|
|
|
|
|
|
|
GuiImage btnFavoriteImg;
|
|
|
|
btnFavoriteImg.SetWidescreen(CFG.widescreen);
|
|
|
|
GuiButton btnFavorite(imgFavorite.GetWidth(), imgFavorite.GetHeight());
|
|
|
|
btnFavorite.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
btnFavorite.SetPosition(-125, -60);
|
|
|
|
btnFavorite.SetImage(&btnFavoriteImg);
|
|
|
|
btnFavorite.SetSoundOver(&btnSoundOver);
|
|
|
|
btnFavorite.SetSoundClick(&btnClick);
|
|
|
|
btnFavorite.SetTrigger(&trigA);
|
|
|
|
btnFavorite.SetEffectGrow();
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
GuiImage btnLeftImg(&imgLeft);
|
|
|
|
GuiButton btnLeft(imgLeft.GetWidth(), imgLeft.GetHeight());
|
|
|
|
btnLeft.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
btnLeft.SetPosition(20, 0);
|
|
|
|
btnLeft.SetImage(&btnLeftImg);
|
|
|
|
btnLeft.SetSoundOver(&btnSoundOver);
|
|
|
|
btnLeft.SetTrigger(&trigA);
|
|
|
|
btnLeft.SetTrigger(&trigL);
|
|
|
|
btnLeft.SetTrigger(&trigMinus);
|
|
|
|
btnLeft.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiImage btnRightImg(&imgRight);
|
|
|
|
GuiButton btnRight(imgRight.GetWidth(), imgRight.GetHeight());
|
|
|
|
btnRight.SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
|
|
|
|
btnRight.SetPosition(-20, 0);
|
|
|
|
btnRight.SetImage(&btnRightImg);
|
|
|
|
btnRight.SetSoundOver(&btnSoundOver);
|
|
|
|
btnRight.SetTrigger(&trigA);
|
|
|
|
btnRight.SetTrigger(&trigR);
|
|
|
|
btnRight.SetTrigger(&trigPlus);
|
|
|
|
btnRight.SetEffectGrow();
|
|
|
|
|
|
|
|
promptWindow.Append(&dialogBoxImg);
|
|
|
|
promptWindow.Append(&nameBtn);
|
2009-05-21 10:56:23 +02:00
|
|
|
promptWindow.Append(&sizeTxt);
|
|
|
|
promptWindow.Append(&playcntTxt);
|
2009-05-20 22:09:57 +02:00
|
|
|
// promptWindow.Append(&btn1); // move down at last apended
|
2009-05-03 22:30:17 +02:00
|
|
|
promptWindow.Append(&btn2);
|
|
|
|
promptWindow.Append(&btnLeft);
|
2009-05-21 10:56:23 +02:00
|
|
|
promptWindow.Append(&btnRight);
|
|
|
|
promptWindow.Append(&btnFavorite);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
//check if unlocked
|
|
|
|
if (CFG.godmode == 1)
|
|
|
|
{
|
|
|
|
promptWindow.Append(&btn3);
|
|
|
|
}
|
|
|
|
|
2009-05-20 22:09:57 +02:00
|
|
|
promptWindow.Append(&diskImg2);
|
|
|
|
promptWindow.Append(&btn1);
|
|
|
|
|
|
|
|
short changed = -1;
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImageData * diskCover = NULL;
|
2009-05-20 22:09:57 +02:00
|
|
|
GuiImageData * diskCover2 = NULL;
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
|
|
|
|
|
|
|
|
while (changed)
|
|
|
|
{
|
|
|
|
if (changed == 1){
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 50);
|
|
|
|
}
|
2009-05-20 22:09:57 +02:00
|
|
|
else if (changed == 2){
|
2009-05-03 22:30:17 +02:00
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 50);
|
|
|
|
}
|
2009-05-20 22:09:57 +02:00
|
|
|
else if (changed == 3 || changed == 4)
|
|
|
|
{
|
|
|
|
if(diskCover2)
|
|
|
|
delete diskCover2;
|
|
|
|
diskCover2 = NULL;
|
|
|
|
if(diskCover)
|
|
|
|
diskCover2 = diskCover;
|
|
|
|
diskCover = NULL;
|
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-20 22:09:57 +02:00
|
|
|
// changed = 0;
|
2009-05-04 05:45:45 +02:00
|
|
|
//load disc image based or what game is seleted
|
2009-05-03 22:30:17 +02:00
|
|
|
struct discHdr * header = &gameList[gameSelected];
|
|
|
|
WBFS_GameSize(header->id, &size);
|
|
|
|
|
|
|
|
snprintf(sizeText, sizeof(sizeText), "%.2fGB", size); //set size text
|
|
|
|
|
|
|
|
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
|
|
|
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]);
|
|
|
|
|
|
|
|
//set name
|
|
|
|
if (strlen(get_title(header)) < (u32)(CFG.maxcharacters + 3)) {
|
|
|
|
sprintf(gameName, "%s", get_title(header));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
strncpy(gameName, get_title(header), CFG.maxcharacters);
|
|
|
|
gameName[CFG.maxcharacters] = '\0';
|
|
|
|
strncat(gameName, "...", 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (diskCover)
|
|
|
|
delete diskCover;
|
|
|
|
|
2009-05-20 22:09:57 +02:00
|
|
|
snprintf(imgPath,sizeof(imgPath),"%s%s.png", CFG.disc_path, IDFull); //changed to current full id
|
2009-05-03 22:30:17 +02:00
|
|
|
diskCover = new GuiImageData(imgPath,0);
|
|
|
|
|
|
|
|
if (!diskCover->GetImage())
|
|
|
|
{
|
|
|
|
delete diskCover;
|
2009-05-20 22:09:57 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.disc_path, ID); //changed to current id
|
2009-05-03 22:30:17 +02:00
|
|
|
diskCover = new GuiImageData(imgPath, 0);
|
|
|
|
if (!diskCover->GetImage())
|
|
|
|
{
|
|
|
|
delete diskCover;
|
2009-05-20 22:09:57 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%snodisc.png", CFG.disc_path); //changed to nodisc.png
|
2009-05-03 22:30:17 +02:00
|
|
|
diskCover = new GuiImageData(imgPath,nodisc_png);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-20 22:09:57 +02:00
|
|
|
|
|
|
|
|
|
|
|
if (changed == 3){
|
2009-05-20 23:58:59 +02:00
|
|
|
diskImg.SetImage(diskCover2);
|
|
|
|
diskImg.SetBeta(0);
|
2009-05-20 22:09:57 +02:00
|
|
|
diskImg.SetBetaRotateEffect(-90, 15);
|
2009-05-20 23:58:59 +02:00
|
|
|
diskImg2.SetImage(diskCover);
|
2009-05-20 22:09:57 +02:00
|
|
|
diskImg2.SetAngle(diskImg.GetAngle());
|
2009-05-20 23:58:59 +02:00
|
|
|
diskImg2.SetBeta(180);
|
2009-05-20 22:09:57 +02:00
|
|
|
diskImg2.SetBetaRotateEffect(-90, 15);
|
|
|
|
sizeTxt.SetEffect(EFFECT_FADE, -17);
|
|
|
|
nameTxt.SetEffect(EFFECT_FADE, -17);
|
|
|
|
ResumeGui();
|
|
|
|
while(nameTxt.GetEffect() > 0 || diskImg.GetBetaRotateEffect()) usleep(50);
|
|
|
|
HaltGui();
|
2009-05-20 23:58:59 +02:00
|
|
|
diskImg.SetImage(diskCover);
|
|
|
|
diskImg.SetBeta(90);
|
2009-05-20 22:09:57 +02:00
|
|
|
diskImg.SetBetaRotateEffect(-90, 15);
|
2009-05-20 23:58:59 +02:00
|
|
|
diskImg2.SetImage(diskCover2);
|
|
|
|
diskImg2.SetBeta(270);
|
2009-05-20 22:09:57 +02:00
|
|
|
diskImg2.SetBetaRotateEffect(-90, 15);
|
|
|
|
sizeTxt.SetEffect(EFFECT_FADE, 17);
|
|
|
|
nameTxt.SetEffect(EFFECT_FADE, 17);
|
|
|
|
}
|
|
|
|
else if (changed == 4){
|
2009-05-20 23:58:59 +02:00
|
|
|
diskImg.SetImage(diskCover2);
|
|
|
|
diskImg.SetBeta(0);
|
2009-05-20 22:09:57 +02:00
|
|
|
diskImg.SetBetaRotateEffect(90, 15);
|
2009-05-20 23:58:59 +02:00
|
|
|
diskImg2.SetImage(diskCover);
|
2009-05-20 22:09:57 +02:00
|
|
|
diskImg2.SetAngle(diskImg.GetAngle());
|
2009-05-20 23:58:59 +02:00
|
|
|
diskImg2.SetBeta(180);
|
2009-05-20 22:09:57 +02:00
|
|
|
diskImg2.SetBetaRotateEffect(90, 15);
|
|
|
|
sizeTxt.SetEffect(EFFECT_FADE, -17);
|
|
|
|
nameTxt.SetEffect(EFFECT_FADE, -17);
|
|
|
|
ResumeGui();
|
|
|
|
while(nameTxt.GetEffect() > 0 || diskImg.GetBetaRotateEffect()) usleep(50);
|
|
|
|
HaltGui();
|
2009-05-20 23:58:59 +02:00
|
|
|
diskImg.SetImage(diskCover);
|
|
|
|
diskImg.SetBeta(270);
|
2009-05-20 22:09:57 +02:00
|
|
|
diskImg.SetBetaRotateEffect(90, 15);
|
2009-05-20 23:58:59 +02:00
|
|
|
diskImg2.SetImage(diskCover2);
|
|
|
|
diskImg2.SetBeta(90);
|
2009-05-20 22:09:57 +02:00
|
|
|
diskImg2.SetBetaRotateEffect(90, 15);
|
|
|
|
sizeTxt.SetEffect(EFFECT_FADE, 17);
|
|
|
|
nameTxt.SetEffect(EFFECT_FADE, 17);
|
|
|
|
}
|
2009-05-20 23:58:59 +02:00
|
|
|
else
|
|
|
|
diskImg.SetImage(diskCover);
|
2009-05-03 22:30:17 +02:00
|
|
|
sizeTxt.SetText(sizeText);
|
2009-05-20 22:09:57 +02:00
|
|
|
nameTxt.SetText(gameName);
|
2009-05-21 10:56:23 +02:00
|
|
|
|
|
|
|
struct Game_NUM* game_num = CFG_get_game_num(header->id);
|
|
|
|
if (game_num) {
|
|
|
|
playCount = game_num->count;
|
|
|
|
faveChoice = game_num->favorite;
|
|
|
|
} else {
|
|
|
|
playCount = 0;
|
|
|
|
faveChoice = 0;
|
|
|
|
}
|
|
|
|
sprintf(PlayCnt,"%s: %i",LANGUAGE.Plays, playCount);
|
|
|
|
playcntTxt.SetText(PlayCnt);
|
|
|
|
btnFavoriteImg.SetImage(faveChoice ? &imgFavorite : &imgNotFavorite);
|
|
|
|
|
2009-05-22 01:12:00 +02:00
|
|
|
nameTxt.SetPosition(0, 1);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-20 22:09:57 +02:00
|
|
|
if(changed != 3 && changed != 4) // changed==3 or changed==4 --> only Resume the GUI
|
|
|
|
{
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->SetState(STATE_DISABLED);
|
|
|
|
mainWindow->Append(&promptWindow);
|
|
|
|
mainWindow->ChangeFocus(&promptWindow);
|
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
ResumeGui();
|
|
|
|
|
2009-05-20 22:09:57 +02:00
|
|
|
changed = 0;
|
2009-05-03 22:30:17 +02:00
|
|
|
while(choice == -1)
|
|
|
|
{
|
2009-05-20 22:09:57 +02:00
|
|
|
diskImg.SetSpin(btn1.GetState() == STATE_SELECTED);
|
|
|
|
diskImg2.SetSpin(btn1.GetState() == STATE_SELECTED);
|
2009-05-03 22:30:17 +02:00
|
|
|
if(shutdown == 1) //for power button
|
|
|
|
{
|
|
|
|
wiilight(0);
|
|
|
|
Sys_Shutdown();
|
|
|
|
}
|
2009-05-20 22:09:57 +02:00
|
|
|
if(reset == 1) //for reset button
|
2009-05-03 22:30:17 +02:00
|
|
|
Sys_Reboot();
|
|
|
|
|
|
|
|
if(btn1.GetState() == STATE_CLICKED) { //boot
|
2009-05-21 00:30:47 +02:00
|
|
|
//////////save game play count////////////////
|
|
|
|
extern u8 favorite;
|
|
|
|
extern u8 count;
|
|
|
|
struct Game_NUM* game_num = CFG_get_game_num(header->id);
|
|
|
|
if (game_num)
|
|
|
|
{
|
|
|
|
favorite = game_num->favorite;
|
|
|
|
count = game_num->count;//count+=1;
|
|
|
|
}count+=1;
|
|
|
|
if(isSdInserted() == 1) {
|
|
|
|
if (CFG_save_game_num(header->id))
|
|
|
|
{
|
|
|
|
//WindowPrompt(LANGUAGE.SuccessfullySaved, 0, LANGUAGE.ok, 0,0,0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//WindowPrompt(LANGUAGE.SaveFailed, 0, LANGUAGE.ok, 0,0,0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
////////////end save play count//////////////
|
2009-05-21 20:13:37 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
choice = 1;
|
2009-05-15 22:03:19 +02:00
|
|
|
SDCard_deInit();
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
else if(btn2.GetState() == STATE_CLICKED) { //back
|
|
|
|
choice = 0;
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
|
|
|
mainWindow->SetState(STATE_DEFAULT);
|
|
|
|
wiilight(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(btn3.GetState() == STATE_CLICKED) { //settings
|
|
|
|
choice = 2;
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(nameBtn.GetState() == STATE_CLICKED) { //rename
|
|
|
|
choice = 3;
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
|
|
|
}
|
2009-05-21 10:56:23 +02:00
|
|
|
|
|
|
|
else if(btnFavorite.GetState() == STATE_CLICKED){//switch favorite
|
|
|
|
if(isSdInserted() == 1) {
|
|
|
|
faveChoice = !faveChoice;
|
|
|
|
btnFavoriteImg.SetImage(faveChoice ? &imgFavorite : &imgNotFavorite);
|
|
|
|
extern u8 favorite;
|
|
|
|
struct Game_NUM* game_num = CFG_get_game_num(header->id);
|
|
|
|
if (game_num) {
|
|
|
|
favorite = game_num->favorite;
|
|
|
|
}
|
|
|
|
favorite = faveChoice;
|
|
|
|
CFG_save_game_num(header->id);
|
|
|
|
}
|
|
|
|
btnFavorite.ResetState();
|
|
|
|
}
|
|
|
|
|
2009-05-10 09:23:01 +02:00
|
|
|
// this next part is long because nobody could agree on what the left/right buttons should do
|
2009-05-05 08:24:23 +02:00
|
|
|
else if((btnRight.GetState() == STATE_CLICKED) && (Settings.xflip == no)){//next game
|
2009-05-03 22:30:17 +02:00
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 50);
|
|
|
|
changed = 1;
|
2009-05-05 11:06:11 +02:00
|
|
|
btnClick.Play();
|
2009-05-03 22:30:17 +02:00
|
|
|
gameSelected = (gameSelected + 1) % gameCnt;
|
|
|
|
btnRight.ResetState();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-05-05 08:24:23 +02:00
|
|
|
else if((btnLeft.GetState() == STATE_CLICKED) && (Settings.xflip == no)){//previous game
|
2009-05-03 22:30:17 +02:00
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
|
|
|
|
changed = 2;
|
2009-05-05 11:06:11 +02:00
|
|
|
btnClick.Play();
|
2009-05-03 22:30:17 +02:00
|
|
|
gameSelected = (gameSelected - 1 + gameCnt) % gameCnt;
|
|
|
|
btnLeft.ResetState();
|
|
|
|
break;
|
|
|
|
}
|
2009-05-05 19:24:19 +02:00
|
|
|
|
2009-05-05 11:06:11 +02:00
|
|
|
else if((btnRight.GetState() == STATE_CLICKED) && (Settings.xflip == yes)){//previous game
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
|
|
|
|
changed = 2;
|
|
|
|
btnClick.Play();
|
2009-05-05 08:24:23 +02:00
|
|
|
gameSelected = (gameSelected - 1 + gameCnt) % gameCnt;
|
|
|
|
btnRight.ResetState();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-05-05 11:06:11 +02:00
|
|
|
else if((btnLeft.GetState() == STATE_CLICKED) && (Settings.xflip == yes)){//netx game
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 50);
|
|
|
|
changed = 1;
|
|
|
|
btnClick.Play();
|
2009-05-05 08:24:23 +02:00
|
|
|
gameSelected = (gameSelected + 1) % gameCnt;
|
|
|
|
btnLeft.ResetState();
|
|
|
|
break;
|
|
|
|
}
|
2009-05-10 09:23:01 +02:00
|
|
|
|
2009-05-10 03:01:41 +02:00
|
|
|
else if((btnRight.GetState() == STATE_CLICKED) && (Settings.xflip == sysmenu)){//previous game
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
|
|
|
|
changed = 2;
|
|
|
|
btnClick.Play();
|
|
|
|
gameSelected = (gameSelected + 1) % gameCnt;
|
|
|
|
btnRight.ResetState();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
else if((btnLeft.GetState() == STATE_CLICKED) && (Settings.xflip == sysmenu)){//netx game
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 50);
|
|
|
|
changed = 1;
|
|
|
|
btnClick.Play();
|
|
|
|
gameSelected = (gameSelected - 1 + gameCnt) % gameCnt;
|
|
|
|
btnLeft.ResetState();
|
|
|
|
break;
|
|
|
|
}
|
2009-05-10 09:23:01 +02:00
|
|
|
|
2009-05-10 03:01:41 +02:00
|
|
|
else if((btnRight.GetState() == STATE_CLICKED) && (Settings.xflip == wtf)){//previous game
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 50);
|
|
|
|
changed = 1;
|
|
|
|
btnClick.Play();
|
|
|
|
gameSelected = (gameSelected - 1 + gameCnt) % gameCnt;
|
|
|
|
btnRight.ResetState();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
else if((btnLeft.GetState() == STATE_CLICKED) && (Settings.xflip == wtf)){//netx game
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
|
|
|
|
changed = 2;
|
|
|
|
btnClick.Play();
|
|
|
|
gameSelected = (gameSelected + 1) % gameCnt;
|
|
|
|
btnLeft.ResetState();
|
|
|
|
break;
|
|
|
|
}
|
2009-05-20 22:09:57 +02:00
|
|
|
|
|
|
|
else if((btnRight.GetState() == STATE_CLICKED) && (Settings.xflip == disk3d)){//next game
|
|
|
|
// diskImg.SetBetaRotateEffect(45, 90);
|
|
|
|
changed = 3;
|
|
|
|
btnClick.Play();
|
|
|
|
gameSelected = (gameSelected + 1) % gameCnt;
|
|
|
|
btnRight.ResetState();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
else if((btnLeft.GetState() == STATE_CLICKED) && (Settings.xflip == disk3d)){//previous game
|
|
|
|
// diskImg.SetBetaRotateEffect(-45, 90);
|
|
|
|
// promptWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 1/*50*/);
|
|
|
|
changed = 4;
|
|
|
|
btnClick.Play();
|
|
|
|
gameSelected = (gameSelected - 1 + gameCnt) % gameCnt;
|
|
|
|
btnLeft.ResetState();
|
|
|
|
break;
|
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
while(promptWindow.GetEffect() > 0) usleep(50);
|
|
|
|
HaltGui();
|
2009-05-20 22:09:57 +02:00
|
|
|
if(changed != 3 && changed != 4) // changed==3 or changed==4 --> only Halt the GUI
|
|
|
|
{
|
|
|
|
mainWindow->Remove(&promptWindow);
|
|
|
|
ResumeGui();
|
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
delete diskCover;
|
2009-05-20 22:09:57 +02:00
|
|
|
delete diskCover2;
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
return choice;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* DiscWait
|
|
|
|
***************************************************************************/
|
|
|
|
int
|
2009-05-09 14:11:43 +02:00
|
|
|
DiscWait(const char *title, const char *msg, const char *btn1Label, const char *btn2Label, int IsDeviceWait)
|
2009-05-03 22:30:17 +02:00
|
|
|
{
|
2009-05-09 15:55:25 +02:00
|
|
|
int i = 30, ret = 0;
|
2009-05-03 22:30:17 +02:00
|
|
|
u32 cover = 0;
|
|
|
|
|
|
|
|
GuiWindow promptWindow(472,320);
|
|
|
|
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
promptWindow.SetPosition(0, -10);
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol);
|
|
|
|
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, vol);
|
2009-05-18 22:00:29 +02:00
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
char imgPath[100];
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
|
|
|
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", CFG.theme_path);
|
|
|
|
GuiImageData dialogBox(imgPath, dialogue_box_png);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiTrigger trigA;
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
GuiTrigger trigB;
|
|
|
|
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
|
|
|
|
|
|
|
GuiImage dialogBoxImg(&dialogBox);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
|
|
|
dialogBoxImg.SetWidescreen(CFG.widescreen);}///////////
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText titleTxt(title, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(0,60);
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText msgTxt(msg, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
msgTxt.SetPosition(0,-40);
|
|
|
|
msgTxt.SetMaxWidth(430);
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText btn1Txt(btn1Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage btn1Img(&btnOutline);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
btn1Txt.SetWidescreen(CFG.widescreen);
|
2009-05-06 13:09:32 +02:00
|
|
|
btn1Img.SetWidescreen(CFG.widescreen);}///////////
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton btn1(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
|
|
|
|
if(btn2Label)
|
|
|
|
{
|
|
|
|
btn1.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn1.SetPosition(40, -45);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
btn1.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
|
|
|
btn1.SetPosition(0, -45);
|
|
|
|
}
|
|
|
|
|
|
|
|
btn1.SetLabel(&btn1Txt);
|
|
|
|
btn1.SetImage(&btn1Img);
|
|
|
|
btn1.SetSoundOver(&btnSoundOver);
|
|
|
|
btn1.SetSoundClick(&btnClick);
|
|
|
|
btn1.SetTrigger(&trigB);
|
|
|
|
btn1.SetTrigger(&trigA);
|
|
|
|
btn1.SetState(STATE_SELECTED);
|
|
|
|
btn1.SetEffectGrow();
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText btn2Txt(btn2Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage btn2Img(&btnOutline);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
btn2Txt.SetWidescreen(CFG.widescreen);
|
2009-05-06 13:09:32 +02:00
|
|
|
btn2Img.SetWidescreen(CFG.widescreen);}///////////
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton btn2(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
btn2.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
btn2.SetPosition(-20, -25);
|
|
|
|
btn2.SetLabel(&btn2Txt);
|
|
|
|
btn2.SetImage(&btn2Img);
|
|
|
|
btn2.SetSoundOver(&btnSoundOver);
|
|
|
|
btn2.SetSoundClick(&btnClick);
|
|
|
|
btn2.SetTrigger(&trigA);
|
|
|
|
btn2.SetEffectGrow();
|
2009-05-06 12:23:58 +02:00
|
|
|
|
2009-05-06 13:09:32 +02:00
|
|
|
if ((Settings.wsprompt == yes) && (CFG.widescreen)){/////////////adjust buttons for widescreen
|
2009-05-06 12:01:15 +02:00
|
|
|
msgTxt.SetMaxWidth(380);
|
|
|
|
if(btn2Label)
|
|
|
|
{
|
|
|
|
btn1.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn2.SetPosition(-70, -80);
|
|
|
|
btn1.SetPosition(70, -80);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
btn1.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
|
|
|
btn1.SetPosition(0, -80);
|
|
|
|
}
|
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-09 14:11:43 +02:00
|
|
|
char timer[20];
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText timerTxt(timer, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-09 14:11:43 +02:00
|
|
|
timerTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
timerTxt.SetPosition(0,160);
|
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
promptWindow.Append(&dialogBoxImg);
|
|
|
|
promptWindow.Append(&titleTxt);
|
|
|
|
promptWindow.Append(&msgTxt);
|
|
|
|
|
2009-05-09 14:11:43 +02:00
|
|
|
if(btn1Label)
|
|
|
|
promptWindow.Append(&btn1);
|
2009-05-03 22:30:17 +02:00
|
|
|
if(btn2Label)
|
|
|
|
promptWindow.Append(&btn2);
|
2009-05-09 14:11:43 +02:00
|
|
|
if(IsDeviceWait)
|
|
|
|
promptWindow.Append(&timerTxt);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->SetState(STATE_DISABLED);
|
|
|
|
mainWindow->Append(&promptWindow);
|
|
|
|
mainWindow->ChangeFocus(&promptWindow);
|
|
|
|
ResumeGui();
|
|
|
|
|
2009-05-09 14:11:43 +02:00
|
|
|
if(IsDeviceWait) {
|
|
|
|
while(i >= 0)
|
|
|
|
{
|
2009-05-16 17:38:52 +02:00
|
|
|
sprintf(timer, "%u%s", i,LANGUAGE.secondsleft);
|
2009-05-09 14:11:43 +02:00
|
|
|
timerTxt.SetText(timer);
|
|
|
|
VIDEO_WaitVSync();
|
|
|
|
if(Settings.cios == ios222) {
|
|
|
|
ret = IOS_ReloadIOS(222);
|
|
|
|
} else {
|
|
|
|
ret = IOS_ReloadIOS(249);
|
|
|
|
}
|
|
|
|
sleep(1);
|
|
|
|
ret = WBFS_Init(WBFS_DEVICE_USB);
|
|
|
|
if(ret>=0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
i--;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
while(!(cover & 0x2))
|
|
|
|
{
|
|
|
|
VIDEO_WaitVSync();
|
|
|
|
if(btn1.GetState() == STATE_CLICKED) {
|
2009-05-09 15:55:25 +02:00
|
|
|
btn1.ResetState();
|
2009-05-09 14:11:43 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
ret = WDVD_GetCoverStatus(&cover);
|
|
|
|
if (ret < 0)
|
|
|
|
break;
|
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
|
|
|
while(promptWindow.GetEffect() > 0) usleep(50);
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&promptWindow);
|
|
|
|
mainWindow->SetState(STATE_DEFAULT);
|
|
|
|
ResumeGui();
|
2009-05-09 14:11:43 +02:00
|
|
|
return ret;
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* FormatingPartition
|
|
|
|
***************************************************************************/
|
|
|
|
int
|
|
|
|
FormatingPartition(const char *title, partitionEntry *entry)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
GuiWindow promptWindow(472,320);
|
|
|
|
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
promptWindow.SetPosition(0, -10);
|
2009-05-18 22:00:29 +02:00
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
char imgPath[100];
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
|
|
|
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", CFG.theme_path);
|
|
|
|
GuiImageData dialogBox(imgPath, dialogue_box_png);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-18 22:00:29 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiTrigger trigA;
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiImage dialogBoxImg(&dialogBox);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
|
|
|
dialogBoxImg.SetWidescreen(CFG.widescreen);}///////////
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText titleTxt(title, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(0,60);
|
|
|
|
|
|
|
|
promptWindow.Append(&dialogBoxImg);
|
|
|
|
promptWindow.Append(&titleTxt);
|
|
|
|
|
|
|
|
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->SetState(STATE_DISABLED);
|
|
|
|
mainWindow->Append(&promptWindow);
|
|
|
|
mainWindow->ChangeFocus(&promptWindow);
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
VIDEO_WaitVSync();
|
|
|
|
ret = WBFS_Format(entry->sector, entry->size);
|
|
|
|
|
|
|
|
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
|
|
|
while(promptWindow.GetEffect() > 0) usleep(50);
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&promptWindow);
|
|
|
|
mainWindow->SetState(STATE_DEFAULT);
|
|
|
|
ResumeGui();
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* NetworkInit
|
|
|
|
***************************************************************************/
|
2009-05-06 11:51:16 +02:00
|
|
|
int NetworkInitPromp(int choice2)
|
2009-05-03 22:30:17 +02:00
|
|
|
{
|
2009-05-06 11:51:16 +02:00
|
|
|
char hostip[16];
|
|
|
|
char * IP = NULL;
|
|
|
|
s32 ret = -1;
|
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiWindow promptWindow(472,320);
|
|
|
|
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
promptWindow.SetPosition(0, -10);
|
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol);
|
|
|
|
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, vol);
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
char imgPath[100];
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
|
|
|
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", CFG.theme_path);
|
|
|
|
GuiImageData dialogBox(imgPath, dialogue_box_png);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiTrigger trigA;
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiImage dialogBoxImg(&dialogBox);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
|
|
|
dialogBoxImg.SetWidescreen(CFG.widescreen);}///////////
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText titleTxt(LANGUAGE.InitializingNetwork, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(0,60);
|
|
|
|
|
|
|
|
char msg[20] = " ";
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText msgTxt(msg, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
msgTxt.SetPosition(0,-40);
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText btn1Txt(LANGUAGE.Cancel, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage btn1Img(&btnOutline);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
btn1Txt.SetWidescreen(CFG.widescreen);
|
2009-05-06 13:09:32 +02:00
|
|
|
btn1Img.SetWidescreen(CFG.widescreen);}///////////
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton btn1(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
btn1.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
|
|
|
btn1.SetPosition(0, -45);
|
|
|
|
btn1.SetLabel(&btn1Txt);
|
|
|
|
btn1.SetImage(&btn1Img);
|
|
|
|
btn1.SetSoundOver(&btnSoundOver);
|
|
|
|
btn1.SetSoundClick(&btnClick);
|
|
|
|
btn1.SetTrigger(&trigA);
|
|
|
|
btn1.SetState(STATE_SELECTED);
|
|
|
|
btn1.SetEffectGrow();
|
2009-05-06 12:23:58 +02:00
|
|
|
|
2009-05-06 13:09:32 +02:00
|
|
|
if ((Settings.wsprompt == yes) && (CFG.widescreen)){/////////////adjust buttons for widescreen
|
2009-05-06 12:01:15 +02:00
|
|
|
btn1.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
|
|
|
btn1.SetPosition(0, -80);
|
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
promptWindow.Append(&dialogBoxImg);
|
|
|
|
promptWindow.Append(&titleTxt);
|
|
|
|
promptWindow.Append(&msgTxt);
|
|
|
|
promptWindow.Append(&btn1);
|
|
|
|
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->SetState(STATE_DISABLED);
|
|
|
|
mainWindow->Append(&promptWindow);
|
|
|
|
mainWindow->ChangeFocus(&promptWindow);
|
|
|
|
|
2009-05-06 11:51:16 +02:00
|
|
|
ResumeGui();
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-06 11:51:16 +02:00
|
|
|
while (!IP)
|
2009-05-03 22:30:17 +02:00
|
|
|
{
|
|
|
|
|
2009-05-06 11:51:16 +02:00
|
|
|
VIDEO_WaitVSync();
|
|
|
|
|
|
|
|
ret = Net_Init(hostip);
|
|
|
|
|
|
|
|
if (ret > 0) {
|
|
|
|
IP = hostip;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ret <= 0) {
|
2009-05-16 17:38:52 +02:00
|
|
|
msgTxt.SetText(LANGUAGE.Couldnotinitializenetwork);
|
2009-05-06 11:51:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (IP && ret > 0) {
|
2009-05-03 22:30:17 +02:00
|
|
|
sprintf(msg, "IP: %s", IP);
|
|
|
|
msgTxt.SetText(msg);
|
|
|
|
cntMissFiles = 0;
|
|
|
|
u32 i = 0;
|
|
|
|
char filename[11];
|
2009-05-06 11:51:16 +02:00
|
|
|
|
2009-05-04 05:45:45 +02:00
|
|
|
bool found1 = false;/////add Ids of games that are missing covers to cntMissFiles
|
2009-05-03 22:30:17 +02:00
|
|
|
bool found2 = false;
|
|
|
|
for (i = 0; i < gameCnt && cntMissFiles < 500; i++)
|
|
|
|
{
|
|
|
|
struct discHdr* header = &gameList[i];
|
|
|
|
if (choice2 != 3) {
|
|
|
|
|
|
|
|
snprintf (filename,sizeof(filename),"%c%c%c.png", header->id[0], header->id[1], header->id[2]);
|
|
|
|
found2 = findfile(filename, CFG.covers_path);
|
|
|
|
snprintf(filename,sizeof(filename),"%c%c%c%c%c%c.png",header->id[0], header->id[1], header->id[2],
|
|
|
|
header->id[3], header->id[4], header->id[5]); //full id
|
|
|
|
found1 = findfile(filename, CFG.covers_path);
|
|
|
|
if (!found1 && !found2) //if could not find any image
|
|
|
|
{
|
|
|
|
snprintf(missingFiles[cntMissFiles],11,"%s",filename);
|
|
|
|
cntMissFiles++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (choice2 == 3) {
|
|
|
|
snprintf (filename,sizeof(filename),"%c%c%c.png", header->id[0], header->id[1], header->id[2]);
|
|
|
|
found2 = findfile(filename, CFG.disc_path);
|
|
|
|
snprintf(filename,sizeof(filename),"%c%c%c%c%c%c.png",header->id[0], header->id[1], header->id[2],
|
|
|
|
header->id[3], header->id[4], header->id[5]); //full id
|
|
|
|
found1 = findfile(filename,CFG.disc_path);
|
|
|
|
if (!found1 && !found2)
|
|
|
|
{
|
|
|
|
snprintf(missingFiles[cntMissFiles],11,"%s",filename);
|
|
|
|
cntMissFiles++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-05-06 11:51:16 +02:00
|
|
|
if(btn1.GetState() == STATE_CLICKED) {
|
2009-05-03 22:30:17 +02:00
|
|
|
IP = 0;
|
2009-05-06 11:51:16 +02:00
|
|
|
ret = -1;
|
2009-05-03 22:30:17 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
|
|
|
while(promptWindow.GetEffect() > 0) usleep(50);
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&promptWindow);
|
|
|
|
mainWindow->SetState(STATE_DEFAULT);
|
|
|
|
ResumeGui();
|
2009-05-06 11:51:16 +02:00
|
|
|
|
|
|
|
return ret;
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* ShowProgress
|
|
|
|
*
|
|
|
|
* Updates the variables used by the progress window for drawing a progress
|
|
|
|
* bar. Also resumes the progress window thread if it is suspended.
|
|
|
|
***************************************************************************/
|
|
|
|
void
|
|
|
|
ShowProgress (s32 done, s32 total)
|
|
|
|
{
|
|
|
|
|
2009-05-11 20:45:33 +02:00
|
|
|
static time_t start;
|
2009-05-03 22:30:17 +02:00
|
|
|
static u32 expected;
|
|
|
|
|
|
|
|
u32 d, h, m, s;
|
|
|
|
|
|
|
|
//first time
|
|
|
|
if (!done) {
|
|
|
|
start = time(0);
|
|
|
|
expected = 300;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Elapsed time
|
|
|
|
d = time(0) - start;
|
|
|
|
|
|
|
|
if (done != total) {
|
|
|
|
//Expected time
|
|
|
|
if (d)
|
|
|
|
expected = (expected * 3 + d * total / done) / 4;
|
|
|
|
|
|
|
|
//Remaining time
|
|
|
|
d = (expected > d) ? (expected - d) : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Calculate time values
|
|
|
|
h = d / 3600;
|
|
|
|
m = (d / 60) % 60;
|
|
|
|
s = d % 60;
|
|
|
|
|
2009-05-20 15:14:52 +02:00
|
|
|
//Calculate percentage/size
|
|
|
|
f32 percent = (done * 100.0) / total;
|
|
|
|
|
|
|
|
sprintf(prozent, "%0.2f", percent);
|
|
|
|
prTxt.SetText(prozent);
|
|
|
|
|
|
|
|
sprintf(timet,"%s %d:%02d:%02d",LANGUAGE.Timeleft,h,m,s);
|
|
|
|
timeTxt.SetText(timet);
|
|
|
|
|
|
|
|
f32 gamesizedone = gamesize * done/total;
|
|
|
|
|
|
|
|
sprintf(sizeshow,"%0.2fGB/%0.2fGB", gamesizedone, gamesize);
|
|
|
|
sizeTxt.SetText(sizeshow);
|
2009-05-06 17:44:15 +02:00
|
|
|
|
2009-05-06 13:09:32 +02:00
|
|
|
if ((Settings.wsprompt == yes) && (CFG.widescreen)){
|
2009-05-20 15:14:52 +02:00
|
|
|
progressbarImg.SetTile((int)(80*done/total));}
|
|
|
|
else {progressbarImg.SetTile((int)(100*done/total));}
|
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* ProgressWindow
|
|
|
|
*
|
|
|
|
* Opens a window, which displays progress to the user. Can either display a
|
|
|
|
* progress bar showing % completion, or a throbber that only shows that an
|
|
|
|
* action is in progress.
|
|
|
|
***************************************************************************/
|
|
|
|
int
|
|
|
|
ProgressWindow(const char *title, const char *msg)
|
|
|
|
{
|
|
|
|
|
|
|
|
GuiWindow promptWindow(472,320);
|
|
|
|
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
promptWindow.SetPosition(0, -10);
|
2009-05-18 11:33:23 +02:00
|
|
|
char imgPath[100];
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
|
|
|
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", CFG.theme_path);
|
|
|
|
GuiImageData dialogBox(imgPath, dialogue_box_png);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiTrigger trigA;
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiImage dialogBoxImg(&dialogBox);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-07 03:03:18 +02:00
|
|
|
dialogBoxImg.SetWidescreen(CFG.widescreen);}
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-19 07:08:14 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sprogressbar_outline.png", CFG.theme_path);
|
|
|
|
GuiImageData progressbarOutline(imgPath, progressbar_outline_png);
|
2009-05-20 02:03:43 +02:00
|
|
|
|
2009-05-19 07:08:14 +02:00
|
|
|
//GuiImageData progressbarOutline(progressbar_outline_png);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage progressbarOutlineImg(&progressbarOutline);
|
2009-05-06 17:02:18 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-07 03:03:18 +02:00
|
|
|
progressbarOutlineImg.SetWidescreen(CFG.widescreen);}
|
2009-05-03 22:30:17 +02:00
|
|
|
progressbarOutlineImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
progressbarOutlineImg.SetPosition(25, 40);
|
|
|
|
|
2009-05-19 07:08:14 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sprogressbar_empty.png", CFG.theme_path);
|
|
|
|
GuiImageData progressbarEmpty(imgPath, progressbar_empty_png);
|
|
|
|
//GuiImageData progressbarEmpty(progressbar_empty_png);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage progressbarEmptyImg(&progressbarEmpty);
|
|
|
|
progressbarEmptyImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
progressbarEmptyImg.SetPosition(25, 40);
|
|
|
|
progressbarEmptyImg.SetTile(100);
|
|
|
|
|
2009-05-19 07:08:14 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sprogressbar.png", CFG.theme_path);
|
|
|
|
GuiImageData progressbar(imgPath, progressbar_png);
|
|
|
|
//GuiImageData progressbar(progressbar_png);
|
2009-05-06 17:44:15 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
progressbarImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
progressbarImg.SetPosition(25, 40);
|
2009-05-06 17:44:15 +02:00
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText titleTxt(title, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(0,60);
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText msgTxt(msg, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
2009-05-06 17:02:18 +02:00
|
|
|
msgTxt.SetPosition(0,120);
|
2009-05-07 12:38:10 +02:00
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText prsTxt("%", 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-07 03:03:18 +02:00
|
|
|
prsTxt.SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
|
|
|
|
prsTxt.SetPosition(-188,40);
|
2009-05-06 17:44:15 +02:00
|
|
|
|
2009-05-07 03:03:18 +02:00
|
|
|
timeTxt.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
timeTxt.SetPosition(275,-50);
|
2009-05-06 17:44:15 +02:00
|
|
|
|
|
|
|
sizeTxt.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
2009-05-07 03:03:18 +02:00
|
|
|
sizeTxt.SetPosition(50, -50);
|
2009-05-07 12:38:10 +02:00
|
|
|
|
2009-05-07 03:03:18 +02:00
|
|
|
prTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
prTxt.SetPosition(200, 40);
|
2009-05-06 17:44:15 +02:00
|
|
|
|
2009-05-06 13:09:32 +02:00
|
|
|
if ((Settings.wsprompt == yes) && (CFG.widescreen)){/////////////adjust for widescreen
|
2009-05-06 12:01:15 +02:00
|
|
|
progressbarOutlineImg.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
progressbarOutlineImg.SetPosition(0, 40);
|
|
|
|
progressbarEmptyImg.SetPosition(80,40);
|
|
|
|
progressbarEmptyImg.SetTile(78);
|
|
|
|
progressbarImg.SetPosition(80, 40);
|
2009-05-06 17:02:18 +02:00
|
|
|
msgTxt.SetMaxWidth(380);
|
2009-05-06 17:44:15 +02:00
|
|
|
|
2009-05-07 03:03:18 +02:00
|
|
|
timeTxt.SetPosition(250,-50);
|
|
|
|
timeTxt.SetFontSize(22);
|
|
|
|
sizeTxt.SetPosition(90, -50);
|
|
|
|
sizeTxt.SetFontSize(22);
|
2009-05-06 12:01:15 +02:00
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
promptWindow.Append(&dialogBoxImg);
|
|
|
|
promptWindow.Append(&titleTxt);
|
|
|
|
promptWindow.Append(&msgTxt);
|
|
|
|
promptWindow.Append(&progressbarEmptyImg);
|
|
|
|
promptWindow.Append(&progressbarImg);
|
|
|
|
promptWindow.Append(&progressbarOutlineImg);
|
|
|
|
promptWindow.Append(&prTxt);
|
2009-05-07 03:03:18 +02:00
|
|
|
promptWindow.Append(&prsTxt);
|
2009-05-03 22:30:17 +02:00
|
|
|
promptWindow.Append(&timeTxt);
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->SetState(STATE_DISABLED);
|
|
|
|
mainWindow->Append(&promptWindow);
|
|
|
|
mainWindow->ChangeFocus(&promptWindow);
|
|
|
|
ResumeGui();
|
2009-05-06 17:02:18 +02:00
|
|
|
promptWindow.Append(&prTxt);
|
2009-05-06 17:44:15 +02:00
|
|
|
promptWindow.Append(&sizeTxt);
|
2009-05-07 12:38:10 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
s32 ret;
|
|
|
|
|
2009-05-07 12:38:10 +02:00
|
|
|
__Disc_SetLowMem();
|
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
ret = wbfs_add_disc(hdd, __WBFS_ReadDVD, NULL, ShowProgress, ONLY_GAME_PARTITION, 0);
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&promptWindow);
|
|
|
|
mainWindow->SetState(STATE_DEFAULT);
|
|
|
|
ResumeGui();
|
|
|
|
if (ret < 0) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* ProgressWindow
|
|
|
|
*
|
|
|
|
* Opens a window, which displays progress to the user. Can either display a
|
|
|
|
* progress bar showing % completion, or a throbber that only shows that an
|
|
|
|
* action is in progress.
|
|
|
|
***************************************************************************/
|
|
|
|
int
|
|
|
|
ProgressDownloadWindow(int choice2)
|
|
|
|
{
|
|
|
|
|
|
|
|
int i = 0, cntNotFound = 0;
|
|
|
|
|
|
|
|
GuiWindow promptWindow(472,320);
|
|
|
|
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
promptWindow.SetPosition(0, -10);
|
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol);
|
|
|
|
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, vol);
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
char imgPath[100];
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
|
|
|
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", CFG.theme_path);
|
|
|
|
GuiImageData dialogBox(imgPath, dialogue_box_png);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiTrigger trigA;
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiImage dialogBoxImg(&dialogBox);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-06 17:02:18 +02:00
|
|
|
dialogBoxImg.SetWidescreen(CFG.widescreen);}
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-19 07:08:14 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sprogressbar_outline.png", CFG.theme_path);
|
|
|
|
GuiImageData progressbarOutline(imgPath, progressbar_outline_png);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage progressbarOutlineImg(&progressbarOutline);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-06 17:02:18 +02:00
|
|
|
progressbarOutlineImg.SetWidescreen(CFG.widescreen);}
|
2009-05-03 22:30:17 +02:00
|
|
|
progressbarOutlineImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
progressbarOutlineImg.SetPosition(25, 40);
|
|
|
|
|
2009-05-19 07:08:14 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sprogressbar_empty.png", CFG.theme_path);
|
|
|
|
GuiImageData progressbarEmpty(imgPath, progressbar_empty_png);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage progressbarEmptyImg(&progressbarEmpty);
|
|
|
|
progressbarEmptyImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
progressbarEmptyImg.SetPosition(25, 40);
|
|
|
|
progressbarEmptyImg.SetTile(100);
|
|
|
|
|
2009-05-19 07:08:14 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sprogressbar.png", CFG.theme_path);
|
|
|
|
GuiImageData progressbar(imgPath, progressbar_png);
|
2009-05-03 22:30:17 +02:00
|
|
|
progressbarImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
progressbarImg.SetPosition(25, 40);
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText titleTxt(LANGUAGE.Downloadingfile, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(0,60);
|
|
|
|
char msg[25] = " ";
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText msgTxt(msg, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
2009-05-03 20:53:31 +02:00
|
|
|
msgTxt.SetPosition(0,130);
|
|
|
|
char msg2[15] = " ";
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText msg2Txt(msg2, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 20:53:31 +02:00
|
|
|
msg2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
2009-05-03 22:30:17 +02:00
|
|
|
msg2Txt.SetPosition(0,100);
|
|
|
|
|
|
|
|
prTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
prTxt.SetPosition(0, 40);
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText btn1Txt(LANGUAGE.Cancel, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage btn1Img(&btnOutline);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
btn1Txt.SetWidescreen(CFG.widescreen);
|
2009-05-06 17:02:18 +02:00
|
|
|
btn1Img.SetWidescreen(CFG.widescreen);}
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton btn1(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
btn1.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
|
|
|
btn1.SetPosition(0, -45);
|
|
|
|
btn1.SetLabel(&btn1Txt);
|
|
|
|
btn1.SetImage(&btn1Img);
|
|
|
|
btn1.SetSoundOver(&btnSoundOver);
|
|
|
|
btn1.SetSoundClick(&btnClick);
|
|
|
|
btn1.SetTrigger(&trigA);
|
|
|
|
btn1.SetState(STATE_SELECTED);
|
|
|
|
btn1.SetEffectGrow();
|
2009-05-06 12:23:58 +02:00
|
|
|
|
2009-05-06 13:09:32 +02:00
|
|
|
if ((Settings.wsprompt == yes) && (CFG.widescreen)){/////////////adjust for widescreen
|
2009-05-06 12:01:15 +02:00
|
|
|
progressbarOutlineImg.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
progressbarOutlineImg.SetPosition(0, 40);
|
|
|
|
progressbarEmptyImg.SetPosition(80,40);
|
|
|
|
progressbarEmptyImg.SetTile(78);
|
|
|
|
progressbarImg.SetPosition(80, 40);
|
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
promptWindow.Append(&dialogBoxImg);
|
|
|
|
promptWindow.Append(&titleTxt);
|
2009-05-03 20:53:31 +02:00
|
|
|
promptWindow.Append(&msgTxt);
|
2009-05-03 22:30:17 +02:00
|
|
|
promptWindow.Append(&msg2Txt);
|
|
|
|
promptWindow.Append(&progressbarEmptyImg);
|
|
|
|
promptWindow.Append(&progressbarImg);
|
|
|
|
promptWindow.Append(&progressbarOutlineImg);
|
|
|
|
promptWindow.Append(&prTxt);
|
|
|
|
promptWindow.Append(&btn1);
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->SetState(STATE_DISABLED);
|
|
|
|
mainWindow->Append(&promptWindow);
|
|
|
|
mainWindow->ChangeFocus(&promptWindow);
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
//check if directory exist and if not create one
|
|
|
|
struct stat st;
|
|
|
|
if(stat(CFG.covers_path, &st) != 0) {
|
|
|
|
char dircovers[100];
|
|
|
|
snprintf(dircovers,strlen(CFG.covers_path),"%s",CFG.covers_path);
|
|
|
|
if (mkdir(dircovers, 0777) == -1) {
|
2009-05-10 12:47:15 +02:00
|
|
|
if(subfoldercheck(dircovers) != 1) {
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.Error,LANGUAGE.Cantcreatedirectory,LANGUAGE.ok,0,0,0);
|
2009-05-10 12:47:15 +02:00
|
|
|
cntMissFiles = 0;
|
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(stat(CFG.disc_path,&st) != 0) {
|
|
|
|
char dirdiscs[100];
|
|
|
|
snprintf(dirdiscs,strlen(CFG.disc_path),"%s",CFG.disc_path);
|
|
|
|
if (mkdir(dirdiscs, 0777) == -1) {
|
2009-05-10 12:47:15 +02:00
|
|
|
if(subfoldercheck(dirdiscs) != 1) {
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.Error,LANGUAGE.Cantcreatedirectory,LANGUAGE.ok,0,0,0);
|
2009-05-10 12:47:15 +02:00
|
|
|
cntMissFiles = 0;
|
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
while (i < cntMissFiles) {
|
|
|
|
|
2009-05-05 20:17:59 +02:00
|
|
|
sprintf(prozent, "%i%%", 100*i/cntMissFiles);
|
|
|
|
prTxt.SetText(prozent);
|
2009-05-06 12:23:58 +02:00
|
|
|
|
2009-05-06 13:09:32 +02:00
|
|
|
if ((Settings.wsprompt == yes) && (CFG.widescreen)){/////////////adjust for widescreen
|
2009-05-06 12:01:15 +02:00
|
|
|
progressbarImg.SetPosition(80,40);
|
2009-05-08 20:17:26 +02:00
|
|
|
progressbarImg.SetTile(80*i/cntMissFiles);
|
2009-05-06 12:01:15 +02:00
|
|
|
}
|
|
|
|
else{
|
|
|
|
progressbarImg.SetTile(100*i/cntMissFiles);}
|
2009-05-06 01:07:22 +02:00
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
sprintf(msg, "%i %s", cntMissFiles - i, LANGUAGE.filesleft);
|
2009-05-03 20:53:31 +02:00
|
|
|
msgTxt.SetText(msg);
|
2009-05-03 22:30:17 +02:00
|
|
|
sprintf(msg2, "%s", missingFiles[i]);
|
2009-05-03 20:53:31 +02:00
|
|
|
msg2Txt.SetText(msg2);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
//download boxart image
|
|
|
|
char imgPath[100];
|
|
|
|
char URLFile[100];
|
|
|
|
if (choice2 == 2) {
|
|
|
|
sprintf(URLFile,"http://www.theotherzone.com/wii/3d/176/248/%s",missingFiles[i]); // For 3D Covers
|
|
|
|
sprintf(imgPath,"%s%s", CFG.covers_path, missingFiles[i]);
|
|
|
|
}
|
|
|
|
if(choice2 == 3) {
|
|
|
|
sprintf(URLFile,"http://www.theotherzone.com/wii/diskart/160/160/%s",missingFiles[i]);
|
|
|
|
sprintf(imgPath,"%s%s", CFG.disc_path, missingFiles[i]);
|
|
|
|
}
|
|
|
|
if(choice2 == 1) {
|
|
|
|
sprintf(URLFile,"http://www.theotherzone.com/wii/resize/160/224/%s",missingFiles[i]);
|
|
|
|
sprintf(imgPath,"%s%s", CFG.covers_path, missingFiles[i]);
|
|
|
|
}
|
|
|
|
|
2009-05-04 05:45:45 +02:00
|
|
|
struct block file = downloadfile(URLFile);//reject known bad images
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
if (file.size == 36864 || file.size <= 1024 || file.size == 7386 || file.data == NULL) {
|
|
|
|
cntNotFound++;
|
|
|
|
i++;
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if(file.data != NULL)
|
|
|
|
{
|
|
|
|
// save png to sd card
|
|
|
|
FILE *pfile;
|
|
|
|
pfile = fopen(imgPath, "wb");
|
|
|
|
fwrite(file.data,1,file.size,pfile);
|
|
|
|
fclose (pfile);
|
|
|
|
free(file.data);
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(btn1.GetState() == STATE_CLICKED) {
|
|
|
|
cntNotFound = cntMissFiles-i+cntNotFound;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&promptWindow);
|
|
|
|
mainWindow->SetState(STATE_DEFAULT);
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
if (cntNotFound != 0) {
|
|
|
|
return cntNotFound;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* UpdateGUI
|
|
|
|
*
|
|
|
|
* Primary thread to allow GUI to respond to state changes, and draws GUI
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
static void *
|
|
|
|
UpdateGUI (void *arg)
|
|
|
|
{
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
if(guiHalt)
|
|
|
|
{
|
|
|
|
LWP_SuspendThread(guithread);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mainWindow->Draw();
|
2009-05-18 22:00:29 +02:00
|
|
|
if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0 && mainWindow->GetState() != STATE_DISABLED)
|
2009-05-08 16:23:05 +02:00
|
|
|
mainWindow->DrawTooltip();
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
#ifdef HW_RVL
|
|
|
|
for(int i=3; i >= 0; i--) // so that player 1's cursor appears on top!
|
|
|
|
{
|
|
|
|
if(userInput[i].wpad.ir.valid)
|
2009-05-20 22:09:57 +02:00
|
|
|
Menu_DrawImg(userInput[i].wpad.ir.x-48, userInput[i].wpad.ir.y-48, 200.0,
|
2009-05-03 22:30:17 +02:00
|
|
|
96, 96, pointer[i]->GetImage(), userInput[i].wpad.ir.angle, CFG.widescreen? 0.8 : 1, 1, 255);
|
|
|
|
if(Settings.rumble == RumbleOn)
|
|
|
|
{
|
2009-05-08 16:23:05 +02:00
|
|
|
DoRumble(i);
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
Menu_Render();
|
|
|
|
|
|
|
|
for(int i=0; i < 4; i++)
|
|
|
|
mainWindow->Update(&userInput[i]);
|
|
|
|
|
|
|
|
if(ExitRequested)
|
|
|
|
{
|
|
|
|
for(int a = 0; a < 255; a += 15)
|
|
|
|
{
|
|
|
|
mainWindow->Draw();
|
|
|
|
Menu_DrawRectangle(0,0,screenwidth,screenheight,(GXColor){0, 0, 0, a},1);
|
|
|
|
Menu_Render();
|
|
|
|
}
|
|
|
|
ExitApp();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* InitGUIThread
|
|
|
|
*
|
|
|
|
* Startup GUI threads
|
|
|
|
***************************************************************************/
|
|
|
|
void
|
|
|
|
InitGUIThreads()
|
|
|
|
{
|
|
|
|
LWP_CreateThread (&guithread, UpdateGUI, NULL, NULL, 0, 70);
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* EntryCmp
|
|
|
|
***************************************************************************/
|
|
|
|
s32 __Menu_EntryCmp(const void *a, const void *b)
|
2009-05-21 06:00:16 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
{
|
2009-05-21 06:00:16 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
struct discHdr *hdr1 = (struct discHdr *)a;
|
2009-05-21 06:00:16 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
struct discHdr *hdr2 = (struct discHdr *)b;
|
|
|
|
|
2009-05-21 06:00:16 +02:00
|
|
|
|
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
/* Compare strings */
|
2009-05-21 06:00:16 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
return stricmp(get_title(hdr1), get_title(hdr2));
|
2009-05-21 06:00:16 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 __Menu_EntryCmpCount(const void *a, const void *b)
|
|
|
|
{
|
|
|
|
s32 ret;
|
|
|
|
|
|
|
|
struct discHdr *hdr1 = (struct discHdr *)a;
|
|
|
|
|
|
|
|
struct discHdr *hdr2 = (struct discHdr *)b;
|
|
|
|
|
|
|
|
/* Compare Play Count */
|
|
|
|
u8 count1 = 0;
|
|
|
|
u8 count2 = 0;
|
|
|
|
struct Game_NUM* game_num1 = CFG_get_game_num(hdr1->id);
|
|
|
|
struct Game_NUM* game_num2 = CFG_get_game_num(hdr2->id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (game_num1) count1 = game_num1->count;
|
|
|
|
if (game_num2) count2 = game_num2->count;
|
|
|
|
|
|
|
|
ret = (s32) (count2-count1);
|
|
|
|
if (ret == 0) return stricmp(get_title(hdr1), get_title(hdr2));
|
2009-05-21 20:13:37 +02:00
|
|
|
|
2009-05-21 06:00:16 +02:00
|
|
|
return ret;
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Get Gamelist
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
s32 __Menu_GetEntries(void)
|
2009-05-21 20:13:37 +02:00
|
|
|
{
|
2009-05-03 22:30:17 +02:00
|
|
|
struct discHdr *buffer = NULL;
|
|
|
|
struct discHdr *buffer2 = NULL;
|
|
|
|
struct discHdr *header = NULL;
|
|
|
|
|
|
|
|
u32 cnt, len;
|
|
|
|
s32 ret;
|
|
|
|
|
|
|
|
/* Get list length */
|
|
|
|
ret = WBFS_GetCount(&cnt);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* Buffer length */
|
|
|
|
len = sizeof(struct discHdr) * cnt;
|
|
|
|
|
|
|
|
/* Allocate memory */
|
|
|
|
buffer = (struct discHdr *)memalign(32, len);
|
|
|
|
if (!buffer)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
/* Clear buffer */
|
|
|
|
memset(buffer, 0, len);
|
|
|
|
|
|
|
|
/* Get header list */
|
|
|
|
ret = WBFS_GetHeaders(buffer, cnt, sizeof(struct discHdr));
|
2009-05-21 10:56:23 +02:00
|
|
|
if (ret < 0) {
|
|
|
|
if(buffer) free(buffer);
|
|
|
|
return ret;
|
|
|
|
}
|
2009-05-21 20:13:37 +02:00
|
|
|
|
2009-05-21 10:56:23 +02:00
|
|
|
/* Filters */
|
|
|
|
if (Settings.sort==fave || dispFave) {
|
2009-05-21 06:00:16 +02:00
|
|
|
u32 cnt2 = 0;
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-21 06:00:16 +02:00
|
|
|
for (u32 i = 0; i < cnt; i++)
|
|
|
|
{
|
2009-05-21 10:56:23 +02:00
|
|
|
header = &buffer[i];
|
|
|
|
u8 favorite = 0;
|
|
|
|
struct Game_NUM* game_num = CFG_get_game_num(header->id);
|
|
|
|
if (game_num) {
|
|
|
|
favorite = game_num->favorite;
|
|
|
|
}
|
|
|
|
if (favorite==1) {
|
2009-05-21 06:00:16 +02:00
|
|
|
buffer2 = (discHdr *) realloc(buffer2, (cnt2+1) * sizeof(struct discHdr));
|
|
|
|
if (!buffer2)
|
|
|
|
{
|
|
|
|
free(buffer);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy((buffer2 + cnt2), (buffer + i), sizeof(struct discHdr));
|
|
|
|
cnt2++;
|
|
|
|
}
|
2009-05-21 20:26:01 +02:00
|
|
|
}
|
|
|
|
if (buffer2) {
|
|
|
|
free(buffer);
|
|
|
|
buffer = buffer2;
|
|
|
|
buffer2 = NULL;
|
|
|
|
} else {
|
|
|
|
memset(buffer, 0, len);
|
2009-05-21 06:00:16 +02:00
|
|
|
}
|
|
|
|
cnt = cnt2;
|
2009-05-21 20:13:37 +02:00
|
|
|
}
|
2009-05-21 10:56:23 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
if (CFG.parentalcontrol && !CFG.godmode)
|
|
|
|
{
|
2009-05-21 20:26:01 +02:00
|
|
|
u32 cnt3 = 0;
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
for (u32 i = 0; i < cnt; i++)
|
|
|
|
{
|
2009-05-21 06:00:16 +02:00
|
|
|
if (get_block(header) < CFG.parentalcontrol)
|
2009-05-03 22:30:17 +02:00
|
|
|
{
|
2009-05-21 20:26:01 +02:00
|
|
|
buffer2 = (discHdr *) realloc(buffer2, (cnt3+1) * sizeof(struct discHdr));
|
2009-05-03 22:30:17 +02:00
|
|
|
if (!buffer2)
|
|
|
|
{
|
|
|
|
free(buffer);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-05-21 20:26:01 +02:00
|
|
|
memcpy((buffer2 + cnt3), (buffer + i), sizeof(struct discHdr));
|
|
|
|
cnt3++;
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
2009-05-21 20:26:01 +02:00
|
|
|
}
|
|
|
|
if (buffer2) {
|
|
|
|
free(buffer);
|
|
|
|
buffer = buffer2;
|
|
|
|
buffer2 = NULL;
|
|
|
|
} else {
|
|
|
|
memset(buffer, 0, len);
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
2009-05-21 20:26:01 +02:00
|
|
|
cnt = cnt3;
|
2009-05-21 10:56:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (Settings.sort==pcount) {
|
|
|
|
qsort(buffer, cnt, sizeof(struct discHdr), __Menu_EntryCmpCount);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
qsort(buffer, cnt, sizeof(struct discHdr), __Menu_EntryCmp);
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Free memory */
|
|
|
|
if (gameList)
|
|
|
|
free(gameList);
|
|
|
|
|
|
|
|
/* Set values */
|
2009-05-21 10:56:23 +02:00
|
|
|
gameList = buffer;
|
|
|
|
buffer = NULL;
|
2009-05-03 22:30:17 +02:00
|
|
|
gameCnt = cnt;
|
|
|
|
|
|
|
|
/* Reset variables */
|
|
|
|
gameSelected = gameStart = 0;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* OnScreenKeyboard
|
|
|
|
*
|
|
|
|
* Opens an on-screen keyboard window, with the data entered being stored
|
|
|
|
* into the specified variable.
|
|
|
|
***************************************************************************/
|
2009-05-12 01:26:39 +02:00
|
|
|
extern int min;
|
|
|
|
static int OnScreenKeyboard(char * var, u32 maxlen, int min)
|
2009-05-03 22:30:17 +02:00
|
|
|
{
|
|
|
|
int save = -1;
|
2009-05-17 06:02:52 +02:00
|
|
|
int keyset = 0;
|
|
|
|
if (Settings.keyset == us) keyset = 0;
|
|
|
|
else if (Settings.keyset == dvorak) keyset = 1;
|
|
|
|
else if (Settings.keyset == euro) keyset = 2;
|
2009-05-17 10:40:47 +02:00
|
|
|
|
2009-05-17 06:02:52 +02:00
|
|
|
GuiKeyboard keyboard(var, maxlen, min, keyset);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol);
|
|
|
|
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, vol);
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
char imgPath[50];
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
|
|
|
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
2009-05-18 22:00:29 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiTrigger trigA;
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
GuiTrigger trigB;
|
|
|
|
trigB.SetSimpleTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText okBtnTxt(LANGUAGE.ok, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage okBtnImg(&btnOutline);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
okBtnTxt.SetWidescreen(CFG.widescreen);
|
2009-05-06 13:09:32 +02:00
|
|
|
okBtnImg.SetWidescreen(CFG.widescreen);}///////////
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton okBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
|
|
|
|
okBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
2009-05-05 11:06:11 +02:00
|
|
|
okBtn.SetPosition(5, 15);//(25, -25);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
okBtn.SetLabel(&okBtnTxt);//
|
2009-05-03 22:30:17 +02:00
|
|
|
okBtn.SetImage(&okBtnImg);
|
|
|
|
okBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
okBtn.SetSoundClick(&btnClick);
|
|
|
|
okBtn.SetTrigger(&trigA);
|
|
|
|
okBtn.SetEffectGrow();
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText cancelBtnTxt(LANGUAGE.Cancel, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage cancelBtnImg(&btnOutline);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
cancelBtnTxt.SetWidescreen(CFG.widescreen);
|
2009-05-06 13:09:32 +02:00
|
|
|
cancelBtnImg.SetWidescreen(CFG.widescreen);}///////////
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton cancelBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
cancelBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
2009-05-05 11:06:11 +02:00
|
|
|
cancelBtn.SetPosition(-5, 15);//(-25, -25);
|
2009-05-03 22:30:17 +02:00
|
|
|
cancelBtn.SetLabel(&cancelBtnTxt);
|
|
|
|
cancelBtn.SetImage(&cancelBtnImg);
|
|
|
|
cancelBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
cancelBtn.SetSoundClick(&btnClick);
|
|
|
|
cancelBtn.SetTrigger(&trigA);
|
|
|
|
cancelBtn.SetTrigger(&trigB);
|
|
|
|
cancelBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
keyboard.Append(&okBtn);
|
|
|
|
keyboard.Append(&cancelBtn);
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->SetState(STATE_DISABLED);
|
|
|
|
mainWindow->Append(&keyboard);
|
|
|
|
mainWindow->ChangeFocus(&keyboard);
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(save == -1)
|
|
|
|
{
|
|
|
|
VIDEO_WaitVSync();
|
|
|
|
|
|
|
|
if(okBtn.GetState() == STATE_CLICKED)
|
|
|
|
save = 1;
|
|
|
|
else if(cancelBtn.GetState() == STATE_CLICKED)
|
|
|
|
save = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(save)
|
|
|
|
{
|
|
|
|
snprintf(var, maxlen, "%s", keyboard.kbtextstr);
|
|
|
|
}
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&keyboard);
|
|
|
|
mainWindow->SetState(STATE_DEFAULT);
|
|
|
|
ResumeGui();
|
|
|
|
return save;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* MenuInstall
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
static int MenuInstall()
|
|
|
|
{
|
|
|
|
int menu = MENU_NONE;
|
|
|
|
static struct discHdr headerdisc ATTRIBUTE_ALIGN(32);
|
|
|
|
|
|
|
|
if(Settings.cios == ios222) {
|
2009-05-03 20:53:31 +02:00
|
|
|
Disc_SetUSB(NULL, 1);
|
|
|
|
} else {
|
|
|
|
Disc_SetUSB(NULL, 0);
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int ret, choice = 0;
|
|
|
|
char *name;
|
|
|
|
static char buffer[MAX_CHARACTERS + 4];
|
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol);
|
|
|
|
|
2009-05-20 15:14:52 +02:00
|
|
|
char imgPath[100];
|
2009-05-16 21:12:36 +02:00
|
|
|
|
2009-05-15 06:07:34 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbattery.png", CFG.theme_path);
|
|
|
|
GuiImageData battery(imgPath, battery_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbattery_red.png", CFG.theme_path);
|
|
|
|
GuiImageData batteryRed(imgPath, battery_red_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbattery_bar.png", CFG.theme_path);
|
|
|
|
GuiImageData batteryBar(imgPath, battery_bar_png);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
GuiWindow w(screenwidth, screenheight);
|
|
|
|
|
|
|
|
mainWindow->Append(&w);
|
|
|
|
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(menu == MENU_NONE)
|
|
|
|
{
|
|
|
|
VIDEO_WaitVSync ();
|
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
ret = DiscWait(LANGUAGE.InsertDisk,LANGUAGE.Waiting,LANGUAGE.Cancel,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
if (ret < 0) {
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt (LANGUAGE.ErrorreadingDisc,0,LANGUAGE.Back,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
menu = MENU_DISCLIST;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ret = Disc_Open();
|
|
|
|
if (ret < 0) {
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt (LANGUAGE.CouldnotopenDisc,0,LANGUAGE.Back,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
menu = MENU_DISCLIST;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = Disc_IsWii();
|
|
|
|
if (ret < 0) {
|
2009-05-16 17:38:52 +02:00
|
|
|
choice = WindowPrompt (LANGUAGE.NotaWiiDisc,LANGUAGE.InsertaWiiDisc,LANGUAGE.ok,LANGUAGE.Back,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
if (choice == 1) {
|
|
|
|
menu = MENU_INSTALL;
|
|
|
|
break;
|
|
|
|
} else
|
|
|
|
menu = MENU_DISCLIST;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
Disc_ReadHeader(&headerdisc);
|
|
|
|
name = headerdisc.title;
|
2009-05-07 12:38:10 +02:00
|
|
|
if (strlen(name) < (34 + 3)) {
|
2009-05-03 22:30:17 +02:00
|
|
|
memset(buffer, 0, sizeof(buffer));
|
|
|
|
sprintf(name, "%s", name);
|
|
|
|
} else {
|
2009-05-07 12:38:10 +02:00
|
|
|
strncpy(buffer, name, 34);
|
2009-05-03 22:30:17 +02:00
|
|
|
strncat(buffer, "...", 3);
|
|
|
|
sprintf(name, "%s", buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = WBFS_CheckGame(headerdisc.id);
|
|
|
|
if (ret) {
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt (LANGUAGE.Gameisalreadyinstalled,name,LANGUAGE.Back,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
menu = MENU_DISCLIST;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
hdd = GetHddInfo();
|
|
|
|
if (!hdd) {
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt (LANGUAGE.NoHDDfound,LANGUAGE.Error,LANGUAGE.Back,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
menu = MENU_DISCLIST;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
f32 freespace, used;
|
|
|
|
|
|
|
|
WBFS_DiskSpace(&used, &freespace);
|
2009-05-13 22:55:33 +02:00
|
|
|
float estimation = wbfs_estimate_disc(hdd, __WBFS_ReadDVD, NULL, ONLY_GAME_PARTITION);
|
|
|
|
gamesize = estimation/1073741824;
|
2009-05-03 22:30:17 +02:00
|
|
|
char gametxt[50];
|
2009-05-04 20:21:55 +02:00
|
|
|
|
|
|
|
sprintf(gametxt, "%s : %.2fGB", name, gamesize);
|
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
choice = WindowPrompt(LANGUAGE.Continueinstallgame,gametxt,LANGUAGE.ok,LANGUAGE.Cancel,0,0);
|
2009-05-04 20:21:55 +02:00
|
|
|
|
|
|
|
if(choice == 1) {
|
|
|
|
|
2009-05-16 22:10:29 +02:00
|
|
|
sprintf(gametxt, "%s", LANGUAGE.Installinggame);
|
2009-05-04 20:21:55 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
if (gamesize > freespace) {
|
|
|
|
char errortxt[50];
|
2009-05-16 17:38:52 +02:00
|
|
|
sprintf(errortxt, "%s: %.2fGB, %s: %.2fGB",LANGUAGE.GameSize, gamesize, LANGUAGE.FreeSpace, freespace);
|
|
|
|
choice = WindowPrompt(LANGUAGE.Notenoughfreespace,errortxt,LANGUAGE.ok, LANGUAGE.Return,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
if (choice == 1) {
|
|
|
|
ret = ProgressWindow(gametxt, name);
|
|
|
|
if (ret != 0) {
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt (LANGUAGE.Installerror,0,LANGUAGE.Back,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
menu = MENU_DISCLIST;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
__Menu_GetEntries(); //get the entries again
|
|
|
|
wiilight(1);
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt (LANGUAGE.Successfullyinstalled,name,LANGUAGE.ok,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
menu = MENU_DISCLIST;
|
|
|
|
wiilight(0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
menu = MENU_DISCLIST;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ret = ProgressWindow(gametxt, name);
|
|
|
|
if (ret != 0) {
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt (LANGUAGE.Installerror,0,LANGUAGE.Back,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
menu = MENU_DISCLIST;
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
__Menu_GetEntries(); //get the entries again
|
|
|
|
wiilight(1);
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt (LANGUAGE.Successfullyinstalled,name,LANGUAGE.ok,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
menu = MENU_DISCLIST;
|
|
|
|
wiilight(0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-05-04 20:21:55 +02:00
|
|
|
} else {
|
|
|
|
menu = MENU_DISCLIST;
|
|
|
|
wiilight(0);
|
|
|
|
break;
|
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
if (shutdown == 1)
|
|
|
|
Sys_Shutdown();
|
|
|
|
if(reset == 1)
|
|
|
|
Sys_Reboot();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
|
|
|
|
mainWindow->Remove(&w);
|
|
|
|
ResumeGui();
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* MenuDiscList
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
static int MenuDiscList()
|
|
|
|
{
|
2009-05-15 22:03:19 +02:00
|
|
|
|
2009-05-12 01:26:39 +02:00
|
|
|
datagB=0;
|
|
|
|
int menu = MENU_NONE, dataef=0;
|
2009-05-03 20:53:31 +02:00
|
|
|
char imgPath[100];
|
2009-05-12 01:26:39 +02:00
|
|
|
char buf[4];
|
2009-05-21 06:00:16 +02:00
|
|
|
__Menu_GetEntries();
|
|
|
|
if (gameCnt==0){Settings.sort=all;__Menu_GetEntries();}
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
f32 freespace, used, size = 0.0;
|
|
|
|
u32 nolist;
|
2009-05-20 15:14:52 +02:00
|
|
|
char text[MAX_CHARACTERS + 4];
|
2009-05-03 22:30:17 +02:00
|
|
|
int choice = 0, selectedold = 100;
|
|
|
|
s32 ret;
|
|
|
|
|
|
|
|
//CLOCK
|
|
|
|
struct tm * timeinfo;
|
|
|
|
char theTime[80];
|
2009-05-08 00:46:54 +02:00
|
|
|
time_t lastrawtime=0;
|
2009-05-08 18:39:10 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
WBFS_DiskSpace(&used, &freespace);
|
|
|
|
|
2009-05-04 05:45:45 +02:00
|
|
|
if (!gameCnt) { //if there is no list of games to display
|
2009-05-03 22:30:17 +02:00
|
|
|
nolist = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol);
|
|
|
|
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, vol);
|
|
|
|
|
|
|
|
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);
|
2009-05-11 21:55:14 +02:00
|
|
|
GuiImageData dataID(&data1);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
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.png", CFG.theme_path);
|
|
|
|
GuiImageData btnsdcard(imgPath, sdcard_png);
|
2009-05-16 21:12:36 +02:00
|
|
|
|
2009-05-15 06:07:34 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbattery.png", CFG.theme_path);
|
|
|
|
GuiImageData battery(imgPath, battery_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbattery_red.png", CFG.theme_path);
|
|
|
|
GuiImageData batteryRed(imgPath, battery_red_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbattery_bar.png", CFG.theme_path);
|
|
|
|
GuiImageData batteryBar(imgPath, battery_bar_png);
|
2009-05-21 10:56:23 +02:00
|
|
|
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sfavorite.png", CFG.theme_path);
|
|
|
|
GuiImageData imgFavoriteOn(imgPath, favorite_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%snot_favorite.png", CFG.theme_path);
|
|
|
|
GuiImageData imgFavoriteOff(imgPath, not_favorite_png);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
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, 0);
|
|
|
|
|
|
|
|
char spaceinfo[30];
|
2009-05-16 17:38:52 +02:00
|
|
|
sprintf(spaceinfo,"%.2fGB %s %.2fGB %s",freespace,LANGUAGE.of,(freespace+used),LANGUAGE.free);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiText usedSpaceTxt(spaceinfo, 18, (GXColor){THEME.info_r, THEME.info_g, THEME.info_b, 255});
|
|
|
|
usedSpaceTxt.SetAlignment(THEME.hddInfoAlign, ALIGN_TOP);
|
|
|
|
usedSpaceTxt.SetPosition(THEME.hddInfo_x, THEME.hddInfo_y);
|
|
|
|
|
|
|
|
char GamesCnt[15];
|
2009-05-16 17:38:52 +02:00
|
|
|
sprintf(GamesCnt,"%s: %i",LANGUAGE.Games, gameCnt);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiText gamecntTxt(GamesCnt, 18, (GXColor){THEME.info_r, THEME.info_g, THEME.info_b, 255});
|
|
|
|
gamecntTxt.SetAlignment(THEME.gameCntAlign, ALIGN_TOP);
|
|
|
|
gamecntTxt.SetPosition(THEME.gameCnt_x,THEME.gameCnt_y);
|
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
GuiTooltip installBtnTT(LANGUAGE.Installagame);
|
2009-05-08 00:46:54 +02:00
|
|
|
if (Settings.wsprompt == yes)
|
2009-05-20 15:14:52 +02:00
|
|
|
installBtnTT.SetWidescreen(CFG.widescreen);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage installBtnImg(&btnInstall);
|
|
|
|
GuiImage installBtnImgOver(&btnInstallOver);
|
2009-05-20 15:14:52 +02:00
|
|
|
installBtnImg.SetWidescreen(CFG.widescreen);
|
|
|
|
installBtnImgOver.SetWidescreen(CFG.widescreen);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton installBtn(btnInstall.GetWidth(), btnInstall.GetHeight());
|
|
|
|
installBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
installBtn.SetPosition(THEME.install_x, THEME.install_y);
|
|
|
|
installBtn.SetImage(&installBtnImg);
|
|
|
|
installBtn.SetImageOver(&installBtnImgOver);
|
|
|
|
installBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
installBtn.SetSoundClick(&btnClick);
|
|
|
|
installBtn.SetTrigger(&trigA);
|
2009-05-03 20:53:31 +02:00
|
|
|
installBtn.SetEffectGrow();
|
2009-05-08 16:23:05 +02:00
|
|
|
installBtn.SetToolTip(&installBtnTT,24,-30, ALIGN_LEFT);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
GuiTooltip settingsBtnTT(LANGUAGE.settings);
|
2009-05-08 00:46:54 +02:00
|
|
|
if (Settings.wsprompt == yes)
|
2009-05-20 15:14:52 +02:00
|
|
|
settingsBtnTT.SetWidescreen(CFG.widescreen);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
GuiImage settingsBtnImg(&btnSettings);
|
2009-05-20 15:14:52 +02:00
|
|
|
settingsBtnImg.SetWidescreen(CFG.widescreen);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage settingsBtnImgOver(&btnSettingsOver);
|
2009-05-20 15:14:52 +02:00
|
|
|
settingsBtnImgOver.SetWidescreen(CFG.widescreen);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton settingsBtn(btnSettings.GetWidth(), btnSettings.GetHeight());
|
|
|
|
settingsBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
settingsBtn.SetPosition(THEME.setting_x, THEME.setting_y);
|
|
|
|
settingsBtn.SetImage(&settingsBtnImg);
|
|
|
|
settingsBtn.SetImageOver(&settingsBtnImgOver);
|
|
|
|
settingsBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
settingsBtn.SetSoundClick(&btnClick);
|
|
|
|
settingsBtn.SetTrigger(&trigA);
|
2009-05-03 20:53:31 +02:00
|
|
|
settingsBtn.SetEffectGrow();
|
2009-05-08 16:23:05 +02:00
|
|
|
settingsBtn.SetToolTip(&settingsBtnTT,65,-30);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
GuiTooltip homeBtnTT(LANGUAGE.BacktoHBCorWiiMenu);
|
2009-05-08 00:46:54 +02:00
|
|
|
if (Settings.wsprompt == yes)
|
2009-05-20 15:14:52 +02:00
|
|
|
homeBtnTT.SetWidescreen(CFG.widescreen);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
GuiImage homeBtnImg(&btnhome);
|
2009-05-20 15:14:52 +02:00
|
|
|
homeBtnImg.SetWidescreen(CFG.widescreen);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage homeBtnImgOver(&btnhomeOver);
|
2009-05-20 15:14:52 +02:00
|
|
|
homeBtnImgOver.SetWidescreen(CFG.widescreen);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton homeBtn(btnhome.GetWidth(), btnhome.GetHeight());
|
|
|
|
homeBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
homeBtn.SetPosition(THEME.home_x, THEME.home_y);
|
|
|
|
homeBtn.SetImage(&homeBtnImg);
|
|
|
|
homeBtn.SetImageOver(&homeBtnImgOver);
|
|
|
|
homeBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
homeBtn.SetTrigger(&trigA);
|
|
|
|
homeBtn.SetTrigger(&trigHome);
|
2009-05-03 20:53:31 +02:00
|
|
|
homeBtn.SetEffectGrow();
|
2009-05-08 16:23:05 +02:00
|
|
|
homeBtn.SetToolTip(&homeBtnTT,15,-30);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
GuiTooltip poweroffBtnTT(LANGUAGE.PowerofftheWii);
|
2009-05-08 00:46:54 +02:00
|
|
|
if (Settings.wsprompt == yes)
|
2009-05-20 15:14:52 +02:00
|
|
|
poweroffBtnTT.SetWidescreen(CFG.widescreen);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
GuiImage poweroffBtnImg(&btnpwroff);
|
|
|
|
GuiImage poweroffBtnImgOver(&btnpwroffOver);
|
|
|
|
poweroffBtnImg.SetWidescreen(CFG.widescreen);
|
|
|
|
poweroffBtnImgOver.SetWidescreen(CFG.widescreen);
|
|
|
|
GuiButton poweroffBtn(btnpwroff.GetWidth(), btnpwroff.GetHeight());
|
|
|
|
poweroffBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
poweroffBtn.SetPosition(THEME.power_x, THEME.power_y);
|
|
|
|
poweroffBtn.SetImage(&poweroffBtnImg);
|
|
|
|
poweroffBtn.SetImageOver(&poweroffBtnImgOver);
|
|
|
|
poweroffBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
poweroffBtn.SetSoundClick(&btnClick);
|
|
|
|
poweroffBtn.SetTrigger(&trigA);
|
2009-05-03 20:53:31 +02:00
|
|
|
poweroffBtn.SetEffectGrow();
|
2009-05-08 16:23:05 +02:00
|
|
|
poweroffBtn.SetToolTip(&poweroffBtnTT,-10,-30);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-04 19:45:50 +02:00
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
GuiTooltip sdcardBtnTT(LANGUAGE.ReloadSD);
|
2009-05-08 00:46:54 +02:00
|
|
|
if (Settings.wsprompt == yes)
|
2009-05-20 15:14:52 +02:00
|
|
|
sdcardBtnTT.SetWidescreen(CFG.widescreen);
|
2009-05-04 19:45:50 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImage sdcardImg(&btnsdcard);
|
|
|
|
sdcardImg.SetWidescreen(CFG.widescreen);
|
|
|
|
GuiButton sdcardBtn(btnsdcard.GetWidth(), btnsdcard.GetHeight());
|
|
|
|
sdcardBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
sdcardBtn.SetPosition(THEME.sdcard_x, THEME.sdcard_y);
|
|
|
|
sdcardBtn.SetImage(&sdcardImg);
|
|
|
|
sdcardBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
sdcardBtn.SetSoundClick(&btnClick);
|
|
|
|
sdcardBtn.SetTrigger(&trigA);
|
|
|
|
sdcardBtn.SetEffectGrow();
|
2009-05-08 16:23:05 +02:00
|
|
|
sdcardBtn.SetToolTip(&sdcardBtnTT,95,-40);
|
2009-05-11 23:19:00 +02:00
|
|
|
|
2009-05-11 21:55:14 +02:00
|
|
|
GuiImage wiiBtnImg(&dataID);
|
|
|
|
wiiBtnImg.SetWidescreen(CFG.widescreen);
|
|
|
|
GuiButton wiiBtn(wiiBtnImg.GetWidth(), wiiBtnImg.GetHeight());
|
2009-05-20 15:14:52 +02:00
|
|
|
wiiBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
2009-05-11 21:55:14 +02:00
|
|
|
wiiBtn.SetPosition(0,-10);
|
|
|
|
wiiBtn.SetImage(&wiiBtnImg);
|
|
|
|
wiiBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
wiiBtn.SetSoundClick(&btnClick);
|
|
|
|
wiiBtn.SetTrigger(&trigA);
|
2009-05-21 10:56:23 +02:00
|
|
|
|
|
|
|
GuiImage favoriteBtnImg(dispFave ? &imgFavoriteOn : &imgFavoriteOff);;
|
|
|
|
favoriteBtnImg.SetWidescreen(CFG.widescreen);
|
|
|
|
GuiButton favoriteBtn(imgFavoriteOn.GetWidth(), imgFavoriteOn.GetHeight());
|
|
|
|
favoriteBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
favoriteBtn.SetPosition(-90, 105);
|
|
|
|
favoriteBtn.SetImage(&favoriteBtnImg);
|
|
|
|
favoriteBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
favoriteBtn.SetSoundClick(&btnClick);
|
|
|
|
favoriteBtn.SetTrigger(&trigA);
|
|
|
|
favoriteBtn.SetEffectGrow();
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
//Downloading Covers
|
2009-05-16 17:38:52 +02:00
|
|
|
GuiTooltip DownloadBtnTT(LANGUAGE.ClicktoDownloadCovers);
|
2009-05-08 00:46:54 +02:00
|
|
|
if (Settings.wsprompt == yes)
|
2009-05-20 15:14:52 +02:00
|
|
|
DownloadBtnTT.SetWidescreen(CFG.widescreen);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton DownloadBtn(160,224);
|
|
|
|
DownloadBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
2009-05-20 15:14:52 +02:00
|
|
|
DownloadBtn.SetPosition(THEME.cover_x,THEME.cover_y);
|
2009-05-04 19:59:53 +02:00
|
|
|
|
2009-05-08 00:46:54 +02:00
|
|
|
if (CFG.godmode == 1)
|
|
|
|
{//only make the button have trigger & tooltip if in godmode
|
|
|
|
DownloadBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
DownloadBtn.SetTrigger(&trigA);
|
2009-05-08 16:23:05 +02:00
|
|
|
DownloadBtn.SetToolTip(&DownloadBtnTT,205,-30);
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
2009-05-08 00:46:54 +02:00
|
|
|
else
|
|
|
|
DownloadBtn.SetRumble(false);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
GuiGameBrowser gameBrowser(THEME.selection_w, THEME.selection_h, gameList, gameCnt, CFG.theme_path, bg_options_png, startat, offset);
|
|
|
|
gameBrowser.SetPosition(THEME.selection_x, THEME.selection_y);
|
|
|
|
gameBrowser.SetAlignment(ALIGN_LEFT, ALIGN_CENTRE);
|
|
|
|
|
2009-05-07 10:53:23 +02:00
|
|
|
GuiText clockTimeBack("88:88", 40, (GXColor){138, 138, 138, 40});
|
2009-05-08 00:46:54 +02:00
|
|
|
clockTimeBack.SetAlignment(THEME.clockAlign, ALIGN_TOP);
|
2009-05-07 00:36:28 +02:00
|
|
|
clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y);
|
|
|
|
clockTimeBack.SetFont(fontClock);
|
|
|
|
|
2009-05-07 10:53:23 +02:00
|
|
|
GuiText clockTime(theTime, 40, (GXColor){138, 138, 138, 240});
|
2009-05-08 00:46:54 +02:00
|
|
|
clockTime.SetAlignment(THEME.clockAlign, ALIGN_TOP);
|
2009-05-03 22:30:17 +02:00
|
|
|
clockTime.SetPosition(THEME.clock_x, THEME.clock_y);
|
2009-05-04 23:50:46 +02:00
|
|
|
clockTime.SetFont(fontClock);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
GuiWindow w(screenwidth, screenheight);
|
|
|
|
|
2009-05-19 12:29:58 +02:00
|
|
|
if(THEME.showHDD == -1 || THEME.showHDD == 1) //force show hdd info
|
2009-05-03 22:30:17 +02:00
|
|
|
{
|
|
|
|
w.Append(&usedSpaceTxt);
|
|
|
|
}
|
2009-05-19 12:29:58 +02:00
|
|
|
if(THEME.showGameCnt == -1 || THEME.showGameCnt == 1) //force show game cnt info
|
2009-05-03 22:30:17 +02:00
|
|
|
{
|
|
|
|
w.Append(&gamecntTxt);
|
|
|
|
}
|
|
|
|
|
|
|
|
w.Append(&sdcardBtn);
|
|
|
|
w.Append(&poweroffBtn);
|
|
|
|
if (CFG.godmode)
|
|
|
|
w.Append(&installBtn);
|
|
|
|
w.Append(&homeBtn);
|
|
|
|
w.Append(&settingsBtn);
|
2009-05-21 10:56:23 +02:00
|
|
|
w.Append(&DownloadBtn);
|
|
|
|
w.Append(&favoriteBtn);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-20 10:31:47 +02:00
|
|
|
if((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24))
|
2009-05-03 22:30:17 +02:00
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
w.Append(&clockTimeBack);
|
2009-05-03 22:30:17 +02:00
|
|
|
w.Append(&clockTime);
|
|
|
|
}
|
2009-05-20 15:14:52 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
mainWindow->Append(&gameBrowser);
|
|
|
|
mainWindow->Append(&w);
|
|
|
|
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(menu == MENU_NONE)
|
|
|
|
{
|
|
|
|
|
|
|
|
VIDEO_WaitVSync ();
|
|
|
|
|
|
|
|
//CLOCK
|
2009-05-08 00:46:54 +02:00
|
|
|
time_t rawtime = time(0); //this fixes code dump caused by the clock
|
2009-05-20 10:31:47 +02:00
|
|
|
if (((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) && rawtime != lastrawtime) {
|
2009-05-08 00:46:54 +02:00
|
|
|
lastrawtime = rawtime;
|
|
|
|
timeinfo = localtime (&rawtime);
|
2009-05-12 01:26:39 +02:00
|
|
|
if (dataed < 1){
|
2009-05-20 10:53:02 +02:00
|
|
|
if(Settings.hddinfo == hr12){
|
|
|
|
if(rawtime & 1)
|
2009-05-20 10:31:47 +02:00
|
|
|
strftime(theTime, sizeof(theTime), "%I:%M", timeinfo);
|
2009-05-20 10:53:02 +02:00
|
|
|
else
|
|
|
|
strftime(theTime, sizeof(theTime), "%I %M", timeinfo);
|
|
|
|
}
|
|
|
|
if(Settings.hddinfo == hr24){
|
|
|
|
if(rawtime & 1)
|
2009-05-12 01:26:39 +02:00
|
|
|
strftime(theTime, sizeof(theTime), "%H:%M", timeinfo);
|
2009-05-20 10:53:02 +02:00
|
|
|
else
|
2009-05-12 01:26:39 +02:00
|
|
|
strftime(theTime, sizeof(theTime), "%H %M", timeinfo);
|
2009-05-20 10:53:02 +02:00
|
|
|
}
|
2009-05-12 01:26:39 +02:00
|
|
|
clockTime.SetText(theTime);
|
2009-05-20 15:14:52 +02:00
|
|
|
|
2009-05-12 01:26:39 +02:00
|
|
|
}
|
|
|
|
else if (dataed > 0){
|
2009-05-12 08:23:22 +02:00
|
|
|
|
2009-05-12 01:26:39 +02:00
|
|
|
sprintf(buf, "%i", (dataed-1));
|
|
|
|
clockTime.SetText(buf);
|
|
|
|
}
|
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
2009-05-20 15:14:52 +02:00
|
|
|
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);}}
|
2009-05-04 05:45:45 +02:00
|
|
|
// respond to button presses
|
2009-05-03 22:30:17 +02:00
|
|
|
if(shutdown == 1)
|
|
|
|
{
|
|
|
|
Sys_Shutdown();
|
|
|
|
}
|
|
|
|
if(reset == 1)
|
|
|
|
Sys_Reboot();
|
2009-05-04 19:45:50 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
if(poweroffBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
choice = WindowPrompt(LANGUAGE.HowtoShutdown,0,LANGUAGE.FullShutdown, LANGUAGE.ShutdowntoIdle, LANGUAGE.Cancel,0);
|
2009-05-09 14:11:43 +02:00
|
|
|
if(choice == 2)
|
2009-05-03 22:30:17 +02:00
|
|
|
{
|
|
|
|
WPAD_Flush(0);
|
|
|
|
WPAD_Disconnect(0);
|
|
|
|
WPAD_Shutdown();
|
2009-05-06 11:51:16 +02:00
|
|
|
|
|
|
|
/* Set LED mode */
|
|
|
|
ret = CONF_GetIdleLedMode();
|
|
|
|
if(ret >= 0 && ret <= 2)
|
|
|
|
STM_SetLedMode(ret);
|
|
|
|
|
2009-05-06 09:12:09 +02:00
|
|
|
STM_ShutdownToIdle();
|
2009-05-06 11:51:16 +02:00
|
|
|
|
2009-05-09 14:11:43 +02:00
|
|
|
} else if(choice == 1) {
|
2009-05-06 09:12:09 +02:00
|
|
|
WPAD_Flush(0);
|
|
|
|
WPAD_Disconnect(0);
|
|
|
|
WPAD_Shutdown();
|
|
|
|
STM_ShutdownToStandby();
|
2009-05-03 22:30:17 +02:00
|
|
|
} else {
|
|
|
|
poweroffBtn.ResetState();
|
|
|
|
gameBrowser.SetFocus(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else if(homeBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-05-20 02:03:43 +02:00
|
|
|
s32 thetimeofbg = bgMusic->GetPlayTime();
|
2009-05-18 22:00:29 +02:00
|
|
|
bgMusic->Stop();
|
2009-05-18 14:09:37 +02:00
|
|
|
choice = WindowExitPrompt(LANGUAGE.ExitUSBISOLoader,0, LANGUAGE.BacktoLoader,LANGUAGE.WiiMenu,LANGUAGE.Back,0);
|
2009-05-20 02:03:43 +02:00
|
|
|
if(!strcmp("", CFG.oggload_path) || !strcmp("notset", CFG.ogg_path)) {
|
|
|
|
bgMusic->Play();
|
|
|
|
} else {
|
|
|
|
bgMusic->PlayOggFile(CFG.ogg_path);
|
|
|
|
}
|
|
|
|
bgMusic->SetPlayTime(thetimeofbg);
|
|
|
|
SetVolumeOgg(255*(vol/100.0));
|
|
|
|
|
2009-05-18 14:09:37 +02:00
|
|
|
if(choice == 3)
|
2009-05-03 22:30:17 +02:00
|
|
|
{
|
|
|
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); // Back to System Menu
|
|
|
|
}
|
2009-05-18 14:09:37 +02:00
|
|
|
else if (choice == 2)
|
2009-05-03 22:30:17 +02:00
|
|
|
{
|
|
|
|
if (*(unsigned int*) 0x80001800) exit(0);
|
|
|
|
// Channel Version
|
|
|
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
|
|
|
} else {
|
|
|
|
homeBtn.ResetState();
|
|
|
|
gameBrowser.SetFocus(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2009-05-12 01:26:39 +02:00
|
|
|
else if(wiiBtn.GetState() == STATE_CLICKED)
|
|
|
|
{ dataed++;
|
|
|
|
wiiBtn.ResetState();
|
|
|
|
gameBrowser.SetFocus(1);
|
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
else if(installBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-05-16 17:38:52 +02:00
|
|
|
choice = WindowPrompt(LANGUAGE.Installagame,0,LANGUAGE.Yes,LANGUAGE.No,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
if (choice == 1)
|
|
|
|
{
|
|
|
|
menu = MENU_INSTALL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
installBtn.ResetState();
|
|
|
|
gameBrowser.SetFocus(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(sdcardBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-05-15 22:03:19 +02:00
|
|
|
SDCard_deInit();
|
|
|
|
SDCard_Init();
|
|
|
|
sdcardBtn.ResetState();
|
2009-05-20 15:14:52 +02:00
|
|
|
menu = MENU_DISCLIST;
|
|
|
|
break;
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
else if(DownloadBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-05-08 19:06:39 +02:00
|
|
|
if(isSdInserted() == 1) {
|
2009-05-16 17:38:52 +02:00
|
|
|
choice = WindowPrompt(LANGUAGE.CoverDownload, 0, LANGUAGE.NormalCovers, LANGUAGE.t3Covers, LANGUAGE.DiscImages, LANGUAGE.Back); // ask for download choice
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
if (choice != 0)
|
|
|
|
{
|
2009-05-06 11:51:16 +02:00
|
|
|
int netset;
|
2009-05-03 22:30:17 +02:00
|
|
|
int choice2 = choice;
|
|
|
|
|
2009-05-06 11:51:16 +02:00
|
|
|
netset = NetworkInitPromp(choice2);
|
2009-05-03 22:30:17 +02:00
|
|
|
networkisinitialized = 1;
|
2009-05-06 11:51:16 +02:00
|
|
|
|
|
|
|
if(netset < 0)
|
2009-05-03 22:30:17 +02:00
|
|
|
{
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.Networkiniterror, 0, LANGUAGE.ok,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
netcheck = false;
|
2009-05-06 11:51:16 +02:00
|
|
|
|
|
|
|
} else {
|
|
|
|
netcheck = true;
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (netcheck)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (missingFiles != NULL && cntMissFiles > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
char tempCnt[40];
|
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
sprintf(tempCnt,"%i %s",cntMissFiles,LANGUAGE.Missingfiles);
|
|
|
|
choice = WindowPrompt(LANGUAGE.DownloadBoxartimage,tempCnt,LANGUAGE.Yes,LANGUAGE.No,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
if (choice == 1)
|
|
|
|
{
|
|
|
|
ret = ProgressDownloadWindow(choice2);
|
|
|
|
if (ret == 0) {
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.Downloadfinished,0,LANGUAGE.ok,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
} else {
|
2009-05-16 17:38:52 +02:00
|
|
|
sprintf(tempCnt,"%i %s",ret,LANGUAGE.filesnotfoundontheserver);
|
|
|
|
WindowPrompt(LANGUAGE.Downloadfinished,tempCnt,LANGUAGE.ok,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.Nofilemissing,0,LANGUAGE.ok,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-05-08 19:06:39 +02:00
|
|
|
} else {
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtodownloadimages, LANGUAGE.ok, 0,0,0);
|
2009-05-08 19:06:39 +02:00
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
DownloadBtn.ResetState();
|
|
|
|
gameBrowser.SetFocus(1);
|
|
|
|
}//end download
|
|
|
|
|
|
|
|
else if(settingsBtn.GetState() == STATE_CLICKED)
|
|
|
|
{ startat = gameBrowser.GetSelectedOption();
|
|
|
|
offset = gameBrowser.GetOffset();
|
|
|
|
menu = MENU_SETTINGS;
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-05-21 10:56:23 +02:00
|
|
|
else if(favoriteBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
dispFave = !dispFave;
|
|
|
|
__Menu_GetEntries();
|
|
|
|
gameBrowser.Reload(gameList, gameCnt);
|
|
|
|
sprintf(GamesCnt,"%s: %i",LANGUAGE.Games, gameCnt);
|
|
|
|
gamecntTxt.SetText(GamesCnt);
|
2009-05-21 22:18:58 +02:00
|
|
|
selectedold=-1;
|
2009-05-21 10:56:23 +02:00
|
|
|
favoriteBtnImg.SetImage(dispFave ? &imgFavoriteOn : &imgFavoriteOff);
|
|
|
|
favoriteBtn.ResetState();
|
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
//Get selected game under cursor
|
2009-05-04 05:45:45 +02:00
|
|
|
int selectimg;//, promptnumber;
|
2009-05-03 22:30:17 +02:00
|
|
|
char ID[4];
|
|
|
|
char IDfull[7];
|
|
|
|
selectimg = gameBrowser.GetSelectedOption();
|
|
|
|
gameSelected = gameBrowser.GetClickedOption();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (gameSelected > 0) //if click occured
|
|
|
|
selectimg = gameSelected;
|
|
|
|
|
|
|
|
if ((selectimg >= 0) && (selectimg < (s32) gameCnt))
|
|
|
|
{
|
|
|
|
if (selectimg != selectedold)
|
|
|
|
{
|
2009-05-04 05:45:45 +02:00
|
|
|
selectedold = selectimg;//update displayed cover, game ID, and region if the selected game changes
|
2009-05-03 22:30:17 +02:00
|
|
|
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),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
|
|
|
w.Remove(&DownloadBtn);
|
|
|
|
|
|
|
|
if (GameIDTxt)
|
|
|
|
{
|
|
|
|
w.Remove(GameIDTxt);
|
|
|
|
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;
|
2009-05-11 23:19:00 +02:00
|
|
|
|
2009-05-11 21:55:14 +02:00
|
|
|
case 'K':
|
|
|
|
sprintf(gameregion,"NTSC K");
|
|
|
|
break;
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
case 'P':
|
|
|
|
case 'D':
|
|
|
|
case 'F':
|
|
|
|
case 'X':
|
|
|
|
case 'S':
|
|
|
|
case 'Y':
|
|
|
|
sprintf(gameregion," PAL ");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
//load game cover
|
|
|
|
if (cover)
|
|
|
|
{
|
|
|
|
delete cover;
|
|
|
|
cover = NULL;
|
|
|
|
}
|
|
|
|
|
2009-05-10 09:23:01 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull);
|
2009-05-03 22:30:17 +02:00
|
|
|
cover = new GuiImageData(imgPath,0); //load short id
|
|
|
|
if (!cover->GetImage()) //if could not load the short id image
|
|
|
|
{
|
|
|
|
delete cover;
|
2009-05-10 09:23:01 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID);
|
2009-05-03 22:30:17 +02:00
|
|
|
cover = new GuiImageData(imgPath, 0); //load full id image
|
|
|
|
if (!cover->GetImage())
|
|
|
|
{
|
|
|
|
delete cover;
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path);
|
|
|
|
cover = new GuiImageData(imgPath, nocover_png); //load no image
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (coverImg)
|
|
|
|
{
|
|
|
|
delete coverImg;
|
|
|
|
coverImg = NULL;
|
|
|
|
}
|
|
|
|
coverImg = new GuiImage(cover);
|
2009-05-03 20:53:31 +02:00
|
|
|
coverImg->SetWidescreen(CFG.widescreen);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-04 05:45:45 +02:00
|
|
|
DownloadBtn.SetImage(coverImg);// put the new image on the download button
|
2009-05-03 22:30:17 +02:00
|
|
|
w.Append(&DownloadBtn);
|
|
|
|
|
|
|
|
if ((Settings.sinfo == GameID) || (Settings.sinfo == Both)){
|
|
|
|
GameIDTxt = new GuiText(IDfull, 22, (GXColor){THEME.info_r, THEME.info_g, THEME.info_b, 255});
|
|
|
|
GameIDTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
GameIDTxt->SetPosition(THEME.id_x,THEME.id_y);
|
|
|
|
GameIDTxt->SetEffect(EFFECT_FADE, 20);
|
|
|
|
w.Append(GameIDTxt);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((Settings.sinfo == GameRegion) || (Settings.sinfo == Both)){
|
|
|
|
GameRegionTxt = new GuiText(gameregion, 22, (GXColor){THEME.info_r, THEME.info_g, THEME.info_b, 255});
|
|
|
|
GameRegionTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
GameRegionTxt->SetPosition(THEME.region_x, THEME.region_y);
|
|
|
|
GameRegionTxt->SetEffect(EFFECT_FADE, 20);
|
|
|
|
w.Append(GameRegionTxt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((gameSelected >= 0) && (gameSelected < (s32)gameCnt))
|
|
|
|
{
|
|
|
|
struct discHdr *header = &gameList[gameSelected];
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2009-05-05 08:24:23 +02:00
|
|
|
if (Settings.qboot == yes)//quickboot game
|
|
|
|
{
|
|
|
|
|
|
|
|
wiilight(0);
|
2009-05-20 10:31:47 +02:00
|
|
|
//////////save game play count////////////////
|
|
|
|
extern u8 favorite;
|
|
|
|
extern u8 count;
|
|
|
|
struct Game_NUM* game_num = CFG_get_game_num(header->id);
|
|
|
|
|
|
|
|
if (game_num)
|
|
|
|
{
|
|
|
|
favorite = game_num->favorite;
|
|
|
|
count = game_num->count;//count+=1;
|
2009-05-20 15:14:52 +02:00
|
|
|
|
2009-05-20 10:31:47 +02:00
|
|
|
}count+=1;
|
2009-05-20 15:14:52 +02:00
|
|
|
|
2009-05-20 10:31:47 +02:00
|
|
|
if(isSdInserted() == 1) {
|
|
|
|
if (CFG_save_game_num(header->id))
|
|
|
|
{
|
|
|
|
//WindowPrompt(LANGUAGE.SuccessfullySaved, 0, LANGUAGE.ok, 0,0,0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WindowPrompt(LANGUAGE.SaveFailed, 0, LANGUAGE.ok, 0,0,0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
////////////end save play count//////////////
|
2009-05-05 08:24:23 +02:00
|
|
|
|
2009-05-11 23:19:00 +02:00
|
|
|
struct Game_CFG* game_cfg = CFG_get_game_opt(header->id);
|
|
|
|
|
|
|
|
if (game_cfg)//if there are saved settings for this game use them
|
|
|
|
{
|
|
|
|
iosChoice = game_cfg->ios;
|
|
|
|
}
|
|
|
|
else// otherwise use the global settings
|
|
|
|
{
|
|
|
|
if(Settings.cios == ios222) {
|
|
|
|
iosChoice = i222;
|
|
|
|
} else {
|
|
|
|
iosChoice = i249;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-05 08:24:23 +02:00
|
|
|
int ios2;
|
|
|
|
switch(iosChoice)
|
|
|
|
{
|
|
|
|
case i249:
|
|
|
|
ios2 = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case i222:
|
|
|
|
ios2 = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
ios2 = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// if we have used the network or cios222 we need to reload the disklist
|
|
|
|
if(networkisinitialized == 1 || ios2 == 1 || Settings.cios == ios222) {
|
|
|
|
|
|
|
|
|
|
|
|
if(ios2 == 1) {
|
|
|
|
|
2009-05-06 11:51:16 +02:00
|
|
|
ret = Sys_IosReload(222);
|
2009-05-05 08:24:23 +02:00
|
|
|
|
2009-05-06 11:51:16 +02:00
|
|
|
if(ret < 0) {
|
2009-05-05 08:24:23 +02:00
|
|
|
Wpad_Init();
|
|
|
|
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
|
|
|
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.YoudonthavecIOS,LANGUAGE.LoadingincIOS,LANGUAGE.ok, 0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-06 11:51:16 +02:00
|
|
|
Sys_IosReload(249);
|
2009-05-05 08:24:23 +02:00
|
|
|
ios2 = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
2009-05-06 11:51:16 +02:00
|
|
|
ret = Sys_IosReload(249);
|
2009-05-05 08:24:23 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set USB mode */
|
|
|
|
ret = Disc_SetUSB(header->id, ios2);
|
|
|
|
if (ret < 0) {
|
2009-05-16 17:38:52 +02:00
|
|
|
sprintf(text, "%s %i", LANGUAGE.Error,ret);
|
2009-05-05 08:24:23 +02:00
|
|
|
WindowPrompt(
|
2009-05-16 17:38:52 +02:00
|
|
|
LANGUAGE.FailedtosetUSB,
|
2009-05-05 08:24:23 +02:00
|
|
|
text,
|
2009-05-16 17:38:52 +02:00
|
|
|
LANGUAGE.ok,0,0,0);
|
2009-05-05 08:24:23 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Open disc */
|
|
|
|
ret = Disc_Open();
|
|
|
|
if (ret < 0) {
|
2009-05-16 17:38:52 +02:00
|
|
|
sprintf(text, "%s %i",LANGUAGE.Error, ret);
|
2009-05-05 08:24:23 +02:00
|
|
|
WindowPrompt(
|
2009-05-16 17:38:52 +02:00
|
|
|
LANGUAGE.Failedtoboot,
|
2009-05-05 08:24:23 +02:00
|
|
|
text,
|
2009-05-16 17:38:52 +02:00
|
|
|
LANGUAGE.ok,0,0,0);
|
2009-05-05 08:24:23 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
menu = MENU_EXIT;
|
|
|
|
}
|
2009-05-06 11:51:16 +02:00
|
|
|
}
|
|
|
|
break;
|
2009-05-05 10:04:07 +02:00
|
|
|
}
|
2009-05-05 08:24:23 +02:00
|
|
|
bool returnHere = true;// prompt to start game
|
2009-05-03 22:30:17 +02:00
|
|
|
while (returnHere)
|
|
|
|
{
|
2009-05-20 15:14:52 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
returnHere = false;
|
|
|
|
wiilight(1);
|
|
|
|
choice = GameWindowPrompt();
|
|
|
|
header = &gameList[gameSelected]; //reset header
|
|
|
|
|
|
|
|
if(choice == 1)
|
|
|
|
{
|
|
|
|
|
2009-05-03 20:53:31 +02:00
|
|
|
wiilight(0);
|
2009-05-21 00:30:47 +02:00
|
|
|
struct Game_CFG* game_cfg = CFG_get_game_opt(header->id);
|
|
|
|
if (game_cfg)//if there are saved settings for this game use them
|
2009-05-11 23:19:00 +02:00
|
|
|
{
|
|
|
|
iosChoice = game_cfg->ios;
|
|
|
|
}
|
|
|
|
else// otherwise use the global settings
|
|
|
|
{
|
|
|
|
if(Settings.cios == ios222) {
|
|
|
|
iosChoice = i222;
|
|
|
|
} else {
|
|
|
|
iosChoice = i249;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-04 19:45:50 +02:00
|
|
|
int ios2;
|
2009-05-03 20:53:31 +02:00
|
|
|
switch(iosChoice)
|
|
|
|
{
|
|
|
|
case i249:
|
|
|
|
ios2 = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case i222:
|
|
|
|
ios2 = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
ios2 = 0;
|
|
|
|
break;
|
|
|
|
}
|
2009-05-04 19:45:50 +02:00
|
|
|
|
2009-05-06 11:51:16 +02:00
|
|
|
// if we have used the network or cios222 we need to reload the disklist
|
2009-05-03 20:53:31 +02:00
|
|
|
if(networkisinitialized == 1 || ios2 == 1 || Settings.cios == ios222) {
|
|
|
|
|
|
|
|
|
|
|
|
if(ios2 == 1) {
|
2009-05-04 19:45:50 +02:00
|
|
|
|
2009-05-06 11:51:16 +02:00
|
|
|
ret = Sys_IosReload(222);
|
2009-05-04 19:45:50 +02:00
|
|
|
|
2009-05-06 11:51:16 +02:00
|
|
|
if(ret < 0) {
|
2009-05-04 19:45:50 +02:00
|
|
|
Wpad_Init();
|
|
|
|
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
|
|
|
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.YoudonthavecIOS,LANGUAGE.LoadingincIOS,LANGUAGE.ok, 0,0,0);
|
2009-05-04 19:45:50 +02:00
|
|
|
|
2009-05-06 11:51:16 +02:00
|
|
|
Sys_IosReload(249);
|
2009-05-04 19:45:50 +02:00
|
|
|
ios2 = 0;
|
|
|
|
}
|
|
|
|
|
2009-05-03 20:53:31 +02:00
|
|
|
} else {
|
2009-05-04 19:45:50 +02:00
|
|
|
|
2009-05-06 11:51:16 +02:00
|
|
|
ret = Sys_IosReload(249);
|
2009-05-04 19:45:50 +02:00
|
|
|
|
2009-05-06 11:51:16 +02:00
|
|
|
}
|
2009-05-03 20:53:31 +02:00
|
|
|
}
|
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* Set USB mode */
|
|
|
|
ret = Disc_SetUSB(header->id, ios2);
|
|
|
|
if (ret < 0) {
|
2009-05-16 17:38:52 +02:00
|
|
|
sprintf(text, "%s %i", LANGUAGE.Error, ret);
|
2009-05-03 22:30:17 +02:00
|
|
|
WindowPrompt(
|
2009-05-16 17:38:52 +02:00
|
|
|
LANGUAGE.FailedtosetUSB,
|
2009-05-03 22:30:17 +02:00
|
|
|
text,
|
2009-05-16 17:38:52 +02:00
|
|
|
LANGUAGE.ok,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Open disc */
|
|
|
|
ret = Disc_Open();
|
|
|
|
if (ret < 0) {
|
2009-05-16 17:38:52 +02:00
|
|
|
sprintf(text, "%s %i",LANGUAGE.Error, ret);
|
2009-05-03 22:30:17 +02:00
|
|
|
WindowPrompt(
|
2009-05-16 17:38:52 +02:00
|
|
|
LANGUAGE.Failedtoboot,
|
2009-05-03 22:30:17 +02:00
|
|
|
text,
|
2009-05-16 17:38:52 +02:00
|
|
|
LANGUAGE.ok,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
menu = MENU_EXIT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (choice == 2)
|
|
|
|
{
|
|
|
|
wiilight(0);
|
|
|
|
if (GameSettings(header) == 1) //if deleted
|
|
|
|
{
|
|
|
|
menu = MENU_DISCLIST;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
returnHere = true;
|
|
|
|
}
|
|
|
|
|
2009-05-04 05:45:45 +02:00
|
|
|
else if (choice == 3) //WBFS renaming
|
2009-05-03 22:30:17 +02:00
|
|
|
{
|
|
|
|
wiilight(0);
|
2009-05-04 05:45:45 +02:00
|
|
|
//enter new game title
|
2009-05-17 19:40:19 +02:00
|
|
|
char entered[60];
|
2009-05-03 22:30:17 +02:00
|
|
|
snprintf(entered, sizeof(entered), "%s", get_title(header));
|
2009-05-17 19:40:19 +02:00
|
|
|
entered[59] = '\0';
|
|
|
|
int result = OnScreenKeyboard(entered, 60,0);
|
2009-05-16 23:04:43 +02:00
|
|
|
if (result == 1) {
|
2009-05-03 22:30:17 +02:00
|
|
|
WBFS_RenameGame(header->id, entered);
|
|
|
|
__Menu_GetEntries();
|
|
|
|
menu = MENU_DISCLIST;
|
2009-05-16 23:04:43 +02:00
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
else if(choice == 0)
|
|
|
|
gameBrowser.SetFocus(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-15 22:03:19 +02:00
|
|
|
HaltGui();
|
2009-05-03 22:30:17 +02:00
|
|
|
mainWindow->Remove(&gameBrowser);
|
|
|
|
mainWindow->Remove(&w);
|
|
|
|
ResumeGui();
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* MenuFormat
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
static int MenuFormat()
|
|
|
|
{
|
|
|
|
int menu = MENU_NONE;
|
|
|
|
char imgPath[100];
|
|
|
|
|
|
|
|
OptionList options;
|
|
|
|
partitionEntry partitions[MAX_PARTITIONS];
|
|
|
|
|
|
|
|
u32 cnt, sector_size, selected = 2000;
|
|
|
|
int choice, ret;
|
|
|
|
char text[ISFS_MAXPATH];
|
|
|
|
|
|
|
|
s32 ret2;
|
|
|
|
ret2 = Partition_GetEntries(partitions, §or_size);
|
|
|
|
|
|
|
|
//create the partitionlist
|
|
|
|
for (cnt = 0; cnt < MAX_PARTITIONS; cnt++) {
|
|
|
|
partitionEntry *entry = &partitions[cnt];
|
|
|
|
|
|
|
|
/* Calculate size in gigabytes */
|
|
|
|
f32 size = entry->size * (sector_size / GB_SIZE);
|
|
|
|
|
|
|
|
if (size) {
|
2009-05-16 17:38:52 +02:00
|
|
|
sprintf(options.name[cnt], "%s %d:",LANGUAGE.Partition, cnt+1);
|
2009-05-03 22:30:17 +02:00
|
|
|
sprintf (options.value[cnt],"%.2fGB", size);
|
|
|
|
} else {
|
2009-05-16 17:38:52 +02:00
|
|
|
sprintf(options.name[cnt], "%s %d:",LANGUAGE.Partition, cnt+1);
|
|
|
|
sprintf (options.value[cnt],LANGUAGE.Cantbeformated);
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
options.length = cnt;
|
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol);
|
|
|
|
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, vol);
|
|
|
|
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);
|
|
|
|
GuiImageData battery(battery_png);
|
|
|
|
GuiImageData batteryRed(battery_red_png);
|
|
|
|
GuiImageData batteryBar(battery_bar_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, 0);
|
|
|
|
|
|
|
|
GuiImage poweroffBtnImg(&btnpwroff);
|
|
|
|
GuiImage poweroffBtnImgOver(&btnpwroffOver);
|
|
|
|
poweroffBtnImg.SetWidescreen(CFG.widescreen);
|
|
|
|
poweroffBtnImgOver.SetWidescreen(CFG.widescreen);
|
|
|
|
GuiButton poweroffBtn(btnpwroff.GetWidth(), btnpwroff.GetHeight());
|
|
|
|
poweroffBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
poweroffBtn.SetPosition(THEME.power_x, THEME.power_y);
|
|
|
|
poweroffBtn.SetImage(&poweroffBtnImg);
|
|
|
|
poweroffBtn.SetImageOver(&poweroffBtnImgOver);
|
|
|
|
poweroffBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
poweroffBtn.SetSoundClick(&btnClick);
|
|
|
|
poweroffBtn.SetTrigger(&trigA);
|
|
|
|
poweroffBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiImage exitBtnImg(&btnhome);
|
|
|
|
GuiImage exitBtnImgOver(&btnhomeOver);
|
|
|
|
exitBtnImg.SetWidescreen(CFG.widescreen);
|
|
|
|
exitBtnImgOver.SetWidescreen(CFG.widescreen);
|
|
|
|
GuiButton exitBtn(btnhome.GetWidth(), btnhome.GetHeight());
|
2009-05-15 22:03:19 +02:00
|
|
|
exitBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
exitBtn.SetPosition(0, -10);
|
2009-05-03 22:30:17 +02:00
|
|
|
exitBtn.SetImage(&exitBtnImg);
|
|
|
|
exitBtn.SetImageOver(&exitBtnImgOver);
|
|
|
|
exitBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
exitBtn.SetSoundClick(&btnClick);
|
|
|
|
exitBtn.SetTrigger(&trigA);
|
|
|
|
exitBtn.SetTrigger(&trigHome);
|
|
|
|
exitBtn.SetEffectGrow();
|
2009-05-03 20:53:31 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
#ifdef HW_RVL
|
|
|
|
int i = 0, level;
|
|
|
|
char txt[3];
|
|
|
|
GuiText * batteryTxt[4];
|
|
|
|
GuiImage * batteryImg[4];
|
|
|
|
GuiImage * batteryBarImg[4];
|
|
|
|
GuiButton * batteryBtn[4];
|
|
|
|
|
|
|
|
for(i=0; i < 4; i++)
|
|
|
|
{
|
|
|
|
|
|
|
|
if(i == 0)
|
|
|
|
sprintf(txt, "P%d", i+1);
|
|
|
|
else
|
|
|
|
sprintf(txt, "P%d", i+1);
|
|
|
|
|
|
|
|
batteryTxt[i] = new GuiText(txt, 22, (GXColor){THEME.info_r, THEME.info_g, THEME.info_b, 255});
|
|
|
|
batteryTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
batteryImg[i] = new GuiImage(&battery);
|
|
|
|
batteryImg[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
batteryImg[i]->SetPosition(36, 0);
|
|
|
|
batteryImg[i]->SetTile(0);
|
|
|
|
batteryBarImg[i] = new GuiImage(&batteryBar);
|
|
|
|
batteryBarImg[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
batteryBarImg[i]->SetPosition(33, 0);
|
|
|
|
|
|
|
|
batteryBtn[i] = new GuiButton(40, 20);
|
|
|
|
batteryBtn[i]->SetLabel(batteryTxt[i]);
|
|
|
|
batteryBtn[i]->SetImage(batteryBarImg[i]);
|
|
|
|
batteryBtn[i]->SetIcon(batteryImg[i]);
|
|
|
|
batteryBtn[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
batteryBtn[i]->SetRumble(false);
|
|
|
|
batteryBtn[i]->SetAlpha(70);
|
|
|
|
}
|
|
|
|
|
|
|
|
batteryBtn[0]->SetPosition(THEME.battery1_x, THEME.battery1_y);
|
|
|
|
batteryBtn[1]->SetPosition(THEME.battery2_x, THEME.battery2_y);
|
|
|
|
batteryBtn[2]->SetPosition(THEME.battery3_x, THEME.battery3_y);
|
|
|
|
batteryBtn[3]->SetPosition(THEME.battery4_x, THEME.battery4_y);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
GuiOptionBrowser optionBrowser(THEME.selection_w, THEME.selection_h, &options, CFG.theme_path, bg_options_png, 1, 0);
|
|
|
|
optionBrowser.SetPosition(THEME.selection_x, THEME.selection_y);
|
|
|
|
optionBrowser.SetAlignment(ALIGN_LEFT, ALIGN_CENTRE);
|
2009-05-15 22:03:19 +02:00
|
|
|
optionBrowser.SetCol2Position(200);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
GuiWindow w(screenwidth, screenheight);
|
|
|
|
w.Append(&poweroffBtn);
|
|
|
|
w.Append(&exitBtn);
|
|
|
|
|
|
|
|
if (THEME.showBattery)
|
|
|
|
{
|
|
|
|
#ifdef HW_RVL
|
|
|
|
w.Append(batteryBtn[0]);
|
|
|
|
w.Append(batteryBtn[1]);
|
|
|
|
w.Append(batteryBtn[2]);
|
|
|
|
w.Append(batteryBtn[3]);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
mainWindow->Append(&w);
|
|
|
|
mainWindow->Append(&optionBrowser);
|
|
|
|
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(menu == MENU_NONE)
|
|
|
|
{
|
|
|
|
VIDEO_WaitVSync ();
|
|
|
|
|
|
|
|
#ifdef HW_RVL
|
|
|
|
for(i=0; i < 4; i++)
|
|
|
|
{
|
|
|
|
if(WPAD_Probe(i, NULL) == WPAD_ERR_NONE) // controller connected
|
|
|
|
{
|
|
|
|
level = (userInput[i].wpad.battery_level / 100.0) * 4;
|
|
|
|
if(level > 4) level = 4;
|
|
|
|
batteryImg[i]->SetTile(level);
|
|
|
|
|
|
|
|
if(level == 0)
|
|
|
|
batteryBarImg[i]->SetImage(&batteryRed);
|
|
|
|
else
|
|
|
|
batteryBarImg[i]->SetImage(&batteryBar);
|
|
|
|
|
|
|
|
batteryBtn[i]->SetAlpha(255);
|
|
|
|
}
|
|
|
|
else // controller not connected
|
|
|
|
{
|
|
|
|
batteryImg[i]->SetTile(0);
|
|
|
|
batteryImg[i]->SetImage(&battery);
|
|
|
|
batteryBtn[i]->SetAlpha(70);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
selected = optionBrowser.GetClickedOption();
|
|
|
|
|
|
|
|
for (cnt = 0; cnt < MAX_PARTITIONS; cnt++) {
|
|
|
|
if (cnt == selected) {
|
|
|
|
partitionEntry *entry = &partitions[selected];
|
|
|
|
if (entry->size) {
|
2009-05-16 17:38:52 +02:00
|
|
|
sprintf(text, "%s %d : %.2fGB",LANGUAGE.Partition, selected+1, entry->size * (sector_size / GB_SIZE));
|
2009-05-03 22:30:17 +02:00
|
|
|
choice = WindowPrompt(
|
2009-05-16 17:38:52 +02:00
|
|
|
LANGUAGE.Doyouwanttoformat,
|
2009-05-03 22:30:17 +02:00
|
|
|
text,
|
2009-05-16 17:38:52 +02:00
|
|
|
LANGUAGE.Yes,
|
|
|
|
LANGUAGE.No,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
if(choice == 1) {
|
2009-05-16 17:38:52 +02:00
|
|
|
ret = FormatingPartition(LANGUAGE.Formattingpleasewait, entry);
|
2009-05-03 22:30:17 +02:00
|
|
|
if (ret < 0) {
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.Error,LANGUAGE.Failedformating,LANGUAGE.Return,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
menu = MENU_SETTINGS;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
WBFS_Open();
|
2009-05-16 17:38:52 +02:00
|
|
|
sprintf(text, "%s %s", text,LANGUAGE.formated);
|
|
|
|
WindowPrompt(LANGUAGE.Success,text,LANGUAGE.ok,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
menu = MENU_DISCLIST;
|
|
|
|
}
|
2009-05-03 20:53:31 +02:00
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (shutdown == 1)
|
|
|
|
Sys_Shutdown();
|
|
|
|
if(reset == 1)
|
|
|
|
Sys_Reboot();
|
2009-05-04 19:45:50 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
if(poweroffBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-05-16 17:38:52 +02:00
|
|
|
choice = WindowPrompt (LANGUAGE.ShutdownSystem,LANGUAGE.Areyousure,LANGUAGE.Yes,LANGUAGE.No,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
if(choice == 1)
|
|
|
|
{
|
|
|
|
WPAD_Flush(0);
|
|
|
|
WPAD_Disconnect(0);
|
|
|
|
WPAD_Shutdown();
|
|
|
|
Sys_Shutdown();
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if(exitBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-05-16 17:38:52 +02:00
|
|
|
choice = WindowPrompt (LANGUAGE.ReturntoWiiMenu,LANGUAGE.Areyousure,LANGUAGE.Yes,LANGUAGE.No,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
if(choice == 1)
|
|
|
|
{
|
|
|
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
|
|
|
|
#ifdef HW_RVL
|
|
|
|
for(i=0; i < 4; i++)
|
|
|
|
{
|
|
|
|
delete batteryTxt[i];
|
|
|
|
delete batteryImg[i];
|
|
|
|
delete batteryBarImg[i];
|
|
|
|
delete batteryBtn[i];
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
mainWindow->Remove(&optionBrowser);
|
|
|
|
mainWindow->Remove(&w);
|
|
|
|
ResumeGui();
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* MenuSettings
|
|
|
|
***************************************************************************/
|
|
|
|
static int MenuSettings()
|
|
|
|
{
|
|
|
|
int menu = MENU_NONE;
|
|
|
|
int ret;
|
2009-05-10 12:47:15 +02:00
|
|
|
char cfgtext[20];
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol);
|
|
|
|
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, vol);
|
|
|
|
|
|
|
|
char imgPath[100];
|
|
|
|
|
2009-05-18 22:00:29 +02:00
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
|
|
|
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
2009-05-03 22:30:17 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%ssettings_background.png", CFG.theme_path);
|
|
|
|
GuiImageData settingsbg(imgPath, settings_background_png);
|
2009-05-11 21:55:14 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%stab_bg1.png", CFG.theme_path);
|
|
|
|
GuiImageData tab1(imgPath, tab_bg1_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%stab_bg2.png", CFG.theme_path);
|
|
|
|
GuiImageData tab2(imgPath, tab_bg2_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%stab_bg3.png", CFG.theme_path);
|
|
|
|
GuiImageData tab3(imgPath, tab_bg3_png);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
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, 0);
|
|
|
|
GuiTrigger trigB;
|
|
|
|
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
2009-05-09 15:55:25 +02:00
|
|
|
GuiTrigger trigL;
|
|
|
|
trigL.SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT);
|
|
|
|
GuiTrigger trigR;
|
2009-05-10 00:37:14 +02:00
|
|
|
trigR.SetButtonOnlyTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT);
|
|
|
|
GuiTrigger trigMinus;
|
|
|
|
trigMinus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, 0);
|
|
|
|
GuiTrigger trigPlus;
|
|
|
|
trigPlus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, 0);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
GuiText titleTxt(LANGUAGE.settings, 28, (GXColor){0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(0,40);
|
|
|
|
|
|
|
|
GuiImage settingsbackground(&settingsbg);
|
|
|
|
GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
|
|
|
|
settingsbackgroundbtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
settingsbackgroundbtn.SetPosition(0, 0);
|
|
|
|
settingsbackgroundbtn.SetImage(&settingsbackground);
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText backBtnTxt(LANGUAGE.Back , 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
|
|
|
GuiImage backBtnImg(&btnOutline);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
backBtnTxt.SetWidescreen(CFG.widescreen);
|
2009-05-20 15:14:52 +02:00
|
|
|
backBtnImg.SetWidescreen(CFG.widescreen);}
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
backBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
backBtn.SetPosition(-180, 400);
|
|
|
|
backBtn.SetLabel(&backBtnTxt);
|
|
|
|
backBtn.SetImage(&backBtnImg);
|
|
|
|
backBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
backBtn.SetSoundClick(&btnClick);
|
|
|
|
backBtn.SetTrigger(&trigA);
|
|
|
|
backBtn.SetTrigger(&trigB);
|
|
|
|
backBtn.SetEffectGrow();
|
2009-05-20 15:14:52 +02:00
|
|
|
|
2009-05-11 21:55:14 +02:00
|
|
|
GuiImage tab1Img(&tab1);
|
|
|
|
GuiImage tab2Img(&tab2);
|
|
|
|
GuiImage tab3Img(&tab3);
|
|
|
|
GuiButton tabBtn(tab1.GetWidth(), tab1.GetHeight());
|
|
|
|
tabBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
tabBtn.SetPosition(-202, 90);
|
|
|
|
tabBtn.SetImage(&tab1Img);
|
2009-05-11 23:19:00 +02:00
|
|
|
|
2009-05-11 21:55:14 +02:00
|
|
|
GuiButton page1Btn(40, 96);
|
2009-05-05 02:11:00 +02:00
|
|
|
page1Btn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
2009-05-07 10:53:23 +02:00
|
|
|
page1Btn.SetPosition(-202, 90);
|
2009-05-05 02:11:00 +02:00
|
|
|
page1Btn.SetSoundOver(&btnSoundOver);
|
|
|
|
page1Btn.SetSoundClick(&btnClick);
|
2009-05-13 08:48:30 +02:00
|
|
|
page1Btn.SetTrigger(0, &trigA);
|
2009-05-05 19:24:19 +02:00
|
|
|
|
2009-05-11 21:55:14 +02:00
|
|
|
GuiButton page2Btn(40, 96);
|
2009-05-05 02:11:00 +02:00
|
|
|
page2Btn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
2009-05-07 10:53:23 +02:00
|
|
|
page2Btn.SetPosition(-202, 186);
|
2009-05-05 02:11:00 +02:00
|
|
|
page2Btn.SetSoundOver(&btnSoundOver);
|
|
|
|
page2Btn.SetSoundClick(&btnClick);
|
2009-05-13 08:48:30 +02:00
|
|
|
page2Btn.SetTrigger(0, &trigA);
|
|
|
|
page2Btn.SetTrigger(1, &trigR);
|
|
|
|
page2Btn.SetTrigger(2, &trigPlus);
|
2009-05-11 23:19:00 +02:00
|
|
|
|
2009-05-11 21:55:14 +02:00
|
|
|
GuiButton page3Btn(40, 96);
|
|
|
|
page3Btn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
page3Btn.SetPosition(-202, 282);
|
|
|
|
page3Btn.SetSoundOver(&btnSoundOver);
|
|
|
|
page3Btn.SetSoundClick(&btnClick);
|
2009-05-13 08:48:30 +02:00
|
|
|
page3Btn.SetTrigger(0, &trigA);
|
|
|
|
page3Btn.SetTrigger(1, &trigR);
|
|
|
|
page3Btn.SetTrigger(2, &trigPlus);
|
2009-05-05 19:24:19 +02:00
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
const char * text = LANGUAGE.Unlock;
|
2009-05-03 22:30:17 +02:00
|
|
|
if (CFG.godmode == 1)
|
2009-05-16 17:38:52 +02:00
|
|
|
text = LANGUAGE.Lock;
|
2009-05-20 15:14:52 +02:00
|
|
|
GuiText lockBtnTxt(text, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
lockBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
|
|
|
GuiImage lockBtnImg(&btnOutline);
|
2009-05-20 15:14:52 +02:00
|
|
|
lockBtnImg.SetWidescreen(CFG.widescreen);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton lockBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
lockBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
lockBtn.SetPosition(180, 400);
|
|
|
|
lockBtn.SetLabel(&lockBtnTxt);
|
|
|
|
lockBtn.SetImage(&lockBtnImg);
|
|
|
|
lockBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
lockBtn.SetSoundClick(&btnClick);
|
|
|
|
lockBtn.SetTrigger(&trigA);
|
|
|
|
lockBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiImageData logo(credits_button_png);
|
|
|
|
GuiImage logoImg(&logo);
|
|
|
|
GuiImageData logoOver(credits_button_over_png);
|
|
|
|
GuiImage logoImgOver(&logoOver);
|
|
|
|
btnLogo = new GuiButton(logoImg.GetWidth(), logoImg.GetHeight());
|
|
|
|
btnLogo->SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
|
|
|
btnLogo->SetPosition(0, -35);
|
|
|
|
btnLogo->SetImage(&logoImg);
|
|
|
|
btnLogo->SetImageOver(&logoImgOver);
|
|
|
|
btnLogo->SetEffectGrow();
|
|
|
|
btnLogo->SetSoundOver(&btnSoundOver);
|
|
|
|
btnLogo->SetSoundClick(&btnClick);
|
|
|
|
btnLogo->SetTrigger(&trigA);
|
|
|
|
btnLogo->SetUpdateCallback(WindowCredits);
|
|
|
|
|
|
|
|
customOptionList options2(9);
|
2009-05-19 07:08:14 +02:00
|
|
|
GuiCustomOptionBrowser optionBrowser2(396, 280, &options2, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, 0, 200);
|
2009-05-03 22:30:17 +02:00
|
|
|
optionBrowser2.SetPosition(0, 90);
|
|
|
|
optionBrowser2.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
2009-05-06 13:09:32 +02:00
|
|
|
optionBrowser2.SetCol2Position(200);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiWindow w(screenwidth, screenheight);
|
|
|
|
|
|
|
|
int pageToDisplay = 1;
|
|
|
|
while ( pageToDisplay > 0) //set pageToDisplay to 0 to quit
|
|
|
|
{
|
|
|
|
menu = MENU_NONE;
|
|
|
|
if ( pageToDisplay == 1)
|
|
|
|
{
|
2009-05-17 06:02:52 +02:00
|
|
|
|
|
|
|
sprintf(options2.name[0], "%s",LANGUAGE.VideoMode);
|
|
|
|
sprintf(options2.name[1], "%s",LANGUAGE.VIDTVPatch);
|
|
|
|
sprintf(options2.name[2], "%s",LANGUAGE.Language);
|
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
sprintf(options2.name[3], "Ocarina");
|
2009-05-17 06:02:52 +02:00
|
|
|
|
2009-05-16 22:10:29 +02:00
|
|
|
sprintf(options2.name[4],"%s", LANGUAGE.Display);
|
|
|
|
sprintf(options2.name[5],"%s", LANGUAGE.Clock); //CLOCK
|
|
|
|
sprintf(options2.name[6],"%s", LANGUAGE.Rumble); //RUMBLE
|
|
|
|
sprintf(options2.name[7],"%s", LANGUAGE.Volume);
|
|
|
|
sprintf(options2.name[8],"%s", LANGUAGE.Tooltips);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
w.Append(&settingsbackgroundbtn);
|
|
|
|
w.Append(&titleTxt);
|
|
|
|
w.Append(&backBtn);
|
|
|
|
w.Append(&lockBtn);
|
|
|
|
w.Append(btnLogo);
|
2009-05-13 08:48:30 +02:00
|
|
|
//set triggers for tabs
|
|
|
|
page1Btn.RemoveTrigger(1);
|
|
|
|
page1Btn.RemoveTrigger(2);
|
|
|
|
page2Btn.RemoveTrigger(1);
|
|
|
|
page2Btn.RemoveTrigger(2);
|
|
|
|
page3Btn.RemoveTrigger(1);
|
|
|
|
page3Btn.RemoveTrigger(2);
|
|
|
|
page2Btn.SetTrigger(1, &trigPlus);
|
|
|
|
page2Btn.SetTrigger(2, &trigR);
|
|
|
|
page3Btn.SetTrigger(1, &trigMinus);
|
|
|
|
page3Btn.SetTrigger(2, &trigL);
|
2009-05-13 17:56:16 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
mainWindow->Append(&w);
|
2009-05-07 03:03:18 +02:00
|
|
|
mainWindow->Append(&optionBrowser2);
|
2009-05-11 21:55:14 +02:00
|
|
|
mainWindow->Append(&tabBtn);
|
2009-05-05 02:11:00 +02:00
|
|
|
mainWindow->Append(&page2Btn);
|
2009-05-11 21:55:14 +02:00
|
|
|
mainWindow->Append(&page3Btn);
|
2009-05-07 12:38:10 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
ResumeGui();
|
|
|
|
}
|
|
|
|
else if ( pageToDisplay == 2 )
|
|
|
|
{
|
2009-05-13 08:48:30 +02:00
|
|
|
page1Btn.RemoveTrigger(1);
|
|
|
|
page1Btn.RemoveTrigger(2);
|
|
|
|
page2Btn.RemoveTrigger(1);
|
|
|
|
page2Btn.RemoveTrigger(2);
|
|
|
|
page3Btn.RemoveTrigger(1);
|
|
|
|
page3Btn.RemoveTrigger(2);
|
|
|
|
page1Btn.SetTrigger(1, &trigMinus);
|
|
|
|
page1Btn.SetTrigger(2, &trigL);
|
|
|
|
page3Btn.SetTrigger(1, &trigPlus);
|
|
|
|
page3Btn.SetTrigger(2, &trigR);
|
2009-05-07 12:38:10 +02:00
|
|
|
|
2009-05-07 03:03:18 +02:00
|
|
|
mainWindow->Append(&optionBrowser2);
|
2009-05-11 21:55:14 +02:00
|
|
|
mainWindow->Append(&tabBtn);
|
2009-05-05 02:11:00 +02:00
|
|
|
mainWindow->Append(&page1Btn);
|
2009-05-11 21:55:14 +02:00
|
|
|
mainWindow->Append(&page3Btn);
|
2009-05-05 19:24:19 +02:00
|
|
|
|
2009-05-16 22:10:29 +02:00
|
|
|
sprintf(options2.name[0],"%s", LANGUAGE.Password);
|
|
|
|
sprintf(options2.name[1],"%s", LANGUAGE.BootStandard);
|
|
|
|
sprintf(options2.name[2],"%s", LANGUAGE.FlipX);
|
|
|
|
sprintf(options2.name[3],"%s", LANGUAGE.QuickBoot);
|
|
|
|
sprintf(options2.name[4],"%s", LANGUAGE.PromptsButtons);
|
|
|
|
sprintf(options2.name[5],"%s", LANGUAGE.Parentalcontrol);
|
|
|
|
sprintf(options2.name[6],"%s", LANGUAGE.CoverPath);
|
|
|
|
sprintf(options2.name[7],"%s", LANGUAGE.DiscimagePath);
|
|
|
|
sprintf(options2.name[8],"%s", LANGUAGE.ThemePath);
|
2009-05-13 08:48:30 +02:00
|
|
|
}
|
|
|
|
else if ( pageToDisplay == 3 )
|
|
|
|
{
|
|
|
|
page1Btn.RemoveTrigger(1);
|
|
|
|
page1Btn.RemoveTrigger(2);
|
|
|
|
page2Btn.RemoveTrigger(1);
|
|
|
|
page2Btn.RemoveTrigger(2);
|
|
|
|
page3Btn.RemoveTrigger(1);
|
|
|
|
page3Btn.RemoveTrigger(2);
|
|
|
|
page2Btn.SetTrigger(1, &trigMinus);
|
|
|
|
page2Btn.SetTrigger(2, &trigL);
|
|
|
|
page1Btn.SetTrigger(1, &trigPlus);
|
|
|
|
page1Btn.SetTrigger(2, &trigR);
|
|
|
|
|
|
|
|
mainWindow->Append(&optionBrowser2);
|
|
|
|
mainWindow->Append(&tabBtn);
|
|
|
|
mainWindow->Append(&page1Btn);
|
|
|
|
mainWindow->Append(&page3Btn);
|
|
|
|
|
2009-05-17 06:02:52 +02:00
|
|
|
|
2009-05-17 10:40:47 +02:00
|
|
|
sprintf(options2.name[0], "%s",LANGUAGE.Titlestxtpath);
|
2009-05-17 06:02:52 +02:00
|
|
|
sprintf(options2.name[1], "%s",LANGUAGE.AppLanguage);
|
2009-05-17 10:40:47 +02:00
|
|
|
sprintf(options2.name[2], "%s",LANGUAGE.keyboard);
|
|
|
|
sprintf(options2.name[3], "%s",LANGUAGE.Unicodefix);
|
2009-05-20 02:03:43 +02:00
|
|
|
sprintf(options2.name[4], "%s",LANGUAGE.Backgroundmusic);
|
2009-05-21 06:00:16 +02:00
|
|
|
sprintf(options2.name[5], "%s",LANGUAGE.ListSort);
|
2009-05-20 02:03:43 +02:00
|
|
|
sprintf(options2.name[6], " ");
|
2009-05-13 08:48:30 +02:00
|
|
|
sprintf(options2.name[7], " ");
|
2009-05-20 02:03:43 +02:00
|
|
|
sprintf(options2.name[8], "%s",LANGUAGE.MP3Menu);
|
2009-05-13 08:48:30 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
while(menu == MENU_NONE)
|
|
|
|
{
|
|
|
|
VIDEO_WaitVSync ();
|
|
|
|
|
|
|
|
if ( pageToDisplay == 1 )
|
|
|
|
{
|
|
|
|
if(Settings.video > 5)
|
|
|
|
Settings.video = 0;
|
|
|
|
if(Settings.language > 10)
|
|
|
|
Settings.language = 0;
|
|
|
|
if(Settings.ocarina > 1)
|
|
|
|
Settings.ocarina = 0;
|
|
|
|
if(Settings.vpatch > 1)
|
|
|
|
Settings.vpatch = 0;
|
|
|
|
if(Settings.sinfo > 3)
|
|
|
|
Settings.sinfo = 0;
|
2009-05-20 10:31:47 +02:00
|
|
|
if(Settings.hddinfo > 2)
|
2009-05-03 22:30:17 +02:00
|
|
|
Settings.hddinfo = 0; //CLOCK
|
|
|
|
if(Settings.rumble > 1)
|
|
|
|
Settings.rumble = 0; //RUMBLE
|
|
|
|
if(Settings.volume > 10)
|
|
|
|
Settings.volume = 0;
|
2009-05-06 09:12:09 +02:00
|
|
|
if (Settings.tooltips > 1 )
|
|
|
|
Settings.tooltips = 0;
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-16 22:10:29 +02:00
|
|
|
if (Settings.video == discdefault) sprintf (options2.value[0],"%s",LANGUAGE.DiscDefault);
|
|
|
|
else if (Settings.video == systemdefault) sprintf (options2.value[0],"%s",LANGUAGE.SystemDefault);
|
|
|
|
else if (Settings.video == patch) sprintf (options2.value[0],"%s",LANGUAGE.AutoPatch);
|
2009-05-16 17:38:52 +02:00
|
|
|
else if (Settings.video == pal50) sprintf (options2.value[0],"%s PAL50",LANGUAGE.Force);
|
|
|
|
else if (Settings.video == pal60) sprintf (options2.value[0],"%s PAL60",LANGUAGE.Force);
|
|
|
|
else if (Settings.video == ntsc) sprintf (options2.value[0],"%s NTSC",LANGUAGE.Force);
|
|
|
|
|
2009-05-16 22:10:29 +02:00
|
|
|
if (Settings.vpatch == on) sprintf (options2.value[1],"%s",LANGUAGE.ON);
|
|
|
|
else if (Settings.vpatch == off) sprintf (options2.value[1],"%s",LANGUAGE.OFF);
|
2009-05-16 17:38:52 +02:00
|
|
|
|
2009-05-16 22:10:29 +02:00
|
|
|
if (Settings.language == ConsoleLangDefault) sprintf (options2.value[2],"%s",LANGUAGE.ConsoleDefault);
|
|
|
|
else if (Settings.language == jap) sprintf (options2.value[2],"%s",LANGUAGE.Japanese);
|
|
|
|
else if (Settings.language == ger) sprintf (options2.value[2],"%s",LANGUAGE.German);
|
|
|
|
else if (Settings.language == eng) sprintf (options2.value[2],"%s",LANGUAGE.English);
|
|
|
|
else if (Settings.language == fren) sprintf (options2.value[2],"%s",LANGUAGE.French);
|
|
|
|
else if (Settings.language == esp) sprintf (options2.value[2],"%s",LANGUAGE.Spanish);
|
|
|
|
else if (Settings.language == it) sprintf (options2.value[2],"%s",LANGUAGE.Italian);
|
|
|
|
else if (Settings.language == dut) sprintf (options2.value[2],"%s",LANGUAGE.Dutch);
|
|
|
|
else if (Settings.language == schin) sprintf (options2.value[2],"%s",LANGUAGE.SChinese);
|
|
|
|
else if (Settings.language == tchin) sprintf (options2.value[2],"%s",LANGUAGE.TChinese);
|
|
|
|
else if (Settings.language == kor) sprintf (options2.value[2],"%s",LANGUAGE.Korean);
|
2009-05-16 17:38:52 +02:00
|
|
|
|
2009-05-16 22:10:29 +02:00
|
|
|
if (Settings.ocarina == on) sprintf (options2.value[3],"%s",LANGUAGE.ON);
|
|
|
|
else if (Settings.ocarina == off) sprintf (options2.value[3],"%s",LANGUAGE.OFF);
|
2009-05-16 17:38:52 +02:00
|
|
|
|
2009-05-16 22:10:29 +02:00
|
|
|
if (Settings.sinfo == GameID) sprintf (options2.value[4],"%s",LANGUAGE.GameID);
|
|
|
|
else if (Settings.sinfo == GameRegion) sprintf (options2.value[4],"%s",LANGUAGE.GameRegion);
|
|
|
|
else if (Settings.sinfo == Both) sprintf (options2.value[4],"%s",LANGUAGE.Both);
|
|
|
|
else if (Settings.sinfo == Neither) sprintf (options2.value[4],"%s",LANGUAGE.Neither);
|
2009-05-16 17:38:52 +02:00
|
|
|
|
2009-05-20 10:31:47 +02:00
|
|
|
if (Settings.hddinfo == hr12) sprintf (options2.value[5],"12 %s",LANGUAGE.hour);
|
|
|
|
else if (Settings.hddinfo == hr24) sprintf (options2.value[5],"24 %s",LANGUAGE.hour);
|
|
|
|
else if (Settings.hddinfo == Off) sprintf (options2.value[5],"%s",LANGUAGE.OFF);
|
2009-05-16 17:38:52 +02:00
|
|
|
|
2009-05-16 22:10:29 +02:00
|
|
|
if (Settings.rumble == RumbleOn) sprintf (options2.value[6],"%s",LANGUAGE.ON);
|
|
|
|
else if (Settings.rumble == RumbleOff) sprintf (options2.value[6],"%s",LANGUAGE.OFF);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
if (Settings.volume == v10) sprintf (options2.value[7],"10");
|
|
|
|
else if (Settings.volume == v20) sprintf (options2.value[7],"20");
|
|
|
|
else if (Settings.volume == v30) sprintf (options2.value[7],"30");
|
|
|
|
else if (Settings.volume == v40) sprintf (options2.value[7],"40");
|
|
|
|
else if (Settings.volume == v50) sprintf (options2.value[7],"50");
|
|
|
|
else if (Settings.volume == v60) sprintf (options2.value[7],"60");
|
|
|
|
else if (Settings.volume == v70) sprintf (options2.value[7],"70");
|
|
|
|
else if (Settings.volume == v80) sprintf (options2.value[7],"80");
|
|
|
|
else if (Settings.volume == v90) sprintf (options2.value[7],"90");
|
|
|
|
else if (Settings.volume == v100) sprintf (options2.value[7],"100");
|
2009-05-16 22:10:29 +02:00
|
|
|
else if (Settings.volume == v0) sprintf (options2.value[7],"%s",LANGUAGE.OFF);
|
2009-05-05 19:24:19 +02:00
|
|
|
|
2009-05-06 09:12:09 +02:00
|
|
|
|
2009-05-16 22:10:29 +02:00
|
|
|
if (Settings.tooltips == TooltipsOn) sprintf (options2.value[8],"%s",LANGUAGE.ON);
|
|
|
|
else if (Settings.tooltips == TooltipsOff) sprintf (options2.value[8],"%s",LANGUAGE.OFF);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
ret = optionBrowser2.GetClickedOption();
|
|
|
|
|
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
Settings.video++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
Settings.vpatch++;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
Settings.language++;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
Settings.ocarina++;
|
|
|
|
break;
|
|
|
|
case 4: // Game Code and Region
|
|
|
|
Settings.sinfo++;
|
|
|
|
break;
|
|
|
|
case 5: //CLOCK
|
|
|
|
Settings.hddinfo++;
|
|
|
|
break;
|
|
|
|
case 6: //Rumble
|
|
|
|
Settings.rumble++;
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
Settings.volume++;
|
|
|
|
break;
|
2009-05-06 09:12:09 +02:00
|
|
|
case 8:
|
|
|
|
Settings.tooltips++;
|
|
|
|
break;
|
2009-05-05 02:11:00 +02:00
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( pageToDisplay == 2 )
|
|
|
|
{
|
2009-05-05 02:11:00 +02:00
|
|
|
if ( Settings.cios > 1 )
|
2009-05-03 22:30:17 +02:00
|
|
|
Settings.cios = 0;
|
2009-05-20 22:09:57 +02:00
|
|
|
if ( Settings.xflip > 4 )
|
2009-05-05 08:24:23 +02:00
|
|
|
Settings.xflip = 0;
|
|
|
|
if ( Settings.qboot > 1 )
|
|
|
|
Settings.qboot = 0;
|
2009-05-06 13:09:32 +02:00
|
|
|
if ( Settings.wsprompt > 1 )
|
|
|
|
Settings.wsprompt = 0;
|
2009-05-10 00:37:14 +02:00
|
|
|
if (CFG.parentalcontrol > 3 )
|
|
|
|
CFG.parentalcontrol = 0;
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
|
2009-05-06 09:12:09 +02:00
|
|
|
if ( CFG.godmode != 1) sprintf(options2.value[0], "********");
|
2009-05-16 22:10:29 +02:00
|
|
|
else if (!strcmp("", Settings.unlockCode)) sprintf(options2.value[0], "%s",LANGUAGE.notset);
|
2009-05-06 09:12:09 +02:00
|
|
|
else sprintf(options2.value[0], Settings.unlockCode);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-10 01:03:16 +02:00
|
|
|
if (CFG.godmode != 1) sprintf(options2.value[1], "********");
|
|
|
|
else if (Settings.cios == ios249) sprintf (options2.value[1],"cIOS 249");
|
2009-05-06 09:12:09 +02:00
|
|
|
else if (Settings.cios == ios222) sprintf (options2.value[1],"cIOS 222");
|
2009-05-05 19:24:19 +02:00
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
if (Settings.xflip == no) sprintf (options2.value[2],"%s/%s",LANGUAGE.Right,LANGUAGE.Next);
|
|
|
|
else if (Settings.xflip == yes) sprintf (options2.value[2],"%s/%s",LANGUAGE.Left,LANGUAGE.Prev);
|
2009-05-16 23:04:43 +02:00
|
|
|
else if (Settings.xflip == sysmenu) sprintf (options2.value[2],"%s", LANGUAGE.LikeSysMenu);
|
2009-05-16 17:38:52 +02:00
|
|
|
else if (Settings.xflip == wtf) sprintf (options2.value[2],"%s/%s",LANGUAGE.Right,LANGUAGE.Prev);
|
2009-05-20 22:09:57 +02:00
|
|
|
else if (Settings.xflip == disk3d) sprintf (options2.value[2],"DiskFlip");
|
2009-05-05 19:24:19 +02:00
|
|
|
|
2009-05-16 22:10:29 +02:00
|
|
|
if (Settings.qboot == no) sprintf (options2.value[3],"%s",LANGUAGE.No);
|
|
|
|
else if (Settings.qboot == yes) sprintf (options2.value[3],"%s",LANGUAGE.Yes);
|
2009-05-06 13:23:10 +02:00
|
|
|
|
2009-05-16 22:10:29 +02:00
|
|
|
if (Settings.wsprompt == no) sprintf (options2.value[4],"%s",LANGUAGE.Normal);
|
|
|
|
else if (Settings.wsprompt == yes) sprintf (options2.value[4],"%s",LANGUAGE.WidescreenFix);
|
2009-05-05 19:24:19 +02:00
|
|
|
|
2009-05-10 00:37:14 +02:00
|
|
|
if (CFG.godmode != 1) sprintf(options2.value[5], "********");
|
|
|
|
else if(CFG.parentalcontrol == 0) sprintf(options2.value[5], "0");
|
|
|
|
else if(CFG.parentalcontrol == 1) sprintf(options2.value[5], "1");
|
|
|
|
else if(CFG.parentalcontrol == 2) sprintf(options2.value[5], "2");
|
|
|
|
else if(CFG.parentalcontrol == 3) sprintf(options2.value[5], "3");
|
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-10 12:47:15 +02:00
|
|
|
if (strlen(CFG.covers_path) < (9 + 3)) {
|
|
|
|
sprintf(cfgtext, "%s", CFG.covers_path);
|
|
|
|
} else {
|
|
|
|
strncpy(cfgtext, CFG.covers_path, 9);
|
|
|
|
cfgtext[9] = '\0';
|
|
|
|
strncat(cfgtext, "...", 3);
|
|
|
|
}
|
|
|
|
sprintf(options2.value[6], "%s", cfgtext);
|
|
|
|
|
|
|
|
if (strlen(CFG.disc_path) < (9 + 3)) {
|
|
|
|
sprintf(cfgtext, "%s", CFG.disc_path);
|
|
|
|
} else {
|
|
|
|
strncpy(cfgtext, CFG.disc_path, 9);
|
|
|
|
cfgtext[9] = '\0';
|
|
|
|
strncat(cfgtext, "...", 3);
|
|
|
|
}
|
|
|
|
sprintf(options2.value[7], "%s", cfgtext);
|
|
|
|
|
|
|
|
if (strlen(CFG.theme_path) < (9 + 3)) {
|
|
|
|
sprintf(cfgtext, "%s", CFG.theme_path);
|
|
|
|
} else {
|
|
|
|
strncpy(cfgtext, CFG.theme_path, 9);
|
|
|
|
cfgtext[9] = '\0';
|
|
|
|
strncat(cfgtext, "...", 3);
|
|
|
|
}
|
|
|
|
sprintf(options2.value[8], "%s", cfgtext);
|
2009-05-06 09:12:09 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
ret = optionBrowser2.GetClickedOption();
|
|
|
|
|
|
|
|
switch (ret)
|
|
|
|
{
|
2009-05-06 09:12:09 +02:00
|
|
|
|
|
|
|
case 0: // Modify Password
|
2009-05-03 22:30:17 +02:00
|
|
|
if ( CFG.godmode == 1)
|
2009-05-05 19:24:19 +02:00
|
|
|
{
|
2009-05-05 02:11:00 +02:00
|
|
|
mainWindow->Remove(&optionBrowser2);
|
|
|
|
mainWindow->Remove(&page1Btn);
|
|
|
|
mainWindow->Remove(&page2Btn);
|
2009-05-11 21:55:14 +02:00
|
|
|
mainWindow->Remove(&tabBtn);
|
|
|
|
mainWindow->Remove(&page3Btn);
|
2009-05-05 02:11:00 +02:00
|
|
|
w.Remove(&backBtn);
|
|
|
|
w.Remove(&lockBtn);
|
2009-05-03 22:30:17 +02:00
|
|
|
char entered[20] = "";
|
|
|
|
strncpy(entered, Settings.unlockCode, sizeof(entered));
|
2009-05-12 01:26:39 +02:00
|
|
|
int result = OnScreenKeyboard(entered, 20,0);
|
2009-05-10 00:37:14 +02:00
|
|
|
mainWindow->Append(&optionBrowser2);
|
2009-05-11 21:55:14 +02:00
|
|
|
mainWindow->Append(&tabBtn);
|
2009-05-05 02:11:00 +02:00
|
|
|
mainWindow->Append(&page1Btn);
|
|
|
|
mainWindow->Append(&page2Btn);
|
2009-05-11 21:55:14 +02:00
|
|
|
mainWindow->Append(&page3Btn);
|
2009-05-05 02:11:00 +02:00
|
|
|
w.Append(&backBtn);
|
|
|
|
w.Append(&lockBtn);
|
2009-05-03 22:30:17 +02:00
|
|
|
if ( result == 1 )
|
|
|
|
{
|
|
|
|
strncpy(Settings.unlockCode, entered, sizeof(Settings.unlockCode));
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.PasswordChanged,LANGUAGE.Passwordhasbeenchanged,LANGUAGE.ok,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
cfg_save_global();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.Passwordchange,LANGUAGE.Consoleshouldbeunlockedtomodifyit,LANGUAGE.ok,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
break;
|
2009-05-06 09:12:09 +02:00
|
|
|
case 1:
|
2009-05-10 01:03:16 +02:00
|
|
|
if ( CFG.godmode == 1)
|
2009-05-05 02:11:00 +02:00
|
|
|
Settings.cios++;
|
2009-05-03 22:30:17 +02:00
|
|
|
break;
|
2009-05-06 09:12:09 +02:00
|
|
|
case 2:
|
2009-05-05 08:24:23 +02:00
|
|
|
Settings.xflip++;
|
|
|
|
break;
|
2009-05-06 09:12:09 +02:00
|
|
|
case 3:
|
2009-05-05 08:24:23 +02:00
|
|
|
Settings.qboot++;
|
|
|
|
break;
|
2009-05-06 13:09:32 +02:00
|
|
|
case 4:
|
|
|
|
Settings.wsprompt++;
|
|
|
|
break;
|
2009-05-10 00:37:14 +02:00
|
|
|
case 5:
|
2009-05-10 01:03:16 +02:00
|
|
|
if ( CFG.godmode == 1)
|
2009-05-10 00:37:14 +02:00
|
|
|
CFG.parentalcontrol++;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
if ( CFG.godmode == 1)
|
|
|
|
{
|
|
|
|
mainWindow->Remove(&optionBrowser2);
|
|
|
|
mainWindow->Remove(&page1Btn);
|
|
|
|
mainWindow->Remove(&page2Btn);
|
2009-05-11 21:55:14 +02:00
|
|
|
mainWindow->Remove(&tabBtn);
|
|
|
|
mainWindow->Remove(&page3Btn);
|
2009-05-10 00:37:14 +02:00
|
|
|
w.Remove(&backBtn);
|
|
|
|
w.Remove(&lockBtn);
|
2009-05-10 12:47:15 +02:00
|
|
|
char entered[43] = "";
|
2009-05-10 00:37:14 +02:00
|
|
|
strncpy(entered, CFG.covers_path, sizeof(entered));
|
2009-05-12 01:26:39 +02:00
|
|
|
int result = OnScreenKeyboard(entered,43,4);
|
2009-05-10 00:37:14 +02:00
|
|
|
mainWindow->Append(&optionBrowser2);
|
|
|
|
mainWindow->Append(&page1Btn);
|
|
|
|
mainWindow->Append(&page2Btn);
|
2009-05-11 21:55:14 +02:00
|
|
|
mainWindow->Append(&tabBtn);
|
|
|
|
mainWindow->Append(&page3Btn);
|
2009-05-10 00:37:14 +02:00
|
|
|
w.Append(&backBtn);
|
|
|
|
w.Append(&lockBtn);
|
|
|
|
if ( result == 1 )
|
2009-05-20 15:14:52 +02:00
|
|
|
{
|
2009-05-20 10:31:47 +02:00
|
|
|
int len = (strlen(entered)-1);
|
|
|
|
if(entered[len] !='/')
|
|
|
|
strncat (entered, "/", 1);
|
|
|
|
strncpy(CFG.covers_path, entered, sizeof(CFG.covers_path));
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.CoverpathChanged,0,LANGUAGE.ok,0,0,0);
|
2009-05-15 22:03:19 +02:00
|
|
|
if(isSdInserted() == 1) {
|
|
|
|
cfg_save_global();
|
|
|
|
} else {
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtosave, LANGUAGE.ok, 0,0,0);
|
2009-05-15 22:03:19 +02:00
|
|
|
}
|
2009-05-10 00:37:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.Coverpathchange,LANGUAGE.Consoleshouldbeunlockedtomodifyit,LANGUAGE.ok,0,0,0);
|
2009-05-10 00:37:14 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
if ( CFG.godmode == 1)
|
|
|
|
{
|
|
|
|
mainWindow->Remove(&optionBrowser2);
|
|
|
|
mainWindow->Remove(&page1Btn);
|
|
|
|
mainWindow->Remove(&page2Btn);
|
2009-05-11 21:55:14 +02:00
|
|
|
mainWindow->Remove(&tabBtn);
|
|
|
|
mainWindow->Remove(&page3Btn);
|
2009-05-10 00:37:14 +02:00
|
|
|
w.Remove(&backBtn);
|
|
|
|
w.Remove(&lockBtn);
|
2009-05-10 12:47:15 +02:00
|
|
|
char entered[43] = "";
|
2009-05-10 00:37:14 +02:00
|
|
|
strncpy(entered, CFG.disc_path, sizeof(entered));
|
2009-05-12 01:26:39 +02:00
|
|
|
int result = OnScreenKeyboard(entered, 43,4);
|
2009-05-10 00:37:14 +02:00
|
|
|
mainWindow->Append(&optionBrowser2);
|
|
|
|
mainWindow->Append(&page1Btn);
|
|
|
|
mainWindow->Append(&page2Btn);
|
2009-05-11 21:55:14 +02:00
|
|
|
mainWindow->Append(&tabBtn);
|
|
|
|
mainWindow->Append(&page3Btn);
|
2009-05-10 00:37:14 +02:00
|
|
|
w.Append(&backBtn);
|
|
|
|
w.Append(&lockBtn);
|
|
|
|
if ( result == 1 )
|
2009-05-12 08:23:22 +02:00
|
|
|
{
|
2009-05-20 10:31:47 +02:00
|
|
|
int len = (strlen(entered)-1);
|
|
|
|
if(entered[len] !='/')
|
|
|
|
strncat (entered, "/", 1);
|
2009-05-10 00:37:14 +02:00
|
|
|
strncpy(CFG.disc_path, entered, sizeof(CFG.disc_path));
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.DiscpathChanged,0,LANGUAGE.ok,0,0,0);
|
2009-05-15 22:03:19 +02:00
|
|
|
if(isSdInserted() == 1) {
|
|
|
|
cfg_save_global();
|
|
|
|
} else {
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtosave, LANGUAGE.ok, 0,0,0);
|
2009-05-15 22:03:19 +02:00
|
|
|
}
|
2009-05-10 00:37:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.Discpathchange,LANGUAGE.Consoleshouldbeunlockedtomodifyit,LANGUAGE.ok,0,0,0);
|
2009-05-10 00:37:14 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
if ( CFG.godmode == 1)
|
|
|
|
{
|
|
|
|
mainWindow->Remove(&optionBrowser2);
|
|
|
|
mainWindow->Remove(&page1Btn);
|
|
|
|
mainWindow->Remove(&page2Btn);
|
2009-05-11 21:55:14 +02:00
|
|
|
mainWindow->Remove(&tabBtn);
|
|
|
|
mainWindow->Remove(&page3Btn);
|
2009-05-10 00:37:14 +02:00
|
|
|
w.Remove(&backBtn);
|
|
|
|
w.Remove(&lockBtn);
|
2009-05-10 12:47:15 +02:00
|
|
|
char entered[43] = "";
|
2009-05-10 00:37:14 +02:00
|
|
|
strncpy(entered, CFG.theme_path, sizeof(entered));
|
2009-05-12 01:26:39 +02:00
|
|
|
int result = OnScreenKeyboard(entered, 43,4);
|
2009-05-10 00:37:14 +02:00
|
|
|
mainWindow->Append(&optionBrowser2);
|
|
|
|
mainWindow->Append(&page1Btn);
|
|
|
|
mainWindow->Append(&page2Btn);
|
2009-05-11 21:55:14 +02:00
|
|
|
mainWindow->Append(&tabBtn);
|
|
|
|
mainWindow->Append(&page3Btn);
|
2009-05-10 00:37:14 +02:00
|
|
|
w.Append(&backBtn);
|
|
|
|
w.Append(&lockBtn);
|
|
|
|
if ( result == 1 )
|
2009-05-12 08:23:22 +02:00
|
|
|
{
|
2009-05-20 10:31:47 +02:00
|
|
|
int len = (strlen(entered)-1);
|
|
|
|
if(entered[len] !='/')
|
|
|
|
strncat (entered, "/", 1);
|
2009-05-10 00:37:14 +02:00
|
|
|
strncpy(CFG.theme_path, entered, sizeof(CFG.theme_path));
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.ThemepathChanged,0,LANGUAGE.ok,0,0,0);
|
2009-05-15 22:03:19 +02:00
|
|
|
if(isSdInserted() == 1) {
|
|
|
|
cfg_save_global();
|
|
|
|
} else {
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtosave, LANGUAGE.ok, 0,0,0);
|
2009-05-15 22:03:19 +02:00
|
|
|
}
|
2009-05-11 15:57:19 +02:00
|
|
|
mainWindow->Remove(bgImg);
|
2009-05-16 21:12:36 +02:00
|
|
|
CFG_Load();
|
2009-05-11 15:57:19 +02:00
|
|
|
CFG_LoadGlobal();
|
|
|
|
menu = MENU_SETTINGS;
|
|
|
|
#ifdef HW_RVL
|
2009-05-11 21:55:14 +02:00
|
|
|
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);
|
|
|
|
#endif
|
2009-05-11 15:57:19 +02:00
|
|
|
if (CFG.widescreen)
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%swbackground.png", CFG.theme_path);
|
|
|
|
else
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbackground.png", CFG.theme_path);
|
|
|
|
|
|
|
|
background = new GuiImageData(imgPath, CFG.widescreen? wbackground_png : background_png);
|
|
|
|
|
|
|
|
bgImg = new GuiImage(background);
|
|
|
|
mainWindow->Append(bgImg);
|
|
|
|
mainWindow->Append(&w);
|
2009-05-11 23:19:00 +02:00
|
|
|
|
2009-05-11 15:57:19 +02:00
|
|
|
w.Append(&settingsbackgroundbtn);
|
2009-05-11 21:55:14 +02:00
|
|
|
w.Append(&titleTxt);
|
|
|
|
w.Append(&backBtn);
|
|
|
|
w.Append(&lockBtn);
|
|
|
|
w.Append(btnLogo);
|
2009-05-11 23:19:00 +02:00
|
|
|
|
2009-05-11 21:55:14 +02:00
|
|
|
mainWindow->Append(&optionBrowser2);
|
2009-05-11 15:57:19 +02:00
|
|
|
mainWindow->Append(&page1Btn);
|
|
|
|
mainWindow->Append(&page2Btn);
|
2009-05-11 21:55:14 +02:00
|
|
|
mainWindow->Append(&tabBtn);
|
|
|
|
mainWindow->Append(&page3Btn);
|
2009-05-11 15:57:19 +02:00
|
|
|
w.Append(&backBtn);
|
|
|
|
w.Append(&lockBtn);
|
2009-05-11 21:55:14 +02:00
|
|
|
//////end load new theme////////////
|
2009-05-10 00:37:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.Themepathchange,LANGUAGE.Consoleshouldbeunlockedtomodifyit,LANGUAGE.ok,0,0,0);
|
2009-05-10 00:37:14 +02:00
|
|
|
}
|
|
|
|
break;
|
2009-05-05 02:11:00 +02:00
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
2009-05-13 08:48:30 +02:00
|
|
|
if (pageToDisplay == 3){
|
2009-05-17 10:40:47 +02:00
|
|
|
|
|
|
|
|
2009-05-17 06:02:52 +02:00
|
|
|
if ( Settings.keyset > 2 )
|
|
|
|
Settings.keyset = 0;
|
2009-05-18 22:00:29 +02:00
|
|
|
if ( Settings.unicodefix > 2 )
|
2009-05-17 10:40:47 +02:00
|
|
|
Settings.unicodefix = 0;
|
2009-05-21 06:00:16 +02:00
|
|
|
if ( Settings.sort > 2 )
|
|
|
|
Settings.sort = 0;
|
2009-05-17 10:40:47 +02:00
|
|
|
|
|
|
|
if (strlen(CFG.titlestxt_path) < (9 + 3)) {
|
|
|
|
sprintf(cfgtext, "%s", CFG.titlestxt_path);
|
|
|
|
} else {
|
|
|
|
strncpy(cfgtext, CFG.titlestxt_path, 9);
|
|
|
|
cfgtext[9] = '\0';
|
|
|
|
strncat(cfgtext, "...", 3);
|
|
|
|
}
|
|
|
|
sprintf(options2.value[0], "%s", cfgtext);
|
2009-05-16 21:12:36 +02:00
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
if (strlen(CFG.language_path) < (9 + 3)) {
|
|
|
|
sprintf(cfgtext, "%s", CFG.language_path);
|
2009-05-20 02:03:43 +02:00
|
|
|
} else {
|
2009-05-16 17:38:52 +02:00
|
|
|
strncpy(cfgtext, CFG.language_path, 9);
|
|
|
|
cfgtext[9] = '\0';
|
|
|
|
strncat(cfgtext, "...", 3);
|
2009-05-20 02:03:43 +02:00
|
|
|
}
|
|
|
|
sprintf(options2.value[1], "%s", cfgtext);
|
2009-05-16 21:12:36 +02:00
|
|
|
|
2009-05-17 10:40:47 +02:00
|
|
|
|
2009-05-17 06:02:52 +02:00
|
|
|
if (Settings.keyset == us) sprintf (options2.value[2],"QWERTY");
|
|
|
|
else if (Settings.keyset == dvorak) sprintf (options2.value[2],"DVORAK");
|
|
|
|
else if (Settings.keyset == euro) sprintf (options2.value[2],"QWERTZ");
|
2009-05-17 10:40:47 +02:00
|
|
|
|
2009-05-18 22:00:29 +02:00
|
|
|
if (Settings.unicodefix == 0) sprintf (options2.value[3],"%s",LANGUAGE.OFF);
|
|
|
|
else if (Settings.unicodefix == 1) sprintf (options2.value[3],"%s",LANGUAGE.TChinese);
|
|
|
|
else if (Settings.unicodefix == 2) sprintf (options2.value[3],"%s",LANGUAGE.SChinese);
|
2009-05-17 10:40:47 +02:00
|
|
|
|
2009-05-20 02:03:43 +02:00
|
|
|
if(!strcmp("notset", CFG.ogg_path) || !strcmp("",CFG.oggload_path)) {
|
|
|
|
sprintf(options2.value[4], "%s", LANGUAGE.Standard);
|
|
|
|
} else {
|
|
|
|
if (strlen(CFG.ogg_path) < (9 + 3)) {
|
|
|
|
sprintf(cfgtext, "%s", CFG.ogg_path);
|
|
|
|
} else {
|
|
|
|
strncpy(cfgtext, CFG.ogg_path, 9);
|
|
|
|
cfgtext[9] = '\0';
|
|
|
|
strncat(cfgtext, "...", 3);
|
|
|
|
}
|
|
|
|
sprintf(options2.value[4], "%s", cfgtext);
|
|
|
|
}
|
|
|
|
|
2009-05-21 06:00:16 +02:00
|
|
|
if (Settings.sort == all) sprintf (options2.value[5],"%s",LANGUAGE.all);
|
|
|
|
else if (Settings.sort == fave) sprintf (options2.value[5],"%s",LANGUAGE.fave);
|
|
|
|
else if (Settings.sort == pcount) sprintf (options2.value[5],"%s",LANGUAGE.count);
|
2009-05-13 08:48:30 +02:00
|
|
|
sprintf(options2.value[6], " ");
|
|
|
|
sprintf(options2.value[7], " ");
|
2009-05-20 02:03:43 +02:00
|
|
|
sprintf(options2.value[8], "not working!");
|
2009-05-13 17:56:16 +02:00
|
|
|
|
|
|
|
ret = optionBrowser2.GetClickedOption();
|
|
|
|
|
|
|
|
switch(ret) {
|
|
|
|
|
|
|
|
case 0:
|
2009-05-17 10:40:47 +02:00
|
|
|
if ( CFG.godmode == 1)
|
|
|
|
{
|
|
|
|
mainWindow->Remove(&optionBrowser2);
|
|
|
|
mainWindow->Remove(&page1Btn);
|
|
|
|
mainWindow->Remove(&page2Btn);
|
|
|
|
mainWindow->Remove(&tabBtn);
|
|
|
|
mainWindow->Remove(&page3Btn);
|
|
|
|
w.Remove(&backBtn);
|
|
|
|
w.Remove(&lockBtn);
|
|
|
|
char entered[43] = "";
|
|
|
|
strncpy(entered, CFG.titlestxt_path, sizeof(entered));
|
|
|
|
int result = OnScreenKeyboard(entered,43,4);
|
|
|
|
mainWindow->Append(&optionBrowser2);
|
|
|
|
mainWindow->Append(&page1Btn);
|
|
|
|
mainWindow->Append(&page2Btn);
|
|
|
|
mainWindow->Append(&tabBtn);
|
|
|
|
mainWindow->Append(&page3Btn);
|
|
|
|
w.Append(&backBtn);
|
|
|
|
w.Append(&lockBtn);
|
|
|
|
if ( result == 1 )
|
2009-05-20 15:14:52 +02:00
|
|
|
{
|
2009-05-20 10:31:47 +02:00
|
|
|
int len = (strlen(entered)-1);
|
|
|
|
if(entered[len] !='/')
|
|
|
|
strncat (entered, "/", 1);
|
|
|
|
strncpy(CFG.titlestxt_path, entered, sizeof(CFG.titlestxt_path));
|
2009-05-17 10:40:47 +02:00
|
|
|
WindowPrompt(LANGUAGE.TitlestxtpathChanged,0,LANGUAGE.ok,0,0,0);
|
|
|
|
if(isSdInserted() == 1) {
|
|
|
|
cfg_save_global();
|
|
|
|
CFG_Load();
|
|
|
|
} else {
|
|
|
|
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtosave, LANGUAGE.ok, 0,0,0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WindowPrompt(LANGUAGE.Titlestxtpathchange,LANGUAGE.Consoleshouldbeunlockedtomodifyit,LANGUAGE.ok,0,0,0);
|
|
|
|
}
|
|
|
|
break;
|
2009-05-16 17:38:52 +02:00
|
|
|
case 1: // language file path
|
|
|
|
if ( CFG.godmode == 1)
|
|
|
|
{
|
|
|
|
mainWindow->Remove(&optionBrowser2);
|
|
|
|
mainWindow->Remove(&page1Btn);
|
|
|
|
mainWindow->Remove(&page2Btn);
|
|
|
|
mainWindow->Remove(&tabBtn);
|
|
|
|
mainWindow->Remove(&page3Btn);
|
|
|
|
w.Remove(&backBtn);
|
|
|
|
w.Remove(&lockBtn);
|
|
|
|
char entered[40] = "";
|
|
|
|
strncpy(entered, CFG.language_path, sizeof(entered));
|
|
|
|
int result = OnScreenKeyboard(entered, 40,0);
|
|
|
|
mainWindow->Append(&optionBrowser2);
|
|
|
|
mainWindow->Append(&tabBtn);
|
|
|
|
mainWindow->Append(&page1Btn);
|
|
|
|
mainWindow->Append(&page2Btn);
|
|
|
|
mainWindow->Append(&page3Btn);
|
|
|
|
w.Append(&backBtn);
|
|
|
|
w.Append(&lockBtn);
|
|
|
|
if ( result == 1 )
|
|
|
|
{ strncpy(CFG.language_path, entered, sizeof(CFG.language_path));
|
|
|
|
if(isSdInserted() == 1) {
|
|
|
|
cfg_save_global();
|
2009-05-17 10:40:47 +02:00
|
|
|
if(!checkfile(CFG.language_path)) {
|
|
|
|
WindowPrompt(LANGUAGE.Filenotfound,LANGUAGE.Loadingstandardlanguage,LANGUAGE.ok,0,0,0);
|
|
|
|
}
|
2009-05-16 21:12:36 +02:00
|
|
|
lang_default();
|
|
|
|
CFG_Load();
|
|
|
|
menu = MENU_SETTINGS;
|
|
|
|
pageToDisplay = 0;
|
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
} else {
|
|
|
|
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtosave, LANGUAGE.ok, 0,0,0);
|
|
|
|
}
|
2009-05-16 21:12:36 +02:00
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WindowPrompt(LANGUAGE.Langchange,LANGUAGE.Consoleshouldbeunlockedtomodifyit,LANGUAGE.ok,0,0,0);
|
|
|
|
}
|
|
|
|
break;
|
2009-05-17 06:02:52 +02:00
|
|
|
case 2:
|
|
|
|
Settings.keyset++;
|
|
|
|
break;
|
2009-05-17 10:40:47 +02:00
|
|
|
case 3:
|
|
|
|
Settings.unicodefix++;
|
|
|
|
break;
|
|
|
|
case 4:
|
2009-05-20 15:14:52 +02:00
|
|
|
if(isSdInserted() == 1) {
|
|
|
|
menu = MENU_OGG;
|
|
|
|
pageToDisplay = 0;
|
|
|
|
} else {
|
|
|
|
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtousethatoption, LANGUAGE.ok, 0,0,0);
|
|
|
|
}
|
2009-05-20 02:03:43 +02:00
|
|
|
break;
|
|
|
|
case 8:
|
2009-05-20 15:14:52 +02:00
|
|
|
if(isSdInserted() == 1) {
|
|
|
|
menu = MENU_MP3;
|
|
|
|
pageToDisplay = 0;
|
|
|
|
} else {
|
|
|
|
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtousethatoption, LANGUAGE.ok, 0,0,0);
|
|
|
|
}
|
2009-05-21 06:00:16 +02:00
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
Settings.sort++;
|
|
|
|
//__Menu_GetEntries();
|
2009-05-17 10:40:47 +02:00
|
|
|
break;
|
2009-05-13 17:56:16 +02:00
|
|
|
}
|
|
|
|
|
2009-05-13 08:48:30 +02:00
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
if(shutdown == 1)
|
|
|
|
Sys_Shutdown();
|
|
|
|
if(reset == 1)
|
|
|
|
Sys_Reboot();
|
2009-05-05 19:24:19 +02:00
|
|
|
|
2009-05-05 02:11:00 +02:00
|
|
|
if(page1Btn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
pageToDisplay = 1;
|
|
|
|
page1Btn.ResetState();
|
2009-05-11 21:55:14 +02:00
|
|
|
tabBtn.SetImage(&tab1Img);
|
2009-05-05 02:11:00 +02:00
|
|
|
menu = MENU_NONE;
|
|
|
|
break;
|
2009-05-05 19:24:19 +02:00
|
|
|
}
|
|
|
|
|
2009-05-05 02:11:00 +02:00
|
|
|
if(page2Btn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
pageToDisplay = 2;
|
|
|
|
menu = MENU_NONE;
|
|
|
|
page2Btn.ResetState();
|
2009-05-11 21:55:14 +02:00
|
|
|
tabBtn.SetImage(&tab2Img);
|
|
|
|
break;
|
|
|
|
}
|
2009-05-11 23:19:00 +02:00
|
|
|
|
2009-05-11 21:55:14 +02:00
|
|
|
if(page3Btn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-05-13 08:48:30 +02:00
|
|
|
pageToDisplay = 3;
|
2009-05-11 21:55:14 +02:00
|
|
|
menu = MENU_NONE;
|
|
|
|
page3Btn.ResetState();
|
|
|
|
tabBtn.SetImage(&tab3Img);
|
2009-05-05 02:11:00 +02:00
|
|
|
break;
|
|
|
|
}
|
2009-05-05 19:24:19 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
if(backBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
//Add the procedure call to save the global configuration
|
2009-05-08 19:06:39 +02:00
|
|
|
if(isSdInserted() == 1) {
|
2009-05-03 22:30:17 +02:00
|
|
|
cfg_save_global();
|
2009-05-08 19:06:39 +02:00
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
menu = MENU_DISCLIST;
|
|
|
|
pageToDisplay = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(lockBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
if (!strcmp("", Settings.unlockCode))
|
|
|
|
{
|
|
|
|
CFG.godmode = !CFG.godmode;
|
|
|
|
}
|
|
|
|
else if ( CFG.godmode == 0 )
|
|
|
|
{
|
|
|
|
//password check to unlock Install,Delete and Format
|
2009-05-05 02:11:00 +02:00
|
|
|
mainWindow->Remove(&optionBrowser2);
|
2009-05-15 06:07:34 +02:00
|
|
|
mainWindow->Remove(&page1Btn);
|
|
|
|
mainWindow->Remove(&page2Btn);
|
|
|
|
mainWindow->Remove(&tabBtn);
|
|
|
|
mainWindow->Remove(&page3Btn);
|
2009-05-05 02:11:00 +02:00
|
|
|
w.Remove(&backBtn);
|
|
|
|
w.Remove(&lockBtn);
|
2009-05-10 09:23:01 +02:00
|
|
|
char entered[20] = "";
|
2009-05-12 01:26:39 +02:00
|
|
|
int result = OnScreenKeyboard(entered, 20,0);
|
2009-05-06 14:31:55 +02:00
|
|
|
mainWindow->Append(&optionBrowser2);
|
2009-05-15 06:07:34 +02:00
|
|
|
mainWindow->Append(&tabBtn);
|
|
|
|
mainWindow->Append(&page1Btn);
|
|
|
|
mainWindow->Append(&page2Btn);
|
|
|
|
mainWindow->Append(&page3Btn);
|
2009-05-05 02:11:00 +02:00
|
|
|
w.Append(&backBtn);
|
|
|
|
w.Append(&lockBtn);
|
2009-05-15 06:07:34 +02:00
|
|
|
mainWindow->Append(&tabBtn);
|
2009-05-03 22:30:17 +02:00
|
|
|
if ( result == 1 )
|
|
|
|
{
|
|
|
|
if (!strcmp(entered, Settings.unlockCode)) //if password correct
|
|
|
|
{
|
|
|
|
if (CFG.godmode == 0)
|
|
|
|
{
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.CorrectPassword,LANGUAGE.InstallRenameandDeleteareunlocked,LANGUAGE.ok,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
CFG.godmode = 1;
|
|
|
|
__Menu_GetEntries();
|
|
|
|
menu = MENU_DISCLIST;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.WrongPassword,LANGUAGE.USBLoaderisprotected,LANGUAGE.ok,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-05-16 17:38:52 +02:00
|
|
|
int choice = WindowPrompt (LANGUAGE.LockConsole,LANGUAGE.Areyousure,LANGUAGE.Yes,LANGUAGE.No,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
if(choice == 1)
|
|
|
|
{
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.ConsoleLocked,LANGUAGE.USBLoaderisprotected,LANGUAGE.ok,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
CFG.godmode = 0;
|
|
|
|
__Menu_GetEntries();
|
|
|
|
menu = MENU_DISCLIST;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( CFG.godmode == 1)
|
|
|
|
{
|
2009-05-16 17:38:52 +02:00
|
|
|
lockBtnTxt.SetText(LANGUAGE.Lock);
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-05-16 17:38:52 +02:00
|
|
|
lockBtnTxt.SetText(LANGUAGE.Unlock);
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
lockBtn.ResetState();
|
|
|
|
}
|
2009-05-05 10:04:07 +02:00
|
|
|
if(settingsbackgroundbtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
optionBrowser2.SetFocus(1);
|
2009-05-10 03:01:41 +02:00
|
|
|
break;
|
2009-05-05 10:04:07 +02:00
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
HaltGui();
|
|
|
|
delete btnLogo;
|
|
|
|
btnLogo = NULL;
|
|
|
|
mainWindow->Remove(&optionBrowser2);
|
|
|
|
mainWindow->Remove(&w);
|
|
|
|
ResumeGui();
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/********************************************************************************
|
|
|
|
*Game specific settings
|
|
|
|
*********************************************************************************/
|
|
|
|
int GameSettings(struct discHdr * header)
|
|
|
|
{
|
|
|
|
bool exit = false;
|
|
|
|
int ret;
|
2009-05-03 20:53:31 +02:00
|
|
|
int retVal = 0;
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
char gameName[31];
|
|
|
|
|
|
|
|
if (strlen(get_title(header)) < (27 + 3)) {
|
|
|
|
sprintf(gameName, "%s", get_title(header));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
strncpy(gameName, get_title(header), 27);
|
|
|
|
gameName[27] = '\0';
|
|
|
|
strncat(gameName, "...", 3);
|
|
|
|
}
|
|
|
|
|
2009-05-20 10:31:47 +02:00
|
|
|
customOptionList options3(6);
|
2009-05-16 22:10:29 +02:00
|
|
|
sprintf(options3.name[0],"%s", LANGUAGE.VideoMode);
|
|
|
|
sprintf(options3.name[1],"%s", LANGUAGE.VIDTVPatch);
|
|
|
|
sprintf(options3.name[2],"%s", LANGUAGE.Language);
|
2009-05-03 22:30:17 +02:00
|
|
|
sprintf(options3.name[3], "Ocarina");
|
|
|
|
sprintf(options3.name[4], "IOS");
|
2009-05-20 10:31:47 +02:00
|
|
|
sprintf(options3.name[5],"%s", LANGUAGE.addToFavorite);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol);
|
|
|
|
|
|
|
|
char imgPath[100];
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
|
|
|
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
2009-05-05 04:56:01 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sgamesettings_background.png", CFG.theme_path);
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiImageData settingsbg(imgPath, settings_background_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, 0);
|
|
|
|
GuiTrigger trigB;
|
|
|
|
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
|
|
|
|
|
|
|
GuiText titleTxt(gameName, 28, (GXColor){0, 0, 0, 255});
|
|
|
|
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(0,40);
|
|
|
|
|
|
|
|
GuiImage settingsbackground(&settingsbg);
|
|
|
|
GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
|
|
|
|
settingsbackgroundbtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
settingsbackgroundbtn.SetPosition(0, 0);
|
|
|
|
settingsbackgroundbtn.SetImage(&settingsbackground);
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText saveBtnTxt(LANGUAGE.Save, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
saveBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
|
|
|
GuiImage saveBtnImg(&btnOutline);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
saveBtnTxt.SetWidescreen(CFG.widescreen);
|
2009-05-06 13:09:32 +02:00
|
|
|
saveBtnImg.SetWidescreen(CFG.widescreen);}
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton saveBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
saveBtn.SetScale(0.9);
|
|
|
|
saveBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
saveBtn.SetPosition(-180, 400);
|
|
|
|
saveBtn.SetLabel(&saveBtnTxt);
|
|
|
|
saveBtn.SetImage(&saveBtnImg);
|
|
|
|
saveBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
saveBtn.SetTrigger(&trigA);
|
|
|
|
saveBtn.SetEffectGrow();
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText cancelBtnTxt(LANGUAGE.Back, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
|
|
|
GuiImage cancelBtnImg(&btnOutline);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
cancelBtnTxt.SetWidescreen(CFG.widescreen);
|
2009-05-06 13:09:32 +02:00
|
|
|
cancelBtnImg.SetWidescreen(CFG.widescreen);}
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton cancelBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
cancelBtn.SetScale(0.9);
|
|
|
|
cancelBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
cancelBtn.SetPosition(180, 400);
|
|
|
|
cancelBtn.SetLabel(&cancelBtnTxt);
|
|
|
|
cancelBtn.SetImage(&cancelBtnImg);
|
|
|
|
cancelBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
cancelBtn.SetTrigger(&trigA);
|
|
|
|
cancelBtn.SetTrigger(&trigB);
|
|
|
|
cancelBtn.SetEffectGrow();
|
2009-05-20 15:14:52 +02:00
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText deleteBtnTxt(LANGUAGE.Uninstall, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-03 22:30:17 +02:00
|
|
|
deleteBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
|
|
|
GuiImage deleteBtnImg(&btnOutline);
|
2009-05-06 13:09:32 +02:00
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
deleteBtnTxt.SetWidescreen(CFG.widescreen);
|
2009-05-06 13:09:32 +02:00
|
|
|
deleteBtnImg.SetWidescreen(CFG.widescreen);}
|
2009-05-03 22:30:17 +02:00
|
|
|
GuiButton deleteBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
deleteBtn.SetScale(0.9);
|
|
|
|
deleteBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
deleteBtn.SetPosition(0, 400);
|
|
|
|
deleteBtn.SetLabel(&deleteBtnTxt);
|
|
|
|
deleteBtn.SetImage(&deleteBtnImg);
|
|
|
|
deleteBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
deleteBtn.SetTrigger(&trigA);
|
|
|
|
deleteBtn.SetEffectGrow();
|
|
|
|
|
2009-05-19 07:08:14 +02:00
|
|
|
GuiCustomOptionBrowser optionBrowser3(396, 280, &options3, CFG.theme_path, "bg_options_gamesettings.png", bg_options_settings_png, 0, 200);
|
2009-05-03 22:30:17 +02:00
|
|
|
optionBrowser3.SetPosition(0, 90);
|
|
|
|
optionBrowser3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
2009-05-19 07:08:14 +02:00
|
|
|
optionBrowser3.SetCol2Position(200);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
GuiWindow w(screenwidth, screenheight);
|
|
|
|
w.Append(&settingsbackgroundbtn);
|
|
|
|
w.Append(&titleTxt);
|
|
|
|
w.Append(&deleteBtn);
|
|
|
|
w.Append(&saveBtn);
|
|
|
|
w.Append(&cancelBtn);
|
|
|
|
|
|
|
|
mainWindow->Append(&w);
|
|
|
|
mainWindow->Append(&optionBrowser3);
|
|
|
|
|
|
|
|
ResumeGui();
|
2009-05-20 10:31:47 +02:00
|
|
|
//extern u8 favorite;
|
|
|
|
extern u8 count;
|
|
|
|
struct Game_NUM* game_num = CFG_get_game_num(header->id);
|
|
|
|
|
|
|
|
if (game_num)
|
|
|
|
{
|
|
|
|
faveChoice = game_num->favorite;
|
|
|
|
count = game_num->count;//count+=1;
|
2009-05-20 15:14:52 +02:00
|
|
|
|
2009-05-20 10:31:47 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
faveChoice = no;}
|
2009-05-20 15:14:52 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
struct Game_CFG* game_cfg = CFG_get_game_opt(header->id);
|
|
|
|
|
2009-05-04 05:45:45 +02:00
|
|
|
if (game_cfg)//if there are saved settings for this game use them
|
2009-05-03 22:30:17 +02:00
|
|
|
{
|
|
|
|
videoChoice = game_cfg->video;
|
|
|
|
languageChoice = game_cfg->language;
|
|
|
|
ocarinaChoice = game_cfg->ocarina;
|
|
|
|
viChoice = game_cfg->vipatch;
|
|
|
|
iosChoice = game_cfg->ios;
|
|
|
|
}
|
2009-05-04 05:45:45 +02:00
|
|
|
else// otherwise use the global settings
|
2009-05-03 22:30:17 +02:00
|
|
|
{
|
|
|
|
videoChoice = Settings.video;
|
|
|
|
languageChoice = Settings.language;
|
|
|
|
ocarinaChoice = Settings.ocarina;
|
2009-05-03 20:53:31 +02:00
|
|
|
viChoice = Settings.vpatch;
|
2009-05-06 13:23:10 +02:00
|
|
|
if(Settings.cios == ios222) {
|
2009-05-03 20:53:31 +02:00
|
|
|
iosChoice = i222;
|
2009-05-03 22:30:17 +02:00
|
|
|
} else {
|
2009-05-03 20:53:31 +02:00
|
|
|
iosChoice = i249;
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
while(!exit)
|
|
|
|
{
|
|
|
|
|
|
|
|
VIDEO_WaitVSync ();
|
|
|
|
|
2009-05-16 22:10:29 +02:00
|
|
|
if (videoChoice == discdefault) sprintf (options3.value[0],"%s",LANGUAGE.DiscDefault);
|
|
|
|
else if (videoChoice == systemdefault) sprintf (options3.value[0],"%s",LANGUAGE.SystemDefault);
|
|
|
|
else if (videoChoice == patch) sprintf (options3.value[0],"%s",LANGUAGE.AutoPatch);
|
2009-05-16 17:38:52 +02:00
|
|
|
else if (videoChoice == pal50) sprintf (options3.value[0],"%s PAL50",LANGUAGE.Force);
|
|
|
|
else if (videoChoice == pal60) sprintf (options3.value[0],"%s PAL60",LANGUAGE.Force);
|
|
|
|
else if (videoChoice == ntsc) sprintf (options3.value[0],"%s NTSC",LANGUAGE.Force);
|
|
|
|
|
2009-05-16 22:10:29 +02:00
|
|
|
if (viChoice == on) sprintf (options3.value[1],"%s",LANGUAGE.ON);
|
|
|
|
else if (viChoice == off) sprintf (options3.value[1],"%s",LANGUAGE.OFF);
|
|
|
|
|
|
|
|
if (languageChoice == ConsoleLangDefault) sprintf (options3.value[2],"%s",LANGUAGE.ConsoleDefault);
|
|
|
|
else if (languageChoice == jap) sprintf (options3.value[2],"%s",LANGUAGE.Japanese);
|
|
|
|
else if (languageChoice == ger) sprintf (options3.value[2],"%s",LANGUAGE.German);
|
|
|
|
else if (languageChoice == eng) sprintf (options3.value[2],"%s",LANGUAGE.English);
|
|
|
|
else if (languageChoice == fren) sprintf (options3.value[2],"%s",LANGUAGE.French);
|
|
|
|
else if (languageChoice == esp) sprintf (options3.value[2],"%s",LANGUAGE.Spanish);
|
|
|
|
else if (languageChoice == it) sprintf (options3.value[2],"%s",LANGUAGE.Italian);
|
|
|
|
else if (languageChoice == dut) sprintf (options3.value[2],"%s",LANGUAGE.Dutch);
|
|
|
|
else if (languageChoice == schin) sprintf (options3.value[2],"%s",LANGUAGE.SChinese);
|
|
|
|
else if (languageChoice == tchin) sprintf (options3.value[2],"%s",LANGUAGE.TChinese);
|
|
|
|
else if (languageChoice == kor) sprintf (options3.value[2],"%s",LANGUAGE.Korean);
|
|
|
|
|
|
|
|
if (ocarinaChoice == on) sprintf (options3.value[3],"%s",LANGUAGE.ON);
|
|
|
|
else if (ocarinaChoice == off) sprintf (options3.value[3],"%s",LANGUAGE.OFF);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
if (iosChoice == i249) sprintf (options3.value[4],"249");
|
|
|
|
else if (iosChoice == i222) sprintf (options3.value[4],"222");
|
2009-05-20 15:14:52 +02:00
|
|
|
|
2009-05-20 10:31:47 +02:00
|
|
|
if (faveChoice == yes) sprintf (options3.value[5],"%s",LANGUAGE.Yes);
|
|
|
|
else if (faveChoice == no) sprintf (options3.value[5],"%s",LANGUAGE.No);
|
2009-05-20 15:14:52 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
if(shutdown == 1)
|
|
|
|
Sys_Shutdown();
|
|
|
|
if(reset == 1)
|
|
|
|
Sys_Reboot();
|
2009-05-04 19:45:50 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
ret = optionBrowser3.GetClickedOption();
|
|
|
|
|
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
videoChoice = (videoChoice + 1) % CFG_VIDEO_COUNT;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
viChoice = (viChoice + 1) % 2;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
languageChoice = (languageChoice + 1) % CFG_LANG_COUNT;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
ocarinaChoice = (ocarinaChoice + 1) % 2;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
iosChoice = (iosChoice + 1) % 2;
|
|
|
|
break;
|
2009-05-20 10:31:47 +02:00
|
|
|
case 5:
|
|
|
|
faveChoice = (faveChoice + 1) % 2;
|
|
|
|
break;
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(saveBtn.GetState() == STATE_CLICKED)
|
2009-05-20 15:14:52 +02:00
|
|
|
{
|
|
|
|
|
2009-05-20 10:31:47 +02:00
|
|
|
if(isSdInserted() == 1) {
|
|
|
|
//////////save game play count////////////////
|
|
|
|
extern u8 favorite;
|
|
|
|
extern u8 count;
|
|
|
|
struct Game_NUM* game_num = CFG_get_game_num(header->id);
|
|
|
|
|
|
|
|
if (game_num)
|
|
|
|
{
|
|
|
|
favorite = game_num->favorite;
|
|
|
|
count = game_num->count;//count+=1;
|
2009-05-20 15:14:52 +02:00
|
|
|
|
2009-05-20 10:31:47 +02:00
|
|
|
}favorite = faveChoice;
|
2009-05-20 15:14:52 +02:00
|
|
|
|
2009-05-20 10:31:47 +02:00
|
|
|
if(isSdInserted() == 1) {
|
|
|
|
if (CFG_save_game_num(header->id))
|
|
|
|
{
|
|
|
|
//WindowPrompt(LANGUAGE.SuccessfullySaved, 0, LANGUAGE.ok, 0,0,0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WindowPrompt(LANGUAGE.SaveFailed, 0, LANGUAGE.ok, 0,0,0);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtosave, LANGUAGE.ok, 0,0,0);
|
|
|
|
}
|
|
|
|
////////////end save play count//////////////
|
|
|
|
if (CFG_save_game_opt(header->id))
|
2009-05-03 22:30:17 +02:00
|
|
|
{
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.SuccessfullySaved, 0, LANGUAGE.ok, 0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.SaveFailed, 0, LANGUAGE.ok, 0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
2009-05-08 19:06:39 +02:00
|
|
|
} else {
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtosave, LANGUAGE.ok, 0,0,0);
|
2009-05-08 19:06:39 +02:00
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
saveBtn.ResetState();
|
|
|
|
optionBrowser3.SetFocus(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cancelBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
exit = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (deleteBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
int choice = WindowPrompt(
|
2009-05-16 17:38:52 +02:00
|
|
|
LANGUAGE.Doyoureallywanttodelete,
|
2009-05-03 22:30:17 +02:00
|
|
|
gameName,
|
2009-05-16 17:38:52 +02:00
|
|
|
LANGUAGE.Yes,LANGUAGE.Cancel,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
if (choice == 1)
|
|
|
|
{
|
|
|
|
ret = WBFS_RemoveGame(header->id);
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
WindowPrompt(
|
2009-05-16 17:38:52 +02:00
|
|
|
LANGUAGE.Cantdelete,
|
2009-05-03 22:30:17 +02:00
|
|
|
gameName,
|
2009-05-16 17:38:52 +02:00
|
|
|
LANGUAGE.ok,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
__Menu_GetEntries();
|
|
|
|
WindowPrompt(
|
2009-05-16 17:38:52 +02:00
|
|
|
LANGUAGE.Successfullydeleted,
|
2009-05-03 22:30:17 +02:00
|
|
|
gameName,
|
2009-05-16 17:38:52 +02:00
|
|
|
LANGUAGE.ok,0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
retVal = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (choice == 0)
|
|
|
|
{
|
|
|
|
deleteBtn.ResetState();
|
|
|
|
optionBrowser3.SetFocus(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&optionBrowser3);
|
|
|
|
mainWindow->Remove(&w);
|
|
|
|
ResumeGui();
|
|
|
|
return retVal;
|
|
|
|
}
|
|
|
|
|
2009-05-13 17:56:16 +02:00
|
|
|
|
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* MenuCheck
|
|
|
|
***************************************************************************/
|
|
|
|
static int MenuCheck()
|
|
|
|
{
|
|
|
|
int menu = MENU_NONE;
|
|
|
|
int i = 0;
|
|
|
|
int choice;
|
|
|
|
s32 ret2;
|
|
|
|
OptionList options;
|
|
|
|
options.length = i;
|
2009-05-03 20:53:31 +02:00
|
|
|
partitionEntry partitions[MAX_PARTITIONS];
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
VIDEO_WaitVSync ();
|
|
|
|
|
|
|
|
ret2 = WBFS_Init(WBFS_DEVICE_USB);
|
|
|
|
if (ret2 < 0)
|
|
|
|
{
|
2009-05-12 08:23:22 +02:00
|
|
|
//shutdown SD
|
2009-05-15 22:03:19 +02:00
|
|
|
SDCard_deInit();
|
2009-05-12 08:23:22 +02:00
|
|
|
//initialize WiiMote for Prompt
|
|
|
|
Wpad_Init();
|
|
|
|
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
|
|
|
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
ret2 = WindowPrompt(LANGUAGE.NoUSBDevicefound,
|
|
|
|
LANGUAGE.Doyouwanttoretryfor30secs,
|
|
|
|
"cIOS249", "cIOS222",
|
|
|
|
LANGUAGE.BacktoWiiMenu, 0);
|
2009-05-12 08:23:22 +02:00
|
|
|
|
|
|
|
if(ret2 == 1) {
|
|
|
|
Settings.cios = ios249;
|
|
|
|
} else if(ret2 == 2) {
|
|
|
|
Settings.cios = ios222;
|
|
|
|
} else {
|
|
|
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
|
|
|
}
|
|
|
|
//shutdown WiiMote before IOS Reload
|
|
|
|
WPAD_Flush(0);
|
|
|
|
WPAD_Disconnect(0);
|
|
|
|
WPAD_Shutdown();
|
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
ret2 = DiscWait(LANGUAGE.NoUSBDevice, LANGUAGE.WaitingforUSBDevice, 0, 0, 1);
|
2009-05-04 05:45:45 +02:00
|
|
|
PAD_Init();
|
2009-05-03 22:30:17 +02:00
|
|
|
Wpad_Init();
|
|
|
|
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
|
|
|
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
2009-05-15 22:03:19 +02:00
|
|
|
SDCard_Init();
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
if (ret2 < 0) {
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt (LANGUAGE.Error,LANGUAGE.USBDevicenotfound, LANGUAGE.ok, 0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
|
|
|
} else {
|
|
|
|
PAD_Init();
|
|
|
|
Wpad_Init();
|
|
|
|
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
|
|
|
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
2009-05-15 22:03:19 +02:00
|
|
|
SDCard_Init();
|
2009-05-03 22:30:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ret2 = Disc_Init();
|
|
|
|
if (ret2 < 0) {
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt (LANGUAGE.Error,LANGUAGE.CouldnotinitializeDIPmodule,LANGUAGE.ok, 0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
ret2 = WBFS_Open();
|
|
|
|
if (ret2 < 0) {
|
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
choice = WindowPrompt(LANGUAGE.NoWBFSpartitionfound,
|
|
|
|
LANGUAGE.Youneedtoformatapartition,
|
|
|
|
LANGUAGE.Format,
|
|
|
|
LANGUAGE.Return,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
if(choice == 0)
|
|
|
|
{
|
|
|
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
/* Get partition entries */
|
|
|
|
u32 sector_size;
|
|
|
|
ret2 = Partition_GetEntries(partitions, §or_size);
|
|
|
|
if (ret2 < 0) {
|
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
WindowPrompt (LANGUAGE.Nopartitionsfound,0, LANGUAGE.Restart, 0,0,0);
|
2009-05-03 22:30:17 +02:00
|
|
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
menu = MENU_FORMAT;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(shutdown == 1)
|
|
|
|
Sys_Shutdown();
|
|
|
|
if(reset == 1)
|
|
|
|
Sys_Reboot();
|
|
|
|
//Spieleliste laden
|
|
|
|
__Menu_GetEntries();
|
|
|
|
|
2009-05-15 22:03:19 +02:00
|
|
|
if(menu == MENU_NONE)
|
2009-05-03 22:30:17 +02:00
|
|
|
menu = MENU_DISCLIST;
|
|
|
|
|
|
|
|
return menu;
|
|
|
|
}
|
2009-05-20 02:03:43 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* MenuOGG
|
|
|
|
***************************************************************************/
|
|
|
|
int MenuOGG()
|
|
|
|
{
|
|
|
|
int menu = MENU_NONE, cnt = 0;
|
|
|
|
int ret = 0, choice = 0;
|
|
|
|
int scrollon, nothingchanged = 0;
|
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol);
|
|
|
|
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, vol);
|
|
|
|
|
|
|
|
char imgPath[100];
|
|
|
|
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
|
|
|
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%ssettings_background.png", CFG.theme_path);
|
|
|
|
GuiImageData settingsbg(imgPath, settings_background_png);
|
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
GuiTrigger trigB;
|
|
|
|
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
|
|
|
GuiTrigger trigMinus;
|
|
|
|
trigMinus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, 0);
|
|
|
|
GuiTrigger trigPlus;
|
|
|
|
trigPlus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, 0);
|
|
|
|
|
|
|
|
char fullpath[150];
|
|
|
|
char shortpath[35];
|
|
|
|
int countmp3 = GetFiles(CFG.oggload_path);
|
|
|
|
|
|
|
|
if(!strcmp("", CFG.oggload_path)) {
|
|
|
|
sprintf(shortpath, "%s", LANGUAGE.Standard);
|
|
|
|
} else if (strlen(CFG.oggload_path) < (27 + 3)) {
|
|
|
|
sprintf(shortpath, "%s", CFG.oggload_path);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
strncpy(shortpath, CFG.oggload_path, 27);
|
|
|
|
shortpath[27] = '\0';
|
|
|
|
strncat(shortpath, "...", 3);
|
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
|
2009-05-20 02:03:43 +02:00
|
|
|
GuiText titleTxt(shortpath, 24, (GXColor){0, 0, 0, 255});
|
|
|
|
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
titleTxt.SetPosition(0,0);
|
|
|
|
GuiButton pathBtn(300, 50);
|
|
|
|
pathBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
pathBtn.SetPosition(0,28);
|
|
|
|
pathBtn.SetLabel(&titleTxt);
|
|
|
|
pathBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
pathBtn.SetSoundClick(&btnClick);
|
|
|
|
pathBtn.SetTrigger(&trigA);
|
|
|
|
pathBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiImage oggmenubackground(&settingsbg);
|
|
|
|
oggmenubackground.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
oggmenubackground.SetPosition(0, 0);
|
|
|
|
|
|
|
|
GuiText backBtnTxt(LANGUAGE.Back , 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
|
|
|
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
|
|
|
GuiImage backBtnImg(&btnOutline);
|
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
backBtnTxt.SetWidescreen(CFG.widescreen);
|
2009-05-20 02:03:43 +02:00
|
|
|
backBtnImg.SetWidescreen(CFG.widescreen);}//////
|
|
|
|
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
backBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
backBtn.SetPosition(-180, 400);
|
|
|
|
backBtn.SetLabel(&backBtnTxt);
|
|
|
|
backBtn.SetImage(&backBtnImg);
|
|
|
|
backBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
backBtn.SetSoundClick(&btnClick);
|
|
|
|
backBtn.SetTrigger(&trigA);
|
|
|
|
backBtn.SetTrigger(&trigB);
|
|
|
|
backBtn.SetEffectGrow();
|
|
|
|
|
2009-05-20 10:03:22 +02:00
|
|
|
customOptionList options2(countmp3);
|
2009-05-20 02:03:43 +02:00
|
|
|
|
|
|
|
for (cnt = 0; cnt < countmp3; cnt++) {
|
|
|
|
snprintf(options2.value[cnt], 30, "%s", mp3files[cnt]);
|
|
|
|
sprintf (options2.name[cnt],"%i.", cnt+1);
|
|
|
|
}
|
|
|
|
options2.length = cnt;
|
|
|
|
|
|
|
|
if(cnt < 9) {
|
|
|
|
scrollon = 0;
|
|
|
|
} else {
|
|
|
|
scrollon = 1;
|
|
|
|
}
|
|
|
|
|
2009-05-20 10:31:47 +02:00
|
|
|
GuiCustomOptionBrowser optionBrowser4(396, 280, &options2, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, scrollon, 55);
|
2009-05-20 02:03:43 +02:00
|
|
|
optionBrowser4.SetPosition(0, 90);
|
|
|
|
optionBrowser4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
|
|
|
|
int songPlaying=0;
|
|
|
|
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sarrow_next.png", CFG.theme_path);
|
|
|
|
GuiImageData next(imgPath, arrow_next_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sarrow_previous.png", CFG.theme_path);
|
|
|
|
GuiImageData prev(imgPath, arrow_previous_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%smp3_stop.png", CFG.theme_path);
|
|
|
|
GuiImageData stop(imgPath, mp3_stop_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%smp3_pause.png", CFG.theme_path);
|
|
|
|
GuiImageData pause(imgPath, mp3_pause_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_right.png", CFG.theme_path);
|
|
|
|
GuiImageData play(imgPath, startgame_arrow_right_png);
|
|
|
|
|
|
|
|
GuiImage nextBtnImg(&next);
|
|
|
|
GuiButton nextBtn(next.GetWidth(), next.GetHeight());
|
|
|
|
nextBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
nextBtn.SetPosition(130, 400);
|
|
|
|
nextBtn.SetImage(&nextBtnImg);
|
|
|
|
nextBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
nextBtn.SetSoundClick(&btnClick);
|
|
|
|
nextBtn.SetTrigger(&trigA);
|
|
|
|
nextBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiImage prevBtnImg(&prev);
|
|
|
|
prevBtnImg.SetWidescreen(CFG.widescreen);
|
|
|
|
GuiButton prevBtn(prev.GetWidth(), prev.GetHeight());
|
|
|
|
prevBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
prevBtn.SetPosition(-60, 400);
|
|
|
|
prevBtn.SetImage(&prevBtnImg);
|
|
|
|
prevBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
prevBtn.SetSoundClick(&btnClick);
|
|
|
|
prevBtn.SetTrigger(&trigA);
|
|
|
|
prevBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiImage playBtnImg(&play);
|
|
|
|
playBtnImg.SetWidescreen(CFG.widescreen);
|
|
|
|
GuiButton playBtn(play.GetWidth(), play.GetHeight());
|
|
|
|
playBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
playBtn.SetPosition(72, 400);
|
|
|
|
playBtn.SetImage(&playBtnImg);
|
|
|
|
playBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
playBtn.SetSoundClick(&btnClick);
|
|
|
|
playBtn.SetTrigger(&trigA);
|
|
|
|
playBtn.SetTrigger(&trigPlus);
|
|
|
|
playBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiImage stopBtnImg(&stop);
|
|
|
|
stopBtnImg.SetWidescreen(CFG.widescreen);
|
|
|
|
GuiButton stopBtn(stop.GetWidth(), stop.GetHeight());
|
|
|
|
stopBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
stopBtn.SetPosition(17, 400);
|
|
|
|
stopBtn.SetImage(&stopBtnImg);
|
|
|
|
stopBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
stopBtn.SetSoundClick(&btnClick);
|
|
|
|
stopBtn.SetTrigger(&trigA);
|
|
|
|
stopBtn.SetTrigger(&trigMinus);
|
|
|
|
stopBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
GuiWindow w(screenwidth, screenheight);
|
|
|
|
w.Append(&oggmenubackground);
|
|
|
|
w.Append(&pathBtn);
|
|
|
|
w.Append(&backBtn);
|
|
|
|
w.Append(&playBtn);
|
|
|
|
w.Append(&nextBtn);
|
|
|
|
w.Append(&prevBtn);
|
|
|
|
w.Append(&stopBtn);
|
|
|
|
mainWindow->Append(&w);
|
|
|
|
mainWindow->Append(&optionBrowser4);
|
|
|
|
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(menu == MENU_NONE)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (backBtn.GetState() == STATE_CLICKED) {
|
|
|
|
if(nothingchanged == 1 && countmp3 > 0) {
|
|
|
|
if(!strcmp("", CFG.oggload_path) || !strcmp("notset", CFG.ogg_path)) {
|
|
|
|
bgMusic->Play();
|
|
|
|
} else {
|
|
|
|
bgMusic->PlayOggFile(CFG.ogg_path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
menu = MENU_SETTINGS;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pathBtn.GetState() == STATE_CLICKED) {
|
|
|
|
mainWindow->Remove(&optionBrowser4);
|
|
|
|
w.Remove(&backBtn);
|
|
|
|
w.Remove(&pathBtn);
|
|
|
|
w.Remove(&playBtn);
|
|
|
|
w.Remove(&nextBtn);
|
|
|
|
w.Remove(&prevBtn);
|
|
|
|
w.Remove(&stopBtn);
|
|
|
|
char entered[43] = "";
|
|
|
|
strncpy(entered, CFG.oggload_path, sizeof(entered));
|
|
|
|
int result = OnScreenKeyboard(entered,43,0);
|
|
|
|
mainWindow->Append(&optionBrowser4);
|
|
|
|
w.Append(&pathBtn);
|
|
|
|
w.Append(&backBtn);
|
|
|
|
w.Append(&playBtn);
|
|
|
|
w.Append(&nextBtn);
|
|
|
|
w.Append(&prevBtn);
|
|
|
|
w.Append(&stopBtn);
|
|
|
|
if ( result == 1 ) {
|
|
|
|
strncpy(CFG.oggload_path, entered, sizeof(CFG.oggload_path));
|
|
|
|
WindowPrompt(LANGUAGE.Backgroundmusicpath,0,LANGUAGE.ok,0,0,0);
|
|
|
|
if(isSdInserted() == 1) {
|
|
|
|
cfg_save_global();
|
|
|
|
if(!strcmp("", CFG.oggload_path)) {
|
2009-05-20 10:03:22 +02:00
|
|
|
sprintf(CFG.ogg_path, "notset");
|
2009-05-20 02:03:43 +02:00
|
|
|
bgMusic->Play();
|
|
|
|
}
|
|
|
|
menu = MENU_OGG;
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtosave, LANGUAGE.ok, 0,0,0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(countmp3 > 0) {
|
|
|
|
optionBrowser4.SetFocus(1);
|
|
|
|
}
|
|
|
|
pathBtn.ResetState();
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = optionBrowser4.GetClickedOption();
|
|
|
|
|
|
|
|
if(ret>=0) {
|
|
|
|
choice = WindowPrompt(LANGUAGE.Setasbackgroundmusic,mp3files[ret],LANGUAGE.Yes,LANGUAGE.No,0,0);
|
|
|
|
if(choice == 1) {
|
|
|
|
snprintf(fullpath,150,"%s%s",CFG.oggload_path,mp3files[ret]);
|
|
|
|
choice = bgMusic->PlayOggFile(fullpath);
|
|
|
|
if(choice < 0) {
|
|
|
|
WindowPrompt(LANGUAGE.Notasupportedformat, LANGUAGE.Loadingstandardmusic, LANGUAGE.ok, 0,0,0);
|
|
|
|
sprintf(CFG.ogg_path, "notset");
|
|
|
|
bgMusic->Play();
|
2009-05-20 10:03:22 +02:00
|
|
|
SetVolumeOgg(255*(vol/100.0));
|
2009-05-20 02:03:43 +02:00
|
|
|
} else {
|
|
|
|
snprintf(CFG.ogg_path, sizeof(CFG.ogg_path), "%s", fullpath);
|
|
|
|
cfg_save_global();
|
|
|
|
SetVolumeOgg(255*(vol/100.0));
|
|
|
|
nothingchanged = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
optionBrowser4.SetFocus(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (playBtn.GetState() == STATE_CLICKED && countmp3 > 0) {
|
|
|
|
if(countmp3 > 0) {
|
|
|
|
ret = optionBrowser4.GetSelectedOption();
|
|
|
|
songPlaying=ret;
|
|
|
|
snprintf(fullpath, 150,"%s%s", CFG.oggload_path,mp3files[ret]);
|
|
|
|
choice = bgMusic->PlayOggFile(fullpath);
|
|
|
|
if(choice < 0) {
|
|
|
|
WindowPrompt(LANGUAGE.Notasupportedformat, LANGUAGE.Loadingstandardmusic, LANGUAGE.ok, 0,0,0);
|
|
|
|
if(!strcmp("", CFG.oggload_path) || !strcmp("notset", CFG.ogg_path)) {
|
|
|
|
bgMusic->Play();
|
|
|
|
} else {
|
|
|
|
bgMusic->PlayOggFile(CFG.ogg_path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SetVolumeOgg(255*(vol/100.0));
|
|
|
|
songPlaying=ret;
|
|
|
|
nothingchanged = 1;
|
|
|
|
optionBrowser4.SetFocus(1);
|
|
|
|
}
|
|
|
|
playBtn.ResetState();
|
|
|
|
}
|
|
|
|
|
|
|
|
if(nextBtn.GetState() == STATE_CLICKED){
|
|
|
|
if(countmp3 > 0) {
|
|
|
|
songPlaying++;
|
|
|
|
if (songPlaying>(countmp3 - 1)){songPlaying=0;}
|
|
|
|
snprintf(fullpath,150,"%s%s", CFG.oggload_path,mp3files[songPlaying]);
|
|
|
|
choice = bgMusic->PlayOggFile(fullpath);
|
|
|
|
if(choice < 0) {
|
|
|
|
WindowPrompt(LANGUAGE.Notasupportedformat, LANGUAGE.Loadingstandardmusic, LANGUAGE.ok, 0,0,0);
|
|
|
|
if(!strcmp("", CFG.oggload_path) || !strcmp("notset", CFG.ogg_path)) {
|
|
|
|
bgMusic->Play();
|
|
|
|
} else {
|
|
|
|
bgMusic->PlayOggFile(CFG.ogg_path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nothingchanged = 1;
|
|
|
|
optionBrowser4.SetFocus(1);
|
|
|
|
}
|
|
|
|
SetVolumeOgg(255*(vol/100.0));
|
|
|
|
nextBtn.ResetState();
|
|
|
|
}
|
|
|
|
if(prevBtn.GetState() == STATE_CLICKED) {
|
|
|
|
if(countmp3 > 0) {
|
|
|
|
songPlaying--;
|
|
|
|
if (songPlaying<0){songPlaying=(countmp3 - 1);}
|
|
|
|
snprintf(fullpath,150,"%s%s", CFG.oggload_path,mp3files[songPlaying]);
|
|
|
|
choice = bgMusic->PlayOggFile(fullpath);
|
|
|
|
if(choice < 0) {
|
|
|
|
WindowPrompt(LANGUAGE.Notasupportedformat, LANGUAGE.Loadingstandardmusic, LANGUAGE.ok, 0,0,0);
|
|
|
|
if(!strcmp("", CFG.oggload_path) || !strcmp("notset", CFG.ogg_path)) {
|
|
|
|
bgMusic->Play();
|
|
|
|
} else {
|
|
|
|
bgMusic->PlayOggFile(CFG.ogg_path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nothingchanged = 1;
|
|
|
|
optionBrowser4.SetFocus(1);
|
|
|
|
}
|
|
|
|
SetVolumeOgg(255*(vol/100.0));
|
|
|
|
prevBtn.ResetState();
|
|
|
|
}
|
|
|
|
if(stopBtn.GetState() == STATE_CLICKED) {
|
|
|
|
if(countmp3 > 0) {
|
|
|
|
StopOgg();
|
|
|
|
nothingchanged = 1;
|
|
|
|
optionBrowser4.SetFocus(1);
|
|
|
|
}
|
|
|
|
stopBtn.ResetState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&optionBrowser4);
|
|
|
|
mainWindow->Remove(&w);
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* MenuMp3
|
|
|
|
***************************************************************************/
|
2009-05-13 17:56:16 +02:00
|
|
|
int MenuMp3()
|
|
|
|
{
|
|
|
|
int menu = MENU_NONE, cnt = 0;
|
|
|
|
int ret = 0;
|
|
|
|
int scrollon, i = 0;
|
2009-05-13 18:54:50 +02:00
|
|
|
char imgPath[100];
|
2009-05-13 17:56:16 +02:00
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol);
|
|
|
|
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, vol);
|
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
customOptionList options2(500);
|
|
|
|
char mp3path[30] = "SD:/mp3/";
|
2009-05-13 22:55:33 +02:00
|
|
|
char fullpath[110];
|
2009-05-13 17:56:16 +02:00
|
|
|
int countmp3 = GetFiles(mp3path);
|
|
|
|
|
|
|
|
for (cnt = 0; cnt < countmp3; cnt++) {
|
|
|
|
snprintf(options2.value[cnt], 30, "%s", mp3files[cnt]);
|
|
|
|
sprintf (options2.name[cnt],"%i.", cnt+1);
|
|
|
|
}
|
|
|
|
options2.length = cnt;
|
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
|
|
|
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
|
|
|
if(cnt < 9) {
|
2009-05-13 17:56:16 +02:00
|
|
|
scrollon = 0;
|
|
|
|
} else {
|
|
|
|
scrollon = 1;
|
|
|
|
}
|
2009-05-19 07:08:14 +02:00
|
|
|
GuiCustomOptionBrowser optionBrowser4(396, 280, &options2, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, scrollon, 85);
|
2009-05-13 17:56:16 +02:00
|
|
|
optionBrowser4.SetPosition(0, 90);
|
|
|
|
optionBrowser4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
2009-05-19 07:08:14 +02:00
|
|
|
optionBrowser4.SetCol2Position(85);
|
2009-05-13 17:56:16 +02:00
|
|
|
|
2009-05-18 11:33:23 +02:00
|
|
|
GuiText cancelBtnTxt(LANGUAGE.Back, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
2009-05-13 17:56:16 +02:00
|
|
|
cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
|
|
|
GuiImage cancelBtnImg(&btnOutline);
|
|
|
|
if (Settings.wsprompt == yes){
|
2009-05-20 22:09:57 +02:00
|
|
|
cancelBtnTxt.SetWidescreen(CFG.widescreen);
|
2009-05-13 17:56:16 +02:00
|
|
|
cancelBtnImg.SetWidescreen(CFG.widescreen);}
|
|
|
|
GuiButton cancelBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
cancelBtn.SetScale(0.9);
|
|
|
|
cancelBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
2009-05-13 18:54:50 +02:00
|
|
|
cancelBtn.SetPosition(210, 400);
|
2009-05-13 17:56:16 +02:00
|
|
|
cancelBtn.SetLabel(&cancelBtnTxt);
|
|
|
|
cancelBtn.SetImage(&cancelBtnImg);
|
|
|
|
cancelBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
cancelBtn.SetTrigger(&trigA);
|
|
|
|
cancelBtn.SetEffectGrow();
|
|
|
|
|
2009-05-13 18:54:50 +02:00
|
|
|
int songPlaying=0;
|
|
|
|
|
|
|
|
GuiTrigger trigHome;
|
|
|
|
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
|
|
|
|
GuiTrigger trigL;
|
|
|
|
trigL.SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT);
|
|
|
|
GuiTrigger trigR;
|
|
|
|
trigR.SetButtonOnlyTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT);
|
|
|
|
GuiTrigger trigMinus;
|
|
|
|
trigMinus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, 0);
|
|
|
|
GuiTrigger trigPlus;
|
|
|
|
trigPlus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, 0);
|
|
|
|
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sarrow_next.png", CFG.theme_path);
|
|
|
|
GuiImageData next(imgPath, arrow_next_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sarrow_previous.png", CFG.theme_path);
|
|
|
|
GuiImageData prev(imgPath, arrow_previous_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%smp3_stop.png", CFG.theme_path);
|
|
|
|
GuiImageData stop(imgPath, mp3_stop_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%smp3_pause.png", CFG.theme_path);
|
|
|
|
GuiImageData pause(imgPath, mp3_pause_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_right.png", CFG.theme_path);
|
|
|
|
GuiImageData play(imgPath, startgame_arrow_right_png);
|
2009-05-13 22:55:33 +02:00
|
|
|
|
2009-05-13 18:54:50 +02:00
|
|
|
GuiImage nextBtnImg(&next);
|
|
|
|
GuiButton nextBtn(next.GetWidth(), next.GetHeight());
|
|
|
|
nextBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
nextBtn.SetPosition(100, 400);
|
|
|
|
nextBtn.SetImage(&nextBtnImg);
|
|
|
|
nextBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
nextBtn.SetSoundClick(&btnClick);
|
|
|
|
nextBtn.SetTrigger(&trigA);
|
|
|
|
nextBtn.SetTrigger(&trigR);
|
|
|
|
nextBtn.SetEffectGrow();
|
2009-05-13 22:55:33 +02:00
|
|
|
|
2009-05-13 18:54:50 +02:00
|
|
|
GuiImage prevBtnImg(&prev);
|
|
|
|
prevBtnImg.SetWidescreen(CFG.widescreen);
|
|
|
|
GuiButton prevBtn(prev.GetWidth(), prev.GetHeight());
|
|
|
|
prevBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
prevBtn.SetPosition(-100, 400);
|
|
|
|
prevBtn.SetImage(&prevBtnImg);
|
|
|
|
prevBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
prevBtn.SetSoundClick(&btnClick);
|
|
|
|
prevBtn.SetTrigger(&trigA);
|
|
|
|
prevBtn.SetTrigger(&trigL);
|
|
|
|
prevBtn.SetEffectGrow();
|
2009-05-13 22:55:33 +02:00
|
|
|
|
2009-05-13 18:54:50 +02:00
|
|
|
GuiImage playBtnImg(&play);
|
|
|
|
playBtnImg.SetWidescreen(CFG.widescreen);
|
|
|
|
GuiButton playBtn(play.GetWidth(), play.GetHeight());
|
2009-05-13 17:56:16 +02:00
|
|
|
playBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
2009-05-13 18:54:50 +02:00
|
|
|
playBtn.SetPosition(42, 400);
|
2009-05-13 17:56:16 +02:00
|
|
|
playBtn.SetImage(&playBtnImg);
|
|
|
|
playBtn.SetSoundOver(&btnSoundOver);
|
2009-05-13 18:54:50 +02:00
|
|
|
playBtn.SetSoundClick(&btnClick);
|
2009-05-13 17:56:16 +02:00
|
|
|
playBtn.SetTrigger(&trigA);
|
2009-05-13 18:54:50 +02:00
|
|
|
playBtn.SetTrigger(&trigPlus);
|
2009-05-13 17:56:16 +02:00
|
|
|
playBtn.SetEffectGrow();
|
2009-05-13 22:55:33 +02:00
|
|
|
|
2009-05-13 18:54:50 +02:00
|
|
|
GuiImage stopBtnImg(&stop);
|
|
|
|
stopBtnImg.SetWidescreen(CFG.widescreen);
|
|
|
|
GuiButton stopBtn(stop.GetWidth(), stop.GetHeight());
|
|
|
|
stopBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
stopBtn.SetPosition(-27, 400);
|
|
|
|
stopBtn.SetImage(&stopBtnImg);
|
|
|
|
stopBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
stopBtn.SetSoundClick(&btnClick);
|
|
|
|
stopBtn.SetTrigger(&trigA);
|
|
|
|
stopBtn.SetTrigger(&trigMinus);
|
|
|
|
stopBtn.SetEffectGrow();
|
2009-05-13 22:55:33 +02:00
|
|
|
|
2009-05-13 18:54:50 +02:00
|
|
|
GuiImage pauseBtnImg(&pause);
|
|
|
|
pauseBtnImg.SetWidescreen(CFG.widescreen);
|
2009-05-13 17:56:16 +02:00
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
GuiWindow w(screenwidth, screenheight);
|
|
|
|
w.Append(&cancelBtn);
|
|
|
|
w.Append(&playBtn);
|
2009-05-13 18:54:50 +02:00
|
|
|
w.Append(&playBtn);
|
|
|
|
w.Append(&nextBtn);
|
|
|
|
w.Append(&prevBtn);
|
|
|
|
w.Append(&stopBtn);
|
2009-05-13 17:56:16 +02:00
|
|
|
mainWindow->Append(&optionBrowser4);
|
|
|
|
mainWindow->Append(&w);
|
|
|
|
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(menu == MENU_NONE)
|
|
|
|
{
|
|
|
|
if (cancelBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
menu = MENU_DISCLIST;
|
|
|
|
CloseMp3();
|
|
|
|
bgMusic->Play();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = optionBrowser4.GetClickedOption();
|
|
|
|
|
|
|
|
for(i = 0; i < countmp3; i++) {
|
|
|
|
if(i == ret) {
|
|
|
|
sprintf(fullpath,"%s%s", mp3path,mp3files[ret]);
|
|
|
|
PlayMp3(fullpath);
|
2009-05-13 18:54:50 +02:00
|
|
|
songPlaying=ret;
|
2009-05-13 17:56:16 +02:00
|
|
|
SetMp3Volume(127);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (playBtn.GetState() == STATE_CLICKED) {
|
2009-05-13 18:54:50 +02:00
|
|
|
StopMp3();
|
2009-05-13 17:56:16 +02:00
|
|
|
ret = optionBrowser4.GetSelectedOption();
|
2009-05-13 18:54:50 +02:00
|
|
|
songPlaying=ret;
|
2009-05-13 17:56:16 +02:00
|
|
|
sprintf(fullpath,"%s%s", mp3path,mp3files[ret]);
|
|
|
|
PlayMp3(fullpath);
|
|
|
|
SetMp3Volume(127);
|
2009-05-20 15:14:52 +02:00
|
|
|
playBtn.ResetState();
|
2009-05-13 22:55:33 +02:00
|
|
|
|
2009-05-13 17:56:16 +02:00
|
|
|
}
|
2009-05-13 22:55:33 +02:00
|
|
|
|
2009-05-13 18:54:50 +02:00
|
|
|
if(nextBtn.GetState() == STATE_CLICKED)
|
2009-05-13 22:55:33 +02:00
|
|
|
{
|
2009-05-13 18:54:50 +02:00
|
|
|
StopMp3();
|
|
|
|
songPlaying++;
|
2009-05-13 21:03:21 +02:00
|
|
|
if (songPlaying>(countmp3 - 1)){songPlaying=0;}
|
2009-05-13 18:54:50 +02:00
|
|
|
sprintf(fullpath,"%s%s", mp3path,mp3files[songPlaying]);
|
|
|
|
PlayMp3(fullpath);
|
|
|
|
SetMp3Volume(127);
|
|
|
|
nextBtn.ResetState();
|
|
|
|
}
|
|
|
|
if(prevBtn.GetState() == STATE_CLICKED)
|
2009-05-13 22:55:33 +02:00
|
|
|
{
|
2009-05-13 18:54:50 +02:00
|
|
|
StopMp3();
|
|
|
|
songPlaying--;
|
2009-05-13 21:03:21 +02:00
|
|
|
if (songPlaying<0){songPlaying=(countmp3 - 1);}
|
2009-05-13 18:54:50 +02:00
|
|
|
sprintf(fullpath,"%s%s", mp3path,mp3files[songPlaying]);
|
|
|
|
PlayMp3(fullpath);
|
|
|
|
SetMp3Volume(127);
|
|
|
|
prevBtn.ResetState();
|
|
|
|
}
|
|
|
|
if(stopBtn.GetState() == STATE_CLICKED)
|
|
|
|
{ StopMp3();
|
|
|
|
stopBtn.ResetState();
|
|
|
|
playBtn.SetImage(&playBtnImg);
|
|
|
|
//break;
|
|
|
|
}
|
2009-05-13 17:56:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HaltGui();
|
2009-05-13 18:54:50 +02:00
|
|
|
w.Remove(&playBtn);
|
|
|
|
w.Remove(&nextBtn);
|
|
|
|
w.Remove(&prevBtn);
|
|
|
|
w.Remove(&stopBtn);
|
2009-05-13 17:56:16 +02:00
|
|
|
mainWindow->Remove(&optionBrowser4);
|
|
|
|
mainWindow->Remove(&w);
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
return menu;
|
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* MainMenu
|
|
|
|
***************************************************************************/
|
|
|
|
int MainMenu(int menu)
|
|
|
|
{
|
|
|
|
|
|
|
|
int currentMenu = menu;
|
|
|
|
char imgPath[100];
|
|
|
|
|
2009-05-05 19:24:19 +02:00
|
|
|
#ifdef HW_RVL
|
2009-05-03 22:30:17 +02:00
|
|
|
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);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
mainWindow = new GuiWindow(screenwidth, screenheight);
|
|
|
|
|
|
|
|
if (CFG.widescreen)
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%swbackground.png", CFG.theme_path);
|
|
|
|
else
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sbackground.png", CFG.theme_path);
|
|
|
|
|
|
|
|
background = new GuiImageData(imgPath, CFG.widescreen? wbackground_png : background_png);
|
|
|
|
|
|
|
|
bgImg = new GuiImage(background);
|
|
|
|
mainWindow->Append(bgImg);
|
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
ResumeGui();
|
|
|
|
|
2009-05-03 20:53:31 +02:00
|
|
|
bgMusic = new GuiSound(bg_music_ogg, bg_music_ogg_size, SOUND_OGG, vol);
|
2009-05-03 22:30:17 +02:00
|
|
|
bgMusic->SetVolume(vol);
|
|
|
|
bgMusic->SetLoop(1); //loop music
|
2009-05-20 02:03:43 +02:00
|
|
|
// startup music
|
|
|
|
if(!strcmp("", CFG.oggload_path) || !strcmp("notset", CFG.ogg_path)) {
|
|
|
|
bgMusic->Play();
|
|
|
|
} else {
|
|
|
|
bgMusic->PlayOggFile(CFG.ogg_path);
|
|
|
|
}
|
2009-05-03 22:30:17 +02:00
|
|
|
|
|
|
|
while(currentMenu != MENU_EXIT)
|
2009-05-03 20:53:31 +02:00
|
|
|
{
|
2009-05-20 02:03:43 +02:00
|
|
|
SetVolumeOgg(255*(vol/100.0));
|
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
switch (currentMenu)
|
|
|
|
{
|
|
|
|
case MENU_CHECK:
|
|
|
|
currentMenu = MenuCheck();
|
|
|
|
break;
|
|
|
|
case MENU_FORMAT:
|
|
|
|
currentMenu = MenuFormat();
|
|
|
|
break;
|
|
|
|
case MENU_INSTALL:
|
|
|
|
currentMenu = MenuInstall();
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS:
|
|
|
|
currentMenu = MenuSettings();
|
|
|
|
break;
|
|
|
|
case MENU_DISCLIST:
|
|
|
|
currentMenu = MenuDiscList();
|
|
|
|
break;
|
2009-05-13 17:56:16 +02:00
|
|
|
case MENU_MP3:
|
|
|
|
currentMenu = MenuMp3();
|
|
|
|
break;
|
2009-05-20 02:03:43 +02:00
|
|
|
case MENU_OGG:
|
|
|
|
currentMenu = MenuOGG();
|
|
|
|
break;
|
2009-05-03 22:30:17 +02:00
|
|
|
default: // unrecognized menu
|
|
|
|
currentMenu = MenuCheck();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (Settings.volume)
|
|
|
|
{
|
|
|
|
case v10:
|
|
|
|
vol = 10;
|
|
|
|
break;
|
|
|
|
case v20:
|
|
|
|
vol = 20;
|
|
|
|
break;
|
|
|
|
case v30:
|
|
|
|
vol = 30;
|
|
|
|
break;
|
|
|
|
case v40:
|
|
|
|
vol = 40;
|
|
|
|
break;
|
|
|
|
case v50:
|
|
|
|
vol = 50;
|
|
|
|
break;
|
|
|
|
case v60:
|
|
|
|
vol = 60;
|
|
|
|
break;
|
|
|
|
case v70:
|
|
|
|
vol = 70;
|
|
|
|
break;
|
|
|
|
case v80:
|
|
|
|
vol = 80;
|
|
|
|
break;
|
|
|
|
case v90:
|
|
|
|
vol = 90;
|
|
|
|
break;
|
|
|
|
case v100:
|
|
|
|
vol = 100;
|
|
|
|
break;
|
|
|
|
case v0:
|
|
|
|
vol = 0;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
vol = 80;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bgMusic->Stop();
|
|
|
|
delete bgMusic;
|
|
|
|
delete background;
|
|
|
|
delete bgImg;
|
|
|
|
delete mainWindow;
|
|
|
|
delete pointer[0];
|
|
|
|
delete pointer[1];
|
|
|
|
delete pointer[2];
|
|
|
|
delete pointer[3];
|
|
|
|
|
|
|
|
delete cover;
|
|
|
|
delete coverImg;
|
|
|
|
|
|
|
|
mainWindow = NULL;
|
2009-05-06 12:23:58 +02:00
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
ExitApp();
|
|
|
|
|
2009-05-06 01:07:22 +02:00
|
|
|
struct discHdr *header = &gameList[gameSelected];
|
|
|
|
struct Game_CFG* game_cfg = CFG_get_game_opt(header->id);
|
|
|
|
|
|
|
|
if (game_cfg) {
|
|
|
|
|
|
|
|
videoChoice = game_cfg->video;
|
|
|
|
languageChoice = game_cfg->language;
|
|
|
|
ocarinaChoice = game_cfg->ocarina;
|
|
|
|
viChoice = game_cfg->vipatch;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
videoChoice = Settings.video;
|
|
|
|
languageChoice = Settings.language;
|
|
|
|
ocarinaChoice = Settings.ocarina;
|
|
|
|
viChoice = Settings.vpatch;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-05-03 22:30:17 +02:00
|
|
|
switch(languageChoice)
|
|
|
|
{
|
|
|
|
case ConsoleLangDefault:
|
|
|
|
configbytes[0] = 0xCD;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case jap:
|
|
|
|
configbytes[0] = 0x00;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eng:
|
|
|
|
configbytes[0] = 0x01;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ger:
|
|
|
|
configbytes[0] = 0x02;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case fren:
|
|
|
|
configbytes[0] = 0x03;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case esp:
|
|
|
|
configbytes[0] = 0x04;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case it:
|
|
|
|
configbytes[0] = 0x05;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case dut:
|
|
|
|
configbytes[0] = 0x06;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case schin:
|
|
|
|
configbytes[0] = 0x07;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case tchin:
|
|
|
|
configbytes[0] = 0x08;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case kor:
|
|
|
|
configbytes[0] = 0x09;
|
|
|
|
break;
|
|
|
|
//wenn nicht genau klar ist welches
|
|
|
|
default:
|
|
|
|
configbytes[0] = 0xCD;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 videoselected = 0;
|
|
|
|
|
|
|
|
switch(videoChoice)
|
|
|
|
{
|
|
|
|
case discdefault:
|
|
|
|
videoselected = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case pal50:
|
|
|
|
videoselected = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case pal60:
|
|
|
|
videoselected = 2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ntsc:
|
|
|
|
videoselected = 3;
|
|
|
|
|
|
|
|
case systemdefault:
|
|
|
|
|
|
|
|
videoselected = 4;
|
|
|
|
break;
|
|
|
|
case patch:
|
|
|
|
|
|
|
|
videoselected = 5;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
videoselected = 3;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 cheat = 0;
|
|
|
|
switch(ocarinaChoice)
|
|
|
|
{
|
|
|
|
case on:
|
|
|
|
cheat = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case off:
|
|
|
|
cheat = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
cheat = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
u8 vipatch = 0;
|
|
|
|
switch(viChoice)
|
|
|
|
{
|
|
|
|
case on:
|
|
|
|
vipatch = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case off:
|
|
|
|
vipatch = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
vipatch = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ret = 0;
|
|
|
|
ret = Disc_WiiBoot(videoselected, cheat, vipatch);
|
|
|
|
if (ret < 0) {
|
2009-05-16 17:38:52 +02:00
|
|
|
printf("%s (ret = %d)\n",LANGUAGE.Error, ret);
|
2009-05-03 22:30:17 +02:00
|
|
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|