2009-06-01 17:50:18 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* libwiigui Template
|
|
|
|
* Tantric 2009
|
|
|
|
*
|
|
|
|
* demo.cpp
|
|
|
|
* Basic template/demonstration of libwiigui capabilities. For a
|
|
|
|
* full-featured app using many more extensions, check out Snes9x GX.
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#include <gccore.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2009-06-10 01:26:03 +02:00
|
|
|
#include <sys/dir.h>
|
2009-06-01 17:50:18 +02:00
|
|
|
#include <ogcsys.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <wiiuse/wpad.h>
|
|
|
|
|
2009-06-13 02:24:36 +02:00
|
|
|
#include "usbloader/wbfs.h"
|
|
|
|
#include "usbloader/video2.h"
|
|
|
|
#include "settings/cfg.h"
|
|
|
|
#include "language/language.h"
|
|
|
|
#include "mload/mload.h"
|
2009-06-01 17:50:18 +02:00
|
|
|
#include "FreeTypeGX.h"
|
|
|
|
#include "video.h"
|
|
|
|
#include "audio.h"
|
|
|
|
#include "menu.h"
|
|
|
|
#include "input.h"
|
|
|
|
#include "filelist.h"
|
|
|
|
#include "main.h"
|
|
|
|
#include "fatmounter.h"
|
|
|
|
#include "sys.h"
|
|
|
|
#include "wpad.h"
|
|
|
|
#include "fat.h"
|
|
|
|
|
2009-06-13 14:56:24 +02:00
|
|
|
//#define SPECIAL_FOR_ARDI // Fix Problem with Trekstor Classic 250GB
|
2009-06-01 17:50:18 +02:00
|
|
|
|
|
|
|
/* Constants */
|
|
|
|
#define CONSOLE_XCOORD 260
|
|
|
|
#define CONSOLE_YCOORD 115
|
|
|
|
#define CONSOLE_WIDTH 340
|
|
|
|
#define CONSOLE_HEIGHT 218
|
|
|
|
|
|
|
|
FreeTypeGX *fontSystem=0;
|
|
|
|
FreeTypeGX *fontClock=0;
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
2009-05-03 20:53:31 +02:00
|
|
|
s32 ret2;
|
2009-06-13 14:56:24 +02:00
|
|
|
u8 preloaded_ios = 0;
|
|
|
|
#ifdef SPECIAL_FOR_ARDI
|
|
|
|
if( (ret2 = IOS_ReloadIOS(249)) >=0 )
|
|
|
|
preloaded_ios = 249;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( (ret2 = IOS_ReloadIOS(222)) >=0 )
|
|
|
|
{
|
|
|
|
load_ehc_module();
|
|
|
|
preloaded_ios = 222;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2009-06-12 01:02:05 +02:00
|
|
|
|
2009-06-10 01:26:03 +02:00
|
|
|
SDCard_Init(); // mount SD for loading cfg's
|
|
|
|
USBDevice_Init(); // and mount USB:/
|
|
|
|
bool bootDevice_found=false;
|
|
|
|
if(argc >= 1)
|
|
|
|
{
|
|
|
|
if(!strncasecmp(argv[0], "usb:/", 5))
|
|
|
|
{
|
|
|
|
strcpy(bootDevice, "USB:");
|
|
|
|
bootDevice_found = true;
|
|
|
|
}
|
|
|
|
else if(!strncasecmp(argv[0], "sd:/", 4))
|
|
|
|
bootDevice_found = true;
|
|
|
|
}
|
|
|
|
if(!bootDevice_found)
|
|
|
|
{
|
|
|
|
//try USB
|
2009-06-15 17:29:27 +02:00
|
|
|
struct stat st;
|
2009-06-15 17:32:40 +02:00
|
|
|
if((stat("USB:/apps/usbloader_gx/boot.dol", &st) == 0) || (stat("USB:/apps/usbloader_gx/boot.elf", &st) == 0))
|
2009-06-10 01:26:03 +02:00
|
|
|
strcpy(bootDevice, "USB:");
|
|
|
|
}
|
2009-06-01 17:50:18 +02:00
|
|
|
|
2009-05-16 17:38:52 +02:00
|
|
|
lang_default();
|
2009-05-16 21:12:36 +02:00
|
|
|
CFG_Load();
|
2009-05-03 20:53:31 +02:00
|
|
|
|
2009-06-01 17:50:18 +02:00
|
|
|
SDCard_deInit();// unmount SD for reloading IOS
|
2009-06-10 01:26:03 +02:00
|
|
|
USBDevice_deInit();// unmount USB for reloading IOS
|
2009-05-03 20:53:31 +02:00
|
|
|
|
|
|
|
/* Load Custom IOS */
|
2009-06-13 14:56:24 +02:00
|
|
|
if(Settings.cios == ios222 && preloaded_ios != 222) {
|
2009-05-03 20:53:31 +02:00
|
|
|
ret2 = IOS_ReloadIOS(222);
|
2009-06-13 02:24:36 +02:00
|
|
|
load_ehc_module();
|
2009-05-03 20:53:31 +02:00
|
|
|
if (ret2 < 0) {
|
|
|
|
Settings.cios = ios249;
|
|
|
|
ret2 = IOS_ReloadIOS(249);
|
|
|
|
}
|
2009-06-13 14:56:24 +02:00
|
|
|
} else if(preloaded_ios != 249) {
|
2009-05-03 20:53:31 +02:00
|
|
|
ret2 = IOS_ReloadIOS(249);
|
|
|
|
}
|
2009-06-01 17:50:18 +02:00
|
|
|
|
|
|
|
if (ret2 < 0) {
|
|
|
|
printf("ERROR: cIOS could not be loaded!");
|
|
|
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
2009-05-30 18:58:34 +02:00
|
|
|
}
|
2009-06-01 17:50:18 +02:00
|
|
|
|
|
|
|
SDCard_Init(); // now mount SD:/
|
|
|
|
USBDevice_Init(); // and mount USB:/
|
|
|
|
|
|
|
|
Sys_Init();
|
|
|
|
|
2009-06-05 17:43:32 +02:00
|
|
|
/** PAD_Init has to be before InitVideo don't move that **/
|
|
|
|
PAD_Init(); // initialize PAD/WPAD
|
|
|
|
Wpad_Init();
|
|
|
|
|
2009-06-01 17:50:18 +02:00
|
|
|
InitVideo(); // Initialise video
|
|
|
|
InitAudio(); // Initialize audio
|
|
|
|
|
|
|
|
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
|
|
|
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
2009-06-15 17:29:27 +02:00
|
|
|
printf("\n\n load Font\n");
|
2009-06-01 17:50:18 +02:00
|
|
|
fontSystem = new FreeTypeGX();
|
2009-06-15 17:29:27 +02:00
|
|
|
char *fontPath=0;
|
|
|
|
asprintf(&fontPath, "%sfont.ttf", CFG.theme_path);
|
|
|
|
printf(" from: %s\n", fontPath);
|
|
|
|
printf(" 5\n");
|
|
|
|
sleep(1);
|
|
|
|
printf(" 4\n");
|
|
|
|
sleep(1);
|
|
|
|
printf(" 3\n");
|
|
|
|
sleep(1);
|
|
|
|
printf(" 2\n");
|
|
|
|
sleep(1);
|
|
|
|
printf(" 1\n");
|
|
|
|
sleep(1);
|
|
|
|
printf(" 0\n");
|
|
|
|
fontSystem->loadFont(fontPath, font_ttf, font_ttf_size, 0);
|
2009-06-01 17:50:18 +02:00
|
|
|
fontSystem->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
|
2009-06-15 17:29:27 +02:00
|
|
|
free(fontPath);
|
2009-06-01 17:50:18 +02:00
|
|
|
|
|
|
|
fontClock = new FreeTypeGX();
|
2009-06-15 17:29:27 +02:00
|
|
|
fontClock->loadFont(NULL, clock_ttf, clock_ttf_size, 0);
|
2009-06-01 17:50:18 +02:00
|
|
|
fontClock->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
|
|
|
|
|
|
|
|
InitGUIThreads();
|
|
|
|
MainMenu(MENU_CHECK);
|
|
|
|
return 0;
|
|
|
|
}
|