NOTE: this commit requires "make clean" and the new libfat (see Downloads libfat-01-06-2009)

* clean up the wild mounts and unmounts (this and the new libfat fix the download-bug)
* reorganize shutdowns and reboots use now the functions Sys_Reboot(), Sys_Shutdown(), Sys_ShutdownToIdel(), Sys_ShutdownToStandby() and Sys_BackToLoader()
  this functions stops the GUI-Thread, Shutdowns the Audio, Video, WPad and unmounts the SD and USB
This commit is contained in:
ardi@ist-einmalig.de 2009-06-01 15:50:18 +00:00
parent 976ea2041c
commit 904fda37d4
9 changed files with 457 additions and 426 deletions

View File

@ -1,33 +1,31 @@
#include <fat.h>
#include <sys/dir.h>
#include <sys/iosupport.h>
#include <ogc/lwp_watchdog.h>
#include <ogc/mutex.h>
#include <ogc/system.h>
#include <ogc/usbstorage.h>
#include <sdcard/wiisd_io.h>
#define CACHE 32
#define SECTORS 128
#define CACHE 4
#define SECTORS 64
int USBDevice_Init()
{
//right now only mounts first partition and only under IOS36
__io_usbstorage.startup();
//closing all open Files write back the cache and then shutdown em!
fatUnmount("USB:/");
//right now only mounts first partition
if (fatMount("USB", &__io_usbstorage, 0, CACHE, SECTORS)) {
return 1;
}
return -1;
return -1;
}
void USBDevice_deInit()
{
//First unmount all the devs...
//closing all open Files write back the cache and then shutdown em!
fatUnmount("USB:/");
//...and then shutdown em!
__io_usbstorage.shutdown();
}
int isSdInserted()
@ -37,21 +35,16 @@ int isSdInserted()
int SDCard_Init()
{
//mount SD if inserted
__io_wiisd.startup();
if (!isSdInserted()){
return -1;
}
if (fatMount("SD", &__io_wiisd, 0, CACHE, SECTORS)) {
//closing all open Files write back the cache and then shutdown em!
fatUnmount("SD:/");
//right now only mounts first partition
if (fatMount("SD", &__io_wiisd, 0, CACHE, SECTORS))
return 1;
}
return -1;
return -1;
}
void SDCard_deInit()
{
//First unmount all the devs...
//closing all open Files write back the cache and then shutdown em!
fatUnmount("SD:/");
//...and then shutdown em!
__io_wiisd.shutdown();
}

View File

@ -73,7 +73,7 @@ u32 do_sd_code(char *filename)
fp = fopen(filepath, "rb");
if (!fp) {
fatUnmount("SD");
fatUnmount("SD:/");
__io_wiisd.shutdown();
return 0;
}
@ -93,7 +93,7 @@ u32 do_sd_code(char *filename)
if(ret != filesize){
free(filebuff);
fclose(fp);
fatUnmount("SD");
fatUnmount("SD:/");
__io_wiisd.shutdown();
return 0;
}
@ -106,7 +106,7 @@ u32 do_sd_code(char *filename)
free(filebuff);
fclose(fp);
fatUnmount("SD");
fatUnmount("SD:/");
__io_wiisd.shutdown();
return 1;

View File

@ -1,5 +1,4 @@
#include "gui.h"
extern int SetValue(int i, const char *format, ...) __attribute__((format(printf,2,3)));
class customOptionList {
public:

View File

@ -43,7 +43,6 @@
FreeTypeGX *fontSystem=0;
FreeTypeGX *fontClock=0;
int ExitRequested = 0;
bool netcheck = false;
@ -64,21 +63,6 @@ int Net_Init(char *ip){
return TRUE;
}
void ExitApp()
{
ShutoffRumble();
StopGX();
ShutdownAudio();
if(isSdInserted())
SDCard_deInit();
//WPAD_Flush(0);
//WPAD_Disconnect(0);
//WPAD_Shutdown();
//exit(0);
}
void
DefaultSettings()
{
@ -107,6 +91,9 @@ DefaultSettings()
CFG_LoadGlobal();
}
// check for libfat.a from 1. Jun 2009
extern int LibFat4USB_Loader_GX;
int fatCheck = LibFat4USB_Loader_GX; // remove when libfat newer than 1. Jun 2009
int
main(int argc, char *argv[])
@ -114,14 +101,14 @@ main(int argc, char *argv[])
s32 ret2;
SDCard_Init();
SDCard_Init(); // mount SD for loading cfg's
lang_default();
CFG_Load();
DefaultSettings();
SDCard_deInit();
SDCard_deInit();// unmount SD for reloading IOS
/* Load Custom IOS */
if(Settings.cios == ios222) {
@ -139,17 +126,18 @@ main(int argc, char *argv[])
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
}
SDCard_Init();
SDCard_Init(); // now mount SD:/
USBDevice_Init(); // and mount USB:/
Sys_Init();
//Video_SetMode();
//Con_Init(CONSOLE_XCOORD, CONSOLE_YCOORD, CONSOLE_WIDTH, CONSOLE_HEIGHT);
//Wpad_Init();
PAD_Init();
InitVideo(); // Initialise video
InitAudio(); // Initialize audio
PAD_Init(); // initialize PAD/WPAD
Wpad_Init();
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
fontSystem = new FreeTypeGX();
fontSystem->loadFont(font_ttf, font_ttf_size, 0);

View File

@ -12,9 +12,7 @@
extern struct SSettings Settings;
void ExitApp();
void DefaultSettings();
extern int ExitRequested;
extern FreeTypeGX *fontSystem;
extern bool netcheck;
extern int Net_Init(char *ip);

View File

@ -19,6 +19,7 @@
#include "libwiigui/gui.h"
#include "menu.h"
#include "main.h"
#include "audio.h"
#include "input.h"
#include "http.h"
#include "dns.h"
@ -66,6 +67,7 @@ static s32 gameSelected = 0, gameStart = 0;
static GuiWindow * mainWindow = NULL;
static lwp_t guithread = LWP_THREAD_NULL;
static bool guiHalt = true;
static int ExitRequested = 0;
static GuiImageData progressbar(progressbar_png);
static GuiImage progressbarImg(&progressbar);
int godmode = 0;
@ -404,15 +406,15 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label,
dialogBoxImg.SetWidescreen(CFG.widescreen);
}
GuiText titleTxt(title, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText titleTxt(title, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt.SetPosition(0,55);
GuiText msgTxt(msg, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText msgTxt(msg, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
msgTxt.SetPosition(0,-40);
msgTxt.SetMaxWidth(430);
GuiText btn1Txt(btn1Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText btn1Txt(btn1Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes){
btn1Txt.SetWidescreen(CFG.widescreen);
@ -423,7 +425,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label,
btn1.SetLabel(&btn1Txt);
btn1.SetState(STATE_SELECTED);
GuiText btn2Txt(btn2Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText btn2Txt(btn2Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
GuiImage btn2Img(&btnOutline);
if (Settings.wsprompt == yes){
btn2Txt.SetWidescreen(CFG.widescreen);
@ -434,7 +436,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label,
if(!btn3Label && !btn4Label)
btn2.SetTrigger(&trigB);
GuiText btn3Txt(btn3Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText btn3Txt(btn3Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
GuiImage btn3Img(&btnOutline);
if (Settings.wsprompt == yes){
btn3Txt.SetWidescreen(CFG.widescreen);
@ -445,7 +447,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label,
if(!btn4Label)
btn3.SetTrigger(&trigB);
GuiText btn4Txt(btn4Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText btn4Txt(btn4Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
GuiImage btn4Img(&btnOutline);
if (Settings.wsprompt == yes){
btn4Txt.SetWidescreen(CFG.widescreen);
@ -985,7 +987,7 @@ int GameWindowPrompt()
GuiTooltip nameBtnTT(LANGUAGE.RenameGameonWBFS);
if (Settings.wsprompt == yes)
nameBtnTT.SetWidescreen(CFG.widescreen);
GuiText nameTxt("", 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{50, 50, 50, 255});
GuiText nameTxt("", 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
if (Settings.wsprompt == yes)
nameTxt.SetWidescreen(CFG.widescreen);
nameTxt.SetMaxWidth(350, GuiText::SCROLL);
@ -1003,7 +1005,7 @@ int GameWindowPrompt()
nameBtn.SetEffectGrow();
}
GuiText sizeTxt(NULL, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{50, 50, 50, 255}); //TODO: get the size here
GuiText sizeTxt(NULL, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //TODO: get the size here
sizeTxt.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
sizeTxt.SetPosition(-60,70);
@ -1033,7 +1035,7 @@ int GameWindowPrompt()
btn1.SetTrigger(&trigA);
btn1.SetState(STATE_SELECTED);
GuiText btn2Txt(LANGUAGE.Back, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText btn2Txt(LANGUAGE.Back, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
GuiImage btn2Img(&btnOutline);
if (Settings.wsprompt == yes){
btn2Txt.SetWidescreen(CFG.widescreen);
@ -1054,7 +1056,7 @@ int GameWindowPrompt()
btn2.SetLabel(&btn2Txt);
btn2.SetTrigger(&trigB);
GuiText btn3Txt(LANGUAGE.settings, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText btn3Txt(LANGUAGE.settings, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
GuiImage btn3Img(&btnOutline);
if (Settings.wsprompt == yes){
btn3Txt.SetWidescreen(CFG.widescreen);
@ -1454,15 +1456,15 @@ DiscWait(const char *title, const char *msg, const char *btn1Label, const char *
dialogBoxImg.SetWidescreen(CFG.widescreen);
}
GuiText titleTxt(title, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText titleTxt(title, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt.SetPosition(0,60);
GuiText msgTxt(msg, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText msgTxt(msg, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
msgTxt.SetPosition(0,-40);
msgTxt.SetMaxWidth(430);
GuiText btn1Txt(btn1Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText btn1Txt(btn1Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes){
btn1Txt.SetWidescreen(CFG.widescreen);
@ -1485,7 +1487,7 @@ DiscWait(const char *title, const char *msg, const char *btn1Label, const char *
btn1.SetTrigger(&trigB);
btn1.SetState(STATE_SELECTED);
GuiText btn2Txt(btn2Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText btn2Txt(btn2Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
GuiImage btn2Img(&btnOutline);
if (Settings.wsprompt == yes){
btn2Txt.SetWidescreen(CFG.widescreen);
@ -1509,7 +1511,7 @@ DiscWait(const char *title, const char *msg, const char *btn1Label, const char *
}
}
GuiText timerTxt(NULL, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText timerTxt(NULL, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
timerTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
timerTxt.SetPosition(0,160);
@ -1531,12 +1533,10 @@ DiscWait(const char *title, const char *msg, const char *btn1Label, const char *
mainWindow->ChangeFocus(&promptWindow);
ResumeGui();
SDCard_deInit();
if(IsDeviceWait) {
while(i >= 0)
{
timerTxt.SetTextf("%u%s", i,LANGUAGE.secondsleft);
timerTxt.SetTextf("%u %s", i,LANGUAGE.secondsleft);
VIDEO_WaitVSync();
if(Settings.cios == ios222) {
ret = IOS_ReloadIOS(222);
@ -1599,7 +1599,7 @@ FormatingPartition(const char *title, partitionEntry *entry)
dialogBoxImg.SetWidescreen(CFG.widescreen);
}
GuiText titleTxt(title, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText titleTxt(title, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt.SetPosition(0,60);
@ -1657,16 +1657,16 @@ int NetworkInitPromp(int choice2)
dialogBoxImg.SetWidescreen(CFG.widescreen);
}
GuiText titleTxt(LANGUAGE.InitializingNetwork, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText titleTxt(LANGUAGE.InitializingNetwork, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt.SetPosition(0,60);
char msg[20] = " ";
GuiText msgTxt(msg, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText msgTxt(msg, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
msgTxt.SetPosition(0,-40);
GuiText btn1Txt(LANGUAGE.Cancel, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText btn1Txt(LANGUAGE.Cancel, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes){
btn1Txt.SetWidescreen(CFG.widescreen);
@ -1869,14 +1869,14 @@ ProgressWindow(const char *title, const char *msg)
progressbarImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
progressbarImg.SetPosition(25, 40);
GuiText titleTxt(title, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText titleTxt(title, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt.SetPosition(0,60);
GuiText msgTxt(msg, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText msgTxt(msg, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
msgTxt.SetPosition(0,120);
GuiText prsTxt("%", 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText prsTxt("%", 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
prsTxt.SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
prsTxt.SetPosition(-188,40);
@ -1989,22 +1989,22 @@ ProgressDownloadWindow(int choice2)
progressbarImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
progressbarImg.SetPosition(25, 40);
GuiText titleTxt(LANGUAGE.Downloadingfile, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText titleTxt(LANGUAGE.Downloadingfile, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt.SetPosition(0,60);
GuiText msgTxt(NULL, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText msgTxt(NULL, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
msgTxt.SetPosition(0,130);
GuiText msg2Txt(NULL, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText msg2Txt(NULL, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
msg2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
msg2Txt.SetPosition(0,100);
prTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
prTxt.SetPosition(0, 40);
GuiText btn1Txt(LANGUAGE.Cancel, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText btn1Txt(LANGUAGE.Cancel, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes){
btn1Txt.SetWidescreen(CFG.widescreen);
@ -2060,14 +2060,19 @@ ProgressDownloadWindow(int choice2)
}
}
while (i < cntMissFiles) {
while (i < cntMissFiles)
{
prTxt.SetTextf("%i%%", 100*i/cntMissFiles);
if ((Settings.wsprompt == yes) && (CFG.widescreen)){/////////////adjust for widescreen
if ((Settings.wsprompt == yes) && (CFG.widescreen))
{
//adjust for widescreen
progressbarImg.SetPosition(80,40);
progressbarImg.SetTile(80*i/cntMissFiles);
} else {
}
else
{
progressbarImg.SetTile(100*i/cntMissFiles);
}
@ -2077,15 +2082,18 @@ ProgressDownloadWindow(int choice2)
//download boxart image
char imgPath[100];
char URLFile[100];
if (choice2 == 2) {
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) {
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) {
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]);
}
@ -2095,29 +2103,32 @@ ProgressDownloadWindow(int choice2)
if (file.size == 36864 || file.size <= 1024 || file.size == 7386 || file.data == NULL) {
cntNotFound++;
i++;
} else {
}
else
{
if(file.data != NULL)
{
// save png to sd card
FILE *pfile;
pfile = fopen(imgPath, "wb");
FILE *pfile=NULL;
if((pfile = fopen(imgPath, "wb"))!=NULL)
{
fwrite(file.data,1,file.size,pfile);
fclose (pfile);
}
free(file.data);
}
i++;
}
if(btn1.GetState() == STATE_CLICKED) {
if(btn1.GetState() == STATE_CLICKED)
{
cntNotFound = cntMissFiles-i+cntNotFound;
break;
}
}
/**Temporary redownloading 1st image because of a fucking corruption bug **/
/*
char URLFile[100];
if (choice2 == 2) {
sprintf(URLFile,"http://www.theotherzone.com/wii/3d/176/248/%s",missingFiles[0]); // For 3D Covers
@ -2146,7 +2157,7 @@ ProgressDownloadWindow(int choice2)
free(file.data);
}
}
*/
HaltGui();
mainWindow->Remove(&promptWindow);
@ -2218,23 +2229,23 @@ ProgressUpdateWindow()
char title[50];
sprintf(title, "%s", LANGUAGE.CheckingforUpdates);
GuiText titleTxt(title, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText titleTxt(title, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt.SetPosition(0,50);
char msg[50];
sprintf(msg, "%s", LANGUAGE.InitializingNetwork);
GuiText msgTxt(msg, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText msgTxt(msg, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
msgTxt.SetPosition(0,140);
char msg2[50] = " ";
GuiText msg2Txt(msg2, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText msg2Txt(msg2, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
msg2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
msg2Txt.SetPosition(0, 50);
prTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
prTxt.SetPosition(0, 7);
GuiText btn1Txt(LANGUAGE.Cancel, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText btn1Txt(LANGUAGE.Cancel, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes){
btn1Txt.SetWidescreen(CFG.widescreen);
@ -2314,10 +2325,10 @@ ProgressUpdateWindow()
int revnumber = 0;
int currentrev = atoi(SVN_REV);
SDCard_deInit();
/// SDCard_deInit();
struct block file = downloadfile("http://www.techjawa.com/usbloadergx/rev.txt");
FILE *pfile;
SDCard_Init();
/// SDCard_Init();
if(file.data != NULL)
{
@ -2442,9 +2453,7 @@ ProgressUpdateWindow()
if(!failed && ret >= 0) {
WindowPrompt(LANGUAGE.Successfullyupdated , LANGUAGE.Restarting, LANGUAGE.ok, 0, 0, 0);
ExitApp();
if (*((u32*) 0x80001800)) exit(0);
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
Sys_BackToLoader();
}
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
@ -2514,13 +2523,14 @@ UpdateGUI (void *arg)
if(ExitRequested)
{
for(int a = 0; a < 255; a += 15)
for(int a = 5; a < 255; a += 10)
{
mainWindow->Draw();
Menu_DrawRectangle(0,0,screenwidth,screenheight,(GXColor){0, 0, 0, a},1);
Menu_Render();
}
ExitApp();
ShutoffRumble();
return 0;
}
}
}
@ -2537,7 +2547,12 @@ InitGUIThreads()
{
LWP_CreateThread (&guithread, UpdateGUI, NULL, NULL, 0, 70);
}
void
ExitGUIThreads()
{
ExitRequested = 1;
LWP_JoinThread(guithread, NULL);
}
/****************************************************************************
* EntryCmp
***************************************************************************/
@ -2732,7 +2747,7 @@ static int OnScreenKeyboard(char * var, u32 maxlen, int min)
GuiTrigger trigB;
trigB.SetSimpleTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
GuiText okBtnTxt(LANGUAGE.ok, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText okBtnTxt(LANGUAGE.ok, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
GuiImage okBtnImg(&btnOutline);
if (Settings.wsprompt == yes){
okBtnTxt.SetWidescreen(CFG.widescreen);
@ -2740,7 +2755,7 @@ static int OnScreenKeyboard(char * var, u32 maxlen, int min)
}
GuiButton okBtn(&okBtnImg,&okBtnImg, 0, 4, 5, 15, &trigA, &btnSoundOver, &btnClick,1);
okBtn.SetLabel(&okBtnTxt);
GuiText cancelBtnTxt(LANGUAGE.Cancel, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText cancelBtnTxt(LANGUAGE.Cancel, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
GuiImage cancelBtnImg(&btnOutline);
if (Settings.wsprompt == yes){
cancelBtnTxt.SetWidescreen(CFG.widescreen);
@ -2949,8 +2964,8 @@ static int MenuInstall()
mainWindow->Remove(&w);
ResumeGui();
SDCard_deInit();
SDCard_Init();
/// SDCard_deInit();
/// SDCard_Init();
return menu;
}
@ -3371,22 +3386,9 @@ static int MenuDiscList()
choice = WindowPrompt(LANGUAGE.HowtoShutdown,0,LANGUAGE.FullShutdown, LANGUAGE.ShutdowntoIdle, LANGUAGE.Cancel,0);
if(choice == 2)
{
WPAD_Flush(0);
WPAD_Disconnect(0);
WPAD_Shutdown();
/* Set LED mode */
ret = CONF_GetIdleLedMode();
if(ret >= 0 && ret <= 2)
STM_SetLedMode(ret);
STM_ShutdownToIdle();
Sys_ShutdownToIdel();
} else if(choice == 1) {
WPAD_Flush(0);
WPAD_Disconnect(0);
WPAD_Shutdown();
STM_ShutdownToStandby();
Sys_ShutdownToStandby();
} else {
poweroffBtn.ResetState();
if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);}
@ -3410,15 +3412,11 @@ static int MenuDiscList()
if(choice == 3)
{
ExitApp();
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); // Back to System Menu
Sys_LoadMenu(); // Back to System Menu
}
else if (choice == 2)
{
ExitApp();
if (*((u32*) 0x80001800)) exit(0);
// Channel Version
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
Sys_BackToLoader();
} else {
homeBtn.ResetState();
if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);}
@ -3995,28 +3993,22 @@ static int MenuDiscList()
}
// 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) {
if(networkisinitialized == 1 || ios2 == 1 || Settings.cios == ios222)
{
if(ios2 == 1)
{
ret = Sys_IosReload(222);
if(ret < 0) {
Wpad_Init();
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
if(ret < 0)
{
WindowPrompt(LANGUAGE.YoudonthavecIOS,LANGUAGE.LoadingincIOS,LANGUAGE.ok, 0,0,0);
Sys_IosReload(249);
ios2 = 0;
}
} else {
}
else
{
ret = Sys_IosReload(249);
}
}
@ -4089,28 +4081,21 @@ static int MenuDiscList()
}
// 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) {
if(networkisinitialized == 1 || ios2 == 1 || Settings.cios == ios222)
{
if(ios2 == 1)
{
ret = Sys_IosReload(222);
if(ret < 0) {
Wpad_Init();
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
if(ret < 0)
{
WindowPrompt(LANGUAGE.YoudonthavecIOS,LANGUAGE.LoadingincIOS,LANGUAGE.ok, 0,0,0);
Sys_IosReload(249);
ios2 = 0;
}
} else {
}
else
{
ret = Sys_IosReload(249);
}
}
@ -4191,6 +4176,7 @@ static int MenuDiscList()
static int MenuFormat()
{
USBDevice_deInit();
int menu = MENU_NONE;
char imgPath[100];
@ -4386,9 +4372,6 @@ static int MenuFormat()
choice = WindowPrompt (LANGUAGE.ShutdownSystem,LANGUAGE.Areyousure,LANGUAGE.Yes,LANGUAGE.No,0,0);
if(choice == 1)
{
WPAD_Flush(0);
WPAD_Disconnect(0);
WPAD_Shutdown();
Sys_Shutdown();
}
@ -4397,8 +4380,7 @@ static int MenuFormat()
choice = WindowPrompt (LANGUAGE.ReturntoWiiMenu,LANGUAGE.Areyousure,LANGUAGE.Yes,LANGUAGE.No,0,0);
if(choice == 1)
{
ExitApp();
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
Sys_LoadMenu();
}
}
}
@ -4419,6 +4401,7 @@ static int MenuFormat()
mainWindow->Remove(&optionBrowser);
mainWindow->Remove(&w);
ResumeGui();
USBDevice_Init();
return menu;
}
@ -4474,7 +4457,7 @@ static int MenuSettings()
settingsbackgroundbtn.SetPosition(0, 0);
settingsbackgroundbtn.SetImage(&settingsbackground);
GuiText backBtnTxt(LANGUAGE.Back , 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText backBtnTxt(LANGUAGE.Back , 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage backBtnImg(&btnOutline);
if (Settings.wsprompt == yes){
@ -5420,15 +5403,11 @@ static int MenuSettings()
if(choice == 3)
{
ExitApp();
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); // Back to System Menu
Sys_LoadMenu(); // Back to System Menu
}
else if (choice == 2)
{
ExitApp();
if (*((u32*) 0x80001800)) exit(0);
// Channel Version
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
Sys_BackToLoader();
}
else
{
@ -5514,7 +5493,7 @@ int GameSettings(struct discHdr * header)
settingsbackgroundbtn.SetPosition(0, 0);
settingsbackgroundbtn.SetImage(&settingsbackground);
GuiText saveBtnTxt(LANGUAGE.Save, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText saveBtnTxt(LANGUAGE.Save, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
saveBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage saveBtnImg(&btnOutline);
if (Settings.wsprompt == yes){
@ -5524,7 +5503,7 @@ int GameSettings(struct discHdr * header)
saveBtn.SetScale(0.9);
saveBtn.SetLabel(&saveBtnTxt);
GuiText cancelBtnTxt(LANGUAGE.Back, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText cancelBtnTxt(LANGUAGE.Back, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage cancelBtnImg(&btnOutline);
if (Settings.wsprompt == yes){
@ -5535,7 +5514,7 @@ int GameSettings(struct discHdr * header)
cancelBtn.SetLabel(&cancelBtnTxt);
cancelBtn.SetTrigger(&trigB);
GuiText deleteBtnTxt(LANGUAGE.Uninstall, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
GuiText deleteBtnTxt(LANGUAGE.Uninstall, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
deleteBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage deleteBtnImg(&btnOutline);
if (Settings.wsprompt == yes){
@ -5752,7 +5731,7 @@ static int MenuCheck()
int menu = MENU_NONE;
int i = 0;
int choice;
s32 ret2;
s32 ret, ret2;
OptionList options;
options.length = i;
partitionEntry partitions[MAX_PARTITIONS];
@ -5762,87 +5741,92 @@ static int MenuCheck()
ret2 = WBFS_Init(WBFS_DEVICE_USB);
if (ret2 < 0)
{
//initialize WiiMote for Prompt
Wpad_Init();
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
ret2 = WindowPrompt(LANGUAGE.NoUSBDevicefound,
LANGUAGE.Doyouwanttoretryfor30secs,
"cIOS249", "cIOS222",
LANGUAGE.BacktoWiiMenu, 0);
//shutdown SD
SDCard_deInit();
if(ret2 == 1) {
Settings.cios = ios249;
} else if(ret2 == 2) {
Settings.cios = ios222;
} else {
ExitApp();
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
}
if(Settings.cios != ios222)
{
//shutdown WiiMote before IOS Reload
WPAD_Flush(0);
WPAD_Disconnect(0);
WPAD_Shutdown();
SDCard_Init();
ret2 = DiscWait(LANGUAGE.NoUSBDevice, LANGUAGE.WaitingforUSBDevice, 0, 0, 1);
//shutdown SD and USB before IOS Reload
SDCard_deInit();
USBDevice_deInit();
ret = IOS_ReloadIOS(222);
if(ret < 0)
IOS_ReloadIOS(249);
//reinitialize WiiMote for Prompt
PAD_Init();
Wpad_Init();
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
//reinitialize SD and USB
SDCard_Init();
USBDevice_Init();
if(ret < 0)
WindowPrompt(LANGUAGE.YoudonthavecIOS,LANGUAGE.LoadingincIOS,LANGUAGE.ok, 0,0,0);
else
Settings.cios = ios222;
}
} else {
Sys_LoadMenu();
}
//shutdown WiiMote before IOS Reload
WPAD_Flush(0);
WPAD_Disconnect(0);
WPAD_Shutdown();
//shutdown SD and USB before IOS Reload in DiscWait
SDCard_deInit();
USBDevice_deInit();
ret2 = DiscWait(LANGUAGE.NoUSBDevice, LANGUAGE.WaitingforUSBDevice, 0, 0, 1);
//reinitialize WiiMote for Prompt
PAD_Init();
Wpad_Init();
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
//reinitialize SD and USB
SDCard_Init();
USBDevice_Init();
}
if (ret2 < 0) {
SDCard_Init();
WindowPrompt (LANGUAGE.Error,LANGUAGE.USBDevicenotfound, LANGUAGE.ok, 0,0,0);
SDCard_deInit();
ExitApp();
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);
SDCard_Init();
Sys_LoadMenu();
}
ret2 = Disc_Init();
if (ret2 < 0) {
SDCard_Init();
WindowPrompt (LANGUAGE.Error,LANGUAGE.CouldnotinitializeDIPmodule,LANGUAGE.ok, 0,0,0);
SDCard_deInit();
ExitApp();
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
Sys_LoadMenu();
}
ret2 = WBFS_Open();
if (ret2 < 0) {
SDCard_Init();
choice = WindowPrompt(LANGUAGE.NoWBFSpartitionfound,
LANGUAGE.Youneedtoformatapartition,
LANGUAGE.Format,
LANGUAGE.Return,0,0);
SDCard_deInit();
if(choice == 0)
{
ExitApp();
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
Sys_LoadMenu();
} else {
/* Get partition entries */
u32 sector_size;
ret2 = Partition_GetEntries(partitions, &sector_size);
if (ret2 < 0) {
SDCard_Init();
WindowPrompt (LANGUAGE.Nopartitionsfound,0, LANGUAGE.Restart, 0,0,0);
SDCard_deInit();
ExitApp();
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
Sys_LoadMenu();
}
menu = MENU_FORMAT;
}
}
@ -6302,6 +6286,7 @@ int MainMenu(int menu)
break;
}
}
ExitGUIThreads();
bgMusic->Stop();
@ -6319,7 +6304,11 @@ int MainMenu(int menu)
delete cover;
delete coverImg;
ExitApp();
StopGX();
ShutdownAudio();
SDCard_deInit();
USBDevice_deInit();
struct discHdr *header = &gameList[gameSelected];
struct Game_CFG* game_cfg = CFG_get_game_opt(header->id);
@ -6461,8 +6450,7 @@ int MainMenu(int menu)
int ret = 0;
ret = Disc_WiiBoot(videoselected, cheat, vipatch, Settings.patchcountrystrings);
if (ret < 0) {
ExitApp();
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
Sys_LoadMenu();
}
return 0;

View File

@ -11,7 +11,16 @@
#include <ogcsys.h>
void InitGUIThreads();
#ifdef __cplusplus
//extern "C"
//{
#endif
void InitGUIThreads(void);
void ExitGUIThreads(void);
#ifdef __cplusplus
//}
#endif
int MainMenu (int menuitem);
void wiilight(int enable);
int GameSettings(struct discHdr *);

View File

@ -8,6 +8,8 @@
#include "disc.h"
#include "wbfs.h"
#include "video.h"
#include "audio.h"
#include "menu.h"
#include "fatmounter.h"
/* Constants */
@ -41,9 +43,21 @@ void Sys_Init(void)
SYS_SetPowerCallback(__Sys_PowerCallback);
}
static void _ExitApp()
{
ExitGUIThreads();
StopGX();
ShutdownAudio();
SDCard_deInit();
USBDevice_deInit();
}
void Sys_Reboot(void)
{
/* Restart console */
_ExitApp();
STM_RebootSystem();
}
@ -51,8 +65,9 @@ int Sys_IosReload(int IOS)
{
s32 ret;
if(isSdInserted())
//shutdown SD and USB before IOS Reload in DiscWait
SDCard_deInit();
USBDevice_deInit();
WPAD_Flush(0);
WPAD_Disconnect(0);
@ -62,35 +77,49 @@ int Sys_IosReload(int IOS)
USBStorage_Deinit();
__IOS_ShutdownSubsystems();
ret = IOS_ReloadIOS(IOS);
if(ret < 0) {
return ret;
}
PAD_Init();
Wpad_Init();
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
if(IOS == 249 || IOS == 222) {
if(ret < 0) {
return ret;
}
if(IOS == 249 || IOS == 222 || IOS == 223) {
ret = WBFS_Init(WBFS_DEVICE_USB);
if(ret>=0)
{
ret = Disc_Init();
if(ret>=0)
ret = WBFS_Open();
}
}
//reinitialize SD and USB
SDCard_Init();
USBDevice_Init();
return ret;
}
void Sys_Shutdown(void)
#define ShutdownToDefault 0
#define ShutdownToIdle 1
#define ShutdownToStandby 2
static void _Sys_Shutdown(int SHUTDOWN_MODE)
{
Wpad_Disconnect();
_ExitApp();
WPAD_Flush(0);
WPAD_Disconnect(0);
WPAD_Shutdown();
/* Poweroff console */
if(CONF_GetShutdownMode() == CONF_SHUTDOWN_IDLE) {
if((CONF_GetShutdownMode() == CONF_SHUTDOWN_IDLE && SHUTDOWN_MODE != ShutdownToStandby) || SHUTDOWN_MODE == ShutdownToIdle) {
s32 ret;
/* Set LED mode */
@ -105,13 +134,37 @@ void Sys_Shutdown(void)
STM_ShutdownToStandby();
}
}
void Sys_Shutdown(void)
{
_Sys_Shutdown(ShutdownToDefault);
}
void Sys_ShutdownToIdel(void)
{
_Sys_Shutdown(ShutdownToIdle);
}
void Sys_ShutdownToStandby(void)
{
_Sys_Shutdown(ShutdownToStandby);
}
void Sys_LoadMenu(void)
{
_ExitApp();
/* Return to the Wii system menu */
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
}
void Sys_BackToLoader(void)
{
if (*((u32*) 0x80001800))
{
_ExitApp();
exit(0);
}
// Channel Version
Sys_LoadMenu();
}
s32 Sys_GetCerts(signed_blob **certs, u32 *len)
{
static signed_blob certificates[CERTS_LEN] ATTRIBUTE_ALIGN(32);

View File

@ -3,18 +3,21 @@
#ifdef __cplusplus
extern "C"
{
//{
#endif
/* Prototypes */
void Sys_Init(void);
void Sys_Reboot(void);
void Sys_Shutdown(void);
void Sys_ShutdownToIdel(void);
void Sys_ShutdownToStandby(void);
void Sys_LoadMenu(void);
void Sys_BackToLoader(void);
int Sys_IosReload(int IOS);
s32 Sys_GetCerts(signed_blob **, u32 *);
#ifdef __cplusplus
}
//}
#endif
#endif