*Added wiilight settings to turn on/off and install only (issue 211)

*Added DefaultSettings Button and a DefaultGameSettings Button.
*Fixed OGG Menu to not codedump on path change and auto add '/' if not entered like on paths
*Some small fixes
This commit is contained in:
dimok321 2009-05-23 22:23:24 +00:00
parent 5cf5cd6ae7
commit c6fdedb008
10 changed files with 123 additions and 143 deletions

View File

@ -862,6 +862,13 @@ void global_cfg_set(char *name, char *val)
}
return;
}
else if (strcmp(name, "wiilight") == 0) {
int i;
if (sscanf(val, "%d", &i) == 1) {
Settings.wiilight = i;
}
return;
}
}
// split line to part1 delimiter part2
@ -1071,6 +1078,7 @@ bool cfg_save_global()// save global settings
fprintf(f, "godmode = %d\n ", 0);
}
fprintf(f, "ogg_path = %s\n ", CFG.ogg_path);
fprintf(f, "wiilight = %d\n ", Settings.wiilight);
fclose(f);
return true;
}

View File

@ -278,35 +278,29 @@ enum {
dvorak,
euro,
};
/*
enum {
ParentalControlOff,
ParentalControlLevel1,
ParentalControlLevel2,
ParentalControlLevel3
};*/
struct SSettings {
int video;
int language;
int video;
int language;
int ocarina;
int vpatch;
int ios;
int sinfo;
int hddinfo;
int rumble;
int xflip;
int volume;
int sinfo;
int hddinfo;
int rumble;
int xflip;
int volume;
int tooltips;
char unlockCode[20];
int parentalcontrol;
int parentalcontrol;
int cios;
int qboot;
int wsprompt;
int keyset;
int qboot;
int wsprompt;
int keyset;
int unicodefix;
int sort;
int fave;
int sort;
int fave;
int wiilight;
};
void CFG_LoadGlobal(void);

View File

@ -77,6 +77,8 @@ snprintf(LANGUAGE.Doyouwanttoretryfor30secs, sizeof(LANGUAGE.Doyouwanttoretryfor
snprintf(LANGUAGE.Downloadingfile, sizeof(LANGUAGE.Downloadingfile), "Downloading file:");
snprintf(LANGUAGE.DownloadBoxartimage, sizeof(LANGUAGE.DownloadBoxartimage), "Download Boxart image?");
snprintf(LANGUAGE.Downloadfinished, sizeof(LANGUAGE.Downloadfinished), "Download finished");
snprintf(LANGUAGE.Defaultgamesettings, sizeof(LANGUAGE.Defaultgamesettings), "Default Gamesettings");
snprintf(LANGUAGE.Defaultsettings, sizeof(LANGUAGE.Defaultsettings), "Default Settings");
snprintf(LANGUAGE.Error, sizeof(LANGUAGE.Error), "Error !");
snprintf(LANGUAGE.hour, sizeof(LANGUAGE.hour), "Hour");
snprintf(LANGUAGE.Homemenu, sizeof(LANGUAGE.Homemenu), "HOME Menu");
@ -150,6 +152,7 @@ snprintf(LANGUAGE.of, sizeof(LANGUAGE.of), "of");
snprintf(LANGUAGE.OFF, sizeof(LANGUAGE.OFF), "OFF");
snprintf(LANGUAGE.OfficialSite, sizeof(LANGUAGE.OfficialSite), "Official Site");
snprintf(LANGUAGE.ON, sizeof(LANGUAGE.ON), "ON");
snprintf(LANGUAGE.OnlyInstall, sizeof(LANGUAGE.OnlyInstall), "Only for Install");
snprintf(LANGUAGE.Parentalcontrol, sizeof(LANGUAGE.Parentalcontrol), "Parental control");
snprintf(LANGUAGE.Partition, sizeof(LANGUAGE.Partition), "Partition");
snprintf(LANGUAGE.Password, sizeof(LANGUAGE.Password), "Password");
@ -208,6 +211,7 @@ snprintf(LANGUAGE.Waiting, sizeof(LANGUAGE.Waiting), "Waiting...");
snprintf(LANGUAGE.WaitingforUSBDevice, sizeof(LANGUAGE.WaitingforUSBDevice), "Waiting for USB Device");
snprintf(LANGUAGE.WidescreenFix, sizeof(LANGUAGE.WidescreenFix), "Widescreen Fix");
snprintf(LANGUAGE.WiiMenu, sizeof(LANGUAGE.WiiMenu), "Wii Menu");
snprintf(LANGUAGE.Wiilight, sizeof(LANGUAGE.Wiilight), "Wiilight");
snprintf(LANGUAGE.WrongPassword, sizeof(LANGUAGE.WrongPassword), "Wrong Password");
snprintf(LANGUAGE.Yes, sizeof(LANGUAGE.Yes), "Yes");
snprintf(LANGUAGE.YoudonthavecIOS, sizeof(LANGUAGE.YoudonthavecIOS), "You don't have cIOS222");
@ -427,6 +431,14 @@ void language_set(char *name, char *val)
strcopy(LANGUAGE.Downloadfinished, val, sizeof(LANGUAGE.Downloadfinished));
return;
}
if (strcmp(name, "Defaultgamesettings") == 0) {
strcopy(LANGUAGE.Defaultgamesettings, val, sizeof(LANGUAGE.Defaultgamesettings));
return;
}
if (strcmp(name, "Defaultsettings") == 0) {
strcopy(LANGUAGE.Defaultsettings, val, sizeof(LANGUAGE.Defaultsettings));
return;
}
if (strcmp(name, "Error") == 0) {
strcopy(LANGUAGE.Error, val, sizeof(LANGUAGE.Error));
return;
@ -728,6 +740,10 @@ void language_set(char *name, char *val)
strcopy(LANGUAGE.OfficialSite, val, sizeof(LANGUAGE.OfficialSite));
return;
}
if (strcmp(name, "OnlyInstall") == 0) {
strcopy(LANGUAGE.OnlyInstall, val, sizeof(LANGUAGE.OnlyInstall));
return;
}
if (strcmp(name, "ON") == 0) {
strcopy(LANGUAGE.ON, val, sizeof(LANGUAGE.ON));
return;
@ -956,6 +972,10 @@ void language_set(char *name, char *val)
strcopy(LANGUAGE.WiiMenu, val, sizeof(LANGUAGE.WiiMenu));
return;
}
if (strcmp(name, "Wiilight") == 0) {
strcopy(LANGUAGE.Wiilight, val, sizeof(LANGUAGE.Wiilight));
return;
}
if (strcmp(name, "WrongPassword") == 0) {
strcopy(LANGUAGE.WrongPassword, val, sizeof(LANGUAGE.WrongPassword));
return;

View File

@ -59,6 +59,8 @@ struct LANGUAGE
char Downloadingfile[50];
char DownloadBoxartimage[50];
char Downloadfinished[50];
char Defaultgamesettings[50];
char Defaultsettings[40];
char Error[30];
char BOOTERROR[50];
char ErrorreadingDisc[50];
@ -135,6 +137,7 @@ struct LANGUAGE
char OfficialSite[50];
char ok[30];
char ON[30];
char OnlyInstall[50];
char Parentalcontrol[50];
char Partition[50];
char Password[50];
@ -192,6 +195,7 @@ struct LANGUAGE
char WaitingforUSBDevice[80];
char WidescreenFix[50];
char WiiMenu[50];
char Wiilight[20];
char WrongPassword[50];
char Yes[20];
char YoudonthavecIOS[70];

View File

@ -141,27 +141,6 @@ void GuiButton::SetSoundClick(GuiSound * snd)
soundClick = snd;
}
//No delay for now
/*
void GuiButton::SetToolTip(GuiImage* img, GuiText * txt, int x, int y)
{
LOCK(this);
if(img)
{
toolTip = img;
img->SetParent(this);
img->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
img->SetPosition(x,y);
if(txt)
{
toolTipTxt = txt;
txt->SetParent(img);
}
}
}
*/
void GuiButton::SetToolTip(GuiElement* tt, int x, int y, int h_align, int v_align)
{
LOCK(this);
@ -249,11 +228,6 @@ void GuiButton::Update(GuiTrigger * t)
else if(parentElement && parentElement->GetState() == STATE_DISABLED)
return;
// if(state != STATE_SELECTED && toolTip) {
// time2 = 0;
// }
#ifdef HW_RVL
// cursor
if(t->wpad.ir.valid)

View File

@ -206,7 +206,6 @@ void GuiCustomOptionBrowser::SetFocus(int f)
optionBtn[i]->ResetState();
if(f == 1)
optionBtn[selectedItem]->ResetState();
optionBtn[selectedItem]->SetState(STATE_SELECTED);
}

View File

@ -3,31 +3,6 @@
#include "gui.h"
#include "../disc.h"
/*
class GameBrowserList {
public:
GameBrowserList(int size) {
name = new char * [size];
for (int i = 0; i < size; i++)
{
name[i] = new char[50];
}
length = size;
};
~GameBrowserList(){
for (int i = 0; i < length; i++)
{
delete [] name[i];
}
delete [] name;
};
public:
int length;
char ** name;
};
*/
class GuiGameBrowser : public GuiElement
{
@ -69,22 +44,16 @@ class GuiGameBrowser : public GuiElement
GuiImage * scrollbarImg;
GuiImage * arrowDownImg;
GuiImage * arrowDownOverImg;
GuiImage * ttarrowUpImg;
GuiImage * ttarrowDownImg;
GuiImage * arrowUpImg;
GuiImage * arrowUpOverImg;
GuiImage * scrollbarBoxImg;
GuiImage * scrollbarBoxOverImg;
GuiText * ttarrowDownTxt;
GuiText * ttarrowUpTxt;
GuiImageData * bgGames;
GuiImageData * bgGamesEntry;
GuiImageData * scrollbar;
GuiImageData * arrowDown;
GuiImageData * arrowDownOver;
GuiImageData * ttarrow;
GuiImageData * arrowUp;
GuiImageData * arrowUpOver;
GuiImageData * scrollbarBox;

View File

@ -31,7 +31,8 @@
#include "video2.h"
#include "wpad.h"
#include "cfg.h"
#include "language.h"
#include "language.h"
#include "fat.h"
/* Constants */
@ -99,6 +100,7 @@ DefaultSettings()
Settings.xflip = no;
Settings.qboot = no;
Settings.unicodefix = 0;
Settings.wiilight = 1;
CFG_LoadGlobal();
}
@ -134,6 +136,8 @@ main(int argc, char *argv[])
printf("ERROR: cIOS could not be loaded!");
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
}
fatInit(1, true);
SDCard_Init();

View File

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

View File

@ -100,8 +100,9 @@ extern u8 reset;
static vu32 *_wiilight_reg = (u32*)0xCD0000C0;
void wiilight(int enable){ // Toggle wiilight (thanks Bool for wiilight source)
u32 val = (*_wiilight_reg&~0x20);
if(enable) val |= 0x20;
*_wiilight_reg=val;}
if(enable && Settings.wiilight) val |= 0x20;
*_wiilight_reg=val;
}
//Prototypes
int WindowPrompt(const char *title, const char *msg, const char *btn1Label, const char *btn2Label, const char *btn3Label, const char *btn4Label);
@ -2636,6 +2637,7 @@ static int MenuInstall()
sprintf(gametxt, "%s : %.2fGB", name, gamesize);
wiilight(1);
choice = WindowPrompt(LANGUAGE.Continueinstallgame,gametxt,LANGUAGE.ok,LANGUAGE.Cancel,0,0);
if(choice == 1) {
@ -2647,6 +2649,7 @@ static int MenuInstall()
sprintf(errortxt, "%s: %.2fGB, %s: %.2fGB",LANGUAGE.GameSize, gamesize, LANGUAGE.FreeSpace, freespace);
choice = WindowPrompt(LANGUAGE.Notenoughfreespace,errortxt,LANGUAGE.ok, LANGUAGE.Return,0,0);
if (choice == 1) {
wiilight(1);
ret = ProgressWindow(gametxt, name);
if (ret != 0) {
WindowPrompt (LANGUAGE.Installerror,0,LANGUAGE.Back,0,0,0);
@ -2654,11 +2657,10 @@ static int MenuInstall()
break;
}
else {
wiilight(1);
__Menu_GetEntries(); //get the entries again
wiilight(1);
WindowPrompt (LANGUAGE.Successfullyinstalled,name,LANGUAGE.ok,0,0,0);
menu = MENU_DISCLIST;
wiilight(0);
break;
}
} else {
@ -2675,25 +2677,28 @@ static int MenuInstall()
break;
} else {
__Menu_GetEntries(); //get the entries again
wiilight(1);
WindowPrompt (LANGUAGE.Successfullyinstalled,name,LANGUAGE.ok,0,0,0);
menu = MENU_DISCLIST;
wiilight(0);
break;
}
}
} else {
menu = MENU_DISCLIST;
wiilight(0);
break;
}
if (shutdown == 1)
if (shutdown == 1) {
wiilight(0);
Sys_Shutdown();
if(reset == 1)
}
if(reset == 1) {
wiilight(0);
Sys_Reboot();
}
}
//Turn off the WiiLight
wiilight(0);
HaltGui();
@ -3189,7 +3194,7 @@ static int MenuDiscList()
} else {
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtodownloadimages, LANGUAGE.ok, 0,0,0);
}
DownloadBtn.ResetState();
DownloadBtn.ResetState();
gameBrowser.SetFocus(1);
}//end download
@ -3486,7 +3491,7 @@ static int MenuDiscList()
{
returnHere = false;
wiilight(1);
if(Settings.wiilight != 2) wiilight(1);
choice = GameWindowPrompt();
header = &gameList[gameSelected]; //reset header
@ -4108,10 +4113,10 @@ static int MenuSettings()
sprintf(options2.name[2], "%s",LANGUAGE.keyboard);
sprintf(options2.name[3], "%s",LANGUAGE.Unicodefix);
sprintf(options2.name[4], "%s",LANGUAGE.Backgroundmusic);
sprintf(options2.name[5], " ");
sprintf(options2.name[5], "%s",LANGUAGE.Wiilight);
sprintf(options2.name[6], " ");
sprintf(options2.name[7], " ");
sprintf(options2.name[8], "%s",LANGUAGE.MP3Menu);
sprintf(options2.name[7], "%s",LANGUAGE.MP3Menu);
sprintf(options2.name[8], "%s",LANGUAGE.Defaultsettings);
}
while(menu == MENU_NONE)
@ -4513,8 +4518,8 @@ static int MenuSettings()
Settings.keyset = 0;
if ( Settings.unicodefix > 2 )
Settings.unicodefix = 0;
//if ( Settings.sort > 2 )
// Settings.sort = 0;
if ( Settings.wiilight > 2 )
Settings.wiilight = 0;
if (strlen(CFG.titlestxt_path) < (9 + 3)) {
sprintf(cfgtext, "%s", CFG.titlestxt_path);
@ -4556,10 +4561,13 @@ static int MenuSettings()
sprintf(options2.value[4], "%s", cfgtext);
}
sprintf(options2.value[5], " ");
if (Settings.wiilight == 0) sprintf (options2.value[5],"%s",LANGUAGE.OFF);
else if (Settings.wiilight == 1) sprintf (options2.value[5],"%s",LANGUAGE.ON);
else if (Settings.wiilight == 2) sprintf (options2.value[5],"%s",LANGUAGE.OnlyInstall);
sprintf(options2.value[6], " ");
sprintf(options2.value[7], " ");
sprintf(options2.value[8], "not working!");
sprintf(options2.value[7], "not working!");
sprintf(options2.value[8], " ");
ret = optionBrowser2.GetClickedOption();
@ -4662,14 +4670,30 @@ static int MenuSettings()
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtousethatoption, LANGUAGE.ok, 0,0,0);
}
break;
case 8:
if(isSdInserted() == 1) {
case 5:
Settings.wiilight++;
break;
case 7:
if(isSdInserted()) {
menu = MENU_MP3;
pageToDisplay = 0;
} else {
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtousethatoption, LANGUAGE.ok, 0,0,0);
}
break;
case 8:
int choice = WindowPrompt(LANGUAGE.Areyousure, 0, LANGUAGE.Yes, LANGUAGE.Cancel, 0, 0);
if(choice == 1) {
if(isSdInserted()) {
remove("SD:/config/GXGlobal.cfg");
}
lang_default();
CFG_Load();
DefaultSettings();
menu = MENU_SETTINGS;
pageToDisplay = 0;
}
break;
}
}
@ -4820,13 +4844,14 @@ int GameSettings(struct discHdr * header)
strncat(gameName, "...", 3);
}
customOptionList options3(6);
customOptionList options3(7);
sprintf(options3.name[0],"%s", LANGUAGE.VideoMode);
sprintf(options3.name[1],"%s", LANGUAGE.VIDTVPatch);
sprintf(options3.name[2],"%s", LANGUAGE.Language);
sprintf(options3.name[3], "Ocarina");
sprintf(options3.name[4], "IOS");
sprintf(options3.name[5],"Parental Control");//sprintf(options3.name[5],"%s", LANGUAGE.addToFavorite);
sprintf(options3.name[6],"%s", LANGUAGE.Defaultgamesettings);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol);
@ -4921,19 +4946,6 @@ int GameSettings(struct discHdr * header)
mainWindow->Append(&optionBrowser3);
ResumeGui();
//extern u8 favorite;
/*extern u16 count;
struct Game_NUM* game_num = CFG_get_game_num(header->id);
if (game_num)
{
faveChoice = game_num->favorite;
count = game_num->count;//count+=1;
}
else {
faveChoice = no;}*/
struct Game_CFG* game_cfg = CFG_get_game_opt(header->id);
@ -5004,6 +5016,8 @@ int GameSettings(struct discHdr * header)
if(reset == 1)
Sys_Reboot();
sprintf(options3.value[6]," ");
ret = optionBrowser3.GetClickedOption();
switch (ret)
@ -5026,38 +5040,28 @@ int GameSettings(struct discHdr * header)
case 5:
parentalcontrolChoice = (parentalcontrolChoice + 1) % 4;
break;
case 6:
int choice = WindowPrompt(LANGUAGE.Areyousure,0,LANGUAGE.Yes,LANGUAGE.Cancel,0,0);
if(choice == 1) {
videoChoice = discdefault;
viChoice = off;
languageChoice = ConsoleLangDefault;
ocarinaChoice = off;
if(Settings.cios == ios222) {
iosChoice = i222;
} else {
iosChoice = i249;
}
parentalcontrolChoice = 0;
}
break;
}
if(saveBtn.GetState() == STATE_CLICKED)
{
if(isSdInserted() == 1) {
/*//////////save game play count////////////////
extern u8 favorite;
extern u8 count;
struct Game_NUM* game_num = CFG_get_game_num(header->id);
if (game_num)
{
favorite = game_num->favorite;
count = game_num->count;//count+=1;
}favorite = faveChoice;
if(isSdInserted() == 1) {
if (CFG_save_game_num(header->id))
{
//WindowPrompt(LANGUAGE.SuccessfullySaved, 0, LANGUAGE.ok, 0,0,0);
}
else
{
WindowPrompt(LANGUAGE.SaveFailed, 0, LANGUAGE.ok, 0,0,0);
}
} else {
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtosave, LANGUAGE.ok, 0,0,0);
}
*////////////end save play count//////////////
if (CFG_save_game_opt(header->id))
if (CFG_save_game_opt(header->id))
{
WindowPrompt(LANGUAGE.SuccessfullySaved, 0, LANGUAGE.ok, 0,0,0);
}
@ -5428,14 +5432,17 @@ int MenuOGG()
w.Append(&prevBtn);
w.Append(&stopBtn);
if ( result == 1 ) {
int len = (strlen(entered)-1);
if(entered[len] !='/')
strncat (entered, "/", 1);
strncpy(CFG.oggload_path, entered, sizeof(CFG.oggload_path));
WindowPrompt(LANGUAGE.Backgroundmusicpath,0,LANGUAGE.ok,0,0,0);
if(isSdInserted() == 1) {
cfg_save_global();
if(isSdInserted()) {
if(!strcmp("", CFG.oggload_path)) {
sprintf(CFG.ogg_path, "notset");
bgMusic->Play();
}
//cfg_save_global();
menu = MENU_OGG;
break;
} else {