2009-10-01 01:10:58 +02:00
# include <gccore.h>
# include <stdio.h>
# include <unistd.h>
# include <stdlib.h>
# include <string.h>
# include <dirent.h>
# include <time.h>
# include <stdlib.h>
2010-12-31 00:49:22 +01:00
# include "Controls/DeviceHandler.hpp"
2009-10-01 01:10:58 +02:00
# include "usbloader/wbfs.h"
# include "usbloader/wdvd.h"
2010-02-22 22:29:47 +01:00
# include "usbloader/usbstorage2.h"
2010-09-18 13:46:25 +02:00
# include "usbloader/GameList.h"
2010-10-27 21:50:48 +02:00
# include "usbloader/utils.h"
2009-10-01 01:10:58 +02:00
# include "language/gettext.h"
2011-06-14 19:53:19 +02:00
# include "GUI/gui.h"
# include "GUI/gui_diskcover.h"
# include "GUI/Text.hpp"
2010-09-25 10:51:44 +02:00
# include "settings/CGameStatistics.h"
2010-10-28 11:00:52 +02:00
# include "settings/GameTitles.h"
2009-10-01 01:10:58 +02:00
# include "network/networkops.h"
2010-12-03 19:38:57 +01:00
# include "network/update.h"
2009-10-01 01:10:58 +02:00
# include "network/http.h"
# include "prompts/PromptWindows.h"
2011-01-23 21:13:41 +01:00
# include "prompts/PromptWindow.hpp"
2009-10-18 23:23:54 +02:00
# include "prompts/gameinfo.h"
2010-09-24 19:58:56 +02:00
# include "themes/CTheme.h"
2010-10-31 10:30:53 +01:00
# include "utils/StringTools.h"
2009-10-01 01:10:58 +02:00
# include "mload/mload.h"
2010-09-25 08:54:27 +02:00
# include "FileOperations/fileops.h"
2011-07-23 21:49:51 +02:00
# include "menu/menus.h"
2009-10-01 01:10:58 +02:00
# include "sys.h"
# include "wpad.h"
# include "wad/wad.h"
# include "zlib.h"
# include "svnrev.h"
# include "audio.h"
# include "language/UpdateLanguage.h"
2011-06-04 18:29:08 +02:00
# include "system/IosLoader.h"
2009-10-21 01:00:19 +02:00
# include "gecko.h"
2009-11-10 00:03:13 +01:00
# include "lstub.h"
2009-10-01 01:10:58 +02:00
2009-12-10 21:27:36 +01:00
/****************************************************************************
* OnScreenNumpad
*
* Opens an on - screen numpad window , with the data entered being stored
* into the specified variable .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2010-09-24 02:48:03 +02:00
int OnScreenNumpad ( char * var , u32 maxlen )
2010-09-19 01:16:05 +02:00
{
int save = - 1 ;
2010-09-17 17:15:21 +02:00
2010-09-24 02:48:03 +02:00
GuiNumpad numpad ( var , maxlen ) ;
2010-09-17 17:15:21 +02:00
2010-09-26 10:33:43 +02:00
GuiImageData btnOutline ( Resources : : GetFile ( " button_dialogue_box.png " ) , Resources : : GetFileSize ( " button_dialogue_box.png " ) ) ;
2009-12-10 21:27:36 +01:00
GuiTrigger trigA ;
2010-09-24 02:48:03 +02:00
trigA . SetSimpleTrigger ( - 1 , WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A , PAD_BUTTON_A ) ;
2009-12-10 21:27:36 +01:00
GuiTrigger trigB ;
2010-09-24 02:48:03 +02:00
trigB . SetSimpleTrigger ( - 1 , WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B , PAD_BUTTON_B ) ;
2009-12-10 21:27:36 +01:00
2011-06-14 19:53:19 +02:00
GuiText okBtnTxt ( tr ( " OK " ) , 22 , thColor ( " r=0 g=0 b=0 a=255 - prompt windows button text color " ) ) ;
2010-09-24 02:48:03 +02:00
GuiImage okBtnImg ( & btnOutline ) ;
2010-10-27 16:45:27 +02:00
if ( Settings . wsprompt )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
okBtnTxt . SetWidescreen ( Settings . widescreen ) ;
okBtnImg . SetWidescreen ( Settings . widescreen ) ;
2010-09-19 01:16:05 +02:00
}
2010-11-13 23:34:53 +01:00
GuiButton okBtn ( & okBtnImg , & okBtnImg , 0 , 4 , 5 , - 15 , & trigA , btnSoundOver , btnSoundClick2 , 1 ) ;
2010-09-24 02:48:03 +02:00
okBtn . SetLabel ( & okBtnTxt ) ;
2011-06-14 19:53:19 +02:00
GuiText cancelBtnTxt ( tr ( " Cancel " ) , 22 , thColor ( " r=0 g=0 b=0 a=255 - prompt windows button text color " ) ) ;
2010-09-24 02:48:03 +02:00
GuiImage cancelBtnImg ( & btnOutline ) ;
2010-10-27 16:45:27 +02:00
if ( Settings . wsprompt )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
cancelBtnTxt . SetWidescreen ( Settings . widescreen ) ;
cancelBtnImg . SetWidescreen ( Settings . widescreen ) ;
2009-12-10 21:27:36 +01:00
}
2010-11-13 23:34:53 +01:00
GuiButton cancelBtn ( & cancelBtnImg , & cancelBtnImg , 1 , 4 , - 5 , - 15 , & trigA , btnSoundOver , btnSoundClick2 , 1 ) ;
2010-09-24 02:48:03 +02:00
cancelBtn . SetLabel ( & cancelBtnTxt ) ;
cancelBtn . SetTrigger ( & trigB ) ;
2010-09-17 17:15:21 +02:00
2010-09-24 02:48:03 +02:00
numpad . Append ( & okBtn ) ;
numpad . Append ( & cancelBtn ) ;
2009-12-10 21:27:36 +01:00
HaltGui ( ) ;
2010-09-24 02:48:03 +02:00
mainWindow - > SetState ( STATE_DISABLED ) ;
mainWindow - > Append ( & numpad ) ;
mainWindow - > ChangeFocus ( & numpad ) ;
2009-12-10 21:27:36 +01:00
ResumeGui ( ) ;
2010-09-24 02:48:03 +02:00
while ( save = = - 1 )
2010-09-19 01:16:05 +02:00
{
2009-12-10 21:27:36 +01:00
VIDEO_WaitVSync ( ) ;
2010-09-24 02:48:03 +02:00
if ( okBtn . GetState ( ) = = STATE_CLICKED )
2009-12-10 21:27:36 +01:00
save = 1 ;
2010-09-24 02:48:03 +02:00
else if ( cancelBtn . GetState ( ) = = STATE_CLICKED ) save = 0 ;
2009-12-10 21:27:36 +01:00
}
2010-09-24 02:48:03 +02:00
if ( save = = 1 )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
snprintf ( var , maxlen , " %s " , numpad . kbtextstr ) ;
2009-12-10 21:27:36 +01:00
}
HaltGui ( ) ;
2010-09-24 02:48:03 +02:00
mainWindow - > Remove ( & numpad ) ;
2011-06-18 09:00:42 +02:00
mainWindow - > SetState ( STATE_DEFAULT ) ;
2009-12-10 21:27:36 +01:00
ResumeGui ( ) ;
2010-09-24 02:48:03 +02:00
gprintf ( " \t %s " , ( save = = 1 ? " saved " : " discarded " ) ) ;
2010-09-17 17:15:21 +02:00
return save ;
2009-12-10 21:27:36 +01:00
}
2009-10-01 01:10:58 +02:00
/****************************************************************************
* OnScreenKeyboard
*
* Opens an on - screen keyboard window , with the data entered being stored
* into the specified variable .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2010-09-24 02:48:03 +02:00
int OnScreenKeyboard ( char * var , u32 maxlen , int min )
2010-09-19 01:16:05 +02:00
{
2009-11-08 21:13:57 +01:00
2009-10-01 01:10:58 +02:00
int save = - 1 ;
2009-11-08 21:13:57 +01:00
2010-10-27 16:45:27 +02:00
gprintf ( " \n OnScreenKeyboard(%s, %i, %i) \n \t keyset = %i " , var , maxlen , min , Settings . keyset ) ;
2009-10-01 01:10:58 +02:00
2010-10-27 16:45:27 +02:00
GuiKeyboard keyboard ( var , maxlen , min , Settings . keyset ) ;
2009-10-01 01:10:58 +02:00
2010-09-26 10:33:43 +02:00
GuiImageData btnOutline ( Resources : : GetFile ( " button_dialogue_box.png " ) , Resources : : GetFileSize ( " button_dialogue_box.png " ) ) ;
2009-10-01 01:10:58 +02:00
GuiTrigger trigA ;
2010-09-24 02:48:03 +02:00
trigA . SetSimpleTrigger ( - 1 , WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A , PAD_BUTTON_A ) ;
2009-10-01 01:10:58 +02:00
GuiTrigger trigB ;
2010-09-24 02:48:03 +02:00
trigB . SetSimpleTrigger ( - 1 , WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B , PAD_BUTTON_B ) ;
2009-10-01 01:10:58 +02:00
2011-06-14 19:53:19 +02:00
GuiText okBtnTxt ( tr ( " OK " ) , 22 , thColor ( " r=0 g=0 b=0 a=255 - prompt windows button text color " ) ) ;
2010-09-24 02:48:03 +02:00
GuiImage okBtnImg ( & btnOutline ) ;
2010-10-27 16:45:27 +02:00
if ( Settings . wsprompt )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
okBtnTxt . SetWidescreen ( Settings . widescreen ) ;
okBtnImg . SetWidescreen ( Settings . widescreen ) ;
2010-09-19 01:16:05 +02:00
}
2010-11-13 23:34:53 +01:00
GuiButton okBtn ( & okBtnImg , & okBtnImg , 0 , 4 , 5 , 15 , & trigA , btnSoundOver , btnSoundClick2 , 1 ) ;
2010-09-24 02:48:03 +02:00
okBtn . SetLabel ( & okBtnTxt ) ;
2011-06-14 19:53:19 +02:00
GuiText cancelBtnTxt ( tr ( " Cancel " ) , 22 , thColor ( " r=0 g=0 b=0 a=255 - prompt windows button text color " ) ) ;
2010-09-24 02:48:03 +02:00
GuiImage cancelBtnImg ( & btnOutline ) ;
2010-10-27 16:45:27 +02:00
if ( Settings . wsprompt )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
cancelBtnTxt . SetWidescreen ( Settings . widescreen ) ;
cancelBtnImg . SetWidescreen ( Settings . widescreen ) ;
2009-10-01 01:10:58 +02:00
}
2010-11-13 23:34:53 +01:00
GuiButton cancelBtn ( & cancelBtnImg , & cancelBtnImg , 1 , 4 , - 5 , 15 , & trigA , btnSoundOver , btnSoundClick2 , 1 ) ;
2010-09-24 02:48:03 +02:00
cancelBtn . SetLabel ( & cancelBtnTxt ) ;
cancelBtn . SetTrigger ( & trigB ) ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
keyboard . Append ( & okBtn ) ;
keyboard . Append ( & cancelBtn ) ;
2009-10-01 01:10:58 +02:00
HaltGui ( ) ;
2010-09-24 02:48:03 +02:00
mainWindow - > SetState ( STATE_DISABLED ) ;
mainWindow - > Append ( & keyboard ) ;
mainWindow - > ChangeFocus ( & keyboard ) ;
2009-10-01 01:10:58 +02:00
ResumeGui ( ) ;
2010-09-24 02:48:03 +02:00
while ( save = = - 1 )
2010-09-19 01:16:05 +02:00
{
2009-10-01 01:10:58 +02:00
VIDEO_WaitVSync ( ) ;
2010-09-24 02:48:03 +02:00
if ( okBtn . GetState ( ) = = STATE_CLICKED )
2009-10-01 01:10:58 +02:00
save = 1 ;
2010-09-24 02:48:03 +02:00
else if ( cancelBtn . GetState ( ) = = STATE_CLICKED ) save = 0 ;
2009-10-01 01:10:58 +02:00
}
2010-09-24 02:48:03 +02:00
if ( save )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
snprintf ( var , maxlen , " %s " , keyboard . kbtextstr ) ;
2009-10-01 01:10:58 +02:00
}
HaltGui ( ) ;
2010-09-24 02:48:03 +02:00
mainWindow - > Remove ( & keyboard ) ;
2011-06-18 09:00:42 +02:00
mainWindow - > SetState ( STATE_DEFAULT ) ;
2009-10-01 01:10:58 +02:00
ResumeGui ( ) ;
2010-09-24 02:48:03 +02:00
gprintf ( " \t %s " , ( save ? " saved " : " discarded " ) ) ;
2009-10-01 01:10:58 +02:00
return save ;
}
/****************************************************************************
* WindowCredits
* Display credits
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2010-09-19 01:16:05 +02:00
void WindowCredits ( )
{
2010-09-24 02:48:03 +02:00
gprintf ( " WindowCredits() \n " ) ;
2009-11-08 21:13:57 +01:00
2009-10-01 01:10:58 +02:00
int angle = 0 ;
GuiSound * creditsMusic = NULL ;
2009-11-10 00:03:13 +01:00
bgMusic - > Pause ( ) ;
2009-10-01 01:10:58 +02:00
2011-01-08 13:35:41 +01:00
creditsMusic = new GuiSound ( Resources : : GetFile ( " credits_music.ogg " ) , Resources : : GetFileSize ( " credits_music.ogg " ) , 55 ) ;
2010-09-24 02:48:03 +02:00
creditsMusic - > SetVolume ( 60 ) ;
creditsMusic - > SetLoop ( 1 ) ;
2009-10-01 01:10:58 +02:00
creditsMusic - > Play ( ) ;
bool exit = false ;
int i = 0 ;
int y = 20 ;
2010-09-24 02:48:03 +02:00
GuiWindow creditsWindow ( screenwidth , screenheight ) ;
GuiWindow creditsWindowBox ( 580 , 448 ) ;
creditsWindowBox . SetAlignment ( ALIGN_CENTRE , ALIGN_MIDDLE ) ;
2009-10-01 01:10:58 +02:00
2011-01-08 13:35:41 +01:00
GuiImageData creditsBox ( Resources : : GetFile ( " credits_bg.png " ) , Resources : : GetFileSize ( " credits_bg.png " ) ) ;
2010-09-24 02:48:03 +02:00
GuiImage creditsBoxImg ( & creditsBox ) ;
creditsBoxImg . SetAlignment ( ALIGN_CENTRE , ALIGN_MIDDLE ) ;
creditsWindowBox . Append ( & creditsBoxImg ) ;
2009-10-01 01:10:58 +02:00
2011-01-08 13:35:41 +01:00
GuiImageData star ( Resources : : GetFile ( " little_star.png " ) , Resources : : GetFileSize ( " little_star.png " ) ) ;
2010-09-24 02:48:03 +02:00
GuiImage starImg ( & star ) ;
starImg . SetWidescreen ( Settings . widescreen ) ; //added
starImg . SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
starImg . SetPosition ( 505 , 350 ) ;
2009-10-01 01:10:58 +02:00
2011-06-04 18:29:08 +02:00
const int numEntries = 25 ;
std : : vector < GuiText * > txt ( numEntries ) ;
2009-10-01 01:10:58 +02:00
2011-06-04 18:29:08 +02:00
txt [ i ] = new GuiText ( tr ( " Credits " ) , 28 , ( GXColor ) { 255 , 255 , 255 , 255 } ) ;
2010-09-24 02:48:03 +02:00
txt [ i ] - > SetAlignment ( ALIGN_CENTRE , ALIGN_TOP ) ;
txt [ i ] - > SetPosition ( 0 , 12 ) ;
2009-10-01 01:10:58 +02:00
i + + ;
2011-06-04 18:29:08 +02:00
char SvnRev [ 80 ] ;
2011-02-25 19:18:57 +01:00
# ifdef FULLCHANNEL
2011-07-23 21:49:51 +02:00
snprintf ( SvnRev , sizeof ( SvnRev ) , " Rev%sc IOS%u (Rev %u) " , GetRev ( ) , IOS_GetVersion ( ) , IOS_GetRevision ( ) ) ;
2009-11-18 10:01:14 +01:00
# else
2011-07-23 21:49:51 +02:00
snprintf ( SvnRev , sizeof ( SvnRev ) , " Rev%s IOS%u (Rev %u) " , GetRev ( ) , IOS_GetVersion ( ) , IOS_GetRevision ( ) ) ;
2009-10-01 01:10:58 +02:00
# endif
2011-06-04 18:29:08 +02:00
char IosInfo [ 80 ] = " " ;
iosinfo_t * info = IosLoader : : GetIOSInfo ( IOS_GetVersion ( ) ) ;
if ( info )
snprintf ( IosInfo , sizeof ( IosInfo ) , " (%s v%i%s base%i) " , info - > name , info - > version , info - > versionstring , info - > baseios ) ;
2011-01-02 10:23:44 +01:00
txt [ i ] = new GuiText ( SvnRev , 16 , ( GXColor ) { 255 , 255 , 255 , 255 } ) ;
2010-09-24 02:48:03 +02:00
txt [ i ] - > SetAlignment ( ALIGN_RIGHT , ALIGN_TOP ) ;
2011-06-04 18:29:08 +02:00
txt [ i ] - > SetPosition ( 0 , info ? y - 10 : y ) ;
i + + ;
txt [ i ] = new GuiText ( IosInfo , 16 , ( GXColor ) { 255 , 255 , 255 , 255 } ) ;
txt [ i ] - > SetAlignment ( ALIGN_RIGHT , ALIGN_TOP ) ;
txt [ i ] - > SetPosition ( 0 , y + 6 ) ;
2009-10-01 01:10:58 +02:00
i + + ;
2010-09-19 01:16:05 +02:00
y + = 34 ;
2009-10-01 01:10:58 +02:00
2011-01-02 10:23:44 +01:00
txt [ i ] = new GuiText ( " USB Loader GX " , 24 , ( GXColor ) { 255 , 255 , 255 , 255 } ) ;
2010-09-24 02:48:03 +02:00
txt [ i ] - > SetAlignment ( ALIGN_CENTRE , ALIGN_TOP ) ;
txt [ i ] - > SetPosition ( 0 , y ) ;
2009-10-01 01:10:58 +02:00
i + + ;
2010-12-31 17:18:48 +01:00
y + = 24 ;
2009-10-01 01:10:58 +02:00
2011-01-02 10:23:44 +01:00
txt [ i ] = new GuiText ( tr ( " Official Site: " ) , 20 , ( GXColor ) { 255 , 255 , 255 , 255 } ) ;
2010-09-24 02:48:03 +02:00
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
txt [ i ] - > SetPosition ( 10 , y ) ;
2009-10-01 01:10:58 +02:00
i + + ;
2009-12-04 16:05:20 +01:00
2011-01-02 10:23:44 +01:00
txt [ i ] = new GuiText ( " http://code.google.com/p/usbloader-gui/ " , 20 , ( GXColor ) { 255 , 255 , 255 , 255 } ) ;
2010-09-24 02:48:03 +02:00
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
txt [ i ] - > SetPosition ( 160 , y ) ;
2009-12-04 16:05:20 +01:00
i + + ;
2010-12-31 17:18:48 +01:00
y + = 22 ;
2009-10-01 01:10:58 +02:00
2010-12-31 17:18:48 +01:00
GuiText : : SetPresets ( 20 , ( GXColor ) { 255 , 255 , 255 , 255 } , 3000 , FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP , ALIGN_LEFT , ALIGN_TOP ) ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
txt [ i ] = new GuiText ( tr ( " Coding: " ) ) ;
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
txt [ i ] - > SetPosition ( 10 , y ) ;
2009-10-01 01:10:58 +02:00
i + + ;
2010-12-31 17:18:48 +01:00
txt [ i ] = new GuiText ( " Dimok / nIxx / giantpune / ardi " ) ;
2010-09-24 02:48:03 +02:00
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
txt [ i ] - > SetPosition ( 160 , y ) ;
2009-10-01 01:10:58 +02:00
i + + ;
2010-12-31 17:18:48 +01:00
y + = 20 ;
2009-10-13 12:47:56 +02:00
2010-09-24 02:48:03 +02:00
txt [ i ] = new GuiText ( " hungyip84 / DrayX7 / lustar / r-win " ) ;
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
txt [ i ] - > SetPosition ( 160 , y ) ;
2009-10-13 12:47:56 +02:00
i + + ;
2010-12-31 17:18:48 +01:00
y + = 22 ;
2009-10-01 01:10:58 +02:00
char text [ 100 ] ;
2010-09-24 02:48:03 +02:00
txt [ i ] = new GuiText ( tr ( " Design: " ) ) ;
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
txt [ i ] - > SetPosition ( 10 , y ) ;
2009-10-01 01:10:58 +02:00
i + + ;
2010-09-24 02:48:03 +02:00
txt [ i ] = new GuiText ( " cyrex / NeoRame " ) ;
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
txt [ i ] - > SetPosition ( 160 , y ) ;
2009-10-01 01:10:58 +02:00
i + + ;
2010-12-31 17:18:48 +01:00
y + = 22 ;
txt [ i ] = new GuiText ( tr ( " Issue manager / " ) ) ;
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
txt [ i ] - > SetPosition ( 10 , y ) ;
i + + ;
y + = 20 ;
txt [ i ] = new GuiText ( tr ( " Main tester: " ) ) ;
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
txt [ i ] - > SetPosition ( 10 , y ) ;
i + + ;
txt [ i ] = new GuiText ( " Cyan " ) ;
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
txt [ i ] - > SetPosition ( 160 , y ) ;
i + + ;
y + = 22 ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
txt [ i ] = new GuiText ( tr ( " Big thanks to: " ) ) ;
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
txt [ i ] - > SetPosition ( 10 , y ) ;
2009-10-01 01:10:58 +02:00
i + + ;
2010-09-24 02:48:03 +02:00
sprintf ( text , " lustar %s " , tr ( " for WiiTDB and hosting covers / disc images " ) ) ;
txt [ i ] = new GuiText ( text ) ;
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
txt [ i ] - > SetPosition ( 160 , y ) ;
2009-10-01 01:10:58 +02:00
i + + ;
2010-12-31 17:18:48 +01:00
y + = 20 ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
sprintf ( text , " CorneliousJD %s " , tr ( " for hosting the update files " ) ) ;
txt [ i ] = new GuiText ( text ) ;
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
txt [ i ] - > SetPosition ( 160 , y ) ;
2009-10-15 07:52:33 +02:00
i + + ;
2010-12-31 17:18:48 +01:00
y + = 20 ;
2009-10-15 07:52:33 +02:00
2010-12-31 17:18:48 +01:00
sprintf ( text , " Kinyo %s " , tr ( " and translators for language files updates " ) ) ;
2010-09-24 02:48:03 +02:00
txt [ i ] = new GuiText ( text ) ;
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
txt [ i ] - > SetPosition ( 160 , y ) ;
2009-10-01 01:10:58 +02:00
i + + ;
2010-12-31 17:18:48 +01:00
y + = 20 ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
sprintf ( text , " Deak Phreak %s " , tr ( " for hosting the themes " ) ) ;
txt [ i ] = new GuiText ( text ) ;
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
txt [ i ] - > SetPosition ( 160 , y ) ;
2009-10-22 16:45:07 +02:00
i + + ;
2010-12-31 17:18:48 +01:00
y + = 22 ;
2009-10-22 16:45:07 +02:00
2010-09-24 02:48:03 +02:00
txt [ i ] = new GuiText ( tr ( " Special thanks to: " ) ) ;
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
txt [ i ] - > SetPosition ( 10 , y ) ;
2009-10-01 01:10:58 +02:00
i + + ;
2010-12-31 17:18:48 +01:00
y + = 20 ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
sprintf ( text , " Waninkoko, Kwiirk & Hermes %s " , tr ( " for the USB Loader source " ) ) ;
txt [ i ] = new GuiText ( text ) ;
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
2011-02-25 19:18:57 +01:00
txt [ i ] - > SetPosition ( 10 , y ) ;
2009-10-01 01:10:58 +02:00
i + + ;
2010-12-31 17:18:48 +01:00
y + = 20 ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
sprintf ( text , " Tantric %s " , tr ( " for his awesome tool LibWiiGui " ) ) ;
txt [ i ] = new GuiText ( text ) ;
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
2011-02-25 19:18:57 +01:00
txt [ i ] - > SetPosition ( 10 , y ) ;
2009-10-01 01:10:58 +02:00
i + + ;
2010-12-31 17:18:48 +01:00
y + = 20 ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
sprintf ( text , " Fishears/Nuke %s " , tr ( " for Ocarina " ) ) ;
txt [ i ] = new GuiText ( text ) ;
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
2011-02-25 19:18:57 +01:00
txt [ i ] - > SetPosition ( 10 , y ) ;
2009-10-01 01:10:58 +02:00
i + + ;
2010-12-31 17:18:48 +01:00
y + = 20 ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
sprintf ( text , " WiiPower %s " , tr ( " for diverse patches " ) ) ;
txt [ i ] = new GuiText ( text ) ;
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
2011-02-25 19:18:57 +01:00
txt [ i ] - > SetPosition ( 10 , y ) ;
2009-10-01 01:10:58 +02:00
i + + ;
2010-12-31 17:18:48 +01:00
y + = 20 ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
sprintf ( text , " Oggzee %s " , tr ( " for FAT/NTFS support " ) ) ;
txt [ i ] = new GuiText ( text ) ;
txt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
2011-02-25 19:18:57 +01:00
txt [ i ] - > SetPosition ( 10 , y ) ;
2009-12-04 16:05:20 +01:00
i + + ;
2010-12-31 17:18:48 +01:00
y + = 20 ;
2009-12-04 16:05:20 +01:00
2010-09-24 02:48:03 +02:00
for ( i = 0 ; i < numEntries ; i + + )
creditsWindowBox . Append ( txt [ i ] ) ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
creditsWindow . Append ( & creditsWindowBox ) ;
creditsWindow . Append ( & starImg ) ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
creditsWindow . SetEffect ( EFFECT_FADE , 30 ) ;
2009-10-01 01:10:58 +02:00
HaltGui ( ) ;
2010-09-24 02:48:03 +02:00
mainWindow - > SetState ( STATE_DISABLED ) ;
mainWindow - > Append ( & creditsWindow ) ;
2009-10-01 01:10:58 +02:00
ResumeGui ( ) ;
2010-09-24 02:48:03 +02:00
while ( ! exit )
2010-09-19 01:16:05 +02:00
{
2011-01-02 10:23:44 +01:00
usleep ( 12000 ) ;
if ( shutdown )
Sys_Shutdown ( ) ;
if ( reset )
Sys_Reboot ( ) ;
2009-10-01 01:10:58 +02:00
angle + + ;
2010-09-24 02:48:03 +02:00
if ( angle > 360 ) angle = 0 ;
starImg . SetAngle ( angle ) ;
2009-10-01 01:10:58 +02:00
2011-01-02 10:23:44 +01:00
if ( ButtonsPressed ( ) ! = 0 )
exit = true ;
2009-10-01 01:10:58 +02:00
}
creditsMusic - > Stop ( ) ;
delete creditsMusic ;
2010-09-24 02:48:03 +02:00
creditsWindow . SetEffect ( EFFECT_FADE , - 30 ) ;
while ( creditsWindow . GetEffect ( ) > 0 )
2010-11-14 16:19:42 +01:00
usleep ( 100 ) ;
2009-10-01 01:10:58 +02:00
HaltGui ( ) ;
2010-09-24 02:48:03 +02:00
mainWindow - > Remove ( & creditsWindow ) ;
mainWindow - > SetState ( STATE_DEFAULT ) ;
for ( i = 0 ; i < numEntries ; i + + )
2010-09-19 01:16:05 +02:00
{
2009-10-01 01:10:58 +02:00
delete txt [ i ] ;
txt [ i ] = NULL ;
}
ResumeGui ( ) ;
2009-11-10 00:03:13 +01:00
bgMusic - > Resume ( ) ;
2009-10-01 01:10:58 +02:00
}
/****************************************************************************
* WindowScreensaver
* Display screensaver
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2010-09-19 01:16:05 +02:00
int WindowScreensaver ( )
{
2011-01-02 10:31:32 +01:00
//! 2 Seconds delay in case the wiimote shutdown was pressed
2011-01-02 10:23:44 +01:00
time_t start = time ( 0 ) ;
2011-01-02 10:31:32 +01:00
while ( time ( 0 ) - start < 2 )
2011-01-02 10:23:44 +01:00
{
usleep ( 100 ) ;
if ( shutdown )
return 0 ;
}
2010-09-24 02:48:03 +02:00
gprintf ( " WindowScreenSaver() \n " ) ;
2010-09-19 01:16:05 +02:00
bool exit = false ;
/* initialize random seed: */
2010-09-24 02:48:03 +02:00
srand ( time ( NULL ) ) ;
2010-09-19 01:16:05 +02:00
2010-09-26 10:33:43 +02:00
GuiImageData GXlogo ( Resources : : GetFile ( " gxlogo.png " ) , Resources : : GetFileSize ( " gxlogo.png " ) ) ; //uncomment for themable screensaver
2010-09-19 01:16:05 +02:00
//GuiImageData GXlogo(gxlogo_png);//comment for themable screensaver
2010-09-24 02:48:03 +02:00
GuiImage GXlogoImg ( & GXlogo ) ;
GXlogoImg . SetPosition ( 172 , 152 ) ;
GXlogoImg . SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
2010-09-19 01:16:05 +02:00
2010-12-20 20:37:38 +01:00
GuiImage BackgroundImg ( 640 , 480 , ( GXColor ) { 0 , 0 , 0 , 255 } ) ;
2010-09-24 02:48:03 +02:00
BackgroundImg . SetPosition ( 0 , 0 ) ;
BackgroundImg . SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
2010-09-19 01:16:05 +02:00
2010-09-24 02:48:03 +02:00
GuiWindow screensaverWindow ( screenwidth , screenheight ) ;
screensaverWindow . Append ( & BackgroundImg ) ;
screensaverWindow . Append ( & GXlogoImg ) ;
2010-09-19 01:16:05 +02:00
HaltGui ( ) ;
2010-09-24 02:48:03 +02:00
mainWindow - > SetState ( STATE_DISABLED ) ;
mainWindow - > Append ( & screensaverWindow ) ;
2010-09-19 01:16:05 +02:00
ResumeGui ( ) ;
2010-09-24 02:48:03 +02:00
while ( ! exit )
2010-09-19 01:16:05 +02:00
{
2011-01-02 10:23:44 +01:00
if ( shutdown )
Sys_Shutdown ( ) ;
if ( reset )
Sys_Reboot ( ) ;
2010-09-24 02:48:03 +02:00
if ( IsWpadConnected ( ) )
2010-09-19 01:16:05 +02:00
{
2009-10-01 01:10:58 +02:00
exit = true ;
2010-12-12 17:31:13 +01:00
break ;
2009-10-01 01:10:58 +02:00
}
/* Set random position */
2010-12-12 17:31:13 +01:00
GXlogoImg . SetPosition ( ( rand ( ) % 345 ) , ( rand ( ) % 305 ) ) ;
2009-10-01 01:10:58 +02:00
2010-12-12 17:31:13 +01:00
sleep ( 4 ) ;
2009-10-01 01:10:58 +02:00
}
HaltGui ( ) ;
2010-09-24 02:48:03 +02:00
mainWindow - > Remove ( & screensaverWindow ) ;
mainWindow - > SetState ( STATE_DEFAULT ) ;
2009-10-01 01:10:58 +02:00
ResumeGui ( ) ;
return 1 ;
}
/****************************************************************************
* WindowPrompt
*
* 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 Title , 1 Subtitle and 4 Buttons
* If title / subtitle or one of the buttons is not needed give him a 0 on that
* place .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2010-09-24 02:48:03 +02:00
int WindowPrompt ( const char * title , const char * msg , const char * btn1Label , const char * btn2Label ,
const char * btn3Label , const char * btn4Label , int wait )
2010-09-19 01:16:05 +02:00
{
2009-10-01 01:10:58 +02:00
int choice = - 1 ;
int count = wait ;
2011-01-23 21:13:41 +01:00
gprintf ( " WindowPrompt( %s, %s, %s, %s, %s, %s, %i ): " , title , msg , btn1Label , btn2Label , btn3Label , btn4Label , wait ) ;
PromptWindow * Window = new PromptWindow ;
Window - > SetTitle ( title ) ;
Window - > SetMessageText ( msg ) ;
if ( btn1Label )
Window - > AddButton ( btn1Label ) ;
if ( btn2Label )
Window - > AddButton ( btn2Label ) ;
if ( btn3Label )
Window - > AddButton ( btn3Label ) ;
if ( btn4Label )
Window - > AddButton ( btn4Label ) ;
2009-11-08 21:13:57 +01:00
2010-09-24 02:48:03 +02:00
mainWindow - > SetState ( STATE_DISABLED ) ;
2011-01-23 21:13:41 +01:00
mainWindow - > Append ( Window ) ;
mainWindow - > ChangeFocus ( Window ) ;
2011-02-11 18:41:52 +01:00
ResumeGui ( ) ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
while ( choice = = - 1 )
2010-09-19 01:16:05 +02:00
{
2009-10-01 01:10:58 +02:00
VIDEO_WaitVSync ( ) ;
2011-01-23 21:13:41 +01:00
if ( shutdown )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
wiilight ( 0 ) ;
2010-01-19 11:48:50 +01:00
Sys_Shutdown ( ) ;
}
2011-01-23 21:13:41 +01:00
if ( reset )
Sys_Reboot ( ) ;
choice = Window - > GetChoice ( ) ;
2010-09-24 02:48:03 +02:00
if ( count > 0 ) count - - ;
if ( count = = 0 ) choice = 1 ;
2010-09-19 01:16:05 +02:00
}
2011-01-23 21:13:41 +01:00
delete Window ;
2011-06-18 09:00:42 +02:00
mainWindow - > SetState ( STATE_DEFAULT ) ;
2010-09-24 02:48:03 +02:00
gprintf ( " %i \n " , choice ) ;
2009-11-08 21:13:57 +01:00
2009-10-01 01:10:58 +02:00
return choice ;
}
/****************************************************************************
* 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 .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2010-02-09 11:59:55 +01:00
int WindowExitPrompt ( )
{
2010-09-24 02:48:03 +02:00
gprintf ( " WindowExitPrompt() \n " ) ;
2009-11-08 21:13:57 +01:00
2010-12-29 16:42:26 +01:00
bgMusic - > Pause ( ) ;
2009-10-01 01:10:58 +02:00
GuiSound * homein = NULL ;
2011-01-08 13:35:41 +01:00
homein = new GuiSound ( Resources : : GetFile ( " menuin.ogg " ) , Resources : : GetFileSize ( " menuin.ogg " ) , Settings . sfxvolume ) ;
2010-09-24 02:48:03 +02:00
homein - > SetVolume ( Settings . sfxvolume ) ;
homein - > SetLoop ( 0 ) ;
2009-10-01 01:10:58 +02:00
homein - > Play ( ) ;
GuiSound * homeout = NULL ;
2011-01-08 13:35:41 +01:00
homeout = new GuiSound ( Resources : : GetFile ( " menuout.ogg " ) , Resources : : GetFileSize ( " menuout.ogg " ) , Settings . sfxvolume ) ;
2010-09-24 02:48:03 +02:00
homeout - > SetVolume ( Settings . sfxvolume ) ;
homeout - > SetLoop ( 0 ) ;
2009-10-01 01:10:58 +02:00
int choice = - 1 ;
2009-11-08 21:13:57 +01:00
2010-09-19 01:16:05 +02:00
u64 oldstub = getStubDest ( ) ;
loadStub ( ) ;
2010-09-24 02:48:03 +02:00
if ( oldstub ! = 0x00010001554c4e52ll & & oldstub ! = 0x00010001554e454fll ) Set_Stub ( oldstub ) ;
2010-09-19 01:16:05 +02:00
2010-09-24 02:48:03 +02:00
GuiWindow promptWindow ( 640 , 480 ) ;
promptWindow . SetAlignment ( ALIGN_LEFT , ALIGN_TOP ) ;
promptWindow . SetPosition ( 0 , 0 ) ;
2011-01-08 13:35:41 +01:00
GuiImageData top ( Resources : : GetFile ( " exit_top.png " ) , Resources : : GetFileSize ( " exit_top.png " ) ) ;
GuiImageData topOver ( Resources : : GetFile ( " exit_top_over.png " ) , Resources : : GetFileSize ( " exit_top_over.png " ) ) ;
GuiImageData bottom ( Resources : : GetFile ( " exit_bottom.png " ) , Resources : : GetFileSize ( " exit_bottom.png " ) ) ;
GuiImageData bottomOver ( Resources : : GetFile ( " exit_bottom_over.png " ) , Resources : : GetFileSize ( " exit_bottom_over.png " ) ) ;
GuiImageData button ( Resources : : GetFile ( " exit_button.png " ) , Resources : : GetFileSize ( " exit_button.png " ) ) ;
GuiImageData wiimote ( Resources : : GetFile ( " wiimote.png " ) , Resources : : GetFileSize ( " wiimote.png " ) ) ;
GuiImageData close ( Resources : : GetFile ( " closebutton.png " ) , Resources : : GetFileSize ( " closebutton.png " ) ) ;
2010-09-26 10:33:43 +02:00
GuiImageData battery ( Resources : : GetFile ( " battery_white.png " ) , Resources : : GetFileSize ( " battery_white.png " ) ) ;
GuiImageData batteryBar ( Resources : : GetFile ( " battery_bar_white.png " ) , Resources : : GetFileSize ( " battery_bar_white.png " ) ) ;
GuiImageData batteryRed ( Resources : : GetFile ( " battery_red.png " ) , Resources : : GetFileSize ( " battery_red.png " ) ) ;
GuiImageData batteryBarRed ( Resources : : GetFile ( " battery_bar_red.png " ) , Resources : : GetFileSize ( " battery_bar_red.png " ) ) ;
2009-10-01 01:10:58 +02:00
int i = 0 , ret = 0 , level ;
char txt [ 3 ] ;
GuiText * batteryTxt [ 4 ] ;
GuiImage * batteryImg [ 4 ] ;
GuiImage * batteryBarImg [ 4 ] ;
GuiButton * batteryBtn [ 4 ] ;
2010-09-24 02:48:03 +02:00
for ( i = 0 ; i < 4 ; i + + )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
sprintf ( txt , " P%d " , i + 1 ) ;
2010-09-19 01:16:05 +02:00
2010-12-20 20:37:38 +01:00
batteryTxt [ i ] = new GuiText ( txt , 22 , ( GXColor ) { 255 , 255 , 255 , 255 } ) ;
2010-09-24 02:48:03 +02:00
batteryTxt [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_MIDDLE ) ;
batteryImg [ i ] = new GuiImage ( & battery ) ;
batteryImg [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_MIDDLE ) ;
batteryImg [ i ] - > SetPosition ( 36 , 0 ) ;
2011-06-14 19:53:19 +02:00
batteryImg [ i ] - > SetTileHorizontal ( 0 ) ;
2010-09-24 02:48:03 +02:00
batteryBarImg [ i ] = new GuiImage ( & batteryBar ) ;
batteryBarImg [ i ] - > SetAlignment ( ALIGN_LEFT , ALIGN_MIDDLE ) ;
batteryBarImg [ i ] - > SetPosition ( 33 , 0 ) ;
2010-09-19 01:16:05 +02:00
2010-09-24 02:48:03 +02:00
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 ) ;
2010-09-19 01:16:05 +02:00
}
2010-09-24 02:48:03 +02:00
batteryBtn [ 0 ] - > SetPosition ( 180 , 150 ) ;
batteryBtn [ 1 ] - > SetPosition ( 284 , 150 ) ;
batteryBtn [ 2 ] - > SetPosition ( 388 , 150 ) ;
batteryBtn [ 3 ] - > SetPosition ( 494 , 150 ) ;
2010-09-19 01:16:05 +02:00
GuiTrigger trigA ;
2010-09-24 02:48:03 +02:00
trigA . SetSimpleTrigger ( - 1 , WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A , PAD_BUTTON_A ) ;
2009-10-01 01:10:58 +02:00
GuiTrigger trigB ;
2010-09-24 02:48:03 +02:00
trigB . SetButtonOnlyTrigger ( - 1 , WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B , PAD_BUTTON_B ) ;
2009-10-01 01:10:58 +02:00
GuiTrigger trigHome ;
2010-09-24 02:48:03 +02:00
trigHome . SetButtonOnlyTrigger ( - 1 , WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME , 0 ) ;
2010-12-20 20:37:38 +01:00
GuiText titleTxt ( tr ( " HOME Menu " ) , 36 , ( GXColor ) { 255 , 255 , 255 , 255 } ) ;
2010-09-24 02:48:03 +02:00
titleTxt . SetAlignment ( ALIGN_CENTRE , ALIGN_TOP ) ;
titleTxt . SetPosition ( - 180 , 40 ) ;
titleTxt . SetEffect ( EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN , 50 ) ;
2010-12-20 20:37:38 +01:00
GuiText closeTxt ( tr ( " Close " ) , 28 , ( GXColor ) { 0 , 0 , 0 , 255 } ) ;
2010-09-24 02:48:03 +02:00
closeTxt . SetPosition ( 10 , 3 ) ;
GuiImage closeImg ( & close ) ;
2010-10-27 16:45:27 +02:00
if ( Settings . wsprompt )
2010-09-24 02:48:03 +02:00
{
closeTxt . SetWidescreen ( Settings . widescreen ) ;
closeImg . SetWidescreen ( Settings . widescreen ) ;
}
GuiButton closeBtn ( close . GetWidth ( ) , close . GetHeight ( ) ) ;
closeBtn . SetImage ( & closeImg ) ;
closeBtn . SetAlignment ( ALIGN_CENTRE , ALIGN_TOP ) ;
closeBtn . SetPosition ( 190 , 30 ) ;
closeBtn . SetLabel ( & closeTxt ) ;
closeBtn . SetRumble ( false ) ;
closeBtn . SetEffect ( EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN , 50 ) ;
GuiImage btn1Img ( & top ) ;
GuiImage btn1OverImg ( & topOver ) ;
2010-11-13 23:34:53 +01:00
GuiButton btn1 ( & btn1Img , & btn1OverImg , 0 , 3 , 0 , 0 , & trigA , btnSoundOver , btnSoundClick2 , 0 ) ;
2010-09-24 02:48:03 +02:00
btn1 . SetEffect ( EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN , 50 ) ;
2011-01-30 17:22:16 +01:00
GuiText btn2Txt ( tr ( " Homebrew Channel " ) , 26 , ( GXColor ) { 0 , 0 , 0 , 255 } ) ;
2011-01-22 17:10:36 +01:00
if ( Settings . HomeMenu = = HOME_MENU_SYSTEM )
{
btn2Txt . SetText ( tr ( " Wii Menu " ) ) ;
}
else if ( Settings . HomeMenu = = HOME_MENU_FULL )
{
btn2Txt . SetText ( tr ( " Exit " ) ) ;
}
2010-09-24 02:48:03 +02:00
GuiImage btn2Img ( & button ) ;
2010-10-27 16:45:27 +02:00
if ( Settings . wsprompt )
2010-09-24 02:48:03 +02:00
{
btn2Txt . SetWidescreen ( Settings . widescreen ) ;
btn2Img . SetWidescreen ( Settings . widescreen ) ;
}
2010-11-13 23:34:53 +01:00
GuiButton btn2 ( & btn2Img , & btn2Img , 2 , 5 , - 150 , 0 , & trigA , btnSoundOver , btnSoundClick2 , 1 ) ;
2010-09-24 02:48:03 +02:00
btn2 . SetLabel ( & btn2Txt ) ;
btn2 . SetEffect ( EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN , 50 ) ;
btn2 . SetRumble ( false ) ;
btn2 . SetPosition ( - 150 , 0 ) ;
2011-01-30 17:22:16 +01:00
GuiText btn3Txt ( tr ( " Wii Menu " ) , 26 , ( GXColor ) { 0 , 0 , 0 , 255 } ) ;
2011-01-22 17:10:36 +01:00
if ( Settings . HomeMenu = = HOME_MENU_SYSTEM )
{
btn3Txt . SetText ( tr ( " Reset " ) ) ;
}
else if ( Settings . HomeMenu = = HOME_MENU_FULL )
{
btn3Txt . SetText ( tr ( " Shutdown Wii " ) ) ;
}
2010-09-24 02:48:03 +02:00
GuiImage btn3Img ( & button ) ;
2010-10-27 16:45:27 +02:00
if ( Settings . wsprompt )
2010-09-24 02:48:03 +02:00
{
btn3Txt . SetWidescreen ( Settings . widescreen ) ;
btn3Img . SetWidescreen ( Settings . widescreen ) ;
}
2010-11-13 23:34:53 +01:00
GuiButton btn3 ( & btn3Img , & btn3Img , 2 , 5 , 150 , 0 , & trigA , btnSoundOver , btnSoundClick2 , 1 ) ;
2010-09-24 02:48:03 +02:00
btn3 . SetLabel ( & btn3Txt ) ;
btn3 . SetEffect ( EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN , 50 ) ;
btn3 . SetRumble ( false ) ;
btn3 . SetPosition ( 150 , 0 ) ;
GuiImage btn4Img ( & bottom ) ;
GuiImage btn4OverImg ( & bottomOver ) ;
2010-11-13 23:34:53 +01:00
GuiButton btn4 ( & btn4Img , & btn4OverImg , 0 , 4 , 0 , 0 , & trigA , btnSoundOver , btnSoundClick2 , 0 ) ;
2010-09-24 02:48:03 +02:00
btn4 . SetTrigger ( & trigB ) ;
btn4 . SetTrigger ( & trigHome ) ;
btn4 . SetEffect ( EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN , 50 ) ;
GuiImage wiimoteImg ( & wiimote ) ;
2010-10-27 16:45:27 +02:00
if ( Settings . wsprompt )
2010-09-24 02:48:03 +02:00
{
wiimoteImg . SetWidescreen ( Settings . widescreen ) ;
}
wiimoteImg . SetAlignment ( ALIGN_LEFT , ALIGN_BOTTOM ) ;
wiimoteImg . SetEffect ( EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN , 50 ) ;
wiimoteImg . SetPosition ( 50 , 210 ) ;
promptWindow . Append ( & btn2 ) ;
promptWindow . Append ( & btn3 ) ;
promptWindow . Append ( & btn4 ) ;
promptWindow . Append ( & btn1 ) ;
promptWindow . Append ( & closeBtn ) ;
promptWindow . Append ( & titleTxt ) ;
promptWindow . Append ( & wiimoteImg ) ;
promptWindow . Append ( batteryBtn [ 0 ] ) ;
promptWindow . Append ( batteryBtn [ 1 ] ) ;
promptWindow . Append ( batteryBtn [ 2 ] ) ;
promptWindow . Append ( batteryBtn [ 3 ] ) ;
2009-10-01 01:10:58 +02:00
HaltGui ( ) ;
2010-09-24 02:48:03 +02:00
mainWindow - > SetState ( STATE_DISABLED ) ;
mainWindow - > Append ( & promptWindow ) ;
mainWindow - > ChangeFocus ( & promptWindow ) ;
2009-10-01 01:10:58 +02:00
ResumeGui ( ) ;
2010-09-24 02:48:03 +02:00
while ( choice = = - 1 )
2010-09-19 01:16:05 +02:00
{
2009-10-01 01:10:58 +02:00
VIDEO_WaitVSync ( ) ;
2010-09-24 02:48:03 +02:00
for ( i = 0 ; i < 4 ; i + + )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
if ( WPAD_Probe ( i , NULL ) = = WPAD_ERR_NONE ) // controller connected
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
level = ( userInput [ i ] . wpad . battery_level / 100.0 ) * 4 ;
if ( level > 4 ) level = 4 ;
2010-09-19 01:16:05 +02:00
2010-09-24 02:48:03 +02:00
if ( level < = 1 )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
batteryBarImg [ i ] - > SetImage ( & batteryBarRed ) ;
batteryImg [ i ] - > SetImage ( & batteryRed ) ;
2010-09-19 01:16:05 +02:00
}
else
{
2010-09-24 02:48:03 +02:00
batteryBarImg [ i ] - > SetImage ( & batteryBar ) ;
2010-09-19 01:16:05 +02:00
}
2011-06-14 19:53:19 +02:00
batteryImg [ i ] - > SetTileHorizontal ( level ) ;
2010-09-19 01:16:05 +02:00
2010-09-24 02:48:03 +02:00
batteryBtn [ i ] - > SetAlpha ( 255 ) ;
2010-09-19 01:16:05 +02:00
}
2010-09-24 02:48:03 +02:00
else // controller not connected
2010-09-19 01:16:05 +02:00
{
2011-06-14 19:53:19 +02:00
batteryImg [ i ] - > SetTileHorizontal ( 0 ) ;
2010-09-24 02:48:03 +02:00
batteryImg [ i ] - > SetImage ( & battery ) ;
batteryBtn [ i ] - > SetAlpha ( 70 ) ;
2009-10-01 01:10:58 +02:00
}
}
2010-12-29 16:42:26 +01:00
if ( shutdown )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
wiilight ( 0 ) ;
2010-01-19 11:48:50 +01:00
Sys_Shutdown ( ) ;
}
2010-12-29 16:42:26 +01:00
if ( reset )
Sys_Reboot ( ) ;
2010-09-24 02:48:03 +02:00
if ( btn1 . GetState ( ) = = STATE_CLICKED )
2010-09-19 01:16:05 +02:00
{
2009-10-01 01:10:58 +02:00
choice = 1 ;
2010-09-24 02:48:03 +02:00
btn1 . SetEffect ( EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT , 50 ) ;
closeBtn . SetEffect ( EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT , 50 ) ;
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 ) ;
wiimoteImg . SetEffect ( EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT , 50 ) ;
2010-09-19 01:16:05 +02:00
2010-09-24 02:48:03 +02:00
for ( int i = 0 ; i < 4 ; i + + )
batteryBtn [ i ] - > SetEffect ( EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT , 50 ) ;
2010-09-19 01:16:05 +02:00
}
2010-09-24 02:48:03 +02:00
else if ( btn4 . GetState ( ) = = STATE_SELECTED )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
wiimoteImg . SetPosition ( 50 , 165 ) ;
2010-09-19 01:16:05 +02:00
}
2010-09-24 02:48:03 +02:00
else if ( btn2 . GetState ( ) = = STATE_CLICKED )
2010-09-19 01:16:05 +02:00
{
2011-01-22 17:10:36 +01:00
if ( Settings . HomeMenu = = HOME_MENU_SYSTEM )
2010-12-29 16:42:26 +01:00
Sys_LoadMenu ( ) ;
2011-01-22 17:10:36 +01:00
else if ( Settings . HomeMenu = = HOME_MENU_DEFAULT )
Sys_LoadHBC ( ) ;
else if ( Settings . HomeMenu = = HOME_MENU_FULL )
{
ret = WindowPrompt ( tr ( " Exit to where? " ) , 0 , tr ( " Homebrew Channel " ) , tr ( " Wii Menu " ) , tr ( " Reset " ) , tr ( " Cancel " ) ) ;
if ( ret = = 1 )
Sys_LoadHBC ( ) ;
else if ( ret = = 2 )
Sys_LoadMenu ( ) ;
else if ( ret = = 3 )
RebootApp ( ) ;
}
2009-10-01 01:10:58 +02:00
HaltGui ( ) ;
2010-09-24 02:48:03 +02:00
mainWindow - > SetState ( STATE_DISABLED ) ;
promptWindow . SetState ( STATE_DEFAULT ) ;
mainWindow - > ChangeFocus ( & promptWindow ) ;
2009-10-01 01:10:58 +02:00
ResumeGui ( ) ;
btn2 . ResetState ( ) ;
2010-09-19 01:16:05 +02:00
}
2010-09-24 02:48:03 +02:00
else if ( btn3 . GetState ( ) = = STATE_CLICKED )
2010-09-19 01:16:05 +02:00
{
2011-01-22 17:10:36 +01:00
if ( Settings . HomeMenu = = HOME_MENU_SYSTEM )
RebootApp ( ) ;
else if ( Settings . HomeMenu = = HOME_MENU_DEFAULT )
Sys_LoadMenu ( ) ;
else if ( Settings . HomeMenu = = HOME_MENU_FULL )
{
ret = WindowPrompt ( tr ( " How to Shutdown? " ) , 0 , tr ( " Full shutdown " ) , tr ( " Standby " ) , tr ( " Cancel " ) ) ;
if ( ret = = 1 )
Sys_ShutdownToStandby ( ) ;
else if ( ret = = 2 )
Sys_ShutdownToIdle ( ) ;
}
2009-10-01 01:10:58 +02:00
HaltGui ( ) ;
2010-09-24 02:48:03 +02:00
mainWindow - > SetState ( STATE_DISABLED ) ;
promptWindow . SetState ( STATE_DEFAULT ) ;
mainWindow - > ChangeFocus ( & promptWindow ) ;
2009-10-01 01:10:58 +02:00
ResumeGui ( ) ;
btn3 . ResetState ( ) ;
2010-09-19 01:16:05 +02:00
}
2010-09-24 02:48:03 +02:00
else if ( btn4 . GetState ( ) = = STATE_CLICKED )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
btn1 . SetEffect ( EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT , 50 ) ;
closeBtn . SetEffect ( EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT , 50 ) ;
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 ) ;
wiimoteImg . SetEffect ( EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT , 50 ) ;
2010-09-19 01:16:05 +02:00
2010-09-24 02:48:03 +02:00
for ( int i = 0 ; i < 4 ; i + + )
batteryBtn [ i ] - > SetEffect ( EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT , 50 ) ;
2009-12-03 02:06:09 +01:00
2009-10-01 01:10:58 +02:00
choice = 0 ;
2010-09-19 01:16:05 +02:00
}
2010-09-24 02:48:03 +02:00
else if ( btn4 . GetState ( ) ! = STATE_SELECTED )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
wiimoteImg . SetPosition ( 50 , 210 ) ;
2009-10-01 01:10:58 +02:00
}
}
homeout - > Play ( ) ;
2010-09-24 02:48:03 +02:00
while ( btn1 . GetEffect ( ) > 0 )
2010-11-14 16:19:42 +01:00
usleep ( 100 ) ;
2010-09-24 02:48:03 +02:00
while ( promptWindow . GetEffect ( ) > 0 )
2010-11-14 16:19:42 +01:00
usleep ( 100 ) ;
2009-10-01 01:10:58 +02:00
HaltGui ( ) ;
homein - > Stop ( ) ;
delete homein ;
2010-09-24 02:48:03 +02:00
mainWindow - > Remove ( & promptWindow ) ;
2011-06-18 09:00:42 +02:00
mainWindow - > SetState ( STATE_DEFAULT ) ;
2010-09-24 02:48:03 +02:00
while ( homeout - > IsPlaying ( ) > 0 )
2010-11-14 16:19:42 +01:00
usleep ( 100 ) ;
2009-10-01 01:10:58 +02:00
homeout - > Stop ( ) ;
delete homeout ;
2010-09-28 20:58:56 +02:00
2010-12-20 20:37:38 +01:00
for ( int i = 0 ; i < 4 ; + + i )
2010-09-24 02:48:03 +02:00
{
2010-12-20 20:37:38 +01:00
delete batteryTxt [ i ] ;
delete batteryImg [ i ] ;
delete batteryBarImg [ i ] ;
delete batteryBtn [ i ] ;
2009-10-01 01:10:58 +02:00
}
2010-12-20 20:37:38 +01:00
ResumeGui ( ) ;
2010-12-29 16:42:26 +01:00
bgMusic - > Resume ( ) ;
2009-10-01 01:10:58 +02:00
return choice ;
}
/****************************************************************************
* DiscWait
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2010-09-24 02:48:03 +02:00
int DiscWait ( const char * title , const char * msg , const char * btn1Label , const char * btn2Label , int IsDeviceWait )
2010-09-19 01:16:05 +02:00
{
2010-11-28 16:31:08 +01:00
int ret = 0 ;
2009-10-01 01:10:58 +02:00
u32 cover = 0 ;
2010-09-24 02:48:03 +02:00
GuiWindow promptWindow ( 472 , 320 ) ;
promptWindow . SetAlignment ( ALIGN_CENTRE , ALIGN_MIDDLE ) ;
promptWindow . SetPosition ( 0 , - 10 ) ;
2009-10-01 01:10:58 +02:00
2010-09-26 10:33:43 +02:00
GuiImageData btnOutline ( Resources : : GetFile ( " button_dialogue_box.png " ) , Resources : : GetFileSize ( " button_dialogue_box.png " ) ) ;
GuiImageData dialogBox ( Resources : : GetFile ( " dialogue_box.png " ) , Resources : : GetFileSize ( " dialogue_box.png " ) ) ;
2009-10-01 01:10:58 +02:00
GuiTrigger trigA ;
2010-09-24 02:48:03 +02:00
trigA . SetSimpleTrigger ( - 1 , WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A , PAD_BUTTON_A ) ;
2009-10-01 01:10:58 +02:00
GuiTrigger trigB ;
2010-09-24 02:48:03 +02:00
trigB . SetButtonOnlyTrigger ( - 1 , WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B , PAD_BUTTON_B ) ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
GuiImage dialogBoxImg ( & dialogBox ) ;
2010-10-27 16:45:27 +02:00
if ( Settings . wsprompt )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
dialogBoxImg . SetWidescreen ( Settings . widescreen ) ;
2010-09-19 01:16:05 +02:00
}
2009-10-01 01:10:58 +02:00
2010-12-26 18:02:14 +01:00
GuiText titleTxt ( title , 26 , thColor ( " r=0 g=0 b=0 a=255 - prompt windows text color " ) ) ;
2010-09-24 02:48:03 +02:00
titleTxt . SetAlignment ( ALIGN_CENTRE , ALIGN_TOP ) ;
titleTxt . SetPosition ( 0 , 60 ) ;
2010-12-26 18:02:14 +01:00
GuiText msgTxt ( msg , 22 , thColor ( " r=0 g=0 b=0 a=255 - prompt windows text color " ) ) ;
2010-09-24 02:48:03 +02:00
msgTxt . SetAlignment ( ALIGN_CENTRE , ALIGN_MIDDLE ) ;
msgTxt . SetPosition ( 0 , - 40 ) ;
msgTxt . SetMaxWidth ( 430 ) ;
2009-12-30 10:52:24 +01:00
2011-06-14 19:53:19 +02:00
GuiText btn1Txt ( btn1Label , 22 , thColor ( " r=0 g=0 b=0 a=255 - prompt windows button text color " ) ) ;
2010-09-24 02:48:03 +02:00
GuiImage btn1Img ( & btnOutline ) ;
2010-10-27 16:45:27 +02:00
if ( Settings . wsprompt )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
btn1Txt . SetWidescreen ( Settings . widescreen ) ;
btn1Img . SetWidescreen ( Settings . widescreen ) ;
2009-10-01 01:10:58 +02:00
}
2010-11-13 23:34:53 +01:00
GuiButton btn1 ( & btn1Img , & btn1Img , 1 , 5 , 0 , 0 , & trigA , btnSoundOver , btnSoundClick2 , 1 ) ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
if ( btn2Label )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
btn1 . SetAlignment ( ALIGN_LEFT , ALIGN_BOTTOM ) ;
btn1 . SetPosition ( 40 , - 45 ) ;
2010-09-19 01:16:05 +02:00
}
else
{
2010-09-24 02:48:03 +02:00
btn1 . SetAlignment ( ALIGN_CENTRE , ALIGN_BOTTOM ) ;
btn1 . SetPosition ( 0 , - 45 ) ;
2010-09-19 01:16:05 +02:00
}
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
btn1 . SetLabel ( & btn1Txt ) ;
btn1 . SetTrigger ( & trigB ) ;
btn1 . SetState ( STATE_SELECTED ) ;
2010-09-19 01:16:05 +02:00
2011-06-14 19:53:19 +02:00
GuiText btn2Txt ( btn2Label , 22 , thColor ( " r=0 g=0 b=0 a=255 - prompt windows button text color " ) ) ;
2010-09-24 02:48:03 +02:00
GuiImage btn2Img ( & btnOutline ) ;
2010-10-27 16:45:27 +02:00
if ( Settings . wsprompt )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
btn2Txt . SetWidescreen ( Settings . widescreen ) ;
btn2Img . SetWidescreen ( Settings . widescreen ) ;
2010-09-19 01:16:05 +02:00
}
2010-11-13 23:34:53 +01:00
GuiButton btn2 ( & btn2Img , & btn2Img , 1 , 4 , - 20 , - 25 , & trigA , btnSoundOver , btnSoundClick2 , 1 ) ;
2010-09-24 02:48:03 +02:00
btn2 . SetLabel ( & btn2Txt ) ;
2010-09-19 01:16:05 +02:00
2010-10-28 11:00:52 +02:00
if ( Settings . wsprompt & & Settings . widescreen ) /////////////adjust buttons for widescreen
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
msgTxt . SetMaxWidth ( 380 ) ;
if ( btn2Label )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
btn1 . SetAlignment ( ALIGN_LEFT , ALIGN_BOTTOM ) ;
btn2 . SetPosition ( - 70 , - 80 ) ;
btn1 . SetPosition ( 70 , - 80 ) ;
2010-09-19 01:16:05 +02:00
}
else
{
2010-09-24 02:48:03 +02:00
btn1 . SetAlignment ( ALIGN_CENTRE , ALIGN_BOTTOM ) ;
btn1 . SetPosition ( 0 , - 80 ) ;
2010-09-19 01:16:05 +02:00
}
}
2010-12-26 18:02:14 +01:00
GuiText timerTxt ( ( char * ) NULL , 26 , thColor ( " r=0 g=0 b=0 a=255 - prompt windows text color " ) ) ;
2010-09-24 02:48:03 +02:00
timerTxt . SetAlignment ( ALIGN_CENTRE , ALIGN_TOP ) ;
timerTxt . SetPosition ( 0 , 160 ) ;
2010-09-19 01:16:05 +02:00
2010-09-24 02:48:03 +02:00
promptWindow . Append ( & dialogBoxImg ) ;
promptWindow . Append ( & titleTxt ) ;
promptWindow . Append ( & msgTxt ) ;
2010-09-19 01:16:05 +02:00
2010-09-24 02:48:03 +02:00
if ( btn1Label ) promptWindow . Append ( & btn1 ) ;
if ( btn2Label ) promptWindow . Append ( & btn2 ) ;
if ( IsDeviceWait ) promptWindow . Append ( & timerTxt ) ;
2010-09-19 01:16:05 +02:00
2010-09-24 02:48:03 +02:00
promptWindow . SetEffect ( EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN , 50 ) ;
2010-09-19 01:16:05 +02:00
HaltGui ( ) ;
2010-09-24 02:48:03 +02:00
mainWindow - > SetState ( STATE_DISABLED ) ;
mainWindow - > Append ( & promptWindow ) ;
mainWindow - > ChangeFocus ( & promptWindow ) ;
2010-09-19 01:16:05 +02:00
ResumeGui ( ) ;
2010-09-24 02:48:03 +02:00
if ( IsDeviceWait )
2010-09-19 01:16:05 +02:00
{
2010-11-28 16:31:08 +01:00
time_t starttime = time ( 0 ) ;
time_t timenow = starttime ;
do
2010-09-19 01:16:05 +02:00
{
2010-11-28 16:31:08 +01:00
gprintf ( " %i \n " , ( int ) ( timenow - starttime ) ) ;
2010-09-24 02:48:03 +02:00
ret = WBFS_Init ( WBFS_DEVICE_USB ) ;
if ( ret > = 0 ) break ;
2010-09-19 01:16:05 +02:00
2010-11-28 16:31:08 +01:00
timerTxt . SetTextf ( " %i %s " , ( int ) ( 30 - ( timenow - starttime ) ) , tr ( " seconds left " ) ) ;
2010-12-31 00:49:22 +01:00
DeviceHandler : : Instance ( ) - > UnMountAllUSB ( ) ;
DeviceHandler : : Instance ( ) - > MountAllUSB ( ) ;
2010-11-28 16:31:08 +01:00
timenow = time ( 0 ) ;
2010-09-19 01:16:05 +02:00
}
2010-11-28 16:31:08 +01:00
while ( timenow - starttime < 30 ) ;
2010-09-19 01:16:05 +02:00
}
else
{
2010-09-24 02:48:03 +02:00
while ( ! ( cover & 0x2 ) )
2010-09-19 01:16:05 +02:00
{
VIDEO_WaitVSync ( ) ;
2010-09-24 02:48:03 +02:00
if ( btn1 . GetState ( ) = = STATE_CLICKED )
2010-09-19 01:16:05 +02:00
{
btn1 . ResetState ( ) ;
break ;
}
2010-09-24 02:48:03 +02:00
ret = WDVD_GetCoverStatus ( & cover ) ;
if ( ret < 0 ) break ;
2010-09-19 01:16:05 +02:00
}
}
2010-09-24 02:48:03 +02:00
promptWindow . SetEffect ( EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT , 50 ) ;
while ( promptWindow . GetEffect ( ) > 0 )
2010-11-14 16:19:42 +01:00
usleep ( 100 ) ;
2010-09-19 01:16:05 +02:00
HaltGui ( ) ;
2010-09-24 02:48:03 +02:00
mainWindow - > Remove ( & promptWindow ) ;
mainWindow - > SetState ( STATE_DEFAULT ) ;
2010-09-19 01:16:05 +02:00
ResumeGui ( ) ;
return ret ;
}
/****************************************************************************
* FormatingPartition
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2010-12-31 00:49:22 +01:00
int FormatingPartition ( const char * title , int part_num )
2010-09-19 01:16:05 +02:00
{
2011-06-22 19:57:37 +02:00
PartitionHandle * usbHandle = DeviceHandler : : Instance ( ) - > GetUSBHandleFromPartition ( part_num ) ;
int portPart = DeviceHandler : : PartitionToPortPartition ( part_num ) ;
2010-10-27 21:50:48 +02:00
char text [ 255 ] ;
2011-06-22 19:57:37 +02:00
sprintf ( text , " %s: %.2fGB " , tr ( " Partition " ) , usbHandle - > GetSize ( portPart ) / GB_SIZE ) ;
2010-10-27 21:50:48 +02:00
int choice = WindowPrompt ( tr ( " Do you want to format: " ) , text , tr ( " Yes " ) , tr ( " No " ) ) ;
if ( choice = = 0 )
return - 666 ;
2009-10-01 01:10:58 +02:00
int ret ;
2010-09-24 02:48:03 +02:00
GuiWindow promptWindow ( 472 , 320 ) ;
promptWindow . SetAlignment ( ALIGN_CENTRE , ALIGN_MIDDLE ) ;
promptWindow . SetPosition ( 0 , - 10 ) ;
2009-10-01 01:10:58 +02:00
2010-09-26 10:33:43 +02:00
GuiImageData btnOutline ( Resources : : GetFile ( " button_dialogue_box.png " ) , Resources : : GetFileSize ( " button_dialogue_box.png " ) ) ;
GuiImageData dialogBox ( Resources : : GetFile ( " dialogue_box.png " ) , Resources : : GetFileSize ( " dialogue_box.png " ) ) ;
2009-10-01 01:10:58 +02:00
GuiTrigger trigA ;
2010-09-24 02:48:03 +02:00
trigA . SetSimpleTrigger ( - 1 , WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A , PAD_BUTTON_A ) ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
GuiImage dialogBoxImg ( & dialogBox ) ;
2010-10-27 16:45:27 +02:00
if ( Settings . wsprompt )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
dialogBoxImg . SetWidescreen ( Settings . widescreen ) ;
2009-10-01 01:10:58 +02:00
}
2010-12-26 18:02:14 +01:00
GuiText titleTxt ( title , 26 , thColor ( " r=0 g=0 b=0 a=255 - prompt windows text color " ) ) ;
2010-09-24 02:48:03 +02:00
titleTxt . SetAlignment ( ALIGN_CENTRE , ALIGN_TOP ) ;
titleTxt . SetPosition ( 0 , 60 ) ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
promptWindow . Append ( & dialogBoxImg ) ;
promptWindow . Append ( & titleTxt ) ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
promptWindow . SetEffect ( EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN , 50 ) ;
2009-10-01 01:10:58 +02:00
HaltGui ( ) ;
2010-09-24 02:48:03 +02:00
mainWindow - > SetState ( STATE_DISABLED ) ;
mainWindow - > Append ( & promptWindow ) ;
mainWindow - > ChangeFocus ( & promptWindow ) ;
2009-10-01 01:10:58 +02:00
ResumeGui ( ) ;
VIDEO_WaitVSync ( ) ;
2011-06-22 19:57:37 +02:00
ret = WBFS_Format ( usbHandle - > GetLBAStart ( portPart ) , usbHandle - > GetSecCount ( portPart ) , DeviceHandler : : PartitionToUSBPort ( part_num ) ) ;
2009-10-01 01:10:58 +02:00
2010-10-27 21:50:48 +02:00
if ( ret < 0 )
{
WindowPrompt ( tr ( " Error ! " ) , tr ( " Failed formating " ) , tr ( " Return " ) ) ;
}
else
{
2011-06-22 19:57:37 +02:00
PartitionFS * partition = usbHandle - > GetPartitionRecord ( portPart ) ;
2010-12-31 00:49:22 +01:00
partition - > PartitionType = 0xBF ;
partition - > FSName = " WBFS " ;
2010-10-27 21:50:48 +02:00
sleep ( 1 ) ;
2010-12-31 00:49:22 +01:00
ret = WBFS_OpenPart ( part_num ) ;
2010-10-27 21:50:48 +02:00
sprintf ( text , " %s %s " , text , tr ( " formatted! " ) ) ;
WindowPrompt ( tr ( " Success: " ) , text , tr ( " OK " ) ) ;
if ( ret < 0 )
{
WindowPrompt ( tr ( " ERROR " ) , tr ( " Failed to open partition " ) , tr ( " OK " ) ) ;
Sys_LoadMenu ( ) ;
}
}
2010-09-24 02:48:03 +02:00
promptWindow . SetEffect ( EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT , 50 ) ;
while ( promptWindow . GetEffect ( ) > 0 )
2010-11-14 16:19:42 +01:00
usleep ( 100 ) ;
2009-10-01 01:10:58 +02:00
HaltGui ( ) ;
2010-09-24 02:48:03 +02:00
mainWindow - > Remove ( & promptWindow ) ;
mainWindow - > SetState ( STATE_DEFAULT ) ;
2009-10-01 01:10:58 +02:00
ResumeGui ( ) ;
return ret ;
}
/****************************************************************************
* NetworkInitPrompt
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2010-09-19 01:16:05 +02:00
bool NetworkInitPrompt ( )
{
2009-10-18 23:23:54 +02:00
2010-09-24 02:48:03 +02:00
gprintf ( " \n NetworkinitPrompt() " ) ;
if ( IsNetworkInit ( ) ) return true ;
2009-10-18 23:23:54 +02:00
2009-10-01 01:10:58 +02:00
bool success = true ;
2010-09-24 02:48:03 +02:00
GuiWindow promptWindow ( 472 , 320 ) ;
promptWindow . SetAlignment ( ALIGN_CENTRE , ALIGN_MIDDLE ) ;
promptWindow . SetPosition ( 0 , - 10 ) ;
2009-10-01 01:10:58 +02:00
2010-09-26 10:33:43 +02:00
GuiImageData btnOutline ( Resources : : GetFile ( " button_dialogue_box.png " ) , Resources : : GetFileSize ( " button_dialogue_box.png " ) ) ;
GuiImageData dialogBox ( Resources : : GetFile ( " dialogue_box.png " ) , Resources : : GetFileSize ( " dialogue_box.png " ) ) ;
2009-10-01 01:10:58 +02:00
GuiTrigger trigA ;
2010-09-24 02:48:03 +02:00
trigA . SetSimpleTrigger ( - 1 , WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A , PAD_BUTTON_A ) ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
GuiImage dialogBoxImg ( & dialogBox ) ;
2009-10-01 01:10:58 +02:00
2010-10-27 16:45:27 +02:00
if ( Settings . wsprompt )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
dialogBoxImg . SetWidescreen ( Settings . widescreen ) ;
2009-10-01 01:10:58 +02:00
}
2010-12-26 18:02:14 +01:00
GuiText titleTxt ( tr ( " Initializing Network " ) , 26 , thColor ( " r=0 g=0 b=0 a=255 - prompt windows text color " ) ) ;
2010-09-24 02:48:03 +02:00
titleTxt . SetAlignment ( ALIGN_CENTRE , ALIGN_TOP ) ;
titleTxt . SetPosition ( 0 , 60 ) ;
2009-10-01 01:10:58 +02:00
char msg [ 20 ] = " " ;
2010-12-26 18:02:14 +01:00
GuiText msgTxt ( msg , 22 , thColor ( " r=0 g=0 b=0 a=255 - prompt windows text color " ) ) ;
2010-09-24 02:48:03 +02:00
msgTxt . SetAlignment ( ALIGN_CENTRE , ALIGN_MIDDLE ) ;
msgTxt . SetPosition ( 0 , - 40 ) ;
2009-10-01 01:10:58 +02:00
2011-06-14 19:53:19 +02:00
GuiText btn1Txt ( tr ( " Cancel " ) , 22 , thColor ( " r=0 g=0 b=0 a=255 - prompt windows button text color " ) ) ;
2010-09-24 02:48:03 +02:00
GuiImage btn1Img ( & btnOutline ) ;
2010-10-27 16:45:27 +02:00
if ( Settings . wsprompt )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
btn1Txt . SetWidescreen ( Settings . widescreen ) ;
btn1Img . SetWidescreen ( Settings . widescreen ) ;
2009-10-01 01:10:58 +02:00
}
2010-11-13 23:34:53 +01:00
GuiButton btn1 ( & btn1Img , & btn1Img , 2 , 4 , 0 , - 45 , & trigA , btnSoundOver , btnSoundClick2 , 1 ) ;
2010-09-24 02:48:03 +02:00
btn1 . SetLabel ( & btn1Txt ) ;
btn1 . SetState ( STATE_SELECTED ) ;
2009-10-01 01:10:58 +02:00
2010-10-27 16:45:27 +02:00
if ( ( Settings . wsprompt ) & & ( Settings . widescreen ) ) /////////////adjust buttons for widescreen
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
btn1 . SetAlignment ( ALIGN_CENTRE , ALIGN_BOTTOM ) ;
btn1 . SetPosition ( 0 , - 80 ) ;
2009-10-01 01:10:58 +02:00
}
2010-09-24 02:48:03 +02:00
promptWindow . Append ( & dialogBoxImg ) ;
promptWindow . Append ( & titleTxt ) ;
promptWindow . Append ( & msgTxt ) ;
promptWindow . Append ( & btn1 ) ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
promptWindow . SetEffect ( EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN , 50 ) ;
2009-10-01 01:10:58 +02:00
HaltGui ( ) ;
2010-09-24 02:48:03 +02:00
mainWindow - > SetState ( STATE_DISABLED ) ;
mainWindow - > Append ( & promptWindow ) ;
mainWindow - > ChangeFocus ( & promptWindow ) ;
2009-10-01 01:10:58 +02:00
ResumeGui ( ) ;
2010-09-24 02:48:03 +02:00
while ( ! IsNetworkInit ( ) )
2010-09-19 01:16:05 +02:00
{
2009-10-01 01:10:58 +02:00
VIDEO_WaitVSync ( ) ;
Initialize_Network ( ) ;
2010-09-24 02:48:03 +02:00
if ( ! IsNetworkInit ( ) )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
msgTxt . SetText ( tr ( " Could not initialize network! " ) ) ;
sleep ( 3 ) ;
2009-10-01 01:10:58 +02:00
success = false ;
break ;
}
2010-09-24 02:48:03 +02:00
if ( btn1 . GetState ( ) = = STATE_CLICKED )
2010-09-19 01:16:05 +02:00
{
2009-10-01 01:10:58 +02:00
btn1 . ResetState ( ) ;
success = false ;
break ;
}
}
2010-09-24 02:48:03 +02:00
promptWindow . SetEffect ( EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT , 50 ) ;
while ( promptWindow . GetEffect ( ) > 0 )
2010-11-14 16:19:42 +01:00
usleep ( 100 ) ;
2009-10-01 01:10:58 +02:00
HaltGui ( ) ;
2010-09-24 02:48:03 +02:00
mainWindow - > Remove ( & promptWindow ) ;
mainWindow - > SetState ( STATE_DEFAULT ) ;
2009-10-01 01:10:58 +02:00
ResumeGui ( ) ;
return success ;
}
2010-09-24 02:48:03 +02:00
int CodeDownload ( const char * id )
2010-09-19 01:16:05 +02:00
{
2009-10-01 01:10:58 +02:00
int ret = 0 ;
2010-09-24 02:48:03 +02:00
GuiWindow promptWindow ( 472 , 320 ) ;
promptWindow . SetAlignment ( ALIGN_CENTRE , ALIGN_MIDDLE ) ;
promptWindow . SetPosition ( 0 , - 10 ) ;
2009-10-01 01:10:58 +02:00
2010-09-26 10:33:43 +02:00
GuiImageData btnOutline ( Resources : : GetFile ( " button_dialogue_box.png " ) , Resources : : GetFileSize ( " button_dialogue_box.png " ) ) ;
GuiImageData dialogBox ( Resources : : GetFile ( " dialogue_box.png " ) , Resources : : GetFileSize ( " dialogue_box.png " ) ) ;
2009-10-01 01:10:58 +02:00
GuiTrigger trigA ;
2010-09-24 02:48:03 +02:00
trigA . SetSimpleTrigger ( - 1 , WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A , PAD_BUTTON_A ) ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
GuiImage dialogBoxImg ( & dialogBox ) ;
2010-10-27 16:45:27 +02:00
if ( Settings . wsprompt )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
dialogBoxImg . SetWidescreen ( Settings . widescreen ) ;
2009-10-01 01:10:58 +02:00
}
char title [ 50 ] ;
2010-09-24 02:48:03 +02:00
sprintf ( title , " %s " , tr ( " Code Download " ) ) ;
2010-12-26 18:02:14 +01:00
GuiText titleTxt ( title , 26 , thColor ( " r=0 g=0 b=0 a=255 - prompt windows text color " ) ) ;
2010-09-24 02:48:03 +02:00
titleTxt . SetAlignment ( ALIGN_CENTRE , ALIGN_TOP ) ;
titleTxt . SetPosition ( 0 , 50 ) ;
2009-10-01 01:10:58 +02:00
char msg [ 50 ] ;
2010-09-24 02:48:03 +02:00
sprintf ( msg , " %s " , tr ( " Initializing Network " ) ) ;
2010-12-26 18:02:14 +01:00
GuiText msgTxt ( msg , 26 , thColor ( " r=0 g=0 b=0 a=255 - prompt windows text color " ) ) ;
2010-09-24 02:48:03 +02:00
msgTxt . SetAlignment ( ALIGN_CENTRE , ALIGN_TOP ) ;
msgTxt . SetPosition ( 0 , 140 ) ;
2009-10-01 01:10:58 +02:00
char msg2 [ 50 ] = " " ;
2010-12-26 18:02:14 +01:00
GuiText msg2Txt ( msg2 , 26 , thColor ( " r=0 g=0 b=0 a=255 - prompt windows text color " ) ) ;
2010-09-24 02:48:03 +02:00
msg2Txt . SetAlignment ( ALIGN_CENTRE , ALIGN_MIDDLE ) ;
msg2Txt . SetPosition ( 0 , 50 ) ;
2009-10-01 01:10:58 +02:00
2011-06-14 19:53:19 +02:00
GuiText btn1Txt ( tr ( " Cancel " ) , 22 , thColor ( " r=0 g=0 b=0 a=255 - prompt windows button text color " ) ) ;
2010-09-24 02:48:03 +02:00
GuiImage btn1Img ( & btnOutline ) ;
2010-10-27 16:45:27 +02:00
if ( Settings . wsprompt )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
btn1Txt . SetWidescreen ( Settings . widescreen ) ;
btn1Img . SetWidescreen ( Settings . widescreen ) ;
2009-10-01 01:10:58 +02:00
}
2010-11-13 23:34:53 +01:00
GuiButton btn1 ( & btn1Img , & btn1Img , 2 , 4 , 0 , - 40 , & trigA , btnSoundOver , btnSoundClick2 , 1 ) ;
2010-09-24 02:48:03 +02:00
btn1 . SetLabel ( & btn1Txt ) ;
btn1 . SetState ( STATE_SELECTED ) ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
promptWindow . Append ( & dialogBoxImg ) ;
promptWindow . Append ( & titleTxt ) ;
promptWindow . Append ( & msgTxt ) ;
promptWindow . Append ( & msg2Txt ) ;
promptWindow . Append ( & btn1 ) ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
promptWindow . SetEffect ( EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN , 50 ) ;
2009-10-01 01:10:58 +02:00
HaltGui ( ) ;
2010-09-24 02:48:03 +02:00
mainWindow - > SetState ( STATE_DISABLED ) ;
mainWindow - > Append ( & promptWindow ) ;
mainWindow - > ChangeFocus ( & promptWindow ) ;
2009-10-01 01:10:58 +02:00
ResumeGui ( ) ;
struct stat st ;
2010-09-24 02:48:03 +02:00
if ( stat ( Settings . TxtCheatcodespath , & st ) ! = 0 )
2010-09-19 01:16:05 +02:00
{
2010-09-25 08:54:27 +02:00
if ( ! CreateSubfolder ( Settings . TxtCheatcodespath ) )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
WindowPrompt ( tr ( " Error ! " ) , tr ( " Can't create directory " ) , tr ( " OK " ) ) ;
2009-10-01 01:10:58 +02:00
ret = - 1 ;
goto exit ;
}
}
2010-09-24 02:48:03 +02:00
while ( ! IsNetworkInit ( ) )
2010-09-19 01:16:05 +02:00
{
2009-10-01 01:10:58 +02:00
VIDEO_WaitVSync ( ) ;
Initialize_Network ( ) ;
2010-09-24 02:48:03 +02:00
if ( IsNetworkInit ( ) )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
msgTxt . SetText ( GetNetworkIP ( ) ) ;
2010-09-19 01:16:05 +02:00
}
else
{
2010-09-24 02:48:03 +02:00
msgTxt . SetText ( tr ( " Could not initialize network! " ) ) ;
2009-10-01 01:10:58 +02:00
}
2010-09-24 02:48:03 +02:00
if ( btn1 . GetState ( ) = = STATE_CLICKED )
2010-09-19 01:16:05 +02:00
{
2009-10-01 01:10:58 +02:00
ret = - 1 ;
btn1 . ResetState ( ) ;
goto exit ;
}
}
2010-09-24 02:48:03 +02:00
if ( IsNetworkInit ( ) & & ret > = 0 )
2010-09-19 01:16:05 +02:00
{
2009-10-01 01:10:58 +02:00
char txtpath [ 150 ] ;
2010-09-24 02:48:03 +02:00
snprintf ( txtpath , sizeof ( txtpath ) , " %s%s.txt " , Settings . TxtCheatcodespath , id ) ;
2009-10-01 01:10:58 +02:00
char codeurl [ 150 ] ;
2010-09-24 02:48:03 +02:00
snprintf ( codeurl , sizeof ( codeurl ) , " http://geckocodes.org/codes/R/%s.txt " , id ) ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
struct block file = downloadfile ( codeurl ) ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
if ( file . size = = 333 | | file . size = = 216 | | file . size = = 284 )
2010-09-19 01:16:05 +02:00
{
2010-09-24 02:48:03 +02:00
strcat ( codeurl , tr ( " is not on the server. " ) ) ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
WindowPrompt ( tr ( " Error " ) , codeurl , tr ( " OK " ) ) ;
2010-09-19 01:16:05 +02:00
ret = - 1 ;
2009-10-01 01:10:58 +02:00
goto exit ;
}
2010-09-24 02:48:03 +02:00
if ( file . data ! = NULL )
2010-09-19 01:16:05 +02:00
{
2009-10-01 01:10:58 +02:00
FILE * pfile ;
2010-09-24 02:48:03 +02:00
pfile = fopen ( txtpath , " wb " ) ;
fwrite ( file . data , 1 , file . size , pfile ) ;
fclose ( pfile ) ;
free ( file . data ) ;
2009-10-01 01:10:58 +02:00
ret = 1 ;
2010-09-24 02:48:03 +02:00
strcat (
txtpath ,
tr ( " has been Saved. The text has not been verified. Some of the code may not work right with each other. If you experience trouble, open the text in a real text editor for more information. " ) ) ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
WindowPrompt ( 0 , txtpath , tr ( " OK " ) ) ;
2010-09-19 01:16:05 +02:00
}
else
{
2010-09-24 02:48:03 +02:00
strcat ( codeurl , tr ( " could not be downloaded. " ) ) ;
2009-10-01 01:10:58 +02:00
2010-09-24 02:48:03 +02:00
WindowPrompt ( tr ( " Error " ) , codeurl , tr ( " OK " ) ) ;
2010-09-19 01:16:05 +02:00
ret = - 1 ;
2009-10-01 01:10:58 +02:00
}
CloseConnection ( ) ;
}
2010-09-24 02:48:03 +02:00
exit : promptWindow . SetEffect ( EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT , 50 ) ;
while ( promptWindow . GetEffect ( ) > 0 )
2010-11-14 16:19:42 +01:00
usleep ( 100 ) ;
2009-10-01 01:10:58 +02:00
HaltGui ( ) ;
2010-09-24 02:48:03 +02:00
mainWindow - > Remove ( & promptWindow ) ;
mainWindow - > SetState ( STATE_DEFAULT ) ;
2009-10-01 01:10:58 +02:00
ResumeGui ( ) ;
return ret ;
}